@rustic-ai/ui-components 0.0.36 → 0.0.38
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/filePreview/filePreview.d.ts +1 -12
- package/dist/components/filePreview/filePreview.d.ts.map +1 -1
- package/dist/components/image/image.d.ts +1 -7
- package/dist/components/image/image.d.ts.map +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- 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 +1 -11
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/uploader/index.js +1 -1
- package/dist/components/input/textInput/index.js +1 -1
- package/dist/components/markdown/index.js +1 -1
- package/dist/components/media/audio/index.js +1 -1
- package/dist/components/media/timeIndicator/timeIndicator.d.ts +2 -7
- package/dist/components/media/timeIndicator/timeIndicator.d.ts.map +1 -1
- package/dist/components/media/video/index.js +1 -1
- package/dist/components/messageSpace/index.js +1 -1
- package/dist/components/messageSpace/messageSpace.d.ts +1 -7
- package/dist/components/messageSpace/messageSpace.d.ts.map +1 -1
- package/dist/components/multipart/chatCompletion/index.js +1 -1
- package/dist/components/multipart/multipart/index.js +1 -1
- package/dist/components/prompts/index.js +1 -1
- package/dist/components/prompts/prompts.d.ts.map +1 -1
- package/dist/components/question/index.js +1 -1
- package/dist/components/question/question.d.ts.map +1 -1
- package/dist/components/video/index.js +1 -1
- package/dist/components/video/youtubeVideo.d.ts +1 -7
- package/dist/components/video/youtubeVideo.d.ts.map +1 -1
- package/dist/components/visualization/chart/index.js +1 -1
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts +1 -10
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts.map +1 -1
- package/dist/components/visualization/vegaLiteViz/index.js +1 -1
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts +1 -8
- package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +39 -34
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:()=>f});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"),m=require("uniforms-mui");var p=r(3903);function f(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,f=new(l())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),h=(o=e.schema,c=f.compile(o),function(e){var t;return c(e),(null===(t=c.errors)||void 0===t?void 0:t.length)?{details:c.errors}:null}),v=new d.JSONSchemaBridge({schema:e.schema,validator:h});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)(s(),{variant:"body1",children:e.description}),(0,n.jsx)(m.AutoForm,{schema:v,onSubmit:function(t){return function(t){var r=(new Date).toISOString(),n={id:(0,p.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"formResponse",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},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})})}},2500:(e,t,r)=>{r.d(t,{default:()=>a}),r(1737);var n=r(7131);r(7159);const a=n.A},1737:(e,t,r)=>{r.d(t,{A:()=>d});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),c=r(7447),l=r.n(c),u=r(2015);const d=function(e){var t=(0,u.useState)(l().sanitize(e.text)),r=t[0],a=t[1],o=(0,u.useState)(""),c=o[0],d=o[1];return(0,u.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(l().sanitize(t))}}),[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s(),{variant:"body2",children:r}),c&&(0,n.jsx)(i(),{severity:"error",children:c})]})}},7131:(e,t,r)=>{r.d(t,{A:()=>c});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o);r(2015);const c=function(e){return(0,n.jsx)(i(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})}},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:()=>p,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"},m={fontSize:"16px",lineHeight:1.75,letterSpacing:"0.15px",padding:"0 24px",minHeight:"64px"};function p(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"},m),"&.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"},m),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)(p("light",l)),h=(0,n.createTheme)(p("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")},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:()=>ir,CodeSnippet:()=>O,CopyText:()=>Wt,ElementRenderer:()=>L,FCCalendar:()=>w,Icon:()=>A.A,Image:()=>G,MarkedMarkdown:()=>wt,MarkedStreamingMarkdown:()=>St,MermaidViz:()=>vn,MessageCanvas:()=>Qt,MessageSpace:()=>rr,MultimodalInput:()=>et,Multipart:()=>sr,OpenLayersMap:()=>gt,PDFViewer:()=>Le,ParticipantsContainer:()=>wr,PerspectiveViz:()=>jn,PlotlyGraph:()=>Cn,PopoverMenu:()=>Ke,PromptBuilder:()=>Dr,Prompts:()=>Lr,Question:()=>Ar,RechartsTimeSeries:()=>mn,Sound:()=>qt,StreamingText:()=>tn.A,Table:()=>en,Text:()=>or.A,TextInput:()=>nt,TextToSpeech:()=>Ut,Timestamp:()=>Kt,UniformsForm:()=>D.UniformsForm,Uploader:()=>Xe,VegaLiteViz:()=>Dn,Video:()=>zt,Weather:()=>Pn,YoutubeVideo:()=>nn,generateTheme:()=>Ln.generateTheme,rusticDarkTheme:()=>Ln.rusticDarkTheme,rusticLightTheme:()=>Ln.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 m=a.n(d),p=a(6989),f=a.n(p),h=a(6182);const v=require("@mui/material/useMediaQuery");var g=a.n(v),x=a(2015),b=a.n(x),y=function(){return y=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},y.apply(this,arguments)};function j(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}function w(e){var t=(0,h.useTheme)(),r=g()(t.breakpoints.up("md"));return(0,o.jsx)(f(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),".fc .fc-toolbar-title":y({},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":y({},t.typography.caption)},children:(0,o.jsx)(u(),{plugins:[m(),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(j)})})}const S=require("@codemirror/language"),k=require("@codemirror/language-data"),C=require("@codemirror/state"),F=require("@codemirror/view");var N=a(785),E=a.n(N);const T=require("@mui/system");function O(e){var t=(0,x.useRef)(null),r=(0,x.useRef)(),n=new C.Compartment,a=[C.EditorState.readOnly.of(!0),(0,F.highlightSpecialChars)(),(0,S.syntaxHighlighting)(S.defaultHighlightStyle,{fallback:!0}),n.of([])],i=k.languages.find((function(t){return t.name.toLowerCase()===e.language.toLowerCase()}));return(0,x.useEffect)((function(){if(t.current&&!r.current){var o=t.current,s=C.EditorState.create({doc:e.code,extensions:a});r.current=new F.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.jsx)(T.Box,{sx:{backgroundColor:"background.default"},className:"rustic-code-snippet",children:(0,o.jsx)("div",{"aria-label":"code snippet",ref:t,children:(0,o.jsx)(E(),{variant:"body2","aria-label":"language type",children:e.language})})})}var D=a(9528),P=function(){return P=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},P.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?b().createElement(n,P(P({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)(E(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var A=a(9767);const M=require("@mui/material/CircularProgress");var I,R=a.n(M),q=function(){return q=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},q.apply(this,arguments)},B=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function _(e,t){return function(e,t){var r,n=new Date(e),a=navigator.language;return r=t===I.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(a,r)}(e,t<=1?I.HOUR:I.MONTH_DATE)}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,t){var r={};return e&&(r={width:e}),t&&(r=q(q({},r),{height:t})),e||t||(r={className:"rustic-fit-container"}),r}function W(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"}(I||(I={}));var V=function(){return V=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},V.apply(this,arguments)};function G(e){var t=(0,x.useState)(!0),r=t[0],n=t[1],a=(0,x.useState)(""),i=a[0],s=a[1];return i.length>0?(0,o.jsx)(E(),{variant:"body2",children:i}):(0,o.jsxs)("figure",{children:[r&&(0,o.jsx)(R(),{}),(0,o.jsx)("img",V({},H(e.width,e.height),{src:e.src,alt:e.alt,onError:function(){s("Image failed to load"),n(!1)},onLoad:function(){n(!1)}})),e.description&&(0,o.jsx)("figcaption",{children:(0,o.jsx)(E(),{variant:"body2",children:e.description})})]})}G.defaultProps={alt:"An image is displayed"};var K=a(3903);const Q=require("@mui/material/Avatar");var Y=a.n(Q),$=a(909),X=a.n($);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,x.useRef)(null),n=(0,x.useRef)(null),i=(0,x.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,x.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,x.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)(A.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 me={"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 pe(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)(Y(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(E(),{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)}))})})}var ve=(0,x.forwardRef)((function(e,t){var r=(0,x.useState)(""),n=r[0],a=r[1],i=(0,x.useState)(!1),s=i[0],c=i[1],l=(0,x.useState)(!1),u=l[0],d=l[1],m=(0,x.useState)(!1),p=m[0],h=m[1],v=(0,x.useState)(""),g=v[0],b=v[1],y=(0,x.useState)([]),j=y[0],w=y[1],S=(0,x.useState)(!1),k=S[0],C=S[1],F=(0,x.useState)(0),N=F[0],T=F[1],O=(0,x.useRef)(null),D=new ue.Database({dataSource:e.emojiDataSource}),P=!n.trim().length&&!e.isSendEnabled,L="".concat(s?"Stop":"Start"," speech to text"),M=u?"primary.main":"primary.light",I=s?"error.main":M,q=s?"stop_circle":"speech_to_text",B=(0,x.useState)([]),_=B[0],z=B[1],H=(0,x.useState)(!1),W=H[0],V=H[1];function G(e,t){if(O.current){var r=O.current,i=r.selectionStart,o=r.selectionEnd;if("number"==typeof i&&"number"==typeof o){var s,c=n||"",l=c.substring(0,i),u=c.substring(o),d=void 0;t?(d=l.replace(t,e)+u,s=l.replace(t,e).length):(d=l+e+u,s=i+e.length),a(d),setTimeout((function(){var e,t;null===(e=O.current)||void 0===e||e.focus(),null===(t=O.current)||void 0===t||t.setSelectionRange(s,s)}),0)}}}function Q(e){G("@".concat(e," "),/@(\w*)$/),z([])}function Y(e,t){void 0===t&&(t=!1),G(e,t?/:(\w+)$/:void 0),C(!1)}var $=p?(0,o.jsx)(R(),{size:24}):(0,o.jsx)(le(),{title:L,children:(0,o.jsx)(X(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,s?(e.stop(),h(!0),c(!1)):(e.start(),b(""),c(!0)),e.onstart=function(){c(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;n.length>0?a(n+" "+r):a(r),null===(t=O.current)||void 0===t||t.focus(),c(!1)},e.onerror=function(e){var t=me[e.error];b(t),c(!1)},e.onend=function(){h(!1),c(!1)}},size:"small",sx:{color:I,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(A.A,{name:q})})});function Z(){var t=(new Date).toISOString(),r={id:(0,K.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:U(n)};e.send(r),a(""),b("")}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)(E(),{variant:"caption",color:"error",className:"rustic-error-message",children:g})}),(0,o.jsxs)(f(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:u?"secondary.main":"action.disabled"},children:[j.length>0&&O.current&&(0,o.jsx)(he,{anchorEl:O.current,items:j.filter((function(e){return"unicode"in e})),isOpen:k,onClose:function(){C(!1),T(0)},onSelect:function(e){return Y(e.unicode,!0)},selectedIndex:N,renderItem:pe}),_.length>0&&O.current&&(0,o.jsx)(he,{anchorEl:O.current,items:_,isOpen:W,onClose:function(){V(!1),T(0)},onSelect:function(e){return Q(e.displayName)},renderItem:fe,selectedIndex:N}),(0,o.jsx)(se(),{className:"rustic-text-field",variant:"outlined",value:n,label:e.label,placeholder:e.placeholder,maxRows:e.maxRows,multiline:e.multiline,fullWidth:e.fullWidth,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),k&&j.length>0&&"unicode"in j[N]?Y(j[N].unicode,!0):W&&_.length>0?Q(_[N].displayName):e.shiftKey||P||Z();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(k?T((function(e){return(e+t+j.length)%j.length})):W&&T((function(e){return(e+t+_.length)%_.length})));0!==N&&T(0)}},onChange:function(t){b("");var r=t.target.value;a(r),function(t){var r=t.match(/@(\w*)$/);if(r&&e.getMembers){var n=r[1].toLowerCase();e.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(n)}));z(t),t.length>0?V(!0):V(!1)}))}else z([])}(r);var n,i=r.match(/:(\w{2,}):/g),o=r.match(/:(\w{2,})/g);if(i){var s=i[0].replace(/:/g,"");D.getEmojiByShortcode(s).then((function(e){if(e&&"unicode"in e){var t=r.replace(i[0],e.unicode);a(t)}else a(r)})).catch((function(){a(r)})),C(!1)}else o?(n=o[0].replace(":",""),D.getEmojiBySearchQuery(n).then((function(t){t.length?(w(t.slice(0,e.maximumEmojiSearchResults)),C(!0)):(w([]),C(!1))})).catch((function(){w([]),C(!1)}))):C(!1)},onFocus:function(){return d(!0)},onBlur:function(){return d(!1)},inputRef:O,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,o.jsxs)(J(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(de,{dataSource:e.emojiDataSource,onEmojiClick:Y,buttonColor:M}),e.enableSpeechToText&&$]})},inputLabel:{className:u?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(f(),{className:"rustic-input-actions",children:[e.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:Z,disabled:P,color:"secondary",children:(0,o.jsx)(A.A,{name:"send"})})})})]})]})}));ve.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const ge=ve,xe=require("@mui/material/LinearProgress");var be=a.n(xe);const ye=require("axios");var je=a.n(ye);const we=require("react-dom"),Se=require("@mui/material/Card");var ke=a.n(Se);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 Oe=a.n(Te);const De=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)(A.A,{name:r.symbol})})})})},Le=function(e){var t,r=(0,x.useRef)(null),n=(0,x.useState)(1),a=n[0],i=n[1],s=(0,x.useState)(1),c=s[0],l=s[1],u=(0,x.useState)(1),d=u[0],m=u[1],p=(0,x.useState)(!1),h=p[0],v=p[1],b=(0,x.useState)(),y=b[0],j=b[1],w=Oe()(),S=g()(w.breakpoints.down("sm")),k=g()(w.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,o.jsx)(ke(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(E(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var C=(0,x.useState)((function(){return S?.5:k?1:1.5})),F=C[0],N=C[1];return(0,x.useEffect)((function(){De.GlobalWorkerOptions.workerSrc||(De.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(De.version,"/pdf.worker.mjs")),De.getDocument({url:"".concat(e.url)}).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]};y&&y.cancel();var s=e.render(o);j(s),s.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){v(!0)}))}),[e.url,a,F]),h?(0,o.jsx)(ke(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(E(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(ke(),{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(){N((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(Pe,{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)(Pe,{action:"previousPage",onClick:function(){a>1&&(i(a-1),m(a-1))},isDisabled:1===a}),(0,o.jsx)(E(),{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);m(t),!isNaN(t)&&t>=1&&t<=c&&i(t)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(E(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(Pe,{action:"nextPage",onClick:function(){a<c&&(i(a+1),m(a+1))},isDisabled:a===c})]})]})};var Ae={pdf:Le};function Me(e){var t=(0,h.useTheme)(),r=(0,x.useState)(!1),n=r[0],a=r[1];function i(){a(!1)}var s,c,l=e.file.url&&(s=e.file.url.split("."))[s.length-1].toLowerCase(),u=l&&e.supportedViewers?e.supportedViewers[l]:null,d=!!u,m=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",p=d?" rustic-cursor-pointer":"",f="rustic-file-preview ".concat(m).concat(p),v=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(ke(),{className:f,variant:"outlined",sx:{boxShadow:t.shadows[1]},onClick:function(){a(!0)},children:[(0,o.jsx)(E(),{variant:"subtitle2",className:"rustic-file-preview-name",children:v}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),d&&(0,o.jsx)(Fe(),{open:n,onClose:i,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:i,className:"rustic-close-button",children:(0,o.jsx)(A.A,{name:"close"})})}),e.file.url&&(0,o.jsx)(u,{url:e.file.url})]})})]})}Me.defaultProps={supportedViewers:Ae,showFullName:!0};var Ie=a(3110);const Re=require("@mui/material"),qe=require("@mui/material/Button");var Be=a.n(qe);const _e=require("@mui/material/Drawer");var ze=a.n(_e);const He=require("@mui/material/ListItemText");var We=a.n(He);const Ue=require("@mui/material/Menu");var Ve=a.n(Ue),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,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useRef)(null),i=(0,h.useTheme)(),s=(0,Re.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)(We(),{children:(0,o.jsx)(E(),{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 m,p,f=s?{}:{anchorEl:a.current};return(0,o.jsxs)(o.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},p=(0,o.jsx)(A.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(Be(),Ge({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(le(),{title:e.ariaLabel,children:(0,o.jsx)(X(),Ge({},m,{children:e.icon?e.icon:p}))})),(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)},Ye=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 $e(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,x.useState)([]),n=r[0],a=r[1],i=(0,x.useState)([]),s=i[0],c=i[1],l=(0,x.useState)({}),u=l[0],d=l[1],m=(0,x.useRef)({}),p=(0,K.v4)();(0,x.useEffect)((function(){a([]),c([]),m.current={}}),[e.messageId]);var h=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function v(e,t,r){var n;m.current=Qe(Qe({},m.current),((n={})[e]=m.current[e]--,n)),function(e,t,r){c((function(t){return Ye(Ye([],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 g=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,o.jsx)(Me,{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)(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(m.current=Qe(Qe({},m.current),((n={})[o]=m.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){je().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 Ye(Ye([],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}))})),m.current=Qe(Qe({},m.current),((i={})[o]=m.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)(E(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function y(e,t){return t?(0,we.createPortal)(e,t):e}var j=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(p);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,o.jsx)(Ie.default,{name:t.iconName})}}));return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(f(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:p,children:(null==j?void 0:j.length)?(0,o.jsx)(Ke,{ariaLabel:"Upload",icon:(0,o.jsx)(Ie.default,{name:"upload_2"}),menuItems:j}):(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:p,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 Ye(Ye([],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 Ye(Ye([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&$e(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,i=function(e){var t,r,n=e.name,a=m.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),m.current=Qe(Qe({},m.current),((t={})[e.name]=i,t))}else m.current=Qe(Qe({},m.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 p(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 Ye(Ye([],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 je().post(f,r,Qe(Qe({},s),{onUploadProgress:p,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=Ye([],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 m,p,f,h;409===(null===(s=n.response)||void 0===s?void 0:s.status)&&e.listFiles?(m=i.lastIndexOf("."),p=i.substring(0,m),f=i.substring(m),h=new RegExp("^".concat(p.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(p,"(").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&&y(b,e.errorMessagesContainer),n.length>0&&y(g,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,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 et(e){var t=(0,x.useState)({uploaded:[],fileList:[]}),r=t[0],n=t[1],a=(0,x.useState)((0,K.v4)()),i=a[0],s=a[1],c=(0,x.useState)(),l=c[0],u=c[1],d=(0,x.useState)(),m=d[0],p=d[1],v=(0,x.useRef)(null),g=(0,h.useTheme)(),b=r.uploaded.length===r.fileList.length&&r.uploaded.length>0;return(0,x.useEffect)((function(){v.current&&(p(v.current.querySelector(".rustic-error-container")),u(v.current.querySelector(".rustic-input-extras")))})),(0,o.jsx)(f(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(g.palette.action.disabled),borderRadius:"".concat(g.shape.borderRadius,"px"),":focus-within":{borderColor:g.palette.secondary.main},background:g.palette.background.paper},children:(0,o.jsx)(ge,Ze({},e,{send:function(t){b&&(t.id=i,t.format="chatCompletionRequest",t.data=U(t.data.text,r.uploaded.map((function(e){return{url:e.url,name:e.name}})))),e.ws.send(t),s((0,K.v4)()),n({uploaded:[],fileList:[]})},isSendEnabled:b,ref:v,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Xe,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)n((function(e){return Ze(Ze({},e),{fileList:Je(Je([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");n((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),a=Je(Je(Je([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Ze(Ze({},e),{uploaded:a})}))}else n((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:i,filePreviewsContainer:l,errorMessagesContainer:m,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions,listFiles:e.listFiles,getUploadHeaders:e.getUploadHeaders})})}))})}et.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};var tt=function(){return tt=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},tt.apply(this,arguments)},rt=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 nt(e){var t=e.ws,r=rt(e,["ws"]);return(0,o.jsx)(ge,tt({},r,{send:function(e){t.send(e)}}))}require("ol/ol.css");var at=a(5642),it=a.n(at);const ot=require("ol/layer/Tile.js");var st=a.n(ot);const ct=require("ol/Map.js");var lt=a.n(ct);const ut=require("ol/Overlay.js");var dt=a.n(ut);const mt=require("ol/proj.js"),pt=require("ol/source/OSM.js");var ft=a.n(pt);const ht=require("ol/View.js");var vt=a.n(ht);function gt(e){var t=(0,x.useState)(""),r=t[0],n=t[1],a=(0,x.useRef)(null),i=(0,x.useRef)(null);return(0,x.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(lt())({layers:[new(st())({source:new(ft())})],view:new(vt())({center:(0,mt.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:a.current}),r=new(dt())({element:i.current,position:(0,mt.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)(it(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[(0,o.jsx)(f(),{ref:i,children:(0,o.jsx)(A.A,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,o.jsx)("div",{ref:a,className:"rustic-open-layers-map-canvas"})]})})}var xt=a(7447),bt=a.n(xt);const yt=require("marked");function jt(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=yt.marked.parse(t);return bt().sanitize(r)}const wt=function(e){var t=(0,x.useState)(jt(e.text)),r=t[0],n=t[1];return(0,x.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;n(jt(t))}}),[e.text,e.updatedData]),(0,o.jsx)(E(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}})},St=function(e){var t=(0,x.useState)(jt(e.text)),r=t[0],n=t[1],a=(0,x.useState)(""),i=a[0],s=a[1];return(0,x.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(jt(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(E(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),i&&(0,o.jsx)(it(),{severity:"error",children:i})]})},kt=require("@mui/material/Slider");var Ct=a.n(kt);function Ft(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)(A.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var Nt=100;function Et(e){var t="dark"===(0,Re.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*Nt;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)(Ct(),{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 Tt(e){var t=(0,x.useState)(e.mediaElement.volume),r=t[0],n=t[1],a=(0,x.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)(Ft,{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)(Ct(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*Nt,"%"),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)(A.A,{name:t}),children:(0,o.jsx)(E(),{variant:"overline",children:r})})}function Dt(e){var t=(0,x.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)(Ft,{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,x.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)(E(),{variant:"body1",children:[n,"X"]})})})}function Lt(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)(Ft,{onClick:r,action:n})}function At(e){var t=z(e.elapsedTimeInSeconds),r=z(e.durationTimeInSeconds),n="".concat(t," / ").concat(r);return"wide"===e.style?(0,o.jsxs)(f(),{className:"rustic-time-container",children:[(0,o.jsx)(E(),{variant:"overline",children:t}),(0,o.jsx)(E(),{variant:"overline",children:r})]}):(0,o.jsx)(E(),{variant:"overline",className:"rustic-time-display",children:n})}At.defaultProps={style:"condensed"};const Mt=require("@mui/material/Divider");var It=a.n(Mt);function Rt(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)(E(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function qt(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!0),l=c[0],u=c[1],d=(0,x.useState)(0),m=d[0],p=d[1],f=(0,x.useState)(""),h=f[0],v=f[1],g=(0,x.useState)(""),b=g[0],y=g[1],j=(0,Re.useTheme)(),w=(0,x.useRef)(null),S=(0,Re.useMediaQuery)(j.breakpoints.down("md"));function k(){return(0,o.jsx)(E(),{variant:"h6",className:"rustic-sound-title",children:e.title})}function C(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(Ft,{action:t,onClick:function(){return s(!i)}})}}function F(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Lt,{mediaElement:w.current,movement:"replay"}),(0,o.jsx)(Dt,{mediaElement:w.current,onError:y}),(0,o.jsx)(Lt,{mediaElement:w.current,movement:"forward"})]})}function N(){if(e.transcript&&r)return(0,o.jsx)(Rt,{transcript:e.transcript})}function O(){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:w,className:i?"rustic-has-captions":"",children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,x.useEffect)((function(){var e,t,r,n;function a(e){v(e)}null===(e=w.current)||void 0===e||e.addEventListener("timeupdate",(function(){w.current&&p(w.current.currentTime)})),null===(t=w.current)||void 0===t||t.addEventListener("canplay",(function(){v(""),u(!1)})),null===(r=w.current)||void 0===r||r.addEventListener("error",(function(){return a("Failed to load the audio.")})),null===(n=w.current)||void 0===n||n.addEventListener("stalled",(function(){return a("Failed to fetch audio data, but trying.")}))}),[]);var P=S?function(){if(w.current)return(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(At,{elapsedTimeInSeconds:m,durationTimeInSeconds:w.current.duration,style:"wide"}),(0,o.jsx)(Et,{mediaElement:w.current}),k(),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-left",children:F()}),(0,o.jsx)(Tt,{mediaElement:w.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-right",children:[O(),(0,o.jsxs)(T.Box,{children:[C(),(0,o.jsx)(Pt,{mediaElement:w.current})]})]})]}),N()]})}:function(){if(w.current)return(0,o.jsxs)(o.Fragment,{children:[k(),(0,o.jsxs)(T.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Et,{mediaElement:w.current}),(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsxs)(T.Box,{className:"rustic-sound-bottom-controls-left",children:[F(),C(),(0,o.jsx)(Pt,{mediaElement:w.current}),(0,o.jsx)(Tt,{mediaElement:w.current}),(0,o.jsx)(At,{elapsedTimeInSeconds:m,durationTimeInSeconds:w.current.duration,style:"condensed"})]}),(0,o.jsx)(T.Box,{className:"rustic-sound-bottom-controls-right",children:O()})]}),N()]})]})};return h.length>0?(0,o.jsx)(it(),{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(),P(),b.length>0&&(0,o.jsx)(it(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b})]})}function Bt(e){var t=(0,x.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)(Ft,{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,x.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)(Ft,{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,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!0),l=c[0],u=c[1],d=(0,x.useState)(!!document.fullscreenElement),m=d[0],p=d[1],f=(0,x.useState)(!1),h=f[0],v=f[1],g=(0,x.useState)(""),b=g[0],y=g[1],j=(0,x.useState)(""),w=j[0],S=j[1],k=(0,x.useState)(0),C=k[0],F=k[1],N=(0,x.useRef)(null),O=(0,x.useRef)(null),D=(0,Re.useTheme)(),P=(0,Re.useMediaQuery)(D.breakpoints.down("md"));(0,x.useEffect)((function(){var e,t,r,n,a,i,o,s;function c(e){S(e),u(!1)}function l(){clearTimeout(s),s=setTimeout((function(){return v(!1)}),3e3)}null===(e=O.current)||void 0===e||e.addEventListener("timeupdate",(function(){O.current&&F(O.current.currentTime)})),null===(t=O.current)||void 0===t||t.addEventListener("canplay",(function(){S(""),u(!1)})),null===(r=O.current)||void 0===r||r.addEventListener("error",(function(){return c("Failed to load the video.")})),null===(n=O.current)||void 0===n||n.addEventListener("stalled",(function(){return c("Failed to fetch video data, but trying.")})),document.addEventListener("fullscreenchange",(function(){p(!!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 L={backgroundColor:D.palette.background.paper,opacity:h?1:0};function A(){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)(Ft,{action:t,onClick:function(){return s(!i)}})}}function I(){if(e.transcript)return(0,o.jsx)(Ot,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var q=P?function(){return m?(0,o.jsx)(o.Fragment,{children:O.current&&N.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)(Dt,{mediaElement:O.current,onError:y}),(0,o.jsx)(Et,{mediaElement:O.current}),(0,o.jsx)(At,{elapsedTimeInSeconds:C,durationTimeInSeconds:O.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)(Lt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(Lt,{mediaElement:O.current,movement:"forward"}),M(),(0,o.jsx)(Pt,{mediaElement:O.current})]}),I()]}),A()]})}):(0,o.jsx)(o.Fragment,{children:O.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(Dt,{mediaElement:O.current,onError:y}),(0,o.jsxs)(T.Box,{className:"rustic-video-controls-right",children:[I(),(0,o.jsx)(_t,{element:N.current,onError:y})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:O.current&&N.current&&(0,o.jsxs)(T.Box,{className:"rustic-video-controls",sx:L,children:[(0,o.jsx)(Et,{mediaElement:O.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)(Dt,{mediaElement:O.current,onError:y}),(0,o.jsx)(Lt,{mediaElement:O.current,movement:"replay"}),(0,o.jsx)(Lt,{mediaElement:O.current,movement:"forward"}),M(),(0,o.jsx)(Pt,{mediaElement:O.current}),(0,o.jsx)(Tt,{mediaElement:O.current}),(0,o.jsx)(At,{elapsedTimeInSeconds:C,durationTimeInSeconds:O.current.duration,style:"condensed"})]}),(0,o.jsxs)(T.Box,{className:"rustic-video-bottom-controls-right",children:[I(),(0,o.jsx)(Bt,{mediaElement:O.current,onError:y}),(0,o.jsx)(_t,{element:N.current,onError:y})]})]}),m&&A()]})})};return w.length>0?(0,o.jsx)(it(),{severity:"error",children:w}):(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)(it(),{severity:"error",className:"rustic-control-error",onClose:function(){return y("")},children:b}),(!P||m)&&function(){if(O.current&&N.current)return(0,o.jsxs)(T.Box,{className:"rustic-video-title",sx:L,children:[(0,o.jsx)(E(),{variant:"body2",children:e.title}),m&&P&&(0,o.jsxs)(T.Box,{children:[(0,o.jsx)(Bt,{mediaElement:O.current,onError:y}),(0,o.jsx)(_t,{element:N.current,onError:y})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:O,src:e.src,poster:e.poster,children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),q()]}),!m&&A()]})}var Ht=a(4445);function Wt(e){var t=(0,x.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(Ht.default,{message:e.message,icon:(0,o.jsx)(A.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,x.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)(A.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)(E(),{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,x.forwardRef)((function(e,t){var r=(0,Re.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)(ke(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(n)}),(0,o.jsxs)(ke(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,o.jsxs)(E(),{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,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 tr(e,t){var r;if(!(r=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.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]=er(er([],n[r],!0),[t],!1),n}function rr(e){var t,r,n,a=(0,x.useRef)(null),i=(0,x.useRef)(null),s=(0,x.useRef)(),c=(0,x.useState)(!0),l=c[0],u=c[1],d=(0,x.useState)(!0),m=d[0],p=d[1],f=(0,x.useState)(!1),h=f[0],v=f[1],g=(0,x.useState)({}),b=g[0],y=g[1],j=Object.keys(b).length,w=(r=j,n=(0,x.useRef)(0),(0,x.useEffect)((function(){n.current=r})),n.current);function S(){p(!0),s.current&&clearTimeout(s.current),s.current=setTimeout((function(){p(!1)}),2e3)}function k(){var e=i.current,t=a.current;if(e&&t){var r=e.getBoundingClientRect().bottom,n=t.getBoundingClientRect().bottom;u(n-1<=r)}}function C(){if(function(){var e,t=null===(e=i.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=i.current;v(!0),e&&setTimeout((function(){S(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(C,1)}function F(e){y((function(t){return tr(t,e)}))}return(0,x.useEffect)((function(){var e=i.current;if(k(),e)return e.addEventListener("scroll",k),window.addEventListener("resize",k),function(){e.removeEventListener("scroll",k),window.removeEventListener("resize",k)}}),[l]),(0,x.useEffect)((function(){C()}),[h]),(0,x.useEffect)((function(){l&&0!==w&&j>w&&(S(),C())}),[l,Object.keys(b).length]),(0,x.useEffect)((function(){var t,r={};null===(t=e.receivedMessages)||void 0===t||t.forEach((function(e){var t=tr(r,e);r=t})),y(r)}),[null===(t=e.receivedMessages)||void 0===t?void 0:t.length]),(0,x.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(F)}),[]),(0,o.jsxs)(Zt(),{className:"rustic-message-space",children:[(0,o.jsxs)(Zt(),{ref:i,className:"rustic-message-container",children:[Object.keys(b).map((function(t,r){var n,i=b[t],s=i[i.length-1],c=s.format.includes("Response"),l=c&&{inReplyTo:i[0]};return"prompts"!==s.format?(0,o.jsx)(Qt,Jt({message:s},l,{getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===j-1?a:null,children:(0,o.jsx)(L,{ws:e.ws,sender:e.sender,messages:c?[i[0]]:i,supportedElements:e.supportedElements})}),t):"inConversation"===(null===(n=s.data)||void 0===n?void 0:n.position)?(0,o.jsx)("div",{ref:r===j-1?a:null,children:(0,o.jsx)(L,{ws:e.ws,sender:e.sender,messages:c?[i[0]]:i,supportedElements:e.supportedElements})},t):void 0})),!l&&!m&&(0,o.jsx)($t(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:C,label:(0,o.jsxs)(o.Fragment,{children:[e.scrollDownLabel,(0,o.jsx)(A.A,{name:"arrow_downward"})]})})]}),function(t){var r,n=Object.values(t).flat(),a=n[n.length-1];return"prompts"===(null==a?void 0:a.format)&&"inConversation"!==(null===(r=null==a?void 0:a.data)||void 0===r?void 0:r.position)?(0,o.jsx)(L,{ws:e.ws,sender:e.sender,messages:[a],supportedElements:e.supportedElements}):null}(b)]})}rr.defaultProps={scrollDownLabel:"Scroll down"};var nr=a(2500);function ar(e){return new URL(e).pathname.split("/").pop()}function ir(e){return(0,o.jsx)(f(),{className:"rustic-multipart",children:e.messages.map((function(t){return"string"==typeof t.content?(0,o.jsx)(nr.default,{text:t.content}):(r=t.content,n=[],a="",r.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||ar(r)},s=(0,o.jsx)(Me,{file:i,showFullName:e.showFullName,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)(Ie.default,{name:"download"})})})});n.push(s)}})),(0,o.jsxs)(o.Fragment,{children:[a.length>0&&(0,o.jsx)(nr.default,{text:a}),n.length>0&&(0,o.jsx)(f(),{className:"rustic-files",children:n})]}));var r,n,a}))})}var or=a(7131);function sr(e){return(0,o.jsxs)(Zt(),{className:"rustic-multipart",children:[e.text&&(0,o.jsx)(or.A,{text:e.text}),(t=e.files.map((function(t,r){return(0,o.jsx)(Me,{file:t,showFullName:e.showFullName,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)(A.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 mr=require("@mui/material/List");var pr=a.n(mr);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 br=a.n(xr),yr=a(7159);function jr(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=e.participants.length,i=r?e.participants:e.participants.slice(0,3),s="".concat(br()(e.participantType,a)," (").concat(a,")"),c=r?"Show Less":"Show All ".concat(a);return 0===a?(0,o.jsx)(E(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(pr(),{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)(E(),{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)(A.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)(Y(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(E(),{variant:"subtitle2",children:e.displayName})]}),(0,o.jsx)(E(),{variant:e.participantRole===yr.s.Owner?"subtitle2":"caption",children:B(e.participantRole||yr.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===yr.s.Owner?1:-1}))}(e.filter((function(e){return e.participantType===t})))}var r=t(e.participants,yr.y.Human),n=t(e.participants,yr.y.Agent),a="".concat(br()("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)(A.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)(jr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(A.A,{name:"smart_toy"}),participants:n})]})]})},Sr=require("@mui/material/DialogActions");var kr=a.n(Sr);const Cr=require("@mui/material/DialogContent");var Fr=a.n(Cr);const Nr=require("@mui/material/DialogContentText");var Er=a.n(Nr),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)},Or=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 Dr(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!1),l=c[0],u=c[1],d=(0,x.useState)(!1),m=d[0],p=d[1],f=(0,x.useState)([]),h=f[0],v=f[1],g=(0,x.useState)(null),b=g[0],y=g[1],j=(0,T.useTheme)(),w=h[h.length-1],S=Tr(Tr({},e.ws),{send:function(e){y(e)}});function k(e){v((function(t){return Or(Or([],t,!0),[e],!1)}))}function C(){if(b){var t=Tr(Tr({},b),{threadId:e.messageId});e.ws.send(t)}}if((0,x.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(k)}),[e.ws]),(0,x.useEffect)((function(){h.length>0&&(w&&w.sender.id!==e.sender.id&&s(!1),"promptBuilder"===w.format&&w.data.isLastQuestion&&n(!0))}),[h.length]),0!==h.length)return(0,o.jsxs)(ke(),{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(j.palette.divider)}},children:[(0,o.jsx)(dr(),{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)(Er(),{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)(Be(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(A.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)(E(),{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(!m&&h.length>0)return h.map((function(t){if(t.sender.id!==e.sender.id&&"promptBuilder"!==t.format)return(0,o.jsx)(L,{ws:S,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:!m&&(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)(A.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(Be(),{variant:"outlined",color:"secondary",endIcon:(0,o.jsx)(A.A,{name:"chevron_right"}),onClick:function(){C(),y(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(),p(!0),s(!0),e.onSubmit()},disabled:i,"aria-disabled":i,children:"Generate"})})]})})]})}var Pr=function(){return Pr=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},Pr.apply(this,arguments)};function Lr(e){var t=Oe()(),r=e.prompts.map((function(r,n){return(0,o.jsx)($t(),{onClick:function(){return t=r,n=(new Date).toISOString(),a={id:(0,K.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t}},void e.ws.send(a);var t,n,a},color:"secondary",size:"small",className:"rustic-prompt",sx:Pr(Pr({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 Ar(e){var t=(0,x.useState)(""),r=t[0],n=t[1],a=(0,Re.useTheme)(),i=(0,Re.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,K.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t},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)(E(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",children:e.description})]}),(0,o.jsx)(Gt(),{direction:i,className:"rustic-options-container",children:s})]})}const Mr=require("@mui/material/Table");var Ir=a.n(Mr);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)(A.A,{name:"expand_all"})}function en(e){if(0===e.data.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available"});var t,r,n,a=e.data.length>Zr,i=(0,x.useState)({}),s=i[0],c=i[1],l=(0,x.useState)(a?Zr:-1),u=l[0],d=l[1],m=(0,x.useState)(0),p=m[0],f=m[1],h=(0,Re.useTheme)(),v=Array.from(new Set(e.data.flatMap((function(e){return Object.keys(e)})))),g=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===$r.Descending?1:-1:e[r]>t[r]?n===$r.Descending?-1:1:0})):t),y=b.slice(p*u,p*u+u),j=u>0?y:b;function w(e){if(!s[e])return Jr}return(0,o.jsxs)(Gt(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(E(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)(Hr(),{className:"rustic-table-container",children:(0,o.jsxs)(Ir(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[g.length>0&&(0,o.jsx)(Ur(),{children:(0,o.jsx)(Qr(),{children:g.map((function(e,t){return(0,o.jsx)(_r(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(le(),{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:w(e.dataKey),children:e.label||B(e.dataKey)})})},"header-".concat(t));var r,n}))})}),(0,o.jsx)(qr(),{children:j.map((function(e,t){return(0,o.jsx)(Qr(),{children:g.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:p,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(1737),rn=function(){return rn=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},rn.apply(this,arguments)};function nn(e){var t=bt().sanitize(e.youtubeVideoId);return(0,o.jsx)("iframe",rn({},H(e.width,e.height),{src:"https://www.youtube.com/embed/".concat(t),title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",loading:"lazy"}))}nn.defaultProps={title:"Embedded video"};const an=require("@mui/material/FormControl");var on=a.n(an);const sn=require("recharts");var cn=function(){return cn=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},cn.apply(this,arguments)},ln={line:sn.LineChart,bar:sn.BarChart,area:sn.AreaChart};function un(e){var t={};return e.forEach((function(e){t[e]=!0})),t}function dn(e){var t=(0,x.useState)(e.defaultChartType||"line"),r=t[0],n=t[1],a=(0,x.useState)(null),i=a[0],s=a[1],c=(0,x.useState)(e.timeSeries),l=c[0],u=c[1],d=Oe()(),m=l.length>0?Object.keys(l[0]):[],p=m[0],f=m.slice(1),h=(0,x.useState)(un(f)),v=h[0],g=h[1];(0,x.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=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.timeSeries,!0);e.updatedData.forEach((function(e){t=t.concat(e.timeSeries),u(t)}))}}),[e.timeSeries,e.updatedData]);var b=ln[r];function y(e){i?s(null):e&&s(e.currentTarget)}function j(t,r){return v[t]?e.chartColors[r%e.chartColors.length]:"grey"}function w(e){return v[e]?"none":"line-through"}if(0===l.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available"});var S,k,C,F,N=e.timeSeries[e.timeSeries.length-1],T=(S=e.timeSeries[0][p],k=N[p],C=new Date(S),F=new Date(k),Math.round(Math.abs((F.getTime()-C.getTime())/864e5)));return(0,o.jsxs)(Zt(),{className:"rustic-recharts-time-series",children:[!e.disableChartTypeToggle&&(0,o.jsxs)(on(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,o.jsx)(X(),{"aria-label":"chart options","aria-expanded":Boolean(i),"aria-haspopup":"true",onClick:y,color:"primary",children:(0,o.jsx)(A.A,{name:"more_vert"})}),(0,o.jsxs)(Ve(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:i,open:Boolean(i),onClose:function(e){return y(e)},children:[(0,o.jsx)(E(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(ln).map((function(e){return(0,o.jsxs)(te(),{value:e,selected:e===r,onClick:function(){return function(e){n(e),y()}(e)},children:[e.charAt(0).toUpperCase()+e.slice(1)," ","Chart"]},e)}))]})]}),(0,o.jsxs)(Zt(),{children:[e.title&&(0,o.jsx)(E(),{variant:"subtitle2",className:"rustic-recharts-time-series-title",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",className:"rustic-recharts-time-series-description",children:e.description}),(0,o.jsx)(sn.ResponsiveContainer,{aspect:e.aspectRatio,width:e.width,maxHeight:e.maxHeight,minWidth:e.minChartWidth,children:(0,o.jsxs)(b,{data:l,margin:e.chartContainerMargin,children:[(0,o.jsx)(sn.XAxis,{dataKey:p,tickFormatter:function(e){return _(e,T)},stroke:d.palette.text.primary}),(0,o.jsx)(sn.YAxis,{domain:["auto","auto"],width:e.yAxisLabelWidth,tickFormatter:e.yAxisTickFormatter,stroke:d.palette.text.primary}),(0,o.jsx)(sn.Tooltip,{labelFormatter:function(e){return[_(e,T)]},formatter:e.tooltipFormatter,contentStyle:{color:d.palette.common.black}}),(0,o.jsx)(sn.Legend,{content:function(){return(0,o.jsx)(Zt(),{className:"rustic-recharts-time-series-legend",children:f.map((function(e,t){return(0,o.jsxs)(Zt(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=v[e]&&!f.find((function(t){return t!==e&&v[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(v)){for(var n={},a=0,i=f;a<i.length;a++){var o=i[a],s=o===e;n[o]=s}g(n)}else g(r?un(f):cn(cn({},v),((t={})[e]=!v[e],t)))}(e)},sx:{color:j(e,t)},children:[(0,o.jsx)(A.A,{name:"crop_16_9"}),(0,o.jsx)(E(),{variant:"body2",display:"inline",sx:{textDecorationLine:w(e)},children:e})]},t)}))})}}),f.map((function(t,n){return v[t]?function(t,n){var a=n%e.chartColors.length,i=v[t]?e.chartColors[a]:"transparent",s={onClick:e.onClick,cursor:"pointer"};switch(r){case"line":return(0,o.jsx)(sn.Line,{type:"monotone",isAnimationActive:!1,dataKey:t,name:t,dot:!1,stroke:i,activeDot:e.onClick&&s},t);case"bar":return(0,o.jsx)(sn.Bar,{dataKey:t,fill:i,onClick:e.onClick&&s.onClick,cursor:e.onClick&&s.cursor},t);case"area":return(0,o.jsxs)(x.Fragment,{children:[(0,o.jsx)("defs",{children:(0,o.jsxs)("linearGradient",{id:"color".concat(t),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,o.jsx)("stop",{offset:"5%",stopColor:i,stopOpacity:.8}),(0,o.jsx)("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),(0,o.jsx)(sn.Area,{isAnimationActive:!1,dataKey:t,type:"monotone",stroke:i,fillOpacity:1,fill:"url(#color".concat(t,")"),activeDot:e.onClick&&s},t)]},t)}}(t,n):null})),e.referenceLineYAxis&&e.referenceLineYAxis.map((function(t,r){return(0,o.jsx)(sn.ReferenceLine,{y:t,label:e.referenceLineLabel&&e.referenceLineLabel[r],stroke:e.referenceLineColor&&e.referenceLineColor[r],strokeDasharray:"3 3",ifOverflow:"extendDomain",strokeWidth:e.referenceLineStrokeWidth&&e.referenceLineStrokeWidth[r],isFront:!0},r)}))]})})]})]})}dn.defaultProps={minChartWidth:200,maxHeight:600,yAxisLabelWidth:30,aspectRatio:16/9,disableChartTypeToggle:!1};const mn=dn,pn=require("mermaid");var fn=a.n(pn),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=(0,x.useRef)(null),r=(0,x.useState)(),n=r[0],a=r[1],i=Oe()(),s=(0,K.v4)();return(0,x.useEffect)((function(){var r="dark"===i.palette.mode?"dark":"neutral",n=i.typography.fontFamily;t.current&&(fn().initialize(hn({theme:r,themeVariables:{fontFamily:n}},e.config)),fn().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)(E(),{variant:"subtitle2",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"caption",children:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(E(),{variant:"body2",children:n})]})},gn=(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 xn=a.n(gn),bn=function(){return bn=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},bn.apply(this,arguments)};function yn(e){return e?e.reduce((function(e,t){var r=t.dataKey,n=t.label;return e[r]=n||r,e}),{}):{}}const jn=function(e){if(0===e.data.length)return(0,o.jsx)(E(),{variant:"body2",children:"No data available."});var t=(0,x.useRef)(null),r=(0,h.useTheme)(),n=(0,x.useState)(!1),a=n[0],i=n[1],s=r.palette.mode,c="dark"===s?"Pro Dark":"Pro Light",l=yn(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,m,p,f,v,g,b,y,j,w=e.config&&(m=(d=e.config).groupBy,p=d.splitBy,f=d.aggregates,v=d.sort,g=d.filter,b=d.columns,y=null==v?void 0:v.map((function(e){return[l[e[0]]||e[0],e[1]]})),j=f&&Object.fromEntries(Object.entries(f).map((function(e){var t=e[0],r=e[1];return[l[t]||t,r]}))),{group_by:null==m?void 0:m.map((function(e){return l[e]||e})),split_by:null==p?void 0:p.map((function(e){return l[e]||e})),aggregates:j,sort:y,filter:g&&function(e){return e.map((function(e){return[l[e[0]]||e[0],e[1],e[e.length-1]]}))}(g),columns:null==b?void 0:b.map((function(e){return l[e]||e}))});return(0,x.useEffect)((function(){xn().worker().then((function(t){return t.table(function(e,t){var r=yn(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(bn(bn({},w),{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)(E(),{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)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},wn=require("react-plotly.js");var Sn=a.n(wn),kn=function(){return kn=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},kn.apply(this,arguments)};const Cn=function(e){var t=kn(kn({},e.plotParams),{className:"rustic-plotly"});return t.config=kn(kn({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(Zt(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(E(),{variant:"body1",children:e.description}),(0,o.jsx)(Sn(),kn({},t))]})},Fn=require("react-dom/server"),Nn=require("vega-embed");var En=a.n(Nn),Tn=function(){return Tn=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},Tn.apply(this,arguments)};function On(e){var t=(0,x.useRef)(null),r=(0,x.useState)(!1),n=r[0],a=r[1],i=Oe()(),s="dark"===i.palette.mode,c=i.typography.fontFamily,l={backgroundColor:i.palette.primary.main,color:i.palette.background.paper,borderRadius:i.shape.borderRadius+"px",padding:"4px 8px",fontSize:i.typography.caption.fontSize,fontFamily:c,fontWeight:i.typography.caption.fontWeight},u={formatTooltip:function(e,t){return(0,Fn.renderToStaticMarkup)((0,o.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:l,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"},d=[{label:"Save as SVG"},{label:"Save as PNG"}];function m(){var r,n,i,o;if(t.current&&e.spec){var l=Tn(Tn({config:{font:c}},e.options),{theme:s?null===(r=e.theme)||void 0===r?void 0:r.dark:null===(n=e.theme)||void 0===n?void 0:n.light,tooltip:u,actions:!1});(null===(o=null===(i=e.options)||void 0===i?void 0:i.config)||void 0===o?void 0:o.font)||(l.config.font=c);var m=Tn({},e.spec);delete m.title,En()(t.current,m,l).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){d[a].href=e,d[a].downloadFileName="".concat(r,".").concat(n)}))})),a(!1)})).catch((function(){a(!0)}))}}return(0,x.useEffect)((function(){function e(){m()}return m(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[e.spec,s]),n?(0,o.jsx)(E(),{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)(Ke,{menuItems:d,ariaLabel:"Download options"})}),e.title&&(0,o.jsx)(E(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(wt,{text:e.description}),(0,o.jsxs)(Zt(),{textAlign:"center",mt:1,children:["string"==typeof e.spec.title&&(0,o.jsx)(E(),{variant:"subtitle2",children:e.spec.title}),e.spec.description&&(0,o.jsx)(E(),{variant:"caption",children:e.spec.description})]}),(0,o.jsx)("div",{ref:t,className:"rustic-vega-lite"})]})}const Dn=On;function Pn(e){var t=(0,x.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=W(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)),m=e.weather.map((function(e,t){if(0!==t)return(0,o.jsxs)(ke(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(E(),{variant:"h5",component:"span",color:"text.secondary","aria-label":W(e.timestamp).fullName,children:W(e.timestamp).shortName}),(0,o.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,o.jsxs)(E(),{variant:"body2",color:"text.secondary",children:["High: ",a(e.temp.high),"°"]}),(0,o.jsxs)(E(),{variant:"body2",color:"text.secondary",children:["Low: ",a(e.temp.low),"°"]})]},t)}));return(0,o.jsxs)(ke(),{variant:"outlined",className:"rustic-weather",children:[(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)(Gt(),{alignItems:"center",children:[(0,o.jsx)(E(),{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)(E(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(E(),{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)(E(),{variant:"overline",children:u}),(0,o.jsx)(E(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:m}),e.weatherProvider&&(0,o.jsxs)(Gt(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(A.A,{name:"cloud"}),(0,o.jsx)(E(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}On.defaultProps={theme:{dark:"dark"}};var Ln=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:()=>f});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);function f(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,f=new(l())({allErrors:!0,useDefaults:!0,keywords:["uniforms"]}),h=(o=e.schema,c=f.compile(o),function(e){var t;return c(e),(null===(t=c.errors)||void 0===t?void 0:t.length)?{details:c.errors}:null}),v=new d.JSONSchemaBridge({schema:e.schema,validator:h});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)(s(),{variant:"body1",children:e.description}),(0,n.jsx)(p.AutoForm,{schema:v,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: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},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})})}},2500:(e,t,r)=>{r.d(t,{default:()=>a}),r(1737);var n=r(7131);r(7159);const a=n.A},1737:(e,t,r)=>{r.d(t,{A:()=>d});var n=r(8732),a=r(5642),i=r.n(a),o=r(785),s=r.n(o),c=r(7447),l=r.n(c),u=r(2015);const d=function(e){var t=(0,u.useState)(l().sanitize(e.text)),r=t[0],a=t[1],o=(0,u.useState)(""),c=o[0],d=o[1];return(0,u.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(l().sanitize(t))}}),[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s(),{variant:"body2",children:r}),c&&(0,n.jsx)(i(),{severity:"error",children:c})]})}},7131:(e,t,r)=>{r.d(t,{A:()=>c});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o);r(2015);const c=function(e){return(0,n.jsx)(i(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})}},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")},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:()=>Gt.default,ChatCompletion:()=>ur,CodeSnippet:()=>T,CopyText:()=>Kt,ElementRenderer:()=>L,FCCalendar:()=>w,Icon:()=>I.A,Image:()=>K,MarkedMarkdown:()=>Ot,MarkedStreamingMarkdown:()=>Ct,MermaidViz:()=>jn,MessageCanvas:()=>Zt,MessageSpace:()=>sr,MultimodalInput:()=>nt,Multipart:()=>pr,OpenLayersMap:()=>bt,PDFViewer:()=>Le,ParticipantRole:()=>Or.s,ParticipantType:()=>Or.y,ParticipantsContainer:()=>Fr,PerspectiveViz:()=>Cn,PlotlyGraph:()=>Tn,PopoverMenu:()=>Qe,PromptBuilder:()=>Mr,Prompts:()=>qr,Question:()=>Br,RechartsTimeSeries:()=>gn,Sound:()=>Ht,StreamingText:()=>sn.A,Table:()=>on,Text:()=>dr.A,TextInput:()=>ot,TextToSpeech:()=>Qt,Timestamp:()=>Xt,UniformsForm:()=>P.UniformsForm,Uploader:()=>Ze,VegaLiteViz:()=>An,Video:()=>Vt,Weather:()=>Mn,YoutubeVideo:()=>un,generateTheme:()=>Rn.generateTheme,rusticDarkTheme:()=>Rn.rusticDarkTheme,rusticLightTheme:()=>Rn.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);const v=require("@mui/material/useMediaQuery");var g=a.n(v),x=a(2015),y=a.n(x),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 j(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}function w(e){var t=(0,h.useTheme)(),r=g()(t.breakpoints.up("md"));return(0,o.jsx)(f(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(t.palette.divider),borderRadius:"".concat(t.shape.borderRadius,"px"),".fc .fc-toolbar-title":b({},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":b({},t.typography.caption)},children:(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(j)})})}const S=require("@codemirror/language"),k=require("@codemirror/language-data"),O=require("@codemirror/state"),C=require("@codemirror/view");var F=a(785),N=a.n(F);const E=require("@mui/system");function T(e){var t=(0,x.useRef)(null),r=(0,x.useRef)(),n=new O.Compartment,a=[O.EditorState.readOnly.of(!0),(0,C.highlightSpecialChars)(),(0,S.syntaxHighlighting)(S.defaultHighlightStyle,{fallback:!0}),n.of([])],i=k.languages.find((function(t){return t.name.toLowerCase()===e.language.toLowerCase()}));return(0,x.useEffect)((function(){if(t.current&&!r.current){var o=t.current,s=O.EditorState.create({doc:e.code,extensions:a});r.current=new C.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.jsx)(E.Box,{sx:{backgroundColor:"background.default"},className:"rustic-code-snippet",children:(0,o.jsx)("div",{"aria-label":"code snippet",ref:t,children:(0,o.jsx)(N(),{variant:"body2","aria-label":"language type",children:e.language})})})}var P=a(9528),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)};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?y().createElement(n,D(D({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)(N(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var I=a(9767);const A=require("@mui/material/CircularProgress");var M,R=a.n(A),q=function(){return q=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},q.apply(this,arguments)},B=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};function _(e,t){return function(e,t){var r,n=new Date(e),a=navigator.language;return r=t===M.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(a,r)}(e,t<=1?M.HOUR:M.MONTH_DATE)}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,t){var r={};return e&&(r={width:e}),t&&(r=q(q({},r),{height:t})),e||t||(r={className:"rustic-fit-container"}),r}function W(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"}(M||(M={}));var V=function(){return V=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},V.apply(this,arguments)},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 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 K(e){var t=e.alt,r=void 0===t?"An image is displayed":t,n=G(e,["alt"]),a=(0,x.useState)(!0),i=a[0],s=a[1],c=(0,x.useState)(""),l=c[0],u=c[1];return l.length>0?(0,o.jsx)(N(),{variant:"body2",children:l}):(0,o.jsxs)("figure",{children:[i&&(0,o.jsx)(R(),{}),(0,o.jsx)("img",V({},H(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)(N(),{variant:"body2",children:n.description})})]})}var Q=a(3903);const Y=require("@mui/material/Avatar");var $=a.n(Y),X=a(909),Z=a.n(X);const J=require("@mui/material/InputAdornment");var ee=a.n(J);const te=require("@mui/material/MenuItem");var re=a.n(te);const ne=require("@mui/material/MenuList");var ae=a.n(ne);const ie=require("@mui/material/Popover");var oe=a.n(ie);const se=require("@mui/material/TextField");var ce=a.n(se),le=a(4603),ue=a.n(le),de=a(8342);const pe=function(e){var t=(0,h.useTheme)(),r=(0,x.useRef)(null),n=(0,x.useRef)(null),i=(0,x.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,x.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,x.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)(ue(),{title:"Emoji",children:(0,o.jsx)(Z(),{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)(oe(),{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 me={"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 fe(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function he(e){return(0,o.jsxs)(f(),{className:"rustic-participant-profile",children:[(0,o.jsx)($(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(N(),{variant:"body1Bold",children:e.displayName})]})}function ve(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)(oe(),{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)(ae(),{children:t.map((function(e,t){return(0,o.jsx)(re(),{onClick:function(){return a(e)},selected:t===c,children:i(e)},t)}))})})}const ge=(0,x.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,x.useState)(""),v=h[0],g=h[1],y=(0,x.useState)(!1),b=y[0],j=y[1],w=(0,x.useState)(!1),S=w[0],k=w[1],O=(0,x.useState)(!1),C=O[0],F=O[1],E=(0,x.useState)(""),T=E[0],P=E[1],D=(0,x.useState)([]),L=D[0],A=D[1],M=(0,x.useState)(!1),q=M[0],B=M[1],_=(0,x.useState)(0),z=_[0],H=_[1],W=(0,x.useRef)(null),V=new de.Database({dataSource:m.emojiDataSource}),G=!v.trim().length&&!m.isSendEnabled,K="".concat(b?"Stop":"Start"," speech to text"),Y=S?"primary.main":"primary.light",$=b?"error.main":Y,X=b?"stop_circle":"speech_to_text",J=(0,x.useState)([]),te=J[0],re=J[1],ne=(0,x.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),g(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 le(e,t){void 0===t&&(t=!1),oe(e,t?/:(\w+)$/:void 0),B(!1)}var ge=C?(0,o.jsx)(R(),{size:24}):(0,o.jsx)(ue(),{title:K,children:(0,o.jsx)(Z(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,b?(e.stop(),F(!0),j(!1)):(e.start(),P(""),j(!0)),e.onstart=function(){j(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;v.length>0?g(v+" "+r):g(r),null===(t=W.current)||void 0===t||t.focus(),j(!1)},e.onerror=function(e){var t=me[e.error];P(t),j(!1)},e.onend=function(){F(!1),j(!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,Q.v4)(),timestamp:e,sender:m.sender,conversationId:m.conversationId,format:"chatCompletionRequest",data:U(v)};m.send(t),g(""),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)(N(),{variant:"caption",color:"error",className:"rustic-error-message",children:T})}),(0,o.jsxs)(f(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:S?"secondary.main":"action.disabled"},children:[L.length>0&&W.current&&(0,o.jsx)(ve,{anchorEl:W.current,items:L.filter((function(e){return"unicode"in e})),isOpen:q,onClose:function(){B(!1),H(0)},onSelect:function(e){return le(e.unicode,!0)},selectedIndex:z,renderItem:fe}),te.length>0&&W.current&&(0,o.jsx)(ve,{anchorEl:W.current,items:te,isOpen:ae,onClose:function(){ie(!1),H(0)},onSelect:function(e){return se(e.displayName)},renderItem:he,selectedIndex:z}),(0,o.jsx)(ce(),{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&&L.length>0&&"unicode"in L[z]?le(L[z].unicode,!0):ae&&te.length>0?se(te[z].displayName):e.shiftKey||G||xe();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(q?H((function(e){return(e+t+L.length)%L.length})):ae&&H((function(e){return(e+t+te.length)%te.length})));0!==z&&H(0)}},onChange:function(e){P("");var t=e.target.value;g(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,"");V.getEmojiByShortcode(i).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);g(r)}else g(t)})).catch((function(){g(t)})),B(!1)}else a?(r=a[0].replace(":",""),V.getEmojiBySearchQuery(r).then((function(e){e.length?(A(e.slice(0,p)),B(!0)):(A([]),B(!1))})).catch((function(){A([]),B(!1)}))):B(!1)},onFocus:function(){return k(!0)},onBlur:function(){return k(!1)},inputRef:W,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,o.jsxs)(ee(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(pe,{dataSource:m.emojiDataSource,onEmojiClick:le,buttonColor:Y}),u&&ge]})},inputLabel:{className:S?"":"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)(ue(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(Z(),{"aria-label":"send message",onClick:xe,disabled:G,color:"secondary",children:(0,o.jsx)(I.A,{name:"send"})})})})]})]})})),xe=require("@mui/material/LinearProgress");var ye=a.n(xe);const be=require("axios");var je=a.n(be);const we=require("react-dom"),Se=require("@mui/material/Card");var ke=a.n(Se);const Oe=require("@mui/material/Modal");var Ce=a.n(Oe);const Fe=require("@mui/system/Stack");var Ne=a.n(Fe);const Ee=require("@mui/system/useTheme");var Te=a.n(Ee);const Pe=require("pdfjs-dist"),De=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)(ue(),{title:r.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(Z(),{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,x.useRef)(null),n=(0,x.useState)(1),a=n[0],i=n[1],s=(0,x.useState)(1),c=s[0],l=s[1],u=(0,x.useState)(1),d=u[0],p=u[1],m=(0,x.useState)(!1),h=m[0],v=m[1],y=(0,x.useState)(),b=y[0],j=y[1],w=Te()(),S=g()(w.breakpoints.down("sm")),k=g()(w.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,o.jsx)(ke(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(N(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var O=(0,x.useState)((function(){return S?.5:k?1:1.5})),C=O[0],F=O[1];return(0,x.useEffect)((function(){Pe.GlobalWorkerOptions.workerSrc||(Pe.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(Pe.version,"/pdf.worker.mjs")),Pe.getDocument({url:"".concat(e.url)}).promise.then((function(e){l(e.numPages),function(e){e.getPage(a).then((function(e){var t=e.getViewport({scale:C}),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]};b&&b.cancel();var s=e.render(o);j(s),s.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){v(!0)}))}),[e.url,a,C]),h?(0,o.jsx)(ke(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(N(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(ke(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(f(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(De,{action:"zoomOut",onClick:function(){F((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(De,{action:"zoomIn",onClick:function(){F((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)(Ne(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(De,{action:"previousPage",onClick:function(){a>1&&(i(a-1),p(a-1))},isDisabled:1===a}),(0,o.jsx)(N(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(ce(),{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)(N(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,o.jsx)(De,{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},Ae={pdf:Le};function Me(e){var t=e.supportedViewers,r=void 0===t?Ae:t,n=e.showFullName,a=void 0===n||n,i=Ie(e,["supportedViewers","showFullName"]),s=(0,h.useTheme)(),c=(0,x.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,g=!!v,y=g?" rustic-cursor-pointer":"",b="rustic-file-preview ".concat(a?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),j=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)(ke(),{className:b,variant:"outlined",sx:{boxShadow:s.shadows[1]},onClick:function(){u(!0)},children:[(0,o.jsx)(N(),{variant:"subtitle2",className:"rustic-file-preview-name",children:j}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:i.children})]}),g&&(0,o.jsx)(Ce(),{open:l,onClose:d,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(ue(),{title:"Close",children:(0,o.jsx)(Z(),{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})]})})]})}var Re=a(3110);const qe=require("@mui/material"),Be=require("@mui/material/Button");var _e=a.n(Be);const ze=require("@mui/material/Drawer");var He=a.n(ze);const We=require("@mui/material/ListItemText");var Ue=a.n(We);const Ve=require("@mui/material/Menu");var Ge=a.n(Ve),Ke=function(){return Ke=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},Ke.apply(this,arguments)};function Qe(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useRef)(null),i=(0,h.useTheme)(),s=(0,qe.useMediaQuery)(i.breakpoints.down("md")),c=s?He():Ge(),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)(E.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)(N(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,o.jsx)(E.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}s&&(l=Ke(Ke({},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)(re(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:u(e)},e.label):(0,o.jsx)(re(),{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)(_e(),Ke({},p,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(ue(),{title:e.ariaLabel,children:(0,o.jsx)(Z(),Ke({},p,{children:e.icon?e.icon:m}))})),(0,o.jsx)(c,Ke({open:r,onClose:function(){return n(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":Ke(Ke({},l),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:d}))]})}var Ye=function(){return Ye=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},Ye.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 Xe(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 Ze=function(e){var t,r=(0,x.useState)([]),n=r[0],a=r[1],i=(0,x.useState)([]),s=i[0],c=i[1],l=(0,x.useState)({}),u=l[0],d=l[1],p=(0,x.useRef)({}),m=(0,Q.v4)();(0,x.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=Ye(Ye({},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 g=(0,o.jsx)(f(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,o.jsx)(Me,{file:{name:t.name},showFullName:e.showFullName,children:(0,o.jsxs)(f(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,o.jsx)(ye(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(ue(),{title:"Delete",children:(0,o.jsx)(Z(),{color:"primary",onClick:function(){return function(t,r){var n,i;c([]);var o=t.name;if(p.current=Ye(Ye({},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){je().delete(s,Ye({},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=Ye(Ye({},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)(N(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function b(e,t){return t?(0,we.createPortal)(e,t):e}var j=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)(Re.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==j?void 0:j.length)?(0,o.jsx)(Qe,{ariaLabel:"Upload",icon:(0,o.jsx)(Re.default,{name:"upload_2"}),menuItems:j}):(0,o.jsx)(ue(),{title:"Upload",children:(0,o.jsx)(Z(),{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&&Xe(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=Ye(Ye({},p.current),((t={})[e.name]=i,t))}else p.current=Ye(Ye({},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=Ye(Ye({},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,Q.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?Ye(Ye({},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 je().post(f,r,Ye(Ye({},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]=Ye(Ye({},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?Ye(Ye({},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&&b(y,e.errorMessagesContainer),n.length>0&&b(g,e.filePreviewsContainer)]})};var Je=function(){return Je=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},Je.apply(this,arguments)},et=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},tt=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))},rt=2097152;function nt(e){var t=e.maxFileSize,r=void 0===t?rt:t,n=e.maxFileCount,a=void 0===n?1:n,i=et(e,["maxFileSize","maxFileCount"]),s=(0,x.useState)({uploaded:[],fileList:[]}),c=s[0],l=s[1],u=(0,x.useState)((0,Q.v4)()),d=u[0],p=u[1],m=(0,x.useState)(),v=m[0],g=m[1],y=(0,x.useState)(),b=y[0],j=y[1],w=(0,x.useRef)(null),S=(0,h.useTheme)(),k=c.uploaded.length===c.fileList.length&&c.uploaded.length>0;return(0,x.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)(ge,Je({},i,{send:function(e){k&&(e.id=d,e.format="chatCompletionRequest",e.data=U(e.data.text,c.uploaded.map((function(e){return{url:e.url,name:e.name}})))),i.ws.send(e),p((0,Q.v4)()),l({uploaded:[],fileList:[]})},isSendEnabled:k,ref:w,children:(0,o.jsx)(f(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Ze,{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 Je(Je({},e),{fileList:tt(tt([],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=tt(tt(tt([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Je(Je({},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 at=function(){return at=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},at.apply(this,arguments)},it=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 ot(e){var t=e.ws,r=it(e,["ws"]);return(0,o.jsx)(ge,at({},r,{send:function(e){t.send(e)}}))}require("ol/ol.css");var st=a(5642),ct=a.n(st);const lt=require("ol/layer/Tile.js");var ut=a.n(lt);const dt=require("ol/Map.js");var pt=a.n(dt);const mt=require("ol/Overlay.js");var ft=a.n(mt);const ht=require("ol/proj.js"),vt=require("ol/source/OSM.js");var gt=a.n(vt);const xt=require("ol/View.js");var yt=a.n(xt);function bt(e){var t=(0,x.useState)(""),r=t[0],n=t[1],a=(0,x.useRef)(null),i=(0,x.useRef)(null);return(0,x.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(pt())({layers:[new(ut())({source:new(gt())})],view:new(yt())({center:(0,ht.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:a.current}),r=new(ft())({element:i.current,position:(0,ht.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)(ct(),{severity:"error",children:r}):(0,o.jsxs)(f(),{children:[(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 jt=a(7447),wt=a.n(jt);const St=require("marked");function kt(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=St.marked.parse(t,{async:!1});return wt().sanitize(r)}const Ot=function(e){var t=(0,x.useState)(kt(e.text)),r=t[0],n=t[1];return(0,x.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;n(kt(t))}}),[e.text,e.updatedData]),(0,o.jsx)(N(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}})},Ct=function(e){var t=(0,x.useState)(kt(e.text)),r=t[0],n=t[1],a=(0,x.useState)(""),i=a[0],s=a[1];return(0,x.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(kt(t))}}),[e.text,e.updatedData]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(N(),{variant:"body2",dangerouslySetInnerHTML:{__html:r}}),i&&(0,o.jsx)(ct(),{severity:"error",children:i})]})},Ft=require("@mui/material/Slider");var Nt=a.n(Ft);function Et(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)(ue(),{title:r[e.action].label,PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(Z(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,o.jsx)(I.A,{name:r[e.action].symbol,className:"rustic-icon-large"})})})}var Tt=100;function Pt(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*Tt;return(0,o.jsx)(ye(),{className:"rustic-progress-buffered",variant:"determinate",value:c,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:t?"secondary.light":"action.selected"}}})}(),(0,o.jsx)(Nt(),{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 Dt(e){var t=(0,x.useState)(e.mediaElement.volume),r=t[0],n=t[1],a=(0,x.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)(Et,{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)(Nt(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(r*Tt,"%"),value:r,onChange:function(t,r){var a=r;e.mediaElement.muted=0===a,e.mediaElement.volume=a,n(e.mediaElement.volume)}})]})}function Lt(e){var t=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",r="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,o.jsx)(_e(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,o.jsx)(I.A,{name:t}),children:(0,o.jsx)(N(),{variant:"overline",children:r})})}function It(e){var t=(0,x.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)(Et,{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 At(e){var t,r=(0,x.useState)(e.mediaElement.playbackRate),n=r[0],a=r[1];return(0,o.jsx)(ue(),{title:"Playback rate",PopperProps:{container:null!==(t=document.fullscreenElement)&&void 0!==t?t:document.body},children:(0,o.jsx)(_e(),{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)(N(),{variant:"body1",children:[n,"X"]})})})}function Mt(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)(Et,{onClick:r,action:n})}var Rt=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 qt(e){var t=e.style,r=void 0===t?"condensed":t,n=Rt(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)(N(),{variant:"overline",children:a}),(0,o.jsx)(N(),{variant:"overline",children:i})]}):(0,o.jsx)(N(),{variant:"overline",className:"rustic-time-display",children:s})}const Bt=require("@mui/material/Divider");var _t=a.n(Bt);function zt(e){var t=!!document.fullscreenElement;return(0,o.jsxs)(E.Box,{className:"rustic-transcript-container",children:[!t&&(0,o.jsx)(_t(),{orientation:"vertical",flexItem:!0}),(0,o.jsx)(N(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}function Ht(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!0),l=c[0],u=c[1],d=(0,x.useState)(0),p=d[0],m=d[1],f=(0,x.useState)(""),h=f[0],v=f[1],g=(0,x.useState)(""),y=g[0],b=g[1],j=(0,qe.useTheme)(),w=(0,x.useRef)(null),S=(0,qe.useMediaQuery)(j.breakpoints.down("md"));function k(){return(0,o.jsx)(N(),{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)(Et,{action:t,onClick:function(){return s(!i)}})}}function C(){if(w.current)return(0,o.jsxs)(E.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Mt,{mediaElement:w.current,movement:"replay"}),(0,o.jsx)(It,{mediaElement:w.current,onError:b}),(0,o.jsx)(Mt,{mediaElement:w.current,movement:"forward"})]})}function F(){if(e.transcript&&r)return(0,o.jsx)(zt,{transcript:e.transcript})}function T(){if(e.transcript)return(0,o.jsx)(Lt,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}function P(){return(0,o.jsx)("video",{src:e.src,ref:w,className:i?"rustic-has-captions":"",children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})})}(0,x.useEffect)((function(){var e,t,r,n;function a(e){v(e)}null===(e=w.current)||void 0===e||e.addEventListener("timeupdate",(function(){w.current&&m(w.current.currentTime)})),null===(t=w.current)||void 0===t||t.addEventListener("canplay",(function(){v(""),u(!1)})),null===(r=w.current)||void 0===r||r.addEventListener("error",(function(){return a("Failed to load the audio.")})),null===(n=w.current)||void 0===n||n.addEventListener("stalled",(function(){return a("Failed to fetch audio data, but trying.")}))}),[]);var D=S?function(){if(w.current)return(0,o.jsxs)(E.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(qt,{elapsedTimeInSeconds:p,durationTimeInSeconds:w.current.duration,style:"wide"}),(0,o.jsx)(Pt,{mediaElement:w.current}),k(),(0,o.jsxs)(E.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsx)(E.Box,{className:"rustic-sound-bottom-controls-left",children:C()}),(0,o.jsx)(Dt,{mediaElement:w.current}),(0,o.jsxs)(E.Box,{className:"rustic-sound-bottom-controls-right",children:[T(),(0,o.jsxs)(E.Box,{children:[O(),(0,o.jsx)(At,{mediaElement:w.current})]})]})]}),F()]})}:function(){if(w.current)return(0,o.jsxs)(o.Fragment,{children:[k(),(0,o.jsxs)(E.Box,{className:"rustic-sound-controls",children:[(0,o.jsx)(Pt,{mediaElement:w.current}),(0,o.jsxs)(E.Box,{className:"rustic-sound-bottom-controls",children:[(0,o.jsxs)(E.Box,{className:"rustic-sound-bottom-controls-left",children:[C(),O(),(0,o.jsx)(At,{mediaElement:w.current}),(0,o.jsx)(Dt,{mediaElement:w.current}),(0,o.jsx)(qt,{elapsedTimeInSeconds:p,durationTimeInSeconds:w.current.duration,style:"condensed"})]}),(0,o.jsx)(E.Box,{className:"rustic-sound-bottom-controls-right",children:T()})]}),F()]})]})};return h.length>0?(0,o.jsx)(ct(),{severity:"error",children:h}):l?(0,o.jsxs)(E.Box,{className:"rustic-sound",children:[P(),(0,o.jsx)(R(),{})]}):(0,o.jsxs)(E.Box,{className:"rustic-sound",children:[P(),D(),y.length>0&&(0,o.jsx)(ct(),{severity:"error",className:"rustic-control-error",onClose:function(){return b("")},children:y})]})}function Wt(e){var t=(0,x.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)(Et,{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 Ut(e){var t=(0,x.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)(Et,{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 Vt(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!0),l=c[0],u=c[1],d=(0,x.useState)(!!document.fullscreenElement),p=d[0],m=d[1],f=(0,x.useState)(!1),h=f[0],v=f[1],g=(0,x.useState)(""),y=g[0],b=g[1],j=(0,x.useState)(""),w=j[0],S=j[1],k=(0,x.useState)(0),O=k[0],C=k[1],F=(0,x.useRef)(null),T=(0,x.useRef)(null),P=(0,qe.useTheme)(),D=(0,qe.useMediaQuery)(P.breakpoints.down("md"));(0,x.useEffect)((function(){var e,t,r,n,a,i,o,s;function c(e){S(e),u(!1)}function l(){clearTimeout(s),s=setTimeout((function(){return v(!1)}),3e3)}null===(e=T.current)||void 0===e||e.addEventListener("timeupdate",(function(){T.current&&C(T.current.currentTime)})),null===(t=T.current)||void 0===t||t.addEventListener("canplay",(function(){S(""),u(!1)})),null===(r=T.current)||void 0===r||r.addEventListener("error",(function(){return c("Failed to load the video.")})),null===(n=T.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=F.current)||void 0===a||a.addEventListener("mousemove",(function(){v(!0),l()})),null===(i=F.current)||void 0===i||i.addEventListener("mouseleave",(function(){v(!1)})),null===(o=F.current)||void 0===o||o.addEventListener("keydown",(function(){v(!0),l()}))}),[]);var L={backgroundColor:P.palette.background.paper,opacity:h?1:0};function I(){if(e.transcript&&r)return(0,o.jsx)(zt,{transcript:e.transcript})}function A(){if(e.captions&&e.captions.length>0){var t=i?"captionsOff":"captionsOn";return(0,o.jsx)(Et,{action:t,onClick:function(){return s(!i)}})}}function M(){if(e.transcript)return(0,o.jsx)(Lt,{isTranscriptVisible:r,setIsTranscriptVisible:function(){return n(!r)}})}var q=D?function(){return p?(0,o.jsx)(o.Fragment,{children:T.current&&F.current&&(0,o.jsxs)(E.Box,{className:"rustic-video-controls",sx:L,children:[(0,o.jsxs)(E.Box,{className:"rustic-video-top-controls",children:[(0,o.jsx)(It,{mediaElement:T.current,onError:b}),(0,o.jsx)(Pt,{mediaElement:T.current}),(0,o.jsx)(qt,{elapsedTimeInSeconds:O,durationTimeInSeconds:T.current.duration})]}),(0,o.jsxs)(E.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(E.Box,{className:"rustic-time-controls",children:[(0,o.jsx)(Mt,{mediaElement:T.current,movement:"replay"}),(0,o.jsx)(Mt,{mediaElement:T.current,movement:"forward"}),A(),(0,o.jsx)(At,{mediaElement:T.current})]}),M()]}),I()]})}):(0,o.jsx)(o.Fragment,{children:T.current&&F.current&&(0,o.jsxs)(E.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,o.jsx)(It,{mediaElement:T.current,onError:b}),(0,o.jsxs)(E.Box,{className:"rustic-video-controls-right",children:[M(),(0,o.jsx)(Ut,{element:F.current,onError:b})]})]})})}:function(){return(0,o.jsx)(o.Fragment,{children:T.current&&F.current&&(0,o.jsxs)(E.Box,{className:"rustic-video-controls",sx:L,children:[(0,o.jsx)(Pt,{mediaElement:T.current}),(0,o.jsxs)(E.Box,{className:"rustic-video-bottom-controls",children:[(0,o.jsxs)(E.Box,{className:"rustic-video-bottom-controls-left",children:[(0,o.jsx)(It,{mediaElement:T.current,onError:b}),(0,o.jsx)(Mt,{mediaElement:T.current,movement:"replay"}),(0,o.jsx)(Mt,{mediaElement:T.current,movement:"forward"}),A(),(0,o.jsx)(At,{mediaElement:T.current}),(0,o.jsx)(Dt,{mediaElement:T.current}),(0,o.jsx)(qt,{elapsedTimeInSeconds:O,durationTimeInSeconds:T.current.duration,style:"condensed"})]}),(0,o.jsxs)(E.Box,{className:"rustic-video-bottom-controls-right",children:[M(),(0,o.jsx)(Wt,{mediaElement:T.current,onError:b}),(0,o.jsx)(Ut,{element:F.current,onError:b})]})]}),p&&I()]})})};return w.length>0?(0,o.jsx)(ct(),{severity:"error",children:w}):(0,o.jsxs)(E.Box,{className:"rustic-video",children:[l&&(0,o.jsx)(R(),{className:"rustic-video-loading-spinner"}),(0,o.jsxs)(E.Box,{ref:F,className:"rustic-video-screen",sx:{visibility:l?"hidden":"visible"},children:[y.length>0&&(0,o.jsx)(ct(),{severity:"error",className:"rustic-control-error",onClose:function(){return b("")},children:y}),(!D||p)&&function(){if(T.current&&F.current)return(0,o.jsxs)(E.Box,{className:"rustic-video-title",sx:L,children:[(0,o.jsx)(N(),{variant:"body2",children:e.title}),p&&D&&(0,o.jsxs)(E.Box,{children:[(0,o.jsx)(Wt,{mediaElement:T.current,onError:b}),(0,o.jsx)(Ut,{element:F.current,onError:b})]})]})}(),(0,o.jsx)("video",{className:"rustic-video-element",ref:T,src:e.src,poster:e.poster,children:i&&(0,o.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),q()]}),!p&&I()]})}var Gt=a(4445);function Kt(e){var t=(0,x.useState)("Copy text"),r=t[0],n=t[1];return(0,o.jsx)(Gt.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 Qt(e){var t=(0,x.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)(Gt.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 Yt=require("@mui/material/Stack");var $t=a.n(Yt);const Xt=function(e){return(0,o.jsx)(N(),{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},Zt=(0,x.forwardRef)((function(e,t){var r=(0,qe.useTheme)(),n=e.inReplyTo?e.inReplyTo:e.message;return(0,o.jsxs)($t(),{id:n.id,className:"rustic-message-canvas",ref:t,children:[(0,o.jsxs)($t(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(n),(0,o.jsx)(Xt,{timestamp:n.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,o.jsx)(ke(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(n)}),(0,o.jsxs)(ke(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,o.jsxs)(N(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,o.jsx)(Xt,{timestamp:e.message.timestamp})]})]})]})})),Jt=require("@mui/material/Chip");var er=a.n(Jt);const tr=require("@mui/system/Box");var rr=a.n(tr),nr=function(){return nr=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},nr.apply(this,arguments)},ar=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},ir=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 or(e,t){var r;if(!(r=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.inReplyTo:t.id))return e;var n=nr({},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]=[nr(nr({},a),{data:nr(nr({},a.data),t.data)}),t]:n[r]=ir(ir([],n[r],!0),[t],!1),n}function sr(e){var t,r,n,a=e.scrollDownLabel,i=void 0===a?"Scroll down":a,s=ar(e,["scrollDownLabel"]),c=(0,x.useRef)(null),l=(0,x.useRef)(null),u=(0,x.useRef)(),d=(0,x.useState)(!0),p=d[0],m=d[1],f=(0,x.useState)(!0),h=f[0],v=f[1],g=(0,x.useState)(!1),y=g[0],b=g[1],j=(0,x.useState)({}),w=j[0],S=j[1],k=Object.keys(w).length,O=(r=k,n=(0,x.useRef)(0),(0,x.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;b(!0),e&&setTimeout((function(){C(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(N,1)}function E(e){S((function(t){return or(t,e)}))}return(0,x.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,x.useEffect)((function(){N()}),[y]),(0,x.useEffect)((function(){p&&0!==O&&k>O&&(C(),N())}),[p,Object.keys(w).length]),(0,x.useEffect)((function(){var e,t={};null===(e=s.receivedMessages)||void 0===e||e.forEach((function(e){var r=or(t,e);t=r})),S(t)}),[null===(t=s.receivedMessages)||void 0===t?void 0:t.length]),(0,x.useEffect)((function(){s.ws.onReceive&&s.ws.onReceive(E)}),[]),(0,o.jsxs)(rr(),{className:"rustic-message-space",children:[(0,o.jsxs)(rr(),{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)(Zt,nr({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)(er(),{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 cr=a(2500);function lr(e){return new URL(e).pathname.split("/").pop()}function ur(e){return(0,o.jsx)(f(),{className:"rustic-multipart",children:e.messages.map((function(t,r){return"string"==typeof t.content?(0,o.jsx)(cr.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||lr(r)},s=(0,o.jsx)(Me,{file:i,showFullName:e.showFullName,children:i.url&&(0,o.jsx)(ue(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(Z(),{component:"a",href:i.url,download:i.name,children:(0,o.jsx)(Re.default,{name:"download"})})})});n.push(s)}})),(0,o.jsxs)(y().Fragment,{children:[a.length>0&&(0,o.jsx)(cr.default,{text:a}),n.length>0&&(0,o.jsx)(f(),{className:"rustic-files",children:n})]},r)}(t.content,r)}))})}var dr=a(7131);function pr(e){return(0,o.jsxs)(rr(),{className:"rustic-multipart",children:[e.text&&(0,o.jsx)(dr.A,{text:e.text}),(t=e.files.map((function(t,r){return(0,o.jsx)(Me,{file:t,showFullName:e.showFullName,children:t.url&&(0,o.jsx)(ue(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,o.jsx)(Z(),{component:"a",href:t.url,download:t.name,children:(0,o.jsx)(I.A,{name:"download"})})})},r)})),(0,o.jsx)(rr(),{className:"rustic-files",children:t}))]});var t}const mr=require("@mui/material/Dialog");var fr=a.n(mr);const hr=require("@mui/material/DialogTitle");var vr=a.n(hr);const gr=require("@mui/material/List");var xr=a.n(gr);const yr=require("@mui/material/ListItem");var br=a.n(yr);const jr=require("@mui/material/ListSubheader");var wr=a.n(jr);const Sr=require("pluralize");var kr=a.n(Sr),Or=a(7159);function Cr(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=e.participants.length,i=r?e.participants:e.participants.slice(0,3),s="".concat(kr()(e.participantType,a)," (").concat(a,")"),c=r?"Show Less":"Show All ".concat(a);return 0===a?(0,o.jsx)(N(),{variant:"caption",className:"rustic-participant-list-no-participants-message",children:"There are currently no participants."}):(0,o.jsx)(xr(),{className:"rustic-participant-list",subheader:(0,o.jsxs)(wr(),{disableSticky:!0,className:"rustic-participant-list-subheader",children:[(0,o.jsxs)(E.Box,{className:"rustic-participant-list-subheader-title",children:[e.participantTypeIcon,(0,o.jsx)(N(),{variant:"subtitle2",color:"text.secondary",children:s})]}),a>3&&(0,o.jsx)(_e(),{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)(br(),{className:"rustic-participant-list-item",children:[(0,o.jsxs)(E.Box,{className:"rustic-participant-profile",children:[(0,o.jsx)($(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(N(),{variant:"subtitle2",children:e.displayName})]}),(0,o.jsx)(N(),{variant:e.participantRole===Or.s.Owner?"subtitle2":"caption",children:B(e.participantRole||Or.s.Member)})]},e.id)}))})}const Fr=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===Or.s.Owner?1:-1}))}(e.filter((function(e){return e.participantType===t})))}var r=t(e.participants,Or.y.Human),n=t(e.participants,Or.y.Agent),a="".concat(kr()("Participant",e.participants.length)," (").concat(e.participants.length,")");return(0,o.jsxs)(fr(),{open:e.isParticipantListOpen,onClose:e.onClose,className:"rustic-participants-container",maxWidth:"sm",fullWidth:!0,children:[(0,o.jsx)(vr(),{sx:{borderBottom:"1px solid",borderColor:"divider"},component:"h6",className:"rustic-participants-container-title",children:a}),(0,o.jsx)(Cr,{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)(_t(),{className:"rustic-participants-container-divider"}),(0,o.jsx)(Cr,{participantType:"Agent",participantTypeIcon:(0,o.jsx)(I.A,{name:"smart_toy"}),participants:n})]})]})},Nr=require("@mui/material/DialogActions");var Er=a.n(Nr);const Tr=require("@mui/material/DialogContent");var Pr=a.n(Tr);const Dr=require("@mui/material/DialogContentText");var Lr=a.n(Dr),Ir=function(){return Ir=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},Ir.apply(this,arguments)},Ar=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 Mr(e){var t=(0,x.useState)(!1),r=t[0],n=t[1],a=(0,x.useState)(!1),i=a[0],s=a[1],c=(0,x.useState)(!1),l=c[0],u=c[1],d=(0,x.useState)(!1),p=d[0],m=d[1],f=(0,x.useState)([]),h=f[0],v=f[1],g=(0,x.useState)(null),y=g[0],b=g[1],j=(0,E.useTheme)(),w=h[h.length-1],S=Ir(Ir({},e.ws),{send:function(e){b(e)}});function k(e){v((function(t){return Ar(Ar([],t,!0),[e],!1)}))}function O(){if(y){var t=Ir(Ir({},y),{threadId:e.messageId});e.ws.send(t)}}if((0,x.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(k)}),[e.ws]),(0,x.useEffect)((function(){h.length>0&&(w&&w.sender.id!==e.sender.id&&s(!1),"promptBuilder"===w.format&&w.data.isLastQuestion&&n(!0))}),[h.length]),0!==h.length)return(0,o.jsxs)(ke(),{variant:"outlined",className:"rustic-prompt-builder",children:[(0,o.jsxs)(fr(),{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(j.palette.divider)}},children:[(0,o.jsx)(vr(),{id:"quit-dialog-title",className:"rustic-align-self-center",children:"Are you sure?"}),(0,o.jsx)(_t(),{}),(0,o.jsx)(Pr(),{children:(0,o.jsx)(Lr(),{id:"quit-dialog-description",className:"rustic-align-self-center",children:"All progress will be lost."})}),(0,o.jsxs)(Er(),{className:"rustic-prompt-builder-dialog-buttons",disableSpacing:!0,children:[(0,o.jsx)(_e(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(I.A,{name:"close"}),onClick:function(){u(!1),e.onCancel()},children:"Quit"}),(0,o.jsx)(_e(),{variant:"contained",color:"primary",onClick:function(){return u(!1)},children:"Continue build"})]})]}),e.getProfileComponent?e.getProfileComponent(h[0]):(0,o.jsx)(N(),{color:"text.secondary",children:"Prompt Builder"}),(0,o.jsx)(_t(),{className:"rustic-prompt-builder-divider"}),(0,o.jsxs)(E.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:S,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)(E.Box,{className:"rustic-prompt-builder-buttons",children:[(0,o.jsxs)(E.Box,{className:"rustic-prompt-builder-buttons-left",children:[(0,o.jsx)(_e(),{variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(I.A,{name:"close"}),onClick:function(){return u(!0)},children:"Quit"}),(0,o.jsx)(_e(),{variant:"outlined",color:"secondary",endIcon:(0,o.jsx)(I.A,{name:"chevron_right"}),onClick:function(){O(),b(null),s(!0)},disabled:!y,"aria-disabled":!y,children:"Next question"})]}),r&&(0,o.jsx)(E.Box,{className:"rustic-prompt-builder-buttons-right",children:(0,o.jsx)(_e(),{variant:"contained",color:"primary",onClick:function(){O(),m(!0),s(!0),e.onSubmit()},disabled:i,"aria-disabled":i,children:"Generate"})})]})})]})}var Rr=function(){return Rr=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},Rr.apply(this,arguments)};function qr(e){var t=Te()(),r=e.prompts.map((function(r,n){return(0,o.jsx)(er(),{onClick:function(){return t=r,n=(new Date).toISOString(),a={id:(0,Q.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:Rr(Rr({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 Br(e){var t=(0,x.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)(er(),{onClick:function(){return function(t){n(t);var r=(new Date).toISOString(),a={id:(0,Q.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)(N(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"caption",children:e.description})]}),(0,o.jsx)($t(),{direction:i,className:"rustic-options-container",children:s})]})}const _r=require("@mui/material/Table");var zr=a.n(_r);const Hr=require("@mui/material/TableBody");var Wr=a.n(Hr);const Ur=require("@mui/material/TableCell");var Vr=a.n(Ur);const Gr=require("@mui/material/TableContainer");var Kr=a.n(Gr);const Qr=require("@mui/material/TableHead");var Yr=a.n(Qr);const $r=require("@mui/material/TablePagination");var Xr=a.n($r);const Zr=require("@mui/material/TableRow");var Jr=a.n(Zr);const en=require("@mui/material/TableSortLabel");var tn,rn=a.n(en),nn=10;function an(){return(0,o.jsx)(I.A,{name:"expand_all"})}function on(e){if(0===e.data.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available"});var t,r,n,a=e.data.length>nn,i=(0,x.useState)({}),s=i[0],c=i[1],l=(0,x.useState)(a?nn:-1),u=l[0],d=l[1],p=(0,x.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)})))),g=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===tn.Descending?1:-1:e[r]>t[r]?n===tn.Descending?-1:1:0})):t),b=y.slice(m*u,m*u+u),j=u>0?b:y;function w(e){if(!s[e])return an}return(0,o.jsxs)($t(),{className:"rustic-table",spacing:1,children:[e.title&&(0,o.jsx)(N(),{variant:"h6",className:"rustic-table-title",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)(Kr(),{className:"rustic-table-container",children:(0,o.jsxs)(zr(),{"aria-label":e.title||"a table of data",size:"small",stickyHeader:!0,children:[g.length>0&&(0,o.jsx)(Yr(),{children:(0,o.jsx)(Jr(),{children:g.map((function(e,t){return(0,o.jsx)(Vr(),{sortDirection:s[e.dataKey]||!1,children:(0,o.jsx)(ue(),{title:(r=e.dataKey,n=s[r],n?Object.keys(tn)[Object.values(tn).indexOf(n)]:"Sort"),children:(0,o.jsx)(rn(),{active:!0,direction:s[e.dataKey],onClick:function(){return function(e){c((function(t){var r,n,a={};switch(t[e]){case tn.Ascending:(r={})[e]=tn.Descending,a=r;break;case tn.Descending:a={};break;default:(n={})[e]=tn.Ascending,a=n}return a}))}(e.dataKey)},className:"rustic-table-header",IconComponent:w(e.dataKey),children:e.label||B(e.dataKey)})})},"header-".concat(t));var r,n}))})}),(0,o.jsx)(Wr(),{children:j.map((function(e,t){return(0,o.jsx)(Jr(),{children:g.map((function(r,n){return(0,o.jsx)(Vr(),{children:e[r.dataKey]},"cell-".concat(t,"-").concat(n))}))},"row-".concat(t))}))})]})}),a&&(0,o.jsx)(Xr(),{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"}(tn||(tn={}));var sn=a(1737),cn=function(){return cn=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},cn.apply(this,arguments)},ln=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 un(e){var t=e.title,r=void 0===t?"Embedded video":t,n=ln(e,["title"]),a=wt().sanitize(n.youtubeVideoId);return(0,o.jsx)("iframe",cn({},H(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 dn=require("@mui/material/FormControl");var pn=a.n(dn);const mn=require("recharts");var 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)},hn={line:mn.LineChart,bar:mn.BarChart,area:mn.AreaChart};function vn(e){var t={};return e.forEach((function(e){t[e]=!0})),t}const gn=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,x.useState)(p.defaultChartType||"line"),f=m[0],h=m[1],v=(0,x.useState)(null),g=v[0],y=v[1],b=(0,x.useState)(p.timeSeries),j=b[0],w=b[1],S=Te()(),k=j.length>0?Object.keys(j[0]):[],O=k[0],C=k.slice(1),F=(0,x.useState)(vn(C)),E=F[0],T=F[1];(0,x.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),w(e)}))}}),[p.timeSeries,p.updatedData]);var P=hn[f];function D(e){g?y(null):e&&y(e.currentTarget)}function L(e,t){return E[e]?p.chartColors[t%p.chartColors.length]:"grey"}function A(e){return E[e]?"none":"line-through"}if(0===j.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available"});var M,R,q,B,z=p.timeSeries[p.timeSeries.length-1],H=(M=p.timeSeries[0][O],R=z[O],q=new Date(M),B=new Date(R),Math.round(Math.abs((B.getTime()-q.getTime())/864e5)));return(0,o.jsxs)(rr(),{className:"rustic-recharts-time-series",children:[!d&&(0,o.jsxs)(pn(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,o.jsx)(Z(),{"aria-label":"chart options","aria-expanded":Boolean(g),"aria-haspopup":"true",onClick:D,color:"primary",children:(0,o.jsx)(I.A,{name:"more_vert"})}),(0,o.jsxs)(Ge(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:g,open:Boolean(g),onClose:function(e){return D(e)},children:[(0,o.jsx)(N(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(hn).map((function(e){return(0,o.jsxs)(re(),{value:e,selected:e===f,onClick:function(){return function(e){h(e),D()}(e)},children:[e.charAt(0).toUpperCase()+e.slice(1)," ","Chart"]},e)}))]})]}),(0,o.jsxs)(rr(),{children:[p.title&&(0,o.jsx)(N(),{variant:"subtitle2",className:"rustic-recharts-time-series-title",children:p.title}),p.description&&(0,o.jsx)(N(),{variant:"caption",className:"rustic-recharts-time-series-description",children:p.description}),(0,o.jsx)(mn.ResponsiveContainer,{aspect:l,width:p.width,maxHeight:a,minWidth:r,children:(0,o.jsxs)(P,{data:j,margin:p.chartContainerMargin,children:[(0,o.jsx)(mn.XAxis,{dataKey:O,tickFormatter:function(e){return _(e,H)},stroke:S.palette.text.primary}),(0,o.jsx)(mn.YAxis,{domain:["auto","auto"],width:s,tickFormatter:p.yAxisTickFormatter,stroke:S.palette.text.primary}),(0,o.jsx)(mn.Tooltip,{labelFormatter:function(e){return[_(e,H)]},formatter:p.tooltipFormatter,contentStyle:{color:S.palette.common.black}}),(0,o.jsx)(mn.Legend,{content:function(){return(0,o.jsx)(rr(),{className:"rustic-recharts-time-series-legend",children:C.map((function(e,t){return(0,o.jsxs)(rr(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=E[e]&&!C.find((function(t){return t!==e&&E[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(E)){for(var n={},a=0,i=C;a<i.length;a++){var o=i[a],s=o===e;n[o]=s}T(n)}else T(r?vn(C):fn(fn({},E),((t={})[e]=!E[e],t)))}(e)},sx:{color:L(e,t)},children:[(0,o.jsx)(I.A,{name:"crop_16_9"}),(0,o.jsx)(N(),{variant:"body2",display:"inline",sx:{textDecorationLine:A(e)},children:e})]},t)}))})}}),C.map((function(e,t){return E[e]?function(e,t){var r=t%p.chartColors.length,n=E[e]?p.chartColors[r]:"transparent",a={onClick:p.onClick,cursor:"pointer"};switch(f){case"line":return(0,o.jsx)(mn.Line,{type:"monotone",isAnimationActive:!1,dataKey:e,name:e,dot:!1,stroke:n,activeDot:p.onClick&&a},e);case"bar":return(0,o.jsx)(mn.Bar,{dataKey:e,fill:n,onClick:p.onClick&&a.onClick,cursor:p.onClick&&a.cursor},e);case"area":return(0,o.jsxs)(x.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)(mn.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)(mn.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)}))]})})]})]})},xn=require("mermaid");var yn=a.n(xn),bn=function(){return bn=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},bn.apply(this,arguments)};const jn=function(e){var t=(0,x.useRef)(null),r=(0,x.useState)(),n=r[0],a=r[1],i=Te()(),s=(0,Q.v4)();return(0,x.useEffect)((function(){var r="dark"===i.palette.mode?"dark":"neutral",n=i.typography.fontFamily;t.current&&(yn().initialize(bn({theme:r,themeVariables:{fontFamily:n}},e.config)),yn().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)($t(),{className:"rustic-mermaid-container",children:[e.title&&(0,o.jsx)(N(),{variant:"subtitle2",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"caption",children:e.description}),(0,o.jsx)("div",{className:"rustic-mermaid",ref:t}),n&&(0,o.jsx)(N(),{variant:"body2",children:n})]})},wn=(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 Sn=a.n(wn),kn=function(){return kn=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},kn.apply(this,arguments)};function On(e){return e?e.reduce((function(e,t){var r=t.dataKey,n=t.label;return e[r]=n||r,e}),{}):{}}const Cn=function(e){if(0===e.data.length)return(0,o.jsx)(N(),{variant:"body2",children:"No data available."});var t=(0,x.useRef)(null),r=(0,h.useTheme)(),n=(0,x.useState)(!1),a=n[0],i=n[1],s=r.palette.mode,c="dark"===s?"Pro Dark":"Pro Light",l=On(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,g,y,b,j,w=e.config&&(p=(d=e.config).groupBy,m=d.splitBy,f=d.aggregates,v=d.sort,g=d.filter,y=d.columns,b=null==v?void 0:v.map((function(e){return[l[e[0]]||e[0],e[1]]})),j=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:j,sort:b,filter:g&&function(e){return e.map((function(e){return[l[e[0]]||e[0],e[1],e[e.length-1]]}))}(g),columns:null==y?void 0:y.map((function(e){return l[e]||e}))});return(0,x.useEffect)((function(){Sn().worker().then((function(t){return t.table(function(e,t){var r=On(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(kn(kn({},w),{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)(N(),{variant:"body2",children:"Failed to create table from data."}):(0,o.jsxs)(Ne(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,o.jsx)(N(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)("perspective-viewer",{ref:t,style:{fontFamily:r.typography.fontFamily}})]})},Fn=require("react-plotly.js");var Nn=a.n(Fn),En=function(){return En=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},En.apply(this,arguments)};const Tn=function(e){var t=En(En({},e.plotParams),{className:"rustic-plotly"});return t.config=En(En({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,o.jsxs)(rr(),{className:"rustic-plotly-container",children:[e.title&&(0,o.jsx)(N(),{variant:"h6",children:e.title}),e.description&&(0,o.jsx)(N(),{variant:"body1",children:e.description}),(0,o.jsx)(Nn(),En({},t))]})},Pn=require("react-dom/server"),Dn=require("vega-embed");var Ln=a.n(Dn),In=function(){return In=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},In.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,x.useRef)(null),i=(0,x.useState)(!1),s=i[0],c=i[1],l=Te()(),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,Pn.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=In(In({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=In({},n.spec);delete o.title,Ln()(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,x.useEffect)((function(){function e(){h()}return h(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[n.spec,u]),s?(0,o.jsx)(N(),{variant:"body2",children:"Failed to load the chart."}):(0,o.jsxs)(Ne(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,o.jsx)(rr(),{justifyContent:"end",display:"flex",children:(0,o.jsx)(Qe,{menuItems:f,ariaLabel:"Download options"})}),n.title&&(0,o.jsx)(N(),{variant:"h6",children:n.title}),n.description&&(0,o.jsx)(Ot,{text:n.description}),(0,o.jsxs)(rr(),{textAlign:"center",mt:1,children:["string"==typeof n.spec.title&&(0,o.jsx)(N(),{variant:"subtitle2",children:n.spec.title}),n.spec.description&&(0,o.jsx)(N(),{variant:"caption",children:n.spec.description})]}),(0,o.jsx)("div",{ref:a,className:"rustic-vega-lite"})]})};function Mn(e){var t=(0,x.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=W(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)(ke(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,o.jsx)(N(),{variant:"h5",component:"span",color:"text.secondary","aria-label":W(e.timestamp).fullName,children:W(e.timestamp).shortName}),(0,o.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,o.jsxs)(N(),{variant:"body2",color:"text.secondary",children:["High: ",a(e.temp.high),"°"]}),(0,o.jsxs)(N(),{variant:"body2",color:"text.secondary",children:["Low: ",a(e.temp.low),"°"]})]},t)}));return(0,o.jsxs)(ke(),{variant:"outlined",className:"rustic-weather",children:[(0,o.jsx)(Qe,{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)($t(),{alignItems:"center",children:[(0,o.jsx)(N(),{variant:"h4",component:"span",children:e.location}),(0,o.jsxs)($t(),{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)(N(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,o.jsxs)(N(),{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)($t(),{direction:"row",spacing:2,children:[(0,o.jsx)(N(),{variant:"overline",children:u}),(0,o.jsx)(N(),{variant:"overline",children:d})]})]}),(0,o.jsx)(f(),{className:"rustic-daily-weather-container",children:p}),e.weatherProvider&&(0,o.jsxs)($t(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,o.jsx)(I.A,{name:"cloud"}),(0,o.jsx)(N(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})}var Rn=a(9517);return i})()));
|