@iai-lib/any-chat-widget 0.1.0-alpha.14 → 0.1.0-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- (function(F,B){typeof exports=="object"&&typeof module<"u"?B(exports):typeof define=="function"&&define.amd?define(["exports"],B):(F=typeof globalThis<"u"?globalThis:F||self,B(F.AnyChatbot={}))})(this,function(F){"use strict";var dn=(F,B,Q)=>{if(!B.has(F))throw TypeError("Cannot "+Q)};var ms=(F,B,Q)=>(dn(F,B,"read from private field"),Q?Q.call(F):B.get(F)),Ws=(F,B,Q)=>{if(B.has(F))throw TypeError("Cannot add the same private member more than once");B instanceof WeakSet?B.add(F):B.set(F,Q)},je=(F,B,Q,Xe)=>(dn(F,B,"write to private field"),Xe?Xe.call(F,Q):B.set(F,Q),Q);/**
1
+ (function(F,B){typeof exports=="object"&&typeof module<"u"?B(exports):typeof define=="function"&&define.amd?define(["exports"],B):(F=typeof globalThis<"u"?globalThis:F||self,B(F.AnyChatbot={}))})(this,function(F){"use strict";var dn=(F,B,Q)=>{if(!B.has(F))throw TypeError("Cannot "+Q)};var gs=(F,B,Q)=>(dn(F,B,"read from private field"),Q?Q.call(F):B.get(F)),Ks=(F,B,Q)=>{if(B.has(F))throw TypeError("Cannot add the same private member more than once");B instanceof WeakSet?B.add(F):B.set(F,Q)},Ze=(F,B,Q,et)=>(dn(F,B,"write to private field"),et?et.call(F,Q):B.set(F,Q),Q);/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */var we,qe;const B=globalThis,Q=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Xe=Symbol(),Ks=new WeakMap;let Js=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==Xe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o;const e=this.t;if(Q&&s===void 0){const t=e!==void 0&&e.length===1;t&&(s=Ks.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&Ks.set(e,s))}return s}toString(){return this.cssText}};const ln=s=>new Js(typeof s=="string"?s:s+"",void 0,Xe),Qe=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,n,r)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+s[r+1],s[0]);return new Js(t,s,Xe)},un=(s,e)=>{if(Q)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),n=B.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,s.appendChild(i)}},qs=Q?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return ln(t)})(s):s;/**
5
+ */var we,Ge;const B=globalThis,Q=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,et=Symbol(),Js=new WeakMap;let qs=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==et)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=e}get styleSheet(){let s=this.o;const e=this.t;if(Q&&s===void 0){const t=e!==void 0&&e.length===1;t&&(s=Js.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&Js.set(e,s))}return s}toString(){return this.cssText}};const ln=s=>new qs(typeof s=="string"?s:s+"",void 0,et),tt=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,n,r)=>i+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+s[r+1],s[0]);return new qs(t,s,et)},un=(s,e)=>{if(Q)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),n=B.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,s.appendChild(i)}},Ys=Q?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return ln(t)})(s):s;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:hn,defineProperty:pn,getOwnPropertyDescriptor:mn,getOwnPropertyNames:fn,getOwnPropertySymbols:gn,getPrototypeOf:yn}=Object,et=globalThis,Ys=et.trustedTypes,vn=Ys?Ys.emptyScript:"",Gs=et.reactiveElementPolyfillSupport,ht=(s,e)=>s,Dt={toAttribute(s,e){switch(e){case Boolean:s=s?vn:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},fs=(s,e)=>!hn(s,e),Xs={attribute:!0,type:String,converter:Dt,reflect:!1,hasChanged:fs};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),et.litPropertyMetadata??(et.litPropertyMetadata=new WeakMap);class tt extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Xs){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(e,i,t);n!==void 0&&pn(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:r}=mn(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get(){return n==null?void 0:n.call(this)},set(a){const o=n==null?void 0:n.call(this);r.call(this,a),this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Xs}static _$Ei(){if(this.hasOwnProperty(ht("elementProperties")))return;const e=yn(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ht("properties"))){const t=this.properties,i=[...fn(t),...gn(t)];for(const n of i)this.createProperty(n,t[n])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,n]of t)this.elementProperties.set(i,n)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const n=this._$Eu(t,i);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)t.unshift(qs(n))}else e!==void 0&&t.push(qs(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return un(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var i;const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){const a=(((i=n.converter)==null?void 0:i.toAttribute)!==void 0?n.converter:Dt).toAttribute(t,n.type);this._$Em=e,a==null?this.removeAttribute(r):this.setAttribute(r,a),this._$Em=null}}_$AK(e,t){var i;const n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const a=n.getPropertyOptions(r),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)==null?void 0:i.fromAttribute)!==void 0?a.converter:Dt;this._$Em=r,this[r]=o.fromAttribute(t,a.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??fs)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,a]of this._$Ep)this[r]=a;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[r,a]of n)a.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],a)}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$EO)==null||e.forEach(n=>{var r;return(r=n.hostUpdate)==null?void 0:r.call(n)}),this.update(i)):this._$EU()}catch(n){throw t=!1,this._$EU(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostUpdated)==null?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}tt.elementStyles=[],tt.shadowRootOptions={mode:"open"},tt[ht("elementProperties")]=new Map,tt[ht("finalized")]=new Map,Gs==null||Gs({ReactiveElement:tt}),(et.reactiveElementVersions??(et.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:hn,defineProperty:pn,getOwnPropertyDescriptor:mn,getOwnPropertyNames:fn,getOwnPropertySymbols:gn,getPrototypeOf:yn}=Object,st=globalThis,Gs=st.trustedTypes,vn=Gs?Gs.emptyScript:"",Xs=st.reactiveElementPolyfillSupport,ft=(s,e)=>s,Bt={toAttribute(s,e){switch(e){case Boolean:s=s?vn:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},ys=(s,e)=>!hn(s,e),Qs={attribute:!0,type:String,converter:Bt,reflect:!1,hasChanged:ys};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),st.litPropertyMetadata??(st.litPropertyMetadata=new WeakMap);class it extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Qs){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(e,i,t);n!==void 0&&pn(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){const{get:n,set:r}=mn(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get(){return n==null?void 0:n.call(this)},set(a){const o=n==null?void 0:n.call(this);r.call(this,a),this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Qs}static _$Ei(){if(this.hasOwnProperty(ft("elementProperties")))return;const e=yn(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ft("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ft("properties"))){const t=this.properties,i=[...fn(t),...gn(t)];for(const n of i)this.createProperty(n,t[n])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,n]of t)this.elementProperties.set(i,n)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const n=this._$Eu(t,i);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const n of i)t.unshift(Ys(n))}else e!==void 0&&t.push(Ys(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return un(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var i;const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){const a=(((i=n.converter)==null?void 0:i.toAttribute)!==void 0?n.converter:Bt).toAttribute(t,n.type);this._$Em=e,a==null?this.removeAttribute(r):this.setAttribute(r,a),this._$Em=null}}_$AK(e,t){var i;const n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const a=n.getPropertyOptions(r),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)==null?void 0:i.fromAttribute)!==void 0?a.converter:Bt;this._$Em=r,this[r]=o.fromAttribute(t,a.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??ys)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,a]of this._$Ep)this[r]=a;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[r,a]of n)a.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],a)}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$EO)==null||e.forEach(n=>{var r;return(r=n.hostUpdate)==null?void 0:r.call(n)}),this.update(i)):this._$EU()}catch(n){throw t=!1,this._$EU(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var n;return(n=i.hostUpdated)==null?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}it.elementStyles=[],it.shadowRootOptions={mode:"open"},it[ft("elementProperties")]=new Map,it[ft("finalized")]=new Map,Xs==null||Xs({ReactiveElement:it}),(st.reactiveElementVersions??(st.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Ut=globalThis,Ht=Ut.trustedTypes,Qs=Ht?Ht.createPolicy("lit-html",{createHTML:s=>s}):void 0,gs="$lit$",ge=`lit$${(Math.random()+"").slice(9)}$`,ys="?"+ge,bn=`<${ys}>`,Re=document,pt=()=>Re.createComment(""),mt=s=>s===null||typeof s!="object"&&typeof s!="function",ei=Array.isArray,ti=s=>ei(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",vs=`[
14
- \f\r]`,ft=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,si=/-->/g,ii=/>/g,Ze=RegExp(`>|${vs}(?:([^\\s"'>=/]+)(${vs}*=${vs}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),ni=/'/g,ri=/"/g,ai=/^(?:script|style|textarea|title)$/i,wn=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),z=wn(1),ue=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),oi=new WeakMap,Le=Re.createTreeWalker(Re,129);function ci(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qs!==void 0?Qs.createHTML(e):e}const di=(s,e)=>{const t=s.length-1,i=[];let n,r=e===2?"<svg>":"",a=ft;for(let o=0;o<t;o++){const c=s[o];let l,h,m=-1,d=0;for(;d<c.length&&(a.lastIndex=d,h=a.exec(c),h!==null);)d=a.lastIndex,a===ft?h[1]==="!--"?a=si:h[1]!==void 0?a=ii:h[2]!==void 0?(ai.test(h[2])&&(n=RegExp("</"+h[2],"g")),a=Ze):h[3]!==void 0&&(a=Ze):a===Ze?h[0]===">"?(a=n??ft,m=-1):h[1]===void 0?m=-2:(m=a.lastIndex-h[2].length,l=h[1],a=h[3]===void 0?Ze:h[3]==='"'?ri:ni):a===ri||a===ni?a=Ze:a===si||a===ii?a=ft:(a=Ze,n=void 0);const b=a===Ze&&s[o+1].startsWith("/>")?" ":"";r+=a===ft?c+bn:m>=0?(i.push(l),c.slice(0,m)+gs+c.slice(m)+ge+b):c+ge+(m===-2?o:b)}return[ci(s,r+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class gt{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let r=0,a=0;const o=e.length-1,c=this.parts,[l,h]=di(e,t);if(this.el=gt.createElement(l,i),Le.currentNode=this.el.content,t===2){const m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(n=Le.nextNode())!==null&&c.length<o;){if(n.nodeType===1){if(n.hasAttributes())for(const m of n.getAttributeNames())if(m.endsWith(gs)){const d=h[a++],b=n.getAttribute(m).split(ge),N=/([.?@])?(.*)/.exec(d);c.push({type:1,index:r,name:N[2],strings:b,ctor:N[1]==="."?ui:N[1]==="?"?hi:N[1]==="@"?pi:yt}),n.removeAttribute(m)}else m.startsWith(ge)&&(c.push({type:6,index:r}),n.removeAttribute(m));if(ai.test(n.tagName)){const m=n.textContent.split(ge),d=m.length-1;if(d>0){n.textContent=Ht?Ht.emptyScript:"";for(let b=0;b<d;b++)n.append(m[b],pt()),Le.nextNode(),c.push({type:2,index:++r});n.append(m[d],pt())}}}else if(n.nodeType===8)if(n.data===ys)c.push({type:2,index:r});else{let m=-1;for(;(m=n.data.indexOf(ge,m+1))!==-1;)c.push({type:7,index:r}),m+=ge.length-1}r++}}static createElement(e,t){const i=Re.createElement("template");return i.innerHTML=e,i}}function ze(s,e,t=s,i){var n,r;if(e===ue)return e;let a=i!==void 0?(n=t._$Co)==null?void 0:n[i]:t._$Cl;const o=mt(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==o&&((r=a==null?void 0:a._$AO)==null||r.call(a,!1),o===void 0?a=void 0:(a=new o(s),a._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=a:t._$Cl=a),a!==void 0&&(e=ze(s,a._$AS(s,e.values),a,i)),e}class li{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,n=((e==null?void 0:e.creationScope)??Re).importNode(t,!0);Le.currentNode=n;let r=Le.nextNode(),a=0,o=0,c=i[0];for(;c!==void 0;){if(a===c.index){let l;c.type===2?l=new st(r,r.nextSibling,this,e):c.type===1?l=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(l=new mi(r,this,e)),this._$AV.push(l),c=i[++o]}a!==(c==null?void 0:c.index)&&(r=Le.nextNode(),a++)}return Le.currentNode=Re,n}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class st{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,n){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cv=(n==null?void 0:n.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=ze(this,e,t),mt(e)?e===V||e==null||e===""?(this._$AH!==V&&this._$AR(),this._$AH=V):e!==this._$AH&&e!==ue&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ti(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==V&&mt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Re.createTextNode(e)),this._$AH=e}$(e){var t;const{values:i,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=gt.createElement(ci(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(i);else{const a=new li(r,this),o=a.u(this.options);a.p(i),this.T(o),this._$AH=a}}_$AC(e){let t=oi.get(e.strings);return t===void 0&&oi.set(e.strings,t=new gt(e)),t}k(e){ei(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const r of e)n===t.length?t.push(i=new st(this.S(pt()),this.S(pt()),this,this.options)):i=t[n],i._$AI(r),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class yt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,n,r){this.type=1,this._$AH=V,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=V}_$AI(e,t=this,i,n){const r=this.strings;let a=!1;if(r===void 0)e=ze(this,e,t,0),a=!mt(e)||e!==this._$AH&&e!==ue,a&&(this._$AH=e);else{const o=e;let c,l;for(e=r[0],c=0;c<r.length-1;c++)l=ze(this,o[i+c],t,c),l===ue&&(l=this._$AH[c]),a||(a=!mt(l)||l!==this._$AH[c]),l===V?e=V:e!==V&&(e+=(l??"")+r[c+1]),this._$AH[c]=l}a&&!n&&this.j(e)}j(e){e===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ui extends yt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===V?void 0:e}}class hi extends yt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==V)}}class pi extends yt{constructor(e,t,i,n,r){super(e,t,i,n,r),this.type=5}_$AI(e,t=this){if((e=ze(this,e,t,0)??V)===ue)return;const i=this._$AH,n=e===V&&i!==V||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==V&&(i===V||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class mi{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){ze(this,e)}}const _n={P:gs,A:ge,C:ys,M:1,L:di,R:li,D:ti,V:ze,I:st,H:yt,N:hi,U:pi,B:ui,F:mi},fi=Ut.litHtmlPolyfillSupport;fi==null||fi(gt,st),(Ut.litHtmlVersions??(Ut.litHtmlVersions=[])).push("3.1.2");const xn=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let n=i._$litPart$;if(n===void 0){const r=(t==null?void 0:t.renderBefore)??null;i._$litPart$=n=new st(e.insertBefore(pt(),r),r,void 0,t??{})}return n._$AI(s),n};/**
13
+ */const Ft=globalThis,Vt=Ft.trustedTypes,ei=Vt?Vt.createPolicy("lit-html",{createHTML:s=>s}):void 0,vs="$lit$",ge=`lit$${(Math.random()+"").slice(9)}$`,bs="?"+ge,bn=`<${bs}>`,Le=document,gt=()=>Le.createComment(""),yt=s=>s===null||typeof s!="object"&&typeof s!="function",ti=Array.isArray,si=s=>ti(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",ws=`[
14
+ \f\r]`,vt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ii=/-->/g,ni=/>/g,De=RegExp(`>|${ws}(?:([^\\s"'>=/]+)(${ws}*=${ws}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ri=/'/g,ai=/"/g,oi=/^(?:script|style|textarea|title)$/i,wn=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),L=wn(1),ue=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),ci=new WeakMap,ze=Le.createTreeWalker(Le,129);function di(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ei!==void 0?ei.createHTML(e):e}const li=(s,e)=>{const t=s.length-1,i=[];let n,r=e===2?"<svg>":"",a=vt;for(let o=0;o<t;o++){const c=s[o];let l,h,m=-1,d=0;for(;d<c.length&&(a.lastIndex=d,h=a.exec(c),h!==null);)d=a.lastIndex,a===vt?h[1]==="!--"?a=ii:h[1]!==void 0?a=ni:h[2]!==void 0?(oi.test(h[2])&&(n=RegExp("</"+h[2],"g")),a=De):h[3]!==void 0&&(a=De):a===De?h[0]===">"?(a=n??vt,m=-1):h[1]===void 0?m=-2:(m=a.lastIndex-h[2].length,l=h[1],a=h[3]===void 0?De:h[3]==='"'?ai:ri):a===ai||a===ri?a=De:a===ii||a===ni?a=vt:(a=De,n=void 0);const b=a===De&&s[o+1].startsWith("/>")?" ":"";r+=a===vt?c+bn:m>=0?(i.push(l),c.slice(0,m)+vs+c.slice(m)+ge+b):c+ge+(m===-2?o:b)}return[di(s,r+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class bt{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let r=0,a=0;const o=e.length-1,c=this.parts,[l,h]=li(e,t);if(this.el=bt.createElement(l,i),ze.currentNode=this.el.content,t===2){const m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(n=ze.nextNode())!==null&&c.length<o;){if(n.nodeType===1){if(n.hasAttributes())for(const m of n.getAttributeNames())if(m.endsWith(vs)){const d=h[a++],b=n.getAttribute(m).split(ge),N=/([.?@])?(.*)/.exec(d);c.push({type:1,index:r,name:N[2],strings:b,ctor:N[1]==="."?hi:N[1]==="?"?pi:N[1]==="@"?mi:wt}),n.removeAttribute(m)}else m.startsWith(ge)&&(c.push({type:6,index:r}),n.removeAttribute(m));if(oi.test(n.tagName)){const m=n.textContent.split(ge),d=m.length-1;if(d>0){n.textContent=Vt?Vt.emptyScript:"";for(let b=0;b<d;b++)n.append(m[b],gt()),ze.nextNode(),c.push({type:2,index:++r});n.append(m[d],gt())}}}else if(n.nodeType===8)if(n.data===bs)c.push({type:2,index:r});else{let m=-1;for(;(m=n.data.indexOf(ge,m+1))!==-1;)c.push({type:7,index:r}),m+=ge.length-1}r++}}static createElement(e,t){const i=Le.createElement("template");return i.innerHTML=e,i}}function Ue(s,e,t=s,i){var n,r;if(e===ue)return e;let a=i!==void 0?(n=t._$Co)==null?void 0:n[i]:t._$Cl;const o=yt(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==o&&((r=a==null?void 0:a._$AO)==null||r.call(a,!1),o===void 0?a=void 0:(a=new o(s),a._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=a:t._$Cl=a),a!==void 0&&(e=Ue(s,a._$AS(s,e.values),a,i)),e}class ui{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,n=((e==null?void 0:e.creationScope)??Le).importNode(t,!0);ze.currentNode=n;let r=ze.nextNode(),a=0,o=0,c=i[0];for(;c!==void 0;){if(a===c.index){let l;c.type===2?l=new nt(r,r.nextSibling,this,e):c.type===1?l=new c.ctor(r,c.name,c.strings,this,e):c.type===6&&(l=new fi(r,this,e)),this._$AV.push(l),c=i[++o]}a!==(c==null?void 0:c.index)&&(r=ze.nextNode(),a++)}return ze.currentNode=Le,n}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class nt{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,n){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cv=(n==null?void 0:n.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ue(this,e,t),yt(e)?e===V||e==null||e===""?(this._$AH!==V&&this._$AR(),this._$AH=V):e!==this._$AH&&e!==ue&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):si(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==V&&yt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Le.createTextNode(e)),this._$AH=e}$(e){var t;const{values:i,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=bt.createElement(di(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(i);else{const a=new ui(r,this),o=a.u(this.options);a.p(i),this.T(o),this._$AH=a}}_$AC(e){let t=ci.get(e.strings);return t===void 0&&ci.set(e.strings,t=new bt(e)),t}k(e){ti(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,n=0;for(const r of e)n===t.length?t.push(i=new nt(this.S(gt()),this.S(gt()),this,this.options)):i=t[n],i._$AI(r),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class wt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,n,r){this.type=1,this._$AH=V,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=V}_$AI(e,t=this,i,n){const r=this.strings;let a=!1;if(r===void 0)e=Ue(this,e,t,0),a=!yt(e)||e!==this._$AH&&e!==ue,a&&(this._$AH=e);else{const o=e;let c,l;for(e=r[0],c=0;c<r.length-1;c++)l=Ue(this,o[i+c],t,c),l===ue&&(l=this._$AH[c]),a||(a=!yt(l)||l!==this._$AH[c]),l===V?e=V:e!==V&&(e+=(l??"")+r[c+1]),this._$AH[c]=l}a&&!n&&this.j(e)}j(e){e===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class hi extends wt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===V?void 0:e}}class pi extends wt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==V)}}class mi extends wt{constructor(e,t,i,n,r){super(e,t,i,n,r),this.type=5}_$AI(e,t=this){if((e=Ue(this,e,t,0)??V)===ue)return;const i=this._$AH,n=e===V&&i!==V||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==V&&(i===V||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class fi{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ue(this,e)}}const _n={P:vs,A:ge,C:bs,M:1,L:li,R:ui,D:si,V:Ue,I:nt,H:wt,N:pi,U:mi,B:hi,F:fi},gi=Ft.litHtmlPolyfillSupport;gi==null||gi(bt,nt),(Ft.litHtmlVersions??(Ft.litHtmlVersions=[])).push("3.1.2");const xn=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let n=i._$litPart$;if(n===void 0){const r=(t==null?void 0:t.renderBefore)??null;i._$litPart$=n=new nt(e.insertBefore(gt(),r),r,void 0,t??{})}return n._$AI(s),n};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */let se=class extends tt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var s;const e=super.createRenderRoot();return(s=this.renderOptions).renderBefore??(s.renderBefore=e.firstChild),e}update(s){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(s),this._$Do=xn(e,this.renderRoot,this.renderOptions)}connectedCallback(){var s;super.connectedCallback(),(s=this._$Do)==null||s.setConnected(!0)}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._$Do)==null||s.setConnected(!1)}render(){return ue}};var gi;se._$litElement$=!0,se.finalized=!0,(gi=globalThis.litElementHydrateSupport)==null||gi.call(globalThis,{LitElement:se});const yi=globalThis.litElementPolyfillSupport;yi==null||yi({LitElement:se}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");const Ee=Qe`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: \"\"}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol,\"Noto Color Emoji\";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-8{bottom:2rem}.left-0{left:0}.left-8{left:2rem}.right-0{right:0}.right-8{right:2rem}.top-0{top:0}.z-50{z-index:50}.m-0{margin:0}.m-0\\.5{margin:.125rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-auto{margin-top:auto;margin-bottom:auto}.mb-1{margin-bottom:.25rem}.mb-\\[-8px\\]{margin-bottom:-8px}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-20{margin-left:5rem}.mr-2{margin-right:.5rem}.mr-20{margin-right:5rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-0{height:0px}.h-3\\/5{height:60%}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-9{height:2.25rem}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.max-h-\\[90vh\\]{max-height:90vh}.w-0{width:0px}.w-3\\/5{width:60%}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.max-w-\\[90vw\\]{max-width:90vw}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-x-8{border-left-width:8px;border-right-width:8px}.border-t-8{border-top-width:8px}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-x-transparent{border-left-color:transparent;border-right-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity: .5}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-0{padding-left:0;padding-right:0}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-0{padding-bottom:0}.pb-8{padding-bottom:2rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-semibold{font-weight:600}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:host{font-size:16px;line-height:1.2;color:#000;text-align:left;--iai-chat-i-primary-color: var(--iai-chat-primary-color, #3B82F6);--iai-chat-i-text-color: var(--iai-chat-text-color, #FFF);--iai-chat-i-header-bg: var(--iai-chat-header-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-header-fg: var(--iai-chat-header-text-color, var(--iai-chat-i-text-color));--iai-chat-i-button-bg: var(--iai-chat-button-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-button-fg: var(--iai-chat-button-text-color, var(--iai-chat-i-text-color));--iai-chat-i-message-user-bg: var(--iai-chat-messages-user-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-message-user-fg: var(--iai-chat-messages-user-text-color, var(--iai-chat-i-text-color));--iai-chat-i-message-assistant-bg: var(--iai-chat-messages-assistant-background-color, #6B7280);--iai-chat-i-message-assistant-fg: var(--iai-chat-messages-assistant-text-color, var(--iai-chat-i-text-color));--iai-chat-i-ocb-bg: var(--iai-chat-open-chat-button-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-ocb-fg: var(--iai-chat-open-chat-button-icon-color, var(--iai-chat-i-text-color));--iai-chat-i-iframe-modal-header-bg: var(--iai-chat-iframe-modal-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-iframe-modal-header-fg: var(--iai-chat-iframe-modal-text-color, var(--iai-chat-i-text-color))}input{background-color:#fff}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\\:bg-gray-200:disabled{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.disabled\\:opacity-50:disabled{opacity:.5}@media (min-width: 768px){.md\\:bottom-8{bottom:2rem}.md\\:left-8{left:2rem}.md\\:right-8{right:2rem}.md\\:flex{display:flex}.md\\:h-\\[500px\\]{height:500px}.md\\:h-fit{height:-moz-fit-content;height:fit-content}.md\\:w-\\[350px\\]{width:350px}.md\\:w-fit{width:-moz-fit-content;width:fit-content}.md\\:p-0{padding:0}.md\\:px-0{padding-left:0;padding-right:0}.md\\:pb-0{padding-bottom:0}}`;/**
19
+ */let se=class extends it{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var s;const e=super.createRenderRoot();return(s=this.renderOptions).renderBefore??(s.renderBefore=e.firstChild),e}update(s){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(s),this._$Do=xn(e,this.renderRoot,this.renderOptions)}connectedCallback(){var s;super.connectedCallback(),(s=this._$Do)==null||s.setConnected(!0)}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._$Do)==null||s.setConnected(!1)}render(){return ue}};var yi;se._$litElement$=!0,se.finalized=!0,(yi=globalThis.litElementHydrateSupport)==null||yi.call(globalThis,{LitElement:se});const vi=globalThis.litElementPolyfillSupport;vi==null||vi({LitElement:se}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");const Ee=tt`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: \"\"}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol,\"Noto Color Emoji\";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-8{bottom:2rem}.left-0{left:0}.left-8{left:2rem}.right-0{right:0}.right-8{right:2rem}.top-0{top:0}.z-50{z-index:50}.m-0{margin:0}.m-0\\.5{margin:.125rem}.m-2{margin:.5rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-auto{margin-top:auto;margin-bottom:auto}.mb-1{margin-bottom:.25rem}.mb-\\[-8px\\]{margin-bottom:-8px}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-20{margin-left:5rem}.mr-2{margin-right:.5rem}.mr-20{margin-right:5rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-0{height:0px}.h-3\\/5{height:60%}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-9{height:2.25rem}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.max-h-\\[90vh\\]{max-height:90vh}.w-0{width:0px}.w-3\\/5{width:60%}.w-5{width:1.25rem}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.max-w-\\[90vw\\]{max-width:90vw}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-x-8{border-left-width:8px;border-right-width:8px}.border-t-8{border-top-width:8px}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-x-transparent{border-left-color:transparent;border-right-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity: .5}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-0{padding-left:0;padding-right:0}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-0{padding-bottom:0}.pb-8{padding-bottom:2rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-semibold{font-weight:600}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:host{font-size:16px;line-height:1.2;color:#000;text-align:left;--iai-chat-i-primary-color: var(--iai-chat-primary-color, #3B82F6);--iai-chat-i-text-color: var(--iai-chat-text-color, #FFF);--iai-chat-i-header-bg: var(--iai-chat-header-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-header-fg: var(--iai-chat-header-text-color, var(--iai-chat-i-text-color));--iai-chat-i-button-bg: var(--iai-chat-button-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-button-fg: var(--iai-chat-button-text-color, var(--iai-chat-i-text-color));--iai-chat-i-message-user-bg: var(--iai-chat-messages-user-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-message-user-fg: var(--iai-chat-messages-user-text-color, var(--iai-chat-i-text-color));--iai-chat-i-message-assistant-bg: var(--iai-chat-messages-assistant-background-color, #6B7280);--iai-chat-i-message-assistant-fg: var(--iai-chat-messages-assistant-text-color, var(--iai-chat-i-text-color));--iai-chat-i-ocb-bg: var(--iai-chat-open-chat-button-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-ocb-fg: var(--iai-chat-open-chat-button-icon-color, var(--iai-chat-i-text-color));--iai-chat-i-iframe-modal-header-bg: var(--iai-chat-iframe-modal-background-color, var(--iai-chat-i-primary-color));--iai-chat-i-iframe-modal-header-fg: var(--iai-chat-iframe-modal-text-color, var(--iai-chat-i-text-color))}input{background-color:#fff}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\\:bg-gray-200:disabled{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.disabled\\:opacity-50:disabled{opacity:.5}@media (min-width: 768px){.md\\:bottom-8{bottom:2rem}.md\\:left-8{left:2rem}.md\\:right-8{right:2rem}.md\\:flex{display:flex}.md\\:h-\\[500px\\]{height:500px}.md\\:h-fit{height:-moz-fit-content;height:fit-content}.md\\:w-\\[350px\\]{width:350px}.md\\:w-fit{width:-moz-fit-content;width:fit-content}.md\\:p-0{padding:0}.md\\:px-0{padding-left:0;padding-right:0}.md\\:pb-0{padding-bottom:0}}`;/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
@@ -24,37 +24,37 @@
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const kn={attribute:!0,type:String,converter:Dt,reflect:!1,hasChanged:fs},Tn=(s=kn,e,t)=>{const{kind:i,metadata:n}=t;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),r.set(t.name,s),i==="accessor"){const{name:a}=t;return{set(o){const c=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,c,s)},init(o){return o!==void 0&&this.P(a,void 0,s),o}}}if(i==="setter"){const{name:a}=t;return function(o){const c=this[a];e.call(this,o),this.requestUpdate(a,c,s)}}throw Error("Unsupported decorator location: "+i)};function J(s){return(e,t)=>typeof t=="object"?Tn(s,e,t):((i,n,r)=>{const a=n.hasOwnProperty(r);return n.constructor.createProperty(r,a?{...i,wrapped:!0}:i),a?Object.getOwnPropertyDescriptor(n,r):void 0})(s,e,t)}/**
27
+ */const kn={attribute:!0,type:String,converter:Bt,reflect:!1,hasChanged:ys},Sn=(s=kn,e,t)=>{const{kind:i,metadata:n}=t;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),r.set(t.name,s),i==="accessor"){const{name:a}=t;return{set(o){const c=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,c,s)},init(o){return o!==void 0&&this.P(a,void 0,s),o}}}if(i==="setter"){const{name:a}=t;return function(o){const c=this[a];e.call(this,o),this.requestUpdate(a,c,s)}}throw Error("Unsupported decorator location: "+i)};function W(s){return(e,t)=>typeof t=="object"?Sn(s,e,t):((i,n,r)=>{const a=n.hasOwnProperty(r);return n.constructor.createProperty(r,a?{...i,wrapped:!0}:i),a?Object.getOwnPropertyDescriptor(n,r):void 0})(s,e,t)}/**
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */function it(s){return J({...s,state:!0,attribute:!1})}/**
31
+ */function rt(s){return W({...s,state:!0,attribute:!1})}/**
32
32
  * @license
33
33
  * Copyright 2017 Google LLC
34
34
  * SPDX-License-Identifier: BSD-3-Clause
35
- */const vi=(s,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(s,e,t),t);/**
35
+ */const bi=(s,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(s,e,t),t);/**
36
36
  * @license
37
37
  * Copyright 2017 Google LLC
38
38
  * SPDX-License-Identifier: BSD-3-Clause
39
- */function Sn(s,e){return(t,i,n)=>{const r=a=>{var o;return((o=a.renderRoot)==null?void 0:o.querySelector(s))??null};if(e){const{get:a,set:o}=typeof i=="object"?t:n??(()=>{const c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return vi(t,i,{get(){let c=a.call(this);return c===void 0&&(c=r(this),(c!==null||this.hasUpdated)&&o.call(this,c)),c}})}return vi(t,i,{get(){return r(this)}})}}/**
39
+ */function Tn(s,e){return(t,i,n)=>{const r=a=>{var o;return((o=a.renderRoot)==null?void 0:o.querySelector(s))??null};if(e){const{get:a,set:o}=typeof i=="object"?t:n??(()=>{const c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return bi(t,i,{get(){let c=a.call(this);return c===void 0&&(c=r(this),(c!==null||this.hasUpdated)&&o.call(this,c)),c}})}return bi(t,i,{get(){return r(this)}})}}/**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
- */const Bt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ft=s=>(...e)=>({_$litDirective$:s,values:e});let Vt=class{constructor(s){}get _$AU(){return this._$AM._$AU}_$AT(s,e,t){this._$Ct=s,this._$AM=e,this._$Ci=t}_$AS(s,e){return this.update(s,e)}update(s,e){return this.render(...e)}};/**
43
+ */const Wt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Kt=s=>(...e)=>({_$litDirective$:s,values:e});let Jt=class{constructor(s){}get _$AU(){return this._$AM._$AU}_$AT(s,e,t){this._$Ct=s,this._$AM=e,this._$Ci=t}_$AS(s,e){return this.update(s,e)}update(s,e){return this.render(...e)}};/**
44
44
  * @license
45
45
  * Copyright 2018 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const bi=Ft(class extends Vt{constructor(s){var e;if(super(s),s.type!==Bt.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var t,i;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in e)e[r]&&!((t=this.nt)!=null&&t.has(r))&&this.st.add(r);return this.render(e)}const n=s.element.classList;for(const r of this.st)r in e||(n.remove(r),this.st.delete(r));for(const r in e){const a=!!e[r];a===this.st.has(r)||(i=this.nt)!=null&&i.has(r)||(a?(n.add(r),this.st.add(r)):(n.remove(r),this.st.delete(r)))}return ue}});/**
47
+ */const wi=Kt(class extends Jt{constructor(s){var e;if(super(s),s.type!==Wt.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var t,i;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in e)e[r]&&!((t=this.nt)!=null&&t.has(r))&&this.st.add(r);return this.render(e)}const n=s.element.classList;for(const r of this.st)r in e||(n.remove(r),this.st.delete(r));for(const r in e){const a=!!e[r];a===this.st.has(r)||(i=this.nt)!=null&&i.has(r)||(a?(n.add(r),this.st.add(r)):(n.remove(r),this.st.delete(r)))}return ue}});/**
48
48
  * @license
49
49
  * Copyright 2018 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
- */const wi="important",$n=" !"+wi,vt=Ft(class extends Vt{constructor(s){var e;if(super(s),s.type!==Bt.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const n=e[i];if(n!=null){this.ft.add(i);const r=typeof n=="string"&&n.endsWith($n);i.includes("-")||r?t.setProperty(i,r?n.slice(0,-11):n,r?wi:""):t[i]=n}}return ue}});var j;(function(s){s.assertEqual=n=>n;function e(n){}s.assertIs=e;function t(n){throw new Error}s.assertNever=t,s.arrayToEnum=n=>{const r={};for(const a of n)r[a]=a;return r},s.getValidEnumValues=n=>{const r=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(const o of r)a[o]=n[o];return s.objectValues(a)},s.objectValues=n=>s.objectKeys(n).map(function(r){return n[r]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const r=[];for(const a in n)Object.prototype.hasOwnProperty.call(n,a)&&r.push(a);return r},s.find=(n,r)=>{for(const a of n)if(r(a))return a},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function i(n,r=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}s.joinValues=i,s.jsonStringifyReplacer=(n,r)=>typeof r=="bigint"?r.toString():r})(j||(j={}));var bs;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(bs||(bs={}));const f=j.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ae=s=>{switch(typeof s){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(s)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(s)?f.array:s===null?f.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?f.promise:typeof Map<"u"&&s instanceof Map?f.map:typeof Set<"u"&&s instanceof Set?f.set:typeof Date<"u"&&s instanceof Date?f.date:f.object;default:return f.unknown}},p=j.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"]),En=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class ie extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(r){return r.message},i={_errors:[]},n=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)i._errors.push(t(a));else{let o=i,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,j.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},i=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}ie.create=s=>new ie(s);const bt=(s,e)=>{let t;switch(s.code){case p.invalid_type:s.received===f.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case p.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,j.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:t=`Unrecognized key(s) in object: ${j.joinValues(s.keys,", ")}`;break;case p.invalid_union:t="Invalid input";break;case p.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${j.joinValues(s.options)}`;break;case p.invalid_enum_value:t=`Invalid enum value. Expected ${j.joinValues(s.options)}, received '${s.received}'`;break;case p.invalid_arguments:t="Invalid function arguments";break;case p.invalid_return_type:t="Invalid function return type";break;case p.invalid_date:t="Invalid date";break;case p.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:j.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case p.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case p.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case p.custom:t="Invalid input";break;case p.invalid_intersection_types:t="Intersection results could not be merged";break;case p.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case p.not_finite:t="Number must be finite";break;default:t=e.defaultError,j.assertNever(s)}return{message:t}};let _i=bt;function Cn(s){_i=s}function Wt(){return _i}const Kt=s=>{const{data:e,path:t,errorMaps:i,issueData:n}=s,r=[...t,...n.path||[]],a={...n,path:r};let o="";const c=i.filter(l=>!!l).slice().reverse();for(const l of c)o=l(a,{data:e,defaultError:o}).message;return{...n,path:r,message:n.message||o}},An=[];function g(s,e){const t=Kt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Wt(),bt].filter(i=>!!i)});s.common.issues.push(t)}class q{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const n of t){if(n.status==="aborted")return E;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const n of t)i.push({key:await n.key,value:await n.value});return q.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const n of t){const{key:r,value:a}=n;if(r.status==="aborted"||a.status==="aborted")return E;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(i[r.value]=a.value)}return{status:e.value,value:i}}}const E=Object.freeze({status:"aborted"}),xi=s=>({status:"dirty",value:s}),G=s=>({status:"valid",value:s}),ws=s=>s.status==="aborted",_s=s=>s.status==="dirty",wt=s=>s.status==="valid",Jt=s=>typeof Promise<"u"&&s instanceof Promise;var _;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_||(_={}));class he{constructor(e,t,i,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ki=(s,e)=>{if(wt(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ie(s.common.issues);return this._error=t,this._error}}};function C(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:i,description:n}=s;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(r,a)=>r.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:i??a.defaultError}:{message:t??a.defaultError},description:n}}class I{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)}get description(){return this._def.description}_getType(e){return Ae(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new q,ctx:{common:e.parent.common,data:e.data,parsedType:Ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Jt(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 i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){var i;const n={common:{issues:[],async:(i=t==null?void 0:t.async)!==null&&i!==void 0?i:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ae(e)},r=this._parseSync({data:e,path:n.path,parent:n});return ki(n,r)}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ae(e)},n=this._parse({data:e,path:i.path,parent:i}),r=await(Jt(n)?n:Promise.resolve(n));return ki(i,r)}refine(e,t){const i=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,r)=>{const a=e(n),o=()=>r.addIssue({code:p.custom,...i(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof t=="function"?t(i,n):t),!1))}_refinement(e){return new ae({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ve.create(this,this._def)}nullable(){return Be.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this,this._def)}promise(){return ot.create(this,this._def)}or(e){return Tt.create([this,e],this._def)}and(e){return St.create(this,e,this._def)}transform(e){return new ae({...C(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ot({...C(this._def),innerType:this,defaultValue:t,typeName:S.ZodDefault})}brand(){return new Si({typeName:S.ZodBranded,type:this,...C(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new es({...C(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 It.create(this,e)}readonly(){return ss.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const On=/^c[^\s-]{8,}$/i,In=/^[a-z][a-z0-9]*$/,Mn=/^[0-9A-HJKMNP-TV-Z]{26}$/,Nn=/^[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,Pn=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xs;const Rn=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Zn=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ln=s=>s.precision?s.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}Z$`):s.precision===0?s.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):s.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function zn(s,e){return!!((e==="v4"||!e)&&Rn.test(s)||(e==="v6"||!e)&&Zn.test(s))}class ne extends I{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_type,expected:f.string,received:n.parsedType}),E}const t=new q;let i;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(i=this._getOrReturnCtx(e,i),g(i,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="max")e.data.length>n.value&&(i=this._getOrReturnCtx(e,i),g(i,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="length"){const r=e.data.length>n.value,a=e.data.length<n.value;(r||a)&&(i=this._getOrReturnCtx(e,i),r?g(i,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):a&&g(i,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")Pn.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"email",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")xs||(xs=new RegExp(jn,"u")),xs.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"emoji",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")Nn.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"uuid",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")On.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"cuid",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")In.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"cuid2",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")Mn.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"ulid",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),g(i,{validation:"url",code:p.invalid_string,message:n.message}),t.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"regex",code:p.invalid_string,message:n.message}),t.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(i=this._getOrReturnCtx(e,i),g(i,{code:p.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(i=this._getOrReturnCtx(e,i),g(i,{code:p.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(i=this._getOrReturnCtx(e,i),g(i,{code:p.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?Ln(n).test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{code:p.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="ip"?zn(e.data,n.version)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"ip",code:p.invalid_string,message:n.message}),t.dirty()):j.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,i){return this.refinement(n=>e.test(n),{validation:t,code:p.invalid_string,..._.errToObj(i)})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,..._.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,..._.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errToObj(t)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new ne({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ne.create=s=>{var e;return new ne({checks:[],typeName:S.ZodString,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...C(s)})};function Dn(s,e){const t=(s.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=t>i?t:i,r=parseInt(s.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return r%a/Math.pow(10,n)}class Oe extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_type,expected:f.number,received:n.parsedType}),E}let t;const i=new q;for(const n of this._def.checks)n.kind==="int"?j.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),g(t,{code:p.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?Dn(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),g(t,{code:p.not_finite,message:n.message}),i.dirty()):j.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,i,n){return new Oe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:_.toString(n)}]})}_addCheck(e){return new Oe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&j.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Oe.create=s=>new Oe({checks:[],typeName:S.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...C(s)});class Ie extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_type,expected:f.bigint,received:n.parsedType}),E}let t;const i=new q;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):j.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,i,n){return new Ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:_.toString(n)}]})}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ie.create=s=>{var e;return new Ie({checks:[],typeName:S.ZodBigInt,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...C(s)})};class _t extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.boolean,received:t.parsedType}),E}return G(e.data)}}_t.create=s=>new _t({typeName:S.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...C(s)});class De extends I{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_type,expected:f.date,received:n.parsedType}),E}if(isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_date}),E}const t=new q;let i;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),g(i,{code:p.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),g(i,{code:p.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):j.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}De.create=s=>new De({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:S.ZodDate,...C(s)});class qt extends I{_parse(e){if(this._getType(e)!==f.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.symbol,received:t.parsedType}),E}return G(e.data)}}qt.create=s=>new qt({typeName:S.ZodSymbol,...C(s)});class xt extends I{_parse(e){if(this._getType(e)!==f.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.undefined,received:t.parsedType}),E}return G(e.data)}}xt.create=s=>new xt({typeName:S.ZodUndefined,...C(s)});class kt extends I{_parse(e){if(this._getType(e)!==f.null){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.null,received:t.parsedType}),E}return G(e.data)}}kt.create=s=>new kt({typeName:S.ZodNull,...C(s)});class nt extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return G(e.data)}}nt.create=s=>new nt({typeName:S.ZodAny,...C(s)});class Ue extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return G(e.data)}}Ue.create=s=>new Ue({typeName:S.ZodUnknown,...C(s)});class ye extends I{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.never,received:t.parsedType}),E}}ye.create=s=>new ye({typeName:S.ZodNever,...C(s)});class Yt extends I{_parse(e){if(this._getType(e)!==f.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.void,received:t.parsedType}),E}return G(e.data)}}Yt.create=s=>new Yt({typeName:S.ZodVoid,...C(s)});class re extends I{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return g(t,{code:p.invalid_type,expected:f.array,received:t.parsedType}),E;if(n.exactLength!==null){const a=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(a||o)&&(g(t,{code:a?p.too_big:p.too_small,minimum:o?n.exactLength.value:void 0,maximum:a?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(g(t,{code:p.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(g(t,{code:p.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>n.type._parseAsync(new he(t,a,t.path,o)))).then(a=>q.mergeArray(i,a));const r=[...t.data].map((a,o)=>n.type._parseSync(new he(t,a,t.path,o)));return q.mergeArray(i,r)}get element(){return this._def.type}min(e,t){return new re({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new re({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new re({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}re.create=(s,e)=>new re({type:s,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...C(e)});function rt(s){if(s instanceof U){const e={};for(const t in s.shape){const i=s.shape[t];e[t]=ve.create(rt(i))}return new U({...s._def,shape:()=>e})}else return s instanceof re?new re({...s._def,type:rt(s.element)}):s instanceof ve?ve.create(rt(s.unwrap())):s instanceof Be?Be.create(rt(s.unwrap())):s instanceof pe?pe.create(s.items.map(e=>rt(e))):s}class U extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=j.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const c=this._getOrReturnCtx(e);return g(c,{code:p.invalid_type,expected:f.object,received:c.parsedType}),E}const{status:t,ctx:i}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),a=[];if(!(this._def.catchall instanceof ye&&this._def.unknownKeys==="strip"))for(const c in i.data)r.includes(c)||a.push(c);const o=[];for(const c of r){const l=n[c],h=i.data[c];o.push({key:{status:"valid",value:c},value:l._parse(new he(i,h,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof ye){const c=this._def.unknownKeys;if(c==="passthrough")for(const l of a)o.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")a.length>0&&(g(i,{code:p.unrecognized_keys,keys:a}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const l of a){const h=i.data[l];o.push({key:{status:"valid",value:l},value:c._parse(new he(i,h,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const l of o){const h=await l.key;c.push({key:h,value:await l.value,alwaysSet:l.alwaysSet})}return c}).then(c=>q.mergeObjectSync(t,c)):q.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new U({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{var n,r,a,o;const c=(a=(r=(n=this._def).errorMap)===null||r===void 0?void 0:r.call(n,t,i).message)!==null&&a!==void 0?a:i.defaultError;return t.code==="unrecognized_keys"?{message:(o=_.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new U({...this._def,unknownKeys:"strip"})}passthrough(){return new U({...this._def,unknownKeys:"passthrough"})}extend(e){return new U({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new U({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:S.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new U({...this._def,catchall:e})}pick(e){const t={};return j.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(t[i]=this.shape[i])}),new U({...this._def,shape:()=>t})}omit(e){const t={};return j.objectKeys(this.shape).forEach(i=>{e[i]||(t[i]=this.shape[i])}),new U({...this._def,shape:()=>t})}deepPartial(){return rt(this)}partial(e){const t={};return j.objectKeys(this.shape).forEach(i=>{const n=this.shape[i];e&&!e[i]?t[i]=n:t[i]=n.optional()}),new U({...this._def,shape:()=>t})}required(e){const t={};return j.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])t[i]=this.shape[i];else{let n=this.shape[i];for(;n instanceof ve;)n=n._def.innerType;t[i]=n}}),new U({...this._def,shape:()=>t})}keyof(){return Ti(j.objectKeys(this.shape))}}U.create=(s,e)=>new U({shape:()=>s,unknownKeys:"strip",catchall:ye.create(),typeName:S.ZodObject,...C(e)}),U.strictCreate=(s,e)=>new U({shape:()=>s,unknownKeys:"strict",catchall:ye.create(),typeName:S.ZodObject,...C(e)}),U.lazycreate=(s,e)=>new U({shape:s,unknownKeys:"strip",catchall:ye.create(),typeName:S.ZodObject,...C(e)});class Tt extends I{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;function n(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=r.map(o=>new ie(o.ctx.common.issues));return g(t,{code:p.invalid_union,unionErrors:a}),E}if(t.common.async)return Promise.all(i.map(async r=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let r;const a=[];for(const c of i){const l={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!r&&(r={result:h,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(c=>new ie(c));return g(t,{code:p.invalid_union,unionErrors:o}),E}}get options(){return this._def.options}}Tt.create=(s,e)=>new Tt({options:s,typeName:S.ZodUnion,...C(e)});const Gt=s=>s instanceof Et?Gt(s.schema):s instanceof ae?Gt(s.innerType()):s instanceof Ct?[s.value]:s instanceof Me?s.options:s instanceof At?Object.keys(s.enum):s instanceof Ot?Gt(s._def.innerType):s instanceof xt?[void 0]:s instanceof kt?[null]:null;class Xt extends I{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return g(t,{code:p.invalid_type,expected:f.object,received:t.parsedType}),E;const i=this.discriminator,n=t.data[i],r=this.optionsMap.get(n);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(g(t,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const n=new Map;for(const r of t){const a=Gt(r.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,r)}}return new Xt({typeName:S.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...C(i)})}}function ks(s,e){const t=Ae(s),i=Ae(e);if(s===e)return{valid:!0,data:s};if(t===f.object&&i===f.object){const n=j.objectKeys(e),r=j.objectKeys(s).filter(o=>n.indexOf(o)!==-1),a={...s,...e};for(const o of r){const c=ks(s[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===f.array&&i===f.array){if(s.length!==e.length)return{valid:!1};const n=[];for(let r=0;r<s.length;r++){const a=s[r],o=e[r],c=ks(a,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===f.date&&i===f.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class St extends I{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=(r,a)=>{if(ws(r)||ws(a))return E;const o=ks(r.value,a.value);return o.valid?((_s(r)||_s(a))&&t.dirty(),{status:t.value,value:o.data}):(g(i,{code:p.invalid_intersection_types}),E)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([r,a])=>n(r,a)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}St.create=(s,e,t)=>new St({left:s,right:e,typeName:S.ZodIntersection,...C(t)});class pe extends I{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==f.array)return g(i,{code:p.invalid_type,expected:f.array,received:i.parsedType}),E;if(i.data.length<this._def.items.length)return g(i,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&i.data.length>this._def.items.length&&(g(i,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...i.data].map((r,a)=>{const o=this._def.items[a]||this._def.rest;return o?o._parse(new he(i,r,i.path,a)):null}).filter(r=>!!r);return i.common.async?Promise.all(n).then(r=>q.mergeArray(t,r)):q.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new pe({...this._def,rest:e})}}pe.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pe({items:s,typeName:S.ZodTuple,rest:null,...C(e)})};class $t extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==f.object)return g(i,{code:p.invalid_type,expected:f.object,received:i.parsedType}),E;const n=[],r=this._def.keyType,a=this._def.valueType;for(const o in i.data)n.push({key:r._parse(new he(i,o,i.path,o)),value:a._parse(new he(i,i.data[o],i.path,o))});return i.common.async?q.mergeObjectAsync(t,n):q.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof I?new $t({keyType:e,valueType:t,typeName:S.ZodRecord,...C(i)}):new $t({keyType:ne.create(),valueType:e,typeName:S.ZodRecord,...C(t)})}}class Qt extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==f.map)return g(i,{code:p.invalid_type,expected:f.map,received:i.parsedType}),E;const n=this._def.keyType,r=this._def.valueType,a=[...i.data.entries()].map(([o,c],l)=>({key:n._parse(new he(i,o,i.path,[l,"key"])),value:r._parse(new he(i,c,i.path,[l,"value"]))}));if(i.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of a){const l=await c.key,h=await c.value;if(l.status==="aborted"||h.status==="aborted")return E;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(l.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of a){const l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return E;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(l.value,h.value)}return{status:t.value,value:o}}}}Qt.create=(s,e,t)=>new Qt({valueType:e,keyType:s,typeName:S.ZodMap,...C(t)});class He extends I{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==f.set)return g(i,{code:p.invalid_type,expected:f.set,received:i.parsedType}),E;const n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(g(i,{code:p.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(g(i,{code:p.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function a(c){const l=new Set;for(const h of c){if(h.status==="aborted")return E;h.status==="dirty"&&t.dirty(),l.add(h.value)}return{status:t.value,value:l}}const o=[...i.data.values()].map((c,l)=>r._parse(new he(i,c,i.path,l)));return i.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new He({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new He({...this._def,maxSize:{value:e,message:_.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}He.create=(s,e)=>new He({valueType:s,minSize:null,maxSize:null,typeName:S.ZodSet,...C(e)});class at extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return g(t,{code:p.invalid_type,expected:f.function,received:t.parsedType}),E;function i(o,c){return Kt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Wt(),bt].filter(l=>!!l),issueData:{code:p.invalid_arguments,argumentsError:c}})}function n(o,c){return Kt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Wt(),bt].filter(l=>!!l),issueData:{code:p.invalid_return_type,returnTypeError:c}})}const r={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ot){const o=this;return G(async function(...c){const l=new ie([]),h=await o._def.args.parseAsync(c,r).catch(d=>{throw l.addIssue(i(c,d)),l}),m=await Reflect.apply(a,this,h);return await o._def.returns._def.type.parseAsync(m,r).catch(d=>{throw l.addIssue(n(m,d)),l})})}else{const o=this;return G(function(...c){const l=o._def.args.safeParse(c,r);if(!l.success)throw new ie([i(c,l.error)]);const h=Reflect.apply(a,this,l.data),m=o._def.returns.safeParse(h,r);if(!m.success)throw new ie([n(h,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new at({...this._def,args:pe.create(e).rest(Ue.create())})}returns(e){return new at({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new at({args:e||pe.create([]).rest(Ue.create()),returns:t||Ue.create(),typeName:S.ZodFunction,...C(i)})}}class Et extends I{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})}}Et.create=(s,e)=>new Et({getter:s,typeName:S.ZodLazy,...C(e)});class Ct extends I{_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}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ct.create=(s,e)=>new Ct({value:s,typeName:S.ZodLiteral,...C(e)});function Ti(s,e){return new Me({values:s,typeName:S.ZodEnum,...C(e)})}class Me extends I{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),i=this._def.values;return g(t,{expected:j.joinValues(i),received:t.parsedType,code:p.invalid_type}),E}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),i=this._def.values;return g(t,{received:t.data,code:p.invalid_enum_value,options:i}),E}return G(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Me.create(e)}exclude(e){return Me.create(this.options.filter(t=>!e.includes(t)))}}Me.create=Ti;class At extends I{_parse(e){const t=j.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==f.string&&i.parsedType!==f.number){const n=j.objectValues(t);return g(i,{expected:j.joinValues(n),received:i.parsedType,code:p.invalid_type}),E}if(t.indexOf(e.data)===-1){const n=j.objectValues(t);return g(i,{received:i.data,code:p.invalid_enum_value,options:n}),E}return G(e.data)}get enum(){return this._def.values}}At.create=(s,e)=>new At({values:s,typeName:S.ZodNativeEnum,...C(e)});class ot extends I{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return g(t,{code:p.invalid_type,expected:f.promise,received:t.parsedType}),E;const i=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return G(i.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ot.create=(s,e)=>new ot({type:s,typeName:S.ZodPromise,...C(e)});class ae extends I{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:i}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:a=>{g(i,a),a.fatal?t.abort():t.dirty()},get path(){return i.path}};if(r.addIssue=r.addIssue.bind(r),n.type==="preprocess"){const a=n.transform(i.data,r);return i.common.issues.length?{status:"dirty",value:i.data}:i.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:i.path,parent:i})):this._def.schema._parseSync({data:a,path:i.path,parent:i})}if(n.type==="refinement"){const a=o=>{const c=n.refinement(o,r);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?E:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>o.status==="aborted"?E:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!wt(a))return a;const o=n.transform(a.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>wt(a)?Promise.resolve(n.transform(a.value,r)).then(o=>({status:t.value,value:o})):a);j.assertNever(n)}}ae.create=(s,e,t)=>new ae({schema:s,typeName:S.ZodEffects,effect:e,...C(t)}),ae.createWithPreprocess=(s,e,t)=>new ae({schema:e,effect:{type:"preprocess",transform:s},typeName:S.ZodEffects,...C(t)});class ve extends I{_parse(e){return this._getType(e)===f.undefined?G(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ve.create=(s,e)=>new ve({innerType:s,typeName:S.ZodOptional,...C(e)});class Be extends I{_parse(e){return this._getType(e)===f.null?G(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Be.create=(s,e)=>new Be({innerType:s,typeName:S.ZodNullable,...C(e)});class Ot extends I{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===f.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ot.create=(s,e)=>new Ot({innerType:s,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...C(e)});class es extends I{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Jt(n)?n.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ie(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ie(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}es.create=(s,e)=>new es({innerType:s,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...C(e)});class ts extends I{_parse(e){if(this._getType(e)!==f.nan){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.nan,received:t.parsedType}),E}return{status:"valid",value:e.data}}}ts.create=s=>new ts({typeName:S.ZodNaN,...C(s)});const Un=Symbol("zod_brand");class Si extends I{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}}class It extends I{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?E:n.status==="dirty"?(t.dirty(),xi(n.value)):this._def.out._parseAsync({data:n.value,path:i.path,parent:i})})();{const n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?E:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,t){return new It({in:e,out:t,typeName:S.ZodPipeline})}}class ss extends I{_parse(e){const t=this._def.innerType._parse(e);return wt(t)&&(t.value=Object.freeze(t.value)),t}}ss.create=(s,e)=>new ss({innerType:s,typeName:S.ZodReadonly,...C(e)});const $i=(s,e={},t)=>s?nt.create().superRefine((i,n)=>{var r,a;if(!s(i)){const o=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,c=(a=(r=o.fatal)!==null&&r!==void 0?r:t)!==null&&a!==void 0?a:!0,l=typeof o=="string"?{message:o}:o;n.addIssue({code:"custom",...l,fatal:c})}}):nt.create(),Hn={object:U.lazycreate};var S;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(S||(S={}));const Bn=(s,e={message:`Input not instance of ${s.name}`})=>$i(t=>t instanceof s,e),Ei=ne.create,Ci=Oe.create,Fn=ts.create,Vn=Ie.create,Ai=_t.create,Wn=De.create,Kn=qt.create,Jn=xt.create,qn=kt.create,Yn=nt.create,Gn=Ue.create,Xn=ye.create,Qn=Yt.create,er=re.create,tr=U.create,sr=U.strictCreate,ir=Tt.create,nr=Xt.create,rr=St.create,ar=pe.create,or=$t.create,cr=Qt.create,dr=He.create,lr=at.create,ur=Et.create,hr=Ct.create,pr=Me.create,mr=At.create,fr=ot.create,Oi=ae.create,gr=ve.create,yr=Be.create,vr=ae.createWithPreprocess,br=It.create;var w=Object.freeze({__proto__:null,defaultErrorMap:bt,setErrorMap:Cn,getErrorMap:Wt,makeIssue:Kt,EMPTY_PATH:An,addIssueToContext:g,ParseStatus:q,INVALID:E,DIRTY:xi,OK:G,isAborted:ws,isDirty:_s,isValid:wt,isAsync:Jt,get util(){return j},get objectUtil(){return bs},ZodParsedType:f,getParsedType:Ae,ZodType:I,ZodString:ne,ZodNumber:Oe,ZodBigInt:Ie,ZodBoolean:_t,ZodDate:De,ZodSymbol:qt,ZodUndefined:xt,ZodNull:kt,ZodAny:nt,ZodUnknown:Ue,ZodNever:ye,ZodVoid:Yt,ZodArray:re,ZodObject:U,ZodUnion:Tt,ZodDiscriminatedUnion:Xt,ZodIntersection:St,ZodTuple:pe,ZodRecord:$t,ZodMap:Qt,ZodSet:He,ZodFunction:at,ZodLazy:Et,ZodLiteral:Ct,ZodEnum:Me,ZodNativeEnum:At,ZodPromise:ot,ZodEffects:ae,ZodTransformer:ae,ZodOptional:ve,ZodNullable:Be,ZodDefault:Ot,ZodCatch:es,ZodNaN:ts,BRAND:Un,ZodBranded:Si,ZodPipeline:It,ZodReadonly:ss,custom:$i,Schema:I,ZodSchema:I,late:Hn,get ZodFirstPartyTypeKind(){return S},coerce:{string:s=>ne.create({...s,coerce:!0}),number:s=>Oe.create({...s,coerce:!0}),boolean:s=>_t.create({...s,coerce:!0}),bigint:s=>Ie.create({...s,coerce:!0}),date:s=>De.create({...s,coerce:!0})},any:Yn,array:er,bigint:Vn,boolean:Ai,date:Wn,discriminatedUnion:nr,effect:Oi,enum:pr,function:lr,instanceof:Bn,intersection:rr,lazy:ur,literal:hr,map:cr,nan:Fn,nativeEnum:mr,never:Xn,null:qn,nullable:yr,number:Ci,object:tr,oboolean:()=>Ai().optional(),onumber:()=>Ci().optional(),optional:gr,ostring:()=>Ei().optional(),pipeline:br,preprocess:vr,promise:fr,record:or,set:dr,strictObject:sr,string:Ei,symbol:Kn,transformer:Oi,tuple:ar,undefined:Jn,union:ir,unknown:Gn,void:Qn,NEVER:E,ZodIssueCode:p,quotelessJson:En,ZodError:ie});const is=w.object({assistantId:w.string(),params:w.record(w.any()).default({}),config:w.object({historyKey:w.string().refine(s=>s.replace(/-/g,"_")).nullable().default("main"),welcomeMessage:w.string().default("Hello! How can I help you today?"),initialReplyMessage:w.string().nullable().default(null),placement:w.enum(["left","right"]).default("right"),openChatButton:w.object({imageSrc:w.string().optional(),width:w.union([w.string(),w.number()]).default("48px"),height:w.union([w.string(),w.number()]).default("48px"),cta:w.string().optional()}).default({}),chatWindow:w.object({header:w.object({text:w.string().nullable().default("AI Chat"),imageSrc:w.string().optional()}).default({}),showCloseButton:w.boolean().default(!0)}).default({}),styles:w.object({primaryColor:w.string().optional(),textColor:w.string().optional(),openChatButton:w.object({backgroundColor:w.string().optional(),iconColor:w.string().optional()}).optional(),header:w.object({backgroundColor:w.string().optional(),textColor:w.string().optional()}).optional(),button:w.object({backgroundColor:w.string().optional(),textColor:w.string().optional()}).optional(),messages:w.object({user:w.object({backgroundColor:w.string().optional(),textColor:w.string().optional()}).optional(),assistant:w.object({backgroundColor:w.string().optional(),textColor:w.string().optional()}).optional()}).optional()}).default({})}).default({}),handlers:w.object({functionCalls:w.record(w.function().returns(w.union([w.any(),w.promise(w.any())]))).default({}),enhancedContent:w.record(w.function().returns(w.union([w.any(),w.promise(w.any())]))).default({})}).default({})});function wr(s){if(Array.isArray(s)){for(var e=0,t=Array(s.length);e<s.length;e++)t[e]=s[e];return t}else return Array.from(s)}var Ts=!1;if(typeof window<"u"){var Ii={get passive(){Ts=!0}};window.addEventListener("testPassive",null,Ii),window.removeEventListener("testPassive",null,Ii)}var ns=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),Fe=[],rs=!1,Mi=-1,Mt=void 0,Ve=void 0,Nt=void 0,Ni=function(s){return Fe.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(s))})},Ss=function(s){var e=s||window.event;return Ni(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},_r=function(s){if(Nt===void 0){var e=!!s&&s.reserveScrollBarGap===!0,t=window.innerWidth-document.documentElement.clientWidth;if(e&&t>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);Nt=document.body.style.paddingRight,document.body.style.paddingRight=i+t+"px"}}Mt===void 0&&(Mt=document.body.style.overflow,document.body.style.overflow="hidden")},xr=function(){Nt!==void 0&&(document.body.style.paddingRight=Nt,Nt=void 0),Mt!==void 0&&(document.body.style.overflow=Mt,Mt=void 0)},kr=function(){return window.requestAnimationFrame(function(){if(Ve===void 0){Ve={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var s=window,e=s.scrollY,t=s.scrollX,i=s.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-t,setTimeout(function(){return window.requestAnimationFrame(function(){var n=i-window.innerHeight;n&&e>=i&&(document.body.style.top=-(e+n))})},300)}})},Tr=function(){if(Ve!==void 0){var s=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=Ve.position,document.body.style.top=Ve.top,document.body.style.left=Ve.left,window.scrollTo(e,s),Ve=void 0}},Sr=function(s){return s?s.scrollHeight-s.scrollTop<=s.clientHeight:!1},$r=function(s,e){var t=s.targetTouches[0].clientY-Mi;return Ni(s.target)?!1:e&&e.scrollTop===0&&t>0||Sr(e)&&t<0?Ss(s):(s.stopPropagation(),!0)},Er=function(s,e){if(!s){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!Fe.some(function(i){return i.targetElement===s})){var t={targetElement:s,options:e||{}};Fe=[].concat(wr(Fe),[t]),ns?kr():_r(e),ns&&(s.ontouchstart=function(i){i.targetTouches.length===1&&(Mi=i.targetTouches[0].clientY)},s.ontouchmove=function(i){i.targetTouches.length===1&&$r(i,s)},rs||(document.addEventListener("touchmove",Ss,Ts?{passive:!1}:void 0),rs=!0))}},Pi=function(s){if(!s){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}Fe=Fe.filter(function(e){return e.targetElement!==s}),ns&&(s.ontouchstart=null,s.ontouchmove=null,rs&&Fe.length===0&&(document.removeEventListener("touchmove",Ss,Ts?{passive:!1}:void 0),rs=!1)),ns?Tr():xr()},Cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ji(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var $s={};(function(s){function e(o){o&&o.options&&clearTimeout(o.options.timer)}function t(o,c,l,h){var m={timer:void 0,lastArgs:[]},d=function(){for(var b=this,N=[],H=0;H<arguments.length;H++)N[H]=arguments[H];m.lastArgs=N,m.timer?clearTimeout(m.timer):c&&l.apply(this,m.lastArgs),m.timer=setTimeout(function(){c||l.apply(b,m.lastArgs),m.timer=void 0},o)};return h&&(d=d.bind(h)),d.options=m,d}function i(o,c,l,h){var m;Object.defineProperty(l,h,{configurable:!0,enumerable:!1,get:function(){return m},set:function(d){m=t(o,c,d,this)}})}function n(o,c,l){var h=l.value;return l.value=t(o,c,h),l}function r(o,c){for(var l=[],h=2;h<arguments.length;h++)l[h-2]=arguments[h];if(l.length===0)throw new Error("function applied debounce decorator should be a method");if(l.length===1)throw new Error("method applied debounce decorator should have valid name");var m=l[0],d=l[1],b=l.length===3&&l[2]?l[2]:Object.getOwnPropertyDescriptor(m,d);if(b)return n(o,c,b);i(o,c,m,d)}function a(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];var l=500,h=!1;if(o.length&&(typeof o[0]=="number"||typeof o[0]=="object"&&o[0].leading!==void 0)){typeof o[0]=="number"&&(l=o[0]);var m=void 0;return typeof o[0]=="object"&&o[0].leading!==void 0&&(m=o[0]),1<o.length&&typeof o[1]=="object"&&o[1].leading!==void 0&&(m=o[1]),m&&(h=m.leading),function(){for(var d=[],b=0;b<arguments.length;b++)d[b]=arguments[b];return r.apply(void 0,[l,h].concat(d))}}return r.apply(void 0,[l,h].concat(o))}Object.defineProperty(s,"__esModule",{value:!0}),s.cancel=e,s.debounce=a})($s);var Ar=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,Pt=(s,e,t,i)=>{for(var n=i>1?void 0:i?Or(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Ar(e,t,n),n};let We=class extends se{constructor(){super(...arguments),this.isOpen=!0,this.onResizeHandler=()=>{this.isOpen&&window.innerWidth<768?Er(this):Pi(this)}}connectedCallback(){super.connectedCallback(),this.cleanOptions=is.parse(this.options),this.onResizeHandler(),window.addEventListener("resize",this.onResizeHandler,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),Pi(this),window.removeEventListener("resize",this.onResizeHandler)}render(){const s=this.cleanOptions.config.placement!=="left",e=bi({fixed:!0,"bottom-0":!0,"w-full":this.isOpen,"h-full":this.isOpen,...s&&{"right-0":!0,"md:right-8":!0},...!s&&{"left-0":!0,"md:left-8":!0},"md:bottom-8":!0,"md:w-fit":!0,"md:h-fit":!0}),t=bi({"mt-4":!0,"px-8":!0,"pb-8":!0,"w-full":!0,hidden:this.isOpen,flex:!this.isOpen,"md:px-0":!0,"md:pb-0":!0,"md:w-[350px]":!0,"md:flex":!0});return z`
51
+ */const _i="important",$n=" !"+_i,at=Kt(class extends Jt{constructor(s){var e;if(super(s),s.type!==Wt.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const n=e[i];if(n!=null){this.ft.add(i);const r=typeof n=="string"&&n.endsWith($n);i.includes("-")||r?t.setProperty(i,r?n.slice(0,-11):n,r?_i:""):t[i]=n}}return ue}});var j;(function(s){s.assertEqual=n=>n;function e(n){}s.assertIs=e;function t(n){throw new Error}s.assertNever=t,s.arrayToEnum=n=>{const r={};for(const a of n)r[a]=a;return r},s.getValidEnumValues=n=>{const r=s.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),a={};for(const o of r)a[o]=n[o];return s.objectValues(a)},s.objectValues=n=>s.objectKeys(n).map(function(r){return n[r]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const r=[];for(const a in n)Object.prototype.hasOwnProperty.call(n,a)&&r.push(a);return r},s.find=(n,r)=>{for(const a of n)if(r(a))return a},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function i(n,r=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}s.joinValues=i,s.jsonStringifyReplacer=(n,r)=>typeof r=="bigint"?r.toString():r})(j||(j={}));var _s;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(_s||(_s={}));const f=j.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ae=s=>{switch(typeof s){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(s)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(s)?f.array:s===null?f.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?f.promise:typeof Map<"u"&&s instanceof Map?f.map:typeof Set<"u"&&s instanceof Set?f.set:typeof Date<"u"&&s instanceof Date?f.date:f.object;default:return f.unknown}},p=j.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"]),En=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class ie extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(r){return r.message},i={_errors:[]},n=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)i._errors.push(t(a));else{let o=i,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(a))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,j.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},i=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}}ie.create=s=>new ie(s);const _t=(s,e)=>{let t;switch(s.code){case p.invalid_type:s.received===f.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case p.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,j.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:t=`Unrecognized key(s) in object: ${j.joinValues(s.keys,", ")}`;break;case p.invalid_union:t="Invalid input";break;case p.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${j.joinValues(s.options)}`;break;case p.invalid_enum_value:t=`Invalid enum value. Expected ${j.joinValues(s.options)}, received '${s.received}'`;break;case p.invalid_arguments:t="Invalid function arguments";break;case p.invalid_return_type:t="Invalid function return type";break;case p.invalid_date:t="Invalid date";break;case p.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:j.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case p.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case p.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case p.custom:t="Invalid input";break;case p.invalid_intersection_types:t="Intersection results could not be merged";break;case p.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case p.not_finite:t="Number must be finite";break;default:t=e.defaultError,j.assertNever(s)}return{message:t}};let xi=_t;function Cn(s){xi=s}function qt(){return xi}const Yt=s=>{const{data:e,path:t,errorMaps:i,issueData:n}=s,r=[...t,...n.path||[]],a={...n,path:r};let o="";const c=i.filter(l=>!!l).slice().reverse();for(const l of c)o=l(a,{data:e,defaultError:o}).message;return{...n,path:r,message:n.message||o}},An=[];function g(s,e){const t=Yt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,qt(),_t].filter(i=>!!i)});s.common.issues.push(t)}class q{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const n of t){if(n.status==="aborted")return E;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const n of t)i.push({key:await n.key,value:await n.value});return q.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const n of t){const{key:r,value:a}=n;if(r.status==="aborted"||a.status==="aborted")return E;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||n.alwaysSet)&&(i[r.value]=a.value)}return{status:e.value,value:i}}}const E=Object.freeze({status:"aborted"}),ki=s=>({status:"dirty",value:s}),G=s=>({status:"valid",value:s}),xs=s=>s.status==="aborted",ks=s=>s.status==="dirty",xt=s=>s.status==="valid",Gt=s=>typeof Promise<"u"&&s instanceof Promise;var _;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(_||(_={}));class he{constructor(e,t,i,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Si=(s,e)=>{if(xt(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ie(s.common.issues);return this._error=t,this._error}}};function C(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:i,description:n}=s;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(r,a)=>r.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:i??a.defaultError}:{message:t??a.defaultError},description:n}}class I{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)}get description(){return this._def.description}_getType(e){return Ae(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new q,ctx:{common:e.parent.common,data:e.data,parsedType:Ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Gt(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 i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){var i;const n={common:{issues:[],async:(i=t==null?void 0:t.async)!==null&&i!==void 0?i:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ae(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Si(n,r)}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ae(e)},n=this._parse({data:e,path:i.path,parent:i}),r=await(Gt(n)?n:Promise.resolve(n));return Si(i,r)}refine(e,t){const i=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,r)=>{const a=e(n),o=()=>r.addIssue({code:p.custom,...i(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof t=="function"?t(i,n):t),!1))}_refinement(e){return new ae({schema:this,typeName:T.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ve.create(this,this._def)}nullable(){return Ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this,this._def)}promise(){return lt.create(this,this._def)}or(e){return $t.create([this,e],this._def)}and(e){return Et.create(this,e,this._def)}transform(e){return new ae({...C(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Mt({...C(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new $i({typeName:T.ZodBranded,type:this,...C(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new is({...C(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Nt.create(this,e)}readonly(){return rs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const On=/^c[^\s-]{8,}$/i,In=/^[a-z][a-z0-9]*$/,Mn=/^[0-9A-HJKMNP-TV-Z]{26}$/,Nn=/^[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,Pn=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ss;const Rn=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Zn=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ln=s=>s.precision?s.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${s.precision}}Z$`):s.precision===0?s.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):s.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Dn(s,e){return!!((e==="v4"||!e)&&Rn.test(s)||(e==="v6"||!e)&&Zn.test(s))}class ne extends I{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_type,expected:f.string,received:n.parsedType}),E}const t=new q;let i;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(i=this._getOrReturnCtx(e,i),g(i,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="max")e.data.length>n.value&&(i=this._getOrReturnCtx(e,i),g(i,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if(n.kind==="length"){const r=e.data.length>n.value,a=e.data.length<n.value;(r||a)&&(i=this._getOrReturnCtx(e,i),r?g(i,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):a&&g(i,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if(n.kind==="email")Pn.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"email",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="emoji")Ss||(Ss=new RegExp(jn,"u")),Ss.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"emoji",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="uuid")Nn.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"uuid",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid")On.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"cuid",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="cuid2")In.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"cuid2",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="ulid")Mn.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"ulid",code:p.invalid_string,message:n.message}),t.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),g(i,{validation:"url",code:p.invalid_string,message:n.message}),t.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"regex",code:p.invalid_string,message:n.message}),t.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(i=this._getOrReturnCtx(e,i),g(i,{code:p.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(i=this._getOrReturnCtx(e,i),g(i,{code:p.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(i=this._getOrReturnCtx(e,i),g(i,{code:p.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):n.kind==="datetime"?Ln(n).test(e.data)||(i=this._getOrReturnCtx(e,i),g(i,{code:p.invalid_string,validation:"datetime",message:n.message}),t.dirty()):n.kind==="ip"?Dn(e.data,n.version)||(i=this._getOrReturnCtx(e,i),g(i,{validation:"ip",code:p.invalid_string,message:n.message}),t.dirty()):j.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,i){return this.refinement(n=>e.test(n),{validation:t,code:p.invalid_string,..._.errToObj(i)})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,..._.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,..._.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errToObj(t)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new ne({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ne.create=s=>{var e;return new ne({checks:[],typeName:T.ZodString,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...C(s)})};function zn(s,e){const t=(s.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=t>i?t:i,r=parseInt(s.toFixed(n).replace(".","")),a=parseInt(e.toFixed(n).replace(".",""));return r%a/Math.pow(10,n)}class Oe extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_type,expected:f.number,received:n.parsedType}),E}let t;const i=new q;for(const n of this._def.checks)n.kind==="int"?j.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),g(t,{code:p.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?zn(e.data,n.value)!==0&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),g(t,{code:p.not_finite,message:n.message}),i.dirty()):j.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,i,n){return new Oe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:_.toString(n)}]})}_addCheck(e){return new Oe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&j.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Oe.create=s=>new Oe({checks:[],typeName:T.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...C(s)});class Ie extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_type,expected:f.bigint,received:n.parsedType}),E}let t;const i=new q;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),g(t,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):j.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,i,n){return new Ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:_.toString(n)}]})}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ie.create=s=>{var e;return new Ie({checks:[],typeName:T.ZodBigInt,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...C(s)})};class kt extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.boolean,received:t.parsedType}),E}return G(e.data)}}kt.create=s=>new kt({typeName:T.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...C(s)});class He extends I{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_type,expected:f.date,received:n.parsedType}),E}if(isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return g(n,{code:p.invalid_date}),E}const t=new q;let i;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),g(i,{code:p.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),g(i,{code:p.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):j.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new He({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}He.create=s=>new He({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:T.ZodDate,...C(s)});class Xt extends I{_parse(e){if(this._getType(e)!==f.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.symbol,received:t.parsedType}),E}return G(e.data)}}Xt.create=s=>new Xt({typeName:T.ZodSymbol,...C(s)});class St extends I{_parse(e){if(this._getType(e)!==f.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.undefined,received:t.parsedType}),E}return G(e.data)}}St.create=s=>new St({typeName:T.ZodUndefined,...C(s)});class Tt extends I{_parse(e){if(this._getType(e)!==f.null){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.null,received:t.parsedType}),E}return G(e.data)}}Tt.create=s=>new Tt({typeName:T.ZodNull,...C(s)});class ot extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return G(e.data)}}ot.create=s=>new ot({typeName:T.ZodAny,...C(s)});class Be extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return G(e.data)}}Be.create=s=>new Be({typeName:T.ZodUnknown,...C(s)});class ye extends I{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.never,received:t.parsedType}),E}}ye.create=s=>new ye({typeName:T.ZodNever,...C(s)});class Qt extends I{_parse(e){if(this._getType(e)!==f.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.void,received:t.parsedType}),E}return G(e.data)}}Qt.create=s=>new Qt({typeName:T.ZodVoid,...C(s)});class re extends I{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return g(t,{code:p.invalid_type,expected:f.array,received:t.parsedType}),E;if(n.exactLength!==null){const a=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(a||o)&&(g(t,{code:a?p.too_big:p.too_small,minimum:o?n.exactLength.value:void 0,maximum:a?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(g(t,{code:p.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(g(t,{code:p.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>n.type._parseAsync(new he(t,a,t.path,o)))).then(a=>q.mergeArray(i,a));const r=[...t.data].map((a,o)=>n.type._parseSync(new he(t,a,t.path,o)));return q.mergeArray(i,r)}get element(){return this._def.type}min(e,t){return new re({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new re({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new re({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}re.create=(s,e)=>new re({type:s,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...C(e)});function ct(s){if(s instanceof U){const e={};for(const t in s.shape){const i=s.shape[t];e[t]=ve.create(ct(i))}return new U({...s._def,shape:()=>e})}else return s instanceof re?new re({...s._def,type:ct(s.element)}):s instanceof ve?ve.create(ct(s.unwrap())):s instanceof Ve?Ve.create(ct(s.unwrap())):s instanceof pe?pe.create(s.items.map(e=>ct(e))):s}class U extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=j.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const c=this._getOrReturnCtx(e);return g(c,{code:p.invalid_type,expected:f.object,received:c.parsedType}),E}const{status:t,ctx:i}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),a=[];if(!(this._def.catchall instanceof ye&&this._def.unknownKeys==="strip"))for(const c in i.data)r.includes(c)||a.push(c);const o=[];for(const c of r){const l=n[c],h=i.data[c];o.push({key:{status:"valid",value:c},value:l._parse(new he(i,h,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof ye){const c=this._def.unknownKeys;if(c==="passthrough")for(const l of a)o.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")a.length>0&&(g(i,{code:p.unrecognized_keys,keys:a}),t.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const l of a){const h=i.data[l];o.push({key:{status:"valid",value:l},value:c._parse(new he(i,h,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const l of o){const h=await l.key;c.push({key:h,value:await l.value,alwaysSet:l.alwaysSet})}return c}).then(c=>q.mergeObjectSync(t,c)):q.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new U({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{var n,r,a,o;const c=(a=(r=(n=this._def).errorMap)===null||r===void 0?void 0:r.call(n,t,i).message)!==null&&a!==void 0?a:i.defaultError;return t.code==="unrecognized_keys"?{message:(o=_.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new U({...this._def,unknownKeys:"strip"})}passthrough(){return new U({...this._def,unknownKeys:"passthrough"})}extend(e){return new U({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new U({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new U({...this._def,catchall:e})}pick(e){const t={};return j.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(t[i]=this.shape[i])}),new U({...this._def,shape:()=>t})}omit(e){const t={};return j.objectKeys(this.shape).forEach(i=>{e[i]||(t[i]=this.shape[i])}),new U({...this._def,shape:()=>t})}deepPartial(){return ct(this)}partial(e){const t={};return j.objectKeys(this.shape).forEach(i=>{const n=this.shape[i];e&&!e[i]?t[i]=n:t[i]=n.optional()}),new U({...this._def,shape:()=>t})}required(e){const t={};return j.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])t[i]=this.shape[i];else{let n=this.shape[i];for(;n instanceof ve;)n=n._def.innerType;t[i]=n}}),new U({...this._def,shape:()=>t})}keyof(){return Ti(j.objectKeys(this.shape))}}U.create=(s,e)=>new U({shape:()=>s,unknownKeys:"strip",catchall:ye.create(),typeName:T.ZodObject,...C(e)}),U.strictCreate=(s,e)=>new U({shape:()=>s,unknownKeys:"strict",catchall:ye.create(),typeName:T.ZodObject,...C(e)}),U.lazycreate=(s,e)=>new U({shape:s,unknownKeys:"strip",catchall:ye.create(),typeName:T.ZodObject,...C(e)});class $t extends I{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;function n(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const a=r.map(o=>new ie(o.ctx.common.issues));return g(t,{code:p.invalid_union,unionErrors:a}),E}if(t.common.async)return Promise.all(i.map(async r=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(n);{let r;const a=[];for(const c of i){const l={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!r&&(r={result:h,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(c=>new ie(c));return g(t,{code:p.invalid_union,unionErrors:o}),E}}get options(){return this._def.options}}$t.create=(s,e)=>new $t({options:s,typeName:T.ZodUnion,...C(e)});const es=s=>s instanceof At?es(s.schema):s instanceof ae?es(s.innerType()):s instanceof Ot?[s.value]:s instanceof Me?s.options:s instanceof It?Object.keys(s.enum):s instanceof Mt?es(s._def.innerType):s instanceof St?[void 0]:s instanceof Tt?[null]:null;class ts extends I{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return g(t,{code:p.invalid_type,expected:f.object,received:t.parsedType}),E;const i=this.discriminator,n=t.data[i],r=this.optionsMap.get(n);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(g(t,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const n=new Map;for(const r of t){const a=es(r.shape[e]);if(!a)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,r)}}return new ts({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...C(i)})}}function Ts(s,e){const t=Ae(s),i=Ae(e);if(s===e)return{valid:!0,data:s};if(t===f.object&&i===f.object){const n=j.objectKeys(e),r=j.objectKeys(s).filter(o=>n.indexOf(o)!==-1),a={...s,...e};for(const o of r){const c=Ts(s[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(t===f.array&&i===f.array){if(s.length!==e.length)return{valid:!1};const n=[];for(let r=0;r<s.length;r++){const a=s[r],o=e[r],c=Ts(a,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===f.date&&i===f.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class Et extends I{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=(r,a)=>{if(xs(r)||xs(a))return E;const o=Ts(r.value,a.value);return o.valid?((ks(r)||ks(a))&&t.dirty(),{status:t.value,value:o.data}):(g(i,{code:p.invalid_intersection_types}),E)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([r,a])=>n(r,a)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Et.create=(s,e,t)=>new Et({left:s,right:e,typeName:T.ZodIntersection,...C(t)});class pe extends I{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==f.array)return g(i,{code:p.invalid_type,expected:f.array,received:i.parsedType}),E;if(i.data.length<this._def.items.length)return g(i,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&i.data.length>this._def.items.length&&(g(i,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...i.data].map((r,a)=>{const o=this._def.items[a]||this._def.rest;return o?o._parse(new he(i,r,i.path,a)):null}).filter(r=>!!r);return i.common.async?Promise.all(n).then(r=>q.mergeArray(t,r)):q.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new pe({...this._def,rest:e})}}pe.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pe({items:s,typeName:T.ZodTuple,rest:null,...C(e)})};class Ct extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==f.object)return g(i,{code:p.invalid_type,expected:f.object,received:i.parsedType}),E;const n=[],r=this._def.keyType,a=this._def.valueType;for(const o in i.data)n.push({key:r._parse(new he(i,o,i.path,o)),value:a._parse(new he(i,i.data[o],i.path,o))});return i.common.async?q.mergeObjectAsync(t,n):q.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof I?new Ct({keyType:e,valueType:t,typeName:T.ZodRecord,...C(i)}):new Ct({keyType:ne.create(),valueType:e,typeName:T.ZodRecord,...C(t)})}}class ss extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==f.map)return g(i,{code:p.invalid_type,expected:f.map,received:i.parsedType}),E;const n=this._def.keyType,r=this._def.valueType,a=[...i.data.entries()].map(([o,c],l)=>({key:n._parse(new he(i,o,i.path,[l,"key"])),value:r._parse(new he(i,c,i.path,[l,"value"]))}));if(i.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of a){const l=await c.key,h=await c.value;if(l.status==="aborted"||h.status==="aborted")return E;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(l.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of a){const l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return E;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(l.value,h.value)}return{status:t.value,value:o}}}}ss.create=(s,e,t)=>new ss({valueType:e,keyType:s,typeName:T.ZodMap,...C(t)});class Fe extends I{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==f.set)return g(i,{code:p.invalid_type,expected:f.set,received:i.parsedType}),E;const n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(g(i,{code:p.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(g(i,{code:p.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function a(c){const l=new Set;for(const h of c){if(h.status==="aborted")return E;h.status==="dirty"&&t.dirty(),l.add(h.value)}return{status:t.value,value:l}}const o=[...i.data.values()].map((c,l)=>r._parse(new he(i,c,i.path,l)));return i.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,t){return new Fe({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new Fe({...this._def,maxSize:{value:e,message:_.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Fe.create=(s,e)=>new Fe({valueType:s,minSize:null,maxSize:null,typeName:T.ZodSet,...C(e)});class dt extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return g(t,{code:p.invalid_type,expected:f.function,received:t.parsedType}),E;function i(o,c){return Yt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qt(),_t].filter(l=>!!l),issueData:{code:p.invalid_arguments,argumentsError:c}})}function n(o,c){return Yt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qt(),_t].filter(l=>!!l),issueData:{code:p.invalid_return_type,returnTypeError:c}})}const r={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof lt){const o=this;return G(async function(...c){const l=new ie([]),h=await o._def.args.parseAsync(c,r).catch(d=>{throw l.addIssue(i(c,d)),l}),m=await Reflect.apply(a,this,h);return await o._def.returns._def.type.parseAsync(m,r).catch(d=>{throw l.addIssue(n(m,d)),l})})}else{const o=this;return G(function(...c){const l=o._def.args.safeParse(c,r);if(!l.success)throw new ie([i(c,l.error)]);const h=Reflect.apply(a,this,l.data),m=o._def.returns.safeParse(h,r);if(!m.success)throw new ie([n(h,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new dt({...this._def,args:pe.create(e).rest(Be.create())})}returns(e){return new dt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new dt({args:e||pe.create([]).rest(Be.create()),returns:t||Be.create(),typeName:T.ZodFunction,...C(i)})}}class At extends I{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})}}At.create=(s,e)=>new At({getter:s,typeName:T.ZodLazy,...C(e)});class Ot extends I{_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}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ot.create=(s,e)=>new Ot({value:s,typeName:T.ZodLiteral,...C(e)});function Ti(s,e){return new Me({values:s,typeName:T.ZodEnum,...C(e)})}class Me extends I{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),i=this._def.values;return g(t,{expected:j.joinValues(i),received:t.parsedType,code:p.invalid_type}),E}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),i=this._def.values;return g(t,{received:t.data,code:p.invalid_enum_value,options:i}),E}return G(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Me.create(e)}exclude(e){return Me.create(this.options.filter(t=>!e.includes(t)))}}Me.create=Ti;class It extends I{_parse(e){const t=j.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==f.string&&i.parsedType!==f.number){const n=j.objectValues(t);return g(i,{expected:j.joinValues(n),received:i.parsedType,code:p.invalid_type}),E}if(t.indexOf(e.data)===-1){const n=j.objectValues(t);return g(i,{received:i.data,code:p.invalid_enum_value,options:n}),E}return G(e.data)}get enum(){return this._def.values}}It.create=(s,e)=>new It({values:s,typeName:T.ZodNativeEnum,...C(e)});class lt extends I{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return g(t,{code:p.invalid_type,expected:f.promise,received:t.parsedType}),E;const i=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return G(i.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}lt.create=(s,e)=>new lt({type:s,typeName:T.ZodPromise,...C(e)});class ae extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:a=>{g(i,a),a.fatal?t.abort():t.dirty()},get path(){return i.path}};if(r.addIssue=r.addIssue.bind(r),n.type==="preprocess"){const a=n.transform(i.data,r);return i.common.issues.length?{status:"dirty",value:i.data}:i.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:i.path,parent:i})):this._def.schema._parseSync({data:a,path:i.path,parent:i})}if(n.type==="refinement"){const a=o=>{const c=n.refinement(o,r);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?E:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>o.status==="aborted"?E:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!xt(a))return a;const o=n.transform(a.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>xt(a)?Promise.resolve(n.transform(a.value,r)).then(o=>({status:t.value,value:o})):a);j.assertNever(n)}}ae.create=(s,e,t)=>new ae({schema:s,typeName:T.ZodEffects,effect:e,...C(t)}),ae.createWithPreprocess=(s,e,t)=>new ae({schema:e,effect:{type:"preprocess",transform:s},typeName:T.ZodEffects,...C(t)});class ve extends I{_parse(e){return this._getType(e)===f.undefined?G(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ve.create=(s,e)=>new ve({innerType:s,typeName:T.ZodOptional,...C(e)});class Ve extends I{_parse(e){return this._getType(e)===f.null?G(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ve.create=(s,e)=>new Ve({innerType:s,typeName:T.ZodNullable,...C(e)});class Mt extends I{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===f.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Mt.create=(s,e)=>new Mt({innerType:s,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...C(e)});class is extends I{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Gt(n)?n.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ie(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ie(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}is.create=(s,e)=>new is({innerType:s,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...C(e)});class ns extends I{_parse(e){if(this._getType(e)!==f.nan){const t=this._getOrReturnCtx(e);return g(t,{code:p.invalid_type,expected:f.nan,received:t.parsedType}),E}return{status:"valid",value:e.data}}}ns.create=s=>new ns({typeName:T.ZodNaN,...C(s)});const Un=Symbol("zod_brand");class $i extends I{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}}class Nt extends I{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?E:n.status==="dirty"?(t.dirty(),ki(n.value)):this._def.out._parseAsync({data:n.value,path:i.path,parent:i})})();{const n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?E:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,t){return new Nt({in:e,out:t,typeName:T.ZodPipeline})}}class rs extends I{_parse(e){const t=this._def.innerType._parse(e);return xt(t)&&(t.value=Object.freeze(t.value)),t}}rs.create=(s,e)=>new rs({innerType:s,typeName:T.ZodReadonly,...C(e)});const Ei=(s,e={},t)=>s?ot.create().superRefine((i,n)=>{var r,a;if(!s(i)){const o=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,c=(a=(r=o.fatal)!==null&&r!==void 0?r:t)!==null&&a!==void 0?a:!0,l=typeof o=="string"?{message:o}:o;n.addIssue({code:"custom",...l,fatal:c})}}):ot.create(),Hn={object:U.lazycreate};var T;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(T||(T={}));const Bn=(s,e={message:`Input not instance of ${s.name}`})=>Ei(t=>t instanceof s,e),Ci=ne.create,Ai=Oe.create,Fn=ns.create,Vn=Ie.create,Oi=kt.create,Wn=He.create,Kn=Xt.create,Jn=St.create,qn=Tt.create,Yn=ot.create,Gn=Be.create,Xn=ye.create,Qn=Qt.create,er=re.create,tr=U.create,sr=U.strictCreate,ir=$t.create,nr=ts.create,rr=Et.create,ar=pe.create,or=Ct.create,cr=ss.create,dr=Fe.create,lr=dt.create,ur=At.create,hr=Ot.create,pr=Me.create,mr=It.create,fr=lt.create,Ii=ae.create,gr=ve.create,yr=Ve.create,vr=ae.createWithPreprocess,br=Nt.create;var w=Object.freeze({__proto__:null,defaultErrorMap:_t,setErrorMap:Cn,getErrorMap:qt,makeIssue:Yt,EMPTY_PATH:An,addIssueToContext:g,ParseStatus:q,INVALID:E,DIRTY:ki,OK:G,isAborted:xs,isDirty:ks,isValid:xt,isAsync:Gt,get util(){return j},get objectUtil(){return _s},ZodParsedType:f,getParsedType:Ae,ZodType:I,ZodString:ne,ZodNumber:Oe,ZodBigInt:Ie,ZodBoolean:kt,ZodDate:He,ZodSymbol:Xt,ZodUndefined:St,ZodNull:Tt,ZodAny:ot,ZodUnknown:Be,ZodNever:ye,ZodVoid:Qt,ZodArray:re,ZodObject:U,ZodUnion:$t,ZodDiscriminatedUnion:ts,ZodIntersection:Et,ZodTuple:pe,ZodRecord:Ct,ZodMap:ss,ZodSet:Fe,ZodFunction:dt,ZodLazy:At,ZodLiteral:Ot,ZodEnum:Me,ZodNativeEnum:It,ZodPromise:lt,ZodEffects:ae,ZodTransformer:ae,ZodOptional:ve,ZodNullable:Ve,ZodDefault:Mt,ZodCatch:is,ZodNaN:ns,BRAND:Un,ZodBranded:$i,ZodPipeline:Nt,ZodReadonly:rs,custom:Ei,Schema:I,ZodSchema:I,late:Hn,get ZodFirstPartyTypeKind(){return T},coerce:{string:s=>ne.create({...s,coerce:!0}),number:s=>Oe.create({...s,coerce:!0}),boolean:s=>kt.create({...s,coerce:!0}),bigint:s=>Ie.create({...s,coerce:!0}),date:s=>He.create({...s,coerce:!0})},any:Yn,array:er,bigint:Vn,boolean:Oi,date:Wn,discriminatedUnion:nr,effect:Ii,enum:pr,function:lr,instanceof:Bn,intersection:rr,lazy:ur,literal:hr,map:cr,nan:Fn,nativeEnum:mr,never:Xn,null:qn,nullable:yr,number:Ai,object:tr,oboolean:()=>Oi().optional(),onumber:()=>Ai().optional(),optional:gr,ostring:()=>Ci().optional(),pipeline:br,preprocess:vr,promise:fr,record:or,set:dr,strictObject:sr,string:Ci,symbol:Kn,transformer:Ii,tuple:ar,undefined:Jn,union:ir,unknown:Gn,void:Qn,NEVER:E,ZodIssueCode:p,quotelessJson:En,ZodError:ie});const as=w.object({assistantId:w.string(),params:w.record(w.any()).default({}),config:w.object({historyKey:w.string().refine(s=>s.replace(/-/g,"_")).nullable().default("main"),welcomeMessage:w.string().default("Hello! How can I help you today?"),initialReplyMessage:w.string().nullable().default(null),placement:w.enum(["left","right"]).default("right"),openChatButton:w.object({imageSrc:w.string().optional(),width:w.union([w.string(),w.number()]).default("48px"),height:w.union([w.string(),w.number()]).default("48px"),cta:w.string().optional()}).default({}),chatWindow:w.object({header:w.object({text:w.string().nullable().default("AI Chat"),imageSrc:w.string().optional()}).default({}),showCloseButton:w.boolean().default(!0)}).default({}),styles:w.object({primaryColor:w.string().optional(),textColor:w.string().optional(),openChatButton:w.object({backgroundColor:w.string().optional(),iconColor:w.string().optional()}).optional(),header:w.object({backgroundColor:w.string().optional(),textColor:w.string().optional()}).optional(),button:w.object({backgroundColor:w.string().optional(),textColor:w.string().optional()}).optional(),messages:w.object({user:w.object({backgroundColor:w.string().optional(),textColor:w.string().optional()}).optional(),assistant:w.object({backgroundColor:w.string().optional(),textColor:w.string().optional()}).optional()}).optional()}).default({})}).default({}),handlers:w.object({functionCalls:w.record(w.function().returns(w.union([w.any(),w.promise(w.any())]))).default({}),enhancedContent:w.record(w.function().returns(w.union([w.any(),w.promise(w.any())]))).default({})}).default({})});function wr(s){if(Array.isArray(s)){for(var e=0,t=Array(s.length);e<s.length;e++)t[e]=s[e];return t}else return Array.from(s)}var $s=!1;if(typeof window<"u"){var Mi={get passive(){$s=!0}};window.addEventListener("testPassive",null,Mi),window.removeEventListener("testPassive",null,Mi)}var os=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),We=[],cs=!1,Ni=-1,Pt=void 0,Ke=void 0,jt=void 0,Pi=function(s){return We.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(s))})},Es=function(s){var e=s||window.event;return Pi(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},_r=function(s){if(jt===void 0){var e=!!s&&s.reserveScrollBarGap===!0,t=window.innerWidth-document.documentElement.clientWidth;if(e&&t>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);jt=document.body.style.paddingRight,document.body.style.paddingRight=i+t+"px"}}Pt===void 0&&(Pt=document.body.style.overflow,document.body.style.overflow="hidden")},xr=function(){jt!==void 0&&(document.body.style.paddingRight=jt,jt=void 0),Pt!==void 0&&(document.body.style.overflow=Pt,Pt=void 0)},kr=function(){return window.requestAnimationFrame(function(){if(Ke===void 0){Ke={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var s=window,e=s.scrollY,t=s.scrollX,i=s.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-t,setTimeout(function(){return window.requestAnimationFrame(function(){var n=i-window.innerHeight;n&&e>=i&&(document.body.style.top=-(e+n))})},300)}})},Sr=function(){if(Ke!==void 0){var s=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=Ke.position,document.body.style.top=Ke.top,document.body.style.left=Ke.left,window.scrollTo(e,s),Ke=void 0}},Tr=function(s){return s?s.scrollHeight-s.scrollTop<=s.clientHeight:!1},$r=function(s,e){var t=s.targetTouches[0].clientY-Ni;return Pi(s.target)?!1:e&&e.scrollTop===0&&t>0||Tr(e)&&t<0?Es(s):(s.stopPropagation(),!0)},Er=function(s,e){if(!s){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!We.some(function(i){return i.targetElement===s})){var t={targetElement:s,options:e||{}};We=[].concat(wr(We),[t]),os?kr():_r(e),os&&(s.ontouchstart=function(i){i.targetTouches.length===1&&(Ni=i.targetTouches[0].clientY)},s.ontouchmove=function(i){i.targetTouches.length===1&&$r(i,s)},cs||(document.addEventListener("touchmove",Es,$s?{passive:!1}:void 0),cs=!0))}},ji=function(s){if(!s){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}We=We.filter(function(e){return e.targetElement!==s}),os&&(s.ontouchstart=null,s.ontouchmove=null,cs&&We.length===0&&(document.removeEventListener("touchmove",Es,$s?{passive:!1}:void 0),cs=!1)),os?Sr():xr()},Cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ri(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Cs={};(function(s){function e(o){o&&o.options&&clearTimeout(o.options.timer)}function t(o,c,l,h){var m={timer:void 0,lastArgs:[]},d=function(){for(var b=this,N=[],H=0;H<arguments.length;H++)N[H]=arguments[H];m.lastArgs=N,m.timer?clearTimeout(m.timer):c&&l.apply(this,m.lastArgs),m.timer=setTimeout(function(){c||l.apply(b,m.lastArgs),m.timer=void 0},o)};return h&&(d=d.bind(h)),d.options=m,d}function i(o,c,l,h){var m;Object.defineProperty(l,h,{configurable:!0,enumerable:!1,get:function(){return m},set:function(d){m=t(o,c,d,this)}})}function n(o,c,l){var h=l.value;return l.value=t(o,c,h),l}function r(o,c){for(var l=[],h=2;h<arguments.length;h++)l[h-2]=arguments[h];if(l.length===0)throw new Error("function applied debounce decorator should be a method");if(l.length===1)throw new Error("method applied debounce decorator should have valid name");var m=l[0],d=l[1],b=l.length===3&&l[2]?l[2]:Object.getOwnPropertyDescriptor(m,d);if(b)return n(o,c,b);i(o,c,m,d)}function a(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];var l=500,h=!1;if(o.length&&(typeof o[0]=="number"||typeof o[0]=="object"&&o[0].leading!==void 0)){typeof o[0]=="number"&&(l=o[0]);var m=void 0;return typeof o[0]=="object"&&o[0].leading!==void 0&&(m=o[0]),1<o.length&&typeof o[1]=="object"&&o[1].leading!==void 0&&(m=o[1]),m&&(h=m.leading),function(){for(var d=[],b=0;b<arguments.length;b++)d[b]=arguments[b];return r.apply(void 0,[l,h].concat(d))}}return r.apply(void 0,[l,h].concat(o))}Object.defineProperty(s,"__esModule",{value:!0}),s.cancel=e,s.debounce=a})(Cs);var Ar=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,Rt=(s,e,t,i)=>{for(var n=i>1?void 0:i?Or(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Ar(e,t,n),n};let Je=class extends se{constructor(){super(...arguments),this.isOpen=!0,this.onResizeHandler=()=>{this.isOpen&&window.innerWidth<768?Er(this):ji(this)}}connectedCallback(){super.connectedCallback(),this.cleanOptions=as.parse(this.options),this.onResizeHandler(),window.addEventListener("resize",this.onResizeHandler,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),ji(this),window.removeEventListener("resize",this.onResizeHandler)}render(){const s=this.cleanOptions.config.placement!=="left",e=wi({fixed:!0,"bottom-0":!0,"w-full":this.isOpen,"h-full":this.isOpen,...s&&{"right-0":!0,"md:right-8":!0},...!s&&{"left-0":!0,"md:left-8":!0},"md:bottom-8":!0,"md:w-fit":!0,"md:h-fit":!0}),t=wi({"mt-4":!0,"px-8":!0,"pb-8":!0,"w-full":!0,hidden:this.isOpen,flex:!this.isOpen,"md:px-0":!0,"md:pb-0":!0,"md:w-[350px]":!0,"md:flex":!0});return L`
52
52
  <div
53
53
  class=${e}
54
54
  >
55
55
  <div
56
56
  class="w-full h-full p-2 md:w-[350px] md:h-[500px] md:p-0"
57
- style=${vt({display:this.isOpen?"block":"none"})}
57
+ style=${at({display:this.isOpen?"block":"none"})}
58
58
  >
59
59
  <iai-chat
60
60
  .options=${this.options}
@@ -64,7 +64,7 @@
64
64
 
65
65
  <div
66
66
  class=${t}
67
- style=${vt({justifyContent:s?"flex-end":"flex-start"})}
67
+ style=${at({justifyContent:s?"flex-end":"flex-start"})}
68
68
  >
69
69
  <iai-chat-open-chat-button
70
70
  .options=${this.cleanOptions}
@@ -73,19 +73,19 @@
73
73
  />
74
74
  </div>
75
75
  </div>
76
- `}toggleChat(){this.isOpen=!this.isOpen,this.onResizeHandler()}};We.styles=[Ee],Pt([J({type:Object})],We.prototype,"options",2),Pt([it()],We.prototype,"isOpen",2),Pt([Sn("iai-chat")],We.prototype,"chatWindow",2),Pt([$s.debounce(250)],We.prototype,"onResizeHandler",2),We=Pt([Ce("iai-chat-popup")],We);const Es="https://ai-dev.anyonehome.xyz";async function Ir(s,e={}){return await(await fetch(`${Es}/threads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assistantId:s,params:e})})).json()}async function Mr(s,e){return await(await fetch(`${Es}/threads/${s}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})})).json()}async function Nr(s,e,t,i=!1){return await(await fetch(`${Es}/threads/${s}/functions/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({params:t,rerunLLM:i})})).json()}function Pr(s){return{all:s=s||new Map,on:function(e,t){var i=s.get(e);i?i.push(t):s.set(e,[t])},off:function(e,t){var i=s.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var i=s.get(e);i&&i.slice().map(function(n){n(t)}),(i=s.get("*"))&&i.slice().map(function(n){n(e,t)})}}}let jr=class{constructor(s,e={}){if(this._assistantId="",this._threadId="",this._messages=[],this.isTyping=!1,this.inputDisabled=!1,this.onStorageEvent=t=>{var i;const[n,r,a]=((i=t.key)==null?void 0:i.split("-"))||[];if(!(n!=="iaiChat"||r!==this.options.historyKey))switch(a){case"messageHistory":this.onMessageHistoryStorageEvent(t);break;case"threadId":this.setThreadId(JSON.parse(t.newValue||""),!0);break;case"typing":this.setTyping(JSON.parse(t.newValue||"false"),!0);break;case"inputDisabled":this.setInputDisabled(JSON.parse(t.newValue||"false"),!0);break}},this._assistantId=s,this.options={params:{},simulateDelays:!0,historyKey:null,initialReplyMessage:null,...e},this._emitter=Pr(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),e.historyKey){const t=this.storageGet("messageHistory");t&&(this._messages=t);const i=this.storageGet("threadId");i&&this.setThreadId(i,!0);const n=this.storageGet("typing");n&&this.setTyping(n,!0);const r=this.storageGet("inputDisabled");r&&this.setInputDisabled(r,!0),window.addEventListener("storage",this.onStorageEvent)}e.events&&Object.entries(e.events).forEach(([t,i])=>{this._emitter.on(t,i)})}onMessageHistoryStorageEvent(s){if(!s.newValue){this.reset();return}const e=JSON.parse(s.newValue),t=this._messages.map(n=>n.id),i=e.map(n=>n.id);this._messages.forEach(n=>{i.includes(n.id)||this._emitter.emit("messageRemoved",n.id)}),e.forEach(n=>{t.includes(n.id)||this._emitter.emit("message",n)}),this._messages=e}reset(){this._threadId="",this._messages=[],this.setTyping(!1),this.setInputDisabled(!1),this.storageRemoveAll(),this._emitter.emit("reset")}destroy(){this._emitter.all.clear(),window.removeEventListener("storage",this.onStorageEvent),this._emitter.emit("destroy")}async startChat(){if(this.chatStarted)return;const{id:s}=await Ir(this.assistantId,this.params);if(!s)throw new Error("Could not start chat");this.setThreadId(s)}addMessage(s){const e={...s,id:s.id||Math.random().toString(36).substring(7)};return this._messages.push(e),this.storageSet("messageHistory",this._messages),this._emitter.emit("message",e),e}removeMessage(s){this._messages=this._messages.filter(e=>e.id!==s),this.storageSet("messageHistory",this._messages),this._emitter.emit("messageRemoved",s)}async respondToFunctionCall(s,e,t){this.simulateDelay(1800).then(()=>this.setTyping(!0));const i=this.simulateDelay(2e3);await this.insertMessagesWithSimulatedDelays(Promise.all([Nr(this.threadId,s,e,t),i]).then(([n])=>n))}async sendUserMessage(s){try{this.addMessage({role:"user",content:s}),this.simulateDelay(1800).then(()=>this.setTyping(!0));let e=this.simulateDelay(4800);if(!this.chatStarted){const{initialReplyMessage:n}=this.options;n&&(this.simulateDelay(3800).then(()=>{this.addMessage({role:"assistant",content:n}),this.setTyping(!1)}),this.simulateDelay(6200).then(()=>this.setTyping(!0)),e=this.simulateDelay(8200)),await this.startChat()}const{messages:t,functions:i}=await this.insertMessagesWithSimulatedDelays(Promise.all([Mr(this.threadId,s),e]).then(([n])=>n));return{messages:t,functions:i}}catch(e){throw console.error(e),new Error("There was an error sending the message")}}setThreadId(s,e=!1){this._threadId=s,e||this.storageSet("threadId",s)}setTyping(s,e=!1){this.isTyping=s,this._emitter.emit("typing",s),e||this.storageSet("typing",s)}setInputDisabled(s,e=!1){this.inputDisabled=s,this._emitter.emit("inputDisabled",s),e||this.storageSet("inputDisabled",s)}async insertMessagesWithSimulatedDelays(s){const e=await s;if(e.error)throw new Error(e.message);const{messages:t,functions:i}=e;return await Promise.all(t.map(async(n,r)=>(await this.simulateDelay(1e3*r),this.addMessage(n)))),this.setTyping(!1),i.forEach(n=>this._emitter.emit("functionCall",n)),{messages:t,functions:i}}simulateDelay(s){return this.options.simulateDelays?new Promise(e=>setTimeout(e,s)):Promise.resolve()}get assistantId(){return this._assistantId}get params(){return this.options.params}get threadId(){return this._threadId}get messages(){return this._messages}get chatStarted(){return!!this._threadId}storageSet(s,e){this.options.historyKey&&localStorage.setItem(`iaiChat-${this.options.historyKey}-${s}`,JSON.stringify(e))}storageGet(s){if(!this.options.historyKey)return null;const e=localStorage.getItem(`iaiChat-${this.options.historyKey}-${s}`);return e?JSON.parse(e):null}storageRemove(s){localStorage.removeItem(`iaiChat-${this.options.historyKey}-${s}`)}storageRemoveAll(){this.options.historyKey&&Object.keys(localStorage).forEach(s=>{s.startsWith(`iaiChat-${this.options.historyKey}-`)&&localStorage.removeItem(s)})}};function Rr(s){return{all:s=s||new Map,on:function(e,t){var i=s.get(e);i?i.push(t):s.set(e,[t])},off:function(e,t){var i=s.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var i=s.get(e);i&&i.slice().map(function(n){n(t)}),(i=s.get("*"))&&i.slice().map(function(n){n(e,t)})}}}/**
76
+ `}toggleChat(){this.isOpen=!this.isOpen,this.onResizeHandler()}};Je.styles=[Ee],Rt([W({type:Object})],Je.prototype,"options",2),Rt([rt()],Je.prototype,"isOpen",2),Rt([Tn("iai-chat")],Je.prototype,"chatWindow",2),Rt([Cs.debounce(250)],Je.prototype,"onResizeHandler",2),Je=Rt([Ce("iai-chat-popup")],Je);const As="https://ai-dev.anyonehome.xyz";async function Ir(s,e={}){return await(await fetch(`${As}/threads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assistantId:s,params:e})})).json()}async function Mr(s,e){return await(await fetch(`${As}/threads/${s}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})})).json()}async function Nr(s,e,t,i=!1){return await(await fetch(`${As}/threads/${s}/functions/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({params:t,rerunLLM:i})})).json()}function Pr(s){return{all:s=s||new Map,on:function(e,t){var i=s.get(e);i?i.push(t):s.set(e,[t])},off:function(e,t){var i=s.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var i=s.get(e);i&&i.slice().map(function(n){n(t)}),(i=s.get("*"))&&i.slice().map(function(n){n(e,t)})}}}let jr=class{constructor(s,e={}){if(this._assistantId="",this._threadId="",this._messages=[],this.isTyping=!1,this.inputDisabled=!1,this.onStorageEvent=t=>{var i;const[n,r,a]=((i=t.key)==null?void 0:i.split("-"))||[];if(!(n!=="iaiChat"||r!==this.options.historyKey))switch(a){case"messageHistory":this.onMessageHistoryStorageEvent(t);break;case"threadId":this.setThreadId(JSON.parse(t.newValue||""),!0);break;case"typing":this.setTyping(JSON.parse(t.newValue||"false"),!0);break;case"inputDisabled":this.setInputDisabled(JSON.parse(t.newValue||"false"),!0);break}},this._assistantId=s,this.options={params:{},simulateDelays:!0,historyKey:null,initialReplyMessage:null,...e},this._emitter=Pr(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),e.historyKey){const t=this.storageGet("messageHistory");t&&(this._messages=t);const i=this.storageGet("threadId");i&&this.setThreadId(i,!0);const n=this.storageGet("typing");n&&this.setTyping(n,!0);const r=this.storageGet("inputDisabled");r&&this.setInputDisabled(r,!0),window.addEventListener("storage",this.onStorageEvent)}e.events&&Object.entries(e.events).forEach(([t,i])=>{this._emitter.on(t,i)})}onMessageHistoryStorageEvent(s){if(!s.newValue){this.reset();return}const e=JSON.parse(s.newValue),t=this._messages.map(n=>n.id),i=e.map(n=>n.id);this._messages.forEach(n=>{i.includes(n.id)||this._emitter.emit("messageRemoved",n.id)}),e.forEach(n=>{t.includes(n.id)||this._emitter.emit("message",n)}),this._messages=e}reset(){this._threadId="",this._messages=[],this.setTyping(!1),this.setInputDisabled(!1),this.storageRemoveAll(),this._emitter.emit("reset")}destroy(){this._emitter.all.clear(),window.removeEventListener("storage",this.onStorageEvent),this._emitter.emit("destroy")}async startChat(){if(this.chatStarted)return;const{id:s}=await Ir(this.assistantId,this.params);if(!s)throw new Error("Could not start chat");this.setThreadId(s)}addMessage(s){const e={...s,id:s.id||Math.random().toString(36).substring(7)};return this._messages.push(e),this.storageSet("messageHistory",this._messages),this._emitter.emit("message",e),e}removeMessage(s){this._messages=this._messages.filter(e=>e.id!==s),this.storageSet("messageHistory",this._messages),this._emitter.emit("messageRemoved",s)}async respondToFunctionCall(s,e,t){this.simulateDelay(1800).then(()=>this.setTyping(!0));const i=this.simulateDelay(2e3);await this.insertMessagesWithSimulatedDelays(Promise.all([Nr(this.threadId,s,e,t),i]).then(([n])=>n))}async sendUserMessage(s){try{this.addMessage({role:"user",content:s}),this.simulateDelay(1800).then(()=>this.setTyping(!0));let e=this.simulateDelay(4800);if(!this.chatStarted){const{initialReplyMessage:n}=this.options;n&&(this.simulateDelay(3800).then(()=>{this.addMessage({role:"assistant",content:n}),this.setTyping(!1)}),this.simulateDelay(6200).then(()=>this.setTyping(!0)),e=this.simulateDelay(8200)),await this.startChat()}const{messages:t,functions:i}=await this.insertMessagesWithSimulatedDelays(Promise.all([Mr(this.threadId,s),e]).then(([n])=>n));return{messages:t,functions:i}}catch(e){throw console.error(e),new Error("There was an error sending the message")}}setThreadId(s,e=!1){this._threadId=s,e||this.storageSet("threadId",s)}setTyping(s,e=!1){this.isTyping=s,this._emitter.emit("typing",s),e||this.storageSet("typing",s)}setInputDisabled(s,e=!1){this.inputDisabled=s,this._emitter.emit("inputDisabled",s),e||this.storageSet("inputDisabled",s)}async insertMessagesWithSimulatedDelays(s){const e=await s;if(e.error)throw new Error(e.message);const{messages:t,functions:i}=e;return await Promise.all(t.map(async(n,r)=>(await this.simulateDelay(1e3*r),this.addMessage(n)))),this.setTyping(!1),i.forEach(n=>this._emitter.emit("functionCall",n)),{messages:t,functions:i}}simulateDelay(s){return this.options.simulateDelays?new Promise(e=>setTimeout(e,s)):Promise.resolve()}get assistantId(){return this._assistantId}get params(){return this.options.params}get threadId(){return this._threadId}get messages(){return this._messages}get chatStarted(){return!!this._threadId}storageSet(s,e){this.options.historyKey&&localStorage.setItem(`iaiChat-${this.options.historyKey}-${s}`,JSON.stringify(e))}storageGet(s){if(!this.options.historyKey)return null;const e=localStorage.getItem(`iaiChat-${this.options.historyKey}-${s}`);return e?JSON.parse(e):null}storageRemove(s){localStorage.removeItem(`iaiChat-${this.options.historyKey}-${s}`)}storageRemoveAll(){this.options.historyKey&&Object.keys(localStorage).forEach(s=>{s.startsWith(`iaiChat-${this.options.historyKey}-`)&&localStorage.removeItem(s)})}};function Rr(s){return{all:s=s||new Map,on:function(e,t){var i=s.get(e);i?i.push(t):s.set(e,[t])},off:function(e,t){var i=s.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var i=s.get(e);i&&i.slice().map(function(n){n(t)}),(i=s.get("*"))&&i.slice().map(function(n){n(e,t)})}}}/**
77
77
  * @license
78
78
  * Copyright 2021 Google LLC
79
79
  * SPDX-License-Identifier: BSD-3-Clause
80
- */function ct(s,e,t){return s?e(s):t==null?void 0:t(s)}/**
80
+ */function Ne(s,e,t){return s?e(s):t==null?void 0:t(s)}/**
81
81
  * @license
82
82
  * Copyright 2020 Google LLC
83
83
  * SPDX-License-Identifier: BSD-3-Clause
84
- */const{I:Zr}=_n,Ri=()=>document.createComment(""),jt=(s,e,t)=>{var i;const n=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const a=n.insertBefore(Ri(),r),o=n.insertBefore(Ri(),r);t=new Zr(a,o,s,s.options)}else{const a=t._$AB.nextSibling,o=t._$AM,c=o!==s;if(c){let l;(i=t._$AQ)==null||i.call(t,s),t._$AM=s,t._$AP!==void 0&&(l=s._$AU)!==o._$AU&&t._$AP(l)}if(a!==r||c){let l=t._$AA;for(;l!==a;){const h=l.nextSibling;n.insertBefore(l,r),l=h}}}return t},Ke=(s,e,t=s)=>(s._$AI(e,t),s),Lr={},zr=(s,e=Lr)=>s._$AH=e,Dr=s=>s._$AH,Cs=s=>{var e;(e=s._$AP)==null||e.call(s,!1,!0);let t=s._$AA;const i=s._$AB.nextSibling;for(;t!==i;){const n=t.nextSibling;t.remove(),t=n}};/**
84
+ */const{I:Zr}=_n,Zi=()=>document.createComment(""),Zt=(s,e,t)=>{var i;const n=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const a=n.insertBefore(Zi(),r),o=n.insertBefore(Zi(),r);t=new Zr(a,o,s,s.options)}else{const a=t._$AB.nextSibling,o=t._$AM,c=o!==s;if(c){let l;(i=t._$AQ)==null||i.call(t,s),t._$AM=s,t._$AP!==void 0&&(l=s._$AU)!==o._$AU&&t._$AP(l)}if(a!==r||c){let l=t._$AA;for(;l!==a;){const h=l.nextSibling;n.insertBefore(l,r),l=h}}}return t},qe=(s,e,t=s)=>(s._$AI(e,t),s),Lr={},Dr=(s,e=Lr)=>s._$AH=e,zr=s=>s._$AH,Os=s=>{var e;(e=s._$AP)==null||e.call(s,!1,!0);let t=s._$AA;const i=s._$AB.nextSibling;for(;t!==i;){const n=t.nextSibling;t.remove(),t=n}};/**
85
85
  * @license
86
86
  * Copyright 2017 Google LLC
87
87
  * SPDX-License-Identifier: BSD-3-Clause
88
- */const Zi=(s,e,t)=>{const i=new Map;for(let n=e;n<=t;n++)i.set(s[n],n);return i},Ur=Ft(class extends Vt{constructor(s){if(super(s),s.type!==Bt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const n=[],r=[];let a=0;for(const o of s)n[a]=i?i(o,a):a,r[a]=t(o,a),a++;return{values:r,keys:n}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const n=Dr(s),{values:r,keys:a}=this.dt(e,t,i);if(!Array.isArray(n))return this.ut=a,r;const o=this.ut??(this.ut=[]),c=[];let l,h,m=0,d=n.length-1,b=0,N=r.length-1;for(;m<=d&&b<=N;)if(n[m]===null)m++;else if(n[d]===null)d--;else if(o[m]===a[b])c[b]=Ke(n[m],r[b]),m++,b++;else if(o[d]===a[N])c[N]=Ke(n[d],r[N]),d--,N--;else if(o[m]===a[N])c[N]=Ke(n[m],r[N]),jt(s,c[N+1],n[m]),m++,N--;else if(o[d]===a[b])c[b]=Ke(n[d],r[b]),jt(s,n[m],n[d]),d--,b++;else if(l===void 0&&(l=Zi(a,b,N),h=Zi(o,m,d)),l.has(o[m]))if(l.has(o[d])){const H=h.get(a[b]),ee=H!==void 0?n[H]:null;if(ee===null){const _e=jt(s,n[m]);Ke(_e,r[b]),c[b]=_e}else c[b]=Ke(ee,r[b]),jt(s,n[m],ee),n[H]=null;b++}else Cs(n[d]),d--;else Cs(n[m]),m++;for(;b<=N;){const H=jt(s,c[N+1]);Ke(H,r[b]),c[b++]=H}for(;m<=d;){const H=n[m++];H!==null&&Cs(H)}return this.ut=a,zr(s,c),ue}}),As=z`
88
+ */const Li=(s,e,t)=>{const i=new Map;for(let n=e;n<=t;n++)i.set(s[n],n);return i},Ur=Kt(class extends Jt{constructor(s){if(super(s),s.type!==Wt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const n=[],r=[];let a=0;for(const o of s)n[a]=i?i(o,a):a,r[a]=t(o,a),a++;return{values:r,keys:n}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const n=zr(s),{values:r,keys:a}=this.dt(e,t,i);if(!Array.isArray(n))return this.ut=a,r;const o=this.ut??(this.ut=[]),c=[];let l,h,m=0,d=n.length-1,b=0,N=r.length-1;for(;m<=d&&b<=N;)if(n[m]===null)m++;else if(n[d]===null)d--;else if(o[m]===a[b])c[b]=qe(n[m],r[b]),m++,b++;else if(o[d]===a[N])c[N]=qe(n[d],r[N]),d--,N--;else if(o[m]===a[N])c[N]=qe(n[m],r[N]),Zt(s,c[N+1],n[m]),m++,N--;else if(o[d]===a[b])c[b]=qe(n[d],r[b]),Zt(s,n[m],n[d]),d--,b++;else if(l===void 0&&(l=Li(a,b,N),h=Li(o,m,d)),l.has(o[m]))if(l.has(o[d])){const H=h.get(a[b]),ee=H!==void 0?n[H]:null;if(ee===null){const _e=Zt(s,n[m]);qe(_e,r[b]),c[b]=_e}else c[b]=qe(ee,r[b]),Zt(s,n[m],ee),n[H]=null;b++}else Os(n[d]),d--;else Os(n[m]),m++;for(;b<=N;){const H=Zt(s,c[N+1]);qe(H,r[b]),c[b++]=H}for(;m<=d;){const H=n[m++];H!==null&&Os(H)}return this.ut=a,Dr(s,c),ue}}),Lt=L`
89
89
  <svg
90
90
  xmlns="http://www.w3.org/2000/svg"
91
91
  viewBox="0 0 24 24"
@@ -97,7 +97,7 @@
97
97
  <path
98
98
  d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"/>
99
99
  </svg>
100
- `,Hr=z`
100
+ `,Hr=L`
101
101
  <svg
102
102
  xmlns="http://www.w3.org/2000/svg"
103
103
  viewBox="0 0 24 24"
@@ -109,7 +109,7 @@
109
109
  <path
110
110
  d="M12,3C17.5,3 22,6.58 22,11C22,15.42 17.5,19 12,19C10.76,19 9.57,18.82 8.47,18.5C5.55,21 2,21 2,21C4.33,18.67 4.7,17.1 4.75,16.5C3.05,15.07 2,13.13 2,11C2,6.58 6.5,3 12,3Z"/>
111
111
  </svg>
112
- `,Br=z`
112
+ `,Br=L`
113
113
  <svg
114
114
  xmlns="http://www.w3.org/2000/svg"
115
115
  viewBox="0 0 24 24"
@@ -120,7 +120,7 @@
120
120
  <title>send</title>
121
121
  <path d="M2,21L23,12L2,3V10L17,12L2,14V21Z"/>
122
122
  </svg>
123
- `,Fr=z`
123
+ `,Fr=L`
124
124
  <svg
125
125
  xmlns="http://www.w3.org/2000/svg"
126
126
  viewBox="0 0 24 24"
@@ -131,14 +131,14 @@
131
131
  <title>refresh</title>
132
132
  <path d="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z" />
133
133
  </svg>
134
- `;var Vr=Object.defineProperty,Wr=Object.getOwnPropertyDescriptor,be=(s,e,t,i)=>{for(var n=i>1?void 0:i?Wr(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Vr(e,t,n),n},Li=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},dt=(s,e,t)=>(Li(s,e,"read from private field"),t?t.call(s):e.get(s)),zi=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Di=(s,e,t,i)=>(Li(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Ne,as;let oe=class extends se{constructor(){super(),zi(this,Ne,void 0),zi(this,as,Promise.resolve()),this.disableInput=!1,this.showTyping=!1,this.messages=[],this.inputValue="",this.internalDisableInput=!1,this.internalShowTyping=!1,this._emitter=Rr(),this._emitter.on("*",(s,e)=>this.dispatchEvent(new CustomEvent(`iai-chat-${s.toString()}`,{bubbles:!0,composed:!0,detail:e})))}connectedCallback(){super.connectedCallback(),this.cleanOptions=is.parse(this.options||{});const{assistantId:s,params:e,config:t}=this.cleanOptions;Di(this,Ne,new jr(s,{params:e,simulateDelays:!0,historyKey:t.historyKey,initialReplyMessage:t.initialReplyMessage})),this.updateMessages(dt(this,Ne).messages),this.showTyping=dt(this,Ne).isTyping,this.disableInput=dt(this,Ne).inputDisabled,this.chatManager.on("functionCall",({id:i,name:n,params:r})=>{const a=this.cleanOptions.handlers.functionCalls[n];if(!a){console.warn(`No function call handler found for ${n}`);return}a.call(this,{id:i,params:r,html:z,chatWindow:this})}),this.chatManager.on("typing",i=>{this.showTyping=i}),this.chatManager.on("inputDisabled",i=>{this.disableInput=i}),this.chatManager.on("message",i=>{this.updateMessages([...this.messages,i])}),this.chatManager.on("messageRemoved",i=>{this.updateMessages(this.messages.filter(n=>n.id!==i))}),this.chatManager.on("reset",()=>{this.updateMessages([])}),this.chatManager.on("*",this._emitter.emit)}disconnectedCallback(){super.disconnectedCallback(),this._emitter.all.clear(),dt(this,Ne).destroy()}firstUpdated(){this.focusOnInput()}updateMessages(s){this.messages=[...s],this.scrollChatToBottom()}render(){const{header:s,showCloseButton:e}=this.cleanOptions.config.chatWindow;return z`
134
+ `;var Vr=Object.defineProperty,Wr=Object.getOwnPropertyDescriptor,be=(s,e,t,i)=>{for(var n=i>1?void 0:i?Wr(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Vr(e,t,n),n},Di=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},ut=(s,e,t)=>(Di(s,e,"read from private field"),t?t.call(s):e.get(s)),zi=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Ui=(s,e,t,i)=>(Di(s,e,"write to private field"),i?i.call(s,t):e.set(s,t),t),Pe,ds;let oe=class extends se{constructor(){super(),zi(this,Pe,void 0),zi(this,ds,Promise.resolve()),this.disableInput=!1,this.showTyping=!1,this.messages=[],this.inputValue="",this.internalDisableInput=!1,this.internalShowTyping=!1,this._emitter=Rr(),this._emitter.on("*",(s,e)=>this.dispatchEvent(new CustomEvent(`iai-chat-${s.toString()}`,{bubbles:!0,composed:!0,detail:e})))}connectedCallback(){super.connectedCallback(),this.cleanOptions=as.parse(this.options||{});const{assistantId:s,params:e,config:t}=this.cleanOptions;Ui(this,Pe,new jr(s,{params:e,simulateDelays:!0,historyKey:t.historyKey,initialReplyMessage:t.initialReplyMessage})),this.updateMessages(ut(this,Pe).messages),this.showTyping=ut(this,Pe).isTyping,this.disableInput=ut(this,Pe).inputDisabled,this.chatManager.on("functionCall",({id:i,name:n,params:r})=>{const a=this.cleanOptions.handlers.functionCalls[n];if(!a){console.warn(`No function call handler found for ${n}`);return}a.call(this,{id:i,params:r,html:L,chatWindow:this})}),this.chatManager.on("typing",i=>{this.showTyping=i}),this.chatManager.on("inputDisabled",i=>{this.disableInput=i}),this.chatManager.on("message",i=>{this.updateMessages([...this.messages,i])}),this.chatManager.on("messageRemoved",i=>{this.updateMessages(this.messages.filter(n=>n.id!==i))}),this.chatManager.on("reset",()=>{this.updateMessages([])}),this.chatManager.on("*",this._emitter.emit)}disconnectedCallback(){super.disconnectedCallback(),this._emitter.all.clear(),ut(this,Pe).destroy()}firstUpdated(){this.focusOnInput()}updateMessages(s){this.messages=[...s],this.scrollChatToBottom()}render(){const{header:s,showCloseButton:e}=this.cleanOptions.config.chatWindow;return L`
135
135
  <div class="flex flex-col h-full rounded-lg shadow-lg bg-white">
136
136
  <div class="header rounded-t-lg text-lg p-2 flex justify-between items-center">
137
137
  <div class="flex flex-row h-full items-center">
138
- ${ct(s.imageSrc,()=>z`
138
+ ${Ne(s.imageSrc,()=>L`
139
139
  <img src="${s.imageSrc}" alt="Logo" style="max-height: 100%" />
140
140
  `)}
141
- ${ct(s.text,()=>z`
141
+ ${Ne(s.text,()=>L`
142
142
  <span class="text-lg font-semibold ml-2">${s.text}</span>
143
143
  `)}
144
144
  </div>
@@ -152,9 +152,9 @@
152
152
  ${Fr}
153
153
  </button>
154
154
 
155
- ${ct(e,()=>z`
155
+ ${Ne(e,()=>L`
156
156
  <button class="mr-2 h-6 focus:outline-none" @click="${this.closeChat}">
157
- ${As}
157
+ ${Lt}
158
158
  </button>
159
159
  `)}
160
160
  </div>
@@ -162,7 +162,7 @@
162
162
  <div id="chat-container" class="flex-1 overflow-y-auto p-4 flex flex-col gap-2">
163
163
  ${this.chatMessage({id:"intro-message",role:"assistant",content:this.cleanOptions.config.welcomeMessage})}
164
164
 
165
- ${Ur(this.messages,t=>t.id,(t,i)=>z`
165
+ ${Ur(this.messages,t=>t.id,(t,i)=>L`
166
166
  <div>
167
167
  ${this.nameLabel(i)}
168
168
  ${this.chatMessage(t)}
@@ -198,19 +198,19 @@
198
198
  </form>
199
199
  </div>
200
200
  </div>
201
- `}get chatManager(){return dt(this,Ne)}resetChat(){this.chatManager.reset()}addMessage(s){return this.chatManager.addMessage(s)}removeMessage(s){this.chatManager.removeMessage(s)}setInputDisabled(s=!0){this.chatManager.setInputDisabled(s)}setTypingIndicatorVisible(s=!0){this.chatManager.setTyping(s)}async sendFunctionCallResponse(s,e,t=!1){try{await this.chatManager.respondToFunctionCall(s,e,t)}catch(i){console.error("sendFunctionCallResponse error",i),this.addMessage({role:"assistant",content:"An unexpected error occurred. Please try again later."})}}async sendUserMessage(s){s.preventDefault(),!(this.internalDisableInput||this.disableInput)&&(this.internalDisableInput=!0,this.dispatchEvent(new CustomEvent("iai-chat-send-user-message",{bubbles:!0,composed:!0,detail:{message:this.inputValue},cancelable:!0}))&&(await dt(this,as),Di(this,as,this.chatManager.sendUserMessage(this.inputValue))),this.inputValue="",this.internalDisableInput=!1,setTimeout(()=>{this.focusOnInput()},0))}focusOnInput(){var s;const e=(s=this.shadowRoot)==null?void 0:s.getElementById("message-input");e==null||e.focus()}scrollChatToBottom(){var s;const e=(s=this.shadowRoot)==null?void 0:s.getElementById("chat-container");e==null||e.scrollTo({top:e==null?void 0:e.scrollHeight,behavior:"smooth"})}nameLabel(s){const e=this.messages[s];if(e.role!=="assistant")return null;const t=e.name||"Assistant",i=this.messages[s-1];return((i==null?void 0:i.name)||"Assistant")===t?null:z`
201
+ `}get chatManager(){return ut(this,Pe)}resetChat(){this.chatManager.reset()}addMessage(s){return this.chatManager.addMessage(s)}removeMessage(s){this.chatManager.removeMessage(s)}setInputDisabled(s=!0){this.chatManager.setInputDisabled(s)}setTypingIndicatorVisible(s=!0){this.chatManager.setTyping(s)}async sendFunctionCallResponse(s,e,t=!1){try{await this.chatManager.respondToFunctionCall(s,e,t)}catch(i){console.error("sendFunctionCallResponse error",i),this.addMessage({role:"assistant",content:"An unexpected error occurred. Please try again later."})}}async sendUserMessage(s){s.preventDefault(),!(this.internalDisableInput||this.disableInput)&&(this.internalDisableInput=!0,this.dispatchEvent(new CustomEvent("iai-chat-send-user-message",{bubbles:!0,composed:!0,detail:{message:this.inputValue},cancelable:!0}))&&(await ut(this,ds),Ui(this,ds,this.chatManager.sendUserMessage(this.inputValue))),this.inputValue="",this.internalDisableInput=!1,setTimeout(()=>{this.focusOnInput()},0))}focusOnInput(){var s;const e=(s=this.shadowRoot)==null?void 0:s.getElementById("message-input");e==null||e.focus()}scrollChatToBottom(){var s;const e=(s=this.shadowRoot)==null?void 0:s.getElementById("chat-container");e==null||e.scrollTo({top:e==null?void 0:e.scrollHeight,behavior:"smooth"})}nameLabel(s){const e=this.messages[s];if(e.role!=="assistant")return null;const t=e.name||"Assistant",i=this.messages[s-1];return((i==null?void 0:i.name)||"Assistant")===t?null:L`
202
202
  <div class="name text-sm">${e.name||"Assistant"}</div>
203
- `}chatMessage(s){switch(s.role){case"assistant":return z`
203
+ `}chatMessage(s){switch(s.role){case"assistant":return L`
204
204
  <iai-chat-message-assistant
205
205
  id="message-${s.id}"
206
206
  .content="${s.content}"
207
207
  ></iai-chat-message-assistant>
208
- `;case"user":return z`
208
+ `;case"user":return L`
209
209
  <iai-chat-message-user
210
210
  id="message-${s.id}"
211
211
  .content="${s.content}"
212
212
  ></iai-chat-message-user>
213
- `;case"system":return z`
213
+ `;case"system":return L`
214
214
  <iai-chat-message-system
215
215
  id="message-${s.id}"
216
216
  .content="${s.content}"
@@ -218,7 +218,7 @@
218
218
  .contentHtmlTemplate="${s.contentHtmlTemplate}"
219
219
  .options="${this.cleanOptions}"
220
220
  ></iai-chat-message-system>
221
- `;default:return""}}closeChat(){this._emitter.emit("close")}};Ne=new WeakMap,as=new WeakMap,oe.styles=[Ee,Qe`
221
+ `;default:return""}}closeChat(){this._emitter.emit("close")}};Pe=new WeakMap,ds=new WeakMap,oe.styles=[Ee,tt`
222
222
  .header {
223
223
  background-color: var(--iai-chat-i-header-bg);
224
224
  color: var(--iai-chat-i-header-fg);
@@ -234,57 +234,68 @@
234
234
  .name {
235
235
  color: #8c8c8c;
236
236
  }
237
- `],be([J({type:Object})],oe.prototype,"options",2),be([J()],oe.prototype,"disableInput",2),be([J()],oe.prototype,"showTyping",2),be([it()],oe.prototype,"messages",2),be([it()],oe.prototype,"inputValue",2),be([it()],oe.prototype,"internalDisableInput",2),be([it()],oe.prototype,"internalShowTyping",2),be([$s.debounce(1)],oe.prototype,"scrollChatToBottom",1),oe=be([Ce("iai-chat")],oe);var Ui={exports:{}};(function(s){(function(e){if(typeof window>"u")return;var t=0,i=!1,n=!1,r="message",a=r.length,o="[iFrameSizer]",c=o.length,l=null,h=window.requestAnimationFrame,m=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),d={},b=null,N=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){ce("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function H(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function ee(u,y,M){u.addEventListener(y,M,!1)}function _e(u,y,M){u.removeEventListener(y,M,!1)}function xe(){var u=["moz","webkit","o","ms"],y;for(y=0;y<u.length&&!h;y+=1)h=window[u[y]+"RequestAnimationFrame"];h?h=h.bind(window):O("setup","RequestAnimationFrame not supported")}function te(u){var y="Host page: "+u;return window.top!==window.self&&(y=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+u:"Nested host page: "+u),y}function ut(u){return o+"["+te(u)+"]"}function ke(u){return d[u]?d[u].log:i}function O(u,y){Ms("log",u,y,ke(u))}function qi(u,y){Ms("info",u,y,ke(u))}function ce(u,y){Ms("warn",u,y,!0)}function Ms(u,y,M,x){x===!0&&typeof window.console=="object"&&console[u](ut(y),M)}function xa(u){function y(){function v(){tn(R),Xi($),Ge("onResized",R)}Z("Height"),Z("Width"),sn(v,R,"init")}function M(){var v=le.slice(c).split(":"),A=v[1]?parseInt(v[1],10):0,L=d[v[0]]&&d[v[0]].iframe,D=getComputedStyle(L);return{iframe:L,id:v[0],height:A+x(D)+P(D),width:v[2],type:v[3]}}function x(v){if(v.boxSizing!=="border-box")return 0;var A=v.paddingTop?parseInt(v.paddingTop,10):0,L=v.paddingBottom?parseInt(v.paddingBottom,10):0;return A+L}function P(v){if(v.boxSizing!=="border-box")return 0;var A=v.borderTopWidth?parseInt(v.borderTopWidth,10):0,L=v.borderBottomWidth?parseInt(v.borderBottomWidth,10):0;return A+L}function Z(v){var A=Number(d[$]["max"+v]),L=Number(d[$]["min"+v]),D=v.toLowerCase(),K=Number(R[D]);O($,"Checking "+D+" is in range "+L+"-"+A),K<L&&(K=L,O($,"Set "+D+" to min value")),K>A&&(K=A,O($,"Set "+D+" to max value")),R[D]=""+K}function fe(){function v(){function D(){var X=0,$e=!1;for(O($,"Checking connection is from allowed list of origins: "+L);X<L.length;X++)if(L[X]===A){$e=!0;break}return $e}function K(){var X=d[$]&&d[$].remoteHost;return O($,"Checking connection is from: "+X),A===X}return L.constructor===Array?D():K()}var A=u.origin,L=d[$]&&d[$].checkOrigin;if(L&&""+A!="null"&&!v())throw new Error("Unexpected message received from: "+A+" for "+R.iframe.id+". Message was: "+u.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function Ye(){return o===(""+le).slice(0,c)&&le.slice(c).split(":")[0]in d}function Te(){var v=R.type in{true:1,false:1,undefined:1};return v&&O($,"Ignoring init message from meta parent page"),v}function Se(v){return le.slice(le.indexOf(":")+a+v)}function Pe(v){O($,"onMessage passed: {iframe: "+R.iframe.id+", message: "+v+"}"),Ge("onMessage",{iframe:R.iframe,message:JSON.parse(v)}),O($,"--")}function Ls(){var v=document.body.getBoundingClientRect(),A=R.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:A.height,iframeWidth:A.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(A.top-v.top,10),offsetLeft:parseInt(A.left-v.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function ps(v,A){function L(){me("Send Page Info","pageInfo:"+Ls(),v,A)}Ta(L,32,A)}function zs(){function v(K,X){function $e(){d[D]?ps(d[D].iframe,D):A()}["scroll","resize"].forEach(function(cn){O(D,K+cn+" listener for sendPageInfo"),X(window,cn,$e)})}function A(){v("Remove ",_e)}function L(){v("Add ",ee)}var D=$;L(),d[D]&&(d[D].stopPageInfo=A)}function Ds(){d[$]&&d[$].stopPageInfo&&(d[$].stopPageInfo(),delete d[$].stopPageInfo)}function Us(){var v=!0;return R.iframe===null&&(ce($,"IFrame ("+R.id+") not found"),v=!1),v}function k(v){var A=v.getBoundingClientRect();return Gi($),{x:Math.floor(Number(A.left)+Number(l.x)),y:Math.floor(Number(A.top)+Number(l.y))}}function T(v){function A(){l=X,W(),O($,"--")}function L(){return{x:Number(R.width)+K.x,y:Number(R.height)+K.y}}function D(){window.parentIFrame?window.parentIFrame["scrollTo"+(v?"Offset":"")](X.x,X.y):ce($,"Unable to scroll to requested position, window.parentIFrame not found")}var K=v?k(R.iframe):{x:0,y:0},X=L();O($,"Reposition requested from iFrame (offset x:"+K.x+" y:"+K.y+")"),window.top===window.self?A():D()}function W(){Ge("onScroll",l)===!1?Qi():Xi($)}function Y(v){function A(){var $e=k(X);O($,"Moving to in page link (#"+D+") at x: "+$e.x+" y: "+$e.y),l={x:$e.x,y:$e.y},W(),O($,"--")}function L(){window.parentIFrame?window.parentIFrame.moveToAnchor(D):O($,"In page link #"+D+" not found and window.parentIFrame not found")}var D=v.split("#")[1]||"",K=decodeURIComponent(D),X=document.getElementById(K)||document.getElementsByName(K)[0];X?A():window.top===window.self?O($,"In page link #"+D+" not found"):L()}function de(v){var A={};if(Number(R.width)===0&&Number(R.height)===0){var L=Se(9).split(":");A={x:L[1],y:L[0]}}else A={x:R.width,y:R.height};Ge(v,{iframe:R.iframe,screenX:Number(A.x),screenY:Number(A.y),type:R.type})}function Ge(v,A){return Ns($,v,A)}function Hs(){switch(d[$]&&d[$].firstRun&&Vs(),R.type){case"close":{Ps(R.iframe);break}case"message":{Pe(Se(6));break}case"mouseenter":{de("onMouseEnter");break}case"mouseleave":{de("onMouseLeave");break}case"autoResize":{d[$].autoResize=JSON.parse(Se(9));break}case"scrollTo":{T(!1);break}case"scrollToOffset":{T(!0);break}case"pageInfo":{ps(d[$]&&d[$].iframe,$),zs();break}case"pageInfoStop":{Ds();break}case"inPageLink":{Y(Se(9));break}case"reset":{en(R);break}case"init":{y(),Ge("onInit",R.iframe);break}default:Number(R.width)===0&&Number(R.height)===0?ce("Unsupported message received ("+R.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):y()}}function Bs(v){var A=!0;return d[v]||(A=!1,ce(R.type+" No settings for "+v+". Message was: "+le)),A}function Fs(){for(var v in d)me("iFrame requested init",nn(v),d[v].iframe,v)}function Vs(){d[$]&&(d[$].firstRun=!1)}var le=u.data,R={},$=null;le==="[iFrameResizerChild]Ready"?Fs():Ye()?(R=M(),$=R.id,d[$]&&(d[$].loaded=!0),!Te()&&Bs($)&&(O($,"Received: "+le),Us()&&fe()&&Hs())):qi($,"Ignored: "+le)}function Ns(u,y,M){var x=null,P=null;if(d[u])if(x=d[u][y],typeof x=="function")P=x(M);else throw new TypeError(y+" on iFrame["+u+"] is not a function");return P}function Yi(u){var y=u.id;delete d[y]}function Ps(u){var y=u.id;if(Ns(y,"onClose",y)===!1){O(y,"Close iframe cancelled by onClose event");return}O(y,"Removing iFrame: "+y);try{u.parentNode&&u.parentNode.removeChild(u)}catch(M){ce(M)}Ns(y,"onClosed",y),O(y,"--"),Yi(u)}function Gi(u){l===null&&(l={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset},O(u,"Get page position: "+l.x+","+l.y))}function Xi(u){l!==null&&(window.scrollTo(l.x,l.y),O(u,"Set page position: "+l.x+","+l.y),Qi())}function Qi(){l=null}function en(u){function y(){tn(u),me("reset","reset",u.iframe,u.id)}O(u.id,"Size reset requested by "+(u.type==="init"?"host page":"iFrame")),Gi(u.id),sn(y,u,"reset")}function tn(u){function y(Z){if(!u.id){O("undefined","messageData id not set");return}u.iframe.style[Z]=u[Z]+"px",O(u.id,"IFrame ("+P+") "+Z+" set to "+u[Z]+"px")}function M(Z){!n&&u[Z]==="0"&&(n=!0,O(P,"Hidden iFrame detected, creating visibility listener"),Sa())}function x(Z){y(Z),M(Z)}var P=u.iframe.id;d[P]&&(d[P].sizeHeight&&x("height"),d[P].sizeWidth&&x("width"))}function sn(u,y,M){M!==y.type&&h&&!window.jasmine?(O(y.id,"Requesting animation frame"),h(u)):u()}function me(u,y,M,x,P){function Z(){var Pe=d[x]&&d[x].targetOrigin;O(x,"["+u+"] Sending msg to iframe["+x+"] ("+y+") targetOrigin: "+Pe),M.contentWindow.postMessage(o+y,Pe)}function fe(){ce(x,"["+u+"] IFrame("+x+") not found")}function Ye(){M&&"contentWindow"in M&&M.contentWindow!==null?Z():fe()}function Te(){function Pe(){d[x]&&!d[x].loaded&&!Se&&(Se=!0,ce(x,"IFrame has not responded within "+d[x].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}P&&d[x]&&d[x].warningTimeout&&(d[x].msgTimeout=setTimeout(Pe,d[x].warningTimeout))}var Se=!1;x=x||M.id,d[x]&&(Ye(),Te())}function nn(u){return u+":"+d[u].bodyMarginV1+":"+d[u].sizeWidth+":"+d[u].log+":"+d[u].interval+":"+d[u].enablePublicMethods+":"+d[u].autoResize+":"+d[u].bodyMargin+":"+d[u].heightCalculationMethod+":"+d[u].bodyBackground+":"+d[u].bodyPadding+":"+d[u].tolerance+":"+d[u].inPageLinks+":"+d[u].resizeFrom+":"+d[u].widthCalculationMethod+":"+d[u].mouseEvents}function ka(u){return typeof u=="number"}function rn(u,y){function M(){function T(Y){var de=d[k][Y];de!==1/0&&de!==0&&(u.style[Y]=ka(de)?de+"px":de,O(k,"Set "+Y+" = "+u.style[Y]))}function W(Y){if(d[k]["min"+Y]>d[k]["max"+Y])throw new Error("Value for min"+Y+" can not be greater than max"+Y)}W("Height"),W("Width"),T("maxHeight"),T("minHeight"),T("maxWidth"),T("minWidth")}function x(){var T=y&&y.id||N.id+t++;return document.getElementById(T)!==null&&(T+=t++),T}function P(T){if(typeof T!="string")throw new TypeError("Invaild id for iFrame. Expected String");return T===""&&(u.id=T=x(),i=(y||{}).log,O(T,"Added missing iframe ID: "+T+" ("+u.src+")")),T}function Z(){switch(O(k,"IFrame scrolling "+(d[k]&&d[k].scrolling?"enabled":"disabled")+" for "+k),u.style.overflow=(d[k]&&d[k].scrolling)===!1?"hidden":"auto",d[k]&&d[k].scrolling){case"omit":break;case!0:{u.scrolling="yes";break}case!1:{u.scrolling="no";break}default:u.scrolling=d[k]?d[k].scrolling:"no"}}function fe(){(typeof(d[k]&&d[k].bodyMargin)=="number"||(d[k]&&d[k].bodyMargin)==="0")&&(d[k].bodyMarginV1=d[k].bodyMargin,d[k].bodyMargin=""+d[k].bodyMargin+"px")}function Ye(){var T=d[k]&&d[k].firstRun,W=d[k]&&d[k].heightCalculationMethod in m;!T&&W&&en({iframe:u,height:0,width:0,type:"init"})}function Te(){d[k]&&(d[k].iframe.iFrameResizer={close:Ps.bind(null,d[k].iframe),removeListeners:Yi.bind(null,d[k].iframe),resize:me.bind(null,"Window resize","resize",d[k].iframe),moveToAnchor:function(T){me("Move to anchor","moveToAnchor:"+T,d[k].iframe,k)},sendMessage:function(T){T=JSON.stringify(T),me("Send Message","message:"+T,d[k].iframe,k)}})}function Se(T){function W(){me("iFrame.onload",T,u,e,!0),Ye()}function Y(Ge){if(u.parentNode){var Hs=new Ge(function(Bs){Bs.forEach(function(Fs){var Vs=Array.prototype.slice.call(Fs.removedNodes);Vs.forEach(function(le){le===u&&Ps(u)})})});Hs.observe(u.parentNode,{childList:!0})}}var de=H();de&&Y(de),ee(u,"load",W),me("init",T,u,e,!0)}function Pe(T){if(typeof T!="object")throw new TypeError("Options is not an object")}function Ls(T){for(var W in N)Object.prototype.hasOwnProperty.call(N,W)&&(d[k][W]=Object.prototype.hasOwnProperty.call(T,W)?T[W]:N[W])}function ps(T){return T===""||T.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":T}function zs(T){var W=T.split("Callback");if(W.length===2){var Y="on"+W[0].charAt(0).toUpperCase()+W[0].slice(1);this[Y]=this[T],delete this[T],ce(k,"Deprecated: '"+T+"' has been renamed '"+Y+"'. The old method will be removed in the next major version.")}}function Ds(T){T=T||{},d[k]=Object.create(null),d[k].iframe=u,d[k].firstRun=!0,d[k].remoteHost=u.src&&u.src.split("/").slice(0,3).join("/"),Pe(T),Object.keys(T).forEach(zs,T),Ls(T),d[k]&&(d[k].targetOrigin=d[k].checkOrigin===!0?ps(d[k].remoteHost):"*")}function Us(){return k in d&&"iFrameResizer"in u}var k=P(u.id);Us()?ce(k,"Ignored iFrame, already setup."):(Ds(y),Z(),M(),fe(),Se(nn(k)),Te())}function js(u,y){b===null&&(b=setTimeout(function(){b=null,u()},y))}var Rs={};function Ta(u,y,M){Rs[M]||(Rs[M]=setTimeout(function(){Rs[M]=null,u()},y))}function Sa(){function u(){function P(Z){function fe(Te){return(d[Z]&&d[Z].iframe.style[Te])==="0px"}function Ye(Te){return Te.offsetParent!==null}d[Z]&&Ye(d[Z].iframe)&&(fe("height")||fe("width"))&&me("Visibility change","resize",d[Z].iframe,Z)}Object.keys(d).forEach(function(Z){P(Z)})}function y(P){O("window","Mutation observed: "+P[0].target+" "+P[0].type),js(u,16)}function M(){var P=document.querySelector("body"),Z={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},fe=new x(y);fe.observe(P,Z)}var x=H();x&&M()}function $a(u){function y(){on("Window "+u,"resize")}O("window","Trigger event: "+u),js(y,16)}function an(){function u(){on("Tab Visible","resize")}document.visibilityState!=="hidden"&&(O("document","Trigger event: Visibility change"),js(u,16))}function on(u,y){function M(x){return d[x]&&d[x].resizeFrom==="parent"&&d[x].autoResize&&!d[x].firstRun}Object.keys(d).forEach(function(x){M(x)&&me(u,y,d[x].iframe,x)})}function Ea(){ee(window,"message",xa),ee(window,"resize",function(){$a("resize")}),ee(document,"visibilitychange",an),ee(document,"-webkit-visibilitychange",an)}function Zs(){function u(x,P){function Z(){if(P.tagName){if(P.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+P.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}P&&(Z(),rn(P,x),M.push(P))}function y(x){x&&x.enablePublicMethods&&ce("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var M;return xe(),Ea(),function(x,P){switch(M=[],y(x),typeof P){case"undefined":case"string":{Array.prototype.forEach.call(document.querySelectorAll(P||"iframe"),u.bind(e,x));break}case"object":{u(x,P);break}default:throw new TypeError("Unexpected data type ("+typeof P+")")}return M}}function Ca(u){u.fn?u.fn.iFrameResize||(u.fn.iFrameResize=function(y){function M(x,P){rn(P,y)}return this.filter("iframe").each(M).end()}):qi("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==e&&Ca(window.jQuery),typeof e=="function"&&e.amd?e([],Zs):s.exports=Zs(),window.iFrameResize=window.iFrameResize||Zs()})()})(Ui);var Kr=Ui.exports;const Jr=ji(Kr);var qr=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,Hi=(s,e,t,i)=>{for(var n=i>1?void 0:i?Yr(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&qr(e,t,n),n};let os=class extends se{constructor(){super(...arguments),this.src=""}async onLoad(s){Jr({log:!1,heightCalculationMethod:"max",onMessage:({message:e})=>{this.dispatchEvent(new CustomEvent("message-received",{bubbles:!0,composed:!0,detail:e}))}},s.target)}render(){return z`
238
- <iframe
239
- src=${this.src}
240
- width="100%"
241
- @load=${this.onLoad}
242
- ></iframe>
243
- `}};os.styles=[Ee],Hi([J({type:String})],os.prototype,"src",2),os=Hi([Ce("iai-chat-iframe")],os);var Gr=Object.defineProperty,Xr=Object.getOwnPropertyDescriptor,Os=(s,e,t,i)=>{for(var n=i>1?void 0:i?Xr(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Gr(e,t,n),n};let Rt=class extends se{constructor(){super(...arguments),this.title="",this.src=""}async connectedCallback(){super.connectedCallback()}close(){this.dispatchEvent(new CustomEvent("close"))}render(){return z`
237
+ `],be([W({type:Object})],oe.prototype,"options",2),be([W()],oe.prototype,"disableInput",2),be([W()],oe.prototype,"showTyping",2),be([rt()],oe.prototype,"messages",2),be([rt()],oe.prototype,"inputValue",2),be([rt()],oe.prototype,"internalDisableInput",2),be([rt()],oe.prototype,"internalShowTyping",2),be([Cs.debounce(1)],oe.prototype,"scrollChatToBottom",1),oe=be([Ce("iai-chat")],oe);var Hi={exports:{}};(function(s){(function(e){if(typeof window>"u")return;var t=0,i=!1,n=!1,r="message",a=r.length,o="[iFrameSizer]",c=o.length,l=null,h=window.requestAnimationFrame,m=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),d={},b=null,N=Object.freeze({autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){ce("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function H(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function ee(u,y,M){u.addEventListener(y,M,!1)}function _e(u,y,M){u.removeEventListener(y,M,!1)}function xe(){var u=["moz","webkit","o","ms"],y;for(y=0;y<u.length&&!h;y+=1)h=window[u[y]+"RequestAnimationFrame"];h?h=h.bind(window):O("setup","RequestAnimationFrame not supported")}function te(u){var y="Host page: "+u;return window.top!==window.self&&(y=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+u:"Nested host page: "+u),y}function mt(u){return o+"["+te(u)+"]"}function ke(u){return d[u]?d[u].log:i}function O(u,y){Ns("log",u,y,ke(u))}function qi(u,y){Ns("info",u,y,ke(u))}function ce(u,y){Ns("warn",u,y,!0)}function Ns(u,y,M,x){x===!0&&typeof window.console=="object"&&console[u](mt(y),M)}function xa(u){function y(){function v(){tn(R),Xi($),Qe("onResized",R)}Z("Height"),Z("Width"),sn(v,R,"init")}function M(){var v=le.slice(c).split(":"),A=v[1]?parseInt(v[1],10):0,D=d[v[0]]&&d[v[0]].iframe,z=getComputedStyle(D);return{iframe:D,id:v[0],height:A+x(z)+P(z),width:v[2],type:v[3]}}function x(v){if(v.boxSizing!=="border-box")return 0;var A=v.paddingTop?parseInt(v.paddingTop,10):0,D=v.paddingBottom?parseInt(v.paddingBottom,10):0;return A+D}function P(v){if(v.boxSizing!=="border-box")return 0;var A=v.borderTopWidth?parseInt(v.borderTopWidth,10):0,D=v.borderBottomWidth?parseInt(v.borderBottomWidth,10):0;return A+D}function Z(v){var A=Number(d[$]["max"+v]),D=Number(d[$]["min"+v]),z=v.toLowerCase(),J=Number(R[z]);O($,"Checking "+z+" is in range "+D+"-"+A),J<D&&(J=D,O($,"Set "+z+" to min value")),J>A&&(J=A,O($,"Set "+z+" to max value")),R[z]=""+J}function fe(){function v(){function z(){var X=0,$e=!1;for(O($,"Checking connection is from allowed list of origins: "+D);X<D.length;X++)if(D[X]===A){$e=!0;break}return $e}function J(){var X=d[$]&&d[$].remoteHost;return O($,"Checking connection is from: "+X),A===X}return D.constructor===Array?z():J()}var A=u.origin,D=d[$]&&d[$].checkOrigin;if(D&&""+A!="null"&&!v())throw new Error("Unexpected message received from: "+A+" for "+R.iframe.id+". Message was: "+u.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function Xe(){return o===(""+le).slice(0,c)&&le.slice(c).split(":")[0]in d}function Se(){var v=R.type in{true:1,false:1,undefined:1};return v&&O($,"Ignoring init message from meta parent page"),v}function Te(v){return le.slice(le.indexOf(":")+a+v)}function Re(v){O($,"onMessage passed: {iframe: "+R.iframe.id+", message: "+v+"}"),Qe("onMessage",{iframe:R.iframe,message:JSON.parse(v)}),O($,"--")}function Ds(){var v=document.body.getBoundingClientRect(),A=R.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:A.height,iframeWidth:A.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(A.top-v.top,10),offsetLeft:parseInt(A.left-v.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function fs(v,A){function D(){me("Send Page Info","pageInfo:"+Ds(),v,A)}Sa(D,32,A)}function zs(){function v(J,X){function $e(){d[z]?fs(d[z].iframe,z):A()}["scroll","resize"].forEach(function(cn){O(z,J+cn+" listener for sendPageInfo"),X(window,cn,$e)})}function A(){v("Remove ",_e)}function D(){v("Add ",ee)}var z=$;D(),d[z]&&(d[z].stopPageInfo=A)}function Us(){d[$]&&d[$].stopPageInfo&&(d[$].stopPageInfo(),delete d[$].stopPageInfo)}function Hs(){var v=!0;return R.iframe===null&&(ce($,"IFrame ("+R.id+") not found"),v=!1),v}function k(v){var A=v.getBoundingClientRect();return Gi($),{x:Math.floor(Number(A.left)+Number(l.x)),y:Math.floor(Number(A.top)+Number(l.y))}}function S(v){function A(){l=X,K(),O($,"--")}function D(){return{x:Number(R.width)+J.x,y:Number(R.height)+J.y}}function z(){window.parentIFrame?window.parentIFrame["scrollTo"+(v?"Offset":"")](X.x,X.y):ce($,"Unable to scroll to requested position, window.parentIFrame not found")}var J=v?k(R.iframe):{x:0,y:0},X=D();O($,"Reposition requested from iFrame (offset x:"+J.x+" y:"+J.y+")"),window.top===window.self?A():z()}function K(){Qe("onScroll",l)===!1?Qi():Xi($)}function Y(v){function A(){var $e=k(X);O($,"Moving to in page link (#"+z+") at x: "+$e.x+" y: "+$e.y),l={x:$e.x,y:$e.y},K(),O($,"--")}function D(){window.parentIFrame?window.parentIFrame.moveToAnchor(z):O($,"In page link #"+z+" not found and window.parentIFrame not found")}var z=v.split("#")[1]||"",J=decodeURIComponent(z),X=document.getElementById(J)||document.getElementsByName(J)[0];X?A():window.top===window.self?O($,"In page link #"+z+" not found"):D()}function de(v){var A={};if(Number(R.width)===0&&Number(R.height)===0){var D=Te(9).split(":");A={x:D[1],y:D[0]}}else A={x:R.width,y:R.height};Qe(v,{iframe:R.iframe,screenX:Number(A.x),screenY:Number(A.y),type:R.type})}function Qe(v,A){return Ps($,v,A)}function Bs(){switch(d[$]&&d[$].firstRun&&Ws(),R.type){case"close":{js(R.iframe);break}case"message":{Re(Te(6));break}case"mouseenter":{de("onMouseEnter");break}case"mouseleave":{de("onMouseLeave");break}case"autoResize":{d[$].autoResize=JSON.parse(Te(9));break}case"scrollTo":{S(!1);break}case"scrollToOffset":{S(!0);break}case"pageInfo":{fs(d[$]&&d[$].iframe,$),zs();break}case"pageInfoStop":{Us();break}case"inPageLink":{Y(Te(9));break}case"reset":{en(R);break}case"init":{y(),Qe("onInit",R.iframe);break}default:Number(R.width)===0&&Number(R.height)===0?ce("Unsupported message received ("+R.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):y()}}function Fs(v){var A=!0;return d[v]||(A=!1,ce(R.type+" No settings for "+v+". Message was: "+le)),A}function Vs(){for(var v in d)me("iFrame requested init",nn(v),d[v].iframe,v)}function Ws(){d[$]&&(d[$].firstRun=!1)}var le=u.data,R={},$=null;le==="[iFrameResizerChild]Ready"?Vs():Xe()?(R=M(),$=R.id,d[$]&&(d[$].loaded=!0),!Se()&&Fs($)&&(O($,"Received: "+le),Hs()&&fe()&&Bs())):qi($,"Ignored: "+le)}function Ps(u,y,M){var x=null,P=null;if(d[u])if(x=d[u][y],typeof x=="function")P=x(M);else throw new TypeError(y+" on iFrame["+u+"] is not a function");return P}function Yi(u){var y=u.id;delete d[y]}function js(u){var y=u.id;if(Ps(y,"onClose",y)===!1){O(y,"Close iframe cancelled by onClose event");return}O(y,"Removing iFrame: "+y);try{u.parentNode&&u.parentNode.removeChild(u)}catch(M){ce(M)}Ps(y,"onClosed",y),O(y,"--"),Yi(u)}function Gi(u){l===null&&(l={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset},O(u,"Get page position: "+l.x+","+l.y))}function Xi(u){l!==null&&(window.scrollTo(l.x,l.y),O(u,"Set page position: "+l.x+","+l.y),Qi())}function Qi(){l=null}function en(u){function y(){tn(u),me("reset","reset",u.iframe,u.id)}O(u.id,"Size reset requested by "+(u.type==="init"?"host page":"iFrame")),Gi(u.id),sn(y,u,"reset")}function tn(u){function y(Z){if(!u.id){O("undefined","messageData id not set");return}u.iframe.style[Z]=u[Z]+"px",O(u.id,"IFrame ("+P+") "+Z+" set to "+u[Z]+"px")}function M(Z){!n&&u[Z]==="0"&&(n=!0,O(P,"Hidden iFrame detected, creating visibility listener"),Ta())}function x(Z){y(Z),M(Z)}var P=u.iframe.id;d[P]&&(d[P].sizeHeight&&x("height"),d[P].sizeWidth&&x("width"))}function sn(u,y,M){M!==y.type&&h&&!window.jasmine?(O(y.id,"Requesting animation frame"),h(u)):u()}function me(u,y,M,x,P){function Z(){var Re=d[x]&&d[x].targetOrigin;O(x,"["+u+"] Sending msg to iframe["+x+"] ("+y+") targetOrigin: "+Re),M.contentWindow.postMessage(o+y,Re)}function fe(){ce(x,"["+u+"] IFrame("+x+") not found")}function Xe(){M&&"contentWindow"in M&&M.contentWindow!==null?Z():fe()}function Se(){function Re(){d[x]&&!d[x].loaded&&!Te&&(Te=!0,ce(x,"IFrame has not responded within "+d[x].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}P&&d[x]&&d[x].warningTimeout&&(d[x].msgTimeout=setTimeout(Re,d[x].warningTimeout))}var Te=!1;x=x||M.id,d[x]&&(Xe(),Se())}function nn(u){return u+":"+d[u].bodyMarginV1+":"+d[u].sizeWidth+":"+d[u].log+":"+d[u].interval+":"+d[u].enablePublicMethods+":"+d[u].autoResize+":"+d[u].bodyMargin+":"+d[u].heightCalculationMethod+":"+d[u].bodyBackground+":"+d[u].bodyPadding+":"+d[u].tolerance+":"+d[u].inPageLinks+":"+d[u].resizeFrom+":"+d[u].widthCalculationMethod+":"+d[u].mouseEvents}function ka(u){return typeof u=="number"}function rn(u,y){function M(){function S(Y){var de=d[k][Y];de!==1/0&&de!==0&&(u.style[Y]=ka(de)?de+"px":de,O(k,"Set "+Y+" = "+u.style[Y]))}function K(Y){if(d[k]["min"+Y]>d[k]["max"+Y])throw new Error("Value for min"+Y+" can not be greater than max"+Y)}K("Height"),K("Width"),S("maxHeight"),S("minHeight"),S("maxWidth"),S("minWidth")}function x(){var S=y&&y.id||N.id+t++;return document.getElementById(S)!==null&&(S+=t++),S}function P(S){if(typeof S!="string")throw new TypeError("Invaild id for iFrame. Expected String");return S===""&&(u.id=S=x(),i=(y||{}).log,O(S,"Added missing iframe ID: "+S+" ("+u.src+")")),S}function Z(){switch(O(k,"IFrame scrolling "+(d[k]&&d[k].scrolling?"enabled":"disabled")+" for "+k),u.style.overflow=(d[k]&&d[k].scrolling)===!1?"hidden":"auto",d[k]&&d[k].scrolling){case"omit":break;case!0:{u.scrolling="yes";break}case!1:{u.scrolling="no";break}default:u.scrolling=d[k]?d[k].scrolling:"no"}}function fe(){(typeof(d[k]&&d[k].bodyMargin)=="number"||(d[k]&&d[k].bodyMargin)==="0")&&(d[k].bodyMarginV1=d[k].bodyMargin,d[k].bodyMargin=""+d[k].bodyMargin+"px")}function Xe(){var S=d[k]&&d[k].firstRun,K=d[k]&&d[k].heightCalculationMethod in m;!S&&K&&en({iframe:u,height:0,width:0,type:"init"})}function Se(){d[k]&&(d[k].iframe.iFrameResizer={close:js.bind(null,d[k].iframe),removeListeners:Yi.bind(null,d[k].iframe),resize:me.bind(null,"Window resize","resize",d[k].iframe),moveToAnchor:function(S){me("Move to anchor","moveToAnchor:"+S,d[k].iframe,k)},sendMessage:function(S){S=JSON.stringify(S),me("Send Message","message:"+S,d[k].iframe,k)}})}function Te(S){function K(){me("iFrame.onload",S,u,e,!0),Xe()}function Y(Qe){if(u.parentNode){var Bs=new Qe(function(Fs){Fs.forEach(function(Vs){var Ws=Array.prototype.slice.call(Vs.removedNodes);Ws.forEach(function(le){le===u&&js(u)})})});Bs.observe(u.parentNode,{childList:!0})}}var de=H();de&&Y(de),ee(u,"load",K),me("init",S,u,e,!0)}function Re(S){if(typeof S!="object")throw new TypeError("Options is not an object")}function Ds(S){for(var K in N)Object.prototype.hasOwnProperty.call(N,K)&&(d[k][K]=Object.prototype.hasOwnProperty.call(S,K)?S[K]:N[K])}function fs(S){return S===""||S.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":S}function zs(S){var K=S.split("Callback");if(K.length===2){var Y="on"+K[0].charAt(0).toUpperCase()+K[0].slice(1);this[Y]=this[S],delete this[S],ce(k,"Deprecated: '"+S+"' has been renamed '"+Y+"'. The old method will be removed in the next major version.")}}function Us(S){S=S||{},d[k]=Object.create(null),d[k].iframe=u,d[k].firstRun=!0,d[k].remoteHost=u.src&&u.src.split("/").slice(0,3).join("/"),Re(S),Object.keys(S).forEach(zs,S),Ds(S),d[k]&&(d[k].targetOrigin=d[k].checkOrigin===!0?fs(d[k].remoteHost):"*")}function Hs(){return k in d&&"iFrameResizer"in u}var k=P(u.id);Hs()?ce(k,"Ignored iFrame, already setup."):(Us(y),Z(),M(),fe(),Te(nn(k)),Se())}function Rs(u,y){b===null&&(b=setTimeout(function(){b=null,u()},y))}var Zs={};function Sa(u,y,M){Zs[M]||(Zs[M]=setTimeout(function(){Zs[M]=null,u()},y))}function Ta(){function u(){function P(Z){function fe(Se){return(d[Z]&&d[Z].iframe.style[Se])==="0px"}function Xe(Se){return Se.offsetParent!==null}d[Z]&&Xe(d[Z].iframe)&&(fe("height")||fe("width"))&&me("Visibility change","resize",d[Z].iframe,Z)}Object.keys(d).forEach(function(Z){P(Z)})}function y(P){O("window","Mutation observed: "+P[0].target+" "+P[0].type),Rs(u,16)}function M(){var P=document.querySelector("body"),Z={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},fe=new x(y);fe.observe(P,Z)}var x=H();x&&M()}function $a(u){function y(){on("Window "+u,"resize")}O("window","Trigger event: "+u),Rs(y,16)}function an(){function u(){on("Tab Visible","resize")}document.visibilityState!=="hidden"&&(O("document","Trigger event: Visibility change"),Rs(u,16))}function on(u,y){function M(x){return d[x]&&d[x].resizeFrom==="parent"&&d[x].autoResize&&!d[x].firstRun}Object.keys(d).forEach(function(x){M(x)&&me(u,y,d[x].iframe,x)})}function Ea(){ee(window,"message",xa),ee(window,"resize",function(){$a("resize")}),ee(document,"visibilitychange",an),ee(document,"-webkit-visibilitychange",an)}function Ls(){function u(x,P){function Z(){if(P.tagName){if(P.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+P.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}P&&(Z(),rn(P,x),M.push(P))}function y(x){x&&x.enablePublicMethods&&ce("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var M;return xe(),Ea(),function(x,P){switch(M=[],y(x),typeof P){case"undefined":case"string":{Array.prototype.forEach.call(document.querySelectorAll(P||"iframe"),u.bind(e,x));break}case"object":{u(x,P);break}default:throw new TypeError("Unexpected data type ("+typeof P+")")}return M}}function Ca(u){u.fn?u.fn.iFrameResize||(u.fn.iFrameResize=function(y){function M(x,P){rn(P,y)}return this.filter("iframe").each(M).end()}):qi("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==e&&Ca(window.jQuery),typeof e=="function"&&e.amd?e([],Ls):s.exports=Ls(),window.iFrameResize=window.iFrameResize||Ls()})()})(Hi);var Kr=Hi.exports;const Jr=Ri(Kr);var qr=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,Is=(s,e,t,i)=>{for(var n=i>1?void 0:i?Yr(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&qr(e,t,n),n};let Dt=class extends se{constructor(){super(...arguments),this.src="",this.showCloseButton=!1}async onLoad(s){Jr({log:!1,heightCalculationMethod:"max",onMessage:({message:e})=>{this.dispatchEvent(new CustomEvent("message-received",{bubbles:!0,composed:!0,detail:e}))}},s.target)}close(){this.dispatchEvent(new CustomEvent("close"))}render(){return L`
238
+ <div class="relative">
239
+ ${Ne(this.showCloseButton,()=>L`
240
+ <button class="absolute top-0 right-0 m-2 h-6 text-white focus:outline-none" @click="${this.close}">
241
+ ${Lt}
242
+ </button>
243
+ `)}
244
+
245
+ <iframe
246
+ src=${this.src}
247
+ width="100%"
248
+ @load=${this.onLoad}
249
+ ></iframe>
250
+ </div>
251
+ `}};Dt.styles=[Ee],Is([W({type:String})],Dt.prototype,"src",2),Is([W({type:Boolean})],Dt.prototype,"showCloseButton",2),Dt=Is([Ce("iai-chat-iframe")],Dt);var Gr=Object.defineProperty,Xr=Object.getOwnPropertyDescriptor,ht=(s,e,t,i)=>{for(var n=i>1?void 0:i?Xr(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&Gr(e,t,n),n};let je=class extends se{constructor(){super(...arguments),this.title="",this.src="",this.width="500px",this.height=null,this.showHeader=!0}async connectedCallback(){super.connectedCallback()}close(){this.dispatchEvent(new CustomEvent("close"))}render(){const s=at({width:this.width,height:this.height});return L`
244
252
  <div class="fixed inset-0 z-50 bg-black bg-opacity-50 flex justify-center items-center">
245
253
  <div
246
254
  class="flex flex-col rounded-lg shadow-lg bg-white mx-auto my-auto max-h-[90vh] max-w-[90vw] overflow-hidden"
255
+ style=${s}
247
256
  part="modal"
248
257
  >
249
- <div class="header text-lg p-2 flex justify-between items-center">
250
- <div class="flex flex-row h-full items-center">
251
- <span class="text-lg font-semibold ml-2">${this.title}</span>
252
- </div>
258
+ ${Ne(this.showHeader,()=>L`
259
+ <div class="header text-lg p-2 flex justify-between items-center">
260
+ <div class="flex flex-row h-full items-center">
261
+ <span class="text-lg font-semibold ml-2">${this.title}</span>
262
+ </div>
253
263
 
254
- <button class="mr-2 focus:outline-none" @click="${this.close}">
255
- <svg class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
256
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
257
- </svg>
258
- </button>
259
- </div>
264
+ <button class="mr-2 h-6 text-white focus:outline-none" @click="${this.close}">
265
+ ${Lt}
266
+ </button>
267
+ </div>
268
+ `)}
260
269
 
261
270
  <div class="overflow-y-auto">
262
271
  <iai-chat-iframe
263
272
  src=${this.src}
273
+ showCloseButton=${!this.showHeader}
274
+ @close=${this.close}
264
275
  ></iai-chat-iframe>
265
276
  </div>
266
277
  </div>
267
278
  </div>
268
- `}};Rt.styles=[Ee,Qe`
279
+ `}};je.styles=[Ee,tt`
269
280
  .header {
270
281
  background-color: var(--iai-chat-i-iframe-modal-header-bg);
271
282
  color: var(--iai-chat-i-iframe-modal-header-fg);
272
283
  height: 50px;
273
284
  }
274
- `],Os([J({type:String})],Rt.prototype,"title",2),Os([J({type:String})],Rt.prototype,"src",2),Rt=Os([Ce("iai-chat-iframe-modal")],Rt);/**
285
+ `],ht([W({type:String})],je.prototype,"title",2),ht([W({type:String})],je.prototype,"src",2),ht([W({type:String})],je.prototype,"width",2),ht([W({type:String})],je.prototype,"height",2),ht([W({type:Boolean})],je.prototype,"showHeader",2),je=ht([Ce("iai-chat-iframe-modal")],je);/**
275
286
  * @license
276
287
  * Copyright 2017 Google LLC
277
288
  * SPDX-License-Identifier: BSD-3-Clause
278
- */class Is extends Vt{constructor(e){if(super(e),this.it=V,e.type!==Bt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===V||e==null)return this._t=void 0,this.it=e;if(e===ue)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Is.directiveName="unsafeHTML",Is.resultType=1;const Qr=Ft(Is);var Bi={exports:{}};(function(s,e){(function(t,i){s.exports=i()})(Cr,function(){function t(o){return o.replace(/\\([(){}[\]#*+\-.!_\\])/g,function(c,l){return String.fromCharCode(1,n.indexOf(l)+r)}).replace(/(\*\*|__|~~)(\S(?:[\s\S]*?\S)?)\1/g,function(c,l,h){return l==="~~"?"<del>"+h+"</del>":"<b>"+h+"</b>"}).replace(/(\n|^|\W)([_\*])(\S(?:[\s\S]*?\S)?)\2(\W|$|\n)/g,function(c,l,h,m,d){return l+"<i>"+m+"</i>"+d}).replace(/(!?)\[([^\]<>]+)\]\((\+?)([^ \)<>]+)(?: "([^\(\)\"]+)")?\)/g,function(c,l,h,m,d,b){var N=b?' title="'+b+'"':"";return l?'<img src="'+a.href(d)+'" alt="'+h+'"'+N+"/>":(m&&(N+=' target="_blank"'),'<a href="'+a.href(d)+'"'+N+">"+h+"</a>")})}function i(o){return o.replace(/\x01([\x0f-\x1c])/g,function(c,l){return n.charAt(l.charCodeAt(0)-r)})}var n="\\[!]#{()}*+-._",r=16,a=function(o){return o.replace(/.+(?:\n.+)*/g,function(c){var l=/^\s{4}([^]*)$/.exec(c);if(l)return"<pre><code>"+l[1].replace(/\n /g,`
289
+ */class Ms extends Jt{constructor(e){if(super(e),this.it=V,e.type!==Wt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===V||e==null)return this._t=void 0,this.it=e;if(e===ue)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Ms.directiveName="unsafeHTML",Ms.resultType=1;const Qr=Kt(Ms);var Bi={exports:{}};(function(s,e){(function(t,i){s.exports=i()})(Cr,function(){function t(o){return o.replace(/\\([(){}[\]#*+\-.!_\\])/g,function(c,l){return String.fromCharCode(1,n.indexOf(l)+r)}).replace(/(\*\*|__|~~)(\S(?:[\s\S]*?\S)?)\1/g,function(c,l,h){return l==="~~"?"<del>"+h+"</del>":"<b>"+h+"</b>"}).replace(/(\n|^|\W)([_\*])(\S(?:[\s\S]*?\S)?)\2(\W|$|\n)/g,function(c,l,h,m,d){return l+"<i>"+m+"</i>"+d}).replace(/(!?)\[([^\]<>]+)\]\((\+?)([^ \)<>]+)(?: "([^\(\)\"]+)")?\)/g,function(c,l,h,m,d,b){var N=b?' title="'+b+'"':"";return l?'<img src="'+a.href(d)+'" alt="'+h+'"'+N+"/>":(m&&(N+=' target="_blank"'),'<a href="'+a.href(d)+'"'+N+">"+h+"</a>")})}function i(o){return o.replace(/\x01([\x0f-\x1c])/g,function(c,l){return n.charAt(l.charCodeAt(0)-r)})}var n="\\[!]#{()}*+-._",r=16,a=function(o){return o.replace(/.+(?:\n.+)*/g,function(c){var l=/^\s{4}([^]*)$/.exec(c);if(l)return"<pre><code>"+l[1].replace(/\n /g,`
279
290
  `)+"</code></pre>";for(var h,m=[],d=t(c).split(`
280
291
  `),b=0,N=d.length;N>b;++b){var H=d[b],ee=/^\s{0,3}(\#{1,6})\s+(.*?)\s*#*\s*$/.exec(H);if(ee)m.push(h=[ee[2],"h",ee[1].length]);else{var _e=/^(\s*)(?:[-*]|(\d[.)])) (.+)$/.exec(H);_e?m.push(h=[_e[3],_e[2]?"ol":"ul",_e[1].length]):/^\s{0,3}([-])(\s*\1){2,}\s*$/.test(H)?m.push(h=["","hr"]):h&&h[1]!=="hr"&&h[1]!=="h"?h[0]+=`
281
- `+H:m.push(h=[H,"p",""])}}var xe="",te=[];for(b=0,N=m.length;N>b;++b){h=m[b];var ut=h[0],ke=h[1],O=h[2];if(ke==="ul"||ke==="ol")!te.length||O>te[0][1]?(te.unshift([ke,O]),xe+="<"+te[0][0]+"><li>"+ut):te.length>1&&O<=te[1][1]?(xe+="</li></"+te.shift()[0]+">",--b):xe+="</li><li>"+ut;else{for(;te.length;)xe+="</li></"+te.shift()[0]+">";xe+=ke==="hr"?"<hr/>":"<"+ke+O+a.headAttrs(O,ut)+">"+ut+"</"+ke+O+">"}}for(;te.length;)xe+="</li></"+te.shift()[0]+">";return i(xe)})};return a.href=function(o){return o},a.headAttrs=function(o,c){return""},a})})(Bi);var ea=Bi.exports;const ta=ji(ea);var sa=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,Fi=(s,e,t,i)=>{for(var n=i>1?void 0:i?ia(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&sa(e,t,n),n};let cs=class extends se{constructor(){super(...arguments),this.content=""}get htmlContent(){return ta(this.content)}render(){return z`
292
+ `+H:m.push(h=[H,"p",""])}}var xe="",te=[];for(b=0,N=m.length;N>b;++b){h=m[b];var mt=h[0],ke=h[1],O=h[2];if(ke==="ul"||ke==="ol")!te.length||O>te[0][1]?(te.unshift([ke,O]),xe+="<"+te[0][0]+"><li>"+mt):te.length>1&&O<=te[1][1]?(xe+="</li></"+te.shift()[0]+">",--b):xe+="</li><li>"+mt;else{for(;te.length;)xe+="</li></"+te.shift()[0]+">";xe+=ke==="hr"?"<hr/>":"<"+ke+O+a.headAttrs(O,mt)+">"+mt+"</"+ke+O+">"}}for(;te.length;)xe+="</li></"+te.shift()[0]+">";return i(xe)})};return a.href=function(o){return o},a.headAttrs=function(o,c){return""},a})})(Bi);var ea=Bi.exports;const ta=Ri(ea);var sa=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,Fi=(s,e,t,i)=>{for(var n=i>1?void 0:i?ia(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&sa(e,t,n),n};let ls=class extends se{constructor(){super(...arguments),this.content=""}get htmlContent(){return ta(this.content)}render(){return L`
282
293
  <div class="flex items-end mr-20">
283
294
  <div class="message rounded-lg px-4 py-2 flex flex-col gap-3">
284
295
  ${Qr(this.htmlContent)}
285
296
  </div>
286
297
  </div>
287
- `}};cs.styles=[Ee,Qe`
298
+ `}};ls.styles=[Ee,tt`
288
299
  .message {
289
300
  background-color: var(--iai-chat-i-message-assistant-bg);
290
301
  color: var(--iai-chat-i-message-assistant-fg);
@@ -313,55 +324,55 @@
313
324
  ol {
314
325
  list-style-type: decimal;
315
326
  }
316
- `],Fi([J({type:String})],cs.prototype,"content",2),cs=Fi([Ce("iai-chat-message-assistant")],cs);async function na(s,e){const{type:t,params:i}=s,n=e[t];if(!n)throw new Error(`No handler for enhanced content type ${t}`);return n({params:i,html:z})}var ra=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,Zt=(s,e,t,i)=>{for(var n=i>1?void 0:i?aa(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&ra(e,t,n),n};let Je=class extends se{constructor(){super(...arguments),this.content=""}async connectedCallback(){if(super.connectedCallback(),this.enhancedContent)try{this.contentHtmlTemplate=await na(this.enhancedContent,this.options.handlers.enhancedContent);return}catch(s){console.warn("Error processing enhanced content",s)}else this.contentHtmlTemplate||(this.contentHtmlTemplate=z`<p class="text-center text-gray-400 text-sm">${this.content}</p>`)}render(){return z`
327
+ `],Fi([W({type:String})],ls.prototype,"content",2),ls=Fi([Ce("iai-chat-message-assistant")],ls);async function na(s,e){const{type:t,params:i}=s,n=e[t];if(!n)throw new Error(`No handler for enhanced content type ${t}`);return n({params:i,html:L})}var ra=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,zt=(s,e,t,i)=>{for(var n=i>1?void 0:i?aa(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&ra(e,t,n),n};let Ye=class extends se{constructor(){super(...arguments),this.content=""}async connectedCallback(){if(super.connectedCallback(),this.enhancedContent)try{this.contentHtmlTemplate=await na(this.enhancedContent,this.options.handlers.enhancedContent);return}catch(s){console.warn("Error processing enhanced content",s)}else this.contentHtmlTemplate||(this.contentHtmlTemplate=L`<p class="text-center text-gray-400 text-sm">${this.content}</p>`)}render(){return L`
317
328
  <div>
318
329
  ${this.contentHtmlTemplate}
319
330
  </div>
320
- `}};Je.styles=[Ee],Zt([J({type:Object})],Je.prototype,"options",2),Zt([J({type:String})],Je.prototype,"content",2),Zt([J({type:Object})],Je.prototype,"enhancedContent",2),Zt([J()],Je.prototype,"contentHtmlTemplate",2),Je=Zt([Ce("iai-chat-message-system")],Je);var oa=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,Vi=(s,e,t,i)=>{for(var n=i>1?void 0:i?ca(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&oa(e,t,n),n};let ds=class extends se{constructor(){super(...arguments),this.content=""}render(){return z`
331
+ `}};Ye.styles=[Ee],zt([W({type:Object})],Ye.prototype,"options",2),zt([W({type:String})],Ye.prototype,"content",2),zt([W({type:Object})],Ye.prototype,"enhancedContent",2),zt([W()],Ye.prototype,"contentHtmlTemplate",2),Ye=zt([Ce("iai-chat-message-system")],Ye);var oa=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,Vi=(s,e,t,i)=>{for(var n=i>1?void 0:i?ca(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&oa(e,t,n),n};let us=class extends se{constructor(){super(...arguments),this.content=""}render(){return L`
321
332
  <div class="flex items-end justify-end ml-20">
322
333
  <div class="message rounded-lg px-4 py-2 flex gap-2">
323
334
  <p>${this.content}</p>
324
335
  </div>
325
336
  </div>
326
- `}};ds.styles=[Ee,Qe`
337
+ `}};us.styles=[Ee,tt`
327
338
  .message {
328
339
  background-color: var(--iai-chat-i-message-user-bg);
329
340
  color: var(--iai-chat-i-message-user-fg);
330
341
  }
331
- `],Vi([J({type:String})],ds.prototype,"content",2),ds=Vi([Ce("iai-chat-message-user")],ds);var da=Object.defineProperty,la=Object.getOwnPropertyDescriptor,ls=(s,e,t,i)=>{for(var n=i>1?void 0:i?la(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&da(e,t,n),n};let lt=class extends se{constructor(){super(...arguments),this.isChatWindowOpen=!1,this.isCtaOpen=!0}render(){const{openChatButton:{width:s,height:e,imageSrc:t,cta:i},placement:n}=this.options.config,r=vt({alignItems:n!=="left"?"end":"start"}),a=vt({width:s,height:e});return z`
342
+ `],Vi([W({type:String})],us.prototype,"content",2),us=Vi([Ce("iai-chat-message-user")],us);var da=Object.defineProperty,la=Object.getOwnPropertyDescriptor,hs=(s,e,t,i)=>{for(var n=i>1?void 0:i?la(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&da(e,t,n),n};let pt=class extends se{constructor(){super(...arguments),this.isChatWindowOpen=!1,this.isCtaOpen=!0}render(){const{openChatButton:{width:s,height:e,imageSrc:t,cta:i},placement:n}=this.options.config,r=at({alignItems:n!=="left"?"end":"start"}),a=at({width:s,height:e});return L`
332
343
  <div class="flex flex-col gap-4" style=${r}>
333
- ${ct(i&&this.isCtaOpen&&!this.isChatWindowOpen,()=>z`
344
+ ${Ne(i&&this.isCtaOpen&&!this.isChatWindowOpen,()=>L`
334
345
  <div class="relative rounded-lg p-5 shadow-md bg-white" style="max-width: 350px;">
335
346
  <button
336
347
  class="absolute top-0 right-0 w-5 h-5 m-0.5"
337
348
  @click="${()=>this.isCtaOpen=!1}"
338
- >${As}</button>
349
+ >${Lt}</button>
339
350
 
340
351
  <span>${i}</span>
341
352
 
342
353
  <div
343
354
  class="absolute bottom-0 mx-4 mb-[-8px] w-0 h-0 border-x-8 border-t-8 border-x-transparent border-white"
344
- style=${vt({[n]:0})}
355
+ style=${at({[n]:0})}
345
356
  />
346
357
  </div>
347
358
  `)}
348
359
 
349
360
  <button @click="${this.toggleChat}">
350
- ${ct(t,()=>z`<img src="${t}" alt="Chat Icon" style=${a}/>`,()=>z`
361
+ ${Ne(t,()=>L`<img src="${t}" alt="Chat Icon" style=${a}/>`,()=>L`
351
362
  <div class="button rounded-full flex items-center justify-center" style=${a}>
352
363
  <div class="h-3/5 w-3/5">
353
- ${ct(this.isChatWindowOpen,()=>As,()=>Hr)}
364
+ ${Ne(this.isChatWindowOpen,()=>Lt,()=>Hr)}
354
365
  </div>
355
366
  </div>
356
367
  `)}
357
368
  </button>
358
369
  </div>
359
- `}toggleChat(){this.dispatchEvent(new CustomEvent("toggle-chat"))}};lt.styles=[Ee,Qe`
370
+ `}toggleChat(){this.dispatchEvent(new CustomEvent("toggle-chat"))}};pt.styles=[Ee,tt`
360
371
  .button {
361
372
  background-color: var(--iai-chat-i-ocb-bg);
362
373
  color: var(--iai-chat-i-ocb-fg);
363
374
  }
364
- `],ls([J({type:Object})],lt.prototype,"options",2),ls([J({type:Boolean})],lt.prototype,"isChatWindowOpen",2),ls([it()],lt.prototype,"isCtaOpen",2),lt=ls([Ce("iai-chat-open-chat-button")],lt);function ua(s){return s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Wi(s,e=""){return Object.keys(s).reduce((t,i)=>{const n=ua(i),r=e?`${e}-${n}`:n;return typeof s[i]=="object"&&s[i]!==null?Object.assign(t,Wi(s[i],r)):t[r]=s[i],t},{})}class ha{constructor(e){this.widget=null,this.options=is.parse(e);const t=document.createElement("iai-chat-popup");t.options=this.options;const i=Wi(this.options.config.styles);Object.entries(i).forEach(([n,r])=>{t.style.setProperty(`--iai-chat-${n}`,r)}),document.body.appendChild(t),this.widget=t}get api(){if(!this.widget)throw new Error("Widget has not been initialized");return this.widget}destroy(){var e;(e=this.widget)==null||e.remove(),this.widget=null}}var us;(s=>{(e=>{e.TEXT="TEXT"})(s.MessageType||(s.MessageType={})),(e=>{e.DELIVERED="DELIVERED",e.READ="READ",e.FAILED="FAILED"})(s.AcknowledgeType||(s.AcknowledgeType={})),(e=>{e.GENERIC="GENERIC",e.SMS="SMS",e.RCS="RCS",e.FACEBOOK="FACEBOOK",e.TWITTER="TWITTER",e.WHATSAPP="WHATSAPP",e.WECHAT="WECHAT",e.QQMOBILE="QQMOBILE",e.APPLE_BUSINESS_CHAT="APPLE_BUSINESS_CHAT",e.SKYPE="SKYPE",e.SNAPCHAT="SNAPCHAT",e.VIBER="VIBER",e.LINE="LINE",e.TELEGRAM="TELEGRAM",e.KAKAO="KAKAO"})(s.ContentType||(s.ContentType={})),(e=>{e.SYSTEM="SYSTEM",e.USER="USER"})(s.ConversationEventOrigin||(s.ConversationEventOrigin={})),(e=>{e.PENDING="PENDING",e.ACTIVE="ACTIVE",e.TERMINATED="TERMINATED"})(s.ConversationStatus||(s.ConversationStatus={}))})(us||(us={}));function Ki(s){return{all:s=s||new Map,on:function(e,t){var i=s.get(e);i?i.push(t):s.set(e,[t])},off:function(e,t){var i=s.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var i=s.get(e);i&&i.slice().map(function(n){n(t)}),(i=s.get("*"))&&i.slice().map(function(n){n(e,t)})}}}class pa{constructor(e){this.chatWsUrl=e,this._emitter=Ki(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),this.reconnectCodes=new Set([1006]),this.reconnectAttempts=0,this.maxReconnectAttempts=10}connect(){const e=new WebSocket(this.chatWsUrl);e.onopen=async()=>{this.reconnectAttempts=0,e.send(JSON.stringify({type:"ready"}))},e.onmessage=t=>{const i=JSON.parse(t.data);this._emitter.emit(i.type,i.data)},e.onclose=t=>{console.log("Disconnected: ",t.code,t.reason||"No reason provided"),this._emitter.emit("disconnected",t),this.reconnectCodes.has(t.code)&&this.reconnectAttempts<this.maxReconnectAttempts&&(console.log("Reconnecting..."),this._emitter.emit("reconnecting"),this.reconnectAttempts++,setTimeout(()=>this.connect(),this.reconnectAttempts*1e3))},e.onerror=t=>{console.log("Error:",t),this._emitter.emit("error",t)},this.ws=e}reconnect(){this.reconnectAttempts=0,this.connect()}disconnect(){var e;(e=this.ws)==null||e.close()}destroy(){this.disconnect(),this._emitter.all.clear()}}const ma=us.AcknowledgeType,fa="Anyone Home",ga="IB Chat Leasing - Development";let ya="https://five9.ah.inhabit.work";const va="https://five9.ah.inhabit.work".replace("http","ws").replace(/\/$/,""),zt=class zt{constructor(){Ws(this,we,void 0);Ws(this,qe,void 0);this._emitter=Ki(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),je(this,we,null),je(this,qe,null),this.conversationStarted=!1}serialize(){return JSON.stringify({sessionToken:this.sessionToken,conversationId:this.conversationId,conversationStarted:this.conversationStarted})}static deserialize(e){const t=JSON.parse(e),i=new zt;return t.sessionToken&&i.setSession(t.sessionToken),t.conversationId&&i.setConversationId(t.conversationId),i.conversationStarted=t.conversationStarted||!1,i}static generateBaseUrl(e){return`https://${e}/appsvcs/rs/svc`}async createSession(){const e=await fetch(`${zt.generateBaseUrl("app-scl.five9.com")}/auth/anon?cookieless=true`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({tenantName:fa})});return je(this,we,await e.json()),ms(this,we)}setSession(e){je(this,we,e)}setConversationId(e){je(this,qe,e),this.five9WebSocket&&(this.five9WebSocket.destroy(),this.five9WebSocket=void 0,e&&this.connectToWebSocket())}connect(){if(!this.sessionToken)throw new Error("Session not created");if(!this.conversationId)throw new Error("Conversation not started");this.connectToWebSocket()}connectToWebSocket(){if(!this.conversationId)throw new Error("Conversation not started");this.five9WebSocket&&this.five9WebSocket.destroy();const e=new pa(`${va}/conversations/${this.conversationId}/ws`);e.on("*",(t,i)=>{this._emitter.emit(t,i)}),e.on("conversationCreated",t=>{this.conversationStarted=!0,console.log("Conversation Created:",t)}),e.on("conversationAccepted",t=>{console.log("Conversation Accepted:",t)}),e.on("agentJoined",t=>{console.log("Agent Joined:",t)}),e.on("agentTransferredConversation",t=>{console.log("Agent Transferred Conversation:",t)}),e.on("conversationTransferredToGroup",t=>{console.log("Conversation Transferred To Group:",t)}),e.on("agentLeftConversation",t=>{console.log("Agent Left Conversation:",t)}),e.on("agentTyping",t=>{console.log("Agent Typing:",t)}),e.on("message",async t=>{console.log("Message:",t),await this.acknowledgeMessage({messages:[{messageId:t.messageId,type:ma.READ}]})}),e.on("conversationTerminated",t=>{console.log("Conversation Terminated:",t)}),e.on("error",t=>{console.log("Error:",t)}),this.five9WebSocket=e,e.connect()}async authenticatedFetch(e,t={}){const{sessionToken:i}=this;if(!i)throw new Error("Session not found");e=e.startsWith("/")?e:`/${e}`;const n=i.metadata.dataCenters[0].apiUrls[0].host,r=await fetch(`${zt.generateBaseUrl(n)}${e}`,{...t,headers:{...t.headers,"Content-Type":"application/json",Accept:"application/json",Authorization:i.tokenId,farmId:i.context.farmId}});return r.status===204?null:r.json()}async getMetadata(){if(!this.sessionToken)throw new Error("Session not created");return await this.authenticatedFetch("/auth/metadata",{method:"GET"})}async createConversation(e){if(!this.sessionToken)throw new Error("Session not created");const t={...e,campaignName:ga,tenantId:this.tenantId,callbackUrl:ya};console.log("body",t);const i=await this.authenticatedFetch("/conversations",{method:"POST",body:JSON.stringify(t)});return this.setConversationId(i.id),i}async sendMessage(e){const{conversationId:t,conversationStarted:i}=this;if(!t||!i)throw new Error("Conversation not started");const n={messageType:us.MessageType.TEXT,message:e};await this.authenticatedFetch(`/conversations/${t}/messages`,{method:"POST",body:JSON.stringify(n)})}async sendTyping(){const{conversationId:e}=this;if(!e)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${e}/messages/typing`,{method:"PUT"})}async acknowledgeMessage(e){const{conversationId:t}=this;if(!t)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${t}/messages/acknowledge`,{method:"PUT",body:JSON.stringify(e)})}async terminateConversation(){const{conversationId:e}=this;if(!e)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${e}/terminate`,{method:"POST"}),this.destroy()}destroy(){this.five9WebSocket&&this.five9WebSocket.destroy(),je(this,we,null),je(this,qe,null)}get sessionToken(){return ms(this,we)}get conversationId(){return ms(this,qe)}get dataCenter(){var e;return(e=this.sessionToken)==null?void 0:e.metadata.dataCenters[0]}get apiUrl(){var e;return(e=this.dataCenter)==null?void 0:e.apiUrls[0].host}get tenantId(){var e;return(e=this.sessionToken)==null?void 0:e.orgId}get tokenId(){var e;return(e=this.sessionToken)==null?void 0:e.tokenId}get farmId(){var e;return(e=this.sessionToken)==null?void 0:e.context.farmId}};we=new WeakMap,qe=new WeakMap;let hs=zt;function Lt(s){return`any-${s||"main"}-chatSession`}async function ba({id:s,params:e,chatWindow:t,html:i}){t=t;const n=async()=>{t.removeMessage("transferMessageId"),await t.sendFunctionCallResponse(s,{transfer:"Declined"},!0),t.setInputDisabled(!1)},r=async()=>{t.setInputDisabled(!0),t.removeMessage("transferMessageId"),t.addMessage({role:"system",content:"Please wait while we connect you to a live agent"});const a=new hs;await a.createSession();const{summary:o,subject:c,...l}=e;await a.createConversation({contact:l,attributes:{Question:c,"AI Summary":o}}),localStorage.setItem(Lt(t.cleanOptions.config.historyKey),a.serialize()),Ji(t,a)};t.addMessage({id:"transferMessageId",role:"system",contentHtmlTemplate:i`
375
+ `],hs([W({type:Object})],pt.prototype,"options",2),hs([W({type:Boolean})],pt.prototype,"isChatWindowOpen",2),hs([rt()],pt.prototype,"isCtaOpen",2),pt=hs([Ce("iai-chat-open-chat-button")],pt);function ua(s){return s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Wi(s,e=""){return Object.keys(s).reduce((t,i)=>{const n=ua(i),r=e?`${e}-${n}`:n;return typeof s[i]=="object"&&s[i]!==null?Object.assign(t,Wi(s[i],r)):t[r]=s[i],t},{})}class ha{constructor(e){this.widget=null,this.options=as.parse(e);const t=document.createElement("iai-chat-popup");t.options=this.options;const i=Wi(this.options.config.styles);Object.entries(i).forEach(([n,r])=>{t.style.setProperty(`--iai-chat-${n}`,r)}),document.body.appendChild(t),this.widget=t}get api(){if(!this.widget)throw new Error("Widget has not been initialized");return this.widget}destroy(){var e;(e=this.widget)==null||e.remove(),this.widget=null}}var ps;(s=>{(e=>{e.TEXT="TEXT"})(s.MessageType||(s.MessageType={})),(e=>{e.DELIVERED="DELIVERED",e.READ="READ",e.FAILED="FAILED"})(s.AcknowledgeType||(s.AcknowledgeType={})),(e=>{e.GENERIC="GENERIC",e.SMS="SMS",e.RCS="RCS",e.FACEBOOK="FACEBOOK",e.TWITTER="TWITTER",e.WHATSAPP="WHATSAPP",e.WECHAT="WECHAT",e.QQMOBILE="QQMOBILE",e.APPLE_BUSINESS_CHAT="APPLE_BUSINESS_CHAT",e.SKYPE="SKYPE",e.SNAPCHAT="SNAPCHAT",e.VIBER="VIBER",e.LINE="LINE",e.TELEGRAM="TELEGRAM",e.KAKAO="KAKAO"})(s.ContentType||(s.ContentType={})),(e=>{e.SYSTEM="SYSTEM",e.USER="USER"})(s.ConversationEventOrigin||(s.ConversationEventOrigin={})),(e=>{e.PENDING="PENDING",e.ACTIVE="ACTIVE",e.TERMINATED="TERMINATED"})(s.ConversationStatus||(s.ConversationStatus={}))})(ps||(ps={}));function Ki(s){return{all:s=s||new Map,on:function(e,t){var i=s.get(e);i?i.push(t):s.set(e,[t])},off:function(e,t){var i=s.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var i=s.get(e);i&&i.slice().map(function(n){n(t)}),(i=s.get("*"))&&i.slice().map(function(n){n(e,t)})}}}class pa{constructor(e){this.chatWsUrl=e,this._emitter=Ki(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),this.reconnectCodes=new Set([1006]),this.reconnectAttempts=0,this.maxReconnectAttempts=10}connect(){const e=new WebSocket(this.chatWsUrl);e.onopen=async()=>{this.reconnectAttempts=0,e.send(JSON.stringify({type:"ready"}))},e.onmessage=t=>{const i=JSON.parse(t.data);this._emitter.emit(i.type,i.data)},e.onclose=t=>{console.log("Disconnected: ",t.code,t.reason||"No reason provided"),this._emitter.emit("disconnected",t),this.reconnectCodes.has(t.code)&&this.reconnectAttempts<this.maxReconnectAttempts&&(console.log("Reconnecting..."),this._emitter.emit("reconnecting"),this.reconnectAttempts++,setTimeout(()=>this.connect(),this.reconnectAttempts*1e3))},e.onerror=t=>{console.log("Error:",t),this._emitter.emit("error",t)},this.ws=e}reconnect(){this.reconnectAttempts=0,this.connect()}disconnect(){var e;(e=this.ws)==null||e.close()}destroy(){this.disconnect(),this._emitter.all.clear()}}const ma=ps.AcknowledgeType,fa="Anyone Home",ga="IB Chat Leasing - Development";let ya="https://five9.ah.inhabit.work";const va="https://five9.ah.inhabit.work".replace("http","ws").replace(/\/$/,""),Ht=class Ht{constructor(){Ks(this,we,void 0);Ks(this,Ge,void 0);this._emitter=Ki(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),Ze(this,we,null),Ze(this,Ge,null),this.conversationStarted=!1}serialize(){return JSON.stringify({sessionToken:this.sessionToken,conversationId:this.conversationId,conversationStarted:this.conversationStarted})}static deserialize(e){const t=JSON.parse(e),i=new Ht;return t.sessionToken&&i.setSession(t.sessionToken),t.conversationId&&i.setConversationId(t.conversationId),i.conversationStarted=t.conversationStarted||!1,i}static generateBaseUrl(e){return`https://${e}/appsvcs/rs/svc`}async createSession(){const e=await fetch(`${Ht.generateBaseUrl("app-scl.five9.com")}/auth/anon?cookieless=true`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({tenantName:fa})});return Ze(this,we,await e.json()),gs(this,we)}setSession(e){Ze(this,we,e)}setConversationId(e){Ze(this,Ge,e),this.five9WebSocket&&(this.five9WebSocket.destroy(),this.five9WebSocket=void 0,e&&this.connectToWebSocket())}connect(){if(!this.sessionToken)throw new Error("Session not created");if(!this.conversationId)throw new Error("Conversation not started");this.connectToWebSocket()}connectToWebSocket(){if(!this.conversationId)throw new Error("Conversation not started");this.five9WebSocket&&this.five9WebSocket.destroy();const e=new pa(`${va}/conversations/${this.conversationId}/ws`);e.on("*",(t,i)=>{this._emitter.emit(t,i)}),e.on("conversationCreated",t=>{this.conversationStarted=!0,console.log("Conversation Created:",t)}),e.on("conversationAccepted",t=>{console.log("Conversation Accepted:",t)}),e.on("agentJoined",t=>{console.log("Agent Joined:",t)}),e.on("agentTransferredConversation",t=>{console.log("Agent Transferred Conversation:",t)}),e.on("conversationTransferredToGroup",t=>{console.log("Conversation Transferred To Group:",t)}),e.on("agentLeftConversation",t=>{console.log("Agent Left Conversation:",t)}),e.on("agentTyping",t=>{console.log("Agent Typing:",t)}),e.on("message",async t=>{console.log("Message:",t),await this.acknowledgeMessage({messages:[{messageId:t.messageId,type:ma.READ}]})}),e.on("conversationTerminated",t=>{console.log("Conversation Terminated:",t)}),e.on("error",t=>{console.log("Error:",t)}),this.five9WebSocket=e,e.connect()}async authenticatedFetch(e,t={}){const{sessionToken:i}=this;if(!i)throw new Error("Session not found");e=e.startsWith("/")?e:`/${e}`;const n=i.metadata.dataCenters[0].apiUrls[0].host,r=await fetch(`${Ht.generateBaseUrl(n)}${e}`,{...t,headers:{...t.headers,"Content-Type":"application/json",Accept:"application/json",Authorization:i.tokenId,farmId:i.context.farmId}});return r.status===204?null:r.json()}async getMetadata(){if(!this.sessionToken)throw new Error("Session not created");return await this.authenticatedFetch("/auth/metadata",{method:"GET"})}async createConversation(e){if(!this.sessionToken)throw new Error("Session not created");const t={...e,campaignName:ga,tenantId:this.tenantId,callbackUrl:ya};console.log("body",t);const i=await this.authenticatedFetch("/conversations",{method:"POST",body:JSON.stringify(t)});return this.setConversationId(i.id),i}async sendMessage(e){const{conversationId:t,conversationStarted:i}=this;if(!t||!i)throw new Error("Conversation not started");const n={messageType:ps.MessageType.TEXT,message:e};await this.authenticatedFetch(`/conversations/${t}/messages`,{method:"POST",body:JSON.stringify(n)})}async sendTyping(){const{conversationId:e}=this;if(!e)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${e}/messages/typing`,{method:"PUT"})}async acknowledgeMessage(e){const{conversationId:t}=this;if(!t)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${t}/messages/acknowledge`,{method:"PUT",body:JSON.stringify(e)})}async terminateConversation(){const{conversationId:e}=this;if(!e)throw new Error("Conversation not started");await this.authenticatedFetch(`/conversations/${e}/terminate`,{method:"POST"}),this.destroy()}destroy(){this.five9WebSocket&&this.five9WebSocket.destroy(),Ze(this,we,null),Ze(this,Ge,null)}get sessionToken(){return gs(this,we)}get conversationId(){return gs(this,Ge)}get dataCenter(){var e;return(e=this.sessionToken)==null?void 0:e.metadata.dataCenters[0]}get apiUrl(){var e;return(e=this.dataCenter)==null?void 0:e.apiUrls[0].host}get tenantId(){var e;return(e=this.sessionToken)==null?void 0:e.orgId}get tokenId(){var e;return(e=this.sessionToken)==null?void 0:e.tokenId}get farmId(){var e;return(e=this.sessionToken)==null?void 0:e.context.farmId}};we=new WeakMap,Ge=new WeakMap;let ms=Ht;function Ut(s){return`any-${s||"main"}-chatSession`}async function ba({id:s,params:e,chatWindow:t,html:i}){t=t;const n=async()=>{t.removeMessage("transferMessageId"),await t.sendFunctionCallResponse(s,{transfer:"Declined"},!0),t.setInputDisabled(!1)},r=async()=>{t.setInputDisabled(!0),t.removeMessage("transferMessageId"),t.addMessage({role:"system",content:"Please wait while we connect you to a live agent"});const a=new ms;await a.createSession();const{summary:o,subject:c,...l}=e;await a.createConversation({contact:l,attributes:{Question:c,"AI Summary":o}}),localStorage.setItem(Ut(t.cleanOptions.config.historyKey),a.serialize()),Ji(t,a)};t.addMessage({id:"transferMessageId",role:"system",contentHtmlTemplate:i`
365
376
  <style>
366
377
  .btn {
367
378
  background-color: #007bff;
@@ -388,4 +399,4 @@
388
399
  <button class="btn btn-no" @click=${n}>No</button>
389
400
  </div>
390
401
  </div>
391
- `})}function Ji(s,e){e.on("*",(r,a)=>{console.log("event:",r,a)}),e.on("conversationCreated",()=>{s.setInputDisabled(!1),localStorage.setItem(Lt(s.cleanOptions.config.historyKey),e.serialize())}),e.on("conversationAccepted",r=>{s.addMessage({role:"system",content:`${r.displayName} has joined the chat`})}),e.on("agentTyping",()=>{s.setTypingIndicatorVisible(!0)}),e.on("agentJoined",r=>{s.addMessage({role:"system",content:`${r.displayName} has joined the chat`})}),e.on("agentTransferredConversation",r=>{s.addMessage({role:"system",content:`You have been transferred to ${r.toDisplayName}`})}),e.on("conversationTransferredToGroup",r=>{s.addMessage({role:"system",content:`You have been transferred to ${r.groupName}`})}),e.on("agentLeftConversation",r=>{s.addMessage({role:"system",content:`${r.displayName} has left the chat`})}),e.on("conversationTerminated",r=>{s.addMessage({role:"system",content:"The chat has ended"}),s.setInputDisabled(!0),localStorage.removeItem(Lt(s.cleanOptions.config.historyKey))}),e.on("message",r=>{switch(r.from){case"SYSTEM":s.addMessage({role:"system",content:r.text});break;case"USER":s.setTypingIndicatorVisible(!1),s.addMessage({role:"assistant",name:r.displayName,content:r.text});break;default:console.log("unhandled message:",r);break}}),e.connect();const t=async r=>{r.preventDefault(),s.addMessage({role:"user",content:r.detail.message}),await e.sendMessage(r.detail.message)},i=async()=>{console.log("destroyed fired"),e.destroy(),s.removeEventListener("iai-chat-send-user-message",t),s.removeEventListener("iai-chat-reset",n),s.removeEventListener("iai-chat-destroy",i)},n=async()=>{console.log("reset fired"),await e.terminateConversation(),await i(),localStorage.removeItem(Lt(s.cleanOptions.config.historyKey))};s.addEventListener("iai-chat-send-user-message",t),s.addEventListener("iai-chat-reset",n),s.addEventListener("iai-chat-destroy",i)}function wa(s){return async function({id:t,params:i,chatWindow:n}){n.setInputDisabled(!0);const r={...i.guestCardId&&{guestCardId:i.guestCardId},...i.customerFirstName&&{firstName:i.customerFirstName},...i.customerLastName&&{lastName:i.customerLastName},...i.customerEmail&&{email:i.customerEmail},...i.customerPhoneNumber&&{phone:i.customerPhoneNumber}},a=document.createElement("iai-chat-iframe-modal");a.title="Schedule a Tour",a.src=`${s}?${new URLSearchParams(r).toString()}`;const o=()=>{a.remove(),window.removeEventListener("beforeunload",h),n.setInputDisabled(!1)},c=async({detail:m})=>{if(m.type!=="tourScheduled")return;const{tourType:d,tourDate:b,tourTime:N}=m;o(),n.addMessage({role:"system",content:"Your tour has been scheduled!"}),await n.sendFunctionCallResponse(t,{status:"scheduled",tourType:d,tourDate:b,tourTime:N},!0)},l=async()=>{o(),n.addMessage({role:"system",content:"Tour Scheduler Closed"}),await n.sendFunctionCallResponse(t,{status:"canceled"},!0)},h=async()=>{o(),n.addMessage({role:"system",content:"Tour Scheduler Closed"})};a.addEventListener("message-received",c),a.addEventListener("close",l),window.addEventListener("beforeunload",h),document.body.appendChild(a),n.addMessage({role:"system",content:"Tour Scheduler Opened"})}}class _a{constructor(e,t){const i=is.parse({assistantId:"7e59c8c1-a4ff-40f1-9a68-86ea294a4e75",...e});i.handlers.functionCalls.transferToLiveAgent=ba,i.handlers.functionCalls.showScheduleTourWidget=wa(t.schedulerUrl),this.chatWidget=new ha(i);const n=localStorage.getItem(Lt(i.config.historyKey));if(n){const r=hs.deserialize(n);setTimeout(()=>{Ji(this.chatWidget.api.chatWindow,r)},0)}}destroy(){this.chatWidget.destroy()}}F.AnyChatWidget=_a,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
402
+ `})}function Ji(s,e){e.on("*",(r,a)=>{console.log("event:",r,a)}),e.on("conversationCreated",()=>{s.setInputDisabled(!1),localStorage.setItem(Ut(s.cleanOptions.config.historyKey),e.serialize())}),e.on("conversationAccepted",r=>{s.addMessage({role:"system",content:`${r.displayName} has joined the chat`})}),e.on("agentTyping",()=>{s.setTypingIndicatorVisible(!0)}),e.on("agentJoined",r=>{s.addMessage({role:"system",content:`${r.displayName} has joined the chat`})}),e.on("agentTransferredConversation",r=>{s.addMessage({role:"system",content:`You have been transferred to ${r.toDisplayName}`})}),e.on("conversationTransferredToGroup",r=>{s.addMessage({role:"system",content:`You have been transferred to ${r.groupName}`})}),e.on("agentLeftConversation",r=>{s.addMessage({role:"system",content:`${r.displayName} has left the chat`})}),e.on("conversationTerminated",r=>{s.addMessage({role:"system",content:"The chat has ended"}),s.setInputDisabled(!0),localStorage.removeItem(Ut(s.cleanOptions.config.historyKey))}),e.on("message",r=>{switch(r.from){case"SYSTEM":s.addMessage({role:"system",content:r.text});break;case"USER":s.setTypingIndicatorVisible(!1),s.addMessage({role:"assistant",name:r.displayName,content:r.text});break;default:console.log("unhandled message:",r);break}}),e.connect();const t=async r=>{r.preventDefault(),s.addMessage({role:"user",content:r.detail.message}),await e.sendMessage(r.detail.message)},i=async()=>{console.log("destroyed fired"),e.destroy(),s.removeEventListener("iai-chat-send-user-message",t),s.removeEventListener("iai-chat-reset",n),s.removeEventListener("iai-chat-destroy",i)},n=async()=>{console.log("reset fired"),await e.terminateConversation(),await i(),localStorage.removeItem(Ut(s.cleanOptions.config.historyKey))};s.addEventListener("iai-chat-send-user-message",t),s.addEventListener("iai-chat-reset",n),s.addEventListener("iai-chat-destroy",i)}function wa(s){return async function({id:t,params:i,chatWindow:n}){n.setInputDisabled(!0);const r={...i.guestCardId&&{guestCardId:i.guestCardId},...i.customerFirstName&&{firstName:i.customerFirstName},...i.customerLastName&&{lastName:i.customerLastName},...i.customerEmail&&{email:i.customerEmail},...i.customerPhoneNumber&&{phone:i.customerPhoneNumber},...i.desiredMoveInDate&&{moveInDate:i.desiredMoveInDate}},a=document.createElement("iai-chat-iframe-modal");a.title="Schedule a Tour",a.src=`${s}?${new URLSearchParams(r).toString()}`,a.showHeader=!1;const o=()=>{a.remove(),window.removeEventListener("beforeunload",h),n.setInputDisabled(!1)},c=async({detail:m})=>{if(m.type!=="tourScheduled")return;const{tourType:d,tourDate:b,tourTime:N}=m;o(),n.addMessage({role:"system",content:"Your tour has been scheduled!"}),await n.sendFunctionCallResponse(t,{status:"scheduled",tourType:d,tourDate:b,tourTime:N},!0)},l=async()=>{o(),n.addMessage({role:"system",content:"Tour Scheduler Closed"}),await n.sendFunctionCallResponse(t,{status:"canceled"},!0)},h=async()=>{o(),n.addMessage({role:"system",content:"Tour Scheduler Closed"})};a.addEventListener("message-received",c),a.addEventListener("close",l),window.addEventListener("beforeunload",h),document.body.appendChild(a),n.addMessage({role:"system",content:"Tour Scheduler Opened"})}}class _a{constructor(e,t){const i=as.parse({assistantId:"7e59c8c1-a4ff-40f1-9a68-86ea294a4e75",...e});i.handlers.functionCalls.transferToLiveAgent=ba,i.handlers.functionCalls.showScheduleTourWidget=wa(t.schedulerUrl),this.chatWidget=new ha(i);const n=localStorage.getItem(Ut(i.config.historyKey));if(n){const r=ms.deserialize(n);setTimeout(()=>{Ji(this.chatWidget.api.chatWindow,r)},0)}}destroy(){this.chatWidget.destroy()}}F.AnyChatWidget=_a,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});