/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */

"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["987"],{6457:function(e,t,r){r.r(t),r.d(t,{Echarts:function(){return b}});var n=r(8156),o=r.n(n),s=r(197),a=r(3990),i=r(3772);let l=(0,n.createContext)(null),c={didCatch:!1,error:null};class u extends n.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=c}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,o=Array(n),s=0;s<n;s++)o[s]=arguments[s];null==(t=(r=this.props).onReset)||t.call(r,{args:o,reason:"imperative-api"}),this.setState(c)}}componentDidCatch(e,t){var r,n;null==(r=(n=this.props).onError)||r.call(n,e,t)}componentDidUpdate(e,t){let{didCatch:r}=this.state,{resetKeys:n}=this.props;if(r&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)){var o,s;null==(o=(s=this.props).onReset)||o.call(s,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(c)}}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:o}=this.props,{didCatch:s,error:a}=this.state,i=e;if(s){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if((0,n.isValidElement)(o))i=o;else if("function"==typeof t)i=t(e);else if(r)i=(0,n.createElement)(r,e);else throw a}return(0,n.createElement)(l.Provider,{value:{didCatch:s,error:a,resetErrorBoundary:this.resetErrorBoundary}},i)}}var p=r(2721),h=r(482),f=r(5708);function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var m=function(e){var t=e.error,r=(0,a.NT)();return f.h.use.responseLoading()?null:o().createElement(p.Alert,{showIcon:!0,type:"error",message:r("Invalid chart options"),description:o().createElement(o().Fragment,null,t.message," ",o().createElement(p.Button,{icon:o().createElement(h.CopyOutlined,null),variant:"link",color:"primary",onClick:function(){navigator.clipboard.writeText(t.message),p.message.success(r("Copied"))}}))})},b=function(e){var t=e.toolCall,r=(0,a.NT)(),n=(0,i.useToken)().token,l=(0,i.useGlobalTheme)().isDarkTheme,c={fontSize:n.fontSizeSM,color:n.colorText,borderWidth:0},p=d(y({},c),{color:n.colorLinkHover});return o().createElement(u,{FallbackComponent:m,onError:function(e){return console.error(e,t.args)},resetKeys:[t.args.options]},o().createElement(s.Z,{option:d(y({},t.args.options),{animation:!1,toolbox:{show:!0,feature:{saveAsImage:{title:r("Save as image"),icon:"path://".concat("M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"),iconStyle:c,emphasis:{iconStyle:p}}}}}),theme:l?"defaultDark":"light"}))}}}]);