@rustic-ai/ui-components 0.0.36 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/components/filePreview/filePreview.d.ts +1 -12
  2. package/dist/components/filePreview/filePreview.d.ts.map +1 -1
  3. package/dist/components/image/image.d.ts +1 -7
  4. package/dist/components/image/image.d.ts.map +1 -1
  5. package/dist/components/image/index.js +1 -1
  6. package/dist/components/index.d.ts +1 -0
  7. package/dist/components/index.d.ts.map +1 -1
  8. package/dist/components/input/baseInput/baseInput.d.ts.map +1 -1
  9. package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
  10. package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts +1 -11
  11. package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
  12. package/dist/components/input/multimodal/uploader/index.js +1 -1
  13. package/dist/components/input/textInput/index.js +1 -1
  14. package/dist/components/markdown/index.js +1 -1
  15. package/dist/components/media/audio/index.js +1 -1
  16. package/dist/components/media/timeIndicator/timeIndicator.d.ts +2 -7
  17. package/dist/components/media/timeIndicator/timeIndicator.d.ts.map +1 -1
  18. package/dist/components/media/video/index.js +1 -1
  19. package/dist/components/messageSpace/index.js +1 -1
  20. package/dist/components/messageSpace/messageSpace.d.ts +1 -7
  21. package/dist/components/messageSpace/messageSpace.d.ts.map +1 -1
  22. package/dist/components/multipart/chatCompletion/index.js +1 -1
  23. package/dist/components/multipart/multipart/index.js +1 -1
  24. package/dist/components/prompts/index.js +1 -1
  25. package/dist/components/prompts/prompts.d.ts.map +1 -1
  26. package/dist/components/question/index.js +1 -1
  27. package/dist/components/question/question.d.ts.map +1 -1
  28. package/dist/components/video/index.js +1 -1
  29. package/dist/components/video/youtubeVideo.d.ts +1 -7
  30. package/dist/components/video/youtubeVideo.d.ts.map +1 -1
  31. package/dist/components/visualization/chart/index.js +1 -1
  32. package/dist/components/visualization/chart/rechartsTimeSeries.d.ts +1 -10
  33. package/dist/components/visualization/chart/rechartsTimeSeries.d.ts.map +1 -1
  34. package/dist/components/visualization/vegaLiteViz/index.js +1 -1
  35. package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts +1 -8
  36. package/dist/components/visualization/vegaLiteViz/vegaLiteViz.d.ts.map +1 -1
  37. package/dist/index.js +1 -1
  38. package/package.json +39 -34
