From 97a284108715c0f581373b869b58638d3629a011 Mon Sep 17 00:00:00 2001 From: OvidijusParsiunas Date: Sat, 14 Oct 2023 16:17:10 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=20a935a?= =?UTF-8?q?c6acbe8ce0a6b24a1525af2d70d8a60a20f=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 4 ++-- assets/js/6392.a847b857.js | 2 -- assets/js/6392.d6845425.js | 2 ++ ...a847b857.js.LICENSE.txt => 6392.d6845425.js.LICENSE.txt} | 0 assets/js/{f4a41cc5.374a8986.js => f4a41cc5.8626c0c6.js} | 2 +- .../{runtime~main.cab6d4bf.js => runtime~main.2b6bf37d.js} | 2 +- docs/connect/index.html | 4 ++-- docs/demo/index.html | 4 ++-- docs/directConnection/AssemblyAI/index.html | 4 ++-- docs/directConnection/Azure/index.html | 4 ++-- docs/directConnection/Cohere/index.html | 4 ++-- docs/directConnection/HuggingFace/index.html | 4 ++-- docs/directConnection/OpenAI/index.html | 4 ++-- docs/directConnection/StabilityAI/index.html | 4 ++-- docs/directConnection/index.html | 4 ++-- docs/events/index.html | 4 ++-- docs/files/index.html | 4 ++-- docs/installation/index.html | 6 +++--- docs/interceptors/index.html | 4 ++-- docs/introPanel/index.html | 4 ++-- docs/introduction/index.html | 4 ++-- docs/messages/HTML/index.html | 4 ++-- docs/messages/index.html | 4 ++-- docs/messages/styles/index.html | 4 ++-- docs/methods/index.html | 4 ++-- docs/speech/index.html | 4 ++-- docs/styles/index.html | 4 ++-- examples/Layout/fullScreen/index.html | 4 ++-- examples/Layout/sticky/index.html | 4 ++-- examples/design/index.html | 4 ++-- examples/externalModules/index.html | 4 ++-- examples/frameworks/index.html | 4 ++-- examples/servers/index.html | 4 ++-- exploreButton/exploreButton/index.html | 4 ++-- features/captureFiles/captureFiles/index.html | 4 ++-- features/connect/connect/index.html | 4 ++-- features/customize/customize/index.html | 4 ++-- features/features/index.html | 4 ++-- features/media/media/index.html | 4 ++-- features/speech/speech/index.html | 4 ++-- footer/footer/index.html | 4 ++-- index.html | 4 ++-- playground/chat/manipulate/playgroundAddButton/index.html | 4 ++-- playground/chat/playgroundChatComponent/index.html | 4 ++-- playground/chat/playgroundChatWrapper/index.html | 4 ++-- playground/chat/playgroundChatWrapperConfig/index.html | 4 ++-- playground/chat/playgroundChatWrapperLogo/index.html | 4 ++-- playground/chat/playgroundChatWrapperText/index.html | 4 ++-- .../header/export/modal/playgroundExportModal/index.html | 4 ++-- playground/header/export/playgroundExportButton/index.html | 4 ++-- .../information/modal/playgroundInformationModal/index.html | 4 ++-- .../information/playgroundInformationButton/index.html | 4 ++-- playground/header/layout/playgroundLayoutButton/index.html | 4 ++-- playground/header/playgroundCog/index.html | 4 ++-- playground/header/playgroundHeaderButtons/index.html | 4 ++-- playground/header/playgroundShield/index.html | 4 ++-- .../header/upload/modal/playgroundUploadModal/index.html | 4 ++-- playground/header/upload/playgroundUploadButton/index.html | 4 ++-- playground/index.html | 4 ++-- playground/playgroundSelect/index.html | 4 ++-- .../serviceModal/close/serviceModalCloseButtons/index.html | 4 ++-- playground/serviceModal/code/serviceCode/index.html | 4 ++-- .../fields/serviceConstructableObject/index.html | 4 ++-- playground/serviceModal/fields/serviceField/index.html | 4 ++-- .../fields/serviceOptionalParametersFields/index.html | 4 ++-- .../serviceModal/fields/serviceRequiredField/index.html | 4 ++-- playground/serviceModal/fields/serviceTypeField/index.html | 4 ++-- playground/serviceModal/serviceModal/index.html | 4 ++-- .../serviceModal/wrappers/collapsableSection/index.html | 4 ++-- playground/tooltip/playgroundTooltipWrapper/index.html | 4 ++-- preload/preloadImages/index.html | 4 ++-- preload/preloadPlaygroundImages/index.html | 4 ++-- preload/preloadStartImages/index.html | 4 ++-- search/index.html | 4 ++-- smallScreen/deepChatLogo/index.html | 4 ++-- smallScreen/smallScreen/index.html | 4 ++-- start/connectToCustomAPI/index.html | 4 ++-- start/connectToPopularAPI/index.html | 4 ++-- start/createComponent/index.html | 4 ++-- start/index.html | 4 ++-- start/options/index.html | 4 ++-- start/startParticles/index.html | 4 ++-- start/startSmallScreen/index.html | 4 ++-- startPanel/startPanel/index.html | 4 ++-- startPanel/startPanelParticles/index.html | 4 ++-- utils/fadeInContent/index.html | 4 ++-- utils/fadeInNav/index.html | 4 ++-- utils/onVisibleAnimation/index.html | 4 ++-- 88 files changed, 171 insertions(+), 171 deletions(-) delete mode 100644 assets/js/6392.a847b857.js create mode 100644 assets/js/6392.d6845425.js rename assets/js/{6392.a847b857.js.LICENSE.txt => 6392.d6845425.js.LICENSE.txt} (100%) rename assets/js/{f4a41cc5.374a8986.js => f4a41cc5.8626c0c6.js} (98%) rename assets/js/{runtime~main.cab6d4bf.js => runtime~main.2b6bf37d.js} (74%) diff --git a/404.html b/404.html index fd4772551..bc8ae3710 100644 --- a/404.html +++ b/404.html @@ -13,13 +13,13 @@ - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/6392.a847b857.js b/assets/js/6392.a847b857.js deleted file mode 100644 index 8f41a5557..000000000 --- a/assets/js/6392.a847b857.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 6392.a847b857.js.LICENSE.txt */ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6392],{1262:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(7294),i=n(2389);function a(e){let{children:t,fallback:n}=e;return(0,i.Z)()?r.createElement(r.Fragment,null,t?.()):n??null}},1943:(e,t,n)=>{n.d(t,{L:()=>o});const r=new Set(["children","localName","ref","style","className"]),i=new WeakMap,a=(e,t,n,r,a)=>{const s=null==a?void 0:a[t];void 0===s||n===r?null==n&&t in HTMLElement.prototype?e.removeAttribute(t):e[t]=n:((e,t,n)=>{let r=i.get(e);void 0===r&&i.set(e,r=new Map);let a=r.get(t);void 0!==n?void 0===a?(r.set(t,a={handleEvent:n}),e.addEventListener(t,a)):a.handleEvent=n:void 0!==a&&(r.delete(t),e.removeEventListener(t,a))})(e,s,n)},s=(e,t)=>{"function"==typeof e?e(t):e.current=t};function o(e=window.React,t,n,i,o){let l,c,u;if(void 0===t){const t=e;({tagName:c,elementClass:u,events:i,displayName:o}=t),l=t.react}else l=e,u=n,c=t;const d=l.Component,p=l.createElement,h=new Set(Object.keys(null!=i?i:{}));class f extends d{constructor(){super(...arguments),this.o=null}t(e){if(null!==this.o)for(const t in this.i)a(this.o,t,this.props[t],e?e[t]:void 0,i)}componentDidMount(){var e;this.t(),null===(e=this.o)||void 0===e||e.removeAttribute("defer-hydration")}componentDidUpdate(e){this.t(e)}render(){const{_$Gl:e,...t}=this.props;this.h!==e&&(this.u=t=>{null!==e&&s(e,t),this.o=t,this.h=e}),this.i={};const n={ref:this.u};for(const[i,a]of Object.entries(t))r.has(i)?n["className"===i?"class":i]=a:h.has(i)||i in u.prototype?this.i[i]=a:n[i]=a;return n.suppressHydrationWarning=!0,p(c,n)}}f.displayName=null!=o?o:u.name;const m=l.forwardRef(((e,t)=>p(f,{...e,_$Gl:t},null==e?void 0:e.children)));return m.displayName=f.displayName,m}},5197:(e,t,n)=>{var r;n.r(t),n.d(t,{DeepChat:()=>o});var i=n(7694),a=n(1943),s=n(7294);const o=(0,a.L)({tagName:"deep-chat",elementClass:i.S,react:r||(r=n.t(s,2)),events:{onactivate:"activate",onchange:"change"}})},7694:(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _createForOfIteratorHelper(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0;--a){var s=this.tryEntries[a],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(l&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function asyncGeneratorStep(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(c){return void n(c)}o.done?t(l):Promise.resolve(l).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function s(e){asyncGeneratorStep(a,r,i,s,o,"next",e)}function o(e){asyncGeneratorStep(a,r,i,s,o,"throw",e)}s(void 0)}))}}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;tDeepChat});var ErrorView=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"render",value:function(e,t){var n=document.createElement("div");n.id="error-view",n.innerText=t,e.replaceChildren(n)}}]),e}(),ValidateKeyPropertyView=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"onLoad",value:function(e){e.innerHTML='
'}},{key:"createElements",value:function(){var e=document.createElement("div");return e.id="validate-property-key-view",e}},{key:"render",value:function(t,n,r){var i=e.createElements(),a={onSuccess:n,onFail:ErrorView.render.bind(this,t,"Your 'key' has failed authentication"),onLoad:e.onLoad.bind(this,i)};r.key&&r.verifyKey(r.key,a),t.replaceChildren(i)}}]),e}(),StyleUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"unsetStyle",value:function(e,t){var n=Object.keys(t).reduce((function(e,t){return e[t]="",e}),{});Object.assign(e.style,n)}},{key:"unsetActivityCSSMouseStates",value:function(t,n){n.click&&e.unsetStyle(t,n.click),n.hover&&e.unsetStyle(t,n.hover)}},{key:"unsetAllCSSMouseStates",value:function(t,n){e.unsetActivityCSSMouseStates(t,n),n.default&&e.unsetStyle(t,n.default)}},{key:"processStateful",value:function(e,t,n){var r=e.default||{},i=Object.assign(JSON.parse(JSON.stringify(_objectSpread(_objectSpread({},r),t))),null==e?void 0:e.hover);return{default:r,hover:i,click:Object.assign(JSON.parse(JSON.stringify(_objectSpread(_objectSpread({},i),n))),null==e?void 0:e.click)}}},{key:"mergeStatefulStyles",value:function(e){var t={default:{},hover:{},click:{}};return e.forEach((function(e){t.default=Object.assign(t.default,e.default),t.hover=Object.assign(t.hover,e.hover),t.click=Object.assign(t.click,e.click)})),t}},{key:"overwriteDefaultWithAlreadyApplied",value:function(e,t){Object.keys(e.default||[]).forEach((function(n){var r,i=n;t.style[i]&&null!=(r=e.default)&&r[i]&&(e.default[n]=t.style[i])}))}},{key:"applyToStyleIfNotDefined",value:function(e,t){for(var n in t){var r=t[n];""===e[n]&&r&&(e[n]=r)}}}]),e}(),_WebComponentStyleUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"apply",value:function(t,n){if(n)try{e.applyStyleSheet(t,n)}catch(r){e.addStyleElement(t,n)}}},{key:"applyStyleSheet",value:function(e,t){var n=new CSSStyleSheet;n.replaceSync(e),t.adoptedStyleSheets.push(n)}},{key:"addStyleElement",value:function(e,t){var n=document.createElement("style");n.innerHTML=e,t.appendChild(n)}},{key:"applyDefaultStyleToComponent",value:function(t){StyleUtils.applyToStyleIfNotDefined(t,e.DEFAULT_COMPONENT_STYLE)}}]),e}();_WebComponentStyleUtils.DEFAULT_COMPONENT_STYLE={height:"350px",width:"320px",border:"1px solid #cacaca",fontFamily:"'Inter', sans-serif, Avenir, Helvetica, Arial",fontSize:"0.9rem",backgroundColor:"white",position:"relative",overflow:"hidden"};var WebComponentStyleUtils=_WebComponentStyleUtils,KEYBOARD_KEY=function(e){return e.ESCAPE="Escape",e.ENTER="Enter",e.TAB="Tab",e.ARROW_UP="ArrowUp",e.ARROW_DOWN="ArrowDown",e.ARROW_RIGHT="ArrowRight",e.ARROW_LEFT="ArrowLeft",e.BACKSPACE="Backspace",e.DELETE="Delete",e.META="Meta",e.CONTROL="Control",e}(KEYBOARD_KEY||{}),Browser$1=_createClass((function e(){_classCallCheck(this,e)}));Browser$1.IS_SAFARI=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),Browser$1.IS_CHROMIUM=window.chrome;var PasteUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"sanitizePastedTextContent",value:function(e){var t,n;e.preventDefault();var r=null==(t=e.clipboardData)?void 0:t.getData("text/plain");null==(n=document.execCommand)||n.call(document,"insertHTML",!1,r)}}]),e}(),_InputLimit=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"add",value:function(t,n){t.addEventListener("keydown",e.onKeyDown.bind(this,n)),t.oninput=e.onInput.bind(this,n)}},{key:"onKeyDown",value:function(t,n){var r=n.target.textContent;r&&r.length>=t&&!e.PERMITTED_KEYS.has(n.key)&&!e.isKeyCombinationPermitted(n)&&n.preventDefault()}},{key:"isKeyCombinationPermitted",value:function(e){return"a"===e.key&&(e.ctrlKey||e.metaKey)}},{key:"onInput",value:function(e,t){var n=t.target,r=n.textContent;r&&r.length>e&&(n.textContent=r.substring(0,e),FocusUtils.focusEndOfInput(n))}}]),e}();_InputLimit.PERMITTED_KEYS=new Set([KEYBOARD_KEY.BACKSPACE,KEYBOARD_KEY.DELETE,KEYBOARD_KEY.ARROW_RIGHT,KEYBOARD_KEY.ARROW_LEFT,KEYBOARD_KEY.ARROW_DOWN,KEYBOARD_KEY.ARROW_UP,KEYBOARD_KEY.META,KEYBOARD_KEY.CONTROL,KEYBOARD_KEY.ENTER]);var InputLimit=_InputLimit,_TextInputEl=function(){function e(t,n){var r;_classCallCheck(this,e);var i=e.processConfig(t,n);this.elementRef=e.createContainerElement(null==(r=null==i?void 0:i.styles)?void 0:r.container),this.inputElementRef=this.createInputElement(i),this._config=i,this.elementRef.appendChild(this.inputElementRef),null!=n&&n.characterLimit&&InputLimit.add(this.inputElementRef,null==n?void 0:n.characterLimit)}return _createClass(e,[{key:"createInputElement",value:function(t){var n,r,i,a=document.createElement("div");return a.id=e.TEXT_INPUT_ID,a.classList.add("text-input-styling","text-input-placeholder"),a.innerText=(null==(n=null==t?void 0:t.placeholder)?void 0:n.text)||"Ask me anything!",Browser$1.IS_CHROMIUM&&e.preventAutomaticScrollUpOnNewLine(a),"boolean"==typeof(null==t?void 0:t.disabled)&&!0===t.disabled?(a.contentEditable="false",a.classList.add("text-input-disabled")):(a.contentEditable="true",this.addEventListeners(a,t)),Object.assign(a.style,null==(r=null==t?void 0:t.styles)?void 0:r.text),Object.assign(a.style,null==(i=null==t?void 0:t.placeholder)?void 0:i.style),a}},{key:"removeTextIfPlaceholder",value:function(){var t,n,r,i;this.inputElementRef.classList.contains("text-input-placeholder")&&!this.inputElementRef.classList.contains("text-input-disabled")&&(null!=(t=this._config.placeholder)&&t.style&&(StyleUtils.unsetStyle(this.inputElementRef,null==(n=this._config.placeholder)?void 0:n.style),Object.assign(this.inputElementRef.style,null==(i=null==(r=this._config)?void 0:r.styles)?void 0:i.text)),e.clear(this.inputElementRef),this.inputElementRef.classList.remove("text-input-placeholder"))}},{key:"addEventListeners",value:function(e,t){var n,r,i;e.onfocus=this.onFocus.bind(this,null==(n=null==t?void 0:t.styles)?void 0:n.focus),null!=(r=null==t?void 0:t.styles)&&r.focus&&(e.onblur=this.onBlur.bind(this,t.styles.focus,null==(i=null==t?void 0:t.styles)?void 0:i.container)),e.addEventListener("keydown",this.onKeydown.bind(this)),e.onpaste=PasteUtils.sanitizePastedTextContent}},{key:"onFocus",value:function(e){var t=this;Browser$1.IS_SAFARI?setTimeout((function(){t.removeTextIfPlaceholder()})):this.removeTextIfPlaceholder(),Object.assign(this.elementRef.style,e)}},{key:"onBlur",value:function(e,t){StyleUtils.unsetStyle(this.elementRef,e),t&&Object.assign(this.elementRef.style,t)}},{key:"onKeydown",value:function(e){var t;e.key===KEYBOARD_KEY.ENTER&&!e.ctrlKey&&!e.shiftKey&&(e.preventDefault(),null==(t=this.submit)||t.call(this))}}],[{key:"processConfig",value:function(e,t){var n,r,i,a,s;return null!==(n=t)&&void 0!==n||(t={}),null!==(r=t.disabled)&&void 0!==r||(t.disabled=e.isTextInputDisabled),null!==(i=t.placeholder)&&void 0!==i||(t.placeholder={}),null!==(a=(s=t.placeholder).text)&&void 0!==a||(s.text=e.textInputPlaceholderText),t}},{key:"preventAutomaticScrollUpOnNewLine",value:function(e){var t;e.addEventListener("keydown",(function(){t=window.scrollY})),e.addEventListener("input",(function(){t!==window.scrollY&&window.scrollTo({top:t})}))}},{key:"clear",value:function(e){var t=window.scrollY;e.classList.contains("text-input-disabled")||(e.textContent=""),Browser$1.IS_CHROMIUM&&window.scrollTo({top:t})}},{key:"toggleEditability",value:function(e,t){e.contentEditable=t?"true":"false"}},{key:"createContainerElement",value:function(e){var t=document.createElement("div");return t.id="text-input-container",Object.assign(t.style,e),t}}]),e}();_TextInputEl.TEXT_INPUT_ID="text-input";var TextInputEl=_TextInputEl,FocusUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"focusEndOfInput",value:function(e){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var n=window.getSelection();null==n||n.removeAllRanges(),null==n||n.addRange(t)}},{key:"focusFromParentElement",value:function(t){var n=t.querySelector("#".concat(TextInputEl.TEXT_INPUT_ID));n&&e.focusEndOfInput(n)}}]),e}();function capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}function getInterceptorMessage(e){return e&&JSON.stringify(e)}function getInvalidResponseMessage(e,t,n,r){var i="\n".concat(capitalizeFirstLetter(t)," message: ").concat(JSON.stringify(e)," \n"),a=n?"".concat(capitalizeFirstLetter(t)," message after interceptor: ").concat(getInterceptorMessage(r)," \n"):"";return"".concat(i+a,"Make sure the ").concat(t," message is using the Response format: https://deepchat.dev/docs/connect/#Response \n You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor")}var ErrorMessages={INVALID_KEY:"Invalid API Key",CONNECTION_FAILED:"Failed to connect",INVALID_RESPONSE:getInvalidResponseMessage,INVALID_STREAM_RESPONSE:"Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"},_RequestUtils=function(){function e(){_classCallCheck(this,e)}var t,n;return _createClass(e,null,[{key:"temporarilyRemoveHeader",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r,i){var a;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=n&&n.headers){t.next=2;break}throw new Error("Request settings have not been set up");case 2:return a=n.headers[e.CONTENT_TYPE],delete n.headers[e.CONTENT_TYPE],t.next=6,r(i);case 6:n.headers[e.CONTENT_TYPE]=a;case 7:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"displayError",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Service error, please try again.";if(console.error(t),"object"==_typeof(t))return 0===Object.keys(t).length?e.addNewErrorMessage("service",n):e.addNewErrorMessage("service",JSON.stringify(t));e.addNewErrorMessage("service",t)}},{key:"processResponseByType",value:function(e){var t=e.headers.get("content-type");return null!=t&&t.includes("application/json")?e.json():null!=t&&t.includes("text/plain")||!t?e:e.blob()}},{key:"processRequestInterceptor",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r,i,a,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==(r=t.requestInterceptor)?void 0:r.call(t,n);case 2:if(e.t0=e.sent,e.t0){e.next=5;break}e.t0=n;case 5:return i=e.t0,a=i,s=i,e.abrupt("return",{body:a.body,headers:a.headers,error:s.error});case 9:case"end":return e.stop()}}),e)}))),function(e,n){return t.apply(this,arguments)})},{key:"validateResponseFormat",value:function(e){return e&&"object"==_typeof(e)&&("string"==typeof e.error||"string"==typeof e.text||"string"==typeof e.html||"object"==_typeof(e.files))}}]),e}();_RequestUtils.CONTENT_TYPE="Content-Type";var RequestUtils=_RequestUtils;function getBytes(e,t){return _getBytes.apply(this,arguments)}function _getBytes(){return(_getBytes=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r,i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.getReader();case 1:return e.next=3,r.read();case 3:if((i=e.sent).done){e.next=7;break}n(i.value);case 5:e.next=1;break;case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function getLines(e){var t,n,r,i=!1;return function(a){void 0===t?(t=a,n=0,r=-1):t=concat(t,a);for(var s=t.length,o=0;n0){var o=i.decode(a.subarray(0,s)),l=s+(32===a[s+1]?2:1),c=i.decode(a.subarray(l));switch(o){case"data":r.data=r.data?r.data+"\n"+c:c;break;case"event":r.event=c;break;case"id":e(r.id=c);break;case"retry":var u=parseInt(c,10);isNaN(u)||t(r.retry=u)}}}}function concat(e,t){var n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function newMessage(){return{data:"",event:"",id:"",retry:void 0}}var __rest=globalThis&&globalThis.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i=0&&"ai"!==t.messages[r].role;r-=1)n.push(t.messages[r]);if(1===n.length)return e.generateResponseForOneMessage(t.messages[t.messages.length-1]);var i=t.messages.findIndex((function(e){return e.text}));return-1!==i&&n.splice(i,1),1===n.length?e.generateResponseForOneMessage(t.messages[t.messages.length-1]):"Wow, very cool files!"}},{key:"getCustomResponse",value:function(e,t){return"function"==typeof e?e(t):e}},{key:"getResponse",value:function(t){return t.customDemoResponse?e.getCustomResponse(t.customDemoResponse,t.messages[t.messages.length-1]):{text:e.generateResponse(t)}}},{key:"request",value:function(t,n,r){var i=e.getResponse(t);setTimeout(_asyncToGenerator(_regeneratorRuntime().mark((function e(){var a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==r?void 0:r(i);case 2:if(e.t0=e.sent,e.t0){e.next=5;break}e.t0=i;case 5:(a=e.t0).error?t.addNewErrorMessage("service",a.error):t.addNewMessage(a,!0,!0),n();case 7:case"end":return e.stop()}}),e)}))),400)}},{key:"requestStream",value:function(t,n){setTimeout((function(){var r,i=null==(r=e.getResponse(t))?void 0:r.text;Stream.simulate(t,n,i)}),400)}}]),e}();_Demo.URL="deep-chat-demo";var Demo=_Demo,Stream=function(){function e(){_classCallCheck(this,e)}var t;return _createClass(e,null,[{key:"request",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r,i){var a,s,o,l,c,u,d,p,h,f,m,v,g,y,_,b,k=arguments;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=!(k.length>3&&void 0!==k[3])||k[3],d={body:r,headers:null==(s=n.requestSettings)?void 0:s.headers},t.next=4,RequestUtils.processRequestInterceptor(n.deepChat,d);case 4:if(p=t.sent,h=p.body,f=p.headers,m=p.error,v=n.streamHandlers,g=v.onOpen,y=v.onClose,_=v.abortStream,!m){t.next=14;break}return t.abrupt("return",e.onInterceptorError(i,m,y));case 14:if(null==(o=n.requestSettings)||!o.handler){t.next=16;break}return t.abrupt("return",CustomHandler.stream(n,h,i));case 16:if((null==(l=n.requestSettings)?void 0:l.url)!==Demo.URL){t.next=18;break}return t.abrupt("return",Demo.requestStream(i,n.streamHandlers));case 18:b=null,fetchEventSource((null==(c=n.requestSettings)?void 0:c.url)||n.url||"",{method:(null==(u=n.requestSettings)?void 0:u.method)||"POST",headers:f,body:a?JSON.stringify(h):h,openWhenHidden:!0,onopen:function(e){return _asyncToGenerator(_regeneratorRuntime().mark((function t(){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.ok){t.next=2;break}return t.abrupt("return",(b=i.addNewStreamedMessage(),g()));case 2:return t.next=4,RequestUtils.processResponseByType(e);case 4:throw t.sent;case 5:case"end":return t.stop()}}),t)})))()},onmessage:function(e){var t;if(JSON.stringify(e.data)!==JSON.stringify("[DONE]")){var r=JSON.parse(e.data);null==(t=n.extractResultData)||t.call(n,r).then((function(t){void 0===(null==t?void 0:t.text)?console.error("Response data: ".concat(e.data," \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)):b&&i.updateStreamedMessage(t.text,b)})).catch((function(e){return RequestUtils.displayError(i,e)}))}},onerror:function(e){throw y(),e},onclose:function(){i.finaliseStreamedMessage(),y()},signal:_.signal}).catch((function(e){var t;null==(t=n.extractResultData)||t.call(n,e).then((function(){RequestUtils.displayError(i,e)})).catch((function(e){RequestUtils.displayError(i,e)}))}));case 20:case"end":return t.stop()}}),t)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"onInterceptorError",value:function(e,t,n){e.addNewErrorMessage("service",t),null==n||n()}},{key:"simulate",value:function(t,n,r){var i=n,a=(null==r?void 0:r.split(" "))||[],s=t.addNewStreamedMessage();n.onOpen(),e.populateMessages(s,a,t,i)}},{key:"populateMessages",value:function(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=n[a];if(s){r.updateStreamedMessage("".concat(s," "),t);var o=setTimeout((function(){e.populateMessages(t,n,r,i,a+1)}),i.simulationInterim||70);i.abortStream.abort=function(){return e.abort(o,r,i.onClose)}}else r.finaliseStreamedMessage(),i.onClose()}},{key:"abort",value:function(e,t,n){clearTimeout(e),t.finaliseStreamedMessage(),n()}}]),e}(),CustomHandler=function(){function e(){_classCallCheck(this,e)}var t;return _createClass(e,null,[{key:"request",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r,i){var a,s,o,l,c;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=!0,l=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,a,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o){e.next=2;break}return e.abrupt("return");case 2:return o=!1,e.next=5,null==(a=(r=n.deepChat).responseInterceptor)?void 0:a.call(r,t);case 5:if(e.t0=e.sent,e.t0){e.next=8;break}e.t0=t;case 8:s=e.t0,RequestUtils.validateResponseFormat(s)?"string"==typeof s.error?(console.error(s.error),i.addNewErrorMessage("service",s.error),n.completionsHandlers.onFinish()):n.deepChat.stream&&s.text?Stream.simulate(i,n.streamHandlers,s.text):(i.addNewMessage(s,!0,!0),n.completionsHandlers.onFinish()):(console.error(ErrorMessages.INVALID_RESPONSE(t,"server",!!n.deepChat.responseInterceptor,s)),i.addNewErrorMessage("service","Error in server message"),n.completionsHandlers.onFinish());case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),c=e.generateOptionalSignals(),null==(s=(a=n.requestSettings).handler)||s.call(a,r,_objectSpread(_objectSpread({},c),{},{onResponse:l}));case 3:case"end":return t.stop()}}),t)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"stream",value:function(t,n,r){var i,a,s=!0,o=!1,l=null;t.streamHandlers.abortStream.abort=function(){r.finaliseStreamedMessage(),t.streamHandlers.onClose(),s=!1};var c=e.generateOptionalSignals();null==(a=(i=t.requestSettings).handler)||a.call(i,n,_objectSpread(_objectSpread({},c),{},{onOpen:function(){o||!s||(l=r.addNewStreamedMessage(),t.streamHandlers.onOpen(),o=!0)},onResponse:function(e){s&&(!e||"object"!=_typeof(e)||"string"!=typeof e.error&&"string"!=typeof e.text?console.error(ErrorMessages.INVALID_RESPONSE(e,"server",!1)):e.error?(console.error(e.error),r.finaliseStreamedMessage(),t.streamHandlers.onClose(),r.addNewErrorMessage("service",e.error),s=!1):e.text&&l&&r.updateStreamedMessage(e.text,l))},onClose:function(){s&&(r.finaliseStreamedMessage(),t.streamHandlers.onClose(),s=!1)},stopClicked:t.streamHandlers.stopClicked}))}},{key:"websocket",value:function(t,n){var r,i,a={isOpen:!1,newUserMessage:{listener:function(){}}};t.websocket=a;var s=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var i,s,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a.isOpen){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,null==(s=(i=t.deepChat).responseInterceptor)?void 0:s.call(i,r);case 4:if(e.t0=e.sent,e.t0){e.next=7;break}e.t0=r;case 7:o=e.t0,RequestUtils.validateResponseFormat(o)?"string"==typeof o.error?(console.error(o.error),n.isLastMessageError()||n.addNewErrorMessage("service",o.error)):t.deepChat.stream?Stream.simulate(n,t.streamHandlers,o.text):n.addNewMessage(o,!0,!0):(console.error(ErrorMessages.INVALID_RESPONSE(r,"server",!!t.deepChat.responseInterceptor,o)),n.addNewErrorMessage("service","Error in server message"));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o=e.generateOptionalSignals();null==(i=(r=t.requestSettings).handler)||i.call(r,void 0,_objectSpread(_objectSpread({},o),{},{onOpen:function(){n.removeError(),a.isOpen=!0},onResponse:s,onClose:function(){a.isOpen=!1},newUserMessage:a.newUserMessage}))}},{key:"generateOptionalSignals",value:function(){return{onClose:function(){},onOpen:function(){},stopClicked:{listener:function(){}},newUserMessage:{listener:function(){}}}}}]),e}(),HTTPRequest=function(){function e(){_classCallCheck(this,e)}var t,n;return _createClass(e,null,[{key:"request",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r,i){var a,s,o,l,c,u,d,p,h,f,m,v,g,y=arguments;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=!(y.length>3&&void 0!==y[3])||y[3],d={body:r,headers:null==(s=n.requestSettings)?void 0:s.headers},t.next=4,RequestUtils.processRequestInterceptor(n.deepChat,d);case 4:if(p=t.sent,h=p.body,f=p.headers,m=p.error,v=n.completionsHandlers.onFinish,!m){t.next=11;break}return t.abrupt("return",e.onInterceptorError(i,m,v));case 11:if(null==(o=n.requestSettings)||!o.handler){t.next=13;break}return t.abrupt("return",CustomHandler.request(n,h,i));case 13:if((null==(l=n.requestSettings)?void 0:l.url)!==Demo.URL){t.next=15;break}return t.abrupt("return",Demo.request(i,v,n.deepChat.responseInterceptor));case 15:g=!0,fetch((null==(c=n.requestSettings)?void 0:c.url)||n.url||"",{method:(null==(u=n.requestSettings)?void 0:u.method)||"POST",headers:f,body:a?JSON.stringify(h):h}).then((function(e){return g=!!e.ok,e})).then((function(e){return RequestUtils.processResponseByType(e)})).then(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,a,s,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.extractResultData){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,null==(a=(r=n.deepChat).responseInterceptor)?void 0:a.call(r,t);case 4:if(e.t0=e.sent,e.t0){e.next=7;break}e.t0=t;case 7:return s=e.t0,e.next=10,n.extractResultData(s);case 10:if(o=e.sent,g){e.next=13;break}throw t;case 13:if(o&&"object"==_typeof(o)){e.next=15;break}throw Error(ErrorMessages.INVALID_RESPONSE(t,"response",!!n.deepChat.responseInterceptor,s));case 15:o.pollingInAnotherRequest||(n.deepChat.stream&&o.text?Stream.simulate(i,n.streamHandlers,o.text):(i.addNewMessage(o,!0,!0),v()));case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){RequestUtils.displayError(i,e),v()}));case 17:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"executePollRequest",value:function(t,n,r,i){console.log("polling");var a=t.completionsHandlers.onFinish;fetch(n,r).then((function(e){return e.json()})).then(function(){var s=_asyncToGenerator(_regeneratorRuntime().mark((function s(o){var l,c,u;return _regeneratorRuntime().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(t.extractPollResultData){s.next=2;break}return s.abrupt("return");case 2:return s.t0=t,s.next=5,null==(c=(l=t.deepChat).responseInterceptor)?void 0:c.call(l,o);case 5:if(s.t1=s.sent,s.t1){s.next=8;break}s.t1=o;case 8:return s.t2=s.t1,s.next=11,s.t0.extractPollResultData.call(s.t0,s.t2);case 11:(u=s.sent).timeoutMS?setTimeout((function(){e.executePollRequest(t,n,r,i)}),u.timeoutMS):(console.log("finished polling"),i.addNewMessage(u,!0,!0),a());case 13:case"end":return s.stop()}}),s)})));return function(e){return s.apply(this,arguments)}}()).catch((function(e){RequestUtils.displayError(i,e),a()}))}},{key:"poll",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r,i){var a,s,o,l,c,u,d,p,h,f,m,v,g,y=arguments;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=!(y.length>3&&void 0!==y[3])||y[3],c={body:r,headers:null==(s=n.requestSettings)?void 0:s.headers},t.next=4,RequestUtils.processRequestInterceptor(n.deepChat,c);case 4:if(u=t.sent,d=u.body,p=u.headers,!(h=u.error)){t.next=10;break}return t.abrupt("return",e.onInterceptorError(i,h));case 10:f=(null==(o=n.requestSettings)?void 0:o.url)||n.url||"",m=(null==(l=n.requestSettings)?void 0:l.method)||"POST",v=a?JSON.stringify(d):d,g={method:m,body:v,headers:p},e.executePollRequest(n,f,g,i);case 12:case"end":return t.stop()}}),t)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"onInterceptorError",value:function(e,t,n){e.addNewErrorMessage("service",t),null==n||n()}},{key:"verifyKey",value:function(e,t,n,r,i,a,s,o,l){if(""===e)return a(ErrorMessages.INVALID_KEY);s(),fetch(t,{method:r,headers:n,body:l||null}).then((function(e){return RequestUtils.processResponseByType(e)})).then((function(t){o(t,e,i,a)})).catch((function(e){a(ErrorMessages.CONNECTION_FAILED),console.error(e)}))}}]),e}(),MessageLimitUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"getCharacterLimitMessages",value:function(e,t){for(var n,r=0,i=e.length-1;i>=0;i-=1){var a=null==(n=e[i])?void 0:n.text;if(void 0!==a&&(r+=a.length)>t){e[i].text=a.substring(0,a.length-(r-t));break}}return e.slice(Math.max(i,0))}},{key:"getRequestMessages",value:function(e,t){for(var n,r=[],i=(null==(n=e.files)?void 0:n.length)||0,a=!!e.text,s=t.length-1;s>=0;s-=1){var o=t[s];if(r.push(o),o.file?i-=1:o.text&&(a=!1),0===i&&!a)break}return r}},{key:"getMaxMessages",value:function(e,t){return e.slice(Math.max(e.length-t,0))}},{key:"processMessages",value:function(t,n,r,i){return void 0!==r?r>0&&(n=e.getMaxMessages(n,r)):n=e.getRequestMessages(t,n),n=JSON.parse(JSON.stringify(n)),void 0===i?n:e.getCharacterLimitMessages(n,i)}}]),e}(),Websocket=function(){function e(){_classCallCheck(this,e)}var t;return _createClass(e,null,[{key:"setup",value:function(e){e.requestSettings.url!==Demo.URL&&(e.permittedErrorPrefixes=["Connection error","Error in server message"],e.websocket="pending")}},{key:"createConnection",value:function(t,n){if(document.body.contains(t.deepChat)){var r=t.requestSettings.websocket;if(r){if(t.requestSettings.handler)return CustomHandler.websocket(t,n);try{var i="boolean"!=typeof r?r:void 0,a=new WebSocket(t.requestSettings.url||"",i);t.websocket=a,t.websocket.onopen=function(){n.removeError(),t.websocket&&"object"==_typeof(t.websocket)&&e.assignListeners(t,a,n)},t.websocket.onerror=function(r){console.error(r),e.retryConnection(t,n)}}catch(i){console.error(i),e.retryConnection(t,n)}}}}},{key:"retryConnection",value:function(t,n){document.body.contains(t.deepChat)&&(t.websocket="pending",n.isLastMessageError()||n.addNewErrorMessage("service","Connection error"),setTimeout((function(){e.createConnection(t,n)}),5e3))}},{key:"assignListeners",value:function(t,n,r){n.onmessage=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(n){var i,a,s,o,l;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.extractResultData){e.next=20;break}return e.prev=1,s=JSON.parse(n.data),e.next=5,null==(a=(i=t.deepChat).responseInterceptor)?void 0:a.call(i,s);case 5:if(e.t0=e.sent,e.t0){e.next=8;break}e.t0=s;case 8:return o=e.t0,e.next=11,t.extractResultData(o);case 11:if((l=e.sent)&&"object"==_typeof(l)){e.next=14;break}throw Error(ErrorMessages.INVALID_RESPONSE(s,"server",!!t.deepChat.responseInterceptor,o));case 14:t.deepChat.stream&&l.text?Stream.simulate(r,t.streamHandlers,l.text):r.addNewMessage(l,!0,!0),e.next=20;break;case 17:e.prev=17,e.t1=e.catch(1),RequestUtils.displayError(r,e.t1,"Error in server message");case 20:case"end":return e.stop()}}),e,null,[[1,17]])})));return function(t){return e.apply(this,arguments)}}(),n.onclose=function(){console.error("Connection closed"),r.isLastMessageError()||r.addNewErrorMessage("service","Connection error"),e.createConnection(t,r)}}},{key:"sendWebsocket",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r,i){var a,s,o,l,c,u,d,p,h,f=arguments;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=!(f.length>3&&void 0!==f[3])||f[3],(l=n.websocket)&&"pending"!==l){t.next=4;break}return t.abrupt("return");case 4:return c={body:r,headers:null==(s=n.requestSettings)?void 0:s.headers},t.next=7,RequestUtils.processRequestInterceptor(n.deepChat,c);case 7:if(u=t.sent,d=u.body,!(p=u.error)){t.next=12;break}return t.abrupt("return",i.addNewErrorMessage("service",p));case 12:if(e.isWebSocket(l)){t.next=14;break}return t.abrupt("return",l.newUserMessage.listener(d));case 14:if(h=a?JSON.stringify(d):d,(null==(o=n.requestSettings)?void 0:o.url)!==Demo.URL){t.next=17;break}return t.abrupt("return",Demo.request(i,n.completionsHandlers.onFinish,n.deepChat.responseInterceptor));case 17:void 0===l.readyState||l.readyState!==l.OPEN?(console.error("Connection is not open"),i.isLastMessageError()||i.addNewErrorMessage("service","Connection error")):l.send(JSON.stringify(h));case 18:case"end":return t.stop()}}),t)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"canSendMessage",value:function(t){return!t||"pending"!==t&&(e.isWebSocket(t)?void 0!==t.readyState&&t.readyState===t.OPEN:t.isOpen)}},{key:"isWebSocket",value:function(e){return void 0!==e.send}}]),e}(),Legacy=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"checkForContainerStyles",value:function(e,t){var n=e.containerStyle;n&&(Object.assign(t.style,n),console.error("The containerStyle property is deprecated since version 1.3.14."),console.error("Please change to using the style property instead: https://deepchat.dev/docs/styles#style"))}},{key:"handleResponseProperty",value:function(e){return console.error("The {result: ....} response object type is deprecated since version 1.3.0."),console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"),e.result}}]),e}(),textarea;function decodeEntity(e){return(textarea=textarea||document.createElement("textarea")).innerHTML="&"+e+";",textarea.value}var hasOwn=Object.prototype.hasOwnProperty;function has(e,t){return!!e&&hasOwn.call(e,t)}function assign(e){return[].slice.call(arguments,1).forEach((function(t){if(t){if("object"!=_typeof(t))throw new TypeError(t+"must be object");Object.keys(t).forEach((function(n){e[n]=t[n]}))}})),e}var UNESCAPE_MD_RE=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function unescapeMd(e){return e.indexOf("\\")<0?e:e.replace(UNESCAPE_MD_RE,"$1")}function isValidEntityCode(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||65535==(65535&e)||65534==(65535&e)||e>=0&&e<=8||11===e||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function fromCodePoint(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var NAMED_ENTITY_RE=/&([a-z#][a-z0-9]{1,31});/gi,DIGITAL_ENTITY_TEST_RE=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;function replaceEntityPattern(e,t){var n=0,r=decodeEntity(t);return t!==r?r:35===t.charCodeAt(0)&&DIGITAL_ENTITY_TEST_RE.test(t)&&isValidEntityCode(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10))?fromCodePoint(n):e}function replaceEntities(e){return e.indexOf("&")<0?e:e.replace(NAMED_ENTITY_RE,replaceEntityPattern)}var HTML_ESCAPE_TEST_RE=/[&<>"]/,HTML_ESCAPE_REPLACE_RE=/[&<>"]/g,HTML_REPLACEMENTS={"&":"&","<":"<",">":">",'"':"""};function replaceUnsafeChar(e){return HTML_REPLACEMENTS[e]}function escapeHtml(e){return HTML_ESCAPE_TEST_RE.test(e)?e.replace(HTML_ESCAPE_REPLACE_RE,replaceUnsafeChar):e}var rules={};function nextToken(e,t){return++t>=e.length-2?t:"paragraph_open"===e[t].type&&e[t].tight&&"inline"===e[t+1].type&&0===e[t+1].content.length&&"paragraph_close"===e[t+2].type&&e[t+2].tight?nextToken(e,t+2):t}rules.blockquote_open=function(){return"
\n"},rules.blockquote_close=function(e,t){return"
"+getBreak(e,t)},rules.code=function(e,t){return e[t].block?"
"+escapeHtml(e[t].content)+"
"+getBreak(e,t):""+escapeHtml(e[t].content)+""},rules.fence=function(e,t,n,r,i){var a,s,o=e[t],l="",c=n.langPrefix;if(o.params){if(s=(a=o.params.split(/\s+/g)).join(" "),has(i.rules.fence_custom,a[0]))return i.rules.fence_custom[a[0]](e,t,n,r,i);l=' class="'+c+escapeHtml(replaceEntities(unescapeMd(s)))+'"'}return"
"+(n.highlight&&n.highlight.apply(n.highlight,[o.content].concat(a))||escapeHtml(o.content))+"
"+getBreak(e,t)},rules.fence_custom={},rules.heading_open=function(e,t){return""},rules.heading_close=function(e,t){return"\n"},rules.hr=function(e,t,n){return(n.xhtmlOut?"
":"
")+getBreak(e,t)},rules.bullet_list_open=function(){return"
    \n"},rules.bullet_list_close=function(e,t){return"
"+getBreak(e,t)},rules.list_item_open=function(){return"
  • "},rules.list_item_close=function(){return"
  • \n"},rules.ordered_list_open=function(e,t){var n=e[t];return"1?' start="'+n.order+'"':"")+">\n"},rules.ordered_list_close=function(e,t){return""+getBreak(e,t)},rules.paragraph_open=function(e,t){return e[t].tight?"":"

    "},rules.paragraph_close=function(e,t){var n=!(e[t].tight&&t&&"inline"===e[t-1].type&&!e[t-1].content);return(e[t].tight?"":"

    ")+(n?getBreak(e,t):"")},rules.link_open=function(e,t,n){var r=e[t].title?' title="'+escapeHtml(replaceEntities(e[t].title))+'"':"",i=n.linkTarget?' target="'+n.linkTarget+'"':"";return'"},rules.link_close=function(){return""},rules.image=function(e,t,n){var r=' src="'+escapeHtml(e[t].src)+'"',i=e[t].title?' title="'+escapeHtml(replaceEntities(e[t].title))+'"':"";return""},rules.table_open=function(){return"\n"},rules.table_close=function(){return"
    \n"},rules.thead_open=function(){return"\n"},rules.thead_close=function(){return"\n"},rules.tbody_open=function(){return"\n"},rules.tbody_close=function(){return"\n"},rules.tr_open=function(){return""},rules.tr_close=function(){return"\n"},rules.th_open=function(e,t){var n=e[t];return""},rules.th_close=function(){return""},rules.td_open=function(e,t){var n=e[t];return""},rules.td_close=function(){return""},rules.strong_open=function(){return""},rules.strong_close=function(){return""},rules.em_open=function(){return""},rules.em_close=function(){return""},rules.del_open=function(){return""},rules.del_close=function(){return""},rules.ins_open=function(){return""},rules.ins_close=function(){return""},rules.mark_open=function(){return""},rules.mark_close=function(){return""},rules.sub=function(e,t){return""+escapeHtml(e[t].content)+""},rules.sup=function(e,t){return""+escapeHtml(e[t].content)+""},rules.hardbreak=function(e,t,n){return n.xhtmlOut?"
    \n":"
    \n"},rules.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?"
    \n":"
    \n":"\n"},rules.text=function(e,t){return escapeHtml(e[t].content)},rules.htmlblock=function(e,t){return e[t].content},rules.htmltag=function(e,t){return e[t].content},rules.abbr_open=function(e,t){return''},rules.abbr_close=function(){return""},rules.footnote_ref=function(e,t){var n=Number(e[t].id+1).toString(),r="fnref"+n;return e[t].subId>0&&(r+=":"+e[t].subId),'['+n+"]"},rules.footnote_block_open=function(e,t,n){return(n.xhtmlOut?'
    \n':'
    \n')+'
    \n
      \n'},rules.footnote_block_close=function(){return"
    \n
    \n"},rules.footnote_open=function(e,t){return'
  • '},rules.footnote_close=function(){return"
  • \n"},rules.footnote_anchor=function(e,t){var n="fnref"+Number(e[t].id+1).toString();return e[t].subId>0&&(n+=":"+e[t].subId),' \u21a9'},rules.dl_open=function(){return"
    \n"},rules.dt_open=function(){return"
    "},rules.dd_open=function(){return"
    "},rules.dl_close=function(){return"
    \n"},rules.dt_close=function(){return"\n"},rules.dd_close=function(){return"\n"};var getBreak=rules.getBreak=function(e,t){return(t=nextToken(e,t))"u"&&(r.abbreviations[":"+l]=c),s)}function abbr(e){var t,n,r,i,a=e.tokens;if(!e.inlineMode)for(t=1,n=a.length-1;t1||41===n&&--r<0)break;t++}return!(a===t||(i=unescapeMd(e.src.slice(a,t)),!e.parser.validateLink(i)))&&(e.linkContent=i,e.pos=t,!0)}function parseLinkTitle(e,t){var n,r=t,i=e.posMax,a=e.src.charCodeAt(t);if(34!==a&&39!==a&&40!==a)return!1;for(t++,40===a&&(a=41);t"u"&&(r.references[p]={title:d,href:u}),s)}function references(e){var t,n,r,i,a=e.tokens;if(e.env.references=e.env.references||{},!e.inlineMode)for(t=1,n=a.length-1;t0?s[t].count:1,r=0;r=0;t--)if("text"===(a=i[t]).type){for(l=0,s=a.content,u.lastIndex=0,c=a.level,o=[];d=u.exec(s);)u.lastIndex>l&&o.push({type:"text",content:s.slice(l,d.index+d[1].length),level:c}),o.push({type:"abbr_open",title:e.env.abbreviations[":"+d[2]],level:c++}),o.push({type:"text",content:d[2],level:c}),o.push({type:"abbr_close",level:--c}),l=u.lastIndex-d[3].length;o.length&&(l=0;a--)if("inline"===e.tokens[a].type)for(t=(i=e.tokens[a].children).length-1;t>=0;t--)"text"===(n=i[t]).type&&(r=replaceScopedAbbr(r=n.content),RARE_RE.test(r)&&(r=r.replace(/\+-/g,"\xb1").replace(/\.{2,}/g,"\u2026").replace(/([?!])\u2026/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/gm,"$1\u2014$2").replace(/(^|\s)--(\s|$)/gm,"$1\u2013$2").replace(/(^|[^-\s])--([^-\s]|$)/gm,"$1\u2013$2")),n.content=r)}var QUOTE_TEST_RE=/['"]/,QUOTE_RE=/['"]/g,PUNCT_RE=/[-\s()\[\]]/,APOSTROPHE="\u2019";function isLetter(e,t){return!(t<0||t>=e.length)&&!PUNCT_RE.test(e[t])}function replaceAt(e,t,n){return e.substr(0,t)+n+e.substr(t+1)}function smartquotes(e){var t,n,r,i,a,s,o,l,c,u,d,p,h,f,m,v,g;if(e.options.typographer)for(g=[],m=e.tokens.length-1;m>=0;m--)if("inline"===e.tokens[m].type)for(v=e.tokens[m].children,g.length=0,t=0;t=0&&!(g[h].level<=o);h--);g.length=h+1,a=0,s=(r=n.content).length;e:for(;a=0&&(u=g[h],!(g[h].level=4))break;i=++r}return e.line=r,e.tokens.push({type:"code",content:e.getLines(t,i,4+e.blkIndent,!0),block:!0,lines:[t,e.line],level:e.level}),!0}function fences(e,t,n,r){var i,a,s,o,l,c=!1,u=e.bMarks[t]+e.tShift[t],d=e.eMarks[t];if(u+3>d||126!==(i=e.src.charCodeAt(u))&&96!==i||(l=u,(a=(u=e.skipChars(u,i))-l)<3)||(s=e.src.slice(u,d).trim()).indexOf("`")>=0)return!1;if(r)return!0;for(o=t;!(++o>=n||(u=l=e.bMarks[o]+e.tShift[o],d=e.eMarks[o],u=4||(u=e.skipChars(u,i),u-lv||62!==e.src.charCodeAt(m++)||e.level>=e.options.maxNesting)return!1;if(r)return!0;for(32===e.src.charCodeAt(m)&&m++,l=e.blkIndent,e.blkIndent=0,o=[e.bMarks[t]],e.bMarks[t]=m,a=(m=m=v,s=[e.tShift[t]],e.tShift[t]=m-e.bMarks[t],d=e.parser.ruler.getRules("blockquote"),i=t+1;i=(v=e.eMarks[i]));i++)if(62!==e.src.charCodeAt(m++)){if(a)break;for(f=!1,p=0,h=d.length;p=v,s.push(e.tShift[i]),e.tShift[i]=m-e.bMarks[i];for(c=e.parentType,e.parentType="blockquote",e.tokens.push({type:"blockquote_open",lines:u=[t,0],level:e.level++}),e.parser.tokenize(e,t,i),e.tokens.push({type:"blockquote_close",level:--e.level}),e.parentType=c,u[1]=e.line,p=0;pl||42!==(i=e.src.charCodeAt(o++))&&45!==i&&95!==i)return!1;for(a=1;o=(i=e.eMarks[t])||42!==(n=e.src.charCodeAt(r++))&&45!==n&&43!==n||r=i||((n=e.src.charCodeAt(r++))<48||n>57))return-1;for(;;){if(r>=i)return-1;if(!((n=e.src.charCodeAt(r++))>=48&&n<=57)){if(41===n||46===n)break;return-1}}return r=0)m=!0;else{if(!((d=skipBulletListMarker(e,t))>=0))return!1;m=!1}if(e.level>=e.options.maxNesting)return!1;if(f=e.src.charCodeAt(d-1),r)return!0;for(g=e.tokens.length,m?(u=e.bMarks[t]+e.tShift[t],h=Number(e.src.substr(u,d-u-1)),e.tokens.push({type:"ordered_list_open",order:h,lines:_=[t,0],level:e.level++})):e.tokens.push({type:"bullet_list_open",lines:_=[t,0],level:e.level++}),i=t,y=!1,k=e.parser.ruler.getRules("list");i=e.eMarks[i]?1:v-d)>4&&(p=1),p<1&&(p=1),a=d-e.bMarks[i]+p,e.tokens.push({type:"list_item_open",lines:b=[t,0],level:e.level++}),o=e.blkIndent,l=e.tight,s=e.tShift[t],c=e.parentType,e.tShift[t]=v-e.bMarks[t],e.blkIndent=a,e.tight=!0,e.parentType="list",e.parser.tokenize(e,t,n,!0),(!e.tight||y)&&(E=!1),y=e.line-t>1&&e.isEmpty(e.line-1),e.blkIndent=o,e.tShift[t]=s,e.tight=l,e.parentType=c,e.tokens.push({type:"list_item_close",level:--e.level}),i=t=e.line,b[1]=i,v=e.bMarks[t],!(i>=n||e.isEmpty(i)||e.tShift[i]u||91!==e.src.charCodeAt(c)||94!==e.src.charCodeAt(c+1)||e.level>=e.options.maxNesting)return!1;for(o=c+2;o=u||58!==e.src.charCodeAt(++o))&&(r||(o++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={}),l=e.src.slice(c+2,o-2),e.env.footnotes.refs[":"+l]=-1,e.tokens.push({type:"footnote_reference_open",label:l,level:e.level++}),i=e.bMarks[t],a=e.tShift[t],s=e.parentType,e.tShift[t]=e.skipSpaces(o)-o,e.bMarks[t]=o,e.blkIndent+=4,e.parentType="footnote",e.tShift[t]=l||(35!==(i=e.src.charCodeAt(o))||o>=l))return!1;for(a=1,i=e.src.charCodeAt(++o);35===i&&o6||oo&&32===e.src.charCodeAt(s-1)&&(l=s),e.line=t+1,e.tokens.push({type:"heading_open",hLevel:a,lines:[t,e.line],level:e.level}),o=n||e.tShift[s]3||(i=e.bMarks[s]+e.tShift[s],a=e.eMarks[s],i>=a)||(r=e.src.charCodeAt(i),45!==r&&61!==r)||(i=e.skipChars(i,r),i=e.skipSpaces(i),i=this.eMarks[e]},StateBlock.prototype.skipEmptyLines=function(e){for(var t=this.lineMax;en;)if(t!==this.src.charCodeAt(--e))return e+1;return e},StateBlock.prototype.getLines=function(e,t,n,r){var i,a,s,o,l,c=e;if(e>=t)return"";if(c+1===t)return a=this.bMarks[c]+Math.min(this.tShift[c],n),s=r?this.eMarks[c]+1:this.eMarks[c],this.src.slice(a,s);for(o=new Array(t-e),i=0;cn&&(l=n),l<0&&(l=0),a=this.bMarks[c]+l,s=c+1]/,HTML_TAG_CLOSE_RE=/^<\/([a-zA-Z]{1,15})[\s>]/;function isLetter$1(e){var t=32|e;return t>=97&&t<=122}function htmlblock(e,t,n,r){var i,a,s,o=e.bMarks[t],l=e.eMarks[t],c=e.tShift[t];if(o+=c,!e.options.html||c>3||o+2>=l||60!==e.src.charCodeAt(o))return!1;if(33===(i=e.src.charCodeAt(o+1))||63===i){if(r)return!0}else{if(47!==i&&!isLetter$1(i))return!1;if(47===i){if(!(a=e.src.slice(o,l).match(HTML_TAG_CLOSE_RE)))return!1}else if(!(a=e.src.slice(o,l).match(HTML_TAG_OPEN_RE)))return!1;if(!0!==html_blocks[a[1].toLowerCase()])return!1;if(r)return!0}for(s=t+1;sn||(l=t+1,e.tShift[l]=e.eMarks[l]||124!==(i=e.src.charCodeAt(s))&&45!==i&&58!==i||(a=getLine(e,t+1),!/^[-:| ]+$/.test(a))||(c=a.split("|"))<=2)return!1;for(d=[],o=0;o=a||126!==(r=e.src.charCodeAt(i++))&&58!==r||i===(n=e.skipSpaces(i))||n>=a?-1:n}function markTightParagraphs$1(e,t){var n,r,i=e.level+2;for(n=t+2,r=e.tokens.length-2;n=0;if(u=t+1,e.isEmpty(u)&&++u>n||e.tShift[u]=e.options.maxNesting)return!1;c=e.tokens.length,e.tokens.push({type:"dl_open",lines:l=[t,0],level:e.level++}),s=t,a=u;e:for(;;){for(g=!0,v=!1,e.tokens.push({type:"dt_open",lines:[s,s],level:e.level++}),e.tokens.push({type:"inline",content:e.getLines(s,s+1,e.blkIndent,!1).trim(),level:e.level+1,lines:[s,s],children:[]}),e.tokens.push({type:"dt_close",level:--e.level});;){if(e.tokens.push({type:"dd_open",lines:o=[u,0],level:e.level++}),m=e.tight,p=e.ddIndent,d=e.blkIndent,f=e.tShift[a],h=e.parentType,e.blkIndent=e.ddIndent=e.tShift[a]+2,e.tShift[a]=i-e.bMarks[a],e.tight=!0,e.parentType="deflist",e.parser.tokenize(e,a,n,!0),(!e.tight||v)&&(g=!1),v=e.line-a>1&&e.isEmpty(e.line-1),e.tShift[a]=f,e.tight=m,e.parentType=h,e.blkIndent=d,e.ddIndent=p,e.tokens.push({type:"dd_close",level:--e.level}),o[1]=u=e.line,u>=n||e.tShift[u]=n||(s=u,e.isEmpty(s))||e.tShift[s]=n||(e.isEmpty(a)&&a++,a>=n)||e.tShift[a]3)){for(i=!1,a=0,s=o.length;a=n||e.tShift[s]=0&&32===e.pending.charCodeAt(n))if(n>=1&&32===e.pending.charCodeAt(n-1)){for(var a=n-2;a>=0;a--)if(32!==e.pending.charCodeAt(a)){e.pending=e.pending.substring(0,a+1);break}e.push({type:"hardbreak",level:e.level})}else e.pending=e.pending.slice(0,-1),e.push({type:"softbreak",level:e.level});else e.push({type:"softbreak",level:e.level});for(i++;i=0&&(e=e.replace(TABS_SCAN_RE,(function(t,n){var r;return 10===e.charCodeAt(n)?(a=n+1,s=0,t):(r=" ".slice((n-a-s)%4),s=n-a+1,r)}))),i=new StateBlock(e,this,t,n,r),this.tokenize(i,i.line,i.lineMax)};for(var ESCAPED=[],i=0;i<256;i++)ESCAPED.push(0);function escape(e,t){var n,r=e.pos,i=e.posMax;if(92!==e.src.charCodeAt(r))return!1;if(++r=o||126!==e.src.charCodeAt(l+1)||e.level>=e.options.maxNesting||(a=l>0?e.src.charCodeAt(l-1):-1,s=e.src.charCodeAt(l+2),126===a)||126===s||32===s||10===s)return!1;for(r=l+2;rl+3)return e.pos+=r-l,t||(e.pending+=e.src.slice(l,r)),!0;for(e.pos=l+2,i=1;e.pos+1=o||43!==e.src.charCodeAt(l+1)||e.level>=e.options.maxNesting||(a=l>0?e.src.charCodeAt(l-1):-1,s=e.src.charCodeAt(l+2),43===a)||43===s||32===s||10===s)return!1;for(r=l+2;r=o||61!==e.src.charCodeAt(l+1)||e.level>=e.options.maxNesting||(a=l>0?e.src.charCodeAt(l-1):-1,s=e.src.charCodeAt(l+2),61===a)||61===s||32===s||10===s)return!1;for(r=l+2;r=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122}function scanDelims(e,t){var n,r,i,a=t,s=!0,o=!0,l=e.posMax,c=e.src.charCodeAt(t);for(n=t>0?e.src.charCodeAt(t-1):-1;a=l&&(s=!1),(i=a-t)>=4?s=o=!1:((32===(r=a=e.options.maxNesting)return!1;for(e.pos=u+n,o=[n];e.pos?@[]^_`{|}~-".split("").forEach((function(e){ESCAPED[e.charCodeAt(0)]=1}));var UNESCAPE_RE=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function sub(e,t){var n,r,i=e.posMax,a=e.pos;if(126!==e.src.charCodeAt(a)||t||a+2>=i||e.level>=e.options.maxNesting)return!1;for(e.pos=a+1;e.pos?@[\]^_`{|}~-])/g;function sup(e,t){var n,r,i=e.posMax,a=e.pos;if(94!==e.src.charCodeAt(a)||t||a+2>=i||e.level>=e.options.maxNesting)return!1;for(e.pos=a+1;e.pos=e.options.maxNesting||(n=h+1,(r=parseLinkLabel(e,h))<0))return!1;if((o=r+1)=p)return!1;for(h=o,parseLinkDestination(e,o)?(a=e.linkContent,o=e.pos):a="",h=o;o=p||41!==e.src.charCodeAt(o))return e.pos=d,!1;o++}else{if(e.linkLevel>0)return!1;for(;o=0?i=e.src.slice(h,o++):o=h-1),i||(_typeof(i)>"u"&&(o=r+1),i=e.src.slice(n,r)),!(l=e.env.references[normalizeReference(i)]))return e.pos=d,!1;a=l.href,s=l.title}return t||(e.pos=n,e.posMax=r,u?e.push({type:"image",src:a,title:s,alt:e.src.substr(n,r-n),level:e.level}):(e.push({type:"link_open",href:a,title:s,level:e.level++}),e.linkLevel++,e.parser.tokenize(e),e.linkLevel--,e.push({type:"link_close",level:--e.level}))),e.pos=o,e.posMax=p,!0}function footnote_inline(e,t){var n,r,i,a,s=e.posMax,o=e.pos;return!(o+2>=s||94!==e.src.charCodeAt(o)||91!==e.src.charCodeAt(o+1)||e.level>=e.options.maxNesting||(n=o+2,r=parseLinkLabel(e,o+1),r<0))&&(t||(e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]),i=e.env.footnotes.list.length,e.pos=n,e.posMax=r,e.push({type:"footnote_ref",id:i,level:e.level}),e.linkLevel++,a=e.tokens.length,e.parser.tokenize(e),e.env.footnotes.list[i]={tokens:e.tokens.splice(a)},e.linkLevel--),e.pos=r+1,e.posMax=s,!0)}function footnote_ref(e,t){var n,r,i,a,s=e.posMax,o=e.pos;if(o+3>s||!e.env.footnotes||!e.env.footnotes.refs||91!==e.src.charCodeAt(o)||94!==e.src.charCodeAt(o+1)||e.level>=e.options.maxNesting)return!1;for(r=o+2;r=s||(r++,n=e.src.slice(o+2,r-1),_typeof(e.env.footnotes.refs[":"+n])>"u"))&&(t||(e.env.footnotes.list||(e.env.footnotes.list=[]),e.env.footnotes.refs[":"+n]<0?(i=e.env.footnotes.list.length,e.env.footnotes.list[i]={label:n,count:0},e.env.footnotes.refs[":"+n]=i):i=e.env.footnotes.refs[":"+n],a=e.env.footnotes.list[i].count,e.env.footnotes.list[i].count++,e.push({type:"footnote_ref",id:i,subId:a,level:e.level})),e.pos=r,e.posMax=s,!0)}var url_schemas=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"],EMAIL_RE=/^<([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])?)*)>/,AUTOLINK_RE=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;function autolink(e,t){var n,r,i,a,s,o=e.pos;return!(60!==e.src.charCodeAt(o)||(n=e.src.slice(o),n.indexOf(">")<0))&&((r=n.match(AUTOLINK_RE))?!(url_schemas.indexOf(r[1].toLowerCase())<0||(a=r[0].slice(1,-1),s=normalizeLink(a),!e.parser.validateLink(a)))&&(t||(e.push({type:"link_open",href:s,level:e.level}),e.push({type:"text",content:a,level:e.level+1}),e.push({type:"link_close",level:e.level})),e.pos+=r[0].length,!0):!!(i=n.match(EMAIL_RE))&&(s=normalizeLink("mailto:"+(a=i[0].slice(1,-1))),!!e.parser.validateLink(s)&&(t||(e.push({type:"link_open",href:s,level:e.level}),e.push({type:"text",content:a,level:e.level+1}),e.push({type:"link_close",level:e.level})),e.pos+=i[0].length,!0)))}function replace$1(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,e=e.replace(r,i),n):new RegExp(e,t)}}var attr_name=/[a-zA-Z_:][a-zA-Z0-9:._-]*/,unquoted=/[^"'=<>`\x00-\x20]+/,single_quoted=/'[^']*'/,double_quoted=/"[^"]*"/,attr_value=replace$1(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",unquoted)("single_quoted",single_quoted)("double_quoted",double_quoted)(),attribute=replace$1(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",attr_name)("attr_value",attr_value)(),open_tag=replace$1(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",attribute)(),close_tag=/<\/[A-Za-z][A-Za-z0-9]*\s*>/,comment=/|/,processing=/<[?].*?[?]>/,declaration=/]*>/,cdata=//,HTML_TAG_RE=replace$1(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag",open_tag)("close_tag",close_tag)("comment",comment)("processing",processing)("declaration",declaration)("cdata",cdata)();function isLetter$2(e){var t=32|e;return t>=97&&t<=122}function htmltag(e,t){var n,r,i,a=e.pos;return!(!e.options.html||(i=e.posMax,60!==e.src.charCodeAt(a)||a+2>=i)||(n=e.src.charCodeAt(a+1),33!==n&&63!==n&&47!==n&&!isLetter$2(n))||(r=e.src.slice(a).match(HTML_TAG_RE),!r))&&(t||e.push({type:"htmltag",content:e.src.slice(a,a+r[0].length),level:e.level}),e.pos+=r[0].length,!0)}var DIGITAL_RE=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,NAMED_RE=/^&([a-z][a-z0-9]{1,31});/i;function entity(e,t){var n,r,i=e.pos,a=e.posMax;if(38!==e.src.charCodeAt(i))return!1;if(i+10)e.pos=n;else{for(t=0;t=a)break}else e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},ParserInline.prototype.parse=function(e,t,n,r){var i=new StateInline(e,this,t,n,r);this.tokenize(i)};var defaultConfig={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","replacements","smartquotes","references","abbr2","footnote_tail"]},block:{rules:["blockquote","code","fences","footnote","heading","hr","htmlblock","lheading","list","paragraph","table"]},inline:{rules:["autolink","backticks","del","emphasis","entity","escape","footnote_ref","htmltag","links","newline","text"]}}},fullConfig={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{},block:{},inline:{}}},commonmarkConfig={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"\u201c\u201d\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","abbr2"]},block:{rules:["blockquote","code","fences","heading","hr","htmlblock","lheading","list","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","htmltag","links","newline","text"]}}},config={default:defaultConfig,full:fullConfig,commonmark:commonmarkConfig};function StateCore(e,t,n){this.src=t,this.env=n,this.options=e.options,this.tokens=[],this.inlineMode=!1,this.inline=e.inline,this.block=e.block,this.renderer=e.renderer,this.typographer=e.typographer}function Remarkable(e,t){"string"!=typeof e&&(t=e,e="default"),t&&null!=t.linkify&&console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"),this.inline=new ParserInline,this.block=new ParserBlock,this.core=new Core,this.renderer=new Renderer,this.ruler=new Ruler,this.options={},this.configure(config[e]),this.set(t||{})}Remarkable.prototype.set=function(e){assign(this.options,e)},Remarkable.prototype.configure=function(e){var t=this;if(!e)throw new Error("Wrong `remarkable` preset, check name/content");e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach((function(n){e.components[n].rules&&t[n].ruler.enable(e.components[n].rules,!0)}))},Remarkable.prototype.use=function(e,t){return e(this,t),this},Remarkable.prototype.parse=function(e,t){var n=new StateCore(this,e,t);return this.core.process(n),n.tokens},Remarkable.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)},Remarkable.prototype.parseInline=function(e,t){var n=new StateCore(this,e,t);return n.inlineMode=!0,this.core.process(n),n.tokens},Remarkable.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var RemarkableConfig=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"createNew",value:function(){var e=window.hljs;return new Remarkable(e?{highlight:function(t,n){if(n&&e.getLanguage(n))try{return e.highlight(n,t).value}catch(r){console.error("failed to setup the highlight dependency")}try{return e.highlightAuto(t).value}catch(i){console.error("failed to automatically highlight messages")}return""},html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"_blank",typographer:!0}:{highlight:function(e){return e},linkTarget:"_blank"})}}]),e}(),SetFileTypes=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"parseConfig",value:function(e,t,n,r){var i,a={files:t};if("object"==_typeof(r)){var s=r.files,o=r.request,l=r.button;s&&(s.infoModal&&(a.files.infoModal=s.infoModal,null!=(i=s.infoModal)&&i.textMarkDown&&(a.infoModalTextMarkUp=n.render(s.infoModal.textMarkDown))),s.acceptedFormats&&(a.files.acceptedFormats=s.acceptedFormats),s.maxNumberOfFiles&&(a.files.maxNumberOfFiles=s.maxNumberOfFiles)),a.button=l,o&&(o.headers||o.method||o.url||e.headers||e.method||e.url)&&(a.request={headers:(null==o?void 0:o.headers)||e.headers,method:(null==o?void 0:o.method)||e.method,url:(null==o?void 0:o.url)||e.url})}return a}},{key:"processMixedFiles",value:function(t,n,r){if(r){t.fileTypes.mixedFiles=e.parseConfig(t.requestSettings,{acceptedFormats:""},n,r)}}},{key:"processMicrophone",value:function(t,n,r,i){var a,s,o,l,c,u,d,p,h=_objectSpread({acceptedFormats:"audio/*"},(null==(o=t.fileTypes.audio)?void 0:o.files)||{});r&&(void 0!==navigator.mediaDevices.getUserMedia?(t.recordAudio=e.parseConfig(t.requestSettings,h,n,r),"object"==_typeof(r)&&r.files&&(null!==(a=(l=t.recordAudio).files)&&void 0!==a||(l.files={}),t.recordAudio.files.format=null==(c=r.files)?void 0:c.format,t.recordAudio.files.maxDurationSeconds=null==(u=r.files)?void 0:u.maxDurationSeconds,null!=(d=t.fileTypes.audio)&&d.files&&(null!==(s=(p=t.fileTypes.audio.files).maxNumberOfFiles)&&void 0!==s||(p.maxNumberOfFiles=r.files.maxNumberOfFiles)))):i||(t.fileTypes.audio=e.parseConfig(t.requestSettings,h,n,r)))}},{key:"processAudioConfig",value:function(t,n,r,i){if(r||i){var a=_objectSpread({acceptedFormats:"audio/*"},(null==i?void 0:i.files)||{});t.fileTypes.audio=e.parseConfig(t.requestSettings,a,n,r)}}},{key:"processGifConfig",value:function(t,n,r,i){if(r||i){var a=_objectSpread({acceptedFormats:"image/gif"},(null==i?void 0:i.files)||{});t.fileTypes.gifs=e.parseConfig(t.requestSettings,a,n,r)}}},{key:"processCamera",value:function(t,n,r,i){var a,s,o,l,c,u=_objectSpread({acceptedFormats:"image/*"},(null==(s=t.fileTypes.images)?void 0:s.files)||{});r&&(void 0!==navigator.mediaDevices.getUserMedia?(t.camera=e.parseConfig(t.requestSettings,u,n,r),"object"==_typeof(r)&&(t.camera.modalContainerStyle=r.modalContainerStyle,r.files&&(null!==(a=(o=t.camera).files)&&void 0!==a||(o.files={}),t.camera.files.format=null==(l=r.files)?void 0:l.format,t.camera.files.dimensions=null==(c=r.files)?void 0:c.dimensions))):i||(t.fileTypes.images=e.parseConfig(t.requestSettings,u,n,r)))}},{key:"processImagesConfig",value:function(t,n,r,i){if(r||i){var a=_objectSpread({acceptedFormats:"image/*"},(null==i?void 0:i.files)||{});t.fileTypes.images=e.parseConfig(t.requestSettings,a,n,r)}}},{key:"populateDefaultFileIO",value:function(e,t){var n,r,i,a,s;e&&(null!==(n=e.files)&&void 0!==n||(e.files={}),null!==(r=(a=e.files).acceptedFormats)&&void 0!==r||(a.acceptedFormats=t),null!==(i=(s=e.files).maxNumberOfFiles)&&void 0!==i||(s.maxNumberOfFiles=1))}},{key:"set",value:function(t,n,r){e.populateDefaultFileIO(null==r?void 0:r.audio,".4a,.mp3,.webm,.mp4,.mpga,.wav,.mpeg,.m4a"),e.populateDefaultFileIO(null==r?void 0:r.images,".png,.jpg");var i=RemarkableConfig.createNew();e.processImagesConfig(n,i,t.images,null==r?void 0:r.images),e.processCamera(n,i,t.camera,t.images),e.processGifConfig(n,i,t.gifs,null==r?void 0:r.gifs),e.processAudioConfig(n,i,t.audio,null==r?void 0:r.audio),e.processMicrophone(n,i,t.microphone,t.audio),e.processMixedFiles(n,i,t.mixedFiles)}}]),e}(),BaseServiceIO=function(){function e(t,n,r){var i,a,s,o,l;_classCallCheck(this,e),this.rawBody={},this.validateConfigKey=!1,this.canSendMessage=e.canSendMessage,this.requestSettings={},this.fileTypes={},this.completionsHandlers={},this.streamHandlers={},this.deepChat=t,this.demo=r,Object.assign(this.rawBody,null==(a=t.request)?void 0:a.additionalBodyProps),this.totalMessagesMaxCharLength=null==(s=null==t?void 0:t.requestBodyLimits)?void 0:s.totalMessagesMaxCharLength,this.maxMessages=null==(o=null==t?void 0:t.requestBodyLimits)?void 0:o.maxMessages,SetFileTypes.set(t,this,n),t.request&&(this.requestSettings=t.request),this.demo&&(null!==(i=(l=this.requestSettings).url)&&void 0!==i||(l.url=Demo.URL)),this._directServiceRequiresFiles=!!n&&Object.keys(n).length>0,this.requestSettings.websocket&&Websocket.setup(this)}var t,n,r,i;return _createClass(e,[{key:"verifyKey",value:function(e,t){}},{key:"getServiceIOByType",value:function(e){if(e.type.startsWith("audio")&&this.fileTypes.audio)return this.fileTypes.audio;if(e.type.startsWith("image")){if(this.fileTypes.gifs&&e.type.endsWith("/gif"))return this.fileTypes.gifs;if(this.fileTypes.images)return this.fileTypes.images;if(this.camera)return this.camera}return this.fileTypes.mixedFiles}},{key:"callServiceAPI",value:(i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var i,a,s,o,l,c,u,d,p;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=_objectSpread({messages:n},this.rawBody),d=!1,null!=(s=this.requestSettings.headers)&&s["Content-Type"]||(null!==(i=(o=this.requestSettings).headers)&&void 0!==i||(o.headers={}),null!==(a=(l=this.requestSettings.headers)["Content-Type"])&&void 0!==a||(l["Content-Type"]="application/json"),d=!0),!(p=this.deepChat.stream)||!this.demo&&"object"==_typeof(p)&&p.simulation){e.next=9;break}return e.next=7,Stream.request(this,u,t);case 7:e.next=11;break;case 9:return e.next=11,HTTPRequest.request(this,u,t);case 11:d&&(null==(c=this.requestSettings.headers)||delete c["Content-Type"]);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return i.apply(this,arguments)})},{key:"callApiWithFiles",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r,i,a){var s,o,l;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=e.createCustomFormDataBody(n,i,a),o=this.requestSettings,l=this.getServiceIOByType(a[0]),this.requestSettings=(null==l?void 0:l.request)||this.requestSettings,t.next=4,HTTPRequest.request(this,s,r,!1);case 4:this.requestSettings=o;case 5:case"end":return t.stop()}}),t,this)}))),function(e,t,n,i){return r.apply(this,arguments)})},{key:"callAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r,i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=MessageLimitUtils.processMessages(t,n.messages,this.maxMessages,this.totalMessagesMaxCharLength),this.requestSettings.websocket?(i=_objectSpread({messages:r},this.rawBody),Websocket.sendWebsocket(this,i,n,!1)):t.files&&!this._directServiceRequiresFiles?this.callApiWithFiles(this.rawBody,n,r,t.files):this.callServiceAPI(n,r,t.files);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return e.abrupt("return",t.result?Legacy.handleResponseProperty(t):t);case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"isDirectConnection",value:function(){return!1}}],[{key:"canSendMessage",value:function(e,t){return!(!e||""===e.trim())||!!(t&&t.length>0)}},{key:"createCustomFormDataBody",value:function(e,t,n){var r=new FormData;n.forEach((function(e){return r.append("files",e)})),Object.keys(e).forEach((function(t){return r.append(t,String(e[t]))}));var i=0;return t.forEach((function(e){e.text&&r.append("message".concat(i+=1),JSON.stringify(e))})),r}}]),e}(),DirectServiceIO=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r,i,a,s){var o,l;return _classCallCheck(this,n),(o=t.call(this,e,s)).insertKeyPlaceholderText="API Key",o.getKeyLink="",Object.assign(o.rawBody,null==(l=e.request)?void 0:l.additionalBodyProps),o.keyVerificationDetails=r,o.buildHeadersFunc=i,a&&o.setApiKeyProperties(a),o.requestSettings=o.buildRequestSettings(o.key||"",e.request),o}return _createClass(n,[{key:"setApiKeyProperties",value:function(e){this.key=e.key,e.validateKeyProperty&&(this.validateConfigKey=e.validateKeyProperty)}},{key:"buildRequestSettings",value:function(e,t){var n=null!=t?t:{};return n.headers=this.buildHeadersFunc(e),n}},{key:"keyAuthenticated",value:function(e,t){this.requestSettings=this.buildRequestSettings(t,this.requestSettings),this.key=t,e()}},{key:"verifyKey",value:function(e,t){var n=this.keyVerificationDetails,r=n.url,i=n.method,a=n.handleVerificationResult,s=n.createHeaders,o=n.body,l=(null==s?void 0:s(e))||this.buildHeadersFunc(e);HTTPRequest.verifyKey(e,r,l,i,this.keyAuthenticated.bind(this,t.onSuccess),t.onFail,t.onLoad,a,o)}},{key:"isDirectConnection",value:function(){return!0}}]),n}(BaseServiceIO),RenderControl=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"waitForPropertiesToBeUpdatedBeforeRender",value:function(t){t._propUpdated_=!1,setTimeout((function(){t._propUpdated_?e.waitForPropertiesToBeUpdatedBeforeRender(t):(t._waitingToRender_=!1,t.onRender())}))}},{key:"attemptRender",value:function(t){t._propUpdated_=!0,t._waitingToRender_||(t._waitingToRender_=!0,e.waitForPropertiesToBeUpdatedBeforeRender(t))}}]),e}(),_InternalHTML=function(e){_inherits(n,e);var t=_createSuper(n);function n(){var e;return _classCallCheck(this,n),(e=t.call(this))._waitingToRender_=!1,e._propUpdated_=!1,Object.keys(n._attributeToProperty_).forEach((function(t){var r=n._attributeToProperty_[t];e.constructPropertyAccessors(r),e.hasOwnProperty(t)||e.constructPropertyAccessors(r,t)})),e}return _createClass(n,[{key:"constructPropertyAccessors",value:function(e,t){var n;Object.defineProperty(this,t||e,{get:function(){return n},set:function(r){n=r,t?this[e]=r:RenderControl.attemptRender(this)}})}},{key:"attributeChangedCallback",value:function(e,t,r){if(t!==r){var i=n._attributes_[e](r);this[n._attributeToProperty_[e]]=i}}},{key:"onRender",value:function(){}}],[{key:"observedAttributes",get:function(){return Object.keys(n._attributes_)||[]}}]),n}(_wrapNativeSuper(HTMLElement));_InternalHTML._attributes_={},_InternalHTML._attributeToProperty_={};var InternalHTML=_InternalHTML,NOT_VISIBLE_ICON_STRING='\n\n\t\t\n\n',VISIBLE_ICON_STRING='\n\n\t\t\n\n',SVGIconUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"createSVGElement",value:function(e){return(new DOMParser).parseFromString(e,"image/svg+xml").documentElement}}]),e}(),_VisibilityIcon=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"changeVisibility",value:function(t,n,r,i){i.target.id===e.VISIBLE_ICON_ID?(n.style.display="none",r.style.display="block",t.type="password"):(n.style.display="block",r.style.display="none",t.type="text")}},{key:"createIconElement",value:function(e,t){var n=SVGIconUtils.createSVGElement(e);return n.id=t,n.classList.add("visibility-icon"),n}},{key:"create",value:function(t){var n=document.createElement("div");n.id="visibility-icon-container";var r=e.createIconElement(VISIBLE_ICON_STRING,e.VISIBLE_ICON_ID);r.style.display="none",n.appendChild(r);var i=e.createIconElement(NOT_VISIBLE_ICON_STRING,"not-visible-icon");return n.appendChild(i),n.onclick=e.changeVisibility.bind(this,t,r,i),n}}]),e}();_VisibilityIcon.VISIBLE_ICON_ID="visible-icon";var VisibilityIcon=_VisibilityIcon,InsertKeyView=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"createCautionText",value:function(){var e=document.createElement("a");return e.classList.add("insert-key-input-help-text"),e.innerText="Please exercise CAUTION when inserting your API key outside of deepchat.dev or localhost!!",e}},{key:"createHelpLink",value:function(e){var t=document.createElement("a");return t.classList.add("insert-key-input-help-text"),t.href=e,t.innerText="Find more info here",t.target="_blank",t}},{key:"createFailText",value:function(){var e=document.createElement("div");return e.id="insert-key-input-invalid-text",e.style.display="none",e}},{key:"createHelpTextContainer",value:function(t){var n=document.createElement("div");n.id="insert-key-help-text-container";var r=document.createElement("div");r.id="insert-key-help-text-contents";var i=e.createFailText();if(r.appendChild(i),t){var a=e.createHelpLink(t);r.appendChild(a)}var s=e.createCautionText();return r.appendChild(s),n.appendChild(r),{helpTextContainerElement:n,failTextElement:i}}},{key:"onFail",value:function(e,t,n,r){e.classList.replace("insert-key-input-valid","insert-key-input-invalid"),n.innerText=r,n.style.display="block",t.innerText="Start",e.classList.remove("loading")}},{key:"onLoad",value:function(e,t){e.classList.add("loading"),t.innerHTML='
    '}},{key:"verifyKey",value:function(e,t,n){var r=e.value.trim();n.verifyKey(r,t)}},{key:"addVerificationEvents",value:function(t,n,r,i,a){var s={onSuccess:i,onFail:e.onFail.bind(this,t,n,r),onLoad:e.onLoad.bind(this,t,n)},o=e.verifyKey.bind(this,t,s,a);n.onclick=o,t.onkeydown=function(e){!t.classList.contains("loading")&&e.key===KEYBOARD_KEY.ENTER&&o()}}},{key:"createStartButton",value:function(){var e=document.createElement("div");return e.id="start-button",e.innerText="Start",e}},{key:"onInputFocus",value:function(e){e.target.classList.replace("insert-key-input-invalid","insert-key-input-valid")}},{key:"createInput",value:function(t){var n=document.createElement("div");n.id="insert-key-input-container";var r=document.createElement("input");return r.id="insert-key-input",r.placeholder=t||"API Key",r.type="password",r.classList.add("insert-key-input-valid"),r.onfocus=e.onInputFocus,n.appendChild(r),n}},{key:"createContents",value:function(t,n){var r=document.createElement("div");r.id="insert-key-contents";var i=e.createInput(n.insertKeyPlaceholderText),a=i.children[0],s=VisibilityIcon.create(a);i.appendChild(s),r.appendChild(i);var o=e.createStartButton(),l=e.createHelpTextContainer(n.getKeyLink),c=l.helpTextContainerElement,u=l.failTextElement;return r.appendChild(o),r.appendChild(c),e.addVerificationEvents(a,o,u,t,n),r}},{key:"createElements",value:function(t,n){var r=document.createElement("div");r.id="insert-key-view";var i=e.createContents(t,n);return r.appendChild(i),r}},{key:"render",value:function(t,n,r){var i=e.createElements(n,r);t.replaceChildren(i)}}]),e}(),HuggingFaceUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"buildHeaders",value:function(e){return{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}}},{key:"handleVerificationResult",value:function(e,t,n,r){var i=e;Array.isArray(i.error)&&"Error in `parameters`: field required"===i.error[0]?n(t):r(ErrorMessages.INVALID_KEY)}},{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api-inference.huggingface.co/models/gpt2",method:"POST",handleVerificationResult:e.handleVerificationResult}}}]),e}(),_HuggingFaceIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e,t,i,a,s,o){var l;return _classCallCheck(this,r),(l=n.call(this,e,HuggingFaceUtils.buildKeyVerificationDetails(),HuggingFaceUtils.buildHeaders,s,o)).insertKeyPlaceholderText="Hugging Face Token",l.getKeyLink="https://huggingface.co/settings/tokens",l.introPanelMarkUp='\n
    Hugging Face
    \n

    First message may take an extented amount of time to complete as the model needs to be initialized.

    ',l.permittedErrorPrefixes=["Authorization header"],l.url="".concat(r.URL_PREFIX).concat(i),l.textInputPlaceholderText=t,"object"==_typeof(a)&&(a.model&&(l.url="".concat(r.URL_PREFIX).concat(a.model)),a.options&&(l.rawBody.options=a.options),a.parameters&&(l.rawBody.parameters=a.parameters)),l}return _createClass(r,[{key:"preprocessBody",value:function(e,t,n){var r,i=JSON.parse(JSON.stringify(e)),a=t[t.length-1].text;if(a)return null!==(r=i.options)&&void 0!==r||(i.options={}),i.options.wait_for_model=!0,_objectSpread({inputs:a},i)}},{key:"callServiceAPI",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:i=this.preprocessBody(this.rawBody,n,r),HTTPRequest.request(this,i,t);case 4:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})}]),r}(DirectServiceIO);_HuggingFaceIO.URL_PREFIX="https://api-inference.huggingface.co/models/";var HuggingFaceIO=_HuggingFaceIO,HuggingFaceFileIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e,t,i,a,s,o){var l;return _classCallCheck(this,r),(l=n.call(this,e,t,i,a,s,o)).isTextInputDisabled=!0,l.canSendMessage=r.canSendFile,l}return _createClass(r,[{key:"preprocessBody",value:function(e,t,n){return n[0]}},{key:"callServiceAPI",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:if(null!=r&&r[0]){e.next=4;break}throw new Error("No file was added");case 4:HTTPRequest.poll(this,r[0],t,!1);case 5:case"end":return e.stop()}}),e,this)}))),function(e,n,r){return t.apply(this,arguments)})}],[{key:"canSendFile",value:function(e,t){return!(null==t||!t[0])}}]),r}(HuggingFaceIO),HuggingFaceAudioClassificationIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a;_classCallCheck(this,r);var s=null==(i=null==(t=e.directConnection)?void 0:t.huggingFace)?void 0:i.audioClassification,o=null==(a=e.directConnection)?void 0:a.huggingFace;return n.call(this,e,"Attach an audio file","ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition",s,o,{audio:{}})}return _createClass(r,[{key:"extractPollResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.estimated_time){e.next=2;break}return e.abrupt("return",{timeoutMS:1e3*(t.estimated_time+1)});case 2:if(!t.error){e.next=4;break}throw t.error;case 4:return e.abrupt("return",{text:(null==(n=t[0])?void 0:n.label)||""});case 5:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceFileIO),HuggingFaceImageClassificationIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a;_classCallCheck(this,r);var s=null==(i=null==(t=e.directConnection)?void 0:t.huggingFace)?void 0:i.imageClassification,o=null==(a=e.directConnection)?void 0:a.huggingFace;return n.call(this,e,"Attach an image file","google/vit-base-patch16-224",s,o,{images:{}})}return _createClass(r,[{key:"extractPollResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.estimated_time){e.next=2;break}return e.abrupt("return",{timeoutMS:1e3*(t.estimated_time+1)});case 2:if(!t.error){e.next=4;break}throw t.error;case 4:return e.abrupt("return",{text:(null==(n=t[0])?void 0:n.label)||""});case 5:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceFileIO),BASE_64_PREFIX="data:image/png;base64,",StabilityAIUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"buildHeaders",value:function(e){return{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}}},{key:"handleVerificationResult",value:function(e,t,n,r){e.message?r(ErrorMessages.INVALID_KEY):n(t)}},{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api.stability.ai/v1/engines/list",method:"GET",handleVerificationResult:e.handleVerificationResult}}}]),e}(),StabilityAIIO=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r,i,a,s){var o;return _classCallCheck(this,n),(o=t.call(this,e,r,i,a,s)).insertKeyPlaceholderText="Stability AI API Key",o.getKeyLink="https://platform.stability.ai/docs/getting-started/authentication",o.permittedErrorPrefixes=["Incorrect","invalid_"],o}return _createClass(n)}(DirectServiceIO),StabilityAIImageToImageUpscaleIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n;_classCallCheck(this,i);var a=JSON.parse(JSON.stringify(e.directConnection)),s=null==a?void 0:a.stabilityAI;(t=r.call(this,e,StabilityAIUtils.buildKeyVerificationDetails(),StabilityAIUtils.buildHeaders,s,{images:{files:{acceptedFormats:".png",maxNumberOfFiles:1}}})).url="https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale",t.textInputPlaceholderText="Describe image changes",t.introPanelMarkUp='\n
    Stability AI
    \n
    Image to Image Upscale
    \n

    Upload an image to generate a new one with higher resolution.

    \n

    Click here for more info.

    ';var o=null==(n=null==a?void 0:a.stabilityAI)?void 0:n.imageToImageUpscale;return"object"==_typeof(o)&&(o.engine_id&&(t.url="https://api.stability.ai/v1/generation/".concat(o.engine_id,"/image-to-image/upscale")),i.cleanConfig(o),Object.assign(t.rawBody,o)),t.canSendMessage=i.canSendFileMessage,t}return _createClass(i,[{key:"createFormDataBody",value:function(e,t){var n=new FormData;return n.append("image",t),Object.keys(e).forEach((function(t){n.append(t,String(e[t]))})),n}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:if(r){e.next=4;break}throw new Error("Image was not found");case 4:i=this.createFormDataBody(this.rawBody,r[0]),RequestUtils.temporarilyRemoveHeader(this.requestSettings,HTTPRequest.request.bind(this,this,i,t),!1);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.message){e.next=2;break}throw t.message;case 2:return e.abrupt("return",{files:t.artifacts.map((function(e){return{src:"".concat(BASE_64_PREFIX).concat(e.base64),type:"image"}}))});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}],[{key:"cleanConfig",value:function(e){delete e.engine_id}},{key:"canSendFileMessage",value:function(e,t){return!(null==t||!t[0])}}]),i}(StabilityAIIO),StabilityAIImageToImageMaskingIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n;_classCallCheck(this,i);var a=JSON.parse(JSON.stringify(e.directConnection)),s=null==a?void 0:a.stabilityAI;(t=r.call(this,e,StabilityAIUtils.buildKeyVerificationDetails(),StabilityAIUtils.buildHeaders,s,{images:{files:{acceptedFormats:".png",maxNumberOfFiles:2}}})).url="https://api.stability.ai/v1/generation/stable-inpainting-512-v2-0/image-to-image/masking",t._maskSource="MASK_IMAGE_WHITE",t.textInputPlaceholderText="Describe image changes",t.introPanelMarkUp='\n
    Stability AI
    \n
    Image to Image Masking
    \n

    Upload an image, its mask image to create a new one based on the changes you have described for the mask area.

    \n

    Click here for more info.

    ';var o=null==(n=null==a?void 0:a.stabilityAI)?void 0:n.imageToImageMasking;return"object"==_typeof(o)&&(o.engine_id&&(t.url="https://api.stability.ai/v1/generation/".concat(o.engine_id,"/image-to-image/masking")),void 0!==o.weight&&null!==o.weight&&(t._imageWeight=o.weight),void 0!==o.mask_source&&null!==o.mask_source&&(t._maskSource=o.mask_source),i.cleanConfig(o),Object.assign(t.rawBody,o)),t.canSendMessage=i.canSendFileTextMessage,t}return _createClass(i,[{key:"createFormDataBody",value:function(e,t,n,r){var i=new FormData;return i.append("init_image",t),i.append("mask_source",String(this._maskSource)),i.append("mask_image",n),r&&""!==r&&i.append("text_prompts[0][text]",r),void 0!==this._imageWeight&&null!==this._imageWeight&&i.append("text_prompts[0][weight]",String(this._imageWeight)),Object.keys(e).forEach((function(t){i.append(t,String(e[t]))})),void 0===i.get("weight")&&i.append("weight",String(1)),i}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var i,a,s,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:if(r&&r[0]&&r[1]){e.next=4;break}throw new Error("Image was not found");case 4:s=null==(a=null==(i=n[n.length-1])?void 0:i.text)?void 0:a.trim(),o=this.createFormDataBody(this.rawBody,r[0],r[1],s),RequestUtils.temporarilyRemoveHeader(this.requestSettings,HTTPRequest.request.bind(this,this,o,t),!1);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.message){e.next=2;break}throw t.message;case 2:return e.abrupt("return",{files:t.artifacts.map((function(e){return{src:"".concat(BASE_64_PREFIX).concat(e.base64),type:"image"}}))});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}],[{key:"cleanConfig",value:function(e){delete e.engine_id,delete e.weight}},{key:"canSendFileTextMessage",value:function(e,t){return!(null==t||!t[0]||!e||""===e.trim())}}]),i}(StabilityAIIO),HuggingFaceAudioRecognitionIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a;_classCallCheck(this,r);var s=null==(i=null==(t=e.directConnection)?void 0:t.huggingFace)?void 0:i.audioSpeechRecognition,o=null==(a=e.directConnection)?void 0:a.huggingFace;return n.call(this,e,"Attach an audio file","facebook/wav2vec2-large-960h-lv60-self",s,o,{audio:{}})}return _createClass(r,[{key:"extractPollResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.estimated_time){e.next=2;break}return e.abrupt("return",{timeoutMS:1e3*(t.estimated_time+1)});case 2:if(!t.error){e.next=4;break}throw t.error;case 4:return e.abrupt("return",{text:t.text||""});case 5:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceFileIO),HuggingFaceTextGenerationIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a;_classCallCheck(this,r);var s=null==(i=null==(t=e.directConnection)?void 0:t.huggingFace)?void 0:i.textGeneration,o=null==(a=e.directConnection)?void 0:a.huggingFace;return n.call(this,e,"Once upon a time","gpt2",s,o)}return _createClass(r,[{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return e.abrupt("return",{text:t[0].generated_text||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceIO),HuggingFaceQuestionAnswerIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a,s;_classCallCheck(this,r);var o=null==(a=null==(i=e.directConnection)?void 0:i.huggingFace)?void 0:a.questionAnswer,l=null==(s=e.directConnection)?void 0:s.huggingFace;return(t=n.call(this,e,"Ask a question","bert-large-uncased-whole-word-masking-finetuned-squad",o,l)).permittedErrorPrefixes=["Authorization header","Error in"],t.context=o.context,t}return _createClass(r,[{key:"preprocessBody",value:function(e,t){var n=t[t.length-1].text;if(n)return{inputs:{question:n,context:this.context,options:{wait_for_model:!0}}}}},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return e.abrupt("return",{text:t.answer||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceIO),HuggingFaceSummarizationIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a;_classCallCheck(this,r);var s=null==(i=null==(t=e.directConnection)?void 0:t.huggingFace)?void 0:i.summarization,o=null==(a=e.directConnection)?void 0:a.huggingFace;return n.call(this,e,"Insert text to summarize","facebook/bart-large-cnn",s,o)}return _createClass(r,[{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return e.abrupt("return",{text:t[0].summary_text||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceIO),HuggingFaceConversationIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a,s;_classCallCheck(this,r);var o=null==(a=null==(i=e.directConnection)?void 0:i.huggingFace)?void 0:a.conversation,l=null==(s=e.directConnection)?void 0:s.huggingFace;return void 0===(t=n.call(this,e,"Ask me anything!","facebook/blenderbot-400M-distill",o,l)).maxMessages&&(t.maxMessages=-1),t}return _createClass(r,[{key:"processMessages",value:function(e){var t=e[e.length-1].text,n=e.slice(0,e.length-1);if(t)return{past_user_inputs:n.filter((function(e){return"user"===e.role})).map((function(e){return e.text})),generated_responses:n.filter((function(e){return"ai"===e.role})).map((function(e){return e.text})),mostRecentMessageText:t}}},{key:"preprocessBody",value:function(e,t){var n,r=JSON.parse(JSON.stringify(e)),i=this.processMessages(t);if(i)return null!==(n=r.options)&&void 0!==n||(r.options={}),r.options.wait_for_model=!0,_objectSpread({inputs:{past_user_inputs:i.past_user_inputs,generated_responses:i.generated_responses,text:i.mostRecentMessageText}},r)}},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return e.abrupt("return",{text:t.generated_text||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceIO),StabilityAIImageToImageIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n;_classCallCheck(this,i);var a=JSON.parse(JSON.stringify(e.directConnection)),s=a.stabilityAI;(t=r.call(this,e,StabilityAIUtils.buildKeyVerificationDetails(),StabilityAIUtils.buildHeaders,s,{images:{files:{acceptedFormats:".png",maxNumberOfFiles:1}}})).url="https://api.stability.ai/v1/generation/stable-diffusion-v1-5/image-to-image",t.textInputPlaceholderText="Describe image changes",t.introPanelMarkUp='\n
    Stability AI: Image to Image
    \n

    Upload an image to create a new one with the changes you have described.

    \n

    Click here for more info.

    ';var o=null==(n=a.stabilityAI)?void 0:n.imageToImage;return"object"==_typeof(o)&&(o.engine_id&&(t.url="https://api.stability.ai/v1/generation/".concat(o.engine_id,"/text-to-image")),void 0!==o.weight&&null!==o.weight&&(t._imageWeight=o.weight),i.cleanConfig(o),Object.assign(t.rawBody,o)),t.canSendMessage=i.canSendFileTextMessage,t}return _createClass(i,[{key:"createFormDataBody",value:function(e,t,n){var r=new FormData;return r.append("init_image",t),n&&""!==n&&r.append("text_prompts[0][text]",n),void 0!==this._imageWeight&&null!==this._imageWeight&&r.append("text_prompts[0][weight]",String(this._imageWeight)),Object.keys(e).forEach((function(t){r.append(t,String(e[t]))})),void 0===r.get("weight")&&r.append("weight",String(1)),r}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var i,a,s,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:if(r){e.next=4;break}throw new Error("Image was not found");case 4:s=null==(a=null==(i=n[n.length-1])?void 0:i.text)?void 0:a.trim(),o=this.createFormDataBody(this.rawBody,r[0],s),RequestUtils.temporarilyRemoveHeader(this.requestSettings,HTTPRequest.request.bind(this,this,o,t),!1);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.message){e.next=2;break}throw t.message;case 2:return e.abrupt("return",{files:t.artifacts.map((function(e){return{src:"".concat(BASE_64_PREFIX).concat(e.base64),type:"image"}}))});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}],[{key:"cleanConfig",value:function(e){delete e.engine_id,delete e.weight}},{key:"canSendFileTextMessage",value:function(e,t){return!(null==t||!t[0]||!e||""===e.trim())}}]),i}(StabilityAIIO),HuggingFaceTranslationIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a;_classCallCheck(this,r);var s=null==(i=null==(t=e.directConnection)?void 0:t.huggingFace)?void 0:i.translation,o=null==(a=e.directConnection)?void 0:a.huggingFace;return n.call(this,e,"Insert text to translate","Helsinki-NLP/opus-tatoeba-en-ja",s,o)}return _createClass(r,[{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return e.abrupt("return",{text:t[0].translation_text||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceIO),StabilityAITextToImageIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n;_classCallCheck(this,i);var a=JSON.parse(JSON.stringify(e.directConnection)),s=a.stabilityAI;(t=r.call(this,e,StabilityAIUtils.buildKeyVerificationDetails(),StabilityAIUtils.buildHeaders,s)).url="https://api.stability.ai/v1/generation/stable-diffusion-v1-5/text-to-image",t.textInputPlaceholderText="Describe an image",t.introPanelMarkUp='\n
    Stability AI: Text to Image
    \n

    Insert text to generate an image.

    \n

    Click here for more info.

    ';var o=null==(n=a.stabilityAI)?void 0:n.textToImage;return"object"==_typeof(o)&&(o.engine_id&&(t.url="https://api.stability.ai/v1/generation/".concat(o.engine_id,"/text-to-image")),void 0!==o.weight&&null!==o.weight&&(t._imageWeight=o.weight),i.cleanConfig(o),Object.assign(t.rawBody,o)),t.canSendMessage=i.canSendTextMessage,t}return _createClass(i,[{key:"preprocessBody",value:function(e,t){var n=JSON.parse(JSON.stringify(e)),r={text:t};return this._imageWeight&&(r.weight=this._imageWeight),n.text_prompts=[r],n}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(this.rawBody,n[n.length-1].text),HTTPRequest.request(this,r,t);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.message){e.next=2;break}throw t.message;case 2:return e.abrupt("return",{files:t.artifacts.map((function(e){return{src:"".concat(BASE_64_PREFIX).concat(e.base64),type:"image"}}))});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}],[{key:"cleanConfig",value:function(e){delete e.engine_id,delete e.weight}},{key:"canSendTextMessage",value:function(e){return!(!e||""===e.trim())}}]),i}(StabilityAIIO),HuggingFaceFillMaskIO=function(e){_inherits(r,e);var t,n=_createSuper(r);function r(e){var t,i,a,s;_classCallCheck(this,r);var o=null==(a=null==(i=e.directConnection)?void 0:i.huggingFace)?void 0:a.fillMask,l=null==(s=e.directConnection)?void 0:s.huggingFace;return(t=n.call(this,e,"The goal of life is [MASK].","bert-base-uncased",o,l)).introPanelMarkUp='\n
    Hugging Face
    \n

    Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].

    \n

    First message may take an extented amount of time to complete as the model needs to be initialized.

    ',t.permittedErrorPrefixes=["Authorization header","No mask_token"],t}return _createClass(r,[{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return e.abrupt("return",{text:t[0].sequence||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),r}(HuggingFaceIO),CohereUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"buildHeaders",value:function(e){return{Authorization:"Bearer ".concat(e),"Content-Type":"application/json",accept:"application/json"}}},{key:"handleVerificationResult",value:function(e,t,n,r){"invalid request: prompt must be at least 1 token long"===e.message?n(t):r(ErrorMessages.INVALID_KEY)}},{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api.cohere.ai/v1/generate",method:"POST",handleVerificationResult:e.handleVerificationResult,body:JSON.stringify({prompt:""})}}}]),e}(),CohereIO=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r,i,a,s){var o;return _classCallCheck(this,n),(o=t.call(this,e,CohereUtils.buildKeyVerificationDetails(),CohereUtils.buildHeaders,s)).insertKeyPlaceholderText="Cohere API Key",o.getKeyLink="https://dashboard.cohere.ai/api-keys",o.permittedErrorPrefixes=["invalid"],o.url=r,o.textInputPlaceholderText=i,a&&"object"==_typeof(a)&&Object.assign(o.rawBody,a),o}return _createClass(n)}(DirectServiceIO),CohereTextGenerationIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n,a;_classCallCheck(this,i);var s=null==(n=null==(t=e.directConnection)?void 0:t.cohere)?void 0:n.textGeneration,o=null==(a=e.directConnection)?void 0:a.cohere;return r.call(this,e,"https://api.cohere.ai/v1/generate","Once upon a time",s,o)}return _createClass(i,[{key:"preprocessBody",value:function(e,t){var n=JSON.parse(JSON.stringify(e)),r=t[t.length-1].text;if(r)return _objectSpread({prompt:r},n)}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(this.rawBody,n),HTTPRequest.request(this,r,t);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.message){e.next=2;break}throw t.message;case 2:return e.abrupt("return",{text:(null==(n=t.generations)?void 0:n[0].text)||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),i}(CohereIO),CohereSummarizationIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n,a;_classCallCheck(this,i);var s=null==(n=null==(t=e.directConnection)?void 0:t.cohere)?void 0:n.summarization,o=null==(a=e.directConnection)?void 0:a.cohere;return r.call(this,e,"https://api.cohere.ai/v1/summarize","Insert text to summarize",s,o)}return _createClass(i,[{key:"preprocessBody",value:function(e,t){var n=JSON.parse(JSON.stringify(e)),r=t[t.length-1].text;if(r)return _objectSpread({text:r},n)}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(this.rawBody,n),HTTPRequest.request(this,r,t);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.message){e.next=2;break}throw t.message;case 2:return e.abrupt("return",{text:t.summary||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),i}(CohereIO),AzureUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"buildTextToSpeechHeaders",value:function(e,t){return{"Ocp-Apim-Subscription-Key":t,"Content-Type":"application/ssml+xml","X-Microsoft-OutputFormat":e}}},{key:"buildSpeechToTextHeaders",value:function(e){return{"Ocp-Apim-Subscription-Key":e,Accept:"application/json"}}},{key:"handleSpeechVerificationResult",value:function(e,t,n,r){e.error?r(ErrorMessages.INVALID_KEY):n(t)}},{key:"buildSpeechKeyVerificationDetails",value:function(t){return{url:"https://".concat(t,".api.cognitive.microsoft.com/sts/v1.0/issuetoken"),method:"POST",createHeaders:function(e){return{"Ocp-Apim-Subscription-Key":"".concat(e)}},handleVerificationResult:e.handleSpeechVerificationResult}}},{key:"buildSummarizationHeader",value:function(e){return{"Ocp-Apim-Subscription-Key":e,"Content-Type":"application/json"}}},{key:"handleLanguageVerificationResult",value:function(e,t,n,r){var i;"401"===(null==(i=e.error)?void 0:i.code)?r(ErrorMessages.INVALID_KEY):n(t)}},{key:"buildLanguageKeyVerificationDetails",value:function(t){return{url:"".concat(t,"/language/analyze-text/jobs?api-version=2022-10-01-preview"),method:"POST",createHeaders:function(e){return{"Ocp-Apim-Subscription-Key":"".concat(e)}},handleVerificationResult:e.handleLanguageVerificationResult}}},{key:"handleTranslationVerificationResult",value:function(e,t,n,r){e.json().then((function(e){Array.isArray(e)||401e3!==e.error.code?n(t):r(ErrorMessages.INVALID_KEY)}))}},{key:"buildTranslationKeyVerificationDetails",value:function(t){return{url:"https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",method:"POST",createHeaders:function(n){return e.buildTranslationHeaders(t,n)},handleVerificationResult:e.handleTranslationVerificationResult}}},{key:"buildTranslationHeaders",value:function(e,t){var n={"Ocp-Apim-Subscription-Key":t,"Content-Type":"application/json"};return e&&(n["Ocp-Apim-Subscription-Region"]=e),n}}]),e}(),AzureLanguageIO=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r,i,a,s){var o;return _classCallCheck(this,n),(o=t.call(this,e,AzureUtils.buildLanguageKeyVerificationDetails(i),r,a,s)).insertKeyPlaceholderText="Azure Language Subscription Key",o.getKeyLink="https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",o.permittedErrorPrefixes=["Access"],o}return _createClass(n)}(DirectServiceIO),AzureSummarizationIO=function(e){_inherits(a,e);var t,n,r,i=_createSuper(a);function a(e){var t,n,r,s,o,l;_classCallCheck(this,a);var c=null==(s=null==(r=e.directConnection)?void 0:r.azure)?void 0:s.summarization,u=null==(o=e.directConnection)?void 0:o.azure;return(n=i.call(this,e,AzureUtils.buildSummarizationHeader,c.endpoint,u)).url="",n.textInputPlaceholderText="Insert text to summarize",null!==(t=(l=n.rawBody).language)&&void 0!==t||(l.language="en"),Object.assign(n.rawBody,c),n.url="".concat(c.endpoint,"/language/analyze-text/jobs?api-version=2022-10-01-preview"),n}return _createClass(a,[{key:"preprocessBody",value:function(e,t){var n=t[t.length-1].text;if(n)return{analysisInput:{documents:[{id:"1",language:e.language,text:n}]},tasks:[{kind:"ExtractiveSummarization"}]}}},{key:"callServiceAPI",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(this.rawBody,n),HTTPRequest.request(this,r,t),this.messages=t;case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"extractResultData",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error.message;case 2:return this.messages&&this.completionsHandlers&&(r=t.headers.get("operation-location"),i={method:"GET",headers:null==(n=this.requestSettings)?void 0:n.headers},HTTPRequest.executePollRequest(this,r,i,this.messages)),e.abrupt("return",{pollingInAnotherRequest:!0});case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"extractPollResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,i,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:if("running"!==t.status){e.next=4;break}return e.abrupt("return",{timeoutMS:2e3});case 4:if(!(t.errors.length>0)){e.next=6;break}throw t.errors[0];case 6:if(!(t.tasks.items[0].results.errors.length>0)){e.next=8;break}throw t.tasks.items[0].results.errors[0];case 8:n="",r=_createForOfIteratorHelper(t.tasks.items[0].results.documents[0].sentences);try{for(r.s();!(i=r.n()).done;)a=i.value,n+=a.text}catch(s){r.e(s)}finally{r.f()}return e.abrupt("return",{text:n||""});case 12:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),a}(AzureLanguageIO),_OpenAIConverseBaseBody=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"generateDefaultBody",value:function(e){return{model:e}}},{key:"build",value:function(t,n){var r=e.generateDefaultBody(t);return n&&"boolean"!=typeof n?Object.assign(r,n):r}}]),e}();_OpenAIConverseBaseBody.GPT_COMPLETIONS_DAVINCI_MODEL="text-davinci-003",_OpenAIConverseBaseBody.GPT_CHAT_TURBO_MODEL="gpt-3.5-turbo";var OpenAIConverseBaseBody=_OpenAIConverseBaseBody,_OpenAIUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"buildHeaders",value:function(e){return{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}}},{key:"handleVerificationResult",value:function(e,t,n,r){var i=e;i.error?"invalid_api_key"===i.error.code?r(ErrorMessages.INVALID_KEY):r(ErrorMessages.CONNECTION_FAILED):n(t)}},{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api.openai.com/v1/models",method:"GET",handleVerificationResult:e.handleVerificationResult}}}]),e}();_OpenAIUtils.CONVERSE_MAX_CHAR_LENGTH=13352,_OpenAIUtils.FILE_MAX_CHAR_LENGTH=1e3;var OpenAIUtils=_OpenAIUtils,OpenAICompletionsIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n,a,s;_classCallCheck(this,i);var o=e.directConnection,l=e.textInput,c=null==o?void 0:o.openAI;(n=r.call(this,e,OpenAIUtils.buildKeyVerificationDetails(),OpenAIUtils.buildHeaders,c)).insertKeyPlaceholderText="OpenAI API Key",n.getKeyLink="https://platform.openai.com/account/api-keys",n.url="https://api.openai.com/v1/completions",n.permittedErrorPrefixes=["Incorrect"],n._maxCharLength=OpenAIUtils.CONVERSE_MAX_CHAR_LENGTH,n.full_transaction_max_tokens=4e3,n.numberOfCharsPerToken=3.5;var u=null==(a=null==o?void 0:o.openAI)?void 0:a.completions;return null!=l&&l.characterLimit&&(n._maxCharLength=l.characterLimit),"object"==_typeof(u)&&Object.assign(n.rawBody,u),null!==(t=(s=n.rawBody).model)&&void 0!==t||(s.model=OpenAIConverseBaseBody.GPT_COMPLETIONS_DAVINCI_MODEL),n}return _createClass(i,[{key:"preprocessBody",value:function(e,t){var n=JSON.parse(JSON.stringify(e)),r=t[t.length-1].text;if(r){var i=r.substring(0,this._maxCharLength),a=n.max_tokens||this.full_transaction_max_tokens-i.length/this.numberOfCharsPerToken;return _objectSpread({prompt:i,max_tokens:Math.floor(a)},n)}}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(this.rawBody,n),this.deepChat.stream||r.stream?(r.stream=!0,Stream.request(this,r,t)):HTTPRequest.request(this,r,t);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error.message;case 2:return e.abrupt("return",{text:(null==(n=t.choices[0])?void 0:n.text)||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),i}(DirectServiceIO),AssemblyAIUtils=function(){function e(){_classCallCheck(this,e)}var t;return _createClass(e,null,[{key:"poll",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r,i,a,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={authorization:t,"content-type":"application/json"},e.t0="https://api.assemblyai.com/v2/transcript/",e.next=4,fetch("https://api.assemblyai.com/v2/transcript",{method:"POST",body:JSON.stringify({audio_url:n}),headers:r});case 4:return e.next=6,e.sent.json();case 6:e.t1=e.sent.id,i=e.t0.concat.call(e.t0,e.t1);case 8:if(a){e.next=24;break}return e.next=11,fetch(i,{headers:r});case 11:return e.next=13,e.sent.json();case 13:if("completed"!==(s=e.sent).status){e.next=18;break}a=s,e.next=22;break;case 18:if("error"!==s.status){e.next=20;break}throw new Error("Transcription failed: ".concat(s.error));case 20:return e.next=22,new Promise((function(e){return setTimeout(e,3e3)}));case 22:e.next=8;break;case 24:return e.abrupt("return",a);case 25:case"end":return e.stop()}}),e)}))),function(e,n){return t.apply(this,arguments)})},{key:"buildHeaders",value:function(e){return{Authorization:e,"Content-Type":"application/octet-stream"}}},{key:"handleVerificationResult",value:function(e,t,n,r){var i=e;i.error?"invalid_api_key"===i.error.code?r(ErrorMessages.INVALID_KEY):r(ErrorMessages.CONNECTION_FAILED):n(t)}},{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api.assemblyai.com/v2/upload",method:"POST",handleVerificationResult:e.handleVerificationResult}}}]),e}(),AssemblyAIAudioIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n;_classCallCheck(this,i);var a=null==(n=e.directConnection)?void 0:n.assemblyAI;return(t=r.call(this,e,AssemblyAIUtils.buildKeyVerificationDetails(),AssemblyAIUtils.buildHeaders,a,{audio:{}})).insertKeyPlaceholderText="AssemblyAI API Key",t.getKeyLink="https://www.assemblyai.com/app/account",t.introPanelMarkUp='\n
    AssemblyAI Audio
    \n

    Upload an audio file to transcribe it into text.\n

    \n Click here for more info.\n

    ',t.url="https://api.assemblyai.com/v2/upload",t.isTextInputDisabled=!0,t.textInputPlaceholderText="Upload an audio file",t.permittedErrorPrefixes=["Authentication","Invalid"],t.canSendMessage=i.canFileSendMessage,t}return _createClass(i,[{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(i=this.requestSettings)&&i.headers){e.next=2;break}throw new Error("Request settings have not been set up");case 2:if(null!=r&&r[0]){e.next=4;break}throw new Error("No file was added");case 4:HTTPRequest.request(this,r[0],t,!1);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return i=null==(r=null==(n=this.requestSettings)?void 0:n.headers)?void 0:r.Authorization,e.next=5,AssemblyAIUtils.poll(i,t.upload_url);case 5:return e.t0=e.sent.text,e.abrupt("return",{text:e.t0});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}],[{key:"canFileSendMessage",value:function(e,t){return!(null==t||!t[0])}}]),i}(DirectServiceIO),AzureSpeechIO=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r,i,a,s){var o;return _classCallCheck(this,n),(o=t.call(this,e,AzureUtils.buildSpeechKeyVerificationDetails(i),r,a,s)).insertKeyPlaceholderText="Azure Speech Subscription Key",o.getKeyLink="https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",o}return _createClass(n)}(DirectServiceIO),_AzureTextToSpeechIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n,a,s,o,l,c,u,d,p;_classCallCheck(this,i);var h=null==(l=null==(o=e.directConnection)?void 0:o.azure)?void 0:l.textToSpeech,f=null==(c=e.directConnection)?void 0:c.azure;return(s=r.call(this,e,AzureUtils.buildTextToSpeechHeaders.bind({},(null==h?void 0:h.outputFormat)||"audio-16khz-128kbitrate-mono-mp3"),h.region,f)).introPanelMarkUp='\n
    Azure Text To Speech
    \n

    Insert text to synthesize it to audio.\n

    \n Click here for more info.\n

    '),s.url="",Object.assign(s.rawBody,h),null!==(t=(u=s.rawBody).lang)&&void 0!==t||(u.lang="en-US"),null!==(n=(d=s.rawBody).name)&&void 0!==n||(d.name="en-US-JennyNeural"),null!==(a=(p=s.rawBody).gender)&&void 0!==a||(p.gender="Female"),s.url="https://".concat(h.region,".tts.speech.microsoft.com/cognitiveservices/v1"),s}return _createClass(i,[{key:"preprocessBody",value:function(e,t){var n=t[t.length-1].text;if(n)return"\n \n ").concat(n,"\n \n ")}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(this.rawBody,n),HTTPRequest.request(this,r,t,!1);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var n=new FileReader;n.readAsDataURL(t),n.onload=function(t){e({files:[{src:t.target.result,type:"audio"}]})}})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),i}(AzureSpeechIO);_AzureTextToSpeechIO.HELP_LINK="https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";var AzureTextToSpeechIO=_AzureTextToSpeechIO,_AzureSpeechToTextIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n,a,s;_classCallCheck(this,i);var o=null==(a=null==(n=e.directConnection)?void 0:n.azure)?void 0:a.speechToText,l=null==(s=e.directConnection)?void 0:s.azure;(t=r.call(this,e,AzureUtils.buildSpeechToTextHeaders,o.region,l,{audio:{files:{acceptedFormats:".wav,.ogg"}}})).introPanelMarkUp='\n
    Azure Speech To Text
    \n

    Upload a .wav or .ogg audio file to transcribe it into text.\n

    \n Click here for more info.\n

    '),t.url="",t.isTextInputDisabled=!0,t.textInputPlaceholderText="Upload an audio file",t.canSendMessage=i.canFileSendMessage;var c=o.lang||"en-US";return t.url="https://".concat(o.region,".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(c,"&format=detailed"),t.recordAudio=void 0,t}return _createClass(i,[{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var i,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(i=this.requestSettings)&&i.headers){e.next=2;break}throw new Error("Request settings have not been set up");case 2:if(null!=r&&r[0]){e.next=4;break}throw new Error("No file was added");case 4:null!=(a=this.requestSettings)&&a.headers&&(this.requestSettings.headers["Content-Type"]=r[0].name.toLocaleLowerCase().endsWith(".wav")?"audio/wav; codecs=audio/pcm; samplerate=16000":"audio/ogg; codecs=opus"),HTTPRequest.request(this,r[0],t,!1);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error;case 2:return e.abrupt("return",{text:t.DisplayText||""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}],[{key:"canFileSendMessage",value:function(e,t){return!(null==t||!t[0])}}]),i}(AzureSpeechIO);_AzureSpeechToTextIO.HELP_LINK="https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";var AzureSpeechToTextIO=_AzureSpeechToTextIO,AzureTranslationIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n,a,s;_classCallCheck(this,i);var o=null==(a=null==(n=e.directConnection)?void 0:n.azure)?void 0:a.translation,l=null==(s=e.directConnection)?void 0:s.azure;return(t=r.call(this,e,AzureUtils.buildTranslationKeyVerificationDetails(o.region),AzureUtils.buildTranslationHeaders.bind({},null==o?void 0:o.region),l)).insertKeyPlaceholderText="Azure Translate Subscription Key",t.getKeyLink="https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",t.url="",t.url="https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(o.language||"es"),t}return _createClass(i,[{key:"preprocessBody",value:function(e){var t=e[e.length-1].text;if(t)return[{Text:t}]}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(n),HTTPRequest.request(this,r,t);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Array.isArray(t)){e.next=2;break}return e.abrupt("return",{text:(null==(n=t[0].translations)?void 0:n[0].text)||""});case 2:throw t.error;case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),i}(DirectServiceIO),_OpenAIImagesIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n;_classCallCheck(this,i);var a=e.directConnection,s=e.textInput,o=null==a?void 0:a.openAI;(t=r.call(this,e,OpenAIUtils.buildKeyVerificationDetails(),OpenAIUtils.buildHeaders,o,{images:{files:{acceptedFormats:".png",maxNumberOfFiles:2}}})).insertKeyPlaceholderText="OpenAI API Key",t.getKeyLink="https://platform.openai.com/account/api-keys",t.introPanelMarkUp='\n
    OpenAI DALL\xb7E
    \n

    Insert text to generate an image.

    \n

    Upload 1 PNG image to generate its variation and optionally insert text to specify the change.

    \n

    Upload 2 PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.

    \n

    Click here for more info.

    ',t.url="",t.permittedErrorPrefixes=["Incorrect","Invalid input image"],t._maxCharLength=OpenAIUtils.FILE_MAX_CHAR_LENGTH,null!=s&&s.characterLimit&&(t._maxCharLength=s.characterLimit);var l=null==(n=null==a?void 0:a.openAI)?void 0:n.images;if(t.camera){var c="object"==_typeof(l)&&l.size?Number.parseInt(l.size):1024;t.camera.files={dimensions:{width:c,height:c}}}return"object"==_typeof(l)&&Object.assign(t.rawBody,l),t.canSendMessage=i.canFileSendMessage,t}return _createClass(i,[{key:"preprocessBody",value:function(e,t){var n=JSON.parse(JSON.stringify(e));if(t&&""!==t){var r=t.substring(0,this._maxCharLength);n.prompt=r}return n}},{key:"callApiWithImage",value:function(e,t,n){var r,a,s,o=null==(a=null==(r=t[t.length-1])?void 0:r.text)?void 0:a.trim();if(n[1]||o&&""!==o){this.url=i.IMAGE_EDIT_URL;var l=this.preprocessBody(this.rawBody,o);s=i.createFormDataBody(l,n[0],n[1])}else this.url=i.IMAGE_VARIATIONS_URL,s=i.createFormDataBody(this.rawBody,n[0]);RequestUtils.temporarilyRemoveHeader(this.requestSettings,HTTPRequest.request.bind(this,this,s,e),!1)}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var a,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(a=this.requestSettings)&&a.headers){e.next=2;break}throw new Error("Request settings have not been set up");case 2:if(null==r||!r[0]){e.next=6;break}this.callApiWithImage(t,n,r),e.next=11;break;case 6:if(this.requestSettings){e.next=8;break}throw new Error("Request settings have not been set up");case 8:this.url=i.IMAGE_GENERATION_URL,s=this.preprocessBody(this.rawBody,n[n.length-1].text),HTTPRequest.request(this,s,t);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error.message;case 2:return e.abrupt("return",{files:t.data.map((function(e){return e.url?{src:e.url,type:"image"}:{src:"".concat(BASE_64_PREFIX).concat(e.b64_json),type:"image"}}))});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}],[{key:"canFileSendMessage",value:function(e,t){return!(null==t||!t[0])||!(!e||""===e.trim())}},{key:"createFormDataBody",value:function(e,t,n){var r=new FormData;return r.append("image",t),n&&r.append("mask",n),Object.keys(e).forEach((function(t){r.append(t,String(e[t]))})),r}}]),i}(DirectServiceIO);_OpenAIImagesIO.IMAGE_GENERATION_URL="https://api.openai.com/v1/images/generations",_OpenAIImagesIO.IMAGE_VARIATIONS_URL="https://api.openai.com/v1/images/variations",_OpenAIImagesIO.IMAGE_EDIT_URL="https://api.openai.com/v1/images/edits";var OpenAIImagesIO=_OpenAIImagesIO,_OpenAIAudioIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n,a,s;_classCallCheck(this,i);var o=e.textInput,l=JSON.parse(JSON.stringify(e.directConnection)),c=null==l?void 0:l.openAI;(n=r.call(this,e,OpenAIUtils.buildKeyVerificationDetails(),OpenAIUtils.buildHeaders,c,{audio:{}})).insertKeyPlaceholderText="OpenAI API Key",n.getKeyLink="https://platform.openai.com/account/api-keys",n.introPanelMarkUp='\n
    OpenAI Whisper
    \n

    Upload an audio file to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n

    Click here for more info.

    ',n.url="",n.permittedErrorPrefixes=["Invalid"],n._maxCharLength=OpenAIUtils.FILE_MAX_CHAR_LENGTH,n._service_url=i.AUDIO_TRANSCRIPTIONS_URL,null!=o&&o.characterLimit&&(n._maxCharLength=o.characterLimit);var u=null==(a=null==l?void 0:l.openAI)?void 0:a.audio;return"object"==_typeof(u)&&(n.processConfig(u),i.cleanConfig(u),Object.assign(n.rawBody,u)),null!==(t=(s=n.rawBody).model)&&void 0!==t||(s.model=i.DEFAULT_MODEL),n.rawBody.response_format="json",n.canSendMessage=i.canSendFileMessage,n}return _createClass(i,[{key:"processConfig",value:function(e){null!=e&&e.type&&"translation"===e.type&&(this._service_url=i.AUDIO_TRANSLATIONS_URL,delete e.language)}},{key:"preprocessBody",value:function(e,t,n){var r,i,a=JSON.parse(JSON.stringify(e)),s=null==(i=null==(r=t[t.length-n.length+1])?void 0:r.text)?void 0:i.trim();if(s&&""!==s){var o=s.substring(0,this._maxCharLength);a.prompt=o}return a}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n,r){var a,s,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(a=this.requestSettings)&&a.headers){e.next=2;break}throw new Error("Request settings have not been set up");case 2:if(null!=r&&r[0]){e.next=4;break}throw new Error("No file was added");case 4:this.url=this.requestSettings.url||this._service_url,s=this.preprocessBody(this.rawBody,n,r),o=i.createFormDataBody(s,r[0]),RequestUtils.temporarilyRemoveHeader(this.requestSettings,HTTPRequest.request.bind(this,this,o,t),!1);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error.message;case 2:return e.abrupt("return",{text:t.text});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}],[{key:"canSendFileMessage",value:function(e,t){return!(null==t||!t[0])}},{key:"cleanConfig",value:function(e){delete e.type}},{key:"createFormDataBody",value:function(e,t){var n=new FormData;return n.append("file",t),Object.keys(e).forEach((function(t){n.append(t,String(e[t]))})),n}}]),i}(DirectServiceIO);_OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL="https://api.openai.com/v1/audio/transcriptions",_OpenAIAudioIO.AUDIO_TRANSLATIONS_URL="https://api.openai.com/v1/audio/translations",_OpenAIAudioIO.DEFAULT_MODEL="whisper-1";var OpenAIAudioIO=_OpenAIAudioIO,OpenAIChatIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n,a,s;_classCallCheck(this,i);var o=JSON.parse(JSON.stringify(e.directConnection)),l=o.openAI;(n=r.call(this,e,OpenAIUtils.buildKeyVerificationDetails(),OpenAIUtils.buildHeaders,l)).insertKeyPlaceholderText="OpenAI API Key",n.getKeyLink="https://platform.openai.com/account/api-keys",n.url="https://api.openai.com/v1/chat/completions",n.permittedErrorPrefixes=["Incorrect"],n._systemMessage=i.generateSystemMessage("You are a helpful assistant.");var c=null==(a=o.openAI)?void 0:a.chat;return"object"==_typeof(c)&&(c.system_prompt&&(n._systemMessage=i.generateSystemMessage(c.system_prompt)),n.cleanConfig(c),Object.assign(n.rawBody,c)),void 0===n.maxMessages&&(n.maxMessages=-1),null!==(t=(s=n.rawBody).model)&&void 0!==t||(s.model=OpenAIConverseBaseBody.GPT_CHAT_TURBO_MODEL),n}return _createClass(i,[{key:"cleanConfig",value:function(e){delete e.system_prompt}},{key:"preprocessBody",value:function(e,t){var n=JSON.parse(JSON.stringify(e)),r=this.totalMessagesMaxCharLength||OpenAIUtils.CONVERSE_MAX_CHAR_LENGTH,i=MessageLimitUtils.getCharacterLimitMessages(t,r-this._systemMessage.content.length).map((function(e){return{content:e.text,role:"ai"===e.role?"assistant":"user"}}));return n.messages=[this._systemMessage].concat(_toConsumableArray(i)),n}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(this.rawBody,n),this.deepChat.stream||r.stream?(r.stream=!0,Stream.request(this,r,t)):HTTPRequest.request(this,r,t);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.error){e.next=2;break}throw t.error.message;case 2:return e.abrupt("return",t.choices[0].delta?{text:t.choices[0].delta.content||""}:t.choices[0].message?{text:t.choices[0].message.content}:{text:""});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}],[{key:"generateSystemMessage",value:function(e){return{role:"system",content:e}}}]),i}(DirectServiceIO),CohereChatIO=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(e){var t,n;_classCallCheck(this,i);var a=JSON.parse(JSON.stringify(e.directConnection)),s=null==(n=a.cohere)?void 0:n.chat,o=a.cohere;return(t=r.call(this,e,"https://api.cohere.ai/v1/chat","Ask me anything!",s,o)).username="USER","object"==_typeof(s)&&(s.user_name&&(t.username=s.user_name),t.cleanConfig(s),Object.assign(t.rawBody,s)),void 0===t.maxMessages&&(t.maxMessages=-1),t}return _createClass(i,[{key:"cleanConfig",value:function(e){delete e.user_name}},{key:"preprocessBody",value:function(e,t){var n=this,r=JSON.parse(JSON.stringify(e));return r.query=t[t.length-1].text,r.chat_history=t.slice(0,t.length-1).map((function(e){return{text:e.text,user_name:"ai"===e.role?"CHATBOT":n.username}})),r}},{key:"callServiceAPI",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.requestSettings){e.next=2;break}throw new Error("Request settings have not been set up");case 2:r=this.preprocessBody(this.rawBody,n),HTTPRequest.request(this,r,t);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"extractResultData",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.message){e.next=2;break}throw t.message;case 2:return e.abrupt("return",{text:t.text});case 3:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),i}(CohereIO),ServiceIOFactory=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"create",value:function(e){var t=e.directConnection,n=e.request,r=e.demo;if(t){if(t.openAI)return t.openAI.images?new OpenAIImagesIO(e):t.openAI.audio?new OpenAIAudioIO(e):t.openAI.completions?new OpenAICompletionsIO(e):new OpenAIChatIO(e);if(t.assemblyAI)return new AssemblyAIAudioIO(e);if(t.cohere)return t.cohere.chat?new CohereChatIO(e):t.cohere.summarization?new CohereSummarizationIO(e):new CohereTextGenerationIO(e);if(t.huggingFace)return t.huggingFace.textGeneration?new HuggingFaceTextGenerationIO(e):t.huggingFace.summarization?new HuggingFaceSummarizationIO(e):t.huggingFace.translation?new HuggingFaceTranslationIO(e):t.huggingFace.fillMask?new HuggingFaceFillMaskIO(e):t.huggingFace.questionAnswer?new HuggingFaceQuestionAnswerIO(e):t.huggingFace.audioSpeechRecognition?new HuggingFaceAudioRecognitionIO(e):t.huggingFace.audioClassification?new HuggingFaceAudioClassificationIO(e):t.huggingFace.imageClassification?new HuggingFaceImageClassificationIO(e):new HuggingFaceConversationIO(e);if(t.azure){if(t.azure.speechToText)return new AzureSpeechToTextIO(e);if(t.azure.textToSpeech)return new AzureTextToSpeechIO(e);if(t.azure.summarization)return new AzureSummarizationIO(e);if(t.azure.translation)return new AzureTranslationIO(e)}if(t.stabilityAI)return t.stabilityAI.imageToImage?new StabilityAIImageToImageIO(e):t.stabilityAI.imageToImageUpscale?new StabilityAIImageToImageUpscaleIO(e):t.stabilityAI.imageToImageMasking?new StabilityAIImageToImageMaskingIO(e):new StabilityAITextToImageIO(e)}return n?new BaseServiceIO(e):new BaseServiceIO(e,void 0,r||!0)}}]),e}(),_GoogleFont=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"appendStyleSheetToHead",value:function(){var t=document.getElementsByTagName("head")[0];if(!Array.from(t.getElementsByTagName("link")).some((function(t){return t.getAttribute("href")===e.FONT_URL}))){var n=document.createElement("link");n.rel="stylesheet",n.href=e.FONT_URL,t.appendChild(n)}}}]),e}();_GoogleFont.FONT_URL="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap";var GoogleFont=_GoogleFont,TypeConverters=_createClass((function e(){_classCallCheck(this,e)}));function Property(e){return function(t,n){Object.defineProperty(t,n,{});var r=t.constructor,i=n.toLocaleLowerCase();r._attributes_[i]=TypeConverters.attibutes[e],r._attributeToProperty_[i]=n}}TypeConverters.attibutes={string:function(e){return e},number:function(e){return parseFloat(e)},boolean:function(e){return"true"===e},object:function(e){return JSON.parse(e)},array:function(e){return JSON.parse(e)},function:function _function(value){return eval(value)}};var FireEvents=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"onNewMessage",value:function(e,t,n){var r=JSON.parse(JSON.stringify({message:t,isInitial:n}));e.onNewMessage(r),e.dispatchEvent(new CustomEvent("new-message",{detail:r}))}},{key:"onClearMessages",value:function(e){e.onClearMessages(),e.dispatchEvent(new CustomEvent("clear-messages"))}},{key:"onRender",value:function(e){e.onComponentRender(),e.dispatchEvent(new CustomEvent("render"))}}]),e}(),_ElementUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"addElements",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=n-r-e.CODE_SNIPPET_GENERATION_JUMP}},{key:"cloneElement",value:function(e){var t=e.cloneNode(!0);return e.parentNode.replaceChild(t,e),t}}]),e}();_ElementUtils.CODE_SNIPPET_GENERATION_JUMP=.5;var ElementUtils=_ElementUtils,_TextToSpeech=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"speak",value:function(e,t){if(window.SpeechSynthesisUtterance){var n=new SpeechSynthesisUtterance(e);Object.assign(n,t),speechSynthesis.speak(n)}}},{key:"processConfig",value:function(t,n){var r={};setTimeout((function(){if("object"==_typeof(t)&&(t.lang&&(r.lang=t.lang),t.pitch&&(r.pitch=t.pitch),t.rate&&(r.rate=t.rate),t.volume&&(r.volume=t.volume),t.voiceName)){var e=window.speechSynthesis.getVoices().find((function(e){var n;return e.name.toLocaleLowerCase()===(null==(n=t.voiceName)?void 0:n.toLocaleLowerCase())}));e&&(r.voice=e)}n(r)}),e.LOAD_VOICES_MS)}}]),e}();_TextToSpeech.LOAD_VOICES_MS=200;var TextToSpeech=_TextToSpeech,LoadingMessageDotsStyle=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"colorToHex",value:function(e){var t=document.createElement("div");return t.style.color=e,document.body.appendChild(t),"#".concat(window.getComputedStyle(t).color.match(/\d+/g).map((function(e){return parseInt(e).toString(16).padStart(2,"0")})).join(""))}},{key:"set",value:function(t,n){var r,i,a,s;if(null!=(i=null==(r=null==n?void 0:n.loading)?void 0:r.bubble)&&i.color){var o=e.colorToHex(null==(s=null==(a=null==n?void 0:n.loading)?void 0:a.bubble)?void 0:s.color);t.style.setProperty("--message-dots-color",o),t.style.setProperty("--message-dots-color-fade","".concat(o,"33"))}else t.style.setProperty("--message-dots-color","#848484"),t.style.setProperty("--message-dots-color-fade","#55555533")}}]),e}(),StatefulEvents=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"mouseUp",value:function(e,t){StyleUtils.unsetAllCSSMouseStates(e,t),Object.assign(e.style,t.default),Object.assign(e.style,t.hover)}},{key:"mouseDown",value:function(e,t){Object.assign(e.style,t.click)}},{key:"mouseLeave",value:function(e,t){StyleUtils.unsetAllCSSMouseStates(e,t),Object.assign(e.style,t.default)}},{key:"mouseEnter",value:function(e,t){Object.assign(e.style,t.hover)}},{key:"add",value:function(t,n){t.addEventListener("mouseenter",e.mouseEnter.bind(this,t,n)),t.addEventListener("mouseleave",e.mouseLeave.bind(this,t,n)),t.addEventListener("mousedown",e.mouseDown.bind(this,t,n)),t.addEventListener("mouseup",e.mouseUp.bind(this,t,n))}}]),e}(),HTMLUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"applyStylesToElement",value:function(e,t){var n=StyleUtils.processStateful(t,{},{});StatefulEvents.add(e,n),Object.assign(e.style,n.default)}},{key:"applyEventsToElement",value:function(e,t){Object.keys(t).forEach((function(n){var r=t[n];r&&e.addEventListener(n,r)}))}},{key:"applyClassUtilitiesToElement",value:function(t,n){var r=n.events,i=n.styles;r&&e.applyEventsToElement(t,r),i&&!HTMLDeepChatElements.doesElementContainDeepChatClass(t)&&e.applyStylesToElement(t,i)}},{key:"applyCustomClassUtilities",value:function(t,n){Object.keys(t).forEach((function(r){var i=n.getElementsByClassName(r);Array.from(i).forEach((function(n){t[r]&&e.applyClassUtilitiesToElement(n,t[r])}))}))}},{key:"apply",value:function(t,n){HTMLDeepChatElements.applyDeepChatUtilities(t,t._htmlClassUtilities,n),e.applyCustomClassUtilities(t._htmlClassUtilities,n)}}]),e}(),DEEP_CHAT_TEMPORARY_MESSAGE="deep-chat-temporary-message",DEEP_CHAT_SUGGESTION_BUTTON="deep-chat-suggestion-button",DEEP_CHAT_ELEMENTS={"deep-chat-button":{styles:{default:{backgroundColor:"white",padding:"5px",paddingLeft:"7px",paddingRight:"7px",border:"1px solid #c2c2c2",borderRadius:"6px",cursor:"pointer"},hover:{backgroundColor:"#fafafa"},click:{backgroundColor:"#f1f1f1"}}}},DEEP_CHAT_ELEMENT_CLASSES=Object.keys(DEEP_CHAT_ELEMENTS),HTMLDeepChatElements=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"applySuggestionEvent",value:function(e,t){setTimeout((function(){t.addEventListener("click",(function(){var n,r;null==(r=e.submitUserMessage)||r.call(e,(null==(n=t.textContent)?void 0:n.trim())||"")}))}))}},{key:"isElementTemporary",value:function(e){return!!e&&e.bubbleElement.children[0].classList.contains(DEEP_CHAT_TEMPORARY_MESSAGE)}},{key:"doesElementContainDeepChatClass",value:function(e){return DEEP_CHAT_ELEMENT_CLASSES.find((function(t){return e.classList.contains(t)}))}},{key:"applyEvents",value:function(e,t){var n=DEEP_CHAT_ELEMENTS[t].events;Object.keys(n||[]).forEach((function(t){e.addEventListener(t,null==n?void 0:n[t])}))}},{key:"getProcessedStyles",value:function(e,t,n){var r=Array.from(t.classList).reduce((function(t,n){var r,i=null==(r=e[n])?void 0:r.styles;return i&&e[n].styles&&t.push(i),t}),[]),i=DEEP_CHAT_ELEMENTS[n].styles;if(i){var a=JSON.parse(JSON.stringify(i));a.default&&StyleUtils.overwriteDefaultWithAlreadyApplied(a,t),r.unshift(a)}var s=StyleUtils.mergeStatefulStyles(r);return StyleUtils.processStateful(s,{},{})}},{key:"applyDeepChatUtilities",value:function(t,n,r){DEEP_CHAT_ELEMENT_CLASSES.forEach((function(t){var i=r.getElementsByClassName(t);Array.from(i||[]).forEach((function(r){var i=e.getProcessedStyles(n,r,t);HTMLUtils.applyStylesToElement(r,i),e.applyEvents(r,t)}))}));var i=r.getElementsByClassName(DEEP_CHAT_SUGGESTION_BUTTON);Array.from(i).forEach((function(n){return e.applySuggestionEvent(t,n)}))}}]),e}(),MessageStyleUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"applyCustomStylesToElements",value:function(e,t,n){if(n&&(Object.assign(e.outerContainer.style,n.outerContainer),Object.assign(e.innerContainer.style,n.innerContainer),Object.assign(e.bubbleElement.style,n.bubble),t)){var r=e.bubbleElement.children[0],i="a"!==r.tagName.toLocaleLowerCase()?r:r.children[0];Object.assign(i.style,n.media)}}},{key:"applySideStyles",value:function(t,n,r,i){i&&(e.applyCustomStylesToElements(t,r,i.shared),n?e.applyCustomStylesToElements(t,r,i.ai):e.applyCustomStylesToElements(t,r,i.user))}},{key:"isMessageSideStyles",value:function(e){return!!(e.ai||e.shared||e.user)}},{key:"applyCustomStyles",value:function(t,n,r,i,a){var s;a&&t.default!==a?e.isMessageSideStyles(a)?(e.applySideStyles(n,r,i,t.default),e.applySideStyles(n,r,i,a)):(e.applyCustomStylesToElements(n,i,null==(s=t.default)?void 0:s.shared),e.applyCustomStylesToElements(n,i,a)):e.applySideStyles(n,r,i,t.default)}},{key:"extractParticularSharedStyles",value:function(e,t){if(null!=t&&t.shared){var n=t.shared,r={outerContainer:{},innerContainer:{},bubble:{},media:{}};return e.forEach((function(e){var t,i,a,s;r.outerContainer[e]=(null==(t=n.outerContainer)?void 0:t[e])||"",r.innerContainer[e]=(null==(i=n.innerContainer)?void 0:i[e])||"",r.bubble[e]=(null==(a=n.bubble)?void 0:a[e])||"",r.media[e]=(null==(s=n.media)?void 0:s[e])||""})),r}}}]),e}(),IntroPanel=function(){function e(t,n,r){_classCallCheck(this,e),this._isDisplayed=!1,t?(this._elementRef=this.createIntroPanelWithChild(t,r),this._isDisplayed=!0):n&&(this._elementRef=this.createInternalIntroPanel(n,r),this._isDisplayed=!0)}return _createClass(e,[{key:"createIntroPanelWithChild",value:function(t,n){var r=e.createIntroPanel(n);return"none"===t.style.display&&(t.style.display="block"),r.appendChild(t),r}},{key:"createInternalIntroPanel",value:function(t,n){var r=e.createIntroPanel(n);return r.id="internal-intro-panel",r.innerHTML=t,r}},{key:"hide",value:function(){this._isDisplayed&&this._elementRef&&(this._elementRef.style.display="none",this._isDisplayed=!1)}},{key:"display",value:function(){!this._isDisplayed&&this._elementRef&&(this._elementRef.style.display="",this._isDisplayed=!0)}}],[{key:"createIntroPanel",value:function(e){var t=document.createElement("div");return t.classList.add("intro-panel"),Object.assign(t.style,e),t}}]),e}(),_FileMessageUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"updateMessages",value:function(e,t,n,r,i){var a,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];e.applyCustomStyles(t,i,!0,null==(a=e.messageStyles)?void 0:a[r]),e.elementRef.scrollTop=e.elementRef.scrollHeight;var o=Messages.createMessageContent(i,{file:n});e.messages.push(o),e.sendClientUpdate(o,s)}},{key:"wrapInLink",value:function(e,t){var n=document.createElement("a");return n.href=t,n.target="_blank",n.appendChild(e),n}},{key:"processContent",value:function(t,n){return!n||n.startsWith("data")?t:e.wrapInLink(t,n)}},{key:"waitToLoadThenScroll",value:function(e){setTimeout((function(){e.scrollTop=e.scrollHeight}),60)}},{key:"scrollDownOnImageLoad",value:function(t,n){if(t.startsWith("data"))e.waitToLoadThenScroll(n);else try{fetch(t,{mode:"no-cors"}).catch((function(){})).finally((function(){e.waitToLoadThenScroll(n)}))}catch(r){n.scrollTop=n.scrollHeight}}}]),e}();_FileMessageUtils.DEFAULT_FILE_NAME="file";var FileMessageUtils=_FileMessageUtils,HTMLMessages=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"addElement",value:function(e,t){e.elementRef.appendChild(t),e.elementRef.scrollTop=e.elementRef.scrollHeight}},{key:"update",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=Messages.createMessageContent(n,{html:t});i||e.messages.push(a),r&&e.sendClientUpdate(a,i)}},{key:"createElements",value:function(e,t,n){var r=e.createNewMessageElement("",n);return r.bubbleElement.style.maxWidth="unset",r.bubbleElement.innerHTML=t,r}},{key:"addNewHTMLMessage",value:function(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=e.createElements(t,n,r);return 0===n.trim().length&&Messages.editEmptyMessageElement(s.bubbleElement),HTMLUtils.apply(t,s.outerContainer),HTMLDeepChatElements.isElementTemporary(s)||e.update(t,n,r,i,a),e.addElement(t,s.outerContainer),s}}]),e}(),SetupMessages=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"getText",value:function(e,t){if(!e.directConnection&&!e.request&&!e.demo)return"Connect to any API using the [request](https://deepchat.dev/docs/connect#Request)\n property or choose any one of the preconfigured APIs via\n the [directConnection](https://deepchat.dev/docs/directConnection/#directConnection) property.\n \n To get started checkout the [Start](https://deepchat.dev/start) page and\n live code [examples](https://deepchat.dev/examples/frameworks).\n \n To remove this message set the [demo](https://deepchat.dev/docs/demo#demo) property to true.";if(e.directConnection){if(!t.isDirectConnection())return"Please define a valid service inside\n the [directConnection](https://deepchat.dev/docs/directConnection/#directConnection) object."}else if(e.request&&!e.request.url&&!e.request.handler)return"Please define a `url` or a `handler` property inside the [request](https://deepchat.dev/docs/connect#Request) object.";return null}}]),e}(),FILE_ICON_STRING='\n\n\n\t\n\t\t\n\t\n\n\n\t\n\t\t\n\t\n\n\n\t\n\t\t\n\t\n\n\n\t\n\t\t\n\t\n\n\n\t\n\t\t\n\t\n\n',FileMessages=function(){function e(){_classCallCheck(this,e)}var t;return _createClass(e,null,[{key:"createImage",value:function(e,t){var n=new Image;return n.src=e.src,FileMessageUtils.scrollDownOnImageLoad(n.src,t),FileMessageUtils.processContent(n,n.src)}},{key:"addNewImageMessage",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r,i){var a,s,o,l=arguments;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a=l.length>3&&void 0!==l[3]&&l[3],s=e.createImage(r,n.elementRef),(o=n.createNewMessageElement("",i)).bubbleElement.appendChild(s),o.bubbleElement.classList.add("image-message"),n.elementRef.appendChild(o.outerContainer),FileMessageUtils.updateMessages(n,o,r,"image",i,a);case 3:case"end":return t.stop()}}),t)}))),function(e,n,r){return t.apply(this,arguments)})},{key:"createAudioElement",value:function(e,t){var n=document.createElement("audio");return n.src=e.src,n.classList.add("audio-player"),n.controls=!0,Browser$1.IS_SAFARI&&(n.classList.add("audio-player-safari"),n.classList.add(t?"audio-player-safari-left":"audio-player-safari-right")),n}},{key:"addNewAudioMessage",value:function(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=e.createAudioElement(n,r),s=t.createNewMessageElement("",r);s.bubbleElement.appendChild(a),s.bubbleElement.classList.add("audio-message"),t.elementRef.appendChild(s.outerContainer),FileMessageUtils.updateMessages(t,s,n,"audio",r,i)}},{key:"createAnyFile",value:function(e){var t=document.createElement("div");t.classList.add("any-file-message-contents");var n=document.createElement("div");n.classList.add("any-file-message-icon-container");var r=SVGIconUtils.createSVGElement(FILE_ICON_STRING);r.classList.add("any-file-message-icon"),n.appendChild(r);var i=document.createElement("div");return i.classList.add("any-file-message-text"),i.textContent=e.name||FileMessageUtils.DEFAULT_FILE_NAME,t.appendChild(n),t.appendChild(i),FileMessageUtils.processContent(t,e.src)}},{key:"addNewAnyFileMessage",value:function(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=t.createNewMessageElement("",r),s=e.createAnyFile(n);a.bubbleElement.classList.add("any-file-message-bubble"),a.bubbleElement.appendChild(s),t.elementRef.appendChild(a.outerContainer),FileMessageUtils.updateMessages(t,a,n,"file",r,i)}}]),e}(),aiLogoUrl="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8c3ZnIGZpbGw9IiMwMDAwMDAiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIAoJCXZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+Cgk8cGF0aCBkPSJNMjMsMzAuMzZIOWMtMi40MDQsMC00LjM2LTEuOTU2LTQuMzYtNC4zNlYxNWMwLTIuNDA0LDEuOTU2LTQuMzYsNC4zNi00LjM2aDMuNjU5CgkJYzAuMTY3LTEuNTY2LDEuNDE1LTIuODEzLDIuOTgxLTIuOTgxVjUuMzMzYy0xLjEzMS0wLjE3NC0yLTEuMTU0LTItMi4zMzNjMC0xLjMwMSwxLjA1OS0yLjM2LDIuMzYtMi4zNgoJCWMxLjMwMiwwLDIuMzYsMS4wNTksMi4zNiwyLjM2YzAsMS4xNzktMC44NjksMi4xNTktMiwyLjMzM1Y3LjY2YzEuNTY2LDAuMTY3LDIuODE0LDEuNDE1LDIuOTgxLDIuOTgxSDIzCgkJYzIuNDA0LDAsNC4zNiwxLjk1Niw0LjM2LDQuMzZ2MTFDMjcuMzYsMjguNDA0LDI1LjQwNCwzMC4zNiwyMywzMC4zNnogTTksMTEuMzZjLTIuMDA3LDAtMy42NCwxLjYzMy0zLjY0LDMuNjR2MTEKCQljMCwyLjAwNywxLjYzMywzLjY0LDMuNjQsMy42NGgxNGMyLjAwNywwLDMuNjQtMS42MzMsMy42NC0zLjY0VjE1YzAtMi4wMDctMS42MzMtMy42NC0zLjY0LTMuNjRIOXogTTEzLjM4NCwxMC42NGg1LjIzMQoJCUMxOC40MzksOS4zNTQsMTcuMzM0LDguMzYsMTYsOC4zNkMxNC42NjcsOC4zNiwxMy41NjEsOS4zNTQsMTMuMzg0LDEwLjY0eiBNMTYsMS4zNmMtMC45MDQsMC0xLjY0LDAuNzM2LTEuNjQsMS42NAoJCVMxNS4wOTYsNC42NCwxNiw0LjY0YzAuOTA0LDAsMS42NC0wLjczNiwxLjY0LTEuNjRTMTYuOTA0LDEuMzYsMTYsMS4zNnogTTIwLDI3LjM2aC04Yy0xLjMwMSwwLTIuMzYtMS4wNTktMi4zNi0yLjM2CgkJczEuMDU5LTIuMzYsMi4zNi0yLjM2aDhjMS4zMDIsMCwyLjM2LDEuMDU5LDIuMzYsMi4zNlMyMS4zMDIsMjcuMzYsMjAsMjcuMzZ6IE0xMiwyMy4zNmMtMC45MDQsMC0xLjY0LDAuNzM1LTEuNjQsMS42NAoJCXMwLjczNiwxLjY0LDEuNjQsMS42NGg4YzAuOTA0LDAsMS42NC0wLjczNSwxLjY0LTEuNjRzLTAuNzM1LTEuNjQtMS42NC0xLjY0SDEyeiBNMzEsMjMuODZoLTJjLTAuMTk5LDAtMC4zNi0wLjE2MS0wLjM2LTAuMzZWMTUKCQljMC0wLjE5OSwwLjE2MS0wLjM2LDAuMzYtMC4zNmgyYzAuMTk5LDAsMC4zNiwwLjE2MSwwLjM2LDAuMzZ2OC41QzMxLjM2LDIzLjY5OSwzMS4xOTksMjMuODYsMzEsMjMuODZ6IE0yOS4zNiwyMy4xNGgxLjI3OXYtNy43OAoJCUgyOS4zNlYyMy4xNHogTTMsMjMuODZIMWMtMC4xOTksMC0wLjM2LTAuMTYxLTAuMzYtMC4zNlYxNWMwLTAuMTk5LDAuMTYxLTAuMzYsMC4zNi0wLjM2aDJjMC4xOTksMCwwLjM2LDAuMTYxLDAuMzYsMC4zNnY4LjUKCQlDMy4zNiwyMy42OTksMy4xOTksMjMuODYsMywyMy44NnogTTEuMzYsMjMuMTRoMS4yOHYtNy43OEgxLjM2VjIzLjE0eiBNMjAsMjAuMzZjLTEuMzAyLDAtMi4zNi0xLjA1OS0yLjM2LTIuMzYKCQlzMS4wNTktMi4zNiwyLjM2LTIuMzZzMi4zNiwxLjA1OSwyLjM2LDIuMzZDMjIuMzYsMTkuMzAyLDIxLjMwMiwyMC4zNiwyMCwyMC4zNnogTTIwLDE2LjM2Yy0wLjkwNCwwLTEuNjQsMC43MzYtMS42NCwxLjY0CgkJczAuNzM1LDEuNjQsMS42NCwxLjY0czEuNjQtMC43MzUsMS42NC0xLjY0UzIwLjkwNCwxNi4zNiwyMCwxNi4zNnogTTEyLDIwLjM2Yy0xLjMwMSwwLTIuMzYtMS4wNTktMi4zNi0yLjM2czEuMDU5LTIuMzYsMi4zNi0yLjM2CgkJczIuMzYsMS4wNTksMi4zNiwyLjM2QzE0LjM2LDE5LjMwMiwxMy4zMDEsMjAuMzYsMTIsMjAuMzZ6IE0xMiwxNi4zNmMtMC45MDQsMC0xLjY0LDAuNzM2LTEuNjQsMS42NHMwLjczNiwxLjY0LDEuNjQsMS42NAoJCXMxLjY0LTAuNzM1LDEuNjQtMS42NFMxMi45MDQsMTYuMzYsMTIsMTYuMzZ6Ii8+Cgk8cmVjdCBzdHlsZT0iZmlsbDpub25lOyIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIi8+Cjwvc3ZnPg==",avatarUrl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==",AvatarEl=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"applyCustomStylesToElements",value:function(e,t,n){Object.assign(e.style,n.container),Object.assign(t.style,n.avatar)}},{key:"applyCustomStyles",value:function(t,n,r,i){var a,s,o;null!=(a=r.default)&&a.styles&&e.applyCustomStylesToElements(t,n,r.default.styles),i?null!=(s=r.ai)&&s.styles&&e.applyCustomStylesToElements(t,n,r.ai.styles):null!=(o=r.user)&&o.styles&&e.applyCustomStylesToElements(t,n,r.user.styles)}},{key:"createAvatar",value:function(t,n){var r,i,a,s,o=document.createElement("img");o.src=t?(null==(r=null==n?void 0:n.ai)?void 0:r.src)||(null==(i=null==n?void 0:n.default)?void 0:i.src)||aiLogoUrl:(null==(a=null==n?void 0:n.user)?void 0:a.src)||(null==(s=null==n?void 0:n.default)?void 0:s.src)||avatarUrl,o.classList.add("avatar");var l=document.createElement("div");return l.classList.add("avatar-container"),l.appendChild(o),n&&e.applyCustomStyles(l,o,n,t),l}},{key:"getPosition",value:function(e,t){var n,r,i,a,s,o,l,c,u=e?null==(a=null==(i=null==t?void 0:t.ai)?void 0:i.styles)?void 0:a.position:null==(o=null==(s=null==t?void 0:t.user)?void 0:s.styles)?void 0:o.position;return null!==(n=u)&&void 0!==n||(u=null==(c=null==(l=null==t?void 0:t.default)?void 0:l.styles)?void 0:c.position),null!==(r=u)&&void 0!==r||(u=e?"left":"right"),u}},{key:"add",value:function(t,n,r){var i="boolean"==typeof r?void 0:r,a=e.createAvatar(n,i),s=e.getPosition(n,i);a.classList.add("left"===s?"left-item-position":"right-item-position"),t.insertAdjacentElement("left"===s?"beforebegin":"afterend",a)}}]),e}(),Name=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"getPosition",value:function(e,t){var n,r,i,a=e?null==(n=null==t?void 0:t.ai)?void 0:n.position:null==(r=null==t?void 0:t.user)?void 0:r.position;return a||(a=null==(i=null==t?void 0:t.default)?void 0:i.position),a||(a=e?"left":"right"),a}},{key:"applyStyle",value:function(e,t,n){var r,i,a;Object.assign(e.style,null==(r=n.default)?void 0:r.style,t?null==(i=n.ai)?void 0:i.style:null==(a=n.user)?void 0:a.style)}},{key:"getNameText",value:function(e,t){var n,r,i,a;return e?(null==(n=t.ai)?void 0:n.text)||(null==(r=t.default)?void 0:r.text)||"AI":(null==(i=t.user)?void 0:i.text)||(null==(a=t.default)?void 0:a.text)||"User"}},{key:"createName",value:function(t,n){var r=document.createElement("div");return r.classList.add("name"),r.textContent=e.getNameText(t,n),e.applyStyle(r,t,n),r}},{key:"add",value:function(t,n,r){var i="boolean"==typeof r?{}:r,a=e.createName(n,i),s=e.getPosition(n,i);a.classList.add("left"===s?"left-item-position":"right-item-position"),t.insertAdjacentElement("left"===s?"beforebegin":"afterend",a)}}]),e}(),Messages=function(){function e(t,n,r){var i,a,s=this;_classCallCheck(this,e),this._messageElementRefs=[],this._streamedText="",this._htmlClassUtilities={},this.messages=[];var o=n.permittedErrorPrefixes,l=n.introPanelMarkUp,c=n.demo;this._remarkable=RemarkableConfig.createNew(),this.elementRef=e.createContainerElement(),this.messageStyles=t.messageStyles,this._avatars=t.avatars,this._names=t.names,this._errorMessageOverrides=null==(i=t.errorMessages)?void 0:i.overrides,t.htmlClassUtilities&&(this._htmlClassUtilities=t.htmlClassUtilities),this._onNewMessage=FireEvents.onNewMessage.bind(this,t),this._onClearMessages=FireEvents.onClearMessages.bind(this,t),this._displayLoadingMessage=e.getDisplayLoadingMessage(t,n),this._permittedErrorPrefixes=o,this.addSetupMessageIfNeeded(t,n),this.populateIntroPanel(r,l,t.introPanelStyle),t.introMessage&&this.addIntroductoryMessage(t.introMessage),t.initialMessages&&this.populateInitialMessages(t.initialMessages),this.displayServiceErrorMessages=null==(a=t.errorMessages)?void 0:a.displayServiceErrorMessages,t.getMessages=function(){return JSON.parse(JSON.stringify(s.messages))},t.clearMessages=this.clearMessages.bind(this),t.refreshMessages=this.refreshTextMessages.bind(this),t.scrollToBottom=this.scrollToBottom.bind(this),c&&this.prepareDemo(c),t.textToSpeech&&TextToSpeech.processConfig(t.textToSpeech,(function(e){s._textToSpeech=e})),setTimeout((function(){s.submitUserMessage=t.submitUserMessage}))}var t;return _createClass(e,[{key:"prepareDemo",value:function(e){"object"==_typeof(e)&&(e.response&&(this.customDemoResponse=e.response),e.displayErrors&&(e.displayErrors.default&&this.addNewErrorMessage("",""),e.displayErrors.service&&this.addNewErrorMessage("service",""),e.displayErrors.speechToText&&this.addNewErrorMessage("speechToText","")),e.displayLoadingBubble&&this.addLoadingMessage())}},{key:"addSetupMessageIfNeeded",value:function(e,t){var n=SetupMessages.getText(e,t);if(n){var r=this.createAndAppendNewMessageElement(n,!0);this.applyCustomStyles(r,!0,!1)}}},{key:"addIntroductoryMessage",value:function(e){var t,n,r,i,a;if(e&&(this._introMessage=e),null!=(t=this._introMessage)&&t.text){var s=this.createAndAppendNewMessageElement(this._introMessage.text,!0);this.applyCustomStyles(s,!0,!1,null==(n=this.messageStyles)?void 0:n.intro)}else if(null!=(r=this._introMessage)&&r.html){var o=HTMLMessages.addNewHTMLMessage(this,this._introMessage.html,!0,!1,!0);this.applyCustomStyles(o,!0,!1,null==(i=this.messageStyles)?void 0:i.html),this.applyCustomStyles(o,!0,!1,null==(a=this.messageStyles)?void 0:a.intro)}}},{key:"populateInitialMessages",value:function(e){var t=this;e.forEach((function(e){e.file?t.addNewMessage({files:[e.file]},"ai"===e.role,!0,!0):t.addNewMessage(e,"ai"===e.role,!0,!0)})),setTimeout((function(){return t.scrollToBottom()}))}},{key:"applyCustomStyles",value:function(e,t,n,r){this.messageStyles&&MessageStyleUtils.applyCustomStyles(this.messageStyles,e,t,n,r)}},{key:"addInnerContainerElements",value:function(e,t,n){return e.classList.add("message-bubble",n?"ai-message-text":"user-message-text"),e.innerHTML=this._remarkable.render(t),0===e.innerText.trim().length&&(e.innerText=t),this._avatars&&AvatarEl.add(e,n,this._avatars),this._names&&Name.add(e,n,this._names),{bubbleElement:e}}},{key:"createMessageElements",value:function(t,n){var r=e.createBaseElements(),i=r.outerContainer,a=r.innerContainer,s=r.bubbleElement;return i.appendChild(a),this.addInnerContainerElements(s,t,n),this._messageElementRefs.push(r),r}},{key:"createNewMessageElement",value:function(t,n){var r;null==(r=this._introPanel)||r.hide();var i=this._messageElementRefs[this._messageElementRefs.length-1];return e.isTemporaryElement(i)&&(i.outerContainer.remove(),this._messageElementRefs.pop()),this.createMessageElements(t,n)}},{key:"createAndAppendNewMessageElement",value:function(e,t){var n=this.createNewMessageElement(e,t);return this.elementRef.appendChild(n.outerContainer),this.scrollToBottom(),n}},{key:"addNewTextMessage",value:function(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=this.createAndAppendNewMessageElement(t,n);this.applyCustomStyles(a,n,!1);var s=e.createMessageContent(n,{text:t});return 0===t.trim().length&&e.editEmptyMessageElement(a.bubbleElement),this.messages.push(s),r&&this.sendClientUpdate(s,i),a}},{key:"addNewMessage",value:function(e,t,n){var r,i=this,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e.text&&null!==e.text&&(this.addNewTextMessage(e.text,t,n,a),!a&&this._textToSpeech&&t&&TextToSpeech.speak(e.text,this._textToSpeech)),e.files&&e.files.forEach((function(e){var n,r;"audio"===e.type||null!=(n=e.src)&&n.startsWith("data:audio")?FileMessages.addNewAudioMessage(i,e,t,a):"image"===e.type||"gif"===e.type||null!=(r=e.src)&&r.startsWith("data:image")?FileMessages.addNewImageMessage(i,e,t,a):FileMessages.addNewAnyFileMessage(i,e,t,a)})),void 0!==e.html&&null!==e.html){var s=HTMLMessages.addNewHTMLMessage(this,e.html,t,n,a);this.applyCustomStyles(s,t,!1,null==(r=this.messageStyles)?void 0:r.html)}}},{key:"sendClientUpdate",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null==(t=this._onNewMessage)||t.call(this,JSON.parse(JSON.stringify(e)),n)}},{key:"removeMessageOnError",value:function(){var t=this._messageElementRefs[this._messageElementRefs.length-1],n=null==t?void 0:t.bubbleElement;(null!=n&&n.classList.contains("streamed-message")&&""===n.textContent||e.isTemporaryElement(t))&&(t.outerContainer.remove(),this._messageElementRefs.pop())}},{key:"addNewErrorMessage",value:function(t,n){var r,i,a,s;this.removeMessageOnError();var o=e.createBaseElements(),l=o.outerContainer,c=o.bubbleElement;c.classList.add("error-message-text");var u=this.getPermittedMessage(n)||(null==(r=this._errorMessageOverrides)?void 0:r[t])||(null==(i=this._errorMessageOverrides)?void 0:i.default)||"Error, please try again.";c.innerHTML=u;var d=MessageStyleUtils.extractParticularSharedStyles(["fontSize","fontFamily"],null==(a=this.messageStyles)?void 0:a.default);MessageStyleUtils.applyCustomStylesToElements(o,!1,d),MessageStyleUtils.applyCustomStylesToElements(o,!1,null==(s=this.messageStyles)?void 0:s.error),this.elementRef.appendChild(l),this.scrollToBottom(),this._textToSpeech&&TextToSpeech.speak(u,this._textToSpeech),this._streamedText=""}},{key:"getPermittedMessage",value:function(t){if(t){if(this.displayServiceErrorMessages)return t;if("string"==typeof t&&this._permittedErrorPrefixes){var n=e.checkPermittedErrorPrefixes(this._permittedErrorPrefixes,t);if(n)return n}else if(Array.isArray(t)&&this._permittedErrorPrefixes)for(var r=0;r0&&e.classList.add("text-input-inner-left-adjustment"),t["inside-right"].length>0&&e.classList.add("text-input-inner-right-adjustment")}},{key:"adjustForOutsideButton",value:function(t,n,r){0===r["outside-right"].length&&r["outside-left"].length>0?(t[0].classList.add(e.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS),n.classList.add(e.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)):0===r["outside-left"].length&&r["outside-right"].length>0&&(t[3].classList.add(e.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS),n.classList.add(e.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS))}},{key:"adjustOutsideSubmit",value:function(t,n,r){if(!(r["inside-left"].length>0||r["inside-right"].length>0)){if(0===r["outside-right"].length&&r["outside-left"].length>0)return t[0].classList.add(e.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS),n.classList.add(e.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS),r["outside-left"].map((function(e){return e.button.elementRef.classList.add("submit-button-enlarged")}));if(0===r["outside-left"].length&&r["outside-right"].length>0)return t[3].classList.add(e.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS),n.classList.add(e.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS),r["outside-right"].map((function(e){return e.button.elementRef.classList.add("submit-button-enlarged")}))}}},{key:"set",value:function(t,n,r,i){!!e.adjustOutsideSubmit(n,r,i)||e.adjustForOutsideButton(n,r,i),e.adjustInputPadding(t,i)}}]),e}();_InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS="text-input-container-left-adjustment",_InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS="text-input-container-right-adjustment",_InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS="text-input-container-left-small-adjustment",_InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS="text-input-container-right-small-adjustment";var InputButtonStyleAdjustments=_InputButtonStyleAdjustments,ButtonContainers=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"create",value:function(){return Array.from({length:4}).map((function(e,t){var n=document.createElement("div");return n.classList.add("input-button-container"),(0===t||3===t)&&n.classList.add("outer-button-container"),(1===t||2===t)&&n.classList.add("inner-button-container"),n}))}},{key:"add",value:function(e,t){e.insertBefore(t[1],e.firstChild),e.insertBefore(t[0],e.firstChild),e.appendChild(t[2]),e.appendChild(t[3])}},{key:"getContainerIndex",value:function(e){return"outside-left"===e?0:"inside-left"===e?1:"inside-right"===e?2:3}},{key:"addButton",value:function(t,n,r){n.classList.add(r);var i=e.getContainerIndex(r);t[i].appendChild(n),3===i&&n.classList.add("outside-right")}}]),e}(),BUTTON_ORDER=["camera","gifs","images","audio","mixedFiles","submit","microphone"],CustomButtonInnerElements=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"createTextElement",value:function(e){var t=document.createElement("div");return t.classList.add("text-button"),t.innerText=e,t}},{key:"createElement",value:function(t,n){return n?e.createTextElement(t):SVGIconUtils.createSVGElement(t)}},{key:"createCustomElement",value:function(t,n){var r,i,a,s,o=t[n];return null!=(r=null==o?void 0:o.text)&&r.content?e.createElement(null==(i=null==o?void 0:o.text)?void 0:i.content,!0):null!=(a=null==o?void 0:o.svg)&&a.content?e.createElement(null==(s=null==o?void 0:o.svg)?void 0:s.content,!1):void 0}},{key:"processElement",value:function(e,t){null!=t&&t.classList.contains("text-button")||e.classList.add("input-button-svg")}},{key:"createSpecificStateElement",value:function(t,n,r){var i;return r&&(i=e.createCustomElement(r,n)),e.processElement(t,i),i}},{key:"create",value:function(t,n,r){var i={};if(!r)return e.processElement(t),i;var a=e.createSpecificStateElement(t,n[0],r);i[n[0]]=a;var s=a;return n.slice(1).forEach((function(t){s=e.createCustomElement(r,t)||s,i[t]=s})),i}}]),e}(),PLUS_ICON_STRING='\n\n \n',ButtonCSS=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"unsetAllCSS",value:function(e,t){var n,r;t.container&&StyleUtils.unsetAllCSSMouseStates(e,t.container),null!=(n=t.svg)&&n.styles&&StyleUtils.unsetAllCSSMouseStates(e.children[0],t.svg.styles),null!=(r=t.text)&&r.styles&&StyleUtils.unsetAllCSSMouseStates(e.children[0],t.text.styles)}},{key:"unsetActionCSS",value:function(e,t){var n,r;t.container&&StyleUtils.unsetActivityCSSMouseStates(e,t.container),null!=(n=t.svg)&&n.styles&&StyleUtils.unsetActivityCSSMouseStates(e.children[0],t.svg.styles),null!=(r=t.text)&&r.styles&&StyleUtils.unsetActivityCSSMouseStates(e.children[0],t.text.styles)}},{key:"setElementsCSS",value:function(e,t,n){var r,i,a,s,o;Object.assign(e.style,null==(r=t.container)?void 0:r[n]),Object.assign(e.children[0].style,null==(a=null==(i=t.svg)?void 0:i.styles)?void 0:a[n]),Object.assign(e.children[0].style,null==(o=null==(s=t.text)?void 0:s.styles)?void 0:o[n])}},{key:"setElementCssUpToState",value:function(t,n,r){e.setElementsCSS(t,n,"default"),"default"!==r&&(e.setElementsCSS(t,n,"hover"),"hover"!==r&&e.setElementsCSS(t,n,"click"))}}]),e}(),InputButton=function(){function e(t,n,r,i){_classCallCheck(this,e),this._mouseState={state:"default"},this.elementRef=t,this._customStyles=r,this.position=n,this.dropupText=i}return _createClass(e,[{key:"buttonMouseLeave",value:function(e){this._mouseState.state="default",e&&(ButtonCSS.unsetAllCSS(this.elementRef,e),ButtonCSS.setElementsCSS(this.elementRef,e,"default"))}},{key:"buttonMouseEnter",value:function(e){this._mouseState.state="hover",e&&ButtonCSS.setElementsCSS(this.elementRef,e,"hover")}},{key:"buttonMouseUp",value:function(e){e&&ButtonCSS.unsetActionCSS(this.elementRef,e),this.buttonMouseEnter(e)}},{key:"buttonMouseDown",value:function(e){this._mouseState.state="click",e&&ButtonCSS.setElementsCSS(this.elementRef,e,"click")}},{key:"setEvents",value:function(e){this.elementRef.onmousedown=this.buttonMouseDown.bind(this,e),this.elementRef.onmouseup=this.buttonMouseUp.bind(this,e),this.elementRef.onmouseenter=this.buttonMouseEnter.bind(this,e),this.elementRef.onmouseleave=this.buttonMouseLeave.bind(this,e)}},{key:"unsetCustomStateStyles",value:function(e){if(this._customStyles)for(var t=0;t3&&void 0!==arguments[3]&&arguments[3]?t:t[r?"nextSibling":"previousSibling"];i?(t.dispatchEvent(new MouseEvent("mouseleave")),i.dispatchEvent(new MouseEvent("mouseenter"))):(t.dispatchEvent(new MouseEvent("mouseleave")),e.focusItemWhenOnEdge(n,r))}}]),e}(),DropupItem=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"addItemEvents",value:function(e,t,n,r){StatefulEvents.add(t,r),t.addEventListener("click",(function(){n.click()})),t.addEventListener("mouseenter",(function(t){e.highlightedItem=t.target})),t.addEventListener("mouseleave",(function(){e.highlightedItem=void 0}))}},{key:"createItemText",value:function(e,t){var n=document.createElement("div");return Object.assign(n.style,t),n.classList.add("dropup-menu-item-text"),n.textContent=e||"File",n}},{key:"createItemIcon",value:function(e,t){var n=document.createElement("div");return Object.assign(n.style,t),n.classList.add("dropup-menu-item-icon"),n.appendChild(e.children[0]),n}},{key:"populateItem",value:function(t,n,r,i){var a=t.children[0];a.classList.contains("text-button")?n.appendChild(e.createItemText(a.textContent,null==i?void 0:i.text)):(n.appendChild(e.createItemIcon(t,null==i?void 0:i.iconContainer)),n.appendChild(e.createItemText(r,null==i?void 0:i.text)))}},{key:"createItem",value:function(t,n,r){var i,a=n.elementRef,s=n.dropupText,o=document.createElement("div");Object.assign(o.style,null==(i=null==r?void 0:r.item)?void 0:i.default),e.populateItem(a,o,s,r),o.classList.add("dropup-menu-item");var l=StyleUtils.processStateful((null==r?void 0:r.item)||{},{backgroundColor:"#f3f3f3"},{backgroundColor:"#ebebeb"});return e.addItemEvents(t,o,a,l),o}}]),e}(),DropupMenu=function(){function e(t,n){var r,i=this;_classCallCheck(this,e),this._isOpen=!0,this._styles=n,this.elementRef=e.createElement(null==(r=this._styles)?void 0:r.container),this.close(),setTimeout((function(){return i.addWindowEvents(t)}))}return _createClass(e,[{key:"open",value:function(){this.elementRef.style.display="block",this._isOpen=!0}},{key:"close",value:function(){this._isOpen&&(this.elementRef.style.display="none",this._isOpen=!1)}},{key:"toggle",value:function(){this._isOpen?this.close():this.open()}},{key:"addItem",value:function(e){var t=DropupItem.createItem(this,e,this._styles);this.elementRef.appendChild(t)}},{key:"addWindowEvents",value:function(e){var t=this;window.addEventListener("click",(function(n){var r;e.parentElement!==(null==(r=n.target.shadowRoot)?void 0:r.children[0])&&t.close()})),window.addEventListener("keydown",(function(e){var n,r,i;t._isOpen&&(e.key===KEYBOARD_KEY.ESCAPE?(t.close(),null==(n=t.highlightedItem)||n.dispatchEvent(new MouseEvent("mouseleave"))):e.key===KEYBOARD_KEY.ENTER?(null==(r=t.highlightedItem)||r.click(),null==(i=t.highlightedItem)||i.dispatchEvent(new MouseEvent("mouseleave"))):e.key===KEYBOARD_KEY.ARROW_DOWN?DropupItemNavigation.focusSiblingItem(t.highlightedItem||t.elementRef.children[t.elementRef.children.length-1],t.elementRef,!0):e.key===KEYBOARD_KEY.ARROW_UP&&DropupItemNavigation.focusSiblingItem(t.highlightedItem||t.elementRef.children[0],t.elementRef,!1))}))}}],[{key:"createElement",value:function(e){var t=document.createElement("div");return t.id="dropup-menu",Object.assign(t.style,e),t}}]),e}(),Dropup=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r){var i,a;_classCallCheck(this,n);var s=(i=t.call(this,n.createButtonElement(),void 0,{styles:null==(a=null==r?void 0:r.button)?void 0:a.styles})).createInnerElements(i._customStyles);return i._menu=new DropupMenu(e,null==r?void 0:r.menu),i.addClickEvent(),i.buttonContainer=n.createButtonContainer(),i.elementRef.appendChild(s.styles),i.buttonContainer.appendChild(i.elementRef),i.elementRef.classList.add("dropup-icon","upload-file-button"),i.buttonContainer.appendChild(i._menu.elementRef),i.reapplyStateStyle("styles"),i.addContainerEvents(e),i}return _createClass(n,[{key:"createInnerElements",value:function(e){return{styles:this.createInnerElement(n.createSVGIconElement(),"styles",e)}}},{key:"createInnerElement",value:function(e,t,n){return CustomButtonInnerElements.createSpecificStateElement(this.elementRef,t,n)||e}},{key:"addClickEvent",value:function(){this.elementRef.onclick=this._menu.toggle.bind(this._menu)}},{key:"addItem",value:function(e){this._menu.addItem(e)}},{key:"addContainerEvents",value:function(e){var t=this;e.addEventListener("click",(function(e){e.target.classList.contains("dropup-icon")||t._menu.close()}))}}],[{key:"createButtonElement",value:function(){var e=document.createElement("div");return e.classList.add("input-button"),e}},{key:"createSVGIconElement",value:function(){var e=SVGIconUtils.createSVGElement(PLUS_ICON_STRING);return e.id="dropup-icon",e}},{key:"createButtonContainer",value:function(){var e=document.createElement("div");return e.id="dropup-container",e}},{key:"getPosition",value:function(e,t){var n,r;return null!=(n=null==t?void 0:t.button)&&n.position?null==(r=null==t?void 0:t.button)?void 0:r.position:e["outside-left"].length>0&&0===e["outside-right"].length?"outside-right":"outside-left"}}]),n}(InputButton),InputButtonPositions=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"addToDropup",value:function(e,t,n,r){var i=new Dropup(n,r);BUTTON_ORDER.forEach((function(e){var n=t["dropup-menu"].findIndex((function(t){return t.buttonType===e})),r=t["dropup-menu"][n];r&&(i.addItem(r.button),t["dropup-menu"].splice(n,1))}));var a=Dropup.getPosition(t,r);ButtonContainers.addButton(e,i.buttonContainer,a),t[a].push({})}},{key:"addToSideContainer",value:function(e,t){["inside-left","inside-right","outside-left","outside-right"].forEach((function(n){var r=n;t[r].forEach((function(t){ButtonContainers.addButton(e,t.button.elementRef,r)}))}))}},{key:"setPosition",value:function(e,t,n){var r=_objectSpread(_objectSpread({},e[t]),{},{buttonType:t});n.push(r),delete e[t]}},{key:"createPositionsObj",value:function(){return{"dropup-menu":[],"outside-left":[],"inside-left":[],"inside-right":[],"outside-right":[]}}},{key:"generatePositions",value:function(t){var n=e.createPositionsObj();Object.keys(t).forEach((function(r){var i,a=null==(i=t[r])?void 0:i.button.position;a&&e.setPosition(t,r,n[a])})),0===n["inside-right"].length&&t.submit&&e.setPosition(t,"submit",n["inside-right"]),0===n["outside-right"].length&&(t.submit?e.setPosition(t,"submit",n["outside-right"]):t.microphone?e.setPosition(t,"microphone",n["outside-right"]):t.camera&&e.setPosition(t,"camera",n["outside-right"])),t.submit&&e.setPosition(t,"submit",0===n["outside-left"].length?n["outside-left"]:n["inside-right"]),t.microphone&&e.setPosition(t,"microphone",0===n["outside-left"].length?n["outside-left"]:n["inside-right"]);var r=Object.keys(t);return r.length>1||n["dropup-menu"].length>0?BUTTON_ORDER.forEach((function(e){t[e]&&n["dropup-menu"].push(_objectSpread(_objectSpread({},t[e]),{},{buttonType:e}))})):1===r.length&&e.setPosition(t,r[0],0===n["outside-right"].length?n["outside-right"]:n["outside-left"]),n}},{key:"addButtons",value:function(t,n,r,i){var a=e.generatePositions(n);return e.addToSideContainer(t,a),a["dropup-menu"].length>0&&e.addToDropup(t,a,r,i),a}}]),e}(),MIXED_FILES_ICON_STRING='\n\nfile\n\n',IMAGE_ICON_STRING='\n\n \n\n',AUDIO_ICON_STRING='\n \n \n \n \n \n \n \n \n \n \n',GIF_ICON_STRING='\n\n \n \n \n \n\n',FILE_TYPE_BUTTON_ICONS={images:{id:"upload-images-icon",svgString:IMAGE_ICON_STRING,dropupText:"Image"},gifs:{id:"upload-gifs-icon",svgString:GIF_ICON_STRING,dropupText:"GIF"},audio:{id:"upload-audio-icon",svgString:AUDIO_ICON_STRING,dropupText:"Audio"},mixedFiles:{id:"upload-mixed-files-icon",svgString:MIXED_FILES_ICON_STRING,dropupText:"File"}},FileAttachmentsType=function(){function e(t,n,r){_classCallCheck(this,e),this._attachments=[],this._fileCountLimit=99,this._acceptedFormat="",t.maxNumberOfFiles&&(this._fileCountLimit=t.maxNumberOfFiles),this._toggleContainerDisplay=n,this._fileAttachmentsContainerRef=r,t.acceptedFormats&&(this._acceptedFormat=t.acceptedFormats)}return _createClass(e,[{key:"attemptAddFile",value:function(t,n){return!!e.isFileTypeValid(t,this._acceptedFormat)&&(this.addAttachmentBasedOnType(t,n,!0),!0)}},{key:"addAttachmentBasedOnType",value:function(t,n,r){if(t.type.startsWith("image")){var i=e.createImageAttachment(n);this.addFileAttachment(t,"image",i,r)}else if(t.type.startsWith("audio")){var a=AudioFileAttachmentType.createAudioAttachment(n);this.addFileAttachment(t,"audio",a,r)}else{var s=e.createAnyFileAttachment(t.name);this.addFileAttachment(t,"any",s,r)}}},{key:"addFileAttachment",value:function(t,n,r,i){var a=e.createContainer(r);if(this._attachments.length>=this._fileCountLimit){var s=this._attachments[this._attachments.length-1].removeButton;null==s||s.click();var o=this._fileAttachmentsContainerRef.children;this._fileAttachmentsContainerRef.insertBefore(a,o[0])}else this._fileAttachmentsContainerRef.appendChild(a);var l={file:t,attachmentContainerElement:a,fileType:n};return i&&(l.removeButton=this.createRemoveAttachmentButton(l),a.appendChild(l.removeButton)),this._toggleContainerDisplay(!0),this._attachments.push(l),this._fileAttachmentsContainerRef.scrollTop=this._fileAttachmentsContainerRef.scrollHeight,l}},{key:"createRemoveAttachmentButton",value:function(e){var t=document.createElement("div");t.classList.add("remove-file-attachment-button"),t.onclick=this.removeAttachment.bind(this,e);var n=document.createElement("div");return n.classList.add("x-icon"),n.innerText="\xd7",t.appendChild(n),t}},{key:"removeAttachment",value:function(e){var t=this._attachments.findIndex((function(t){return t===e})),n=this._attachments[t].attachmentContainerElement;this._attachments.splice(t,1),AudioFileAttachmentType.stopAttachmentPlayback(n),n.remove(),this._toggleContainerDisplay(!1)}},{key:"getFiles",value:function(){return Array.from(this._attachments).map((function(e){return{file:e.file,type:e.fileType}}))}},{key:"removeAllAttachments",value:function(){this._attachments.forEach((function(e){setTimeout((function(){var t;return null==(t=e.removeButton)?void 0:t.click()}))}))}}],[{key:"isFileTypeValid",value:function(e,t){if(""===t)return!0;for(var n=t.split(","),r=0;r0?e:void 0}},{key:"completePlaceholders",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(this._fileAttachmentsTypes.map(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null==(n=t.stopPlaceholderCallback)?void 0:n.call(t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"addFilesToAnyType",value:function(t){e.addFilesToType(t,this._fileAttachmentsTypes)}},{key:"removeAllFiles",value:function(){this._fileAttachmentsTypes.forEach((function(e){return e.removeAllAttachments()})),this.elementRef.replaceChildren(),this.toggleContainerDisplay(!1)}},{key:"getNumberOfTypes",value:function(){return this._fileAttachmentsTypes.length}}],[{key:"addFilesToType",value:function(e,t){e.forEach((function(e){var n=new FileReader;n.readAsDataURL(e),n.onload=function(n){for(var r=0;r0)}}]),e}(),MICROPHONE_ICON_STRING='\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n',MicrophoneButton=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r;return _classCallCheck(this,n),"dropup-menu"===(null==e?void 0:e.position)&&(e.position="outside-right"),(r=t.call(this,n.createMicrophoneElement(),null==e?void 0:e.position,e)).isActive=!1,r._innerElements=r.createInnerElements(r._customStyles),r.changeToDefault(),r}return _createClass(n,[{key:"createInnerElements",value:function(e){var t=n.createSVGIconElement();return{default:this.createInnerElement(t,"default",e),active:this.createInnerElement(t,"active",e),unsupported:this.createInnerElement(t,"unsupported",e),commandMode:this.createInnerElement(t,"commandMode",e)}}},{key:"createInnerElement",value:function(e,t,n){return CustomButtonInnerElements.createSpecificStateElement(this.elementRef,t,n)||e}},{key:"changeToActive",value:function(){this.elementRef.replaceChildren(this._innerElements.active),this.toggleIconFilter("active"),this.reapplyStateStyle("active",["default","commandMode"]),this.isActive=!0}},{key:"changeToDefault",value:function(){this.elementRef.replaceChildren(this._innerElements.default),this.toggleIconFilter("default"),this.reapplyStateStyle("default",["active","commandMode"]),this.isActive=!1}},{key:"changeToCommandMode",value:function(){this.elementRef.replaceChildren(this._innerElements.unsupported),this.toggleIconFilter("command"),this.reapplyStateStyle("commandMode",["active"])}},{key:"changeToUnsupported",value:function(){this.elementRef.replaceChildren(this._innerElements.unsupported),this.elementRef.classList.add("unsupported-microphone"),this.reapplyStateStyle("unsupported",["active"])}},{key:"toggleIconFilter",value:function(e){var t=this.elementRef.children[0];if("svg"===t.tagName.toLocaleLowerCase())switch(e){case"default":t.classList.remove("active-microphone-icon","command-microphone-icon"),t.classList.add("default-microphone-icon");break;case"active":t.classList.remove("default-microphone-icon","command-microphone-icon"),t.classList.add("active-microphone-icon");break;case"command":t.classList.remove("active-microphone-icon","default-microphone-icon"),t.classList.add("command-microphone-icon")}}}],[{key:"createMicrophoneElement",value:function(){var e=document.createElement("div");return e.id="microphone-button",e.classList.add("input-button"),e}},{key:"createSVGIconElement",value:function(){var e=SVGIconUtils.createSVGElement(MICROPHONE_ICON_STRING);return e.id="microphone-icon",e}}]),n}(InputButton),dist={},webSpeech={},webSpeechTranscript={},translate={},text={};Object.defineProperty(text,"__esModule",{value:!0}),text.Text=void 0;var Text=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"capitalize",value:function(t){return t.replace(e.FIRST_CHAR_REGEX,(function(e){return e.toUpperCase()}))}},{key:"lineBreak",value:function(t){return t.replace(e.DOUBLE_LINE,"

    ").replace(e.ONE_LINE,"
    ")}},{key:"isCharDefined",value:function(e){return void 0!==e&&"\xa0"!==e&&" "!==e&&"\n"!==e&&""!==e}},{key:"breakupIntoWordsArr",value:function(e){return e.split(/(\W+)/)}}]),e}();text.Text=Text,Text.FIRST_CHAR_REGEX=/\S/,Text.DOUBLE_LINE=/\n\n/g,Text.ONE_LINE=/\n/g,Object.defineProperty(translate,"__esModule",{value:!0}),translate.Translate=void 0;var text_1$3=text,Translate=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"translate",value:function(e,t){for(var n=text_1$3.Text.breakupIntoWordsArr(e),r=0;re.clientHeight||e.scrollWidth>e.clientWidth}},{key:"isRequired",value:function(t,n){return t&&e.isElementOverflown(n)}}]),e}();autoScroll.AutoScroll=AutoScroll;var elements={};Object.defineProperty(elements,"__esModule",{value:!0}),elements.Elements=void 0;var Elements=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"isPrimitiveElement",value:function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName}},{key:"createInterimSpan",value:function(){var e=document.createElement("span");return e.style.color="grey",e.style.pointerEvents="none",e}},{key:"createGenericSpan",value:function(){var e=document.createElement("span");return e.style.pointerEvents="none",e}},{key:"appendSpans",value:function(e,t){if(e.spansPopulated=!0,e.insertInCursorLocation&&document.activeElement===t){var n=window.getSelection();if(null!=n&&n.focusNode){var r=n.getRangeAt(0);return r.insertNode(e.scrollingSpan),r.insertNode(e.interimSpan),r.insertNode(e.finalSpan),r.collapse(!1),n.removeAllRanges(),void n.addRange(r)}}t.appendChild(e.finalSpan),t.appendChild(e.interimSpan),t.appendChild(e.scrollingSpan)}},{key:"applyCustomColors",value:function(e,t){t.interim&&(e.interimSpan.style.color=t.interim),t.final&&(e.finalSpan.style.color=t.final)}},{key:"isInsideShadowDOM",value:function(e){return e.getRootNode()instanceof ShadowRoot}}]),e}();elements.Elements=Elements;var cursor={};Object.defineProperty(cursor,"__esModule",{value:!0}),cursor.Cursor=void 0;var Cursor=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"setOffsetForGeneric",value:function(t,n){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=0,a=0;a0){var o=e.setOffsetForGeneric(s,n,r);if(-1===o)return-1;r+=o}else if(null!==s.textContent){if(r+s.textContent.length>n){var l=document.createRange();l.setStart(s,n-r),l.collapse(!0);var c=window.getSelection();return null==c||c.removeAllRanges(),null==c||c.addRange(l),t.focus(),-1}r+=s.textContent.length,i+=s.textContent.length}}return i}},{key:"focusEndOfGeneric",value:function(e){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}},{key:"setOffsetForSafariGeneric",value:function(t,n){var r=window.getSelection();if(r){var i=e.getGenericElementCursorOffset(t,r,!0);console.log(i),setTimeout((function(){}),100),e.setOffsetForGeneric(t,i+n)}}},{key:"setOffsetForPrimitive",value:function(e,t,n){n&&e.blur(),e.setSelectionRange(t,t),e.focus()}},{key:"getGenericElementCursorOffset",value:function(e,t,n){var r=0;if(t.rangeCount>0){var i=t.getRangeAt(0),a=i.cloneRange();a.selectNodeContents(e),n?a.setEnd(i.startContainer,i.startOffset):a.setEnd(i.endContainer,i.endOffset),r=a.toString().length}return r}}]),e}();cursor.Cursor=Cursor,Object.defineProperty(commandUtils,"__esModule",{value:!0}),commandUtils.CommandUtils=void 0;var autoScroll_1$1=autoScroll,elements_1$3=elements,browser_1$2=browser,cursor_1$3=cursor,text_1$2=text,CommandUtils=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"processCommand",value:function(e,t){return(!t||!t.caseSensitive)&&(e=e.toLowerCase()),!1===(null==t?void 0:t.substrings)?text_1$2.Text.breakupIntoWordsArr(e):e}},{key:"process",value:function(t){var n;return!0===(null===(n=t.settings)||void 0===n?void 0:n.caseSensitive)?t:Object.keys(t).reduce((function(n,r){var i=t[r];return n[r]="string"==typeof i?e.processCommand(i,t.settings):i,n}),{})}},{key:"toggleCommandModeOn",value:function(e){var t;e.isWaitingForCommand=!0,null===(t=e.onCommandModeTrigger)||void 0===t||t.call(e,!0)}},{key:"toggleCommandModeOff",value:function(e){var t;e.isWaitingForCommand&&(null===(t=e.onCommandModeTrigger)||void 0===t||t.call(e,!1),e.isWaitingForCommand=!1)}},{key:"setText",value:function(t,n,r,i){e.toggleCommandModeOff(t),elements_1$3.Elements.isPrimitiveElement(i)?(i.value=r,t.isTargetInShadow||cursor_1$3.Cursor.setOffsetForPrimitive(i,r.length,!0),browser_1$2.Browser.IS_SAFARI()&&t.autoScroll&&autoScroll_1$1.AutoScroll.scrollSafariPrimitiveToEnd(i)):(i.textContent=r,t.isTargetInShadow||cursor_1$3.Cursor.focusEndOfGeneric(i),setTimeout((function(){return autoScroll_1$1.AutoScroll.scrollGeneric(t,i)}))),t.resetRecording(n)}},{key:"checkIfMatchesSubstring",value:function(e,t){return t.includes(e)}},{key:"checkIfMatchesWord",value:function(e,t,n){for(var r=e,i=n.length-1;i>=0;i-=1){for(var a=i,s=r.length-1;n[a]===r[s]&&s>=0;)a-=1,s-=1;if(s<0)return!0}return!1}},{key:"execCommand",value:function(t,n,r,i,a){var s,o,l,c=t.commands;if(c&&i&&r){var u=!0===(null===(s=c.settings)||void 0===s?void 0:s.caseSensitive)?n:n.toLowerCase(),d=text_1$2.Text.breakupIntoWordsArr(u),p=!1===(null===(o=c.settings)||void 0===o?void 0:o.substrings)?e.checkIfMatchesWord:e.checkIfMatchesSubstring;if(c.commandMode&&p(c.commandMode,u,d))return t.setInterimColorToFinal(),setTimeout((function(){return e.toggleCommandModeOn(t)})),{doNotProcessTranscription:!1};if(!c.commandMode||t.isWaitingForCommand){if(c.stop&&p(c.stop,u,d))return e.toggleCommandModeOff(t),setTimeout((function(){return t.stop()})),{doNotProcessTranscription:!1};if(c.pause&&p(c.pause,u,d))return e.toggleCommandModeOff(t),t.setInterimColorToFinal(),setTimeout((function(){var e;t.isPaused=!0,null===(e=t.onPauseTrigger)||void 0===e||e.call(t,!0)})),{doNotProcessTranscription:!1};if(c.resume&&p(c.resume,u,d))return t.isPaused=!1,null===(l=t.onPauseTrigger)||void 0===l||l.call(t,!1),e.toggleCommandModeOff(t),t.resetRecording(r),{doNotProcessTranscription:!0};if(c.reset&&p(c.reset,u,d))return void 0!==a&&e.setText(t,r,a,i),{doNotProcessTranscription:!0};if(c.removeAllText&&p(c.removeAllText,u,d))return e.setText(t,r,"",i),{doNotProcessTranscription:!0}}}}}]),e}();commandUtils.CommandUtils=CommandUtils;var highlight={};Object.defineProperty(highlight,"__esModule",{value:!0}),highlight.Highlight=void 0;var elements_1$2=elements,cursor_1$2=cursor,Highlight=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"setStateForPrimitive",value:function(e,t){var n,r;null!==t.selectionStart&&(n=t.selectionStart),null!==t.selectionEnd&&(r=t.selectionEnd),e.isHighlighted=n!==r}},{key:"setStateForGeneric",value:function(e,t){var n=window.getSelection();if(null!=n&&n.focusNode){var r=cursor_1$2.Cursor.getGenericElementCursorOffset(t,n,!0),i=cursor_1$2.Cursor.getGenericElementCursorOffset(t,n,!1);e.isHighlighted=r!==i}}},{key:"setState",value:function(t,n){document.activeElement===n&&(elements_1$2.Elements.isPrimitiveElement(n)?e.setStateForPrimitive(t,n):e.setStateForGeneric(t,n))}},{key:"removeForGeneric",value:function(e,t){var n=window.getSelection();if(n){var r=cursor_1$2.Cursor.getGenericElementCursorOffset(t,n,!0);n.deleteFromDocument(),cursor_1$2.Cursor.setOffsetForGeneric(t,r),e.isHighlighted=!1}}},{key:"removeForPrimitive",value:function(e,t){var n=t.selectionStart,r=t.selectionEnd,i=t.value;if(n&&r){var a=i.substring(0,n)+i.substring(r);t.value=a,cursor_1$2.Cursor.setOffsetForPrimitive(t,n,e.autoScroll)}e.isHighlighted=!1}}]),e}();highlight.Highlight=Highlight;var padding={};Object.defineProperty(padding,"__esModule",{value:!0}),padding.Padding=void 0;var elements_1$1=elements,cursor_1$1=cursor,text_1$1=text,Padding=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"setStateForPrimitiveElement",value:function(e,t){if(document.activeElement===t&&null!==t.selectionStart){var n=t.selectionStart,r=t.value[n-1],i=null===t.selectionEnd?n:t.selectionEnd,a=t.value[i];return text_1$1.Text.isCharDefined(r)&&(e.startPadding=" ",e.numberOfSpacesBeforeNewText=1),text_1$1.Text.isCharDefined(a)&&(e.endPadding=" ",e.numberOfSpacesAfterNewText=1),void(e.isCursorAtEnd=t.value.length===i)}var s=t.value[t.value.length-1];text_1$1.Text.isCharDefined(s)&&(e.startPadding=" ",e.numberOfSpacesBeforeNewText=1),e.isCursorAtEnd=!0}},{key:"setStateForGenericElement",value:function(e,t){var n,r,i;if(document.activeElement===t){var a=window.getSelection();if(null!=a&&a.focusNode){var s=cursor_1$1.Cursor.getGenericElementCursorOffset(t,a,!0),o=null===(n=t.textContent)||void 0===n?void 0:n[s-1],l=cursor_1$1.Cursor.getGenericElementCursorOffset(t,a,!1),c=null===(r=t.textContent)||void 0===r?void 0:r[l];return text_1$1.Text.isCharDefined(o)&&(e.startPadding=" "),text_1$1.Text.isCharDefined(c)&&(e.endPadding=" "),void(e.isCursorAtEnd=(null===(i=t.textContent)||void 0===i?void 0:i.length)===l)}}var u=t.innerText.charAt(t.innerText.length-1);text_1$1.Text.isCharDefined(u)&&(e.startPadding=" "),e.isCursorAtEnd=!0}},{key:"setState",value:function(t,n){elements_1$1.Elements.isPrimitiveElement(n)?e.setStateForPrimitiveElement(t,n):e.setStateForGenericElement(t,n)}},{key:"adjustStateAfterRecodingPrimitiveElement",value:function(e,t){e.primitiveTextRecorded=!0,e.insertInCursorLocation&&document.activeElement===t&&(null!==t.selectionEnd&&(e.endPadding=e.endPadding+t.value.slice(t.selectionEnd)),null!==t.selectionStart)?e.startPadding=t.value.slice(0,t.selectionStart)+e.startPadding:e.startPadding=t.value+e.startPadding}},{key:"adjustSateForNoTextPrimitiveElement",value:function(e){1===e.numberOfSpacesBeforeNewText&&(e.startPadding=e.startPadding.substring(0,e.startPadding.length-1),e.numberOfSpacesBeforeNewText=0),1===e.numberOfSpacesAfterNewText&&(e.endPadding=e.endPadding.substring(1),e.numberOfSpacesAfterNewText=0)}}]),e}();padding.Padding=Padding,Object.defineProperty(speech,"__esModule",{value:!0}),speech.Speech=void 0;var eventListeners_1=eventListeners,preResultUtils_1=preResultUtils,commandUtils_1$1=commandUtils,autoScroll_1=autoScroll,highlight_1=highlight,elements_1=elements,padding_1=padding,browser_1$1=browser,cursor_1=cursor,text_1=text,Speech=function(){function e(){_classCallCheck(this,e),this.finalTranscript="",this.interimSpan=elements_1.Elements.createInterimSpan(),this.finalSpan=elements_1.Elements.createGenericSpan(),this.scrollingSpan=elements_1.Elements.createGenericSpan(),this.isCursorAtEnd=!1,this.spansPopulated=!1,this.startPadding="",this.endPadding="",this.numberOfSpacesBeforeNewText=0,this.numberOfSpacesAfterNewText=0,this.isHighlighted=!1,this.primitiveTextRecorded=!1,this.recognizing=!1,this._displayInterimResults=!0,this.insertInCursorLocation=!0,this.autoScroll=!0,this.isRestarting=!1,this.isPaused=!1,this.isWaitingForCommand=!1,this.isTargetInShadow=!1,this.cannotBeStopped=!1,this.resetState()}return _createClass(e,[{key:"prepareBeforeStart",value:function(e){var t,n;if(null!=e&&e.element)if(eventListeners_1.EventListeners.add(this,e),Array.isArray(e.element)){var r=e.element.find((function(e){return e===document.activeElement}))||e.element[0];if(!r)return;this.prepare(r)}else this.prepare(e.element);void 0!==(null==e?void 0:e.displayInterimResults)&&(this._displayInterimResults=e.displayInterimResults),null!=e&&e.textColor&&(this._finalTextColor=null===(t=null==e?void 0:e.textColor)||void 0===t?void 0:t.final,elements_1.Elements.applyCustomColors(this,e.textColor)),void 0!==(null==e?void 0:e.insertInCursorLocation)&&(this.insertInCursorLocation=e.insertInCursorLocation),void 0!==(null==e?void 0:e.autoScroll)&&(this.autoScroll=e.autoScroll),this._onResult=null==e?void 0:e.onResult,this._onPreResult=null==e?void 0:e.onPreResult,this._onStart=null==e?void 0:e.onStart,this._onStop=null==e?void 0:e.onStop,this._onError=null==e?void 0:e.onError,this.onCommandModeTrigger=null==e?void 0:e.onCommandModeTrigger,this.onPauseTrigger=null==e?void 0:e.onPauseTrigger,this._options=e,null!==(n=this._options)&&void 0!==n&&n.commands&&(this.commands=commandUtils_1$1.CommandUtils.process(this._options.commands))}},{key:"prepare",value:function(e){padding_1.Padding.setState(this,e),highlight_1.Highlight.setState(this,e),this.isTargetInShadow=elements_1.Elements.isInsideShadowDOM(e),elements_1.Elements.isPrimitiveElement(e)?(this._primitiveElement=e,this._originalText=this._primitiveElement.value):(this._genericElement=e,this._originalText=this._genericElement.textContent)}},{key:"resetRecording",value:function(e){this.isRestarting=!0,this.stop(!0),this.resetState(!0),this.start(e,!0)}},{key:"updateElements",value:function(e,t,n){var r,i=text_1.Text.capitalize(t);if(this.finalTranscript!==i||""!==e){preResultUtils_1.PreResultUtils.process(this,n,""===e,this._onPreResult,this._options)&&(e="",n="");var a=this.commands&&commandUtils_1$1.CommandUtils.execCommand(this,n,this._options,this._primitiveElement||this._genericElement,this._originalText);if(a){if(a.doNotProcessTranscription)return;e="",n=""}if(!this.isPaused&&!this.isWaitingForCommand){null===(r=this._onResult)||void 0===r||r.call(this,n,""===e),this.finalTranscript=i,this._displayInterimResults||(e="");var s=""===this.finalTranscript&&""===e;this._primitiveElement?this.updatePrimitiveElement(this._primitiveElement,e,s):this._genericElement&&this.updateGenericElement(this._genericElement,e,s)}}}},{key:"updatePrimitiveElement",value:function(e,t,n){this.isHighlighted&&highlight_1.Highlight.removeForPrimitive(this,e),this.primitiveTextRecorded||padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this,e),n&&padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);var r=this.startPadding+this.finalTranscript+t;if(e.value=r+this.endPadding,!this.isTargetInShadow){var i=r.length+this.numberOfSpacesAfterNewText;cursor_1.Cursor.setOffsetForPrimitive(e,i,this.autoScroll)}this.autoScroll&&browser_1$1.Browser.IS_SAFARI()&&this.isCursorAtEnd&&autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e)}},{key:"updateGenericElement",value:function(e,t,n){this.isHighlighted&&highlight_1.Highlight.removeForGeneric(this,e),this.spansPopulated||elements_1.Elements.appendSpans(this,e);var r=(n?"":this.startPadding)+text_1.Text.lineBreak(this.finalTranscript);this.finalSpan.innerHTML=r;var i=autoScroll_1.AutoScroll.isRequired(this.autoScroll,e);autoScroll_1.AutoScroll.changeStateIfNeeded(this,i);var a=text_1.Text.lineBreak(t)+(n?"":this.endPadding);this.interimSpan.innerHTML=a,browser_1$1.Browser.IS_SAFARI()&&this.insertInCursorLocation&&cursor_1.Cursor.setOffsetForSafariGeneric(e,r.length+a.length),i&&autoScroll_1.AutoScroll.scrollGeneric(this,e),n&&(this.scrollingSpan.innerHTML="")}},{key:"finalise",value:function(e){this._genericElement&&(e?(this.finalSpan=elements_1.Elements.createGenericSpan(),this.setInterimColorToFinal(),this.interimSpan=elements_1.Elements.createInterimSpan(),this.scrollingSpan=elements_1.Elements.createGenericSpan()):this._genericElement.textContent=this._genericElement.textContent,this.spansPopulated=!1),eventListeners_1.EventListeners.remove(this)}},{key:"setInterimColorToFinal",value:function(){this.interimSpan.style.color=this._finalTextColor||"black"}},{key:"resetState",value:function(e){this._primitiveElement=void 0,this._genericElement=void 0,this.finalTranscript="",this.finalSpan.innerHTML="",this.interimSpan.innerHTML="",this.scrollingSpan.innerHTML="",this.startPadding="",this.endPadding="",this.isHighlighted=!1,this.primitiveTextRecorded=!1,this.numberOfSpacesBeforeNewText=0,this.numberOfSpacesAfterNewText=0,e||(this.stopTimeout=void 0)}},{key:"setStateOnStart",value:function(){var e;this.recognizing=!0,this.isRestarting?this.isRestarting=!1:null===(e=this._onStart)||void 0===e||e.call(this)}},{key:"setStateOnStop",value:function(){var e;this.recognizing=!1,this.isRestarting||null===(e=this._onStop)||void 0===e||e.call(this)}},{key:"setStateOnError",value:function(e){var t;null===(t=this._onError)||void 0===t||t.call(this,e),this.recognizing=!1}}]),e}();speech.Speech=Speech,Object.defineProperty(webSpeech,"__esModule",{value:!0}),webSpeech.WebSpeech=void 0;var webSpeechTranscript_1=webSpeechTranscript,browser_1=browser,speech_1$1=speech,WebSpeech=function(e){_inherits(n,e);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.call(this)}return _createClass(n,[{key:"start",value:function(e){var t;void 0===this._extractText&&(this._extractText=browser_1.Browser.IS_SAFARI()?webSpeechTranscript_1.WebSpeechTranscript.extractSafari:webSpeechTranscript_1.WebSpeechTranscript.extract),this.validate()&&(this.prepareBeforeStart(e),this.instantiateService(e),null===(t=this._service)||void 0===t||t.start(),this._translations=null==e?void 0:e.translations)}},{key:"validate",value:function(){return!!n.getAPI()||(this.error("Speech Recognition is unsupported"),!1)}},{key:"instantiateService",value:function(e){var t,r,i=n.getAPI();this._service=new i,this._service.continuous=!0,this._service.interimResults=null===(t=null==e?void 0:e.displayInterimResults)||void 0===t||t,this._service.lang=(null===(r=null==e?void 0:e.language)||void 0===r?void 0:r.trim())||"en-US",this.setEvents()}},{key:"setEvents",value:function(){var e=this;this._service&&(this._service.onstart=function(){e.setStateOnStart()},this._service.onerror=function(t){browser_1.Browser.IS_SAFARI()&&"Another request is started"===t.message||"aborted"===t.error&&e.isRestarting||"no-speech"!==t.error&&e.error(t.message||t.error)},this._service.onaudioend=function(){e.setStateOnStop()},this._service.onend=function(){e._stopping=!1},this._service.onresult=function(t){if(_typeof(t.results)>"u"&&e._service)e._service.onend=null,e._service.stop();else if(e._extractText&&!e._stopping){var n=e._extractText(t,e.finalTranscript,e._translations),r=n.interimTranscript,i=n.finalTranscript,a=n.newText;e.updateElements(r,i,a)}})}},{key:"stop",value:function(e){var t;this._stopping=!0,null===(t=this._service)||void 0===t||t.stop(),this.finalise(e)}},{key:"error",value:function(e){console.error(e),this.setStateOnError(e),this.stop()}}],[{key:"getAPI",value:function(){return window.webkitSpeechRecognition||window.SpeechRecognition}}]),n}(speech_1$1.Speech);webSpeech.WebSpeech=WebSpeech;var globalState={};Object.defineProperty(globalState,"__esModule",{value:!0}),globalState.GlobalState=void 0;var GlobalState=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"doubleClickDetector",value:function(){return!!e.doubleClickPending||(e.doubleClickPending=!0,setTimeout((function(){e.doubleClickPending=!1}),300),!1)}}]),e}();globalState.GlobalState=GlobalState,GlobalState.doubleClickPending=!1;var azure={},preventConnectionStop={};Object.defineProperty(preventConnectionStop,"__esModule",{value:!0}),preventConnectionStop.PreventConnectionStop=void 0;var PreventConnectionStop=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"applyPrevention",value:function(e){clearTimeout(e._manualConnectionStopPrevention),e.cannotBeStopped=!0,e._manualConnectionStopPrevention=setTimeout((function(){e.cannotBeStopped=!1}),800)}},{key:"clearPrevention",value:function(e){clearTimeout(e._manualConnectionStopPrevention),e.cannotBeStopped=!1}}]),e}();preventConnectionStop.PreventConnectionStop=PreventConnectionStop;var azureSpeechConfig={},readme={};Object.defineProperty(readme,"__esModule",{value:!0}),readme.README_URL=void 0,readme.README_URL="https://github.com/OvidijusParsiunas/speech-to-element",Object.defineProperty(azureSpeechConfig,"__esModule",{value:!0}),azureSpeechConfig.AzureSpeechConfig=void 0;var readme_1=readme,AzureSpeechConfig=function(){function e(){_classCallCheck(this,e)}var t,n;return _createClass(e,null,[{key:"validateOptions",value:function(e,t){return t?t.subscriptionKey||t.token||t.retrieveToken?!!t.region||(e("Please define a 'region' property - more info: ".concat(readme_1.README_URL)),!1):(e("Please define a 'subscriptionKey', 'token' or 'retrieveToken' property - more info: ".concat(readme_1.README_URL)),!1):(e("Please provide subscription details - more info: ".concat(readme_1.README_URL)),!1)}},{key:"getNewSpeechConfig",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.region){e.next=2;break}return e.abrupt("return",n.subscriptionKey?t.fromSubscription(n.subscriptionKey.trim(),n.region.trim()):n.token?t.fromAuthorizationToken(n.token.trim(),n.region.trim()):n.retrieveToken?n.retrieveToken().then((function(e){return n.region?t.fromAuthorizationToken((null==e?void 0:e.trim())||"",n.region.trim()):null})).catch((function(e){return console.error(e),null})):null);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"process",value:function(e,t){t.language&&(e.speechRecognitionLanguage=t.language.trim())}},{key:"get",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function t(n,r){var i;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getNewSpeechConfig(n,r);case 2:return i=t.sent,t.abrupt("return",(i&&e.process(i,r),i));case 4:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})}]),e}();azureSpeechConfig.AzureSpeechConfig=AzureSpeechConfig;var stopTimeout={};Object.defineProperty(stopTimeout,"__esModule",{value:!0}),stopTimeout.StopTimeout=void 0;var StopTimeout=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"set",value:function(e){e.stopTimeout=setTimeout((function(){return e.stop()}),e.stopTimeoutMS)}},{key:"reset",value:function(t,n){t.stopTimeoutMS=n||e.DEFAULT_MS,t.stopTimeout&&clearTimeout(t.stopTimeout),e.set(t)}}]),e}();stopTimeout.StopTimeout=StopTimeout,StopTimeout.DEFAULT_MS=2e4;var azureTranscript={};Object.defineProperty(azureTranscript,"__esModule",{value:!0}),azureTranscript.AzureTranscript=void 0;var translate_1=translate,AzureTranscript=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"extract",value:function(e,t,n,r){return r&&(e=translate_1.Translate.translate(e,r)),n?{interimTranscript:"",finalTranscript:t+e,newText:e}:{interimTranscript:e,finalTranscript:t,newText:e}}}]),e}();azureTranscript.AzureTranscript=AzureTranscript,Object.defineProperty(azure,"__esModule",{value:!0}),azure.Azure=void 0;var preventConnectionStop_1=preventConnectionStop,azureSpeechConfig_1=azureSpeechConfig,stopTimeout_1=stopTimeout,azureTranscript_1=azureTranscript,speech_1=speech,Azure=function(e){_inherits(i,e);var t,n,r=_createSuper(i);function i(){var e;return _classCallCheck(this,i),(e=r.apply(this,arguments))._newTextPadding="",e}return _createClass(i,[{key:"start",value:function(e,t){this._newTextPadding="",void 0===this.stopTimeout&&stopTimeout_1.StopTimeout.reset(this,null==e?void 0:e.stopAfterSilenceMs),this.prepareBeforeStart(e),this.startAsync(e),t||preventConnectionStop_1.PreventConnectionStop.applyPrevention(this)}},{key:"startAsync",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.validate(t),!e.t0){e.next=6;break}return e.next=4,this.instantiateService(t);case 4:this._translations=null==t?void 0:t.translations,null===(n=this._service)||void 0===n||n.startContinuousRecognitionAsync((function(){}),this.error);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"validate",value:function(e){return i.getAPI()?azureSpeechConfig_1.AzureSpeechConfig.validateOptions(this.error.bind(this),e):(this.moduleNotFound(),!1)}},{key:"instantiateService",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,a,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.getAPI(),r=n.AudioConfig.fromDefaultMicrophoneInput(),e.next=4,azureSpeechConfig_1.AzureSpeechConfig.get(n.SpeechConfig,t);case 4:(a=e.sent)?(s=new n.SpeechRecognizer(a,r),this.setEvents(s),this._service=s,t.retrieveToken&&this.retrieveTokenInterval(t.retrieveToken)):this.error("Unable to contact Azure server");case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setEvents",value:function(e){e.recognizing=this.onRecognizing.bind(this),e.recognized=this.onRecognized.bind(this),e.sessionStarted=this.onSessionStarted.bind(this),e.canceled=this.onCanceled.bind(this),e.sessionStopped=this.onSessionStopped.bind(this)}},{key:"onRecognizing",value:function(e,t){if(!this._stopping){var n=azureTranscript_1.AzureTranscript.extract(this._newTextPadding+t.result.text,this.finalTranscript,!1,this._translations),r=n.interimTranscript,i=n.finalTranscript,a=n.newText;stopTimeout_1.StopTimeout.reset(this,this.stopTimeoutMS),this.updateElements(r,i,a)}}},{key:"onRecognized",value:function(e,t){var n=t.result;switch(n.reason){case window.SpeechSDK.ResultReason.Canceled:break;case window.SpeechSDK.ResultReason.RecognizedSpeech:if(n.text&&!this._stopping){var r=azureTranscript_1.AzureTranscript.extract(this._newTextPadding+n.text,this.finalTranscript,!0,this._translations),i=r.interimTranscript,a=r.finalTranscript,s=r.newText;stopTimeout_1.StopTimeout.reset(this,this.stopTimeoutMS),this.updateElements(i,a,s),""!==a&&(this._newTextPadding=" ")}}}},{key:"onCanceled",value:function(e,t){t.reason===window.SpeechSDK.CancellationReason.Error&&this.error(t.errorDetails)}},{key:"onSessionStarted",value:function(){preventConnectionStop_1.PreventConnectionStop.clearPrevention(this),this.setStateOnStart()}},{key:"onSessionStopped",value:function(){this._retrieveTokenInterval||clearInterval(this._retrieveTokenInterval),this._stopping=!1,this.setStateOnStop()}},{key:"retrieveTokenInterval",value:function(e){var t=this;this._retrieveTokenInterval=setInterval((function(){null==e||e().then((function(e){t._service&&(t._service.authorizationToken=(null==e?void 0:e.trim())||"")})).catch((function(e){t.error(e)}))}),1e4)}},{key:"stop",value:function(e){var t;!e&&this._retrieveTokenInterval&&clearInterval(this._retrieveTokenInterval),this._stopping=!0,null===(t=this._service)||void 0===t||t.stopContinuousRecognitionAsync(),this.finalise(e)}},{key:"moduleNotFound",value:function(){console.error("speech recognition module not found:"),console.error("please install the 'microsoft-cognitiveservices-speech-sdk' npm package or add a script tag: + \ No newline at end of file diff --git a/docs/demo/index.html b/docs/demo/index.html index d05f003e1..e4247347f 100644 --- a/docs/demo/index.html +++ b/docs/demo/index.html @@ -13,7 +13,7 @@ - + @@ -27,7 +27,7 @@ displayFileAttachmentContainer is used to display the element that encapsulates all of the files to be sent on the next message.
    displayErrors is used to display error messages; for the component via default, an API error via service and a speech to text issue via speechToText. This is mainly used to showcase the override capabilities in errorMessages.

    Base Example

    <deep-chat demo="true"></deep-chat>

    Custom Response Example

    chatElementRef.demo = {
    response: (message) => {
    const options = ['rock', 'paper', 'scissors'];
    const userOption = message.text?.toLocaleLowerCase();
    const aiOption = options[Math.floor(Math.random() * 3)];
    let response = `I guessed ${aiOption}. `;
    if (userOption === aiOption) response += 'Draw';
    else if (userOption === 'rock') response += aiOption === 'paper' ? 'I win!' : 'You win!';
    else if (userOption === 'paper') response += aiOption === 'scissors' ? 'I win!' : 'You win!';
    else if (userOption === 'scissors') response += aiOption === 'rock' ? 'I win!' : 'You win!';
    else response = 'Guess either Rock, Paper or Scissors';
    return {text: response};
    },
    };

    Elements Example

    <deep-chat
    demo='{
    "displayLoadingBubble": true,
    "displayFileAttachmentContainer": true,
    "displayErrors": {"service": true}
    }'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/directConnection/AssemblyAI/index.html b/docs/directConnection/AssemblyAI/index.html index 62fa7e91f..9a3a1f614 100644 --- a/docs/directConnection/AssemblyAI/index.html +++ b/docs/directConnection/AssemblyAI/index.html @@ -13,13 +13,13 @@ - +

    AssemblyAI

    AssemblyAI

    Properties used to connect to AssemblyAI.

    assemblyAI

    • Type: true | {audio?: true}
    • Default: {audio: true}

    Connect to Assembly AI's speech recognition API to transcribe your audio.

    Example

    <deep-chat
    directConnection='{
    "assemblyAI": {
    "key": "placeholder key",
    "audio": true
    }
    }'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/directConnection/Azure/index.html b/docs/directConnection/Azure/index.html index e5730f252..b54ab6632 100644 --- a/docs/directConnection/Azure/index.html +++ b/docs/directConnection/Azure/index.html @@ -13,7 +13,7 @@ - + @@ -37,7 +37,7 @@ language is a BCP 47 language tag for the language of your text.

    Example

    caution

    Cannot input a test key as user's language service endpoint is required.

    <deep-chat
    directConnection='{
    "azure": {
    "key": "placeholder key",
    "summarization": {"endpoint": "https://placeholderresource.cognitiveservices.azure.com"}
    }
    }'
    ></deep-chat>

    Translation

    • Type: {region?: string, language?: string}
    • Default: {language: "es"}

    Connect to Azure's translation API.
    region is the region of your translator resource. This is optional if your resource is global.
    language is the BCP 47 language tag for the language you are translating to from English.

    Example

    <deep-chat
    directConnection='{
    "azure": {
    "key": "placeholder key",
    "translation": {"region": "eastus", "language": "ja"}
    }
    }'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/directConnection/Cohere/index.html b/docs/directConnection/Cohere/index.html index 8265911f7..e1c63cdf4 100644 --- a/docs/directConnection/Cohere/index.html +++ b/docs/directConnection/Cohere/index.html @@ -13,7 +13,7 @@ - + @@ -60,7 +60,7 @@ extractiveness controls how close to the original text the summary is. "high" extractiveness summaries will lean towards reusing sentences verbatim, while "low" extractiveness summaries will tend to paraphrase more.
    temperature (from 0 to 5) controls the randomness of the output. Lower values tend to generate more predictable outputs, while higher values tend to generate more creative outputs. The sweet spot is typically between 0 and 1.
    additional_command is a free-form instruction for modifying how the summaries get generated. Should start with "Generate a summary _". and end with Eg. "focusing on the next steps" or "written by Yoda".

    Example

    <deep-chat
    directConnection='{
    "cohere": {
    "key": "placeholder key",
    "summarization": {"model": "summarize-xlarge"}
    }
    }'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/directConnection/HuggingFace/index.html b/docs/directConnection/HuggingFace/index.html index dda8a841f..c545ad32f 100644 --- a/docs/directConnection/HuggingFace/index.html +++ b/docs/directConnection/HuggingFace/index.html @@ -13,7 +13,7 @@ - + @@ -98,7 +98,7 @@ model is the name of the model used for the task.

    Example

    <deep-chat
    directConnection='{
    "huggingFace": {
    "key": "placeholder key",
    "huggingFace": {"model": "facebook/wav2vec2-large-960h-lv60-self"}
    }
    }'
    ></deep-chat>

    AudioClassification

    • Type: true | {model?: string}
    • Default: {model: "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"}

    Connect to Hugging Face Audio Classification API.
    model is the name of the model used for the task.

    Example

    <deep-chat
    directConnection='{
    "huggingFace": {
    "key": "placeholder key",
    "audioSpeechRecognition": {"model": "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"}
    }
    }'
    ></deep-chat>

    ImageClassification

    • Type: true | {model?: string}
    • Default: {model: "google/vit-base-patch16-224"}

    Connect to Hugging Face Image Classification API.
    model is the name of the model used for the task.

    Example

    <deep-chat
    directConnection='{
    "huggingFace": {
    "key": "placeholder key",
    "imageClassification": {"model": "google/vit-base-patch16-224"}
    }
    }'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/directConnection/OpenAI/index.html b/docs/directConnection/OpenAI/index.html index 76d588506..088d5276a 100644 --- a/docs/directConnection/OpenAI/index.html +++ b/docs/directConnection/OpenAI/index.html @@ -13,7 +13,7 @@ - + @@ -40,7 +40,7 @@ max_tokens the maximum number of tokens to generate in the chat. See here for more info.
    temperature is used for sampling; between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused.
    top_p is an alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

    Example

    <deep-chat
    directConnection='{
    "openAI": {
    "key": "placeholder key",
    "chat": {
    "model": "gpt-4",
    "max_tokens": 2000,
    "temperature": 1,
    "top_p": 1
    }
    }
    }'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/directConnection/StabilityAI/index.html b/docs/directConnection/StabilityAI/index.html index fc324123b..7823f87a2 100644 --- a/docs/directConnection/StabilityAI/index.html +++ b/docs/directConnection/StabilityAI/index.html @@ -13,7 +13,7 @@ - + @@ -78,7 +78,7 @@ steps is the number of diffusion steps to run (10 to 150).
    style_preset guides the image model towards a particular style.
    clip_guidance_preset is the clip guidance preset.

    Example

    <deep-chat
    directConnection='{
    "stabilityAI": {
    "key": "placeholder key",
    "textToImage": {
    "engine_id": "stable-diffusion-v1-5",
    "weight": 1,
    "style_preset": "fantasy-art",
    "samples": 2
    }}}'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/directConnection/index.html b/docs/directConnection/index.html index 2dabe459e..435798d6b 100644 --- a/docs/directConnection/index.html +++ b/docs/directConnection/index.html @@ -13,7 +13,7 @@ - + @@ -28,7 +28,7 @@ is loaded up during the validation period.

    caution

    This object is intended to be used for prototyping purposes ONLY and should not be deployed to an environment as it can be accessed in the browser. Before going live, use the request property in combination with your own service to safely use your key there. Read more about this in Connect and check examples.

    Key Example

    <deep-chat
    directConnection='{
    "openAI": {
    "key": "placeholder key",
    "chat": {"system_prompt": "Assist me with anything you can"}
    }
    }'
    ></deep-chat>

    Validation Example

    <deep-chat
    directConnection='{
    "openAI": {
    "key": "placeholder key",
    "validateKeyProperty": true,
    "chat": {"system_prompt": "Assist me with anything you can"}
    }
    }'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/events/index.html b/docs/events/index.html index 1419b461f..b5a4c68de 100644 --- a/docs/events/index.html +++ b/docs/events/index.html @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@

    Events

    Events can be observed in two ways, either by assigning a function to a property or by listening to custom events fired from the component element.

    onNewMessage

    Triggered when a message is sent from the user and recieved from the target service.
    message encompasses all of the message contents.
    isInitial is used to determine whether if the message is from the prepopulated initialMessages property.

    Example

    Latest events:
    >
    chatElementRef.onNewMessage = (message) => { console.log(message); };

    onClearMessages

    • Function: () => void
    • Event: clear-messages

    Triggered when the clearMessages method has been executed. The core purpose of this is to help track messages state.

    Example

    Latest events:
    >
    chatElementRef.onClearMessages = () => { console.log("Messages cleared"); };

    onComponentRender

    • Function: () => void
    • Event: render

    Triggered when the component has finished rendering on the browser's window.

    Example

    Latest events:
    > "Finished rendering"
    chatElementRef.onComponentRender = () => { console.log("Finished rendering"); };
    - + \ No newline at end of file diff --git a/docs/files/index.html b/docs/files/index.html index 681cf651a..8ded6ed4c 100644 --- a/docs/files/index.html +++ b/docs/files/index.html @@ -13,7 +13,7 @@ - + @@ -82,7 +82,7 @@ It uses the same syntax as the accept attributes in input elements. If the configuration in audio also uses the acceptedFormats property, it will override this one.

    <deep-chat
    microphone='{
    "files": {
    "format": "mp3",
    "maxDurationSeconds": 10,
    "maxNumberOfFiles": 2,
    "acceptedFormats": ".mp3,.wav"
    }
    }'
    ></deep-chat>
    info

    The use of this object will automatically disable the speechToText functionality.

    AudioFormat

    • Type: "mp3" | "4a" | "webm" | "mp4" | "mpga" | "wav" | "mpeg" | "m4a"

    Allowed audio file formats.

    - + \ No newline at end of file diff --git a/docs/installation/index.html b/docs/installation/index.html index 1c3c25932..5e6e003b3 100644 --- a/docs/installation/index.html +++ b/docs/installation/index.html @@ -13,13 +13,13 @@ - +
    -

    Installation

    Install the component via npm:

    npm install deep-chat

    For React, install the following instead:

    npm install deep-chat-react

    Access the component via CDN:

    https://unpkg.com/deep-chat@1.3.14/dist/deepChat.bundle.js
    - +

    Installation

    Install the component via npm:

    npm install deep-chat

    For React, install the following instead:

    npm install deep-chat-react

    Access the component via CDN:

    https://unpkg.com/deep-chat@1.3.15/dist/deepChat.bundle.js
    + \ No newline at end of file diff --git a/docs/interceptors/index.html b/docs/interceptors/index.html index 3b5be2336..6c363b1cb 100644 --- a/docs/interceptors/index.html +++ b/docs/interceptors/index.html @@ -13,7 +13,7 @@ - + @@ -24,7 +24,7 @@ The types for the return argument is determined by the connection variety used:

    • If you are connecting to a server via the request property - the type will be Response.
    • If you are connecting via the directConnection property - the type will be defined by the chosen service API.

    This property is not enabled for server-sent stream responses.

    Example

    Console:
    >
    chatElementRef.responseInterceptor = (response) => {
    console.log(response); // printed above
    return response;
    };

    validateMessageBeforeSending

    • Type: (text?: string, files?: File[]) => boolean

    Triggered before a message is sent out in order to validate if it should be sent out to the target service.
    text argument is the text content of the message and files is an array that contains any files that are to be sent out along with the message.
    The method must return a boolean value with either true or false for whether the message should be sent.

    Example

    chatElementRef.validateMessageBeforeSending = (text, files) => {
    return text ? true : false;
    };
    - + \ No newline at end of file diff --git a/docs/introPanel/index.html b/docs/introPanel/index.html index d8b16c28c..80f67b4c3 100644 --- a/docs/introPanel/index.html +++ b/docs/introPanel/index.html @@ -13,7 +13,7 @@ - + @@ -24,7 +24,7 @@ to the CSS classes and JavaScript in your app. To get around this, we recommend using the htmlClassUtilities property which will allow you to define reusable styling and bind functions to your app's state.

    Example

    // Markup

    <deep-chat id="chat-element">
    <div style="display: none">
    <div class="custom-button">
    <div class="custom-button-text">"Explain quantum computing"</div>
    </div>
    <div class="custom-button" style="margin-top: 15px">
    <div class="custom-button-text">"Creative ideas for a birthday"</div>
    </div>
    <div class="custom-button" style="margin-top: 15px">
    <div class="custom-button-text">"Hello World in JavaScript"</div>
    </div>
    </div>
    </deep-chat>

    // using JavaScript for a simplified example

    const chatElementRef = document.getElementById('chat-element');

    chatElementRef.htmlClassUtilities = {
    ['custom-button']: {
    events: {
    click: (event) => {
    const text = event.target.children[0].innerText;
    chatElementRef.submitUserMessage(text.substring(1, text.length - 1));
    },
    },
    styles: {
    default: {backgroundColor: '#f2f2f2', borderRadius: '10px', padding: '10px', cursor: 'pointer', textAlign: 'center'},
    hover: {backgroundColor: '#ebebeb'},
    click: {backgroundColor: '#e4e4e4'},
    },
    },
    ['custom-button-text']: {styles: {default: {pointerEvents: 'none'}}},
    };

    introPanelStyle

    Controls the intro panel's parent-most element's style. This is most useful for changing the base styling of the automatically generated intro panels when using services in the directConnection property.

    Example

    <deep-chat
    introPanelStyle='{"backgroundColor": "#fffeec"}'
    directConnection='{"openAI": {"audio": true, "key": "placeholder-key"}}'
    ></deep-chat>
    tip

    To remove an automatically generated panel - add empty div tags: <deep-chat><div></div></deep-chat> .

    - + \ No newline at end of file diff --git a/docs/introduction/index.html b/docs/introduction/index.html index ead78bc08..64ec2c566 100644 --- a/docs/introduction/index.html +++ b/docs/introduction/index.html @@ -13,7 +13,7 @@ - + @@ -24,7 +24,7 @@ the component you need.

    Developer experience is paramount to this component's success! This is why Deep Chat is shipped in a cross-framework plug-and-play package to allow you to get started in just a few seconds no matter what platform you use! Additionally, we carefully monitor all of your feedback to help us optimise your and your users' chat experience as well as use it as a base point for helping us decide what future improvements the component will need.

    Open source

    Open source is at the heart of what we do. Deep Chat is built by the community - for the community. All contributions to this project are welcome!

    If you have any suggestions for enhancements, ideas on how to take the project further or have discovered a bug, do not hesitate to create a new issue ticket and we will look into it as soon as possible!

    - + \ No newline at end of file diff --git a/docs/messages/HTML/index.html b/docs/messages/HTML/index.html index 17e8ab12d..94d88bf6e 100644 --- a/docs/messages/HTML/index.html +++ b/docs/messages/HTML/index.html @@ -13,7 +13,7 @@ - + @@ -37,7 +37,7 @@ deep-chat. To note, this approach may require you to first import or use them in your app's code in order for your bundler to register them.

    Example

    // This is a simple way to create web components via JavaScript, refer to all possibilities above

    // JavaScript
    class CustomElement extends HTMLElement {
    constructor() {
    super();
    this.textContent = 'This is a Custom Element';
    }
    }

    customElements.define('custom-element', CustomElement);

    // HTML
    <deep-chat initialMessages='[{"html": "<custom-element/>", "role": "user"}]'></deep-chat>
    info

    When passing values into your custom element, you need to pass them as attributes (they must be stringified). E.g. {"html": "<custom-element count="0" name="jeff"></custom-element>"}

    info

    If you are experiencing problems with embedding your custom elements inside the chat, you can always raise an issue on GitHub. When you do please provide us with either a sandbox example or sufficient information to enable us to replicate the problem.

    Examples

    Suggestion buttons

    Basic suggestion buttons using Deep Chat Classes.

    // using JavaScript for a simplified example

    chatElementRef.initialMessages = [
    {
    html: `
    <div class="deep-chat-temporary-message">
    <button class="deep-chat-button deep-chat-suggestion-button" style="margin-top: 5px">What do shrimps eat?</button>
    <button class="deep-chat-button deep-chat-suggestion-button" style="margin-top: 6px">Can a shrimp fry rice?</button>
    <button class="deep-chat-button deep-chat-suggestion-button" style="margin-top: 6px">What is a pistol shrimp?</button>
    </div>`,
    role: 'ai',
    },
    ];

    chatElementRef.messageStyles = {html: {shared: {bubble: {backgroundColor: 'unset', padding: '0px'}}}};

    Controlled responses

    Preset user responses which can be used to give feedback, follow a conversation path or control a service.

    // using JavaScript for a simplified example

    chatElementRef.initialMessages = [
    {
    html: `
    <div class="deep-chat-temporary-message">
    <button class="deep-chat-button deep-chat-suggestion-button" style="border: 1px solid green">Yes</button>
    <button class="deep-chat-button deep-chat-suggestion-button" style="border: 1px solid #d80000">No</button>
    </div>`,
    role: 'user',
    },
    ];

    chatElementRef.messageStyles = {
    html: {shared: {bubble: {backgroundColor: 'unset', padding: '0px', width: '100%', textAlign: 'right'}}},
    };

    Feedback

    Add feedback buttons to response messages.

    // using JavaScript for a simplified example

    chatElementRef.initialMessages = [
    {
    html: `<div class="feedback">
    <div class="feedback-text">The powerhouse of a cell.</div>
    <img class="feedback-icon feedback-icon-positive" src="path-to-svg.svg">
    <img class="feedback-icon feedback-icon-negative" src="path-to-svg.svg">
    </div>`,
    role: 'ai',
    },
    {
    html: `<div class="feedback">
    <div class="feedback-text">A labrador.</div>
    <img class="feedback-icon feedback-icon-positive" src="path-to-svg.svg">
    <img class="feedback-icon feedback-icon-negative" src="path-to-svg.svg">
    </div>`,
    role: 'ai',
    },
    ];

    chatElementRef.messageStyles = {
    default: {shared: {bubble: {maxWidth: '95%', width: '100%', marginTop: '10px'}}},
    };

    chatElementRef.htmlClassUtilities = {
    feedback: {styles: {default: {display: 'flex'}}},
    'feedback-text': {styles: {default: {width: 'calc(100% - 42px)', paddingTop: '2px'}}},
    'feedback-icon': {
    styles: {
    default: {width: '20px', height: '20px', cursor: 'pointer', borderRadius: '5px'},
    hover: {backgroundColor: '#d1d1d1'},
    },
    },
    'feedback-icon-positive': {events: {click: () => console.log('positive response')}},
    'feedback-icon-negative': {
    events: {click: () => console.log('negative response')},
    styles: {default: {transform: 'rotate(180deg)', marginLeft: '3px'}},
    },
    };

    Custom Element - Chart

    Add a chart component (e.g. using Google Chart).

    // using JavaScript for a simplified example

    chatElementRef.initialMessages = [
    {
    html: `
    <div>
    <div style="margin-bottom: 10px">Here is an example chart:</div>
    <google-chart
    style="width: 220px; height: 200px"
    data='[["Planet", "Score"], ["Earth", 50], ["Moon", 100], ["Saturn", 80]]'
    options='{"legend": "none"}'>
    </google-chart>
    </div>
    `,
    role: 'ai',
    },
    ];

    Custom Element - Table

    Add an interactive table component (e.g. using Active Table).

    // using JavaScript for a simplified example

    chatElementRef.initialMessages = [
    {
    html: `
    <div>
    <div style="margin-bottom: 10px">Here is a simple example:</div>
    <active-table
    content='[["Planet", "Mass"], ["Earth", 5.97], ["Mars", 0.642], ["Jupiter", 1898]]'
    cellStyle='{"width": "80px"}'
    displayAddNewRow="false"
    displayAddNewColumn="false">
    </active-table>
    </div>`,
    role: 'ai',
    },
    ];
    - + \ No newline at end of file diff --git a/docs/messages/index.html b/docs/messages/index.html index ca0efac33..cc806b3d3 100644 --- a/docs/messages/index.html +++ b/docs/messages/index.html @@ -13,7 +13,7 @@ - + @@ -51,7 +51,7 @@ however you can help it by setting the type.

    Example

    <deep-chat
    initialMessages='[
    {"file": {"src": "path-to-file.jpeg", "type": "image"}, "role": "user"},
    {"file": {"src": "data:image/gif;base64,R0lGODlh4A...", "type": "image"}, "role": "user"},
    {"file": {"src": "path-to-file.wav", "type": "audio"}, "role": "user"},
    {"file": {"name": "placeholder.exe"}, "role": "user"},
    {"file": {"src": "path-to-file", "name": "hello-world.txt", "type": "file"}, "role": "user"}
    ]'
    ></deep-chat>
    info

    Files with "image" or "any" types that contain a src property as a url will have their bubble set as a hyperlink.

    MessageFileType

    • Type: "image" | "audio" | "any"

    Type of a file stored inside a message. "any" is the default type.

    Code messages

    By default, messages containing code will be rendered with white text in a dark background. In order to highlight the code, you will need to add an external module called highligtjs. Check out external module EXAMPLES to find multiple ways of how you can add it to your project.

    Example

    <deep-chat
    initialMessages='[
    {
    "text": "```java\nwhile (i < 5) {\n console.log(\"hi\");\n i+= 1;\n}\n```",
    "role": "ai"
    }
    ]'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/messages/styles/index.html b/docs/messages/styles/index.html index addb4d1d6..77248586d 100644 --- a/docs/messages/styles/index.html +++ b/docs/messages/styles/index.html @@ -13,7 +13,7 @@ - + @@ -38,7 +38,7 @@ bubble is the element that displays the actual message contents.
    media is applied to image, audio and file type messages which contain an extra child element inside the bubble to display the file contents.

    <deep-chat
    messageStyles='{
    "default": {
    "shared": {
    "outerContainer": {"backgroundColor": "orange"},
    "innerContainer": {"backgroundColor": "yellow"},
    "bubble": {"color": "black"}
    },
    "ai": {"bubble": {"backgroundColor": "lightgreen"}},
    "user": {"bubble": {"backgroundColor": "lightblue"}}
    }
    }'
    ></deep-chat>

    More Examples

    Files

    <deep-chat
    messageStyles='{
    "image": {
    "shared": {
    "media": {"borderRadius": "0px"}
    }
    },
    "audio": {
    "shared": {
    "media": {"borderRadius": "30px", "border": "1px solid #8c8c8c", "backgroundColor": "red"}
    }
    },
    "file": {
    "shared": {
    "bubble": {"backgroundColor": "grey"}
    }
    }
    }'
    ></deep-chat>
    info

    The "audio" media player is controlled by the browser and and its styling may not be overwritable by the media property.

    tip

    In the Safari browser, the "audio" media player can be expanded by setting the width property in media to 200px or higher.

    Intro message

    <deep-chat
    messageStyles='{
    "intro": {"bubble": {"backgroundColor": "#475cc7", "color": "white", "fontSize": "16px"}}
    }'
    ></deep-chat>

    Loading bubble

    <deep-chat
    messageStyles='{
    "loading": {
    "bubble": {"backgroundColor": "#3793ff", "fontSize": "20px", "color": "white"}
    }
    }'
    ></deep-chat>

    Error messages

    <deep-chat
    messageStyles='{
    "error": {
    "bubble": {"backgroundColor": "#f98e00", "color": "white", "fontSize": "15px"}
    }
    }'
    ></deep-chat>
    - + \ No newline at end of file diff --git a/docs/methods/index.html b/docs/methods/index.html index da7bd87d1..ce4032f13 100644 --- a/docs/methods/index.html +++ b/docs/methods/index.html @@ -13,7 +13,7 @@ - + @@ -22,7 +22,7 @@ a false argument to prevent this.

    Example

    chatElementRef.clearMessages();

    submitUserMessage

    • Type: (text: string) => void

    Send a user message programmatically.

    Example

    chatElementRef.submitUserMessage("User message");

    scrollToBottom

    • Type: () => void

    Moves the chat's scrollbar to the bottom.

    Example

    chatElementRef.scrollToBottom();

    focusInput

    • Type: () => void

    Focuses the cursor on the text input.

    Example

    chatElementRef.focusInput();

    refreshMessages

    • Type: () => void

    If your messages contain Code and you are using the higlight.js module to highlight them (as per external module guidelines), sometimes the module may load after the messages have been rendered, leaving the code without a highlight. In such instances, you can use this method to highlight the code with the loaded module.

    Example

    chatElementRef.refreshMessages();
    - + \ No newline at end of file diff --git a/docs/speech/index.html b/docs/speech/index.html index 3af42c6ed..041336df9 100644 --- a/docs/speech/index.html +++ b/docs/speech/index.html @@ -13,7 +13,7 @@ - + @@ -82,7 +82,7 @@ It contains the same properties as the MicrophoneStyles object and an additional commandMode property which sets the button styling when the command mode is activated.

    Example

    <deep-chat
    speechToText='{
    "button": {
    "commandMode": {
    "svg": {
    "styles": {
    "default": {
    "filter":
    "brightness(0) saturate(100%) invert(70%) sepia(70%) saturate(4438%) hue-rotate(170deg) brightness(92%) contrast(98%)"
    }}}},
    "active": {
    "svg": {
    "styles": {
    "default": {
    "filter":
    "brightness(0) saturate(100%) invert(10%) sepia(97%) saturate(7495%) hue-rotate(0deg) brightness(101%) contrast(107%))"
    }}}},
    "default": {
    "svg": {
    "styles": {
    "default": {
    "filter":
    "brightness(0) saturate(100%) invert(77%) sepia(9%) saturate(7093%) hue-rotate(32deg) brightness(99%) contrast(83%)"
    }}}}},
    "commands": {
    "removeAllText": "remove text",
    "commandMode": "command"
    }
    }'
    ></deep-chat>
    tip

    You can use the CSSFilterConverter tool to generate filter values for the icon color.

    Demo

    This is the example used in the demo video. When replicating - make sure to add the Speech SDK to your project and add your resource properties.

    <!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->

    <div style="display: flex">
    <deep-chat
    speechToText='{
    "azure": {
    "subscriptionKey": "resource-key",
    "region": "resource-region"
    },
    "commands": {
    "stop": "stop",
    "pause": "pause",
    "resume": "resume",
    "removeAllText": "remove text",
    "submit": "submit",
    "commandMode": "command"
    }}'
    errorMessages='{
    "overrides": {"speechToText": "Azure Speech To Text can not be used in this website as you need to set your credentials."}
    }'
    style="margin-right: 30px"
    demo="true"
    ></deep-chat>
    <deep-chat
    speechToText='{
    "commands": {
    "azure": {
    "subscriptionKey": "resource-key",
    "region": "resource-region"
    },
    "stop": "stop",
    "pause": "pause",
    "resume": "resume",
    "removeAllText": "remove text",
    "submit": "submit",
    "commandMode": "command"
    }}'
    errorMessages='{
    "overrides": {"speechToText": "Azure Speech To Text can not be used in this website as you need to set your credentials."}
    }'
    demo="true"
    ></deep-chat>
    </div>
    - + \ No newline at end of file diff --git a/docs/styles/index.html b/docs/styles/index.html index d05c93e4c..acf6d4ddc 100644 --- a/docs/styles/index.html +++ b/docs/styles/index.html @@ -13,7 +13,7 @@ - + @@ -52,7 +52,7 @@ active is used when the microphone is active.
    unsupported is used when recording is not supported on the user's browser.
    position is the button position within the input area.

    <deep-chat
    microphone='{
    "button": {
    "default": {
    "container": {
    "hover": {
    "backgroundColor": "#7fbded69"
    },
    "click": {
    "backgroundColor": "#4babf669"
    }
    },
    "svg": {
    "styles": {
    "default": {
    "filter":
    "brightness(0) saturate(100%) invert(49%) sepia(53%) saturate(6895%) hue-rotate(200deg) brightness(101%) contrast(101%)"
    },
    "hover": {
    "filter":
    "brightness(0) saturate(100%) invert(27%) sepia(59%) saturate(5655%) hue-rotate(203deg) brightness(101%) contrast(84%)"
    }
    }
    }
    },
    "active": {
    "container": {
    "hover": {
    "backgroundColor": "#ffd07c70"
    },
    "click": {
    "backgroundColor": "#ecb85c70"
    }
    },
    "svg": {
    "styles": {
    "default": {
    "filter":
    "brightness(0) saturate(100%) invert(49%) sepia(99%) saturate(477%) hue-rotate(343deg) brightness(100%) contrast(101%)"
    }
    }
    }
    }
    }
    }'
    ></deep-chat>
    tip

    You can use the CSSFilterConverter tool to generate filter values for the icon color.

    - + \ No newline at end of file diff --git a/examples/Layout/fullScreen/index.html b/examples/Layout/fullScreen/index.html index d7a81c5ce..4599b0213 100644 --- a/examples/Layout/fullScreen/index.html +++ b/examples/Layout/fullScreen/index.html @@ -13,14 +13,14 @@ - +

    Full Screen

    Examples to help you expand the chat component dimensions.

    Default

    This example uses the default Deep Chat theme.

    View Code

    ChatGPT

    This example uses a design similar to ChatGPT.

    View Code

    Simple

    If you want to automatically scale the inner chat's elements relative to the font-size, you can simply add the desired font-size inside the style property.

    View Code
    - + \ No newline at end of file diff --git a/examples/Layout/sticky/index.html b/examples/Layout/sticky/index.html index c73ec6df3..23114e787 100644 --- a/examples/Layout/sticky/index.html +++ b/examples/Layout/sticky/index.html @@ -13,14 +13,14 @@ - +

    Sticky

    Example to help you stick the component to any side of the screen - furthering a chat-like experience to your users. The core method to achieve this is to set the style property with position: fixed and defining the side you want to component to sit on e.g. right: 7%.

    Example code

    <!-- This example is for Vanilla JS and should be tailored to your framework (see Frameworks) -->

    <deep-chat
    style="border-radius: 10px; position: fixed; bottom: 0px; right: 7%; z-index: 1"
    initialMessages='[
    {"text": "Hey, how are you?", "role": "user"},
    {"text": "I am doing great, how about you?", "role": "ai"},
    {"text": "What is the meaning of life?", "role": "user"},
    {"text": "This completely depends on the person.", "role": "ai"}
    ]'
    demo="true"
    stream="true"
    ></deep-chat>
    - + \ No newline at end of file diff --git a/examples/design/index.html b/examples/design/index.html index b9aeb9636..9b507376d 100644 --- a/examples/design/index.html +++ b/examples/design/index.html @@ -13,7 +13,7 @@ - + @@ -22,7 +22,7 @@ set the avatars property to true.

    View Code

    Bard

    Simulation of the styling used in Google Bard. If you are using a custom avatar - please replace the "path-to-icon.png" string to your file's path or set the avatars property to true.

    View Code

    Bing

    Simulation of the styling used in Bing Chat.

    View Code

    Blue

    A blue color theme that uses a background image.

    View Code

    Lo-fi

    A blue and purple theme that uses an image background.

    View Code

    Red

    A red color flavour. If you are using a custom avatar - please replace the "path-to-icon.png" string to your file's path or set the avatars property to true.

    View Code

    Violet

    A violet color theme that uses a squared border styling approach.

    View Code

    Dark blue

    Dark blue color variation that is suitable for a dark screen mode.

    View Code

    Dark Orange

    Dark orange color variation that is suitable for a dark screen mode.

    View Code

    Full width input

    A simple text input area that covers the full width of the chat component.

    View Code
    - + \ No newline at end of file diff --git a/examples/externalModules/index.html b/examples/externalModules/index.html index 47c7e6194..ca0700ff3 100644 --- a/examples/externalModules/index.html +++ b/examples/externalModules/index.html @@ -13,7 +13,7 @@ - + @@ -33,7 +33,7 @@ in their hands to alllow them to tailor the approach for their project.

    Troubleshooting

    If you are experiencing issues for importing/exporting files, please see github issues or create a new issue ticket and we will look into it as soon as possible.

    - + \ No newline at end of file diff --git a/examples/frameworks/index.html b/examples/frameworks/index.html index 8f546f671..a15296b6b 100644 --- a/examples/frameworks/index.html +++ b/examples/frameworks/index.html @@ -13,7 +13,7 @@ - + @@ -30,7 +30,7 @@ the existing examples; please see github issues or create a new issue ticket and we will look into it as soon as possible.

    - + \ No newline at end of file diff --git a/examples/servers/index.html b/examples/servers/index.html index dd322e98a..6e0ce5274 100644 --- a/examples/servers/index.html +++ b/examples/servers/index.html @@ -13,7 +13,7 @@ - + @@ -28,7 +28,7 @@ such as Vercel:

    Click for GitHub Project

    Troubleshooting

    If you are experiencing issueswith any of the examples - please see github issues or create a new issue ticket and we will look into it as soon as possible.

    - + \ No newline at end of file diff --git a/exploreButton/exploreButton/index.html b/exploreButton/exploreButton/index.html index 240330840..8351f19c8 100644 --- a/exploreButton/exploreButton/index.html +++ b/exploreButton/exploreButton/index.html @@ -13,13 +13,13 @@ - + - + \ No newline at end of file diff --git a/features/captureFiles/captureFiles/index.html b/features/captureFiles/captureFiles/index.html index f8fed4065..423c6989e 100644 --- a/features/captureFiles/captureFiles/index.html +++ b/features/captureFiles/captureFiles/index.html @@ -13,13 +13,13 @@ - +
    Use Camera and Microphone
    Deep Chat can be used to create new files inside the component! Click the camera button to capture photos or use the microphone button to record audio.
    - + \ No newline at end of file diff --git a/features/connect/connect/index.html b/features/connect/connect/index.html index 0a462f895..187d1af3f 100644 --- a/features/connect/connect/index.html +++ b/features/connect/connect/index.html @@ -13,13 +13,13 @@ - +
    Connect to any service
    Deep Chat can connect to any API. Use it to communicate with popular AI providers directly from the browser or configure it to connect to your own servers.
    - + \ No newline at end of file diff --git a/features/customize/customize/index.html b/features/customize/customize/index.html index c1abfdfe2..84dfa1184 100644 --- a/features/customize/customize/index.html +++ b/features/customize/customize/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/features/features/index.html b/features/features/index.html index ce240bfef..135b02e14 100644 --- a/features/features/index.html +++ b/features/features/index.html @@ -13,13 +13,13 @@ - +
    Connect to any service
    Deep Chat can connect to any API. Use it to communicate with popular AI providers directly from the browser or configure it to connect to your own servers.
    Transfer Media and MarkDown
    Send images, audio, gifs, spreadsheets and other files to and from the chat. Text messages support MarkDown to help control text layout and render code.
    Use Camera and Microphone
    Deep Chat can be used to create new files inside the component! Click the camera button to capture photos or use the microphone button to record audio.
    Enhance chat with Speech
    Input your text using real time speech to text transcription and have the responses read out to you automatically using text to speech synthesis.
    - + \ No newline at end of file diff --git a/features/media/media/index.html b/features/media/media/index.html index ef2a73ca8..5706fa841 100644 --- a/features/media/media/index.html +++ b/features/media/media/index.html @@ -13,13 +13,13 @@ - +
    Transfer Media and MarkDown
    Send images, audio, gifs, spreadsheets and other files to and from the chat. Text messages support MarkDown to help control text layout and render code.
    - + \ No newline at end of file diff --git a/features/speech/speech/index.html b/features/speech/speech/index.html index 072a00c2d..c3f72ae9c 100644 --- a/features/speech/speech/index.html +++ b/features/speech/speech/index.html @@ -13,13 +13,13 @@ - +
    Enhance chat with Speech
    Input your text using real time speech to text transcription and have the responses read out to you automatically using text to speech synthesis.
    - + \ No newline at end of file diff --git a/footer/footer/index.html b/footer/footer/index.html index 6d8558a77..eda52d5db 100644 --- a/footer/footer/index.html +++ b/footer/footer/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/index.html b/index.html index 0ccd26db4..46ea97019 100644 --- a/index.html +++ b/index.html @@ -13,13 +13,13 @@ - +
    Connect to any service
    Deep Chat can connect to any API. Use it to communicate with popular AI providers directly from the browser or configure it to connect to your own servers.
    Transfer Media and MarkDown
    Send images, audio, gifs, spreadsheets and other files to and from the chat. Text messages support MarkDown to help control text layout and render code.
    Use Camera and Microphone
    Deep Chat can be used to create new files inside the component! Click the camera button to capture photos or use the microphone button to record audio.
    Enhance chat with Speech
    Input your text using real time speech to text transcription and have the responses read out to you automatically using text to speech synthesis.
    - + \ No newline at end of file diff --git a/playground/chat/manipulate/playgroundAddButton/index.html b/playground/chat/manipulate/playgroundAddButton/index.html index 3a78ed4a1..ade77dbd7 100644 --- a/playground/chat/manipulate/playgroundAddButton/index.html +++ b/playground/chat/manipulate/playgroundAddButton/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/chat/playgroundChatComponent/index.html b/playground/chat/playgroundChatComponent/index.html index 7bb988172..7902990c9 100644 --- a/playground/chat/playgroundChatComponent/index.html +++ b/playground/chat/playgroundChatComponent/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/chat/playgroundChatWrapper/index.html b/playground/chat/playgroundChatWrapper/index.html index 0bede4b7d..f3ca783c0 100644 --- a/playground/chat/playgroundChatWrapper/index.html +++ b/playground/chat/playgroundChatWrapper/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/chat/playgroundChatWrapperConfig/index.html b/playground/chat/playgroundChatWrapperConfig/index.html index 8e22dbd83..7b68396e1 100644 --- a/playground/chat/playgroundChatWrapperConfig/index.html +++ b/playground/chat/playgroundChatWrapperConfig/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/chat/playgroundChatWrapperLogo/index.html b/playground/chat/playgroundChatWrapperLogo/index.html index e0bcec4a4..c10f67298 100644 --- a/playground/chat/playgroundChatWrapperLogo/index.html +++ b/playground/chat/playgroundChatWrapperLogo/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/chat/playgroundChatWrapperText/index.html b/playground/chat/playgroundChatWrapperText/index.html index cc9e57323..ab853c931 100644 --- a/playground/chat/playgroundChatWrapperText/index.html +++ b/playground/chat/playgroundChatWrapperText/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/header/export/modal/playgroundExportModal/index.html b/playground/header/export/modal/playgroundExportModal/index.html index ff42ab13c..801c80f45 100644 --- a/playground/header/export/modal/playgroundExportModal/index.html +++ b/playground/header/export/modal/playgroundExportModal/index.html @@ -13,13 +13,13 @@ - +
    Export Config
    Export your playground configuration to continue where you left of next time.
    - + \ No newline at end of file diff --git a/playground/header/export/playgroundExportButton/index.html b/playground/header/export/playgroundExportButton/index.html index a6f18a1e3..5d64c2875 100644 --- a/playground/header/export/playgroundExportButton/index.html +++ b/playground/header/export/playgroundExportButton/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/header/information/modal/playgroundInformationModal/index.html b/playground/header/information/modal/playgroundInformationModal/index.html index 9d29a21cf..3b6e5bc83 100644 --- a/playground/header/information/modal/playgroundInformationModal/index.html +++ b/playground/header/information/modal/playgroundInformationModal/index.html @@ -13,13 +13,13 @@ - +
    Information
    Create, configure and experiment with Deep Chat components without writing any code.
    The playground does not record any data. All information remains in the safety of your browser.
    Watch the playground tutorial video.
    - + \ No newline at end of file diff --git a/playground/header/information/playgroundInformationButton/index.html b/playground/header/information/playgroundInformationButton/index.html index 3221b9143..90b89282e 100644 --- a/playground/header/information/playgroundInformationButton/index.html +++ b/playground/header/information/playgroundInformationButton/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/header/layout/playgroundLayoutButton/index.html b/playground/header/layout/playgroundLayoutButton/index.html index 5e6d12a1b..bf3fc5a8a 100644 --- a/playground/header/layout/playgroundLayoutButton/index.html +++ b/playground/header/layout/playgroundLayoutButton/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/header/playgroundCog/index.html b/playground/header/playgroundCog/index.html index f76f43730..00ee25803 100644 --- a/playground/header/playgroundCog/index.html +++ b/playground/header/playgroundCog/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/header/playgroundHeaderButtons/index.html b/playground/header/playgroundHeaderButtons/index.html index 403b8107e..fb22de910 100644 --- a/playground/header/playgroundHeaderButtons/index.html +++ b/playground/header/playgroundHeaderButtons/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/header/playgroundShield/index.html b/playground/header/playgroundShield/index.html index 657f38fb5..2e2d8a0a5 100644 --- a/playground/header/playgroundShield/index.html +++ b/playground/header/playgroundShield/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/header/upload/modal/playgroundUploadModal/index.html b/playground/header/upload/modal/playgroundUploadModal/index.html index 9b9e2fe87..d5f83b56b 100644 --- a/playground/header/upload/modal/playgroundUploadModal/index.html +++ b/playground/header/upload/modal/playgroundUploadModal/index.html @@ -13,13 +13,13 @@ - +
    Upload Config
    Upload your playground configuration to create chats with your setup and continue where you left of.
    - + \ No newline at end of file diff --git a/playground/header/upload/playgroundUploadButton/index.html b/playground/header/upload/playgroundUploadButton/index.html index b9c0582df..7216c321e 100644 --- a/playground/header/upload/playgroundUploadButton/index.html +++ b/playground/header/upload/playgroundUploadButton/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/index.html b/playground/index.html index 291feee7e..1242ceb0c 100644 --- a/playground/index.html +++ b/playground/index.html @@ -13,13 +13,13 @@ - + - + \ No newline at end of file diff --git a/playground/playgroundSelect/index.html b/playground/playgroundSelect/index.html index 7ed9846ff..a14704eca 100644 --- a/playground/playgroundSelect/index.html +++ b/playground/playgroundSelect/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/serviceModal/close/serviceModalCloseButtons/index.html b/playground/serviceModal/close/serviceModalCloseButtons/index.html index 4cf25a306..f002380e3 100644 --- a/playground/serviceModal/close/serviceModalCloseButtons/index.html +++ b/playground/serviceModal/close/serviceModalCloseButtons/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/serviceModal/code/serviceCode/index.html b/playground/serviceModal/code/serviceCode/index.html index d49508422..6a0c706e0 100644 --- a/playground/serviceModal/code/serviceCode/index.html +++ b/playground/serviceModal/code/serviceCode/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/serviceModal/fields/serviceConstructableObject/index.html b/playground/serviceModal/fields/serviceConstructableObject/index.html index 4337a96cf..723b0de8e 100644 --- a/playground/serviceModal/fields/serviceConstructableObject/index.html +++ b/playground/serviceModal/fields/serviceConstructableObject/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/serviceModal/fields/serviceField/index.html b/playground/serviceModal/fields/serviceField/index.html index a1705bc96..fb7313995 100644 --- a/playground/serviceModal/fields/serviceField/index.html +++ b/playground/serviceModal/fields/serviceField/index.html @@ -13,13 +13,13 @@ - + - + \ No newline at end of file diff --git a/playground/serviceModal/fields/serviceOptionalParametersFields/index.html b/playground/serviceModal/fields/serviceOptionalParametersFields/index.html index d709d8475..defb6c1d2 100644 --- a/playground/serviceModal/fields/serviceOptionalParametersFields/index.html +++ b/playground/serviceModal/fields/serviceOptionalParametersFields/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/serviceModal/fields/serviceRequiredField/index.html b/playground/serviceModal/fields/serviceRequiredField/index.html index c3ba7a17a..1f54c89a8 100644 --- a/playground/serviceModal/fields/serviceRequiredField/index.html +++ b/playground/serviceModal/fields/serviceRequiredField/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/playground/serviceModal/fields/serviceTypeField/index.html b/playground/serviceModal/fields/serviceTypeField/index.html index 866094098..628aeed9a 100644 --- a/playground/serviceModal/fields/serviceTypeField/index.html +++ b/playground/serviceModal/fields/serviceTypeField/index.html @@ -13,13 +13,13 @@ - + - + \ No newline at end of file diff --git a/playground/serviceModal/serviceModal/index.html b/playground/serviceModal/serviceModal/index.html index 52caead8b..176c3e3d7 100644 --- a/playground/serviceModal/serviceModal/index.html +++ b/playground/serviceModal/serviceModal/index.html @@ -13,13 +13,13 @@ - +
    Service Settings
    - + \ No newline at end of file diff --git a/playground/serviceModal/wrappers/collapsableSection/index.html b/playground/serviceModal/wrappers/collapsableSection/index.html index 3cbb76975..308632544 100644 --- a/playground/serviceModal/wrappers/collapsableSection/index.html +++ b/playground/serviceModal/wrappers/collapsableSection/index.html @@ -13,13 +13,13 @@ - +
    -
    - + \ No newline at end of file diff --git a/playground/tooltip/playgroundTooltipWrapper/index.html b/playground/tooltip/playgroundTooltipWrapper/index.html index 9e4711c12..cbebc56bd 100644 --- a/playground/tooltip/playgroundTooltipWrapper/index.html +++ b/playground/tooltip/playgroundTooltipWrapper/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/preload/preloadImages/index.html b/preload/preloadImages/index.html index f10c69297..aa46ec05e 100644 --- a/preload/preloadImages/index.html +++ b/preload/preloadImages/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/preload/preloadPlaygroundImages/index.html b/preload/preloadPlaygroundImages/index.html index 4cc35f7f5..5919196d4 100644 --- a/preload/preloadPlaygroundImages/index.html +++ b/preload/preloadPlaygroundImages/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/preload/preloadStartImages/index.html b/preload/preloadStartImages/index.html index 243a0b32f..96059121b 100644 --- a/preload/preloadStartImages/index.html +++ b/preload/preloadStartImages/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/search/index.html b/search/index.html index 500dc672f..dc16eb994 100644 --- a/search/index.html +++ b/search/index.html @@ -13,13 +13,13 @@ - + - + \ No newline at end of file diff --git a/smallScreen/deepChatLogo/index.html b/smallScreen/deepChatLogo/index.html index 303a9e8ac..0e7588b35 100644 --- a/smallScreen/deepChatLogo/index.html +++ b/smallScreen/deepChatLogo/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/smallScreen/smallScreen/index.html b/smallScreen/smallScreen/index.html index 135bdee9b..d37d8f8c2 100644 --- a/smallScreen/smallScreen/index.html +++ b/smallScreen/smallScreen/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/start/connectToCustomAPI/index.html b/start/connectToCustomAPI/index.html index 7fe923f18..a10be2a49 100644 --- a/start/connectToCustomAPI/index.html +++ b/start/connectToCustomAPI/index.html @@ -13,13 +13,13 @@ - +
    Configure your connection settings using the request property:
    <deep-chat request='{"url":"https://service.com/chat"}'/>
    The target service needs to be able to handle Deep Chat's request and response formats.
    To avoid making changes to the service, use any of the following approaches:
    - Add interceptor properties to augment the transferred objects.
    - Use a handler function to control the request logic with your own code.
    When creating a new server, use these example templates:
    ← Back
    - + \ No newline at end of file diff --git a/start/connectToPopularAPI/index.html b/start/connectToPopularAPI/index.html index b895621cb..aa1cfe44a 100644 --- a/start/connectToPopularAPI/index.html +++ b/start/connectToPopularAPI/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/start/createComponent/index.html b/start/createComponent/index.html index a7d031878..33f2e0eea 100644 --- a/start/createComponent/index.html +++ b/start/createComponent/index.html @@ -13,13 +13,13 @@ - +
    1. Install
    Add the component via an npm dependency or a script.
    2. Define it in your markup
    <deep-chat></deep-chat>
    All done!
    Live code examples:
    Connect to a service →
    - + \ No newline at end of file diff --git a/start/index.html b/start/index.html index e27439f8c..de5d28594 100644 --- a/start/index.html +++ b/start/index.html @@ -13,13 +13,13 @@ - + - + \ No newline at end of file diff --git a/start/options/index.html b/start/options/index.html index 25e1f23a4..b68348c1e 100644 --- a/start/options/index.html +++ b/start/options/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/start/startParticles/index.html b/start/startParticles/index.html index 425280072..f7a73d069 100644 --- a/start/startParticles/index.html +++ b/start/startParticles/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/start/startSmallScreen/index.html b/start/startSmallScreen/index.html index 617449111..837293b41 100644 --- a/start/startSmallScreen/index.html +++ b/start/startSmallScreen/index.html @@ -13,13 +13,13 @@ - + - + \ No newline at end of file diff --git a/startPanel/startPanel/index.html b/startPanel/startPanel/index.html index 037ba544e..d4bbc89eb 100644 --- a/startPanel/startPanel/index.html +++ b/startPanel/startPanel/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/startPanel/startPanelParticles/index.html b/startPanel/startPanelParticles/index.html index a50a5635b..145db7d64 100644 --- a/startPanel/startPanelParticles/index.html +++ b/startPanel/startPanelParticles/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/utils/fadeInContent/index.html b/utils/fadeInContent/index.html index 88a989e60..7cb20620e 100644 --- a/utils/fadeInContent/index.html +++ b/utils/fadeInContent/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/utils/fadeInNav/index.html b/utils/fadeInNav/index.html index fda03479e..7fde53ac1 100644 --- a/utils/fadeInNav/index.html +++ b/utils/fadeInNav/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file diff --git a/utils/onVisibleAnimation/index.html b/utils/onVisibleAnimation/index.html index 0be40a6fb..4c0875f33 100644 --- a/utils/onVisibleAnimation/index.html +++ b/utils/onVisibleAnimation/index.html @@ -13,13 +13,13 @@ - +
    - + \ No newline at end of file