@devtable/dashboard 12.10.0 → 12.10.1
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/dashboard.es.js +3 -3
- package/dist/dashboard.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/package.json +1 -1
package/dist/dashboard.es.js
CHANGED
|
@@ -1728,7 +1728,7 @@ class Ai {
|
|
|
1728
1728
|
}), this.instanceRegistry.clear(), this.factoryRegistry.clear();
|
|
1729
1729
|
}
|
|
1730
1730
|
}
|
|
1731
|
-
const rc = "12.10.
|
|
1731
|
+
const rc = "12.10.1", Hx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1732
1732
|
__proto__: null,
|
|
1733
1733
|
version: rc
|
|
1734
1734
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -33349,7 +33349,7 @@ const l2 = {
|
|
|
33349
33349
|
pagination: {
|
|
33350
33350
|
page_size: "Page Size",
|
|
33351
33351
|
total: "Total",
|
|
33352
|
-
total_rows: "Total {total} row"
|
|
33352
|
+
total_rows: "Total {{total}} row(s)"
|
|
33353
33353
|
},
|
|
33354
33354
|
align: {
|
|
33355
33355
|
horizontal: {
|
|
@@ -33437,7 +33437,7 @@ const l2 = {
|
|
|
33437
33437
|
panel: {
|
|
33438
33438
|
label: "Panel",
|
|
33439
33439
|
labels: "Panels",
|
|
33440
|
-
add: "Add a
|
|
33440
|
+
add: "Add a Panel",
|
|
33441
33441
|
delete: "Delete This Panel",
|
|
33442
33442
|
panel_name: "Panel Name",
|
|
33443
33443
|
panel_description: "Description",
|
package/dist/dashboard.umd.js
CHANGED
|
@@ -53,7 +53,7 @@ Check the top-level render call using <`+P+">.")}return M}}function lu(w,M){{if(
|
|
|
53
53
|
</table>
|
|
54
54
|
`;function bs(t,e){const n=Object.keys(e),r=Object.values(e);try{return new Function(...n,`return \`${t}\`;`)(...r)}catch(i){throw n.length===0&&t.includes("$")?new Error("[formatSQL] insufficient payload"):i}}function vs(t,e){try{return bs(t,e)}catch(n){return console.error(n),n.message}}function ad({sql:t,pre_process:e}){if(!e.trim())return t;try{return new Function(`return ${e}`)()({sql:t},ot)}catch(n){return console.error(n),t}}function od(t,e,n){if(!t.trim())return e;try{return new Function(`return ${t}`)()(e,ot,n)}catch(r){return console.error(r),e}}function ld(t){t=t||{};const e=Object.keys(t).sort(),n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i!="authentication"&&t[i])n.push(e[r]+"="+(typeof t[i]=="object"?JSON.stringify(t[i]):t[i]));else{const o=Object.keys(t[i]).sort();for(let l=0;l<o.length;l++){const c=o[l];c!="sign"&&t[i][c]&&n.push(o[l]+"="+(typeof t[i][c]=="object"?JSON.stringify(t[i][c]):t[i][c]))}}}return n.sort().join("&")}function cd(t,e){let n=ld(t);return n+="&key="+e,Hu.MD5(n).toString().toUpperCase()}class la{constructor(){this.type="default_api_client",this.baseURL="http://localhost:31200",this.app_id="",this.app_secret=""}getAuthentication(e){if(!this.app_id||!this.app_secret)return;const n=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:n,sign:cd({app_id:this.app_id,nonce_str:n,...e},this.app_secret)}}getRequest(e,n){return(r,i,o,l)=>{const c=this.buildHeader(o),u=this.buildAxiosConfig(e,r,i,o,c,n);return it(u).then(d=>l?d:d.data).catch(d=>Promise.reject(d))}}get(e){return this.getRequest("GET",e)}post(e){return this.getRequest("POST",e)}put(e){return this.getRequest("PUT",e)}buildAxiosConfig(e,n,r,i,o,l){const c={baseURL:this.baseURL,method:e,url:n,params:e==="GET"?r:i.params,headers:o,signal:l};return["POST","PUT"].includes(e)&&(c.data=i.string?JSON.stringify(r):r,c.data.authentication=this.getAuthentication(c.data)),c}buildHeader(e){const n=window.localStorage.getItem("token");return{"X-Requested-With":"XMLHttpRequest","Content-Type":e.string?"application/x-www-form-urlencoded":"application/json",authorization:n?`bearer ${n}`:"",...e.headers}}}class ud{constructor(e){this.implementation=e}getRequest(e,n){return this.implementation.getRequest(e,n)}get(e){return this.getRequest("GET",e)}post(e){return this.getRequest("POST",e)}put(e){return this.getRequest("PUT",e)}}class ca extends la{constructor(){super(...arguments);$(this,"makeQueryENV",null)}query(n){return async(r,i={})=>{var o;return r.env||(r.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.post(n)("/query",r,i)}}httpDataSourceQuery(n){return async(r,i={})=>{var o;return r.env||(r.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.getRequest("POST",n)("/query",r,i,!0)}}structure(n){return async(r,i={})=>this.post(n)("/query/structure",r,i)}}class ua{constructor(e){this.implementation=e}query(e){return this.implementation.query(e)}httpDataSourceQuery(e){return this.implementation.httpDataSourceQuery(e)}structure(e){return this.implementation.structure(e)}getRequest(e,n){return this.implementation.getRequest(e,n)}get(e){return this.getRequest("GET",e)}post(e){return this.getRequest("POST",e)}put(e){return this.getRequest("PUT",e)}}const Lt=new ca;function js(t){Lt.baseURL!==t.apiBaseURL&&(Lt.baseURL=t.apiBaseURL),t.app_id&&(Lt.app_id=t.app_id),t.app_secret&&(Lt.app_secret=t.app_secret),t.makeQueryENV&&(Lt.makeQueryENV=t.makeQueryENV)}const da=new ua(Lt),He=da,tn=g.forwardRef(function({value:e,onChange:n,...r},i){return s.jsx(a.TextInput,{ref:i,value:e,onChange:n,...r})});function A(t){const[e,n]=t.split(".");return{queryID:e,columnKey:n}}function dd(t){return t.includes(".")?A(t):{queryID:"",columnKey:t}}function et(t,e){var i;const{queryID:n,columnKey:r}=A(e);return n?r?((i=t[n])==null?void 0:i.map(o=>o[r]))??[]:t[n]:[]}function nn(t,e){const{queryID:n}=A(e);return n?t[n]:[]}function pd(t){return Object.values(t)[0]}function Sn(t,e){const{queryID:n,columnKey:r}=A(e);return t[r]}const pa=["function aggregation({ queryData }, utils) {",' return "Aggregation Result";',"}"].join(`
|
|
55
55
|
`),Bt={type:"none",config:{},fallback:"0"};function hd(t){const e=Array.from(t).sort((r,i)=>r-i),n=Math.floor(e.length/2);return e.length%2===0?(e[n-1]+e[n])/2:e[n]}function xd(t,e){switch(e.type){case"sum":return y.sum(t);case"mean":return y.mean(t);case"median":return hd(t);case"max":return y.max(t);case"min":return y.min(t);case"quantile":return Xt.quantile(t,e.config.p);case"CV":const n=$t.std(...t),r=$t.mean(...t);return r?n/r:Number.NaN;case"std":return $t.std(...t);default:return t}}function _s(t,e){const n=t.map(Number),r=xd(n,e);return typeof r=="number"?Number.isFinite(r)?r:e.fallback:r??e.fallback}function gd(t,e,n){try{const r=nn(t,e);return new Function(`return ${n.config.func}`)()({queryData:r},ot)}catch(r){return console.error(r),r.message}}function kn(t,e,n){try{return n.type==="custom"?gd(t,e,n):_s(et(t,e),n)}catch(r){return console.error(r),null}}class md{constructor({valueRange:e,colorRange:n}){$(this,"mapper");this.mapper=Ct.interpolate(e,n)}getColor(e){return this.mapper(e)}}const ye={mantissa:0,output:"number",trimMantissa:!1,average:!1,absolute:!1};function W(t,{absolute:e,...n}){if(t===null)return String(t);try{let r=_n(t).value();if(r===void 0||Number.isNaN(r))throw new Error(`[formatNumber]Not a number: ${t}`);return e&&(r=Math.abs(r)),_n(r).format(n)}catch(r){return console.debug(r),String(t)}}function fd(t){return t===null?"null":t===void 0?"undefined":Array.isArray(t)?`Array(${t.length})`:t.toString()}function lt({data_field:t,aggregation:e},n){return kn(n,t,e)}function Be({formatter:t,aggregation:e},n){if(typeof n!="string"&&typeof n!="number")return fd(n);if(e.type==="custom")return n;try{return W(n,t)}catch(r){return console.error(r),n}}function yd(t,e){if(t.type==="static")return t.staticColor;if(t.type==="continuous")try{if(typeof e!="number")throw new Error(`[getColorByColorConf] Invalid type of aggregated value: ${e}`);return new md(t).getColor(e)}catch(n){return console.error(n),"black"}return"black"}function bd(t,e){const{color:n,data_field:r,aggregation:i,size:o,weight:l}=t,c=kn(e,r,i),u=Be(t,c);return s.jsx(a.Text,{sx:{fontSize:o,display:"inline"},color:yd(n,c),weight:l,children:u})}function vd(t,e){const n={};return t.forEach(r=>{const i=r.name;n[i]=bd(r,e)}),n}function jd(t){return t.split(" ").map((e,n)=>s.jsxs(g.Fragment,{children:[e," "]},n))}function _d(t){const n=t.replaceAll("<br />","<br/>").replaceAll(`
|
|
56
|
-
`,"<br/>").split("<br/>");return n.map((i,o)=>{const l=[jd(i)];return o!==n.length-1&&l.push(s.jsx("br",{},`br-${o}`)),l}).flat().filter(i=>i!==void 0)}function ws(t){return _d(t)}function sn(t,e,n){const r=vd(e,n),i=/^\{(.+)\}(.*)$/;return t.split("$").map((o,l)=>{const c=i.exec(o);if(!c)return ws(o);const u=r[c[1]];if(!u)return ws(o);const d=c[2]??"";return s.jsxs(g.Fragment,{children:[u,ws(d)]},`${o}-${l}`)})}function wd(t,e){const{data_field:n,aggregation:r}=t,i=kn(e,n,r);return Be(t,i)}function ha(t,e){const n={};return t.forEach(r=>{n[r.name]=wd(r,e)}),n}function Tn(t,e,n){const r=ha(e,n),i=/^\{(.+)\}(.*)$/;return t.split("$").map(o=>{const l=i.exec(o);if(!l)return o;const c=r[l[1]];if(!c)return o;const u=l[2]??"";return`${c}${u}`}).join("")}const Cs={grid:{axis:"#97999D",scope:"rgba(47,140,192,0.1)",boundary:"#789AB4",reference:"#CFCFD8"},graphics:{compared:{blueDark:"#3E7CAB",blue:"#6398C7",blueLight:"#7CB0DF",blue10:"#6398C71a",redDark:"#AF5F6B",red:"#CD7C88",redLight:"#E794A0",red10:"#CD7C881a"},gradient:{distributed:"linear-gradient(90deg, #1babe6 0%, #2fc8c8 28.63%, #98d44b 48.86%, #ffd057 67.53%, #f5ae53 80.6%, #e76441 91.18%, #b90000 100%)",protrude:"linear-gradient(180deg, #ec73734d 0%, #ec737300 100%)"},level:{lv0:"#6398C7",lv1:"#61B5BF",lv2:"#54D4BB",lv3:"#F5D277",lv4:"#E8BB7F",lv5:"#DB9E84",lv6:"#CB8089"},depth:{dp0:"#FFF7F8",dp1:"#FFE1E1",dp2:"#FDBCBC",dp3:"#F39494",dp4:"#FA4242",dp5:"#E21212"},multiple:{c1:"#66B4DB",c2:"#E46464",c3:"#EEBA00",c4:"#33A678",c5:"#9D88CB",c6:"#939943",c7:"#E49792",c8:"#09A2B8",c9:"#AF5F6B",c10:"#6CA157",c11:"#3E7CAB",c12:"#6398C7",c13:"#E692BA",c14:"#97B566",c15:"#8CACE2",c16:"#CA79AC",c17:"#6DBC80",c18:"#B08F4B",c19:"#39BFA2",c20:"#826BAF"}}};function Cd(){ve.registerTheme("merico-light",{color:Object.values(Cs.graphics.multiple),visualMap:{color:Object.values(Cs.graphics.depth).reverse()},axes:[{type:"all",name:"通用坐标轴",axisLineColor:"#97999D",axisTickColor:"#97999D",axisLabelShow:!0,axisLabelColor:"#818388",splitLineShow:!0,splitLineColor:["#E0E6F1"]}]})}function xa(){Cd()}function*Sd(t){const e=Cs.graphics[t];if(!e)throw new Error("Invalid palette key provided");const n=Object.values(e);let r=0;for(;;)yield n[r%n.length],r++}function ga(){return{filters:{},context:{}}}function Ss(t){const e=ga();if(!t)return ga();const{filters:n=e.filters,context:r=e.context}=t;return{filters:n,context:r}}class je extends g.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}render(){var e;if(this.state.error){const n=()=>{this.setState({error:null})};return s.jsxs(a.Box,{children:[s.jsx(a.Text,{size:"xs",children:(e=this.state.error)==null?void 0:e.message}),s.jsx(a.Button,{variant:"subtle",size:"xs",mx:"auto",compact:!0,sx:{display:"block"},onClick:n,children:"Retry"})]})}return this.props.children}}function kd(t,e={handleError:!0}){return n=>s.jsx(je,{...e,children:s.jsx(t,{...n})})}function Td(t,e){return new Function(`return ${t}`)()(e,ot)}function Dd(t,e,n){return Td(t,{context:e,filters:n})}function zd(t,e){try{return new Function(`return ${t.config.processing.pre}`)()(e,ot)}catch(n){return console.error(n),e}}function Md(t,e){return new Function(`return ${t.config.processing.post}`)()(e,ot)}function Id(t,e,n){return t?new Function(`return ${t}`)()(e,ot,n):e}function ma(){Bi.use([xu.CanvasRenderer,Ze.BarChart,Ze.BoxplotChart,Ze.CustomChart,Ze.FunnelChart,Ze.HeatmapChart,Ze.LineChart,Ze.PieChart,Ze.RadarChart,Ze.ScatterChart,Ze.SunburstChart,gt.CalendarComponent,gt.DataZoomComponent,gt.GridComponent,gt.LegendComponent,gt.TooltipComponent,gt.MarkLineComponent,gt.MarkAreaComponent,gt.VisualMapComponent])}const qt=t=>y.cloneDeepWith(t,(e,n)=>{if(n!==void 0&&e)return K.toJS(e)}),Dn={sqlSnippet:new RegExp("(?<=sql_snippets\\.)([^\\?}.]+)","gm"),context:new RegExp("(?<=context\\.)([^\\?}.]+)","gm"),filter:new RegExp("(?<=filters\\.)([^\\?}.]+)","gm")};function Ed(t,e){const n=qi.decode(e);n!==t&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:t,after:e,v:n}),console.groupEnd())}async function Ad({query:t,name:e,payload:n,additionals:r},i){if(!t.sql)return[];const{type:o,key:l,sql:c,pre_process:u,post_process:d}=t,p=bs(c,n),h=ad({sql:p,pre_process:u}),x=qi.encode(h);Ed(h,x);let m=await He.query(i)({type:o,key:l,query:x,...r},{params:{name:e}});return m=od(d,m,Ss(n)),m}async function Pd({type:t,key:e,configString:n,name:r,additionals:i},o){try{return await He.httpDataSourceQuery(o)({type:t,key:e,query:n,...i},{params:{name:r}})}catch(l){if(it.isCancel(l))throw l;return console.error(l),l}}async function ks(){try{return(await He.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(t){return console.error(t),[]}}async function fa(){try{return(await He.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(t){return console.error(t),[]}}class ya{constructor(e){$(this,"rootRef");this.rootRef=K.observable({current:e})}async deleteItem(e){K.runInAction(()=>{y.unset(this.rootRef.current,[e])})}getItem(e){const n=this.getValueFromRoot(e);return Promise.resolve(n)}getValueFromRoot(e){return e===null?K.toJS(this.rootRef.current):y.get(this.rootRef.current,[e])}setItem(e,n){if(e===null)if(y.isObject(n))K.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else K.runInAction(()=>{y.set(this.rootRef.current,[e],n)});return Promise.resolve(this.getItem(e))}watchItem(e,n,r){return K.reaction(()=>this.getValueFromRoot(e),(i,o)=>{n(i,o)},{requiresObservable:!0,fireImmediately:y.get(r,"fireImmediately",!1)})}}class $d{constructor(){$(this,"channels",new Map);$(this,"globalChannel",new Oi)}getChannel(e){const n=this.channels.get(e);if(n)return n;const r=new Oi;return this.channels.set(e,r),r}}class Ld{constructor(e){$(this,"instances",new Map);this.pluginManager=e}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(e=>e.manifest.viz)}resolveComponent(e){return this.pluginManager.factory.viz(e)}getOrCreateInstance(e){const n=this.instances.get(e.id);if(n)return n;const r={id:e.id,name:e.viz.type,type:e.viz.type,messageChannels:new $d,instanceData:new ya(e.viz.conf)};return this.instances.set(e.id,r),r}}function ba(t,e,n,r){return{vizManager:n,locale:"zh",msgChannels:t.messageChannels,instanceData:t.instanceData,pluginData:new ya({}),colorPalette:{getColor(){return()=>""}},data:e,variables:r}}const Bd=t=>{const{panel:e,measure:n,vizManager:r,data:i,variables:o}=t,l=r.resolveComponent(e.viz.type),c=r.getOrCreateInstance(e),u={...ba(c,i,r,o),viewport:{width:n.w,height:n.h}},d=l.viewRender;return s.jsx(d,{context:u,instance:c,...y.omit(t,["panel","vizManager","data"])})},qd=t=>{const{vizManager:e,panel:n,data:r,variables:i}=t,o=e.resolveComponent(n.viz.type),l=e.getOrCreateInstance(n),c={...ba(l,r,e,i)},u=o.configRender;return s.jsx(u,{context:c,instance:l,...y.omit(t,["panel","vizManager","data"])})},va=(t,e)=>{const n=at.bezier(t),r=at.bezier(e);return function(i){return i<50?n(i*2/100).hex():r((i-50)*2/100).hex()}},zn=t=>{const e=at.bezier(t);return function(n){return e(n/100).hex()}},Od={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:va(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},Vd={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:va(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},Nd={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:zn(["#fff7f1","darkred"]),name:"red",category:"sequential"},Fd={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:zn(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},Gd={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:zn(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},Wd={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:zn(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class Qd{constructor(e){$(this,"symbol");this.symbol=Symbol(e)}}function ct(t){return new Qd(t)}class Ts{constructor(){$(this,"parent");$(this,"factoryRegistry",new Map);$(this,"instanceRegistry",new Map)}createScoped(){const e=new Ts;return e.parent=this,e}getRequired(e){return this.get(e)}get(e){if(this.instanceRegistry.has(e.symbol))return this.instanceRegistry.get(e.symbol);const n=this.factoryRegistry.get(e.symbol);if(n){const r=n(this);return this.instanceRegistry.set(e.symbol,r),r}if(this.parent)return this.parent.get(e)}provideFactory(e,n){return this.factoryRegistry.has(e.symbol)?console.warn(`Token ${e.symbol.toString()} is already registered`):this.factoryRegistry.set(e.symbol,n),this}provideValue(e,n){return this.factoryRegistry.has(e.symbol)?console.warn(`Token ${e.symbol.toString()} is already registered`):this.factoryRegistry.set(e.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(e=>{const n=y.get(e,"dispose");y.isFunction(n)&&n.bind(e)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const ja="12.10.0",Rd=Object.freeze(Object.defineProperty({__proto__:null,version:ja},Symbol.toStringTag,{value:"Module"}));class Yd{constructor(e){$(this,"staticColors",new Map);$(this,"interpolations",new Map);e.installedPlugins.forEach(n=>{n.manifest.color.forEach(r=>{this.register(r)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(e){const n=this.encodeColor(e);e.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`),this.staticColors.set(n,e)):e.type==="interpolation"&&(this.interpolations.has(n)&&console.warn(`the interpolation '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`,`the interpolation '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`),this.interpolations.set(n,e))}decodeStaticColor(e){return this.staticColors.get(e)}encodeColor(e){return`\${${e.category}}.{${e.name}}`}decodeInterpolation(e){return this.interpolations.get(e)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class Ud{constructor(){$(this,"plugins",new Map);$(this,"vizComponents",new Map);$(this,"factory",{viz:e=>{const n=this.vizComponents.get(e);if(n)return n;throw new Error(`Viz Component (${e}) not found`)}})}install(e){if(this.plugins.has(e.id))throw new Error(`Plugin (${e.id}) has been installed before`);this.plugins.set(e.id,e);for(const n of e.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}class Kd{constructor(){$(this,"migrations",[])}version(e,n){return this.migrations.push({version:e,handler:n}),this}run(e,n,r){var l;if(e.from===e.to)return n;if(e.from>e.to)throw new Error(`Can not downgrade from version '${e.from}' to (${e.to})`);const i=this.migrations.filter(c=>c.version>e.from&&c.version<=e.to),o=y.orderBy(i,"version","asc");if(((l=y.last(o))==null?void 0:l.version)!==e.to)throw new Error(`Migration to version ${e.to} not found`);return o.reduce((c,u)=>u.handler(c,r),n)}}class oe extends Kd{constructor(){super(),this.configVersions()}version(e,n){return super.version(e,(r,i)=>({version:e,...n(r,i)}))}async migrate({configData:e,panelModel:n}){const r=await e.getItem(null),i=y.get(r,"version",0),o=this.run({from:i,to:this.VERSION},r,{panelModel:n});await e.setItem(null,o)}async needMigration({configData:e}){const n=await e.getItem(null);return y.get(n,"version",0)<this.VERSION}}const O=(t,e)=>{const[n,{setFalse:r}]=N.useBoolean(!0),[i,o]=g.useState();g.useEffect(()=>(t.getItem(e).then(c=>{o(c),r()}),t.watchItem(e,c=>{o(c)})));const l=g.useCallback(async c=>{await t.setItem(e,c),o(c)},[t,e]);return{loading:n,value:i,set:l}},De={top:16,right:16,bottom:16,left:16},Ye=t=>Math.max(0,t-De.left-De.right),Ue=t=>Math.max(0,t-De.top-De.bottom),rn=(t,e)=>({width:Ye(t),height:Ue(e)}),ze=({width:t,height:e,children:n})=>s.jsx(a.Box,{pt:De.top,pr:De.right,pb:De.bottom,pl:De.left,sx:{width:t,height:e,overflow:"hidden",position:"relative"},children:n}),Ds={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function Jd({context:t}){const{value:e}=O(t.instanceData,"config"),n=t.data,{width:r,height:i}=t.viewport,{x_axis_data_key:o,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:p}=y.defaults({},e,Ds),h=g.useMemo(()=>nn(n,o),[n,o]),{x,y:m,z:v}=g.useMemo(()=>({x:A(o),y:A(l),z:A(c)}),[o,l,c]),{min:C,max:k}=g.useMemo(()=>{const E=y.minBy(h,G=>G[v.columnKey]),B=y.maxBy(h,G=>G[v.columnKey]);return{min:y.get(E,v.columnKey),max:y.get(B,v.columnKey)}},[h,v]),D={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:C,max:k,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:p,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:h.map(E=>[E[x.columnKey],E[m.columnKey],E[v.columnKey]])}]};return e?s.jsx(ze,{width:r,height:i,children:s.jsx(Se,{echarts:ve,option:D,style:rn(r,i),notMerge:!0,theme:"merico-light"})}):null}const _a=g.createContext(null),zs=_a.Provider;function Ms(){const t=g.useContext(_a);if(!t)throw new Error("Please use DashboardModelContextProvider");return t}const X=()=>Ms(),wa=()=>Ms(),Ca=g.createContext({searchButtonProps:{}}),Is=Ca.Provider;function Sa(){return g.useContext(Ca)}const ka=g.createContext(null),Es=ka.Provider;function Ta(){const t=g.useContext(ka);if(!t)throw new Error("Please use ContentModelContextProvider");return t}const Q=()=>Ta(),ue=()=>Ta(),Xd={inEditMode:!1},Mn=g.createContext(Xd),Da=g.createContext({panel:null,data:{},loading:!1,errors:[],downloadPanelScreenshot:()=>{}}),As=Da.Provider;function za(){const t=g.useContext(Da);if(!t.panel)throw new Error("Please use PanelContextProvider");return t}const vt=()=>za(),qe=()=>za(),Zd={fullScreenPanelID:"",setFullScreenPanelID:y.noop},Ps=g.createContext(Zd);function Ma(){const t=g.useContext(Ps);if(!t)throw new Error("Please use FullScreenPanelContext.Provider");return t}const Hd={en:"en",zh:"zh-cn"};function $s({children:t}){const{i18n:e}=j.useTranslation(),n=g.useMemo(()=>{const r=e.language;return Hd[r]??"en"},[e.language]);return s.jsx(Vi.DatesProvider,{settings:{locale:n,firstDayOfWeek:1},children:t})}const q=S.observer(g.forwardRef(({label:t,required:e,description:n,value:r,onChange:i,clearable:o=!1,sx:l,...c},u)=>{const{panel:d}=qe(),p=g.useMemo(()=>d.dataFieldOptions(r,o),[r,o]);if(p.length===0){const h=d.explainDataKey(r);return s.jsxs(a.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[s.jsx(a.HoverCard.Target,{children:s.jsx(a.Box,{children:s.jsx(a.TextInput,{label:t,required:e,defaultValue:h.columnKey,readOnly:!0,disabled:!0})})}),s.jsx(a.HoverCard.Dropdown,{children:s.jsxs(a.Group,{position:"left",spacing:0,children:[s.jsx(a.Text,{size:"xs",color:h.queryName?"black":"red",sx:{fontFamily:"monospace"},children:h.queryName??h.queryID}),s.jsx(a.Text,{size:"xs",color:"black",sx:{fontFamily:"monospace"},children:"."}),s.jsx(a.Text,{size:"xs",color:"red",sx:{fontFamily:"monospace"},children:h.columnKey})]})})]})}return s.jsx(a.Select,{ref:u,label:t,description:n,data:p,value:r,onChange:i,required:e,sx:l,maxDropdownHeight:500,...c})}));function ep({context:t}){const{value:e,set:n}=O(t.instanceData,"config"),r=y.defaults({},e,Ds),{control:i,handleSubmit:o,reset:l}=b.useForm({defaultValues:r});return g.useEffect(()=>{l(r)},[e]),e?s.jsx(a.Stack,{spacing:"xs",children:s.jsxs("form",{onSubmit:o(n),children:[s.jsx(a.Text,{children:"X Axis"}),s.jsxs(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[s.jsx(b.Controller,{name:"x_axis_data_key",control:i,render:({field:c})=>s.jsx(q,{label:"Data Field",required:!0,...c})}),s.jsx(b.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>s.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),s.jsx(a.Text,{mt:"lg",children:"Y Axis"}),s.jsxs(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[s.jsx(b.Controller,{name:"y_axis_data_key",control:i,render:({field:c})=>s.jsx(q,{label:"Data Field",required:!0,...c})}),s.jsx(b.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>s.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),s.jsx(a.Text,{mt:"lg",children:"Z Axis"}),s.jsxs(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[s.jsx(b.Controller,{name:"z_axis_data_key",control:i,render:({field:c})=>s.jsx(q,{label:"Data Field",required:!0,...c})}),s.jsx(b.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>s.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),s.jsx(a.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:s.jsxs(a.Button,{color:"blue",type:"submit",children:[s.jsx(z.DeviceFloppy,{size:20}),s.jsx(a.Text,{ml:"md",children:"Save"})]})})]})}):null}const tp=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function np(t,{panelModel:e}){try{const n=e.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const r=u=>u&&`${n}.${u}`,{x_axis_data_key:i,y_axis_data_key:o,z_axis_data_key:l,...c}=t;return{...c,x_axis_data_key:r(i),y_axis_data_key:r(o),z_axis_data_key:r(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class sp extends oe{constructor(){super(...arguments);$(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,r)=>{const{config:i}=n;return{...n,version:2,config:np(i,r)}})}}const rp={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new sp,name:"bar-3d",viewRender:Jd,configRender:ep,createConfig(){return{version:2,config:y.cloneDeep(Ds)}},translation:tp},ip=({disabled:t,value:e,onChange:n})=>{const r=i=>{i&&n(i)};return s.jsxs(a.Box,{sx:{position:"relative"},children:[t&&s.jsx(a.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),s.jsx(Ae,{height:"500px",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:t}})]})};function Me({enabled:t,func_content:e}){return(n,r)=>{if(!t)return n;try{return new Function(`return ${e}`)()(n,r)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),n}}}function _e(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
|
|
56
|
+
`,"<br/>").split("<br/>");return n.map((i,o)=>{const l=[jd(i)];return o!==n.length-1&&l.push(s.jsx("br",{},`br-${o}`)),l}).flat().filter(i=>i!==void 0)}function ws(t){return _d(t)}function sn(t,e,n){const r=vd(e,n),i=/^\{(.+)\}(.*)$/;return t.split("$").map((o,l)=>{const c=i.exec(o);if(!c)return ws(o);const u=r[c[1]];if(!u)return ws(o);const d=c[2]??"";return s.jsxs(g.Fragment,{children:[u,ws(d)]},`${o}-${l}`)})}function wd(t,e){const{data_field:n,aggregation:r}=t,i=kn(e,n,r);return Be(t,i)}function ha(t,e){const n={};return t.forEach(r=>{n[r.name]=wd(r,e)}),n}function Tn(t,e,n){const r=ha(e,n),i=/^\{(.+)\}(.*)$/;return t.split("$").map(o=>{const l=i.exec(o);if(!l)return o;const c=r[l[1]];if(!c)return o;const u=l[2]??"";return`${c}${u}`}).join("")}const Cs={grid:{axis:"#97999D",scope:"rgba(47,140,192,0.1)",boundary:"#789AB4",reference:"#CFCFD8"},graphics:{compared:{blueDark:"#3E7CAB",blue:"#6398C7",blueLight:"#7CB0DF",blue10:"#6398C71a",redDark:"#AF5F6B",red:"#CD7C88",redLight:"#E794A0",red10:"#CD7C881a"},gradient:{distributed:"linear-gradient(90deg, #1babe6 0%, #2fc8c8 28.63%, #98d44b 48.86%, #ffd057 67.53%, #f5ae53 80.6%, #e76441 91.18%, #b90000 100%)",protrude:"linear-gradient(180deg, #ec73734d 0%, #ec737300 100%)"},level:{lv0:"#6398C7",lv1:"#61B5BF",lv2:"#54D4BB",lv3:"#F5D277",lv4:"#E8BB7F",lv5:"#DB9E84",lv6:"#CB8089"},depth:{dp0:"#FFF7F8",dp1:"#FFE1E1",dp2:"#FDBCBC",dp3:"#F39494",dp4:"#FA4242",dp5:"#E21212"},multiple:{c1:"#66B4DB",c2:"#E46464",c3:"#EEBA00",c4:"#33A678",c5:"#9D88CB",c6:"#939943",c7:"#E49792",c8:"#09A2B8",c9:"#AF5F6B",c10:"#6CA157",c11:"#3E7CAB",c12:"#6398C7",c13:"#E692BA",c14:"#97B566",c15:"#8CACE2",c16:"#CA79AC",c17:"#6DBC80",c18:"#B08F4B",c19:"#39BFA2",c20:"#826BAF"}}};function Cd(){ve.registerTheme("merico-light",{color:Object.values(Cs.graphics.multiple),visualMap:{color:Object.values(Cs.graphics.depth).reverse()},axes:[{type:"all",name:"通用坐标轴",axisLineColor:"#97999D",axisTickColor:"#97999D",axisLabelShow:!0,axisLabelColor:"#818388",splitLineShow:!0,splitLineColor:["#E0E6F1"]}]})}function xa(){Cd()}function*Sd(t){const e=Cs.graphics[t];if(!e)throw new Error("Invalid palette key provided");const n=Object.values(e);let r=0;for(;;)yield n[r%n.length],r++}function ga(){return{filters:{},context:{}}}function Ss(t){const e=ga();if(!t)return ga();const{filters:n=e.filters,context:r=e.context}=t;return{filters:n,context:r}}class je extends g.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}render(){var e;if(this.state.error){const n=()=>{this.setState({error:null})};return s.jsxs(a.Box,{children:[s.jsx(a.Text,{size:"xs",children:(e=this.state.error)==null?void 0:e.message}),s.jsx(a.Button,{variant:"subtle",size:"xs",mx:"auto",compact:!0,sx:{display:"block"},onClick:n,children:"Retry"})]})}return this.props.children}}function kd(t,e={handleError:!0}){return n=>s.jsx(je,{...e,children:s.jsx(t,{...n})})}function Td(t,e){return new Function(`return ${t}`)()(e,ot)}function Dd(t,e,n){return Td(t,{context:e,filters:n})}function zd(t,e){try{return new Function(`return ${t.config.processing.pre}`)()(e,ot)}catch(n){return console.error(n),e}}function Md(t,e){return new Function(`return ${t.config.processing.post}`)()(e,ot)}function Id(t,e,n){return t?new Function(`return ${t}`)()(e,ot,n):e}function ma(){Bi.use([xu.CanvasRenderer,Ze.BarChart,Ze.BoxplotChart,Ze.CustomChart,Ze.FunnelChart,Ze.HeatmapChart,Ze.LineChart,Ze.PieChart,Ze.RadarChart,Ze.ScatterChart,Ze.SunburstChart,gt.CalendarComponent,gt.DataZoomComponent,gt.GridComponent,gt.LegendComponent,gt.TooltipComponent,gt.MarkLineComponent,gt.MarkAreaComponent,gt.VisualMapComponent])}const qt=t=>y.cloneDeepWith(t,(e,n)=>{if(n!==void 0&&e)return K.toJS(e)}),Dn={sqlSnippet:new RegExp("(?<=sql_snippets\\.)([^\\?}.]+)","gm"),context:new RegExp("(?<=context\\.)([^\\?}.]+)","gm"),filter:new RegExp("(?<=filters\\.)([^\\?}.]+)","gm")};function Ed(t,e){const n=qi.decode(e);n!==t&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:t,after:e,v:n}),console.groupEnd())}async function Ad({query:t,name:e,payload:n,additionals:r},i){if(!t.sql)return[];const{type:o,key:l,sql:c,pre_process:u,post_process:d}=t,p=bs(c,n),h=ad({sql:p,pre_process:u}),x=qi.encode(h);Ed(h,x);let m=await He.query(i)({type:o,key:l,query:x,...r},{params:{name:e}});return m=od(d,m,Ss(n)),m}async function Pd({type:t,key:e,configString:n,name:r,additionals:i},o){try{return await He.httpDataSourceQuery(o)({type:t,key:e,query:n,...i},{params:{name:r}})}catch(l){if(it.isCancel(l))throw l;return console.error(l),l}}async function ks(){try{return(await He.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(t){return console.error(t),[]}}async function fa(){try{return(await He.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(t){return console.error(t),[]}}class ya{constructor(e){$(this,"rootRef");this.rootRef=K.observable({current:e})}async deleteItem(e){K.runInAction(()=>{y.unset(this.rootRef.current,[e])})}getItem(e){const n=this.getValueFromRoot(e);return Promise.resolve(n)}getValueFromRoot(e){return e===null?K.toJS(this.rootRef.current):y.get(this.rootRef.current,[e])}setItem(e,n){if(e===null)if(y.isObject(n))K.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else K.runInAction(()=>{y.set(this.rootRef.current,[e],n)});return Promise.resolve(this.getItem(e))}watchItem(e,n,r){return K.reaction(()=>this.getValueFromRoot(e),(i,o)=>{n(i,o)},{requiresObservable:!0,fireImmediately:y.get(r,"fireImmediately",!1)})}}class $d{constructor(){$(this,"channels",new Map);$(this,"globalChannel",new Oi)}getChannel(e){const n=this.channels.get(e);if(n)return n;const r=new Oi;return this.channels.set(e,r),r}}class Ld{constructor(e){$(this,"instances",new Map);this.pluginManager=e}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(e=>e.manifest.viz)}resolveComponent(e){return this.pluginManager.factory.viz(e)}getOrCreateInstance(e){const n=this.instances.get(e.id);if(n)return n;const r={id:e.id,name:e.viz.type,type:e.viz.type,messageChannels:new $d,instanceData:new ya(e.viz.conf)};return this.instances.set(e.id,r),r}}function ba(t,e,n,r){return{vizManager:n,locale:"zh",msgChannels:t.messageChannels,instanceData:t.instanceData,pluginData:new ya({}),colorPalette:{getColor(){return()=>""}},data:e,variables:r}}const Bd=t=>{const{panel:e,measure:n,vizManager:r,data:i,variables:o}=t,l=r.resolveComponent(e.viz.type),c=r.getOrCreateInstance(e),u={...ba(c,i,r,o),viewport:{width:n.w,height:n.h}},d=l.viewRender;return s.jsx(d,{context:u,instance:c,...y.omit(t,["panel","vizManager","data"])})},qd=t=>{const{vizManager:e,panel:n,data:r,variables:i}=t,o=e.resolveComponent(n.viz.type),l=e.getOrCreateInstance(n),c={...ba(l,r,e,i)},u=o.configRender;return s.jsx(u,{context:c,instance:l,...y.omit(t,["panel","vizManager","data"])})},va=(t,e)=>{const n=at.bezier(t),r=at.bezier(e);return function(i){return i<50?n(i*2/100).hex():r((i-50)*2/100).hex()}},zn=t=>{const e=at.bezier(t);return function(n){return e(n/100).hex()}},Od={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:va(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},Vd={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:va(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},Nd={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:zn(["#fff7f1","darkred"]),name:"red",category:"sequential"},Fd={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:zn(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},Gd={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:zn(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},Wd={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:zn(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class Qd{constructor(e){$(this,"symbol");this.symbol=Symbol(e)}}function ct(t){return new Qd(t)}class Ts{constructor(){$(this,"parent");$(this,"factoryRegistry",new Map);$(this,"instanceRegistry",new Map)}createScoped(){const e=new Ts;return e.parent=this,e}getRequired(e){return this.get(e)}get(e){if(this.instanceRegistry.has(e.symbol))return this.instanceRegistry.get(e.symbol);const n=this.factoryRegistry.get(e.symbol);if(n){const r=n(this);return this.instanceRegistry.set(e.symbol,r),r}if(this.parent)return this.parent.get(e)}provideFactory(e,n){return this.factoryRegistry.has(e.symbol)?console.warn(`Token ${e.symbol.toString()} is already registered`):this.factoryRegistry.set(e.symbol,n),this}provideValue(e,n){return this.factoryRegistry.has(e.symbol)?console.warn(`Token ${e.symbol.toString()} is already registered`):this.factoryRegistry.set(e.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(e=>{const n=y.get(e,"dispose");y.isFunction(n)&&n.bind(e)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const ja="12.10.1",Rd=Object.freeze(Object.defineProperty({__proto__:null,version:ja},Symbol.toStringTag,{value:"Module"}));class Yd{constructor(e){$(this,"staticColors",new Map);$(this,"interpolations",new Map);e.installedPlugins.forEach(n=>{n.manifest.color.forEach(r=>{this.register(r)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(e){const n=this.encodeColor(e);e.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`),this.staticColors.set(n,e)):e.type==="interpolation"&&(this.interpolations.has(n)&&console.warn(`the interpolation '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`,`the interpolation '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`),this.interpolations.set(n,e))}decodeStaticColor(e){return this.staticColors.get(e)}encodeColor(e){return`\${${e.category}}.{${e.name}}`}decodeInterpolation(e){return this.interpolations.get(e)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class Ud{constructor(){$(this,"plugins",new Map);$(this,"vizComponents",new Map);$(this,"factory",{viz:e=>{const n=this.vizComponents.get(e);if(n)return n;throw new Error(`Viz Component (${e}) not found`)}})}install(e){if(this.plugins.has(e.id))throw new Error(`Plugin (${e.id}) has been installed before`);this.plugins.set(e.id,e);for(const n of e.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}class Kd{constructor(){$(this,"migrations",[])}version(e,n){return this.migrations.push({version:e,handler:n}),this}run(e,n,r){var l;if(e.from===e.to)return n;if(e.from>e.to)throw new Error(`Can not downgrade from version '${e.from}' to (${e.to})`);const i=this.migrations.filter(c=>c.version>e.from&&c.version<=e.to),o=y.orderBy(i,"version","asc");if(((l=y.last(o))==null?void 0:l.version)!==e.to)throw new Error(`Migration to version ${e.to} not found`);return o.reduce((c,u)=>u.handler(c,r),n)}}class oe extends Kd{constructor(){super(),this.configVersions()}version(e,n){return super.version(e,(r,i)=>({version:e,...n(r,i)}))}async migrate({configData:e,panelModel:n}){const r=await e.getItem(null),i=y.get(r,"version",0),o=this.run({from:i,to:this.VERSION},r,{panelModel:n});await e.setItem(null,o)}async needMigration({configData:e}){const n=await e.getItem(null);return y.get(n,"version",0)<this.VERSION}}const O=(t,e)=>{const[n,{setFalse:r}]=N.useBoolean(!0),[i,o]=g.useState();g.useEffect(()=>(t.getItem(e).then(c=>{o(c),r()}),t.watchItem(e,c=>{o(c)})));const l=g.useCallback(async c=>{await t.setItem(e,c),o(c)},[t,e]);return{loading:n,value:i,set:l}},De={top:16,right:16,bottom:16,left:16},Ye=t=>Math.max(0,t-De.left-De.right),Ue=t=>Math.max(0,t-De.top-De.bottom),rn=(t,e)=>({width:Ye(t),height:Ue(e)}),ze=({width:t,height:e,children:n})=>s.jsx(a.Box,{pt:De.top,pr:De.right,pb:De.bottom,pl:De.left,sx:{width:t,height:e,overflow:"hidden",position:"relative"},children:n}),Ds={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function Jd({context:t}){const{value:e}=O(t.instanceData,"config"),n=t.data,{width:r,height:i}=t.viewport,{x_axis_data_key:o,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:p}=y.defaults({},e,Ds),h=g.useMemo(()=>nn(n,o),[n,o]),{x,y:m,z:v}=g.useMemo(()=>({x:A(o),y:A(l),z:A(c)}),[o,l,c]),{min:C,max:k}=g.useMemo(()=>{const E=y.minBy(h,G=>G[v.columnKey]),B=y.maxBy(h,G=>G[v.columnKey]);return{min:y.get(E,v.columnKey),max:y.get(B,v.columnKey)}},[h,v]),D={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:C,max:k,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:p,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:h.map(E=>[E[x.columnKey],E[m.columnKey],E[v.columnKey]])}]};return e?s.jsx(ze,{width:r,height:i,children:s.jsx(Se,{echarts:ve,option:D,style:rn(r,i),notMerge:!0,theme:"merico-light"})}):null}const _a=g.createContext(null),zs=_a.Provider;function Ms(){const t=g.useContext(_a);if(!t)throw new Error("Please use DashboardModelContextProvider");return t}const X=()=>Ms(),wa=()=>Ms(),Ca=g.createContext({searchButtonProps:{}}),Is=Ca.Provider;function Sa(){return g.useContext(Ca)}const ka=g.createContext(null),Es=ka.Provider;function Ta(){const t=g.useContext(ka);if(!t)throw new Error("Please use ContentModelContextProvider");return t}const Q=()=>Ta(),ue=()=>Ta(),Xd={inEditMode:!1},Mn=g.createContext(Xd),Da=g.createContext({panel:null,data:{},loading:!1,errors:[],downloadPanelScreenshot:()=>{}}),As=Da.Provider;function za(){const t=g.useContext(Da);if(!t.panel)throw new Error("Please use PanelContextProvider");return t}const vt=()=>za(),qe=()=>za(),Zd={fullScreenPanelID:"",setFullScreenPanelID:y.noop},Ps=g.createContext(Zd);function Ma(){const t=g.useContext(Ps);if(!t)throw new Error("Please use FullScreenPanelContext.Provider");return t}const Hd={en:"en",zh:"zh-cn"};function $s({children:t}){const{i18n:e}=j.useTranslation(),n=g.useMemo(()=>{const r=e.language;return Hd[r]??"en"},[e.language]);return s.jsx(Vi.DatesProvider,{settings:{locale:n,firstDayOfWeek:1},children:t})}const q=S.observer(g.forwardRef(({label:t,required:e,description:n,value:r,onChange:i,clearable:o=!1,sx:l,...c},u)=>{const{panel:d}=qe(),p=g.useMemo(()=>d.dataFieldOptions(r,o),[r,o]);if(p.length===0){const h=d.explainDataKey(r);return s.jsxs(a.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[s.jsx(a.HoverCard.Target,{children:s.jsx(a.Box,{children:s.jsx(a.TextInput,{label:t,required:e,defaultValue:h.columnKey,readOnly:!0,disabled:!0})})}),s.jsx(a.HoverCard.Dropdown,{children:s.jsxs(a.Group,{position:"left",spacing:0,children:[s.jsx(a.Text,{size:"xs",color:h.queryName?"black":"red",sx:{fontFamily:"monospace"},children:h.queryName??h.queryID}),s.jsx(a.Text,{size:"xs",color:"black",sx:{fontFamily:"monospace"},children:"."}),s.jsx(a.Text,{size:"xs",color:"red",sx:{fontFamily:"monospace"},children:h.columnKey})]})})]})}return s.jsx(a.Select,{ref:u,label:t,description:n,data:p,value:r,onChange:i,required:e,sx:l,maxDropdownHeight:500,...c})}));function ep({context:t}){const{value:e,set:n}=O(t.instanceData,"config"),r=y.defaults({},e,Ds),{control:i,handleSubmit:o,reset:l}=b.useForm({defaultValues:r});return g.useEffect(()=>{l(r)},[e]),e?s.jsx(a.Stack,{spacing:"xs",children:s.jsxs("form",{onSubmit:o(n),children:[s.jsx(a.Text,{children:"X Axis"}),s.jsxs(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[s.jsx(b.Controller,{name:"x_axis_data_key",control:i,render:({field:c})=>s.jsx(q,{label:"Data Field",required:!0,...c})}),s.jsx(b.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>s.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),s.jsx(a.Text,{mt:"lg",children:"Y Axis"}),s.jsxs(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[s.jsx(b.Controller,{name:"y_axis_data_key",control:i,render:({field:c})=>s.jsx(q,{label:"Data Field",required:!0,...c})}),s.jsx(b.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>s.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),s.jsx(a.Text,{mt:"lg",children:"Z Axis"}),s.jsxs(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[s.jsx(b.Controller,{name:"z_axis_data_key",control:i,render:({field:c})=>s.jsx(q,{label:"Data Field",required:!0,...c})}),s.jsx(b.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>s.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),s.jsx(a.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:s.jsxs(a.Button,{color:"blue",type:"submit",children:[s.jsx(z.DeviceFloppy,{size:20}),s.jsx(a.Text,{ml:"md",children:"Save"})]})})]})}):null}const tp=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function np(t,{panelModel:e}){try{const n=e.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const r=u=>u&&`${n}.${u}`,{x_axis_data_key:i,y_axis_data_key:o,z_axis_data_key:l,...c}=t;return{...c,x_axis_data_key:r(i),y_axis_data_key:r(o),z_axis_data_key:r(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class sp extends oe{constructor(){super(...arguments);$(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,r)=>{const{config:i}=n;return{...n,version:2,config:np(i,r)}})}}const rp={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new sp,name:"bar-3d",viewRender:Jd,configRender:ep,createConfig(){return{version:2,config:y.cloneDeep(Ds)}},translation:tp},ip=({disabled:t,value:e,onChange:n})=>{const r=i=>{i&&n(i)};return s.jsxs(a.Box,{sx:{position:"relative"},children:[t&&s.jsx(a.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),s.jsx(Ae,{height:"500px",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:t}})]})};function Me({enabled:t,func_content:e}){return(n,r)=>{if(!t)return n;try{return new Function(`return ${e}`)()(n,r)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),n}}}function _e(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
|
|
57
57
|
`)}}const Ke=g.forwardRef(({value:t,onChange:e,triggerButtonText:n},r)=>{const{t:i}=j.useTranslation(),[o,{setTrue:l,setFalse:c}]=N.useBoolean(),[u,d]=g.useState(t);g.useEffect(()=>{d(t)},[t]);const p=k=>{d({...u,enabled:k})},h=()=>{c();const{enabled:k,func_content:D}=u,E={enabled:k,func_content:D};d(E),e(E)},x=()=>{c(),d(t)},m=k=>{d(D=>({...D,func_content:k}))},v=()=>{m(_e().func_content)},C=n??i("chart.axis.customize_label");return s.jsxs(s.Fragment,{children:[s.jsx(a.Button,{variant:"filled",color:"grape",leftIcon:s.jsx(T.IconMathFunction,{size:16}),mt:24,onClick:l,sx:{flexGrow:0},children:C}),s.jsx(a.Modal,{size:800,title:C,opened:o,onClose:c,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:o&&s.jsxs(a.Stack,{children:[s.jsx(a.Checkbox,{mt:10,label:i("common.enabled"),checked:u.enabled,onChange:k=>p(k.currentTarget.checked)}),s.jsx(ip,{value:u.func_content,onChange:m,disabled:!u.enabled}),s.jsxs(a.Group,{position:"apart",children:[s.jsx(a.Button,{onClick:v,color:"red",leftIcon:s.jsx(z.Recycle,{size:20}),children:i("common.actions.reset_to_default")}),s.jsxs(a.Group,{position:"right",children:[s.jsx(a.Button,{onClick:x,variant:"subtle",children:i("common.actions.cancel")}),s.jsx(a.Button,{color:"green",leftIcon:s.jsx(T.IconDeviceFloppy,{size:16}),onClick:h,children:i("common.actions.save")})]})]})]})})]})}),St={x_axis_scroll:!1,y_axis_scroll:!1,x_axis_slider:!1,y_axis_slider:!1};function Ia(){return y.cloneDeep(St)}const ap=[{lang:"en",resources:{boxplot:{viz_name:"Boxplot Chart",box:"Box",outlier:"Outlier",scatter:"Scatter",click_series:{label:"Click box, scatter or outlier"}}}},{lang:"zh",resources:{boxplot:{viz_name:"箱线图",box:"箱体",outlier:"异常点",scatter:"散点",click_series:{label:"点击箱体、散点或异常点"}}}}],Ea={id:"builtin:echarts:click-echart:series",displayName:"viz.boxplot.click_series.label",nameRender:lp,configRender:op,payload:[{name:"type",description:"Always 'click'",valueType:"string"},{name:"seriesType",description:"'boxplot'",valueType:"string"},{name:"name",description:"Name of the series clicked",valueType:"string"},{name:"color",description:"Color",valueType:"string"},{name:"value",description:"Record of 'name', 'min', 'q1', 'median', 'q3', 'max'",valueType:"object"},{name:"rowData",description:"Data of the row",valueType:"object"}]};function op(t){return s.jsx(s.Fragment,{})}function lp(t){const{t:e}=j.useTranslation();return s.jsx(a.Text,{children:e("viz.boxplot.click_series.label")})}const In=g.forwardRef(({sectionTitle:t,value:e,onChange:n},r)=>{const{t:i,i18n:o}=j.useTranslation(),l=u=>d=>{const p=y.cloneDeep(e);y.set(p,u,d),n(p)},c=g.useMemo(()=>[{label:i("chart.axis.overflow.truncate"),value:"truncate"},{label:i("chart.axis.overflow.break_line"),value:"break"},{label:i("chart.axis.overflow.break_word"),value:"breakAll"}],[o.language]);return s.jsxs(a.Stack,{spacing:0,children:[t&&s.jsx(a.Divider,{mb:-5,mt:5,variant:"dotted",label:t,labelPosition:"right",labelProps:{color:"dimmed"}}),s.jsxs(a.Group,{grow:!0,noWrap:!0,children:[s.jsx(a.NumberInput,{label:i("chart.axis.overflow.max_width"),hideControls:!0,value:e.width,onChange:l("width")}),s.jsx(a.Select,{label:i("chart.axis.overflow.label"),data:c,value:e.overflow,onChange:l("overflow")}),s.jsx(a.TextInput,{label:i("chart.axis.overflow.ellipsis"),value:e.ellipsis,disabled:!0})]})]})}),Je=g.forwardRef(({value:t,onChange:e},n)=>{const{t:r}=j.useTranslation(),i=l=>{e({...t,on_axis:l})},o=l=>{e({...t,in_tooltip:l})};return s.jsxs(a.Stack,{ref:n,spacing:0,children:[s.jsx(In,{sectionTitle:r("chart.axis.overflow.section_title.on_axis"),value:t.on_axis,onChange:i}),s.jsx(In,{sectionTitle:r("chart.axis.overflow.section_title.in_tooltip"),value:t.in_tooltip,onChange:o})]})});function Ie(){return{on_axis:{width:80,overflow:"truncate",ellipsis:"..."},in_tooltip:{width:200,overflow:"break",ellipsis:"..."}}}function Oe({overflow:t,width:e}){const n={truncate:"initial",break:"break-all",breakAll:"break-word"}[t],r=t==="truncate"?"nowrap":"initial",i={truncate:"ellipsis",break:"clip",breakAll:"clip"}[t];return`
|
|
58
58
|
max-width: ${e}px;
|
|
59
59
|
word-break: ${n};
|
|
@@ -479,4 +479,4 @@ WHERE
|
|
|
479
479
|
`)},u1=S.observer(({queryModel:t})=>{const{t:e}=j.useTranslation();return t.typedAsHTTP?s.jsxs(a.Tabs,{defaultValue:"pre_process",orientation:"vertical",sx:{flexGrow:1},children:[s.jsxs(a.Tabs.List,{children:[s.jsx(a.Tabs.Tab,{value:"pre_process",children:e("query.build_request")}),s.jsx(a.Tabs.Tab,{value:"post_process",children:e("query.process_result")}),s.jsx(Ci,{})]}),s.jsx(a.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:s.jsx(Ft,{label:"",value:t.pre_process,onChange:t.setPreProcess,defaultValue:qc.pre})}),s.jsx(a.Tabs.Panel,{value:"post_process",p:"sm",children:s.jsx(Ft,{label:"",value:t.post_process,onChange:t.setPostProcess,defaultValue:qc.post})})]}):null}),d1=S.observer(({queryID:t,usage:e})=>{const{t:n}=j.useTranslation(),r=X().editor,i=l=>{if(l.type==="filter"){r.setPath(["_FILTERS_",l.id]);return}if(l.type==="panel"){const c=l.views[0].id;r.setPath(["_VIEWS_",c,"_PANELS_",l.id]);return}},o=l=>{r.setPath(["_VIEWS_",l])};return s.jsx(a.Stack,{py:"sm",px:"md",children:s.jsxs(a.Table,{highlightOnHover:!0,sx:{tableLayout:"fixed"},children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{style:{width:100},children:n("common.type")}),s.jsx("th",{style:{width:"calc(50% - 50px)"},children:n("common.name")}),s.jsx("th",{children:n("query.usage.in_views")})]})}),s.jsx("tbody",{children:e.map(l=>s.jsxs("tr",{children:[s.jsx("td",{children:n(`${l.type}.label`)}),s.jsx("td",{children:s.jsx(a.Anchor,{component:"button",type:"button",onClick:()=>i(l),children:l.label})}),s.jsx("td",{children:s.jsxs(a.Stack,{align:"flex-start",justify:"flex-start",spacing:2,children:[l.views.map(c=>s.jsx(a.Anchor,{component:"button",type:"button",onClick:()=>o(c.id),children:s.jsx(a.Box,{children:c.label})},c.id)),l.views.length===0&&s.jsx(a.Box,{children:"--"})]})})]},l.id))})]})})}),Si=({value:t,onChange:e,height:n="200px",defaultLanguage:r="sql",theme:i="vs-dark"})=>{const o=c=>{e==null||e(c??"")},l=!e;return s.jsx(Ae,{className:"minimal-monaco-editor",height:n,defaultLanguage:r,value:t,onChange:l?void 0:o,theme:i,options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:l||!e,"semanticHighlighting.enabled":!0}})},p1=S.observer(({queryModel:t})=>{const{t:e}=j.useTranslation(),n=g.useMemo(()=>y.groupBy(t.dependencies,"type"),[t.dependencies]),r=g.useMemo(()=>t.dependencies.some(o=>!o.valid),[t.dependencies]),i=t.dependencies.length>0;return i?s.jsxs(a.HoverCard,{withinPortal:!0,zIndex:340,shadow:"md",disabled:!i,children:[s.jsx(a.HoverCard.Target,{children:s.jsx(a.Button,{size:"xs",variant:"subtle",color:r?"red":"green",disabled:!i,leftIcon:r?s.jsx(T.IconAlertTriangle,{size:16}):s.jsx(T.IconDiscountCheckFilled,{size:16}),children:e("query.dependency.label")})}),s.jsx(a.HoverCard.Dropdown,{children:s.jsx(a.List,{spacing:"md",size:14,listStyleType:"none",children:Object.entries(n).map(([o,l])=>s.jsxs(a.List.Item,{children:[s.jsx(a.Text,{fw:"bold",ff:"monospace",children:e(`${o}.label`)}),s.jsx(a.List,{withPadding:!0,size:14,sx:{fontFamily:"monospace",svg:{verticalAlign:"middle"}},children:l.map(c=>s.jsx(a.List.Item,{icon:s.jsx(a.Box,{sx:{path:{fill:c.valid?"rgb(18, 184, 134)":"rgb(250, 82, 82)"}},children:s.jsx(T.IconPointFilled,{size:12})}),children:c.key},c.key))})]},o))})})]}):s.jsx(a.Tooltip,{label:e("query.dependency.has_none"),children:s.jsx(a.Button,{size:"xs",variant:"subtle",color:"gray",leftIcon:s.jsx(T.IconHierarchy,{size:16,style:{transform:"rotate(180deg)"}}),sx:{transform:"none !important"},children:e("query.dependency.label")})})}),h1="SELECT 1",x1=S.observer(({queryModel:t})=>{const{t:e}=j.useTranslation(),[n,r]=g.useState(t.sql),i=()=>{t.setSQL(n)},o=()=>{r(t.sql)},l=()=>{r(h1)};g.useEffect(()=>{r(t.sql)},[t.sql]);const c=n!==t.sql;return s.jsxs(a.Stack,{spacing:4,sx:{height:"100%"},children:[s.jsxs(a.Group,{mb:6,position:"apart",sx:{flexShrink:0,flexGrow:0},children:[s.jsx(a.Group,{position:"left",children:s.jsx(p1,{queryModel:t})}),s.jsxs(a.Group,{position:"right",children:[s.jsx(a.Button,{onClick:l,size:"xs",variant:"default",leftIcon:s.jsx(T.IconPlayerSkipBack,{size:16}),children:e("common.actions.reset_to_default")}),s.jsx(a.Button,{onClick:o,color:"red",size:"xs",disabled:!c,leftIcon:s.jsx(T.IconRecycle,{size:16}),children:e("common.actions.revert_changes")}),s.jsx(a.Button,{color:"green",size:"xs",onClick:i,disabled:!c,leftIcon:s.jsx(T.IconDeviceFloppy,{size:16}),children:e("common.actions.save_changes")})]})]}),s.jsx(Si,{height:"100%",value:n,onChange:r,theme:"sql-dark",defaultLanguage:"sql"})]})}),g1=({value:t,height:e="200px",defaultLanguage:n="sql"})=>s.jsx(Ae,{className:"preview-sql-in-monaco-editor",height:e,defaultLanguage:n,value:t,onChange:void 0,theme:"vs-light",options:{lineNumbers:"on",folding:!0,lineDecorationsWidth:20,wordWrap:"on",minimap:{enabled:!1},readOnly:!0}}),m1=S.observer(({value:t})=>{const n=ue().payloadForSQL,r=g.useMemo(()=>vs(t,n),[t,n]);return s.jsx(g1,{height:"100%",value:r})}),Oc={pre:["function process_request({ context, filters, sql }, utils) {"," // modify and return sql"," return sql","}"].join(`
|
|
480
480
|
`),post:["function process_result(data, utils, state) {"," // process data and return the result"," return data","}"].join(`
|
|
481
481
|
`)},f1=S.observer(({queryModel:t})=>{const{t:e}=j.useTranslation();return t.typedAsSQL?s.jsxs(a.Tabs,{defaultValue:"Edit",orientation:"vertical",sx:{flexGrow:1},styles:{tabLabel:{width:"100%",height:"28px",lineHeight:"28px"}},keepMounted:!1,children:[s.jsxs(a.Tabs.List,{children:[s.jsx(a.Tabs.Tab,{value:"Edit",children:s.jsx(a.Group,{spacing:14,position:"apart",children:e("query.edit_sql")})}),s.jsx(a.Tabs.Tab,{value:"Preview",children:e("query.preview_sql")}),s.jsx(a.Tabs.Tab,{value:"pre_process",children:e("query.process_request")}),s.jsx(a.Tabs.Tab,{value:"post_process",children:e("query.process_result")}),s.jsx(Ci,{}),t.datasource&&s.jsx($c,{dataSource:t.datasource})]}),s.jsx(a.Tabs.Panel,{value:"Edit",sx:{position:"relative"},p:"sm",children:s.jsx(x1,{queryModel:t})}),s.jsx(a.Tabs.Panel,{value:"Preview",p:0,pl:4,children:s.jsx(m1,{value:t.sql})}),s.jsx(a.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:s.jsx(Ft,{label:"",value:t.pre_process,onChange:t.setPreProcess,defaultValue:Oc.pre})}),s.jsx(a.Tabs.Panel,{value:"post_process",p:"sm",children:s.jsx(Ft,{label:"",value:t.post_process,onChange:t.setPostProcess,defaultValue:Oc.post})})]}):null}),y1={pre:["function transform(queries, state, utils) {"," // use queries & dashboar state to build new data"," const data = []"," return data","}"].join(`
|
|
482
|
-
`),post:""},b1=S.observer(({queryModel:t})=>{const{t:e}=j.useTranslation(),n=Q();return t.isTransform?s.jsxs(a.Stack,{py:20,px:20,sx:{height:"100%"},children:[s.jsx(a.Text,{size:"sm",children:e("query.transform.guide.pick_queries")}),s.jsx(a.MultiSelect,{data:n.queries.optionsWithoutTransform,value:[...t.dep_query_ids],onChange:t.setDependantQueryIDs,maxDropdownHeight:800}),s.jsx(a.Text,{size:"sm",children:e("query.transform.guide.write_function")}),s.jsx(a.Box,{sx:{flexGrow:1},children:s.jsx(Ft,{label:"",value:t.pre_process,onChange:t.setPreProcess,defaultValue:y1.pre})})]}):null}),yn={height:"calc(100% - 44px)",padding:0},v1=S.observer(({queryModel:t})=>{const{t:e}=j.useTranslation(),n=Q(),r=g.useMemo(()=>t.datasource?t.typedAsHTTP?"HTTP":"SQL":"Configurations",[t.datasource,t.typedAsHTTP]),[i,o]=g.useState(r);g.useEffect(()=>{o(u=>u!=="Configurations"&&r==="Configurations"?"Configurations":u)},[r]);const l=n.findQueryUsage(t.id),c=l.length===0;return s.jsxs(a.Tabs,{value:i,onTabChange:o,defaultValue:r,orientation:"horizontal",keepMounted:!1,sx:{height:"100vh"},children:[s.jsxs(a.Tabs.List,{grow:!0,children:[s.jsx(a.Tabs.Tab,{value:"Configurations",children:e("query.configurations")}),t.typedAsSQL&&s.jsx(a.Tabs.Tab,{value:"SQL",children:e("query.request")}),t.typedAsHTTP&&s.jsx(a.Tabs.Tab,{value:"HTTP",children:e("query.request")}),t.isTransform&&s.jsx(a.Tabs.Tab,{value:"Transform",children:e("query.transform.label")}),s.jsx(a.Tabs.Tab,{value:"Data",disabled:!t.canPreviewData,children:s.jsx(a.Tooltip,{label:t.guideToPreviewData,disabled:t.canPreviewData,withinPortal:!0,children:s.jsx(a.Text,{children:e("data.preview_data")})})}),s.jsx(a.Tabs.Tab,{value:"Usage",disabled:c,children:s.jsx(a.Tooltip,{label:e("query.usage.unused_description"),disabled:!c,withinPortal:!0,children:s.jsx(a.Text,{children:e("query.usage.label")})})})]}),s.jsx(a.Tabs.Panel,{value:"Configurations",pt:0,p:0,children:s.jsx(a1,{queryModel:t})}),t.typedAsSQL&&s.jsx(a.Tabs.Panel,{value:"SQL",sx:yn,children:s.jsx(a.Stack,{sx:{height:"100%"},children:s.jsx(f1,{queryModel:t})})}),t.typedAsHTTP&&s.jsx(a.Tabs.Panel,{value:"HTTP",sx:yn,children:s.jsx(a.Stack,{sx:{height:"100%"},children:s.jsx(u1,{queryModel:t})})}),t.isTransform&&s.jsx(a.Tabs.Panel,{value:"Transform",sx:yn,children:s.jsx(a.Stack,{sx:{height:"100%"},children:s.jsx(b1,{queryModel:t})})}),s.jsx(a.Tabs.Panel,{value:"Data",sx:{...yn,overflow:"hidden"},children:s.jsx(ji,{id:t.id,moreActions:null,refreshOnMount:!0})}),s.jsx(a.Tabs.Panel,{value:"Usage",sx:{...yn,overflow:"hidden"},children:s.jsx(d1,{queryID:t.id,usage:l})})]})}),j1=S.observer(({id:t})=>{const n=Q().queries.findByID(t);return t===""?null:n?s.jsx(v1,{queryModel:n}):s.jsx(a.Text,{size:14,color:"red",children:"Invalid Query ID"})}),_1=S.observer(({value:t})=>{const n=ue().payloadForSQL,r=g.useMemo(()=>vs(t,n),[t,n]);return s.jsx(Si,{height:"100%",value:r})}),w1=S.observer(({item:t,remove:e,onKeyChanged:n})=>{const{t:r}=j.useTranslation(),[i,o]=g.useState("SQL"),[l,c]=g.useState(t.key),u=()=>{t.setKey(l),n(l)},d=l!==t.key,p=t.isADuplicatedKey(l),[h,x]=g.useState(t.value),m=()=>{t.setValue(h)};g.useEffect(()=>{c(t.key),x(t.value)},[t]);const v=h!==t.value,C=Le.useModals(),k=()=>{C.openConfirmModal({title:`${r("sql_snippet.delete")}?`,labels:{confirm:r("common.actions.confirm"),cancel:r("common.actions.cancel")},onCancel:()=>console.log("Cancel"),onConfirm:e,confirmProps:{color:"red"},zIndex:320})};return s.jsxs(a.Stack,{p:20,sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",children:[s.jsxs(a.Group,{sx:{alignItems:"end"},spacing:40,children:[s.jsx(a.TextInput,{label:r(p?"sql_snippet.key_occupied":"sql_snippet.key"),value:l,onChange:D=>{c(D.currentTarget.value)},sx:{flexGrow:"1 !important"},rightSection:s.jsx(a.ActionIcon,{color:"blue",variant:"subtle",onClick:u,disabled:!d||p,children:s.jsx(z.DeviceFloppy,{size:16})}),error:p}),s.jsx(a.Button,{leftIcon:s.jsx(z.Trash,{size:16}),color:"red",variant:"light",onClick:k,children:r("sql_snippet.delete")})]}),s.jsxs(a.Tabs,{value:i,onTabChange:o,sx:{flexGrow:1},styles:{panel:{height:"calc(100% - 50px)"}},children:[s.jsxs(a.Tabs.List,{sx:{position:"relative"},children:[s.jsx(a.Tabs.Tab,{value:"SQL",children:r("sql_snippet.edit_snippet")}),s.jsx(a.Tabs.Tab,{value:"Preview",children:r("sql_snippet.preview_snippet")}),s.jsx(Ci,{}),s.jsx(a.ActionIcon,{color:"blue",variant:"filled",onClick:m,disabled:!v,sx:{position:"absolute",top:0,right:10},children:s.jsx(z.DeviceFloppy,{size:18})})]}),s.jsx(a.Tabs.Panel,{value:"SQL",pt:"sm",children:s.jsx(Si,{height:"100%",value:h,onChange:x,defaultLanguage:"sql",theme:"sql-dark"})}),s.jsx(a.Tabs.Panel,{value:"Preview",pt:"sm",children:s.jsx(_1,{value:h})})]})]})}),C1=S.observer(({id:t})=>{const e=X(),n=Q(),r=g.useMemo(()=>n.sqlSnippets.findByKey(t),[t]);if(!t)return null;if(!r)return s.jsxs(a.Text,{size:14,children:["SQL Snippet by key[",t,"] is not found"]});const i=()=>{e.editor.setPath(["_SQL_SNIPPETS_",""])},o=()=>{n.sqlSnippets.removeByKey(t),i()},l=c=>{e.editor.setPath(["_SQL_SNIPPETS_",c])};return s.jsx(w1,{item:r,remove:o,onKeyChanged:l})}),S1=S.observer(()=>{const{t}=j.useTranslation(),[e,n]=g.useState([]),r=Le.useModals(),i=X(),o=x=>{i.editor.setPath(["_SQL_SNIPPETS_",x])},l=()=>{r.openConfirmModal({title:"Delete ununsed SQL snippets?",children:s.jsx(a.Text,{size:"sm",children:"This action cannot be undone."}),labels:{confirm:t("common.actions.confirm"),cancel:t("common.actions.cancel")},onCancel:()=>console.log("Cancel"),onConfirm:()=>i.content.removeUnusedSQLSnippets(),confirmProps:{color:"red"},zIndex:320})},c=()=>{i.content.sqlSnippets.downloadSchema(e)},u=g.useMemo(()=>i.content.sqlSnippets.sortedList.map(x=>x.key),[i.content.sqlSnippets.sortedList]),d=()=>{n(u)},p=()=>{n([])},h=i.content.sqlSnippetsUsage;return s.jsxs(a.Stack,{sx:{height:"100%"},spacing:"sm",pb:"59px",children:[s.jsx(a.Box,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:s.jsx(a.Text,{px:"md",align:"left",sx:{userSelect:"none",cursor:"default"},children:t("sql_snippet.manage")})}),s.jsxs(a.Flex,{justify:"space-between",align:"center",px:12,children:[s.jsxs(a.Group,{position:"left",children:[s.jsxs(a.Button.Group,{children:[s.jsx(a.Button,{variant:"default",size:"xs",onClick:d,children:t("common.actions.select_all")}),s.jsx(a.Button,{variant:"default",size:"xs",onClick:p,children:t("common.actions.clear_selection")})]}),s.jsx(a.Button,{size:"xs",color:"blue",leftIcon:s.jsx(T.IconCode,{size:14}),disabled:e.length===0,onClick:c,children:t("common.actions.download_schema")})]}),s.jsx(a.Button,{variant:"subtle",size:"xs",color:"red",leftIcon:s.jsx(T.IconTrash,{size:14}),disabled:!i.content.hasUnusedSQLSnippets,onClick:l,children:t("sql_snippet.delete_unused")})]}),s.jsx(a.Box,{sx:{flexGrow:1,overflow:"auto"},children:s.jsx(a.Checkbox.Group,{size:"xs",value:e,onChange:n,children:s.jsxs(a.Table,{fontSize:"sm",highlightOnHover:!0,sx:{tableLayout:"fixed"},children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{style:{width:"40px"}}),s.jsx("th",{children:t("common.key")}),s.jsx("th",{style:{width:"100px",textAlign:"center"},children:t("sql_snippet.usage.label")}),s.jsx("th",{style:{width:"300px",paddingLeft:"24px"},children:t("common.action")})]})}),s.jsx("tbody",{children:i.content.sqlSnippets.sortedList.map(x=>{var v;const m=((v=h[x.key])==null?void 0:v.length)??0;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(a.Checkbox,{value:x.key,styles:{input:{cursor:"pointer"}}})}),s.jsx("td",{children:x.key}),s.jsx("td",{style:{color:m===0?"#ff0000":"#000",fontWeight:m===0?"bold":"normal",textAlign:"center"},children:m}),s.jsx("td",{children:s.jsx(a.Button,{variant:"subtle",size:"xs",onClick:()=>o(x.key),children:t("common.actions.open")})})]},x.key)})})]})})})]})}),k1=S.observer(({view:t})=>!t||t.type!==L.Division?null:s.jsx(a.Stack,{})),T1=S.observer(({view:t})=>{const{t:e,i18n:n}=j.useTranslation(),r=g.useMemo(()=>[{value:"default",label:e("common.tabs.variant.default")},{value:"outline",label:e("common.tabs.variant.outline")},{value:"pills",label:e("common.tabs.variant.pills")}],[n.language]),i=g.useMemo(()=>[{value:"horizontal",label:e("common.tabs.orientation.horizontal")},{value:"vertical",label:e("common.tabs.orientation.vertical")}],[n.language]);if(!t||t.type!==L.Tabs)return null;const o=t.config;return s.jsxs(a.Stack,{children:[s.jsx(a.Divider,{mt:8,mb:0,label:e("view.component.tabs.tabs_settings"),labelPosition:"center"}),s.jsx(a.Select,{label:e("common.tabs.variant.label"),value:o.variant,onChange:o.setVariant,data:r}),s.jsx(a.Select,{label:e("common.tabs.orientation.label"),value:o.orientation,onChange:o.setOrientation,data:i}),s.jsx(a.Switch,{label:e("common.tabs.grow_tabs"),checked:o.grow,onChange:l=>o.setGrow(l.currentTarget.checked)})]})}),D1=({disabled:t,value:e,onChange:n})=>{const r=i=>{i&&n(i)};return s.jsxs(a.Box,{sx:{position:"relative"},children:[t&&s.jsx(a.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),s.jsx(Ae,{height:"500px",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:t}})]})},z1=({value:t,onChange:e})=>{const{t:n}=j.useTranslation(),[r,{setTrue:i,setFalse:o}]=N.useBoolean(),[l,c]=g.useState(t??is),u=m=>{c({...l,enabled:m})},d=()=>{o();const{enabled:m,func_content:v}=l,C={enabled:m,func_content:v};c(C),e(C)},p=()=>{o(),c(t)},h=m=>{c(v=>({...v,func_content:m}))},x=()=>{h(is.func_content)};return s.jsxs(s.Fragment,{children:[s.jsx(a.ActionIcon,{size:"lg",color:"blue",variant:"filled",mt:26,onClick:i,sx:{flexGrow:0},children:s.jsx(z.Settings,{size:14})}),s.jsx(a.Modal,{size:800,title:n("view.component.modal.custom_title"),opened:r,onClose:o,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:r&&s.jsxs(a.Stack,{children:[s.jsx(a.Checkbox,{mt:10,label:n("common.enabled"),checked:l.enabled,onChange:m=>u(m.currentTarget.checked)}),s.jsx(D1,{value:l.func_content,onChange:h,disabled:!l.enabled}),s.jsxs(a.Group,{position:"apart",children:[s.jsx(a.Button,{onClick:x,color:"red",leftIcon:s.jsx(z.Recycle,{size:20}),children:n("common.actions.revert")}),s.jsxs(a.Group,{position:"right",children:[s.jsx(a.Button,{onClick:p,variant:"subtle",children:n("common.actions.cancel")}),s.jsx(a.Button,{onClick:d,children:n("common.actions.save")})]})]})]})})]})},M1=S.observer(({view:t})=>{const{t:e}=j.useTranslation();if(!t||t.type!==L.Modal)return null;const n=t.config,r=n.custom_modal_title.value;return s.jsxs(a.Stack,{children:[s.jsx(a.Divider,{mt:8,label:e("view.component.modal.modal_settings"),labelPosition:"center"}),s.jsxs(a.Flex,{gap:10,children:[s.jsx(a.TextInput,{label:e("view.component.modal.title"),value:r,onChange:y.noop,disabled:!0,sx:{flexGrow:1}}),s.jsx(z1,{value:n.custom_modal_title,onChange:n.custom_modal_title.replace})]}),s.jsxs(a.Group,{grow:!0,children:[s.jsx(a.TextInput,{label:e("view.component.modal.width"),value:n.width,onChange:i=>n.setWidth(i.currentTarget.value),placeholder:"600px / 50vw"}),s.jsx(a.TextInput,{label:e("view.component.modal.height"),value:n.height,onChange:i=>n.setHeight(i.currentTarget.value),placeholder:"600px / 50vw"})]})]})}),I1=S.observer(({view:t})=>s.jsxs(s.Fragment,{children:[s.jsx(k1,{view:t}),s.jsx(M1,{view:t}),s.jsx(T1,{view:t})]})),E1=S.observer(({view:t})=>{const{t:e,i18n:n}=j.useTranslation(),r=g.useMemo(()=>[{label:e("view.component.div.label"),value:L.Division},{label:e("view.component.modal.label"),value:L.Modal},{label:e("view.component.tabs.label"),value:L.Tabs}],[n.language]);return t?s.jsxs(a.Stack,{sx:{position:"relative"},children:[s.jsx(a.TextInput,{label:e("common.name"),value:t.name,onChange:i=>{t.setName(i.currentTarget.value)}}),s.jsx(a.Select,{label:e("common.type"),withinPortal:!0,zIndex:320,value:t.type,onChange:t.setType,data:r}),s.jsx(I1,{view:t})]}):null}),A1=S.observer(({id:t})=>{const{t:e}=j.useTranslation(),n=Le.useModals(),r=X(),i=Q();if(t==="")return null;const o=i.views.findByID(t);if(!o)return s.jsxs(a.Text,{size:14,children:["View by ID[",t,"] is not found"]});const l=()=>{r.editor.setPath(["_VIEWS_",""])},c=()=>{n.openConfirmModal({title:`${e("view.delete")}?`,labels:{confirm:e("common.actions.confirm"),cancel:e("common.actions.cancel")},onCancel:()=>console.log("Cancel"),onConfirm:()=>{i.views.removeByID(t),l()},zIndex:320})};return s.jsxs(a.Stack,{sx:{maxWidth:"600px",height:"100%"},spacing:"sm",children:[s.jsx(a.Group,{position:"right",pt:10,children:s.jsx(a.Button,{size:"xs",color:"red",leftIcon:s.jsx(z.Trash,{size:16}),onClick:c,children:e("view.delete")})}),s.jsx(a.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:s.jsx(E1,{view:o})})]})});function P1(t){return t.length===1&&t[0]==="_QUERY_VARS_"}function $1(t){return t.length===1&&t[0]==="_MOCK_CONTEXT_"}function L1(t){return t.length===1&&t[0]==="_FILTERS_"}function B1(t){return t.length===2&&t[0]==="_FILTERS_"}function q1(t){return t.length===1&&t[0]==="_SQL_SNIPPETS_"}function O1(t){return t.length===2&&t[0]==="_SQL_SNIPPETS_"}function V1(t){return t.length===2&&t[0]==="_QUERIES_"}function N1(t){return t.length===1&&t[0]==="_QUERIES_"}function F1(t){return t.length===2&&t[0]==="_VIEWS_"}function G1(t){return t.length===4&&t[0]==="_VIEWS_"&&t[2]==="_PANELS_"}const W1=S.observer(()=>s.jsx(a.Stack,{sx:{height:"100%"},p:"sm",children:s.jsx(Bc,{})})),Q1=S.observer(()=>{const t=X().editor,e=t.path;return P1(e)?s.jsx(W1,{}):$1(e)?s.jsx(nT,{}):L1(e)?s.jsx(tT,{}):B1(e)?s.jsx(a.Box,{p:"xs",pl:20,children:s.jsx(eT,{id:e[1]})}):q1(e)?s.jsx(S1,{}):O1(e)?s.jsx(C1,{id:e[1]}):N1(e)?s.jsx(OT,{}):V1(e)?s.jsx(j1,{id:e[1]}):F1(e)?s.jsx(a.Box,{p:"xs",pl:20,children:s.jsx(A1,{id:e[1]})}):G1(e)?s.jsx(qT,{viewID:e[1],panelID:e[3]}):s.jsx(a.Box,{children:t.path})}),R1=S.observer(()=>s.jsx(Q1,{})),Y1=S.observer(()=>{const{t}=j.useTranslation(),e=X(),n=()=>{const r=new Date().getTime().toString(),i={id:r,key:r,label:r,order:e.content.filters.current.length+1,type:pe.TextInput,config:Rr(),visibleInViewsIDs:["Main"],auto_submit:!1};e.content.filters.append(i),e.editor.setPath(["_FILTERS_",r])};return s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:n,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:t("filter.add")})}),U1=S.observer(({parentID:t})=>{const{t:e}=j.useTranslation(),n=Q();if(!t)return null;const r=n.views.findByID(t);return!r||r.type===L.Tabs?null:s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:()=>n.addANewPanel(r.id),sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:e("panel.add")})}),K1=S.observer(()=>{const{t}=j.useTranslation(),e=X(),n=()=>{const r=new Date().getTime().toString(),i={id:r,name:r,type:le.Postgresql,key:"",sql:""};e.content.queries.append(i),e.editor.setPath(["_QUERIES_",r])};return s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:n,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:t("query.add")})}),J1=S.observer(()=>{const{t}=j.useTranslation(),e=X(),n=()=>{const r=new Date().getTime().toString(),i={key:r,value:""};e.content.sqlSnippets.append(i),e.editor.setPath(["_SQL_SNIPPETS_",r])};return s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:n,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:t("sql_snippet.add")})}),X1=S.observer(()=>{const{t}=j.useTranslation(),e=Q();return s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:t("view.add")})}),Z1=S.observer(()=>{const{t}=j.useTranslation(),e=X();return s.jsx(a.Button,{variant:"subtle",rightIcon:s.jsx(T.IconSettings,{size:14}),size:"sm",px:12,mb:0,color:"blue",onClick:()=>e.editor.setPath(["_QUERIES_"]),sx:{width:"100%",borderRadius:0,fontWeight:"normal"},styles:{inner:{justifyContent:"space-between"}},children:t("query.manage")})}),H1=S.observer(()=>{const{t}=j.useTranslation(),e=X();return s.jsx(a.Button,{variant:"subtle",rightIcon:s.jsx(T.IconSettings,{size:14}),size:"sm",px:12,mb:0,color:"blue",onClick:()=>e.editor.setPath(["_SQL_SNIPPETS_"]),sx:{width:"100%",borderRadius:0,fontWeight:"normal"},styles:{inner:{justifyContent:"space-between"}},children:t("sql_snippet.manage")})}),eD=S.observer(()=>{const{t}=j.useTranslation(),e=X();return s.jsx(a.Button,{variant:"subtle",rightIcon:s.jsx(T.IconSettings,{size:14}),size:"sm",px:12,mb:0,color:"blue",onClick:()=>e.editor.setPath(["_FILTERS_"]),sx:{width:"100%",borderRadius:0,fontWeight:"normal"},styles:{inner:{justifyContent:"space-between"}},children:t("filter.manage")})}),tD=S.observer(({action_type:t,parentID:e})=>t==="_Add_A_Filter_"?s.jsx(Y1,{}):t==="_Add_A_SQL_SNIPPET_"?s.jsx(J1,{}):t==="_Add_A_QUERY_"?s.jsx(K1,{}):t==="_Add_A_VIEW_"?s.jsx(X1,{}):t==="_Add_A_PANEL_"?s.jsx(U1,{parentID:e}):t==="_QUERIES_SETTINGS_"?s.jsx(Z1,{}):t==="_SQL_SNIPPETS_SETTINGS_"?s.jsx(H1,{}):t==="_FILTERS_SETTINGS_"?s.jsx(eD,{}):null),Vc=S.observer(({option:t})=>{var p;const{t:e}=j.useTranslation(),n=X().editor,r=n.isOptionActive,i=r(n.path,t),o=n.isOptionOpened,l=n.navigate,c=o(t),[u,d]=g.useState(c);return g.useEffect(()=>{d(c)},[c]),s.jsx(a.NavLink,{active:i,defaultOpened:c,opened:u,onChange:d,label:e(t.label),onClick:()=>l(t),icon:t.Icon?s.jsx(t.Icon,{size:18}):null,children:(p=t.children)==null?void 0:p.map(h=>h._type==="ACTION"?s.jsx(tD,{action_type:h._action_type,parentID:h.parentID},`_ADD_${h.value}_`):s.jsx(Vc,{option:h},h.value))},t.label)}),nD=S.observer(()=>{const t=X();return s.jsx(a.Box,{sx:{position:"relative"},children:t.editor.navOptions.map(e=>s.jsx(Vc,{option:e},e.value))})}),sD=S.observer(()=>{const{t}=j.useTranslation(),e=X();return s.jsxs(a.Navbar,{p:0,width:{base:220,xs:220,sm:240,md:260,lg:300,xl:320},sx:{height:"100vh - 60px - 60px",".mantine-NavLink-body":{wordWrap:"break-word"}},children:[s.jsx(a.Navbar.Section,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:s.jsx(a.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:t("common.titles.settings")})}),s.jsx(a.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:s.jsx(nD,{})}),s.jsx(a.Navbar.Section,{children:s.jsx(a.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:s.jsx(a.Button,{size:"xs",color:"red",leftIcon:s.jsx(T.IconX,{size:18}),onClick:()=>e.editor.close(),children:t("common.actions.close")})})})]})}),rD={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden",minWidth:"calc(var(--mantine-navbar-width, 0px) + 1200px)"},body:{flexGrow:1,nav:{top:0,height:"100vh"}},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:0,height:"100vh"}},iD=S.observer(()=>{const t=X().editor;return s.jsx(a.Modal,{onClose:()=>t.setSettingsOpen(!1),closeOnEscape:!1,closeOnClickOutside:!1,opened:t.settings_open,fullScreen:!0,title:null,transitionProps:{duration:0},withCloseButton:!1,withinPortal:!0,zIndex:300,styles:{body:{padding:"0 !important"},content:{overflowY:"hidden !important"}},children:s.jsx(a.AppShell,{padding:0,navbar:s.jsx(sD,{}),styles:rD,children:s.jsx(R1,{})})})}),aD=t=>t.replace(/([^:])(\/\/+)/g,"$1/");function oD(t){g.useEffect(()=>{if(Ae.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/dashboard");const n=aD(t);Ae.loader.config({paths:{vs:n}}),Ae.loader.init().then(r=>console.log("monaco instance:",r))},[])}xa(),ma();const lD={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:60+30,height:"100vh"}},cD=({context:t,dashboard:e,content:n,update:r,className:i="dashboard",config:o,onChange:l,headerSlot:c,filterValues:u,onFilterValuesChange:d,onExit:p,lang:h},x)=>{oD(o.monacoPath),js(o);const{i18n:m}=j.useTranslation();g.useEffect(()=>{m.changeLanguage(h)},[h]);const{data:v=[]}=N.useRequest(ks),{data:C=[]}=N.useRequest(fa),k=g.useMemo(()=>vc(e,n,v,C,t,u??{}),[e,n]);g.useImperativeHandle(x,()=>k,[k]),jc(k.content,!0),g.useEffect(()=>{k.context.replace(t)},[t]),g.useEffect(()=>{k.datasources.replace(v)},[v]),g.useEffect(()=>{k.globalSQLSnippets.replace(C)},[C]),g.useEffect(()=>{d==null||d(k.content.filters.values)},[d,k.content.filters.values]),g.useEffect(()=>{u&&k.content.filters.patchValues(u)},[u,k.content.filters.patchValues]),g.useEffect(()=>K.reaction(()=>K.toJS(k.json),G=>{l==null||l(G)}),[k]);const D=async()=>{await r(k.json,k.content.json)},E=N.useCreation(Pr,[]),B=_c(E);return s.jsx(Le.ModalsProvider,{children:s.jsx($s,{children:s.jsx(Is,{value:{searchButtonProps:o.searchButtonProps},children:s.jsx(zs,{value:k,children:s.jsx(Es,{value:k.content,children:s.jsx(Mn.Provider,{value:{inEditMode:!0},children:s.jsx(rt.Provider,{value:E,children:s.jsxs(ss,{configure:B,children:[s.jsx(a.AppShell,{padding:0,header:s.jsx(pk,{onExit:p,saveDashboardChanges:D,headerSlot:c}),navbar:s.jsx(Ok,{}),styles:lD,children:s.jsx(a.Box,{className:`${i} dashboard-root`,sx:{position:"relative"},children:k.content.views.visibleViews.map(G=>s.jsx(lc,{view:G},G.id))})}),s.jsx(iD,{})]})})})})})})})})},uD=S.observer(g.forwardRef(cD)),tM="",ki=f.types.model({id:f.types.string,name:f.types.string,dashboard_id:f.types.string,create_time:f.types.string,update_time:f.types.string,version:f.types.string,filters:ii,queries:li,sqlSnippets:ui,views:ni,panels:ri,layouts:ci,mock_context:qr}).views(t=>({get json(){return{id:t.id,name:t.name,create_time:t.create_time,update_time:t.update_time,dashboard_id:t.dashboard_id,content:{views:t.views.json,panels:t.panels.json,filters:t.filters.json,version:t.version,layouts:t.layouts.json,definition:{queries:t.queries.json,sqlSnippets:t.sqlSnippets.json,mock_context:t.mock_context.current}}}},get contentJSON(){return this.json.content},get payloadForSQL(){const e=f.getParent(t).context.current,n=f.getParent(t).globalSQLSnippets,r={context:{...t.mock_context.current,...e},filters:t.filters.values};return{...r,sql_snippets:mn(t.sqlSnippets.current,"key","value",r),global_sql_snippets:mn(n.list,"id","content",r)}},get payloadForViz(){const e=f.getParent(t).context.current;return{context:{...t.mock_context.current,...e},filters:t.filters.values}},get dashboardState(){return Ss(this.payloadForSQL)},getAdditionalQueryInfo(e){return{content_id:t.id,query_id:e,params:this.dashboardState}},get data(){return t.queries.current.map(({id:n,data:r})=>({id:n,data:r})).reduce((n,r)=>(n[r.id]=r.data,n),{})},getDataStuffByID(e){const n=t.queries.findByID(e);return n?{data:n.data,len:n.data.length,state:n.state,error:n.error}:{data:[],len:0,state:"idle",error:void 0}}})).actions(t=>({}));function Nc({id:t,name:e,dashboard_id:n,create_time:r,update_time:i,content:o},l,c){if(!o)throw new Error("unexpected null content when creating a content model");const{version:u,filters:d,views:p,panels:h,layouts:x,definition:{queries:m,sqlSnippets:v,mock_context:C={}}}=o;return ki.create({id:t,name:e,dashboard_id:n,create_time:r,update_time:i,version:u,filters:ai(d,l,C,c),queries:Gl(m),sqlSnippets:Rl(v),mock_context:Or(C),views:$l(p),panels:{list:h},layouts:{list:x,currentBreakpoint:x[0].id}})}const Fc=f.types.model({id:f.types.identifier,name:f.types.string,group:f.types.string,content:ki,content_id:f.types.string,datasources:Al,globalSQLSnippets:Hr,context:as});function Gc({id:t,name:e,group:n,content_id:r},i,o,l,c,u){return Fc.create({id:t,name:e,group:n,content_id:r,content:Nc(i,c,u),datasources:{list:o},globalSQLSnippets:{list:l},context:ei(c)})}xa(),ma();const dD=({context:t,dashboard:e,content:n,className:r="dashboard",config:i,fullScreenPanelID:o,setFullScreenPanelID:l,filterValues:c,onFilterValuesChange:u,lang:d})=>{js(i);const{i18n:p}=j.useTranslation();g.useEffect(()=>{p.changeLanguage(d)},[d]);const{data:h=[]}=N.useRequest(ks),{data:x=[]}=N.useRequest(fa),m=g.useMemo(()=>Gc(e,n,h,x,t,c??{}),[e,n]);jc(m.content,!1),g.useEffect(()=>{m.context.replace(t)},[t]),g.useEffect(()=>{m.datasources.replace(h)},[h]),g.useEffect(()=>{m.globalSQLSnippets.replace(x)},[x]),g.useEffect(()=>{u==null||u(m.content.filters.values)},[u,m.content.filters.values]),g.useEffect(()=>{c&&m.content.filters.patchValues(c)},[c,m.content.filters.patchValues]);const v=N.useCreation(Pr,[]),C=_c(v);return s.jsx(Le.ModalsProvider,{children:s.jsx($s,{children:s.jsx(Is,{value:{searchButtonProps:i.searchButtonProps},children:s.jsx(zs,{value:m,children:s.jsx(Es,{value:m.content,children:s.jsx(Ps.Provider,{value:{fullScreenPanelID:o,setFullScreenPanelID:l},children:s.jsx(Mn.Provider,{value:{inEditMode:!1},children:s.jsx(a.Box,{className:`${r} dashboard-root`,children:s.jsx(rt.Provider,{value:v,children:s.jsx(ss,{configure:C,children:m.content.views.visibleViews.map(k=>s.jsx(ls,{view:k},k.id))})})})})})})})})})})},pD=S.observer(dD);I.extend(bu),I.extend(vu),I.extend(ju),I.extend(_u),I.extend(wu),I.extend(Cu),I.extend(Su),I.extend(ku),I.extend(Tu),I.extend(Du),I.extend(Iu),I.extend(Eu),I.extend(Au),I.extend(Pu),I.extend($u),I.extend(zu),I.extend(Mu),I.extend(Lu),I.extend(Bu),I.extend(qu),I.extend(Ou),I.extend(Vu),I.extend(Nu),I.extend(Fu),I.extend(Gu),I.extend(Wu),I.extend(Qu),I.extend(Ru),I.extend(Yu),I.extend(Uu),I.extend(Ju),I.extend(Xu),I.extend(Ku),I.tz.setDefault("UTC"),I.updateLocale("en",{weekStart:1});const hD={translation:{filter:{label:"Filter",labels:"Filters",add:"Add a Filter",manage:"Manage Filters",show_filters:"Show Filters",hide_filters:"Hide Filters",field:{widget:"Widget",visible_in:"Visible in...",key_placeholder:"A unique key to refer",label_placeholder:"Label for this field",auto_submit:"Submit automatically",order:"Placement Order",custom_default_value:{trigger:"Custom",title:"Custom default value",tips:"Tips",tip_1:"Function has the highest priority of getting filter's default value",tip_2:"Leave this editor empty to disable this feature"}},widget:{names:{select:"Select",multi_select:"Multi Select",tree_select:"Tree Select",text_input:"Text Input",checkbox:"Checkbox",date_range:"Date Range"},common:{use_query_data_as_options:"Use query data as options",fetch_options_from_datasource:"Fetch options from datasource",or_fetch_options_from_datasource:"Or fetch options from datasource",selector_option_empty:"Not found",see_data_structure:"Click to see expected data structure",using_query:"Using query",default_selection_count:"Select first N options by default",min_width:"Min width",x_selected:"{{count}} selected"},text_input:{default_value:"Default Value",required:"Required"},select:{width:"Width",required:"Required",clearable:"Clearable",configure_options:"Configure options",default_selection:"Default Selection",no_default_selection:"none",select_first_option_by_default:"Select the first option by default"},multi_select:{width_description:"At least 160px"},tree_select:{strictly:"Parent and children nodes are not associated"},checkbox:{description:"Description",default_checked:"Default checked"},date_range:{required:"Required",allow_single_date:"Allow choosing 1 day",display_format:"Display format",max_days:"Max days",one_day:"1 day",x_days:"{{count}} days",x_max_days:"{{max_days}} days max",default_value:"Default value",default_by_shortcut:"Default by shortcut",defualt_by_shortcut_placeholder:"Priors default value",start_date:"Start date",end_date:"End date",shortcut:{last:{label:"last",d:"yesterday",w:"week",m:"month",m2:"2 months",m3:"3 months",y:"year",full:{d:"yesterday",w:"last week",m:"last month",m2:"last 2 months",m3:"last 3 months",y:"last year"}},recent:{label:"recent",d7:"7 days",d30:"30 days",d60:"60 days",d90:"90 days",d180:"180 days",d365:"365 days",full:{d7:"recent 7 days",d30:"recent 30 days",d60:"recent 60 days",d90:"recent 90 days",d180:"recent 180 days",d365:"recent 365 days"}},this:{label:"this",d:"today",w:"week",m:"month",y:"year",full:{d:"today",w:"this week",m:"this month",y:"this year"}},this_so_far:{label:"this...so far",w:"week",m:"month",y:"year",full:{w:"this week so far",m:"this month so far",y:"this year so far"}}}}}},view:{label:"View",labels:"Views",add:"Add a View",delete:"Delete this View",download_schema:"Download this View",component:{div:{label:"Division"},tabs:{label:"Tabs",tabs_settings:"Tabs Settings",tab:{name:"Tab Name",view:"View",order:"Placement Order",color:"Color",delete:"Delete this tab",switch_to_view:"Swith to View: {{name}}"}},modal:{label:"Modal",modal_settings:"Modal settings",title:"Modal Title",custom_title:"Customize modal title",width:"Width",height:"Height"}}},interactions:{label:"Interactions",add:"Add an interaction",interactions_viewer:"Interactions Viewer",unavailable:"Unavailable",unavailable_reason:"This visualization does not have available interactions to choose from",trigger:{setup:"Setup Trigger",label:"Trigger",payload:"Payload"},operation:{setup:"Operation Settings",label:"Operation",settings:"Settings",variables:"Variables",console_log:{label:"console.log | debug",log_content:"log content"},open_link:{label:"Open Link",url:"URL",open_in_new_tab:"Open in new tab"},open_view:{label:"Open View",view:"View"},set_filter_values:{label:"Set Filter Values",set_filter:"Set filter",with:"with"},clear_filter_values:{label:"Clear Filter Values",select_filter:"Select filters to clear"}}},query_variable:{label:"Query Variable",labels:"Query Variables",add:"Add a Variable",guide:{tabs:{guide:"Guide",variables_in_this_dashboard:"Variables in this dashboard",global_sql_snippets:"Global SQL Snippets"}},open:"See Query Variables"},sql_snippet:{label:"SQL Snippet",labels:"SQL Snippets",add:"Add a SQL Snippet",delete:"Delete this SQL Snippet",delete_unused:"Delete unused SQL Snippets",manage:"Manage SQL Snippets",key:"Key",key_occupied:"This key is occupied by another snippet",edit_snippet:"Edit SQL Snippet",preview_snippet:"Preview SQL Snippet",usage:{label:"Usage"}},global_sql_snippet:{label:"Global SQL Snippet",labels:"Global SQL Snippets",description:"SQL snippets worth sharing between dashboards are managed in System Settings by admins."},common:{titles:{settings:"Settings",edit:"Edit",config:"Config"},pagination:{page_size:"Page Size",total:"Total",total_rows:"Total {total} row"},align:{horizontal:{label:"Horizontal Align",left:"left",center:"center",right:"right"},vertical:{label:"Vertical Align",left:"top",center:"center",right:"bottom"}},id:"ID",name:"Name",key:"Key",label:"Label",value:"Value",type:"Type",info:"Info",min:"Min",max:"Max",data_field:"Data Field",name_data_field:"Name Data Field",value_data_field:"Value Data Field",color_data_field:"Color Data Field",enabled:"Enabled",copied:"Copied to clipboard",action:"Action",actions:{open:"Open",close:"Close",save:"Save",save_changes:"Save Changes",revert:"Revert",revert_changes:"Revert Changes",reset_to_default:"Reset to default",select_all:"Select All",clear_selection:"Clear Selection",refresh:"Refresh",download_data:"Download Data",download_schema:"Download Schema",download_screenshot:"Screenshot",enter_fullscreen:"Full Screen",duplicate:"Duplicate",delete:"Delete",cancel:"Cancel",confirm:"Confirm",add_an_option:"Add an Option",edit:"Edit",end_editing:"End editing <1>{{name}}</1>"},tabs:{variant:{label:"Variant",default:"Default",outline:"Outline",pills:"Pills"},orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"},grow_tabs:"Grow Tabs"},choose_a_tab_first:"Please choose a tab first"},breakpoint:{label_one:"Screen size",label_other:"Screen sizes",add:"Add a screen size",manage:"Manage screen sizes",breakpoint:"Min Width"},context:{label:"Context"},mock_context:{label:"Mock Context",hint:"A valid json string is required"},panel:{label:"Panel",labels:"Panels",add:"Add a Pane",delete:"Delete This Panel",panel_name:"Panel Name",panel_description:"Description",panel_description_click:"Click to see description",show_title:"Show title",use_name_as_title:"Use name as title",settings:{change_view:"Move into Another View",change_view_title:"Move panel into another view",choose_queries:"Choose queries"},style:{label:"Style",width:"Width",width_postfix:"of 36 columns",height:"Height",height_postfix:"px",border:"Border"},variable:{label:"Variable",labels:"Variables",add:"Add a Variable",delete:"Delete this Variable",aggregation:{label:"Aggregation",fallback_value:"Fallback Value",fallback_value_description:"Used when data is empty or the aggregation yields NaN"}}},style:{label:"Style",font_size:{label:"Font Size",placeholder:"10px, 1em, 1rem, 100%..."},font_weight:{label:"Font Weight"},size:{xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},flex:{justify_content:{label:"Justify Content",left:"Left",center:"Center",right:"Right",space_between:"Space Between",space_around:"Space Around",space_evenly:"Space Evenly"},align_items:{label:"Align Items",start:"Start",center:"Center",end:"End",stretch:"Stretch"}},color:{type:{label:"Color Type",static:"Static",interpolation:"Interpolation",none:"None"},interpolation:{setup:"Setup color interpolation",palette:{label:"Palette",category:{sequential:"Sequential",diverging:"Diverging"},red_green:"Red / Green",yellow_blue:"Yellow / Blue",red:"Red",green:"Green",blue:"Blue",orange:"Orange",mapping:{value_input_label:"Map a value to this color"}}}}},query:{label:"Query",labels:"Queries",add:"Add a Query",delete:"Delete this Query",cant_delete:"Can't delete this query for it's being used, check out Usage tab for details",delete_unused:"Delete unused queries",name:"Name",name_description:"A unique name",manage:"Manage Queries",open:"Open this query",configurations:"Configurations",basics:"Basics",conditions:"Conditions",run_by_condition:{label:"Run query when these are truthy",unset:"Always run this query on load"},re_run_condition:{label:"Re-run query when these changed",unset:"Leave it empty to never re-run this query"},dependency:{label:"Dependency",has_none:"This query has no dependency"},edit_sql:"Edit SQL",preview_sql:"Preview SQL",request:"Request",build_request:"Build Request",process_request:"Process Request",process_result:"Process Result",usage:{label:"Usage",in_views:"In View(s)",unused_description:"This query is not used by any filter or panel"},transform:{label:"Transform",data_source:"Use other queries' data",guide:{pick_queries:"Pick queries for data input",write_function:"Write a function for making new data"}}},data:{label:"Data",preview_data:"Preview Data",empty_data:"Empty Data"},data_source:{label:"Data Source",explore:"Explore Data Source",explorer:"Data Source Explorer",table_structure:"Table Structure",table_structure_short:"Structure",see_table_structure:"See Table Structure"},visualization:{label:"Visualization",component:"Visualization",label_short:"Viz"},numbro:{format:{label:"Format",absolute:"Absolute",absolute_description:"Non-negative",abbreviation:"Abbreviation",abbreviation_description:"like 1.23k, 1.23m",mantissa:"Mantissa",trim_mantissa:"Trim mantissa",trim_mantissa_description:"hide trailing zero(s)",preview:{open:"Open Preview",close:"Close Preview",input:"In",output:"Out"}}},import:{label:"Import...",title:"Import content with schema json",json_file:"JSON File",this_dashboard:"This dashboard",this_file:"This file"},function_utils:{trigger_text:"About parameter 'utils'",modal_title:"About FunctionUtils",description:"Parameter <code>utils</code> is <code>FunctionUtils</code>, which contains:",document:"Document"},aggregation:{option:{none:"None",sum:"Sum",mean:"Mean",median:"Median",min:"Min",max:"Max",cov:"Coefficient of Variation",std:"Standard Variation",quantile:{label:"Quantile",label_with_hint:"Quantile(99%, 95%, ...)"},custom:{label:"Custom",label_trigger:"Edit Function",title:"Custom Aggregation"}}},chart:{chart_config:"Chart Config",data_field:"Data Field",groups:{merico_suite:"Merico suite",echarts_based_charts:"ECharts-based charts",others:"Others"},label:{label:"Label",label_full:"Label",label_style:"Label Style",label_format:"Label Format"},label_position:{label:"Label Position",off:"Off",top:"Top",left:"Left",right:"Right",bottom:"Bottom",inside:"Inside",inside_top:"Inside Top",inside_left:"Inside Left",inside_center:"Inside Center",inside_right:"Inside Right",inside_bottom:"Inside Bottom",inside_top_left:"Inside Top Left",inside_top_right:"Inside Top Right",inside_bottom_left:"Inside Bottom Left",inside_bottom_right:"Inside Bottom Right",outside:"Outside"},number_or_dynamic_value:{type:{static:"Static",dynamic:"Dynamic"},dynamic:{setup:"Setup",setup_title:"Setup dynamic value",guide:"Dyanmic by a custom function"}},orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"},symbol_size:{label:"Symbol Size",static:"Static",dynamic:"Dynamic",setup:{label:"Setup",title:"Setup dynamic size",description:"Dynamic by a custom function"}},series:{label:"Series",name:"Name",y_axis:"Y Axis",data_field:"Data Field",delete:"Delete this series",line:{label:"Line",line_settings:"Line Settings",line_style:"Line Style",type:{label:"Line Type",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},line_width:"Line Width",step:{label:"Step",off:"Off",start:"Start",middle:"Middle",end:"End"},smooth_line:"Smooth Line",show_name_on_line:"Display Name on Line",show_symbol_on_line:"Show Symbol on Line"},bar:{label:"Bar",stack:"Stack",stack_hint:"Stack bars by this ID",bar_gap:{label:"Bar Gap",no_gap:"No gap between bars",overlap:"Bars overlapping on each other"},bar_width:{min:"Bar Width(min)",exact:"Bar Width",max:"Bar Width(max)"}},scatter:{label:"Scatter"},group_by:{label:"Split into multiple seires by this field...",label_line:"Split into multiple lines by this field..."}},axis:{tick_label:"Tick Label",customize_label:"Customize Label",overflow:{label:"Overflow",max_width:"Max Width",truncate:"Truncate",break_line:"Break Line",break_word:"Break Word",ellipsis:"Ellipsis",section_title:{on_axis:"Overflow on Axis",in_tooltip:"Overflow in Tooltip"}},section_title:{label_format:"Label Format"},type:{value:"Value",category:"Category",time:"Time",log:"Log",click_to_learn_more:"Click <1>here</1> to learn more about these options"}},name_text:{align:{label:"Name Anchor",left:"Left",center:"Center",right:"Right"}},rotate:"Rotate",degree:"degree",padding:"Padding",content_template:{label:"Content Template",hint:"Average: ${avg}"},x_axis:{label:"X Axis",labels:"X Axes",label_format:"Label Format",delete:"Delete this XAxis",x_axis_name:"X Axis Name",x_axis_data_field:"X Axis Data Field",x_axis_type:"X Axis Type",layout:"Layout",position:{label:"Position",top:"Top",bottom:"Bottom"},value_range:"Value Range",value_min:"Min",value_max:"Max",behavior:"Behavior",visible:"Visible"},y_axis:{label:"Y Axis",labels:"Y Axes",label_format:"Label Format",delete:"Delete this YAxis",y_axis_name:"Y Axis Name",y_axis_name_anchor:"Name Anchor",y_axis_data_field:"Y Axis Data Field",layout:"Layout",position:{label:"Position",left:"Left",right:"Right"},value_range:"Value Range",value_min:"Min",value_max:"Max",behavior:"Behavior",visible:"Visible"},stats:{label:"Stats",template:{above_chart:"Template for stats above the chart",under_chart:"Template for stats under the chart"}},legend:{label:"Legend",show_legend:"Show Legend",show_in_legend:"Show in legend",hide_in_legend:"Hide in legend",orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"}},tooltip:{label:"Tooltip",additional_metrics:{description:"Set additional metrics to show in scatter's tooltip",delete:"Delete this Metric"},trigger:{label:"Trigger",scatter_point:"Scatter Point",x_axis:"X Axis"}},style:{label:"Style"},color:{label:"Color",or:"or",set_any_color:"Set any color",pick_a_theme_color:"Pick a theme color",background_color:"Background Color",text_color:"Text Color"},behavior:{label:"Behavior",invisible:"Invisible"},heatmap:{heatblock:{label:"Heat Block",min_value:"Min Value",max_value:"Max Value",show_label:"Show Label"}},reference_line:{label:"Reference Line",labels:"Reference Lines",add:"Add a reference line",name_placeholder:"Average Reference Line",delete:"Remove this Reference Line",orientation:{vertical_hint:"Works only when xAxis values are numbers"}},regression_line:{label:"Regression Line",labels:"Regression Lines",add:"Add a line",delete:"Delete this line",method:{label:"Method",linear:"Linear",exponential:"Exponential",logistic:"Logistic",polynomial:"Polynomial",polynomial_order:"Order"}},reference_area:{label:"Reference Area",labels:"Reference Areas",add:"Add a reference area",delete:"Remove this reference area",type:{label:"Type",rectangle:"Rectangle"},direction:{label:"Direction",horizontal:"Horizontal"},boundary:{upper:"Upper Boundary",lower:"Lower Boundary"},content:{label:"Content",content_text:"Content Text",text_position:"Text Position"},endpoint:{labels:"Endpoints",left_bottom_point:"Left-Bottom Point",right_top_point:"Right-Top Point"}},zooming:{label:"Zooming",scroll:{label:"Scroll to zoom",x_axis:"Enable on X Axis",y_axis:"Enable on Y Axis"},slider:{label:"Slider for zooming",x_axis:"Slider for X Axis",y_axis:"Slider for Y Axis",y_axis_disabled:"Not available for now, will overlap y-axis's label"}}},viz:{viz_config_banner:"Visualization Settings"},validation:{number:{require_a_number:"A number is required"}}}},xD={translation:{filter:{label:"筛选器",labels:"筛选器",add:"新增筛选器",manage:"管理筛选器",show_filters:"展开筛选器",hide_filters:"收起筛选器",field:{widget:"控件",visible_in:"在...视图中可见",key_placeholder:"用于引用此筛选器,需保持唯一",label_placeholder:"用于展示的标签文案",auto_submit:"自动提交",order:"排列次序",custom_default_value:{trigger:"自定义",title:"自定义默认值",tips:"提示",tip_1:"在指定筛选器默认值这事上,自定义函数具备最高优先级",tip_2:"清空下方编辑器来禁用本功能"}},widget:{names:{select:"单选",multi_select:"多选",tree_select:"树形选择器",text_input:"文本框",checkbox:"勾选框",date_range:"日期范围"},common:{use_query_data_as_options:"使用所查数据为选项",fetch_options_from_datasource:"从数据源查选项",or_fetch_options_from_datasource:"或从数据源查选项",selector_option_empty:"无选项可用",see_data_structure:"点击查看期望的数据格式",using_query:"在用查询获取选项",default_selection_count:"默认选中前N项",min_width:"控件最小宽度",x_selected:"已选数:{{count}}"},text_input:{default_value:"默认值",required:"必填"},select:{width:"控件宽度",required:"必选",clearable:"可取消选择",configure_options:"配置选项",default_selection:"默认选项",no_default_selection:"无",select_first_option_by_default:"默认选中第一个选项"},multi_select:{width_description:"至少160px"},tree_select:{strictly:"枝叶节点不相关,各选各的"},checkbox:{description:"描述信息",default_checked:"默认勾选"},date_range:{required:"必选",allow_single_date:"允许选一天作为范围",display_format:"展示格式",max_days:"最大选择天数",one_day:"1天",x_days:"{{count}}天",x_max_days:"最多可选{{max_days}}天",default_value:"默认日期范围(具体)",default_by_shortcut:"默认日期范围(快捷方式)",defualt_by_shortcut_placeholder:"优先于左侧",start_date:"开始日期",end_date:"结束日期",shortcut:{last:{label:"过往整周期",d:"昨天",w:"周",m:"月",m2:"两个月",m3:"三个月",y:"年",full:{d:"昨天",w:"上周",m:"上个月",m2:"上两月",m3:"上三月",y:"去年"}},recent:{label:"最近",d7:"7天",d30:"30天",d60:"60天",d90:"90天",d180:"180天",d365:"365天",full:{d7:"近7天",d30:"近30天",d60:"近60天",d90:"近90天",d180:"近180天",d365:"近365天"}},this:{label:"当前整周期",d:"今天",w:"周",m:"月",y:"年",full:{d:"今天",w:"本周",m:"本月",y:"今年"}},this_so_far:{label:"至今",w:"周",m:"月",y:"年",full:{w:"本周至今",m:"本月至今",y:"本年至今"}}}}}},view:{label:"视图",labels:"视图",add:"新增视图",delete:"删除此视图",download_schema:"下载此视图描述文件",component:{div:{label:"内容"},tabs:{label:"标签页",tabs_settings:"标签页设置",tab:{name:"名称",view:"内容视图",order:"排列次序",color:"颜色",delete:"删除这个标签页",switch_to_view:"打开视图: {{name}}"}},modal:{label:"弹窗",modal_settings:"弹窗设置",title:"弹窗标题",custom_title:"自定义弹窗标题",width:"宽度",height:"高度"}}},interactions:{label:"交互",add:"新增交互",interactions_viewer:"纵览交互",unavailable:"不可用",unavailable_reason:"此可视化组件没有交互功能",trigger:{setup:"设置触发动作",label:"触发动作",payload:"触发时的参数"},operation:{setup:"操作设置",label:"操作",settings:"设置",variables:"变量",console_log:{label:"console.log | 调试用",log_content:"打印内容"},open_link:{label:"打开链接",url:"URL",open_in_new_tab:"在新标签页中打开"},open_view:{label:"唤出视图",view:"视图"},set_filter_values:{label:"设置筛选器值",set_filter:"将筛选器的值",with:"设为"},clear_filter_values:{label:"清除筛选器值",select_filter:"选择筛选器以清除其值"}}},query_variable:{label:"查询变量",labels:"查询变量",add:"新增变量",guide:{tabs:{guide:"使用指南",variables_in_this_dashboard:"本看板中的查询变量",global_sql_snippets:"全局SQL片段"}},open:"查看查询变量"},sql_snippet:{label:"SQL片段",labels:"SQL片段",add:"新增SQL片段",delete:"删除这个SQL片段",delete_unused:"删除未用到的SQL片段",manage:"管理SQL片段",key:"键",key_occupied:"此键已被其他SQL片段占用",edit_snippet:"编辑SQL片段",preview_snippet:"预览SQL片段",usage:{label:"使用情况"}},global_sql_snippet:{label:"全局SQL片段",labels:"全局SQL片段",description:"管理员负责在系统设置中维护全局SQL片段"},common:{titles:{settings:"设置",edit:"编辑",config:"配置"},pagination:{page_size:"页容量",total:"共",total_rows:"共 {{total}} 行"},align:{horizontal:{label:"水平对齐",left:"居左",center:"居中",right:"居右"},vertical:{label:"垂直对齐",left:"居上",center:"居中",right:"居下"}},id:"ID",name:"名称",key:"键",label:"标签",value:"值",type:"类型",info:"信息",min:"最小值",max:"最大值",data_field:"数据字段",name_data_field:"名称字段",value_data_field:"值字段",color_data_field:"颜色字段",enabled:"启用",copied:"已复制到剪切板",action:"操作",actions:{open:"打开",close:"关闭",save:"保存",save_changes:"保存改动",revert:"还原",revert_changes:"还原改动",reset_to_default:"重置为初始值",select_all:"全选",clear_selection:"撤销选择",refresh:"刷新",download_data:"下载数据",download_schema:"下载描述文件",download_screenshot:"下载截图",enter_fullscreen:"全屏",duplicate:"复制",delete:"删除",cancel:"取消",confirm:"确认",add_an_option:"新增选项",edit:"编辑",end_editing:"结束编辑 <1>{{name}}</1>"},tabs:{variant:{label:"风格",default:"默认",outline:"轮廓",pills:"胶囊"},orientation:{label:"朝向",horizontal:"水平",vertical:"垂直"},grow_tabs:"拉伸标签卡宽度"},choose_a_tab_first:"请先选择一个标签页"},breakpoint:{label_one:"屏幕尺寸",label_other:"屏幕尺寸",add:"新增屏幕尺寸",manage:"管理屏幕尺寸",breakpoint:"最小宽度"},context:{label:"上下文"},mock_context:{label:"模拟上下文",hint:"内容格式为JSON"},panel:{label:"卡片",labels:"卡片",add:"新增卡片",delete:"删除这个卡片",panel_name:"卡片名",panel_description:"卡片描述",panel_description_click:"点击查看卡片描述",show_title:"展示卡片标题",use_name_as_title:"使用卡片名作为标题",settings:{change_view:"移至另一个视图下",change_view_title:"移动此卡片至另一个视图下",choose_queries:"关联查询"},style:{label:"样式",width:"宽",width_postfix:"之 36 栏",height:"高",height_postfix:"px",border:"边框"},variable:{label:"变量",labels:"变量",add:"新增变量",delete:"删除此变量",aggregation:{label:"聚合",fallback_value:"兜底值",fallback_value_description:"当数据为空或聚合结果非数字时,使用此兜底值"}}},style:{label:"样式",font_size:{label:"字号",placeholder:"10px, 1em, 1rem, 100%..."},font_weight:{label:"字重"},size:{xs:"特小",sm:"小",md:"中",lg:"大",xl:"特大"},flex:{justify_content:{label:"内容分布",left:"从左起",center:"居中",right:"从右起",space_between:"均匀分布,首尾顶格",space_around:"均匀分布,首尾留空一半",space_evenly:"均匀分布,首尾留空"},align_items:{label:"对齐位置",start:"起点对齐",center:"居中对齐",end:"末端对齐",stretch:"拉伸对齐"}},color:{type:{label:"颜色类型",static:"单色",interpolation:"插值取色",none:"无"},interpolation:{setup:"设置取色方案",palette:{label:"色板",category:{sequential:"单色渐变",diverging:"双色渐变"},red_green:"红 / 绿",yellow_blue:"黄 / 蓝",red:"红",green:"绿",blue:"蓝",orange:"橙",mapping:{value_input_label:"映射一个值到此颜色"}}}}},query:{label:"查询",labels:"查询",add:"新增查询",delete:"删除这个查询",cant_delete:"此查询在使用中,不能删除。请查看“使用情况”标签页以了解详情",delete_unused:"删除未用到的查询",name:"名称",name_description:"唯一名称",manage:"管理查询",open:"打开此查询",configurations:"配置",basics:"基本信息",conditions:"条件",run_by_condition:{label:"以下条件满足时,才运行本查询",unset:"看板加载时便运行本查询"},re_run_condition:{label:"当以下条件改变时,重新运行此查询",unset:"留空则永不重新运行此查询"},dependency:{label:"依赖",has_none:"此查询无依赖"},edit_sql:"编辑SQL",preview_sql:"预览SQL",request:"请求",build_request:"构造请求",process_request:"加工请求",process_result:"加工结果",usage:{label:"使用情况",in_views:"所在视图",unused_description:"此查询未被任何筛选器或卡片用到"},transform:{label:"查询变形",data_source:"基于其他查询的数据,加工出新数据",guide:{pick_queries:"选择一至多个查询作为数据输入",write_function:"编写函数,返回新数据"}}},data:{label:"数据",preview_data:"预览数据",empty_data:"无数据"},data_source:{label:"数据源",explore:"查看数据源",explorer:"数据源查看器",table_structure:"数据表结构",table_structure_short:"表结构",see_table_structure:"查看数据表结构"},visualization:{label:"可视化",component:"可视化组件",label_short:"可视化"},numbro:{format:{label:"格式",absolute:"绝对值",absolute_description:"非负",abbreviation:"缩写",abbreviation_description:"如1.23k、1.23m",mantissa:"小数",trim_mantissa:"抹零",trim_mantissa_description:"省略末尾的零",preview:{open:"展开预览",close:"收起预览",input:"输入",output:"输出"}}},import:{label:"导入...",title:"自描述文件导入看板内容",json_file:"描述文件(JSON格式)",this_dashboard:"此看板",this_file:"此文件"},function_utils:{trigger_text:"关于utils参数",modal_title:"关于utils参数",description:"参数 <code>utils</code> 是 <code>FunctionUtils</code>,包含以下内容:",document:"文档"},aggregation:{option:{none:"无",sum:"和",mean:"平均值",median:"中位数",min:"最小值",max:"最大值",cov:"变异系数",std:"标准差",quantile:{label:"分位",label_with_hint:"分位(99%, 95%, ...)"},custom:{label:"自定义",label_trigger:"编写函数",title:"自定义聚合方式"}}},chart:{chart_config:"图表设置",data_field:"数据字段",groups:{merico_suite:"思码逸套件",echarts_based_charts:"基于ECharts的图表",others:"其他"},label:{label:"文案",label_full:"标签文案",label_style:"标签文案样式",label_format:"标签文案格式"},label_position:{label:"文案位置",off:"不显示文案",top:"上",left:"左",right:"右",bottom:"下",inside:"内",inside_top:"内-上",inside_left:"内-左",inside_center:"内-中",inside_right:"内-右",inside_bottom:"内-下",inside_top_left:"内-上-左",inside_top_right:"内-上-右",inside_bottom_left:"内-下-左",inside_bottom_right:"内-下-右",outside:"外"},number_or_dynamic_value:{type:{static:"具体值",dynamic:"动态值"},dynamic:{setup:"设置",setup_title:"设置动态值",guide:"由函数确定动态值"}},orientation:{label:"朝向",horizontal:"水平",vertical:"垂直"},symbol_size:{label:"标记点大小",static:"固定值",dynamic:"动态值",setup:{label:"设置",title:"设置动态值",description:"由函数确定动态值"}},series:{label:"系列",name:"名称",y_axis:"Y轴",data_field:"数据字段",delete:"删除这个系列",line:{label:"线",line_settings:"线段设置",line_style:"线条样式",type:{label:"类型",solid:"实线",dashed:"方虚线",dotted:"圆点虚线"},line_width:"线宽",step:{label:"阶梯状",off:"不启用",start:"在当前点拐弯",middle:"在当前点与下个点中间拐弯",end:"在下个点拐弯"},smooth_line:"平滑曲线",show_name_on_line:"显示标签文案",show_symbol_on_line:"显示标记点"},bar:{label:"柱",stack:"堆放",stack_hint:"此值相同的柱系列会堆叠在一起",bar_gap:{label:"柱间隔",no_gap:"柱子之间无间隔",overlap:"柱子可互相重叠"},bar_width:{min:"最大柱宽",exact:"柱宽",max:"最大柱宽"}},scatter:{label:"散点"},group_by:{label:"按此字段拆分为多个系列",label_line:"按此字段拆分为多条线"}},axis:{tick_label:"刻度文案",customize_label:"自定义文案",overflow:{label:"溢出",max_width:"最大宽度",truncate:"截断",break_line:"换行",break_word:"断词换行",ellipsis:"省略符",section_title:{on_axis:"轴刻度上文案的溢出",in_tooltip:"提示框中的文案溢出"}},section_title:{label_format:"文案格式"},type:{value:"数值轴",category:"类目轴",time:"时间轴",log:"对数轴",click_to_learn_more:"点击 <1>这里</1> 以进一步了解这些选项"}},name_text:{align:{label:"名称贴靠侧",left:"左",center:"中",right:"右"}},rotate:"旋转",degree:"度",padding:"内间距",content_template:{label:"内容模板",hint:"均值: ${avg}"},x_axis:{label:"X轴",labels:"X轴",label_format:"刻度文案格式",delete:"删除这个X轴",x_axis_name:"X轴名称",x_axis_data_field:"X轴数据字段",x_axis_type:"X轴类型",layout:"布局",position:{label:"位置",top:"上",bottom:"下"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见"},y_axis:{label:"Y轴",labels:"Y轴",label_format:"刻度文案格式",delete:"删除这个Y轴",y_axis_name:"Y轴名称",y_axis_name_anchor:"名称贴靠侧",y_axis_data_field:"Y轴数据字段",layout:"布局",position:{label:"位置",left:"左",right:"右"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见"},stats:{label:"统计内容",template:{above_chart:"统计内容模板(图表上方)",under_chart:"统计内容模板(图表下方)"}},legend:{label:"图例",show_legend:"显示图例",show_in_legend:"显示在图例中",hide_in_legend:"不显示在图例中",orientation:{label:"布局朝向",horizontal:"横向",vertical:"纵向"}},tooltip:{label:"提示框",additional_metrics:{description:"在此设置更多指标,来展示在散点的提示框",delete:"删除这个指标"},trigger:{label:"触发者",scatter_point:"散点",x_axis:"X轴"}},style:{label:"样式"},color:{label:"颜色",or:"或",set_any_color:"输入色号",pick_a_theme_color:"选择一个主题色",background_color:"背景色",text_color:"文字颜色"},behavior:{label:"表现",invisible:"隐藏不可见"},heatmap:{heatblock:{label:"热力块",min_value:"最小值",max_value:"最大值",show_label:"展示值文案"}},reference_line:{label:"参考线",labels:"参考线",add:"增加一条参考线",name_placeholder:"均值参考线",delete:"删除这条参考线",orientation:{vertical_hint:"仅当X轴值为数字时可绘制"}},regression_line:{label:"回归线",labels:"回归线",add:"增加一条回归线",delete:"删除这条回归线",method:{label:"方法",linear:"线性回归",exponential:"指数回归",logistic:"指数回归",polynomial:"多项式回归",polynomial_order:"次"}},reference_area:{label:"参考区域",labels:"参考区域",add:"增加一面参考区域",delete:"删除这面参考区域",type:{label:"形状",rectangle:"矩形"},direction:{label:"方向",horizontal:"水平"},boundary:{upper:"上边界",lower:"下边界"},content:{label:"内容",content_text:"内容文字",text_position:"文字位置"},endpoint:{labels:"端点",left_bottom_point:"左下点",right_top_point:"右上点"}},zooming:{label:"缩放",scroll:{label:"滚轮缩放",x_axis:"对X轴启用",y_axis:"对Y轴启用"},slider:{label:"滚动条缩放",x_axis:"对X轴启用",y_axis:"对Y轴启用",y_axis_disabled:"暂不可用,会与Y轴刻度文字重叠"}}},viz:{viz_config_banner:"可视化参数配置"},validation:{number:{require_a_number:"请填写一个数字"}}}};ia.use(Zu).use(j.initReactI18next).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:hD,zh:xD}}),ol.forEach(t=>{var e;(e=t.translation)==null||e.forEach(n=>{ia.addResourceBundle(n.lang,"translation",{viz:n.resources},!0,!0)})});const gD=()=>Promise.resolve().then(()=>Rd).then(({version:t})=>(console.log(`[@devtable/dashboard] version: ${t}`),t));_.APIClient=He,_.CURRENT_SCHEMA_VERSION=pt,_.ContentModel=mi,_.ContentModelContextProvider=Es,_.ContentRenderModel=ki,_.ContextMeta=as,_.DEFAULT_CUSTOM_MODAL_TITLE=is,_.DashboardApiClient=ca,_.DashboardApiFacadeClient=ua,_.DashboardEditor=uD,_.DashboardFilterType=pe,_.DashboardMode=cc,_.DashboardModel=bc,_.DashboardModelContextProvider=zs,_.DashboardRenderModel=Fc,_.DashboardThemeContextProvider=Is,_.DashboardViewEditor=lc,_.DashboardViewRender=ls,_.DataSourceMetaModel=Zr,_.DataSourceType=le,_.DataSourcesMetaModel=Al,_.DatesProvider=$s,_.DefaultApiClient=la,_.DescriptionPopover=di,_.DraftModel=Yl,_.EViewComponentType=L,_.FacadeApiClient=ud,_.FilterCheckboxConfigMeta=Vr,_.FilterDateRangeConfigMeta=Nr,_.FilterMeta=Ur,_.FilterMultiSelectConfigMeta=Gr,_.FilterSelectConfigMeta=Wr,_.FilterTextInputConfigMeta=Qr,_.FilterTreeSelectConfigMeta=Yr,_.FiltersModel=dc,_.FiltersRenderModel=ii,_.FullScreenPanel=sc,_.FullScreenPanelContext=Ps,_.GlobalSQLSnippetMeta=Pl,_.GlobalSQLSnippetsMeta=Hr,_.LayoutItemMeta=vl,_.LayoutSetMeta=jl,_.LayoutStateContext=Mn,_.LayoutsRenderModel=ci,_.MockContextMeta=qr,_.MuteQueryModel=Fl,_.Panel=nc,_.PanelContextProvider=As,_.PanelErrorOrStateMessage=ec,_.PanelMeta=yl,_.PanelModel=gc,_.PanelRender=hi,_.PanelRenderModel=si,_.PanelStyleMeta=xl,_.PanelTitleMeta=gl,_.PanelVizMeta=fl,_.PanelVizSection=pi,_.PanelsModel=mc,_.PanelsRenderModel=ri,_.QueriesModel=hc,_.QueriesRenderModel=li,_.QueryMeta=bl,_.QueryModel=pc,_.QueryRenderModel=oi,_.ReadOnlyDashboard=pD,_.SQLSnippetMeta=_l,_.SQLSnippetRenderModel=Ql,_.SQLSnippetsModel=xc,_.SQLSnippetsRenderModel=ui,_.VariableMeta=ml,_.ViewComponentTypeBackground=uc,_.ViewComponentTypeColor=PS,_.ViewComponentTypeName=AS,_.ViewDivisionConfig=Kr,_.ViewMeta=El,_.ViewModalConfig=Jr,_.ViewRenderModel=ti,_.ViewTabsConfig=Xr,_.ViewsModel=fc,_.ViewsRenderModel=ni,_.Viz=Hl,_.applyPartialDashboard=YS,_.configureAPIClient=js,_.createContentModel=yc,_.createContentRenderModel=Nc,_.createContextMeta=ei,_.createDashboardModel=vc,_.createDashboardRenderModel=Gc,_.createDraft=Ul,_.createFilterCheckboxConfig=wl,_.createFilterDateRangeConfig=Sl,_.createFilterMultiSelectConfig=kl,_.createFilterSelectConfig=Tl,_.createFilterTextInputConfig=Rr,_.createFilterTreeSelectConfig=Dl,_.createViewDivisionConfig=zl,_.createViewModalConfig=Ml,_.createViewTabsConfig=Il,_.facadeApiClient=da,_.formatSQLSnippet=mn,_.getInitialDashboardViewsModel=gi,_.getInitialFiltersConfig=ai,_.getInitialMockContextMeta=Or,_.getInitialQueriesRenderModel=Gl,_.getInitialSQLSnippetsRenderModel=Rl,_.getInitialViewsRenderModel=$l,_.getNewPanel=ql,_.getVersion=gD,_.initialDashboardContent=XC,_.useDashboardContext=Ms,_.useDashboardThemeContext=Sa,_.useEditContentModelContext=Q,_.useEditDashboardContext=X,_.useEditPanelContext=qe,_.useFullScreenPanelContext=Ma,_.usePanelFullScreen=rc,_.useRenderContentModelContext=ue,_.useRenderDashboardContext=wa,_.useRenderPanelContext=vt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
482
|
+
`),post:""},b1=S.observer(({queryModel:t})=>{const{t:e}=j.useTranslation(),n=Q();return t.isTransform?s.jsxs(a.Stack,{py:20,px:20,sx:{height:"100%"},children:[s.jsx(a.Text,{size:"sm",children:e("query.transform.guide.pick_queries")}),s.jsx(a.MultiSelect,{data:n.queries.optionsWithoutTransform,value:[...t.dep_query_ids],onChange:t.setDependantQueryIDs,maxDropdownHeight:800}),s.jsx(a.Text,{size:"sm",children:e("query.transform.guide.write_function")}),s.jsx(a.Box,{sx:{flexGrow:1},children:s.jsx(Ft,{label:"",value:t.pre_process,onChange:t.setPreProcess,defaultValue:y1.pre})})]}):null}),yn={height:"calc(100% - 44px)",padding:0},v1=S.observer(({queryModel:t})=>{const{t:e}=j.useTranslation(),n=Q(),r=g.useMemo(()=>t.datasource?t.typedAsHTTP?"HTTP":"SQL":"Configurations",[t.datasource,t.typedAsHTTP]),[i,o]=g.useState(r);g.useEffect(()=>{o(u=>u!=="Configurations"&&r==="Configurations"?"Configurations":u)},[r]);const l=n.findQueryUsage(t.id),c=l.length===0;return s.jsxs(a.Tabs,{value:i,onTabChange:o,defaultValue:r,orientation:"horizontal",keepMounted:!1,sx:{height:"100vh"},children:[s.jsxs(a.Tabs.List,{grow:!0,children:[s.jsx(a.Tabs.Tab,{value:"Configurations",children:e("query.configurations")}),t.typedAsSQL&&s.jsx(a.Tabs.Tab,{value:"SQL",children:e("query.request")}),t.typedAsHTTP&&s.jsx(a.Tabs.Tab,{value:"HTTP",children:e("query.request")}),t.isTransform&&s.jsx(a.Tabs.Tab,{value:"Transform",children:e("query.transform.label")}),s.jsx(a.Tabs.Tab,{value:"Data",disabled:!t.canPreviewData,children:s.jsx(a.Tooltip,{label:t.guideToPreviewData,disabled:t.canPreviewData,withinPortal:!0,children:s.jsx(a.Text,{children:e("data.preview_data")})})}),s.jsx(a.Tabs.Tab,{value:"Usage",disabled:c,children:s.jsx(a.Tooltip,{label:e("query.usage.unused_description"),disabled:!c,withinPortal:!0,children:s.jsx(a.Text,{children:e("query.usage.label")})})})]}),s.jsx(a.Tabs.Panel,{value:"Configurations",pt:0,p:0,children:s.jsx(a1,{queryModel:t})}),t.typedAsSQL&&s.jsx(a.Tabs.Panel,{value:"SQL",sx:yn,children:s.jsx(a.Stack,{sx:{height:"100%"},children:s.jsx(f1,{queryModel:t})})}),t.typedAsHTTP&&s.jsx(a.Tabs.Panel,{value:"HTTP",sx:yn,children:s.jsx(a.Stack,{sx:{height:"100%"},children:s.jsx(u1,{queryModel:t})})}),t.isTransform&&s.jsx(a.Tabs.Panel,{value:"Transform",sx:yn,children:s.jsx(a.Stack,{sx:{height:"100%"},children:s.jsx(b1,{queryModel:t})})}),s.jsx(a.Tabs.Panel,{value:"Data",sx:{...yn,overflow:"hidden"},children:s.jsx(ji,{id:t.id,moreActions:null,refreshOnMount:!0})}),s.jsx(a.Tabs.Panel,{value:"Usage",sx:{...yn,overflow:"hidden"},children:s.jsx(d1,{queryID:t.id,usage:l})})]})}),j1=S.observer(({id:t})=>{const n=Q().queries.findByID(t);return t===""?null:n?s.jsx(v1,{queryModel:n}):s.jsx(a.Text,{size:14,color:"red",children:"Invalid Query ID"})}),_1=S.observer(({value:t})=>{const n=ue().payloadForSQL,r=g.useMemo(()=>vs(t,n),[t,n]);return s.jsx(Si,{height:"100%",value:r})}),w1=S.observer(({item:t,remove:e,onKeyChanged:n})=>{const{t:r}=j.useTranslation(),[i,o]=g.useState("SQL"),[l,c]=g.useState(t.key),u=()=>{t.setKey(l),n(l)},d=l!==t.key,p=t.isADuplicatedKey(l),[h,x]=g.useState(t.value),m=()=>{t.setValue(h)};g.useEffect(()=>{c(t.key),x(t.value)},[t]);const v=h!==t.value,C=Le.useModals(),k=()=>{C.openConfirmModal({title:`${r("sql_snippet.delete")}?`,labels:{confirm:r("common.actions.confirm"),cancel:r("common.actions.cancel")},onCancel:()=>console.log("Cancel"),onConfirm:e,confirmProps:{color:"red"},zIndex:320})};return s.jsxs(a.Stack,{p:20,sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",children:[s.jsxs(a.Group,{sx:{alignItems:"end"},spacing:40,children:[s.jsx(a.TextInput,{label:r(p?"sql_snippet.key_occupied":"sql_snippet.key"),value:l,onChange:D=>{c(D.currentTarget.value)},sx:{flexGrow:"1 !important"},rightSection:s.jsx(a.ActionIcon,{color:"blue",variant:"subtle",onClick:u,disabled:!d||p,children:s.jsx(z.DeviceFloppy,{size:16})}),error:p}),s.jsx(a.Button,{leftIcon:s.jsx(z.Trash,{size:16}),color:"red",variant:"light",onClick:k,children:r("sql_snippet.delete")})]}),s.jsxs(a.Tabs,{value:i,onTabChange:o,sx:{flexGrow:1},styles:{panel:{height:"calc(100% - 50px)"}},children:[s.jsxs(a.Tabs.List,{sx:{position:"relative"},children:[s.jsx(a.Tabs.Tab,{value:"SQL",children:r("sql_snippet.edit_snippet")}),s.jsx(a.Tabs.Tab,{value:"Preview",children:r("sql_snippet.preview_snippet")}),s.jsx(Ci,{}),s.jsx(a.ActionIcon,{color:"blue",variant:"filled",onClick:m,disabled:!v,sx:{position:"absolute",top:0,right:10},children:s.jsx(z.DeviceFloppy,{size:18})})]}),s.jsx(a.Tabs.Panel,{value:"SQL",pt:"sm",children:s.jsx(Si,{height:"100%",value:h,onChange:x,defaultLanguage:"sql",theme:"sql-dark"})}),s.jsx(a.Tabs.Panel,{value:"Preview",pt:"sm",children:s.jsx(_1,{value:h})})]})]})}),C1=S.observer(({id:t})=>{const e=X(),n=Q(),r=g.useMemo(()=>n.sqlSnippets.findByKey(t),[t]);if(!t)return null;if(!r)return s.jsxs(a.Text,{size:14,children:["SQL Snippet by key[",t,"] is not found"]});const i=()=>{e.editor.setPath(["_SQL_SNIPPETS_",""])},o=()=>{n.sqlSnippets.removeByKey(t),i()},l=c=>{e.editor.setPath(["_SQL_SNIPPETS_",c])};return s.jsx(w1,{item:r,remove:o,onKeyChanged:l})}),S1=S.observer(()=>{const{t}=j.useTranslation(),[e,n]=g.useState([]),r=Le.useModals(),i=X(),o=x=>{i.editor.setPath(["_SQL_SNIPPETS_",x])},l=()=>{r.openConfirmModal({title:"Delete ununsed SQL snippets?",children:s.jsx(a.Text,{size:"sm",children:"This action cannot be undone."}),labels:{confirm:t("common.actions.confirm"),cancel:t("common.actions.cancel")},onCancel:()=>console.log("Cancel"),onConfirm:()=>i.content.removeUnusedSQLSnippets(),confirmProps:{color:"red"},zIndex:320})},c=()=>{i.content.sqlSnippets.downloadSchema(e)},u=g.useMemo(()=>i.content.sqlSnippets.sortedList.map(x=>x.key),[i.content.sqlSnippets.sortedList]),d=()=>{n(u)},p=()=>{n([])},h=i.content.sqlSnippetsUsage;return s.jsxs(a.Stack,{sx:{height:"100%"},spacing:"sm",pb:"59px",children:[s.jsx(a.Box,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:s.jsx(a.Text,{px:"md",align:"left",sx:{userSelect:"none",cursor:"default"},children:t("sql_snippet.manage")})}),s.jsxs(a.Flex,{justify:"space-between",align:"center",px:12,children:[s.jsxs(a.Group,{position:"left",children:[s.jsxs(a.Button.Group,{children:[s.jsx(a.Button,{variant:"default",size:"xs",onClick:d,children:t("common.actions.select_all")}),s.jsx(a.Button,{variant:"default",size:"xs",onClick:p,children:t("common.actions.clear_selection")})]}),s.jsx(a.Button,{size:"xs",color:"blue",leftIcon:s.jsx(T.IconCode,{size:14}),disabled:e.length===0,onClick:c,children:t("common.actions.download_schema")})]}),s.jsx(a.Button,{variant:"subtle",size:"xs",color:"red",leftIcon:s.jsx(T.IconTrash,{size:14}),disabled:!i.content.hasUnusedSQLSnippets,onClick:l,children:t("sql_snippet.delete_unused")})]}),s.jsx(a.Box,{sx:{flexGrow:1,overflow:"auto"},children:s.jsx(a.Checkbox.Group,{size:"xs",value:e,onChange:n,children:s.jsxs(a.Table,{fontSize:"sm",highlightOnHover:!0,sx:{tableLayout:"fixed"},children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{style:{width:"40px"}}),s.jsx("th",{children:t("common.key")}),s.jsx("th",{style:{width:"100px",textAlign:"center"},children:t("sql_snippet.usage.label")}),s.jsx("th",{style:{width:"300px",paddingLeft:"24px"},children:t("common.action")})]})}),s.jsx("tbody",{children:i.content.sqlSnippets.sortedList.map(x=>{var v;const m=((v=h[x.key])==null?void 0:v.length)??0;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(a.Checkbox,{value:x.key,styles:{input:{cursor:"pointer"}}})}),s.jsx("td",{children:x.key}),s.jsx("td",{style:{color:m===0?"#ff0000":"#000",fontWeight:m===0?"bold":"normal",textAlign:"center"},children:m}),s.jsx("td",{children:s.jsx(a.Button,{variant:"subtle",size:"xs",onClick:()=>o(x.key),children:t("common.actions.open")})})]},x.key)})})]})})})]})}),k1=S.observer(({view:t})=>!t||t.type!==L.Division?null:s.jsx(a.Stack,{})),T1=S.observer(({view:t})=>{const{t:e,i18n:n}=j.useTranslation(),r=g.useMemo(()=>[{value:"default",label:e("common.tabs.variant.default")},{value:"outline",label:e("common.tabs.variant.outline")},{value:"pills",label:e("common.tabs.variant.pills")}],[n.language]),i=g.useMemo(()=>[{value:"horizontal",label:e("common.tabs.orientation.horizontal")},{value:"vertical",label:e("common.tabs.orientation.vertical")}],[n.language]);if(!t||t.type!==L.Tabs)return null;const o=t.config;return s.jsxs(a.Stack,{children:[s.jsx(a.Divider,{mt:8,mb:0,label:e("view.component.tabs.tabs_settings"),labelPosition:"center"}),s.jsx(a.Select,{label:e("common.tabs.variant.label"),value:o.variant,onChange:o.setVariant,data:r}),s.jsx(a.Select,{label:e("common.tabs.orientation.label"),value:o.orientation,onChange:o.setOrientation,data:i}),s.jsx(a.Switch,{label:e("common.tabs.grow_tabs"),checked:o.grow,onChange:l=>o.setGrow(l.currentTarget.checked)})]})}),D1=({disabled:t,value:e,onChange:n})=>{const r=i=>{i&&n(i)};return s.jsxs(a.Box,{sx:{position:"relative"},children:[t&&s.jsx(a.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),s.jsx(Ae,{height:"500px",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:t}})]})},z1=({value:t,onChange:e})=>{const{t:n}=j.useTranslation(),[r,{setTrue:i,setFalse:o}]=N.useBoolean(),[l,c]=g.useState(t??is),u=m=>{c({...l,enabled:m})},d=()=>{o();const{enabled:m,func_content:v}=l,C={enabled:m,func_content:v};c(C),e(C)},p=()=>{o(),c(t)},h=m=>{c(v=>({...v,func_content:m}))},x=()=>{h(is.func_content)};return s.jsxs(s.Fragment,{children:[s.jsx(a.ActionIcon,{size:"lg",color:"blue",variant:"filled",mt:26,onClick:i,sx:{flexGrow:0},children:s.jsx(z.Settings,{size:14})}),s.jsx(a.Modal,{size:800,title:n("view.component.modal.custom_title"),opened:r,onClose:o,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:r&&s.jsxs(a.Stack,{children:[s.jsx(a.Checkbox,{mt:10,label:n("common.enabled"),checked:l.enabled,onChange:m=>u(m.currentTarget.checked)}),s.jsx(D1,{value:l.func_content,onChange:h,disabled:!l.enabled}),s.jsxs(a.Group,{position:"apart",children:[s.jsx(a.Button,{onClick:x,color:"red",leftIcon:s.jsx(z.Recycle,{size:20}),children:n("common.actions.revert")}),s.jsxs(a.Group,{position:"right",children:[s.jsx(a.Button,{onClick:p,variant:"subtle",children:n("common.actions.cancel")}),s.jsx(a.Button,{onClick:d,children:n("common.actions.save")})]})]})]})})]})},M1=S.observer(({view:t})=>{const{t:e}=j.useTranslation();if(!t||t.type!==L.Modal)return null;const n=t.config,r=n.custom_modal_title.value;return s.jsxs(a.Stack,{children:[s.jsx(a.Divider,{mt:8,label:e("view.component.modal.modal_settings"),labelPosition:"center"}),s.jsxs(a.Flex,{gap:10,children:[s.jsx(a.TextInput,{label:e("view.component.modal.title"),value:r,onChange:y.noop,disabled:!0,sx:{flexGrow:1}}),s.jsx(z1,{value:n.custom_modal_title,onChange:n.custom_modal_title.replace})]}),s.jsxs(a.Group,{grow:!0,children:[s.jsx(a.TextInput,{label:e("view.component.modal.width"),value:n.width,onChange:i=>n.setWidth(i.currentTarget.value),placeholder:"600px / 50vw"}),s.jsx(a.TextInput,{label:e("view.component.modal.height"),value:n.height,onChange:i=>n.setHeight(i.currentTarget.value),placeholder:"600px / 50vw"})]})]})}),I1=S.observer(({view:t})=>s.jsxs(s.Fragment,{children:[s.jsx(k1,{view:t}),s.jsx(M1,{view:t}),s.jsx(T1,{view:t})]})),E1=S.observer(({view:t})=>{const{t:e,i18n:n}=j.useTranslation(),r=g.useMemo(()=>[{label:e("view.component.div.label"),value:L.Division},{label:e("view.component.modal.label"),value:L.Modal},{label:e("view.component.tabs.label"),value:L.Tabs}],[n.language]);return t?s.jsxs(a.Stack,{sx:{position:"relative"},children:[s.jsx(a.TextInput,{label:e("common.name"),value:t.name,onChange:i=>{t.setName(i.currentTarget.value)}}),s.jsx(a.Select,{label:e("common.type"),withinPortal:!0,zIndex:320,value:t.type,onChange:t.setType,data:r}),s.jsx(I1,{view:t})]}):null}),A1=S.observer(({id:t})=>{const{t:e}=j.useTranslation(),n=Le.useModals(),r=X(),i=Q();if(t==="")return null;const o=i.views.findByID(t);if(!o)return s.jsxs(a.Text,{size:14,children:["View by ID[",t,"] is not found"]});const l=()=>{r.editor.setPath(["_VIEWS_",""])},c=()=>{n.openConfirmModal({title:`${e("view.delete")}?`,labels:{confirm:e("common.actions.confirm"),cancel:e("common.actions.cancel")},onCancel:()=>console.log("Cancel"),onConfirm:()=>{i.views.removeByID(t),l()},zIndex:320})};return s.jsxs(a.Stack,{sx:{maxWidth:"600px",height:"100%"},spacing:"sm",children:[s.jsx(a.Group,{position:"right",pt:10,children:s.jsx(a.Button,{size:"xs",color:"red",leftIcon:s.jsx(z.Trash,{size:16}),onClick:c,children:e("view.delete")})}),s.jsx(a.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:s.jsx(E1,{view:o})})]})});function P1(t){return t.length===1&&t[0]==="_QUERY_VARS_"}function $1(t){return t.length===1&&t[0]==="_MOCK_CONTEXT_"}function L1(t){return t.length===1&&t[0]==="_FILTERS_"}function B1(t){return t.length===2&&t[0]==="_FILTERS_"}function q1(t){return t.length===1&&t[0]==="_SQL_SNIPPETS_"}function O1(t){return t.length===2&&t[0]==="_SQL_SNIPPETS_"}function V1(t){return t.length===2&&t[0]==="_QUERIES_"}function N1(t){return t.length===1&&t[0]==="_QUERIES_"}function F1(t){return t.length===2&&t[0]==="_VIEWS_"}function G1(t){return t.length===4&&t[0]==="_VIEWS_"&&t[2]==="_PANELS_"}const W1=S.observer(()=>s.jsx(a.Stack,{sx:{height:"100%"},p:"sm",children:s.jsx(Bc,{})})),Q1=S.observer(()=>{const t=X().editor,e=t.path;return P1(e)?s.jsx(W1,{}):$1(e)?s.jsx(nT,{}):L1(e)?s.jsx(tT,{}):B1(e)?s.jsx(a.Box,{p:"xs",pl:20,children:s.jsx(eT,{id:e[1]})}):q1(e)?s.jsx(S1,{}):O1(e)?s.jsx(C1,{id:e[1]}):N1(e)?s.jsx(OT,{}):V1(e)?s.jsx(j1,{id:e[1]}):F1(e)?s.jsx(a.Box,{p:"xs",pl:20,children:s.jsx(A1,{id:e[1]})}):G1(e)?s.jsx(qT,{viewID:e[1],panelID:e[3]}):s.jsx(a.Box,{children:t.path})}),R1=S.observer(()=>s.jsx(Q1,{})),Y1=S.observer(()=>{const{t}=j.useTranslation(),e=X(),n=()=>{const r=new Date().getTime().toString(),i={id:r,key:r,label:r,order:e.content.filters.current.length+1,type:pe.TextInput,config:Rr(),visibleInViewsIDs:["Main"],auto_submit:!1};e.content.filters.append(i),e.editor.setPath(["_FILTERS_",r])};return s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:n,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:t("filter.add")})}),U1=S.observer(({parentID:t})=>{const{t:e}=j.useTranslation(),n=Q();if(!t)return null;const r=n.views.findByID(t);return!r||r.type===L.Tabs?null:s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:()=>n.addANewPanel(r.id),sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:e("panel.add")})}),K1=S.observer(()=>{const{t}=j.useTranslation(),e=X(),n=()=>{const r=new Date().getTime().toString(),i={id:r,name:r,type:le.Postgresql,key:"",sql:""};e.content.queries.append(i),e.editor.setPath(["_QUERIES_",r])};return s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:n,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:t("query.add")})}),J1=S.observer(()=>{const{t}=j.useTranslation(),e=X(),n=()=>{const r=new Date().getTime().toString(),i={key:r,value:""};e.content.sqlSnippets.append(i),e.editor.setPath(["_SQL_SNIPPETS_",r])};return s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:n,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:t("sql_snippet.add")})}),X1=S.observer(()=>{const{t}=j.useTranslation(),e=Q();return s.jsx(a.Button,{variant:"subtle",leftIcon:s.jsx(T.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:t("view.add")})}),Z1=S.observer(()=>{const{t}=j.useTranslation(),e=X();return s.jsx(a.Button,{variant:"subtle",rightIcon:s.jsx(T.IconSettings,{size:14}),size:"sm",px:12,mb:0,color:"blue",onClick:()=>e.editor.setPath(["_QUERIES_"]),sx:{width:"100%",borderRadius:0,fontWeight:"normal"},styles:{inner:{justifyContent:"space-between"}},children:t("query.manage")})}),H1=S.observer(()=>{const{t}=j.useTranslation(),e=X();return s.jsx(a.Button,{variant:"subtle",rightIcon:s.jsx(T.IconSettings,{size:14}),size:"sm",px:12,mb:0,color:"blue",onClick:()=>e.editor.setPath(["_SQL_SNIPPETS_"]),sx:{width:"100%",borderRadius:0,fontWeight:"normal"},styles:{inner:{justifyContent:"space-between"}},children:t("sql_snippet.manage")})}),eD=S.observer(()=>{const{t}=j.useTranslation(),e=X();return s.jsx(a.Button,{variant:"subtle",rightIcon:s.jsx(T.IconSettings,{size:14}),size:"sm",px:12,mb:0,color:"blue",onClick:()=>e.editor.setPath(["_FILTERS_"]),sx:{width:"100%",borderRadius:0,fontWeight:"normal"},styles:{inner:{justifyContent:"space-between"}},children:t("filter.manage")})}),tD=S.observer(({action_type:t,parentID:e})=>t==="_Add_A_Filter_"?s.jsx(Y1,{}):t==="_Add_A_SQL_SNIPPET_"?s.jsx(J1,{}):t==="_Add_A_QUERY_"?s.jsx(K1,{}):t==="_Add_A_VIEW_"?s.jsx(X1,{}):t==="_Add_A_PANEL_"?s.jsx(U1,{parentID:e}):t==="_QUERIES_SETTINGS_"?s.jsx(Z1,{}):t==="_SQL_SNIPPETS_SETTINGS_"?s.jsx(H1,{}):t==="_FILTERS_SETTINGS_"?s.jsx(eD,{}):null),Vc=S.observer(({option:t})=>{var p;const{t:e}=j.useTranslation(),n=X().editor,r=n.isOptionActive,i=r(n.path,t),o=n.isOptionOpened,l=n.navigate,c=o(t),[u,d]=g.useState(c);return g.useEffect(()=>{d(c)},[c]),s.jsx(a.NavLink,{active:i,defaultOpened:c,opened:u,onChange:d,label:e(t.label),onClick:()=>l(t),icon:t.Icon?s.jsx(t.Icon,{size:18}):null,children:(p=t.children)==null?void 0:p.map(h=>h._type==="ACTION"?s.jsx(tD,{action_type:h._action_type,parentID:h.parentID},`_ADD_${h.value}_`):s.jsx(Vc,{option:h},h.value))},t.label)}),nD=S.observer(()=>{const t=X();return s.jsx(a.Box,{sx:{position:"relative"},children:t.editor.navOptions.map(e=>s.jsx(Vc,{option:e},e.value))})}),sD=S.observer(()=>{const{t}=j.useTranslation(),e=X();return s.jsxs(a.Navbar,{p:0,width:{base:220,xs:220,sm:240,md:260,lg:300,xl:320},sx:{height:"100vh - 60px - 60px",".mantine-NavLink-body":{wordWrap:"break-word"}},children:[s.jsx(a.Navbar.Section,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:s.jsx(a.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:t("common.titles.settings")})}),s.jsx(a.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:s.jsx(nD,{})}),s.jsx(a.Navbar.Section,{children:s.jsx(a.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:s.jsx(a.Button,{size:"xs",color:"red",leftIcon:s.jsx(T.IconX,{size:18}),onClick:()=>e.editor.close(),children:t("common.actions.close")})})})]})}),rD={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden",minWidth:"calc(var(--mantine-navbar-width, 0px) + 1200px)"},body:{flexGrow:1,nav:{top:0,height:"100vh"}},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:0,height:"100vh"}},iD=S.observer(()=>{const t=X().editor;return s.jsx(a.Modal,{onClose:()=>t.setSettingsOpen(!1),closeOnEscape:!1,closeOnClickOutside:!1,opened:t.settings_open,fullScreen:!0,title:null,transitionProps:{duration:0},withCloseButton:!1,withinPortal:!0,zIndex:300,styles:{body:{padding:"0 !important"},content:{overflowY:"hidden !important"}},children:s.jsx(a.AppShell,{padding:0,navbar:s.jsx(sD,{}),styles:rD,children:s.jsx(R1,{})})})}),aD=t=>t.replace(/([^:])(\/\/+)/g,"$1/");function oD(t){g.useEffect(()=>{if(Ae.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/dashboard");const n=aD(t);Ae.loader.config({paths:{vs:n}}),Ae.loader.init().then(r=>console.log("monaco instance:",r))},[])}xa(),ma();const lD={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:60+30,height:"100vh"}},cD=({context:t,dashboard:e,content:n,update:r,className:i="dashboard",config:o,onChange:l,headerSlot:c,filterValues:u,onFilterValuesChange:d,onExit:p,lang:h},x)=>{oD(o.monacoPath),js(o);const{i18n:m}=j.useTranslation();g.useEffect(()=>{m.changeLanguage(h)},[h]);const{data:v=[]}=N.useRequest(ks),{data:C=[]}=N.useRequest(fa),k=g.useMemo(()=>vc(e,n,v,C,t,u??{}),[e,n]);g.useImperativeHandle(x,()=>k,[k]),jc(k.content,!0),g.useEffect(()=>{k.context.replace(t)},[t]),g.useEffect(()=>{k.datasources.replace(v)},[v]),g.useEffect(()=>{k.globalSQLSnippets.replace(C)},[C]),g.useEffect(()=>{d==null||d(k.content.filters.values)},[d,k.content.filters.values]),g.useEffect(()=>{u&&k.content.filters.patchValues(u)},[u,k.content.filters.patchValues]),g.useEffect(()=>K.reaction(()=>K.toJS(k.json),G=>{l==null||l(G)}),[k]);const D=async()=>{await r(k.json,k.content.json)},E=N.useCreation(Pr,[]),B=_c(E);return s.jsx(Le.ModalsProvider,{children:s.jsx($s,{children:s.jsx(Is,{value:{searchButtonProps:o.searchButtonProps},children:s.jsx(zs,{value:k,children:s.jsx(Es,{value:k.content,children:s.jsx(Mn.Provider,{value:{inEditMode:!0},children:s.jsx(rt.Provider,{value:E,children:s.jsxs(ss,{configure:B,children:[s.jsx(a.AppShell,{padding:0,header:s.jsx(pk,{onExit:p,saveDashboardChanges:D,headerSlot:c}),navbar:s.jsx(Ok,{}),styles:lD,children:s.jsx(a.Box,{className:`${i} dashboard-root`,sx:{position:"relative"},children:k.content.views.visibleViews.map(G=>s.jsx(lc,{view:G},G.id))})}),s.jsx(iD,{})]})})})})})})})})},uD=S.observer(g.forwardRef(cD)),tM="",ki=f.types.model({id:f.types.string,name:f.types.string,dashboard_id:f.types.string,create_time:f.types.string,update_time:f.types.string,version:f.types.string,filters:ii,queries:li,sqlSnippets:ui,views:ni,panels:ri,layouts:ci,mock_context:qr}).views(t=>({get json(){return{id:t.id,name:t.name,create_time:t.create_time,update_time:t.update_time,dashboard_id:t.dashboard_id,content:{views:t.views.json,panels:t.panels.json,filters:t.filters.json,version:t.version,layouts:t.layouts.json,definition:{queries:t.queries.json,sqlSnippets:t.sqlSnippets.json,mock_context:t.mock_context.current}}}},get contentJSON(){return this.json.content},get payloadForSQL(){const e=f.getParent(t).context.current,n=f.getParent(t).globalSQLSnippets,r={context:{...t.mock_context.current,...e},filters:t.filters.values};return{...r,sql_snippets:mn(t.sqlSnippets.current,"key","value",r),global_sql_snippets:mn(n.list,"id","content",r)}},get payloadForViz(){const e=f.getParent(t).context.current;return{context:{...t.mock_context.current,...e},filters:t.filters.values}},get dashboardState(){return Ss(this.payloadForSQL)},getAdditionalQueryInfo(e){return{content_id:t.id,query_id:e,params:this.dashboardState}},get data(){return t.queries.current.map(({id:n,data:r})=>({id:n,data:r})).reduce((n,r)=>(n[r.id]=r.data,n),{})},getDataStuffByID(e){const n=t.queries.findByID(e);return n?{data:n.data,len:n.data.length,state:n.state,error:n.error}:{data:[],len:0,state:"idle",error:void 0}}})).actions(t=>({}));function Nc({id:t,name:e,dashboard_id:n,create_time:r,update_time:i,content:o},l,c){if(!o)throw new Error("unexpected null content when creating a content model");const{version:u,filters:d,views:p,panels:h,layouts:x,definition:{queries:m,sqlSnippets:v,mock_context:C={}}}=o;return ki.create({id:t,name:e,dashboard_id:n,create_time:r,update_time:i,version:u,filters:ai(d,l,C,c),queries:Gl(m),sqlSnippets:Rl(v),mock_context:Or(C),views:$l(p),panels:{list:h},layouts:{list:x,currentBreakpoint:x[0].id}})}const Fc=f.types.model({id:f.types.identifier,name:f.types.string,group:f.types.string,content:ki,content_id:f.types.string,datasources:Al,globalSQLSnippets:Hr,context:as});function Gc({id:t,name:e,group:n,content_id:r},i,o,l,c,u){return Fc.create({id:t,name:e,group:n,content_id:r,content:Nc(i,c,u),datasources:{list:o},globalSQLSnippets:{list:l},context:ei(c)})}xa(),ma();const dD=({context:t,dashboard:e,content:n,className:r="dashboard",config:i,fullScreenPanelID:o,setFullScreenPanelID:l,filterValues:c,onFilterValuesChange:u,lang:d})=>{js(i);const{i18n:p}=j.useTranslation();g.useEffect(()=>{p.changeLanguage(d)},[d]);const{data:h=[]}=N.useRequest(ks),{data:x=[]}=N.useRequest(fa),m=g.useMemo(()=>Gc(e,n,h,x,t,c??{}),[e,n]);jc(m.content,!1),g.useEffect(()=>{m.context.replace(t)},[t]),g.useEffect(()=>{m.datasources.replace(h)},[h]),g.useEffect(()=>{m.globalSQLSnippets.replace(x)},[x]),g.useEffect(()=>{u==null||u(m.content.filters.values)},[u,m.content.filters.values]),g.useEffect(()=>{c&&m.content.filters.patchValues(c)},[c,m.content.filters.patchValues]);const v=N.useCreation(Pr,[]),C=_c(v);return s.jsx(Le.ModalsProvider,{children:s.jsx($s,{children:s.jsx(Is,{value:{searchButtonProps:i.searchButtonProps},children:s.jsx(zs,{value:m,children:s.jsx(Es,{value:m.content,children:s.jsx(Ps.Provider,{value:{fullScreenPanelID:o,setFullScreenPanelID:l},children:s.jsx(Mn.Provider,{value:{inEditMode:!1},children:s.jsx(a.Box,{className:`${r} dashboard-root`,children:s.jsx(rt.Provider,{value:v,children:s.jsx(ss,{configure:C,children:m.content.views.visibleViews.map(k=>s.jsx(ls,{view:k},k.id))})})})})})})})})})})},pD=S.observer(dD);I.extend(bu),I.extend(vu),I.extend(ju),I.extend(_u),I.extend(wu),I.extend(Cu),I.extend(Su),I.extend(ku),I.extend(Tu),I.extend(Du),I.extend(Iu),I.extend(Eu),I.extend(Au),I.extend(Pu),I.extend($u),I.extend(zu),I.extend(Mu),I.extend(Lu),I.extend(Bu),I.extend(qu),I.extend(Ou),I.extend(Vu),I.extend(Nu),I.extend(Fu),I.extend(Gu),I.extend(Wu),I.extend(Qu),I.extend(Ru),I.extend(Yu),I.extend(Uu),I.extend(Ju),I.extend(Xu),I.extend(Ku),I.tz.setDefault("UTC"),I.updateLocale("en",{weekStart:1});const hD={translation:{filter:{label:"Filter",labels:"Filters",add:"Add a Filter",manage:"Manage Filters",show_filters:"Show Filters",hide_filters:"Hide Filters",field:{widget:"Widget",visible_in:"Visible in...",key_placeholder:"A unique key to refer",label_placeholder:"Label for this field",auto_submit:"Submit automatically",order:"Placement Order",custom_default_value:{trigger:"Custom",title:"Custom default value",tips:"Tips",tip_1:"Function has the highest priority of getting filter's default value",tip_2:"Leave this editor empty to disable this feature"}},widget:{names:{select:"Select",multi_select:"Multi Select",tree_select:"Tree Select",text_input:"Text Input",checkbox:"Checkbox",date_range:"Date Range"},common:{use_query_data_as_options:"Use query data as options",fetch_options_from_datasource:"Fetch options from datasource",or_fetch_options_from_datasource:"Or fetch options from datasource",selector_option_empty:"Not found",see_data_structure:"Click to see expected data structure",using_query:"Using query",default_selection_count:"Select first N options by default",min_width:"Min width",x_selected:"{{count}} selected"},text_input:{default_value:"Default Value",required:"Required"},select:{width:"Width",required:"Required",clearable:"Clearable",configure_options:"Configure options",default_selection:"Default Selection",no_default_selection:"none",select_first_option_by_default:"Select the first option by default"},multi_select:{width_description:"At least 160px"},tree_select:{strictly:"Parent and children nodes are not associated"},checkbox:{description:"Description",default_checked:"Default checked"},date_range:{required:"Required",allow_single_date:"Allow choosing 1 day",display_format:"Display format",max_days:"Max days",one_day:"1 day",x_days:"{{count}} days",x_max_days:"{{max_days}} days max",default_value:"Default value",default_by_shortcut:"Default by shortcut",defualt_by_shortcut_placeholder:"Priors default value",start_date:"Start date",end_date:"End date",shortcut:{last:{label:"last",d:"yesterday",w:"week",m:"month",m2:"2 months",m3:"3 months",y:"year",full:{d:"yesterday",w:"last week",m:"last month",m2:"last 2 months",m3:"last 3 months",y:"last year"}},recent:{label:"recent",d7:"7 days",d30:"30 days",d60:"60 days",d90:"90 days",d180:"180 days",d365:"365 days",full:{d7:"recent 7 days",d30:"recent 30 days",d60:"recent 60 days",d90:"recent 90 days",d180:"recent 180 days",d365:"recent 365 days"}},this:{label:"this",d:"today",w:"week",m:"month",y:"year",full:{d:"today",w:"this week",m:"this month",y:"this year"}},this_so_far:{label:"this...so far",w:"week",m:"month",y:"year",full:{w:"this week so far",m:"this month so far",y:"this year so far"}}}}}},view:{label:"View",labels:"Views",add:"Add a View",delete:"Delete this View",download_schema:"Download this View",component:{div:{label:"Division"},tabs:{label:"Tabs",tabs_settings:"Tabs Settings",tab:{name:"Tab Name",view:"View",order:"Placement Order",color:"Color",delete:"Delete this tab",switch_to_view:"Swith to View: {{name}}"}},modal:{label:"Modal",modal_settings:"Modal settings",title:"Modal Title",custom_title:"Customize modal title",width:"Width",height:"Height"}}},interactions:{label:"Interactions",add:"Add an interaction",interactions_viewer:"Interactions Viewer",unavailable:"Unavailable",unavailable_reason:"This visualization does not have available interactions to choose from",trigger:{setup:"Setup Trigger",label:"Trigger",payload:"Payload"},operation:{setup:"Operation Settings",label:"Operation",settings:"Settings",variables:"Variables",console_log:{label:"console.log | debug",log_content:"log content"},open_link:{label:"Open Link",url:"URL",open_in_new_tab:"Open in new tab"},open_view:{label:"Open View",view:"View"},set_filter_values:{label:"Set Filter Values",set_filter:"Set filter",with:"with"},clear_filter_values:{label:"Clear Filter Values",select_filter:"Select filters to clear"}}},query_variable:{label:"Query Variable",labels:"Query Variables",add:"Add a Variable",guide:{tabs:{guide:"Guide",variables_in_this_dashboard:"Variables in this dashboard",global_sql_snippets:"Global SQL Snippets"}},open:"See Query Variables"},sql_snippet:{label:"SQL Snippet",labels:"SQL Snippets",add:"Add a SQL Snippet",delete:"Delete this SQL Snippet",delete_unused:"Delete unused SQL Snippets",manage:"Manage SQL Snippets",key:"Key",key_occupied:"This key is occupied by another snippet",edit_snippet:"Edit SQL Snippet",preview_snippet:"Preview SQL Snippet",usage:{label:"Usage"}},global_sql_snippet:{label:"Global SQL Snippet",labels:"Global SQL Snippets",description:"SQL snippets worth sharing between dashboards are managed in System Settings by admins."},common:{titles:{settings:"Settings",edit:"Edit",config:"Config"},pagination:{page_size:"Page Size",total:"Total",total_rows:"Total {{total}} row(s)"},align:{horizontal:{label:"Horizontal Align",left:"left",center:"center",right:"right"},vertical:{label:"Vertical Align",left:"top",center:"center",right:"bottom"}},id:"ID",name:"Name",key:"Key",label:"Label",value:"Value",type:"Type",info:"Info",min:"Min",max:"Max",data_field:"Data Field",name_data_field:"Name Data Field",value_data_field:"Value Data Field",color_data_field:"Color Data Field",enabled:"Enabled",copied:"Copied to clipboard",action:"Action",actions:{open:"Open",close:"Close",save:"Save",save_changes:"Save Changes",revert:"Revert",revert_changes:"Revert Changes",reset_to_default:"Reset to default",select_all:"Select All",clear_selection:"Clear Selection",refresh:"Refresh",download_data:"Download Data",download_schema:"Download Schema",download_screenshot:"Screenshot",enter_fullscreen:"Full Screen",duplicate:"Duplicate",delete:"Delete",cancel:"Cancel",confirm:"Confirm",add_an_option:"Add an Option",edit:"Edit",end_editing:"End editing <1>{{name}}</1>"},tabs:{variant:{label:"Variant",default:"Default",outline:"Outline",pills:"Pills"},orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"},grow_tabs:"Grow Tabs"},choose_a_tab_first:"Please choose a tab first"},breakpoint:{label_one:"Screen size",label_other:"Screen sizes",add:"Add a screen size",manage:"Manage screen sizes",breakpoint:"Min Width"},context:{label:"Context"},mock_context:{label:"Mock Context",hint:"A valid json string is required"},panel:{label:"Panel",labels:"Panels",add:"Add a Panel",delete:"Delete This Panel",panel_name:"Panel Name",panel_description:"Description",panel_description_click:"Click to see description",show_title:"Show title",use_name_as_title:"Use name as title",settings:{change_view:"Move into Another View",change_view_title:"Move panel into another view",choose_queries:"Choose queries"},style:{label:"Style",width:"Width",width_postfix:"of 36 columns",height:"Height",height_postfix:"px",border:"Border"},variable:{label:"Variable",labels:"Variables",add:"Add a Variable",delete:"Delete this Variable",aggregation:{label:"Aggregation",fallback_value:"Fallback Value",fallback_value_description:"Used when data is empty or the aggregation yields NaN"}}},style:{label:"Style",font_size:{label:"Font Size",placeholder:"10px, 1em, 1rem, 100%..."},font_weight:{label:"Font Weight"},size:{xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},flex:{justify_content:{label:"Justify Content",left:"Left",center:"Center",right:"Right",space_between:"Space Between",space_around:"Space Around",space_evenly:"Space Evenly"},align_items:{label:"Align Items",start:"Start",center:"Center",end:"End",stretch:"Stretch"}},color:{type:{label:"Color Type",static:"Static",interpolation:"Interpolation",none:"None"},interpolation:{setup:"Setup color interpolation",palette:{label:"Palette",category:{sequential:"Sequential",diverging:"Diverging"},red_green:"Red / Green",yellow_blue:"Yellow / Blue",red:"Red",green:"Green",blue:"Blue",orange:"Orange",mapping:{value_input_label:"Map a value to this color"}}}}},query:{label:"Query",labels:"Queries",add:"Add a Query",delete:"Delete this Query",cant_delete:"Can't delete this query for it's being used, check out Usage tab for details",delete_unused:"Delete unused queries",name:"Name",name_description:"A unique name",manage:"Manage Queries",open:"Open this query",configurations:"Configurations",basics:"Basics",conditions:"Conditions",run_by_condition:{label:"Run query when these are truthy",unset:"Always run this query on load"},re_run_condition:{label:"Re-run query when these changed",unset:"Leave it empty to never re-run this query"},dependency:{label:"Dependency",has_none:"This query has no dependency"},edit_sql:"Edit SQL",preview_sql:"Preview SQL",request:"Request",build_request:"Build Request",process_request:"Process Request",process_result:"Process Result",usage:{label:"Usage",in_views:"In View(s)",unused_description:"This query is not used by any filter or panel"},transform:{label:"Transform",data_source:"Use other queries' data",guide:{pick_queries:"Pick queries for data input",write_function:"Write a function for making new data"}}},data:{label:"Data",preview_data:"Preview Data",empty_data:"Empty Data"},data_source:{label:"Data Source",explore:"Explore Data Source",explorer:"Data Source Explorer",table_structure:"Table Structure",table_structure_short:"Structure",see_table_structure:"See Table Structure"},visualization:{label:"Visualization",component:"Visualization",label_short:"Viz"},numbro:{format:{label:"Format",absolute:"Absolute",absolute_description:"Non-negative",abbreviation:"Abbreviation",abbreviation_description:"like 1.23k, 1.23m",mantissa:"Mantissa",trim_mantissa:"Trim mantissa",trim_mantissa_description:"hide trailing zero(s)",preview:{open:"Open Preview",close:"Close Preview",input:"In",output:"Out"}}},import:{label:"Import...",title:"Import content with schema json",json_file:"JSON File",this_dashboard:"This dashboard",this_file:"This file"},function_utils:{trigger_text:"About parameter 'utils'",modal_title:"About FunctionUtils",description:"Parameter <code>utils</code> is <code>FunctionUtils</code>, which contains:",document:"Document"},aggregation:{option:{none:"None",sum:"Sum",mean:"Mean",median:"Median",min:"Min",max:"Max",cov:"Coefficient of Variation",std:"Standard Variation",quantile:{label:"Quantile",label_with_hint:"Quantile(99%, 95%, ...)"},custom:{label:"Custom",label_trigger:"Edit Function",title:"Custom Aggregation"}}},chart:{chart_config:"Chart Config",data_field:"Data Field",groups:{merico_suite:"Merico suite",echarts_based_charts:"ECharts-based charts",others:"Others"},label:{label:"Label",label_full:"Label",label_style:"Label Style",label_format:"Label Format"},label_position:{label:"Label Position",off:"Off",top:"Top",left:"Left",right:"Right",bottom:"Bottom",inside:"Inside",inside_top:"Inside Top",inside_left:"Inside Left",inside_center:"Inside Center",inside_right:"Inside Right",inside_bottom:"Inside Bottom",inside_top_left:"Inside Top Left",inside_top_right:"Inside Top Right",inside_bottom_left:"Inside Bottom Left",inside_bottom_right:"Inside Bottom Right",outside:"Outside"},number_or_dynamic_value:{type:{static:"Static",dynamic:"Dynamic"},dynamic:{setup:"Setup",setup_title:"Setup dynamic value",guide:"Dyanmic by a custom function"}},orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"},symbol_size:{label:"Symbol Size",static:"Static",dynamic:"Dynamic",setup:{label:"Setup",title:"Setup dynamic size",description:"Dynamic by a custom function"}},series:{label:"Series",name:"Name",y_axis:"Y Axis",data_field:"Data Field",delete:"Delete this series",line:{label:"Line",line_settings:"Line Settings",line_style:"Line Style",type:{label:"Line Type",solid:"Solid",dashed:"Dashed",dotted:"Dotted"},line_width:"Line Width",step:{label:"Step",off:"Off",start:"Start",middle:"Middle",end:"End"},smooth_line:"Smooth Line",show_name_on_line:"Display Name on Line",show_symbol_on_line:"Show Symbol on Line"},bar:{label:"Bar",stack:"Stack",stack_hint:"Stack bars by this ID",bar_gap:{label:"Bar Gap",no_gap:"No gap between bars",overlap:"Bars overlapping on each other"},bar_width:{min:"Bar Width(min)",exact:"Bar Width",max:"Bar Width(max)"}},scatter:{label:"Scatter"},group_by:{label:"Split into multiple seires by this field...",label_line:"Split into multiple lines by this field..."}},axis:{tick_label:"Tick Label",customize_label:"Customize Label",overflow:{label:"Overflow",max_width:"Max Width",truncate:"Truncate",break_line:"Break Line",break_word:"Break Word",ellipsis:"Ellipsis",section_title:{on_axis:"Overflow on Axis",in_tooltip:"Overflow in Tooltip"}},section_title:{label_format:"Label Format"},type:{value:"Value",category:"Category",time:"Time",log:"Log",click_to_learn_more:"Click <1>here</1> to learn more about these options"}},name_text:{align:{label:"Name Anchor",left:"Left",center:"Center",right:"Right"}},rotate:"Rotate",degree:"degree",padding:"Padding",content_template:{label:"Content Template",hint:"Average: ${avg}"},x_axis:{label:"X Axis",labels:"X Axes",label_format:"Label Format",delete:"Delete this XAxis",x_axis_name:"X Axis Name",x_axis_data_field:"X Axis Data Field",x_axis_type:"X Axis Type",layout:"Layout",position:{label:"Position",top:"Top",bottom:"Bottom"},value_range:"Value Range",value_min:"Min",value_max:"Max",behavior:"Behavior",visible:"Visible"},y_axis:{label:"Y Axis",labels:"Y Axes",label_format:"Label Format",delete:"Delete this YAxis",y_axis_name:"Y Axis Name",y_axis_name_anchor:"Name Anchor",y_axis_data_field:"Y Axis Data Field",layout:"Layout",position:{label:"Position",left:"Left",right:"Right"},value_range:"Value Range",value_min:"Min",value_max:"Max",behavior:"Behavior",visible:"Visible"},stats:{label:"Stats",template:{above_chart:"Template for stats above the chart",under_chart:"Template for stats under the chart"}},legend:{label:"Legend",show_legend:"Show Legend",show_in_legend:"Show in legend",hide_in_legend:"Hide in legend",orientation:{label:"Orientation",horizontal:"Horizontal",vertical:"Vertical"}},tooltip:{label:"Tooltip",additional_metrics:{description:"Set additional metrics to show in scatter's tooltip",delete:"Delete this Metric"},trigger:{label:"Trigger",scatter_point:"Scatter Point",x_axis:"X Axis"}},style:{label:"Style"},color:{label:"Color",or:"or",set_any_color:"Set any color",pick_a_theme_color:"Pick a theme color",background_color:"Background Color",text_color:"Text Color"},behavior:{label:"Behavior",invisible:"Invisible"},heatmap:{heatblock:{label:"Heat Block",min_value:"Min Value",max_value:"Max Value",show_label:"Show Label"}},reference_line:{label:"Reference Line",labels:"Reference Lines",add:"Add a reference line",name_placeholder:"Average Reference Line",delete:"Remove this Reference Line",orientation:{vertical_hint:"Works only when xAxis values are numbers"}},regression_line:{label:"Regression Line",labels:"Regression Lines",add:"Add a line",delete:"Delete this line",method:{label:"Method",linear:"Linear",exponential:"Exponential",logistic:"Logistic",polynomial:"Polynomial",polynomial_order:"Order"}},reference_area:{label:"Reference Area",labels:"Reference Areas",add:"Add a reference area",delete:"Remove this reference area",type:{label:"Type",rectangle:"Rectangle"},direction:{label:"Direction",horizontal:"Horizontal"},boundary:{upper:"Upper Boundary",lower:"Lower Boundary"},content:{label:"Content",content_text:"Content Text",text_position:"Text Position"},endpoint:{labels:"Endpoints",left_bottom_point:"Left-Bottom Point",right_top_point:"Right-Top Point"}},zooming:{label:"Zooming",scroll:{label:"Scroll to zoom",x_axis:"Enable on X Axis",y_axis:"Enable on Y Axis"},slider:{label:"Slider for zooming",x_axis:"Slider for X Axis",y_axis:"Slider for Y Axis",y_axis_disabled:"Not available for now, will overlap y-axis's label"}}},viz:{viz_config_banner:"Visualization Settings"},validation:{number:{require_a_number:"A number is required"}}}},xD={translation:{filter:{label:"筛选器",labels:"筛选器",add:"新增筛选器",manage:"管理筛选器",show_filters:"展开筛选器",hide_filters:"收起筛选器",field:{widget:"控件",visible_in:"在...视图中可见",key_placeholder:"用于引用此筛选器,需保持唯一",label_placeholder:"用于展示的标签文案",auto_submit:"自动提交",order:"排列次序",custom_default_value:{trigger:"自定义",title:"自定义默认值",tips:"提示",tip_1:"在指定筛选器默认值这事上,自定义函数具备最高优先级",tip_2:"清空下方编辑器来禁用本功能"}},widget:{names:{select:"单选",multi_select:"多选",tree_select:"树形选择器",text_input:"文本框",checkbox:"勾选框",date_range:"日期范围"},common:{use_query_data_as_options:"使用所查数据为选项",fetch_options_from_datasource:"从数据源查选项",or_fetch_options_from_datasource:"或从数据源查选项",selector_option_empty:"无选项可用",see_data_structure:"点击查看期望的数据格式",using_query:"在用查询获取选项",default_selection_count:"默认选中前N项",min_width:"控件最小宽度",x_selected:"已选数:{{count}}"},text_input:{default_value:"默认值",required:"必填"},select:{width:"控件宽度",required:"必选",clearable:"可取消选择",configure_options:"配置选项",default_selection:"默认选项",no_default_selection:"无",select_first_option_by_default:"默认选中第一个选项"},multi_select:{width_description:"至少160px"},tree_select:{strictly:"枝叶节点不相关,各选各的"},checkbox:{description:"描述信息",default_checked:"默认勾选"},date_range:{required:"必选",allow_single_date:"允许选一天作为范围",display_format:"展示格式",max_days:"最大选择天数",one_day:"1天",x_days:"{{count}}天",x_max_days:"最多可选{{max_days}}天",default_value:"默认日期范围(具体)",default_by_shortcut:"默认日期范围(快捷方式)",defualt_by_shortcut_placeholder:"优先于左侧",start_date:"开始日期",end_date:"结束日期",shortcut:{last:{label:"过往整周期",d:"昨天",w:"周",m:"月",m2:"两个月",m3:"三个月",y:"年",full:{d:"昨天",w:"上周",m:"上个月",m2:"上两月",m3:"上三月",y:"去年"}},recent:{label:"最近",d7:"7天",d30:"30天",d60:"60天",d90:"90天",d180:"180天",d365:"365天",full:{d7:"近7天",d30:"近30天",d60:"近60天",d90:"近90天",d180:"近180天",d365:"近365天"}},this:{label:"当前整周期",d:"今天",w:"周",m:"月",y:"年",full:{d:"今天",w:"本周",m:"本月",y:"今年"}},this_so_far:{label:"至今",w:"周",m:"月",y:"年",full:{w:"本周至今",m:"本月至今",y:"本年至今"}}}}}},view:{label:"视图",labels:"视图",add:"新增视图",delete:"删除此视图",download_schema:"下载此视图描述文件",component:{div:{label:"内容"},tabs:{label:"标签页",tabs_settings:"标签页设置",tab:{name:"名称",view:"内容视图",order:"排列次序",color:"颜色",delete:"删除这个标签页",switch_to_view:"打开视图: {{name}}"}},modal:{label:"弹窗",modal_settings:"弹窗设置",title:"弹窗标题",custom_title:"自定义弹窗标题",width:"宽度",height:"高度"}}},interactions:{label:"交互",add:"新增交互",interactions_viewer:"纵览交互",unavailable:"不可用",unavailable_reason:"此可视化组件没有交互功能",trigger:{setup:"设置触发动作",label:"触发动作",payload:"触发时的参数"},operation:{setup:"操作设置",label:"操作",settings:"设置",variables:"变量",console_log:{label:"console.log | 调试用",log_content:"打印内容"},open_link:{label:"打开链接",url:"URL",open_in_new_tab:"在新标签页中打开"},open_view:{label:"唤出视图",view:"视图"},set_filter_values:{label:"设置筛选器值",set_filter:"将筛选器的值",with:"设为"},clear_filter_values:{label:"清除筛选器值",select_filter:"选择筛选器以清除其值"}}},query_variable:{label:"查询变量",labels:"查询变量",add:"新增变量",guide:{tabs:{guide:"使用指南",variables_in_this_dashboard:"本看板中的查询变量",global_sql_snippets:"全局SQL片段"}},open:"查看查询变量"},sql_snippet:{label:"SQL片段",labels:"SQL片段",add:"新增SQL片段",delete:"删除这个SQL片段",delete_unused:"删除未用到的SQL片段",manage:"管理SQL片段",key:"键",key_occupied:"此键已被其他SQL片段占用",edit_snippet:"编辑SQL片段",preview_snippet:"预览SQL片段",usage:{label:"使用情况"}},global_sql_snippet:{label:"全局SQL片段",labels:"全局SQL片段",description:"管理员负责在系统设置中维护全局SQL片段"},common:{titles:{settings:"设置",edit:"编辑",config:"配置"},pagination:{page_size:"页容量",total:"共",total_rows:"共 {{total}} 行"},align:{horizontal:{label:"水平对齐",left:"居左",center:"居中",right:"居右"},vertical:{label:"垂直对齐",left:"居上",center:"居中",right:"居下"}},id:"ID",name:"名称",key:"键",label:"标签",value:"值",type:"类型",info:"信息",min:"最小值",max:"最大值",data_field:"数据字段",name_data_field:"名称字段",value_data_field:"值字段",color_data_field:"颜色字段",enabled:"启用",copied:"已复制到剪切板",action:"操作",actions:{open:"打开",close:"关闭",save:"保存",save_changes:"保存改动",revert:"还原",revert_changes:"还原改动",reset_to_default:"重置为初始值",select_all:"全选",clear_selection:"撤销选择",refresh:"刷新",download_data:"下载数据",download_schema:"下载描述文件",download_screenshot:"下载截图",enter_fullscreen:"全屏",duplicate:"复制",delete:"删除",cancel:"取消",confirm:"确认",add_an_option:"新增选项",edit:"编辑",end_editing:"结束编辑 <1>{{name}}</1>"},tabs:{variant:{label:"风格",default:"默认",outline:"轮廓",pills:"胶囊"},orientation:{label:"朝向",horizontal:"水平",vertical:"垂直"},grow_tabs:"拉伸标签卡宽度"},choose_a_tab_first:"请先选择一个标签页"},breakpoint:{label_one:"屏幕尺寸",label_other:"屏幕尺寸",add:"新增屏幕尺寸",manage:"管理屏幕尺寸",breakpoint:"最小宽度"},context:{label:"上下文"},mock_context:{label:"模拟上下文",hint:"内容格式为JSON"},panel:{label:"卡片",labels:"卡片",add:"新增卡片",delete:"删除这个卡片",panel_name:"卡片名",panel_description:"卡片描述",panel_description_click:"点击查看卡片描述",show_title:"展示卡片标题",use_name_as_title:"使用卡片名作为标题",settings:{change_view:"移至另一个视图下",change_view_title:"移动此卡片至另一个视图下",choose_queries:"关联查询"},style:{label:"样式",width:"宽",width_postfix:"之 36 栏",height:"高",height_postfix:"px",border:"边框"},variable:{label:"变量",labels:"变量",add:"新增变量",delete:"删除此变量",aggregation:{label:"聚合",fallback_value:"兜底值",fallback_value_description:"当数据为空或聚合结果非数字时,使用此兜底值"}}},style:{label:"样式",font_size:{label:"字号",placeholder:"10px, 1em, 1rem, 100%..."},font_weight:{label:"字重"},size:{xs:"特小",sm:"小",md:"中",lg:"大",xl:"特大"},flex:{justify_content:{label:"内容分布",left:"从左起",center:"居中",right:"从右起",space_between:"均匀分布,首尾顶格",space_around:"均匀分布,首尾留空一半",space_evenly:"均匀分布,首尾留空"},align_items:{label:"对齐位置",start:"起点对齐",center:"居中对齐",end:"末端对齐",stretch:"拉伸对齐"}},color:{type:{label:"颜色类型",static:"单色",interpolation:"插值取色",none:"无"},interpolation:{setup:"设置取色方案",palette:{label:"色板",category:{sequential:"单色渐变",diverging:"双色渐变"},red_green:"红 / 绿",yellow_blue:"黄 / 蓝",red:"红",green:"绿",blue:"蓝",orange:"橙",mapping:{value_input_label:"映射一个值到此颜色"}}}}},query:{label:"查询",labels:"查询",add:"新增查询",delete:"删除这个查询",cant_delete:"此查询在使用中,不能删除。请查看“使用情况”标签页以了解详情",delete_unused:"删除未用到的查询",name:"名称",name_description:"唯一名称",manage:"管理查询",open:"打开此查询",configurations:"配置",basics:"基本信息",conditions:"条件",run_by_condition:{label:"以下条件满足时,才运行本查询",unset:"看板加载时便运行本查询"},re_run_condition:{label:"当以下条件改变时,重新运行此查询",unset:"留空则永不重新运行此查询"},dependency:{label:"依赖",has_none:"此查询无依赖"},edit_sql:"编辑SQL",preview_sql:"预览SQL",request:"请求",build_request:"构造请求",process_request:"加工请求",process_result:"加工结果",usage:{label:"使用情况",in_views:"所在视图",unused_description:"此查询未被任何筛选器或卡片用到"},transform:{label:"查询变形",data_source:"基于其他查询的数据,加工出新数据",guide:{pick_queries:"选择一至多个查询作为数据输入",write_function:"编写函数,返回新数据"}}},data:{label:"数据",preview_data:"预览数据",empty_data:"无数据"},data_source:{label:"数据源",explore:"查看数据源",explorer:"数据源查看器",table_structure:"数据表结构",table_structure_short:"表结构",see_table_structure:"查看数据表结构"},visualization:{label:"可视化",component:"可视化组件",label_short:"可视化"},numbro:{format:{label:"格式",absolute:"绝对值",absolute_description:"非负",abbreviation:"缩写",abbreviation_description:"如1.23k、1.23m",mantissa:"小数",trim_mantissa:"抹零",trim_mantissa_description:"省略末尾的零",preview:{open:"展开预览",close:"收起预览",input:"输入",output:"输出"}}},import:{label:"导入...",title:"自描述文件导入看板内容",json_file:"描述文件(JSON格式)",this_dashboard:"此看板",this_file:"此文件"},function_utils:{trigger_text:"关于utils参数",modal_title:"关于utils参数",description:"参数 <code>utils</code> 是 <code>FunctionUtils</code>,包含以下内容:",document:"文档"},aggregation:{option:{none:"无",sum:"和",mean:"平均值",median:"中位数",min:"最小值",max:"最大值",cov:"变异系数",std:"标准差",quantile:{label:"分位",label_with_hint:"分位(99%, 95%, ...)"},custom:{label:"自定义",label_trigger:"编写函数",title:"自定义聚合方式"}}},chart:{chart_config:"图表设置",data_field:"数据字段",groups:{merico_suite:"思码逸套件",echarts_based_charts:"基于ECharts的图表",others:"其他"},label:{label:"文案",label_full:"标签文案",label_style:"标签文案样式",label_format:"标签文案格式"},label_position:{label:"文案位置",off:"不显示文案",top:"上",left:"左",right:"右",bottom:"下",inside:"内",inside_top:"内-上",inside_left:"内-左",inside_center:"内-中",inside_right:"内-右",inside_bottom:"内-下",inside_top_left:"内-上-左",inside_top_right:"内-上-右",inside_bottom_left:"内-下-左",inside_bottom_right:"内-下-右",outside:"外"},number_or_dynamic_value:{type:{static:"具体值",dynamic:"动态值"},dynamic:{setup:"设置",setup_title:"设置动态值",guide:"由函数确定动态值"}},orientation:{label:"朝向",horizontal:"水平",vertical:"垂直"},symbol_size:{label:"标记点大小",static:"固定值",dynamic:"动态值",setup:{label:"设置",title:"设置动态值",description:"由函数确定动态值"}},series:{label:"系列",name:"名称",y_axis:"Y轴",data_field:"数据字段",delete:"删除这个系列",line:{label:"线",line_settings:"线段设置",line_style:"线条样式",type:{label:"类型",solid:"实线",dashed:"方虚线",dotted:"圆点虚线"},line_width:"线宽",step:{label:"阶梯状",off:"不启用",start:"在当前点拐弯",middle:"在当前点与下个点中间拐弯",end:"在下个点拐弯"},smooth_line:"平滑曲线",show_name_on_line:"显示标签文案",show_symbol_on_line:"显示标记点"},bar:{label:"柱",stack:"堆放",stack_hint:"此值相同的柱系列会堆叠在一起",bar_gap:{label:"柱间隔",no_gap:"柱子之间无间隔",overlap:"柱子可互相重叠"},bar_width:{min:"最大柱宽",exact:"柱宽",max:"最大柱宽"}},scatter:{label:"散点"},group_by:{label:"按此字段拆分为多个系列",label_line:"按此字段拆分为多条线"}},axis:{tick_label:"刻度文案",customize_label:"自定义文案",overflow:{label:"溢出",max_width:"最大宽度",truncate:"截断",break_line:"换行",break_word:"断词换行",ellipsis:"省略符",section_title:{on_axis:"轴刻度上文案的溢出",in_tooltip:"提示框中的文案溢出"}},section_title:{label_format:"文案格式"},type:{value:"数值轴",category:"类目轴",time:"时间轴",log:"对数轴",click_to_learn_more:"点击 <1>这里</1> 以进一步了解这些选项"}},name_text:{align:{label:"名称贴靠侧",left:"左",center:"中",right:"右"}},rotate:"旋转",degree:"度",padding:"内间距",content_template:{label:"内容模板",hint:"均值: ${avg}"},x_axis:{label:"X轴",labels:"X轴",label_format:"刻度文案格式",delete:"删除这个X轴",x_axis_name:"X轴名称",x_axis_data_field:"X轴数据字段",x_axis_type:"X轴类型",layout:"布局",position:{label:"位置",top:"上",bottom:"下"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见"},y_axis:{label:"Y轴",labels:"Y轴",label_format:"刻度文案格式",delete:"删除这个Y轴",y_axis_name:"Y轴名称",y_axis_name_anchor:"名称贴靠侧",y_axis_data_field:"Y轴数据字段",layout:"布局",position:{label:"位置",left:"左",right:"右"},value_range:"值范围",value_min:"最小值",value_max:"最大值",behavior:"表现",visible:"可见"},stats:{label:"统计内容",template:{above_chart:"统计内容模板(图表上方)",under_chart:"统计内容模板(图表下方)"}},legend:{label:"图例",show_legend:"显示图例",show_in_legend:"显示在图例中",hide_in_legend:"不显示在图例中",orientation:{label:"布局朝向",horizontal:"横向",vertical:"纵向"}},tooltip:{label:"提示框",additional_metrics:{description:"在此设置更多指标,来展示在散点的提示框",delete:"删除这个指标"},trigger:{label:"触发者",scatter_point:"散点",x_axis:"X轴"}},style:{label:"样式"},color:{label:"颜色",or:"或",set_any_color:"输入色号",pick_a_theme_color:"选择一个主题色",background_color:"背景色",text_color:"文字颜色"},behavior:{label:"表现",invisible:"隐藏不可见"},heatmap:{heatblock:{label:"热力块",min_value:"最小值",max_value:"最大值",show_label:"展示值文案"}},reference_line:{label:"参考线",labels:"参考线",add:"增加一条参考线",name_placeholder:"均值参考线",delete:"删除这条参考线",orientation:{vertical_hint:"仅当X轴值为数字时可绘制"}},regression_line:{label:"回归线",labels:"回归线",add:"增加一条回归线",delete:"删除这条回归线",method:{label:"方法",linear:"线性回归",exponential:"指数回归",logistic:"指数回归",polynomial:"多项式回归",polynomial_order:"次"}},reference_area:{label:"参考区域",labels:"参考区域",add:"增加一面参考区域",delete:"删除这面参考区域",type:{label:"形状",rectangle:"矩形"},direction:{label:"方向",horizontal:"水平"},boundary:{upper:"上边界",lower:"下边界"},content:{label:"内容",content_text:"内容文字",text_position:"文字位置"},endpoint:{labels:"端点",left_bottom_point:"左下点",right_top_point:"右上点"}},zooming:{label:"缩放",scroll:{label:"滚轮缩放",x_axis:"对X轴启用",y_axis:"对Y轴启用"},slider:{label:"滚动条缩放",x_axis:"对X轴启用",y_axis:"对Y轴启用",y_axis_disabled:"暂不可用,会与Y轴刻度文字重叠"}}},viz:{viz_config_banner:"可视化参数配置"},validation:{number:{require_a_number:"请填写一个数字"}}}};ia.use(Zu).use(j.initReactI18next).init({debug:!1,fallbackLng:"en",interpolation:{escapeValue:!1},resources:{en:hD,zh:xD}}),ol.forEach(t=>{var e;(e=t.translation)==null||e.forEach(n=>{ia.addResourceBundle(n.lang,"translation",{viz:n.resources},!0,!0)})});const gD=()=>Promise.resolve().then(()=>Rd).then(({version:t})=>(console.log(`[@devtable/dashboard] version: ${t}`),t));_.APIClient=He,_.CURRENT_SCHEMA_VERSION=pt,_.ContentModel=mi,_.ContentModelContextProvider=Es,_.ContentRenderModel=ki,_.ContextMeta=as,_.DEFAULT_CUSTOM_MODAL_TITLE=is,_.DashboardApiClient=ca,_.DashboardApiFacadeClient=ua,_.DashboardEditor=uD,_.DashboardFilterType=pe,_.DashboardMode=cc,_.DashboardModel=bc,_.DashboardModelContextProvider=zs,_.DashboardRenderModel=Fc,_.DashboardThemeContextProvider=Is,_.DashboardViewEditor=lc,_.DashboardViewRender=ls,_.DataSourceMetaModel=Zr,_.DataSourceType=le,_.DataSourcesMetaModel=Al,_.DatesProvider=$s,_.DefaultApiClient=la,_.DescriptionPopover=di,_.DraftModel=Yl,_.EViewComponentType=L,_.FacadeApiClient=ud,_.FilterCheckboxConfigMeta=Vr,_.FilterDateRangeConfigMeta=Nr,_.FilterMeta=Ur,_.FilterMultiSelectConfigMeta=Gr,_.FilterSelectConfigMeta=Wr,_.FilterTextInputConfigMeta=Qr,_.FilterTreeSelectConfigMeta=Yr,_.FiltersModel=dc,_.FiltersRenderModel=ii,_.FullScreenPanel=sc,_.FullScreenPanelContext=Ps,_.GlobalSQLSnippetMeta=Pl,_.GlobalSQLSnippetsMeta=Hr,_.LayoutItemMeta=vl,_.LayoutSetMeta=jl,_.LayoutStateContext=Mn,_.LayoutsRenderModel=ci,_.MockContextMeta=qr,_.MuteQueryModel=Fl,_.Panel=nc,_.PanelContextProvider=As,_.PanelErrorOrStateMessage=ec,_.PanelMeta=yl,_.PanelModel=gc,_.PanelRender=hi,_.PanelRenderModel=si,_.PanelStyleMeta=xl,_.PanelTitleMeta=gl,_.PanelVizMeta=fl,_.PanelVizSection=pi,_.PanelsModel=mc,_.PanelsRenderModel=ri,_.QueriesModel=hc,_.QueriesRenderModel=li,_.QueryMeta=bl,_.QueryModel=pc,_.QueryRenderModel=oi,_.ReadOnlyDashboard=pD,_.SQLSnippetMeta=_l,_.SQLSnippetRenderModel=Ql,_.SQLSnippetsModel=xc,_.SQLSnippetsRenderModel=ui,_.VariableMeta=ml,_.ViewComponentTypeBackground=uc,_.ViewComponentTypeColor=PS,_.ViewComponentTypeName=AS,_.ViewDivisionConfig=Kr,_.ViewMeta=El,_.ViewModalConfig=Jr,_.ViewRenderModel=ti,_.ViewTabsConfig=Xr,_.ViewsModel=fc,_.ViewsRenderModel=ni,_.Viz=Hl,_.applyPartialDashboard=YS,_.configureAPIClient=js,_.createContentModel=yc,_.createContentRenderModel=Nc,_.createContextMeta=ei,_.createDashboardModel=vc,_.createDashboardRenderModel=Gc,_.createDraft=Ul,_.createFilterCheckboxConfig=wl,_.createFilterDateRangeConfig=Sl,_.createFilterMultiSelectConfig=kl,_.createFilterSelectConfig=Tl,_.createFilterTextInputConfig=Rr,_.createFilterTreeSelectConfig=Dl,_.createViewDivisionConfig=zl,_.createViewModalConfig=Ml,_.createViewTabsConfig=Il,_.facadeApiClient=da,_.formatSQLSnippet=mn,_.getInitialDashboardViewsModel=gi,_.getInitialFiltersConfig=ai,_.getInitialMockContextMeta=Or,_.getInitialQueriesRenderModel=Gl,_.getInitialSQLSnippetsRenderModel=Rl,_.getInitialViewsRenderModel=$l,_.getNewPanel=ql,_.getVersion=gD,_.initialDashboardContent=XC,_.useDashboardContext=Ms,_.useDashboardThemeContext=Sa,_.useEditContentModelContext=Q,_.useEditDashboardContext=X,_.useEditPanelContext=qe,_.useFullScreenPanelContext=Ma,_.usePanelFullScreen=rc,_.useRenderContentModelContext=ue,_.useRenderDashboardContext=wa,_.useRenderPanelContext=vt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|