@microsoft/agents-copilotstudio-client 1.4.0-beta.7.g541749904d → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/package.json +2 -2
  2. package/dist/src/browser.mjs +5 -5
  3. package/dist/src/browser.mjs.map +4 -4
  4. package/dist/src/connectionSettings.d.ts +2 -0
  5. package/dist/src/connectionSettings.js +5 -2
  6. package/dist/src/connectionSettings.js.map +1 -1
  7. package/dist/src/copilotStudioClient.d.ts +61 -6
  8. package/dist/src/copilotStudioClient.js +176 -38
  9. package/dist/src/copilotStudioClient.js.map +1 -1
  10. package/dist/src/copilotStudioConnectionSettings.d.ts +6 -0
  11. package/dist/src/copilotStudioWebChat.d.ts +30 -0
  12. package/dist/src/copilotStudioWebChat.js +38 -11
  13. package/dist/src/copilotStudioWebChat.js.map +1 -1
  14. package/dist/src/executeTurnRequest.d.ts +5 -2
  15. package/dist/src/executeTurnRequest.js +4 -2
  16. package/dist/src/executeTurnRequest.js.map +1 -1
  17. package/dist/src/index.d.ts +5 -0
  18. package/dist/src/index.js +5 -0
  19. package/dist/src/index.js.map +1 -1
  20. package/dist/src/powerPlatformEnvironment.d.ts +8 -0
  21. package/dist/src/powerPlatformEnvironment.js +21 -6
  22. package/dist/src/powerPlatformEnvironment.js.map +1 -1
  23. package/dist/src/responses.d.ts +50 -0
  24. package/dist/src/responses.js +35 -0
  25. package/dist/src/responses.js.map +1 -0
  26. package/dist/src/scopeHelper.d.ts +17 -0
  27. package/dist/src/scopeHelper.js +24 -0
  28. package/dist/src/scopeHelper.js.map +1 -0
  29. package/dist/src/startRequest.d.ts +34 -0
  30. package/dist/src/startRequest.js +22 -0
  31. package/dist/src/startRequest.js.map +1 -0
  32. package/dist/src/strategies/prebuiltBotStrategy.d.ts +2 -1
  33. package/dist/src/strategies/publishedBotStrategy.d.ts +2 -1
  34. package/dist/src/subscribeEvent.d.ts +33 -0
  35. package/dist/src/subscribeEvent.js +7 -0
  36. package/dist/src/subscribeEvent.js.map +1 -0
  37. package/dist/src/userAgentHelper.d.ts +26 -0
  38. package/dist/src/userAgentHelper.js +52 -0
  39. package/dist/src/userAgentHelper.js.map +1 -0
  40. package/package.json +2 -2
  41. package/src/connectionSettings.ts +4 -1
  42. package/src/copilotStudioClient.ts +238 -32
  43. package/src/copilotStudioConnectionSettings.ts +7 -0
  44. package/src/copilotStudioWebChat.ts +75 -12
  45. package/src/executeTurnRequest.ts +7 -2
  46. package/src/index.ts +5 -0
  47. package/src/powerPlatformEnvironment.ts +26 -7
  48. package/src/responses.ts +75 -0
  49. package/src/scopeHelper.ts +22 -0
  50. package/src/startRequest.ts +48 -0
  51. package/src/strategies/prebuiltBotStrategy.ts +1 -1
  52. package/src/strategies/publishedBotStrategy.ts +1 -1
  53. package/src/subscribeEvent.ts +38 -0
  54. package/src/userAgentHelper.ts +49 -0
