@rustic-ai/ui-components 0.0.40 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.d.ts +1 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/baseInput/baseInput.d.ts.map +1 -1
- package/dist/components/input/multimodal/multimodalInput/index.js +1 -1
- package/dist/components/input/multimodal/multimodalInput/multimodalInput.d.ts.map +1 -1
- package/dist/components/input/textInput/index.js +1 -1
- package/dist/components/input/textInput/textInput.d.ts.map +1 -1
- package/dist/components/multipart/chatCompletion/chatCompletion.d.ts.map +1 -1
- package/dist/components/multipart/chatCompletion/index.js +1 -1
- package/dist/components/multipart/downloadButton.d.ts +9 -0
- package/dist/components/multipart/downloadButton.d.ts.map +1 -0
- package/dist/components/multipart/multipart/index.js +1 -1
- package/dist/components/multipart/multipart/multipart.d.ts.map +1 -1
- package/dist/components/sharedDescription.d.ts +1 -0
- package/dist/components/sharedDescription.d.ts.map +1 -1
- package/dist/index.css +0 -40
- package/dist/index.js +1 -1
- package/package.json +2 -7
- package/dist/components/video/index.css +0 -49
- package/dist/components/video/index.d.ts +0 -3
- package/dist/components/video/index.d.ts.map +0 -1
- package/dist/components/video/index.js +0 -1
- package/dist/components/video/youtubeVideo.d.ts +0 -23
- package/dist/components/video/youtubeVideo.d.ts.map +0 -1
- package/dist/components/visualization/chart/index.css +0 -49
- package/dist/components/visualization/chart/index.d.ts +0 -4
- package/dist/components/visualization/chart/index.d.ts.map +0 -1
- package/dist/components/visualization/chart/index.js +0 -1
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts +0 -69
- package/dist/components/visualization/chart/rechartsTimeSeries.d.ts.map +0 -1
|
@@ -29,14 +29,12 @@ import Table from './table/table';
|
|
|
29
29
|
import StreamingText from './text/streamingText';
|
|
30
30
|
import Text from './text/text';
|
|
31
31
|
import Timestamp from './timestamp/timestamp';
|
|
32
|
-
import YoutubeVideo from './video/youtubeVideo';
|
|
33
|
-
import RechartsTimeSeries from './visualization/chart/rechartsTimeSeries';
|
|
34
32
|
import MermaidViz from './visualization/mermaidViz/mermaidViz';
|
|
35
33
|
import PerspectiveViz from './visualization/perspectiveViz/perspectiveViz';
|
|
36
34
|
import PlotlyGraph from './visualization/plotlyGraph/plotlyGraph';
|
|
37
35
|
import VegaLiteViz from './visualization/vegaLiteViz/vegaLiteViz';
|
|
38
36
|
import Weather from './weather/weather';
|
|
39
|
-
export { Action, ChatCompletion, CodeSnippet, CopyText, ElementRenderer, FCCalendar, Icon, Image, MarkedMarkdown, MarkedStreamingMarkdown, MermaidViz, MessageCanvas, MessageSpace, MultimodalInput, Multipart, OpenLayersMap, ParticipantsContainer, PDFViewer, PerspectiveViz, PlotlyGraph, PopoverMenu, PromptBuilder, Prompts, Question,
|
|
37
|
+
export { Action, ChatCompletion, CodeSnippet, CopyText, ElementRenderer, FCCalendar, Icon, Image, MarkedMarkdown, MarkedStreamingMarkdown, MermaidViz, MessageCanvas, MessageSpace, MultimodalInput, Multipart, OpenLayersMap, ParticipantsContainer, PDFViewer, PerspectiveViz, PlotlyGraph, PopoverMenu, PromptBuilder, Prompts, Question, Sound, StreamingText, Table, Text, TextInput, TextToSpeech, Timestamp, UniformsForm, Uploader, VegaLiteViz, Video, Weather, };
|
|
40
38
|
export * from '../rusticTheme';
|
|
41
39
|
export type * from './types';
|
|
42
40
|
export { ParticipantRole, ParticipantType } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,WAAW,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,eAAe,MAAM,mCAAmC,CAAA;AAC/D,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,eAAe,MAAM,oDAAoD,CAAA;AAChF,OAAO,QAAQ,MAAM,sCAAsC,CAAA;AAC3D,OAAO,SAAS,MAAM,6BAA6B,CAAA;AACnD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,cAAc,MAAM,2BAA2B,CAAA;AACtD,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAC5C,OAAO,QAAQ,MAAM,uCAAuC,CAAA;AAC5D,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAClD,OAAO,YAAY,MAAM,mDAAmD,CAAA;AAC5E,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,YAAY,MAAM,6BAA6B,CAAA;AACtD,OAAO,cAAc,MAAM,2CAA2C,CAAA;AACtE,OAAO,SAAS,MAAM,iCAAiC,CAAA;AACvD,OAAO,qBAAqB,MAAM,+CAA+C,CAAA;AACjF,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,OAAO,MAAM,mBAAmB,CAAA;AACvC,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,aAAa,MAAM,sBAAsB,CAAA;AAChD,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,WAAW,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,eAAe,MAAM,mCAAmC,CAAA;AAC/D,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,eAAe,MAAM,oDAAoD,CAAA;AAChF,OAAO,QAAQ,MAAM,sCAAsC,CAAA;AAC3D,OAAO,SAAS,MAAM,6BAA6B,CAAA;AACnD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,cAAc,MAAM,2BAA2B,CAAA;AACtD,OAAO,uBAAuB,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,KAAK,MAAM,qBAAqB,CAAA;AACvC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAC5C,OAAO,QAAQ,MAAM,uCAAuC,CAAA;AAC5D,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAClD,OAAO,YAAY,MAAM,mDAAmD,CAAA;AAC5E,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,YAAY,MAAM,6BAA6B,CAAA;AACtD,OAAO,cAAc,MAAM,2CAA2C,CAAA;AACtE,OAAO,SAAS,MAAM,iCAAiC,CAAA;AACvD,OAAO,qBAAqB,MAAM,+CAA+C,CAAA;AACjF,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,OAAO,MAAM,mBAAmB,CAAA;AACvC,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,aAAa,MAAM,sBAAsB,CAAA;AAChD,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,UAAU,MAAM,uCAAuC,CAAA;AAC9D,OAAO,cAAc,MAAM,+CAA+C,CAAA;AAC1E,OAAO,WAAW,MAAM,yCAAyC,CAAA;AACjE,OAAO,WAAW,MAAM,yCAAyC,CAAA;AACjE,OAAO,OAAO,MAAM,mBAAmB,CAAA;AAEvC,OAAO,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,QAAQ,EACR,eAAe,EACf,UAAU,EACV,IAAI,EACJ,KAAK,EACL,cAAc,EACd,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,OAAO,EACP,QAAQ,EACR,KAAK,EACL,aAAa,EACb,KAAK,EACL,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,OAAO,GACR,CAAA;AAED,cAAc,gBAAgB,CAAA;AAC9B,mBAAmB,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC1D,mBAAmB,6CAA6C,CAAA;AAChE,mBAAmB,+CAA+C,CAAA;AAClE,mBAAmB,+CAA+C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,oBAAoB,CAAA;AAmB3B,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"baseInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/baseInput/baseInput.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,oBAAoB,CAAA;AAmB3B,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAA;AA0evE,QAAA,MAAM,SAAS;;wCAA+B,CAAA;AAE9C,eAAe,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e,t,r={9767:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(8732),o=(r(2015),function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:o({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var a=Object.create(null);o.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var c=2&n&&r;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((e=>i[e]=()=>r[e]));return i.default=()=>r,o.d(a,i),a},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};o.r(a),o.d(a,{ParticipantRole:()=>Oe,ParticipantType:()=>Ce,default:()=>ke});var i=o(8732);const c=require("@mui/material/Box");var l=o.n(c);const s=require("@mui/material/styles");var u=o(2015);const d=require("uuid");var p;function f(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const m=require("@mui/material/Avatar");var h=o.n(m);const v=require("@mui/material/CircularProgress");var g=o.n(v);const x=require("@mui/material/IconButton");var b=o.n(x);const y=require("@mui/material/InputAdornment");var j=o.n(y);const w=require("@mui/material/MenuItem");var S=o.n(w);const O=require("@mui/material/MenuList");var C=o.n(O);const N=require("@mui/material/Popover");var F=o.n(N);const k=require("@mui/material/TextField");var P=o.n(k);const E=require("@mui/material/Tooltip");var I=o.n(E);const q=require("@mui/material/Typography");var A=o.n(q),T=o(8342),R=o(9767);const D=function(e){var t=(0,s.useTheme)(),r=(0,u.useRef)(null),n=(0,u.useRef)(null),a=(0,u.useState)(!1),c=a[0],l=a[1],d={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function p(){l(!1)}function f(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),p()}return(0,u.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(r){var o=new(0,r.Picker)({dataSource:e.dataSource}),a="dark"===t.palette.mode?"dark":"light";o.classList.add(a),Object.keys(d).forEach((function(e){o.style.setProperty(e,d[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",f),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",f)}}),[c,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(I(),{title:"Emoji",children:(0,i.jsx)(b(),{size:"small",ref:r,onClick:function(){l((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(R.A,{name:"Mood"})})}),n.current&&(0,i.jsx)(F(),{open:c,anchorEl:r.current,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,i.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var U={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function _(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function L(e){return(0,i.jsxs)(l(),{className:"rustic-participant-profile",children:[(0,i.jsx)(h(),{src:e.icon,className:"rustic-participant-avatar"}),(0,i.jsx)(A(),{variant:"body1Bold",children:e.displayName})]})}function z(e){var t=e.items,r=e.isOpen,n=e.onClose,o=e.onSelect,a=e.renderItem,c=e.anchorEl,l=e.selectedIndex;return(0,i.jsx)(F(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,i.jsx)(C(),{children:t.map((function(e,t){return(0,i.jsx)(S(),{onClick:function(){return o(e)},selected:t===l,children:a(e)},t)}))})})}const M=(0,u.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,o=e.fullWidth,a=void 0===o||o,c=e.maxRows,s=void 0===c?6:c,p=e.enableSpeechToText,m=void 0!==p&&p,h=e.maximumEmojiSearchResults,v=void 0===h?5:h,x=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),y=(0,u.useState)(""),w=y[0],S=y[1],O=(0,u.useState)(!1),C=O[0],N=O[1],F=(0,u.useState)(!1),k=F[0],E=F[1],q=(0,u.useState)(!1),M=q[0],B=q[1],H=(0,u.useState)(""),$=H[0],W=H[1],K=(0,u.useState)([]),G=K[0],Q=K[1],V=(0,u.useState)(!1),Y=V[0],Z=V[1],J=(0,u.useState)(0),X=J[0],ee=J[1],te=(0,u.useRef)(null),re=new T.Database({dataSource:x.emojiDataSource}),ne=!w.trim().length&&!x.isSendEnabled,oe="".concat(C?"Stop":"Start"," speech to text"),ae=k?"primary.main":"primary.light",ie=C?"error.main":ae,ce=C?"stop_circle":"speech_to_text",le=(0,u.useState)([]),se=le[0],ue=le[1],de=(0,u.useState)(!1),pe=de[0],fe=de[1];function me(e,t){if(te.current){var r=te.current,n=r.selectionStart,o=r.selectionEnd;if("number"==typeof n&&"number"==typeof o){var a,i=w||"",c=i.substring(0,n),l=i.substring(o),s=void 0;t?(s=c.replace(t,e)+l,a=c.replace(t,e).length):(s=c+e+l,a=n+e.length),S(s),setTimeout((function(){var e,t;null===(e=te.current)||void 0===e||e.focus(),null===(t=te.current)||void 0===t||t.setSelectionRange(a,a)}),0)}}}function he(e){me("@".concat(e," "),/@(\w*)$/),ue([])}function ve(e,t){void 0===t&&(t=!1),me(e,t?/:(\w+)$/:void 0),Z(!1)}var ge=M?(0,i.jsx)(g(),{size:24}):(0,i.jsx)(I(),{title:oe,children:(0,i.jsx)(b(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,C?(e.stop(),B(!0),N(!1)):(e.start(),W(""),N(!0)),e.onstart=function(){N(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;w.length>0?S(w+" "+r):S(r),null===(t=te.current)||void 0===t||t.focus(),N(!1)},e.onerror=function(e){var t=U[e.error];W(t),N(!1)},e.onend=function(){B(!1),N(!1)}},size:"small",sx:{color:ie,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(R.A,{name:ce})})});function xe(){var e=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:e,sender:x.sender,conversationId:x.conversationId,format:"chatCompletionRequest",data:f(w)};x.send(t),S(""),W("")}return(0,i.jsxs)(l(),{className:"rustic-base-input",ref:t,children:[(0,i.jsxs)(l(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(l(),{className:"rustic-error-container",children:(0,i.jsx)(A(),{variant:"caption",color:"error",className:"rustic-error-message",children:$})}),(0,i.jsxs)(l(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:k?"secondary.main":"action.disabled"},children:[G.length>0&&te.current&&(0,i.jsx)(z,{anchorEl:te.current,items:G.filter((function(e){return"unicode"in e})),isOpen:Y,onClose:function(){Z(!1),ee(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:X,renderItem:_}),se.length>0&&te.current&&(0,i.jsx)(z,{anchorEl:te.current,items:se,isOpen:pe,onClose:function(){fe(!1),ee(0)},onSelect:function(e){return he(e.displayName)},renderItem:L,selectedIndex:X}),(0,i.jsx)(P(),{className:"rustic-text-field",variant:"outlined",value:w,label:x.label,placeholder:x.placeholder,maxRows:s,multiline:n,fullWidth:a,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),Y&&G.length>0&&"unicode"in G[X]?ve(G[X].unicode,!0):pe&&se.length>0?he(se[X].displayName):e.shiftKey||ne||xe();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(Y?ee((function(e){return(e+t+G.length)%G.length})):pe&&ee((function(e){return(e+t+se.length)%se.length})));0!==X&&ee(0)}},onChange:function(e){W("");var t=e.target.value;S(t),function(e){var t=e.match(/@(\w*)$/);if(t&&x.getMembers){var r=t[1].toLowerCase();x.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));ue(t),t.length>0?fe(!0):fe(!1)}))}else ue([])}(t);var r,n=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(n){var a=n[0].replace(/:/g,"");re.getEmojiByShortcode(a).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);S(r)}else S(t)})).catch((function(){S(t)})),Z(!1)}else o?(r=o[0].replace(":",""),re.getEmojiBySearchQuery(r).then((function(e){e.length?(Q(e.slice(0,v)),Z(!0)):(Q([]),Z(!1))})).catch((function(){Q([]),Z(!1)}))):Z(!1)},onFocus:function(){return E(!0)},onBlur:function(){return E(!1)},inputRef:te,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,i.jsxs)(j(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(D,{dataSource:x.emojiDataSource,onEmojiClick:ve,buttonColor:ae}),m&&ge]})},inputLabel:{className:k?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(l(),{className:"rustic-input-actions",children:[x.children,(0,i.jsx)(I(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(b(),{"aria-label":"send message",onClick:xe,disabled:ne,color:"secondary",children:(0,i.jsx)(R.A,{name:"send"})})})})]})]})})),B=require("@mui/material/LinearProgress");var H=o.n(B);const $=require("axios");var W=o.n($);const K=require("react-dom"),G=require("@mui/material/Card");var Q=o.n(G);const V=require("@mui/material/Modal");var Y=o.n(V);const Z=require("@mui/material/useMediaQuery");var J=o.n(Z);const X=require("@mui/system/Stack");var ee=o.n(X);const te=require("@mui/system/useTheme");var re=o.n(te);const ne=require("pdfjs-dist"),oe=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,i.jsx)(I(),{title:r.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(b(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(R.A,{name:r.symbol})})})})};var ae={pdf:function(e){var t,r=(0,u.useRef)(null),n=(0,u.useState)(1),o=n[0],a=n[1],c=(0,u.useState)(1),s=c[0],d=c[1],p=(0,u.useState)(1),f=p[0],m=p[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],y=x[1],j=re()(),w=J()(j.breakpoints.down("sm")),S=J()(j.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(Q(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(A(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var O=(0,u.useState)((function(){return w?.5:S?1:1.5})),C=O[0],N=O[1];function F(t){ne.getDocument({url:e.url,httpHeaders:t}).promise.then((function(e){d(e.numPages),function(e){e.getPage(o).then((function(e){var t=e.getViewport({scale:C}),n=r.current;if(n){var o=n.getContext("2d");if(o){var a=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*a,n.height=t.height*a;var i={canvasContext:o,viewport:t,transform:[a,0,0,a,0,0]};b&&b.cancel();var c=e.render(i);y(c),c.promise.then((function(){y(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}return(0,u.useEffect)((function(){ne.GlobalWorkerOptions.workerSrc||(ne.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(ne.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then((function(e){return F(e.headers)})).catch((function(){return g(!0)})):F()}),[e.url,o,C]),v?(0,i.jsx)(Q(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(A(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(Q(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(l(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(oe,{action:"zoomOut",onClick:function(){N((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(oe,{action:"zoomIn",onClick:function(){N((function(e){return e+.2}))}})]}),(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:r})})}),(0,i.jsxs)(ee(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(oe,{action:"previousPage",onClick:function(){o>1&&(a(o-1),m(o-1))},isDisabled:1===o}),(0,i.jsx)(A(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(P(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);m(t),!isNaN(t)&&t>=1&&t<=s&&a(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(A(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,i.jsx)(oe,{action:"nextPage",onClick:function(){o<s&&(a(o+1),m(o+1))},isDisabled:o===s})]})]})}};function ie(e){var t=e.supportedViewers,r=void 0===t?ae:t,n=e.showFullName,o=void 0===n||n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["supportedViewers","showFullName"]),c=(0,s.useTheme)(),l=(0,u.useState)(!1),d=l[0],p=l[1];function f(){p(!1)}var m,h,v=a.file.url&&(m=a.file.url.split("."))[m.length-1].toLowerCase(),g=v&&r?r[v]:null,x=!!g,y=x?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(o?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=o?a.file.name:(h=a.file.name).length<=15?h:h.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(Q(),{className:j,variant:"outlined",sx:{boxShadow:c.shadows[1]},onClick:function(){p(!0)},children:[(0,i.jsx)(A(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:a.children})]}),x&&(0,i.jsx)(Y(),{open:d,onClose:f,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(I(),{title:"Close",children:(0,i.jsx)(b(),{onClick:f,className:"rustic-close-button",children:(0,i.jsx)(R.A,{name:"close"})})}),a.file.url&&(0,i.jsx)(g,{url:a.file.url,getAuthHeaders:a.getAuthHeaders})]})})]})}var ce=o(3110);const le=require("@mui/material"),se=require("@mui/material/Button");var ue=o.n(se);const de=require("@mui/material/Drawer");var pe=o.n(de);const fe=require("@mui/material/ListItemText");var me=o.n(fe);const he=require("@mui/material/Menu");var ve=o.n(he);const ge=require("@mui/system");var xe=function(){return xe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},xe.apply(this,arguments)};function be(e){var t=(0,u.useState)(!1),r=t[0],n=t[1],o=(0,u.useRef)(null),a=(0,s.useTheme)(),c=(0,le.useMediaQuery)(a.breakpoints.down("md")),l=c?pe():ve(),d={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(ge.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(me(),{children:(0,i.jsx)(A(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(ge.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(d=xe(xe({},d),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.shape.borderRadius,"px 0 0"),borderBottom:0}));var f=e.menuItems.map((function(e){return e.href?(0,i.jsx)(S(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(S(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var m,h,v=c?{}:{anchorEl:o.current};return(0,i.jsxs)(i.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:o,className:"rustic-popover-menu-button"},h=(0,i.jsx)(R.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(ue(),xe({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(I(),{title:e.ariaLabel,children:(0,i.jsx)(b(),xe({},m,{children:e.icon?e.icon:h}))})),(0,i.jsx)(l,xe({open:r,onClose:function(){return n(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":xe(xe({},d),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:f}))]})}var ye=function(){return ye=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ye.apply(this,arguments)},je=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};function we(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const Se=function(e){var t,r=(0,u.useState)([]),n=r[0],o=r[1],a=(0,u.useState)([]),c=a[0],s=a[1],p=(0,u.useState)({}),f=p[0],m=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();(0,u.useEffect)((function(){o([]),s([]),h.current={}}),[e.messageId]);var g=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function x(e,t,r){var n;h.current=ye(ye({},h.current),((n={})[e]=h.current[e]--,n)),function(e,t,r){s((function(t){return je(je([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)})),o((function(e){return e.filter((function(e){return e.id!==t}))}))}(e,t,r)}var y=(0,i.jsx)(l(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,i.jsx)(ie,{file:{name:t.name},showFullName:e.showFullName,children:(0,i.jsxs)(l(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,i.jsx)(H(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(I(),{title:"Delete",children:(0,i.jsx)(b(),{color:"primary",onClick:function(){return function(t,r){var n,a;s([]);var i=t.name;if(h.current=ye(ye({},h.current),((n={})[i]=h.current[i]--,n)),e.onFileUpdate("remove",i),100===t.loadingProgress){var c="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);g.then((function(t){W().delete(c,ye({},t)).then((function(){return o((function(e){return e.filter((function(e,t){return t!==r}))}))})).catch((function(){return e.onFileUpdate("add",i),s((function(e){return je(je([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)}))}))}))}else t.abortController.abort(),o((function(e){return e.filter((function(e,t){return t!==r}))})),h.current=ye(ye({},h.current),((a={})[i]=h.current[i]++,a))}(t,r)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},r)}))}),j=(0,i.jsx)(l(),{children:c.map((function(e,t){return(0,i.jsx)(A(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function w(e,t){return t?(0,K.createPortal)(e,t):e}var S=null===(t=e.uploadOptions)||void 0===t?void 0:t.map((function(t){return{label:t.label,onClick:function(){return function(t){m(t.metadata);var r=document.getElementById(v);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,i.jsx)(ce.default,{name:t.iconName})}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==S?void 0:S.length)?(0,i.jsx)(be,{ariaLabel:"Upload",icon:(0,i.jsx)(ce.default,{name:"upload_2"}),menuItems:S}):(0,i.jsx)(I(),{title:"Upload",children:(0,i.jsx)(b(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,i.jsx)("input",{type:"file",id:v,onChange:function(t){s([]);var r=t.target.files&&Array.from(t.target.files),a=n.length+(r?r.length:0);e.maxFileCount&&a>e.maxFileCount&&s((function(t){return je(je([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var i=r&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(r,a,e.maxFileCount);i&&i.forEach((function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,s((function(t){return je(je([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&we(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,a=function(e){var t,r,n=e.name,o=h.current[n];if(o){var a=o+1,i=n.lastIndexOf("."),c=n.substring(0,i),l=n.substring(i);n="".concat(c,"(").concat(o,")").concat(l),h.current=ye(ye({},h.current),((t={})[e.name]=a,t))}else h.current=ye(ye({},h.current),((r={})[e.name]=1,r));return n}(t),i=new File([t],a,{type:t.type});if(e.getUploadData||f){var c=e.getUploadData?e.getUploadData(a):{},l=ye(ye({},c),f);Object.keys(l).forEach((function(e){var t=l[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)}))}r.append("file",i);var s=(0,d.v4)(),u={name:a,loadingProgress:0,abortController:n,id:s};function p(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=u.id,o((function(e){var n=e.map((function(e){return e.id===r?ye(ye({},e),{loadingProgress:t}):e}));return n})))}o((function(e){return je(je([],e,!0),[u],!1)})),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function i(){return g.then((function(c){return W().post(m,r,ye(ye({},c),{onUploadProgress:p,signal:n.signal})).then((function(t){var n,a,i=r.get("file");t.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,t.data.url),t.data.fileId&&(n=t.data,a=u.id,o((function(e){var t=e.findIndex((function(e){return e.id===a}));if(-1!==t){var r=je([],e,!0);return r[t]=ye(ye({},r[t]),{id:n.fileId}),r}return e})))})).catch((function(n){var c,l,d=r.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,f,m,h;409===(null===(c=n.response)||void 0===c?void 0:c.status)&&e.listFiles?(p=a.lastIndexOf("."),f=a.substring(0,p),m=a.substring(p),h=new RegExp("^".concat(f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(m,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var t=0,r=0,n=e;r<n.length;r++){var o=n[r];if(h.test(o.name)){var a=o.name.match(h),i=a&&a[1]?parseInt(a[1].slice(1,-1),10):0;t=Math.max(t,i)}}return"".concat(f,"(").concat(t+1,")").concat(m)})):Promise.resolve(a)).then((function(n){e.onFileUpdate("add",n);var a=new File([t],n,{type:t.type});r.set("file",a),o((function(e){return e.map((function(e){return e.id===s?ye(ye({},e),{name:n,loadingProgress:0}):e}))})),i()})).catch((function(){var e;x(t.name,u.id,null===(e=n.response)||void 0===e?void 0:e.data)})):x(t.name,u.id,null===(l=n.response)||void 0===l?void 0:l.data)}))}))}()}(t)}(t)})),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&w(j,e.errorMessagesContainer),n.length>0&&w(y,e.filePreviewsContainer)]})};var Oe,Ce,Ne=function(){return Ne=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ne.apply(this,arguments)},Fe=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};!function(e){e.Owner="owner",e.Member="member"}(Oe||(Oe={})),function(e){e.Human="human",e.Agent="agent"}(Ce||(Ce={}));const ke=function(e){var t=e.maxFileSize,r=void 0===t?2097152:t,n=e.maxFileCount,o=void 0===n?1:n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["maxFileSize","maxFileCount"]),c=(0,u.useState)({uploaded:[],fileList:[]}),p=c[0],m=c[1],h=(0,u.useState)((0,d.v4)()),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],y=x[1],j=(0,u.useState)(),w=j[0],S=j[1],O=(0,u.useRef)(null),C=(0,s.useTheme)(),N=p.uploaded.length===p.fileList.length&&p.uploaded.length>0;return(0,u.useEffect)((function(){O.current&&(S(O.current.querySelector(".rustic-error-container")),y(O.current.querySelector(".rustic-input-extras")))})),(0,i.jsx)(l(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(C.palette.action.disabled),borderRadius:"".concat(C.shape.borderRadius,"px"),":focus-within":{borderColor:C.palette.secondary.main},background:C.palette.background.paper},children:(0,i.jsx)(M,Ne({},a,{send:function(e){N&&(e.id=v,e.format="chatCompletionRequest",e.data=f(e.data.text,p.uploaded.map((function(e){return{url:e.url,name:e.name}})))),a.ws.send(e),g((0,d.v4)()),m({uploaded:[],fileList:[]})},isSendEnabled:N,ref:O,children:(0,i.jsx)(l(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(Se,{acceptedFileTypes:a.acceptedFileTypes,maxFileCount:o,maxFileSize:r,uploadFileEndpoint:a.uploadFileEndpoint,deleteFileEndpoint:a.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)m((function(e){return Ne(Ne({},e),{fileList:Fe(Fe([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");m((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),o=Fe(Fe(Fe([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Ne(Ne({},e),{uploaded:o})}))}else m((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:v,filePreviewsContainer:b,errorMessagesContainer:w,showFullName:a.showFullName,getUploadData:a.getUploadData,uploadOptions:a.uploadOptions,listFiles:a.listFiles,getUploadHeaders:a.getUploadHeaders})})}))})};return a})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e,t,r={9767:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(8732),o=(r(2015),function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)});function a(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,n.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:o({},t),children:e.name})}},3110:(e,t,r)=>{r.d(t,{default:()=>n});const n=r(9767).A},8342:e=>{e.exports=require("emoji-picker-element")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var a=Object.create(null);o.r(a);var i={};e=e||[null,t({}),t([]),t(t)];for(var c=2&n&&r;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((e=>i[e]=()=>r[e]));return i.default=()=>r,o.d(a,i),a},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};o.r(a),o.d(a,{ParticipantRole:()=>Se,ParticipantType:()=>Oe,default:()=>Fe});var i=o(8732);const c=require("@mui/material/Box");var l=o.n(c);const s=require("@mui/material/styles");var u=o(2015);const d=require("uuid");var p;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(p||(p={}));const f=require("@mui/material/Avatar");var m=o.n(f);const h=require("@mui/material/CircularProgress");var v=o.n(h);const g=require("@mui/material/IconButton");var x=o.n(g);const b=require("@mui/material/InputAdornment");var y=o.n(b);const j=require("@mui/material/MenuItem");var w=o.n(j);const S=require("@mui/material/MenuList");var O=o.n(S);const N=require("@mui/material/Popover");var C=o.n(N);const F=require("@mui/material/TextField");var k=o.n(F);const P=require("@mui/material/Tooltip");var E=o.n(P);const I=require("@mui/material/Typography");var q=o.n(I),A=o(8342),T=o(9767);const R=function(e){var t=(0,s.useTheme)(),r=(0,u.useRef)(null),n=(0,u.useRef)(null),a=(0,u.useState)(!1),c=a[0],l=a[1],d={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function p(){l(!1)}function f(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),p()}return(0,u.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(r){var o=new(0,r.Picker)({dataSource:e.dataSource}),a="dark"===t.palette.mode?"dark":"light";o.classList.add(a),Object.keys(d).forEach((function(e){o.style.setProperty(e,d[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,u.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",f),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",f)}}),[c,e.onEmojiClick]),(0,i.jsxs)("div",{children:[(0,i.jsx)(E(),{title:"Emoji",children:(0,i.jsx)(x(),{size:"small",ref:r,onClick:function(){l((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:"Mood"})})}),n.current&&(0,i.jsx)(C(),{open:c,anchorEl:r.current,onClose:p,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,i.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var D={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function L(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function U(e){return(0,i.jsxs)(l(),{className:"rustic-participant-profile",children:[(0,i.jsx)(m(),{src:e.icon,className:"rustic-participant-avatar"}),(0,i.jsx)(q(),{variant:"body1Bold",children:e.displayName})]})}function _(e){var t=e.items,r=e.isOpen,n=e.onClose,o=e.onSelect,a=e.renderItem,c=e.anchorEl,l=e.selectedIndex;return(0,i.jsx)(C(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,i.jsx)(O(),{children:t.map((function(e,t){return(0,i.jsx)(w(),{onClick:function(){return o(e)},selected:t===l,children:a(e)},t)}))})})}const z=(0,u.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,o=e.fullWidth,a=void 0===o||o,c=e.maxRows,s=void 0===c?6:c,p=e.enableSpeechToText,f=void 0!==p&&p,m=e.maximumEmojiSearchResults,h=void 0===m?5:m,g=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,u.useState)(""),j=b[0],w=b[1],S=(0,u.useState)(!1),O=S[0],N=S[1],C=(0,u.useState)(!1),F=C[0],P=C[1],I=(0,u.useState)(!1),z=I[0],M=I[1],B=(0,u.useState)(""),H=B[0],$=B[1],W=(0,u.useState)([]),K=W[0],G=W[1],Q=(0,u.useState)(!1),V=Q[0],Y=Q[1],Z=(0,u.useState)(0),J=Z[0],X=Z[1],ee=(0,u.useRef)(null),te=new A.Database({dataSource:g.emojiDataSource}),re=!j.trim().length,ne="".concat(O?"Stop":"Start"," speech to text"),oe=F?"primary.main":"primary.light",ae=O?"error.main":oe,ie=O?"stop_circle":"speech_to_text",ce=(0,u.useState)([]),le=ce[0],se=ce[1],ue=(0,u.useState)(!1),de=ue[0],pe=ue[1];function fe(){return"boolean"==typeof g.isSendEnabled?!g.isSendEnabled:re}function me(e,t){if(ee.current){var r=ee.current,n=r.selectionStart,o=r.selectionEnd;if("number"==typeof n&&"number"==typeof o){var a,i=j||"",c=i.substring(0,n),l=i.substring(o),s=void 0;t?(s=c.replace(t,e)+l,a=c.replace(t,e).length):(s=c+e+l,a=n+e.length),w(s),setTimeout((function(){var e,t;null===(e=ee.current)||void 0===e||e.focus(),null===(t=ee.current)||void 0===t||t.setSelectionRange(a,a)}),0)}}}function he(e){me("@".concat(e," "),/@(\w*)$/),se([])}function ve(e,t){void 0===t&&(t=!1),me(e,t?/:(\w+)$/:void 0),Y(!1)}var ge=z?(0,i.jsx)(v(),{size:24}):(0,i.jsx)(E(),{title:ne,children:(0,i.jsx)(x(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,O?(e.stop(),M(!0),N(!1)):(e.start(),$(""),N(!0)),e.onstart=function(){N(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;j.length>0?w(j+" "+r):w(r),null===(t=ee.current)||void 0===t||t.focus(),N(!1)},e.onerror=function(e){var t=D[e.error];$(t),N(!1)},e.onend=function(){M(!1),N(!1)}},size:"small",sx:{color:ae,"&:hover":{color:"primary.main"}},children:(0,i.jsx)(T.A,{name:ie})})});function xe(){var e=(new Date).toISOString(),t={id:(0,d.v4)(),timestamp:e,sender:g.sender,conversationId:g.conversationId,format:"chatCompletionRequest",data:{text:j}};g.send(t),w(""),$("")}return(0,i.jsxs)(l(),{className:"rustic-base-input",ref:t,children:[(0,i.jsxs)(l(),{className:"rustic-error-and-input-container",children:[(0,i.jsx)(l(),{className:"rustic-error-container",children:(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:H})}),(0,i.jsxs)(l(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:F?"secondary.main":"action.disabled"},children:[K.length>0&&ee.current&&(0,i.jsx)(_,{anchorEl:ee.current,items:K.filter((function(e){return"unicode"in e})),isOpen:V,onClose:function(){Y(!1),X(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:J,renderItem:L}),le.length>0&&ee.current&&(0,i.jsx)(_,{anchorEl:ee.current,items:le,isOpen:de,onClose:function(){pe(!1),X(0)},onSelect:function(e){return he(e.displayName)},renderItem:U,selectedIndex:J}),(0,i.jsx)(k(),{className:"rustic-text-field",variant:"outlined",value:j,label:g.label,placeholder:g.placeholder,maxRows:s,multiline:n,fullWidth:a,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),V&&K.length>0&&"unicode"in K[J]?ve(K[J].unicode,!0):de&&le.length>0?he(le[J].displayName):e.shiftKey||fe()||xe();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(V?X((function(e){return(e+t+K.length)%K.length})):de&&X((function(e){return(e+t+le.length)%le.length})));0!==J&&X(0)}},onChange:function(e){$("");var t=e.target.value;w(t),function(e){var t=e.match(/@(\w*)$/);if(t&&g.getMembers){var r=t[1].toLowerCase();g.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));se(t),t.length>0?pe(!0):pe(!1)}))}else se([])}(t);var r,n=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(n){var a=n[0].replace(/:/g,"");te.getEmojiByShortcode(a).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);w(r)}else w(t)})).catch((function(){w(t)})),Y(!1)}else o?(r=o[0].replace(":",""),te.getEmojiBySearchQuery(r).then((function(e){e.length?(G(e.slice(0,h)),Y(!0)):(G([]),Y(!1))})).catch((function(){G([]),Y(!1)}))):Y(!1)},onFocus:function(){return P(!0)},onBlur:function(){return P(!1)},inputRef:ee,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,i.jsxs)(y(),{position:"end",className:"rustic-input-adornment",children:[(0,i.jsx)(R,{dataSource:g.emojiDataSource,onEmojiClick:ve,buttonColor:oe}),f&&ge]})},inputLabel:{className:F?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,i.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,i.jsxs)(l(),{className:"rustic-input-actions",children:[g.children,(0,i.jsx)(E(),{title:"Send",children:(0,i.jsx)("span",{className:"rustic-send-button",children:(0,i.jsx)(x(),{"aria-label":"send message",onClick:xe,disabled:fe(),color:"secondary",children:(0,i.jsx)(T.A,{name:"send"})})})})]})]})})),M=require("@mui/material/LinearProgress");var B=o.n(M);const H=require("axios");var $=o.n(H);const W=require("react-dom"),K=require("@mui/material/Card");var G=o.n(K);const Q=require("@mui/material/Modal");var V=o.n(Q);const Y=require("@mui/material/useMediaQuery");var Z=o.n(Y);const J=require("@mui/system/Stack");var X=o.n(J);const ee=require("@mui/system/useTheme");var te=o.n(ee);const re=require("pdfjs-dist"),ne=function(e){var t={zoomIn:{symbol:"zoom_in",label:"Zoom in"},zoomOut:{symbol:"zoom_out",label:"Zoom out"},close:{symbol:"close",label:"Close"},previousPage:{symbol:"arrow_back",label:"Previous page"},nextPage:{symbol:"arrow_forward",label:"Next page"}},r=(t[e.action].label.replaceAll(" ","-").toLowerCase(),t[e.action]);return(0,i.jsx)(E(),{title:r.label,children:(0,i.jsx)("span",{children:(0,i.jsx)(x(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,i.jsx)(T.A,{name:r.symbol})})})})};var oe={pdf:function(e){var t,r=(0,u.useRef)(null),n=(0,u.useState)(1),o=n[0],a=n[1],c=(0,u.useState)(1),s=c[0],d=c[1],p=(0,u.useState)(1),f=p[0],m=p[1],h=(0,u.useState)(!1),v=h[0],g=h[1],x=(0,u.useState)(),b=x[0],y=x[1],j=te()(),w=Z()(j.breakpoints.down("sm")),S=Z()(j.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,i.jsx)(G(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var O=(0,u.useState)((function(){return w?.5:S?1:1.5})),N=O[0],C=O[1];function F(t){re.getDocument({url:e.url,httpHeaders:t}).promise.then((function(e){d(e.numPages),function(e){e.getPage(o).then((function(e){var t=e.getViewport({scale:N}),n=r.current;if(n){var o=n.getContext("2d");if(o){var a=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*a,n.height=t.height*a;var i={canvasContext:o,viewport:t,transform:[a,0,0,a,0,0]};b&&b.cancel();var c=e.render(i);y(c),c.promise.then((function(){y(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){g(!0)}))}return(0,u.useEffect)((function(){re.GlobalWorkerOptions.workerSrc||(re.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(re.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then((function(e){return F(e.headers)})).catch((function(){return g(!0)})):F()}),[e.url,o,N]),v?(0,i.jsx)(G(),{variant:"outlined",className:"rustic-pdf-error",children:(0,i.jsx)(q(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,i.jsxs)(G(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,i.jsxs)(l(),{className:"rustic-pdf-viewer-header",children:[(0,i.jsx)(ne,{action:"zoomOut",onClick:function(){C((function(e){return Math.max(e-.2,.2)}))}}),(0,i.jsx)(ne,{action:"zoomIn",onClick:function(){C((function(e){return e+.2}))}})]}),(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body",children:(0,i.jsx)(l(),{className:"rustic-pdf-viewer-body-inner",children:(0,i.jsx)("canvas",{ref:r})})}),(0,i.jsxs)(X(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,i.jsx)(ne,{action:"previousPage",onClick:function(){o>1&&(a(o-1),m(o-1))},isDisabled:1===o}),(0,i.jsx)(q(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,i.jsx)(k(),{type:"number",value:f,onChange:function(e){var t=parseInt(e.target.value);m(t),!isNaN(t)&&t>=1&&t<=s&&a(t)},size:"small",className:"rustic-pdf-page-input"}),(0,i.jsxs)(q(),{variant:"body1",className:"rustic-page-indicator",children:["of ",s]}),(0,i.jsx)(ne,{action:"nextPage",onClick:function(){o<s&&(a(o+1),m(o+1))},isDisabled:o===s})]})]})}};function ae(e){var t=e.supportedViewers,r=void 0===t?oe:t,n=e.showFullName,o=void 0===n||n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["supportedViewers","showFullName"]),c=(0,s.useTheme)(),l=(0,u.useState)(!1),d=l[0],p=l[1];function f(){p(!1)}var m,h,v=a.file.url&&(m=a.file.url.split("."))[m.length-1].toLowerCase(),g=v&&r?r[v]:null,b=!!g,y=b?" rustic-cursor-pointer":"",j="rustic-file-preview ".concat(o?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(y),w=o?a.file.name:(h=a.file.name).length<=15?h:h.substring(0,12)+"...";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(G(),{className:j,variant:"outlined",sx:{boxShadow:c.shadows[1]},onClick:function(){p(!0)},children:[(0,i.jsx)(q(),{variant:"subtitle2",className:"rustic-file-preview-name",children:w}),(0,i.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:a.children})]}),b&&(0,i.jsx)(V(),{open:d,onClose:f,className:"rustic-file-preview-modal",children:(0,i.jsxs)("div",{className:"rustic-modal-content",children:[(0,i.jsx)(E(),{title:"Close",children:(0,i.jsx)(x(),{onClick:f,className:"rustic-close-button",children:(0,i.jsx)(T.A,{name:"close"})})}),a.file.url&&(0,i.jsx)(g,{url:a.file.url,getAuthHeaders:a.getAuthHeaders})]})})]})}var ie=o(3110);const ce=require("@mui/material"),le=require("@mui/material/Button");var se=o.n(le);const ue=require("@mui/material/Drawer");var de=o.n(ue);const pe=require("@mui/material/ListItemText");var fe=o.n(pe);const me=require("@mui/material/Menu");var he=o.n(me);const ve=require("@mui/system");var ge=function(){return ge=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ge.apply(this,arguments)};function xe(e){var t=(0,u.useState)(!1),r=t[0],n=t[1],o=(0,u.useRef)(null),a=(0,s.useTheme)(),c=(0,ce.useMediaQuery)(a.breakpoints.down("md")),l=c?de():he(),d={borderRadius:"".concat(a.shape.borderRadius,"px"),border:"1px solid ".concat(a.palette.divider)};function p(e){return(0,i.jsxs)(i.Fragment,{children:[e.startDecorator&&(0,i.jsx)(ve.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,i.jsx)(fe(),{children:(0,i.jsx)(q(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,i.jsx)(ve.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(d=ge(ge({},d),{borderRadius:"".concat(a.shape.borderRadius,"px ").concat(a.shape.borderRadius,"px 0 0"),borderBottom:0}));var f=e.menuItems.map((function(e){return e.href?(0,i.jsx)(w(),{component:"a",onClick:function(){return n(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:p(e)},e.label):(0,i.jsx)(w(),{onClick:function(t){e.onClick&&e.onClick(t),n(!1)},disabled:!e.onClick,children:p(e)},e.label)}));var m,h,v=c?{}:{anchorEl:o.current};return(0,i.jsxs)(i.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),n(!0)},"aria-label":e.ariaLabel,ref:o,className:"rustic-popover-menu-button"},h=(0,i.jsx)(T.A,{name:"more_vert"}),e.buttonText?(0,i.jsx)(se(),ge({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,i.jsx)(E(),{title:e.ariaLabel,children:(0,i.jsx)(x(),ge({},m,{children:e.icon?e.icon:h}))})),(0,i.jsx)(l,ge({open:r,onClose:function(){return n(!1)}},v,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":ge(ge({},d),{backgroundImage:"none",boxShadow:a.shadows[2]})},children:f}))]})}var be=function(){return be=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},be.apply(this,arguments)},ye=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};function je(e){for(var t=["Bytes","KB","MB","GB"],r=0;e>=1024&&r<t.length-1;)e/=1024,r++;var n=e.toFixed(1).toString().replace(/\.0$/,"");return"".concat(n," ").concat(t[r])}const we=function(e){var t,r=(0,u.useState)([]),n=r[0],o=r[1],a=(0,u.useState)([]),c=a[0],s=a[1],p=(0,u.useState)({}),f=p[0],m=p[1],h=(0,u.useRef)({}),v=(0,d.v4)();(0,u.useEffect)((function(){o([]),s([]),h.current={}}),[e.messageId]);var g=e.getUploadHeaders?e.getUploadHeaders():Promise.resolve({headers:{}});function b(e,t,r){var n;h.current=be(be({},h.current),((n={})[e]=h.current[e]--,n)),function(e,t,r){s((function(t){return ye(ye([],t,!0),["Failed to upload ".concat(e,". ").concat((null==r?void 0:r.message)||"")],!1)})),o((function(e){return e.filter((function(e){return e.id!==t}))}))}(e,t,r)}var y=(0,i.jsx)(l(),{className:"rustic-files rustic-padding-16",children:n.map((function(t,r){return(0,i.jsx)(ae,{file:{name:t.name},showFullName:e.showFullName,children:(0,i.jsxs)(l(),{className:"rustic-flex-center",children:[t.loadingProgress<100&&(0,i.jsx)(B(),{variant:"determinate",color:"secondary",value:t.loadingProgress,className:"rustic-upload-progress"}),(0,i.jsx)(E(),{title:"Delete",children:(0,i.jsx)(x(),{color:"primary",onClick:function(){return function(t,r){var n,a;s([]);var i=t.name;if(h.current=be(be({},h.current),((n={})[i]=h.current[i]--,n)),e.onFileUpdate("remove",i),100===t.loadingProgress){var c="".concat(e.deleteFileEndpoint).replaceAll("fileName",i).replaceAll("messageId",e.messageId).replaceAll("fileId",t.id);g.then((function(t){$().delete(c,be({},t)).then((function(){return o((function(e){return e.filter((function(e,t){return t!==r}))}))})).catch((function(){return e.onFileUpdate("add",i),s((function(e){return ye(ye([],e,!0),["Failed to delete ".concat(i,". Please try again.")],!1)}))}))}))}else t.abortController.abort(),o((function(e){return e.filter((function(e,t){return t!==r}))})),h.current=be(be({},h.current),((a={})[i]=h.current[i]++,a))}(t,r)},className:"rustic-delete-button rustic-shift-to-right-by-8","aria-label":"cancel file upload",children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"cancel"})})})]})},r)}))}),j=(0,i.jsx)(l(),{children:c.map((function(e,t){return(0,i.jsx)(q(),{variant:"caption",color:"error",className:"rustic-error-message",children:e},t)}))});function w(e,t){return t?(0,W.createPortal)(e,t):e}var S=null===(t=e.uploadOptions)||void 0===t?void 0:t.map((function(t){return{label:t.label,onClick:function(){return function(t){m(t.metadata);var r=document.getElementById(v);r&&(r.accept=t.acceptedFileTypes||e.acceptedFileTypes),r.click()}(t)},startDecorator:t.iconName&&(0,i.jsx)(ie.default,{name:t.iconName})}}));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l(),{className:"rustic-uploader",children:[(0,i.jsx)("label",{htmlFor:v,children:(null==S?void 0:S.length)?(0,i.jsx)(xe,{ariaLabel:"Upload",icon:(0,i.jsx)(ie.default,{name:"upload_2"}),menuItems:S}):(0,i.jsx)(E(),{title:"Upload",children:(0,i.jsx)(x(),{component:"span","aria-label":"Upload file",sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,i.jsx)("span",{className:"material-symbols-rounded",children:"upload_2"})})})}),(0,i.jsx)("input",{type:"file",id:v,onChange:function(t){s([]);var r=t.target.files&&Array.from(t.target.files),a=n.length+(r?r.length:0);e.maxFileCount&&a>e.maxFileCount&&s((function(t){return ye(ye([],t,!0),["You can only upload ".concat(e.maxFileCount," files.")],!1)}));var i=r&&function(e,t,r){return r?t<=r?e:e.slice(0,r-t):e}(r,a,e.maxFileCount);i&&i.forEach((function(t){!function(t){var r;e.maxFileSize&&t.size>e.maxFileSize?(r=t.name,s((function(t){return ye(ye([],t,!0),["Failed to upload ".concat(r,". You cannot upload files larger than ").concat(e.maxFileSize&&je(e.maxFileSize),".")],!1)}))):function(t){var r=new FormData,n=new AbortController,a=function(e){var t,r,n=e.name,o=h.current[n];if(o){var a=o+1,i=n.lastIndexOf("."),c=n.substring(0,i),l=n.substring(i);n="".concat(c,"(").concat(o,")").concat(l),h.current=be(be({},h.current),((t={})[e.name]=a,t))}else h.current=be(be({},h.current),((r={})[e.name]=1,r));return n}(t),i=new File([t],a,{type:t.type});if(e.getUploadData||f){var c=e.getUploadData?e.getUploadData(a):{},l=be(be({},c),f);Object.keys(l).forEach((function(e){var t=l[e];r.append(e,"object"==typeof t?JSON.stringify(t):t)}))}r.append("file",i);var s=(0,d.v4)(),u={name:a,loadingProgress:0,abortController:n,id:s};function p(e){var t,r;e.total&&(t=e.loaded/e.total*100,r=u.id,o((function(e){var n=e.map((function(e){return e.id===r?be(be({},e),{loadingProgress:t}):e}));return n})))}o((function(e){return ye(ye([],e,!0),[u],!1)})),e.onFileUpdate("add",a);var m="".concat(e.uploadFileEndpoint).replaceAll("fileName",a).replaceAll("messageId",e.messageId);!function i(){return g.then((function(c){return $().post(m,r,be(be({},c),{onUploadProgress:p,signal:n.signal})).then((function(t){var n,a,i=r.get("file");t.data.url&&i instanceof File&&i.name&&e.onFileUpdate("update",i.name,t.data.url),t.data.fileId&&(n=t.data,a=u.id,o((function(e){var t=e.findIndex((function(e){return e.id===a}));if(-1!==t){var r=ye([],e,!0);return r[t]=be(be({},r[t]),{id:n.fileId}),r}return e})))})).catch((function(n){var c,l,d=r.get("file");d instanceof File&&d.name&&e.onFileUpdate("remove",d.name);var p,f,m,h;409===(null===(c=n.response)||void 0===c?void 0:c.status)&&e.listFiles?(p=a.lastIndexOf("."),f=a.substring(0,p),m=a.substring(p),h=new RegExp("^".concat(f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"(\\(\\d+\\))?").concat(m,"$"),"i"),e.listFiles?e.listFiles().then((function(e){for(var t=0,r=0,n=e;r<n.length;r++){var o=n[r];if(h.test(o.name)){var a=o.name.match(h),i=a&&a[1]?parseInt(a[1].slice(1,-1),10):0;t=Math.max(t,i)}}return"".concat(f,"(").concat(t+1,")").concat(m)})):Promise.resolve(a)).then((function(n){e.onFileUpdate("add",n);var a=new File([t],n,{type:t.type});r.set("file",a),o((function(e){return e.map((function(e){return e.id===s?be(be({},e),{name:n,loadingProgress:0}):e}))})),i()})).catch((function(){var e;b(t.name,u.id,null===(e=n.response)||void 0===e?void 0:e.data)})):b(t.name,u.id,null===(l=n.response)||void 0===l?void 0:l.data)}))}))}()}(t)}(t)})),t.target.value=""},multiple:!0,accept:e.acceptedFileTypes})]}),c.length>0&&w(j,e.errorMessagesContainer),n.length>0&&w(y,e.filePreviewsContainer)]})};var Se,Oe,Ne=function(){return Ne=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ne.apply(this,arguments)},Ce=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};!function(e){e.Owner="owner",e.Member="member"}(Se||(Se={})),function(e){e.Human="human",e.Agent="agent"}(Oe||(Oe={}));const Fe=function(e){var t=e.maxFileSize,r=void 0===t?2097152:t,n=e.maxFileCount,o=void 0===n?1:n,a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["maxFileSize","maxFileCount"]),c=(0,u.useState)({uploaded:[],fileList:[]}),p=c[0],f=c[1],m=(0,u.useState)((0,d.v4)()),h=m[0],v=m[1],g=(0,u.useState)(),x=g[0],b=g[1],y=(0,u.useState)(),j=y[0],w=y[1],S=(0,u.useRef)(null),O=(0,s.useTheme)(),N=p.fileList.length>0,C=p.uploaded.length===p.fileList.length&&p.uploaded.length>0;return(0,u.useEffect)((function(){S.current&&(w(S.current.querySelector(".rustic-error-container")),b(S.current.querySelector(".rustic-input-extras")))})),(0,i.jsx)(l(),{className:"rustic-multimodal-input",sx:{border:"1px solid ".concat(O.palette.action.disabled),borderRadius:"".concat(O.shape.borderRadius,"px"),":focus-within":{borderColor:O.palette.secondary.main},background:O.palette.background.paper},children:(0,i.jsx)(z,Ne({},a,{send:function(e){e.data=function(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}(e.data.text,p.uploaded.map((function(e){return{url:e.url,name:e.name}}))),e.id=h,a.ws.send(e),v((0,d.v4)()),f({uploaded:[],fileList:[]})},isSendEnabled:N?C:void 0,ref:S,children:(0,i.jsx)(l(),{className:"rustic-bottom-buttons",children:(0,i.jsx)(we,{acceptedFileTypes:a.acceptedFileTypes,maxFileCount:o,maxFileSize:r,uploadFileEndpoint:a.uploadFileEndpoint,deleteFileEndpoint:a.deleteFileEndpoint,onFileUpdate:function(e,t,r){if("add"===e)f((function(e){return Ne(Ne({},e),{fileList:Ce(Ce([],e.fileList,!0),[{name:t}],!1)})}));else if("update"===e){if(!r)return void console.error("URL is required for the 'update' action");f((function(e){var n=e.fileList.findIndex((function(e){return e.name===t})),o=Ce(Ce(Ce([],e.uploaded.slice(0,n),!0),[{name:t,url:r}],!1),e.uploaded.slice(n),!0);return Ne(Ne({},e),{uploaded:o})}))}else f((function(e){return{uploaded:e.uploaded.filter((function(e){return e.name!==t})),fileList:e.fileList.filter((function(e){return e.name!==t}))}}))},messageId:h,filePreviewsContainer:x,errorMessagesContainer:j,showFullName:a.showFullName,getUploadData:a.getUploadData,uploadOptions:a.uploadOptions,listFiles:a.listFiles,getUploadHeaders:a.getUploadHeaders})})}))})};return a})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAM7E;;;;;;;;;;;;;;;EAeE;AACF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,WAAmB,EACnB,YAAgB,EAChB,GAAG,KAAK,EACT,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"multimodalInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/multimodal/multimodalInput/multimodalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAM7E;;;;;;;;;;;;;;;EAeE;AACF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,WAAmB,EACnB,YAAgB,EAChB,GAAG,KAAK,EACT,EAAE,oBAAoB,2CA+HtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e,t,r={8342:e=>{e.exports=require("emoji-picker-element")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var i=Object.create(null);o.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&n&&r;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>r[e]));return a.default=()=>r,o.d(i,a),i},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{ParticipantRole:()=>W,ParticipantType:()=>K,default:()=>$});const a=require("react/jsx-runtime"),c=require("react"),s=require("@mui/material/Avatar");var u=o.n(s);const l=require("@mui/material/Box");var d=o.n(l);const p=require("@mui/material/CircularProgress");var m=o.n(p);const f=require("@mui/material/IconButton");var h=o.n(f);const v=require("@mui/material/InputAdornment");var g=o.n(v);const y=require("@mui/material/MenuItem");var b=o.n(y);const j=require("@mui/material/MenuList");var x=o.n(j);const O=require("@mui/material/Popover");var w=o.n(O);const S=require("@mui/material/TextField");var k=o.n(S);const E=require("@mui/material/Tooltip");var C=o.n(E);const N=require("@mui/material/Typography");var P=o.n(N),T=o(8342);const q=require("uuid");var _;function R(e,t){var r=[];if(e&&(null==e?void 0:e.trim().length)&&r.push({type:"text",text:e}),t&&t.length>0)for(var n=0;n<(null==t?void 0:t.length);n++)r.push({type:"file_url",file_url:{url:t[n].url,name:t[n].name}});return{messages:[{content:r,role:"user"}]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(_||(_={}));var I=function(){return I=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},I.apply(this,arguments)};function M(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:I({},t),children:e.name})}const A=require("@mui/material/styles"),D=function(e){var t=(0,A.useTheme)(),r=(0,c.useRef)(null),n=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function d(){u(!1)}function p(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),d()}return(0,c.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(r){var o=new(0,r.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";o.classList.add(i),Object.keys(l).forEach((function(e){o.style.setProperty(e,l[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,c.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",p),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(C(),{title:"Emoji",children:(0,a.jsx)(h(),{size:"small",ref:r,onClick:function(){u((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:"Mood"})})}),n.current&&(0,a.jsx)(w(),{open:s,anchorEl:r.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var z={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function L(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function B(e){return(0,a.jsxs)(d(),{className:"rustic-participant-profile",children:[(0,a.jsx)(u(),{src:e.icon,className:"rustic-participant-avatar"}),(0,a.jsx)(P(),{variant:"body1Bold",children:e.displayName})]})}function F(e){var t=e.items,r=e.isOpen,n=e.onClose,o=e.onSelect,i=e.renderItem,c=e.anchorEl,s=e.selectedIndex;return(0,a.jsx)(w(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,a.jsx)(x(),{children:t.map((function(e,t){return(0,a.jsx)(b(),{onClick:function(){return o(e)},selected:t===s,children:i(e)},t)}))})})}const H=(0,c.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,o=e.fullWidth,i=void 0===o||o,s=e.maxRows,u=void 0===s?6:s,l=e.enableSpeechToText,p=void 0!==l&&l,f=e.maximumEmojiSearchResults,v=void 0===f?5:f,y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,c.useState)(""),j=b[0],x=b[1],O=(0,c.useState)(!1),w=O[0],S=O[1],E=(0,c.useState)(!1),N=E[0],_=E[1],I=(0,c.useState)(!1),A=I[0],H=I[1],W=(0,c.useState)(""),K=W[0],U=W[1],$=(0,c.useState)([]),Q=$[0],G=$[1],J=(0,c.useState)(!1),V=J[0],X=J[1],Y=(0,c.useState)(0),Z=Y[0],ee=Y[1],te=(0,c.useRef)(null),re=new T.Database({dataSource:y.emojiDataSource}),ne=!j.trim().length&&!y.isSendEnabled,oe="".concat(w?"Stop":"Start"," speech to text"),ie=N?"primary.main":"primary.light",ae=w?"error.main":ie,ce=w?"stop_circle":"speech_to_text",se=(0,c.useState)([]),ue=se[0],le=se[1],de=(0,c.useState)(!1),pe=de[0],me=de[1];function fe(e,t){if(te.current){var r=te.current,n=r.selectionStart,o=r.selectionEnd;if("number"==typeof n&&"number"==typeof o){var i,a=j||"",c=a.substring(0,n),s=a.substring(o),u=void 0;t?(u=c.replace(t,e)+s,i=c.replace(t,e).length):(u=c+e+s,i=n+e.length),x(u),setTimeout((function(){var e,t;null===(e=te.current)||void 0===e||e.focus(),null===(t=te.current)||void 0===t||t.setSelectionRange(i,i)}),0)}}}function he(e){fe("@".concat(e," "),/@(\w*)$/),le([])}function ve(e,t){void 0===t&&(t=!1),fe(e,t?/:(\w+)$/:void 0),X(!1)}var ge=A?(0,a.jsx)(m(),{size:24}):(0,a.jsx)(C(),{title:oe,children:(0,a.jsx)(h(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,w?(e.stop(),H(!0),S(!1)):(e.start(),U(""),S(!0)),e.onstart=function(){S(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;j.length>0?x(j+" "+r):x(r),null===(t=te.current)||void 0===t||t.focus(),S(!1)},e.onerror=function(e){var t=z[e.error];U(t),S(!1)},e.onend=function(){H(!1),S(!1)}},size:"small",sx:{color:ae,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(M,{name:ce})})});function ye(){var e=(new Date).toISOString(),t={id:(0,q.v4)(),timestamp:e,sender:y.sender,conversationId:y.conversationId,format:"chatCompletionRequest",data:R(j)};y.send(t),x(""),U("")}return(0,a.jsxs)(d(),{className:"rustic-base-input",ref:t,children:[(0,a.jsxs)(d(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(d(),{className:"rustic-error-container",children:(0,a.jsx)(P(),{variant:"caption",color:"error",className:"rustic-error-message",children:K})}),(0,a.jsxs)(d(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:N?"secondary.main":"action.disabled"},children:[Q.length>0&&te.current&&(0,a.jsx)(F,{anchorEl:te.current,items:Q.filter((function(e){return"unicode"in e})),isOpen:V,onClose:function(){X(!1),ee(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:Z,renderItem:L}),ue.length>0&&te.current&&(0,a.jsx)(F,{anchorEl:te.current,items:ue,isOpen:pe,onClose:function(){me(!1),ee(0)},onSelect:function(e){return he(e.displayName)},renderItem:B,selectedIndex:Z}),(0,a.jsx)(k(),{className:"rustic-text-field",variant:"outlined",value:j,label:y.label,placeholder:y.placeholder,maxRows:u,multiline:n,fullWidth:i,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),V&&Q.length>0&&"unicode"in Q[Z]?ve(Q[Z].unicode,!0):pe&&ue.length>0?he(ue[Z].displayName):e.shiftKey||ne||ye();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(V?ee((function(e){return(e+t+Q.length)%Q.length})):pe&&ee((function(e){return(e+t+ue.length)%ue.length})));0!==Z&&ee(0)}},onChange:function(e){U("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&y.getMembers){var r=t[1].toLowerCase();y.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));le(t),t.length>0?me(!0):me(!1)}))}else le([])}(t);var r,n=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(n){var i=n[0].replace(/:/g,"");re.getEmojiByShortcode(i).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);x(r)}else x(t)})).catch((function(){x(t)})),X(!1)}else o?(r=o[0].replace(":",""),re.getEmojiBySearchQuery(r).then((function(e){e.length?(G(e.slice(0,v)),X(!0)):(G([]),X(!1))})).catch((function(){G([]),X(!1)}))):X(!1)},onFocus:function(){return _(!0)},onBlur:function(){return _(!1)},inputRef:te,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,a.jsxs)(g(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(D,{dataSource:y.emojiDataSource,onEmojiClick:ve,buttonColor:ie}),p&&ge]})},inputLabel:{className:N?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(d(),{className:"rustic-input-actions",children:[y.children,(0,a.jsx)(C(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(h(),{"aria-label":"send message",onClick:ye,disabled:ne,color:"secondary",children:(0,a.jsx)(M,{name:"send"})})})})]})]})}));var W,K,U=function(){return U=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},U.apply(this,arguments)};!function(e){e.Owner="owner",e.Member="member"}(W||(W={})),function(e){e.Human="human",e.Agent="agent"}(K||(K={}));const $=function(e){var t=e.ws,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["ws"]);return(0,a.jsx)(H,U({},r,{send:function(e){t.send(e)}}))};return i})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,(()=>(()=>{"use strict";var e,t,r={8342:e=>{e.exports=require("emoji-picker-element")}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var i=Object.create(null);o.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&n&&r;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((e=>a[e]=()=>r[e]));return a.default=()=>r,o.d(i,a),i},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};o.r(i),o.d(i,{ParticipantRole:()=>H,ParticipantType:()=>W,default:()=>U});const a=require("react/jsx-runtime"),c=require("react");var s;!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(s||(s={}));const u=require("@mui/material/Avatar");var l=o.n(u);const d=require("@mui/material/Box");var p=o.n(d);const m=require("@mui/material/CircularProgress");var f=o.n(m);const h=require("@mui/material/IconButton");var v=o.n(h);const y=require("@mui/material/InputAdornment");var g=o.n(y);const b=require("@mui/material/MenuItem");var j=o.n(b);const x=require("@mui/material/MenuList");var O=o.n(x);const w=require("@mui/material/Popover");var S=o.n(w);const k=require("@mui/material/TextField");var E=o.n(k);const C=require("@mui/material/Tooltip");var N=o.n(C);const P=require("@mui/material/Typography");var T=o.n(P),q=o(8342);const R=require("uuid");var _=function(){return _=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},_.apply(this,arguments)};function I(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:_({},t),children:e.name})}const M=require("@mui/material/styles"),A=function(e){var t=(0,M.useTheme)(),r=(0,c.useRef)(null),n=(0,c.useRef)(null),i=(0,c.useState)(!1),s=i[0],u=i[1],l={"--indicator-color":t.palette.divider,"--background":t.palette.background.paper,"--input-border-color":t.palette.divider,"--outline-color":t.palette.secondary.main};function d(){u(!1)}function p(t){t.detail.unicode&&e.onEmojiClick(t.detail.unicode),d()}return(0,c.useEffect)((function(){n.current||"undefined"==typeof window||Promise.resolve().then(o.t.bind(o,8342,23)).then((function(r){var o=new(0,r.Picker)({dataSource:e.dataSource}),i="dark"===t.palette.mode?"dark":"light";o.classList.add(i),Object.keys(l).forEach((function(e){o.style.setProperty(e,l[e])})),n.current=o})).catch((function(e){console.error("Failed to load emoji picker",e)}))}),[]),(0,c.useEffect)((function(){return n.current&&n.current.addEventListener("emoji-click",p),function(){var e;null===(e=n.current)||void 0===e||e.removeEventListener("emoji-click",p)}}),[s,e.onEmojiClick]),(0,a.jsxs)("div",{children:[(0,a.jsx)(N(),{title:"Emoji",children:(0,a.jsx)(v(),{size:"small",ref:r,onClick:function(){u((function(e){return!e}))},sx:{color:"primary.light","&:hover":{color:"primary.main"}},children:(0,a.jsx)(I,{name:"Mood"})})}),n.current&&(0,a.jsx)(S(),{open:s,anchorEl:r.current,onClose:d,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"bottom",horizontal:"right"},children:(0,a.jsx)("div",{className:"rustic-emoji-picker",ref:function(e){e&&n.current&&!e.contains(n.current)&&e.appendChild(n.current)}})})]})};var D={"no-speech":"No speech detected. Check your microphone volume and try again.",aborted:"Speech input was aborted. Ensure no other windows are accessing your microphone and try again.","audio-capture":"Could not capture any audio. Check that your microphone is connected and try again.",network:"Failed to connect to the internet for recognition. Check your internet connection and try again.","not-allowed":"This functionality requires microphone access. Please allow microphone access and try again.","service-not-allowed":"Speech recognition service is not allowed, either because the browser doesn't support it or because of reasons of security, privacy or user preference.","bad-grammar":"There was an error in the speech recognition grammar or format. Check your speech input or grammar rules.","language-not-supported":"The language you're speaking isn't supported. Try speaking in a different language or check your device settings."};function z(e){if("unicode"in e&&"annotation"in e)return"".concat(e.unicode," ").concat(e.annotation)}function L(e){return(0,a.jsxs)(p(),{className:"rustic-participant-profile",children:[(0,a.jsx)(l(),{src:e.icon,className:"rustic-participant-avatar"}),(0,a.jsx)(T(),{variant:"body1Bold",children:e.displayName})]})}function B(e){var t=e.items,r=e.isOpen,n=e.onClose,o=e.onSelect,i=e.renderItem,c=e.anchorEl,s=e.selectedIndex;return(0,a.jsx)(S(),{disableAutoFocus:!0,open:r&&t.length>0,anchorEl:c,onClose:n,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},className:"rustic-suggestion-menu",children:(0,a.jsx)(O(),{children:t.map((function(e,t){return(0,a.jsx)(j(),{onClick:function(){return o(e)},selected:t===s,children:i(e)},t)}))})})}const F=(0,c.forwardRef)((function(e,t){var r=e.multiline,n=void 0===r||r,o=e.fullWidth,i=void 0===o||o,s=e.maxRows,u=void 0===s?6:s,l=e.enableSpeechToText,d=void 0!==l&&l,m=e.maximumEmojiSearchResults,h=void 0===m?5:m,y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["multiline","fullWidth","maxRows","enableSpeechToText","maximumEmojiSearchResults"]),b=(0,c.useState)(""),j=b[0],x=b[1],O=(0,c.useState)(!1),w=O[0],S=O[1],k=(0,c.useState)(!1),C=k[0],P=k[1],_=(0,c.useState)(!1),M=_[0],F=_[1],H=(0,c.useState)(""),W=H[0],K=H[1],U=(0,c.useState)([]),$=U[0],Q=U[1],G=(0,c.useState)(!1),J=G[0],V=G[1],X=(0,c.useState)(0),Y=X[0],Z=X[1],ee=(0,c.useRef)(null),te=new q.Database({dataSource:y.emojiDataSource}),re=!j.trim().length,ne="".concat(w?"Stop":"Start"," speech to text"),oe=C?"primary.main":"primary.light",ie=w?"error.main":oe,ae=w?"stop_circle":"speech_to_text",ce=(0,c.useState)([]),se=ce[0],ue=ce[1],le=(0,c.useState)(!1),de=le[0],pe=le[1];function me(){return"boolean"==typeof y.isSendEnabled?!y.isSendEnabled:re}function fe(e,t){if(ee.current){var r=ee.current,n=r.selectionStart,o=r.selectionEnd;if("number"==typeof n&&"number"==typeof o){var i,a=j||"",c=a.substring(0,n),s=a.substring(o),u=void 0;t?(u=c.replace(t,e)+s,i=c.replace(t,e).length):(u=c+e+s,i=n+e.length),x(u),setTimeout((function(){var e,t;null===(e=ee.current)||void 0===e||e.focus(),null===(t=ee.current)||void 0===t||t.setSelectionRange(i,i)}),0)}}}function he(e){fe("@".concat(e," "),/@(\w*)$/),ue([])}function ve(e,t){void 0===t&&(t=!1),fe(e,t?/:(\w+)$/:void 0),V(!1)}var ye=M?(0,a.jsx)(f(),{size:24}):(0,a.jsx)(N(),{title:ne,children:(0,a.jsx)(v(),{onClick:function(){var e=new window.webkitSpeechRecognition,t=navigator.language;e.lang=t,w?(e.stop(),F(!0),S(!1)):(e.start(),K(""),S(!0)),e.onstart=function(){S(!0)},e.onresult=function(e){var t,r=e.results[0][0].transcript;j.length>0?x(j+" "+r):x(r),null===(t=ee.current)||void 0===t||t.focus(),S(!1)},e.onerror=function(e){var t=D[e.error];K(t),S(!1)},e.onend=function(){F(!1),S(!1)}},size:"small",sx:{color:ie,"&:hover":{color:"primary.main"}},children:(0,a.jsx)(I,{name:ae})})});function ge(){var e=(new Date).toISOString(),t={id:(0,R.v4)(),timestamp:e,sender:y.sender,conversationId:y.conversationId,format:"chatCompletionRequest",data:{text:j}};y.send(t),x(""),K("")}return(0,a.jsxs)(p(),{className:"rustic-base-input",ref:t,children:[(0,a.jsxs)(p(),{className:"rustic-error-and-input-container",children:[(0,a.jsx)(p(),{className:"rustic-error-container",children:(0,a.jsx)(T(),{variant:"caption",color:"error",className:"rustic-error-message",children:W})}),(0,a.jsxs)(p(),{className:"rustic-input-field",sx:{border:"1px solid",borderColor:C?"secondary.main":"action.disabled"},children:[$.length>0&&ee.current&&(0,a.jsx)(B,{anchorEl:ee.current,items:$.filter((function(e){return"unicode"in e})),isOpen:J,onClose:function(){V(!1),Z(0)},onSelect:function(e){return ve(e.unicode,!0)},selectedIndex:Y,renderItem:z}),se.length>0&&ee.current&&(0,a.jsx)(B,{anchorEl:ee.current,items:se,isOpen:de,onClose:function(){pe(!1),Z(0)},onSelect:function(e){return he(e.displayName)},renderItem:L,selectedIndex:Y}),(0,a.jsx)(E(),{className:"rustic-text-field",variant:"outlined",value:j,label:y.label,placeholder:y.placeholder,maxRows:u,multiline:n,fullWidth:i,onKeyDown:function(e){var t,r="ArrowDown"===e.key,n="ArrowUp"===e.key;if("Enter"===e.key||"Tab"===e.key)e.shiftKey||e.preventDefault(),J&&$.length>0&&"unicode"in $[Y]?ve($[Y].unicode,!0):de&&se.length>0?he(se[Y].displayName):e.shiftKey||me()||ge();else{if(r||n)return e.preventDefault(),t=r?1:-1,void(J?Z((function(e){return(e+t+$.length)%$.length})):de&&Z((function(e){return(e+t+se.length)%se.length})));0!==Y&&Z(0)}},onChange:function(e){K("");var t=e.target.value;x(t),function(e){var t=e.match(/@(\w*)$/);if(t&&y.getMembers){var r=t[1].toLowerCase();y.getMembers().then((function(e){var t=e.filter((function(e){return e.displayName.toLowerCase().startsWith(r)}));ue(t),t.length>0?pe(!0):pe(!1)}))}else ue([])}(t);var r,n=t.match(/:(\w{2,}):/g),o=t.match(/:(\w{2,})/g);if(n){var i=n[0].replace(/:/g,"");te.getEmojiByShortcode(i).then((function(e){if(e&&"unicode"in e){var r=t.replace(n[0],e.unicode);x(r)}else x(t)})).catch((function(){x(t)})),V(!1)}else o?(r=o[0].replace(":",""),te.getEmojiBySearchQuery(r).then((function(e){e.length?(Q(e.slice(0,h)),V(!0)):(Q([]),V(!1))})).catch((function(){Q([]),V(!1)}))):V(!1)},onFocus:function(){return P(!0)},onBlur:function(){return P(!1)},inputRef:ee,color:"secondary",size:"small",slotProps:{input:{endAdornment:(0,a.jsxs)(g(),{position:"end",className:"rustic-input-adornment",children:[(0,a.jsx)(A,{dataSource:y.emojiDataSource,onEmojiClick:ve,buttonColor:oe}),d&&ye]})},inputLabel:{className:C?"":"rustic-input-label",sx:{backgroundColor:"background.paper"}}}}),(0,a.jsx)("div",{className:"rustic-input-extras"})]})]}),(0,a.jsxs)(p(),{className:"rustic-input-actions",children:[y.children,(0,a.jsx)(N(),{title:"Send",children:(0,a.jsx)("span",{className:"rustic-send-button",children:(0,a.jsx)(v(),{"aria-label":"send message",onClick:ge,disabled:me(),color:"secondary",children:(0,a.jsx)(I,{name:"send"})})})})]})]})}));var H,W,K=function(){return K=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},K.apply(this,arguments)};!function(e){e.Owner="owner",e.Member="member"}(H||(H={})),function(e){e.Human="human",e.Agent="agent"}(W||(W={}));const U=function(e){var t=e.ws,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["ws"]);return(0,a.jsx)(F,K({},r,{send:function(e){var r,n;e.data=(r=e.data.text,n=[],r&&(null==r?void 0:r.trim().length)&&n.push({type:"text",text:r}),{messages:[{content:n,role:"user"}]}),t.send(e)}}))};return i})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/textInput/textInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"textInput.d.ts","sourceRoot":"","sources":["../../../../src/components/input/textInput/textInput.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,aAAa,CAAA;AAG1D,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CAetD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatCompletion.d.ts","sourceRoot":"","sources":["../../../../src/components/multipart/chatCompletion/chatCompletion.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"chatCompletion.d.ts","sourceRoot":"","sources":["../../../../src/components/multipart/chatCompletion/chatCompletion.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,4BAA4B,CAAA;AAQnC,OAAO,KAAK,EAAE,mBAAmB,EAAW,MAAM,aAAa,CAAA;AAU/D;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CA6DhE"}
|
|
@@ -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={
|
|
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={8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(4409),r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>d});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o),l=r(3840),c=r(2015);function u(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=l.marked.parse(t,{async:!1});return s().sanitize(r)}const d=function(e){var t=(0,c.useState)(u(e.text)),r=t[0],a=t[1];return(0,c.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(u(t))}}),[e.text,e.updatedData]),(0,n.jsx)(i(),{variant:"body1",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:r}})}},4409:(e,t,r)=>{r(8732),r(5642),r(785),r(2015),r(227)},7159:(e,t,r)=>{var n,a;!function(e){e.Owner="owner",e.Member="member"}(n||(n={})),function(e){e.Human="human",e.Agent="agent"}(a||(a={}))},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},7447:e=>{e.exports=require("dompurify")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.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:()=>L});var a=r(8732);const i=require("@mui/material/Box");var o=r.n(i),s=r(785),l=r.n(s),c=r(2015),u=r.n(c);const d=require("@mui/material/Card");var f=r.n(d);const m=require("@mui/material/IconButton");var p=r.n(m);const h=require("@mui/material/Modal");var v=r.n(h);const x=require("@mui/material/styles"),j=require("@mui/material/Tooltip");var b,g=r.n(j);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(b||(b={}));var y=function(){return y=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},y.apply(this,arguments)};function w(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:y({},t),children:e.name})}const N=require("@mui/material/TextField");var O=r.n(N);const k=require("@mui/material/useMediaQuery");var C=r.n(k);const P=require("@mui/system/Stack");var S=r.n(P);const A=require("@mui/system/useTheme");var q=r.n(A);const H=require("pdfjs-dist"),D=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,a.jsx)(g(),{title:r.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(p(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(w,{name:r.symbol})})})})};var F={pdf:function(e){var t,r=(0,c.useRef)(null),n=(0,c.useState)(1),i=n[0],s=n[1],u=(0,c.useState)(1),d=u[0],m=u[1],p=(0,c.useState)(1),h=p[0],v=p[1],x=(0,c.useState)(!1),j=x[0],b=x[1],g=(0,c.useState)(),y=g[0],w=g[1],N=q()(),k=C()(N.breakpoints.down("sm")),P=C()(N.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,a.jsx)(f(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(l(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var A=(0,c.useState)((function(){return k?.5:P?1:1.5})),F=A[0],_=A[1];function T(t){H.getDocument({url:e.url,httpHeaders:t}).promise.then((function(e){m(e.numPages),function(e){e.getPage(i).then((function(e){var t=e.getViewport({scale:F}),n=r.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*i,n.height=t.height*i;var o={canvasContext:a,viewport:t,transform:[i,0,0,i,0,0]};y&&y.cancel();var s=e.render(o);w(s),s.promise.then((function(){w(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){b(!0)}))}return(0,c.useEffect)((function(){H.GlobalWorkerOptions.workerSrc||(H.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(H.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then((function(e){return T(e.headers)})).catch((function(){return b(!0)})):T()}),[e.url,i,F]),j?(0,a.jsx)(f(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(l(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(f(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(o(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(D,{action:"zoomOut",onClick:function(){_((function(e){return Math.max(e-.2,.2)}))}}),(0,a.jsx)(D,{action:"zoomIn",onClick:function(){_((function(e){return e+.2}))}})]}),(0,a.jsx)(o(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(o(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:r})})}),(0,a.jsxs)(S(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(D,{action:"previousPage",onClick:function(){i>1&&(s(i-1),v(i-1))},isDisabled:1===i}),(0,a.jsx)(l(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(O(),{type:"number",value:h,onChange:function(e){var t=parseInt(e.target.value);v(t),!isNaN(t)&&t>=1&&t<=d&&s(t)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(l(),{variant:"body1",className:"rustic-page-indicator",children:["of ",d]}),(0,a.jsx)(D,{action:"nextPage",onClick:function(){i<d&&(s(i+1),v(i+1))},isDisabled:i===d})]})]})}};function _(e){var t=e.supportedViewers,r=void 0===t?F:t,n=e.showFullName,i=void 0===n||n,o=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["supportedViewers","showFullName"]),s=(0,x.useTheme)(),u=(0,c.useState)(!1),d=u[0],m=u[1];function h(){m(!1)}var j,b,y=o.file.url&&(j=o.file.url.split("."))[j.length-1].toLowerCase(),N=y&&r?r[y]:null,O=!!N,k=O?" rustic-cursor-pointer":"",C="rustic-file-preview ".concat(i?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(k),P=i?o.file.name:(b=o.file.name).length<=15?b:b.substring(0,12)+"...";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(f(),{className:C,variant:"outlined",sx:{boxShadow:s.shadows[1]},onClick:function(){m(!0)},children:[(0,a.jsx)(l(),{variant:"subtitle2",className:"rustic-file-preview-name",children:P}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:o.children})]}),O&&(0,a.jsx)(v(),{open:d,onClose:h,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(g(),{title:"Close",children:(0,a.jsx)(p(),{onClick:h,className:"rustic-close-button",children:(0,a.jsx)(w,{name:"close"})})}),o.file.url&&(0,a.jsx)(N,{url:o.file.url,getAuthHeaders:o.getAuthHeaders})]})})]})}var T=r(8010),M=function(){return M=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},M.apply(this,arguments)};function R(e){return(0,a.jsx)(g(),{title:"Download",className:"rustic-shift-to-right-by-8",children:e.getAuthHeaders?(0,a.jsx)(p(),{onClick:function(){(0,e.getAuthHeaders)().then((function(t){return fetch(e.url,M({},t))})).then((function(e){return e.blob()})).then((function(t){var r=window.URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e.fileName,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)})).catch((function(e){throw new Error("Error downloading file. "+e.message)}))},children:(0,a.jsx)(w,{name:"download"})}):(0,a.jsx)(p(),{component:"a",href:e.url,download:e.fileName,children:(0,a.jsx)(w,{name:"download"})})})}function E(e){return new URL(e).pathname.split("/").pop()}const L=function(e){return(0,a.jsxs)(o(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,a.jsxs)("div",{children:[e.title&&(0,a.jsx)(l(),{variant:"h6",children:e.title}),e.description&&(0,a.jsx)(T.default,{text:e.description})]}),e.messages.map((function(t,r){return"string"==typeof t.content?(0,a.jsx)(T.default,{text:t.content},r):function(t,r){var n=[],i="";return t.map((function(t){if("text"===t.type)i+=t.text;else if(t.type.endsWith("_url")){var r=t[t.type].url,o={url:r,name:t[t.type].name||E(r)},s=(0,a.jsx)(_,{file:o,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:o.url&&(0,a.jsx)(R,{url:o.url,fileName:o.name,getAuthHeaders:e.getAuthHeaders})});n.push(s)}})),(0,a.jsxs)(u().Fragment,{children:[i.length>0&&(0,a.jsx)(T.default,{text:i}),n.length>0&&(0,a.jsx)(o(),{className:"rustic-files",children:n})]},r)}(t.content,r)}))]})};return n})()));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GetAuthHeaders } from '../types';
|
|
2
|
+
type DownloadButtonProps = {
|
|
3
|
+
url: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
getAuthHeaders?: GetAuthHeaders;
|
|
6
|
+
};
|
|
7
|
+
export default function DownloadButton(props: DownloadButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=downloadButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloadButton.d.ts","sourceRoot":"","sources":["../../../src/components/multipart/downloadButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CA8ChE"}
|
|
@@ -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={8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(4409),r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>d});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o),l=r(3840),c=r(2015);function u(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=l.marked.parse(t,{async:!1});return s().sanitize(r)}const d=function(e){var t=(0,c.useState)(u(e.text)),r=t[0],a=t[1];return(0,c.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(u(t))}}),[e.text,e.updatedData]),(0,n.jsx)(i(),{variant:"body1",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:r}})}},4409:(e,t,r)=>{r(8732),r(5642),r(785),r(2015),r(227)},7159:(e,t,r)=>{var n,a;!function(e){e.Owner="owner",e.Member="member"}(n||(n={})),function(e){e.Human="human",e.Agent="agent"}(a||(a={}))},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},7447:e=>{e.exports=require("dompurify")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.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 a=r(8732)
|
|
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={8010:(e,t,r)=>{r.d(t,{default:()=>a});var n=r(227);r(4409),r(7159);const a=n.A},227:(e,t,r)=>{r.d(t,{A:()=>d});var n=r(8732),a=r(785),i=r.n(a),o=r(7447),s=r.n(o),l=r(3840),c=r(2015);function u(e){var t=e.replace(/^[\u200B-\u200F\uFEFF]/,""),r=l.marked.parse(t,{async:!1});return s().sanitize(r)}const d=function(e){var t=(0,c.useState)(u(e.text)),r=t[0],a=t[1];return(0,c.useEffect)((function(){if(e.updatedData&&e.updatedData.length>0){var t=e.updatedData[e.updatedData.length-1].text;a(u(t))}}),[e.text,e.updatedData]),(0,n.jsx)(i(),{variant:"body1",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:r}})}},4409:(e,t,r)=>{r(8732),r(5642),r(785),r(2015),r(227)},7159:(e,t,r)=>{var n,a;!function(e){e.Owner="owner",e.Member="member"}(n||(n={})),function(e){e.Human="human",e.Agent="agent"}(a||(a={}))},5642:e=>{e.exports=require("@mui/material/Alert")},785:e=>{e.exports=require("@mui/material/Typography")},7447:e=>{e.exports=require("dompurify")},3840:e=>{e.exports=require("marked")},2015:e=>{e.exports=require("react")},8732:e=>{e.exports=require("react/jsx-runtime")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.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 a=r(8732),i=r(785),o=r.n(i);const s=require("@mui/system/Box");var l=r.n(s),c=r(2015);const u=require("@mui/material/Card");var d=r.n(u);const m=require("@mui/material/IconButton");var f=r.n(m);const p=require("@mui/material/Modal");var h=r.n(p);const v=require("@mui/material/styles"),x=require("@mui/material/Tooltip");var b,j=r.n(x);!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(b||(b={}));var g=function(){return g=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},g.apply(this,arguments)};function y(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,a.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:g({},t),children:e.name})}const w=require("@mui/material/Box");var N=r.n(w);const O=require("@mui/material/TextField");var k=r.n(O);const C=require("@mui/material/useMediaQuery");var P=r.n(C);const S=require("@mui/system/Stack");var q=r.n(S);const A=require("@mui/system/useTheme");var H=r.n(A);const D=require("pdfjs-dist"),F=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,a.jsx)(j(),{title:r.label,children:(0,a.jsx)("span",{children:(0,a.jsx)(f(),{onClick:e.onClick,className:e.className,disabled:e.isDisabled,children:(0,a.jsx)(y,{name:r.symbol})})})})};var T={pdf:function(e){var t,r=(0,c.useRef)(null),n=(0,c.useState)(1),i=n[0],s=n[1],l=(0,c.useState)(1),u=l[0],m=l[1],f=(0,c.useState)(1),p=f[0],h=f[1],v=(0,c.useState)(!1),x=v[0],b=v[1],j=(0,c.useState)(),g=j[0],y=j[1],w=H()(),O=P()(w.breakpoints.down("sm")),C=P()(w.breakpoints.between("sm","md"));if(t=e.url,!/\/[^/]+\.pdf$/.test(t))return(0,a.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(o(),{variant:"body2",children:"The provided URL does not point to a PDF file."})});var S=(0,c.useState)((function(){return O?.5:C?1:1.5})),A=S[0],T=S[1];function _(t){D.getDocument({url:e.url,httpHeaders:t}).promise.then((function(e){m(e.numPages),function(e){e.getPage(i).then((function(e){var t=e.getViewport({scale:A}),n=r.current;if(n){var a=n.getContext("2d");if(a){var i=window.devicePixelRatio||1;n.style.width="".concat(t.width,"px"),n.style.height="".concat(t.height,"px"),n.width=t.width*i,n.height=t.height*i;var o={canvasContext:a,viewport:t,transform:[i,0,0,i,0,0]};g&&g.cancel();var s=e.render(o);y(s),s.promise.then((function(){y(void 0)})).catch((function(e){console.error(e)}))}}}))}(e)})).catch((function(){b(!0)}))}return(0,c.useEffect)((function(){D.GlobalWorkerOptions.workerSrc||(D.GlobalWorkerOptions.workerSrc="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(D.version,"/pdf.worker.mjs")),e.getAuthHeaders?e.getAuthHeaders().then((function(e){return _(e.headers)})).catch((function(){return b(!0)})):_()}),[e.url,i,A]),x?(0,a.jsx)(d(),{variant:"outlined",className:"rustic-pdf-error",children:(0,a.jsx)(o(),{variant:"body2",children:"Failed to load the PDF file."})}):(0,a.jsxs)(d(),{variant:"outlined",className:"rustic-pdf-viewer",children:[(0,a.jsxs)(N(),{className:"rustic-pdf-viewer-header",children:[(0,a.jsx)(F,{action:"zoomOut",onClick:function(){T((function(e){return Math.max(e-.2,.2)}))}}),(0,a.jsx)(F,{action:"zoomIn",onClick:function(){T((function(e){return e+.2}))}})]}),(0,a.jsx)(N(),{className:"rustic-pdf-viewer-body",children:(0,a.jsx)(N(),{className:"rustic-pdf-viewer-body-inner",children:(0,a.jsx)("canvas",{ref:r})})}),(0,a.jsxs)(q(),{direction:"row",justifyContent:"center",alignItems:"center",gap:1,children:[(0,a.jsx)(F,{action:"previousPage",onClick:function(){i>1&&(s(i-1),h(i-1))},isDisabled:1===i}),(0,a.jsx)(o(),{variant:"body1",className:"rustic-page-indicator",children:"Page"}),(0,a.jsx)(k(),{type:"number",value:p,onChange:function(e){var t=parseInt(e.target.value);h(t),!isNaN(t)&&t>=1&&t<=u&&s(t)},size:"small",className:"rustic-pdf-page-input"}),(0,a.jsxs)(o(),{variant:"body1",className:"rustic-page-indicator",children:["of ",u]}),(0,a.jsx)(F,{action:"nextPage",onClick:function(){i<u&&(s(i+1),h(i+1))},isDisabled:i===u})]})]})}};function _(e){var t=e.supportedViewers,r=void 0===t?T:t,n=e.showFullName,i=void 0===n||n,s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["supportedViewers","showFullName"]),l=(0,v.useTheme)(),u=(0,c.useState)(!1),m=u[0],p=u[1];function x(){p(!1)}var b,g,w=s.file.url&&(b=s.file.url.split("."))[b.length-1].toLowerCase(),N=w&&r?r[w]:null,O=!!N,k=O?" rustic-cursor-pointer":"",C="rustic-file-preview ".concat(i?"rustic-flexible-file-preview-width":"rustic-fixed-file-preview-width").concat(k),P=i?s.file.name:(g=s.file.name).length<=15?g:g.substring(0,12)+"...";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d(),{className:C,variant:"outlined",sx:{boxShadow:l.shadows[1]},onClick:function(){p(!0)},children:[(0,a.jsx)(o(),{variant:"subtitle2",className:"rustic-file-preview-name",children:P}),(0,a.jsx)("div",{onClick:function(e){return e.stopPropagation()},children:s.children})]}),O&&(0,a.jsx)(h(),{open:m,onClose:x,className:"rustic-file-preview-modal",children:(0,a.jsxs)("div",{className:"rustic-modal-content",children:[(0,a.jsx)(j(),{title:"Close",children:(0,a.jsx)(f(),{onClick:x,className:"rustic-close-button",children:(0,a.jsx)(y,{name:"close"})})}),s.file.url&&(0,a.jsx)(N,{url:s.file.url,getAuthHeaders:s.getAuthHeaders})]})})]})}var M=r(8010),E=function(){return E=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},E.apply(this,arguments)};function R(e){return(0,a.jsx)(j(),{title:"Download",className:"rustic-shift-to-right-by-8",children:e.getAuthHeaders?(0,a.jsx)(f(),{onClick:function(){(0,e.getAuthHeaders)().then((function(t){return fetch(e.url,E({},t))})).then((function(e){return e.blob()})).then((function(t){var r=window.URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download=e.fileName,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)})).catch((function(e){throw new Error("Error downloading file. "+e.message)}))},children:(0,a.jsx)(y,{name:"download"})}):(0,a.jsx)(f(),{component:"a",href:e.url,download:e.fileName,children:(0,a.jsx)(y,{name:"download"})})})}const z=function(e){return(0,a.jsxs)(l(),{className:"rustic-multipart",children:[(e.title||e.description)&&(0,a.jsxs)("div",{children:[e.title&&(0,a.jsx)(o(),{variant:"h6",children:e.title}),e.description&&(0,a.jsx)(M.default,{text:e.description})]}),e.text&&(0,a.jsx)(M.default,{text:e.text}),(t=e.files.map((function(t,r){return(0,a.jsx)(_,{file:t,showFullName:e.showFullName,getAuthHeaders:e.getAuthHeaders,children:t.url&&(0,a.jsx)(R,{url:t.url,fileName:t.name,getAuthHeaders:e.getAuthHeaders})},r)})),(0,a.jsx)(l(),{className:"rustic-files",children:t}))]});var t};return n})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../../../src/components/multipart/multipart/multipart.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../../../src/components/multipart/multipart/multipart.tsx"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,iBAAiB,CAAA;AAQxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,mKAAmK;AACnK,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CAoCtD"}
|
|
@@ -4,4 +4,5 @@ export declare const senderDescription: InputType;
|
|
|
4
4
|
export declare const wsDescription: InputType;
|
|
5
5
|
export declare const participantDetail: string;
|
|
6
6
|
export declare const getMembersDescription: InputType;
|
|
7
|
+
export declare const textInputDescription: InputType;
|
|
7
8
|
//# sourceMappingURL=sharedDescription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedDescription.d.ts","sourceRoot":"","sources":["../../src/components/sharedDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,eAAO,MAAM,yBAAyB,EAAE,SAIvC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,SAmB/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAwB3B,CAAA;AAED,eAAO,MAAM,iBAAiB,QAMoC,CAAA;AAElE,eAAO,MAAM,qBAAqB,EAAE,SASnC,CAAA"}
|
|
1
|
+
{"version":3,"file":"sharedDescription.d.ts","sourceRoot":"","sources":["../../src/components/sharedDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,eAAO,MAAM,yBAAyB,EAAE,SAIvC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,SAmB/B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAwB3B,CAAA;AAED,eAAO,MAAM,iBAAiB,QAMoC,CAAA;AAElE,eAAO,MAAM,qBAAqB,EAAE,SASnC,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,SA4ElC,CAAA"}
|
package/dist/index.css
CHANGED
|
@@ -887,46 +887,6 @@ span.rustic-open-layers-map-marker {
|
|
|
887
887
|
overflow-wrap: break-word;
|
|
888
888
|
}
|
|
889
889
|
|
|
890
|
-
.rustic-recharts-time-series {
|
|
891
|
-
display: flex;
|
|
892
|
-
flex-direction: column;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
.rustic-recharts-time-series-chart-toggle {
|
|
896
|
-
align-self: end;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
.rustic-recharts-time-series-chart-toggle-title {
|
|
900
|
-
padding: 6px 16px;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
.rustic-recharts-time-series-title {
|
|
904
|
-
text-align: center;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
.rustic-recharts-time-series-description {
|
|
908
|
-
padding: 16px;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
.rustic-recharts-time-series-legend {
|
|
912
|
-
display: flex;
|
|
913
|
-
flex-wrap: wrap;
|
|
914
|
-
gap: 8px;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
.rustic-recharts-time-series-legend-item {
|
|
918
|
-
display: flex;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
.recharts-responsive-container {
|
|
922
|
-
font-size: 12px;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
.recharts-legend-wrapper {
|
|
926
|
-
display: flex;
|
|
927
|
-
justify-content: center;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
890
|
.rustic-mermaid-container {
|
|
931
891
|
height: 100%;
|
|
932
892
|
width: 100%;
|