@microsoft/agents-copilotstudio-client 1.1.1 → 1.1.4-g8d884129e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +2 -2
- package/dist/src/browser.mjs +5 -5
- package/dist/src/browser.mjs.map +3 -3
- package/dist/src/copilotStudioClient.js +28 -2
- package/dist/src/copilotStudioClient.js.map +1 -1
- package/dist/src/copilotStudioWebChat.js +12 -7
- package/dist/src/copilotStudioWebChat.js.map +1 -1
- package/package.json +2 -2
- package/src/copilotStudioClient.ts +27 -0
- package/src/copilotStudioWebChat.ts +13 -7
package/dist/src/browser.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var Ss=Object.create;var co=Object.defineProperty;var As=Object.getOwnPropertyDescriptor;var Os=Object.getOwnPropertyNames;var Ps=Object.getPrototypeOf,Zs=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var js=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Os(e))!Zs.call(t,o)&&o!==r&&co(t,o,{get:()=>e[o],enumerable:!(n=As(e,o))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Ss(Ps(t)):{},js(e||!t||!t.__esModule?co(r,"default",{value:t,enumerable:!0}):r,t));var ho=y((Xd,po)=>{var Ge=1e3,Ye=Ge*60,Xe=Ye*60,Te=Xe*24,zs=Te*7,Ls=Te*365.25;po.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Fs(t);if(r==="number"&&isFinite(t))return e.long?Vs(t):qs(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Fs(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Ls;case"weeks":case"week":case"w":return r*zs;case"days":case"day":case"d":return r*Te;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Xe;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ye;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ge;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function qs(t){var e=Math.abs(t);return e>=Te?Math.round(t/Te)+"d":e>=Xe?Math.round(t/Xe)+"h":e>=Ye?Math.round(t/Ye)+"m":e>=Ge?Math.round(t/Ge)+"s":t+"ms"}function Vs(t){var e=Math.abs(t);return e>=Te?nr(t,e,Te,"day"):e>=Xe?nr(t,e,Xe,"hour"):e>=Ye?nr(t,e,Ye,"minute"):e>=Ge?nr(t,e,Ge,"second"):t+" ms"}function nr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var yo=y((Qd,mo)=>{function $s(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=ho(),r.destroy=l,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let m=0;for(let b=0;b<f.length;b++)m=(m<<5)-m+f.charCodeAt(b),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(f){let m,b=null,T,O;function g(...S){if(!g.enabled)return;let A=g,F=Number(new Date),te=F-(m||F);A.diff=te,A.prev=m,A.curr=F,m=F,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let ye=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(re,Pt)=>{if(re==="%%")return"%";ye++;let Zt=r.formatters[Pt];if(typeof Zt=="function"){let Vr=S[ye];re=Zt.call(A,Vr),S.splice(ye,1),ye--}return re}),r.formatArgs.call(A,S),(A.log||r.log).apply(A,S)}return g.namespace=f,g.useColors=r.useColors(),g.color=r.selectColor(f),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>b!==null?b:(T!==r.namespaces&&(T=r.namespaces,O=r.enabled(f)),O),set:S=>{b=S}}),typeof r.init=="function"&&r.init(g),g}function n(f,m){let b=r(this.namespace+(typeof m=="undefined"?":":m)+f);return b.log=this.log,b}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let m=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let b of m)b[0]==="-"?r.skips.push(b.slice(1)):r.names.push(b)}function i(f,m){let b=0,T=0,O=-1,g=0;for(;b<f.length;)if(T<m.length&&(m[T]===f[b]||m[T]==="*"))m[T]==="*"?(O=T,g=b,T++):(b++,T++);else if(O!==-1)T=O+1,g++,b=g;else return!1;for(;T<m.length&&m[T]==="*";)T++;return T===m.length}function s(){let f=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),f}function a(f){for(let m of r.skips)if(i(f,m))return!1;for(let m of r.names)if(i(f,m))return!0;return!1}function d(f){return f instanceof Error?f.stack||f.message:f}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}mo.exports=$s});var vo=y((V,or)=>{V.formatArgs=Hs;V.save=Bs;V.load=Ks;V.useColors=Ws;V.storage=Js();V.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();V.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 Ws(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Hs(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+or.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}V.log=console.debug||console.log||(()=>{});function Bs(t){try{t?V.storage.setItem("debug",t):V.storage.removeItem("debug")}catch{}}function Ks(){let t;try{t=V.storage.getItem("debug")||V.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Js(){try{return localStorage}catch{}}or.exports=yo()(V);var{formatters:Gs}=or.exports;Gs.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Mt=y(Se=>{"use strict";var Ys=Se&&Se.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Se,"__esModule",{value:!0});Se.Logger=void 0;Se.debug=ea;var Xs=Ys(vo()),Qs=["info","warn","error","debug"],ir=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of Qs){let n=(0,Xs.default)(`${e}:${r}`);n.color=this.getPlatformColor(r),this.loggers[r]=n}}getPlatformColor(e){return{node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}}[typeof window!="undefined"?"browser":"node"][e]}info(e,...r){this.loggers.info(e,...r)}warn(e,...r){this.loggers.warn(e,...r)}error(e,...r){this.loggers.error(e,...r)}debug(e,...r){this.loggers.debug(e,...r)}};Se.Logger=ir;function ea(t){return new ir(t)}});var Dt=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Kr;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Kr||(k.util=Kr={}));var xo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(xo||(k.objectUtil=xo={}));k.ZodParsedType=Kr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var oa=t=>{switch(typeof t){case"undefined":return k.ZodParsedType.undefined;case"string":return k.ZodParsedType.string;case"number":return Number.isNaN(t)?k.ZodParsedType.nan:k.ZodParsedType.number;case"boolean":return k.ZodParsedType.boolean;case"function":return k.ZodParsedType.function;case"bigint":return k.ZodParsedType.bigint;case"symbol":return k.ZodParsedType.symbol;case"object":return Array.isArray(t)?k.ZodParsedType.array:t===null?k.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?k.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?k.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?k.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?k.ZodParsedType.date:k.ZodParsedType.object;default:return k.ZodParsedType.unknown}};k.getParsedType=oa});var dr=y(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.ZodError=ve.quotelessJson=ve.ZodIssueCode=void 0;var wo=Dt();ve.ZodIssueCode=wo.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 ia=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");ve.quotelessJson=ia;var zt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,d=0;for(;d<s.path.length;){let l=s.path[d];d===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wo.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ve.ZodError=zt;zt.create=t=>new zt(t)});var Gr=y(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});var M=dr(),Ae=Dt(),sa=(t,e)=>{let r;switch(t.code){case M.ZodIssueCode.invalid_type:t.received===Ae.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case M.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ae.util.jsonStringifyReplacer)}`;break;case M.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.util.joinValues(t.keys,", ")}`;break;case M.ZodIssueCode.invalid_union:r="Invalid input";break;case M.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.util.joinValues(t.options)}`;break;case M.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.util.joinValues(t.options)}, received '${t.received}'`;break;case M.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case M.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case M.ZodIssueCode.invalid_date:r="Invalid date";break;case M.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ae.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case M.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case M.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case M.ZodIssueCode.custom:r="Invalid input";break;case M.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case M.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case M.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ae.util.assertNever(t)}return{message:r}};Jr.default=sa});var lr=y(ge=>{"use strict";var aa=ge&&ge.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ge,"__esModule",{value:!0});ge.defaultErrorMap=void 0;ge.setErrorMap=ca;ge.getErrorMap=ua;var Co=aa(Gr());ge.defaultErrorMap=Co.default;var Io=Co.default;function ca(t){Io=t}function ua(){return Io}});var Xr=y(Z=>{"use strict";var da=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Z,"__esModule",{value:!0});Z.isAsync=Z.isValid=Z.isDirty=Z.isAborted=Z.OK=Z.DIRTY=Z.INVALID=Z.ParseStatus=Z.EMPTY_PATH=Z.makeIssue=void 0;Z.addIssueToContext=pa;var la=lr(),To=da(Gr()),fa=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",d=n.filter(l=>!!l).slice().reverse();for(let l of d)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};Z.makeIssue=fa;Z.EMPTY_PATH=[];function pa(t,e){let r=(0,la.getErrorMap)(),n=(0,Z.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===To.default?void 0:To.default].filter(o=>!!o)});t.common.issues.push(n)}var Yr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return Z.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Z.INVALID;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}};Z.ParseStatus=Yr;Z.INVALID=Object.freeze({status:"aborted"});var ha=t=>({status:"dirty",value:t});Z.DIRTY=ha;var ma=t=>({status:"valid",value:t});Z.OK=ma;var ya=t=>t.status==="aborted";Z.isAborted=ya;var va=t=>t.status==="dirty";Z.isDirty=va;var ga=t=>t.status==="valid";Z.isValid=ga;var _a=t=>typeof Promise!="undefined"&&t instanceof Promise;Z.isAsync=_a});var Ao=y(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0})});var Po=y(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.errorUtil=void 0;var Oo;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Oo||(fr.errorUtil=Oo={}))});var Fo=y(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.discriminatedUnion=c.date=c.boolean=c.bigint=c.array=c.any=c.coerce=c.ZodFirstPartyTypeKind=c.late=c.ZodSchema=c.Schema=c.ZodReadonly=c.ZodPipeline=c.ZodBranded=c.BRAND=c.ZodNaN=c.ZodCatch=c.ZodDefault=c.ZodNullable=c.ZodOptional=c.ZodTransformer=c.ZodEffects=c.ZodPromise=c.ZodNativeEnum=c.ZodEnum=c.ZodLiteral=c.ZodLazy=c.ZodFunction=c.ZodSet=c.ZodMap=c.ZodRecord=c.ZodTuple=c.ZodIntersection=c.ZodDiscriminatedUnion=c.ZodUnion=c.ZodObject=c.ZodArray=c.ZodVoid=c.ZodNever=c.ZodUnknown=c.ZodAny=c.ZodNull=c.ZodUndefined=c.ZodSymbol=c.ZodDate=c.ZodBoolean=c.ZodBigInt=c.ZodNumber=c.ZodString=c.ZodType=void 0;c.NEVER=c.void=c.unknown=c.union=c.undefined=c.tuple=c.transformer=c.symbol=c.string=c.strictObject=c.set=c.record=c.promise=c.preprocess=c.pipeline=c.ostring=c.optional=c.onumber=c.oboolean=c.object=c.number=c.nullable=c.null=c.never=c.nativeEnum=c.nan=c.map=c.literal=c.lazy=c.intersection=c.instanceof=c.function=c.enum=c.effect=void 0;c.datetimeRegex=Uo;c.custom=Mo;var p=dr(),pr=lr(),v=Po(),u=Xr(),h=Dt(),K=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Zo=(t,e)=>{if((0,u.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new p.ZodError(t.common.issues);return this._error=r,this._error}}};function C(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{var l,f;let{message:d}=t;return s.code==="invalid_enum_value"?{message:d!=null?d:a.defaultError}:typeof a.data=="undefined"?{message:(l=d!=null?d:n)!=null?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(f=d!=null?d:r)!=null?f:a.defaultError}},description:o}}var I=class{get description(){return this._def.description}_getType(e){return(0,h.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,u.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r==null?void 0:r.async)!=null?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Zo(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(o=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,u.isAsync)(o)?o:Promise.resolve(o));return Zo(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:p.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(d=>d?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new H({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return B.create(this,this._def)}nullable(){return se.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return xe.create(this,this._def)}or(e){return Ue.create([this,e],this._def)}and(e){return Re.create(this,e,this._def)}transform(e){return new H({...C(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Le({...C(this._def),innerType:this,defaultValue:r,typeName:x.ZodDefault})}brand(){return new Lt({typeName:x.ZodBranded,type:this,...C(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Fe({...C(this._def),innerType:this,catchValue:r,typeName:x.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ft.create(this,e)}readonly(){return qe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=I;c.Schema=I;c.ZodSchema=I;var ba=/^c[^\s-]{8,}$/i,xa=/^[0-9a-z]+$/,wa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ca=/^[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,Ia=/^[a-z0-9_-]{21}$/i,Ta=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sa=/^[-+]?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)?)??$/,Aa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Oa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qr,Pa=/^(?:(?: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])$/,Za=/^(?:(?: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])$/,ja=/^(([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]))$/,ka=/^(([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])$/,Ea=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ua=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ko="((\\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])))",Ra=new RegExp(`^${ko}$`);function Eo(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Ma(t){return new RegExp(`^${Eo(t)}$`)}function Uo(t){let e=`${ko}T${Eo(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Na(t,e){return!!((e==="v4"||!e)&&Pa.test(t)||(e==="v6"||!e)&&ja.test(t))}function Da(t,e){if(!Ta.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function za(t,e){return!!((e==="v4"||!e)&&Za.test(t)||(e==="v6"||!e)&&ka.test(t))}var _e=class t extends I{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:i.parsedType}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Aa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"email",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Qr||(Qr=new RegExp(Oa,"u")),Qr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"emoji",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ca.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"uuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ia.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"nanoid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")ba.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")xa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid2",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")wa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ulid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"regex",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Uo(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Ra.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Ma(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Sa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"duration",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Na(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ip",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Da(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"jwt",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?za(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cidr",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Ea.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ua.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:p.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,...v.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...v.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...v.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...v.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...v.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...v.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...v.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...v.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,v.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};c.ZodString=_e;_e.create=t=>{var e;return new _e({checks:[],typeName:x.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};function La(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Oe=class t extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:i.parsedType}),u.INVALID}let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="int"?h.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?La(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_finite,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:v.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&h.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};c.ZodNumber=Oe;Oe.create=t=>new Oe({checks:[],typeName:x.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var Pe=class t extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:r.parsedType}),u.INVALID}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};c.ZodBigInt=Pe;Pe.create=t=>{var e;return new Pe({checks:[],typeName:x.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};var Ze=class extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodBoolean=Ze;Ze.create=t=>new Ze({typeName:x.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var je=class t extends I{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:i.parsedType}),u.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_date}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.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(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:v.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:v.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};c.ZodDate=je;je.create=t=>new je({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:x.ZodDate,...C(t)});var tt=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodSymbol=tt;tt.create=t=>new tt({typeName:x.ZodSymbol,...C(t)});var ke=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodUndefined=ke;ke.create=t=>new ke({typeName:x.ZodUndefined,...C(t)});var Ee=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodNull=Ee;Ee.create=t=>new Ee({typeName:x.ZodNull,...C(t)});var be=class extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=be;be.create=t=>new be({typeName:x.ZodAny,...C(t)});var de=class extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=de;de.create=t=>new de({typeName:x.ZodUnknown,...C(t)});var X=class extends I{_parse(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:r.parsedType}),u.INVALID}};c.ZodNever=X;X.create=t=>new X({typeName:x.ZodNever,...C(t)});var rt=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodVoid=rt;rt.create=t=>new rt({typeName:x.ZodVoid,...C(t)});var le=class t extends I{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:r.parsedType}),u.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,u.addIssueToContext)(r,{code:s?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,u.addIssueToContext)(r,{code:p.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,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new K(r,s,r.path,a)))).then(s=>u.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new K(r,s,r.path,a)));return u.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:v.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:v.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=le;le.create=(t,e)=>new le({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...C(e)});function et(t){if(t instanceof $){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=B.create(et(n))}return new $({...t._def,shape:()=>e})}else return t instanceof le?new le({...t._def,type:et(t.element)}):t instanceof B?B.create(et(t.unwrap())):t instanceof se?se.create(et(t.unwrap())):t instanceof ie?ie.create(t.items.map(e=>et(e))):t}var $=class t extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=h.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==h.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:l.parsedType}),u.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof X&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let d=[];for(let l of s){let f=i[l],m=o.data[l];d.push({key:{status:"valid",value:l},value:f._parse(new K(o,m,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof X){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of a)d.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(l==="strict")a.length>0&&((0,u.addIssueToContext)(o,{code:p.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of a){let m=o.data[f];d.push({key:{status:"valid",value:f},value:l._parse(new K(o,m,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of d){let m=await f.key,b=await f.value;l.push({key:m,value:b,alwaysSet:f.alwaysSet})}return l}).then(l=>u.ParseStatus.mergeObjectSync(n,l)):u.ParseStatus.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return v.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,d;let o=(a=(s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(d=v.errorUtil.errToObj(e).message)!=null?d:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of h.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of h.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return et(this)}partial(e){let r={};for(let n of h.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of h.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof B;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Ro(h.util.objectKeys(this.shape))}};c.ZodObject=$;$.create=(t,e)=>new $({shape:()=>t,unknownKeys:"strip",catchall:X.create(),typeName:x.ZodObject,...C(e)});$.strictCreate=(t,e)=>new $({shape:()=>t,unknownKeys:"strict",catchall:X.create(),typeName:x.ZodObject,...C(e)});$.lazycreate=(t,e)=>new $({shape:t,unknownKeys:"strip",catchall:X.create(),typeName:x.ZodObject,...C(e)});var Ue=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new p.ZodError(a.ctx.common.issues));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:s}),u.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let d of n){let l={...r,common:{...r.common,issues:[]},parent:null},f=d._parseSync({data:r.data,path:r.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(d=>new p.ZodError(d));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:a}),u.INVALID}}get options(){return this._def.options}};c.ZodUnion=Ue;Ue.create=(t,e)=>new Ue({options:t,typeName:x.ZodUnion,...C(e)});var ue=t=>t instanceof Me?ue(t.schema):t instanceof H?ue(t.innerType()):t instanceof Ne?[t.value]:t instanceof De?t.options:t instanceof ze?h.util.objectValues(t.enum):t instanceof Le?ue(t._def.innerType):t instanceof ke?[void 0]:t instanceof Ee?[null]:t instanceof B?[void 0,...ue(t.unwrap())]:t instanceof se?[null,...ue(t.unwrap())]:t instanceof Lt||t instanceof qe?ue(t.unwrap()):t instanceof Fe?ue(t._def.innerType):[],hr=class t extends I{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:r.parsedType}),u.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,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),u.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ue(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...C(n)})}};c.ZodDiscriminatedUnion=hr;function en(t,e){let r=(0,h.getParsedType)(t),n=(0,h.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===h.ZodParsedType.object&&n===h.ZodParsedType.object){let o=h.util.objectKeys(e),i=h.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let d=en(t[a],e[a]);if(!d.valid)return{valid:!1};s[a]=d.data}return{valid:!0,data:s}}else if(r===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],d=en(s,a);if(!d.valid)return{valid:!1};o.push(d.data)}return{valid:!0,data:o}}else return r===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Re=class extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,u.isAborted)(i)||(0,u.isAborted)(s))return u.INVALID;let a=en(i.value,s.value);return a.valid?(((0,u.isDirty)(i)||(0,u.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_intersection_types}),u.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c.ZodIntersection=Re;Re.create=(t,e,r)=>new Re({left:t,right:e,typeName:x.ZodIntersection,...C(r)});var ie=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),u.INVALID;if(n.data.length<this._def.items.length)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let d=this._def.items[a]||this._def.rest;return d?d._parse(new K(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>u.ParseStatus.mergeArray(r,s)):u.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};c.ZodTuple=ie;ie.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ie({items:t,typeName:x.ZodTuple,rest:null,...C(e)})};var mr=class t extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),u.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new K(n,a,n.path,a)),value:s._parse(new K(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?u.ParseStatus.mergeObjectAsync(r,o):u.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof I?new t({keyType:e,valueType:r,typeName:x.ZodRecord,...C(n)}):new t({keyType:_e.create(),valueType:e,typeName:x.ZodRecord,...C(r)})}};c.ZodRecord=mr;var nt=class extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.map)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),u.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,d],l)=>({key:o._parse(new K(n,a,n.path,[l,"key"])),value:i._parse(new K(n,d,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let d of s){let l=await d.key,f=await d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let d of s){let l=d.key,f=d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}}}};c.ZodMap=nt;nt.create=(t,e,r)=>new nt({valueType:e,keyType:t,typeName:x.ZodMap,...C(r)});var ot=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.set)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),u.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,u.addIssueToContext)(n,{code:p.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,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(d){let l=new Set;for(let f of d){if(f.status==="aborted")return u.INVALID;f.status==="dirty"&&r.dirty(),l.add(f.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((d,l)=>i._parse(new K(n,d,n.path,l)));return n.common.async?Promise.all(a).then(d=>s(d)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:v.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=ot;ot.create=(t,e)=>new ot({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...C(e)});var yr=class t extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.function)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:r.parsedType}),u.INVALID;function n(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,pr.getErrorMap)(),pr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_arguments,argumentsError:d}})}function o(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,pr.getErrorMap)(),pr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_return_type,returnTypeError:d}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof xe){let a=this;return(0,u.OK)(async function(...d){let l=new p.ZodError([]),f=await a._def.args.parseAsync(d,i).catch(T=>{throw l.addIssue(n(d,T)),l}),m=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(m,i).catch(T=>{throw l.addIssue(o(m,T)),l})})}else{let a=this;return(0,u.OK)(function(...d){let l=a._def.args.safeParse(d,i);if(!l.success)throw new p.ZodError([n(d,l.error)]);let f=Reflect.apply(s,this,l.data),m=a._def.returns.safeParse(f,i);if(!m.success)throw new p.ZodError([o(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ie.create(e).rest(de.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ie.create([]).rest(de.create()),returns:r||de.create(),typeName:x.ZodFunction,...C(n)})}};c.ZodFunction=yr;var Me=class extends I{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};c.ZodLazy=Me;Me.create=(t,e)=>new Me({getter:t,typeName:x.ZodLazy,...C(e)});var Ne=class extends I{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),u.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};c.ZodLiteral=Ne;Ne.create=(t,e)=>new Ne({value:t,typeName:x.ZodLiteral,...C(e)});function Ro(t,e){return new De({values:t,typeName:x.ZodEnum,...C(e)})}var De=class t extends I{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{expected:h.util.joinValues(n),received:r.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_enum_value,options:n}),u.INVALID}return(0,u.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};c.ZodEnum=De;De.create=Ro;var ze=class extends I{_parse(e){let r=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{expected:h.util.joinValues(o),received:n.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(h.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{received:n.data,code:p.ZodIssueCode.invalid_enum_value,options:o}),u.INVALID}return(0,u.OK)(e.data)}get enum(){return this._def.values}};c.ZodNativeEnum=ze;ze.create=(t,e)=>new ze({values:t,typeName:x.ZodNativeEnum,...C(e)});var xe=class extends I{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.promise&&r.common.async===!1)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:r.parsedType}),u.INVALID;let n=r.parsedType===h.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,u.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};c.ZodPromise=xe;xe.create=(t,e)=>new xe({type:t,typeName:x.ZodPromise,...C(e)});var H=class extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{(0,u.addIssueToContext)(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return u.INVALID;let d=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return d.status==="aborted"?u.INVALID:d.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(d.value):d});{if(r.value==="aborted")return u.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:a.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let d=o.refinement(a,i);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,u.isValid)(s))return u.INVALID;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>(0,u.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):u.INVALID);h.util.assertNever(o)}};c.ZodEffects=H;c.ZodTransformer=H;H.create=(t,e,r)=>new H({schema:t,typeName:x.ZodEffects,effect:e,...C(r)});H.createWithPreprocess=(t,e,r)=>new H({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...C(r)});var B=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.undefined?(0,u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodOptional=B;B.create=(t,e)=>new B({innerType:t,typeName:x.ZodOptional,...C(e)});var se=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.null?(0,u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodNullable=se;se.create=(t,e)=>new se({innerType:t,typeName:x.ZodNullable,...C(e)});var Le=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),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}};c.ZodDefault=Le;Le.create=(t,e)=>new Le({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...C(e)});var Fe=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,u.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c.ZodCatch=Fe;Fe.create=(t,e)=>new Fe({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...C(e)});var it=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),u.INVALID}return{status:"valid",value:e.data}}};c.ZodNaN=it;it.create=t=>new it({typeName:x.ZodNaN,...C(t)});c.BRAND=Symbol("zod_brand");var Lt=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};c.ZodBranded=Lt;var Ft=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?u.INVALID:i.status==="dirty"?(r.dirty(),(0,u.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"?u.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:x.ZodPipeline})}};c.ZodPipeline=Ft;var qe=class extends I{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,u.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,u.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};c.ZodReadonly=qe;qe.create=(t,e)=>new qe({innerType:t,typeName:x.ZodReadonly,...C(e)});function jo(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Mo(t,e={},r){return t?be.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(d=>{var l,f;if(!d){let m=jo(e,n),b=(f=(l=m.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...m,fatal:b})}});if(!i){let d=jo(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):be.create()}c.late={object:$.lazycreate};var x;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(x||(c.ZodFirstPartyTypeKind=x={}));var Fa=(t,e={message:`Input not instance of ${t.name}`})=>Mo(r=>r instanceof t,e);c.instanceof=Fa;var No=_e.create;c.string=No;var Do=Oe.create;c.number=Do;var qa=it.create;c.nan=qa;var Va=Pe.create;c.bigint=Va;var zo=Ze.create;c.boolean=zo;var $a=je.create;c.date=$a;var Wa=tt.create;c.symbol=Wa;var Ha=ke.create;c.undefined=Ha;var Ba=Ee.create;c.null=Ba;var Ka=be.create;c.any=Ka;var Ja=de.create;c.unknown=Ja;var Ga=X.create;c.never=Ga;var Ya=rt.create;c.void=Ya;var Xa=le.create;c.array=Xa;var Qa=$.create;c.object=Qa;var ec=$.strictCreate;c.strictObject=ec;var tc=Ue.create;c.union=tc;var rc=hr.create;c.discriminatedUnion=rc;var nc=Re.create;c.intersection=nc;var oc=ie.create;c.tuple=oc;var ic=mr.create;c.record=ic;var sc=nt.create;c.map=sc;var ac=ot.create;c.set=ac;var cc=yr.create;c.function=cc;var uc=Me.create;c.lazy=uc;var dc=Ne.create;c.literal=dc;var lc=De.create;c.enum=lc;var fc=ze.create;c.nativeEnum=fc;var pc=xe.create;c.promise=pc;var Lo=H.create;c.effect=Lo;c.transformer=Lo;var hc=B.create;c.optional=hc;var mc=se.create;c.nullable=mc;var yc=H.createWithPreprocess;c.preprocess=yc;var vc=Ft.create;c.pipeline=vc;var gc=()=>No().optional();c.ostring=gc;var _c=()=>Do().optional();c.onumber=_c;var bc=()=>zo().optional();c.oboolean=bc;c.coerce={string:(t=>_e.create({...t,coerce:!0})),number:(t=>Oe.create({...t,coerce:!0})),boolean:(t=>Ze.create({...t,coerce:!0})),bigint:(t=>Pe.create({...t,coerce:!0})),date:(t=>je.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var tn=y(J=>{"use strict";var xc=J&&J.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),st=J&&J.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xc(e,t,r)};Object.defineProperty(J,"__esModule",{value:!0});st(lr(),J);st(Xr(),J);st(Ao(),J);st(Dt(),J);st(Fo(),J);st(dr(),J)});var j=y(W=>{"use strict";var qo=W&&W.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),wc=W&&W.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Cc=W&&W.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qo(e,t,r);return wc(e,t),e},Ic=W&&W.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qo(e,t,r)};Object.defineProperty(W,"__esModule",{value:!0});W.z=void 0;var Vo=Cc(tn());W.z=Vo;Ic(tn(),W);W.default=Vo});var rn=y(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.actionTypesZodSchema=at.ActionTypes=void 0;var Tc=j(),$o;(function(t){t.OpenUrl="openUrl",t.ImBack="imBack",t.PostBack="postBack",t.PlayAudio="playAudio",t.PlayVideo="playVideo",t.ShowImage="showImage",t.DownloadFile="downloadFile",t.Signin="signin",t.Call="call",t.MessageBack="messageBack",t.OpenApp="openApp"})($o||(at.ActionTypes=$o={}));at.actionTypesZodSchema=Tc.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var nn=y(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.semanticActionStateTypesZodSchema=ct.SemanticActionStateTypes=void 0;var Sc=j(),Wo;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Wo||(ct.SemanticActionStateTypes=Wo={}));ct.semanticActionStateTypesZodSchema=Sc.z.enum(["start","continue","done"])});var on=y(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.attachmentLayoutTypesZodSchema=ut.AttachmentLayoutTypes=void 0;var Ac=j(),Ho;(function(t){t.List="list",t.Carousel="carousel"})(Ho||(ut.AttachmentLayoutTypes=Ho={}));ut.attachmentLayoutTypesZodSchema=Ac.z.enum(["list","carousel"])});var sn=y(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.Channels=void 0;var Bo;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(Bo||(vr.Channels=Bo={}))});var an=y(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.endOfConversationCodesZodSchema=dt.EndOfConversationCodes=void 0;var Oc=j(),Ko;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(Ko||(dt.EndOfConversationCodes=Ko={}));dt.endOfConversationCodesZodSchema=Oc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Go=y(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.membershipSourceTypeZodSchema=lt.MembershipSourceTypes=void 0;var Pc=j(),Jo;(function(t){t.Channel="channel",t.Team="team"})(Jo||(lt.MembershipSourceTypes=Jo={}));lt.membershipSourceTypeZodSchema=Pc.z.enum(["channel","team"])});var Xo=y(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.membershipTypeZodSchema=ft.MembershipTypes=void 0;var Zc=j(),Yo;(function(t){t.Direct="direct",t.Transitive="transitive"})(Yo||(ft.MembershipTypes=Yo={}));ft.membershipTypeZodSchema=Zc.z.enum(["direct","transitive"])});var qt=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.roleTypeZodSchema=pt.RoleTypes=void 0;var jc=j(),Qo;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(Qo||(pt.RoleTypes=Qo={}));pt.roleTypeZodSchema=jc.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var ei=y(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.addAIToActivity=void 0;var kc=(t,e,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:e,usageInfo:r};(n=t.entities)!==null&&n!==void 0||(t.entities=[]),t.entities.push(o)};gr.addAIToActivity=kc});var ti=y(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.adaptiveCardInvokeActionZodSchema=void 0;var Ve=j();_r.adaptiveCardInvokeActionZodSchema=Ve.z.object({type:Ve.z.string().min(1),id:Ve.z.string().optional(),verb:Ve.z.string().min(1),data:Ve.z.record(Ve.z.string().min(1),Ve.z.any())})});var ri=y(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var ni=y(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.default="00000000-0000-0000-0000-000000000000"});var oi=y(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.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 Vt=y(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});var Ec=oi();function Uc(t){return typeof t=="string"&&Ec.default.test(t)}ln.default=Uc});var $t=y(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});var Rc=Vt();function Mc(t){if(!(0,Rc.default)(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(t.slice(9,13),16))>>>8,e&255,(e=parseInt(t.slice(14,18),16))>>>8,e&255,(e=parseInt(t.slice(19,23),16))>>>8,e&255,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}fn.default=Mc});var fe=y(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.unsafeStringify=void 0;var Nc=Vt(),U=[];for(let t=0;t<256;++t)U.push((t+256).toString(16).slice(1));function ii(t,e=0){return(U[t[e+0]]+U[t[e+1]]+U[t[e+2]]+U[t[e+3]]+"-"+U[t[e+4]]+U[t[e+5]]+"-"+U[t[e+6]]+U[t[e+7]]+"-"+U[t[e+8]]+U[t[e+9]]+"-"+U[t[e+10]]+U[t[e+11]]+U[t[e+12]]+U[t[e+13]]+U[t[e+14]]+U[t[e+15]]).toLowerCase()}Wt.unsafeStringify=ii;function Dc(t,e=0){let r=ii(t,e);if(!(0,Nc.default)(r))throw TypeError("Stringified UUID is invalid");return r}Wt.default=Dc});var br=y(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});var pn,zc=new Uint8Array(16);function Lc(){if(!pn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");pn=crypto.getRandomValues.bind(crypto)}return pn(zc)}hn.default=Lc});var mn=y(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.updateV1State=void 0;var si=br(),Fc=fe(),Ht={};function qc(t,e,r){var i,s,a,d;let n,o=(i=t==null?void 0:t._v6)!=null?i:!1;if(t){let l=Object.keys(t);l.length===1&&l[0]==="_v6"&&(t=void 0)}if(t)n=ai((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,si.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,si.default)();ci(Ht,l,f),n=ai(f,Ht.msecs,Ht.nsecs,o?void 0:Ht.clockseq,o?void 0:Ht.node,e,r)}return e!=null?e:(0,Fc.unsafeStringify)(n)}function ci(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.nsecs)!=null||(t.nsecs=0),e===t.msecs?(t.nsecs++,t.nsecs>=1e4&&(t.node=void 0,t.nsecs=0)):e>t.msecs?t.nsecs=0:e<t.msecs&&(t.node=void 0),t.node||(t.node=r.slice(10,16),t.node[0]|=1,t.clockseq=(r[8]<<8|r[9])&16383),t.msecs=e,t}Bt.updateV1State=ci;function ai(t,e,r,n,o,i,s=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!i)i=new Uint8Array(16),s=0;else if(s<0||s+16>i.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);e!=null||(e=Date.now()),r!=null||(r=0),n!=null||(n=(t[8]<<8|t[9])&16383),o!=null||(o=t.slice(10,16)),e+=122192928e5;let a=((e&268435455)*1e4+r)%4294967296;i[s++]=a>>>24&255,i[s++]=a>>>16&255,i[s++]=a>>>8&255,i[s++]=a&255;let d=e/4294967296*1e4&268435455;i[s++]=d>>>8&255,i[s++]=d&255,i[s++]=d>>>24&15|16,i[s++]=d>>>16&255,i[s++]=n>>>8|128,i[s++]=n&255;for(let l=0;l<6;++l)i[s++]=o[l];return i}Bt.default=qc});var vn=y(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});var Vc=$t(),$c=fe();function Wc(t){let e=typeof t=="string"?(0,Vc.default)(t):t,r=Hc(e);return typeof t=="string"?(0,$c.unsafeStringify)(r):r}yn.default=Wc;function Hc(t){return Uint8Array.of((t[6]&15)<<4|t[7]>>4&15,(t[7]&15)<<4|(t[4]&240)>>4,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,(t[1]&15)<<4|(t[2]&240)>>4,96|t[2]&15,t[3],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var di=y(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});function Bc(t){let e=Gc(t),r=Jc(e,t.length*8);return Kc(r)}function Kc(t){let e=new Uint8Array(t.length*4);for(let r=0;r<t.length*4;r++)e[r]=t[r>>2]>>>r%4*8&255;return e}function ui(t){return(t+64>>>9<<4)+14+1}function Jc(t,e){let r=new Uint32Array(ui(e)).fill(0);r.set(t),r[e>>5]|=128<<e%32,r[r.length-1]=e,t=r;let n=1732584193,o=-271733879,i=-1732584194,s=271733878;for(let a=0;a<t.length;a+=16){let d=n,l=o,f=i,m=s;n=N(n,o,i,s,t[a],7,-680876936),s=N(s,n,o,i,t[a+1],12,-389564586),i=N(i,s,n,o,t[a+2],17,606105819),o=N(o,i,s,n,t[a+3],22,-1044525330),n=N(n,o,i,s,t[a+4],7,-176418897),s=N(s,n,o,i,t[a+5],12,1200080426),i=N(i,s,n,o,t[a+6],17,-1473231341),o=N(o,i,s,n,t[a+7],22,-45705983),n=N(n,o,i,s,t[a+8],7,1770035416),s=N(s,n,o,i,t[a+9],12,-1958414417),i=N(i,s,n,o,t[a+10],17,-42063),o=N(o,i,s,n,t[a+11],22,-1990404162),n=N(n,o,i,s,t[a+12],7,1804603682),s=N(s,n,o,i,t[a+13],12,-40341101),i=N(i,s,n,o,t[a+14],17,-1502002290),o=N(o,i,s,n,t[a+15],22,1236535329),n=D(n,o,i,s,t[a+1],5,-165796510),s=D(s,n,o,i,t[a+6],9,-1069501632),i=D(i,s,n,o,t[a+11],14,643717713),o=D(o,i,s,n,t[a],20,-373897302),n=D(n,o,i,s,t[a+5],5,-701558691),s=D(s,n,o,i,t[a+10],9,38016083),i=D(i,s,n,o,t[a+15],14,-660478335),o=D(o,i,s,n,t[a+4],20,-405537848),n=D(n,o,i,s,t[a+9],5,568446438),s=D(s,n,o,i,t[a+14],9,-1019803690),i=D(i,s,n,o,t[a+3],14,-187363961),o=D(o,i,s,n,t[a+8],20,1163531501),n=D(n,o,i,s,t[a+13],5,-1444681467),s=D(s,n,o,i,t[a+2],9,-51403784),i=D(i,s,n,o,t[a+7],14,1735328473),o=D(o,i,s,n,t[a+12],20,-1926607734),n=z(n,o,i,s,t[a+5],4,-378558),s=z(s,n,o,i,t[a+8],11,-2022574463),i=z(i,s,n,o,t[a+11],16,1839030562),o=z(o,i,s,n,t[a+14],23,-35309556),n=z(n,o,i,s,t[a+1],4,-1530992060),s=z(s,n,o,i,t[a+4],11,1272893353),i=z(i,s,n,o,t[a+7],16,-155497632),o=z(o,i,s,n,t[a+10],23,-1094730640),n=z(n,o,i,s,t[a+13],4,681279174),s=z(s,n,o,i,t[a],11,-358537222),i=z(i,s,n,o,t[a+3],16,-722521979),o=z(o,i,s,n,t[a+6],23,76029189),n=z(n,o,i,s,t[a+9],4,-640364487),s=z(s,n,o,i,t[a+12],11,-421815835),i=z(i,s,n,o,t[a+15],16,530742520),o=z(o,i,s,n,t[a+2],23,-995338651),n=L(n,o,i,s,t[a],6,-198630844),s=L(s,n,o,i,t[a+7],10,1126891415),i=L(i,s,n,o,t[a+14],15,-1416354905),o=L(o,i,s,n,t[a+5],21,-57434055),n=L(n,o,i,s,t[a+12],6,1700485571),s=L(s,n,o,i,t[a+3],10,-1894986606),i=L(i,s,n,o,t[a+10],15,-1051523),o=L(o,i,s,n,t[a+1],21,-2054922799),n=L(n,o,i,s,t[a+8],6,1873313359),s=L(s,n,o,i,t[a+15],10,-30611744),i=L(i,s,n,o,t[a+6],15,-1560198380),o=L(o,i,s,n,t[a+13],21,1309151649),n=L(n,o,i,s,t[a+4],6,-145523070),s=L(s,n,o,i,t[a+11],10,-1120210379),i=L(i,s,n,o,t[a+2],15,718787259),o=L(o,i,s,n,t[a+9],21,-343485551),n=we(n,d),o=we(o,l),i=we(i,f),s=we(s,m)}return Uint32Array.of(n,o,i,s)}function Gc(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(ui(t.length*8)).fill(0);for(let r=0;r<t.length;r++)e[r>>2]|=(t[r]&255)<<r%4*8;return e}function we(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function Yc(t,e){return t<<e|t>>>32-e}function xr(t,e,r,n,o,i){return we(Yc(we(we(e,t),we(n,i)),o),r)}function N(t,e,r,n,o,i,s){return xr(e&r|~e&n,t,e,o,i,s)}function D(t,e,r,n,o,i,s){return xr(e&n|r&~n,t,e,o,i,s)}function z(t,e,r,n,o,i,s){return xr(e^r^n,t,e,o,i,s)}function L(t,e,r,n,o,i,s){return xr(r^(e|~n),t,e,o,i,s)}gn.default=Bc});var Kt=y(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.URL=pe.DNS=pe.stringToBytes=void 0;var li=$t(),Xc=fe();function fi(t){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r);return e}pe.stringToBytes=fi;pe.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";pe.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Qc(t,e,r,n,o,i){let s=typeof r=="string"?fi(r):r,a=typeof n=="string"?(0,li.default)(n):n;if(typeof n=="string"&&(n=(0,li.default)(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let d=new Uint8Array(16+s.length);if(d.set(a),d.set(s,a.length),d=e(d),d[6]=d[6]&15|t,d[8]=d[8]&63|128,o){i=i||0;for(let l=0;l<16;++l)o[i+l]=d[l];return o}return(0,Xc.unsafeStringify)(d)}pe.default=Qc});var hi=y($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.URL=$e.DNS=void 0;var eu=di(),_n=Kt(),pi=Kt();Object.defineProperty($e,"DNS",{enumerable:!0,get:function(){return pi.DNS}});Object.defineProperty($e,"URL",{enumerable:!0,get:function(){return pi.URL}});function bn(t,e,r,n){return(0,_n.default)(48,eu.default,t,e,r,n)}bn.DNS=_n.DNS;bn.URL=_n.URL;$e.default=bn});var mi=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});var tu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);xn.default={randomUUID:tu}});var vi=y(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});var yi=mi(),ru=br(),nu=fe();function ou(t,e,r){var o,i,s;if(yi.default.randomUUID&&!e&&!t)return yi.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,ru.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,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return(0,nu.unsafeStringify)(n)}wn.default=ou});var gi=y(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});function iu(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function Cn(t,e){return t<<e|t>>>32-e}function su(t){let e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(t.length+1);n.set(t),n[t.length]=128,t=n;let o=t.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let d=new Uint32Array(16);for(let l=0;l<16;++l)d[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=d}s[i-1][14]=(t.length-1)*8/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<i;++a){let d=new Uint32Array(80);for(let O=0;O<16;++O)d[O]=s[a][O];for(let O=16;O<80;++O)d[O]=Cn(d[O-3]^d[O-8]^d[O-14]^d[O-16],1);let l=r[0],f=r[1],m=r[2],b=r[3],T=r[4];for(let O=0;O<80;++O){let g=Math.floor(O/20),S=Cn(l,5)+iu(g,f,m,b)+T+e[g]+d[O]>>>0;T=b,b=m,m=Cn(f,30)>>>0,f=l,l=S}r[0]=r[0]+l>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+T>>>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])}In.default=su});var bi=y(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.URL=We.DNS=void 0;var au=gi(),Tn=Kt(),_i=Kt();Object.defineProperty(We,"DNS",{enumerable:!0,get:function(){return _i.DNS}});Object.defineProperty(We,"URL",{enumerable:!0,get:function(){return _i.URL}});function Sn(t,e,r,n){return(0,Tn.default)(80,au.default,t,e,r,n)}Sn.DNS=Tn.DNS;Sn.URL=Tn.URL;We.default=Sn});var xi=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});var cu=fe(),uu=mn(),du=vn();function lu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,uu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,du.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,cu.unsafeStringify)(n)}An.default=lu});var wi=y(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});var fu=$t(),pu=fe();function hu(t){let e=typeof t=="string"?(0,fu.default)(t):t,r=mu(e);return typeof t=="string"?(0,pu.unsafeStringify)(r):r}On.default=hu;function mu(t){return Uint8Array.of((t[3]&15)<<4|t[4]>>4&15,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|t[6]&15,t[7],(t[1]&15)<<4|(t[2]&240)>>4,(t[2]&15)<<4|(t[3]&240)>>4,16|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var Si=y(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.updateV7State=void 0;var Ci=br(),yu=fe(),Pn={};function vu(t,e,r){var o,i,s;let n;if(t)n=Ii((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,Ci.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,Ci.default)();Ti(Pn,a,d),n=Ii(d,Pn.msecs,Pn.seq,e,r)}return e!=null?e:(0,yu.unsafeStringify)(n)}function Ti(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.seq)!=null||(t.seq=0),e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}Jt.updateV7State=Ti;function Ii(t,e,r,n,o=0){if(t.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 e!=null||(e=Date.now()),r!=null||(r=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9]),n[o++]=e/1099511627776&255,n[o++]=e/4294967296&255,n[o++]=e/16777216&255,n[o++]=e/65536&255,n[o++]=e/256&255,n[o++]=e&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|t[10]&3,n[o++]=t[11],n[o++]=t[12],n[o++]=t[13],n[o++]=t[14],n[o++]=t[15],n}Jt.default=vu});var Ai=y(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});var gu=Vt();function _u(t){if(!(0,gu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}Zn.default=_u});var Oi=y(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.version=P.validate=P.v7=P.v6ToV1=P.v6=P.v5=P.v4=P.v3=P.v1ToV6=P.v1=P.stringify=P.parse=P.NIL=P.MAX=void 0;var bu=ri();Object.defineProperty(P,"MAX",{enumerable:!0,get:function(){return bu.default}});var xu=ni();Object.defineProperty(P,"NIL",{enumerable:!0,get:function(){return xu.default}});var wu=$t();Object.defineProperty(P,"parse",{enumerable:!0,get:function(){return wu.default}});var Cu=fe();Object.defineProperty(P,"stringify",{enumerable:!0,get:function(){return Cu.default}});var Iu=mn();Object.defineProperty(P,"v1",{enumerable:!0,get:function(){return Iu.default}});var Tu=vn();Object.defineProperty(P,"v1ToV6",{enumerable:!0,get:function(){return Tu.default}});var Su=hi();Object.defineProperty(P,"v3",{enumerable:!0,get:function(){return Su.default}});var Au=vi();Object.defineProperty(P,"v4",{enumerable:!0,get:function(){return Au.default}});var Ou=bi();Object.defineProperty(P,"v5",{enumerable:!0,get:function(){return Ou.default}});var Pu=xi();Object.defineProperty(P,"v6",{enumerable:!0,get:function(){return Pu.default}});var Zu=wi();Object.defineProperty(P,"v6ToV1",{enumerable:!0,get:function(){return Zu.default}});var ju=Si();Object.defineProperty(P,"v7",{enumerable:!0,get:function(){return ju.default}});var ku=Vt();Object.defineProperty(P,"validate",{enumerable:!0,get:function(){return ku.default}});var Eu=Ai();Object.defineProperty(P,"version",{enumerable:!0,get:function(){return Eu.default}})});var jn=y(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.entityZodSchema=void 0;var Pi=j();wr.entityZodSchema=Pi.z.object({type:Pi.z.string().min(1)}).passthrough()});var Zi=y(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.semanticActionZodSchema=void 0;var Gt=j(),Uu=jn(),Ru=nn();Cr.semanticActionZodSchema=Gt.z.object({id:Gt.z.string().min(1),state:Gt.z.union([Ru.semanticActionStateTypesZodSchema,Gt.z.string().min(1)]),entities:Gt.z.record(Uu.entityZodSchema)})});var ji=y(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.cardActionZodSchema=void 0;var ae=j(),Mu=rn();Ir.cardActionZodSchema=ae.z.object({type:ae.z.union([Mu.actionTypesZodSchema,ae.z.string().min(1)]),title:ae.z.string().min(1),image:ae.z.string().min(1).optional(),text:ae.z.string().min(1).optional(),displayText:ae.z.string().min(1).optional(),value:ae.z.any().optional(),channelData:ae.z.unknown().optional(),imageAltText:ae.z.string().min(1).optional()})});var ki=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.suggestedActionsZodSchema=void 0;var Tr=j(),Nu=ji();Sr.suggestedActionsZodSchema=Tr.z.object({to:Tr.z.array(Tr.z.string().min(1)),actions:Tr.z.array(Nu.cardActionZodSchema)})});var kn=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.activityEventNamesZodSchema=ht.ActivityEventNames=void 0;var Du=j(),Ei;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(Ei||(ht.ActivityEventNames=Ei={}));ht.activityEventNamesZodSchema=Du.z.enum(["ContinueConversation","CreateConversation"])});var En=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.activityImportanceZodSchema=mt.ActivityImportance=void 0;var zu=j(),Ui;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Ui||(mt.ActivityImportance=Ui={}));mt.activityImportanceZodSchema=zu.z.enum(["low","normal","high"])});var Un=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.activityTypesZodSchema=yt.ActivityTypes=void 0;var Lu=j(),Ri;(function(t){t.Message="message",t.ContactRelationUpdate="contactRelationUpdate",t.ConversationUpdate="conversationUpdate",t.Typing="typing",t.EndOfConversation="endOfConversation",t.Event="event",t.Invoke="invoke",t.InvokeResponse="invokeResponse",t.DeleteUserData="deleteUserData",t.MessageUpdate="messageUpdate",t.MessageDelete="messageDelete",t.InstallationUpdate="installationUpdate",t.MessageReaction="messageReaction",t.Suggestion="suggestion",t.Trace="trace",t.Handoff="handoff",t.Command="command",t.CommandResult="commandResult"})(Ri||(yt.ActivityTypes=Ri={}));yt.activityTypesZodSchema=Lu.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Mi=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.attachmentZodSchema=void 0;var vt=j();Ar.attachmentZodSchema=vt.z.object({contentType:vt.z.string().min(1),contentUrl:vt.z.string().min(1).optional(),content:vt.z.unknown().optional(),name:vt.z.string().min(1).optional(),thumbnailUrl:vt.z.string().min(1).optional()})});var Ni=y(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.addProductInfoToActivity=He.clearProductInfoFromActivity=void 0;var Fu=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};He.clearProductInfoFromActivity=Fu;var qu=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,He.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};He.addProductInfoToActivity=qu});var Rn=y(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.channelAccountZodSchema=void 0;var Q=j(),Vu=qt();Or.channelAccountZodSchema=Q.z.object({id:Q.z.string().min(1).optional(),name:Q.z.string().optional(),aadObjectId:Q.z.string().min(1).optional(),tenantId:Q.z.string().min(1).optional(),agenticUserId:Q.z.string().min(1).optional(),agenticAppId:Q.z.string().min(1).optional(),agenticAppBlueprintId:Q.z.string().min(1).optional(),role:Q.z.union([Vu.roleTypeZodSchema,Q.z.string().min(1)]).optional(),properties:Q.z.unknown().optional()})});var Mn=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.conversationAccountZodSchema=void 0;var ce=j(),$u=qt();Pr.conversationAccountZodSchema=ce.z.object({isGroup:ce.z.boolean().optional(),conversationType:ce.z.string().min(1).optional(),tenantId:ce.z.string().min(1).optional(),id:ce.z.string().min(1),name:ce.z.string().min(1).optional(),aadObjectId:ce.z.string().min(1).optional(),role:ce.z.union([$u.roleTypeZodSchema,ce.z.string().min(1)]).optional(),properties:ce.z.unknown().optional()})});var zi=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.conversationReferenceZodSchema=void 0;var Yt=j(),Di=Rn(),Wu=Mn();Zr.conversationReferenceZodSchema=Yt.z.object({activityId:Yt.z.string().min(1).optional(),user:Di.channelAccountZodSchema.optional(),locale:Yt.z.string().min(1).optional(),agent:Di.channelAccountZodSchema.optional().nullable(),conversation:Wu.conversationAccountZodSchema,channelId:Yt.z.string().min(1),serviceUrl:Yt.z.string().min(1).optional()})});var Nn=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.deliveryModesZodSchema=gt.DeliveryModes=void 0;var Hu=j(),Li;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Li||(gt.DeliveryModes=Li={}));gt.deliveryModesZodSchema=Hu.z.enum(["normal","notification","expectReplies","ephemeral"])});var Dn=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.inputHintsZodSchema=_t.InputHints=void 0;var Bu=j(),Fi;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Fi||(_t.InputHints=Fi={}));_t.inputHintsZodSchema=Bu.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var zn=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.messageReactionTypesZodSchema=bt.MessageReactionTypes=void 0;var Ku=j(),qi;(function(t){t.Like="like",t.PlusOne="plusOne"})(qi||(bt.MessageReactionTypes=qi={}));bt.messageReactionTypesZodSchema=Ku.z.enum(["like","plusOne"])});var Vi=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.messageReactionZodSchema=void 0;var Ln=j(),Ju=zn();jr.messageReactionZodSchema=Ln.z.object({type:Ln.z.union([Ju.messageReactionTypesZodSchema,Ln.z.string().min(1)])})});var Fn=y(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.textFormatTypesZodSchema=xt.TextFormatTypes=void 0;var Gu=j(),$i;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})($i||(xt.TextFormatTypes=$i={}));xt.textFormatTypesZodSchema=Gu.z.enum(["markdown","plain","xml"])});var Wi=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.textHighlightZodSchema=void 0;var qn=j();kr.textHighlightZodSchema=qn.z.object({text:qn.z.string().min(1),occurrence:qn.z.number()})});var Yi=y(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.Activity=Be.activityZodSchema=void 0;var Yu=Oi(),_=j(),Xu=Zi(),Qu=ki(),Gi=kn(),ed=En(),Ur=Un(),td=Mi(),rd=on(),Hi=Ni(),Er=Rn(),Bi=sn(),nd=Mn(),od=zi(),id=an(),sd=Nn(),ad=jn(),cd=Dn(),Ki=Vi(),ud=Fn(),dd=Wi(),Ji=qt();Be.activityZodSchema=_.z.object({type:_.z.union([Ur.activityTypesZodSchema,_.z.string().min(1)]),text:_.z.string().optional(),id:_.z.string().min(1).optional(),channelId:_.z.string().min(1).optional(),from:Er.channelAccountZodSchema.optional(),timestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:_.z.string().min(1).optional(),callerId:_.z.string().min(1).optional(),serviceUrl:_.z.string().min(1).optional(),conversation:nd.conversationAccountZodSchema.optional(),recipient:Er.channelAccountZodSchema.optional(),textFormat:_.z.union([ud.textFormatTypesZodSchema,_.z.string().min(1)]).optional(),attachmentLayout:_.z.union([rd.attachmentLayoutTypesZodSchema,_.z.string().min(1)]).optional(),membersAdded:_.z.array(Er.channelAccountZodSchema).optional(),membersRemoved:_.z.array(Er.channelAccountZodSchema).optional(),reactionsAdded:_.z.array(Ki.messageReactionZodSchema).optional(),reactionsRemoved:_.z.array(Ki.messageReactionZodSchema).optional(),topicName:_.z.string().min(1).optional(),historyDisclosed:_.z.boolean().optional(),locale:_.z.string().min(1).optional(),speak:_.z.string().min(1).optional(),inputHint:_.z.union([cd.inputHintsZodSchema,_.z.string().min(1)]).optional(),summary:_.z.string().min(1).optional(),suggestedActions:Qu.suggestedActionsZodSchema.optional(),attachments:_.z.array(td.attachmentZodSchema).optional(),entities:_.z.array(ad.entityZodSchema.passthrough()).optional(),channelData:_.z.any().optional(),action:_.z.string().min(1).optional(),replyToId:_.z.string().min(1).optional(),label:_.z.string().min(1).optional(),valueType:_.z.string().min(1).optional(),value:_.z.unknown().optional(),name:_.z.union([Gi.activityEventNamesZodSchema,_.z.string().min(1)]).optional(),relatesTo:od.conversationReferenceZodSchema.optional(),code:_.z.union([id.endOfConversationCodesZodSchema,_.z.string().min(1)]).optional(),expiration:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:_.z.union([ed.activityImportanceZodSchema,_.z.string().min(1)]).optional(),deliveryMode:_.z.union([sd.deliveryModesZodSchema,_.z.string().min(1)]).optional(),listenFor:_.z.array(_.z.string().min(1)).optional(),textHighlights:_.z.array(dd.textHighlightZodSchema).optional(),semanticAction:Xu.semanticActionZodSchema.optional()});var Vn=class t{constructor(e){if(e===void 0)throw new Error("Invalid ActivityType: undefined");if(e===null)throw new Error("Invalid ActivityType: null");if(typeof e=="string"&&e.length===0)throw new Error("Invalid ActivityType: empty string");this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Be.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw new Error(`Invalid channelId ${e}. Found subChannel but no main channel.`);this._channelId=r,n?(0,Hi.addProductInfoToActivity)(this,n):(0,Hi.clearProductInfoFromActivity)(this)}set channelIdChannel(e){this._channelId=e}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var e,r;return(r=(e=this.entities)===null||e===void 0?void 0:e.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(e){if(!this._channelId)throw new Error("Primary channel must be set before setting subChannel");this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:Ur.ActivityTypes.Event,name:Gi.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,Yu.v4)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(n)}getAppropriateReplyToId(){if(this.type!==Ur.ActivityTypes.ConversationUpdate||this.channelId!==Bi.Channels.Directline&&this.channelId!==Bi.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw new Error("Activity Recipient undefined");if(this.conversation===null||this.conversation===void 0)throw new Error("Activity Conversation undefined");if(this.channelId===null||this.channelId===void 0)throw new Error("Activity ChannelId undefined");return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===Ur.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),d=e.substring(0,n);d.length>0&&!/\s$/.test(d)&&(d+=" "),e=d+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}getReplyConversationReference(e){let r=this.getConversationReference();return r.activityId=e,r}toJsonString(){let e={...this};return e.channelId=e._channelId,delete e._channelId,JSON.stringify(e)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===Ji.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Ji.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var e,r,n;return(r=(e=this.recipient)===null||e===void 0?void 0:e.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticAppId}getAgenticUser(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticUserId}};Be.Activity=Vn});var Xi=y(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.activityTreatments=wt.ActivityTreatments=void 0;var ld=j(),$n;(function(t){t.Targeted="targeted"})($n||(wt.ActivityTreatments=$n={}));wt.activityTreatments=ld.z.nativeEnum($n)});var Wn=y(w=>{"use strict";var fd=w&&w.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Qi=w&&w.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fd(e,t,r)};Object.defineProperty(w,"__esModule",{value:!0});w.Logger=w.debug=w.ActivityTreatments=w.TextFormatTypes=w.MessageReactionTypes=w.InputHints=w.DeliveryModes=w.ActivityTypes=w.ActivityImportance=w.ActivityEventNames=w.activityZodSchema=w.Activity=w.RoleTypes=w.MembershipTypes=w.MembershipSourceTypes=w.EndOfConversationCodes=w.Channels=w.AttachmentLayoutTypes=w.SemanticActionStateTypes=w.ActionTypes=void 0;var pd=rn();Object.defineProperty(w,"ActionTypes",{enumerable:!0,get:function(){return pd.ActionTypes}});var hd=nn();Object.defineProperty(w,"SemanticActionStateTypes",{enumerable:!0,get:function(){return hd.SemanticActionStateTypes}});var md=on();Object.defineProperty(w,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return md.AttachmentLayoutTypes}});var yd=sn();Object.defineProperty(w,"Channels",{enumerable:!0,get:function(){return yd.Channels}});var vd=an();Object.defineProperty(w,"EndOfConversationCodes",{enumerable:!0,get:function(){return vd.EndOfConversationCodes}});var gd=Go();Object.defineProperty(w,"MembershipSourceTypes",{enumerable:!0,get:function(){return gd.MembershipSourceTypes}});var _d=Xo();Object.defineProperty(w,"MembershipTypes",{enumerable:!0,get:function(){return _d.MembershipTypes}});var bd=qt();Object.defineProperty(w,"RoleTypes",{enumerable:!0,get:function(){return bd.RoleTypes}});Qi(ei(),w);Qi(ti(),w);var es=Yi();Object.defineProperty(w,"Activity",{enumerable:!0,get:function(){return es.Activity}});Object.defineProperty(w,"activityZodSchema",{enumerable:!0,get:function(){return es.activityZodSchema}});var xd=kn();Object.defineProperty(w,"ActivityEventNames",{enumerable:!0,get:function(){return xd.ActivityEventNames}});var wd=En();Object.defineProperty(w,"ActivityImportance",{enumerable:!0,get:function(){return wd.ActivityImportance}});var Cd=Un();Object.defineProperty(w,"ActivityTypes",{enumerable:!0,get:function(){return Cd.ActivityTypes}});var Id=Nn();Object.defineProperty(w,"DeliveryModes",{enumerable:!0,get:function(){return Id.DeliveryModes}});var Td=Dn();Object.defineProperty(w,"InputHints",{enumerable:!0,get:function(){return Td.InputHints}});var Sd=zn();Object.defineProperty(w,"MessageReactionTypes",{enumerable:!0,get:function(){return Sd.MessageReactionTypes}});var Ad=Fn();Object.defineProperty(w,"TextFormatTypes",{enumerable:!0,get:function(){return Ad.TextFormatTypes}});var Od=Xi();Object.defineProperty(w,"ActivityTreatments",{enumerable:!0,get:function(){return Od.ActivityTreatments}});var ts=Mt();Object.defineProperty(w,"debug",{enumerable:!0,get:function(){return ts.debug}});Object.defineProperty(w,"Logger",{enumerable:!0,get:function(){return ts.Logger}})});var Ut=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Ut||{});var Rt=(A=>(A.Unknown="Unknown",A.Exp="Exp",A.Dev="Dev",A.Test="Test",A.Preprod="Preprod",A.FirstRelease="FirstRelease",A.Prod="Prod",A.Gov="Gov",A.High="High",A.DoD="DoD",A.Mooncake="Mooncake",A.Ex="Ex",A.Rx="Rx",A.Prv="Prv",A.Local="Local",A.GovFR="GovFR",A.Other="Other",A))(Rt||{});var $r=class{constructor(){this.appClientId="";this.tenantId="";this.authority="";this.environmentId="";this.agentIdentifier="";this.useExperimentalEndpoint=!1}},Wr=class extends $r{constructor(e){var i,s;if(super(),!e)return;let r=(i=e.cloud)!=null?i:"Prod",n=(s=e.copilotAgentType)!=null?s:"Published",o=e.authority&&e.authority.trim()!==""?e.authority:"https://login.microsoftonline.com";if(!Object.values(Rt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Rt).join(", ")}`);if(!Object.values(Ut).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(Ut).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},Bd=()=>{var t,e,r,n,o,i;return new Wr({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((i=process.env.useExperimentalEndpoint)==null?void 0:i.toLowerCase())==="true"})};var tr=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Hr(t){}function uo(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Hr,onError:r=Hr,onRetry:n=Hr,onComment:o}=t,i="",s=!0,a,d="",l="";function f(g){let S=s?g.replace(/^\xEF\xBB\xBF/,""):g,[A,F]=ks(`${i}${S}`);for(let te of A)m(te);i=F,s=!1}function m(g){if(g===""){T();return}if(g.startsWith(":")){o&&o(g.slice(g.startsWith(": ")?2:1));return}let S=g.indexOf(":");if(S!==-1){let A=g.slice(0,S),F=g[S+1]===" "?2:1,te=g.slice(S+F);b(A,te,g);return}b(g,"",g)}function b(g,S,A){switch(g){case"event":l=S;break;case"data":d=`${d}${S}
|
|
2
|
-
`;break;case"id":a=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?n(parseInt(S,10)):r(new
|
|
3
|
-
`)?d.slice(0,-1):d}),a=void 0,d="",l=""}function O(
|
|
1
|
+
var Ss=Object.create;var co=Object.defineProperty;var As=Object.getOwnPropertyDescriptor;var Os=Object.getOwnPropertyNames;var Ps=Object.getPrototypeOf,Zs=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var js=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Os(e))!Zs.call(t,o)&&o!==r&&co(t,o,{get:()=>e[o],enumerable:!(n=As(e,o))||n.enumerable});return t};var Rt=(t,e,r)=>(r=t!=null?Ss(Ps(t)):{},js(e||!t||!t.__esModule?co(r,"default",{value:t,enumerable:!0}):r,t));var ho=y((Xd,po)=>{var Qe=1e3,et=Qe*60,tt=et*60,Oe=tt*24,zs=Oe*7,Ls=Oe*365.25;po.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return qs(t);if(r==="number"&&isFinite(t))return e.long?Vs(t):Fs(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function qs(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Ls;case"weeks":case"week":case"w":return r*zs;case"days":case"day":case"d":return r*Oe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*tt;case"minutes":case"minute":case"mins":case"min":case"m":return r*et;case"seconds":case"second":case"secs":case"sec":case"s":return r*Qe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Fs(t){var e=Math.abs(t);return e>=Oe?Math.round(t/Oe)+"d":e>=tt?Math.round(t/tt)+"h":e>=et?Math.round(t/et)+"m":e>=Qe?Math.round(t/Qe)+"s":t+"ms"}function Vs(t){var e=Math.abs(t);return e>=Oe?or(t,e,Oe,"day"):e>=tt?or(t,e,tt,"hour"):e>=et?or(t,e,et,"minute"):e>=Qe?or(t,e,Qe,"second"):t+" ms"}function or(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var yo=y((Qd,mo)=>{function $s(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=ho(),r.destroy=l,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let m=0;for(let g=0;g<f.length;g++)m=(m<<5)-m+f.charCodeAt(g),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(f){let m,g=null,T,O;function v(...S){if(!v.enabled)return;let A=v,P=Number(new Date),R=P-(m||P);A.diff=R,A.prev=m,A.curr=P,m=P,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let V=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,($,Y)=>{if($==="%%")return"%";V++;let Se=r.formatters[Y];if(typeof Se=="function"){let Vr=S[V];$=Se.call(A,Vr),S.splice(V,1),V--}return $}),r.formatArgs.call(A,S),(A.log||r.log).apply(A,S)}return v.namespace=f,v.useColors=r.useColors(),v.color=r.selectColor(f),v.extend=n,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(T!==r.namespaces&&(T=r.namespaces,O=r.enabled(f)),O),set:S=>{g=S}}),typeof r.init=="function"&&r.init(v),v}function n(f,m){let g=r(this.namespace+(typeof m=="undefined"?":":m)+f);return g.log=this.log,g}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let m=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let g of m)g[0]==="-"?r.skips.push(g.slice(1)):r.names.push(g)}function i(f,m){let g=0,T=0,O=-1,v=0;for(;g<f.length;)if(T<m.length&&(m[T]===f[g]||m[T]==="*"))m[T]==="*"?(O=T,v=g,T++):(g++,T++);else if(O!==-1)T=O+1,v++,g=v;else return!1;for(;T<m.length&&m[T]==="*";)T++;return T===m.length}function s(){let f=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),f}function a(f){for(let m of r.skips)if(i(f,m))return!1;for(let m of r.names)if(i(f,m))return!0;return!1}function d(f){return f instanceof Error?f.stack||f.message:f}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}mo.exports=$s});var vo=y((H,ir)=>{H.formatArgs=Hs;H.save=Bs;H.load=Ks;H.useColors=Ws;H.storage=Js();H.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();H.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 Ws(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Hs(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+ir.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}H.log=console.debug||console.log||(()=>{});function Bs(t){try{t?H.storage.setItem("debug",t):H.storage.removeItem("debug")}catch{}}function Ks(){let t;try{t=H.storage.getItem("debug")||H.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Js(){try{return localStorage}catch{}}ir.exports=yo()(H);var{formatters:Gs}=ir.exports;Gs.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Dt=y(Pe=>{"use strict";var Ys=Pe&&Pe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.Logger=void 0;Pe.debug=ea;var Xs=Ys(vo()),Qs=["info","warn","error","debug"],sr=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of Qs){let n=(0,Xs.default)(`${e}:${r}`);n.color=this.getPlatformColor(r),this.loggers[r]=n}}getPlatformColor(e){return{node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}}[typeof window!="undefined"?"browser":"node"][e]}info(e,...r){this.loggers.info(e,...r)}warn(e,...r){this.loggers.warn(e,...r)}error(e,...r){this.loggers.error(e,...r)}debug(e,...r){this.loggers.debug(e,...r)}};Pe.Logger=sr;function ea(t){return new sr(t)}});var Lt=y(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.getParsedType=E.ZodParsedType=E.objectUtil=E.util=void 0;var Kr;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Kr||(E.util=Kr={}));var xo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(xo||(E.objectUtil=xo={}));E.ZodParsedType=Kr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var oa=t=>{switch(typeof t){case"undefined":return E.ZodParsedType.undefined;case"string":return E.ZodParsedType.string;case"number":return Number.isNaN(t)?E.ZodParsedType.nan:E.ZodParsedType.number;case"boolean":return E.ZodParsedType.boolean;case"function":return E.ZodParsedType.function;case"bigint":return E.ZodParsedType.bigint;case"symbol":return E.ZodParsedType.symbol;case"object":return Array.isArray(t)?E.ZodParsedType.array:t===null?E.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?E.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?E.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?E.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?E.ZodParsedType.date:E.ZodParsedType.object;default:return E.ZodParsedType.unknown}};E.getParsedType=oa});var lr=y(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.ZodError=_e.quotelessJson=_e.ZodIssueCode=void 0;var wo=Lt();_e.ZodIssueCode=wo.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 ia=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");_e.quotelessJson=ia;var qt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,d=0;for(;d<s.path.length;){let l=s.path[d];d===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wo.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};_e.ZodError=qt;qt.create=t=>new qt(t)});var Gr=y(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});var D=lr(),Ze=Lt(),sa=(t,e)=>{let r;switch(t.code){case D.ZodIssueCode.invalid_type:t.received===Ze.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case D.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.util.jsonStringifyReplacer)}`;break;case D.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.util.joinValues(t.keys,", ")}`;break;case D.ZodIssueCode.invalid_union:r="Invalid input";break;case D.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.util.joinValues(t.options)}`;break;case D.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.util.joinValues(t.options)}, received '${t.received}'`;break;case D.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case D.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case D.ZodIssueCode.invalid_date:r="Invalid date";break;case D.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ze.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case D.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case D.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case D.ZodIssueCode.custom:r="Invalid input";break;case D.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case D.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case D.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.util.assertNever(t)}return{message:r}};Jr.default=sa});var fr=y(be=>{"use strict";var aa=be&&be.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(be,"__esModule",{value:!0});be.defaultErrorMap=void 0;be.setErrorMap=ca;be.getErrorMap=ua;var Co=aa(Gr());be.defaultErrorMap=Co.default;var Io=Co.default;function ca(t){Io=t}function ua(){return Io}});var Xr=y(j=>{"use strict";var da=j&&j.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};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=pa;var la=fr(),To=da(Gr()),fa=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",d=n.filter(l=>!!l).slice().reverse();for(let l of d)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};j.makeIssue=fa;j.EMPTY_PATH=[];function pa(t,e){let r=(0,la.getErrorMap)(),n=(0,j.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===To.default?void 0:To.default].filter(o=>!!o)});t.common.issues.push(n)}var Yr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return j.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return j.INVALID;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}};j.ParseStatus=Yr;j.INVALID=Object.freeze({status:"aborted"});var ha=t=>({status:"dirty",value:t});j.DIRTY=ha;var ma=t=>({status:"valid",value:t});j.OK=ma;var ya=t=>t.status==="aborted";j.isAborted=ya;var va=t=>t.status==="dirty";j.isDirty=va;var ga=t=>t.status==="valid";j.isValid=ga;var _a=t=>typeof Promise!="undefined"&&t instanceof Promise;j.isAsync=_a});var Ao=y(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0})});var Po=y(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.errorUtil=void 0;var Oo;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Oo||(pr.errorUtil=Oo={}))});var qo=y(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.discriminatedUnion=c.date=c.boolean=c.bigint=c.array=c.any=c.coerce=c.ZodFirstPartyTypeKind=c.late=c.ZodSchema=c.Schema=c.ZodReadonly=c.ZodPipeline=c.ZodBranded=c.BRAND=c.ZodNaN=c.ZodCatch=c.ZodDefault=c.ZodNullable=c.ZodOptional=c.ZodTransformer=c.ZodEffects=c.ZodPromise=c.ZodNativeEnum=c.ZodEnum=c.ZodLiteral=c.ZodLazy=c.ZodFunction=c.ZodSet=c.ZodMap=c.ZodRecord=c.ZodTuple=c.ZodIntersection=c.ZodDiscriminatedUnion=c.ZodUnion=c.ZodObject=c.ZodArray=c.ZodVoid=c.ZodNever=c.ZodUnknown=c.ZodAny=c.ZodNull=c.ZodUndefined=c.ZodSymbol=c.ZodDate=c.ZodBoolean=c.ZodBigInt=c.ZodNumber=c.ZodString=c.ZodType=void 0;c.NEVER=c.void=c.unknown=c.union=c.undefined=c.tuple=c.transformer=c.symbol=c.string=c.strictObject=c.set=c.record=c.promise=c.preprocess=c.pipeline=c.ostring=c.optional=c.onumber=c.oboolean=c.object=c.number=c.nullable=c.null=c.never=c.nativeEnum=c.nan=c.map=c.literal=c.lazy=c.intersection=c.instanceof=c.function=c.enum=c.effect=void 0;c.datetimeRegex=Uo;c.custom=Mo;var p=lr(),hr=fr(),_=Po(),u=Xr(),h=Lt(),Q=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Zo=(t,e)=>{if((0,u.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new p.ZodError(t.common.issues);return this._error=r,this._error}}};function C(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{var l,f;let{message:d}=t;return s.code==="invalid_enum_value"?{message:d!=null?d:a.defaultError}:typeof a.data=="undefined"?{message:(l=d!=null?d:n)!=null?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(f=d!=null?d:r)!=null?f:a.defaultError}},description:o}}var I=class{get description(){return this._def.description}_getType(e){return(0,h.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,u.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r==null?void 0:r.async)!=null?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Zo(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(o=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,u.isAsync)(o)?o:Promise.resolve(o));return Zo(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:p.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(d=>d?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new J({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return X.create(this,this._def)}nullable(){return ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return he.create(this)}promise(){return Ce.create(this,this._def)}or(e){return Ne.create([this,e],this._def)}and(e){return De.create(this,e,this._def)}transform(e){return new J({...C(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ve({...C(this._def),innerType:this,defaultValue:r,typeName:x.ZodDefault})}brand(){return new Ft({typeName:x.ZodBranded,type:this,...C(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new $e({...C(this._def),innerType:this,catchValue:r,typeName:x.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Vt.create(this,e)}readonly(){return We.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=I;c.Schema=I;c.ZodSchema=I;var ba=/^c[^\s-]{8,}$/i,xa=/^[0-9a-z]+$/,wa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ca=/^[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,Ia=/^[a-z0-9_-]{21}$/i,Ta=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sa=/^[-+]?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)?)??$/,Aa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Oa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qr,Pa=/^(?:(?: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])$/,Za=/^(?:(?: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])$/,ja=/^(([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]))$/,ka=/^(([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])$/,Ea=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ua=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ko="((\\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])))",Ra=new RegExp(`^${ko}$`);function Eo(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Ma(t){return new RegExp(`^${Eo(t)}$`)}function Uo(t){let e=`${ko}T${Eo(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Na(t,e){return!!((e==="v4"||!e)&&Pa.test(t)||(e==="v6"||!e)&&ja.test(t))}function Da(t,e){if(!Ta.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function za(t,e){return!!((e==="v4"||!e)&&Za.test(t)||(e==="v6"||!e)&&ka.test(t))}var xe=class t extends I{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:i.parsedType}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Aa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"email",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Qr||(Qr=new RegExp(Oa,"u")),Qr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"emoji",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ca.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"uuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ia.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"nanoid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")ba.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")xa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid2",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")wa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ulid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"regex",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Uo(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Ra.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Ma(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Sa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"duration",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Na(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ip",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Da(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"jwt",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?za(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cidr",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Ea.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ua.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:p.ZodIssueCode.invalid_string,..._.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,..._.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,..._.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,..._.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,_.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};c.ZodString=xe;xe.create=t=>{var e;return new xe({checks:[],typeName:x.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};function La(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var je=class t extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:i.parsedType}),u.INVALID}let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="int"?h.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?La(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_finite,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,_.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&h.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};c.ZodNumber=je;je.create=t=>new je({checks:[],typeName:x.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var ke=class t extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:r.parsedType}),u.INVALID}gte(e,r){return this.setLimit("min",e,!0,_.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};c.ZodBigInt=ke;ke.create=t=>{var e;return new ke({checks:[],typeName:x.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};var Ee=class extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodBoolean=Ee;Ee.create=t=>new Ee({typeName:x.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var Ue=class t extends I{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:i.parsedType}),u.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_date}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.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(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:_.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};c.ZodDate=Ue;Ue.create=t=>new Ue({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:x.ZodDate,...C(t)});var ot=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodSymbol=ot;ot.create=t=>new ot({typeName:x.ZodSymbol,...C(t)});var Re=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodUndefined=Re;Re.create=t=>new Re({typeName:x.ZodUndefined,...C(t)});var Me=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodNull=Me;Me.create=t=>new Me({typeName:x.ZodNull,...C(t)});var we=class extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=we;we.create=t=>new we({typeName:x.ZodAny,...C(t)});var pe=class extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=pe;pe.create=t=>new pe({typeName:x.ZodUnknown,...C(t)});var re=class extends I{_parse(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:r.parsedType}),u.INVALID}};c.ZodNever=re;re.create=t=>new re({typeName:x.ZodNever,...C(t)});var it=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodVoid=it;it.create=t=>new it({typeName:x.ZodVoid,...C(t)});var he=class t extends I{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:r.parsedType}),u.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,u.addIssueToContext)(r,{code:s?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,u.addIssueToContext)(r,{code:p.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,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new Q(r,s,r.path,a)))).then(s=>u.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Q(r,s,r.path,a)));return u.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:_.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:_.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:_.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=he;he.create=(t,e)=>new he({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...C(e)});function nt(t){if(t instanceof B){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=X.create(nt(n))}return new B({...t._def,shape:()=>e})}else return t instanceof he?new he({...t._def,type:nt(t.element)}):t instanceof X?X.create(nt(t.unwrap())):t instanceof ue?ue.create(nt(t.unwrap())):t instanceof ce?ce.create(t.items.map(e=>nt(e))):t}var B=class t extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=h.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==h.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:l.parsedType}),u.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof re&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let d=[];for(let l of s){let f=i[l],m=o.data[l];d.push({key:{status:"valid",value:l},value:f._parse(new Q(o,m,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof re){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of a)d.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(l==="strict")a.length>0&&((0,u.addIssueToContext)(o,{code:p.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of a){let m=o.data[f];d.push({key:{status:"valid",value:f},value:l._parse(new Q(o,m,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of d){let m=await f.key,g=await f.value;l.push({key:m,value:g,alwaysSet:f.alwaysSet})}return l}).then(l=>u.ParseStatus.mergeObjectSync(n,l)):u.ParseStatus.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return _.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,d;let o=(a=(s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(d=_.errorUtil.errToObj(e).message)!=null?d:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of h.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of h.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return nt(this)}partial(e){let r={};for(let n of h.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of h.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof X;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Ro(h.util.objectKeys(this.shape))}};c.ZodObject=B;B.create=(t,e)=>new B({shape:()=>t,unknownKeys:"strip",catchall:re.create(),typeName:x.ZodObject,...C(e)});B.strictCreate=(t,e)=>new B({shape:()=>t,unknownKeys:"strict",catchall:re.create(),typeName:x.ZodObject,...C(e)});B.lazycreate=(t,e)=>new B({shape:t,unknownKeys:"strip",catchall:re.create(),typeName:x.ZodObject,...C(e)});var Ne=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new p.ZodError(a.ctx.common.issues));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:s}),u.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let d of n){let l={...r,common:{...r.common,issues:[]},parent:null},f=d._parseSync({data:r.data,path:r.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(d=>new p.ZodError(d));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:a}),u.INVALID}}get options(){return this._def.options}};c.ZodUnion=Ne;Ne.create=(t,e)=>new Ne({options:t,typeName:x.ZodUnion,...C(e)});var fe=t=>t instanceof ze?fe(t.schema):t instanceof J?fe(t.innerType()):t instanceof Le?[t.value]:t instanceof qe?t.options:t instanceof Fe?h.util.objectValues(t.enum):t instanceof Ve?fe(t._def.innerType):t instanceof Re?[void 0]:t instanceof Me?[null]:t instanceof X?[void 0,...fe(t.unwrap())]:t instanceof ue?[null,...fe(t.unwrap())]:t instanceof Ft||t instanceof We?fe(t.unwrap()):t instanceof $e?fe(t._def.innerType):[],mr=class t extends I{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:r.parsedType}),u.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,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),u.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=fe(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...C(n)})}};c.ZodDiscriminatedUnion=mr;function en(t,e){let r=(0,h.getParsedType)(t),n=(0,h.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===h.ZodParsedType.object&&n===h.ZodParsedType.object){let o=h.util.objectKeys(e),i=h.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let d=en(t[a],e[a]);if(!d.valid)return{valid:!1};s[a]=d.data}return{valid:!0,data:s}}else if(r===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],d=en(s,a);if(!d.valid)return{valid:!1};o.push(d.data)}return{valid:!0,data:o}}else return r===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var De=class extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,u.isAborted)(i)||(0,u.isAborted)(s))return u.INVALID;let a=en(i.value,s.value);return a.valid?(((0,u.isDirty)(i)||(0,u.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_intersection_types}),u.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c.ZodIntersection=De;De.create=(t,e,r)=>new De({left:t,right:e,typeName:x.ZodIntersection,...C(r)});var ce=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),u.INVALID;if(n.data.length<this._def.items.length)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let d=this._def.items[a]||this._def.rest;return d?d._parse(new Q(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>u.ParseStatus.mergeArray(r,s)):u.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};c.ZodTuple=ce;ce.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ce({items:t,typeName:x.ZodTuple,rest:null,...C(e)})};var yr=class t extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),u.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Q(n,a,n.path,a)),value:s._parse(new Q(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?u.ParseStatus.mergeObjectAsync(r,o):u.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof I?new t({keyType:e,valueType:r,typeName:x.ZodRecord,...C(n)}):new t({keyType:xe.create(),valueType:e,typeName:x.ZodRecord,...C(r)})}};c.ZodRecord=yr;var st=class extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.map)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),u.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,d],l)=>({key:o._parse(new Q(n,a,n.path,[l,"key"])),value:i._parse(new Q(n,d,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let d of s){let l=await d.key,f=await d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let d of s){let l=d.key,f=d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}}}};c.ZodMap=st;st.create=(t,e,r)=>new st({valueType:e,keyType:t,typeName:x.ZodMap,...C(r)});var at=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.set)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),u.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,u.addIssueToContext)(n,{code:p.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,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(d){let l=new Set;for(let f of d){if(f.status==="aborted")return u.INVALID;f.status==="dirty"&&r.dirty(),l.add(f.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((d,l)=>i._parse(new Q(n,d,n.path,l)));return n.common.async?Promise.all(a).then(d=>s(d)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:_.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:_.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=at;at.create=(t,e)=>new at({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...C(e)});var vr=class t extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.function)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:r.parsedType}),u.INVALID;function n(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,hr.getErrorMap)(),hr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_arguments,argumentsError:d}})}function o(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,hr.getErrorMap)(),hr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_return_type,returnTypeError:d}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ce){let a=this;return(0,u.OK)(async function(...d){let l=new p.ZodError([]),f=await a._def.args.parseAsync(d,i).catch(T=>{throw l.addIssue(n(d,T)),l}),m=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(m,i).catch(T=>{throw l.addIssue(o(m,T)),l})})}else{let a=this;return(0,u.OK)(function(...d){let l=a._def.args.safeParse(d,i);if(!l.success)throw new p.ZodError([n(d,l.error)]);let f=Reflect.apply(s,this,l.data),m=a._def.returns.safeParse(f,i);if(!m.success)throw new p.ZodError([o(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ce.create(e).rest(pe.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ce.create([]).rest(pe.create()),returns:r||pe.create(),typeName:x.ZodFunction,...C(n)})}};c.ZodFunction=vr;var ze=class extends I{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};c.ZodLazy=ze;ze.create=(t,e)=>new ze({getter:t,typeName:x.ZodLazy,...C(e)});var Le=class extends I{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),u.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};c.ZodLiteral=Le;Le.create=(t,e)=>new Le({value:t,typeName:x.ZodLiteral,...C(e)});function Ro(t,e){return new qe({values:t,typeName:x.ZodEnum,...C(e)})}var qe=class t extends I{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{expected:h.util.joinValues(n),received:r.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_enum_value,options:n}),u.INVALID}return(0,u.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};c.ZodEnum=qe;qe.create=Ro;var Fe=class extends I{_parse(e){let r=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{expected:h.util.joinValues(o),received:n.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(h.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{received:n.data,code:p.ZodIssueCode.invalid_enum_value,options:o}),u.INVALID}return(0,u.OK)(e.data)}get enum(){return this._def.values}};c.ZodNativeEnum=Fe;Fe.create=(t,e)=>new Fe({values:t,typeName:x.ZodNativeEnum,...C(e)});var Ce=class extends I{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.promise&&r.common.async===!1)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:r.parsedType}),u.INVALID;let n=r.parsedType===h.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,u.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};c.ZodPromise=Ce;Ce.create=(t,e)=>new Ce({type:t,typeName:x.ZodPromise,...C(e)});var J=class extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{(0,u.addIssueToContext)(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return u.INVALID;let d=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return d.status==="aborted"?u.INVALID:d.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(d.value):d});{if(r.value==="aborted")return u.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:a.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let d=o.refinement(a,i);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,u.isValid)(s))return u.INVALID;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>(0,u.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):u.INVALID);h.util.assertNever(o)}};c.ZodEffects=J;c.ZodTransformer=J;J.create=(t,e,r)=>new J({schema:t,typeName:x.ZodEffects,effect:e,...C(r)});J.createWithPreprocess=(t,e,r)=>new J({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...C(r)});var X=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.undefined?(0,u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodOptional=X;X.create=(t,e)=>new X({innerType:t,typeName:x.ZodOptional,...C(e)});var ue=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.null?(0,u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodNullable=ue;ue.create=(t,e)=>new ue({innerType:t,typeName:x.ZodNullable,...C(e)});var Ve=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),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}};c.ZodDefault=Ve;Ve.create=(t,e)=>new Ve({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...C(e)});var $e=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,u.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c.ZodCatch=$e;$e.create=(t,e)=>new $e({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...C(e)});var ct=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),u.INVALID}return{status:"valid",value:e.data}}};c.ZodNaN=ct;ct.create=t=>new ct({typeName:x.ZodNaN,...C(t)});c.BRAND=Symbol("zod_brand");var Ft=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};c.ZodBranded=Ft;var Vt=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?u.INVALID:i.status==="dirty"?(r.dirty(),(0,u.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"?u.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:x.ZodPipeline})}};c.ZodPipeline=Vt;var We=class extends I{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,u.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,u.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};c.ZodReadonly=We;We.create=(t,e)=>new We({innerType:t,typeName:x.ZodReadonly,...C(e)});function jo(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Mo(t,e={},r){return t?we.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(d=>{var l,f;if(!d){let m=jo(e,n),g=(f=(l=m.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...m,fatal:g})}});if(!i){let d=jo(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):we.create()}c.late={object:B.lazycreate};var x;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(x||(c.ZodFirstPartyTypeKind=x={}));var qa=(t,e={message:`Input not instance of ${t.name}`})=>Mo(r=>r instanceof t,e);c.instanceof=qa;var No=xe.create;c.string=No;var Do=je.create;c.number=Do;var Fa=ct.create;c.nan=Fa;var Va=ke.create;c.bigint=Va;var zo=Ee.create;c.boolean=zo;var $a=Ue.create;c.date=$a;var Wa=ot.create;c.symbol=Wa;var Ha=Re.create;c.undefined=Ha;var Ba=Me.create;c.null=Ba;var Ka=we.create;c.any=Ka;var Ja=pe.create;c.unknown=Ja;var Ga=re.create;c.never=Ga;var Ya=it.create;c.void=Ya;var Xa=he.create;c.array=Xa;var Qa=B.create;c.object=Qa;var ec=B.strictCreate;c.strictObject=ec;var tc=Ne.create;c.union=tc;var rc=mr.create;c.discriminatedUnion=rc;var nc=De.create;c.intersection=nc;var oc=ce.create;c.tuple=oc;var ic=yr.create;c.record=ic;var sc=st.create;c.map=sc;var ac=at.create;c.set=ac;var cc=vr.create;c.function=cc;var uc=ze.create;c.lazy=uc;var dc=Le.create;c.literal=dc;var lc=qe.create;c.enum=lc;var fc=Fe.create;c.nativeEnum=fc;var pc=Ce.create;c.promise=pc;var Lo=J.create;c.effect=Lo;c.transformer=Lo;var hc=X.create;c.optional=hc;var mc=ue.create;c.nullable=mc;var yc=J.createWithPreprocess;c.preprocess=yc;var vc=Vt.create;c.pipeline=vc;var gc=()=>No().optional();c.ostring=gc;var _c=()=>Do().optional();c.onumber=_c;var bc=()=>zo().optional();c.oboolean=bc;c.coerce={string:(t=>xe.create({...t,coerce:!0})),number:(t=>je.create({...t,coerce:!0})),boolean:(t=>Ee.create({...t,coerce:!0})),bigint:(t=>ke.create({...t,coerce:!0})),date:(t=>Ue.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var tn=y(ee=>{"use strict";var xc=ee&&ee.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ut=ee&&ee.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xc(e,t,r)};Object.defineProperty(ee,"__esModule",{value:!0});ut(fr(),ee);ut(Xr(),ee);ut(Ao(),ee);ut(Lt(),ee);ut(qo(),ee);ut(lr(),ee)});var k=y(K=>{"use strict";var Fo=K&&K.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),wc=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Cc=K&&K.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Fo(e,t,r);return wc(e,t),e},Ic=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fo(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.z=void 0;var Vo=Cc(tn());K.z=Vo;Ic(tn(),K);K.default=Vo});var rn=y(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.actionTypesZodSchema=dt.ActionTypes=void 0;var Tc=k(),$o;(function(t){t.OpenUrl="openUrl",t.ImBack="imBack",t.PostBack="postBack",t.PlayAudio="playAudio",t.PlayVideo="playVideo",t.ShowImage="showImage",t.DownloadFile="downloadFile",t.Signin="signin",t.Call="call",t.MessageBack="messageBack",t.OpenApp="openApp"})($o||(dt.ActionTypes=$o={}));dt.actionTypesZodSchema=Tc.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var nn=y(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.semanticActionStateTypesZodSchema=lt.SemanticActionStateTypes=void 0;var Sc=k(),Wo;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Wo||(lt.SemanticActionStateTypes=Wo={}));lt.semanticActionStateTypesZodSchema=Sc.z.enum(["start","continue","done"])});var on=y(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.attachmentLayoutTypesZodSchema=ft.AttachmentLayoutTypes=void 0;var Ac=k(),Ho;(function(t){t.List="list",t.Carousel="carousel"})(Ho||(ft.AttachmentLayoutTypes=Ho={}));ft.attachmentLayoutTypesZodSchema=Ac.z.enum(["list","carousel"])});var sn=y(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.Channels=void 0;var Bo;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(Bo||(gr.Channels=Bo={}))});var an=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.endOfConversationCodesZodSchema=pt.EndOfConversationCodes=void 0;var Oc=k(),Ko;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(Ko||(pt.EndOfConversationCodes=Ko={}));pt.endOfConversationCodesZodSchema=Oc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Go=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.membershipSourceTypeZodSchema=ht.MembershipSourceTypes=void 0;var Pc=k(),Jo;(function(t){t.Channel="channel",t.Team="team"})(Jo||(ht.MembershipSourceTypes=Jo={}));ht.membershipSourceTypeZodSchema=Pc.z.enum(["channel","team"])});var Xo=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.membershipTypeZodSchema=mt.MembershipTypes=void 0;var Zc=k(),Yo;(function(t){t.Direct="direct",t.Transitive="transitive"})(Yo||(mt.MembershipTypes=Yo={}));mt.membershipTypeZodSchema=Zc.z.enum(["direct","transitive"])});var $t=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.roleTypeZodSchema=yt.RoleTypes=void 0;var jc=k(),Qo;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(Qo||(yt.RoleTypes=Qo={}));yt.roleTypeZodSchema=jc.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var ei=y(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.addAIToActivity=void 0;var kc=(t,e,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:e,usageInfo:r};(n=t.entities)!==null&&n!==void 0||(t.entities=[]),t.entities.push(o)};_r.addAIToActivity=kc});var ti=y(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.adaptiveCardInvokeActionZodSchema=void 0;var He=k();br.adaptiveCardInvokeActionZodSchema=He.z.object({type:He.z.string().min(1),id:He.z.string().optional(),verb:He.z.string().min(1),data:He.z.record(He.z.string().min(1),He.z.any())})});var ri=y(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var ni=y(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.default="00000000-0000-0000-0000-000000000000"});var oi=y(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.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 Wt=y(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});var Ec=oi();function Uc(t){return typeof t=="string"&&Ec.default.test(t)}ln.default=Uc});var Ht=y(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});var Rc=Wt();function Mc(t){if(!(0,Rc.default)(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(t.slice(9,13),16))>>>8,e&255,(e=parseInt(t.slice(14,18),16))>>>8,e&255,(e=parseInt(t.slice(19,23),16))>>>8,e&255,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}fn.default=Mc});var me=y(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.unsafeStringify=void 0;var Nc=Wt(),M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));function ii(t,e=0){return(M[t[e+0]]+M[t[e+1]]+M[t[e+2]]+M[t[e+3]]+"-"+M[t[e+4]]+M[t[e+5]]+"-"+M[t[e+6]]+M[t[e+7]]+"-"+M[t[e+8]]+M[t[e+9]]+"-"+M[t[e+10]]+M[t[e+11]]+M[t[e+12]]+M[t[e+13]]+M[t[e+14]]+M[t[e+15]]).toLowerCase()}Bt.unsafeStringify=ii;function Dc(t,e=0){let r=ii(t,e);if(!(0,Nc.default)(r))throw TypeError("Stringified UUID is invalid");return r}Bt.default=Dc});var xr=y(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});var pn,zc=new Uint8Array(16);function Lc(){if(!pn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");pn=crypto.getRandomValues.bind(crypto)}return pn(zc)}hn.default=Lc});var mn=y(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.updateV1State=void 0;var si=xr(),qc=me(),Kt={};function Fc(t,e,r){var i,s,a,d;let n,o=(i=t==null?void 0:t._v6)!=null?i:!1;if(t){let l=Object.keys(t);l.length===1&&l[0]==="_v6"&&(t=void 0)}if(t)n=ai((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,si.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,si.default)();ci(Kt,l,f),n=ai(f,Kt.msecs,Kt.nsecs,o?void 0:Kt.clockseq,o?void 0:Kt.node,e,r)}return e!=null?e:(0,qc.unsafeStringify)(n)}function ci(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.nsecs)!=null||(t.nsecs=0),e===t.msecs?(t.nsecs++,t.nsecs>=1e4&&(t.node=void 0,t.nsecs=0)):e>t.msecs?t.nsecs=0:e<t.msecs&&(t.node=void 0),t.node||(t.node=r.slice(10,16),t.node[0]|=1,t.clockseq=(r[8]<<8|r[9])&16383),t.msecs=e,t}Jt.updateV1State=ci;function ai(t,e,r,n,o,i,s=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!i)i=new Uint8Array(16),s=0;else if(s<0||s+16>i.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);e!=null||(e=Date.now()),r!=null||(r=0),n!=null||(n=(t[8]<<8|t[9])&16383),o!=null||(o=t.slice(10,16)),e+=122192928e5;let a=((e&268435455)*1e4+r)%4294967296;i[s++]=a>>>24&255,i[s++]=a>>>16&255,i[s++]=a>>>8&255,i[s++]=a&255;let d=e/4294967296*1e4&268435455;i[s++]=d>>>8&255,i[s++]=d&255,i[s++]=d>>>24&15|16,i[s++]=d>>>16&255,i[s++]=n>>>8|128,i[s++]=n&255;for(let l=0;l<6;++l)i[s++]=o[l];return i}Jt.default=Fc});var vn=y(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});var Vc=Ht(),$c=me();function Wc(t){let e=typeof t=="string"?(0,Vc.default)(t):t,r=Hc(e);return typeof t=="string"?(0,$c.unsafeStringify)(r):r}yn.default=Wc;function Hc(t){return Uint8Array.of((t[6]&15)<<4|t[7]>>4&15,(t[7]&15)<<4|(t[4]&240)>>4,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,(t[1]&15)<<4|(t[2]&240)>>4,96|t[2]&15,t[3],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var di=y(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});function Bc(t){let e=Gc(t),r=Jc(e,t.length*8);return Kc(r)}function Kc(t){let e=new Uint8Array(t.length*4);for(let r=0;r<t.length*4;r++)e[r]=t[r>>2]>>>r%4*8&255;return e}function ui(t){return(t+64>>>9<<4)+14+1}function Jc(t,e){let r=new Uint32Array(ui(e)).fill(0);r.set(t),r[e>>5]|=128<<e%32,r[r.length-1]=e,t=r;let n=1732584193,o=-271733879,i=-1732584194,s=271733878;for(let a=0;a<t.length;a+=16){let d=n,l=o,f=i,m=s;n=z(n,o,i,s,t[a],7,-680876936),s=z(s,n,o,i,t[a+1],12,-389564586),i=z(i,s,n,o,t[a+2],17,606105819),o=z(o,i,s,n,t[a+3],22,-1044525330),n=z(n,o,i,s,t[a+4],7,-176418897),s=z(s,n,o,i,t[a+5],12,1200080426),i=z(i,s,n,o,t[a+6],17,-1473231341),o=z(o,i,s,n,t[a+7],22,-45705983),n=z(n,o,i,s,t[a+8],7,1770035416),s=z(s,n,o,i,t[a+9],12,-1958414417),i=z(i,s,n,o,t[a+10],17,-42063),o=z(o,i,s,n,t[a+11],22,-1990404162),n=z(n,o,i,s,t[a+12],7,1804603682),s=z(s,n,o,i,t[a+13],12,-40341101),i=z(i,s,n,o,t[a+14],17,-1502002290),o=z(o,i,s,n,t[a+15],22,1236535329),n=L(n,o,i,s,t[a+1],5,-165796510),s=L(s,n,o,i,t[a+6],9,-1069501632),i=L(i,s,n,o,t[a+11],14,643717713),o=L(o,i,s,n,t[a],20,-373897302),n=L(n,o,i,s,t[a+5],5,-701558691),s=L(s,n,o,i,t[a+10],9,38016083),i=L(i,s,n,o,t[a+15],14,-660478335),o=L(o,i,s,n,t[a+4],20,-405537848),n=L(n,o,i,s,t[a+9],5,568446438),s=L(s,n,o,i,t[a+14],9,-1019803690),i=L(i,s,n,o,t[a+3],14,-187363961),o=L(o,i,s,n,t[a+8],20,1163531501),n=L(n,o,i,s,t[a+13],5,-1444681467),s=L(s,n,o,i,t[a+2],9,-51403784),i=L(i,s,n,o,t[a+7],14,1735328473),o=L(o,i,s,n,t[a+12],20,-1926607734),n=q(n,o,i,s,t[a+5],4,-378558),s=q(s,n,o,i,t[a+8],11,-2022574463),i=q(i,s,n,o,t[a+11],16,1839030562),o=q(o,i,s,n,t[a+14],23,-35309556),n=q(n,o,i,s,t[a+1],4,-1530992060),s=q(s,n,o,i,t[a+4],11,1272893353),i=q(i,s,n,o,t[a+7],16,-155497632),o=q(o,i,s,n,t[a+10],23,-1094730640),n=q(n,o,i,s,t[a+13],4,681279174),s=q(s,n,o,i,t[a],11,-358537222),i=q(i,s,n,o,t[a+3],16,-722521979),o=q(o,i,s,n,t[a+6],23,76029189),n=q(n,o,i,s,t[a+9],4,-640364487),s=q(s,n,o,i,t[a+12],11,-421815835),i=q(i,s,n,o,t[a+15],16,530742520),o=q(o,i,s,n,t[a+2],23,-995338651),n=F(n,o,i,s,t[a],6,-198630844),s=F(s,n,o,i,t[a+7],10,1126891415),i=F(i,s,n,o,t[a+14],15,-1416354905),o=F(o,i,s,n,t[a+5],21,-57434055),n=F(n,o,i,s,t[a+12],6,1700485571),s=F(s,n,o,i,t[a+3],10,-1894986606),i=F(i,s,n,o,t[a+10],15,-1051523),o=F(o,i,s,n,t[a+1],21,-2054922799),n=F(n,o,i,s,t[a+8],6,1873313359),s=F(s,n,o,i,t[a+15],10,-30611744),i=F(i,s,n,o,t[a+6],15,-1560198380),o=F(o,i,s,n,t[a+13],21,1309151649),n=F(n,o,i,s,t[a+4],6,-145523070),s=F(s,n,o,i,t[a+11],10,-1120210379),i=F(i,s,n,o,t[a+2],15,718787259),o=F(o,i,s,n,t[a+9],21,-343485551),n=Ie(n,d),o=Ie(o,l),i=Ie(i,f),s=Ie(s,m)}return Uint32Array.of(n,o,i,s)}function Gc(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(ui(t.length*8)).fill(0);for(let r=0;r<t.length;r++)e[r>>2]|=(t[r]&255)<<r%4*8;return e}function Ie(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function Yc(t,e){return t<<e|t>>>32-e}function wr(t,e,r,n,o,i){return Ie(Yc(Ie(Ie(e,t),Ie(n,i)),o),r)}function z(t,e,r,n,o,i,s){return wr(e&r|~e&n,t,e,o,i,s)}function L(t,e,r,n,o,i,s){return wr(e&n|r&~n,t,e,o,i,s)}function q(t,e,r,n,o,i,s){return wr(e^r^n,t,e,o,i,s)}function F(t,e,r,n,o,i,s){return wr(r^(e|~n),t,e,o,i,s)}gn.default=Bc});var Gt=y(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.URL=ye.DNS=ye.stringToBytes=void 0;var li=Ht(),Xc=me();function fi(t){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r);return e}ye.stringToBytes=fi;ye.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ye.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Qc(t,e,r,n,o,i){let s=typeof r=="string"?fi(r):r,a=typeof n=="string"?(0,li.default)(n):n;if(typeof n=="string"&&(n=(0,li.default)(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let d=new Uint8Array(16+s.length);if(d.set(a),d.set(s,a.length),d=e(d),d[6]=d[6]&15|t,d[8]=d[8]&63|128,o){i=i||0;for(let l=0;l<16;++l)o[i+l]=d[l];return o}return(0,Xc.unsafeStringify)(d)}ye.default=Qc});var hi=y(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.URL=Be.DNS=void 0;var eu=di(),_n=Gt(),pi=Gt();Object.defineProperty(Be,"DNS",{enumerable:!0,get:function(){return pi.DNS}});Object.defineProperty(Be,"URL",{enumerable:!0,get:function(){return pi.URL}});function bn(t,e,r,n){return(0,_n.default)(48,eu.default,t,e,r,n)}bn.DNS=_n.DNS;bn.URL=_n.URL;Be.default=bn});var mi=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});var tu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);xn.default={randomUUID:tu}});var vi=y(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});var yi=mi(),ru=xr(),nu=me();function ou(t,e,r){var o,i,s;if(yi.default.randomUUID&&!e&&!t)return yi.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,ru.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,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return(0,nu.unsafeStringify)(n)}wn.default=ou});var gi=y(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});function iu(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function Cn(t,e){return t<<e|t>>>32-e}function su(t){let e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(t.length+1);n.set(t),n[t.length]=128,t=n;let o=t.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let d=new Uint32Array(16);for(let l=0;l<16;++l)d[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=d}s[i-1][14]=(t.length-1)*8/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<i;++a){let d=new Uint32Array(80);for(let O=0;O<16;++O)d[O]=s[a][O];for(let O=16;O<80;++O)d[O]=Cn(d[O-3]^d[O-8]^d[O-14]^d[O-16],1);let l=r[0],f=r[1],m=r[2],g=r[3],T=r[4];for(let O=0;O<80;++O){let v=Math.floor(O/20),S=Cn(l,5)+iu(v,f,m,g)+T+e[v]+d[O]>>>0;T=g,g=m,m=Cn(f,30)>>>0,f=l,l=S}r[0]=r[0]+l>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+g>>>0,r[4]=r[4]+T>>>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])}In.default=su});var bi=y(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.URL=Ke.DNS=void 0;var au=gi(),Tn=Gt(),_i=Gt();Object.defineProperty(Ke,"DNS",{enumerable:!0,get:function(){return _i.DNS}});Object.defineProperty(Ke,"URL",{enumerable:!0,get:function(){return _i.URL}});function Sn(t,e,r,n){return(0,Tn.default)(80,au.default,t,e,r,n)}Sn.DNS=Tn.DNS;Sn.URL=Tn.URL;Ke.default=Sn});var xi=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});var cu=me(),uu=mn(),du=vn();function lu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,uu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,du.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,cu.unsafeStringify)(n)}An.default=lu});var wi=y(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});var fu=Ht(),pu=me();function hu(t){let e=typeof t=="string"?(0,fu.default)(t):t,r=mu(e);return typeof t=="string"?(0,pu.unsafeStringify)(r):r}On.default=hu;function mu(t){return Uint8Array.of((t[3]&15)<<4|t[4]>>4&15,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|t[6]&15,t[7],(t[1]&15)<<4|(t[2]&240)>>4,(t[2]&15)<<4|(t[3]&240)>>4,16|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var Si=y(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.updateV7State=void 0;var Ci=xr(),yu=me(),Pn={};function vu(t,e,r){var o,i,s;let n;if(t)n=Ii((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,Ci.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,Ci.default)();Ti(Pn,a,d),n=Ii(d,Pn.msecs,Pn.seq,e,r)}return e!=null?e:(0,yu.unsafeStringify)(n)}function Ti(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.seq)!=null||(t.seq=0),e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}Yt.updateV7State=Ti;function Ii(t,e,r,n,o=0){if(t.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 e!=null||(e=Date.now()),r!=null||(r=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9]),n[o++]=e/1099511627776&255,n[o++]=e/4294967296&255,n[o++]=e/16777216&255,n[o++]=e/65536&255,n[o++]=e/256&255,n[o++]=e&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|t[10]&3,n[o++]=t[11],n[o++]=t[12],n[o++]=t[13],n[o++]=t[14],n[o++]=t[15],n}Yt.default=vu});var Ai=y(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});var gu=Wt();function _u(t){if(!(0,gu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}Zn.default=_u});var Oi=y(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.version=Z.validate=Z.v7=Z.v6ToV1=Z.v6=Z.v5=Z.v4=Z.v3=Z.v1ToV6=Z.v1=Z.stringify=Z.parse=Z.NIL=Z.MAX=void 0;var bu=ri();Object.defineProperty(Z,"MAX",{enumerable:!0,get:function(){return bu.default}});var xu=ni();Object.defineProperty(Z,"NIL",{enumerable:!0,get:function(){return xu.default}});var wu=Ht();Object.defineProperty(Z,"parse",{enumerable:!0,get:function(){return wu.default}});var Cu=me();Object.defineProperty(Z,"stringify",{enumerable:!0,get:function(){return Cu.default}});var Iu=mn();Object.defineProperty(Z,"v1",{enumerable:!0,get:function(){return Iu.default}});var Tu=vn();Object.defineProperty(Z,"v1ToV6",{enumerable:!0,get:function(){return Tu.default}});var Su=hi();Object.defineProperty(Z,"v3",{enumerable:!0,get:function(){return Su.default}});var Au=vi();Object.defineProperty(Z,"v4",{enumerable:!0,get:function(){return Au.default}});var Ou=bi();Object.defineProperty(Z,"v5",{enumerable:!0,get:function(){return Ou.default}});var Pu=xi();Object.defineProperty(Z,"v6",{enumerable:!0,get:function(){return Pu.default}});var Zu=wi();Object.defineProperty(Z,"v6ToV1",{enumerable:!0,get:function(){return Zu.default}});var ju=Si();Object.defineProperty(Z,"v7",{enumerable:!0,get:function(){return ju.default}});var ku=Wt();Object.defineProperty(Z,"validate",{enumerable:!0,get:function(){return ku.default}});var Eu=Ai();Object.defineProperty(Z,"version",{enumerable:!0,get:function(){return Eu.default}})});var jn=y(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.entityZodSchema=void 0;var Pi=k();Cr.entityZodSchema=Pi.z.object({type:Pi.z.string().min(1)}).passthrough()});var Zi=y(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.semanticActionZodSchema=void 0;var Xt=k(),Uu=jn(),Ru=nn();Ir.semanticActionZodSchema=Xt.z.object({id:Xt.z.string().min(1),state:Xt.z.union([Ru.semanticActionStateTypesZodSchema,Xt.z.string().min(1)]),entities:Xt.z.record(Uu.entityZodSchema)})});var ji=y(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.cardActionZodSchema=void 0;var de=k(),Mu=rn();Tr.cardActionZodSchema=de.z.object({type:de.z.union([Mu.actionTypesZodSchema,de.z.string().min(1)]),title:de.z.string().min(1),image:de.z.string().min(1).optional(),text:de.z.string().min(1).optional(),displayText:de.z.string().min(1).optional(),value:de.z.any().optional(),channelData:de.z.unknown().optional(),imageAltText:de.z.string().min(1).optional()})});var ki=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.suggestedActionsZodSchema=void 0;var Sr=k(),Nu=ji();Ar.suggestedActionsZodSchema=Sr.z.object({to:Sr.z.array(Sr.z.string().min(1)),actions:Sr.z.array(Nu.cardActionZodSchema)})});var kn=y(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.activityEventNamesZodSchema=vt.ActivityEventNames=void 0;var Du=k(),Ei;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(Ei||(vt.ActivityEventNames=Ei={}));vt.activityEventNamesZodSchema=Du.z.enum(["ContinueConversation","CreateConversation"])});var En=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.activityImportanceZodSchema=gt.ActivityImportance=void 0;var zu=k(),Ui;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Ui||(gt.ActivityImportance=Ui={}));gt.activityImportanceZodSchema=zu.z.enum(["low","normal","high"])});var Un=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.activityTypesZodSchema=_t.ActivityTypes=void 0;var Lu=k(),Ri;(function(t){t.Message="message",t.ContactRelationUpdate="contactRelationUpdate",t.ConversationUpdate="conversationUpdate",t.Typing="typing",t.EndOfConversation="endOfConversation",t.Event="event",t.Invoke="invoke",t.InvokeResponse="invokeResponse",t.DeleteUserData="deleteUserData",t.MessageUpdate="messageUpdate",t.MessageDelete="messageDelete",t.InstallationUpdate="installationUpdate",t.MessageReaction="messageReaction",t.Suggestion="suggestion",t.Trace="trace",t.Handoff="handoff",t.Command="command",t.CommandResult="commandResult"})(Ri||(_t.ActivityTypes=Ri={}));_t.activityTypesZodSchema=Lu.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Mi=y(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.attachmentZodSchema=void 0;var bt=k();Or.attachmentZodSchema=bt.z.object({contentType:bt.z.string().min(1),contentUrl:bt.z.string().min(1).optional(),content:bt.z.unknown().optional(),name:bt.z.string().min(1).optional(),thumbnailUrl:bt.z.string().min(1).optional()})});var Ni=y(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.addProductInfoToActivity=Je.clearProductInfoFromActivity=void 0;var qu=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};Je.clearProductInfoFromActivity=qu;var Fu=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,Je.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};Je.addProductInfoToActivity=Fu});var Rn=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.channelAccountZodSchema=void 0;var ne=k(),Vu=$t();Pr.channelAccountZodSchema=ne.z.object({id:ne.z.string().min(1).optional(),name:ne.z.string().optional(),aadObjectId:ne.z.string().min(1).optional(),tenantId:ne.z.string().min(1).optional(),agenticUserId:ne.z.string().min(1).optional(),agenticAppId:ne.z.string().min(1).optional(),agenticAppBlueprintId:ne.z.string().min(1).optional(),role:ne.z.union([Vu.roleTypeZodSchema,ne.z.string().min(1)]).optional(),properties:ne.z.unknown().optional()})});var Mn=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.conversationAccountZodSchema=void 0;var le=k(),$u=$t();Zr.conversationAccountZodSchema=le.z.object({isGroup:le.z.boolean().optional(),conversationType:le.z.string().min(1).optional(),tenantId:le.z.string().min(1).optional(),id:le.z.string().min(1),name:le.z.string().min(1).optional(),aadObjectId:le.z.string().min(1).optional(),role:le.z.union([$u.roleTypeZodSchema,le.z.string().min(1)]).optional(),properties:le.z.unknown().optional()})});var zi=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.conversationReferenceZodSchema=void 0;var Qt=k(),Di=Rn(),Wu=Mn();jr.conversationReferenceZodSchema=Qt.z.object({activityId:Qt.z.string().min(1).optional(),user:Di.channelAccountZodSchema.optional(),locale:Qt.z.string().min(1).optional(),agent:Di.channelAccountZodSchema.optional().nullable(),conversation:Wu.conversationAccountZodSchema,channelId:Qt.z.string().min(1),serviceUrl:Qt.z.string().min(1).optional()})});var Nn=y(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.deliveryModesZodSchema=xt.DeliveryModes=void 0;var Hu=k(),Li;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Li||(xt.DeliveryModes=Li={}));xt.deliveryModesZodSchema=Hu.z.enum(["normal","notification","expectReplies","ephemeral"])});var Dn=y(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.inputHintsZodSchema=wt.InputHints=void 0;var Bu=k(),qi;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(qi||(wt.InputHints=qi={}));wt.inputHintsZodSchema=Bu.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var zn=y(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.messageReactionTypesZodSchema=Ct.MessageReactionTypes=void 0;var Ku=k(),Fi;(function(t){t.Like="like",t.PlusOne="plusOne"})(Fi||(Ct.MessageReactionTypes=Fi={}));Ct.messageReactionTypesZodSchema=Ku.z.enum(["like","plusOne"])});var Vi=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.messageReactionZodSchema=void 0;var Ln=k(),Ju=zn();kr.messageReactionZodSchema=Ln.z.object({type:Ln.z.union([Ju.messageReactionTypesZodSchema,Ln.z.string().min(1)])})});var qn=y(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.textFormatTypesZodSchema=It.TextFormatTypes=void 0;var Gu=k(),$i;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})($i||(It.TextFormatTypes=$i={}));It.textFormatTypesZodSchema=Gu.z.enum(["markdown","plain","xml"])});var Wi=y(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.textHighlightZodSchema=void 0;var Fn=k();Er.textHighlightZodSchema=Fn.z.object({text:Fn.z.string().min(1),occurrence:Fn.z.number()})});var Yi=y(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.Activity=Ge.activityZodSchema=void 0;var Yu=Oi(),b=k(),Xu=Zi(),Qu=ki(),Gi=kn(),ed=En(),Rr=Un(),td=Mi(),rd=on(),Hi=Ni(),Ur=Rn(),Bi=sn(),nd=Mn(),od=zi(),id=an(),sd=Nn(),ad=jn(),cd=Dn(),Ki=Vi(),ud=qn(),dd=Wi(),Ji=$t();Ge.activityZodSchema=b.z.object({type:b.z.union([Rr.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:Ur.channelAccountZodSchema.optional(),timestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:b.z.string().min(1).optional(),callerId:b.z.string().min(1).optional(),serviceUrl:b.z.string().min(1).optional(),conversation:nd.conversationAccountZodSchema.optional(),recipient:Ur.channelAccountZodSchema.optional(),textFormat:b.z.union([ud.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([rd.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(Ur.channelAccountZodSchema).optional(),membersRemoved:b.z.array(Ur.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(Ki.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(Ki.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([cd.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:Qu.suggestedActionsZodSchema.optional(),attachments:b.z.array(td.attachmentZodSchema).optional(),entities:b.z.array(ad.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([Gi.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:od.conversationReferenceZodSchema.optional(),code:b.z.union([id.endOfConversationCodesZodSchema,b.z.string().min(1)]).optional(),expiration:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:b.z.union([ed.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([sd.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(dd.textHighlightZodSchema).optional(),semanticAction:Xu.semanticActionZodSchema.optional()});var Vn=class t{constructor(e){if(e===void 0)throw new Error("Invalid ActivityType: undefined");if(e===null)throw new Error("Invalid ActivityType: null");if(typeof e=="string"&&e.length===0)throw new Error("Invalid ActivityType: empty string");this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Ge.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw new Error(`Invalid channelId ${e}. Found subChannel but no main channel.`);this._channelId=r,n?(0,Hi.addProductInfoToActivity)(this,n):(0,Hi.clearProductInfoFromActivity)(this)}set channelIdChannel(e){this._channelId=e}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var e,r;return(r=(e=this.entities)===null||e===void 0?void 0:e.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(e){if(!this._channelId)throw new Error("Primary channel must be set before setting subChannel");this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:Rr.ActivityTypes.Event,name:Gi.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,Yu.v4)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(n)}getAppropriateReplyToId(){if(this.type!==Rr.ActivityTypes.ConversationUpdate||this.channelId!==Bi.Channels.Directline&&this.channelId!==Bi.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw new Error("Activity Recipient undefined");if(this.conversation===null||this.conversation===void 0)throw new Error("Activity Conversation undefined");if(this.channelId===null||this.channelId===void 0)throw new Error("Activity ChannelId undefined");return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===Rr.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),d=e.substring(0,n);d.length>0&&!/\s$/.test(d)&&(d+=" "),e=d+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}getReplyConversationReference(e){let r=this.getConversationReference();return r.activityId=e,r}toJsonString(){let e={...this};return e.channelId=e._channelId,delete e._channelId,JSON.stringify(e)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===Ji.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Ji.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var e,r,n;return(r=(e=this.recipient)===null||e===void 0?void 0:e.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticAppId}getAgenticUser(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticUserId}};Ge.Activity=Vn});var Xi=y(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.activityTreatments=Tt.ActivityTreatments=void 0;var ld=k(),$n;(function(t){t.Targeted="targeted"})($n||(Tt.ActivityTreatments=$n={}));Tt.activityTreatments=ld.z.nativeEnum($n)});var Wn=y(w=>{"use strict";var fd=w&&w.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Qi=w&&w.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fd(e,t,r)};Object.defineProperty(w,"__esModule",{value:!0});w.Logger=w.debug=w.ActivityTreatments=w.TextFormatTypes=w.MessageReactionTypes=w.InputHints=w.DeliveryModes=w.ActivityTypes=w.ActivityImportance=w.ActivityEventNames=w.activityZodSchema=w.Activity=w.RoleTypes=w.MembershipTypes=w.MembershipSourceTypes=w.EndOfConversationCodes=w.Channels=w.AttachmentLayoutTypes=w.SemanticActionStateTypes=w.ActionTypes=void 0;var pd=rn();Object.defineProperty(w,"ActionTypes",{enumerable:!0,get:function(){return pd.ActionTypes}});var hd=nn();Object.defineProperty(w,"SemanticActionStateTypes",{enumerable:!0,get:function(){return hd.SemanticActionStateTypes}});var md=on();Object.defineProperty(w,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return md.AttachmentLayoutTypes}});var yd=sn();Object.defineProperty(w,"Channels",{enumerable:!0,get:function(){return yd.Channels}});var vd=an();Object.defineProperty(w,"EndOfConversationCodes",{enumerable:!0,get:function(){return vd.EndOfConversationCodes}});var gd=Go();Object.defineProperty(w,"MembershipSourceTypes",{enumerable:!0,get:function(){return gd.MembershipSourceTypes}});var _d=Xo();Object.defineProperty(w,"MembershipTypes",{enumerable:!0,get:function(){return _d.MembershipTypes}});var bd=$t();Object.defineProperty(w,"RoleTypes",{enumerable:!0,get:function(){return bd.RoleTypes}});Qi(ei(),w);Qi(ti(),w);var es=Yi();Object.defineProperty(w,"Activity",{enumerable:!0,get:function(){return es.Activity}});Object.defineProperty(w,"activityZodSchema",{enumerable:!0,get:function(){return es.activityZodSchema}});var xd=kn();Object.defineProperty(w,"ActivityEventNames",{enumerable:!0,get:function(){return xd.ActivityEventNames}});var wd=En();Object.defineProperty(w,"ActivityImportance",{enumerable:!0,get:function(){return wd.ActivityImportance}});var Cd=Un();Object.defineProperty(w,"ActivityTypes",{enumerable:!0,get:function(){return Cd.ActivityTypes}});var Id=Nn();Object.defineProperty(w,"DeliveryModes",{enumerable:!0,get:function(){return Id.DeliveryModes}});var Td=Dn();Object.defineProperty(w,"InputHints",{enumerable:!0,get:function(){return Td.InputHints}});var Sd=zn();Object.defineProperty(w,"MessageReactionTypes",{enumerable:!0,get:function(){return Sd.MessageReactionTypes}});var Ad=qn();Object.defineProperty(w,"TextFormatTypes",{enumerable:!0,get:function(){return Ad.TextFormatTypes}});var Od=Xi();Object.defineProperty(w,"ActivityTreatments",{enumerable:!0,get:function(){return Od.ActivityTreatments}});var ts=Dt();Object.defineProperty(w,"debug",{enumerable:!0,get:function(){return ts.debug}});Object.defineProperty(w,"Logger",{enumerable:!0,get:function(){return ts.Logger}})});var Mt=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Mt||{});var Nt=(A=>(A.Unknown="Unknown",A.Exp="Exp",A.Dev="Dev",A.Test="Test",A.Preprod="Preprod",A.FirstRelease="FirstRelease",A.Prod="Prod",A.Gov="Gov",A.High="High",A.DoD="DoD",A.Mooncake="Mooncake",A.Ex="Ex",A.Rx="Rx",A.Prv="Prv",A.Local="Local",A.GovFR="GovFR",A.Other="Other",A))(Nt||{});var $r=class{constructor(){this.appClientId="";this.tenantId="";this.authority="";this.environmentId="";this.agentIdentifier="";this.useExperimentalEndpoint=!1}},Wr=class extends $r{constructor(e){var i,s;if(super(),!e)return;let r=(i=e.cloud)!=null?i:"Prod",n=(s=e.copilotAgentType)!=null?s:"Published",o=e.authority&&e.authority.trim()!==""?e.authority:"https://login.microsoftonline.com";if(!Object.values(Nt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Nt).join(", ")}`);if(!Object.values(Mt).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(Mt).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},Bd=()=>{var t,e,r,n,o,i;return new Wr({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((i=process.env.useExperimentalEndpoint)==null?void 0:i.toLowerCase())==="true"})};var rr=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Hr(t){}function uo(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Hr,onError:r=Hr,onRetry:n=Hr,onComment:o}=t,i="",s=!0,a,d="",l="";function f(v){let S=s?v.replace(/^\xEF\xBB\xBF/,""):v,[A,P]=ks(`${i}${S}`);for(let R of A)m(R);i=P,s=!1}function m(v){if(v===""){T();return}if(v.startsWith(":")){o&&o(v.slice(v.startsWith(": ")?2:1));return}let S=v.indexOf(":");if(S!==-1){let A=v.slice(0,S),P=v[S+1]===" "?2:1,R=v.slice(S+P);g(A,R,v);return}g(v,"",v)}function g(v,S,A){switch(v){case"event":l=S;break;case"data":d=`${d}${S}
|
|
2
|
+
`;break;case"id":a=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?n(parseInt(S,10)):r(new rr(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:A}));break;default:r(new rr(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:S,line:A}));break}}function T(){d.length>0&&e({id:a,event:l||void 0,data:d.endsWith(`
|
|
3
|
+
`)?d.slice(0,-1):d}),a=void 0,d="",l=""}function O(v={}){i&&v.consume&&m(i),s=!0,a=void 0,d="",l="",i=""}return{feed:f,reset:O}}function ks(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),i=t.indexOf(`
|
|
4
4
|
`,n),s=-1;if(o!==-1&&i!==-1?s=Math.min(o,i):o!==-1?o===t.length-1?s=-1:s=o:i!==-1&&(s=i),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
5
|
-
`&&n++}}return[e,r]}var lo="connecting",Es="open",Br="closed",rr=()=>{};function Us(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=rr,onConnect:i=rr,onDisconnect:s=rr,onScheduleReconnect:a=rr}=r,{fetch:d,url:l,initialLastEventId:f}=Rs(r),m={...r.headers},b=[],T=n?[n]:[],O=E=>T.forEach(ne=>ne(E)),g=uo({onEvent:Cs,onRetry:Is,onComment:o}),S,A=l.toString(),F=new AbortController,te=f,ye=2e3,qr,re=Br;return Pt(),{close:Zt,connect:Pt,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Vr,get lastEventId(){return te},get url(){return A},get readyState(){return re}};function Pt(){S||(re=lo,F=new AbortController,S=d(l,Ts()).then(ws).catch(E=>{S=null,!(E.name==="AbortError"||E.type==="aborted"||F.signal.aborted)&&io()}))}function Zt(){re=Br,F.abort(),g.reset(),clearTimeout(qr),b.forEach(E=>E())}function Vr(){let E=[],ne=[];function jt(){return new Promise(q=>{let oe=ne.shift();oe?q({value:oe,done:!1}):E.push(q)})}let Je=function(q){let oe=E.shift();oe?oe({value:q,done:!1}):ne.push(q)};function Ie(){for(T.splice(T.indexOf(Je),1);E.shift(););for(;ne.shift(););}function kt(){let q=E.shift();q&&(q({done:!0,value:void 0}),Ie())}return b.push(kt),T.push(Je),{next(){return re===Br?this.return():jt()},return(){return Ie(),Promise.resolve({done:!0,value:void 0})},throw(q){return Ie(),Promise.reject(q)},[Symbol.asyncIterator](){return this}}}function io(){a({delay:ye}),!F.signal.aborted&&(re=lo,qr=setTimeout(Pt,ye))}async function ws(E){i(),g.reset();let{body:ne,redirected:jt,status:Je}=E;if(Je===204){s(),Zt();return}if(!ne)throw new Error("Missing response body");jt&&(A=E.url);let Ie=e(ne),kt=new TextDecoder,q=Ie.getReader(),oe=!0;re=Es;do{let{done:so,value:ao}=await q.read();ao&&g.feed(kt.decode(ao,{stream:!so})),so&&(oe=!1,S=null,g.reset(),io(),s())}while(oe)}function Cs(E){typeof E.id=="string"&&(te=E.id),O(E)}function Is(E){ye=E}function Ts(){let{mode:E,credentials:ne,body:jt,method:Je,redirect:Ie,referrer:kt,referrerPolicy:q}=r,oe={Accept:"text/event-stream",...m,...te?{"Last-Event-ID":te}:void 0};return{mode:E,credentials:ne,body:jt,method:Je,redirect:Ie,referrer:kt,referrerPolicy:q,headers:oe,cache:"no-store",signal:F.signal}}}function Rs(t){let e=t.fetch||globalThis.fetch;if(!Ms(e))throw new Error("No fetch implementation provided, and one was not found on the global object.");if(typeof AbortController!="function")throw new Error("Missing AbortController implementation");let{url:r,initialLastEventId:n}=t;if(typeof r!="string"&&!(r instanceof URL))throw new Error("Invalid URL provided - must be string or URL instance");if(typeof n!="string"&&n!==void 0)throw new Error("Invalid initialLastEventId provided - must be string or undefined");return{fetch:e,url:r,initialLastEventId:n}}function Ms(t){return typeof t=="function"}var Ns={getStream:Ds};function fo(t){return Us(t,Ns)}function Ds(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var _o=Et(Mt());var sr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{identifier:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var ar=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var Qe=(0,_o.debug)("copilot-studio:power-platform");function ur(t,e){var a,d,l,f,m,b;if((a=t.directConnectUrl)!=null&&a.trim()){if(Qe.debug(`Using direct connection: ${t.directConnectUrl}`),!Nt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(Qe.debug(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),ur({...t,directConnectUrl:""},e)):ta(t.directConnectUrl,e).href}let r=(d=t.cloud)!=null?d:"Prod",n=(l=t.copilotAgentType)!=null?l:"Published";if(Qe.debug(`Using cloud setting: ${r}`),Qe.debug(`Using agent type: ${n}`),!((f=t.environmentId)!=null&&f.trim()))throw new Error("EnvironmentId must be provided");if(!((m=t.agentIdentifier)!=null&&m.trim()))throw new Error("AgentIdentifier must be provided");if(r==="Other")if((b=t.customPowerPlatformCloud)!=null&&b.trim())if(Nt(t.customPowerPlatformCloud))Qe.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let o=ra(r,t.environmentId,t.customPowerPlatformCloud),s={Published:()=>new ar({host:o,schema:t.agentIdentifier}),Prebuilt:()=>new sr({host:o,identifier:t.agentIdentifier})}[n]().getConversationUrl(e);return Qe.debug(`Generated Copilot Studio connection URL: ${s}`),s}function bo(t,e="Unknown",r="",n=""){var o,i;if(!n&&!(t!=null&&t.directConnectUrl)){if(e==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!t&&e==="Unknown")throw new Error("Either settings or cloud must be provided");if(t&&t.cloud&&t.cloud!=="Unknown"&&(e=t.cloud),e==="Other")if(r&&Nt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&Nt(t.customPowerPlatformCloud))e="Other",r=t.customPowerPlatformCloud;else throw new Error("Either CustomPowerPlatformCloud or cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");return r!=null||(r="api.unknown.powerplatform.com"),`https://${cr(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&Nt(n)){if(go(new URL(n))==="Unknown"){let s=(i=t==null?void 0:t.cloud)!=null?i:e;if(s==="Other"||s==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(s!=="Unknown")return`https://${cr(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${cr(go(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Nt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function ta(t,e){let r=new URL(t);return r.searchParams.has("api-version")||r.searchParams.append("api-version","2022-03-01-preview"),r.pathname.endsWith("/")&&(r.pathname=r.pathname.slice(0,-1)),r.pathname.includes("/conversations")&&(r.pathname=r.pathname.substring(0,r.pathname.indexOf("/conversations"))),r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r}function ra(t,e,r){if(t==="Other"&&(!r||!r.trim()))throw new Error("cloudBaseAddress must be provided when PowerPlatformCloud is Other");r=r!=null?r:"api.unknown.powerplatform.com";let n=e.toLowerCase().replaceAll("-",""),o=na(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${cr(t,r)}`)}function cr(t,e){switch(t){case"Local":return"api.powerplatform.localhost";case"Exp":return"api.exp.powerplatform.com";case"Dev":return"api.dev.powerplatform.com";case"Prv":return"api.prv.powerplatform.com";case"Test":return"api.test.powerplatform.com";case"Preprod":return"api.preprod.powerplatform.com";case"FirstRelease":case"Prod":return"api.powerplatform.com";case"GovFR":return"api.gov.powerplatform.microsoft.us";case"Gov":return"api.gov.powerplatform.microsoft.us";case"High":return"api.high.powerplatform.microsoft.us";case"DoD":return"api.appsplatform.us";case"Mooncake":return"api.powerplatform.partner.microsoftonline.cn";case"Ex":return"api.powerplatform.eaglex.ic.gov";case"Rx":return"api.powerplatform.microsoft.scloud";case"Other":return e;default:throw new Error(`Invalid cluster category value: ${t}`)}}function na(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function go(t){switch(t.host.toLowerCase()){case"api.powerplatform.localhost":return"Local";case"api.exp.powerplatform.com":return"Exp";case"api.dev.powerplatform.com":return"Dev";case"api.prv.powerplatform.com":return"Prv";case"api.test.powerplatform.com":return"Test";case"api.preprod.powerplatform.com":return"Preprod";case"api.powerplatform.com":return"Prod";case"api.gov.powerplatform.microsoft.us":return"GovFR";case"api.high.powerplatform.microsoft.us":return"High";case"api.appsplatform.us":return"DoD";case"api.powerplatform.partner.microsoftonline.cn":return"Mooncake";default:return"Unknown"}}var Xt=Et(Wn());var Rr=class{constructor(e){this.activity=e}};var os=Et(Mt());var rs="1.1.1";var Mr={};var G=(0,os.debug)("copilot-studio:client"),he=class he{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}async*postRequestAsync(e,r,n="POST"){var i,s;G.debug(`>>> SEND TO ${e}`);let o=fo({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":he.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(a,d)=>{let l=await fetch(a,d);return this.processResponseHeaders(l.headers),l}});try{for await(let{data:a,event:d}of o){if(a&&d==="activity")try{let l=Xt.Activity.fromJson(a);switch(l.type){case Xt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(s=(i=l.conversation)==null?void 0:i.id)!=null?s:"",G.debug(`Conversation ID: ${this.conversationId}`)),yield l;break;default:G.debug(`Activity type: ${l.type}`),yield l;break}}catch(l){G.error("Failed to parse activity:",l)}else if(d==="end"){G.debug("Stream complete");break}if(o.readyState==="closed"){G.debug("Connection closed");break}}}finally{o.close()}}static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${rs}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Mr.platform()}-${Mr.arch()}/${Mr.release()}`,G.debug(`User-Agent: ${r}`),r}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(he.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,G.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(he.conversationIdHeaderKey))!=null?o:"",this.conversationId&&G.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==he.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),G.debug("Headers received:",r)}async*startConversationStreaming(e=!0){let r=ur(this.settings),n={emitStartConversationEvent:e};G.info("Starting conversation ..."),yield*this.postRequestAsync(r,n,"POST")}async*sendActivityStreaming(e,r=this.conversationId){var s,a;let n=(a=(s=e.conversation)==null?void 0:s.id)!=null?a:r,o=ur(this.settings,n),i=new Rr(e);G.info("Sending activity...",e),yield*this.postRequestAsync(o,i,"POST")}async startConversationAsync(e=!0){let r=[];for await(let n of this.startConversationStreaming(e))r.push(n);return r}async askQuestionAsync(e,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:e,conversation:o},s=Xt.Activity.fromObject(i),a=[];for await(let d of this.sendActivityStreaming(s,r))a.push(d);return a}async sendActivity(e,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(e,r))n.push(o);return n}};he.conversationIdHeaderKey="x-ms-conversationid",he.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",he.scopeFromSettings=bo;var ns=he;var R=[];for(let t=0;t<256;++t)R.push((t+256).toString(16).slice(1));function is(t,e=0){return(R[t[e+0]]+R[t[e+1]]+R[t[e+2]]+R[t[e+3]]+"-"+R[t[e+4]]+R[t[e+5]]+"-"+R[t[e+6]]+R[t[e+7]]+"-"+R[t[e+8]]+R[t[e+9]]+"-"+R[t[e+10]]+R[t[e+11]]+R[t[e+12]]+R[t[e+13]]+R[t[e+14]]+R[t[e+15]]).toLowerCase()}var Hn,Zd=new Uint8Array(16);function Bn(){if(!Hn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hn=crypto.getRandomValues.bind(crypto)}return Hn(Zd)}var jd=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Kn={randomUUID:jd};function kd(t,e,r){var o,i,s;if(Kn.randomUUID&&!e&&!t)return Kn.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:Bn();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,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return is(n)}var Jn=kd;var bs=Et(Wn());var Gn=function(t,e){return Gn=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])},Gn(t,e)};function Ce(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Gn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Qt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ct(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function It(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Y(t){return typeof t=="function"}function Nr(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Dr=Nr(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
5
|
+
`&&n++}}return[e,r]}var lo="connecting",Es="open",Br="closed",nr=()=>{};function Us(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=nr,onConnect:i=nr,onDisconnect:s=nr,onScheduleReconnect:a=nr}=r,{fetch:d,url:l,initialLastEventId:f}=Rs(r),m={...r.headers},g=[],T=n?[n]:[],O=U=>T.forEach(se=>se(U)),v=uo({onEvent:Cs,onRetry:Is,onComment:o}),S,A=l.toString(),P=new AbortController,R=f,V=2e3,ie,$=Br;return Y(),{close:Se,connect:Y,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Vr,get lastEventId(){return R},get url(){return A},get readyState(){return $}};function Y(){S||($=lo,P=new AbortController,S=d(l,Ts()).then(ws).catch(U=>{S=null,!(U.name==="AbortError"||U.type==="aborted"||P.signal.aborted)&&io()}))}function Se(){$=Br,P.abort(),v.reset(),clearTimeout(ie),g.forEach(U=>U())}function Vr(){let U=[],se=[];function Et(){return new Promise(W=>{let ae=se.shift();ae?W({value:ae,done:!1}):U.push(W)})}let Xe=function(W){let ae=U.shift();ae?ae({value:W,done:!1}):se.push(W)};function Ae(){for(T.splice(T.indexOf(Xe),1);U.shift(););for(;se.shift(););}function Ut(){let W=U.shift();W&&(W({done:!0,value:void 0}),Ae())}return g.push(Ut),T.push(Xe),{next(){return $===Br?this.return():Et()},return(){return Ae(),Promise.resolve({done:!0,value:void 0})},throw(W){return Ae(),Promise.reject(W)},[Symbol.asyncIterator](){return this}}}function io(){a({delay:V}),!P.signal.aborted&&($=lo,ie=setTimeout(Y,V))}async function ws(U){i(),v.reset();let{body:se,redirected:Et,status:Xe}=U;if(Xe===204){s(),Se();return}if(!se)throw new Error("Missing response body");Et&&(A=U.url);let Ae=e(se),Ut=new TextDecoder,W=Ae.getReader(),ae=!0;$=Es;do{let{done:so,value:ao}=await W.read();ao&&v.feed(Ut.decode(ao,{stream:!so})),so&&(ae=!1,S=null,v.reset(),io(),s())}while(ae)}function Cs(U){typeof U.id=="string"&&(R=U.id),O(U)}function Is(U){V=U}function Ts(){let{mode:U,credentials:se,body:Et,method:Xe,redirect:Ae,referrer:Ut,referrerPolicy:W}=r,ae={Accept:"text/event-stream",...m,...R?{"Last-Event-ID":R}:void 0};return{mode:U,credentials:se,body:Et,method:Xe,redirect:Ae,referrer:Ut,referrerPolicy:W,headers:ae,cache:"no-store",signal:P.signal}}}function Rs(t){let e=t.fetch||globalThis.fetch;if(!Ms(e))throw new Error("No fetch implementation provided, and one was not found on the global object.");if(typeof AbortController!="function")throw new Error("Missing AbortController implementation");let{url:r,initialLastEventId:n}=t;if(typeof r!="string"&&!(r instanceof URL))throw new Error("Invalid URL provided - must be string or URL instance");if(typeof n!="string"&&n!==void 0)throw new Error("Invalid initialLastEventId provided - must be string or undefined");return{fetch:e,url:r,initialLastEventId:n}}function Ms(t){return typeof t=="function"}var Ns={getStream:Ds};function fo(t){return Us(t,Ns)}function Ds(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var _o=Rt(Dt());var ar=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{identifier:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var cr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var rt=(0,_o.debug)("copilot-studio:power-platform");function dr(t,e){var a,d,l,f,m,g;if((a=t.directConnectUrl)!=null&&a.trim()){if(rt.debug(`Using direct connection: ${t.directConnectUrl}`),!zt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(rt.debug(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),dr({...t,directConnectUrl:""},e)):ta(t.directConnectUrl,e).href}let r=(d=t.cloud)!=null?d:"Prod",n=(l=t.copilotAgentType)!=null?l:"Published";if(rt.debug(`Using cloud setting: ${r}`),rt.debug(`Using agent type: ${n}`),!((f=t.environmentId)!=null&&f.trim()))throw new Error("EnvironmentId must be provided");if(!((m=t.agentIdentifier)!=null&&m.trim()))throw new Error("AgentIdentifier must be provided");if(r==="Other")if((g=t.customPowerPlatformCloud)!=null&&g.trim())if(zt(t.customPowerPlatformCloud))rt.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let o=ra(r,t.environmentId,t.customPowerPlatformCloud),s={Published:()=>new cr({host:o,schema:t.agentIdentifier}),Prebuilt:()=>new ar({host:o,identifier:t.agentIdentifier})}[n]().getConversationUrl(e);return rt.debug(`Generated Copilot Studio connection URL: ${s}`),s}function bo(t,e="Unknown",r="",n=""){var o,i;if(!n&&!(t!=null&&t.directConnectUrl)){if(e==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!t&&e==="Unknown")throw new Error("Either settings or cloud must be provided");if(t&&t.cloud&&t.cloud!=="Unknown"&&(e=t.cloud),e==="Other")if(r&&zt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&zt(t.customPowerPlatformCloud))e="Other",r=t.customPowerPlatformCloud;else throw new Error("Either CustomPowerPlatformCloud or cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");return r!=null||(r="api.unknown.powerplatform.com"),`https://${ur(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&zt(n)){if(go(new URL(n))==="Unknown"){let s=(i=t==null?void 0:t.cloud)!=null?i:e;if(s==="Other"||s==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(s!=="Unknown")return`https://${ur(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${ur(go(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function zt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function ta(t,e){let r=new URL(t);return r.searchParams.has("api-version")||r.searchParams.append("api-version","2022-03-01-preview"),r.pathname.endsWith("/")&&(r.pathname=r.pathname.slice(0,-1)),r.pathname.includes("/conversations")&&(r.pathname=r.pathname.substring(0,r.pathname.indexOf("/conversations"))),r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r}function ra(t,e,r){if(t==="Other"&&(!r||!r.trim()))throw new Error("cloudBaseAddress must be provided when PowerPlatformCloud is Other");r=r!=null?r:"api.unknown.powerplatform.com";let n=e.toLowerCase().replaceAll("-",""),o=na(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${ur(t,r)}`)}function ur(t,e){switch(t){case"Local":return"api.powerplatform.localhost";case"Exp":return"api.exp.powerplatform.com";case"Dev":return"api.dev.powerplatform.com";case"Prv":return"api.prv.powerplatform.com";case"Test":return"api.test.powerplatform.com";case"Preprod":return"api.preprod.powerplatform.com";case"FirstRelease":case"Prod":return"api.powerplatform.com";case"GovFR":return"api.gov.powerplatform.microsoft.us";case"Gov":return"api.gov.powerplatform.microsoft.us";case"High":return"api.high.powerplatform.microsoft.us";case"DoD":return"api.appsplatform.us";case"Mooncake":return"api.powerplatform.partner.microsoftonline.cn";case"Ex":return"api.powerplatform.eaglex.ic.gov";case"Rx":return"api.powerplatform.microsoft.scloud";case"Other":return e;default:throw new Error(`Invalid cluster category value: ${t}`)}}function na(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function go(t){switch(t.host.toLowerCase()){case"api.powerplatform.localhost":return"Local";case"api.exp.powerplatform.com":return"Exp";case"api.dev.powerplatform.com":return"Dev";case"api.prv.powerplatform.com":return"Prv";case"api.test.powerplatform.com":return"Test";case"api.preprod.powerplatform.com":return"Preprod";case"api.powerplatform.com":return"Prod";case"api.gov.powerplatform.microsoft.us":return"GovFR";case"api.high.powerplatform.microsoft.us":return"High";case"api.appsplatform.us":return"DoD";case"api.powerplatform.partner.microsoftonline.cn":return"Mooncake";default:return"Unknown"}}var St=Rt(Wn());var Mr=class{constructor(e){this.activity=e}};var os=Rt(Dt());var rs="1.1.4-g8d884129e7";var Nr={};var G=(0,os.debug)("copilot-studio:client"),ve=class ve{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}async*postRequestAsync(e,r,n="POST"){var s,a,d,l,f,m,g,T,O,v;G.debug(`>>> SEND TO ${e}`);let o=new Map,i=fo({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":ve.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(S,A)=>{let P=await fetch(S,A);return this.processResponseHeaders(P.headers),P}});try{for await(let{data:S,event:A}of i){if(S&&A==="activity")try{let P=St.Activity.fromJson(S),R=(s=P.entities)==null?void 0:s.find(V=>V.type==="streaminfo"&&V.streamType==="streaming");switch(P.type){case St.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(d=(a=P.conversation)==null?void 0:a.id)!=null?d:"",G.debug(`Conversation ID: ${this.conversationId}`)),yield P;break;case St.ActivityTypes.Typing:if(G.debug(`Activity type: ${P.type}`),R||((l=P.channelData)==null?void 0:l.streamType)==="streaming"){let V=(f=P.text)!=null?f:"",ie=(g=R==null?void 0:R.streamId)!=null?g:(m=P.channelData)==null?void 0:m.streamId,$=(O=R==null?void 0:R.streamSequence)!=null?O:(T=P.channelData)==null?void 0:T.streamSequence;if(ie&&$){if(o.has(ie)){let Y=o.get(ie);Y.push({text:V,sequence:$}),o.set(ie,Y)}else o.set(ie,[{text:V,sequence:$}]);P.text=((v=o.get(ie))==null?void 0:v.sort((Y,Se)=>Y.sequence-Se.sequence).map(Y=>Y.text).join(""))||""}}yield P;break;default:G.debug(`Activity type: ${P.type}`),yield P;break}}catch(P){G.error("Failed to parse activity:",P)}else if(A==="end"){G.debug("Stream complete");break}if(i.readyState==="closed"){G.debug("Connection closed");break}}}finally{i.close()}}static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${rs}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Nr.platform()}-${Nr.arch()}/${Nr.release()}`,G.debug(`User-Agent: ${r}`),r}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(ve.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,G.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(ve.conversationIdHeaderKey))!=null?o:"",this.conversationId&&G.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==ve.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),G.debug("Headers received:",r)}async*startConversationStreaming(e=!0){let r=dr(this.settings),n={emitStartConversationEvent:e};G.info("Starting conversation ..."),yield*this.postRequestAsync(r,n,"POST")}async*sendActivityStreaming(e,r=this.conversationId){var s,a;let n=(a=(s=e.conversation)==null?void 0:s.id)!=null?a:r,o=dr(this.settings,n),i=new Mr(e);G.info("Sending activity...",e),yield*this.postRequestAsync(o,i,"POST")}async startConversationAsync(e=!0){let r=[];for await(let n of this.startConversationStreaming(e))r.push(n);return r}async askQuestionAsync(e,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:e,conversation:o},s=St.Activity.fromObject(i),a=[];for await(let d of this.sendActivityStreaming(s,r))a.push(d);return a}async sendActivity(e,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(e,r))n.push(o);return n}};ve.conversationIdHeaderKey="x-ms-conversationid",ve.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",ve.scopeFromSettings=bo;var ns=ve;var N=[];for(let t=0;t<256;++t)N.push((t+256).toString(16).slice(1));function is(t,e=0){return(N[t[e+0]]+N[t[e+1]]+N[t[e+2]]+N[t[e+3]]+"-"+N[t[e+4]]+N[t[e+5]]+"-"+N[t[e+6]]+N[t[e+7]]+"-"+N[t[e+8]]+N[t[e+9]]+"-"+N[t[e+10]]+N[t[e+11]]+N[t[e+12]]+N[t[e+13]]+N[t[e+14]]+N[t[e+15]]).toLowerCase()}var Hn,Zd=new Uint8Array(16);function Bn(){if(!Hn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hn=crypto.getRandomValues.bind(crypto)}return Hn(Zd)}var jd=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Kn={randomUUID:jd};function kd(t,e,r){var o,i,s;if(Kn.randomUUID&&!e&&!t)return Kn.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:Bn();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,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return is(n)}var Jn=kd;var bs=Rt(Wn());var Gn=function(t,e){return Gn=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])},Gn(t,e)};function Te(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Gn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function er(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function At(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function Ot(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function te(t){return typeof t=="function"}function Dr(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var zr=Dr(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
6
6
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
7
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function er(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Tt=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Qt(s),d=a.next();!d.done;d=a.next()){var l=d.value;l.remove(this)}}catch(g){e={error:g}}finally{try{d&&!d.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var f=this.initialTeardown;if(Y(f))try{f()}catch(g){i=g instanceof Dr?g.errors:[g]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var b=Qt(m),T=b.next();!T.done;T=b.next()){var O=T.value;try{ss(O)}catch(g){i=i!=null?i:[],g instanceof Dr?i=It(It([],Ct(i)),Ct(g.errors)):i.push(g)}}}catch(g){n={error:g}}finally{try{T&&!T.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(i)throw new Dr(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)ss(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&er(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&er(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var Yn=Tt.EMPTY;function zr(t){return t instanceof Tt||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function ss(t){Y(t)?t():t.unsubscribe()}var ee={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var St={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=St.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,It([t,e],Ct(r))):setTimeout.apply(void 0,It([t,e],Ct(r)))},clearTimeout:function(t){var e=St.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function as(t){St.setTimeout(function(){var e=ee.onUnhandledError;if(e)e(t);else throw t})}function Xn(){}var cs=(function(){return Qn("C",void 0,void 0)})();function us(t){return Qn("E",void 0,t)}function ds(t){return Qn("N",t,void 0)}function Qn(t,e,r){return{kind:t,value:e,error:r}}var Ke=null;function At(t){if(ee.useDeprecatedSynchronousErrorHandling){var e=!Ke;if(e&&(Ke={errorThrown:!1,error:null}),t(),e){var r=Ke,n=r.errorThrown,o=r.error;if(Ke=null,n)throw o}}else t()}function ls(t){ee.useDeprecatedSynchronousErrorHandling&&Ke&&(Ke.errorThrown=!0,Ke.error=t)}var ro=(function(t){Ce(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,zr(r)&&r.add(n)):n.destination=Md,n}return e.create=function(r,n,o){return new Fr(r,n,o)},e.prototype.next=function(r){this.isStopped?to(ds(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?to(us(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?to(cs,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Tt);var Ed=Function.prototype.bind;function eo(t,e){return Ed.call(t,e)}var Ud=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){Lr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Lr(n)}else Lr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Lr(r)}},t})(),Fr=(function(t){Ce(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(Y(r)||!r)s={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var a;i&&ee.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&eo(r.next,a),error:r.error&&eo(r.error,a),complete:r.complete&&eo(r.complete,a)}):s=r}return i.destination=new Ud(s),i}return e})(ro);function Lr(t){ee.useDeprecatedSynchronousErrorHandling?ls(t):as(t)}function Rd(t){throw t}function to(t,e){var r=ee.onStoppedNotification;r&&St.setTimeout(function(){return r(t,e)})}var Md={closed:!0,next:Xn,error:Rd,complete:Xn};var fs=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ps(t){return t}function hs(t){return t.length===0?ps:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Ot=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,i=Dd(e)?e:new Fr(e,r,n);return At(function(){var s=o,a=s.operator,d=s.source;i.add(a?a.call(i,d):d?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=ms(r),new r(function(o,i){var s=new Fr({next:function(a){try{e(a)}catch(d){i(d),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[fs]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return hs(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=ms(e),new e(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},t.create=function(e){return new t(e)},t})();function ms(t){var e;return(e=t!=null?t:ee.Promise)!==null&&e!==void 0?e:Promise}function Nd(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function Dd(t){return t&&t instanceof ro||Nd(t)&&zr(t)}var ys=Nr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var no=(function(t){Ce(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new vs(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new ys},e.prototype.next=function(r){var n=this;At(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=Qt(n.currentObservers),a=s.next();!a.done;a=s.next()){var d=a.value;d.next(r)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;At(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;At(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Yn:(this.currentObservers=null,a.push(r),new Tt(function(){n.currentObservers=null,er(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new Ot;return r.source=this,r},e.create=function(r,n){return new vs(r,n)},e})(Ot);var vs=(function(t){Ce(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Yn},e})(no);var oo=(function(t){Ce(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(no);var xs=Et(Mt()),me=(0,xs.debug)("copilot-studio:webchat"),gs=class{static createConnection(e,r){me.info("--> Creating connection between Copilot Studio and WebChat ...");let n=0,o,i,s=new oo(0),a=_s(async f=>{if(o=f,s.value<2){s.next(2);return}me.debug("--> Connection established."),l();for await(let m of e.startConversationStreaming())delete m.replyToId,i=m.conversation,d(m)}),d=f=>{let m={...f,timestamp:new Date().toISOString(),channelData:{...f.channelData,"webchat:sequence-id":n}};n++,me.debug(`Notify '${m.type}' activity to WebChat:`,m),o==null||o.next(m)},l=()=>{if(!(r!=null&&r.showTyping))return;let f=i?{id:i.id,name:i.name}:{id:"agent",name:"Agent"};d({type:"typing",from:f})};return{connectionStatus$:s,activity$:a,postActivity(f){if(me.info("--> Preparing to send activity to Copilot Studio ..."),!f)throw new Error("Activity cannot be null.");if(!o)throw new Error("Activity subscriber is not initialized.");return _s(async m=>{try{me.info("--> Sending activity to Copilot Studio ...");let b=bs.Activity.fromObject({...f,id:Jn(),attachments:await zd(f)});d(b),l(),m.next(b.id);for await(let T of e.sendActivityStreaming(b))d(T),me.info("<-- Activity received correctly from Copilot Studio.");m.complete()}catch(b){me.error("Error sending Activity to Copilot Studio:",b),m.error(b)}})},end(){me.info("--> Ending connection between Copilot Studio and WebChat ..."),s.complete(),o&&(o.complete(),o=void 0)}}}};async function zd(t){var r;if(t.type!=="message"||!((r=t.attachments)!=null&&r.length))return t.attachments||[];let e=[];for(let n of t.attachments){let o=await Ld(n);e.push(o)}return e}async function Ld(t){let e=t.contentUrl;if(!(e!=null&&e.startsWith("blob:")))return t;try{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch blob URL: ${r.status} ${r.statusText}`);let n=await r.blob(),o=await n.arrayBuffer(),i=Fd(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,me.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function Fd(t){let e=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(e&&typeof e.from=="function")return e.from(t).toString("base64");let r="";for(let n of new Uint8Array(t))r+=String.fromCharCode(n);return btoa(r)}function _s(t){return new Ot(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}export{Ut as AgentType,Wr as ConnectionSettings,ns as CopilotStudioClient,gs as CopilotStudioWebChat,Rr as ExecuteTurnRequest,Rt as PowerPlatformCloud,ur as getCopilotStudioConnectionUrl,bo as getTokenAudience,Bd as loadCopilotStudioConnectionSettingsFromEnv};
|
|
7
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});function tr(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Pt=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=er(s),d=a.next();!d.done;d=a.next()){var l=d.value;l.remove(this)}}catch(v){e={error:v}}finally{try{d&&!d.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var f=this.initialTeardown;if(te(f))try{f()}catch(v){i=v instanceof zr?v.errors:[v]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var g=er(m),T=g.next();!T.done;T=g.next()){var O=T.value;try{ss(O)}catch(v){i=i!=null?i:[],v instanceof zr?i=Ot(Ot([],At(i)),At(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{T&&!T.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}}if(i)throw new zr(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)ss(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&tr(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&tr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var Yn=Pt.EMPTY;function Lr(t){return t instanceof Pt||t&&"closed"in t&&te(t.remove)&&te(t.add)&&te(t.unsubscribe)}function ss(t){te(t)?t():t.unsubscribe()}var oe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Zt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Zt.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,Ot([t,e],At(r))):setTimeout.apply(void 0,Ot([t,e],At(r)))},clearTimeout:function(t){var e=Zt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function as(t){Zt.setTimeout(function(){var e=oe.onUnhandledError;if(e)e(t);else throw t})}function Xn(){}var cs=(function(){return Qn("C",void 0,void 0)})();function us(t){return Qn("E",void 0,t)}function ds(t){return Qn("N",t,void 0)}function Qn(t,e,r){return{kind:t,value:e,error:r}}var Ye=null;function jt(t){if(oe.useDeprecatedSynchronousErrorHandling){var e=!Ye;if(e&&(Ye={errorThrown:!1,error:null}),t(),e){var r=Ye,n=r.errorThrown,o=r.error;if(Ye=null,n)throw o}}else t()}function ls(t){oe.useDeprecatedSynchronousErrorHandling&&Ye&&(Ye.errorThrown=!0,Ye.error=t)}var ro=(function(t){Te(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Lr(r)&&r.add(n)):n.destination=Md,n}return e.create=function(r,n,o){return new Fr(r,n,o)},e.prototype.next=function(r){this.isStopped?to(ds(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?to(us(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?to(cs,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Pt);var Ed=Function.prototype.bind;function eo(t,e){return Ed.call(t,e)}var Ud=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){qr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){qr(n)}else qr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){qr(r)}},t})(),Fr=(function(t){Te(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(te(r)||!r)s={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var a;i&&oe.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&eo(r.next,a),error:r.error&&eo(r.error,a),complete:r.complete&&eo(r.complete,a)}):s=r}return i.destination=new Ud(s),i}return e})(ro);function qr(t){oe.useDeprecatedSynchronousErrorHandling?ls(t):as(t)}function Rd(t){throw t}function to(t,e){var r=oe.onStoppedNotification;r&&Zt.setTimeout(function(){return r(t,e)})}var Md={closed:!0,next:Xn,error:Rd,complete:Xn};var fs=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ps(t){return t}function hs(t){return t.length===0?ps:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var kt=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,i=Dd(e)?e:new Fr(e,r,n);return jt(function(){var s=o,a=s.operator,d=s.source;i.add(a?a.call(i,d):d?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=ms(r),new r(function(o,i){var s=new Fr({next:function(a){try{e(a)}catch(d){i(d),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[fs]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return hs(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=ms(e),new e(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},t.create=function(e){return new t(e)},t})();function ms(t){var e;return(e=t!=null?t:oe.Promise)!==null&&e!==void 0?e:Promise}function Nd(t){return t&&te(t.next)&&te(t.error)&&te(t.complete)}function Dd(t){return t&&t instanceof ro||Nd(t)&&Lr(t)}var ys=Dr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var no=(function(t){Te(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new vs(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new ys},e.prototype.next=function(r){var n=this;jt(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=er(n.currentObservers),a=s.next();!a.done;a=s.next()){var d=a.value;d.next(r)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;jt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;jt(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Yn:(this.currentObservers=null,a.push(r),new Pt(function(){n.currentObservers=null,tr(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new kt;return r.source=this,r},e.create=function(r,n){return new vs(r,n)},e})(kt);var vs=(function(t){Te(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Yn},e})(no);var oo=(function(t){Te(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(no);var xs=Rt(Dt()),ge=(0,xs.debug)("copilot-studio:webchat"),gs=class{static createConnection(e,r){ge.info("--> Creating connection between Copilot Studio and WebChat ...");let n=0,o,i,s=new oo(0),a=_s(async f=>{o=f;let m=async()=>{s.next(2),await 0};if(ge.debug("--> Connection established."),l(),s.value<2)for await(let g of e.startConversationStreaming())delete g.replyToId,!i&&g.conversation&&(i=g.conversation,await m()),d(g)}),d=f=>{let m={...f,timestamp:new Date().toISOString(),channelData:{...f.channelData,"webchat:sequence-id":n}};n++,ge.debug(`Notify '${m.type}' activity to WebChat:`,m),o==null||o.next(m)},l=()=>{if(!(r!=null&&r.showTyping))return;let f=i?{id:i.id,name:i.name}:{id:"agent",name:"Agent"};d({type:"typing",from:f})};return{connectionStatus$:s,activity$:a,postActivity(f){if(ge.info("--> Preparing to send activity to Copilot Studio ..."),!f)throw new Error("Activity cannot be null.");if(!o)throw new Error("Activity subscriber is not initialized.");return _s(async m=>{try{ge.info("--> Sending activity to Copilot Studio ...");let g=bs.Activity.fromObject({...f,id:Jn(),attachments:await zd(f)});d(g),l(),m.next(g.id);for await(let T of e.sendActivityStreaming(g))d(T),ge.info("<-- Activity received correctly from Copilot Studio.");m.complete()}catch(g){ge.error("Error sending Activity to Copilot Studio:",g),m.error(g)}})},end(){ge.info("--> Ending connection between Copilot Studio and WebChat ..."),s.complete(),o&&(o.complete(),o=void 0)}}}};async function zd(t){var r;if(t.type!=="message"||!((r=t.attachments)!=null&&r.length))return t.attachments||[];let e=[];for(let n of t.attachments){let o=await Ld(n);e.push(o)}return e}async function Ld(t){let e=t.contentUrl;if(!(e!=null&&e.startsWith("blob:")))return t;try{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch blob URL: ${r.status} ${r.statusText}`);let n=await r.blob(),o=await n.arrayBuffer(),i=qd(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,ge.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function qd(t){let e=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(e&&typeof e.from=="function")return e.from(t).toString("base64");let r="";for(let n of new Uint8Array(t))r+=String.fromCharCode(n);return btoa(r)}function _s(t){return new kt(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}export{Mt as AgentType,Wr as ConnectionSettings,ns as CopilotStudioClient,gs as CopilotStudioWebChat,Mr as ExecuteTurnRequest,Nt as PowerPlatformCloud,dr as getCopilotStudioConnectionUrl,bo as getTokenAudience,Bd as loadCopilotStudioConnectionSettingsFromEnv};
|
|
8
8
|
//# sourceMappingURL=browser.mjs.map
|