ai12z 3.13.3 → 3.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ai12z-bot.cjs.entry.js +107 -19
- package/dist/cjs/ai12z-chat-message.cjs.entry.js +17 -46
- package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +14 -60
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/styleSheetRegistry-7aecMygn.js +175 -0
- package/dist/collection/components/ai12z-bot/ai12z-bot.js +32 -13
- package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +15 -61
- package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.js +16 -46
- package/dist/collection/utils/liveagents/providers/salesforce.js +75 -6
- package/dist/collection/utils/styleSheetRegistry.js +169 -0
- package/dist/components/ai12z-bot.js +1 -1
- package/dist/components/ai12z-chat-message.js +1 -1
- package/dist/components/ai12z-chat.js +1 -1
- package/dist/components/ai12z-container.js +1 -1
- package/dist/components/ai12z-cta.js +1 -1
- package/dist/components/ai12z-form.js +1 -1
- package/dist/components/ai12z-inline-search.js +1 -1
- package/dist/components/ai12z-input-form.js +1 -1
- package/dist/components/ai12z-knowledge-box.js +1 -1
- package/dist/components/ai12z-search-panel.js +1 -1
- package/dist/components/audio-recorder.js +1 -1
- package/dist/components/dynamic-form.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/interaction-buttons.js +1 -1
- package/dist/components/item-list.js +1 -1
- package/dist/components/{p-DKxaam7U.js → p-3j2aDKYq.js} +1 -1
- package/dist/components/{p-BP8ig03d.js → p-AQ1MS6Ps.js} +1 -1
- package/dist/components/p-B9IJbo4G.js +1 -0
- package/dist/components/{p-DsZWeAcM.js → p-BWMhH2R1.js} +1 -1
- package/dist/components/{p-5UYwpNzl.js → p-BaXs0IIw.js} +1 -1
- package/dist/components/{p-Gr6Q2s96.js → p-Bnj1LjUJ.js} +1 -1
- package/dist/components/p-BwpiW24r.js +1 -0
- package/dist/components/{p-Bo3Ig8oX.js → p-BwqXbNCx.js} +1 -1
- package/dist/components/{p-D2nUK4Pa.js → p-COqFEHJ7.js} +1 -1
- package/dist/components/{p-DA32xa7d.js → p-Ci85xHWQ.js} +1 -1
- package/dist/components/{p-DUaZgAhA.js → p-CrfXJRIo.js} +1 -1
- package/dist/components/{p-DJ68HDol.js → p-DkRAkHLI.js} +2 -2
- package/dist/components/{p-ha1wIlZ-.js → p-Dubjoiw6.js} +1 -1
- package/dist/components/{p-C2wKkcYa.js → p-DvtUY5FW.js} +1 -1
- package/dist/components/{p-J--erGbY.js → p-dQEvevXk.js} +1 -1
- package/dist/{library/p-DAGa-uHD.js → components/p-g36mIk7k.js} +1 -1
- package/dist/components/p-m0Ed3g6I.js +1 -0
- package/dist/components/p-mBjDeFh_.js +1 -0
- package/dist/components/{p-q7YWDP9B.js → p-pOVc-eI8.js} +1 -1
- package/dist/components/{p-BCJzelr9.js → p-qwKoi5kn.js} +1 -1
- package/dist/components/{p-CKAp10SJ.js → p-xTOLReQF.js} +1 -1
- package/dist/components/privacy-modal.js +1 -1
- package/dist/components/search-results-page.js +1 -1
- package/dist/esm/ai12z-bot.entry.js +115 -27
- package/dist/esm/ai12z-category_2.entry.js +3 -3
- package/dist/esm/ai12z-chat-message.entry.js +17 -46
- package/dist/esm/ai12z-chat_2.entry.js +8 -8
- package/dist/esm/ai12z-container.entry.js +3 -3
- package/dist/esm/ai12z-cta.entry.js +4 -4
- package/dist/esm/ai12z-form.entry.js +2 -2
- package/dist/esm/ai12z-inline-search.entry.js +2 -2
- package/dist/esm/ai12z-knowledge-box.entry.js +18 -64
- package/dist/esm/ai12z-search-panel.entry.js +1 -1
- package/dist/esm/chat-avatar_6.entry.js +1 -1
- package/dist/esm/{ctaHelpers-BhM8KbEY.js → ctaHelpers-DrH6S5iU.js} +1 -1
- package/dist/esm/dynamic-form.entry.js +1 -1
- package/dist/esm/{index-BQKLwW-C.js → index-VWr-8RG8.js} +1 -1
- package/dist/esm/index.js +10 -9
- package/dist/esm/item-list.entry.js +2 -2
- package/dist/esm/{keyboard-shortcuts-Bd3LDe9j.js → keyboard-shortcuts-BhKv64FZ.js} +2 -2
- package/dist/esm/{parseHelper-9rP0JS7J.js → parseHelper-kOGOndOe.js} +1 -1
- package/dist/esm/{processCarouselData-Bf2pDFsV.js → processCarouselData-DX152a4X.js} +1 -1
- package/dist/esm/{reCaptchaHelpers-CUcgfdqX.js → reCaptchaHelpers-DUpCzUFb.js} +1 -1
- package/dist/esm/search-results-page.entry.js +4 -4
- package/dist/esm/{socket-service-B1OMbkCM.js → socket-service-D_h5x8Gr.js} +1 -1
- package/dist/esm/styleSheetRegistry-Bfi9VkqK.js +172 -0
- package/dist/esm/{surveyHelpers-CvrZlir1.js → surveyHelpers-D-00eWjv.js} +1 -1
- package/dist/esm/{utils-BTLjNTwP.js → utils-DK_Yhmpx.js} +1 -1
- package/dist/library/index.esm.js +1 -1
- package/dist/library/library.esm.js +1 -1
- package/dist/library/{p-cd764f70.entry.js → p-11c1f91d.entry.js} +1 -1
- package/dist/library/{p-806bfb3d.entry.js → p-1d382046.entry.js} +1 -1
- package/dist/library/{p-0641ba91.entry.js → p-252bb713.entry.js} +2 -2
- package/dist/library/p-25a678ca.entry.js +1 -0
- package/dist/library/p-53edf210.entry.js +1 -0
- package/dist/library/p-646a7eae.entry.js +1 -0
- package/dist/library/p-675d0243.entry.js +1 -0
- package/dist/library/{p-60d5d99f.entry.js → p-6ea05db1.entry.js} +1 -1
- package/dist/library/{p-7f0e306c.entry.js → p-7154a204.entry.js} +1 -1
- package/dist/library/{p-07f11cb8.entry.js → p-72a5eaf2.entry.js} +1 -1
- package/dist/library/{p-2d262192.entry.js → p-8f238b3f.entry.js} +1 -1
- package/dist/library/p-9cffb6fa.entry.js +1 -0
- package/dist/library/{p-y3Go1NSi.js → p-BCkDiHIY.js} +1 -1
- package/dist/{components/p-BhV62IFF.js → library/p-By1gJKXA.js} +1 -1
- package/dist/library/{p-Bbow4UZX.js → p-C0wNDqKO.js} +1 -1
- package/dist/library/p-C3yxqbFh.js +1 -0
- package/dist/library/p-CwZwG6gL.js +1 -0
- package/dist/library/{p-D5m1leH0.js → p-D1IPrgJe.js} +3 -3
- package/dist/library/{p-NAKC5NP9.js → p-KSKiM1sy.js} +1 -1
- package/dist/library/{p-C1eU4fpM.js → p-TJuczvVq.js} +1 -1
- package/dist/library/{p-CnadO0kA.js → p-ZyOWOLs5.js} +1 -1
- package/dist/library/{p-94bf0c7f.entry.js → p-cbfc9f73.entry.js} +1 -1
- package/dist/library/{p-014d5664.entry.js → p-d8506e43.entry.js} +1 -1
- package/dist/library/{p-BZ_koFpE.js → p-n8ydBHE4.js} +1 -1
- package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +1 -0
- package/dist/types/components/ai12z-knowledge-box/ai12z-knowledge-box.d.ts +0 -3
- package/dist/types/components/ai12z-knowledge-box/components/ai12z-chat-message.d.ts +0 -2
- package/dist/types/utils/liveagents/providers/salesforce.d.ts +2 -0
- package/dist/types/utils/styleSheetRegistry.d.ts +40 -0
- package/package.json +2 -2
- package/dist/components/p-B3lv_O-6.js +0 -1
- package/dist/components/p-CLdlCTTp.js +0 -1
- package/dist/components/p-DT0Uarfg.js +0 -1
- package/dist/components/p-zVXADzTq.js +0 -1
- package/dist/library/p-29cd4edc.entry.js +0 -1
- package/dist/library/p-6f3727d3.entry.js +0 -1
- package/dist/library/p-83a71da9.entry.js +0 -1
- package/dist/library/p-DoBD_KPG.js +0 -1
- package/dist/library/p-d3a2acee.entry.js +0 -1
- package/dist/library/p-dc131a5c.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as t,t as i,p as e,H as s,d as o,h as n}from"./p-ZGVz1_9H.js";import{s as a,p as r}from"./p-D2nUK4Pa.js";import{e as l,s as h,p as c}from"./p-BCJzelr9.js";import{j as d,g as u,d as p,H as v,u as m,h as b,k as g,a as w,D as f}from"./p-DUaZgAhA.js";import{l as y,b as x,a as k}from"./p-B_OuPB-D.js";import{r as C}from"./p-BhV62IFF.js";import{w as z,h as S}from"./p-q7YWDP9B.js";import{t as H,g as M}from"./p-ChFVg77w.js";import{l as I,b as $}from"./p-DmqUTHP1.js";class T{constructor(i,e=""){this.socketId="",this.socket=null,this.mode=t.DATA_MODE,this.connectionPromise=null,this.apiKey="",this.protocol="legacy",this.authenticated=!1,this.mode=i,this.apiKey=e,this.protocol=d(i),this.initSocket()}initSocket(){if(this.socket&&(this.clearSocketListeners(),this.socket.disconnect(),this.socket=null),!this.socket){let t=u(this.mode);this.connectionPromise=new Promise(((i,e)=>{let s=!1;const o=setTimeout((()=>{s||(s=!0,console.error("Socket connection timed out"),window.dispatchEvent(new CustomEvent("socketError",{detail:{message:"Unable to connect to server. Please try again later.",code:"CONNECTION_TIMEOUT"}})),e(new Error("Unable to connect to server. Please try again later.")))}),3e4);this.socket=y(t,{transports:"v2"===this.protocol?["websocket","polling"]:["polling"]}),this.socket.on("connect",(()=>{var t;this.socketId=null===(t=this.socket)||void 0===t?void 0:t.id,this.socketId&&T.instances.set(this.socketId,this),"v2"===this.protocol&&this.apiKey?this.socket.emit("authenticate",{api_key:this.apiKey}):s||(s=!0,clearTimeout(o),i())})),"v2"===this.protocol?(this.socket.on("authenticated",(()=>{this.authenticated=!0,s||(s=!0,clearTimeout(o),i())})),this.socket.on("chunk",(t=>{const i=x(t);window.dispatchEvent(new CustomEvent("streamResponse",{detail:i}))})),this.socket.on("complete",(t=>{const i=k(t);window.dispatchEvent(new CustomEvent("endResponse",{detail:i}))}))):(this.socket.on("response",(t=>{window.dispatchEvent(new CustomEvent("streamResponse",{detail:t}))})),this.socket.on("end_response",(t=>{window.dispatchEvent(new CustomEvent("endResponse",{detail:t}))}))),this.socket.on("close",(()=>{this.clearSocketListeners(),this.authenticated=!1,this.socket=null,setTimeout((()=>this.initSocket()),3e3)})),this.socket.on("error",(t=>{console.error("WebSocket error:",t),"v2"===this.protocol&&window.dispatchEvent(new CustomEvent("socketError",{detail:t}))})),this.socket.on("disconnect",(()=>{this.socketId&&T.instances.delete(this.socketId),this.authenticated=!1}))})),this.connectionPromise=this.connectionPromise.catch((t=>{console.error("Socket connection failed:",t.message)}))}}clearSocketListeners(){this.socket&&(this.socket.off("connect"),this.socket.off("response"),this.socket.off("end_response"),this.socket.off("chunk"),this.socket.off("complete"),this.socket.off("authenticated"),this.socket.off("close"),this.socket.off("error"),this.socket.off("disconnect"))}static createInstance(t,i=""){return new T(t,i)}static getInstanceById(t){return T.instances.get(t)}getSocket(){return this.socket}getSocketId(){return this.socketId}getProtocol(){return this.protocol}isAuthenticated(){return"legacy"===this.protocol||this.authenticated}async waitForConnection(){this.connectionPromise&&await this.connectionPromise}isConnected(){var t,i;return null!==(i=null===(t=this.socket)||void 0===t?void 0:t.connected)&&void 0!==i&&i}disconnect(){this.socket&&(this.clearSocketListeners(),this.socket.disconnect(),this.socket=null),this.socketId&&(T.instances.delete(this.socketId),this.socketId=""),this.authenticated=!1}static disconnectSocketById(t){const i=T.instances.get(t);i&&i.socket?(i.socket.disconnect(),T.instances.delete(t)):console.error(`Socket with ID ${t} not found`)}}T.instances=new Map;const j=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.feedback=o(this,"feedback",7),this.survey=o(this,"survey",7),this.stateChanged=o(this,"stateChanged",7),this.messageReceived=o(this,"messageReceived",7),this.formSubmitted=o(this,"formComplete",7),this.surveyCDNPath="https://cdn.ai12z.net/pkg/surveyjs",this.surveyScriptsLoaded=null,this.chats=[],this.chatExcludeTags=[],this.chatIncludeTags=[],this.componentType="search",this.chatPosition="below",this.copied=!1,this.isPlayed=!1,this.buttons=[],this.currentPage=0,this.currentSlide=0,this.scriptArray=[],this.isProse=!0,this.isProcessingEndResponse=!1,this.surveyDomId="",this.focusedIndex=-1,this.chatItemRefs=[],this.styles=["https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css","https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/default.min.css","https://cdn.ai12z.net/pkg/surveyjs/survey-core@2.3.4/survey-core.min.css"],this.getUpdatedChat=(t,i)=>{var e,s,o,n,a;const r=`ai-message-${this.generateUUID()}`,l=this.generateUUID();let h={message:i,type:"ai",status:"success",insightId:t.insightId,id:r,thumbsId:l,controlType:null!==(a=null===(n=null===(o=null===(s=null===(e=t.controlData)||void 0===e?void 0:e.data)||void 0===s?void 0:s.source)||void 0===o?void 0:o.carousel)||void 0===n?void 0:n.type)&&void 0!==a?a:""};return this.survey.emit({results:h,type:"carousel"}),h},this.updateChatMessage=(t,i)=>{const e=this.chats.findIndex((t=>t.id===this.aiMessageId));-1!==e&&(this.chats[e].message=t,this.chats[e].clipboard=t,"form"===i.controlType&&(this.chats[e].controlType=i.controlType,this.chats[e].itemComponent=i,this.chats[e].surveyDomId=i.surveyDomId),this.chats=[...this.chats])},this.handlePrev=()=>{this.currentSlide=(this.currentSlide-1+this.itemList.length)%this.itemList.length,this.processTemplateData(this.currentChatData,"","pagination")},this.handleNext=()=>{this.currentSlide=(this.currentSlide+1)%this.itemList.length,this.processTemplateData(this.currentChatData,"","pagination")},this.handleButtonClick=t=>()=>{this.survey.emit({results:t,type:"button"})},this.handleMessage=(t,i)=>{const e=new a.Converter,s=this.element.shadowRoot.querySelector(`#${i}`);if(!s)return void console.error(`Message bubble with ID ${i} not found.`);var o=s.getAttribute("data-bubbleText")||"";s.setAttribute("data-bubbleText",o+=t),s.setAttribute("aria-label",o),s.setAttribute("role","log"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-atomic","false");let n=e.makeHtml(o);const r=document.getElementById("spinner");r&&(r.style.display="none"),s.innerHTML=n,this.chats[this.chats.length-1].status="success"},this.scrollToBottom=()=>{this.scrollBottom=this.element.shadowRoot.querySelector(".scroll-bottom"),this.scrollBottom.scrollIntoView({behavior:"smooth",block:"end"})},this.disableFeedback=t=>{const i=this.element.shadowRoot.querySelector(`#thumbsUp_${t}`),e=this.element.shadowRoot.querySelector(`#thumbsDown_${t}`);i.classList.add("not-allowed"),i.setAttribute("disabled","true"),e.classList.add("not-allowed"),e.setAttribute("disabled","true")},this.thumbsUp=(t,i,e)=>{const s=this.element.shadowRoot.querySelector(`#thumbsUp_${t}`);s.classList.add("thumbs-up"),s.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path d="M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z" />\n </svg>\n ',this.disableFeedback(t),this.feedback.emit({insightId:i,feedback:{value:1}}),H("up",i||t,e)},this.thumbsDown=(t,i,e)=>{const s=this.element.shadowRoot.querySelector(`#thumbsDown_${t}`);s.classList.add("thumbs-down"),s.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path d="M15.73 5.5h1.035A7.465 7.465 0 0 1 18 9.625a7.465 7.465 0 0 1-1.235 4.125h-.148c-.806 0-1.534.446-2.031 1.08a9.04 9.04 0 0 1-2.861 2.4c-.723.384-1.35.956-1.653 1.715a4.499 4.499 0 0 0-.322 1.672v.633A.75.75 0 0 1 9 22a2.25 2.25 0 0 1-2.25-2.25c0-1.152.26-2.243.723-3.218.266-.558-.107-1.282-.725-1.282H3.622c-1.026 0-1.945-.694-2.054-1.715A12.137 12.137 0 0 1 1.5 12.25c0-2.848.992-5.464 2.649-7.521C4.537 4.247 5.136 4 5.754 4H9.77a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23ZM21.669 14.023c.536-1.362.831-2.845.831-4.398 0-1.22-.182-2.398-.52-3.507-.26-.85-1.084-1.368-1.973-1.368H19.1c-.445 0-.72.498-.523.898.591 1.2.924 2.55.924 3.977a8.958 8.958 0 0 1-1.302 4.666c-.245.403.028.959.5.959h1.053c.832 0 1.612-.453 1.918-1.227Z" />\n </svg>\n ',this.disableFeedback(t),this.feedback.emit({insightId:i,feedback:{value:-1}}),H("down",i||t,e)}}handleChatKeyNav(t,i){var e,s;if("ArrowDown"===t.key){t.preventDefault(),t.stopPropagation();const s=Math.min(this.chats.length-1,i+1);this.focusedIndex=s,null===(e=this.chatItemRefs[s])||void 0===e||e.focus()}else if("ArrowUp"===t.key){t.preventDefault(),t.stopPropagation();const e=Math.max(0,i-1);this.focusedIndex=e,null===(s=this.chatItemRefs[e])||void 0===s||s.focus()}}componentDidLoad(){const t=document.createElement("script");t.text='\n var ai12zChat = window["ai12z"] = {}\n ',document.head.appendChild(t),this.element.shadowRoot.appendChild(t),setTimeout((()=>{var t,i;if(this.customstyle){const i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("href",this.customstyle),null===(t=this.element.shadowRoot)||void 0===t||t.appendChild(i)}if(this.customJS){const t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",this.customJS),null===(i=this.element.shadowRoot)||void 0===i||i.appendChild(t)}}),500),this.loadScriptsSequentially()}async loadScriptsSequentially(){return this.surveyScriptsLoaded||(this.surveyScriptsLoaded=(async()=>{try{await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/survey.core.min.js`),await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/survey.i18n.min.js`),await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/themes/index.min.js`),await this.loadScript(`${this.surveyCDNPath}/survey-js-ui@2.3.4/survey-js-ui.min.js`),this.loadStyles()}catch(t){throw console.error("Failed to load Survey.js scripts:",t),t}})()),this.surveyScriptsLoaded}loadScript(t){return new Promise(((i,e)=>{if(document.querySelector(`script[src="${t}"]`))return void i();const s=document.createElement("script");s.src=t,s.async=!1,s.onload=()=>i(),s.onerror=()=>e(new Error(`Failed to load script: ${t}`)),this.element.shadowRoot.appendChild(s)}))}loadStyles(){for(const t of this.styles){const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.onerror=t=>{console.error("Failed to load style:",t)},this.element.shadowRoot.appendChild(i)}}scrollToLatestBubble(){var t;if("search"===this.componentType){const i=this.element.closest(".chat-content-wrapper"),e=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".chat-list"),s=null==e?void 0:e.querySelectorAll(".non-pending-user"),o=null==s?void 0:s[s.length-1];if(i&&o){const t=i.getBoundingClientRect(),e=o.getBoundingClientRect();i.scrollTo({top:e.top-t.top+i.scrollTop,behavior:"smooth"})}return}const i=this.element.shadowRoot.querySelector(".chat-list"),e=null==i?void 0:i.querySelectorAll(".non-pending-user"),s=null==e?void 0:e[e.length-1];s&&s.scrollIntoView({behavior:"smooth",block:"start"})}componentWillLoad(){this.loadStyles(),"undefined"==typeof window||window.Handlebars||(window.Handlebars=v)}async hydrateMessagesFromState(){var t,i,e;if((null===(t=this.element)||void 0===t?void 0:t.shadowRoot)&&0!==this.chats.length){await this.loadScriptsSequentially(),await new Promise((t=>requestAnimationFrame((()=>t()))));for(const t of this.chats){if("template"===t.controlType)this.processTemplateData(t,t.itemComponent,t.controlType);else if("form"===t.controlType){if(!t.surveyDomId)continue;this.surveyDomId=t.surveyDomId;const i=await z(`#${t.id}`,this.element);i.querySelector(`#${t.surveyDomId}`)||await z(`#${t.surveyDomId}`,this.element),i.style.width="100%",i.parentElement.style.width="100%",await this.renderSurvey(t.itemComponent)}else if("carousel"===t.controlType&&"carousel"===(null===(i=t.itemComponent)||void 0===i?void 0:i.controlType))this.processChatData(t,t.itemComponent);else if(!t.controlType){t.text=m(t.text,this.target||"_blank","ai12z-cta-link",null===(e=this.settings)||void 0===e?void 0:e.utm,"answer");const i=b(t.text);t.text=i.body,this.buttons=i.buttons,this.addEventListeners(`#${t.id}`)}"form"!==t.controlType&&(this.hideSpinner(t).then((()=>{console.log("spinner is hidden")})),this.checkHighlightcode(t.id))}}}disconnectedCallback(){window.ai12z={},this.chats=[]}watchHandler(t,i){}getProjectId(){var t,i,e,s;return null!==(s=null!==(i=null===(t=this.settings)||void 0===t?void 0:t.pId)&&void 0!==i?i:null===(e=this.dataAttributes)||void 0===e?void 0:e.projectId)&&void 0!==s?s:null}streamResponseHandler(t){const{id:i,idChanged:e}=l(this.aiMessageId,this.chats,"ai-message");this.aiMessageId=i,e&&(this.chats=[...this.chats]),requestAnimationFrame((()=>this.handleMessage(t.detail.data,this.aiMessageId)))}async renderSurvey(t){await this.loadScriptsSequentially(),await C({chat:t,surveyDomId:this.surveyDomId,shadowRoot:this.element.shadowRoot,config:{dataKey:this.apiKey,dataMode:this.env,dataAttributes:this.dataAttributes,formSubmitRenderCallback:t=>{this.handleSurveyCompletionRender(t)},onSubmitError:t=>{var i;const e=null===(i=this.element.shadowRoot)||void 0===i?void 0:i.querySelector(`#${this.surveyDomId}`);e?e.innerHTML="Form submission blocked by validation"!==t?"Failed to submit form":"Submission blocked due to suspicious activity.":console.error(`Survey element not found for DOM ID: ${this.surveyDomId}`)}}})}handleSurveyCompletionRender(t){t&&(this.element.shadowRoot.querySelector(`#${t.domId}`).parentElement.innerHTML=t.completedHtml,this.formSubmitted.emit(t),this.survey.emit(t))}endResponseHandler(t){const{id:i,idChanged:e,orphaned:s}=l(this.aiMessageId,this.chats,"ai-message");this.aiMessageId=i,e&&(this.chats=[...this.chats]),s||this.messageReceived.emit({data:t.detail,domId:this.aiMessageId}),this.isProcessingEndResponse?console.log("Already processing endResponse, ignoring duplicate"):(this.scrollToLatestBubble(),this.isProcessingEndResponse=!0,requestAnimationFrame((async()=>{var i,e,s,o;try{const n={element:this.element,hideSpinner:t=>{this.hideSpinner(t)},getUpdatedChat:(t,i)=>this.getUpdatedChat(i,t),updateChatMessage:(t,i)=>{this.updateChatMessage(t,i)},renderSurvey:t=>this.renderSurvey(t),processTemplateData:(t,i)=>this.processTemplateData(t,i,"carousel"),processChatData:(t,i)=>this.processChatData(t,i),checkHighlightcode:t=>this.checkHighlightcode(t),addEventListeners:t=>this.addEventListeners(t),customStyle:this.customstyle,customJS:this.customJS,conversationId:this.conversationId,controlSettings:this.settings,utmConfig:null===(i=this.settings)||void 0===i?void 0:i.utm};await S({data:t.detail,currentDomId:this.aiMessageId,inputType:"cta",setMessages:t=>{this.chats=[...this.chats,t],this.aiMessageId=t.id,requestAnimationFrame((()=>{setTimeout((()=>{t&&t.id&&this.hideSpinner(t).then((()=>{}))}),100)}))},setSurveyDomId:t=>{this.surveyDomId=t},setButtons:t=>{this.buttons=t},config:n}),this.conversationId=t.detail.conversationId,h(this.getProjectId(),this.chats,this.conversationId,null!==(o=null===(s=null===(e=this.settings)||void 0===e?void 0:e._id)||void 0===s?void 0:s.$oid)&&void 0!==o?o:"","ai12z-cta-history","search"),this.aiMessageId=""}catch(t){console.error("Error handling end_response:",t)}finally{setTimeout((()=>{this.isProcessingEndResponse=!1}),500)}})))}checkHighlightcode(t=""){var i;try{if(!t)return console.warn("highlightcodeId is empty"),void(this.isProse=!0);const e=null===(i=this.element.shadowRoot)||void 0===i?void 0:i.querySelector(`#${t}`);if(!e)return console.warn(`Element with id '${t}' not found in shadowRoot`),void(this.isProse=!0);const s=e.querySelectorAll("pre");s.length>0?(e.classList.remove("prose"),import("./p-J--erGbY.js").then((function(t){return t.i})).then((({default:t})=>{t.configure({ignoreUnescapedHTML:!0}),s.forEach((i=>{i.dataset.highlighted?console.warn("Element previously highlighted..."):t.highlightElement(i)}))})).catch((t=>console.error("Failed to load highlight.js:",t)))):e.classList.add("prose")}catch(t){console.error("Error in highlightcode:",t),this.isProse=!0}}buttonClickHandler(t){this.survey.emit({results:t.detail,type:"button"})}get mainObject(){return window.ai12z||(window.ai12z={}),window.ai12z}generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var i=16*Math.random()|0;return("x"==t?i:3&i|8).toString(16)}))}async processChatData(t,i){r(t,i,this.element,(t=>this.hideSpinner(t)),(t=>{this.survey.emit({results:t,type:"update"})}),this.customJS,this.customstyle,!1,"ai")}addEventforReadMore(){this.element.shadowRoot.querySelectorAll(".read-more").forEach((t=>{t.addEventListener("click",(t=>{const i=t.target.closest(".card"),e=i.querySelector(".short-description"),s=i.querySelector(".long-description"),o=i.querySelector(".card-image");e.classList.toggle("hidden"),s.classList.toggle("hidden"),e.classList.contains("hidden")?(o.classList.add("hidden"),i.classList.remove("md:grid-cols-2"),t.target.textContent="Show Less"):(o.classList.remove("hidden"),i.classList.add("md:grid-cols-2"),t.target.textContent="Read More")}))}))}addEventforPanel(t,i){this.element.shadowRoot.querySelectorAll(".panel-button").forEach((t=>{t.addEventListener("click",(t=>{"panel"===t.target.getAttribute("data-type")&&this.processTemplateData(this.currentChatData,"","pagination")}))}))}handleIndicatorClick(t){this.currentSlide=t,this.processTemplateData(this.currentChatData,"","pagination")}updateCarousel(){var t,i;const e=null!==(t=this.element.shadowRoot.querySelector(".prev"))&&void 0!==t?t:this.element.shadowRoot.querySelector(".prev-btn"),s=null!==(i=this.element.shadowRoot.querySelector(".next"))&&void 0!==i?i:this.element.shadowRoot.querySelector(".next-btn");this.element.shadowRoot.querySelectorAll(".indicator").forEach(((t,i)=>{t.addEventListener("click",(()=>this.handleIndicatorClick(i)))})),null==e||e.addEventListener("click",this.handlePrev),null==s||s.addEventListener("click",this.handleNext)}renderPagination(t){let i,e,s,o,n;switch(t){case"carousel":return i=1,o=this.itemList,n={paginatedItems:o,isFirstSlide:0===this.currentSlide,isLastSlide:this.currentSlide===this.itemList.length-1,transform:`-${100*this.currentSlide}%`,currentSlide:this.currentSlide},{context:n,end:s};case"list":return i=5,e=this.currentPage*i,s=e+i,o=this.itemList.slice(e,s),n={items:o,hasPrev:this.currentPage>0,hasNext:s<this.itemList.length},{context:n,end:s}}}addEventforPagination(t){var i,e;null===(i=this.element.shadowRoot.querySelector(".prev-btn"))||void 0===i||i.addEventListener("click",(()=>{this.currentPage>0&&(this.currentPage--,this.processTemplateData(this.currentChatData,"","pagination"))})),null===(e=this.element.shadowRoot.querySelector(".next-btn"))||void 0===e||e.addEventListener("click",(()=>{t<this.itemList.length&&(this.currentPage++,this.processTemplateData(this.currentChatData,"","pagination"))}))}addEventforcardButton(t,i){this.element.shadowRoot.querySelectorAll(".card-button").forEach((e=>{e.addEventListener("click",(e=>{var s,o;v.registerHelper("json",(function(t){return JSON.stringify(t)}));const n=e.target.getAttribute("data-id"),a=e.target.getAttribute("data-type"),r=e.target.getAttribute("data-url");if("panel"===a){const a=v.compile(i[Number(n)+1].content),r=this.element.shadowRoot.querySelectorAll(".carousel-card"),l=e.target.closest(".carousel-card").getAttribute("data-index");r[l].innerHTML=a({form:null===(s=t.items[l].panels[Number(n)])||void 0===s?void 0:s.form,formSettings:t.formSettings,buttons:null===(o=t.items[l].panels[Number(n)])||void 0===o?void 0:o.buttons}),this.addEventforPanel(i,t)}"url"===a&&window.open(r,"_blank")}))}))}async processTemplateData(t,i,e){this.currentChatData=t,await this.waitForElementRender(`#${t.id}`).then((async()=>{var s,o,n,a,r;this.hideSpinner(t);const l=this.element.shadowRoot.querySelector(`#${t.id}`);let h;if(l){if("carousel"===e&&(this.currentTemplate=null===(s=i.controlData)||void 0===s?void 0:s.template,this.currentResponse=null===(o=i.controlData)||void 0===o?void 0:o.data.source,this.itemList=this.currentResponse.items),l.parentElement.style.width="90%",h=v.compile(null===(n=this.currentTemplate[0])||void 0===n?void 0:n.content),"list"===this.currentResponse.process)l.innerHTML=h(this.renderPagination("list").context),this.addEventforPagination(this.renderPagination("list").end);else if("carousel"===this.currentResponse.process)v.registerHelper("eq",(function(t,i){return t===i})),l.innerHTML=h(this.renderPagination("carousel").context),this.updateCarousel();else{v.registerHelper("processArray",(function(t){return Array.isArray(t)?new v.SafeString(JSON.stringify(t)):""})),t.data=i.controlData.data,i.controlData&&i.controlData.data&&(i.controlData.data.msgId=t.id);const e=null===(a=i.controlData)||void 0===a?void 0:a.styles,s=null===(r=i.controlData)||void 0===r?void 0:r.Scripts;e&&I(e,this.element.shadowRoot),l.innerHTML=h({msgId:`${t.id}`,source:this.currentResponse,llm:i.controlData.data.llm}),s&&$(s,l),setTimeout((()=>{this.renderTemplateData(t)}),1e3)}this.addEventforReadMore(),this.addEventforcardButton(this.currentResponse,this.currentTemplate),t.message=l.innerHTML,this.survey.emit({results:t,type:"update"})}}))}renderTemplateData(t){this.mainObject[`${t.id}`]||(this.mainObject[`${t.id}`]={}),this.element.shadowRoot.querySelectorAll(`#${t.id} script`).forEach((t=>{var i;const e=document.createElement("script");e.type="text/javascript",t.src?e.src=t.src:e.innerHTML+=t.innerHTML,e.src||this.scriptArray.push(e),null===(i=t.parentNode)||void 0===i||i.removeChild(t),e.src&&!this.element.shadowRoot.querySelector(`script[src="${e.src}"]`)?this.element.shadowRoot.appendChild(e):this.element.shadowRoot.querySelector('script[type="text/javascript"]')&&!e.src&&(this.scriptArray.length>1?this.scriptArray.forEach((t=>{t.src||t.innerHTML===e.innerHTML||this.element.shadowRoot.appendChild(e)})):this.element.shadowRoot.appendChild(e))})),setTimeout((()=>{this.initializeScript(t.id)}),1e3)}initializeScript(t){"function"==typeof this.mainObject[`${t}`].onLoadCallback&&this.mainObject[`${t}`].onLoadCallback()}hideSpinner(t){return new Promise((i=>{const e=this.element.shadowRoot.querySelector(`#${t.id}`);e&&e.querySelector("#spinner")&&(e.querySelector("#spinner").style.display="none"),i(!0)}))}waitForElementRender(t){return new Promise((i=>{if(this.element.shadowRoot.querySelector(t))return void i();const e=new MutationObserver((()=>{this.element.shadowRoot.querySelector(t)&&(i(),e.disconnect())}));e.observe(this.element.shadowRoot,{childList:!0,subtree:!0})}))}waitForElementToAdd(t){return new Promise((i=>{const e=new MutationObserver((()=>{i(),e.disconnect()}));e.observe(t,{childList:!0,subtree:!0})}))}async invokeSocket(){var i,e,s,o,n,a;let r=null===(i=this.socketIn)||void 0===i?void 0:i.getSocketId();if(!r)return void console.error("Socket ID not available");let l=T.getInstanceById(r);if(!l){console.warn(`No socket service found for socket ID: ${r}, attempting to wait for connection...`);try{await this.socketIn.waitForConnection(),r=this.socketIn.getSocketId(),l=T.getInstanceById(r)}catch(t){console.error("Failed to wait for connection:",t)}}if(!l){console.warn("Creating new socket service...");try{const i=T.createInstance(this.env,null!==(e=this.apiKey)&&void 0!==e?e:t.DATA_KEY);if(await i.waitForConnection(),this.socketIn=i,r=i.getSocketId(),l=T.getInstanceById(r),!l)return void console.error("Failed to create and retrieve new socket service")}catch(t){return void console.error("Failed to create new socket service:",t)}}const h=l.getSocket();if(!h)return void console.error("Socket not available from service");let c,d;"v2"===l.getProtocol()?(d="query",c={query:this.query,conversation_id:this.conversationId||"",base64_images:(null===(s=this.imgFiles)||void 0===s?void 0:s.length)>0?this.imgFiles:void 0}):(d="evaluate_query",c={apiKey:null!==(o=this.apiKey)&&void 0!==o?o:t.DATA_KEY,query:this.query,conversationId:null!==(n=this.conversationId)&&void 0!==n?n:"",base64Images:(null===(a=this.imgFiles)||void 0===a?void 0:a.length)>0?this.imgFiles:[],event:"evaluate_query",attributes:this.dataAttributes,excludeTags:this.chatExcludeTags,includeTags:this.chatIncludeTags,meta:g()}),h.emit(d,c,(t=>{t&&(console.error("Error occurred while evaluating query:",t),this.aiMessageId=`chatbot-${w()}`,this.chats[this.chats.length-1].id=this.aiMessageId,this.chats[this.chats.length-1].text="Error connecting to server. Please try again later.")}))}addEventListeners(t){const i=this.element.shadowRoot.querySelector(t);i&&this.buttons.forEach((t=>{const e=i.querySelector(`#${t.id}`);if(e){const i=e.getAttribute("data-original-click");if(!i)return void console.warn(`originalClickHandler is not defined for button with id: ${t.id}`);const s=i.match(/^([\w.]+)\s*\(([\s\S]*)\)$/);if(s){const i=s[1],o=s[2],n=i.includes(".")?i.split(".").pop():i;e.addEventListener("click",(()=>{try{switch(n){case"sendQuery":console.warn("sendQuery is deprecated, use sendMessage instead"),this.survey.emit({results:t.label,type:"button"});break;case"sendMessage":case"ai12zCtrl.sendMessage":const i=c(o);if(!i)return;this.survey.emit({results:i,type:"sendMessage"});break;case"sendJSON":case"ai12zCtrl.sendJSON":const e=c(o);if(!e)return;this.survey.emit({results:e,type:"sendJSON"})}}catch(t){console.error(`Error invoking ${i}:`,t)}}))}}}))}stopStreamInputHandler(t){this.socketIn&&T.disconnectSocketById(t.detail.socketId)}startStreamInputHandler(t){var i,e,s;(null===(i=t.detail)||void 0===i?void 0:i.maxQuestion)?setTimeout((()=>{this.hideSpinner(t.detail.chatData),this.scrollToLatestBubble()}),1e3):(this.query=null===(e=t.detail)||void 0===e?void 0:e.search,this.imgFiles=null===(s=t.detail)||void 0===s?void 0:s.imgFiles,this.invokeSocket(),this.chats.length>2&&setTimeout((()=>{this.scrollToLatestBubble()}),500))}highlightcode(){const t=this.element.shadowRoot.querySelectorAll("pre");t.length>0&&(this.isProse=!1,import("./p-J--erGbY.js").then((function(t){return t.i})).then((({default:i})=>{i.configure({ignoreUnescapedHTML:!0}),t.forEach((t=>{i.highlightElement(t)}))})).catch((t=>console.error("Failed to load highlight.js:",t))))}copyToClipboard(t){navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([this.removeHtmlTags(t)],{type:"text/plain"})})]).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}removeHtmlTags(t){const i=document.createElement("div");return i.innerHTML=t,i.textContent||i.innerText||""}async speakText(i){var e,s;if("default"===this.voiceType)if("speechSynthesis"in window){const t=window.speechSynthesis.getVoices().find((t=>t.name===this.voice));this.isPlayed=!0;const e=new SpeechSynthesisUtterance(i);e.lang="en-US",e.rate=1,e.pitch=1,e.voice=t,window.speechSynthesis.speak(e)}else alert("Speech Synthesis API is not supported in your browser.");if("google"===this.voiceType){const o=await f(null!==(e=this.apiKey)&&void 0!==e?e:t.DATA_KEY,null!==(s=this.env)&&void 0!==s?s:t.DATA_MODE,i,this.voice),n=this.base64ToBlob(o.audio_content,"audio/mpeg"),a=URL.createObjectURL(n);this.audioElement=new Audio(a),this.audioElement.onended=()=>{this.isPlayed=!1},this.audioElement.paused?(this.audioElement.play(),this.isPlayed=!0):(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null,this.isPlayed=!1)}}base64ToBlob(t,i){const e=atob(t),s=new Array(e.length).fill(0).map(((t,i)=>e.charCodeAt(i))),o=new Uint8Array(s);return new Blob([o],{type:i})}render(){var t;return n("div",{key:"567d1598d53db83ebb453da3fcd6227ee5fe5bc0"},n("ul",{key:"65d296e9a7503b85d6d476039123253c48a9305a",id:"main-content",tabindex:"-1",class:{"chat-list":!0,"custom-list":"search"===this.componentType,"custom-chat-bottom-height":"inline"===this.componentType,"custom-chat-above-height":"inline"===this.componentType&&"above"===this.chatPosition},style:{maxHeight:"search"!==this.componentType?"80vh":"none",overflowY:"search"!==this.componentType?"auto":"visible",height:"search"===this.componentType?"auto":"100%"}},null===(t=this.chats)||void 0===t?void 0:t.map(((t,i)=>{var e,s,o,a,r;const l="ai"===t.type&&(i===this.chats.length-1||"ai"!==(null===(e=this.chats[i+1])||void 0===e?void 0:e.type));return n("li",{class:{"text-md":!0,"chat-list-item":!0,"chat-align-list":"user"!==t.type,"chat-not-user-list":"user"===t.type,"pointer-events-none":"user"===t.type},tabindex:i===this.focusedIndex?0:-1,onKeyDown:t=>this.handleChatKeyNav(t,i),ref:t=>this.chatItemRefs[i]=t,role:"article","aria-label":`${"user"===t.type?"Your message":"Bot response"} ${i+1}`},"user"!==t.type&&n("div",{class:"chat-inner-list default-avatar"},!this.avatarUrl&&n("svg",{viewBox:"0 0 48 48",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",class:"w-8 h-8 "+(l?"md:block":"opacity-0")},n("path",{d:"M24 2c-3 8-8 13-16 16 8 3 13 8 16 16 3-8 8-13 16-16-8-3-13-8-16-16z"})),this.avatarUrl&&n("div",{class:"avatar-container "+(l?"md:block":"opacity-0")},n("img",{src:this.avatarUrl,alt:"Avatar",class:"avatar-image w-8 h-8 rounded-full"}))),"pending"===t.status&&n("div",{class:"pending-chat"},n("svg",{class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},n("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),n("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))),n("div",{id:"parent-element",onMouseEnter:t=>{let i=t.target.querySelector(".non-user-container");i&&(i.style.display="block")},onMouseLeave:t=>{let i=t.target.querySelector(".non-user-container");i&&(i.style.display="none")}},"pending"!==t.status&&!("user"===t.type&&t.isHide)&&n("div",{class:{"p-4":!0,"max-w-full":"search"===this.componentType,prose:!0,"custom-prose":!0,"transition-all":!0,"duration-300":!0,"opacity-100":this.isProse,"opacity-90":!this.isProse,resize:null===(s=t.formModel)||void 0===s?void 0:s.hasOwnProperty("answer"),"non-pending-user":!0},id:t.id,innerHTML:t.message},null===(o=null==t?void 0:t.images)||void 0===o?void 0:o.map((t=>n("img",{src:t,class:"thumbnail",alt:"thumbnail",width:"70",height:"50"}))),"user"!==t.type&&n("svg",{class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",id:"spinner"},n("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),n("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))),"user"!==t.type&&t.clipboard&&(null===(a=this.settings.showMessageIcons)||void 0===a||a)&&!t.surveyDomId&&n("div",{class:"non-user-container",style:{display:"none"}},this.isPlayed&&n("button",{class:"copy-btn","aria-label":"Stop",tabindex:"0",onClick:()=>{this.isPlayed=!1,window.speechSynthesis.cancel(),this.audioElement&&(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null)}},n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-md-heavy"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM9.5 8.5C8.94772 8.5 8.5 8.94772 8.5 9.5V14.5C8.5 15.0523 8.94772 15.5 9.5 15.5H14.5C15.0523 15.5 15.5 15.0523 15.5 14.5V9.5C15.5 8.94772 15.0523 8.5 14.5 8.5H9.5Z",fill:"currentColor"}))),!this.isPlayed&&n("button",{class:"copy-btn",onClick:()=>this.speakText(this.removeHtmlTags(t.clipboard)),"aria-label":"Play",tabindex:"0"},n("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11 4.9099C11 4.47485 10.4828 4.24734 10.1621 4.54132L6.67572 7.7372C6.49129 7.90626 6.25019 8.00005 6 8.00005H4C3.44772 8.00005 3 8.44776 3 9.00005V15C3 15.5523 3.44772 16 4 16H6C6.25019 16 6.49129 16.0938 6.67572 16.2629L10.1621 19.4588C10.4828 19.7527 11 19.5252 11 19.0902V4.9099ZM8.81069 3.06701C10.4142 1.59714 13 2.73463 13 4.9099V19.0902C13 21.2655 10.4142 22.403 8.81069 20.9331L5.61102 18H4C2.34315 18 1 16.6569 1 15V9.00005C1 7.34319 2.34315 6.00005 4 6.00005H5.61102L8.81069 3.06701ZM20.3166 6.35665C20.8019 6.09313 21.409 6.27296 21.6725 6.75833C22.5191 8.3176 22.9996 10.1042 22.9996 12.0001C22.9996 13.8507 22.5418 15.5974 21.7323 17.1302C21.4744 17.6185 20.8695 17.8054 20.3811 17.5475C19.8927 17.2896 19.7059 16.6846 19.9638 16.1962C20.6249 14.9444 20.9996 13.5175 20.9996 12.0001C20.9996 10.4458 20.6064 8.98627 19.9149 7.71262C19.6514 7.22726 19.8312 6.62017 20.3166 6.35665ZM15.7994 7.90049C16.241 7.5688 16.8679 7.65789 17.1995 8.09947C18.0156 9.18593 18.4996 10.5379 18.4996 12.0001C18.4996 13.3127 18.1094 14.5372 17.4385 15.5604C17.1357 16.0222 16.5158 16.1511 16.0539 15.8483C15.5921 15.5455 15.4632 14.9255 15.766 14.4637C16.2298 13.7564 16.4996 12.9113 16.4996 12.0001C16.4996 10.9859 16.1653 10.0526 15.6004 9.30063C15.2687 8.85905 15.3578 8.23218 15.7994 7.90049Z",fill:"currentColor"}))),n("button",{class:"copy-btn",onClick:()=>this.copyToClipboard(t.clipboard),"aria-label":"Copy to Clipboard",tabindex:"0"},!this.copied&&n("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z",fill:"currentColor"})),this.copied&&n("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19.8198 6.19526C20.0601 6.45561 20.0601 6.87772 19.8198 7.13807L9.9736 17.8047C9.73328 18.0651 9.34364 18.0651 9.10332 17.8047L4.18024 12.4714C3.93992 12.2111 3.93992 11.7889 4.18024 11.5286C4.42056 11.2682 4.8102 11.2682 5.05053 11.5286L9.53846 16.3905L18.9495 6.19526C19.1898 5.93491 19.5794 5.93491 19.8198 6.19526Z",fill:"currentColor"}))),n("button",{id:`thumbsUp_${t.thumbsId}`,onClick:()=>this.thumbsUp(t.thumbsId,t.insightId,{dataKey:this.apiKey,dataMode:this.env,conversationId:this.conversationId,projectId:this.getProjectId(),questionText:M(this.chats,t.insightId)||""}),class:"chat-thumbs-up","aria-label":"Thumbs Up",tabindex:"0"},n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z"}))),n("button",{id:`thumbsDown_${t.thumbsId}`,onClick:()=>this.thumbsDown(t.thumbsId,t.insightId,{dataKey:this.apiKey,dataMode:this.env,conversationId:this.conversationId,projectId:this.getProjectId(),questionText:M(this.chats,t.insightId)||""}),class:"chat-thumbs-up","aria-label":"Thumbs Down",tabindex:"0"},n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54"}))),n("button",{class:"copy-btn",tabindex:"0","aria-label":"Send Email"},n("a",{href:`mailto:?subject=${encodeURIComponent(null===(r=this.chats[i-1])||void 0===r?void 0:r.message)}&body=${encodeURIComponent(this.removeHtmlTags(t.clipboard))}`,target:"_blank","aria-label":"Send Email"},n("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"0.3",class:"w-6 h-6"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.75 5.25L3 6V18L3.75 18.75H20.25L21 18V6L20.25 5.25H3.75ZM4.5 7.6955V17.25H19.5V7.69525L11.9999 14.5136L4.5 7.6955ZM18.3099 6.75H5.68986L11.9999 12.4864L18.3099 6.75Z",fill:"currentColor"})," "))))))})),n("div",{key:"ead0c342309de4030cb69954fe585eb2fc06870f",class:"scroll-bottom"})))}get element(){return this}static get watchers(){return{chats:[{watchHandler:0}]}}static get style(){return":host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important;color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}.not-allowed{cursor:not-allowed}.prose.custom-prose{--tw-prose-body:var(--ai12z-bubble-font-color);--tw-prose-bold:var(--ai12z-bubble-font-color);--tw-prose-links:var(--ai12z-link-color);--tw-prose-headings:var(--ai12z-bubble-font-color)}.ai12z-cta-link{color:var(--ai12z-link-color);text-decoration:underline}.ai12z-cta-link:hover{color:var(--ai12z-link-hover-color)}@media (max-width: 768px){.chat-align-list{padding:1rem 1rem 1rem 0rem !important}.chat-not-user-list{padding-inline-start:2.5rem !important}}.thumbs-up{fill:var(--ai12z-feedback-selected);width:1.5rem}.thumbs-down{fill:var(--ai12z-feedback-selected);width:1.5rem}.chat-thumbs-up{color:var(--ai12z-feedback-color)}.default-avatar{color:var(--ai12z-default-avatar-color, var(--ai12z-primary-color))}.chat-list{margin-top:1.25rem;overflow-y:auto;display:flex;flex-direction:column}.custom-chat-top-height{max-height:100vh}@media (max-width: 768px){.custom-chat-bottom-height{max-height:700px}.default-avatar{display:none !important}}.custom-chat-bottom-height{max-height:100%}.custom-chat-above-height{max-height:80vh;margin-bottom:20px}.custom-list{overflow-y:auto}.chat-list-item{padding:2rem 0.5rem 0 0.25rem;display:flex;position:relative;color:var(--ai12z-bubble-font-color);font-size:var(--ai12z-bubble-font-size)}.chat-align-list{justify-content:flex-start;padding-inline-end:2.5rem}.chat-not-user-list{justify-content:flex-end;padding-inline-start:5rem}.chat-inner-list{display:flex;align-items:flex-end;padding-right:0.5rem}.pending-chat{display:flex;justify-content:center;align-items:center;border-width:1px;padding:1.25rem;line-height:1.75rem;border-radius:0.5rem}.non-pending-user{line-height:1.75rem;border-radius:0.5rem}.chat-not-user-list #parent-element .non-pending-user{background-color:var(--ai12z-user-bubble-background, var(--ai12z-bubble-background))}.chat-align-list #parent-element .non-pending-user{background-color:var(--ai12z-ai-bubble-background, var(--ai12z-bubble-background));border:var(--ai12z-ai-bubble-border)}#parent-element{position:relative}.non-user-container{position:absolute;right:0;top:0;width:11rem}.thumbnail{margin-bottom:30px;width:70%}.ai12z_image_result{max-width:500px;width:100%;border-radius:5%;padding:20px}.ai12z_image_caption{margin:20px;padding:1px;background-color:#f0f0f0;border-radius:5px;text-align:center}.resize{width:100%}.prose.prose-w-none *{all:unset;}.non-pending-user .ai12zBtn{background-color:var(--ai12z-primary-color);color:white;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px}.ai12zBtn:active{background-color:rgb(118 135 214)}::-webkit-scrollbar{width:12px;height:12px}::-webkit-scrollbar-track{background:#f1f1f1;border-radius:10px}::-webkit-scrollbar-thumb{background-color:#888;border-radius:10px;border:2px solid #f1f1f1}::-webkit-scrollbar-thumb:hover{background:#555}.copy-btn{color:var(--ai12z-feedback-color)}.list-btn{background-color:#007bff;color:white;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px;max-width:100%;}.pagination-controls{display:flex;justify-content:space-between;margin-top:20px}.pagination-controls button{padding:10px 20px;border:none;background-color:#007bff;color:white;cursor:pointer;border-radius:5px}.pagination-controls button:disabled{background-color:#ccc;cursor:not-allowed}.pagination-controls span{align-self:center;font-size:1.1em}.hidden{display:none}.carousel-container{position:relative;display:flex;overflow:hidden;margin:0 auto;width:100%;max-width:100%}.carousel-items{display:flex;transition:transform 0.3s ease-in-out;width:100%}.carousel-card{flex-shrink:0;width:100%}.card img{width:100%;height:auto}.card-body{margin:15px}.prev,.next{background:#007bff;border:none;color:white;padding:10px;cursor:pointer;border-radius:50%;position:absolute;top:50%;transform:translateY(-50%);z-index:10}.prev{cursor:pointer;left:0px}.next{cursor:pointer;right:0px}.carousel-indicators{display:flex;justify-content:center;margin-top:10px;bottom:4px;left:50%}.indicator{width:10px;height:10px;background-color:gray;border-radius:50%;margin:0 5px;cursor:pointer}button:focus-visible{outline:2px solid var(--ai12z-focus-visible-color, #0A2A43);outline-offset:2px}button.chat-btn-primary:focus-visible{outline:2px solid var(--ai12z-focus-visible-color-primary, --ai12z-focus-visible-color);outline-offset:2px}button.chat-btn-secondary:focus-visible{outline:2px solid var(--ai12z-focus-visible-color-secondary, --ai12z-focus-visible-color)}.ai12z-form-honeypot{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}"}},[1,"ai12z-chat",{chatId:[1,"chat-id"],chats:[1032],query:[1025],apiKey:[1,"api-key"],aiMessageId:[1025,"ai-message-id"],imgFiles:[1032,"img-files"],env:[1025],conversationId:[1025,"conversation-id"],dataAttributes:[8,"data-attributes"],chatExcludeTags:[16],chatIncludeTags:[16],target:[1],voiceType:[1,"voice-type"],voice:[1],componentType:[1,"component-type"],chatPosition:[1,"chat-position"],socketIn:[16],customstyle:[1],customJS:[1,"custom-j-s"],avatarUrl:[1,"avatar-url"],settings:[8],scrollBottom:[32],copied:[32],isPlayed:[32],buttons:[32],itemList:[32],currentChatData:[32],currentTemplate:[32],currentPage:[32],currentResponse:[32],currentSlide:[32],scriptArray:[32],isProse:[32],isProcessingEndResponse:[32],surveyDomId:[32],focusedIndex:[32],hydrateMessagesFromState:[64]},[[8,"streamResponse","streamResponseHandler"],[8,"endResponse","endResponseHandler"],[0,"buttonClick","buttonClickHandler"],[4,"stopStream","stopStreamInputHandler"],[4,"startStream","startStreamInputHandler"]],{chats:[{watchHandler:0}]}]);function E(){"undefined"!=typeof customElements&&["ai12z-chat","item-list"].forEach((t=>{switch(t){case"ai12z-chat":customElements.get(i(t))||customElements.define(i(t),j);break;case"item-list":customElements.get(i(t))||p()}}))}E();export{j as M,T as S,E as d}
|
|
1
|
+
import{E as t,t as i,p as e,H as s,d as o,h as n}from"./p-ZGVz1_9H.js";import{s as a,p as r}from"./p-COqFEHJ7.js";import{e as l,s as h,p as c}from"./p-qwKoi5kn.js";import{j as d,g as u,d as p,H as v,u as m,h as b,k as g,a as w,D as f}from"./p-CrfXJRIo.js";import{l as y,b as x,a as k}from"./p-B_OuPB-D.js";import{r as C}from"./p-g36mIk7k.js";import{w as z,h as S}from"./p-pOVc-eI8.js";import{t as H,g as M}from"./p-ChFVg77w.js";import{l as I,b as $}from"./p-DmqUTHP1.js";class T{constructor(i,e=""){this.socketId="",this.socket=null,this.mode=t.DATA_MODE,this.connectionPromise=null,this.apiKey="",this.protocol="legacy",this.authenticated=!1,this.mode=i,this.apiKey=e,this.protocol=d(i),this.initSocket()}initSocket(){if(this.socket&&(this.clearSocketListeners(),this.socket.disconnect(),this.socket=null),!this.socket){let t=u(this.mode);this.connectionPromise=new Promise(((i,e)=>{let s=!1;const o=setTimeout((()=>{s||(s=!0,console.error("Socket connection timed out"),window.dispatchEvent(new CustomEvent("socketError",{detail:{message:"Unable to connect to server. Please try again later.",code:"CONNECTION_TIMEOUT"}})),e(new Error("Unable to connect to server. Please try again later.")))}),3e4);this.socket=y(t,{transports:"v2"===this.protocol?["websocket","polling"]:["polling"]}),this.socket.on("connect",(()=>{var t;this.socketId=null===(t=this.socket)||void 0===t?void 0:t.id,this.socketId&&T.instances.set(this.socketId,this),"v2"===this.protocol&&this.apiKey?this.socket.emit("authenticate",{api_key:this.apiKey}):s||(s=!0,clearTimeout(o),i())})),"v2"===this.protocol?(this.socket.on("authenticated",(()=>{this.authenticated=!0,s||(s=!0,clearTimeout(o),i())})),this.socket.on("chunk",(t=>{const i=x(t);window.dispatchEvent(new CustomEvent("streamResponse",{detail:i}))})),this.socket.on("complete",(t=>{const i=k(t);window.dispatchEvent(new CustomEvent("endResponse",{detail:i}))}))):(this.socket.on("response",(t=>{window.dispatchEvent(new CustomEvent("streamResponse",{detail:t}))})),this.socket.on("end_response",(t=>{window.dispatchEvent(new CustomEvent("endResponse",{detail:t}))}))),this.socket.on("close",(()=>{this.clearSocketListeners(),this.authenticated=!1,this.socket=null,setTimeout((()=>this.initSocket()),3e3)})),this.socket.on("error",(t=>{console.error("WebSocket error:",t),"v2"===this.protocol&&window.dispatchEvent(new CustomEvent("socketError",{detail:t}))})),this.socket.on("disconnect",(()=>{this.socketId&&T.instances.delete(this.socketId),this.authenticated=!1}))})),this.connectionPromise=this.connectionPromise.catch((t=>{console.error("Socket connection failed:",t.message)}))}}clearSocketListeners(){this.socket&&(this.socket.off("connect"),this.socket.off("response"),this.socket.off("end_response"),this.socket.off("chunk"),this.socket.off("complete"),this.socket.off("authenticated"),this.socket.off("close"),this.socket.off("error"),this.socket.off("disconnect"))}static createInstance(t,i=""){return new T(t,i)}static getInstanceById(t){return T.instances.get(t)}getSocket(){return this.socket}getSocketId(){return this.socketId}getProtocol(){return this.protocol}isAuthenticated(){return"legacy"===this.protocol||this.authenticated}async waitForConnection(){this.connectionPromise&&await this.connectionPromise}isConnected(){var t,i;return null!==(i=null===(t=this.socket)||void 0===t?void 0:t.connected)&&void 0!==i&&i}disconnect(){this.socket&&(this.clearSocketListeners(),this.socket.disconnect(),this.socket=null),this.socketId&&(T.instances.delete(this.socketId),this.socketId=""),this.authenticated=!1}static disconnectSocketById(t){const i=T.instances.get(t);i&&i.socket?(i.socket.disconnect(),T.instances.delete(t)):console.error(`Socket with ID ${t} not found`)}}T.instances=new Map;const j=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.feedback=o(this,"feedback",7),this.survey=o(this,"survey",7),this.stateChanged=o(this,"stateChanged",7),this.messageReceived=o(this,"messageReceived",7),this.formSubmitted=o(this,"formComplete",7),this.surveyCDNPath="https://cdn.ai12z.net/pkg/surveyjs",this.surveyScriptsLoaded=null,this.chats=[],this.chatExcludeTags=[],this.chatIncludeTags=[],this.componentType="search",this.chatPosition="below",this.copied=!1,this.isPlayed=!1,this.buttons=[],this.currentPage=0,this.currentSlide=0,this.scriptArray=[],this.isProse=!0,this.isProcessingEndResponse=!1,this.surveyDomId="",this.focusedIndex=-1,this.chatItemRefs=[],this.styles=["https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css","https://unpkg.com/@highlightjs/cdn-assets@11.11.1/styles/default.min.css","https://cdn.ai12z.net/pkg/surveyjs/survey-core@2.3.4/survey-core.min.css"],this.getUpdatedChat=(t,i)=>{var e,s,o,n,a;const r=`ai-message-${this.generateUUID()}`,l=this.generateUUID();let h={message:i,type:"ai",status:"success",insightId:t.insightId,id:r,thumbsId:l,controlType:null!==(a=null===(n=null===(o=null===(s=null===(e=t.controlData)||void 0===e?void 0:e.data)||void 0===s?void 0:s.source)||void 0===o?void 0:o.carousel)||void 0===n?void 0:n.type)&&void 0!==a?a:""};return this.survey.emit({results:h,type:"carousel"}),h},this.updateChatMessage=(t,i)=>{const e=this.chats.findIndex((t=>t.id===this.aiMessageId));-1!==e&&(this.chats[e].message=t,this.chats[e].clipboard=t,"form"===i.controlType&&(this.chats[e].controlType=i.controlType,this.chats[e].itemComponent=i,this.chats[e].surveyDomId=i.surveyDomId),this.chats=[...this.chats])},this.handlePrev=()=>{this.currentSlide=(this.currentSlide-1+this.itemList.length)%this.itemList.length,this.processTemplateData(this.currentChatData,"","pagination")},this.handleNext=()=>{this.currentSlide=(this.currentSlide+1)%this.itemList.length,this.processTemplateData(this.currentChatData,"","pagination")},this.handleButtonClick=t=>()=>{this.survey.emit({results:t,type:"button"})},this.handleMessage=(t,i)=>{const e=new a.Converter,s=this.element.shadowRoot.querySelector(`#${i}`);if(!s)return void console.error(`Message bubble with ID ${i} not found.`);var o=s.getAttribute("data-bubbleText")||"";s.setAttribute("data-bubbleText",o+=t),s.setAttribute("aria-label",o),s.setAttribute("role","log"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-atomic","false");let n=e.makeHtml(o);const r=document.getElementById("spinner");r&&(r.style.display="none"),s.innerHTML=n,this.chats[this.chats.length-1].status="success"},this.scrollToBottom=()=>{this.scrollBottom=this.element.shadowRoot.querySelector(".scroll-bottom"),this.scrollBottom.scrollIntoView({behavior:"smooth",block:"end"})},this.disableFeedback=t=>{const i=this.element.shadowRoot.querySelector(`#thumbsUp_${t}`),e=this.element.shadowRoot.querySelector(`#thumbsDown_${t}`);i.classList.add("not-allowed"),i.setAttribute("disabled","true"),e.classList.add("not-allowed"),e.setAttribute("disabled","true")},this.thumbsUp=(t,i,e)=>{const s=this.element.shadowRoot.querySelector(`#thumbsUp_${t}`);s.classList.add("thumbs-up"),s.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path d="M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z" />\n </svg>\n ',this.disableFeedback(t),this.feedback.emit({insightId:i,feedback:{value:1}}),H("up",i||t,e)},this.thumbsDown=(t,i,e)=>{const s=this.element.shadowRoot.querySelector(`#thumbsDown_${t}`);s.classList.add("thumbs-down"),s.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path d="M15.73 5.5h1.035A7.465 7.465 0 0 1 18 9.625a7.465 7.465 0 0 1-1.235 4.125h-.148c-.806 0-1.534.446-2.031 1.08a9.04 9.04 0 0 1-2.861 2.4c-.723.384-1.35.956-1.653 1.715a4.499 4.499 0 0 0-.322 1.672v.633A.75.75 0 0 1 9 22a2.25 2.25 0 0 1-2.25-2.25c0-1.152.26-2.243.723-3.218.266-.558-.107-1.282-.725-1.282H3.622c-1.026 0-1.945-.694-2.054-1.715A12.137 12.137 0 0 1 1.5 12.25c0-2.848.992-5.464 2.649-7.521C4.537 4.247 5.136 4 5.754 4H9.77a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23ZM21.669 14.023c.536-1.362.831-2.845.831-4.398 0-1.22-.182-2.398-.52-3.507-.26-.85-1.084-1.368-1.973-1.368H19.1c-.445 0-.72.498-.523.898.591 1.2.924 2.55.924 3.977a8.958 8.958 0 0 1-1.302 4.666c-.245.403.028.959.5.959h1.053c.832 0 1.612-.453 1.918-1.227Z" />\n </svg>\n ',this.disableFeedback(t),this.feedback.emit({insightId:i,feedback:{value:-1}}),H("down",i||t,e)}}handleChatKeyNav(t,i){var e,s;if("ArrowDown"===t.key){t.preventDefault(),t.stopPropagation();const s=Math.min(this.chats.length-1,i+1);this.focusedIndex=s,null===(e=this.chatItemRefs[s])||void 0===e||e.focus()}else if("ArrowUp"===t.key){t.preventDefault(),t.stopPropagation();const e=Math.max(0,i-1);this.focusedIndex=e,null===(s=this.chatItemRefs[e])||void 0===s||s.focus()}}componentDidLoad(){const t=document.createElement("script");t.text='\n var ai12zChat = window["ai12z"] = {}\n ',document.head.appendChild(t),this.element.shadowRoot.appendChild(t),setTimeout((()=>{var t,i;if(this.customstyle){const i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("href",this.customstyle),null===(t=this.element.shadowRoot)||void 0===t||t.appendChild(i)}if(this.customJS){const t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",this.customJS),null===(i=this.element.shadowRoot)||void 0===i||i.appendChild(t)}}),500),this.loadScriptsSequentially()}async loadScriptsSequentially(){return this.surveyScriptsLoaded||(this.surveyScriptsLoaded=(async()=>{try{await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/survey.core.min.js`),await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/survey.i18n.min.js`),await this.loadScript(`${this.surveyCDNPath}/survey-core@2.3.4/themes/index.min.js`),await this.loadScript(`${this.surveyCDNPath}/survey-js-ui@2.3.4/survey-js-ui.min.js`),this.loadStyles()}catch(t){throw console.error("Failed to load Survey.js scripts:",t),t}})()),this.surveyScriptsLoaded}loadScript(t){return new Promise(((i,e)=>{if(document.querySelector(`script[src="${t}"]`))return void i();const s=document.createElement("script");s.src=t,s.async=!1,s.onload=()=>i(),s.onerror=()=>e(new Error(`Failed to load script: ${t}`)),this.element.shadowRoot.appendChild(s)}))}loadStyles(){for(const t of this.styles){const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.onerror=t=>{console.error("Failed to load style:",t)},this.element.shadowRoot.appendChild(i)}}scrollToLatestBubble(){var t;if("search"===this.componentType){const i=this.element.closest(".chat-content-wrapper"),e=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".chat-list"),s=null==e?void 0:e.querySelectorAll(".non-pending-user"),o=null==s?void 0:s[s.length-1];if(i&&o){const t=i.getBoundingClientRect(),e=o.getBoundingClientRect();i.scrollTo({top:e.top-t.top+i.scrollTop,behavior:"smooth"})}return}const i=this.element.shadowRoot.querySelector(".chat-list"),e=null==i?void 0:i.querySelectorAll(".non-pending-user"),s=null==e?void 0:e[e.length-1];s&&s.scrollIntoView({behavior:"smooth",block:"start"})}componentWillLoad(){this.loadStyles(),"undefined"==typeof window||window.Handlebars||(window.Handlebars=v)}async hydrateMessagesFromState(){var t,i,e;if((null===(t=this.element)||void 0===t?void 0:t.shadowRoot)&&0!==this.chats.length){await this.loadScriptsSequentially(),await new Promise((t=>requestAnimationFrame((()=>t()))));for(const t of this.chats){if("template"===t.controlType)this.processTemplateData(t,t.itemComponent,t.controlType);else if("form"===t.controlType){if(!t.surveyDomId)continue;this.surveyDomId=t.surveyDomId;const i=await z(`#${t.id}`,this.element);i.querySelector(`#${t.surveyDomId}`)||await z(`#${t.surveyDomId}`,this.element),i.style.width="100%",i.parentElement.style.width="100%",await this.renderSurvey(t.itemComponent)}else if("carousel"===t.controlType&&"carousel"===(null===(i=t.itemComponent)||void 0===i?void 0:i.controlType))this.processChatData(t,t.itemComponent);else if(!t.controlType){t.text=m(t.text,this.target||"_blank","ai12z-cta-link",null===(e=this.settings)||void 0===e?void 0:e.utm,"answer");const i=b(t.text);t.text=i.body,this.buttons=i.buttons,this.addEventListeners(`#${t.id}`)}"form"!==t.controlType&&(this.hideSpinner(t).then((()=>{console.log("spinner is hidden")})),this.checkHighlightcode(t.id))}}}disconnectedCallback(){window.ai12z={},this.chats=[]}watchHandler(t,i){}getProjectId(){var t,i,e,s;return null!==(s=null!==(i=null===(t=this.settings)||void 0===t?void 0:t.pId)&&void 0!==i?i:null===(e=this.dataAttributes)||void 0===e?void 0:e.projectId)&&void 0!==s?s:null}streamResponseHandler(t){const{id:i,idChanged:e}=l(this.aiMessageId,this.chats,"ai-message");this.aiMessageId=i,e&&(this.chats=[...this.chats]),requestAnimationFrame((()=>this.handleMessage(t.detail.data,this.aiMessageId)))}async renderSurvey(t){await this.loadScriptsSequentially(),await C({chat:t,surveyDomId:this.surveyDomId,shadowRoot:this.element.shadowRoot,config:{dataKey:this.apiKey,dataMode:this.env,dataAttributes:this.dataAttributes,formSubmitRenderCallback:t=>{this.handleSurveyCompletionRender(t)},onSubmitError:t=>{var i;const e=null===(i=this.element.shadowRoot)||void 0===i?void 0:i.querySelector(`#${this.surveyDomId}`);e?e.innerHTML="Form submission blocked by validation"!==t?"Failed to submit form":"Submission blocked due to suspicious activity.":console.error(`Survey element not found for DOM ID: ${this.surveyDomId}`)}}})}handleSurveyCompletionRender(t){t&&(this.element.shadowRoot.querySelector(`#${t.domId}`).parentElement.innerHTML=t.completedHtml,this.formSubmitted.emit(t),this.survey.emit(t))}endResponseHandler(t){const{id:i,idChanged:e,orphaned:s}=l(this.aiMessageId,this.chats,"ai-message");this.aiMessageId=i,e&&(this.chats=[...this.chats]),s||this.messageReceived.emit({data:t.detail,domId:this.aiMessageId}),this.isProcessingEndResponse?console.log("Already processing endResponse, ignoring duplicate"):(this.scrollToLatestBubble(),this.isProcessingEndResponse=!0,requestAnimationFrame((async()=>{var i,e,s,o;try{const n={element:this.element,hideSpinner:t=>{this.hideSpinner(t)},getUpdatedChat:(t,i)=>this.getUpdatedChat(i,t),updateChatMessage:(t,i)=>{this.updateChatMessage(t,i)},renderSurvey:t=>this.renderSurvey(t),processTemplateData:(t,i)=>this.processTemplateData(t,i,"carousel"),processChatData:(t,i)=>this.processChatData(t,i),checkHighlightcode:t=>this.checkHighlightcode(t),addEventListeners:t=>this.addEventListeners(t),customStyle:this.customstyle,customJS:this.customJS,conversationId:this.conversationId,controlSettings:this.settings,utmConfig:null===(i=this.settings)||void 0===i?void 0:i.utm};await S({data:t.detail,currentDomId:this.aiMessageId,inputType:"cta",setMessages:t=>{this.chats=[...this.chats,t],this.aiMessageId=t.id,requestAnimationFrame((()=>{setTimeout((()=>{t&&t.id&&this.hideSpinner(t).then((()=>{}))}),100)}))},setSurveyDomId:t=>{this.surveyDomId=t},setButtons:t=>{this.buttons=t},config:n}),this.conversationId=t.detail.conversationId,h(this.getProjectId(),this.chats,this.conversationId,null!==(o=null===(s=null===(e=this.settings)||void 0===e?void 0:e._id)||void 0===s?void 0:s.$oid)&&void 0!==o?o:"","ai12z-cta-history","search"),this.aiMessageId=""}catch(t){console.error("Error handling end_response:",t)}finally{setTimeout((()=>{this.isProcessingEndResponse=!1}),500)}})))}checkHighlightcode(t=""){var i;try{if(!t)return console.warn("highlightcodeId is empty"),void(this.isProse=!0);const e=null===(i=this.element.shadowRoot)||void 0===i?void 0:i.querySelector(`#${t}`);if(!e)return console.warn(`Element with id '${t}' not found in shadowRoot`),void(this.isProse=!0);const s=e.querySelectorAll("pre");s.length>0?(e.classList.remove("prose"),import("./p-dQEvevXk.js").then((function(t){return t.i})).then((({default:t})=>{t.configure({ignoreUnescapedHTML:!0}),s.forEach((i=>{i.dataset.highlighted?console.warn("Element previously highlighted..."):t.highlightElement(i)}))})).catch((t=>console.error("Failed to load highlight.js:",t)))):e.classList.add("prose")}catch(t){console.error("Error in highlightcode:",t),this.isProse=!0}}buttonClickHandler(t){this.survey.emit({results:t.detail,type:"button"})}get mainObject(){return window.ai12z||(window.ai12z={}),window.ai12z}generateUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var i=16*Math.random()|0;return("x"==t?i:3&i|8).toString(16)}))}async processChatData(t,i){r(t,i,this.element,(t=>this.hideSpinner(t)),(t=>{this.survey.emit({results:t,type:"update"})}),this.customJS,this.customstyle,!1,"ai")}addEventforReadMore(){this.element.shadowRoot.querySelectorAll(".read-more").forEach((t=>{t.addEventListener("click",(t=>{const i=t.target.closest(".card"),e=i.querySelector(".short-description"),s=i.querySelector(".long-description"),o=i.querySelector(".card-image");e.classList.toggle("hidden"),s.classList.toggle("hidden"),e.classList.contains("hidden")?(o.classList.add("hidden"),i.classList.remove("md:grid-cols-2"),t.target.textContent="Show Less"):(o.classList.remove("hidden"),i.classList.add("md:grid-cols-2"),t.target.textContent="Read More")}))}))}addEventforPanel(t,i){this.element.shadowRoot.querySelectorAll(".panel-button").forEach((t=>{t.addEventListener("click",(t=>{"panel"===t.target.getAttribute("data-type")&&this.processTemplateData(this.currentChatData,"","pagination")}))}))}handleIndicatorClick(t){this.currentSlide=t,this.processTemplateData(this.currentChatData,"","pagination")}updateCarousel(){var t,i;const e=null!==(t=this.element.shadowRoot.querySelector(".prev"))&&void 0!==t?t:this.element.shadowRoot.querySelector(".prev-btn"),s=null!==(i=this.element.shadowRoot.querySelector(".next"))&&void 0!==i?i:this.element.shadowRoot.querySelector(".next-btn");this.element.shadowRoot.querySelectorAll(".indicator").forEach(((t,i)=>{t.addEventListener("click",(()=>this.handleIndicatorClick(i)))})),null==e||e.addEventListener("click",this.handlePrev),null==s||s.addEventListener("click",this.handleNext)}renderPagination(t){let i,e,s,o,n;switch(t){case"carousel":return i=1,o=this.itemList,n={paginatedItems:o,isFirstSlide:0===this.currentSlide,isLastSlide:this.currentSlide===this.itemList.length-1,transform:`-${100*this.currentSlide}%`,currentSlide:this.currentSlide},{context:n,end:s};case"list":return i=5,e=this.currentPage*i,s=e+i,o=this.itemList.slice(e,s),n={items:o,hasPrev:this.currentPage>0,hasNext:s<this.itemList.length},{context:n,end:s}}}addEventforPagination(t){var i,e;null===(i=this.element.shadowRoot.querySelector(".prev-btn"))||void 0===i||i.addEventListener("click",(()=>{this.currentPage>0&&(this.currentPage--,this.processTemplateData(this.currentChatData,"","pagination"))})),null===(e=this.element.shadowRoot.querySelector(".next-btn"))||void 0===e||e.addEventListener("click",(()=>{t<this.itemList.length&&(this.currentPage++,this.processTemplateData(this.currentChatData,"","pagination"))}))}addEventforcardButton(t,i){this.element.shadowRoot.querySelectorAll(".card-button").forEach((e=>{e.addEventListener("click",(e=>{var s,o;v.registerHelper("json",(function(t){return JSON.stringify(t)}));const n=e.target.getAttribute("data-id"),a=e.target.getAttribute("data-type"),r=e.target.getAttribute("data-url");if("panel"===a){const a=v.compile(i[Number(n)+1].content),r=this.element.shadowRoot.querySelectorAll(".carousel-card"),l=e.target.closest(".carousel-card").getAttribute("data-index");r[l].innerHTML=a({form:null===(s=t.items[l].panels[Number(n)])||void 0===s?void 0:s.form,formSettings:t.formSettings,buttons:null===(o=t.items[l].panels[Number(n)])||void 0===o?void 0:o.buttons}),this.addEventforPanel(i,t)}"url"===a&&window.open(r,"_blank")}))}))}async processTemplateData(t,i,e){this.currentChatData=t,await this.waitForElementRender(`#${t.id}`).then((async()=>{var s,o,n,a,r;this.hideSpinner(t);const l=this.element.shadowRoot.querySelector(`#${t.id}`);let h;if(l){if("carousel"===e&&(this.currentTemplate=null===(s=i.controlData)||void 0===s?void 0:s.template,this.currentResponse=null===(o=i.controlData)||void 0===o?void 0:o.data.source,this.itemList=this.currentResponse.items),l.parentElement.style.width="90%",h=v.compile(null===(n=this.currentTemplate[0])||void 0===n?void 0:n.content),"list"===this.currentResponse.process)l.innerHTML=h(this.renderPagination("list").context),this.addEventforPagination(this.renderPagination("list").end);else if("carousel"===this.currentResponse.process)v.registerHelper("eq",(function(t,i){return t===i})),l.innerHTML=h(this.renderPagination("carousel").context),this.updateCarousel();else{v.registerHelper("processArray",(function(t){return Array.isArray(t)?new v.SafeString(JSON.stringify(t)):""})),t.data=i.controlData.data,i.controlData&&i.controlData.data&&(i.controlData.data.msgId=t.id);const e=null===(a=i.controlData)||void 0===a?void 0:a.styles,s=null===(r=i.controlData)||void 0===r?void 0:r.Scripts;e&&I(e,this.element.shadowRoot),l.innerHTML=h({msgId:`${t.id}`,source:this.currentResponse,llm:i.controlData.data.llm}),s&&$(s,l),setTimeout((()=>{this.renderTemplateData(t)}),1e3)}this.addEventforReadMore(),this.addEventforcardButton(this.currentResponse,this.currentTemplate),t.message=l.innerHTML,this.survey.emit({results:t,type:"update"})}}))}renderTemplateData(t){this.mainObject[`${t.id}`]||(this.mainObject[`${t.id}`]={}),this.element.shadowRoot.querySelectorAll(`#${t.id} script`).forEach((t=>{var i;const e=document.createElement("script");e.type="text/javascript",t.src?e.src=t.src:e.innerHTML+=t.innerHTML,e.src||this.scriptArray.push(e),null===(i=t.parentNode)||void 0===i||i.removeChild(t),e.src&&!this.element.shadowRoot.querySelector(`script[src="${e.src}"]`)?this.element.shadowRoot.appendChild(e):this.element.shadowRoot.querySelector('script[type="text/javascript"]')&&!e.src&&(this.scriptArray.length>1?this.scriptArray.forEach((t=>{t.src||t.innerHTML===e.innerHTML||this.element.shadowRoot.appendChild(e)})):this.element.shadowRoot.appendChild(e))})),setTimeout((()=>{this.initializeScript(t.id)}),1e3)}initializeScript(t){"function"==typeof this.mainObject[`${t}`].onLoadCallback&&this.mainObject[`${t}`].onLoadCallback()}hideSpinner(t){return new Promise((i=>{const e=this.element.shadowRoot.querySelector(`#${t.id}`);e&&e.querySelector("#spinner")&&(e.querySelector("#spinner").style.display="none"),i(!0)}))}waitForElementRender(t){return new Promise((i=>{if(this.element.shadowRoot.querySelector(t))return void i();const e=new MutationObserver((()=>{this.element.shadowRoot.querySelector(t)&&(i(),e.disconnect())}));e.observe(this.element.shadowRoot,{childList:!0,subtree:!0})}))}waitForElementToAdd(t){return new Promise((i=>{const e=new MutationObserver((()=>{i(),e.disconnect()}));e.observe(t,{childList:!0,subtree:!0})}))}async invokeSocket(){var i,e,s,o,n,a;let r=null===(i=this.socketIn)||void 0===i?void 0:i.getSocketId();if(!r)return void console.error("Socket ID not available");let l=T.getInstanceById(r);if(!l){console.warn(`No socket service found for socket ID: ${r}, attempting to wait for connection...`);try{await this.socketIn.waitForConnection(),r=this.socketIn.getSocketId(),l=T.getInstanceById(r)}catch(t){console.error("Failed to wait for connection:",t)}}if(!l){console.warn("Creating new socket service...");try{const i=T.createInstance(this.env,null!==(e=this.apiKey)&&void 0!==e?e:t.DATA_KEY);if(await i.waitForConnection(),this.socketIn=i,r=i.getSocketId(),l=T.getInstanceById(r),!l)return void console.error("Failed to create and retrieve new socket service")}catch(t){return void console.error("Failed to create new socket service:",t)}}const h=l.getSocket();if(!h)return void console.error("Socket not available from service");let c,d;"v2"===l.getProtocol()?(d="query",c={query:this.query,conversation_id:this.conversationId||"",base64_images:(null===(s=this.imgFiles)||void 0===s?void 0:s.length)>0?this.imgFiles:void 0}):(d="evaluate_query",c={apiKey:null!==(o=this.apiKey)&&void 0!==o?o:t.DATA_KEY,query:this.query,conversationId:null!==(n=this.conversationId)&&void 0!==n?n:"",base64Images:(null===(a=this.imgFiles)||void 0===a?void 0:a.length)>0?this.imgFiles:[],event:"evaluate_query",attributes:this.dataAttributes,excludeTags:this.chatExcludeTags,includeTags:this.chatIncludeTags,meta:g()}),h.emit(d,c,(t=>{t&&(console.error("Error occurred while evaluating query:",t),this.aiMessageId=`chatbot-${w()}`,this.chats[this.chats.length-1].id=this.aiMessageId,this.chats[this.chats.length-1].text="Error connecting to server. Please try again later.")}))}addEventListeners(t){const i=this.element.shadowRoot.querySelector(t);i&&this.buttons.forEach((t=>{const e=i.querySelector(`#${t.id}`);if(e){const i=e.getAttribute("data-original-click");if(!i)return void console.warn(`originalClickHandler is not defined for button with id: ${t.id}`);const s=i.match(/^([\w.]+)\s*\(([\s\S]*)\)$/);if(s){const i=s[1],o=s[2],n=i.includes(".")?i.split(".").pop():i;e.addEventListener("click",(()=>{try{switch(n){case"sendQuery":console.warn("sendQuery is deprecated, use sendMessage instead"),this.survey.emit({results:t.label,type:"button"});break;case"sendMessage":case"ai12zCtrl.sendMessage":const i=c(o);if(!i)return;this.survey.emit({results:i,type:"sendMessage"});break;case"sendJSON":case"ai12zCtrl.sendJSON":const e=c(o);if(!e)return;this.survey.emit({results:e,type:"sendJSON"})}}catch(t){console.error(`Error invoking ${i}:`,t)}}))}}}))}stopStreamInputHandler(t){this.socketIn&&T.disconnectSocketById(t.detail.socketId)}startStreamInputHandler(t){var i,e,s;(null===(i=t.detail)||void 0===i?void 0:i.maxQuestion)?setTimeout((()=>{this.hideSpinner(t.detail.chatData),this.scrollToLatestBubble()}),1e3):(this.query=null===(e=t.detail)||void 0===e?void 0:e.search,this.imgFiles=null===(s=t.detail)||void 0===s?void 0:s.imgFiles,this.invokeSocket(),this.chats.length>2&&setTimeout((()=>{this.scrollToLatestBubble()}),500))}highlightcode(){const t=this.element.shadowRoot.querySelectorAll("pre");t.length>0&&(this.isProse=!1,import("./p-dQEvevXk.js").then((function(t){return t.i})).then((({default:i})=>{i.configure({ignoreUnescapedHTML:!0}),t.forEach((t=>{i.highlightElement(t)}))})).catch((t=>console.error("Failed to load highlight.js:",t))))}copyToClipboard(t){navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([this.removeHtmlTags(t)],{type:"text/plain"})})]).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}removeHtmlTags(t){const i=document.createElement("div");return i.innerHTML=t,i.textContent||i.innerText||""}async speakText(i){var e,s;if("default"===this.voiceType)if("speechSynthesis"in window){const t=window.speechSynthesis.getVoices().find((t=>t.name===this.voice));this.isPlayed=!0;const e=new SpeechSynthesisUtterance(i);e.lang="en-US",e.rate=1,e.pitch=1,e.voice=t,window.speechSynthesis.speak(e)}else alert("Speech Synthesis API is not supported in your browser.");if("google"===this.voiceType){const o=await f(null!==(e=this.apiKey)&&void 0!==e?e:t.DATA_KEY,null!==(s=this.env)&&void 0!==s?s:t.DATA_MODE,i,this.voice),n=this.base64ToBlob(o.audio_content,"audio/mpeg"),a=URL.createObjectURL(n);this.audioElement=new Audio(a),this.audioElement.onended=()=>{this.isPlayed=!1},this.audioElement.paused?(this.audioElement.play(),this.isPlayed=!0):(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null,this.isPlayed=!1)}}base64ToBlob(t,i){const e=atob(t),s=new Array(e.length).fill(0).map(((t,i)=>e.charCodeAt(i))),o=new Uint8Array(s);return new Blob([o],{type:i})}render(){var t;return n("div",{key:"567d1598d53db83ebb453da3fcd6227ee5fe5bc0"},n("ul",{key:"65d296e9a7503b85d6d476039123253c48a9305a",id:"main-content",tabindex:"-1",class:{"chat-list":!0,"custom-list":"search"===this.componentType,"custom-chat-bottom-height":"inline"===this.componentType,"custom-chat-above-height":"inline"===this.componentType&&"above"===this.chatPosition},style:{maxHeight:"search"!==this.componentType?"80vh":"none",overflowY:"search"!==this.componentType?"auto":"visible",height:"search"===this.componentType?"auto":"100%"}},null===(t=this.chats)||void 0===t?void 0:t.map(((t,i)=>{var e,s,o,a,r;const l="ai"===t.type&&(i===this.chats.length-1||"ai"!==(null===(e=this.chats[i+1])||void 0===e?void 0:e.type));return n("li",{class:{"text-md":!0,"chat-list-item":!0,"chat-align-list":"user"!==t.type,"chat-not-user-list":"user"===t.type,"pointer-events-none":"user"===t.type},tabindex:i===this.focusedIndex?0:-1,onKeyDown:t=>this.handleChatKeyNav(t,i),ref:t=>this.chatItemRefs[i]=t,role:"article","aria-label":`${"user"===t.type?"Your message":"Bot response"} ${i+1}`},"user"!==t.type&&n("div",{class:"chat-inner-list default-avatar"},!this.avatarUrl&&n("svg",{viewBox:"0 0 48 48",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",class:"w-8 h-8 "+(l?"md:block":"opacity-0")},n("path",{d:"M24 2c-3 8-8 13-16 16 8 3 13 8 16 16 3-8 8-13 16-16-8-3-13-8-16-16z"})),this.avatarUrl&&n("div",{class:"avatar-container "+(l?"md:block":"opacity-0")},n("img",{src:this.avatarUrl,alt:"Avatar",class:"avatar-image w-8 h-8 rounded-full"}))),"pending"===t.status&&n("div",{class:"pending-chat"},n("svg",{class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},n("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),n("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))),n("div",{id:"parent-element",onMouseEnter:t=>{let i=t.target.querySelector(".non-user-container");i&&(i.style.display="block")},onMouseLeave:t=>{let i=t.target.querySelector(".non-user-container");i&&(i.style.display="none")}},"pending"!==t.status&&!("user"===t.type&&t.isHide)&&n("div",{class:{"p-4":!0,"max-w-full":"search"===this.componentType,prose:!0,"custom-prose":!0,"transition-all":!0,"duration-300":!0,"opacity-100":this.isProse,"opacity-90":!this.isProse,resize:null===(s=t.formModel)||void 0===s?void 0:s.hasOwnProperty("answer"),"non-pending-user":!0},id:t.id,innerHTML:t.message},null===(o=null==t?void 0:t.images)||void 0===o?void 0:o.map((t=>n("img",{src:t,class:"thumbnail",alt:"thumbnail",width:"70",height:"50"}))),"user"!==t.type&&n("svg",{class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",id:"spinner"},n("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),n("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))),"user"!==t.type&&t.clipboard&&(null===(a=this.settings.showMessageIcons)||void 0===a||a)&&!t.surveyDomId&&n("div",{class:"non-user-container",style:{display:"none"}},this.isPlayed&&n("button",{class:"copy-btn","aria-label":"Stop",tabindex:"0",onClick:()=>{this.isPlayed=!1,window.speechSynthesis.cancel(),this.audioElement&&(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null)}},n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-md-heavy"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM9.5 8.5C8.94772 8.5 8.5 8.94772 8.5 9.5V14.5C8.5 15.0523 8.94772 15.5 9.5 15.5H14.5C15.0523 15.5 15.5 15.0523 15.5 14.5V9.5C15.5 8.94772 15.0523 8.5 14.5 8.5H9.5Z",fill:"currentColor"}))),!this.isPlayed&&n("button",{class:"copy-btn",onClick:()=>this.speakText(this.removeHtmlTags(t.clipboard)),"aria-label":"Play",tabindex:"0"},n("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11 4.9099C11 4.47485 10.4828 4.24734 10.1621 4.54132L6.67572 7.7372C6.49129 7.90626 6.25019 8.00005 6 8.00005H4C3.44772 8.00005 3 8.44776 3 9.00005V15C3 15.5523 3.44772 16 4 16H6C6.25019 16 6.49129 16.0938 6.67572 16.2629L10.1621 19.4588C10.4828 19.7527 11 19.5252 11 19.0902V4.9099ZM8.81069 3.06701C10.4142 1.59714 13 2.73463 13 4.9099V19.0902C13 21.2655 10.4142 22.403 8.81069 20.9331L5.61102 18H4C2.34315 18 1 16.6569 1 15V9.00005C1 7.34319 2.34315 6.00005 4 6.00005H5.61102L8.81069 3.06701ZM20.3166 6.35665C20.8019 6.09313 21.409 6.27296 21.6725 6.75833C22.5191 8.3176 22.9996 10.1042 22.9996 12.0001C22.9996 13.8507 22.5418 15.5974 21.7323 17.1302C21.4744 17.6185 20.8695 17.8054 20.3811 17.5475C19.8927 17.2896 19.7059 16.6846 19.9638 16.1962C20.6249 14.9444 20.9996 13.5175 20.9996 12.0001C20.9996 10.4458 20.6064 8.98627 19.9149 7.71262C19.6514 7.22726 19.8312 6.62017 20.3166 6.35665ZM15.7994 7.90049C16.241 7.5688 16.8679 7.65789 17.1995 8.09947C18.0156 9.18593 18.4996 10.5379 18.4996 12.0001C18.4996 13.3127 18.1094 14.5372 17.4385 15.5604C17.1357 16.0222 16.5158 16.1511 16.0539 15.8483C15.5921 15.5455 15.4632 14.9255 15.766 14.4637C16.2298 13.7564 16.4996 12.9113 16.4996 12.0001C16.4996 10.9859 16.1653 10.0526 15.6004 9.30063C15.2687 8.85905 15.3578 8.23218 15.7994 7.90049Z",fill:"currentColor"}))),n("button",{class:"copy-btn",onClick:()=>this.copyToClipboard(t.clipboard),"aria-label":"Copy to Clipboard",tabindex:"0"},!this.copied&&n("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z",fill:"currentColor"})),this.copied&&n("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19.8198 6.19526C20.0601 6.45561 20.0601 6.87772 19.8198 7.13807L9.9736 17.8047C9.73328 18.0651 9.34364 18.0651 9.10332 17.8047L4.18024 12.4714C3.93992 12.2111 3.93992 11.7889 4.18024 11.5286C4.42056 11.2682 4.8102 11.2682 5.05053 11.5286L9.53846 16.3905L18.9495 6.19526C19.1898 5.93491 19.5794 5.93491 19.8198 6.19526Z",fill:"currentColor"}))),n("button",{id:`thumbsUp_${t.thumbsId}`,onClick:()=>this.thumbsUp(t.thumbsId,t.insightId,{dataKey:this.apiKey,dataMode:this.env,conversationId:this.conversationId,projectId:this.getProjectId(),questionText:M(this.chats,t.insightId)||""}),class:"chat-thumbs-up","aria-label":"Thumbs Up",tabindex:"0"},n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z"}))),n("button",{id:`thumbsDown_${t.thumbsId}`,onClick:()=>this.thumbsDown(t.thumbsId,t.insightId,{dataKey:this.apiKey,dataMode:this.env,conversationId:this.conversationId,projectId:this.getProjectId(),questionText:M(this.chats,t.insightId)||""}),class:"chat-thumbs-up","aria-label":"Thumbs Down",tabindex:"0"},n("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54"}))),n("button",{class:"copy-btn",tabindex:"0","aria-label":"Send Email"},n("a",{href:`mailto:?subject=${encodeURIComponent(null===(r=this.chats[i-1])||void 0===r?void 0:r.message)}&body=${encodeURIComponent(this.removeHtmlTags(t.clipboard))}`,target:"_blank","aria-label":"Send Email"},n("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor","stroke-width":"0.3",class:"w-6 h-6"},n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.75 5.25L3 6V18L3.75 18.75H20.25L21 18V6L20.25 5.25H3.75ZM4.5 7.6955V17.25H19.5V7.69525L11.9999 14.5136L4.5 7.6955ZM18.3099 6.75H5.68986L11.9999 12.4864L18.3099 6.75Z",fill:"currentColor"})," "))))))})),n("div",{key:"ead0c342309de4030cb69954fe585eb2fc06870f",class:"scroll-bottom"})))}get element(){return this}static get watchers(){return{chats:[{watchHandler:0}]}}static get style(){return":host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important;color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}.not-allowed{cursor:not-allowed}.prose.custom-prose{--tw-prose-body:var(--ai12z-bubble-font-color);--tw-prose-bold:var(--ai12z-bubble-font-color);--tw-prose-links:var(--ai12z-link-color);--tw-prose-headings:var(--ai12z-bubble-font-color)}.ai12z-cta-link{color:var(--ai12z-link-color);text-decoration:underline}.ai12z-cta-link:hover{color:var(--ai12z-link-hover-color)}@media (max-width: 768px){.chat-align-list{padding:1rem 1rem 1rem 0rem !important}.chat-not-user-list{padding-inline-start:2.5rem !important}}.thumbs-up{fill:var(--ai12z-feedback-selected);width:1.5rem}.thumbs-down{fill:var(--ai12z-feedback-selected);width:1.5rem}.chat-thumbs-up{color:var(--ai12z-feedback-color)}.default-avatar{color:var(--ai12z-default-avatar-color, var(--ai12z-primary-color))}.chat-list{margin-top:1.25rem;overflow-y:auto;display:flex;flex-direction:column}.custom-chat-top-height{max-height:100vh}@media (max-width: 768px){.custom-chat-bottom-height{max-height:700px}.default-avatar{display:none !important}}.custom-chat-bottom-height{max-height:100%}.custom-chat-above-height{max-height:80vh;margin-bottom:20px}.custom-list{overflow-y:auto}.chat-list-item{padding:2rem 0.5rem 0 0.25rem;display:flex;position:relative;color:var(--ai12z-bubble-font-color);font-size:var(--ai12z-bubble-font-size)}.chat-align-list{justify-content:flex-start;padding-inline-end:2.5rem}.chat-not-user-list{justify-content:flex-end;padding-inline-start:5rem}.chat-inner-list{display:flex;align-items:flex-end;padding-right:0.5rem}.pending-chat{display:flex;justify-content:center;align-items:center;border-width:1px;padding:1.25rem;line-height:1.75rem;border-radius:0.5rem}.non-pending-user{line-height:1.75rem;border-radius:0.5rem}.chat-not-user-list #parent-element .non-pending-user{background-color:var(--ai12z-user-bubble-background, var(--ai12z-bubble-background))}.chat-align-list #parent-element .non-pending-user{background-color:var(--ai12z-ai-bubble-background, var(--ai12z-bubble-background));border:var(--ai12z-ai-bubble-border)}#parent-element{position:relative}.non-user-container{position:absolute;right:0;top:0;width:11rem}.thumbnail{margin-bottom:30px;width:70%}.ai12z_image_result{max-width:500px;width:100%;border-radius:5%;padding:20px}.ai12z_image_caption{margin:20px;padding:1px;background-color:#f0f0f0;border-radius:5px;text-align:center}.resize{width:100%}.prose.prose-w-none *{all:unset;}.non-pending-user .ai12zBtn{background-color:var(--ai12z-primary-color);color:white;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px}.ai12zBtn:active{background-color:rgb(118 135 214)}::-webkit-scrollbar{width:12px;height:12px}::-webkit-scrollbar-track{background:#f1f1f1;border-radius:10px}::-webkit-scrollbar-thumb{background-color:#888;border-radius:10px;border:2px solid #f1f1f1}::-webkit-scrollbar-thumb:hover{background:#555}.copy-btn{color:var(--ai12z-feedback-color)}.list-btn{background-color:#007bff;color:white;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px;max-width:100%;}.pagination-controls{display:flex;justify-content:space-between;margin-top:20px}.pagination-controls button{padding:10px 20px;border:none;background-color:#007bff;color:white;cursor:pointer;border-radius:5px}.pagination-controls button:disabled{background-color:#ccc;cursor:not-allowed}.pagination-controls span{align-self:center;font-size:1.1em}.hidden{display:none}.carousel-container{position:relative;display:flex;overflow:hidden;margin:0 auto;width:100%;max-width:100%}.carousel-items{display:flex;transition:transform 0.3s ease-in-out;width:100%}.carousel-card{flex-shrink:0;width:100%}.card img{width:100%;height:auto}.card-body{margin:15px}.prev,.next{background:#007bff;border:none;color:white;padding:10px;cursor:pointer;border-radius:50%;position:absolute;top:50%;transform:translateY(-50%);z-index:10}.prev{cursor:pointer;left:0px}.next{cursor:pointer;right:0px}.carousel-indicators{display:flex;justify-content:center;margin-top:10px;bottom:4px;left:50%}.indicator{width:10px;height:10px;background-color:gray;border-radius:50%;margin:0 5px;cursor:pointer}button:focus-visible{outline:2px solid var(--ai12z-focus-visible-color, #0A2A43);outline-offset:2px}button.chat-btn-primary:focus-visible{outline:2px solid var(--ai12z-focus-visible-color-primary, --ai12z-focus-visible-color);outline-offset:2px}button.chat-btn-secondary:focus-visible{outline:2px solid var(--ai12z-focus-visible-color-secondary, --ai12z-focus-visible-color)}.ai12z-form-honeypot{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}"}},[1,"ai12z-chat",{chatId:[1,"chat-id"],chats:[1032],query:[1025],apiKey:[1,"api-key"],aiMessageId:[1025,"ai-message-id"],imgFiles:[1032,"img-files"],env:[1025],conversationId:[1025,"conversation-id"],dataAttributes:[8,"data-attributes"],chatExcludeTags:[16],chatIncludeTags:[16],target:[1],voiceType:[1,"voice-type"],voice:[1],componentType:[1,"component-type"],chatPosition:[1,"chat-position"],socketIn:[16],customstyle:[1],customJS:[1,"custom-j-s"],avatarUrl:[1,"avatar-url"],settings:[8],scrollBottom:[32],copied:[32],isPlayed:[32],buttons:[32],itemList:[32],currentChatData:[32],currentTemplate:[32],currentPage:[32],currentResponse:[32],currentSlide:[32],scriptArray:[32],isProse:[32],isProcessingEndResponse:[32],surveyDomId:[32],focusedIndex:[32],hydrateMessagesFromState:[64]},[[8,"streamResponse","streamResponseHandler"],[8,"endResponse","endResponseHandler"],[0,"buttonClick","buttonClickHandler"],[4,"stopStream","stopStreamInputHandler"],[4,"startStream","startStreamInputHandler"]],{chats:[{watchHandler:0}]}]);function E(){"undefined"!=typeof customElements&&["ai12z-chat","item-list"].forEach((t=>{switch(t){case"ai12z-chat":customElements.get(i(t))||customElements.define(i(t),j);break;case"item-list":customElements.get(i(t))||p()}}))}E();export{j as M,T as S,E as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as
|
|
1
|
+
import{P as o,d as s}from"./p-Bnj1LjUJ.js";const j=o,p=s;export{j as PrivacyModal,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as o,d as s}from"./p-
|
|
1
|
+
import{S as o,d as s}from"./p-BwqXbNCx.js";const p=o,r=s;export{p as SearchResultsPage,r as defineCustomElement}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { E as Env, r as registerInstance, a as createEvent, e as ai12zManager, h, f as Host, d as getElement } from './index-BNpVu1WU.js';
|
|
2
2
|
import { b as adaptCompleteToLegacy, l as lookup } from './response-adapter-SyQT2Pr3.js';
|
|
3
|
-
import { s as showdown, p as processChatData } from './processCarouselData-
|
|
3
|
+
import { s as showdown, p as processChatData } from './processCarouselData-DX152a4X.js';
|
|
4
4
|
import { L as Logger, a as LogLevel } from './logger-DUcx64Gz.js';
|
|
5
|
-
import { c as getEndpoint,
|
|
6
|
-
import { H as Handlebars } from './index-
|
|
5
|
+
import { c as getEndpoint, k as generateUUID, I as getOrCreateVisitorId, j as generateMessage, J as checkStatus, K as formatTimestamp, u as updateAnchorTags, f as updateButtonEvents, L as getConfig, l as getMetaInfo, M as getSessionState, b as getBackendProtocol } from './utils-DK_Yhmpx.js';
|
|
6
|
+
import { H as Handlebars } from './index-VWr-8RG8.js';
|
|
7
7
|
import { a as setBotElement } from './global-store-odmyXuxx.js';
|
|
8
|
-
import { e as executeRecaptcha } from './reCaptchaHelpers-
|
|
8
|
+
import { e as executeRecaptcha } from './reCaptchaHelpers-DUpCzUFb.js';
|
|
9
9
|
import { i as initializeScript, g as getBotStateFromSession, b as getBotStateKey, p as processTemplateData, r as renderTemplateData, c as checkBusinessHours } from './botHelpers-B_moTKAE.js';
|
|
10
|
-
import { r as renderSurvey } from './surveyHelpers-
|
|
10
|
+
import { r as renderSurvey } from './surveyHelpers-D-00eWjv.js';
|
|
11
11
|
import { c as createScriptStyleLoader } from './scriptStyleLoader-DXBxSLgN.js';
|
|
12
|
-
import { D as DEFAULT_SHORTCUTS, w as waitForElementRender, h as handleEndResponse } from './keyboard-shortcuts-
|
|
13
|
-
import { f as filterConversationHistoryByProjectAndConfig, s as saveConversation } from './ctaHelpers-
|
|
12
|
+
import { D as DEFAULT_SHORTCUTS, w as waitForElementRender, h as handleEndResponse } from './keyboard-shortcuts-BhKv64FZ.js';
|
|
13
|
+
import { f as filterConversationHistoryByProjectAndConfig, s as saveConversation } from './ctaHelpers-DrH6S5iU.js';
|
|
14
14
|
import { a as setParentComponentState } from './app-store-DYN4CiXV.js';
|
|
15
|
-
import { e as ensureMessageId, p as parseArgsWithJson5 } from './parseHelper-
|
|
15
|
+
import { e as ensureMessageId, p as parseArgsWithJson5 } from './parseHelper-kOGOndOe.js';
|
|
16
16
|
import './_commonjsHelpers-Dj2_voLF.js';
|
|
17
17
|
|
|
18
18
|
// ILiveAgentProvider.ts
|
|
@@ -64,6 +64,67 @@ class SalesforceLiveAgentProvider {
|
|
|
64
64
|
this.configSettings = null;
|
|
65
65
|
this.sessionContext = null;
|
|
66
66
|
this.endpointSSE = "";
|
|
67
|
+
this.checkAgentAvailability = async (conversationId) => {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
this.availabilityAbort = new AbortController();
|
|
70
|
+
const { signal } = this.availabilityAbort;
|
|
71
|
+
// MIAW routing is async — poll until a RoutingResult entry appears or we time out.
|
|
72
|
+
const POLL_INTERVAL_MS = 1500;
|
|
73
|
+
const MAX_WAIT_MS = 20000;
|
|
74
|
+
const startTime = Date.now();
|
|
75
|
+
while (Date.now() - startTime < MAX_WAIT_MS) {
|
|
76
|
+
if (signal.aborted)
|
|
77
|
+
return false;
|
|
78
|
+
const availabilityRes = await fetch(`${(_a = this.configSettings) === null || _a === void 0 ? void 0 : _a.instanceUrl}/iamessage/api/v2/conversation/${conversationId}/entries`, {
|
|
79
|
+
method: "GET",
|
|
80
|
+
signal,
|
|
81
|
+
headers: {
|
|
82
|
+
"Content-Type": "application/json",
|
|
83
|
+
"Authorization": `Bearer ${(_b = this.sessionContext) === null || _b === void 0 ? void 0 : _b.accessToken}`,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
if (!availabilityRes.ok) {
|
|
87
|
+
logger.warn(`Agent availability check failed: ${availabilityRes.status} ${availabilityRes.statusText}`);
|
|
88
|
+
ChatEventBus.emit("AGENT_UNAVAILABLE", { reason: "request_error" });
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
const availabilityData = await availabilityRes.json();
|
|
92
|
+
logger.debug("Agent availability check result:", availabilityData);
|
|
93
|
+
const entries = (_c = availabilityData === null || availabilityData === void 0 ? void 0 : availabilityData.conversationEntries) !== null && _c !== void 0 ? _c : [];
|
|
94
|
+
const routingEntry = entries.find((e) => e.entryType === "RoutingResult");
|
|
95
|
+
if (routingEntry) {
|
|
96
|
+
// entryPayload may arrive as a JSON string — parse it if needed
|
|
97
|
+
let entryPayload = routingEntry.entryPayload;
|
|
98
|
+
if (typeof entryPayload === "string") {
|
|
99
|
+
try {
|
|
100
|
+
entryPayload = JSON.parse(entryPayload);
|
|
101
|
+
}
|
|
102
|
+
catch (_d) {
|
|
103
|
+
logger.warn("Failed to parse RoutingResult entryPayload");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const failureReason = entryPayload === null || entryPayload === void 0 ? void 0 : entryPayload.failureReason;
|
|
107
|
+
if (failureReason) {
|
|
108
|
+
logger.warn("Routing failed with reason:", failureReason);
|
|
109
|
+
ChatEventBus.emit("AGENT_UNAVAILABLE", { reason: failureReason });
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
logger.debug("Agent routed successfully");
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
// conversationEntries is empty — routing hasn't completed yet, retry
|
|
116
|
+
logger.debug(`No RoutingResult yet (entries: ${entries.length}), retrying in ${POLL_INTERVAL_MS}ms…`);
|
|
117
|
+
// await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS))
|
|
118
|
+
await new Promise((resolve, reject) => {
|
|
119
|
+
const t = setTimeout(resolve, POLL_INTERVAL_MS);
|
|
120
|
+
signal.addEventListener("abort", () => { clearTimeout(t); reject(); }, { once: true });
|
|
121
|
+
}).catch(() => null);
|
|
122
|
+
}
|
|
123
|
+
// Timed out — no routing result arrived within the window
|
|
124
|
+
logger.warn("Timed out waiting for MIAW routing result");
|
|
125
|
+
ChatEventBus.emit("AGENT_UNAVAILABLE", { reason: "timeout" });
|
|
126
|
+
return false;
|
|
127
|
+
};
|
|
67
128
|
this.configSettings = null;
|
|
68
129
|
this.sessionContext = null;
|
|
69
130
|
this.endpointSSE = getEndpoint(envMode);
|
|
@@ -175,8 +236,15 @@ class SalesforceLiveAgentProvider {
|
|
|
175
236
|
if (formatInitialMessages) {
|
|
176
237
|
this.sendMessage({ isNewSession: true, sessionId: ((_m = this.sessionContext) === null || _m === void 0 ? void 0 : _m.sessionId) || "", message: formatInitialMessages });
|
|
177
238
|
}
|
|
178
|
-
|
|
179
|
-
|
|
239
|
+
if (await this.checkAgentAvailability(this.sessionContext.conversationId || "")) {
|
|
240
|
+
logger.debug("Agent is available, starting to listen to messages");
|
|
241
|
+
this.listenToMessages();
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
// AGENT_UNAVAILABLE (with reason: failureReason | "timeout" | "request_error")
|
|
245
|
+
// was already emitted by checkAgentAvailability
|
|
246
|
+
logger.warn("No agent assigned — skipping SSE listener setup");
|
|
247
|
+
}
|
|
180
248
|
}
|
|
181
249
|
}
|
|
182
250
|
/**
|
|
@@ -609,13 +677,14 @@ class SalesforceLiveAgentProvider {
|
|
|
609
677
|
* It sends a POST request to the Salesforce MIAW API to close the conversation.
|
|
610
678
|
*/
|
|
611
679
|
async endChat(_sessionId) {
|
|
612
|
-
var _a, _b, _c, _d, _e;
|
|
680
|
+
var _a, _b, _c, _d, _e, _f;
|
|
681
|
+
(_a = this.availabilityAbort) === null || _a === void 0 ? void 0 : _a.abort();
|
|
613
682
|
// console.log("this.sessionContext?.conversationId", this.sessionContext?.conversationId)
|
|
614
|
-
if ((
|
|
615
|
-
const res = await fetch(`${(
|
|
683
|
+
if ((_b = this.sessionContext) === null || _b === void 0 ? void 0 : _b.conversationId) {
|
|
684
|
+
const res = await fetch(`${(_c = this.configSettings) === null || _c === void 0 ? void 0 : _c.instanceUrl}/iamessage/api/v2/conversation/${(_d = this.sessionContext) === null || _d === void 0 ? void 0 : _d.conversationId}?esDeveloperName=${(_e = this.configSettings) === null || _e === void 0 ? void 0 : _e.messagingChannelId}`, {
|
|
616
685
|
method: "DELETE",
|
|
617
686
|
headers: {
|
|
618
|
-
"Authorization": `Bearer ${(
|
|
687
|
+
"Authorization": `Bearer ${(_f = this.sessionContext) === null || _f === void 0 ? void 0 : _f.accessToken}`,
|
|
619
688
|
"Content-Type": "application/json",
|
|
620
689
|
},
|
|
621
690
|
});
|
|
@@ -1251,6 +1320,7 @@ const Ai12zBot = class {
|
|
|
1251
1320
|
if (currentDomElement) {
|
|
1252
1321
|
// Append the agent event messages to the current message bubble
|
|
1253
1322
|
currentDomElement.parentNode.appendChild(agentEventMessages);
|
|
1323
|
+
this.currentDomId = "";
|
|
1254
1324
|
return agentEventMessages;
|
|
1255
1325
|
}
|
|
1256
1326
|
}
|
|
@@ -1300,9 +1370,6 @@ const Ai12zBot = class {
|
|
|
1300
1370
|
this.agentEventHandler = event => {
|
|
1301
1371
|
this.isTypingIndicatorVisible = false;
|
|
1302
1372
|
if ((event === null || event === void 0 ? void 0 : event.length) > 0) {
|
|
1303
|
-
if (this.isLiveAgentEnabled && this.currentDomId === "") {
|
|
1304
|
-
this.currentDomId = this.messages[this.messages.length - 1].id;
|
|
1305
|
-
}
|
|
1306
1373
|
// Persist each system event into this.messages so they survive page reload
|
|
1307
1374
|
const systemMessages = event.map((evt) => ({
|
|
1308
1375
|
id: evt.id || `system-${generateUUID()}`,
|
|
@@ -1344,6 +1411,16 @@ const Ai12zBot = class {
|
|
|
1344
1411
|
this.isLiveAgent = true;
|
|
1345
1412
|
this.updateBotState();
|
|
1346
1413
|
};
|
|
1414
|
+
this.handleAgentUnavailable = () => {
|
|
1415
|
+
this.addEventMessage("Live Agent is currently unavailable. Please try again later.");
|
|
1416
|
+
this.isTypingIndicatorVisible = false;
|
|
1417
|
+
this.isLiveAgent = false;
|
|
1418
|
+
this.liveAgentSessionId = "";
|
|
1419
|
+
this.liveAgentConversationId = "";
|
|
1420
|
+
this.updateBotState();
|
|
1421
|
+
this.announce("Live agent is currently unavailable");
|
|
1422
|
+
this.clearEvents();
|
|
1423
|
+
};
|
|
1347
1424
|
this.toggleBot = _e => {
|
|
1348
1425
|
// e.stopPropagation()
|
|
1349
1426
|
this.isToggled = !this.isToggled;
|
|
@@ -2015,6 +2092,9 @@ const Ai12zBot = class {
|
|
|
2015
2092
|
this.socket.on(endEvent, async (rawData) => {
|
|
2016
2093
|
// For v2, adapt the response format to match legacy expectations
|
|
2017
2094
|
const data = protocol === "v2" ? adaptCompleteToLegacy(rawData) : rawData;
|
|
2095
|
+
if (data.showInput !== undefined && typeof data.showInput === "boolean") {
|
|
2096
|
+
this.botSettings.showInput = data.showInput;
|
|
2097
|
+
}
|
|
2018
2098
|
this.unreadCount++;
|
|
2019
2099
|
const { id, idChanged, orphaned } = ensureMessageId(this.currentDomId, this.messages, "chatbot");
|
|
2020
2100
|
this.currentDomId = id;
|
|
@@ -2498,7 +2578,9 @@ const Ai12zBot = class {
|
|
|
2498
2578
|
this.liveAgentSessionId = "";
|
|
2499
2579
|
this.liveAgentConversationId = "";
|
|
2500
2580
|
this.liveAgentButtonText = "Talk to a Live Agent";
|
|
2501
|
-
this.sendMessage(((_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.llmMessageOnDisconnect) !== ""
|
|
2581
|
+
this.sendMessage(((_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.llmMessageOnDisconnect) !== ""
|
|
2582
|
+
? (_b = this.botSettings) === null || _b === void 0 ? void 0 : _b.llmMessageOnDisconnect
|
|
2583
|
+
: "The live agent has been disconnected. Please do not initiate the live agent directive again.", ((_c = this.botSettings) === null || _c === void 0 ? void 0 : _c.userMessageOnDisconnect) !== "" ? (_d = this.botSettings) === null || _d === void 0 ? void 0 : _d.userMessageOnDisconnect : "The live agent has ended the conversation.", { isLiveChatEnded: true });
|
|
2502
2584
|
this.announce("Live agent chat ended");
|
|
2503
2585
|
this.clearEvents();
|
|
2504
2586
|
}
|
|
@@ -2519,6 +2601,7 @@ const Ai12zBot = class {
|
|
|
2519
2601
|
this.liveAgentListenersRegistered = true;
|
|
2520
2602
|
ChatEventBus.on("FINDING_AGENT", this.findingAgent);
|
|
2521
2603
|
ChatEventBus.on("AGENT_EVENT", this.agentEventHandler);
|
|
2604
|
+
ChatEventBus.on("AGENT_UNAVAILABLE", this.handleAgentUnavailable);
|
|
2522
2605
|
ChatEventBus.on("TYPING_STARTED", this.handleTypingStarted);
|
|
2523
2606
|
ChatEventBus.on("TYPING_STOPPED", this.handleTypingStopped);
|
|
2524
2607
|
ChatEventBus.on("AGENT_MESSAGE", this.agentMessageCreated);
|
|
@@ -2530,6 +2613,7 @@ const Ai12zBot = class {
|
|
|
2530
2613
|
this.liveAgentListenersRegistered = false;
|
|
2531
2614
|
ChatEventBus.off("FINDING_AGENT", this.findingAgent);
|
|
2532
2615
|
ChatEventBus.off("AGENT_EVENT", this.agentEventHandler);
|
|
2616
|
+
ChatEventBus.off("AGENT_UNAVAILABLE", this.handleAgentUnavailable);
|
|
2533
2617
|
ChatEventBus.off("AGENT_MESSAGE", this.agentMessageCreated);
|
|
2534
2618
|
ChatEventBus.off("AGENT_ERROR", this.handleAgentError);
|
|
2535
2619
|
ChatEventBus.off("CONVERSATION_CLOSED", this.handleAgentConversationEnded);
|
|
@@ -2740,7 +2824,7 @@ const Ai12zBot = class {
|
|
|
2740
2824
|
}
|
|
2741
2825
|
}
|
|
2742
2826
|
render() {
|
|
2743
|
-
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _w, _x, _y;
|
|
2827
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _w, _x, _y, _z;
|
|
2744
2828
|
if (!this.canRender) {
|
|
2745
2829
|
return (h(Host, null, h("span", { style: { display: "none" } }, "Failed to load ai12z bot control due to insufficient fund")));
|
|
2746
2830
|
}
|
|
@@ -2823,7 +2907,11 @@ const Ai12zBot = class {
|
|
|
2823
2907
|
"opacity-90": !this.isProse,
|
|
2824
2908
|
"max-w-full break-words @md:text-body2 box-border @md:pr-4 flex-1 rounded-lg text-gray-30 pr-2 text-body3": true,
|
|
2825
2909
|
}, innerHTML: message.text, id: message.id }, message.isLoading && (h("div", { class: "w-full rounded-md", id: "spinner" }, h("div", { class: "flex animate-pulse space-x-4" }, h("div", { class: "flex-1 space-y-3 py-1" }, h("div", { class: "h-4 rounded bg-gray-200" }), h("div", { class: "space-y-3" }, h("div", { class: "grid grid-cols-3 gap-4" }, h("div", { class: "col-span-2 h-4 rounded bg-gray-200" }), h("div", { class: "col-span-1 h-4 rounded bg-gray-200" })), h("div", { class: "h-4 rounded bg-gray-200" }))))))), message.text !== "" && message.showIcon && ((_c = this.botSettings.showMessageIcons) !== null && _c !== void 0 ? _c : true) && (h("interaction-buttons", { message: message, chatArray: this.messages, currentIndex: idx, dataKey: this.dataKey, dataMode: this.dataMode, voice: this.voice, voiceType: this.voiceType, source: "bot", conversationId: this.conversationId, projectId: ((_d = this.botSettings) === null || _d === void 0 ? void 0 : _d.pId) || "" })), h("div", { class: "text-gray-30 pt-2 text-body4" }, this.botSettings.botName, " \u2022 ", message.timestamp)))));
|
|
2826
|
-
}), this.showHistory && (h("chatbot-history", { chatList: this.conversationHistory, botName: (_s = this.botSettings) === null || _s === void 0 ? void 0 : _s.botName, styles: this.customStyle, scripts: this.customJS })), h("div", { class: "h-px pt-2px", style: { overflowAnchor: "auto" } })), h("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", class: "sr-only" }, this.announceMessage)))), h("form", { "data-testid": "user-input", class: `relative pointer-events-auto ${this.isOpened ? "p-2.5" : ""} searchform user-input`, "aria-label": "Message Area", "aria-hidden": "false", style: {
|
|
2910
|
+
}), this.showHistory && (h("chatbot-history", { chatList: this.conversationHistory, botName: (_s = this.botSettings) === null || _s === void 0 ? void 0 : _s.botName, styles: this.customStyle, scripts: this.customJS })), h("div", { class: "h-px pt-2px", style: { overflowAnchor: "auto" } })), h("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", class: "sr-only" }, this.announceMessage)))), ((_t = this.botSettings) === null || _t === void 0 ? void 0 : _t.showInput) !== false && (h("form", { "data-testid": "user-input", class: `relative pointer-events-auto ${this.isOpened ? "p-2.5" : ""} searchform user-input`, "aria-label": "Message Area", "aria-hidden": "false", style: {
|
|
2911
|
+
opacity: !this.isMinimized ? "1" : "0",
|
|
2912
|
+
transform: "translateX(0)",
|
|
2913
|
+
pointerEvents: !this.isMinimized ? "auto" : "none",
|
|
2914
|
+
} }, !this.isOpened && (h("div", { class: `absolute right-4 md:right-0 border-2 border-white border-solid rounded-full ${this.isContent ? "" : "top-0"} minimize-input` }, h("button", { class: "rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-gray-500 bg-opacity-60 hover:bg-opacity-80 h-5 w-5 bot-btn-primary", "aria-label": "Minimize Bot", tabindex: "0", onClick: e => {
|
|
2827
2915
|
e.preventDefault();
|
|
2828
2916
|
this.isMinimized = !this.isMinimized;
|
|
2829
2917
|
this.isOpened = !this.isMinimized;
|
|
@@ -2855,12 +2943,12 @@ const Ai12zBot = class {
|
|
|
2855
2943
|
.filter(Boolean)
|
|
2856
2944
|
.join(" "), "aria-placeholder": this.isLiveAgent
|
|
2857
2945
|
? "Type a message to the agent..."
|
|
2858
|
-
: ((
|
|
2859
|
-
? (
|
|
2946
|
+
: ((_u = this.botSettings) === null || _u === void 0 ? void 0 : _u.botPlaceholderText) !== ""
|
|
2947
|
+
? (_w = this.botSettings) === null || _w === void 0 ? void 0 : _w.botPlaceholderText
|
|
2860
2948
|
: "Ask me anything", "aria-label": "Type your message here", class: `resize-none overflow-hidden text-ellipsis focus:outline-none w-full custom-input ${this.hideAllButtons ? "hidden" : ""}`, "data-testid": "user-input-textarea", rows: this.rowCount, name: "userMessage", placeholder: this.isLiveAgent
|
|
2861
2949
|
? "Type a message to the agent..."
|
|
2862
|
-
: ((
|
|
2863
|
-
? (
|
|
2950
|
+
: ((_x = this.botSettings) === null || _x === void 0 ? void 0 : _x.botPlaceholderText) !== ""
|
|
2951
|
+
? (_y = this.botSettings) === null || _y === void 0 ? void 0 : _y.botPlaceholderText
|
|
2864
2952
|
: "Ask me anything", ref: el => (this.inputEl = el), onKeyUp: _e => {
|
|
2865
2953
|
this.adjustHeight();
|
|
2866
2954
|
}, onKeyDown: e => {
|
|
@@ -2912,7 +3000,7 @@ const Ai12zBot = class {
|
|
|
2912
3000
|
this.isOpened = true;
|
|
2913
3001
|
this.isContent = false;
|
|
2914
3002
|
this.handleSend(button.label);
|
|
2915
|
-
} }, button.label)))))))), h("div", {
|
|
3003
|
+
} }, button.label))))))))), h("div", {
|
|
2916
3004
|
// slot="bot"
|
|
2917
3005
|
class: "pointer-events-auto fixed right-7 whitespace-nowrap transition-transform duration-300 ease-in-out fab", style: {
|
|
2918
3006
|
opacity: this.isMinimized ? "1" : "0",
|
|
@@ -2922,8 +3010,8 @@ const Ai12zBot = class {
|
|
|
2922
3010
|
}, onClick: () => {
|
|
2923
3011
|
this.openChat();
|
|
2924
3012
|
}
|
|
2925
|
-
}, this.isBot && h("slot", { name: "bot" }), !this.isBot && (h("button", { class: "rounded-full flex cursor-pointer items-center pr-[14px] md:gap-x-3 focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-blue-focused bot-btn-primary", tabindex: "0", "aria-label": "open Bot" }, h("div", { class: "w-10 h-10 flex items-center justify-center bg-white rounded-full border relative" }, this.botSettings.botLaunchIcon && h("img", { src: this.botSettings.botLaunchIcon, alt: "bot icon", class: "w-8 h-8 rounded-lg" }), !this.botSettings.botLaunchIcon && (h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", stroke: "#2095ae", "aria-hidden": "true" }, h("g", { "stroke-width": "0" }), h("g", { "stroke-linecap": "round", "stroke-linejoin": "round" }), h("g", null, " ", h("path", { d: "M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z", stroke: "#2095ae", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), " ")))), h("span", { class: "bot-name" }, " ", (
|
|
2926
|
-
|
|
3013
|
+
}, this.isBot && h("slot", { name: "bot" }), !this.isBot && (h("button", { class: "rounded-full flex cursor-pointer items-center pr-[14px] md:gap-x-3 focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-blue-focused bot-btn-primary", tabindex: "0", "aria-label": "open Bot" }, h("div", { class: "w-10 h-10 flex items-center justify-center bg-white rounded-full border relative" }, this.botSettings.botLaunchIcon && h("img", { src: this.botSettings.botLaunchIcon, alt: "bot icon", class: "w-8 h-8 rounded-lg" }), !this.botSettings.botLaunchIcon && (h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", stroke: "#2095ae", "aria-hidden": "true" }, h("g", { "stroke-width": "0" }), h("g", { "stroke-linecap": "round", "stroke-linejoin": "round" }), h("g", null, " ", h("path", { d: "M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z", stroke: "#2095ae", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), " ")))), h("span", { class: "bot-name" }, " ", (_z = this.botSettings) === null || _z === void 0 ? void 0 :
|
|
3014
|
+
_z.botName, " ")))))), h("keyboard-shortcuts-dialog", { show: this.showShortcutsDialog, shortcuts: this.shortcuts, onCloseDialog: () => {
|
|
2927
3015
|
this.showShortcutsDialog = false;
|
|
2928
3016
|
} }), h("delete-confirmation-modal", { show: this.showLiveAgentEndDialog, dialogTitle: "End live agent chat?", message: "You are about to end the current live agent conversation. You can continue chatting with the bot after ending it.", confirmButtonText: "End", onConfirmDelete: () => {
|
|
2929
3017
|
this.confirmEndLiveAgent();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as registerInstance, h as h$1, F as Fragment, a as createEvent, d as getElement } from './index-BNpVu1WU.js';
|
|
2
2
|
import { S as SearchResult } from './SearchResult-zLaEhc3L.js';
|
|
3
|
-
import {
|
|
3
|
+
import { H as getSpeechToText } from './utils-DK_Yhmpx.js';
|
|
4
4
|
import { a as getAugmentedNamespace } from './_commonjsHelpers-Dj2_voLF.js';
|
|
5
5
|
import { g as getParentComponentState, s as setActiveParentComponent } from './app-store-DYN4CiXV.js';
|
|
6
|
-
import { g as getCountryByTimeZone, v as validateChinaTime } from './parseHelper-
|
|
7
|
-
import './ctaHelpers-
|
|
6
|
+
import { g as getCountryByTimeZone, v as validateChinaTime } from './parseHelper-kOGOndOe.js';
|
|
7
|
+
import './ctaHelpers-DrH6S5iU.js';
|
|
8
8
|
import './logger-DUcx64Gz.js';
|
|
9
9
|
|
|
10
10
|
const categoryCss = () => `ai12z-category{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-search-font-size, var(--ai12z-font-size)) !important}.custom-title{font-size:var(--ai12z-category-font-size);color:var(--ai12z-category-font-color)}`;
|