@rustic-ai/ui-components 0.0.34 → 0.0.36

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.
Files changed (55) hide show
  1. package/dist/components/calendar/index.js +1 -1
  2. package/dist/components/codeSnippet/index.js +1 -1
  3. package/dist/components/image/index.css +11 -0
  4. package/dist/components/image/index.js +1 -1
  5. package/dist/components/input/baseInput/baseInput.d.ts +1 -0
  6. package/dist/components/input/baseInput/baseInput.d.ts.map +1 -1
  7. package/dist/components/input/emoji/emoji.d.ts.map +1 -1
  8. package/dist/components/input/multimodal/multimodalInput/index.css +18 -0
  9. package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
  10. package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
  11. package/dist/components/input/multimodal/uploader/index.css +11 -0
  12. package/dist/components/input/multimodal/uploader/index.js +1 -1
  13. package/dist/components/input/multimodal/uploader/uploader.d.ts.map +1 -1
  14. package/dist/components/input/textInput/index.css +56 -0
  15. package/dist/components/input/textInput/index.js +1 -1
  16. package/dist/components/map/index.js +1 -1
  17. package/dist/components/markdown/index.js +1 -1
  18. package/dist/components/media/audio/index.js +1 -1
  19. package/dist/components/media/video/index.js +1 -1
  20. package/dist/components/messageCanvas/actions/copy/index.js +1 -1
  21. package/dist/components/messageCanvas/actions/index.js +1 -1
  22. package/dist/components/messageCanvas/actions/textToSpeech/index.js +1 -1
  23. package/dist/components/messageSpace/index.js +1 -1
  24. package/dist/components/multipart/chatCompletion/index.css +11 -0
  25. package/dist/components/multipart/chatCompletion/index.js +1 -1
  26. package/dist/components/multipart/multipart/index.css +11 -0
  27. package/dist/components/participantsContainer/index.css +49 -0
  28. package/dist/components/participantsContainer/index.d.ts +2 -1
  29. package/dist/components/participantsContainer/index.d.ts.map +1 -1
  30. package/dist/components/participantsContainer/index.js +1 -1
  31. package/dist/components/participantsContainer/participantsContainer.d.ts +2 -14
  32. package/dist/components/participantsContainer/participantsContainer.d.ts.map +1 -1
  33. package/dist/components/pdfViewer/index.js +1 -1
  34. package/dist/components/promptBuilder/index.css +11 -0
  35. package/dist/components/promptBuilder/index.js +1 -1
  36. package/dist/components/promptBuilder/promptBuilder.d.ts.map +1 -1
  37. package/dist/components/prompts/index.js +1 -1
  38. package/dist/components/prompts/prompts.d.ts.map +1 -1
  39. package/dist/components/question/index.js +1 -1
  40. package/dist/components/sharedDescription.d.ts +2 -0
  41. package/dist/components/sharedDescription.d.ts.map +1 -1
  42. package/dist/components/table/index.js +1 -1
  43. package/dist/components/text/index.js +1 -1
  44. package/dist/components/types.d.ts +24 -0
  45. package/dist/components/types.d.ts.map +1 -1
  46. package/dist/components/video/index.css +11 -0
  47. package/dist/components/visualization/perspectiveViz/index.js +1 -1
  48. package/dist/components/visualization/perspectiveViz/perspectiveViz.d.ts.map +1 -1
  49. package/dist/components/weather/index.js +1 -1
  50. package/dist/index.css +18 -0
  51. package/dist/index.js +1 -1
  52. package/dist/rusticTheme.d.ts +3 -11
  53. package/dist/rusticTheme.d.ts.map +1 -1
  54. package/dist/rusticTheme.js +1 -1
  55. package/package.json +2 -2
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var a in t)e.o(t,a)&&!e.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:t[a]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{default:()=>m});const t=require("react/jsx-runtime"),a=require("@fullcalendar/daygrid");var o=e.n(a);const i=require("@fullcalendar/react");var n=e.n(i);const d=require("@fullcalendar/timegrid");var c=e.n(d);const l=require("@mui/material/Box");var s=e.n(l);const u=require("@mui/material/styles"),p=require("@mui/material/useMediaQuery");var f=e.n(p);require("react");var y=function(){return y=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},y.apply(this,arguments)};function b(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}const m=function(e){var r=(0,u.useTheme)(),a=f()(r.breakpoints.up("md"));return(0,t.jsx)(s(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(r.palette.divider),borderRadius:"".concat(r.shape.borderRadius,"px"),".fc .fc-toolbar-title":y({},r.typography.h6),".fc .fc-scrollgrid-liquid":{borderRadius:"".concat(r.shape.borderRadius,"px")},".fc td":{borderRadius:"0 0 ".concat(r.shape.borderRadius,"px ").concat(r.shape.borderRadius,"px")},".fc .fc-scrollgrid-section-header > th":{borderRadius:"".concat(r.shape.borderRadius,"px ").concat(r.shape.borderRadius,"px 0 0")},".fc .fc-button, .fc .fc-button:active":{color:r.palette.primary.main,backgroundColor:r.palette.background.paper,border:"1px solid ".concat(r.palette.divider),borderRadius:"".concat(r.shape.borderRadius,"px"),"&:hover":{backgroundColor:r.palette.secondary.light,border:"1px solid ".concat(r.palette.divider)}},".fc .fc-button-group .fc-button.fc-button-active":{backgroundColor:r.palette.secondary.main,border:"1px solid ".concat(r.palette.divider)},".fc a, .fc .fc-event-title, .fc .fc-button, .fc .fc-timegrid-slot":y({},r.typography.caption)},children:(0,t.jsx)(n(),{plugins:[c(),o()],initialView:a?"dayGridMonth":"timeGridDay",headerToolbar:{left:"title",right:"prev,next dayGridMonth,timeGridWeek,timeGridDay"},eventColor:r.palette.secondary.main,displayEventTime:!1,titleFormat:{year:"numeric",month:"long"},views:{dayGridMonth:{dayHeaderFormat:{weekday:a?"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(b)})})};return r})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var a in t)e.o(t,a)&&!e.o(r,a)&&Object.defineProperty(r,a,{enumerable:!0,get:t[a]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{ParticipantRole:()=>y,ParticipantType:()=>b,default:()=>g});const t=require("react/jsx-runtime"),a=require("@fullcalendar/daygrid");var o=e.n(a);const i=require("@fullcalendar/react");var n=e.n(i);const d=require("@fullcalendar/timegrid");var c=e.n(d);const l=require("@mui/material/Box");var u=e.n(l);const s=require("@mui/material/styles"),p=require("@mui/material/useMediaQuery");var f=e.n(p);require("react");var y,b,m=function(){return m=Object.assign||function(e){for(var r,t=1,a=arguments.length;t<a;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},m.apply(this,arguments)};function v(e){return{title:e.title?e.title:"",start:e.start,end:e.end,allDay:e.isAllDay}}!function(e){e.Owner="owner",e.Member="member"}(y||(y={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const g=function(e){var r=(0,s.useTheme)(),a=f()(r.breakpoints.up("md"));return(0,t.jsx)(u(),{className:"rustic-fc-calendar",sx:{border:"1px solid ".concat(r.palette.divider),borderRadius:"".concat(r.shape.borderRadius,"px"),".fc .fc-toolbar-title":m({},r.typography.h6),".fc .fc-scrollgrid-liquid":{borderRadius:"".concat(r.shape.borderRadius,"px")},".fc td":{borderRadius:"0 0 ".concat(r.shape.borderRadius,"px ").concat(r.shape.borderRadius,"px")},".fc .fc-scrollgrid-section-header > th":{borderRadius:"".concat(r.shape.borderRadius,"px ").concat(r.shape.borderRadius,"px 0 0")},".fc .fc-button, .fc .fc-button:active":{color:r.palette.primary.main,backgroundColor:r.palette.background.paper,border:"1px solid ".concat(r.palette.divider),borderRadius:"".concat(r.shape.borderRadius,"px"),"&:hover":{backgroundColor:r.palette.secondary.light,border:"1px solid ".concat(r.palette.divider)}},".fc .fc-button-group .fc-button.fc-button-active":{backgroundColor:r.palette.secondary.main,border:"1px solid ".concat(r.palette.divider)},".fc a, .fc .fc-event-title, .fc .fc-button, .fc .fc-timegrid-slot":m({},r.typography.caption)},children:(0,t.jsx)(n(),{plugins:[c(),o()],initialView:a?"dayGridMonth":"timeGridDay",headerToolbar:{left:"title",right:"prev,next dayGridMonth,timeGridWeek,timeGridDay"},eventColor:r.palette.secondary.main,displayEventTime:!1,titleFormat:{year:"numeric",month:"long"},views:{dayGridMonth:{dayHeaderFormat:{weekday:a?"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(v)})})};return r})()));
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var o in t)e.o(t,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:t[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{default:()=>s});const t=require("react/jsx-runtime"),o=require("@codemirror/language"),n=require("@codemirror/language-data"),a=require("@codemirror/state"),i=require("@codemirror/view"),u=require("@mui/material/Typography");var c=e.n(u);const l=require("@mui/system"),d=require("react"),s=function(e){var r=(0,d.useRef)(null),u=(0,d.useRef)(),s=new a.Compartment,f=[a.EditorState.readOnly.of(!0),(0,i.highlightSpecialChars)(),(0,o.syntaxHighlighting)(o.defaultHighlightStyle,{fallback:!0}),s.of([])],g=n.languages.find((function(r){return r.name.toLowerCase()===e.language.toLowerCase()}));return(0,d.useEffect)((function(){if(r.current&&!u.current){var t=r.current,o=a.EditorState.create({doc:e.code,extensions:f});u.current=new i.EditorView({state:o,parent:t}),g&&u.current&&g.load().then((function(e){var r;null===(r=u.current)||void 0===r||r.dispatch({effects:s.reconfigure(e.extension)})}))}}),[]),(0,t.jsx)(l.Box,{sx:{backgroundColor:"background.default"},className:"rustic-code-snippet",children:(0,t.jsx)("div",{"aria-label":"code snippet",ref:r,children:(0,t.jsx)(c(),{variant:"body2","aria-label":"language type",children:e.language})})})};return r})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{ParticipantRole:()=>s,ParticipantType:()=>f,default:()=>g});const t=require("react/jsx-runtime"),n=require("@codemirror/language"),o=require("@codemirror/language-data"),a=require("@codemirror/state"),i=require("@codemirror/view"),u=require("@mui/material/Typography");var c=e.n(u);const l=require("@mui/system"),d=require("react");var s,f;!function(e){e.Owner="owner",e.Member="member"}(s||(s={})),function(e){e.Human="human",e.Agent="agent"}(f||(f={}));const g=function(e){var r=(0,d.useRef)(null),u=(0,d.useRef)(),s=new a.Compartment,f=[a.EditorState.readOnly.of(!0),(0,i.highlightSpecialChars)(),(0,n.syntaxHighlighting)(n.defaultHighlightStyle,{fallback:!0}),s.of([])],g=o.languages.find((function(r){return r.name.toLowerCase()===e.language.toLowerCase()}));return(0,d.useEffect)((function(){if(r.current&&!u.current){var t=r.current,n=a.EditorState.create({doc:e.code,extensions:f});u.current=new i.EditorView({state:n,parent:t}),g&&u.current&&g.load().then((function(e){var r;null===(r=u.current)||void 0===r||r.dispatch({effects:s.reconfigure(e.extension)})}))}}),[]),(0,t.jsx)(l.Box,{sx:{backgroundColor:"background.default"},className:"rustic-code-snippet",children:(0,t.jsx)("div",{"aria-label":"code snippet",ref:r,children:(0,t.jsx)(c(),{variant:"body2","aria-label":"language type",children:e.language})})})};return r})()));
@@ -45,3 +45,14 @@ code {
45
45
  margin-right: -8px;
46
46
  }
47
47
 
48
+ .rustic-participant-profile {
49
+ display: flex;
50
+ gap: 8px;
51
+ align-items: center;
52
+ }
53
+
54
+ .rustic-participant-profile .rustic-participant-avatar {
55
+ width: 16px;
56
+ height: 16px;
57
+ }
58
+
@@ -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={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>f});const r=require("react/jsx-runtime"),o=require("@mui/material/CircularProgress");var n=e.n(o);const i=require("@mui/material/Typography");var a=e.n(i);const c=require("react");var s,u=function(){return u=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},u.apply(this,arguments)};!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(s||(s={}));var l=function(){return l=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},l.apply(this,arguments)};function d(e){var t,o,i,s=(0,c.useState)(!0),d=s[0],f=s[1],p=(0,c.useState)(""),y=p[0],g=p[1];return y.length>0?(0,r.jsx)(a(),{variant:"body2",children:y}):(0,r.jsxs)("figure",{children:[d&&(0,r.jsx)(n(),{}),(0,r.jsx)("img",l({},(t=e.width,o=e.height,i={},t&&(i={width:t}),o&&(i=u(u({},i),{height:o})),t||o||(i={className:"rustic-fit-container"}),i),{src:e.src,alt:e.alt,onError:function(){g("Image failed to load"),f(!1)},onLoad:function(){f(!1)}})),e.description&&(0,r.jsx)("figcaption",{children:(0,r.jsx)(a(),{variant:"body2",children:e.description})})]})}d.defaultProps={alt:"An image is displayed"};const f=d;return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ParticipantRole:()=>l,ParticipantType:()=>p,default:()=>y});const r=require("react/jsx-runtime"),n=require("@mui/material/CircularProgress");var o=e.n(n);const i=require("@mui/material/Typography");var a=e.n(i);const c=require("react");var u,s=function(){return s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(u||(u={}));var l,p,f=function(){return f=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)};function d(e){var t,n,i,u=(0,c.useState)(!0),l=u[0],p=u[1],d=(0,c.useState)(""),y=d[0],m=d[1];return y.length>0?(0,r.jsx)(a(),{variant:"body2",children:y}):(0,r.jsxs)("figure",{children:[l&&(0,r.jsx)(o(),{}),(0,r.jsx)("img",f({},(t=e.width,n=e.height,i={},t&&(i={width:t}),n&&(i=s(s({},i),{height:n})),t||n||(i={className:"rustic-fit-container"}),i),{src:e.src,alt:e.alt,onError:function(){m("Image failed to load"),p(!1)},onLoad:function(){p(!1)}})),e.description&&(0,r.jsx)("figcaption",{children:(0,r.jsx)(a(),{variant:"body2",children:e.description})})]})}d.defaultProps={alt:"An image is displayed"},function(e){e.Owner="owner",e.Member="member"}(l||(l={})),function(e){e.Human="human",e.Agent="agent"}(p||(p={}));const y=d;return t})()));
@@ -1,4 +1,5 @@
1
1
  import './baseInput.css';