@@ -1,8 +1,8 @@
1
- var ks=Object.create;var mo=Object.defineProperty;var Us=Object.getOwnPropertyDescriptor;var Rs=Object.getOwnPropertyNames;var Ns=Object.getPrototypeOf,Ms=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ds=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Rs(e))!Ms.call(t,o)&&o!==r&&mo(t,o,{get:()=>e[o],enumerable:!(n=Us(e,o))||n.enumerable});return t};var Ut=(t,e,r)=>(r=t!=null?ks(Ns(t)):{},Ds(e||!t||!t.__esModule?mo(r,"default",{value:t,enumerable:!0}):r,t));var bo=y((il,_o)=>{var tt=1e3,rt=tt*60,nt=rt*60,Ee=nt*24,Ws=Ee*7,Bs=Ee*365.25;_o.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Ks(t);if(r==="number"&&isFinite(t))return e.long?Gs(t):Js(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Ks(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*Bs;case"weeks":case"week":case"w":return r*Ws;case"days":case"day":case"d":return r*Ee;case"hours":case"hour":case"hrs":case"hr":case"h":return r*nt;case"minutes":case"minute":case"mins":case"min":case"m":return r*rt;case"seconds":case"second":case"secs":case"sec":case"s":return r*tt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Js(t){var e=Math.abs(t);return e>=Ee?Math.round(t/Ee)+"d":e>=nt?Math.round(t/nt)+"h":e>=rt?Math.round(t/rt)+"m":e>=tt?Math.round(t/tt)+"s":t+"ms"}function Gs(t){var e=Math.abs(t);return e>=Ee?nr(t,e,Ee,"day"):e>=nt?nr(t,e,nt,"hour"):e>=rt?nr(t,e,rt,"minute"):e>=tt?nr(t,e,tt,"second"):t+" ms"}function nr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var wo=y((sl,xo)=>{function Ys(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=bo(),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,C,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 Oe=r.formatters[Y];if(typeof Oe=="function"){let Kr=S[V];$=Oe.call(A,Kr),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:(C!==r.namespaces&&(C=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,C=0,O=-1,v=0;for(;g<f.length;)if(C<m.length&&(m[C]===f[g]||m[C]==="*"))m[C]==="*"?(O=C,v=g,C++):(g++,C++);else if(O!==-1)C=O+1,v++,g=v;else return!1;for(;C<m.length&&m[C]==="*";)C++;return C===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}xo.exports=Ys});var Co=y((W,or)=>{W.formatArgs=Qs;W.save=ea;W.load=ta;W.useColors=Xs;W.storage=ra();W.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();W.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Xs(){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 Qs(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)}W.log=console.debug||console.log||(()=>{});function ea(t){try{t?W.storage.setItem("debug",t):W.storage.removeItem("debug")}catch{}}function ta(){let t;try{t=W.storage.getItem("debug")||W.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function ra(){try{return localStorage}catch{}}or.exports=wo()(W);var{formatters:na}=or.exports;na.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Mt=y(je=>{"use strict";var oa=je&&je.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(je,"__esModule",{value:!0});je.Logger=void 0;je.debug=aa;var ia=oa(Co()),sa=["info","warn","error","debug"],ir=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of sa){let n=(0,ia.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)}};je.Logger=ir;function aa(t){return new ir(t)}});var Lt=y(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.getParsedType=Z.ZodParsedType=Z.objectUtil=Z.util=void 0;var Qr;(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})(Qr||(Z.util=Qr={}));var Ao;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ao||(Z.objectUtil=Ao={}));Z.ZodParsedType=Qr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var la=t=>{switch(typeof t){case"undefined":return Z.ZodParsedType.undefined;case"string":return Z.ZodParsedType.string;case"number":return Number.isNaN(t)?Z.ZodParsedType.nan:Z.ZodParsedType.number;case"boolean":return Z.ZodParsedType.boolean;case"function":return Z.ZodParsedType.function;case"bigint":return Z.ZodParsedType.bigint;case"symbol":return Z.ZodParsedType.symbol;case"object":return Array.isArray(t)?Z.ZodParsedType.array:t===null?Z.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Z.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?Z.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?Z.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?Z.ZodParsedType.date:Z.ZodParsedType.object;default:return Z.ZodParsedType.unknown}};Z.getParsedType=la});var dr=y(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.ZodError=_e.quotelessJson=_e.ZodIssueCode=void 0;var Oo=Lt();_e.ZodIssueCode=Oo.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 fa=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");_e.quotelessJson=fa;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,Oo.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=zt;zt.create=t=>new zt(t)});var tn=y(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});var D=dr(),Ze=Lt(),pa=(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}};en.default=pa});var lr=y(be=>{"use strict";var ha=be&&be.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(be,"__esModule",{value:!0});be.defaultErrorMap=void 0;be.setErrorMap=ma;be.getErrorMap=ya;var Po=ha(tn());be.defaultErrorMap=Po.default;var Eo=Po.default;function ma(t){Eo=t}function ya(){return Eo}});var nn=y(j=>{"use strict";var va=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=ba;var ga=lr(),jo=va(tn()),_a=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=_a;j.EMPTY_PATH=[];function ba(t,e){let r=(0,ga.getErrorMap)(),n=(0,j.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===jo.default?void 0:jo.default].filter(o=>!!o)});t.common.issues.push(n)}var rn=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=rn;j.INVALID=Object.freeze({status:"aborted"});var xa=t=>({status:"dirty",value:t});j.DIRTY=xa;var wa=t=>({status:"valid",value:t});j.OK=wa;var Ca=t=>t.status==="aborted";j.isAborted=Ca;var Ia=t=>t.status==="dirty";j.isDirty=Ia;var Ta=t=>t.status==="valid";j.isValid=Ta;var Sa=t=>typeof Promise!="undefined"&&t instanceof Promise;j.isAsync=Sa});var ko=y(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0})});var Ro=y(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.errorUtil=void 0;var Uo;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Uo||(fr.errorUtil=Uo={}))});var Bo=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=zo;c.custom=Fo;var p=dr(),pr=lr(),_=Ro(),u=nn(),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}},No=(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 I(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 T=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 No(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 No(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:w.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 Le.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new J({...I(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new He({...I(this._def),innerType:this,defaultValue:r,typeName:w.ZodDefault})}brand(){return new qt({typeName:w.ZodBranded,type:this,...I(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new We({...I(this._def),innerType:this,catchValue:r,typeName:w.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ft.create(this,e)}readonly(){return Be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=T;c.Schema=T;c.ZodSchema=T;var Aa=/^c[^\s-]{8,}$/i,Oa=/^[0-9a-z]+$/,Pa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ea=/^[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,ja=/^[a-z0-9_-]{21}$/i,Za=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ka=/^[-+]?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)?)??$/,Ua=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ra="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",on,Na=/^(?:(?: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])$/,Ma=/^(?:(?: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])$/,Da=/^(([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]))$/,La=/^(([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])$/,za=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Do="((\\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])))",Fa=new RegExp(`^${Do}$`);function Lo(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 Va(t){return new RegExp(`^${Lo(t)}$`)}function zo(t){let e=`${Do}T${Lo(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 $a(t,e){return!!((e==="v4"||!e)&&Na.test(t)||(e==="v6"||!e)&&Da.test(t))}function Ha(t,e){if(!Za.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 Wa(t,e){return!!((e==="v4"||!e)&&Ma.test(t)||(e==="v6"||!e)&&La.test(t))}var xe=class t extends T{_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")Ua.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")on||(on=new RegExp(Ra,"u")),on.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")Ea.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")ja.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")Aa.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")Oa.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")Pa.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"?zo(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"?Fa.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"?Va(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"?ka.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"?$a(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"?Ha(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"?Wa(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"?za.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"?qa.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:w.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...I(t)})};function Ba(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 ke=class t extends T{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"?Ba(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=ke;ke.create=t=>new ke({checks:[],typeName:w.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...I(t)});var Ue=class t extends T{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=Ue;Ue.create=t=>{var e;return new Ue({checks:[],typeName:w.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...I(t)})};var Re=class extends T{_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=Re;Re.create=t=>new Re({typeName:w.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...I(t)});var Ne=class t extends T{_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=Ne;Ne.create=t=>new Ne({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:w.ZodDate,...I(t)});var st=class extends T{_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=st;st.create=t=>new st({typeName:w.ZodSymbol,...I(t)});var Me=class extends T{_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=Me;Me.create=t=>new Me({typeName:w.ZodUndefined,...I(t)});var De=class extends T{_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=De;De.create=t=>new De({typeName:w.ZodNull,...I(t)});var we=class extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=we;we.create=t=>new we({typeName:w.ZodAny,...I(t)});var pe=class extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=pe;pe.create=t=>new pe({typeName:w.ZodUnknown,...I(t)});var re=class extends T{_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:w.ZodNever,...I(t)});var at=class extends T{_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=at;at.create=t=>new at({typeName:w.ZodVoid,...I(t)});var he=class t extends T{_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:w.ZodArray,...I(e)});function it(t){if(t instanceof B){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=X.create(it(n))}return new B({...t._def,shape:()=>e})}else return t instanceof he?new he({...t._def,type:it(t.element)}):t instanceof X?X.create(it(t.unwrap())):t instanceof ue?ue.create(it(t.unwrap())):t instanceof ce?ce.create(t.items.map(e=>it(e))):t}var B=class t extends T{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:w.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 it(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 qo(h.util.objectKeys(this.shape))}};c.ZodObject=B;B.create=(t,e)=>new B({shape:()=>t,unknownKeys:"strip",catchall:re.create(),typeName:w.ZodObject,...I(e)});B.strictCreate=(t,e)=>new B({shape:()=>t,unknownKeys:"strict",catchall:re.create(),typeName:w.ZodObject,...I(e)});B.lazycreate=(t,e)=>new B({shape:t,unknownKeys:"strip",catchall:re.create(),typeName:w.ZodObject,...I(e)});var Le=class extends T{_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=Le;Le.create=(t,e)=>new Le({options:t,typeName:w.ZodUnion,...I(e)});var fe=t=>t instanceof qe?fe(t.schema):t instanceof J?fe(t.innerType()):t instanceof Fe?[t.value]:t instanceof Ve?t.options:t instanceof $e?h.util.objectValues(t.enum):t instanceof He?fe(t._def.innerType):t instanceof Me?[void 0]:t instanceof De?[null]:t instanceof X?[void 0,...fe(t.unwrap())]:t instanceof ue?[null,...fe(t.unwrap())]:t instanceof qt||t instanceof Be?fe(t.unwrap()):t instanceof We?fe(t._def.innerType):[],hr=class t extends T{_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:w.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...I(n)})}};c.ZodDiscriminatedUnion=hr;function sn(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=sn(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=sn(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 ze=class extends T{_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=sn(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=ze;ze.create=(t,e,r)=>new ze({left:t,right:e,typeName:w.ZodIntersection,...I(r)});var ce=class t extends T{_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:w.ZodTuple,rest:null,...I(e)})};var mr=class t extends T{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 T?new t({keyType:e,valueType:r,typeName:w.ZodRecord,...I(n)}):new t({keyType:xe.create(),valueType:e,typeName:w.ZodRecord,...I(r)})}};c.ZodRecord=mr;var ct=class extends T{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=ct;ct.create=(t,e,r)=>new ct({valueType:e,keyType:t,typeName:w.ZodMap,...I(r)});var ut=class t extends T{_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=ut;ut.create=(t,e)=>new ut({valueType:t,minSize:null,maxSize:null,typeName:w.ZodSet,...I(e)});var yr=class t extends T{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 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(C=>{throw l.addIssue(n(d,C)),l}),m=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(m,i).catch(C=>{throw l.addIssue(o(m,C)),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:w.ZodFunction,...I(n)})}};c.ZodFunction=yr;var qe=class extends T{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=qe;qe.create=(t,e)=>new qe({getter:t,typeName:w.ZodLazy,...I(e)});var Fe=class extends T{_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=Fe;Fe.create=(t,e)=>new Fe({value:t,typeName:w.ZodLiteral,...I(e)});function qo(t,e){return new Ve({values:t,typeName:w.ZodEnum,...I(e)})}var Ve=class t extends T{_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=Ve;Ve.create=qo;var $e=class extends T{_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=$e;$e.create=(t,e)=>new $e({values:t,typeName:w.ZodNativeEnum,...I(e)});var Ce=class extends T{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:w.ZodPromise,...I(e)});var J=class extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.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:w.ZodEffects,effect:e,...I(r)});J.createWithPreprocess=(t,e,r)=>new J({schema:e,effect:{type:"preprocess",transform:t},typeName:w.ZodEffects,...I(r)});var X=class extends T{_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:w.ZodOptional,...I(e)});var ue=class extends T{_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:w.ZodNullable,...I(e)});var He=class extends T{_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=He;He.create=(t,e)=>new He({innerType:t,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...I(e)});var We=class extends T{_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=We;We.create=(t,e)=>new We({innerType:t,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...I(e)});var dt=class extends T{_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=dt;dt.create=t=>new dt({typeName:w.ZodNaN,...I(t)});c.BRAND=Symbol("zod_brand");var qt=class extends T{_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=qt;var Ft=class t extends T{_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:w.ZodPipeline})}};c.ZodPipeline=Ft;var Be=class extends T{_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=Be;Be.create=(t,e)=>new Be({innerType:t,typeName:w.ZodReadonly,...I(e)});function Mo(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Fo(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=Mo(e,n),g=(f=(l=m.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...m,fatal:g})}});if(!i){let d=Mo(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 w;(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"})(w||(c.ZodFirstPartyTypeKind=w={}));var Ka=(t,e={message:`Input not instance of ${t.name}`})=>Fo(r=>r instanceof t,e);c.instanceof=Ka;var Vo=xe.create;c.string=Vo;var $o=ke.create;c.number=$o;var Ja=dt.create;c.nan=Ja;var Ga=Ue.create;c.bigint=Ga;var Ho=Re.create;c.boolean=Ho;var Ya=Ne.create;c.date=Ya;var Xa=st.create;c.symbol=Xa;var Qa=Me.create;c.undefined=Qa;var ec=De.create;c.null=ec;var tc=we.create;c.any=tc;var rc=pe.create;c.unknown=rc;var nc=re.create;c.never=nc;var oc=at.create;c.void=oc;var ic=he.create;c.array=ic;var sc=B.create;c.object=sc;var ac=B.strictCreate;c.strictObject=ac;var cc=Le.create;c.union=cc;var uc=hr.create;c.discriminatedUnion=uc;var dc=ze.create;c.intersection=dc;var lc=ce.create;c.tuple=lc;var fc=mr.create;c.record=fc;var pc=ct.create;c.map=pc;var hc=ut.create;c.set=hc;var mc=yr.create;c.function=mc;var yc=qe.create;c.lazy=yc;var vc=Fe.create;c.literal=vc;var gc=Ve.create;c.enum=gc;var _c=$e.create;c.nativeEnum=_c;var bc=Ce.create;c.promise=bc;var Wo=J.create;c.effect=Wo;c.transformer=Wo;var xc=X.create;c.optional=xc;var wc=ue.create;c.nullable=wc;var Cc=J.createWithPreprocess;c.preprocess=Cc;var Ic=Ft.create;c.pipeline=Ic;var Tc=()=>Vo().optional();c.ostring=Tc;var Sc=()=>$o().optional();c.onumber=Sc;var Ac=()=>Ho().optional();c.oboolean=Ac;c.coerce={string:(t=>xe.create({...t,coerce:!0})),number:(t=>ke.create({...t,coerce:!0})),boolean:(t=>Re.create({...t,coerce:!0})),bigint:(t=>Ue.create({...t,coerce:!0})),date:(t=>Ne.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var an=y(ee=>{"use strict";var Oc=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]})),lt=ee&&ee.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Oc(e,t,r)};Object.defineProperty(ee,"__esModule",{value:!0});lt(lr(),ee);lt(nn(),ee);lt(ko(),ee);lt(Lt(),ee);lt(Bo(),ee);lt(dr(),ee)});var k=y(K=>{"use strict";var Ko=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]})),Pc=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Ec=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)&&Ko(e,t,r);return Pc(e,t),e},jc=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ko(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.z=void 0;var Jo=Ec(an());K.z=Jo;jc(an(),K);K.default=Jo});var cn=y(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.actionTypesZodSchema=ft.ActionTypes=void 0;var Zc=k(),Go;(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"})(Go||(ft.ActionTypes=Go={}));ft.actionTypesZodSchema=Zc.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var un=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.semanticActionStateTypesZodSchema=pt.SemanticActionStateTypes=void 0;var kc=k(),Yo;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Yo||(pt.SemanticActionStateTypes=Yo={}));pt.semanticActionStateTypesZodSchema=kc.z.enum(["start","continue","done"])});var dn=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.attachmentLayoutTypesZodSchema=ht.AttachmentLayoutTypes=void 0;var Uc=k(),Xo;(function(t){t.List="list",t.Carousel="carousel"})(Xo||(ht.AttachmentLayoutTypes=Xo={}));ht.attachmentLayoutTypesZodSchema=Uc.z.enum(["list","carousel"])});var ln=y(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.Channels=void 0;var Qo;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.M365CopilotSubChannel="COPILOT",t.M365Copilot="msteams:COPILOT",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(Qo||(vr.Channels=Qo={}))});var fn=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.endOfConversationCodesZodSchema=mt.EndOfConversationCodes=void 0;var Rc=k(),ei;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(ei||(mt.EndOfConversationCodes=ei={}));mt.endOfConversationCodesZodSchema=Rc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var ri=y(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.MembershipSourceTypes=void 0;var ti;(function(t){t.Channel="channel",t.Team="team"})(ti||(gr.MembershipSourceTypes=ti={}))});var oi=y(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.MembershipTypes=void 0;var ni;(function(t){t.Direct="direct",t.Transitive="transitive"})(ni||(_r.MembershipTypes=ni={}))});var Vt=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.roleTypeZodSchema=yt.RoleTypes=void 0;var Nc=k(),ii;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(ii||(yt.RoleTypes=ii={}));yt.roleTypeZodSchema=Nc.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var si=y(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.addAIToActivity=void 0;var Mc=(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)};br.addAIToActivity=Mc});var ai=y(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.adaptiveCardInvokeActionZodSchema=void 0;var Ke=k();xr.adaptiveCardInvokeActionZodSchema=Ke.z.object({type:Ke.z.string().min(1),id:Ke.z.string().optional(),verb:Ke.z.string().min(1),data:Ke.z.record(Ke.z.string().min(1),Ke.z.any())})});var ci=y(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var ui=y(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.default="00000000-0000-0000-0000-000000000000"});var di=y(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.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 $t=y(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});var Dc=di();function Lc(t){return typeof t=="string"&&Dc.default.test(t)}yn.default=Lc});var Ht=y(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});var zc=$t();function qc(t){if(!(0,zc.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)}vn.default=qc});var me=y(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.unsafeStringify=void 0;var Fc=$t(),N=[];for(let t=0;t<256;++t)N.push((t+256).toString(16).slice(1));function li(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()}Wt.unsafeStringify=li;function Vc(t,e=0){let r=li(t,e);if(!(0,Fc.default)(r))throw TypeError("Stringified UUID is invalid");return r}Wt.default=Vc});var wr=y(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});var gn,$c=new Uint8Array(16);function Hc(){if(!gn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");gn=crypto.getRandomValues.bind(crypto)}return gn($c)}_n.default=Hc});var bn=y(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.updateV1State=void 0;var fi=wr(),Wc=me(),Bt={};function Bc(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=pi((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,fi.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,fi.default)();hi(Bt,l,f),n=pi(f,Bt.msecs,Bt.nsecs,o?void 0:Bt.clockseq,o?void 0:Bt.node,e,r)}return e!=null?e:(0,Wc.unsafeStringify)(n)}function hi(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}Kt.updateV1State=hi;function pi(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}Kt.default=Bc});var wn=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});var Kc=Ht(),Jc=me();function Gc(t){let e=typeof t=="string"?(0,Kc.default)(t):t,r=Yc(e);return typeof t=="string"?(0,Jc.unsafeStringify)(r):r}xn.default=Gc;function Yc(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 yi=y(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});function Xc(t){let e=tu(t),r=eu(e,t.length*8);return Qc(r)}function Qc(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 mi(t){return(t+64>>>9<<4)+14+1}function eu(t,e){let r=new Uint32Array(mi(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=L(n,o,i,s,t[a],7,-680876936),s=L(s,n,o,i,t[a+1],12,-389564586),i=L(i,s,n,o,t[a+2],17,606105819),o=L(o,i,s,n,t[a+3],22,-1044525330),n=L(n,o,i,s,t[a+4],7,-176418897),s=L(s,n,o,i,t[a+5],12,1200080426),i=L(i,s,n,o,t[a+6],17,-1473231341),o=L(o,i,s,n,t[a+7],22,-45705983),n=L(n,o,i,s,t[a+8],7,1770035416),s=L(s,n,o,i,t[a+9],12,-1958414417),i=L(i,s,n,o,t[a+10],17,-42063),o=L(o,i,s,n,t[a+11],22,-1990404162),n=L(n,o,i,s,t[a+12],7,1804603682),s=L(s,n,o,i,t[a+13],12,-40341101),i=L(i,s,n,o,t[a+14],17,-1502002290),o=L(o,i,s,n,t[a+15],22,1236535329),n=z(n,o,i,s,t[a+1],5,-165796510),s=z(s,n,o,i,t[a+6],9,-1069501632),i=z(i,s,n,o,t[a+11],14,643717713),o=z(o,i,s,n,t[a],20,-373897302),n=z(n,o,i,s,t[a+5],5,-701558691),s=z(s,n,o,i,t[a+10],9,38016083),i=z(i,s,n,o,t[a+15],14,-660478335),o=z(o,i,s,n,t[a+4],20,-405537848),n=z(n,o,i,s,t[a+9],5,568446438),s=z(s,n,o,i,t[a+14],9,-1019803690),i=z(i,s,n,o,t[a+3],14,-187363961),o=z(o,i,s,n,t[a+8],20,1163531501),n=z(n,o,i,s,t[a+13],5,-1444681467),s=z(s,n,o,i,t[a+2],9,-51403784),i=z(i,s,n,o,t[a+7],14,1735328473),o=z(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 tu(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(mi(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 ru(t,e){return t<<e|t>>>32-e}function Cr(t,e,r,n,o,i){return Ie(ru(Ie(Ie(e,t),Ie(n,i)),o),r)}function L(t,e,r,n,o,i,s){return Cr(e&r|~e&n,t,e,o,i,s)}function z(t,e,r,n,o,i,s){return Cr(e&n|r&~n,t,e,o,i,s)}function q(t,e,r,n,o,i,s){return Cr(e^r^n,t,e,o,i,s)}function F(t,e,r,n,o,i,s){return Cr(r^(e|~n),t,e,o,i,s)}Cn.default=Xc});var Jt=y(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.URL=ye.DNS=ye.stringToBytes=void 0;var vi=Ht(),nu=me();function gi(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=gi;ye.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ye.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function ou(t,e,r,n,o,i){let s=typeof r=="string"?gi(r):r,a=typeof n=="string"?(0,vi.default)(n):n;if(typeof n=="string"&&(n=(0,vi.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,nu.unsafeStringify)(d)}ye.default=ou});var bi=y(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.URL=Je.DNS=void 0;var iu=yi(),In=Jt(),_i=Jt();Object.defineProperty(Je,"DNS",{enumerable:!0,get:function(){return _i.DNS}});Object.defineProperty(Je,"URL",{enumerable:!0,get:function(){return _i.URL}});function Tn(t,e,r,n){return(0,In.default)(48,iu.default,t,e,r,n)}Tn.DNS=In.DNS;Tn.URL=In.URL;Je.default=Tn});var xi=y(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});var su=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);Sn.default={randomUUID:su}});var Ci=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});var wi=xi(),au=wr(),cu=me();function uu(t,e,r){var o,i,s;if(wi.default.randomUUID&&!e&&!t)return wi.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,au.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,cu.unsafeStringify)(n)}An.default=uu});var Ii=y(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});function du(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 On(t,e){return t<<e|t>>>32-e}function lu(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]=On(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],C=r[4];for(let O=0;O<80;++O){let v=Math.floor(O/20),S=On(l,5)+du(v,f,m,g)+C+e[v]+d[O]>>>0;C=g,g=m,m=On(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]+C>>>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])}Pn.default=lu});var Si=y(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.URL=Ge.DNS=void 0;var fu=Ii(),En=Jt(),Ti=Jt();Object.defineProperty(Ge,"DNS",{enumerable:!0,get:function(){return Ti.DNS}});Object.defineProperty(Ge,"URL",{enumerable:!0,get:function(){return Ti.URL}});function jn(t,e,r,n){return(0,En.default)(80,fu.default,t,e,r,n)}jn.DNS=En.DNS;jn.URL=En.URL;Ge.default=jn});var Ai=y(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});var pu=me(),hu=bn(),mu=wn();function yu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,hu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,mu.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,pu.unsafeStringify)(n)}Zn.default=yu});var Oi=y(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});var vu=Ht(),gu=me();function _u(t){let e=typeof t=="string"?(0,vu.default)(t):t,r=bu(e);return typeof t=="string"?(0,gu.unsafeStringify)(r):r}kn.default=_u;function bu(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 Zi=y(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.updateV7State=void 0;var Pi=wr(),xu=me(),Un={};function wu(t,e,r){var o,i,s;let n;if(t)n=Ei((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,Pi.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,Pi.default)();ji(Un,a,d),n=Ei(d,Un.msecs,Un.seq,e,r)}return e!=null?e:(0,xu.unsafeStringify)(n)}function ji(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}Gt.updateV7State=ji;function Ei(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}Gt.default=wu});var ki=y(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});var Cu=$t();function Iu(t){if(!(0,Cu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}Rn.default=Iu});var Ui=y(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.version=E.validate=E.v7=E.v6ToV1=E.v6=E.v5=E.v4=E.v3=E.v1ToV6=E.v1=E.stringify=E.parse=E.NIL=E.MAX=void 0;var Tu=ci();Object.defineProperty(E,"MAX",{enumerable:!0,get:function(){return Tu.default}});var Su=ui();Object.defineProperty(E,"NIL",{enumerable:!0,get:function(){return Su.default}});var Au=Ht();Object.defineProperty(E,"parse",{enumerable:!0,get:function(){return Au.default}});var Ou=me();Object.defineProperty(E,"stringify",{enumerable:!0,get:function(){return Ou.default}});var Pu=bn();Object.defineProperty(E,"v1",{enumerable:!0,get:function(){return Pu.default}});var Eu=wn();Object.defineProperty(E,"v1ToV6",{enumerable:!0,get:function(){return Eu.default}});var ju=bi();Object.defineProperty(E,"v3",{enumerable:!0,get:function(){return ju.default}});var Zu=Ci();Object.defineProperty(E,"v4",{enumerable:!0,get:function(){return Zu.default}});var ku=Si();Object.defineProperty(E,"v5",{enumerable:!0,get:function(){return ku.default}});var Uu=Ai();Object.defineProperty(E,"v6",{enumerable:!0,get:function(){return Uu.default}});var Ru=Oi();Object.defineProperty(E,"v6ToV1",{enumerable:!0,get:function(){return Ru.default}});var Nu=Zi();Object.defineProperty(E,"v7",{enumerable:!0,get:function(){return Nu.default}});var Mu=$t();Object.defineProperty(E,"validate",{enumerable:!0,get:function(){return Mu.default}});var Du=ki();Object.defineProperty(E,"version",{enumerable:!0,get:function(){return Du.default}})});var Nn=y(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.entityZodSchema=void 0;var Ri=k();Ir.entityZodSchema=Ri.z.object({type:Ri.z.string().min(1)}).passthrough()});var Ni=y(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.semanticActionZodSchema=void 0;var Yt=k(),Lu=Nn(),zu=un();Tr.semanticActionZodSchema=Yt.z.object({id:Yt.z.string().min(1),state:Yt.z.union([zu.semanticActionStateTypesZodSchema,Yt.z.string().min(1)]),entities:Yt.z.record(Lu.entityZodSchema)})});var Mi=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.cardActionZodSchema=void 0;var de=k(),qu=cn();Sr.cardActionZodSchema=de.z.object({type:de.z.union([qu.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 Di=y(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.suggestedActionsZodSchema=void 0;var Ar=k(),Fu=Mi();Or.suggestedActionsZodSchema=Ar.z.object({to:Ar.z.array(Ar.z.string().min(1)),actions:Ar.z.array(Fu.cardActionZodSchema)})});var Mn=y(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.activityEventNamesZodSchema=vt.ActivityEventNames=void 0;var Vu=k(),Li;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(Li||(vt.ActivityEventNames=Li={}));vt.activityEventNamesZodSchema=Vu.z.enum(["ContinueConversation","CreateConversation"])});var Dn=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.activityImportanceZodSchema=gt.ActivityImportance=void 0;var $u=k(),zi;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(zi||(gt.ActivityImportance=zi={}));gt.activityImportanceZodSchema=$u.z.enum(["low","normal","high"])});var Ln=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.activityTypesZodSchema=_t.ActivityTypes=void 0;var Hu=k(),qi;(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"})(qi||(_t.ActivityTypes=qi={}));_t.activityTypesZodSchema=Hu.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Fi=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.attachmentZodSchema=void 0;var bt=k();Pr.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 Vi=y(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.addProductInfoToActivity=Ye.clearProductInfoFromActivity=void 0;var Wu=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};Ye.clearProductInfoFromActivity=Wu;var Bu=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,Ye.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};Ye.addProductInfoToActivity=Bu});var zn=y(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.channelAccountZodSchema=void 0;var ne=k(),Ku=Vt();Er.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([Ku.roleTypeZodSchema,ne.z.string().min(1)]).optional(),properties:ne.z.unknown().optional()})});var qn=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.conversationAccountZodSchema=void 0;var le=k(),Ju=Vt();jr.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([Ju.roleTypeZodSchema,le.z.string().min(1)]).optional(),properties:le.z.unknown().optional()})});var Hi=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.conversationReferenceZodSchema=void 0;var Xt=k(),$i=zn(),Gu=qn();Zr.conversationReferenceZodSchema=Xt.z.object({activityId:Xt.z.string().min(1).optional(),user:$i.channelAccountZodSchema.optional(),locale:Xt.z.string().min(1).optional(),agent:$i.channelAccountZodSchema.optional().nullable(),conversation:Gu.conversationAccountZodSchema,channelId:Xt.z.string().min(1),serviceUrl:Xt.z.string().min(1).optional()})});var Fn=y(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.deliveryModesZodSchema=xt.DeliveryModes=void 0;var Yu=k(),Wi;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Wi||(xt.DeliveryModes=Wi={}));xt.deliveryModesZodSchema=Yu.z.enum(["normal","notification","expectReplies","ephemeral"])});var Vn=y(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.inputHintsZodSchema=wt.InputHints=void 0;var Xu=k(),Bi;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Bi||(wt.InputHints=Bi={}));wt.inputHintsZodSchema=Xu.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var $n=y(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.messageReactionTypesZodSchema=Ct.MessageReactionTypes=void 0;var Qu=k(),Ki;(function(t){t.Like="like",t.PlusOne="plusOne"})(Ki||(Ct.MessageReactionTypes=Ki={}));Ct.messageReactionTypesZodSchema=Qu.z.enum(["like","plusOne"])});var Ji=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.messageReactionZodSchema=void 0;var Hn=k(),ed=$n();kr.messageReactionZodSchema=Hn.z.object({type:Hn.z.union([ed.messageReactionTypesZodSchema,Hn.z.string().min(1)])})});var Wn=y(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.textFormatTypesZodSchema=It.TextFormatTypes=void 0;var td=k(),Gi;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(Gi||(It.TextFormatTypes=Gi={}));It.textFormatTypesZodSchema=td.z.enum(["markdown","plain","xml"])});var Yi=y(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.textHighlightZodSchema=void 0;var Bn=k();Ur.textHighlightZodSchema=Bn.z.object({text:Bn.z.string().min(1),occurrence:Bn.z.number()})});var Kn=y(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.ExceptionHelper=void 0;var Rr=class t{static generateException(e,r,n,o){var i;let s=r.description;o&&Object.keys(o).forEach(m=>{s=s.replace(`{${m}}`,o[m])});let d=((i=r.helplink)!==null&&i!==void 0?i:t.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),l=`[${r.code}] - ${s} - ${d}`,f=new e(l);return f.code=r.code,f.helpLink=d,n&&(f.innerException=n),f}};Nr.ExceptionHelper=Rr;Rr.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var Jn=y(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.Errors=void 0;Mr.Errors={InvalidActivityTypeUndefined:{code:-11e4,description:"Invalid ActivityType: undefined"},InvalidActivityTypeNull:{code:-110001,description:"Invalid ActivityType: null"},InvalidActivityTypeEmptyString:{code:-110002,description:"Invalid ActivityType: empty string"},InvalidChannelIdFormat:{code:-110003,description:"Invalid channelId {channelId}. Found subChannel but no main channel."},PrimaryChannelNotSet:{code:-110004,description:"Primary channel must be set before setting subChannel"},ActivityRecipientUndefined:{code:-110005,description:"Activity Recipient undefined"},ActivityConversationUndefined:{code:-110006,description:"Activity Conversation undefined"},ActivityChannelIdUndefined:{code:-110007,description:"Activity ChannelId undefined"}}});var ns=y(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.Activity=Xe.activityZodSchema=void 0;var rd=Ui(),b=k(),nd=Ni(),od=Di(),rs=Mn(),id=Dn(),Lr=Ln(),sd=Fi(),ad=dn(),Xi=Vi(),Dr=zn(),Qi=ln(),cd=qn(),ud=Hi(),dd=fn(),ld=Fn(),fd=Nn(),pd=Vn(),es=Ji(),hd=Wn(),md=Yi(),ts=Vt(),Te=Kn(),Se=Jn();Xe.activityZodSchema=b.z.object({type:b.z.union([Lr.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:Dr.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:cd.conversationAccountZodSchema.optional(),recipient:Dr.channelAccountZodSchema.optional(),textFormat:b.z.union([hd.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([ad.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(Dr.channelAccountZodSchema).optional(),membersRemoved:b.z.array(Dr.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(es.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(es.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([pd.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:od.suggestedActionsZodSchema.optional(),attachments:b.z.array(sd.attachmentZodSchema).optional(),entities:b.z.array(fd.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([rs.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:ud.conversationReferenceZodSchema.optional(),code:b.z.union([dd.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([id.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([ld.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(md.textHighlightZodSchema).optional(),semanticAction:nd.semanticActionZodSchema.optional()});var Gn=class t{constructor(e){if(e===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeUndefined);if(e===null)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeNull);if(typeof e=="string"&&e.length===0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeEmptyString);this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Xe.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 Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidChannelIdFormat,void 0,{channelId:e});this._channelId=r,n?(0,Xi.addProductInfoToActivity)(this,n):(0,Xi.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 Te.ExceptionHelper.generateException(Error,Se.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:Lr.ActivityTypes.Event,name:rs.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,rd.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!==Lr.ActivityTypes.ConversationUpdate||this.channelId!==Qi.Channels.Directline&&this.channelId!==Qi.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityChannelIdUndefined);return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(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===Lr.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(e,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,e,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===ts.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===ts.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}};Xe.Activity=Gn});var is=y(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.ActivityTreatments=void 0;var os;(function(t){t.Targeted="targeted"})(os||(zr.ActivityTreatments=os={}))});var Yn=y(x=>{"use strict";var yd=x&&x.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ss=x&&x.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yd(e,t,r)};Object.defineProperty(x,"__esModule",{value:!0});x.ActivityErrors=x.ExceptionHelper=x.Logger=x.debug=x.ActivityTreatments=x.TextFormatTypes=x.MessageReactionTypes=x.InputHints=x.DeliveryModes=x.ActivityTypes=x.ActivityImportance=x.ActivityEventNames=x.activityZodSchema=x.Activity=x.RoleTypes=x.MembershipTypes=x.MembershipSourceTypes=x.EndOfConversationCodes=x.Channels=x.AttachmentLayoutTypes=x.SemanticActionStateTypes=x.ActionTypes=void 0;var vd=cn();Object.defineProperty(x,"ActionTypes",{enumerable:!0,get:function(){return vd.ActionTypes}});var gd=un();Object.defineProperty(x,"SemanticActionStateTypes",{enumerable:!0,get:function(){return gd.SemanticActionStateTypes}});var _d=dn();Object.defineProperty(x,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return _d.AttachmentLayoutTypes}});var bd=ln();Object.defineProperty(x,"Channels",{enumerable:!0,get:function(){return bd.Channels}});var xd=fn();Object.defineProperty(x,"EndOfConversationCodes",{enumerable:!0,get:function(){return xd.EndOfConversationCodes}});var wd=ri();Object.defineProperty(x,"MembershipSourceTypes",{enumerable:!0,get:function(){return wd.MembershipSourceTypes}});var Cd=oi();Object.defineProperty(x,"MembershipTypes",{enumerable:!0,get:function(){return Cd.MembershipTypes}});var Id=Vt();Object.defineProperty(x,"RoleTypes",{enumerable:!0,get:function(){return Id.RoleTypes}});ss(si(),x);ss(ai(),x);var as=ns();Object.defineProperty(x,"Activity",{enumerable:!0,get:function(){return as.Activity}});Object.defineProperty(x,"activityZodSchema",{enumerable:!0,get:function(){return as.activityZodSchema}});var Td=Mn();Object.defineProperty(x,"ActivityEventNames",{enumerable:!0,get:function(){return Td.ActivityEventNames}});var Sd=Dn();Object.defineProperty(x,"ActivityImportance",{enumerable:!0,get:function(){return Sd.ActivityImportance}});var Ad=Ln();Object.defineProperty(x,"ActivityTypes",{enumerable:!0,get:function(){return Ad.ActivityTypes}});var Od=Fn();Object.defineProperty(x,"DeliveryModes",{enumerable:!0,get:function(){return Od.DeliveryModes}});var Pd=Vn();Object.defineProperty(x,"InputHints",{enumerable:!0,get:function(){return Pd.InputHints}});var Ed=$n();Object.defineProperty(x,"MessageReactionTypes",{enumerable:!0,get:function(){return Ed.MessageReactionTypes}});var jd=Wn();Object.defineProperty(x,"TextFormatTypes",{enumerable:!0,get:function(){return jd.TextFormatTypes}});var Zd=is();Object.defineProperty(x,"ActivityTreatments",{enumerable:!0,get:function(){return Zd.ActivityTreatments}});var cs=Mt();Object.defineProperty(x,"debug",{enumerable:!0,get:function(){return cs.debug}});Object.defineProperty(x,"Logger",{enumerable:!0,get:function(){return cs.Logger}});var kd=Kn();Object.defineProperty(x,"ExceptionHelper",{enumerable:!0,get:function(){return kd.ExceptionHelper}});var Ud=Jn();Object.defineProperty(x,"ActivityErrors",{enumerable:!0,get:function(){return Ud.Errors}})});var Rt=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Rt||{});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 Jr=class{constructor(){this.useExperimentalEndpoint=!1}},Gr=class extends Jr{constructor(e){var i,s,a;if(super(),!e)return;let r=((i=e.cloud)==null?void 0:i.trim())||"Prod",n=((s=e.copilotAgentType)==null?void 0:s.trim())||"Published",o=((a=e.authority)==null?void 0:a.trim())||"https://login.microsoftonline.com";if(!Object.values(Nt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Nt).join(", ")}`);if(!Object.values(Rt).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(Rt).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},el=()=>{var t,e,r,n,o,i,s;return new Gr({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",schemaName:(i=process.env.schemaName)!=null?i:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((s=process.env.useExperimentalEndpoint)==null?void 0:s.toLowerCase())==="true"})};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 Yr(t){}function yo(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=Yr,onError:r=Yr,onRetry:n=Yr,onComment:o}=t,i="",s=!0,a,d="",l="";function f(v){let S=s?v.replace(/^\xEF\xBB\xBF/,""):v,[A,P]=Ls(`${i}${S}`);for(let R of A)m(R);i=P,s=!1}function m(v){if(v===""){C();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 tr(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:A}));break;default:r(new tr(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:S,line:A}));break}}function C(){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 Ls(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),i=t.indexOf(`
1
+ var Ds=Object.create;var bo=Object.defineProperty;var Ls=Object.getOwnPropertyDescriptor;var zs=Object.getOwnPropertyNames;var qs=Object.getPrototypeOf,Fs=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var $s=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zs(e))!Fs.call(t,o)&&o!==r&&bo(t,o,{get:()=>e[o],enumerable:!(n=Ls(e,o))||n.enumerable});return t};var Rt=(t,e,r)=>(r=t!=null?Ds(qs(t)):{},$s(e||!t||!t.__esModule?bo(r,"default",{value:t,enumerable:!0}):r,t));var Co=y((dl,wo)=>{var rt=1e3,nt=rt*60,ot=nt*60,Ee=ot*24,Ys=Ee*7,Xs=Ee*365.25;wo.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?ta(t):ea(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*Xs;case"weeks":case"week":case"w":return r*Ys;case"days":case"day":case"d":return r*Ee;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ot;case"minutes":case"minute":case"mins":case"min":case"m":return r*nt;case"seconds":case"second":case"secs":case"sec":case"s":return r*rt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function ea(t){var e=Math.abs(t);return e>=Ee?Math.round(t/Ee)+"d":e>=ot?Math.round(t/ot)+"h":e>=nt?Math.round(t/nt)+"m":e>=rt?Math.round(t/rt)+"s":t+"ms"}function ta(t){var e=Math.abs(t);return e>=Ee?sr(t,e,Ee,"day"):e>=ot?sr(t,e,ot,"hour"):e>=nt?sr(t,e,nt,"minute"):e>=rt?sr(t,e,rt,"second"):t+" ms"}function sr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var To=y((ll,Io)=>{function ra(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=Co(),r.destroy=l,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let h=0;for(let C=0;C<f.length;C++)h=(h<<5)-h+f.charCodeAt(C),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(f){let h,C=null,T,P;function v(...b){if(!v.enabled)return;let _=v,O=Number(new Date),E=O-(h||O);_.diff=E,_.prev=h,_.curr=O,h=O,b[0]=r.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let N=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(H,Y)=>{if(H==="%%")return"%";N++;let Pe=r.formatters[Y];if(typeof Pe=="function"){let Yr=b[N];H=Pe.call(_,Yr),b.splice(N,1),N--}return H}),r.formatArgs.call(_,b),(_.log||r.log).apply(_,b)}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:()=>C!==null?C:(T!==r.namespaces&&(T=r.namespaces,P=r.enabled(f)),P),set:b=>{C=b}}),typeof r.init=="function"&&r.init(v),v}function n(f,h){let C=r(this.namespace+(typeof h=="undefined"?":":h)+f);return C.log=this.log,C}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let h=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let C of h)C[0]==="-"?r.skips.push(C.slice(1)):r.names.push(C)}function i(f,h){let C=0,T=0,P=-1,v=0;for(;C<f.length;)if(T<h.length&&(h[T]===f[C]||h[T]==="*"))h[T]==="*"?(P=T,v=C,T++):(C++,T++);else if(P!==-1)T=P+1,v++,C=v;else return!1;for(;T<h.length&&h[T]==="*";)T++;return T===h.length}function s(){let f=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),f}function a(f){for(let h of r.skips)if(i(f,h))return!1;for(let h of r.names)if(i(f,h))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}Io.exports=ra});var So=y((B,ar)=>{B.formatArgs=oa;B.save=ia;B.load=sa;B.useColors=na;B.storage=aa();B.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();B.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function na(){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 oa(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+ar.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}B.log=console.debug||console.log||(()=>{});function ia(t){try{t?B.storage.setItem("debug",t):B.storage.removeItem("debug")}catch{}}function sa(){let t;try{t=B.storage.getItem("debug")||B.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function aa(){try{return localStorage}catch{}}ar.exports=To()(B);var{formatters:ca}=ar.exports;ca.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Mt=y(je=>{"use strict";var ua=je&&je.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(je,"__esModule",{value:!0});je.Logger=void 0;je.debug=fa;var da=ua(So()),la=["info","warn","error","debug"],cr=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of la){let n=(0,da.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)}};je.Logger=cr;function fa(t){return new cr(t)}});var zt=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var nn;(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})(nn||(k.util=nn={}));var jo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jo||(k.objectUtil=jo={}));k.ZodParsedType=nn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var ya=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=ya});var fr=y(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.ZodError=ge.quotelessJson=ge.ZodIssueCode=void 0;var Zo=zt();ge.ZodIssueCode=Zo.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 va=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");ge.quotelessJson=va;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,Zo.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()}};ge.ZodError=qt;qt.create=t=>new qt(t)});var sn=y(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});var z=fr(),Ze=zt(),ga=(t,e)=>{let r;switch(t.code){case z.ZodIssueCode.invalid_type:t.received===Ze.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.util.jsonStringifyReplacer)}`;break;case z.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.util.joinValues(t.keys,", ")}`;break;case z.ZodIssueCode.invalid_union:r="Invalid input";break;case z.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.util.joinValues(t.options)}`;break;case z.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.util.joinValues(t.options)}, received '${t.received}'`;break;case z.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case z.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case z.ZodIssueCode.invalid_date:r="Invalid date";break;case z.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 z.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 z.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 z.ZodIssueCode.custom:r="Invalid input";break;case z.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case z.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.util.assertNever(t)}return{message:r}};on.default=ga});var pr=y(be=>{"use strict";var ba=be&&be.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(be,"__esModule",{value:!0});be.defaultErrorMap=void 0;be.setErrorMap=_a;be.getErrorMap=xa;var ko=ba(sn());be.defaultErrorMap=ko.default;var Ro=ko.default;function _a(t){Ro=t}function xa(){return Ro}});var cn=y(Z=>{"use strict";var wa=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=Ta;var Ca=pr(),Uo=wa(sn()),Ia=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=Ia;Z.EMPTY_PATH=[];function Ta(t,e){let r=(0,Ca.getErrorMap)(),n=(0,Z.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Uo.default?void 0:Uo.default].filter(o=>!!o)});t.common.issues.push(n)}var an=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=an;Z.INVALID=Object.freeze({status:"aborted"});var Sa=t=>({status:"dirty",value:t});Z.DIRTY=Sa;var Aa=t=>({status:"valid",value:t});Z.OK=Aa;var Pa=t=>t.status==="aborted";Z.isAborted=Pa;var Oa=t=>t.status==="dirty";Z.isDirty=Oa;var Ea=t=>t.status==="valid";Z.isValid=Ea;var ja=t=>typeof Promise!="undefined"&&t instanceof Promise;Z.isAsync=ja});var Mo=y(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0})});var Lo=y(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.errorUtil=void 0;var Do;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Do||(mr.errorUtil=Do={}))});var Yo=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=Vo;c.custom=Wo;var p=fr(),hr=pr(),g=Lo(),u=cn(),m=zt(),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 S(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{var l,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 A=class{get description(){return this._def.description}_getType(e){return(0,m.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,m.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,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,m.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,m.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,m.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:I.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 me.create(this)}promise(){return we.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new J({...S(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new He({...S(this._def),innerType:this,defaultValue:r,typeName:I.ZodDefault})}brand(){return new Ft({typeName:I.ZodBranded,type:this,...S(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new We({...S(this._def),innerType:this,catchValue:r,typeName:I.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return $t.create(this,e)}readonly(){return Be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=A;c.Schema=A;c.ZodSchema=A;var Za=/^c[^\s-]{8,}$/i,ka=/^[0-9a-z]+$/,Ra=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ua=/^[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,Na=/^[a-z0-9_-]{21}$/i,Ma=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Da=/^[-+]?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)?)??$/,La=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,za="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",un,qa=/^(?:(?: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])$/,Fa=/^(?:(?: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])$/,$a=/^(([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]))$/,Va=/^(([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])$/,Ha=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fo="((\\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])))",Ba=new RegExp(`^${Fo}$`);function $o(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 Ga(t){return new RegExp(`^${$o(t)}$`)}function Vo(t){let e=`${Fo}T${$o(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 Ka(t,e){return!!((e==="v4"||!e)&&qa.test(t)||(e==="v6"||!e)&&$a.test(t))}function Ja(t,e){if(!Ma.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 Ya(t,e){return!!((e==="v4"||!e)&&Fa.test(t)||(e==="v6"||!e)&&Va.test(t))}var _e=class t extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:m.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")La.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")un||(un=new RegExp(za,"u")),un.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")Ua.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")Na.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")Za.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")ka.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")Ra.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"?Vo(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"?Ba.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"?Ga(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"?Da.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"?Ka(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"?Ja(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"?Ya(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"?Ha.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"?Wa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):m.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:p.ZodIssueCode.invalid_string,...g.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.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,...g.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,...g.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...g.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...g.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...g.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...g.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...g.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...g.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...g.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...g.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,g.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:I.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...S(t)})};function Xa(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 ke=class t extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.number,received:i.parsedType}),u.INVALID}let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="int"?m.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"?Xa(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()):m.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,g.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,g.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,g.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,g.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:g.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:g.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:g.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&m.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};c.ZodNumber=ke;ke.create=t=>new ke({checks:[],typeName:I.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});var Re=class t extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new 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()):m.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:m.ZodParsedType.bigint,received:r.parsedType}),u.INVALID}gte(e,r){return this.setLimit("min",e,!0,g.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,g.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,g.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,g.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:g.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:g.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:g.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=Re;Re.create=t=>{var e;return new Re({checks:[],typeName:I.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...S(t)})};var Ue=class extends A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.boolean,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodBoolean=Ue;Ue.create=t=>new Ue({typeName:I.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});var Ne=class t extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:m.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()):m.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:g.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:g.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=Ne;Ne.create=t=>new Ne({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:I.ZodDate,...S(t)});var at=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.symbol,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodSymbol=at;at.create=t=>new at({typeName:I.ZodSymbol,...S(t)});var Me=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.undefined,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodUndefined=Me;Me.create=t=>new Me({typeName:I.ZodUndefined,...S(t)});var De=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.null,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodNull=De;De.create=t=>new De({typeName:I.ZodNull,...S(t)});var xe=class extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=xe;xe.create=t=>new xe({typeName:I.ZodAny,...S(t)});var pe=class extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=pe;pe.create=t=>new pe({typeName:I.ZodUnknown,...S(t)});var re=class extends A{_parse(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.never,received:r.parsedType}),u.INVALID}};c.ZodNever=re;re.create=t=>new re({typeName:I.ZodNever,...S(t)});var ct=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.void,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodVoid=ct;ct.create=t=>new ct({typeName:I.ZodVoid,...S(t)});var me=class t extends A{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==m.ZodParsedType.array)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.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:g.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:g.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:g.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=me;me.create=(t,e)=>new me({type:t,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...S(e)});function st(t){if(t instanceof G){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=X.create(st(n))}return new G({...t._def,shape:()=>e})}else return t instanceof me?new me({...t._def,type:st(t.element)}):t instanceof X?X.create(st(t.unwrap())):t instanceof ue?ue.create(st(t.unwrap())):t instanceof ce?ce.create(t.items.map(e=>st(e))):t}var G=class t extends A{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=m.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==m.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:m.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],h=o.data[l];d.push({key:{status:"valid",value:l},value:f._parse(new Q(o,h,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 h=o.data[f];d.push({key:{status:"valid",value:f},value:l._parse(new Q(o,h,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of d){let h=await f.key,C=await f.value;l.push({key:h,value:C,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 g.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=g.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:I.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of m.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of m.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return st(this)}partial(e){let r={};for(let n of m.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of m.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof X;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Ho(m.util.objectKeys(this.shape))}};c.ZodObject=G;G.create=(t,e)=>new G({shape:()=>t,unknownKeys:"strip",catchall:re.create(),typeName:I.ZodObject,...S(e)});G.strictCreate=(t,e)=>new G({shape:()=>t,unknownKeys:"strict",catchall:re.create(),typeName:I.ZodObject,...S(e)});G.lazycreate=(t,e)=>new G({shape:t,unknownKeys:"strip",catchall:re.create(),typeName:I.ZodObject,...S(e)});var Le=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new 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=Le;Le.create=(t,e)=>new Le({options:t,typeName:I.ZodUnion,...S(e)});var fe=t=>t instanceof qe?fe(t.schema):t instanceof J?fe(t.innerType()):t instanceof Fe?[t.value]:t instanceof $e?t.options:t instanceof Ve?m.util.objectValues(t.enum):t instanceof He?fe(t._def.innerType):t instanceof Me?[void 0]:t instanceof De?[null]:t instanceof X?[void 0,...fe(t.unwrap())]:t instanceof ue?[null,...fe(t.unwrap())]:t instanceof Ft||t instanceof Be?fe(t.unwrap()):t instanceof We?fe(t._def.innerType):[],yr=class t extends A{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.object)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.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:I.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...S(n)})}};c.ZodDiscriminatedUnion=yr;function dn(t,e){let r=(0,m.getParsedType)(t),n=(0,m.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===m.ZodParsedType.object&&n===m.ZodParsedType.object){let o=m.util.objectKeys(e),i=m.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let d=dn(t[a],e[a]);if(!d.valid)return{valid:!1};s[a]=d.data}return{valid:!0,data:s}}else if(r===m.ZodParsedType.array&&n===m.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],d=dn(s,a);if(!d.valid)return{valid:!1};o.push(d.data)}return{valid:!0,data:o}}else return r===m.ZodParsedType.date&&n===m.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ze=class extends A{_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=dn(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=ze;ze.create=(t,e,r)=>new ze({left:t,right:e,typeName:I.ZodIntersection,...S(r)});var ce=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.array)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.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:I.ZodTuple,rest:null,...S(e)})};var vr=class t extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.object)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.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 A?new t({keyType:e,valueType:r,typeName:I.ZodRecord,...S(n)}):new t({keyType:_e.create(),valueType:e,typeName:I.ZodRecord,...S(r)})}};c.ZodRecord=vr;var ut=class extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.map)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.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=ut;ut.create=(t,e,r)=>new ut({valueType:e,keyType:t,typeName:I.ZodMap,...S(r)});var dt=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.set)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.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:g.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:g.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=dt;dt.create=(t,e)=>new dt({valueType:t,minSize:null,maxSize:null,typeName:I.ZodSet,...S(e)});var gr=class t extends A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.function)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.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 we){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}),h=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(h,i).catch(T=>{throw l.addIssue(o(h,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),h=a._def.returns.safeParse(f,i);if(!h.success)throw new p.ZodError([o(f,h.error)]);return h.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:I.ZodFunction,...S(n)})}};c.ZodFunction=gr;var qe=class extends A{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};c.ZodLazy=qe;qe.create=(t,e)=>new qe({getter:t,typeName:I.ZodLazy,...S(e)});var Fe=class extends A{_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=Fe;Fe.create=(t,e)=>new Fe({value:t,typeName:I.ZodLiteral,...S(e)});function Ho(t,e){return new $e({values:t,typeName:I.ZodEnum,...S(e)})}var $e=class t extends A{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{expected:m.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=$e;$e.create=Ho;var Ve=class extends A{_parse(e){let r=m.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.ZodParsedType.string&&n.parsedType!==m.ZodParsedType.number){let o=m.util.objectValues(r);return(0,u.addIssueToContext)(n,{expected:m.util.joinValues(o),received:n.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(m.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=m.util.objectValues(r);return(0,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=Ve;Ve.create=(t,e)=>new Ve({values:t,typeName:I.ZodNativeEnum,...S(e)});var we=class extends A{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.promise&&r.common.async===!1)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.promise,received:r.parsedType}),u.INVALID;let n=r.parsedType===m.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=we;we.create=(t,e)=>new we({type:t,typeName:I.ZodPromise,...S(e)});var J=class extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.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);m.util.assertNever(o)}};c.ZodEffects=J;c.ZodTransformer=J;J.create=(t,e,r)=>new J({schema:t,typeName:I.ZodEffects,effect:e,...S(r)});J.createWithPreprocess=(t,e,r)=>new J({schema:e,effect:{type:"preprocess",transform:t},typeName:I.ZodEffects,...S(r)});var X=class extends A{_parse(e){return this._getType(e)===m.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:I.ZodOptional,...S(e)});var ue=class extends A{_parse(e){return this._getType(e)===m.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:I.ZodNullable,...S(e)});var He=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===m.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};c.ZodDefault=He;He.create=(t,e)=>new He({innerType:t,typeName:I.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});var We=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,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=We;We.create=(t,e)=>new We({innerType:t,typeName:I.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});var lt=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.nan,received:n.parsedType}),u.INVALID}return{status:"valid",value:e.data}}};c.ZodNaN=lt;lt.create=t=>new lt({typeName:I.ZodNaN,...S(t)});c.BRAND=Symbol("zod_brand");var Ft=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};c.ZodBranded=Ft;var $t=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?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:I.ZodPipeline})}};c.ZodPipeline=$t;var Be=class extends A{_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=Be;Be.create=(t,e)=>new Be({innerType:t,typeName:I.ZodReadonly,...S(e)});function qo(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Wo(t,e={},r){return t?xe.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 h=qo(e,n),C=(f=(l=h.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...h,fatal:C})}});if(!i){let d=qo(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):xe.create()}c.late={object:G.lazycreate};var I;(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"})(I||(c.ZodFirstPartyTypeKind=I={}));var Qa=(t,e={message:`Input not instance of ${t.name}`})=>Wo(r=>r instanceof t,e);c.instanceof=Qa;var Bo=_e.create;c.string=Bo;var Go=ke.create;c.number=Go;var ec=lt.create;c.nan=ec;var tc=Re.create;c.bigint=tc;var Ko=Ue.create;c.boolean=Ko;var rc=Ne.create;c.date=rc;var nc=at.create;c.symbol=nc;var oc=Me.create;c.undefined=oc;var ic=De.create;c.null=ic;var sc=xe.create;c.any=sc;var ac=pe.create;c.unknown=ac;var cc=re.create;c.never=cc;var uc=ct.create;c.void=uc;var dc=me.create;c.array=dc;var lc=G.create;c.object=lc;var fc=G.strictCreate;c.strictObject=fc;var pc=Le.create;c.union=pc;var mc=yr.create;c.discriminatedUnion=mc;var hc=ze.create;c.intersection=hc;var yc=ce.create;c.tuple=yc;var vc=vr.create;c.record=vc;var gc=ut.create;c.map=gc;var bc=dt.create;c.set=bc;var _c=gr.create;c.function=_c;var xc=qe.create;c.lazy=xc;var wc=Fe.create;c.literal=wc;var Cc=$e.create;c.enum=Cc;var Ic=Ve.create;c.nativeEnum=Ic;var Tc=we.create;c.promise=Tc;var Jo=J.create;c.effect=Jo;c.transformer=Jo;var Sc=X.create;c.optional=Sc;var Ac=ue.create;c.nullable=Ac;var Pc=J.createWithPreprocess;c.preprocess=Pc;var Oc=$t.create;c.pipeline=Oc;var Ec=()=>Bo().optional();c.ostring=Ec;var jc=()=>Go().optional();c.onumber=jc;var Zc=()=>Ko().optional();c.oboolean=Zc;c.coerce={string:(t=>_e.create({...t,coerce:!0})),number:(t=>ke.create({...t,coerce:!0})),boolean:(t=>Ue.create({...t,coerce:!0})),bigint:(t=>Re.create({...t,coerce:!0})),date:(t=>Ne.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var ln=y(ee=>{"use strict";var kc=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]})),ft=ee&&ee.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kc(e,t,r)};Object.defineProperty(ee,"__esModule",{value:!0});ft(pr(),ee);ft(cn(),ee);ft(Mo(),ee);ft(zt(),ee);ft(Yo(),ee);ft(fr(),ee)});var R=y(K=>{"use strict";var Xo=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]})),Rc=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Uc=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)&&Xo(e,t,r);return Rc(e,t),e},Nc=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xo(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.z=void 0;var Qo=Uc(ln());K.z=Qo;Nc(ln(),K);K.default=Qo});var fn=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.actionTypesZodSchema=pt.ActionTypes=void 0;var Mc=R(),ei;(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"})(ei||(pt.ActionTypes=ei={}));pt.actionTypesZodSchema=Mc.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var pn=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.semanticActionStateTypesZodSchema=mt.SemanticActionStateTypes=void 0;var Dc=R(),ti;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(ti||(mt.SemanticActionStateTypes=ti={}));mt.semanticActionStateTypesZodSchema=Dc.z.enum(["start","continue","done"])});var mn=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.attachmentLayoutTypesZodSchema=ht.AttachmentLayoutTypes=void 0;var Lc=R(),ri;(function(t){t.List="list",t.Carousel="carousel"})(ri||(ht.AttachmentLayoutTypes=ri={}));ht.attachmentLayoutTypesZodSchema=Lc.z.enum(["list","carousel"])});var hn=y(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.Channels=void 0;var ni;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.M365CopilotSubChannel="COPILOT",t.M365Copilot="msteams:COPILOT",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(ni||(br.Channels=ni={}))});var yn=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.endOfConversationCodesZodSchema=yt.EndOfConversationCodes=void 0;var zc=R(),oi;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(oi||(yt.EndOfConversationCodes=oi={}));yt.endOfConversationCodesZodSchema=zc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var si=y(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.MembershipSourceTypes=void 0;var ii;(function(t){t.Channel="channel",t.Team="team"})(ii||(_r.MembershipSourceTypes=ii={}))});var ci=y(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.MembershipTypes=void 0;var ai;(function(t){t.Direct="direct",t.Transitive="transitive"})(ai||(xr.MembershipTypes=ai={}))});var Vt=y(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.roleTypeZodSchema=vt.RoleTypes=void 0;var qc=R(),ui;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(ui||(vt.RoleTypes=ui={}));vt.roleTypeZodSchema=qc.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var di=y(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.addAIToActivity=void 0;var Fc=(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)};wr.addAIToActivity=Fc});var li=y(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.adaptiveCardInvokeActionZodSchema=void 0;var Ge=R();Cr.adaptiveCardInvokeActionZodSchema=Ge.z.object({type:Ge.z.string().min(1),id:Ge.z.string().optional(),verb:Ge.z.string().min(1),data:Ge.z.record(Ge.z.string().min(1),Ge.z.any())})});var fi=y(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var pi=y(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.default="00000000-0000-0000-0000-000000000000"});var mi=y(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.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 Ht=y(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});var $c=mi();function Vc(t){return typeof t=="string"&&$c.default.test(t)}_n.default=Vc});var Wt=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});var Hc=Ht();function Wc(t){if(!(0,Hc.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)}xn.default=Wc});var he=y(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.unsafeStringify=void 0;var Bc=Ht(),D=[];for(let t=0;t<256;++t)D.push((t+256).toString(16).slice(1));function hi(t,e=0){return(D[t[e+0]]+D[t[e+1]]+D[t[e+2]]+D[t[e+3]]+"-"+D[t[e+4]]+D[t[e+5]]+"-"+D[t[e+6]]+D[t[e+7]]+"-"+D[t[e+8]]+D[t[e+9]]+"-"+D[t[e+10]]+D[t[e+11]]+D[t[e+12]]+D[t[e+13]]+D[t[e+14]]+D[t[e+15]]).toLowerCase()}Bt.unsafeStringify=hi;function Gc(t,e=0){let r=hi(t,e);if(!(0,Bc.default)(r))throw TypeError("Stringified UUID is invalid");return r}Bt.default=Gc});var Ir=y(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});var wn,Kc=new Uint8Array(16);function Jc(){if(!wn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");wn=crypto.getRandomValues.bind(crypto)}return wn(Kc)}Cn.default=Jc});var In=y(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.updateV1State=void 0;var yi=Ir(),Yc=he(),Gt={};function Xc(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=vi((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,yi.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,yi.default)();gi(Gt,l,f),n=vi(f,Gt.msecs,Gt.nsecs,o?void 0:Gt.clockseq,o?void 0:Gt.node,e,r)}return e!=null?e:(0,Yc.unsafeStringify)(n)}function gi(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}Kt.updateV1State=gi;function vi(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}Kt.default=Xc});var Sn=y(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});var Qc=Wt(),eu=he();function tu(t){let e=typeof t=="string"?(0,Qc.default)(t):t,r=ru(e);return typeof t=="string"?(0,eu.unsafeStringify)(r):r}Tn.default=tu;function ru(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 _i=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});function nu(t){let e=su(t),r=iu(e,t.length*8);return ou(r)}function ou(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 bi(t){return(t+64>>>9<<4)+14+1}function iu(t,e){let r=new Uint32Array(bi(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,h=s;n=q(n,o,i,s,t[a],7,-680876936),s=q(s,n,o,i,t[a+1],12,-389564586),i=q(i,s,n,o,t[a+2],17,606105819),o=q(o,i,s,n,t[a+3],22,-1044525330),n=q(n,o,i,s,t[a+4],7,-176418897),s=q(s,n,o,i,t[a+5],12,1200080426),i=q(i,s,n,o,t[a+6],17,-1473231341),o=q(o,i,s,n,t[a+7],22,-45705983),n=q(n,o,i,s,t[a+8],7,1770035416),s=q(s,n,o,i,t[a+9],12,-1958414417),i=q(i,s,n,o,t[a+10],17,-42063),o=q(o,i,s,n,t[a+11],22,-1990404162),n=q(n,o,i,s,t[a+12],7,1804603682),s=q(s,n,o,i,t[a+13],12,-40341101),i=q(i,s,n,o,t[a+14],17,-1502002290),o=q(o,i,s,n,t[a+15],22,1236535329),n=F(n,o,i,s,t[a+1],5,-165796510),s=F(s,n,o,i,t[a+6],9,-1069501632),i=F(i,s,n,o,t[a+11],14,643717713),o=F(o,i,s,n,t[a],20,-373897302),n=F(n,o,i,s,t[a+5],5,-701558691),s=F(s,n,o,i,t[a+10],9,38016083),i=F(i,s,n,o,t[a+15],14,-660478335),o=F(o,i,s,n,t[a+4],20,-405537848),n=F(n,o,i,s,t[a+9],5,568446438),s=F(s,n,o,i,t[a+14],9,-1019803690),i=F(i,s,n,o,t[a+3],14,-187363961),o=F(o,i,s,n,t[a+8],20,1163531501),n=F(n,o,i,s,t[a+13],5,-1444681467),s=F(s,n,o,i,t[a+2],9,-51403784),i=F(i,s,n,o,t[a+7],14,1735328473),o=F(o,i,s,n,t[a+12],20,-1926607734),n=$(n,o,i,s,t[a+5],4,-378558),s=$(s,n,o,i,t[a+8],11,-2022574463),i=$(i,s,n,o,t[a+11],16,1839030562),o=$(o,i,s,n,t[a+14],23,-35309556),n=$(n,o,i,s,t[a+1],4,-1530992060),s=$(s,n,o,i,t[a+4],11,1272893353),i=$(i,s,n,o,t[a+7],16,-155497632),o=$(o,i,s,n,t[a+10],23,-1094730640),n=$(n,o,i,s,t[a+13],4,681279174),s=$(s,n,o,i,t[a],11,-358537222),i=$(i,s,n,o,t[a+3],16,-722521979),o=$(o,i,s,n,t[a+6],23,76029189),n=$(n,o,i,s,t[a+9],4,-640364487),s=$(s,n,o,i,t[a+12],11,-421815835),i=$(i,s,n,o,t[a+15],16,530742520),o=$(o,i,s,n,t[a+2],23,-995338651),n=V(n,o,i,s,t[a],6,-198630844),s=V(s,n,o,i,t[a+7],10,1126891415),i=V(i,s,n,o,t[a+14],15,-1416354905),o=V(o,i,s,n,t[a+5],21,-57434055),n=V(n,o,i,s,t[a+12],6,1700485571),s=V(s,n,o,i,t[a+3],10,-1894986606),i=V(i,s,n,o,t[a+10],15,-1051523),o=V(o,i,s,n,t[a+1],21,-2054922799),n=V(n,o,i,s,t[a+8],6,1873313359),s=V(s,n,o,i,t[a+15],10,-30611744),i=V(i,s,n,o,t[a+6],15,-1560198380),o=V(o,i,s,n,t[a+13],21,1309151649),n=V(n,o,i,s,t[a+4],6,-145523070),s=V(s,n,o,i,t[a+11],10,-1120210379),i=V(i,s,n,o,t[a+2],15,718787259),o=V(o,i,s,n,t[a+9],21,-343485551),n=Ce(n,d),o=Ce(o,l),i=Ce(i,f),s=Ce(s,h)}return Uint32Array.of(n,o,i,s)}function su(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(bi(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 Ce(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function au(t,e){return t<<e|t>>>32-e}function Tr(t,e,r,n,o,i){return Ce(au(Ce(Ce(e,t),Ce(n,i)),o),r)}function q(t,e,r,n,o,i,s){return Tr(e&r|~e&n,t,e,o,i,s)}function F(t,e,r,n,o,i,s){return Tr(e&n|r&~n,t,e,o,i,s)}function $(t,e,r,n,o,i,s){return Tr(e^r^n,t,e,o,i,s)}function V(t,e,r,n,o,i,s){return Tr(r^(e|~n),t,e,o,i,s)}An.default=nu});var Jt=y(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.URL=ye.DNS=ye.stringToBytes=void 0;var xi=Wt(),cu=he();function wi(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=wi;ye.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ye.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function uu(t,e,r,n,o,i){let s=typeof r=="string"?wi(r):r,a=typeof n=="string"?(0,xi.default)(n):n;if(typeof n=="string"&&(n=(0,xi.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,cu.unsafeStringify)(d)}ye.default=uu});var Ii=y(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.URL=Ke.DNS=void 0;var du=_i(),Pn=Jt(),Ci=Jt();Object.defineProperty(Ke,"DNS",{enumerable:!0,get:function(){return Ci.DNS}});Object.defineProperty(Ke,"URL",{enumerable:!0,get:function(){return Ci.URL}});function On(t,e,r,n){return(0,Pn.default)(48,du.default,t,e,r,n)}On.DNS=Pn.DNS;On.URL=Pn.URL;Ke.default=On});var Ti=y(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});var lu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);En.default={randomUUID:lu}});var Ai=y(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});var Si=Ti(),fu=Ir(),pu=he();function mu(t,e,r){var o,i,s;if(Si.default.randomUUID&&!e&&!t)return Si.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,fu.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,pu.unsafeStringify)(n)}jn.default=mu});var Pi=y(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});function hu(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 Zn(t,e){return t<<e|t>>>32-e}function yu(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 P=0;P<16;++P)d[P]=s[a][P];for(let P=16;P<80;++P)d[P]=Zn(d[P-3]^d[P-8]^d[P-14]^d[P-16],1);let l=r[0],f=r[1],h=r[2],C=r[3],T=r[4];for(let P=0;P<80;++P){let v=Math.floor(P/20),b=Zn(l,5)+hu(v,f,h,C)+T+e[v]+d[P]>>>0;T=C,C=h,h=Zn(f,30)>>>0,f=l,l=b}r[0]=r[0]+l>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+C>>>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])}kn.default=yu});var Ei=y(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.URL=Je.DNS=void 0;var vu=Pi(),Rn=Jt(),Oi=Jt();Object.defineProperty(Je,"DNS",{enumerable:!0,get:function(){return Oi.DNS}});Object.defineProperty(Je,"URL",{enumerable:!0,get:function(){return Oi.URL}});function Un(t,e,r,n){return(0,Rn.default)(80,vu.default,t,e,r,n)}Un.DNS=Rn.DNS;Un.URL=Rn.URL;Je.default=Un});var ji=y(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});var gu=he(),bu=In(),_u=Sn();function xu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,bu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,_u.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,gu.unsafeStringify)(n)}Nn.default=xu});var Zi=y(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});var wu=Wt(),Cu=he();function Iu(t){let e=typeof t=="string"?(0,wu.default)(t):t,r=Tu(e);return typeof t=="string"?(0,Cu.unsafeStringify)(r):r}Mn.default=Iu;function Tu(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 Ni=y(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.updateV7State=void 0;var ki=Ir(),Su=he(),Dn={};function Au(t,e,r){var o,i,s;let n;if(t)n=Ri((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,ki.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,ki.default)();Ui(Dn,a,d),n=Ri(d,Dn.msecs,Dn.seq,e,r)}return e!=null?e:(0,Su.unsafeStringify)(n)}function Ui(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=Ui;function Ri(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=Au});var Mi=y(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});var Pu=Ht();function Ou(t){if(!(0,Pu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}Ln.default=Ou});var Di=y(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.version=j.validate=j.v7=j.v6ToV1=j.v6=j.v5=j.v4=j.v3=j.v1ToV6=j.v1=j.stringify=j.parse=j.NIL=j.MAX=void 0;var Eu=fi();Object.defineProperty(j,"MAX",{enumerable:!0,get:function(){return Eu.default}});var ju=pi();Object.defineProperty(j,"NIL",{enumerable:!0,get:function(){return ju.default}});var Zu=Wt();Object.defineProperty(j,"parse",{enumerable:!0,get:function(){return Zu.default}});var ku=he();Object.defineProperty(j,"stringify",{enumerable:!0,get:function(){return ku.default}});var Ru=In();Object.defineProperty(j,"v1",{enumerable:!0,get:function(){return Ru.default}});var Uu=Sn();Object.defineProperty(j,"v1ToV6",{enumerable:!0,get:function(){return Uu.default}});var Nu=Ii();Object.defineProperty(j,"v3",{enumerable:!0,get:function(){return Nu.default}});var Mu=Ai();Object.defineProperty(j,"v4",{enumerable:!0,get:function(){return Mu.default}});var Du=Ei();Object.defineProperty(j,"v5",{enumerable:!0,get:function(){return Du.default}});var Lu=ji();Object.defineProperty(j,"v6",{enumerable:!0,get:function(){return Lu.default}});var zu=Zi();Object.defineProperty(j,"v6ToV1",{enumerable:!0,get:function(){return zu.default}});var qu=Ni();Object.defineProperty(j,"v7",{enumerable:!0,get:function(){return qu.default}});var Fu=Ht();Object.defineProperty(j,"validate",{enumerable:!0,get:function(){return Fu.default}});var $u=Mi();Object.defineProperty(j,"version",{enumerable:!0,get:function(){return $u.default}})});var zn=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.entityZodSchema=void 0;var Li=R();Sr.entityZodSchema=Li.z.object({type:Li.z.string().min(1)}).passthrough()});var zi=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.semanticActionZodSchema=void 0;var Xt=R(),Vu=zn(),Hu=pn();Ar.semanticActionZodSchema=Xt.z.object({id:Xt.z.string().min(1),state:Xt.z.union([Hu.semanticActionStateTypesZodSchema,Xt.z.string().min(1)]),entities:Xt.z.record(Vu.entityZodSchema)})});var qi=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.cardActionZodSchema=void 0;var de=R(),Wu=fn();Pr.cardActionZodSchema=de.z.object({type:de.z.union([Wu.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 Fi=y(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.suggestedActionsZodSchema=void 0;var Or=R(),Bu=qi();Er.suggestedActionsZodSchema=Or.z.object({to:Or.z.array(Or.z.string().min(1)),actions:Or.z.array(Bu.cardActionZodSchema)})});var qn=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.activityEventNamesZodSchema=gt.ActivityEventNames=void 0;var Gu=R(),$i;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})($i||(gt.ActivityEventNames=$i={}));gt.activityEventNamesZodSchema=Gu.z.enum(["ContinueConversation","CreateConversation"])});var Fn=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.activityImportanceZodSchema=bt.ActivityImportance=void 0;var Ku=R(),Vi;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Vi||(bt.ActivityImportance=Vi={}));bt.activityImportanceZodSchema=Ku.z.enum(["low","normal","high"])});var $n=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.activityTypesZodSchema=_t.ActivityTypes=void 0;var Ju=R(),Hi;(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"})(Hi||(_t.ActivityTypes=Hi={}));_t.activityTypesZodSchema=Ju.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Wi=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.attachmentZodSchema=void 0;var xt=R();jr.attachmentZodSchema=xt.z.object({contentType:xt.z.string().min(1),contentUrl:xt.z.string().min(1).optional(),content:xt.z.unknown().optional(),name:xt.z.string().min(1).optional(),thumbnailUrl:xt.z.string().min(1).optional()})});var Bi=y(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.addProductInfoToActivity=Ye.clearProductInfoFromActivity=void 0;var Yu=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};Ye.clearProductInfoFromActivity=Yu;var Xu=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,Ye.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};Ye.addProductInfoToActivity=Xu});var Vn=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.channelAccountZodSchema=void 0;var ne=R(),Qu=Vt();Zr.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([Qu.roleTypeZodSchema,ne.z.string().min(1)]).optional(),properties:ne.z.unknown().optional()})});var Hn=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.conversationAccountZodSchema=void 0;var le=R(),ed=Vt();kr.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([ed.roleTypeZodSchema,le.z.string().min(1)]).optional(),properties:le.z.unknown().optional()})});var Ki=y(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.conversationReferenceZodSchema=void 0;var Qt=R(),Gi=Vn(),td=Hn();Rr.conversationReferenceZodSchema=Qt.z.object({activityId:Qt.z.string().min(1).optional(),user:Gi.channelAccountZodSchema.optional(),locale:Qt.z.string().min(1).optional(),agent:Gi.channelAccountZodSchema.optional().nullable(),conversation:td.conversationAccountZodSchema,channelId:Qt.z.string().min(1),serviceUrl:Qt.z.string().min(1).optional()})});var Wn=y(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.deliveryModesZodSchema=wt.DeliveryModes=void 0;var rd=R(),Ji;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Ji||(wt.DeliveryModes=Ji={}));wt.deliveryModesZodSchema=rd.z.enum(["normal","notification","expectReplies","ephemeral"])});var Bn=y(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.inputHintsZodSchema=Ct.InputHints=void 0;var nd=R(),Yi;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Yi||(Ct.InputHints=Yi={}));Ct.inputHintsZodSchema=nd.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var Gn=y(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.messageReactionTypesZodSchema=It.MessageReactionTypes=void 0;var od=R(),Xi;(function(t){t.Like="like",t.PlusOne="plusOne"})(Xi||(It.MessageReactionTypes=Xi={}));It.messageReactionTypesZodSchema=od.z.enum(["like","plusOne"])});var Qi=y(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.messageReactionZodSchema=void 0;var Kn=R(),id=Gn();Ur.messageReactionZodSchema=Kn.z.object({type:Kn.z.union([id.messageReactionTypesZodSchema,Kn.z.string().min(1)])})});var Jn=y(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.textFormatTypesZodSchema=Tt.TextFormatTypes=void 0;var sd=R(),es;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(es||(Tt.TextFormatTypes=es={}));Tt.textFormatTypesZodSchema=sd.z.enum(["markdown","plain","xml"])});var ts=y(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.textHighlightZodSchema=void 0;var Yn=R();Nr.textHighlightZodSchema=Yn.z.object({text:Yn.z.string().min(1),occurrence:Yn.z.number()})});var Xn=y(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.ExceptionHelper=void 0;var Mr=class t{static generateException(e,r,n,o){var i;let s=r.description;o&&Object.keys(o).forEach(h=>{s=s.replace(`{${h}}`,o[h])});let d=((i=r.helplink)!==null&&i!==void 0?i:t.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),l=`[${r.code}] - ${s} - ${d}`,f=new e(l);return f.code=r.code,f.helpLink=d,n&&(f.innerException=n),f}};Dr.ExceptionHelper=Mr;Mr.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var Qn=y(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.Errors=void 0;Lr.Errors={InvalidActivityTypeUndefined:{code:-11e4,description:"Invalid ActivityType: undefined"},InvalidActivityTypeNull:{code:-110001,description:"Invalid ActivityType: null"},InvalidActivityTypeEmptyString:{code:-110002,description:"Invalid ActivityType: empty string"},InvalidChannelIdFormat:{code:-110003,description:"Invalid channelId {channelId}. Found subChannel but no main channel."},PrimaryChannelNotSet:{code:-110004,description:"Primary channel must be set before setting subChannel"},ActivityRecipientUndefined:{code:-110005,description:"Activity Recipient undefined"},ActivityConversationUndefined:{code:-110006,description:"Activity Conversation undefined"},ActivityChannelIdUndefined:{code:-110007,description:"Activity ChannelId undefined"}}});var as=y(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.Activity=Xe.activityZodSchema=void 0;var ad=Di(),x=R(),cd=zi(),ud=Fi(),ss=qn(),dd=Fn(),qr=$n(),ld=Wi(),fd=mn(),rs=Bi(),zr=Vn(),ns=hn(),pd=Hn(),md=Ki(),hd=yn(),yd=Wn(),vd=zn(),gd=Bn(),os=Qi(),bd=Jn(),_d=ts(),is=Vt(),Ie=Xn(),Te=Qn();Xe.activityZodSchema=x.z.object({type:x.z.union([qr.activityTypesZodSchema,x.z.string().min(1)]),text:x.z.string().optional(),id:x.z.string().min(1).optional(),channelId:x.z.string().min(1).optional(),from:zr.channelAccountZodSchema.optional(),timestamp:x.z.union([x.z.date(),x.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:x.z.union([x.z.date(),x.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:x.z.string().min(1).optional(),callerId:x.z.string().min(1).optional(),serviceUrl:x.z.string().min(1).optional(),conversation:pd.conversationAccountZodSchema.optional(),recipient:zr.channelAccountZodSchema.optional(),textFormat:x.z.union([bd.textFormatTypesZodSchema,x.z.string().min(1)]).optional(),attachmentLayout:x.z.union([fd.attachmentLayoutTypesZodSchema,x.z.string().min(1)]).optional(),membersAdded:x.z.array(zr.channelAccountZodSchema).optional(),membersRemoved:x.z.array(zr.channelAccountZodSchema).optional(),reactionsAdded:x.z.array(os.messageReactionZodSchema).optional(),reactionsRemoved:x.z.array(os.messageReactionZodSchema).optional(),topicName:x.z.string().min(1).optional(),historyDisclosed:x.z.boolean().optional(),locale:x.z.string().min(1).optional(),speak:x.z.string().min(1).optional(),inputHint:x.z.union([gd.inputHintsZodSchema,x.z.string().min(1)]).optional(),summary:x.z.string().min(1).optional(),suggestedActions:ud.suggestedActionsZodSchema.optional(),attachments:x.z.array(ld.attachmentZodSchema).optional(),entities:x.z.array(vd.entityZodSchema.passthrough()).optional(),channelData:x.z.any().optional(),action:x.z.string().min(1).optional(),replyToId:x.z.string().min(1).optional(),label:x.z.string().min(1).optional(),valueType:x.z.string().min(1).optional(),value:x.z.unknown().optional(),name:x.z.union([ss.activityEventNamesZodSchema,x.z.string().min(1)]).optional(),relatesTo:md.conversationReferenceZodSchema.optional(),code:x.z.union([hd.endOfConversationCodesZodSchema,x.z.string().min(1)]).optional(),expiration:x.z.union([x.z.date(),x.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:x.z.union([dd.activityImportanceZodSchema,x.z.string().min(1)]).optional(),deliveryMode:x.z.union([yd.deliveryModesZodSchema,x.z.string().min(1)]).optional(),listenFor:x.z.array(x.z.string().min(1)).optional(),textHighlights:x.z.array(_d.textHighlightZodSchema).optional(),semanticAction:cd.semanticActionZodSchema.optional()});var eo=class t{constructor(e){if(e===void 0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.InvalidActivityTypeUndefined);if(e===null)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.InvalidActivityTypeNull);if(typeof e=="string"&&e.length===0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.InvalidActivityTypeEmptyString);this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Xe.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.InvalidChannelIdFormat,void 0,{channelId:e});this._channelId=r,n?(0,rs.addProductInfoToActivity)(this,n):(0,rs.clearProductInfoFromActivity)(this)}set channelIdChannel(e){this._channelId=e}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var e,r;return(r=(e=this.entities)===null||e===void 0?void 0:e.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(e){if(!this._channelId)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:qr.ActivityTypes.Event,name:ss.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,ad.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!==qr.ActivityTypes.ConversationUpdate||this.channelId!==ns.Channels.Directline&&this.channelId!==ns.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.ActivityChannelIdUndefined);return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(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===qr.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(e,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,e,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===is.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===is.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}};Xe.Activity=eo});var us=y(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.ActivityTreatments=void 0;var cs;(function(t){t.Targeted="targeted"})(cs||(Fr.ActivityTreatments=cs={}))});var to=y(w=>{"use strict";var xd=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]})),ds=w&&w.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xd(e,t,r)};Object.defineProperty(w,"__esModule",{value:!0});w.ActivityErrors=w.ExceptionHelper=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 wd=fn();Object.defineProperty(w,"ActionTypes",{enumerable:!0,get:function(){return wd.ActionTypes}});var Cd=pn();Object.defineProperty(w,"SemanticActionStateTypes",{enumerable:!0,get:function(){return Cd.SemanticActionStateTypes}});var Id=mn();Object.defineProperty(w,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Id.AttachmentLayoutTypes}});var Td=hn();Object.defineProperty(w,"Channels",{enumerable:!0,get:function(){return Td.Channels}});var Sd=yn();Object.defineProperty(w,"EndOfConversationCodes",{enumerable:!0,get:function(){return Sd.EndOfConversationCodes}});var Ad=si();Object.defineProperty(w,"MembershipSourceTypes",{enumerable:!0,get:function(){return Ad.MembershipSourceTypes}});var Pd=ci();Object.defineProperty(w,"MembershipTypes",{enumerable:!0,get:function(){return Pd.MembershipTypes}});var Od=Vt();Object.defineProperty(w,"RoleTypes",{enumerable:!0,get:function(){return Od.RoleTypes}});ds(di(),w);ds(li(),w);var ls=as();Object.defineProperty(w,"Activity",{enumerable:!0,get:function(){return ls.Activity}});Object.defineProperty(w,"activityZodSchema",{enumerable:!0,get:function(){return ls.activityZodSchema}});var Ed=qn();Object.defineProperty(w,"ActivityEventNames",{enumerable:!0,get:function(){return Ed.ActivityEventNames}});var jd=Fn();Object.defineProperty(w,"ActivityImportance",{enumerable:!0,get:function(){return jd.ActivityImportance}});var Zd=$n();Object.defineProperty(w,"ActivityTypes",{enumerable:!0,get:function(){return Zd.ActivityTypes}});var kd=Wn();Object.defineProperty(w,"DeliveryModes",{enumerable:!0,get:function(){return kd.DeliveryModes}});var Rd=Bn();Object.defineProperty(w,"InputHints",{enumerable:!0,get:function(){return Rd.InputHints}});var Ud=Gn();Object.defineProperty(w,"MessageReactionTypes",{enumerable:!0,get:function(){return Ud.MessageReactionTypes}});var Nd=Jn();Object.defineProperty(w,"TextFormatTypes",{enumerable:!0,get:function(){return Nd.TextFormatTypes}});var Md=us();Object.defineProperty(w,"ActivityTreatments",{enumerable:!0,get:function(){return Md.ActivityTreatments}});var fs=Mt();Object.defineProperty(w,"debug",{enumerable:!0,get:function(){return fs.debug}});Object.defineProperty(w,"Logger",{enumerable:!0,get:function(){return fs.Logger}});var Dd=Xn();Object.defineProperty(w,"ExceptionHelper",{enumerable:!0,get:function(){return Dd.ExceptionHelper}});var Ld=Qn();Object.defineProperty(w,"ActivityErrors",{enumerable:!0,get:function(){return Ld.Errors}})});var Ut=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Ut||{});var Nt=(_=>(_.Unknown="Unknown",_.Exp="Exp",_.Dev="Dev",_.Test="Test",_.Preprod="Preprod",_.FirstRelease="FirstRelease",_.Prod="Prod",_.Gov="Gov",_.High="High",_.DoD="DoD",_.Mooncake="Mooncake",_.Ex="Ex",_.Rx="Rx",_.Prv="Prv",_.Local="Local",_.GovFR="GovFR",_.Other="Other",_))(Nt||{});var Xr=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},Qr=class extends Xr{constructor(e){var i,s,a;if(super(),!e)return;let r=((i=e.cloud)==null?void 0:i.trim())||"Prod",n=((s=e.copilotAgentType)==null?void 0:s.trim())||"Published",o=((a=e.authority)==null?void 0:a.trim())||"https://login.microsoftonline.com";if(!Object.values(Nt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Nt).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})}},il=()=>{var t,e,r,n,o,i,s,a;return new Qr({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",schemaName:(i=process.env.schemaName)!=null?i:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((s=process.env.useExperimentalEndpoint)==null?void 0:s.toLowerCase())==="true",enableDiagnostics:((a=process.env.enableDiagnostics)==null?void 0:a.toLowerCase())==="true"})};var or=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function en(t){}function _o(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=en,onError:r=en,onRetry:n=en,onComment:o}=t,i="",s=!0,a,d="",l="";function f(v){let b=s?v.replace(/^\xEF\xBB\xBF/,""):v,[_,O]=Vs(`${i}${b}`);for(let E of _)h(E);i=O,s=!1}function h(v){if(v===""){T();return}if(v.startsWith(":")){o&&o(v.slice(v.startsWith(": ")?2:1));return}let b=v.indexOf(":");if(b!==-1){let _=v.slice(0,b),O=v[b+1]===" "?2:1,E=v.slice(b+O);C(_,E,v);return}C(v,"",v)}function C(v,b,_){switch(v){case"event":l=b;break;case"data":d=`${d}${b}
2
+ `;break;case"id":a=b.includes("\0")?void 0:b;break;case"retry":/^\d+$/.test(b)?n(parseInt(b,10)):r(new or(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:_}));break;default:r(new or(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:b,line:_}));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 P(v={}){i&&v.consume&&h(i),s=!0,a=void 0,d="",l="",i=""}return{feed:f,reset:P}}function Vs(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 vo="connecting",zs="open",Xr="closed",rr=()=>{};function qs(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}=Fs(r),m={...r.headers},g=[],C=n?[n]:[],O=U=>C.forEach(se=>se(U)),v=yo({onEvent:Es,onRetry:js,onComment:o}),S,A=l.toString(),P=new AbortController,R=f,V=2e3,ie,$=Xr;return Y(),{close:Oe,connect:Y,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Kr,get lastEventId(){return R},get url(){return A},get readyState(){return $}};function Y(){S||($=vo,P=new AbortController,S=d(l,Zs()).then(Ps).catch(U=>{S=null,!(U.name==="AbortError"||U.type==="aborted"||P.signal.aborted)&&fo()}))}function Oe(){$=Xr,P.abort(),v.reset(),clearTimeout(ie),g.forEach(U=>U())}function Kr(){let U=[],se=[];function Zt(){return new Promise(H=>{let ae=se.shift();ae?H({value:ae,done:!1}):U.push(H)})}let et=function(H){let ae=U.shift();ae?ae({value:H,done:!1}):se.push(H)};function Pe(){for(C.splice(C.indexOf(et),1);U.shift(););for(;se.shift(););}function kt(){let H=U.shift();H&&(H({done:!0,value:void 0}),Pe())}return g.push(kt),C.push(et),{next(){return $===Xr?this.return():Zt()},return(){return Pe(),Promise.resolve({done:!0,value:void 0})},throw(H){return Pe(),Promise.reject(H)},[Symbol.asyncIterator](){return this}}}function fo(){a({delay:V}),!P.signal.aborted&&($=vo,ie=setTimeout(Y,V))}async function Ps(U){i(),v.reset();let{body:se,redirected:Zt,status:et}=U;if(et===204){s(),Oe();return}if(!se)throw new Error("Missing response body");Zt&&(A=U.url);let Pe=e(se),kt=new TextDecoder,H=Pe.getReader(),ae=!0;$=zs;do{let{done:po,value:ho}=await H.read();ho&&v.feed(kt.decode(ho,{stream:!po})),po&&(ae=!1,S=null,v.reset(),fo(),s())}while(ae)}function Es(U){typeof U.id=="string"&&(R=U.id),O(U)}function js(U){V=U}function Zs(){let{mode:U,credentials:se,body:Zt,method:et,redirect:Pe,referrer:kt,referrerPolicy:H}=r,ae={Accept:"text/event-stream",...m,...R?{"Last-Event-ID":R}:void 0};return{mode:U,credentials:se,body:Zt,method:et,redirect:Pe,referrer:kt,referrerPolicy:H,headers:ae,cache:"no-store",signal:P.signal}}}function Fs(t){let e=t.fetch||globalThis.fetch;if(!Vs(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 Vs(t){return typeof t=="function"}var $s={getStream:Hs};function go(t){return qs(t,$s)}function Hs(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var To=Ut(Mt());var sr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let r="schema"in e?e.schema:e.identifier,n=e.host;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var 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 ot=(0,To.debug)("copilot-studio:power-platform");function ur(t,e){var d,l,f,m,g,C,O,v;let r=((d=t.schemaName)==null?void 0:d.trim())||((l=t.agentIdentifier)==null?void 0:l.trim());if(!((f=t.directConnectUrl)!=null&&f.trim())&&(!((m=t.environmentId)!=null&&m.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((g=t.directConnectUrl)!=null&&g.trim()){if(ot.debug(`Using direct connection: ${t.directConnectUrl}`),!Dt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(ot.warn(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),ur({...t,directConnectUrl:""},e)):ca(t.directConnectUrl,e).href}let n=(C=t.cloud)!=null?C:"Prod",o=(O=t.copilotAgentType)!=null?O:"Published";if(ot.debug(`Using cloud setting: ${n}`),ot.debug(`Using agent type: ${o}`),n==="Other")if((v=t.customPowerPlatformCloud)!=null&&v.trim())if(Dt(t.customPowerPlatformCloud))ot.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let i=ua(n,t.environmentId,t.customPowerPlatformCloud),a={Published:()=>new ar({host:i,schema:r}),Prebuilt:()=>new sr({host:i,schema:r})}[o]().getConversationUrl(e);return ot.debug(`Generated Copilot Studio connection URL: ${a}`),a}function So(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&&Dt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&Dt(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&&Dt(n)){if(Io(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(Io(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Dt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function ca(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 ua(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=da(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 da(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function Io(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 Tt=Ut(Yn());var qr=class{constructor(e){this.activity=e}};var ls=Ut(Mt());var us="1.4.0-beta.7.g541749904d";var Fr={};var G=(0,ls.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,C,O,v;G.debug(`>>> SEND TO ${e}`);let o=new Map,i=go({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=Tt.Activity.fromJson(S),R=(s=P.entities)==null?void 0:s.find(V=>V.type==="streaminfo"&&V.streamType==="streaming");switch(P.type){case Tt.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 Tt.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:(C=P.channelData)==null?void 0:C.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,Oe)=>Y.sequence-Oe.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/${us}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Fr.platform()}-${Fr.arch()}/${Fr.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=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 qr(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=Tt.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=So;var ds=ve;var M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));function fs(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()}var Xn,Nd=new Uint8Array(16);function Qn(){if(!Xn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xn=crypto.getRandomValues.bind(crypto)}return Xn(Nd)}var Md=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),eo={randomUUID:Md};function Dd(t,e,r){var o,i,s;if(eo.randomUUID&&!e&&!t)return eo.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:Qn();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 fs(n)}var to=Dd;var As=Ut(Yn());var ro=function(t,e){return ro=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])},ro(t,e)};function Ae(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ro(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 St(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 At(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 Vr(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 $r=Vr(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
5
+ `&&n++}}return[e,r]}var xo="connecting",Hs="open",tn="closed",ir=()=>{};function Ws(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=ir,onConnect:i=ir,onDisconnect:s=ir,onScheduleReconnect:a=ir}=r,{fetch:d,url:l,initialLastEventId:f}=Bs(r),h={...r.headers},C=[],T=n?[n]:[],P=U=>T.forEach(se=>se(U)),v=_o({onEvent:Us,onRetry:Ns,onComment:o}),b,_=l.toString(),O=new AbortController,E=f,N=2e3,ie,H=tn;return Y(),{close:Pe,connect:Y,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Yr,get lastEventId(){return E},get url(){return _},get readyState(){return H}};function Y(){b||(H=xo,O=new AbortController,b=d(l,Ms()).then(Rs).catch(U=>{b=null,!(U.name==="AbortError"||U.type==="aborted"||O.signal.aborted)&&yo()}))}function Pe(){H=tn,O.abort(),v.reset(),clearTimeout(ie),C.forEach(U=>U())}function Yr(){let U=[],se=[];function Zt(){return new Promise(W=>{let ae=se.shift();ae?W({value:ae,done:!1}):U.push(W)})}let tt=function(W){let ae=U.shift();ae?ae({value:W,done:!1}):se.push(W)};function Oe(){for(T.splice(T.indexOf(tt),1);U.shift(););for(;se.shift(););}function kt(){let W=U.shift();W&&(W({done:!0,value:void 0}),Oe())}return C.push(kt),T.push(tt),{next(){return H===tn?this.return():Zt()},return(){return Oe(),Promise.resolve({done:!0,value:void 0})},throw(W){return Oe(),Promise.reject(W)},[Symbol.asyncIterator](){return this}}}function yo(){a({delay:N}),!O.signal.aborted&&(H=xo,ie=setTimeout(Y,N))}async function Rs(U){i(),v.reset();let{body:se,redirected:Zt,status:tt}=U;if(tt===204){s(),Pe();return}if(!se)throw new Error("Missing response body");Zt&&(_=U.url);let Oe=e(se),kt=new TextDecoder,W=Oe.getReader(),ae=!0;H=Hs;do{let{done:vo,value:go}=await W.read();go&&v.feed(kt.decode(go,{stream:!vo})),vo&&(ae=!1,b=null,v.reset(),yo(),s())}while(ae)}function Us(U){typeof U.id=="string"&&(E=U.id),P(U)}function Ns(U){N=U}function Ms(){let{mode:U,credentials:se,body:Zt,method:tt,redirect:Oe,referrer:kt,referrerPolicy:W}=r,ae={Accept:"text/event-stream",...h,...E?{"Last-Event-ID":E}:void 0};return{mode:U,credentials:se,body:Zt,method:tt,redirect:Oe,referrer:kt,referrerPolicy:W,headers:ae,cache:"no-store",signal:O.signal}}}function Bs(t){let e=t.fetch||globalThis.fetch;if(!Gs(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 Gs(t){return typeof t=="function"}var Ks={getStream:Js};function rn(t){return Ws(t,Ks)}function Js(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var Po=Rt(Mt());var ur=class{constructor(e){this.API_VERSION="2022-03-01-preview";let r="schema"in e?e.schema:e.identifier,n=e.host;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var dr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var it=(0,Po.debug)("copilot-studio:power-platform");function Lt(t,e){var d,l,f,h,C,T,P,v;let r=((d=t.schemaName)==null?void 0:d.trim())||((l=t.agentIdentifier)==null?void 0:l.trim());if(!((f=t.directConnectUrl)!=null&&f.trim())&&(!((h=t.environmentId)!=null&&h.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((C=t.directConnectUrl)!=null&&C.trim()){if(it.debug(`Using direct connection: ${t.directConnectUrl}`),!Dt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return pa(t.directConnectUrl,e).href}let n=(T=t.cloud)!=null?T:"Prod",o=(P=t.copilotAgentType)!=null?P:"Published";if(it.debug(`Using cloud setting: ${n}`),it.debug(`Using agent type: ${o}`),n==="Other")if((v=t.customPowerPlatformCloud)!=null&&v.trim())if(Dt(t.customPowerPlatformCloud))it.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let i=ma(n,t.environmentId,t.customPowerPlatformCloud),a={Published:()=>new dr({host:i,schema:r}),Prebuilt:()=>new ur({host:i,schema:r})}[o]().getConversationUrl(e);return it.debug(`Generated Copilot Studio connection URL: ${a}`),a}function Oo(t,e){if(!e||!e.trim())throw new Error("conversationId is required for subscribe URL");let r=Lt(t,e),n=new URL(r);n.pathname=n.pathname.endsWith("/")?`${n.pathname}subscribe`:`${n.pathname}/subscribe`;let o=n.href;return it.debug(`Generated Copilot Studio subscribe URL: ${o}`),o}function Eo(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&&Dt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&Dt(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://${lr(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&Dt(n)){if(Ao(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://${lr(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${lr(Ao(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Dt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function pa(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 ma(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=ha(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${lr(t,r)}`)}function lr(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 ha(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function Ao(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 Qe=Rt(to());var er=class{constructor(e,r){this.activity=e,this.conversationId=r}};var ys=Rt(Mt());var $r="1.4.2";var Vr={};var tr=class{static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${$r}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Vr.platform()}-${Vr.arch()}/${Vr.release()}`,r}static getVersionString(){return`CopilotStudioClient.agents-sdk-js/${$r}`}static getVersion(){return $r}};var Hr=class{static getScopeFromSettings(e){return Eo(e)}};function ps(t,e){return{activities:t,conversationId:e,isNewConversation:!0}}function ms(t,e){return{activities:t,conversationId:e,activityCount:t.length}}var M=(0,ys.debug)("copilot-studio:client"),Se=class Se{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}logDiagnostic(e,...r){this.settings.enableDiagnostics&&M.info(`[DIAGNOSTICS] ${e}`,...r)}async*postRequestAsync(e,r,n="POST"){var s,a,d,l,f,h,C,T,P,v;this.logDiagnostic(`Request URL: ${e}`),this.logDiagnostic(`Request Method: ${n}`),this.logDiagnostic("Request Body:",r?JSON.stringify(r,null,2):"none"),M.debug(`>>> SEND TO ${e}`);let o=new Map,i=rn({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":tr.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(b,_)=>{let O=await fetch(b,_);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:b,event:_}of i){if(b&&_==="activity")try{let O=Qe.Activity.fromJson(b),E=(s=O.entities)==null?void 0:s.find(N=>N.type==="streaminfo"&&N.streamType==="streaming");switch(O.type){case Qe.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(d=(a=O.conversation)==null?void 0:a.id)!=null?d:"",M.debug(`Conversation ID: ${this.conversationId}`)),yield O;break;case Qe.ActivityTypes.Typing:if(M.debug(`Activity type: ${O.type}`),E||((l=O.channelData)==null?void 0:l.streamType)==="streaming"){let N=(f=O.text)!=null?f:"",ie=(C=E==null?void 0:E.streamId)!=null?C:(h=O.channelData)==null?void 0:h.streamId,H=(P=E==null?void 0:E.streamSequence)!=null?P:(T=O.channelData)==null?void 0:T.streamSequence;if(ie&&H){if(o.has(ie)){let Y=o.get(ie);Y.push({text:N,sequence:H}),o.set(ie,Y)}else o.set(ie,[{text:N,sequence:H}]);O.text=((v=o.get(ie))==null?void 0:v.sort((Y,Pe)=>Y.sequence-Pe.sequence).map(Y=>Y.text).join(""))||""}}yield O;break;default:M.debug(`Activity type: ${O.type}`),yield O;break}}catch(O){M.error("Failed to parse activity:",O)}else if(_==="end"){M.debug("Stream complete");break}if(i.readyState==="closed"){M.debug("Connection closed");break}}}finally{i.close()}}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(Se.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,M.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(Se.conversationIdHeaderKey))!=null?o:"",this.conversationId&&M.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==Se.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),this.logDiagnostic("Response Headers:",r)}async*startConversationStreaming(e){var i;let r;typeof e=="boolean"||e===void 0?r={emitStartConversationEvent:e!=null?e:!0}:r=e;let n=Lt(this.settings,r.conversationId),o={emitStartConversationEvent:(i=r.emitStartConversationEvent)!=null?i:!0};r.locale&&(o.locale=r.locale),M.info("Starting conversation ...",r),this.logDiagnostic("Start conversation request:",o),yield*this.postRequestAsync(n,o,"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=Lt(this.settings,n),i=new er(e);M.info("Sending activity...",e),yield*this.postRequestAsync(o,i,"POST")}async*executeStreaming(e,r){if(!r||!r.trim())throw new Error("conversationId is required for executeStreaming");let n=Lt(this.settings,r),o=new er(e,r);M.info("Executing turn with conversation ID:",r),this.logDiagnostic("Execute turn request:",{conversationId:r,activityType:e.type,activityText:e.text}),yield*this.postRequestAsync(n,o,"POST")}async execute(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return n}async startConversationAsync(e){let r=[];for await(let n of this.startConversationStreaming(e))r.push(n);return r}async askQuestionAsync(e,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:e,conversation:o},s=Qe.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}async startConversationWithResponse(e){var o;let r=[],n="";for await(let i of this.startConversationStreaming(e))r.push(i),(o=i.conversation)!=null&&o.id&&(n=i.conversation.id);return n=n||this.conversationId,ps(r,n)}async executeWithResponse(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return ms(n,r)}async*subscribeAsync(e,r){if(!e||!e.trim())throw new Error("conversationId is required for subscribeAsync");let n=Oo(this.settings,e);M.info("Subscribing to conversation:",e),this.logDiagnostic("Subscribe request:",{conversationId:e,lastReceivedEventId:r,url:n});let o=rn({url:n,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":tr.getProductInfo(),Accept:"text/event-stream",...r&&{"Last-Event-ID":r}},method:"GET",fetch:async(i,s)=>{let a=await fetch(i,s);return this.processResponseHeaders(a.headers),a}});try{for await(let{data:i,event:s,id:a}of o){if(i&&s==="activity")try{let d=Qe.Activity.fromJson(i),l={activity:d,eventId:a};M.debug(`Received activity via subscription, event ID: ${a}`),this.logDiagnostic("Subscribe event received:",{eventId:a,activityType:d.type}),yield l}catch(d){M.error("Failed to parse activity in subscription:",d)}else if(s==="end"){M.debug("Subscription stream complete");break}if(o.readyState==="closed"){M.debug("Subscription connection closed");break}}}finally{o.close()}}};Se.conversationIdHeaderKey="x-ms-conversationid",Se.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",Se.scopeFromSettings=Hr.getScopeFromSettings;var hs=Se;var L=[];for(let t=0;t<256;++t)L.push((t+256).toString(16).slice(1));function vs(t,e=0){return(L[t[e+0]]+L[t[e+1]]+L[t[e+2]]+L[t[e+3]]+"-"+L[t[e+4]]+L[t[e+5]]+"-"+L[t[e+6]]+L[t[e+7]]+"-"+L[t[e+8]]+L[t[e+9]]+"-"+L[t[e+10]]+L[t[e+11]]+L[t[e+12]]+L[t[e+13]]+L[t[e+14]]+L[t[e+15]]).toLowerCase()}var ro,qd=new Uint8Array(16);function no(){if(!ro){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ro=crypto.getRandomValues.bind(crypto)}return ro(qd)}var Fd=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),oo={randomUUID:Fd};function $d(t,e,r){var o,i,s;if(oo.randomUUID&&!e&&!t)return oo.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:no();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 vs(n)}var io=$d;var Zs=Rt(to());var so=function(t,e){return so=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])},so(t,e)};function Ae(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");so(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function rr(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 St(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 At(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 Wr(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 Br=Wr(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 Ot=(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(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 $r?v.errors:[v]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var g=Qt(m),C=g.next();!C.done;C=g.next()){var O=C.value;try{ps(O)}catch(v){i=i!=null?i:[],v instanceof $r?i=At(At([],St(i)),St(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{C&&!C.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}}if(i)throw new $r(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)ps(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 no=Ot.EMPTY;function Hr(t){return t instanceof Ot||t&&"closed"in t&&te(t.remove)&&te(t.add)&&te(t.unsubscribe)}function ps(t){te(t)?t():t.unsubscribe()}var oe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Pt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Pt.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,At([t,e],St(r))):setTimeout.apply(void 0,At([t,e],St(r)))},clearTimeout:function(t){var e=Pt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function hs(t){Pt.setTimeout(function(){var e=oe.onUnhandledError;if(e)e(t);else throw t})}function oo(){}var ms=(function(){return io("C",void 0,void 0)})();function ys(t){return io("E",void 0,t)}function vs(t){return io("N",t,void 0)}function io(t,e,r){return{kind:t,value:e,error:r}}var Qe=null;function Et(t){if(oe.useDeprecatedSynchronousErrorHandling){var e=!Qe;if(e&&(Qe={errorThrown:!1,error:null}),t(),e){var r=Qe,n=r.errorThrown,o=r.error;if(Qe=null,n)throw o}}else t()}function gs(t){oe.useDeprecatedSynchronousErrorHandling&&Qe&&(Qe.errorThrown=!0,Qe.error=t)}var co=(function(t){Ae(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Hr(r)&&r.add(n)):n.destination=Fd,n}return e.create=function(r,n,o){return new Br(r,n,o)},e.prototype.next=function(r){this.isStopped?ao(vs(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?ao(ys(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?ao(ms,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})(Ot);var Ld=Function.prototype.bind;function so(t,e){return Ld.call(t,e)}var zd=(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){Wr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Wr(n)}else Wr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Wr(r)}},t})(),Br=(function(t){Ae(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&&so(r.next,a),error:r.error&&so(r.error,a),complete:r.complete&&so(r.complete,a)}):s=r}return i.destination=new zd(s),i}return e})(co);function Wr(t){oe.useDeprecatedSynchronousErrorHandling?gs(t):hs(t)}function qd(t){throw t}function ao(t,e){var r=oe.onStoppedNotification;r&&Pt.setTimeout(function(){return r(t,e)})}var Fd={closed:!0,next:oo,error:qd,complete:oo};var _s=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function bs(t){return t}function xs(t){return t.length===0?bs:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var jt=(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=$d(e)?e:new Br(e,r,n);return Et(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=ws(r),new r(function(o,i){var s=new Br({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[_s]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xs(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=ws(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 ws(t){var e;return(e=t!=null?t:oe.Promise)!==null&&e!==void 0?e:Promise}function Vd(t){return t&&te(t.next)&&te(t.error)&&te(t.complete)}function $d(t){return t&&t instanceof co||Vd(t)&&Hr(t)}var Cs=Vr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var uo=(function(t){Ae(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 Is(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Cs},e.prototype.next=function(r){var n=this;Et(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;Et(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;Et(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?no:(this.currentObservers=null,a.push(r),new Ot(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 jt;return r.source=this,r},e.create=function(r,n){return new Is(r,n)},e})(jt);var Is=(function(t){Ae(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:no},e})(uo);var lo=(function(t){Ae(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})(uo);var Os=Ut(Mt()),ge=(0,Os.debug)("copilot-studio:webchat");function Hd(t){let e=!1;return r=>{if(!e)return e=!0,t(r)}}var Ts=class{static createConnection(e,r){ge.info("--> Creating connection between Copilot Studio and WebChat ...");let n=0,o,i,s=new lo(0),a=Ss(async f=>{o=f;let m=Hd(async()=>{s.next(2),await Promise.resolve()});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);await m()}}),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 Ss(async m=>{try{ge.info("--> Sending activity to Copilot Studio ...");let g=As.Activity.fromObject({...f,id:to(),attachments:await Wd(f)});d(g),l(),m.next(g.id);for await(let C of e.sendActivityStreaming(g))d(C),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 Wd(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 Bd(n);e.push(o)}return e}async function Bd(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=Kd(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 Kd(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 Ss(t){return new jt(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}export{Rt as AgentType,Gr as ConnectionSettings,ds as CopilotStudioClient,Ts as CopilotStudioWebChat,qr as ExecuteTurnRequest,Nt as PowerPlatformCloud,ur as getCopilotStudioConnectionUrl,So as getTokenAudience,el as loadCopilotStudioConnectionSettingsFromEnv};
7
+ `):"",this.name="UnsubscriptionError",this.errors=r}});function nr(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=rr(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 Br?v.errors:[v]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var C=rr(h),T=C.next();!T.done;T=C.next()){var P=T.value;try{gs(P)}catch(v){i=i!=null?i:[],v instanceof Br?i=At(At([],St(i)),St(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{T&&!T.done&&(o=C.return)&&o.call(C)}finally{if(n)throw n.error}}}if(i)throw new Br(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)gs(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)&&nr(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&nr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var ao=Pt.EMPTY;function Gr(t){return t instanceof Pt||t&&"closed"in t&&te(t.remove)&&te(t.add)&&te(t.unsubscribe)}function gs(t){te(t)?t():t.unsubscribe()}var oe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Ot={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ot.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,At([t,e],St(r))):setTimeout.apply(void 0,At([t,e],St(r)))},clearTimeout:function(t){var e=Ot.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function bs(t){Ot.setTimeout(function(){var e=oe.onUnhandledError;if(e)e(t);else throw t})}function co(){}var _s=(function(){return uo("C",void 0,void 0)})();function xs(t){return uo("E",void 0,t)}function ws(t){return uo("N",t,void 0)}function uo(t,e,r){return{kind:t,value:e,error:r}}var et=null;function Et(t){if(oe.useDeprecatedSynchronousErrorHandling){var e=!et;if(e&&(et={errorThrown:!1,error:null}),t(),e){var r=et,n=r.errorThrown,o=r.error;if(et=null,n)throw o}}else t()}function Cs(t){oe.useDeprecatedSynchronousErrorHandling&&et&&(et.errorThrown=!0,et.error=t)}var po=(function(t){Ae(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Gr(r)&&r.add(n)):n.destination=Bd,n}return e.create=function(r,n,o){return new Jr(r,n,o)},e.prototype.next=function(r){this.isStopped?fo(ws(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?fo(xs(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?fo(_s,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 Vd=Function.prototype.bind;function lo(t,e){return Vd.call(t,e)}var Hd=(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){Kr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Kr(n)}else Kr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Kr(r)}},t})(),Jr=(function(t){Ae(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&&lo(r.next,a),error:r.error&&lo(r.error,a),complete:r.complete&&lo(r.complete,a)}):s=r}return i.destination=new Hd(s),i}return e})(po);function Kr(t){oe.useDeprecatedSynchronousErrorHandling?Cs(t):bs(t)}function Wd(t){throw t}function fo(t,e){var r=oe.onStoppedNotification;r&&Ot.setTimeout(function(){return r(t,e)})}var Bd={closed:!0,next:co,error:Wd,complete:co};var Is=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Ts(t){return t}function Ss(t){return t.length===0?Ts:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var jt=(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=Kd(e)?e:new Jr(e,r,n);return Et(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=As(r),new r(function(o,i){var s=new Jr({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[Is]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Ss(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=As(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 As(t){var e;return(e=t!=null?t:oe.Promise)!==null&&e!==void 0?e:Promise}function Gd(t){return t&&te(t.next)&&te(t.error)&&te(t.complete)}function Kd(t){return t&&t instanceof po||Gd(t)&&Gr(t)}var Ps=Wr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var mo=(function(t){Ae(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 Os(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Ps},e.prototype.next=function(r){var n=this;Et(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=rr(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;Et(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;Et(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?ao:(this.currentObservers=null,a.push(r),new Pt(function(){n.currentObservers=null,nr(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 jt;return r.source=this,r},e.create=function(r,n){return new Os(r,n)},e})(jt);var Os=(function(t){Ae(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:ao},e})(mo);var ho=(function(t){Ae(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})(mo);var ks=Rt(Mt()),ve=(0,ks.debug)("copilot-studio:webchat");function Jd(t){let e=!1;return r=>{if(!e)return e=!0,t(r)}}var Es=class{static createConnection(e,r){var v;ve.info("--> Creating connection between Copilot Studio and WebChat ...");let n=r!=null&&r.conversationId&&r.conversationId.trim()!==""?r.conversationId.trim():void 0,o=(v=r==null?void 0:r.startConversation)!=null?v:!n,i=0,s,a,d=n,l=!1,f=!1,h=new ho(0),C=js(async b=>{var O;s=b;let _=Jd(async()=>{h.next(2),await Promise.resolve()});if(!o||f){await _();return}f=!0,ve.debug("--> Connection established."),P();for await(let E of e.startConversationStreaming())delete E.replyToId,!a&&E.conversation&&(a=E.conversation),(O=E.conversation)!=null&&O.id&&(d=E.conversation.id),await _(),T(E);await _()}),T=b=>{let _={...b,timestamp:new Date().toISOString(),channelData:{...b.channelData,"webchat:sequence-id":i}};i++,ve.debug(`Notify '${_.type}' activity to WebChat:`,_),s==null||s.next(_)},P=()=>{if(!(r!=null&&r.showTyping))return;let b=a?{id:a.id,name:a.name}:{id:"agent",name:"Agent"};T({type:"typing",from:b})};return{connectionStatus$:h,activity$:C,get conversationId(){return d},postActivity(b){if(ve.info("--> Preparing to send activity to Copilot Studio ..."),!b)throw new Error("Activity cannot be null.");if(l)throw new Error("Connection has been ended.");if(!s)throw new Error("Activity subscriber is not initialized.");return js(async _=>{var O;try{ve.info("--> Sending activity to Copilot Studio ...");let E=Zs.Activity.fromObject({...b,id:io(),attachments:await Yd(b)});T(E),P(),_.next(E.id);for await(let N of e.sendActivityStreaming(E,d))!d&&((O=N.conversation)!=null&&O.id)&&(d=N.conversation.id),T(N),ve.info("<-- Activity received correctly from Copilot Studio.");_.complete()}catch(E){ve.error("Error sending Activity to Copilot Studio:",E),_.error(E)}})},end(){ve.info("--> Ending connection between Copilot Studio and WebChat ..."),l=!0,h.complete(),s&&(s.complete(),s=void 0)}}}};async function Yd(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 Xd(n);e.push(o)}return e}async function Xd(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,ve.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 js(t){return new jt(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}function ym(t=!0,e,r){return{emitStartConversationEvent:t,locale:e,conversationId:r}}export{Ut as AgentType,Qr as ConnectionSettings,hs as CopilotStudioClient,Es as CopilotStudioWebChat,er as ExecuteTurnRequest,Nt as PowerPlatformCloud,Hr as ScopeHelper,tr as UserAgentHelper,ms as createExecuteTurnResponse,ym as createStartRequest,ps as createStartResponse,Lt as getCopilotStudioConnectionUrl,Oo as getCopilotStudioSubscribeUrl,Eo as getTokenAudience,il as loadCopilotStudioConnectionSettingsFromEnv};
8
8
  //# sourceMappingURL=browser.mjs.map