@bytebrain.ai/bytebrain-ui 0.0.9 → 0.0.10
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/ChatApp.d.ts +5 -1
- package/dist/ChatApp.test.d.ts +1 -0
- package/dist/ChatMessage.d.ts +2 -0
- package/dist/ChatPrompt.d.ts +4 -0
- package/dist/Message.d.ts +2 -0
- package/dist/PopupChatWindow.d.ts +9 -1
- package/dist/PopupChatWindow.test.d.ts +1 -0
- package/dist/QuoteCard.d.ts +26 -0
- package/dist/SelectionAsk.d.ts +39 -0
- package/dist/SelectionAsk.test.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/selectionContext.d.ts +34 -0
- package/package.json +1 -1
package/dist/ChatApp.d.ts
CHANGED
|
@@ -14,11 +14,15 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
|
-
|
|
17
|
+
import { ChatBranding } from './PopupChatWindow';
|
|
18
|
+
interface ChatAppProps extends ChatBranding {
|
|
18
19
|
websocketHost?: string;
|
|
19
20
|
websocketPort?: string;
|
|
20
21
|
websocketEndpoint: string;
|
|
21
22
|
apikey: string;
|
|
23
|
+
buttonLabel?: string;
|
|
24
|
+
askOnSelect?: boolean;
|
|
25
|
+
askExcludeSelector?: string;
|
|
22
26
|
}
|
|
23
27
|
declare const ChatApp: React.FC<ChatAppProps>;
|
|
24
28
|
export default ChatApp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/ChatMessage.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import React from 'react';
|
|
|
18
18
|
import { ReferenceItem } from "./References";
|
|
19
19
|
import Message from "./Message";
|
|
20
20
|
import UserTypes from "./UserTypes";
|
|
21
|
+
import { AskContext } from "./selectionContext";
|
|
21
22
|
interface ChatMessageProps {
|
|
22
23
|
id: string;
|
|
23
24
|
chatHistory: Message[];
|
|
@@ -27,6 +28,7 @@ interface ChatMessageProps {
|
|
|
27
28
|
setQuestion: React.Dispatch<React.SetStateAction<string>>;
|
|
28
29
|
references: ReferenceItem[];
|
|
29
30
|
index: number;
|
|
31
|
+
context?: AskContext;
|
|
30
32
|
}
|
|
31
33
|
declare const ChatMessage: React.FC<ChatMessageProps>;
|
|
32
34
|
export default ChatMessage;
|
package/dist/ChatPrompt.d.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import './ChatPrompt.css';
|
|
18
|
+
import { AskContext } from './selectionContext';
|
|
19
|
+
export declare const DEFAULT_ASK_QUESTION = "Explain this";
|
|
18
20
|
interface ChatPromptProps {
|
|
19
21
|
title?: string;
|
|
20
22
|
defaultQuestion?: string;
|
|
@@ -24,6 +26,8 @@ interface ChatPromptProps {
|
|
|
24
26
|
apikey: string;
|
|
25
27
|
welcomeMessages: string[];
|
|
26
28
|
fullScreen?: boolean;
|
|
29
|
+
askContext?: AskContext | null;
|
|
30
|
+
onAskContextDone?: () => void;
|
|
27
31
|
}
|
|
28
32
|
export declare const ChatPrompt: (props: ChatPromptProps) => React.JSX.Element;
|
|
29
33
|
export default ChatPrompt;
|
package/dist/Message.d.ts
CHANGED
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { ReferenceItem } from './References';
|
|
17
17
|
import UserTypes from "./UserTypes";
|
|
18
|
+
import { AskContext } from './selectionContext';
|
|
18
19
|
export interface Message {
|
|
19
20
|
userType: UserTypes;
|
|
20
21
|
message: string;
|
|
21
22
|
completed: boolean;
|
|
22
23
|
references?: ReferenceItem[];
|
|
24
|
+
context?: AskContext;
|
|
23
25
|
}
|
|
24
26
|
export default Message;
|
|
@@ -14,13 +14,21 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
|
-
|
|
17
|
+
import { AskContext } from "./selectionContext";
|
|
18
|
+
export interface ChatBranding {
|
|
19
|
+
title?: string;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
welcomeMessages?: string[];
|
|
22
|
+
}
|
|
23
|
+
interface PopupChatWindowProps extends ChatBranding {
|
|
18
24
|
visible: boolean;
|
|
19
25
|
onClose: () => void;
|
|
20
26
|
websocketHost?: string;
|
|
21
27
|
websocketPort?: string;
|
|
22
28
|
websocketEndpoint?: string;
|
|
23
29
|
apikey: string;
|
|
30
|
+
askContext?: AskContext | null;
|
|
31
|
+
onAskContextDone?: () => void;
|
|
24
32
|
}
|
|
25
33
|
declare const PopupChatWindow: React.FC<PopupChatWindowProps>;
|
|
26
34
|
export default PopupChatWindow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-2024 ByteBrain AI
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { AskContext } from './selectionContext';
|
|
18
|
+
interface QuoteCardProps {
|
|
19
|
+
context: AskContext;
|
|
20
|
+
onRemove: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const QuoteCard: React.FC<QuoteCardProps>;
|
|
23
|
+
export declare const SentQuote: React.FC<{
|
|
24
|
+
context: Pick<AskContext, 'quote' | 'pageTitle'>;
|
|
25
|
+
}>;
|
|
26
|
+
export default QuoteCard;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-2024 ByteBrain AI
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import './SelectionAsk.css';
|
|
18
|
+
import { AskContext } from './selectionContext';
|
|
19
|
+
export declare const BUTTON_HEIGHT = 44;
|
|
20
|
+
export type Placement = 'above' | 'below';
|
|
21
|
+
export interface Position {
|
|
22
|
+
top: number;
|
|
23
|
+
left: number;
|
|
24
|
+
placement: Placement;
|
|
25
|
+
}
|
|
26
|
+
interface Rect {
|
|
27
|
+
top: number;
|
|
28
|
+
bottom: number;
|
|
29
|
+
left: number;
|
|
30
|
+
width: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function placeButton(rect: Rect | null, viewportWidth: number, viewportHeight: number, touch: boolean): Position;
|
|
33
|
+
interface SelectionAskProps {
|
|
34
|
+
label: string;
|
|
35
|
+
onAsk: (context: AskContext) => void;
|
|
36
|
+
excludeSelector?: string;
|
|
37
|
+
}
|
|
38
|
+
declare const SelectionAsk: React.FC<SelectionAskProps>;
|
|
39
|
+
export default SelectionAsk;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useState as t,useEffect as n,useRef as r}from"react";import o from"highlight.js";import a from"react-markdown";function s(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}s(".custom-list {\n\n padding-left: 0.5rem;\n\n margin: 0px\n}\n\n\n");const i=({items:t,setQuestion:n})=>e.createElement(e.Fragment,null,t&&t.length>0?e.createElement("div",{className:"text-xs px-4 pt-2 rounded-br-none bg-blue-500 text-white"},e.createElement("h3",{className:"text-xs font-bold"},"Ask Related Questions:"),e.createElement("ol",{className:"list-inside custom-list"},t.map(((t,r)=>e.createElement("li",{key:r,className:"mr-2"},e.createElement("a",{className:"underline text-white text-sm hover:text-black",href:"#",onClick:e=>n(e.target.textContent)},t)))))):null),l=({items:t})=>e.createElement(e.Fragment,null,t&&t.length>0?e.createElement("div",{className:"text-xs px-4 py-2 rounded-b-lg rounded-br-none bg-blue-500 text-white"},e.createElement("h3",{className:"text-xs font-bold"},"Discover Related Sources:"),e.createElement("ol",{className:"flex flex-wrap list-inside pl-0"},t.map(((t,n)=>e.createElement("li",{key:n,className:"mr-2"},e.createElement("a",{className:"underline text-white text-sm hover:text-black",href:t.page_url},t.page_title)))))):null);s("pre code.hljs {\n display: block;\n overflow-x: auto;\n padding: 1em\n}\ncode.hljs {\n padding: 3px 5px\n}\n/*!\n Theme: GitHub\n Description: Light theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-light\n Current colors taken from GitHub's CSS\n*/\n.hljs {\n color: #24292e;\n background: #ffffff\n}\n.hljs-doctag,\n.hljs-keyword,\n.hljs-meta .hljs-keyword,\n.hljs-template-tag,\n.hljs-template-variable,\n.hljs-type,\n.hljs-variable.language_ {\n /* prettylights-syntax-keyword */\n color: #d73a49\n}\n.hljs-title,\n.hljs-title.class_,\n.hljs-title.class_.inherited__,\n.hljs-title.function_ {\n /* prettylights-syntax-entity */\n color: #6f42c1\n}\n.hljs-attr,\n.hljs-attribute,\n.hljs-literal,\n.hljs-meta,\n.hljs-number,\n.hljs-operator,\n.hljs-variable,\n.hljs-selector-attr,\n.hljs-selector-class,\n.hljs-selector-id {\n /* prettylights-syntax-constant */\n color: #005cc5\n}\n.hljs-regexp,\n.hljs-string,\n.hljs-meta .hljs-string {\n /* prettylights-syntax-string */\n color: #032f62\n}\n.hljs-built_in,\n.hljs-symbol {\n /* prettylights-syntax-variable */\n color: #e36209\n}\n.hljs-comment,\n.hljs-code,\n.hljs-formula {\n /* prettylights-syntax-comment */\n color: #6a737d\n}\n.hljs-name,\n.hljs-quote,\n.hljs-selector-tag,\n.hljs-selector-pseudo {\n /* prettylights-syntax-entity-tag */\n color: #22863a\n}\n.hljs-subst {\n /* prettylights-syntax-storage-modifier-import */\n color: #24292e\n}\n.hljs-section {\n /* prettylights-syntax-markup-heading */\n color: #005cc5;\n font-weight: bold\n}\n.hljs-bullet {\n /* prettylights-syntax-markup-list */\n color: #735c0f\n}\n.hljs-emphasis {\n /* prettylights-syntax-markup-italic */\n color: #24292e;\n font-style: italic\n}\n.hljs-strong {\n /* prettylights-syntax-markup-bold */\n color: #24292e;\n font-weight: bold\n}\n.hljs-addition {\n /* prettylights-syntax-markup-inserted */\n color: #22863a;\n background-color: #f0fff4\n}\n.hljs-deletion {\n /* prettylights-syntax-markup-deleted */\n color: #b31d28;\n background-color: #ffeef0\n}\n.hljs-char.escape_,\n.hljs-link,\n.hljs-params,\n.hljs-property,\n.hljs-punctuation,\n.hljs-tag {\n /* purposely ignored */\n \n}");const c=()=>e.createElement("svg",{stroke:"currentColor",className:"dark:fill-white w-8 h-8",width:"512",height:"512",strokeWidth:1.2,version:"1.1",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"m251.5 465.47c-2.2-0.79382-4.0658-1.4501-4.1462-1.4584-0.0804-8e-3 -11.213-14.603-24.738-32.433-13.526-17.83-25.783-33.355-27.239-34.5-2.5677-2.0197-3.6988-2.0819-37.881-2.0819-26.502 0-37.311-0.36376-43.615-1.4678-41.84-7.3275-73.739-38.446-83.067-81.032-1.0295-4.7003-1.3141-24.846-1.3141-93 0-87 0-87 2.3606-95.933 4.8879-18.497 12.559-32.605 24.787-45.587 9.2497-9.82 17.894-16.206 29.853-22.055 12.164-5.9487 22.475-8.7238 37-9.9582 14.341-1.2188 250.66-1.2188 265 0 14.525 1.2344 24.836 4.0095 37 9.9582 27.681 13.537 46.498 36.883 54.694 67.859 2.3061 8.7158 2.3061 8.7158 2.3061 95.716 0 91.914 0.0591 90.587-4.7047 105.5-6.7536 21.141-21.967 41.003-40.805 53.271-10.293 6.7034-17.59 10.036-29.49 13.469-8.8282 2.5465-9.7661 2.6072-49.147 3.1783-38.3 0.55544-40.249 0.67425-42.37 2.5822-1.2225 1.1-12.734 15.789-25.581 32.643-22.432 29.428-27.972 35.857-30.897 35.857-0.73782 0-1.9408 0.20627-2.6733 0.45837-0.73249 0.25211-3.1318-0.19112-5.3318-0.98494zm23.537-59.973c10.012-13.2 19.611-25.489 21.333-27.309s6.0438-4.7447 9.605-6.5c6.4748-3.1914 6.4748-3.1914 47.5-3.7939 45.163-0.66322 46.206-0.7918 60.055-7.4041 22.518-10.752 38.146-32.47 41.471-57.628 0.75544-5.7172 0.99241-33.69 0.74856-88.365-0.32659-73.226-0.50777-80.505-2.1398-85.964-7.6316-25.527-24.675-43.653-49.109-52.228-8-2.8078-8-2.8078-148.5-2.8078s-140.5 0-148.5 2.8078c-24.041 8.4376-41.205 26.366-48.686 50.854-2.2293 7.2975-2.2438 7.7874-2.5808 87.339-0.23126 54.58 0.01227 82.658 0.76639 88.365 3.3308 25.208 18.878 46.839 41.391 57.59 13.937 6.655 14.937 6.7788 60.109 7.4426 41 0.60245 41 0.60245 46.5 3.1926 3.025 1.4246 6.9095 3.7825 8.6322 5.2398 1.7227 1.4573 11.848 14.126 22.5 28.154 10.652 14.027 19.668 25.394 20.035 25.26 0.36691-0.13406 8.8583-11.044 18.87-24.244zm-113.54-158.39c-8.0155-2.0869-15.285-7.9248-19.132-15.365-0.91824-1.7757-1.8816-6.1929-2.1409-9.8161-0.7674-10.725 4.3824-20.221 13.724-25.305 18.472-10.054 40.351 2.8809 40.386 23.877 0.0238 14.063-10.461 25.41-24.837 26.879-2.75 0.28104-6.35 0.15949-8-0.2701zm87.306-0.4596c-4.9404-1.3809-6.2234-2.1606-11.678-7.0974-8.3404-7.5483-10.677-21.444-5.3274-31.684 4.7261-9.0467 14.275-14.868 24.388-14.868 19.531 0 32.73 20.777 24.459 38.5-2.5529 5.4705-9.0324 11.927-14.09 14.04-4.9964 2.0876-12.56 2.5602-17.752 1.1091zm88.987-3e-3c-6.3455-1.7731-12.159-5.9747-15.733-11.371-12.497-18.867 2.493-44.045 25.008-42.003 15.041 1.3638 25.769 13.807 24.706 28.656-0.25923 3.6232-1.2226 8.0404-2.1409 9.8161-6.175 11.941-19.731 18.285-31.84 14.902z"})),d=()=>e.createElement("svg",{version:"1.1",stroke:"currentColor",className:"dark:fill-white w-8 h-8 pt-2",width:"546.1333",height:"546.1333",viewBox:"0 0 546.1333 546.1333",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M 248.18949,545.01565 C 140.78277,536.1654 43.347437,457.67748 12.625464,354.27462 -19.122727,256.23986 11.148578,141.59748 88.05005,72.75365 170.6778,-6.3870784 305.25108,-22.727519 404.55416,34.075212 c 90.71756,48.808052 148.5915,152.240698 140.72412,255.265468 -4.721,117.18135 -94.83362,223.7082 -209.03208,249.29175 -28.74608,6.97865 -58.63168,7.99917 -88.05671,6.38322 z m 59.01049,-33.47524 c 44.11214,-6.14054 85.94851,-25.33589 120.34908,-53.46875 -7.50443,-76.23751 -78.33803,-139.58196 -155.13069,-137.4082 -75.87947,-1.11955 -147.39136,61.9662 -153.18566,137.95022 51.92152,43.01255 121.21529,62.41741 187.96727,52.92673 z M 95.23624,417.23455 c 17.04457,-53.94473 60.52333,-97.03721 112.76027,-117.54871 -38.16232,-27.24165 -58.08238,-77.27541 -46.17288,-123.04103 13.97512,-63.62214 88.10784,-103.424302 148.92029,-80.419223 54.27562,17.927063 88.7395,80.021723 73.57777,135.512803 -6.24704,27.51678 -24.27076,50.99914 -46.18838,68.09848 55.60255,21.00409 99.9566,68.92585 115.77754,126.329 11.90975,-0.3504 25.78141,-30.94799 34.70002,-45.64418 C 534.17056,292.25875 516.88138,176.40132 446.32219,106.18998 376.66755,30.895815 256.59496,9.9644804 165.64534,57.566388 73.710219,101.90396 17.392768,209.22775 35.202048,310.08314 c 6.457967,44.14691 25.903239,86.34538 55.464613,119.76818 1.924099,-4.05191 3.127315,-8.38542 4.569579,-12.61677 z m 188.6392,-130.78572 c 51.57064,-4.49807 86.2598,-64.54174 66.52297,-111.81618 -17.42381,-48.17969 -82.7984,-69.2237 -124.13766,-38.07569 -43.14422,27.09101 -48.02204,94.62224 -9.98242,128.12649 17.76999,16.83784 43.29836,25.47902 67.59711,21.76538 z"}));var h;!function(e){e.User="user",e.Bot="bot"}(h||(h={}));var p=h;const m=r=>{const[s,h]=t(r.chatHistory);n((()=>{r.highlight&&r.userType===p.Bot&&document.querySelectorAll("#"+r.id+" pre code").forEach((e=>{o.highlightElement(e)}))}),[r.highlight,r.userType,r.id]),n((()=>{h(r.chatHistory)}),[r]);let m=null;if(r.userType===p.User)m=e.createElement("div",{className:"w-full chat-message user-message text-base flex flex-row space-x-2",id:r.id},e.createElement(d,null),e.createElement(a,{className:"px-4 py-2 rounded-lg rounded-bl-none bg-gray-300 text-gray-600"},r.text));else if(r.userType===p.Bot)if(String(r.text).includes("Related Questions:")){const t=r.text.split("Related Questions:"),n=(g=t[1].trim(),g.split(/\n/).filter((e=>e.length>0)).map((e=>e.trim())).filter((e=>/\d+|[*-]/.test(e)))).map((e=>function(e){return e.replace(/^\d+\.|[*-]\s*/,"")}(e)));m=e.createElement("div",{className:"w-full chat-message bot-message text-base flex flex-row space-x-2",id:r.id},e.createElement(c,null),e.createElement("div",{className:"w-full"},e.createElement(a,{className:"px-4 py-2 space-y-2 rounded-t-lg bg-blue-600 text-white"},t[0]),e.createElement(i,{items:n,setQuestion:r.setQuestion}),e.createElement(l,{items:r.references})))}else m=e.createElement("div",{className:"w-full chat-message bot-message text-base flex flex-row space-x-2",id:r.id},e.createElement(c,null),e.createElement("div",{className:"w-full"},e.createElement(a,{className:"px-4 py-2 space-y-2 rounded-t-lg bg-blue-600 text-white"},r.text),e.createElement(l,{items:r.references})));var g;return m};s('*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.bottom-5 {\n bottom: 1.25rem;\n}\n.left-5 {\n left: 1.25rem;\n}\n.right-0 {\n right: 0px;\n}\n.right-5 {\n right: 1.25rem;\n}\n.mb-6 {\n margin-bottom: 1.5rem;\n}\n.mr-2 {\n margin-right: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.hidden {\n display: none;\n}\n.h-10 {\n height: 2.5rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-screen {\n height: 100vh;\n}\n.max-h-screen {\n max-height: 100vh;\n}\n.w-8 {\n width: 2rem;\n}\n.w-full {\n width: 100%;\n}\n.list-inside {\n list-style-position: inside;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.justify-between {\n justify-content: space-between;\n}\n.space-x-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.5rem * var(--tw-space-x-reverse));\n margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.overflow-y-scroll {\n overflow-y: scroll;\n}\n.scroll-smooth {\n scroll-behavior: smooth;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-b-lg {\n border-bottom-right-radius: 0.5rem;\n border-bottom-left-radius: 0.5rem;\n}\n.rounded-t-lg {\n border-top-left-radius: 0.5rem;\n border-top-right-radius: 0.5rem;\n}\n.rounded-bl-none {\n border-bottom-left-radius: 0px;\n}\n.rounded-br-none {\n border-bottom-right-radius: 0px;\n}\n.rounded-tl-md {\n border-top-left-radius: 0.375rem;\n}\n.border-0 {\n border-width: 0px;\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n.bg-blue-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n}\n.bg-blue-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(37 99 235 / var(--tw-bg-opacity));\n}\n.bg-gray-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity));\n}\n.bg-gray-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(229 231 235 / var(--tw-bg-opacity));\n}\n.bg-gray-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(209 213 219 / var(--tw-bg-opacity));\n}\n.bg-orange-400 {\n --tw-bg-opacity: 1;\n background-color: rgb(251 146 60 / var(--tw-bg-opacity));\n}\n.p-5 {\n padding: 1.25rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.font-sans {\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n}\n.text-3xl {\n font-size: 1.875rem;\n line-height: 2.25rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-normal {\n font-weight: 400;\n}\n.text-\\[red\\] {\n --tw-text-opacity: 1;\n color: rgb(255 0 0 / var(--tw-text-opacity));\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n.underline {\n text-decoration-line: underline;\n}\n.placeholder-black::placeholder {\n --tw-placeholder-opacity: 1;\n color: rgb(0 0 0 / var(--tw-placeholder-opacity));\n}\n.placeholder-gray-500::placeholder {\n --tw-placeholder-opacity: 1;\n color: rgb(107 114 128 / var(--tw-placeholder-opacity));\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n#scroller * {\n overflow-anchor: none;\n}\n\n#anchor {\n overflow-anchor: auto;\n height: 1px;\n}\n\np code {\n border-radius: 3px;\n}\n\n.chat-message p {\n margin: 0;\n}\n\n.user-message p code {\n background-color: aliceblue;\n}\n\n.bot-message p code {\n background-color: cornflowerblue;\n}\n\n.bot-message li > code {\n background-color: cornflowerblue;\n}\n\nol {\n list-style-type: decimal;\n margin: 1.0em;\n}\n\nli {\n padding: 0.2em;\n}\n\n#ChatPrompt ::-webkit-scrollbar {\n display: none;\n}\n\npre {\n color: black;\n white-space: pre-wrap;\n word-break: break-word;\n}\n\n.hover\\:scale-95:hover {\n --tw-scale-x: .95;\n --tw-scale-y: .95;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n\n.hover\\:bg-gray-900:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(17 24 39 / var(--tw-bg-opacity));\n}\n\n.hover\\:text-black:hover {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n\n.focus\\:outline-none:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n\n.disabled\\:cursor-not-allowed:disabled {\n cursor: not-allowed;\n}\n\n.disabled\\:opacity-75:disabled {\n opacity: 0.75;\n}\n\n:is([data-theme="dark"] .dark\\:bg-\\[\\#242526\\]) {\n --tw-bg-opacity: 1;\n background-color: rgb(36 37 38 / var(--tw-bg-opacity));\n}\n\n:is([data-theme="dark"] .dark\\:bg-\\[\\#2b2e30\\]) {\n --tw-bg-opacity: 1;\n background-color: rgb(43 46 48 / var(--tw-bg-opacity));\n}\n\n:is([data-theme="dark"] .dark\\:fill-white) {\n fill: #fff;\n}\n\n:is([data-theme="dark"] .dark\\:text-white) {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n:is([data-theme="dark"] .dark\\:placeholder-white)::placeholder {\n --tw-placeholder-opacity: 1;\n color: rgb(255 255 255 / var(--tw-placeholder-opacity));\n}\n\n@media (min-width: 640px) {\n .sm\\:w-\\[100\\%\\] {\n width: 100%;\n }\n}\n\n@media (min-width: 768px) {\n .md\\:w-\\[100\\%\\] {\n width: 100%;\n }\n}\n\n@media (min-width: 1024px) {\n .lg\\:w-\\[50\\%\\] {\n width: 50%;\n }\n}\n\n@media (min-width: 1280px) {\n .xl\\:w-\\[40\\%\\] {\n width: 40%;\n }\n}\n\n@media (min-width: 1536px) {\n .\\32xl\\:w-\\[30\\%\\] {\n width: 30%;\n }\n}\n');const g="bytebrain-session",w=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;let u;function b(){const e="undefined"!=typeof window?window.crypto:void 0;if(e&&"function"==typeof e.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,(e=>e.toString(16).padStart(2,"0")));return[n.slice(0,4),n.slice(4,6),n.slice(6,8),n.slice(8,10),n.slice(10)].map((e=>e.join(""))).join("-")}const y=t=>{const{title:n="ByteBrain ChatBot",defaultQuestion:r="Send your message",websocketHost:o,websocketPort:a,websocketEndpoint:s,apikey:i,welcomeMessages:l,fullScreen:c}=t,d=l.map((e=>({userType:p.Bot,message:e,completed:!0}))),[h,y]=e.useState(r),[f,x]=e.useState([function(e){const t=Math.floor(Math.random()*e.length);return e.splice(t,1)[0]}(d)]),k=o||window.location.hostname,v="80"===a?"":":"+a,j="80"===a?"wss://":"ws://";const E=e=>x((t=>t.concat([{userType:p.Bot,message:e,completed:!0}]))),I=()=>{const e=new WebSocket(j+k+v+s+"/"+i+"?session="+function(){try{const e=window.sessionStorage.getItem(g);if(e&&w.test(e))return e;const t=b();return window.sessionStorage.setItem(g,t),t}catch(e){return u=u||b(),u}}());let t=!1;e.onopen=t=>{x((e=>e.concat([{userType:p.User,message:h,completed:!0}])));const n=f.map((e=>e.message)).slice(1),r={question:h,history:n};e.send(JSON.stringify(r))},e.onmessage=function(e){const n=JSON.parse(e.data);if(n.error)return t=!0,void E(String(n.error));const r=n.token,o=n.references,a=n.completed;a&&(t=!0),x((e=>{if(0===e.length||e[e.length-1].userType===p.User)return[...e,{userType:p.Bot,message:r,completed:a}];{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{message:t[t.length-1].message+r,references:o,completed:a}),t}}))},e.onclose=()=>{t||(t=!0,E("The connection was closed before an answer arrived. Please try again."))}};return e.createElement("div",{id:"ChatPrompt",className:"dark:bg-[#242526] justify-between flex flex-col p-5 rounded-md bg-gray-100 max-h-screen "+(c?"h-screen":"")},e.createElement("h1",{className:"text-[red] text-3xl font-bold mb-6"},n),e.createElement("div",{id:"scroller",className:"flex flex-col space-y-4 overflow-y-scroll scroll-smooth"},f.map(((t,n)=>e.createElement(m,{key:n,id:"chat"+n,index:n,userType:t.userType,text:t.message,references:t.references,highlight:t.completed,chatHistory:f,setQuestion:y}))),e.createElement("div",{id:"anchor"})),e.createElement("form",{onSubmit:e=>{e.preventDefault(),I(),e.target.reset(),y(r)},className:"flex bottom-5 left-5 right-5 h-10 mt-4"},e.createElement("input",{type:"text",id:"promptInput",onChange:e=>{y(e.target.value)},className:`w-full px-4 py-2 \n border-0\n rounded-md\n text-base\n text-black\n dark:text-white\n bg-gray-200\n dark:bg-[#2b2e30]\n focus:outline-none\n font-sans\n font-normal\n ${h===r?"placeholder-gray-500":"placeholder-black dark:placeholder-white"}\n `,placeholder:h}),e.createElement("button",{disabled:0!==f.length&&(f[f.length-1].userType==p.User||(f[f.length-1].userType==p.Bot?!f[f.length-1].completed:void 0)),id:"generateBtn",type:"submit",className:"px-6 rounded-md border-0 bg-black text-base text-white hover:bg-gray-900 focus:outline-none disabled:opacity-75 disabled:cursor-not-allowed font-sans font-normal"},"Send")))},f=({visible:t,onClose:o,websocketHost:a,websocketPort:s,websocketEndpoint:i,apikey:l})=>{const c=r(null);((e,t)=>{const r=n=>{var r;if("chat-button"===(null===(r=n.target)||void 0===r?void 0:r.id))return null;e.current&&!e.current.contains(n.target)&&t()};n((()=>(document.addEventListener("click",r),()=>{document.removeEventListener("click",r)})),[t,e])})(c,o);return e.createElement("div",{ref:c,id:"container",className:`fixed 2xl:w-[30%] xl:w-[40%] lg:w-[50%] md:w-[100%] sm:w-[100%] bottom-0 right-0 ${t?"block":"hidden"} `},e.createElement(y,{title:"ZIO Chat",defaultQuestion:"Write a question about ZIO!",websocketHost:a||"localhost",websocketPort:s||"8081",websocketEndpoint:i||"/chat",apikey:l,welcomeMessages:["🌟 Greetings from ZIO Chat! 🌟 Have questions about ZIO? Look no further! I'm here to be your ZIO guru. Whether you're a seasoned pro or just starting out, I've got answers tailored just for you. Fire away with your ZIO queries, and I'll hit you back with the best insights I've got. Let's dive into the world of ZIO together!","🔥 Ignite your ZIO journey with ZIO Chat! 🔥 Ready to unravel the intricacies of ZIO? As your trusty sidekick, I'm here to light the way. No matter if you're wandering through functional forests or traversing effectful landscapes, I've got answers to keep you on track. Your ZIO adventure starts here – ask me anything and let's explore together!","Hello! 😊 I'm your ZIO Chat Bot, designed to be your go-to resource for all things ZIO! Whether you're new to this powerful functional effect system or a seasoned pro, I'm here to assist you. ZIO empowers you to build concurrent and resilient applications in Scala, offering referential transparency, composable data types, type-safety, and more. So, go ahead and ask me anything about ZIO – I'm here to provide the answers you need! 🤖","Hi there! 👋 I'm ZIO Chat, your friendly neighborhood ZIO expert. I'm here to help you navigate the world of ZIO. Whether you're a seasoned pro or just starting out, fire away with your ZIO questions. I will hit you back with the best insights I've got. Let's dive into the world of ZIO together!","🎉 Hey there, ZIO aficionado! 🎉 Step into the ZIO wonderland with me as your guide. Whether you're a functional fanatic or just dipping your toes into the ZIO ecosystem, I'm here to make your journey smooth. Got ZIO questions? I've got answers! Let's navigate the ZIO universe together and unlock its infinite possibilities!","Hi, fellow coder! 🌟 Welcome to your ZIO adventure with the ZIO Chat Bot. 🚀 Let's master functional Scala together. From referential transparency to concurrent prowess, I've got your back. Ready to dive in? Your questions, my insights – let's conquer ZIO! 💡🤖"],fullScreen:!1}))},x=n=>{const[r,o]=t(!1);return e.createElement(e.Fragment,null,e.createElement("button",{id:"chat-button",className:"fixed border-0 font-sans text-xl bg-orange-400 rounded-tl-md text-black px-3 py-2 hover:scale-95 transition text-ms bottom-0 right-0",onClick:()=>o(!0)},"ZIO Chat!"),e.createElement(f,{onClose:()=>o(!1),visible:r,websocketHost:n.websocketHost,websocketPort:n.websocketPort,websocketEndpoint:n.websocketEndpoint,apikey:n.apikey}))};export{x as ChatApp,m as ChatMessage,y as ChatPrompt,f as PopupChatWindow,l as References,i as RelatedQuestions};
|
|
1
|
+
import e,{useState as t,useEffect as n,useRef as r,useCallback as o}from"react";import a from"highlight.js";import i from"react-markdown";function s(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}s(".custom-list {\n\n padding-left: 0.5rem;\n\n margin: 0px\n}\n\n\n");const l=({items:t,setQuestion:n})=>e.createElement(e.Fragment,null,t&&t.length>0?e.createElement("div",{className:"text-xs px-4 pt-2 rounded-br-none bg-blue-500 text-white"},e.createElement("h3",{className:"text-xs font-bold"},"Ask Related Questions:"),e.createElement("ol",{className:"list-inside custom-list"},t.map(((t,r)=>e.createElement("li",{key:r,className:"mr-2"},e.createElement("a",{className:"underline text-white text-sm hover:text-black",href:"#",onClick:e=>n(e.target.textContent)},t)))))):null),c=({items:t})=>e.createElement(e.Fragment,null,t&&t.length>0?e.createElement("div",{className:"text-xs px-4 py-2 rounded-b-lg rounded-br-none bg-blue-500 text-white"},e.createElement("h3",{className:"text-xs font-bold"},"Discover Related Sources:"),e.createElement("ol",{className:"flex flex-wrap list-inside pl-0"},t.map(((t,n)=>e.createElement("li",{key:n,className:"mr-2"},e.createElement("a",{className:"underline text-white text-sm hover:text-black",href:t.page_url},t.page_title)))))):null);s("pre code.hljs {\n display: block;\n overflow-x: auto;\n padding: 1em\n}\ncode.hljs {\n padding: 3px 5px\n}\n/*!\n Theme: GitHub\n Description: Light theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-light\n Current colors taken from GitHub's CSS\n*/\n.hljs {\n color: #24292e;\n background: #ffffff\n}\n.hljs-doctag,\n.hljs-keyword,\n.hljs-meta .hljs-keyword,\n.hljs-template-tag,\n.hljs-template-variable,\n.hljs-type,\n.hljs-variable.language_ {\n /* prettylights-syntax-keyword */\n color: #d73a49\n}\n.hljs-title,\n.hljs-title.class_,\n.hljs-title.class_.inherited__,\n.hljs-title.function_ {\n /* prettylights-syntax-entity */\n color: #6f42c1\n}\n.hljs-attr,\n.hljs-attribute,\n.hljs-literal,\n.hljs-meta,\n.hljs-number,\n.hljs-operator,\n.hljs-variable,\n.hljs-selector-attr,\n.hljs-selector-class,\n.hljs-selector-id {\n /* prettylights-syntax-constant */\n color: #005cc5\n}\n.hljs-regexp,\n.hljs-string,\n.hljs-meta .hljs-string {\n /* prettylights-syntax-string */\n color: #032f62\n}\n.hljs-built_in,\n.hljs-symbol {\n /* prettylights-syntax-variable */\n color: #e36209\n}\n.hljs-comment,\n.hljs-code,\n.hljs-formula {\n /* prettylights-syntax-comment */\n color: #6a737d\n}\n.hljs-name,\n.hljs-quote,\n.hljs-selector-tag,\n.hljs-selector-pseudo {\n /* prettylights-syntax-entity-tag */\n color: #22863a\n}\n.hljs-subst {\n /* prettylights-syntax-storage-modifier-import */\n color: #24292e\n}\n.hljs-section {\n /* prettylights-syntax-markup-heading */\n color: #005cc5;\n font-weight: bold\n}\n.hljs-bullet {\n /* prettylights-syntax-markup-list */\n color: #735c0f\n}\n.hljs-emphasis {\n /* prettylights-syntax-markup-italic */\n color: #24292e;\n font-style: italic\n}\n.hljs-strong {\n /* prettylights-syntax-markup-bold */\n color: #24292e;\n font-weight: bold\n}\n.hljs-addition {\n /* prettylights-syntax-markup-inserted */\n color: #22863a;\n background-color: #f0fff4\n}\n.hljs-deletion {\n /* prettylights-syntax-markup-deleted */\n color: #b31d28;\n background-color: #ffeef0\n}\n.hljs-char.escape_,\n.hljs-link,\n.hljs-params,\n.hljs-property,\n.hljs-punctuation,\n.hljs-tag {\n /* purposely ignored */\n \n}");const d=()=>e.createElement("svg",{stroke:"currentColor",className:"dark:fill-white w-8 h-8",width:"512",height:"512",strokeWidth:1.2,version:"1.1",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"m251.5 465.47c-2.2-0.79382-4.0658-1.4501-4.1462-1.4584-0.0804-8e-3 -11.213-14.603-24.738-32.433-13.526-17.83-25.783-33.355-27.239-34.5-2.5677-2.0197-3.6988-2.0819-37.881-2.0819-26.502 0-37.311-0.36376-43.615-1.4678-41.84-7.3275-73.739-38.446-83.067-81.032-1.0295-4.7003-1.3141-24.846-1.3141-93 0-87 0-87 2.3606-95.933 4.8879-18.497 12.559-32.605 24.787-45.587 9.2497-9.82 17.894-16.206 29.853-22.055 12.164-5.9487 22.475-8.7238 37-9.9582 14.341-1.2188 250.66-1.2188 265 0 14.525 1.2344 24.836 4.0095 37 9.9582 27.681 13.537 46.498 36.883 54.694 67.859 2.3061 8.7158 2.3061 8.7158 2.3061 95.716 0 91.914 0.0591 90.587-4.7047 105.5-6.7536 21.141-21.967 41.003-40.805 53.271-10.293 6.7034-17.59 10.036-29.49 13.469-8.8282 2.5465-9.7661 2.6072-49.147 3.1783-38.3 0.55544-40.249 0.67425-42.37 2.5822-1.2225 1.1-12.734 15.789-25.581 32.643-22.432 29.428-27.972 35.857-30.897 35.857-0.73782 0-1.9408 0.20627-2.6733 0.45837-0.73249 0.25211-3.1318-0.19112-5.3318-0.98494zm23.537-59.973c10.012-13.2 19.611-25.489 21.333-27.309s6.0438-4.7447 9.605-6.5c6.4748-3.1914 6.4748-3.1914 47.5-3.7939 45.163-0.66322 46.206-0.7918 60.055-7.4041 22.518-10.752 38.146-32.47 41.471-57.628 0.75544-5.7172 0.99241-33.69 0.74856-88.365-0.32659-73.226-0.50777-80.505-2.1398-85.964-7.6316-25.527-24.675-43.653-49.109-52.228-8-2.8078-8-2.8078-148.5-2.8078s-140.5 0-148.5 2.8078c-24.041 8.4376-41.205 26.366-48.686 50.854-2.2293 7.2975-2.2438 7.7874-2.5808 87.339-0.23126 54.58 0.01227 82.658 0.76639 88.365 3.3308 25.208 18.878 46.839 41.391 57.59 13.937 6.655 14.937 6.7788 60.109 7.4426 41 0.60245 41 0.60245 46.5 3.1926 3.025 1.4246 6.9095 3.7825 8.6322 5.2398 1.7227 1.4573 11.848 14.126 22.5 28.154 10.652 14.027 19.668 25.394 20.035 25.26 0.36691-0.13406 8.8583-11.044 18.87-24.244zm-113.54-158.39c-8.0155-2.0869-15.285-7.9248-19.132-15.365-0.91824-1.7757-1.8816-6.1929-2.1409-9.8161-0.7674-10.725 4.3824-20.221 13.724-25.305 18.472-10.054 40.351 2.8809 40.386 23.877 0.0238 14.063-10.461 25.41-24.837 26.879-2.75 0.28104-6.35 0.15949-8-0.2701zm87.306-0.4596c-4.9404-1.3809-6.2234-2.1606-11.678-7.0974-8.3404-7.5483-10.677-21.444-5.3274-31.684 4.7261-9.0467 14.275-14.868 24.388-14.868 19.531 0 32.73 20.777 24.459 38.5-2.5529 5.4705-9.0324 11.927-14.09 14.04-4.9964 2.0876-12.56 2.5602-17.752 1.1091zm88.987-3e-3c-6.3455-1.7731-12.159-5.9747-15.733-11.371-12.497-18.867 2.493-44.045 25.008-42.003 15.041 1.3638 25.769 13.807 24.706 28.656-0.25923 3.6232-1.2226 8.0404-2.1409 9.8161-6.175 11.941-19.731 18.285-31.84 14.902z"})),p=()=>e.createElement("svg",{version:"1.1",stroke:"currentColor",className:"dark:fill-white w-8 h-8 pt-2",width:"546.1333",height:"546.1333",viewBox:"0 0 546.1333 546.1333",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M 248.18949,545.01565 C 140.78277,536.1654 43.347437,457.67748 12.625464,354.27462 -19.122727,256.23986 11.148578,141.59748 88.05005,72.75365 170.6778,-6.3870784 305.25108,-22.727519 404.55416,34.075212 c 90.71756,48.808052 148.5915,152.240698 140.72412,255.265468 -4.721,117.18135 -94.83362,223.7082 -209.03208,249.29175 -28.74608,6.97865 -58.63168,7.99917 -88.05671,6.38322 z m 59.01049,-33.47524 c 44.11214,-6.14054 85.94851,-25.33589 120.34908,-53.46875 -7.50443,-76.23751 -78.33803,-139.58196 -155.13069,-137.4082 -75.87947,-1.11955 -147.39136,61.9662 -153.18566,137.95022 51.92152,43.01255 121.21529,62.41741 187.96727,52.92673 z M 95.23624,417.23455 c 17.04457,-53.94473 60.52333,-97.03721 112.76027,-117.54871 -38.16232,-27.24165 -58.08238,-77.27541 -46.17288,-123.04103 13.97512,-63.62214 88.10784,-103.424302 148.92029,-80.419223 54.27562,17.927063 88.7395,80.021723 73.57777,135.512803 -6.24704,27.51678 -24.27076,50.99914 -46.18838,68.09848 55.60255,21.00409 99.9566,68.92585 115.77754,126.329 11.90975,-0.3504 25.78141,-30.94799 34.70002,-45.64418 C 534.17056,292.25875 516.88138,176.40132 446.32219,106.18998 376.66755,30.895815 256.59496,9.9644804 165.64534,57.566388 73.710219,101.90396 17.392768,209.22775 35.202048,310.08314 c 6.457967,44.14691 25.903239,86.34538 55.464613,119.76818 1.924099,-4.05191 3.127315,-8.38542 4.569579,-12.61677 z m 188.6392,-130.78572 c 51.57064,-4.49807 86.2598,-64.54174 66.52297,-111.81618 -17.42381,-48.17969 -82.7984,-69.2237 -124.13766,-38.07569 -43.14422,27.09101 -48.02204,94.62224 -9.98242,128.12649 17.76999,16.83784 43.29836,25.47902 67.59711,21.76538 z"}));var m;!function(e){e.User="user",e.Bot="bot"}(m||(m={}));var g=m;const h=1e3,u=200,w=500,b=["#container","#chat-button","#bytebrain-ask-button","input","textarea","select",'[contenteditable]:not([contenteditable="false"])',"nav",".navbar",".theme-doc-sidebar-container",".theme-doc-toc-desktop",".theme-doc-toc-mobile"].join(", ");const f=(e,t)=>e.length<=t?e:e.slice(0,t);function y(e){const t=e.querySelector("article h1")||e.querySelector("h1"),n=((null==t?void 0:t.textContent)||"").trim()||e.title.trim();return f(n.replace(/\s+/g," "),u)}function x(e){return"https:"!==e.protocol&&"http:"!==e.protocol||"null"===e.origin?"":f(e.origin+e.pathname+e.hash,w)}function v(e,t,n){const r=e.replace(/\r\n?/g,"\n").replace(/[ \t ]+\n/g,"\n").replace(/\n{3,}/g,"\n\n").trim();if(r.length<3)return null;const{quote:o,shortened:a}=function(e,t=h){if(e.length<=t)return{quote:e,shortened:!1};const n=e.slice(0,t),r=Math.max(n.lastIndexOf(" "),n.lastIndexOf("\n"));return{quote:(r>=.8*t?n.slice(0,r):n).trimEnd()+"…",shortened:!0}}(r);return{quote:o,shortened:a,originalLength:r.length,pageTitle:y(t),pageUrl:x(n)}}function k(e,t){if(!e)return!0;const n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(!n)return!0;try{return null!==n.closest(t)}catch(e){return null!==n.closest(b)}}const E=()=>e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#c2410c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"shrink-0 mt-0.5"},e.createElement("path",{d:"M7 7h4v4H7c0 3 1 4 3 5M14 7h4v4h-4c0 3 1 4 3 5"})),j=({context:t,onRemove:n})=>e.createElement("div",{id:"bytebrain-quote-card",className:"flex items-start gap-2.5 mt-4 px-3 py-2.5 rounded-lg bg-white dark:bg-[#2b2e30] border border-solid border-gray-300 dark:border-gray-600 font-sans"},e.createElement(E,null),e.createElement("div",{className:"flex-1 min-w-0 flex flex-col gap-1"},e.createElement("p",{className:"m-0 text-sm leading-snug text-black dark:text-white whitespace-pre-wrap break-words max-h-20 overflow-hidden"},"“",t.quote,"”"),e.createElement("p",{className:"m-0 flex flex-wrap items-center gap-2 text-xs text-gray-600 dark:text-gray-300"},t.shortened&&e.createElement(e.Fragment,null,e.createElement("span",{className:"px-2 py-0.5 rounded-full bg-orange-100 text-orange-800 font-semibold"},"Shortened"),e.createElement("span",null,"First ",h.toLocaleString("en-US")," of ",t.originalLength.toLocaleString("en-US")," ","characters")),t.pageTitle&&e.createElement("span",null,"From ",t.pageTitle))),e.createElement("button",{type:"button","aria-label":"Remove quote",onClick:n,className:"shrink-0 w-8 h-8 inline-flex items-center justify-center border-0 rounded-md bg-transparent text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 cursor-pointer"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"},e.createElement("path",{d:"M6 6l12 12M18 6L6 18"})))),I=({context:t})=>e.createElement("div",{className:"flex gap-2 px-2.5 py-2 mb-2 rounded-md bg-gray-200 text-gray-700"},e.createElement(E,null),e.createElement("div",{className:"min-w-0"},e.createElement("p",{className:"m-0 text-sm whitespace-pre-wrap break-words max-h-20 overflow-hidden"},"“",t.quote,"”"),t.pageTitle&&e.createElement("p",{className:"m-0 text-xs text-gray-600"},"From ",t.pageTitle))),N=r=>{const[o,s]=t(r.chatHistory);n((()=>{r.highlight&&r.userType===g.Bot&&document.querySelectorAll("#"+r.id+" pre code").forEach((e=>{a.highlightElement(e)}))}),[r.highlight,r.userType,r.id]),n((()=>{s(r.chatHistory)}),[r]);let m=null;if(r.userType===g.User)m=e.createElement("div",{className:"w-full chat-message user-message text-base flex flex-row space-x-2",id:r.id},e.createElement(p,null),r.context?e.createElement("div",{className:"px-4 py-2 rounded-lg rounded-bl-none bg-gray-300 text-gray-600"},e.createElement(I,{context:r.context}),e.createElement(i,null,r.text)):e.createElement(i,{className:"px-4 py-2 rounded-lg rounded-bl-none bg-gray-300 text-gray-600"},r.text));else if(r.userType===g.Bot)if(String(r.text).includes("Related Questions:")){const t=r.text.split("Related Questions:"),n=(h=t[1].trim(),h.split(/\n/).filter((e=>e.length>0)).map((e=>e.trim())).filter((e=>/\d+|[*-]/.test(e)))).map((e=>function(e){return e.replace(/^\d+\.|[*-]\s*/,"")}(e)));m=e.createElement("div",{className:"w-full chat-message bot-message text-base flex flex-row space-x-2",id:r.id},e.createElement(d,null),e.createElement("div",{className:"w-full"},e.createElement(i,{className:"px-4 py-2 space-y-2 rounded-t-lg bg-blue-600 text-white"},t[0]),e.createElement(l,{items:n,setQuestion:r.setQuestion}),e.createElement(c,{items:r.references})))}else m=e.createElement("div",{className:"w-full chat-message bot-message text-base flex flex-row space-x-2",id:r.id},e.createElement(d,null),e.createElement("div",{className:"w-full"},e.createElement(i,{className:"px-4 py-2 space-y-2 rounded-t-lg bg-blue-600 text-white"},r.text),e.createElement(c,{items:r.references})));var h;return m};s('*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 640px) {\n .container {\n max-width: 640px;\n }\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.sticky {\n position: sticky;\n}\n.-bottom-1 {\n bottom: -0.25rem;\n}\n.-bottom-1\\.5 {\n bottom: -0.375rem;\n}\n.-top-1 {\n top: -0.25rem;\n}\n.-top-1\\.5 {\n top: -0.375rem;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.bottom-5 {\n bottom: 1.25rem;\n}\n.left-1\\/2 {\n left: 50%;\n}\n.left-5 {\n left: 1.25rem;\n}\n.right-0 {\n right: 0px;\n}\n.right-5 {\n right: 1.25rem;\n}\n.z-\\[2147483000\\] {\n z-index: 2147483000;\n}\n.m-0 {\n margin: 0px;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-6 {\n margin-bottom: 1.5rem;\n}\n.mr-2 {\n margin-right: 0.5rem;\n}\n.mt-0 {\n margin-top: 0px;\n}\n.mt-0\\.5 {\n margin-top: 0.125rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.inline-flex {\n display: inline-flex;\n}\n.table {\n display: table;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-10 {\n height: 2.5rem;\n}\n.h-11 {\n height: 2.75rem;\n}\n.h-3 {\n height: 0.75rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-screen {\n height: 100vh;\n}\n.max-h-20 {\n max-height: 5rem;\n}\n.max-h-screen {\n max-height: 100vh;\n}\n.w-3 {\n width: 0.75rem;\n}\n.w-8 {\n width: 2rem;\n}\n.w-full {\n width: 100%;\n}\n.min-w-0 {\n min-width: 0px;\n}\n.flex-1 {\n flex: 1 1 0%;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.-translate-x-1\\/2 {\n --tw-translate-x: -50%;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.resize {\n resize: both;\n}\n.list-inside {\n list-style-position: inside;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.items-start {\n align-items: flex-start;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-2\\.5 {\n gap: 0.625rem;\n}\n.space-x-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.5rem * var(--tw-space-x-reverse));\n margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-y-auto {\n overflow-y: auto;\n}\n.overflow-y-scroll {\n overflow-y: scroll;\n}\n.overscroll-contain {\n overscroll-behavior: contain;\n}\n.scroll-smooth {\n scroll-behavior: smooth;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.whitespace-pre-wrap {\n white-space: pre-wrap;\n}\n.break-words {\n overflow-wrap: break-word;\n}\n.rounded-\\[10px\\] {\n border-radius: 10px;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-b-lg {\n border-bottom-right-radius: 0.5rem;\n border-bottom-left-radius: 0.5rem;\n}\n.rounded-t-lg {\n border-top-left-radius: 0.5rem;\n border-top-right-radius: 0.5rem;\n}\n.rounded-bl-none {\n border-bottom-left-radius: 0px;\n}\n.rounded-br-none {\n border-bottom-right-radius: 0px;\n}\n.rounded-tl-md {\n border-top-left-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-0 {\n border-width: 0px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-gray-300 {\n --tw-border-opacity: 1;\n border-color: rgb(209 213 219 / var(--tw-border-opacity));\n}\n.bg-\\[\\#1f2328\\] {\n --tw-bg-opacity: 1;\n background-color: rgb(31 35 40 / var(--tw-bg-opacity));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity));\n}\n.bg-blue-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n}\n.bg-blue-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(37 99 235 / var(--tw-bg-opacity));\n}\n.bg-gray-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity));\n}\n.bg-gray-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(229 231 235 / var(--tw-bg-opacity));\n}\n.bg-gray-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(209 213 219 / var(--tw-bg-opacity));\n}\n.bg-inherit {\n background-color: inherit;\n}\n.bg-orange-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(255 237 213 / var(--tw-bg-opacity));\n}\n.bg-orange-400 {\n --tw-bg-opacity: 1;\n background-color: rgb(251 146 60 / var(--tw-bg-opacity));\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity));\n}\n.p-5 {\n padding: 1.25rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-2\\.5 {\n padding-left: 0.625rem;\n padding-right: 0.625rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-0 {\n padding-top: 0px;\n padding-bottom: 0px;\n}\n.py-0\\.5 {\n padding-top: 0.125rem;\n padding-bottom: 0.125rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-2\\.5 {\n padding-top: 0.625rem;\n padding-bottom: 0.625rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.font-sans {\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n}\n.text-3xl {\n font-size: 1.875rem;\n line-height: 2.25rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-normal {\n font-weight: 400;\n}\n.font-semibold {\n font-weight: 600;\n}\n.leading-snug {\n line-height: 1.375;\n}\n.text-\\[red\\] {\n --tw-text-opacity: 1;\n color: rgb(255 0 0 / var(--tw-text-opacity));\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity));\n}\n.text-gray-700 {\n --tw-text-opacity: 1;\n color: rgb(55 65 81 / var(--tw-text-opacity));\n}\n.text-orange-800 {\n --tw-text-opacity: 1;\n color: rgb(154 52 18 / var(--tw-text-opacity));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n.underline {\n text-decoration-line: underline;\n}\n.placeholder-gray-500::placeholder {\n --tw-placeholder-opacity: 1;\n color: rgb(107 114 128 / var(--tw-placeholder-opacity));\n}\n.shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.filter {\n filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n#scroller * {\n overflow-anchor: none;\n}\n\n#anchor {\n overflow-anchor: auto;\n height: 1px;\n}\n\np code {\n border-radius: 3px;\n}\n\n.chat-message p {\n margin: 0;\n}\n\n.user-message p code {\n background-color: aliceblue;\n}\n\n.bot-message p code {\n background-color: cornflowerblue;\n}\n\n.bot-message li > code {\n background-color: cornflowerblue;\n}\n\nol {\n list-style-type: decimal;\n margin: 1.0em;\n}\n\nli {\n padding: 0.2em;\n}\n\n#ChatPrompt ::-webkit-scrollbar {\n display: none;\n}\n\npre {\n color: black;\n white-space: pre-wrap;\n word-break: break-word;\n}\n\n.hover\\:scale-95:hover {\n --tw-scale-x: .95;\n --tw-scale-y: .95;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n\n.hover\\:bg-gray-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(229 231 235 / var(--tw-bg-opacity));\n}\n\n.hover\\:bg-gray-700:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(55 65 81 / var(--tw-bg-opacity));\n}\n\n.hover\\:bg-gray-900:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(17 24 39 / var(--tw-bg-opacity));\n}\n\n.hover\\:text-black:hover {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity));\n}\n\n.focus\\:outline-none:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n\n.disabled\\:cursor-not-allowed:disabled {\n cursor: not-allowed;\n}\n\n.disabled\\:opacity-75:disabled {\n opacity: 0.75;\n}\n\n:is([data-theme="dark"] .dark\\:border-gray-600) {\n --tw-border-opacity: 1;\n border-color: rgb(75 85 99 / var(--tw-border-opacity));\n}\n\n:is([data-theme="dark"] .dark\\:bg-\\[\\#242526\\]) {\n --tw-bg-opacity: 1;\n background-color: rgb(36 37 38 / var(--tw-bg-opacity));\n}\n\n:is([data-theme="dark"] .dark\\:bg-\\[\\#2b2e30\\]) {\n --tw-bg-opacity: 1;\n background-color: rgb(43 46 48 / var(--tw-bg-opacity));\n}\n\n:is([data-theme="dark"] .dark\\:fill-white) {\n fill: #fff;\n}\n\n:is([data-theme="dark"] .dark\\:text-gray-300) {\n --tw-text-opacity: 1;\n color: rgb(209 213 219 / var(--tw-text-opacity));\n}\n\n:is([data-theme="dark"] .dark\\:text-white) {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n\n:is([data-theme="dark"] .dark\\:hover\\:bg-gray-700:hover) {\n --tw-bg-opacity: 1;\n background-color: rgb(55 65 81 / var(--tw-bg-opacity));\n}\n\n@media (min-width: 640px) {\n .sm\\:w-\\[100\\%\\] {\n width: 100%;\n }\n}\n\n@media (min-width: 768px) {\n .md\\:w-\\[100\\%\\] {\n width: 100%;\n }\n}\n\n@media (min-width: 1024px) {\n .lg\\:w-\\[50\\%\\] {\n width: 50%;\n }\n}\n\n@media (min-width: 1280px) {\n .xl\\:w-\\[40\\%\\] {\n width: 40%;\n }\n}\n\n@media (min-width: 1536px) {\n .\\32xl\\:w-\\[30\\%\\] {\n width: 30%;\n }\n}\n');const S="bytebrain-session",C=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;let O;function L(){const e="undefined"!=typeof window?window.crypto:void 0;if(e&&"function"==typeof e.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,(e=>e.toString(16).padStart(2,"0")));return[n.slice(0,4),n.slice(4,6),n.slice(6,8),n.slice(8,10),n.slice(10)].map((e=>e.join(""))).join("-")}const T="Explain this",Z=t=>{const{title:n="ByteBrain ChatBot",defaultQuestion:r="Send your message",websocketHost:o,websocketPort:a,websocketEndpoint:i,apikey:s,welcomeMessages:l,fullScreen:c,askContext:d,onAskContextDone:p}=t,m=l.map((e=>({userType:g.Bot,message:e,completed:!0}))),[h,u]=e.useState(""),w=e.useRef(null);e.useEffect((()=>{if(!d)return void u((e=>e===T?"":e));u((e=>""===e.trim()?T:e));const e=w.current;e&&(e.focus(),window.setTimeout((()=>e.setSelectionRange(e.value.length,e.value.length)),0))}),[d]);const[b,f]=e.useState([function(e){const t=Math.floor(Math.random()*e.length);return e.splice(t,1)[0]}(m)]),y=o||window.location.hostname,x="80"===a?"":":"+a,v="80"===a?"wss://":"ws://";function k(){return 0!==b.length&&(b[b.length-1].userType==g.User||(b[b.length-1].userType==g.Bot?!b[b.length-1].completed:void 0))}const E=e=>f((t=>t.concat([{userType:g.Bot,message:e,completed:!0}]))),I=()=>{const e=new WebSocket(v+y+x+i+"/"+s+"?session="+function(){try{const e=window.sessionStorage.getItem(S);if(e&&C.test(e))return e;const t=L();return window.sessionStorage.setItem(S,t),t}catch(e){return O=O||L(),O}}());let t=!1;const n=d||void 0;e.onopen=t=>{f((e=>e.concat([{userType:g.User,message:h,completed:!0,context:n}])));const r=b.map((e=>e.message)).slice(1),o={question:h,history:r};n&&(o.context={quote:n.quote,pageTitle:n.pageTitle,pageUrl:n.pageUrl}),e.send(JSON.stringify(o))},e.onmessage=function(e){const n=JSON.parse(e.data);if(n.error)return t=!0,void E(String(n.error));const r=n.token,o=n.references,a=n.completed;a&&(t=!0),f((e=>{if(0===e.length||e[e.length-1].userType===g.User)return[...e,{userType:g.Bot,message:r,completed:a}];{const t=[...e];return t[t.length-1]=Object.assign(Object.assign({},t[t.length-1]),{message:t[t.length-1].message+r,references:o,completed:a}),t}}))},e.onclose=()=>{t||(t=!0,E("The connection was closed before an answer arrived. Please try again."))}};return e.createElement("div",{id:"ChatPrompt",className:"dark:bg-[#242526] justify-between flex flex-col p-5 rounded-md bg-gray-100 max-h-screen "+(c?"h-screen":"")},e.createElement("h1",{className:"text-[red] text-3xl font-bold mb-6"},n),e.createElement("div",{id:"scroller",className:"flex flex-col space-y-4 overflow-y-scroll scroll-smooth overscroll-contain"},b.map(((t,n)=>e.createElement(N,{key:n,id:"chat"+n,index:n,userType:t.userType,text:t.message,references:t.references,highlight:t.completed,chatHistory:b,context:t.context,setQuestion:u}))),e.createElement("div",{id:"anchor"})),d&&e.createElement(j,{context:d,onRemove:()=>p&&p()}),e.createElement("form",{onSubmit:e=>{e.preventDefault(),""===h.trim()||k()||(I(),u(""),d&&p&&p())},className:"flex bottom-5 left-5 right-5 h-10 mt-4"},e.createElement("input",{type:"text",id:"promptInput",ref:w,value:h,"aria-label":"Your question",onChange:e=>{u(e.target.value)},className:"w-full px-4 py-2 \n border-0\n rounded-md\n text-base\n text-black\n dark:text-white\n bg-gray-200\n dark:bg-[#2b2e30]\n focus:outline-none\n font-sans\n font-normal\n placeholder-gray-500\n ",placeholder:r}),e.createElement("button",{disabled:k(),id:"generateBtn",type:"submit",className:"px-6 rounded-md border-0 bg-black text-base text-white hover:bg-gray-900 focus:outline-none disabled:opacity-75 disabled:cursor-not-allowed font-sans font-normal"},"Send")))},M=["chat-button","bytebrain-ask-button"],z=({visible:t,onClose:o,websocketHost:a,websocketPort:i,websocketEndpoint:s,apikey:l,title:c,placeholder:d,welcomeMessages:p,askContext:m,onAskContextDone:g})=>{const h=r(null);((e,t)=>{const r=n=>{const r="function"==typeof n.composedPath?n.composedPath():[n.target];if(r.some((e=>M.includes(null==e?void 0:e.id))))return null;e.current&&!r.includes(e.current)&&t()};n((()=>(document.addEventListener("click",r),()=>{document.removeEventListener("click",r)})),[t,e])})(h,o);return e.createElement("div",{ref:h,id:"container",className:`fixed 2xl:w-[30%] xl:w-[40%] lg:w-[50%] md:w-[100%] sm:w-[100%] bottom-0 right-0 overflow-y-auto overscroll-contain ${t?"block":"hidden"} `},e.createElement(Z,{title:c||"ZIO Chat",defaultQuestion:d||"Write a question about ZIO!",websocketHost:a||"localhost",websocketPort:i||"8081",websocketEndpoint:s||"/chat",apikey:l,welcomeMessages:p&&p.length>0?p:["🌟 Greetings from ZIO Chat! 🌟 Have questions about ZIO? Look no further! I'm here to be your ZIO guru. Whether you're a seasoned pro or just starting out, I've got answers tailored just for you. Fire away with your ZIO queries, and I'll hit you back with the best insights I've got. Let's dive into the world of ZIO together!","🔥 Ignite your ZIO journey with ZIO Chat! 🔥 Ready to unravel the intricacies of ZIO? As your trusty sidekick, I'm here to light the way. No matter if you're wandering through functional forests or traversing effectful landscapes, I've got answers to keep you on track. Your ZIO adventure starts here – ask me anything and let's explore together!","Hello! 😊 I'm your ZIO Chat Bot, designed to be your go-to resource for all things ZIO! Whether you're new to this powerful functional effect system or a seasoned pro, I'm here to assist you. ZIO empowers you to build concurrent and resilient applications in Scala, offering referential transparency, composable data types, type-safety, and more. So, go ahead and ask me anything about ZIO – I'm here to provide the answers you need! 🤖","Hi there! 👋 I'm ZIO Chat, your friendly neighborhood ZIO expert. I'm here to help you navigate the world of ZIO. Whether you're a seasoned pro or just starting out, fire away with your ZIO questions. I will hit you back with the best insights I've got. Let's dive into the world of ZIO together!","🎉 Hey there, ZIO aficionado! 🎉 Step into the ZIO wonderland with me as your guide. Whether you're a functional fanatic or just dipping your toes into the ZIO ecosystem, I'm here to make your journey smooth. Got ZIO questions? I've got answers! Let's navigate the ZIO universe together and unlock its infinite possibilities!","Hi, fellow coder! 🌟 Welcome to your ZIO adventure with the ZIO Chat Bot. 🚀 Let's master functional Scala together. From referential transparency to concurrent prowess, I've got your back. Ready to dive in? Your questions, my insights – let's conquer ZIO! 💡🤖"],fullScreen:!1,askContext:m,onAskContextDone:g}))};s('/* Keyboard focus on the "Ask ... Chat" button (SelectionAsk.tsx). Sites can override it by this id. */\n#bytebrain-ask-button:focus {\n outline: none;\n}\n\n#bytebrain-ask-button:focus-visible {\n outline: 3px solid #c2410c;\n outline-offset: 3px;\n}\n');function A(e,t,n,r){if(!e)return{top:76,left:t/2,placement:"below"};const o=e.left+e.width/2,a=t<=200?t/2:Math.min(Math.max(o,100),t-100),i=e.top-12-44;if(!r&&i>=64)return{top:i,left:a,placement:"above"};const s=Math.max(64,n-44-12);return{top:Math.min(e.bottom+(r?28:12),s),left:a,placement:"below"}}const q=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),B=({label:a,onAsk:i,excludeSelector:s=b})=>{const[l,c]=t(null),d=r(l);d.current=l;const p=r(null),m=r(!1),g=r(!1),h=r(!1),u=r(void 0),w=o((()=>{const e=window.getSelection();if(!e||e.isCollapsed||0===e.rangeCount)return void c(null);if(k(e.anchorNode,s)||k(e.focusNode,s))return void c(null);const t=v(e.toString(),document,window.location);if(!t)return void c(null);const n=e.getRangeAt(0),r="function"==typeof n.getBoundingClientRect?n.getBoundingClientRect():null;c({context:t,position:A(r,window.innerWidth,window.innerHeight,"function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches)})}),[s]);if(n((()=>{const e=e=>{window.clearTimeout(u.current),u.current=window.setTimeout(w,e)},t=e=>{p.current&&p.current.contains(e.target)?g.current=!0:(h.current=!1,"touch"!==e.pointerType&&(m.current=!0))},n=()=>{g.current=!1,m.current&&(m.current=!1,e(250))},r=()=>{g.current?window.setTimeout((()=>g.current=!1),400):m.current&&(m.current=!1,e(0))},o=()=>{if(!g.current)return m.current?(window.clearTimeout(u.current),void(d.current&&c(null))):void e(250)},a=e=>{if("Escape"!==e.key)return"Tab"!==e.key||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||!d.current||!h.current||!p.current||document.activeElement===p.current?void((e.shiftKey&&q.has(e.key)||(e.ctrlKey||e.metaKey)&&"a"===e.key)&&(h.current=!0)):(e.preventDefault(),void p.current.focus());d.current&&c(null)},i=()=>{d.current&&e(0)};return document.addEventListener("pointerdown",t,!0),document.addEventListener("pointerup",r,!0),document.addEventListener("pointercancel",n,!0),document.addEventListener("selectionchange",o),document.addEventListener("keydown",a,!0),window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),()=>{window.clearTimeout(u.current),document.removeEventListener("pointerdown",t,!0),document.removeEventListener("pointerup",r,!0),document.removeEventListener("pointercancel",n,!0),document.removeEventListener("selectionchange",o),document.removeEventListener("keydown",a,!0),window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}}),[w]),!l)return null;const{top:f,left:y,placement:x}=l.position;return e.createElement("button",{ref:p,id:"bytebrain-ask-button",type:"button","data-placement":x,onMouseDown:e=>e.preventDefault(),onClick:()=>{g.current=!1;const e=d.current;if(!e)return;c(null);const t=window.getSelection();t&&t.removeAllRanges(),i(e.context)},style:{top:f,left:y},className:"fixed z-[2147483000] -translate-x-1/2 inline-flex items-center gap-2 h-11 px-4 border-0 rounded-[10px] bg-[#1f2328] hover:bg-gray-700 text-white font-sans font-semibold text-sm whitespace-nowrap shadow-lg cursor-pointer"},e.createElement("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#fb923c",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.createElement("path",{d:"M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"}),e.createElement("path",{d:"M9 10h6M9 13.5h3.5"})),a,e.createElement("span",{"aria-hidden":"true",className:"absolute left-1/2 -translate-x-1/2 rotate-45 w-3 h-3 bg-inherit "+("above"===x?"-bottom-1.5":"-top-1.5")}))},U=n=>{const[r,o]=t(!1),[a,i]=t(null);return e.createElement(e.Fragment,null,n.askOnSelect&&e.createElement(B,{label:"Ask "+(n.title||"ZIO Chat"),onAsk:e=>{i(e),o(!0)},excludeSelector:n.askExcludeSelector||void 0}),e.createElement("button",{id:"chat-button",className:"fixed border-0 font-sans text-xl bg-orange-400 rounded-tl-md text-black px-3 py-2 hover:scale-95 transition text-ms bottom-0 right-0",onClick:()=>o(!0)},n.buttonLabel||"ZIO Chat!"),e.createElement(z,{onClose:()=>{o(!1),i(null)},visible:r,websocketHost:n.websocketHost,websocketPort:n.websocketPort,websocketEndpoint:n.websocketEndpoint,apikey:n.apikey,title:n.title,placeholder:n.placeholder,welcomeMessages:n.welcomeMessages,askContext:a,onAskContextDone:()=>i(null)}))};export{U as ChatApp,N as ChatMessage,Z as ChatPrompt,z as PopupChatWindow,c as References,l as RelatedQuestions};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/src/stories/RelatedQuestions.tsx","../src/src/stories/References.tsx","../src/src/stories/Bot.tsx","../src/src/stories/User.tsx","../src/src/stories/UserTypes.tsx","../src/src/stories/ChatMessage.tsx","../src/src/stories/session.ts","../src/src/stories/ChatPrompt.tsx","../src/src/stories/PopupChatWindow.tsx","../src/src/stories/ChatApp.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null,null,null,null,null,null],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","RelatedQuestions","items","setQuestion","React","Fragment","length","className","map","item","index","key","href","onClick","event","target","textContent","References","page_url","page_title","Bot","stroke","width","height","strokeWidth","version","viewBox","xmlns","d","User","UserTypes","UserTypes$1","ChatMessage","props","chatHistory","setChatHistory","useState","useEffect","highlight","userType","querySelectorAll","id","forEach","el","hljs","highlightElement","chatMessage","ReactMarkdown","text","String","includes","response","split","related_questions","string","trim","filter","line","l","test","replace","remove_number_fromHead","references","STORAGE_KEY","UUID","memoryId","newId","c","window","crypto","undefined","randomUUID","bytes","Uint8Array","getRandomValues","i","Math","floor","random","hex","Array","from","b","toString","padStart","slice","part","join","ChatPrompt","title","defaultQuestion","websocketHost","websocketPort","websocketEndpoint","apikey","welcomeMessages","fullScreen","greetings","m","message","completed","question","messages","setMessages","arr","randomIndex","splice","getRandom","host","location","hostname","port","protocol","showBotMessage","concat","handleClick","ws","WebSocket","stored","sessionStorage","getItem","setItem","e","getSessionId","finished","onopen","history","data","send","JSON","stringify","onmessage","result","parse","error","word","token","updatedMessages","Object","assign","onclose","onSubmit","preventDefault","reset","onChange","value","placeholder","disabled","PopupChatWindow","visible","onClose","useRef","callback","_a","current","contains","addEventListener","removeEventListener","useClickOutside","ChatApp","isOpen","setIsOpen"],"mappings":"yHAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D,0ECCa,MAAAe,EAAoD,EAAGC,QAAOC,iBAEvEC,EACGX,cAAAW,EAAAC,SAAA,KAAAH,GAASA,EAAMI,OAAS,EACvBF,EAAKX,cAAA,MAAA,CAAAc,UAAU,4DACbH,EAAIX,cAAA,KAAA,CAAAc,UAAU,qBAA+C,0BAC7DH,EAAIX,cAAA,KAAA,CAAAc,UAAU,2BACXL,EAAMM,KAAI,CAACC,EAAMC,IAChBN,EAAIX,cAAA,KAAA,CAAAkB,IAAKD,EAAOH,UAAU,QACxBH,EAAAX,cAAA,IAAA,CACEc,UAAU,gDACVK,KAAK,IACLC,QAAUC,GAAUX,EAAaW,EAAMC,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AAQ7D,EAAM6D,SAGlB"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/src/stories/RelatedQuestions.tsx","../src/src/stories/References.tsx","../src/src/stories/Bot.tsx","../src/src/stories/User.tsx","../src/src/stories/UserTypes.tsx","../src/src/stories/selectionContext.ts","../src/src/stories/QuoteCard.tsx","../src/src/stories/ChatMessage.tsx","../src/src/stories/session.ts","../src/src/stories/ChatPrompt.tsx","../src/src/stories/PopupChatWindow.tsx","../src/src/stories/SelectionAsk.tsx","../src/src/stories/ChatApp.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","RelatedQuestions","items","setQuestion","React","Fragment","length","className","map","item","index","key","href","onClick","event","target","textContent","References","page_url","page_title","Bot","stroke","width","height","strokeWidth","version","viewBox","xmlns","d","User","UserTypes","UserTypes$1","MAX_QUOTE_CHARS","MAX_TITLE_CHARS","MAX_URL_CHARS","DEFAULT_EXCLUDE_SELECTOR","join","clip","text","max","slice","pageTitleOf","doc","heading","querySelector","trim","title","replace","pageUrlOf","loc","protocol","origin","pathname","hash","buildAskContext","selected","cleaned","quote","shortened","lastBreak","Math","lastIndexOf","trimEnd","cutQuote","originalLength","pageTitle","pageUrl","isExcluded","node","selector","element","nodeType","Node","ELEMENT_NODE","parentElement","closest","e","QuoteIcon","fill","strokeLinecap","strokeLinejoin","QuoteCard","context","onRemove","id","toLocaleString","SentQuote","ChatMessage","props","chatHistory","setChatHistory","useState","useEffect","highlight","userType","querySelectorAll","forEach","el","hljs","highlightElement","chatMessage","ReactMarkdown","String","includes","response","split","related_questions","string","filter","line","l","test","remove_number_fromHead","references","STORAGE_KEY","UUID","memoryId","newId","c","window","crypto","undefined","randomUUID","bytes","Uint8Array","getRandomValues","i","floor","random","hex","Array","from","b","toString","padStart","part","DEFAULT_ASK_QUESTION","ChatPrompt","defaultQuestion","websocketHost","websocketPort","websocketEndpoint","apikey","welcomeMessages","fullScreen","askContext","onAskContextDone","greetings","m","message","completed","question","inputRef","useRef","current","input","focus","setTimeout","setSelectionRange","value","messages","setMessages","arr","randomIndex","splice","getRandom","host","location","hostname","port","isButtonDisabled","showBotMessage","concat","handleClick","ws","WebSocket","stored","sessionStorage","getItem","setItem","getSessionId","finished","onopen","history","data","send","JSON","stringify","onmessage","result","parse","error","word","token","updatedMessages","Object","assign","onclose","onSubmit","preventDefault","onChange","placeholder","disabled","OPENERS","PopupChatWindow","visible","onClose","callback","path","composedPath","some","addEventListener","removeEventListener","useClickOutside","placeButton","rect","viewportWidth","viewportHeight","touch","top","TOP_INSET","left","placement","center","min","aboveTop","lowest","bottom","SELECTING_KEYS","Set","SelectionAsk","label","onAsk","excludeSelector","shown","setShown","shownRef","buttonRef","pointerDown","pressingButton","viaKeyboard","timer","update","useCallback","selection","getSelection","isCollapsed","rangeCount","anchorNode","focusNode","range","getRangeAt","getBoundingClientRect","position","innerWidth","innerHeight","matchMedia","matches","schedule","delay","clearTimeout","onPointerDown","contains","pointerType","onPointerCancel","onPointerUp","onSelectionChange","onKeyDown","shiftKey","altKey","ctrlKey","metaKey","activeElement","has","onReposition","onMouseDown","removeAllRanges","ChatApp","isOpen","setIsOpen","setAskContext","askOnSelect","askExcludeSelector","buttonLabel"],"mappings":"0IAAA,SAASA,EAAYC,EAAK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ChC0L,MAVUtJ,IAChBsM,EAActM,GACdqM,GAAU,EAAK,EAST9C,gBAAiBjJ,EAAMkM,yBAAsBjK,IAGjDrH,EAAAX,cAAA,SAAA,CACE2F,GAAG,cACH7E,UAAU,uIACVM,QAnBO,IAAM0Q,GAAU,IAqBtB/L,EAAMmM,aAAe,aAExBvR,EAAAX,cAACmN,EAAe,CACdE,QA5BQ,KACZyE,GAAU,GACVC,EAAc,KAAK,EA2Bf3E,QAASyE,EACT3I,cAAenD,EAAMmD,cACrBC,cAAepD,EAAMoD,cACrBC,kBAAmBrD,EAAMqD,kBACzBC,OAAQtD,EAAMsD,OACdhG,MAAO0C,EAAM1C,MACb2J,YAAajH,EAAMiH,YACnB1D,gBAAiBvD,EAAMuD,gBACvBE,WAAYA,EACZC,iBAAkB,IAAMsI,EAAc,QAG1C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-2024 ByteBrain AI
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export interface AskContext {
|
|
17
|
+
quote: string;
|
|
18
|
+
pageTitle: string;
|
|
19
|
+
pageUrl: string;
|
|
20
|
+
shortened: boolean;
|
|
21
|
+
originalLength: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const MAX_QUOTE_CHARS = 1000;
|
|
24
|
+
export declare const MIN_SELECTION_CHARS = 3;
|
|
25
|
+
export declare const DEFAULT_EXCLUDE_SELECTOR: string;
|
|
26
|
+
export declare function cleanSelection(text: string): string;
|
|
27
|
+
export declare function cutQuote(text: string, max?: number): {
|
|
28
|
+
quote: string;
|
|
29
|
+
shortened: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare function pageTitleOf(doc: Document): string;
|
|
32
|
+
export declare function pageUrlOf(loc: Location): string;
|
|
33
|
+
export declare function buildAskContext(selected: string, doc: Document, loc: Location): AskContext | null;
|
|
34
|
+
export declare function isExcluded(node: Node | null, selector: string): boolean;
|