@rustic-ai/ui-components 1.0.6 → 1.0.7

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.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MessageProcessStatus:()=>m,ParticipantRole:()=>g,ParticipantType:()=>b,UpdateType:()=>v,default:()=>E,globalPerspectiveWorker:()=>q,initPerspective:()=>O});const n=require("react/jsx-runtime"),r=(require("@finos/perspective-viewer-datagrid"),require("@finos/perspective-viewer-d3fc"),require("@finos/perspective-viewer/dist/css/pro.css"),require("@finos/perspective-viewer/dist/css/pro-dark.css"),require("@mui/material/styles")),o=require("@mui/material/Typography");var i=e.n(o);const a=require("@mui/system/Stack");var s=e.n(a);const u=require("react"),c=require("@mui/material/Alert");var l=e.n(c);const p=require("dompurify");var d=e.n(p);const f=require("marked");var m,v,g,b;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(m||(m={})),function(e){e.Append="append",e.Replace="replace"}(v||(v={})),function(e){e.Owner="owner",e.Member="member"}(g||(g={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const h=function(e){var t=(0,r.useTheme)(),o=(0,u.useState)(e.text),a=o[0],s=o[1],c=(0,u.useState)(""),p=c[0],m=c[1];function g(e){return"string"!=typeof e?(m("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function b(e){return(0,n.jsx)(i(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(r=e,o=r.replace(/^[\u200B-\u200F\uFEFF]/,""),a=f.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),d().sanitize(a))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var r,o,a}return(0,u.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,n=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==n?void 0:n.updateType)===v.Replace)t=g(n.text);else for(var r=0,o=e.updatedData;r<o.length;r++){var i=o[r],a=i.updateType||v.Append,u=g(i.text);a===v.Append?t+=u:a===v.Replace&&(t=u)}s(t)}},[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[e.title&&(0,n.jsx)(i(),{variant:"h6",children:e.title}),e.description&&b(e.description),b(a),p&&(0,n.jsx)(l(),{severity:"error",children:p})]})},y=require("@finos/perspective");var x=e.n(y);const _=require("@finos/perspective/dist/wasm/perspective-server.wasm"),S=require("@finos/perspective-viewer");var w=e.n(S);const j=require("@finos/perspective-viewer/dist/wasm/perspective-viewer.wasm");var k,q;function O(){return k||(k=Promise.all([x().init_server(_),w().init_client(j)]).then(function(){return x().worker()}).then(function(e){q=e}))}var T=function(){return T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},T.apply(this,arguments)};function P(e){return e?e.reduce(function(e,t){var n=t.dataKey,r=t.label;return e[n]=r||n,e},{}):{}}const E=function(e){if(0===e.data.length)return(0,n.jsx)(i(),{variant:"body2",children:"No data available."});var t=(0,u.useRef)(null),o=(0,r.useTheme)(),a=(0,u.useState)(!1),c=a[0],l=a[1],p=(0,u.useState)(q),d=p[0],f=p[1],m=o.palette.mode,v="dark"===m?"Pro Dark":"Pro Light",g=P(e.headers),b="\n /* General Button Styles */\n button, .button:hover, #editor-container, .editable, #settings_button {\n border-radius: 16px !important;\n color: ".concat(o.palette.text.primary," !important;\n /* TODO: add background color after updating the theme */\n }\n \n #settings_button {\n border: 1px solid ").concat(o.palette.primary.light," !important;\n }\n \n /* Hide border for aggregate Selector */\n .aggregate-selector:hover {\n border: none !important;\n }\n \n /* Input and Select Elements */\n input, select, .noselect, #add-expression, .dropdown-width-container, \n .pivot-column-border, .pivot-column, .column-selector-column-border {\n border-radius: 8px !important;\n }\n \n /* Change background color */\n #settings_panel, #column_settings_sidebar {\n background: ").concat("dark"===m?"dark":"white"," !important;\n background-image: none !important;\n }\n \n /* Expression Edit Button */\n .expression-edit-button {\n display: none;\n }\n \n /* Add padding to expression input */\n #editor-container, .editable {\n padding: 8px !important;\n }\n \n /* Change Button Font Size */\n .button select, .button {\n font-size: 12px !important;\n }\n \n /* Button and Icon Colors */\n #status_bar .hover-target:hover .button>span {\n display:none !important;\n }\n \n #status_bar .hover-target.modal-target .button>span {\n display:none !important;\n }\n \n .button select:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(o.palette.primary.light," !important;\n }\n \n /* Hide unused buttons */\n #debug_open_button.sidebar_close_button, .reset-default-style-disabled, \n .expression-edit-button, #theme, #status, #status_bar .input-sizer {\n display: none !important;\n }\n \n #status_bar .hover-target:hover, #status_bar .hover-target.modal-target {\n height: fit-content !important;\n }\n\n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: auto !important;\n }\n\n #settings_button:hover {\n color: ").concat(o.palette.primary.contrastText," !important;\n background-color: ").concat(o.palette.primary.main," !important;\n }\n ");(0,u.useEffect)(function(){f(q)},[q]);var y,x,_,S,w,j,k,O,E,D=e.config&&(x=(y=e.config).groupBy,_=y.splitBy,S=y.aggregates,w=y.sort,j=y.filter,k=y.columns,O=null==w?void 0:w.map(function(e){return[g[e[0]]||e[0],e[1]]}),E=S&&Object.fromEntries(Object.entries(S).map(function(e){var t=e[0],n=e[1];return[g[t]||t,n]})),{group_by:null==x?void 0:x.map(function(e){return g[e]||e}),split_by:null==_?void 0:_.map(function(e){return g[e]||e}),aggregates:E,sort:O,filter:j&&function(e){return e.map(function(e){return[g[e[0]]||e[0],e[1],e[e.length-1]]})}(j),columns:null==k?void 0:k.map(function(e){return g[e]||e})});return(0,u.useEffect)(function(){var n=null,r=null,o=!0;if(d){var i=t.current;d.table(function(e,t){var n=P(t);return e.map(function(e){for(var t={},r=0,o=Object.entries(e);r<o.length;r++){var i=o[r],a=i[0],s=i[1];t[n[a]||a]=s}return t})}(e.data,e.headers)).then(function(e){if(n=e,o){if(i){if(i.shadowRoot){var t=new CSSStyleSheet;t.replaceSync(b),i.shadowRoot.adoptedStyleSheets.push(t)}return i.load(n)}}else n&&(n.delete({lazy:!0}),n=null)}).then(function(){var t,n,r;if(o&&i){var a={date_format:{dateStyle:(null===(t=e.config)||void 0===t?void 0:t.dateStyle)||"medium"}},s={};return null===(r=null===(n=e.config)||void 0===n?void 0:n.dateColumns)||void 0===r||r.forEach(function(e){s[e]=a}),i.restore(T(T({},D),{theme:v,title:e.title,settings:!1,columns_config:s}))}}).then(function(){if(o&&i)return i.getView()}).then(function(n){var i;if(o){r=n;var a=null===(i=e.config)||void 0===i?void 0:i.expansionDepth;if("number"==typeof a&&r)return r.set_depth(a).then(function(){t.current&&t.current.resize()})}else n&&n.delete()}).catch(function(){l(!0)})}return function(){o=!1,r&&r.delete(),n&&n.delete({lazy:!0})}},[d,e.data,v,e.config]),c?(0,n.jsx)(i(),{variant:"body2",children:"Failed to create table from data."}):(0,n.jsxs)(s(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,n.jsx)(i(),{variant:"h6",children:e.title}),e.description&&(0,n.jsx)(h,{text:e.description}),(0,n.jsx)("perspective-viewer",{ref:t,style:{fontFamily:o.typography.fontFamily}})]})};return t})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MessageProcessStatus:()=>v,ParticipantRole:()=>b,ParticipantType:()=>h,UpdateType:()=>g,default:()=>R,globalPerspectiveWorker:()=>q,initPerspective:()=>E});const n=require("react/jsx-runtime"),r=(require("@finos/perspective-viewer-datagrid"),require("@finos/perspective-viewer-d3fc"),require("@finos/perspective-viewer/dist/css/pro.css"),require("@finos/perspective-viewer/dist/css/pro-dark.css"),require("@mui/material/styles")),o=require("@mui/material/Typography");var a=e.n(o);const i=require("@mui/system/Stack");var s=e.n(i);const u=require("react"),c=require("@mui/material/Alert");var l=e.n(c);const p=require("dompurify");var d=e.n(p);const f=require("marked");var m,v,g,b,h;function y(e,t,n){var r;return e&&e.length>0&&null!==(r=e[e.length-1][t])&&void 0!==r?r:n}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(m||(m={})),function(e){e.Running="running",e.Completed="completed",e.Error="error"}(v||(v={})),function(e){e.Append="append",e.Replace="replace"}(g||(g={})),function(e){e.Owner="owner",e.Member="member"}(b||(b={})),function(e){e.Human="human",e.Agent="agent"}(h||(h={}));const _=function(e){var t=(0,r.useTheme)(),o=(0,u.useState)(e.text),i=o[0],s=o[1],c=(0,u.useState)(""),p=c[0],m=c[1],v=y(e.updatedData,"title",e.title),b=y(e.updatedData,"description",e.description);function h(e){return"string"!=typeof e?(m("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function _(e){return(0,n.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(r=e,o=r.replace(/^[\u200B-\u200F\uFEFF]/,""),i=f.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),d().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var r,o,i}return(0,u.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,n=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==n?void 0:n.updateType)===g.Replace)t=h(n.text);else for(var r=0,o=e.updatedData;r<o.length;r++){var a=o[r],i=a.updateType||g.Append,u=h(a.text);i===g.Append?t+=u:i===g.Replace&&(t=u)}s(t)}},[e.text,e.updatedData]),(0,n.jsxs)(n.Fragment,{children:[v&&(0,n.jsx)(a(),{variant:"h6",children:v}),b&&_(b),_(i),p&&(0,n.jsx)(l(),{severity:"error",children:p})]})},x=require("@finos/perspective");var S=e.n(x);const w=require("@finos/perspective/dist/wasm/perspective-server.wasm"),j=require("@finos/perspective-viewer");var k=e.n(j);const O=require("@finos/perspective-viewer/dist/wasm/perspective-viewer.wasm");var T,q;function E(){return T||(T=Promise.all([S().init_server(w),k().init_client(O)]).then(function(){return S().worker()}).then(function(e){q=e}))}var D=function(){return D=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},D.apply(this,arguments)};function P(e){return e?e.reduce(function(e,t){var n=t.dataKey,r=t.label;return e[n]=r||n,e},{}):{}}const R=function(e){if(0===e.data.length)return(0,n.jsx)(a(),{variant:"body2",children:"No data available."});var t=(0,u.useRef)(null),o=(0,r.useTheme)(),i=(0,u.useState)(!1),c=i[0],l=i[1],p=(0,u.useState)(q),d=p[0],f=p[1],m=o.palette.mode,v="dark"===m?"Pro Dark":"Pro Light",g=P(e.headers),b="\n /* General Button Styles */\n button, .button:hover, #editor-container, .editable, #settings_button {\n border-radius: 16px !important;\n color: ".concat(o.palette.text.primary," !important;\n /* TODO: add background color after updating the theme */\n }\n \n #settings_button {\n border: 1px solid ").concat(o.palette.primary.light," !important;\n }\n \n /* Hide border for aggregate Selector */\n .aggregate-selector:hover {\n border: none !important;\n }\n \n /* Input and Select Elements */\n input, select, .noselect, #add-expression, .dropdown-width-container, \n .pivot-column-border, .pivot-column, .column-selector-column-border {\n border-radius: 8px !important;\n }\n \n /* Change background color */\n #settings_panel, #column_settings_sidebar {\n background: ").concat("dark"===m?"dark":"white"," !important;\n background-image: none !important;\n }\n \n /* Expression Edit Button */\n .expression-edit-button {\n display: none;\n }\n \n /* Add padding to expression input */\n #editor-container, .editable {\n padding: 8px !important;\n }\n \n /* Change Button Font Size */\n .button select, .button {\n font-size: 12px !important;\n }\n \n /* Button and Icon Colors */\n #status_bar .hover-target:hover .button>span {\n display:none !important;\n }\n \n #status_bar .hover-target.modal-target .button>span {\n display:none !important;\n }\n \n .button select:hover, .psp-expression-editor__button:hover, \n .sidebar_close_button_inner:hover {\n background-color: ").concat(o.palette.primary.light," !important;\n }\n \n /* Hide unused buttons */\n #debug_open_button.sidebar_close_button, .reset-default-style-disabled, \n .expression-edit-button, #theme, #status, #status_bar .input-sizer {\n display: none !important;\n }\n \n #status_bar .hover-target:hover, #status_bar .hover-target.modal-target {\n height: fit-content !important;\n }\n\n /* Enable Scrolling */\n #plugin_selector_container.open, #status_bar, #menu-bar, #app_panel {\n overflow: auto !important;\n }\n\n #settings_button:hover {\n color: ").concat(o.palette.primary.contrastText," !important;\n background-color: ").concat(o.palette.primary.main," !important;\n }\n ");(0,u.useEffect)(function(){f(q)},[q]);var h,y,x,S,w,j,k,O,T,E=e.config&&(y=(h=e.config).groupBy,x=h.splitBy,S=h.aggregates,w=h.sort,j=h.filter,k=h.columns,O=null==w?void 0:w.map(function(e){return[g[e[0]]||e[0],e[1]]}),T=S&&Object.fromEntries(Object.entries(S).map(function(e){var t=e[0],n=e[1];return[g[t]||t,n]})),{group_by:null==y?void 0:y.map(function(e){return g[e]||e}),split_by:null==x?void 0:x.map(function(e){return g[e]||e}),aggregates:T,sort:O,filter:j&&function(e){return e.map(function(e){return[g[e[0]]||e[0],e[1],e[e.length-1]]})}(j),columns:null==k?void 0:k.map(function(e){return g[e]||e})});return(0,u.useEffect)(function(){var n=null,r=null,o=!0;if(d){var a=t.current;d.table(function(e,t){var n=P(t);return e.map(function(e){for(var t={},r=0,o=Object.entries(e);r<o.length;r++){var a=o[r],i=a[0],s=a[1];t[n[i]||i]=s}return t})}(e.data,e.headers)).then(function(e){if(n=e,o){if(a){if(a.shadowRoot){var t=new CSSStyleSheet;t.replaceSync(b),a.shadowRoot.adoptedStyleSheets.push(t)}return a.load(n)}}else n&&(n.delete({lazy:!0}),n=null)}).then(function(){var t,n,r;if(o&&a){var i={date_format:{dateStyle:(null===(t=e.config)||void 0===t?void 0:t.dateStyle)||"medium"}},s={};return null===(r=null===(n=e.config)||void 0===n?void 0:n.dateColumns)||void 0===r||r.forEach(function(e){s[e]=i}),a.restore(D(D({},E),{theme:v,title:e.title,settings:!1,columns_config:s}))}}).then(function(){if(o&&a)return a.getView()}).then(function(n){var a;if(o){r=n;var i=null===(a=e.config)||void 0===a?void 0:a.expansionDepth;if("number"==typeof i&&r)return r.set_depth(i).then(function(){t.current&&t.current.resize()})}else n&&n.delete()}).catch(function(){l(!0)})}return function(){o=!1,r&&r.delete(),n&&n.delete({lazy:!0})}},[d,e.data,v,e.config]),c?(0,n.jsx)(a(),{variant:"body2",children:"Failed to create table from data."}):(0,n.jsxs)(s(),{direction:"column",className:"rustic-perspective-viz",children:[e.title&&(0,n.jsx)(a(),{variant:"h6",children:e.title}),e.description&&(0,n.jsx)(_,{text:e.description}),(0,n.jsx)("perspective-viewer",{ref:t,style:{fontFamily:o.typography.fontFamily}})]})};return t})());
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const u=require("react"),s=require("react-plotly.js");var c=e.n(s);const l=require("@mui/material/Alert");var p=e.n(l);const d=require("@mui/material/styles"),m=require("dompurify");var f=e.n(m);const y=require("marked");var v,g,x,b;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(v||(v={})),function(e){e.Append="append",e.Replace="replace"}(g||(g={})),function(e){e.Owner="owner",e.Member="member"}(x||(x={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const h=function(e){var t=(0,d.useTheme)(),n=(0,u.useState)(e.text),o=n[0],i=n[1],s=(0,u.useState)(""),c=s[0],l=s[1];function m(e){return"string"!=typeof e?(l("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function v(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,o=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=y.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),f().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,o,i}return(0,u.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===g.Replace)t=m(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],u=o.updateType||g.Append,s=m(o.text);u===g.Append?t+=s:u===g.Replace&&(t=s)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&v(e.description),v(o),c&&(0,r.jsx)(p(),{severity:"error",children:c})]})};var j=function(){return j=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},j.apply(this,arguments)};const S=function(e){var t=j(j({},e.plotParams),{className:"rustic-plotly"});return t.config=j(j({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,r.jsxs)(i(),{className:"rustic-plotly-container",children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&(0,r.jsx)(h,{text:e.description}),(0,r.jsx)(c(),j({},t))]})};return t})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>S});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const u=require("react"),s=require("react-plotly.js");var c=e.n(s);const l=require("@mui/material/Alert");var d=e.n(l);const p=require("@mui/material/styles"),f=require("dompurify");var m=e.n(f);const y=require("marked");var v,g,x,h,b;function j(e,t,r){var n;return e&&e.length>0&&null!==(n=e[e.length-1][t])&&void 0!==n?n:r}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(v||(v={})),function(e){e.Running="running",e.Completed="completed",e.Error="error"}(g||(g={})),function(e){e.Append="append",e.Replace="replace"}(x||(x={})),function(e){e.Owner="owner",e.Member="member"}(h||(h={})),function(e){e.Human="human",e.Agent="agent"}(b||(b={}));const O=function(e){var t=(0,p.useTheme)(),n=(0,u.useState)(e.text),o=n[0],i=n[1],s=(0,u.useState)(""),c=s[0],l=s[1],f=j(e.updatedData,"title",e.title),v=j(e.updatedData,"description",e.description);function g(e){return"string"!=typeof e?(l("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function h(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,o=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=y.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),m().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,o,i}return(0,u.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===x.Replace)t=g(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],u=o.updateType||x.Append,s=g(o.text);u===x.Append?t+=s:u===x.Replace&&(t=s)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[f&&(0,r.jsx)(a(),{variant:"h6",children:f}),v&&h(v),h(o),c&&(0,r.jsx)(d(),{severity:"error",children:c})]})};var T=function(){return T=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},T.apply(this,arguments)};const S=function(e){var t=T(T({},e.plotParams),{className:"rustic-plotly"});return t.config=T(T({},t.config),{displaylogo:!1,responsive:!0,editable:!1}),(0,r.jsxs)(i(),{className:"rustic-plotly-container",children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&(0,r.jsx)(O,{text:e.description}),(0,r.jsx)(c(),T({},t))]})};return t})());
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>Z});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const c=require("@mui/system/Stack");var u=e.n(c);const s=require("@mui/system/useTheme");var l=e.n(s);const d=require("axios");var p=e.n(d);const f=require("react"),m=require("react-dom/server"),v=require("vega"),h=require("vega-embed");var y=e.n(h);const b=require("@mui/material/Alert");var x=e.n(b);const g=require("@mui/material/styles"),j=require("dompurify");var w=e.n(j);const O=require("marked");var S,q,T,k;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(S||(S={})),function(e){e.Append="append",e.Replace="replace"}(q||(q={})),function(e){e.Owner="owner",e.Member="member"}(T||(T={})),function(e){e.Human="human",e.Agent="agent"}(k||(k={}));const F=function(e){var t=(0,g.useTheme)(),n=(0,f.useState)(e.text),o=n[0],i=n[1],c=(0,f.useState)(""),u=c[0],s=c[1];function l(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function d(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,o=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=O.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),w().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,o,i}return(0,f.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===q.Replace)t=l(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],c=o.updateType||q.Append,u=l(o.text);c===q.Append?t+=u:c===q.Replace&&(t=u)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[e.title&&(0,r.jsx)(a(),{variant:"h6",children:e.title}),e.description&&d(e.description),d(o),u&&(0,r.jsx)(x(),{severity:"error",children:u})]})},I=require("@mui/material"),A=require("@mui/material/Button");var R=e.n(A);const D=require("@mui/material/Drawer");var N=e.n(D);const P=require("@mui/material/IconButton");var E=e.n(P);const M=require("@mui/material/ListItemText");var C=e.n(M);const _=require("@mui/material/Menu");var L=e.n(_);const z=require("@mui/material/MenuItem");var B=e.n(z);const G=require("@mui/material/Tooltip");var H=e.n(G);const W=require("@mui/system");var J=function(){return J=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},J.apply(this,arguments)};function Q(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:J({},t),children:e.name})}var U=function(){return U=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},U.apply(this,arguments)};function V(e){var t=(0,f.useState)(!1),n=t[0],o=t[1],i=(0,f.useRef)(null),c=(0,g.useTheme)(),u=(0,I.useMediaQuery)(c.breakpoints.down("md")),s=u?N():L(),l={borderRadius:"".concat(c.shape.borderRadius,"px"),border:"1px solid ".concat(c.palette.divider)};function d(e){return(0,r.jsxs)(r.Fragment,{children:[e.startDecorator&&(0,r.jsx)(W.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,r.jsx)(C(),{children:(0,r.jsx)(a(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,r.jsx)(W.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}u&&(l=U(U({},l),{borderRadius:"".concat(c.shape.borderRadius,"px ").concat(c.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,r.jsx)(B(),{component:"a",onClick:function(){return o(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,r.jsx)(B(),{onClick:function(t){e.onClick&&e.onClick(t),o(!1)},disabled:!e.onClick,children:d(e)},e.label)});var m,v,h=u?{}:{anchorEl:i.current};return(0,r.jsxs)(r.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),o(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,r.jsx)(Q,{name:"more_vert"}),e.buttonText?(0,r.jsx)(R(),U({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,r.jsx)(H(),{title:e.ariaLabel,children:(0,r.jsx)(E(),U({},m,{children:e.icon?e.icon:v}))})),(0,r.jsx)(s,U({open:n,onClose:function(){return o(!1)}},h,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":U(U({},l),{backgroundImage:"none",boxShadow:c.shadows[2]})},children:p}))]})}var X=function(){return X=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},X.apply(this,arguments)},K=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},Y="source_0";const Z=function(e){var t=e.theme,n=void 0===t?{dark:"dark"}:t,o=e.refreshIntervalInMs,c=void 0===o?0:o,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,["theme","refreshIntervalInMs"]),d=(0,f.useRef)(null),h=(0,f.useRef)(null),b=(0,f.useState)(!1),x=b[0],g=b[1],j=l()(),w="dark"===j.palette.mode,O=j.typography.fontFamily,S=function(e,t){var r={method:t.method||"GET",headers:t.headers,responseType:"text",data:t.body};return(s.getAuthHeaders?s.getAuthHeaders().then(function(e){return r.headers=X(X({},r.headers),e.headers),r}):Promise.resolve(r)).then(function(t){return p()(e,t)}).then(function(e){return e.data})};function T(){var e=v.loader();return s.getAuthHeaders&&(e.http=S),e}var k={backgroundColor:j.palette.primary.main,color:j.palette.background.paper,borderRadius:j.shape.borderRadius+"px",padding:"4px 8px",fontSize:j.typography.caption.fontSize,fontFamily:O,fontWeight:j.typography.caption.fontWeight},I={formatTooltip:function(e,t){return(0,m.renderToStaticMarkup)((0,r.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:k,children:Object.entries(e).map(function(e){var n=e[0],a=e[1];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:[t(n),":"]})," ",t(a)]},n)})}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},A=[{label:"Save as SVG"},{label:"Save as PNG"}];function R(){var e,t;if(d.current&&s.spec){var r=X(X({config:{font:O}},s.options),{theme:w?n.dark:n.light,tooltip:I,actions:!1,loader:T()});(null===(t=null===(e=s.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(r.config.font=O);var a=X(X({},s.spec),{name:Y});delete a.title,y()(d.current,a,r).then(function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map(function(n,a){var o="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,o).then(function(e){A[a].href=e,A[a].downloadFileName="".concat(r,".").concat(n)})}),h.current=e.view,g(!1),c>0&&function(){var e=this;if(h.current&&s.spec){D.current&&(clearInterval(D.current),D.current=null);var t=s.spec.data;if(t&&"object"==typeof t&&"url"in t&&t.url){var r=setInterval(function(){return r=e,n=void 0,o=function(){var e,r,n;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}(this,function(a){switch(a.label){case 0:if(!h.current)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,T().load(t.url)];case 2:return e=a.sent(),r=JSON.parse(e),n=v.changeset().remove(function(){return!0}).insert(r),h.current.change(Y,n).run(),[3,4];case 3:return a.sent(),g(!0),[3,4];case 4:return[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function i(e){try{u(o.next(e))}catch(e){t(e)}}function c(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(i,c)}u((o=o.apply(r,n||[])).next())});var r,n,a,o},c);D.current=r}}}()}).catch(function(){g(!0)})}}(0,f.useEffect)(function(){if(d.current){var e=null;return(e=new ResizeObserver(function(e){e.some(function(e){return e.contentRect.width>0})&&requestAnimationFrame(function(){R()})})).observe(d.current),requestAnimationFrame(function(){R()}),window.addEventListener("resize",t),function(){window.removeEventListener("resize",t),null==e||e.disconnect()}}function t(){requestAnimationFrame(function(){R()})}},[s.spec,w]),(0,f.useEffect)(function(){var e=setTimeout(function(){if(s.updatedData&&s.updatedData.length>0&&h.current)try{var e=function(e){var t,r=[],n=!1;if(e){var a=e.at(-1);if((null==a?void 0:a.updateType)===q.Replace){if((null===(t=a.spec)||void 0===t?void 0:t.data)&&"values"in a.spec.data){var o=a.spec.data.values;Array.isArray(o)&&(n=!0,r=K([],o,!0))}}else e.forEach(function(e){var t;if((null===(t=e.spec)||void 0===t?void 0:t.data)&&"values"in e.spec.data){var a=e.spec.data.values;Array.isArray(a)&&(e.updateType===q.Append?r.push.apply(r,a):e.updateType===q.Replace&&(n=!0,r=K([],a,!0)))}})}return v.changeset().remove(function(){return n}).insert(r)}(s.updatedData);h.current.change(Y,e).run()}catch(e){console.error("Failed to update streaming data:",e)}},1);return function(){return clearTimeout(e)}},[s.updatedData]);var D=(0,f.useRef)(null);return(0,f.useEffect)(function(){return function(){D.current&&clearInterval(D.current)}},[]),x?(0,r.jsx)(a(),{variant:"body2",children:"Failed to load the chart."}):(0,r.jsxs)(u(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,r.jsx)(i(),{justifyContent:"end",display:"flex",children:(0,r.jsx)(V,{menuItems:A,ariaLabel:"Download options"})}),s.title&&(0,r.jsx)(a(),{variant:"h6",children:s.title}),s.description&&(0,r.jsx)(F,{text:s.description}),(0,r.jsxs)(i(),{textAlign:"center",mt:1,children:["string"==typeof s.spec.title&&(0,r.jsx)(a(),{variant:"subtitle2",children:s.spec.title}),s.spec.description&&(0,r.jsx)(a(),{variant:"caption",children:s.spec.description})]}),(0,r.jsx)("div",{ref:d,className:"rustic-vega-lite"})]})};return t})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["@rustic-ai/ui-components"]=t():e["@rustic-ai/ui-components"]=t()}(global,()=>(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>ee});const r=require("react/jsx-runtime"),n=require("@mui/material/Typography");var a=e.n(n);const o=require("@mui/system/Box");var i=e.n(o);const c=require("@mui/system/Stack");var u=e.n(c);const s=require("@mui/system/useTheme");var l=e.n(s);const d=require("axios");var p=e.n(d);const f=require("react"),m=require("react-dom/server"),v=require("vega"),h=require("vega-embed");var y,b=e.n(h);function g(e,t,r){var n;return e&&e.length>0&&null!==(n=e[e.length-1][t])&&void 0!==n?n:r}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(y||(y={}));const x=require("@mui/material/Alert");var j=e.n(x);const w=require("@mui/material/styles"),O=require("dompurify");var T=e.n(O);const S=require("marked");var q,D,k,R;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(q||(q={})),function(e){e.Append="append",e.Replace="replace"}(D||(D={})),function(e){e.Owner="owner",e.Member="member"}(k||(k={})),function(e){e.Human="human",e.Agent="agent"}(R||(R={}));const A=function(e){var t=(0,w.useTheme)(),n=(0,f.useState)(e.text),o=n[0],i=n[1],c=(0,f.useState)(""),u=c[0],s=c[1],l=g(e.updatedData,"title",e.title),d=g(e.updatedData,"description",e.description);function p(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function m(e){return(0,r.jsx)(a(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,o=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=S.marked.parse(o,{async:!1,breaks:!0,gfm:!0}),T().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(t.palette.divider)}}});var n,o,i}return(0,f.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var t=e.text,r=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==r?void 0:r.updateType)===D.Replace)t=p(r.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],c=o.updateType||D.Append,u=p(o.text);c===D.Append?t+=u:c===D.Replace&&(t=u)}i(t)}},[e.text,e.updatedData]),(0,r.jsxs)(r.Fragment,{children:[l&&(0,r.jsx)(a(),{variant:"h6",children:l}),d&&m(d),m(o),u&&(0,r.jsx)(j(),{severity:"error",children:u})]})},F=require("@mui/material"),I=require("@mui/material/Button");var N=e.n(I);const E=require("@mui/material/Drawer");var M=e.n(E);const P=require("@mui/material/IconButton");var C=e.n(P);const _=require("@mui/material/ListItemText");var H=e.n(_);const B=require("@mui/material/Menu");var L=e.n(B);const z=require("@mui/material/MenuItem");var G=e.n(z);const U=require("@mui/material/Tooltip");var W=e.n(U);const J=require("@mui/system");var Q=function(){return Q=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Q.apply(this,arguments)};function V(e){e.name.replaceAll("_","-");var t={};return e.color&&(t={color:e.color}),(0,r.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:Q({},t),children:e.name})}var X=function(){return X=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},X.apply(this,arguments)};function K(e){var t=(0,f.useState)(!1),n=t[0],o=t[1],i=(0,f.useRef)(null),c=(0,w.useTheme)(),u=(0,F.useMediaQuery)(c.breakpoints.down("md")),s=u?M():L(),l={borderRadius:"".concat(c.shape.borderRadius,"px"),border:"1px solid ".concat(c.palette.divider)};function d(e){return(0,r.jsxs)(r.Fragment,{children:[e.startDecorator&&(0,r.jsx)(J.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,r.jsx)(H(),{children:(0,r.jsx)(a(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,r.jsx)(J.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}u&&(l=X(X({},l),{borderRadius:"".concat(c.shape.borderRadius,"px ").concat(c.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,r.jsx)(G(),{component:"a",onClick:function(){return o(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:d(e)},e.label):(0,r.jsx)(G(),{onClick:function(t){e.onClick&&e.onClick(t),o(!1)},disabled:!e.onClick,children:d(e)},e.label)});var m,v,h=u?{}:{anchorEl:i.current};return(0,r.jsxs)(r.Fragment,{children:[(m={onClick:function(e){e.stopPropagation(),o(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,r.jsx)(V,{name:"more_vert"}),e.buttonText?(0,r.jsx)(N(),X({},m,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,r.jsx)(W(),{title:e.ariaLabel,children:(0,r.jsx)(C(),X({},m,{children:e.icon?e.icon:v}))})),(0,r.jsx)(s,X({open:n,onClose:function(){return o(!1)}},h,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":X(X({},l),{backgroundImage:"none",boxShadow:c.shadows[2]})},children:p}))]})}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)},Z=function(e,t,r){if(r||2===arguments.length)for(var n,a=0,o=t.length;a<o;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))},$="source_0";const ee=function(e){var t=e.theme,n=void 0===t?{dark:"dark"}:t,o=e.refreshIntervalInMs,c=void 0===o?0:o,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,["theme","refreshIntervalInMs"]),d=(0,f.useRef)(null),h=(0,f.useRef)(null),y=(0,f.useState)(!1),x=y[0],j=y[1],w=l()(),O="dark"===w.palette.mode,T=w.typography.fontFamily,S=g(s.updatedData,"title",s.title),q=g(s.updatedData,"description",s.description),k=function(e,t){var r={method:t.method||"GET",headers:t.headers,responseType:"text",data:t.body};return(s.getAuthHeaders?s.getAuthHeaders().then(function(e){return r.headers=Y(Y({},r.headers),e.headers),r}):Promise.resolve(r)).then(function(t){return p()(e,t)}).then(function(e){return e.data})};function R(){var e=v.loader();return s.getAuthHeaders&&(e.http=k),e}var F={backgroundColor:w.palette.primary.main,color:w.palette.background.paper,borderRadius:w.shape.borderRadius+"px",padding:"4px 8px",fontSize:w.typography.caption.fontSize,fontFamily:T,fontWeight:w.typography.caption.fontWeight},I={formatTooltip:function(e,t){return(0,m.renderToStaticMarkup)((0,r.jsx)("div",{role:"tooltip",className:"rustic-vega-lite-tooltip-content",style:F,children:Object.entries(e).map(function(e){var n=e[0],a=e[1];return(0,r.jsxs)("div",{children:[(0,r.jsxs)("strong",{children:[t(n),":"]})," ",t(a)]},n)})}))},disableDefaultStyle:!0,id:"rustic-vega-lite-tooltip"},N=[{label:"Save as SVG"},{label:"Save as PNG"}];function E(){var e,t;if(d.current&&s.spec){var r=Y(Y({config:{font:T}},s.options),{theme:O?n.dark:n.light,tooltip:I,actions:!1,loader:R()});(null===(t=null===(e=s.options)||void 0===e?void 0:e.config)||void 0===t?void 0:t.font)||(r.config.font=T);var a=Y(Y({},s.spec),{name:$});delete a.title,b()(d.current,a,r).then(function(e){var t=e.embedOptions,r=e.embedOptions.downloadFileName||"visualization";["svg","png"].map(function(n,a){var o="object"==typeof t.scaleFactor?t.scaleFactor[n]:t.scaleFactor;e.view.toImageURL(n,o).then(function(e){N[a].href=e,N[a].downloadFileName="".concat(r,".").concat(n)})}),h.current=e.view,j(!1),c>0&&function(){var e=this;if(h.current&&s.spec){M.current&&(clearInterval(M.current),M.current=null);var t=s.spec.data;if(t&&"object"==typeof t&&"url"in t&&t.url){var r=setInterval(function(){return r=e,n=void 0,o=function(){var e,r,n;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}(this,function(a){switch(a.label){case 0:if(!h.current)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,R().load(t.url)];case 2:return e=a.sent(),r=JSON.parse(e),n=v.changeset().remove(function(){return!0}).insert(r),h.current.change($,n).run(),[3,4];case 3:return a.sent(),j(!0),[3,4];case 4:return[2]}})},new((a=void 0)||(a=Promise))(function(e,t){function i(e){try{u(o.next(e))}catch(e){t(e)}}function c(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(i,c)}u((o=o.apply(r,n||[])).next())});var r,n,a,o},c);M.current=r}}}()}).catch(function(){j(!0)})}}(0,f.useEffect)(function(){if(d.current){var e=null;return d.current.getBoundingClientRect().width>0?requestAnimationFrame(function(){E()}):(e=new ResizeObserver(function(t){t.some(function(e){return e.contentRect.width>0})&&e&&(requestAnimationFrame(function(){E()}),e.disconnect(),e=null)})).observe(d.current),window.addEventListener("resize",t),function(){window.removeEventListener("resize",t),null==e||e.disconnect()}}function t(){requestAnimationFrame(function(){E()})}},[s.spec,O]),(0,f.useEffect)(function(){var e=setTimeout(function(){if(s.updatedData&&s.updatedData.length>0&&h.current)try{var e=function(e){var t,r=[],n=!1;if(e){var a=e.at(-1);if((null==a?void 0:a.updateType)===D.Replace){if((null===(t=a.spec)||void 0===t?void 0:t.data)&&"values"in a.spec.data){var o=a.spec.data.values;Array.isArray(o)&&(n=!0,r=Z([],o,!0))}}else e.forEach(function(e){var t;if((null===(t=e.spec)||void 0===t?void 0:t.data)&&"values"in e.spec.data){var a=e.spec.data.values;Array.isArray(a)&&(e.updateType===D.Append?r.push.apply(r,a):e.updateType===D.Replace&&(n=!0,r=Z([],a,!0)))}})}return v.changeset().remove(function(){return n}).insert(r)}(s.updatedData);h.current.change($,e).run()}catch(e){console.error("Failed to update streaming data:",e)}},1);return function(){return clearTimeout(e)}},[s.updatedData]);var M=(0,f.useRef)(null);return(0,f.useEffect)(function(){return function(){M.current&&clearInterval(M.current)}},[]),x?(0,r.jsx)(a(),{variant:"body2",children:"Failed to load the chart."}):(0,r.jsxs)(u(),{direction:"column",className:"rustic-vega-lite-container",children:[(0,r.jsx)(i(),{justifyContent:"end",display:"flex",children:(0,r.jsx)(K,{menuItems:N,ariaLabel:"Download options"})}),S&&(0,r.jsx)(a(),{variant:"h6",children:S}),s.description&&(0,r.jsx)(A,{text:s.description,updatedData:s.updatedData&&s.updatedData.length>0&&q?[{text:q,updateType:D.Replace}]:void 0}),(0,r.jsxs)(i(),{textAlign:"center",mt:1,children:["string"==typeof s.spec.title&&(0,r.jsx)(a(),{variant:"subtitle2",children:s.spec.title}),s.spec.description&&(0,r.jsx)(a(),{variant:"caption",children:s.spec.description})]}),(0,r.jsx)("div",{ref:d,className:"rustic-vega-lite"})]})};return t})());
@@ -1 +1 @@
1
- {"version":3,"file":"vegaLiteViz.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/vegaLiteViz/vegaLiteViz.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAgB1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAIxD;;;;;;;;GAQG;AACH,iBAAS,WAAW,CAAC,EACnB,KAEC,EACD,mBAAuB,EACvB,GAAG,KAAK,EACT,EAAE,aAAa,2CAwTf;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"vegaLiteViz.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/vegaLiteViz/vegaLiteViz.tsx"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAiB1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAIxD;;;;;;;;GAQG;AACH,iBAAS,WAAW,CAAC,EACnB,KAEC,EACD,mBAAuB,EACvB,GAAG,KAAK,EACT,EAAE,aAAa,2CAsVf;AAED,eAAe,WAAW,CAAA"}
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{MessageProcessStatus:()=>w,ParticipantRole:()=>S,ParticipantType:()=>N,UpdateType:()=>T,default:()=>Y});const t=require("react/jsx-runtime"),n=require("@mui/material/Box");var a=e.n(n);const i=require("@mui/material/Card");var o=e.n(i);const c=require("@mui/material/Stack");var s=e.n(c);const u=require("@mui/material/Typography");var l=e.n(u);const d=require("react");var m;function p(e){var r=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"][new Date(1e3*e).getDay()];return{shortName:r,fullName:{Sun:"Sunday",Mon:"Monday",Tues:"Tuesday",Wed:"Wednesday",Thurs:"Thursday",Fri:"Friday",Sat:"Saturday"}[r]}}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(m||(m={}));var h=function(){return h=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},h.apply(this,arguments)};function x(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:h({},r),children:e.name})}const v=require("@mui/material/Alert");var f=e.n(v);const y=require("@mui/material/styles"),b=require("dompurify");var j=e.n(b);const g=require("marked");var w,T,S,N;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(w||(w={})),function(e){e.Append="append",e.Replace="replace"}(T||(T={})),function(e){e.Owner="owner",e.Member="member"}(S||(S={})),function(e){e.Human="human",e.Agent="agent"}(N||(N={}));const D=function(e){var r=(0,y.useTheme)(),n=(0,d.useState)(e.text),a=n[0],i=n[1],o=(0,d.useState)(""),c=o[0],s=o[1];function u(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function m(e){return(0,t.jsx)(l(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,a=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=g.marked.parse(a,{async:!1,breaks:!0,gfm:!0}),j().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(r.palette.divider)}}});var n,a,i}return(0,d.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var r=e.text,t=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==t?void 0:t.updateType)===T.Replace)r=u(t.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],c=o.updateType||T.Append,s=u(o.text);c===T.Append?r+=s:c===T.Replace&&(r=s)}i(r)}},[e.text,e.updatedData]),(0,t.jsxs)(t.Fragment,{children:[e.title&&(0,t.jsx)(l(),{variant:"h6",children:e.title}),e.description&&m(e.description),m(a),c&&(0,t.jsx)(f(),{severity:"error",children:c})]})},q=require("@mui/material"),M=require("@mui/material/Button");var I=e.n(M);const O=require("@mui/material/Drawer");var F=e.n(O);const k=require("@mui/material/IconButton");var C=e.n(k);const P=require("@mui/material/ListItemText");var R=e.n(P);const _=require("@mui/material/Menu");var A=e.n(_);const H=require("@mui/material/MenuItem");var B=e.n(H);const E=require("@mui/material/Tooltip");var L=e.n(E);const W=require("@mui/system");var U=function(){return U=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},U.apply(this,arguments)};function G(e){var r=(0,d.useState)(!1),n=r[0],a=r[1],i=(0,d.useRef)(null),o=(0,y.useTheme)(),c=(0,q.useMediaQuery)(o.breakpoints.down("md")),s=c?F():A(),u={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function m(e){return(0,t.jsxs)(t.Fragment,{children:[e.startDecorator&&(0,t.jsx)(W.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,t.jsx)(R(),{children:(0,t.jsx)(l(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,t.jsx)(W.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(u=U(U({},u),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,t.jsx)(B(),{component:"a",onClick:function(){return a(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:m(e)},e.label):(0,t.jsx)(B(),{onClick:function(r){e.onClick&&e.onClick(r),a(!1)},disabled:!e.onClick,children:m(e)},e.label)});var h,v,f=c?{}:{anchorEl:i.current};return(0,t.jsxs)(t.Fragment,{children:[(h={onClick:function(e){e.stopPropagation(),a(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,t.jsx)(x,{name:"more_vert"}),e.buttonText?(0,t.jsx)(I(),U({},h,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,t.jsx)(L(),{title:e.ariaLabel,children:(0,t.jsx)(C(),U({},h,{children:e.icon?e.icon:v}))})),(0,t.jsx)(s,U({open:n,onClose:function(){return a(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":U(U({},u),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:p}))]})}const Y=function(e){var r=(0,d.useState)(e.units),n=r[0],i=r[1];function c(r){return"metric"===e.units&&"imperial"===n?Math.round(1.8*r+32):"imperial"===e.units&&"metric"===n?Math.round(r*(5/9)-32):Math.round(r)}var u=new Date(1e3*e.weather[0].timestamp),m=p(e.weather[0].timestamp).shortName,h=u.getDate(),v=u.getFullYear().toString().slice(2),f="".concat(m," ").concat(h,"/").concat(v," TODAY"),y="HIGH: ".concat(c(e.weather[0].temp.high)," / LOW: ").concat(c(e.weather[0].temp.high)),b=e.weather.map(function(e,r){if(0!==r)return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,t.jsx)(l(),{variant:"h5",component:"span",color:"text.secondary","aria-label":p(e.timestamp).fullName,children:p(e.timestamp).shortName}),(0,t.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,t.jsxs)(l(),{variant:"body2",color:"text.secondary",children:["High: ",c(e.temp.high),"°"]}),(0,t.jsxs)(l(),{variant:"body2",color:"text.secondary",children:["Low: ",c(e.temp.low),"°"]})]},r)});return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-weather",children:[e.title&&(0,t.jsx)(l(),{variant:"h6",children:e.title}),e.description&&(0,t.jsx)(D,{text:e.description}),(0,t.jsx)(G,{ariaLabel:"Temperature units",menuItems:[{label:"Celsius",endDecorator:"°C",onClick:function(){return i("metric")}},{label:"Fahrenheit",endDecorator:"°F",onClick:function(){return i("imperial")}}]}),(0,t.jsxs)(s(),{alignItems:"center",children:[(0,t.jsx)(l(),{variant:"h4",component:"span",children:e.location}),(0,t.jsxs)(s(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-current-weather-description",children:[(0,t.jsx)("img",{src:e.weather[0].weatherIcon.icon,alt:""}),(0,t.jsx)(l(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,t.jsxs)(l(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[c(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(n)]}),(0,t.jsxs)(s(),{direction:"row",spacing:2,children:[(0,t.jsx)(l(),{variant:"overline",children:f}),(0,t.jsx)(l(),{variant:"overline",children:y})]})]}),(0,t.jsx)(a(),{className:"rustic-daily-weather-container",children:b}),e.weatherProvider&&(0,t.jsxs)(s(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,t.jsx)(x,{name:"cloud"}),(0,t.jsx)(l(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})};return r})());
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@rustic-ai/ui-components"]=r():e["@rustic-ai/ui-components"]=r()}(global,()=>(()=>{"use strict";var e={n:r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};e.r(r),e.d(r,{MessageProcessStatus:()=>T,ParticipantRole:()=>N,ParticipantType:()=>D,UpdateType:()=>S,default:()=>z});const t=require("react/jsx-runtime"),n=require("@mui/material/Box");var a=e.n(n);const i=require("@mui/material/Card");var o=e.n(i);const c=require("@mui/material/Stack");var s=e.n(c);const u=require("@mui/material/Typography");var l=e.n(u);const d=require("react");var m;function p(e){var r=["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"][new Date(1e3*e).getDay()];return{shortName:r,fullName:{Sun:"Sunday",Mon:"Monday",Tues:"Tuesday",Wed:"Wednesday",Thurs:"Thursday",Fri:"Friday",Sat:"Saturday"}[r]}}function h(e,r,t){var n;return e&&e.length>0&&null!==(n=e[e.length-1][r])&&void 0!==n?n:t}!function(e){e[e.HOUR=0]="HOUR",e[e.MONTH_DATE=1]="MONTH_DATE"}(m||(m={}));var v=function(){return v=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},v.apply(this,arguments)};function x(e){e.name.replaceAll("_","-");var r={};return e.color&&(r={color:e.color}),(0,t.jsx)("span",{className:"".concat(e.className?e.className+" ":"","material-symbols-rounded"),style:v({},r),children:e.name})}const f=require("@mui/material/Alert");var y=e.n(f);const b=require("@mui/material/styles"),j=require("dompurify");var g=e.n(j);const w=require("marked");var T,S,N,D;!function(e){e.Running="running",e.Completed="completed",e.Error="error"}(T||(T={})),function(e){e.Append="append",e.Replace="replace"}(S||(S={})),function(e){e.Owner="owner",e.Member="member"}(N||(N={})),function(e){e.Human="human",e.Agent="agent"}(D||(D={}));const q=function(e){var r=(0,b.useTheme)(),n=(0,d.useState)(e.text),a=n[0],i=n[1],o=(0,d.useState)(""),c=o[0],s=o[1],u=h(e.updatedData,"title",e.title),m=h(e.updatedData,"description",e.description);function p(e){return"string"!=typeof e?(s("Some of the incoming text was not correctly formatted. Some data may be missing.")," [MISSING TEXT]"):e}function v(e){return(0,t.jsx)(l(),{component:"div",className:"rustic-markdown",dangerouslySetInnerHTML:{__html:(n=e,a=n.replace(/^[\u200B-\u200F\uFEFF]/,""),i=w.marked.parse(a,{async:!1,breaks:!0,gfm:!0}),g().sanitize(i))},sx:{"& table, & th, & td":{border:"1px solid ".concat(r.palette.divider)}}});var n,a,i}return(0,d.useEffect)(function(){if(e.updatedData&&e.updatedData.length>0){var r=e.text,t=e.updatedData.at(-1);if(e.updatedData.length>1&&(null==t?void 0:t.updateType)===S.Replace)r=p(t.text);else for(var n=0,a=e.updatedData;n<a.length;n++){var o=a[n],c=o.updateType||S.Append,s=p(o.text);c===S.Append?r+=s:c===S.Replace&&(r=s)}i(r)}},[e.text,e.updatedData]),(0,t.jsxs)(t.Fragment,{children:[u&&(0,t.jsx)(l(),{variant:"h6",children:u}),m&&v(m),v(a),c&&(0,t.jsx)(y(),{severity:"error",children:c})]})},M=require("@mui/material"),I=require("@mui/material/Button");var O=e.n(I);const F=require("@mui/material/Drawer");var k=e.n(F);const C=require("@mui/material/IconButton");var P=e.n(C);const R=require("@mui/material/ListItemText");var _=e.n(R);const A=require("@mui/material/Menu");var H=e.n(A);const B=require("@mui/material/MenuItem");var E=e.n(B);const L=require("@mui/material/Tooltip");var W=e.n(L);const U=require("@mui/system");var G=function(){return G=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},G.apply(this,arguments)};function Y(e){var r=(0,d.useState)(!1),n=r[0],a=r[1],i=(0,d.useRef)(null),o=(0,b.useTheme)(),c=(0,M.useMediaQuery)(o.breakpoints.down("md")),s=c?k():H(),u={borderRadius:"".concat(o.shape.borderRadius,"px"),border:"1px solid ".concat(o.palette.divider)};function m(e){return(0,t.jsxs)(t.Fragment,{children:[e.startDecorator&&(0,t.jsx)(U.Box,{sx:{color:"primary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-start-icon",children:e.startDecorator}),(0,t.jsx)(_(),{children:(0,t.jsx)(l(),{variant:"body2",children:e.label})}),e.endDecorator&&(0,t.jsx)(U.Box,{sx:{color:"secondary.main"},className:"rustic-popover-menu-item-icon rustic-popover-menu-item-end-icon",children:e.endDecorator})]})}c&&(u=G(G({},u),{borderRadius:"".concat(o.shape.borderRadius,"px ").concat(o.shape.borderRadius,"px 0 0"),borderBottom:0}));var p=e.menuItems.map(function(e){return e.href?(0,t.jsx)(E(),{component:"a",onClick:function(){return a(!1)},href:e.href,download:e.downloadFileName||e.isFiledownload,children:m(e)},e.label):(0,t.jsx)(E(),{onClick:function(r){e.onClick&&e.onClick(r),a(!1)},disabled:!e.onClick,children:m(e)},e.label)});var h,v,f=c?{}:{anchorEl:i.current};return(0,t.jsxs)(t.Fragment,{children:[(h={onClick:function(e){e.stopPropagation(),a(!0)},"aria-label":e.ariaLabel,ref:i,className:"rustic-popover-menu-button"},v=(0,t.jsx)(x,{name:"more_vert"}),e.buttonText?(0,t.jsx)(O(),G({},h,{startIcon:e.icon?e.icon:null,children:e.buttonText})):(0,t.jsx)(W(),{title:e.ariaLabel,children:(0,t.jsx)(P(),G({},h,{children:e.icon?e.icon:v}))})),(0,t.jsx)(s,G({open:n,onClose:function(){return a(!1)}},f,{anchor:"bottom",className:"rustic-popover-menu",sx:{"& .MuiPaper-root":G(G({},u),{backgroundImage:"none",boxShadow:o.shadows[2]})},children:p}))]})}const z=function(e){var r=(0,d.useState)(e.units),n=r[0],i=r[1];function c(r){return"metric"===e.units&&"imperial"===n?Math.round(1.8*r+32):"imperial"===e.units&&"metric"===n?Math.round(r*(5/9)-32):Math.round(r)}var u=new Date(1e3*e.weather[0].timestamp),m=p(e.weather[0].timestamp).shortName,h=u.getDate(),v=u.getFullYear().toString().slice(2),f="".concat(m," ").concat(h,"/").concat(v," TODAY"),y="HIGH: ".concat(c(e.weather[0].temp.high)," / LOW: ").concat(c(e.weather[0].temp.high)),b=e.weather.map(function(e,r){if(0!==r)return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-daily-weather-card",children:[(0,t.jsx)(l(),{variant:"h5",component:"span",color:"text.secondary","aria-label":p(e.timestamp).fullName,children:p(e.timestamp).shortName}),(0,t.jsx)("img",{src:e.weatherIcon.icon,alt:e.weatherIcon.description}),(0,t.jsxs)(l(),{variant:"body2",color:"text.secondary",children:["High: ",c(e.temp.high),"°"]}),(0,t.jsxs)(l(),{variant:"body2",color:"text.secondary",children:["Low: ",c(e.temp.low),"°"]})]},r)});return(0,t.jsxs)(o(),{variant:"outlined",className:"rustic-weather",children:[e.title&&(0,t.jsx)(l(),{variant:"h6",children:e.title}),e.description&&(0,t.jsx)(q,{text:e.description}),(0,t.jsx)(Y,{ariaLabel:"Temperature units",menuItems:[{label:"Celsius",endDecorator:"°C",onClick:function(){return i("metric")}},{label:"Fahrenheit",endDecorator:"°F",onClick:function(){return i("imperial")}}]}),(0,t.jsxs)(s(),{alignItems:"center",children:[(0,t.jsx)(l(),{variant:"h4",component:"span",children:e.location}),(0,t.jsxs)(s(),{direction:"row",alignItems:"center",spacing:1,className:"rustic-current-weather-description",children:[(0,t.jsx)("img",{src:e.weather[0].weatherIcon.icon,alt:""}),(0,t.jsx)(l(),{variant:"body2",children:e.weather[0].weatherIcon.description})]}),e.weather[0].temp.current&&(0,t.jsxs)(l(),{variant:"h1",component:"span",className:"rustic-current-temp",children:[c(e.weather[0].temp.current),"°",function(e){switch(e){case"imperial":return"F";case"metric":return"C"}}(n)]}),(0,t.jsxs)(s(),{direction:"row",spacing:2,children:[(0,t.jsx)(l(),{variant:"overline",children:f}),(0,t.jsx)(l(),{variant:"overline",children:y})]})]}),(0,t.jsx)(a(),{className:"rustic-daily-weather-container",children:b}),e.weatherProvider&&(0,t.jsxs)(s(),{alignItems:"center",direction:"row",spacing:1,alignSelf:"center",className:"rustic-weather-attribution",children:[(0,t.jsx)(x,{name:"cloud"}),(0,t.jsx)(l(),{variant:"body2",children:"Weather data provided by ".concat(e.weatherProvider)})]})]})};return r})());