@askly/widget 3.3.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/loader.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";function t(t,e=[],o=[]){return e.length>0?e.some(e=>t.startsWith(e)):!(o.length>0)||!o.some(e=>t.startsWith(e))}const e="askly_scope_",o={};function n(t){delete o[t];try{window.localStorage.removeItem(t)}catch{}}function a(t){const r=t||"detect",s=function(t){var e;try{const e=window.localStorage.getItem(t);if(null!==e)return e}catch{}return null!==(e=o[t])&&void 0!==e?e:null}(e+r);s&&s!==r&&a(s),n("askly_visitor_"+r),n("askly_threads_"+r);for(const t of Object.keys(o))t.includes(r)&&!t.startsWith(e)&&delete o[t];try{const t=[];for(let e=0;e<window.localStorage.length;e++){const o=window.localStorage.key(e);o&&o.startsWith(`askly_conversations_${r}`)&&t.push(o)}t.forEach(t=>window.localStorage.removeItem(t))}catch{}}const r=["init","identify","reset","shutdown","unmount","open","close","toggle","show","hide","on","off","once","showSpace","showNewMessage","sendMessage","showArticle","startVoiceInput","stopVoiceInput","update","setLocale","updateTexts"],s={isOpen:!1,getUnreadCount:0,getVisitorId:""},i=["identify","open","toggle","show","showSpace","showNewMessage","sendMessage","showArticle","startVoiceInput","update"],l="#0f172a",d="http://www.w3.org/2000/svg";const u=":host{all:initial}.askly-chat-button{position:fixed;bottom:var(--ob,24px);width:60px;height:60px;border:0;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#fff;background:var(--a,"+l+");border-radius:23%;box-shadow:0 12px 32px rgba(15,23,42,.28),0 4px 10px rgba(15,23,42,.16);z-index:99999;font:28px -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;transition:transform .28s cubic-bezier(.2,.8,.2,1)}.shape-round{border-radius:50%}.askly-chat-button:hover{transform:translateY(-3px) scale(1.05)}.askly-chat-button:focus-visible{outline:3px solid var(--a,"+l+");outline-offset:3px}.r{right:var(--os,24px)}.l{left:var(--os,24px)}@media (max-width:600px){.askly-chat-button{bottom:var(--ob,16px)}.r{right:var(--os,16px)}.l{left:var(--os,16px)}}@media (prefers-reduced-motion:reduce){.askly-chat-button{transition:none}}";function c(t){try{const e=JSON.parse(t||"[]");return Array.isArray(e)&&e.some(t=>t&&Array.isArray(t.messages)&&t.messages.some(t=>t&&"user"===t.role))}catch{return!1}}function p(t,e){const o=t.getAttribute("data-org-server-route")||void 0,n=e=>{const o=t.getAttribute(e);return null===o?void 0:"true"===o};return{appId:e,orgServerRoute:o,organizationName:t.getAttribute("data-org-name")||void 0,position:t.getAttribute("data-position")||void 0,locale:t.getAttribute("data-locale")||void 0,hideLauncher:n("data-hide-launcher"),customLauncherSelector:t.getAttribute("data-custom-launcher-selector")||void 0,offset:(()=>{const e=t.getAttribute("data-offset-bottom"),o=t.getAttribute("data-offset-side");if(null!==e||null!==o)return{bottom:null===e||isNaN(parseInt(e))?void 0:parseInt(e),side:null===o||isNaN(parseInt(o))?void 0:parseInt(o)}})(),themeColor:t.getAttribute("data-theme-color")||void 0,theme:t.getAttribute("data-theme")||void 0,enableVoiceChat:t.getAttribute("data-enable-voice")?"true"===t.getAttribute("data-enable-voice"):void 0,voiceInput:(()=>{const e=t.getAttribute("data-voice-input");return"off"!==e&&"false"!==e&&("review"===e||"auto-send"===e?e:void 0)})(),welcomeMessage:t.getAttribute("data-welcome-message")||void 0,placeholderText:t.getAttribute("data-placeholder-text")||void 0,organizationLogo:t.getAttribute("data-logo")||void 0,buttonIcon:t.getAttribute("data-button-icon")||void 0,buttonShape:t.getAttribute("data-button-shape")||void 0,autoOpen:n("data-auto-open"),greeting:(()=>{if("false"===t.getAttribute("data-greeting"))return!1;const e=t.getAttribute("data-greeting-message")||void 0,o=t.getAttribute("data-greeting-delay"),a=null===o||isNaN(parseInt(o))?void 0:parseInt(o);return void 0!==e||void 0!==a?{message:e,delayMs:a}:n("data-greeting")})(),showTimestamp:n("data-show-timestamp"),soundEnabled:n("data-sound-enabled"),debug:n("data-debug"),soundVolume:t.getAttribute("data-sound-volume")?parseFloat(t.getAttribute("data-sound-volume")):void 0,poweredBy:t.getAttribute("data-powered-by")||void 0,userId:t.getAttribute("data-user-id")||void 0,timestamp:t.getAttribute("data-timestamp")?parseInt(t.getAttribute("data-timestamp")):void 0,signature:t.getAttribute("data-signature")||void 0,turnstileSiteKey:t.getAttribute("data-turnstile-sitekey")||void 0,excludePaths:t.getAttribute("data-exclude-paths")?t.getAttribute("data-exclude-paths").split(",").map(t=>t.trim()):void 0,includePaths:t.getAttribute("data-include-paths")?t.getAttribute("data-include-paths").split(",").map(t=>t.trim()):void 0}}const g="3.3.0",h=`https://unpkg.com/@askly/widget@${g}/dist/app/askly-app.js`,m=window,f=function(){const t=document.currentScript;if(t&&t.src)return t;const e=Array.from(document.querySelectorAll("script[src]")).filter(t=>/(^|\/)(widget|loader)\.js([?#]|$)/.test(t.src));return e.find(t=>t.hasAttribute("data-app-id")||t.hasAttribute("data-widget-id")||t.hasAttribute("data-org-id"))||e[0]||null}();let b;var y,v,w;m.Askly&&"function"==typeof m.Askly.init?(b=m.Askly,3===b.v&&b.q||console.warn("[Askly] The widget script is included twice; the second copy is ignored.")):(b=function(e){let o=e;const n={q:[],v:3,_r:[],_t:0};let p=null,g=!1,h=null,m=!1,f=null,b=[],y=!1,v=!1;const w=(...t)=>{h&&h.debug&&console.log("[Askly]",...t)},A=t=>t&&(t.appId||t.widgetId||t.orgId)||"detect",k=()=>{b.forEach(clearTimeout),b=[],f&&f.remove(),f=null},S=()=>{if(!h)return g=!0,Promise.resolve();if(!p){const t=(e,o)=>(w("Loading the widget from",e),import(/* webpackIgnore: true */ /* @vite-ignore */e).catch(n=>{if(o&&o!==e)return console.warn(`[Askly] Could not load the widget from ${e}; trying ${o}.`),t(o);p=null,k(),console.error("[Askly] The widget could not be loaded:",n)}));p=t(o.appUrl,o.fallbackUrl)}return p};let x=!1;const I=(t,e)=>{if("undefined"==typeof document||f)return;if(!document.body)return void document.addEventListener("DOMContentLoaded",()=>{!m||f||p||_(t)},{once:!0});const o=t.themeColor||e&&e.themeColor||l,a=t.buttonShape||e&&e.buttonShape||"round";f=document.createElement("askly-loader");const r=f.attachShadow({mode:"open"});let s=!1;try{const t=new CSSStyleSheet;t.replaceSync(u),r.adoptedStyleSheets=[t],s=!0}catch{}if(!s){const t=document.createElement("style");t.textContent=u,r.appendChild(t)}const i=document.createElement("button");i.className=`askly-chat-button shape-${a} ${"left"===t.position?"l":"r"}`,i.type="button",i.setAttribute("aria-label","Open support chat"),i.setAttribute("aria-expanded","false"),i.setAttribute("lang","en"),i.title="Open support chat",i.style.setProperty("--a",`var(--askly-brand, ${o})`),t.offset&&"number"==typeof t.offset.bottom&&i.style.setProperty("--ob",`${t.offset.bottom}px`),t.offset&&"number"==typeof t.offset.side&&i.style.setProperty("--os",`${t.offset.side}px`),t.buttonIcon&&"💬"!==t.buttonIcon?i.textContent=t.buttonIcon:i.appendChild(function(){const t=document.createElementNS(d,"svg");t.setAttribute("width","32"),t.setAttribute("height","32"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none");const e=document.createElementNS(d,"g");e.setAttribute("transform","translate(24 0) scale(-1 1)");const o=document.createElementNS(d,"path");return o.setAttribute("fill","currentColor"),o.setAttribute("fill-rule","evenodd"),o.setAttribute("clip-rule","evenodd"),o.setAttribute("d","M16 2H8C4 2 2 4 2 8V21C2 21.55 2.45 22 3 22H16C20 22 22 20 22 16V8C22 4 20 2 16 2ZM15.5 12.75H8.5C8.09 12.75 7.75 12.41 7.75 12C7.75 11.59 8.09 11.25 8.5 11.25H15.5C15.91 11.25 16.25 11.59 16.25 12C16.25 12.41 15.91 12.75 15.5 12.75Z"),e.appendChild(o),t.appendChild(e),t}()),i.addEventListener("mouseenter",()=>{S()}),i.addEventListener("focus",()=>{S()}),i.addEventListener("click",()=>{n.open()}),r.appendChild(i),document.body.appendChild(f)};let C=!1;const _=t=>{C=!0;const e=t.appId||t.widgetId||t.orgId,a=(t.orgServerRoute||"https://api.askly.co.in/api/messages/widget").replace(/\/widget$/,""),r=`askly_config_${e||"detect"}`;let s=null;try{s=JSON.parse(sessionStorage.getItem(r)||"null")}catch{}t.hideLauncher||I(t,s);let i=null;const l=o=>{i&&clearTimeout(i),i=null;const a=t.greeting;if(!0!==a&&(!1===a||o&&!1===o.greetingEnabled)||t.hideLauncher||function(t){try{return"1"===window.sessionStorage.getItem(`askly_greeting_dismissed_${t}`)}catch{return!1}}(e||"detect"))return;const r="object"==typeof a&&"number"==typeof a.delayMs?a.delayMs:o&&"number"==typeof o.greetingDelayMs?o.greetingDelayMs:3e3;i=setTimeout(()=>{S()},Math.max(0,r-400-(Date.now()-n._t))),b.push(i)};l(s);let d=!1;try{const t=`askly_conversations_${e||"detect"}`;for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e)||"";if(0===o.indexOf(t)&&c(localStorage.getItem(o))){d=!0;break}}}catch{}(t=>{const e=window.requestIdleCallback;e?e(t,{timeout:4e3}):b.push(setTimeout(t,1500))})(()=>{m&&!p&&(d?S():((()=>{if(p||x||"undefined"==typeof document)return;x=!0;const t=document.createElement("link");t.rel="modulepreload",t.href=o.appUrl,document.head.appendChild(t)})(),s||y||(y=!0,fetch(`${a}/widget/config${e?`?org_id=${encodeURIComponent(e)}`:""}`).then(t=>t.ok?t.json():null).then(e=>{if(e&&m){try{sessionStorage.setItem(r,JSON.stringify(e))}catch{}if(e.disabled)return w("Disabled by configuration."),k(),n.q=null,void(m=!1);p||(f&&!t.hideLauncher&&(f.remove(),f=null,I(t,e)),l(e))}}).catch(()=>{}))))})};let E=!1;const $=e=>{if(E||!e.includePaths&&!e.excludePaths)return;E=!0;const o=()=>{m&&!p&&(t(window.location.pathname,e.includePaths,e.excludePaths)?C||_(e):(k(),C=!1))},n=t=>{const e=history[t];history[t]=function(...t){const n=e.apply(this,t);return setTimeout(o,0),n}};n("pushState"),n("replaceState"),window.addEventListener("popstate",o)};return r.forEach(e=>{const r=(...s)=>n[e]!==r?n[e](...s):(n.q&&n.q.push([e,s]),"init"===e?((e={})=>{if(h=e,m=!0,n._t=Date.now(),e.appUrl&&(o={...o,appUrl:e.appUrl}),e.appId||e.widgetId||e.orgId||console.error("[Askly] Missing required `appId`. The widget cannot load without it."),"undefined"!=typeof window){if(g||e.autoOpen||e.userId)return g=!1,void S();if($(e),e.customLauncherSelector&&!v){let t=!0;try{document.querySelector(e.customLauncherSelector)}catch{t=!1}t||console.warn(`[Askly] customLauncherSelector is not a valid selector: ${e.customLauncherSelector}`),v=!0,t&&document.addEventListener("click",t=>{if(!(m&&h&&h.customLauncherSelector&&n.q))return;const e=t.target;let o=null;try{o=e&&e.closest?e.closest(h.customLauncherSelector):null}catch{return}o&&("A"===o.tagName&&"#"===(o.getAttribute("href")||"#").charAt(0)&&t.preventDefault(),n.q.some(t=>"open"===t[0]||"toggle"===t[0])||n.open())})}t(window.location.pathname,e.includePaths,e.excludePaths)?_(e):w("Hidden on this path.")}})(s[0]):"reset"===e?a(A(h)):"shutdown"===e||"unmount"===e?("shutdown"===e&&a(A(h)),m=!1,k(),n.q=[]):-1!==i.indexOf(e)&&S(),"on"===e||"once"===e?()=>{n.q?n.q=n.q.filter(t=>!(t[0]===e&&t[1][0]===s[0]&&t[1][1]===s[1])):n.off(s[0],s[1])}:void 0);n[e]=r}),Object.keys(s).forEach(t=>{const e=()=>n[t]!==e?n[t]():s[t];n[t]=e}),n.ready=()=>(S(),new Promise(t=>n._r.push(t))),n._unpaint=k,n}({appUrl:(y=f&&f.src,v=g,w=h,y?y.replace(/[?#].*$/,"").replace(/[^/]*$/,"").replace(/(\/@askly\/widget)(@[^/]*)?(\/)/,(t,e,o,n)=>`${e}@${v}${n}`)+"app/askly-app.js":w),fallbackUrl:h}),m.Askly=b);const A=function(t){if(t)return t.getAttribute("data-app-id")||t.getAttribute("data-widget-id")||t.getAttribute("data-org-id")||void 0}(f);f&&A&&b.init(p(f,A)),m.customElements&&!m.customElements.get("askly-chat")&&m.customElements.define("askly-chat",class extends HTMLElement{constructor(){super(...arguments),this._gone=null}connectedCallback(){if(this._gone)return clearTimeout(this._gone),void(this._gone=null);const t=this.getAttribute("app-id");if(!t)return;const e=document.createElement("script");Array.from(this.attributes).forEach(t=>e.setAttribute(`data-${t.name}`,t.value)),m.Askly.init(p(e,t))}disconnectedCallback(){this._gone=setTimeout(()=>{this._gone=null,m.Askly.unmount()},0)}})}();
1
+ !function(){"use strict";function t(t,e=[],o=[]){return e.length>0?e.some(e=>t.startsWith(e)):!(o.length>0)||!o.some(e=>t.startsWith(e))}const e="askly_scope_",o={};function n(t){delete o[t];try{window.localStorage.removeItem(t)}catch{}}function a(t){const r=t||"detect",s=function(t){var e;try{const e=window.localStorage.getItem(t);if(null!==e)return e}catch{}return null!==(e=o[t])&&void 0!==e?e:null}(e+r);s&&s!==r&&a(s),n("askly_visitor_"+r),n("askly_threads_"+r);for(const t of Object.keys(o))t.includes(r)&&!t.startsWith(e)&&delete o[t];try{const t=[];for(let e=0;e<window.localStorage.length;e++){const o=window.localStorage.key(e);o&&o.startsWith(`askly_conversations_${r}`)&&t.push(o)}t.forEach(t=>window.localStorage.removeItem(t))}catch{}}const r=["init","identify","reset","shutdown","unmount","open","close","toggle","show","hide","on","off","once","showSpace","showNewMessage","sendMessage","showArticle","startVoiceInput","stopVoiceInput","requestHuman","update","setLocale","updateTexts"],s={isOpen:!1,getUnreadCount:0,getVisitorId:""},i=["identify","open","toggle","show","showSpace","showNewMessage","sendMessage","showArticle","startVoiceInput","requestHuman","update"],l="#0f172a",d="http://www.w3.org/2000/svg";const u=":host{all:initial}.askly-chat-button{position:fixed;bottom:var(--ob,24px);width:60px;height:60px;border:0;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#fff;background:var(--a,"+l+");border-radius:23%;box-shadow:0 12px 32px rgba(15,23,42,.28),0 4px 10px rgba(15,23,42,.16);z-index:99999;font:28px -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;transition:transform .28s cubic-bezier(.2,.8,.2,1)}.shape-round{border-radius:50%}.askly-chat-button:hover{transform:translateY(-3px) scale(1.05)}.askly-chat-button:focus-visible{outline:3px solid var(--a,"+l+");outline-offset:3px}.r{right:var(--os,24px)}.l{left:var(--os,24px)}@media (max-width:600px){.askly-chat-button{bottom:var(--ob,16px)}.r{right:var(--os,16px)}.l{left:var(--os,16px)}}@media (prefers-reduced-motion:reduce){.askly-chat-button{transition:none}}";function c(t){try{const e=JSON.parse(t||"[]");return Array.isArray(e)&&e.some(t=>t&&Array.isArray(t.messages)&&t.messages.some(t=>t&&"user"===t.role))}catch{return!1}}function p(t,e){const o=t.getAttribute("data-org-server-route")||void 0,n=e=>{const o=t.getAttribute(e);return null===o?void 0:"true"===o};return{appId:e,orgServerRoute:o,organizationName:t.getAttribute("data-org-name")||void 0,position:t.getAttribute("data-position")||void 0,locale:t.getAttribute("data-locale")||void 0,hideLauncher:n("data-hide-launcher"),customLauncherSelector:t.getAttribute("data-custom-launcher-selector")||void 0,offset:(()=>{const e=t.getAttribute("data-offset-bottom"),o=t.getAttribute("data-offset-side");if(null!==e||null!==o)return{bottom:null===e||isNaN(parseInt(e))?void 0:parseInt(e),side:null===o||isNaN(parseInt(o))?void 0:parseInt(o)}})(),themeColor:t.getAttribute("data-theme-color")||void 0,theme:t.getAttribute("data-theme")||void 0,enableVoiceChat:t.getAttribute("data-enable-voice")?"true"===t.getAttribute("data-enable-voice"):void 0,voiceInput:(()=>{const e=t.getAttribute("data-voice-input");return"off"!==e&&"false"!==e&&("review"===e||"auto-send"===e?e:void 0)})(),welcomeMessage:t.getAttribute("data-welcome-message")||void 0,placeholderText:t.getAttribute("data-placeholder-text")||void 0,organizationLogo:t.getAttribute("data-logo")||void 0,buttonIcon:t.getAttribute("data-button-icon")||void 0,buttonShape:t.getAttribute("data-button-shape")||void 0,autoOpen:n("data-auto-open"),greeting:(()=>{if("false"===t.getAttribute("data-greeting"))return!1;const e=t.getAttribute("data-greeting-message")||void 0,o=t.getAttribute("data-greeting-delay"),a=null===o||isNaN(parseInt(o))?void 0:parseInt(o);return void 0!==e||void 0!==a?{message:e,delayMs:a}:n("data-greeting")})(),showTimestamp:n("data-show-timestamp"),soundEnabled:n("data-sound-enabled"),debug:n("data-debug"),soundVolume:t.getAttribute("data-sound-volume")?parseFloat(t.getAttribute("data-sound-volume")):void 0,poweredBy:t.getAttribute("data-powered-by")||void 0,userId:t.getAttribute("data-user-id")||void 0,timestamp:t.getAttribute("data-timestamp")?parseInt(t.getAttribute("data-timestamp")):void 0,signature:t.getAttribute("data-signature")||void 0,turnstileSiteKey:t.getAttribute("data-turnstile-sitekey")||void 0,excludePaths:t.getAttribute("data-exclude-paths")?t.getAttribute("data-exclude-paths").split(",").map(t=>t.trim()):void 0,includePaths:t.getAttribute("data-include-paths")?t.getAttribute("data-include-paths").split(",").map(t=>t.trim()):void 0}}const g="3.5.0",h=`https://unpkg.com/@askly/widget@${g}/dist/app/askly-app.js`,m=window,f=function(){const t=document.currentScript;if(t&&t.src)return t;const e=Array.from(document.querySelectorAll("script[src]")).filter(t=>/(^|\/)(widget|loader)\.js([?#]|$)/.test(t.src));return e.find(t=>t.hasAttribute("data-app-id")||t.hasAttribute("data-widget-id")||t.hasAttribute("data-org-id"))||e[0]||null}();let b;var y,v,w;m.Askly&&"function"==typeof m.Askly.init?(b=m.Askly,3===b.v&&b.q||console.warn("[Askly] The widget script is included twice; the second copy is ignored.")):(b=function(e){let o=e;const n={q:[],v:3,_r:[],_t:0};let p=null,g=!1,h=null,m=!1,f=null,b=[],y=!1,v=!1;const w=(...t)=>{h&&h.debug&&console.log("[Askly]",...t)},A=t=>t&&(t.appId||t.widgetId||t.orgId)||"detect",k=()=>{b.forEach(clearTimeout),b=[],f&&f.remove(),f=null},S=()=>{if(!h)return g=!0,Promise.resolve();if(!p){const t=(e,o)=>(w("Loading the widget from",e),import(/* webpackIgnore: true */ /* @vite-ignore */e).catch(n=>{if(o&&o!==e)return console.warn(`[Askly] Could not load the widget from ${e}; trying ${o}.`),t(o);p=null,k(),console.error("[Askly] The widget could not be loaded:",n)}));p=t(o.appUrl,o.fallbackUrl)}return p};let x=!1;const I=(t,e)=>{if("undefined"==typeof document||f)return;if(!document.body)return void document.addEventListener("DOMContentLoaded",()=>{!m||f||p||_(t)},{once:!0});const o=t.themeColor||e&&e.themeColor||l,a=t.buttonShape||e&&e.buttonShape||"round";f=document.createElement("askly-loader");const r=f.attachShadow({mode:"open"});let s=!1;try{const t=new CSSStyleSheet;t.replaceSync(u),r.adoptedStyleSheets=[t],s=!0}catch{}if(!s){const t=document.createElement("style");t.textContent=u,r.appendChild(t)}const i=document.createElement("button");i.className=`askly-chat-button shape-${a} ${"left"===t.position?"l":"r"}`,i.type="button",i.setAttribute("aria-label","Open support chat"),i.setAttribute("aria-expanded","false"),i.setAttribute("lang","en"),i.title="Open support chat",i.style.setProperty("--a",`var(--askly-brand, ${o})`),t.offset&&"number"==typeof t.offset.bottom&&i.style.setProperty("--ob",`${t.offset.bottom}px`),t.offset&&"number"==typeof t.offset.side&&i.style.setProperty("--os",`${t.offset.side}px`),t.buttonIcon&&"💬"!==t.buttonIcon?i.textContent=t.buttonIcon:i.appendChild(function(){const t=document.createElementNS(d,"svg");t.setAttribute("width","32"),t.setAttribute("height","32"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none");const e=document.createElementNS(d,"g");e.setAttribute("transform","translate(24 0) scale(-1 1)");const o=document.createElementNS(d,"path");return o.setAttribute("fill","currentColor"),o.setAttribute("fill-rule","evenodd"),o.setAttribute("clip-rule","evenodd"),o.setAttribute("d","M16 2H8C4 2 2 4 2 8V21C2 21.55 2.45 22 3 22H16C20 22 22 20 22 16V8C22 4 20 2 16 2ZM15.5 12.75H8.5C8.09 12.75 7.75 12.41 7.75 12C7.75 11.59 8.09 11.25 8.5 11.25H15.5C15.91 11.25 16.25 11.59 16.25 12C16.25 12.41 15.91 12.75 15.5 12.75Z"),e.appendChild(o),t.appendChild(e),t}()),i.addEventListener("mouseenter",()=>{S()}),i.addEventListener("focus",()=>{S()}),i.addEventListener("click",()=>{n.open()}),r.appendChild(i),document.body.appendChild(f)};let C=!1;const _=t=>{C=!0;const e=t.appId||t.widgetId||t.orgId,a=(t.orgServerRoute||"https://api.askly.co.in/api/messages/widget").replace(/\/widget$/,""),r=`askly_config_${e||"detect"}`;let s=null;try{s=JSON.parse(sessionStorage.getItem(r)||"null")}catch{}t.hideLauncher||I(t,s);let i=null;const l=o=>{i&&clearTimeout(i),i=null;const a=t.greeting;if(!0!==a&&(!1===a||o&&!1===o.greetingEnabled)||t.hideLauncher||function(t){try{return"1"===window.sessionStorage.getItem(`askly_greeting_dismissed_${t}`)}catch{return!1}}(e||"detect"))return;const r="object"==typeof a&&"number"==typeof a.delayMs?a.delayMs:o&&"number"==typeof o.greetingDelayMs?o.greetingDelayMs:3e3;i=setTimeout(()=>{S()},Math.max(0,r-400-(Date.now()-n._t))),b.push(i)};l(s);let d=!1;try{const t=`askly_conversations_${e||"detect"}`;for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e)||"";if(0===o.indexOf(t)&&c(localStorage.getItem(o))){d=!0;break}}}catch{}(t=>{const e=window.requestIdleCallback;e?e(t,{timeout:4e3}):b.push(setTimeout(t,1500))})(()=>{m&&!p&&(d?S():((()=>{if(p||x||"undefined"==typeof document)return;x=!0;const t=document.createElement("link");t.rel="modulepreload",t.href=o.appUrl,document.head.appendChild(t)})(),s||y||(y=!0,fetch(`${a}/widget/config${e?`?org_id=${encodeURIComponent(e)}`:""}`).then(t=>t.ok?t.json():null).then(e=>{if(e&&m){try{sessionStorage.setItem(r,JSON.stringify(e))}catch{}if(e.disabled)return w("Disabled by configuration."),k(),n.q=null,void(m=!1);p||(f&&!t.hideLauncher&&(f.remove(),f=null,I(t,e)),l(e))}}).catch(()=>{}))))})};let E=!1;const $=e=>{if(E||!e.includePaths&&!e.excludePaths)return;E=!0;const o=()=>{m&&!p&&(t(window.location.pathname,e.includePaths,e.excludePaths)?C||_(e):(k(),C=!1))},n=t=>{const e=history[t];history[t]=function(...t){const n=e.apply(this,t);return setTimeout(o,0),n}};n("pushState"),n("replaceState"),window.addEventListener("popstate",o)};return r.forEach(e=>{const r=(...s)=>n[e]!==r?n[e](...s):(n.q&&n.q.push([e,s]),"init"===e?((e={})=>{if(h=e,m=!0,n._t=Date.now(),e.appUrl&&(o={...o,appUrl:e.appUrl}),e.appId||e.widgetId||e.orgId||console.error("[Askly] Missing required `appId`. The widget cannot load without it."),"undefined"!=typeof window){if(g||e.autoOpen||e.userId)return g=!1,void S();if($(e),e.customLauncherSelector&&!v){let t=!0;try{document.querySelector(e.customLauncherSelector)}catch{t=!1}t||console.warn(`[Askly] customLauncherSelector is not a valid selector: ${e.customLauncherSelector}`),v=!0,t&&document.addEventListener("click",t=>{if(!(m&&h&&h.customLauncherSelector&&n.q))return;const e=t.target;let o=null;try{o=e&&e.closest?e.closest(h.customLauncherSelector):null}catch{return}o&&("A"===o.tagName&&"#"===(o.getAttribute("href")||"#").charAt(0)&&t.preventDefault(),n.q.some(t=>"open"===t[0]||"toggle"===t[0])||n.open())})}t(window.location.pathname,e.includePaths,e.excludePaths)?_(e):w("Hidden on this path.")}})(s[0]):"reset"===e?a(A(h)):"shutdown"===e||"unmount"===e?("shutdown"===e&&a(A(h)),m=!1,k(),n.q=[]):-1!==i.indexOf(e)&&S(),"on"===e||"once"===e?()=>{n.q?n.q=n.q.filter(t=>!(t[0]===e&&t[1][0]===s[0]&&t[1][1]===s[1])):n.off(s[0],s[1])}:void 0);n[e]=r}),Object.keys(s).forEach(t=>{const e=()=>n[t]!==e?n[t]():s[t];n[t]=e}),n.ready=()=>(S(),new Promise(t=>n._r.push(t))),n._unpaint=k,n}({appUrl:(y=f&&f.src,v=g,w=h,y?y.replace(/[?#].*$/,"").replace(/[^/]*$/,"").replace(/(\/@askly\/widget)(@[^/]*)?(\/)/,(t,e,o,n)=>`${e}@${v}${n}`)+"app/askly-app.js":w),fallbackUrl:h}),m.Askly=b);const A=function(t){if(t)return t.getAttribute("data-app-id")||t.getAttribute("data-widget-id")||t.getAttribute("data-org-id")||void 0}(f);f&&A&&b.init(p(f,A)),m.customElements&&!m.customElements.get("askly-chat")&&m.customElements.define("askly-chat",class extends HTMLElement{constructor(){super(...arguments),this._gone=null}connectedCallback(){if(this._gone)return clearTimeout(this._gone),void(this._gone=null);const t=this.getAttribute("app-id");if(!t)return;const e=document.createElement("script");Array.from(this.attributes).forEach(t=>e.setAttribute(`data-${t.name}`,t.value)),m.Askly.init(p(e,t))}disconnectedCallback(){this._gone=setTimeout(()=>{this._gone=null,m.Askly.unmount()},0)}})}();
@@ -25,6 +25,8 @@ export interface AsklyApi {
25
25
  sendMessage: (text: string) => void;
26
26
  showArticle: (articleId: string) => void;
27
27
  startVoiceInput: () => void;
28
+ /** Ask for a person on the current conversation: the thread goes to your team. */
29
+ requestHuman: (reason?: string) => void;
28
30
  stopVoiceInput: () => void;
29
31
  update: (config: Record<string, any>) => void;
30
32
  /** Switch the widget's language (BCP 47 tag). Applied asynchronously; unknown tags fall back to English. */
@@ -44,6 +44,21 @@ export interface AsklyEventMap {
44
44
  rating: "up" | "down" | null;
45
45
  comment?: string;
46
46
  };
47
+ /** The visitor answered "was this article helpful?". */
48
+ "article:feedback": {
49
+ articleId: string;
50
+ rating: "yes" | "somewhat" | "no";
51
+ };
52
+ /** The visitor asked to talk to a person (or `Askly.requestHuman()` was called). */
53
+ "handoff:requested": {
54
+ conversationId: string;
55
+ };
56
+ /** The visitor opened one of a reply's sources. */
57
+ "citation:opened": {
58
+ id: string;
59
+ title: string;
60
+ articleId?: string;
61
+ };
47
62
  /** A conversation was closed, taken over by an agent, or reopened. */
48
63
  "conversation:status": {
49
64
  conversationId: string;
@@ -117,6 +132,9 @@ export type AsklyCommand = {
117
132
  articleId: string;
118
133
  } | {
119
134
  type: "startVoiceInput";
135
+ } | {
136
+ type: "requestHuman";
137
+ reason?: string;
120
138
  } | {
121
139
  type: "stopVoiceInput";
122
140
  } | {
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The help centre as the widget reads it (servers that list the `help_center` capability),
3
+ * and business hours (servers that list `business_hours`).
4
+ */
5
+ import type { Article, HelpCollection } from "./types";
6
+ /** One article summary or body as GET /widget/help returns it. */
7
+ export declare function toHelpArticle(raw: any, collections: HelpCollection[]): Article | null;
8
+ export declare function toHelpCollection(raw: any): HelpCollection | null;
9
+ /** The top-level ancestor of a collection id (itself when it has no parent or is unknown). */
10
+ export declare function topLevelCollection(id: string, collections: HelpCollection[]): string;
11
+ export interface HoursInterval {
12
+ start: string;
13
+ end: string;
14
+ }
15
+ export interface BusinessHours {
16
+ timezone: string;
17
+ schedule: Record<string, HoursInterval[]>;
18
+ outsideMessage?: string | null;
19
+ open: boolean;
20
+ nextChangeAt?: string | null;
21
+ }
22
+ export declare function toBusinessHours(raw: any): BusinessHours | null;
23
+ /**
24
+ * Whether a person is around now, and when that changes, from the schedule. Falls back to
25
+ * what the server said when the timezone cannot be read in this browser.
26
+ */
27
+ export declare function hoursState(hours: BusinessHours, now?: Date): {
28
+ open: boolean;
29
+ nextChange: Date | null;
30
+ };
31
+ /** "Mon 09:00" style, in the visitor's locale and the visitor's own timezone. */
32
+ export declare function formatNextOpen(at: Date, locale: string): string;
@@ -3,7 +3,7 @@
3
3
  * the browser's copy (see ./storage.ts) is a cache of it plus what has not reached the
4
4
  * server yet: the welcome line, and messages still sending or not sent.
5
5
  */
6
- import type { ConversationStatus, Message, SavedConversation } from "./types";
6
+ import type { Citation, ConversationStatus, Message, SavedConversation } from "./types";
7
7
  /** One message as the widget API returns it. */
8
8
  export interface ServerMessage {
9
9
  role: string;
@@ -16,7 +16,12 @@ export interface ServerMessage {
16
16
  rating?: string | null;
17
17
  comment?: string | null;
18
18
  } | null;
19
+ citations?: any[] | null;
20
+ sender?: {
21
+ name?: string | null;
22
+ } | null;
19
23
  }
24
+ export declare function toCitations(raw: unknown): Citation[];
20
25
  /** One row of GET /widget/conversations. */
21
26
  export interface ServerThread {
22
27
  thread_key: string;
@@ -59,6 +59,15 @@ export interface Message {
59
59
  status?: MessageStatus;
60
60
  attachments?: Attachment[];
61
61
  feedback?: MessageFeedback;
62
+ citations?: Citation[];
63
+ sender?: {
64
+ name: string;
65
+ };
66
+ }
67
+ export interface Citation {
68
+ id: string;
69
+ title: string;
70
+ articleId?: string;
62
71
  }
63
72
  export interface Attachment {
64
73
  url: string;
@@ -86,6 +95,19 @@ export interface Article {
86
95
  content: string;
87
96
  document_type: string;
88
97
  score?: number;
98
+ collection?: string;
99
+ excerpt?: string;
100
+ updatedAt?: string;
101
+ url?: string;
102
+ featured?: boolean;
103
+ source?: "help" | "kb";
104
+ }
105
+ export interface HelpCollection {
106
+ id: string;
107
+ name: string;
108
+ description: string;
109
+ parentId?: string;
110
+ icon: string;
89
111
  }
90
112
  export type WidgetTab = "explore" | "messages" | "help";
91
113
  export interface Faq {
@@ -151,6 +151,16 @@ declare const en: {
151
151
  help_featured_article: string;
152
152
  help_untitled_article: string;
153
153
  help_unavailable: string;
154
+ help_updated_on: string;
155
+ help_open_site: string;
156
+ help_article_unavailable: string;
157
+ citations_label: string;
158
+ handoff_button: string;
159
+ handoff_requesting: string;
160
+ handoff_unavailable: string;
161
+ handoff_failed: string;
162
+ hours_away_until: string;
163
+ hours_away: string;
154
164
  link_opens_new_tab: string;
155
165
  error_search_rate_limited: string;
156
166
  error_search_unavailable: string;
@@ -28,5 +28,7 @@ export declare function t(key: MessageKey, params?: Params): string;
28
28
  /** A plural string: `key_one` / `key_other` (and `_zero`, `_two`, `_few`, `_many` when a pack has them). */
29
29
  export declare function tn(key: string, count: number, params?: Params): string;
30
30
  export declare function formatNumber(n: number): string;
31
+ /** A calendar date ("3 Oct 2026") in the visitor's locale. */
32
+ export declare function formatDate(dateAny: any): string;
31
33
  /** A clock time (today) or a short date (earlier) in the visitor's locale. */
32
34
  export declare function formatTime(dateAny: any): string;
@@ -1,13 +1,22 @@
1
1
  import React from "react";
2
- import type { WidgetTab, Article } from "../core/types";
2
+ import type { WidgetTab, Article, HelpCollection } from "../core/types";
3
3
  export interface HelpTabProps {
4
4
  allArticles: Article[];
5
+ /** The opened article's body could not be fetched. */
6
+ articleError: boolean;
5
7
  articleFeedback: Record<string, "yes" | "no" | "somewhat">;
8
+ /** The opened article's body is being fetched. */
9
+ articleLoading: boolean;
6
10
  articlesLoading: boolean;
7
11
  handleSearchChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
12
  handleSelectArticle: (article: Article) => void;
13
+ /** Collections from the help centre; empty when the knowledge base is the source. */
14
+ helpCollections: HelpCollection[];
15
+ helpSearchPlaceholder: string | null;
16
+ helpSiteUrl: string | null;
9
17
  organizationLogo: string | undefined;
10
18
  organizationName: string;
19
+ rateArticle: (article: Article, rating: "yes" | "somewhat" | "no") => void;
11
20
  searchError: string | null;
12
21
  searchLoading: boolean;
13
22
  searchQuery: string;
@@ -15,7 +24,6 @@ export interface HelpTabProps {
15
24
  selectedArticle: Article | null;
16
25
  selectedCollection: string | null;
17
26
  setActiveTab: (tab: WidgetTab) => void;
18
- setArticleFeedback: React.Dispatch<React.SetStateAction<Record<string, "yes" | "no" | "somewhat">>>;
19
27
  setInput: React.Dispatch<React.SetStateAction<string>>;
20
28
  setSelectedArticle: (article: Article | null) => void;
21
29
  setSelectedCollection: (collection: string | null) => void;
@@ -1,10 +1,14 @@
1
1
  import React from "react";
2
- import type { Message } from "../core/types";
2
+ import type { Citation, Message } from "../core/types";
3
3
  export interface MessageListProps {
4
4
  /** Which chat is on screen; the comment box and the thanks note belong to one chat. */
5
5
  chatKey: string | null;
6
6
  copiedMsgIndex: string | null;
7
7
  messages: Message[];
8
+ /** Whether a source opens something (an article); otherwise it is shown by title only. */
9
+ canOpenCitation: (c: Citation) => boolean;
10
+ /** Open one of a reply's sources. */
11
+ openCitation: (c: Citation) => void;
8
12
  /** Rate a reply; null withdraws the rating. */
9
13
  rateMessage: (m: Message, rating: "up" | "down" | null, comment?: string) => void | Promise<void>;
10
14
  setCopiedMsgIndex: React.Dispatch<React.SetStateAction<string | null>>;
package/dist/widget.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";function t(t,e=[],o=[]){return e.length>0?e.some(e=>t.startsWith(e)):!(o.length>0)||!o.some(e=>t.startsWith(e))}const e="askly_scope_",o={};function n(t){delete o[t];try{window.localStorage.removeItem(t)}catch{}}function a(t){const r=t||"detect",s=function(t){var e;try{const e=window.localStorage.getItem(t);if(null!==e)return e}catch{}return null!==(e=o[t])&&void 0!==e?e:null}(e+r);s&&s!==r&&a(s),n("askly_visitor_"+r),n("askly_threads_"+r);for(const t of Object.keys(o))t.includes(r)&&!t.startsWith(e)&&delete o[t];try{const t=[];for(let e=0;e<window.localStorage.length;e++){const o=window.localStorage.key(e);o&&o.startsWith(`askly_conversations_${r}`)&&t.push(o)}t.forEach(t=>window.localStorage.removeItem(t))}catch{}}const r=["init","identify","reset","shutdown","unmount","open","close","toggle","show","hide","on","off","once","showSpace","showNewMessage","sendMessage","showArticle","startVoiceInput","stopVoiceInput","update","setLocale","updateTexts"],s={isOpen:!1,getUnreadCount:0,getVisitorId:""},i=["identify","open","toggle","show","showSpace","showNewMessage","sendMessage","showArticle","startVoiceInput","update"],l="#0f172a",d="http://www.w3.org/2000/svg";const u=":host{all:initial}.askly-chat-button{position:fixed;bottom:var(--ob,24px);width:60px;height:60px;border:0;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#fff;background:var(--a,"+l+");border-radius:23%;box-shadow:0 12px 32px rgba(15,23,42,.28),0 4px 10px rgba(15,23,42,.16);z-index:99999;font:28px -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;transition:transform .28s cubic-bezier(.2,.8,.2,1)}.shape-round{border-radius:50%}.askly-chat-button:hover{transform:translateY(-3px) scale(1.05)}.askly-chat-button:focus-visible{outline:3px solid var(--a,"+l+");outline-offset:3px}.r{right:var(--os,24px)}.l{left:var(--os,24px)}@media (max-width:600px){.askly-chat-button{bottom:var(--ob,16px)}.r{right:var(--os,16px)}.l{left:var(--os,16px)}}@media (prefers-reduced-motion:reduce){.askly-chat-button{transition:none}}";function c(t){try{const e=JSON.parse(t||"[]");return Array.isArray(e)&&e.some(t=>t&&Array.isArray(t.messages)&&t.messages.some(t=>t&&"user"===t.role))}catch{return!1}}function p(t,e){const o=t.getAttribute("data-org-server-route")||void 0,n=e=>{const o=t.getAttribute(e);return null===o?void 0:"true"===o};return{appId:e,orgServerRoute:o,organizationName:t.getAttribute("data-org-name")||void 0,position:t.getAttribute("data-position")||void 0,locale:t.getAttribute("data-locale")||void 0,hideLauncher:n("data-hide-launcher"),customLauncherSelector:t.getAttribute("data-custom-launcher-selector")||void 0,offset:(()=>{const e=t.getAttribute("data-offset-bottom"),o=t.getAttribute("data-offset-side");if(null!==e||null!==o)return{bottom:null===e||isNaN(parseInt(e))?void 0:parseInt(e),side:null===o||isNaN(parseInt(o))?void 0:parseInt(o)}})(),themeColor:t.getAttribute("data-theme-color")||void 0,theme:t.getAttribute("data-theme")||void 0,enableVoiceChat:t.getAttribute("data-enable-voice")?"true"===t.getAttribute("data-enable-voice"):void 0,voiceInput:(()=>{const e=t.getAttribute("data-voice-input");return"off"!==e&&"false"!==e&&("review"===e||"auto-send"===e?e:void 0)})(),welcomeMessage:t.getAttribute("data-welcome-message")||void 0,placeholderText:t.getAttribute("data-placeholder-text")||void 0,organizationLogo:t.getAttribute("data-logo")||void 0,buttonIcon:t.getAttribute("data-button-icon")||void 0,buttonShape:t.getAttribute("data-button-shape")||void 0,autoOpen:n("data-auto-open"),greeting:(()=>{if("false"===t.getAttribute("data-greeting"))return!1;const e=t.getAttribute("data-greeting-message")||void 0,o=t.getAttribute("data-greeting-delay"),a=null===o||isNaN(parseInt(o))?void 0:parseInt(o);return void 0!==e||void 0!==a?{message:e,delayMs:a}:n("data-greeting")})(),showTimestamp:n("data-show-timestamp"),soundEnabled:n("data-sound-enabled"),debug:n("data-debug"),soundVolume:t.getAttribute("data-sound-volume")?parseFloat(t.getAttribute("data-sound-volume")):void 0,poweredBy:t.getAttribute("data-powered-by")||void 0,userId:t.getAttribute("data-user-id")||void 0,timestamp:t.getAttribute("data-timestamp")?parseInt(t.getAttribute("data-timestamp")):void 0,signature:t.getAttribute("data-signature")||void 0,turnstileSiteKey:t.getAttribute("data-turnstile-sitekey")||void 0,excludePaths:t.getAttribute("data-exclude-paths")?t.getAttribute("data-exclude-paths").split(",").map(t=>t.trim()):void 0,includePaths:t.getAttribute("data-include-paths")?t.getAttribute("data-include-paths").split(",").map(t=>t.trim()):void 0}}const g="3.3.0",h=`https://unpkg.com/@askly/widget@${g}/dist/app/askly-app.js`,m=window,f=function(){const t=document.currentScript;if(t&&t.src)return t;const e=Array.from(document.querySelectorAll("script[src]")).filter(t=>/(^|\/)(widget|loader)\.js([?#]|$)/.test(t.src));return e.find(t=>t.hasAttribute("data-app-id")||t.hasAttribute("data-widget-id")||t.hasAttribute("data-org-id"))||e[0]||null}();let b;var y,v,w;m.Askly&&"function"==typeof m.Askly.init?(b=m.Askly,3===b.v&&b.q||console.warn("[Askly] The widget script is included twice; the second copy is ignored.")):(b=function(e){let o=e;const n={q:[],v:3,_r:[],_t:0};let p=null,g=!1,h=null,m=!1,f=null,b=[],y=!1,v=!1;const w=(...t)=>{h&&h.debug&&console.log("[Askly]",...t)},A=t=>t&&(t.appId||t.widgetId||t.orgId)||"detect",k=()=>{b.forEach(clearTimeout),b=[],f&&f.remove(),f=null},S=()=>{if(!h)return g=!0,Promise.resolve();if(!p){const t=(e,o)=>(w("Loading the widget from",e),import(/* webpackIgnore: true */ /* @vite-ignore */e).catch(n=>{if(o&&o!==e)return console.warn(`[Askly] Could not load the widget from ${e}; trying ${o}.`),t(o);p=null,k(),console.error("[Askly] The widget could not be loaded:",n)}));p=t(o.appUrl,o.fallbackUrl)}return p};let x=!1;const I=(t,e)=>{if("undefined"==typeof document||f)return;if(!document.body)return void document.addEventListener("DOMContentLoaded",()=>{!m||f||p||_(t)},{once:!0});const o=t.themeColor||e&&e.themeColor||l,a=t.buttonShape||e&&e.buttonShape||"round";f=document.createElement("askly-loader");const r=f.attachShadow({mode:"open"});let s=!1;try{const t=new CSSStyleSheet;t.replaceSync(u),r.adoptedStyleSheets=[t],s=!0}catch{}if(!s){const t=document.createElement("style");t.textContent=u,r.appendChild(t)}const i=document.createElement("button");i.className=`askly-chat-button shape-${a} ${"left"===t.position?"l":"r"}`,i.type="button",i.setAttribute("aria-label","Open support chat"),i.setAttribute("aria-expanded","false"),i.setAttribute("lang","en"),i.title="Open support chat",i.style.setProperty("--a",`var(--askly-brand, ${o})`),t.offset&&"number"==typeof t.offset.bottom&&i.style.setProperty("--ob",`${t.offset.bottom}px`),t.offset&&"number"==typeof t.offset.side&&i.style.setProperty("--os",`${t.offset.side}px`),t.buttonIcon&&"💬"!==t.buttonIcon?i.textContent=t.buttonIcon:i.appendChild(function(){const t=document.createElementNS(d,"svg");t.setAttribute("width","32"),t.setAttribute("height","32"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none");const e=document.createElementNS(d,"g");e.setAttribute("transform","translate(24 0) scale(-1 1)");const o=document.createElementNS(d,"path");return o.setAttribute("fill","currentColor"),o.setAttribute("fill-rule","evenodd"),o.setAttribute("clip-rule","evenodd"),o.setAttribute("d","M16 2H8C4 2 2 4 2 8V21C2 21.55 2.45 22 3 22H16C20 22 22 20 22 16V8C22 4 20 2 16 2ZM15.5 12.75H8.5C8.09 12.75 7.75 12.41 7.75 12C7.75 11.59 8.09 11.25 8.5 11.25H15.5C15.91 11.25 16.25 11.59 16.25 12C16.25 12.41 15.91 12.75 15.5 12.75Z"),e.appendChild(o),t.appendChild(e),t}()),i.addEventListener("mouseenter",()=>{S()}),i.addEventListener("focus",()=>{S()}),i.addEventListener("click",()=>{n.open()}),r.appendChild(i),document.body.appendChild(f)};let C=!1;const _=t=>{C=!0;const e=t.appId||t.widgetId||t.orgId,a=(t.orgServerRoute||"https://api.askly.co.in/api/messages/widget").replace(/\/widget$/,""),r=`askly_config_${e||"detect"}`;let s=null;try{s=JSON.parse(sessionStorage.getItem(r)||"null")}catch{}t.hideLauncher||I(t,s);let i=null;const l=o=>{i&&clearTimeout(i),i=null;const a=t.greeting;if(!0!==a&&(!1===a||o&&!1===o.greetingEnabled)||t.hideLauncher||function(t){try{return"1"===window.sessionStorage.getItem(`askly_greeting_dismissed_${t}`)}catch{return!1}}(e||"detect"))return;const r="object"==typeof a&&"number"==typeof a.delayMs?a.delayMs:o&&"number"==typeof o.greetingDelayMs?o.greetingDelayMs:3e3;i=setTimeout(()=>{S()},Math.max(0,r-400-(Date.now()-n._t))),b.push(i)};l(s);let d=!1;try{const t=`askly_conversations_${e||"detect"}`;for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e)||"";if(0===o.indexOf(t)&&c(localStorage.getItem(o))){d=!0;break}}}catch{}(t=>{const e=window.requestIdleCallback;e?e(t,{timeout:4e3}):b.push(setTimeout(t,1500))})(()=>{m&&!p&&(d?S():((()=>{if(p||x||"undefined"==typeof document)return;x=!0;const t=document.createElement("link");t.rel="modulepreload",t.href=o.appUrl,document.head.appendChild(t)})(),s||y||(y=!0,fetch(`${a}/widget/config${e?`?org_id=${encodeURIComponent(e)}`:""}`).then(t=>t.ok?t.json():null).then(e=>{if(e&&m){try{sessionStorage.setItem(r,JSON.stringify(e))}catch{}if(e.disabled)return w("Disabled by configuration."),k(),n.q=null,void(m=!1);p||(f&&!t.hideLauncher&&(f.remove(),f=null,I(t,e)),l(e))}}).catch(()=>{}))))})};let E=!1;const $=e=>{if(E||!e.includePaths&&!e.excludePaths)return;E=!0;const o=()=>{m&&!p&&(t(window.location.pathname,e.includePaths,e.excludePaths)?C||_(e):(k(),C=!1))},n=t=>{const e=history[t];history[t]=function(...t){const n=e.apply(this,t);return setTimeout(o,0),n}};n("pushState"),n("replaceState"),window.addEventListener("popstate",o)};return r.forEach(e=>{const r=(...s)=>n[e]!==r?n[e](...s):(n.q&&n.q.push([e,s]),"init"===e?((e={})=>{if(h=e,m=!0,n._t=Date.now(),e.appUrl&&(o={...o,appUrl:e.appUrl}),e.appId||e.widgetId||e.orgId||console.error("[Askly] Missing required `appId`. The widget cannot load without it."),"undefined"!=typeof window){if(g||e.autoOpen||e.userId)return g=!1,void S();if($(e),e.customLauncherSelector&&!v){let t=!0;try{document.querySelector(e.customLauncherSelector)}catch{t=!1}t||console.warn(`[Askly] customLauncherSelector is not a valid selector: ${e.customLauncherSelector}`),v=!0,t&&document.addEventListener("click",t=>{if(!(m&&h&&h.customLauncherSelector&&n.q))return;const e=t.target;let o=null;try{o=e&&e.closest?e.closest(h.customLauncherSelector):null}catch{return}o&&("A"===o.tagName&&"#"===(o.getAttribute("href")||"#").charAt(0)&&t.preventDefault(),n.q.some(t=>"open"===t[0]||"toggle"===t[0])||n.open())})}t(window.location.pathname,e.includePaths,e.excludePaths)?_(e):w("Hidden on this path.")}})(s[0]):"reset"===e?a(A(h)):"shutdown"===e||"unmount"===e?("shutdown"===e&&a(A(h)),m=!1,k(),n.q=[]):-1!==i.indexOf(e)&&S(),"on"===e||"once"===e?()=>{n.q?n.q=n.q.filter(t=>!(t[0]===e&&t[1][0]===s[0]&&t[1][1]===s[1])):n.off(s[0],s[1])}:void 0);n[e]=r}),Object.keys(s).forEach(t=>{const e=()=>n[t]!==e?n[t]():s[t];n[t]=e}),n.ready=()=>(S(),new Promise(t=>n._r.push(t))),n._unpaint=k,n}({appUrl:(y=f&&f.src,v=g,w=h,y?y.replace(/[?#].*$/,"").replace(/[^/]*$/,"").replace(/(\/@askly\/widget)(@[^/]*)?(\/)/,(t,e,o,n)=>`${e}@${v}${n}`)+"app/askly-app.js":w),fallbackUrl:h}),m.Askly=b);const A=function(t){if(t)return t.getAttribute("data-app-id")||t.getAttribute("data-widget-id")||t.getAttribute("data-org-id")||void 0}(f);f&&A&&b.init(p(f,A)),m.customElements&&!m.customElements.get("askly-chat")&&m.customElements.define("askly-chat",class extends HTMLElement{constructor(){super(...arguments),this._gone=null}connectedCallback(){if(this._gone)return clearTimeout(this._gone),void(this._gone=null);const t=this.getAttribute("app-id");if(!t)return;const e=document.createElement("script");Array.from(this.attributes).forEach(t=>e.setAttribute(`data-${t.name}`,t.value)),m.Askly.init(p(e,t))}disconnectedCallback(){this._gone=setTimeout(()=>{this._gone=null,m.Askly.unmount()},0)}})}();
1
+ !function(){"use strict";function t(t,e=[],o=[]){return e.length>0?e.some(e=>t.startsWith(e)):!(o.length>0)||!o.some(e=>t.startsWith(e))}const e="askly_scope_",o={};function n(t){delete o[t];try{window.localStorage.removeItem(t)}catch{}}function a(t){const r=t||"detect",s=function(t){var e;try{const e=window.localStorage.getItem(t);if(null!==e)return e}catch{}return null!==(e=o[t])&&void 0!==e?e:null}(e+r);s&&s!==r&&a(s),n("askly_visitor_"+r),n("askly_threads_"+r);for(const t of Object.keys(o))t.includes(r)&&!t.startsWith(e)&&delete o[t];try{const t=[];for(let e=0;e<window.localStorage.length;e++){const o=window.localStorage.key(e);o&&o.startsWith(`askly_conversations_${r}`)&&t.push(o)}t.forEach(t=>window.localStorage.removeItem(t))}catch{}}const r=["init","identify","reset","shutdown","unmount","open","close","toggle","show","hide","on","off","once","showSpace","showNewMessage","sendMessage","showArticle","startVoiceInput","stopVoiceInput","requestHuman","update","setLocale","updateTexts"],s={isOpen:!1,getUnreadCount:0,getVisitorId:""},i=["identify","open","toggle","show","showSpace","showNewMessage","sendMessage","showArticle","startVoiceInput","requestHuman","update"],l="#0f172a",d="http://www.w3.org/2000/svg";const u=":host{all:initial}.askly-chat-button{position:fixed;bottom:var(--ob,24px);width:60px;height:60px;border:0;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#fff;background:var(--a,"+l+");border-radius:23%;box-shadow:0 12px 32px rgba(15,23,42,.28),0 4px 10px rgba(15,23,42,.16);z-index:99999;font:28px -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;transition:transform .28s cubic-bezier(.2,.8,.2,1)}.shape-round{border-radius:50%}.askly-chat-button:hover{transform:translateY(-3px) scale(1.05)}.askly-chat-button:focus-visible{outline:3px solid var(--a,"+l+");outline-offset:3px}.r{right:var(--os,24px)}.l{left:var(--os,24px)}@media (max-width:600px){.askly-chat-button{bottom:var(--ob,16px)}.r{right:var(--os,16px)}.l{left:var(--os,16px)}}@media (prefers-reduced-motion:reduce){.askly-chat-button{transition:none}}";function c(t){try{const e=JSON.parse(t||"[]");return Array.isArray(e)&&e.some(t=>t&&Array.isArray(t.messages)&&t.messages.some(t=>t&&"user"===t.role))}catch{return!1}}function p(t,e){const o=t.getAttribute("data-org-server-route")||void 0,n=e=>{const o=t.getAttribute(e);return null===o?void 0:"true"===o};return{appId:e,orgServerRoute:o,organizationName:t.getAttribute("data-org-name")||void 0,position:t.getAttribute("data-position")||void 0,locale:t.getAttribute("data-locale")||void 0,hideLauncher:n("data-hide-launcher"),customLauncherSelector:t.getAttribute("data-custom-launcher-selector")||void 0,offset:(()=>{const e=t.getAttribute("data-offset-bottom"),o=t.getAttribute("data-offset-side");if(null!==e||null!==o)return{bottom:null===e||isNaN(parseInt(e))?void 0:parseInt(e),side:null===o||isNaN(parseInt(o))?void 0:parseInt(o)}})(),themeColor:t.getAttribute("data-theme-color")||void 0,theme:t.getAttribute("data-theme")||void 0,enableVoiceChat:t.getAttribute("data-enable-voice")?"true"===t.getAttribute("data-enable-voice"):void 0,voiceInput:(()=>{const e=t.getAttribute("data-voice-input");return"off"!==e&&"false"!==e&&("review"===e||"auto-send"===e?e:void 0)})(),welcomeMessage:t.getAttribute("data-welcome-message")||void 0,placeholderText:t.getAttribute("data-placeholder-text")||void 0,organizationLogo:t.getAttribute("data-logo")||void 0,buttonIcon:t.getAttribute("data-button-icon")||void 0,buttonShape:t.getAttribute("data-button-shape")||void 0,autoOpen:n("data-auto-open"),greeting:(()=>{if("false"===t.getAttribute("data-greeting"))return!1;const e=t.getAttribute("data-greeting-message")||void 0,o=t.getAttribute("data-greeting-delay"),a=null===o||isNaN(parseInt(o))?void 0:parseInt(o);return void 0!==e||void 0!==a?{message:e,delayMs:a}:n("data-greeting")})(),showTimestamp:n("data-show-timestamp"),soundEnabled:n("data-sound-enabled"),debug:n("data-debug"),soundVolume:t.getAttribute("data-sound-volume")?parseFloat(t.getAttribute("data-sound-volume")):void 0,poweredBy:t.getAttribute("data-powered-by")||void 0,userId:t.getAttribute("data-user-id")||void 0,timestamp:t.getAttribute("data-timestamp")?parseInt(t.getAttribute("data-timestamp")):void 0,signature:t.getAttribute("data-signature")||void 0,turnstileSiteKey:t.getAttribute("data-turnstile-sitekey")||void 0,excludePaths:t.getAttribute("data-exclude-paths")?t.getAttribute("data-exclude-paths").split(",").map(t=>t.trim()):void 0,includePaths:t.getAttribute("data-include-paths")?t.getAttribute("data-include-paths").split(",").map(t=>t.trim()):void 0}}const g="3.5.0",h=`https://unpkg.com/@askly/widget@${g}/dist/app/askly-app.js`,m=window,f=function(){const t=document.currentScript;if(t&&t.src)return t;const e=Array.from(document.querySelectorAll("script[src]")).filter(t=>/(^|\/)(widget|loader)\.js([?#]|$)/.test(t.src));return e.find(t=>t.hasAttribute("data-app-id")||t.hasAttribute("data-widget-id")||t.hasAttribute("data-org-id"))||e[0]||null}();let b;var y,v,w;m.Askly&&"function"==typeof m.Askly.init?(b=m.Askly,3===b.v&&b.q||console.warn("[Askly] The widget script is included twice; the second copy is ignored.")):(b=function(e){let o=e;const n={q:[],v:3,_r:[],_t:0};let p=null,g=!1,h=null,m=!1,f=null,b=[],y=!1,v=!1;const w=(...t)=>{h&&h.debug&&console.log("[Askly]",...t)},A=t=>t&&(t.appId||t.widgetId||t.orgId)||"detect",k=()=>{b.forEach(clearTimeout),b=[],f&&f.remove(),f=null},S=()=>{if(!h)return g=!0,Promise.resolve();if(!p){const t=(e,o)=>(w("Loading the widget from",e),import(/* webpackIgnore: true */ /* @vite-ignore */e).catch(n=>{if(o&&o!==e)return console.warn(`[Askly] Could not load the widget from ${e}; trying ${o}.`),t(o);p=null,k(),console.error("[Askly] The widget could not be loaded:",n)}));p=t(o.appUrl,o.fallbackUrl)}return p};let x=!1;const I=(t,e)=>{if("undefined"==typeof document||f)return;if(!document.body)return void document.addEventListener("DOMContentLoaded",()=>{!m||f||p||_(t)},{once:!0});const o=t.themeColor||e&&e.themeColor||l,a=t.buttonShape||e&&e.buttonShape||"round";f=document.createElement("askly-loader");const r=f.attachShadow({mode:"open"});let s=!1;try{const t=new CSSStyleSheet;t.replaceSync(u),r.adoptedStyleSheets=[t],s=!0}catch{}if(!s){const t=document.createElement("style");t.textContent=u,r.appendChild(t)}const i=document.createElement("button");i.className=`askly-chat-button shape-${a} ${"left"===t.position?"l":"r"}`,i.type="button",i.setAttribute("aria-label","Open support chat"),i.setAttribute("aria-expanded","false"),i.setAttribute("lang","en"),i.title="Open support chat",i.style.setProperty("--a",`var(--askly-brand, ${o})`),t.offset&&"number"==typeof t.offset.bottom&&i.style.setProperty("--ob",`${t.offset.bottom}px`),t.offset&&"number"==typeof t.offset.side&&i.style.setProperty("--os",`${t.offset.side}px`),t.buttonIcon&&"💬"!==t.buttonIcon?i.textContent=t.buttonIcon:i.appendChild(function(){const t=document.createElementNS(d,"svg");t.setAttribute("width","32"),t.setAttribute("height","32"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none");const e=document.createElementNS(d,"g");e.setAttribute("transform","translate(24 0) scale(-1 1)");const o=document.createElementNS(d,"path");return o.setAttribute("fill","currentColor"),o.setAttribute("fill-rule","evenodd"),o.setAttribute("clip-rule","evenodd"),o.setAttribute("d","M16 2H8C4 2 2 4 2 8V21C2 21.55 2.45 22 3 22H16C20 22 22 20 22 16V8C22 4 20 2 16 2ZM15.5 12.75H8.5C8.09 12.75 7.75 12.41 7.75 12C7.75 11.59 8.09 11.25 8.5 11.25H15.5C15.91 11.25 16.25 11.59 16.25 12C16.25 12.41 15.91 12.75 15.5 12.75Z"),e.appendChild(o),t.appendChild(e),t}()),i.addEventListener("mouseenter",()=>{S()}),i.addEventListener("focus",()=>{S()}),i.addEventListener("click",()=>{n.open()}),r.appendChild(i),document.body.appendChild(f)};let C=!1;const _=t=>{C=!0;const e=t.appId||t.widgetId||t.orgId,a=(t.orgServerRoute||"https://api.askly.co.in/api/messages/widget").replace(/\/widget$/,""),r=`askly_config_${e||"detect"}`;let s=null;try{s=JSON.parse(sessionStorage.getItem(r)||"null")}catch{}t.hideLauncher||I(t,s);let i=null;const l=o=>{i&&clearTimeout(i),i=null;const a=t.greeting;if(!0!==a&&(!1===a||o&&!1===o.greetingEnabled)||t.hideLauncher||function(t){try{return"1"===window.sessionStorage.getItem(`askly_greeting_dismissed_${t}`)}catch{return!1}}(e||"detect"))return;const r="object"==typeof a&&"number"==typeof a.delayMs?a.delayMs:o&&"number"==typeof o.greetingDelayMs?o.greetingDelayMs:3e3;i=setTimeout(()=>{S()},Math.max(0,r-400-(Date.now()-n._t))),b.push(i)};l(s);let d=!1;try{const t=`askly_conversations_${e||"detect"}`;for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e)||"";if(0===o.indexOf(t)&&c(localStorage.getItem(o))){d=!0;break}}}catch{}(t=>{const e=window.requestIdleCallback;e?e(t,{timeout:4e3}):b.push(setTimeout(t,1500))})(()=>{m&&!p&&(d?S():((()=>{if(p||x||"undefined"==typeof document)return;x=!0;const t=document.createElement("link");t.rel="modulepreload",t.href=o.appUrl,document.head.appendChild(t)})(),s||y||(y=!0,fetch(`${a}/widget/config${e?`?org_id=${encodeURIComponent(e)}`:""}`).then(t=>t.ok?t.json():null).then(e=>{if(e&&m){try{sessionStorage.setItem(r,JSON.stringify(e))}catch{}if(e.disabled)return w("Disabled by configuration."),k(),n.q=null,void(m=!1);p||(f&&!t.hideLauncher&&(f.remove(),f=null,I(t,e)),l(e))}}).catch(()=>{}))))})};let E=!1;const $=e=>{if(E||!e.includePaths&&!e.excludePaths)return;E=!0;const o=()=>{m&&!p&&(t(window.location.pathname,e.includePaths,e.excludePaths)?C||_(e):(k(),C=!1))},n=t=>{const e=history[t];history[t]=function(...t){const n=e.apply(this,t);return setTimeout(o,0),n}};n("pushState"),n("replaceState"),window.addEventListener("popstate",o)};return r.forEach(e=>{const r=(...s)=>n[e]!==r?n[e](...s):(n.q&&n.q.push([e,s]),"init"===e?((e={})=>{if(h=e,m=!0,n._t=Date.now(),e.appUrl&&(o={...o,appUrl:e.appUrl}),e.appId||e.widgetId||e.orgId||console.error("[Askly] Missing required `appId`. The widget cannot load without it."),"undefined"!=typeof window){if(g||e.autoOpen||e.userId)return g=!1,void S();if($(e),e.customLauncherSelector&&!v){let t=!0;try{document.querySelector(e.customLauncherSelector)}catch{t=!1}t||console.warn(`[Askly] customLauncherSelector is not a valid selector: ${e.customLauncherSelector}`),v=!0,t&&document.addEventListener("click",t=>{if(!(m&&h&&h.customLauncherSelector&&n.q))return;const e=t.target;let o=null;try{o=e&&e.closest?e.closest(h.customLauncherSelector):null}catch{return}o&&("A"===o.tagName&&"#"===(o.getAttribute("href")||"#").charAt(0)&&t.preventDefault(),n.q.some(t=>"open"===t[0]||"toggle"===t[0])||n.open())})}t(window.location.pathname,e.includePaths,e.excludePaths)?_(e):w("Hidden on this path.")}})(s[0]):"reset"===e?a(A(h)):"shutdown"===e||"unmount"===e?("shutdown"===e&&a(A(h)),m=!1,k(),n.q=[]):-1!==i.indexOf(e)&&S(),"on"===e||"once"===e?()=>{n.q?n.q=n.q.filter(t=>!(t[0]===e&&t[1][0]===s[0]&&t[1][1]===s[1])):n.off(s[0],s[1])}:void 0);n[e]=r}),Object.keys(s).forEach(t=>{const e=()=>n[t]!==e?n[t]():s[t];n[t]=e}),n.ready=()=>(S(),new Promise(t=>n._r.push(t))),n._unpaint=k,n}({appUrl:(y=f&&f.src,v=g,w=h,y?y.replace(/[?#].*$/,"").replace(/[^/]*$/,"").replace(/(\/@askly\/widget)(@[^/]*)?(\/)/,(t,e,o,n)=>`${e}@${v}${n}`)+"app/askly-app.js":w),fallbackUrl:h}),m.Askly=b);const A=function(t){if(t)return t.getAttribute("data-app-id")||t.getAttribute("data-widget-id")||t.getAttribute("data-org-id")||void 0}(f);f&&A&&b.init(p(f,A)),m.customElements&&!m.customElements.get("askly-chat")&&m.customElements.define("askly-chat",class extends HTMLElement{constructor(){super(...arguments),this._gone=null}connectedCallback(){if(this._gone)return clearTimeout(this._gone),void(this._gone=null);const t=this.getAttribute("app-id");if(!t)return;const e=document.createElement("script");Array.from(this.attributes).forEach(t=>e.setAttribute(`data-${t.name}`,t.value)),m.Askly.init(p(e,t))}disconnectedCallback(){this._gone=setTimeout(()=>{this._gone=null,m.Askly.unmount()},0)}})}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askly/widget",
3
- "version": "3.3.0",
3
+ "version": "3.5.0",
4
4
  "description": "Embeddable AI support chat widget for React \u2014 drop-in customer support chatbot with voice, RAG (docs-grounded) answers, and human handoff. One line to install.",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",
@@ -1 +0,0 @@
1
- import{g as e,t,o as l,b as a,r as c,aj as n,ak as s,C as r,d as i,f as o,B as m}from"./shared-keljZg37.js";function p(e){switch(e){case"guide":return{title:t("help_collection_guide_title"),desc:t("help_collection_guide_desc")};case"faq":return{title:t("help_collection_faq_title"),desc:t("help_collection_faq_desc")};case"troubleshooting":return{title:t("help_collection_troubleshooting_title"),desc:t("help_collection_troubleshooting_desc")};default:return{title:t("help_collection_other_title"),desc:t("help_collection_other_desc")}}}function d(d){const{allArticles:h,articleFeedback:u,articlesLoading:E,handleSearchChange:_,handleSelectArticle:y,organizationLogo:f,organizationName:N,searchError:b,searchLoading:k,searchQuery:v,searchResults:g,selectedArticle:x,selectedCollection:w,setActiveTab:C,setArticleFeedback:z,setInput:S,setSelectedArticle:A,setSelectedCollection:L,themeColor:I}=d;return e.createElement("div",{className:"chat-body help-layout"},x?e.createElement("div",{className:"help-article-reader"},e.createElement("div",{className:"article-breadcrumb"},e.createElement("button",{type:"button",className:"article-breadcrumb-link",onClick:()=>{A(null),L(null)}},t("header_help_center")),e.createElement("span",{"aria-hidden":"true"},"/"),e.createElement("span",{className:"article-breadcrumb-type"},x.document_type?p(x.document_type.toLowerCase()).title:t("help_document_type_fallback"))),e.createElement("button",{type:"button",className:"help-back-btn",onClick:()=>A(null),style:{marginBottom:14}},e.createElement(l,{size:16,className:"askly-flip-rtl"}),e.createElement("span",null,t("help_back_to_articles"))),e.createElement("h1",{className:"help-article-heading",tabIndex:-1},x.title),e.createElement("div",{className:"article-author-bar"},e.createElement("img",{src:f||"https://askly.co.in/logo-small.png",alt:N,className:"article-author-avatar"}),e.createElement("div",{className:"article-author-text"},e.createElement("span",{className:"article-author-name"},t("help_written_by",{organizationName:N})),e.createElement("span",{className:"article-author-meta"},t("help_updated_recently")," • ",e.createElement("span",{"aria-hidden":"true"},"⏱ "),a("help_read_time",(q=x.content,Math.max(1,Math.ceil((q||"").split(/\s+/).length/180))))))),e.createElement("div",{className:"help-article-body",dangerouslySetInnerHTML:{__html:c(n(x.content))}}),e.createElement("div",{className:"article-feedback"},e.createElement("div",{className:"article-feedback-title"},t("help_feedback_title")),u[x.id]?e.createElement("div",{className:"article-feedback-thanks",role:"status"},e.createElement("span",{"aria-hidden":"true"},"🎉 "),t("help_feedback_thanks")):e.createElement("div",{className:"article-feedback-options"},e.createElement("button",{type:"button",className:"article-feedback-btn",onClick:()=>z(e=>({...e,[x.id]:"yes"}))},e.createElement("span",{"aria-hidden":"true"},"😃 "),t("help_feedback_yes")),e.createElement("button",{type:"button",className:"article-feedback-btn",onClick:()=>z(e=>({...e,[x.id]:"somewhat"}))},e.createElement("span",{"aria-hidden":"true"},"😐 "),t("help_feedback_somewhat")),e.createElement("button",{type:"button",className:"article-feedback-btn",onClick:()=>z(e=>({...e,[x.id]:"no"}))},e.createElement("span",{"aria-hidden":"true"},"😞 "),t("help_feedback_no"))),e.createElement("button",{type:"button",className:"article-handoff",onClick:()=>{S(t("help_handoff_prefill",{title:x.title})),C("messages")}},e.createElement("div",{className:"article-handoff-text"},e.createElement("span",{className:"article-handoff-title"},e.createElement(s,{size:13})," ",t("help_handoff_title")),e.createElement("span",{className:"article-handoff-desc"},t("help_handoff_desc"))),e.createElement(r,{size:16,className:"article-handoff-chevron askly-flip-rtl"})))):e.createElement("div",null,e.createElement("div",{className:"home-search-input-wrapper",style:{marginBottom:14}},e.createElement(i,{size:14,className:"search-icon-svg"}),e.createElement("input",{type:"text",value:v,onChange:_,placeholder:t("help_search_placeholder"),"aria-label":t("help_search_label")}),k&&e.createElement("span",{className:"search-loader"})),w&&e.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12}},e.createElement("button",{type:"button",onClick:()=>L(null),style:{all:"unset",cursor:"pointer",fontSize:12,color:I,fontWeight:500,display:"flex",alignItems:"center",gap:4}},e.createElement(l,{size:14,className:"askly-flip-rtl"}),e.createElement("span",null,t("help_all_collections"))),e.createElement("span",{style:{fontSize:12,color:"var(--text-4)"},"aria-hidden":"true"},"/"),e.createElement("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-1)",textTransform:"capitalize"}},p(w).title)),e.createElement("div",{className:"help-articles-list"},""===v.trim()?w?(()=>{const l=h.filter(e=>(e.document_type||"guide").toLowerCase()===w.toLowerCase());return e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:10,width:"100%"}},e.createElement("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-3)",textTransform:"uppercase",letterSpacing:"0.5px"}},t("help_collection_articles",{collection:p(w).title,count:o(l.length)})),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:8}},l.map(t=>e.createElement("button",{type:"button",key:t.id,className:"help-article-row",onClick:()=>y(t)},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:3,alignItems:"flex-start",textAlign:"start"}},e.createElement("span",{className:"article-row-title"},t.title),t.content&&e.createElement("span",{className:"article-row-preview"},t.content.replace(/[\n\r]+/g," ").slice(0,85),"…")),e.createElement(r,{size:14,className:"article-row-chevron askly-flip-rtl"})))))})():e.createElement("div",{className:"help-collections"},(()=>{if(E)return[0,1,2].map(t=>e.createElement("div",{key:t,className:"help-collection-card is-skeleton"},e.createElement("div",{className:"help-collection-left"},e.createElement("span",{className:"askly-skeleton help-collection-icon-skel"}),e.createElement("div",{className:"help-collection-text"},e.createElement("span",{className:"askly-skeleton askly-skeleton-line",style:{width:"60%"}}),e.createElement("span",{className:"askly-skeleton askly-skeleton-line",style:{width:"90%"}})))));const l={};h.forEach(e=>{const t=(e.document_type||"guide").toLowerCase();l[t]||(l[t]=[]),l[t].push(e)});const c=Object.keys(l);return 0===c.length?e.createElement("div",{className:"askly-empty-state"},e.createElement("div",{className:"askly-empty-icon"},e.createElement(m,{size:22})),e.createElement("div",{className:"askly-empty-title"},t("help_empty_title")),e.createElement("div",{className:"askly-empty-desc"},t("help_empty_desc"))):c.map(t=>{const c=l[t],{title:n,desc:s}=p(t);return e.createElement("button",{type:"button",key:t,className:"help-collection-card",onClick:()=>L(t)},e.createElement("div",{className:"help-collection-left"},e.createElement("div",{className:"help-collection-icon"},e.createElement(m,{size:16})),e.createElement("div",{className:"help-collection-text"},e.createElement("div",{className:"help-collection-title"},n),e.createElement("div",{className:"help-collection-desc"},s),e.createElement("div",{className:"help-collection-count"},a("help_article_count",c.length)))),e.createElement(r,{size:16,className:"help-collection-chevron askly-flip-rtl"}))})})()):b?e.createElement("div",{className:"no-search-results"},b):0!==g.length||k?g.map(t=>e.createElement("button",{type:"button",key:t.id,className:"help-article-row",onClick:()=>y(t)},e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:3,alignItems:"flex-start",textAlign:"start"}},e.createElement("span",{className:"article-row-title"},t.title),e.createElement("span",{className:"article-row-preview"},t.content.slice(0,80),"…")),e.createElement(r,{size:14,className:"article-row-chevron askly-flip-rtl"}))):e.createElement("div",{className:"no-search-results",role:"status"},t("help_search_no_results",{query:v})))));var q}export{d as HelpTab};
@@ -1 +0,0 @@
1
- var e,t,n,o,r,a,i,s,l,_,u,c,p,f,h,d={},m=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function k(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b(t,n,o){var r,a,i,s={};for(i in n)"key"==i?r=n[i]:"ref"==i?a=n[i]:s[i]=n[i];if(arguments.length>2&&(s.children=arguments.length>3?e.call(arguments,2):o),"function"==typeof t&&null!=t.defaultProps)for(i in t.defaultProps)void 0===s[i]&&(s[i]=t.defaultProps[i]);return w(t,s,r,a,null)}function w(e,o,r,a,i){var s={type:e,props:o,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++n:i,__i:-1,__u:0};return null==i&&null!=t.vnode&&t.vnode(s),s}function C(e){return e.children}function S(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?x(e):null}function N(e){if(e.__P&&e.__d){var n=e.__v,o=n.__e,r=[],a=[],i=y({},n);i.__v=n.__v+1,t.vnode&&t.vnode(i),R(e.__P,i,n,e.__n,e.__P.namespaceURI,32&n.__u?[o]:null,r,null==o?x(n):o,!!(32&n.__u),a),i.__v=n.__v,i.__.__k[i.__i]=i,O(r,i,a),n.__e=n.__=null,i.__e!=o&&M(i)}}function M(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),M(e)}function $(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!E.__r++||r!=t.debounceRendering)&&((r=t.debounceRendering)||a)(E)}function E(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(i),e=o.shift(),t=o.length,N(e)}finally{o.length=E.__r=0}}function H(e,t,n,o,r,a,i,s,l,_,u){var c,p,f,h,g,y,k=o&&o.__k||m,b=t.length;for(l=function(e,t,n,o,r){var a,i,s,l,_,u=n.length,c=u,p=0;for(e.__k=new Array(r),a=0;a<r;a++)null!=(i=t[a])&&"boolean"!=typeof i&&"function"!=typeof i?("string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?i=e.__k[a]=w(null,i,null,null,null):v(i)?i=e.__k[a]=w(C,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?i=e.__k[a]=w(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,l=a+p,i.__=e,i.__b=e.__b+1,s=null,-1!=(_=i.__i=A(i,n,l,c))&&(c--,(s=n[_])&&(s.__u|=2)),null==s||null==s.__v?(-1==_&&(r>u?p--:r<u&&p++),"function"!=typeof i.type&&(i.__u|=4)):_!=l&&(_==l-1?p--:_==l+1?p++:(_>l?p--:p++,i.__u|=4))):e.__k[a]=null;if(c)for(a=0;a<u;a++)null!=(s=n[a])&&!(2&s.__u)&&(s.__e==o&&(o=x(s)),z(s,s));return o}(n,t,k,l,b),c=0;c<b;c++)null!=(f=n.__k[c])&&(p=-1!=f.__i&&k[f.__i]||d,f.__i=c,y=R(e,f,p,r,a,i,s,l,_,u),h=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&j(p.ref,null,f),u.push(f.ref,f.__c||h,f)),null==g&&null!=h&&(g=h),4&f.__u?(l=P(f,l,e),p.__e&&(p.__e=null)):"function"==typeof f.type&&void 0!==y?l=y:h&&(l=h.nextSibling),f.__u&=-7);return n.__e=g,l}function P(e,t,n){var o,r;if("function"==typeof e.type){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=P(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=x(e)),t=n.insertBefore(e.__e,t||null));do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function I(e,t){return t=t||[],null==e||"boolean"==typeof e||(v(e)?e.some(function(e){I(e,t)}):t.push(e)),t}function A(e,t,n,o){var r,a,i,s=e.key,l=e.type,_=t[n],u=null!=_&&!(2&_.__u);if(null===_&&null==s||u&&s==_.key&&l==_.type)return n;if(o>(u?1:0))for(r=n-1,a=n+1;r>=0||a<t.length;)if(null!=(_=t[i=r>=0?r--:a++])&&!(2&_.__u)&&s==_.key&&l==_.type)return i;return-1}function T(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||g.test(t)?n:n+"px"}function U(e,t,n,o,r){var a,i;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||T(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||T(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])a=t!=(t=t.replace(u,"$1")),i=t.toLowerCase(),t=i in e||"onFocusOut"==t||"onFocusIn"==t?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?o?n[_]=o[_]:(n[_]=c,e.addEventListener(t,a?f:p,a)):e.removeEventListener(t,a?f:p,a);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function D(e){return function(n){if(this.l){var o=this.l[n.type+e];if(null==n[l])n[l]=c++;else if(n[l]<o[_])return;return o(t.event?t.event(n):n)}}}function R(e,n,o,r,a,i,s,l,_,u){var c,p,f,h,d,g,b,w,N,M,$,E,P,I,A,T,U=n.type;if(void 0!==n.constructor)return null;128&o.__u&&(_=!!(32&o.__u),i=[l=n.__e=o.__e]),(c=t.__b)&&c(n);e:if("function"==typeof U){p=s.length;try{if(N=n.props,M=U.prototype&&U.prototype.render,$=(c=U.contextType)&&r[c.__c],E=c?$?$.props.value:c.__:r,o.__c?w=(f=n.__c=o.__c).__=f.__E:(M?n.__c=f=new U(N,E):(n.__c=f=new S(N,E),f.constructor=U,f.render=W),$&&$.sub(f),f.state||(f.state={}),f.__n=r,h=f.__d=!0,f.__h=[],f._sb=[]),M&&null==f.__s&&(f.__s=f.state),M&&null!=U.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=y({},f.__s)),y(f.__s,U.getDerivedStateFromProps(N,f.__s))),d=f.props,g=f.state,f.__v=n,h)M&&null==U.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),M&&null!=f.componentDidMount&&f.__h.push(f.componentDidMount);else{if(M&&null==U.getDerivedStateFromProps&&N!==d&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(N,E),n.__v==o.__v||!f.__e&&null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(N,f.__s,E)){n.__v!=o.__v&&(f.props=N,f.state=f.__s,f.__d=!1),n.__e=o.__e,n.__k=o.__k,n.__k.some(function(e){e&&(e.__=n)}),m.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f),l=x(o);break e}null!=f.componentWillUpdate&&f.componentWillUpdate(N,f.__s,E),M&&null!=f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(d,g,b)})}if(f.context=E,f.props=N,f.__P=e,f.__e=!1,P=t.__r,I=0,M)f.state=f.__s,f.__d=!1,P&&P(n),c=f.render(f.props,f.state,f.context),m.push.apply(f.__h,f._sb),f._sb=[];else do{f.__d=!1,P&&P(n),c=f.render(f.props,f.state,f.context),f.state=f.__s}while(f.__d&&++I<25);f.state=f.__s,null!=f.getChildContext&&(r=y(y({},r),f.getChildContext())),M&&!h&&null!=f.getSnapshotBeforeUpdate&&(b=f.getSnapshotBeforeUpdate(d,g)),A=null!=c&&c.type===C&&null==c.key?F(c.props.children):c,l=H(e,v(A)?A:[A],n,o,r,a,i,s,l,_,u),f.base=n.__e,n.__u&=-161,f.__h.length&&s.push(f),w&&(f.__E=f.__=null)}catch(e){if(s.length=p,n.__v=null,_||null!=i){if(e.then){for(n.__u|=_?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=i&&(i[i.indexOf(l)]=null),n.__e=l}else if(null!=i)for(T=i.length;T--;)k(i[T])}else n.__e=o.__e;null==n.__k&&(n.__k=o.__k||[]),e.then||L(n),t.__e(e,n,o)}}else null==i&&n.__v==o.__v?(n.__k=o.__k,n.__e=o.__e):l=n.__e=V(o.__e,n,o,r,a,i,s,_,u);return(c=t.diffed)&&c(n),128&n.__u?void 0:l}function L(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(L))}function O(e,n,o){for(var r=0;r<o.length;r++)j(o[r],o[++r],o[++r]);t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function F(e){return"object"!=typeof e||null==e||e.__b>0?e:v(e)?e.map(F):void 0!==e.constructor?null:y({},e)}function V(n,o,r,a,i,s,l,_,u){var c,p,f,h,m,g,y,b=r.props||d,w=o.props,C=o.type;if("svg"==C?i="http://www.w3.org/2000/svg":"math"==C?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=s)for(c=0;c<s.length;c++)if((m=s[c])&&"setAttribute"in m==!!C&&(C?m.localName==C:3==m.nodeType)){n=m,s[c]=null;break}if(null==n){if(null==C)return document.createTextNode(w);n=document.createElementNS(i,C,w.is&&w),_&&(t.__m&&t.__m(o,s),_=!1),s=null}if(null==C)b===w||_&&n.data==w||(n.data=w);else{if(s="textarea"==C&&null!=w.defaultValue?null:s&&e.call(n.childNodes),!_&&null!=s)for(b={},c=0;c<n.attributes.length;c++)b[(m=n.attributes[c]).name]=m.value;for(c in b)m=b[c],"dangerouslySetInnerHTML"==c?f=m:"children"==c||c in w||"value"==c&&"defaultValue"in w||"checked"==c&&"defaultChecked"in w||U(n,c,null,m,i);for(c in w)m=w[c],"children"==c?h=m:"dangerouslySetInnerHTML"==c?p=m:"value"==c?g=m:"checked"==c?y=m:_&&"function"!=typeof m||b[c]===m||U(n,c,m,b[c],i);if(p)_||f&&(p.__html==f.__html||p.__html==n.innerHTML)||(n.innerHTML=p.__html),o.__k=[];else if(f&&(n.innerHTML=""),H("template"==o.type?n.content:n,v(h)?h:[h],o,r,a,"foreignObject"==C?"http://www.w3.org/1999/xhtml":i,s,l,s?s[0]:r.__k&&x(r,0),_,u),null!=s)for(c=s.length;c--;)k(s[c]);_&&"textarea"!=C||(c="value","progress"==C&&null==g?n.removeAttribute("value"):null!=g&&(g!==n[c]||"progress"==C&&!g||"option"==C&&g!=b[c])&&U(n,c,g,b[c],i),c="checked",null!=y&&y!=n[c]&&U(n,c,y,b[c],i))}return n}function j(e,n,o){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==n||(e.__u=e(n))}else e.current=n}catch(e){t.__e(e,o)}}function z(e,n,o){var r,a;if(t.unmount&&t.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||j(r,null,n)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){t.__e(e,n)}r.base=r.__P=r.__n=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&z(r[a],n,o||"function"!=typeof e.type);o||k(e.__e),e.__c=e.__=e.__e=void 0}function W(e,t,n){return this.constructor(e,n)}function q(n,o,r){var a,i,s,l;o==document&&(o=document.documentElement),t.__&&t.__(n,o),i=(a="function"==typeof r)?null:r&&r.__k||o.__k,s=[],l=[],R(o,n=(!a&&r||o).__k=b(C,null,[n]),i||d,d,o.namespaceURI,!a&&r?[r]:i?null:o.firstChild?e.call(o.childNodes):null,s,!a&&r?r:i?i.__e:o.firstChild,a,l),O(s,n,l),n.props.children=null}function B(e,t){q(e,t,B)}function Y(t,n,o){var r,a,i,s,l=y({},t.props);for(i in t.type&&t.type.defaultProps&&(s=t.type.defaultProps),n)"key"==i?r=n[i]:"ref"==i?a=n[i]:l[i]=void 0===n[i]&&null!=s?s[i]:n[i];return arguments.length>2&&(l.children=arguments.length>3?e.call(arguments,2):o),w(t.type,l,r||t.key,a||t.ref,null)}e=m.slice,t={__e:function(e,t,n,o){for(var r,a,i;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&null!=a.getDerivedStateFromError&&(r.setState(a.getDerivedStateFromError(e)),i=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),i=r.__d),i)return r.__E=r}catch(t){e=t}throw e}},n=0,S.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=y({},this.state),"function"==typeof e&&(e=e(y({},n),this.props)),e&&y(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),$(this))},S.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),$(this))},S.prototype.render=C,o=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,i=function(e,t){return e.__v.__b-t.__v.__b},E.__r=0,s=Math.random().toString(8),l="__d"+s,_="__a"+s,u=/(PointerCapture)$|Capture$/i,c=0,p=D(!1),f=D(!0),h=0;var Z,J,G,Q,K=0,X=[],ee=t,te=ee.__b,ne=ee.__r,oe=ee.diffed,re=ee.__c,ae=ee.unmount,ie=ee.__;function se(e,t){ee.__h&&ee.__h(J,e,K||t),K=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function le(e){return K=1,_e(xe,e)}function _e(e,t,n){var o=se(Z++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):xe(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=J,!J.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=!1,i=o.__c.props!==e;if(o.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}}),a){var s=a.call(this,e,t,n);return r?s||i:s}return!r||i};J.__f=!0;var a=J.shouldComponentUpdate,i=J.componentWillUpdate;J.componentWillUpdate=function(e,t,n){if(this.__e){var o=a;a=void 0,r(e,t,n),a=o}i&&i.call(this,e,t,n)},J.shouldComponentUpdate=r}return o.__N||o.__}function ue(e,t){var n=se(Z++,3);!ee.__s&&Se(n.__H,t)&&(n.__=e,n.u=t,J.__H.__h.push(n))}function ce(e,t){var n=se(Z++,4);!ee.__s&&Se(n.__H,t)&&(n.__=e,n.u=t,J.__h.push(n))}function pe(e){return K=5,he(function(){return{current:e}},[])}function fe(e,t,n){K=6,ce(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function he(e,t){var n=se(Z++,7);return Se(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function de(e,t){return K=8,he(function(){return e},t)}function me(e){var t=J.context[e.__c],n=se(Z++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(J)),t.props.value):e.__}function ge(e,t){ee.useDebugValue&&ee.useDebugValue(t?t(e):e)}function ve(){var e=se(Z++,11);if(!e.__){for(var t=J.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function ye(){for(var e;e=X.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(we),t.__h.some(Ce),t.__h=[]}catch(n){t.__h=[],ee.__e(n,e.__v)}}}ee.__b=function(e){J=null,te&&te(e)},ee.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ie&&ie(e,t)},ee.__r=function(e){ne&&ne(e),Z=0;var t=(J=e.__c).__H;t&&(G===J?(t.__h=[],J.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(we),t.__h.some(Ce),t.__h=[],Z=0)),G=J},ee.diffed=function(e){oe&&oe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==X.push(t)&&Q===ee.requestAnimationFrame||((Q=ee.requestAnimationFrame)||be)(ye)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),G=J=null},ee.__c=function(e,t){t.some(function(e){try{e.__h.some(we),e.__h=e.__h.filter(function(e){return!e.__||Ce(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],ee.__e(n,e.__v)}}),re&&re(e,t)},ee.unmount=function(e){ae&&ae(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{we(e)}catch(e){t=e}}),n.__H=void 0,t&&ee.__e(t,n.__v))};var ke="function"==typeof requestAnimationFrame;function be(e){var t,n=function(){clearTimeout(o),ke&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);ke&&(t=requestAnimationFrame(n))}function we(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function Ce(e){var t=J;e.__c=e.__(),J=t}function Se(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function xe(e,t){return"function"==typeof t?t(e):t}function Ne(e,t){for(var n in t)e[n]=t[n];return e}function Me(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function $e(e,t){var n=t(),o=le({t:{__:n,u:t}}),r=o[0].t,a=o[1];return ce(function(){r.__=n,r.u=t,Ee(r)&&a({t:r})},[e,n,t]),ue(function(){return Ee(r)&&a({t:r}),e(function(){Ee(r)&&a({t:r})})},[e]),n}function Ee(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function He(e){e()}function Pe(e){return e}function Ie(){return[!1,He]}var Ae=ce;function Te(e,t){this.props=e,this.context=t}(Te.prototype=new S).isPureReactComponent=!0,Te.prototype.shouldComponentUpdate=function(e,t){return Me(this.props,e)||Me(this.state,t)};var Ue=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ue&&Ue(e)};var De="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Re=function(e,t){return null==e?null:I(I(e).map(t))},Le={map:Re,forEach:Re,count:function(e){return e?I(e).length:0},only:function(e){var t=I(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:I},Oe=t.__e;t.__e=function(e,t,n,o){if(e.then)for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t);Oe(e,t,n,o)};var Fe=t.unmount;function Ve(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=Ne({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ve(e,t,n)})),e}function je(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return je(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ze(){this.__u=0,this.o=null,this.__b=null}function We(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function qe(e){var t,n,o,r=null;function a(a){if(t||(t=e()).then(function(e){e&&(r=e.default||e),o=!0},function(e){n=e,o=!0}),n)throw n;if(!o)throw t;return r?b(r,a):null}return a.displayName="Lazy",a.__f=!0,a}function Be(){this.i=null,this.l=null}t.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Fe&&Fe(e)},(ze.prototype=new S).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=We(o.__v),a=!1,i=function(){a||o.__z||(a=!0,n.__R=null,r?r(l):l())};n.__R=i;var s=n.__P;n.__P=null;var l=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=je(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=s,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(i,i)},ze.prototype.componentWillUnmount=function(){this.o=[]},ze.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Ve(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&b(C,null,e.fallback);return r&&(r.__u&=-33),[b(C,null,t.__a?null:e.children),r]};var Ye=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Ze(e){return this.getChildContext=function(){return e.context},e.children}function Je(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){q(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}q(b(Ze,{context:t.context},e.__v),t.v)}(Be.prototype=new S).__a=function(e){var t=this,n=We(t.__v),o=t.l.get(e);return o[0]++,function(r){var a=function(){t.props.revealOrder?(o.push(r),Ye(t,e,o)):r()};n?n(a):a()}},Be.prototype.render=function(e){this.i=null,this.l=new Map;var t=I(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Be.prototype.componentDidUpdate=Be.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Ye(e,n,t)})};var Ge="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Qe=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ke=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Xe=/[A-Z0-9]/g,et="undefined"!=typeof document,tt=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function nt(e,t,n){return null==t.__k&&(t.textContent=""),q(e,t),"function"==typeof n&&n(),e?e.__c:null}S.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(S.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ot=t.event;t.event=function(e){return ot&&(e=ot(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var rt,at={configurable:!0,get:function(){return this.class}},it=t.vnode;t.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1==n.indexOf("-");for(var a in t){var i=t[a];if(!("value"===a&&"defaultValue"in t&&null==i||et&&"children"===a&&"noscript"===n||"class"===a||"className"===a)){var s=a.toLowerCase();"defaultValue"===a&&"value"in t&&null==t.value?a="value":"download"===a&&!0===i?i="":"translate"===s&&"no"===i?i=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?a="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||tt(t.type)?"onfocus"===s?a="onfocusin":"onblur"===s?a="onfocusout":Ke.test(a)&&(a=s):s=a="oninput":r&&Qe.test(a)?a=a.replace(Xe,"-$&").toLowerCase():null===i&&(i=void 0),"oninput"===s&&o[a=s]&&(a="oninputCapture"),o[a]=i}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=I(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=I(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",at)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=Ge,it&&it(e)};var st=t.__r;t.__r=function(e){st&&st(e),rt=e.__c};var lt=t.diffed;t.diffed=function(e){lt&&lt(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),rt=null};var _t={ReactCurrentDispatcher:{current:{readContext:function(e){return rt.__n[e.__c].props.value},useCallback:de,useContext:me,useDebugValue:ge,useDeferredValue:Pe,useEffect:ue,useId:ve,useImperativeHandle:fe,useInsertionEffect:Ae,useLayoutEffect:ce,useMemo:he,useReducer:_e,useRef:pe,useState:le,useSyncExternalStore:$e,useTransition:Ie}}};function ut(e){return!!e&&e.$$typeof===Ge}function ct(e){return!!e.__k&&(q(null,e),!0)}var pt={useState:le,useId:ve,useReducer:_e,useEffect:ue,useLayoutEffect:ce,useInsertionEffect:Ae,useTransition:Ie,useDeferredValue:Pe,useSyncExternalStore:$e,startTransition:He,useRef:pe,useImperativeHandle:fe,useMemo:he,useCallback:de,useContext:me,useDebugValue:ge,version:"18.3.1",Children:Le,render:nt,hydrate:function(e,t,n){return B(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:ct,createPortal:function(e,t){var n=b(Je,{__v:e,h:t});return n.containerInfo=t,n},createElement:b,createContext:function(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,$(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+h++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},createFactory:function(e){return b.bind(null,e)},cloneElement:function(e){return ut(e)?Y.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:C,isValidElement:ut,isElement:ut,isFragment:function(e){return ut(e)&&e.type===C},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:S,PureComponent:Te,memo:function(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:Me(this.props,e)}function o(t){return this.shouldComponentUpdate=n,b(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o},forwardRef:function(e){function t(t){var n=Ne({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=De,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,n){var o,r=t.debounceRendering;t.debounceRendering=function(e){o=e};try{var a=e(n);return o&&o(),a}finally{t.debounceRendering=r}},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:C,Suspense:ze,SuspenseList:Be,lazy:qe,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:_t};function ft(e){return{render:function(t){nt(t,e)},unmount:function(){ct(e)}}}const ht=e=>({size:t=24,color:n="currentColor",strokeWidth:o=2,...r})=>pt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...r},e.map(([e,t],n)=>pt.createElement(e,{key:n,...t}))),dt=ht([["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]),mt=ht([["path",{d:"M5 12h14"}]]),gt=ht([["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]]),vt=ht([["path",{d:"M12 19v3"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"}]]),yt=ht([["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]]),kt=ht([["path",{d:"m14 10 7-7"}],["path",{d:"M20 10h-6V4"}],["path",{d:"m3 21 7-7"}],["path",{d:"M4 14h6v6"}]]),bt=ht([["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"}]]),wt=ht([["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9"}]]),Ct=ht([["path",{d:"m9 18 6-6-6-6"}]]),St=ht([["path",{d:"m15 18-6-6 6-6"}]]),xt=ht([["path",{d:"M12 7v14"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"}]]),Nt=ht([["path",{d:"m6 9 6 6 6-6"}]]),Mt=ht([["path",{d:"M7 10v12"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"}]]),$t=ht([["path",{d:"M17 14V2"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"}]]),Et=ht([["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]]),Ht=ht([["path",{d:"M20 6 9 17l-5-5"}]]),Pt=ht([["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .962 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.962 0z"}],["path",{d:"M20 3v4"}],["path",{d:"M22 5h-4"}]]),It=({size:e=22,className:t,style:n},o,r)=>pt.createElement("svg",{width:e,height:e,viewBox:o,fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:n,"aria-hidden":"true",focusable:"false"},r),At=e=>It(e,"0 0 128 128",pt.createElement("g",{fill:"currentColor"},pt.createElement("path",{d:"M109,55c0-29.8-24.2-54-54-54C25.2,1,1,25.2,1,55s24.2,54,54,54c13.5,0,25.8-5,35.2-13.1l25.4,25.4l5.7-5.7L95.9,90.2C104,80.8,109,68.5,109,55z M55,101C29.6,101,9,80.4,9,55S29.6,9,55,9s46,20.6,46,46S80.4,101,55,101z"}),pt.createElement("path",{d:"M25.6,30.9l6.2,5.1C37.5,29,46,25,55,25v-8C43.6,17,32.9,22.1,25.6,30.9z"}),pt.createElement("path",{d:"M17,55h8c0-2.1,0.2-4.1,0.6-6.1l-7.8-1.6C17.3,49.8,17,52.4,17,55z"}))),Tt=e=>It(e,"0 0 24 24",pt.createElement("path",{fill:"currentColor",d:"M16 2H8C4 2 2 4 2 8V21C2 21.55 2.45 22 3 22H16C20 22 22 20 22 16V8C22 4 20 2 16 2ZM14 15.25H7C6.59 15.25 6.25 14.91 6.25 14.5C6.25 14.09 6.59 13.75 7 13.75H14C14.41 13.75 14.75 14.09 14.75 14.5C14.75 14.91 14.41 15.25 14 15.25ZM17 10.25H7C6.59 10.25 6.25 9.91 6.25 9.5C6.25 9.09 6.59 8.75 7 8.75H17C17.41 8.75 17.75 9.09 17.75 9.5C17.75 9.91 17.41 10.25 17 10.25Z"})),Ut=({size:e=26,className:t,style:n})=>pt.createElement("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,style:n,"aria-hidden":"true",focusable:"false"},pt.createElement("g",{transform:"translate(24 0) scale(-1 1)"},pt.createElement("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M16 2H8C4 2 2 4 2 8V21C2 21.55 2.45 22 3 22H16C20 22 22 20 22 16V8C22 4 20 2 16 2ZM15.5 12.75H8.5C8.09 12.75 7.75 12.41 7.75 12C7.75 11.59 8.09 11.25 8.5 11.25H15.5C15.91 11.25 16.25 11.59 16.25 12C16.25 12.41 15.91 12.75 15.5 12.75Z"}))),Dt=e=>It(e,"0 0 24 24",pt.createElement(pt.Fragment,null,pt.createElement("path",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",d:"M12 20H12.01"}),pt.createElement("path",{stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",d:"M7 9C7 7.87439 7.37194 6.83566 7.99963 6C8.91184 4.78555 10.3642 4 12 4C14.7614 4 17 6.23858 17 9C17 11.4212 15.279 13.4405 12.9936 13.9013C12.4522 14.0104 12 14.4477 12 15V15V16"}))),Rt={launcher_open:"Open support chat",launcher_close:"Close support chat",launcher_open_unread_one:"Open support chat, {count} new message",launcher_open_unread_other:"Open support chat, {count} new messages",launcher_unread_overflow:"{count}+",panel_label:"{organizationName} support",header_messages:"Messages",header_help_center:"Help Center",header_back_to_conversations:"Back to conversations",header_expand:"Expand window",header_collapse:"Collapse window",header_close:"Close",conversation_label:"Conversation",sending_to_team:"Sending to the team…",uploading_attachment:"Uploading attachment…",new_messages_one:"{count} new message",new_messages_other:"{count} new messages",reaction_helpful:"Helpful",reaction_not_helpful:"Not helpful",copy_message:"Copy message",copied:"Copied",message_from_agent:"Agent",message_from_you:"You",terms_notice:"By chatting, you agree to our {terms}",terms_link:"Terms",powered_by:"Powered by {brand}",tab_explore:"Explore",tab_messages:"Messages",tab_help:"Help",tabs_label:"Sections",conversations_empty_title:"No conversations yet",conversations_empty_desc:"Start a chat and our AI agent & team will help you out.",conversation_no_messages:"No messages yet",conversation_title:"Chat #{number}",conversation_closed_chip:"Closed",start_new_chat:"Ask a Question",message_not_sent:"Not sent",message_retry:"Retry",conversation_closed:"This conversation was closed. Send a message to reopen it, or start a new one.",conversation_with_agent:"This conversation has been passed to our team. Replies may take a little longer.",composer_label:"Message",composer_placeholder:"Type your message…",composer_placeholder_lead_required:"Add your email above to continue…",composer_placeholder_security_check:"Verify security check to chat…",composer_hint:"Press Enter to send, Shift+Enter for a new line",attach_file:"Attach a file (10 MB max)",insert_emoji:"Insert emoji",emoji_picker_label:"Choose an emoji",send_message:"Send message",attachment_image_alt:"Image attachment",attachment_file_label:"File attachment: {name}",attachment_remove:"Remove {name}",attachment_uploading:"Uploading {name}, {percent}%",attachment_too_large:"Too large (10 MB limit)",attachment_failed:"Upload failed",attachment_rejected:"File type not allowed",attachment_limit:"You can attach up to {count} files per message.",attachment_drop_hint:"Drop files to attach them",attachment_open:"Open {name}",attachments_summary_one:"{count} attachment",attachments_summary_other:"{count} attachments",feedback_comment_prompt:"What was wrong? (optional)",feedback_comment_placeholder:"Tell us a little more…",feedback_comment_send:"Send",feedback_comment_skip:"Skip",feedback_thanks:"Thanks for your feedback",notice_security_check_required:"Please complete the security check first.",voice_start:"Voice input",voice_finish:"Finish recording",voice_status_waiting:"Waiting for the microphone…",voice_status_listening:"Listening…",voice_status_transcribing:"Transcribing…",voice_seconds_left_one:"{count} second left",voice_seconds_left_other:"{count} seconds left",voice_countdown:"{count}s",voice_cancel:"Cancel voice input",voice_stop:"Stop and transcribe",voice_retry:"Try again",voice_error_insecure:"Voice input needs a secure (https) page.",voice_error_unsupported:"Voice input isn't supported in this browser.",voice_error_denied:"Microphone access is blocked. Allow it in your browser's site settings to use voice input.",voice_error_no_microphone:"No microphone was found.",voice_error_no_speech:"I didn't catch that. Please try again.",voice_error_no_audio:"No sound is coming from your microphone. Check that it isn't muted and that the right one is selected.",voice_error_limit:"Voice input isn't available right now. Please type your message.",voice_error_disabled:"Voice input is turned off.",voice_error_network:"Your recording couldn't be transcribed. Check your connection and try again.",voice_error_failed:"Your recording couldn't be transcribed. Please try again or type your message.",lead_prompt:"Leave your email and we'll reply there if you've gone.",lead_email_placeholder:"you@example.com",lead_email_label:"Your email address",lead_save:"Save",lead_saving:"Saving…",lead_dismiss:"No thanks",lead_error_invalid_email:"That doesn't look like an email address.",lead_error_save_failed:"Couldn't save that just now. You can carry on chatting.",greeting_default:"Hi from {organizationName}. How can we help?",greeting_default_persona:"Hi, I'm {ai_name} from {organizationName}. How can I help?",greeting_dismiss:"Dismiss greeting",welcome_default:"Hi! How can I help you today?",explore_hero_title:"Hello there",explore_hero_subtitle:"How can we help?",explore_search_placeholder:"Search for help…",explore_cta_title:"Ask our AI Agent",explore_cta_sub:"Instant answers, 24/7 — or reach the team",explore_tile_help_title:"Help Center",explore_tile_help_sub:"Guides & docs",explore_tile_messages_title:"Messages",explore_tile_messages_sub:"Your conversations",explore_popular_questions:"Popular questions",explore_ask_ai_about_this:"Ask AI Agent about this",explore_recommended_reading:"Recommended reading",help_search_placeholder:"Search for articles…",help_search_label:"Search articles",help_searching:"Searching…",help_search_no_results:"No articles matching “{query}”",help_all_collections:"All Collections",help_back_to_articles:"Back to articles",help_document_type_fallback:"Guide",help_written_by:"Written by the {organizationName} support team",help_updated_recently:"Updated recently",help_read_time_one:"{count} min read",help_read_time_other:"{count} min read",help_feedback_title:"Did this answer your question?",help_feedback_thanks:"Thank you for your feedback!",help_feedback_yes:"Yes",help_feedback_somewhat:"Somewhat",help_feedback_no:"No",help_handoff_title:"Still have questions?",help_handoff_desc:"Ask our AI Agent for instant answers",help_handoff_prefill:"I have a question about the article “{title}”: ",help_collection_articles:"{collection} articles ({count})",help_article_count_one:"{count} article",help_article_count_other:"{count} articles",help_empty_title:"Help Documentation",help_empty_desc:"Search above to fetch instant solutions from our knowledge base.",help_collection_guide_title:"Guides & Tutorials",help_collection_guide_desc:"Setup walkthroughs, rules, and getting started guides",help_collection_faq_title:"Frequently Asked Questions",help_collection_faq_desc:"Quick answers to common account and service questions",help_collection_troubleshooting_title:"Troubleshooting & Support",help_collection_troubleshooting_desc:"Step-by-step solutions for technical issues",help_collection_other_title:"Rules & Documentation",help_collection_other_desc:"Official terms, rules, and policy documentation",help_featured_article:"Featured Article",help_untitled_article:"Untitled Article",help_unavailable:"The help centre couldn't be loaded. Check your connection and try again.",link_opens_new_tab:"(opens in a new tab)",error_search_rate_limited:"You're searching too fast. Please wait a moment and try again.",error_search_unavailable:"Search is unavailable right now. Please try again shortly.",error_send_rate_limited:"You're sending messages too quickly. Please wait a moment and try again.",error_attachment_rejected:"That file can't be attached. It may be too large (10 MB limit) or a type that isn't allowed.",error_attachment_upload_failed:"That attachment couldn't be uploaded. Please try again."},Lt={ar:()=>import("./ar-CQTUQm9_.js"),de:()=>import("./de-DeXGKiqF.js"),es:()=>import("./es-asaD9XBM.js"),fr:()=>import("./fr-D1oVRtfe.js"),hi:()=>import("./hi-DkhpMWtv.js"),pt:()=>import("./pt-DxP1QTsq.js")},Ot=["ar","he","fa","ur","ps","sd","yi","dv","ug"];let Ft="en",Vt=0,jt={},zt={};const Wt=new Set,qt={en:{}};function Bt(){Wt.forEach(e=>{try{e()}catch{}})}function Yt(){return Ft}function Zt(){return-1!==Ot.indexOf(Ft.split("-")[0].toLowerCase())?"rtl":"ltr"}function Jt(e){if(!e)return"en";const t=String(e).trim(),n=t.split(/[-_]/)[0].toLowerCase(),o=t.replace("_","-");return"en"===n||Lt[n]?o:"en"}async function Gt(e){let t=Jt(e),n=t.split("-")[0];const o=++Vt;if(void 0===qt[n])try{const e=(await Lt[n]()).default;qt[n]=e}catch(e){console.warn(`[Askly] Could not load the "${n}" translations; staying in English.`,e),t="en",n="en"}return o!==Vt||(Ft=t,jt=qt[n],Bt()),Ft}function Qt(e){zt={...zt,...e},Bt()}function Kt(e){return Wt.add(e),()=>{Wt.delete(e)}}function Xt(e,t){return t?e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e):e}function en(e,t){var n,o,r;return Xt(null!==(r=null!==(o=null!==(n=zt[e])&&void 0!==n?n:jt[e])&&void 0!==o?o:Rt[e])&&void 0!==r?r:e,t)}function tn(e,t,n){var o,r;let a="other";try{a=new Intl.PluralRules(Ft).select(t)}catch{}const i=[`${e}_${a}`,`${e}_other`,`${e}_one`];let s;for(const e of i)if(s=null!==(r=null!==(o=zt[e])&&void 0!==o?o:jt[e])&&void 0!==r?r:Rt[e],void 0!==s)break;return Xt(null!=s?s:e,{count:nn(t)})}function nn(e){try{return new Intl.NumberFormat(Ft).format(e)}catch{return String(e)}}function on(e){if(!e)return"";const t=new Date(e);if(isNaN(t.getTime()))return"";try{const e=new Date,n=t.toDateString()===e.toDateString();return new Intl.DateTimeFormat(Ft,n?{hour:"numeric",minute:"2-digit"}:{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(t)}catch{return t.toLocaleTimeString()}}const rn={};function an(e,t){return(rn[e]=rn[e]||[]).push(t),()=>sn(e,t)}function sn(e,t){const n=rn[e];if(n)for(let e=n.length-1;e>=0;e--)n[e]!==t&&n[e].original!==t||n.splice(e,1)}function ln(e,t){const n=o=>{sn(e,n),t(o)};return n.original=t,an(e,n)}function _n(e,...t){const n=rn[e];if(n)for(const o of n.slice())try{o(t[0])}catch(t){console.error(`[Askly] "${e}" handler failed:`,t)}}let un=null,cn=[],pn=!1;function fn(){pn=!0}function hn(e){un?un(e):pn?cn.push(e):console.warn(`[Askly] ${e.type}() ignored: the widget is not initialised on this page.`)}function dn(e){un=e,pn=!1;const t=cn;return cn=[],t.forEach(e),()=>{un===e&&(un=null)}}function mn(){cn=[],pn=!1}const gn={ready:!1,open:!1,unread:0,visitorId:""};function vn(){gn.ready=!1,gn.open=!1,gn.unread=0,gn.visitorId=""}function yn(e){try{const t=window.localStorage.getItem(e),n=t?JSON.parse(t):[];return Array.isArray(n)?n.map(e=>Array.isArray(e.messages)&&e.messages.some(e=>e&&"sending"===e.status)?{...e,messages:e.messages.map(e=>"sending"===e.status?{...e,status:"failed"}:e)}:e):[]}catch{return[]}}function kn(e,t){try{return void window.localStorage.setItem(e,JSON.stringify(t))}catch{}try{const n=t.filter(e=>e.messages.some(e=>"user"===e.role)).slice(0,30).map(e=>e.messages.length>200?{...e,messages:e.messages.slice(-200)}:e);window.localStorage.setItem(e,JSON.stringify(n))}catch{}}const bn=5,wn=10485760,Cn=e=>!!e&&/^image\/(png|jpe?g|gif|webp)$/i.test(e);function Sn(e,t){if(!(e>0))return"";const n=["B","KB","MB"];let o=e,r=0;for(;o>=1024&&r<n.length-1;)o/=1024,r++;const a=0===r?0:o<10?1:0;let i;try{i=o.toLocaleString(t,{maximumFractionDigits:a,minimumFractionDigits:0})}catch{i=o.toFixed(a)}return`${i} ${n[r]}`}function xn(e){return e&&"string"==typeof e.url&&/^https?:\/\//i.test(e.url)?{url:e.url,name:"string"==typeof e.filename&&e.filename?e.filename:"string"==typeof e.name&&e.name?e.name:"file",type:"string"==typeof e.content_type?e.content_type:"string"==typeof e.type?e.type:"application/octet-stream",size:"number"==typeof e.size?e.size:0}:null}const Nn=["active","escalated","resolved"];function Mn(e){return Nn.includes(e)?e:"active"}function $n(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`}function En(e){if("string"!=typeof e||!e)return;const t=/(?:[zZ]|[+-]\d\d:?\d\d)$/.test(e)||!/^\d{4}-\d\d-\d\dT/.test(e),n=new Date(t?e:e+"Z");return isNaN(n.getTime())?void 0:n}function Hn(e){if(!e||!e.message_id)return null;if("user"!==e.role&&"agent"!==e.role&&"human"!==e.role)return null;if("string"!=typeof e.content&&null!==e.content&&void 0!==e.content)return null;const t={role:"user"===e.role?"user":"agent",content:e.content||"",timestamp:En(e.timestamp)||new Date,messageId:e.message_id,format:"markdown"===e.format?"markdown":"text"},n=(Array.isArray(e.attachments)?e.attachments:[]).map(xn).filter(Boolean);return n.length&&(t.attachments=n),!e.feedback||"up"!==e.feedback.rating&&"down"!==e.feedback.rating||(t.feedback={rating:e.feedback.rating,...e.feedback.comment?{comment:e.feedback.comment}:{}}),t.content||t.attachments?t:null}function Pn(e,t){var n;const o=new Map(e.map(e=>[e.id,e])),r=[],a=new Set;for(const e of t){if(!e||"string"!=typeof e.thread_key||a.has(e.thread_key))continue;a.add(e.thread_key);const t=Mn(e.conversation_status),i=En(e.updated_at),s=i?i.toISOString():void 0,l=o.get(e.thread_key);if(l){const e=Date.parse(l.lastUpdated)||0,o=!!i&&i.getTime()-e>2e3;r.push({...l,status:t,hydrated:!o&&(null===(n=l.hydrated)||void 0===n||n),lastUpdated:o?s:l.lastUpdated});continue}const _=e.last_message?Hn(e.last_message):null;r.push({id:e.thread_key,messages:_?[_]:[],lastUpdated:s||(new Date).toISOString(),status:t,hydrated:!1})}for(const t of e)a.has(t.id)||r.push(t);return r.sort((e,t)=>e.lastUpdated<t.lastUpdated?1:e.lastUpdated>t.lastUpdated?-1:0)}function In(e,t){const n=new Set(t.map(e=>e.messageId)),o=e.findIndex(e=>"user"===e.role),r=(-1===o?e:e.slice(0,o)).filter(e=>"agent"===e.role&&!e.messageId),a=e=>e.timestamp&&new Date(e.timestamp).getTime()||0,i=t.reduce((e,t)=>Math.max(e,a(t)),0),s=e=>e.content||(e.attachments||[]).map(e=>e.url).join("\n"),l=new Set(t.filter(e=>"user"===e.role).map(s).filter(Boolean)),_=e.filter(e=>e.messageId&&!n.has(e.messageId)&&a(e)>i||"user"===e.role&&("sending"===e.status||"failed"===e.status)&&!e.messageId&&!l.has(s(e)));return[...r,...t,..._]}class An{constructor(e){this.options=e,this.token=null,this.supported=!0,this.userId=null,this.human=!1,this.pending=null,this.lastFailure=null}apply(e){e&&"string"==typeof e.session_token&&(this.token=e.session_token,this.userId=e.session_verified&&"string"==typeof e.session_user_id?e.session_user_id:null,this.human=!!e.session_human,this.options.onChange())}clear(){this.token=null,this.pending=null,this.userId=null,this.human=!1,this.options.onChange()}start(e){const t=this.options.getOrganizationId();if(!this.supported||!t)return Promise.resolve(null);if(this.pending)return this.pending;const n=this.options.getVisitorId();let o=null;return o=(async()=>{try{const o=await fetch(this.options.api("/session"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e?{organization_id:t,token:e}:{organization_id:t,visitor_id:n})});if(404===o.status||405===o.status)return this.supported=!1,null;if(!o.ok)return this.lastFailure=401===o.status?"rejected":"transient",null;this.lastFailure=null;const r=await o.json();return n!==this.options.getVisitorId()?null:(this.token&&this.token!==e||this.apply(r),this.token)}catch{return this.lastFailure="transient",null}finally{this.pending===o&&(this.pending=null)}})(),this.pending=o,o}async request(e,t={}){var n;const o=n=>fetch("function"==typeof e?e(!!n):e,{...t,headers:{...t.headers,...n?{Authorization:`Bearer ${n}`}:{}}}),r=null!==(n=this.token)&&void 0!==n?n:await this.start(),a=await o(r);if(401!==a.status||!r)return{res:a,token:r};let i=await this.start(r);if(!i||i===r){const e=this.token;if(e&&e!==r)i=e;else{if("rejected"!==this.lastFailure)return{res:a,token:r};this.clear(),i=await this.start()}}return{res:await o(i),token:i}}async fetch(e,t={}){return(await this.request(e,t)).res}}let Tn;function Un(){if(void 0===Tn){const e="undefined"!=typeof window?window.trustedTypes:void 0;if(Tn=null,e&&e.createPolicy)try{Tn=e.createPolicy("askly",{createHTML:e=>e,createScriptURL:e=>e})}catch{Tn=null}}return Tn}function Dn(e){const t=Un();return t?t.createHTML(e):e}function Rn(e){const t=Un();return t?t.createScriptURL(e):e}function Ln(e){return!1===e||"off"===e?"off":!0===e||"review"===e?"review":"auto-send"===e?"auto-send":void 0}function On(e){switch(e){case"insecure":return en("voice_error_insecure");case"unsupported":return en("voice_error_unsupported");case"denied":return en("voice_error_denied");case"no-microphone":return en("voice_error_no_microphone");case"no-speech":return en("voice_error_no_speech");case"no-audio":return en("voice_error_no_audio");case"limit":return en("voice_error_limit");case"disabled":return en("voice_error_disabled");case"network":return en("voice_error_network");default:return en("voice_error_failed")}}const Fn=3e3,Vn=3;function jn(e,t,n){const o=en("greeting_default");let r="string"==typeof e&&e.trim()?e:t?en("greeting_default_persona"):o;return t||-1===r.indexOf("{ai_name}")||(r=o),r.replace(/\{ai_name\}/g,()=>t||"").replace(/\{organizationName\}/g,()=>n).trim()}function zn(e){try{return"1"===window.sessionStorage.getItem(`askly_greeting_dismissed_${e}`)}catch{return!1}}function Wn(e){try{window.sessionStorage.setItem(`askly_greeting_dismissed_${e}`,"1")}catch{}}function qn(e){_n("shown"===e?"greeting:shown":"clicked"===e?"greeting:clicked":"greeting:dismissed");try{window.dispatchEvent(new Event(`askly:greeting:${e}`))}catch{}}const Bn={headings:!1,blockquotes:!1,images:!1},Yn={headings:!0,blockquotes:!0,images:!0};function Zn(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Jn(e){const t=e.trim();return/^(https?:\/\/|mailto:|tel:)/i.test(t)&&!/[\s\0-]/.test(t)}function Gn(e,t){return`<a href="${Zn(e.trim())}" target="_blank" rel="noopener noreferrer" class="message-inline-link">${t}</a>`}class Qn{constructor(){this.items=[]}put(e){return this.items.push(e),`${this.items.length-1}`}restore(e){return e.replace(/(\d+)/g,(e,t)=>this.items[Number(t)])}}const Kn=/`([^`\n]+)`/g,Xn=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/g,eo=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/g,to=/(^|[^\w"'=/\]\(])(https?:\/\/[^\s<>()]*[^\s<>().,;:!?'"])/g,no=/\*\*(?=\S)([\s\S]*?\S)\*\*/g,oo=/(^|[^\w*])\*(?=\S)([^*\n]*?\S)\*(?![\w*])/g,ro=/(^|[^\w_])_(?=\S)([^_\n]*?\S)_(?![\w_])/g;function ao(e,t){const n=new Qn;let o=e;return t.emphasis&&(o=o.replace(Kn,(e,t)=>n.put(`<code class="inline-code">${Zn(t)}</code>`))),t.images?o=o.replace(Xn,(e,t,o)=>function(e){const t=e.trim();return/^https:\/\//i.test(t)&&!/[\s\0-]/.test(t)}(o)?n.put(`<img src="${Zn(o.trim())}" alt="${Zn(t)}" class="message-inline-image" />`):n.put(Zn(t))):t.links&&(o=o.replace(Xn,(e,t,o)=>n.put(Jn(o)?Gn(o,Zn(t||o)):Zn(t||o)))),t.links&&(o=o.replace(eo,(e,t,o)=>n.put(Jn(o)?Gn(o,Zn(t)):Zn(t)))),o=o.replace(to,(e,t,o)=>t+n.put(Gn(o,Zn(o)))),o=Zn(o),t.emphasis&&(o=o.replace(no,"<strong>$1</strong>"),o=o.replace(oo,"$1<em>$2</em>"),o=o.replace(ro,"$1<em>$2</em>")),o=o.replace(/\n/g,"<br />"),n.restore(o)}const io=/^\s{0,3}```\s*([\w+-]*)\s*$/,so=/^\s{0,3}```\s*$/,lo=/^\s{0,3}(#{1,3})\s+(.+?)\s*#*\s*$/,_o=/^\s{0,3}>\s?(.*)$/,uo=/^\s*([-*+]|\d{1,3}[.)])\s+(.*)$/,co=/^\s{2,}\S/;function po(e,t){const n={emphasis:!0,links:!0,images:t.images},o=e.replace(/\r\n?/g,"\n").split("\n"),r=[];let a=0;const i=e=>io.test(e)||uo.test(e)||t.headings&&lo.test(e)||t.blockquotes&&_o.test(e);for(;a<o.length;){const e=o[a];if(""===e.trim()){a++;continue}const s=e.match(io);if(s){const e=s[1],t=[];for(a++;a<o.length&&!so.test(o[a]);)t.push(o[a]),a++;for(a++;t.length&&""===t[t.length-1].trim();)t.pop();const n=e?` class="language-${e}"`:"";r.push(`<pre><code${n}>${Zn(t.join("\n"))}</code></pre>`);continue}if(t.headings){const t=e.match(lo);if(t){const e=t[1].length;r.push(`<h${e}>${ao(t[2],n)}</h${e}>`),a++;continue}}if(t.blockquotes&&_o.test(e)){const e=[];for(;a<o.length;){const t=o[a].match(_o);if(!t)break;e.push(t[1]),a++}r.push(`<blockquote><p>${ao(e.join("\n"),n)}</p></blockquote>`);continue}const l=e.match(uo);if(l){const e=/\d/.test(l[1]),t=e?parseInt(l[1],10):1,i=[];for(;a<o.length;){const e=o[a].match(uo);if(e)i.push(e[2]),a++;else{if(!i.length||!co.test(o[a]))break;i[i.length-1]+=" "+o[a].trim(),a++}}const s=e?"ol":"ul",_=e&&1!==t?` start="${t}"`:"";r.push(`<${s}${_}>${i.map(e=>`<li>${ao(e,n)}</li>`).join("")}</${s}>`);continue}const _=[e];for(a++;a<o.length&&""!==o[a].trim()&&!i(o[a]);)_.push(o[a]),a++;r.push(`<p>${ao(_.join("\n"),n)}</p>`)}return r.join("")}function fo(e){return e?po(e,Bn):""}function ho(e){return e?po(e,Yn):""}function mo(e){return e?ao(e,{emphasis:!1,links:!1,images:!1}):""}function go(e){return e?e.replace(/```[\s\S]*?```/g," [Code] ").replace(/!\[[^\]]*\]\([^)]*\)/g,"[Image]").replace(/\[[^\]]*\]\([^)]*\)/g,"[Link]").replace(/`([^`]*)`/g,"$1").replace(/\*\*([^*]*)\*\*/g,"$1").replace(/(^|[^\w*])\*([^*\n]+)\*(?![\w*])/g,"$1$2").replace(/(^|[^\w_])_([^_\n]+)_(?![\w_])/g,"$1$2").replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s*(?:[-*+]|\d{1,3}[.)])\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/\s+/g," ").trim():""}export{In as $,pe as A,xt as B,Ct as C,Et as D,fo as E,mo as F,Vn as G,Yt as H,Kt as I,Jt as J,Gt as K,Ut as L,bn as M,yn as N,kn as O,bt as P,jn as Q,zn as R,wt as S,Tt as T,qn as U,Wn as V,An as W,dt as X,Pn as Y,Hn as Z,Mn as _,on as a,_n as a0,Rn as a1,ce as a2,Qt as a3,Ln as a4,dn as a5,gn as a6,vn as a7,$n as a8,On as a9,wn as aa,Fn as ab,hn as ac,ln as ad,sn as ae,an as af,ft as ag,mn as ah,fn as ai,ho as aj,Pt as ak,tn as b,Nt as c,At as d,Dt as e,nn as f,pt as g,Zt as h,vt as i,gt as j,ze as k,mt as l,kt as m,yt as n,St as o,le as p,ue as q,Dn as r,go as s,en as t,Cn as u,Sn as v,Mt as w,$t as x,Ht as y,qe as z};