@rustic-ai/ui-components 0.0.19 → 0.0.20
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/components/calendar/fCCalendar.d.ts +8 -2
- package/dist/components/calendar/fCCalendar.d.ts.map +1 -1
- package/dist/components/calendar/index.css +21 -0
- package/dist/components/calendar/index.d.ts +5 -0
- package/dist/components/calendar/index.d.ts.map +1 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/codeSnippet/index.css +14 -0
- package/dist/components/codeSnippet/index.d.ts +5 -0
- package/dist/components/codeSnippet/index.d.ts.map +1 -0
- package/dist/components/codeSnippet/index.js +1 -0
- package/dist/components/elementRenderer/index.d.ts +3 -0
- package/dist/components/elementRenderer/index.d.ts.map +1 -0
- package/dist/components/elementRenderer/index.js +1 -0
- package/dist/components/image/index.css +43 -0
- package/dist/components/image/index.d.ts +5 -0
- package/dist/components/image/index.d.ts.map +1 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/baseInput/baseInput.d.ts.map +1 -1
- package/dist/components/input/emoji/index.css +16 -0
- package/dist/components/input/emoji/index.d.ts +4 -0
- package/dist/components/input/emoji/index.d.ts.map +1 -0
- package/dist/components/input/emoji/index.js +1 -0
- package/dist/components/input/multimodal/multimodalInput/index.css +227 -0
- package/dist/components/input/multimodal/multimodalInput/index.d.ts +5 -0
- package/dist/components/input/multimodal/multimodalInput/index.d.ts.map +1 -0
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -0
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts +8 -1
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/uploader/index.css +145 -0
- package/dist/components/input/multimodal/uploader/index.d.ts +5 -0
- package/dist/components/input/multimodal/uploader/index.d.ts.map +1 -0
- package/dist/components/input/multimodal/uploader/index.js +1 -0
- package/dist/components/input/textInput/index.css +57 -0
- package/dist/components/input/textInput/index.d.ts +4 -0
- package/dist/components/input/textInput/index.d.ts.map +1 -0
- package/dist/components/input/textInput/index.js +1 -0
- package/dist/components/input/textInput/textInput.d.ts +0 -3
- package/dist/components/input/textInput/textInput.d.ts.map +1 -1
- package/dist/components/map/index.css +13 -0
- package/dist/components/map/index.d.ts +5 -0
- package/dist/components/map/index.d.ts.map +1 -0
- package/dist/components/map/index.js +1 -0
- package/dist/components/map/openLayersMap.d.ts +6 -1
- package/dist/components/map/openLayersMap.d.ts.map +1 -1
- package/dist/components/markdown/index.d.ts +6 -0
- package/dist/components/markdown/index.d.ts.map +1 -0
- package/dist/components/markdown/index.js +1 -0
- package/dist/components/markdown/markedMarkdown.d.ts +7 -1
- package/dist/components/markdown/markedMarkdown.d.ts.map +1 -1
- package/dist/components/media/audio/index.css +182 -0
- package/dist/components/media/audio/index.d.ts +5 -0
- package/dist/components/media/audio/index.d.ts.map +1 -0
- package/dist/components/media/audio/index.js +1 -0
- package/dist/components/media/video/index.css +225 -0
- package/dist/components/media/video/index.d.ts +5 -0
- package/dist/components/media/video/index.d.ts.map +1 -0
- package/dist/components/media/video/index.js +1 -0
- package/dist/components/menu/index.css +26 -0
- package/dist/components/menu/index.d.ts +4 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/messageCanvas/actions/action.d.ts +12 -0
- package/dist/components/messageCanvas/actions/action.d.ts.map +1 -0
- package/dist/components/messageCanvas/actions/copy/index.css +8 -0
- package/dist/components/messageCanvas/actions/copy/index.d.ts +3 -0
- package/dist/components/messageCanvas/actions/copy/index.d.ts.map +1 -0
- package/dist/components/messageCanvas/actions/copy/index.js +1 -0
- package/dist/components/messageCanvas/actions/index.css +4 -0
- package/dist/components/messageCanvas/actions/index.d.ts +4 -11
- package/dist/components/messageCanvas/actions/index.d.ts.map +1 -1
- package/dist/components/messageCanvas/actions/index.js +1 -0
- package/dist/components/messageCanvas/actions/textToSpeech/index.css +8 -0
- package/dist/components/messageCanvas/actions/textToSpeech/index.d.ts +3 -0
- package/dist/components/messageCanvas/actions/textToSpeech/index.d.ts.map +1 -0
- package/dist/components/messageCanvas/actions/textToSpeech/index.js +1 -0
- package/dist/components/messageCanvas/actions/textToSpeech/textToSpeech.d.ts.map +1 -1
- package/dist/components/messageCanvas/index.css +39 -0
- package/dist/components/messageCanvas/index.d.ts +4 -0
- package/dist/components/messageCanvas/index.d.ts.map +1 -0
- package/dist/components/messageCanvas/index.js +1 -0
- package/dist/components/messageSpace/index.css +63 -0
- package/dist/components/messageSpace/index.d.ts +4 -0
- package/dist/components/messageSpace/index.d.ts.map +1 -0
- package/dist/components/messageSpace/index.js +1 -0
- package/dist/components/messageSpace/messageSpace.d.ts.map +1 -1
- package/dist/components/multipart/index.css +134 -0
- package/dist/components/multipart/index.d.ts +5 -0
- package/dist/components/multipart/index.d.ts.map +1 -0
- package/dist/components/multipart/index.js +1 -0
- package/dist/components/participantsContainer/index.css +42 -0
- package/dist/components/participantsContainer/index.d.ts +4 -0
- package/dist/components/participantsContainer/index.d.ts.map +1 -0
- package/dist/components/participantsContainer/index.js +1 -0
- package/dist/components/pdfViewer/index.css +60 -0
- package/dist/components/pdfViewer/index.d.ts +5 -0
- package/dist/components/pdfViewer/index.d.ts.map +1 -0
- package/dist/components/pdfViewer/index.js +1 -0
- package/dist/components/pdfViewer/pdfViewer.d.ts +4 -0
- package/dist/components/pdfViewer/pdfViewer.d.ts.map +1 -1
- package/dist/components/promptBuilder/index.css +96 -0
- package/dist/components/promptBuilder/index.d.ts +5 -0
- package/dist/components/promptBuilder/index.d.ts.map +1 -0
- package/dist/components/promptBuilder/index.js +1 -0
- package/dist/components/promptBuilder/mockWebSocket.d.ts +5 -0
- package/dist/components/promptBuilder/mockWebSocket.d.ts.map +1 -0
- package/dist/components/promptBuilder/promptBuilder.d.ts +24 -0
- package/dist/components/promptBuilder/promptBuilder.d.ts.map +1 -0
- package/dist/components/question/index.css +14 -0
- package/dist/components/question/index.d.ts +5 -0
- package/dist/components/question/index.d.ts.map +1 -0
- package/dist/components/question/index.js +1 -0
- package/dist/components/question/question.d.ts +7 -1
- package/dist/components/question/question.d.ts.map +1 -1
- package/dist/components/table/index.css +43 -0
- package/dist/components/table/index.d.ts +5 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/text/index.css +5 -0
- package/dist/components/text/index.d.ts +7 -0
- package/dist/components/text/index.d.ts.map +1 -0
- package/dist/components/text/index.js +1 -0
- package/dist/components/text/text.d.ts +7 -1
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/timestamp/index.d.ts +3 -0
- package/dist/components/timestamp/index.d.ts.map +1 -0
- package/dist/components/types.d.ts +17 -31
- package/dist/components/types.d.ts.map +1 -1
- package/dist/components/video/index.css +34 -0
- package/dist/components/video/index.d.ts +3 -0
- package/dist/components/video/index.d.ts.map +1 -0
- package/dist/components/video/index.js +1 -0
- package/dist/components/video/youtubeVideo.d.ts +8 -1
- package/dist/components/video/youtubeVideo.d.ts.map +1 -1
- package/dist/components/visualization/chart/index.css +44 -0
- package/dist/components/visualization/chart/index.d.ts +4 -0
- package/dist/components/visualization/chart/index.d.ts.map +1 -0
- package/dist/components/visualization/chart/index.js +1 -0
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts +8 -1
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts.map +1 -1
- package/dist/components/visualization/mermaidViz/index.css +21 -0
- package/dist/components/visualization/mermaidViz/index.d.ts +5 -0
- package/dist/components/visualization/mermaidViz/index.d.ts.map +1 -0
- package/dist/components/visualization/mermaidViz/index.js +1 -0
- package/dist/components/visualization/mermaidViz/mermaidViz.d.ts +9 -2
- package/dist/components/visualization/mermaidViz/mermaidViz.d.ts.map +1 -1
- package/dist/components/visualization/mermaidViz/mermaidViz.types.d.ts +10 -0
- package/dist/components/visualization/mermaidViz/mermaidViz.types.d.ts.map +1 -0
- package/dist/components/visualization/perspectiveViz/index.css +16 -0
- package/dist/components/visualization/perspectiveViz/index.d.ts +5 -0
- package/dist/components/visualization/perspectiveViz/index.d.ts.map +1 -0
- package/dist/components/visualization/perspectiveViz/index.js +1 -0
- package/dist/components/visualization/perspectiveViz/perspectiveViz.d.ts +7 -4
- package/dist/components/visualization/perspectiveViz/perspectiveViz.d.ts.map +1 -1
- package/dist/components/visualization/vegaLiteViz/index.css +45 -0
- package/dist/components/visualization/vegaLiteViz/index.d.ts +5 -0
- package/dist/components/visualization/vegaLiteViz/index.d.ts.map +1 -0
- package/dist/components/visualization/vegaLiteViz/index.js +1 -0
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts +9 -2
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts.map +1 -1
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.types.d.ts +20 -0
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.types.d.ts.map +1 -0
- package/dist/components/weather/index.css +77 -0
- package/dist/components/weather/index.d.ts +5 -0
- package/dist/components/weather/index.d.ts.map +1 -0
- package/dist/components/weather/index.js +1 -0
- package/dist/index.css +62 -0
- package/dist/index.js +1 -2
- package/dist/rusticTheme.d.ts +29 -0
- package/dist/rusticTheme.d.ts.map +1 -1
- package/dist/rusticTheme.js +1 -0
- package/package.json +123 -22
- package/dist/index.js.LICENSE.txt +0 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
.rustic-file-preview .rustic-upload-progress {
|
|
2
|
+
width: 40px;
|
|
3
|
+
height: 8px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.rustic-file-preview .rustic-flex-center {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.rustic-uploader input {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rustic-error-message {
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.rustic-padding-16 {
|
|
20
|
+
padding: 16px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.rustic-file-preview {
|
|
24
|
+
position: relative;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
padding: 8px 8px 8px 16px;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
width: 220px;
|
|
30
|
+
height: 56px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.rustic-file-preview-modal {
|
|
34
|
+
width: 90vw;
|
|
35
|
+
height: 90vh;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-self: center;
|
|
38
|
+
justify-self: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.rustic-file-preview-modal .rustic-modal-content {
|
|
42
|
+
position: relative;
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.rustic-modal-content .rustic-close-button {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 16px;
|
|
49
|
+
right: 16px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
body {
|
|
53
|
+
margin: 0;
|
|
54
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
55
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
56
|
+
sans-serif;
|
|
57
|
+
-webkit-font-smoothing: antialiased;
|
|
58
|
+
-moz-osx-font-smoothing: grayscale;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
code {
|
|
62
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
63
|
+
monospace;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.rustic-fit-container {
|
|
67
|
+
object-fit: contain;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rustic-files {
|
|
73
|
+
display: flex;
|
|
74
|
+
gap: 8px;
|
|
75
|
+
flex-wrap: wrap;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.rustic-cursor-pointer {
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.rustic-align-self-center {
|
|
83
|
+
align-self: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
span.rustic-icon-large {
|
|
87
|
+
font-size: 32px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.rustic-pdf-viewer {
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 100%;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
padding: 16px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.rustic-pdf-error {
|
|
99
|
+
padding: 16px;
|
|
100
|
+
width: fit-content;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.rustic-pdf-viewer .rustic-pdf-viewer-header {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
margin-bottom: 8px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.rustic-pdf-viewer .rustic-pdf-canvas {
|
|
110
|
+
flex: 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.rustic-pdf-viewer .rustic-pdf-page-input > div {
|
|
114
|
+
height: 24px;
|
|
115
|
+
width: 56px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.rustic-pdf-viewer .rustic-pdf-page-input input {
|
|
119
|
+
text-align: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.rustic-pdf-viewer
|
|
123
|
+
.rustic-pdf-page-input
|
|
124
|
+
input[type='number']::-webkit-inner-spin-button {
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.rustic-pdf-viewer .rustic-page-indicator {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: 8px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.rustic-pdf-viewer-body {
|
|
135
|
+
flex: 1;
|
|
136
|
+
display: flex;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
overflow: auto;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.rustic-pdf-viewer-body-inner {
|
|
142
|
+
overflow: auto;
|
|
143
|
+
width: fit-content;
|
|
144
|
+
}
|
|
145
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/uploader/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAEvB,OAAO,QAAQ,MAAM,YAAY,CAAA;AAEjC,cAAc,gBAAgB,CAAA;AAC9B,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var n=r&&r.__esModule?()=>r.default:()=>r;return e.d(n,{a:n}),n},d:(r,n)=>{for(var t in n)e.o(n,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:n[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{ParticipantRole:()=>R,ParticipantType:()=>B,default:()=>H});const n=require("react/jsx-runtime"),t=require("@mui/material/Box");var a=e.n(t);const i=require("@mui/material/IconButton");var o=e.n(i);const s=require("@mui/material/LinearProgress");var c=e.n(s);const l=require("@mui/material/Tooltip");var u=e.n(l);const d=require("@mui/material/Typography");var m=e.n(d);const f=require("axios");var p=e.n(f);const v=require("react"),h=require("react-dom"),g=require("uuid"),x=require("@mui/material/Card");var b=e.n(x);const j=require("@mui/material/Modal");var y=e.n(j);const w=require("@mui/material/styles");var N;function C(e){return e.name.replaceAll("_","-"),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}require("pluralize"),function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(N||(N={}));const P=require("@mui/material/TextField");var F=e.n(P);const S=require("@mui/material/useMediaQuery");var k=e.n(S);const q=require("@mui/system/Stack");var O=e.n(q);const T=require("@mui/system/useTheme");var z=e.n(T);const _=require("pdfjs-dist"),I=function(e){var r={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},t=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,n.jsx)(u(),{title:t.label,children:(0,n.jsx)("span",{children:(0,n.jsx)(o(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,n.jsx)(C,{name:t.symbol})})})})};var M={pdf:function(e){var r,t=(0,v.useRef)(null),i=(0,v.useState)(1),o=i[0],s=i[1],c=(0,v.useState)(1),l=c[0],u=c[1],d=(0,v.useState)(1),f=d[0],p=d[1],h=(0,v.useState)(!1),g=h[0],x=h[1],j=(0,v.useState)(),y=j[0],w=j[1],N=z()(),C=k()(N.breakpoints.down("sm")),P=k()(N.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,n.jsx)(b(),{variant:"outlined",className:"rustic-pdf-error",children:(0,n.jsx)(m(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var S=(0,v.useState)((function(){return C?.5:P?1:1.5})),q=S[0],T=S[1];return(0,v.useEffect)((function(){_.GlobalWorkerOptions.workerSrc||(_.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(_.version,"/pdf.worker.mjs")),_.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(o).then((function(e){var r=e.getViewport({scale:q}),n=t.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(r.width,"px"),n.style.height="".concat(r.height,"px"),n.width=r.width*i,n.height=r.height*i;var o={canvasContext:a,viewport:r,transform:[i,0,0,i,0,0]};y&&y.cancel();var s=e.render(o);w(s),s.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){x(!0)}))}),[e.url,o,q]),g?(0,n.jsx)(b(),{variant:"outlined",className:"rustic-pdf-error",children:(0,n.jsx)(m(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,n.jsxs)(b(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,n.jsxs)(a(),{className:"rustic-pdf-viewer-header",children:[(0,n.jsx)(I,{action:"zoomOut",onClick:function(){T((function(e){return Math.max(e-.2,.2)}))}}),(0,n.jsx)(I,{action:"zoomIn",onClick:function(){T((function(e){return e+.2}))}})]}),(0,n.jsx)(a(),{className:"rustic-pdf-viewer-body",children:(0,n.jsx)(a(),{className:"rustic-pdf-viewer-body-inner",children:(0,n.jsx)("canvas",{ref:t})})}),(0,n.jsxs)(O(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,n.jsx)(I,{action:"previousPage",onClick:function(){o>1&&(s(o-1),p(o-1))},isDisabled:1===o}),(0,n.jsx)(m(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,n.jsx)(F(),{type:"number",value:f,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=l&&s(r)},size:"small",className:"rustic-pdf-page-input"}),(0,n.jsxs)(m(),{variant:"body1",className:"rustic-page-indicator",children:["of ",l]}),(0,n.jsx)(I,{action:"nextPage",onClick:function(){o<l&&(s(o+1),p(o+1))},isDisabled:o===l})]})]})}};function D(e){var r=(0,w.useTheme)(),t=(0,v.useState)(!1),a=t[0],i=t[1];function s(){i(!1)}var c,l,d=e.file.url&&(c=e.file.url.split("."))[c.length-1].toLowerCase(),f=d&&e.supportedViewers?e.supportedViewers[d]:null,p=!!f;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(b(),{className:"rustic-file-preview".concat(p?" rustic-cursor-pointer":""),variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,n.jsx)(m(),{variant:"subtitle2",children:(l=e.file.name,15,l.length<=15?l:l.substring(0,12)+"...")}),(0,n.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,n.jsx)(y(),{open:a,onClose:s,className:"rustic-file-preview-modal",children:(0,n.jsxs)("div",{className:"rustic-modal-content",children:[(0,n.jsx)(u(),{title:"Close",children:(0,n.jsx)(o(),{onClick:s,className:"rustic-close-button",children:(0,n.jsx)(C,{name:"close"})})}),e.file.url&&(0,n.jsx)(f,{url:e.file.url})]})})]})}D.defaultProps={supportedViewers:M};var U=function(){return U=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},U.apply(this,arguments)},A=function(e,r,n){if(n||2===arguments.length)for(var t,a=0,i=r.length;a<i;a++)!t&&a in r||(t||(t=Array.prototype.slice.call(r,0,a)),t[a]=r[a]);return e.concat(t||Array.prototype.slice.call(r))};function E(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}var R,B;!function(e){e.Owner="owner",e.Member="member"}(R||(R={})),function(e){e.Human="human",e.Agent="agent"}(B||(B={}));const H=function(e){var r=(0,v.useState)([]),t=r[0],i=r[1],s=(0,v.useState)([]),l=s[0],d=s[1],f=(0,v.useRef)({}),x=(0,g.v4)();(0,v.useEffect)((function(){i([]),d([]),f.current={}}),[e.messageId]);var b=(0,n.jsx)(a(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,t){return(0,n.jsx)(D,{file:{name:r.name},children:(0,n.jsxs)(a(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,n.jsx)(c(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,n.jsx)(u(),{title:"Delete",children:(0,n.jsx)(o(),{color:"primary",onClick:function(){return function(r,n){var t,a;d([]);var o=r.name;if(f.current=U(U({},f.current),((t={})[o]=f.current[o]--,t)),e.onFileUpdate("remove",o),100===r.loadingProgress){var s="".concat(e.deleteFileEndpoint,"?message-id=").concat(e.messageId,"&file-id=").concat(r.id);p().delete(s).then((function(){return i((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",o),d((function(e){return A(A([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}else r.abortController.abort(),i((function(e){return e.filter((function(e,r){return r!==n}))})),f.current=U(U({},f.current),((a={})[o]=f.current[o]++,a))}(r,t)},className:"rustic-delete-button","aria-label":"cancel file upload",children:(0,n.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},t)}))}),j=(0,n.jsx)(a(),{children:l.map((function(e,r){return(0,n.jsx)(m(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function y(e,r){return r?(0,h.createPortal)(e,r):e}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a(),{className:"rustic-uploader",children:[(0,n.jsx)("label",{htmlFor:x,children:(0,n.jsx)(u(),{title:"Upload",children:(0,n.jsx)(o(),{component:"span","aria-label":"Upload file",color:"primary",children:(0,n.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,n.jsx)("input",{type:"file",id:x,onChange:function(r){d([]);var n=r.target.files&&Array.from(r.target.files),a=t.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&d((function(r){return A(A([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=n&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(n,a,e.maxFileCount);o&&o.forEach((function(r){!function(r){var n;e.maxFileSize&&r.size>e.maxFileSize?(n=r.name,d((function(r){return A(A([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&E(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,t=new AbortController,a=function(e){var r,n,t=e.name,a=f.current[t];if(a){var i=a+1,o=t.lastIndexOf("."),s=t.substring(0,o),c=t.substring(o);t="".concat(s,"(").concat(a,")").concat(c),f.current=U(U({},f.current),((r={})[e.name]=i,r))}else f.current=U(U({},f.current),((n={})[e.name]=1,n));return t}(r),o=new File([r],a,{type:r.type});n.append("file",o);var s=(0,g.v4)(),c={name:a,loadingProgress:0,abortController:t,id:s};i((function(e){return A(A([],e,!0),[c],!1)})),e.onFileUpdate("add",a);var l="".concat(e.uploadFileEndpoint,"?message-id=").concat(e.messageId);p().post(l,n,{onUploadProgress:function(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=c.id,i((function(e){var t=e.map((function(e){return e.id===n?U(U({},e),{loadingProgress:r}):e}));return t})))},signal:t.signal}).then((function(e){var r,n;r=e.data,n=c.id,i((function(e){var t=e.findIndex((function(e){return e.id===n}));if(-1!==t){var a=A([],e,!0);return a[t]=U(U({},a[t]),{id:r.fileId}),a}return e}))})).catch((function(n){var t,o;e.onFileUpdate("remove",a),f.current=U(U({},f.current),((t={})[a]=f.current[r.name]--,t)),function(e,r,n){d((function(r){return A(A([],r,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)})),i((function(e){return e.filter((function(e){return e.id!==r}))}))}(r.name,c.id,null===(o=n.response)||void 0===o?void 0:o.data)}))}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),l.length>0&&y(j,e.errorMessagesContainer),t.length>0&&y(b,e.filePreviewsContainer)]})};return r})()));
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.rustic-base-input {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-start;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.rustic-base-input .rustic-text-field {
|
|
7
|
+
padding: 16px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.rustic-base-input .rustic-text-field fieldset[aria-hidden='true'] {
|
|
11
|
+
border-width: 1px;
|
|
12
|
+
border: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rustic-error-and-input-container {
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.rustic-base-input .rustic-input-field {
|
|
20
|
+
display: flex;
|
|
21
|
+
border-radius: 16px;
|
|
22
|
+
position: relative;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rustic-base-input .rustic-input-label {
|
|
27
|
+
padding-top: 8px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.rustic-base-input .rustic-text-field .MuiOutlinedInput-input {
|
|
31
|
+
padding: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rustic-base-input .rustic-text-field .MuiOutlinedInput-root {
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.rustic-base-input .rustic-send-button {
|
|
39
|
+
margin: 10px 8px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
span.rustic-icon-large {
|
|
43
|
+
font-size: 32px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
emoji-picker {
|
|
47
|
+
--border-color: transparent;
|
|
48
|
+
--outline-size: 1px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@media screen and (max-width: 600px) {
|
|
52
|
+
emoji-picker {
|
|
53
|
+
--num-columns: 5;
|
|
54
|
+
--category-emoji-size: 1.125rem;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/input/textInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAA;AAEnC,cAAc,aAAa,CAAA;AAC3B,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e,r,t={13:e=>{e.exports=require("emoji-picker-element")}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var i=Object.create(null);o.r(i);var a={};e=e||[null,r({}),r([]),r(r)];for(var c=2&n&&t;"object"==typeof c&&!~e.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>t[e]));return a.default=()=>t,o.d(i,a),i},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{o.r(i),o.d(i,{ParticipantRole:()=>R,ParticipantType:()=>I,default:()=>M});const e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Box");var n=o.n(t);const a=require("@mui/material/CircularProgress");var c=o.n(a);const s=require("@mui/material/IconButton");var u=o.n(s);const l=require("@mui/material/InputAdornment");var d=o.n(l);const p=require("@mui/material/MenuItem");var m=o.n(p);const f=require("@mui/material/MenuList");var h=o.n(f);const v=require("@mui/material/Popover");var g=o.n(v);const y=require("@mui/material/TextField");var b=o.n(y);const j=require("@mui/material/Tooltip");var x=o.n(j);const w=require("@mui/material/Typography");var O=o.n(w),S=o(13);const k=require("uuid");function P(r){return r.name.replaceAll("_","-"),(0,e.jsx)("span",{className:"".concat(r.className?r.className+" ":"","material-symbols-rounded"),children:r.name})}const C=require("@mui/material/styles"),E=function(t){var n=(0,C.useTheme)(),i=(0,r.useRef)(null),a=(0,r.useRef)(null),c=(0,r.useState)(!1),s=c[0],l=c[1],d={"--indicator-color":n.palette.divider,"--background":n.palette.background.paper,"--input-border-color":n.palette.divider,"--outline-color":n.palette.secondary.main};function p(){l(!1)}function m(e){e.detail.unicode&&t.onEmojiClick(e.detail.unicode),p()}return(0,r.useEffect)((function(){a.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,13,23)).then((function(e){var r=new(0,e.Picker),t="dark"===n.palette.mode?"dark":"light";r.classList.add(t),Object.keys(d).forEach((function(e){r.style.setProperty(e,d[e])})),a.current=r})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,r.useEffect)((function(){return a.current&&a.current.addEventListener("emoji-click",m),function(){var e;null===(e=a.current)||void 0===e||e.removeEventListener("emoji-click",m)}}),[s,t.onEmojiClick]),(0,e.jsxs)("div",{children:[(0,e.jsx)(x(),{title:"Emoji",children:(0,e.jsx)(u(),{size:"small",ref:i,onClick:function(){l((function(e){return!e}))},sx:{color:t.buttonColor},children:(0,e.jsx)(P,{name:"Mood"})})}),a.current&&(0,e.jsx)(g(),{open:s,anchorEl:i.current,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,e.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&a.current&&!e.contains(a.current)&&e.appendChild(a.current)}})})]})};var q={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function N(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var T=(0,r.forwardRef)((function(t,o){var i=(0,r.useState)(""),a=i[0],s=i[1],l=(0,r.useState)(!1),p=l[0],f=l[1],v=(0,r.useState)(!1),y=v[0],j=v[1],w=(0,r.useState)(!1),C=w[0],T=w[1],_=(0,r.useState)(""),R=_[0],I=_[1],z=(0,r.useState)([]),M=z[0],A=z[1],B=(0,r.useState)(!1),F=B[0],L=B[1],D=(0,r.useRef)(null),W=!a.trim().length&&!t.isSendEnabled,K="".concat(p?"Stop":"Start"," speech to text"),$=y?"primary.main":"primary.light",H=p?"error.main":$,Q=p?"stop_circle":"speech_to_text";function G(e,r){if(void 0===r&&(r=!1),D.current){var t=D.current,n=t.selectionStart,o=t.selectionEnd;if("number"==typeof n&&"number"==typeof o){var i,c=a||"",u=c.substring(0,n),l=c.substring(o);i=r?u.replace(/:(\w+)$/,e)+l:u+e+l,s(i);var d=r?u.replace(/:(\w+)$/,e).length:n+e.length;setTimeout((function(){var e,r;null===(e=D.current)||void 0===e||e.focus(),null===(r=D.current)||void 0===r||r.setSelectionRange(d,d)}),0)}}L(!1)}var J=new S.Database,U=C?(0,e.jsx)(c(),{size:24}):(0,e.jsx)(x(),{title:K,children:(0,e.jsx)(u(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,p?(e.stop(),T(!0),f(!1)):(e.start(),I(""),f(!0)),e.onstart=function(){f(!0)},e.onresult=function(e){var r,t=e.results[0][0].transcript;a.length>0?s(a+" "+t):s(t),null===(r=D.current)||void 0===r||r.focus(),f(!1)},e.onerror=function(e){var r=q[e.error];I(r),f(!1)},e.onend=function(){T(!1),f(!1)}},size:"small",sx:{color:H},children:(0,e.jsx)(P,{name:Q})})});function V(){var e=(new Date).toISOString(),r={id:(0,k.v4)(),timestamp:e,sender:t.sender,conversationId:t.conversationId,format:"text",data:{text:a}};t.send(r),s(""),I("")}return(0,e.jsxs)(n(),{className:"rustic-base-input",ref:o,children:[(0,e.jsxs)(n(),{className:"rustic-error-and-input-container",children:[(0,e.jsx)(n(),{className:"rustic-error-container",children:(0,e.jsx)(O(),{variant:"caption",color:"error",className:"rustic-error-message",children:R})}),(0,e.jsxs)(n(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:y?"secondary.main":"action.disabled"},children:[M.length>0&&(0,e.jsx)(g(),{open:F,anchorEl:D.current,onClose:function(){return L(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,e.jsx)(h(),{children:M.map((function(r,t){return"unicode"in r&&(0,e.jsx)(m(),{onClick:function(){return G(r.unicode,!0)},children:N(r)},t)}))})}),(0,e.jsx)(b(),{className:"rustic-text-field",variant:"outlined",value:a,label:t.label,placeholder:t.placeholder,maxRows:t.maxRows,multiline:t.multiline,fullWidth:t.fullWidth,onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),!W&&V())},onChange:function(e){I("");var r=e.target.value;s(r);var n,o=r.match(/:(\w{2,}):/g),i=r.match(/:(\w{2,})/g);if(o){var a=o[0].replace(/:/g,"");J.getEmojiByShortcode(a).then((function(e){if(e&&"unicode"in e){var t=r.replace(o[0],e.unicode);s(t)}else s(r)})).catch((function(){s(r)})),L(!1)}else i?(n=i[0].replace(":",""),J.getEmojiBySearchQuery(n).then((function(e){e.length?(A(e.slice(0,t.maximumEmojiSearchResults)),L(!0)):(A([]),L(!1))})).catch((function(){A([]),L(!1)}))):L(!1)},onFocus:function(){return j(!0)},onBlur:function(){return j(!1)},inputRef:D,color:"secondary",size:"small",InputProps:{endAdornment:(0,e.jsxs)(d(),{position:"end",children:[(0,e.jsx)(E,{onEmojiClick:G,buttonColor:$}),t.enableSpeechToText&&U]})},InputLabelProps:{className:y?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}),(0,e.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,e.jsxs)(n(),{className:"rustic-input-actions",children:[t.children,(0,e.jsx)(x(),{title:"Send",children:(0,e.jsx)("span",{className:"rustic-send-button",children:(0,e.jsx)(u(),{"aria-label":"send message",onClick:V,disabled:W,color:"primary",children:(0,e.jsx)(P,{name:"send"})})})})]})]})}));T.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const _=T;var R,I,z=function(){return z=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},z.apply(this,arguments)};!function(e){e.Owner="owner",e.Member="member"}(R||(R={})),function(e){e.Human="human",e.Agent="agent"}(I||(I={}));const M=function(r){var t=r.ws,n=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}(r,["ws"]);return(0,e.jsx)(_,z({},n,{send:function(e){t.send(e)}}))}})(),i})()));
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { TextInputProps } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
The `TextInput` component enables users to input text messages and send them over a WebSocket connection. It provides functionality for sending messages with a sender, timestamp, and conversation ID. The component integrates with the [emoji-picker-element](https://www.npmjs.com/package/emoji-picker-element) library to allow users to easily add emojis to their messages. The emoji picker can be customized through CSS variables. For detailed customization options, refer to the [emoji-picker-element documentation](https://www.npmjs.com/package/emoji-picker-element#css-variables).
|
|
4
|
-
*/
|
|
5
2
|
export default function TextInput(props: TextInputProps): import("react/jsx-runtime").JSX.Element;
|
|
6
3
|
//# sourceMappingURL=textInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/textInput/textInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,aAAa,CAAA;AAG1D
|
|
1
|
+
{"version":3,"file":"textInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/textInput/textInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,aAAa,CAAA;AAG1D,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CActD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/map/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,cAAc,UAAU,CAAA;AACxB,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var n=r&&r.__esModule?()=>r.default:()=>r;return e.d(n,{a:n}),n},d:(r,n)=>{for(var t in n)e.o(n,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:n[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{ParticipantRole:()=>x,ParticipantType:()=>q,default:()=>w});const n=require("react/jsx-runtime"),t=(require("ol/ol.css"),require("@mui/material/Alert"));var o=e.n(t);const a=require("@mui/material/Box");var i=e.n(a);const u=require("ol/layer/Tile.js");var l=e.n(u);const s=require("ol/Map.js");var c=e.n(s);const d=require("ol/Overlay.js");var m=e.n(d);const f=require("ol/proj.js"),p=require("ol/source/OSM.js");var v=e.n(p);const y=require("ol/View.js");var j=e.n(y);const g=require("react");function b(e){return e.name.replaceAll("_","-"),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}var x,q;!function(e){e.Owner="owner",e.Member="member"}(x||(x={})),function(e){e.Human="human",e.Agent="agent"}(q||(q={}));const w=function(e){var r=(0,g.useState)(""),t=r[0],a=r[1],u=(0,g.useRef)(null),s=(0,g.useRef)(null);return(0,g.useEffect)((function(){if(a(""),e.latitude<-90||e.latitude>90||e.longitude<-180||e.longitude>180)return a("Invalid coordinates");if(u.current&&s.current){var r=new(c())({layers:[new(l())({source:new(v())})],view:new(j())({center:(0,f.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:u.current}),n=new(m())({element:s.current,position:(0,f.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return r.addOverlay(n),r.once("postrender",(function(){var e;if(!(null===(e=u.current)||void 0===e?void 0:e.querySelector("canvas")))return a("An error occurred while loading the map")})),function(){r.setTarget(""),r.removeOverlay(n)}}}),[]),(0,n.jsx)(n.Fragment,{children:t.length>0?(0,n.jsx)(o(),{severity:"error",children:t}):(0,n.jsxs)(i(),{children:[(0,n.jsx)(i(),{ref:s,children:(0,n.jsx)(b,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,n.jsx)("div",{ref:u,className:"rustic-open-layers-map-canvas"})]})})};return r})()));
|
|
@@ -5,6 +5,11 @@ import type { LocationFormat } from '../types';
|
|
|
5
5
|
*
|
|
6
6
|
* Height and width are configured through the class `rustic-open-layers-map-canvas`.
|
|
7
7
|
*
|
|
8
|
-
* Note:
|
|
8
|
+
* Note: `ol` is not bundled, so please install the following package using npm:
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* npm i ol
|
|
12
|
+
* ```
|
|
13
|
+
* If you are not seeing the component or come across the error "An error occurred while loading the map", ensure that `@import '@rustic-ai/ui-components/index.css';` is at the top of your `index.css` file. */
|
|
9
14
|
export default function OpenLayersMap(props: LocationFormat): import("react/jsx-runtime").JSX.Element;
|
|
10
15
|
//# sourceMappingURL=openLayersMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openLayersMap.d.ts","sourceRoot":"","sources":["../../../src/components/map/openLayersMap.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAClB,OAAO,qBAAqB,CAAA;AAc5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C
|
|
1
|
+
{"version":3,"file":"openLayersMap.d.ts","sourceRoot":"","sources":["../../../src/components/map/openLayersMap.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAClB,OAAO,qBAAqB,CAAA;AAc5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C;;;;;;;;;iNASiN;AACjN,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,cAAc,2CA4E1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/markdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,uBAAuB,MAAM,2BAA2B,CAAA;AAC/D,cAAc,UAAU,CAAA;AACxB,eAAe,cAAc,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MarkedMarkdown:()=>s,MarkedStreamingMarkdown:()=>l,ParticipantRole:()=>m,ParticipantType:()=>y,default:()=>g});const r=require("react/jsx-runtime"),a=require("@mui/material/Typography");var n=e.n(a);const o=require("dompurify");var u=e.n(o);const i=require("marked"),d=require("react");function c(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=i.marked.parse(t);return u().sanitize(r)}const s=function(e){var t=(0,d.useState)(c(e.text)),a=t[0],o=t[1];return(0,d.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;o(c(t))}}),[e.text,e.updatedData]),(0,r.jsx)(n(),{variant:"body2",dangerouslySetInnerHTML:{__html:a}})},f=require("@mui/material/Alert");var p=e.n(f);const l=function(e){var t=(0,d.useState)(c(e.text)),a=t[0],o=t[1],u=(0,d.useState)(""),i=u[0],s=u[1];return(0,d.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,a=e.updatedData;r<a.length;r++){var n=a[r];"string"!=typeof n.text?(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=n.text}o(c(t))}}),[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n(),{variant:"body2",dangerouslySetInnerHTML:{__html:a}}),i&&(0,r.jsx)(p(),{severity:"error",children:i})]})};var m,y;!function(e){e.Owner="owner",e.Member="member"}(m||(m={})),function(e){e.Human="human",e.Agent="agent"}(y||(y={}));const g=s;return t})()));
|
|
@@ -6,7 +6,13 @@ export declare function convertMarkdownToHtml(text: string): string;
|
|
|
6
6
|
*
|
|
7
7
|
* On the other hand, the `MarkedStreamingMarkdown` component is designed to handle streams of markdown-formatted text data. This component supports updates involving continuous appending of new markdown data to the existing content through the `updatedData` attribute.
|
|
8
8
|
*
|
|
9
|
-
* Tip: Use `MarkedMarkdown` when displaying static content or when you'd like to support content overwrite updates, and use `MarkedStreamingMarkdown` when its being updated dynamically and new content should be appended to existing content.
|
|
9
|
+
* Tip: Use `MarkedMarkdown` when displaying static content or when you'd like to support content overwrite updates, and use `MarkedStreamingMarkdown` when its being updated dynamically and new content should be appended to existing content.
|
|
10
|
+
*
|
|
11
|
+
* Note: `marked` and `dompurify` are not bundled, so please install the following packages using npm:
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* npm i marked dompurify
|
|
15
|
+
* ``` */
|
|
10
16
|
declare const MarkedMarkdown: (props: TextData) => import("react/jsx-runtime").JSX.Element;
|
|
11
17
|
export default MarkedMarkdown;
|
|
12
18
|
//# sourceMappingURL=markedMarkdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markedMarkdown.d.ts","sourceRoot":"","sources":["../../../src/components/markdown/markedMarkdown.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED
|
|
1
|
+
{"version":3,"file":"markedMarkdown.d.ts","sourceRoot":"","sources":["../../../src/components/markdown/markedMarkdown.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED;;;;;;;;;;;;SAYS;AACT,QAAA,MAAM,cAAc,UAAW,QAAQ,4CActC,CAAA;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
.rustic-sound video {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* captions */
|
|
6
|
+
.rustic-sound video::cue {
|
|
7
|
+
font-size: 16px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.rustic-sound .rustic-control-error {
|
|
11
|
+
margin-top: 16px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* style video element if has captions */
|
|
15
|
+
.rustic-sound .rustic-has-captions {
|
|
16
|
+
display: unset;
|
|
17
|
+
height: 10vh;
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rustic-sound-bottom-controls {
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rustic-sound-bottom-controls-left {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.rustic-sound-bottom-controls-right {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.rustic-time-controls {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media (max-width: 900px) {
|
|
43
|
+
.rustic-sound-title {
|
|
44
|
+
padding: 0;
|
|
45
|
+
text-align: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.rustic-sound-bottom-controls {
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
padding-inline: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.rustic-sound .rustic-pause-play-icon span {
|
|
54
|
+
font-size: 52px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rustic-progress {
|
|
59
|
+
display: flex;
|
|
60
|
+
gap: 24px;
|
|
61
|
+
align-items: center;
|
|
62
|
+
position: relative;
|
|
63
|
+
width: 100%;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.rustic-progress-slider {
|
|
67
|
+
height: 8px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* circle that you drag on slider to change the time */
|
|
71
|
+
.rustic-progress-slider .MuiSlider-thumb {
|
|
72
|
+
z-index: 2;
|
|
73
|
+
width: 15px;
|
|
74
|
+
height: 15px;
|
|
75
|
+
}
|
|
76
|
+
/* bar to the left of the thumb (circle), tracking the time */
|
|
77
|
+
.rustic-progress-slider .MuiSlider-track {
|
|
78
|
+
z-index: 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.rustic-progress-buffered {
|
|
82
|
+
height: 8px;
|
|
83
|
+
position: absolute;
|
|
84
|
+
border-radius: 12px;
|
|
85
|
+
width: 100%;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.rustic-volume-settings {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.rustic-volume-slider {
|
|
94
|
+
transition: 0.2s ease-in-out;
|
|
95
|
+
width: 0px;
|
|
96
|
+
height: 5px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* circle that you drag on slider to change the volume */
|
|
100
|
+
.rustic-volume-slider .MuiSlider-thumb {
|
|
101
|
+
width: 10px;
|
|
102
|
+
height: 10px;
|
|
103
|
+
display: none;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* slider thumb appears on hover or focus */
|
|
107
|
+
.rustic-volume-settings:hover .MuiSlider-thumb,
|
|
108
|
+
.rustic-volume-settings:focus-within .MuiSlider-thumb {
|
|
109
|
+
display: unset;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.rustic-transcript-toggle span {
|
|
113
|
+
line-height: 1.5;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.rustic-playback-rate-button {
|
|
117
|
+
min-width: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (min-width: 900px) {
|
|
121
|
+
/* slider appears on hover or focus */
|
|
122
|
+
.rustic-volume-settings:hover .rustic-volume-slider,
|
|
123
|
+
.rustic-volume-settings:focus-within .rustic-volume-slider {
|
|
124
|
+
width: 64px;
|
|
125
|
+
margin-inline: 8px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@media (max-width: 900px) {
|
|
130
|
+
.rustic-progress {
|
|
131
|
+
padding-inline: 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.rustic-progress-buffered {
|
|
135
|
+
left: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.rustic-volume-settings {
|
|
139
|
+
gap: 8px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.rustic-volume-slider {
|
|
143
|
+
width: 100%;
|
|
144
|
+
margin-right: 24px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.rustic-volume-settings .MuiSlider-thumb {
|
|
148
|
+
display: unset;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
span.rustic-icon-large {
|
|
153
|
+
font-size: 32px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.rustic-time-display {
|
|
157
|
+
margin-left: 8px;
|
|
158
|
+
min-width: fit-content;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@media (max-width: 900px) {
|
|
162
|
+
.rustic-time-container {
|
|
163
|
+
display: flex;
|
|
164
|
+
justify-content: space-between;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.rustic-transcript-container {
|
|
169
|
+
display: flex;
|
|
170
|
+
gap: 16px;
|
|
171
|
+
margin-top: 16px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.rustic-transcript-container hr {
|
|
175
|
+
border-right-width: medium;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.rustic-transcript-content {
|
|
179
|
+
max-height: 25vh;
|
|
180
|
+
overflow-y: scroll;
|
|
181
|
+
}
|
|
182
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/media/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,cAAc,aAAa,CAAA;AAC3B,eAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ParticipantRole:()=>L,ParticipantType:()=>R,default:()=>V});const n=require("react/jsx-runtime"),r=require("@mui/material"),a=require("@mui/material/Alert");var i=e.n(a);const s=require("@mui/material/CircularProgress");var o=e.n(s);const l=require("@mui/material/Typography");var c=e.n(l);const u=require("@mui/system"),m=require("react"),d=require("@mui/material/Box");var f=e.n(d);const p=require("@mui/material/Button");var x=e.n(p);const v=require("@mui/material/LinearProgress");var b=e.n(v);const y=require("@mui/material/Slider");var j=e.n(y);const h=require("@mui/material/Tooltip");var E,g=e.n(h);function N(e){var t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60),a=t>0?"".concat(t,":"):"",i="".concat(t>0?n.toString().padStart(2,"0"):n),s=r.toString().padStart(2,"0");return"".concat(a).concat(i,":").concat(s)}function T(e){return e.name.replaceAll("_","-"),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),children:e.name})}require("pluralize"),function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(E||(E={}));const S=require("@mui/material/IconButton");var _=e.n(S);function k(e){var t,r={play:{symbol:"play_circle",label:"Play"},pause:{symbol:"pause_circle",label:"Pause"},forward:{symbol:"forward_10",label:"Forward ten seconds"},replay:{symbol:"replay_10",label:"Replay ten seconds"},volumeUp:{symbol:"volume_up",label:"Mute"},volumeOff:{symbol:"volume_off",label:"Unmute"},miniPlayer:{symbol:"picture_in_picture",label:"Mini player"},miniPlayerExit:{symbol:"picture_in_picture_off",label:"Exit mini player"},fullscreen:{symbol:"fullscreen",label:"Fullscreen"},fullscreenExit:{symbol:"fullscreen_exit",label:"Exit fullscreen"},captionsOn:{symbol:"closed_caption",label:"Show captions"},captionsOff:{symbol:"closed_caption_disabled",label:"Hide captions"}};return r[e.action].label.replaceAll(" ","-").toLowerCase(),(0,n.jsx)(g(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,n.jsx)(_(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,n.jsx)(T,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}function P(e){var t="dark"===(0,r.useTheme)().palette.mode,a=N(e.mediaElement.currentTime);return(0,n.jsxs)(f(),{className:"rustic-progress",children:[function(){for(var r=e.mediaElement.buffered,a=0,i=r.length-1;i>=0;--i){var s=r.start(i),o=r.end(i);if(s<e.mediaElement.currentTime){a=o;break}}var l=a/e.mediaElement.duration*100;return(0,n.jsx)(b(),{className:"rustic-progress-buffered",variant:"determinate",value:l,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,n.jsx)(j(),{className:"rustic-progress-slider",size:"small","aria-label":"Time","aria-valuetext":"Current time: ".concat(a),max:e.mediaElement.duration,value:e.mediaElement.currentTime,onChange:function(t,n){e.mediaElement.currentTime=n},valueLabelDisplay:"auto",valueLabelFormat:function(e){return N(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function w(e){var t=(0,m.useState)(e.mediaElement.volume),r=t[0],a=t[1],i=(0,m.useState)(e.mediaElement.volume),s=i[0],o=i[1],l=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,n.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,n.jsx)(k,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(o(e.mediaElement.volume),a(0)):a(s)},className:"rustic-mute-button",action:l}),(0,n.jsx)(j(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(100*r,"%"),value:r,onChange:function(t,n){var r=n;e.mediaElement.muted=0===r,e.mediaElement.volume=r,a(e.mediaElement.volume)}})]})}function B(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,n.jsx)(x(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,n.jsx)(T,{name:t}),children:(0,n.jsx)(c(),{variant:"overline",children:r})})}function C(e){var t=(0,m.useState)(!e.mediaElement.paused),r=t[0],a=t[1],i=r?"pause":"play";return e.mediaElement.onended=function(){a(!1)},e.mediaElement.onpause=function(){a(!1)},e.mediaElement.onplay=function(){a(!0)},(0,n.jsx)(k,{onClick:function(){r?e.mediaElement.pause():e.mediaElement.play().catch((function(t){e.onError("Failed to play the media. Error: ".concat(t.message))}))},action:i,className:"rustic-pause-play-icon"})}function O(e){var t,r=(0,m.useState)(e.mediaElement.playbackRate),a=r[0],i=r[1];return(0,n.jsx)(g(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,n.jsx)(x(),{onClick:function(){var t=1;e.mediaElement.playbackRate<2&&(t=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=t,i(t)},className:"rustic-playback-rate-button",children:(0,n.jsxs)(c(),{variant:"body1",children:[a,"X"]})})})}function q(e){var t="replay"===e.movement,r=t?function(){e.mediaElement.currentTime-=10}:function(){e.mediaElement.currentTime+=10},a=t?"replay":"forward";return(0,n.jsx)(k,{onClick:r,action:a})}function M(e){var t=N(e.elapsedTimeInSeconds),r=N(e.durationTimeInSeconds),a="".concat(t," / ").concat(r);return"wide"===e.style?(0,n.jsxs)(f(),{className:"rustic-time-container",children:[(0,n.jsx)(c(),{variant:"overline",children:t}),(0,n.jsx)(c(),{variant:"overline",children:r})]}):(0,n.jsx)(c(),{variant:"overline",className:"rustic-time-display",children:a})}M.defaultProps={style:"condensed"};const I=require("@mui/material/Divider");var L,R,F=e.n(I);function H(e){var t=!!document.fullscreenElement;return(0,n.jsxs)(u.Box,{className:"rustic-transcript-container",children:[!t&&(0,n.jsx)(F(),{orientation:"vertical",flexItem:!0}),(0,n.jsx)(c(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}!function(e){e.Owner="owner",e.Member="member"}(L||(L={})),function(e){e.Human="human",e.Agent="agent"}(R||(R={}));const V=function(e){var t=(0,m.useState)(!1),a=t[0],s=t[1],l=(0,m.useState)(!1),d=l[0],f=l[1],p=(0,m.useState)(!0),x=p[0],v=p[1],b=(0,m.useState)(0),y=b[0],j=b[1],h=(0,m.useState)(""),E=h[0],g=h[1],N=(0,m.useState)(""),T=N[0],S=N[1],_=(0,r.useTheme)(),I=(0,m.useRef)(null),L=(0,r.useMediaQuery)(_.breakpoints.down("md"));function R(){return(0,n.jsx)(c(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function F(){if(e.captions&&e.captions.length>0){var t=d?"captionsOff":"captionsOn";return(0,n.jsx)(k,{action:t,onClick:function(){return f(!d)}})}}function V(){if(I.current)return(0,n.jsxs)(u.Box,{className:"rustic-time-controls",children:[(0,n.jsx)(q,{mediaElement:I.current,movement:"replay"}),(0,n.jsx)(C,{mediaElement:I.current,onError:S}),(0,n.jsx)(q,{mediaElement:I.current,movement:"forward"})]})}function A(){if(e.transcript&&a)return(0,n.jsx)(H,{transcript:e.transcript})}function U(){if(e.transcript)return(0,n.jsx)(B,{isTranscriptVisible:a,setIsTranscriptVisible:function(){return s(!a)}})}function D(){return(0,n.jsx)("video",{src:e.src,ref:I,className:d?"rustic-has-captions":"",children:d&&(0,n.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,m.useEffect)((function(){var e,t,n,r;function a(e){g(e)}null===(e=I.current)||void 0===e||e.addEventListener("timeupdate",(function(){I.current&&j(I.current.currentTime)})),null===(t=I.current)||void 0===t||t.addEventListener("canplay",(function(){g(""),v(!1)})),null===(n=I.current)||void 0===n||n.addEventListener("error",(function(){return a("Failed to load the audio.")})),null===(r=I.current)||void 0===r||r.addEventListener("stalled",(function(){return a("Failed to fetch audio data, but trying.")}))}),[]);var z=L?function(){if(I.current)return(0,n.jsxs)(u.Box,{className:"rustic-sound-controls",children:[(0,n.jsx)(M,{elapsedTimeInSeconds:y,durationTimeInSeconds:I.current.duration,style:"wide"}),(0,n.jsx)(P,{mediaElement:I.current}),R(),(0,n.jsxs)(u.Box,{className:"rustic-sound-bottom-controls",children:[(0,n.jsx)(u.Box,{className:"rustic-sound-bottom-controls-left",children:V()}),(0,n.jsx)(w,{mediaElement:I.current}),(0,n.jsxs)(u.Box,{className:"rustic-sound-bottom-controls-right",children:[U(),(0,n.jsxs)(u.Box,{children:[F(),(0,n.jsx)(O,{mediaElement:I.current})]})]})]}),A()]})}:function(){if(I.current)return(0,n.jsxs)(n.Fragment,{children:[R(),(0,n.jsxs)(u.Box,{className:"rustic-sound-controls",children:[(0,n.jsx)(P,{mediaElement:I.current}),(0,n.jsxs)(u.Box,{className:"rustic-sound-bottom-controls",children:[(0,n.jsxs)(u.Box,{className:"rustic-sound-bottom-controls-left",children:[V(),F(),(0,n.jsx)(O,{mediaElement:I.current}),(0,n.jsx)(w,{mediaElement:I.current}),(0,n.jsx)(M,{elapsedTimeInSeconds:y,durationTimeInSeconds:I.current.duration,style:"condensed"})]}),(0,n.jsx)(u.Box,{className:"rustic-sound-bottom-controls-right",children:U()})]}),A()]})]})};return E.length>0?(0,n.jsx)(i(),{severity:"error",children:E}):x?(0,n.jsxs)(u.Box,{className:"rustic-sound",children:[D(),(0,n.jsx)(o(),{})]}):(0,n.jsxs)(u.Box,{className:"rustic-sound",children:[D(),z(),T.length>0&&(0,n.jsx)(i(),{severity:"error",className:"rustic-control-error",onClose:function(){return S("")},children:T})]})};return t})()));
|