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.
Files changed (115) hide show
  1. package/dist/cjs/ai12z-bot.cjs.entry.js +107 -19
  2. package/dist/cjs/ai12z-chat-message.cjs.entry.js +17 -46
  3. package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +14 -60
  4. package/dist/cjs/index.cjs.js +1 -0
  5. package/dist/cjs/styleSheetRegistry-7aecMygn.js +175 -0
  6. package/dist/collection/components/ai12z-bot/ai12z-bot.js +32 -13
  7. package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +15 -61
  8. package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.js +16 -46
  9. package/dist/collection/utils/liveagents/providers/salesforce.js +75 -6
  10. package/dist/collection/utils/styleSheetRegistry.js +169 -0
  11. package/dist/components/ai12z-bot.js +1 -1
  12. package/dist/components/ai12z-chat-message.js +1 -1
  13. package/dist/components/ai12z-chat.js +1 -1
  14. package/dist/components/ai12z-container.js +1 -1
  15. package/dist/components/ai12z-cta.js +1 -1
  16. package/dist/components/ai12z-form.js +1 -1
  17. package/dist/components/ai12z-inline-search.js +1 -1
  18. package/dist/components/ai12z-input-form.js +1 -1
  19. package/dist/components/ai12z-knowledge-box.js +1 -1
  20. package/dist/components/ai12z-search-panel.js +1 -1
  21. package/dist/components/audio-recorder.js +1 -1
  22. package/dist/components/dynamic-form.js +1 -1
  23. package/dist/components/index.js +1 -1
  24. package/dist/components/interaction-buttons.js +1 -1
  25. package/dist/components/item-list.js +1 -1
  26. package/dist/components/{p-DKxaam7U.js → p-3j2aDKYq.js} +1 -1
  27. package/dist/components/{p-BP8ig03d.js → p-AQ1MS6Ps.js} +1 -1
  28. package/dist/components/p-B9IJbo4G.js +1 -0
  29. package/dist/components/{p-DsZWeAcM.js → p-BWMhH2R1.js} +1 -1
  30. package/dist/components/{p-5UYwpNzl.js → p-BaXs0IIw.js} +1 -1
  31. package/dist/components/{p-Gr6Q2s96.js → p-Bnj1LjUJ.js} +1 -1
  32. package/dist/components/p-BwpiW24r.js +1 -0
  33. package/dist/components/{p-Bo3Ig8oX.js → p-BwqXbNCx.js} +1 -1
  34. package/dist/components/{p-D2nUK4Pa.js → p-COqFEHJ7.js} +1 -1
  35. package/dist/components/{p-DA32xa7d.js → p-Ci85xHWQ.js} +1 -1
  36. package/dist/components/{p-DUaZgAhA.js → p-CrfXJRIo.js} +1 -1
  37. package/dist/components/{p-DJ68HDol.js → p-DkRAkHLI.js} +2 -2
  38. package/dist/components/{p-ha1wIlZ-.js → p-Dubjoiw6.js} +1 -1
  39. package/dist/components/{p-C2wKkcYa.js → p-DvtUY5FW.js} +1 -1
  40. package/dist/components/{p-J--erGbY.js → p-dQEvevXk.js} +1 -1
  41. package/dist/{library/p-DAGa-uHD.js → components/p-g36mIk7k.js} +1 -1
  42. package/dist/components/p-m0Ed3g6I.js +1 -0
  43. package/dist/components/p-mBjDeFh_.js +1 -0
  44. package/dist/components/{p-q7YWDP9B.js → p-pOVc-eI8.js} +1 -1
  45. package/dist/components/{p-BCJzelr9.js → p-qwKoi5kn.js} +1 -1
  46. package/dist/components/{p-CKAp10SJ.js → p-xTOLReQF.js} +1 -1
  47. package/dist/components/privacy-modal.js +1 -1
  48. package/dist/components/search-results-page.js +1 -1
  49. package/dist/esm/ai12z-bot.entry.js +115 -27
  50. package/dist/esm/ai12z-category_2.entry.js +3 -3
  51. package/dist/esm/ai12z-chat-message.entry.js +17 -46
  52. package/dist/esm/ai12z-chat_2.entry.js +8 -8
  53. package/dist/esm/ai12z-container.entry.js +3 -3
  54. package/dist/esm/ai12z-cta.entry.js +4 -4
  55. package/dist/esm/ai12z-form.entry.js +2 -2
  56. package/dist/esm/ai12z-inline-search.entry.js +2 -2
  57. package/dist/esm/ai12z-knowledge-box.entry.js +18 -64
  58. package/dist/esm/ai12z-search-panel.entry.js +1 -1
  59. package/dist/esm/chat-avatar_6.entry.js +1 -1
  60. package/dist/esm/{ctaHelpers-BhM8KbEY.js → ctaHelpers-DrH6S5iU.js} +1 -1
  61. package/dist/esm/dynamic-form.entry.js +1 -1
  62. package/dist/esm/{index-BQKLwW-C.js → index-VWr-8RG8.js} +1 -1
  63. package/dist/esm/index.js +10 -9
  64. package/dist/esm/item-list.entry.js +2 -2
  65. package/dist/esm/{keyboard-shortcuts-Bd3LDe9j.js → keyboard-shortcuts-BhKv64FZ.js} +2 -2
  66. package/dist/esm/{parseHelper-9rP0JS7J.js → parseHelper-kOGOndOe.js} +1 -1
  67. package/dist/esm/{processCarouselData-Bf2pDFsV.js → processCarouselData-DX152a4X.js} +1 -1
  68. package/dist/esm/{reCaptchaHelpers-CUcgfdqX.js → reCaptchaHelpers-DUpCzUFb.js} +1 -1
  69. package/dist/esm/search-results-page.entry.js +4 -4
  70. package/dist/esm/{socket-service-B1OMbkCM.js → socket-service-D_h5x8Gr.js} +1 -1
  71. package/dist/esm/styleSheetRegistry-Bfi9VkqK.js +172 -0
  72. package/dist/esm/{surveyHelpers-CvrZlir1.js → surveyHelpers-D-00eWjv.js} +1 -1
  73. package/dist/esm/{utils-BTLjNTwP.js → utils-DK_Yhmpx.js} +1 -1
  74. package/dist/library/index.esm.js +1 -1
  75. package/dist/library/library.esm.js +1 -1
  76. package/dist/library/{p-cd764f70.entry.js → p-11c1f91d.entry.js} +1 -1
  77. package/dist/library/{p-806bfb3d.entry.js → p-1d382046.entry.js} +1 -1
  78. package/dist/library/{p-0641ba91.entry.js → p-252bb713.entry.js} +2 -2
  79. package/dist/library/p-25a678ca.entry.js +1 -0
  80. package/dist/library/p-53edf210.entry.js +1 -0
  81. package/dist/library/p-646a7eae.entry.js +1 -0
  82. package/dist/library/p-675d0243.entry.js +1 -0
  83. package/dist/library/{p-60d5d99f.entry.js → p-6ea05db1.entry.js} +1 -1
  84. package/dist/library/{p-7f0e306c.entry.js → p-7154a204.entry.js} +1 -1
  85. package/dist/library/{p-07f11cb8.entry.js → p-72a5eaf2.entry.js} +1 -1
  86. package/dist/library/{p-2d262192.entry.js → p-8f238b3f.entry.js} +1 -1
  87. package/dist/library/p-9cffb6fa.entry.js +1 -0
  88. package/dist/library/{p-y3Go1NSi.js → p-BCkDiHIY.js} +1 -1
  89. package/dist/{components/p-BhV62IFF.js → library/p-By1gJKXA.js} +1 -1
  90. package/dist/library/{p-Bbow4UZX.js → p-C0wNDqKO.js} +1 -1
  91. package/dist/library/p-C3yxqbFh.js +1 -0
  92. package/dist/library/p-CwZwG6gL.js +1 -0
  93. package/dist/library/{p-D5m1leH0.js → p-D1IPrgJe.js} +3 -3
  94. package/dist/library/{p-NAKC5NP9.js → p-KSKiM1sy.js} +1 -1
  95. package/dist/library/{p-C1eU4fpM.js → p-TJuczvVq.js} +1 -1
  96. package/dist/library/{p-CnadO0kA.js → p-ZyOWOLs5.js} +1 -1
  97. package/dist/library/{p-94bf0c7f.entry.js → p-cbfc9f73.entry.js} +1 -1
  98. package/dist/library/{p-014d5664.entry.js → p-d8506e43.entry.js} +1 -1
  99. package/dist/library/{p-BZ_koFpE.js → p-n8ydBHE4.js} +1 -1
  100. package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +1 -0
  101. package/dist/types/components/ai12z-knowledge-box/ai12z-knowledge-box.d.ts +0 -3
  102. package/dist/types/components/ai12z-knowledge-box/components/ai12z-chat-message.d.ts +0 -2
  103. package/dist/types/utils/liveagents/providers/salesforce.d.ts +2 -0
  104. package/dist/types/utils/styleSheetRegistry.d.ts +40 -0
  105. package/package.json +2 -2
  106. package/dist/components/p-B3lv_O-6.js +0 -1
  107. package/dist/components/p-CLdlCTTp.js +0 -1
  108. package/dist/components/p-DT0Uarfg.js +0 -1
  109. package/dist/components/p-zVXADzTq.js +0 -1
  110. package/dist/library/p-29cd4edc.entry.js +0 -1
  111. package/dist/library/p-6f3727d3.entry.js +0 -1
  112. package/dist/library/p-83a71da9.entry.js +0 -1
  113. package/dist/library/p-DoBD_KPG.js +0 -1
  114. package/dist/library/p-d3a2acee.entry.js +0 -1
  115. package/dist/library/p-dc131a5c.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as t,a as i,E as e,h as s,d as o}from"./p-BNpVu1WU.js";import{s as a,p as r}from"./p-DoBD_KPG.js";import{e as n,p as l}from"./p-CnadO0kA.js";import{u as c,e as h,k as d,j as u,l as p,m as b}from"./p-y3Go1NSi.js";import{s as f}from"./p-C1eU4fpM.js";import{H as v}from"./p-D5m1leH0.js";import{S as m}from"./p-BZ_koFpE.js";import{r as g}from"./p-DAGa-uHD.js";import{w,h as y,D as x}from"./p-NAKC5NP9.js";import{t as k,g as C}from"./p-ChFVg77w.js";import{l as z,a as M}from"./p-B_moTKAE.js";import"./p-Dj2_voLF.js";import"./p-8-Jaom_c.js";import"./p-SyQT2Pr3.js";const S=class{constructor(e){t(this,e),this.feedback=i(this,"feedback",7),this.survey=i(this,"survey",7),this.stateChanged=i(this,"stateChanged",7),this.messageReceived=i(this,"messageReceived",7),this.formSubmitted=i(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,a,r;const n=`ai-message-${this.generateUUID()}`,l=this.generateUUID();let c={message:i,type:"ai",status:"success",insightId:t.insightId,id:n,thumbsId:l,controlType:null!==(r=null===(a=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===a?void 0:a.type)&&void 0!==r?r:""};return this.survey.emit({results:c,type:"carousel"}),c},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 r=e.makeHtml(o);const n=document.getElementById("spinner");n&&(n.style.display="none"),s.innerHTML=r,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}}),k("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}}),k("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 w(`#${t.id}`,this.element);i.querySelector(`#${t.surveyDomId}`)||await w(`#${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=c(t.text,this.target||"_blank","ai12z-cta-link",null===(e=this.settings)||void 0===e?void 0:e.utm,"answer");const i=h(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}=n(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 g({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}=n(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 a={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 y({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:a}),this.conversationId=t.detail.conversationId,f(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-C3lNE7QP.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,a;switch(t){case"carousel":return i=1,o=this.itemList,a={paginatedItems:o,isFirstSlide:0===this.currentSlide,isLastSlide:this.currentSlide===this.itemList.length-1,transform:`-${100*this.currentSlide}%`,currentSlide:this.currentSlide},{context:a,end:s};case"list":return i=5,e=this.currentPage*i,s=e+i,o=this.itemList.slice(e,s),a={items:o,hasPrev:this.currentPage>0,hasNext:s<this.itemList.length},{context:a,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 a=e.target.getAttribute("data-id"),r=e.target.getAttribute("data-type"),n=e.target.getAttribute("data-url");if("panel"===r){const r=v.compile(i[Number(a)+1].content),n=this.element.shadowRoot.querySelectorAll(".carousel-card"),l=e.target.closest(".carousel-card").getAttribute("data-index");n[l].innerHTML=r({form:null===(s=t.items[l].panels[Number(a)])||void 0===s?void 0:s.form,formSettings:t.formSettings,buttons:null===(o=t.items[l].panels[Number(a)])||void 0===o?void 0:o.buttons}),this.addEventforPanel(i,t)}"url"===r&&window.open(n,"_blank")}))}))}async processTemplateData(t,i,e){this.currentChatData=t,await this.waitForElementRender(`#${t.id}`).then((async()=>{var s,o,a,r,n;this.hideSpinner(t);const l=this.element.shadowRoot.querySelector(`#${t.id}`);let c;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%",c=v.compile(null===(a=this.currentTemplate[0])||void 0===a?void 0:a.content),"list"===this.currentResponse.process)l.innerHTML=c(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=c(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===(r=i.controlData)||void 0===r?void 0:r.styles,s=null===(n=i.controlData)||void 0===n?void 0:n.Scripts;e&&z(e,this.element.shadowRoot),l.innerHTML=c({msgId:`${t.id}`,source:this.currentResponse,llm:i.controlData.data.llm}),s&&M(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 t,i,s,o,a,r;let n=null===(t=this.socketIn)||void 0===t?void 0:t.getSocketId();if(!n)return void console.error("Socket ID not available");let l=m.getInstanceById(n);if(!l){console.warn(`No socket service found for socket ID: ${n}, attempting to wait for connection...`);try{await this.socketIn.waitForConnection(),n=this.socketIn.getSocketId(),l=m.getInstanceById(n)}catch(t){console.error("Failed to wait for connection:",t)}}if(!l){console.warn("Creating new socket service...");try{const t=m.createInstance(this.env,null!==(i=this.apiKey)&&void 0!==i?i:e.DATA_KEY);if(await t.waitForConnection(),this.socketIn=t,n=t.getSocketId(),l=m.getInstanceById(n),!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 c=l.getSocket();if(!c)return void console.error("Socket not available from service");let h,p;"v2"===l.getProtocol()?(p="query",h={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}):(p="evaluate_query",h={apiKey:null!==(o=this.apiKey)&&void 0!==o?o:e.DATA_KEY,query:this.query,conversationId:null!==(a=this.conversationId)&&void 0!==a?a:"",base64Images:(null===(r=this.imgFiles)||void 0===r?void 0:r.length)>0?this.imgFiles:[],event:"evaluate_query",attributes:this.dataAttributes,excludeTags:this.chatExcludeTags,includeTags:this.chatIncludeTags,meta:d()}),c.emit(p,h,(t=>{t&&(console.error("Error occurred while evaluating query:",t),this.aiMessageId=`chatbot-${u()}`,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],a=i.includes(".")?i.split(".").pop():i;e.addEventListener("click",(()=>{try{switch(a){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=l(o);if(!i)return;this.survey.emit({results:i,type:"sendMessage"});break;case"sendJSON":case"ai12zCtrl.sendJSON":const e=l(o);if(!e)return;this.survey.emit({results:e,type:"sendJSON"})}}catch(t){console.error(`Error invoking ${i}:`,t)}}))}}}))}stopStreamInputHandler(t){this.socketIn&&m.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-C3lNE7QP.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(t){var i,s;if("default"===this.voiceType)if("speechSynthesis"in window){const i=window.speechSynthesis.getVoices().find((t=>t.name===this.voice));this.isPlayed=!0;const e=new SpeechSynthesisUtterance(t);e.lang="en-US",e.rate=1,e.pitch=1,e.voice=i,window.speechSynthesis.speak(e)}else alert("Speech Synthesis API is not supported in your browser.");if("google"===this.voiceType){const o=await p(null!==(i=this.apiKey)&&void 0!==i?i:e.DATA_KEY,null!==(s=this.env)&&void 0!==s?s:e.DATA_MODE,t,this.voice),a=this.base64ToBlob(o.audio_content,"audio/mpeg"),r=URL.createObjectURL(a);this.audioElement=new Audio(r),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 s("div",{key:"567d1598d53db83ebb453da3fcd6227ee5fe5bc0"},s("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,o,a,r,n;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 s("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&&s("div",{class:"chat-inner-list default-avatar"},!this.avatarUrl&&s("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")},s("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&&s("div",{class:"avatar-container "+(l?"md:block":"opacity-0")},s("img",{src:this.avatarUrl,alt:"Avatar",class:"avatar-image w-8 h-8 rounded-full"}))),"pending"===t.status&&s("div",{class:"pending-chat"},s("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"},s("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),s("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"}))),s("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)&&s("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===(o=t.formModel)||void 0===o?void 0:o.hasOwnProperty("answer"),"non-pending-user":!0},id:t.id,innerHTML:t.message},null===(a=null==t?void 0:t.images)||void 0===a?void 0:a.map((t=>s("img",{src:t,class:"thumbnail",alt:"thumbnail",width:"70",height:"50"}))),"user"!==t.type&&s("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"},s("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),s("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===(r=this.settings.showMessageIcons)||void 0===r||r)&&!t.surveyDomId&&s("div",{class:"non-user-container",style:{display:"none"}},this.isPlayed&&s("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)}},s("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-md-heavy"},s("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&&s("button",{class:"copy-btn",onClick:()=>this.speakText(this.removeHtmlTags(t.clipboard)),"aria-label":"Play",tabindex:"0"},s("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("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"}))),s("button",{class:"copy-btn",onClick:()=>this.copyToClipboard(t.clipboard),"aria-label":"Copy to Clipboard",tabindex:"0"},!this.copied&&s("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("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&&s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6"},s("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"}))),s("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:C(this.chats,t.insightId)||""}),class:"chat-thumbs-up","aria-label":"Thumbs Up",tabindex:"0"},s("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"},s("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"}))),s("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:C(this.chats,t.insightId)||""}),class:"chat-thumbs-up","aria-label":"Thumbs Down",tabindex:"0"},s("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"},s("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"}))),s("button",{class:"copy-btn",tabindex:"0","aria-label":"Send Email"},s("a",{href:`mailto:?subject=${encodeURIComponent(null===(n=this.chats[i-1])||void 0===n?void 0:n.message)}&body=${encodeURIComponent(this.removeHtmlTags(t.clipboard))}`,target:"_blank","aria-label":"Send Email"},s("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"},s("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"})," "))))))})),s("div",{key:"ead0c342309de4030cb69954fe585eb2fc06870f",class:"scroll-bottom"})))}get element(){return o(this)}static get watchers(){return{chats:[{watchHandler:0}]}}};S.style=":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}";const $=class{constructor(e){t(this,e),this.action=i(this,"action",7),this.capturedImgUpload=i(this,"capturedImgUpload",7),this.instanceId=`input-${u()}`,this.imagesBase64List=[],this.showShortcutsDialog=!1,this.shortcuts=x,this.componentType="search",this.chatLength=0,this.searchInput="",this.submitted=!1,this.showErrorMessage=!1,this.hideAllButtons=!1,this.isOpen=!1,this.capturedFile=null,this.errorMessage="You can upload a maximum of 10 images once at a time.",this.emptyMessageError=!1,this.announceMessage="",this.adjustHeight=()=>{this.searchInputElem.style.height="auto",this.searchInputElem.style.height=this.searchInputElem.scrollHeight+"px"},this.handleInputChange=t=>{if(this.searchInput=this.searchInputElem.value,this.isChat)return;const i=this.searchInputElem.value;i.length>3&&!this.isChat&&this.action.emit({event:t,value:i,type:"search",imgFiles:this.imagesBase64List})},this.handleClickOutside=t=>{this.isOpen&&this.menuElem&&!this.menuElem.contains(t.target)&&(this.isOpen=!1)},this.handleFormSubmit=t=>{t.preventDefault(),this.searchInput.length>3&&this.action.emit({event:t,value:this.searchInputElem.value,type:"search"})},this.handleKeyDown=t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),""!==this.searchInputElem.value.trim()||this.imagesBase64List.length>0?this.handleAskAI(t):0===this.imagesBase64List.length&&""===this.searchInputElem.value.trim()&&(this.emptyMessageError=!0,this.searchInputElem.focus(),setTimeout((()=>{this.emptyMessageError=!1}),3e3)))},this.handleFollowUp=t=>{this.action.emit({event:t,value:this.searchInputElem.value,imgFiles:this.imagesBase64List,type:"follow-up",followUp:!1})},this.handleRecentChat=t=>{this.action.emit({event:t,value:this.searchInputElem.value,type:"history"})},this.handleAskAI=t=>{var i,e;if(t.preventDefault(),""===this.searchInputElem.value.trim()&&0===this.imagesBase64List.length)return this.emptyMessageError=!0,this.searchInputElem.focus(),void setTimeout((()=>{this.emptyMessageError=!1}),3e3);this.submitted=!0,this.showErrorMessage=!1,this.emptyMessageError=!1,this.announce("Message sent successfully"),this.tempValue=this.searchInputElem.value,this.searchInputElem.value="";const s=this.imagesBase64List;this.imagesBase64List=[],this.action.emit({event:t,value:this.tempValue,imgFiles:s,followUp:null!==(e=null===(i=this.followUpElem)||void 0===i?void 0:i.checked)&&void 0!==e&&e,type:"ask-ai"})},this.handleImageChange=t=>{this.imagesBase64List=t.detail,this.showErrorMessage=!1},this.handleImageError=t=>{this.errorMessage=t.detail,this.showErrorMessage=!0},this.toggleBox=t=>{t.stopPropagation(),this.isOpen=!this.isOpen},this.handlePaste=t=>{var i;t.preventDefault();const e=(null===(i=t.clipboardData)||void 0===i?void 0:i.getData("text"))||"";if(this.searchInputElem&&e){const t=this.searchInputElem,i=t.selectionStart,s=t.selectionEnd,o=t.value,a=o.substring(0,i)+e+o.substring(s);t.value=a;const r=i+e.length;t.setSelectionRange(r,r),setTimeout((()=>{this.adjustHeight()}),0)}}}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside)}componentDidLoad(){this.isImageUpload&&document.addEventListener("click",this.handleClickOutside)}stateChangedHandler(t){if(this.submitted=!1,this.isChat){this.searchInputElem.value="",this.searchInput="";const t=this.el.querySelector(`#previewContainer-${this.instanceId}`);this.el.querySelector(`#searchInput-${this.instanceId}`).style.overflow="hidden",t&&(t.innerHTML=""),this.imagesBase64List=[]}}clearInputHandler(t){this.submitted=!1,this.searchInput="";const i=this.el.querySelector(`#previewContainer-${this.instanceId}`);i&&(i.innerHTML=""),this.imagesBase64List=[],this.searchInputElem.style.height="auto"}announce(t){this.announceMessage=t,setTimeout((()=>{this.announceMessage=""}),1e3)}async captureScreen(){try{const t=await navigator.mediaDevices.getDisplayMedia({video:!0}),i=document.createElement("video");i.srcObject=t,i.autoplay=!0,document.body.appendChild(i),await new Promise((t=>i.onloadedmetadata=t)),await new Promise((t=>setTimeout(t,500)));const e=document.createElement("canvas");e.width=i.videoWidth,e.height=i.videoHeight;const s=e.getContext("2d");s&&(s.drawImage(i,0,0,e.width,e.height),e.toBlob((t=>{if(t){const i=new File([t],`screenshot-${Date.now()}.png`,{type:"image/png"});this.capturedFile=i,this.capturedImgUpload.emit([i])}}),"image/png")),t.getTracks().forEach((t=>t.stop())),document.body.removeChild(i)}catch(t){console.error("Error capturing screen:",t)}}render(){return s("div",{key:"623f7b93a8fee68a98ffe0d15fe49232c928d541"},s("div",{key:"33fa75b886a6d845785ab7ad4be2cba4437deead",class:"absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10\n "+(this.isOpen?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-90 pointer-events-none"),ref:t=>this.menuElem=t},s("ul",{key:"c7a41dcf7bbb7d3b52d3adac6f7871553d082a97",class:"space-y-2"},this.isImageUpload&&s("li",{key:"4efc17c2a136caf0b8bfc2fba39622a1bab801c9",class:"px-4 py-2 hover:bg-gray-100 cursor-pointer flex"},s("image-uploader",{key:"8c669dda8dd81f4a24da8232938bbd6cae65ad7f",maxImages:10,images:this.imagesBase64List,targetElement:this.searchInputElem,onImagesChange:this.handleImageChange,onError:this.handleImageError,ref:t=>this.imageUploaderRef=t})),s("li",{key:"5fc6b84028c421a57c9b4c3ed36a1b19c6833546",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex",onClick:t=>{this.captureScreen(),this.toggleBox(t)}},s("div",{key:"20cd5b58b14938dde41c3ec82a4d204ddaebea4d",class:"mr-1 mt-px"},s("svg",{key:"c740a9f51839e41055786d23fd7b4ed44ed29324",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"20",height:"20"},s("path",{key:"f8516209c60f8478b6b6e510ceff2ec0a6fb57cd",d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),s("path",{key:"8c59bd0faf944dedc4b311cf6c7403e4e8c79689","fill-rule":"evenodd",d:"M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"}))),s("div",{key:"e10bf86ebd212649837dfad5094d9f39c0555af4"},"Capture")),s("li",{key:"d2b7a298b838ed7259019e26f211a09d69f328b5",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex","aria-label":"Start Over","aria-disabled":0===this.chatLength,style:{opacity:0===this.chatLength?"0.5":"1",cursor:0===this.chatLength?"not-allowed":"pointer"},onClick:t=>{0!==this.chatLength&&(this.handleFollowUp(t),this.toggleBox(t))}},s("div",{key:"95729576e7131a1bcde5edf2f00704e3979f0168",class:"mr-1 mt-px"},s("svg",{key:"aca3169ad3c1933750e6e70156ff3aafa9cb700e",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{key:"f09ce7b4c487d62f744ab255274120d648cebd0c",d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"}))),s("div",{key:"22838c5639850ca1520b5859188cd0cc7f62ae78"},"Start Over")),s("li",{key:"0625819dc4f37253f68674ae2f41169abd7249d3",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex","aria-label":"View Recent Chat",onClick:t=>{this.handleRecentChat(t)}},s("div",{key:"1bd82e7a2f97481c5215af8b5d67ec71d2c69719",class:"mr-1 mt-px"},s("svg",{key:"1a88182d117cadac2c5c491578533860b008cf75",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{key:"1e75ddfc584d70d0ada8008463ea08d8d0ac6623",d:"M21 15a4 4 0 0 1-4 4H7l-4 4V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"}),s("path",{key:"d1db69ed6ae7f982b1839204e52a90c32630f1fb",d:"M12 7v5l3 2"}))),s("div",{key:"813b01482c85e7b63908facb41c4a48f226ecd3b"},"View Recent Chat")))),s("form",{key:"b810bd80536347059124d3827e26502e03a97092",class:"w-full flex flex-col gap-1.5 sticky",onSubmit:this.handleFormSubmit},s("div",{key:"f69b95ec734d662c3e88cdc93aa15f8983f380a7",class:"flex-1 flex flex-col relative w-full rounded-3xl px-1 "+("inline"===this.componentType?"inline-searchbar-bgcolor":"searchbar-bgcolor"),dir:"LTR",ref:t=>this.searchFormElem=t},s("div",{key:"c64d576d4675e5993fcecde579f4a992da296a3f",class:"flex items-center"},s("div",{key:"e41c8a31a3775a409810f12f856dd6bb5113b67d",class:"ml-1 self-center flex space-x-1"},!this.hideAllButtons&&s("div",{key:"7614880c9a53a7e99ead7090637185b996b7cc2e",class:"relative inline-block",style:{width:"5%"}},s("button",{key:"edfcedc1fe6e77f2da4d26a60aad3748683ca6ef",class:"plus-icon","aria-label":"Options",title:"Add images or capture screen",tabindex:"0",onClick:t=>{t.stopPropagation(),this.toggleBox(t)}},s("svg",{key:"123d73fdd31ea56f503df593818a05f5574c6fdb",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20"},s("path",{key:"cded16c28c1421bc4c9d4b9f18af6411309a22ba",d:"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"}))))),!this.hideAllButtons&&s("div",{key:"9b0213ad6586daecb71c46941b17108f13c58048",class:"scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto"},s("div",{key:"619ef140b69574f9b5f6b56d3d7dc8355163fbc1",class:"relative w-full min-w-full h-full min-h-fit flex items-center input-prose"},s("div",{key:"a972c24cc5748376eedced77c91dffd331054293",id:`previewContainer-${this.instanceId}`,draggable:!0}),s("label",{key:"b515979270ffdbf8024951c04a826888539a0e64",htmlFor:`searchInput-${this.instanceId}`,class:"sr-only"},"Your message"),s("textarea",{key:"32123cab1fb36680b6e62a53e975988434721974",readOnly:this.submitted,"aria-describedby":this.emptyMessageError?`message-error-${this.instanceId} search-hint-${this.instanceId}`:`search-hint-${this.instanceId}`,"aria-invalid":this.emptyMessageError,id:`searchInput-${this.instanceId}`,ref:t=>{this.searchInputElem=t,null==t||t.focus()},placeholder:this.placeholder,autoComplete:"off",class:"w-full p-1 custom-input",value:this.searchInput,rows:1,onInput:b((t=>this.handleInputChange(t)),500),onKeyUp:this.adjustHeight,onKeyDown:this.handleKeyDown,onFocus:()=>this.searchFormElem.classList.add("input-focus-color"),onBlur:()=>this.searchFormElem.classList.remove("input-focus-color"),onPaste:t=>{this.handlePaste(t)}}),s("div",{key:"4ced8688e0edac2ed1f8a30ea7c0e1099b09e331",role:"status","aria-live":"polite","aria-atomic":"true",class:"sr-only"},this.announceMessage),s("span",{key:"114b87fb5a67f955503a87624e402722cad00276",class:"sr-only"},"Press Enter to send, Shift+Enter for new line"))),s("div",{key:"d9ce04f9657eba2ed56116f3e51ceba84f518052",class:"p-1 self-end flex space-x-1 flex-row",style:{width:this.hideAllButtons?"100%":"auto"}},s("div",{key:"a4752b743e10f5c90e0c7d03192d64e6ba8d2c08","aria-label":"Record voice",class:"flex self-center",style:{width:this.hideAllButtons?"100%":"auto"}},this.isEnableMic&&s("audio-recorder",{key:"e195ba053e5aeb6d017bccf44c01a3a6df2a684c","component-type":"cta",onStartRecord:()=>{this.hideAllButtons=!0},onStopRecord:()=>{this.hideAllButtons=!1},onSendTranscript:t=>{setTimeout((()=>{this.searchInputElem&&(this.searchInputElem.value=t.detail,this.searchInputElem.focus(),requestAnimationFrame((()=>{this.adjustHeight()})))}),1e3)},style:{width:"100%"}}))," ",!this.hideAllButtons&&s("div",{key:"bd7cbc198fbeb575c0105f686683ff0b0a7cd078",class:"flex items-center"},s("div",{key:"50b9e47852a3830eb9fbf0915d75d994924990fd","aria-label":"Send message",class:"flex"},s("button",{key:"15299d903700edfebc1a7084940e2fd6100ccce3",id:`send-message-button-${this.instanceId}`,class:"btn-bg-color text-white transition rounded-full p-1.5 self-center",disabled:this.submitted,onClick:this.handleAskAI,tabindex:"0","aria-label":"Send Message",title:"Send Message"},s("svg",{key:"f27771c390def50b54ec73c295d2c29f4193fafb",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",class:"size-6"},s("path",{key:"c1c893815c40e536537c0c9f1e486666ad2bb0c9","fill-rule":"evenodd",d:"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z","clip-rule":"evenodd"}))))))),this.imagesBase64List.length>0&&s("div",{key:"3f67411ac3c2f9decf28c5e73767c587744619a5",class:"flex flex-wrap gap-2 mx-1 mt-2.5 mb-1"},this.imagesBase64List.map(((t,i)=>s("div",{class:"image-Container sc-ai12z-input-form",key:i},s("img",{src:t,style:{width:"70px",height:"50px",borderRadius:".75rem"}}),s("span",{class:"delete-image sc-ai12z-input-form cursor-pointer ml-1",onClick:()=>{this.imagesBase64List=this.imagesBase64List.filter(((t,e)=>e!==i)),this.imageUploaderRef&&"function"==typeof this.imageUploaderRef.removeImageAtIndex&&this.imageUploaderRef.removeImageAtIndex(i)}},"×")))))),this.showErrorMessage&&s("div",{key:"868075f816f1704f7a033e44c58b457d3221773d",class:"flex"}," ",s("p",{key:"b3f13d96e369071675db049057032c5e2df64e97",class:"error-msg",innerHTML:this.errorMessage})),this.emptyMessageError&&s("div",{key:"bdda68e0bdf5067c5c188a33652925453afde468",class:"flex"},s("p",{key:"bc9f69e378e0b6ad52f9c4420c6db64343ea3be2",id:`message-error-${this.instanceId}`,class:"error-msg",role:"alert"},"Message cannot be empty. Please enter a message to send.")),0===this.chatLength&&s("div",{key:"5927e7b9968e6dc33cf3f6f4a61c3d3a5e2c86a0",class:"enter-tip",role:"tooltip"},"Tip: Press Enter to send, Shift+Enter for new line"," ",s("button",{key:"b6cc8c60952881f38a68913949f63647e4dedd3f",onClick:()=>this.showShortcutsDialog=!0,class:"keyboard-shortcuts-btn","aria-label":"Show keyboard shortcuts",title:"Keyboard shortcuts (?)",tabindex:"0"},s("svg",{key:"a1330e6d41582e0af855b76a463eb4d5ba5b1c14",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("circle",{key:"c1e6d8628ad15d82d90d686e7f1608c0b0a1b65d",cx:"12",cy:"12",r:"10"}),s("path",{key:"a339edfb79c587493f9935e19ac3db6439906d11",d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),s("line",{key:"9a5a90516a6dbaef064ad268712ada0ba9877d4f",x1:"12",y1:"17",x2:"12.01",y2:"17"}))))),this.showShortcutsDialog&&s("keyboard-shortcuts-dialog",{key:"6f92ef187ba852baf48a50418028ed36ab6ce8dd",show:this.showShortcutsDialog,shortcuts:this.shortcuts,onCloseDialog:()=>this.showShortcutsDialog=!1}))}get el(){return o(this)}};$.style=":host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important}.input-form{display:flex;flex-direction:column;width:100%;margin-bottom:1rem}.input-container{margin-right:1rem;position:relative;border-radius:4rem;border-width:1px;align-items:stretch;display:flex;}.inner-container{flex-grow:1;padding:0.75rem}.custom-input{color:black;border-width:0;max-height:300px;resize:none;overflow:hidden;background-color:inherit}.custom-input::-moz-placeholder{color:var(--ai12z-input-placeholder-color);opacity:1;font-size:var(--ai12z-input-placeholder-font-size)}.custom-input::placeholder{color:var(--ai12z-input-placeholder-color);opacity:1;font-size:var(--ai12z-input-placeholder-font-size)}.custom-input:focus{outline:none;box-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--ai12z-border-color)}.input-focus-color{border-color:rgb(59 130 246) !important}.plus-icon{color:var(--ai12z-plus-icon-color)}.ai-button{border-left-width:1px;padding-left:1rem;padding-right:1rem;white-space:nowrap;display:inline-flex;place-items:center;color:var(--ai12z-button-font-color);font-size:var(--ai12z-button-font-size);}.ai-button:hover{background-color:var(--ai12z-primary-color);color:rgb(255 255 255)}.custom-svg-checkbox{margin-top:0.25rem;width:1rem;height:1rem;position:absolute}.hide-svg{display:none}.icon-width{width:1.75rem}.custom-attachment{border-right-width:1px;padding-top:10px;padding-left:1rem;padding-right:2rem;cursor:pointer;width:5%}#fileInput{display:none}.error-msg{color:red;font-size:0.75rem;margin-top:0.25rem;text-align:center}.image-Container{position:relative;display:inline-block;margin-right:10px}.delete-image{opacity:3;position:absolute;right:3px;top:0;cursor:pointer;line-height:10px}.btn-bg-color{background-color:var(--ai12z-button-bgcolor)}.searchbar-bgcolor{background-color:var(--ai12z-searchbar-bgcolor)}.inline-searchbar-bgcolor{border-color:var(--ai12z-inlinesearchbar-border-color);background-color:var(--ai12z-inlinesearchbar-bgcolor);border-width:1px}.enter-tip{font-size:12px;color:#666;margin-left:10px}#message-error{margin-left:10px}";export{S as ai12z_chat,$ as ai12z_input_form}
1
+ import{r as t,a as i,E as e,h as s,d as o}from"./p-BNpVu1WU.js";import{s as a,p as r}from"./p-CwZwG6gL.js";import{e as n,p as l}from"./p-ZyOWOLs5.js";import{u as c,f as h,l as d,k as u,m as p,n as b}from"./p-BCkDiHIY.js";import{s as f}from"./p-TJuczvVq.js";import{H as v}from"./p-D1IPrgJe.js";import{S as m}from"./p-n8ydBHE4.js";import{r as g}from"./p-By1gJKXA.js";import{w,h as y,D as x}from"./p-KSKiM1sy.js";import{t as k,g as C}from"./p-ChFVg77w.js";import{l as z,a as M}from"./p-B_moTKAE.js";import"./p-Dj2_voLF.js";import"./p-8-Jaom_c.js";import"./p-SyQT2Pr3.js";const S=class{constructor(e){t(this,e),this.feedback=i(this,"feedback",7),this.survey=i(this,"survey",7),this.stateChanged=i(this,"stateChanged",7),this.messageReceived=i(this,"messageReceived",7),this.formSubmitted=i(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,a,r;const n=`ai-message-${this.generateUUID()}`,l=this.generateUUID();let c={message:i,type:"ai",status:"success",insightId:t.insightId,id:n,thumbsId:l,controlType:null!==(r=null===(a=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===a?void 0:a.type)&&void 0!==r?r:""};return this.survey.emit({results:c,type:"carousel"}),c},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 r=e.makeHtml(o);const n=document.getElementById("spinner");n&&(n.style.display="none"),s.innerHTML=r,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}}),k("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}}),k("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 w(`#${t.id}`,this.element);i.querySelector(`#${t.surveyDomId}`)||await w(`#${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=c(t.text,this.target||"_blank","ai12z-cta-link",null===(e=this.settings)||void 0===e?void 0:e.utm,"answer");const i=h(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}=n(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 g({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}=n(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 a={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 y({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:a}),this.conversationId=t.detail.conversationId,f(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-C3lNE7QP.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,a;switch(t){case"carousel":return i=1,o=this.itemList,a={paginatedItems:o,isFirstSlide:0===this.currentSlide,isLastSlide:this.currentSlide===this.itemList.length-1,transform:`-${100*this.currentSlide}%`,currentSlide:this.currentSlide},{context:a,end:s};case"list":return i=5,e=this.currentPage*i,s=e+i,o=this.itemList.slice(e,s),a={items:o,hasPrev:this.currentPage>0,hasNext:s<this.itemList.length},{context:a,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 a=e.target.getAttribute("data-id"),r=e.target.getAttribute("data-type"),n=e.target.getAttribute("data-url");if("panel"===r){const r=v.compile(i[Number(a)+1].content),n=this.element.shadowRoot.querySelectorAll(".carousel-card"),l=e.target.closest(".carousel-card").getAttribute("data-index");n[l].innerHTML=r({form:null===(s=t.items[l].panels[Number(a)])||void 0===s?void 0:s.form,formSettings:t.formSettings,buttons:null===(o=t.items[l].panels[Number(a)])||void 0===o?void 0:o.buttons}),this.addEventforPanel(i,t)}"url"===r&&window.open(n,"_blank")}))}))}async processTemplateData(t,i,e){this.currentChatData=t,await this.waitForElementRender(`#${t.id}`).then((async()=>{var s,o,a,r,n;this.hideSpinner(t);const l=this.element.shadowRoot.querySelector(`#${t.id}`);let c;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%",c=v.compile(null===(a=this.currentTemplate[0])||void 0===a?void 0:a.content),"list"===this.currentResponse.process)l.innerHTML=c(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=c(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===(r=i.controlData)||void 0===r?void 0:r.styles,s=null===(n=i.controlData)||void 0===n?void 0:n.Scripts;e&&z(e,this.element.shadowRoot),l.innerHTML=c({msgId:`${t.id}`,source:this.currentResponse,llm:i.controlData.data.llm}),s&&M(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 t,i,s,o,a,r;let n=null===(t=this.socketIn)||void 0===t?void 0:t.getSocketId();if(!n)return void console.error("Socket ID not available");let l=m.getInstanceById(n);if(!l){console.warn(`No socket service found for socket ID: ${n}, attempting to wait for connection...`);try{await this.socketIn.waitForConnection(),n=this.socketIn.getSocketId(),l=m.getInstanceById(n)}catch(t){console.error("Failed to wait for connection:",t)}}if(!l){console.warn("Creating new socket service...");try{const t=m.createInstance(this.env,null!==(i=this.apiKey)&&void 0!==i?i:e.DATA_KEY);if(await t.waitForConnection(),this.socketIn=t,n=t.getSocketId(),l=m.getInstanceById(n),!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 c=l.getSocket();if(!c)return void console.error("Socket not available from service");let h,p;"v2"===l.getProtocol()?(p="query",h={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}):(p="evaluate_query",h={apiKey:null!==(o=this.apiKey)&&void 0!==o?o:e.DATA_KEY,query:this.query,conversationId:null!==(a=this.conversationId)&&void 0!==a?a:"",base64Images:(null===(r=this.imgFiles)||void 0===r?void 0:r.length)>0?this.imgFiles:[],event:"evaluate_query",attributes:this.dataAttributes,excludeTags:this.chatExcludeTags,includeTags:this.chatIncludeTags,meta:d()}),c.emit(p,h,(t=>{t&&(console.error("Error occurred while evaluating query:",t),this.aiMessageId=`chatbot-${u()}`,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],a=i.includes(".")?i.split(".").pop():i;e.addEventListener("click",(()=>{try{switch(a){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=l(o);if(!i)return;this.survey.emit({results:i,type:"sendMessage"});break;case"sendJSON":case"ai12zCtrl.sendJSON":const e=l(o);if(!e)return;this.survey.emit({results:e,type:"sendJSON"})}}catch(t){console.error(`Error invoking ${i}:`,t)}}))}}}))}stopStreamInputHandler(t){this.socketIn&&m.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-C3lNE7QP.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(t){var i,s;if("default"===this.voiceType)if("speechSynthesis"in window){const i=window.speechSynthesis.getVoices().find((t=>t.name===this.voice));this.isPlayed=!0;const e=new SpeechSynthesisUtterance(t);e.lang="en-US",e.rate=1,e.pitch=1,e.voice=i,window.speechSynthesis.speak(e)}else alert("Speech Synthesis API is not supported in your browser.");if("google"===this.voiceType){const o=await p(null!==(i=this.apiKey)&&void 0!==i?i:e.DATA_KEY,null!==(s=this.env)&&void 0!==s?s:e.DATA_MODE,t,this.voice),a=this.base64ToBlob(o.audio_content,"audio/mpeg"),r=URL.createObjectURL(a);this.audioElement=new Audio(r),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 s("div",{key:"567d1598d53db83ebb453da3fcd6227ee5fe5bc0"},s("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,o,a,r,n;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 s("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&&s("div",{class:"chat-inner-list default-avatar"},!this.avatarUrl&&s("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")},s("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&&s("div",{class:"avatar-container "+(l?"md:block":"opacity-0")},s("img",{src:this.avatarUrl,alt:"Avatar",class:"avatar-image w-8 h-8 rounded-full"}))),"pending"===t.status&&s("div",{class:"pending-chat"},s("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"},s("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),s("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"}))),s("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)&&s("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===(o=t.formModel)||void 0===o?void 0:o.hasOwnProperty("answer"),"non-pending-user":!0},id:t.id,innerHTML:t.message},null===(a=null==t?void 0:t.images)||void 0===a?void 0:a.map((t=>s("img",{src:t,class:"thumbnail",alt:"thumbnail",width:"70",height:"50"}))),"user"!==t.type&&s("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"},s("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),s("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===(r=this.settings.showMessageIcons)||void 0===r||r)&&!t.surveyDomId&&s("div",{class:"non-user-container",style:{display:"none"}},this.isPlayed&&s("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)}},s("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-md-heavy"},s("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&&s("button",{class:"copy-btn",onClick:()=>this.speakText(this.removeHtmlTags(t.clipboard)),"aria-label":"Play",tabindex:"0"},s("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("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"}))),s("button",{class:"copy-btn",onClick:()=>this.copyToClipboard(t.clipboard),"aria-label":"Copy to Clipboard",tabindex:"0"},!this.copied&&s("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("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&&s("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6"},s("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"}))),s("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:C(this.chats,t.insightId)||""}),class:"chat-thumbs-up","aria-label":"Thumbs Up",tabindex:"0"},s("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"},s("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"}))),s("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:C(this.chats,t.insightId)||""}),class:"chat-thumbs-up","aria-label":"Thumbs Down",tabindex:"0"},s("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"},s("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"}))),s("button",{class:"copy-btn",tabindex:"0","aria-label":"Send Email"},s("a",{href:`mailto:?subject=${encodeURIComponent(null===(n=this.chats[i-1])||void 0===n?void 0:n.message)}&body=${encodeURIComponent(this.removeHtmlTags(t.clipboard))}`,target:"_blank","aria-label":"Send Email"},s("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"},s("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"})," "))))))})),s("div",{key:"ead0c342309de4030cb69954fe585eb2fc06870f",class:"scroll-bottom"})))}get element(){return o(this)}static get watchers(){return{chats:[{watchHandler:0}]}}};S.style=":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}";const $=class{constructor(e){t(this,e),this.action=i(this,"action",7),this.capturedImgUpload=i(this,"capturedImgUpload",7),this.instanceId=`input-${u()}`,this.imagesBase64List=[],this.showShortcutsDialog=!1,this.shortcuts=x,this.componentType="search",this.chatLength=0,this.searchInput="",this.submitted=!1,this.showErrorMessage=!1,this.hideAllButtons=!1,this.isOpen=!1,this.capturedFile=null,this.errorMessage="You can upload a maximum of 10 images once at a time.",this.emptyMessageError=!1,this.announceMessage="",this.adjustHeight=()=>{this.searchInputElem.style.height="auto",this.searchInputElem.style.height=this.searchInputElem.scrollHeight+"px"},this.handleInputChange=t=>{if(this.searchInput=this.searchInputElem.value,this.isChat)return;const i=this.searchInputElem.value;i.length>3&&!this.isChat&&this.action.emit({event:t,value:i,type:"search",imgFiles:this.imagesBase64List})},this.handleClickOutside=t=>{this.isOpen&&this.menuElem&&!this.menuElem.contains(t.target)&&(this.isOpen=!1)},this.handleFormSubmit=t=>{t.preventDefault(),this.searchInput.length>3&&this.action.emit({event:t,value:this.searchInputElem.value,type:"search"})},this.handleKeyDown=t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),""!==this.searchInputElem.value.trim()||this.imagesBase64List.length>0?this.handleAskAI(t):0===this.imagesBase64List.length&&""===this.searchInputElem.value.trim()&&(this.emptyMessageError=!0,this.searchInputElem.focus(),setTimeout((()=>{this.emptyMessageError=!1}),3e3)))},this.handleFollowUp=t=>{this.action.emit({event:t,value:this.searchInputElem.value,imgFiles:this.imagesBase64List,type:"follow-up",followUp:!1})},this.handleRecentChat=t=>{this.action.emit({event:t,value:this.searchInputElem.value,type:"history"})},this.handleAskAI=t=>{var i,e;if(t.preventDefault(),""===this.searchInputElem.value.trim()&&0===this.imagesBase64List.length)return this.emptyMessageError=!0,this.searchInputElem.focus(),void setTimeout((()=>{this.emptyMessageError=!1}),3e3);this.submitted=!0,this.showErrorMessage=!1,this.emptyMessageError=!1,this.announce("Message sent successfully"),this.tempValue=this.searchInputElem.value,this.searchInputElem.value="";const s=this.imagesBase64List;this.imagesBase64List=[],this.action.emit({event:t,value:this.tempValue,imgFiles:s,followUp:null!==(e=null===(i=this.followUpElem)||void 0===i?void 0:i.checked)&&void 0!==e&&e,type:"ask-ai"})},this.handleImageChange=t=>{this.imagesBase64List=t.detail,this.showErrorMessage=!1},this.handleImageError=t=>{this.errorMessage=t.detail,this.showErrorMessage=!0},this.toggleBox=t=>{t.stopPropagation(),this.isOpen=!this.isOpen},this.handlePaste=t=>{var i;t.preventDefault();const e=(null===(i=t.clipboardData)||void 0===i?void 0:i.getData("text"))||"";if(this.searchInputElem&&e){const t=this.searchInputElem,i=t.selectionStart,s=t.selectionEnd,o=t.value,a=o.substring(0,i)+e+o.substring(s);t.value=a;const r=i+e.length;t.setSelectionRange(r,r),setTimeout((()=>{this.adjustHeight()}),0)}}}disconnectedCallback(){document.removeEventListener("click",this.handleClickOutside)}componentDidLoad(){this.isImageUpload&&document.addEventListener("click",this.handleClickOutside)}stateChangedHandler(t){if(this.submitted=!1,this.isChat){this.searchInputElem.value="",this.searchInput="";const t=this.el.querySelector(`#previewContainer-${this.instanceId}`);this.el.querySelector(`#searchInput-${this.instanceId}`).style.overflow="hidden",t&&(t.innerHTML=""),this.imagesBase64List=[]}}clearInputHandler(t){this.submitted=!1,this.searchInput="";const i=this.el.querySelector(`#previewContainer-${this.instanceId}`);i&&(i.innerHTML=""),this.imagesBase64List=[],this.searchInputElem.style.height="auto"}announce(t){this.announceMessage=t,setTimeout((()=>{this.announceMessage=""}),1e3)}async captureScreen(){try{const t=await navigator.mediaDevices.getDisplayMedia({video:!0}),i=document.createElement("video");i.srcObject=t,i.autoplay=!0,document.body.appendChild(i),await new Promise((t=>i.onloadedmetadata=t)),await new Promise((t=>setTimeout(t,500)));const e=document.createElement("canvas");e.width=i.videoWidth,e.height=i.videoHeight;const s=e.getContext("2d");s&&(s.drawImage(i,0,0,e.width,e.height),e.toBlob((t=>{if(t){const i=new File([t],`screenshot-${Date.now()}.png`,{type:"image/png"});this.capturedFile=i,this.capturedImgUpload.emit([i])}}),"image/png")),t.getTracks().forEach((t=>t.stop())),document.body.removeChild(i)}catch(t){console.error("Error capturing screen:",t)}}render(){return s("div",{key:"623f7b93a8fee68a98ffe0d15fe49232c928d541"},s("div",{key:"33fa75b886a6d845785ab7ad4be2cba4437deead",class:"absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10\n "+(this.isOpen?"opacity-100 scale-100 pointer-events-auto":"opacity-0 scale-90 pointer-events-none"),ref:t=>this.menuElem=t},s("ul",{key:"c7a41dcf7bbb7d3b52d3adac6f7871553d082a97",class:"space-y-2"},this.isImageUpload&&s("li",{key:"4efc17c2a136caf0b8bfc2fba39622a1bab801c9",class:"px-4 py-2 hover:bg-gray-100 cursor-pointer flex"},s("image-uploader",{key:"8c669dda8dd81f4a24da8232938bbd6cae65ad7f",maxImages:10,images:this.imagesBase64List,targetElement:this.searchInputElem,onImagesChange:this.handleImageChange,onError:this.handleImageError,ref:t=>this.imageUploaderRef=t})),s("li",{key:"5fc6b84028c421a57c9b4c3ed36a1b19c6833546",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex",onClick:t=>{this.captureScreen(),this.toggleBox(t)}},s("div",{key:"20cd5b58b14938dde41c3ec82a4d204ddaebea4d",class:"mr-1 mt-px"},s("svg",{key:"c740a9f51839e41055786d23fd7b4ed44ed29324",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"20",height:"20"},s("path",{key:"f8516209c60f8478b6b6e510ceff2ec0a6fb57cd",d:"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z"}),s("path",{key:"8c59bd0faf944dedc4b311cf6c7403e4e8c79689","fill-rule":"evenodd",d:"M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z","clip-rule":"evenodd"}))),s("div",{key:"e10bf86ebd212649837dfad5094d9f39c0555af4"},"Capture")),s("li",{key:"d2b7a298b838ed7259019e26f211a09d69f328b5",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex","aria-label":"Start Over","aria-disabled":0===this.chatLength,style:{opacity:0===this.chatLength?"0.5":"1",cursor:0===this.chatLength?"not-allowed":"pointer"},onClick:t=>{0!==this.chatLength&&(this.handleFollowUp(t),this.toggleBox(t))}},s("div",{key:"95729576e7131a1bcde5edf2f00704e3979f0168",class:"mr-1 mt-px"},s("svg",{key:"aca3169ad3c1933750e6e70156ff3aafa9cb700e",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{key:"f09ce7b4c487d62f744ab255274120d648cebd0c",d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"}))),s("div",{key:"22838c5639850ca1520b5859188cd0cc7f62ae78"},"Start Over")),s("li",{key:"0625819dc4f37253f68674ae2f41169abd7249d3",class:"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex","aria-label":"View Recent Chat",onClick:t=>{this.handleRecentChat(t)}},s("div",{key:"1bd82e7a2f97481c5215af8b5d67ec71d2c69719",class:"mr-1 mt-px"},s("svg",{key:"1a88182d117cadac2c5c491578533860b008cf75",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("path",{key:"1e75ddfc584d70d0ada8008463ea08d8d0ac6623",d:"M21 15a4 4 0 0 1-4 4H7l-4 4V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4z"}),s("path",{key:"d1db69ed6ae7f982b1839204e52a90c32630f1fb",d:"M12 7v5l3 2"}))),s("div",{key:"813b01482c85e7b63908facb41c4a48f226ecd3b"},"View Recent Chat")))),s("form",{key:"b810bd80536347059124d3827e26502e03a97092",class:"w-full flex flex-col gap-1.5 sticky",onSubmit:this.handleFormSubmit},s("div",{key:"f69b95ec734d662c3e88cdc93aa15f8983f380a7",class:"flex-1 flex flex-col relative w-full rounded-3xl px-1 "+("inline"===this.componentType?"inline-searchbar-bgcolor":"searchbar-bgcolor"),dir:"LTR",ref:t=>this.searchFormElem=t},s("div",{key:"c64d576d4675e5993fcecde579f4a992da296a3f",class:"flex items-center"},s("div",{key:"e41c8a31a3775a409810f12f856dd6bb5113b67d",class:"ml-1 self-center flex space-x-1"},!this.hideAllButtons&&s("div",{key:"7614880c9a53a7e99ead7090637185b996b7cc2e",class:"relative inline-block",style:{width:"5%"}},s("button",{key:"edfcedc1fe6e77f2da4d26a60aad3748683ca6ef",class:"plus-icon","aria-label":"Options",title:"Add images or capture screen",tabindex:"0",onClick:t=>{t.stopPropagation(),this.toggleBox(t)}},s("svg",{key:"123d73fdd31ea56f503df593818a05f5574c6fdb",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",width:"20",height:"20"},s("path",{key:"cded16c28c1421bc4c9d4b9f18af6411309a22ba",d:"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"}))))),!this.hideAllButtons&&s("div",{key:"9b0213ad6586daecb71c46941b17108f13c58048",class:"scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto"},s("div",{key:"619ef140b69574f9b5f6b56d3d7dc8355163fbc1",class:"relative w-full min-w-full h-full min-h-fit flex items-center input-prose"},s("div",{key:"a972c24cc5748376eedced77c91dffd331054293",id:`previewContainer-${this.instanceId}`,draggable:!0}),s("label",{key:"b515979270ffdbf8024951c04a826888539a0e64",htmlFor:`searchInput-${this.instanceId}`,class:"sr-only"},"Your message"),s("textarea",{key:"32123cab1fb36680b6e62a53e975988434721974",readOnly:this.submitted,"aria-describedby":this.emptyMessageError?`message-error-${this.instanceId} search-hint-${this.instanceId}`:`search-hint-${this.instanceId}`,"aria-invalid":this.emptyMessageError,id:`searchInput-${this.instanceId}`,ref:t=>{this.searchInputElem=t,null==t||t.focus()},placeholder:this.placeholder,autoComplete:"off",class:"w-full p-1 custom-input",value:this.searchInput,rows:1,onInput:b((t=>this.handleInputChange(t)),500),onKeyUp:this.adjustHeight,onKeyDown:this.handleKeyDown,onFocus:()=>this.searchFormElem.classList.add("input-focus-color"),onBlur:()=>this.searchFormElem.classList.remove("input-focus-color"),onPaste:t=>{this.handlePaste(t)}}),s("div",{key:"4ced8688e0edac2ed1f8a30ea7c0e1099b09e331",role:"status","aria-live":"polite","aria-atomic":"true",class:"sr-only"},this.announceMessage),s("span",{key:"114b87fb5a67f955503a87624e402722cad00276",class:"sr-only"},"Press Enter to send, Shift+Enter for new line"))),s("div",{key:"d9ce04f9657eba2ed56116f3e51ceba84f518052",class:"p-1 self-end flex space-x-1 flex-row",style:{width:this.hideAllButtons?"100%":"auto"}},s("div",{key:"a4752b743e10f5c90e0c7d03192d64e6ba8d2c08","aria-label":"Record voice",class:"flex self-center",style:{width:this.hideAllButtons?"100%":"auto"}},this.isEnableMic&&s("audio-recorder",{key:"e195ba053e5aeb6d017bccf44c01a3a6df2a684c","component-type":"cta",onStartRecord:()=>{this.hideAllButtons=!0},onStopRecord:()=>{this.hideAllButtons=!1},onSendTranscript:t=>{setTimeout((()=>{this.searchInputElem&&(this.searchInputElem.value=t.detail,this.searchInputElem.focus(),requestAnimationFrame((()=>{this.adjustHeight()})))}),1e3)},style:{width:"100%"}}))," ",!this.hideAllButtons&&s("div",{key:"bd7cbc198fbeb575c0105f686683ff0b0a7cd078",class:"flex items-center"},s("div",{key:"50b9e47852a3830eb9fbf0915d75d994924990fd","aria-label":"Send message",class:"flex"},s("button",{key:"15299d903700edfebc1a7084940e2fd6100ccce3",id:`send-message-button-${this.instanceId}`,class:"btn-bg-color text-white transition rounded-full p-1.5 self-center",disabled:this.submitted,onClick:this.handleAskAI,tabindex:"0","aria-label":"Send Message",title:"Send Message"},s("svg",{key:"f27771c390def50b54ec73c295d2c29f4193fafb",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",class:"size-6"},s("path",{key:"c1c893815c40e536537c0c9f1e486666ad2bb0c9","fill-rule":"evenodd",d:"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z","clip-rule":"evenodd"}))))))),this.imagesBase64List.length>0&&s("div",{key:"3f67411ac3c2f9decf28c5e73767c587744619a5",class:"flex flex-wrap gap-2 mx-1 mt-2.5 mb-1"},this.imagesBase64List.map(((t,i)=>s("div",{class:"image-Container sc-ai12z-input-form",key:i},s("img",{src:t,style:{width:"70px",height:"50px",borderRadius:".75rem"}}),s("span",{class:"delete-image sc-ai12z-input-form cursor-pointer ml-1",onClick:()=>{this.imagesBase64List=this.imagesBase64List.filter(((t,e)=>e!==i)),this.imageUploaderRef&&"function"==typeof this.imageUploaderRef.removeImageAtIndex&&this.imageUploaderRef.removeImageAtIndex(i)}},"×")))))),this.showErrorMessage&&s("div",{key:"868075f816f1704f7a033e44c58b457d3221773d",class:"flex"}," ",s("p",{key:"b3f13d96e369071675db049057032c5e2df64e97",class:"error-msg",innerHTML:this.errorMessage})),this.emptyMessageError&&s("div",{key:"bdda68e0bdf5067c5c188a33652925453afde468",class:"flex"},s("p",{key:"bc9f69e378e0b6ad52f9c4420c6db64343ea3be2",id:`message-error-${this.instanceId}`,class:"error-msg",role:"alert"},"Message cannot be empty. Please enter a message to send.")),0===this.chatLength&&s("div",{key:"5927e7b9968e6dc33cf3f6f4a61c3d3a5e2c86a0",class:"enter-tip",role:"tooltip"},"Tip: Press Enter to send, Shift+Enter for new line"," ",s("button",{key:"b6cc8c60952881f38a68913949f63647e4dedd3f",onClick:()=>this.showShortcutsDialog=!0,class:"keyboard-shortcuts-btn","aria-label":"Show keyboard shortcuts",title:"Keyboard shortcuts (?)",tabindex:"0"},s("svg",{key:"a1330e6d41582e0af855b76a463eb4d5ba5b1c14",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},s("circle",{key:"c1e6d8628ad15d82d90d686e7f1608c0b0a1b65d",cx:"12",cy:"12",r:"10"}),s("path",{key:"a339edfb79c587493f9935e19ac3db6439906d11",d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),s("line",{key:"9a5a90516a6dbaef064ad268712ada0ba9877d4f",x1:"12",y1:"17",x2:"12.01",y2:"17"}))))),this.showShortcutsDialog&&s("keyboard-shortcuts-dialog",{key:"6f92ef187ba852baf48a50418028ed36ab6ce8dd",show:this.showShortcutsDialog,shortcuts:this.shortcuts,onCloseDialog:()=>this.showShortcutsDialog=!1}))}get el(){return o(this)}};$.style=":host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important}.input-form{display:flex;flex-direction:column;width:100%;margin-bottom:1rem}.input-container{margin-right:1rem;position:relative;border-radius:4rem;border-width:1px;align-items:stretch;display:flex;}.inner-container{flex-grow:1;padding:0.75rem}.custom-input{color:black;border-width:0;max-height:300px;resize:none;overflow:hidden;background-color:inherit}.custom-input::-moz-placeholder{color:var(--ai12z-input-placeholder-color);opacity:1;font-size:var(--ai12z-input-placeholder-font-size)}.custom-input::placeholder{color:var(--ai12z-input-placeholder-color);opacity:1;font-size:var(--ai12z-input-placeholder-font-size)}.custom-input:focus{outline:none;box-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--ai12z-border-color)}.input-focus-color{border-color:rgb(59 130 246) !important}.plus-icon{color:var(--ai12z-plus-icon-color)}.ai-button{border-left-width:1px;padding-left:1rem;padding-right:1rem;white-space:nowrap;display:inline-flex;place-items:center;color:var(--ai12z-button-font-color);font-size:var(--ai12z-button-font-size);}.ai-button:hover{background-color:var(--ai12z-primary-color);color:rgb(255 255 255)}.custom-svg-checkbox{margin-top:0.25rem;width:1rem;height:1rem;position:absolute}.hide-svg{display:none}.icon-width{width:1.75rem}.custom-attachment{border-right-width:1px;padding-top:10px;padding-left:1rem;padding-right:2rem;cursor:pointer;width:5%}#fileInput{display:none}.error-msg{color:red;font-size:0.75rem;margin-top:0.25rem;text-align:center}.image-Container{position:relative;display:inline-block;margin-right:10px}.delete-image{opacity:3;position:absolute;right:3px;top:0;cursor:pointer;line-height:10px}.btn-bg-color{background-color:var(--ai12z-button-bgcolor)}.searchbar-bgcolor{background-color:var(--ai12z-searchbar-bgcolor)}.inline-searchbar-bgcolor{border-color:var(--ai12z-inlinesearchbar-border-color);background-color:var(--ai12z-inlinesearchbar-bgcolor);border-width:1px}.enter-tip{font-size:12px;color:#666;margin-left:10px}#message-error{margin-left:10px}";export{S as ai12z_chat,$ as ai12z_input_form}
@@ -1 +1 @@
1
- import{r as t,h as e,a as i,d as s}from"./p-BNpVu1WU.js";import{o as a,r as o,l as n,p as c,i as l}from"./p-y3Go1NSi.js";import{t as d}from"./p-ChFVg77w.js";import{L as r,a as h}from"./p-8-Jaom_c.js";const b=class{constructor(e){t(this,e)}render(){return this.senderType?e("div",{class:"rounded-full w-6 h-6 p-2 grid place-content-center"},this.avatarUrl?e("img",{src:this.avatarUrl,class:"w-8 h-8 rounded-full",alt:`${this.senderType} avatar`}):e("i",{class:"block text-body1 default-botAvatar",title:`${this.senderType} avatar`,"aria-label":`${this.senderType} avatar`},"bot"===this.senderType?e("svg",{width:"28",height:"28",viewBox:"0 0 48 48",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},e("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"})):e("svg",{class:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e("path",{d:"M12 12c2.76 0 5-2.24 5-5s-2.24-5-5-5S7 4.24 7 7s2.24 5 5 5zm0 2c-3.31 0-6 2.69-6 6v1h12v-1c0-3.31-2.69-6-6-6z"})))):null}},u=class{constructor(e){t(this,e),this.hamburgerMenuClick=i(this,"hamburgerMenuClick",7),this.handleByLiveAgent=i(this,"handleByLiveAgent",7),this.toggledChange=i(this,"toggledChange",7),this.isToggled=!1,this.messages=[],this.isLiveAgentEnabled=!1,this.hasCheckedLiveAgent=!1,this.liveAgentButtonText="Connect to Live Agent",this.boundHandleClickOutside=this.handleClickOutside.bind(this)}handleClickOutside(t){this.isToggled&&this.menuV2Ref&&!this.menuV2Ref.contains(t.target)&&(this.isToggled=!1,this.toggledChange.emit(this.isToggled))}watchToggled(t){!0===t?document.addEventListener("click",this.boundHandleClickOutside):document.removeEventListener("click",this.boundHandleClickOutside)}watchMessages(t){!this.hasCheckedLiveAgent&&t&&2===t.length&&(this.hasCheckedLiveAgent=!0)}watchLiveAgentButtonText(t){t&&""!==t.trim()||(this.liveAgentButtonText="Connect to Live Agent")}componentDidLoad(){this.isToggled&&document.addEventListener("click",this.boundHandleClickOutside)}disconnectedCallback(){document.removeEventListener("click",this.boundHandleClickOutside)}render(){var t,i;return e("div",{key:"fb76552fc3799bef70ebddc3833e99b9058f180d",id:"dropdown-menu",role:"menu",class:`flex flex-col gap-y-1 grow-wrap absolute bg-white border-b border-gray-80 border-solid rounded-lg shadow-lg p-2 mt-4 min-w-[200px] left-5 overflow-hidden ${this.isToggled?"show":""} dropdown-menu`,style:{height:"auto"},ref:t=>this.menuV2Ref=t},null===(i=null===(t=this.botSettings)||void 0===t?void 0:t.buttons)||void 0===i?void 0:i.map((t=>e("div",{class:"w-full dropdown-item"},e("button",{class:"dropdown-item-button",role:"menuitem","aria-label":t.label,onClick:()=>{this.hamburgerMenuClick.emit({button:t,type:"menu"})}},t.label)))),e("div",{key:"e9df71a3d62ac65517854d31816d08bdaff947e6",class:"w-full dropdown-item"},e("button",{key:"f043a9273787790c12e1a8a002982f16a21925b0",class:"dropdown-item-button",role:"menuitem","aria-label":"Start Over","aria-disabled":0===this.messages.length,disabled:0===this.messages.length,style:{opacity:0===this.messages.length?"0.5":"1",cursor:0===this.messages.length?"not-allowed":"pointer"},onClick:t=>{t.preventDefault(),this.hamburgerMenuClick.emit({type:"startover",event:t})}},"Start Over")),e("div",{key:"f434964275c80de42847907f60711eaef0ce0460",class:"w-full dropdown-item"},e("button",{key:"ed23384ef53f9e9b25a8215bafcfda0f51778f6c",class:"dropdown-item-button",role:"menuitem","aria-label":"View Recent Chat",onClick:()=>{this.hamburgerMenuClick.emit({type:"history"})}},"View Recent chat")),this.isLiveAgentEnabled&&this.botSettings.enableHamburgerMenu&&e("div",{key:"d0fdceeb92d6ec7b1754c5e338dddeaf6ca46081",class:"w-full dropdown-item"},e("button",{key:"21d6f48f44898a459b0224cdab3f65ed0b93124c",class:"dropdown-item-button "+(this.isLiveAgentEnabled?"opacity-100 cursor-pointer":"opacity-50 cursor-not-allowed pointer-events-none"),role:"menuitem","aria-label":this.liveAgentButtonText,style:{opacity:this.isLiveAgentEnabled?"1":"0.5",cursor:this.isLiveAgentEnabled?"pointer":"not-allowed"},onClick:t=>{t.preventDefault(),this.isLiveAgentEnabled&&this.handleByLiveAgent.emit()}},this.liveAgentButtonText)))}static get watchers(){return{isToggled:[{watchToggled:0}],messages:[{watchMessages:0}],liveAgentButtonText:[{watchLiveAgentButtonText:0}]}}};function f(t,e){const i=e.querySelector(`#thumbsUp_${t}`),s=e.querySelector(`#thumbsDown_${t}`);i.classList.add("not-allowed"),i.setAttribute("disabled","true"),s.classList.add("not-allowed"),s.setAttribute("disabled","true")}const v=class{constructor(e){t(this,e),this.voiceType="default",this.voice="Google US English",this.source="",this.conversationId="",this.projectId="",this.isPlayed=!1,this.audioElement=null,this.copied=!1}copyToClipboard(t){navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([o(t)],{type:"text/plain"})})]).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}async speakText(t){if("default"===this.voiceType)if("speechSynthesis"in window){const e=window.speechSynthesis.getVoices().find((t=>t.name===this.voice));this.isPlayed=!0;const i=new SpeechSynthesisUtterance(t);i.lang="en-US",i.rate=1,i.pitch=1,i.voice=e,window.speechSynthesis.speak(i)}else alert("Speech Synthesis API is not supported in your browser.");if("google"===this.voiceType){const e=await n(this.dataKey,this.dataMode,t,this.voice),i=c(e.audio_content,"audio/mpeg"),s=URL.createObjectURL(i);this.audioElement=new Audio(s),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)}}render(){var t;return e("div",{key:"1301676693d2dae8759c238c2528b54d2179454e",class:"thumbs-container flex gap-2 mt-2"},this.isPlayed&&e("button",{key:"10cd8e47e1c37f28f1238c1b7288db94b9ce8f3c",class:"copy-btn",tabindex:"0","aria-label":"Stop Speaking",onClick:()=>{this.isPlayed=!1,window.speechSynthesis.cancel(),this.audioElement&&(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null)}},e("svg",{key:"7917d77a2ae82e41ecca58761b24bdd40ed901f8",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-md-heavy"},e("path",{key:"709788d90a11ef6e33c4b504b58f5daab0d91d6d","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&&e("button",{key:"007f1ba6c2f17d809dafb460e49e6d58cac83b2f",class:"copy-btn",tabindex:"0",onClick:()=>this.speakText(o(this.message.text)),"aria-label":"Speak Text"},e("svg",{key:"ff62913d5c73c19b3b1bdf5b37057cc9e022fda4",class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{key:"8186495b322cd06040e9ea23e50d2c9ea50bebd4","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"}))),e("button",{key:"73b95dd34970f896e9ad3a5641924b5cb825a6ec",id:`thumbsUp_${this.message.thumbsId}`,tabindex:"0",onClick:()=>{var t;!function(t,e,i,s){const o=i.querySelector(`#thumbsUp_${t}`);o.classList.add("thumbs-up"),o.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 ',f(t,i),a(s.dataKey,s.dataMode,e,{value:1}),d("up",e||t,s)}(this.message.thumbsId,this.message.insightId,this.el,{dataKey:this.dataKey,dataMode:this.dataMode,conversationId:this.conversationId,projectId:this.projectId,questionText:(null===(t=this.chatArray[this.currentIndex-1])||void 0===t?void 0:t.text)||""})},class:"chat-thumbs-up","aria-label":"Thumbs Up"},e("svg",{key:"ac3bd7b9dca8a7b2fe280f454bfa719aa5064bb5",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"},e("path",{key:"24d32fb905fd8499f529f7ab8fdbb28f4428f192","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"}))),e("button",{key:"e88dacbba6d2b8d45beb06a7d5b6e60405fa11d4",id:`thumbsDown_${this.message.thumbsId}`,onClick:()=>{var t;return function(t,e,i,s){const o=i.querySelector(`#thumbsDown_${t}`);o.classList.add("thumbs-down"),o.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 ',f(t,i),a(s.dataKey,s.dataMode,e,{value:-1}),d("down",e||t,s)}(this.message.thumbsId,this.message.insightId,this.el,{dataKey:this.dataKey,dataMode:this.dataMode,conversationId:this.conversationId,projectId:this.projectId,questionText:(null===(t=this.chatArray[this.currentIndex-1])||void 0===t?void 0:t.text)||""})},class:"chat-thumbs-up","aria-label":"Thumbs Down"},e("svg",{key:"b23d5fa5643c1e6cc6f3026385a8d7cb93bc6693",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"},e("path",{key:"20c32a05eb6e12926ac553a1ab4bed9e45fceb7e","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"}))),e("button",{key:"3c6b36fba4822583aa696ecb0554d7f21bb16ee7",class:"copy-btn",onClick:()=>this.copyToClipboard(this.message.text),"aria-label":"Copy Text"},!this.copied&&e("svg",{key:"8894cf516b01e42bb49103091ba8b7a79b1b28b9",class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{key:"9f0571488b60f8b39794c78cb962a3e0c5d0273a","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&&e("svg",{key:"389e0dd0c42e6a2686a66a898b6b3727eb9f104b",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6"},e("path",{key:"00419fae11b47645d88eff7bc416ca20c0142d1d","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"}))),e("button",{key:"bc7d7e38758231b7f146300a5f8876c6082666b3",class:"copy-btn","aria-label":"Send Email"},e("a",{key:"0d3f2e732bb670fa494b50cc2151f6770e221a57",href:`mailto:?subject=${encodeURIComponent(null===(t=this.chatArray[this.currentIndex-1])||void 0===t?void 0:t.text)}&body=${encodeURIComponent(o(this.message.text))}`,target:"_blank"},e("svg",{key:"4cff30b349e567b0ddc05b7dfeef3cea54c2b1fa",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"},e("path",{key:"ba202044b745f9d37b91520cff1086941f155c56","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"})," "))))}get el(){return s(this)}};v.style="";const w=new r("LiveAgentChat",{logLevel:h.Info,remoteLoggingUrl:""}),p=class{constructor(e){t(this,e),this.isApiReady=!1,this.chatButton=null,this.buttonId="ucu6zapn"}componentWillLoad(){var t;(null===(t=this.config)||void 0===t?void 0:t.buttonId)&&this.config.scriptSrc?this.loadLiveAgentScript():w.error("LiveAgentChat: `buttonId` and `scriptSrc` properties are required.")}loadLiveAgentScript(){var t;if(document.getElementById("la_x2s6df8d"))return void this.initializeApi();const e=document.createElement("script");e.id="la_x2s6df8d",e.async=!0,e.src=null===(t=this.config)||void 0===t?void 0:t.scriptSrc,e.onload=()=>{window.LiveAgent&&(this.chatButton=window.LiveAgent.createVirtualButton(this.buttonId,e),this.initializeApi())},document.body.appendChild(e)}initializeApi(){(null===window||void 0===window?void 0:window.LiveAgent)?this.isApiReady=!0:w.error("LiveAgentChat: LiveAgent API is not available or `whenReady` is not a function.")}async startChat(t){var e,i,s,a;return this.isApiReady?(null===(e=this.chatButton)||void 0===e||e.onClick(),null===(s=null===(i=window.LiveAgent)||void 0===i?void 0:i.startChat)||void 0===s||s.call(i,t||(null===(a=this.config)||void 0===a?void 0:a.buttonId)),window.addEventListener("message",(t=>{var e,i;if(t.origin.includes("ladesk.com")){if(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.includes("onEmbeddedChatOpened"))try{document.querySelector("ai12z-bot").action("minimize")}catch(t){w.error("Error fetching data:",t)}if(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.includes("closeOpenedWidget"))try{document.querySelector("ai12z-bot").action("open",{expanded:!1})}catch(t){w.error("Error fetching data:",t)}}})),Promise.resolve()):(w.error("LiveAgentChat: API is not ready. Cannot start chat."),Promise.reject("API not ready"))}render(){return e("slot",{key:"a0d32db2683a293d3b4b232fc65cd63461670af1"})}},m=class{constructor(e){t(this,e)}componentWillLoad(){l("https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css",this.el)}render(){return this.show?e("div",{class:"w-full"},e("div",{class:"privacy-msg",innerHTML:this.message})):null}get el(){return s(this)}};m.style=".link-privacy-modal{color:var(--ai12zBot-v2-privacy-link-color);font-size:var(--ai12zBot-v2-privacy-link-font-size)}.privacy-msg{font-size:var(--ai12zBot-v2-privacy-text-font-size);color:var(--ai12zBot-v2-privacy-text-color)}";const g=class{constructor(e){t(this,e),this.size=10,this.color="#4e7becc0",this.spacing=6}render(){const t={width:`${this.size}px`,height:`${this.size}px`,backgroundColor:this.color,marginRight:`${this.spacing}px`};return e("div",{key:"bd85182ca31ecc6d35c911a567daed098164ea59",class:"typing-indicator",role:"status","aria-live":"polite","aria-label":"Typing indicator"},e("span",{key:"63c24fa73702c58e120f8be7f41829b9776c0fb4",class:"dot",style:Object.assign(Object.assign({},t),{animationDelay:"0s"})}),e("span",{key:"9dc45671673597a3e62d837a6bba1e91cf6597ef",class:"dot",style:Object.assign(Object.assign({},t),{animationDelay:"0.2s"})}),e("span",{key:"9c820b6f1255c932301c46c3d1abc51ff6d1dd87",class:"dot",style:Object.assign(Object.assign({},t),{marginRight:"0",animationDelay:"0.4s"})}))}};g.style=".typing-indicator{display:flex;align-items:center;justify-content:flex-start;height:24px}.dot{border-radius:50%;animation:typing-bounce 1.4s infinite ease-in-out both}@keyframes typing-bounce{0%,80%,100%{transform:scale(0);opacity:0.3}40%{transform:scale(1);opacity:1}}";export{b as chat_avatar,u as hamburger_menu,v as interaction_buttons,p as live_agent_chat,m as privacy_modal,g as typing_indicator}
1
+ import{r as t,h as e,a as i,d as s}from"./p-BNpVu1WU.js";import{p as a,r as o,m as n,q as c,e as l}from"./p-BCkDiHIY.js";import{t as d}from"./p-ChFVg77w.js";import{L as r,a as h}from"./p-8-Jaom_c.js";const b=class{constructor(e){t(this,e)}render(){return this.senderType?e("div",{class:"rounded-full w-6 h-6 p-2 grid place-content-center"},this.avatarUrl?e("img",{src:this.avatarUrl,class:"w-8 h-8 rounded-full",alt:`${this.senderType} avatar`}):e("i",{class:"block text-body1 default-botAvatar",title:`${this.senderType} avatar`,"aria-label":`${this.senderType} avatar`},"bot"===this.senderType?e("svg",{width:"28",height:"28",viewBox:"0 0 48 48",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},e("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"})):e("svg",{class:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},e("path",{d:"M12 12c2.76 0 5-2.24 5-5s-2.24-5-5-5S7 4.24 7 7s2.24 5 5 5zm0 2c-3.31 0-6 2.69-6 6v1h12v-1c0-3.31-2.69-6-6-6z"})))):null}},u=class{constructor(e){t(this,e),this.hamburgerMenuClick=i(this,"hamburgerMenuClick",7),this.handleByLiveAgent=i(this,"handleByLiveAgent",7),this.toggledChange=i(this,"toggledChange",7),this.isToggled=!1,this.messages=[],this.isLiveAgentEnabled=!1,this.hasCheckedLiveAgent=!1,this.liveAgentButtonText="Connect to Live Agent",this.boundHandleClickOutside=this.handleClickOutside.bind(this)}handleClickOutside(t){this.isToggled&&this.menuV2Ref&&!this.menuV2Ref.contains(t.target)&&(this.isToggled=!1,this.toggledChange.emit(this.isToggled))}watchToggled(t){!0===t?document.addEventListener("click",this.boundHandleClickOutside):document.removeEventListener("click",this.boundHandleClickOutside)}watchMessages(t){!this.hasCheckedLiveAgent&&t&&2===t.length&&(this.hasCheckedLiveAgent=!0)}watchLiveAgentButtonText(t){t&&""!==t.trim()||(this.liveAgentButtonText="Connect to Live Agent")}componentDidLoad(){this.isToggled&&document.addEventListener("click",this.boundHandleClickOutside)}disconnectedCallback(){document.removeEventListener("click",this.boundHandleClickOutside)}render(){var t,i;return e("div",{key:"fb76552fc3799bef70ebddc3833e99b9058f180d",id:"dropdown-menu",role:"menu",class:`flex flex-col gap-y-1 grow-wrap absolute bg-white border-b border-gray-80 border-solid rounded-lg shadow-lg p-2 mt-4 min-w-[200px] left-5 overflow-hidden ${this.isToggled?"show":""} dropdown-menu`,style:{height:"auto"},ref:t=>this.menuV2Ref=t},null===(i=null===(t=this.botSettings)||void 0===t?void 0:t.buttons)||void 0===i?void 0:i.map((t=>e("div",{class:"w-full dropdown-item"},e("button",{class:"dropdown-item-button",role:"menuitem","aria-label":t.label,onClick:()=>{this.hamburgerMenuClick.emit({button:t,type:"menu"})}},t.label)))),e("div",{key:"e9df71a3d62ac65517854d31816d08bdaff947e6",class:"w-full dropdown-item"},e("button",{key:"f043a9273787790c12e1a8a002982f16a21925b0",class:"dropdown-item-button",role:"menuitem","aria-label":"Start Over","aria-disabled":0===this.messages.length,disabled:0===this.messages.length,style:{opacity:0===this.messages.length?"0.5":"1",cursor:0===this.messages.length?"not-allowed":"pointer"},onClick:t=>{t.preventDefault(),this.hamburgerMenuClick.emit({type:"startover",event:t})}},"Start Over")),e("div",{key:"f434964275c80de42847907f60711eaef0ce0460",class:"w-full dropdown-item"},e("button",{key:"ed23384ef53f9e9b25a8215bafcfda0f51778f6c",class:"dropdown-item-button",role:"menuitem","aria-label":"View Recent Chat",onClick:()=>{this.hamburgerMenuClick.emit({type:"history"})}},"View Recent chat")),this.isLiveAgentEnabled&&this.botSettings.enableHamburgerMenu&&e("div",{key:"d0fdceeb92d6ec7b1754c5e338dddeaf6ca46081",class:"w-full dropdown-item"},e("button",{key:"21d6f48f44898a459b0224cdab3f65ed0b93124c",class:"dropdown-item-button "+(this.isLiveAgentEnabled?"opacity-100 cursor-pointer":"opacity-50 cursor-not-allowed pointer-events-none"),role:"menuitem","aria-label":this.liveAgentButtonText,style:{opacity:this.isLiveAgentEnabled?"1":"0.5",cursor:this.isLiveAgentEnabled?"pointer":"not-allowed"},onClick:t=>{t.preventDefault(),this.isLiveAgentEnabled&&this.handleByLiveAgent.emit()}},this.liveAgentButtonText)))}static get watchers(){return{isToggled:[{watchToggled:0}],messages:[{watchMessages:0}],liveAgentButtonText:[{watchLiveAgentButtonText:0}]}}};function f(t,e){const i=e.querySelector(`#thumbsUp_${t}`),s=e.querySelector(`#thumbsDown_${t}`);i.classList.add("not-allowed"),i.setAttribute("disabled","true"),s.classList.add("not-allowed"),s.setAttribute("disabled","true")}const v=class{constructor(e){t(this,e),this.voiceType="default",this.voice="Google US English",this.source="",this.conversationId="",this.projectId="",this.isPlayed=!1,this.audioElement=null,this.copied=!1}copyToClipboard(t){navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([o(t)],{type:"text/plain"})})]).then((()=>{this.copied=!0,setTimeout((()=>{this.copied=!1}),2e3)}))}async speakText(t){if("default"===this.voiceType)if("speechSynthesis"in window){const e=window.speechSynthesis.getVoices().find((t=>t.name===this.voice));this.isPlayed=!0;const i=new SpeechSynthesisUtterance(t);i.lang="en-US",i.rate=1,i.pitch=1,i.voice=e,window.speechSynthesis.speak(i)}else alert("Speech Synthesis API is not supported in your browser.");if("google"===this.voiceType){const e=await n(this.dataKey,this.dataMode,t,this.voice),i=c(e.audio_content,"audio/mpeg"),s=URL.createObjectURL(i);this.audioElement=new Audio(s),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)}}render(){var t;return e("div",{key:"1301676693d2dae8759c238c2528b54d2179454e",class:"thumbs-container flex gap-2 mt-2"},this.isPlayed&&e("button",{key:"10cd8e47e1c37f28f1238c1b7288db94b9ce8f3c",class:"copy-btn",tabindex:"0","aria-label":"Stop Speaking",onClick:()=>{this.isPlayed=!1,window.speechSynthesis.cancel(),this.audioElement&&(this.audioElement.pause(),this.audioElement.currentTime=0,this.audioElement.src="",this.audioElement=null)}},e("svg",{key:"7917d77a2ae82e41ecca58761b24bdd40ed901f8",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"icon-md-heavy"},e("path",{key:"709788d90a11ef6e33c4b504b58f5daab0d91d6d","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&&e("button",{key:"007f1ba6c2f17d809dafb460e49e6d58cac83b2f",class:"copy-btn",tabindex:"0",onClick:()=>this.speakText(o(this.message.text)),"aria-label":"Speak Text"},e("svg",{key:"ff62913d5c73c19b3b1bdf5b37057cc9e022fda4",class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{key:"8186495b322cd06040e9ea23e50d2c9ea50bebd4","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"}))),e("button",{key:"73b95dd34970f896e9ad3a5641924b5cb825a6ec",id:`thumbsUp_${this.message.thumbsId}`,tabindex:"0",onClick:()=>{var t;!function(t,e,i,s){const o=i.querySelector(`#thumbsUp_${t}`);o.classList.add("thumbs-up"),o.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 ',f(t,i),a(s.dataKey,s.dataMode,e,{value:1}),d("up",e||t,s)}(this.message.thumbsId,this.message.insightId,this.el,{dataKey:this.dataKey,dataMode:this.dataMode,conversationId:this.conversationId,projectId:this.projectId,questionText:(null===(t=this.chatArray[this.currentIndex-1])||void 0===t?void 0:t.text)||""})},class:"chat-thumbs-up","aria-label":"Thumbs Up"},e("svg",{key:"ac3bd7b9dca8a7b2fe280f454bfa719aa5064bb5",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"},e("path",{key:"24d32fb905fd8499f529f7ab8fdbb28f4428f192","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"}))),e("button",{key:"e88dacbba6d2b8d45beb06a7d5b6e60405fa11d4",id:`thumbsDown_${this.message.thumbsId}`,onClick:()=>{var t;return function(t,e,i,s){const o=i.querySelector(`#thumbsDown_${t}`);o.classList.add("thumbs-down"),o.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 ',f(t,i),a(s.dataKey,s.dataMode,e,{value:-1}),d("down",e||t,s)}(this.message.thumbsId,this.message.insightId,this.el,{dataKey:this.dataKey,dataMode:this.dataMode,conversationId:this.conversationId,projectId:this.projectId,questionText:(null===(t=this.chatArray[this.currentIndex-1])||void 0===t?void 0:t.text)||""})},class:"chat-thumbs-up","aria-label":"Thumbs Down"},e("svg",{key:"b23d5fa5643c1e6cc6f3026385a8d7cb93bc6693",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"},e("path",{key:"20c32a05eb6e12926ac553a1ab4bed9e45fceb7e","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"}))),e("button",{key:"3c6b36fba4822583aa696ecb0554d7f21bb16ee7",class:"copy-btn",onClick:()=>this.copyToClipboard(this.message.text),"aria-label":"Copy Text"},!this.copied&&e("svg",{key:"8894cf516b01e42bb49103091ba8b7a79b1b28b9",class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{key:"9f0571488b60f8b39794c78cb962a3e0c5d0273a","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&&e("svg",{key:"389e0dd0c42e6a2686a66a898b6b3727eb9f104b",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6"},e("path",{key:"00419fae11b47645d88eff7bc416ca20c0142d1d","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"}))),e("button",{key:"bc7d7e38758231b7f146300a5f8876c6082666b3",class:"copy-btn","aria-label":"Send Email"},e("a",{key:"0d3f2e732bb670fa494b50cc2151f6770e221a57",href:`mailto:?subject=${encodeURIComponent(null===(t=this.chatArray[this.currentIndex-1])||void 0===t?void 0:t.text)}&body=${encodeURIComponent(o(this.message.text))}`,target:"_blank"},e("svg",{key:"4cff30b349e567b0ddc05b7dfeef3cea54c2b1fa",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"},e("path",{key:"ba202044b745f9d37b91520cff1086941f155c56","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"})," "))))}get el(){return s(this)}};v.style="";const w=new r("LiveAgentChat",{logLevel:h.Info,remoteLoggingUrl:""}),p=class{constructor(e){t(this,e),this.isApiReady=!1,this.chatButton=null,this.buttonId="ucu6zapn"}componentWillLoad(){var t;(null===(t=this.config)||void 0===t?void 0:t.buttonId)&&this.config.scriptSrc?this.loadLiveAgentScript():w.error("LiveAgentChat: `buttonId` and `scriptSrc` properties are required.")}loadLiveAgentScript(){var t;if(document.getElementById("la_x2s6df8d"))return void this.initializeApi();const e=document.createElement("script");e.id="la_x2s6df8d",e.async=!0,e.src=null===(t=this.config)||void 0===t?void 0:t.scriptSrc,e.onload=()=>{window.LiveAgent&&(this.chatButton=window.LiveAgent.createVirtualButton(this.buttonId,e),this.initializeApi())},document.body.appendChild(e)}initializeApi(){(null===window||void 0===window?void 0:window.LiveAgent)?this.isApiReady=!0:w.error("LiveAgentChat: LiveAgent API is not available or `whenReady` is not a function.")}async startChat(t){var e,i,s,a;return this.isApiReady?(null===(e=this.chatButton)||void 0===e||e.onClick(),null===(s=null===(i=window.LiveAgent)||void 0===i?void 0:i.startChat)||void 0===s||s.call(i,t||(null===(a=this.config)||void 0===a?void 0:a.buttonId)),window.addEventListener("message",(t=>{var e,i;if(t.origin.includes("ladesk.com")){if(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.includes("onEmbeddedChatOpened"))try{document.querySelector("ai12z-bot").action("minimize")}catch(t){w.error("Error fetching data:",t)}if(null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.includes("closeOpenedWidget"))try{document.querySelector("ai12z-bot").action("open",{expanded:!1})}catch(t){w.error("Error fetching data:",t)}}})),Promise.resolve()):(w.error("LiveAgentChat: API is not ready. Cannot start chat."),Promise.reject("API not ready"))}render(){return e("slot",{key:"a0d32db2683a293d3b4b232fc65cd63461670af1"})}},m=class{constructor(e){t(this,e)}componentWillLoad(){l("https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css",this.el)}render(){return this.show?e("div",{class:"w-full"},e("div",{class:"privacy-msg",innerHTML:this.message})):null}get el(){return s(this)}};m.style=".link-privacy-modal{color:var(--ai12zBot-v2-privacy-link-color);font-size:var(--ai12zBot-v2-privacy-link-font-size)}.privacy-msg{font-size:var(--ai12zBot-v2-privacy-text-font-size);color:var(--ai12zBot-v2-privacy-text-color)}";const g=class{constructor(e){t(this,e),this.size=10,this.color="#4e7becc0",this.spacing=6}render(){const t={width:`${this.size}px`,height:`${this.size}px`,backgroundColor:this.color,marginRight:`${this.spacing}px`};return e("div",{key:"bd85182ca31ecc6d35c911a567daed098164ea59",class:"typing-indicator",role:"status","aria-live":"polite","aria-label":"Typing indicator"},e("span",{key:"63c24fa73702c58e120f8be7f41829b9776c0fb4",class:"dot",style:Object.assign(Object.assign({},t),{animationDelay:"0s"})}),e("span",{key:"9dc45671673597a3e62d837a6bba1e91cf6597ef",class:"dot",style:Object.assign(Object.assign({},t),{animationDelay:"0.2s"})}),e("span",{key:"9c820b6f1255c932301c46c3d1abc51ff6d1dd87",class:"dot",style:Object.assign(Object.assign({},t),{marginRight:"0",animationDelay:"0.4s"})}))}};g.style=".typing-indicator{display:flex;align-items:center;justify-content:flex-start;height:24px}.dot{border-radius:50%;animation:typing-bounce 1.4s infinite ease-in-out both}@keyframes typing-bounce{0%,80%,100%{transform:scale(0);opacity:0.3}40%{transform:scale(1);opacity:1}}";export{b as chat_avatar,u as hamburger_menu,v as interaction_buttons,p as live_agent_chat,m as privacy_modal,g as typing_indicator}
@@ -0,0 +1 @@
1
+ import{r as e,E as t,h as a,d as s}from"./p-BNpVu1WU.js";import{e as i,P as r}from"./p-BCkDiHIY.js";import{S as o}from"./p-CkF7XHob.js";const c=class{constructor(a){e(this,a),this.dataKey=t.DATA_KEY||"",this.dataMode=t.DATA_MODE||"prod",this.categorize=!0,this.placeholder="AI Search...",this.redirectUrl="/search",this.query="",this.searchResults=[],this.hideAllButtons=!1,this.handleKeyDown=e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this.handleFormSubmit(e))}}componentWillLoad(){i("https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css",this.el)}async fetchSearchResults(){const e=await r(this.dataKey,this.dataMode,this.query),t=e.docs?[...e.docs]:[];this.searchResults=[],setTimeout((()=>{this.searchResults=t}),0)}async handleInput(e){this.query=e.target.value,this.query.trim().length>3?this.fetchSearchResults():this.searchResults=[]}async handleFormSubmit(e){e.preventDefault();const t=new URLSearchParams({searchText:this.query,page:"1"}).toString();window.location.href=`${this.redirectUrl}?${t}`}render(){var e;return a("div",{key:"4db66cb3af053593b6f49cfd279c62133b5bc59b",class:"flex flex-col rounded-2xl relative",id:"searchPanel"},a("form",{key:"c1b63bac4323c03d968d0a333a6263789065306f",class:"flex flex-col rounded-2xl p-2.5 search-container",onSubmit:e=>this.handleFormSubmit(e),id:"searchForm"},a("div",{key:"241e155dc1090bdf4cab2ff22208d56554cdf2aa",class:"flex"},!this.hideAllButtons&&a("div",{key:"289e07a334a25d82e3318a411732471cb82c6f4a",class:"w-11/12 mt-1 search-input-container"},a("label",{key:"19a47260434e8512a24475d240e831be5c55e185",htmlFor:"search-input",class:"sr-only"},"Your message"),a("input",{key:"a4e7ccc16b5e207eb4d8392916b295370b3f26d8",id:"search-input",class:`bg-inherit w-full outline-none resize-none ${(null===(e=this.searchResults)||void 0===e?void 0:e.length)>0?"input-border":""} search-input`,ref:e=>{this.searchInputElem=e,null==e||e.focus()},placeholder:this.placeholder,value:this.query,onInput:e=>this.handleInput(e),onKeyDown:this.handleKeyDown,onFocus:()=>{this.el.shadowRoot.querySelector("#searchPanel").classList.add("input-focus-color")},onBlur:()=>this.el.shadowRoot.querySelector("#searchPanel").classList.remove("input-focus-color")})),a("div",{key:"388956b4c95944b10a114b7c7049e0a34d73169b",class:"icons flex items-center "+(this.hideAllButtons?"w-full":"w-auto")},a("span",{key:"f80bf5faa8e37155b8ee157abdf38472eb7fa253",class:"w-full mic-icon"},a("audio-recorder",{key:"edb5905ea21aa922b9981dd950ab07643a1af54a","component-type":"search",onStartRecord:()=>{this.hideAllButtons=!0},onStopRecord:()=>{this.hideAllButtons=!1},onSendTranscript:e=>{setTimeout((()=>{if(this.searchInputElem){this.searchInputElem.value=e.detail,this.query=e.detail;const t=this.el.shadowRoot.querySelector("#search-input");if(t){const a=new Event("input",{bubbles:!0});Object.defineProperty(a,"target",{writable:!1,value:t}),t.value=e.detail,this.handleInput(a),t.dispatchEvent(a)}}}),500)},style:{width:"100%"}})),a("div",{key:"71f504092ad5d289f5013b113bcba7c98508754e",class:"search-icon"},a("button",{key:"cd7a2a00747106a42d4a6ee58525d6ace1eb79fc",id:"send-message-button",class:"text-white transition rounded-lg p-1.5 self-center search-btn-bg-color",onClick:e=>this.handleFormSubmit(e),"aria-label":"Search"},a("svg",{key:"9719aae24e90a64d202c6eacaf7d0512d304ed72",xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6",viewBox:"0 0 24 24"},a("path",{key:"8ea5557a92714c394f103551dbe1cb3a1da8e1c7",fill:"currentColor",d:"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 17 9.5 6.5 6.5 0 1 0 10.5 16a6.471 6.471 0 0 0 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-5 0A4.5 4.5 0 1 1 14 9.5 4.5 4.5 0 0 1 10.5 14z"})))))),this.searchResults&&this.searchResults.length>0&&a("div",{key:"4e9ae924150fb065d2e703f09df47d15f7b782be",class:"rounded-b-2xl overflow-hidden search-results"},this.categorize&&a("ai12z-category",{key:"ee52f905f7e06abd6f5b55f2680fb71d4b98ef27",categoryList:this.searchResults,linkTarget:"_blank"}),!this.categorize&&a(o,{key:"4a03deb24440e25d5532fb038565aa4d89398385",results:this.searchResults}))))}get el(){return s(this)}};c.style=":host{display:block;width:100%;font-family:var(--ai12z-font-family);font-size:var(--ai12z-font-size)}.input-focus-color{border:1px solid var(--ai12z-search-panel-focus-color)}.search-btn-bg-color{background-color:var(--ai12z-search-panel-button-bgcolor)}.input-border{border-bottom:1px solid var(--ai12z-search-panel-input-border-color)}.search-container{background-color:var(--ai12z-search-panel-bg)}.search-icon svg{width:20px;height:20px;color:var(--ai12z-search-panel-icon-color);}.search-input::-moz-placeholder{color:#999}.search-input::placeholder{color:#999}.search-results{width:100%;text-align:left}.cta-search-results{border-top-width:1px;border-bottom-width:0px;border-color:rgb(243 244 246)}.cta-search-results-list{position:relative;padding-bottom:1.25rem;padding-top:1.25rem}.cta-search-results-list:hover{background-color:var(--ai12z-hover-bg-color)}.cta-search-container{margin-left:auto;margin-right:auto;display:flex;max-width:56rem;justify-content:space-between;-moz-column-gap:1.5rem;column-gap:1.5rem}.cta-search-container-two{display:flex;min-width:0px;-moz-column-gap:1rem;column-gap:1rem}.cta-search-container-three{min-width:0px;flex:1 1 auto}.cta-search-text{font-weight:600;line-height:1.5rem;font-size:var(--ai12z-search-result-title-font-size);color:var(--ai12z-search-result-title-color)}.cta-search-text-position{position:absolute;left:0px;right:0px;top:-1px;bottom:0px}.cta-search-description{margin-top:0.25rem;display:flex;font-size:var(--ai12z-search-result-description-font-size);line-height:1rem;line-height:1.25rem;color:var(--ai12z-search-result-description-color)}.cta-search-list-arrow{display:flex;align-items:center;flex-shrink:0;-moz-column-gap:1rem;column-gap:1rem}.custom-icon-width{width:4rem}.results-icon svg{width:1.5rem;height:1.5rem}";export{c as ai12z_search_panel}
@@ -1 +1 @@
1
- import{E as t}from"./p-BNpVu1WU.js";let e=null;function n(e){switch(e=e||t.DATA_MODE){case"local-grpc":return"http://localhost:8080";case"dev-grpc":return"https://socket.ai12z.net";case"local":return"http://127.0.0.1:5000";case"dev":return"https://dev-api.ai12z.net";default:return"https://api.ai12z.net"}}function a(e){return"local-grpc"===(e=e||t.DATA_MODE)?"v2":"legacy"}function i(e){switch(e=e||t.DATA_MODE){case"local":return"http://localhost:3000";case"dev":return"https://dev.ai12z.net";default:return"https://app.ai12z.net"}}function o(){var t,e;return{origin:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.href,title:null===document||void 0===document?void 0:document.title,userAgent:null===navigator||void 0===navigator?void 0:navigator.userAgent,referrer:null===document||void 0===document?void 0:document.referrer,language:null===navigator||void 0===navigator?void 0:navigator.language,legacyResponse:!1,description:null===(e=document.querySelector('meta[name="description"]'))||void 0===e?void 0:e.getAttribute("content")}}async function r(t){const e=`HTTP error! status: ${t.status}`;try{if((t.headers.get("content-type")||"").includes("application/json")){const n=await t.json();return new Error((null==n?void 0:n.message)||(null==n?void 0:n.error)||(null==n?void 0:n.details)||(null==n?void 0:n.title)||e)}const n=await t.text();return new Error(n||e)}catch(t){return new Error(e)}}async function s(e,n){var a,i;try{const o=Object.assign({},n),s={origin:null===(a=null===window||void 0===window?void 0:window.location)||void 0===a?void 0:a.href,title:null===document||void 0===document?void 0:document.title,userAgent:null===navigator||void 0===navigator?void 0:navigator.userAgent,referrer:null===document||void 0===document?void 0:document.referrer,language:null===navigator||void 0===navigator?void 0:navigator.language,description:null===(i=document.querySelector('meta[name="description"]'))||void 0===i?void 0:i.getAttribute("content")};if(o.apiKey||(o.apiKey=t.DATA_KEY),!o.apiKey)throw new Error('Public Key is required. Please provide using attribute "data-key".');const l=Object.assign(Object.assign({},o),{meta:s});delete l.apiKey;const c=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":o.apiKey},body:JSON.stringify(l)});if(!c.ok)throw await r(c);const d=await c.json();return await d}catch(t){throw t}}async function l(e,n={},a={}){try{const{requireKeyName:i=!0}=a,o=Object.assign({},n);if(o.apiKey||(o.apiKey=t.DATA_KEY),!o.apiKey)throw new Error('Public Key is required. Please provide using attribute "data-key".');if(i&&!o.keyName)throw new Error("Either Key Name or ID is required.");const s=new URLSearchParams;Object.entries(o).forEach((([t,e])=>{"apiKey"!==t&&null!=e&&""!==e&&s.append(t,"object"==typeof e?JSON.stringify(e):String(e))}));const l=s.toString()?`${e}?${s.toString()}`:e,c=await fetch(l,{method:"GET",headers:{"Content-Type":"application/json","x-api-key":o.apiKey}});if(!c.ok)throw await r(c);return(c.headers.get("content-type")||"").includes("application/json")?await c.json():await c.text()}catch(t){throw t}}async function c(t,e,n,a,o){const r=`${i(e)}/api/projects/formSubmission`,l={apiKey:t,keyName:n,data:a,controlType:o};return await s(r,l)}async function d(t,e,a,i){const o=`${n(a)}/bot/audio/transcribe`;return await s(o,{apiKey:t,language:e,audioBase64:i})}async function u(t,e,n){const a=`${i(e)}/api/projects/formSubmission`;return await l(a,{apiKey:t,keyName:n})}async function f(t,e,a,i){const o=`${n(e)}/bot/control`;let r={};if("string"==typeof i&&""!==i.trim())try{r=JSON.parse(i)}catch(t){console.warn("Invalid widget parameters JSON. Falling back to empty object.")}const l={apiKey:t,keyName:a,parameters:r};return await s(o,l)}async function b(t,e,n){const a=`${i(e)}/api/projects/kb/${encodeURIComponent(n)}`;return await l(a,{apiKey:t},{requireKeyName:!1})}async function p(t,e,i){if(!i)return[];try{const a=`${n(e)}/bot/search`,o={apiKey:t,query:i,num_docs:4};return await s(a,o)}catch(t){if("v2"===a(e))return console.warn("Search endpoint not available on v2 backend"),[];throw t}}async function m(t,e,i,o){try{const a=`${n(e)}/bot/synthesize`,r={text:i,apiKey:t,voiceType:o};return await s(a,r)}catch(t){if("v2"===a(e))return console.warn("Synthesize endpoint not available on v2 backend"),null;throw t}}function h(t,e){const n=atob(t),a=new Array(n.length).fill(0).map(((t,e)=>n.charCodeAt(e))),i=new Uint8Array(a);return new Blob([i],{type:e})}function x(t){const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}async function v(t,e,i,o){if(i)try{const a=`${n(e)}/bot/feedback`,r={apiKey:t,insight_id:i,feedback:o};return await s(a,r)}catch(t){if("v2"===a(e))return void console.warn("Feedback endpoint not available on v2 backend");throw t}}function g(t,e=300){let n;return(...a)=>{clearTimeout(n),n=setTimeout((()=>{t.apply(this,a)}),e)}}async function y(t,a){if(null===e)try{const i=`${n(a)}/bot/status`,o=await s(i,{apiKey:t});o&&(e=o.enable)}catch(t){e=!1}return e}function w(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))}function k(t){const e=(new DOMParser).parseFromString(t,"text/html");let n=Array.from(e.querySelectorAll("button")).map(((t,e)=>{const n=t.id||`button-${e}`,a=t.textContent||`Button ${e+1}`;t.id=n;const i=t.getAttribute("onclick");return t.removeAttribute("type"),t.removeAttribute("onclick"),i&&t.setAttribute("data-original-click",i),t.setAttribute("aria-label",a),{id:n,label:a,onClick:()=>alert(`Button ${n} clicked!`)}}));return{body:e.body.innerHTML,buttons:n}}function j(e,a){const{configId:i,apiKey:o,configType:r}=e,l=`${n(a)}/bot/config`;return e.apiKey||(e.apiKey=t.DATA_KEY),s(l,{configId:i,apiKey:o,configType:r})}function S(e,a){const i=`${n(a)}/bot/verify`;return e.apiKey||(e.apiKey=t.DATA_KEY),s(i,e)}function $(){const t="ai12z-visitorId";let e=localStorage.getItem(t);return e||(e=Date.now()+"-"+Math.random().toString(36).substr(2,9),localStorage.setItem(t,e)),"ai12z-"+e}function I(t,e){var n,a,i,o,r,s;const l=null===(a=null===(n=t.controlData)||void 0===n?void 0:n.data.source.carousel)||void 0===a?void 0:a.type,c=document.createElement("item-list");return c.carouselType=l,c.inputType=e,c.customTemplate=t.controlData.template,c.customSource=null===(i=t.controlData)||void 0===i?void 0:i.data.source,c.llm=null===(o=t.controlData)||void 0===o?void 0:o.data.llm,c.isExpanded=t.isExpanded||!1,c.customStyles=(null===(r=t.controlData)||void 0===r?void 0:r.styles)||"",c.customScripts=(null===(s=t.controlData)||void 0===s?void 0:s.scripts)||"",c}function T(t){if("list"===t)return[{name:"list",content:'{{#each items as |item index|}}\n <div class="carousel-card flex flex-col items-start mb-4 bg-white border h-auto border-gray-200 rounded-lg shadow md:flex-row md:max-w-xl dark:border-gray-700" data-index="{{@index}}">\n <div class="relative carousel-container card-image {{#if (gte item.images.length 1)}}w-full{{else}}w-1/2{{/if}}" data-carousel-id="carousel-{{index}}" id="carousel-{{index}}" data-carousel="slide">\n <div class="relative h-64 overflow-hidden">\n {{#each item.images as |image imageIndex|}} \n <img src="{{this}}" alt="Image for {{../title}}" class="card-image object-cover w-full h-96 md:h-auto md:mt-6 md:ml-2 hidden duration-700 ease-in-out" data-carousel-item id="carousel-{{index}}-item-{{imageIndex}}"/> \n {{/each}}\n </div> \n {{#if (lte item.images.length 3)}} \n {{#if (gte item.images.length 1)}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n {{#each images as |image imageIndex|}}\n <button type="button" class="w-3 h-3 rounded-full" aria-current="true" aria-label="Slide {{@index}}" data-carousel-slide-to="{{index}}" id="carousel-{{index}}-indicator-{{imageIndex}}"></button>\n {{/each}}\n </div>\n {{/if}}\n {{else}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-prev id="carousel-{{index}}-prev"></button>\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-next id="carousel-{{index}}-next"></button>\n </div>\n {{/if}}\n </div>\n \n <div class="flex flex-col justify-between p-4 leading-normal">\n <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"> {{{this.title}}}</h5>\n {{#each subTitle}} \n <p class="font-title text-md md:text-xl">{{this}}</p> \n {{/each}}\n <p class="short-description mb-3 font-normal text-gray-700 dark:text-gray-400">{{{this.shortDescription}}}</p>\n <div class="long-description mb-3 font-normal text-gray-700 dark:text-gray-400 hidden">{{{this.description}}}</div>\n {{#if this.description}}\n <button class="read-more text-blue-500 hover:text-blue-700 underline focus:outline-none" data-index="{{@index}}"> Read More </button>\n {{/if}}\n <div class="flex flex-col items-center my-4">\n {{#each buttons}} \n <button class="card-button list-btn uppercase pt-2 pb-1 px-4 flex-grow hover:bg-gradient-to-t md:flex-none" data-id="{{@index}}" data-url="{{this.url}}" data-type="{{this.type}}">\n {{this.label}}</button>\n {{/each}}\n {{#and ../buttonText formSettings}}\n <button class="card-button list-btn uppercase" data-type="panel">{{../buttonText}}</button>\n {{/and}}\n </div>\n </div>\n</div>\n{{/each}}\n<div class="pagination-controls">\n<button class="prev-btn list-btn" {{#unless hasPrev}}disabled{{/unless}}>Prev</button>\n<span> Page {{getcurrentPage}} of {{getPageCount}} </span>\n<button class="next-btn list-btn" {{#unless hasNext}}disabled{{/unless}}>Next</button>\n</div>'},{name:"detail",content:'<div class="flex flex-col items-center justify-center w-full h-full p-4">\n <div class="w-full md:col-span-2 h-fit">\n <dynamic-form form="{{json form}}" formSettings="{{json formSettings}}" theme="{{json theme}}"/>\n </div> \n <div> \n {{#each buttons}} \n <button class="panel-button list-btn text-white" data-id="{{this.index}}" data-type="{{this.type}}">{{this.label}}</button> \n {{/each}}\n </div>\n </div>'}]}function O(t){switch(t){case"list":return[{name:"list",content:'{{#each items as |item index|}}\n <div class="carousel-card flex flex-col items-start mb-4 bg-white border h-auto border-gray-200 rounded-lg shadow md:flex-row dark:border-gray-700" data-index="{{index}}">\n \n <div class="relative md:w-1/3 carousel-container card-image {{#if (gte item.images.length 1)}}w-full{{else}}w-full md:w-1/2{{/if}}" data-carousel-id="carousel-{{index}}" id="carousel-{{index}}" data-carousel="slide">\n <div class="relative h-64 overflow-hidden">\n {{#each item.images as |image imageIndex|}} \n <img src="{{this}}" alt="Image for {{../title}}" class="card-image object-cover w-full h-96 md:h-auto md:mt-6 md:ml-2 hidden duration-700 ease-in-out" data-carousel-item id="carousel-{{index}}-item-{{imageIndex}}"/> \n {{/each}}\n </div> \n {{#if (lte item.images.length 3)}} \n {{#if (gte item.images.length 1)}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n {{#each images as |image imageIndex|}}\n <button type="button" class="w-3 h-3 rounded-full" aria-current="true" aria-label="Slide {{@index}}" data-carousel-slide-to="{{index}}" id="carousel-{{index}}-indicator-{{imageIndex}}"></button>\n {{/each}}\n </div>\n {{/if}}\n {{else}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-prev id="carousel-{{index}}-prev"></button>\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-next id="carousel-{{index}}-next"></button>\n </div>\n {{/if}}\n </div>\n \n \n \n <div class="flex flex-col justify-between p-4 leading-normal md:w-2/3 card-right">\n <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"> {{{this.title}}}</h5>\n {{#each subTitle}} \n <p class="font-title text-md md:text-xl">{{this}}</p> \n {{/each}}\n <p class="short-description mb-3 font-normal text-gray-700 dark:text-gray-400">{{{this.shortDescription}}}</p>\n <div class="long-description mb-3 font-normal text-gray-700 dark:text-gray-400 hidden">{{{this.description}}}</div>\n {{#if this.description}}\n <a class="read-more text-blue-500 hover:text-blue-700 underline focus:outline-none" data-index="{{@index}}"> Read More </a>\n {{/if}}\n <div class="flex items-center my-4">\n {{#each buttons as |button buttonIndex|}} \n <button class="card-button list-btn uppercase pt-2 pb-1 px-4 flex-grow hover:bg-gradient-to-t md:flex-none" data-id="{{buttonIndex}}" data-url="{{this.url}}" data-type="{{this.type}}">\n {{this.label}}</button>\n {{/each}}\n {{#and ../buttonText formSettings}}\n <button class="card-button list-btn uppercase" data-type="panel">{{../buttonText}}</button>\n {{/and}}\n </div>\n </div>\n</div>\n{{/each}}\n<div class="pagination-controls">\n<button class="prev-btn list-btn" {{#unless hasPrev}}disabled{{/unless}}>Prev</button>\n<span> Page {{getcurrentPage}} of {{getPageCount}} </span>\n<button class="next-btn list-btn" {{#unless hasNext}}disabled{{/unless}}>Next</button>\n</div>\n'},{name:"detail",content:'\n <div class="flex flex-col items-center justify-center w-full h-full p-4">\n <div class="w-full md:col-span-2 h-fit">\n <dynamic-form form="{{json form}}" formSettings="{{json formSettings}}" theme="{{theme}}"/>\n </div> \n <div> \n {{#each buttons}} \n <button class="panel-button list-btn text-white" data-id="{{this.index}}" data-type="{{this.type}}">{{this.label}}</button> \n {{/each}}\n </div>\n </div>'}];case"slider":return[{name:"carousel",content:'\n<div id="carouselExample" class="relative w-full" data-carousel="static">\n \n <div class="carousel-box relative bg-white overflow-hidden overflow-y-scroll h-56 rounded-lg md:h-96" style={ overflowY: "scroll", height: "30rem" }>\n {{#each items as |item index|}}\n <div class="carousel-card max-w-sm hidden duration-700 ease-in-out md:max-w-xl" data-carousel-item id="carousel-item-{{index}}" data-index="{{index}}">\n <div class="card-image relative w-full carousel-container" data-carousel-id="carousel-{{index}}" id="carousel-{{index}}" data-carousel="slide">\n <div class="relative h-64 overflow-hidden rounded-lg">\n {{#each item.images as |image imageIndex|}} \n \n <img src="{{this}}" alt="Image for {{../title}}" class="card-image object-cover h-96 hidden duration-700 ease-in-out" data-carousel-item id="carousel-{{index}}-item-{{imageIndex}}"/> \n \n {{/each}}\n </div> \n {{#if (lte item.images.length 3)}} \n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n {{#each images as |image imageIndex|}}\n <button type="button" class="w-3 h-3 rounded-full" aria-current="true" aria-label="Slide {{@index}}" data-carousel-slide-to="{{index}}" id="carousel-{{index}}-indicator-{{imageIndex}}"></button>\n {{/each}}\n </div>\n {{else}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-prev id="carousel-{{index}}-prev"></button>\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-next id="carousel-{{index}}-next"></button>\n </div>\n {{/if}}\n </div> \n \n <div class="p-5">\n <a href="#">\n <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{{{title}}}</h5>\n </a>\n <p class="short-description mb-3 font-normal text-gray-700 dark:text-gray-400">{{{shortDescription}}}</p>\n <div class="long-description mb-3 font-normal text-gray-700 dark:text-gray-400 hidden">{{{description}}}</div>\n {{#if description}}\n <a class="read-more inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">\n Read more\n <svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">\n <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>\n </svg>\n </a>\n {{/if}}\n {{#each buttons}}\n <button class="card-button list-btn uppercase pt-2 pb-1 px-4 flex-grow hover:bg-gradient-to-t md:flex-none" data-index="{{@index}}" data-url="{{this.url}}" data-type="{{this.type}}">{{this.label}}</button>\n {{/each}}\n </div>\n </div>\n {{/each}}\n </div>\n\n <div class="absolute z-30 flex overflow-x-auto -translate-x-1/2 space-x-1 rtl:space-x-reverse bottom-5 left-1/2 scrollbar-visible">\n {{#if (lte items.length 5)}} \n {{#each items}}\n <button\n id="carousel-indicator-{{@index}}"\n type="button"\n class="w-2.5 h-2.5 sm:w-3 sm:h-3 md:w-4 md:h-4 rounded-full"\n aria-current="true"\n aria-label="Slide {{@index}}"\n ></button>\n {{/each}}\n {{/if}}\n </div>\n\n \x3c!-- Controls --\x3e\n <button\n type="button"\n class="absolute top-0 left-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none"\n id="data-carousel-prev"\n data-carousel-prev\n >\n <span\n class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-blue-600"\n >\n <svg\n aria-hidden="true"\n class="w-6 h-6 text-white"\n fill="none"\n stroke="currentColor"\n viewBox="0 0 24 24"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n stroke-width="2"\n d="M15 19l-7-7 7-7"\n ></path>\n </svg>\n <span class="sr-only">Previous</span>\n </span>\n </button>\n <button\n type="button"\n class="absolute top-0 right-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none"\n id="data-carousel-next"\n data-carousel-next\n >\n <span\n class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-blue-600"\n >\n <svg\n aria-hidden="true"\n class="w-6 h-6 text-white dark:text-gray-800"\n fill="none"\n stroke="currentColor"\n viewBox="0 0 24 24"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n stroke-width="2"\n d="M9 5l7 7-7 7"\n ></path>\n </svg>\n <span class="sr-only">Next</span>\n </span>\n </button>\n</div>'},{name:"detail",content:'\n <div class="flex flex-col items-center justify-center w-full h-full p-4">\n <div class="w-full md:col-span-2 h-fit">\n <dynamic-form form="{{json form}}" formSettings="{{json formSettings}}" theme="{{theme}}"/>\n </div> \n <div> \n {{#each buttons}} \n <button class="panel-button list-btn text-white" data-id="{{this.index}}" data-type="{{this.type}}">{{this.label}}</button> \n {{/each}}\n </div>\n </div>'}]}}function P(){return(navigator.language||navigator.userLanguage).split("-")[0]}function z(t){const e=new Set;return function t(n){if(Array.isArray(n))n.forEach((e=>t(e)));else if("object"==typeof n&&null!==n){(function(t){return"object"==typeof t&&null!==t&&Object.keys(t).length>0&&Object.values(t).every((t=>"string"==typeof t))})(n)&&Object.keys(n).includes("default")&&Object.keys(n).forEach((t=>e.add(t)));for(const e in n)t(n[e])}}(t),e}function K(t){return"string"==typeof t}function N(t){return"object"==typeof t&&null!==t}function D(t,e){return Object.assign({},t&&t.options?t.options:{},e.hash)}function C(t){return K(t)?t.trim().replace(/^[-_.\W\s]+|[-_.\W\s]+$/g,""):""}function E(t,e){return K(t)?1===t.length?t.toLowerCase():(t=C(t).toLowerCase(),"function"!=typeof e&&(e=function(t){return t}),t.replace(/[-_.\W\s]+(\w|$)/g,(function(t,n){return e(n)}))):""}function M(t){return N(t)&&N(t.hash)}function U(t){return null==t||M(t)&&null!=t.hash}function B(t,e){for(var n=0,a=t.length;n<a;n++)if(t[n]===e)return n;return-1}function L(t,e,n){return M(t)?L(null,t,n):M(e)?L(t,{},e):function(t){return M(t)&&"function"==typeof t.fn&&"function"==typeof t.inverse}(n)?t?n.fn(e):n.inverse(e):t}function R(t){return"function"==typeof t?t.apply(this,[].slice.call(arguments,1)):t}function A(t,e,n,a,i){const o=(new DOMParser).parseFromString(t,"text/html");return Array.from(o.querySelectorAll("a")).forEach((t=>{t.setAttribute("target",e),t.classList.add(null!=n?n:"ai12z-link"),a&&function(t,e,n){let a;if(a="enabled"in e||"values"in e||"applyTo"in e||"behavior"in e?e:{enabled:!0,values:e,behavior:{existingUtmHandling:"skip",ignoreEmpty:!0,lowercaseKeys:!1,urlEncode:!0}},!1===a.enabled)return;if(a.applyTo&&n&&!1===a.applyTo[`${n}Links`])return;const i=t.getAttribute("href");if(!(!i||i.startsWith("#")||i.startsWith("javascript:")||i.startsWith("mailto:")||i.startsWith("tel:")))try{const e=new URL(i,window.location.origin),n=a.values||{},o=a.behavior||{};if(Array.from(e.searchParams.keys()).some((t=>t.toLowerCase().startsWith("utm_")))&&"skip"===o.existingUtmHandling)return;Object.keys(n).forEach((t=>{const a=n[t];if(o.ignoreEmpty&&(!a||""===a.trim()))return;let i=t;o.lowercaseKeys&&(i=i.toLowerCase());let r=a;"merge"===o.existingUtmHandling&&e.searchParams.has(i)||e.searchParams.set(i,r)})),t.setAttribute("href",e.toString())}catch(t){console.warn("Failed to parse URL for UTM parameters:",i,t)}}(t,a,i)})),o.body.innerHTML}function q(t){return new Blob([t]).size}function J(t){const e=new Date;e.setHours(0,0,0,0);const n=new Intl.DateTimeFormat("en-US",{weekday:"long",hour:"numeric",minute:"numeric",hour12:!0}).format(t);return t.toDateString()===e.toDateString()?`Today, ${n.split(" ").slice(1).join(" ")}`:n}function _(t){return{text:"",isUser:!1,id:`chatbot-${w()}`,isLoading:!0,timestamp:(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),images:[],conversationId:t,formModel:{},surveyDomId:""}}function F(t,e=2097152){if(function(){let t=0;for(const e in localStorage)localStorage.hasOwnProperty(e)&&(t+=q(e+(localStorage.getItem(e)||"")));return t}()<=e)return t;let n=[...[...t].sort(((t,e)=>new Date(t.date).getTime()-new Date(e.date).getTime()))],a=q(JSON.stringify(n));for(;a>e&&n.length>1;)n.shift(),a=q(JSON.stringify(n));return a>e&&(n=n.map((t=>(t.messages&&t.messages.length>10&&(t.messages=t.messages.slice(-10)),t)))),n}function W(t){const e=[],n=[];let a=0;const i=/\[control[^\]]*\]/g;let o;for(;null!==(o=i.exec(t));){const i=t.substring(a,o.index);H(i)&&n.push({type:"text",content:i});const r=o[0],s=r.match(/agentDataId="([^"]*)"/),l=r.match(/type="([^"]*)"/);e.push({type:"control",content:r,agentDataId:s?s[1]:null,controlType:l?l[1]:"carousel"}),n.push({type:"control",content:r,agentDataId:s?s[1]:null,controlType:l?l[1]:"carousel"}),a=o.index+o[0].length}const r=t.substring(a);return H(r)&&n.push({type:"text",content:r}),{parts:n,controls:e,hasControls:e.length>0,controlCount:e.length}}function H(t){if(!t)return!1;const e=t.trim();if(!e)return!1;const n=[/^<p><\/p>$/,/^<p>\s*<\/p>$/,/^<p>&nbsp;<\/p>$/,/^<p><br><\/p>$/,/^<p><br\/><\/p>$/,/^<br\s*\/?>$/,/^&nbsp;$/,/^\s*$/];for(const t of n)if(t.test(e))return!1;return!!e.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim()}async function G(t){return sessionStorage.getItem(t)}async function Q(t,e){if(!V(t))return void console.warn(`Invalid URL provided for styles: ${t}. Styles will not be applied.`);const n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",t);const a=e.shadowRoot;a&&a.appendChild(n)}function V(t){if(!t||"string"!=typeof t)return!1;try{return"https:"===new URL(t).protocol}catch(t){return!1}}export{C as A,U as B,R as C,L as D,M as E,B as F,d as G,$ as H,y as I,J,j as K,G as L,b as M,f as N,p as O,u as P,V as Q,P as a,a as b,n as c,F as d,k as e,W as f,z as g,_ as h,Q as i,w as j,o as k,m as l,g as m,I as n,v as o,h as p,O as q,x as r,c as s,T as t,A as u,S as v,N as w,K as x,E as y,D as z}
1
+ import{E as t}from"./p-BNpVu1WU.js";let e=null;function n(e){switch(e=e||t.DATA_MODE){case"local-grpc":return"http://localhost:8080";case"dev-grpc":return"https://socket.ai12z.net";case"local":return"http://127.0.0.1:5000";case"dev":return"https://dev-api.ai12z.net";default:return"https://api.ai12z.net"}}function a(e){return"local-grpc"===(e=e||t.DATA_MODE)?"v2":"legacy"}function i(e){switch(e=e||t.DATA_MODE){case"local":return"http://localhost:3000";case"dev":return"https://dev.ai12z.net";default:return"https://app.ai12z.net"}}function o(){var t,e;return{origin:null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.href,title:null===document||void 0===document?void 0:document.title,userAgent:null===navigator||void 0===navigator?void 0:navigator.userAgent,referrer:null===document||void 0===document?void 0:document.referrer,language:null===navigator||void 0===navigator?void 0:navigator.language,legacyResponse:!1,description:null===(e=document.querySelector('meta[name="description"]'))||void 0===e?void 0:e.getAttribute("content")}}async function r(t){const e=`HTTP error! status: ${t.status}`;try{if((t.headers.get("content-type")||"").includes("application/json")){const n=await t.json();return new Error((null==n?void 0:n.message)||(null==n?void 0:n.error)||(null==n?void 0:n.details)||(null==n?void 0:n.title)||e)}const n=await t.text();return new Error(n||e)}catch(t){return new Error(e)}}async function s(e,n){var a,i;try{const o=Object.assign({},n),s={origin:null===(a=null===window||void 0===window?void 0:window.location)||void 0===a?void 0:a.href,title:null===document||void 0===document?void 0:document.title,userAgent:null===navigator||void 0===navigator?void 0:navigator.userAgent,referrer:null===document||void 0===document?void 0:document.referrer,language:null===navigator||void 0===navigator?void 0:navigator.language,description:null===(i=document.querySelector('meta[name="description"]'))||void 0===i?void 0:i.getAttribute("content")};if(o.apiKey||(o.apiKey=t.DATA_KEY),!o.apiKey)throw new Error('Public Key is required. Please provide using attribute "data-key".');const l=Object.assign(Object.assign({},o),{meta:s});delete l.apiKey;const c=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":o.apiKey},body:JSON.stringify(l)});if(!c.ok)throw await r(c);const d=await c.json();return await d}catch(t){throw t}}async function l(e,n={},a={}){try{const{requireKeyName:i=!0}=a,o=Object.assign({},n);if(o.apiKey||(o.apiKey=t.DATA_KEY),!o.apiKey)throw new Error('Public Key is required. Please provide using attribute "data-key".');if(i&&!o.keyName)throw new Error("Either Key Name or ID is required.");const s=new URLSearchParams;Object.entries(o).forEach((([t,e])=>{"apiKey"!==t&&null!=e&&""!==e&&s.append(t,"object"==typeof e?JSON.stringify(e):String(e))}));const l=s.toString()?`${e}?${s.toString()}`:e,c=await fetch(l,{method:"GET",headers:{"Content-Type":"application/json","x-api-key":o.apiKey}});if(!c.ok)throw await r(c);return(c.headers.get("content-type")||"").includes("application/json")?await c.json():await c.text()}catch(t){throw t}}async function c(t,e,n,a,o){const r=`${i(e)}/api/projects/formSubmission`,l={apiKey:t,keyName:n,data:a,controlType:o};return await s(r,l)}async function d(t,e,a,i){const o=`${n(a)}/bot/audio/transcribe`;return await s(o,{apiKey:t,language:e,audioBase64:i})}async function u(t,e,n){const a=`${i(e)}/api/projects/formSubmission`;return await l(a,{apiKey:t,keyName:n})}async function f(t,e,a,i){const o=`${n(e)}/bot/control`;let r={};if("string"==typeof i&&""!==i.trim())try{r=JSON.parse(i)}catch(t){console.warn("Invalid widget parameters JSON. Falling back to empty object.")}const l={apiKey:t,keyName:a,parameters:r};return await s(o,l)}async function b(t,e,n){const a=`${i(e)}/api/projects/kb/${encodeURIComponent(n)}`;return await l(a,{apiKey:t},{requireKeyName:!1})}async function p(t,e,i){if(!i)return[];try{const a=`${n(e)}/bot/search`,o={apiKey:t,query:i,num_docs:4};return await s(a,o)}catch(t){if("v2"===a(e))return console.warn("Search endpoint not available on v2 backend"),[];throw t}}async function m(t,e,i,o){try{const a=`${n(e)}/bot/synthesize`,r={text:i,apiKey:t,voiceType:o};return await s(a,r)}catch(t){if("v2"===a(e))return console.warn("Synthesize endpoint not available on v2 backend"),null;throw t}}function h(t,e){const n=atob(t),a=new Array(n.length).fill(0).map(((t,e)=>n.charCodeAt(e))),i=new Uint8Array(a);return new Blob([i],{type:e})}function x(t){const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}async function v(t,e,i,o){if(i)try{const a=`${n(e)}/bot/feedback`,r={apiKey:t,insight_id:i,feedback:o};return await s(a,r)}catch(t){if("v2"===a(e))return void console.warn("Feedback endpoint not available on v2 backend");throw t}}function g(t,e=300){let n;return(...a)=>{clearTimeout(n),n=setTimeout((()=>{t.apply(this,a)}),e)}}async function y(t,a){if(null===e)try{const i=`${n(a)}/bot/status`,o=await s(i,{apiKey:t});o&&(e=o.enable)}catch(t){e=!1}return e}function w(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))}function k(t){const e=(new DOMParser).parseFromString(t,"text/html");let n=Array.from(e.querySelectorAll("button")).map(((t,e)=>{const n=t.id||`button-${e}`,a=t.textContent||`Button ${e+1}`;t.id=n;const i=t.getAttribute("onclick");return t.removeAttribute("type"),t.removeAttribute("onclick"),i&&t.setAttribute("data-original-click",i),t.setAttribute("aria-label",a),{id:n,label:a,onClick:()=>alert(`Button ${n} clicked!`)}}));return{body:e.body.innerHTML,buttons:n}}function j(e,a){const{configId:i,apiKey:o,configType:r}=e,l=`${n(a)}/bot/config`;return e.apiKey||(e.apiKey=t.DATA_KEY),s(l,{configId:i,apiKey:o,configType:r})}function S(e,a){const i=`${n(a)}/bot/verify`;return e.apiKey||(e.apiKey=t.DATA_KEY),s(i,e)}function $(){const t="ai12z-visitorId";let e=localStorage.getItem(t);return e||(e=Date.now()+"-"+Math.random().toString(36).substr(2,9),localStorage.setItem(t,e)),"ai12z-"+e}function I(t,e){var n,a,i,o,r,s;const l=null===(a=null===(n=t.controlData)||void 0===n?void 0:n.data.source.carousel)||void 0===a?void 0:a.type,c=document.createElement("item-list");return c.carouselType=l,c.inputType=e,c.customTemplate=t.controlData.template,c.customSource=null===(i=t.controlData)||void 0===i?void 0:i.data.source,c.llm=null===(o=t.controlData)||void 0===o?void 0:o.data.llm,c.isExpanded=t.isExpanded||!1,c.customStyles=(null===(r=t.controlData)||void 0===r?void 0:r.styles)||"",c.customScripts=(null===(s=t.controlData)||void 0===s?void 0:s.scripts)||"",c}function T(t){if("list"===t)return[{name:"list",content:'{{#each items as |item index|}}\n <div class="carousel-card flex flex-col items-start mb-4 bg-white border h-auto border-gray-200 rounded-lg shadow md:flex-row md:max-w-xl dark:border-gray-700" data-index="{{@index}}">\n <div class="relative carousel-container card-image {{#if (gte item.images.length 1)}}w-full{{else}}w-1/2{{/if}}" data-carousel-id="carousel-{{index}}" id="carousel-{{index}}" data-carousel="slide">\n <div class="relative h-64 overflow-hidden">\n {{#each item.images as |image imageIndex|}} \n <img src="{{this}}" alt="Image for {{../title}}" class="card-image object-cover w-full h-96 md:h-auto md:mt-6 md:ml-2 hidden duration-700 ease-in-out" data-carousel-item id="carousel-{{index}}-item-{{imageIndex}}"/> \n {{/each}}\n </div> \n {{#if (lte item.images.length 3)}} \n {{#if (gte item.images.length 1)}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n {{#each images as |image imageIndex|}}\n <button type="button" class="w-3 h-3 rounded-full" aria-current="true" aria-label="Slide {{@index}}" data-carousel-slide-to="{{index}}" id="carousel-{{index}}-indicator-{{imageIndex}}"></button>\n {{/each}}\n </div>\n {{/if}}\n {{else}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-prev id="carousel-{{index}}-prev"></button>\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-next id="carousel-{{index}}-next"></button>\n </div>\n {{/if}}\n </div>\n \n <div class="flex flex-col justify-between p-4 leading-normal">\n <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"> {{{this.title}}}</h5>\n {{#each subTitle}} \n <p class="font-title text-md md:text-xl">{{this}}</p> \n {{/each}}\n <p class="short-description mb-3 font-normal text-gray-700 dark:text-gray-400">{{{this.shortDescription}}}</p>\n <div class="long-description mb-3 font-normal text-gray-700 dark:text-gray-400 hidden">{{{this.description}}}</div>\n {{#if this.description}}\n <button class="read-more text-blue-500 hover:text-blue-700 underline focus:outline-none" data-index="{{@index}}"> Read More </button>\n {{/if}}\n <div class="flex flex-col items-center my-4">\n {{#each buttons}} \n <button class="card-button list-btn uppercase pt-2 pb-1 px-4 flex-grow hover:bg-gradient-to-t md:flex-none" data-id="{{@index}}" data-url="{{this.url}}" data-type="{{this.type}}">\n {{this.label}}</button>\n {{/each}}\n {{#and ../buttonText formSettings}}\n <button class="card-button list-btn uppercase" data-type="panel">{{../buttonText}}</button>\n {{/and}}\n </div>\n </div>\n</div>\n{{/each}}\n<div class="pagination-controls">\n<button class="prev-btn list-btn" {{#unless hasPrev}}disabled{{/unless}}>Prev</button>\n<span> Page {{getcurrentPage}} of {{getPageCount}} </span>\n<button class="next-btn list-btn" {{#unless hasNext}}disabled{{/unless}}>Next</button>\n</div>'},{name:"detail",content:'<div class="flex flex-col items-center justify-center w-full h-full p-4">\n <div class="w-full md:col-span-2 h-fit">\n <dynamic-form form="{{json form}}" formSettings="{{json formSettings}}" theme="{{json theme}}"/>\n </div> \n <div> \n {{#each buttons}} \n <button class="panel-button list-btn text-white" data-id="{{this.index}}" data-type="{{this.type}}">{{this.label}}</button> \n {{/each}}\n </div>\n </div>'}]}function O(t){switch(t){case"list":return[{name:"list",content:'{{#each items as |item index|}}\n <div class="carousel-card flex flex-col items-start mb-4 bg-white border h-auto border-gray-200 rounded-lg shadow md:flex-row dark:border-gray-700" data-index="{{index}}">\n \n <div class="relative md:w-1/3 carousel-container card-image {{#if (gte item.images.length 1)}}w-full{{else}}w-full md:w-1/2{{/if}}" data-carousel-id="carousel-{{index}}" id="carousel-{{index}}" data-carousel="slide">\n <div class="relative h-64 overflow-hidden">\n {{#each item.images as |image imageIndex|}} \n <img src="{{this}}" alt="Image for {{../title}}" class="card-image object-cover w-full h-96 md:h-auto md:mt-6 md:ml-2 hidden duration-700 ease-in-out" data-carousel-item id="carousel-{{index}}-item-{{imageIndex}}"/> \n {{/each}}\n </div> \n {{#if (lte item.images.length 3)}} \n {{#if (gte item.images.length 1)}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n {{#each images as |image imageIndex|}}\n <button type="button" class="w-3 h-3 rounded-full" aria-current="true" aria-label="Slide {{@index}}" data-carousel-slide-to="{{index}}" id="carousel-{{index}}-indicator-{{imageIndex}}"></button>\n {{/each}}\n </div>\n {{/if}}\n {{else}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-prev id="carousel-{{index}}-prev"></button>\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-next id="carousel-{{index}}-next"></button>\n </div>\n {{/if}}\n </div>\n \n \n \n <div class="flex flex-col justify-between p-4 leading-normal md:w-2/3 card-right">\n <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"> {{{this.title}}}</h5>\n {{#each subTitle}} \n <p class="font-title text-md md:text-xl">{{this}}</p> \n {{/each}}\n <p class="short-description mb-3 font-normal text-gray-700 dark:text-gray-400">{{{this.shortDescription}}}</p>\n <div class="long-description mb-3 font-normal text-gray-700 dark:text-gray-400 hidden">{{{this.description}}}</div>\n {{#if this.description}}\n <a class="read-more text-blue-500 hover:text-blue-700 underline focus:outline-none" data-index="{{@index}}"> Read More </a>\n {{/if}}\n <div class="flex items-center my-4">\n {{#each buttons as |button buttonIndex|}} \n <button class="card-button list-btn uppercase pt-2 pb-1 px-4 flex-grow hover:bg-gradient-to-t md:flex-none" data-id="{{buttonIndex}}" data-url="{{this.url}}" data-type="{{this.type}}">\n {{this.label}}</button>\n {{/each}}\n {{#and ../buttonText formSettings}}\n <button class="card-button list-btn uppercase" data-type="panel">{{../buttonText}}</button>\n {{/and}}\n </div>\n </div>\n</div>\n{{/each}}\n<div class="pagination-controls">\n<button class="prev-btn list-btn" {{#unless hasPrev}}disabled{{/unless}}>Prev</button>\n<span> Page {{getcurrentPage}} of {{getPageCount}} </span>\n<button class="next-btn list-btn" {{#unless hasNext}}disabled{{/unless}}>Next</button>\n</div>\n'},{name:"detail",content:'\n <div class="flex flex-col items-center justify-center w-full h-full p-4">\n <div class="w-full md:col-span-2 h-fit">\n <dynamic-form form="{{json form}}" formSettings="{{json formSettings}}" theme="{{theme}}"/>\n </div> \n <div> \n {{#each buttons}} \n <button class="panel-button list-btn text-white" data-id="{{this.index}}" data-type="{{this.type}}">{{this.label}}</button> \n {{/each}}\n </div>\n </div>'}];case"slider":return[{name:"carousel",content:'\n<div id="carouselExample" class="relative w-full" data-carousel="static">\n \n <div class="carousel-box relative bg-white overflow-hidden overflow-y-scroll h-56 rounded-lg md:h-96" style={ overflowY: "scroll", height: "30rem" }>\n {{#each items as |item index|}}\n <div class="carousel-card max-w-sm hidden duration-700 ease-in-out md:max-w-xl" data-carousel-item id="carousel-item-{{index}}" data-index="{{index}}">\n <div class="card-image relative w-full carousel-container" data-carousel-id="carousel-{{index}}" id="carousel-{{index}}" data-carousel="slide">\n <div class="relative h-64 overflow-hidden rounded-lg">\n {{#each item.images as |image imageIndex|}} \n \n <img src="{{this}}" alt="Image for {{../title}}" class="card-image object-cover h-96 hidden duration-700 ease-in-out" data-carousel-item id="carousel-{{index}}-item-{{imageIndex}}"/> \n \n {{/each}}\n </div> \n {{#if (lte item.images.length 3)}} \n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n {{#each images as |image imageIndex|}}\n <button type="button" class="w-3 h-3 rounded-full" aria-current="true" aria-label="Slide {{@index}}" data-carousel-slide-to="{{index}}" id="carousel-{{index}}-indicator-{{imageIndex}}"></button>\n {{/each}}\n </div>\n {{else}}\n <div class="absolute z-30 flex -translate-x-1/2 bottom-5 left-1/2 space-x-3 rtl:space-x-reverse">\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-prev id="carousel-{{index}}-prev"></button>\n <button type="button" class="w-3 h-3 rounded-full bg-blue-600" aria-current="true" aria-label="Slide {{@index}}" data-carousel-next id="carousel-{{index}}-next"></button>\n </div>\n {{/if}}\n </div> \n \n <div class="p-5">\n <a href="#">\n <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{{{title}}}</h5>\n </a>\n <p class="short-description mb-3 font-normal text-gray-700 dark:text-gray-400">{{{shortDescription}}}</p>\n <div class="long-description mb-3 font-normal text-gray-700 dark:text-gray-400 hidden">{{{description}}}</div>\n {{#if description}}\n <a class="read-more inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">\n Read more\n <svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">\n <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>\n </svg>\n </a>\n {{/if}}\n {{#each buttons}}\n <button class="card-button list-btn uppercase pt-2 pb-1 px-4 flex-grow hover:bg-gradient-to-t md:flex-none" data-index="{{@index}}" data-url="{{this.url}}" data-type="{{this.type}}">{{this.label}}</button>\n {{/each}}\n </div>\n </div>\n {{/each}}\n </div>\n\n <div class="absolute z-30 flex overflow-x-auto -translate-x-1/2 space-x-1 rtl:space-x-reverse bottom-5 left-1/2 scrollbar-visible">\n {{#if (lte items.length 5)}} \n {{#each items}}\n <button\n id="carousel-indicator-{{@index}}"\n type="button"\n class="w-2.5 h-2.5 sm:w-3 sm:h-3 md:w-4 md:h-4 rounded-full"\n aria-current="true"\n aria-label="Slide {{@index}}"\n ></button>\n {{/each}}\n {{/if}}\n </div>\n\n \x3c!-- Controls --\x3e\n <button\n type="button"\n class="absolute top-0 left-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none"\n id="data-carousel-prev"\n data-carousel-prev\n >\n <span\n class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-blue-600"\n >\n <svg\n aria-hidden="true"\n class="w-6 h-6 text-white"\n fill="none"\n stroke="currentColor"\n viewBox="0 0 24 24"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n stroke-width="2"\n d="M15 19l-7-7 7-7"\n ></path>\n </svg>\n <span class="sr-only">Previous</span>\n </span>\n </button>\n <button\n type="button"\n class="absolute top-0 right-0 z-30 flex items-center justify-center h-full px-4 cursor-pointer group focus:outline-none"\n id="data-carousel-next"\n data-carousel-next\n >\n <span\n class="inline-flex items-center justify-center w-10 h-10 rounded-full bg-blue-600"\n >\n <svg\n aria-hidden="true"\n class="w-6 h-6 text-white dark:text-gray-800"\n fill="none"\n stroke="currentColor"\n viewBox="0 0 24 24"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n stroke-linecap="round"\n stroke-linejoin="round"\n stroke-width="2"\n d="M9 5l7 7-7 7"\n ></path>\n </svg>\n <span class="sr-only">Next</span>\n </span>\n </button>\n</div>'},{name:"detail",content:'\n <div class="flex flex-col items-center justify-center w-full h-full p-4">\n <div class="w-full md:col-span-2 h-fit">\n <dynamic-form form="{{json form}}" formSettings="{{json formSettings}}" theme="{{theme}}"/>\n </div> \n <div> \n {{#each buttons}} \n <button class="panel-button list-btn text-white" data-id="{{this.index}}" data-type="{{this.type}}">{{this.label}}</button> \n {{/each}}\n </div>\n </div>'}]}}function P(){return(navigator.language||navigator.userLanguage).split("-")[0]}function z(t){const e=new Set;return function t(n){if(Array.isArray(n))n.forEach((e=>t(e)));else if("object"==typeof n&&null!==n){(function(t){return"object"==typeof t&&null!==t&&Object.keys(t).length>0&&Object.values(t).every((t=>"string"==typeof t))})(n)&&Object.keys(n).includes("default")&&Object.keys(n).forEach((t=>e.add(t)));for(const e in n)t(n[e])}}(t),e}function K(t){return"string"==typeof t}function N(t){return"object"==typeof t&&null!==t}function D(t,e){return Object.assign({},t&&t.options?t.options:{},e.hash)}function C(t){return K(t)?t.trim().replace(/^[-_.\W\s]+|[-_.\W\s]+$/g,""):""}function E(t,e){return K(t)?1===t.length?t.toLowerCase():(t=C(t).toLowerCase(),"function"!=typeof e&&(e=function(t){return t}),t.replace(/[-_.\W\s]+(\w|$)/g,(function(t,n){return e(n)}))):""}function M(t){return N(t)&&N(t.hash)}function U(t){return null==t||M(t)&&null!=t.hash}function B(t,e){for(var n=0,a=t.length;n<a;n++)if(t[n]===e)return n;return-1}function L(t,e,n){return M(t)?L(null,t,n):M(e)?L(t,{},e):function(t){return M(t)&&"function"==typeof t.fn&&"function"==typeof t.inverse}(n)?t?n.fn(e):n.inverse(e):t}function R(t){return"function"==typeof t?t.apply(this,[].slice.call(arguments,1)):t}function A(t,e,n,a,i){const o=(new DOMParser).parseFromString(t,"text/html");return Array.from(o.querySelectorAll("a")).forEach((t=>{t.setAttribute("target",e),t.classList.add(null!=n?n:"ai12z-link"),a&&function(t,e,n){let a;if(a="enabled"in e||"values"in e||"applyTo"in e||"behavior"in e?e:{enabled:!0,values:e,behavior:{existingUtmHandling:"skip",ignoreEmpty:!0,lowercaseKeys:!1,urlEncode:!0}},!1===a.enabled)return;if(a.applyTo&&n&&!1===a.applyTo[`${n}Links`])return;const i=t.getAttribute("href");if(!(!i||i.startsWith("#")||i.startsWith("javascript:")||i.startsWith("mailto:")||i.startsWith("tel:")))try{const e=new URL(i,window.location.origin),n=a.values||{},o=a.behavior||{};if(Array.from(e.searchParams.keys()).some((t=>t.toLowerCase().startsWith("utm_")))&&"skip"===o.existingUtmHandling)return;Object.keys(n).forEach((t=>{const a=n[t];if(o.ignoreEmpty&&(!a||""===a.trim()))return;let i=t;o.lowercaseKeys&&(i=i.toLowerCase());let r=a;"merge"===o.existingUtmHandling&&e.searchParams.has(i)||e.searchParams.set(i,r)})),t.setAttribute("href",e.toString())}catch(t){console.warn("Failed to parse URL for UTM parameters:",i,t)}}(t,a,i)})),o.body.innerHTML}function q(t){return new Blob([t]).size}function J(t){const e=new Date;e.setHours(0,0,0,0);const n=new Intl.DateTimeFormat("en-US",{weekday:"long",hour:"numeric",minute:"numeric",hour12:!0}).format(t);return t.toDateString()===e.toDateString()?`Today, ${n.split(" ").slice(1).join(" ")}`:n}function _(t){return{text:"",isUser:!1,id:`chatbot-${w()}`,isLoading:!0,timestamp:(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),images:[],conversationId:t,formModel:{},surveyDomId:""}}function F(t,e=2097152){if(function(){let t=0;for(const e in localStorage)localStorage.hasOwnProperty(e)&&(t+=q(e+(localStorage.getItem(e)||"")));return t}()<=e)return t;let n=[...[...t].sort(((t,e)=>new Date(t.date).getTime()-new Date(e.date).getTime()))],a=q(JSON.stringify(n));for(;a>e&&n.length>1;)n.shift(),a=q(JSON.stringify(n));return a>e&&(n=n.map((t=>(t.messages&&t.messages.length>10&&(t.messages=t.messages.slice(-10)),t)))),n}function W(t){const e=[],n=[];let a=0;const i=/\[control[^\]]*\]/g;let o;for(;null!==(o=i.exec(t));){const i=t.substring(a,o.index);H(i)&&n.push({type:"text",content:i});const r=o[0],s=r.match(/agentDataId="([^"]*)"/),l=r.match(/type="([^"]*)"/);e.push({type:"control",content:r,agentDataId:s?s[1]:null,controlType:l?l[1]:"carousel"}),n.push({type:"control",content:r,agentDataId:s?s[1]:null,controlType:l?l[1]:"carousel"}),a=o.index+o[0].length}const r=t.substring(a);return H(r)&&n.push({type:"text",content:r}),{parts:n,controls:e,hasControls:e.length>0,controlCount:e.length}}function H(t){if(!t)return!1;const e=t.trim();if(!e)return!1;const n=[/^<p><\/p>$/,/^<p>\s*<\/p>$/,/^<p>&nbsp;<\/p>$/,/^<p><br><\/p>$/,/^<p><br\/><\/p>$/,/^<br\s*\/?>$/,/^&nbsp;$/,/^\s*$/];for(const t of n)if(t.test(e))return!1;return!!e.replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").trim()}async function G(t){return sessionStorage.getItem(t)}async function Q(t,e){if(!V(t))return void console.warn(`Invalid URL provided for styles: ${t}. Styles will not be applied.`);const n=document.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("href",t);const a=e.shadowRoot;a&&a.appendChild(n)}function V(t){if(!t||"string"!=typeof t)return!1;try{return"https:"===new URL(t).protocol}catch(t){return!1}}export{D as A,C as B,U as C,R as D,L as E,M as F,B as G,d as H,$ as I,y as J,J as K,j as L,G as M,b as N,f as O,p as P,u as Q,P as a,a as b,n as c,F as d,Q as e,k as f,z as g,W as h,V as i,_ as j,w as k,o as l,m,g as n,I as o,v as p,h as q,x as r,c as s,O as t,A as u,S as v,T as w,N as x,K as y,E as z}