@rustic-ai/ui-components 0.0.40 → 0.0.41
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/index.d.ts +1 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/baseInput/baseInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
- package/dist/components/input/textInput/index.js +1 -1
- package/dist/components/input/textInput/textInput.d.ts.map +1 -1
- package/dist/components/sharedDescription.d.ts +1 -0
- package/dist/components/sharedDescription.d.ts.map +1 -1
- package/dist/index.css +0 -40
- package/dist/index.js +1 -1
- package/package.json +2 -7
- package/dist/components/video/index.css +0 -49
- package/dist/components/video/index.d.ts +0 -3
- package/dist/components/video/index.d.ts.map +0 -1
- package/dist/components/video/index.js +0 -1
- package/dist/components/video/youtubeVideo.d.ts +0 -23
- package/dist/components/video/youtubeVideo.d.ts.map +0 -1
- package/dist/components/visualization/chart/index.css +0 -49
- package/dist/components/visualization/chart/index.d.ts +0 -4
- package/dist/components/visualization/chart/index.d.ts.map +0 -1
- package/dist/components/visualization/chart/index.js +0 -1
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts +0 -69
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts.map +0 -1
|
@@ -29,14 +29,12 @@ import Table from './table/table';
|
|
|
29
29
|
import StreamingText from './text/streamingText';
|
|
30
30
|
import Text from './text/text';
|
|
31
31
|
import Timestamp from './timestamp/timestamp';
|
|
32
|
-
import YoutubeVideo from './video/youtubeVideo';
|
|
33
|
-
import RechartsTimeSeries from './visualization/chart/rechartsTimeSeries';
|
|
34
32
|
import MermaidViz from './visualization/mermaidViz/mermaidViz';
|
|
35
33
|
import PerspectiveViz from './visualization/perspectiveViz/perspectiveViz';
|
|
36
34
|
import PlotlyGraph from './visualization/plotlyGraph/plotlyGraph';
|
|
37
35
|
import VegaLiteViz from './visualization/vegaLiteViz/vegaLiteViz';
|
|
38
36
|
import Weather from './weather/weather';
|
|
39
|
-
export { Action, ChatCompletion, CodeSnippet, CopyText, ElementRenderer, FCCalendar, Icon, Image, MarkedMarkdown, MarkedStreamingMarkdown, MermaidViz, MessageCanvas, MessageSpace, MultimodalInput, Multipart, OpenLayersMap, ParticipantsContainer, PDFViewer, PerspectiveViz, PlotlyGraph, PopoverMenu, PromptBuilder, Prompts, Question,
|
|
37
|
+
export { Action, ChatCompletion, CodeSnippet, CopyText, ElementRenderer, FCCalendar, Icon, Image, MarkedMarkdown, MarkedStreamingMarkdown, MermaidViz, MessageCanvas, MessageSpace, MultimodalInput, Multipart, OpenLayersMap, ParticipantsContainer, PDFViewer, PerspectiveViz, PlotlyGraph, PopoverMenu, PromptBuilder, Prompts, Question, Sound, StreamingText, Table, Text, TextInput, TextToSpeech, Timestamp, UniformsForm, Uploader, VegaLiteViz, Video, Weather, };
|
|
40
38
|
export * from '../rusticTheme';
|
|
41
39
|
export type * from './types';
|
|
42
40
|
export { ParticipantRole, ParticipantType } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,WAAW,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,eAAe,MAAM,mCAAmC,CAAA;AAC/D,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,eAAe,MAAM,oDAAoD,CAAA;AAChF,OAAO,QAAQ,MAAM,sCAAsC,CAAA;AAC3D,OAAO,SAAS,MAAM,6BAA6B,CAAA;AACnD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,cAAc,MAAM,2BAA2B,CAAA;AACtD,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAC5C,OAAO,QAAQ,MAAM,uCAAuC,CAAA;AAC5D,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAClD,OAAO,YAAY,MAAM,mDAAmD,CAAA;AAC5E,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,YAAY,MAAM,6BAA6B,CAAA;AACtD,OAAO,cAAc,MAAM,2CAA2C,CAAA;AACtE,OAAO,SAAS,MAAM,iCAAiC,CAAA;AACvD,OAAO,qBAAqB,MAAM,+CAA+C,CAAA;AACjF,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,OAAO,MAAM,mBAAmB,CAAA;AACvC,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,aAAa,MAAM,sBAAsB,CAAA;AAChD,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,WAAW,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,eAAe,MAAM,mCAAmC,CAAA;AAC/D,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,eAAe,MAAM,oDAAoD,CAAA;AAChF,OAAO,QAAQ,MAAM,sCAAsC,CAAA;AAC3D,OAAO,SAAS,MAAM,6BAA6B,CAAA;AACnD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,cAAc,MAAM,2BAA2B,CAAA;AACtD,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAC5C,OAAO,QAAQ,MAAM,uCAAuC,CAAA;AAC5D,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAClD,OAAO,YAAY,MAAM,mDAAmD,CAAA;AAC5E,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,YAAY,MAAM,6BAA6B,CAAA;AACtD,OAAO,cAAc,MAAM,2CAA2C,CAAA;AACtE,OAAO,SAAS,MAAM,iCAAiC,CAAA;AACvD,OAAO,qBAAqB,MAAM,+CAA+C,CAAA;AACjF,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,OAAO,MAAM,mBAAmB,CAAA;AACvC,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,aAAa,MAAM,sBAAsB,CAAA;AAChD,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,UAAU,MAAM,uCAAuC,CAAA;AAC9D,OAAO,cAAc,MAAM,+CAA+C,CAAA;AAC1E,OAAO,WAAW,MAAM,yCAAyC,CAAA;AACjE,OAAO,WAAW,MAAM,yCAAyC,CAAA;AACjE,OAAO,OAAO,MAAM,mBAAmB,CAAA;AAEvC,OAAO,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,IAAI,EACJ,KAAK,EACL,cAAc,EACd,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,OAAO,EACP,QAAQ,EACR,KAAK,EACL,aAAa,EACb,KAAK,EACL,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,OAAO,GACR,CAAA;AAED,cAAc,gBAAgB,CAAA;AAC9B,mBAAmB,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC1D,mBAAmB,6CAA6C,CAAA;AAChE,mBAAmB,+CAA+C,CAAA;AAClE,mBAAmB,+CAA+C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,oBAAoB,CAAA;AAmB3B,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,oBAAoB,CAAA;AAmB3B,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAA;AA0evE,QAAA,MAAM,SAAS;;wCAA+B,CAAA;AAE9C,eAAe,SAAS,CAAA"}
|
|
@@ -1 +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,t,r={9767:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(8732),o=(r(2015),function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:o({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var a=Object.create(null);o.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var c=2&n&&r;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((e=>i[e]=()=>r[e]));return i.default=()=>r,o.d(a,i),a},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};o.r(a),o.d(a,{ParticipantRole:()=>Oe,ParticipantType:()=>Ce,default:()=>ke});var i=o(8732);const c=require("@mui/material/Box");var l=o.n(c);const s=require("@mui/material/styles");var u=o(2015);const d=require("uuid");var p;function f(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const m=require("@mui/material/Avatar");var h=o.n(m);const v=require("@mui/material/CircularProgress");var g=o.n(v);const x=require("@mui/material/IconButton");var b=o.n(x);const y=require("@mui/material/InputAdornment");var j=o.n(y);const w=require("@mui/material/MenuItem");var S=o.n(w);const O=require("@mui/material/MenuList");var C=o.n(O);const N=require("@mui/material/Popover");var F=o.n(N);const k=require("@mui/material/TextField");var P=o.n(k);const E=require("@mui/material/Tooltip");var I=o.n(E);const q=require("@mui/material/Typography");var A=o.n(q),T=o(8342),R=o(9767);const D=function(e){var t=(0,s.useTheme)(),r=(0,u.useRef)(null),n=(0,u.useRef)(null),a=(0,u.useState)(!1),c=a[0],l=a[1],d={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function p(){l(!1)}function f(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),p()}return(0,u.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(r){var o=new(0,r.Picker)({dataSource:e.dataSource}),a="dark"===t.palette.mode?"dark":"light";o.classList.add(a),Object.keys(d).forEach((function(e){o.style.setProperty(e,d[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",f),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",f)}}),[c,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(I(),{title:"Emoji",children:(0,i.jsx)(b(),{size:"small",ref:r,onClick:function(){l((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(R.A,{name:"Mood"})})}),n.current&&(0,i.jsx)(F(),{open:c,anchorEl:r.current,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,i.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var U={"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 _(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function L(e){return(0,i.jsxs)(l(),{className:"rustic-participant-profile",children:[(0,i.jsx)(h(),{src:e.icon,className:"rustic-participant-avatar"}),(0,i.jsx)(A(),{variant:"body1Bold",children:e.displayName})]})}function z(e){var t=e.items,r=e.isOpen,n=e.onClose,o=e.onSelect,a=e.renderItem,c=e.anchorEl,l=e.selectedIndex;return(0,i.jsx)(F(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,i.jsx)(C(),{children:t.map((function(e,t){return(0,i.jsx)(S(),{onClick:function(){return o(e)},selected:t===l,children:a(e)},t)}))})})}const M=(0,u.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,o=e.fullWidth,a=void 0===o||o,c=e.maxRows,s=void 0===c?6:c,p=e.enableSpeechToText,m=void 0!==p&&p,h=e.maximumEmojiSearchResults,v=void 0===h?5:h,x=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),y=(0,u.useState)(""),w=y[0],S=y[1],O=(0,u.useState)(!1),C=O[0],N=O[1],F=(0,u.useState)(!1),k=F[0],E=F[1],q=(0,u.useState)(!1),M=q[0],B=q[1],H=(0,u.useState)(""),$=H[0],W=H[1],K=(0,u.useState)([]),G=K[0],Q=K[1],V=(0,u.useState)(!1),Y=V[0],Z=V[1],J=(0,u.useState)(0),X=J[0],ee=J[1],te=(0,u.useRef)(null),re=new T.Database({dataSource:x.emojiDataSource}),ne=!w.trim().length&&!x.isSendEnabled,oe="".concat(C?"Stop":"Start"," speech to text"),ae=k?"primary.main":"primary.light",ie=C?"error.main":ae,ce=C?"stop_circle":"speech_to_text",le=(0,u.useState)([]),se=le[0],ue=le[1],de=(0,u.useState)(!1),pe=de[0],fe=de[1];function me(e,t){if(te.current){var r=te.current,n=r.selectionStart,o=r.selectionEnd;if("number"==typeof n&&"number"==typeof o){var a,i=w||"",c=i.substring(0,n),l=i.substring(o),s=void 0;t?(s=c.replace(t,e)+l,a=c.replace(t,e).length):(s=c+e+l,a=n+e.length),S(s),setTimeout((function(){var e,t;null===(e=te.current)||void 0===e||e.focus(),null===(t=te.current)||void 0===t||t.setSelectionRange(a,a)}),0)}}}function he(e){me("@".concat(e," "),/@(\w*)$/),ue([])}function ve(e,t){void 0===t&&(t=!1),me(e,t?/:(\w+)$/:void 0),Z(!1)}var ge=M?(0,i.jsx)(g(),{size:24}):(0,i.jsx)(I(),{title:oe,children:(0,i.jsx)(b(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,C?(e.stop(),B(!0),N(!1)):(e.start(),W(""),N(!0)),e.onstart=function(){N(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;w.length>0?S(w+" "+r):S(r),null===(t=te.current)||void 0===t||t.focus(),N(!1)},e.onerror=function(e){var t=U[e.error];W(t),N(!1)},e.onend=function(){B(!1),N(!1)}},size:"small",sx:{color:ie,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(R.A,{name:ce})})});function xe(){var e=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:e,sender:x.sender,conversationId:x.conversationId,format:"chatCompletionRequest",data:f(w)};x.send(t),S(""),W("")}return(0,i.jsxs)(l(),{className:"rustic-base-input",ref:t,children:[(0,i.jsxs)(l(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(l(),{className:"rustic-error-container",children:(0,i.jsx)(A(),{variant:"caption",color:"error",className:"rustic-error-message",children:$})}),(0,i.jsxs)(l(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:k?"secondary.main":"action.disabled"},children:[G.length>0&&te.current&&(0,i.jsx)(z,{anchorEl:te.current,items:G.filter((function(e){return"unicode"in e})),isOpen:Y,onClose:function(){Z(!1),ee(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:X,renderItem:_}),se.length>0&&te.current&&(0,i.jsx)(z,{anchorEl:te.current,items:se,isOpen:pe,onClose:function(){fe(!1),ee(0)},onSelect:function(e){return he(e.displayName)},renderItem:L,selectedIndex:X}),(0,i.jsx)(P(),{className:"rustic-text-field",variant:"outlined",value:w,label:x.label,placeholder:x.placeholder,maxRows:s,multiline:n,fullWidth:a,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),Y&&G.length>0&&"unicode"in G[X]?ve(G[X].unicode,!0):pe&&se.length>0?he(se[X].displayName):e.shiftKey||ne||xe();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(Y?ee((function(e){return(e+t+G.length)%G.length})):pe&&ee((function(e){return(e+t+se.length)%se.length})));0!==X&&ee(0)}},onChange:function(e){W("");var t=e.target.value;S(t),function(e){var t=e.match(/@(\w*)$/);if(t&&x.getMembers){var r=t[1].toLowerCase();x.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));ue(t),t.length>0?fe(!0):fe(!1)}))}else ue([])}(t);var r,n=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(n){var a=n[0].replace(/:/g,"");re.getEmojiByShortcode(a).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);S(r)}else S(t)})).catch((function(){S(t)})),Z(!1)}else o?(r=o[0].replace(":",""),re.getEmojiBySearchQuery(r).then((function(e){e.length?(Q(e.slice(0,v)),Z(!0)):(Q([]),Z(!1))})).catch((function(){Q([]),Z(!1)}))):Z(!1)},onFocus:function(){return E(!0)},onBlur:function(){return E(!1)},inputRef:te,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,i.jsxs)(j(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(D,{dataSource:x.emojiDataSource,onEmojiClick:ve,buttonColor:ae}),m&&ge]})},inputLabel:{className:k?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(l(),{className:"rustic-input-actions",children:[x.children,(0,i.jsx)(I(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(b(),{"aria-label":"send message",onClick:xe,disabled:ne,color:"secondary",children:(0,i.jsx)(R.A,{name:"send"})})})})]})]})})),B=require("@mui/material/LinearProgress");var H=o.n(B);const $=require("axios");var W=o.n($);const K=require("react-dom"),G=require("@mui/material/Card");var Q=o.n(G);const V=require("@mui/material/Modal");var Y=o.n(V);const Z=require("@mui/material/useMediaQuery");var J=o.n(Z);const X=require("@mui/system/Stack");var ee=o.n(X);const te=require("@mui/system/useTheme");var re=o.n(te);const ne=require("pdfjs-dist"),oe=function(e){var t={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"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,i.jsx)(I(),{title:r.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(b(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(R.A,{name:r.symbol})})})})};var ae={pdf:function(e){var t,r=(0,u.useRef)(null),n=(0,u.useState)(1),o=n[0],a=n[1],c=(0,u.useState)(1),s=c[0],d=c[1],p=(0,u.useState)(1),f=p[0],m=p[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],y=x[1],j=re()(),w=J()(j.breakpoints.down("sm")),S=J()(j.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(Q(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(A(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var O=(0,u.useState)((function(){return w?.5:S?1:1.5})),C=O[0],N=O[1];function F(t){ne.getDocument({url:e.url,httpHeaders:t}).promise.then((function(e){d(e.numPages),function(e){e.getPage(o).then((function(e){var t=e.getViewport({scale:C}),n=r.current;if(n){var o=n.getContext("2d");if(o){var a=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*a,n.height=t.height*a;var i={canvasContext:o,viewport:t,transform:[a,0,0,a,0,0]};b&&b.cancel();var c=e.render(i);y(c),c.promise.then((function(){y(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}return(0,u.useEffect)((function(){ne.GlobalWorkerOptions.workerSrc||(ne.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ne.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then((function(e){return F(e.headers)})).catch((function(){return g(!0)})):F()}),[e.url,o,C]),v?(0,i.jsx)(Q(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(A(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(Q(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(l(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(oe,{action:"zoomOut",onClick:function(){N((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(oe,{action:"zoomIn",onClick:function(){N((function(e){return e+.2}))}})]}),(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:r})})}),(0,i.jsxs)(ee(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(oe,{action:"previousPage",onClick:function(){o>1&&(a(o-1),m(o-1))},isDisabled:1===o}),(0,i.jsx)(A(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(P(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);m(t),!isNaN(t)&&t>=1&&t<=s&&a(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(A(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,i.jsx)(oe,{action:"nextPage",onClick:function(){o<s&&(a(o+1),m(o+1))},isDisabled:o===s})]})]})}};function ie(e){var t=e.supportedViewers,r=void 0===t?ae:t,n=e.showFullName,o=void 0===n||n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["supportedViewers","showFullName"]),c=(0,s.useTheme)(),l=(0,u.useState)(!1),d=l[0],p=l[1];function f(){p(!1)}var m,h,v=a.file.url&&(m=a.file.url.split("."))[m.length-1].toLowerCase(),g=v&&r?r[v]:null,x=!!g,y=x?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(o?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=o?a.file.name:(h=a.file.name).length<=15?h:h.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Q(),{className:j,variant:"outlined",sx:{boxShadow:c.shadows[1]},onClick:function(){p(!0)},children:[(0,i.jsx)(A(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:a.children})]}),x&&(0,i.jsx)(Y(),{open:d,onClose:f,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(I(),{title:"Close",children:(0,i.jsx)(b(),{onClick:f,className:"rustic-close-button",children:(0,i.jsx)(R.A,{name:"close"})})}),a.file.url&&(0,i.jsx)(g,{url:a.file.url,getAuthHeaders:a.getAuthHeaders})]})})]})}var ce=o(3110);const le=require("@mui/material"),se=require("@mui/material/Button");var ue=o.n(se);const de=require("@mui/material/Drawer");var pe=o.n(de);const fe=require("@mui/material/ListItemText");var me=o.n(fe);const he=require("@mui/material/Menu");var ve=o.n(he);const ge=require("@mui/system");var xe=function(){return xe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},xe.apply(this,arguments)};function be(e){var t=(0,u.useState)(!1),r=t[0],n=t[1],o=(0,u.useRef)(null),a=(0,s.useTheme)(),c=(0,le.useMediaQuery)(a.breakpoints.down("md")),l=c?pe():ve(),d={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(ge.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(me(),{children:(0,i.jsx)(A(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(ge.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(d=xe(xe({},d),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.shape.borderRadius,"px 0 0"),borderBottom:0}));var f=e.menuItems.map((function(e){return e.href?(0,i.jsx)(S(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(S(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var m,h,v=c?{}:{anchorEl:o.current};return(0,i.jsxs)(i.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:o,className:"rustic-popover-menu-button"},h=(0,i.jsx)(R.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(ue(),xe({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(I(),{title:e.ariaLabel,children:(0,i.jsx)(b(),xe({},m,{children:e.icon?e.icon:h}))})),(0,i.jsx)(l,xe({open:r,onClose:function(){return n(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":xe(xe({},d),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:f}))]})}var ye=function(){return ye=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ye.apply(this,arguments)},je=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};function we(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const Se=function(e){var t,r=(0,u.useState)([]),n=r[0],o=r[1],a=(0,u.useState)([]),c=a[0],s=a[1],p=(0,u.useState)({}),f=p[0],m=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();(0,u.useEffect)((function(){o([]),s([]),h.current={}}),[e.messageId]);var g=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function x(e,t,r){var n;h.current=ye(ye({},h.current),((n={})[e]=h.current[e]--,n)),function(e,t,r){s((function(t){return je(je([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)})),o((function(e){return e.filter((function(e){return e.id!==t}))}))}(e,t,r)}var y=(0,i.jsx)(l(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,i.jsx)(ie,{file:{name:t.name},showFullName:e.showFullName,children:(0,i.jsxs)(l(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,i.jsx)(H(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(I(),{title:"Delete",children:(0,i.jsx)(b(),{color:"primary",onClick:function(){return function(t,r){var n,a;s([]);var i=t.name;if(h.current=ye(ye({},h.current),((n={})[i]=h.current[i]--,n)),e.onFileUpdate("remove",i),100===t.loadingProgress){var c="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);g.then((function(t){W().delete(c,ye({},t)).then((function(){return o((function(e){return e.filter((function(e,t){return t!==r}))}))})).catch((function(){return e.onFileUpdate("add",i),s((function(e){return je(je([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)}))}))}))}else t.abortController.abort(),o((function(e){return e.filter((function(e,t){return t!==r}))})),h.current=ye(ye({},h.current),((a={})[i]=h.current[i]++,a))}(t,r)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},r)}))}),j=(0,i.jsx)(l(),{children:c.map((function(e,t){return(0,i.jsx)(A(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function w(e,t){return t?(0,K.createPortal)(e,t):e}var S=null===(t=e.uploadOptions)||void 0===t?void 0:t.map((function(t){return{label:t.label,onClick:function(){return function(t){m(t.metadata);var r=document.getElementById(v);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,i.jsx)(ce.default,{name:t.iconName})}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==S?void 0:S.length)?(0,i.jsx)(be,{ariaLabel:"Upload",icon:(0,i.jsx)(ce.default,{name:"upload_2"}),menuItems:S}):(0,i.jsx)(I(),{title:"Upload",children:(0,i.jsx)(b(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,i.jsx)("input",{type:"file",id:v,onChange:function(t){s([]);var r=t.target.files&&Array.from(t.target.files),a=n.length+(r?r.length:0);e.maxFileCount&&a>e.maxFileCount&&s((function(t){return je(je([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var i=r&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(r,a,e.maxFileCount);i&&i.forEach((function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,s((function(t){return je(je([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&we(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,a=function(e){var t,r,n=e.name,o=h.current[n];if(o){var a=o+1,i=n.lastIndexOf("."),c=n.substring(0,i),l=n.substring(i);n="".concat(c,"(").concat(o,")").concat(l),h.current=ye(ye({},h.current),((t={})[e.name]=a,t))}else h.current=ye(ye({},h.current),((r={})[e.name]=1,r));return n}(t),i=new File([t],a,{type:t.type});if(e.getUploadData||f){var c=e.getUploadData?e.getUploadData(a):{},l=ye(ye({},c),f);Object.keys(l).forEach((function(e){var t=l[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)}))}r.append("file",i);var s=(0,d.v4)(),u={name:a,loadingProgress:0,abortController:n,id:s};function p(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=u.id,o((function(e){var n=e.map((function(e){return e.id===r?ye(ye({},e),{loadingProgress:t}):e}));return n})))}o((function(e){return je(je([],e,!0),[u],!1)})),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function i(){return g.then((function(c){return W().post(m,r,ye(ye({},c),{onUploadProgress:p,signal:n.signal})).then((function(t){var n,a,i=r.get("file");t.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,t.data.url),t.data.fileId&&(n=t.data,a=u.id,o((function(e){var t=e.findIndex((function(e){return e.id===a}));if(-1!==t){var r=je([],e,!0);return r[t]=ye(ye({},r[t]),{id:n.fileId}),r}return e})))})).catch((function(n){var c,l,d=r.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,f,m,h;409===(null===(c=n.response)||void 0===c?void 0:c.status)&&e.listFiles?(p=a.lastIndexOf("."),f=a.substring(0,p),m=a.substring(p),h=new RegExp("^".concat(f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(m,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var t=0,r=0,n=e;r<n.length;r++){var o=n[r];if(h.test(o.name)){var a=o.name.match(h),i=a&&a[1]?parseInt(a[1].slice(1,-1),10):0;t=Math.max(t,i)}}return"".concat(f,"(").concat(t+1,")").concat(m)})):Promise.resolve(a)).then((function(n){e.onFileUpdate("add",n);var a=new File([t],n,{type:t.type});r.set("file",a),o((function(e){return e.map((function(e){return e.id===s?ye(ye({},e),{name:n,loadingProgress:0}):e}))})),i()})).catch((function(){var e;x(t.name,u.id,null===(e=n.response)||void 0===e?void 0:e.data)})):x(t.name,u.id,null===(l=n.response)||void 0===l?void 0:l.data)}))}))}()}(t)}(t)})),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&w(j,e.errorMessagesContainer),n.length>0&&w(y,e.filePreviewsContainer)]})};var Oe,Ce,Ne=function(){return Ne=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ne.apply(this,arguments)},Fe=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};!function(e){e.Owner="owner",e.Member="member"}(Oe||(Oe={})),function(e){e.Human="human",e.Agent="agent"}(Ce||(Ce={}));const ke=function(e){var t=e.maxFileSize,r=void 0===t?2097152:t,n=e.maxFileCount,o=void 0===n?1:n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["maxFileSize","maxFileCount"]),c=(0,u.useState)({uploaded:[],fileList:[]}),p=c[0],m=c[1],h=(0,u.useState)((0,d.v4)()),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],y=x[1],j=(0,u.useState)(),w=j[0],S=j[1],O=(0,u.useRef)(null),C=(0,s.useTheme)(),N=p.uploaded.length===p.fileList.length&&p.uploaded.length>0;return(0,u.useEffect)((function(){O.current&&(S(O.current.querySelector(".rustic-error-container")),y(O.current.querySelector(".rustic-input-extras")))})),(0,i.jsx)(l(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(C.palette.action.disabled),borderRadius:"".concat(C.shape.borderRadius,"px"),":focus-within":{borderColor:C.palette.secondary.main},background:C.palette.background.paper},children:(0,i.jsx)(M,Ne({},a,{send:function(e){N&&(e.id=v,e.format="chatCompletionRequest",e.data=f(e.data.text,p.uploaded.map((function(e){return{url:e.url,name:e.name}})))),a.ws.send(e),g((0,d.v4)()),m({uploaded:[],fileList:[]})},isSendEnabled:N,ref:O,children:(0,i.jsx)(l(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(Se,{acceptedFileTypes:a.acceptedFileTypes,maxFileCount:o,maxFileSize:r,uploadFileEndpoint:a.uploadFileEndpoint,deleteFileEndpoint:a.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)m((function(e){return Ne(Ne({},e),{fileList:Fe(Fe([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");m((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),o=Fe(Fe(Fe([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Ne(Ne({},e),{uploaded:o})}))}else m((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:v,filePreviewsContainer:b,errorMessagesContainer:w,showFullName:a.showFullName,getUploadData:a.getUploadData,uploadOptions:a.uploadOptions,listFiles:a.listFiles,getUploadHeaders:a.getUploadHeaders})})}))})};return a})()));
|
|
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,t,r={9767:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(8732),o=(r(2015),function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:o({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var a=Object.create(null);o.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var c=2&n&&r;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((e=>i[e]=()=>r[e]));return i.default=()=>r,o.d(a,i),a},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};o.r(a),o.d(a,{ParticipantRole:()=>Se,ParticipantType:()=>Oe,default:()=>Fe});var i=o(8732);const c=require("@mui/material/Box");var l=o.n(c);const s=require("@mui/material/styles");var u=o(2015);const d=require("uuid");var p;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const f=require("@mui/material/Avatar");var m=o.n(f);const h=require("@mui/material/CircularProgress");var v=o.n(h);const g=require("@mui/material/IconButton");var x=o.n(g);const b=require("@mui/material/InputAdornment");var y=o.n(b);const j=require("@mui/material/MenuItem");var w=o.n(j);const S=require("@mui/material/MenuList");var O=o.n(S);const N=require("@mui/material/Popover");var C=o.n(N);const F=require("@mui/material/TextField");var k=o.n(F);const P=require("@mui/material/Tooltip");var E=o.n(P);const I=require("@mui/material/Typography");var q=o.n(I),A=o(8342),T=o(9767);const R=function(e){var t=(0,s.useTheme)(),r=(0,u.useRef)(null),n=(0,u.useRef)(null),a=(0,u.useState)(!1),c=a[0],l=a[1],d={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function p(){l(!1)}function f(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),p()}return(0,u.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(r){var o=new(0,r.Picker)({dataSource:e.dataSource}),a="dark"===t.palette.mode?"dark":"light";o.classList.add(a),Object.keys(d).forEach((function(e){o.style.setProperty(e,d[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",f),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",f)}}),[c,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(E(),{title:"Emoji",children:(0,i.jsx)(x(),{size:"small",ref:r,onClick:function(){l((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:"Mood"})})}),n.current&&(0,i.jsx)(C(),{open:c,anchorEl:r.current,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,i.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var D={"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 L(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function U(e){return(0,i.jsxs)(l(),{className:"rustic-participant-profile",children:[(0,i.jsx)(m(),{src:e.icon,className:"rustic-participant-avatar"}),(0,i.jsx)(q(),{variant:"body1Bold",children:e.displayName})]})}function _(e){var t=e.items,r=e.isOpen,n=e.onClose,o=e.onSelect,a=e.renderItem,c=e.anchorEl,l=e.selectedIndex;return(0,i.jsx)(C(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,i.jsx)(O(),{children:t.map((function(e,t){return(0,i.jsx)(w(),{onClick:function(){return o(e)},selected:t===l,children:a(e)},t)}))})})}const z=(0,u.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,o=e.fullWidth,a=void 0===o||o,c=e.maxRows,s=void 0===c?6:c,p=e.enableSpeechToText,f=void 0!==p&&p,m=e.maximumEmojiSearchResults,h=void 0===m?5:m,g=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,u.useState)(""),j=b[0],w=b[1],S=(0,u.useState)(!1),O=S[0],N=S[1],C=(0,u.useState)(!1),F=C[0],P=C[1],I=(0,u.useState)(!1),z=I[0],M=I[1],B=(0,u.useState)(""),H=B[0],$=B[1],W=(0,u.useState)([]),K=W[0],G=W[1],Q=(0,u.useState)(!1),V=Q[0],Y=Q[1],Z=(0,u.useState)(0),J=Z[0],X=Z[1],ee=(0,u.useRef)(null),te=new A.Database({dataSource:g.emojiDataSource}),re=!j.trim().length,ne="".concat(O?"Stop":"Start"," speech to text"),oe=F?"primary.main":"primary.light",ae=O?"error.main":oe,ie=O?"stop_circle":"speech_to_text",ce=(0,u.useState)([]),le=ce[0],se=ce[1],ue=(0,u.useState)(!1),de=ue[0],pe=ue[1];function fe(){return"boolean"==typeof g.isSendEnabled?!g.isSendEnabled:re}function me(e,t){if(ee.current){var r=ee.current,n=r.selectionStart,o=r.selectionEnd;if("number"==typeof n&&"number"==typeof o){var a,i=j||"",c=i.substring(0,n),l=i.substring(o),s=void 0;t?(s=c.replace(t,e)+l,a=c.replace(t,e).length):(s=c+e+l,a=n+e.length),w(s),setTimeout((function(){var e,t;null===(e=ee.current)||void 0===e||e.focus(),null===(t=ee.current)||void 0===t||t.setSelectionRange(a,a)}),0)}}}function he(e){me("@".concat(e," "),/@(\w*)$/),se([])}function ve(e,t){void 0===t&&(t=!1),me(e,t?/:(\w+)$/:void 0),Y(!1)}var ge=z?(0,i.jsx)(v(),{size:24}):(0,i.jsx)(E(),{title:ne,children:(0,i.jsx)(x(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,O?(e.stop(),M(!0),N(!1)):(e.start(),$(""),N(!0)),e.onstart=function(){N(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;j.length>0?w(j+" "+r):w(r),null===(t=ee.current)||void 0===t||t.focus(),N(!1)},e.onerror=function(e){var t=D[e.error];$(t),N(!1)},e.onend=function(){M(!1),N(!1)}},size:"small",sx:{color:ae,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:ie})})});function xe(){var e=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:e,sender:g.sender,conversationId:g.conversationId,format:"chatCompletionRequest",data:{text:j}};g.send(t),w(""),$("")}return(0,i.jsxs)(l(),{className:"rustic-base-input",ref:t,children:[(0,i.jsxs)(l(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(l(),{className:"rustic-error-container",children:(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:H})}),(0,i.jsxs)(l(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:F?"secondary.main":"action.disabled"},children:[K.length>0&&ee.current&&(0,i.jsx)(_,{anchorEl:ee.current,items:K.filter((function(e){return"unicode"in e})),isOpen:V,onClose:function(){Y(!1),X(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:J,renderItem:L}),le.length>0&&ee.current&&(0,i.jsx)(_,{anchorEl:ee.current,items:le,isOpen:de,onClose:function(){pe(!1),X(0)},onSelect:function(e){return he(e.displayName)},renderItem:U,selectedIndex:J}),(0,i.jsx)(k(),{className:"rustic-text-field",variant:"outlined",value:j,label:g.label,placeholder:g.placeholder,maxRows:s,multiline:n,fullWidth:a,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),V&&K.length>0&&"unicode"in K[J]?ve(K[J].unicode,!0):de&&le.length>0?he(le[J].displayName):e.shiftKey||fe()||xe();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(V?X((function(e){return(e+t+K.length)%K.length})):de&&X((function(e){return(e+t+le.length)%le.length})));0!==J&&X(0)}},onChange:function(e){$("");var t=e.target.value;w(t),function(e){var t=e.match(/@(\w*)$/);if(t&&g.getMembers){var r=t[1].toLowerCase();g.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));se(t),t.length>0?pe(!0):pe(!1)}))}else se([])}(t);var r,n=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(n){var a=n[0].replace(/:/g,"");te.getEmojiByShortcode(a).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);w(r)}else w(t)})).catch((function(){w(t)})),Y(!1)}else o?(r=o[0].replace(":",""),te.getEmojiBySearchQuery(r).then((function(e){e.length?(G(e.slice(0,h)),Y(!0)):(G([]),Y(!1))})).catch((function(){G([]),Y(!1)}))):Y(!1)},onFocus:function(){return P(!0)},onBlur:function(){return P(!1)},inputRef:ee,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,i.jsxs)(y(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(R,{dataSource:g.emojiDataSource,onEmojiClick:ve,buttonColor:oe}),f&&ge]})},inputLabel:{className:F?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(l(),{className:"rustic-input-actions",children:[g.children,(0,i.jsx)(E(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(x(),{"aria-label":"send message",onClick:xe,disabled:fe(),color:"secondary",children:(0,i.jsx)(T.A,{name:"send"})})})})]})]})})),M=require("@mui/material/LinearProgress");var B=o.n(M);const H=require("axios");var $=o.n(H);const W=require("react-dom"),K=require("@mui/material/Card");var G=o.n(K);const Q=require("@mui/material/Modal");var V=o.n(Q);const Y=require("@mui/material/useMediaQuery");var Z=o.n(Y);const J=require("@mui/system/Stack");var X=o.n(J);const ee=require("@mui/system/useTheme");var te=o.n(ee);const re=require("pdfjs-dist"),ne=function(e){var t={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"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,i.jsx)(E(),{title:r.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(x(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(T.A,{name:r.symbol})})})})};var oe={pdf:function(e){var t,r=(0,u.useRef)(null),n=(0,u.useState)(1),o=n[0],a=n[1],c=(0,u.useState)(1),s=c[0],d=c[1],p=(0,u.useState)(1),f=p[0],m=p[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],y=x[1],j=te()(),w=Z()(j.breakpoints.down("sm")),S=Z()(j.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(G(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var O=(0,u.useState)((function(){return w?.5:S?1:1.5})),N=O[0],C=O[1];function F(t){re.getDocument({url:e.url,httpHeaders:t}).promise.then((function(e){d(e.numPages),function(e){e.getPage(o).then((function(e){var t=e.getViewport({scale:N}),n=r.current;if(n){var o=n.getContext("2d");if(o){var a=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*a,n.height=t.height*a;var i={canvasContext:o,viewport:t,transform:[a,0,0,a,0,0]};b&&b.cancel();var c=e.render(i);y(c),c.promise.then((function(){y(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}return(0,u.useEffect)((function(){re.GlobalWorkerOptions.workerSrc||(re.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(re.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then((function(e){return F(e.headers)})).catch((function(){return g(!0)})):F()}),[e.url,o,N]),v?(0,i.jsx)(G(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(G(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(l(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(ne,{action:"zoomOut",onClick:function(){C((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(ne,{action:"zoomIn",onClick:function(){C((function(e){return e+.2}))}})]}),(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:r})})}),(0,i.jsxs)(X(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(ne,{action:"previousPage",onClick:function(){o>1&&(a(o-1),m(o-1))},isDisabled:1===o}),(0,i.jsx)(q(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(k(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);m(t),!isNaN(t)&&t>=1&&t<=s&&a(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(q(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,i.jsx)(ne,{action:"nextPage",onClick:function(){o<s&&(a(o+1),m(o+1))},isDisabled:o===s})]})]})}};function ae(e){var t=e.supportedViewers,r=void 0===t?oe:t,n=e.showFullName,o=void 0===n||n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["supportedViewers","showFullName"]),c=(0,s.useTheme)(),l=(0,u.useState)(!1),d=l[0],p=l[1];function f(){p(!1)}var m,h,v=a.file.url&&(m=a.file.url.split("."))[m.length-1].toLowerCase(),g=v&&r?r[v]:null,b=!!g,y=b?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(o?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=o?a.file.name:(h=a.file.name).length<=15?h:h.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(G(),{className:j,variant:"outlined",sx:{boxShadow:c.shadows[1]},onClick:function(){p(!0)},children:[(0,i.jsx)(q(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:a.children})]}),b&&(0,i.jsx)(V(),{open:d,onClose:f,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(E(),{title:"Close",children:(0,i.jsx)(x(),{onClick:f,className:"rustic-close-button",children:(0,i.jsx)(T.A,{name:"close"})})}),a.file.url&&(0,i.jsx)(g,{url:a.file.url,getAuthHeaders:a.getAuthHeaders})]})})]})}var ie=o(3110);const ce=require("@mui/material"),le=require("@mui/material/Button");var se=o.n(le);const ue=require("@mui/material/Drawer");var de=o.n(ue);const pe=require("@mui/material/ListItemText");var fe=o.n(pe);const me=require("@mui/material/Menu");var he=o.n(me);const ve=require("@mui/system");var ge=function(){return ge=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ge.apply(this,arguments)};function xe(e){var t=(0,u.useState)(!1),r=t[0],n=t[1],o=(0,u.useRef)(null),a=(0,s.useTheme)(),c=(0,ce.useMediaQuery)(a.breakpoints.down("md")),l=c?de():he(),d={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(ve.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(fe(),{children:(0,i.jsx)(q(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(ve.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(d=ge(ge({},d),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.shape.borderRadius,"px 0 0"),borderBottom:0}));var f=e.menuItems.map((function(e){return e.href?(0,i.jsx)(w(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(w(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var m,h,v=c?{}:{anchorEl:o.current};return(0,i.jsxs)(i.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:o,className:"rustic-popover-menu-button"},h=(0,i.jsx)(T.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(se(),ge({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(E(),{title:e.ariaLabel,children:(0,i.jsx)(x(),ge({},m,{children:e.icon?e.icon:h}))})),(0,i.jsx)(l,ge({open:r,onClose:function(){return n(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":ge(ge({},d),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:f}))]})}var be=function(){return be=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},be.apply(this,arguments)},ye=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};function je(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const we=function(e){var t,r=(0,u.useState)([]),n=r[0],o=r[1],a=(0,u.useState)([]),c=a[0],s=a[1],p=(0,u.useState)({}),f=p[0],m=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();(0,u.useEffect)((function(){o([]),s([]),h.current={}}),[e.messageId]);var g=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function b(e,t,r){var n;h.current=be(be({},h.current),((n={})[e]=h.current[e]--,n)),function(e,t,r){s((function(t){return ye(ye([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)})),o((function(e){return e.filter((function(e){return e.id!==t}))}))}(e,t,r)}var y=(0,i.jsx)(l(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,i.jsx)(ae,{file:{name:t.name},showFullName:e.showFullName,children:(0,i.jsxs)(l(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,i.jsx)(B(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(E(),{title:"Delete",children:(0,i.jsx)(x(),{color:"primary",onClick:function(){return function(t,r){var n,a;s([]);var i=t.name;if(h.current=be(be({},h.current),((n={})[i]=h.current[i]--,n)),e.onFileUpdate("remove",i),100===t.loadingProgress){var c="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);g.then((function(t){$().delete(c,be({},t)).then((function(){return o((function(e){return e.filter((function(e,t){return t!==r}))}))})).catch((function(){return e.onFileUpdate("add",i),s((function(e){return ye(ye([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)}))}))}))}else t.abortController.abort(),o((function(e){return e.filter((function(e,t){return t!==r}))})),h.current=be(be({},h.current),((a={})[i]=h.current[i]++,a))}(t,r)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},r)}))}),j=(0,i.jsx)(l(),{children:c.map((function(e,t){return(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function w(e,t){return t?(0,W.createPortal)(e,t):e}var S=null===(t=e.uploadOptions)||void 0===t?void 0:t.map((function(t){return{label:t.label,onClick:function(){return function(t){m(t.metadata);var r=document.getElementById(v);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,i.jsx)(ie.default,{name:t.iconName})}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==S?void 0:S.length)?(0,i.jsx)(xe,{ariaLabel:"Upload",icon:(0,i.jsx)(ie.default,{name:"upload_2"}),menuItems:S}):(0,i.jsx)(E(),{title:"Upload",children:(0,i.jsx)(x(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,i.jsx)("input",{type:"file",id:v,onChange:function(t){s([]);var r=t.target.files&&Array.from(t.target.files),a=n.length+(r?r.length:0);e.maxFileCount&&a>e.maxFileCount&&s((function(t){return ye(ye([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var i=r&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(r,a,e.maxFileCount);i&&i.forEach((function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,s((function(t){return ye(ye([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&je(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,a=function(e){var t,r,n=e.name,o=h.current[n];if(o){var a=o+1,i=n.lastIndexOf("."),c=n.substring(0,i),l=n.substring(i);n="".concat(c,"(").concat(o,")").concat(l),h.current=be(be({},h.current),((t={})[e.name]=a,t))}else h.current=be(be({},h.current),((r={})[e.name]=1,r));return n}(t),i=new File([t],a,{type:t.type});if(e.getUploadData||f){var c=e.getUploadData?e.getUploadData(a):{},l=be(be({},c),f);Object.keys(l).forEach((function(e){var t=l[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)}))}r.append("file",i);var s=(0,d.v4)(),u={name:a,loadingProgress:0,abortController:n,id:s};function p(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=u.id,o((function(e){var n=e.map((function(e){return e.id===r?be(be({},e),{loadingProgress:t}):e}));return n})))}o((function(e){return ye(ye([],e,!0),[u],!1)})),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function i(){return g.then((function(c){return $().post(m,r,be(be({},c),{onUploadProgress:p,signal:n.signal})).then((function(t){var n,a,i=r.get("file");t.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,t.data.url),t.data.fileId&&(n=t.data,a=u.id,o((function(e){var t=e.findIndex((function(e){return e.id===a}));if(-1!==t){var r=ye([],e,!0);return r[t]=be(be({},r[t]),{id:n.fileId}),r}return e})))})).catch((function(n){var c,l,d=r.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,f,m,h;409===(null===(c=n.response)||void 0===c?void 0:c.status)&&e.listFiles?(p=a.lastIndexOf("."),f=a.substring(0,p),m=a.substring(p),h=new RegExp("^".concat(f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(m,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var t=0,r=0,n=e;r<n.length;r++){var o=n[r];if(h.test(o.name)){var a=o.name.match(h),i=a&&a[1]?parseInt(a[1].slice(1,-1),10):0;t=Math.max(t,i)}}return"".concat(f,"(").concat(t+1,")").concat(m)})):Promise.resolve(a)).then((function(n){e.onFileUpdate("add",n);var a=new File([t],n,{type:t.type});r.set("file",a),o((function(e){return e.map((function(e){return e.id===s?be(be({},e),{name:n,loadingProgress:0}):e}))})),i()})).catch((function(){var e;b(t.name,u.id,null===(e=n.response)||void 0===e?void 0:e.data)})):b(t.name,u.id,null===(l=n.response)||void 0===l?void 0:l.data)}))}))}()}(t)}(t)})),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&w(j,e.errorMessagesContainer),n.length>0&&w(y,e.filePreviewsContainer)]})};var Se,Oe,Ne=function(){return Ne=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ne.apply(this,arguments)},Ce=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};!function(e){e.Owner="owner",e.Member="member"}(Se||(Se={})),function(e){e.Human="human",e.Agent="agent"}(Oe||(Oe={}));const Fe=function(e){var t=e.maxFileSize,r=void 0===t?2097152:t,n=e.maxFileCount,o=void 0===n?1:n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["maxFileSize","maxFileCount"]),c=(0,u.useState)({uploaded:[],fileList:[]}),p=c[0],f=c[1],m=(0,u.useState)((0,d.v4)()),h=m[0],v=m[1],g=(0,u.useState)(),x=g[0],b=g[1],y=(0,u.useState)(),j=y[0],w=y[1],S=(0,u.useRef)(null),O=(0,s.useTheme)(),N=p.fileList.length>0,C=p.uploaded.length===p.fileList.length&&p.uploaded.length>0;return(0,u.useEffect)((function(){S.current&&(w(S.current.querySelector(".rustic-error-container")),b(S.current.querySelector(".rustic-input-extras")))})),(0,i.jsx)(l(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(O.palette.action.disabled),borderRadius:"".concat(O.shape.borderRadius,"px"),":focus-within":{borderColor:O.palette.secondary.main},background:O.palette.background.paper},children:(0,i.jsx)(z,Ne({},a,{send:function(e){e.data=function(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}(e.data.text,p.uploaded.map((function(e){return{url:e.url,name:e.name}}))),e.id=h,a.ws.send(e),v((0,d.v4)()),f({uploaded:[],fileList:[]})},isSendEnabled:N?C:void 0,ref:S,children:(0,i.jsx)(l(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(we,{acceptedFileTypes:a.acceptedFileTypes,maxFileCount:o,maxFileSize:r,uploadFileEndpoint:a.uploadFileEndpoint,deleteFileEndpoint:a.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)f((function(e){return Ne(Ne({},e),{fileList:Ce(Ce([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");f((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),o=Ce(Ce(Ce([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Ne(Ne({},e),{uploaded:o})}))}else f((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:h,filePreviewsContainer:x,errorMessagesContainer:j,showFullName:a.showFullName,getUploadData:a.getUploadData,uploadOptions:a.uploadOptions,listFiles:a.listFiles,getUploadHeaders:a.getUploadHeaders})})}))})};return a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAM7E;;;;;;;;;;;;;;;EAeE;AACF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,WAAmB,EACnB,YAAgB,EAChB,GAAG,KAAK,EACT,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAM7E;;;;;;;;;;;;;;;EAeE;AACF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,WAAmB,EACnB,YAAgB,EAChB,GAAG,KAAK,EACT,EAAE,oBAAoB,2CA+HtB"}
|
|
@@ -1 +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,t,r={8342:e=>{e.exports=require("emoji-picker-element")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var i=Object.create(null);o.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&n&&r;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>r[e]));return a.default=()=>r,o.d(i,a),i},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{ParticipantRole:()=>W,ParticipantType:()=>K,default:()=>$});const a=require("react/jsx-runtime"),c=require("react"),s=require("@mui/material/Avatar");var u=o.n(s);const l=require("@mui/material/Box");var d=o.n(l);const p=require("@mui/material/CircularProgress");var m=o.n(p);const f=require("@mui/material/IconButton");var h=o.n(f);const v=require("@mui/material/InputAdornment");var g=o.n(v);const y=require("@mui/material/MenuItem");var b=o.n(y);const j=require("@mui/material/MenuList");var x=o.n(j);const O=require("@mui/material/Popover");var w=o.n(O);const S=require("@mui/material/TextField");var k=o.n(S);const E=require("@mui/material/Tooltip");var C=o.n(E);const N=require("@mui/material/Typography");var P=o.n(N),T=o(8342);const q=require("uuid");var _;function R(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(_||(_={}));var I=function(){return I=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},I.apply(this,arguments)};function M(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:I({},t),children:e.name})}const A=require("@mui/material/styles"),D=function(e){var t=(0,A.useTheme)(),r=(0,c.useRef)(null),n=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function d(){u(!1)}function p(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),d()}return(0,c.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(r){var o=new(0,r.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";o.classList.add(i),Object.keys(l).forEach((function(e){o.style.setProperty(e,l[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,c.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",p),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(C(),{title:"Emoji",children:(0,a.jsx)(h(),{size:"small",ref:r,onClick:function(){u((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:"Mood"})})}),n.current&&(0,a.jsx)(w(),{open:s,anchorEl:r.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var z={"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 L(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function B(e){return(0,a.jsxs)(d(),{className:"rustic-participant-profile",children:[(0,a.jsx)(u(),{src:e.icon,className:"rustic-participant-avatar"}),(0,a.jsx)(P(),{variant:"body1Bold",children:e.displayName})]})}function F(e){var t=e.items,r=e.isOpen,n=e.onClose,o=e.onSelect,i=e.renderItem,c=e.anchorEl,s=e.selectedIndex;return(0,a.jsx)(w(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,a.jsx)(x(),{children:t.map((function(e,t){return(0,a.jsx)(b(),{onClick:function(){return o(e)},selected:t===s,children:i(e)},t)}))})})}const H=(0,c.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,o=e.fullWidth,i=void 0===o||o,s=e.maxRows,u=void 0===s?6:s,l=e.enableSpeechToText,p=void 0!==l&&l,f=e.maximumEmojiSearchResults,v=void 0===f?5:f,y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,c.useState)(""),j=b[0],x=b[1],O=(0,c.useState)(!1),w=O[0],S=O[1],E=(0,c.useState)(!1),N=E[0],_=E[1],I=(0,c.useState)(!1),A=I[0],H=I[1],W=(0,c.useState)(""),K=W[0],U=W[1],$=(0,c.useState)([]),Q=$[0],G=$[1],J=(0,c.useState)(!1),V=J[0],X=J[1],Y=(0,c.useState)(0),Z=Y[0],ee=Y[1],te=(0,c.useRef)(null),re=new T.Database({dataSource:y.emojiDataSource}),ne=!j.trim().length&&!y.isSendEnabled,oe="".concat(w?"Stop":"Start"," speech to text"),ie=N?"primary.main":"primary.light",ae=w?"error.main":ie,ce=w?"stop_circle":"speech_to_text",se=(0,c.useState)([]),ue=se[0],le=se[1],de=(0,c.useState)(!1),pe=de[0],me=de[1];function fe(e,t){if(te.current){var r=te.current,n=r.selectionStart,o=r.selectionEnd;if("number"==typeof n&&"number"==typeof o){var i,a=j||"",c=a.substring(0,n),s=a.substring(o),u=void 0;t?(u=c.replace(t,e)+s,i=c.replace(t,e).length):(u=c+e+s,i=n+e.length),x(u),setTimeout((function(){var e,t;null===(e=te.current)||void 0===e||e.focus(),null===(t=te.current)||void 0===t||t.setSelectionRange(i,i)}),0)}}}function he(e){fe("@".concat(e," "),/@(\w*)$/),le([])}function ve(e,t){void 0===t&&(t=!1),fe(e,t?/:(\w+)$/:void 0),X(!1)}var ge=A?(0,a.jsx)(m(),{size:24}):(0,a.jsx)(C(),{title:oe,children:(0,a.jsx)(h(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,w?(e.stop(),H(!0),S(!1)):(e.start(),U(""),S(!0)),e.onstart=function(){S(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;j.length>0?x(j+" "+r):x(r),null===(t=te.current)||void 0===t||t.focus(),S(!1)},e.onerror=function(e){var t=z[e.error];U(t),S(!1)},e.onend=function(){H(!1),S(!1)}},size:"small",sx:{color:ae,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:ce})})});function ye(){var e=(new Date).toISOString(),t={id:(0,q.v4)(),timestamp:e,sender:y.sender,conversationId:y.conversationId,format:"chatCompletionRequest",data:R(j)};y.send(t),x(""),U("")}return(0,a.jsxs)(d(),{className:"rustic-base-input",ref:t,children:[(0,a.jsxs)(d(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(d(),{className:"rustic-error-container",children:(0,a.jsx)(P(),{variant:"caption",color:"error",className:"rustic-error-message",children:K})}),(0,a.jsxs)(d(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:N?"secondary.main":"action.disabled"},children:[Q.length>0&&te.current&&(0,a.jsx)(F,{anchorEl:te.current,items:Q.filter((function(e){return"unicode"in e})),isOpen:V,onClose:function(){X(!1),ee(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:Z,renderItem:L}),ue.length>0&&te.current&&(0,a.jsx)(F,{anchorEl:te.current,items:ue,isOpen:pe,onClose:function(){me(!1),ee(0)},onSelect:function(e){return he(e.displayName)},renderItem:B,selectedIndex:Z}),(0,a.jsx)(k(),{className:"rustic-text-field",variant:"outlined",value:j,label:y.label,placeholder:y.placeholder,maxRows:u,multiline:n,fullWidth:i,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),V&&Q.length>0&&"unicode"in Q[Z]?ve(Q[Z].unicode,!0):pe&&ue.length>0?he(ue[Z].displayName):e.shiftKey||ne||ye();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(V?ee((function(e){return(e+t+Q.length)%Q.length})):pe&&ee((function(e){return(e+t+ue.length)%ue.length})));0!==Z&&ee(0)}},onChange:function(e){U("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&y.getMembers){var r=t[1].toLowerCase();y.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));le(t),t.length>0?me(!0):me(!1)}))}else le([])}(t);var r,n=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(n){var i=n[0].replace(/:/g,"");re.getEmojiByShortcode(i).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);x(r)}else x(t)})).catch((function(){x(t)})),X(!1)}else o?(r=o[0].replace(":",""),re.getEmojiBySearchQuery(r).then((function(e){e.length?(G(e.slice(0,v)),X(!0)):(G([]),X(!1))})).catch((function(){G([]),X(!1)}))):X(!1)},onFocus:function(){return _(!0)},onBlur:function(){return _(!1)},inputRef:te,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,a.jsxs)(g(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(D,{dataSource:y.emojiDataSource,onEmojiClick:ve,buttonColor:ie}),p&&ge]})},inputLabel:{className:N?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(d(),{className:"rustic-input-actions",children:[y.children,(0,a.jsx)(C(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(h(),{"aria-label":"send message",onClick:ye,disabled:ne,color:"secondary",children:(0,a.jsx)(M,{name:"send"})})})})]})]})}));var W,K,U=function(){return U=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},U.apply(this,arguments)};!function(e){e.Owner="owner",e.Member="member"}(W||(W={})),function(e){e.Human="human",e.Agent="agent"}(K||(K={}));const $=function(e){var t=e.ws,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["ws"]);return(0,a.jsx)(H,U({},r,{send:function(e){t.send(e)}}))};return i})()));
|
|
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,t,r={8342:e=>{e.exports=require("emoji-picker-element")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var i=Object.create(null);o.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&n&&r;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>r[e]));return a.default=()=>r,o.d(i,a),i},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{ParticipantRole:()=>H,ParticipantType:()=>W,default:()=>U});const a=require("react/jsx-runtime"),c=require("react");var s;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(s||(s={}));const u=require("@mui/material/Avatar");var l=o.n(u);const d=require("@mui/material/Box");var p=o.n(d);const m=require("@mui/material/CircularProgress");var f=o.n(m);const h=require("@mui/material/IconButton");var v=o.n(h);const y=require("@mui/material/InputAdornment");var g=o.n(y);const b=require("@mui/material/MenuItem");var j=o.n(b);const x=require("@mui/material/MenuList");var O=o.n(x);const w=require("@mui/material/Popover");var S=o.n(w);const k=require("@mui/material/TextField");var E=o.n(k);const C=require("@mui/material/Tooltip");var N=o.n(C);const P=require("@mui/material/Typography");var T=o.n(P),q=o(8342);const R=require("uuid");var _=function(){return _=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function I(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:_({},t),children:e.name})}const M=require("@mui/material/styles"),A=function(e){var t=(0,M.useTheme)(),r=(0,c.useRef)(null),n=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function d(){u(!1)}function p(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),d()}return(0,c.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(r){var o=new(0,r.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";o.classList.add(i),Object.keys(l).forEach((function(e){o.style.setProperty(e,l[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,c.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",p),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(N(),{title:"Emoji",children:(0,a.jsx)(v(),{size:"small",ref:r,onClick:function(){u((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(I,{name:"Mood"})})}),n.current&&(0,a.jsx)(S(),{open:s,anchorEl:r.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var D={"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 z(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function L(e){return(0,a.jsxs)(p(),{className:"rustic-participant-profile",children:[(0,a.jsx)(l(),{src:e.icon,className:"rustic-participant-avatar"}),(0,a.jsx)(T(),{variant:"body1Bold",children:e.displayName})]})}function B(e){var t=e.items,r=e.isOpen,n=e.onClose,o=e.onSelect,i=e.renderItem,c=e.anchorEl,s=e.selectedIndex;return(0,a.jsx)(S(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,a.jsx)(O(),{children:t.map((function(e,t){return(0,a.jsx)(j(),{onClick:function(){return o(e)},selected:t===s,children:i(e)},t)}))})})}const F=(0,c.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,o=e.fullWidth,i=void 0===o||o,s=e.maxRows,u=void 0===s?6:s,l=e.enableSpeechToText,d=void 0!==l&&l,m=e.maximumEmojiSearchResults,h=void 0===m?5:m,y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,c.useState)(""),j=b[0],x=b[1],O=(0,c.useState)(!1),w=O[0],S=O[1],k=(0,c.useState)(!1),C=k[0],P=k[1],_=(0,c.useState)(!1),M=_[0],F=_[1],H=(0,c.useState)(""),W=H[0],K=H[1],U=(0,c.useState)([]),$=U[0],Q=U[1],G=(0,c.useState)(!1),J=G[0],V=G[1],X=(0,c.useState)(0),Y=X[0],Z=X[1],ee=(0,c.useRef)(null),te=new q.Database({dataSource:y.emojiDataSource}),re=!j.trim().length,ne="".concat(w?"Stop":"Start"," speech to text"),oe=C?"primary.main":"primary.light",ie=w?"error.main":oe,ae=w?"stop_circle":"speech_to_text",ce=(0,c.useState)([]),se=ce[0],ue=ce[1],le=(0,c.useState)(!1),de=le[0],pe=le[1];function me(){return"boolean"==typeof y.isSendEnabled?!y.isSendEnabled:re}function fe(e,t){if(ee.current){var r=ee.current,n=r.selectionStart,o=r.selectionEnd;if("number"==typeof n&&"number"==typeof o){var i,a=j||"",c=a.substring(0,n),s=a.substring(o),u=void 0;t?(u=c.replace(t,e)+s,i=c.replace(t,e).length):(u=c+e+s,i=n+e.length),x(u),setTimeout((function(){var e,t;null===(e=ee.current)||void 0===e||e.focus(),null===(t=ee.current)||void 0===t||t.setSelectionRange(i,i)}),0)}}}function he(e){fe("@".concat(e," "),/@(\w*)$/),ue([])}function ve(e,t){void 0===t&&(t=!1),fe(e,t?/:(\w+)$/:void 0),V(!1)}var ye=M?(0,a.jsx)(f(),{size:24}):(0,a.jsx)(N(),{title:ne,children:(0,a.jsx)(v(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,w?(e.stop(),F(!0),S(!1)):(e.start(),K(""),S(!0)),e.onstart=function(){S(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;j.length>0?x(j+" "+r):x(r),null===(t=ee.current)||void 0===t||t.focus(),S(!1)},e.onerror=function(e){var t=D[e.error];K(t),S(!1)},e.onend=function(){F(!1),S(!1)}},size:"small",sx:{color:ie,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(I,{name:ae})})});function ge(){var e=(new Date).toISOString(),t={id:(0,R.v4)(),timestamp:e,sender:y.sender,conversationId:y.conversationId,format:"chatCompletionRequest",data:{text:j}};y.send(t),x(""),K("")}return(0,a.jsxs)(p(),{className:"rustic-base-input",ref:t,children:[(0,a.jsxs)(p(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(p(),{className:"rustic-error-container",children:(0,a.jsx)(T(),{variant:"caption",color:"error",className:"rustic-error-message",children:W})}),(0,a.jsxs)(p(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:C?"secondary.main":"action.disabled"},children:[$.length>0&&ee.current&&(0,a.jsx)(B,{anchorEl:ee.current,items:$.filter((function(e){return"unicode"in e})),isOpen:J,onClose:function(){V(!1),Z(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:Y,renderItem:z}),se.length>0&&ee.current&&(0,a.jsx)(B,{anchorEl:ee.current,items:se,isOpen:de,onClose:function(){pe(!1),Z(0)},onSelect:function(e){return he(e.displayName)},renderItem:L,selectedIndex:Y}),(0,a.jsx)(E(),{className:"rustic-text-field",variant:"outlined",value:j,label:y.label,placeholder:y.placeholder,maxRows:u,multiline:n,fullWidth:i,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),J&&$.length>0&&"unicode"in $[Y]?ve($[Y].unicode,!0):de&&se.length>0?he(se[Y].displayName):e.shiftKey||me()||ge();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(J?Z((function(e){return(e+t+$.length)%$.length})):de&&Z((function(e){return(e+t+se.length)%se.length})));0!==Y&&Z(0)}},onChange:function(e){K("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&y.getMembers){var r=t[1].toLowerCase();y.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));ue(t),t.length>0?pe(!0):pe(!1)}))}else ue([])}(t);var r,n=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(n){var i=n[0].replace(/:/g,"");te.getEmojiByShortcode(i).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);x(r)}else x(t)})).catch((function(){x(t)})),V(!1)}else o?(r=o[0].replace(":",""),te.getEmojiBySearchQuery(r).then((function(e){e.length?(Q(e.slice(0,h)),V(!0)):(Q([]),V(!1))})).catch((function(){Q([]),V(!1)}))):V(!1)},onFocus:function(){return P(!0)},onBlur:function(){return P(!1)},inputRef:ee,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,a.jsxs)(g(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(A,{dataSource:y.emojiDataSource,onEmojiClick:ve,buttonColor:oe}),d&&ye]})},inputLabel:{className:C?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(p(),{className:"rustic-input-actions",children:[y.children,(0,a.jsx)(N(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(v(),{"aria-label":"send message",onClick:ge,disabled:me(),color:"secondary",children:(0,a.jsx)(I,{name:"send"})})})})]})]})}));var H,W,K=function(){return K=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},K.apply(this,arguments)};!function(e){e.Owner="owner",e.Member="member"}(H||(H={})),function(e){e.Human="human",e.Agent="agent"}(W||(W={}));const U=function(e){var t=e.ws,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["ws"]);return(0,a.jsx)(F,K({},r,{send:function(e){var r,n;e.data=(r=e.data.text,n=[],r&&(null==r?void 0:r.trim().length)&&n.push({type:"text",text:r}),{messages:[{content:n,role:"user"}]}),t.send(e)}}))};return i})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/textInput/textInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"textInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/textInput/textInput.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,aAAa,CAAA;AAG1D,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CAetD"}
|
|
@@ -4,4 +4,5 @@ export declare const senderDescription: InputType;
|
|
|
4
4
|
export declare const wsDescription: InputType;
|
|
5
5
|
export declare const participantDetail: string;
|
|
6
6
|
export declare const getMembersDescription: InputType;
|
|
7
|
+
export declare const textInputDescription: InputType;
|
|
7
8
|
//# sourceMappingURL=sharedDescription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedDescription.d.ts","sourceRoot":"","sources":["../../src/components/sharedDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,eAAO,MAAM,yBAAyB,EAAE,SAIvC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,SAmB/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAwB3B,CAAA;AAED,eAAO,MAAM,iBAAiB,QAMoC,CAAA;AAElE,eAAO,MAAM,qBAAqB,EAAE,SASnC,CAAA"}
|
|
1
|
+
{"version":3,"file":"sharedDescription.d.ts","sourceRoot":"","sources":["../../src/components/sharedDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,eAAO,MAAM,yBAAyB,EAAE,SAIvC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,SAmB/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAwB3B,CAAA;AAED,eAAO,MAAM,iBAAiB,QAMoC,CAAA;AAElE,eAAO,MAAM,qBAAqB,EAAE,SASnC,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,SA4ElC,CAAA"}
|
package/dist/index.css
CHANGED
|
@@ -887,46 +887,6 @@ span.rustic-open-layers-map-marker {
|
|
|
887
887
|
overflow-wrap: break-word;
|
|
888
888
|
}
|
|
889
889
|
|
|
890
|
-
.rustic-recharts-time-series {
|
|
891
|
-
display: flex;
|
|
892
|
-
flex-direction: column;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
.rustic-recharts-time-series-chart-toggle {
|
|
896
|
-
align-self: end;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
.rustic-recharts-time-series-chart-toggle-title {
|
|
900
|
-
padding: 6px 16px;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
.rustic-recharts-time-series-title {
|
|
904
|
-
text-align: center;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
.rustic-recharts-time-series-description {
|
|
908
|
-
padding: 16px;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
.rustic-recharts-time-series-legend {
|
|
912
|
-
display: flex;
|
|
913
|
-
flex-wrap: wrap;
|
|
914
|
-
gap: 8px;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
.rustic-recharts-time-series-legend-item {
|
|
918
|
-
display: flex;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
.recharts-responsive-container {
|
|
922
|
-
font-size: 12px;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
.recharts-legend-wrapper {
|
|
926
|
-
display: flex;
|
|
927
|
-
justify-content: center;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
890
|
.rustic-mermaid-container {
|
|
931
891
|
height: 100%;
|
|
932
892
|
width: 100%;
|
package/dist/index.js
CHANGED
|
@@ -1 +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,t,r={9528:(e,t,r)=>{r.d(t,{UniformsForm:()=>h});var n=r(8732),a=r(6989),i=r.n(a),o=r(785),s=r.n(o);const c=require("ajv");var l=r.n(c),u=r(2015);const d=require("uniforms-bridge-json-schema"),p=require("uniforms-mui");var m=r(3903),f=r(227);function h(e){var t=(0,u.useState)(e.data),r=t[0],a=t[1];(0,u.useEffect)((function(){e.data&&a(e.data)}),[e.data]);var o,c,h=new(l())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),v=(o=e.schema,c=h.compile(o),function(e){var t;return c(e),(null===(t=c.errors)||void 0===t?void 0:t.length)?{details:c.errors}:null}),g=new d.JSONSchemaBridge({schema:e.schema,validator:v});return(0,n.jsxs)(i(),{className:"rustic-form",children:[e.title&&(0,n.jsx)(s(),{variant:"h6",children:e.title}),e.description&&(0,n.jsx)(f.A,{text:e.description}),(0,n.jsx)(p.AutoForm,{schema:g,onSubmit:function(t){return function(t){var r=(new Date).toISOString(),n={id:(0,m.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"formResponse",data:{data:t,inReplyTo:e.messageId}};a(t),e.ws.send(n)}(t)},model:r,disabled:!!r})]})}},9767:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(8732),a=(r(2015),function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},a.apply(this,arguments)});function i(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(4409),r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>d,L:()=>u});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o),c=r(3840),l=r(2015);function u(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=c.marked.parse(t,{async:!1});return s().sanitize(r)}const d=function(e){var t=(0,l.useState)(u(e.text)),r=t[0],a=t[1];return(0,l.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(u(t))}}),[e.text,e.updatedData]),(0,n.jsx)(i(),{variant:"body1",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:r}})}},4409:(e,t,r)=>{r.d(t,{A:()=>u});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),c=r(2015),l=r(227);const u=function(e){var t=(0,c.useState)((0,l.L)(e.text)),r=t[0],a=t[1],o=(0,c.useState)(""),u=o[0],d=o[1];return(0,c.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,n=e.updatedData;r<n.length;r++){var i=n[r];"string"!=typeof i.text?(t+=" [MISSING TEXT]",d("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=i.text}a((0,l.L)(t))}}),[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),u&&(0,n.jsx)(i(),{severity:"error",children:u})]})}},4445:(e,t,r)=>{r.d(t,{default:()=>c});var n=r(8732),a=r(909),i=r.n(a),o=r(4603),s=r.n(o);r(2015),r(7159);const c=function(e){return(0,n.jsx)(s(),{title:e.label,children:(0,n.jsx)(i(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})}},7159:(e,t,r)=>{var n,a;r.d(t,{s:()=>n,y:()=>a}),function(e){e.Owner="owner",e.Member="member"}(n||(n={})),function(e){e.Human="human",e.Agent="agent"}(a||(a={}))},9517:(e,t,r)=>{r.d(t,{generateTheme:()=>m,rusticDarkTheme:()=>h,rusticLightTheme:()=>f});var n=r(6182);const a=require("lodash");var i=r.n(a),o=function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},o.apply(this,arguments)},s=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function c(e){var t={};return Object.keys(e).forEach((function(r){var n=r.match(/^([a-z]+)([A-Z].*)$/);if(n){n[0];var a=n[1],o=n[2],s="".concat(a.toLowerCase(),".").concat(i().camelCase(o));i().set(t,s,e[r])}else i().set(t,r.toLowerCase(),e[r])})),t}var l={lightMode:{commonBlack:"#000000",commonWhite:"#FFFFFF",divider:"#E1D9D5",backgroundPaper:"#FFFFFF",backgroundDefault:"#F4F4F4",textPrimary:"#1E0C04",textSecondary:"#4E443F",textDisabled:"#727272",actionActive:"rgba(0, 0, 0, 0.56)",actionHover:"rgba(0, 0, 0, 0.08)",actionSelected:"rgba(0, 0, 0, 0.16)",actionFocus:"rgba(0, 0, 0, 0.12)",actionDisabledBackground:"rgba(0, 0, 0, 0.12)",actionDisabled:"rgba(0, 0, 0, 0.38)",primaryMain:"#2D2825",primaryLight:"rgba(45, 40, 37, 0.60)",primaryDark:"#000000",primaryContrastText:"#FFFFFF",primaryHover:"rgba(45, 40, 37, 0.08)",primarySelected:"rgba(45, 40, 37, 0.16)",primaryFocus:"rgba(45, 40, 37, 0.12)",primaryFocusVisible:"rgba(45, 40, 37, 0.30)",primaryOutlinedBorder:"rgba(45, 40, 37, 0.50)",secondaryMain:"#FF6928",secondaryDark:"#E54500",secondaryLight:"rgba(255, 105, 40, 0.60)",secondaryContrast:"#FFFFFF",secondaryHover:"rgba(255, 105, 40, 0.08)",secondarySelected:"rgba(255, 105, 40, 0.16)",secondaryFocus:"rgba(255, 105, 40, 0.12)",secondaryFocusVisible:"rgba(255, 105, 40, 0.30)",secondaryOutlinedBorder:"rgba(255, 105, 40, 0.50)",successMain:"#007F51",successDark:"#014F33",successLight:"#00D788",successContrastText:"#000000",errorMain:"#F82A43",errorDark:"#C82639",errorLight:"#FF9BA7",errorContrastText:"#000000",warningMain:"#FFB800",warningDark:"#DC8400",warningLight:"#FFDB7D",warningContrastText:"#000000",infoMain:"#0094FF",infoDark:"#005A9B",infoLight:"#8CCFFF",infoContrastText:"#000000"},darkMode:{commonBlack:"#000000",commonWhite:"#FFFFFF",divider:"#E1D9D5",backgroundPaper:"#202020",backgroundDefault:"#2C2C2C",textPrimary:"#FFFFFF",textSecondary:"rgba(255, 255, 255, 0.70)",textDisabled:"rgba(255, 255, 255, 0.38)",actionActive:"rgba(255, 255, 255, 0.60)",actionHover:"rgba(255, 255, 255, 0.30)",actionSelected:"rgba(255, 255, 255, 0.16)",actionFocus:"rgba(255, 255, 255, 0.12)",actionDisabledBackground:"rgba(255, 255, 255, 0.12)",actionDisabled:"rgba(255, 255, 255, 0.38)",primaryMain:"#FFFCFB",primaryLight:"rgba(255, 252, 251, 0.60)",primaryDark:"#FFFFFF",primaryContrastText:"rgba(0, 0, 0, 0.87)",primaryOutlinedBorder:"rgba(255, 252, 251, 0.50)",primaryFocus:"rgba(255, 252, 251, 0.12)",primaryFocusVisible:"rgba(255, 252, 251, 0.30)",primaryHover:"rgba(255, 252, 251, 0.08)",primarySelected:"rgba(255, 252, 251, 0.16)",secondaryMain:"#FF6928",secondaryDark:"#E54500",secondaryLight:"rgba(255, 105, 40, 0.60)",secondaryContrastText:"rgba(0, 0, 0, 0.87)",secondaryHover:"rgba(255, 105, 40, 0.08)",secondarySelected:"rgba(255, 105, 40, 0.16)",secondaryFocus:"rgba(255, 105, 40, 0.12)",secondaryFocusVisible:"rgba(255, 105, 40, 0.30)",secondaryOutlinedBorder:"rgba(255, 105, 40, 0.50)",successMain:"#00B775",successDark:"#01784D",successLight:"#00E390",successContrastText:"rgba(0, 0, 0, 0.87)",errorMain:"#F82A43",errorDark:"#C82639",errorLight:"#FF9BA7",errorContrastText:"rgba(0, 0, 0, 0.87)",warningMain:"#FFB800",warningDark:"#DC8400",warningLight:"#FFDB7D",warningContrastText:"rgba(0, 0, 0, 0.87)",infoMain:"#0094FF",infoDark:"#005A9B",infoLight:"#8CCFFF",infoContrastText:"rgba(0, 0, 0, 0.87)"}},u={fontSize:"12px",lineHeight:1.5,letterSpacing:"0.5px",padding:"0 12px",minHeight:"26px"},d={fontSize:"14px",lineHeight:1.43,letterSpacing:"0.25px",padding:"0 16px",minHeight:"40px"},p={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"};function m(e,t){var r="light"===e?t.lightMode:t.darkMode;return{shape:{borderRadius:16},typography:{fontFamily:"Inter",h1:{fontStyle:"normal",fontWeight:300,fontSize:"94px",lineHeight:1.167,letterSpacing:"-1.5px"},h2:{fontStyle:"normal",fontWeight:300,fontSize:"59px",letterSpacing:"-2px",lineHeight:1.2},h3:{fontStyle:"normal",fontWeight:400,fontSize:"47px",letterSpacing:"0px",lineHeight:1.167},h4:{fontStyle:"normal",fontWeight:400,fontSize:"33px",letterSpacing:"0px",lineHeight:1.235},h5:{fontStyle:"normal",fontWeight:400,fontSize:"24px",letterSpacing:"0px",lineHeight:1.334},h6:{fontStyle:"normal",fontWeight:500,fontSize:"20px",letterSpacing:"0px",lineHeight:1.6},body1:{fontStyle:"normal",fontWeight:400,fontSize:"16px",letterSpacing:"0px",lineHeight:1.5},body1Bold:{fontStyle:"normal",fontWeight:600,fontSize:"16px",letterSpacing:"0px",lineHeight:1.5},body2:{fontStyle:"normal",fontWeight:400,fontSize:"14px",letterSpacing:"0px",lineHeight:1.43},subtitle1:{fontStyle:"normal",fontWeight:400,fontSize:"16px",letterSpacing:"0px",lineHeight:1.75},subtitle2:{fontStyle:"normal",fontWeight:500,fontSize:"14px",letterSpacing:"0px",lineHeight:1.57},overline:{fontStyle:"normal",fontWeight:400,fontSize:"10px",letterSpacing:"0px",lineHeight:1.5,textTransform:"uppercase"},caption:{fontStyle:"normal",fontWeight:400,fontSize:"12px",letterSpacing:"0px",lineHeight:1.66},button:{textTransform:"none",fontWeight:700}},shadows:s([],(0,n.createTheme)({}).shadows.map((function(e,t){return 1===t?"0 4px 5px rgba(0, 0, 0, 0.05)":2===t?"0 4px 10px rgba(0, 0, 0, 0.1)":3===t?"0 4px 15px rgba(0, 0, 0, 0.15)":"none"})),!0),palette:o({mode:e},c(r)),components:{MuiTooltip:{styleOverrides:{tooltip:"light"===e?{backgroundColor:r.commonBlack,color:r.commonWhite}:{backgroundColor:r.commonWhite,color:r.commonBlack}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:r.actionFocus},root:{borderBottom:"1px solid ".concat(r.divider),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:r.textPrimary}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(r.divider),backgroundImage:"none"}}},MuiButton:{styleOverrides:{root:{"&.MuiButton-sizeSmall":o({},u),"&.MuiButton-sizeMedium":o({borderRadius:"24px"},d),"&.MuiButton-sizeLarge":o({borderRadius:"32px"},p),"&.Mui-disabled":{background:r.backgroundPaper,color:r.textDisabled,border:"1px solid ".concat(r.actionDisabled)}},containedPrimary:{background:r.primaryMain,color:r.primaryContrastText,"&:hover":{background:r.primaryLight},"&:active":{background:r.primaryMain,outline:"2px solid ".concat(r.primaryLight)}},containedSecondary:{"&:hover":{background:r.secondaryLight},"&:active":{background:r.secondaryMain,outline:"2px solid ".concat(r.secondaryLight)}},outlinedSecondary:{color:r.textPrimary,"&:hover":{border:"1px solid ".concat(r.secondaryDark),background:r.secondaryFocus},"&:active":{outline:"2px solid ".concat(r.secondaryLight)}},textSecondary:{color:r.textPrimary,"&:hover":{background:r.secondaryFocus},"&.Mui-disabled":{border:"none"}}}},MuiChip:{styleOverrides:{root:{"& .MuiChip-icon":{margin:"0px 8px 0px 0px"},"& .MuiChip-label":{padding:0,display:"flex",alignItems:"center",gap:"8px"},"&.MuiChip-sizeSmall":o({},u),"&.MuiChip-sizeMedium":o({borderRadius:"24px"},d),"&.MuiChip-sizeLarge":o({borderRadius:"32px"},p),color:r.textPrimary,background:r.backgroundPaper,"&.Mui-disabled":{opacity:1,background:r.backgroundPaper,color:r.textDisabled,border:"1px solid ".concat(r.actionDisabled)}},colorPrimary:{border:"1px solid ".concat(r.textPrimary),"&:hover":{color:r.primaryContrastText},"&:active":{outline:"2px solid ".concat(r.primaryLight)}},colorSecondary:{border:"1px solid ".concat(r.secondaryMain),"&:hover":{color:r.primaryContrastText,background:r.secondaryMain},"&:active":{outline:"2px solid ".concat(r.secondaryLight)}}}}}}}var f=(0,n.createTheme)(m("light",l)),h=(0,n.createTheme)(m("dark",l));f=(0,n.responsiveFontSizes)(f),h=(0,n.responsiveFontSizes)(h)},5642:e=>{e.exports=require("@mui/material/Alert")},6989:e=>{e.exports=require("@mui/material/Box")},909:e=>{e.exports=require("@mui/material/IconButton")},4603:e=>{e.exports=require("@mui/material/Tooltip")},785:e=>{e.exports=require("@mui/material/Typography")},6182:e=>{e.exports=require("@mui/material/styles")},7447:e=>{e.exports=require("dompurify")},8342:e=>{e.exports=require("emoji-picker-element")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")},3903:e=>{e.exports=require("uuid")}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,a),i.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var i=Object.create(null);a.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>r[e]));return o.default=()=>r,a.d(i,o),i},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};a.r(i),a.d(i,{Action:()=>Ht.default,ChatCompletion:()=>or,CodeSnippet:()=>P,CopyText:()=>Wt,ElementRenderer:()=>L,FCCalendar:()=>O,Icon:()=>I.A,Image:()=>Q,MarkedMarkdown:()=>w.A,MarkedStreamingMarkdown:()=>wt.A,MermaidViz:()=>yn,MessageCanvas:()=>Qt,MessageSpace:()=>nr,MultimodalInput:()=>at,Multipart:()=>sr,OpenLayersMap:()=>jt,PDFViewer:()=>Le,ParticipantRole:()=>br.s,ParticipantType:()=>br.y,ParticipantsContainer:()=>wr,PerspectiveViz:()=>kn,PlotlyGraph:()=>Nn,PopoverMenu:()=>Ye,PromptBuilder:()=>Pr,Prompts:()=>Ar,Question:()=>Lr,RechartsTimeSeries:()=>hn,Sound:()=>qt,StreamingText:()=>nn,Table:()=>en,Text:()=>an,TextInput:()=>st,TextToSpeech:()=>Ut,Timestamp:()=>Kt,UniformsForm:()=>D.UniformsForm,Uploader:()=>Je,VegaLiteViz:()=>An,Video:()=>zt,Weather:()=>Ln,YoutubeVideo:()=>cn,generateTheme:()=>In.generateTheme,rusticDarkTheme:()=>In.rusticDarkTheme,rusticLightTheme:()=>In.rusticLightTheme});var o=a(8732);const s=require("@fullcalendar/daygrid");var c=a.n(s);const l=require("@fullcalendar/react");var u=a.n(l);const d=require("@fullcalendar/timegrid");var p=a.n(d),m=a(6989),f=a.n(m),h=a(6182),v=a(785),g=a.n(v);const x=require("@mui/material/useMediaQuery");var y=a.n(x),b=a(2015),j=a.n(b),w=a(227),S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},S.apply(this,arguments)};function k(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}function O(e){var t=(0,h.useTheme)(),r=y()(t.breakpoints.up("md"));return(0,o.jsxs)(f(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),".fc .fc-toolbar-title":S({},t.typography.h6),".fc .fc-scrollgrid-liquid":{borderRadius:"".concat(t.shape.borderRadius,"px")},".fc td":{borderRadius:"0 0 ".concat(t.shape.borderRadius,"px ").concat(t.shape.borderRadius,"px")},".fc .fc-scrollgrid-section-header > th":{borderRadius:"".concat(t.shape.borderRadius,"px ").concat(t.shape.borderRadius,"px 0 0")},".fc .fc-button, .fc .fc-button:active":{color:t.palette.primary.main,backgroundColor:t.palette.background.paper,border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),"&:hover":{backgroundColor:t.palette.secondary.light,border:"1px solid ".concat(t.palette.divider)}},".fc .fc-button-group .fc-button.fc-button-active":{backgroundColor:t.palette.secondary.main,border:"1px solid ".concat(t.palette.divider)},".fc a, .fc .fc-event-title, .fc .fc-button, .fc .fc-timegrid-slot":S({},t.typography.caption)},children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(u(),{plugins:[p(),c()],initialView:r?"dayGridMonth":"timeGridDay",headerToolbar:{left:"title",right:"prev,next dayGridMonth,timeGridWeek,timeGridDay"},eventColor:t.palette.secondary.main,displayEventTime:!1,titleFormat:{year:"numeric",month:"long"},views:{dayGridMonth:{dayHeaderFormat:{weekday:r?"long":"narrow"}},timeGridWeek:{dayHeaderFormat:{weekday:"short",day:"numeric"}},timeGridDay:{dayHeaderFormat:{weekday:"long",day:"numeric"}}},allDaySlot:!1,initialDate:e.events[0].start,events:e.events.map(k)})]})}const C=require("@codemirror/language"),F=require("@codemirror/language-data"),N=require("@codemirror/state"),E=require("@codemirror/view"),T=require("@mui/system");function P(e){var t=(0,b.useRef)(null),r=(0,b.useRef)(),n=new N.Compartment,a=[N.EditorState.readOnly.of(!0),(0,E.highlightSpecialChars)(),(0,C.syntaxHighlighting)(C.defaultHighlightStyle,{fallback:!0}),n.of([])],i=F.languages.find((function(t){return t.name.toLowerCase()===e.language.toLowerCase()}));return(0,b.useEffect)((function(){if(t.current&&!r.current){var o=t.current,s=N.EditorState.create({doc:e.code,extensions:a});r.current=new E.EditorView({state:s,parent:o}),i&&r.current&&i.load().then((function(e){var t;null===(t=r.current)||void 0===t||t.dispatch({effects:n.reconfigure(e.extension)})}))}}),[]),(0,o.jsxs)(T.Box,{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(T.Box,{className:"rustic-code-snippet",sx:{backgroundColor:"background.default"},"aria-label":"code snippet",ref:t,children:(0,o.jsx)(g(),{variant:"body2","aria-label":"language type",children:e.language})})]})}var D=a(9528),A=function(){return A=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},A.apply(this,arguments)};const L=function(e){var t=e.messages[0],r=e.messages.slice(1),n=e.supportedElements[t.format];return(0,o.jsx)(o.Fragment,{children:n?j().createElement(n,A(A({sender:e.sender,ws:e.ws,messageId:t.id,conversationId:t.conversationId},t.data),r.length>0&&{updatedData:r.map((function(e){return e.data}))})):(0,o.jsxs)(g(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var I=a(9767);const M=require("@mui/material/CircularProgress");var R,q=a.n(M),B=function(){return B=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},B.apply(this,arguments)},_=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function z(e,t){return function(e,t){var r,n=new Date(e),a=navigator.language;return r=t===R.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(a,r)}(e,t<=1?R.HOUR:R.MONTH_DATE)}function H(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60),a=t>0?"".concat(t,":"):"",i="".concat(t>0?r.toString().padStart(2,"0"):r),o=n.toString().padStart(2,"0");return"".concat(a).concat(i,":").concat(o)}function W(e,t){var r={};return e&&(r={width:e}),t&&(r=B(B({},r),{height:t})),e||t||(r={className:"rustic-fit-container"}),r}function U(e){var t=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"][new Date(1e3*e).getDay()];return{shortName:t,fullName:{Sun:"Sunday",Mon:"Monday",Tues:"Tuesday",Wed:"Wednesday",Thurs:"Thursday",Fri:"Friday",Sat:"Saturday"}[t]}}function V(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(R||(R={}));var G=function(){return G=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},G.apply(this,arguments)},K=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function Q(e){var t=e.alt,r=void 0===t?"An image is displayed":t,n=K(e,["alt"]),a=(0,b.useState)(!0),i=a[0],s=a[1],c=(0,b.useState)(""),l=c[0],u=c[1];return l.length>0?(0,o.jsx)(g(),{variant:"body2",children:l}):(0,o.jsxs)("figure",{children:[i&&(0,o.jsx)(q(),{}),n.title&&(0,o.jsx)(g(),{variant:"h6",children:n.title}),(0,o.jsx)("img",G({},W(n.width,n.height),{src:n.src,alt:r,onError:function(){u("Image failed to load"),s(!1)},onLoad:function(){s(!1)}})),n.description&&(0,o.jsx)("figcaption",{children:(0,o.jsx)(w.A,{text:n.description})})]})}var Y=a(3903);const $=require("@mui/material/Avatar");var X=a.n($),Z=a(909),J=a.n(Z);const ee=require("@mui/material/InputAdornment");var te=a.n(ee);const re=require("@mui/material/MenuItem");var ne=a.n(re);const ae=require("@mui/material/MenuList");var ie=a.n(ae);const oe=require("@mui/material/Popover");var se=a.n(oe);const ce=require("@mui/material/TextField");var le=a.n(ce),ue=a(4603),de=a.n(ue),pe=a(8342);const me=function(e){var t=(0,h.useTheme)(),r=(0,b.useRef)(null),n=(0,b.useRef)(null),i=(0,b.useState)(!1),s=i[0],c=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function u(){c(!1)}function d(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),u()}return(0,b.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(a.t.bind(a,8342,23)).then((function(r){var a=new(0,r.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";a.classList.add(i),Object.keys(l).forEach((function(e){a.style.setProperty(e,l[e])})),n.current=a})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,b.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",d),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",d)}}),[s,e.onEmojiClick]),(0,o.jsxs)("div",{children:[(0,o.jsx)(de(),{title:"Emoji",children:(0,o.jsx)(J(),{size:"small",ref:r,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(I.A,{name:"Mood"})})}),n.current&&(0,o.jsx)(se(),{open:s,anchorEl:r.current,onClose:u,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,o.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var fe={"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 he(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function ve(e){return(0,o.jsxs)(f(),{className:"rustic-participant-profile",children:[(0,o.jsx)(X(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(g(),{variant:"body1Bold",children:e.displayName})]})}function ge(e){var t=e.items,r=e.isOpen,n=e.onClose,a=e.onSelect,i=e.renderItem,s=e.anchorEl,c=e.selectedIndex;return(0,o.jsx)(se(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:s,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,o.jsx)(ie(),{children:t.map((function(e,t){return(0,o.jsx)(ne(),{onClick:function(){return a(e)},selected:t===c,children:i(e)},t)}))})})}const xe=(0,b.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,a=e.fullWidth,i=void 0===a||a,s=e.maxRows,c=void 0===s?6:s,l=e.enableSpeechToText,u=void 0!==l&&l,d=e.maximumEmojiSearchResults,p=void 0===d?5:d,m=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),h=(0,b.useState)(""),v=h[0],x=h[1],y=(0,b.useState)(!1),j=y[0],w=y[1],S=(0,b.useState)(!1),k=S[0],O=S[1],C=(0,b.useState)(!1),F=C[0],N=C[1],E=(0,b.useState)(""),T=E[0],P=E[1],D=(0,b.useState)([]),A=D[0],L=D[1],M=(0,b.useState)(!1),R=M[0],B=M[1],_=(0,b.useState)(0),z=_[0],H=_[1],W=(0,b.useRef)(null),U=new pe.Database({dataSource:m.emojiDataSource}),G=!v.trim().length&&!m.isSendEnabled,K="".concat(j?"Stop":"Start"," speech to text"),Q=k?"primary.main":"primary.light",$=j?"error.main":Q,X=j?"stop_circle":"speech_to_text",Z=(0,b.useState)([]),ee=Z[0],re=Z[1],ne=(0,b.useState)(!1),ae=ne[0],ie=ne[1];function oe(e,t){if(W.current){var r=W.current,n=r.selectionStart,a=r.selectionEnd;if("number"==typeof n&&"number"==typeof a){var i,o=v||"",s=o.substring(0,n),c=o.substring(a),l=void 0;t?(l=s.replace(t,e)+c,i=s.replace(t,e).length):(l=s+e+c,i=n+e.length),x(l),setTimeout((function(){var e,t;null===(e=W.current)||void 0===e||e.focus(),null===(t=W.current)||void 0===t||t.setSelectionRange(i,i)}),0)}}}function se(e){oe("@".concat(e," "),/@(\w*)$/),re([])}function ce(e,t){void 0===t&&(t=!1),oe(e,t?/:(\w+)$/:void 0),B(!1)}var ue=F?(0,o.jsx)(q(),{size:24}):(0,o.jsx)(de(),{title:K,children:(0,o.jsx)(J(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,j?(e.stop(),N(!0),w(!1)):(e.start(),P(""),w(!0)),e.onstart=function(){w(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;v.length>0?x(v+" "+r):x(r),null===(t=W.current)||void 0===t||t.focus(),w(!1)},e.onerror=function(e){var t=fe[e.error];P(t),w(!1)},e.onend=function(){N(!1),w(!1)}},size:"small",sx:{color:$,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(I.A,{name:X})})});function xe(){var e=(new Date).toISOString(),t={id:(0,Y.v4)(),timestamp:e,sender:m.sender,conversationId:m.conversationId,format:"chatCompletionRequest",data:V(v)};m.send(t),x(""),P("")}return(0,o.jsxs)(f(),{className:"rustic-base-input",ref:t,children:[(0,o.jsxs)(f(),{className:"rustic-error-and-input-container",children:[(0,o.jsx)(f(),{className:"rustic-error-container",children:(0,o.jsx)(g(),{variant:"caption",color:"error",className:"rustic-error-message",children:T})}),(0,o.jsxs)(f(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:k?"secondary.main":"action.disabled"},children:[A.length>0&&W.current&&(0,o.jsx)(ge,{anchorEl:W.current,items:A.filter((function(e){return"unicode"in e})),isOpen:R,onClose:function(){B(!1),H(0)},onSelect:function(e){return ce(e.unicode,!0)},selectedIndex:z,renderItem:he}),ee.length>0&&W.current&&(0,o.jsx)(ge,{anchorEl:W.current,items:ee,isOpen:ae,onClose:function(){ie(!1),H(0)},onSelect:function(e){return se(e.displayName)},renderItem:ve,selectedIndex:z}),(0,o.jsx)(le(),{className:"rustic-text-field",variant:"outlined",value:v,label:m.label,placeholder:m.placeholder,maxRows:c,multiline:n,fullWidth:i,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),R&&A.length>0&&"unicode"in A[z]?ce(A[z].unicode,!0):ae&&ee.length>0?se(ee[z].displayName):e.shiftKey||G||xe();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(R?H((function(e){return(e+t+A.length)%A.length})):ae&&H((function(e){return(e+t+ee.length)%ee.length})));0!==z&&H(0)}},onChange:function(e){P("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&m.getMembers){var r=t[1].toLowerCase();m.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));re(t),t.length>0?ie(!0):ie(!1)}))}else re([])}(t);var r,n=t.match(/:(\w{2,}):/g),a=t.match(/:(\w{2,})/g);if(n){var i=n[0].replace(/:/g,"");U.getEmojiByShortcode(i).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);x(r)}else x(t)})).catch((function(){x(t)})),B(!1)}else a?(r=a[0].replace(":",""),U.getEmojiBySearchQuery(r).then((function(e){e.length?(L(e.slice(0,p)),B(!0)):(L([]),B(!1))})).catch((function(){L([]),B(!1)}))):B(!1)},onFocus:function(){return O(!0)},onBlur:function(){return O(!1)},inputRef:W,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,o.jsxs)(te(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(me,{dataSource:m.emojiDataSource,onEmojiClick:ce,buttonColor:Q}),u&&ue]})},inputLabel:{className:k?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(f(),{className:"rustic-input-actions",children:[m.children,(0,o.jsx)(de(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(J(),{"aria-label":"send message",onClick:xe,disabled:G,color:"secondary",children:(0,o.jsx)(I.A,{name:"send"})})})})]})]})})),ye=require("@mui/material/LinearProgress");var be=a.n(ye);const je=require("axios");var we=a.n(je);const Se=require("react-dom"),ke=require("@mui/material/Card");var Oe=a.n(ke);const Ce=require("@mui/material/Modal");var Fe=a.n(Ce);const Ne=require("@mui/system/Stack");var Ee=a.n(Ne);const Te=require("@mui/system/useTheme");var Pe=a.n(Te);const De=require("pdfjs-dist"),Ae=function(e){var t={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"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,o.jsx)(de(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(J(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(I.A,{name:r.symbol})})})})},Le=function(e){var t,r=(0,b.useRef)(null),n=(0,b.useState)(1),a=n[0],i=n[1],s=(0,b.useState)(1),c=s[0],l=s[1],u=(0,b.useState)(1),d=u[0],p=u[1],m=(0,b.useState)(!1),h=m[0],v=m[1],x=(0,b.useState)(),j=x[0],w=x[1],S=Pe()(),k=y()(S.breakpoints.down("sm")),O=y()(S.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(g(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var C=(0,b.useState)((function(){return k?.5:O?1:1.5})),F=C[0],N=C[1];function E(t){De.getDocument({url:e.url,httpHeaders:t}).promise.then((function(e){l(e.numPages),function(e){e.getPage(a).then((function(e){var t=e.getViewport({scale:F}),n=r.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*i,n.height=t.height*i;var o={canvasContext:a,viewport:t,transform:[i,0,0,i,0,0]};j&&j.cancel();var s=e.render(o);w(s),s.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){v(!0)}))}return(0,b.useEffect)((function(){De.GlobalWorkerOptions.workerSrc||(De.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(De.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then((function(e){return E(e.headers)})).catch((function(){return v(!0)})):E()}),[e.url,a,F]),h?(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(g(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(f(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(Ae,{action:"zoomOut",onClick:function(){N((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(Ae,{action:"zoomIn",onClick:function(){N((function(e){return e+.2}))}})]}),(0,o.jsx)(f(),{className:"rustic-pdf-viewer-body",children:(0,o.jsx)(f(),{className:"rustic-pdf-viewer-body-inner",children:(0,o.jsx)("canvas",{ref:r})})}),(0,o.jsxs)(Ee(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(Ae,{action:"previousPage",onClick:function(){a>1&&(i(a-1),p(a-1))},isDisabled:1===a}),(0,o.jsx)(g(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(le(),{type:"number",value:d,onChange:function(e){var t=parseInt(e.target.value);p(t),!isNaN(t)&&t>=1&&t<=c&&i(t)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(g(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(Ae,{action:"nextPage",onClick:function(){a<c&&(i(a+1),p(a+1))},isDisabled:a===c})]})]})};var Ie=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},Me={pdf:Le};function Re(e){var t=e.supportedViewers,r=void 0===t?Me:t,n=e.showFullName,a=void 0===n||n,i=Ie(e,["supportedViewers","showFullName"]),s=(0,h.useTheme)(),c=(0,b.useState)(!1),l=c[0],u=c[1];function d(){u(!1)}var p,m,f=i.file.url&&(p=i.file.url.split("."))[p.length-1].toLowerCase(),v=f&&r?r[f]:null,x=!!v,y=x?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(a?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=a?i.file.name:(m=i.file.name).length<=15?m:m.substring(0,12)+"...";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(Oe(),{className:j,variant:"outlined",sx:{boxShadow:s.shadows[1]},onClick:function(){u(!0)},children:[(0,o.jsx)(g(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:i.children})]}),x&&(0,o.jsx)(Fe(),{open:l,onClose:d,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(de(),{title:"Close",children:(0,o.jsx)(J(),{onClick:d,className:"rustic-close-button",children:(0,o.jsx)(I.A,{name:"close"})})}),i.file.url&&(0,o.jsx)(v,{url:i.file.url,getAuthHeaders:i.getAuthHeaders})]})})]})}var qe=a(3110);const Be=require("@mui/material"),_e=require("@mui/material/Button");var ze=a.n(_e);const He=require("@mui/material/Drawer");var We=a.n(He);const Ue=require("@mui/material/ListItemText");var Ve=a.n(Ue);const Ge=require("@mui/material/Menu");var Ke=a.n(Ge),Qe=function(){return Qe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Qe.apply(this,arguments)};function Ye(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useRef)(null),i=(0,h.useTheme)(),s=(0,Be.useMediaQuery)(i.breakpoints.down("md")),c=s?We():Ke(),l={borderRadius:"".concat(i.shape.borderRadius,"px"),border:"1px solid ".concat(i.palette.divider)};function u(e){return(0,o.jsxs)(o.Fragment,{children:[e.startDecorator&&(0,o.jsx)(T.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,o.jsx)(Ve(),{children:(0,o.jsx)(g(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,o.jsx)(T.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}s&&(l=Qe(Qe({},l),{borderRadius:"".concat(i.shape.borderRadius,"px ").concat(i.shape.borderRadius,"px 0 0"),borderBottom:0}));var d=e.menuItems.map((function(e){return e.href?(0,o.jsx)(ne(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:u(e)},e.label):(0,o.jsx)(ne(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:u(e)},e.label)}));var p,m,f=s?{}:{anchorEl:a.current};return(0,o.jsxs)(o.Fragment,{children:[(p={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},m=(0,o.jsx)(I.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(ze(),Qe({},p,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(de(),{title:e.ariaLabel,children:(0,o.jsx)(J(),Qe({},p,{children:e.icon?e.icon:m}))})),(0,o.jsx)(c,Qe({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":Qe(Qe({},l),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:d}))]})}var $e=function(){return $e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},$e.apply(this,arguments)},Xe=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Ze(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const Je=function(e){var t,r=(0,b.useState)([]),n=r[0],a=r[1],i=(0,b.useState)([]),s=i[0],c=i[1],l=(0,b.useState)({}),u=l[0],d=l[1],p=(0,b.useRef)({}),m=(0,Y.v4)();(0,b.useEffect)((function(){a([]),c([]),p.current={}}),[e.messageId]);var h=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function v(e,t,r){var n;p.current=$e($e({},p.current),((n={})[e]=p.current[e]--,n)),function(e,t,r){c((function(t){return Xe(Xe([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)})),a((function(e){return e.filter((function(e){return e.id!==t}))}))}(e,t,r)}var x=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,o.jsx)(Re,{file:{name:t.name},showFullName:e.showFullName,children:(0,o.jsxs)(f(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,o.jsx)(be(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(de(),{title:"Delete",children:(0,o.jsx)(J(),{color:"primary",onClick:function(){return function(t,r){var n,i;c([]);var o=t.name;if(p.current=$e($e({},p.current),((n={})[o]=p.current[o]--,n)),e.onFileUpdate("remove",o),100===t.loadingProgress){var s="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);h.then((function(t){we().delete(s,$e({},t)).then((function(){return a((function(e){return e.filter((function(e,t){return t!==r}))}))})).catch((function(){return e.onFileUpdate("add",o),c((function(e){return Xe(Xe([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}))}else t.abortController.abort(),a((function(e){return e.filter((function(e,t){return t!==r}))})),p.current=$e($e({},p.current),((i={})[o]=p.current[o]++,i))}(t,r)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,o.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},r)}))}),y=(0,o.jsx)(f(),{children:s.map((function(e,t){return(0,o.jsx)(g(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function j(e,t){return t?(0,Se.createPortal)(e,t):e}var w=null===(t=e.uploadOptions)||void 0===t?void 0:t.map((function(t){return{label:t.label,onClick:function(){return function(t){d(t.metadata);var r=document.getElementById(m);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,o.jsx)(qe.default,{name:t.iconName})}}));return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(f(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:m,children:(null==w?void 0:w.length)?(0,o.jsx)(Ye,{ariaLabel:"Upload",icon:(0,o.jsx)(qe.default,{name:"upload_2"}),menuItems:w}):(0,o.jsx)(de(),{title:"Upload",children:(0,o.jsx)(J(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,o.jsx)("input",{type:"file",id:m,onChange:function(t){c([]);var r=t.target.files&&Array.from(t.target.files),i=n.length+(r?r.length:0);e.maxFileCount&&i>e.maxFileCount&&c((function(t){return Xe(Xe([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=r&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(r,i,e.maxFileCount);o&&o.forEach((function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,c((function(t){return Xe(Xe([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&Ze(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,i=function(e){var t,r,n=e.name,a=p.current[n];if(a){var i=a+1,o=n.lastIndexOf("."),s=n.substring(0,o),c=n.substring(o);n="".concat(s,"(").concat(a,")").concat(c),p.current=$e($e({},p.current),((t={})[e.name]=i,t))}else p.current=$e($e({},p.current),((r={})[e.name]=1,r));return n}(t),o=new File([t],i,{type:t.type});if(e.getUploadData||u){var s=e.getUploadData?e.getUploadData(i):{},c=$e($e({},s),u);Object.keys(c).forEach((function(e){var t=c[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)}))}r.append("file",o);var l=(0,Y.v4)(),d={name:i,loadingProgress:0,abortController:n,id:l};function m(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=d.id,a((function(e){var n=e.map((function(e){return e.id===r?$e($e({},e),{loadingProgress:t}):e}));return n})))}a((function(e){return Xe(Xe([],e,!0),[d],!1)})),e.onFileUpdate("add",i);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId);!function o(){return h.then((function(s){return we().post(f,r,$e($e({},s),{onUploadProgress:m,signal:n.signal})).then((function(t){var n,i,o=r.get("file");t.data.url&&o instanceof File&&o.name&&e.onFileUpdate("update",o.name,t.data.url),t.data.fileId&&(n=t.data,i=d.id,a((function(e){var t=e.findIndex((function(e){return e.id===i}));if(-1!==t){var r=Xe([],e,!0);return r[t]=$e($e({},r[t]),{id:n.fileId}),r}return e})))})).catch((function(n){var s,c,u=r.get("file");u instanceof File&&u.name&&e.onFileUpdate("remove",u.name);var p,m,f,h;409===(null===(s=n.response)||void 0===s?void 0:s.status)&&e.listFiles?(p=i.lastIndexOf("."),m=i.substring(0,p),f=i.substring(p),h=new RegExp("^".concat(m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var t=0,r=0,n=e;r<n.length;r++){var a=n[r];if(h.test(a.name)){var i=a.name.match(h),o=i&&i[1]?parseInt(i[1].slice(1,-1),10):0;t=Math.max(t,o)}}return"".concat(m,"(").concat(t+1,")").concat(f)})):Promise.resolve(i)).then((function(n){e.onFileUpdate("add",n);var i=new File([t],n,{type:t.type});r.set("file",i),a((function(e){return e.map((function(e){return e.id===l?$e($e({},e),{name:n,loadingProgress:0}):e}))})),o()})).catch((function(){var e;v(t.name,d.id,null===(e=n.response)||void 0===e?void 0:e.data)})):v(t.name,d.id,null===(c=n.response)||void 0===c?void 0:c.data)}))}))}()}(t)}(t)})),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),s.length>0&&j(y,e.errorMessagesContainer),n.length>0&&j(x,e.filePreviewsContainer)]})};var et=function(){return et=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},et.apply(this,arguments)},tt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},rt=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},nt=2097152;function at(e){var t=e.maxFileSize,r=void 0===t?nt:t,n=e.maxFileCount,a=void 0===n?1:n,i=tt(e,["maxFileSize","maxFileCount"]),s=(0,b.useState)({uploaded:[],fileList:[]}),c=s[0],l=s[1],u=(0,b.useState)((0,Y.v4)()),d=u[0],p=u[1],m=(0,b.useState)(),v=m[0],g=m[1],x=(0,b.useState)(),y=x[0],j=x[1],w=(0,b.useRef)(null),S=(0,h.useTheme)(),k=c.uploaded.length===c.fileList.length&&c.uploaded.length>0;return(0,b.useEffect)((function(){w.current&&(j(w.current.querySelector(".rustic-error-container")),g(w.current.querySelector(".rustic-input-extras")))})),(0,o.jsx)(f(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(S.palette.action.disabled),borderRadius:"".concat(S.shape.borderRadius,"px"),":focus-within":{borderColor:S.palette.secondary.main},background:S.palette.background.paper},children:(0,o.jsx)(xe,et({},i,{send:function(e){k&&(e.id=d,e.format="chatCompletionRequest",e.data=V(e.data.text,c.uploaded.map((function(e){return{url:e.url,name:e.name}})))),i.ws.send(e),p((0,Y.v4)()),l({uploaded:[],fileList:[]})},isSendEnabled:k,ref:w,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Je,{acceptedFileTypes:i.acceptedFileTypes,maxFileCount:a,maxFileSize:r,uploadFileEndpoint:i.uploadFileEndpoint,deleteFileEndpoint:i.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)l((function(e){return et(et({},e),{fileList:rt(rt([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");l((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),a=rt(rt(rt([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return et(et({},e),{uploaded:a})}))}else l((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:d,filePreviewsContainer:v,errorMessagesContainer:y,showFullName:i.showFullName,getUploadData:i.getUploadData,uploadOptions:i.uploadOptions,listFiles:i.listFiles,getUploadHeaders:i.getUploadHeaders})})}))})}var it=function(){return it=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},it.apply(this,arguments)},ot=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function st(e){var t=e.ws,r=ot(e,["ws"]);return(0,o.jsx)(xe,it({},r,{send:function(e){t.send(e)}}))}require("ol/ol.css");var ct=a(5642),lt=a.n(ct);const ut=require("ol/layer/Tile.js");var dt=a.n(ut);const pt=require("ol/Map.js");var mt=a.n(pt);const ft=require("ol/Overlay.js");var ht=a.n(ft);const vt=require("ol/proj.js"),gt=require("ol/source/OSM.js");var xt=a.n(gt);const yt=require("ol/View.js");var bt=a.n(yt);function jt(e){var t=(0,b.useState)(""),r=t[0],n=t[1],a=(0,b.useRef)(null),i=(0,b.useRef)(null);return(0,b.useEffect)((function(){if(n(""),e.latitude<-90||e.latitude>90||e.longitude<-180||e.longitude>180)return n("Invalid coordinates");if(a.current&&i.current){var t=new(mt())({layers:[new(dt())({source:new(xt())})],view:new(bt())({center:(0,vt.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:a.current}),r=new(ht())({element:i.current,position:(0,vt.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return t.addOverlay(r),t.once("postrender",(function(){var e;if(!(null===(e=a.current)||void 0===e?void 0:e.querySelector("canvas")))return n("An error occurred while loading the map")})),function(){t.setTarget(""),t.removeOverlay(r)}}}),[]),(0,o.jsx)(o.Fragment,{children:r.length>0?(0,o.jsx)(lt(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(f(),{ref:i,children:(0,o.jsx)(I.A,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:a,className:"rustic-open-layers-map-canvas"})]})})}var wt=a(4409);const St=require("@mui/material/Slider");var kt=a.n(St);function Ot(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,o.jsx)(de(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(J(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(I.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var Ct=100;function Ft(e){var t="dark"===(0,Be.useTheme)().palette.mode,r=H(e.mediaElement.currentTime);return(0,o.jsxs)(f(),{className:"rustic-progress",children:[function(){for(var r=e.mediaElement.buffered,n=0,a=r.length-1;a>=0;--a){var i=r.start(a),s=r.end(a);if(i<e.mediaElement.currentTime){n=s;break}}var c=n/e.mediaElement.duration*Ct;return(0,o.jsx)(be(),{className:"rustic-progress-buffered",variant:"determinate",value:c,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,o.jsx)(kt(),{className:"rustic-progress-slider",size:"small","aria-label":"Time","aria-valuetext":"Current time: ".concat(r),max:e.mediaElement.duration,value:e.mediaElement.currentTime,onChange:function(t,r){e.mediaElement.currentTime=r},valueLabelDisplay:"auto",valueLabelFormat:function(e){return H(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function Nt(e){var t=(0,b.useState)(e.mediaElement.volume),r=t[0],n=t[1],a=(0,b.useState)(e.mediaElement.volume),i=a[0],s=a[1],c=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,o.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,o.jsx)(Ot,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(s(e.mediaElement.volume),n(0)):n(i)},className:"rustic-mute-button",action:c}),(0,o.jsx)(kt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*Ct,"%"),value:r,onChange:function(t,r){var a=r;e.mediaElement.muted=0===a,e.mediaElement.volume=a,n(e.mediaElement.volume)}})]})}function Et(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,o.jsx)(ze(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(I.A,{name:t}),children:(0,o.jsx)(g(),{variant:"overline",children:r})})}function Tt(e){var t=(0,b.useState)(!e.mediaElement.paused),r=t[0],n=t[1],a=r?"pause":"play";return e.mediaElement.onended=function(){n(!1)},e.mediaElement.onpause=function(){n(!1)},e.mediaElement.onplay=function(){n(!0)},(0,o.jsx)(Ot,{onClick:function(){r?e.mediaElement.pause():e.mediaElement.play().catch((function(t){e.onError("Failed to play the media. Error: ".concat(t.message))}))},action:a,className:"rustic-pause-play-icon"})}function Pt(e){var t,r=(0,b.useState)(e.mediaElement.playbackRate),n=r[0],a=r[1];return(0,o.jsx)(de(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(ze(),{onClick:function(){var t=1;e.mediaElement.playbackRate<2&&(t=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=t,a(t)},className:"rustic-playback-rate-button",children:(0,o.jsxs)(g(),{variant:"body1",children:[n,"X"]})})})}function Dt(e){var t="replay"===e.movement,r=t?function(){e.mediaElement.currentTime-=10}:function(){e.mediaElement.currentTime+=10},n=t?"replay":"forward";return(0,o.jsx)(Ot,{onClick:r,action:n})}var At=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function Lt(e){var t=e.style,r=void 0===t?"condensed":t,n=At(e,["style"]),a=H(n.elapsedTimeInSeconds),i=H(n.durationTimeInSeconds),s="".concat(a," / ").concat(i);return"wide"===r?(0,o.jsxs)(f(),{className:"rustic-time-container",children:[(0,o.jsx)(g(),{variant:"overline",children:a}),(0,o.jsx)(g(),{variant:"overline",children:i})]}):(0,o.jsx)(g(),{variant:"overline",className:"rustic-time-display",children:s})}const It=require("@mui/material/Divider");var Mt=a.n(It);function Rt(e){var t=!!document.fullscreenElement;return(0,o.jsxs)(T.Box,{className:"rustic-transcript-container",children:[!t&&(0,o.jsx)(Mt(),{orientation:"vertical",flexItem:!0}),(0,o.jsx)(g(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function qt(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(0),p=d[0],m=d[1],f=(0,b.useState)(""),h=f[0],v=f[1],x=(0,b.useState)(""),y=x[0],j=x[1],S=(0,Be.useTheme)(),k=(0,b.useRef)(null),O=(0,Be.useMediaQuery)(S.breakpoints.down("md"));function C(){return(0,o.jsx)(g(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function F(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(Ot,{action:t,onClick:function(){return s(!i)}})}}function N(){if(k.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Dt,{mediaElement:k.current,movement:"replay"}),(0,o.jsx)(Tt,{mediaElement:k.current,onError:j}),(0,o.jsx)(Dt,{mediaElement:k.current,movement:"forward"})]})}function E(){if(e.transcript&&r)return(0,o.jsx)(Rt,{transcript:e.transcript})}function P(){if(e.transcript)return(0,o.jsx)(Et,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function D(){return(0,o.jsx)("video",{src:e.src,ref:k,className:i?"rustic-has-captions":"",children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,b.useEffect)((function(){var e,t,r,n;function a(e){v(e)}null===(e=k.current)||void 0===e||e.addEventListener("timeupdate",(function(){k.current&&m(k.current.currentTime)})),null===(t=k.current)||void 0===t||t.addEventListener("canplay",(function(){v(""),u(!1)})),null===(r=k.current)||void 0===r||r.addEventListener("error",(function(){return a("Failed to load the audio.")})),null===(n=k.current)||void 0===n||n.addEventListener("stalled",(function(){return a("Failed to fetch audio data, but trying.")}))}),[]);var A=O?function(){if(k.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Lt,{elapsedTimeInSeconds:p,durationTimeInSeconds:k.current.duration,style:"wide"}),(0,o.jsx)(Ft,{mediaElement:k.current}),C(),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-left",children:N()}),(0,o.jsx)(Nt,{mediaElement:k.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-right",children:[P(),(0,o.jsxs)(T.Box,{children:[F(),(0,o.jsx)(Pt,{mediaElement:k.current})]})]})]}),E()]})}:function(){if(k.current)return(0,o.jsxs)(o.Fragment,{children:[C(),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Ft,{mediaElement:k.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-left",children:[N(),F(),(0,o.jsx)(Pt,{mediaElement:k.current}),(0,o.jsx)(Nt,{mediaElement:k.current}),(0,o.jsx)(Lt,{elapsedTimeInSeconds:p,durationTimeInSeconds:k.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:P()})]}),E()]})]})};return h.length>0?(0,o.jsx)(lt(),{severity:"error",children:h}):l?(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[D(),(0,o.jsx)(q(),{})]}):(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[D(),A(),y.length>0&&(0,o.jsx)(lt(),{severity:"error",className:"rustic-control-error",onClose:function(){return j("")},children:y})]})}function Bt(e){var t=(0,b.useState)(!!document.pictureInPictureElement),r=t[0],n=t[1],a=e.mediaElement,i=r?"miniPlayerExit":"miniPlayer";return a.onleavepictureinpicture=function(){n(!1)},(0,o.jsx)(Ot,{onClick:function(){r?document.exitPictureInPicture().then((function(){n(!1)})).catch((function(t){e.onError("Failed to exit mini player. Error: ".concat(t.message))})):a.requestPictureInPicture().then((function(){n(!0)})).catch((function(t){e.onError("Failed to enter mini player. Error: ".concat(t.message))}))},action:i})}function _t(e){var t=(0,b.useState)(!!document.fullscreenElement),r=t[0],n=t[1],a=e.element,i=r?"fullscreenExit":"fullscreen";return a.onfullscreenchange=function(){n(!!document.fullscreenElement)},(0,o.jsx)(Ot,{onClick:function(){r?document.exitFullscreen().then((function(){n(!1)})).catch((function(t){e.onError("Failed to exit fullscreen mode. Error: ".concat(t.message))})):a.requestFullscreen().then((function(){n(!0)})).catch((function(t){e.onError("Failed to enter fullscreen mode. Error: ".concat(t.message))}))},action:i})}function zt(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!0),l=c[0],u=c[1],d=(0,b.useState)(!!document.fullscreenElement),p=d[0],m=d[1],f=(0,b.useState)(!1),h=f[0],v=f[1],x=(0,b.useState)(""),y=x[0],j=x[1],S=(0,b.useState)(""),k=S[0],O=S[1],C=(0,b.useState)(0),F=C[0],N=C[1],E=(0,b.useRef)(null),P=(0,b.useRef)(null),D=(0,Be.useTheme)(),A=(0,Be.useMediaQuery)(D.breakpoints.down("md"));(0,b.useEffect)((function(){var e,t,r,n,a,i,o,s;function c(e){O(e),u(!1)}function l(){clearTimeout(s),s=setTimeout((function(){return v(!1)}),3e3)}null===(e=P.current)||void 0===e||e.addEventListener("timeupdate",(function(){P.current&&N(P.current.currentTime)})),null===(t=P.current)||void 0===t||t.addEventListener("canplay",(function(){O(""),u(!1)})),null===(r=P.current)||void 0===r||r.addEventListener("error",(function(){return c("Failed to load the video.")})),null===(n=P.current)||void 0===n||n.addEventListener("stalled",(function(){return c("Failed to fetch video data, but trying.")})),document.addEventListener("fullscreenchange",(function(){m(!!document.fullscreenElement)})),null===(a=E.current)||void 0===a||a.addEventListener("mousemove",(function(){v(!0),l()})),null===(i=E.current)||void 0===i||i.addEventListener("mouseleave",(function(){v(!1)})),null===(o=E.current)||void 0===o||o.addEventListener("keydown",(function(){v(!0),l()}))}),[]);var L={backgroundColor:D.palette.background.paper,opacity:h?1:0};function I(){if(e.transcript&&r)return(0,o.jsx)(Rt,{transcript:e.transcript})}function M(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(Ot,{action:t,onClick:function(){return s(!i)}})}}function R(){if(e.transcript)return(0,o.jsx)(Et,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var B=A?function(){return p?(0,o.jsx)(o.Fragment,{children:P.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:L,children:[(0,o.jsxs)(T.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(Tt,{mediaElement:P.current,onError:j}),(0,o.jsx)(Ft,{mediaElement:P.current}),(0,o.jsx)(Lt,{elapsedTimeInSeconds:F,durationTimeInSeconds:P.current.duration})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Dt,{mediaElement:P.current,movement:"replay"}),(0,o.jsx)(Dt,{mediaElement:P.current,movement:"forward"}),M(),(0,o.jsx)(Pt,{mediaElement:P.current})]}),R()]}),I()]})}):(0,o.jsx)(o.Fragment,{children:P.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(Tt,{mediaElement:P.current,onError:j}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[R(),(0,o.jsx)(_t,{element:E.current,onError:j})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:P.current&&E.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:L,children:[(0,o.jsx)(Ft,{mediaElement:P.current}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-left",children:[(0,o.jsx)(Tt,{mediaElement:P.current,onError:j}),(0,o.jsx)(Dt,{mediaElement:P.current,movement:"replay"}),(0,o.jsx)(Dt,{mediaElement:P.current,movement:"forward"}),M(),(0,o.jsx)(Pt,{mediaElement:P.current}),(0,o.jsx)(Nt,{mediaElement:P.current}),(0,o.jsx)(Lt,{elapsedTimeInSeconds:F,durationTimeInSeconds:P.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[R(),(0,o.jsx)(Bt,{mediaElement:P.current,onError:j}),(0,o.jsx)(_t,{element:E.current,onError:j})]})]}),p&&I()]})})};return k.length>0?(0,o.jsx)(lt(),{severity:"error",children:k}):(0,o.jsxs)(T.Box,{className:"rustic-video",children:[l&&(0,o.jsx)(q(),{className:"rustic-video-loading-spinner"}),(0,o.jsxs)(T.Box,{ref:E,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[y.length>0&&(0,o.jsx)(lt(),{severity:"error",className:"rustic-control-error",onClose:function(){return j("")},children:y}),(!A||p)&&function(){if(P.current&&E.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:L,children:[(0,o.jsx)(g(),{variant:"body2",children:e.title}),p&&A&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(Bt,{mediaElement:P.current,onError:j}),(0,o.jsx)(_t,{element:E.current,onError:j})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:P,src:e.src,poster:e.poster,children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),B()]}),!p&&I(),e.description&&(0,o.jsx)(w.A,{text:e.description})]})}var Ht=a(4445);function Wt(e){var t=(0,b.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(Ht.default,{message:e.message,icon:(0,o.jsx)(I.A,{name:"file_copy"}),onClick:function(e){e.data.text&&navigator.clipboard.writeText(e.data.text).then((function(){n("Copied"),setTimeout((function(){n("Copy text")}),2e3)})).catch((function(){n("Failed to copy")}))},label:r})}function Ut(e){var t=(0,b.useState)("Start reading aloud"),r=t[0],n=t[1],a=[e.message.data.title,e.message.data.description,e.message.data.alt,e.message.data.text,e.message.data.transcript].filter(Boolean).join(" "),i=new SpeechSynthesisUtterance(a);return(0,o.jsx)(Ht.default,{message:e.message,icon:(0,o.jsx)(I.A,{name:"text_to_speech"}),onClick:function(){window.speechSynthesis.speaking?(window.speechSynthesis.cancel(),n("Start reading aloud")):(i.onend=function(){n("Start reading aloud")},window.speechSynthesis.speak(i),n("Stop reading aloud"))},label:r})}const Vt=require("@mui/material/Stack");var Gt=a.n(Vt);const Kt=function(e){return(0,o.jsx)(g(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),n=navigator.language,a={month:"short",day:"numeric"},i=new Date,s=r.getFullYear()!==i.getFullYear(),c=s?" at ":", ",s&&(a.year="numeric"),r.toLocaleDateString(n,a)+c+r.toLocaleTimeString(n,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,n,a,i,s,c},Qt=(0,b.forwardRef)((function(e,t){var r=(0,Be.useTheme)(),n=e.inReplyTo?e.inReplyTo:e.message;return(0,o.jsxs)(Gt(),{id:n.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)(Gt(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(n),(0,o.jsx)(Kt,{timestamp:n.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,o.jsx)(Oe(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(n)}),(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,o.jsxs)(g(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,o.jsx)(Kt,{timestamp:e.message.timestamp})]})]})]})})),Yt=require("@mui/material/Chip");var $t=a.n(Yt);const Xt=require("@mui/system/Box");var Zt=a.n(Xt),Jt=function(){return Jt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Jt.apply(this,arguments)},er=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},tr=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function rr(e,t){var r;if(!(r=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.data.inReplyTo:t.id))return e;var n=Jt({},e),a=(n[r]||[])[0];return t.format.includes("update")&&a&&a.sender.id!==t.sender.id&&(r=t.id),n[r]||(n[r]=[]),t.format.includes("Response")&&a?n[r]=[Jt(Jt({},a),{data:Jt(Jt({},a.data),t.data)}),t]:n[r]=tr(tr([],n[r],!0),[t],!1),n}function nr(e){var t,r,n,a=e.scrollDownLabel,i=void 0===a?"Scroll down":a,s=er(e,["scrollDownLabel"]),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(),d=(0,b.useState)(!0),p=d[0],m=d[1],f=(0,b.useState)(!0),h=f[0],v=f[1],g=(0,b.useState)(!1),x=g[0],y=g[1],j=(0,b.useState)({}),w=j[0],S=j[1],k=Object.keys(w).length,O=(r=k,n=(0,b.useRef)(0),(0,b.useEffect)((function(){n.current=r})),n.current);function C(){v(!0),u.current&&clearTimeout(u.current),u.current=setTimeout((function(){v(!1)}),2e3)}function F(){var e=l.current,t=c.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;m(n-1<=r)}}function N(){if(function(){var e,t=null===(e=l.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every((function(e){return e.readyState>=1}))}()){var e=l.current;y(!0),e&&setTimeout((function(){C(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(N,1)}function E(e){S((function(t){return rr(t,e)}))}return(0,b.useEffect)((function(){var e=l.current;if(F(),e)return e.addEventListener("scroll",F),window.addEventListener("resize",F),function(){e.removeEventListener("scroll",F),window.removeEventListener("resize",F)}}),[p]),(0,b.useEffect)((function(){N()}),[x]),(0,b.useEffect)((function(){p&&0!==O&&k>O&&(C(),N())}),[p,Object.keys(w).length]),(0,b.useEffect)((function(){var e,t={};null===(e=s.receivedMessages)||void 0===e||e.forEach((function(e){var r=rr(t,e);t=r})),S(t)}),[null===(t=s.receivedMessages)||void 0===t?void 0:t.length]),(0,b.useEffect)((function(){s.ws.onReceive&&s.ws.onReceive(E)}),[]),(0,o.jsxs)(Zt(),{className:"rustic-message-space",children:[(0,o.jsxs)(Zt(),{ref:l,className:"rustic-message-container",children:[Object.keys(w).map((function(e,t){var r,n=w[e],a=n[n.length-1],i=a.format.includes("Response"),l=i&&{inReplyTo:n[0]};return"prompts"!==a.format?(0,o.jsx)(Qt,Jt({message:a},l,{getActionsComponent:s.getActionsComponent,getProfileComponent:s.getProfileComponent,ref:t===k-1?c:null,children:(0,o.jsx)(L,{ws:s.ws,sender:s.sender,messages:i?[n[0]]:n,supportedElements:s.supportedElements})}),e):"inConversation"===(null===(r=a.data)||void 0===r?void 0:r.position)?(0,o.jsx)("div",{ref:t===k-1?c:null,children:(0,o.jsx)(L,{ws:s.ws,sender:s.sender,messages:i?[n[0]]:n,supportedElements:s.supportedElements})},e):void 0})),!p&&!h&&(0,o.jsx)($t(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:N,label:(0,o.jsxs)(o.Fragment,{children:[i,(0,o.jsx)(I.A,{name:"arrow_downward"})]})})]}),function(e){var t,r=Object.values(e).flat(),n=r[r.length-1];return"prompts"===(null==n?void 0:n.format)&&"inConversation"!==(null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.position)?(0,o.jsx)(L,{ws:s.ws,sender:s.sender,messages:[n],supportedElements:s.supportedElements}):null}(w)]})}var ar=a(8010);function ir(e){return new URL(e).pathname.split("/").pop()}function or(e){return(0,o.jsxs)(f(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,o.jsxs)("div",{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(ar.default,{text:e.description})]}),e.messages.map((function(t,r){return"string"==typeof t.content?(0,o.jsx)(ar.default,{text:t.content},r):function(t,r){var n=[],a="";return t.map((function(t){if("text"===t.type)a+=t.text;else if(t.type.endsWith("_url")){var r=t[t.type].url,i={url:r,name:t[t.type].name||ir(r)},s=(0,o.jsx)(Re,{file:i,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:i.url&&(0,o.jsx)(de(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(J(),{component:"a",href:i.url,download:i.name,children:(0,o.jsx)(qe.default,{name:"download"})})})});n.push(s)}})),(0,o.jsxs)(j().Fragment,{children:[a.length>0&&(0,o.jsx)(ar.default,{text:a}),n.length>0&&(0,o.jsx)(f(),{className:"rustic-files",children:n})]},r)}(t.content,r)}))]})}function sr(e){return(0,o.jsxs)(Zt(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,o.jsxs)("div",{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(ar.default,{text:e.description})]}),e.text&&(0,o.jsx)(ar.default,{text:e.text}),(t=e.files.map((function(t,r){return(0,o.jsx)(Re,{file:t,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:t.url&&(0,o.jsx)(de(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(J(),{component:"a",href:t.url,download:t.name,children:(0,o.jsx)(I.A,{name:"download"})})})},r)})),(0,o.jsx)(Zt(),{className:"rustic-files",children:t}))]});var t}const cr=require("@mui/material/Dialog");var lr=a.n(cr);const ur=require("@mui/material/DialogTitle");var dr=a.n(ur);const pr=require("@mui/material/List");var mr=a.n(pr);const fr=require("@mui/material/ListItem");var hr=a.n(fr);const vr=require("@mui/material/ListSubheader");var gr=a.n(vr);const xr=require("pluralize");var yr=a.n(xr),br=a(7159);function jr(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=e.participants.length,i=r?e.participants:e.participants.slice(0,3),s="".concat(yr()(e.participantType,a)," (").concat(a,")"),c=r?"Show Less":"Show All ".concat(a);return 0===a?(0,o.jsx)(g(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(mr(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(gr(),{disableSticky:!0,className:"rustic-participant-list-subheader",children:[(0,o.jsxs)(T.Box,{className:"rustic-participant-list-subheader-title",children:[e.participantTypeIcon,(0,o.jsx)(g(),{variant:"subtitle2",color:"text.secondary",children:s})]}),a>3&&(0,o.jsx)(ze(),{onClick:function(){return n(!r)},color:"primary",size:"small",startIcon:(0,o.jsx)(I.A,{name:"keyboard_arrow_down"}),children:c})]}),children:i.map((function(e){return(0,o.jsxs)(hr(),{className:"rustic-participant-list-item",children:[(0,o.jsxs)(T.Box,{className:"rustic-participant-profile",children:[(0,o.jsx)(X(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(g(),{variant:"subtitle2",children:e.displayName})]}),(0,o.jsx)(g(),{variant:e.participantRole===br.s.Owner?"subtitle2":"caption",children:_(e.participantRole||br.s.Member)})]},e.id)}))})}const wr=function(e){function t(e,t){return function(e){return function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([],e,!0).sort((function(e,t){return t.participantRole===br.s.Owner?1:-1}))}(e.filter((function(e){return e.participantType===t})))}var r=t(e.participants,br.y.Human),n=t(e.participants,br.y.Agent),a="".concat(yr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(lr(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(dr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:a}),(0,o.jsx)(jr,{participantType:"Human",participantTypeIcon:(0,o.jsx)(I.A,{name:"account_circle"}),participants:r}),n.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Mt(),{className:"rustic-participants-container-divider"}),(0,o.jsx)(jr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(I.A,{name:"smart_toy"}),participants:n})]})]})},Sr=require("@mui/material/DialogActions");var kr=a.n(Sr);const Or=require("@mui/material/DialogContent");var Cr=a.n(Or);const Fr=require("@mui/material/DialogContentText");var Nr=a.n(Fr),Er=function(){return Er=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Er.apply(this,arguments)},Tr=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Pr(e){var t=(0,b.useState)(!1),r=t[0],n=t[1],a=(0,b.useState)(!1),i=a[0],s=a[1],c=(0,b.useState)(!1),l=c[0],u=c[1],d=(0,b.useState)(!1),p=d[0],m=d[1],f=(0,b.useState)([]),h=f[0],v=f[1],x=(0,b.useState)(null),y=x[0],j=x[1],w=(0,T.useTheme)(),S=h[h.length-1],k=Er(Er({},e.ws),{send:function(e){j(e)}});function O(e){v((function(t){return Tr(Tr([],t,!0),[e],!1)}))}function C(){if(y){var t=Er(Er({},y),{threadId:e.messageId});e.ws.send(t)}}if((0,b.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(O)}),[e.ws]),(0,b.useEffect)((function(){h.length>0&&(S&&S.sender.id!==e.sender.id&&s(!1),"promptBuilder"===S.format&&S.data.isLastQuestion&&n(!0))}),[h.length]),0!==h.length)return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,o.jsxs)(lr(),{open:l,onClose:function(){return u(!1)},"aria-labelledby":"quit-dialog-title","aria-describedby":"quit-dialog-description",sx:{"& .MuiPaper-root":{width:"clamp(320px,50vw,600px)",border:"1px solid ".concat(w.palette.divider)}},children:[(0,o.jsx)(dr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(Mt(),{}),(0,o.jsx)(Cr(),{children:(0,o.jsx)(Nr(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(kr(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(ze(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(I.A,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(ze(),{variant:"contained",color:"primary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(g(),{color:"text.secondary",children:"Prompt Builder"}),(0,o.jsx)(Mt(),{className:"rustic-prompt-builder-divider"}),(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!p&&h.length>0)return h.map((function(t){if(t.sender.id!==e.sender.id&&"promptBuilder"!==t.format)return(0,o.jsx)(L,{ws:k,sender:e.sender,messages:[t],supportedElements:e.supportedElements},t.id)}))}(),i&&(0,o.jsx)(q(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,o.jsx)(o.Fragment,{children:!p&&(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons",children:[(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,o.jsx)(ze(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(I.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(ze(),{variant:"outlined",color:"secondary",endIcon:(0,o.jsx)(I.A,{name:"chevron_right"}),onClick:function(){C(),j(null),s(!0)},disabled:!y,"aria-disabled":!y,children:"Next question"})]}),r&&(0,o.jsx)(T.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,o.jsx)(ze(),{variant:"contained",color:"primary",onClick:function(){C(),m(!0),s(!0),e.onSubmit()},disabled:i,"aria-disabled":i,children:"Generate"})})]})})]})}var Dr=function(){return Dr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Dr.apply(this,arguments)};function Ar(e){var t=Pe()(),r=e.prompts.map((function(r,n){return(0,o.jsx)($t(),{onClick:function(){return t=r,n=(new Date).toISOString(),a={id:(0,Y.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:V(t.toString())},void e.ws.send(a);var t,n,a},color:"secondary",size:"small",className:"rustic-prompt",sx:Dr(Dr({backgroundColor:t.palette.background.paper},"inConversation"===e.position&&{border:"1px solid ".concat(t.palette.divider)}),{"&:hover":{color:t.palette.text.primary,backgroundColor:t.palette.primary.hover}}),label:r},n)}));return(0,o.jsx)(f(),{className:e.className,children:r})}function Lr(e){var t=(0,b.useState)(""),r=t[0],n=t[1],a=(0,Be.useTheme)(),i=(0,Be.useMediaQuery)(a.breakpoints.down("md"))?"column":"row",s=e.options.map((function(t,a){return(0,o.jsx)($t(),{onClick:function(){return function(t){n(t);var r=(new Date).toISOString(),a={id:(0,Y.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:V(t.toString()),inReplyTo:e.messageId};e.ws.send(a)}(t)},color:"secondary",size:"small",sx:r===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!r,"aria-disabled":!!r,label:t},a)}));return(0,o.jsxs)(f(),{className:"rustic-question",children:[(e.title||e.description)&&(0,o.jsxs)(f(),{className:"rustic-question-text",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description})]}),(0,o.jsx)(Gt(),{direction:i,className:"rustic-options-container",children:s})]})}const Ir=require("@mui/material/Table");var Mr=a.n(Ir);const Rr=require("@mui/material/TableBody");var qr=a.n(Rr);const Br=require("@mui/material/TableCell");var _r=a.n(Br);const zr=require("@mui/material/TableContainer");var Hr=a.n(zr);const Wr=require("@mui/material/TableHead");var Ur=a.n(Wr);const Vr=require("@mui/material/TablePagination");var Gr=a.n(Vr);const Kr=require("@mui/material/TableRow");var Qr=a.n(Kr);const Yr=require("@mui/material/TableSortLabel");var $r,Xr=a.n(Yr),Zr=10;function Jr(){return(0,o.jsx)(I.A,{name:"expand_all"})}function en(e){if(0===e.data.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available"});var t,r,n,a=e.data.length>Zr,i=(0,b.useState)({}),s=i[0],c=i[1],l=(0,b.useState)(a?Zr:-1),u=l[0],d=l[1],p=(0,b.useState)(0),m=p[0],f=p[1],h=(0,Be.useTheme)(),v=Array.from(new Set(e.data.flatMap((function(e){return Object.keys(e)})))),x=e.headers||v.map((function(e){return{dataKey:e}})),y=(t=e.data,r=Object.keys(s)[0],n=s[r],r&&n?t.slice().sort((function(e,t){var r=Object.keys(s)[0],n=s[r];return e[r]<t[r]?n===$r.Descending?1:-1:e[r]>t[r]?n===$r.Descending?-1:1:0})):t),j=y.slice(m*u,m*u+u),S=u>0?j:y;function k(e){if(!s[e])return Jr}return(0,o.jsxs)(Gt(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(Hr(),{className:"rustic-table-container",children:(0,o.jsxs)(Mr(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[x.length>0&&(0,o.jsx)(Ur(),{children:(0,o.jsx)(Qr(),{children:x.map((function(e,t){return(0,o.jsx)(_r(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(de(),{title:(r=e.dataKey,n=s[r],n?Object.keys($r)[Object.values($r).indexOf(n)]:"Sort"),children:(0,o.jsx)(Xr(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c((function(t){var r,n,a={};switch(t[e]){case $r.Ascending:(r={})[e]=$r.Descending,a=r;break;case $r.Descending:a={};break;default:(n={})[e]=$r.Ascending,a=n}return a}))}(e.dataKey)},className:"rustic-table-header",IconComponent:k(e.dataKey),children:e.label||_(e.dataKey)})})},"header-".concat(t));var r,n}))})}),(0,o.jsx)(qr(),{children:S.map((function(e,t){return(0,o.jsx)(Qr(),{children:x.map((function(r,n){return(0,o.jsx)(_r(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))}))},"row-".concat(t))}))})]})}),a&&(0,o.jsx)(Gr(),{className:"rustic-table-pagination",component:"div",count:e.data.length,rowsPerPage:u,labelRowsPerPage:"Rows:",page:m,onPageChange:function(e,t){return f(t)},onRowsPerPageChange:function(e){d(+e.target.value),f(0)},sx:{"& .MuiTablePagination-selectLabel":{color:h.palette.text.disabled}},classes:{toolbar:"rustic-table-toolbar",input:"rustic-table-input",spacer:"rustic-table-spacer",displayedRows:"rustic-table-displayed-rows",actions:"rustic-table-actions"}})]})}!function(e){e.Ascending="asc",e.Descending="desc"}($r||($r={}));var tn=a(7447),rn=a.n(tn);const nn=function(e){var t=(0,b.useState)(rn().sanitize(e.text)),r=t[0],n=t[1],a=(0,b.useState)(""),i=a[0],s=a[1];return(0,b.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,a=e.updatedData;r<a.length;r++){var i=a[r];"string"!=typeof i.text&&(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")),t+=i.text}n(rn().sanitize(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g(),{variant:"body2",children:r}),i&&(0,o.jsx)(lt(),{severity:"error",children:i})]})},an=function(e){return(0,o.jsx)(g(),{variant:"body1",className:"rustic-text",children:rn().sanitize(e.text)})};var on=function(){return on=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},on.apply(this,arguments)},sn=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function cn(e){var t=e.title,r=void 0===t?"Embedded video":t,n=sn(e,["title"]),a=rn().sanitize(n.youtubeVideoId);return(0,o.jsx)("iframe",on({},W(n.width,n.height),{src:"https://www.youtube.com/embed/".concat(a),title:r,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",loading:"lazy"}))}const ln=require("@mui/material/FormControl");var un=a.n(ln);const dn=require("recharts");var pn=function(){return pn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},pn.apply(this,arguments)},mn={line:dn.LineChart,bar:dn.BarChart,area:dn.AreaChart};function fn(e){var t={};return e.forEach((function(e){t[e]=!0})),t}const hn=function(e){var t=e.minChartWidth,r=void 0===t?200:t,n=e.maxHeight,a=void 0===n?600:n,i=e.yAxisLabelWidth,s=void 0===i?30:i,c=e.aspectRatio,l=void 0===c?16/9:c,u=e.disableChartTypeToggle,d=void 0!==u&&u,p=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["minChartWidth","maxHeight","yAxisLabelWidth","aspectRatio","disableChartTypeToggle"]),m=(0,b.useState)(p.defaultChartType||"line"),f=m[0],h=m[1],v=(0,b.useState)(null),x=v[0],y=v[1],j=(0,b.useState)(p.timeSeries),S=j[0],k=j[1],O=Pe()(),C=S.length>0?Object.keys(S[0]):[],F=C[0],N=C.slice(1),E=(0,b.useState)(fn(N)),T=E[0],P=E[1];(0,b.useEffect)((function(){if(p.updatedData&&p.updatedData.length>0){var e=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([],p.timeSeries,!0);p.updatedData.forEach((function(t){e=e.concat(t.timeSeries),k(e)}))}}),[p.timeSeries,p.updatedData]);var D=mn[f];function A(e){x?y(null):e&&y(e.currentTarget)}function L(e,t){return T[e]?p.chartColors[t%p.chartColors.length]:"grey"}function M(e){return T[e]?"none":"line-through"}if(0===S.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available"});var R,q,B,_,H=p.timeSeries[p.timeSeries.length-1],W=(R=p.timeSeries[0][F],q=H[F],B=new Date(R),_=new Date(q),Math.round(Math.abs((_.getTime()-B.getTime())/864e5)));return(0,o.jsxs)(Zt(),{className:"rustic-recharts-time-series",children:[!d&&(0,o.jsxs)(un(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,o.jsx)(J(),{"aria-label":"chart options","aria-expanded":Boolean(x),"aria-haspopup":"true",onClick:A,color:"primary",children:(0,o.jsx)(I.A,{name:"more_vert"})}),(0,o.jsxs)(Ke(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:x,open:Boolean(x),onClose:function(e){return A(e)},children:[(0,o.jsx)(g(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(mn).map((function(e){return(0,o.jsxs)(ne(),{value:e,selected:e===f,onClick:function(){return function(e){h(e),A()}(e)},children:[e.charAt(0).toUpperCase()+e.slice(1)," ","Chart"]},e)}))]})]}),(0,o.jsxs)(Zt(),{children:[p.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-recharts-time-series-title",children:p.title}),p.description&&(0,o.jsx)(w.A,{text:p.description}),(0,o.jsx)(dn.ResponsiveContainer,{aspect:l,width:p.width,maxHeight:a,minWidth:r,children:(0,o.jsxs)(D,{data:S,margin:p.chartContainerMargin,children:[(0,o.jsx)(dn.XAxis,{dataKey:F,tickFormatter:function(e){return z(e,W)},stroke:O.palette.text.primary}),(0,o.jsx)(dn.YAxis,{domain:["auto","auto"],width:s,tickFormatter:p.yAxisTickFormatter,stroke:O.palette.text.primary}),(0,o.jsx)(dn.Tooltip,{labelFormatter:function(e){return[z(e,W)]},formatter:p.tooltipFormatter,contentStyle:{color:O.palette.common.black}}),(0,o.jsx)(dn.Legend,{content:function(){return(0,o.jsx)(Zt(),{className:"rustic-recharts-time-series-legend",children:N.map((function(e,t){return(0,o.jsxs)(Zt(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=T[e]&&!N.find((function(t){return t!==e&&T[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(T)){for(var n={},a=0,i=N;a<i.length;a++){var o=i[a],s=o===e;n[o]=s}P(n)}else P(r?fn(N):pn(pn({},T),((t={})[e]=!T[e],t)))}(e)},sx:{color:L(e,t)},children:[(0,o.jsx)(I.A,{name:"crop_16_9"}),(0,o.jsx)(g(),{variant:"body2",display:"inline",sx:{textDecorationLine:M(e)},children:e})]},t)}))})}}),N.map((function(e,t){return T[e]?function(e,t){var r=t%p.chartColors.length,n=T[e]?p.chartColors[r]:"transparent",a={onClick:p.onClick,cursor:"pointer"};switch(f){case"line":return(0,o.jsx)(dn.Line,{type:"monotone",isAnimationActive:!1,dataKey:e,name:e,dot:!1,stroke:n,activeDot:p.onClick&&a},e);case"bar":return(0,o.jsx)(dn.Bar,{dataKey:e,fill:n,onClick:p.onClick&&a.onClick,cursor:p.onClick&&a.cursor},e);case"area":return(0,o.jsxs)(b.Fragment,{children:[(0,o.jsx)("defs",{children:(0,o.jsxs)("linearGradient",{id:"color".concat(e),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,o.jsx)("stop",{offset:"5%",stopColor:n,stopOpacity:.8}),(0,o.jsx)("stop",{offset:"95%",stopColor:n,stopOpacity:0})]})}),(0,o.jsx)(dn.Area,{isAnimationActive:!1,dataKey:e,type:"monotone",stroke:n,fillOpacity:1,fill:"url(#color".concat(e,")"),activeDot:p.onClick&&a},e)]},e)}}(e,t):null})),p.referenceLineYAxis&&p.referenceLineYAxis.map((function(e,t){return(0,o.jsx)(dn.ReferenceLine,{y:e,label:p.referenceLineLabel&&p.referenceLineLabel[t],stroke:p.referenceLineColor&&p.referenceLineColor[t],strokeDasharray:"3 3",ifOverflow:"extendDomain",strokeWidth:p.referenceLineStrokeWidth&&p.referenceLineStrokeWidth[t],isFront:!0},t)}))]})})]})]})},vn=require("mermaid");var gn=a.n(vn),xn=function(){return xn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},xn.apply(this,arguments)};const yn=function(e){var t=(0,b.useRef)(null),r=(0,b.useState)(),n=r[0],a=r[1],i=Pe()(),s=(0,Y.v4)();return(0,b.useEffect)((function(){var r="dark"===i.palette.mode?"dark":"neutral",n=i.typography.fontFamily;t.current&&(gn().initialize(xn({theme:r,themeVariables:{fontFamily:n}},e.config)),gn().render("mermaid-svg-".concat(s),e.diagram,t.current).then((function(e){t.current&&(t.current.innerHTML=e.svg),a("")})).catch((function(){var e;null===(e=t.current)||void 0===e||e.replaceChildren(),a("Failed to render the diagram.")})))})),(0,o.jsxs)(Gt(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(g(),{variant:"body2",children:n})]})},bn=(require("@finos/perspective-viewer/dist/esm/perspective-viewer.inline.js"),require("@finos/perspective-viewer-datagrid"),require("@finos/perspective-viewer-d3fc"),require("@finos/perspective-viewer/dist/css/pro.css"),require("@finos/perspective-viewer/dist/css/pro-dark.css"),require("@finos/perspective/dist/esm/perspective.inline.js"));var jn=a.n(bn),wn=function(){return wn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},wn.apply(this,arguments)};function Sn(e){return e?e.reduce((function(e,t){var r=t.dataKey,n=t.label;return e[r]=n||r,e}),{}):{}}const kn=function(e){if(0===e.data.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available."});var t=(0,b.useRef)(null),r=(0,h.useTheme)(),n=(0,b.useState)(!1),a=n[0],i=n[1],s=r.palette.mode,c="dark"===s?"Pro Dark":"Pro Light",l=Sn(e.headers),u="\n /* General Button Styles */\n button, .button:hover, #editor-container, .editable, #settings_button {\n border-radius: 16px !important;\n color: ".concat(r.palette.text.primary," !important;\n /* TODO: add background color after updating the theme */\n }\n \n #settings_button {\n border: 1px solid ").concat(r.palette.primary.light," !important;\n }\n \n /* Hide border for aggregate Selector */\n .aggregate-selector:hover {\n border: none !important;\n }\n \n /* Input and Select Elements */\n input, select, .noselect, #add-expression, .dropdown-width-container, \n .pivot-column-border, .pivot-column, .column-selector-column-border {\n border-radius: 8px !important;\n }\n \n /* Change background color */\n #settings_panel, #column_settings_sidebar {\n background: ").concat("dark"===s?"dark":"white"," !important;\n background-image: none !important;\n }\n \n /* Expression Edit Button */\n .expression-edit-button {\n display: none;\n }\n \n /* Add padding to expression input */\n #editor-container, .editable {\n padding: 8px !important;\n }\n \n /* Change Button Font Size */\n .button select, .button {\n font-size: 12px !important;\n }\n \n /* Button and Icon Colors */\n #status_bar .hover-target:hover .button>span {\n display:none !important;\n }\n \n #status_bar .hover-target.modal-target .button>span {\n display:none !important;\n }\n \n .button select:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(r.palette.primary.light," !important;\n }\n \n /* Hide unused buttons */\n #debug_open_button.sidebar_close_button, .reset-default-style-disabled, \n .expression-edit-button, #theme, #status, #status_bar .input-sizer {\n display: none !important;\n }\n \n #status_bar .hover-target:hover, #status_bar .hover-target.modal-target {\n height: fit-content !important;\n }\n\n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: auto !important;\n }\n\n #settings_button:hover {\n color: ").concat(r.palette.primary.contrastText," !important;\n background-color: ").concat(r.palette.primary.main," !important;\n }\n ");var d,p,m,f,v,x,y,j,S,k=e.config&&(p=(d=e.config).groupBy,m=d.splitBy,f=d.aggregates,v=d.sort,x=d.filter,y=d.columns,j=null==v?void 0:v.map((function(e){return[l[e[0]]||e[0],e[1]]})),S=f&&Object.fromEntries(Object.entries(f).map((function(e){var t=e[0],r=e[1];return[l[t]||t,r]}))),{group_by:null==p?void 0:p.map((function(e){return l[e]||e})),split_by:null==m?void 0:m.map((function(e){return l[e]||e})),aggregates:S,sort:j,filter:x&&function(e){return e.map((function(e){return[l[e[0]]||e[0],e[1],e[e.length-1]]}))}(x),columns:null==y?void 0:y.map((function(e){return l[e]||e}))});return(0,b.useEffect)((function(){jn().worker().then((function(t){return t.table(function(e,t){var r=Sn(t);return e.map((function(e){for(var t={},n=0,a=Object.entries(e);n<a.length;n++){var i=a[n],o=i[0],s=i[1];t[r[o]||o]=s}return t}))}(e.data,e.headers))})).then((function(r){var n=t.current;n&&n.load(r).then((function(){n.restore(wn(wn({},k),{theme:c,title:e.title,settings:!1})).then((function(){var t,r=null===(t=e.config)||void 0===t?void 0:t.expansionDepth;if("number"==typeof r&&n.getView().then((function(e){return e.set_depth(r).then((function(){n.resize()}))})),n.shadowRoot){var a=new CSSStyleSheet;a.replaceSync(u),n.shadowRoot.adoptedStyleSheets.push(a)}}))})).catch((function(){i(!0)}))}))}),[e.data,c]),a?(0,o.jsx)(g(),{variant:"body2",children:"Failed to create table from data."}):(0,o.jsxs)(Ee(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},On=require("react-plotly.js");var Cn=a.n(On),Fn=function(){return Fn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Fn.apply(this,arguments)};const Nn=function(e){var t=Fn(Fn({},e.plotParams),{className:"rustic-plotly"});return t.config=Fn(Fn({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(Zt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(Cn(),Fn({},t))]})},En=require("react-dom/server"),Tn=require("vega-embed");var Pn=a.n(Tn),Dn=function(){return Dn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Dn.apply(this,arguments)};const An=function(e){var t=e.theme,r=void 0===t?{dark:"dark"}:t,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["theme"]),a=(0,b.useRef)(null),i=(0,b.useState)(!1),s=i[0],c=i[1],l=Pe()(),u="dark"===l.palette.mode,d=l.typography.fontFamily,p={backgroundColor:l.palette.primary.main,color:l.palette.background.paper,borderRadius:l.shape.borderRadius+"px",padding:"4px 8px",fontSize:l.typography.caption.fontSize,fontFamily:d,fontWeight:l.typography.caption.fontWeight},m={formatTooltip:function(e,t){return(0,En.renderToStaticMarkup)((0,o.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:p,children:Object.entries(e).map((function(e){var r=e[0],n=e[1];return(0,o.jsxs)("div",{children:[(0,o.jsxs)("strong",{children:[t(r),":"]})," ",t(n)]},r)}))}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},f=[{label:"Save as SVG"},{label:"Save as PNG"}];function h(){var e,t;if(a.current&&n.spec){var i=Dn(Dn({config:{font:d}},n.options),{theme:u?r.dark:r.light,tooltip:m,actions:!1});(null===(t=null===(e=n.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(i.config.font=d);var o=Dn({},n.spec);delete o.title,Pn()(a.current,o,i).then((function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map((function(n,a){var i="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,i).then((function(e){f[a].href=e,f[a].downloadFileName="".concat(r,".").concat(n)}))})),c(!1)})).catch((function(){c(!0)}))}}return(0,b.useEffect)((function(){function e(){h()}return h(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[n.spec,u]),s?(0,o.jsx)(g(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(Ee(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(Zt(),{justifyContent:"end",display:"flex",children:(0,o.jsx)(Ye,{menuItems:f,ariaLabel:"Download options"})}),n.title&&(0,o.jsx)(g(),{variant:"h6",children:n.title}),n.description&&(0,o.jsx)(w.A,{text:n.description}),(0,o.jsxs)(Zt(),{textAlign:"center",mt:1,children:["string"==typeof n.spec.title&&(0,o.jsx)(g(),{variant:"subtitle2",children:n.spec.title}),n.spec.description&&(0,o.jsx)(g(),{variant:"caption",children:n.spec.description})]}),(0,o.jsx)("div",{ref:a,className:"rustic-vega-lite"})]})};function Ln(e){var t=(0,b.useState)(e.units),r=t[0],n=t[1];function a(t){return"metric"===e.units&&"imperial"===r?Math.round(1.8*t+32):"imperial"===e.units&&"metric"===r?Math.round(t*(5/9)-32):Math.round(t)}var i=new Date(1e3*e.weather[0].timestamp),s=U(e.weather[0].timestamp).shortName,c=i.getDate(),l=i.getFullYear().toString().slice(2),u="".concat(s," ").concat(c,"/").concat(l," TODAY"),d="HIGH: ".concat(a(e.weather[0].temp.high)," / LOW: ").concat(a(e.weather[0].temp.high)),p=e.weather.map((function(e,t){if(0!==t)return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(g(),{variant:"h5",component:"span",color:"text.secondary","aria-label":U(e.timestamp).fullName,children:U(e.timestamp).shortName}),(0,o.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,o.jsxs)(g(),{variant:"body2",color:"text.secondary",children:["High: ",a(e.temp.high),"°"]}),(0,o.jsxs)(g(),{variant:"body2",color:"text.secondary",children:["Low: ",a(e.temp.low),"°"]})]},t)}));return(0,o.jsxs)(Oe(),{variant:"outlined",className:"rustic-weather",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(Ye,{ariaLabel:"Temperature units",menuItems:[{label:"Celsius",endDecorator:"°C",onClick:function(){return n("metric")}},{label:"Fahrenheit",endDecorator:"°F",onClick:function(){return n("imperial")}}]}),(0,o.jsxs)(Gt(),{alignItems:"center",children:[(0,o.jsx)(g(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)(Gt(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-current-weather-description",children:[(0,o.jsx)("img",{src:e.weather[0].weatherIcon.icon,alt:""}),(0,o.jsx)(g(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(g(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[a(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(r)]}),(0,o.jsxs)(Gt(),{direction:"row",spacing:2,children:[(0,o.jsx)(g(),{variant:"overline",children:u}),(0,o.jsx)(g(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:p}),e.weatherProvider&&(0,o.jsxs)(Gt(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(I.A,{name:"cloud"}),(0,o.jsx)(g(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}var In=a(9517);return i})()));
|
|
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,t,r={9528:(e,t,r)=>{r.d(t,{UniformsForm:()=>h});var n=r(8732),a=r(6989),i=r.n(a),o=r(785),s=r.n(o);const c=require("ajv");var l=r.n(c),u=r(2015);const d=require("uniforms-bridge-json-schema"),p=require("uniforms-mui");var m=r(3903),f=r(227);function h(e){var t=(0,u.useState)(e.data),r=t[0],a=t[1];(0,u.useEffect)((function(){e.data&&a(e.data)}),[e.data]);var o,c,h=new(l())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),v=(o=e.schema,c=h.compile(o),function(e){var t;return c(e),(null===(t=c.errors)||void 0===t?void 0:t.length)?{details:c.errors}:null}),g=new d.JSONSchemaBridge({schema:e.schema,validator:v});return(0,n.jsxs)(i(),{className:"rustic-form",children:[e.title&&(0,n.jsx)(s(),{variant:"h6",children:e.title}),e.description&&(0,n.jsx)(f.A,{text:e.description}),(0,n.jsx)(p.AutoForm,{schema:g,onSubmit:function(t){return function(t){var r=(new Date).toISOString(),n={id:(0,m.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"formResponse",data:{data:t,inReplyTo:e.messageId}};a(t),e.ws.send(n)}(t)},model:r,disabled:!!r})]})}},9767:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(8732),a=(r(2015),function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},a.apply(this,arguments)});function i(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(4409),r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>d,L:()=>u});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o),c=r(3840),l=r(2015);function u(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=c.marked.parse(t,{async:!1});return s().sanitize(r)}const d=function(e){var t=(0,l.useState)(u(e.text)),r=t[0],a=t[1];return(0,l.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(u(t))}}),[e.text,e.updatedData]),(0,n.jsx)(i(),{variant:"body1",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:r}})}},4409:(e,t,r)=>{r.d(t,{A:()=>u});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),c=r(2015),l=r(227);const u=function(e){var t=(0,c.useState)((0,l.L)(e.text)),r=t[0],a=t[1],o=(0,c.useState)(""),u=o[0],d=o[1];return(0,c.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,n=e.updatedData;r<n.length;r++){var i=n[r];"string"!=typeof i.text?(t+=" [MISSING TEXT]",d("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=i.text}a((0,l.L)(t))}}),[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),u&&(0,n.jsx)(i(),{severity:"error",children:u})]})}},4445:(e,t,r)=>{r.d(t,{default:()=>c});var n=r(8732),a=r(909),i=r.n(a),o=r(4603),s=r.n(o);r(2015),r(7159);const c=function(e){return(0,n.jsx)(s(),{title:e.label,children:(0,n.jsx)(i(),{color:"inherit","aria-label":e.label,onClick:function(t){t.stopPropagation(),t.preventDefault(),e.onClick(e.message)},className:"rustic-message-actions",children:e.icon})})}},7159:(e,t,r)=>{var n,a;r.d(t,{s:()=>n,y:()=>a}),function(e){e.Owner="owner",e.Member="member"}(n||(n={})),function(e){e.Human="human",e.Agent="agent"}(a||(a={}))},9517:(e,t,r)=>{r.d(t,{generateTheme:()=>m,rusticDarkTheme:()=>h,rusticLightTheme:()=>f});var n=r(6182);const a=require("lodash");var i=r.n(a),o=function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},o.apply(this,arguments)},s=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function c(e){var t={};return Object.keys(e).forEach((function(r){var n=r.match(/^([a-z]+)([A-Z].*)$/);if(n){n[0];var a=n[1],o=n[2],s="".concat(a.toLowerCase(),".").concat(i().camelCase(o));i().set(t,s,e[r])}else i().set(t,r.toLowerCase(),e[r])})),t}var l={lightMode:{commonBlack:"#000000",commonWhite:"#FFFFFF",divider:"#E1D9D5",backgroundPaper:"#FFFFFF",backgroundDefault:"#F4F4F4",textPrimary:"#1E0C04",textSecondary:"#4E443F",textDisabled:"#727272",actionActive:"rgba(0, 0, 0, 0.56)",actionHover:"rgba(0, 0, 0, 0.08)",actionSelected:"rgba(0, 0, 0, 0.16)",actionFocus:"rgba(0, 0, 0, 0.12)",actionDisabledBackground:"rgba(0, 0, 0, 0.12)",actionDisabled:"rgba(0, 0, 0, 0.38)",primaryMain:"#2D2825",primaryLight:"rgba(45, 40, 37, 0.60)",primaryDark:"#000000",primaryContrastText:"#FFFFFF",primaryHover:"rgba(45, 40, 37, 0.08)",primarySelected:"rgba(45, 40, 37, 0.16)",primaryFocus:"rgba(45, 40, 37, 0.12)",primaryFocusVisible:"rgba(45, 40, 37, 0.30)",primaryOutlinedBorder:"rgba(45, 40, 37, 0.50)",secondaryMain:"#FF6928",secondaryDark:"#E54500",secondaryLight:"rgba(255, 105, 40, 0.60)",secondaryContrast:"#FFFFFF",secondaryHover:"rgba(255, 105, 40, 0.08)",secondarySelected:"rgba(255, 105, 40, 0.16)",secondaryFocus:"rgba(255, 105, 40, 0.12)",secondaryFocusVisible:"rgba(255, 105, 40, 0.30)",secondaryOutlinedBorder:"rgba(255, 105, 40, 0.50)",successMain:"#007F51",successDark:"#014F33",successLight:"#00D788",successContrastText:"#000000",errorMain:"#F82A43",errorDark:"#C82639",errorLight:"#FF9BA7",errorContrastText:"#000000",warningMain:"#FFB800",warningDark:"#DC8400",warningLight:"#FFDB7D",warningContrastText:"#000000",infoMain:"#0094FF",infoDark:"#005A9B",infoLight:"#8CCFFF",infoContrastText:"#000000"},darkMode:{commonBlack:"#000000",commonWhite:"#FFFFFF",divider:"#E1D9D5",backgroundPaper:"#202020",backgroundDefault:"#2C2C2C",textPrimary:"#FFFFFF",textSecondary:"rgba(255, 255, 255, 0.70)",textDisabled:"rgba(255, 255, 255, 0.38)",actionActive:"rgba(255, 255, 255, 0.60)",actionHover:"rgba(255, 255, 255, 0.30)",actionSelected:"rgba(255, 255, 255, 0.16)",actionFocus:"rgba(255, 255, 255, 0.12)",actionDisabledBackground:"rgba(255, 255, 255, 0.12)",actionDisabled:"rgba(255, 255, 255, 0.38)",primaryMain:"#FFFCFB",primaryLight:"rgba(255, 252, 251, 0.60)",primaryDark:"#FFFFFF",primaryContrastText:"rgba(0, 0, 0, 0.87)",primaryOutlinedBorder:"rgba(255, 252, 251, 0.50)",primaryFocus:"rgba(255, 252, 251, 0.12)",primaryFocusVisible:"rgba(255, 252, 251, 0.30)",primaryHover:"rgba(255, 252, 251, 0.08)",primarySelected:"rgba(255, 252, 251, 0.16)",secondaryMain:"#FF6928",secondaryDark:"#E54500",secondaryLight:"rgba(255, 105, 40, 0.60)",secondaryContrastText:"rgba(0, 0, 0, 0.87)",secondaryHover:"rgba(255, 105, 40, 0.08)",secondarySelected:"rgba(255, 105, 40, 0.16)",secondaryFocus:"rgba(255, 105, 40, 0.12)",secondaryFocusVisible:"rgba(255, 105, 40, 0.30)",secondaryOutlinedBorder:"rgba(255, 105, 40, 0.50)",successMain:"#00B775",successDark:"#01784D",successLight:"#00E390",successContrastText:"rgba(0, 0, 0, 0.87)",errorMain:"#F82A43",errorDark:"#C82639",errorLight:"#FF9BA7",errorContrastText:"rgba(0, 0, 0, 0.87)",warningMain:"#FFB800",warningDark:"#DC8400",warningLight:"#FFDB7D",warningContrastText:"rgba(0, 0, 0, 0.87)",infoMain:"#0094FF",infoDark:"#005A9B",infoLight:"#8CCFFF",infoContrastText:"rgba(0, 0, 0, 0.87)"}},u={fontSize:"12px",lineHeight:1.5,letterSpacing:"0.5px",padding:"0 12px",minHeight:"26px"},d={fontSize:"14px",lineHeight:1.43,letterSpacing:"0.25px",padding:"0 16px",minHeight:"40px"},p={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"};function m(e,t){var r="light"===e?t.lightMode:t.darkMode;return{shape:{borderRadius:16},typography:{fontFamily:"Inter",h1:{fontStyle:"normal",fontWeight:300,fontSize:"94px",lineHeight:1.167,letterSpacing:"-1.5px"},h2:{fontStyle:"normal",fontWeight:300,fontSize:"59px",letterSpacing:"-2px",lineHeight:1.2},h3:{fontStyle:"normal",fontWeight:400,fontSize:"47px",letterSpacing:"0px",lineHeight:1.167},h4:{fontStyle:"normal",fontWeight:400,fontSize:"33px",letterSpacing:"0px",lineHeight:1.235},h5:{fontStyle:"normal",fontWeight:400,fontSize:"24px",letterSpacing:"0px",lineHeight:1.334},h6:{fontStyle:"normal",fontWeight:500,fontSize:"20px",letterSpacing:"0px",lineHeight:1.6},body1:{fontStyle:"normal",fontWeight:400,fontSize:"16px",letterSpacing:"0px",lineHeight:1.5},body1Bold:{fontStyle:"normal",fontWeight:600,fontSize:"16px",letterSpacing:"0px",lineHeight:1.5},body2:{fontStyle:"normal",fontWeight:400,fontSize:"14px",letterSpacing:"0px",lineHeight:1.43},subtitle1:{fontStyle:"normal",fontWeight:400,fontSize:"16px",letterSpacing:"0px",lineHeight:1.75},subtitle2:{fontStyle:"normal",fontWeight:500,fontSize:"14px",letterSpacing:"0px",lineHeight:1.57},overline:{fontStyle:"normal",fontWeight:400,fontSize:"10px",letterSpacing:"0px",lineHeight:1.5,textTransform:"uppercase"},caption:{fontStyle:"normal",fontWeight:400,fontSize:"12px",letterSpacing:"0px",lineHeight:1.66},button:{textTransform:"none",fontWeight:700}},shadows:s([],(0,n.createTheme)({}).shadows.map((function(e,t){return 1===t?"0 4px 5px rgba(0, 0, 0, 0.05)":2===t?"0 4px 10px rgba(0, 0, 0, 0.1)":3===t?"0 4px 15px rgba(0, 0, 0, 0.15)":"none"})),!0),palette:o({mode:e},c(r)),components:{MuiTooltip:{styleOverrides:{tooltip:"light"===e?{backgroundColor:r.commonBlack,color:r.commonWhite}:{backgroundColor:r.commonWhite,color:r.commonBlack}}},MuiTableCell:{styleOverrides:{head:{backgroundColor:r.actionFocus},root:{borderBottom:"1px solid ".concat(r.divider),padding:"8px 16px"}}},MuiTableSortLabel:{styleOverrides:{root:{"&.Mui-active":{"& .MuiTableSortLabel-icon":{color:r.textPrimary}}}}},MuiPopover:{styleOverrides:{paper:{border:"1px solid ".concat(r.divider),backgroundImage:"none"}}},MuiButton:{styleOverrides:{root:{"&.MuiButton-sizeSmall":o({},u),"&.MuiButton-sizeMedium":o({borderRadius:"24px"},d),"&.MuiButton-sizeLarge":o({borderRadius:"32px"},p),"&.Mui-disabled":{background:r.backgroundPaper,color:r.textDisabled,border:"1px solid ".concat(r.actionDisabled)}},containedPrimary:{background:r.primaryMain,color:r.primaryContrastText,"&:hover":{background:r.primaryLight},"&:active":{background:r.primaryMain,outline:"2px solid ".concat(r.primaryLight)}},containedSecondary:{"&:hover":{background:r.secondaryLight},"&:active":{background:r.secondaryMain,outline:"2px solid ".concat(r.secondaryLight)}},outlinedSecondary:{color:r.textPrimary,"&:hover":{border:"1px solid ".concat(r.secondaryDark),background:r.secondaryFocus},"&:active":{outline:"2px solid ".concat(r.secondaryLight)}},textSecondary:{color:r.textPrimary,"&:hover":{background:r.secondaryFocus},"&.Mui-disabled":{border:"none"}}}},MuiChip:{styleOverrides:{root:{"& .MuiChip-icon":{margin:"0px 8px 0px 0px"},"& .MuiChip-label":{padding:0,display:"flex",alignItems:"center",gap:"8px"},"&.MuiChip-sizeSmall":o({},u),"&.MuiChip-sizeMedium":o({borderRadius:"24px"},d),"&.MuiChip-sizeLarge":o({borderRadius:"32px"},p),color:r.textPrimary,background:r.backgroundPaper,"&.Mui-disabled":{opacity:1,background:r.backgroundPaper,color:r.textDisabled,border:"1px solid ".concat(r.actionDisabled)}},colorPrimary:{border:"1px solid ".concat(r.textPrimary),"&:hover":{color:r.primaryContrastText},"&:active":{outline:"2px solid ".concat(r.primaryLight)}},colorSecondary:{border:"1px solid ".concat(r.secondaryMain),"&:hover":{color:r.primaryContrastText,background:r.secondaryMain},"&:active":{outline:"2px solid ".concat(r.secondaryLight)}}}}}}}var f=(0,n.createTheme)(m("light",l)),h=(0,n.createTheme)(m("dark",l));f=(0,n.responsiveFontSizes)(f),h=(0,n.responsiveFontSizes)(h)},5642:e=>{e.exports=require("@mui/material/Alert")},6989:e=>{e.exports=require("@mui/material/Box")},909:e=>{e.exports=require("@mui/material/IconButton")},4603:e=>{e.exports=require("@mui/material/Tooltip")},785:e=>{e.exports=require("@mui/material/Typography")},6182:e=>{e.exports=require("@mui/material/styles")},7447:e=>{e.exports=require("dompurify")},8342:e=>{e.exports=require("emoji-picker-element")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")},3903:e=>{e.exports=require("uuid")}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,a),i.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var i=Object.create(null);a.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>r[e]));return o.default=()=>r,a.d(i,o),i},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};a.r(i),a.d(i,{Action:()=>_t.default,ChatCompletion:()=>ar,CodeSnippet:()=>P,CopyText:()=>zt,ElementRenderer:()=>I,FCCalendar:()=>k,Icon:()=>L.A,Image:()=>G,MarkedMarkdown:()=>w.A,MarkedStreamingMarkdown:()=>yt.A,MermaidViz:()=>sn,MessageCanvas:()=>Gt,MessageSpace:()=>tr,MultimodalInput:()=>rt,Multipart:()=>ir,OpenLayersMap:()=>bt,PDFViewer:()=>De,ParticipantRole:()=>xr.s,ParticipantType:()=>xr.y,ParticipantsContainer:()=>yr,PerspectiveViz:()=>pn,PlotlyGraph:()=>vn,PopoverMenu:()=>Ke,PromptBuilder:()=>Nr,Prompts:()=>Pr,Question:()=>Dr,Sound:()=>Mt,StreamingText:()=>tn,Table:()=>Zr,Text:()=>rn,TextInput:()=>it,TextToSpeech:()=>Ht,Timestamp:()=>Vt,UniformsForm:()=>D.UniformsForm,Uploader:()=>Xe,VegaLiteViz:()=>jn,Video:()=>Bt,Weather:()=>wn,generateTheme:()=>Sn.generateTheme,rusticDarkTheme:()=>Sn.rusticDarkTheme,rusticLightTheme:()=>Sn.rusticLightTheme});var o=a(8732);const s=require("@fullcalendar/daygrid");var c=a.n(s);const l=require("@fullcalendar/react");var u=a.n(l);const d=require("@fullcalendar/timegrid");var p=a.n(d),m=a(6989),f=a.n(m),h=a(6182),v=a(785),g=a.n(v);const x=require("@mui/material/useMediaQuery");var b=a.n(x),y=a(2015),j=a.n(y),w=a(227),S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},S.apply(this,arguments)};function F(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}function k(e){var t=(0,h.useTheme)(),r=b()(t.breakpoints.up("md"));return(0,o.jsxs)(f(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),".fc .fc-toolbar-title":S({},t.typography.h6),".fc .fc-scrollgrid-liquid":{borderRadius:"".concat(t.shape.borderRadius,"px")},".fc td":{borderRadius:"0 0 ".concat(t.shape.borderRadius,"px ").concat(t.shape.borderRadius,"px")},".fc .fc-scrollgrid-section-header > th":{borderRadius:"".concat(t.shape.borderRadius,"px ").concat(t.shape.borderRadius,"px 0 0")},".fc .fc-button, .fc .fc-button:active":{color:t.palette.primary.main,backgroundColor:t.palette.background.paper,border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),"&:hover":{backgroundColor:t.palette.secondary.light,border:"1px solid ".concat(t.palette.divider)}},".fc .fc-button-group .fc-button.fc-button-active":{backgroundColor:t.palette.secondary.main,border:"1px solid ".concat(t.palette.divider)},".fc a, .fc .fc-event-title, .fc .fc-button, .fc .fc-timegrid-slot":S({},t.typography.caption)},children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(u(),{plugins:[p(),c()],initialView:r?"dayGridMonth":"timeGridDay",headerToolbar:{left:"title",right:"prev,next dayGridMonth,timeGridWeek,timeGridDay"},eventColor:t.palette.secondary.main,displayEventTime:!1,titleFormat:{year:"numeric",month:"long"},views:{dayGridMonth:{dayHeaderFormat:{weekday:r?"long":"narrow"}},timeGridWeek:{dayHeaderFormat:{weekday:"short",day:"numeric"}},timeGridDay:{dayHeaderFormat:{weekday:"long",day:"numeric"}}},allDaySlot:!1,initialDate:e.events[0].start,events:e.events.map(F)})]})}const C=require("@codemirror/language"),O=require("@codemirror/language-data"),E=require("@codemirror/state"),N=require("@codemirror/view"),T=require("@mui/system");function P(e){var t=(0,y.useRef)(null),r=(0,y.useRef)(),n=new E.Compartment,a=[E.EditorState.readOnly.of(!0),(0,N.highlightSpecialChars)(),(0,C.syntaxHighlighting)(C.defaultHighlightStyle,{fallback:!0}),n.of([])],i=O.languages.find((function(t){return t.name.toLowerCase()===e.language.toLowerCase()}));return(0,y.useEffect)((function(){if(t.current&&!r.current){var o=t.current,s=E.EditorState.create({doc:e.code,extensions:a});r.current=new N.EditorView({state:s,parent:o}),i&&r.current&&i.load().then((function(e){var t;null===(t=r.current)||void 0===t||t.dispatch({effects:n.reconfigure(e.extension)})}))}}),[]),(0,o.jsxs)(T.Box,{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(T.Box,{className:"rustic-code-snippet",sx:{backgroundColor:"background.default"},"aria-label":"code snippet",ref:t,children:(0,o.jsx)(g(),{variant:"body2","aria-label":"language type",children:e.language})})]})}var D=a(9528),A=function(){return A=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},A.apply(this,arguments)};const I=function(e){var t=e.messages[0],r=e.messages.slice(1),n=e.supportedElements[t.format];return(0,o.jsx)(o.Fragment,{children:n?j().createElement(n,A(A({sender:e.sender,ws:e.ws,messageId:t.id,conversationId:t.conversationId},t.data),r.length>0&&{updatedData:r.map((function(e){return e.data}))})):(0,o.jsxs)(g(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var L=a(9767);const M=require("@mui/material/CircularProgress");var q,R=a.n(M),B=function(){return B=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},B.apply(this,arguments)},_=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function z(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60),a=t>0?"".concat(t,":"):"",i="".concat(t>0?r.toString().padStart(2,"0"):r),o=n.toString().padStart(2,"0");return"".concat(a).concat(i,":").concat(o)}function H(e){var t=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"][new Date(1e3*e).getDay()];return{shortName:t,fullName:{Sun:"Sunday",Mon:"Monday",Tues:"Tuesday",Wed:"Wednesday",Thurs:"Thursday",Fri:"Friday",Sat:"Saturday"}[t]}}function U(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(q||(q={}));var W=function(){return W=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},W.apply(this,arguments)},V=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function G(e){var t,r,n,a=e.alt,i=void 0===a?"An image is displayed":a,s=V(e,["alt"]),c=(0,y.useState)(!0),l=c[0],u=c[1],d=(0,y.useState)(""),p=d[0],m=d[1];return p.length>0?(0,o.jsx)(g(),{variant:"body2",children:p}):(0,o.jsxs)("figure",{children:[l&&(0,o.jsx)(R(),{}),s.title&&(0,o.jsx)(g(),{variant:"h6",children:s.title}),(0,o.jsx)("img",W({},(t=s.width,r=s.height,n={},t&&(n={width:t}),r&&(n=B(B({},n),{height:r})),t||r||(n={className:"rustic-fit-container"}),n),{src:s.src,alt:i,onError:function(){m("Image failed to load"),u(!1)},onLoad:function(){u(!1)}})),s.description&&(0,o.jsx)("figcaption",{children:(0,o.jsx)(w.A,{text:s.description})})]})}var K=a(3903);const Q=require("@mui/material/Avatar");var $=a.n(Q),Y=a(909),X=a.n(Y);const Z=require("@mui/material/InputAdornment");var J=a.n(Z);const ee=require("@mui/material/MenuItem");var te=a.n(ee);const re=require("@mui/material/MenuList");var ne=a.n(re);const ae=require("@mui/material/Popover");var ie=a.n(ae);const oe=require("@mui/material/TextField");var se=a.n(oe),ce=a(4603),le=a.n(ce),ue=a(8342);const de=function(e){var t=(0,h.useTheme)(),r=(0,y.useRef)(null),n=(0,y.useRef)(null),i=(0,y.useState)(!1),s=i[0],c=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function u(){c(!1)}function d(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),u()}return(0,y.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(a.t.bind(a,8342,23)).then((function(r){var a=new(0,r.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";a.classList.add(i),Object.keys(l).forEach((function(e){a.style.setProperty(e,l[e])})),n.current=a})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,y.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",d),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",d)}}),[s,e.onEmojiClick]),(0,o.jsxs)("div",{children:[(0,o.jsx)(le(),{title:"Emoji",children:(0,o.jsx)(X(),{size:"small",ref:r,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(L.A,{name:"Mood"})})}),n.current&&(0,o.jsx)(ie(),{open:s,anchorEl:r.current,onClose:u,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,o.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var pe={"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 me(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function fe(e){return(0,o.jsxs)(f(),{className:"rustic-participant-profile",children:[(0,o.jsx)($(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(g(),{variant:"body1Bold",children:e.displayName})]})}function he(e){var t=e.items,r=e.isOpen,n=e.onClose,a=e.onSelect,i=e.renderItem,s=e.anchorEl,c=e.selectedIndex;return(0,o.jsx)(ie(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:s,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,o.jsx)(ne(),{children:t.map((function(e,t){return(0,o.jsx)(te(),{onClick:function(){return a(e)},selected:t===c,children:i(e)},t)}))})})}const ve=(0,y.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,a=e.fullWidth,i=void 0===a||a,s=e.maxRows,c=void 0===s?6:s,l=e.enableSpeechToText,u=void 0!==l&&l,d=e.maximumEmojiSearchResults,p=void 0===d?5:d,m=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),h=(0,y.useState)(""),v=h[0],x=h[1],b=(0,y.useState)(!1),j=b[0],w=b[1],S=(0,y.useState)(!1),F=S[0],k=S[1],C=(0,y.useState)(!1),O=C[0],E=C[1],N=(0,y.useState)(""),T=N[0],P=N[1],D=(0,y.useState)([]),A=D[0],I=D[1],M=(0,y.useState)(!1),q=M[0],B=M[1],_=(0,y.useState)(0),z=_[0],H=_[1],U=(0,y.useRef)(null),W=new ue.Database({dataSource:m.emojiDataSource}),V=!v.trim().length,G="".concat(j?"Stop":"Start"," speech to text"),Q=F?"primary.main":"primary.light",$=j?"error.main":Q,Y=j?"stop_circle":"speech_to_text",Z=(0,y.useState)([]),ee=Z[0],te=Z[1],re=(0,y.useState)(!1),ne=re[0],ae=re[1];function ie(){return"boolean"==typeof m.isSendEnabled?!m.isSendEnabled:V}function oe(e,t){if(U.current){var r=U.current,n=r.selectionStart,a=r.selectionEnd;if("number"==typeof n&&"number"==typeof a){var i,o=v||"",s=o.substring(0,n),c=o.substring(a),l=void 0;t?(l=s.replace(t,e)+c,i=s.replace(t,e).length):(l=s+e+c,i=n+e.length),x(l),setTimeout((function(){var e,t;null===(e=U.current)||void 0===e||e.focus(),null===(t=U.current)||void 0===t||t.setSelectionRange(i,i)}),0)}}}function ce(e){oe("@".concat(e," "),/@(\w*)$/),te([])}function ve(e,t){void 0===t&&(t=!1),oe(e,t?/:(\w+)$/:void 0),B(!1)}var ge=O?(0,o.jsx)(R(),{size:24}):(0,o.jsx)(le(),{title:G,children:(0,o.jsx)(X(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,j?(e.stop(),E(!0),w(!1)):(e.start(),P(""),w(!0)),e.onstart=function(){w(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;v.length>0?x(v+" "+r):x(r),null===(t=U.current)||void 0===t||t.focus(),w(!1)},e.onerror=function(e){var t=pe[e.error];P(t),w(!1)},e.onend=function(){E(!1),w(!1)}},size:"small",sx:{color:$,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(L.A,{name:Y})})});function xe(){var e=(new Date).toISOString(),t={id:(0,K.v4)(),timestamp:e,sender:m.sender,conversationId:m.conversationId,format:"chatCompletionRequest",data:{text:v}};m.send(t),x(""),P("")}return(0,o.jsxs)(f(),{className:"rustic-base-input",ref:t,children:[(0,o.jsxs)(f(),{className:"rustic-error-and-input-container",children:[(0,o.jsx)(f(),{className:"rustic-error-container",children:(0,o.jsx)(g(),{variant:"caption",color:"error",className:"rustic-error-message",children:T})}),(0,o.jsxs)(f(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:F?"secondary.main":"action.disabled"},children:[A.length>0&&U.current&&(0,o.jsx)(he,{anchorEl:U.current,items:A.filter((function(e){return"unicode"in e})),isOpen:q,onClose:function(){B(!1),H(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:z,renderItem:me}),ee.length>0&&U.current&&(0,o.jsx)(he,{anchorEl:U.current,items:ee,isOpen:ne,onClose:function(){ae(!1),H(0)},onSelect:function(e){return ce(e.displayName)},renderItem:fe,selectedIndex:z}),(0,o.jsx)(se(),{className:"rustic-text-field",variant:"outlined",value:v,label:m.label,placeholder:m.placeholder,maxRows:c,multiline:n,fullWidth:i,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),q&&A.length>0&&"unicode"in A[z]?ve(A[z].unicode,!0):ne&&ee.length>0?ce(ee[z].displayName):e.shiftKey||ie()||xe();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(q?H((function(e){return(e+t+A.length)%A.length})):ne&&H((function(e){return(e+t+ee.length)%ee.length})));0!==z&&H(0)}},onChange:function(e){P("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&m.getMembers){var r=t[1].toLowerCase();m.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));te(t),t.length>0?ae(!0):ae(!1)}))}else te([])}(t);var r,n=t.match(/:(\w{2,}):/g),a=t.match(/:(\w{2,})/g);if(n){var i=n[0].replace(/:/g,"");W.getEmojiByShortcode(i).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);x(r)}else x(t)})).catch((function(){x(t)})),B(!1)}else a?(r=a[0].replace(":",""),W.getEmojiBySearchQuery(r).then((function(e){e.length?(I(e.slice(0,p)),B(!0)):(I([]),B(!1))})).catch((function(){I([]),B(!1)}))):B(!1)},onFocus:function(){return k(!0)},onBlur:function(){return k(!1)},inputRef:U,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,o.jsxs)(J(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(de,{dataSource:m.emojiDataSource,onEmojiClick:ve,buttonColor:Q}),u&&ge]})},inputLabel:{className:F?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(f(),{className:"rustic-input-actions",children:[m.children,(0,o.jsx)(le(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(X(),{"aria-label":"send message",onClick:xe,disabled:ie(),color:"secondary",children:(0,o.jsx)(L.A,{name:"send"})})})})]})]})})),ge=require("@mui/material/LinearProgress");var xe=a.n(ge);const be=require("axios");var ye=a.n(be);const je=require("react-dom"),we=require("@mui/material/Card");var Se=a.n(we);const Fe=require("@mui/material/Modal");var ke=a.n(Fe);const Ce=require("@mui/system/Stack");var Oe=a.n(Ce);const Ee=require("@mui/system/useTheme");var Ne=a.n(Ee);const Te=require("pdfjs-dist"),Pe=function(e){var t={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"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,o.jsx)(le(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(X(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(L.A,{name:r.symbol})})})})},De=function(e){var t,r=(0,y.useRef)(null),n=(0,y.useState)(1),a=n[0],i=n[1],s=(0,y.useState)(1),c=s[0],l=s[1],u=(0,y.useState)(1),d=u[0],p=u[1],m=(0,y.useState)(!1),h=m[0],v=m[1],x=(0,y.useState)(),j=x[0],w=x[1],S=Ne()(),F=b()(S.breakpoints.down("sm")),k=b()(S.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,o.jsx)(Se(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(g(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var C=(0,y.useState)((function(){return F?.5:k?1:1.5})),O=C[0],E=C[1];function N(t){Te.getDocument({url:e.url,httpHeaders:t}).promise.then((function(e){l(e.numPages),function(e){e.getPage(a).then((function(e){var t=e.getViewport({scale:O}),n=r.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*i,n.height=t.height*i;var o={canvasContext:a,viewport:t,transform:[i,0,0,i,0,0]};j&&j.cancel();var s=e.render(o);w(s),s.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){v(!0)}))}return(0,y.useEffect)((function(){Te.GlobalWorkerOptions.workerSrc||(Te.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(Te.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then((function(e){return N(e.headers)})).catch((function(){return v(!0)})):N()}),[e.url,a,O]),h?(0,o.jsx)(Se(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(g(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(Se(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(f(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(Pe,{action:"zoomOut",onClick:function(){E((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(Pe,{action:"zoomIn",onClick:function(){E((function(e){return e+.2}))}})]}),(0,o.jsx)(f(),{className:"rustic-pdf-viewer-body",children:(0,o.jsx)(f(),{className:"rustic-pdf-viewer-body-inner",children:(0,o.jsx)("canvas",{ref:r})})}),(0,o.jsxs)(Oe(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(Pe,{action:"previousPage",onClick:function(){a>1&&(i(a-1),p(a-1))},isDisabled:1===a}),(0,o.jsx)(g(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(se(),{type:"number",value:d,onChange:function(e){var t=parseInt(e.target.value);p(t),!isNaN(t)&&t>=1&&t<=c&&i(t)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(g(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(Pe,{action:"nextPage",onClick:function(){a<c&&(i(a+1),p(a+1))},isDisabled:a===c})]})]})};var Ae=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},Ie={pdf:De};function Le(e){var t=e.supportedViewers,r=void 0===t?Ie:t,n=e.showFullName,a=void 0===n||n,i=Ae(e,["supportedViewers","showFullName"]),s=(0,h.useTheme)(),c=(0,y.useState)(!1),l=c[0],u=c[1];function d(){u(!1)}var p,m,f=i.file.url&&(p=i.file.url.split("."))[p.length-1].toLowerCase(),v=f&&r?r[f]:null,x=!!v,b=x?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(a?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(b),w=a?i.file.name:(m=i.file.name).length<=15?m:m.substring(0,12)+"...";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(Se(),{className:j,variant:"outlined",sx:{boxShadow:s.shadows[1]},onClick:function(){u(!0)},children:[(0,o.jsx)(g(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:i.children})]}),x&&(0,o.jsx)(ke(),{open:l,onClose:d,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(le(),{title:"Close",children:(0,o.jsx)(X(),{onClick:d,className:"rustic-close-button",children:(0,o.jsx)(L.A,{name:"close"})})}),i.file.url&&(0,o.jsx)(v,{url:i.file.url,getAuthHeaders:i.getAuthHeaders})]})})]})}var Me=a(3110);const qe=require("@mui/material"),Re=require("@mui/material/Button");var Be=a.n(Re);const _e=require("@mui/material/Drawer");var ze=a.n(_e);const He=require("@mui/material/ListItemText");var Ue=a.n(He);const We=require("@mui/material/Menu");var Ve=a.n(We),Ge=function(){return Ge=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ge.apply(this,arguments)};function Ke(e){var t=(0,y.useState)(!1),r=t[0],n=t[1],a=(0,y.useRef)(null),i=(0,h.useTheme)(),s=(0,qe.useMediaQuery)(i.breakpoints.down("md")),c=s?ze():Ve(),l={borderRadius:"".concat(i.shape.borderRadius,"px"),border:"1px solid ".concat(i.palette.divider)};function u(e){return(0,o.jsxs)(o.Fragment,{children:[e.startDecorator&&(0,o.jsx)(T.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,o.jsx)(Ue(),{children:(0,o.jsx)(g(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,o.jsx)(T.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}s&&(l=Ge(Ge({},l),{borderRadius:"".concat(i.shape.borderRadius,"px ").concat(i.shape.borderRadius,"px 0 0"),borderBottom:0}));var d=e.menuItems.map((function(e){return e.href?(0,o.jsx)(te(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:u(e)},e.label):(0,o.jsx)(te(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:u(e)},e.label)}));var p,m,f=s?{}:{anchorEl:a.current};return(0,o.jsxs)(o.Fragment,{children:[(p={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},m=(0,o.jsx)(L.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(Be(),Ge({},p,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(le(),{title:e.ariaLabel,children:(0,o.jsx)(X(),Ge({},p,{children:e.icon?e.icon:m}))})),(0,o.jsx)(c,Ge({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":Ge(Ge({},l),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:d}))]})}var Qe=function(){return Qe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Qe.apply(this,arguments)},$e=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Ye(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const Xe=function(e){var t,r=(0,y.useState)([]),n=r[0],a=r[1],i=(0,y.useState)([]),s=i[0],c=i[1],l=(0,y.useState)({}),u=l[0],d=l[1],p=(0,y.useRef)({}),m=(0,K.v4)();(0,y.useEffect)((function(){a([]),c([]),p.current={}}),[e.messageId]);var h=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function v(e,t,r){var n;p.current=Qe(Qe({},p.current),((n={})[e]=p.current[e]--,n)),function(e,t,r){c((function(t){return $e($e([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)})),a((function(e){return e.filter((function(e){return e.id!==t}))}))}(e,t,r)}var x=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,o.jsx)(Le,{file:{name:t.name},showFullName:e.showFullName,children:(0,o.jsxs)(f(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,o.jsx)(xe(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(le(),{title:"Delete",children:(0,o.jsx)(X(),{color:"primary",onClick:function(){return function(t,r){var n,i;c([]);var o=t.name;if(p.current=Qe(Qe({},p.current),((n={})[o]=p.current[o]--,n)),e.onFileUpdate("remove",o),100===t.loadingProgress){var s="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);h.then((function(t){ye().delete(s,Qe({},t)).then((function(){return a((function(e){return e.filter((function(e,t){return t!==r}))}))})).catch((function(){return e.onFileUpdate("add",o),c((function(e){return $e($e([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}))}else t.abortController.abort(),a((function(e){return e.filter((function(e,t){return t!==r}))})),p.current=Qe(Qe({},p.current),((i={})[o]=p.current[o]++,i))}(t,r)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,o.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},r)}))}),b=(0,o.jsx)(f(),{children:s.map((function(e,t){return(0,o.jsx)(g(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function j(e,t){return t?(0,je.createPortal)(e,t):e}var w=null===(t=e.uploadOptions)||void 0===t?void 0:t.map((function(t){return{label:t.label,onClick:function(){return function(t){d(t.metadata);var r=document.getElementById(m);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,o.jsx)(Me.default,{name:t.iconName})}}));return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(f(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:m,children:(null==w?void 0:w.length)?(0,o.jsx)(Ke,{ariaLabel:"Upload",icon:(0,o.jsx)(Me.default,{name:"upload_2"}),menuItems:w}):(0,o.jsx)(le(),{title:"Upload",children:(0,o.jsx)(X(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,o.jsx)("input",{type:"file",id:m,onChange:function(t){c([]);var r=t.target.files&&Array.from(t.target.files),i=n.length+(r?r.length:0);e.maxFileCount&&i>e.maxFileCount&&c((function(t){return $e($e([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=r&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(r,i,e.maxFileCount);o&&o.forEach((function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,c((function(t){return $e($e([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&Ye(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,i=function(e){var t,r,n=e.name,a=p.current[n];if(a){var i=a+1,o=n.lastIndexOf("."),s=n.substring(0,o),c=n.substring(o);n="".concat(s,"(").concat(a,")").concat(c),p.current=Qe(Qe({},p.current),((t={})[e.name]=i,t))}else p.current=Qe(Qe({},p.current),((r={})[e.name]=1,r));return n}(t),o=new File([t],i,{type:t.type});if(e.getUploadData||u){var s=e.getUploadData?e.getUploadData(i):{},c=Qe(Qe({},s),u);Object.keys(c).forEach((function(e){var t=c[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)}))}r.append("file",o);var l=(0,K.v4)(),d={name:i,loadingProgress:0,abortController:n,id:l};function m(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=d.id,a((function(e){var n=e.map((function(e){return e.id===r?Qe(Qe({},e),{loadingProgress:t}):e}));return n})))}a((function(e){return $e($e([],e,!0),[d],!1)})),e.onFileUpdate("add",i);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId);!function o(){return h.then((function(s){return ye().post(f,r,Qe(Qe({},s),{onUploadProgress:m,signal:n.signal})).then((function(t){var n,i,o=r.get("file");t.data.url&&o instanceof File&&o.name&&e.onFileUpdate("update",o.name,t.data.url),t.data.fileId&&(n=t.data,i=d.id,a((function(e){var t=e.findIndex((function(e){return e.id===i}));if(-1!==t){var r=$e([],e,!0);return r[t]=Qe(Qe({},r[t]),{id:n.fileId}),r}return e})))})).catch((function(n){var s,c,u=r.get("file");u instanceof File&&u.name&&e.onFileUpdate("remove",u.name);var p,m,f,h;409===(null===(s=n.response)||void 0===s?void 0:s.status)&&e.listFiles?(p=i.lastIndexOf("."),m=i.substring(0,p),f=i.substring(p),h=new RegExp("^".concat(m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var t=0,r=0,n=e;r<n.length;r++){var a=n[r];if(h.test(a.name)){var i=a.name.match(h),o=i&&i[1]?parseInt(i[1].slice(1,-1),10):0;t=Math.max(t,o)}}return"".concat(m,"(").concat(t+1,")").concat(f)})):Promise.resolve(i)).then((function(n){e.onFileUpdate("add",n);var i=new File([t],n,{type:t.type});r.set("file",i),a((function(e){return e.map((function(e){return e.id===l?Qe(Qe({},e),{name:n,loadingProgress:0}):e}))})),o()})).catch((function(){var e;v(t.name,d.id,null===(e=n.response)||void 0===e?void 0:e.data)})):v(t.name,d.id,null===(c=n.response)||void 0===c?void 0:c.data)}))}))}()}(t)}(t)})),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),s.length>0&&j(b,e.errorMessagesContainer),n.length>0&&j(x,e.filePreviewsContainer)]})};var Ze=function(){return Ze=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Ze.apply(this,arguments)},Je=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},et=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},tt=2097152;function rt(e){var t=e.maxFileSize,r=void 0===t?tt:t,n=e.maxFileCount,a=void 0===n?1:n,i=Je(e,["maxFileSize","maxFileCount"]),s=(0,y.useState)({uploaded:[],fileList:[]}),c=s[0],l=s[1],u=(0,y.useState)((0,K.v4)()),d=u[0],p=u[1],m=(0,y.useState)(),v=m[0],g=m[1],x=(0,y.useState)(),b=x[0],j=x[1],w=(0,y.useRef)(null),S=(0,h.useTheme)(),F=c.fileList.length>0,k=c.uploaded.length===c.fileList.length&&c.uploaded.length>0;return(0,y.useEffect)((function(){w.current&&(j(w.current.querySelector(".rustic-error-container")),g(w.current.querySelector(".rustic-input-extras")))})),(0,o.jsx)(f(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(S.palette.action.disabled),borderRadius:"".concat(S.shape.borderRadius,"px"),":focus-within":{borderColor:S.palette.secondary.main},background:S.palette.background.paper},children:(0,o.jsx)(ve,Ze({},i,{send:function(e){e.data=U(e.data.text,c.uploaded.map((function(e){return{url:e.url,name:e.name}}))),e.id=d,i.ws.send(e),p((0,K.v4)()),l({uploaded:[],fileList:[]})},isSendEnabled:F?k:void 0,ref:w,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Xe,{acceptedFileTypes:i.acceptedFileTypes,maxFileCount:a,maxFileSize:r,uploadFileEndpoint:i.uploadFileEndpoint,deleteFileEndpoint:i.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)l((function(e){return Ze(Ze({},e),{fileList:et(et([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");l((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),a=et(et(et([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Ze(Ze({},e),{uploaded:a})}))}else l((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:d,filePreviewsContainer:v,errorMessagesContainer:b,showFullName:i.showFullName,getUploadData:i.getUploadData,uploadOptions:i.uploadOptions,listFiles:i.listFiles,getUploadHeaders:i.getUploadHeaders})})}))})}var nt=function(){return nt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},nt.apply(this,arguments)},at=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function it(e){var t=e.ws,r=at(e,["ws"]);return(0,o.jsx)(ve,nt({},r,{send:function(e){e.data=U(e.data.text),t.send(e)}}))}require("ol/ol.css");var ot=a(5642),st=a.n(ot);const ct=require("ol/layer/Tile.js");var lt=a.n(ct);const ut=require("ol/Map.js");var dt=a.n(ut);const pt=require("ol/Overlay.js");var mt=a.n(pt);const ft=require("ol/proj.js"),ht=require("ol/source/OSM.js");var vt=a.n(ht);const gt=require("ol/View.js");var xt=a.n(gt);function bt(e){var t=(0,y.useState)(""),r=t[0],n=t[1],a=(0,y.useRef)(null),i=(0,y.useRef)(null);return(0,y.useEffect)((function(){if(n(""),e.latitude<-90||e.latitude>90||e.longitude<-180||e.longitude>180)return n("Invalid coordinates");if(a.current&&i.current){var t=new(dt())({layers:[new(lt())({source:new(vt())})],view:new(xt())({center:(0,ft.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:a.current}),r=new(mt())({element:i.current,position:(0,ft.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return t.addOverlay(r),t.once("postrender",(function(){var e;if(!(null===(e=a.current)||void 0===e?void 0:e.querySelector("canvas")))return n("An error occurred while loading the map")})),function(){t.setTarget(""),t.removeOverlay(r)}}}),[]),(0,o.jsx)(o.Fragment,{children:r.length>0?(0,o.jsx)(st(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(f(),{ref:i,children:(0,o.jsx)(L.A,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:a,className:"rustic-open-layers-map-canvas"})]})})}var yt=a(4409);const jt=require("@mui/material/Slider");var wt=a.n(jt);function St(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,o.jsx)(le(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(X(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(L.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var Ft=100;function kt(e){var t="dark"===(0,qe.useTheme)().palette.mode,r=z(e.mediaElement.currentTime);return(0,o.jsxs)(f(),{className:"rustic-progress",children:[function(){for(var r=e.mediaElement.buffered,n=0,a=r.length-1;a>=0;--a){var i=r.start(a),s=r.end(a);if(i<e.mediaElement.currentTime){n=s;break}}var c=n/e.mediaElement.duration*Ft;return(0,o.jsx)(xe(),{className:"rustic-progress-buffered",variant:"determinate",value:c,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,o.jsx)(wt(),{className:"rustic-progress-slider",size:"small","aria-label":"Time","aria-valuetext":"Current time: ".concat(r),max:e.mediaElement.duration,value:e.mediaElement.currentTime,onChange:function(t,r){e.mediaElement.currentTime=r},valueLabelDisplay:"auto",valueLabelFormat:function(e){return z(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function Ct(e){var t=(0,y.useState)(e.mediaElement.volume),r=t[0],n=t[1],a=(0,y.useState)(e.mediaElement.volume),i=a[0],s=a[1],c=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,o.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,o.jsx)(St,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(s(e.mediaElement.volume),n(0)):n(i)},className:"rustic-mute-button",action:c}),(0,o.jsx)(wt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*Ft,"%"),value:r,onChange:function(t,r){var a=r;e.mediaElement.muted=0===a,e.mediaElement.volume=a,n(e.mediaElement.volume)}})]})}function Ot(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,o.jsx)(Be(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(L.A,{name:t}),children:(0,o.jsx)(g(),{variant:"overline",children:r})})}function Et(e){var t=(0,y.useState)(!e.mediaElement.paused),r=t[0],n=t[1],a=r?"pause":"play";return e.mediaElement.onended=function(){n(!1)},e.mediaElement.onpause=function(){n(!1)},e.mediaElement.onplay=function(){n(!0)},(0,o.jsx)(St,{onClick:function(){r?e.mediaElement.pause():e.mediaElement.play().catch((function(t){e.onError("Failed to play the media. Error: ".concat(t.message))}))},action:a,className:"rustic-pause-play-icon"})}function Nt(e){var t,r=(0,y.useState)(e.mediaElement.playbackRate),n=r[0],a=r[1];return(0,o.jsx)(le(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(Be(),{onClick:function(){var t=1;e.mediaElement.playbackRate<2&&(t=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=t,a(t)},className:"rustic-playback-rate-button",children:(0,o.jsxs)(g(),{variant:"body1",children:[n,"X"]})})})}function Tt(e){var t="replay"===e.movement,r=t?function(){e.mediaElement.currentTime-=10}:function(){e.mediaElement.currentTime+=10},n=t?"replay":"forward";return(0,o.jsx)(St,{onClick:r,action:n})}var Pt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r};function Dt(e){var t=e.style,r=void 0===t?"condensed":t,n=Pt(e,["style"]),a=z(n.elapsedTimeInSeconds),i=z(n.durationTimeInSeconds),s="".concat(a," / ").concat(i);return"wide"===r?(0,o.jsxs)(f(),{className:"rustic-time-container",children:[(0,o.jsx)(g(),{variant:"overline",children:a}),(0,o.jsx)(g(),{variant:"overline",children:i})]}):(0,o.jsx)(g(),{variant:"overline",className:"rustic-time-display",children:s})}const At=require("@mui/material/Divider");var It=a.n(At);function Lt(e){var t=!!document.fullscreenElement;return(0,o.jsxs)(T.Box,{className:"rustic-transcript-container",children:[!t&&(0,o.jsx)(It(),{orientation:"vertical",flexItem:!0}),(0,o.jsx)(g(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function Mt(e){var t=(0,y.useState)(!1),r=t[0],n=t[1],a=(0,y.useState)(!1),i=a[0],s=a[1],c=(0,y.useState)(!0),l=c[0],u=c[1],d=(0,y.useState)(0),p=d[0],m=d[1],f=(0,y.useState)(""),h=f[0],v=f[1],x=(0,y.useState)(""),b=x[0],j=x[1],S=(0,qe.useTheme)(),F=(0,y.useRef)(null),k=(0,qe.useMediaQuery)(S.breakpoints.down("md"));function C(){return(0,o.jsx)(g(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function O(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(St,{action:t,onClick:function(){return s(!i)}})}}function E(){if(F.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Tt,{mediaElement:F.current,movement:"replay"}),(0,o.jsx)(Et,{mediaElement:F.current,onError:j}),(0,o.jsx)(Tt,{mediaElement:F.current,movement:"forward"})]})}function N(){if(e.transcript&&r)return(0,o.jsx)(Lt,{transcript:e.transcript})}function P(){if(e.transcript)return(0,o.jsx)(Ot,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function D(){return(0,o.jsx)("video",{src:e.src,ref:F,className:i?"rustic-has-captions":"",children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,y.useEffect)((function(){var e,t,r,n;function a(e){v(e)}null===(e=F.current)||void 0===e||e.addEventListener("timeupdate",(function(){F.current&&m(F.current.currentTime)})),null===(t=F.current)||void 0===t||t.addEventListener("canplay",(function(){v(""),u(!1)})),null===(r=F.current)||void 0===r||r.addEventListener("error",(function(){return a("Failed to load the audio.")})),null===(n=F.current)||void 0===n||n.addEventListener("stalled",(function(){return a("Failed to fetch audio data, but trying.")}))}),[]);var A=k?function(){if(F.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Dt,{elapsedTimeInSeconds:p,durationTimeInSeconds:F.current.duration,style:"wide"}),(0,o.jsx)(kt,{mediaElement:F.current}),C(),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-left",children:E()}),(0,o.jsx)(Ct,{mediaElement:F.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-right",children:[P(),(0,o.jsxs)(T.Box,{children:[O(),(0,o.jsx)(Nt,{mediaElement:F.current})]})]})]}),N()]})}:function(){if(F.current)return(0,o.jsxs)(o.Fragment,{children:[C(),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(kt,{mediaElement:F.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-left",children:[E(),O(),(0,o.jsx)(Nt,{mediaElement:F.current}),(0,o.jsx)(Ct,{mediaElement:F.current}),(0,o.jsx)(Dt,{elapsedTimeInSeconds:p,durationTimeInSeconds:F.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:P()})]}),N()]})]})};return h.length>0?(0,o.jsx)(st(),{severity:"error",children:h}):l?(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[D(),(0,o.jsx)(R(),{})]}):(0,o.jsxs)(T.Box,{className:"rustic-sound",children:[D(),A(),b.length>0&&(0,o.jsx)(st(),{severity:"error",className:"rustic-control-error",onClose:function(){return j("")},children:b})]})}function qt(e){var t=(0,y.useState)(!!document.pictureInPictureElement),r=t[0],n=t[1],a=e.mediaElement,i=r?"miniPlayerExit":"miniPlayer";return a.onleavepictureinpicture=function(){n(!1)},(0,o.jsx)(St,{onClick:function(){r?document.exitPictureInPicture().then((function(){n(!1)})).catch((function(t){e.onError("Failed to exit mini player. Error: ".concat(t.message))})):a.requestPictureInPicture().then((function(){n(!0)})).catch((function(t){e.onError("Failed to enter mini player. Error: ".concat(t.message))}))},action:i})}function Rt(e){var t=(0,y.useState)(!!document.fullscreenElement),r=t[0],n=t[1],a=e.element,i=r?"fullscreenExit":"fullscreen";return a.onfullscreenchange=function(){n(!!document.fullscreenElement)},(0,o.jsx)(St,{onClick:function(){r?document.exitFullscreen().then((function(){n(!1)})).catch((function(t){e.onError("Failed to exit fullscreen mode. Error: ".concat(t.message))})):a.requestFullscreen().then((function(){n(!0)})).catch((function(t){e.onError("Failed to enter fullscreen mode. Error: ".concat(t.message))}))},action:i})}function Bt(e){var t=(0,y.useState)(!1),r=t[0],n=t[1],a=(0,y.useState)(!1),i=a[0],s=a[1],c=(0,y.useState)(!0),l=c[0],u=c[1],d=(0,y.useState)(!!document.fullscreenElement),p=d[0],m=d[1],f=(0,y.useState)(!1),h=f[0],v=f[1],x=(0,y.useState)(""),b=x[0],j=x[1],S=(0,y.useState)(""),F=S[0],k=S[1],C=(0,y.useState)(0),O=C[0],E=C[1],N=(0,y.useRef)(null),P=(0,y.useRef)(null),D=(0,qe.useTheme)(),A=(0,qe.useMediaQuery)(D.breakpoints.down("md"));(0,y.useEffect)((function(){var e,t,r,n,a,i,o,s;function c(e){k(e),u(!1)}function l(){clearTimeout(s),s=setTimeout((function(){return v(!1)}),3e3)}null===(e=P.current)||void 0===e||e.addEventListener("timeupdate",(function(){P.current&&E(P.current.currentTime)})),null===(t=P.current)||void 0===t||t.addEventListener("canplay",(function(){k(""),u(!1)})),null===(r=P.current)||void 0===r||r.addEventListener("error",(function(){return c("Failed to load the video.")})),null===(n=P.current)||void 0===n||n.addEventListener("stalled",(function(){return c("Failed to fetch video data, but trying.")})),document.addEventListener("fullscreenchange",(function(){m(!!document.fullscreenElement)})),null===(a=N.current)||void 0===a||a.addEventListener("mousemove",(function(){v(!0),l()})),null===(i=N.current)||void 0===i||i.addEventListener("mouseleave",(function(){v(!1)})),null===(o=N.current)||void 0===o||o.addEventListener("keydown",(function(){v(!0),l()}))}),[]);var I={backgroundColor:D.palette.background.paper,opacity:h?1:0};function L(){if(e.transcript&&r)return(0,o.jsx)(Lt,{transcript:e.transcript})}function M(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(St,{action:t,onClick:function(){return s(!i)}})}}function q(){if(e.transcript)return(0,o.jsx)(Ot,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var B=A?function(){return p?(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:I,children:[(0,o.jsxs)(T.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(Et,{mediaElement:P.current,onError:j}),(0,o.jsx)(kt,{mediaElement:P.current}),(0,o.jsx)(Dt,{elapsedTimeInSeconds:O,durationTimeInSeconds:P.current.duration})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Tt,{mediaElement:P.current,movement:"replay"}),(0,o.jsx)(Tt,{mediaElement:P.current,movement:"forward"}),M(),(0,o.jsx)(Nt,{mediaElement:P.current})]}),q()]}),L()]})}):(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(Et,{mediaElement:P.current,onError:j}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[q(),(0,o.jsx)(Rt,{element:N.current,onError:j})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:P.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:I,children:[(0,o.jsx)(kt,{mediaElement:P.current}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-left",children:[(0,o.jsx)(Et,{mediaElement:P.current,onError:j}),(0,o.jsx)(Tt,{mediaElement:P.current,movement:"replay"}),(0,o.jsx)(Tt,{mediaElement:P.current,movement:"forward"}),M(),(0,o.jsx)(Nt,{mediaElement:P.current}),(0,o.jsx)(Ct,{mediaElement:P.current}),(0,o.jsx)(Dt,{elapsedTimeInSeconds:O,durationTimeInSeconds:P.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[q(),(0,o.jsx)(qt,{mediaElement:P.current,onError:j}),(0,o.jsx)(Rt,{element:N.current,onError:j})]})]}),p&&L()]})})};return F.length>0?(0,o.jsx)(st(),{severity:"error",children:F}):(0,o.jsxs)(T.Box,{className:"rustic-video",children:[l&&(0,o.jsx)(R(),{className:"rustic-video-loading-spinner"}),(0,o.jsxs)(T.Box,{ref:N,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[b.length>0&&(0,o.jsx)(st(),{severity:"error",className:"rustic-control-error",onClose:function(){return j("")},children:b}),(!A||p)&&function(){if(P.current&&N.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:I,children:[(0,o.jsx)(g(),{variant:"body2",children:e.title}),p&&A&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(qt,{mediaElement:P.current,onError:j}),(0,o.jsx)(Rt,{element:N.current,onError:j})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:P,src:e.src,poster:e.poster,children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),B()]}),!p&&L(),e.description&&(0,o.jsx)(w.A,{text:e.description})]})}var _t=a(4445);function zt(e){var t=(0,y.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(_t.default,{message:e.message,icon:(0,o.jsx)(L.A,{name:"file_copy"}),onClick:function(e){e.data.text&&navigator.clipboard.writeText(e.data.text).then((function(){n("Copied"),setTimeout((function(){n("Copy text")}),2e3)})).catch((function(){n("Failed to copy")}))},label:r})}function Ht(e){var t=(0,y.useState)("Start reading aloud"),r=t[0],n=t[1],a=[e.message.data.title,e.message.data.description,e.message.data.alt,e.message.data.text,e.message.data.transcript].filter(Boolean).join(" "),i=new SpeechSynthesisUtterance(a);return(0,o.jsx)(_t.default,{message:e.message,icon:(0,o.jsx)(L.A,{name:"text_to_speech"}),onClick:function(){window.speechSynthesis.speaking?(window.speechSynthesis.cancel(),n("Start reading aloud")):(i.onend=function(){n("Start reading aloud")},window.speechSynthesis.speak(i),n("Stop reading aloud"))},label:r})}const Ut=require("@mui/material/Stack");var Wt=a.n(Ut);const Vt=function(e){return(0,o.jsx)(g(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),n=navigator.language,a={month:"short",day:"numeric"},i=new Date,s=r.getFullYear()!==i.getFullYear(),c=s?" at ":", ",s&&(a.year="numeric"),r.toLocaleDateString(n,a)+c+r.toLocaleTimeString(n,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,n,a,i,s,c},Gt=(0,y.forwardRef)((function(e,t){var r=(0,qe.useTheme)(),n=e.inReplyTo?e.inReplyTo:e.message;return(0,o.jsxs)(Wt(),{id:n.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)(Wt(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(n),(0,o.jsx)(Vt,{timestamp:n.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,o.jsx)(Se(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(n)}),(0,o.jsxs)(Se(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,o.jsxs)(g(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,o.jsx)(Vt,{timestamp:e.message.timestamp})]})]})]})})),Kt=require("@mui/material/Chip");var Qt=a.n(Kt);const $t=require("@mui/system/Box");var Yt=a.n($t),Xt=function(){return Xt=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Xt.apply(this,arguments)},Zt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},Jt=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function er(e,t){var r;if(!(r=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.data.inReplyTo:t.id))return e;var n=Xt({},e),a=(n[r]||[])[0];return t.format.includes("update")&&a&&a.sender.id!==t.sender.id&&(r=t.id),n[r]||(n[r]=[]),t.format.includes("Response")&&a?n[r]=[Xt(Xt({},a),{data:Xt(Xt({},a.data),t.data)}),t]:n[r]=Jt(Jt([],n[r],!0),[t],!1),n}function tr(e){var t,r,n,a=e.scrollDownLabel,i=void 0===a?"Scroll down":a,s=Zt(e,["scrollDownLabel"]),c=(0,y.useRef)(null),l=(0,y.useRef)(null),u=(0,y.useRef)(),d=(0,y.useState)(!0),p=d[0],m=d[1],f=(0,y.useState)(!0),h=f[0],v=f[1],g=(0,y.useState)(!1),x=g[0],b=g[1],j=(0,y.useState)({}),w=j[0],S=j[1],F=Object.keys(w).length,k=(r=F,n=(0,y.useRef)(0),(0,y.useEffect)((function(){n.current=r})),n.current);function C(){v(!0),u.current&&clearTimeout(u.current),u.current=setTimeout((function(){v(!1)}),2e3)}function O(){var e=l.current,t=c.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;m(n-1<=r)}}function E(){if(function(){var e,t=null===(e=l.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every((function(e){return e.readyState>=1}))}()){var e=l.current;b(!0),e&&setTimeout((function(){C(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(E,1)}function N(e){S((function(t){return er(t,e)}))}return(0,y.useEffect)((function(){var e=l.current;if(O(),e)return e.addEventListener("scroll",O),window.addEventListener("resize",O),function(){e.removeEventListener("scroll",O),window.removeEventListener("resize",O)}}),[p]),(0,y.useEffect)((function(){E()}),[x]),(0,y.useEffect)((function(){p&&0!==k&&F>k&&(C(),E())}),[p,Object.keys(w).length]),(0,y.useEffect)((function(){var e,t={};null===(e=s.receivedMessages)||void 0===e||e.forEach((function(e){var r=er(t,e);t=r})),S(t)}),[null===(t=s.receivedMessages)||void 0===t?void 0:t.length]),(0,y.useEffect)((function(){s.ws.onReceive&&s.ws.onReceive(N)}),[]),(0,o.jsxs)(Yt(),{className:"rustic-message-space",children:[(0,o.jsxs)(Yt(),{ref:l,className:"rustic-message-container",children:[Object.keys(w).map((function(e,t){var r,n=w[e],a=n[n.length-1],i=a.format.includes("Response"),l=i&&{inReplyTo:n[0]};return"prompts"!==a.format?(0,o.jsx)(Gt,Xt({message:a},l,{getActionsComponent:s.getActionsComponent,getProfileComponent:s.getProfileComponent,ref:t===F-1?c:null,children:(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:i?[n[0]]:n,supportedElements:s.supportedElements})}),e):"inConversation"===(null===(r=a.data)||void 0===r?void 0:r.position)?(0,o.jsx)("div",{ref:t===F-1?c:null,children:(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:i?[n[0]]:n,supportedElements:s.supportedElements})},e):void 0})),!p&&!h&&(0,o.jsx)(Qt(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:E,label:(0,o.jsxs)(o.Fragment,{children:[i,(0,o.jsx)(L.A,{name:"arrow_downward"})]})})]}),function(e){var t,r=Object.values(e).flat(),n=r[r.length-1];return"prompts"===(null==n?void 0:n.format)&&"inConversation"!==(null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.position)?(0,o.jsx)(I,{ws:s.ws,sender:s.sender,messages:[n],supportedElements:s.supportedElements}):null}(w)]})}var rr=a(8010);function nr(e){return new URL(e).pathname.split("/").pop()}function ar(e){return(0,o.jsxs)(f(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,o.jsxs)("div",{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(rr.default,{text:e.description})]}),e.messages.map((function(t,r){return"string"==typeof t.content?(0,o.jsx)(rr.default,{text:t.content},r):function(t,r){var n=[],a="";return t.map((function(t){if("text"===t.type)a+=t.text;else if(t.type.endsWith("_url")){var r=t[t.type].url,i={url:r,name:t[t.type].name||nr(r)},s=(0,o.jsx)(Le,{file:i,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:i.url&&(0,o.jsx)(le(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(X(),{component:"a",href:i.url,download:i.name,children:(0,o.jsx)(Me.default,{name:"download"})})})});n.push(s)}})),(0,o.jsxs)(j().Fragment,{children:[a.length>0&&(0,o.jsx)(rr.default,{text:a}),n.length>0&&(0,o.jsx)(f(),{className:"rustic-files",children:n})]},r)}(t.content,r)}))]})}function ir(e){return(0,o.jsxs)(Yt(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,o.jsxs)("div",{children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(rr.default,{text:e.description})]}),e.text&&(0,o.jsx)(rr.default,{text:e.text}),(t=e.files.map((function(t,r){return(0,o.jsx)(Le,{file:t,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:t.url&&(0,o.jsx)(le(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(X(),{component:"a",href:t.url,download:t.name,children:(0,o.jsx)(L.A,{name:"download"})})})},r)})),(0,o.jsx)(Yt(),{className:"rustic-files",children:t}))]});var t}const or=require("@mui/material/Dialog");var sr=a.n(or);const cr=require("@mui/material/DialogTitle");var lr=a.n(cr);const ur=require("@mui/material/List");var dr=a.n(ur);const pr=require("@mui/material/ListItem");var mr=a.n(pr);const fr=require("@mui/material/ListSubheader");var hr=a.n(fr);const vr=require("pluralize");var gr=a.n(vr),xr=a(7159);function br(e){var t=(0,y.useState)(!1),r=t[0],n=t[1],a=e.participants.length,i=r?e.participants:e.participants.slice(0,3),s="".concat(gr()(e.participantType,a)," (").concat(a,")"),c=r?"Show Less":"Show All ".concat(a);return 0===a?(0,o.jsx)(g(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(dr(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(hr(),{disableSticky:!0,className:"rustic-participant-list-subheader",children:[(0,o.jsxs)(T.Box,{className:"rustic-participant-list-subheader-title",children:[e.participantTypeIcon,(0,o.jsx)(g(),{variant:"subtitle2",color:"text.secondary",children:s})]}),a>3&&(0,o.jsx)(Be(),{onClick:function(){return n(!r)},color:"primary",size:"small",startIcon:(0,o.jsx)(L.A,{name:"keyboard_arrow_down"}),children:c})]}),children:i.map((function(e){return(0,o.jsxs)(mr(),{className:"rustic-participant-list-item",children:[(0,o.jsxs)(T.Box,{className:"rustic-participant-profile",children:[(0,o.jsx)($(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(g(),{variant:"subtitle2",children:e.displayName})]}),(0,o.jsx)(g(),{variant:e.participantRole===xr.s.Owner?"subtitle2":"caption",children:_(e.participantRole||xr.s.Member)})]},e.id)}))})}const yr=function(e){function t(e,t){return function(e){return function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([],e,!0).sort((function(e,t){return t.participantRole===xr.s.Owner?1:-1}))}(e.filter((function(e){return e.participantType===t})))}var r=t(e.participants,xr.y.Human),n=t(e.participants,xr.y.Agent),a="".concat(gr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(sr(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(lr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:a}),(0,o.jsx)(br,{participantType:"Human",participantTypeIcon:(0,o.jsx)(L.A,{name:"account_circle"}),participants:r}),n.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(It(),{className:"rustic-participants-container-divider"}),(0,o.jsx)(br,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(L.A,{name:"smart_toy"}),participants:n})]})]})},jr=require("@mui/material/DialogActions");var wr=a.n(jr);const Sr=require("@mui/material/DialogContent");var Fr=a.n(Sr);const kr=require("@mui/material/DialogContentText");var Cr=a.n(kr),Or=function(){return Or=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Or.apply(this,arguments)},Er=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))};function Nr(e){var t=(0,y.useState)(!1),r=t[0],n=t[1],a=(0,y.useState)(!1),i=a[0],s=a[1],c=(0,y.useState)(!1),l=c[0],u=c[1],d=(0,y.useState)(!1),p=d[0],m=d[1],f=(0,y.useState)([]),h=f[0],v=f[1],x=(0,y.useState)(null),b=x[0],j=x[1],w=(0,T.useTheme)(),S=h[h.length-1],F=Or(Or({},e.ws),{send:function(e){j(e)}});function k(e){v((function(t){return Er(Er([],t,!0),[e],!1)}))}function C(){if(b){var t=Or(Or({},b),{threadId:e.messageId});e.ws.send(t)}}if((0,y.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(k)}),[e.ws]),(0,y.useEffect)((function(){h.length>0&&(S&&S.sender.id!==e.sender.id&&s(!1),"promptBuilder"===S.format&&S.data.isLastQuestion&&n(!0))}),[h.length]),0!==h.length)return(0,o.jsxs)(Se(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,o.jsxs)(sr(),{open:l,onClose:function(){return u(!1)},"aria-labelledby":"quit-dialog-title","aria-describedby":"quit-dialog-description",sx:{"& .MuiPaper-root":{width:"clamp(320px,50vw,600px)",border:"1px solid ".concat(w.palette.divider)}},children:[(0,o.jsx)(lr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(It(),{}),(0,o.jsx)(Fr(),{children:(0,o.jsx)(Cr(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(wr(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(Be(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(L.A,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(Be(),{variant:"contained",color:"primary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(g(),{color:"text.secondary",children:"Prompt Builder"}),(0,o.jsx)(It(),{className:"rustic-prompt-builder-divider"}),(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-questions",children:[function(){if(!p&&h.length>0)return h.map((function(t){if(t.sender.id!==e.sender.id&&"promptBuilder"!==t.format)return(0,o.jsx)(I,{ws:F,sender:e.sender,messages:[t],supportedElements:e.supportedElements},t.id)}))}(),i&&(0,o.jsx)(R(),{color:"secondary",className:"rustic-align-self-center"})]}),(0,o.jsx)(o.Fragment,{children:!p&&(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons",children:[(0,o.jsxs)(T.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,o.jsx)(Be(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(L.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(Be(),{variant:"outlined",color:"secondary",endIcon:(0,o.jsx)(L.A,{name:"chevron_right"}),onClick:function(){C(),j(null),s(!0)},disabled:!b,"aria-disabled":!b,children:"Next question"})]}),r&&(0,o.jsx)(T.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,o.jsx)(Be(),{variant:"contained",color:"primary",onClick:function(){C(),m(!0),s(!0),e.onSubmit()},disabled:i,"aria-disabled":i,children:"Generate"})})]})})]})}var Tr=function(){return Tr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Tr.apply(this,arguments)};function Pr(e){var t=Ne()(),r=e.prompts.map((function(r,n){return(0,o.jsx)(Qt(),{onClick:function(){return t=r,n=(new Date).toISOString(),a={id:(0,K.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:U(t.toString())},void e.ws.send(a);var t,n,a},color:"secondary",size:"small",className:"rustic-prompt",sx:Tr(Tr({backgroundColor:t.palette.background.paper},"inConversation"===e.position&&{border:"1px solid ".concat(t.palette.divider)}),{"&:hover":{color:t.palette.text.primary,backgroundColor:t.palette.primary.hover}}),label:r},n)}));return(0,o.jsx)(f(),{className:e.className,children:r})}function Dr(e){var t=(0,y.useState)(""),r=t[0],n=t[1],a=(0,qe.useTheme)(),i=(0,qe.useMediaQuery)(a.breakpoints.down("md"))?"column":"row",s=e.options.map((function(t,a){return(0,o.jsx)(Qt(),{onClick:function(){return function(t){n(t);var r=(new Date).toISOString(),a={id:(0,K.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:U(t.toString()),inReplyTo:e.messageId};e.ws.send(a)}(t)},color:"secondary",size:"small",sx:r===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!r,"aria-disabled":!!r,label:t},a)}));return(0,o.jsxs)(f(),{className:"rustic-question",children:[(e.title||e.description)&&(0,o.jsxs)(f(),{className:"rustic-question-text",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description})]}),(0,o.jsx)(Wt(),{direction:i,className:"rustic-options-container",children:s})]})}const Ar=require("@mui/material/Table");var Ir=a.n(Ar);const Lr=require("@mui/material/TableBody");var Mr=a.n(Lr);const qr=require("@mui/material/TableCell");var Rr=a.n(qr);const Br=require("@mui/material/TableContainer");var _r=a.n(Br);const zr=require("@mui/material/TableHead");var Hr=a.n(zr);const Ur=require("@mui/material/TablePagination");var Wr=a.n(Ur);const Vr=require("@mui/material/TableRow");var Gr=a.n(Vr);const Kr=require("@mui/material/TableSortLabel");var Qr,$r=a.n(Kr),Yr=10;function Xr(){return(0,o.jsx)(L.A,{name:"expand_all"})}function Zr(e){if(0===e.data.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available"});var t,r,n,a=e.data.length>Yr,i=(0,y.useState)({}),s=i[0],c=i[1],l=(0,y.useState)(a?Yr:-1),u=l[0],d=l[1],p=(0,y.useState)(0),m=p[0],f=p[1],h=(0,qe.useTheme)(),v=Array.from(new Set(e.data.flatMap((function(e){return Object.keys(e)})))),x=e.headers||v.map((function(e){return{dataKey:e}})),b=(t=e.data,r=Object.keys(s)[0],n=s[r],r&&n?t.slice().sort((function(e,t){var r=Object.keys(s)[0],n=s[r];return e[r]<t[r]?n===Qr.Descending?1:-1:e[r]>t[r]?n===Qr.Descending?-1:1:0})):t),j=b.slice(m*u,m*u+u),S=u>0?j:b;function F(e){if(!s[e])return Xr}return(0,o.jsxs)(Wt(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(g(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(_r(),{className:"rustic-table-container",children:(0,o.jsxs)(Ir(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[x.length>0&&(0,o.jsx)(Hr(),{children:(0,o.jsx)(Gr(),{children:x.map((function(e,t){return(0,o.jsx)(Rr(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(le(),{title:(r=e.dataKey,n=s[r],n?Object.keys(Qr)[Object.values(Qr).indexOf(n)]:"Sort"),children:(0,o.jsx)($r(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c((function(t){var r,n,a={};switch(t[e]){case Qr.Ascending:(r={})[e]=Qr.Descending,a=r;break;case Qr.Descending:a={};break;default:(n={})[e]=Qr.Ascending,a=n}return a}))}(e.dataKey)},className:"rustic-table-header",IconComponent:F(e.dataKey),children:e.label||_(e.dataKey)})})},"header-".concat(t));var r,n}))})}),(0,o.jsx)(Mr(),{children:S.map((function(e,t){return(0,o.jsx)(Gr(),{children:x.map((function(r,n){return(0,o.jsx)(Rr(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))}))},"row-".concat(t))}))})]})}),a&&(0,o.jsx)(Wr(),{className:"rustic-table-pagination",component:"div",count:e.data.length,rowsPerPage:u,labelRowsPerPage:"Rows:",page:m,onPageChange:function(e,t){return f(t)},onRowsPerPageChange:function(e){d(+e.target.value),f(0)},sx:{"& .MuiTablePagination-selectLabel":{color:h.palette.text.disabled}},classes:{toolbar:"rustic-table-toolbar",input:"rustic-table-input",spacer:"rustic-table-spacer",displayedRows:"rustic-table-displayed-rows",actions:"rustic-table-actions"}})]})}!function(e){e.Ascending="asc",e.Descending="desc"}(Qr||(Qr={}));var Jr=a(7447),en=a.n(Jr);const tn=function(e){var t=(0,y.useState)(en().sanitize(e.text)),r=t[0],n=t[1],a=(0,y.useState)(""),i=a[0],s=a[1];return(0,y.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,a=e.updatedData;r<a.length;r++){var i=a[r];"string"!=typeof i.text&&(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")),t+=i.text}n(en().sanitize(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(g(),{variant:"body2",children:r}),i&&(0,o.jsx)(st(),{severity:"error",children:i})]})},rn=function(e){return(0,o.jsx)(g(),{variant:"body1",className:"rustic-text",children:en().sanitize(e.text)})},nn=require("mermaid");var an=a.n(nn),on=function(){return on=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},on.apply(this,arguments)};const sn=function(e){var t=(0,y.useRef)(null),r=(0,y.useState)(),n=r[0],a=r[1],i=Ne()(),s=(0,K.v4)();return(0,y.useEffect)((function(){var r="dark"===i.palette.mode?"dark":"neutral",n=i.typography.fontFamily;t.current&&(an().initialize(on({theme:r,themeVariables:{fontFamily:n}},e.config)),an().render("mermaid-svg-".concat(s),e.diagram,t.current).then((function(e){t.current&&(t.current.innerHTML=e.svg),a("")})).catch((function(){var e;null===(e=t.current)||void 0===e||e.replaceChildren(),a("Failed to render the diagram.")})))})),(0,o.jsxs)(Wt(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(g(),{variant:"body2",children:n})]})},cn=(require("@finos/perspective-viewer/dist/esm/perspective-viewer.inline.js"),require("@finos/perspective-viewer-datagrid"),require("@finos/perspective-viewer-d3fc"),require("@finos/perspective-viewer/dist/css/pro.css"),require("@finos/perspective-viewer/dist/css/pro-dark.css"),require("@finos/perspective/dist/esm/perspective.inline.js"));var ln=a.n(cn),un=function(){return un=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},un.apply(this,arguments)};function dn(e){return e?e.reduce((function(e,t){var r=t.dataKey,n=t.label;return e[r]=n||r,e}),{}):{}}const pn=function(e){if(0===e.data.length)return(0,o.jsx)(g(),{variant:"body2",children:"No data available."});var t=(0,y.useRef)(null),r=(0,h.useTheme)(),n=(0,y.useState)(!1),a=n[0],i=n[1],s=r.palette.mode,c="dark"===s?"Pro Dark":"Pro Light",l=dn(e.headers),u="\n /* General Button Styles */\n button, .button:hover, #editor-container, .editable, #settings_button {\n border-radius: 16px !important;\n color: ".concat(r.palette.text.primary," !important;\n /* TODO: add background color after updating the theme */\n }\n \n #settings_button {\n border: 1px solid ").concat(r.palette.primary.light," !important;\n }\n \n /* Hide border for aggregate Selector */\n .aggregate-selector:hover {\n border: none !important;\n }\n \n /* Input and Select Elements */\n input, select, .noselect, #add-expression, .dropdown-width-container, \n .pivot-column-border, .pivot-column, .column-selector-column-border {\n border-radius: 8px !important;\n }\n \n /* Change background color */\n #settings_panel, #column_settings_sidebar {\n background: ").concat("dark"===s?"dark":"white"," !important;\n background-image: none !important;\n }\n \n /* Expression Edit Button */\n .expression-edit-button {\n display: none;\n }\n \n /* Add padding to expression input */\n #editor-container, .editable {\n padding: 8px !important;\n }\n \n /* Change Button Font Size */\n .button select, .button {\n font-size: 12px !important;\n }\n \n /* Button and Icon Colors */\n #status_bar .hover-target:hover .button>span {\n display:none !important;\n }\n \n #status_bar .hover-target.modal-target .button>span {\n display:none !important;\n }\n \n .button select:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(r.palette.primary.light," !important;\n }\n \n /* Hide unused buttons */\n #debug_open_button.sidebar_close_button, .reset-default-style-disabled, \n .expression-edit-button, #theme, #status, #status_bar .input-sizer {\n display: none !important;\n }\n \n #status_bar .hover-target:hover, #status_bar .hover-target.modal-target {\n height: fit-content !important;\n }\n\n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: auto !important;\n }\n\n #settings_button:hover {\n color: ").concat(r.palette.primary.contrastText," !important;\n background-color: ").concat(r.palette.primary.main," !important;\n }\n ");var d,p,m,f,v,x,b,j,S,F=e.config&&(p=(d=e.config).groupBy,m=d.splitBy,f=d.aggregates,v=d.sort,x=d.filter,b=d.columns,j=null==v?void 0:v.map((function(e){return[l[e[0]]||e[0],e[1]]})),S=f&&Object.fromEntries(Object.entries(f).map((function(e){var t=e[0],r=e[1];return[l[t]||t,r]}))),{group_by:null==p?void 0:p.map((function(e){return l[e]||e})),split_by:null==m?void 0:m.map((function(e){return l[e]||e})),aggregates:S,sort:j,filter:x&&function(e){return e.map((function(e){return[l[e[0]]||e[0],e[1],e[e.length-1]]}))}(x),columns:null==b?void 0:b.map((function(e){return l[e]||e}))});return(0,y.useEffect)((function(){ln().worker().then((function(t){return t.table(function(e,t){var r=dn(t);return e.map((function(e){for(var t={},n=0,a=Object.entries(e);n<a.length;n++){var i=a[n],o=i[0],s=i[1];t[r[o]||o]=s}return t}))}(e.data,e.headers))})).then((function(r){var n=t.current;n&&n.load(r).then((function(){n.restore(un(un({},F),{theme:c,title:e.title,settings:!1})).then((function(){var t,r=null===(t=e.config)||void 0===t?void 0:t.expansionDepth;if("number"==typeof r&&n.getView().then((function(e){return e.set_depth(r).then((function(){n.resize()}))})),n.shadowRoot){var a=new CSSStyleSheet;a.replaceSync(u),n.shadowRoot.adoptedStyleSheets.push(a)}}))})).catch((function(){i(!0)}))}))}),[e.data,c]),a?(0,o.jsx)(g(),{variant:"body2",children:"Failed to create table from data."}):(0,o.jsxs)(Oe(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},mn=require("react-plotly.js");var fn=a.n(mn),hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},hn.apply(this,arguments)};const vn=function(e){var t=hn(hn({},e.plotParams),{className:"rustic-plotly"});return t.config=hn(hn({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(Yt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(fn(),hn({},t))]})},gn=require("react-dom/server"),xn=require("vega-embed");var bn=a.n(xn),yn=function(){return yn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},yn.apply(this,arguments)};const jn=function(e){var t=e.theme,r=void 0===t?{dark:"dark"}:t,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["theme"]),a=(0,y.useRef)(null),i=(0,y.useState)(!1),s=i[0],c=i[1],l=Ne()(),u="dark"===l.palette.mode,d=l.typography.fontFamily,p={backgroundColor:l.palette.primary.main,color:l.palette.background.paper,borderRadius:l.shape.borderRadius+"px",padding:"4px 8px",fontSize:l.typography.caption.fontSize,fontFamily:d,fontWeight:l.typography.caption.fontWeight},m={formatTooltip:function(e,t){return(0,gn.renderToStaticMarkup)((0,o.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:p,children:Object.entries(e).map((function(e){var r=e[0],n=e[1];return(0,o.jsxs)("div",{children:[(0,o.jsxs)("strong",{children:[t(r),":"]})," ",t(n)]},r)}))}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},f=[{label:"Save as SVG"},{label:"Save as PNG"}];function h(){var e,t;if(a.current&&n.spec){var i=yn(yn({config:{font:d}},n.options),{theme:u?r.dark:r.light,tooltip:m,actions:!1});(null===(t=null===(e=n.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(i.config.font=d);var o=yn({},n.spec);delete o.title,bn()(a.current,o,i).then((function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map((function(n,a){var i="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,i).then((function(e){f[a].href=e,f[a].downloadFileName="".concat(r,".").concat(n)}))})),c(!1)})).catch((function(){c(!0)}))}}return(0,y.useEffect)((function(){function e(){h()}return h(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[n.spec,u]),s?(0,o.jsx)(g(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(Oe(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(Yt(),{justifyContent:"end",display:"flex",children:(0,o.jsx)(Ke,{menuItems:f,ariaLabel:"Download options"})}),n.title&&(0,o.jsx)(g(),{variant:"h6",children:n.title}),n.description&&(0,o.jsx)(w.A,{text:n.description}),(0,o.jsxs)(Yt(),{textAlign:"center",mt:1,children:["string"==typeof n.spec.title&&(0,o.jsx)(g(),{variant:"subtitle2",children:n.spec.title}),n.spec.description&&(0,o.jsx)(g(),{variant:"caption",children:n.spec.description})]}),(0,o.jsx)("div",{ref:a,className:"rustic-vega-lite"})]})};function wn(e){var t=(0,y.useState)(e.units),r=t[0],n=t[1];function a(t){return"metric"===e.units&&"imperial"===r?Math.round(1.8*t+32):"imperial"===e.units&&"metric"===r?Math.round(t*(5/9)-32):Math.round(t)}var i=new Date(1e3*e.weather[0].timestamp),s=H(e.weather[0].timestamp).shortName,c=i.getDate(),l=i.getFullYear().toString().slice(2),u="".concat(s," ").concat(c,"/").concat(l," TODAY"),d="HIGH: ".concat(a(e.weather[0].temp.high)," / LOW: ").concat(a(e.weather[0].temp.high)),p=e.weather.map((function(e,t){if(0!==t)return(0,o.jsxs)(Se(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(g(),{variant:"h5",component:"span",color:"text.secondary","aria-label":H(e.timestamp).fullName,children:H(e.timestamp).shortName}),(0,o.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,o.jsxs)(g(),{variant:"body2",color:"text.secondary",children:["High: ",a(e.temp.high),"°"]}),(0,o.jsxs)(g(),{variant:"body2",color:"text.secondary",children:["Low: ",a(e.temp.low),"°"]})]},t)}));return(0,o.jsxs)(Se(),{variant:"outlined",className:"rustic-weather",children:[e.title&&(0,o.jsx)(g(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(w.A,{text:e.description}),(0,o.jsx)(Ke,{ariaLabel:"Temperature units",menuItems:[{label:"Celsius",endDecorator:"°C",onClick:function(){return n("metric")}},{label:"Fahrenheit",endDecorator:"°F",onClick:function(){return n("imperial")}}]}),(0,o.jsxs)(Wt(),{alignItems:"center",children:[(0,o.jsx)(g(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)(Wt(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-current-weather-description",children:[(0,o.jsx)("img",{src:e.weather[0].weatherIcon.icon,alt:""}),(0,o.jsx)(g(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(g(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[a(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(r)]}),(0,o.jsxs)(Wt(),{direction:"row",spacing:2,children:[(0,o.jsx)(g(),{variant:"overline",children:u}),(0,o.jsx)(g(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:p}),e.weatherProvider&&(0,o.jsxs)(Wt(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(L.A,{name:"cloud"}),(0,o.jsx)(g(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}var Sn=a(9517);return i})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rustic-ai/ui-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"rustic-ai",
|
|
6
6
|
"conversational-ui"
|
|
@@ -110,7 +110,6 @@
|
|
|
110
110
|
"prop-types": "15.8.1",
|
|
111
111
|
"react-dom": "18.3.1",
|
|
112
112
|
"react-plotly.js": "2.6.0",
|
|
113
|
-
"recharts": "2.10.3",
|
|
114
113
|
"storybook": "8.6.2",
|
|
115
114
|
"storybook-addon-mock": "5.0.0",
|
|
116
115
|
"style-loader": "3.3.4",
|
|
@@ -156,7 +155,6 @@
|
|
|
156
155
|
"react": "^18.3.1",
|
|
157
156
|
"react-dom": "^18.3.1",
|
|
158
157
|
"react-plotly.js": "^2.6.0",
|
|
159
|
-
"recharts": "^2.10.3",
|
|
160
158
|
"uniforms": "^4.0.0",
|
|
161
159
|
"uniforms-bridge-json-schema": "^4.0.0",
|
|
162
160
|
"uniforms-mui": "^4.0.0",
|
|
@@ -233,9 +231,6 @@
|
|
|
233
231
|
"react-plotly.js": {
|
|
234
232
|
"optional": true
|
|
235
233
|
},
|
|
236
|
-
"recharts": {
|
|
237
|
-
"optional": true
|
|
238
|
-
},
|
|
239
234
|
"uuid": {
|
|
240
235
|
"optional": true
|
|
241
236
|
},
|
|
@@ -287,4 +282,4 @@
|
|
|
287
282
|
"@commitlint/config-conventional"
|
|
288
283
|
]
|
|
289
284
|
}
|
|
290
|
-
}
|
|
285
|
+
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
4
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
5
|
-
sans-serif;
|
|
6
|
-
-webkit-font-smoothing: antialiased;
|
|
7
|
-
-moz-osx-font-smoothing: grayscale;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
code {
|
|
11
|
-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
12
|
-
monospace;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.rustic-fit-container {
|
|
16
|
-
object-fit: contain;
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.rustic-files {
|
|
22
|
-
display: flex;
|
|
23
|
-
gap: 8px;
|
|
24
|
-
flex-wrap: wrap;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.rustic-cursor-pointer {
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.rustic-align-self-center {
|
|
32
|
-
align-self: center;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.rustic-shift-to-right-by-8 {
|
|
36
|
-
margin-right: -8px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.rustic-participant-profile {
|
|
40
|
-
display: flex;
|
|
41
|
-
gap: 8px;
|
|
42
|
-
align-items: center;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.rustic-participant-profile .rustic-participant-avatar {
|
|
46
|
-
width: 16px;
|
|
47
|
-
height: 16px;
|
|
48
|
-
}
|
|
49
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/video/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,eAAe,YAAY,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
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 o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},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,{default:()=>u});const r=require("react/jsx-runtime"),o=require("dompurify");var n=e.n(o);require("react");var i,a=function(){return a=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(i||(i={}));var c=function(){return c=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},c.apply(this,arguments)};const u=function(e){var t,o,i,u=e.title,l=void 0===u?"Embedded video":u,p=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(e,["title"]),f=n().sanitize(p.youtubeVideoId);return(0,r.jsx)("iframe",c({},(i={},(t=p.width)&&(i={width:t}),(o=p.height)&&(i=a(a({},i),{height:o})),t||o||(i={className:"rustic-fit-container"}),i),{src:"https://www.youtube.com/embed/".concat(f),title:l,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",loading:"lazy"}))};return t})()));
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import '../../index.css';
|
|
2
|
-
export interface YoutubeVideoProps {
|
|
3
|
-
/** The string after "?v=" parameter of YouTube URLs. */
|
|
4
|
-
youtubeVideoId: string;
|
|
5
|
-
/** Width rendered in pixels. If neither width nor height are provided, the video will be set to be contained in the parent container. */
|
|
6
|
-
width?: number;
|
|
7
|
-
/** Height rendered in pixels. */
|
|
8
|
-
height?: number;
|
|
9
|
-
/** Title of the video used for assistive technology. */
|
|
10
|
-
title?: string;
|
|
11
|
-
}
|
|
12
|
-
/** > **Deprecated:** Use `Video` component instead. This component will be removed in the next release.
|
|
13
|
-
*
|
|
14
|
-
* The `YoutubeVideo` component enables the embedding of YouTube videos, providing a seamless playback experience.
|
|
15
|
-
*
|
|
16
|
-
* Note: `dompurify` is not bundled, so please install the following package using npm:
|
|
17
|
-
*
|
|
18
|
-
* ```typescript
|
|
19
|
-
* npm i dompurify
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export default function YoutubeVideo({ title, ...props }: YoutubeVideoProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
//# sourceMappingURL=youtubeVideo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"youtubeVideo.d.ts","sourceRoot":"","sources":["../../../src/components/video/youtubeVideo.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAOxB,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,cAAc,EAAE,MAAM,CAAA;IACtB,yIAAyI;IACzI,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,KAAwB,EACxB,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAanB"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
.rustic-recharts-time-series {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.rustic-recharts-time-series-chart-toggle {
|
|
7
|
-
align-self: end;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.rustic-recharts-time-series-chart-toggle-title {
|
|
11
|
-
padding: 6px 16px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.rustic-recharts-time-series-title {
|
|
15
|
-
text-align: center;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.rustic-recharts-time-series-description {
|
|
19
|
-
padding: 16px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.rustic-recharts-time-series-legend {
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-wrap: wrap;
|
|
25
|
-
gap: 8px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.rustic-recharts-time-series-legend-item {
|
|
29
|
-
display: flex;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.recharts-responsive-container {
|
|
33
|
-
font-size: 12px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.recharts-legend-wrapper {
|
|
37
|
-
display: flex;
|
|
38
|
-
justify-content: center;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
span.rustic-icon-large {
|
|
42
|
-
font-size: 32px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.rustic-markdown p {
|
|
46
|
-
margin-block-start: 0;
|
|
47
|
-
margin-block-end: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,kBAAkB,MAAM,sBAAsB,CAAA;AAErD,eAAe,kBAAkB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
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 n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},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,{default:()=>N});const r=require("react/jsx-runtime"),n=require("@mui/material/FormControl");var a=e.n(n);const i=require("@mui/material/IconButton");var o=e.n(i);const c=require("@mui/material/Menu");var s=e.n(c);const l=require("@mui/material/MenuItem");var u=e.n(l);const d=require("@mui/material/Typography");var m=e.n(d);const p=require("@mui/system/Box");var f=e.n(p);const h=require("@mui/system/useTheme");var y=e.n(h);const x=require("react"),v=require("recharts");var g;function j(e,t){return function(e,t){var r,n=new Date(e),a=navigator.language;return r=t===g.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(a,r)}(e,t<=1?g.HOUR:g.MONTH_DATE)}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(g||(g={}));var b=function(){return b=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},b.apply(this,arguments)};function O(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:b({},t),children:e.name})}const C=require("dompurify");var k=e.n(C);const S=require("marked");function T(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=S.marked.parse(t,{async:!1});return k().sanitize(r)}const A=function(e){var t=(0,x.useState)(T(e.text)),n=t[0],a=t[1];return(0,x.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(T(t))}}),[e.text,e.updatedData]),(0,r.jsx)(m(),{variant:"body1",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:n}})};var D=function(){return D=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},D.apply(this,arguments)},L={line:v.LineChart,bar:v.BarChart,area:v.AreaChart};function w(e){var t={};return e.forEach((function(e){t[e]=!0})),t}const N=function(e){var t=e.minChartWidth,n=void 0===t?200:t,i=e.maxHeight,c=void 0===i?600:i,l=e.yAxisLabelWidth,d=void 0===l?30:l,p=e.aspectRatio,h=void 0===p?16/9:p,g=e.disableChartTypeToggle,b=void 0!==g&&g,C=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["minChartWidth","maxHeight","yAxisLabelWidth","aspectRatio","disableChartTypeToggle"]),k=(0,x.useState)(C.defaultChartType||"line"),S=k[0],T=k[1],N=(0,x.useState)(null),_=N[0],q=N[1],F=(0,x.useState)(C.timeSeries),M=F[0],H=F[1],E=y()(),P=M.length>0?Object.keys(M[0]):[],R=P[0],W=P.slice(1),B=(0,x.useState)(w(W)),U=B[0],I=B[1];(0,x.useEffect)((function(){if(C.updatedData&&C.updatedData.length>0){var e=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,i=t.length;a<i;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))}([],C.timeSeries,!0);C.updatedData.forEach((function(t){e=e.concat(t.timeSeries),H(e)}))}}),[C.timeSeries,C.updatedData]);var K=L[S];function z(e){_?q(null):e&&q(e.currentTarget)}function Y(e,t){return U[e]?C.chartColors[t%C.chartColors.length]:"grey"}function G(e){return U[e]?"none":"line-through"}if(0===M.length)return(0,r.jsx)(m(),{variant:"body2",children:"No data available"});var X,J,Q,V,Z=C.timeSeries[C.timeSeries.length-1],$=(X=C.timeSeries[0][R],J=Z[R],Q=new Date(X),V=new Date(J),Math.round(Math.abs((V.getTime()-Q.getTime())/864e5)));return(0,r.jsxs)(f(),{className:"rustic-recharts-time-series",children:[!b&&(0,r.jsxs)(a(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,r.jsx)(o(),{"aria-label":"chart options","aria-expanded":Boolean(_),"aria-haspopup":"true",onClick:z,color:"primary",children:(0,r.jsx)(O,{name:"more_vert"})}),(0,r.jsxs)(s(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:_,open:Boolean(_),onClose:function(e){return z(e)},children:[(0,r.jsx)(m(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(L).map((function(e){return(0,r.jsxs)(u(),{value:e,selected:e===S,onClick:function(){return function(e){T(e),z()}(e)},children:[e.charAt(0).toUpperCase()+e.slice(1)," ","Chart"]},e)}))]})]}),(0,r.jsxs)(f(),{children:[C.title&&(0,r.jsx)(m(),{variant:"h6",className:"rustic-recharts-time-series-title",children:C.title}),C.description&&(0,r.jsx)(A,{text:C.description}),(0,r.jsx)(v.ResponsiveContainer,{aspect:h,width:C.width,maxHeight:c,minWidth:n,children:(0,r.jsxs)(K,{data:M,margin:C.chartContainerMargin,children:[(0,r.jsx)(v.XAxis,{dataKey:R,tickFormatter:function(e){return j(e,$)},stroke:E.palette.text.primary}),(0,r.jsx)(v.YAxis,{domain:["auto","auto"],width:d,tickFormatter:C.yAxisTickFormatter,stroke:E.palette.text.primary}),(0,r.jsx)(v.Tooltip,{labelFormatter:function(e){return[j(e,$)]},formatter:C.tooltipFormatter,contentStyle:{color:E.palette.common.black}}),(0,r.jsx)(v.Legend,{content:function(){return(0,r.jsx)(f(),{className:"rustic-recharts-time-series-legend",children:W.map((function(e,t){return(0,r.jsxs)(f(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=U[e]&&!W.find((function(t){return t!==e&&U[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(U)){for(var n={},a=0,i=W;a<i.length;a++){var o=i[a],c=o===e;n[o]=c}I(n)}else I(r?w(W):D(D({},U),((t={})[e]=!U[e],t)))}(e)},sx:{color:Y(e,t)},children:[(0,r.jsx)(O,{name:"crop_16_9"}),(0,r.jsx)(m(),{variant:"body2",display:"inline",sx:{textDecorationLine:G(e)},children:e})]},t)}))})}}),W.map((function(e,t){return U[e]?function(e,t){var n=t%C.chartColors.length,a=U[e]?C.chartColors[n]:"transparent",i={onClick:C.onClick,cursor:"pointer"};switch(S){case"line":return(0,r.jsx)(v.Line,{type:"monotone",isAnimationActive:!1,dataKey:e,name:e,dot:!1,stroke:a,activeDot:C.onClick&&i},e);case"bar":return(0,r.jsx)(v.Bar,{dataKey:e,fill:a,onClick:C.onClick&&i.onClick,cursor:C.onClick&&i.cursor},e);case"area":return(0,r.jsxs)(x.Fragment,{children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("linearGradient",{id:"color".concat(e),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,r.jsx)("stop",{offset:"5%",stopColor:a,stopOpacity:.8}),(0,r.jsx)("stop",{offset:"95%",stopColor:a,stopOpacity:0})]})}),(0,r.jsx)(v.Area,{isAnimationActive:!1,dataKey:e,type:"monotone",stroke:a,fillOpacity:1,fill:"url(#color".concat(e,")"),activeDot:C.onClick&&i},e)]},e)}}(e,t):null})),C.referenceLineYAxis&&C.referenceLineYAxis.map((function(e,t){return(0,r.jsx)(v.ReferenceLine,{y:e,label:C.referenceLineLabel&&C.referenceLineLabel[t],stroke:C.referenceLineColor&&C.referenceLineColor[t],strokeDasharray:"3 3",ifOverflow:"extendDomain",strokeWidth:C.referenceLineStrokeWidth&&C.referenceLineStrokeWidth[t],isFront:!0},t)}))]})})]})]})};return t})()));
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import './rechartsTimeSeries.css';
|
|
2
|
-
export interface TimeSeriesData {
|
|
3
|
-
timestamp: number;
|
|
4
|
-
[key: string]: number;
|
|
5
|
-
}
|
|
6
|
-
export interface Margin {
|
|
7
|
-
top?: number;
|
|
8
|
-
right?: number;
|
|
9
|
-
bottom?: number;
|
|
10
|
-
left?: number;
|
|
11
|
-
}
|
|
12
|
-
export interface RechartsTimeSeriesProps {
|
|
13
|
-
/** Data to be displayed in the time series chart. The first field is used as the x-axis field. We currently support formatting timestamps in milliseconds. Other data types will be displayed as given. */
|
|
14
|
-
timeSeries: TimeSeriesData[];
|
|
15
|
-
/** An array containing a predefined set of Hex color codes or string colors (e.g. 'blue'). The colors will be applied to the keys of the data object in order. */
|
|
16
|
-
chartColors: string[];
|
|
17
|
-
/** Array of y-axis reference lines. */
|
|
18
|
-
referenceLineYAxis?: number[];
|
|
19
|
-
/** Array of y-axis reference line colors. Hex color codes and string colors are both supported for defining colors. If not provided, all lines default to grey. Skip providing a custom color for a certain y-axis by providing an empty string. */
|
|
20
|
-
referenceLineColor?: string[];
|
|
21
|
-
/** Array of y-axis reference line labels. Skip providing a custom label for a certain y-axis by providing an empty string. */
|
|
22
|
-
referenceLineLabel?: string[];
|
|
23
|
-
/** Array of y-axis reference line stroke widths. If not provided, all lines default to 1. Skip providing a custom stroke width for a certain y-axis by providing an empty string. */
|
|
24
|
-
referenceLineStrokeWidth?: number[];
|
|
25
|
-
/** Title of the time series chart. */
|
|
26
|
-
title?: string;
|
|
27
|
-
/** Description of the time series chart. */
|
|
28
|
-
description?: string;
|
|
29
|
-
/** Callback function to be called when a point on the graph is clicked. */
|
|
30
|
-
onClick?: (...args: any[]) => any;
|
|
31
|
-
/** Width of the y-axis labels in pixels. */
|
|
32
|
-
yAxisLabelWidth?: number;
|
|
33
|
-
/** Minimum width of the chart in pixels. */
|
|
34
|
-
minChartWidth?: number;
|
|
35
|
-
/** Maximum width of the chart in pixels. */
|
|
36
|
-
maxHeight?: number;
|
|
37
|
-
/** Updated data will be added to the original time series data. */
|
|
38
|
-
updatedData?: {
|
|
39
|
-
timeSeries: TimeSeriesData[];
|
|
40
|
-
}[];
|
|
41
|
-
/** Aspect ratio of the chart. */
|
|
42
|
-
aspectRatio?: number;
|
|
43
|
-
/** Width of the chart in pixels. */
|
|
44
|
-
width?: number;
|
|
45
|
-
/** Chart type toggle will be hidden if the value is true. */
|
|
46
|
-
disableChartTypeToggle?: boolean;
|
|
47
|
-
/** Define the default chart type: `line`, `bar`, or `area`. */
|
|
48
|
-
defaultChartType?: TimeSeriesType;
|
|
49
|
-
/** Pass a function to format y-axis label. Make sure to use tooltipFormatter and yAxisTickFormatter together so that the numbers are uniform. */
|
|
50
|
-
yAxisTickFormatter?: (value: number) => string;
|
|
51
|
-
/** Pass a function to format tooltip content. */
|
|
52
|
-
tooltipFormatter?: (value: number, name: string) => [string, string];
|
|
53
|
-
/** Margin of chart container in pixels. For example, adding left margin could show larger numbered labels properly. */
|
|
54
|
-
chartContainerMargin?: Margin;
|
|
55
|
-
}
|
|
56
|
-
export type TimeSeriesType = 'line' | 'bar' | 'area';
|
|
57
|
-
/** > **Deprecated:** Use other visualization components instead. This component will be removed in the next release.
|
|
58
|
-
*
|
|
59
|
-
* The `RechartsTimeSeries` component integrates the [Recharts](https://recharts.org/en-US/api) library to facilitate the visualization of time-based data through various chart types such as line charts, bar charts, and area charts. It supports customizations for reference lines, tooltips, and chart type toggling, providing a flexible and interactive data representation solution.
|
|
60
|
-
*
|
|
61
|
-
* Note: `Recharts` is not bundled, so please install the following package using npm:
|
|
62
|
-
*
|
|
63
|
-
* ```
|
|
64
|
-
* npm i recharts
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
declare function RechartsTimeSeries({ minChartWidth, maxHeight, yAxisLabelWidth, aspectRatio, disableChartTypeToggle, ...props }: RechartsTimeSeriesProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
-
export default RechartsTimeSeries;
|
|
69
|
-
//# sourceMappingURL=rechartsTimeSeries.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rechartsTimeSeries.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/chart/rechartsTimeSeries.tsx"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAA;AA8BjC,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,2MAA2M;IAC3M,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,kKAAkK;IAClK,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,oPAAoP;IACpP,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,8HAA8H;IAC9H,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,qLAAqL;IACrL,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,2EAA2E;IAE3E,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACjC,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,WAAW,CAAC,EAAE;QAAE,UAAU,EAAE,cAAc,EAAE,CAAA;KAAE,EAAE,CAAA;IAChD,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,cAAc,CAAA;IACjC,iJAAiJ;IACjJ,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9C,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpE,uHAAuH;IACvH,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAyBpD;;;;;;;;;GASG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,aAAoC,EACpC,SAA4B,EAC5B,eAAwC,EAExC,WAAoB,EACpB,sBAA8B,EAC9B,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAyTzB;AAED,eAAe,kBAAkB,CAAA"}
|