2
+ import '../../../index.css';
2
3
  import React from 'react';
3
4
  import type { BaseInputProps } from '../../types';
4
5
  declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & {
@@ -1 +1 @@
1
- {"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAexB,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,cAAc,EAAW,MAAM,aAAa,CAAA;AAyW1D,QAAA,MAAM,SAAS;;wCAA+B,CAAA;AAU9C,eAAe,SAAS,CAAA"}
1
+ {"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,oBAAoB,CAAA;AAmB3B,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAA;AA8dvE,QAAA,MAAM,SAAS;;wCAA+B,CAAA;AAU9C,eAAe,SAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"emoji.d.ts","sourceRoot":"","sources":["../../../../src/components/input/emoji/emoji.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,sBAAsB,CAAA;AAY7B,UAAU,UAAU;IAClB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,2CAyG/B;AAED,eAAe,KAAK,CAAA"}
1
+ {"version":3,"file":"emoji.d.ts","sourceRoot":"","sources":["../../../../src/components/input/emoji/emoji.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,sBAAsB,CAAA;AAY7B,UAAU,UAAU;IAClB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,2CA2G/B;AAED,eAAe,KAAK,CAAA"}
@@ -73,6 +73,17 @@ code {
73
73
  margin-right: -8px;
74
74
  }
75
75
 
76
+ .rustic-participant-profile {
77
+ display: flex;
78
+ gap: 8px;
79
+ align-items: center;
80
+ }
81
+
82
+ .rustic-participant-profile .rustic-participant-avatar {
83
+ width: 16px;
84
+ height: 16px;
85
+ }
86
+
76
87
  .rustic-base-input {
77
88
  display: flex;
78
89
  align-items: flex-start;
@@ -122,6 +133,13 @@ code {
122
133
  align-self: start;
123
134
  }
124
135
 
136
+ .rustic-suggestion-menu ul {
137
+ padding: 0;
138
+ max-height: 220px;
139
+ min-width: 220px;
140
+ overflow-y: auto;
141
+ }
142
+
125
143
  span.rustic-icon-large {
126
144
  font-size: 32px;
127
145
  }
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e,r,t={9767:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(8732),a=(t(2015),function(){return a=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},a.apply(this,arguments)});function o(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},r),children:e.name})}},3110:(e,r,t)=>{t.d(r,{default:()=>n});const n=t(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,a),o.exports}a.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return a.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);a.r(o);var i={};e=e||[null,r({}),r([]),r(r)];for(var l=2&n&&t;"object"==typeof l&&!~e.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach((e=>i[e]=()=>t[e]));return i.default=()=>t,a.d(o,i),o},a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};a.r(o),a.d(o,{default:()=>Se});var i=a(8732);const l=require("@mui/material/Box");var c=a.n(l);const s=require("@mui/material/styles");var u=a(2015);const d=require("uuid");var p;function m(e,r){var t=[];if(e&&(null==e?void 0:e.trim().length)&&t.push({type:"text",text:e}),r&&r.length>0)for(var n=0;n<(null==r?void 0:r.length);n++)t.push({type:"file_url",file_url:{url:r[n].url,name:r[n].name}});return{messages:[{content:t,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const f=require("@mui/material/CircularProgress");var h=a.n(f);const v=require("@mui/material/IconButton");var x=a.n(v);const g=require("@mui/material/InputAdornment");var b=a.n(g);const j=require("@mui/material/MenuItem");var y=a.n(j);const w=require("@mui/material/MenuList");var F=a.n(w);const S=require("@mui/material/Popover");var C=a.n(S);const N=require("@mui/material/TextField");var k=a.n(N);const P=require("@mui/material/Tooltip");var O=a.n(P);const E=require("@mui/material/Typography");var q=a.n(E),R=a(8342),T=a(9767);const I=function(e){var r=(0,s.useTheme)(),t=(0,u.useRef)(null),n=(0,u.useRef)(null),o=(0,u.useState)(!1),l=o[0],c=o[1],d={"--indicator-color":r.palette.divider,"--background":r.palette.background.paper,"--input-border-color":r.palette.divider,"--outline-color":r.palette.secondary.main};function p(){c(!1)}function m(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),p()}return(0,u.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(a.t.bind(a,8342,23)).then((function(t){var a=new(0,t.Picker)({dataSource:e.dataSource}),o="dark"===r.palette.mode?"dark":"light";a.classList.add(o),Object.keys(d).forEach((function(e){a.style.setProperty(e,d[e])})),n.current=a})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",m),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",m)}}),[l,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(O(),{title:"Emoji",children:(0,i.jsx)(x(),{size:"small",ref:t,onClick:function(){c((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:"Mood"})})}),n.current&&(0,i.jsx)(C(),{open:l,anchorEl:t.current,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,i.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var D={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function A(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var _=(0,u.forwardRef)((function(e,r){var t=(0,u.useState)(""),n=t[0],a=t[1],o=(0,u.useState)(!1),l=o[0],s=o[1],p=(0,u.useState)(!1),f=p[0],v=p[1],g=(0,u.useState)(!1),j=g[0],w=g[1],S=(0,u.useState)(""),N=S[0],P=S[1],E=(0,u.useState)([]),_=E[0],z=E[1],L=(0,u.useState)(!1),U=L[0],M=L[1],B=(0,u.useRef)(null),$=new R.Database({dataSource:e.emojiDataSource}),W=!n.trim().length&&!e.isSendEnabled,H="".concat(l?"Stop":"Start"," speech to text"),V=f?"primary.main":"primary.light",G=l?"error.main":V,K=l?"stop_circle":"speech_to_text";function Q(e,r){if(void 0===r&&(r=!1),B.current){var t=B.current,o=t.selectionStart,i=t.selectionEnd;if("number"==typeof o&&"number"==typeof i){var l,c=n||"",s=c.substring(0,o),u=c.substring(i);l=r?s.replace(/:(\w+)$/,e)+u:s+e+u,a(l);var d=r?s.replace(/:(\w+)$/,e).length:o+e.length;setTimeout((function(){var e,r;null===(e=B.current)||void 0===e||e.focus(),null===(r=B.current)||void 0===r||r.setSelectionRange(d,d)}),0)}}M(!1)}var Y=j?(0,i.jsx)(h(),{size:24}):(0,i.jsx)(O(),{title:H,children:(0,i.jsx)(x(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,l?(e.stop(),w(!0),s(!1)):(e.start(),P(""),s(!0)),e.onstart=function(){s(!0)},e.onresult=function(e){var r,t=e.results[0][0].transcript;n.length>0?a(n+" "+t):a(t),null===(r=B.current)||void 0===r||r.focus(),s(!1)},e.onerror=function(e){var r=D[e.error];P(r),s(!1)},e.onend=function(){w(!1),s(!1)}},size:"small",sx:{color:G,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:K})})});function Z(){var r=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:m(n)};e.send(t),a(""),P("")}return(0,i.jsxs)(c(),{className:"rustic-base-input",ref:r,children:[(0,i.jsxs)(c(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(c(),{className:"rustic-error-container",children:(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:N})}),(0,i.jsxs)(c(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:f?"secondary.main":"action.disabled"},children:[_.length>0&&(0,i.jsx)(C(),{open:U,anchorEl:B.current,onClose:function(){return M(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,i.jsx)(F(),{children:_.map((function(e,r){return"unicode"in e&&(0,i.jsx)(y(),{onClick:function(){return Q(e.unicode,!0)},children:A(e)},r)}))})}),(0,i.jsx)(k(),{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){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),W||Z())},onChange:function(r){P("");var t=r.target.value;a(t);var n,o=t.match(/:(\w{2,}):/g),i=t.match(/:(\w{2,})/g);if(o){var l=o[0].replace(/:/g,"");$.getEmojiByShortcode(l).then((function(e){if(e&&"unicode"in e){var r=t.replace(o[0],e.unicode);a(r)}else a(t)})).catch((function(){a(t)})),M(!1)}else i?(n=i[0].replace(":",""),$.getEmojiBySearchQuery(n).then((function(r){r.length?(z(r.slice(0,e.maximumEmojiSearchResults)),M(!0)):(z([]),M(!1))})).catch((function(){z([]),M(!1)}))):M(!1)},onFocus:function(){return v(!0)},onBlur:function(){return v(!1)},inputRef:B,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,i.jsxs)(b(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(I,{dataSource:e.emojiDataSource,onEmojiClick:Q,buttonColor:V}),e.enableSpeechToText&&Y]})},inputLabel:{className:f?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(c(),{className:"rustic-input-actions",children:[e.children,(0,i.jsx)(O(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(x(),{"aria-label":"send message",onClick:Z,disabled:W,color:"secondary",children:(0,i.jsx)(T.A,{name:"send"})})})})]})]})}));_.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const z=_,L=require("@mui/material/LinearProgress");var U=a.n(L);const M=require("axios");var B=a.n(M);const $=require("react-dom"),W=require("@mui/material/Card");var H=a.n(W);const V=require("@mui/material/Modal");var G=a.n(V);const K=require("@mui/material/useMediaQuery");var Q=a.n(K);const Y=require("@mui/system/Stack");var Z=a.n(Y);const J=require("@mui/system/useTheme");var X=a.n(J);const ee=require("pdfjs-dist"),re=function(e){var r={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},t=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,i.jsx)(O(),{title:t.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(x(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(T.A,{name:t.symbol})})})})};var te={pdf:function(e){var r,t=(0,u.useRef)(null),n=(0,u.useState)(1),a=n[0],o=n[1],l=(0,u.useState)(1),s=l[0],d=l[1],p=(0,u.useState)(1),m=p[0],f=p[1],h=(0,u.useState)(!1),v=h[0],x=h[1],g=(0,u.useState)(),b=g[0],j=g[1],y=X()(),w=Q()(y.breakpoints.down("sm")),F=Q()(y.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,i.jsx)(H(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var S=(0,u.useState)((function(){return w?.5:F?1:1.5})),C=S[0],N=S[1];return(0,u.useEffect)((function(){ee.GlobalWorkerOptions.workerSrc||(ee.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ee.version,"/pdf.worker.mjs")),ee.getDocument({url:"".concat(e.url)}).promise.then((function(e){d(e.numPages),function(e){e.getPage(a).then((function(e){var r=e.getViewport({scale:C}),n=t.current;if(n){var a=n.getContext("2d");if(a){var o=window.devicePixelRatio||1;n.style.width="".concat(r.width,"px"),n.style.height="".concat(r.height,"px"),n.width=r.width*o,n.height=r.height*o;var i={canvasContext:a,viewport:r,transform:[o,0,0,o,0,0]};b&&b.cancel();var l=e.render(i);j(l),l.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){x(!0)}))}),[e.url,a,C]),v?(0,i.jsx)(H(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(H(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(c(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(re,{action:"zoomOut",onClick:function(){N((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(re,{action:"zoomIn",onClick:function(){N((function(e){return e+.2}))}})]}),(0,i.jsx)(c(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(c(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:t})})}),(0,i.jsxs)(Z(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(re,{action:"previousPage",onClick:function(){a>1&&(o(a-1),f(a-1))},isDisabled:1===a}),(0,i.jsx)(q(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(k(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);f(r),!isNaN(r)&&r>=1&&r<=s&&o(r)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(q(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,i.jsx)(re,{action:"nextPage",onClick:function(){a<s&&(o(a+1),f(a+1))},isDisabled:a===s})]})]})}};function ne(e){var r=(0,s.useTheme)(),t=(0,u.useState)(!1),n=t[0],a=t[1];function o(){a(!1)}var l,c,d=e.file.url&&(l=e.file.url.split("."))[l.length-1].toLowerCase(),p=d&&e.supportedViewers?e.supportedViewers[d]:null,m=!!p,f=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",h=m?" rustic-cursor-pointer":"",v="rustic-file-preview ".concat(f).concat(h),g=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(H(),{className:v,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){a(!0)},children:[(0,i.jsx)(q(),{variant:"subtitle2",className:"rustic-file-preview-name",children:g}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),m&&(0,i.jsx)(G(),{open:n,onClose:o,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(O(),{title:"Close",children:(0,i.jsx)(x(),{onClick:o,className:"rustic-close-button",children:(0,i.jsx)(T.A,{name:"close"})})}),e.file.url&&(0,i.jsx)(p,{url:e.file.url})]})})]})}ne.defaultProps={supportedViewers:te,showFullName:!0};var ae=a(3110);const oe=require("@mui/material"),ie=require("@mui/material/Button");var le=a.n(ie);const ce=require("@mui/material/Drawer");var se=a.n(ce);const ue=require("@mui/material/ListItemText");var de=a.n(ue);const pe=require("@mui/material/Menu");var me=a.n(pe);const fe=require("@mui/system");var he=function(){return he=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},he.apply(this,arguments)};function ve(e){var r=(0,u.useState)(!1),t=r[0],n=r[1],a=(0,u.useRef)(null),o=(0,s.useTheme)(),l=(0,oe.useMediaQuery)(o.breakpoints.down("md")),c=l?se():me(),d={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(fe.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(de(),{children:(0,i.jsx)(q(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(fe.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}l&&(d=he(he({},d),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var m=e.menuItems.map((function(e){return e.href?(0,i.jsx)(y(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(y(),{onClick:function(r){e.onClick&&e.onClick(r),n(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var f,h,v=l?{}:{anchorEl:a.current};return(0,i.jsxs)(i.Fragment,{children:[(f={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},h=(0,i.jsx)(T.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(le(),he({},f,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(O(),{title:e.ariaLabel,children:(0,i.jsx)(x(),he({},f,{children:e.icon?e.icon:h}))})),(0,i.jsx)(c,he({open:t,onClose:function(){return n(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":he(he({},d),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:m}))]})}var xe=function(){return xe=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},xe.apply(this,arguments)},ge=function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};function be(e){for(var r=["Bytes","KB","MB","GB"],t=0;e>=1024&&t<r.length-1;)e/=1024,t++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(r[t])}const je=function(e){var r,t=(0,u.useState)([]),n=t[0],a=t[1],o=(0,u.useState)([]),l=o[0],s=o[1],p=(0,u.useState)({}),m=p[0],f=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();function g(e,r,t){var n;h.current=xe(xe({},h.current),((n={})[e]=h.current[e]--,n)),function(e,r,t){s((function(r){return ge(ge([],r,!0),["Failed to upload ".concat(e,". ").concat((null==t?void 0:t.message)||"")],!1)})),a((function(e){return e.filter((function(e){return e.id!==r}))}))}(e,r,t)}(0,u.useEffect)((function(){a([]),s([]),h.current={}}),[e.messageId]);var b=(0,i.jsx)(c(),{className:"rustic-files rustic-padding-16",children:n.map((function(r,t){return(0,i.jsx)(ne,{file:{name:r.name},showFullName:e.showFullName,children:(0,i.jsxs)(c(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,i.jsx)(U(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(O(),{title:"Delete",children:(0,i.jsx)(x(),{color:"primary",onClick:function(){return function(r,t){var n,o;s([]);var i=r.name;if(h.current=xe(xe({},h.current),((n={})[i]=h.current[i]--,n)),e.onFileUpdate("remove",i),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);B().delete(l).then((function(){return a((function(e){return e.filter((function(e,r){return r!==t}))}))})).catch((function(){return e.onFileUpdate("add",i),s((function(e){return ge(ge([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)}))}))}else r.abortController.abort(),a((function(e){return e.filter((function(e,r){return r!==t}))})),h.current=xe(xe({},h.current),((o={})[i]=h.current[i]++,o))}(r,t)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},t)}))}),j=(0,i.jsx)(c(),{children:l.map((function(e,r){return(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function y(e,r){return r?(0,$.createPortal)(e,r):e}var w=null===(r=e.uploadOptions)||void 0===r?void 0:r.map((function(r){return{label:r.label,onClick:function(){return function(r){f(r.metadata);var t=document.getElementById(v);t&&(t.accept=r.acceptedFileTypes||e.acceptedFileTypes),t.click()}(r)},startDecorator:r.iconName&&(0,i.jsx)(ae.default,{name:r.iconName})}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(c(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==w?void 0:w.length)?(0,i.jsx)(ve,{ariaLabel:"Upload",icon:(0,i.jsx)(ae.default,{name:"upload_2"}),menuItems:w}):(0,i.jsx)(O(),{title:"Upload",children:(0,i.jsx)(x(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,i.jsx)("input",{type:"file",id:v,onChange:function(r){s([]);var t=r.target.files&&Array.from(r.target.files),o=n.length+(t?t.length:0);e.maxFileCount&&o>e.maxFileCount&&s((function(r){return ge(ge([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var i=t&&function(e,r,t){return t?r<=t?e:e.slice(0,t-r):e}(t,o,e.maxFileCount);i&&i.forEach((function(r){!function(r){var t;e.maxFileSize&&r.size>e.maxFileSize?(t=r.name,s((function(r){return ge(ge([],r,!0),["Failed to upload ".concat(t,". You cannot upload files larger than ").concat(e.maxFileSize&&be(e.maxFileSize),".")],!1)}))):function(r){var t=new FormData,n=new AbortController,o=function(e){var r,t,n=e.name,a=h.current[n];if(a){var o=a+1,i=n.lastIndexOf("."),l=n.substring(0,i),c=n.substring(i);n="".concat(l,"(").concat(a,")").concat(c),h.current=xe(xe({},h.current),((r={})[e.name]=o,r))}else h.current=xe(xe({},h.current),((t={})[e.name]=1,t));return n}(r),i=new File([r],o,{type:r.type});if(e.getUploadData||m){var l=e.getUploadData?e.getUploadData(o):{},c=xe(xe({},l),m);Object.keys(c).forEach((function(e){var r=c[e];t.append(e,"object"==typeof r?JSON.stringify(r):r)}))}t.append("file",i);var s=(0,d.v4)(),u={name:o,loadingProgress:0,abortController:n,id:s};function p(e){var r,t;e.total&&(r=e.loaded/e.total*100,t=u.id,a((function(e){var n=e.map((function(e){return e.id===t?xe(xe({},e),{loadingProgress:r}):e}));return n})))}a((function(e){return ge(ge([],e,!0),[u],!1)})),e.onFileUpdate("add",o);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId);!function i(){return B().post(f,t,{onUploadProgress:p,signal:n.signal}).then((function(r){var n,o,i=t.get("file");r.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,r.data.url),r.data.fileId&&(n=r.data,o=u.id,a((function(e){var r=e.findIndex((function(e){return e.id===o}));if(-1!==r){var t=ge([],e,!0);return t[r]=xe(xe({},t[r]),{id:n.fileId}),t}return e})))})).catch((function(n){var l,c,d=t.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,m,f,h;409===(null===(l=n.response)||void 0===l?void 0:l.status)&&e.listFiles?(p=o.lastIndexOf("."),m=o.substring(0,p),f=o.substring(p),h=new RegExp("^".concat(m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var r=0,t=0,n=e;t<n.length;t++){var a=n[t];if(h.test(a.name)){var o=a.name.match(h),i=o&&o[1]?parseInt(o[1].slice(1,-1),10):0;r=Math.max(r,i)}}return"".concat(m,"(").concat(r+1,")").concat(f)})):Promise.resolve(o)).then((function(n){e.onFileUpdate("add",n);var o=new File([r],n,{type:r.type});t.set("file",o),a((function(e){return e.map((function(e){return e.id===s?xe(xe({},e),{name:n,loadingProgress:0}):e}))})),i()})).catch((function(){var e;g(r.name,u.id,null===(e=n.response)||void 0===e?void 0:e.data)})):g(r.name,u.id,null===(c=n.response)||void 0===c?void 0:c.data)}))}()}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),l.length>0&&y(j,e.errorMessagesContainer),n.length>0&&y(b,e.filePreviewsContainer)]})};var ye=function(){return ye=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},ye.apply(this,arguments)},we=function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};function Fe(e){var r=(0,u.useState)({uploaded:[],fileList:[]}),t=r[0],n=r[1],a=(0,u.useState)((0,d.v4)()),o=a[0],l=a[1],p=(0,u.useState)(),f=p[0],h=p[1],v=(0,u.useState)(),x=v[0],g=v[1],b=(0,u.useRef)(null),j=(0,s.useTheme)(),y=t.uploaded.length===t.fileList.length&&t.uploaded.length>0;return(0,u.useEffect)((function(){b.current&&(g(b.current.querySelector(".rustic-error-container")),h(b.current.querySelector(".rustic-input-extras")))})),(0,i.jsx)(c(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(j.palette.action.disabled),borderRadius:"".concat(j.shape.borderRadius,"px"),":focus-within":{borderColor:j.palette.secondary.main},background:j.palette.background.paper},children:(0,i.jsx)(z,ye({},e,{send:function(r){y&&(r.id=o,r.format="chatCompletionRequest",r.data=m(r.data.text,t.uploaded.map((function(e){return{url:e.url,name:e.name}})))),e.ws.send(r),l((0,d.v4)()),n({uploaded:[],fileList:[]})},isSendEnabled:y,ref:b,children:(0,i.jsx)(c(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(je,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,r,t){if("add"===e)n((function(e){return ye(ye({},e),{fileList:we(we([],e.fileList,!0),[{name:r}],!1)})}));else if("update"===e){if(!t)return void console.error("URL is required for the 'update' action");n((function(e){var n=e.fileList.findIndex((function(e){return e.name===r})),a=we(we(we([],e.uploaded.slice(0,n),!0),[{name:r,url:t}],!1),e.uploaded.slice(n),!0);return ye(ye({},e),{uploaded:a})}))}else n((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==r})),fileList:e.fileList.filter((function(e){return e.name!==r}))}}))},messageId:o,filePreviewsContainer:f,errorMessagesContainer:x,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions,listFiles:e.listFiles})})}))})}Fe.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1};const Se=Fe;return o})()));
1
+ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["@rustic-ai/ui-components"]=n():e["@rustic-ai/ui-components"]=n()}(global,(()=>(()=>{"use strict";var e,n,t={9767:(e,n,t)=>{t.d(n,{A:()=>i});var r=t(8732),a=(t(2015),function(){return a=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},a.apply(this,arguments)});function i(e){e.name.replaceAll("_","-");var n={};return e.color&&(n={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},n),children:e.name})}},3110:(e,n,t)=>{t.d(n,{default:()=>r});const r=t(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},r={};function a(e){var n=r[e];if(void 0!==n)return n.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,a),i.exports}a.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return a.d(n,{a:n}),n},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(t,r){if(1&r&&(t=this(t)),8&r)return t;if("object"==typeof t&&t){if(4&r&&t.__esModule)return t;if(16&r&&"function"==typeof t.then)return t}var i=Object.create(null);a.r(i);var o={};e=e||[null,n({}),n([]),n(n)];for(var c=2&r&&t;"object"==typeof c&&!~e.indexOf(c);c=n(c))Object.getOwnPropertyNames(c).forEach((e=>o[e]=()=>t[e]));return o.default=()=>t,a.d(i,o),i},a.d=(e,n)=>{for(var t in n)a.o(n,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},a.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),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,{ParticipantRole:()=>Ce,ParticipantType:()=>Fe,default:()=>Ee});var o=a(8732);const c=require("@mui/material/Box");var l=a.n(c);const s=require("@mui/material/styles");var u=a(2015);const d=require("uuid");var m;function p(e,n){var t=[];if(e&&(null==e?void 0:e.trim().length)&&t.push({type:"text",text:e}),n&&n.length>0)for(var r=0;r<(null==n?void 0:n.length);r++)t.push({type:"file_url",file_url:{url:n[r].url,name:n[r].name}});return{messages:[{content:t,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(m||(m={}));const f=require("@mui/material/Avatar");var h=a.n(f);const v=require("@mui/material/CircularProgress");var g=a.n(v);const x=require("@mui/material/IconButton");var b=a.n(x);const j=require("@mui/material/InputAdornment");var y=a.n(j);const w=require("@mui/material/MenuItem");var S=a.n(w);const N=require("@mui/material/MenuList");var C=a.n(N);const F=require("@mui/material/Popover");var k=a.n(F);const P=require("@mui/material/TextField");var O=a.n(P);const E=require("@mui/material/Tooltip");var q=a.n(E);const I=require("@mui/material/Typography");var T=a.n(I),R=a(8342),A=a(9767);const D=function(e){var n=(0,s.useTheme)(),t=(0,u.useRef)(null),r=(0,u.useRef)(null),i=(0,u.useState)(!1),c=i[0],l=i[1],d={"--indicator-color":n.palette.divider,"--background":n.palette.background.paper,"--input-border-color":n.palette.divider,"--outline-color":n.palette.secondary.main};function m(){l(!1)}function p(n){n.detail.unicode&&e.onEmojiClick(n.detail.unicode),m()}return(0,u.useEffect)((function(){r.current||"undefined"==typeof window||Promise.resolve().then(a.t.bind(a,8342,23)).then((function(t){var a=new(0,t.Picker)({dataSource:e.dataSource}),i="dark"===n.palette.mode?"dark":"light";a.classList.add(i),Object.keys(d).forEach((function(e){a.style.setProperty(e,d[e])})),r.current=a})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return r.current&&r.current.addEventListener("emoji-click",p),function(){var e;null===(e=r.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[c,e.onEmojiClick]),(0,o.jsxs)("div",{children:[(0,o.jsx)(q(),{title:"Emoji",children:(0,o.jsx)(b(),{size:"small",ref:t,onClick:function(){l((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,o.jsx)(A.A,{name:"Mood"})})}),r.current&&(0,o.jsx)(k(),{open:c,anchorEl:t.current,onClose:m,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,o.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&r.current&&!e.contains(r.current)&&e.appendChild(r.current)}})})]})};var U={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function _(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function L(e){return(0,o.jsxs)(l(),{className:"rustic-participant-profile",children:[(0,o.jsx)(h(),{src:e.icon,className:"rustic-participant-avatar"}),(0,o.jsx)(T(),{variant:"body1Bold",children:e.displayName})]})}function z(e){var n=e.items,t=e.isOpen,r=e.onClose,a=e.onSelect,i=e.renderItem,c=e.anchorEl,l=e.selectedIndex;return(0,o.jsx)(k(),{disableAutoFocus:!0,open:t&&n.length>0,anchorEl:c,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,o.jsx)(C(),{children:n.map((function(e,n){return(0,o.jsx)(S(),{onClick:function(){return a(e)},selected:n===l,children:i(e)},n)}))})})}var M=(0,u.forwardRef)((function(e,n){var t=(0,u.useState)(""),r=t[0],a=t[1],i=(0,u.useState)(!1),c=i[0],s=i[1],m=(0,u.useState)(!1),f=m[0],h=m[1],v=(0,u.useState)(!1),x=v[0],j=v[1],w=(0,u.useState)(""),S=w[0],N=w[1],C=(0,u.useState)([]),F=C[0],k=C[1],P=(0,u.useState)(!1),E=P[0],I=P[1],M=(0,u.useState)(0),B=M[0],H=M[1],$=(0,u.useRef)(null),W=new R.Database({dataSource:e.emojiDataSource}),K=!r.trim().length&&!e.isSendEnabled,V="".concat(c?"Stop":"Start"," speech to text"),G=f?"primary.main":"primary.light",Q=c?"error.main":G,Y=c?"stop_circle":"speech_to_text",Z=(0,u.useState)([]),J=Z[0],X=Z[1],ee=(0,u.useState)(!1),ne=ee[0],te=ee[1];function re(e,n){if($.current){var t=$.current,i=t.selectionStart,o=t.selectionEnd;if("number"==typeof i&&"number"==typeof o){var c,l=r||"",s=l.substring(0,i),u=l.substring(o),d=void 0;n?(d=s.replace(n,e)+u,c=s.replace(n,e).length):(d=s+e+u,c=i+e.length),a(d),setTimeout((function(){var e,n;null===(e=$.current)||void 0===e||e.focus(),null===(n=$.current)||void 0===n||n.setSelectionRange(c,c)}),0)}}}function ae(e){re("@".concat(e," "),/@(\w*)$/),X([])}function ie(e,n){void 0===n&&(n=!1),re(e,n?/:(\w+)$/:void 0),I(!1)}var oe=x?(0,o.jsx)(g(),{size:24}):(0,o.jsx)(q(),{title:V,children:(0,o.jsx)(b(),{onClick:function(){var e=new window.webkitSpeechRecognition,n=navigator.language;e.lang=n,c?(e.stop(),j(!0),s(!1)):(e.start(),N(""),s(!0)),e.onstart=function(){s(!0)},e.onresult=function(e){var n,t=e.results[0][0].transcript;r.length>0?a(r+" "+t):a(t),null===(n=$.current)||void 0===n||n.focus(),s(!1)},e.onerror=function(e){var n=U[e.error];N(n),s(!1)},e.onend=function(){j(!1),s(!1)}},size:"small",sx:{color:Q,"&:hover":{color:"primary.main"}},children:(0,o.jsx)(A.A,{name:Y})})});function ce(){var n=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:n,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:p(r)};e.send(t),a(""),N("")}return(0,o.jsxs)(l(),{className:"rustic-base-input",ref:n,children:[(0,o.jsxs)(l(),{className:"rustic-error-and-input-container",children:[(0,o.jsx)(l(),{className:"rustic-error-container",children:(0,o.jsx)(T(),{variant:"caption",color:"error",className:"rustic-error-message",children:S})}),(0,o.jsxs)(l(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:f?"secondary.main":"action.disabled"},children:[F.length>0&&$.current&&(0,o.jsx)(z,{anchorEl:$.current,items:F.filter((function(e){return"unicode"in e})),isOpen:E,onClose:function(){I(!1),H(0)},onSelect:function(e){return ie(e.unicode,!0)},selectedIndex:B,renderItem:_}),J.length>0&&$.current&&(0,o.jsx)(z,{anchorEl:$.current,items:J,isOpen:ne,onClose:function(){te(!1),H(0)},onSelect:function(e){return ae(e.displayName)},renderItem:L,selectedIndex:B}),(0,o.jsx)(O(),{className:"rustic-text-field",variant:"outlined",value:r,label:e.label,placeholder:e.placeholder,maxRows:e.maxRows,multiline:e.multiline,fullWidth:e.fullWidth,onKeyDown:function(e){var n,t="ArrowDown"===e.key,r="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),E&&F.length>0&&"unicode"in F[B]?ie(F[B].unicode,!0):ne&&J.length>0?ae(J[B].displayName):e.shiftKey||K||ce();else{if(t||r)return e.preventDefault(),n=t?1:-1,void(E?H((function(e){return(e+n+F.length)%F.length})):ne&&H((function(e){return(e+n+J.length)%J.length})));0!==B&&H(0)}},onChange:function(n){N("");var t=n.target.value;a(t),function(n){var t=n.match(/@(\w*)$/);if(t&&e.getMembers){var r=t[1].toLowerCase();e.getMembers().then((function(e){var n=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));X(n),n.length>0?te(!0):te(!1)}))}else X([])}(t);var r,i=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(i){var c=i[0].replace(/:/g,"");W.getEmojiByShortcode(c).then((function(e){if(e&&"unicode"in e){var n=t.replace(i[0],e.unicode);a(n)}else a(t)})).catch((function(){a(t)})),I(!1)}else o?(r=o[0].replace(":",""),W.getEmojiBySearchQuery(r).then((function(n){n.length?(k(n.slice(0,e.maximumEmojiSearchResults)),I(!0)):(k([]),I(!1))})).catch((function(){k([]),I(!1)}))):I(!1)},onFocus:function(){return h(!0)},onBlur:function(){return h(!1)},inputRef:$,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,o.jsxs)(y(),{position:"end",className:"rustic-input-adornment",children:[(0,o.jsx)(D,{dataSource:e.emojiDataSource,onEmojiClick:ie,buttonColor:G}),e.enableSpeechToText&&oe]})},inputLabel:{className:f?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,o.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,o.jsxs)(l(),{className:"rustic-input-actions",children:[e.children,(0,o.jsx)(q(),{title:"Send",children:(0,o.jsx)("span",{className:"rustic-send-button",children:(0,o.jsx)(b(),{"aria-label":"send message",onClick:ce,disabled:K,color:"secondary",children:(0,o.jsx)(A.A,{name:"send"})})})})]})]})}));M.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const B=M,H=require("@mui/material/LinearProgress");var $=a.n(H);const W=require("axios");var K=a.n(W);const V=require("react-dom"),G=require("@mui/material/Card");var Q=a.n(G);const Y=require("@mui/material/Modal");var Z=a.n(Y);const J=require("@mui/material/useMediaQuery");var X=a.n(J);const ee=require("@mui/system/Stack");var ne=a.n(ee);const te=require("@mui/system/useTheme");var re=a.n(te);const ae=require("pdfjs-dist"),ie=function(e){var n={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},t=(n[e.action].label.replaceAll(" ","-").toLowerCase(),n[e.action]);return(0,o.jsx)(q(),{title:t.label,children:(0,o.jsx)("span",{children:(0,o.jsx)(b(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,o.jsx)(A.A,{name:t.symbol})})})})};var oe={pdf:function(e){var n,t=(0,u.useRef)(null),r=(0,u.useState)(1),a=r[0],i=r[1],c=(0,u.useState)(1),s=c[0],d=c[1],m=(0,u.useState)(1),p=m[0],f=m[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],j=x[1],y=re()(),w=X()(y.breakpoints.down("sm")),S=X()(y.breakpoints.between("sm","md"));if(n=e.url,!/\/[^/]+\.pdf$/.test(n))return(0,o.jsx)(Q(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(T(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var N=(0,u.useState)((function(){return w?.5:S?1:1.5})),C=N[0],F=N[1];return(0,u.useEffect)((function(){ae.GlobalWorkerOptions.workerSrc||(ae.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ae.version,"/pdf.worker.mjs")),ae.getDocument({url:"".concat(e.url)}).promise.then((function(e){d(e.numPages),function(e){e.getPage(a).then((function(e){var n=e.getViewport({scale:C}),r=t.current;if(r){var a=r.getContext("2d");if(a){var i=window.devicePixelRatio||1;r.style.width="".concat(n.width,"px"),r.style.height="".concat(n.height,"px"),r.width=n.width*i,r.height=n.height*i;var o={canvasContext:a,viewport:n,transform:[i,0,0,i,0,0]};b&&b.cancel();var c=e.render(o);j(c),c.promise.then((function(){j(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,a,C]),v?(0,o.jsx)(Q(),{variant:"outlined",className:"rustic-pdf-error",children:(0,o.jsx)(T(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,o.jsxs)(Q(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,o.jsxs)(l(),{className:"rustic-pdf-viewer-header",children:[(0,o.jsx)(ie,{action:"zoomOut",onClick:function(){F((function(e){return Math.max(e-.2,.2)}))}}),(0,o.jsx)(ie,{action:"zoomIn",onClick:function(){F((function(e){return e+.2}))}})]}),(0,o.jsx)(l(),{className:"rustic-pdf-viewer-body",children:(0,o.jsx)(l(),{className:"rustic-pdf-viewer-body-inner",children:(0,o.jsx)("canvas",{ref:t})})}),(0,o.jsxs)(ne(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,o.jsx)(ie,{action:"previousPage",onClick:function(){a>1&&(i(a-1),f(a-1))},isDisabled:1===a}),(0,o.jsx)(T(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,o.jsx)(O(),{type:"number",value:p,onChange:function(e){var n=parseInt(e.target.value);f(n),!isNaN(n)&&n>=1&&n<=s&&i(n)},size:"small",className:"rustic-pdf-page-input"}),(0,o.jsxs)(T(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,o.jsx)(ie,{action:"nextPage",onClick:function(){a<s&&(i(a+1),f(a+1))},isDisabled:a===s})]})]})}};function ce(e){var n=(0,s.useTheme)(),t=(0,u.useState)(!1),r=t[0],a=t[1];function i(){a(!1)}var c,l,d=e.file.url&&(c=e.file.url.split("."))[c.length-1].toLowerCase(),m=d&&e.supportedViewers?e.supportedViewers[d]:null,p=!!m,f=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",h=p?" rustic-cursor-pointer":"",v="rustic-file-preview ".concat(f).concat(h),g=e.showFullName?e.file.name:(l=e.file.name).length<=15?l:l.substring(0,12)+"...";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(Q(),{className:v,variant:"outlined",sx:{boxShadow:n.shadows[1]},onClick:function(){a(!0)},children:[(0,o.jsx)(T(),{variant:"subtitle2",className:"rustic-file-preview-name",children:g}),(0,o.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,o.jsx)(Z(),{open:r,onClose:i,className:"rustic-file-preview-modal",children:(0,o.jsxs)("div",{className:"rustic-modal-content",children:[(0,o.jsx)(q(),{title:"Close",children:(0,o.jsx)(b(),{onClick:i,className:"rustic-close-button",children:(0,o.jsx)(A.A,{name:"close"})})}),e.file.url&&(0,o.jsx)(m,{url:e.file.url})]})})]})}ce.defaultProps={supportedViewers:oe,showFullName:!0};var le=a(3110);const se=require("@mui/material"),ue=require("@mui/material/Button");var de=a.n(ue);const me=require("@mui/material/Drawer");var pe=a.n(me);const fe=require("@mui/material/ListItemText");var he=a.n(fe);const ve=require("@mui/material/Menu");var ge=a.n(ve);const xe=require("@mui/system");var be=function(){return be=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},be.apply(this,arguments)};function je(e){var n=(0,u.useState)(!1),t=n[0],r=n[1],a=(0,u.useRef)(null),i=(0,s.useTheme)(),c=(0,se.useMediaQuery)(i.breakpoints.down("md")),l=c?pe():ge(),d={borderRadius:"".concat(i.shape.borderRadius,"px"),border:"1px solid ".concat(i.palette.divider)};function m(e){return(0,o.jsxs)(o.Fragment,{children:[e.startDecorator&&(0,o.jsx)(xe.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,o.jsx)(he(),{children:(0,o.jsx)(T(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,o.jsx)(xe.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(d=be(be({},d),{borderRadius:"".concat(i.shape.borderRadius,"px ").concat(i.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map((function(e){return e.href?(0,o.jsx)(S(),{component:"a",onClick:function(){return r(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:m(e)},e.label):(0,o.jsx)(S(),{onClick:function(n){e.onClick&&e.onClick(n),r(!1)},disabled:!e.onClick,children:m(e)},e.label)}));var f,h,v=c?{}:{anchorEl:a.current};return(0,o.jsxs)(o.Fragment,{children:[(f={onClick:function(e){e.stopPropagation(),r(!0)},"aria-label":e.ariaLabel,ref:a,className:"rustic-popover-menu-button"},h=(0,o.jsx)(A.A,{name:"more_vert"}),e.buttonText?(0,o.jsx)(de(),be({},f,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,o.jsx)(q(),{title:e.ariaLabel,children:(0,o.jsx)(b(),be({},f,{children:e.icon?e.icon:h}))})),(0,o.jsx)(l,be({open:t,onClose:function(){return r(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":be(be({},d),{backgroundImage:"none",boxShadow:i.shadows[2]})},children:p}))]})}var ye=function(){return ye=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},ye.apply(this,arguments)},we=function(e,n,t){if(t||2===arguments.length)for(var r,a=0,i=n.length;a<i;a++)!r&&a in n||(r||(r=Array.prototype.slice.call(n,0,a)),r[a]=n[a]);return e.concat(r||Array.prototype.slice.call(n))};function Se(e){for(var n=["Bytes","KB","MB","GB"],t=0;e>=1024&&t<n.length-1;)e/=1024,t++;var r=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(r," ").concat(n[t])}const Ne=function(e){var n,t=(0,u.useState)([]),r=t[0],a=t[1],i=(0,u.useState)([]),c=i[0],s=i[1],m=(0,u.useState)({}),p=m[0],f=m[1],h=(0,u.useRef)({}),v=(0,d.v4)();(0,u.useEffect)((function(){a([]),s([]),h.current={}}),[e.messageId]);var g=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function x(e,n,t){var r;h.current=ye(ye({},h.current),((r={})[e]=h.current[e]--,r)),function(e,n,t){s((function(n){return we(we([],n,!0),["Failed to upload ".concat(e,". ").concat((null==t?void 0:t.message)||"")],!1)})),a((function(e){return e.filter((function(e){return e.id!==n}))}))}(e,n,t)}var j=(0,o.jsx)(l(),{className:"rustic-files rustic-padding-16",children:r.map((function(n,t){return(0,o.jsx)(ce,{file:{name:n.name},showFullName:e.showFullName,children:(0,o.jsxs)(l(),{className:"rustic-flex-center",children:[n.loadingProgress<100&&(0,o.jsx)($(),{variant:"determinate",color:"secondary",value:n.loadingProgress,className:"rustic-upload-progress"}),(0,o.jsx)(q(),{title:"Delete",children:(0,o.jsx)(b(),{color:"primary",onClick:function(){return function(n,t){var r,i;s([]);var o=n.name;if(h.current=ye(ye({},h.current),((r={})[o]=h.current[o]--,r)),e.onFileUpdate("remove",o),100===n.loadingProgress){var c="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",n.id);g.then((function(n){K().delete(c,ye({},n)).then((function(){return a((function(e){return e.filter((function(e,n){return n!==t}))}))})).catch((function(){return e.onFileUpdate("add",o),s((function(e){return we(we([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}))}else n.abortController.abort(),a((function(e){return e.filter((function(e,n){return n!==t}))})),h.current=ye(ye({},h.current),((i={})[o]=h.current[o]++,i))}(n,t)},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"})})})]})},t)}))}),y=(0,o.jsx)(l(),{children:c.map((function(e,n){return(0,o.jsx)(T(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},n)}))});function w(e,n){return n?(0,V.createPortal)(e,n):e}var S=null===(n=e.uploadOptions)||void 0===n?void 0:n.map((function(n){return{label:n.label,onClick:function(){return function(n){f(n.metadata);var t=document.getElementById(v);t&&(t.accept=n.acceptedFileTypes||e.acceptedFileTypes),t.click()}(n)},startDecorator:n.iconName&&(0,o.jsx)(le.default,{name:n.iconName})}}));return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(l(),{className:"rustic-uploader",children:[(0,o.jsx)("label",{htmlFor:v,children:(null==S?void 0:S.length)?(0,o.jsx)(je,{ariaLabel:"Upload",icon:(0,o.jsx)(le.default,{name:"upload_2"}),menuItems:S}):(0,o.jsx)(q(),{title:"Upload",children:(0,o.jsx)(b(),{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:v,onChange:function(n){s([]);var t=n.target.files&&Array.from(n.target.files),i=r.length+(t?t.length:0);e.maxFileCount&&i>e.maxFileCount&&s((function(n){return we(we([],n,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=t&&function(e,n,t){return t?n<=t?e:e.slice(0,t-n):e}(t,i,e.maxFileCount);o&&o.forEach((function(n){!function(n){var t;e.maxFileSize&&n.size>e.maxFileSize?(t=n.name,s((function(n){return we(we([],n,!0),["Failed to upload ".concat(t,". You cannot upload files larger than ").concat(e.maxFileSize&&Se(e.maxFileSize),".")],!1)}))):function(n){var t=new FormData,r=new AbortController,i=function(e){var n,t,r=e.name,a=h.current[r];if(a){var i=a+1,o=r.lastIndexOf("."),c=r.substring(0,o),l=r.substring(o);r="".concat(c,"(").concat(a,")").concat(l),h.current=ye(ye({},h.current),((n={})[e.name]=i,n))}else h.current=ye(ye({},h.current),((t={})[e.name]=1,t));return r}(n),o=new File([n],i,{type:n.type});if(e.getUploadData||p){var c=e.getUploadData?e.getUploadData(i):{},l=ye(ye({},c),p);Object.keys(l).forEach((function(e){var n=l[e];t.append(e,"object"==typeof n?JSON.stringify(n):n)}))}t.append("file",o);var s=(0,d.v4)(),u={name:i,loadingProgress:0,abortController:r,id:s};function m(e){var n,t;e.total&&(n=e.loaded/e.total*100,t=u.id,a((function(e){var r=e.map((function(e){return e.id===t?ye(ye({},e),{loadingProgress:n}):e}));return r})))}a((function(e){return we(we([],e,!0),[u],!1)})),e.onFileUpdate("add",i);var f="".concat(e.uploadFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId);!function o(){return g.then((function(c){return K().post(f,t,ye(ye({},c),{onUploadProgress:m,signal:r.signal})).then((function(n){var r,i,o=t.get("file");n.data.url&&o instanceof File&&o.name&&e.onFileUpdate("update",o.name,n.data.url),n.data.fileId&&(r=n.data,i=u.id,a((function(e){var n=e.findIndex((function(e){return e.id===i}));if(-1!==n){var t=we([],e,!0);return t[n]=ye(ye({},t[n]),{id:r.fileId}),t}return e})))})).catch((function(r){var c,l,d=t.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var m,p,f,h;409===(null===(c=r.response)||void 0===c?void 0:c.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 n=0,t=0,r=e;t<r.length;t++){var a=r[t];if(h.test(a.name)){var i=a.name.match(h),o=i&&i[1]?parseInt(i[1].slice(1,-1),10):0;n=Math.max(n,o)}}return"".concat(p,"(").concat(n+1,")").concat(f)})):Promise.resolve(i)).then((function(r){e.onFileUpdate("add",r);var i=new File([n],r,{type:n.type});t.set("file",i),a((function(e){return e.map((function(e){return e.id===s?ye(ye({},e),{name:r,loadingProgress:0}):e}))})),o()})).catch((function(){var e;x(n.name,u.id,null===(e=r.response)||void 0===e?void 0:e.data)})):x(n.name,u.id,null===(l=r.response)||void 0===l?void 0:l.data)}))}))}()}(n)}(n)})),n.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&w(y,e.errorMessagesContainer),r.length>0&&w(j,e.filePreviewsContainer)]})};var Ce,Fe,ke=function(){return ke=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},ke.apply(this,arguments)},Pe=function(e,n,t){if(t||2===arguments.length)for(var r,a=0,i=n.length;a<i;a++)!r&&a in n||(r||(r=Array.prototype.slice.call(n,0,a)),r[a]=n[a]);return e.concat(r||Array.prototype.slice.call(n))};function Oe(e){var n=(0,u.useState)({uploaded:[],fileList:[]}),t=n[0],r=n[1],a=(0,u.useState)((0,d.v4)()),i=a[0],c=a[1],m=(0,u.useState)(),f=m[0],h=m[1],v=(0,u.useState)(),g=v[0],x=v[1],b=(0,u.useRef)(null),j=(0,s.useTheme)(),y=t.uploaded.length===t.fileList.length&&t.uploaded.length>0;return(0,u.useEffect)((function(){b.current&&(x(b.current.querySelector(".rustic-error-container")),h(b.current.querySelector(".rustic-input-extras")))})),(0,o.jsx)(l(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(j.palette.action.disabled),borderRadius:"".concat(j.shape.borderRadius,"px"),":focus-within":{borderColor:j.palette.secondary.main},background:j.palette.background.paper},children:(0,o.jsx)(B,ke({},e,{send:function(n){y&&(n.id=i,n.format="chatCompletionRequest",n.data=p(n.data.text,t.uploaded.map((function(e){return{url:e.url,name:e.name}})))),e.ws.send(n),c((0,d.v4)()),r({uploaded:[],fileList:[]})},isSendEnabled:y,ref:b,children:(0,o.jsx)(l(),{className:"rustic-bottom-buttons",children:(0,o.jsx)(Ne,{acceptedFileTypes:e.acceptedFileTypes,maxFileCount:e.maxFileCount,maxFileSize:e.maxFileSize,uploadFileEndpoint:e.uploadFileEndpoint,deleteFileEndpoint:e.deleteFileEndpoint,onFileUpdate:function(e,n,t){if("add"===e)r((function(e){return ke(ke({},e),{fileList:Pe(Pe([],e.fileList,!0),[{name:n}],!1)})}));else if("update"===e){if(!t)return void console.error("URL is required for the 'update' action");r((function(e){var r=e.fileList.findIndex((function(e){return e.name===n})),a=Pe(Pe(Pe([],e.uploaded.slice(0,r),!0),[{name:n,url:t}],!1),e.uploaded.slice(r),!0);return ke(ke({},e),{uploaded:a})}))}else r((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==n})),fileList:e.fileList.filter((function(e){return e.name!==n}))}}))},messageId:i,filePreviewsContainer:f,errorMessagesContainer:g,showFullName:e.showFullName,getUploadData:e.getUploadData,uploadOptions:e.uploadOptions,listFiles:e.listFiles,getUploadHeaders:e.getUploadHeaders})})}))})}Oe.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,maxFileSize:2097152,maxFileCount:1},function(e){e.Owner="owner",e.Member="member"}(Ce||(Ce={})),function(e){e.Human="human",e.Agent="agent"}(Fe||(Fe={}));const Ee=Oe;return i})()));
@@ -1 +1 @@
1
- {"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CA+HlE;kBA/HuB,eAAe;;;;;;;;;eAAf,eAAe"}
1
+ {"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI7E;;;;;;;;;;;;;;;EAeE;AACF,iBAAwB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAgIlE;kBAhIuB,eAAe;;;;;;;;;eAAf,eAAe"}
@@ -98,6 +98,17 @@ code {
98
98
  margin-right: -8px;
99
99
  }
100
100
 
101
+ .rustic-participant-profile {
102
+ display: flex;
103
+ gap: 8px;
104
+ align-items: center;
105
+ }
106
+
107
+ .rustic-participant-profile .rustic-participant-avatar {
108
+ width: 16px;
109
+ height: 16px;
110
+ }
111
+
101
112
  span.rustic-icon-large {
102
113
  font-size: 32px;
103
114
  }
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={9767:(e,r,n)=>{n.d(r,{A:()=>i});var t=n(8732),a=(n(2015),function(){return a=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},a.apply(this,arguments)});function i(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},r),children:e.name})}},3110:(e,r,n)=>{n.d(r,{default:()=>t});const t=n(9767).A},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},r={};function n(t){var a=r[t];if(void 0!==a)return a.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};n.r(t),n.d(t,{default:()=>te});var a=n(8732);const i=require("@mui/material/Box");var o=n.n(i);const l=require("@mui/material/IconButton");var s=n.n(l);const c=require("@mui/material/LinearProgress");var u=n.n(c);const d=require("@mui/material/Tooltip");var m=n.n(d);const p=require("@mui/material/Typography");var f=n.n(p);const v=require("axios");var h=n.n(v),x=n(2015);const g=require("react-dom"),b=require("uuid"),j=require("@mui/material/Card");var y=n.n(j);const w=require("@mui/material/Modal");var F=n.n(w);const N=require("@mui/material/styles");var C;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(C||(C={}));var P=n(9767);const k=require("@mui/material/TextField");var O=n.n(k);const S=require("@mui/material/useMediaQuery");var q=n.n(S);const I=require("@mui/system/Stack");var D=n.n(I);const T=require("@mui/system/useTheme");var A=n.n(T);const U=require("pdfjs-dist"),M=function(e){var r={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},n=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,a.jsx)(m(),{title:n.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(s(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(P.A,{name:n.symbol})})})})};var _={pdf:function(e){var r,n=(0,x.useRef)(null),t=(0,x.useState)(1),i=t[0],l=t[1],s=(0,x.useState)(1),c=s[0],u=s[1],d=(0,x.useState)(1),m=d[0],p=d[1],v=(0,x.useState)(!1),h=v[0],g=v[1],b=(0,x.useState)(),j=b[0],w=b[1],F=A()(),N=q()(F.breakpoints.down("sm")),C=q()(F.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,a.jsx)(y(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(f(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var P=(0,x.useState)((function(){return N?.5:C?1:1.5})),k=P[0],S=P[1];return(0,x.useEffect)((function(){U.GlobalWorkerOptions.workerSrc||(U.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(U.version,"/pdf.worker.mjs")),U.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(i).then((function(e){var r=e.getViewport({scale:k}),t=n.current;if(t){var a=t.getContext("2d");if(a){var i=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*i,t.height=r.height*i;var o={canvasContext:a,viewport:r,transform:[i,0,0,i,0,0]};j&&j.cancel();var l=e.render(o);w(l),l.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,i,k]),h?(0,a.jsx)(y(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(f(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(y(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(o(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(M,{action:"zoomOut",onClick:function(){S((function(e){return Math.max(e-.2,.2)}))}}),(0,a.jsx)(M,{action:"zoomIn",onClick:function(){S((function(e){return e+.2}))}})]}),(0,a.jsx)(o(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(o(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:n})})}),(0,a.jsxs)(D(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(M,{action:"previousPage",onClick:function(){i>1&&(l(i-1),p(i-1))},isDisabled:1===i}),(0,a.jsx)(f(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(O(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=c&&l(r)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(f(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,a.jsx)(M,{action:"nextPage",onClick:function(){i<c&&(l(i+1),p(i+1))},isDisabled:i===c})]})]})}};function R(e){var r=(0,N.useTheme)(),n=(0,x.useState)(!1),t=n[0],i=n[1];function o(){i(!1)}var l,c,u=e.file.url&&(l=e.file.url.split("."))[l.length-1].toLowerCase(),d=u&&e.supportedViewers?e.supportedViewers[u]:null,p=!!d,v=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",h=p?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(v).concat(h),b=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(y(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,a.jsx)(f(),{variant:"subtitle2",className:"rustic-file-preview-name",children:b}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,a.jsx)(F(),{open:t,onClose:o,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(m(),{title:"Close",children:(0,a.jsx)(s(),{onClick:o,className:"rustic-close-button",children:(0,a.jsx)(P.A,{name:"close"})})}),e.file.url&&(0,a.jsx)(d,{url:e.file.url})]})})]})}R.defaultProps={supportedViewers:_,showFullName:!0};var z=n(3110);const B=require("@mui/material"),E=require("@mui/material/Button");var L=n.n(E);const $=require("@mui/material/Drawer");var H=n.n($);const V=require("@mui/material/ListItemText");var G=n.n(V);const Q=require("@mui/material/Menu");var W=n.n(Q);const Y=require("@mui/material/MenuItem");var Z=n.n(Y);const J=require("@mui/system");var K=function(){return K=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},K.apply(this,arguments)};function X(e){var r=(0,x.useState)(!1),n=r[0],t=r[1],i=(0,x.useRef)(null),o=(0,N.useTheme)(),l=(0,B.useMediaQuery)(o.breakpoints.down("md")),c=l?H():W(),u={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function d(e){return(0,a.jsxs)(a.Fragment,{children:[e.startDecorator&&(0,a.jsx)(J.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,a.jsx)(G(),{children:(0,a.jsx)(f(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,a.jsx)(J.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}l&&(u=K(K({},u),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map((function(e){return e.href?(0,a.jsx)(Z(),{component:"a",onClick:function(){return t(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,a.jsx)(Z(),{onClick:function(r){e.onClick&&e.onClick(r),t(!1)},disabled:!e.onClick,children:d(e)},e.label)}));var v,h,g=l?{}:{anchorEl:i.current};return(0,a.jsxs)(a.Fragment,{children:[(v={onClick:function(e){e.stopPropagation(),t(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},h=(0,a.jsx)(P.A,{name:"more_vert"}),e.buttonText?(0,a.jsx)(L(),K({},v,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,a.jsx)(m(),{title:e.ariaLabel,children:(0,a.jsx)(s(),K({},v,{children:e.icon?e.icon:h}))})),(0,a.jsx)(c,K({open:n,onClose:function(){return t(!1)}},g,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":K(K({},u),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:p}))]})}var ee=function(){return ee=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},ee.apply(this,arguments)},re=function(e,r,n){if(n||2===arguments.length)for(var t,a=0,i=r.length;a<i;a++)!t&&a in r||(t||(t=Array.prototype.slice.call(r,0,a)),t[a]=r[a]);return e.concat(t||Array.prototype.slice.call(r))};function ne(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}const te=function(e){var r,n=(0,x.useState)([]),t=n[0],i=n[1],l=(0,x.useState)([]),c=l[0],d=l[1],p=(0,x.useState)({}),v=p[0],j=p[1],y=(0,x.useRef)({}),w=(0,b.v4)();function F(e,r,n){var t;y.current=ee(ee({},y.current),((t={})[e]=y.current[e]--,t)),function(e,r,n){d((function(r){return re(re([],r,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)})),i((function(e){return e.filter((function(e){return e.id!==r}))}))}(e,r,n)}(0,x.useEffect)((function(){i([]),d([]),y.current={}}),[e.messageId]);var N=(0,a.jsx)(o(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,n){return(0,a.jsx)(R,{file:{name:r.name},showFullName:e.showFullName,children:(0,a.jsxs)(o(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,a.jsx)(u(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,a.jsx)(m(),{title:"Delete",children:(0,a.jsx)(s(),{color:"primary",onClick:function(){return function(r,n){var t,a;d([]);var o=r.name;if(y.current=ee(ee({},y.current),((t={})[o]=y.current[o]--,t)),e.onFileUpdate("remove",o),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);h().delete(l).then((function(){return i((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",o),d((function(e){return re(re([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}else r.abortController.abort(),i((function(e){return e.filter((function(e,r){return r!==n}))})),y.current=ee(ee({},y.current),((a={})[o]=y.current[o]++,a))}(r,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)}))}),C=(0,a.jsx)(o(),{children:c.map((function(e,r){return(0,a.jsx)(f(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function P(e,r){return r?(0,g.createPortal)(e,r):e}var k=null===(r=e.uploadOptions)||void 0===r?void 0:r.map((function(r){return{label:r.label,onClick:function(){return function(r){j(r.metadata);var n=document.getElementById(w);n&&(n.accept=r.acceptedFileTypes||e.acceptedFileTypes),n.click()}(r)},startDecorator:r.iconName&&(0,a.jsx)(z.default,{name:r.iconName})}}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o(),{className:"rustic-uploader",children:[(0,a.jsx)("label",{htmlFor:w,children:(null==k?void 0:k.length)?(0,a.jsx)(X,{ariaLabel:"Upload",icon:(0,a.jsx)(z.default,{name:"upload_2"}),menuItems:k}):(0,a.jsx)(m(),{title:"Upload",children:(0,a.jsx)(s(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,a.jsx)("input",{type:"file",id:w,onChange:function(r){d([]);var n=r.target.files&&Array.from(r.target.files),a=t.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&d((function(r){return re(re([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=n&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(n,a,e.maxFileCount);o&&o.forEach((function(r){!function(r){var n;e.maxFileSize&&r.size>e.maxFileSize?(n=r.name,d((function(r){return re(re([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&ne(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,t=new AbortController,a=function(e){var r,n,t=e.name,a=y.current[t];if(a){var i=a+1,o=t.lastIndexOf("."),l=t.substring(0,o),s=t.substring(o);t="".concat(l,"(").concat(a,")").concat(s),y.current=ee(ee({},y.current),((r={})[e.name]=i,r))}else y.current=ee(ee({},y.current),((n={})[e.name]=1,n));return t}(r),o=new File([r],a,{type:r.type});if(e.getUploadData||v){var l=e.getUploadData?e.getUploadData(a):{},s=ee(ee({},l),v);Object.keys(s).forEach((function(e){var r=s[e];n.append(e,"object"==typeof r?JSON.stringify(r):r)}))}n.append("file",o);var c=(0,b.v4)(),u={name:a,loadingProgress:0,abortController:t,id:c};function d(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=u.id,i((function(e){var t=e.map((function(e){return e.id===n?ee(ee({},e),{loadingProgress:r}):e}));return t})))}i((function(e){return re(re([],e,!0),[u],!1)})),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function o(){return h().post(m,n,{onUploadProgress:d,signal:t.signal}).then((function(r){var t,a,o=n.get("file");r.data.url&&o instanceof File&&o.name&&e.onFileUpdate("update",o.name,r.data.url),r.data.fileId&&(t=r.data,a=u.id,i((function(e){var r=e.findIndex((function(e){return e.id===a}));if(-1!==r){var n=re([],e,!0);return n[r]=ee(ee({},n[r]),{id:t.fileId}),n}return e})))})).catch((function(t){var l,s,d=n.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var m,p,f,v;409===(null===(l=t.response)||void 0===l?void 0:l.status)&&e.listFiles?(m=a.lastIndexOf("."),p=a.substring(0,m),f=a.substring(m),v=new RegExp("^".concat(p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var r=0,n=0,t=e;n<t.length;n++){var a=t[n];if(v.test(a.name)){var i=a.name.match(v),o=i&&i[1]?parseInt(i[1].slice(1,-1),10):0;r=Math.max(r,o)}}return"".concat(p,"(").concat(r+1,")").concat(f)})):Promise.resolve(a)).then((function(t){e.onFileUpdate("add",t);var a=new File([r],t,{type:r.type});n.set("file",a),i((function(e){return e.map((function(e){return e.id===c?ee(ee({},e),{name:t,loadingProgress:0}):e}))})),o()})).catch((function(){var e;F(r.name,u.id,null===(e=t.response)||void 0===e?void 0:e.data)})):F(r.name,u.id,null===(s=t.response)||void 0===s?void 0:s.data)}))}()}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&P(C,e.errorMessagesContainer),t.length>0&&P(N,e.filePreviewsContainer)]})};return t})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={9767:(e,r,n)=>{n.d(r,{A:()=>i});var t=n(8732),a=(n(2015),function(){return a=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},a.apply(this,arguments)});function i(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:a({},r),children:e.name})}},3110:(e,r,n)=>{n.d(r,{default:()=>t});const t=n(9767).A},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},r={};function n(t){var a=r[t];if(void 0!==a)return a.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};n.r(t),n.d(t,{ParticipantRole:()=>te,ParticipantType:()=>ae,default:()=>ie});var a=n(8732);const i=require("@mui/material/Box");var o=n.n(i);const l=require("@mui/material/IconButton");var s=n.n(l);const c=require("@mui/material/LinearProgress");var u=n.n(c);const d=require("@mui/material/Tooltip");var m=n.n(d);const p=require("@mui/material/Typography");var f=n.n(p);const v=require("axios");var h=n.n(v),x=n(2015);const g=require("react-dom"),b=require("uuid"),j=require("@mui/material/Card");var y=n.n(j);const w=require("@mui/material/Modal");var F=n.n(w);const N=require("@mui/material/styles");var C;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(C||(C={}));var P=n(9767);const k=require("@mui/material/TextField");var O=n.n(k);const S=require("@mui/material/useMediaQuery");var q=n.n(S);const I=require("@mui/system/Stack");var T=n.n(I);const A=require("@mui/system/useTheme");var D=n.n(A);const U=require("pdfjs-dist"),M=function(e){var r={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},n=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,a.jsx)(m(),{title:n.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(s(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(P.A,{name:n.symbol})})})})};var R={pdf:function(e){var r,n=(0,x.useRef)(null),t=(0,x.useState)(1),i=t[0],l=t[1],s=(0,x.useState)(1),c=s[0],u=s[1],d=(0,x.useState)(1),m=d[0],p=d[1],v=(0,x.useState)(!1),h=v[0],g=v[1],b=(0,x.useState)(),j=b[0],w=b[1],F=D()(),N=q()(F.breakpoints.down("sm")),C=q()(F.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,a.jsx)(y(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(f(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var P=(0,x.useState)((function(){return N?.5:C?1:1.5})),k=P[0],S=P[1];return(0,x.useEffect)((function(){U.GlobalWorkerOptions.workerSrc||(U.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(U.version,"/pdf.worker.mjs")),U.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(i).then((function(e){var r=e.getViewport({scale:k}),t=n.current;if(t){var a=t.getContext("2d");if(a){var i=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*i,t.height=r.height*i;var o={canvasContext:a,viewport:r,transform:[i,0,0,i,0,0]};j&&j.cancel();var l=e.render(o);w(l),l.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}),[e.url,i,k]),h?(0,a.jsx)(y(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(f(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(y(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(o(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(M,{action:"zoomOut",onClick:function(){S((function(e){return Math.max(e-.2,.2)}))}}),(0,a.jsx)(M,{action:"zoomIn",onClick:function(){S((function(e){return e+.2}))}})]}),(0,a.jsx)(o(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(o(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:n})})}),(0,a.jsxs)(T(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(M,{action:"previousPage",onClick:function(){i>1&&(l(i-1),p(i-1))},isDisabled:1===i}),(0,a.jsx)(f(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(O(),{type:"number",value:m,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=c&&l(r)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(f(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,a.jsx)(M,{action:"nextPage",onClick:function(){i<c&&(l(i+1),p(i+1))},isDisabled:i===c})]})]})}};function _(e){var r=(0,N.useTheme)(),n=(0,x.useState)(!1),t=n[0],i=n[1];function o(){i(!1)}var l,c,u=e.file.url&&(l=e.file.url.split("."))[l.length-1].toLowerCase(),d=u&&e.supportedViewers?e.supportedViewers[u]:null,p=!!d,v=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",h=p?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(v).concat(h),b=e.showFullName?e.file.name:(c=e.file.name).length<=15?c:c.substring(0,12)+"...";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(y(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){i(!0)},children:[(0,a.jsx)(f(),{variant:"subtitle2",className:"rustic-file-preview-name",children:b}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),p&&(0,a.jsx)(F(),{open:t,onClose:o,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(m(),{title:"Close",children:(0,a.jsx)(s(),{onClick:o,className:"rustic-close-button",children:(0,a.jsx)(P.A,{name:"close"})})}),e.file.url&&(0,a.jsx)(d,{url:e.file.url})]})})]})}_.defaultProps={supportedViewers:R,showFullName:!0};var z=n(3110);const B=require("@mui/material"),E=require("@mui/material/Button");var L=n.n(E);const H=require("@mui/material/Drawer");var $=n.n(H);const V=require("@mui/material/ListItemText");var G=n.n(V);const Q=require("@mui/material/Menu");var W=n.n(Q);const Y=require("@mui/material/MenuItem");var Z=n.n(Y);const J=require("@mui/system");var K=function(){return K=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},K.apply(this,arguments)};function X(e){var r=(0,x.useState)(!1),n=r[0],t=r[1],i=(0,x.useRef)(null),o=(0,N.useTheme)(),l=(0,B.useMediaQuery)(o.breakpoints.down("md")),c=l?$():W(),u={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function d(e){return(0,a.jsxs)(a.Fragment,{children:[e.startDecorator&&(0,a.jsx)(J.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,a.jsx)(G(),{children:(0,a.jsx)(f(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,a.jsx)(J.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}l&&(u=K(K({},u),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map((function(e){return e.href?(0,a.jsx)(Z(),{component:"a",onClick:function(){return t(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,a.jsx)(Z(),{onClick:function(r){e.onClick&&e.onClick(r),t(!1)},disabled:!e.onClick,children:d(e)},e.label)}));var v,h,g=l?{}:{anchorEl:i.current};return(0,a.jsxs)(a.Fragment,{children:[(v={onClick:function(e){e.stopPropagation(),t(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},h=(0,a.jsx)(P.A,{name:"more_vert"}),e.buttonText?(0,a.jsx)(L(),K({},v,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,a.jsx)(m(),{title:e.ariaLabel,children:(0,a.jsx)(s(),K({},v,{children:e.icon?e.icon:h}))})),(0,a.jsx)(c,K({open:n,onClose:function(){return t(!1)}},g,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":K(K({},u),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:p}))]})}var ee=function(){return ee=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},ee.apply(this,arguments)},re=function(e,r,n){if(n||2===arguments.length)for(var t,a=0,i=r.length;a<i;a++)!t&&a in r||(t||(t=Array.prototype.slice.call(r,0,a)),t[a]=r[a]);return e.concat(t||Array.prototype.slice.call(r))};function ne(e){for(var r=["Bytes","KB","MB","GB"],n=0;e>=1024&&n<r.length-1;)e/=1024,n++;var t=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(t," ").concat(r[n])}var te,ae;!function(e){e.Owner="owner",e.Member="member"}(te||(te={})),function(e){e.Human="human",e.Agent="agent"}(ae||(ae={}));const ie=function(e){var r,n=(0,x.useState)([]),t=n[0],i=n[1],l=(0,x.useState)([]),c=l[0],d=l[1],p=(0,x.useState)({}),v=p[0],j=p[1],y=(0,x.useRef)({}),w=(0,b.v4)();(0,x.useEffect)((function(){i([]),d([]),y.current={}}),[e.messageId]);var F=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function N(e,r,n){var t;y.current=ee(ee({},y.current),((t={})[e]=y.current[e]--,t)),function(e,r,n){d((function(r){return re(re([],r,!0),["Failed to upload ".concat(e,". ").concat((null==n?void 0:n.message)||"")],!1)})),i((function(e){return e.filter((function(e){return e.id!==r}))}))}(e,r,n)}var C=(0,a.jsx)(o(),{className:"rustic-files rustic-padding-16",children:t.map((function(r,n){return(0,a.jsx)(_,{file:{name:r.name},showFullName:e.showFullName,children:(0,a.jsxs)(o(),{className:"rustic-flex-center",children:[r.loadingProgress<100&&(0,a.jsx)(u(),{variant:"determinate",color:"secondary",value:r.loadingProgress,className:"rustic-upload-progress"}),(0,a.jsx)(m(),{title:"Delete",children:(0,a.jsx)(s(),{color:"primary",onClick:function(){return function(r,n){var t,a;d([]);var o=r.name;if(y.current=ee(ee({},y.current),((t={})[o]=y.current[o]--,t)),e.onFileUpdate("remove",o),100===r.loadingProgress){var l="".concat(e.deleteFileEndpoint).replaceAll("fileName",o).replaceAll("messageId",e.messageId).replaceAll("fileId",r.id);F.then((function(r){h().delete(l,ee({},r)).then((function(){return i((function(e){return e.filter((function(e,r){return r!==n}))}))})).catch((function(){return e.onFileUpdate("add",o),d((function(e){return re(re([],e,!0),["Failed to delete ".concat(o,". Please try again.")],!1)}))}))}))}else r.abortController.abort(),i((function(e){return e.filter((function(e,r){return r!==n}))})),y.current=ee(ee({},y.current),((a={})[o]=y.current[o]++,a))}(r,n)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},n)}))}),P=(0,a.jsx)(o(),{children:c.map((function(e,r){return(0,a.jsx)(f(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},r)}))});function k(e,r){return r?(0,g.createPortal)(e,r):e}var O=null===(r=e.uploadOptions)||void 0===r?void 0:r.map((function(r){return{label:r.label,onClick:function(){return function(r){j(r.metadata);var n=document.getElementById(w);n&&(n.accept=r.acceptedFileTypes||e.acceptedFileTypes),n.click()}(r)},startDecorator:r.iconName&&(0,a.jsx)(z.default,{name:r.iconName})}}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o(),{className:"rustic-uploader",children:[(0,a.jsx)("label",{htmlFor:w,children:(null==O?void 0:O.length)?(0,a.jsx)(X,{ariaLabel:"Upload",icon:(0,a.jsx)(z.default,{name:"upload_2"}),menuItems:O}):(0,a.jsx)(m(),{title:"Upload",children:(0,a.jsx)(s(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,a.jsx)("input",{type:"file",id:w,onChange:function(r){d([]);var n=r.target.files&&Array.from(r.target.files),a=t.length+(n?n.length:0);e.maxFileCount&&a>e.maxFileCount&&d((function(r){return re(re([],r,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var o=n&&function(e,r,n){return n?r<=n?e:e.slice(0,n-r):e}(n,a,e.maxFileCount);o&&o.forEach((function(r){!function(r){var n;e.maxFileSize&&r.size>e.maxFileSize?(n=r.name,d((function(r){return re(re([],r,!0),["Failed to upload ".concat(n,". You cannot upload files larger than ").concat(e.maxFileSize&&ne(e.maxFileSize),".")],!1)}))):function(r){var n=new FormData,t=new AbortController,a=function(e){var r,n,t=e.name,a=y.current[t];if(a){var i=a+1,o=t.lastIndexOf("."),l=t.substring(0,o),s=t.substring(o);t="".concat(l,"(").concat(a,")").concat(s),y.current=ee(ee({},y.current),((r={})[e.name]=i,r))}else y.current=ee(ee({},y.current),((n={})[e.name]=1,n));return t}(r),o=new File([r],a,{type:r.type});if(e.getUploadData||v){var l=e.getUploadData?e.getUploadData(a):{},s=ee(ee({},l),v);Object.keys(s).forEach((function(e){var r=s[e];n.append(e,"object"==typeof r?JSON.stringify(r):r)}))}n.append("file",o);var c=(0,b.v4)(),u={name:a,loadingProgress:0,abortController:t,id:c};function d(e){var r,n;e.total&&(r=e.loaded/e.total*100,n=u.id,i((function(e){var t=e.map((function(e){return e.id===n?ee(ee({},e),{loadingProgress:r}):e}));return t})))}i((function(e){return re(re([],e,!0),[u],!1)})),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function o(){return F.then((function(l){return h().post(m,n,ee(ee({},l),{onUploadProgress:d,signal:t.signal})).then((function(r){var t,a,o=n.get("file");r.data.url&&o instanceof File&&o.name&&e.onFileUpdate("update",o.name,r.data.url),r.data.fileId&&(t=r.data,a=u.id,i((function(e){var r=e.findIndex((function(e){return e.id===a}));if(-1!==r){var n=re([],e,!0);return n[r]=ee(ee({},n[r]),{id:t.fileId}),n}return e})))})).catch((function(t){var l,s,d=n.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var m,p,f,v;409===(null===(l=t.response)||void 0===l?void 0:l.status)&&e.listFiles?(m=a.lastIndexOf("."),p=a.substring(0,m),f=a.substring(m),v=new RegExp("^".concat(p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(f,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var r=0,n=0,t=e;n<t.length;n++){var a=t[n];if(v.test(a.name)){var i=a.name.match(v),o=i&&i[1]?parseInt(i[1].slice(1,-1),10):0;r=Math.max(r,o)}}return"".concat(p,"(").concat(r+1,")").concat(f)})):Promise.resolve(a)).then((function(t){e.onFileUpdate("add",t);var a=new File([r],t,{type:r.type});n.set("file",a),i((function(e){return e.map((function(e){return e.id===c?ee(ee({},e),{name:t,loadingProgress:0}):e}))})),o()})).catch((function(){var e;N(r.name,u.id,null===(e=t.response)||void 0===e?void 0:e.data)})):N(r.name,u.id,null===(s=t.response)||void 0===s?void 0:s.data)}))}))}()}(r)}(r)})),r.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&k(P,e.errorMessagesContainer),t.length>0&&k(C,e.filePreviewsContainer)]})};return t})()));
@@ -1 +1 @@
1
- {"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/uploader/uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAgBvB,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,gBAAgB,CAAA;AAWjE,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,EAAE,EACb,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,EAAE,GAAG,SAAS,CAUpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAobrC;AACD,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/uploader/uploader.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAgBvB,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,gBAAgB,CAAA;AAWjE,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,EAAE,EACb,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,EAAE,GAAG,SAAS,CAUpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAicrC;AACD,eAAe,QAAQ,CAAA"}
@@ -47,6 +47,62 @@
47
47
  align-self: start;
48
48
  }
49
49
 
50
+ .rustic-suggestion-menu ul {
51
+ padding: 0;
52
+ max-height: 220px;
53
+ min-width: 220px;
54
+ overflow-y: auto;
55
+ }
56
+
57
+ body {
58
+ margin: 0;
59
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
60
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
61
+ sans-serif;
62
+ -webkit-font-smoothing: antialiased;
63
+ -moz-osx-font-smoothing: grayscale;
64
+ }
65
+
66
+ code {
67
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
68
+ monospace;
69
+ }
70
+
71
+ .rustic-fit-container {
72
+ object-fit: contain;
73
+ width: 100%;
74
+ height: 100%;
75
+ }
76
+
77
+ .rustic-files {
78
+ display: flex;
79
+ gap: 8px;
80
+ flex-wrap: wrap;
81
+ }
82
+
83
+ .rustic-cursor-pointer {
84
+ cursor: pointer;
85
+ }
86
+
87
+ .rustic-align-self-center {
88
+ align-self: center;
89
+ }
90
+
91
+ .rustic-shift-to-right-by-8 {
92
+ margin-right: -8px;
93
+ }
94
+
95
+ .rustic-participant-profile {
96
+ display: flex;
97
+ gap: 8px;
98
+ align-items: center;
99
+ }
100
+
101
+ .rustic-participant-profile .rustic-participant-avatar {
102
+ width: 16px;
103
+ height: 16px;
104
+ }
105
+
50
106
  span.rustic-icon-large {
51
107
  font-size: 32px;
52
108
  }
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e,r,t={8342:e=>{e.exports=require("emoji-picker-element")}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var i=Object.create(null);o.r(i);var a={};e=e||[null,r({}),r([]),r(r)];for(var c=2&n&&t;"object"==typeof c&&!~e.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>t[e]));return a.default=()=>t,o.d(i,a),i},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{default:()=>L});const a=require("react/jsx-runtime"),c=require("react"),s=require("@mui/material/Box");var u=o.n(s);const l=require("@mui/material/CircularProgress");var d=o.n(l);const p=require("@mui/material/IconButton");var m=o.n(p);const f=require("@mui/material/InputAdornment");var h=o.n(f);const v=require("@mui/material/MenuItem");var g=o.n(v);const y=require("@mui/material/MenuList");var b=o.n(y);const j=require("@mui/material/Popover");var x=o.n(j);const O=require("@mui/material/TextField");var S=o.n(O);const w=require("@mui/material/Tooltip");var k=o.n(w);const E=require("@mui/material/Typography");var C=o.n(E),P=o(8342);const N=require("uuid");var T;function _(e,r){var t=[];if(e&&(null==e?void 0:e.trim().length)&&t.push({type:"text",text:e}),r&&r.length>0)for(var n=0;n<(null==r?void 0:r.length);n++)t.push({type:"file_url",file_url:{url:r[n].url,name:r[n].name}});return{messages:[{content:t,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(T||(T={}));var q=function(){return q=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},q.apply(this,arguments)};function R(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:q({},r),children:e.name})}const M=require("@mui/material/styles"),z=function(e){var r=(0,M.useTheme)(),t=(0,c.useRef)(null),n=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":r.palette.divider,"--background":r.palette.background.paper,"--input-border-color":r.palette.divider,"--outline-color":r.palette.secondary.main};function d(){u(!1)}function p(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),d()}return(0,c.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(t){var o=new(0,t.Picker)({dataSource:e.dataSource}),i="dark"===r.palette.mode?"dark":"light";o.classList.add(i),Object.keys(l).forEach((function(e){o.style.setProperty(e,l[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,c.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",p),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(k(),{title:"Emoji",children:(0,a.jsx)(m(),{size:"small",ref:t,onClick:function(){u((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(R,{name:"Mood"})})}),n.current&&(0,a.jsx)(x(),{open:s,anchorEl:t.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var D={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function I(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}var A=(0,c.forwardRef)((function(e,r){var t=(0,c.useState)(""),n=t[0],o=t[1],i=(0,c.useState)(!1),s=i[0],l=i[1],p=(0,c.useState)(!1),f=p[0],v=p[1],y=(0,c.useState)(!1),j=y[0],O=y[1],w=(0,c.useState)(""),E=w[0],T=w[1],q=(0,c.useState)([]),M=q[0],A=q[1],B=(0,c.useState)(!1),F=B[0],L=B[1],H=(0,c.useRef)(null),W=new P.Database({dataSource:e.emojiDataSource}),K=!n.trim().length&&!e.isSendEnabled,U="".concat(s?"Stop":"Start"," speech to text"),$=f?"primary.main":"primary.light",Q=s?"error.main":$,G=s?"stop_circle":"speech_to_text";function J(e,r){if(void 0===r&&(r=!1),H.current){var t=H.current,i=t.selectionStart,a=t.selectionEnd;if("number"==typeof i&&"number"==typeof a){var c,s=n||"",u=s.substring(0,i),l=s.substring(a);c=r?u.replace(/:(\w+)$/,e)+l:u+e+l,o(c);var d=r?u.replace(/:(\w+)$/,e).length:i+e.length;setTimeout((function(){var e,r;null===(e=H.current)||void 0===e||e.focus(),null===(r=H.current)||void 0===r||r.setSelectionRange(d,d)}),0)}}L(!1)}var V=j?(0,a.jsx)(d(),{size:24}):(0,a.jsx)(k(),{title:U,children:(0,a.jsx)(m(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,s?(e.stop(),O(!0),l(!1)):(e.start(),T(""),l(!0)),e.onstart=function(){l(!0)},e.onresult=function(e){var r,t=e.results[0][0].transcript;n.length>0?o(n+" "+t):o(t),null===(r=H.current)||void 0===r||r.focus(),l(!1)},e.onerror=function(e){var r=D[e.error];T(r),l(!1)},e.onend=function(){O(!1),l(!1)}},size:"small",sx:{color:Q,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(R,{name:G})})});function X(){var r=(new Date).toISOString(),t={id:(0,N.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:_(n)};e.send(t),o(""),T("")}return(0,a.jsxs)(u(),{className:"rustic-base-input",ref:r,children:[(0,a.jsxs)(u(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(u(),{className:"rustic-error-container",children:(0,a.jsx)(C(),{variant:"caption",color:"error",className:"rustic-error-message",children:E})}),(0,a.jsxs)(u(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:f?"secondary.main":"action.disabled"},children:[M.length>0&&(0,a.jsx)(x(),{open:F,anchorEl:H.current,onClose:function(){return L(!1)},disableAutoFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},children:(0,a.jsx)(b(),{children:M.map((function(e,r){return"unicode"in e&&(0,a.jsx)(g(),{onClick:function(){return J(e.unicode,!0)},children:I(e)},r)}))})}),(0,a.jsx)(S(),{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){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),K||X())},onChange:function(r){T("");var t=r.target.value;o(t);var n,i=t.match(/:(\w{2,}):/g),a=t.match(/:(\w{2,})/g);if(i){var c=i[0].replace(/:/g,"");W.getEmojiByShortcode(c).then((function(e){if(e&&"unicode"in e){var r=t.replace(i[0],e.unicode);o(r)}else o(t)})).catch((function(){o(t)})),L(!1)}else a?(n=a[0].replace(":",""),W.getEmojiBySearchQuery(n).then((function(r){r.length?(A(r.slice(0,e.maximumEmojiSearchResults)),L(!0)):(A([]),L(!1))})).catch((function(){A([]),L(!1)}))):L(!1)},onFocus:function(){return v(!0)},onBlur:function(){return v(!1)},inputRef:H,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,a.jsxs)(h(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(z,{dataSource:e.emojiDataSource,onEmojiClick:J,buttonColor:$}),e.enableSpeechToText&&V]})},inputLabel:{className:f?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(u(),{className:"rustic-input-actions",children:[e.children,(0,a.jsx)(k(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(m(),{"aria-label":"send message",onClick:X,disabled:K,color:"secondary",children:(0,a.jsx)(R,{name:"send"})})})})]})]})}));A.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const B=A;var F=function(){return F=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},F.apply(this,arguments)};const L=function(e){var r=e.ws,t=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}(e,["ws"]);return(0,a.jsx)(B,F({},t,{send:function(e){r.send(e)}}))};return i})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e,r,t={8342:e=>{e.exports=require("emoji-picker-element")}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var i=Object.create(null);o.r(i);var a={};e=e||[null,r({}),r([]),r(r)];for(var c=2&n&&t;"object"==typeof c&&!~e.indexOf(c);c=r(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>t[e]));return a.default=()=>t,o.d(i,a),i},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{ParticipantRole:()=>K,ParticipantType:()=>U,default:()=>Q});const a=require("react/jsx-runtime"),c=require("react"),s=require("@mui/material/Avatar");var u=o.n(s);const l=require("@mui/material/Box");var d=o.n(l);const m=require("@mui/material/CircularProgress");var p=o.n(m);const f=require("@mui/material/IconButton");var h=o.n(f);const v=require("@mui/material/InputAdornment");var g=o.n(v);const y=require("@mui/material/MenuItem");var b=o.n(y);const j=require("@mui/material/MenuList");var x=o.n(j);const w=require("@mui/material/Popover");var S=o.n(w);const O=require("@mui/material/TextField");var k=o.n(O);const C=require("@mui/material/Tooltip");var E=o.n(C);const N=require("@mui/material/Typography");var P=o.n(N),T=o(8342);const q=require("uuid");var _;function R(e,r){var t=[];if(e&&(null==e?void 0:e.trim().length)&&t.push({type:"text",text:e}),r&&r.length>0)for(var n=0;n<(null==r?void 0:r.length);n++)t.push({type:"file_url",file_url:{url:r[n].url,name:r[n].name}});return{messages:[{content:t,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(_||(_={}));var I=function(){return I=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},I.apply(this,arguments)};function M(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:I({},r),children:e.name})}const A=require("@mui/material/styles"),D=function(e){var r=(0,A.useTheme)(),t=(0,c.useRef)(null),n=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":r.palette.divider,"--background":r.palette.background.paper,"--input-border-color":r.palette.divider,"--outline-color":r.palette.secondary.main};function d(){u(!1)}function m(r){r.detail.unicode&&e.onEmojiClick(r.detail.unicode),d()}return(0,c.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(t){var o=new(0,t.Picker)({dataSource:e.dataSource}),i="dark"===r.palette.mode?"dark":"light";o.classList.add(i),Object.keys(l).forEach((function(e){o.style.setProperty(e,l[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,c.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",m),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",m)}}),[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(E(),{title:"Emoji",children:(0,a.jsx)(h(),{size:"small",ref:t,onClick:function(){u((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:"Mood"})})}),n.current&&(0,a.jsx)(S(),{open:s,anchorEl:t.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var z={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function L(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function B(e){return(0,a.jsxs)(d(),{className:"rustic-participant-profile",children:[(0,a.jsx)(u(),{src:e.icon,className:"rustic-participant-avatar"}),(0,a.jsx)(P(),{variant:"body1Bold",children:e.displayName})]})}function F(e){var r=e.items,t=e.isOpen,n=e.onClose,o=e.onSelect,i=e.renderItem,c=e.anchorEl,s=e.selectedIndex;return(0,a.jsx)(S(),{disableAutoFocus:!0,open:t&&r.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,a.jsx)(x(),{children:r.map((function(e,r){return(0,a.jsx)(b(),{onClick:function(){return o(e)},selected:r===s,children:i(e)},r)}))})})}var H=(0,c.forwardRef)((function(e,r){var t=(0,c.useState)(""),n=t[0],o=t[1],i=(0,c.useState)(!1),s=i[0],u=i[1],l=(0,c.useState)(!1),m=l[0],f=l[1],v=(0,c.useState)(!1),y=v[0],b=v[1],j=(0,c.useState)(""),x=j[0],w=j[1],S=(0,c.useState)([]),O=S[0],C=S[1],N=(0,c.useState)(!1),_=N[0],I=N[1],A=(0,c.useState)(0),H=A[0],W=A[1],K=(0,c.useRef)(null),U=new T.Database({dataSource:e.emojiDataSource}),$=!n.trim().length&&!e.isSendEnabled,Q="".concat(s?"Stop":"Start"," speech to text"),G=m?"primary.main":"primary.light",J=s?"error.main":G,V=s?"stop_circle":"speech_to_text",X=(0,c.useState)([]),Y=X[0],Z=X[1],ee=(0,c.useState)(!1),re=ee[0],te=ee[1];function ne(e,r){if(K.current){var t=K.current,i=t.selectionStart,a=t.selectionEnd;if("number"==typeof i&&"number"==typeof a){var c,s=n||"",u=s.substring(0,i),l=s.substring(a),d=void 0;r?(d=u.replace(r,e)+l,c=u.replace(r,e).length):(d=u+e+l,c=i+e.length),o(d),setTimeout((function(){var e,r;null===(e=K.current)||void 0===e||e.focus(),null===(r=K.current)||void 0===r||r.setSelectionRange(c,c)}),0)}}}function oe(e){ne("@".concat(e," "),/@(\w*)$/),Z([])}function ie(e,r){void 0===r&&(r=!1),ne(e,r?/:(\w+)$/:void 0),I(!1)}var ae=y?(0,a.jsx)(p(),{size:24}):(0,a.jsx)(E(),{title:Q,children:(0,a.jsx)(h(),{onClick:function(){var e=new window.webkitSpeechRecognition,r=navigator.language;e.lang=r,s?(e.stop(),b(!0),u(!1)):(e.start(),w(""),u(!0)),e.onstart=function(){u(!0)},e.onresult=function(e){var r,t=e.results[0][0].transcript;n.length>0?o(n+" "+t):o(t),null===(r=K.current)||void 0===r||r.focus(),u(!1)},e.onerror=function(e){var r=z[e.error];w(r),u(!1)},e.onend=function(){b(!1),u(!1)}},size:"small",sx:{color:J,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:V})})});function ce(){var r=(new Date).toISOString(),t={id:(0,q.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:R(n)};e.send(t),o(""),w("")}return(0,a.jsxs)(d(),{className:"rustic-base-input",ref:r,children:[(0,a.jsxs)(d(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(d(),{className:"rustic-error-container",children:(0,a.jsx)(P(),{variant:"caption",color:"error",className:"rustic-error-message",children:x})}),(0,a.jsxs)(d(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:m?"secondary.main":"action.disabled"},children:[O.length>0&&K.current&&(0,a.jsx)(F,{anchorEl:K.current,items:O.filter((function(e){return"unicode"in e})),isOpen:_,onClose:function(){I(!1),W(0)},onSelect:function(e){return ie(e.unicode,!0)},selectedIndex:H,renderItem:L}),Y.length>0&&K.current&&(0,a.jsx)(F,{anchorEl:K.current,items:Y,isOpen:re,onClose:function(){te(!1),W(0)},onSelect:function(e){return oe(e.displayName)},renderItem:B,selectedIndex:H}),(0,a.jsx)(k(),{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 r,t="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),_&&O.length>0&&"unicode"in O[H]?ie(O[H].unicode,!0):re&&Y.length>0?oe(Y[H].displayName):e.shiftKey||$||ce();else{if(t||n)return e.preventDefault(),r=t?1:-1,void(_?W((function(e){return(e+r+O.length)%O.length})):re&&W((function(e){return(e+r+Y.length)%Y.length})));0!==H&&W(0)}},onChange:function(r){w("");var t=r.target.value;o(t),function(r){var t=r.match(/@(\w*)$/);if(t&&e.getMembers){var n=t[1].toLowerCase();e.getMembers().then((function(e){var r=e.filter((function(e){return e.displayName.toLowerCase().startsWith(n)}));Z(r),r.length>0?te(!0):te(!1)}))}else Z([])}(t);var n,i=t.match(/:(\w{2,}):/g),a=t.match(/:(\w{2,})/g);if(i){var c=i[0].replace(/:/g,"");U.getEmojiByShortcode(c).then((function(e){if(e&&"unicode"in e){var r=t.replace(i[0],e.unicode);o(r)}else o(t)})).catch((function(){o(t)})),I(!1)}else a?(n=a[0].replace(":",""),U.getEmojiBySearchQuery(n).then((function(r){r.length?(C(r.slice(0,e.maximumEmojiSearchResults)),I(!0)):(C([]),I(!1))})).catch((function(){C([]),I(!1)}))):I(!1)},onFocus:function(){return f(!0)},onBlur:function(){return f(!1)},inputRef:K,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,a.jsxs)(g(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(D,{dataSource:e.emojiDataSource,onEmojiClick:ie,buttonColor:G}),e.enableSpeechToText&&ae]})},inputLabel:{className:m?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(d(),{className:"rustic-input-actions",children:[e.children,(0,a.jsx)(E(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(h(),{"aria-label":"send message",onClick:ce,disabled:$,color:"secondary",children:(0,a.jsx)(M,{name:"send"})})})})]})]})}));H.defaultProps={multiline:!0,fullWidth:!0,maxRows:6,enableSpeechToText:!1,maximumEmojiSearchResults:5};const W=H;var K,U,$=function(){return $=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},$.apply(this,arguments)};!function(e){e.Owner="owner",e.Member="member"}(K||(K={})),function(e){e.Human="human",e.Agent="agent"}(U||(U={}));const Q=function(e){var r=e.ws,t=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}(e,["ws"]);return(0,a.jsx)(W,$({},t,{send:function(e){r.send(e)}}))};return i})()));
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{default:()=>h});const t=require("react/jsx-runtime"),n=(require("ol/ol.css"),require("@mui/material/Alert"));var o=e.n(n);const a=require("@mui/material/Box");var i=e.n(a);const l=require("ol/layer/Tile.js");var s=e.n(l);const u=require("ol/Map.js");var c=e.n(u);const d=require("ol/Overlay.js");var f=e.n(d);const m=require("ol/proj.js"),p=require("ol/source/OSM.js");var v=e.n(p);const y=require("ol/View.js");var j=e.n(y);const g=require("react");var b=function(){return b=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},b.apply(this,arguments)};function x(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:b({},r),children:e.name})}const h=function(e){var r=(0,g.useState)(""),n=r[0],a=r[1],l=(0,g.useRef)(null),u=(0,g.useRef)(null);return(0,g.useEffect)((function(){if(a(""),e.latitude<-90||e.latitude>90||e.longitude<-180||e.longitude>180)return a("Invalid coordinates");if(l.current&&u.current){var r=new(c())({layers:[new(s())({source:new(v())})],view:new(j())({center:(0,m.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:l.current}),t=new(f())({element:u.current,position:(0,m.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return r.addOverlay(t),r.once("postrender",(function(){var e;if(!(null===(e=l.current)||void 0===e?void 0:e.querySelector("canvas")))return a("An error occurred while loading the map")})),function(){r.setTarget(""),r.removeOverlay(t)}}}),[]),(0,t.jsx)(t.Fragment,{children:n.length>0?(0,t.jsx)(o(),{severity:"error",children:n}):(0,t.jsxs)(i(),{children:[(0,t.jsx)(i(),{ref:u,children:(0,t.jsx)(x,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,t.jsx)("div",{ref:l,className:"rustic-open-layers-map-canvas"})]})})};return r})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,(()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{ParticipantRole:()=>b,ParticipantType:()=>h,default:()=>q});const t=require("react/jsx-runtime"),n=(require("ol/ol.css"),require("@mui/material/Alert"));var o=e.n(n);const a=require("@mui/material/Box");var i=e.n(a);const l=require("ol/layer/Tile.js");var u=e.n(l);const c=require("ol/Map.js");var s=e.n(c);const d=require("ol/Overlay.js");var m=e.n(d);const f=require("ol/proj.js"),p=require("ol/source/OSM.js");var v=e.n(p);const y=require("ol/View.js");var j=e.n(y);const g=require("react");var b,h,x=function(){return x=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},x.apply(this,arguments)};function O(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:x({},r),children:e.name})}!function(e){e.Owner="owner",e.Member="member"}(b||(b={})),function(e){e.Human="human",e.Agent="agent"}(h||(h={}));const q=function(e){var r=(0,g.useState)(""),n=r[0],a=r[1],l=(0,g.useRef)(null),c=(0,g.useRef)(null);return(0,g.useEffect)((function(){if(a(""),e.latitude<-90||e.latitude>90||e.longitude<-180||e.longitude>180)return a("Invalid coordinates");if(l.current&&c.current){var r=new(s())({layers:[new(u())({source:new(v())})],view:new(j())({center:(0,f.fromLonLat)([e.longitude,e.latitude]),zoom:12}),target:l.current}),t=new(m())({element:c.current,position:(0,f.fromLonLat)([e.longitude,e.latitude]),positioning:"bottom-center",stopEvent:!1});return r.addOverlay(t),r.once("postrender",(function(){var e;if(!(null===(e=l.current)||void 0===e?void 0:e.querySelector("canvas")))return a("An error occurred while loading the map")})),function(){r.setTarget(""),r.removeOverlay(t)}}}),[]),(0,t.jsx)(t.Fragment,{children:n.length>0?(0,t.jsx)(o(),{severity:"error",children:n}):(0,t.jsxs)(i(),{children:[(0,t.jsx)(i(),{ref:c,children:(0,t.jsx)(O,{className:"rustic-open-layers-map-marker",name:"location_on"})}),(0,t.jsx)("div",{ref:l,className:"rustic-open-layers-map-canvas"})]})})};return r})()));
@@ -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={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MarkedMarkdown:()=>c,MarkedStreamingMarkdown:()=>p,default:()=>m});const r=require("react/jsx-runtime"),a=require("@mui/material/Typography");var n=e.n(a);const o=require("dompurify");var u=e.n(o);const d=require("marked"),i=require("react");function s(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=d.marked.parse(t);return u().sanitize(r)}const c=function(e){var t=(0,i.useState)(s(e.text)),a=t[0],o=t[1];return(0,i.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;o(s(t))}}),[e.text,e.updatedData]),(0,r.jsx)(n(),{variant:"body2",dangerouslySetInnerHTML:{__html:a}})},f=require("@mui/material/Alert");var l=e.n(f);const p=function(e){var t=(0,i.useState)(s(e.text)),a=t[0],o=t[1],u=(0,i.useState)(""),d=u[0],c=u[1];return(0,i.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,a=e.updatedData;r<a.length;r++){var n=a[r];"string"!=typeof n.text?(t+=" [MISSING TEXT]",c("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=n.text}o(s(t))}}),[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n(),{variant:"body2",dangerouslySetInnerHTML:{__html:a}}),d&&(0,r.jsx)(l(),{severity:"error",children:d})]})},m=c;return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MarkedMarkdown:()=>s,MarkedStreamingMarkdown:()=>l,ParticipantRole:()=>m,ParticipantType:()=>y,default:()=>g});const r=require("react/jsx-runtime"),a=require("@mui/material/Typography");var n=e.n(a);const o=require("dompurify");var u=e.n(o);const i=require("marked"),d=require("react");function c(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=i.marked.parse(t);return u().sanitize(r)}const s=function(e){var t=(0,d.useState)(c(e.text)),a=t[0],o=t[1];return(0,d.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;o(c(t))}}),[e.text,e.updatedData]),(0,r.jsx)(n(),{variant:"body2",dangerouslySetInnerHTML:{__html:a}})},f=require("@mui/material/Alert");var p=e.n(f);const l=function(e){var t=(0,d.useState)(c(e.text)),a=t[0],o=t[1],u=(0,d.useState)(""),i=u[0],s=u[1];return(0,d.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){for(var t=e.text,r=0,a=e.updatedData;r<a.length;r++){var n=a[r];"string"!=typeof n.text?(t+=" [MISSING TEXT]",s("Some of the incoming text was not correctly formatted. Some data may be missing.")):t+=n.text}o(c(t))}}),[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n(),{variant:"body2",dangerouslySetInnerHTML:{__html:a}}),i&&(0,r.jsx)(p(),{severity:"error",children:i})]})};var m,y;!function(e){e.Owner="owner",e.Member="member"}(m||(m={})),function(e){e.Human="human",e.Agent="agent"}(y||(y={}));const g=s;return t})()));