@iai-lib/any-chat-widget 0.1.0-alpha.33 → 0.1.0-alpha.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/any-chat-widget.es.js +2965 -3007
- package/dist/any-chat-widget.umd.js +95 -123
- package/package.json +3 -3
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
(function(ie,de){typeof exports=="object"&&typeof module<"u"?de(exports):typeof define=="function"&&define.amd?define(["exports"],de):(ie=typeof globalThis<"u"?globalThis:ie||self,de(ie.AnyChatbot={}))})(this,function(ie){"use strict";var
|
|
1
|
+
(function(ie,de){typeof exports=="object"&&typeof module<"u"?de(exports):typeof define=="function"&&define.amd?define(["exports"],de):(ie=typeof globalThis<"u"?globalThis:ie||self,de(ie.AnyChatbot={}))})(this,function(ie){"use strict";var wr=(ie,de,_e)=>{if(!de.has(ie))throw TypeError("Cannot "+_e)};var hs=(ie,de,_e)=>(wr(ie,de,"read from private field"),_e?_e.call(ie):de.get(ie)),Ys=(ie,de,_e)=>{if(de.has(ie))throw TypeError("Cannot add the same private member more than once");de instanceof WeakSet?de.add(ie):de.set(ie,_e)},lt=(ie,de,_e,Y)=>(wr(ie,de,"write to private field"),Y?Y.call(ie,_e):de.set(ie,_e),_e);var Ve,Et;var de=Object.defineProperty,_e=(s,e,t)=>e in s?de(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Y=(s,e,t)=>(_e(s,typeof e!="symbol"?e+"":e,t),t),xr=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Gs=(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)},ps=(s,e,t)=>(xr(s,e,"access private method"),t);/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const An=globalThis,
|
|
5
|
+
*/const An=globalThis,fs=An.ShadowRoot&&(An.ShadyCSS===void 0||An.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ms=Symbol(),Xs=new WeakMap;let ei=class{constructor(s,e,t){if(this._$cssResult$=!0,t!==ms)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(fs&&s===void 0){const t=e!==void 0&&e.length===1;t&&(s=Xs.get(e)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),t&&Xs.set(e,s))}return s}toString(){return this.cssText}};const _r=s=>new ei(typeof s=="string"?s:s+"",void 0,ms),ct=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((n,i,r)=>n+(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.")})(i)+s[r+1],s[0]);return new ei(t,s,ms)},kr=(s,e)=>{if(fs)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=An.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,s.appendChild(n)}},ti=fs?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return _r(t)})(s):s;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is
|
|
9
|
+
*/const{is:$r,defineProperty:Tr,getOwnPropertyDescriptor:Sr,getOwnPropertyNames:Er,getOwnPropertySymbols:Cr,getPrototypeOf:Ar}=Object,Mt=globalThis,ni=Mt.trustedTypes,Or=ni?ni.emptyScript:"",si=Mt.reactiveElementPolyfillSupport,Kt=(s,e)=>s,On={toAttribute(s,e){switch(e){case Boolean:s=s?Or: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}},gs=(s,e)=>!$r(s,e),ii={attribute:!0,type:String,converter:On,reflect:!1,hasChanged:gs};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Mt.litPropertyMetadata??(Mt.litPropertyMetadata=new WeakMap);class Rt 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=ii){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Tr(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=Sr(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get(){return i==null?void 0:i.call(this)},set(a){const o=i==null?void 0:i.call(this);r.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ii}static _$Ei(){if(this.hasOwnProperty(Kt("elementProperties")))return;const e=Ar(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Kt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Kt("properties"))){const t=this.properties,n=[...Er(t),...Cr(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(ti(i))}else e!==void 0&&t.push(ti(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n: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 n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return kr(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 n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const a=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:On).toAttribute(t,i.type);this._$Em=e,a==null?this.removeAttribute(r):this.setAttribute(r,a),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const a=i.getPropertyOptions(r),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)==null?void 0:n.fromAttribute)!==void 0?a.converter:On;this._$Em=r,this[r]=o.fromAttribute(t,a.type),this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){if(n??(n=this.constructor.getPropertyOptions(e)),!(n.hasChanged??gs)(this[e],t))return;this.P(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),n.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 i=this.constructor.elementProperties;if(i.size>0)for(const[r,a]of i)a.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],a)}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$EO)==null||e.forEach(i=>{var r;return(r=i.hostUpdate)==null?void 0:r.call(i)}),this.update(n)):this._$EU()}catch(i){throw t=!1,this._$EU(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),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){}}Rt.elementStyles=[],Rt.shadowRootOptions={mode:"open"},Rt[Kt("elementProperties")]=new Map,Rt[Kt("finalized")]=new Map,si==null||si({ReactiveElement:Rt}),(Mt.reactiveElementVersions??(Mt.reactiveElementVersions=[])).push("2.0.4");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const In=globalThis,Mn=In.trustedTypes,ri=Mn?Mn.createPolicy("lit-html",{createHTML:s=>s}):void 0,
|
|
14
|
-
\f\r]`,Qt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,li=/-->/g,ci=/>/g,ut=RegExp(`>|${
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),di=/'/g,ui=/"/g,hi=/^(?:script|style|textarea|title)$/i,
|
|
13
|
+
*/const In=globalThis,Mn=In.trustedTypes,ri=Mn?Mn.createPolicy("lit-html",{createHTML:s=>s}):void 0,ys="$lit$",Le=`lit$${(Math.random()+"").slice(9)}$`,vs="?"+Le,Ir=`<${vs}>`,dt=document,qt=()=>dt.createComment(""),Jt=s=>s===null||typeof s!="object"&&typeof s!="function",ai=Array.isArray,oi=s=>ai(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",bs=`[
|
|
14
|
+
\f\r]`,Qt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,li=/-->/g,ci=/>/g,ut=RegExp(`>|${bs}(?:([^\\s"'>=/]+)(${bs}*=${bs}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),di=/'/g,ui=/"/g,hi=/^(?:script|style|textarea|title)$/i,Mr=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),H=Mr(1),Ie=Symbol.for("lit-noChange"),re=Symbol.for("lit-nothing"),pi=new WeakMap,ht=dt.createTreeWalker(dt,129);function fi(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ri!==void 0?ri.createHTML(e):e}const mi=(s,e)=>{const t=s.length-1,n=[];let i,r=e===2?"<svg>":"",a=Qt;for(let o=0;o<t;o++){const l=s[o];let d,u,p=-1,c=0;for(;c<l.length&&(a.lastIndex=c,u=a.exec(l),u!==null);)c=a.lastIndex,a===Qt?u[1]==="!--"?a=li:u[1]!==void 0?a=ci:u[2]!==void 0?(hi.test(u[2])&&(i=RegExp("</"+u[2],"g")),a=ut):u[3]!==void 0&&(a=ut):a===ut?u[0]===">"?(a=i??Qt,p=-1):u[1]===void 0?p=-2:(p=a.lastIndex-u[2].length,d=u[1],a=u[3]===void 0?ut:u[3]==='"'?ui:di):a===ui||a===di?a=ut:a===li||a===ci?a=Qt:(a=ut,i=void 0);const m=a===ut&&s[o+1].startsWith("/>")?" ":"";r+=a===Qt?l+Ir:p>=0?(n.push(d),l.slice(0,p)+ys+l.slice(p)+Le+m):l+Le+(p===-2?o:m)}return[fi(s,r+(s[t]||"<?>")+(e===2?"</svg>":"")),n]};class Yt{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,a=0;const o=e.length-1,l=this.parts,[d,u]=mi(e,t);if(this.el=Yt.createElement(d,n),ht.currentNode=this.el.content,t===2){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=ht.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(ys)){const c=u[a++],m=i.getAttribute(p).split(Le),R=/([.?@])?(.*)/.exec(c);l.push({type:1,index:r,name:R[2],strings:m,ctor:R[1]==="."?yi:R[1]==="?"?vi:R[1]==="@"?bi:Gt}),i.removeAttribute(p)}else p.startsWith(Le)&&(l.push({type:6,index:r}),i.removeAttribute(p));if(hi.test(i.tagName)){const p=i.textContent.split(Le),c=p.length-1;if(c>0){i.textContent=Mn?Mn.emptyScript:"";for(let m=0;m<c;m++)i.append(p[m],qt()),ht.nextNode(),l.push({type:2,index:++r});i.append(p[c],qt())}}}else if(i.nodeType===8)if(i.data===vs)l.push({type:2,index:r});else{let p=-1;for(;(p=i.data.indexOf(Le,p+1))!==-1;)l.push({type:7,index:r}),p+=Le.length-1}r++}}static createElement(e,t){const n=dt.createElement("template");return n.innerHTML=e,n}}function pt(s,e,t=s,n){var i,r;if(e===Ie)return e;let a=n!==void 0?(i=t._$Co)==null?void 0:i[n]:t._$Cl;const o=Jt(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,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=a:t._$Cl=a),a!==void 0&&(e=pt(s,a._$AS(s,e.values),a,n)),e}class gi{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:n}=this._$AD,i=((e==null?void 0:e.creationScope)??dt).importNode(t,!0);ht.currentNode=i;let r=ht.nextNode(),a=0,o=0,l=n[0];for(;l!==void 0;){if(a===l.index){let d;l.type===2?d=new Pt(r,r.nextSibling,this,e):l.type===1?d=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(d=new wi(r,this,e)),this._$AV.push(d),l=n[++o]}a!==(l==null?void 0:l.index)&&(r=ht.nextNode(),a++)}return ht.currentNode=dt,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Pt{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=re,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.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=pt(this,e,t),Jt(e)?e===re||e==null||e===""?(this._$AH!==re&&this._$AR(),this._$AH=re):e!==this._$AH&&e!==Ie&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):oi(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!==re&&Jt(this._$AH)?this._$AA.nextSibling.data=e:this.T(dt.createTextNode(e)),this._$AH=e}$(e){var t;const{values:n,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Yt.createElement(fi(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(n);else{const a=new gi(r,this),o=a.u(this.options);a.p(n),this.T(o),this._$AH=a}}_$AC(e){let t=pi.get(e.strings);return t===void 0&&pi.set(e.strings,t=new Yt(e)),t}k(e){ai(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new Pt(this.S(qt()),this.S(qt()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class Gt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=re,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=re}_$AI(e,t=this,n,i){const r=this.strings;let a=!1;if(r===void 0)e=pt(this,e,t,0),a=!Jt(e)||e!==this._$AH&&e!==Ie,a&&(this._$AH=e);else{const o=e;let l,d;for(e=r[0],l=0;l<r.length-1;l++)d=pt(this,o[n+l],t,l),d===Ie&&(d=this._$AH[l]),a||(a=!Jt(d)||d!==this._$AH[l]),d===re?e=re:e!==re&&(e+=(d??"")+r[l+1]),this._$AH[l]=d}a&&!i&&this.j(e)}j(e){e===re?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class yi extends Gt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===re?void 0:e}}class vi extends Gt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==re)}}class bi extends Gt{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=pt(this,e,t,0)??re)===Ie)return;const n=this._$AH,i=e===re&&n!==re||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==re&&(n===re||i);i&&this.element.removeEventListener(this.name,this,n),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 wi{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){pt(this,e)}}const Rr={P:ys,A:Le,C:vs,M:1,L:mi,R:gi,D:oi,V:pt,I:Pt,H:Gt,N:vi,U:bi,B:yi,F:wi},xi=In.litHtmlPolyfillSupport;xi==null||xi(Yt,Pt),(In.litHtmlVersions??(In.litHtmlVersions=[])).push("3.1.2");const Pr=(s,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const r=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new Pt(e.insertBefore(qt(),r),r,void 0,t??{})}return i._$AI(s),i};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/let
|
|
19
|
+
*/let we=class extends Rt{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=Pr(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 Ie}};var _i;we._$litElement$=!0,we.finalized=!0,(_i=globalThis.litElementHydrateSupport)==null||_i.call(globalThis,{LitElement:we});const ki=globalThis.litElementPolyfillSupport;ki==null||ki({LitElement:we}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const Ue=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const jr={attribute:!0,type:String,converter:On,reflect:!1,hasChanged:gs},Nr=(s=jr,e,t)=>{const{kind:n,metadata:i}=t;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(t.name,s),n==="accessor"){const{name:a}=t;return{set(o){const l=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,l,s)},init(o){return o!==void 0&&this.P(a,void 0,s),o}}}if(n==="setter"){const{name:a}=t;return function(o){const l=this[a];e.call(this,o),this.requestUpdate(a,l,s)}}throw Error("Unsupported decorator location: "+n)};function ne(s){return(e,t)=>typeof t=="object"?Nr(s,e,t):((n,i,r)=>{const a=i.hasOwnProperty(r);return i.constructor.createProperty(r,a?{...n,wrapped:!0}:n),a?Object.getOwnPropertyDescriptor(i,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 ft(s){return
|
|
31
|
+
*/function ft(s){return ne({...s,state:!0,attribute:!1})}/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2017 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
* @license
|
|
45
45
|
* Copyright 2020 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
-
*/const{I:
|
|
47
|
+
*/const{I:zr}=Rr,Ti=()=>document.createComment(""),Xt=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const a=i.insertBefore(Ti(),r),o=i.insertBefore(Ti(),r);t=new zr(a,o,s,s.options)}else{const a=t._$AB.nextSibling,o=t._$AM,l=o!==s;if(l){let d;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(d=s._$AU)!==o._$AU&&t._$AP(d)}if(a!==r||l){let d=t._$AA;for(;d!==a;){const u=d.nextSibling;i.insertBefore(d,r),d=u}}}return t},mt=(s,e,t=s)=>(s._$AI(e,t),s),Dr={},Zr=(s,e=Dr)=>s._$AH=e,Lr=s=>s._$AH,ws=s=>{var e;(e=s._$AP)==null||e.call(s,!1,!0);let t=s._$AA;const n=s._$AB.nextSibling;for(;t!==n;){const i=t.nextSibling;t.remove(),t=i}};/**
|
|
48
48
|
* @license
|
|
49
49
|
* Copyright 2017 Google LLC
|
|
50
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
|
-
*/const Si=(s,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(s[i],i);return n},Ei=jn(class extends Nn{constructor(s){if(super(s),s.type!==Pn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],r=[];let a=0;for(const o of s)i[a]=n?n(o,a):a,r[a]=t(o,a),a++;return{values:r,keys:i}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,n]){const i=Ur(s),{values:r,keys:a}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=a,r;const o=this.ut??(this.ut=[]),l=[];let d,u,p=0,c=i.length-1,m=0,R=r.length-1;for(;p<=c&&m<=R;)if(i[p]===null)p++;else if(i[c]===null)c--;else if(o[p]===a[m])l[m]=mt(i[p],r[m]),p++,m++;else if(o[c]===a[R])l[R]=mt(i[c],r[R]),c--,R--;else if(o[p]===a[R])l[R]=mt(i[p],r[R]),Xt(s,l[R+1],i[p]),p++,R--;else if(o[c]===a[m])l[m]=mt(i[c],r[m]),Xt(s,i[p],i[c]),c--,m++;else if(d===void 0&&(d=Si(a,m,R),u=Si(o,p,c)),d.has(o[p]))if(d.has(o[c])){const F=u.get(a[m]),ae=F!==void 0?i[F]:null;if(ae===null){const De=Xt(s,i[p]);mt(De,r[m]),l[m]=De}else l[m]=mt(ae,r[m]),Xt(s,i[p],ae),i[F]=null;m++}else xs(i[c]),c--;else xs(i[p]),p++;for(;m<=R;){const F=Xt(s,l[R+1]);mt(F,r[m]),l[m++]=F}for(;p<=c;){const F=i[p++];F!==null&&xs(F)}return this.ut=a,Lr(s,l),Ie}}),Re=Ge`*,: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: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-8{bottom:2rem}.bottom-\\[-1px\\]{bottom:-1px}.left-0{left:0}.left-8{left:2rem}.right-0{right:0}.right-8{right:2rem}.top-0{top:0}.top-12{top:3rem}.z-10{z-index:10}.z-50{z-index:50}.m-0{margin:0}.m-0\\.5{margin:.125rem}.m-2{margin:.5rem}.m-4{margin:1rem}.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}.inline-block{display:inline-block}.flex{display:flex}.hidden{display:none}.h-0{height:0px}.h-12{height:3rem}.h-2{height:.5rem}.h-2\\.5{height:.625rem}.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-20{max-height:5rem}.max-h-\\[90vh\\]{max-height:90vh}.w-0{width:0px}.w-2{width:.5rem}.w-2\\.5{width:.625rem}.w-3\\/5{width:60%}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-9{width:2.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}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize{resize:both}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness: mandatory}.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-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-b-lg{border-bottom-right-radius:.5rem;border-bottom-left-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-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity))}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / 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}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.p-0{padding:0}.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-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.text-right{text-align:right}.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-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.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;text-align:left;--iai-chat-i-primary-color: var(--iai-chat-primary-color, #0B64F4);--iai-chat-i-text-color: var(--iai-chat-text-color, #FFF);--iai-chat-i-link-color: var(--iai-chat-link-color, var(--iai-chat-i-primary-color));--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))}.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}}`;var Hr=Object.defineProperty,Br=Object.getOwnPropertyDescriptor,zn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Br(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Hr(e,t,i),i};let jt=class extends be{constructor(){super(...arguments),this.activeIndex=0,this.items=[]}render(){return H`
|
|
51
|
+
*/const Si=(s,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(s[i],i);return n},Ei=jn(class extends Nn{constructor(s){if(super(s),s.type!==Pn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],r=[];let a=0;for(const o of s)i[a]=n?n(o,a):a,r[a]=t(o,a),a++;return{values:r,keys:i}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,n]){const i=Lr(s),{values:r,keys:a}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=a,r;const o=this.ut??(this.ut=[]),l=[];let d,u,p=0,c=i.length-1,m=0,R=r.length-1;for(;p<=c&&m<=R;)if(i[p]===null)p++;else if(i[c]===null)c--;else if(o[p]===a[m])l[m]=mt(i[p],r[m]),p++,m++;else if(o[c]===a[R])l[R]=mt(i[c],r[R]),c--,R--;else if(o[p]===a[R])l[R]=mt(i[p],r[R]),Xt(s,l[R+1],i[p]),p++,R--;else if(o[c]===a[m])l[m]=mt(i[c],r[m]),Xt(s,i[p],i[c]),c--,m++;else if(d===void 0&&(d=Si(a,m,R),u=Si(o,p,c)),d.has(o[p]))if(d.has(o[c])){const F=u.get(a[m]),ae=F!==void 0?i[F]:null;if(ae===null){const Ne=Xt(s,i[p]);mt(Ne,r[m]),l[m]=Ne}else l[m]=mt(ae,r[m]),Xt(s,i[p],ae),i[F]=null;m++}else ws(i[c]),c--;else ws(i[p]),p++;for(;m<=R;){const F=Xt(s,l[R+1]);mt(F,r[m]),l[m++]=F}for(;p<=c;){const F=i[p++];F!==null&&ws(F)}return this.ut=a,Zr(s,l),Ie}}),He=ct`*,: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: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-8{bottom:2rem}.bottom-\\[-1px\\]{bottom:-1px}.left-0{left:0}.left-8{left:2rem}.right-0{right:0}.right-8{right:2rem}.top-0{top:0}.top-12{top:3rem}.z-10{z-index:10}.z-50{z-index:50}.m-0{margin:0}.m-0\\.5{margin:.125rem}.m-2{margin:.5rem}.m-4{margin:1rem}.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}.inline-block{display:inline-block}.flex{display:flex}.hidden{display:none}.h-0{height:0px}.h-12{height:3rem}.h-2{height:.5rem}.h-2\\.5{height:.625rem}.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-20{max-height:5rem}.max-h-\\[90vh\\]{max-height:90vh}.w-0{width:0px}.w-2{width:.5rem}.w-2\\.5{width:.625rem}.w-3\\/5{width:60%}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-9{width:2.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}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize{resize:both}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness: mandatory}.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-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-b-lg{border-bottom-right-radius:.5rem;border-bottom-left-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-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity))}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / 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}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.p-0{padding:0}.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-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.text-right{text-align:right}.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-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.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;text-align:left;--iai-chat-i-primary-color: var(--iai-chat-primary-color, #0B64F4);--iai-chat-i-text-color: var(--iai-chat-text-color, #FFF);--iai-chat-i-link-color: var(--iai-chat-link-color, var(--iai-chat-i-primary-color));--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))}h1{font-size:1.5em}h2{font-size:1.17em}h3{font-size:1em}ol,ul{display:flex;flex-direction:column;padding:0;margin-left:20px;gap:8px}ol{list-style-type:decimal}a{color:var(--iai-chat-i-link-color)}.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}}`;var Ur=Object.defineProperty,Hr=Object.getOwnPropertyDescriptor,zn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Hr(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ur(e,t,i),i};let jt=class extends we{constructor(){super(...arguments),this.activeIndex=0,this.items=[]}render(){return H`
|
|
52
52
|
<div>
|
|
53
53
|
<div
|
|
54
54
|
id="carousel"
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
</button>
|
|
97
97
|
</div>
|
|
98
98
|
</div>
|
|
99
|
-
`}onSlotChange(s){const e=s.target;this.items=(e==null?void 0:e.assignedElements())||[]}onScroll(){const{carousel:s}=this;if(!s)return;let e=0,t=1/0;this.items.forEach((n,i)=>{const r=Math.abs(n.offsetLeft-s.scrollLeft);r<t&&(t=r,e=i)}),this.activeIndex=e}scrollCarousel(s){this.scrollToIndex(this.activeIndex+s)}scrollToIndex(s){s!==this.activeIndex&&(this.activeIndex=Math.max(0,Math.min(s,this.items.length-1)),this.scrollToActiveItem())}scrollToActiveItem(){const{carousel:s,items:e,activeIndex:t}=this;if(!s)return;const n=e[t];n&&s.scrollTo({left:n.offsetLeft-s.clientWidth/2+n.clientWidth/2,behavior:"smooth"})}};jt.styles=[
|
|
99
|
+
`}onSlotChange(s){const e=s.target;this.items=(e==null?void 0:e.assignedElements())||[]}onScroll(){const{carousel:s}=this;if(!s)return;let e=0,t=1/0;this.items.forEach((n,i)=>{const r=Math.abs(n.offsetLeft-s.scrollLeft);r<t&&(t=r,e=i)}),this.activeIndex=e}scrollCarousel(s){this.scrollToIndex(this.activeIndex+s)}scrollToIndex(s){s!==this.activeIndex&&(this.activeIndex=Math.max(0,Math.min(s,this.items.length-1)),this.scrollToActiveItem())}scrollToActiveItem(){const{carousel:s,items:e,activeIndex:t}=this;if(!s)return;const n=e[t];n&&s.scrollTo({left:n.offsetLeft-s.clientWidth/2+n.clientWidth/2,behavior:"smooth"})}};jt.styles=[He,ct`
|
|
100
100
|
::slotted(div) {
|
|
101
101
|
flex: 0 0 auto;
|
|
102
102
|
scroll-snap-align: start;
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
border-radius: 0.25rem;
|
|
108
108
|
margin-right: 1rem;
|
|
109
109
|
}
|
|
110
|
-
`],zn([
|
|
110
|
+
`],zn([ne({type:Number})],jt.prototype,"activeIndex",2),zn([ne({type:Array})],jt.prototype,"items",2),zn([Rn("#carousel")],jt.prototype,"carousel",2),jt=zn([Ue("iai-chat-carousel")],jt);function Br(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 xs=!1;if(typeof window<"u"){var Ci={get passive(){xs=!0}};window.addEventListener("testPassive",null,Ci),window.removeEventListener("testPassive",null,Ci)}var Dn=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1),gt=[],Zn=!1,Ai=-1,en=void 0,yt=void 0,tn=void 0,Oi=function(s){return gt.some(function(e){return!!(e.options.allowTouchMove&&e.options.allowTouchMove(s))})},_s=function(s){var e=s||window.event;return Oi(e.target)||e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)},Wr=function(s){if(tn===void 0){var e=!!s&&s.reserveScrollBarGap===!0,t=window.innerWidth-document.documentElement.clientWidth;if(e&&t>0){var n=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);tn=document.body.style.paddingRight,document.body.style.paddingRight=n+t+"px"}}en===void 0&&(en=document.body.style.overflow,document.body.style.overflow="hidden")},Fr=function(){tn!==void 0&&(document.body.style.paddingRight=tn,tn=void 0),en!==void 0&&(document.body.style.overflow=en,en=void 0)},Vr=function(){return window.requestAnimationFrame(function(){if(yt===void 0){yt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left};var s=window,e=s.scrollY,t=s.scrollX,n=s.innerHeight;document.body.style.position="fixed",document.body.style.top=-e,document.body.style.left=-t,setTimeout(function(){return window.requestAnimationFrame(function(){var i=n-window.innerHeight;i&&e>=n&&(document.body.style.top=-(e+i))})},300)}})},Kr=function(){if(yt!==void 0){var s=-parseInt(document.body.style.top,10),e=-parseInt(document.body.style.left,10);document.body.style.position=yt.position,document.body.style.top=yt.top,document.body.style.left=yt.left,window.scrollTo(e,s),yt=void 0}},qr=function(s){return s?s.scrollHeight-s.scrollTop<=s.clientHeight:!1},Jr=function(s,e){var t=s.targetTouches[0].clientY-Ai;return Oi(s.target)?!1:e&&e.scrollTop===0&&t>0||qr(e)&&t<0?_s(s):(s.stopPropagation(),!0)},Qr=function(s,e){if(!s){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!gt.some(function(n){return n.targetElement===s})){var t={targetElement:s,options:e||{}};gt=[].concat(Br(gt),[t]),Dn?Vr():Wr(e),Dn&&(s.ontouchstart=function(n){n.targetTouches.length===1&&(Ai=n.targetTouches[0].clientY)},s.ontouchmove=function(n){n.targetTouches.length===1&&Jr(n,s)},Zn||(document.addEventListener("touchmove",_s,xs?{passive:!1}:void 0),Zn=!0))}},Ii=function(s){if(!s){console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");return}gt=gt.filter(function(e){return e.targetElement!==s}),Dn&&(s.ontouchstart=null,s.ontouchmove=null,Zn&>.length===0&&(document.removeEventListener("touchmove",_s,xs?{passive:!1}:void 0),Zn=!1)),Dn?Kr():Fr()};/**
|
|
111
111
|
* @license
|
|
112
112
|
* Copyright 2018 Google LLC
|
|
113
113
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
* @license
|
|
116
116
|
* Copyright 2018 Google LLC
|
|
117
117
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
118
|
-
*/const Ri="important",Gr=" !"+Ri,vt=jn(class extends Nn{constructor(s){var e;if(super(s),s.type!==Pn.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 n=s[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}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 n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const r=typeof i=="string"&&i.endsWith(Gr);n.includes("-")||r?t.setProperty(n,r?i.slice(0,-11):i,r?Ri:""):t[n]=i}}return Ie}});var Xr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pi(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,l,d,u){var p={timer:void 0,lastArgs:[]},c=function(){for(var m=this,R=[],F=0;F<arguments.length;F++)R[F]=arguments[F];p.lastArgs=R,p.timer?clearTimeout(p.timer):l&&d.apply(this,p.lastArgs),p.timer=setTimeout(function(){l||d.apply(m,p.lastArgs),p.timer=void 0},o)};return u&&(c=c.bind(u)),c.options=p,c}function n(o,l,d,u){var p;Object.defineProperty(d,u,{configurable:!0,enumerable:!1,get:function(){return p},set:function(c){p=t(o,l,c,this)}})}function i(o,l,d){var u=d.value;return d.value=t(o,l,u),d}function r(o,l){for(var d=[],u=2;u<arguments.length;u++)d[u-2]=arguments[u];if(d.length===0)throw new Error("function applied debounce decorator should be a method");if(d.length===1)throw new Error("method applied debounce decorator should have valid name");var p=d[0],c=d[1],m=d.length===3&&d[2]?d[2]:Object.getOwnPropertyDescriptor(p,c);if(m)return i(o,l,m);n(o,l,p,c)}function a(){for(var o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];var d=500,u=!1;if(o.length&&(typeof o[0]=="number"||typeof o[0]=="object"&&o[0].leading!==void 0)){typeof o[0]=="number"&&(d=o[0]);var p=void 0;return typeof o[0]=="object"&&o[0].leading!==void 0&&(p=o[0]),1<o.length&&typeof o[1]=="object"&&o[1].leading!==void 0&&(p=o[1]),p&&(u=p.leading),function(){for(var c=[],m=0;m<arguments.length;m++)c[m]=arguments[m];return r.apply(void 0,[d,u].concat(c))}}return r.apply(void 0,[d,u].concat(o))}Object.defineProperty(s,"__esModule",{value:!0}),s.cancel=e,s.debounce=a})($s);var B;(function(s){s.assertEqual=i=>i;function e(i){}s.assertIs=e;function t(i){throw new Error}s.assertNever=t,s.arrayToEnum=i=>{const r={};for(const a of i)r[a]=a;return r},s.getValidEnumValues=i=>{const r=s.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of r)a[o]=i[o];return s.objectValues(a)},s.objectValues=i=>s.objectKeys(i).map(function(r){return i[r]}),s.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const r=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&r.push(a);return r},s.find=(i,r)=>{for(const a of i)if(r(a))return a},s.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,r=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}s.joinValues=n,s.jsonStringifyReplacer=(i,r)=>typeof r=="bigint"?r.toString():r})(B||(B={}));var Ts;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Ts||(Ts={}));const y=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xe=s=>{switch(typeof s){case"undefined":return y.undefined;case"string":return y.string;case"number":return isNaN(s)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(s)?y.array:s===null?y.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?y.promise:typeof Map<"u"&&s instanceof Map?y.map:typeof Set<"u"&&s instanceof Set?y.set:typeof Date<"u"&&s instanceof Date?y.date:y.object;default:return y.unknown}},f=B.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"]),ea=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class Te extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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},n={_errors:[]},i=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let o=n,l=0;for(;l<a.path.length;){const d=a.path[l];l===a.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(a))):o[d]=o[d]||{_errors:[]},o=o[d],l++}}};return i(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Te.create=s=>new Te(s);const nn=(s,e)=>{let t;switch(s.code){case f.invalid_type:s.received===y.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,B.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${B.joinValues(s.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${B.joinValues(s.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${B.joinValues(s.options)}, received '${s.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.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}"`:B.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case f.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 f.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 f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,B.assertNever(s)}return{message:t}};let ji=nn;function ta(s){ji=s}function Ln(){return ji}const Un=s=>{const{data:e,path:t,errorMaps:n,issueData:i}=s,r=[...t,...i.path||[]],a={...i,path:r};let o="";const l=n.filter(d=>!!d).slice().reverse();for(const d of l)o=d(a,{data:e,defaultError:o}).message;return{...i,path:r,message:i.message||o}},na=[];function b(s,e){const t=Un({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ln(),nn].filter(n=>!!n)});s.common.issues.push(t)}class pe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if(i.status==="aborted")return j;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t)n.push({key:await i.key,value:await i.value});return pe.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:r,value:a}=i;if(r.status==="aborted"||a.status==="aborted")return j;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[r.value]=a.value)}return{status:e.value,value:n}}}const j=Object.freeze({status:"aborted"}),Ni=s=>({status:"dirty",value:s}),ge=s=>({status:"valid",value:s}),Ss=s=>s.status==="aborted",Es=s=>s.status==="dirty",sn=s=>s.status==="valid",Hn=s=>typeof Promise<"u"&&s instanceof Promise;var T;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(T||(T={}));class Pe{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}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 zi=(s,e)=>{if(sn(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 Te(s.common.issues);return this._error=t,this._error}}};function N(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:i}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(r,a)=>r.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:n??a.defaultError}:{message:t??a.defaultError},description:i}}class Z{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 Xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pe,ctx:{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Hn(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},r=this._parseSync({data:e,path:i.path,parent:i});return zi(i,r)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},i=this._parse({data:e,path:n.path,parent:n}),r=await(Hn(i)?i:Promise.resolve(i));return zi(n,r)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,r)=>{const a=e(i),o=()=>r.addIssue({code:f.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Ce({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return We.create(this,this._def)}nullable(){return kt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ee.create(this,this._def)}promise(){return Zt.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return cn.create(this,e,this._def)}transform(e){return new Ce({...N(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new fn({...N(this._def),innerType:this,defaultValue:t,typeName:O.ZodDefault})}brand(){return new Zi({typeName:O.ZodBranded,type:this,...N(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new qn({...N(this._def),innerType:this,catchValue:t,typeName:O.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return mn.create(this,e)}readonly(){return Qn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const sa=/^c[^\s-]{8,}$/i,ia=/^[a-z][a-z0-9]*$/,ra=/^[0-9A-HJKMNP-TV-Z]{26}$/,aa=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,oa=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,la="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Cs;const ca=/^(((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}))$/,da=/^(([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})))$/,ua=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 ha(s,e){return!!((e==="v4"||!e)&&ca.test(s)||(e==="v6"||!e)&&da.test(s))}class Se extends Z{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==y.string){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:y.string,received:i.parsedType}),j}const t=new pe;let n;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="length"){const r=e.data.length>i.value,a=e.data.length<i.value;(r||a)&&(n=this._getOrReturnCtx(e,n),r?b(n,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&b(n,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if(i.kind==="email")oa.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"email",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="emoji")Cs||(Cs=new RegExp(la,"u")),Cs.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"emoji",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="uuid")aa.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"uuid",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="cuid")sa.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="cuid2")ia.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid2",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="ulid")ra.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ulid",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),b(n,{validation:"url",code:f.invalid_string,message:i.message}),t.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"regex",code:f.invalid_string,message:i.message}),t.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty()):i.kind==="datetime"?ua(i).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:"datetime",message:i.message}),t.dirty()):i.kind==="ip"?ha(e.data,i.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ip",code:f.invalid_string,message:i.message}),t.dirty()):B.assertNever(i);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:f.invalid_string,...T.errToObj(n)})}_addCheck(e){return new Se({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.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,...T.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...T.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...T.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...T.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...T.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...T.errToObj(t)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new Se({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Se({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Se({...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}}Se.create=s=>{var e;return new Se({checks:[],typeName:O.ZodString,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...N(s)})};function pa(s,e){const t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,r=parseInt(s.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return r%a/Math.pow(10,i)}class et extends Z{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)!==y.number){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:y.number,received:i.parsedType}),j}let t;const n=new pe;for(const i of this._def.checks)i.kind==="int"?B.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:f.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?pa(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_finite,message:i.message}),n.dirty()):B.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,i){return new et({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(i)}]})}_addCheck(e){return new et({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.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"&&B.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}et.create=s=>new et({checks:[],typeName:O.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...N(s)});class tt extends Z{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)!==y.bigint){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:y.bigint,received:i.parsedType}),j}let t;const n=new pe;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):B.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,i){return new tt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(i)}]})}_addCheck(e){return new tt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.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}}tt.create=s=>{var e;return new tt({checks:[],typeName:O.ZodBigInt,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...N(s)})};class rn extends Z{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.boolean,received:t.parsedType}),j}return ge(e.data)}}rn.create=s=>new rn({typeName:O.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...N(s)});class bt extends Z{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==y.date){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:y.date,received:i.parsedType}),j}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_date}),j}const t=new pe;let n;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),t.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):B.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:T.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}}bt.create=s=>new bt({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:O.ZodDate,...N(s)});class Bn extends Z{_parse(e){if(this._getType(e)!==y.symbol){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.symbol,received:t.parsedType}),j}return ge(e.data)}}Bn.create=s=>new Bn({typeName:O.ZodSymbol,...N(s)});class an extends Z{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.undefined,received:t.parsedType}),j}return ge(e.data)}}an.create=s=>new an({typeName:O.ZodUndefined,...N(s)});class on extends Z{_parse(e){if(this._getType(e)!==y.null){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.null,received:t.parsedType}),j}return ge(e.data)}}on.create=s=>new on({typeName:O.ZodNull,...N(s)});class Nt extends Z{constructor(){super(...arguments),this._any=!0}_parse(e){return ge(e.data)}}Nt.create=s=>new Nt({typeName:O.ZodAny,...N(s)});class wt extends Z{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ge(e.data)}}wt.create=s=>new wt({typeName:O.ZodUnknown,...N(s)});class Be extends Z{_parse(e){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.never,received:t.parsedType}),j}}Be.create=s=>new Be({typeName:O.ZodNever,...N(s)});class Wn extends Z{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.void,received:t.parsedType}),j}return ge(e.data)}}Wn.create=s=>new Wn({typeName:O.ZodVoid,...N(s)});class Ee extends Z{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==y.array)return b(t,{code:f.invalid_type,expected:y.array,received:t.parsedType}),j;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(b(t,{code:a?f.too_big:f.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(b(t,{code:f.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(b(t,{code:f.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>i.type._parseAsync(new Pe(t,a,t.path,o)))).then(a=>pe.mergeArray(n,a));const r=[...t.data].map((a,o)=>i.type._parseSync(new Pe(t,a,t.path,o)));return pe.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new Ee({...this._def,minLength:{value:e,message:T.toString(t)}})}max(e,t){return new Ee({...this._def,maxLength:{value:e,message:T.toString(t)}})}length(e,t){return new Ee({...this._def,exactLength:{value:e,message:T.toString(t)}})}nonempty(e){return this.min(1,e)}}Ee.create=(s,e)=>new Ee({type:s,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...N(e)});function zt(s){if(s instanceof te){const e={};for(const t in s.shape){const n=s.shape[t];e[t]=We.create(zt(n))}return new te({...s._def,shape:()=>e})}else return s instanceof Ee?new Ee({...s._def,type:zt(s.element)}):s instanceof We?We.create(zt(s.unwrap())):s instanceof kt?kt.create(zt(s.unwrap())):s instanceof je?je.create(s.items.map(e=>zt(e))):s}class te extends Z{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=B.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==y.object){const l=this._getOrReturnCtx(e);return b(l,{code:f.invalid_type,expected:y.object,received:l.parsedType}),j}const{status:t,ctx:n}=this._processInputParams(e),{shape:i,keys:r}=this._getCached(),a=[];if(!(this._def.catchall instanceof Be&&this._def.unknownKeys==="strip"))for(const l in n.data)r.includes(l)||a.push(l);const o=[];for(const l of r){const d=i[l],u=n.data[l];o.push({key:{status:"valid",value:l},value:d._parse(new Pe(n,u,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Be){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of a)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(l==="strict")a.length>0&&(b(n,{code:f.unrecognized_keys,keys:a}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of a){const u=n.data[d];o.push({key:{status:"valid",value:d},value:l._parse(new Pe(n,u,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of o){const u=await d.key;l.push({key:u,value:await d.value,alwaysSet:d.alwaysSet})}return l}).then(l=>pe.mergeObjectSync(t,l)):pe.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new te({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,r,a,o;const l=(a=(r=(i=this._def).errorMap)===null||r===void 0?void 0:r.call(i,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=T.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new te({...this._def,unknownKeys:"strip"})}passthrough(){return new te({...this._def,unknownKeys:"passthrough"})}extend(e){return new te({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new te({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new te({...this._def,catchall:e})}pick(e){const t={};return B.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new te({...this._def,shape:()=>t})}omit(e){const t={};return B.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new te({...this._def,shape:()=>t})}deepPartial(){return zt(this)}partial(e){const t={};return B.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new te({...this._def,shape:()=>t})}required(e){const t={};return B.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof We;)i=i._def.innerType;t[n]=i}}),new te({...this._def,shape:()=>t})}keyof(){return Di(B.objectKeys(this.shape))}}te.create=(s,e)=>new te({shape:()=>s,unknownKeys:"strip",catchall:Be.create(),typeName:O.ZodObject,...N(e)}),te.strictCreate=(s,e)=>new te({shape:()=>s,unknownKeys:"strict",catchall:Be.create(),typeName:O.ZodObject,...N(e)}),te.lazycreate=(s,e)=>new te({shape:s,unknownKeys:"strip",catchall:Be.create(),typeName:O.ZodObject,...N(e)});class ln extends Z{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(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 Te(o.ctx.common.issues));return b(t,{code:f.invalid_union,unionErrors:a}),j}if(t.common.async)return Promise.all(n.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(i);{let r;const a=[];for(const l of n){const d={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!r&&(r={result:u,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(l=>new Te(l));return b(t,{code:f.invalid_union,unionErrors:o}),j}}get options(){return this._def.options}}ln.create=(s,e)=>new ln({options:s,typeName:O.ZodUnion,...N(e)});const Fn=s=>s instanceof un?Fn(s.schema):s instanceof Ce?Fn(s.innerType()):s instanceof hn?[s.value]:s instanceof nt?s.options:s instanceof pn?Object.keys(s.enum):s instanceof fn?Fn(s._def.innerType):s instanceof an?[void 0]:s instanceof on?[null]:null;class Vn extends Z{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.object)return b(t,{code:f.invalid_type,expected:y.object,received:t.parsedType}),j;const n=this.discriminator,i=t.data[n],r=this.optionsMap.get(i);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}):(b(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),j)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const r of t){const a=Fn(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(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,r)}}return new Vn({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...N(n)})}}function As(s,e){const t=Xe(s),n=Xe(e);if(s===e)return{valid:!0,data:s};if(t===y.object&&n===y.object){const i=B.objectKeys(e),r=B.objectKeys(s).filter(o=>i.indexOf(o)!==-1),a={...s,...e};for(const o of r){const l=As(s[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===y.array&&n===y.array){if(s.length!==e.length)return{valid:!1};const i=[];for(let r=0;r<s.length;r++){const a=s[r],o=e[r],l=As(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===y.date&&n===y.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class cn extends Z{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(r,a)=>{if(Ss(r)||Ss(a))return j;const o=As(r.value,a.value);return o.valid?((Es(r)||Es(a))&&t.dirty(),{status:t.value,value:o.data}):(b(n,{code:f.invalid_intersection_types}),j)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([r,a])=>i(r,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}cn.create=(s,e,t)=>new cn({left:s,right:e,typeName:O.ZodIntersection,...N(t)});class je extends Z{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.array)return b(n,{code:f.invalid_type,expected:y.array,received:n.parsedType}),j;if(n.data.length<this._def.items.length)return b(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;!this._def.rest&&n.data.length>this._def.items.length&&(b(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map((r,a)=>{const o=this._def.items[a]||this._def.rest;return o?o._parse(new Pe(n,r,n.path,a)):null}).filter(r=>!!r);return n.common.async?Promise.all(i).then(r=>pe.mergeArray(t,r)):pe.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new je({...this._def,rest:e})}}je.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new je({items:s,typeName:O.ZodTuple,rest:null,...N(e)})};class dn extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.object)return b(n,{code:f.invalid_type,expected:y.object,received:n.parsedType}),j;const i=[],r=this._def.keyType,a=this._def.valueType;for(const o in n.data)i.push({key:r._parse(new Pe(n,o,n.path,o)),value:a._parse(new Pe(n,n.data[o],n.path,o))});return n.common.async?pe.mergeObjectAsync(t,i):pe.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof Z?new dn({keyType:e,valueType:t,typeName:O.ZodRecord,...N(n)}):new dn({keyType:Se.create(),valueType:e,typeName:O.ZodRecord,...N(t)})}}class Kn extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.map)return b(n,{code:f.invalid_type,expected:y.map,received:n.parsedType}),j;const i=this._def.keyType,r=this._def.valueType,a=[...n.data.entries()].map(([o,l],d)=>({key:i._parse(new Pe(n,o,n.path,[d,"key"])),value:r._parse(new Pe(n,l,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return j;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(d.value,u.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return j;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(d.value,u.value)}return{status:t.value,value:o}}}}Kn.create=(s,e,t)=>new Kn({valueType:e,keyType:s,typeName:O.ZodMap,...N(t)});class xt extends Z{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.set)return b(n,{code:f.invalid_type,expected:y.set,received:n.parsedType}),j;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(b(n,{code:f.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(b(n,{code:f.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const r=this._def.valueType;function a(l){const d=new Set;for(const u of l){if(u.status==="aborted")return j;u.status==="dirty"&&t.dirty(),d.add(u.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((l,d)=>r._parse(new Pe(n,l,n.path,d)));return n.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new xt({...this._def,minSize:{value:e,message:T.toString(t)}})}max(e,t){return new xt({...this._def,maxSize:{value:e,message:T.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}xt.create=(s,e)=>new xt({valueType:s,minSize:null,maxSize:null,typeName:O.ZodSet,...N(e)});class Dt extends Z{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.function)return b(t,{code:f.invalid_type,expected:y.function,received:t.parsedType}),j;function n(o,l){return Un({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ln(),nn].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:l}})}function i(o,l){return Un({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ln(),nn].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:l}})}const r={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Zt){const o=this;return ge(async function(...l){const d=new Te([]),u=await o._def.args.parseAsync(l,r).catch(c=>{throw d.addIssue(n(l,c)),d}),p=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(p,r).catch(c=>{throw d.addIssue(i(p,c)),d})})}else{const o=this;return ge(function(...l){const d=o._def.args.safeParse(l,r);if(!d.success)throw new Te([n(l,d.error)]);const u=Reflect.apply(a,this,d.data),p=o._def.returns.safeParse(u,r);if(!p.success)throw new Te([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Dt({...this._def,args:je.create(e).rest(wt.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,n){return new Dt({args:e||je.create([]).rest(wt.create()),returns:t||wt.create(),typeName:O.ZodFunction,...N(n)})}}class un extends Z{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})}}un.create=(s,e)=>new un({getter:s,typeName:O.ZodLazy,...N(e)});class hn extends Z{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:e.data}}get value(){return this._def.value}}hn.create=(s,e)=>new hn({value:s,typeName:O.ZodLiteral,...N(e)});function Di(s,e){return new nt({values:s,typeName:O.ZodEnum,...N(e)})}class nt extends Z{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{expected:B.joinValues(n),received:t.parsedType,code:f.invalid_type}),j}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{received:t.data,code:f.invalid_enum_value,options:n}),j}return ge(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 nt.create(e)}exclude(e){return nt.create(this.options.filter(t=>!e.includes(t)))}}nt.create=Di;class pn extends Z{_parse(e){const t=B.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==y.string&&n.parsedType!==y.number){const i=B.objectValues(t);return b(n,{expected:B.joinValues(i),received:n.parsedType,code:f.invalid_type}),j}if(t.indexOf(e.data)===-1){const i=B.objectValues(t);return b(n,{received:n.data,code:f.invalid_enum_value,options:i}),j}return ge(e.data)}get enum(){return this._def.values}}pn.create=(s,e)=>new pn({values:s,typeName:O.ZodNativeEnum,...N(e)});class Zt extends Z{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.promise&&t.common.async===!1)return b(t,{code:f.invalid_type,expected:y.promise,received:t.parsedType}),j;const n=t.parsedType===y.promise?t.data:Promise.resolve(t.data);return ge(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Zt.create=(s,e)=>new Zt({type:s,typeName:O.ZodPromise,...N(e)});class Ce extends Z{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,r={addIssue:a=>{b(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),i.type==="preprocess"){const a=i.transform(n.data,r);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,r);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!sn(a))return a;const o=i.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:n.data,path:n.path,parent:n}).then(a=>sn(a)?Promise.resolve(i.transform(a.value,r)).then(o=>({status:t.value,value:o})):a);B.assertNever(i)}}Ce.create=(s,e,t)=>new Ce({schema:s,typeName:O.ZodEffects,effect:e,...N(t)}),Ce.createWithPreprocess=(s,e,t)=>new Ce({schema:e,effect:{type:"preprocess",transform:s},typeName:O.ZodEffects,...N(t)});class We extends Z{_parse(e){return this._getType(e)===y.undefined?ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}We.create=(s,e)=>new We({innerType:s,typeName:O.ZodOptional,...N(e)});class kt extends Z{_parse(e){return this._getType(e)===y.null?ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}kt.create=(s,e)=>new kt({innerType:s,typeName:O.ZodNullable,...N(e)});class fn extends Z{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fn.create=(s,e)=>new fn({innerType:s,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...N(e)});class qn extends Z{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Hn(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qn.create=(s,e)=>new qn({innerType:s,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...N(e)});class Jn extends Z{_parse(e){if(this._getType(e)!==y.nan){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.nan,received:t.parsedType}),j}return{status:"valid",value:e.data}}}Jn.create=s=>new Jn({typeName:O.ZodNaN,...N(s)});const fa=Symbol("zod_brand");class Zi extends Z{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class mn extends Z{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?j:i.status==="dirty"?(t.dirty(),Ni(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?j:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new mn({in:e,out:t,typeName:O.ZodPipeline})}}class Qn extends Z{_parse(e){const t=this._def.innerType._parse(e);return sn(t)&&(t.value=Object.freeze(t.value)),t}}Qn.create=(s,e)=>new Qn({innerType:s,typeName:O.ZodReadonly,...N(e)});const Li=(s,e={},t)=>s?Nt.create().superRefine((n,i)=>{var r,a;if(!s(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,l=(a=(r=o.fatal)!==null&&r!==void 0?r:t)!==null&&a!==void 0?a:!0,d=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...d,fatal:l})}}):Nt.create(),ma={object:te.lazycreate};var O;(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"})(O||(O={}));const ga=(s,e={message:`Input not instance of ${s.name}`})=>Li(t=>t instanceof s,e),Ui=Se.create,Hi=et.create,ya=Jn.create,va=tt.create,Bi=rn.create,ba=bt.create,wa=Bn.create,xa=an.create,ka=on.create,_a=Nt.create,$a=wt.create,Ta=Be.create,Sa=Wn.create,Ea=Ee.create,Ca=te.create,Aa=te.strictCreate,Oa=ln.create,Ia=Vn.create,Ma=cn.create,Ra=je.create,Pa=dn.create,ja=Kn.create,Na=xt.create,za=Dt.create,Da=un.create,Za=hn.create,La=nt.create,Ua=pn.create,Ha=Zt.create,Wi=Ce.create,Ba=We.create,Wa=kt.create,Fa=Ce.createWithPreprocess,Va=mn.create;var k=Object.freeze({__proto__:null,defaultErrorMap:nn,setErrorMap:ta,getErrorMap:Ln,makeIssue:Un,EMPTY_PATH:na,addIssueToContext:b,ParseStatus:pe,INVALID:j,DIRTY:Ni,OK:ge,isAborted:Ss,isDirty:Es,isValid:sn,isAsync:Hn,get util(){return B},get objectUtil(){return Ts},ZodParsedType:y,getParsedType:Xe,ZodType:Z,ZodString:Se,ZodNumber:et,ZodBigInt:tt,ZodBoolean:rn,ZodDate:bt,ZodSymbol:Bn,ZodUndefined:an,ZodNull:on,ZodAny:Nt,ZodUnknown:wt,ZodNever:Be,ZodVoid:Wn,ZodArray:Ee,ZodObject:te,ZodUnion:ln,ZodDiscriminatedUnion:Vn,ZodIntersection:cn,ZodTuple:je,ZodRecord:dn,ZodMap:Kn,ZodSet:xt,ZodFunction:Dt,ZodLazy:un,ZodLiteral:hn,ZodEnum:nt,ZodNativeEnum:pn,ZodPromise:Zt,ZodEffects:Ce,ZodTransformer:Ce,ZodOptional:We,ZodNullable:kt,ZodDefault:fn,ZodCatch:qn,ZodNaN:Jn,BRAND:fa,ZodBranded:Zi,ZodPipeline:mn,ZodReadonly:Qn,custom:Li,Schema:Z,ZodSchema:Z,late:ma,get ZodFirstPartyTypeKind(){return O},coerce:{string:s=>Se.create({...s,coerce:!0}),number:s=>et.create({...s,coerce:!0}),boolean:s=>rn.create({...s,coerce:!0}),bigint:s=>tt.create({...s,coerce:!0}),date:s=>bt.create({...s,coerce:!0})},any:_a,array:Ea,bigint:va,boolean:Bi,date:ba,discriminatedUnion:Ia,effect:Wi,enum:La,function:za,instanceof:ga,intersection:Ma,lazy:Da,literal:Za,map:ja,nan:ya,nativeEnum:Ua,never:Ta,null:ka,nullable:Wa,number:Hi,object:Ca,oboolean:()=>Bi().optional(),onumber:()=>Hi().optional(),optional:Ba,ostring:()=>Ui().optional(),pipeline:Va,preprocess:Fa,promise:Ha,record:Pa,set:Na,strictObject:Aa,string:Ui,symbol:wa,transformer:Wi,tuple:Ra,undefined:xa,union:Oa,unknown:$a,void:Sa,NEVER:j,ZodIssueCode:f,quotelessJson:ea,ZodError:Te});const Yn=k.object({assistantId:k.string(),params:k.record(k.any()).default({}),config:k.object({historyKey:k.string().refine(s=>s.replace(/-/g,"_")).nullable().default("main"),welcomeMessage:k.string().default("Hello! How can I help you today?"),inactivityWarningMessage:k.string().default("Are you still there? The chat will end soon if we don't hear from you."),chatEndedMessage:k.string().default("The chat has ended. Please restart the chat to continue."),initialReplyMessage:k.string().nullable().default(null),disclaimerMessage:k.string().nullable().default(null),disclaimerPopover:k.object({message:k.string().nullable().default(null),agreeButtonText:k.string().default("I Agree"),rememberDurationMinutes:k.number().default(60*24*3)}).default({}),simulateDelays:k.boolean().default(!0),placement:k.enum(["left","right"]).default("right"),openChatButton:k.object({imageSrc:k.string().nullable().default(null),width:k.union([k.string(),k.number()]).default("48px"),height:k.union([k.string(),k.number()]).default("48px"),cta:k.string().nullable().default(null)}).default({}),chatWindow:k.object({header:k.object({text:k.string().nullable().default("AI Chat"),imageSrc:k.string().nullable().default(null)}).default({}),showCloseButton:k.boolean().default(!0)}).default({}),styles:k.object({primaryColor:k.string().nullable().default(null),textColor:k.string().nullable().default(null),linkColor:k.string().nullable().default(null),openChatButton:k.object({backgroundColor:k.string().nullable().default(null),iconColor:k.string().nullable().default(null)}).default({}),header:k.object({backgroundColor:k.string().nullable().default(null),textColor:k.string().nullable().default(null)}).default({}),button:k.object({backgroundColor:k.string().nullable().default(null),textColor:k.string().nullable().default(null)}).default({}),messages:k.object({user:k.object({backgroundColor:k.string().nullable().default(null),textColor:k.string().nullable().default(null)}).default({}),assistant:k.object({backgroundColor:k.string().nullable().default(null),textColor:k.string().nullable().default(null)}).default({})}).default({})}).default({})}).default({}),handlers:k.object({functionCalls:k.record(k.function().returns(k.union([k.any(),k.promise(k.any())]))).default({}),enhancedContent:k.record(k.function().returns(k.union([k.any(),k.promise(k.any())]))).default({})}).default({})});var Ka=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,gn=(s,e,t,n)=>{for(var i=n>1?void 0:n?qa(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Ka(e,t,i),i};let _t=class extends be{constructor(){super(...arguments),this.isOpen=!1,this.onResizeHandler=()=>{this.isOpen&&window.innerWidth<768?Yr(this):Ii(this)}}connectedCallback(){super.connectedCallback(),this.cleanOptions=Yn.parse(this.options),this.onResizeHandler(),window.addEventListener("resize",this.onResizeHandler,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),Ii(this),window.removeEventListener("resize",this.onResizeHandler)}render(){const s=this.cleanOptions.config.placement!=="left",e=Mi({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=Mi({"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 H`
|
|
118
|
+
*/const Ri="important",Yr=" !"+Ri,vt=jn(class extends Nn{constructor(s){var e;if(super(s),s.type!==Pn.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 n=s[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}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 n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const r=typeof i=="string"&&i.endsWith(Yr);n.includes("-")||r?t.setProperty(n,r?i.slice(0,-11):i,r?Ri:""):t[n]=i}}return Ie}});var Gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pi(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ks={};(function(s){function e(o){o&&o.options&&clearTimeout(o.options.timer)}function t(o,l,d,u){var p={timer:void 0,lastArgs:[]},c=function(){for(var m=this,R=[],F=0;F<arguments.length;F++)R[F]=arguments[F];p.lastArgs=R,p.timer?clearTimeout(p.timer):l&&d.apply(this,p.lastArgs),p.timer=setTimeout(function(){l||d.apply(m,p.lastArgs),p.timer=void 0},o)};return u&&(c=c.bind(u)),c.options=p,c}function n(o,l,d,u){var p;Object.defineProperty(d,u,{configurable:!0,enumerable:!1,get:function(){return p},set:function(c){p=t(o,l,c,this)}})}function i(o,l,d){var u=d.value;return d.value=t(o,l,u),d}function r(o,l){for(var d=[],u=2;u<arguments.length;u++)d[u-2]=arguments[u];if(d.length===0)throw new Error("function applied debounce decorator should be a method");if(d.length===1)throw new Error("method applied debounce decorator should have valid name");var p=d[0],c=d[1],m=d.length===3&&d[2]?d[2]:Object.getOwnPropertyDescriptor(p,c);if(m)return i(o,l,m);n(o,l,p,c)}function a(){for(var o=[],l=0;l<arguments.length;l++)o[l]=arguments[l];var d=500,u=!1;if(o.length&&(typeof o[0]=="number"||typeof o[0]=="object"&&o[0].leading!==void 0)){typeof o[0]=="number"&&(d=o[0]);var p=void 0;return typeof o[0]=="object"&&o[0].leading!==void 0&&(p=o[0]),1<o.length&&typeof o[1]=="object"&&o[1].leading!==void 0&&(p=o[1]),p&&(u=p.leading),function(){for(var c=[],m=0;m<arguments.length;m++)c[m]=arguments[m];return r.apply(void 0,[d,u].concat(c))}}return r.apply(void 0,[d,u].concat(o))}Object.defineProperty(s,"__esModule",{value:!0}),s.cancel=e,s.debounce=a})(ks);var B;(function(s){s.assertEqual=i=>i;function e(i){}s.assertIs=e;function t(i){throw new Error}s.assertNever=t,s.arrayToEnum=i=>{const r={};for(const a of i)r[a]=a;return r},s.getValidEnumValues=i=>{const r=s.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of r)a[o]=i[o];return s.objectValues(a)},s.objectValues=i=>s.objectKeys(i).map(function(r){return i[r]}),s.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const r=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&r.push(a);return r},s.find=(i,r)=>{for(const a of i)if(r(a))return a},s.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,r=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(r)}s.joinValues=n,s.jsonStringifyReplacer=(i,r)=>typeof r=="bigint"?r.toString():r})(B||(B={}));var $s;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})($s||($s={}));const y=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ge=s=>{switch(typeof s){case"undefined":return y.undefined;case"string":return y.string;case"number":return isNaN(s)?y.nan:y.number;case"boolean":return y.boolean;case"function":return y.function;case"bigint":return y.bigint;case"symbol":return y.symbol;case"object":return Array.isArray(s)?y.array:s===null?y.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?y.promise:typeof Map<"u"&&s instanceof Map?y.map:typeof Set<"u"&&s instanceof Set?y.set:typeof Date<"u"&&s instanceof Date?y.date:y.object;default:return y.unknown}},f=B.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"]),Xr=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class Te extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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},n={_errors:[]},i=r=>{for(const a of r.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let o=n,l=0;for(;l<a.path.length;){const d=a.path[l];l===a.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(a))):o[d]=o[d]||{_errors:[]},o=o[d],l++}}};return i(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Te.create=s=>new Te(s);const nn=(s,e)=>{let t;switch(s.code){case f.invalid_type:s.received===y.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,B.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${B.joinValues(s.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${B.joinValues(s.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${B.joinValues(s.options)}, received '${s.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.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}"`:B.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case f.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 f.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 f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,B.assertNever(s)}return{message:t}};let ji=nn;function ea(s){ji=s}function Ln(){return ji}const Un=s=>{const{data:e,path:t,errorMaps:n,issueData:i}=s,r=[...t,...i.path||[]],a={...i,path:r};let o="";const l=n.filter(d=>!!d).slice().reverse();for(const d of l)o=d(a,{data:e,defaultError:o}).message;return{...i,path:r,message:i.message||o}},ta=[];function b(s,e){const t=Un({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ln(),nn].filter(n=>!!n)});s.common.issues.push(t)}class pe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if(i.status==="aborted")return j;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t)n.push({key:await i.key,value:await i.value});return pe.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:r,value:a}=i;if(r.status==="aborted"||a.status==="aborted")return j;r.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[r.value]=a.value)}return{status:e.value,value:n}}}const j=Object.freeze({status:"aborted"}),Ni=s=>({status:"dirty",value:s}),ge=s=>({status:"valid",value:s}),Ts=s=>s.status==="aborted",Ss=s=>s.status==="dirty",sn=s=>s.status==="valid",Hn=s=>typeof Promise<"u"&&s instanceof Promise;var T;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(T||(T={}));class Me{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}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 zi=(s,e)=>{if(sn(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 Te(s.common.issues);return this._error=t,this._error}}};function N(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:i}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(r,a)=>r.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:n??a.defaultError}:{message:t??a.defaultError},description:i}}class Z{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 Ge(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pe,ctx:{common:e.parent.common,data:e.data,parsedType:Ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Hn(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ge(e)},r=this._parseSync({data:e,path:i.path,parent:i});return zi(i,r)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ge(e)},i=this._parse({data:e,path:n.path,parent:n}),r=await(Hn(i)?i:Promise.resolve(i));return zi(n,r)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,r)=>{const a=e(i),o=()=>r.addIssue({code:f.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Ce({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return We.create(this,this._def)}nullable(){return _t.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ee.create(this,this._def)}promise(){return Zt.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return cn.create(this,e,this._def)}transform(e){return new Ce({...N(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new fn({...N(this._def),innerType:this,defaultValue:t,typeName:O.ZodDefault})}brand(){return new Zi({typeName:O.ZodBranded,type:this,...N(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new qn({...N(this._def),innerType:this,catchValue:t,typeName:O.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return mn.create(this,e)}readonly(){return Qn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const na=/^c[^\s-]{8,}$/i,sa=/^[a-z][a-z0-9]*$/,ia=/^[0-9A-HJKMNP-TV-Z]{26}$/,ra=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,aa=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Es;const la=/^(((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}))$/,ca=/^(([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})))$/,da=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 ua(s,e){return!!((e==="v4"||!e)&&la.test(s)||(e==="v6"||!e)&&ca.test(s))}class Se extends Z{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==y.string){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:y.string,received:i.parsedType}),j}const t=new pe;let n;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if(i.kind==="length"){const r=e.data.length>i.value,a=e.data.length<i.value;(r||a)&&(n=this._getOrReturnCtx(e,n),r?b(n,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&b(n,{code:f.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if(i.kind==="email")aa.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"email",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="emoji")Es||(Es=new RegExp(oa,"u")),Es.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"emoji",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="uuid")ra.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"uuid",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="cuid")na.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="cuid2")sa.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid2",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="ulid")ia.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ulid",code:f.invalid_string,message:i.message}),t.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),b(n,{validation:"url",code:f.invalid_string,message:i.message}),t.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"regex",code:f.invalid_string,message:i.message}),t.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty()):i.kind==="datetime"?da(i).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:"datetime",message:i.message}),t.dirty()):i.kind==="ip"?ua(e.data,i.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ip",code:f.invalid_string,message:i.message}),t.dirty()):B.assertNever(i);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:f.invalid_string,...T.errToObj(n)})}_addCheck(e){return new Se({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.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,...T.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...T.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...T.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...T.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...T.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...T.errToObj(t)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new Se({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Se({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Se({...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}}Se.create=s=>{var e;return new Se({checks:[],typeName:O.ZodString,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...N(s)})};function ha(s,e){const t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,r=parseInt(s.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return r%a/Math.pow(10,i)}class Xe extends Z{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)!==y.number){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:y.number,received:i.parsedType}),j}let t;const n=new pe;for(const i of this._def.checks)i.kind==="int"?B.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:f.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?ha(e.data,i.value)!==0&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_finite,message:i.message}),n.dirty()):B.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,i){return new Xe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(i)}]})}_addCheck(e){return new Xe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.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"&&B.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Xe.create=s=>new Xe({checks:[],typeName:O.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...N(s)});class et extends Z{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)!==y.bigint){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:y.bigint,received:i.parsedType}),j}let t;const n=new pe;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):B.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,i){return new et({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(i)}]})}_addCheck(e){return new et({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.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}}et.create=s=>{var e;return new et({checks:[],typeName:O.ZodBigInt,coerce:(e=s==null?void 0:s.coerce)!==null&&e!==void 0?e:!1,...N(s)})};class rn extends Z{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==y.boolean){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.boolean,received:t.parsedType}),j}return ge(e.data)}}rn.create=s=>new rn({typeName:O.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...N(s)});class bt extends Z{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==y.date){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_type,expected:y.date,received:i.parsedType}),j}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return b(i,{code:f.invalid_date}),j}const t=new pe;let n;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),t.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):B.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:T.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}}bt.create=s=>new bt({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:O.ZodDate,...N(s)});class Bn extends Z{_parse(e){if(this._getType(e)!==y.symbol){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.symbol,received:t.parsedType}),j}return ge(e.data)}}Bn.create=s=>new Bn({typeName:O.ZodSymbol,...N(s)});class an extends Z{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.undefined,received:t.parsedType}),j}return ge(e.data)}}an.create=s=>new an({typeName:O.ZodUndefined,...N(s)});class on extends Z{_parse(e){if(this._getType(e)!==y.null){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.null,received:t.parsedType}),j}return ge(e.data)}}on.create=s=>new on({typeName:O.ZodNull,...N(s)});class Nt extends Z{constructor(){super(...arguments),this._any=!0}_parse(e){return ge(e.data)}}Nt.create=s=>new Nt({typeName:O.ZodAny,...N(s)});class wt extends Z{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ge(e.data)}}wt.create=s=>new wt({typeName:O.ZodUnknown,...N(s)});class Be extends Z{_parse(e){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.never,received:t.parsedType}),j}}Be.create=s=>new Be({typeName:O.ZodNever,...N(s)});class Wn extends Z{_parse(e){if(this._getType(e)!==y.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.void,received:t.parsedType}),j}return ge(e.data)}}Wn.create=s=>new Wn({typeName:O.ZodVoid,...N(s)});class Ee extends Z{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==y.array)return b(t,{code:f.invalid_type,expected:y.array,received:t.parsedType}),j;if(i.exactLength!==null){const a=t.data.length>i.exactLength.value,o=t.data.length<i.exactLength.value;(a||o)&&(b(t,{code:a?f.too_big:f.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(b(t,{code:f.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(b(t,{code:f.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>i.type._parseAsync(new Me(t,a,t.path,o)))).then(a=>pe.mergeArray(n,a));const r=[...t.data].map((a,o)=>i.type._parseSync(new Me(t,a,t.path,o)));return pe.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new Ee({...this._def,minLength:{value:e,message:T.toString(t)}})}max(e,t){return new Ee({...this._def,maxLength:{value:e,message:T.toString(t)}})}length(e,t){return new Ee({...this._def,exactLength:{value:e,message:T.toString(t)}})}nonempty(e){return this.min(1,e)}}Ee.create=(s,e)=>new Ee({type:s,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...N(e)});function zt(s){if(s instanceof ee){const e={};for(const t in s.shape){const n=s.shape[t];e[t]=We.create(zt(n))}return new ee({...s._def,shape:()=>e})}else return s instanceof Ee?new Ee({...s._def,type:zt(s.element)}):s instanceof We?We.create(zt(s.unwrap())):s instanceof _t?_t.create(zt(s.unwrap())):s instanceof Re?Re.create(s.items.map(e=>zt(e))):s}class ee extends Z{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=B.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==y.object){const l=this._getOrReturnCtx(e);return b(l,{code:f.invalid_type,expected:y.object,received:l.parsedType}),j}const{status:t,ctx:n}=this._processInputParams(e),{shape:i,keys:r}=this._getCached(),a=[];if(!(this._def.catchall instanceof Be&&this._def.unknownKeys==="strip"))for(const l in n.data)r.includes(l)||a.push(l);const o=[];for(const l of r){const d=i[l],u=n.data[l];o.push({key:{status:"valid",value:l},value:d._parse(new Me(n,u,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Be){const l=this._def.unknownKeys;if(l==="passthrough")for(const d of a)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(l==="strict")a.length>0&&(b(n,{code:f.unrecognized_keys,keys:a}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const d of a){const u=n.data[d];o.push({key:{status:"valid",value:d},value:l._parse(new Me(n,u,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const d of o){const u=await d.key;l.push({key:u,value:await d.value,alwaysSet:d.alwaysSet})}return l}).then(l=>pe.mergeObjectSync(t,l)):pe.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new ee({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,r,a,o;const l=(a=(r=(i=this._def).errorMap)===null||r===void 0?void 0:r.call(i,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=T.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new ee({...this._def,unknownKeys:"strip"})}passthrough(){return new ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ee({...this._def,catchall:e})}pick(e){const t={};return B.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new ee({...this._def,shape:()=>t})}omit(e){const t={};return B.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ee({...this._def,shape:()=>t})}deepPartial(){return zt(this)}partial(e){const t={};return B.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new ee({...this._def,shape:()=>t})}required(e){const t={};return B.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof We;)i=i._def.innerType;t[n]=i}}),new ee({...this._def,shape:()=>t})}keyof(){return Di(B.objectKeys(this.shape))}}ee.create=(s,e)=>new ee({shape:()=>s,unknownKeys:"strip",catchall:Be.create(),typeName:O.ZodObject,...N(e)}),ee.strictCreate=(s,e)=>new ee({shape:()=>s,unknownKeys:"strict",catchall:Be.create(),typeName:O.ZodObject,...N(e)}),ee.lazycreate=(s,e)=>new ee({shape:s,unknownKeys:"strip",catchall:Be.create(),typeName:O.ZodObject,...N(e)});class ln extends Z{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(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 Te(o.ctx.common.issues));return b(t,{code:f.invalid_union,unionErrors:a}),j}if(t.common.async)return Promise.all(n.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(i);{let r;const a=[];for(const l of n){const d={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!r&&(r={result:u,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=a.map(l=>new Te(l));return b(t,{code:f.invalid_union,unionErrors:o}),j}}get options(){return this._def.options}}ln.create=(s,e)=>new ln({options:s,typeName:O.ZodUnion,...N(e)});const Fn=s=>s instanceof un?Fn(s.schema):s instanceof Ce?Fn(s.innerType()):s instanceof hn?[s.value]:s instanceof tt?s.options:s instanceof pn?Object.keys(s.enum):s instanceof fn?Fn(s._def.innerType):s instanceof an?[void 0]:s instanceof on?[null]:null;class Vn extends Z{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.object)return b(t,{code:f.invalid_type,expected:y.object,received:t.parsedType}),j;const n=this.discriminator,i=t.data[n],r=this.optionsMap.get(i);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}):(b(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),j)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const r of t){const a=Fn(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(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,r)}}return new Vn({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...N(n)})}}function Cs(s,e){const t=Ge(s),n=Ge(e);if(s===e)return{valid:!0,data:s};if(t===y.object&&n===y.object){const i=B.objectKeys(e),r=B.objectKeys(s).filter(o=>i.indexOf(o)!==-1),a={...s,...e};for(const o of r){const l=Cs(s[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===y.array&&n===y.array){if(s.length!==e.length)return{valid:!1};const i=[];for(let r=0;r<s.length;r++){const a=s[r],o=e[r],l=Cs(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===y.date&&n===y.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class cn extends Z{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(r,a)=>{if(Ts(r)||Ts(a))return j;const o=Cs(r.value,a.value);return o.valid?((Ss(r)||Ss(a))&&t.dirty(),{status:t.value,value:o.data}):(b(n,{code:f.invalid_intersection_types}),j)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([r,a])=>i(r,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}cn.create=(s,e,t)=>new cn({left:s,right:e,typeName:O.ZodIntersection,...N(t)});class Re extends Z{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.array)return b(n,{code:f.invalid_type,expected:y.array,received:n.parsedType}),j;if(n.data.length<this._def.items.length)return b(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;!this._def.rest&&n.data.length>this._def.items.length&&(b(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map((r,a)=>{const o=this._def.items[a]||this._def.rest;return o?o._parse(new Me(n,r,n.path,a)):null}).filter(r=>!!r);return n.common.async?Promise.all(i).then(r=>pe.mergeArray(t,r)):pe.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new Re({...this._def,rest:e})}}Re.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Re({items:s,typeName:O.ZodTuple,rest:null,...N(e)})};class dn extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.object)return b(n,{code:f.invalid_type,expected:y.object,received:n.parsedType}),j;const i=[],r=this._def.keyType,a=this._def.valueType;for(const o in n.data)i.push({key:r._parse(new Me(n,o,n.path,o)),value:a._parse(new Me(n,n.data[o],n.path,o))});return n.common.async?pe.mergeObjectAsync(t,i):pe.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof Z?new dn({keyType:e,valueType:t,typeName:O.ZodRecord,...N(n)}):new dn({keyType:Se.create(),valueType:e,typeName:O.ZodRecord,...N(t)})}}class Kn extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.map)return b(n,{code:f.invalid_type,expected:y.map,received:n.parsedType}),j;const i=this._def.keyType,r=this._def.valueType,a=[...n.data.entries()].map(([o,l],d)=>({key:i._parse(new Me(n,o,n.path,[d,"key"])),value:r._parse(new Me(n,l,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const d=await l.key,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return j;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(d.value,u.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const l of a){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return j;(d.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(d.value,u.value)}return{status:t.value,value:o}}}}Kn.create=(s,e,t)=>new Kn({valueType:e,keyType:s,typeName:O.ZodMap,...N(t)});class xt extends Z{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==y.set)return b(n,{code:f.invalid_type,expected:y.set,received:n.parsedType}),j;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(b(n,{code:f.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(b(n,{code:f.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const r=this._def.valueType;function a(l){const d=new Set;for(const u of l){if(u.status==="aborted")return j;u.status==="dirty"&&t.dirty(),d.add(u.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((l,d)=>r._parse(new Me(n,l,n.path,d)));return n.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new xt({...this._def,minSize:{value:e,message:T.toString(t)}})}max(e,t){return new xt({...this._def,maxSize:{value:e,message:T.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}xt.create=(s,e)=>new xt({valueType:s,minSize:null,maxSize:null,typeName:O.ZodSet,...N(e)});class Dt extends Z{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.function)return b(t,{code:f.invalid_type,expected:y.function,received:t.parsedType}),j;function n(o,l){return Un({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ln(),nn].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:l}})}function i(o,l){return Un({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ln(),nn].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:l}})}const r={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Zt){const o=this;return ge(async function(...l){const d=new Te([]),u=await o._def.args.parseAsync(l,r).catch(c=>{throw d.addIssue(n(l,c)),d}),p=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(p,r).catch(c=>{throw d.addIssue(i(p,c)),d})})}else{const o=this;return ge(function(...l){const d=o._def.args.safeParse(l,r);if(!d.success)throw new Te([n(l,d.error)]);const u=Reflect.apply(a,this,d.data),p=o._def.returns.safeParse(u,r);if(!p.success)throw new Te([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Dt({...this._def,args:Re.create(e).rest(wt.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,n){return new Dt({args:e||Re.create([]).rest(wt.create()),returns:t||wt.create(),typeName:O.ZodFunction,...N(n)})}}class un extends Z{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})}}un.create=(s,e)=>new un({getter:s,typeName:O.ZodLazy,...N(e)});class hn extends Z{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:e.data}}get value(){return this._def.value}}hn.create=(s,e)=>new hn({value:s,typeName:O.ZodLiteral,...N(e)});function Di(s,e){return new tt({values:s,typeName:O.ZodEnum,...N(e)})}class tt extends Z{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{expected:B.joinValues(n),received:t.parsedType,code:f.invalid_type}),j}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{received:t.data,code:f.invalid_enum_value,options:n}),j}return ge(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 tt.create(e)}exclude(e){return tt.create(this.options.filter(t=>!e.includes(t)))}}tt.create=Di;class pn extends Z{_parse(e){const t=B.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==y.string&&n.parsedType!==y.number){const i=B.objectValues(t);return b(n,{expected:B.joinValues(i),received:n.parsedType,code:f.invalid_type}),j}if(t.indexOf(e.data)===-1){const i=B.objectValues(t);return b(n,{received:n.data,code:f.invalid_enum_value,options:i}),j}return ge(e.data)}get enum(){return this._def.values}}pn.create=(s,e)=>new pn({values:s,typeName:O.ZodNativeEnum,...N(e)});class Zt extends Z{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==y.promise&&t.common.async===!1)return b(t,{code:f.invalid_type,expected:y.promise,received:t.parsedType}),j;const n=t.parsedType===y.promise?t.data:Promise.resolve(t.data);return ge(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Zt.create=(s,e)=>new Zt({type:s,typeName:O.ZodPromise,...N(e)});class Ce extends Z{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,r={addIssue:a=>{b(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),i.type==="preprocess"){const a=i.transform(n.data,r);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(a).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,r);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(i.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!sn(a))return a;const o=i.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:n.data,path:n.path,parent:n}).then(a=>sn(a)?Promise.resolve(i.transform(a.value,r)).then(o=>({status:t.value,value:o})):a);B.assertNever(i)}}Ce.create=(s,e,t)=>new Ce({schema:s,typeName:O.ZodEffects,effect:e,...N(t)}),Ce.createWithPreprocess=(s,e,t)=>new Ce({schema:e,effect:{type:"preprocess",transform:s},typeName:O.ZodEffects,...N(t)});class We extends Z{_parse(e){return this._getType(e)===y.undefined?ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}We.create=(s,e)=>new We({innerType:s,typeName:O.ZodOptional,...N(e)});class _t extends Z{_parse(e){return this._getType(e)===y.null?ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_t.create=(s,e)=>new _t({innerType:s,typeName:O.ZodNullable,...N(e)});class fn extends Z{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===y.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fn.create=(s,e)=>new fn({innerType:s,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...N(e)});class qn extends Z{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Hn(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}qn.create=(s,e)=>new qn({innerType:s,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...N(e)});class Jn extends Z{_parse(e){if(this._getType(e)!==y.nan){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:y.nan,received:t.parsedType}),j}return{status:"valid",value:e.data}}}Jn.create=s=>new Jn({typeName:O.ZodNaN,...N(s)});const pa=Symbol("zod_brand");class Zi extends Z{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class mn extends Z{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?j:i.status==="dirty"?(t.dirty(),Ni(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?j:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new mn({in:e,out:t,typeName:O.ZodPipeline})}}class Qn extends Z{_parse(e){const t=this._def.innerType._parse(e);return sn(t)&&(t.value=Object.freeze(t.value)),t}}Qn.create=(s,e)=>new Qn({innerType:s,typeName:O.ZodReadonly,...N(e)});const Li=(s,e={},t)=>s?Nt.create().superRefine((n,i)=>{var r,a;if(!s(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,l=(a=(r=o.fatal)!==null&&r!==void 0?r:t)!==null&&a!==void 0?a:!0,d=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...d,fatal:l})}}):Nt.create(),fa={object:ee.lazycreate};var O;(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"})(O||(O={}));const ma=(s,e={message:`Input not instance of ${s.name}`})=>Li(t=>t instanceof s,e),Ui=Se.create,Hi=Xe.create,ga=Jn.create,ya=et.create,Bi=rn.create,va=bt.create,ba=Bn.create,wa=an.create,xa=on.create,_a=Nt.create,ka=wt.create,$a=Be.create,Ta=Wn.create,Sa=Ee.create,Ea=ee.create,Ca=ee.strictCreate,Aa=ln.create,Oa=Vn.create,Ia=cn.create,Ma=Re.create,Ra=dn.create,Pa=Kn.create,ja=xt.create,Na=Dt.create,za=un.create,Da=hn.create,Za=tt.create,La=pn.create,Ua=Zt.create,Wi=Ce.create,Ha=We.create,Ba=_t.create,Wa=Ce.createWithPreprocess,Fa=mn.create;var x=Object.freeze({__proto__:null,defaultErrorMap:nn,setErrorMap:ea,getErrorMap:Ln,makeIssue:Un,EMPTY_PATH:ta,addIssueToContext:b,ParseStatus:pe,INVALID:j,DIRTY:Ni,OK:ge,isAborted:Ts,isDirty:Ss,isValid:sn,isAsync:Hn,get util(){return B},get objectUtil(){return $s},ZodParsedType:y,getParsedType:Ge,ZodType:Z,ZodString:Se,ZodNumber:Xe,ZodBigInt:et,ZodBoolean:rn,ZodDate:bt,ZodSymbol:Bn,ZodUndefined:an,ZodNull:on,ZodAny:Nt,ZodUnknown:wt,ZodNever:Be,ZodVoid:Wn,ZodArray:Ee,ZodObject:ee,ZodUnion:ln,ZodDiscriminatedUnion:Vn,ZodIntersection:cn,ZodTuple:Re,ZodRecord:dn,ZodMap:Kn,ZodSet:xt,ZodFunction:Dt,ZodLazy:un,ZodLiteral:hn,ZodEnum:tt,ZodNativeEnum:pn,ZodPromise:Zt,ZodEffects:Ce,ZodTransformer:Ce,ZodOptional:We,ZodNullable:_t,ZodDefault:fn,ZodCatch:qn,ZodNaN:Jn,BRAND:pa,ZodBranded:Zi,ZodPipeline:mn,ZodReadonly:Qn,custom:Li,Schema:Z,ZodSchema:Z,late:fa,get ZodFirstPartyTypeKind(){return O},coerce:{string:s=>Se.create({...s,coerce:!0}),number:s=>Xe.create({...s,coerce:!0}),boolean:s=>rn.create({...s,coerce:!0}),bigint:s=>et.create({...s,coerce:!0}),date:s=>bt.create({...s,coerce:!0})},any:_a,array:Sa,bigint:ya,boolean:Bi,date:va,discriminatedUnion:Oa,effect:Wi,enum:Za,function:Na,instanceof:ma,intersection:Ia,lazy:za,literal:Da,map:Pa,nan:ga,nativeEnum:La,never:$a,null:xa,nullable:Ba,number:Hi,object:Ea,oboolean:()=>Bi().optional(),onumber:()=>Hi().optional(),optional:Ha,ostring:()=>Ui().optional(),pipeline:Fa,preprocess:Wa,promise:Ua,record:Ra,set:ja,strictObject:Ca,string:Ui,symbol:ba,transformer:Wi,tuple:Ma,undefined:wa,union:Aa,unknown:ka,void:Ta,NEVER:j,ZodIssueCode:f,quotelessJson:Xr,ZodError:Te});const Yn=x.object({assistantId:x.string(),params:x.record(x.any()).default({}),config:x.object({historyKey:x.string().refine(s=>s.replace(/-/g,"_")).nullable().default("main"),welcomeMessage:x.string().default("Hello! How can I help you today?"),inactivityWarningMessage:x.string().default("Are you still there? The chat will end soon if we don't hear from you."),chatEndedMessage:x.string().default("The chat has ended. Please restart the chat to continue."),resetEndedChatOnLoad:x.boolean().default(!1),initialReplyMessage:x.string().nullable().default(null),disclaimerMessage:x.string().nullable().default(null),disclaimerPopover:x.object({message:x.string().nullable().default(null),agreeButtonText:x.string().default("I Agree"),rememberDurationMinutes:x.number().default(60*24*3)}).default({}),simulateDelays:x.boolean().default(!0),placement:x.enum(["left","right"]).default("right"),openChatButton:x.object({imageSrc:x.string().nullable().default(null),width:x.union([x.string(),x.number()]).default("48px"),height:x.union([x.string(),x.number()]).default("48px"),cta:x.string().nullable().default(null)}).default({}),chatWindow:x.object({header:x.object({text:x.string().nullable().default("AI Chat"),imageSrc:x.string().nullable().default(null)}).default({}),showCloseButton:x.boolean().default(!0)}).default({}),styles:x.object({primaryColor:x.string().nullable().default(null),textColor:x.string().nullable().default(null),linkColor:x.string().nullable().default(null),openChatButton:x.object({backgroundColor:x.string().nullable().default(null),iconColor:x.string().nullable().default(null)}).default({}),header:x.object({backgroundColor:x.string().nullable().default(null),textColor:x.string().nullable().default(null)}).default({}),button:x.object({backgroundColor:x.string().nullable().default(null),textColor:x.string().nullable().default(null)}).default({}),messages:x.object({user:x.object({backgroundColor:x.string().nullable().default(null),textColor:x.string().nullable().default(null)}).default({}),assistant:x.object({backgroundColor:x.string().nullable().default(null),textColor:x.string().nullable().default(null)}).default({})}).default({})}).default({})}).default({}),handlers:x.object({functionCalls:x.record(x.function().returns(x.union([x.any(),x.promise(x.any())]))).default({}),enhancedContent:x.record(x.function().returns(x.union([x.any(),x.promise(x.any())]))).default({})}).default({})});var Va=Object.defineProperty,Ka=Object.getOwnPropertyDescriptor,gn=(s,e,t,n)=>{for(var i=n>1?void 0:n?Ka(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Va(e,t,i),i};let kt=class extends we{constructor(){super(...arguments),this.isOpen=!1,this.onResizeHandler=()=>{this.isOpen&&window.innerWidth<768?Qr(this):Ii(this)}}connectedCallback(){super.connectedCallback(),this.cleanOptions=Yn.parse(this.options),this.onResizeHandler(),window.addEventListener("resize",this.onResizeHandler,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),Ii(this),window.removeEventListener("resize",this.onResizeHandler)}render(){const s=this.cleanOptions.config.placement!=="left",e=Mi({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=Mi({"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 H`
|
|
119
119
|
<div
|
|
120
120
|
class=${e}
|
|
121
121
|
style=${vt({zIndex:"9999",colorScheme:"normal"})}
|
|
@@ -141,11 +141,11 @@
|
|
|
141
141
|
/>
|
|
142
142
|
</div>
|
|
143
143
|
</div>
|
|
144
|
-
`}toggleChat(){this.isOpen=!this.isOpen,this.onResizeHandler()}};_t.styles=[Re],gn([ee({type:Object})],_t.prototype,"options",2),gn([ft()],_t.prototype,"isOpen",2),gn([Rn("iai-chat")],_t.prototype,"chatWindow",2),gn([$s.debounce(250)],_t.prototype,"onResizeHandler",2),_t=gn([Me("iai-chat-popup")],_t);const Gn="https://api-dev.ai.inhabit.work";async function Ja(s,e={}){return(await fetch(`${Gn}/threads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assistantId:s,params:e})})).json()}async function Qa(s,e="No reason provided"){await fetch(`${Gn}/threads/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e})})}async function Ya(s,e){return(await fetch(`${Gn}/threads/${s}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})})).json()}async function Ga(s,e,t,n=!1){return(await fetch(`${Gn}/threads/${s}/functions/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({params:t,rerunLLM:n})})).json()}function Xa(s){return{all:s=s||new Map,on:function(e,t){var n=s.get(e);n?n.push(t):s.set(e,[t])},off:function(e,t){var n=s.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var n=s.get(e);n&&n.slice().map(function(i){i(t)}),(n=s.get("*"))&&n.slice().map(function(i){i(e,t)})}}}class eo{constructor(e,t={}){if(this._assistantId="",this._conversationDetails=null,this._messages=[],this.isTyping=!1,this.inputDisabled=!1,this.chatEndingWarningSent=!1,this.chatEnded=!1,this.onStorageEvent=n=>{var i;const[r,a,o]=((i=n.key)==null?void 0:i.split("-"))||[];if(!(r!=="iaiChat"||a!==this.options.historyKey))switch(o){case"messageHistory":this.onMessageHistoryStorageEvent(n);break;case"conversation":this.setConversationDetails(JSON.parse(n.newValue||"null"),!0);break;case"lastActivity":this.keepAlive(JSON.parse(n.newValue||"null"),!0);break;case"chatEndingWarningSent":this.setChatEndingWarningSent(JSON.parse(n.newValue||"false"),!0);break;case"chatEnded":this.setChatEnded(JSON.parse(n.newValue||"false"),!0);break;case"typing":this.setTyping(JSON.parse(n.newValue||"false"),!0);break;case"inputDisabled":this.setInputDisabled(JSON.parse(n.newValue||"false"),!0);break}},this._assistantId=e,this.options={params:{},simulateDelays:!1,historyKey:"main",...t},this._emitter=Xa(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),t.events&&Object.entries(t.events).forEach(([n,i])=>{this._emitter.on(n,i)}),t.historyKey){this._messages=this.storageGet("messageHistory",[]);const n=this.storageGet("conversation");n&&this.setConversationDetails(n,!0);const i=this.storageGet("chatEndingWarningSent");i&&this.setChatEndingWarningSent(i,!0);const r=this.storageGet("chatEnded");r&&this.setChatEnded(r,!0);const a=this.storageGet("typing");a&&this.setTyping(a,!0);const o=this.storageGet("inputDisabled");o&&this.setInputDisabled(o,!0);const l=this.storageGet("lastActivity");l&&setTimeout(()=>this.keepAlive(l,!0),0),window.addEventListener("storage",this.onStorageEvent)}}onMessageHistoryStorageEvent(e){if(!e.newValue){this.reset();return}const t=JSON.parse(e.newValue),n=this._messages.map(r=>r.id),i=t.map(r=>r.id);this._messages.forEach(r=>{i.includes(r.id)||this._emitter.emit("messageRemoved",r.id)}),t.forEach(r=>{n.includes(r.id)||this._emitter.emit("message",r)}),this._messages=t}async endChat(e,t=!0){!this.threadId||this.chatEnded||(t&&(this._emitter.emit("chatEnded"),this.setChatEnded(!0)),this.stopInactivityTimers(),await Qa(this.threadId,e))}reset(e){this.endChat(e,!1).then(()=>{}),this._messages=[],this.setConversationDetails(null),this.setTyping(!1),this.setInputDisabled(!1),this.setChatEnded(!1),this.stopInactivityTimers(),this.storageRemoveAll(),this._emitter.emit("reset")}destroy(){this._emitter.all.clear(),window.removeEventListener("storage",this.onStorageEvent),this.stopInactivityTimers(),this._emitter.emit("destroy")}stopInactivityTimers(){this._inactivityTimeout&&(clearTimeout(this._inactivityTimeout),this._inactivityTimeout=null),this._inactivityWarningTimeout&&(clearTimeout(this._inactivityWarningTimeout),this._inactivityWarningTimeout=null)}keepAlive(e=Date.now(),t=!1){if(this.stopInactivityTimers(),this.chatEnded||!e)return;const{timeUntilChatEnds:n,timeUntilWarnAboutChatEnding:i}=this;if(!n)return;t||this.storageSet("lastActivity",e);const r=Date.now()-e;r>n?(this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)):r>i?(this.sendChatEndingWarning(),this._inactivityTimeout=setTimeout(()=>{this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)},n-r)):(this.setChatEndingWarningSent(!1),this._inactivityWarningTimeout=setTimeout(()=>this.sendChatEndingWarning(),i-r),this._inactivityTimeout=setTimeout(()=>{this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)},n-r))}async startChat(){if(this.chatStarted)return;const{id:e,inactivityWaitTime:t,inactivityWarningTime:n}=await Ja(this.assistantId,this.params);if(!e)throw new Error("Could not start chat");this.setConversationDetails({threadId:e,inactivityWaitTime:t,inactivityWarningTime:n})}addMessage(e){const t={...e,id:e.id||Math.random().toString(36).substring(7)};return this._messages.push(t),this.storageSet("messageHistory",this._messages),this._emitter.emit("message",t),t}removeMessage(e){this._messages=this._messages.filter(t=>t.id!==e),this.storageSet("messageHistory",this._messages),this._emitter.emit("messageRemoved",e)}async respondToFunctionCall(e,t,n){this.simulateDelay(1800).then(()=>this.setTyping(!0));const i=this.simulateDelay(2e3);this.keepAlive(),await this.insertMessagesWithSimulatedDelays(Promise.all([Ga(this.threadId,e,t,n),i]).then(([r])=>r))}async sendUserMessage(e){try{this.addMessage({role:"user",content:e}),this.simulateDelay(1800).then(()=>this.setTyping(!0));let t=this.simulateDelay(4800);if(!this.chatStarted){const{initialReplyMessage:r}=this.options;r&&(this.simulateDelay(3800).then(()=>{this.addMessage({role:"assistant",content:r}),this.setTyping(!1)}),this.simulateDelay(6200).then(()=>this.setTyping(!0)),t=this.simulateDelay(8200)),await this.startChat()}this.keepAlive();const{messages:n,functions:i}=await this.insertMessagesWithSimulatedDelays(Promise.all([Ya(this.threadId,e),t]).then(([r])=>r));return{messages:n,functions:i}}catch(t){throw console.error("Error sending message:",t),new Error("There was an error sending the message")}}setTyping(e,t=!1){this.isTyping=e,this._emitter.emit("typing",e),t||this.storageSet("typing",e)}setConversationDetails(e,t=!1){this._conversationDetails=e,t||this.storageSet("conversation",e)}setInputDisabled(e,t=!1){this.inputDisabled=e,this._emitter.emit("inputDisabled",e),t||this.storageSet("inputDisabled",e)}setChatEnded(e,t=!1){this.chatEnded=e,t||this.storageSet("chatEnded",e)}setChatEndingWarningSent(e,t=!1){this.chatEndingWarningSent=e,t||this.storageSet("chatEndingWarningSent",e)}sendChatEndingWarning(){this.chatEndingWarningSent||(this._emitter.emit("inactivityWarning"),this.setChatEndingWarningSent(!0))}async insertMessagesWithSimulatedDelays(e){const t=await e;if(t.error)throw new Error(t.message);const{messages:n,functions:i}=t;return await Promise.all(n.map(async(r,a)=>(await this.simulateDelay(1e3*a),this.addMessage(r)))),this.setTyping(!1),i.forEach(r=>this._emitter.emit("functionCall",r)),{messages:n,functions:i}}simulateDelay(e){return this.options.simulateDelays?new Promise(t=>{setTimeout(t,e)}):Promise.resolve()}get assistantId(){return this._assistantId}get params(){return this.options.params}get threadId(){var e;return(e=this._conversationDetails)==null?void 0:e.threadId}get timeUntilChatEnds(){const{inactivityWaitTime:e}=this._conversationDetails||{};return e?e*60*1e3:null}get timeUntilWarnAboutChatEnding(){const{inactivityWaitTime:e=0,inactivityWarningTime:t=0}=this._conversationDetails||{};return(e-t)*60*1e3}get messages(){return this._messages}get chatStarted(){return!!this.threadId}storageSet(e,t){this.options.historyKey&&localStorage.setItem(`iaiChat-${this.options.historyKey}-${e}`,JSON.stringify(t))}storageGet(e,t=null){if(!this.options.historyKey)return null;const n=localStorage.getItem(`iaiChat-${this.options.historyKey}-${e}`);return n?JSON.parse(n):t}storageRemove(e){localStorage.removeItem(`iaiChat-${this.options.historyKey}-${e}`)}storageRemoveAll(){this.options.historyKey&&Object.keys(localStorage).forEach(e=>{e.startsWith(`iaiChat-${this.options.historyKey}-`)&&localStorage.removeItem(e)})}}var Fi={exports:{}};(function(s,e){(function(t,n){s.exports=n()})(Xr,function(){var t=1e3,n=6e4,i=36e5,r="millisecond",a="second",o="minute",l="hour",d="day",u="week",p="month",c="quarter",m="year",R="date",F="Invalid Date",ae=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,De=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Bt={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(I){var w=["th","st","nd","rd"],g=I%100;return"["+I+(w[(g-20)%10]||w[g]||w[0])+"]"}},rt=function(I,w,g){var $=String(I);return!$||$.length>=w?I:""+Array(w+1-$.length).join(g)+I},Wt={s:rt,z:function(I){var w=-I.utcOffset(),g=Math.abs(w),$=Math.floor(g/60),v=g%60;return(w<=0?"+":"-")+rt($,2,"0")+":"+rt(v,2,"0")},m:function I(w,g){if(w.date()<g.date())return-I(g,w);var $=12*(g.year()-w.year())+(g.month()-w.month()),v=w.clone().add($,p),P=g-v<0,S=w.clone().add($+(P?-1:1),p);return+(-($+(g-v)/(P?v-S:S-v))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:p,y:m,w:u,d,D:R,h:l,m:o,s:a,ms:r,Q:c}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},$e="en",z={};z[$e]=Bt;var Cn="$isDayjsObject",ye=function(I){return I instanceof Ct||!(!I||!I[Cn])},at=function I(w,g,$){var v;if(!w)return $e;if(typeof w=="string"){var P=w.toLowerCase();z[P]&&(v=P),g&&(z[P]=g,v=P);var S=w.split("-");if(!v&&S.length>1)return I(S[0])}else{var K=w.name;z[K]=w,v=K}return!$&&v&&($e=v),v||!$&&$e},oe=function(I,w){if(ye(I))return I.clone();var g=typeof w=="object"?w:{};return g.date=I,g.args=arguments,new Ct(g)},W=Wt;W.l=at,W.i=ye,W.w=function(I,w){return oe(I,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var Ct=function(){function I(g){this.$L=at(g.locale,null,!0),this.parse(g),this.$x=this.$x||g.x||{},this[Cn]=!0}var w=I.prototype;return w.parse=function(g){this.$d=function($){var v=$.date,P=$.utc;if(v===null)return new Date(NaN);if(W.u(v))return new Date;if(v instanceof Date)return new Date(v);if(typeof v=="string"&&!/Z$/i.test(v)){var S=v.match(ae);if(S){var K=S[2]-1||0,ne=(S[7]||"0").substring(0,3);return P?new Date(Date.UTC(S[1],K,S[3]||1,S[4]||0,S[5]||0,S[6]||0,ne)):new Date(S[1],K,S[3]||1,S[4]||0,S[5]||0,S[6]||0,ne)}}return new Date(v)}(g),this.init()},w.init=function(){var g=this.$d;this.$y=g.getFullYear(),this.$M=g.getMonth(),this.$D=g.getDate(),this.$W=g.getDay(),this.$H=g.getHours(),this.$m=g.getMinutes(),this.$s=g.getSeconds(),this.$ms=g.getMilliseconds()},w.$utils=function(){return W},w.isValid=function(){return this.$d.toString()!==F},w.isSame=function(g,$){var v=oe(g);return this.startOf($)<=v&&v<=this.endOf($)},w.isAfter=function(g,$){return oe(g)<this.startOf($)},w.isBefore=function(g,$){return this.endOf($)<oe(g)},w.$g=function(g,$,v){return W.u(g)?this[$]:this.set(v,g)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(g,$){var v=this,P=!!W.u($)||$,S=W.p(g),K=function(Ze,ue){var Le=W.w(v.$u?Date.UTC(v.$y,ue,Ze):new Date(v.$y,ue,Ze),v);return P?Le:Le.endOf(d)},ne=function(Ze,ue){return W.w(v.toDate()[Ze].apply(v.toDate("s"),(P?[0,0,0,0]:[23,59,59,999]).slice(ue)),v)},se=this.$W,le=this.$M,fe=this.$D,ot="set"+(this.$u?"UTC":"");switch(S){case m:return P?K(1,0):K(31,11);case p:return P?K(1,le):K(0,le+1);case u:var Ke=this.$locale().weekStart||0,At=(se<Ke?se+7:se)-Ke;return K(P?fe-At:fe+(6-At),le);case d:case R:return ne(ot+"Hours",0);case l:return ne(ot+"Minutes",1);case o:return ne(ot+"Seconds",2);case a:return ne(ot+"Milliseconds",3);default:return this.clone()}},w.endOf=function(g){return this.startOf(g,!1)},w.$set=function(g,$){var v,P=W.p(g),S="set"+(this.$u?"UTC":""),K=(v={},v[d]=S+"Date",v[R]=S+"Date",v[p]=S+"Month",v[m]=S+"FullYear",v[l]=S+"Hours",v[o]=S+"Minutes",v[a]=S+"Seconds",v[r]=S+"Milliseconds",v)[P],ne=P===d?this.$D+($-this.$W):$;if(P===p||P===m){var se=this.clone().set(R,1);se.$d[K](ne),se.init(),this.$d=se.set(R,Math.min(this.$D,se.daysInMonth())).$d}else K&&this.$d[K](ne);return this.init(),this},w.set=function(g,$){return this.clone().$set(g,$)},w.get=function(g){return this[W.p(g)]()},w.add=function(g,$){var v,P=this;g=Number(g);var S=W.p($),K=function(le){var fe=oe(P);return W.w(fe.date(fe.date()+Math.round(le*g)),P)};if(S===p)return this.set(p,this.$M+g);if(S===m)return this.set(m,this.$y+g);if(S===d)return K(1);if(S===u)return K(7);var ne=(v={},v[o]=n,v[l]=i,v[a]=t,v)[S]||1,se=this.$d.getTime()+g*ne;return W.w(se,this)},w.subtract=function(g,$){return this.add(-1*g,$)},w.format=function(g){var $=this,v=this.$locale();if(!this.isValid())return v.invalidDate||F;var P=g||"YYYY-MM-DDTHH:mm:ssZ",S=W.z(this),K=this.$H,ne=this.$m,se=this.$M,le=v.weekdays,fe=v.months,ot=v.meridiem,Ke=function(ue,Le,qe,Vt){return ue&&(ue[Le]||ue($,P))||qe[Le].slice(0,Vt)},At=function(ue){return W.s(K%12||12,ue,"0")},Ze=ot||function(ue,Le,qe){var Vt=ue<12?"AM":"PM";return qe?Vt.toLowerCase():Vt};return P.replace(De,function(ue,Le){return Le||function(qe){switch(qe){case"YY":return String($.$y).slice(-2);case"YYYY":return W.s($.$y,4,"0");case"M":return se+1;case"MM":return W.s(se+1,2,"0");case"MMM":return Ke(v.monthsShort,se,fe,3);case"MMMM":return Ke(fe,se);case"D":return $.$D;case"DD":return W.s($.$D,2,"0");case"d":return String($.$W);case"dd":return Ke(v.weekdaysMin,$.$W,le,2);case"ddd":return Ke(v.weekdaysShort,$.$W,le,3);case"dddd":return le[$.$W];case"H":return String(K);case"HH":return W.s(K,2,"0");case"h":return At(1);case"hh":return At(2);case"a":return Ze(K,ne,!0);case"A":return Ze(K,ne,!1);case"m":return String(ne);case"mm":return W.s(ne,2,"0");case"s":return String($.$s);case"ss":return W.s($.$s,2,"0");case"SSS":return W.s($.$ms,3,"0");case"Z":return S}return null}(ue)||S.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(g,$,v){var P,S=this,K=W.p($),ne=oe(g),se=(ne.utcOffset()-this.utcOffset())*n,le=this-ne,fe=function(){return W.m(S,ne)};switch(K){case m:P=fe()/12;break;case p:P=fe();break;case c:P=fe()/3;break;case u:P=(le-se)/6048e5;break;case d:P=(le-se)/864e5;break;case l:P=le/i;break;case o:P=le/n;break;case a:P=le/t;break;default:P=le}return v?P:W.a(P)},w.daysInMonth=function(){return this.endOf(p).$D},w.$locale=function(){return z[this.$L]},w.locale=function(g,$){if(!g)return this.$L;var v=this.clone(),P=at(g,$,!0);return P&&(v.$L=P),v},w.clone=function(){return W.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},I}(),Ft=Ct.prototype;return oe.prototype=Ft,[["$ms",r],["$s",a],["$m",o],["$H",l],["$W",d],["$M",p],["$y",m],["$D",R]].forEach(function(I){Ft[I[1]]=function(w){return this.$g(w,I[0],I[1])}}),oe.extend=function(I,w){return I.$i||(I(w,Ct,oe),I.$i=!0),oe},oe.locale=at,oe.isDayjs=ye,oe.unix=function(I){return oe(1e3*I)},oe.en=z[$e],oe.Ls=z,oe.p={},oe})})(Fi);var to=Fi.exports;const Vi=Pi(to);/**
|
|
144
|
+
`}toggleChat(){this.isOpen=!this.isOpen,this.onResizeHandler()}};kt.styles=[He],gn([ne({type:Object})],kt.prototype,"options",2),gn([ft()],kt.prototype,"isOpen",2),gn([Rn("iai-chat")],kt.prototype,"chatWindow",2),gn([ks.debounce(250)],kt.prototype,"onResizeHandler",2),kt=gn([Ue("iai-chat-popup")],kt);const Gn="https://api-dev.ai.inhabit.work";async function qa(s,e={}){return(await fetch(`${Gn}/threads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assistantId:s,params:e})})).json()}async function Ja(s,e="No reason provided"){await fetch(`${Gn}/threads/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:e})})}async function Qa(s,e){return(await fetch(`${Gn}/threads/${s}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})})).json()}async function Ya(s,e,t,n=!1){return(await fetch(`${Gn}/threads/${s}/functions/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({params:t,rerunLLM:n})})).json()}function Ga(s){return{all:s=s||new Map,on:function(e,t){var n=s.get(e);n?n.push(t):s.set(e,[t])},off:function(e,t){var n=s.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var n=s.get(e);n&&n.slice().map(function(i){i(t)}),(n=s.get("*"))&&n.slice().map(function(i){i(e,t)})}}}class Xa{constructor(e,t={}){if(this._assistantId="",this._conversationDetails=null,this._messages=[],this.isTyping=!1,this.inputDisabled=!1,this.chatEndingWarningSent=!1,this.chatEnded=!1,this.onStorageEvent=n=>{var i;const[r,a,o]=((i=n.key)==null?void 0:i.split("-"))||[];if(!(r!=="iaiChat"||a!==this.options.historyKey))switch(o){case"messageHistory":this.onMessageHistoryStorageEvent(n);break;case"conversation":this.setConversationDetails(JSON.parse(n.newValue||"null"),!0);break;case"lastActivity":this.keepAlive(JSON.parse(n.newValue||"null"),!0);break;case"chatEndingWarningSent":this.setChatEndingWarningSent(JSON.parse(n.newValue||"false"),!0);break;case"chatEnded":this.setChatEnded(JSON.parse(n.newValue||"false"),!0);break;case"typing":this.setTyping(JSON.parse(n.newValue||"false"),!0);break;case"inputDisabled":this.setInputDisabled(JSON.parse(n.newValue||"false"),!0);break}},this._assistantId=e,this.options={params:{},simulateDelays:!1,resetEndedChatOnLoad:!1,historyKey:"main",...t},this._emitter=Ga(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),t.events&&Object.entries(t.events).forEach(([n,i])=>{this._emitter.on(n,i)}),t.historyKey){this._messages=this.storageGet("messageHistory",[]);const n=this.storageGet("conversation");n&&this.setConversationDetails(n,!0);const i=this.storageGet("chatEndingWarningSent");i&&this.setChatEndingWarningSent(i,!0);const r=this.storageGet("chatEnded");r&&this.setChatEnded(r,!0);const a=this.storageGet("typing");a&&this.setTyping(a,!0);const o=this.storageGet("inputDisabled");o&&this.setInputDisabled(o,!0);const l=this.storageGet("lastActivity");l&&setTimeout(()=>this.keepAlive(l,!0),0),setTimeout(()=>{this.chatEnded&&this.options.resetEndedChatOnLoad&&this.reset()},0),window.addEventListener("storage",this.onStorageEvent)}}onMessageHistoryStorageEvent(e){if(!e.newValue){this.reset();return}const t=JSON.parse(e.newValue),n=this._messages.map(r=>r.id),i=t.map(r=>r.id);this._messages.forEach(r=>{i.includes(r.id)||this._emitter.emit("messageRemoved",r.id)}),t.forEach(r=>{n.includes(r.id)||this._emitter.emit("message",r)}),this._messages=t}async endChat(e,t=!0){!this.threadId||this.chatEnded||(t&&(this._emitter.emit("chatEnded"),this.setChatEnded(!0)),this.stopInactivityTimers(),await Ja(this.threadId,e))}reset(e){this.endChat(e,!1).then(()=>{}),this._messages=[],this.setConversationDetails(null),this.setTyping(!1),this.setInputDisabled(!1),this.setChatEnded(!1),this.stopInactivityTimers(),this.storageRemoveAll(),this._emitter.emit("reset")}destroy(){this._emitter.all.clear(),window.removeEventListener("storage",this.onStorageEvent),this.stopInactivityTimers(),this._emitter.emit("destroy")}stopInactivityTimers(){this._inactivityTimeout&&(clearTimeout(this._inactivityTimeout),this._inactivityTimeout=null),this._inactivityWarningTimeout&&(clearTimeout(this._inactivityWarningTimeout),this._inactivityWarningTimeout=null)}keepAlive(e=Date.now(),t=!1){if(this.stopInactivityTimers(),this.chatEnded||!e)return;const{timeUntilChatEnds:n,timeUntilWarnAboutChatEnding:i}=this;if(!n)return;t||this.storageSet("lastActivity",e);const r=Date.now()-e;r>n?(this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)):r>i?(this.sendChatEndingWarning(),this._inactivityTimeout=setTimeout(()=>{this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)},n-r)):(this.setChatEndingWarningSent(!1),this._inactivityWarningTimeout=setTimeout(()=>this.sendChatEndingWarning(),i-r),this._inactivityTimeout=setTimeout(()=>{this.chatEnded||this._emitter.emit("chatEnded"),this.setChatEnded(!0)},n-r))}async startChat(){if(this.chatStarted)return;const{id:e,inactivityWaitTime:t,inactivityWarningTime:n}=await qa(this.assistantId,this.params);if(!e)throw new Error("Could not start chat");this.setConversationDetails({threadId:e,inactivityWaitTime:t,inactivityWarningTime:n})}addMessage(e){const t={...e,id:e.id||Math.random().toString(36).substring(7)};return this._messages.push(t),this.storageSet("messageHistory",this._messages),this._emitter.emit("message",t),t}removeMessage(e){this._messages=this._messages.filter(t=>t.id!==e),this.storageSet("messageHistory",this._messages),this._emitter.emit("messageRemoved",e)}async respondToFunctionCall(e,t,n){this.simulateDelay(1800).then(()=>this.setTyping(!0));const i=this.simulateDelay(2e3);this.keepAlive(),await this.insertMessagesWithSimulatedDelays(Promise.all([Ya(this.threadId,e,t,n),i]).then(([r])=>r))}async sendUserMessage(e){try{this.addMessage({role:"user",content:e}),this.simulateDelay(1800).then(()=>this.setTyping(!0));let t=this.simulateDelay(4800);if(!this.chatStarted){const{initialReplyMessage:r}=this.options;r&&(this.simulateDelay(3800).then(()=>{this.addMessage({role:"assistant",content:r}),this.setTyping(!1)}),this.simulateDelay(6200).then(()=>this.setTyping(!0)),t=this.simulateDelay(8200)),await this.startChat()}this.keepAlive();const{messages:n,functions:i}=await this.insertMessagesWithSimulatedDelays(Promise.all([Qa(this.threadId,e),t]).then(([r])=>r));return{messages:n,functions:i}}catch(t){throw console.error("Error sending message:",t),new Error("There was an error sending the message")}}setTyping(e,t=!1){this.isTyping=e,this._emitter.emit("typing",e),t||this.storageSet("typing",e)}setConversationDetails(e,t=!1){this._conversationDetails=e,t||this.storageSet("conversation",e)}setInputDisabled(e,t=!1){this.inputDisabled=e,this._emitter.emit("inputDisabled",e),t||this.storageSet("inputDisabled",e)}setChatEnded(e,t=!1){this.chatEnded=e,t||this.storageSet("chatEnded",e)}setChatEndingWarningSent(e,t=!1){this.chatEndingWarningSent=e,t||this.storageSet("chatEndingWarningSent",e)}sendChatEndingWarning(){this.chatEndingWarningSent||(this._emitter.emit("inactivityWarning"),this.setChatEndingWarningSent(!0))}async insertMessagesWithSimulatedDelays(e){const t=await e;if(t.error)throw new Error(t.message);const{messages:n,functions:i}=t;return await Promise.all(n.map(async(r,a)=>(await this.simulateDelay(1e3*a),this.addMessage(r)))),this.setTyping(!1),i.forEach(r=>this._emitter.emit("functionCall",r)),{messages:n,functions:i}}simulateDelay(e){return this.options.simulateDelays?new Promise(t=>{setTimeout(t,e)}):Promise.resolve()}get assistantId(){return this._assistantId}get params(){return this.options.params}get threadId(){var e;return(e=this._conversationDetails)==null?void 0:e.threadId}get timeUntilChatEnds(){const{inactivityWaitTime:e}=this._conversationDetails||{};return e?e*60*1e3:null}get timeUntilWarnAboutChatEnding(){const{inactivityWaitTime:e=0,inactivityWarningTime:t=0}=this._conversationDetails||{};return(e-t)*60*1e3}get messages(){return this._messages}get chatStarted(){return!!this.threadId}storageSet(e,t){this.options.historyKey&&localStorage.setItem(`iaiChat-${this.options.historyKey}-${e}`,JSON.stringify(t))}storageGet(e,t=null){if(!this.options.historyKey)return null;const n=localStorage.getItem(`iaiChat-${this.options.historyKey}-${e}`);return n?JSON.parse(n):t}storageRemove(e){localStorage.removeItem(`iaiChat-${this.options.historyKey}-${e}`)}storageRemoveAll(){this.options.historyKey&&Object.keys(localStorage).forEach(e=>{e.startsWith(`iaiChat-${this.options.historyKey}-`)&&localStorage.removeItem(e)})}}var Fi={exports:{}};(function(s,e){(function(t,n){s.exports=n()})(Gr,function(){var t=1e3,n=6e4,i=36e5,r="millisecond",a="second",o="minute",l="hour",d="day",u="week",p="month",c="quarter",m="year",R="date",F="Invalid Date",ae=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Ne=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Bt={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(I){var w=["th","st","nd","rd"],g=I%100;return"["+I+(w[(g-20)%10]||w[g]||w[0])+"]"}},it=function(I,w,g){var $=String(I);return!$||$.length>=w?I:""+Array(w+1-$.length).join(g)+I},Wt={s:it,z:function(I){var w=-I.utcOffset(),g=Math.abs(w),$=Math.floor(g/60),v=g%60;return(w<=0?"+":"-")+it($,2,"0")+":"+it(v,2,"0")},m:function I(w,g){if(w.date()<g.date())return-I(g,w);var $=12*(g.year()-w.year())+(g.month()-w.month()),v=w.clone().add($,p),P=g-v<0,S=w.clone().add($+(P?-1:1),p);return+(-($+(g-v)/(P?v-S:S-v))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:p,y:m,w:u,d,D:R,h:l,m:o,s:a,ms:r,Q:c}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},$e="en",z={};z[$e]=Bt;var Cn="$isDayjsObject",ye=function(I){return I instanceof Ct||!(!I||!I[Cn])},rt=function I(w,g,$){var v;if(!w)return $e;if(typeof w=="string"){var P=w.toLowerCase();z[P]&&(v=P),g&&(z[P]=g,v=P);var S=w.split("-");if(!v&&S.length>1)return I(S[0])}else{var K=w.name;z[K]=w,v=K}return!$&&v&&($e=v),v||!$&&$e},oe=function(I,w){if(ye(I))return I.clone();var g=typeof w=="object"?w:{};return g.date=I,g.args=arguments,new Ct(g)},W=Wt;W.l=rt,W.i=ye,W.w=function(I,w){return oe(I,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var Ct=function(){function I(g){this.$L=rt(g.locale,null,!0),this.parse(g),this.$x=this.$x||g.x||{},this[Cn]=!0}var w=I.prototype;return w.parse=function(g){this.$d=function($){var v=$.date,P=$.utc;if(v===null)return new Date(NaN);if(W.u(v))return new Date;if(v instanceof Date)return new Date(v);if(typeof v=="string"&&!/Z$/i.test(v)){var S=v.match(ae);if(S){var K=S[2]-1||0,te=(S[7]||"0").substring(0,3);return P?new Date(Date.UTC(S[1],K,S[3]||1,S[4]||0,S[5]||0,S[6]||0,te)):new Date(S[1],K,S[3]||1,S[4]||0,S[5]||0,S[6]||0,te)}}return new Date(v)}(g),this.init()},w.init=function(){var g=this.$d;this.$y=g.getFullYear(),this.$M=g.getMonth(),this.$D=g.getDate(),this.$W=g.getDay(),this.$H=g.getHours(),this.$m=g.getMinutes(),this.$s=g.getSeconds(),this.$ms=g.getMilliseconds()},w.$utils=function(){return W},w.isValid=function(){return this.$d.toString()!==F},w.isSame=function(g,$){var v=oe(g);return this.startOf($)<=v&&v<=this.endOf($)},w.isAfter=function(g,$){return oe(g)<this.startOf($)},w.isBefore=function(g,$){return this.endOf($)<oe(g)},w.$g=function(g,$,v){return W.u(g)?this[$]:this.set(v,g)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(g,$){var v=this,P=!!W.u($)||$,S=W.p(g),K=function(ze,ue){var De=W.w(v.$u?Date.UTC(v.$y,ue,ze):new Date(v.$y,ue,ze),v);return P?De:De.endOf(d)},te=function(ze,ue){return W.w(v.toDate()[ze].apply(v.toDate("s"),(P?[0,0,0,0]:[23,59,59,999]).slice(ue)),v)},se=this.$W,le=this.$M,fe=this.$D,at="set"+(this.$u?"UTC":"");switch(S){case m:return P?K(1,0):K(31,11);case p:return P?K(1,le):K(0,le+1);case u:var Ke=this.$locale().weekStart||0,At=(se<Ke?se+7:se)-Ke;return K(P?fe-At:fe+(6-At),le);case d:case R:return te(at+"Hours",0);case l:return te(at+"Minutes",1);case o:return te(at+"Seconds",2);case a:return te(at+"Milliseconds",3);default:return this.clone()}},w.endOf=function(g){return this.startOf(g,!1)},w.$set=function(g,$){var v,P=W.p(g),S="set"+(this.$u?"UTC":""),K=(v={},v[d]=S+"Date",v[R]=S+"Date",v[p]=S+"Month",v[m]=S+"FullYear",v[l]=S+"Hours",v[o]=S+"Minutes",v[a]=S+"Seconds",v[r]=S+"Milliseconds",v)[P],te=P===d?this.$D+($-this.$W):$;if(P===p||P===m){var se=this.clone().set(R,1);se.$d[K](te),se.init(),this.$d=se.set(R,Math.min(this.$D,se.daysInMonth())).$d}else K&&this.$d[K](te);return this.init(),this},w.set=function(g,$){return this.clone().$set(g,$)},w.get=function(g){return this[W.p(g)]()},w.add=function(g,$){var v,P=this;g=Number(g);var S=W.p($),K=function(le){var fe=oe(P);return W.w(fe.date(fe.date()+Math.round(le*g)),P)};if(S===p)return this.set(p,this.$M+g);if(S===m)return this.set(m,this.$y+g);if(S===d)return K(1);if(S===u)return K(7);var te=(v={},v[o]=n,v[l]=i,v[a]=t,v)[S]||1,se=this.$d.getTime()+g*te;return W.w(se,this)},w.subtract=function(g,$){return this.add(-1*g,$)},w.format=function(g){var $=this,v=this.$locale();if(!this.isValid())return v.invalidDate||F;var P=g||"YYYY-MM-DDTHH:mm:ssZ",S=W.z(this),K=this.$H,te=this.$m,se=this.$M,le=v.weekdays,fe=v.months,at=v.meridiem,Ke=function(ue,De,qe,Vt){return ue&&(ue[De]||ue($,P))||qe[De].slice(0,Vt)},At=function(ue){return W.s(K%12||12,ue,"0")},ze=at||function(ue,De,qe){var Vt=ue<12?"AM":"PM";return qe?Vt.toLowerCase():Vt};return P.replace(Ne,function(ue,De){return De||function(qe){switch(qe){case"YY":return String($.$y).slice(-2);case"YYYY":return W.s($.$y,4,"0");case"M":return se+1;case"MM":return W.s(se+1,2,"0");case"MMM":return Ke(v.monthsShort,se,fe,3);case"MMMM":return Ke(fe,se);case"D":return $.$D;case"DD":return W.s($.$D,2,"0");case"d":return String($.$W);case"dd":return Ke(v.weekdaysMin,$.$W,le,2);case"ddd":return Ke(v.weekdaysShort,$.$W,le,3);case"dddd":return le[$.$W];case"H":return String(K);case"HH":return W.s(K,2,"0");case"h":return At(1);case"hh":return At(2);case"a":return ze(K,te,!0);case"A":return ze(K,te,!1);case"m":return String(te);case"mm":return W.s(te,2,"0");case"s":return String($.$s);case"ss":return W.s($.$s,2,"0");case"SSS":return W.s($.$ms,3,"0");case"Z":return S}return null}(ue)||S.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(g,$,v){var P,S=this,K=W.p($),te=oe(g),se=(te.utcOffset()-this.utcOffset())*n,le=this-te,fe=function(){return W.m(S,te)};switch(K){case m:P=fe()/12;break;case p:P=fe();break;case c:P=fe()/3;break;case u:P=(le-se)/6048e5;break;case d:P=(le-se)/864e5;break;case l:P=le/i;break;case o:P=le/n;break;case a:P=le/t;break;default:P=le}return v?P:W.a(P)},w.daysInMonth=function(){return this.endOf(p).$D},w.$locale=function(){return z[this.$L]},w.locale=function(g,$){if(!g)return this.$L;var v=this.clone(),P=rt(g,$,!0);return P&&(v.$L=P),v},w.clone=function(){return W.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},I}(),Ft=Ct.prototype;return oe.prototype=Ft,[["$ms",r],["$s",a],["$m",o],["$H",l],["$W",d],["$M",p],["$y",m],["$D",R]].forEach(function(I){Ft[I[1]]=function(w){return this.$g(w,I[0],I[1])}}),oe.extend=function(I,w){return I.$i||(I(w,Ct,oe),I.$i=!0),oe},oe.locale=rt,oe.isDayjs=ye,oe.unix=function(I){return oe(1e3*I)},oe.en=z[$e],oe.Ls=z,oe.p={},oe})})(Fi);var eo=Fi.exports;const Vi=Pi(eo);/**
|
|
145
145
|
* @license
|
|
146
146
|
* Copyright 2021 Google LLC
|
|
147
147
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
148
|
-
*/function Fe(s,e,t){return s?e(s):t==null?void 0:t(s)}function
|
|
148
|
+
*/function Fe(s,e,t){return s?e(s):t==null?void 0:t(s)}function to(s){return{all:s=s||new Map,on:function(e,t){var n=s.get(e);n?n.push(t):s.set(e,[t])},off:function(e,t){var n=s.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var n=s.get(e);n&&n.slice().map(function(i){i(t)}),(n=s.get("*"))&&n.slice().map(function(i){i(e,t)})}}}const yn=H`
|
|
149
149
|
<svg
|
|
150
150
|
xmlns="http://www.w3.org/2000/svg"
|
|
151
151
|
viewBox="0 0 24 24"
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
<path
|
|
158
158
|
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"/>
|
|
159
159
|
</svg>
|
|
160
|
-
`,
|
|
160
|
+
`,no=H`
|
|
161
161
|
<svg
|
|
162
162
|
xmlns="http://www.w3.org/2000/svg"
|
|
163
163
|
viewBox="0 0 24 24"
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
<path
|
|
170
170
|
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"/>
|
|
171
171
|
</svg>
|
|
172
|
-
`,
|
|
172
|
+
`,so=H`
|
|
173
173
|
<svg
|
|
174
174
|
xmlns="http://www.w3.org/2000/svg"
|
|
175
175
|
viewBox="0 0 24 24"
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
<title>send</title>
|
|
181
181
|
<path d="M2,21L23,12L2,3V10L17,12L2,14V21Z"/>
|
|
182
182
|
</svg>
|
|
183
|
-
`,
|
|
183
|
+
`,io=H`
|
|
184
184
|
<svg
|
|
185
185
|
xmlns="http://www.w3.org/2000/svg"
|
|
186
186
|
viewBox="0 0 24 24"
|
|
@@ -191,7 +191,60 @@
|
|
|
191
191
|
<title>refresh</title>
|
|
192
192
|
<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" />
|
|
193
193
|
</svg>
|
|
194
|
-
|
|
194
|
+
`;/**
|
|
195
|
+
* @license
|
|
196
|
+
* Copyright 2017 Google LLC
|
|
197
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
198
|
+
*/class As extends Nn{constructor(e){if(super(e),this.it=re,e.type!==Pn.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===re||e==null)return this._t=void 0,this.it=e;if(e===Ie)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:[]}}}As.directiveName="unsafeHTML",As.resultType=1;const ro=jn(As);function Os(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let $t=Os();function Ki(s){$t=s}const qi=/[&<>"']/,ao=new RegExp(qi.source,"g"),Ji=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,oo=new RegExp(Ji.source,"g"),lo={"&":"&","<":"<",">":">",'"':""","'":"'"},Qi=s=>lo[s];function xe(s,e){if(e){if(qi.test(s))return s.replace(ao,Qi)}else if(Ji.test(s))return s.replace(oo,Qi);return s}const co=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function uo(s){return s.replace(co,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const ho=/(^|[^\[])\^/g;function J(s,e){let t=typeof s=="string"?s:s.source;e=e||"";const n={replace:(i,r)=>{let a=typeof r=="string"?r:r.source;return a=a.replace(ho,"$1"),t=t.replace(i,a),n},getRegex:()=>new RegExp(t,e)};return n}function Yi(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}const vn={exec:()=>null};function Gi(s,e){const t=s.replace(/\|/g,(r,a,o)=>{let l=!1,d=a;for(;--d>=0&&o[d]==="\\";)l=!l;return l?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Xn(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const r=s.charAt(n-i-1);if(r===e&&!t)i++;else if(r!==e&&t)i++;else break}return s.slice(0,n-i)}function po(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function Xi(s,e,t,n){const i=e.href,r=e.title?xe(e.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const o={type:"link",raw:t,href:i,title:r,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,o}return{type:"image",raw:t,href:i,title:r,text:xe(a)}}function fo(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
|
199
|
+
`).map(i=>{const r=i.match(/^\s+/);if(r===null)return i;const[a]=r;return a.length>=n.length?i.slice(n.length):i}).join(`
|
|
200
|
+
`)}class es{constructor(e){Y(this,"options"),Y(this,"rules"),Y(this,"lexer"),this.options=e||$t}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Xn(n,`
|
|
201
|
+
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=fo(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=Xn(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
202
|
+
$1`);n=Xn(n.replace(/^ *>[ \t]?/gm,""),`
|
|
203
|
+
`);const i=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:r,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const a=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let o="",l="",d=!1;for(;e;){let u=!1;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let p=t[2].split(`
|
|
204
|
+
`,1)[0].replace(/^\t+/,Ne=>" ".repeat(3*Ne.length)),c=e.split(`
|
|
205
|
+
`,1)[0],m=0;this.options.pedantic?(m=2,l=p.trimStart()):(m=t[2].search(/[^ ]/),m=m>4?1:m,l=p.slice(m),m+=t[1].length);let R=!1;if(!p&&/^ *$/.test(c)&&(o+=c+`
|
|
206
|
+
`,e=e.substring(c.length+1),u=!0),!u){const Ne=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),Bt=new RegExp(`^ {0,${Math.min(3,m-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),it=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:\`\`\`|~~~)`),Wt=new RegExp(`^ {0,${Math.min(3,m-1)}}#`);for(;e;){const $e=e.split(`
|
|
207
|
+
`,1)[0];if(c=$e,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),it.test(c)||Wt.test(c)||Ne.test(c)||Bt.test(e))break;if(c.search(/[^ ]/)>=m||!c.trim())l+=`
|
|
208
|
+
`+c.slice(m);else{if(R||p.search(/[^ ]/)>=4||it.test(p)||Wt.test(p)||Bt.test(p))break;l+=`
|
|
209
|
+
`+c}!R&&!c.trim()&&(R=!0),o+=$e+`
|
|
210
|
+
`,e=e.substring($e.length+1),p=c.slice(m)}}r.loose||(d?r.loose=!0:/\n *\n *$/.test(o)&&(d=!0));let F=null,ae;this.options.gfm&&(F=/^\[[ xX]\] /.exec(l),F&&(ae=F[0]!=="[ ] ",l=l.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:o,task:!!F,checked:ae,loose:!1,text:l,tokens:[]}),r.raw+=o}r.items[r.items.length-1].raw=o.trimEnd(),r.items[r.items.length-1].text=l.trimEnd(),r.raw=r.raw.trimEnd();for(let u=0;u<r.items.length;u++)if(this.lexer.state.top=!1,r.items[u].tokens=this.lexer.blockTokens(r.items[u].text,[]),!r.loose){const p=r.items[u].tokens.filter(m=>m.type==="space"),c=p.length>0&&p.some(m=>/\n.*\n/.test(m.raw));r.loose=c}if(r.loose)for(let u=0;u<r.items.length;u++)r.items[u].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=Gi(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
211
|
+
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const o of i)/^ *-+: *$/.test(o)?a.align.push("right"):/^ *:-+: *$/.test(o)?a.align.push("center"):/^ *:-+ *$/.test(o)?a.align.push("left"):a.align.push(null);for(const o of n)a.header.push({text:o,tokens:this.lexer.inline(o)});for(const o of r)a.rows.push(Gi(o,a.header.length).map(l=>({text:l,tokens:this.lexer.inline(l)})));return a}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
|
|
212
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:xe(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=Xn(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=po(t[2],"()");if(a>-1){const o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],r=a[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),Xi(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const i=(n[2]||n[1]).replace(/\s+/g," "),r=t[i.toLowerCase()];if(!r){const a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Xi(n,r,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){const r=[...i[0]].length-1;let a,o,l=r,d=0;const u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+r);(i=u.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=[...a].length,i[3]||i[4]){l+=o;continue}else if((i[5]||i[6])&&r%3&&!((r+o)%3)){d+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+d);const p=[...i[0]][0].length,c=e.slice(0,r+i.index+p+o);if(Math.min(r,o)%2){const R=c.slice(1,-1);return{type:"em",raw:c,text:R,tokens:this.lexer.inlineTokens(R)}}const m=c.slice(2,-2);return{type:"strong",raw:c,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),r=/^ /.test(n)&&/ $/.test(n);return i&&r&&(n=n.substring(1,n.length-1)),n=xe(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=xe(t[1]),i="mailto:"+n):(n=xe(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var t;let n;if(n=this.rules.inline.url.exec(e)){let i,r;if(n[2]==="@")i=xe(n[0]),r="mailto:"+i;else{let a;do a=n[0],n[0]=((t=this.rules.inline._backpedal.exec(n[0]))==null?void 0:t[0])??"";while(a!==n[0]);i=xe(n[0]),n[1]==="www."?r="http://"+n[0]:r=n[0]}return{type:"link",raw:n[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=xe(t[0]),{type:"text",raw:t[0],text:n}}}}const mo=/^(?: *(?:\n|$))+/,go=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,yo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,bn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,vo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,er=/(?:[*+-]|\d{1,9}[.)])/,tr=J(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,er).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Is=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,bo=/^[^\n]+/,Ms=/(?!\s*\])(?:\\.|[^\[\]\\])+/,wo=J(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Ms).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),xo=J(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,er).getRegex(),ts="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Rs=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_o=J("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",Rs).replace("tag",ts).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),nr=J(Is).replace("hr",bn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ts).getRegex(),ko=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",nr).getRegex(),Ps={blockquote:ko,code:go,def:wo,fences:yo,heading:vo,hr:bn,html:_o,lheading:tr,list:xo,newline:mo,paragraph:nr,table:vn,text:bo},sr=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",bn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ts).getRegex(),$o={...Ps,table:sr,paragraph:J(Is).replace("hr",bn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",sr).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ts).getRegex()},To={...Ps,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Rs).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:vn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(Is).replace("hr",bn).replace("heading",` *#{1,6} *[^
|
|
213
|
+
]`).replace("lheading",tr).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ir=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,So=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rr=/^( {2,}|\\)\n(?!\s*$)/,Eo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,wn="\\p{P}\\p{S}",Co=J(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,wn).getRegex(),Ao=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Oo=J(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,wn).getRegex(),Io=J("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,wn).getRegex(),Mo=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,wn).getRegex(),Ro=J(/\\([punct])/,"gu").replace(/punct/g,wn).getRegex(),Po=J(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),jo=J(Rs).replace("(?:-->|$)","-->").getRegex(),No=J("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",jo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ns=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zo=J(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",ns).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ar=J(/^!?\[(label)\]\[(ref)\]/).replace("label",ns).replace("ref",Ms).getRegex(),or=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ms).getRegex(),Do=J("reflink|nolink(?!\\()","g").replace("reflink",ar).replace("nolink",or).getRegex(),js={_backpedal:vn,anyPunctuation:Ro,autolink:Po,blockSkip:Ao,br:rr,code:So,del:vn,emStrongLDelim:Oo,emStrongRDelimAst:Io,emStrongRDelimUnd:Mo,escape:ir,link:zo,nolink:or,punctuation:Co,reflink:ar,reflinkSearch:Do,tag:No,text:Eo,url:vn},Zo={...js,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",ns).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ns).getRegex()},Ns={...js,escape:J(ir).replace("])","~|])").getRegex(),url:J(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Lo={...Ns,br:J(rr).replace("{2,}","*").getRegex(),text:J(Ns.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ss={normal:Ps,gfm:$o,pedantic:To},xn={normal:js,gfm:Ns,breaks:Lo,pedantic:Zo};class Pe{constructor(e){Y(this,"tokens"),Y(this,"options"),Y(this,"state"),Y(this,"tokenizer"),Y(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||$t,this.options.tokenizer=this.options.tokenizer||new es,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:ss.normal,inline:xn.normal};this.options.pedantic?(t.block=ss.pedantic,t.inline=xn.pedantic):this.options.gfm&&(t.block=ss.gfm,this.options.breaks?t.inline=xn.breaks:t.inline=xn.gfm),this.tokenizer.rules=t}static get rules(){return{block:ss,inline:xn}}static lex(e,t){return new Pe(t).lex(e)}static lexInline(e,t){return new Pe(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
214
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(o,l,d)=>l+" ".repeat(d.length));let n,i,r,a;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(o=>(n=o.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
|
215
|
+
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
216
|
+
`+n.raw,i.text+=`
|
|
217
|
+
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
218
|
+
`+n.raw,i.text+=`
|
|
219
|
+
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(r=e,this.options.extensions&&this.options.extensions.startBlock){let o=1/0;const l=e.slice(1);let d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},l),typeof d=="number"&&d>=0&&(o=Math.min(o,d))}),o<1/0&&o>=0&&(r=e.substring(0,o+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r))){i=t[t.length-1],a&&i.type==="paragraph"?(i.raw+=`
|
|
220
|
+
`+n.raw,i.text+=`
|
|
221
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),a=r.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
|
|
222
|
+
`+n.raw,i.text+=`
|
|
223
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,r,a=e,o,l,d;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(d=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(n=u.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,a,d)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(r=e,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const p=e.slice(1);let c;this.options.extensions.startInline.forEach(m=>{c=m.call({lexer:this},p),typeof c=="number"&&c>=0&&(u=Math.min(u,c))}),u<1/0&&u>=0&&(r=e.substring(0,u+1))}if(n=this.tokenizer.inlineText(r)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(d=n.raw.slice(-1)),l=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}}class _n{constructor(e){Y(this,"options"),this.options=e||$t}code(e,t,n){var i;const r=(i=(t||"").match(/^\S*/))==null?void 0:i[0];return e=e.replace(/\n$/,"")+`
|
|
224
|
+
`,r?'<pre><code class="language-'+xe(r)+'">'+(n?e:xe(e,!0))+`</code></pre>
|
|
225
|
+
`:"<pre><code>"+(n?e:xe(e,!0))+`</code></pre>
|
|
226
|
+
`}blockquote(e){return`<blockquote>
|
|
227
|
+
${e}</blockquote>
|
|
228
|
+
`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
|
|
229
|
+
`}hr(){return`<hr>
|
|
230
|
+
`}list(e,t,n){const i=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
|
|
231
|
+
`+e+"</"+i+`>
|
|
232
|
+
`}listitem(e,t,n){return`<li>${e}</li>
|
|
233
|
+
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
|
|
234
|
+
`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
|
|
235
|
+
<thead>
|
|
236
|
+
`+e+`</thead>
|
|
237
|
+
`+t+`</table>
|
|
238
|
+
`}tablerow(e){return`<tr>
|
|
239
|
+
${e}</tr>
|
|
240
|
+
`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
241
|
+
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=Yi(e);if(i===null)return n;e=i;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const i=Yi(e);if(i===null)return n;e=i;let r=`<img src="${e}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class zs{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class je{constructor(e){Y(this,"options"),Y(this,"renderer"),Y(this,"textRenderer"),this.options=e||$t,this.options.renderer=this.options.renderer||new _n,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new zs}static parse(e,t){return new je(t).parse(e)}static parseInline(e,t){return new je(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const a=r,o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){n+=o||"";continue}}switch(r.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const a=r;n+=this.renderer.heading(this.parseInline(a.tokens),a.depth,uo(this.parseInline(a.tokens,this.textRenderer)));continue}case"code":{const a=r;n+=this.renderer.code(a.text,a.lang,!!a.escaped);continue}case"table":{const a=r;let o="",l="";for(let u=0;u<a.header.length;u++)l+=this.renderer.tablecell(this.parseInline(a.header[u].tokens),{header:!0,align:a.align[u]});o+=this.renderer.tablerow(l);let d="";for(let u=0;u<a.rows.length;u++){const p=a.rows[u];l="";for(let c=0;c<p.length;c++)l+=this.renderer.tablecell(this.parseInline(p[c].tokens),{header:!1,align:a.align[c]});d+=this.renderer.tablerow(l)}n+=this.renderer.table(o,d);continue}case"blockquote":{const a=r,o=this.parse(a.tokens);n+=this.renderer.blockquote(o);continue}case"list":{const a=r,o=a.ordered,l=a.start,d=a.loose;let u="";for(let p=0;p<a.items.length;p++){const c=a.items[p],m=c.checked,R=c.task;let F="";if(c.task){const ae=this.renderer.checkbox(!!m);d?c.tokens.length>0&&c.tokens[0].type==="paragraph"?(c.tokens[0].text=ae+" "+c.tokens[0].text,c.tokens[0].tokens&&c.tokens[0].tokens.length>0&&c.tokens[0].tokens[0].type==="text"&&(c.tokens[0].tokens[0].text=ae+" "+c.tokens[0].tokens[0].text)):c.tokens.unshift({type:"text",text:ae+" "}):F+=ae+" "}F+=this.parse(c.tokens,d),u+=this.renderer.listitem(F,R,!!m)}n+=this.renderer.list(u,o,l);continue}case"html":{const a=r;n+=this.renderer.html(a.text,a.block);continue}case"paragraph":{const a=r;n+=this.renderer.paragraph(this.parseInline(a.tokens));continue}case"text":{let a=r,o=a.tokens?this.parseInline(a.tokens):a.text;for(;i+1<e.length&&e[i+1].type==="text";)a=e[++i],o+=`
|
|
242
|
+
`+(a.tokens?this.parseInline(a.tokens):a.text);n+=t?this.renderer.paragraph(o):o;continue}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=a||"";continue}}switch(r.type){case"escape":{const a=r;n+=t.text(a.text);break}case"html":{const a=r;n+=t.html(a.text);break}case"link":{const a=r;n+=t.link(a.href,a.title,this.parseInline(a.tokens,t));break}case"image":{const a=r;n+=t.image(a.href,a.title,a.text);break}case"strong":{const a=r;n+=t.strong(this.parseInline(a.tokens,t));break}case"em":{const a=r;n+=t.em(this.parseInline(a.tokens,t));break}case"codespan":{const a=r;n+=t.codespan(a.text);break}case"br":{n+=t.br();break}case"del":{const a=r;n+=t.del(this.parseInline(a.tokens,t));break}case"text":{const a=r;n+=t.text(a.text);break}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}}class kn{constructor(e){Y(this,"options"),this.options=e||$t}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}Y(kn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var is,Ds,Zs,lr;class cr{constructor(...e){Gs(this,is),Gs(this,Zs),Y(this,"defaults",Os()),Y(this,"options",this.setOptions),Y(this,"parse",ps(this,is,Ds).call(this,Pe.lex,je.parse)),Y(this,"parseInline",ps(this,is,Ds).call(this,Pe.lexInline,je.parseInline)),Y(this,"Parser",je),Y(this,"Renderer",_n),Y(this,"TextRenderer",zs),Y(this,"Lexer",Pe),Y(this,"Tokenizer",es),Y(this,"Hooks",kn),this.use(...e)}walkTokens(e,t){var n,i;let r=[];for(const a of e)switch(r=r.concat(t.call(this,a)),a.type){case"table":{const o=a;for(const l of o.header)r=r.concat(this.walkTokens(l.tokens,t));for(const l of o.rows)for(const d of l)r=r.concat(this.walkTokens(d.tokens,t));break}case"list":{const o=a;r=r.concat(this.walkTokens(o.items,t));break}default:{const o=a;(i=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{const d=o[l].flat(1/0);r=r.concat(this.walkTokens(d,t))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,t)))}}return r}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){const a=t.renderers[r.name];a?t.renderers[r.name]=function(...o){let l=r.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const a=t[r.level];a?a.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){const r=this.defaults.renderer||new _n(this.defaults);for(const a in n.renderer){if(!(a in r))throw new Error(`renderer '${a}' does not exist`);if(a==="options")continue;const o=a,l=n.renderer[o],d=r[o];r[o]=(...u)=>{let p=l.apply(r,u);return p===!1&&(p=d.apply(r,u)),p||""}}i.renderer=r}if(n.tokenizer){const r=this.defaults.tokenizer||new es(this.defaults);for(const a in n.tokenizer){if(!(a in r))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;const o=a,l=n.tokenizer[o],d=r[o];r[o]=(...u)=>{let p=l.apply(r,u);return p===!1&&(p=d.apply(r,u)),p}}i.tokenizer=r}if(n.hooks){const r=this.defaults.hooks||new kn;for(const a in n.hooks){if(!(a in r))throw new Error(`hook '${a}' does not exist`);if(a==="options")continue;const o=a,l=n.hooks[o],d=r[o];kn.passThroughHooks.has(a)?r[o]=u=>{if(this.defaults.async)return Promise.resolve(l.call(r,u)).then(c=>d.call(r,c));const p=l.call(r,u);return d.call(r,p)}:r[o]=(...u)=>{let p=l.apply(r,u);return p===!1&&(p=d.apply(r,u)),p}}i.hooks=r}if(n.walkTokens){const r=this.defaults.walkTokens,a=n.walkTokens;i.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),r&&(l=l.concat(r.call(this,o))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Pe.lex(e,t??this.defaults)}parser(e,t){return je.parse(e,t??this.defaults)}}is=new WeakSet,Ds=function(s,e){return(t,n)=>{const i={...n},r={...this.defaults,...i};this.defaults.async===!0&&i.async===!1&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const a=ps(this,Zs,lr).call(this,!!r.silent,!!r.async);if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then(o=>s(o,r)).then(o=>r.hooks?r.hooks.processAllTokens(o):o).then(o=>r.walkTokens?Promise.all(this.walkTokens(o,r.walkTokens)).then(()=>o):o).then(o=>e(o,r)).then(o=>r.hooks?r.hooks.postprocess(o):o).catch(a);try{r.hooks&&(t=r.hooks.preprocess(t));let o=s(t,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let l=e(o,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(o){return a(o)}}},Zs=new WeakSet,lr=function(s,e){return t=>{if(t.message+=`
|
|
243
|
+
Please report this to https://github.com/markedjs/marked.`,s){const n="<p>An error occurred:</p><pre>"+xe(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}};const Tt=new cr;function Q(s,e){return Tt.parse(s,e)}Q.options=Q.setOptions=function(s){return Tt.setOptions(s),Q.defaults=Tt.defaults,Ki(Q.defaults),Q},Q.getDefaults=Os,Q.defaults=$t,Q.use=function(...s){return Tt.use(...s),Q.defaults=Tt.defaults,Ki(Q.defaults),Q},Q.walkTokens=function(s,e){return Tt.walkTokens(s,e)},Q.parseInline=Tt.parseInline,Q.Parser=je,Q.parser=je.parse,Q.Renderer=_n,Q.TextRenderer=zs,Q.Lexer=Pe,Q.lexer=Pe.lex,Q.Tokenizer=es,Q.Hooks=kn,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,je.parse,Pe.lex;const Ls=new _n;Ls.link=(s,e,t)=>{const n=document.createElement("a");return n.setAttribute("href",s),n.setAttribute("target","_blank"),n.setAttribute("rel","noopener nofollow"),n.textContent=t,e&&n.setAttribute("title",e),n.outerHTML};const Uo=new cr({renderer:Ls});function Ho(s){const e=Bo(s);return Uo.parse(e,{renderer:Ls})}function Us(s){const e=Ho(s);return H`
|
|
244
|
+
<div class="flex flex-col gap-3">
|
|
245
|
+
${ro(e)}
|
|
246
|
+
</div>
|
|
247
|
+
`}function Bo(s){const e={"&":"&","<":"<",">":">",'"':""","'":"'"};return s.replace(/[&<>"']/g,t=>e[t])}var Wo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,ke=(s,e,t,n)=>{for(var i=n>1?void 0:n?Fo(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Wo(e,t,i),i},dr=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Lt=(s,e,t)=>(dr(s,e,"read from private field"),t?t.call(s):e.get(s)),ur=(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)},hr=(s,e,t,n)=>(dr(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),nt,rs;let be=class extends we{constructor(){super(),ur(this,nt,void 0),ur(this,rs,Promise.resolve()),this.disableInput=!1,this.showTyping=!1,this.messages=[],this.inputValue="",this.internalDisableInput=!1,this.internalShowTyping=!1,this.showPopoverDisclaimer=!1,this._emitter=to(),this._emitter.on("*",(s,e)=>this.dispatchEvent(new CustomEvent(`iai-chat-${s.toString()}`,{bubbles:!0,composed:!0,detail:e})))}connectedCallback(){super.connectedCallback(),this.cleanOptions=Yn.parse(this.options||{});const{assistantId:s,params:e,config:t}=this.cleanOptions;this.checkIfDisclaimerShouldBeShown(),hr(this,nt,new Xa(s,{params:e,simulateDelays:t.simulateDelays,historyKey:t.historyKey,initialReplyMessage:t.initialReplyMessage,resetEndedChatOnLoad:t.resetEndedChatOnLoad})),this.updateMessages(Lt(this,nt).messages),this.showTyping=Lt(this,nt).isTyping,this.disableInput=Lt(this,nt).inputDisabled,this.chatManager.on("functionCall",({id:n,name:i,params:r})=>{const a=this.cleanOptions.handlers.functionCalls[i];if(!a){console.warn(`No function call handler found for ${i}`);return}a.call(this,{id:n,params:r,html:H,chatWindow:this})}),this.chatManager.on("typing",n=>{this.showTyping=n}),this.chatManager.on("inputDisabled",n=>{this.disableInput=n}),this.chatManager.on("inactivityWarning",()=>{this.addMessage({role:"assistant",content:t.inactivityWarningMessage})}),this.chatManager.on("chatEnded",()=>{this.addMessage({role:"system",content:t.chatEndedMessage}),this.setInputDisabled(!0)}),this.chatManager.on("message",n=>{this.updateMessages([...this.messages,n])}),this.chatManager.on("messageRemoved",n=>{this.updateMessages(this.messages.filter(i=>i.id!==n))}),this.chatManager.on("reset",()=>{this.updateMessages([]),this.checkIfDisclaimerShouldBeShown()}),this.chatManager.on("*",this._emitter.emit)}disconnectedCallback(){super.disconnectedCallback(),this._emitter.all.clear(),Lt(this,nt).destroy()}firstUpdated(){this.focusOnInput()}updateMessages(s){this.messages=[...s],this.scrollChatToBottom()}render(){const{chatWindow:s,disclaimerMessage:e,disclaimerPopover:t}=this.cleanOptions.config,{header:n,showCloseButton:i}=s;return H`
|
|
195
248
|
<div class="relative flex flex-col h-full rounded-lg shadow-lg bg-white text-black">
|
|
196
249
|
<div class="header rounded-t-lg text-lg p-2 flex justify-between items-center h-12">
|
|
197
250
|
<div class="flex flex-row h-full items-center">
|
|
@@ -209,7 +262,7 @@
|
|
|
209
262
|
class="mr-2 h-6 w-6"
|
|
210
263
|
@click="${this.resetChat}"
|
|
211
264
|
>
|
|
212
|
-
${
|
|
265
|
+
${io}
|
|
213
266
|
</button>
|
|
214
267
|
|
|
215
268
|
${Fe(i,()=>H`
|
|
@@ -222,7 +275,7 @@
|
|
|
222
275
|
${Fe(this.showPopoverDisclaimer,()=>H`
|
|
223
276
|
<div class="absolute top-12 left-0 right-0 bottom-0 bg-white z-10 flex flex-col gap-2 rounded-b-lg">
|
|
224
277
|
<div class="flex-grow overflow-y-auto pt-4 px-4 relative">
|
|
225
|
-
|
|
278
|
+
${Us(t.message)}
|
|
226
279
|
|
|
227
280
|
<div class="sticky bottom-[-1px] left-0 right-0 h-12 bg-gradient-to-t from-white to-transparent"></div>
|
|
228
281
|
</div>
|
|
@@ -273,7 +326,7 @@
|
|
|
273
326
|
class="button rounded-lg p-2 disabled:opacity-50 h-9 w-9"
|
|
274
327
|
.disabled="${this.isSubmitDisabled}"
|
|
275
328
|
>
|
|
276
|
-
${
|
|
329
|
+
${so}
|
|
277
330
|
</button>
|
|
278
331
|
</div>
|
|
279
332
|
</form>
|
|
@@ -283,7 +336,7 @@
|
|
|
283
336
|
</p>
|
|
284
337
|
</div>
|
|
285
338
|
</div>
|
|
286
|
-
`}get isSubmitDisabled(){return!this.inputValue||this.internalDisableInput||this.disableInput}handleKeyDown(s){s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),!this.isSubmitDisabled&&this.sendUserMessage(s))}checkIfDisclaimerShouldBeShown(){const{config:s}=this.cleanOptions,e=localStorage.getItem(`iaiChatWindow-${s.historyKey}-acceptedDisclaimerTime`);this.showPopoverDisclaimer=!!(s.disclaimerPopover.message&&(!e||Vi().diff(e,"minutes")>=s.disclaimerPopover.rememberDurationMinutes))}acceptDisclaimer(){localStorage.setItem(`iaiChatWindow-${this.cleanOptions.config.historyKey}-acceptedDisclaimerTime`,Vi().toISOString()),this.showPopoverDisclaimer=!1}handleInput(){const{inputElement:s,chatContainer:e}=this;if(!s||!e)return;this.inputValue=s.value;const{scrollTop:t,clientHeight:n,scrollHeight:i}=e,r=t+n>=i;s.style.height="auto",s.style.height=`${s.scrollHeight+2}px`,r&&this.scrollChatToBottom()}get chatManager(){return Lt(this,
|
|
339
|
+
`}get isSubmitDisabled(){return!this.inputValue||this.internalDisableInput||this.disableInput}handleKeyDown(s){s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),!this.isSubmitDisabled&&this.sendUserMessage(s))}checkIfDisclaimerShouldBeShown(){const{config:s}=this.cleanOptions,e=localStorage.getItem(`iaiChatWindow-${s.historyKey}-acceptedDisclaimerTime`);this.showPopoverDisclaimer=!!(s.disclaimerPopover.message&&(!e||Vi().diff(e,"minutes")>=s.disclaimerPopover.rememberDurationMinutes))}acceptDisclaimer(){localStorage.setItem(`iaiChatWindow-${this.cleanOptions.config.historyKey}-acceptedDisclaimerTime`,Vi().toISOString()),this.showPopoverDisclaimer=!1}handleInput(){const{inputElement:s,chatContainer:e}=this;if(!s||!e)return;this.inputValue=s.value;const{scrollTop:t,clientHeight:n,scrollHeight:i}=e,r=t+n>=i;s.style.height="auto",s.style.height=`${s.scrollHeight+2}px`,r&&this.scrollChatToBottom()}get chatManager(){return Lt(this,nt)}resetChat(){this.chatManager.reset("Manually reset by user")}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(n){console.error("sendFunctionCallResponse error",n),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 Lt(this,rs),hr(this,rs,this.chatManager.sendUserMessage(this.inputValue))),this.inputValue="",this.inputElement&&(this.inputElement.style.height="auto"),this.internalDisableInput=!1,setTimeout(()=>{this.focusOnInput()},0))}focusOnInput(){var s;(s=this.inputElement)==null||s.focus()}scrollChatToBottom(){const{chatContainer:s}=this;s==null||s.scrollTo({top:s==null?void 0:s.scrollHeight,behavior:"smooth"})}nameLabel(s){const e=this.messages[s];if(e.role!=="assistant")return null;const t=e.name||"Assistant",n=this.messages[s-1];return((n==null?void 0:n.name)||"Assistant")===t?null:H`
|
|
287
340
|
<div class="name text-sm">${e.name||"Assistant"}</div>
|
|
288
341
|
`}chatMessage(s){switch(s.role){case"assistant":return H`
|
|
289
342
|
<iai-chat-message-assistant
|
|
@@ -303,7 +356,7 @@
|
|
|
303
356
|
.contentHtmlTemplate="${s.contentHtmlTemplate}"
|
|
304
357
|
.options="${this.cleanOptions}"
|
|
305
358
|
></iai-chat-message-system>
|
|
306
|
-
`;default:return""}}closeChat(){this._emitter.emit("close")}};
|
|
359
|
+
`;default:return""}}closeChat(){this._emitter.emit("close")}};nt=new WeakMap,rs=new WeakMap,be.styles=[He,ct`
|
|
307
360
|
.header {
|
|
308
361
|
background-color: var(--iai-chat-i-header-bg);
|
|
309
362
|
color: var(--iai-chat-i-header-fg);
|
|
@@ -318,7 +371,7 @@
|
|
|
318
371
|
.name {
|
|
319
372
|
color: #8c8c8c;
|
|
320
373
|
}
|
|
321
|
-
`],_e([ee({type:Object})],we.prototype,"options",2),_e([ee()],we.prototype,"disableInput",2),_e([ee()],we.prototype,"showTyping",2),_e([ft()],we.prototype,"messages",2),_e([ft()],we.prototype,"inputValue",2),_e([ft()],we.prototype,"internalDisableInput",2),_e([ft()],we.prototype,"internalShowTyping",2),_e([ft()],we.prototype,"showPopoverDisclaimer",2),_e([Rn("#chat-container")],we.prototype,"chatContainer",2),_e([Rn("#message-input")],we.prototype,"inputElement",2),_e([$s.debounce(1)],we.prototype,"scrollChatToBottom",1),we=_e([Me("iai-chat")],we);var Qi={exports:{}};(function(s){(function(e){if(typeof window>"u")return;var t=0,n=!1,i=!1,r="message",a=r.length,o="[iFrameSizer]",l=o.length,d=null,u=window.requestAnimationFrame,p=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),c={},m=null,R=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(){ye("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function F(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function ae(h,x,L){h.addEventListener(x,L,!1)}function De(h,x,L){h.removeEventListener(x,L,!1)}function Bt(){var h=["moz","webkit","o","ms"],x;for(x=0;x<h.length&&!u;x+=1)u=window[h[x]+"RequestAnimationFrame"];u?u=u.bind(window):z("setup","RequestAnimationFrame not supported")}function rt(h){var x="Host page: "+h;return window.top!==window.self&&(x=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+h:"Nested host page: "+h),x}function Wt(h){return o+"["+rt(h)+"]"}function $e(h){return c[h]?c[h].log:n}function z(h,x){at("log",h,x,$e(h))}function Cn(h,x){at("info",h,x,$e(h))}function ye(h,x){at("warn",h,x,!0)}function at(h,x,L,E){E===!0&&typeof window.console=="object"&&console[h](Wt(x),L)}function oe(h){function x(){function _(){v(V),w(M),It("onResized",V)}q("Height"),q("Width"),P(_,V,"init")}function L(){var _=Oe.slice(l).split(":"),D=_[1]?parseInt(_[1],10):0,G=c[_[0]]&&c[_[0]].iframe,X=getComputedStyle(G);return{iframe:G,id:_[0],height:D+E(X)+U(X),width:_[2],type:_[3]}}function E(_){if(_.boxSizing!=="border-box")return 0;var D=_.paddingTop?parseInt(_.paddingTop,10):0,G=_.paddingBottom?parseInt(_.paddingBottom,10):0;return D+G}function U(_){if(_.boxSizing!=="border-box")return 0;var D=_.borderTopWidth?parseInt(_.borderTopWidth,10):0,G=_.borderBottomWidth?parseInt(_.borderBottomWidth,10):0;return D+G}function q(_){var D=Number(c[M]["max"+_]),G=Number(c[M]["min"+_]),X=_.toLowerCase(),he=Number(V[X]);z(M,"Checking "+X+" is in range "+G+"-"+D),he<G&&(he=G,z(M,"Set "+X+" to min value")),he>D&&(he=D,z(M,"Set "+X+" to max value")),V[X]=""+he}function Ue(){function _(){function X(){var ve=0,Ye=!1;for(z(M,"Checking connection is from allowed list of origins: "+G);ve<G.length;ve++)if(G[ve]===D){Ye=!0;break}return Ye}function he(){var ve=c[M]&&c[M].remoteHost;return z(M,"Checking connection is from: "+ve),D===ve}return G.constructor===Array?X():he()}var D=h.origin,G=c[M]&&c[M].checkOrigin;if(G&&""+D!="null"&&!_())throw new Error("Unexpected message received from: "+D+" for "+V.iframe.id+". Message was: "+h.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function Ot(){return o===(""+Oe).slice(0,l)&&Oe.slice(l).split(":")[0]in c}function Je(){var _=V.type in{true:1,false:1,undefined:1};return _&&z(M,"Ignoring init message from meta parent page"),_}function Qe(_){return Oe.slice(Oe.indexOf(":")+a+_)}function lt(_){z(M,"onMessage passed: {iframe: "+V.iframe.id+", message: "+_+"}"),It("onMessage",{iframe:V.iframe,message:JSON.parse(_)}),z(M,"--")}function Bs(){var _=document.body.getBoundingClientRect(),D=V.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:D.height,iframeWidth:D.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(D.top-_.top,10),offsetLeft:parseInt(D.left-_.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function hs(_,D){function G(){S("Send Page Info","pageInfo:"+Bs(),_,D)}ot(G,32,D)}function Ws(){function _(he,ve){function Ye(){c[X]?hs(c[X].iframe,X):D()}["scroll","resize"].forEach(function(wr){z(X,he+wr+" listener for sendPageInfo"),ve(window,wr,Ye)})}function D(){_("Remove ",De)}function G(){_("Add ",ae)}var X=M;G(),c[X]&&(c[X].stopPageInfo=D)}function Fs(){c[M]&&c[M].stopPageInfo&&(c[M].stopPageInfo(),delete c[M].stopPageInfo)}function Vs(){var _=!0;return V.iframe===null&&(ye(M,"IFrame ("+V.id+") not found"),_=!1),_}function C(_){var D=_.getBoundingClientRect();return I(M),{x:Math.floor(Number(D.left)+Number(d.x)),y:Math.floor(Number(D.top)+Number(d.y))}}function A(_){function D(){d=ve,ce(),z(M,"--")}function G(){return{x:Number(V.width)+he.x,y:Number(V.height)+he.y}}function X(){window.parentIFrame?window.parentIFrame["scrollTo"+(_?"Offset":"")](ve.x,ve.y):ye(M,"Unable to scroll to requested position, window.parentIFrame not found")}var he=_?C(V.iframe):{x:0,y:0},ve=G();z(M,"Reposition requested from iFrame (offset x:"+he.x+" y:"+he.y+")"),window.top===window.self?D():X()}function ce(){It("onScroll",d)===!1?g():w(M)}function me(_){function D(){var Ye=C(ve);z(M,"Moving to in page link (#"+X+") at x: "+Ye.x+" y: "+Ye.y),d={x:Ye.x,y:Ye.y},ce(),z(M,"--")}function G(){window.parentIFrame?window.parentIFrame.moveToAnchor(X):z(M,"In page link #"+X+" not found and window.parentIFrame not found")}var X=_.split("#")[1]||"",he=decodeURIComponent(X),ve=document.getElementById(he)||document.getElementsByName(he)[0];ve?D():window.top===window.self?z(M,"In page link #"+X+" not found"):G()}function Ae(_){var D={};if(Number(V.width)===0&&Number(V.height)===0){var G=Qe(9).split(":");D={x:G[1],y:G[0]}}else D={x:V.width,y:V.height};It(_,{iframe:V.iframe,screenX:Number(D.x),screenY:Number(D.y),type:V.type})}function It(_,D){return W(M,_,D)}function Ks(){switch(c[M]&&c[M].firstRun&&Qs(),V.type){case"close":{Ft(V.iframe);break}case"message":{lt(Qe(6));break}case"mouseenter":{Ae("onMouseEnter");break}case"mouseleave":{Ae("onMouseLeave");break}case"autoResize":{c[M].autoResize=JSON.parse(Qe(9));break}case"scrollTo":{A(!1);break}case"scrollToOffset":{A(!0);break}case"pageInfo":{hs(c[M]&&c[M].iframe,M),Ws();break}case"pageInfoStop":{Fs();break}case"inPageLink":{me(Qe(9));break}case"reset":{$(V);break}case"init":{x(),It("onInit",V.iframe);break}default:Number(V.width)===0&&Number(V.height)===0?ye("Unsupported message received ("+V.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):x()}}function qs(_){var D=!0;return c[_]||(D=!1,ye(V.type+" No settings for "+_+". Message was: "+Oe)),D}function Js(){for(var _ in c)S("iFrame requested init",K(_),c[_].iframe,_)}function Qs(){c[M]&&(c[M].firstRun=!1)}var Oe=h.data,V={},M=null;Oe==="[iFrameResizerChild]Ready"?Js():Ot()?(V=L(),M=V.id,c[M]&&(c[M].loaded=!0),!Je()&&qs(M)&&(z(M,"Received: "+Oe),Vs()&&Ue()&&Ks())):Cn(M,"Ignored: "+Oe)}function W(h,x,L){var E=null,U=null;if(c[h])if(E=c[h][x],typeof E=="function")U=E(L);else throw new TypeError(x+" on iFrame["+h+"] is not a function");return U}function Ct(h){var x=h.id;delete c[x]}function Ft(h){var x=h.id;if(W(x,"onClose",x)===!1){z(x,"Close iframe cancelled by onClose event");return}z(x,"Removing iFrame: "+x);try{h.parentNode&&h.parentNode.removeChild(h)}catch(L){ye(L)}W(x,"onClosed",x),z(x,"--"),Ct(h)}function I(h){d===null&&(d={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset},z(h,"Get page position: "+d.x+","+d.y))}function w(h){d!==null&&(window.scrollTo(d.x,d.y),z(h,"Set page position: "+d.x+","+d.y),g())}function g(){d=null}function $(h){function x(){v(h),S("reset","reset",h.iframe,h.id)}z(h.id,"Size reset requested by "+(h.type==="init"?"host page":"iFrame")),I(h.id),P(x,h,"reset")}function v(h){function x(q){if(!h.id){z("undefined","messageData id not set");return}h.iframe.style[q]=h[q]+"px",z(h.id,"IFrame ("+U+") "+q+" set to "+h[q]+"px")}function L(q){!i&&h[q]==="0"&&(i=!0,z(U,"Hidden iFrame detected, creating visibility listener"),Ke())}function E(q){x(q),L(q)}var U=h.iframe.id;c[U]&&(c[U].sizeHeight&&E("height"),c[U].sizeWidth&&E("width"))}function P(h,x,L){L!==x.type&&u&&!window.jasmine?(z(x.id,"Requesting animation frame"),u(h)):h()}function S(h,x,L,E,U){function q(){var lt=c[E]&&c[E].targetOrigin;z(E,"["+h+"] Sending msg to iframe["+E+"] ("+x+") targetOrigin: "+lt),L.contentWindow.postMessage(o+x,lt)}function Ue(){ye(E,"["+h+"] IFrame("+E+") not found")}function Ot(){L&&"contentWindow"in L&&L.contentWindow!==null?q():Ue()}function Je(){function lt(){c[E]&&!c[E].loaded&&!Qe&&(Qe=!0,ye(E,"IFrame has not responded within "+c[E].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."))}U&&c[E]&&c[E].warningTimeout&&(c[E].msgTimeout=setTimeout(lt,c[E].warningTimeout))}var Qe=!1;E=E||L.id,c[E]&&(Ot(),Je())}function K(h){return h+":"+c[h].bodyMarginV1+":"+c[h].sizeWidth+":"+c[h].log+":"+c[h].interval+":"+c[h].enablePublicMethods+":"+c[h].autoResize+":"+c[h].bodyMargin+":"+c[h].heightCalculationMethod+":"+c[h].bodyBackground+":"+c[h].bodyPadding+":"+c[h].tolerance+":"+c[h].inPageLinks+":"+c[h].resizeFrom+":"+c[h].widthCalculationMethod+":"+c[h].mouseEvents}function ne(h){return typeof h=="number"}function se(h,x){function L(){function A(me){var Ae=c[C][me];Ae!==1/0&&Ae!==0&&(h.style[me]=ne(Ae)?Ae+"px":Ae,z(C,"Set "+me+" = "+h.style[me]))}function ce(me){if(c[C]["min"+me]>c[C]["max"+me])throw new Error("Value for min"+me+" can not be greater than max"+me)}ce("Height"),ce("Width"),A("maxHeight"),A("minHeight"),A("maxWidth"),A("minWidth")}function E(){var A=x&&x.id||R.id+t++;return document.getElementById(A)!==null&&(A+=t++),A}function U(A){if(typeof A!="string")throw new TypeError("Invaild id for iFrame. Expected String");return A===""&&(h.id=A=E(),n=(x||{}).log,z(A,"Added missing iframe ID: "+A+" ("+h.src+")")),A}function q(){switch(z(C,"IFrame scrolling "+(c[C]&&c[C].scrolling?"enabled":"disabled")+" for "+C),h.style.overflow=(c[C]&&c[C].scrolling)===!1?"hidden":"auto",c[C]&&c[C].scrolling){case"omit":break;case!0:{h.scrolling="yes";break}case!1:{h.scrolling="no";break}default:h.scrolling=c[C]?c[C].scrolling:"no"}}function Ue(){(typeof(c[C]&&c[C].bodyMargin)=="number"||(c[C]&&c[C].bodyMargin)==="0")&&(c[C].bodyMarginV1=c[C].bodyMargin,c[C].bodyMargin=""+c[C].bodyMargin+"px")}function Ot(){var A=c[C]&&c[C].firstRun,ce=c[C]&&c[C].heightCalculationMethod in p;!A&&ce&&$({iframe:h,height:0,width:0,type:"init"})}function Je(){c[C]&&(c[C].iframe.iFrameResizer={close:Ft.bind(null,c[C].iframe),removeListeners:Ct.bind(null,c[C].iframe),resize:S.bind(null,"Window resize","resize",c[C].iframe),moveToAnchor:function(A){S("Move to anchor","moveToAnchor:"+A,c[C].iframe,C)},sendMessage:function(A){A=JSON.stringify(A),S("Send Message","message:"+A,c[C].iframe,C)}})}function Qe(A){function ce(){S("iFrame.onload",A,h,e,!0),Ot()}function me(It){if(h.parentNode){var Ks=new It(function(qs){qs.forEach(function(Js){var Qs=Array.prototype.slice.call(Js.removedNodes);Qs.forEach(function(Oe){Oe===h&&Ft(h)})})});Ks.observe(h.parentNode,{childList:!0})}}var Ae=F();Ae&&me(Ae),ae(h,"load",ce),S("init",A,h,e,!0)}function lt(A){if(typeof A!="object")throw new TypeError("Options is not an object")}function Bs(A){for(var ce in R)Object.prototype.hasOwnProperty.call(R,ce)&&(c[C][ce]=Object.prototype.hasOwnProperty.call(A,ce)?A[ce]:R[ce])}function hs(A){return A===""||A.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":A}function Ws(A){var ce=A.split("Callback");if(ce.length===2){var me="on"+ce[0].charAt(0).toUpperCase()+ce[0].slice(1);this[me]=this[A],delete this[A],ye(C,"Deprecated: '"+A+"' has been renamed '"+me+"'. The old method will be removed in the next major version.")}}function Fs(A){A=A||{},c[C]=Object.create(null),c[C].iframe=h,c[C].firstRun=!0,c[C].remoteHost=h.src&&h.src.split("/").slice(0,3).join("/"),lt(A),Object.keys(A).forEach(Ws,A),Bs(A),c[C]&&(c[C].targetOrigin=c[C].checkOrigin===!0?hs(c[C].remoteHost):"*")}function Vs(){return C in c&&"iFrameResizer"in h}var C=U(h.id);Vs()?ye(C,"Ignored iFrame, already setup."):(Fs(x),q(),L(),Ue(),Qe(K(C)),Je())}function le(h,x){m===null&&(m=setTimeout(function(){m=null,h()},x))}var fe={};function ot(h,x,L){fe[L]||(fe[L]=setTimeout(function(){fe[L]=null,h()},x))}function Ke(){function h(){function U(q){function Ue(Je){return(c[q]&&c[q].iframe.style[Je])==="0px"}function Ot(Je){return Je.offsetParent!==null}c[q]&&Ot(c[q].iframe)&&(Ue("height")||Ue("width"))&&S("Visibility change","resize",c[q].iframe,q)}Object.keys(c).forEach(function(q){U(q)})}function x(U){z("window","Mutation observed: "+U[0].target+" "+U[0].type),le(h,16)}function L(){var U=document.querySelector("body"),q={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},Ue=new E(x);Ue.observe(U,q)}var E=F();E&&L()}function At(h){function x(){ue("Window "+h,"resize")}z("window","Trigger event: "+h),le(x,16)}function Ze(){function h(){ue("Tab Visible","resize")}document.visibilityState!=="hidden"&&(z("document","Trigger event: Visibility change"),le(h,16))}function ue(h,x){function L(E){return c[E]&&c[E].resizeFrom==="parent"&&c[E].autoResize&&!c[E].firstRun}Object.keys(c).forEach(function(E){L(E)&&S(h,x,c[E].iframe,E)})}function Le(){ae(window,"message",oe),ae(window,"resize",function(){At("resize")}),ae(document,"visibilitychange",Ze),ae(document,"-webkit-visibilitychange",Ze)}function qe(){function h(E,U){function q(){if(U.tagName){if(U.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+U.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}U&&(q(),se(U,E),L.push(U))}function x(E){E&&E.enablePublicMethods&&ye("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var L;return Bt(),Le(),function(E,U){switch(L=[],x(E),typeof U){case"undefined":case"string":{Array.prototype.forEach.call(document.querySelectorAll(U||"iframe"),h.bind(e,E));break}case"object":{h(E,U);break}default:throw new TypeError("Unexpected data type ("+typeof U+")")}return L}}function Vt(h){h.fn?h.fn.iFrameResize||(h.fn.iFrameResize=function(x){function L(E,U){se(U,x)}return this.filter("iframe").each(L).end()}):Cn("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==e&&Vt(window.jQuery),typeof e=="function"&&e.amd?e([],qe):s.exports=qe(),window.iFrameResize=window.iFrameResize||qe()})()})(Qi);var lo=Qi.exports;const co=Pi(lo);var uo=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,Os=(s,e,t,n)=>{for(var i=n>1?void 0:n?ho(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&uo(e,t,i),i};let vn=class extends be{constructor(){super(...arguments),this.src="",this.showCloseButton=!1}async onLoad(s){co({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 H`
|
|
374
|
+
`],ke([ne({type:Object})],be.prototype,"options",2),ke([ne()],be.prototype,"disableInput",2),ke([ne()],be.prototype,"showTyping",2),ke([ft()],be.prototype,"messages",2),ke([ft()],be.prototype,"inputValue",2),ke([ft()],be.prototype,"internalDisableInput",2),ke([ft()],be.prototype,"internalShowTyping",2),ke([ft()],be.prototype,"showPopoverDisclaimer",2),ke([Rn("#chat-container")],be.prototype,"chatContainer",2),ke([Rn("#message-input")],be.prototype,"inputElement",2),ke([ks.debounce(1)],be.prototype,"scrollChatToBottom",1),be=ke([Ue("iai-chat")],be);var pr={exports:{}};(function(s){(function(e){if(typeof window>"u")return;var t=0,n=!1,i=!1,r="message",a=r.length,o="[iFrameSizer]",l=o.length,d=null,u=window.requestAnimationFrame,p=Object.freeze({max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),c={},m=null,R=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(){ye("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}});function F(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function ae(h,_,L){h.addEventListener(_,L,!1)}function Ne(h,_,L){h.removeEventListener(_,L,!1)}function Bt(){var h=["moz","webkit","o","ms"],_;for(_=0;_<h.length&&!u;_+=1)u=window[h[_]+"RequestAnimationFrame"];u?u=u.bind(window):z("setup","RequestAnimationFrame not supported")}function it(h){var _="Host page: "+h;return window.top!==window.self&&(_=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+h:"Nested host page: "+h),_}function Wt(h){return o+"["+it(h)+"]"}function $e(h){return c[h]?c[h].log:n}function z(h,_){rt("log",h,_,$e(h))}function Cn(h,_){rt("info",h,_,$e(h))}function ye(h,_){rt("warn",h,_,!0)}function rt(h,_,L,E){E===!0&&typeof window.console=="object"&&console[h](Wt(_),L)}function oe(h){function _(){function k(){v(V),w(M),It("onResized",V)}q("Height"),q("Width"),P(k,V,"init")}function L(){var k=Oe.slice(l).split(":"),D=k[1]?parseInt(k[1],10):0,G=c[k[0]]&&c[k[0]].iframe,X=getComputedStyle(G);return{iframe:G,id:k[0],height:D+E(X)+U(X),width:k[2],type:k[3]}}function E(k){if(k.boxSizing!=="border-box")return 0;var D=k.paddingTop?parseInt(k.paddingTop,10):0,G=k.paddingBottom?parseInt(k.paddingBottom,10):0;return D+G}function U(k){if(k.boxSizing!=="border-box")return 0;var D=k.borderTopWidth?parseInt(k.borderTopWidth,10):0,G=k.borderBottomWidth?parseInt(k.borderBottomWidth,10):0;return D+G}function q(k){var D=Number(c[M]["max"+k]),G=Number(c[M]["min"+k]),X=k.toLowerCase(),he=Number(V[X]);z(M,"Checking "+X+" is in range "+G+"-"+D),he<G&&(he=G,z(M,"Set "+X+" to min value")),he>D&&(he=D,z(M,"Set "+X+" to max value")),V[X]=""+he}function Ze(){function k(){function X(){var ve=0,Ye=!1;for(z(M,"Checking connection is from allowed list of origins: "+G);ve<G.length;ve++)if(G[ve]===D){Ye=!0;break}return Ye}function he(){var ve=c[M]&&c[M].remoteHost;return z(M,"Checking connection is from: "+ve),D===ve}return G.constructor===Array?X():he()}var D=h.origin,G=c[M]&&c[M].checkOrigin;if(G&&""+D!="null"&&!k())throw new Error("Unexpected message received from: "+D+" for "+V.iframe.id+". Message was: "+h.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}function Ot(){return o===(""+Oe).slice(0,l)&&Oe.slice(l).split(":")[0]in c}function Je(){var k=V.type in{true:1,false:1,undefined:1};return k&&z(M,"Ignoring init message from meta parent page"),k}function Qe(k){return Oe.slice(Oe.indexOf(":")+a+k)}function ot(k){z(M,"onMessage passed: {iframe: "+V.iframe.id+", message: "+k+"}"),It("onMessage",{iframe:V.iframe,message:JSON.parse(k)}),z(M,"--")}function Bs(){var k=document.body.getBoundingClientRect(),D=V.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:D.height,iframeWidth:D.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(D.top-k.top,10),offsetLeft:parseInt(D.left-k.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})}function us(k,D){function G(){S("Send Page Info","pageInfo:"+Bs(),k,D)}at(G,32,D)}function Ws(){function k(he,ve){function Ye(){c[X]?us(c[X].iframe,X):D()}["scroll","resize"].forEach(function(br){z(X,he+br+" listener for sendPageInfo"),ve(window,br,Ye)})}function D(){k("Remove ",Ne)}function G(){k("Add ",ae)}var X=M;G(),c[X]&&(c[X].stopPageInfo=D)}function Fs(){c[M]&&c[M].stopPageInfo&&(c[M].stopPageInfo(),delete c[M].stopPageInfo)}function Vs(){var k=!0;return V.iframe===null&&(ye(M,"IFrame ("+V.id+") not found"),k=!1),k}function C(k){var D=k.getBoundingClientRect();return I(M),{x:Math.floor(Number(D.left)+Number(d.x)),y:Math.floor(Number(D.top)+Number(d.y))}}function A(k){function D(){d=ve,ce(),z(M,"--")}function G(){return{x:Number(V.width)+he.x,y:Number(V.height)+he.y}}function X(){window.parentIFrame?window.parentIFrame["scrollTo"+(k?"Offset":"")](ve.x,ve.y):ye(M,"Unable to scroll to requested position, window.parentIFrame not found")}var he=k?C(V.iframe):{x:0,y:0},ve=G();z(M,"Reposition requested from iFrame (offset x:"+he.x+" y:"+he.y+")"),window.top===window.self?D():X()}function ce(){It("onScroll",d)===!1?g():w(M)}function me(k){function D(){var Ye=C(ve);z(M,"Moving to in page link (#"+X+") at x: "+Ye.x+" y: "+Ye.y),d={x:Ye.x,y:Ye.y},ce(),z(M,"--")}function G(){window.parentIFrame?window.parentIFrame.moveToAnchor(X):z(M,"In page link #"+X+" not found and window.parentIFrame not found")}var X=k.split("#")[1]||"",he=decodeURIComponent(X),ve=document.getElementById(he)||document.getElementsByName(he)[0];ve?D():window.top===window.self?z(M,"In page link #"+X+" not found"):G()}function Ae(k){var D={};if(Number(V.width)===0&&Number(V.height)===0){var G=Qe(9).split(":");D={x:G[1],y:G[0]}}else D={x:V.width,y:V.height};It(k,{iframe:V.iframe,screenX:Number(D.x),screenY:Number(D.y),type:V.type})}function It(k,D){return W(M,k,D)}function Ks(){switch(c[M]&&c[M].firstRun&&Qs(),V.type){case"close":{Ft(V.iframe);break}case"message":{ot(Qe(6));break}case"mouseenter":{Ae("onMouseEnter");break}case"mouseleave":{Ae("onMouseLeave");break}case"autoResize":{c[M].autoResize=JSON.parse(Qe(9));break}case"scrollTo":{A(!1);break}case"scrollToOffset":{A(!0);break}case"pageInfo":{us(c[M]&&c[M].iframe,M),Ws();break}case"pageInfoStop":{Fs();break}case"inPageLink":{me(Qe(9));break}case"reset":{$(V);break}case"init":{_(),It("onInit",V.iframe);break}default:Number(V.width)===0&&Number(V.height)===0?ye("Unsupported message received ("+V.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):_()}}function qs(k){var D=!0;return c[k]||(D=!1,ye(V.type+" No settings for "+k+". Message was: "+Oe)),D}function Js(){for(var k in c)S("iFrame requested init",K(k),c[k].iframe,k)}function Qs(){c[M]&&(c[M].firstRun=!1)}var Oe=h.data,V={},M=null;Oe==="[iFrameResizerChild]Ready"?Js():Ot()?(V=L(),M=V.id,c[M]&&(c[M].loaded=!0),!Je()&&qs(M)&&(z(M,"Received: "+Oe),Vs()&&Ze()&&Ks())):Cn(M,"Ignored: "+Oe)}function W(h,_,L){var E=null,U=null;if(c[h])if(E=c[h][_],typeof E=="function")U=E(L);else throw new TypeError(_+" on iFrame["+h+"] is not a function");return U}function Ct(h){var _=h.id;delete c[_]}function Ft(h){var _=h.id;if(W(_,"onClose",_)===!1){z(_,"Close iframe cancelled by onClose event");return}z(_,"Removing iFrame: "+_);try{h.parentNode&&h.parentNode.removeChild(h)}catch(L){ye(L)}W(_,"onClosed",_),z(_,"--"),Ct(h)}function I(h){d===null&&(d={x:window.pageXOffset===e?document.documentElement.scrollLeft:window.pageXOffset,y:window.pageYOffset===e?document.documentElement.scrollTop:window.pageYOffset},z(h,"Get page position: "+d.x+","+d.y))}function w(h){d!==null&&(window.scrollTo(d.x,d.y),z(h,"Set page position: "+d.x+","+d.y),g())}function g(){d=null}function $(h){function _(){v(h),S("reset","reset",h.iframe,h.id)}z(h.id,"Size reset requested by "+(h.type==="init"?"host page":"iFrame")),I(h.id),P(_,h,"reset")}function v(h){function _(q){if(!h.id){z("undefined","messageData id not set");return}h.iframe.style[q]=h[q]+"px",z(h.id,"IFrame ("+U+") "+q+" set to "+h[q]+"px")}function L(q){!i&&h[q]==="0"&&(i=!0,z(U,"Hidden iFrame detected, creating visibility listener"),Ke())}function E(q){_(q),L(q)}var U=h.iframe.id;c[U]&&(c[U].sizeHeight&&E("height"),c[U].sizeWidth&&E("width"))}function P(h,_,L){L!==_.type&&u&&!window.jasmine?(z(_.id,"Requesting animation frame"),u(h)):h()}function S(h,_,L,E,U){function q(){var ot=c[E]&&c[E].targetOrigin;z(E,"["+h+"] Sending msg to iframe["+E+"] ("+_+") targetOrigin: "+ot),L.contentWindow.postMessage(o+_,ot)}function Ze(){ye(E,"["+h+"] IFrame("+E+") not found")}function Ot(){L&&"contentWindow"in L&&L.contentWindow!==null?q():Ze()}function Je(){function ot(){c[E]&&!c[E].loaded&&!Qe&&(Qe=!0,ye(E,"IFrame has not responded within "+c[E].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."))}U&&c[E]&&c[E].warningTimeout&&(c[E].msgTimeout=setTimeout(ot,c[E].warningTimeout))}var Qe=!1;E=E||L.id,c[E]&&(Ot(),Je())}function K(h){return h+":"+c[h].bodyMarginV1+":"+c[h].sizeWidth+":"+c[h].log+":"+c[h].interval+":"+c[h].enablePublicMethods+":"+c[h].autoResize+":"+c[h].bodyMargin+":"+c[h].heightCalculationMethod+":"+c[h].bodyBackground+":"+c[h].bodyPadding+":"+c[h].tolerance+":"+c[h].inPageLinks+":"+c[h].resizeFrom+":"+c[h].widthCalculationMethod+":"+c[h].mouseEvents}function te(h){return typeof h=="number"}function se(h,_){function L(){function A(me){var Ae=c[C][me];Ae!==1/0&&Ae!==0&&(h.style[me]=te(Ae)?Ae+"px":Ae,z(C,"Set "+me+" = "+h.style[me]))}function ce(me){if(c[C]["min"+me]>c[C]["max"+me])throw new Error("Value for min"+me+" can not be greater than max"+me)}ce("Height"),ce("Width"),A("maxHeight"),A("minHeight"),A("maxWidth"),A("minWidth")}function E(){var A=_&&_.id||R.id+t++;return document.getElementById(A)!==null&&(A+=t++),A}function U(A){if(typeof A!="string")throw new TypeError("Invaild id for iFrame. Expected String");return A===""&&(h.id=A=E(),n=(_||{}).log,z(A,"Added missing iframe ID: "+A+" ("+h.src+")")),A}function q(){switch(z(C,"IFrame scrolling "+(c[C]&&c[C].scrolling?"enabled":"disabled")+" for "+C),h.style.overflow=(c[C]&&c[C].scrolling)===!1?"hidden":"auto",c[C]&&c[C].scrolling){case"omit":break;case!0:{h.scrolling="yes";break}case!1:{h.scrolling="no";break}default:h.scrolling=c[C]?c[C].scrolling:"no"}}function Ze(){(typeof(c[C]&&c[C].bodyMargin)=="number"||(c[C]&&c[C].bodyMargin)==="0")&&(c[C].bodyMarginV1=c[C].bodyMargin,c[C].bodyMargin=""+c[C].bodyMargin+"px")}function Ot(){var A=c[C]&&c[C].firstRun,ce=c[C]&&c[C].heightCalculationMethod in p;!A&&ce&&$({iframe:h,height:0,width:0,type:"init"})}function Je(){c[C]&&(c[C].iframe.iFrameResizer={close:Ft.bind(null,c[C].iframe),removeListeners:Ct.bind(null,c[C].iframe),resize:S.bind(null,"Window resize","resize",c[C].iframe),moveToAnchor:function(A){S("Move to anchor","moveToAnchor:"+A,c[C].iframe,C)},sendMessage:function(A){A=JSON.stringify(A),S("Send Message","message:"+A,c[C].iframe,C)}})}function Qe(A){function ce(){S("iFrame.onload",A,h,e,!0),Ot()}function me(It){if(h.parentNode){var Ks=new It(function(qs){qs.forEach(function(Js){var Qs=Array.prototype.slice.call(Js.removedNodes);Qs.forEach(function(Oe){Oe===h&&Ft(h)})})});Ks.observe(h.parentNode,{childList:!0})}}var Ae=F();Ae&&me(Ae),ae(h,"load",ce),S("init",A,h,e,!0)}function ot(A){if(typeof A!="object")throw new TypeError("Options is not an object")}function Bs(A){for(var ce in R)Object.prototype.hasOwnProperty.call(R,ce)&&(c[C][ce]=Object.prototype.hasOwnProperty.call(A,ce)?A[ce]:R[ce])}function us(A){return A===""||A.match(/^(about:blank|javascript:|file:\/\/)/)!==null?"*":A}function Ws(A){var ce=A.split("Callback");if(ce.length===2){var me="on"+ce[0].charAt(0).toUpperCase()+ce[0].slice(1);this[me]=this[A],delete this[A],ye(C,"Deprecated: '"+A+"' has been renamed '"+me+"'. The old method will be removed in the next major version.")}}function Fs(A){A=A||{},c[C]=Object.create(null),c[C].iframe=h,c[C].firstRun=!0,c[C].remoteHost=h.src&&h.src.split("/").slice(0,3).join("/"),ot(A),Object.keys(A).forEach(Ws,A),Bs(A),c[C]&&(c[C].targetOrigin=c[C].checkOrigin===!0?us(c[C].remoteHost):"*")}function Vs(){return C in c&&"iFrameResizer"in h}var C=U(h.id);Vs()?ye(C,"Ignored iFrame, already setup."):(Fs(_),q(),L(),Ze(),Qe(K(C)),Je())}function le(h,_){m===null&&(m=setTimeout(function(){m=null,h()},_))}var fe={};function at(h,_,L){fe[L]||(fe[L]=setTimeout(function(){fe[L]=null,h()},_))}function Ke(){function h(){function U(q){function Ze(Je){return(c[q]&&c[q].iframe.style[Je])==="0px"}function Ot(Je){return Je.offsetParent!==null}c[q]&&Ot(c[q].iframe)&&(Ze("height")||Ze("width"))&&S("Visibility change","resize",c[q].iframe,q)}Object.keys(c).forEach(function(q){U(q)})}function _(U){z("window","Mutation observed: "+U[0].target+" "+U[0].type),le(h,16)}function L(){var U=document.querySelector("body"),q={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},Ze=new E(_);Ze.observe(U,q)}var E=F();E&&L()}function At(h){function _(){ue("Window "+h,"resize")}z("window","Trigger event: "+h),le(_,16)}function ze(){function h(){ue("Tab Visible","resize")}document.visibilityState!=="hidden"&&(z("document","Trigger event: Visibility change"),le(h,16))}function ue(h,_){function L(E){return c[E]&&c[E].resizeFrom==="parent"&&c[E].autoResize&&!c[E].firstRun}Object.keys(c).forEach(function(E){L(E)&&S(h,_,c[E].iframe,E)})}function De(){ae(window,"message",oe),ae(window,"resize",function(){At("resize")}),ae(document,"visibilitychange",ze),ae(document,"-webkit-visibilitychange",ze)}function qe(){function h(E,U){function q(){if(U.tagName){if(U.tagName.toUpperCase()!=="IFRAME")throw new TypeError("Expected <IFRAME> tag, found <"+U.tagName+">")}else throw new TypeError("Object is not a valid DOM element")}U&&(q(),se(U,E),L.push(U))}function _(E){E&&E.enablePublicMethods&&ye("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}var L;return Bt(),De(),function(E,U){switch(L=[],_(E),typeof U){case"undefined":case"string":{Array.prototype.forEach.call(document.querySelectorAll(U||"iframe"),h.bind(e,E));break}case"object":{h(E,U);break}default:throw new TypeError("Unexpected data type ("+typeof U+")")}return L}}function Vt(h){h.fn?h.fn.iFrameResize||(h.fn.iFrameResize=function(_){function L(E,U){se(U,_)}return this.filter("iframe").each(L).end()}):Cn("","Unable to bind to jQuery, it is not fully loaded.")}window.jQuery!==e&&Vt(window.jQuery),typeof e=="function"&&e.amd?e([],qe):s.exports=qe(),window.iFrameResize=window.iFrameResize||qe()})()})(pr);var Vo=pr.exports;const Ko=Pi(Vo);var qo=Object.defineProperty,Jo=Object.getOwnPropertyDescriptor,Hs=(s,e,t,n)=>{for(var i=n>1?void 0:n?Jo(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&qo(e,t,i),i};let $n=class extends we{constructor(){super(...arguments),this.src="",this.showCloseButton=!1}async onLoad(s){Ko({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 H`
|
|
322
375
|
<div class="relative">
|
|
323
376
|
${Fe(this.showCloseButton,()=>H`
|
|
324
377
|
<button class="absolute top-0 right-0 m-2 h-6 text-white focus:outline-none" @click="${this.close}">
|
|
@@ -332,7 +385,7 @@
|
|
|
332
385
|
@load=${this.onLoad}
|
|
333
386
|
></iframe>
|
|
334
387
|
</div>
|
|
335
|
-
`}}
|
|
388
|
+
`}};$n.styles=[He],Hs([ne({type:String})],$n.prototype,"src",2),Hs([ne({type:Boolean})],$n.prototype,"showCloseButton",2),$n=Hs([Ue("iai-chat-iframe")],$n);var Qo=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,Ut=(s,e,t,n)=>{for(var i=n>1?void 0:n?Yo(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Qo(e,t,i),i};let st=class extends we{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=vt({width:this.width,height:this.height});return H`
|
|
336
389
|
<div class="fixed inset-0 z-50 bg-black bg-opacity-50 flex justify-center items-center">
|
|
337
390
|
<div
|
|
338
391
|
class="flex flex-col rounded-lg shadow-lg bg-white mx-auto my-auto max-h-[90vh] max-w-[90vw] overflow-hidden"
|
|
@@ -360,124 +413,43 @@
|
|
|
360
413
|
</div>
|
|
361
414
|
</div>
|
|
362
415
|
</div>
|
|
363
|
-
`}};
|
|
416
|
+
`}};st.styles=[He,ct`
|
|
364
417
|
.header {
|
|
365
418
|
background-color: var(--iai-chat-i-iframe-modal-header-bg);
|
|
366
419
|
color: var(--iai-chat-i-iframe-modal-header-fg);
|
|
367
420
|
height: 50px;
|
|
368
421
|
}
|
|
369
|
-
`],Ut([
|
|
370
|
-
* @license
|
|
371
|
-
* Copyright 2017 Google LLC
|
|
372
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
373
|
-
*/class Is extends Nn{constructor(e){if(super(e),this.it=re,e.type!==Pn.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===re||e==null)return this._t=void 0,this.it=e;if(e===Ie)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 mo=jn(Is);function Ms(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let $t=Ms();function Yi(s){$t=s}const Gi=/[&<>"']/,go=new RegExp(Gi.source,"g"),Xi=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,yo=new RegExp(Xi.source,"g"),vo={"&":"&","<":"<",">":">",'"':""","'":"'"},er=s=>vo[s];function xe(s,e){if(e){if(Gi.test(s))return s.replace(go,er)}else if(Xi.test(s))return s.replace(yo,er);return s}const bo=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function wo(s){return s.replace(bo,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const xo=/(^|[^\[])\^/g;function J(s,e){let t=typeof s=="string"?s:s.source;e=e||"";const n={replace:(i,r)=>{let a=typeof r=="string"?r:r.source;return a=a.replace(xo,"$1"),t=t.replace(i,a),n},getRegex:()=>new RegExp(t,e)};return n}function tr(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}const bn={exec:()=>null};function nr(s,e){const t=s.replace(/\|/g,(r,a,o)=>{let l=!1,d=a;for(;--d>=0&&o[d]==="\\";)l=!l;return l?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function es(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const r=s.charAt(n-i-1);if(r===e&&!t)i++;else if(r!==e&&t)i++;else break}return s.slice(0,n-i)}function ko(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return-1}function sr(s,e,t,n){const i=e.href,r=e.title?xe(e.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const o={type:"link",raw:t,href:i,title:r,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,o}return{type:"image",raw:t,href:i,title:r,text:xe(a)}}function _o(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
|
374
|
-
`).map(i=>{const r=i.match(/^\s+/);if(r===null)return i;const[a]=r;return a.length>=n.length?i.slice(n.length):i}).join(`
|
|
375
|
-
`)}class ts{constructor(e){Y(this,"options"),Y(this,"rules"),Y(this,"lexer"),this.options=e||$t}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:es(n,`
|
|
376
|
-
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=_o(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=es(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
377
|
-
$1`);n=es(n.replace(/^ *>[ \t]?/gm,""),`
|
|
378
|
-
`);const i=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:r,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const a=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let o="",l="",d=!1;for(;e;){let u=!1;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let p=t[2].split(`
|
|
379
|
-
`,1)[0].replace(/^\t+/,De=>" ".repeat(3*De.length)),c=e.split(`
|
|
380
|
-
`,1)[0],m=0;this.options.pedantic?(m=2,l=p.trimStart()):(m=t[2].search(/[^ ]/),m=m>4?1:m,l=p.slice(m),m+=t[1].length);let R=!1;if(!p&&/^ *$/.test(c)&&(o+=c+`
|
|
381
|
-
`,e=e.substring(c.length+1),u=!0),!u){const De=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),Bt=new RegExp(`^ {0,${Math.min(3,m-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),rt=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:\`\`\`|~~~)`),Wt=new RegExp(`^ {0,${Math.min(3,m-1)}}#`);for(;e;){const $e=e.split(`
|
|
382
|
-
`,1)[0];if(c=$e,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),rt.test(c)||Wt.test(c)||De.test(c)||Bt.test(e))break;if(c.search(/[^ ]/)>=m||!c.trim())l+=`
|
|
383
|
-
`+c.slice(m);else{if(R||p.search(/[^ ]/)>=4||rt.test(p)||Wt.test(p)||Bt.test(p))break;l+=`
|
|
384
|
-
`+c}!R&&!c.trim()&&(R=!0),o+=$e+`
|
|
385
|
-
`,e=e.substring($e.length+1),p=c.slice(m)}}r.loose||(d?r.loose=!0:/\n *\n *$/.test(o)&&(d=!0));let F=null,ae;this.options.gfm&&(F=/^\[[ xX]\] /.exec(l),F&&(ae=F[0]!=="[ ] ",l=l.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:o,task:!!F,checked:ae,loose:!1,text:l,tokens:[]}),r.raw+=o}r.items[r.items.length-1].raw=o.trimEnd(),r.items[r.items.length-1].text=l.trimEnd(),r.raw=r.raw.trimEnd();for(let u=0;u<r.items.length;u++)if(this.lexer.state.top=!1,r.items[u].tokens=this.lexer.blockTokens(r.items[u].text,[]),!r.loose){const p=r.items[u].tokens.filter(m=>m.type==="space"),c=p.length>0&&p.some(m=>/\n.*\n/.test(m.raw));r.loose=c}if(r.loose)for(let u=0;u<r.items.length;u++)r.items[u].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const n=nr(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
386
|
-
`):[],a={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const o of i)/^ *-+: *$/.test(o)?a.align.push("right"):/^ *:-+: *$/.test(o)?a.align.push("center"):/^ *:-+ *$/.test(o)?a.align.push("left"):a.align.push(null);for(const o of n)a.header.push({text:o,tokens:this.lexer.inline(o)});for(const o of r)a.rows.push(nr(o,a.header.length).map(l=>({text:l,tokens:this.lexer.inline(l)})));return a}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
|
|
387
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:xe(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=es(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=ko(t[2],"()");if(a>-1){const o=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],r=a[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),sr(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const i=(n[2]||n[1]).replace(/\s+/g," "),r=t[i.toLowerCase()];if(!r){const a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return sr(n,r,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){const r=[...i[0]].length-1;let a,o,l=r,d=0;const u=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+r);(i=u.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(o=[...a].length,i[3]||i[4]){l+=o;continue}else if((i[5]||i[6])&&r%3&&!((r+o)%3)){d+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+d);const p=[...i[0]][0].length,c=e.slice(0,r+i.index+p+o);if(Math.min(r,o)%2){const R=c.slice(1,-1);return{type:"em",raw:c,text:R,tokens:this.lexer.inlineTokens(R)}}const m=c.slice(2,-2);return{type:"strong",raw:c,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),r=/^ /.test(n)&&/ $/.test(n);return i&&r&&(n=n.substring(1,n.length-1)),n=xe(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=xe(t[1]),i="mailto:"+n):(n=xe(t[1]),i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var t;let n;if(n=this.rules.inline.url.exec(e)){let i,r;if(n[2]==="@")i=xe(n[0]),r="mailto:"+i;else{let a;do a=n[0],n[0]=((t=this.rules.inline._backpedal.exec(n[0]))==null?void 0:t[0])??"";while(a!==n[0]);i=xe(n[0]),n[1]==="www."?r="http://"+n[0]:r=n[0]}return{type:"link",raw:n[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let n;return this.lexer.state.inRawBlock?n=t[0]:n=xe(t[0]),{type:"text",raw:t[0],text:n}}}}const $o=/^(?: *(?:\n|$))+/,To=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,So=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Eo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ir=/(?:[*+-]|\d{1,9}[.)])/,rr=J(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ir).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Rs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Co=/^[^\n]+/,Ps=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ao=J(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Ps).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Oo=J(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ir).getRegex(),ns="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",js=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Io=J("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",js).replace("tag",ns).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ar=J(Rs).replace("hr",wn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ns).getRegex(),Mo=J(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ar).getRegex(),Ns={blockquote:Mo,code:To,def:Ao,fences:So,heading:Eo,hr:wn,html:Io,lheading:rr,list:Oo,newline:$o,paragraph:ar,table:bn,text:Co},or=J("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",wn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ns).getRegex(),Ro={...Ns,table:or,paragraph:J(Rs).replace("hr",wn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",or).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ns).getRegex()},Po={...Ns,html:J(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",js).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:bn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:J(Rs).replace("hr",wn).replace("heading",` *#{1,6} *[^
|
|
388
|
-
]`).replace("lheading",rr).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lr=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,jo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cr=/^( {2,}|\\)\n(?!\s*$)/,No=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xn="\\p{P}\\p{S}",zo=J(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,xn).getRegex(),Do=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Zo=J(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,xn).getRegex(),Lo=J("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,xn).getRegex(),Uo=J("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,xn).getRegex(),Ho=J(/\\([punct])/,"gu").replace(/punct/g,xn).getRegex(),Bo=J(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Wo=J(js).replace("(?:-->|$)","-->").getRegex(),Fo=J("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Wo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ss=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Vo=J(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",ss).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),dr=J(/^!?\[(label)\]\[(ref)\]/).replace("label",ss).replace("ref",Ps).getRegex(),ur=J(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ps).getRegex(),Ko=J("reflink|nolink(?!\\()","g").replace("reflink",dr).replace("nolink",ur).getRegex(),zs={_backpedal:bn,anyPunctuation:Ho,autolink:Bo,blockSkip:Do,br:cr,code:jo,del:bn,emStrongLDelim:Zo,emStrongRDelimAst:Lo,emStrongRDelimUnd:Uo,escape:lr,link:Vo,nolink:ur,punctuation:zo,reflink:dr,reflinkSearch:Ko,tag:Fo,text:No,url:bn},qo={...zs,link:J(/^!?\[(label)\]\((.*?)\)/).replace("label",ss).getRegex(),reflink:J(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ss).getRegex()},Ds={...zs,escape:J(lr).replace("])","~|])").getRegex(),url:J(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Jo={...Ds,br:J(cr).replace("{2,}","*").getRegex(),text:J(Ds.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},is={normal:Ns,gfm:Ro,pedantic:Po},kn={normal:zs,gfm:Ds,breaks:Jo,pedantic:qo};class Ne{constructor(e){Y(this,"tokens"),Y(this,"options"),Y(this,"state"),Y(this,"tokenizer"),Y(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||$t,this.options.tokenizer=this.options.tokenizer||new ts,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:is.normal,inline:kn.normal};this.options.pedantic?(t.block=is.pedantic,t.inline=kn.pedantic):this.options.gfm&&(t.block=is.gfm,this.options.breaks?t.inline=kn.breaks:t.inline=kn.gfm),this.tokenizer.rules=t}static get rules(){return{block:is,inline:kn}}static lex(e,t){return new Ne(t).lex(e)}static lexInline(e,t){return new Ne(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
389
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(o,l,d)=>l+" ".repeat(d.length));let n,i,r,a;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(o=>(n=o.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
|
390
|
-
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
391
|
-
`+n.raw,i.text+=`
|
|
392
|
-
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
393
|
-
`+n.raw,i.text+=`
|
|
394
|
-
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(r=e,this.options.extensions&&this.options.extensions.startBlock){let o=1/0;const l=e.slice(1);let d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},l),typeof d=="number"&&d>=0&&(o=Math.min(o,d))}),o<1/0&&o>=0&&(r=e.substring(0,o+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r))){i=t[t.length-1],a&&i.type==="paragraph"?(i.raw+=`
|
|
395
|
-
`+n.raw,i.text+=`
|
|
396
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),a=r.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
|
|
397
|
-
`+n.raw,i.text+=`
|
|
398
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,r,a=e,o,l,d;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(d=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(n=u.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,a,d)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(r=e,this.options.extensions&&this.options.extensions.startInline){let u=1/0;const p=e.slice(1);let c;this.options.extensions.startInline.forEach(m=>{c=m.call({lexer:this},p),typeof c=="number"&&c>=0&&(u=Math.min(u,c))}),u<1/0&&u>=0&&(r=e.substring(0,u+1))}if(n=this.tokenizer.inlineText(r)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(d=n.raw.slice(-1)),l=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return t}}class _n{constructor(e){Y(this,"options"),this.options=e||$t}code(e,t,n){var i;const r=(i=(t||"").match(/^\S*/))==null?void 0:i[0];return e=e.replace(/\n$/,"")+`
|
|
399
|
-
`,r?'<pre><code class="language-'+xe(r)+'">'+(n?e:xe(e,!0))+`</code></pre>
|
|
400
|
-
`:"<pre><code>"+(n?e:xe(e,!0))+`</code></pre>
|
|
401
|
-
`}blockquote(e){return`<blockquote>
|
|
402
|
-
${e}</blockquote>
|
|
403
|
-
`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
|
|
404
|
-
`}hr(){return`<hr>
|
|
405
|
-
`}list(e,t,n){const i=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return"<"+i+r+`>
|
|
406
|
-
`+e+"</"+i+`>
|
|
407
|
-
`}listitem(e,t,n){return`<li>${e}</li>
|
|
408
|
-
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>
|
|
409
|
-
`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
|
|
410
|
-
<thead>
|
|
411
|
-
`+e+`</thead>
|
|
412
|
-
`+t+`</table>
|
|
413
|
-
`}tablerow(e){return`<tr>
|
|
414
|
-
${e}</tr>
|
|
415
|
-
`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
416
|
-
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=tr(e);if(i===null)return n;e=i;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const i=tr(e);if(i===null)return n;e=i;let r=`<img src="${e}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class Zs{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class ze{constructor(e){Y(this,"options"),Y(this,"renderer"),Y(this,"textRenderer"),this.options=e||$t,this.options.renderer=this.options.renderer||new _n,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Zs}static parse(e,t){return new ze(t).parse(e)}static parseInline(e,t){return new ze(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const a=r,o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){n+=o||"";continue}}switch(r.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{const a=r;n+=this.renderer.heading(this.parseInline(a.tokens),a.depth,wo(this.parseInline(a.tokens,this.textRenderer)));continue}case"code":{const a=r;n+=this.renderer.code(a.text,a.lang,!!a.escaped);continue}case"table":{const a=r;let o="",l="";for(let u=0;u<a.header.length;u++)l+=this.renderer.tablecell(this.parseInline(a.header[u].tokens),{header:!0,align:a.align[u]});o+=this.renderer.tablerow(l);let d="";for(let u=0;u<a.rows.length;u++){const p=a.rows[u];l="";for(let c=0;c<p.length;c++)l+=this.renderer.tablecell(this.parseInline(p[c].tokens),{header:!1,align:a.align[c]});d+=this.renderer.tablerow(l)}n+=this.renderer.table(o,d);continue}case"blockquote":{const a=r,o=this.parse(a.tokens);n+=this.renderer.blockquote(o);continue}case"list":{const a=r,o=a.ordered,l=a.start,d=a.loose;let u="";for(let p=0;p<a.items.length;p++){const c=a.items[p],m=c.checked,R=c.task;let F="";if(c.task){const ae=this.renderer.checkbox(!!m);d?c.tokens.length>0&&c.tokens[0].type==="paragraph"?(c.tokens[0].text=ae+" "+c.tokens[0].text,c.tokens[0].tokens&&c.tokens[0].tokens.length>0&&c.tokens[0].tokens[0].type==="text"&&(c.tokens[0].tokens[0].text=ae+" "+c.tokens[0].tokens[0].text)):c.tokens.unshift({type:"text",text:ae+" "}):F+=ae+" "}F+=this.parse(c.tokens,d),u+=this.renderer.listitem(F,R,!!m)}n+=this.renderer.list(u,o,l);continue}case"html":{const a=r;n+=this.renderer.html(a.text,a.block);continue}case"paragraph":{const a=r;n+=this.renderer.paragraph(this.parseInline(a.tokens));continue}case"text":{let a=r,o=a.tokens?this.parseInline(a.tokens):a.text;for(;i+1<e.length&&e[i+1].type==="text";)a=e[++i],o+=`
|
|
417
|
-
`+(a.tokens?this.parseInline(a.tokens):a.text);n+=t?this.renderer.paragraph(o):o;continue}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const a=this.options.extensions.renderers[r.type].call({parser:this},r);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=a||"";continue}}switch(r.type){case"escape":{const a=r;n+=t.text(a.text);break}case"html":{const a=r;n+=t.html(a.text);break}case"link":{const a=r;n+=t.link(a.href,a.title,this.parseInline(a.tokens,t));break}case"image":{const a=r;n+=t.image(a.href,a.title,a.text);break}case"strong":{const a=r;n+=t.strong(this.parseInline(a.tokens,t));break}case"em":{const a=r;n+=t.em(this.parseInline(a.tokens,t));break}case"codespan":{const a=r;n+=t.codespan(a.text);break}case"br":{n+=t.br();break}case"del":{const a=r;n+=t.del(this.parseInline(a.tokens,t));break}case"text":{const a=r;n+=t.text(a.text);break}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}}class $n{constructor(e){Y(this,"options"),this.options=e||$t}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}Y($n,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var rs,Ls,Us,hr;class pr{constructor(...e){Gs(this,rs),Gs(this,Us),Y(this,"defaults",Ms()),Y(this,"options",this.setOptions),Y(this,"parse",fs(this,rs,Ls).call(this,Ne.lex,ze.parse)),Y(this,"parseInline",fs(this,rs,Ls).call(this,Ne.lexInline,ze.parseInline)),Y(this,"Parser",ze),Y(this,"Renderer",_n),Y(this,"TextRenderer",Zs),Y(this,"Lexer",Ne),Y(this,"Tokenizer",ts),Y(this,"Hooks",$n),this.use(...e)}walkTokens(e,t){var n,i;let r=[];for(const a of e)switch(r=r.concat(t.call(this,a)),a.type){case"table":{const o=a;for(const l of o.header)r=r.concat(this.walkTokens(l.tokens,t));for(const l of o.rows)for(const d of l)r=r.concat(this.walkTokens(d.tokens,t));break}case"list":{const o=a;r=r.concat(this.walkTokens(o.items,t));break}default:{const o=a;(i=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{const d=o[l].flat(1/0);r=r.concat(this.walkTokens(d,t))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,t)))}}return r}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){const a=t.renderers[r.name];a?t.renderers[r.name]=function(...o){let l=r.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const a=t[r.level];a?a.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){const r=this.defaults.renderer||new _n(this.defaults);for(const a in n.renderer){if(!(a in r))throw new Error(`renderer '${a}' does not exist`);if(a==="options")continue;const o=a,l=n.renderer[o],d=r[o];r[o]=(...u)=>{let p=l.apply(r,u);return p===!1&&(p=d.apply(r,u)),p||""}}i.renderer=r}if(n.tokenizer){const r=this.defaults.tokenizer||new ts(this.defaults);for(const a in n.tokenizer){if(!(a in r))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;const o=a,l=n.tokenizer[o],d=r[o];r[o]=(...u)=>{let p=l.apply(r,u);return p===!1&&(p=d.apply(r,u)),p}}i.tokenizer=r}if(n.hooks){const r=this.defaults.hooks||new $n;for(const a in n.hooks){if(!(a in r))throw new Error(`hook '${a}' does not exist`);if(a==="options")continue;const o=a,l=n.hooks[o],d=r[o];$n.passThroughHooks.has(a)?r[o]=u=>{if(this.defaults.async)return Promise.resolve(l.call(r,u)).then(c=>d.call(r,c));const p=l.call(r,u);return d.call(r,p)}:r[o]=(...u)=>{let p=l.apply(r,u);return p===!1&&(p=d.apply(r,u)),p}}i.hooks=r}if(n.walkTokens){const r=this.defaults.walkTokens,a=n.walkTokens;i.walkTokens=function(o){let l=[];return l.push(a.call(this,o)),r&&(l=l.concat(r.call(this,o))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ne.lex(e,t??this.defaults)}parser(e,t){return ze.parse(e,t??this.defaults)}}rs=new WeakSet,Ls=function(s,e){return(t,n)=>{const i={...n},r={...this.defaults,...i};this.defaults.async===!0&&i.async===!1&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const a=fs(this,Us,hr).call(this,!!r.silent,!!r.async);if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(t):t).then(o=>s(o,r)).then(o=>r.hooks?r.hooks.processAllTokens(o):o).then(o=>r.walkTokens?Promise.all(this.walkTokens(o,r.walkTokens)).then(()=>o):o).then(o=>e(o,r)).then(o=>r.hooks?r.hooks.postprocess(o):o).catch(a);try{r.hooks&&(t=r.hooks.preprocess(t));let o=s(t,r);r.hooks&&(o=r.hooks.processAllTokens(o)),r.walkTokens&&this.walkTokens(o,r.walkTokens);let l=e(o,r);return r.hooks&&(l=r.hooks.postprocess(l)),l}catch(o){return a(o)}}},Us=new WeakSet,hr=function(s,e){return t=>{if(t.message+=`
|
|
418
|
-
Please report this to https://github.com/markedjs/marked.`,s){const n="<p>An error occurred:</p><pre>"+xe(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}};const Tt=new pr;function Q(s,e){return Tt.parse(s,e)}Q.options=Q.setOptions=function(s){return Tt.setOptions(s),Q.defaults=Tt.defaults,Yi(Q.defaults),Q},Q.getDefaults=Ms,Q.defaults=$t,Q.use=function(...s){return Tt.use(...s),Q.defaults=Tt.defaults,Yi(Q.defaults),Q},Q.walkTokens=function(s,e){return Tt.walkTokens(s,e)},Q.parseInline=Tt.parseInline,Q.Parser=ze,Q.parser=ze.parse,Q.Renderer=_n,Q.TextRenderer=Zs,Q.Lexer=Ne,Q.lexer=Ne.lex,Q.Tokenizer=ts,Q.Hooks=$n,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,ze.parse,Ne.lex;const Hs=new _n;Hs.link=(s,e,t)=>{const n=document.createElement("a");return n.setAttribute("href",s),n.setAttribute("target","_blank"),n.setAttribute("rel","noopener nofollow"),n.textContent=t,e&&n.setAttribute("title",e),n.outerHTML};const Qo=new pr({renderer:Hs});function Yo(s){const e=Go(s);return Qo.parse(e,{renderer:Hs})}function Go(s){const e={"&":"&","<":"<",">":">",'"':""","'":"'"};return s.replace(/[&<>"']/g,t=>e[t])}var Xo=Object.defineProperty,el=Object.getOwnPropertyDescriptor,fr=(s,e,t,n)=>{for(var i=n>1?void 0:n?el(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Xo(e,t,i),i};let as=class extends be{constructor(){super(...arguments),this.markdown=""}get htmlContent(){return Yo(this.markdown)}render(){return H`
|
|
419
|
-
<div class="flex flex-col gap-3">
|
|
420
|
-
${mo(this.htmlContent)}
|
|
421
|
-
</div>
|
|
422
|
-
`}};as.styles=[Re,Ge`
|
|
423
|
-
h1 {
|
|
424
|
-
font-size: 1.5em;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
h2 {
|
|
428
|
-
font-size: 1.17em;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
h3 {
|
|
432
|
-
font-size: 1em;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
ol, ul {
|
|
436
|
-
display: flex;
|
|
437
|
-
flex-direction: column;
|
|
438
|
-
padding: 0;
|
|
439
|
-
margin-left: 20px;
|
|
440
|
-
gap: 8px;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
ol {
|
|
444
|
-
list-style-type: decimal;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
a {
|
|
448
|
-
color: var(--iai-chat-i-link-color);
|
|
449
|
-
}
|
|
450
|
-
`],fr([ee({type:String})],as.prototype,"markdown",2),as=fr([Me("iai-chat-markdown-viewer")],as);var tl=Object.defineProperty,nl=Object.getOwnPropertyDescriptor,mr=(s,e,t,n)=>{for(var i=n>1?void 0:n?nl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&tl(e,t,i),i};let os=class extends be{constructor(){super(...arguments),this.content=""}render(){return H`
|
|
422
|
+
`],Ut([ne({type:String})],st.prototype,"title",2),Ut([ne({type:String})],st.prototype,"src",2),Ut([ne({type:String})],st.prototype,"width",2),Ut([ne({type:String})],st.prototype,"height",2),Ut([ne({type:Boolean})],st.prototype,"showHeader",2),st=Ut([Ue("iai-chat-iframe-modal")],st);var Go=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,fr=(s,e,t,n)=>{for(var i=n>1?void 0:n?Xo(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Go(e,t,i),i};let as=class extends we{constructor(){super(...arguments),this.content=""}render(){return H`
|
|
451
423
|
<div class="flex items-end mr-20">
|
|
452
424
|
<div class="message rounded-lg px-4 py-2">
|
|
453
|
-
|
|
425
|
+
${Us(this.content)}
|
|
454
426
|
</div>
|
|
455
427
|
</div>
|
|
456
|
-
`}};
|
|
428
|
+
`}};as.styles=[He,ct`
|
|
457
429
|
.message {
|
|
458
430
|
background-color: var(--iai-chat-i-message-assistant-bg);
|
|
459
431
|
color: var(--iai-chat-i-message-assistant-fg);
|
|
460
432
|
}
|
|
461
|
-
`],
|
|
433
|
+
`],fr([ne({type:String})],as.prototype,"content",2),as=fr([Ue("iai-chat-message-assistant")],as);async function el(s,e){const{type:t,params:n}=s,i=e[t];if(!i)throw new Error(`No handler for enhanced content type ${t}`);return i({params:n,html:H})}var tl=Object.defineProperty,nl=Object.getOwnPropertyDescriptor,Tn=(s,e,t,n)=>{for(var i=n>1?void 0:n?nl(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&tl(e,t,i),i};let St=class extends we{constructor(){super(...arguments),this.content=""}async connectedCallback(){if(super.connectedCallback(),this.enhancedContent)try{this.contentHtmlTemplate=await el(this.enhancedContent,this.options.handlers.enhancedContent)}catch(s){console.warn("Error processing enhanced content",s)}this.contentHtmlTemplate||(this.contentHtmlTemplate=H`
|
|
462
434
|
<div class="text-center text-gray-400 text-sm">
|
|
463
|
-
|
|
435
|
+
${Us(this.content)}
|
|
464
436
|
</div>
|
|
465
437
|
`)}render(){return H`
|
|
466
438
|
<div>
|
|
467
439
|
${this.contentHtmlTemplate}
|
|
468
440
|
</div>
|
|
469
|
-
`}};St.styles=[
|
|
441
|
+
`}};St.styles=[He],Tn([ne({type:Object})],St.prototype,"options",2),Tn([ne({type:String})],St.prototype,"content",2),Tn([ne({type:Object})],St.prototype,"enhancedContent",2),Tn([ne()],St.prototype,"contentHtmlTemplate",2),St=Tn([Ue("iai-chat-message-system")],St);var sl=Object.defineProperty,il=Object.getOwnPropertyDescriptor,mr=(s,e,t,n)=>{for(var i=n>1?void 0:n?il(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&sl(e,t,i),i};let os=class extends we{constructor(){super(...arguments),this.content=""}render(){return H`
|
|
470
442
|
<div class="flex items-end justify-end ml-20">
|
|
471
443
|
<div class="message rounded-lg px-4 py-2 flex gap-2">
|
|
472
444
|
<p class="whitespace-pre-wrap">${this.content}</p>
|
|
473
445
|
</div>
|
|
474
446
|
</div>
|
|
475
|
-
`}};
|
|
447
|
+
`}};os.styles=[He,ct`
|
|
476
448
|
.message {
|
|
477
449
|
background-color: var(--iai-chat-i-message-user-bg);
|
|
478
450
|
color: var(--iai-chat-i-message-user-fg);
|
|
479
451
|
}
|
|
480
|
-
`],
|
|
452
|
+
`],mr([ne({type:String})],os.prototype,"content",2),os=mr([Ue("iai-chat-message-user")],os);var rl=Object.defineProperty,al=Object.getOwnPropertyDescriptor,ls=(s,e,t,n)=>{for(var i=n>1?void 0:n?al(e,t):e,r=s.length-1,a;r>=0;r--)(a=s[r])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rl(e,t,i),i};let Ht=class extends we{constructor(){super(...arguments),this.isChatWindowOpen=!1,this.isCtaOpen=!0}render(){const{openChatButton:{width:s,height:e,imageSrc:t,cta:n},placement:i}=this.options.config,r=vt({alignItems:i!=="left"?"end":"start"}),a=vt({width:s,height:e});return H`
|
|
481
453
|
<div class="flex flex-col gap-4" style=${r}>
|
|
482
454
|
${Fe(n&&this.isCtaOpen&&!this.isChatWindowOpen,()=>H`
|
|
483
455
|
<div class="relative rounded-lg p-5 shadow-md bg-white" style="max-width: 350px;">
|
|
@@ -499,18 +471,18 @@ Please report this to https://github.com/markedjs/marked.`,s){const n="<p>An err
|
|
|
499
471
|
${Fe(t,()=>H`<img src="${t}" alt="Chat Icon" style=${a}/>`,()=>H`
|
|
500
472
|
<div class="button rounded-full flex items-center justify-center" style=${a}>
|
|
501
473
|
<div class="h-3/5 w-3/5">
|
|
502
|
-
${Fe(this.isChatWindowOpen,()=>yn,()=>
|
|
474
|
+
${Fe(this.isChatWindowOpen,()=>yn,()=>no)}
|
|
503
475
|
</div>
|
|
504
476
|
</div>
|
|
505
477
|
`)}
|
|
506
478
|
</button>
|
|
507
479
|
</div>
|
|
508
|
-
`}toggleChat(){this.dispatchEvent(new CustomEvent("toggle-chat"))}};Ht.styles=[
|
|
480
|
+
`}toggleChat(){this.dispatchEvent(new CustomEvent("toggle-chat"))}};Ht.styles=[He,ct`
|
|
509
481
|
.button {
|
|
510
482
|
background-color: var(--iai-chat-i-ocb-bg);
|
|
511
483
|
color: var(--iai-chat-i-ocb-fg);
|
|
512
484
|
}
|
|
513
|
-
`],
|
|
485
|
+
`],ls([ne({type:Object})],Ht.prototype,"options",2),ls([ne({type:Boolean})],Ht.prototype,"isChatWindowOpen",2),ls([ft()],Ht.prototype,"isCtaOpen",2),Ht=ls([Ue("iai-chat-open-chat-button")],Ht);function ol(s){return s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function gr(s,e=""){return Object.keys(s).reduce((t,n)=>{const i=ol(n),r=e?`${e}-${i}`:i;return typeof s[n]=="object"&&s[n]!==null?Object.assign(t,gr(s[n],r)):t[r]=s[n],t},{})}class ll{constructor(e){this.widget=null,this.options=Yn.parse(e);const t=document.createElement("iai-chat-popup");t.options=this.options;const n=gr(this.options.config.styles);Object.entries(n).filter(([,i])=>i).forEach(([i,r])=>{t.style.setProperty(`--iai-chat-${i}`,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}}function cl({html:s,params:e}){return s`
|
|
514
486
|
<div>
|
|
515
487
|
<h2>Unit List</h2>
|
|
516
488
|
|
|
@@ -528,7 +500,7 @@ Please report this to https://github.com/markedjs/marked.`,s){const n="<p>An err
|
|
|
528
500
|
</div>
|
|
529
501
|
`)}
|
|
530
502
|
</iai-chat-carousel>
|
|
531
|
-
`}function
|
|
503
|
+
`}function dl(s){return async function({id:t,params:n,chatWindow:i}){i.setInputDisabled(!0);const r={...n.guestCardId&&{guestCardId:n.guestCardId},...n.customerFirstName&&{firstName:n.customerFirstName},...n.customerLastName&&{lastName:n.customerLastName},...n.customerEmail&&{email:n.customerEmail},...n.customerPhoneNumber&&{phone:n.customerPhoneNumber},...n.desiredMoveInDate&&{moveInDate:n.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",u),i.setInputDisabled(!1)},l=async({detail:p})=>{if(p.type!=="tourScheduled")return;const{tourType:c,tourDate:m,tourTime:R,guestCardId:F}=p;o(),i.addMessage({role:"system",content:"Your tour has been scheduled!"}),await i.sendFunctionCallResponse(t,{status:"scheduled",tourType:c,tourDate:m,tourTime:R,guestCardId:F},!0)},d=async()=>{o(),i.addMessage({role:"system",content:"Tour Scheduler Closed"}),await i.sendFunctionCallResponse(t,{status:"canceled"},!0)},u=async()=>{o(),i.addMessage({role:"system",content:"Tour Scheduler Closed"})};a.addEventListener("message-received",l),a.addEventListener("close",d),window.addEventListener("beforeunload",u),document.body.appendChild(a),i.addMessage({role:"system",content:"Tour Scheduler Opened"})}}function yr(s){return{all:s=s||new Map,on:function(e,t){var n=s.get(e);n?n.push(t):s.set(e,[t])},off:function(e,t){var n=s.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):s.set(e,[]))},emit:function(e,t){var n=s.get(e);n&&n.slice().map(function(i){i(t)}),(n=s.get("*"))&&n.slice().map(function(i){i(e,t)})}}}class ul{constructor(e){this.chatWsUrl=e,this._emitter=yr(),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 n=JSON.parse(t.data);this._emitter.emit(n.type,n.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()}}var cs;(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={}))})(cs||(cs={}));const hl=cs.AcknowledgeType,pl="Anyone Home",fl="IB Chat Leasing - Development";let ml="https://five9.ah.inhabit.work";const gl="https://five9.ah.inhabit.work".replace("http","ws").replace(/\/$/,""),En=class En{constructor(){Ys(this,Ve,void 0);Ys(this,Et,void 0);this._emitter=yr(),this.on=this._emitter.on.bind(this._emitter),this.off=this._emitter.off.bind(this._emitter),lt(this,Ve,null),lt(this,Et,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),n=new En;return t.sessionToken&&n.setSession(t.sessionToken),t.conversationId&&n.setConversationId(t.conversationId),n.conversationStarted=t.conversationStarted||!1,n}static generateBaseUrl(e){return`https://${e}/appsvcs/rs/svc`}async createSession(){const e=await fetch(`${En.generateBaseUrl("app-scl.five9.com")}/auth/anon?cookieless=true`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({tenantName:pl})});return lt(this,Ve,await e.json()),hs(this,Ve)}setSession(e){lt(this,Ve,e)}setConversationId(e){lt(this,Et,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 ul(`${gl}/conversations/${this.conversationId}/ws`);e.on("*",(t,n)=>{this._emitter.emit(t,n)}),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:hl.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:n}=this;if(!n)throw new Error("Session not found");e=e.startsWith("/")?e:`/${e}`;const i=n.metadata.dataCenters[0].apiUrls[0].host,r=await fetch(`${En.generateBaseUrl(i)}${e}`,{...t,headers:{...t.headers,"Content-Type":"application/json",Accept:"application/json",Authorization:n.tokenId,farmId:n.context.farmId}});return r.status===204?null:r.json()}async getMetadata(){if(!this.sessionToken)throw new Error("Session not created");return this.authenticatedFetch("/auth/metadata",{method:"GET"})}async createConversation(e){if(!this.sessionToken)throw new Error("Session not created");const t=e.contact||{};Object.keys(t).forEach(r=>{const a=r;t[a]||delete t[a]});const n={...e,campaignName:fl,tenantId:this.tenantId,callbackUrl:ml};console.log("body",n);const i=await this.authenticatedFetch("/conversations",{method:"POST",body:JSON.stringify(n)});return this.setConversationId(i.id),i}async sendMessage(e){const{conversationId:t,conversationStarted:n}=this;if(!t||!n)throw new Error("Conversation not started");const i={messageType:cs.MessageType.TEXT,message:e};await this.authenticatedFetch(`/conversations/${t}/messages`,{method:"POST",body:JSON.stringify(i)})}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(),lt(this,Ve,null),lt(this,Et,null)}get sessionToken(){return hs(this,Ve)}get conversationId(){return hs(this,Et)}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}};Ve=new WeakMap,Et=new WeakMap;let ds=En;function Sn(s){return`any-${s||"main"}-chatSession`}async function yl({id:s,params:e,chatWindow:t,html:n}){t=t;const i=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"}),t.chatManager.endChat("Transferred to live agent",!1);const a=new ds;await a.createSession();const{summary:o,subject:l,...d}=e;await a.createConversation({contact:d,attributes:{Question:l,"AI Summary":o}}),localStorage.setItem(Sn(t.cleanOptions.config.historyKey),a.serialize()),vr(t,a)};t.addMessage({id:"transferMessageId",role:"system",contentHtmlTemplate:n`
|
|
532
504
|
<style>
|
|
533
505
|
.btn {
|
|
534
506
|
background-color: var(--iai-chat-i-message-user-bg);
|
|
@@ -556,4 +528,4 @@ Please report this to https://github.com/markedjs/marked.`,s){const n="<p>An err
|
|
|
556
528
|
<button class="btn btn-no" @click=${i}>No</button>
|
|
557
529
|
</div>
|
|
558
530
|
</div>
|
|
559
|
-
`})}function
|
|
531
|
+
`})}function vr(s,e){e.on("*",(r,a)=>{console.log("event:",r,a)}),e.on("conversationCreated",()=>{s.setInputDisabled(!1),localStorage.setItem(Sn(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(Sn(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)},n=async()=>{console.log("destroyed fired"),e.destroy(),s.removeEventListener("iai-chat-send-user-message",t),s.removeEventListener("iai-chat-reset",i),s.removeEventListener("iai-chat-destroy",n)},i=async()=>{console.log("reset fired"),await e.terminateConversation(),await n(),localStorage.removeItem(Sn(s.cleanOptions.config.historyKey))};s.cleanOptions.config.disclaimerMessage="You are chatting with a live agent",s.addEventListener("iai-chat-send-user-message",t),s.addEventListener("iai-chat-reset",i),s.addEventListener("iai-chat-destroy",n)}class vl{constructor(e,t){const n=Yn.parse({assistantId:"7e59c8c1-a4ff-40f1-9a68-86ea294a4e75",...e,config:{...e.config,styles:e.styles||{}}});n.handlers.functionCalls.transferToLiveAgent=yl,n.handlers.functionCalls.showScheduleTourWidget=dl(t.schedulerUrl),n.handlers.enhancedContent.unitList=cl,this.chatWidget=new ll(n);const i=localStorage.getItem(Sn(n.config.historyKey));if(i){const r=ds.deserialize(i);setTimeout(()=>{vr(this.chatWidget.api.chatWindow,r)},0)}}destroy(){this.chatWidget.destroy()}}ie.AnyChatWidget=vl,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});
|