@bymos/agentkit-sdk 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agentkit-widget.iife.js +162 -14
- package/agentkit-widget.js +2555 -2183
- package/index.cjs +162 -14
- package/index.js +1832 -1460
- package/package.json +1 -1
package/agentkit-widget.iife.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"Module"});var A;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function r(a){throw new Error}e.assertNever=r,e.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(const s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(A||(A={}));var lr;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(lr||(lr={}));var v=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fe=e=>{switch(typeof e){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(e)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(e)?v.array:e===null?v.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?v.promise:typeof Map<"u"&&e instanceof Map?v.map:typeof Set<"u"&&e instanceof Set?v.set:typeof Date<"u"&&e instanceof Date?v.date:v.object;default:return v.unknown}},p=A.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"]),te=class Gn extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(i){return i.message},n={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,l=0;for(;l<s.path.length;){const c=s.path[l];l!==s.path.length-1?o[c]=o[c]||{_errors:[]}:(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(s))),o=o[c],l++}}};return a(this),n}static assert(t){if(!(t instanceof Gn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];r[i]=r[i]||[],r[i].push(t(a))}else n.push(t(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};te.create=e=>new te(e);var Ae=(e,t)=>{let r;switch(e.code){case p.invalid_type:e.received===v.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case p.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,A.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:r=`Unrecognized key(s) in object: ${A.joinValues(e.keys,", ")}`;break;case p.invalid_union:r="Invalid input";break;case p.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${A.joinValues(e.options)}`;break;case p.invalid_enum_value:r=`Invalid enum value. Expected ${A.joinValues(e.options)}, received '${e.received}'`;break;case p.invalid_arguments:r="Invalid function arguments";break;case p.invalid_return_type:r="Invalid function return type";break;case p.invalid_date:r="Invalid date";break;case p.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:A.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case p.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case p.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case p.custom:r="Invalid input";break;case p.invalid_intersection_types:r="Intersection results could not be merged";break;case p.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case p.not_finite:r="Number must be finite";break;default:r=t.defaultError,A.assertNever(e)}return{message:r}},qn=Ae;function bt(){return qn}var xt=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)o=c(s,{data:t,defaultError:o}).message;return{...a,path:i,message:o}};function g(e,t){const r=bt(),n=xt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ae?void 0:Ae].filter(a=>!!a)});e.common.issues.push(n)}var U=class Yn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const a of r){if(a.status==="aborted")return w;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const a of r){const i=await a.key,s=await a.value;n.push({key:i,value:s})}return Yn.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const a of r){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return w;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},w=Object.freeze({status:"aborted"}),Re=e=>({status:"dirty",value:e}),D=e=>({status:"valid",value:e}),dr=e=>e.status==="aborted",ur=e=>e.status==="dirty",ye=e=>e.status==="valid",Be=e=>typeof Promise<"u"&&e instanceof Promise,b;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(b||(b={}));var re=class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}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}},fr=(e,t)=>{if(ye(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){return this._error?this._error:(this._error=new te(e.common.issues),this._error)}}};function I(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,o)=>{const{message:l}=e;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??r??o.defaultError}},description:a}}var T=class{get description(){return this._def.description}_getType(e){return fe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new U,ctx:{common:e.parent.common,data:e.data,parsedType:fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Be(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)};return fr(r,this._parseSync({data:e,path:r.path,parent:r}))}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return ye(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>ye(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)},n=this._parse({data:e,path:r.path,parent:r});return fr(r,await(Be(n)?n:Promise.resolve(n)))}refine(e,t){const r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),s=()=>a.addIssue({code:p.custom,...r(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(o=>o?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new se({schema:this,typeName:S.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:t=>this["~validate"](t)}}optional(){return oe.create(this,this._def)}nullable(){return _e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return be.create(this)}promise(){return Ee.create(this,this._def)}or(e){return Xe.create([this,e],this._def)}and(e){return Je.create(this,e,this._def)}transform(e){return new se({...I(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new tt({...I(this._def),innerType:this,defaultValue:t,typeName:S.ZodDefault})}brand(){return new gr({typeName:S.ZodBranded,type:this,...I(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new rt({...I(this._def),innerType:this,catchValue:t,typeName:S.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return _r.create(this,e)}readonly(){return nt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ea=/^c[^\s-]{8,}$/i,ta=/^[0-9a-z]+$/,ra=/^[0-9A-HJKMNP-TV-Z]{26}$/i,na=/^[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,aa=/^[a-z0-9_-]{21}$/i,ia=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ca="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wt,la=/^(?:(?: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])$/,da=/^(?:(?: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])$/,ua=/^(([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]))$/,fa=/^(([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}=))?$/,ma=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hr="((\\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])))",pa=new RegExp(`^${hr}$`);function mr(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function ga(e){return new RegExp(`^${mr(e)}$`)}function _a(e){let t=`${hr}T${mr(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function va(e,t){return!!((t==="v4"||!t)&&la.test(e)||(t==="v6"||!t)&&ua.test(e))}function ya(e,t){if(!ia.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function ka(e,t){return!!((t==="v4"||!t)&&da.test(e)||(t==="v6"||!t)&&fa.test(e))}var He=class Ue extends T{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==v.string){const a=this._getOrReturnCtx(t);return g(a,{code:p.invalid_type,expected:v.string,received:a.parsedType}),w}const r=new U;let n;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")t.data.length>a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=t.data.length>a.value,s=t.data.length<a.value;(i||s)&&(n=this._getOrReturnCtx(t,n),i?g(n,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&g(n,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")oa.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"email",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")wt||(wt=new RegExp(ca,"u")),wt.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"emoji",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")na.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"uuid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")aa.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"nanoid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")ea.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cuid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")ta.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cuid2",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")ra.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"ulid",code:p.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),g(n,{validation:"url",code:p.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"regex",code:p.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?_a(a).test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?pa.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?ga(a).test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:p.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?sa.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"duration",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?va(t.data,a.version)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"ip",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?ya(t.data,a.alg)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"jwt",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?ka(t.data,a.version)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"cidr",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?ha.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"base64",code:p.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?ma.test(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{validation:"base64url",code:p.invalid_string,message:a.message}),r.dirty()):A.assertNever(a);return{status:r.value,value:t.data}}_regex(t,r,n){return this.refinement(a=>t.test(a),{validation:r,code:p.invalid_string,...b.errToObj(n)})}_addCheck(t){return new Ue({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...b.errToObj(t)})}url(t){return this._addCheck({kind:"url",...b.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...b.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...b.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...b.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...b.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...b.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...b.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...b.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...b.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...b.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...b.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...b.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...b.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...b.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...b.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...b.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...b.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...b.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...b.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...b.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...b.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...b.errToObj(r)})}nonempty(t){return this.min(1,b.errToObj(t))}trim(){return new Ue({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ue({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ue({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};He.create=e=>new He({checks:[],typeName:S.ZodString,coerce:e?.coerce??!1,...I(e)});function ba(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}var St=class ar extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==v.number){const a=this._getOrReturnCtx(t);return g(a,{code:p.invalid_type,expected:v.number,received:a.parsedType}),w}let r;const n=new U;for(const a of this._def.checks)a.kind==="int"?A.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),g(r,{code:p.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:p.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:p.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?ba(t.data,a.value)!==0&&(r=this._getOrReturnCtx(t,r),g(r,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),g(r,{code:p.not_finite,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,b.toString(r))}gt(t,r){return this.setLimit("min",t,!1,b.toString(r))}lte(t,r){return this.setLimit("max",t,!0,b.toString(r))}lt(t,r){return this.setLimit("max",t,!1,b.toString(r))}setLimit(t,r,n,a){return new ar({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:b.toString(a)}]})}_addCheck(t){return new ar({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:b.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:b.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:b.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&A.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};St.create=e=>new St({checks:[],typeName:S.ZodNumber,coerce:e?.coerce||!1,...I(e)});var Ct=class ir extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==v.bigint)return this._getInvalidInput(t);let r;const n=new U;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:p.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),g(r,{code:p.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),g(r,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return g(r,{code:p.invalid_type,expected:v.bigint,received:r.parsedType}),w}gte(t,r){return this.setLimit("min",t,!0,b.toString(r))}gt(t,r){return this.setLimit("min",t,!1,b.toString(r))}lte(t,r){return this.setLimit("max",t,!0,b.toString(r))}lt(t,r){return this.setLimit("max",t,!1,b.toString(r))}setLimit(t,r,n,a){return new ir({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:b.toString(a)}]})}_addCheck(t){return new ir({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:b.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ct.create=e=>new Ct({checks:[],typeName:S.ZodBigInt,coerce:e?.coerce??!1,...I(e)});var It=class extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.boolean,received:t.parsedType}),w}return D(e.data)}};It.create=e=>new It({typeName:S.ZodBoolean,coerce:e?.coerce||!1,...I(e)});var Nt=class Xn extends T{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==v.date){const a=this._getOrReturnCtx(t);return g(a,{code:p.invalid_type,expected:v.date,received:a.parsedType}),w}if(Number.isNaN(t.data.getTime()))return g(this._getOrReturnCtx(t),{code:p.invalid_date}),w;const r=new U;let n;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:p.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(n=this._getOrReturnCtx(t,n),g(n,{code:p.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):A.assertNever(a);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Xn({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:b.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:b.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Nt.create=e=>new Nt({checks:[],coerce:e?.coerce||!1,typeName:S.ZodDate,...I(e)});var Tt=class extends T{_parse(e){if(this._getType(e)!==v.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.symbol,received:t.parsedType}),w}return D(e.data)}};Tt.create=e=>new Tt({typeName:S.ZodSymbol,...I(e)});var Ge=class extends T{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.undefined,received:t.parsedType}),w}return D(e.data)}};Ge.create=e=>new Ge({typeName:S.ZodUndefined,...I(e)});var Ye=class extends T{_parse(e){if(this._getType(e)!==v.null){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.null,received:t.parsedType}),w}return D(e.data)}};Ye.create=e=>new Ye({typeName:S.ZodNull,...I(e)});var Lt=class extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return D(e.data)}};Lt.create=e=>new Lt({typeName:S.ZodAny,...I(e)});var ke=class extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return D(e.data)}};ke.create=e=>new ke({typeName:S.ZodUnknown,...I(e)});var he=class extends T{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.never,received:t.parsedType}),w}};he.create=e=>new he({typeName:S.ZodNever,...I(e)});var At=class extends T{_parse(e){if(this._getType(e)!==v.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.void,received:t.parsedType}),w}return D(e.data)}};At.create=e=>new At({typeName:S.ZodVoid,...I(e)});var be=class vt extends T{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==v.array)return g(r,{code:p.invalid_type,expected:v.array,received:r.parsedType}),w;if(a.exactLength!==null){const s=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(s||o)&&(g(r,{code:s?p.too_big:p.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(g(r,{code:p.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(g(r,{code:p.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,o)=>a.type._parseAsync(new re(r,s,r.path,o)))).then(s=>U.mergeArray(n,s));const i=[...r.data].map((s,o)=>a.type._parseSync(new re(r,s,r.path,o)));return U.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new vt({...this._def,minLength:{value:t,message:b.toString(r)}})}max(t,r){return new vt({...this._def,maxLength:{value:t,message:b.toString(r)}})}length(t,r){return new vt({...this._def,exactLength:{value:t,message:b.toString(r)}})}nonempty(t){return this.min(1,t)}};be.create=(e,t)=>new be({type:e,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...I(t)});function xe(e){if(e instanceof J){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=oe.create(xe(n))}return new J({...e._def,shape:()=>t})}else return e instanceof be?new be({...e._def,type:xe(e.element)}):e instanceof oe?oe.create(xe(e.unwrap())):e instanceof _e?_e.create(xe(e.unwrap())):e instanceof ge?ge.create(e.items.map(t=>xe(t))):e}var J=class ee extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape();return this._cached={shape:t,keys:A.objectKeys(t)},this._cached}_parse(t){if(this._getType(t)!==v.object){const l=this._getOrReturnCtx(t);return g(l,{code:p.invalid_type,expected:v.object,received:l.parsedType}),w}const{status:r,ctx:n}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||s.push(l);const o=[];for(const l of i){const c=a[l],f=n.data[l];o.push({key:{status:"valid",value:l},value:c._parse(new re(n,f,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof he){const l=this._def.unknownKeys;if(l==="passthrough")for(const c of s)o.push({key:{status:"valid",value:c},value:{status:"valid",value:n.data[c]}});else if(l==="strict")s.length>0&&(g(n,{code:p.unrecognized_keys,keys:s}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const c of s){const f=n.data[c];o.push({key:{status:"valid",value:c},value:l._parse(new re(n,f,n.path,c)),alwaysSet:c in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const c of o){const f=await c.key,d=await c.value;l.push({key:f,value:d,alwaysSet:c.alwaysSet})}return l}).then(l=>U.mergeObjectSync(r,l)):U.mergeObjectSync(r,o)}get shape(){return this._def.shape()}strict(t){return b.errToObj,new ee({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{const a=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:b.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new ee({...this._def,unknownKeys:"strip"})}passthrough(){return new ee({...this._def,unknownKeys:"passthrough"})}extend(t){return new ee({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ee({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:S.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new ee({...this._def,catchall:t})}pick(t){const r={};for(const n of A.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new ee({...this._def,shape:()=>r})}omit(t){const r={};for(const n of A.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new ee({...this._def,shape:()=>r})}deepPartial(){return xe(this)}partial(t){const r={};for(const n of A.objectKeys(this.shape)){const a=this.shape[n];t&&!t[n]?r[n]=a:r[n]=a.optional()}return new ee({...this._def,shape:()=>r})}required(t){const r={};for(const n of A.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof oe;)a=a._def.innerType;r[n]=a}return new ee({...this._def,shape:()=>r})}keyof(){return pr(A.objectKeys(this.shape))}};J.create=(e,t)=>new J({shape:()=>e,unknownKeys:"strip",catchall:he.create(),typeName:S.ZodObject,...I(t)}),J.strictCreate=(e,t)=>new J({shape:()=>e,unknownKeys:"strict",catchall:he.create(),typeName:S.ZodObject,...I(t)}),J.lazycreate=(e,t)=>new J({shape:e,unknownKeys:"strip",catchall:he.create(),typeName:S.ZodObject,...I(t)});var Xe=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(const s of a)if(s.result.status==="valid")return s.result;for(const s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const i=a.map(s=>new te(s.ctx.common.issues));return g(t,{code:p.invalid_union,unionErrors:i}),w}if(t.common.async)return Promise.all(r.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const o of r){const l={...t,common:{...t.common,issues:[]},parent:null},c=o._parseSync({data:t.data,path:t.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(o=>new te(o));return g(t,{code:p.invalid_union,unionErrors:s}),w}}get options(){return this._def.options}};Xe.create=(e,t)=>new Xe({options:e,typeName:S.ZodUnion,...I(t)});var ie=e=>e instanceof Qe?ie(e.schema):e instanceof se?ie(e.innerType()):e instanceof Ke?[e.value]:e instanceof qe?e.options:e instanceof et?A.objectValues(e.enum):e instanceof tt?ie(e._def.innerType):e instanceof Ge?[void 0]:e instanceof Ye?[null]:e instanceof oe?[void 0,...ie(e.unwrap())]:e instanceof _e?[null,...ie(e.unwrap())]:e instanceof gr||e instanceof nt?ie(e.unwrap()):e instanceof rt?ie(e._def.innerType):[],xa=class Jn extends T{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==v.object)return g(r,{code:p.invalid_type,expected:v.object,received:r.parsedType}),w;const n=this.discriminator,a=r.data[n],i=this.optionsMap.get(a);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}):(g(r,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),w)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const a=new Map;for(const i of r){const s=ie(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const o of s){if(a.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);a.set(o,i)}}return new Jn({typeName:S.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...I(n)})}};function Rt(e,t){const r=fe(e),n=fe(t);if(e===t)return{valid:!0,data:e};if(r===v.object&&n===v.object){const a=A.objectKeys(t),i=A.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s={...e,...t};for(const o of i){const l=Rt(e[o],t[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(r===v.array&&n===v.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const s=e[i],o=t[i],l=Rt(s,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return r===v.date&&n===v.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Je=class extends T{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(a,i)=>{if(dr(a)||dr(i))return w;const s=Rt(a.value,i.value);return s.valid?((ur(a)||ur(i))&&t.dirty(),{status:t.value,value:s.data}):(g(r,{code:p.invalid_intersection_types}),w)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Je.create=(e,t,r)=>new Je({left:e,right:t,typeName:S.ZodIntersection,...I(r)});var ge=class Qn extends T{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.array)return g(n,{code:p.invalid_type,expected:v.array,received:n.parsedType}),w;if(n.data.length<this._def.items.length)return g(n,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w;!this._def.rest&&n.data.length>this._def.items.length&&(g(n,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,s)=>{const o=this._def.items[s]||this._def.rest;return o?o._parse(new re(n,i,n.path,s)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>U.mergeArray(r,i)):U.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new Qn({...this._def,rest:t})}};ge.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ge({items:e,typeName:S.ZodTuple,rest:null,...I(t)})};var wa=class sr extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.object)return g(n,{code:p.invalid_type,expected:v.object,received:n.parsedType}),w;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in n.data)a.push({key:i._parse(new re(n,o,n.path,o)),value:s._parse(new re(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?U.mergeObjectAsync(r,a):U.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof T?new sr({keyType:t,valueType:r,typeName:S.ZodRecord,...I(n)}):new sr({keyType:He.create(),valueType:t,typeName:S.ZodRecord,...I(r)})}},Et=class extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==v.map)return g(r,{code:p.invalid_type,expected:v.map,received:r.parsedType}),w;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([s,o],l)=>({key:n._parse(new re(r,s,r.path,[l,"key"])),value:a._parse(new re(r,o,r.path,[l,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const o of i){const l=await o.key,c=await o.value;if(l.status==="aborted"||c.status==="aborted")return w;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),s.set(l.value,c.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const o of i){const l=o.key,c=o.value;if(l.status==="aborted"||c.status==="aborted")return w;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),s.set(l.value,c.value)}return{status:t.value,value:s}}}};Et.create=(e,t,r)=>new Et({valueType:t,keyType:e,typeName:S.ZodMap,...I(r)});var Zt=class or extends T{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==v.set)return g(n,{code:p.invalid_type,expected:v.set,received:n.parsedType}),w;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(g(n,{code:p.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(g(n,{code:p.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const f of l){if(f.status==="aborted")return w;f.status==="dirty"&&r.dirty(),c.add(f.value)}return{status:r.value,value:c}}const o=[...n.data.values()].map((l,c)=>i._parse(new re(n,l,n.path,c)));return n.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(t,r){return new or({...this._def,minSize:{value:t,message:b.toString(r)}})}max(t,r){return new or({...this._def,maxSize:{value:t,message:b.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Zt.create=(e,t)=>new Zt({valueType:e,minSize:null,maxSize:null,typeName:S.ZodSet,...I(t)});var Sa=class yt extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==v.function)return g(r,{code:p.invalid_type,expected:v.function,received:r.parsedType}),w;function n(o,l){return xt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bt(),Ae].filter(c=>!!c),issueData:{code:p.invalid_arguments,argumentsError:l}})}function a(o,l){return xt({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bt(),Ae].filter(c=>!!c),issueData:{code:p.invalid_return_type,returnTypeError:l}})}const i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ee){const o=this;return D(async function(...l){const c=new te([]),f=await o._def.args.parseAsync(l,i).catch(m=>{throw c.addIssue(n(l,m)),c}),d=await Reflect.apply(s,this,f);return await o._def.returns._def.type.parseAsync(d,i).catch(m=>{throw c.addIssue(a(d,m)),c})})}else{const o=this;return D(function(...l){const c=o._def.args.safeParse(l,i);if(!c.success)throw new te([n(l,c.error)]);const f=Reflect.apply(s,this,c.data),d=o._def.returns.safeParse(f,i);if(!d.success)throw new te([a(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new yt({...this._def,args:ge.create(t).rest(ke.create())})}returns(t){return new yt({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new yt({args:t||ge.create([]).rest(ke.create()),returns:r||ke.create(),typeName:S.ZodFunction,...I(n)})}},Qe=class extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Qe.create=(e,t)=>new Qe({getter:e,typeName:S.ZodLazy,...I(t)});var Ke=class extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return g(t,{received:t.data,code:p.invalid_literal,expected:this._def.value}),w}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(e,t)=>new Ke({value:e,typeName:S.ZodLiteral,...I(t)});function pr(e,t){return new qe({values:e,typeName:S.ZodEnum,...I(t)})}var qe=class cr extends T{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return g(r,{expected:A.joinValues(n),received:r.parsedType,code:p.invalid_type}),w}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return g(r,{received:r.data,code:p.invalid_enum_value,options:n}),w}return D(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return cr.create(t,{...this._def,...r})}exclude(t,r=this._def){return cr.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};qe.create=pr;var et=class extends T{_parse(e){const t=A.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==v.string&&r.parsedType!==v.number){const n=A.objectValues(t);return g(r,{expected:A.joinValues(n),received:r.parsedType,code:p.invalid_type}),w}if(this._cache||(this._cache=new Set(A.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=A.objectValues(t);return g(r,{received:r.data,code:p.invalid_enum_value,options:n}),w}return D(e.data)}get enum(){return this._def.values}};et.create=(e,t)=>new et({values:e,typeName:S.ZodNativeEnum,...I(t)});var Ee=class extends T{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);return t.parsedType!==v.promise&&t.common.async===!1?(g(t,{code:p.invalid_type,expected:v.promise,received:t.parsedType}),w):D((t.parsedType===v.promise?t.data:Promise.resolve(t.data)).then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ee.create=(e,t)=>new Ee({type:e,typeName:S.ZodPromise,...I(t)});var se=class extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{g(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async s=>{if(t.value==="aborted")return w;const o=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return o.status==="aborted"?w:o.status==="dirty"||t.value==="dirty"?Re(o.value):o});{if(t.value==="aborted")return w;const s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?w:s.status==="dirty"||t.value==="dirty"?Re(s.value):s}}if(n.type==="refinement"){const i=s=>{const o=n.refinement(s,a);if(r.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?w:(s.status==="dirty"&&t.dirty(),i(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?w:(s.status==="dirty"&&t.dirty(),i(s.value).then(()=>({status:t.value,value:s.value}))))}if(n.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ye(i))return w;const s=n.transform(i.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>ye(i)?Promise.resolve(n.transform(i.value,a)).then(s=>({status:t.value,value:s})):w);A.assertNever(n)}};se.create=(e,t,r)=>new se({schema:e,typeName:S.ZodEffects,effect:t,...I(r)}),se.createWithPreprocess=(e,t,r)=>new se({schema:t,effect:{type:"preprocess",transform:e},typeName:S.ZodEffects,...I(r)});var oe=class extends T{_parse(e){return this._getType(e)===v.undefined?D(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};oe.create=(e,t)=>new oe({innerType:e,typeName:S.ZodOptional,...I(t)});var _e=class extends T{_parse(e){return this._getType(e)===v.null?D(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_e.create=(e,t)=>new _e({innerType:e,typeName:S.ZodNullable,...I(t)});var tt=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===v.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};tt.create=(e,t)=>new tt({innerType:e,typeName:S.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...I(t)});var rt=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Be(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new te(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new te(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};rt.create=(e,t)=>new rt({innerType:e,typeName:S.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...I(t)});var jt=class extends T{_parse(e){if(this._getType(e)!==v.nan){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:v.nan,received:t.parsedType}),w}return{status:"valid",value:e.data}}};jt.create=e=>new jt({typeName:S.ZodNaN,...I(e)});var gr=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},_r=class Kn extends T{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?w:i.status==="dirty"?(r.dirty(),Re(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?w:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,r){return new Kn({in:t,out:r,typeName:S.ZodPipeline})}},nt=class extends T{_parse(e){const t=this._def.innerType._parse(e),r=n=>(ye(n)&&(n.value=Object.freeze(n.value)),n);return Be(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}};nt.create=(e,t)=>new nt({innerType:e,typeName:S.ZodReadonly,...I(t)});var lc={object:J.lazycreate},S;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(S||(S={}));var $=He.create,dc=St.create,uc=jt.create,fc=Ct.create,Ca=It.create,hc=Nt.create,mc=Tt.create,pc=Ge.create,gc=Ye.create,_c=Lt.create,Ia=ke.create,vc=he.create,yc=At.create,kc=be.create,Mt=J.create,bc=J.strictCreate,xc=Xe.create,wc=xa.create,Sc=Je.create,Cc=ge.create,Na=wa.create,Ic=Et.create,Nc=Zt.create,Tc=Sa.create,Lc=Qe.create,Ac=Ke.create,vr=qe.create,Rc=et.create,Ec=Ee.create,Zc=se.create,jc=oe.create,Mc=_e.create,Oc=se.createWithPreprocess,Pc=_r.create,Ta=Mt({mode:vr(["light","dark","system"]).optional(),accentColor:$().optional(),fontFamily:$().optional(),borderRadius:$().optional()}),La=Mt({externalId:$().optional(),authId:$().optional(),name:$().optional(),email:$().optional()}),yr=Mt({agentId:$().min(1,"agentId is required"),apiBaseUrl:$().url("apiBaseUrl must be a valid URL"),tenantId:$().optional(),user:La.optional(),sessionId:$().optional(),mode:vr(["floating","inline"]).optional(),title:$().optional(),subtitle:$().optional(),description:$().optional(),greeting:$().optional(),avatarUrl:$().optional(),privacyPolicyUrl:$().optional(),streaming:Ca().optional(),metadata:Na(Ia()).optional(),theme:Ta.optional()}),Aa=yr.omit({agentId:!0,apiBaseUrl:!0}).partial(),ve={mode:"floating",streaming:!0,title:"AI Assistant",theme:{mode:"light",accentColor:"#6366f1",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",borderRadius:"12px"}};function Ze(e,t){yr.parse(e);let r;const n=t?{...t}:void 0;n&&typeof n.theme=="object"&&n.theme!==null?(r=n.theme,delete n.theme):n&&typeof n.theme=="string"&&(r={mode:n.theme},delete n.theme);const a=n?Aa.passthrough().safeParse(n).data:void 0,i=a?kr(a,e):e,s={mode:i.theme?.mode??r?.mode??ve.theme.mode,accentColor:i.theme?.accentColor??r?.accentColor??ve.theme.accentColor,fontFamily:i.theme?.fontFamily??r?.fontFamily??ve.theme.fontFamily,borderRadius:i.theme?.borderRadius??r?.borderRadius??ve.theme.borderRadius};return{agentId:i.agentId,apiBaseUrl:i.apiBaseUrl.replace(/\/$/,""),tenantId:i.tenantId,user:{externalId:i.user?.externalId,authId:i.user?.authId,name:i.user?.name,email:i.user?.email},sessionId:i.sessionId,mode:i.mode??ve.mode,title:i.title??ve.title,subtitle:i.subtitle,description:i.description,greeting:i.greeting,avatarUrl:i.avatarUrl,privacyPolicyUrl:i.privacyPolicyUrl,streaming:i.streaming??ve.streaming,metadata:i.metadata??{},theme:s,thinkingEnabled:a?.thinkingEnabled===!0,thinkingViewable:a?.thinkingViewable===!0,photoSendingEnabled:a?.photoSendingEnabled===!0}}function kr(e,t){const r={...e};for(const n of Object.keys(t)){const a=t[n];a!=null&&(typeof a=="object"&&!Array.isArray(a)&&r[n]!==null&&typeof r[n]=="object"?r[n]=kr(r[n],a):r[n]=a)}return r}var Ot=function(){return Ot=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ot.apply(this,arguments)};function ne(e,t,r,n){function a(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function o(f){try{c(n.next(f))}catch(d){s(d)}}function l(f){try{c(n.throw(f))}catch(d){s(d)}}function c(f){f.done?i(f.value):a(f.value).then(o,l)}c((n=n.apply(e,t||[])).next())})}function ae(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(f){return l([c,f])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,a&&(i=c[0]&2?a.return:c[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,c[1])).done)return i;switch(a=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,a=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(f){c=[6,f],a=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function br(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,i;n<a;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}var xr="4.6.2";function at(e,t){return new Promise(function(r){return setTimeout(r,e,t)})}function Ra(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Ea(e,t){t===void 0&&(t=1/0);var r=window.requestIdleCallback;return r?new Promise(function(n){return r.call(window,function(){return n()},{timeout:t})}):at(Math.min(e,t))}function wr(e){return!!e&&typeof e.then=="function"}function Sr(e,t){try{var r=e();wr(r)?r.then(function(n){return t(!0,n)},function(n){return t(!1,n)}):t(!0,r)}catch(n){t(!1,n)}}function Cr(e,t,r){return r===void 0&&(r=16),ne(this,void 0,void 0,function(){var n,a,i,s;return ae(this,function(o){switch(o.label){case 0:n=Array(e.length),a=Date.now(),i=0,o.label=1;case 1:return i<e.length?(n[i]=t(e[i],i),s=Date.now(),s>=a+r?(a=s,[4,Ra()]):[3,3]):[3,4];case 2:o.sent(),o.label=3;case 3:return++i,[3,1];case 4:return[2,n]}})})}function je(e){return e.then(void 0,function(){}),e}function Za(e,t){for(var r=0,n=e.length;r<n;++r)if(e[r]===t)return!0;return!1}function ja(e,t){return!Za(e,t)}function Pt(e){return parseInt(e)}function Q(e){return parseFloat(e)}function ce(e,t){return typeof e=="number"&&isNaN(e)?t:e}function F(e){return e.reduce(function(t,r){return t+(r?1:0)},0)}function Ir(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var r=1/t;return Math.round(e*r)/r}function Ma(e){for(var t,r,n="Unexpected syntax '".concat(e,"'"),a=/^\s*([a-z-]*)(.*)$/i.exec(e),i=a[1]||void 0,s={},o=/([.:#][\w-]+|\[.+?\])/gi,l=function(m,h){s[m]=s[m]||[],s[m].push(h)};;){var c=o.exec(a[2]);if(!c)break;var f=c[0];switch(f[0]){case".":l("class",f.slice(1));break;case"#":l("id",f.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(f);if(d)l(d[1],(r=(t=d[4])!==null&&t!==void 0?t:d[5])!==null&&r!==void 0?r:"");else throw new Error(n);break;default:throw new Error(n)}}return[i,s]}function Oa(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>127)return new TextEncoder().encode(e);t[r]=n}return t}function me(e,t){var r=e[0]>>>16,n=e[0]&65535,a=e[1]>>>16,i=e[1]&65535,s=t[0]>>>16,o=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,f=0,d=0,m=0,h=0;h+=i+c,m+=h>>>16,h&=65535,m+=a+l,d+=m>>>16,m&=65535,d+=n+o,f+=d>>>16,d&=65535,f+=r+s,f&=65535,e[0]=f<<16|d,e[1]=m<<16|h}function Y(e,t){var r=e[0]>>>16,n=e[0]&65535,a=e[1]>>>16,i=e[1]&65535,s=t[0]>>>16,o=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,f=0,d=0,m=0,h=0;h+=i*c,m+=h>>>16,h&=65535,m+=a*c,d+=m>>>16,m&=65535,m+=i*l,d+=m>>>16,m&=65535,d+=n*c,f+=d>>>16,d&=65535,d+=a*l,f+=d>>>16,d&=65535,d+=i*o,f+=d>>>16,d&=65535,f+=r*c+n*l+a*o+i*s,f&=65535,e[0]=f<<16|d,e[1]=m<<16|h}function we(e,t){var r=e[0];t%=64,t===32?(e[0]=e[1],e[1]=r):t<32?(e[0]=r<<t|e[1]>>>32-t,e[1]=e[1]<<t|r>>>32-t):(t-=32,e[0]=e[1]<<t|r>>>32-t,e[1]=r<<t|e[1]>>>32-t)}function B(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function j(e,t){e[0]^=t[0],e[1]^=t[1]}var Pa=[4283543511,3981806797],Va=[3301882366,444984403];function Nr(e){var t=[0,e[0]>>>1];j(e,t),Y(e,Pa),t[1]=e[0]>>>1,j(e,t),Y(e,Va),t[1]=e[0]>>>1,j(e,t)}var it=[2277735313,289559509],st=[1291169091,658871167],Tr=[0,5],$a=[0,1390208809],Fa=[0,944331445];function Wa(e,t){var r=Oa(e);t=t||0;var n=[0,r.length],a=n[1]%16,i=n[1]-a,s=[0,t],o=[0,t],l=[0,0],c=[0,0],f;for(f=0;f<i;f=f+16)l[0]=r[f+4]|r[f+5]<<8|r[f+6]<<16|r[f+7]<<24,l[1]=r[f]|r[f+1]<<8|r[f+2]<<16|r[f+3]<<24,c[0]=r[f+12]|r[f+13]<<8|r[f+14]<<16|r[f+15]<<24,c[1]=r[f+8]|r[f+9]<<8|r[f+10]<<16|r[f+11]<<24,Y(l,it),we(l,31),Y(l,st),j(s,l),we(s,27),me(s,o),Y(s,Tr),me(s,$a),Y(c,st),we(c,33),Y(c,it),j(o,c),we(o,31),me(o,s),Y(o,Tr),me(o,Fa);l[0]=0,l[1]=0,c[0]=0,c[1]=0;var d=[0,0];switch(a){case 15:d[1]=r[f+14],B(d,48),j(c,d);case 14:d[1]=r[f+13],B(d,40),j(c,d);case 13:d[1]=r[f+12],B(d,32),j(c,d);case 12:d[1]=r[f+11],B(d,24),j(c,d);case 11:d[1]=r[f+10],B(d,16),j(c,d);case 10:d[1]=r[f+9],B(d,8),j(c,d);case 9:d[1]=r[f+8],j(c,d),Y(c,st),we(c,33),Y(c,it),j(o,c);case 8:d[1]=r[f+7],B(d,56),j(l,d);case 7:d[1]=r[f+6],B(d,48),j(l,d);case 6:d[1]=r[f+5],B(d,40),j(l,d);case 5:d[1]=r[f+4],B(d,32),j(l,d);case 4:d[1]=r[f+3],B(d,24),j(l,d);case 3:d[1]=r[f+2],B(d,16),j(l,d);case 2:d[1]=r[f+1],B(d,8),j(l,d);case 1:d[1]=r[f],j(l,d),Y(l,it),we(l,31),Y(l,st),j(s,l)}return j(s,n),j(o,n),me(s,o),me(o,s),Nr(s),Nr(o),me(s,o),me(o,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)}function za(e){var t;return Ot({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
|
|
2
|
-
`)},e)}function Da(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Ua(e){return typeof e!="function"}function Ba(e,t){var r=je(new Promise(function(n){var a=Date.now();Sr(e.bind(null,t),function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var o=Date.now()-a;if(!i[0])return n(function(){return{error:i[1],duration:o}});var l=i[1];if(Ua(l))return n(function(){return{value:l,duration:o}});n(function(){return new Promise(function(c){var f=Date.now();Sr(l,function(){for(var d=[],m=0;m<arguments.length;m++)d[m]=arguments[m];var h=o+Date.now()-f;if(!d[0])return c({error:d[1],duration:h});c({value:d[1],duration:h})})})})})}));return function(){return r.then(function(a){return a()})}}function Ha(e,t,r,n){var a=Object.keys(e).filter(function(s){return ja(r,s)}),i=je(Cr(a,function(s){return Ba(e[s],t)},n));return function(){return ne(this,void 0,void 0,function(){var o,l,c,f,d;return ae(this,function(m){switch(m.label){case 0:return[4,i];case 1:return o=m.sent(),[4,Cr(o,function(h){return je(h())},n)];case 2:return l=m.sent(),[4,Promise.all(l)];case 3:for(c=m.sent(),f={},d=0;d<a.length;++d)f[a[d]]=c[d];return[2,f]}})})}}function Lr(){var e=window,t=navigator;return F(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function Ga(){var e=window,t=navigator;return F(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!Lr()}function Me(){var e=window,t=navigator;return F(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function K(){var e=window,t=navigator;return F(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function Vt(){var e=window,t=e.HTMLElement,r=e.Document;return F(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),r&&"pointerLockElement"in r.prototype])>=4}function Oe(){var e=window;return Da(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function Ar(){var e,t,r=window;return F(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in r,"mozInnerScreenX"in r,"CSSMozDocumentRule"in r,"CanvasCaptureMediaStream"in r])>=4}function Ya(){var e=window;return F([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function Xa(){var e=window,t=e.URLPattern;return F(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function Ja(){var e=window;return F(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function Pe(){var e=window,t=navigator,r=e.CSS,n=e.HTMLButtonElement;return F([!("getStorageUpdates"in t),n&&"popover"in n.prototype,"CSSCounterStyleRule"in e,r.supports("font-size-adjust: ex-height 0.5"),r.supports("text-transform: full-width")])>=4}function Qa(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return F(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function Ka(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function qa(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function $t(){var e=Me(),t=Ar(),r=window,n=navigator,a="connection";return e?F([!("SharedWorker"in r),n[a]&&"ontypechange"in n[a],!("sinkId"in new Audio)])>=2:t?F(["onorientationchange"in r,"orientation"in r,/android/i.test(n.appVersion)])>=2:!1}function ei(){var e=navigator,t=window,r=Audio.prototype,n=t.visualViewport;return F(["srLatency"in r,"srChannelCount"in r,"devicePosture"in e,n&&"segments"in n,"getTextInformation"in Image.prototype])>=3}function ti(){return ai()?-4:ri()}function ri(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(ni())return-1;var r=4500,n=new t(1,5e3,44100),a=n.createOscillator();a.type="triangle",a.frequency.value=1e4;var i=n.createDynamicsCompressor();i.threshold.value=-50,i.knee.value=40,i.ratio.value=12,i.attack.value=0,i.release.value=.25,a.connect(i),i.connect(n.destination),a.start(0);var s=ii(n),o=s[0],l=s[1],c=je(o.then(function(f){return si(f.getChannelData(0).subarray(r))},function(f){if(f.name==="timeout"||f.name==="suspended")return-3;throw f}));return function(){return l(),c}}function ni(){return K()&&!Vt()&&!Ja()}function ai(){return K()&&Pe()&&Oe()||Me()&&ei()&&Xa()}function ii(e){var t=3,r=500,n=500,a=5e3,i=function(){};return[new Promise(function(s,o){var l=!1,c=0,f=0;e.oncomplete=function(h){return s(h.renderedBuffer)};var d=function(){setTimeout(function(){return o(Rr("timeout"))},Math.min(n,f+a-Date.now()))},m=function(){try{var h=e.startRendering();switch(wr(h)&&je(h),e.state){case"running":f=Date.now(),l&&d();break;case"suspended":document.hidden||c++,l&&c>=t?o(Rr("suspended")):setTimeout(m,r);break}}catch(k){o(k)}};m(),i=function(){l||(l=!0,f>0&&d())}}),i]}function si(e){for(var t=0,r=0;r<e.length;++r)t+=Math.abs(e[r]);return t}function Rr(e){var t=new Error(e);return t.name=e,t}function Er(e,t,r){var n,a,i;return r===void 0&&(r=50),ne(this,void 0,void 0,function(){var s,o;return ae(this,function(l){switch(l.label){case 0:s=document,l.label=1;case 1:return s.body?[3,3]:[4,at(r)];case 2:return l.sent(),[3,1];case 3:o=s.createElement("iframe"),l.label=4;case 4:return l.trys.push([4,,10,11]),[4,new Promise(function(c,f){var d=!1,m=function(){d=!0,c()},h=function(C){d=!0,f(C)};o.onload=m,o.onerror=h;var k=o.style;k.setProperty("display","block","important"),k.position="absolute",k.top="0",k.left="0",k.visibility="hidden",t&&"srcdoc"in o?o.srcdoc=t:o.src="about:blank",s.body.appendChild(o);var y=function(){var C,_;d||(((_=(C=o.contentWindow)===null||C===void 0?void 0:C.document)===null||_===void 0?void 0:_.readyState)==="complete"?m():setTimeout(y,10))};y()})];case 5:l.sent(),l.label=6;case 6:return!((a=(n=o.contentWindow)===null||n===void 0?void 0:n.document)===null||a===void 0)&&a.body?[3,8]:[4,at(r)];case 7:return l.sent(),[3,6];case 8:return[4,e(o,o.contentWindow)];case 9:return[2,l.sent()];case 10:return(i=o.parentNode)===null||i===void 0||i.removeChild(o),[7];case 11:return[2]}})})}function oi(e){for(var t=Ma(e),r=t[0],n=t[1],a=document.createElement(r??"div"),i=0,s=Object.keys(n);i<s.length;i++){var o=s[i],l=n[o].join(" ");o==="style"?ci(a.style,l):a.setAttribute(o,l)}return a}function ci(e,t){for(var r=0,n=t.split(";");r<n.length;r++){var a=n[r],i=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(a);if(i){var s=i[1],o=i[2],l=i[4];e.setProperty(s,o,l||"")}}}function li(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(r){if(r instanceof Error&&r.name==="SecurityError")return!0;throw r}e=t}}var di="mmMwWLliI0O&1",ui="48px",Se=["monospace","sans-serif","serif"],Zr=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function fi(){var e=this;return Er(function(t,r){var n=r.document;return ne(e,void 0,void 0,function(){var a,i,s,o,l,c,f,d,m,h,k,y;return ae(this,function(C){for(a=n.body,a.style.fontSize=ui,i=n.createElement("div"),i.style.setProperty("visibility","hidden","important"),s={},o={},l=function(_){var x=n.createElement("span"),Z=x.style;return Z.position="absolute",Z.top="0",Z.left="0",Z.fontFamily=_,x.textContent=di,i.appendChild(x),x},c=function(_,x){return l("'".concat(_,"',").concat(x))},f=function(){return Se.map(l)},d=function(){for(var _={},x=function(H){_[H]=Se.map(function(G){return c(H,G)})},Z=0,V=Zr;Z<V.length;Z++){var z=V[Z];x(z)}return _},m=function(_){return Se.some(function(x,Z){return _[Z].offsetWidth!==s[x]||_[Z].offsetHeight!==o[x]})},h=f(),k=d(),a.appendChild(i),y=0;y<Se.length;y++)s[Se[y]]=h[y].offsetWidth,o[Se[y]]=h[y].offsetHeight;return[2,Zr.filter(function(_){return m(k[_])})]})})})}function hi(){var e=navigator.plugins;if(e){for(var t=[],r=0;r<e.length;++r){var n=e[r];if(n){for(var a=[],i=0;i<n.length;++i){var s=n[i];a.push({type:s.type,suffixes:s.suffixes})}t.push({name:n.name,description:n.description,mimeTypes:a})}}return t}}function mi(){return pi(xi())}function pi(e){var t,r=!1,n,a,i=gi(),s=i[0],o=i[1];return _i(s,o)?(r=vi(o),e?n=a="skipped":(t=yi(s,o),n=t[0],a=t[1])):n=a="unsupported",{winding:r,geometry:n,text:a}}function gi(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function _i(e,t){return!!(t&&e.toDataURL)}function vi(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function yi(e,t){ki(e,t);var r=Ft(e);return r!==Ft(e)?["unstable","unstable"]:(bi(e,t),[Ft(e),r])}function ki(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var r="Cwm fjordbank gly ".concat("😃");t.fillText(r,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(r,4,45)}function bi(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var r=0,n=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];r<n.length;r++){var a=n[r],i=a[0],s=a[1],o=a[2];t.fillStyle=i,t.beginPath(),t.arc(s,o,40,0,Math.PI*2,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function Ft(e){return e.toDataURL()}function xi(){return K()&&Pe()&&Oe()}function wi(){var e=navigator,t=0,r;e.maxTouchPoints!==void 0?t=Pt(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),r=!0}catch{r=!1}var n="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:r,touchStart:n}}function Si(){return navigator.oscpu}function Ci(){var e=navigator,t=[],r=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(r!==void 0&&t.push([r]),Array.isArray(e.languages))Me()&&Ya()||t.push(e.languages);else if(typeof e.languages=="string"){var n=e.languages;n&&t.push(n.split(","))}return t}function Ii(){return window.screen.colorDepth}function Ni(){return ce(Q(navigator.deviceMemory),void 0)}function Ti(){if(!(K()&&Pe()&&Oe()))return Li()}function Li(){var e=screen,t=function(n){return ce(Pt(n),null)},r=[t(e.width),t(e.height)];return r.sort().reverse(),r}var Ai=2500,Ri=10,ot,Wt;function Ei(){if(Wt===void 0){var e=function(){var t=zt();Dt(t)?Wt=setTimeout(e,Ai):(ot=t,Wt=void 0)};e()}}function Zi(){var e=this;return Ei(),function(){return ne(e,void 0,void 0,function(){var t;return ae(this,function(r){switch(r.label){case 0:return t=zt(),Dt(t)?ot?[2,br([],ot,!0)]:Ka()?[4,qa()]:[3,2]:[3,2];case 1:r.sent(),t=zt(),r.label=2;case 2:return Dt(t)||(ot=t),[2,t]}})})}}function ji(){var e=this;if(K()&&Pe()&&Oe())return function(){return Promise.resolve(void 0)};var t=Zi();return function(){return ne(e,void 0,void 0,function(){var r,n;return ae(this,function(a){switch(a.label){case 0:return[4,t()];case 1:return r=a.sent(),n=function(i){return i===null?null:Ir(i,Ri)},[2,[n(r[0]),n(r[1]),n(r[2]),n(r[3])]]}})})}}function zt(){var e=screen;return[ce(Q(e.availTop),null),ce(Q(e.width)-Q(e.availWidth)-ce(Q(e.availLeft),0),null),ce(Q(e.height)-Q(e.availHeight)-ce(Q(e.availTop),0),null),ce(Q(e.availLeft),null)]}function Dt(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function Mi(){return ce(Pt(navigator.hardwareConcurrency),void 0)}function Oi(){var e,t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){var r=new t().resolvedOptions().timeZone;if(r)return r}var n=-Pi();return"UTC".concat(n>=0?"+":"").concat(n)}function Pi(){var e=new Date().getFullYear();return Math.max(Q(new Date(e,0,1).getTimezoneOffset()),Q(new Date(e,6,1).getTimezoneOffset()))}function Vi(){try{return!!window.sessionStorage}catch{return!0}}function $i(){try{return!!window.localStorage}catch{return!0}}function Fi(){if(!(Lr()||Ga()))try{return!!window.indexedDB}catch{return!0}}function Wi(){return!!window.openDatabase}function zi(){return navigator.cpuClass}function Di(){var e=navigator.platform;return e==="MacIntel"&&K()&&!Vt()?Qa()?"iPad":"iPhone":e}function Ui(){return navigator.vendor||""}function Bi(){for(var e=[],t=0,r=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<r.length;t++){var n=r[t],a=window[n];a&&typeof a=="object"&&e.push(n)}return e.sort()}function Hi(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function Gi(){var e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}function Yi(e){var t=(e===void 0?{}:e).debug;return ne(this,void 0,void 0,function(){var r,n,a,i,s,o;return ae(this,function(l){switch(l.label){case 0:return Xi()?(r=Gi(),n=Object.keys(r),a=(o=[]).concat.apply(o,n.map(function(c){return r[c]})),[4,Ji(a)]):[2,void 0];case 1:return i=l.sent(),t&&Qi(r,i),s=n.filter(function(c){var f=r[c];return F(f.map(function(d){return i[d]}))>f.length*.6}),s.sort(),[2,s]}})})}function Xi(){return K()||$t()}function Ji(e){var t;return ne(this,void 0,void 0,function(){var r,n,a,i,l,s,o,l;return ae(this,function(c){switch(c.label){case 0:for(r=document,n=r.createElement("div"),a=new Array(e.length),i={},jr(n),l=0;l<e.length;++l)s=oi(e[l]),s.tagName==="DIALOG"&&s.show(),o=r.createElement("div"),jr(o),o.appendChild(s),n.appendChild(o),a[l]=s;c.label=1;case 1:return r.body?[3,3]:[4,at(50)];case 2:return c.sent(),[3,1];case 3:r.body.appendChild(n);try{for(l=0;l<e.length;++l)a[l].offsetParent||(i[e[l]]=!0)}finally{(t=n.parentNode)===null||t===void 0||t.removeChild(n)}return[2,i]}})})}function jr(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function Qi(e,t){for(var r="DOM blockers debug:\n```",n=0,a=Object.keys(e);n<a.length;n++){var i=a[n];r+=`
|
|
3
|
-
`.concat(i,":");for(var s=0,o=e[i];s<o.length;s++){var l=o[s];
|
|
4
|
-
`.concat(t[l]?"🚫":"➡️"," ").concat(l)}}}function Ki(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var r=t[e];if(matchMedia("(color-gamut: ".concat(r,")")).matches)return r}}function qi(){if(Mr("inverted"))return!0;if(Mr("none"))return!1}function Mr(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function es(){if(Or("active"))return!0;if(Or("none"))return!1}function Or(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var ts=100;function rs(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=ts;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function ns(){if(Ce("no-preference"))return 0;if(Ce("high")||Ce("more"))return 1;if(Ce("low")||Ce("less"))return-1;if(Ce("forced"))return 10}function Ce(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function as(){if(Pr("reduce"))return!0;if(Pr("no-preference"))return!1}function Pr(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function is(){if(Vr("reduce"))return!0;if(Vr("no-preference"))return!1}function Vr(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function ss(){if($r("high"))return!0;if($r("standard"))return!1}function $r(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var R=Math,W=function(){return 0};function os(){var e=R.acos||W,t=R.acosh||W,r=R.asin||W,n=R.asinh||W,a=R.atanh||W,i=R.atan||W,s=R.sin||W,o=R.sinh||W,l=R.cos||W,c=R.cosh||W,f=R.tan||W,d=R.tanh||W,m=R.exp||W,h=R.expm1||W,k=R.log1p||W,y=function(L){return R.pow(R.PI,L)},C=function(L){return R.log(L+R.sqrt(L*L-1))},_=function(L){return R.log(L+R.sqrt(L*L+1))},x=function(L){return R.log((1+L)/(1-L))/2},Z=function(L){return R.exp(L)-1/R.exp(L)/2},V=function(L){return(R.exp(L)+1/R.exp(L))/2},z=function(L){return R.exp(L)-1},H=function(L){return(R.exp(2*L)-1)/(R.exp(2*L)+1)},G=function(L){return R.log(1+L)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:C(1e154),asin:r(.12312423423423424),asinh:n(1),asinhPf:_(1),atanh:a(.5),atanhPf:x(.5),atan:i(.5),sin:s(-1e300),sinh:o(1),sinhPf:Z(1),cos:l(10.000000000123),cosh:c(1),coshPf:V(1),tan:f(-1e300),tanh:d(1),tanhPf:H(1),exp:m(1),expm1:h(1),expm1Pf:z(1),log1p:k(10),log1pPf:G(10),powPI:y(-100)}}var cs="mmMwWLliI0fiflO&1",Ut={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function ls(){return ds(function(e,t){for(var r={},n={},a=0,i=Object.keys(Ut);a<i.length;a++){var s=i[a],o=Ut[s],l=o[0],c=l===void 0?{}:l,f=o[1],d=f===void 0?cs:f,m=e.createElement("span");m.textContent=d,m.style.whiteSpace="nowrap";for(var h=0,k=Object.keys(c);h<k.length;h++){var y=k[h],C=c[y];C!==void 0&&(m.style[y]=C)}r[s]=m,t.append(e.createElement("br"),m)}for(var _=0,x=Object.keys(Ut);_<x.length;_++){var s=x[_];n[s]=r[s].getBoundingClientRect().width}return n})}function ds(e,t){return t===void 0&&(t=4e3),Er(function(r,n){var a=n.document,i=a.body,s=i.style;s.width="".concat(t,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",Me()?i.style.zoom="".concat(1/n.devicePixelRatio):K()&&(i.style.zoom="reset");var o=a.createElement("div");return o.textContent=br([],Array(t/20<<0),!0).map(function(){return"word"}).join(" "),i.appendChild(o),e(a,i)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function us(){return navigator.pdfViewerEnabled}function fs(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function hs(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(ms())return-3;try{return e.canMakePayments()?1:0}catch(t){return ps(t)}}var ms=li;function ps(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function gs(){var e,t=document.createElement("a"),r=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return r===void 0?void 0:String(r)}var Fr=-1,Wr=-2,_s=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),vs=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),ys=["FRAGMENT_SHADER","VERTEX_SHADER"],ks=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],zr="WEBGL_debug_renderer_info",bs="WEBGL_polygon_mode";function xs(e){var t,r,n,a,i,s,o=e.cache,l=Dr(o);if(!l)return Fr;if(!Hr(l))return Wr;var c=Br()?null:l.getExtension(zr);return{version:((t=l.getParameter(l.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((r=l.getParameter(l.VENDOR))===null||r===void 0?void 0:r.toString())||"",vendorUnmasked:c?(n=l.getParameter(c.UNMASKED_VENDOR_WEBGL))===null||n===void 0?void 0:n.toString():"",renderer:((a=l.getParameter(l.RENDERER))===null||a===void 0?void 0:a.toString())||"",rendererUnmasked:c?(i=l.getParameter(c.UNMASKED_RENDERER_WEBGL))===null||i===void 0?void 0:i.toString():"",shadingLanguageVersion:((s=l.getParameter(l.SHADING_LANGUAGE_VERSION))===null||s===void 0?void 0:s.toString())||""}}function ws(e){var t=e.cache,r=Dr(t);if(!r)return Fr;if(!Hr(r))return Wr;var n=r.getSupportedExtensions(),a=r.getContextAttributes(),i=[],s=[],o=[],l=[],c=[];if(a)for(var f=0,d=Object.keys(a);f<d.length;f++){var m=d[f];s.push("".concat(m,"=").concat(a[m]))}for(var h=Ur(r),k=0,y=h;k<y.length;k++){var C=y[k],_=r[C];o.push("".concat(C,"=").concat(_).concat(_s.has(_)?"=".concat(r.getParameter(_)):""))}if(n)for(var x=0,Z=n;x<Z.length;x++){var V=Z[x];if(!(V===zr&&Br()||V===bs&&Is())){var z=r.getExtension(V);if(!z){i.push(V);continue}for(var H=0,G=Ur(z);H<G.length;H++){var C=G[H],_=z[C];l.push("".concat(C,"=").concat(_).concat(vs.has(_)?"=".concat(r.getParameter(_)):""))}}}for(var L=0,E=ys;L<E.length;L++)for(var M=E[L],De=0,_t=ks;De<_t.length;De++){var Hn=_t[De],cc=Ss(r,M,Hn);c.push("".concat(M,".").concat(Hn,"=").concat(cc.join(",")))}return l.sort(),o.sort(),{contextAttributes:s,parameters:o,shaderPrecisions:c,extensions:n,extensionParameters:l,unsupportedExtensions:i}}function Dr(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),r;t.addEventListener("webglCreateContextError",function(){r=void 0});for(var n=0,a=["webgl","experimental-webgl"];n<a.length;n++){var i=a[n];try{r=t.getContext(i)}catch{}if(r)break}return e.webgl={context:r},r}function Ss(e,t,r){var n=e.getShaderPrecisionFormat(e[t],e[r]);return n?[n.rangeMin,n.rangeMax,n.precision]:[]}function Ur(e){return Object.keys(e.__proto__).filter(Cs)}function Cs(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function Br(){return Ar()}function Is(){return Me()||K()}function Hr(e){return typeof e.getParameter=="function"}function Ns(){if(!($t()||K()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function Ts(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}var Ls={fonts:fi,domBlockers:Yi,fontPreferences:ls,audio:ti,screenFrame:ji,canvas:mi,osCpu:Si,languages:Ci,colorDepth:Ii,deviceMemory:Ni,screenResolution:Ti,hardwareConcurrency:Mi,timezone:Oi,sessionStorage:Vi,localStorage:$i,indexedDB:Fi,openDatabase:Wi,cpuClass:zi,platform:Di,plugins:hi,touchSupport:wi,vendor:Ui,vendorFlavors:Bi,cookiesEnabled:Hi,colorGamut:Ki,invertedColors:qi,forcedColors:es,monochrome:rs,contrast:ns,reducedMotion:as,reducedTransparency:is,hdr:ss,math:os,pdfViewerEnabled:us,architecture:fs,applePay:hs,privateClickMeasurement:gs,audioBaseLatency:Ns,dateTimeLocale:Ts,webGlBasics:xs,webGlExtensions:ws};function As(e){return Ha(Ls,e,[])}var Rs="$ if upgrade to Pro: https://fpjs.dev/pro";function Es(e){var t=Zs(e),r=js(t);return{score:t,comment:Rs.replace(/\$/g,"".concat(r))}}function Zs(e){if($t())return .4;if(K())return Vt()&&!(Pe()&&Oe())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function js(e){return Ir(.99+.01*e,1e-4)}function Ms(e){for(var t="",r=0,n=Object.keys(e).sort();r<n.length;r++){var a=n[r],i=e[a],s="error"in i?"error":JSON.stringify(i.value);t+="".concat(t?"|":"").concat(a.replace(/([:|\\])/g,"\\$1"),":").concat(s)}return t}function Os(e){return JSON.stringify(e,function(t,r){return r instanceof Error?za(r):r},2)}function Gr(e){return Wa(Ms(e))}function Ps(e){var t;return{get visitorId(){return t===void 0&&(t=Gr(this.components)),t},set visitorId(r){t=r},confidence:Es(e),components:e,version:xr}}function Vs(e){return e===void 0&&(e=50),Ea(e,e*2)}function $s(e,t){var r=Date.now();return{get:function(n){return ne(this,void 0,void 0,function(){var a,i,s;return ae(this,function(o){switch(o.label){case 0:return a=Date.now(),[4,e()];case 1:return i=o.sent(),s=Ps(i),t||n?.debug,[2,s]}})})}}}function Fs(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(xr,"/npm-monitoring"),!0),e.send()}catch{}}function Ws(e){var t;return e===void 0&&(e={}),ne(this,void 0,void 0,function(){var r,n,a;return ae(this,function(i){switch(i.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&Fs(),r=e.delayFallback,n=e.debug,[4,Vs(r)];case 1:return i.sent(),a=As({cache:{},debug:n}),[2,$s(a,n)]}})})}var zs={load:Ws,hashComponents:Gr,componentsToDebugString:Os},Ds=class{constructor(e){this.baseUrl=e}async validateWidget(e,t){if(!t)return{valid:!1,error:"Widget is not configured: tenantId is required"};try{const r=new URLSearchParams({agentId:e,tenantId:t}),n=await fetch(`${this.baseUrl}/v1/widget/validate?${r}`),a=await n.json();return n.ok&&a.success?{valid:!0,agentId:a.data.agentId,tenantId:a.data.tenantId}:{valid:!1,error:a.error??`Widget configuration is invalid (${n.status})`}}catch{return{valid:!1,error:"Unable to reach the AgentForge API to validate widget configuration"}}}async chat(e){const t=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e.agentId)}/responses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e.message,sessionId:e.sessionId,tenantId:e.tenantId,externalId:e.externalId,name:e.name,email:e.email,authId:e.authId,fingerprint:e.fingerprint,metadata:e.metadata,imageUrl:e.imageUrl})});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);const r=await t.json();if(!r.success)throw new Error(r.error??"Unknown API error");return{content:r.data?.text??"",sessionId:r.data?.sessionId,images:r.data?.images}}async fetchSessionMessages(e){try{const t=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/messages`);if(t.status===410||!t.ok)return null;const r=await t.json();return r.success?r.data?.messages??null:null}catch{return null}}async uploadImage(e,t,r,n,a){const i=await fetch(`${this.baseUrl}/v1/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,mimeType:t,fileName:r,agentId:n,tenantId:a})});if(!i.ok)throw new Error(`Upload error: ${i.status} ${i.statusText}`);const s=await i.json();if(!s.success)throw new Error(s.error??"Upload failed");return{url:s.data.url}}async fetchWidgetConfig(e,t){try{const r=t?`?tenantId=${encodeURIComponent(t)}`:"",n=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e)}/widget-config${r}`);if(!n.ok)return null;const a=await n.json();return a.success?a.data:null}catch{return null}}async endSession(e,t,r,n,a){const i=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/end`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tenantId:t,agentId:r,fingerprint:n,externalId:a})});if(!i.ok)throw new Error(`Failed to end session: ${i.status} ${i.statusText}`);const s=await i.json();if(!s.success)throw new Error(s.error??"Failed to end session")}},Us=12e4;function Bs(e){return Promise.race([e.read(),new Promise((t,r)=>setTimeout(()=>r(new Error("Stream timed out — no data received for 120s")),Us))])}async function Hs(e,t,r){let n="",a="";try{const i=await fetch(`${e}/v1/agents/${encodeURIComponent(t.agentId)}/responses:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t.message,sessionId:t.sessionId,tenantId:t.tenantId,externalId:t.externalId,name:t.name,email:t.email,authId:t.authId,fingerprint:t.fingerprint,metadata:t.metadata,imageUrl:t.imageUrl})});if(!i.ok||!i.body){let d=`${i.status} ${i.statusText}`;try{const m=await i.json();m.error&&(d=m.error)}catch{}throw new Error(d)}const s=i.headers.get("x-session-id");s&&r.onSession&&r.onSession(s);const o=i.body.getReader(),l=new TextDecoder;let c="";const f=d=>{if(!d.startsWith("data: "))return!1;const m=d.slice(6).trim();if(!m)return!1;if(m==="[DONE]")return r.onEnd(n),!0;try{const h=JSON.parse(m);if(h.type==="session"){const y=h.sessionId;return y&&r.onSession&&r.onSession(y),!1}if(h.type==="done"||h.type==="stop")return r.onEnd(n),!0;if(h.type==="error")throw new Error(h.message??"Stream error");if(h.type==="images"){const y=h.images;return y&&r.onImages&&r.onImages(y),!1}if(h.type==="thinking_chunk"){const y=h.content;return y&&r.onThinkingDelta&&(a+=y,r.onThinkingDelta(y,a)),!1}const k=Gs(h);k&&(n+=k,r.onDelta(k,n))}catch(h){if(!(h instanceof SyntaxError))throw h}return!1};e:for(;;){const{done:d,value:m}=await Bs(o);if(d)break;c+=l.decode(m,{stream:!0});const h=c.lastIndexOf(`
|
|
5
|
-
`);if(
|
|
6
|
-
`))if(f(y))break e}r.onEnd(n)}catch(i){r.onError(i instanceof Error?i:new Error(String(i)))}}function Gs(e){const t=e.choices;if(Array.isArray(t)&&t.length>0){const a=t[0]?.delta,i=a?.content??a?.text??"";if(i)return i}const r=e.delta;if(r){const a=r.content??r.text??"";if(a)return a}const n=e.response;return n||(e.text??e.content??"")}var Ys=class{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(...e){const[t,r]=e;this.listeners.get(t)?.forEach(n=>n(r))}removeAllListeners(){this.listeners.clear()}},Xs="agentforge";function Bt(e){return`${Xs}:session:${e}`}function Js(e){try{return sessionStorage.getItem(Bt(e))??void 0}catch{return}}function Ht(e,t){try{sessionStorage.setItem(Bt(e),t)}catch{}}function Yr(e){try{sessionStorage.removeItem(Bt(e))}catch{}}function ct(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}var Qs=class{config;apiClient;state;fingerprint;emitter;constructor(e,t,r){this.hostConfig=t,this.onStateChange=r,this.config=e,this.apiClient=new Ds(e.apiBaseUrl),this.emitter=new Ys,this.initializeFingerprint();const n=e.sessionId??Js(e.agentId);e.sessionId&&Ht(e.agentId,e.sessionId);const a=e.mode==="inline";this.state={isOpen:a,messages:[],isLoading:!1,error:null,sessionId:n,initStatus:"validating",initError:null},a&&queueMicrotask(()=>this.openWithGreeting())}async initializeFingerprint(){try{this.fingerprint=(await(await zs.load()).get()).visitorId}catch{this.fingerprint=void 0}}getState(){return{...this.state,messages:[...this.state.messages]}}setOpen(e){e?this.openWithGreeting():this.setState({isOpen:!1})}openWithGreeting(){this.state.initStatus!=="error"&&this.setState({isOpen:!0})}async hydrate(){const e=await this.apiClient.validateWidget(this.config.agentId,this.config.tenantId);if(!e.valid){this.setState({initStatus:"error",initError:e.error});return}const t=await this.apiClient.fetchWidgetConfig(this.config.agentId,this.config.tenantId);if(t&&(this.config=Ze(this.hostConfig,t),this.onStateChange(this.getState(),this.config)),this.setState({initStatus:"ready"}),!this.state.sessionId)return;const r=await this.apiClient.fetchSessionMessages(this.state.sessionId);if(r===null){this.handleSessionExpired();return}if(r.length===0)return;const n=r.map(a=>({id:ct(),role:a.role,content:a.content,images:a.images&&a.images.length>0?a.images:void 0,uploadedImageUrl:a.imageUrl||void 0,createdAt:a.createdAt??new Date().toISOString(),status:"sent"}));this.setState({messages:[...this.state.messages,...n]})}setState(e){this.state={...this.state,...e},this.onStateChange(this.getState(),this.config)}updateMessage(e,t){this.state={...this.state,messages:this.state.messages.map(r=>r.id===e?{...r,...t}:r)},this.onStateChange(this.getState(),this.config)}async resetConversation(){if(this.state.sessionId)try{await this.apiClient.endSession(this.state.sessionId,this.config.tenantId,this.config.agentId,this.fingerprint,this.config.user.externalId)}catch{}Yr(this.config.agentId),this.setState({sessionId:void 0,messages:[],isLoading:!1,error:null}),this.emitter.emit("reset",void 0),this.state.isOpen&&this.openWithGreeting()}handleSessionExpired(){Yr(this.config.agentId),this.setState({sessionId:void 0})}async sendMessage(e,t){if(this.state.isLoading||!e.trim()&&!t||this.state.initStatus!=="ready")return;let r;if(t)try{const i=await Ks(t);r=(await this.apiClient.uploadImage(i,t.type,t.name,this.config.agentId,this.config.tenantId)).url}catch(i){const s=i instanceof Error?i.message:"Image upload failed";this.setState({error:s});return}const n={id:ct(),role:"user",content:e.trim(),uploadedImageUrl:r,createdAt:new Date().toISOString(),status:"sent"},a=!this.state.messages.some(i=>i.role==="user");this.setState({messages:[...this.state.messages,n],isLoading:!0,error:null}),this.emitter.emit("message:sent",n),a&&this.emitter.emit("conversation:started",{sessionId:this.state.sessionId}),this.config.streaming?await this.sendStreaming(e.trim(),r):await this.sendNonStreaming(e.trim(),r)}async sendNonStreaming(e,t,r=!1){try{const n=await this.apiClient.chat({agentId:this.config.agentId,message:e,sessionId:this.state.sessionId,tenantId:this.config.tenantId,externalId:this.config.user.externalId,name:this.config.user.name,email:this.config.user.email,authId:this.config.user.authId,fingerprint:this.fingerprint,metadata:this.config.metadata,imageUrl:t}),a={id:ct(),role:"assistant",content:n.content,images:n.images,createdAt:new Date().toISOString(),status:"sent"};this.setState({messages:[...this.state.messages,a],isLoading:!1,...n.sessionId?{sessionId:n.sessionId}:{}}),n.sessionId&&Ht(this.config.agentId,n.sessionId),this.emitter.emit("message:received",a)}catch(n){const a=n instanceof Error?n.message:"Failed to send message";if(!r&&a.includes("410"))return this.handleSessionExpired(),this.sendNonStreaming(e,t,!0);this.setState({isLoading:!1,error:a}),this.emitter.emit("message:error",{error:a,message:null})}}async sendStreaming(e,t,r=!1){const n=ct(),a={id:n,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"streaming",isThinking:this.config.thinkingEnabled?!0:void 0};this.setState({messages:[...this.state.messages,a]}),this.emitter.emit("stream:start");let i=!1;await Hs(this.config.apiBaseUrl,{agentId:this.config.agentId,message:e,sessionId:this.state.sessionId,tenantId:this.config.tenantId,externalId:this.config.user.externalId,name:this.config.user.name,email:this.config.user.email,authId:this.config.user.authId,fingerprint:this.fingerprint,metadata:this.config.metadata,imageUrl:t},{onSession:s=>{this.setState({sessionId:s}),Ht(this.config.agentId,s)},onImages:s=>{this.updateMessage(n,{images:s})},onThinkingDelta:(s,o)=>{this.updateMessage(n,{thinking:o,isThinking:!0}),this.emitter.emit("thinking:delta",{delta:s,accumulated:o})},onDelta:(s,o)=>{this.updateMessage(n,{content:o,isThinking:!1}),this.emitter.emit("stream:delta",{delta:s,accumulated:o})},onEnd:s=>{this.updateMessage(n,{content:s,status:"sent",isThinking:!1}),this.setState({isLoading:!1}),this.emitter.emit("stream:end",{content:s});const o=this.state.messages.find(l=>l.id===n);o&&(o.thinking&&this.emitter.emit("thinking:end",{content:o.thinking}),this.emitter.emit("message:received",o))},onError:s=>{if(!r&&s.message.includes("410")){i=!0,this.setState({messages:this.state.messages.filter(c=>c.id!==n),isLoading:!1});return}const o=this.state.messages.find(c=>c.id===n)?.content??"",l=s.message||"Something went wrong. Please try again.";this.updateMessage(n,{content:o||l,status:"error"}),this.setState({isLoading:!1,error:l}),this.emitter.emit("message:error",{error:s.message,message:null})}}),i&&(this.handleSessionExpired(),await this.sendStreaming(e,t,!0))}};function Ks(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>{const a=n.result;t(a.split(",")[1]??"")},n.onerror=()=>r(new Error("Failed to read file")),n.readAsDataURL(e)})}function qs(e){const t=document.createElement("div");t.setAttribute("data-agentkit-widget",""),e.appendChild(t);const r=t.attachShadow({mode:"open"}),n=document.createElement("style");r.appendChild(n);const a=document.createElement("div");return a.style.cssText="display: contents;",r.appendChild(a),{host:t,shadowRoot:r,styleSlot:n,mountPoint:a}}function eo(e,t){e.textContent=t}function to(e){e.remove()}function ro(){const e=document.createElement("div");return e.setAttribute("data-agentkit-root","floating"),e.style.cssText=["position: fixed","bottom: 24px","right: 24px","z-index: 2147483647","pointer-events: none"].join("; "),document.body.appendChild(e),e}function no(e){getComputedStyle(e).position==="static"&&(e.style.position="relative");const t=document.createElement("div");return t.setAttribute("data-agentkit-root","floating"),t.style.cssText=["position: absolute","bottom: 24px","right: 24px","z-index: 2147483647","pointer-events: none"].join("; "),e.appendChild(t),t}function ao(e){return e.setAttribute("data-agentkit-root","inline"),getComputedStyle(e).position==="static"&&(e.style.position="relative"),e}function io(e){e.remove()}function so(e){e.removeAttribute("data-agentkit-root")}function Xr(e,t,r,n,a){const i=e.mode==="inline";let s=!1;const o=i&&a?ao(a):!i&&a?no(a):ro(),l=qs(o);eo(l.styleSlot,n);const c=new Qs(e,t,(m,h)=>{s||f.update(m,h)}),f=r(l.mountPoint,e,c.getState(),{onOpen:()=>d.open(),onClose:()=>d.close(),onSendMessage:(m,h)=>{c.sendMessage(m,h)},onReset:()=>{c.resetConversation()}});c.hydrate(),setTimeout(()=>{s||c.emitter.emit("ready",c.getState())},0);const d={open(){s||(c.setOpen(!0),c.emitter.emit("open"))},close(){s||(c.setOpen(!1),c.emitter.emit("close"))},toggle(){c.getState().isOpen?d.close():d.open()},async sendMessage(m,h){await c.sendMessage(m,h)},reset(){s||(c.resetConversation(),c.emitter.emit("reset"))},destroy(){s||(s=!0,f.destroy(),to(l.host),i&&a?so(a):io(o),c.emitter.emit("destroy"),c.emitter.removeAllListeners())},on(m,h){c.emitter.on(m,h)},off(m,h){c.emitter.off(m,h)},getState(){return c.getState()}};return d}var Ve=new Map,oo=0;function Jr(e){const t=`agentkit-widget-${++oo}`,r=e.destroy.bind(e);return e.destroy=()=>{Ve.delete(t),r()},Ve.set(t,e),t}function co(e,t,r){const n={...e,mode:"floating"},a=Xr(Ze(n),n,t,r);return Jr(a),a}function lo(e,t,r,n){const a={...t,mode:"inline"},i=Xr(Ze(a),a,r,n,e);return Jr(i),i}function uo(e){e?Ve.get(e)?.destroy():(Ve.forEach(t=>t.destroy()),Ve.clear())}var lt,N,Qr,fo,pe,Kr,qr,en,tn,Gt,Yt,Xt,ho,dt={},ut=[],mo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$e=Array.isArray;function le(e,t){for(var r in t)e[r]=t[r];return e}function Jt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fe(e,t,r){var n,a,i,s={};for(i in t)i=="key"?n=t[i]:i=="ref"?a=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?lt.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return ft(e,s,n,a,null)}function ft(e,t,r,n,a){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++Qr,__i:-1,__u:0};return a==null&&N.vnode!=null&&N.vnode(i),i}function X(e){return e.children}function de(e,t){this.props=e,this.context=t}function Ie(e,t){if(t==null)return e.__?Ie(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Ie(e):null}function po(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,n=[],a=[],i=le({},t);i.__v=t.__v+1,N.vnode&&N.vnode(i),Qt(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,n,r??Ie(t),!!(32&t.__u),a),i.__v=t.__v,i.__.__k[i.__i]=i,ln(n,i,a),t.__e=t.__=null,i.__e!=r&&rn(i)}}function rn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),rn(e)}function nn(e){(!e.__d&&(e.__d=!0)&&pe.push(e)&&!ht.__r++||Kr!=N.debounceRendering)&&((Kr=N.debounceRendering)||qr)(ht)}function ht(){try{for(var e,t=1;pe.length;)pe.length>t&&pe.sort(en),e=pe.shift(),t=pe.length,po(e)}finally{pe.length=ht.__r=0}}function an(e,t,r,n,a,i,s,o,l,c,f){var d,m,h,k,y,C,_,x=n&&n.__k||ut,Z=t.length;for(l=go(r,t,x,l,Z),d=0;d<Z;d++)(h=r.__k[d])!=null&&(m=h.__i!=-1&&x[h.__i]||dt,h.__i=d,C=Qt(e,h,m,a,i,s,o,l,c,f),k=h.__e,h.ref&&m.ref!=h.ref&&(m.ref&&qt(m.ref,null,h),f.push(h.ref,h.__c||k,h)),y==null&&k!=null&&(y=k),(_=!!(4&h.__u))||m.__k===h.__k?l=sn(h,l,e,_):typeof h.type=="function"&&C!==void 0?l=C:k&&(l=k.nextSibling),h.__u&=-7);return r.__e=y,l}function go(e,t,r,n,a){var i,s,o,l,c,f=r.length,d=f,m=0;for(e.__k=new Array(a),i=0;i<a;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[i]=ft(null,s,null,null,null):$e(s)?s=e.__k[i]=ft(X,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=ft(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+m,s.__=e,s.__b=e.__b+1,o=null,(c=s.__i=_o(s,r,l,d))!=-1&&(d--,(o=r[c])&&(o.__u|=2)),o==null||o.__v==null?(c==-1&&(a>f?m--:a<f&&m++),typeof s.type!="function"&&(s.__u|=4)):c!=l&&(c==l-1?m--:c==l+1?m++:(c>l?m--:m++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<f;i++)(o=r[i])!=null&&(2&o.__u)==0&&(o.__e==n&&(n=Ie(o)),un(o,o));return n}function sn(e,t,r,n){var a,i;if(typeof e.type=="function"){for(a=e.__k,i=0;a&&i<a.length;i++)a[i]&&(a[i].__=e,t=sn(a[i],t,r,n));return t}e.__e!=t&&(n&&(t&&e.type&&!t.parentNode&&(t=Ie(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ue(e,t){return t=t||[],e==null||typeof e=="boolean"||($e(e)?e.some(function(r){ue(r,t)}):t.push(e)),t}function _o(e,t,r,n){var a,i,s,o=e.key,l=e.type,c=t[r],f=c!=null&&(2&c.__u)==0;if(c===null&&o==null||f&&o==c.key&&l==c.type)return r;if(n>(f?1:0)){for(a=r-1,i=r+1;a>=0||i<t.length;)if((c=t[s=a>=0?a--:i++])!=null&&(2&c.__u)==0&&o==c.key&&l==c.type)return s}return-1}function on(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||mo.test(t)?r:r+"px"}function mt(e,t,r,n,a){var i,s;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||on(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||on(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(tn,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?n?r.u=n.u:(r.u=Gt,e.addEventListener(t,i?Xt:Yt,i)):e.removeEventListener(t,i?Xt:Yt,i);else{if(a=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function cn(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=Gt++;else if(t.t<r.u)return;return r(N.event?N.event(t):t)}}}function Qt(e,t,r,n,a,i,s,o,l,c){var f,d,m,h,k,y,C,_,x,Z,V,z,H,G,L,E=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[o=t.__e=r.__e]),(f=N.__b)&&f(t);e:if(typeof E=="function")try{if(_=t.props,x=E.prototype&&E.prototype.render,Z=(f=E.contextType)&&n[f.__c],V=f?Z?Z.props.value:f.__:n,r.__c?C=(d=t.__c=r.__c).__=d.__E:(x?t.__c=d=new E(_,V):(t.__c=d=new de(_,V),d.constructor=E,d.render=yo),Z&&Z.sub(d),d.state||(d.state={}),d.__n=n,m=d.__d=!0,d.__h=[],d._sb=[]),x&&d.__s==null&&(d.__s=d.state),x&&E.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=le({},d.__s)),le(d.__s,E.getDerivedStateFromProps(_,d.__s))),h=d.props,k=d.state,d.__v=t,m)x&&E.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),x&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(x&&E.getDerivedStateFromProps==null&&_!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(_,V),t.__v==r.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(_,d.__s,V)===!1){t.__v!=r.__v&&(d.props=_,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(M){M&&(M.__=t)}),ut.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(_,d.__s,V),x&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,k,y)})}if(d.context=V,d.props=_,d.__P=e,d.__e=!1,z=N.__r,H=0,x)d.state=d.__s,d.__d=!1,z&&z(t),f=d.render(d.props,d.state,d.context),ut.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,z&&z(t),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++H<25);d.state=d.__s,d.getChildContext!=null&&(n=le(le({},n),d.getChildContext())),x&&!m&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(h,k)),G=f!=null&&f.type===X&&f.key==null?dn(f.props.children):f,o=an(e,$e(G)?G:[G],t,r,n,a,i,s,o,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),C&&(d.__E=d.__=null)}catch(M){if(t.__v=null,l||i!=null)if(M.then){for(t.__u|=l?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;i[i.indexOf(o)]=null,t.__e=o}else{for(L=i.length;L--;)Jt(i[L]);Kt(t)}else t.__e=r.__e,t.__k=r.__k,M.then||Kt(t);N.__e(M,t,r)}else i==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):o=t.__e=vo(r.__e,t,r,n,a,i,s,l,c);return(f=N.diffed)&&f(t),128&t.__u?void 0:o}function Kt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Kt))}function ln(e,t,r){for(var n=0;n<r.length;n++)qt(r[n],r[++n],r[++n]);N.__c&&N.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(i){i.call(a)})}catch(i){N.__e(i,a.__v)}})}function dn(e){return typeof e!="object"||e==null||e.__b>0?e:$e(e)?e.map(dn):le({},e)}function vo(e,t,r,n,a,i,s,o,l){var c,f,d,m,h,k,y,C=r.props||dt,_=t.props,x=t.type;if(x=="svg"?a="http://www.w3.org/2000/svg":x=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((h=i[c])&&"setAttribute"in h==!!x&&(x?h.localName==x:h.nodeType==3)){e=h,i[c]=null;break}}if(e==null){if(x==null)return document.createTextNode(_);e=document.createElementNS(a,x,_.is&&_),o&&(N.__m&&N.__m(t,i),o=!1),i=null}if(x==null)C===_||o&&e.data==_||(e.data=_);else{if(i=i&<.call(e.childNodes),!o&&i!=null)for(C={},c=0;c<e.attributes.length;c++)C[(h=e.attributes[c]).name]=h.value;for(c in C)h=C[c],c=="dangerouslySetInnerHTML"?d=h:c=="children"||c in _||c=="value"&&"defaultValue"in _||c=="checked"&&"defaultChecked"in _||mt(e,c,null,h,a);for(c in _)h=_[c],c=="children"?m=h:c=="dangerouslySetInnerHTML"?f=h:c=="value"?k=h:c=="checked"?y=h:o&&typeof h!="function"||C[c]===h||mt(e,c,h,C[c],a);if(f)o||d&&(f.__html==d.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(d&&(e.innerHTML=""),an(t.type=="template"?e.content:e,$e(m)?m:[m],t,r,n,x=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,s,i?i[0]:r.__k&&Ie(r,0),o,l),i!=null)for(c=i.length;c--;)Jt(i[c]);o||(c="value",x=="progress"&&k==null?e.removeAttribute("value"):k!=null&&(k!==e[c]||x=="progress"&&!k||x=="option"&&k!=C[c])&&mt(e,c,k,C[c],a),c="checked",y!=null&&y!=e[c]&&mt(e,c,y,C[c],a))}return e}function qt(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(a){N.__e(a,r)}}function un(e,t,r){var n,a;if(N.unmount&&N.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||qt(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){N.__e(i,t)}n.base=n.__P=null}if(n=e.__k)for(a=0;a<n.length;a++)n[a]&&un(n[a],t,r||typeof e.type!="function");r||Jt(e.__e),e.__c=e.__=e.__e=void 0}function yo(e,t,r){return this.constructor(e,r)}function fn(e,t,r){var n,a,i,s;t==document&&(t=document.documentElement),N.__&&N.__(e,t),a=(n=typeof r=="function")?null:r&&r.__k||t.__k,i=[],s=[],Qt(t,e=(!n&&r||t).__k=Fe(X,null,[e]),a||dt,dt,t.namespaceURI,!n&&r?[r]:a?null:t.firstChild?lt.call(t.childNodes):null,i,!n&&r?r:a?a.__e:t.firstChild,n,s),ln(i,e,s)}lt=ut.slice,N={__e:function(e,t,r,n){for(var a,i,s;t=t.__;)if((a=t.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(e)),s=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,n||{}),s=a.__d),s)return a.__E=a}catch(o){e=o}throw e}},Qr=0,fo=function(e){return e!=null&&e.constructor===void 0},de.prototype.setState=function(e,t){var r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=le({},this.state);typeof e=="function"&&(e=e(le({},r),this.props)),e&&le(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),nn(this))},de.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),nn(this))},de.prototype.render=X,pe=[],qr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,en=function(e,t){return e.__v.__b-t.__v.__b},ht.__r=0,tn=/(PointerCapture)$|Capture$/i,Gt=0,Yt=cn(!1),Xt=cn(!0),ho=0;var We,O,er,hn,ze=0,mn=[],P=N,pn=P.__b,gn=P.__r,_n=P.diffed,vn=P.__c,yn=P.unmount,kn=P.__;function tr(e,t){P.__h&&P.__h(O,e,ze||t),ze=0;var r=O.__H||(O.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Ne(e){return ze=1,ko(Sn,e)}function ko(e,t,r){var n=tr(We++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Sn(void 0,t),function(o){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,o);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=O,!O.__f)){var a=function(o,l,c){if(!n.__c.__H)return!0;var f=n.__c.__H.__.filter(function(m){return m.__c});if(f.every(function(m){return!m.__N}))return!i||i.call(this,o,l,c);var d=n.__c.props!==o;return f.some(function(m){if(m.__N){var h=m.__[0];m.__=m.__N,m.__N=void 0,h!==m.__[0]&&(d=!0)}}),i&&i.call(this,o,l,c)||d};O.__f=!0;var i=O.shouldComponentUpdate,s=O.componentWillUpdate;O.componentWillUpdate=function(o,l,c){if(this.__e){var f=i;i=void 0,a(o,l,c),i=f}s&&s.call(this,o,l,c)},O.shouldComponentUpdate=a}return n.__N||n.__}function Te(e,t){var r=tr(We++,3);!P.__s&&wn(r.__H,t)&&(r.__=e,r.u=t,O.__H.__h.push(r))}function Le(e){return ze=5,bn(function(){return{current:e}},[])}function bn(e,t){var r=tr(We++,7);return wn(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function bo(e,t){return ze=8,bn(function(){return e},t)}function xo(){for(var e;e=mn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(pt),t.__h.some(rr),t.__h=[]}catch(r){t.__h=[],P.__e(r,e.__v)}}}P.__b=function(e){O=null,pn&&pn(e)},P.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),kn&&kn(e,t)},P.__r=function(e){gn&&gn(e),We=0;var t=(O=e.__c).__H;t&&(er===O?(t.__h=[],O.__h=[],t.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.some(pt),t.__h.some(rr),t.__h=[],We=0)),er=O},P.diffed=function(e){_n&&_n(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(mn.push(t)!==1&&hn===P.requestAnimationFrame||((hn=P.requestAnimationFrame)||wo)(xo)),t.__H.__.some(function(r){r.u&&(r.__H=r.u),r.u=void 0})),er=O=null},P.__c=function(e,t){t.some(function(r){try{r.__h.some(pt),r.__h=r.__h.filter(function(n){return!n.__||rr(n)})}catch(n){t.some(function(a){a.__h&&(a.__h=[])}),t=[],P.__e(n,r.__v)}}),vn&&vn(e,t)},P.unmount=function(e){yn&&yn(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some(function(n){try{pt(n)}catch(a){t=a}}),r.__H=void 0,t&&P.__e(t,r.__v))};var xn=typeof requestAnimationFrame=="function";function wo(e){var t,r=function(){clearTimeout(n),xn&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);xn&&(t=requestAnimationFrame(r))}function pt(e){var t=O,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),O=t}function rr(e){var t=O;e.__c=e.__(),O=t}function wn(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Sn(e,t){return typeof t=="function"?t(e):t}function So(e,t){for(var r in t)e[r]=t[r];return e}function Cn(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function In(e,t){this.props=e,this.context=t}(In.prototype=new de).isPureReactComponent=!0,In.prototype.shouldComponentUpdate=function(e,t){return Cn(this.props,e)||Cn(this.state,t)};var Nn=N.__b;N.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Nn&&Nn(e)};var Vc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911,Tn=function(e,t){return e==null?null:ue(ue(e).map(t))},$c={map:Tn,forEach:Tn,count:function(e){return e?ue(e).length:0},only:function(e){var t=ue(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:ue},Co=N.__e;N.__e=function(e,t,r,n){if(e.then){for(var a,i=t;i=i.__;)if((a=i.__c)&&a.__c)return t.__e??(t.__e=r.__e,t.__k=r.__k),a.__c(e,t)}Co(e,t,r,n)};var Ln=N.unmount;function An(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=So({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return An(n,t,r)})),e}function Rn(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return Rn(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function nr(){this.__u=0,this.o=null,this.__b=null}function En(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function gt(){this.i=null,this.l=null}N.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Ln&&Ln(e)},(nr.prototype=new de).__c=function(e,t){var r=t.__c,n=this;n.o??=[],n.o.push(r);var a=En(n.__v),i=!1,s=function(){i||n.__z||(i=!0,r.__R=null,a?a(l):l())};r.__R=s;var o=r.__P;r.__P=null;var l=function(){if(!--n.__u){if(n.state.__a){var c=n.state.__a;n.__v.__k[0]=Rn(c,c.__c.__P,c.__c.__O)}var f;for(n.setState({__a:n.__b=null});f=n.o.pop();)f.__P=o,f.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(s,s)},nr.prototype.componentWillUnmount=function(){this.o=[]},nr.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=An(this.__b,r,n.__O=n.__P)}this.__b=null}var a=t.__a&&Fe(X,null,e.fallback);return a&&(a.__u&=-33),[Fe(X,null,t.__a?null:e.children),a]};var Zn=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(gt.prototype=new de).__a=function(e){var t=this,r=En(t.__v),n=t.l.get(e);return n[0]++,function(a){var i=function(){t.props.revealOrder?(n.push(a),Zn(t,e,n)):a()};r?r(i):i()}},gt.prototype.render=function(e){this.i=null,this.l=new Map;var t=ue(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},gt.prototype.componentDidUpdate=gt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Zn(e,r,t)})};var Io=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,No=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,To=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Lo=/[A-Z0-9]/g,Ao=typeof document<"u",Ro=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Eo(e,t,r){return t.__k??(t.textContent=""),fn(e,t),typeof r=="function"&&r(),e?e.__c:null}de.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(de.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var jn=N.event;N.event=function(e){return jn&&(e=jn(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Mn,Zo={configurable:!0,get:function(){return this.class}},On=N.vnode;N.vnode=function(e){typeof e.type=="string"&&(function(t){var r=t.props,n=t.type,a={},i=n.indexOf("-")==-1;for(var s in r){var o=r[s];if(!(s==="value"&&"defaultValue"in r&&o==null||Ao&&s==="children"&&n==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&o===!0?o="":l==="translate"&&o==="no"?o=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||Ro(r.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":To.test(s)&&(s=l):l=s="oninput":i&&No.test(s)?s=s.replace(Lo,"-$&").toLowerCase():o===null&&(o=void 0),l==="oninput"&&a[s=l]&&(s="oninputCapture"),a[s]=o}}n=="select"&&(a.multiple&&Array.isArray(a.value)&&(a.value=ue(r.children).forEach(function(c){c.props.selected=a.value.indexOf(c.props.value)!=-1})),a.defaultValue!=null&&(a.value=ue(r.children).forEach(function(c){c.props.selected=a.multiple?a.defaultValue.indexOf(c.props.value)!=-1:a.defaultValue==c.props.value}))),r.class&&!r.className?(a.class=r.class,Object.defineProperty(a,"className",Zo)):r.className&&(a.class=a.className=r.className),t.props=a})(e),e.$$typeof=Io,On&&On(e)};var Pn=N.__r;N.__r=function(e){Pn&&Pn(e),Mn=e.__c};var Vn=N.diffed;N.diffed=function(e){Vn&&Vn(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),Mn=null};function jo(e){return!!e.__k&&(fn(null,e),!0)}function Mo(e){return{render:function(t){Eo(t,e)},unmount:function(){jo(e)}}}function Oo(e){const{theme:t}=e,r=[`--ak-accent: ${t.accentColor}`,`--ak-font: ${t.fontFamily}`,`--ak-radius: ${t.borderRadius}`];return r.push(`--ak-accent-hover: color-mix(in srgb, ${t.accentColor} 85%, black)`),`:host { ${r.join("; ")} }`}function Po(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Vo=`
|
|
1
|
+
var AgentKit=(function(xt){Object.defineProperty(xt,Symbol.toStringTag,{value:"Module"});var A;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(const s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(A||(A={}));var hn;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(hn||(hn={}));var y=A.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),he=e=>{switch(typeof e){case"undefined":return y.undefined;case"string":return y.string;case"number":return Number.isNaN(e)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(e)?y.array:e===null?y.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?y.promise:typeof Map<"u"&&e instanceof Map?y.map:typeof Set<"u"&&e instanceof Set?y.set:typeof Date<"u"&&e instanceof Date?y.date:y.object;default:return y.unknown}},p=A.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"]),ne=class Yr extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){const c=s.path[l];l!==s.path.length-1?o[c]=o[c]||{_errors:[]}:(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(s))),o=o[c],l++}}};return a(this),r}static assert(t){if(!(t instanceof Yr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,A.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];n[i]=n[i]||[],n[i].push(t(a))}else r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};ne.create=e=>new ne(e);var Re=(e,t)=>{let n;switch(e.code){case p.invalid_type:e.received===y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case p.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,A.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:n=`Unrecognized key(s) in object: ${A.joinValues(e.keys,", ")}`;break;case p.invalid_union:n="Invalid input";break;case p.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${A.joinValues(e.options)}`;break;case p.invalid_enum_value:n=`Invalid enum value. Expected ${A.joinValues(e.options)}, received '${e.received}'`;break;case p.invalid_arguments:n="Invalid function arguments";break;case p.invalid_return_type:n="Invalid function return type";break;case p.invalid_date:n="Invalid date";break;case p.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:A.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case p.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case p.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case p.custom:n="Invalid input";break;case p.invalid_intersection_types:n="Intersection results could not be merged";break;case p.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case p.not_finite:n="Number must be finite";break;default:n=t.defaultError,A.assertNever(e)}return{message:n}},ea=Re;function wt(){return ea}var St=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,i=[...n,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)o=c(s,{data:t,defaultError:o}).message;return{...a,path:i,message:o}};function _(e,t){const n=wt(),r=St({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Re?void 0:Re].filter(a=>!!a)});e.common.issues.push(r)}var H=class Xr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const a of n){if(a.status==="aborted")return S;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const a of n){const i=await a.key,s=await a.value;r.push({key:i,value:s})}return Xr.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const a of n){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return S;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}},S=Object.freeze({status:"aborted"}),Me=e=>({status:"dirty",value:e}),U=e=>({status:"valid",value:e}),mn=e=>e.status==="aborted",pn=e=>e.status==="dirty",ke=e=>e.status==="valid",He=e=>typeof Promise<"u"&&e instanceof Promise,x;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(x||(x={}));var re=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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}},gn=(e,t)=>{if(ke(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){return this._error?this._error:(this._error=new ne(e.common.issues),this._error)}}};function I(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,o)=>{const{message:l}=e;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??r??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:a}}var T=class{get description(){return this._def.description}_getType(e){return he(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new H,ctx:{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(He(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)};return gn(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return ke(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>ke(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)},r=this._parse({data:e,path:n.path,parent:n});return gn(n,await(He(r)?r:Promise.resolve(r)))}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const i=e(r),s=()=>a.addIssue({code:p.custom,...n(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(o=>o?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new oe({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ce.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xe.create(this)}promise(){return Ze.create(this,this._def)}or(e){return Je.create([this,e],this._def)}and(e){return Qe.create(this,e,this._def)}transform(e){return new oe({...I(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new nt({...I(this._def),innerType:this,defaultValue:t,typeName:C.ZodDefault})}brand(){return new kn({typeName:C.ZodBranded,type:this,...I(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new rt({...I(this._def),innerType:this,catchValue:t,typeName:C.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return bn.create(this,e)}readonly(){return at.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ta=/^c[^\s-]{8,}$/i,na=/^[0-9a-z]+$/,ra=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aa=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ia=/^[a-z0-9_-]{21}$/i,sa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oa=/^[-+]?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)?)??$/,ca=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,la="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ct,da=/^(?:(?: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])$/,ua=/^(?:(?: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])$/,fa=/^(([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]))$/,ha=/^(([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])$/,ma=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_n="((\\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])))",ga=new RegExp(`^${_n}$`);function vn(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function _a(e){return new RegExp(`^${vn(e)}$`)}function va(e){let t=`${_n}T${vn(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function ya(e,t){return!!((t==="v4"||!t)&&da.test(e)||(t==="v6"||!t)&&fa.test(e))}function ka(e,t){if(!sa.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function ba(e,t){return!!((t==="v4"||!t)&&ua.test(e)||(t==="v6"||!t)&&ha.test(e))}var Ge=class Be extends T{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==y.string){const a=this._getOrReturnCtx(t);return _(a,{code:p.invalid_type,expected:y.string,received:a.parsedType}),S}const n=new H;let r;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=t.data.length>a.value,s=t.data.length<a.value;(i||s)&&(r=this._getOrReturnCtx(t,r),i?_(r,{code:p.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&_(r,{code:p.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ca.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"email",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ct||(Ct=new RegExp(la,"u")),Ct.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"emoji",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")aa.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"uuid",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")ia.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"nanoid",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")ta.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cuid",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")na.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cuid2",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ra.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"ulid",code:p.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),_(r,{validation:"url",code:p.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"regex",code:p.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?va(a).test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ga.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?_a(a).test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{code:p.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?oa.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"duration",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?ya(t.data,a.version)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"ip",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?ka(t.data,a.alg)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"jwt",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?ba(t.data,a.version)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"cidr",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?ma.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"base64",code:p.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?pa.test(t.data)||(r=this._getOrReturnCtx(t,r),_(r,{validation:"base64url",code:p.invalid_string,message:a.message}),n.dirty()):A.assertNever(a);return{status:n.value,value:t.data}}_regex(t,n,r){return this.refinement(a=>t.test(a),{validation:n,code:p.invalid_string,...x.errToObj(r)})}_addCheck(t){return new Be({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...x.errToObj(t)})}url(t){return this._addCheck({kind:"url",...x.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...x.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...x.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...x.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...x.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...x.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...x.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...x.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...x.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...x.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...x.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...x.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...x.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...x.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...x.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...x.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...x.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...x.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...x.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...x.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...x.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...x.errToObj(n)})}nonempty(t){return this.min(1,x.errToObj(t))}trim(){return new Be({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Be({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Be({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Ge.create=e=>new Ge({checks:[],typeName:C.ZodString,coerce:e?.coerce??!1,...I(e)});function xa(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}var It=class cn extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==y.number){const a=this._getOrReturnCtx(t);return _(a,{code:p.invalid_type,expected:y.number,received:a.parsedType}),S}let n;const r=new H;for(const a of this._def.checks)a.kind==="int"?A.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),_(n,{code:p.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?xa(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),_(n,{code:p.not_finite,message:a.message}),r.dirty()):A.assertNever(a);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,x.toString(n))}gt(t,n){return this.setLimit("min",t,!1,x.toString(n))}lte(t,n){return this.setLimit("max",t,!0,x.toString(n))}lt(t,n){return this.setLimit("max",t,!1,x.toString(n))}setLimit(t,n,r,a){return new cn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:x.toString(a)}]})}_addCheck(t){return new cn({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:x.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:x.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:x.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&A.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};It.create=e=>new It({checks:[],typeName:C.ZodNumber,coerce:e?.coerce||!1,...I(e)});var Nt=class ln extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==y.bigint)return this._getInvalidInput(t);let n;const r=new H;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),_(n,{code:p.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):A.assertNever(a);return{status:r.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return _(n,{code:p.invalid_type,expected:y.bigint,received:n.parsedType}),S}gte(t,n){return this.setLimit("min",t,!0,x.toString(n))}gt(t,n){return this.setLimit("min",t,!1,x.toString(n))}lte(t,n){return this.setLimit("max",t,!0,x.toString(n))}lt(t,n){return this.setLimit("max",t,!1,x.toString(n))}setLimit(t,n,r,a){return new ln({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:x.toString(a)}]})}_addCheck(t){return new ln({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:x.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Nt.create=e=>new Nt({checks:[],typeName:C.ZodBigInt,coerce:e?.coerce??!1,...I(e)});var Tt=class extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.boolean,received:t.parsedType}),S}return U(e.data)}};Tt.create=e=>new Tt({typeName:C.ZodBoolean,coerce:e?.coerce||!1,...I(e)});var Lt=class Jr extends T{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==y.date){const a=this._getOrReturnCtx(t);return _(a,{code:p.invalid_type,expected:y.date,received:a.parsedType}),S}if(Number.isNaN(t.data.getTime()))return _(this._getOrReturnCtx(t),{code:p.invalid_date}),S;const n=new H;let r;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:p.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(r=this._getOrReturnCtx(t,r),_(r,{code:p.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):A.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Jr({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:x.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:x.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};Lt.create=e=>new Lt({checks:[],coerce:e?.coerce||!1,typeName:C.ZodDate,...I(e)});var At=class extends T{_parse(e){if(this._getType(e)!==y.symbol){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.symbol,received:t.parsedType}),S}return U(e.data)}};At.create=e=>new At({typeName:C.ZodSymbol,...I(e)});var Ye=class extends T{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.undefined,received:t.parsedType}),S}return U(e.data)}};Ye.create=e=>new Ye({typeName:C.ZodUndefined,...I(e)});var Xe=class extends T{_parse(e){if(this._getType(e)!==y.null){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.null,received:t.parsedType}),S}return U(e.data)}};Xe.create=e=>new Xe({typeName:C.ZodNull,...I(e)});var Et=class extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return U(e.data)}};Et.create=e=>new Et({typeName:C.ZodAny,...I(e)});var be=class extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return U(e.data)}};be.create=e=>new be({typeName:C.ZodUnknown,...I(e)});var me=class extends T{_parse(e){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.never,received:t.parsedType}),S}};me.create=e=>new me({typeName:C.ZodNever,...I(e)});var Rt=class extends T{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.void,received:t.parsedType}),S}return U(e.data)}};Rt.create=e=>new Rt({typeName:C.ZodVoid,...I(e)});var xe=class kt extends T{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==y.array)return _(n,{code:p.invalid_type,expected:y.array,received:n.parsedType}),S;if(a.exactLength!==null){const s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(_(n,{code:s?p.too_big:p.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(_(n,{code:p.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(_(n,{code:p.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>a.type._parseAsync(new re(n,s,n.path,o)))).then(s=>H.mergeArray(r,s));const i=[...n.data].map((s,o)=>a.type._parseSync(new re(n,s,n.path,o)));return H.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new kt({...this._def,minLength:{value:t,message:x.toString(n)}})}max(t,n){return new kt({...this._def,maxLength:{value:t,message:x.toString(n)}})}length(t,n){return new kt({...this._def,exactLength:{value:t,message:x.toString(n)}})}nonempty(t){return this.min(1,t)}};xe.create=(e,t)=>new xe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...I(t)});function we(e){if(e instanceof Q){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ce.create(we(r))}return new Q({...e._def,shape:()=>t})}else return e instanceof xe?new xe({...e._def,type:we(e.element)}):e instanceof ce?ce.create(we(e.unwrap())):e instanceof ve?ve.create(we(e.unwrap())):e instanceof _e?_e.create(e.items.map(t=>we(t))):e}var Q=class te extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape();return this._cached={shape:t,keys:A.objectKeys(t)},this._cached}_parse(t){if(this._getType(t)!==y.object){const l=this._getOrReturnCtx(t);return _(l,{code:p.invalid_type,expected:y.object,received:l.parsedType}),S}const{status:n,ctx:r}=this._processInputParams(t),{shape:a,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(const l in r.data)i.includes(l)||s.push(l);const o=[];for(const l of i){const c=a[l],f=r.data[l];o.push({key:{status:"valid",value:l},value:c._parse(new re(r,f,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof me){const l=this._def.unknownKeys;if(l==="passthrough")for(const c of s)o.push({key:{status:"valid",value:c},value:{status:"valid",value:r.data[c]}});else if(l==="strict")s.length>0&&(_(r,{code:p.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const c of s){const f=r.data[c];o.push({key:{status:"valid",value:c},value:l._parse(new re(r,f,r.path,c)),alwaysSet:c in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const c of o){const f=await c.key,d=await c.value;l.push({key:f,value:d,alwaysSet:c.alwaysSet})}return l}).then(l=>H.mergeObjectSync(n,l)):H.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(t){return x.errToObj,new te({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{const a=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:x.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new te({...this._def,unknownKeys:"strip"})}passthrough(){return new te({...this._def,unknownKeys:"passthrough"})}extend(t){return new te({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new te({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:C.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new te({...this._def,catchall:t})}pick(t){const n={};for(const r of A.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new te({...this._def,shape:()=>n})}omit(t){const n={};for(const r of A.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new te({...this._def,shape:()=>n})}deepPartial(){return we(this)}partial(t){const n={};for(const r of A.objectKeys(this.shape)){const a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}return new te({...this._def,shape:()=>n})}required(t){const n={};for(const r of A.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof ce;)a=a._def.innerType;n[r]=a}return new te({...this._def,shape:()=>n})}keyof(){return yn(A.objectKeys(this.shape))}};Q.create=(e,t)=>new Q({shape:()=>e,unknownKeys:"strip",catchall:me.create(),typeName:C.ZodObject,...I(t)}),Q.strictCreate=(e,t)=>new Q({shape:()=>e,unknownKeys:"strict",catchall:me.create(),typeName:C.ZodObject,...I(t)}),Q.lazycreate=(e,t)=>new Q({shape:e,unknownKeys:"strip",catchall:me.create(),typeName:C.ZodObject,...I(t)});var Je=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(a){for(const s of a)if(s.result.status==="valid")return s.result;for(const s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const i=a.map(s=>new ne(s.ctx.common.issues));return _(t,{code:p.invalid_union,unionErrors:i}),S}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let a;const i=[];for(const o of n){const l={...t,common:{...t.common,issues:[]},parent:null},c=o._parseSync({data:t.data,path:t.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(o=>new ne(o));return _(t,{code:p.invalid_union,unionErrors:s}),S}}get options(){return this._def.options}};Je.create=(e,t)=>new Je({options:e,typeName:C.ZodUnion,...I(t)});var se=e=>e instanceof qe?se(e.schema):e instanceof oe?se(e.innerType()):e instanceof Ke?[e.value]:e instanceof et?e.options:e instanceof tt?A.objectValues(e.enum):e instanceof nt?se(e._def.innerType):e instanceof Ye?[void 0]:e instanceof Xe?[null]:e instanceof ce?[void 0,...se(e.unwrap())]:e instanceof ve?[null,...se(e.unwrap())]:e instanceof kn||e instanceof at?se(e.unwrap()):e instanceof rt?se(e._def.innerType):[],wa=class Qr extends T{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==y.object)return _(n,{code:p.invalid_type,expected:y.object,received:n.parsedType}),S;const r=this.discriminator,a=n.data[r],i=this.optionsMap.get(a);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(_(n,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const a=new Map;for(const i of n){const s=se(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const o of s){if(a.has(o))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(o)}`);a.set(o,i)}}return new Qr({typeName:C.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...I(r)})}};function Mt(e,t){const n=he(e),r=he(t);if(e===t)return{valid:!0,data:e};if(n===y.object&&r===y.object){const a=A.objectKeys(t),i=A.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s={...e,...t};for(const o of i){const l=Mt(e[o],t[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===y.array&&r===y.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const s=e[i],o=t[i],l=Mt(s,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return n===y.date&&r===y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Qe=class extends T{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(a,i)=>{if(mn(a)||mn(i))return S;const s=Mt(a.value,i.value);return s.valid?((pn(a)||pn(i))&&t.dirty(),{status:t.value,value:s.data}):(_(n,{code:p.invalid_intersection_types}),S)};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(([a,i])=>r(a,i)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Qe.create=(e,t,n)=>new Qe({left:e,right:t,typeName:C.ZodIntersection,...I(n)});var _e=class qr extends T{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==y.array)return _(r,{code:p.invalid_type,expected:y.array,received:r.parsedType}),S;if(r.data.length<this._def.items.length)return _(r,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&r.data.length>this._def.items.length&&(_(r,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((i,s)=>{const o=this._def.items[s]||this._def.rest;return o?o._parse(new re(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>H.mergeArray(n,i)):H.mergeArray(n,a)}get items(){return this._def.items}rest(t){return new qr({...this._def,rest:t})}};_e.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _e({items:e,typeName:C.ZodTuple,rest:null,...I(t)})};var Sa=class dn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==y.object)return _(r,{code:p.invalid_type,expected:y.object,received:r.parsedType}),S;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in r.data)a.push({key:i._parse(new re(r,o,r.path,o)),value:s._parse(new re(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?H.mergeObjectAsync(n,a):H.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof T?new dn({keyType:t,valueType:n,typeName:C.ZodRecord,...I(r)}):new dn({keyType:Ge.create(),valueType:t,typeName:C.ZodRecord,...I(n)})}},Zt=class extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.map)return _(n,{code:p.invalid_type,expected:y.map,received:n.parsedType}),S;const r=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([s,o],l)=>({key:r._parse(new re(n,s,n.path,[l,"key"])),value:a._parse(new re(n,o,n.path,[l,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const o of i){const l=await o.key,c=await o.value;if(l.status==="aborted"||c.status==="aborted")return S;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),s.set(l.value,c.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const o of i){const l=o.key,c=o.value;if(l.status==="aborted"||c.status==="aborted")return S;(l.status==="dirty"||c.status==="dirty")&&t.dirty(),s.set(l.value,c.value)}return{status:t.value,value:s}}}};Zt.create=(e,t,n)=>new Zt({valueType:t,keyType:e,typeName:C.ZodMap,...I(n)});var jt=class un extends T{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==y.set)return _(r,{code:p.invalid_type,expected:y.set,received:r.parsedType}),S;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(_(r,{code:p.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(_(r,{code:p.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const f of l){if(f.status==="aborted")return S;f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((l,c)=>i._parse(new re(r,l,r.path,c)));return r.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(t,n){return new un({...this._def,minSize:{value:t,message:x.toString(n)}})}max(t,n){return new un({...this._def,maxSize:{value:t,message:x.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};jt.create=(e,t)=>new jt({valueType:e,minSize:null,maxSize:null,typeName:C.ZodSet,...I(t)});var Ca=class bt extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==y.function)return _(n,{code:p.invalid_type,expected:y.function,received:n.parsedType}),S;function r(o,l){return St({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,wt(),Re].filter(c=>!!c),issueData:{code:p.invalid_arguments,argumentsError:l}})}function a(o,l){return St({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,wt(),Re].filter(c=>!!c),issueData:{code:p.invalid_return_type,returnTypeError:l}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Ze){const o=this;return U(async function(...l){const c=new ne([]),f=await o._def.args.parseAsync(l,i).catch(h=>{throw c.addIssue(r(l,h)),c}),d=await Reflect.apply(s,this,f);return await o._def.returns._def.type.parseAsync(d,i).catch(h=>{throw c.addIssue(a(d,h)),c})})}else{const o=this;return U(function(...l){const c=o._def.args.safeParse(l,i);if(!c.success)throw new ne([r(l,c.error)]);const f=Reflect.apply(s,this,c.data),d=o._def.returns.safeParse(f,i);if(!d.success)throw new ne([a(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new bt({...this._def,args:_e.create(t).rest(be.create())})}returns(t){return new bt({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new bt({args:t||_e.create([]).rest(be.create()),returns:n||be.create(),typeName:C.ZodFunction,...I(r)})}},qe=class extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};qe.create=(e,t)=>new qe({getter:e,typeName:C.ZodLazy,...I(t)});var Ke=class extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return _(t,{received:t.data,code:p.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(e,t)=>new Ke({value:e,typeName:C.ZodLiteral,...I(t)});function yn(e,t){return new et({values:e,typeName:C.ZodEnum,...I(t)})}var et=class fn extends T{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return _(n,{expected:A.joinValues(r),received:n.parsedType,code:p.invalid_type}),S}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return _(n,{received:n.data,code:p.invalid_enum_value,options:r}),S}return U(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return fn.create(t,{...this._def,...n})}exclude(t,n=this._def){return fn.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};et.create=yn;var tt=class extends T{_parse(e){const t=A.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==y.string&&n.parsedType!==y.number){const r=A.objectValues(t);return _(n,{expected:A.joinValues(r),received:n.parsedType,code:p.invalid_type}),S}if(this._cache||(this._cache=new Set(A.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=A.objectValues(t);return _(n,{received:n.data,code:p.invalid_enum_value,options:r}),S}return U(e.data)}get enum(){return this._def.values}};tt.create=(e,t)=>new tt({values:e,typeName:C.ZodNativeEnum,...I(t)});var Ze=class extends T{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);return t.parsedType!==y.promise&&t.common.async===!1?(_(t,{code:p.invalid_type,expected:y.promise,received:t.parsedType}),S):U((t.parsedType===y.promise?t.data:Promise.resolve(t.data)).then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ze.create=(e,t)=>new Ze({type:e,typeName:C.ZodPromise,...I(t)});var oe=class extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{_(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async s=>{if(t.value==="aborted")return S;const o=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return o.status==="aborted"?S:o.status==="dirty"||t.value==="dirty"?Me(o.value):o});{if(t.value==="aborted")return S;const s=this._def.schema._parseSync({data:i,path:n.path,parent:n});return s.status==="aborted"?S:s.status==="dirty"||t.value==="dirty"?Me(s.value):s}}if(r.type==="refinement"){const i=s=>{const o=r.refinement(s,a);if(n.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?S:(s.status==="dirty"&&t.dirty(),i(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?S:(s.status==="dirty"&&t.dirty(),i(s.value).then(()=>({status:t.value,value:s.value}))))}if(r.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ke(i))return S;const s=r.transform(i.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>ke(i)?Promise.resolve(r.transform(i.value,a)).then(s=>({status:t.value,value:s})):S);A.assertNever(r)}};oe.create=(e,t,n)=>new oe({schema:e,typeName:C.ZodEffects,effect:t,...I(n)}),oe.createWithPreprocess=(e,t,n)=>new oe({schema:t,effect:{type:"preprocess",transform:e},typeName:C.ZodEffects,...I(n)});var ce=class extends T{_parse(e){return this._getType(e)===y.undefined?U(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ce.create=(e,t)=>new ce({innerType:e,typeName:C.ZodOptional,...I(t)});var ve=class extends T{_parse(e){return this._getType(e)===y.null?U(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(e,t)=>new ve({innerType:e,typeName:C.ZodNullable,...I(t)});var nt=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};nt.create=(e,t)=>new nt({innerType:e,typeName:C.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...I(t)});var rt=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return He(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ne(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ne(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};rt.create=(e,t)=>new rt({innerType:e,typeName:C.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...I(t)});var Ot=class extends T{_parse(e){if(this._getType(e)!==y.nan){const t=this._getOrReturnCtx(e);return _(t,{code:p.invalid_type,expected:y.nan,received:t.parsedType}),S}return{status:"valid",value:e.data}}};Ot.create=e=>new Ot({typeName:C.ZodNaN,...I(e)});var kn=class extends T{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},bn=class Kr extends T{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?S:i.status==="dirty"?(n.dirty(),Me(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?S:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new Kr({in:t,out:n,typeName:C.ZodPipeline})}},at=class extends T{_parse(e){const t=this._def.innerType._parse(e),n=r=>(ke(r)&&(r.value=Object.freeze(r.value)),r);return He(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};at.create=(e,t)=>new at({innerType:e,typeName:C.ZodReadonly,...I(t)});var fc={object:Q.lazycreate},C;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(C||(C={}));var V=Ge.create,hc=It.create,mc=Ot.create,pc=Nt.create,Pt=Tt.create,gc=Lt.create,_c=At.create,vc=Ye.create,yc=Xe.create,kc=Et.create,Ia=be.create,bc=me.create,xc=Rt.create,wc=xe.create,Vt=Q.create,Sc=Q.strictCreate,Cc=Je.create,Ic=wa.create,Nc=Qe.create,Tc=_e.create,Na=Sa.create,Lc=Zt.create,Ac=jt.create,Ec=Ca.create,Rc=qe.create,Mc=Ke.create,xn=et.create,Zc=tt.create,jc=Ze.create,Oc=oe.create,Pc=ce.create,Vc=ve.create,$c=oe.createWithPreprocess,Fc=bn.create,Ta=Vt({mode:xn(["light","dark","system"]).optional(),accentColor:V().optional(),fontFamily:V().optional(),borderRadius:V().optional()}),La=Vt({externalId:V().optional(),authId:V().optional(),name:V().optional(),email:V().optional()}),wn=Vt({agentId:V().min(1,"agentId is required"),apiBaseUrl:V().url("apiBaseUrl must be a valid URL"),tenantId:V().optional(),user:La.optional(),sessionId:V().optional(),mode:xn(["floating","inline"]).optional(),title:V().optional(),subtitle:V().optional(),description:V().optional(),greeting:V().optional(),avatarUrl:V().optional(),privacyPolicyUrl:V().optional(),termsOfServiceUrl:V().optional(),streaming:Pt().optional(),preview:Pt().optional(),skipServerConfigFetch:Pt().optional(),metadata:Na(Ia()).optional(),theme:Ta.optional()}),Aa=wn.omit({agentId:!0,apiBaseUrl:!0}).partial(),ye={mode:"floating",streaming:!0,title:"AI Assistant",theme:{mode:"light",accentColor:"#6366f1",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",borderRadius:"12px"}};function je(e,t){wn.parse(e);let n;const r=t?{...t}:void 0;r&&typeof r.theme=="object"&&r.theme!==null?(n=r.theme,delete r.theme):r&&typeof r.theme=="string"&&(n={mode:r.theme},delete r.theme);const a=r?Aa.passthrough().safeParse(r).data:void 0,i=a?Sn(a,e):e,s={mode:i.theme?.mode??n?.mode??ye.theme.mode,accentColor:i.theme?.accentColor??n?.accentColor??ye.theme.accentColor,fontFamily:i.theme?.fontFamily??n?.fontFamily??ye.theme.fontFamily,borderRadius:i.theme?.borderRadius??n?.borderRadius??ye.theme.borderRadius};return{agentId:i.agentId,apiBaseUrl:i.apiBaseUrl.replace(/\/$/,""),tenantId:i.tenantId,user:{externalId:i.user?.externalId,authId:i.user?.authId,name:i.user?.name,email:i.user?.email},sessionId:i.sessionId,mode:i.mode??ye.mode,title:i.title??ye.title,subtitle:i.subtitle,description:i.description,greeting:i.greeting,avatarUrl:i.avatarUrl,privacyPolicyUrl:i.privacyPolicyUrl,termsOfServiceUrl:i.termsOfServiceUrl,streaming:i.streaming??ye.streaming,preview:i.preview===!0,skipServerConfigFetch:i.skipServerConfigFetch===!0,metadata:i.metadata??{},theme:s,thinkingEnabled:a?.thinkingEnabled===!0,thinkingViewable:a?.thinkingViewable===!0,photoSendingEnabled:a?.photoSendingEnabled===!0}}function Sn(e,t){const n={...e};for(const r of Object.keys(t)){const a=t[r];a!=null&&(typeof a=="object"&&!Array.isArray(a)&&n[r]!==null&&typeof n[r]=="object"?n[r]=Sn(n[r],a):n[r]=a)}return n}var $t=function(){return $t=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},$t.apply(this,arguments)};function ae(e,t,n,r){function a(i){return i instanceof n?i:new n(function(s){s(i)})}return new(n||(n=Promise))(function(i,s){function o(f){try{c(r.next(f))}catch(d){s(d)}}function l(f){try{c(r.throw(f))}catch(d){s(d)}}function c(f){f.done?i(f.value):a(f.value).then(o,l)}c((r=r.apply(e,t||[])).next())})}function ie(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,a,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(f){return l([c,f])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(n=0)),n;)try{if(r=1,a&&(i=c[0]&2?a.return:c[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,c[1])).done)return i;switch(a=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(f){c=[6,f],a=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Cn(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var In="4.6.2";function it(e,t){return new Promise(function(n){return setTimeout(n,e,t)})}function Ea(){return new Promise(function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})}function Ra(e,t){t===void 0&&(t=1/0);var n=window.requestIdleCallback;return n?new Promise(function(r){return n.call(window,function(){return r()},{timeout:t})}):it(Math.min(e,t))}function Nn(e){return!!e&&typeof e.then=="function"}function Tn(e,t){try{var n=e();Nn(n)?n.then(function(r){return t(!0,r)},function(r){return t(!1,r)}):t(!0,n)}catch(r){t(!1,r)}}function Ln(e,t,n){return n===void 0&&(n=16),ae(this,void 0,void 0,function(){var r,a,i,s;return ie(this,function(o){switch(o.label){case 0:r=Array(e.length),a=Date.now(),i=0,o.label=1;case 1:return i<e.length?(r[i]=t(e[i],i),s=Date.now(),s>=a+n?(a=s,[4,Ea()]):[3,3]):[3,4];case 2:o.sent(),o.label=3;case 3:return++i,[3,1];case 4:return[2,r]}})})}function Oe(e){return e.then(void 0,function(){}),e}function Ma(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return!0;return!1}function Za(e,t){return!Ma(e,t)}function Ft(e){return parseInt(e)}function q(e){return parseFloat(e)}function le(e,t){return typeof e=="number"&&isNaN(e)?t:e}function F(e){return e.reduce(function(t,n){return t+(n?1:0)},0)}function An(e,t){if(t===void 0&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function ja(e){for(var t,n,r="Unexpected syntax '".concat(e,"'"),a=/^\s*([a-z-]*)(.*)$/i.exec(e),i=a[1]||void 0,s={},o=/([.:#][\w-]+|\[.+?\])/gi,l=function(h,m){s[h]=s[h]||[],s[h].push(m)};;){var c=o.exec(a[2]);if(!c)break;var f=c[0];switch(f[0]){case".":l("class",f.slice(1));break;case"#":l("id",f.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(f);if(d)l(d[1],(n=(t=d[4])!==null&&t!==void 0?t:d[5])!==null&&n!==void 0?n:"");else throw new Error(r);break;default:throw new Error(r)}}return[i,s]}function Oa(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>127)return new TextEncoder().encode(e);t[n]=r}return t}function pe(e,t){var n=e[0]>>>16,r=e[0]&65535,a=e[1]>>>16,i=e[1]&65535,s=t[0]>>>16,o=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,f=0,d=0,h=0,m=0;m+=i+c,h+=m>>>16,m&=65535,h+=a+l,d+=h>>>16,h&=65535,d+=r+o,f+=d>>>16,d&=65535,f+=n+s,f&=65535,e[0]=f<<16|d,e[1]=h<<16|m}function J(e,t){var n=e[0]>>>16,r=e[0]&65535,a=e[1]>>>16,i=e[1]&65535,s=t[0]>>>16,o=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,f=0,d=0,h=0,m=0;m+=i*c,h+=m>>>16,m&=65535,h+=a*c,d+=h>>>16,h&=65535,h+=i*l,d+=h>>>16,h&=65535,d+=r*c,f+=d>>>16,d&=65535,d+=a*l,f+=d>>>16,d&=65535,d+=i*o,f+=d>>>16,d&=65535,f+=n*c+r*l+a*o+i*s,f&=65535,e[0]=f<<16|d,e[1]=h<<16|m}function Se(e,t){var n=e[0];t%=64,t===32?(e[0]=e[1],e[1]=n):t<32?(e[0]=n<<t|e[1]>>>32-t,e[1]=e[1]<<t|n>>>32-t):(t-=32,e[0]=e[1]<<t|n>>>32-t,e[1]=n<<t|e[1]>>>32-t)}function G(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function Z(e,t){e[0]^=t[0],e[1]^=t[1]}var Pa=[4283543511,3981806797],Va=[3301882366,444984403];function En(e){var t=[0,e[0]>>>1];Z(e,t),J(e,Pa),t[1]=e[0]>>>1,Z(e,t),J(e,Va),t[1]=e[0]>>>1,Z(e,t)}var st=[2277735313,289559509],ot=[1291169091,658871167],Rn=[0,5],$a=[0,1390208809],Fa=[0,944331445];function Wa(e,t){var n=Oa(e);t=t||0;var r=[0,n.length],a=r[1]%16,i=r[1]-a,s=[0,t],o=[0,t],l=[0,0],c=[0,0],f;for(f=0;f<i;f=f+16)l[0]=n[f+4]|n[f+5]<<8|n[f+6]<<16|n[f+7]<<24,l[1]=n[f]|n[f+1]<<8|n[f+2]<<16|n[f+3]<<24,c[0]=n[f+12]|n[f+13]<<8|n[f+14]<<16|n[f+15]<<24,c[1]=n[f+8]|n[f+9]<<8|n[f+10]<<16|n[f+11]<<24,J(l,st),Se(l,31),J(l,ot),Z(s,l),Se(s,27),pe(s,o),J(s,Rn),pe(s,$a),J(c,ot),Se(c,33),J(c,st),Z(o,c),Se(o,31),pe(o,s),J(o,Rn),pe(o,Fa);l[0]=0,l[1]=0,c[0]=0,c[1]=0;var d=[0,0];switch(a){case 15:d[1]=n[f+14],G(d,48),Z(c,d);case 14:d[1]=n[f+13],G(d,40),Z(c,d);case 13:d[1]=n[f+12],G(d,32),Z(c,d);case 12:d[1]=n[f+11],G(d,24),Z(c,d);case 11:d[1]=n[f+10],G(d,16),Z(c,d);case 10:d[1]=n[f+9],G(d,8),Z(c,d);case 9:d[1]=n[f+8],Z(c,d),J(c,ot),Se(c,33),J(c,st),Z(o,c);case 8:d[1]=n[f+7],G(d,56),Z(l,d);case 7:d[1]=n[f+6],G(d,48),Z(l,d);case 6:d[1]=n[f+5],G(d,40),Z(l,d);case 5:d[1]=n[f+4],G(d,32),Z(l,d);case 4:d[1]=n[f+3],G(d,24),Z(l,d);case 3:d[1]=n[f+2],G(d,16),Z(l,d);case 2:d[1]=n[f+1],G(d,8),Z(l,d);case 1:d[1]=n[f],Z(l,d),J(l,st),Se(l,31),J(l,ot),Z(s,l)}return Z(s,r),Z(o,r),pe(s,o),pe(o,s),En(s),En(o),pe(s,o),pe(o,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(o[0]>>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)}function Da(e){var t;return $t({name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
|
|
2
|
+
`)},e)}function za(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function Ua(e){return typeof e!="function"}function Ba(e,t){var n=Oe(new Promise(function(r){var a=Date.now();Tn(e.bind(null,t),function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var o=Date.now()-a;if(!i[0])return r(function(){return{error:i[1],duration:o}});var l=i[1];if(Ua(l))return r(function(){return{value:l,duration:o}});r(function(){return new Promise(function(c){var f=Date.now();Tn(l,function(){for(var d=[],h=0;h<arguments.length;h++)d[h]=arguments[h];var m=o+Date.now()-f;if(!d[0])return c({error:d[1],duration:m});c({value:d[1],duration:m})})})})})}));return function(){return n.then(function(a){return a()})}}function Ha(e,t,n,r){var a=Object.keys(e).filter(function(s){return Za(n,s)}),i=Oe(Ln(a,function(s){return Ba(e[s],t)},r));return function(){return ae(this,void 0,void 0,function(){var o,l,c,f,d;return ie(this,function(h){switch(h.label){case 0:return[4,i];case 1:return o=h.sent(),[4,Ln(o,function(m){return Oe(m())},r)];case 2:return l=h.sent(),[4,Promise.all(l)];case 3:for(c=h.sent(),f={},d=0;d<a.length;++d)f[a[d]]=c[d];return[2,f]}})})}}function Mn(){var e=window,t=navigator;return F(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function Ga(){var e=window,t=navigator;return F(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!Mn()}function Pe(){var e=window,t=navigator;return F(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function K(){var e=window,t=navigator;return F(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function Wt(){var e=window,t=e.HTMLElement,n=e.Document;return F(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),n&&"pointerLockElement"in n.prototype])>=4}function Ve(){var e=window;return za(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function Zn(){var e,t,n=window;return F(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function Ya(){var e=window;return F([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,""+e.Intl=="[object Intl]",""+e.Reflect=="[object Reflect]"])>=3}function Xa(){var e=window,t=e.URLPattern;return F(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function Ja(){var e=window;return F(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function $e(){var e=window,t=navigator,n=e.CSS,r=e.HTMLButtonElement;return F([!("getStorageUpdates"in t),r&&"popover"in r.prototype,"CSSCounterStyleRule"in e,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function Qa(){if(navigator.platform==="iPad")return!0;var e=screen,t=e.width/e.height;return F(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function qa(){var e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function Ka(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Dt(){var e=Pe(),t=Zn(),n=window,r=navigator,a="connection";return e?F([!("SharedWorker"in n),r[a]&&"ontypechange"in r[a],!("sinkId"in new Audio)])>=2:t?F(["onorientationchange"in n,"orientation"in n,/android/i.test(r.appVersion)])>=2:!1}function ei(){var e=navigator,t=window,n=Audio.prototype,r=t.visualViewport;return F(["srLatency"in n,"srChannelCount"in n,"devicePosture"in e,r&&"segments"in r,"getTextInformation"in Image.prototype])>=3}function ti(){return ai()?-4:ni()}function ni(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(ri())return-1;var n=4500,r=new t(1,5e3,44100),a=r.createOscillator();a.type="triangle",a.frequency.value=1e4;var i=r.createDynamicsCompressor();i.threshold.value=-50,i.knee.value=40,i.ratio.value=12,i.attack.value=0,i.release.value=.25,a.connect(i),i.connect(r.destination),a.start(0);var s=ii(r),o=s[0],l=s[1],c=Oe(o.then(function(f){return si(f.getChannelData(0).subarray(n))},function(f){if(f.name==="timeout"||f.name==="suspended")return-3;throw f}));return function(){return l(),c}}function ri(){return K()&&!Wt()&&!Ja()}function ai(){return K()&&$e()&&Ve()||Pe()&&ei()&&Xa()}function ii(e){var t=3,n=500,r=500,a=5e3,i=function(){};return[new Promise(function(s,o){var l=!1,c=0,f=0;e.oncomplete=function(m){return s(m.renderedBuffer)};var d=function(){setTimeout(function(){return o(jn("timeout"))},Math.min(r,f+a-Date.now()))},h=function(){try{var m=e.startRendering();switch(Nn(m)&&Oe(m),e.state){case"running":f=Date.now(),l&&d();break;case"suspended":document.hidden||c++,l&&c>=t?o(jn("suspended")):setTimeout(h,n);break}}catch(g){o(g)}};h(),i=function(){l||(l=!0,f>0&&d())}}),i]}function si(e){for(var t=0,n=0;n<e.length;++n)t+=Math.abs(e[n]);return t}function jn(e){var t=new Error(e);return t.name=e,t}function On(e,t,n){var r,a,i;return n===void 0&&(n=50),ae(this,void 0,void 0,function(){var s,o;return ie(this,function(l){switch(l.label){case 0:s=document,l.label=1;case 1:return s.body?[3,3]:[4,it(n)];case 2:return l.sent(),[3,1];case 3:o=s.createElement("iframe"),l.label=4;case 4:return l.trys.push([4,,10,11]),[4,new Promise(function(c,f){var d=!1,h=function(){d=!0,c()},m=function(b){d=!0,f(b)};o.onload=h,o.onerror=m;var g=o.style;g.setProperty("display","block","important"),g.position="absolute",g.top="0",g.left="0",g.visibility="hidden",t&&"srcdoc"in o?o.srcdoc=t:o.src="about:blank",s.body.appendChild(o);var w=function(){var b,v;d||(((v=(b=o.contentWindow)===null||b===void 0?void 0:b.document)===null||v===void 0?void 0:v.readyState)==="complete"?h():setTimeout(w,10))};w()})];case 5:l.sent(),l.label=6;case 6:return!((a=(r=o.contentWindow)===null||r===void 0?void 0:r.document)===null||a===void 0)&&a.body?[3,8]:[4,it(n)];case 7:return l.sent(),[3,6];case 8:return[4,e(o,o.contentWindow)];case 9:return[2,l.sent()];case 10:return(i=o.parentNode)===null||i===void 0||i.removeChild(o),[7];case 11:return[2]}})})}function oi(e){for(var t=ja(e),n=t[0],r=t[1],a=document.createElement(n??"div"),i=0,s=Object.keys(r);i<s.length;i++){var o=s[i],l=r[o].join(" ");o==="style"?ci(a.style,l):a.setAttribute(o,l)}return a}function ci(e,t){for(var n=0,r=t.split(";");n<r.length;n++){var a=r[n],i=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(a);if(i){var s=i[1],o=i[2],l=i[4];e.setProperty(s,o,l||"")}}}function li(){for(var e=window;;){var t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(n){if(n instanceof Error&&n.name==="SecurityError")return!0;throw n}e=t}}var di="mmMwWLliI0O&1",ui="48px",Ce=["monospace","sans-serif","serif"],Pn=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function fi(){var e=this;return On(function(t,n){var r=n.document;return ae(e,void 0,void 0,function(){var a,i,s,o,l,c,f,d,h,m,g,w;return ie(this,function(b){for(a=r.body,a.style.fontSize=ui,i=r.createElement("div"),i.style.setProperty("visibility","hidden","important"),s={},o={},l=function(v){var k=r.createElement("span"),R=k.style;return R.position="absolute",R.top="0",R.left="0",R.fontFamily=v,k.textContent=di,i.appendChild(k),k},c=function(v,k){return l("'".concat(v,"',").concat(k))},f=function(){return Ce.map(l)},d=function(){for(var v={},k=function(Y){v[Y]=Ce.map(function(X){return c(Y,X)})},R=0,P=Pn;R<P.length;R++){var D=P[R];k(D)}return v},h=function(v){return Ce.some(function(k,R){return v[R].offsetWidth!==s[k]||v[R].offsetHeight!==o[k]})},m=f(),g=d(),a.appendChild(i),w=0;w<Ce.length;w++)s[Ce[w]]=m[w].offsetWidth,o[Ce[w]]=m[w].offsetHeight;return[2,Pn.filter(function(v){return h(g[v])})]})})})}function hi(){var e=navigator.plugins;if(e){for(var t=[],n=0;n<e.length;++n){var r=e[n];if(r){for(var a=[],i=0;i<r.length;++i){var s=r[i];a.push({type:s.type,suffixes:s.suffixes})}t.push({name:r.name,description:r.description,mimeTypes:a})}}return t}}function mi(){return pi(xi())}function pi(e){var t,n=!1,r,a,i=gi(),s=i[0],o=i[1];return _i(s,o)?(n=vi(o),e?r=a="skipped":(t=yi(s,o),r=t[0],a=t[1])):r=a="unsupported",{winding:n,geometry:r,text:a}}function gi(){var e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function _i(e,t){return!!(t&&e.toDataURL)}function vi(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function yi(e,t){ki(e,t);var n=zt(e);return n!==zt(e)?["unstable","unstable"]:(bi(e,t),[zt(e),n])}function ki(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat("😃");t.fillText(n,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(n,4,45)}function bi(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(var n=0,r=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<r.length;n++){var a=r[n],i=a[0],s=a[1],o=a[2];t.fillStyle=i,t.beginPath(),t.arc(s,o,40,0,Math.PI*2,!0),t.closePath(),t.fill()}t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function zt(e){return e.toDataURL()}function xi(){return K()&&$e()&&Ve()}function wi(){var e=navigator,t=0,n;e.maxTouchPoints!==void 0?t=Ft(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),n=!0}catch{n=!1}var r="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:n,touchStart:r}}function Si(){return navigator.oscpu}function Ci(){var e=navigator,t=[],n=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(n!==void 0&&t.push([n]),Array.isArray(e.languages))Pe()&&Ya()||t.push(e.languages);else if(typeof e.languages=="string"){var r=e.languages;r&&t.push(r.split(","))}return t}function Ii(){return window.screen.colorDepth}function Ni(){return le(q(navigator.deviceMemory),void 0)}function Ti(){if(!(K()&&$e()&&Ve()))return Li()}function Li(){var e=screen,t=function(r){return le(Ft(r),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n}var Ai=2500,Ei=10,ct,Ut;function Ri(){if(Ut===void 0){var e=function(){var t=Bt();Ht(t)?Ut=setTimeout(e,Ai):(ct=t,Ut=void 0)};e()}}function Mi(){var e=this;return Ri(),function(){return ae(e,void 0,void 0,function(){var t;return ie(this,function(n){switch(n.label){case 0:return t=Bt(),Ht(t)?ct?[2,Cn([],ct,!0)]:qa()?[4,Ka()]:[3,2]:[3,2];case 1:n.sent(),t=Bt(),n.label=2;case 2:return Ht(t)||(ct=t),[2,t]}})})}}function Zi(){var e=this;if(K()&&$e()&&Ve())return function(){return Promise.resolve(void 0)};var t=Mi();return function(){return ae(e,void 0,void 0,function(){var n,r;return ie(this,function(a){switch(a.label){case 0:return[4,t()];case 1:return n=a.sent(),r=function(i){return i===null?null:An(i,Ei)},[2,[r(n[0]),r(n[1]),r(n[2]),r(n[3])]]}})})}}function Bt(){var e=screen;return[le(q(e.availTop),null),le(q(e.width)-q(e.availWidth)-le(q(e.availLeft),0),null),le(q(e.height)-q(e.availHeight)-le(q(e.availTop),0),null),le(q(e.availLeft),null)]}function Ht(e){for(var t=0;t<4;++t)if(e[t])return!1;return!0}function ji(){return le(Ft(navigator.hardwareConcurrency),void 0)}function Oi(){var e,t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){var n=new t().resolvedOptions().timeZone;if(n)return n}var r=-Pi();return"UTC".concat(r>=0?"+":"").concat(r)}function Pi(){var e=new Date().getFullYear();return Math.max(q(new Date(e,0,1).getTimezoneOffset()),q(new Date(e,6,1).getTimezoneOffset()))}function Vi(){try{return!!window.sessionStorage}catch{return!0}}function $i(){try{return!!window.localStorage}catch{return!0}}function Fi(){if(!(Mn()||Ga()))try{return!!window.indexedDB}catch{return!0}}function Wi(){return!!window.openDatabase}function Di(){return navigator.cpuClass}function zi(){var e=navigator.platform;return e==="MacIntel"&&K()&&!Wt()?Qa()?"iPad":"iPhone":e}function Ui(){return navigator.vendor||""}function Bi(){for(var e=[],t=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];t<n.length;t++){var r=n[t],a=window[r];a&&typeof a=="object"&&e.push(r)}return e.sort()}function Hi(){var e=document;try{e.cookie="cookietest=1; SameSite=Strict;";var t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function Gi(){var e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}function Yi(e){var t=(e===void 0?{}:e).debug;return ae(this,void 0,void 0,function(){var n,r,a,i,s,o;return ie(this,function(l){switch(l.label){case 0:return Xi()?(n=Gi(),r=Object.keys(n),a=(o=[]).concat.apply(o,r.map(function(c){return n[c]})),[4,Ji(a)]):[2,void 0];case 1:return i=l.sent(),t&&Qi(n,i),s=r.filter(function(c){var f=n[c];return F(f.map(function(d){return i[d]}))>f.length*.6}),s.sort(),[2,s]}})})}function Xi(){return K()||Dt()}function Ji(e){var t;return ae(this,void 0,void 0,function(){var n,r,a,i,l,s,o,l;return ie(this,function(c){switch(c.label){case 0:for(n=document,r=n.createElement("div"),a=new Array(e.length),i={},Vn(r),l=0;l<e.length;++l)s=oi(e[l]),s.tagName==="DIALOG"&&s.show(),o=n.createElement("div"),Vn(o),o.appendChild(s),r.appendChild(o),a[l]=s;c.label=1;case 1:return n.body?[3,3]:[4,it(50)];case 2:return c.sent(),[3,1];case 3:n.body.appendChild(r);try{for(l=0;l<e.length;++l)a[l].offsetParent||(i[e[l]]=!0)}finally{(t=r.parentNode)===null||t===void 0||t.removeChild(r)}return[2,i]}})})}function Vn(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function Qi(e,t){for(var n="DOM blockers debug:\n```",r=0,a=Object.keys(e);r<a.length;r++){var i=a[r];n+=`
|
|
3
|
+
`.concat(i,":");for(var s=0,o=e[i];s<o.length;s++){var l=o[s];n+=`
|
|
4
|
+
`.concat(t[l]?"🚫":"➡️"," ").concat(l)}}}function qi(){for(var e=0,t=["rec2020","p3","srgb"];e<t.length;e++){var n=t[e];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}}function Ki(){if($n("inverted"))return!0;if($n("none"))return!1}function $n(e){return matchMedia("(inverted-colors: ".concat(e,")")).matches}function es(){if(Fn("active"))return!0;if(Fn("none"))return!1}function Fn(e){return matchMedia("(forced-colors: ".concat(e,")")).matches}var ts=100;function ns(){if(matchMedia("(min-monochrome: 0)").matches){for(var e=0;e<=ts;++e)if(matchMedia("(max-monochrome: ".concat(e,")")).matches)return e;throw new Error("Too high value")}}function rs(){if(Ie("no-preference"))return 0;if(Ie("high")||Ie("more"))return 1;if(Ie("low")||Ie("less"))return-1;if(Ie("forced"))return 10}function Ie(e){return matchMedia("(prefers-contrast: ".concat(e,")")).matches}function as(){if(Wn("reduce"))return!0;if(Wn("no-preference"))return!1}function Wn(e){return matchMedia("(prefers-reduced-motion: ".concat(e,")")).matches}function is(){if(Dn("reduce"))return!0;if(Dn("no-preference"))return!1}function Dn(e){return matchMedia("(prefers-reduced-transparency: ".concat(e,")")).matches}function ss(){if(zn("high"))return!0;if(zn("standard"))return!1}function zn(e){return matchMedia("(dynamic-range: ".concat(e,")")).matches}var E=Math,W=function(){return 0};function os(){var e=E.acos||W,t=E.acosh||W,n=E.asin||W,r=E.asinh||W,a=E.atanh||W,i=E.atan||W,s=E.sin||W,o=E.sinh||W,l=E.cos||W,c=E.cosh||W,f=E.tan||W,d=E.tanh||W,h=E.exp||W,m=E.expm1||W,g=E.log1p||W,w=function(L){return E.pow(E.PI,L)},b=function(L){return E.log(L+E.sqrt(L*L-1))},v=function(L){return E.log(L+E.sqrt(L*L+1))},k=function(L){return E.log((1+L)/(1-L))/2},R=function(L){return E.exp(L)-1/E.exp(L)/2},P=function(L){return(E.exp(L)+1/E.exp(L))/2},D=function(L){return E.exp(L)-1},Y=function(L){return(E.exp(2*L)-1)/(E.exp(2*L)+1)},X=function(L){return E.log(1+L)};return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:b(1e154),asin:n(.12312423423423424),asinh:r(1),asinhPf:v(1),atanh:a(.5),atanhPf:k(.5),atan:i(.5),sin:s(-1e300),sinh:o(1),sinhPf:R(1),cos:l(10.000000000123),cosh:c(1),coshPf:P(1),tan:f(-1e300),tanh:d(1),tanhPf:Y(1),exp:h(1),expm1:m(1),expm1Pf:D(1),log1p:g(10),log1pPf:X(10),powPI:w(-100)}}var cs="mmMwWLliI0fiflO&1",Gt={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function ls(){return ds(function(e,t){for(var n={},r={},a=0,i=Object.keys(Gt);a<i.length;a++){var s=i[a],o=Gt[s],l=o[0],c=l===void 0?{}:l,f=o[1],d=f===void 0?cs:f,h=e.createElement("span");h.textContent=d,h.style.whiteSpace="nowrap";for(var m=0,g=Object.keys(c);m<g.length;m++){var w=g[m],b=c[w];b!==void 0&&(h.style[w]=b)}n[s]=h,t.append(e.createElement("br"),h)}for(var v=0,k=Object.keys(Gt);v<k.length;v++){var s=k[v];r[s]=n[s].getBoundingClientRect().width}return r})}function ds(e,t){return t===void 0&&(t=4e3),On(function(n,r){var a=r.document,i=a.body,s=i.style;s.width="".concat(t,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",Pe()?i.style.zoom="".concat(1/r.devicePixelRatio):K()&&(i.style.zoom="reset");var o=a.createElement("div");return o.textContent=Cn([],Array(t/20<<0),!0).map(function(){return"word"}).join(" "),i.appendChild(o),e(a,i)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function us(){return navigator.pdfViewerEnabled}function fs(){var e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function hs(){var e=window.ApplePaySession;if(typeof e?.canMakePayments!="function")return-1;if(ms())return-3;try{return e.canMakePayments()?1:0}catch(t){return ps(t)}}var ms=li;function ps(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function gs(){var e,t=document.createElement("a"),n=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return n===void 0?void 0:String(n)}var Un=-1,Bn=-2,_s=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),vs=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),ys=["FRAGMENT_SHADER","VERTEX_SHADER"],ks=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],Hn="WEBGL_debug_renderer_info",bs="WEBGL_polygon_mode";function xs(e){var t,n,r,a,i,s,o=e.cache,l=Gn(o);if(!l)return Un;if(!Jn(l))return Bn;var c=Xn()?null:l.getExtension(Hn);return{version:((t=l.getParameter(l.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((n=l.getParameter(l.VENDOR))===null||n===void 0?void 0:n.toString())||"",vendorUnmasked:c?(r=l.getParameter(c.UNMASKED_VENDOR_WEBGL))===null||r===void 0?void 0:r.toString():"",renderer:((a=l.getParameter(l.RENDERER))===null||a===void 0?void 0:a.toString())||"",rendererUnmasked:c?(i=l.getParameter(c.UNMASKED_RENDERER_WEBGL))===null||i===void 0?void 0:i.toString():"",shadingLanguageVersion:((s=l.getParameter(l.SHADING_LANGUAGE_VERSION))===null||s===void 0?void 0:s.toString())||""}}function ws(e){var t=e.cache,n=Gn(t);if(!n)return Un;if(!Jn(n))return Bn;var r=n.getSupportedExtensions(),a=n.getContextAttributes(),i=[],s=[],o=[],l=[],c=[];if(a)for(var f=0,d=Object.keys(a);f<d.length;f++){var h=d[f];s.push("".concat(h,"=").concat(a[h]))}for(var m=Yn(n),g=0,w=m;g<w.length;g++){var b=w[g],v=n[b];o.push("".concat(b,"=").concat(v).concat(_s.has(v)?"=".concat(n.getParameter(v)):""))}if(r)for(var k=0,R=r;k<R.length;k++){var P=R[k];if(!(P===Hn&&Xn()||P===bs&&Is())){var D=n.getExtension(P);if(!D){i.push(P);continue}for(var Y=0,X=Yn(D);Y<X.length;Y++){var b=X[Y],v=D[b];l.push("".concat(b,"=").concat(v).concat(vs.has(v)?"=".concat(n.getParameter(v)):""))}}}for(var L=0,z=ys;L<z.length;L++)for(var M=z[L],$=0,vt=ks;$<vt.length;$++){var yt=vt[$],uc=Ss(n,M,yt);c.push("".concat(M,".").concat(yt,"=").concat(uc.join(",")))}return l.sort(),o.sort(),{contextAttributes:s,parameters:o,shaderPrecisions:c,extensions:r,extensionParameters:l,unsupportedExtensions:i}}function Gn(e){if(e.webgl)return e.webgl.context;var t=document.createElement("canvas"),n;t.addEventListener("webglCreateContextError",function(){n=void 0});for(var r=0,a=["webgl","experimental-webgl"];r<a.length;r++){var i=a[r];try{n=t.getContext(i)}catch{}if(n)break}return e.webgl={context:n},n}function Ss(e,t,n){var r=e.getShaderPrecisionFormat(e[t],e[n]);return r?[r.rangeMin,r.rangeMax,r.precision]:[]}function Yn(e){return Object.keys(e.__proto__).filter(Cs)}function Cs(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function Xn(){return Zn()}function Is(){return Pe()||K()}function Jn(e){return typeof e.getParameter=="function"}function Ns(){if(!(Dt()||K()))return-2;if(!window.AudioContext)return-1;var e=new AudioContext().baseLatency;return e==null?-1:isFinite(e)?e:-3}function Ts(){if(!window.Intl)return-1;var e=window.Intl.DateTimeFormat;if(!e)return-2;var t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}var Ls={fonts:fi,domBlockers:Yi,fontPreferences:ls,audio:ti,screenFrame:Zi,canvas:mi,osCpu:Si,languages:Ci,colorDepth:Ii,deviceMemory:Ni,screenResolution:Ti,hardwareConcurrency:ji,timezone:Oi,sessionStorage:Vi,localStorage:$i,indexedDB:Fi,openDatabase:Wi,cpuClass:Di,platform:zi,plugins:hi,touchSupport:wi,vendor:Ui,vendorFlavors:Bi,cookiesEnabled:Hi,colorGamut:qi,invertedColors:Ki,forcedColors:es,monochrome:ns,contrast:rs,reducedMotion:as,reducedTransparency:is,hdr:ss,math:os,pdfViewerEnabled:us,architecture:fs,applePay:hs,privateClickMeasurement:gs,audioBaseLatency:Ns,dateTimeLocale:Ts,webGlBasics:xs,webGlExtensions:ws};function As(e){return Ha(Ls,e,[])}var Es="$ if upgrade to Pro: https://fpjs.dev/pro";function Rs(e){var t=Ms(e),n=Zs(t);return{score:t,comment:Es.replace(/\$/g,"".concat(n))}}function Ms(e){if(Dt())return .4;if(K())return Wt()&&!($e()&&Ve())?.5:.3;var t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function Zs(e){return An(.99+.01*e,1e-4)}function js(e){for(var t="",n=0,r=Object.keys(e).sort();n<r.length;n++){var a=r[n],i=e[a],s="error"in i?"error":JSON.stringify(i.value);t+="".concat(t?"|":"").concat(a.replace(/([:|\\])/g,"\\$1"),":").concat(s)}return t}function Os(e){return JSON.stringify(e,function(t,n){return n instanceof Error?Da(n):n},2)}function Qn(e){return Wa(js(e))}function Ps(e){var t;return{get visitorId(){return t===void 0&&(t=Qn(this.components)),t},set visitorId(n){t=n},confidence:Rs(e),components:e,version:In}}function Vs(e){return e===void 0&&(e=50),Ra(e,e*2)}function $s(e,t){var n=Date.now();return{get:function(r){return ae(this,void 0,void 0,function(){var a,i,s;return ie(this,function(o){switch(o.label){case 0:return a=Date.now(),[4,e()];case 1:return i=o.sent(),s=Ps(i),t||r?.debug,[2,s]}})})}}}function Fs(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(In,"/npm-monitoring"),!0),e.send()}catch{}}function Ws(e){var t;return e===void 0&&(e={}),ae(this,void 0,void 0,function(){var n,r,a;return ie(this,function(i){switch(i.label){case 0:return(!((t=e.monitoring)!==null&&t!==void 0)||t)&&Fs(),n=e.delayFallback,r=e.debug,[4,Vs(n)];case 1:return i.sent(),a=As({cache:{},debug:r}),[2,$s(a,r)]}})})}var Ds={load:Ws,hashComponents:Qn,componentsToDebugString:Os},zs=class{constructor(e,t={}){this.baseUrl=e,this.options=t}get credentials(){return this.options.preview?"include":"same-origin"}async validateWidget(e,t){if(!t)return{valid:!1,error:"Widget is not configured: tenantId is required"};try{const n=new URLSearchParams({agentId:e,tenantId:t}),r=await fetch(`${this.baseUrl}/v1/widget/validate?${n}`,{credentials:this.credentials}),a=await r.json();if(r.ok&&a.success)return{valid:!0,agentId:a.data.agentId,tenantId:a.data.tenantId};const i=a?.code==="AGENT_DISABLED"?"AGENT_DISABLED":r.status===404?"AGENT_NOT_FOUND":void 0;return{valid:!1,error:a.error??`Widget configuration is invalid (${r.status})`,...i?{code:i}:{}}}catch{return{valid:!1,error:"Unable to reach the AgentForge API to validate widget configuration"}}}async chat(e){const t=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e.agentId)}/responses`,{method:"POST",credentials:this.credentials,headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e.message,sessionId:e.sessionId,tenantId:e.tenantId,externalId:e.externalId,name:e.name,email:e.email,authId:e.authId,fingerprint:e.fingerprint,metadata:e.metadata,imageUrl:e.imageUrl})});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);const n=await t.json();if(!n.success)throw new Error(n.error??"Unknown API error");return{content:n.data?.text??"",sessionId:n.data?.sessionId,images:n.data?.images,queued:!!n.data?.queued,controlMode:n.data?.controlMode}}async fetchSessionMessages(e,t){try{const n=t?`?tenantId=${encodeURIComponent(t)}`:"",r=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/messages${n}`,{credentials:this.credentials});if(r.status===410||!r.ok)return null;const a=await r.json();return a.success?a.data?.messages??null:null}catch{return null}}async uploadImage(e,t,n,r,a){const i=await fetch(`${this.baseUrl}/v1/upload`,{method:"POST",credentials:this.credentials,headers:{"Content-Type":"application/json"},body:JSON.stringify({file:e,mimeType:t,fileName:n,agentId:r,tenantId:a})});if(!i.ok)throw new Error(`Upload error: ${i.status} ${i.statusText}`);const s=await i.json();if(!s.success)throw new Error(s.error??"Upload failed");return{url:s.data.url}}async fetchWidgetConfig(e,t){try{const n=t?`?tenantId=${encodeURIComponent(t)}`:"",r=await fetch(`${this.baseUrl}/v1/agents/${encodeURIComponent(e)}/widget-config${n}`,{credentials:this.credentials});if(!r.ok)return null;const a=await r.json();return a.success?a.data:null}catch{return null}}async endSession(e,t,n,r,a){const i=await fetch(`${this.baseUrl}/v1/sessions/${encodeURIComponent(e)}/end`,{method:"POST",credentials:this.credentials,headers:{"Content-Type":"application/json"},body:JSON.stringify({tenantId:t,agentId:n,fingerprint:r,externalId:a})});if(!i.ok)throw new Error(`Failed to end session: ${i.status} ${i.statusText}`);const s=await i.json();if(!s.success)throw new Error(s.error??"Failed to end session")}},Us=12e4;function Bs(e){return Promise.race([e.read(),new Promise((t,n)=>setTimeout(()=>n(new Error("Stream timed out — no data received for 120s")),Us))])}async function Hs(e,t,n,r={}){let a="",i="";try{const s=await fetch(`${e}/v1/agents/${encodeURIComponent(t.agentId)}/responses:stream`,{method:"POST",credentials:r.preview?"include":"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t.message,sessionId:t.sessionId,tenantId:t.tenantId,externalId:t.externalId,name:t.name,email:t.email,authId:t.authId,fingerprint:t.fingerprint,metadata:t.metadata,imageUrl:t.imageUrl})});if(!s.ok||!s.body){let h=`${s.status} ${s.statusText}`;try{const m=await s.json();m.error&&(h=m.error)}catch{}throw new Error(h)}const o=s.headers.get("x-session-id");o&&n.onSession&&n.onSession(o);const l=s.body.getReader(),c=new TextDecoder;let f="";const d=h=>{if(!h.startsWith("data: "))return!1;const m=h.slice(6).trim();if(!m)return!1;if(m==="[DONE]")return n.onEnd(a),!0;try{const g=JSON.parse(m);if(g.type==="session"){const b=g.sessionId;return b&&n.onSession&&n.onSession(b),!1}if(g.type==="done"||g.type==="stop")return n.onEnd(a),!0;if(g.type==="error")throw new Error(g.message??"Stream error");if(g.type==="images"){const b=g.images;return b&&n.onImages&&n.onImages(b),!1}if(g.type==="control_mode"){const b=g.mode,v=!!g.queued;return b&&n.onControlMode&&n.onControlMode(b,v),v?(n.onEnd(a),!0):!1}if(g.type==="thinking_chunk"){const b=g.content;return b&&n.onThinkingDelta&&(i+=b,n.onThinkingDelta(b,i)),!1}const w=Gs(g);w&&(a+=w,n.onDelta(w,a))}catch(g){if(!(g instanceof SyntaxError))throw g}return!1};e:for(;;){const{done:h,value:m}=await Bs(l);if(h)break;f+=c.decode(m,{stream:!0});const g=f.lastIndexOf(`
|
|
5
|
+
`);if(g===-1)continue;const w=f.slice(0,g);f=f.slice(g+1);for(const b of w.split(`
|
|
6
|
+
`))if(d(b))break e}n.onEnd(a)}catch(s){n.onError(s instanceof Error?s:new Error(String(s)))}}function Gs(e){const t=e.choices;if(Array.isArray(t)&&t.length>0){const a=t[0]?.delta,i=a?.content??a?.text??"";if(i)return i}const n=e.delta;if(n){const a=n.content??n.text??"";if(a)return a}const r=e.response;return r||(e.text??e.content??"")}var Ys=class{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(...e){const[t,n]=e;this.listeners.get(t)?.forEach(r=>r(n))}removeAllListeners(){this.listeners.clear()}},Xs="agentforge";function Yt(e){return`${Xs}:session:${e}`}function Js(e){try{return sessionStorage.getItem(Yt(e))??void 0}catch{return}}function lt(e,t){try{sessionStorage.setItem(Yt(e),t)}catch{}}function qn(e){try{sessionStorage.removeItem(Yt(e))}catch{}}function Ne(){return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`}var Qs=class{config;apiClient;state;fingerprint;eventSource=null;emitter;constructor(e,t,n){this.hostConfig=t,this.onStateChange=n,this.config=e,this.apiClient=new zs(e.apiBaseUrl,{preview:e.preview}),this.emitter=new Ys,this.initializeFingerprint();const r=e.sessionId??Js(e.agentId);e.sessionId&<(e.agentId,e.sessionId);const a=e.mode==="inline";this.state={isOpen:a,messages:[],isLoading:!1,error:null,sessionId:r,initStatus:"validating",initError:null},a&&queueMicrotask(()=>this.openWithGreeting())}async initializeFingerprint(){try{this.fingerprint=(await(await Ds.load()).get()).visitorId}catch{this.fingerprint=void 0}}getState(){return{...this.state,messages:[...this.state.messages]}}setOpen(e){e?this.openWithGreeting():this.setState({isOpen:!1})}openWithGreeting(){this.state.initStatus==="error"||this.state.initStatus==="disabled"||this.setState({isOpen:!0})}async hydrate(){const e=await this.apiClient.validateWidget(this.config.agentId,this.config.tenantId);if(!e.valid){if(e.code==="AGENT_DISABLED"){this.setState({initStatus:"disabled",initError:null});return}this.setState({initStatus:"error",initError:e.error});return}if(!this.config.skipServerConfigFetch){const r=await this.apiClient.fetchWidgetConfig(this.config.agentId,this.config.tenantId);r&&(this.config=je(this.hostConfig,r),this.onStateChange(this.getState(),this.config))}if(this.setState({initStatus:"ready"}),!this.state.sessionId)return;this.openEventStream();const t=await this.apiClient.fetchSessionMessages(this.state.sessionId,this.config.tenantId);if(t===null){this.handleSessionExpired();return}if(t.length===0)return;const n=t.map(r=>{const a=r.direction==="human";return{id:Ne(),role:r.role,content:r.content,images:r.images&&r.images.length>0?r.images:void 0,uploadedImageUrl:r.imageUrl||void 0,createdAt:r.createdAt??new Date().toISOString(),status:"sent",...a?{isHuman:!0,senderDisplay:r.senderDisplay??null}:{}}});this.setState({messages:[...this.state.messages,...n]})}openEventStream(){if(typeof EventSource>"u"||!this.state.sessionId||this.eventSource)return;const e=`${this.config.apiBaseUrl.replace(/\/$/,"")}/v1/sessions/${encodeURIComponent(this.state.sessionId)}/events`,t=new EventSource(e);t.onmessage=n=>{try{const r=JSON.parse(n.data);if(r.type==="control_mode"){const a=r.mode;this.setState({controlMode:a}),this.emitter.emit("control_mode_changed",{mode:a});return}if(r.type==="execution_state"){const a=r.state;a==="ai_thinking"||a==="ai_streaming"||a==="tool_running"?this.setState({isLoading:!0}):a==="idle"&&this.setState({isLoading:!1});return}if(r.type==="message"&&r.message&&typeof r.message=="object"){const a=r.message;if(typeof a.content!="string"||a.id&&this.state.messages.some(i=>i.id===a.id))return;if(a.direction==="human"){const i={id:a.id??Ne(),role:"assistant",content:a.content,createdAt:a.createdAt??new Date().toISOString(),status:"sent",isHuman:!0,senderDisplay:a.senderDisplay??null};this.setState({messages:[...this.state.messages,i],isLoading:!1}),this.emitter.emit("message:received",i);return}if(a.direction==="ai"){const i={id:a.id??Ne(),role:"assistant",content:a.content,createdAt:a.createdAt??new Date().toISOString(),status:"sent"};this.setState({messages:[...this.state.messages,i],isLoading:!1}),this.emitter.emit("message:received",i);return}}}catch{}},t.onerror=()=>{},this.eventSource=t}closeEventStream(){this.eventSource&&(this.eventSource.close(),this.eventSource=null)}setState(e){this.state={...this.state,...e},this.onStateChange(this.getState(),this.config)}updateMessage(e,t){this.state={...this.state,messages:this.state.messages.map(n=>n.id===e?{...n,...t}:n)},this.onStateChange(this.getState(),this.config)}async resetConversation(){if(this.state.sessionId)try{await this.apiClient.endSession(this.state.sessionId,this.config.tenantId,this.config.agentId,this.fingerprint,this.config.user.externalId)}catch{}qn(this.config.agentId),this.closeEventStream(),this.setState({sessionId:void 0,messages:[],isLoading:!1,error:null,controlMode:void 0}),this.emitter.emit("reset",void 0),this.state.isOpen&&this.openWithGreeting()}handleSessionExpired(){qn(this.config.agentId),this.closeEventStream(),this.setState({sessionId:void 0,controlMode:void 0})}async sendMessage(e,t){if(this.state.isLoading||!e.trim()&&!t||this.state.initStatus!=="ready")return;let n;if(t)try{const i=await qs(t);n=(await this.apiClient.uploadImage(i,t.type,t.name,this.config.agentId,this.config.tenantId)).url}catch(i){const s=i instanceof Error?i.message:"Image upload failed";this.setState({error:s});return}const r={id:Ne(),role:"user",content:e.trim(),uploadedImageUrl:n,createdAt:new Date().toISOString(),status:"sent"},a=!this.state.messages.some(i=>i.role==="user");this.setState({messages:[...this.state.messages,r],isLoading:!0,error:null}),this.emitter.emit("message:sent",r),a&&this.emitter.emit("conversation:started",{sessionId:this.state.sessionId}),this.config.streaming?await this.sendStreaming(e.trim(),n):await this.sendNonStreaming(e.trim(),n)}async sendNonStreaming(e,t,n=!1){try{const r=await this.apiClient.chat({agentId:this.config.agentId,message:e,sessionId:this.state.sessionId,tenantId:this.config.tenantId,externalId:this.config.user.externalId,name:this.config.user.name,email:this.config.user.email,authId:this.config.user.authId,fingerprint:this.fingerprint,metadata:this.config.metadata,imageUrl:t});if(r.queued&&r.controlMode==="human"){this.setState({isLoading:!1,controlMode:"human_takeover",...r.sessionId?{sessionId:r.sessionId}:{}}),r.sessionId&&(lt(this.config.agentId,r.sessionId),this.openEventStream());return}const a={id:Ne(),role:"assistant",content:r.content,images:r.images,createdAt:new Date().toISOString(),status:"sent"};this.setState({messages:[...this.state.messages,a],isLoading:!1,...r.sessionId?{sessionId:r.sessionId}:{}}),r.sessionId&&(lt(this.config.agentId,r.sessionId),this.openEventStream()),this.emitter.emit("message:received",a)}catch(r){const a=r instanceof Error?r.message:"Failed to send message";if(!n&&a.includes("410"))return this.handleSessionExpired(),this.sendNonStreaming(e,t,!0);this.setState({isLoading:!1,error:a}),this.emitter.emit("message:error",{error:a,message:null})}}async sendStreaming(e,t,n=!1){const r=Ne(),a={id:r,role:"assistant",content:"",createdAt:new Date().toISOString(),status:"streaming",isThinking:this.config.thinkingEnabled?!0:void 0};this.setState({messages:[...this.state.messages,a]}),this.emitter.emit("stream:start");let i=!1,s=!1;await Hs(this.config.apiBaseUrl,{agentId:this.config.agentId,message:e,sessionId:this.state.sessionId,tenantId:this.config.tenantId,externalId:this.config.user.externalId,name:this.config.user.name,email:this.config.user.email,authId:this.config.user.authId,fingerprint:this.fingerprint,metadata:this.config.metadata,imageUrl:t},{onSession:o=>{this.setState({sessionId:o}),lt(this.config.agentId,o),this.openEventStream()},onImages:o=>{this.updateMessage(r,{images:o})},onThinkingDelta:(o,l)=>{this.updateMessage(r,{thinking:l,isThinking:!0}),this.emitter.emit("thinking:delta",{delta:o,accumulated:l})},onDelta:(o,l)=>{this.updateMessage(r,{content:l,isThinking:!1}),this.emitter.emit("stream:delta",{delta:o,accumulated:l})},onEnd:o=>{if(s){this.setState({messages:this.state.messages.filter(c=>c.id!==r),isLoading:!1,controlMode:"human_takeover"}),this.emitter.emit("stream:end",{content:""});return}this.updateMessage(r,{content:o,status:"sent",isThinking:!1}),this.setState({isLoading:!1}),this.emitter.emit("stream:end",{content:o});const l=this.state.messages.find(c=>c.id===r);l&&(l.thinking&&this.emitter.emit("thinking:end",{content:l.thinking}),this.emitter.emit("message:received",l))},onControlMode:(o,l)=>{l&&o==="human"&&(s=!0)},onError:o=>{if(!n&&o.message.includes("410")){i=!0,this.setState({messages:this.state.messages.filter(f=>f.id!==r),isLoading:!1});return}const l=this.state.messages.find(f=>f.id===r)?.content??"",c=o.message||"Something went wrong. Please try again.";this.updateMessage(r,{content:l||c,status:"error"}),this.setState({isLoading:!1,error:c}),this.emitter.emit("message:error",{error:o.message,message:null})}},{preview:this.config.preview}),i&&(this.handleSessionExpired(),await this.sendStreaming(e,t,!0))}};function qs(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const a=r.result;t(a.split(",")[1]??"")},r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(e)})}function Ks(e){const t=document.createElement("div");t.setAttribute("data-agentkit-widget",""),e.appendChild(t);const n=t.attachShadow({mode:"open"}),r=document.createElement("style");n.appendChild(r);const a=document.createElement("div");return a.style.cssText="display: contents;",n.appendChild(a),{host:t,shadowRoot:n,styleSlot:r,mountPoint:a}}function eo(e,t){e.textContent=t}function to(e){e.remove()}function no(){const e=document.createElement("div");return e.setAttribute("data-agentkit-root","floating"),e.style.cssText=["position: fixed","bottom: 24px","right: 24px","z-index: 2147483647","pointer-events: none"].join("; "),document.body.appendChild(e),e}function ro(e){getComputedStyle(e).position==="static"&&(e.style.position="relative");const t=document.createElement("div");return t.setAttribute("data-agentkit-root","floating"),t.style.cssText=["position: absolute","bottom: 24px","right: 24px","z-index: 2147483647","pointer-events: none"].join("; "),e.appendChild(t),t}function ao(e){return e.setAttribute("data-agentkit-root","inline"),getComputedStyle(e).position==="static"&&(e.style.position="relative"),e}function io(e){e.remove()}function so(e){e.removeAttribute("data-agentkit-root")}function Kn(e,t,n,r,a){const i=e.mode==="inline";let s=!1;const o=i&&a?ao(a):!i&&a?ro(a):no(),l=Ks(o);eo(l.styleSlot,r);const c=new Qs(e,t,(h,m)=>{s||f.update(h,m)}),f=n(l.mountPoint,e,c.getState(),{onOpen:()=>d.open(),onClose:()=>d.close(),onSendMessage:(h,m)=>{c.sendMessage(h,m)},onReset:()=>{c.resetConversation()}});c.hydrate(),setTimeout(()=>{s||c.emitter.emit("ready",c.getState())},0);const d={open(){s||(c.setOpen(!0),c.emitter.emit("open"))},close(){s||(c.setOpen(!1),c.emitter.emit("close"))},toggle(){c.getState().isOpen?d.close():d.open()},async sendMessage(h,m){await c.sendMessage(h,m)},reset(){s||(c.resetConversation(),c.emitter.emit("reset"))},destroy(){s||(s=!0,f.destroy(),to(l.host),i&&a?so(a):io(o),c.emitter.emit("destroy"),c.emitter.removeAllListeners())},on(h,m){c.emitter.on(h,m)},off(h,m){c.emitter.off(h,m)},getState(){return c.getState()}};return d}var Fe=new Map,oo=0;function er(e){const t=`agentkit-widget-${++oo}`,n=e.destroy.bind(e);return e.destroy=()=>{Fe.delete(t),n()},Fe.set(t,e),t}function co(e,t,n){const r={...e,mode:"floating"},a=Kn(je(r),r,t,n);return er(a),a}function lo(e,t,n,r){const a={...t,mode:"inline"},i=Kn(je(a),a,n,r,e);return er(i),i}function uo(e){e?Fe.get(e)?.destroy():(Fe.forEach(t=>t.destroy()),Fe.clear())}var dt,N,tr,fo,ge,nr,rr,ar,ir,Xt,Jt,Qt,ho,ut={},ft=[],mo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,We=Array.isArray;function de(e,t){for(var n in t)e[n]=t[n];return e}function qt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function De(e,t,n){var r,a,i,s={};for(i in t)i=="key"?r=t[i]:i=="ref"?a=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?dt.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return ht(e,s,r,a,null)}function ht(e,t,n,r,a){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++tr,__i:-1,__u:0};return a==null&&N.vnode!=null&&N.vnode(i),i}function B(e){return e.children}function ue(e,t){this.props=e,this.context=t}function Te(e,t){if(t==null)return e.__?Te(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Te(e):null}function po(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],i=de({},t);i.__v=t.__v+1,N.vnode&&N.vnode(i),Kt(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Te(t),!!(32&t.__u),a),i.__v=t.__v,i.__.__k[i.__i]=i,fr(r,i,a),t.__e=t.__=null,i.__e!=n&&sr(i)}}function sr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),sr(e)}function or(e){(!e.__d&&(e.__d=!0)&&ge.push(e)&&!mt.__r++||nr!=N.debounceRendering)&&((nr=N.debounceRendering)||rr)(mt)}function mt(){try{for(var e,t=1;ge.length;)ge.length>t&&ge.sort(ar),e=ge.shift(),t=ge.length,po(e)}finally{ge.length=mt.__r=0}}function cr(e,t,n,r,a,i,s,o,l,c,f){var d,h,m,g,w,b,v,k=r&&r.__k||ft,R=t.length;for(l=go(n,t,k,l,R),d=0;d<R;d++)(m=n.__k[d])!=null&&(h=m.__i!=-1&&k[m.__i]||ut,m.__i=d,b=Kt(e,m,h,a,i,s,o,l,c,f),g=m.__e,m.ref&&h.ref!=m.ref&&(h.ref&&tn(h.ref,null,m),f.push(m.ref,m.__c||g,m)),w==null&&g!=null&&(w=g),(v=!!(4&m.__u))||h.__k===m.__k?l=lr(m,l,e,v):typeof m.type=="function"&&b!==void 0?l=b:g&&(l=g.nextSibling),m.__u&=-7);return n.__e=w,l}function go(e,t,n,r,a){var i,s,o,l,c,f=n.length,d=f,h=0;for(e.__k=new Array(a),i=0;i<a;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[i]=ht(null,s,null,null,null):We(s)?s=e.__k[i]=ht(B,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=ht(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+h,s.__=e,s.__b=e.__b+1,o=null,(c=s.__i=_o(s,n,l,d))!=-1&&(d--,(o=n[c])&&(o.__u|=2)),o==null||o.__v==null?(c==-1&&(a>f?h--:a<f&&h++),typeof s.type!="function"&&(s.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;i<f;i++)(o=n[i])!=null&&(2&o.__u)==0&&(o.__e==r&&(r=Te(o)),mr(o,o));return r}function lr(e,t,n,r){var a,i;if(typeof e.type=="function"){for(a=e.__k,i=0;a&&i<a.length;i++)a[i]&&(a[i].__=e,t=lr(a[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Te(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function fe(e,t){return t=t||[],e==null||typeof e=="boolean"||(We(e)?e.some(function(n){fe(n,t)}):t.push(e)),t}function _o(e,t,n,r){var a,i,s,o=e.key,l=e.type,c=t[n],f=c!=null&&(2&c.__u)==0;if(c===null&&o==null||f&&o==c.key&&l==c.type)return n;if(r>(f?1:0)){for(a=n-1,i=n+1;a>=0||i<t.length;)if((c=t[s=a>=0?a--:i++])!=null&&(2&c.__u)==0&&o==c.key&&l==c.type)return s}return-1}function dr(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||mo.test(t)?n:n+"px"}function pt(e,t,n,r,a){var i,s;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||dr(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||dr(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(ir,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n.u=r.u:(n.u=Xt,e.addEventListener(t,i?Qt:Jt,i)):e.removeEventListener(t,i?Qt:Jt,i);else{if(a=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function ur(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=Xt++;else if(t.t<n.u)return;return n(N.event?N.event(t):t)}}}function Kt(e,t,n,r,a,i,s,o,l,c){var f,d,h,m,g,w,b,v,k,R,P,D,Y,X,L,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[o=t.__e=n.__e]),(f=N.__b)&&f(t);e:if(typeof z=="function")try{if(v=t.props,k=z.prototype&&z.prototype.render,R=(f=z.contextType)&&r[f.__c],P=f?R?R.props.value:f.__:r,n.__c?b=(d=t.__c=n.__c).__=d.__E:(k?t.__c=d=new z(v,P):(t.__c=d=new ue(v,P),d.constructor=z,d.render=yo),R&&R.sub(d),d.state||(d.state={}),d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),k&&d.__s==null&&(d.__s=d.state),k&&z.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=de({},d.__s)),de(d.__s,z.getDerivedStateFromProps(v,d.__s))),m=d.props,g=d.state,d.__v=t,h)k&&z.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),k&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(k&&z.getDerivedStateFromProps==null&&v!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,P),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(v,d.__s,P)===!1){t.__v!=n.__v&&(d.props=v,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(M){M&&(M.__=t)}),ft.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,P),k&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,w)})}if(d.context=P,d.props=v,d.__P=e,d.__e=!1,D=N.__r,Y=0,k)d.state=d.__s,d.__d=!1,D&&D(t),f=d.render(d.props,d.state,d.context),ft.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(t),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++Y<25);d.state=d.__s,d.getChildContext!=null&&(r=de(de({},r),d.getChildContext())),k&&!h&&d.getSnapshotBeforeUpdate!=null&&(w=d.getSnapshotBeforeUpdate(m,g)),X=f!=null&&f.type===B&&f.key==null?hr(f.props.children):f,o=cr(e,We(X)?X:[X],t,n,r,a,i,s,o,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),b&&(d.__E=d.__=null)}catch(M){if(t.__v=null,l||i!=null)if(M.then){for(t.__u|=l?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;i[i.indexOf(o)]=null,t.__e=o}else{for(L=i.length;L--;)qt(i[L]);en(t)}else t.__e=n.__e,t.__k=n.__k,M.then||en(t);N.__e(M,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):o=t.__e=vo(n.__e,t,n,r,a,i,s,l,c);return(f=N.diffed)&&f(t),128&t.__u?void 0:o}function en(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(en))}function fr(e,t,n){for(var r=0;r<n.length;r++)tn(n[r],n[++r],n[++r]);N.__c&&N.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(i){i.call(a)})}catch(i){N.__e(i,a.__v)}})}function hr(e){return typeof e!="object"||e==null||e.__b>0?e:We(e)?e.map(hr):de({},e)}function vo(e,t,n,r,a,i,s,o,l){var c,f,d,h,m,g,w,b=n.props||ut,v=t.props,k=t.type;if(k=="svg"?a="http://www.w3.org/2000/svg":k=="math"?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((m=i[c])&&"setAttribute"in m==!!k&&(k?m.localName==k:m.nodeType==3)){e=m,i[c]=null;break}}if(e==null){if(k==null)return document.createTextNode(v);e=document.createElementNS(a,k,v.is&&v),o&&(N.__m&&N.__m(t,i),o=!1),i=null}if(k==null)b===v||o&&e.data==v||(e.data=v);else{if(i=i&&dt.call(e.childNodes),!o&&i!=null)for(b={},c=0;c<e.attributes.length;c++)b[(m=e.attributes[c]).name]=m.value;for(c in b)m=b[c],c=="dangerouslySetInnerHTML"?d=m:c=="children"||c in v||c=="value"&&"defaultValue"in v||c=="checked"&&"defaultChecked"in v||pt(e,c,null,m,a);for(c in v)m=v[c],c=="children"?h=m:c=="dangerouslySetInnerHTML"?f=m:c=="value"?g=m:c=="checked"?w=m:o&&typeof m!="function"||b[c]===m||pt(e,c,m,b[c],a);if(f)o||d&&(f.__html==d.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(d&&(e.innerHTML=""),cr(t.type=="template"?e.content:e,We(h)?h:[h],t,n,r,k=="foreignObject"?"http://www.w3.org/1999/xhtml":a,i,s,i?i[0]:n.__k&&Te(n,0),o,l),i!=null)for(c=i.length;c--;)qt(i[c]);o||(c="value",k=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[c]||k=="progress"&&!g||k=="option"&&g!=b[c])&&pt(e,c,g,b[c],a),c="checked",w!=null&&w!=e[c]&&pt(e,c,w,b[c],a))}return e}function tn(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(a){N.__e(a,n)}}function mr(e,t,n){var r,a;if(N.unmount&&N.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||tn(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){N.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&mr(r[a],t,n||typeof e.type!="function");n||qt(e.__e),e.__c=e.__=e.__e=void 0}function yo(e,t,n){return this.constructor(e,n)}function pr(e,t,n){var r,a,i,s;t==document&&(t=document.documentElement),N.__&&N.__(e,t),a=(r=typeof n=="function")?null:n&&n.__k||t.__k,i=[],s=[],Kt(t,e=(!r&&n||t).__k=De(B,null,[e]),a||ut,ut,t.namespaceURI,!r&&n?[n]:a?null:t.firstChild?dt.call(t.childNodes):null,i,!r&&n?n:a?a.__e:t.firstChild,r,s),fr(i,e,s)}dt=ft.slice,N={__e:function(e,t,n,r){for(var a,i,s;t=t.__;)if((a=t.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(e)),s=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),s=a.__d),s)return a.__E=a}catch(o){e=o}throw e}},tr=0,fo=function(e){return e!=null&&e.constructor===void 0},ue.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=de({},this.state);typeof e=="function"&&(e=e(de({},n),this.props)),e&&de(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),or(this))},ue.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),or(this))},ue.prototype.render=B,ge=[],rr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ar=function(e,t){return e.__v.__b-t.__v.__b},mt.__r=0,ir=/(PointerCapture)$|Capture$/i,Xt=0,Jt=ur(!1),Qt=ur(!0),ho=0;var ze,j,nn,gr,Ue=0,_r=[],O=N,vr=O.__b,yr=O.__r,kr=O.diffed,br=O.__c,xr=O.unmount,wr=O.__;function rn(e,t){O.__h&&O.__h(j,e,Ue||t),Ue=0;var n=j.__H||(j.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Le(e){return Ue=1,ko(Ir,e)}function ko(e,t,n){var r=rn(ze++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ir(void 0,t),function(o){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,o);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=j,!j.__f)){var a=function(o,l,c){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(h){return h.__c});if(f.every(function(h){return!h.__N}))return!i||i.call(this,o,l,c);var d=r.__c.props!==o;return f.some(function(h){if(h.__N){var m=h.__[0];h.__=h.__N,h.__N=void 0,m!==h.__[0]&&(d=!0)}}),i&&i.call(this,o,l,c)||d};j.__f=!0;var i=j.shouldComponentUpdate,s=j.componentWillUpdate;j.componentWillUpdate=function(o,l,c){if(this.__e){var f=i;i=void 0,a(o,l,c),i=f}s&&s.call(this,o,l,c)},j.shouldComponentUpdate=a}return r.__N||r.__}function Ae(e,t){var n=rn(ze++,3);!O.__s&&Cr(n.__H,t)&&(n.__=e,n.u=t,j.__H.__h.push(n))}function Ee(e){return Ue=5,an(function(){return{current:e}},[])}function an(e,t){var n=rn(ze++,7);return Cr(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function bo(e,t){return Ue=8,an(function(){return e},t)}function xo(){for(var e;e=_r.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(gt),t.__h.some(sn),t.__h=[]}catch(n){t.__h=[],O.__e(n,e.__v)}}}O.__b=function(e){j=null,vr&&vr(e)},O.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),wr&&wr(e,t)},O.__r=function(e){yr&&yr(e),ze=0;var t=(j=e.__c).__H;t&&(nn===j?(t.__h=[],j.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(gt),t.__h.some(sn),t.__h=[],ze=0)),nn=j},O.diffed=function(e){kr&&kr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(_r.push(t)!==1&&gr===O.requestAnimationFrame||((gr=O.requestAnimationFrame)||wo)(xo)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),nn=j=null},O.__c=function(e,t){t.some(function(n){try{n.__h.some(gt),n.__h=n.__h.filter(function(r){return!r.__||sn(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],O.__e(r,n.__v)}}),br&&br(e,t)},O.unmount=function(e){xr&&xr(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{gt(r)}catch(a){t=a}}),n.__H=void 0,t&&O.__e(t,n.__v))};var Sr=typeof requestAnimationFrame=="function";function wo(e){var t,n=function(){clearTimeout(r),Sr&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Sr&&(t=requestAnimationFrame(n))}function gt(e){var t=j,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),j=t}function sn(e){var t=j;e.__c=e.__(),j=t}function Cr(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ir(e,t){return typeof t=="function"?t(e):t}function So(e,t){for(var n in t)e[n]=t[n];return e}function Nr(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function Tr(e,t){this.props=e,this.context=t}(Tr.prototype=new ue).isPureReactComponent=!0,Tr.prototype.shouldComponentUpdate=function(e,t){return Nr(this.props,e)||Nr(this.state,t)};var Lr=N.__b;N.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Lr&&Lr(e)};var Wc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911,Ar=function(e,t){return e==null?null:fe(fe(e).map(t))},Dc={map:Ar,forEach:Ar,count:function(e){return e?fe(e).length:0},only:function(e){var t=fe(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:fe},Co=N.__e;N.__e=function(e,t,n,r){if(e.then){for(var a,i=t;i=i.__;)if((a=i.__c)&&a.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k),a.__c(e,t)}Co(e,t,n,r)};var Er=N.unmount;function Rr(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=So({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Rr(r,t,n)})),e}function Mr(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Mr(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function on(){this.__u=0,this.o=null,this.__b=null}function Zr(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function _t(){this.i=null,this.l=null}N.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Er&&Er(e)},(on.prototype=new ue).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var a=Zr(r.__v),i=!1,s=function(){i||r.__z||(i=!0,n.__R=null,a?a(l):l())};n.__R=s;var o=n.__P;n.__P=null;var l=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=Mr(c,c.__c.__P,c.__c.__O)}var f;for(r.setState({__a:r.__b=null});f=r.o.pop();)f.__P=o,f.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},on.prototype.componentWillUnmount=function(){this.o=[]},on.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Rr(this.__b,n,r.__O=r.__P)}this.__b=null}var a=t.__a&&De(B,null,e.fallback);return a&&(a.__u&=-33),[De(B,null,t.__a?null:e.children),a]};var jr=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(_t.prototype=new ue).__a=function(e){var t=this,n=Zr(t.__v),r=t.l.get(e);return r[0]++,function(a){var i=function(){t.props.revealOrder?(r.push(a),jr(t,e,r)):a()};n?n(i):i()}},_t.prototype.render=function(e){this.i=null,this.l=new Map;var t=fe(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},_t.prototype.componentDidUpdate=_t.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){jr(e,n,t)})};var Io=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,No=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,To=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Lo=/[A-Z0-9]/g,Ao=typeof document<"u",Eo=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Ro(e,t,n){return t.__k??(t.textContent=""),pr(e,t),typeof n=="function"&&n(),e?e.__c:null}ue.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(ue.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Or=N.event;N.event=function(e){return Or&&(e=Or(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Pr,Mo={configurable:!0,get:function(){return this.class}},Vr=N.vnode;N.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,r=t.type,a={},i=r.indexOf("-")==-1;for(var s in n){var o=n[s];if(!(s==="value"&&"defaultValue"in n&&o==null||Ao&&s==="children"&&r==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&o===!0?o="":l==="translate"&&o==="no"?o=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||Eo(n.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":To.test(s)&&(s=l):l=s="oninput":i&&No.test(s)?s=s.replace(Lo,"-$&").toLowerCase():o===null&&(o=void 0),l==="oninput"&&a[s=l]&&(s="oninputCapture"),a[s]=o}}r=="select"&&(a.multiple&&Array.isArray(a.value)&&(a.value=fe(n.children).forEach(function(c){c.props.selected=a.value.indexOf(c.props.value)!=-1})),a.defaultValue!=null&&(a.value=fe(n.children).forEach(function(c){c.props.selected=a.multiple?a.defaultValue.indexOf(c.props.value)!=-1:a.defaultValue==c.props.value}))),n.class&&!n.className?(a.class=n.class,Object.defineProperty(a,"className",Mo)):n.className&&(a.class=a.className=n.className),t.props=a})(e),e.$$typeof=Io,Vr&&Vr(e)};var $r=N.__r;N.__r=function(e){$r&&$r(e),Pr=e.__c};var Fr=N.diffed;N.diffed=function(e){Fr&&Fr(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),Pr=null};function Zo(e){return!!e.__k&&(pr(null,e),!0)}function jo(e){return{render:function(t){Ro(t,e)},unmount:function(){Zo(e)}}}function Oo(e){const{theme:t}=e,n=[`--ak-accent: ${t.accentColor}`,`--ak-font: ${t.fontFamily}`,`--ak-radius: ${t.borderRadius}`];return n.push(`--ak-accent-hover: color-mix(in srgb, ${t.accentColor} 85%, black)`),`:host { ${n.join("; ")} }`}function Po(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Vo=`
|
|
7
7
|
*, *::before, *::after {
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
margin: 0;
|
|
@@ -22,6 +22,9 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
22
22
|
--ak-user-text: #ffffff;
|
|
23
23
|
--ak-bot-bg: #f3f4f6;
|
|
24
24
|
--ak-bot-text: #111827;
|
|
25
|
+
--ak-maintenance-fg: #92400e;
|
|
26
|
+
--ak-maintenance-bg: #fffbeb;
|
|
27
|
+
--ak-maintenance-halo: #fcd34d;
|
|
25
28
|
--ak-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
26
29
|
--ak-radius: 12px;
|
|
27
30
|
--ak-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08);
|
|
@@ -39,6 +42,9 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
39
42
|
--ak-border: #374151;
|
|
40
43
|
--ak-bot-bg: #374151;
|
|
41
44
|
--ak-bot-text: #f9fafb;
|
|
45
|
+
--ak-maintenance-fg: #fde68a;
|
|
46
|
+
--ak-maintenance-bg: rgba(253, 230, 138, 0.06);
|
|
47
|
+
--ak-maintenance-halo: #f59e0b;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
/* ── Floating layout ─────────────────────────────────────────── */
|
|
@@ -356,7 +362,7 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
356
362
|
flex-direction: column;
|
|
357
363
|
align-items: center;
|
|
358
364
|
justify-content: center;
|
|
359
|
-
padding: 0;
|
|
365
|
+
padding: 0 16px;
|
|
360
366
|
text-align: center;
|
|
361
367
|
gap: 16px;
|
|
362
368
|
overflow-y: auto;
|
|
@@ -386,6 +392,7 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
386
392
|
align-items: center;
|
|
387
393
|
gap: 8px;
|
|
388
394
|
position: relative;
|
|
395
|
+
width: 100%;
|
|
389
396
|
}
|
|
390
397
|
.ak-empty-state__avatar {
|
|
391
398
|
width: 64px;
|
|
@@ -427,13 +434,12 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
427
434
|
font-size: 13px;
|
|
428
435
|
color: var(--ak-text-muted);
|
|
429
436
|
line-height: 1.55;
|
|
430
|
-
|
|
437
|
+
width: 100%;
|
|
431
438
|
}
|
|
432
439
|
/* Quoted greeting block */
|
|
433
440
|
.ak-empty-state__quote {
|
|
434
441
|
position: relative;
|
|
435
|
-
|
|
436
|
-
width: calc(100% - 32px);
|
|
442
|
+
width: 100%;
|
|
437
443
|
background: color-mix(in srgb, var(--ak-accent) 6%, var(--ak-bg));
|
|
438
444
|
border: 1px solid color-mix(in srgb, var(--ak-accent) 18%, var(--ak-border));
|
|
439
445
|
border-radius: 12px;
|
|
@@ -505,12 +511,71 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
505
511
|
color: #991b1b;
|
|
506
512
|
border-color: #fca5a5;
|
|
507
513
|
}
|
|
514
|
+
.ak-message--operator .ak-message__bubble--operator {
|
|
515
|
+
background: color-mix(in srgb, var(--ak-accent) 8%, var(--ak-bot-bg));
|
|
516
|
+
border: 1px solid color-mix(in srgb, var(--ak-accent) 22%, var(--ak-border));
|
|
517
|
+
}
|
|
508
518
|
.ak-message__time {
|
|
509
519
|
font-size: 11px;
|
|
510
520
|
color: var(--ak-text-muted);
|
|
511
521
|
margin-top: 3px;
|
|
512
522
|
padding: 0 4px;
|
|
513
523
|
}
|
|
524
|
+
.ak-message__sender-label {
|
|
525
|
+
font-size: 11px;
|
|
526
|
+
font-weight: 500;
|
|
527
|
+
color: var(--ak-text-muted);
|
|
528
|
+
display: inline-flex;
|
|
529
|
+
align-items: center;
|
|
530
|
+
gap: 6px;
|
|
531
|
+
padding: 0 2px;
|
|
532
|
+
margin-bottom: 4px;
|
|
533
|
+
}
|
|
534
|
+
.ak-message--operator .ak-message__sender-label {
|
|
535
|
+
color: var(--ak-accent);
|
|
536
|
+
font-weight: 600;
|
|
537
|
+
}
|
|
538
|
+
.ak-message__operator-avatar {
|
|
539
|
+
display: inline-flex;
|
|
540
|
+
align-items: center;
|
|
541
|
+
justify-content: center;
|
|
542
|
+
width: 18px;
|
|
543
|
+
height: 18px;
|
|
544
|
+
border-radius: 50%;
|
|
545
|
+
background: var(--ak-accent);
|
|
546
|
+
color: #fff;
|
|
547
|
+
font-size: 10px;
|
|
548
|
+
font-weight: 700;
|
|
549
|
+
line-height: 1;
|
|
550
|
+
flex-shrink: 0;
|
|
551
|
+
}
|
|
552
|
+
.ak-message__operator-name {
|
|
553
|
+
line-height: 1;
|
|
554
|
+
}
|
|
555
|
+
.ak-handoff-divider {
|
|
556
|
+
display: flex;
|
|
557
|
+
align-items: center;
|
|
558
|
+
gap: 10px;
|
|
559
|
+
margin: 8px 4px;
|
|
560
|
+
color: var(--ak-text-muted);
|
|
561
|
+
font-size: 11px;
|
|
562
|
+
font-weight: 500;
|
|
563
|
+
}
|
|
564
|
+
.ak-handoff-divider::before,
|
|
565
|
+
.ak-handoff-divider::after {
|
|
566
|
+
content: '';
|
|
567
|
+
flex: 1;
|
|
568
|
+
height: 1px;
|
|
569
|
+
background: var(--ak-border);
|
|
570
|
+
}
|
|
571
|
+
.ak-handoff-divider__label {
|
|
572
|
+
white-space: nowrap;
|
|
573
|
+
padding: 2px 8px;
|
|
574
|
+
border-radius: 999px;
|
|
575
|
+
background: color-mix(in srgb, var(--ak-accent) 6%, var(--ak-bg));
|
|
576
|
+
border: 1px solid color-mix(in srgb, var(--ak-accent) 14%, var(--ak-border));
|
|
577
|
+
color: color-mix(in srgb, var(--ak-accent) 70%, var(--ak-text));
|
|
578
|
+
}
|
|
514
579
|
/* ── Message avatar (assistant only, when avatarUrl is set) ─── */
|
|
515
580
|
.ak-message--with-avatar {
|
|
516
581
|
flex-direction: row;
|
|
@@ -655,6 +720,9 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
655
720
|
.ak-init-status--error {
|
|
656
721
|
justify-content: flex-start;
|
|
657
722
|
}
|
|
723
|
+
.ak-init-status--maintenance {
|
|
724
|
+
padding: 28px 24px;
|
|
725
|
+
}
|
|
658
726
|
|
|
659
727
|
/* ── Composer ────────────────────────────────────────────────── */
|
|
660
728
|
.ak-composer {
|
|
@@ -992,6 +1060,86 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
992
1060
|
color: var(--ak-accent);
|
|
993
1061
|
}
|
|
994
1062
|
|
|
1063
|
+
/* ── Maintenance state ───────────────────────────────────────── */
|
|
1064
|
+
.ak-maintenance {
|
|
1065
|
+
position: relative;
|
|
1066
|
+
display: flex;
|
|
1067
|
+
flex-direction: column;
|
|
1068
|
+
align-items: center;
|
|
1069
|
+
text-align: center;
|
|
1070
|
+
max-width: 320px;
|
|
1071
|
+
padding: 8px 4px;
|
|
1072
|
+
animation: ak-maintenance-enter 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
|
|
1073
|
+
}
|
|
1074
|
+
.ak-maintenance__halo {
|
|
1075
|
+
position: absolute;
|
|
1076
|
+
top: -6px;
|
|
1077
|
+
left: 50%;
|
|
1078
|
+
width: 120px;
|
|
1079
|
+
height: 120px;
|
|
1080
|
+
transform: translateX(-50%);
|
|
1081
|
+
border-radius: 50%;
|
|
1082
|
+
background: radial-gradient(
|
|
1083
|
+
closest-side,
|
|
1084
|
+
var(--ak-maintenance-halo) 0%,
|
|
1085
|
+
transparent 72%
|
|
1086
|
+
);
|
|
1087
|
+
opacity: 0.22;
|
|
1088
|
+
filter: blur(4px);
|
|
1089
|
+
pointer-events: none;
|
|
1090
|
+
animation: ak-maintenance-pulse 2.8s ease-in-out infinite;
|
|
1091
|
+
}
|
|
1092
|
+
.ak-maintenance__icon {
|
|
1093
|
+
position: relative;
|
|
1094
|
+
display: inline-flex;
|
|
1095
|
+
align-items: center;
|
|
1096
|
+
justify-content: center;
|
|
1097
|
+
width: 56px;
|
|
1098
|
+
height: 56px;
|
|
1099
|
+
border-radius: 50%;
|
|
1100
|
+
background: var(--ak-maintenance-bg);
|
|
1101
|
+
color: var(--ak-maintenance-fg);
|
|
1102
|
+
border: 1px solid color-mix(in srgb, var(--ak-maintenance-halo) 40%, transparent);
|
|
1103
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
1104
|
+
}
|
|
1105
|
+
.ak-maintenance__title {
|
|
1106
|
+
margin-top: 16px;
|
|
1107
|
+
font-size: 15px;
|
|
1108
|
+
font-weight: 600;
|
|
1109
|
+
color: var(--ak-text);
|
|
1110
|
+
line-height: 1.3;
|
|
1111
|
+
letter-spacing: -0.01em;
|
|
1112
|
+
}
|
|
1113
|
+
.ak-maintenance__description {
|
|
1114
|
+
margin-top: 6px;
|
|
1115
|
+
font-size: 13px;
|
|
1116
|
+
color: var(--ak-text-muted);
|
|
1117
|
+
line-height: 1.5;
|
|
1118
|
+
max-width: 28ch;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
@keyframes ak-maintenance-enter {
|
|
1122
|
+
from {
|
|
1123
|
+
opacity: 0;
|
|
1124
|
+
transform: translateY(6px) scale(0.98);
|
|
1125
|
+
}
|
|
1126
|
+
to {
|
|
1127
|
+
opacity: 1;
|
|
1128
|
+
transform: translateY(0) scale(1);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
@keyframes ak-maintenance-pulse {
|
|
1132
|
+
0%, 100% { opacity: 0.18; transform: translateX(-50%) scale(1); }
|
|
1133
|
+
50% { opacity: 0.32; transform: translateX(-50%) scale(1.06); }
|
|
1134
|
+
}
|
|
1135
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1136
|
+
.ak-maintenance,
|
|
1137
|
+
.ak-maintenance__halo,
|
|
1138
|
+
.ak-maintenance__icon {
|
|
1139
|
+
animation: none;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
|
|
995
1143
|
/* ── Error banner ────────────────────────────────────────────── */
|
|
996
1144
|
.ak-error {
|
|
997
1145
|
padding: 12px 16px;
|
|
@@ -1137,9 +1285,9 @@ var AgentKit=(function(kt){Object.defineProperty(kt,Symbol.toStringTag,{value:"M
|
|
|
1137
1285
|
opacity: 0.75;
|
|
1138
1286
|
letter-spacing: -0.01em;
|
|
1139
1287
|
}
|
|
1140
|
-
`,
|
|
1288
|
+
`,zc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$o=0,Uc=Array.isArray;function u(e,t,n,r,a,i){t||(t={});var s,o,l=t;if("ref"in l)for(o in l={},t)o=="ref"?s=t[o]:l[o]=t[o];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--$o,__i:-1,__u:0,__source:a,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(o in s)l[o]===void 0&&(l[o]=s[o]);return N.vnode&&N.vnode(c),c}function Fo(){return u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),u("circle",{cx:"12",cy:"5",r:"2"}),u("path",{d:"M12 7v4"}),u("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),u("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]})}function Wo(){return u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[u("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Do(){return u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),u("path",{d:"M3 3v5h5"})]})}function zo({title:e,subtitle:t,avatarUrl:n,onClose:r,onReset:a,hideClose:i=!1}){const[s,o]=Le(!1);return u("div",{className:`ak-header${s?" ak-header--confirming":""}`,children:[u("div",{className:"ak-header__row",children:[n?u("img",{src:n,alt:"",className:"ak-header__avatar","aria-hidden":"true"}):u("span",{className:"ak-header__bot-icon","aria-hidden":"true",children:u(Fo,{})}),u("div",{className:"ak-header__title-group",children:[u("span",{className:"ak-header__title",children:e}),t&&u("span",{className:"ak-header__subtitle",children:t})]}),u("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[u("span",{className:"ak-header__status","aria-hidden":"true"}),a&&u("button",{className:`ak-header__button${s?" ak-header__button--active":""}`,onClick:()=>o(!0),"aria-label":"New conversation",type:"button",title:"Start a new conversation (Retains current conversation to memory)",children:u(Do,{})}),!i&&u("button",{className:"ak-header__close",onClick:r,"aria-label":"Close chat",type:"button",children:u(Wo,{})})]})]}),s&&u("div",{className:"ak-header__confirm",role:"alert",children:[u("div",{className:"ak-header__confirm-text",children:[u("span",{className:"ak-header__confirm-title",children:"End this conversation?"}),u("span",{className:"ak-header__confirm-sub",children:"All messages will be removed"})]}),u("div",{className:"ak-header__confirm-actions",children:[u("button",{className:"ak-header__confirm-cancel",type:"button",onClick:()=>o(!1),children:"Cancel"}),u("button",{className:"ak-header__confirm-ok",type:"button",onClick:()=>{a?.(),o(!1)},children:"End chat"})]})]})]})}function Uo({thinking:e,isThinking:t,thinkingViewable:n}){const[r,a]=Le(!1);return!t&&!e?null:t?u("div",{className:"ak-thinking",children:u("div",{className:"ak-thinking__indicator",children:[u("span",{className:"ak-thinking__label",children:"Thinking"}),u("span",{className:"ak-cursor","aria-hidden":"true",children:[u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"})]})]})}):!n||!e?null:u("div",{className:"ak-thinking ak-thinking--done",children:[u("button",{className:"ak-thinking__toggle",onClick:()=>a(i=>!i),"aria-expanded":r,type:"button",children:[u("svg",{className:`ak-thinking__chevron${r?" ak-thinking__chevron--open":""}`,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u("polyline",{points:"6 9 12 15 18 9"})}),u("span",{children:"Thought for a moment"})]}),r&&u("div",{className:"ak-thinking__content",children:e})]})}function Bo(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}var Wr=/(`[^`\n]+`|\*\*[^*\n]+\*\*|\*[^*\n]+\*|!\[[^\]\n]*\]\([^)\n]+\)|\[[^\]\n]+\]\([^)\n]+\))/g;function ee(e){const t=[];let n=0,r=0;Wr.lastIndex=0;let a;for(;(a=Wr.exec(e))!==null;){a.index>n&&t.push(e.slice(n,a.index));const i=a[0];if(i.startsWith("`"))t.push(u("code",{className:"ak-md-ic",children:i.slice(1,-1)},r++));else if(i.startsWith("**"))t.push(u("strong",{children:i.slice(2,-2)},r++));else if(i.startsWith("*"))t.push(u("em",{children:i.slice(1,-1)},r++));else if(i.startsWith("![")){const s=i.match(/!\[([^\]]*)\]\(([^)]+)\)/);s&&t.push(u("a",{href:s[2],target:"_blank",rel:"noopener noreferrer",children:s[1]||"image"},r++))}else{const s=i.match(/\[(.+?)\]\((.+?)\)/);s?t.push(u("a",{href:s[2],target:"_blank",rel:"noopener noreferrer",children:s[1]},r++)):t.push(i)}n=a.index+i.length}return n<e.length&&t.push(e.slice(n)),t}function Ho(e){e=e.replace(/\\text\{([^}]*)\}/g,"$1").replace(/\\implies/g,"→").replace(/\\Rightarrow/g,"⟹").replace(/\\times/g,"×").replace(/\\div/g,"÷").replace(/\\cdot/g,"·").replace(/\\quad/g," ").replace(/\\qquad/g," ").replace(/\\leq/g,"≤").replace(/\\geq/g,"≥").replace(/\\neq/g,"≠").replace(/\\approx/g,"≈").replace(/\\infty/g,"∞").replace(/\\\((.+?)\\\)/gs,"$1").replace(/\\\[[\s\S]+?\\\]/g,"").replace(/\\\$/g,"\0DOLLAR\0").replace(/\$\$[\s\S]+?\$\$/g,"").replace(/\$([^$]+)\$/g,"$1").replace(/\x00DOLLAR\x00/g,"$").replace(/\\[a-zA-Z]+\*?/g,"").replace(/\n{3,}/g,`
|
|
1141
1289
|
|
|
1142
1290
|
`);const t=e.split(`
|
|
1143
|
-
`),
|
|
1144
|
-
`)})})]},a++));continue}const o=i.match(/^(#{1,6})(\s+.*)?$/);if(o){const c=o[1].length,f=o[2]?q(o[2].trim()):"";c===1?r.push(u("h1",{className:"ak-md-h1",children:f},a++)):c===2?r.push(u("h2",{className:"ak-md-h2",children:f},a++)):c===3?r.push(u("h3",{className:"ak-md-h3",children:f},a++)):c===4?r.push(u("h4",{className:"ak-md-h4",children:f},a++)):c===5?r.push(u("h5",{className:"ak-md-h5",children:f},a++)):r.push(u("h6",{className:"ak-md-h6",children:f},a++)),n++;continue}if(/^[-*_]{3,}$/.test(i.trim())){r.push(u("hr",{className:"ak-md-hr"},a++)),n++;continue}if(/^[-*+]\s/.test(i)){const c=[];let f=n;for(;f<t.length&&(/^[-*+]\s/.test(t[f])||t[f].trim()==="");){if(t[f].trim()===""){f++;continue}const d=t[f].length-t[f].trimStart().length,m=t[f].replace(/^[-*+]\s+/,""),h=[],k=[];let y=f+1;for(;y<t.length&&y<f+20;){const _=t[y];if(_.length-_.trimStart().length>d&&_.trim()!==""){const x=_.trim();/^[-*+]\s/.test(x)?h.push(u("li",{children:q(x.replace(/^[-*+]\s+/,""))},`nested-${y}`)):k.push(u("p",{style:{margin:"0.2em 0 0"},children:q(x)},`cont-${y}`)),y++}else break}const C=k.length>0||h.length>0?u(X,{children:[q(m),k,h.length>0&&u("ul",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:h})]}):q(m);c.push(u("li",{children:C},`item-${f}`)),f=y}r.push(u("ul",{className:"ak-md-ul",children:c},a++)),n=f;continue}if(/^\d+\.\s/.test(i)){const c=[];let f=n;for(;f<t.length&&(/^\d+\.\s/.test(t[f])||t[f].trim()==="");){if(t[f].trim()===""){f++;continue}const d=t[f].length-t[f].trimStart().length,m=t[f].replace(/^\d+\.\s+/,""),h=[],k=[];let y=f+1;for(;y<t.length&&y<f+20;){const _=t[y];if(_.length-_.trimStart().length>d&&_.trim()!==""){const x=_.trim();/^\d+\.\s/.test(x)?h.push(u("li",{children:q(x.replace(/^\d+\.\s+/,""))},`nested-order-${y}`)):/^[-*+]\s/.test(x)?h.push(u("li",{children:q(x.replace(/^[-*+]\s+/,""))},`nested-unorder-${y}`)):k.push(u("p",{style:{margin:"0.2em 0 0"},children:q(x)},`cont-${y}`)),y++}else break}const C=k.length>0||h.length>0?u(X,{children:[q(m),k,h.length>0&&u("ol",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:h})]}):q(m);c.push(u("li",{children:C},`order-item-${f}`)),f=y}r.push(u("ol",{className:"ak-md-ol",children:c},a++)),n=f;continue}if(i.trim()===""){n++;continue}const l=[];for(;n<t.length&&t[n].trim()!==""&&!t[n].startsWith("#")&&!/^\s*```/.test(t[n])&&!/^[-*+]\s/.test(t[n])&&!/^\d+\.\s/.test(t[n])&&!/^[-*_]{3,}$/.test(t[n].trim());)l.push(t[n]),n++;if(l.length>0){const c=[];l.forEach((f,d)=>{c.push(...q(f)),d<l.length-1&&c.push(u("br",{},`br-${d}`))}),r.push(u("p",{className:"ak-md-p",children:c},a++))}}return u(X,{children:r})}function Go({message:e,thinkingViewable:t=!1}){const r=e.role==="user",n=e.status==="error",a=e.status==="streaming",i=!!(e.images&&e.images.length>0),s=!!(r&&e.uploadedImageUrl),o=i||s,l=!r&&!n,c=r?"ak-message--user":n?"ak-message--assistant ak-message--error":"ak-message--assistant",f=u(X,{children:[u("div",{className:["ak-message__bubble",l?"ak-message__bubble--md":"",o?"ak-message__bubble--has-image":""].filter(Boolean).join(" "),children:[s&&u("div",{className:"ak-message__images",children:u("div",{className:"ak-message__image-wrap",children:[u("a",{href:e.uploadedImageUrl,className:"ak-message__image-link",children:u("img",{src:e.uploadedImageUrl,alt:"Uploaded image",className:"ak-message__image"})}),u("a",{href:e.uploadedImageUrl,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:m=>m.stopPropagation(),children:u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),u("polyline",{points:"7 10 12 15 17 10"}),u("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]})}),i&&u("div",{className:"ak-message__images",children:e.images.map((m,h)=>{const k=m.url??(m.base64?`data:${m.mimeType};base64,${m.base64}`:null);return k?u("div",{className:"ak-message__image-wrap",children:[u("a",{href:k,className:"ak-message__image-link",children:u("img",{src:k,alt:"Generated image",className:"ak-message__image"})}),u("a",{href:k,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:y=>y.stopPropagation(),children:u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),u("polyline",{points:"7 10 12 15 17 10"}),u("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]},`${e.id}-img-${h}`):null})}),(e.content||a&&!e.isThinking)&&u("div",{className:o?"ak-message__image-caption":void 0,children:[l?Ho(e.content):e.content,a&&!e.isThinking&&u("span",{className:"ak-cursor","aria-hidden":"true",children:[u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"})]})]})]}),u("span",{className:"ak-message__time",children:Bo(e.createdAt)})]}),d=!e.isThinking||!!e.content;return u("div",{className:`ak-message ${c}`,children:[!r&&u(Uo,{thinking:e.thinking,isThinking:e.isThinking??!1,thinkingViewable:t}),d&&f]})}function Yo(){return u("div",{className:"ak-typing","aria-label":"Assistant is typing",children:[u("span",{className:"ak-typing__dot"}),u("span",{className:"ak-typing__dot"}),u("span",{className:"ak-typing__dot"})]})}function Xo({messages:e,isLoading:t,thinkingViewable:r}){const n=Le(null),a=e.find(s=>s.status==="streaming")?.content??"",i=e.find(s=>s.isThinking)?.thinking??"";return Te(()=>{n.current?.scrollIntoView({behavior:"smooth"})},[e.length,t,a,i]),u("div",{className:"ak-messages",role:"log","aria-live":"polite","aria-label":"Conversation",children:[e.map(s=>u(Go,{message:s,thinkingViewable:r},s.id)),t&&!e.some(s=>s.status==="streaming")&&u(Yo,{}),u("div",{ref:n})]})}function Jo(){return u("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),u("circle",{cx:"12",cy:"5",r:"2"}),u("path",{d:"M12 7v4"}),u("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),u("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]})}function Qo({title:e,description:t,greeting:r,avatarUrl:n}){return u("div",{className:"ak-empty-state","aria-label":"Start a conversation",children:[u("div",{className:"ak-empty-state__glow","aria-hidden":"true"}),u("div",{className:"ak-empty-state__body",children:[u("div",{className:"ak-empty-state__avatar",children:n?u("img",{src:n,alt:"",className:"ak-empty-state__avatar-img","aria-hidden":"true"}):u("span",{className:"ak-empty-state__bot-icon","aria-hidden":"true",children:u(Jo,{})})}),u("p",{className:"ak-empty-state__title",children:e}),t&&u("p",{className:"ak-empty-state__description",children:t})]}),r&&u("div",{className:"ak-empty-state__quote",children:[u("span",{className:"ak-empty-state__quote-mark","aria-hidden":"true",children:'"'}),u("p",{className:"ak-empty-state__quote-text",children:r})]})]})}function Ko(){return u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),u("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function qo(){return u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[u("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),u("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function ec(){return u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),u("circle",{cx:"12",cy:"13",r:"4"})]})}function tc(){return u("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[u("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function rc({onSend:e,disabled:t=!1,placeholder:r="Type a message…",privacyPolicyUrl:n,photoSendingEnabled:a=!1}){const[i,s]=Ne(""),[o,l]=Ne(null),[c,f]=Ne(null),[d,m]=Ne(!1),h=Le(null),k=Le(null),y=Le(null),C=Le(null);Te(()=>()=>{c&&URL.revokeObjectURL(c)},[c]),Te(()=>{t||h.current?.focus()},[t]);const _=bo(E=>{if(!d)return;const M=E.composedPath?E.composedPath():[],De=!!y.current&&M.includes(y.current),_t=!!C.current&&M.includes(C.current);!De&&!_t&&m(!1)},[d]);Te(()=>{if(d)return document.addEventListener("click",_),()=>document.removeEventListener("click",_)},[d,_]),Te(()=>{a||m(!1)},[a]);function x(){l(null),c&&URL.revokeObjectURL(c),f(null),k.current&&(k.current.value="")}function Z(){const E=i.trim();!E&&!o||t||(e(E,o??void 0),s(""),x(),h.current&&(h.current.style.height="auto"))}function V(E){E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),Z())}function z(E){const M=E.currentTarget;s(M.value),M.style.height="auto",M.style.height=`${M.scrollHeight}px`}function H(E){const M=E.currentTarget.files?.[0];if(M){if(M.size>5242880){alert("Image must be smaller than 5 MB."),E.currentTarget.value="";return}c&&URL.revokeObjectURL(c),l(M),f(URL.createObjectURL(M))}}function G(){m(!1),k.current?.click()}const L=!t&&(!!i.trim()||!!o);return u("div",{className:"ak-composer",children:[a&&d&&u("div",{ref:y,className:"ak-composer__attach-menu",role:"menu",children:u("button",{className:"ak-composer__attach-menu-item",onClick:G,type:"button",role:"menuitem",disabled:t,children:[u(ec,{}),u("span",{children:"Photo"})]})}),c&&u("div",{className:"ak-composer__preview",children:u("div",{className:"ak-composer__preview-wrap",children:[u("img",{src:c,alt:"Selected",className:"ak-composer__preview-img"}),u("button",{className:"ak-composer__preview-remove",onClick:x,type:"button","aria-label":"Remove image",disabled:t,children:u(tc,{})})]})}),u("div",{className:"ak-composer__input-wrap",children:[a&&u(X,{children:[u("input",{ref:k,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",className:"ak-composer__file-input",onChange:H,disabled:t,"aria-label":"Attach image"}),u("div",{className:"ak-composer__attach-wrap",children:u("button",{ref:C,className:`ak-composer__attach${d?" ak-composer__attach--open":""}`,onClick:()=>m(E=>!E),disabled:t,"aria-label":"Attachment options","aria-haspopup":"true","aria-expanded":d,type:"button",children:u(qo,{})})})]}),u("textarea",{ref:h,className:"ak-composer__input",value:i,onInput:z,onKeyDown:V,placeholder:r,disabled:t,rows:1,"aria-label":"Message input"}),u("button",{className:"ak-composer__send",onClick:Z,disabled:!L,"aria-label":"Send message",type:"button",children:u(Ko,{})})]}),u("p",{className:"ak-composer__disclaimer",children:["By chatting with us, you agree to our"," ",n?u("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}):"Privacy Policy"]})]})}function Fn({message:e}){return e.includes("Origin not allowed")?u("div",{className:"ak-error ak-error--origin",role:"alert",children:[u("div",{className:"ak-error__icon",children:"🔒"}),u("div",{className:"ak-error__content",children:[u("h3",{className:"ak-error__title",children:"Access Restricted"}),u("p",{className:"ak-error__description",children:"This widget has been restricted to specific websites only. Contact the website administrator if you believe this is an error."})]})]}):u("div",{className:"ak-error",role:"alert",children:[u("div",{className:"ak-error__icon",children:"⚠️"}),u("div",{className:"ak-error__content",children:u("p",{className:"ak-error__message",children:e})})]})}function nc(){return u("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"ak-branding__logo",children:[u("rect",{width:"24",height:"24",rx:"5",fill:"currentColor"}),u("path",{d:"M12 5L7 13h3.5v6l6.5-9H13.5V5z",fill:"white"})]})}function ac(){return u("div",{className:"ak-branding",children:[u(nc,{}),u("span",{className:"ak-branding__label",children:"Powered by"}),u("span",{className:"ak-branding__name",children:"AgentForge"})]})}function Wn({config:e,messages:t,isLoading:r,error:n,isInline:a,initStatus:i,initError:s,callbacks:o}){return u("div",{className:a?"ak-shell-wrap":"ak-shell-wrap ak-shell-enter",children:[u("div",{className:a?"ak-shell ak-shell--inline":"ak-shell ak-shell--floating",role:"dialog","aria-label":e.title,children:[u(Do,{title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,onClose:o.onClose,onReset:o.onReset,hideClose:!0}),i==="validating"&&u("div",{className:"ak-init-status",children:u("div",{className:"ak-init-spinner","aria-label":"Connecting…"})}),i==="error"&&u("div",{className:"ak-init-status ak-init-status--error",children:u(Fn,{message:s??"Widget configuration is invalid."})}),i==="ready"&&u(X,{children:[t.length===0?u(Qo,{title:e.title,description:e.description??e.subtitle,greeting:e.greeting,avatarUrl:e.avatarUrl}):u(Xo,{messages:t,isLoading:r,thinkingViewable:e.thinkingViewable}),n&&u(Fn,{message:n}),u(rc,{onSend:o.onSendMessage,disabled:r,placeholder:"Type a message…",privacyPolicyUrl:e.privacyPolicyUrl,photoSendingEnabled:e.photoSendingEnabled})]})]}),!a&&u(ac,{})]})}function ic(){return u("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function sc(){return u("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:u("polyline",{points:"6,9 12,15 18,9"})})}function oc({isOpen:e,onClick:t,avatarUrl:r,ariaLabel:n="Toggle chat"}){const a=!e&&!!r;return u("button",{className:`ak-launcher${a?" ak-launcher--avatar":""}`,onClick:t,"aria-label":n,"aria-expanded":e,type:"button",children:e?u(sc,{}):a?u("img",{src:r,alt:"",className:"ak-launcher__avatar-img","aria-hidden":"true"}):u(ic,{})})}function zn({config:e,state:t,callbacks:r}){const n=e.mode==="inline",a=Le(null);return Te(()=>{const i=a.current?.getRootNode()?.host;if(!i)return;const s=Po(e.theme.mode);i.setAttribute("data-theme",s)},[e.theme.mode]),n?u("div",{ref:a,className:"ak-inline",children:u(Wn,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!0,initStatus:t.initStatus,initError:t.initError,callbacks:r})}):u("div",{ref:a,className:"ak-floating",children:[t.isOpen&&u(Wn,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!1,initStatus:t.initStatus,initError:t.initError,callbacks:r}),u(oc,{isOpen:t.isOpen,onClick:t.isOpen?r.onClose:r.onOpen,avatarUrl:e.avatarUrl})]})}var Dn=(e,t,r,n)=>{const a=Mo(e);return a.render(Fe(zn,{config:t,state:r,callbacks:n})),{update(i,s){a.render(Fe(zn,{config:s,state:i,callbacks:n}))},destroy(){setTimeout(()=>{a.unmount()},0)}}};function Un(e){return Vo+`
|
|
1145
|
-
`+Oo(e)}var
|
|
1291
|
+
`),n=[];let r=0,a=0;for(;r<t.length;){const i=t[r],s=i.match(/^(\s*)```/);if(s){const c=s[1],f=i.trimStart().match(/^```(\w+)?\s*$/)?.[1]||"",d=[];for(r++;r<t.length&&!t[r].trimStart().startsWith("```");)d.push(t[r].startsWith(c)?t[r].slice(c.length):t[r]),r++;r<t.length&&t[r].trimStart().startsWith("```")&&r++,n.push(u("div",{className:"ak-md-pre-wrap",children:[f&&u("span",{className:"ak-md-pre-lang",children:f}),u("pre",{className:`ak-md-pre${f?` ak-md-pre--${f}`:""}`,children:u("code",{className:"ak-md-code",children:d.join(`
|
|
1292
|
+
`)})})]},a++));continue}const o=i.match(/^(#{1,6})(\s+.*)?$/);if(o){const c=o[1].length,f=o[2]?ee(o[2].trim()):"";c===1?n.push(u("h1",{className:"ak-md-h1",children:f},a++)):c===2?n.push(u("h2",{className:"ak-md-h2",children:f},a++)):c===3?n.push(u("h3",{className:"ak-md-h3",children:f},a++)):c===4?n.push(u("h4",{className:"ak-md-h4",children:f},a++)):c===5?n.push(u("h5",{className:"ak-md-h5",children:f},a++)):n.push(u("h6",{className:"ak-md-h6",children:f},a++)),r++;continue}if(/^[-*_]{3,}$/.test(i.trim())){n.push(u("hr",{className:"ak-md-hr"},a++)),r++;continue}if(/^[-*+]\s/.test(i)){const c=[];let f=r;for(;f<t.length&&(/^[-*+]\s/.test(t[f])||t[f].trim()==="");){if(t[f].trim()===""){f++;continue}const d=t[f].length-t[f].trimStart().length,h=t[f].replace(/^[-*+]\s+/,""),m=[],g=[];let w=f+1;for(;w<t.length&&w<f+20;){const v=t[w];if(v.length-v.trimStart().length>d&&v.trim()!==""){const k=v.trim();/^[-*+]\s/.test(k)?m.push(u("li",{children:ee(k.replace(/^[-*+]\s+/,""))},`nested-${w}`)):g.push(u("p",{style:{margin:"0.2em 0 0"},children:ee(k)},`cont-${w}`)),w++}else break}const b=g.length>0||m.length>0?u(B,{children:[ee(h),g,m.length>0&&u("ul",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:m})]}):ee(h);c.push(u("li",{children:b},`item-${f}`)),f=w}n.push(u("ul",{className:"ak-md-ul",children:c},a++)),r=f;continue}if(/^\d+\.\s/.test(i)){const c=[];let f=r;for(;f<t.length&&(/^\d+\.\s/.test(t[f])||t[f].trim()==="");){if(t[f].trim()===""){f++;continue}const d=t[f].length-t[f].trimStart().length,h=t[f].replace(/^\d+\.\s+/,""),m=[],g=[];let w=f+1;for(;w<t.length&&w<f+20;){const v=t[w];if(v.length-v.trimStart().length>d&&v.trim()!==""){const k=v.trim();/^\d+\.\s/.test(k)?m.push(u("li",{children:ee(k.replace(/^\d+\.\s+/,""))},`nested-order-${w}`)):/^[-*+]\s/.test(k)?m.push(u("li",{children:ee(k.replace(/^[-*+]\s+/,""))},`nested-unorder-${w}`)):g.push(u("p",{style:{margin:"0.2em 0 0"},children:ee(k)},`cont-${w}`)),w++}else break}const b=g.length>0||m.length>0?u(B,{children:[ee(h),g,m.length>0&&u("ol",{style:{margin:"0.2em 0 0",paddingLeft:"1.2em"},children:m})]}):ee(h);c.push(u("li",{children:b},`order-item-${f}`)),f=w}n.push(u("ol",{className:"ak-md-ol",children:c},a++)),r=f;continue}if(i.trim()===""){r++;continue}const l=[];for(;r<t.length&&t[r].trim()!==""&&!t[r].startsWith("#")&&!/^\s*```/.test(t[r])&&!/^[-*+]\s/.test(t[r])&&!/^\d+\.\s/.test(t[r])&&!/^[-*_]{3,}$/.test(t[r].trim());)l.push(t[r]),r++;if(l.length>0){const c=[];l.forEach((f,d)=>{c.push(...ee(f)),d<l.length-1&&c.push(u("br",{},`br-${d}`))}),n.push(u("p",{className:"ak-md-p",children:c},a++))}}return u(B,{children:n})}function Go({message:e,thinkingViewable:t=!1}){const n=e.role==="user",r=e.status==="error",a=e.status==="streaming",i=!!(e.images&&e.images.length>0),s=!!(n&&e.uploadedImageUrl),o=i||s,l=!n&&!r,c=!!e.isHuman&&!n,f=n?"ak-message--user":r?"ak-message--assistant ak-message--error":c?"ak-message--assistant ak-message--operator":"ak-message--assistant",d=["ak-message__bubble",l?"ak-message__bubble--md":"",o?"ak-message__bubble--has-image":"",c?"ak-message__bubble--operator":""].filter(Boolean).join(" "),h=c?e.senderDisplay?.trim()||"Operator":null,m=h?h.charAt(0).toUpperCase():"",g=u(B,{children:[u("div",{className:d,children:[s&&u("div",{className:"ak-message__images",children:u("div",{className:"ak-message__image-wrap",children:[u("a",{href:e.uploadedImageUrl,className:"ak-message__image-link",children:u("img",{src:e.uploadedImageUrl,alt:"Uploaded image",className:"ak-message__image"})}),u("a",{href:e.uploadedImageUrl,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:b=>b.stopPropagation(),children:u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),u("polyline",{points:"7 10 12 15 17 10"}),u("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]})}),i&&u("div",{className:"ak-message__images",children:e.images.map((b,v)=>{const k=b.url??(b.base64?`data:${b.mimeType};base64,${b.base64}`:null);return k?u("div",{className:"ak-message__image-wrap",children:[u("a",{href:k,className:"ak-message__image-link",children:u("img",{src:k,alt:"Generated image",className:"ak-message__image"})}),u("a",{href:k,download:!0,className:"ak-message__image-dl-icon",title:"Download image",onClick:R=>R.stopPropagation(),children:u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),u("polyline",{points:"7 10 12 15 17 10"}),u("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]},`${e.id}-img-${v}`):null})}),(e.content||a&&!e.isThinking)&&u("div",{className:o?"ak-message__image-caption":void 0,children:[l?Ho(e.content):e.content,a&&!e.isThinking&&u("span",{className:"ak-cursor","aria-hidden":"true",children:[u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"}),u("span",{className:"ak-cursor__dot"})]})]})]}),u("span",{className:"ak-message__time",children:Bo(e.createdAt)})]}),w=!e.isThinking||!!e.content;return u("div",{className:`ak-message ${f}`,children:[!n&&u(Uo,{thinking:e.thinking,isThinking:e.isThinking??!1,thinkingViewable:t}),c&&u("span",{className:"ak-message__sender-label",children:[u("span",{className:"ak-message__operator-avatar","aria-hidden":"true",children:m}),u("span",{className:"ak-message__operator-name",children:h})]}),w&&g]})}function Yo(){return u("div",{className:"ak-typing","aria-label":"Assistant is typing",children:[u("span",{className:"ak-typing__dot"}),u("span",{className:"ak-typing__dot"}),u("span",{className:"ak-typing__dot"})]})}function Xo(e,t){const n=[];let r=null;for(const a of e){if(a.role==="assistant"){const i=!!a.isHuman;r!==null&&r!==i&&n.push({kind:"divider",id:`divider-${a.id}`,label:i?`${a.senderDisplay?.trim()||t} joined the chat`:`${t} left — AI is back`}),r=i}n.push({kind:"message",message:a})}return n}function Jo({messages:e,isLoading:t,thinkingViewable:n,operatorFallbackLabel:r="Operator"}){const a=Ee(null),i=an(()=>Xo(e,r),[e,r]),s=e.find(l=>l.status==="streaming")?.content??"",o=e.find(l=>l.isThinking)?.thinking??"";return Ae(()=>{a.current?.scrollIntoView({behavior:"smooth"})},[e.length,t,s,o]),u("div",{className:"ak-messages",role:"log","aria-live":"polite","aria-label":"Conversation",children:[i.map(l=>l.kind==="divider"?u("div",{className:"ak-handoff-divider",role:"separator",children:u("span",{className:"ak-handoff-divider__label",children:l.label})},l.id):u(Go,{message:l.message,thinkingViewable:n},l.message.id)),t&&!e.some(l=>l.status==="streaming")&&u(Yo,{}),u("div",{ref:a})]})}function Qo(){return u("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),u("circle",{cx:"12",cy:"5",r:"2"}),u("path",{d:"M12 7v4"}),u("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),u("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]})}function qo({title:e,description:t,greeting:n,avatarUrl:r}){return u("div",{className:"ak-empty-state","aria-label":"Start a conversation",children:[u("div",{className:"ak-empty-state__glow","aria-hidden":"true"}),u("div",{className:"ak-empty-state__body",children:[u("div",{className:"ak-empty-state__avatar",children:r?u("img",{src:r,alt:"",className:"ak-empty-state__avatar-img","aria-hidden":"true"}):u("span",{className:"ak-empty-state__bot-icon","aria-hidden":"true",children:u(Qo,{})})}),u("p",{className:"ak-empty-state__title",children:e}),t&&u("p",{className:"ak-empty-state__description",children:t})]}),n&&u("div",{className:"ak-empty-state__quote",children:[u("span",{className:"ak-empty-state__quote-mark","aria-hidden":"true",children:'"'}),u("p",{className:"ak-empty-state__quote-text",children:n})]})]})}function Ko(){return u("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[u("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),u("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})}function ec(){return u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[u("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),u("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function tc(){return u("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[u("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),u("circle",{cx:"12",cy:"13",r:"4"})]})}function nc(){return u("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[u("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),u("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function rc({onSend:e,disabled:t=!1,placeholder:n="Type a message…",privacyPolicyUrl:r,termsOfServiceUrl:a,photoSendingEnabled:i=!1}){const[s,o]=Le(""),[l,c]=Le(null),[f,d]=Le(null),[h,m]=Le(!1),g=Ee(null),w=Ee(null),b=Ee(null),v=Ee(null);Ae(()=>()=>{f&&URL.revokeObjectURL(f)},[f]),Ae(()=>{t||g.current?.focus()},[t]);const k=bo(M=>{if(!h)return;const $=M.composedPath?M.composedPath():[],vt=!!b.current&&$.includes(b.current),yt=!!v.current&&$.includes(v.current);!vt&&!yt&&m(!1)},[h]);Ae(()=>{if(h)return document.addEventListener("click",k),()=>document.removeEventListener("click",k)},[h,k]),Ae(()=>{i||m(!1)},[i]);function R(){c(null),f&&URL.revokeObjectURL(f),d(null),w.current&&(w.current.value="")}function P(){const M=s.trim();!M&&!l||t||(e(M,l??void 0),o(""),R(),g.current&&(g.current.style.height="auto"))}function D(M){M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),P())}function Y(M){const $=M.currentTarget;o($.value),$.style.height="auto",$.style.height=`${$.scrollHeight}px`}function X(M){const $=M.currentTarget.files?.[0];if($){if($.size>5242880){alert("Image must be smaller than 5 MB."),M.currentTarget.value="";return}f&&URL.revokeObjectURL(f),c($),d(URL.createObjectURL($))}}function L(){m(!1),w.current?.click()}const z=!t&&(!!s.trim()||!!l);return u("div",{className:"ak-composer",children:[i&&h&&u("div",{ref:b,className:"ak-composer__attach-menu",role:"menu",children:u("button",{className:"ak-composer__attach-menu-item",onClick:L,type:"button",role:"menuitem",disabled:t,children:[u(tc,{}),u("span",{children:"Photo"})]})}),f&&u("div",{className:"ak-composer__preview",children:u("div",{className:"ak-composer__preview-wrap",children:[u("img",{src:f,alt:"Selected",className:"ak-composer__preview-img"}),u("button",{className:"ak-composer__preview-remove",onClick:R,type:"button","aria-label":"Remove image",disabled:t,children:u(nc,{})})]})}),u("div",{className:"ak-composer__input-wrap",children:[i&&u(B,{children:[u("input",{ref:w,type:"file",accept:"image/jpeg,image/png,image/gif,image/webp",className:"ak-composer__file-input",onChange:X,disabled:t,"aria-label":"Attach image"}),u("div",{className:"ak-composer__attach-wrap",children:u("button",{ref:v,className:`ak-composer__attach${h?" ak-composer__attach--open":""}`,onClick:()=>m(M=>!M),disabled:t,"aria-label":"Attachment options","aria-haspopup":"true","aria-expanded":h,type:"button",children:u(ec,{})})})]}),u("textarea",{ref:g,className:"ak-composer__input",value:s,onInput:Y,onKeyDown:D,placeholder:n,disabled:t,rows:1,"aria-label":"Message input"}),u("button",{className:"ak-composer__send",onClick:P,disabled:!z,"aria-label":"Send message",type:"button",children:u(Ko,{})})]}),u("p",{className:"ak-composer__disclaimer",children:[(r||a)&&u(B,{children:["By chatting you agree to our"," ",r?u("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"}):"Privacy Policy",a&&u(B,{children:[" ","and"," ",u("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})]}),". "]}),"AI can make mistakes. Verify important information."]})]})}function Dr({message:e}){return e.includes("Origin not allowed")?u("div",{className:"ak-error ak-error--origin",role:"alert",children:[u("div",{className:"ak-error__icon",children:"🔒"}),u("div",{className:"ak-error__content",children:[u("h3",{className:"ak-error__title",children:"Access Restricted"}),u("p",{className:"ak-error__description",children:"This widget has been restricted to specific websites only. Contact the website administrator if you believe this is an error."})]})]}):u("div",{className:"ak-error",role:"alert",children:[u("div",{className:"ak-error__icon",children:"⚠️"}),u("div",{className:"ak-error__content",children:u("p",{className:"ak-error__message",children:e})})]})}function ac(){return u("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u("circle",{cx:"12",cy:"12",r:"9"}),u("path",{d:"M12 7v5l3 2"})]})}function ic(){return u("div",{className:"ak-maintenance",role:"status","aria-live":"polite",children:[u("div",{className:"ak-maintenance__halo","aria-hidden":"true"}),u("div",{className:"ak-maintenance__icon",children:u(ac,{})}),u("p",{className:"ak-maintenance__title",children:"Under maintenance"}),u("p",{className:"ak-maintenance__description",children:"This assistant is temporarily unavailable. Please check back in a little while."})]})}function sc(){return u("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"ak-branding__logo",children:[u("rect",{width:"24",height:"24",rx:"5",fill:"currentColor"}),u("path",{d:"M12 5L7 13h3.5v6l6.5-9H13.5V5z",fill:"white"})]})}function oc(){return u("div",{className:"ak-branding",children:[u(sc,{}),u("span",{className:"ak-branding__label",children:"Powered by"}),u("span",{className:"ak-branding__name",children:"AgentForge"})]})}function zr({config:e,messages:t,isLoading:n,error:r,isInline:a,initStatus:i,initError:s,callbacks:o}){return u("div",{className:a?"ak-shell-wrap":"ak-shell-wrap ak-shell-enter",children:[u("div",{className:a?"ak-shell ak-shell--inline":"ak-shell ak-shell--floating",role:"dialog","aria-label":e.title,children:[u(zo,{title:e.title,subtitle:e.subtitle,avatarUrl:e.avatarUrl,onClose:o.onClose,onReset:i==="ready"?o.onReset:void 0,hideClose:!0}),i==="validating"&&u("div",{className:"ak-init-status",children:u("div",{className:"ak-init-spinner","aria-label":"Connecting…"})}),i==="error"&&u("div",{className:"ak-init-status ak-init-status--error",children:u(Dr,{message:s??"Widget configuration is invalid."})}),i==="disabled"&&u("div",{className:"ak-init-status ak-init-status--maintenance",children:u(ic,{})}),i==="ready"&&u(B,{children:[t.length===0?u(qo,{title:e.title,description:e.description??e.subtitle,greeting:e.greeting,avatarUrl:e.avatarUrl}):u(Jo,{messages:t,isLoading:n,thinkingViewable:e.thinkingViewable}),r&&u(Dr,{message:r}),u(rc,{onSend:o.onSendMessage,disabled:n,placeholder:"Type a message…",privacyPolicyUrl:e.privacyPolicyUrl,termsOfServiceUrl:e.termsOfServiceUrl,photoSendingEnabled:e.photoSendingEnabled})]})]}),!a&&u(oc,{})]})}function cc(){return u("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:u("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function lc(){return u("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:u("polyline",{points:"6,9 12,15 18,9"})})}function dc({isOpen:e,onClick:t,avatarUrl:n,ariaLabel:r="Toggle chat"}){const a=!e&&!!n;return u("button",{className:`ak-launcher${a?" ak-launcher--avatar":""}`,onClick:t,"aria-label":r,"aria-expanded":e,type:"button",children:e?u(lc,{}):a?u("img",{src:n,alt:"",className:"ak-launcher__avatar-img","aria-hidden":"true"}):u(cc,{})})}function Ur({config:e,state:t,callbacks:n}){const r=e.mode==="inline",a=Ee(null);return Ae(()=>{const i=a.current?.getRootNode()?.host;if(!i)return;const s=Po(e.theme.mode);i.setAttribute("data-theme",s)},[e.theme.mode]),r?u("div",{ref:a,className:"ak-inline",children:u(zr,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!0,initStatus:t.initStatus,initError:t.initError,callbacks:n})}):u("div",{ref:a,className:"ak-floating",children:[t.isOpen&&u(zr,{config:e,messages:t.messages,isLoading:t.isLoading,error:t.error,isInline:!1,initStatus:t.initStatus,initError:t.initError,callbacks:n}),u(dc,{isOpen:t.isOpen,onClick:t.isOpen?n.onClose:n.onOpen,avatarUrl:e.avatarUrl})]})}var Br=(e,t,n,r)=>{const a=jo(e);return a.render(De(Ur,{config:t,state:n,callbacks:r})),{update(i,s){a.render(De(Ur,{config:s,state:i,callbacks:r}))},destroy(){setTimeout(()=>{a.unmount()},0)}}};function Hr(e){return Vo+`
|
|
1293
|
+
`+Oo(e)}var Gr={init(e){return co(e,Br,Hr(je(e)))},mount(e,t){return lo(e,t,Br,Hr(je({...t,mode:"inline"})))},destroy(e){uo(e)}};return window.AgentKit=Gr,xt.AgentKit=Gr,xt})({});
|