@eshal-bot/chat-widget 0.1.92 → 0.1.93

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.
@@ -91218,6 +91218,20 @@
91218
91218
  return lines.slice(0, start).join('\n');
91219
91219
  }
91220
91220
 
91221
+ // EV-2782: SQL aggregates (AVG(salary), etc.) come back from Postgres as a
91222
+ // NUMERIC with a fixed decimal scale, so the DB tool round-trips it as e.g.
91223
+ // `106500.00000000000` - trailing zero padding from the column's declared
91224
+ // precision, not a real value the agent computed. The agent quotes it
91225
+ // verbatim into its prose, so it reaches here as plain text. Collapse any
91226
+ // decimal whose digits past the 2nd place are ALL zero down to 2 decimals -
91227
+ // safe because a genuinely precise value (19.99, 3.14159) never has an
91228
+ // all-zero tail past position 2, so this only ever fires on exactly this
91229
+ // padding artifact. Mirrors the same fix in the frontend's
91230
+ // StreamingMarkdown.tsx (Testing Lab renderer).
91231
+ function sanitizeExcessDecimalPrecision(text) {
91232
+ return text.replace(/(\d+\.\d{2})0+(?!\d)/g, '$1');
91233
+ }
91234
+
91221
91235
  // The rich markdown renderer. Receives the already-animated `content`
91222
91236
  // (displayedContent from StreamingMarkdown) plus styling props. Renders only
91223
91237
  // the ReactMarkdown tree - the outer wrapper <div> and the streaming cursor
@@ -91665,7 +91679,7 @@
91665
91679
  }));
91666
91680
  }
91667
91681
  },
91668
- children: sanitizeStreamingContent(content, isStreaming)
91682
+ children: sanitizeExcessDecimalPrecision(sanitizeStreamingContent(content, isStreaming))
91669
91683
  });
91670
91684
  }
91671
91685
 