@@ -1 +1 @@
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:n=>{var r=n&&n.__esModule?()=>n.default:()=>n;return e.d(r,{a:r}),r},d:(n,r)=>{for(var t in r)e.o(r,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:r[t]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{ParticipantRole:()=>H,ParticipantType:()=>V,default:()=>D});const r=require("react/jsx-runtime"),t=require("@mui/material"),i=require("@mui/material/Alert");var a=e.n(i);const o=require("@mui/material/CircularProgress");var c=e.n(o);const l=require("@mui/material/Typography");var s=e.n(l);const u=require("@mui/system"),m=require("react"),d=require("@mui/material/Box");var f=e.n(d);const p=require("@mui/material/Button");var v=e.n(p);const x=require("@mui/material/LinearProgress");var y=e.n(x);const E=require("@mui/material/Slider");var b=e.n(E);const j=require("@mui/material/Tooltip");var h,g=e.n(j);function N(e){var n=Math.floor(e/3600),r=Math.floor(e%3600/60),t=Math.floor(e%60),i=n>0?"".concat(n,":"):"",a="".concat(n>0?r.toString().padStart(2,"0"):r),o=t.toString().padStart(2,"0");return"".concat(i).concat(a,":").concat(o)}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(h||(h={}));var S=function(){return S=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var i in n=arguments[r])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},S.apply(this,arguments)};function T(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:S({},n),children:e.name})}const k=require("@mui/material/IconButton");var P=e.n(k);function _(e){var n,t={play:{symbol:"play_circle",label:"Play"},pause:{symbol:"pause_circle",label:"Pause"},forward:{symbol:"forward_10",label:"Forward ten seconds"},replay:{symbol:"replay_10",label:"Replay ten seconds"},volumeUp:{symbol:"volume_up",label:"Mute"},volumeOff:{symbol:"volume_off",label:"Unmute"},miniPlayer:{symbol:"picture_in_picture",label:"Mini player"},miniPlayerExit:{symbol:"picture_in_picture_off",label:"Exit mini player"},fullscreen:{symbol:"fullscreen",label:"Fullscreen"},fullscreenExit:{symbol:"fullscreen_exit",label:"Exit fullscreen"},captionsOn:{symbol:"closed_caption",label:"Show captions"},captionsOff:{symbol:"closed_caption_disabled",label:"Hide captions"}};return t[e.action].label.replaceAll(" ","-").toLowerCase(),(0,r.jsx)(g(),{title:t[e.action].label,PopperProps:{container:null!==(n=document.fullscreenElement)&&void 0!==n?n:document.body},children:(0,r.jsx)(P(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,r.jsx)(T,{name:t[e.action].symbol,className:"rustic-icon-large"})})})}function w(e){var n="dark"===(0,t.useTheme)().palette.mode,i=N(e.mediaElement.currentTime);return(0,r.jsxs)(f(),{className:"rustic-progress",children:[function(){for(var t=e.mediaElement.buffered,i=0,a=t.length-1;a>=0;--a){var o=t.start(a),c=t.end(a);if(o<e.mediaElement.currentTime){i=c;break}}var l=i/e.mediaElement.duration*100;return(0,r.jsx)(y(),{className:"rustic-progress-buffered",variant:"determinate",value:l,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:n?"secondary.light":"action.selected"}}})}(),(0,r.jsx)(b(),{className:"rustic-progress-slider",size:"small","aria-label":"Time","aria-valuetext":"Current time: ".concat(i),max:e.mediaElement.duration,value:e.mediaElement.currentTime,onChange:function(n,r){e.mediaElement.currentTime=r},valueLabelDisplay:"auto",valueLabelFormat:function(e){return N(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function C(e){var n=(0,m.useState)(e.mediaElement.volume),t=n[0],i=n[1],a=(0,m.useState)(e.mediaElement.volume),o=a[0],c=a[1],l=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,r.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,r.jsx)(_,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(c(e.mediaElement.volume),i(0)):i(o)},className:"rustic-mute-button",action:l}),(0,r.jsx)(b(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(100*t,"%"),value:t,onChange:function(n,r){var t=r;e.mediaElement.muted=0===t,e.mediaElement.volume=t,i(e.mediaElement.volume)}})]})}function O(e){var n=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",t="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,r.jsx)(v(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,r.jsx)(T,{name:n}),children:(0,r.jsx)(s(),{variant:"overline",children:t})})}function B(e){var n=(0,m.useState)(!e.mediaElement.paused),t=n[0],i=n[1],a=t?"pause":"play";return e.mediaElement.onended=function(){i(!1)},e.mediaElement.onpause=function(){i(!1)},e.mediaElement.onplay=function(){i(!0)},(0,r.jsx)(_,{onClick:function(){t?e.mediaElement.pause():e.mediaElement.play().catch((function(n){e.onError("Failed to play the media. Error: ".concat(n.message))}))},action:a,className:"rustic-pause-play-icon"})}function q(e){var n,t=(0,m.useState)(e.mediaElement.playbackRate),i=t[0],a=t[1];return(0,r.jsx)(g(),{title:"Playback rate",PopperProps:{container:null!==(n=document.fullscreenElement)&&void 0!==n?n:document.body},children:(0,r.jsx)(v(),{onClick:function(){var n=1;e.mediaElement.playbackRate<2&&(n=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=n,a(n)},className:"rustic-playback-rate-button",children:(0,r.jsxs)(s(),{variant:"body1",children:[i,"X"]})})})}function F(e){var n="replay"===e.movement,t=n?function(){e.mediaElement.currentTime-=10}:function(){e.mediaElement.currentTime+=10},i=n?"replay":"forward";return(0,r.jsx)(_,{onClick:t,action:i})}function I(e){var n=(0,m.useState)(!!document.pictureInPictureElement),t=n[0],i=n[1],a=e.mediaElement,o=t?"miniPlayerExit":"miniPlayer";return a.onleavepictureinpicture=function(){i(!1)},(0,r.jsx)(_,{onClick:function(){t?document.exitPictureInPicture().then((function(){i(!1)})).catch((function(n){e.onError("Failed to exit mini player. Error: ".concat(n.message))})):a.requestPictureInPicture().then((function(){i(!0)})).catch((function(n){e.onError("Failed to enter mini player. Error: ".concat(n.message))}))},action:o})}function M(e){var n=(0,m.useState)(!!document.fullscreenElement),t=n[0],i=n[1],a=e.element,o=t?"fullscreenExit":"fullscreen";return a.onfullscreenchange=function(){i(!!document.fullscreenElement)},(0,r.jsx)(_,{onClick:function(){t?document.exitFullscreen().then((function(){i(!1)})).catch((function(n){e.onError("Failed to exit fullscreen mode. Error: ".concat(n.message))})):a.requestFullscreen().then((function(){i(!0)})).catch((function(n){e.onError("Failed to enter fullscreen mode. Error: ".concat(n.message))}))},action:o})}function L(e){var n=N(e.elapsedTimeInSeconds),t=N(e.durationTimeInSeconds),i="".concat(n," / ").concat(t);return"wide"===e.style?(0,r.jsxs)(f(),{className:"rustic-time-container",children:[(0,r.jsx)(s(),{variant:"overline",children:n}),(0,r.jsx)(s(),{variant:"overline",children:t})]}):(0,r.jsx)(s(),{variant:"overline",className:"rustic-time-display",children:i})}L.defaultProps={style:"condensed"};const R=require("@mui/material/Divider");var H,V,A=e.n(R);function U(e){var n=!!document.fullscreenElement;return(0,r.jsxs)(u.Box,{className:"rustic-transcript-container",children:[!n&&(0,r.jsx)(A(),{orientation:"vertical",flexItem:!0}),(0,r.jsx)(s(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}!function(e){e.Owner="owner",e.Member="member"}(H||(H={})),function(e){e.Human="human",e.Agent="agent"}(V||(V={}));const D=function(e){var n=(0,m.useState)(!1),i=n[0],o=n[1],l=(0,m.useState)(!1),d=l[0],f=l[1],p=(0,m.useState)(!0),v=p[0],x=p[1],y=(0,m.useState)(!!document.fullscreenElement),E=y[0],b=y[1],j=(0,m.useState)(!1),h=j[0],g=j[1],N=(0,m.useState)(""),S=N[0],T=N[1],k=(0,m.useState)(""),P=k[0],R=k[1],H=(0,m.useState)(0),V=H[0],A=H[1],D=(0,m.useRef)(null),z=(0,m.useRef)(null),Q=(0,t.useTheme)(),X=(0,t.useMediaQuery)(Q.breakpoints.down("md"));(0,m.useEffect)((function(){var e,n,r,t,i,a,o,c;function l(e){R(e),x(!1)}function s(){clearTimeout(c),c=setTimeout((function(){return g(!1)}),3e3)}null===(e=z.current)||void 0===e||e.addEventListener("timeupdate",(function(){z.current&&A(z.current.currentTime)})),null===(n=z.current)||void 0===n||n.addEventListener("canplay",(function(){R(""),x(!1)})),null===(r=z.current)||void 0===r||r.addEventListener("error",(function(){return l("Failed to load the video.")})),null===(t=z.current)||void 0===t||t.addEventListener("stalled",(function(){return l("Failed to fetch video data, but trying.")})),document.addEventListener("fullscreenchange",(function(){b(!!document.fullscreenElement)})),null===(i=D.current)||void 0===i||i.addEventListener("mousemove",(function(){g(!0),s()})),null===(a=D.current)||void 0===a||a.addEventListener("mouseleave",(function(){g(!1)})),null===(o=D.current)||void 0===o||o.addEventListener("keydown",(function(){g(!0),s()}))}),[]);var G={backgroundColor:Q.palette.background.paper,opacity:h?1:0};function J(){if(e.transcript&&i)return(0,r.jsx)(U,{transcript:e.transcript})}function K(){if(e.captions&&e.captions.length>0){var n=d?"captionsOff":"captionsOn";return(0,r.jsx)(_,{action:n,onClick:function(){return f(!d)}})}}function W(){if(e.transcript)return(0,r.jsx)(O,{isTranscriptVisible:i,setIsTranscriptVisible:function(){return o(!i)}})}var Y=X?function(){return E?(0,r.jsx)(r.Fragment,{children:z.current&&D.current&&(0,r.jsxs)(u.Box,{className:"rustic-video-controls",sx:G,children:[(0,r.jsxs)(u.Box,{className:"rustic-video-top-controls",children:[(0,r.jsx)(B,{mediaElement:z.current,onError:T}),(0,r.jsx)(w,{mediaElement:z.current}),(0,r.jsx)(L,{elapsedTimeInSeconds:V,durationTimeInSeconds:z.current.duration})]}),(0,r.jsxs)(u.Box,{className:"rustic-video-bottom-controls",children:[(0,r.jsxs)(u.Box,{className:"rustic-time-controls",children:[(0,r.jsx)(F,{mediaElement:z.current,movement:"replay"}),(0,r.jsx)(F,{mediaElement:z.current,movement:"forward"}),K(),(0,r.jsx)(q,{mediaElement:z.current})]}),W()]}),J()]})}):(0,r.jsx)(r.Fragment,{children:z.current&&D.current&&(0,r.jsxs)(u.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,r.jsx)(B,{mediaElement:z.current,onError:T}),(0,r.jsxs)(u.Box,{className:"rustic-video-controls-right",children:[W(),(0,r.jsx)(M,{element:D.current,onError:T})]})]})})}:function(){return(0,r.jsx)(r.Fragment,{children:z.current&&D.current&&(0,r.jsxs)(u.Box,{className:"rustic-video-controls",sx:G,children:[(0,r.jsx)(w,{mediaElement:z.current}),(0,r.jsxs)(u.Box,{className:"rustic-video-bottom-controls",children:[(0,r.jsxs)(u.Box,{className:"rustic-video-bottom-controls-left",children:[(0,r.jsx)(B,{mediaElement:z.current,onError:T}),(0,r.jsx)(F,{mediaElement:z.current,movement:"replay"}),(0,r.jsx)(F,{mediaElement:z.current,movement:"forward"}),K(),(0,r.jsx)(q,{mediaElement:z.current}),(0,r.jsx)(C,{mediaElement:z.current}),(0,r.jsx)(L,{elapsedTimeInSeconds:V,durationTimeInSeconds:z.current.duration,style:"condensed"})]}),(0,r.jsxs)(u.Box,{className:"rustic-video-bottom-controls-right",children:[W(),(0,r.jsx)(I,{mediaElement:z.current,onError:T}),(0,r.jsx)(M,{element:D.current,onError:T})]})]}),E&&J()]})})};return P.length>0?(0,r.jsx)(a(),{severity:"error",children:P}):(0,r.jsxs)(u.Box,{className:"rustic-video",children:[v&&(0,r.jsx)(c(),{className:"rustic-video-loading-spinner"}),(0,r.jsxs)(u.Box,{ref:D,className:"rustic-video-screen",sx:{visibility:v?"hidden":"visible"},children:[S.length>0&&(0,r.jsx)(a(),{severity:"error",className:"rustic-control-error",onClose:function(){return T("")},children:S}),(!X||E)&&function(){if(z.current&&D.current)return(0,r.jsxs)(u.Box,{className:"rustic-video-title",sx:G,children:[(0,r.jsx)(s(),{variant:"body2",children:e.title}),E&&X&&(0,r.jsxs)(u.Box,{children:[(0,r.jsx)(I,{mediaElement:z.current,onError:T}),(0,r.jsx)(M,{element:D.current,onError:T})]})]})}(),(0,r.jsx)("video",{className:"rustic-video-element",ref:z,src:e.src,poster:e.poster,children:d&&(0,r.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),Y()]}),!E&&J()]})};return n})()));
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:n=>{var r=n&&n.__esModule?()=>n.default:()=>n;return e.d(r,{a:r}),r},d:(n,r)=>{for(var t in r)e.o(r,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:r[t]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{ParticipantRole:()=>H,ParticipantType:()=>V,default:()=>D});const r=require("react/jsx-runtime"),t=require("@mui/material"),i=require("@mui/material/Alert");var a=e.n(i);const o=require("@mui/material/CircularProgress");var c=e.n(o);const l=require("@mui/material/Typography");var s=e.n(l);const u=require("@mui/system"),m=require("react"),d=require("@mui/material/Box");var f=e.n(d);const p=require("@mui/material/Button");var v=e.n(p);const x=require("@mui/material/LinearProgress");var y=e.n(x);const b=require("@mui/material/Slider");var E=e.n(b);const j=require("@mui/material/Tooltip");var h,g=e.n(j);function N(e){var n=Math.floor(e/3600),r=Math.floor(e%3600/60),t=Math.floor(e%60),i=n>0?"".concat(n,":"):"",a="".concat(n>0?r.toString().padStart(2,"0"):r),o=t.toString().padStart(2,"0");return"".concat(i).concat(a,":").concat(o)}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(h||(h={}));var S=function(){return S=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var i in n=arguments[r])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},S.apply(this,arguments)};function T(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:S({},n),children:e.name})}const P=require("@mui/material/IconButton");var k=e.n(P);function O(e){var n,t={play:{symbol:"play_circle",label:"Play"},pause:{symbol:"pause_circle",label:"Pause"},forward:{symbol:"forward_10",label:"Forward ten seconds"},replay:{symbol:"replay_10",label:"Replay ten seconds"},volumeUp:{symbol:"volume_up",label:"Mute"},volumeOff:{symbol:"volume_off",label:"Unmute"},miniPlayer:{symbol:"picture_in_picture",label:"Mini player"},miniPlayerExit:{symbol:"picture_in_picture_off",label:"Exit mini player"},fullscreen:{symbol:"fullscreen",label:"Fullscreen"},fullscreenExit:{symbol:"fullscreen_exit",label:"Exit fullscreen"},captionsOn:{symbol:"closed_caption",label:"Show captions"},captionsOff:{symbol:"closed_caption_disabled",label:"Hide captions"}};return t[e.action].label.replaceAll(" ","-").toLowerCase(),(0,r.jsx)(g(),{title:t[e.action].label,PopperProps:{container:null!==(n=document.fullscreenElement)&&void 0!==n?n:document.body},children:(0,r.jsx)(k(),{onClick:e.onClick,className:e.className,color:"primary",children:(0,r.jsx)(T,{name:t[e.action].symbol,className:"rustic-icon-large"})})})}function _(e){var n="dark"===(0,t.useTheme)().palette.mode,i=N(e.mediaElement.currentTime);return(0,r.jsxs)(f(),{className:"rustic-progress",children:[function(){for(var t=e.mediaElement.buffered,i=0,a=t.length-1;a>=0;--a){var o=t.start(a),c=t.end(a);if(o<e.mediaElement.currentTime){i=c;break}}var l=i/e.mediaElement.duration*100;return(0,r.jsx)(y(),{className:"rustic-progress-buffered",variant:"determinate",value:l,sx:{backgroundColor:"action.focus","& .MuiLinearProgress-bar":{backgroundColor:n?"secondary.light":"action.selected"}}})}(),(0,r.jsx)(E(),{className:"rustic-progress-slider",size:"small","aria-label":"Time","aria-valuetext":"Current time: ".concat(i),max:e.mediaElement.duration,value:e.mediaElement.currentTime,onChange:function(n,r){e.mediaElement.currentTime=r},valueLabelDisplay:"auto",valueLabelFormat:function(e){return N(e)},color:"secondary",sx:{"& .MuiSlider-rail":{color:"action.focus"}}})]})}function w(e){var n=(0,m.useState)(e.mediaElement.volume),t=n[0],i=n[1],a=(0,m.useState)(e.mediaElement.volume),o=a[0],c=a[1],l=e.mediaElement.muted?"volumeOff":"volumeUp";return(0,r.jsxs)(f(),{className:"rustic-volume-settings",children:[(0,r.jsx)(O,{onClick:function(){e.mediaElement.muted=!e.mediaElement.muted,e.mediaElement.muted?(c(e.mediaElement.volume),i(0)):i(o)},className:"rustic-mute-button",action:l}),(0,r.jsx)(E(),{className:"rustic-volume-slider",size:"small",max:1,step:.1,"aria-label":"Volume","aria-valuetext":"Volume: ".concat(100*t,"%"),value:t,onChange:function(n,r){var t=r;e.mediaElement.muted=0===t,e.mediaElement.volume=t,i(e.mediaElement.volume)}})]})}function C(e){var n=e.isTranscriptVisible?"keyboard_arrow_up":"keyboard_arrow_down",t="".concat(e.isTranscriptVisible?"Hide":"Show"," Transcript");return(0,r.jsx)(v(),{className:"rustic-transcript-toggle",onClick:e.setIsTranscriptVisible,endIcon:(0,r.jsx)(T,{name:n}),children:(0,r.jsx)(s(),{variant:"overline",children:t})})}function B(e){var n=(0,m.useState)(!e.mediaElement.paused),t=n[0],i=n[1],a=t?"pause":"play";return e.mediaElement.onended=function(){i(!1)},e.mediaElement.onpause=function(){i(!1)},e.mediaElement.onplay=function(){i(!0)},(0,r.jsx)(O,{onClick:function(){t?e.mediaElement.pause():e.mediaElement.play().catch((function(n){e.onError("Failed to play the media. Error: ".concat(n.message))}))},action:a,className:"rustic-pause-play-icon"})}function q(e){var n,t=(0,m.useState)(e.mediaElement.playbackRate),i=t[0],a=t[1];return(0,r.jsx)(g(),{title:"Playback rate",PopperProps:{container:null!==(n=document.fullscreenElement)&&void 0!==n?n:document.body},children:(0,r.jsx)(v(),{onClick:function(){var n=1;e.mediaElement.playbackRate<2&&(n=e.mediaElement.playbackRate+.5),e.mediaElement.playbackRate=n,a(n)},className:"rustic-playback-rate-button",children:(0,r.jsxs)(s(),{variant:"body1",children:[i,"X"]})})})}function F(e){var n="replay"===e.movement,t=n?function(){e.mediaElement.currentTime-=10}:function(){e.mediaElement.currentTime+=10},i=n?"replay":"forward";return(0,r.jsx)(O,{onClick:t,action:i})}function I(e){var n=(0,m.useState)(!!document.pictureInPictureElement),t=n[0],i=n[1],a=e.mediaElement,o=t?"miniPlayerExit":"miniPlayer";return a.onleavepictureinpicture=function(){i(!1)},(0,r.jsx)(O,{onClick:function(){t?document.exitPictureInPicture().then((function(){i(!1)})).catch((function(n){e.onError("Failed to exit mini player. Error: ".concat(n.message))})):a.requestPictureInPicture().then((function(){i(!0)})).catch((function(n){e.onError("Failed to enter mini player. Error: ".concat(n.message))}))},action:o})}function M(e){var n=(0,m.useState)(!!document.fullscreenElement),t=n[0],i=n[1],a=e.element,o=t?"fullscreenExit":"fullscreen";return a.onfullscreenchange=function(){i(!!document.fullscreenElement)},(0,r.jsx)(O,{onClick:function(){t?document.exitFullscreen().then((function(){i(!1)})).catch((function(n){e.onError("Failed to exit fullscreen mode. Error: ".concat(n.message))})):a.requestFullscreen().then((function(){i(!0)})).catch((function(n){e.onError("Failed to enter fullscreen mode. Error: ".concat(n.message))}))},action:o})}function L(e){var n=e.style,t=void 0===n?"condensed":n,i=function(e,n){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);i<t.length;i++)n.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(r[t[i]]=e[t[i]])}return r}(e,["style"]),a=N(i.elapsedTimeInSeconds),o=N(i.durationTimeInSeconds),c="".concat(a," / ").concat(o);return"wide"===t?(0,r.jsxs)(f(),{className:"rustic-time-container",children:[(0,r.jsx)(s(),{variant:"overline",children:a}),(0,r.jsx)(s(),{variant:"overline",children:o})]}):(0,r.jsx)(s(),{variant:"overline",className:"rustic-time-display",children:c})}const R=require("@mui/material/Divider");var H,V,A=e.n(R);function U(e){var n=!!document.fullscreenElement;return(0,r.jsxs)(u.Box,{className:"rustic-transcript-container",children:[!n&&(0,r.jsx)(A(),{orientation:"vertical",flexItem:!0}),(0,r.jsx)(s(),{className:"rustic-transcript-content",variant:"body2",children:e.transcript})]})}!function(e){e.Owner="owner",e.Member="member"}(H||(H={})),function(e){e.Human="human",e.Agent="agent"}(V||(V={}));const D=function(e){var n=(0,m.useState)(!1),i=n[0],o=n[1],l=(0,m.useState)(!1),d=l[0],f=l[1],p=(0,m.useState)(!0),v=p[0],x=p[1],y=(0,m.useState)(!!document.fullscreenElement),b=y[0],E=y[1],j=(0,m.useState)(!1),h=j[0],g=j[1],N=(0,m.useState)(""),S=N[0],T=N[1],P=(0,m.useState)(""),k=P[0],R=P[1],H=(0,m.useState)(0),V=H[0],A=H[1],D=(0,m.useRef)(null),z=(0,m.useRef)(null),Q=(0,t.useTheme)(),X=(0,t.useMediaQuery)(Q.breakpoints.down("md"));(0,m.useEffect)((function(){var e,n,r,t,i,a,o,c;function l(e){R(e),x(!1)}function s(){clearTimeout(c),c=setTimeout((function(){return g(!1)}),3e3)}null===(e=z.current)||void 0===e||e.addEventListener("timeupdate",(function(){z.current&&A(z.current.currentTime)})),null===(n=z.current)||void 0===n||n.addEventListener("canplay",(function(){R(""),x(!1)})),null===(r=z.current)||void 0===r||r.addEventListener("error",(function(){return l("Failed to load the video.")})),null===(t=z.current)||void 0===t||t.addEventListener("stalled",(function(){return l("Failed to fetch video data, but trying.")})),document.addEventListener("fullscreenchange",(function(){E(!!document.fullscreenElement)})),null===(i=D.current)||void 0===i||i.addEventListener("mousemove",(function(){g(!0),s()})),null===(a=D.current)||void 0===a||a.addEventListener("mouseleave",(function(){g(!1)})),null===(o=D.current)||void 0===o||o.addEventListener("keydown",(function(){g(!0),s()}))}),[]);var G={backgroundColor:Q.palette.background.paper,opacity:h?1:0};function J(){if(e.transcript&&i)return(0,r.jsx)(U,{transcript:e.transcript})}function K(){if(e.captions&&e.captions.length>0){var n=d?"captionsOff":"captionsOn";return(0,r.jsx)(O,{action:n,onClick:function(){return f(!d)}})}}function W(){if(e.transcript)return(0,r.jsx)(C,{isTranscriptVisible:i,setIsTranscriptVisible:function(){return o(!i)}})}var Y=X?function(){return b?(0,r.jsx)(r.Fragment,{children:z.current&&D.current&&(0,r.jsxs)(u.Box,{className:"rustic-video-controls",sx:G,children:[(0,r.jsxs)(u.Box,{className:"rustic-video-top-controls",children:[(0,r.jsx)(B,{mediaElement:z.current,onError:T}),(0,r.jsx)(_,{mediaElement:z.current}),(0,r.jsx)(L,{elapsedTimeInSeconds:V,durationTimeInSeconds:z.current.duration})]}),(0,r.jsxs)(u.Box,{className:"rustic-video-bottom-controls",children:[(0,r.jsxs)(u.Box,{className:"rustic-time-controls",children:[(0,r.jsx)(F,{mediaElement:z.current,movement:"replay"}),(0,r.jsx)(F,{mediaElement:z.current,movement:"forward"}),K(),(0,r.jsx)(q,{mediaElement:z.current})]}),W()]}),J()]})}):(0,r.jsx)(r.Fragment,{children:z.current&&D.current&&(0,r.jsxs)(u.Box,{className:"rustic-video-controls-mobile-preview",children:[(0,r.jsx)(B,{mediaElement:z.current,onError:T}),(0,r.jsxs)(u.Box,{className:"rustic-video-controls-right",children:[W(),(0,r.jsx)(M,{element:D.current,onError:T})]})]})})}:function(){return(0,r.jsx)(r.Fragment,{children:z.current&&D.current&&(0,r.jsxs)(u.Box,{className:"rustic-video-controls",sx:G,children:[(0,r.jsx)(_,{mediaElement:z.current}),(0,r.jsxs)(u.Box,{className:"rustic-video-bottom-controls",children:[(0,r.jsxs)(u.Box,{className:"rustic-video-bottom-controls-left",children:[(0,r.jsx)(B,{mediaElement:z.current,onError:T}),(0,r.jsx)(F,{mediaElement:z.current,movement:"replay"}),(0,r.jsx)(F,{mediaElement:z.current,movement:"forward"}),K(),(0,r.jsx)(q,{mediaElement:z.current}),(0,r.jsx)(w,{mediaElement:z.current}),(0,r.jsx)(L,{elapsedTimeInSeconds:V,durationTimeInSeconds:z.current.duration,style:"condensed"})]}),(0,r.jsxs)(u.Box,{className:"rustic-video-bottom-controls-right",children:[W(),(0,r.jsx)(I,{mediaElement:z.current,onError:T}),(0,r.jsx)(M,{element:D.current,onError:T})]})]}),b&&J()]})})};return k.length>0?(0,r.jsx)(a(),{severity:"error",children:k}):(0,r.jsxs)(u.Box,{className:"rustic-video",children:[v&&(0,r.jsx)(c(),{className:"rustic-video-loading-spinner"}),(0,r.jsxs)(u.Box,{ref:D,className:"rustic-video-screen",sx:{visibility:v?"hidden":"visible"},children:[S.length>0&&(0,r.jsx)(a(),{severity:"error",className:"rustic-control-error",onClose:function(){return T("")},children:S}),(!X||b)&&function(){if(z.current&&D.current)return(0,r.jsxs)(u.Box,{className:"rustic-video-title",sx:G,children:[(0,r.jsx)(s(),{variant:"body2",children:e.title}),b&&X&&(0,r.jsxs)(u.Box,{children:[(0,r.jsx)(I,{mediaElement:z.current,onError:T}),(0,r.jsx)(M,{element:D.current,onError:T})]})]})}(),(0,r.jsx)("video",{className:"rustic-video-element",ref:z,src:e.src,poster:e.poster,children:d&&(0,r.jsx)("track",{src:e.captions,kind:"captions",default:!0})}),Y()]}),!b&&J()]})};return n})()));
@@ -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 n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const n=require("react/jsx-runtime"),r=require("@mui/material/Chip");var o=e.n(r);const s=require("@mui/system/Box");var a=e.n(s);const i=require("react");var c=e.n(i);const l=require("@mui/material/Typography");var u=e.n(l),d=function(){return d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},d.apply(this,arguments)};const m=function(e){var t=e.messages[0],r=e.messages.slice(1),o=e.supportedElements[t.format];return(0,n.jsx)(n.Fragment,{children:o?c().createElement(o,d(d({sender:e.sender,ws:e.ws,messageId:t.id,conversationId:t.conversationId},t.data),r.length>0&&{updatedData:r.map((function(e){return e.data}))})):(0,n.jsxs)(u(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)};function p(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:f({},t),children:e.name})}const v=require("@mui/material"),g=require("@mui/material/Card");var y=e.n(g);const h=require("@mui/material/Stack");var j,b=e.n(h);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(j||(j={}));const w=function(e){return(0,n.jsx)(u(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),o=navigator.language,s={month:"short",day:"numeric"},a=new Date,i=r.getFullYear()!==a.getFullYear(),c=i?" at ":", ",i&&(s.year="numeric"),r.toLocaleDateString(o,s)+c+r.toLocaleTimeString(o,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,o,s,a,i,c},x=(0,i.forwardRef)((function(e,t){var r=(0,v.useTheme)(),o=e.inReplyTo?e.inReplyTo:e.message;return(0,n.jsxs)(b(),{id:o.id,className:"rustic-message-canvas",ref:t,children:[(0,n.jsxs)(b(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(o),(0,n.jsx)(w,{timestamp:o.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,n.jsx)(y(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(o)}),(0,n.jsxs)(y(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,n.jsxs)(u(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,n.jsx)(w,{timestamp:e.message.timestamp})]})]})]})}));var O=function(){return O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},O.apply(this,arguments)},E=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,s=t.length;o<s;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};function R(e,t){var n;if(!(n=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.inReplyTo:t.id))return e;var r=O({},e),o=(r[n]||[])[0];return t.format.includes("update")&&o&&o.sender.id!==t.sender.id&&(n=t.id),r[n]||(r[n]=[]),t.format.includes("Response")&&o?r[n]=[O(O({},o),{data:O(O({},o.data),t.data)}),t]:r[n]=E(E([],r[n],!0),[t],!1),r}function T(e){var t,r,s,c=(0,i.useRef)(null),l=(0,i.useRef)(null),u=(0,i.useRef)(),d=(0,i.useState)(!0),f=d[0],v=d[1],g=(0,i.useState)(!0),y=g[0],h=g[1],j=(0,i.useState)(!1),b=j[0],w=j[1],E=(0,i.useState)({}),T=E[0],S=E[1],C=Object.keys(T).length,N=(r=C,s=(0,i.useRef)(0),(0,i.useEffect)((function(){s.current=r})),s.current);function A(){h(!0),u.current&&clearTimeout(u.current),u.current=setTimeout((function(){h(!1)}),2e3)}function P(){var e=l.current,t=c.current;if(e&&t){var n=e.getBoundingClientRect().bottom,r=t.getBoundingClientRect().bottom;v(r-1<=n)}}function q(){if(function(){var e,t=null===(e=l.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every((function(e){return e.readyState>=1}))}()){var e=l.current;w(!0),e&&setTimeout((function(){A(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(q,1)}function D(e){S((function(t){return R(t,e)}))}return(0,i.useEffect)((function(){var e=l.current;if(P(),e)return e.addEventListener("scroll",P),window.addEventListener("resize",P),function(){e.removeEventListener("scroll",P),window.removeEventListener("resize",P)}}),[f]),(0,i.useEffect)((function(){q()}),[b]),(0,i.useEffect)((function(){f&&0!==N&&C>N&&(A(),q())}),[f,Object.keys(T).length]),(0,i.useEffect)((function(){var t,n={};null===(t=e.receivedMessages)||void 0===t||t.forEach((function(e){var t=R(n,e);n=t})),S(n)}),[null===(t=e.receivedMessages)||void 0===t?void 0:t.length]),(0,i.useEffect)((function(){e.ws.onReceive&&e.ws.onReceive(D)}),[]),(0,n.jsxs)(a(),{className:"rustic-message-space",children:[(0,n.jsxs)(a(),{ref:l,className:"rustic-message-container",children:[Object.keys(T).map((function(t,r){var o,s=T[t],a=s[s.length-1],i=a.format.includes("Response"),l=i&&{inReplyTo:s[0]};return"prompts"!==a.format?(0,n.jsx)(x,O({message:a},l,{getActionsComponent:e.getActionsComponent,getProfileComponent:e.getProfileComponent,ref:r===C-1?c:null,children:(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:i?[s[0]]:s,supportedElements:e.supportedElements})}),t):"inConversation"===(null===(o=a.data)||void 0===o?void 0:o.position)?(0,n.jsx)("div",{ref:r===C-1?c:null,children:(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:i?[s[0]]:s,supportedElements:e.supportedElements})},t):void 0})),!f&&!y&&(0,n.jsx)(o(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:q,label:(0,n.jsxs)(n.Fragment,{children:[e.scrollDownLabel,(0,n.jsx)(p,{name:"arrow_downward"})]})})]}),function(t){var r,o=Object.values(t).flat(),s=o[o.length-1];return"prompts"===(null==s?void 0:s.format)&&"inConversation"!==(null===(r=null==s?void 0:s.data)||void 0===r?void 0:r.position)?(0,n.jsx)(m,{ws:e.ws,sender:e.sender,messages:[s],supportedElements:e.supportedElements}):null}(T)]})}T.defaultProps={scrollDownLabel:"Scroll down"};const S=T;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 n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const n=require("react/jsx-runtime"),r=require("@mui/material/Chip");var o=e.n(r);const s=require("@mui/system/Box");var a=e.n(s);const i=require("react");var c=e.n(i);const l=require("@mui/material/Typography");var u=e.n(l),d=function(){return d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},d.apply(this,arguments)};const m=function(e){var t=e.messages[0],r=e.messages.slice(1),o=e.supportedElements[t.format];return(0,n.jsx)(n.Fragment,{children:o?c().createElement(o,d(d({sender:e.sender,ws:e.ws,messageId:t.id,conversationId:t.conversationId},t.data),r.length>0&&{updatedData:r.map((function(e){return e.data}))})):(0,n.jsxs)(u(),{variant:"body2",children:["Unsupported element format: ",t.format]})})};var f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)};function p(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:f({},t),children:e.name})}const v=require("@mui/material"),g=require("@mui/material/Card");var y=e.n(g);const h=require("@mui/material/Stack");var j,b=e.n(h);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(j||(j={}));const w=function(e){return(0,n.jsx)(u(),{variant:"caption",color:"text.secondary",className:"rustic-timestamp",children:(t=e.timestamp,r=new Date(t),o=navigator.language,s={month:"short",day:"numeric"},a=new Date,i=r.getFullYear()!==a.getFullYear(),c=i?" at ":", ",i&&(s.year="numeric"),r.toLocaleDateString(o,s)+c+r.toLocaleTimeString(o,{hour:"numeric",minute:"2-digit",hour12:!0}))});var t,r,o,s,a,i,c},x=(0,i.forwardRef)((function(e,t){var r=(0,v.useTheme)(),o=e.inReplyTo?e.inReplyTo:e.message;return(0,n.jsxs)(b(),{id:o.id,className:"rustic-message-canvas",ref:t,children:[(0,n.jsxs)(b(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-header",children:[e.getProfileComponent&&e.getProfileComponent(o),(0,n.jsx)(w,{timestamp:o.timestamp})]}),e.getActionsComponent&&e.getActionsComponent(e.message)&&(0,n.jsx)(y(),{variant:"outlined",className:"rustic-message-actions-container",sx:{boxShadow:r.shadows[1]},children:e.getActionsComponent(o)}),(0,n.jsxs)(y(),{variant:"outlined",className:"rustic-message-container",children:[e.children,e.inReplyTo&&(0,n.jsxs)(u(),{variant:"caption",color:"text.secondary",className:"rustic-footer",children:["Submitted by ",e.message.sender.name," at ",(0,n.jsx)(w,{timestamp:e.message.timestamp})]})]})]})}));var O=function(){return O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},O.apply(this,arguments)},E=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,s=t.length;o<s;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};function R(e,t){var n;if(!(n=t.format.includes("update")?t.threadId:t.format.includes("Response")?t.inReplyTo:t.id))return e;var r=O({},e),o=(r[n]||[])[0];return t.format.includes("update")&&o&&o.sender.id!==t.sender.id&&(n=t.id),r[n]||(r[n]=[]),t.format.includes("Response")&&o?r[n]=[O(O({},o),{data:O(O({},o.data),t.data)}),t]:r[n]=E(E([],r[n],!0),[t],!1),r}const S=function(e){var t,r,s,c=e.scrollDownLabel,l=void 0===c?"Scroll down":c,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["scrollDownLabel"]),d=(0,i.useRef)(null),f=(0,i.useRef)(null),v=(0,i.useRef)(),g=(0,i.useState)(!0),y=g[0],h=g[1],j=(0,i.useState)(!0),b=j[0],w=j[1],E=(0,i.useState)(!1),S=E[0],T=E[1],C=(0,i.useState)({}),N=C[0],P=C[1],A=Object.keys(N).length,q=(r=A,s=(0,i.useRef)(0),(0,i.useEffect)((function(){s.current=r})),s.current);function D(){w(!0),v.current&&clearTimeout(v.current),v.current=setTimeout((function(){w(!1)}),2e3)}function L(){var e=f.current,t=d.current;if(e&&t){var n=e.getBoundingClientRect().bottom,r=t.getBoundingClientRect().bottom;h(r-1<=n)}}function _(){if(function(){var e,t=null===(e=f.current)||void 0===e?void 0:e.querySelectorAll("video");return!t||0===t.length||Array.from(t).every((function(e){return e.readyState>=1}))}()){var e=f.current;T(!0),e&&setTimeout((function(){D(),e.scrollTop=e.scrollHeight}),0)}else setTimeout(_,1)}function M(e){P((function(t){return R(t,e)}))}return(0,i.useEffect)((function(){var e=f.current;if(L(),e)return e.addEventListener("scroll",L),window.addEventListener("resize",L),function(){e.removeEventListener("scroll",L),window.removeEventListener("resize",L)}}),[y]),(0,i.useEffect)((function(){_()}),[S]),(0,i.useEffect)((function(){y&&0!==q&&A>q&&(D(),_())}),[y,Object.keys(N).length]),(0,i.useEffect)((function(){var e,t={};null===(e=u.receivedMessages)||void 0===e||e.forEach((function(e){var n=R(t,e);t=n})),P(t)}),[null===(t=u.receivedMessages)||void 0===t?void 0:t.length]),(0,i.useEffect)((function(){u.ws.onReceive&&u.ws.onReceive(M)}),[]),(0,n.jsxs)(a(),{className:"rustic-message-space",children:[(0,n.jsxs)(a(),{ref:f,className:"rustic-message-container",children:[Object.keys(N).map((function(e,t){var r,o=N[e],s=o[o.length-1],a=s.format.includes("Response"),i=a&&{inReplyTo:o[0]};return"prompts"!==s.format?(0,n.jsx)(x,O({message:s},i,{getActionsComponent:u.getActionsComponent,getProfileComponent:u.getProfileComponent,ref:t===A-1?d:null,children:(0,n.jsx)(m,{ws:u.ws,sender:u.sender,messages:a?[o[0]]:o,supportedElements:u.supportedElements})}),e):"inConversation"===(null===(r=s.data)||void 0===r?void 0:r.position)?(0,n.jsx)("div",{ref:t===A-1?d:null,children:(0,n.jsx)(m,{ws:u.ws,sender:u.sender,messages:a?[o[0]]:o,supportedElements:u.supportedElements})},e):void 0})),!y&&!b&&(0,n.jsx)(o(),{color:"secondary",className:"rustic-scroll-down-button",size:"medium",onClick:_,label:(0,n.jsxs)(n.Fragment,{children:[l,(0,n.jsx)(p,{name:"arrow_downward"})]})})]}),function(e){var t,r=Object.values(e).flat(),o=r[r.length-1];return"prompts"===(null==o?void 0:o.format)&&"inConversation"!==(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.position)?(0,n.jsx)(m,{ws:u.ws,sender:u.sender,messages:[o],supportedElements:u.supportedElements}):null}(N)]})};return t})()));
@@ -20,11 +20,5 @@ export interface MessageSpaceProps extends MessageContainerProps {
20
20
 
21
21
  Note: For more information about the `getActionsComponent` and `getProfileComponent` fields, refer to the [MessageCanvas' docs](http://localhost:6006/?path=/docs/rustic-ui-message-canvas-message-canvas--docs).
22
22
  */
23
- declare function MessageSpace(props: MessageSpaceProps): import("react/jsx-runtime").JSX.Element;
24
- declare namespace MessageSpace {
25
- var defaultProps: {
26
- scrollDownLabel: string;
27
- };
28
- }
29
- export default MessageSpace;
23
+ export default function MessageSpace({ scrollDownLabel, ...props }: MessageSpaceProps): import("react/jsx-runtime").JSX.Element;
30
24
  //# sourceMappingURL=messageSpace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageSpace.d.ts","sourceRoot":"","sources":["../../../src/components/messageSpace/messageSpace.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAQ3B,OAAsB,EACpB,KAAK,qBAAqB,EAC3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE9E,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,0LAA0L;IAC1L,EAAE,EAAE,eAAe,CAAA;IACnB,0GAA0G;IAC1G,MAAM,EAAE,MAAM,CAAA;IACd,2GAA2G;IAC3G,iBAAiB,EAAE,YAAY,CAAA;IAC/B,2IAA2I;IAC3I,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAA;IAC5B,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AA6DD;;;;;;EAME;AAEF,iBAAwB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAmN5D;kBAnNuB,YAAY;;;;;eAAZ,YAAY"}
1
+ {"version":3,"file":"messageSpace.d.ts","sourceRoot":"","sources":["../../../src/components/messageSpace/messageSpace.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAQ3B,OAAsB,EACpB,KAAK,qBAAqB,EAC3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE9E,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,0LAA0L;IAC1L,EAAE,EAAE,eAAe,CAAA;IACnB,0GAA0G;IAC1G,MAAM,EAAE,MAAM,CAAA;IACd,2GAA2G;IAC3G,iBAAiB,EAAE,YAAY,CAAA;IAC/B,2IAA2I;IAC3I,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAA;IAC5B,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AA6DD;;;;;;EAME;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,eAA+B,EAC/B,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAmNnB"}
@@ -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={9767:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(8732),i=(r(2015),function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:i({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},2500:(e,t,r)=>{r.d(t,{default:()=>i}),r(1737);var n=r(7131);r(7159);const i=n.A},1737:(e,t,r)=>{r(8732),r(5642),r(785),r(7447),r(2015)},7131:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(8732),i=r(785),a=r.n(i),o=r(7447),s=r.n(o);r(2015);const l=function(e){return(0,n.jsx)(a(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})}},7159:(e,t,r)=>{var n,i;!function(e){e.Owner="owner",e.Member="member"}(n||(n={})),function(e){e.Human="human",e.Agent="agent"}(i||(i={}))},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},7447:e=>{e.exports=require("dompurify")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{default:()=>z});var i=r(8732);const a=require("@mui/material/Box");var o=r.n(a);const s=require("@mui/material/IconButton");var l=r.n(s);const c=require("@mui/material/Tooltip");var u=r.n(c),d=r(2015);const m=require("@mui/material/Card");var f=r.n(m);const p=require("@mui/material/Modal");var h=r.n(p);const x=require("@mui/material/styles");var v,j=r(785),b=r.n(j);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(v||(v={}));var w=r(9767);const y=require("@mui/material/TextField");var g=r.n(y);const N=require("@mui/material/useMediaQuery");var C=r.n(N);const k=require("@mui/system/Stack");var P=r.n(k);const O=require("@mui/system/useTheme");var q=r.n(O);const S=require("pdfjs-dist"),A=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,i.jsx)(u(),{title:r.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(l(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(w.A,{name:r.symbol})})})})};var T={pdf:function(e){var t,r=(0,d.useRef)(null),n=(0,d.useState)(1),a=n[0],s=n[1],l=(0,d.useState)(1),c=l[0],u=l[1],m=(0,d.useState)(1),p=m[0],h=m[1],x=(0,d.useState)(!1),v=x[0],j=x[1],w=(0,d.useState)(),y=w[0],N=w[1],k=q()(),O=C()(k.breakpoints.down("sm")),T=C()(k.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(f(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(b(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var _=(0,d.useState)((function(){return O?.5:T?1:1.5})),F=_[0],D=_[1];return(0,d.useEffect)((function(){S.GlobalWorkerOptions.workerSrc||(S.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(S.version,"/pdf.worker.mjs")),S.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(a).then((function(e){var t=e.getViewport({scale:F}),n=r.current;if(n){var i=n.getContext("2d");if(i){var a=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*a,n.height=t.height*a;var o={canvasContext:i,viewport:t,transform:[a,0,0,a,0,0]};y&&y.cancel();var s=e.render(o);N(s),s.promise.then((function(){N(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){j(!0)}))}),[e.url,a,F]),v?(0,i.jsx)(f(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(b(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(f(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(o(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(A,{action:"zoomOut",onClick:function(){D((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(A,{action:"zoomIn",onClick:function(){D((function(e){return e+.2}))}})]}),(0,i.jsx)(o(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(o(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:r})})}),(0,i.jsxs)(P(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(A,{action:"previousPage",onClick:function(){a>1&&(s(a-1),h(a-1))},isDisabled:1===a}),(0,i.jsx)(b(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(g(),{type:"number",value:p,onChange:function(e){var t=parseInt(e.target.value);h(t),!isNaN(t)&&t>=1&&t<=c&&s(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(b(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,i.jsx)(A,{action:"nextPage",onClick:function(){a<c&&(s(a+1),h(a+1))},isDisabled:a===c})]})]})}};function _(e){var t=(0,x.useTheme)(),r=(0,d.useState)(!1),n=r[0],a=r[1];function o(){a(!1)}var s,c,m=e.file.url&&(s=e.file.url.split("."))[s.length-1].toLowerCase(),p=m&&e.supportedViewers?e.supportedViewers[m]:null,v=!!p,j=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",y=v?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(j).concat(y),N=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)(f(),{className:g,variant:"outlined",sx:{boxShadow:t.shadows[1]},onClick:function(){a(!0)},children:[(0,i.jsx)(b(),{variant:"subtitle2",className:"rustic-file-preview-name",children:N}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),v&&(0,i.jsx)(h(),{open:n,onClose:o,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(u(),{title:"Close",children:(0,i.jsx)(l(),{onClick:o,className:"rustic-close-button",children:(0,i.jsx)(w.A,{name:"close"})})}),e.file.url&&(0,i.jsx)(p,{url:e.file.url})]})})]})}_.defaultProps={supportedViewers:T,showFullName:!0};var F=r(3110),D=r(2500);function M(e){return new URL(e).pathname.split("/").pop()}const z=function(e){return(0,i.jsx)(o(),{className:"rustic-multipart",children:e.messages.map((function(t){return"string"==typeof t.content?(0,i.jsx)(D.default,{text:t.content}):(r=t.content,n=[],a="",r.map((function(t){if("text"===t.type)a+=t.text;else if(t.type.endsWith("_url")){var r=t[t.type].url,o={url:r,name:t[t.type].name||M(r)},s=(0,i.jsx)(_,{file:o,showFullName:e.showFullName,children:o.url&&(0,i.jsx)(u(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,i.jsx)(l(),{component:"a",href:o.url,download:o.name,children:(0,i.jsx)(F.default,{name:"download"})})})});n.push(s)}})),(0,i.jsxs)(i.Fragment,{children:[a.length>0&&(0,i.jsx)(D.default,{text:a}),n.length>0&&(0,i.jsx)(o(),{className:"rustic-files",children:n})]}));var r,n,a}))})};return n})()));
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={9767:(e,t,r)=>{r.d(t,{A:()=>o});var n=r(8732),i=(r(2015),function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)});function o(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:i({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},2500:(e,t,r)=>{r.d(t,{default:()=>i}),r(1737);var n=r(7131);r(7159);const i=n.A},1737:(e,t,r)=>{r(8732),r(5642),r(785),r(7447),r(2015)},7131:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(8732),i=r(785),o=r.n(i),a=r(7447),s=r.n(a);r(2015);const l=function(e){return(0,n.jsx)(o(),{variant:"body2",className:"rustic-text",children:s().sanitize(e.text)})}},7159:(e,t,r)=>{var n,i;!function(e){e.Owner="owner",e.Member="member"}(n||(n={})),function(e){e.Human="human",e.Agent="agent"}(i||(i={}))},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},7447:e=>{e.exports=require("dompurify")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{default:()=>I});var i=r(8732);const o=require("@mui/material/Box");var a=r.n(o);const s=require("@mui/material/IconButton");var l=r.n(s);const c=require("@mui/material/Tooltip");var u=r.n(c),d=r(2015),m=r.n(d);const f=require("@mui/material/Card");var p=r.n(f);const h=require("@mui/material/Modal");var v=r.n(h);const x=require("@mui/material/styles");var b,j=r(785),y=r.n(j);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(b||(b={}));var g=r(9767);const w=require("@mui/material/TextField");var N=r.n(w);const O=require("@mui/material/useMediaQuery");var P=r.n(O);const C=require("@mui/system/Stack");var k=r.n(C);const S=require("@mui/system/useTheme");var q=r.n(S);const A=require("pdfjs-dist"),T=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,i.jsx)(u(),{title:r.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(l(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(g.A,{name:r.symbol})})})})};var _={pdf:function(e){var t,r=(0,d.useRef)(null),n=(0,d.useState)(1),o=n[0],s=n[1],l=(0,d.useState)(1),c=l[0],u=l[1],m=(0,d.useState)(1),f=m[0],h=m[1],v=(0,d.useState)(!1),x=v[0],b=v[1],j=(0,d.useState)(),g=j[0],w=j[1],O=q()(),C=P()(O.breakpoints.down("sm")),S=P()(O.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(p(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(y(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var _=(0,d.useState)((function(){return C?.5:S?1:1.5})),F=_[0],D=_[1];return(0,d.useEffect)((function(){A.GlobalWorkerOptions.workerSrc||(A.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(A.version,"/pdf.worker.mjs")),A.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(o).then((function(e){var t=e.getViewport({scale:F}),n=r.current;if(n){var i=n.getContext("2d");if(i){var o=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*o,n.height=t.height*o;var a={canvasContext:i,viewport:t,transform:[o,0,0,o,0,0]};g&&g.cancel();var s=e.render(a);w(s),s.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){b(!0)}))}),[e.url,o,F]),x?(0,i.jsx)(p(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(y(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(p(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(a(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(T,{action:"zoomOut",onClick:function(){D((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(T,{action:"zoomIn",onClick:function(){D((function(e){return e+.2}))}})]}),(0,i.jsx)(a(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(a(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:r})})}),(0,i.jsxs)(k(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(T,{action:"previousPage",onClick:function(){o>1&&(s(o-1),h(o-1))},isDisabled:1===o}),(0,i.jsx)(y(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(N(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);h(t),!isNaN(t)&&t>=1&&t<=c&&s(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(y(),{variant:"body1",className:"rustic-page-indicator",children:["of ",c]}),(0,i.jsx)(T,{action:"nextPage",onClick:function(){o<c&&(s(o+1),h(o+1))},isDisabled:o===c})]})]})}};function F(e){var t=e.supportedViewers,r=void 0===t?_:t,n=e.showFullName,o=void 0===n||n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["supportedViewers","showFullName"]),s=(0,x.useTheme)(),c=(0,d.useState)(!1),m=c[0],f=c[1];function h(){f(!1)}var b,j,w=a.file.url&&(b=a.file.url.split("."))[b.length-1].toLowerCase(),N=w&&r?r[w]:null,O=!!N,P=O?" rustic-cursor-pointer":"",C="rustic-file-preview ".concat(o?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(P),k=o?a.file.name:(j=a.file.name).length<=15?j:j.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(p(),{className:C,variant:"outlined",sx:{boxShadow:s.shadows[1]},onClick:function(){f(!0)},children:[(0,i.jsx)(y(),{variant:"subtitle2",className:"rustic-file-preview-name",children:k}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:a.children})]}),O&&(0,i.jsx)(v(),{open:m,onClose:h,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(u(),{title:"Close",children:(0,i.jsx)(l(),{onClick:h,className:"rustic-close-button",children:(0,i.jsx)(g.A,{name:"close"})})}),a.file.url&&(0,i.jsx)(N,{url:a.file.url})]})})]})}var D=r(3110),M=r(2500);function z(e){return new URL(e).pathname.split("/").pop()}const I=function(e){return(0,i.jsx)(a(),{className:"rustic-multipart",children:e.messages.map((function(t,r){return"string"==typeof t.content?(0,i.jsx)(M.default,{text:t.content},r):function(t,r){var n=[],o="";return t.map((function(t){if("text"===t.type)o+=t.text;else if(t.type.endsWith("_url")){var r=t[t.type].url,a={url:r,name:t[t.type].name||z(r)},s=(0,i.jsx)(F,{file:a,showFullName:e.showFullName,children:a.url&&(0,i.jsx)(u(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,i.jsx)(l(),{component:"a",href:a.url,download:a.name,children:(0,i.jsx)(D.default,{name:"download"})})})});n.push(s)}})),(0,i.jsxs)(m().Fragment,{children:[o.length>0&&(0,i.jsx)(M.default,{text:o}),n.length>0&&(0,i.jsx)(a(),{className:"rustic-files",children:n})]},r)}(t.content,r)}))})};return n})()));
@@ -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 i in t)e.o(t,i)&&!e.o(r,i)&&Object.defineProperty(r,i,{enumerable:!0,get:t[i]})},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:()=>R});const t=require("react/jsx-runtime"),i=require("@mui/material/IconButton");var n=e.n(i);const a=require("@mui/material/Tooltip");var o=e.n(a);const s=require("@mui/system/Box");var l=e.n(s);const c=require("react"),u=require("@mui/material/Card");var d=e.n(u);const m=require("@mui/material/Modal");var f=e.n(m);const p=require("@mui/material/styles"),h=require("@mui/material/Typography");var v,x=e.n(h);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(v||(v={}));var j=function(){return j=Object.assign||function(e){for(var r,t=1,i=arguments.length;t<i;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},j.apply(this,arguments)};function b(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:j({},r),children:e.name})}const w=require("@mui/material/Box");var y=e.n(w);const g=require("@mui/material/TextField");var N=e.n(g);const C=require("@mui/material/useMediaQuery");var k=e.n(C);const P=require("@mui/system/Stack");var q=e.n(P);const O=require("@mui/system/useTheme");var S=e.n(O);const T=require("pdfjs-dist"),_=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"}},i=(r[e.action].label.replaceAll(" ","-").toLowerCase(),r[e.action]);return(0,t.jsx)(o(),{title:i.label,children:(0,t.jsx)("span",{children:(0,t.jsx)(n(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,t.jsx)(b,{name:i.symbol})})})})};var F={pdf:function(e){var r,i=(0,c.useRef)(null),n=(0,c.useState)(1),a=n[0],o=n[1],s=(0,c.useState)(1),l=s[0],u=s[1],m=(0,c.useState)(1),f=m[0],p=m[1],h=(0,c.useState)(!1),v=h[0],j=h[1],b=(0,c.useState)(),w=b[0],g=b[1],C=S()(),P=k()(C.breakpoints.down("sm")),O=k()(C.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,t.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(x(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var F=(0,c.useState)((function(){return P?.5:O?1:1.5})),D=F[0],z=F[1];return(0,c.useEffect)((function(){T.GlobalWorkerOptions.workerSrc||(T.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(T.version,"/pdf.worker.mjs")),T.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(a).then((function(e){var r=e.getViewport({scale:D}),t=i.current;if(t){var n=t.getContext("2d");if(n){var a=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*a,t.height=r.height*a;var o={canvasContext:n,viewport:r,transform:[a,0,0,a,0,0]};w&&w.cancel();var s=e.render(o);g(s),s.promise.then((function(){g(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){j(!0)}))}),[e.url,a,D]),v?(0,t.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(x(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,t.jsxs)(d(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,t.jsxs)(y(),{className:"rustic-pdf-viewer-header",children:[(0,t.jsx)(_,{action:"zoomOut",onClick:function(){z((function(e){return Math.max(e-.2,.2)}))}}),(0,t.jsx)(_,{action:"zoomIn",onClick:function(){z((function(e){return e+.2}))}})]}),(0,t.jsx)(y(),{className:"rustic-pdf-viewer-body",children:(0,t.jsx)(y(),{className:"rustic-pdf-viewer-body-inner",children:(0,t.jsx)("canvas",{ref:i})})}),(0,t.jsxs)(q(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,t.jsx)(_,{action:"previousPage",onClick:function(){a>1&&(o(a-1),p(a-1))},isDisabled:1===a}),(0,t.jsx)(x(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,t.jsx)(N(),{type:"number",value:f,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=l&&o(r)},size:"small",className:"rustic-pdf-page-input"}),(0,t.jsxs)(x(),{variant:"body1",className:"rustic-page-indicator",children:["of ",l]}),(0,t.jsx)(_,{action:"nextPage",onClick:function(){a<l&&(o(a+1),p(a+1))},isDisabled:a===l})]})]})}};function D(e){var r=(0,p.useTheme)(),i=(0,c.useState)(!1),a=i[0],s=i[1];function l(){s(!1)}var u,m,h=e.file.url&&(u=e.file.url.split("."))[u.length-1].toLowerCase(),v=h&&e.supportedViewers?e.supportedViewers[h]:null,j=!!v,w=e.showFullName?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width",y=j?" rustic-cursor-pointer":"",g="rustic-file-preview ".concat(w).concat(y),N=e.showFullName?e.file.name:(m=e.file.name).length<=15?m:m.substring(0,12)+"...";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d(),{className:g,variant:"outlined",sx:{boxShadow:r.shadows[1]},onClick:function(){s(!0)},children:[(0,t.jsx)(x(),{variant:"subtitle2",className:"rustic-file-preview-name",children:N}),(0,t.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:e.children})]}),j&&(0,t.jsx)(f(),{open:a,onClose:l,className:"rustic-file-preview-modal",children:(0,t.jsxs)("div",{className:"rustic-modal-content",children:[(0,t.jsx)(o(),{title:"Close",children:(0,t.jsx)(n(),{onClick:l,className:"rustic-close-button",children:(0,t.jsx)(b,{name:"close"})})}),e.file.url&&(0,t.jsx)(v,{url:e.file.url})]})})]})}D.defaultProps={supportedViewers:F,showFullName:!0};const z=require("dompurify");var M=e.n(z);const I=function(e){return(0,t.jsx)(x(),{variant:"body2",className:"rustic-text",children:M().sanitize(e.text)})},R=function(e){return(0,t.jsxs)(l(),{className:"rustic-multipart",children:[e.text&&(0,t.jsx)(I,{text:e.text}),(r=e.files.map((function(r,i){return(0,t.jsx)(D,{file:r,showFullName:e.showFullName,children:r.url&&(0,t.jsx)(o(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,t.jsx)(n(),{component:"a",href:r.url,download:r.name,children:(0,t.jsx)(b,{name:"download"})})})},i)})),(0,t.jsx)(l(),{className:"rustic-files",children:r}))]});var r};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,{default:()=>R});const t=require("react/jsx-runtime"),n=require("@mui/material/IconButton");var i=e.n(n);const o=require("@mui/material/Tooltip");var a=e.n(o);const s=require("@mui/system/Box");var l=e.n(s);const c=require("react"),u=require("@mui/material/Card");var d=e.n(u);const m=require("@mui/material/Modal");var f=e.n(m);const p=require("@mui/material/styles"),h=require("@mui/material/Typography");var v,x=e.n(h);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(v||(v={}));var b=function(){return b=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e},b.apply(this,arguments)};function j(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 y=require("@mui/material/Box");var w=e.n(y);const g=require("@mui/material/TextField");var N=e.n(g);const O=require("@mui/material/useMediaQuery");var P=e.n(O);const C=require("@mui/system/Stack");var k=e.n(C);const S=require("@mui/system/useTheme");var q=e.n(S);const T=require("pdfjs-dist"),_=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,t.jsx)(a(),{title:n.label,children:(0,t.jsx)("span",{children:(0,t.jsx)(i(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,t.jsx)(j,{name:n.symbol})})})})};var D={pdf:function(e){var r,n=(0,c.useRef)(null),i=(0,c.useState)(1),o=i[0],a=i[1],s=(0,c.useState)(1),l=s[0],u=s[1],m=(0,c.useState)(1),f=m[0],p=m[1],h=(0,c.useState)(!1),v=h[0],b=h[1],j=(0,c.useState)(),y=j[0],g=j[1],O=q()(),C=P()(O.breakpoints.down("sm")),S=P()(O.breakpoints.between("sm","md"));if(r=e.url,!/\/[^/]+\.pdf$/.test(r))return(0,t.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(x(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var D=(0,c.useState)((function(){return C?.5:S?1:1.5})),F=D[0],z=D[1];return(0,c.useEffect)((function(){T.GlobalWorkerOptions.workerSrc||(T.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(T.version,"/pdf.worker.mjs")),T.getDocument({url:"".concat(e.url)}).promise.then((function(e){u(e.numPages),function(e){e.getPage(o).then((function(e){var r=e.getViewport({scale:F}),t=n.current;if(t){var i=t.getContext("2d");if(i){var o=window.devicePixelRatio||1;t.style.width="".concat(r.width,"px"),t.style.height="".concat(r.height,"px"),t.width=r.width*o,t.height=r.height*o;var a={canvasContext:i,viewport:r,transform:[o,0,0,o,0,0]};y&&y.cancel();var s=e.render(a);g(s),s.promise.then((function(){g(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){b(!0)}))}),[e.url,o,F]),v?(0,t.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,t.jsx)(x(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,t.jsxs)(d(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,t.jsxs)(w(),{className:"rustic-pdf-viewer-header",children:[(0,t.jsx)(_,{action:"zoomOut",onClick:function(){z((function(e){return Math.max(e-.2,.2)}))}}),(0,t.jsx)(_,{action:"zoomIn",onClick:function(){z((function(e){return e+.2}))}})]}),(0,t.jsx)(w(),{className:"rustic-pdf-viewer-body",children:(0,t.jsx)(w(),{className:"rustic-pdf-viewer-body-inner",children:(0,t.jsx)("canvas",{ref:n})})}),(0,t.jsxs)(k(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,t.jsx)(_,{action:"previousPage",onClick:function(){o>1&&(a(o-1),p(o-1))},isDisabled:1===o}),(0,t.jsx)(x(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,t.jsx)(N(),{type:"number",value:f,onChange:function(e){var r=parseInt(e.target.value);p(r),!isNaN(r)&&r>=1&&r<=l&&a(r)},size:"small",className:"rustic-pdf-page-input"}),(0,t.jsxs)(x(),{variant:"body1",className:"rustic-page-indicator",children:["of ",l]}),(0,t.jsx)(_,{action:"nextPage",onClick:function(){o<l&&(a(o+1),p(o+1))},isDisabled:o===l})]})]})}};function F(e){var r=e.supportedViewers,n=void 0===r?D:r,o=e.showFullName,s=void 0===o||o,l=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 i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(t[n[i]]=e[n[i]])}return t}(e,["supportedViewers","showFullName"]),u=(0,p.useTheme)(),m=(0,c.useState)(!1),h=m[0],v=m[1];function b(){v(!1)}var y,w,g=l.file.url&&(y=l.file.url.split("."))[y.length-1].toLowerCase(),N=g&&n?n[g]:null,O=!!N,P=O?" rustic-cursor-pointer":"",C="rustic-file-preview ".concat(s?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(P),k=s?l.file.name:(w=l.file.name).length<=15?w:w.substring(0,12)+"...";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d(),{className:C,variant:"outlined",sx:{boxShadow:u.shadows[1]},onClick:function(){v(!0)},children:[(0,t.jsx)(x(),{variant:"subtitle2",className:"rustic-file-preview-name",children:k}),(0,t.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:l.children})]}),O&&(0,t.jsx)(f(),{open:h,onClose:b,className:"rustic-file-preview-modal",children:(0,t.jsxs)("div",{className:"rustic-modal-content",children:[(0,t.jsx)(a(),{title:"Close",children:(0,t.jsx)(i(),{onClick:b,className:"rustic-close-button",children:(0,t.jsx)(j,{name:"close"})})}),l.file.url&&(0,t.jsx)(N,{url:l.file.url})]})})]})}const z=require("dompurify");var M=e.n(z);const I=function(e){return(0,t.jsx)(x(),{variant:"body2",className:"rustic-text",children:M().sanitize(e.text)})},R=function(e){return(0,t.jsxs)(l(),{className:"rustic-multipart",children:[e.text&&(0,t.jsx)(I,{text:e.text}),(r=e.files.map((function(r,n){return(0,t.jsx)(F,{file:r,showFullName:e.showFullName,children:r.url&&(0,t.jsx)(a(),{title:"Download",className:"rustic-shift-to-right-by-8",children:(0,t.jsx)(i(),{component:"a",href:r.url,download:r.name,children:(0,t.jsx)(j,{name:"download"})})})},n)})),(0,t.jsx)(l(),{className:"rustic-files",children:r}))]});var r};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:()=>p});const t=require("react/jsx-runtime"),o=require("@mui/material/Box");var n=e.n(o);const a=require("@mui/material/Chip");var i=e.n(a);const s=require("@mui/system/useTheme");var u=e.n(s);require("react");const c=require("uuid");var l=function(){return l=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},l.apply(this,arguments)};const p=function(e){var r=u()(),o=e.prompts.map((function(o,n){return(0,t.jsx)(i(),{onClick:function(){return r=o,t=(new Date).toISOString(),n={id:(0,c.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:r}},void e.ws.send(n);var r,t,n},color:"secondary",size:"small",className:"rustic-prompt",sx:l(l({backgroundColor:r.palette.background.paper},"inConversation"===e.position&&{border:"1px solid ".concat(r.palette.divider)}),{"&:hover":{color:r.palette.text.primary,backgroundColor:r.palette.primary.hover}}),label:o},n)}));return(0,t.jsx)(n(),{className:e.className,children:o})};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 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:()=>m});const t=require("react/jsx-runtime"),o=require("@mui/material/Box");var n=e.n(o);const a=require("@mui/material/Chip");var i=e.n(a);const u=require("@mui/system/useTheme");var s=e.n(u);require("react");const l=require("uuid");var c;function p(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 o=0;o<(null==r?void 0:r.length);o++)t.push({type:"file_url",file_url:{url:r[o].url,name:r[o].name}});return{messages:[{content:t,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(c||(c={}));var d=function(){return d=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var n in r=arguments[t])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e},d.apply(this,arguments)};const m=function(e){var r=s()(),o=e.prompts.map((function(o,n){return(0,t.jsx)(i(),{onClick:function(){return r=o,t=(new Date).toISOString(),n={id:(0,l.v4)(),timestamp:t,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:p(r.toString())},void e.ws.send(n);var r,t,n},color:"secondary",size:"small",className:"rustic-prompt",sx:d(d({backgroundColor:r.palette.background.paper},"inConversation"===e.position&&{border:"1px solid ".concat(r.palette.divider)}),{"&:hover":{color:r.palette.text.primary,backgroundColor:r.palette.primary.hover}}),label:o},n)}));return(0,t.jsx)(n(),{className:e.className,children:o})};return r})()));
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/components/prompts/prompts.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAQtB,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,UAAU,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,2CA8ClD"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/components/prompts/prompts.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAStB,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,UAAU,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,2CA8ClD"}
@@ -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 i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},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:()=>f,ParticipantType:()=>b,default:()=>y});const r=require("react/jsx-runtime"),i=require("@mui/material"),n=require("@mui/material/Box");var o=e.n(n);const a=require("@mui/material/Chip");var s=e.n(a);const c=require("@mui/material/Stack");var u=e.n(c);const l=require("@mui/material/Typography");var d=e.n(l);const m=require("react"),p=require("uuid");var f,b;!function(e){e.Owner="owner",e.Member="member"}(f||(f={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const y=function(e){var t=(0,m.useState)(""),n=t[0],a=t[1],c=(0,i.useTheme)(),l=(0,i.useMediaQuery)(c.breakpoints.down("md"))?"column":"row",f=e.options.map((function(t,i){return(0,r.jsx)(s(),{onClick:function(){return function(t){a(t);var r=(new Date).toISOString(),i={id:(0,p.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"text",data:{text:t},inReplyTo:e.messageId};e.ws.send(i)}(t)},color:"secondary",size:"small",sx:n===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!n,"aria-disabled":!!n,label:t},i)}));return(0,r.jsxs)(o(),{className:"rustic-question",children:[(e.title||e.description)&&(0,r.jsxs)(o(),{className:"rustic-question-text",children:[e.title&&(0,r.jsx)(d(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,r.jsx)(d(),{variant:"caption",children:e.description})]}),(0,r.jsx)(u(),{direction:l,className:"rustic-options-container",children:f})]})};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:()=>y,ParticipantType:()=>b,default:()=>g});const r=require("react/jsx-runtime"),n=require("@mui/material"),i=require("@mui/material/Box");var o=e.n(i);const a=require("@mui/material/Chip");var s=e.n(a);const u=require("@mui/material/Stack");var l=e.n(u);const c=require("@mui/material/Typography");var d=e.n(c);const m=require("react"),p=require("uuid");var f,y,b;function v(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(f||(f={})),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 t=(0,m.useState)(""),i=t[0],a=t[1],u=(0,n.useTheme)(),c=(0,n.useMediaQuery)(u.breakpoints.down("md"))?"column":"row",f=e.options.map((function(t,n){return(0,r.jsx)(s(),{onClick:function(){return function(t){a(t);var r=(new Date).toISOString(),n={id:(0,p.v4)(),timestamp:r,sender:e.sender,conversationId:e.conversationId,format:"chatCompletionRequest",data:v(t.toString()),inReplyTo:e.messageId};e.ws.send(n)}(t)},color:"secondary",size:"small",sx:i===t?{"&.Mui-disabled":{backgroundColor:"secondary.light",color:"text.primary"}}:{},className:"rustic-option",disabled:!!i,"aria-disabled":!!i,label:t},n)}));return(0,r.jsxs)(o(),{className:"rustic-question",children:[(e.title||e.description)&&(0,r.jsxs)(o(),{className:"rustic-question-text",children:[e.title&&(0,r.jsx)(d(),{variant:"subtitle2",className:"rustic-title",children:e.title}),e.description&&(0,r.jsx)(d(),{variant:"caption",children:e.description})]}),(0,r.jsx)(l(),{direction:c,className:"rustic-options-container",children:f})]})};return t})()));
@@ -1 +1 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../src/components/question/question.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAUvB,OAAO,KAAK,EAAW,aAAa,EAAE,MAAM,UAAU,CAAA;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAwEpD"}
1
+ {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../src/components/question/question.tsx"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAA;AAWvB,OAAO,KAAK,EAAW,aAAa,EAAE,MAAM,UAAU,CAAA;AAEtD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAwEpD"}
@@ -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:()=>l});const r=require("react/jsx-runtime"),o=require("dompurify");var n=e.n(o);require("react");var i,a=function(){return a=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(i||(i={}));var c=function(){return c=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},c.apply(this,arguments)};function u(e){var t,o,i,u=n().sanitize(e.youtubeVideoId);return(0,r.jsx)("iframe",c({},(i={},(t=e.width)&&(i={width:t}),(o=e.height)&&(i=a(a({},i),{height:o})),t||o||(i={className:"rustic-fit-container"}),i),{src:"https://www.youtube.com/embed/".concat(u),title:e.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",loading:"lazy"}))}u.defaultProps={title:"Embedded video"};const l=u;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 o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>u});const r=require("react/jsx-runtime"),o=require("dompurify");var n=e.n(o);require("react");var i,a=function(){return a=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(i||(i={}));var c=function(){return c=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},c.apply(this,arguments)};const u=function(e){var t,o,i,u=e.title,l=void 0===u?"Embedded video":u,p=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(e,["title"]),f=n().sanitize(p.youtubeVideoId);return(0,r.jsx)("iframe",c({},(i={},(t=p.width)&&(i={width:t}),(o=p.height)&&(i=a(a({},i),{height:o})),t||o||(i={className:"rustic-fit-container"}),i),{src:"https://www.youtube.com/embed/".concat(f),title:l,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen",loading:"lazy"}))};return t})()));
@@ -17,11 +17,5 @@ export interface YoutubeVideoProps {
17
17
  * npm i dompurify
18
18
  * ```
19
19
  */
20
- declare function YoutubeVideo(props: YoutubeVideoProps): import("react/jsx-runtime").JSX.Element;
21
- declare namespace YoutubeVideo {
22
- var defaultProps: {
23
- title: string;
24
- };
25
- }
26
- export default YoutubeVideo;
20
+ export default function YoutubeVideo({ title, ...props }: YoutubeVideoProps): import("react/jsx-runtime").JSX.Element;
27
21
  //# sourceMappingURL=youtubeVideo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"youtubeVideo.d.ts","sourceRoot":"","sources":["../../../src/components/video/youtubeVideo.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAOxB,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,cAAc,EAAE,MAAM,CAAA;IACtB,yIAAyI;IACzI,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,iBAAwB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAa5D;kBAbuB,YAAY;;;;;eAAZ,YAAY"}
1
+ {"version":3,"file":"youtubeVideo.d.ts","sourceRoot":"","sources":["../../../src/components/video/youtubeVideo.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAOxB,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,cAAc,EAAE,MAAM,CAAA;IACtB,yIAAyI;IACzI,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,KAAwB,EACxB,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAanB"}
@@ -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 n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const r=require("react/jsx-runtime"),n=require("@mui/material/FormControl");var i=e.n(n);const a=require("@mui/material/IconButton");var o=e.n(a);const s=require("@mui/material/Menu");var c=e.n(s);const l=require("@mui/material/MenuItem");var u=e.n(l);const h=require("@mui/material/Typography");var m=e.n(h);const d=require("@mui/system/Box");var f=e.n(d);const p=require("@mui/system/useTheme");var y=e.n(p);const x=require("react"),g=require("recharts");var v;function j(e,t){return function(e,t){var r,n=new Date(e),i=navigator.language;return r=t===v.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(i,r)}(e,t<=1?v.HOUR:v.MONTH_DATE)}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(v||(v={}));var b=function(){return b=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},b.apply(this,arguments)};function C(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:b({},t),children:e.name})}var O=function(){return O=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},O.apply(this,arguments)},k={line:g.LineChart,bar:g.BarChart,area:g.AreaChart};function T(e){var t={};return e.forEach((function(e){t[e]=!0})),t}function A(e){var t=(0,x.useState)(e.defaultChartType||"line"),n=t[0],a=t[1],s=(0,x.useState)(null),l=s[0],h=s[1],d=(0,x.useState)(e.timeSeries),p=d[0],v=d[1],b=y()(),A=p.length>0?Object.keys(p[0]):[],S=A[0],L=A.slice(1),D=(0,x.useState)(T(L)),N=D[0],w=D[1];(0,x.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],e.timeSeries,!0);e.updatedData.forEach((function(e){t=t.concat(e.timeSeries),v(t)}))}}),[e.timeSeries,e.updatedData]);var M=k[n];function _(e){l?h(null):e&&h(e.currentTarget)}function q(t,r){return N[t]?e.chartColors[r%e.chartColors.length]:"grey"}function H(e){return N[e]?"none":"line-through"}if(0===p.length)return(0,r.jsx)(m(),{variant:"body2",children:"No data available"});var F,R,W,E,P=e.timeSeries[e.timeSeries.length-1],B=(F=e.timeSeries[0][S],R=P[S],W=new Date(F),E=new Date(R),Math.round(Math.abs((E.getTime()-W.getTime())/864e5)));return(0,r.jsxs)(f(),{className:"rustic-recharts-time-series",children:[!e.disableChartTypeToggle&&(0,r.jsxs)(i(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,r.jsx)(o(),{"aria-label":"chart options","aria-expanded":Boolean(l),"aria-haspopup":"true",onClick:_,color:"primary",children:(0,r.jsx)(C,{name:"more_vert"})}),(0,r.jsxs)(c(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:l,open:Boolean(l),onClose:function(e){return _(e)},children:[(0,r.jsx)(m(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(k).map((function(e){return(0,r.jsxs)(u(),{value:e,selected:e===n,onClick:function(){return function(e){a(e),_()}(e)},children:[e.charAt(0).toUpperCase()+e.slice(1)," ","Chart"]},e)}))]})]}),(0,r.jsxs)(f(),{children:[e.title&&(0,r.jsx)(m(),{variant:"subtitle2",className:"rustic-recharts-time-series-title",children:e.title}),e.description&&(0,r.jsx)(m(),{variant:"caption",className:"rustic-recharts-time-series-description",children:e.description}),(0,r.jsx)(g.ResponsiveContainer,{aspect:e.aspectRatio,width:e.width,maxHeight:e.maxHeight,minWidth:e.minChartWidth,children:(0,r.jsxs)(M,{data:p,margin:e.chartContainerMargin,children:[(0,r.jsx)(g.XAxis,{dataKey:S,tickFormatter:function(e){return j(e,B)},stroke:b.palette.text.primary}),(0,r.jsx)(g.YAxis,{domain:["auto","auto"],width:e.yAxisLabelWidth,tickFormatter:e.yAxisTickFormatter,stroke:b.palette.text.primary}),(0,r.jsx)(g.Tooltip,{labelFormatter:function(e){return[j(e,B)]},formatter:e.tooltipFormatter,contentStyle:{color:b.palette.common.black}}),(0,r.jsx)(g.Legend,{content:function(){return(0,r.jsx)(f(),{className:"rustic-recharts-time-series-legend",children:L.map((function(e,t){return(0,r.jsxs)(f(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=N[e]&&!L.find((function(t){return t!==e&&N[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(N)){for(var n={},i=0,a=L;i<a.length;i++){var o=a[i],s=o===e;n[o]=s}w(n)}else w(r?T(L):O(O({},N),((t={})[e]=!N[e],t)))}(e)},sx:{color:q(e,t)},children:[(0,r.jsx)(C,{name:"crop_16_9"}),(0,r.jsx)(m(),{variant:"body2",display:"inline",sx:{textDecorationLine:H(e)},children:e})]},t)}))})}}),L.map((function(t,i){return N[t]?function(t,i){var a=i%e.chartColors.length,o=N[t]?e.chartColors[a]:"transparent",s={onClick:e.onClick,cursor:"pointer"};switch(n){case"line":return(0,r.jsx)(g.Line,{type:"monotone",isAnimationActive:!1,dataKey:t,name:t,dot:!1,stroke:o,activeDot:e.onClick&&s},t);case"bar":return(0,r.jsx)(g.Bar,{dataKey:t,fill:o,onClick:e.onClick&&s.onClick,cursor:e.onClick&&s.cursor},t);case"area":return(0,r.jsxs)(x.Fragment,{children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("linearGradient",{id:"color".concat(t),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,r.jsx)("stop",{offset:"5%",stopColor:o,stopOpacity:.8}),(0,r.jsx)("stop",{offset:"95%",stopColor:o,stopOpacity:0})]})}),(0,r.jsx)(g.Area,{isAnimationActive:!1,dataKey:t,type:"monotone",stroke:o,fillOpacity:1,fill:"url(#color".concat(t,")"),activeDot:e.onClick&&s},t)]},t)}}(t,i):null})),e.referenceLineYAxis&&e.referenceLineYAxis.map((function(t,n){return(0,r.jsx)(g.ReferenceLine,{y:t,label:e.referenceLineLabel&&e.referenceLineLabel[n],stroke:e.referenceLineColor&&e.referenceLineColor[n],strokeDasharray:"3 3",ifOverflow:"extendDomain",strokeWidth:e.referenceLineStrokeWidth&&e.referenceLineStrokeWidth[n],isFront:!0},n)}))]})})]})]})}A.defaultProps={minChartWidth:200,maxHeight:600,yAxisLabelWidth:30,aspectRatio:16/9,disableChartTypeToggle:!1};const S=A;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,{default:()=>T});const r=require("react/jsx-runtime"),n=require("@mui/material/FormControl");var i=e.n(n);const a=require("@mui/material/IconButton");var o=e.n(a);const c=require("@mui/material/Menu");var s=e.n(c);const l=require("@mui/material/MenuItem");var u=e.n(l);const m=require("@mui/material/Typography");var h=e.n(m);const d=require("@mui/system/Box");var p=e.n(d);const f=require("@mui/system/useTheme");var y=e.n(f);const x=require("react"),v=require("recharts");var g;function j(e,t){return function(e,t){var r,n=new Date(e),i=navigator.language;return r=t===g.HOUR?{hour:"numeric",minute:"2-digit",hour12:!0}:{month:"short",day:"numeric"},n.toLocaleString(i,r)}(e,t<=1?g.HOUR:g.MONTH_DATE)}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(g||(g={}));var b=function(){return b=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},b.apply(this,arguments)};function O(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:b({},t),children:e.name})}var C=function(){return C=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},C.apply(this,arguments)},k={line:v.LineChart,bar:v.BarChart,area:v.AreaChart};function S(e){var t={};return e.forEach((function(e){t[e]=!0})),t}const T=function(e){var t=e.minChartWidth,n=void 0===t?200:t,a=e.maxHeight,c=void 0===a?600:a,l=e.yAxisLabelWidth,m=void 0===l?30:l,d=e.aspectRatio,f=void 0===d?16/9:d,g=e.disableChartTypeToggle,b=void 0!==g&&g,T=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["minChartWidth","maxHeight","yAxisLabelWidth","aspectRatio","disableChartTypeToggle"]),A=(0,x.useState)(T.defaultChartType||"line"),L=A[0],D=A[1],w=(0,x.useState)(null),N=w[0],M=w[1],_=(0,x.useState)(T.timeSeries),q=_[0],H=_[1],P=y()(),E=q.length>0?Object.keys(q[0]):[],F=E[0],R=E.slice(1),W=(0,x.useState)(S(R)),B=W[0],U=W[1];(0,x.useEffect)((function(){if(T.updatedData&&T.updatedData.length>0){var e=function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}([],T.timeSeries,!0);T.updatedData.forEach((function(t){e=e.concat(t.timeSeries),H(e)}))}}),[T.timeSeries,T.updatedData]);var K=k[L];function I(e){N?M(null):e&&M(e.currentTarget)}function Y(e,t){return B[e]?T.chartColors[t%T.chartColors.length]:"grey"}function z(e){return B[e]?"none":"line-through"}if(0===q.length)return(0,r.jsx)(h(),{variant:"body2",children:"No data available"});var G,X,J,Q,V=T.timeSeries[T.timeSeries.length-1],Z=(G=T.timeSeries[0][F],X=V[F],J=new Date(G),Q=new Date(X),Math.round(Math.abs((Q.getTime()-J.getTime())/864e5)));return(0,r.jsxs)(p(),{className:"rustic-recharts-time-series",children:[!b&&(0,r.jsxs)(i(),{className:"rustic-recharts-time-series-chart-toggle",children:[(0,r.jsx)(o(),{"aria-label":"chart options","aria-expanded":Boolean(N),"aria-haspopup":"true",onClick:I,color:"primary",children:(0,r.jsx)(O,{name:"more_vert"})}),(0,r.jsxs)(s(),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:N,open:Boolean(N),onClose:function(e){return I(e)},children:[(0,r.jsx)(h(),{className:"rustic-recharts-time-series-chart-toggle-title",children:"Chart Types:"}),Object.keys(k).map((function(e){return(0,r.jsxs)(u(),{value:e,selected:e===L,onClick:function(){return function(e){D(e),I()}(e)},children:[e.charAt(0).toUpperCase()+e.slice(1)," ","Chart"]},e)}))]})]}),(0,r.jsxs)(p(),{children:[T.title&&(0,r.jsx)(h(),{variant:"subtitle2",className:"rustic-recharts-time-series-title",children:T.title}),T.description&&(0,r.jsx)(h(),{variant:"caption",className:"rustic-recharts-time-series-description",children:T.description}),(0,r.jsx)(v.ResponsiveContainer,{aspect:f,width:T.width,maxHeight:c,minWidth:n,children:(0,r.jsxs)(K,{data:q,margin:T.chartContainerMargin,children:[(0,r.jsx)(v.XAxis,{dataKey:F,tickFormatter:function(e){return j(e,Z)},stroke:P.palette.text.primary}),(0,r.jsx)(v.YAxis,{domain:["auto","auto"],width:m,tickFormatter:T.yAxisTickFormatter,stroke:P.palette.text.primary}),(0,r.jsx)(v.Tooltip,{labelFormatter:function(e){return[j(e,Z)]},formatter:T.tooltipFormatter,contentStyle:{color:P.palette.common.black}}),(0,r.jsx)(v.Legend,{content:function(){return(0,r.jsx)(p(),{className:"rustic-recharts-time-series-legend",children:R.map((function(e,t){return(0,r.jsxs)(p(),{className:"rustic-recharts-time-series-legend-item",onClick:function(){return function(e){var t,r=B[e]&&!R.find((function(t){return t!==e&&B[t]}));if(function(e){return Object.values(e).every((function(e){return!0===e}))}(B)){for(var n={},i=0,a=R;i<a.length;i++){var o=a[i],c=o===e;n[o]=c}U(n)}else U(r?S(R):C(C({},B),((t={})[e]=!B[e],t)))}(e)},sx:{color:Y(e,t)},children:[(0,r.jsx)(O,{name:"crop_16_9"}),(0,r.jsx)(h(),{variant:"body2",display:"inline",sx:{textDecorationLine:z(e)},children:e})]},t)}))})}}),R.map((function(e,t){return B[e]?function(e,t){var n=t%T.chartColors.length,i=B[e]?T.chartColors[n]:"transparent",a={onClick:T.onClick,cursor:"pointer"};switch(L){case"line":return(0,r.jsx)(v.Line,{type:"monotone",isAnimationActive:!1,dataKey:e,name:e,dot:!1,stroke:i,activeDot:T.onClick&&a},e);case"bar":return(0,r.jsx)(v.Bar,{dataKey:e,fill:i,onClick:T.onClick&&a.onClick,cursor:T.onClick&&a.cursor},e);case"area":return(0,r.jsxs)(x.Fragment,{children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("linearGradient",{id:"color".concat(e),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,r.jsx)("stop",{offset:"5%",stopColor:i,stopOpacity:.8}),(0,r.jsx)("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),(0,r.jsx)(v.Area,{isAnimationActive:!1,dataKey:e,type:"monotone",stroke:i,fillOpacity:1,fill:"url(#color".concat(e,")"),activeDot:T.onClick&&a},e)]},e)}}(e,t):null})),T.referenceLineYAxis&&T.referenceLineYAxis.map((function(e,t){return(0,r.jsx)(v.ReferenceLine,{y:e,label:T.referenceLineLabel&&T.referenceLineLabel[t],stroke:T.referenceLineColor&&T.referenceLineColor[t],strokeDasharray:"3 3",ifOverflow:"extendDomain",strokeWidth:T.referenceLineStrokeWidth&&T.referenceLineStrokeWidth[t],isFront:!0},t)}))]})})]})]})};return t})()));
@@ -62,15 +62,6 @@ export type TimeSeriesType = 'line' | 'bar' | 'area';
62
62
  * npm i recharts
63
63
  * ```
64
64
  */
65
- declare function RechartsTimeSeries(props: RechartsTimeSeriesProps): import("react/jsx-runtime").JSX.Element;
66
- declare namespace RechartsTimeSeries {
67
- var defaultProps: {
68
- minChartWidth: number;
69
- maxHeight: number;
70
- yAxisLabelWidth: number;
71
- aspectRatio: number;
72
- disableChartTypeToggle: boolean;
73
- };
74
- }
65
+ declare function RechartsTimeSeries({ minChartWidth, maxHeight, yAxisLabelWidth, aspectRatio, disableChartTypeToggle, ...props }: RechartsTimeSeriesProps): import("react/jsx-runtime").JSX.Element;
75
66
  export default RechartsTimeSeries;
76
67
  //# sourceMappingURL=rechartsTimeSeries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rechartsTimeSeries.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/chart/rechartsTimeSeries.tsx"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAA;AA6BjC,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,2MAA2M;IAC3M,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,kKAAkK;IAClK,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,oPAAoP;IACpP,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,8HAA8H;IAC9H,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,qLAAqL;IACrL,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,2EAA2E;IAE3E,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACjC,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,WAAW,CAAC,EAAE;QAAE,UAAU,EAAE,cAAc,EAAE,CAAA;KAAE,EAAE,CAAA;IAChD,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,cAAc,CAAA;IACjC,iJAAiJ;IACjJ,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9C,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpE,uHAAuH;IACvH,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAuBpD;;;;;;;GAOG;AACH,iBAAS,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CA4TzD;kBA5TQ,kBAAkB;;;;;;;;;AAuU3B,eAAe,kBAAkB,CAAA"}
1
+ {"version":3,"file":"rechartsTimeSeries.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/chart/rechartsTimeSeries.tsx"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAA;AA6BjC,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,2MAA2M;IAC3M,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,kKAAkK;IAClK,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,oPAAoP;IACpP,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,8HAA8H;IAC9H,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,qLAAqL;IACrL,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,2EAA2E;IAE3E,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACjC,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,WAAW,CAAC,EAAE;QAAE,UAAU,EAAE,cAAc,EAAE,CAAA;KAAE,EAAE,CAAA;IAChD,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,cAAc,CAAA;IACjC,iJAAiJ;IACjJ,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9C,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpE,uHAAuH;IACvH,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAyBpD;;;;;;;GAOG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,aAAoC,EACpC,SAA4B,EAC5B,eAAwC,EAExC,WAAoB,EACpB,sBAA8B,EAC9B,GAAG,KAAK,EACT,EAAE,uBAAuB,2CAgUzB;AAED,eAAe,kBAAkB,CAAA"}
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>H});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var o=e.n(n);const a=require("@mui/system/Box");var i=e.n(a);const c=require("@mui/system/Stack");var s=e.n(c);const l=require("@mui/system/useTheme");var u=e.n(l);const d=require("react"),p=require("react-dom/server"),m=require("vega-embed");var f=e.n(m);const v=require("dompurify");var h=e.n(v);const b=require("marked");function x(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=b.marked.parse(t);return h().sanitize(r)}const y=function(e){var t=(0,d.useState)(x(e.text)),n=t[0],a=t[1];return(0,d.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(x(t))}}),[e.text,e.updatedData]),(0,r.jsx)(o(),{variant:"body2",dangerouslySetInnerHTML:{__html:n}})},j=require("@mui/material"),g=require("@mui/material/Button");var q=e.n(g);const w=require("@mui/material/Drawer");var k=e.n(w);const S=require("@mui/material/IconButton");var O=e.n(S);const F=require("@mui/material/ListItemText");var N=e.n(F);const D=require("@mui/material/Menu");var T=e.n(D);const P=require("@mui/material/MenuItem");var R=e.n(P);const C=require("@mui/material/styles"),I=require("@mui/material/Tooltip");var M=e.n(I);const L=require("@mui/system");var _=function(){return _=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function B(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:_({},t),children:e.name})}var z=function(){return z=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},z.apply(this,arguments)};function E(e){var t=(0,d.useState)(!1),n=t[0],a=t[1],i=(0,d.useRef)(null),c=(0,C.useTheme)(),s=(0,j.useMediaQuery)(c.breakpoints.down("md")),l=s?k():T(),u={borderRadius:"".concat(c.shape.borderRadius,"px"),border:"1px solid ".concat(c.palette.divider)};function p(e){return(0,r.jsxs)(r.Fragment,{children:[e.startDecorator&&(0,r.jsx)(L.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,r.jsx)(N(),{children:(0,r.jsx)(o(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,r.jsx)(L.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}s&&(u=z(z({},u),{borderRadius:"".concat(c.shape.borderRadius,"px ").concat(c.shape.borderRadius,"px 0 0"),borderBottom:0}));var m=e.menuItems.map((function(e){return e.href?(0,r.jsx)(R(),{component:"a",onClick:function(){return a(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,r.jsx)(R(),{onClick:function(t){e.onClick&&e.onClick(t),a(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var f,v,h=s?{}:{anchorEl:i.current};return(0,r.jsxs)(r.Fragment,{children:[(f={onClick:function(e){e.stopPropagation(),a(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,r.jsx)(B,{name:"more_vert"}),e.buttonText?(0,r.jsx)(q(),z({},f,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,r.jsx)(M(),{title:e.ariaLabel,children:(0,r.jsx)(O(),z({},f,{children:e.icon?e.icon:v}))})),(0,r.jsx)(l,z({open:n,onClose:function(){return a(!1)}},h,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":z(z({},u),{backgroundImage:"none",boxShadow:c.shadows[2]})},children:m}))]})}var A=function(){return A=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},A.apply(this,arguments)};function G(e){var t=(0,d.useRef)(null),n=(0,d.useState)(!1),a=n[0],c=n[1],l=u()(),m="dark"===l.palette.mode,v=l.typography.fontFamily,h={backgroundColor:l.palette.primary.main,color:l.palette.background.paper,borderRadius:l.shape.borderRadius+"px",padding:"4px 8px",fontSize:l.typography.caption.fontSize,fontFamily:v,fontWeight:l.typography.caption.fontWeight},b={formatTooltip:function(e,t){return(0,p.renderToStaticMarkup)((0,r.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:h,children:Object.entries(e).map((function(e){var n=e[0],o=e[1];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:[t(n),":"]})," ",t(o)]},n)}))}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},x=[{label:"Save as SVG"},{label:"Save as PNG"}];function j(){var r,n,o,a;if(t.current&&e.spec){var i=A(A({config:{font:v}},e.options),{theme:m?null===(r=e.theme)||void 0===r?void 0:r.dark:null===(n=e.theme)||void 0===n?void 0:n.light,tooltip:b,actions:!1});(null===(a=null===(o=e.options)||void 0===o?void 0:o.config)||void 0===a?void 0:a.font)||(i.config.font=v);var s=A({},e.spec);delete s.title,f()(t.current,s,i).then((function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map((function(n,o){var a="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,a).then((function(e){x[o].href=e,x[o].downloadFileName="".concat(r,".").concat(n)}))})),c(!1)})).catch((function(){c(!0)}))}}return(0,d.useEffect)((function(){function e(){j()}return j(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[e.spec,m]),a?(0,r.jsx)(o(),{variant:"body2",children:"Failed to load the chart."}):(0,r.jsxs)(s(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,r.jsx)(i(),{justifyContent:"end",display:"flex",children:(0,r.jsx)(E,{menuItems:x,ariaLabel:"Download options"})}),e.title&&(0,r.jsx)(o(),{variant:"h6",children:e.title}),e.description&&(0,r.jsx)(y,{text:e.description}),(0,r.jsxs)(i(),{textAlign:"center",mt:1,children:["string"==typeof e.spec.title&&(0,r.jsx)(o(),{variant:"subtitle2",children:e.spec.title}),e.spec.description&&(0,r.jsx)(o(),{variant:"caption",children:e.spec.description})]}),(0,r.jsx)("div",{ref:t,className:"rustic-vega-lite"})]})}const W=G;G.defaultProps={theme:{dark:"dark"}};const H=W;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,{default:()=>G});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var o=e.n(n);const a=require("@mui/system/Box");var i=e.n(a);const c=require("@mui/system/Stack");var s=e.n(c);const l=require("@mui/system/useTheme");var u=e.n(l);const d=require("react"),p=require("react-dom/server"),m=require("vega-embed");var f=e.n(m);const v=require("dompurify");var h=e.n(v);const b=require("marked");function y(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=b.marked.parse(t,{async:!1});return h().sanitize(r)}const x=function(e){var t=(0,d.useState)(y(e.text)),n=t[0],a=t[1];return(0,d.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(y(t))}}),[e.text,e.updatedData]),(0,r.jsx)(o(),{variant:"body2",dangerouslySetInnerHTML:{__html:n}})},j=require("@mui/material"),g=require("@mui/material/Button");var O=e.n(g);const w=require("@mui/material/Drawer");var q=e.n(w);const S=require("@mui/material/IconButton");var k=e.n(S);const F=require("@mui/material/ListItemText");var N=e.n(F);const P=require("@mui/material/Menu");var D=e.n(P);const T=require("@mui/material/MenuItem");var I=e.n(T);const R=require("@mui/material/styles"),C=require("@mui/material/Tooltip");var M=e.n(C);const L=require("@mui/system");var _=function(){return _=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function B(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:_({},t),children:e.name})}var E=function(){return E=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},E.apply(this,arguments)};function z(e){var t=(0,d.useState)(!1),n=t[0],a=t[1],i=(0,d.useRef)(null),c=(0,R.useTheme)(),s=(0,j.useMediaQuery)(c.breakpoints.down("md")),l=s?q():D(),u={borderRadius:"".concat(c.shape.borderRadius,"px"),border:"1px solid ".concat(c.palette.divider)};function p(e){return(0,r.jsxs)(r.Fragment,{children:[e.startDecorator&&(0,r.jsx)(L.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,r.jsx)(N(),{children:(0,r.jsx)(o(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,r.jsx)(L.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}s&&(u=E(E({},u),{borderRadius:"".concat(c.shape.borderRadius,"px ").concat(c.shape.borderRadius,"px 0 0"),borderBottom:0}));var m=e.menuItems.map((function(e){return e.href?(0,r.jsx)(I(),{component:"a",onClick:function(){return a(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,r.jsx)(I(),{onClick:function(t){e.onClick&&e.onClick(t),a(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var f,v,h=s?{}:{anchorEl:i.current};return(0,r.jsxs)(r.Fragment,{children:[(f={onClick:function(e){e.stopPropagation(),a(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,r.jsx)(B,{name:"more_vert"}),e.buttonText?(0,r.jsx)(O(),E({},f,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,r.jsx)(M(),{title:e.ariaLabel,children:(0,r.jsx)(k(),E({},f,{children:e.icon?e.icon:v}))})),(0,r.jsx)(l,E({open:n,onClose:function(){return a(!1)}},h,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":E(E({},u),{backgroundImage:"none",boxShadow:c.shadows[2]})},children:m}))]})}var A=function(){return A=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},A.apply(this,arguments)};const G=function(e){var t=e.theme,n=void 0===t?{dark:"dark"}:t,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["theme"]),c=(0,d.useRef)(null),l=(0,d.useState)(!1),m=l[0],v=l[1],h=u()(),b="dark"===h.palette.mode,y=h.typography.fontFamily,j={backgroundColor:h.palette.primary.main,color:h.palette.background.paper,borderRadius:h.shape.borderRadius+"px",padding:"4px 8px",fontSize:h.typography.caption.fontSize,fontFamily:y,fontWeight:h.typography.caption.fontWeight},g={formatTooltip:function(e,t){return(0,p.renderToStaticMarkup)((0,r.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:j,children:Object.entries(e).map((function(e){var n=e[0],o=e[1];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:[t(n),":"]})," ",t(o)]},n)}))}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},O=[{label:"Save as SVG"},{label:"Save as PNG"}];function w(){var e,t;if(c.current&&a.spec){var r=A(A({config:{font:y}},a.options),{theme:b?n.dark:n.light,tooltip:g,actions:!1});(null===(t=null===(e=a.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(r.config.font=y);var o=A({},a.spec);delete o.title,f()(c.current,o,r).then((function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map((function(n,o){var a="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,a).then((function(e){O[o].href=e,O[o].downloadFileName="".concat(r,".").concat(n)}))})),v(!1)})).catch((function(){v(!0)}))}}return(0,d.useEffect)((function(){function e(){w()}return w(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[a.spec,b]),m?(0,r.jsx)(o(),{variant:"body2",children:"Failed to load the chart."}):(0,r.jsxs)(s(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,r.jsx)(i(),{justifyContent:"end",display:"flex",children:(0,r.jsx)(z,{menuItems:O,ariaLabel:"Download options"})}),a.title&&(0,r.jsx)(o(),{variant:"h6",children:a.title}),a.description&&(0,r.jsx)(x,{text:a.description}),(0,r.jsxs)(i(),{textAlign:"center",mt:1,children:["string"==typeof a.spec.title&&(0,r.jsx)(o(),{variant:"subtitle2",children:a.spec.title}),a.spec.description&&(0,r.jsx)(o(),{variant:"caption",children:a.spec.description})]}),(0,r.jsx)("div",{ref:c,className:"rustic-vega-lite"})]})};return t})()));
@@ -8,13 +8,6 @@ import type { VegaLiteData } from './vegaLiteViz.types';
8
8
  * npm i vega-embed marked dompurify
9
9
  * ```
10
10
  */
11
- declare function VegaLiteViz(props: VegaLiteData): import("react/jsx-runtime").JSX.Element;
12
- declare namespace VegaLiteViz {
13
- var defaultProps: {
14
- theme: {
15
- dark: "dark";
16
- };
17
- };
18
- }
11
+ declare function VegaLiteViz({ theme, ...props }: VegaLiteData): import("react/jsx-runtime").JSX.Element;
19
12
  export default VegaLiteViz;
20
13
  //# sourceMappingURL=vegaLiteViz.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vegaLiteViz.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/vegaLiteViz/vegaLiteViz.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAa1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;;;;;;GAOG;AACH,iBAAS,WAAW,CAAC,KAAK,EAAE,YAAY,2CA+HvC;kBA/HQ,WAAW;;;;;;;AAiIpB,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"vegaLiteViz.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/vegaLiteViz/vegaLiteViz.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAa1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;;;;;;GAOG;AACH,iBAAS,WAAW,CAAC,EACnB,KAEC,EACD,GAAG,KAAK,EACT,EAAE,YAAY,2CA+Hd;AAED,eAAe,WAAW,CAAA"}