@@ -58,4 +58,4 @@ var T9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */function M9(e){if(!e)return!1;const t=e.source_type,n=e.url;return"file"===t||"string"==typeof n&&n.includes("/api/v1/sharepoint/file/")||!!e.source_id&&!n}function j9(e,t){return function(e){if(!e)return"";try{return decodeURIComponent(String(e))}catch(t){return String(e)}}(e.source_name)||e.url||e.source_type||"Source ".concat(t)}function F9(e){return e.url||e.source_id||e.sourceid||e.source_name||""}function B9(t){let{indices:n}=t;const r=e.useContext(L9),a=e.useRef(null),i=e.useRef(null),[o,l]=e.useState(!1),[s,u]=e.useState(null),c=e.useMemo(()=>{if(!r||!Array.isArray(r.sources))return[];const e=[],t=new Set;for(const s of n){var a,i,o,l;const n=r.sources.find(e=>Array.isArray(null==e?void 0:e.citation_indices)&&e.citation_indices.includes(s)),u=null!=n?n:r.sources[s-1];if(!u)continue;const c=String(null!==(a=null!==(i=null!==(o=null!==(l=u.url)&&void 0!==l?l:u.source_id)&&void 0!==o?o:u.sourceid)&&void 0!==i?i:u.source_name)&&void 0!==a?a:"").toLowerCase();c&&t.has(c)||(c&&t.add(c),e.push({src:u,index:s}))}return e},[r,n]);e.useEffect(()=>{if(!o)return;const e=e=>{const t="function"==typeof e.composedPath?e.composedPath():[],n=a.current&&t.includes(a.current),r=i.current&&t.includes(i.current);n||r||l(!1)},t=e=>{"Escape"===e.key&&l(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]);if(!r)return null;if(Array.isArray(r.sources)&&0===r.sources.length)return null;if(0===c.length)return null;const d=c[0],p=c.length-1,f=j9(d.src,d.index),g=M9(d.src),m=r.downloadingKey&&r.downloadingKey===F9(d.src),h=e=>{"function"==typeof r.onSourceActivate&&r.onSourceActivate(e)},b=e=>{e.preventDefault(),e.stopPropagation(),1!==c.length?o?l(!1):(()=>{const e=a.current;if(!e)return;const t=e.getBoundingClientRect();u({top:t.bottom+window.scrollY+4,left:t.left+window.scrollX}),l(!0)})():h(d.src)};return nt.jsxs(nt.Fragment,{children:[nt.jsxs("span",{ref:a,role:"button",tabIndex:0,title:f+(p?" (+".concat(p," more)"):""),onClick:b,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b(e))},style:{display:"inline-flex",alignItems:"center",gap:3,height:20,padding:"0 5px 0 6px",margin:"0 2px",fontSize:11,lineHeight:1,borderRadius:5,background:null!=r&&r.textColor?"rgba(128,128,128,0.08)":"rgba(59, 130, 246, 0.10)",color:(null==r?void 0:r.textColor)||"rgb(37, 99, 235)",border:null!=r&&r.textColor?"0.5px solid ".concat(r.textColor):"0.5px solid rgba(59, 130, 246, 0.35)",cursor:"pointer",userSelect:"none",maxWidth:180,verticalAlign:"1px",textDecoration:"none",fontWeight:500,whiteSpace:"nowrap"},children:[nt.jsx("span",{style:{display:"inline-flex",flexShrink:0},children:g?nt.jsx(R9,{size:12,strokeWidth:2,"aria-hidden":!0}):nt.jsx(P9,{size:12,strokeWidth:2,"aria-hidden":!0})}),nt.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:f}),p>0&&nt.jsxs("span",{style:{background:null!=r&&r.textColor?"transparent":"rgb(37, 99, 235)",color:(null==r?void 0:r.textColor)||"white",border:null!=r&&r.textColor?"1px solid ".concat(r.textColor):"none",borderRadius:3,padding:"1px 4px",fontSize:9,lineHeight:1,fontWeight:600,marginLeft:1},children:["+",p]}),1===c.length&&nt.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,paddingLeft:3,borderLeft:null!=r&&r.textColor?"0.5px solid ".concat(r.textColor):"0.5px solid rgba(59, 130, 246, 0.35)",marginLeft:2},children:m?nt.jsx(D9,{size:12,strokeWidth:2,className:"animate-spin"}):g?nt.jsx(N9,{size:12,strokeWidth:2}):nt.jsx(C9,{size:12,strokeWidth:2})})]}),o&&s&&"undefined"!=typeof document&&SJ.createPortal(nt.jsxs("div",{ref:i,role:"dialog","aria-label":"".concat(c.length," sources cited"),style:{position:"absolute",top:s.top,left:s.left,zIndex:2147483647,background:"#fff",color:"#111",border:"0.5px solid rgba(0, 0, 0, 0.12)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0,0,0,0.06)",padding:6,minWidth:240,maxWidth:360,fontSize:12},onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:[nt.jsxs("div",{style:{fontSize:10,textTransform:"uppercase",opacity:.55,letterSpacing:"0.06em",padding:"4px 6px 6px"},children:[c.length," source",1===c.length?"":"s"]}),c.map(e=>{let{src:t,index:n}=e;const a=j9(t,n),i=M9(t),o=r.downloadingKey&&r.downloadingKey===F9(t);return nt.jsxs("button",{type:"button",onClick:()=>h(t),disabled:!!o,title:a,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",border:0,background:"transparent",color:"inherit",cursor:o?"default":"pointer",textAlign:"left",borderRadius:4,font:"inherit"},onMouseEnter:e=>{e.currentTarget.style.background="rgba(0,0,0,0.04)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:[nt.jsx("span",{style:{display:"inline-flex",flexShrink:0,opacity:.8},children:i?nt.jsx(R9,{size:14,strokeWidth:2,"aria-hidden":!0}):nt.jsx(P9,{size:14,strokeWidth:2,"aria-hidden":!0})}),nt.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),nt.jsx("span",{style:{display:"inline-flex",flexShrink:0,opacity:.7},children:o?nt.jsx(D9,{size:14,strokeWidth:2,className:"animate-spin"}):i?nt.jsx(N9,{size:14,strokeWidth:2}):nt.jsx(C9,{size:14,strokeWidth:2})})]},"".concat(n,"-").concat(F9(t)||n))})]}),document.body)]})}const U9=["node","children"],z9=["children"],$9=["node","children"],G9=["node","children"],H9=["node","children"],W9=["node","children","start"],V9=["node","children","data-ol-index"],q9=["node","children"],Y9=["node","children"],K9=["node","children"],X9=["node","children"],Z9=["node","children"],Q9=["node","children"],J9=["node","children"],e7=["className","children"],t7=new Set(["eshal-ui","eshal-chart","chart"]);function n7(e,t){if(!t)return e;const n=/^```(?:eshal-ui|eshal-chart|chart)\b/m.exec(e);if(n){const t=e.slice(n.index+n[0].length).split("\n").some(e=>"```"===e.trim());if(!t)return e.slice(0,n.index).trimEnd()}const r=e.split("\n");let a=r.length-1;for(;a>0&&""===r[a].trim();)a--;if(!r[a].trim().startsWith("|"))return e;let i=a;for(;i>0&&(r[i-1].trim().startsWith("|")||""===r[i-1].trim());)i--;const o=r.slice(i,a+1).some(e=>/^\|[\s\-:|]+\|/.test(e.trim()));return o?e:r.slice(0,i).join("\n")}"undefined"!=typeof window&&(window.__eshalChatWidgetChunks=window.__eshalChatWidgetChunks||{},window.__eshalChatWidgetChunks.MarkdownRenderer=function(t){let{content:n,isStreaming:r,isDark:a=!1,isRtl:l=!1,textColor:s,fontFamily:u,fontSize:c,onButtonClick:d,provideCitations:p=!0}=t;return nt.jsx(ba,{className:"max-w-none [&>*:last-child]:!mb-0 [&>*:first-child]:!mt-0",remarkPlugins:[po,go],rehypePlugins:p?[w9]:[],components:{span(e){var t;let{node:n,children:r}=e,a=o(e,U9);const l=null!==(t=a["data-eshal-citation"])&&void 0!==t?t:a.dataEshalCitation;if("string"==typeof l&&l.length>0){const e=function(e){if(!e)return[];const t=[];for(const n of String(e).split(",")){const e=parseInt(n.trim(),10);Number.isFinite(e)&&e>=1&&t.push(e)}return S9(t)}(l);if(e.length>0)return nt.jsx(B9,{indices:e})}return nt.jsx("span",i(i({},a),{},{children:r}))},pre(t){let{children:n}=t,r=o(t,z9);return function(t){return e.Children.toArray(t).some(t=>{var n;if(!e.isValidElement(t))return!1;const r=null===(n=t.props)||void 0===n?void 0:n.className;if("string"!=typeof r)return!1;const a=r.match(/language-([\w-]+)/);return!!a&&t7.has(a[1])})}(n)?nt.jsx(nt.Fragment,{children:n}):nt.jsx("pre",i(i({},r),{},{children:n}))},a(e){let{node:t,children:n}=e,r=o(e,$9);return nt.jsx("a",i(i({className:"underline hover:opacity-80",dir:"ltr",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),unicodeBidi:"isolate"},target:"_blank",rel:"noopener noreferrer"},r),{},{children:n}))},p(e){var t;let{node:n,children:r}=e,l=o(e,G9);const d="li"===(null==n||null===(t=n.parent)||void 0===t?void 0:t.tagName);return nt.jsx("p",i(i({className:"leading-relaxed [&:first-child]:!mt-0",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",fontSize:c||"14px",margin:0,marginTop:0,marginBottom:d?"0.125rem":"0.85rem",lineHeight:"1.6",padding:0}},l),{},{children:r}))},ul(e){let{node:t,children:n}=e,r=o(e,H9);return nt.jsx("ul",i(i({className:"list-disc [&:first-child]:!mt-0",style:{marginTop:0,marginBottom:"0.6rem",paddingInlineStart:"1.2rem"}},r),{},{children:n}))},ol(t){let{node:n,children:r,start:a=1}=t,l=o(t,W9);const s=Number.isFinite(Number(a))?Number(a):1;let u=0;return nt.jsx("ol",i(i({className:"[&:first-child]:!mt-0",style:{listStyle:"none",marginTop:0,marginBottom:"0.6rem",paddingInlineStart:0}},l),{},{children:e.Children.map(r,t=>{if(!e.isValidElement(t))return t;const n=s+u;return u+=1,e.cloneElement(t,{"data-ol-index":n})})}))},li(e){let{node:t,children:n,"data-ol-index":r}=e,l=o(e,V9);const d={color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",fontSize:c||"14px",marginBottom:"0.3rem",lineHeight:"1.5"};return null!=r?nt.jsxs("li",i(i({style:i(i({},d),{},{listStyle:"none",display:"flex",alignItems:"baseline",gap:"0.4em"})},l),{},{children:[nt.jsxs("span",{style:{flexShrink:0,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif',fontVariantNumeric:"tabular-nums",minWidth:"1.5em",color:"inherit"},"aria-hidden":"false",children:[r,"."]}),nt.jsx("span",{style:{flex:"1 1 auto",minWidth:0},children:n})]})):nt.jsx("li",i(i({className:"",style:d},l),{},{children:n}))},h1(e){let{node:t,children:n}=e,r=o(e,q9);return nt.jsx("h1",i(i({className:"text-xl font-bold [&:first-child]:!mt-0",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",marginTop:"0.7rem",marginBottom:"0.45rem",lineHeight:"1.35"}},r),{},{children:n}))},h2(e){let{node:t,children:n}=e,r=o(e,Y9);return nt.jsx("h2",i(i({className:"text-lg font-semibold [&:first-child]:!mt-0",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",marginTop:"0.65rem",marginBottom:"0.4rem",lineHeight:"1.35"}},r),{},{children:n}))},h3(e){let{node:t,children:n}=e,r=o(e,K9);return nt.jsx("h3",i(i({className:"text-base font-semibold [&:first-child]:!mt-0",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",marginTop:"0.6rem",marginBottom:"0.35rem",lineHeight:"1.35"}},r),{},{children:n}))},blockquote(e){let{node:t,children:n}=e,r=o(e,X9);return nt.jsx("blockquote",i(i({className:"border-l-4 pl-4 italic ".concat(a?"border-gray-600 text-gray-300":"border-gray-300 text-gray-700")},r),{},{children:n}))},table(e){var t;let{node:n,children:r}=e,l=o(e,Z9);if((null==n||null===(t=n.children)||void 0===t?void 0:t.length)>0){var s;function u(e){return e?"string"==typeof e.value?e.value:Array.isArray(e.children)?e.children.map(u).join(""):"":""}const c=n.children.find(e=>"thead"===e.tagName),d=n.children.find(e=>"tbody"===e.tagName),p=null==c||null===(s=c.children)||void 0===s?void 0:s.find(e=>"tr"===e.tagName),f=((null==p?void 0:p.children)||[]).filter(e=>"th"===e.tagName).map(e=>u(e)),g=((null==d?void 0:d.children)||[]).filter(e=>"tr"===e.tagName),m=g.map(e=>(e.children||[]).filter(e=>"td"===e.tagName).map(e=>u(e)));if(f.length>0&&m.length>0){const h=m.map(e=>Object.fromEntries(f.map((t,n)=>{var r;return[t,null!==(r=e[n])&&void 0!==r?r:""]})));return nt.jsx(k8,{spec:{type:"table",columns:f,data:h},isDark:a})}}return nt.jsx("div",{className:"overflow-x-auto my-3 rounded-lg border ".concat(a?"border-gray-700 bg-gray-900":"border-gray-200 bg-white"),children:nt.jsx("table",i(i({className:"min-w-full border-collapse ".concat(a?"text-gray-100":"text-gray-900")},l),{},{children:r}))})},th(e){let{node:t,children:n}=e,r=o(e,Q9);return nt.jsx("th",i(i({className:"border px-3 py-2 text-left font-medium ".concat(a?"border-gray-700 bg-gray-800/50 text-gray-300":"border-gray-200 bg-gray-50 text-gray-700")},r),{},{children:n}))},td(e){let{node:t,children:n}=e,r=o(e,J9);return nt.jsx("td",i(i({className:"border px-3 py-2 ".concat(a?"border-gray-700":"border-gray-200")},r),{},{children:n}))},code(e){let{className:t,children:n}=e,r=o(e,e7);const l=/language-([\w-]+)/.exec(t||""),s=l?l[1]:null;if(s&&t7.has(s)){const e=function(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"string"==typeof e?e:"").join(""):""}(n).trim();try{const t=JSON.parse(e);if(t&&"object"==typeof t)return nt.jsx(k8,{spec:t,isDark:a,onButtonClick:d})}catch(e){return null}return null}return l?nt.jsx(eE,i(i({style:tE,language:s,PreTag:"div",wrapLines:!0},r),{},{children:String(n).replace(/\n$/,"")})):nt.jsx("code",i(i({className:t},r),{},{children:n}))}},children:n7(n,r)})})}(__eshalChatWidgetReact);
61
+ */function M9(e){if(!e)return!1;const t=e.source_type,n=e.url;return"file"===t||"string"==typeof n&&n.includes("/api/v1/sharepoint/file/")||!!e.source_id&&!n}function j9(e,t){return function(e){if(!e)return"";try{return decodeURIComponent(String(e))}catch(t){return String(e)}}(e.source_name)||e.url||e.source_type||"Source ".concat(t)}function F9(e){return e.url||e.source_id||e.sourceid||e.source_name||""}function B9(t){let{indices:n}=t;const r=e.useContext(L9),a=e.useRef(null),i=e.useRef(null),[o,l]=e.useState(!1),[s,u]=e.useState(null),c=e.useMemo(()=>{if(!r||!Array.isArray(r.sources))return[];const e=[],t=new Set;for(const s of n){var a,i,o,l;const n=r.sources.find(e=>Array.isArray(null==e?void 0:e.citation_indices)&&e.citation_indices.includes(s)),u=null!=n?n:r.sources[s-1];if(!u)continue;const c=String(null!==(a=null!==(i=null!==(o=null!==(l=u.url)&&void 0!==l?l:u.source_id)&&void 0!==o?o:u.sourceid)&&void 0!==i?i:u.source_name)&&void 0!==a?a:"").toLowerCase();c&&t.has(c)||(c&&t.add(c),e.push({src:u,index:s}))}return e},[r,n]);e.useEffect(()=>{if(!o)return;const e=e=>{const t="function"==typeof e.composedPath?e.composedPath():[],n=a.current&&t.includes(a.current),r=i.current&&t.includes(i.current);n||r||l(!1)},t=e=>{"Escape"===e.key&&l(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]);if(!r)return null;if(Array.isArray(r.sources)&&0===r.sources.length)return null;if(0===c.length)return null;const d=c[0],p=c.length-1,f=j9(d.src,d.index),g=M9(d.src),m=r.downloadingKey&&r.downloadingKey===F9(d.src),h=e=>{"function"==typeof r.onSourceActivate&&r.onSourceActivate(e)},b=e=>{e.preventDefault(),e.stopPropagation(),1!==c.length?o?l(!1):(()=>{const e=a.current;if(!e)return;const t=e.getBoundingClientRect();u({top:t.bottom+window.scrollY+4,left:t.left+window.scrollX}),l(!0)})():h(d.src)};return nt.jsxs(nt.Fragment,{children:[nt.jsxs("span",{ref:a,role:"button",tabIndex:0,title:f+(p?" (+".concat(p," more)"):""),onClick:b,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b(e))},style:{display:"inline-flex",alignItems:"center",gap:3,height:20,padding:"0 5px 0 6px",margin:"0 2px",fontSize:11,lineHeight:1,borderRadius:5,background:null!=r&&r.textColor?"rgba(128,128,128,0.08)":"rgba(59, 130, 246, 0.10)",color:(null==r?void 0:r.textColor)||"rgb(37, 99, 235)",border:null!=r&&r.textColor?"0.5px solid ".concat(r.textColor):"0.5px solid rgba(59, 130, 246, 0.35)",cursor:"pointer",userSelect:"none",maxWidth:180,verticalAlign:"1px",textDecoration:"none",fontWeight:500,whiteSpace:"nowrap"},children:[nt.jsx("span",{style:{display:"inline-flex",flexShrink:0},children:g?nt.jsx(R9,{size:12,strokeWidth:2,"aria-hidden":!0}):nt.jsx(P9,{size:12,strokeWidth:2,"aria-hidden":!0})}),nt.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:f}),p>0&&nt.jsxs("span",{style:{background:null!=r&&r.textColor?"transparent":"rgb(37, 99, 235)",color:(null==r?void 0:r.textColor)||"white",border:null!=r&&r.textColor?"1px solid ".concat(r.textColor):"none",borderRadius:3,padding:"1px 4px",fontSize:9,lineHeight:1,fontWeight:600,marginLeft:1},children:["+",p]}),1===c.length&&nt.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,paddingLeft:3,borderLeft:null!=r&&r.textColor?"0.5px solid ".concat(r.textColor):"0.5px solid rgba(59, 130, 246, 0.35)",marginLeft:2},children:m?nt.jsx(D9,{size:12,strokeWidth:2,className:"animate-spin"}):g?nt.jsx(N9,{size:12,strokeWidth:2}):nt.jsx(C9,{size:12,strokeWidth:2})})]}),o&&s&&"undefined"!=typeof document&&SJ.createPortal(nt.jsxs("div",{ref:i,role:"dialog","aria-label":"".concat(c.length," sources cited"),style:{position:"absolute",top:s.top,left:s.left,zIndex:2147483647,background:"#fff",color:"#111",border:"0.5px solid rgba(0, 0, 0, 0.12)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0,0,0,0.06)",padding:6,minWidth:240,maxWidth:360,fontSize:12},onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:[nt.jsxs("div",{style:{fontSize:10,textTransform:"uppercase",opacity:.55,letterSpacing:"0.06em",padding:"4px 6px 6px"},children:[c.length," source",1===c.length?"":"s"]}),c.map(e=>{let{src:t,index:n}=e;const a=j9(t,n),i=M9(t),o=r.downloadingKey&&r.downloadingKey===F9(t);return nt.jsxs("button",{type:"button",onClick:()=>h(t),disabled:!!o,title:a,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 8px",border:0,background:"transparent",color:"inherit",cursor:o?"default":"pointer",textAlign:"left",borderRadius:4,font:"inherit"},onMouseEnter:e=>{e.currentTarget.style.background="rgba(0,0,0,0.04)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:[nt.jsx("span",{style:{display:"inline-flex",flexShrink:0,opacity:.8},children:i?nt.jsx(R9,{size:14,strokeWidth:2,"aria-hidden":!0}):nt.jsx(P9,{size:14,strokeWidth:2,"aria-hidden":!0})}),nt.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),nt.jsx("span",{style:{display:"inline-flex",flexShrink:0,opacity:.7},children:o?nt.jsx(D9,{size:14,strokeWidth:2,className:"animate-spin"}):i?nt.jsx(N9,{size:14,strokeWidth:2}):nt.jsx(C9,{size:14,strokeWidth:2})})]},"".concat(n,"-").concat(F9(t)||n))})]}),document.body)]})}const U9=["node","children"],z9=["children"],$9=["node","children"],G9=["node","children"],H9=["node","children"],W9=["node","children","start"],V9=["node","children","data-ol-index"],q9=["node","children"],Y9=["node","children"],K9=["node","children"],X9=["node","children"],Z9=["node","children"],Q9=["node","children"],J9=["node","children"],e7=["className","children"],t7=new Set(["eshal-ui","eshal-chart","chart"]);function n7(e,t){if(!t)return e;const n=/^```(?:eshal-ui|eshal-chart|chart)\b/m.exec(e);if(n){const t=e.slice(n.index+n[0].length).split("\n").some(e=>"```"===e.trim());if(!t)return e.slice(0,n.index).trimEnd()}const r=e.split("\n");let a=r.length-1;for(;a>0&&""===r[a].trim();)a--;if(!r[a].trim().startsWith("|"))return e;let i=a;for(;i>0&&(r[i-1].trim().startsWith("|")||""===r[i-1].trim());)i--;const o=r.slice(i,a+1).some(e=>/^\|[\s\-:|]+\|/.test(e.trim()));return o?e:r.slice(0,i).join("\n")}function r7(e){return e.replace(/(\d+\.\d{2})0+(?!\d)/g,"$1")}"undefined"!=typeof window&&(window.__eshalChatWidgetChunks=window.__eshalChatWidgetChunks||{},window.__eshalChatWidgetChunks.MarkdownRenderer=function(t){let{content:n,isStreaming:r,isDark:a=!1,isRtl:l=!1,textColor:s,fontFamily:u,fontSize:c,onButtonClick:d,provideCitations:p=!0}=t;return nt.jsx(ba,{className:"max-w-none [&>*:last-child]:!mb-0 [&>*:first-child]:!mt-0",remarkPlugins:[po,go],rehypePlugins:p?[w9]:[],components:{span(e){var t;let{node:n,children:r}=e,a=o(e,U9);const l=null!==(t=a["data-eshal-citation"])&&void 0!==t?t:a.dataEshalCitation;if("string"==typeof l&&l.length>0){const e=function(e){if(!e)return[];const t=[];for(const n of String(e).split(",")){const e=parseInt(n.trim(),10);Number.isFinite(e)&&e>=1&&t.push(e)}return S9(t)}(l);if(e.length>0)return nt.jsx(B9,{indices:e})}return nt.jsx("span",i(i({},a),{},{children:r}))},pre(t){let{children:n}=t,r=o(t,z9);return function(t){return e.Children.toArray(t).some(t=>{var n;if(!e.isValidElement(t))return!1;const r=null===(n=t.props)||void 0===n?void 0:n.className;if("string"!=typeof r)return!1;const a=r.match(/language-([\w-]+)/);return!!a&&t7.has(a[1])})}(n)?nt.jsx(nt.Fragment,{children:n}):nt.jsx("pre",i(i({},r),{},{children:n}))},a(e){let{node:t,children:n}=e,r=o(e,$9);return nt.jsx("a",i(i({className:"underline hover:opacity-80",dir:"ltr",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),unicodeBidi:"isolate"},target:"_blank",rel:"noopener noreferrer"},r),{},{children:n}))},p(e){var t;let{node:n,children:r}=e,l=o(e,G9);const d="li"===(null==n||null===(t=n.parent)||void 0===t?void 0:t.tagName);return nt.jsx("p",i(i({className:"leading-relaxed [&:first-child]:!mt-0",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",fontSize:c||"14px",margin:0,marginTop:0,marginBottom:d?"0.125rem":"0.85rem",lineHeight:"1.6",padding:0}},l),{},{children:r}))},ul(e){let{node:t,children:n}=e,r=o(e,H9);return nt.jsx("ul",i(i({className:"list-disc [&:first-child]:!mt-0",style:{marginTop:0,marginBottom:"0.6rem",paddingInlineStart:"1.2rem"}},r),{},{children:n}))},ol(t){let{node:n,children:r,start:a=1}=t,l=o(t,W9);const s=Number.isFinite(Number(a))?Number(a):1;let u=0;return nt.jsx("ol",i(i({className:"[&:first-child]:!mt-0",style:{listStyle:"none",marginTop:0,marginBottom:"0.6rem",paddingInlineStart:0}},l),{},{children:e.Children.map(r,t=>{if(!e.isValidElement(t))return t;const n=s+u;return u+=1,e.cloneElement(t,{"data-ol-index":n})})}))},li(e){let{node:t,children:n,"data-ol-index":r}=e,l=o(e,V9);const d={color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",fontSize:c||"14px",marginBottom:"0.3rem",lineHeight:"1.5"};return null!=r?nt.jsxs("li",i(i({style:i(i({},d),{},{listStyle:"none",display:"flex",alignItems:"baseline",gap:"0.4em"})},l),{},{children:[nt.jsxs("span",{style:{flexShrink:0,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif',fontVariantNumeric:"tabular-nums",minWidth:"1.5em",color:"inherit"},"aria-hidden":"false",children:[r,"."]}),nt.jsx("span",{style:{flex:"1 1 auto",minWidth:0},children:n})]})):nt.jsx("li",i(i({className:"",style:d},l),{},{children:n}))},h1(e){let{node:t,children:n}=e,r=o(e,q9);return nt.jsx("h1",i(i({className:"text-xl font-bold [&:first-child]:!mt-0",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",marginTop:"0.7rem",marginBottom:"0.45rem",lineHeight:"1.35"}},r),{},{children:n}))},h2(e){let{node:t,children:n}=e,r=o(e,Y9);return nt.jsx("h2",i(i({className:"text-lg font-semibold [&:first-child]:!mt-0",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",marginTop:"0.65rem",marginBottom:"0.4rem",lineHeight:"1.35"}},r),{},{children:n}))},h3(e){let{node:t,children:n}=e,r=o(e,K9);return nt.jsx("h3",i(i({className:"text-base font-semibold [&:first-child]:!mt-0",style:{color:s||(a?"#f3f4f6":"#1A1A1A"),fontFamily:u||"Inter",marginTop:"0.6rem",marginBottom:"0.35rem",lineHeight:"1.35"}},r),{},{children:n}))},blockquote(e){let{node:t,children:n}=e,r=o(e,X9);return nt.jsx("blockquote",i(i({className:"border-l-4 pl-4 italic ".concat(a?"border-gray-600 text-gray-300":"border-gray-300 text-gray-700")},r),{},{children:n}))},table(e){var t;let{node:n,children:r}=e,l=o(e,Z9);if((null==n||null===(t=n.children)||void 0===t?void 0:t.length)>0){var s;function u(e){return e?"string"==typeof e.value?e.value:Array.isArray(e.children)?e.children.map(u).join(""):"":""}const c=n.children.find(e=>"thead"===e.tagName),d=n.children.find(e=>"tbody"===e.tagName),p=null==c||null===(s=c.children)||void 0===s?void 0:s.find(e=>"tr"===e.tagName),f=((null==p?void 0:p.children)||[]).filter(e=>"th"===e.tagName).map(e=>u(e)),g=((null==d?void 0:d.children)||[]).filter(e=>"tr"===e.tagName),m=g.map(e=>(e.children||[]).filter(e=>"td"===e.tagName).map(e=>u(e)));if(f.length>0&&m.length>0){const h=m.map(e=>Object.fromEntries(f.map((t,n)=>{var r;return[t,null!==(r=e[n])&&void 0!==r?r:""]})));return nt.jsx(k8,{spec:{type:"table",columns:f,data:h},isDark:a})}}return nt.jsx("div",{className:"overflow-x-auto my-3 rounded-lg border ".concat(a?"border-gray-700 bg-gray-900":"border-gray-200 bg-white"),children:nt.jsx("table",i(i({className:"min-w-full border-collapse ".concat(a?"text-gray-100":"text-gray-900")},l),{},{children:r}))})},th(e){let{node:t,children:n}=e,r=o(e,Q9);return nt.jsx("th",i(i({className:"border px-3 py-2 text-left font-medium ".concat(a?"border-gray-700 bg-gray-800/50 text-gray-300":"border-gray-200 bg-gray-50 text-gray-700")},r),{},{children:n}))},td(e){let{node:t,children:n}=e,r=o(e,J9);return nt.jsx("td",i(i({className:"border px-3 py-2 ".concat(a?"border-gray-700":"border-gray-200")},r),{},{children:n}))},code(e){let{className:t,children:n}=e,r=o(e,e7);const l=/language-([\w-]+)/.exec(t||""),s=l?l[1]:null;if(s&&t7.has(s)){const e=function(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"string"==typeof e?e:"").join(""):""}(n).trim();try{const t=JSON.parse(e);if(t&&"object"==typeof t)return nt.jsx(k8,{spec:t,isDark:a,onButtonClick:d})}catch(e){return null}return null}return l?nt.jsx(eE,i(i({style:tE,language:s,PreTag:"div",wrapLines:!0},r),{},{children:String(n).replace(/\n$/,"")})):nt.jsx("code",i(i({className:t},r),{},{children:n}))}},children:r7(n7(n,r))})})}(__eshalChatWidgetReact);
@@ -1 +1 @@
1
- export{S as default}from"./chat-widget-index-CUW4QWbL.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
1
+ export{S as default}from"./chat-widget-index-C9411407.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";