@advt-gpt-chart/package 3.0.9 → 3.0.10

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/index.es.js CHANGED
@@ -181673,7 +181673,7 @@ function VQe() {
181673
181673
  throw new Error("useGPTVisContext must be used within a GPTVisContext.Provider");
181674
181674
  return i;
181675
181675
  }
181676
- const Yxi = "3.0.9", Sce = /* @__PURE__ */ Qy({});
181676
+ const Yxi = "3.0.10", Sce = /* @__PURE__ */ Qy({});
181677
181677
  function jQe(i) {
181678
181678
  var e, t, n = "";
181679
181679
  if (typeof i == "string" || typeof i == "number") n += i;
@@ -183300,18 +183300,18 @@ function bwi(i, e) {
183300
183300
  }), { metricsOptions: r, dataFormat: o };
183301
183301
  }
183302
183302
  function ywi(i, e, t, n) {
183303
- const { metricsOptions: r, dataFormat: o } = e, { dimensions: a, timeDimension: s = {}, filters: l = [] } = i, u = Di(Me({}, n), { dataType: "TIMESTAMP" }), c = uJe(r), h = Ice(t, c, n), d = a == null ? void 0 : a.map(
183303
+ const { dimensions: r, timeDimension: o = {}, filters: a = [] } = i, { metricsOptions: s, dataFormat: l } = e, u = Di(Me({}, n), { dataType: "TIMESTAMP" }), c = uJe(s), h = Ice(t, c, n), d = (r == null ? void 0 : r.map(
183304
183304
  (f) => h.find(
183305
183305
  (g) => (f == null ? void 0 : f.displayName) === g.label || (f == null ? void 0 : f.dimensionId) === g.value
183306
183306
  )
183307
- ).filter(Boolean);
183308
- return (s == null ? void 0 : s.dimensionName) === (n == null ? void 0 : n.value) && d.unshift(u), {
183309
- metrics: r,
183310
- dataFormat: o,
183307
+ ).filter(Boolean)) || [];
183308
+ return (o == null ? void 0 : o.dimensionName) === (n == null ? void 0 : n.value) && d.unshift(u), {
183309
+ metrics: s,
183310
+ dataFormat: l,
183311
183311
  dimensions: d,
183312
183312
  dissionOptions: h,
183313
- timeDimension: s,
183314
- filters: l,
183313
+ timeDimension: o,
183314
+ filters: a,
183315
183315
  queryMetricOrgId: i == null ? void 0 : i.orgId
183316
183316
  };
183317
183317
  }
@@ -183569,7 +183569,6 @@ const xwi = [
183569
183569
  return {
183570
183570
  queryChartDataFromDatasource: (p, m) => aa(null, null, function* () {
183571
183571
  var S;
183572
- console.log("queryChartDataFromDatasource", p);
183573
183572
  const { metrics: v, dimensions: b, timeGrain: y, dataFormat: _ } = p;
183574
183573
  if (u({
183575
183574
  visible: !1,
@@ -203525,13 +203524,14 @@ function C9i({ theme: i, dataSource: e }) {
203525
203524
  metrics: [],
203526
203525
  dimensions: []
203527
203526
  }), { queryDimensions: m, queryMql2Params: v, queryMetricId: b } = sJe(e == null ? void 0 : e.type), { queryChartDataFromDatasource: y } = Dce(e), _ = (L) => {
203528
- const F = Me({
203527
+ const F = {
203529
203528
  metrics: (L == null ? void 0 : L.metrics) || [],
203530
203529
  dimensions: (L == null ? void 0 : L.dimensions) || [],
203531
203530
  timeRange: kwi(L == null ? void 0 : L.timeRange, e) || {},
203532
203531
  timeGrain: Mwi(L == null ? void 0 : L.timeDimension) || (L == null ? void 0 : L.timeGrain) || (l == null ? void 0 : l.timeGrain),
203533
- filters: awi(L == null ? void 0 : L.filters)
203534
- }, L);
203532
+ filters: awi(L == null ? void 0 : L.filters),
203533
+ queryMetricOrgId: L == null ? void 0 : L.queryMetricOrgId
203534
+ };
203535
203535
  p(F), r(L == null ? void 0 : L.metrics), a((L == null ? void 0 : L.dissionOptions) || []), u({
203536
203536
  metrics: (L == null ? void 0 : L.metrics) || [],
203537
203537
  dimensions: (L == null ? void 0 : L.dissionOptions) || []
Binary file
package/dist/index.umd.js CHANGED
@@ -10586,7 +10586,7 @@ For more details see https://formatjs.github.io/docs/getting-started/message-dis
10586
10586
  `,HT=({loadingText:i})=>we.jsxs(H3i,{className:"gpt-vis-loading",children:[we.jsx("div",{className:"gpt-vis-loading-icon",children:we.jsxs("div",{className:"loading-svg-ele",children:[we.jsx("svg",{width:"0",height:"0",children:we.jsx("defs",{children:we.jsxs("linearGradient",{id:"loadingCircleStrokeGradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[we.jsx("stop",{offset:"0%",stopColor:"#008CD6"}),we.jsx("stop",{offset:"100%",stopColor:"#00CC66"})]})})}),we.jsx("svg",{viewBox:"22 22 44 44",children:we.jsx("circle",{className:"loading-svg-circle",cx:"44",cy:"44",r:"20.2",fill:"none",strokeWidth:"3.6"})})]})}),we.jsx("p",{children:i})]});var Nae=new Map,FL=new WeakMap,MGe=0,$3i;function z3i(i){return i?(FL.has(i)||(MGe+=1,FL.set(i,MGe.toString())),FL.get(i)):"0"}function W3i(i){return Object.keys(i).sort().filter(e=>i[e]!==void 0).map(e=>`${e}_${e==="root"?z3i(i.root):i[e]}`).toString()}function V3i(i){const e=W3i(i);let t=Nae.get(e);if(!t){const n=new Map;let r;const o=new IntersectionObserver(a=>{a.forEach(s=>{var l;const u=s.isIntersecting&&r.some(c=>s.intersectionRatio>=c);i.trackVisibility&&typeof s.isVisible=="undefined"&&(s.isVisible=u),(l=n.get(s.target))==null||l.forEach(c=>{c(u,s)})})},i);r=o.thresholds||(Array.isArray(i.threshold)?i.threshold:[i.threshold||0]),t={id:e,observer:o,elements:n},Nae.set(e,t)}return t}function j3i(i,e,t={},n=$3i){if(typeof window.IntersectionObserver=="undefined"&&n!==void 0){const l=i.getBoundingClientRect();return e(n,{isIntersecting:n,target:i,intersectionRatio:typeof t.threshold=="number"?t.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:r,observer:o,elements:a}=V3i(t),s=a.get(i)||[];return a.has(i)||a.set(i,s),s.push(e),o.observe(i),function(){s.splice(s.indexOf(e),1),s.length===0&&(a.delete(i),o.unobserve(i)),a.size===0&&(o.disconnect(),Nae.delete(r))}}function U3i({threshold:i,delay:e,trackVisibility:t,rootMargin:n,root:r,triggerOnce:o,skip:a,initialInView:s,fallbackInView:l,onChange:u}={}){var c;const[h,d]=M.useState(null),f=M.useRef(u),g=M.useRef(s),[p,m]=M.useState({inView:!!s,entry:void 0});f.current=u,M.useEffect(()=>{if(g.current===void 0&&(g.current=s),a||!h)return;let _;return _=j3i(h,(S,x)=>{const w=g.current;g.current=S,!(w===void 0&&!S)&&(m({inView:S,entry:x}),f.current&&f.current(S,x),x.isIntersecting&&o&&_&&(_(),_=void 0))},{root:r,rootMargin:n,threshold:i,trackVisibility:t,delay:e},l),()=>{_&&_()}},[Array.isArray(i)?i.toString():i,h,r,n,o,a,t,l,e]);const v=(c=p.entry)==null?void 0:c.target,b=M.useRef(void 0);!h&&v&&!o&&!a&&b.current!==v&&(b.current=v,m({inView:!!s,entry:void 0}),g.current=s);const y=[d,p.inView,p.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y}const G3i=Es.div`
10587
10587
  height: 100%;
10588
10588
  width: 100%;
10589
- `,Hae=({visible:i,title:e,message:t})=>i?we.jsx(G3i,{className:"error-container",children:we.jsx(QA,{status:"error",title:e,subTitle:t})}):null,kGe=ce.createContext(null);function OGe(){const i=ce.useContext(kGe);if(i===void 0||Object.keys(i).length===0)throw new Error("useGPTVisContext must be used within a GPTVisContext.Provider");return i}const IGe="3.0.9",$ae=ce.createContext({});function DGe(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=DGe(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function zae(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=DGe(i))&&(n&&(n+=" "),n+=e);return n}const q3i={aliceblue:"9ehhb",antiquewhite:"9sgk7",aqua:"1ekf",aquamarine:"4zsno",azure:"9eiv3",beige:"9lhp8",bisque:"9zg04",black:"0",blanchedalmond:"9zhe5",blue:"73",blueviolet:"5e31e",brown:"6g016",burlywood:"8ouiv",cadetblue:"3qba8",chartreuse:"4zshs",chocolate:"87k0u",coral:"9yvyo",cornflowerblue:"3xael",cornsilk:"9zjz0",crimson:"8l4xo",cyan:"1ekf",darkblue:"3v",darkcyan:"rkb",darkgoldenrod:"776yz",darkgray:"6mbhl",darkgreen:"jr4",darkgrey:"6mbhl",darkkhaki:"7ehkb",darkmagenta:"5f91n",darkolivegreen:"3bzfz",darkorange:"9yygw",darkorchid:"5z6x8",darkred:"5f8xs",darksalmon:"9441m",darkseagreen:"5lwgf",darkslateblue:"2th1n",darkslategray:"1ugcv",darkslategrey:"1ugcv",darkturquoise:"14up",darkviolet:"5rw7n",deeppink:"9yavn",deepskyblue:"11xb",dimgray:"442g9",dimgrey:"442g9",dodgerblue:"16xof",firebrick:"6y7tu",floralwhite:"9zkds",forestgreen:"1cisi",fuchsia:"9y70f",gainsboro:"8m8kc",ghostwhite:"9pq0v",goldenrod:"8j4f4",gold:"9zda8",gray:"50i2o",green:"pa8",greenyellow:"6senj",grey:"50i2o",honeydew:"9eiuo",hotpink:"9yrp0",indianred:"80gnw",indigo:"2xcoy",ivory:"9zldc",khaki:"9edu4",lavenderblush:"9ziet",lavender:"90c8q",lawngreen:"4vk74",lemonchiffon:"9zkct",lightblue:"6s73a",lightcoral:"9dtog",lightcyan:"8s1rz",lightgoldenrodyellow:"9sjiq",lightgray:"89jo3",lightgreen:"5nkwg",lightgrey:"89jo3",lightpink:"9z6wx",lightsalmon:"9z2ii",lightseagreen:"19xgq",lightskyblue:"5arju",lightslategray:"4nwk9",lightslategrey:"4nwk9",lightsteelblue:"6wau6",lightyellow:"9zlcw",lime:"1edc",limegreen:"1zcxe",linen:"9shk6",magenta:"9y70f",maroon:"4zsow",mediumaquamarine:"40eju",mediumblue:"5p",mediumorchid:"79qkz",mediumpurple:"5r3rv",mediumseagreen:"2d9ip",mediumslateblue:"4tcku",mediumspringgreen:"1di2",mediumturquoise:"2uabw",mediumvioletred:"7rn9h",midnightblue:"z980",mintcream:"9ljp6",mistyrose:"9zg0x",moccasin:"9zfzp",navajowhite:"9zest",navy:"3k",oldlace:"9wq92",olive:"50hz4",olivedrab:"472ub",orange:"9z3eo",orangered:"9ykg0",orchid:"8iu3a",palegoldenrod:"9bl4a",palegreen:"5yw0o",paleturquoise:"6v4ku",palevioletred:"8k8lv",papayawhip:"9zi6t",peachpuff:"9ze0p",peru:"80oqn",pink:"9z8wb",plum:"8nba5",powderblue:"6wgdi",purple:"4zssg",rebeccapurple:"3zk49",red:"9y6tc",rosybrown:"7cv4f",royalblue:"2jvtt",saddlebrown:"5fmkz",salmon:"9rvci",sandybrown:"9jn1c",seagreen:"1tdnb",seashell:"9zje6",sienna:"6973h",silver:"7ir40",skyblue:"5arjf",slateblue:"45e4t",slategray:"4e100",slategrey:"4e100",snow:"9zke2",springgreen:"1egv",steelblue:"2r1kk",tan:"87yx8",teal:"pds",thistle:"8ggk8",tomato:"9yqfb",turquoise:"2j4r4",violet:"9b10u",wheat:"9ld4j",white:"9zldr",whitesmoke:"9lhpx",yellow:"9zl6o",yellowgreen:"61fzm"},ou=Math.round;function Wae(i,e){const t=i.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],n=t.map(r=>parseFloat(r));for(let r=0;r<3;r+=1)n[r]=e(n[r]||0,t[r]||"",r);return t[3]?n[3]=t[3].includes("%")?n[3]/100:n[3]:n[3]=1,n}const PGe=(i,e,t)=>t===0?i:i/100;function $T(i,e){const t=e||255;return i>t?t:i<0?0:i}class yS{constructor(e){sc(this,"isValid",!0);sc(this,"r",0);sc(this,"g",0);sc(this,"b",0);sc(this,"a",1);sc(this,"_h");sc(this,"_s");sc(this,"_l");sc(this,"_v");sc(this,"_max");sc(this,"_min");sc(this,"_brightness");function t(n){return n[0]in e&&n[1]in e&&n[2]in e}if(e)if(typeof e=="string"){let r=function(o){return n.startsWith(o)};const n=e.trim();if(/^#?[A-F\d]{3,8}$/i.test(n))this.fromHexString(n);else if(r("rgb"))this.fromRgbString(n);else if(r("hsl"))this.fromHslString(n);else if(r("hsv")||r("hsb"))this.fromHsvString(n);else{const o=q3i[n.toLowerCase()];o&&this.fromHexString(parseInt(o,36).toString(16).padStart(6,"0"))}}else if(e instanceof yS)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=$T(e.r),this.g=$T(e.g),this.b=$T(e.b),this.a=typeof e.a=="number"?$T(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else if(t("hsv"))this.fromHsv(e);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e))}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(o){const a=o/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)}const t=e(this.r),n=e(this.g),r=e(this.b);return .2126*t+.7152*n+.0722*r}getHue(){if(typeof this._h=="undefined"){const e=this.getMax()-this.getMin();e===0?this._h=0:this._h=ou(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(typeof this._s=="undefined"){const e=this.getMax()-this.getMin();e===0?this._s=0:this._s=e/this.getMax()}return this._s}getLightness(){return typeof this._l=="undefined"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v=="undefined"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness=="undefined"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,o=s=>(n[s]-this[s])*r+this[s],a={r:ou(o("r")),g:ou(o("g")),b:ou(o("b")),a:ou(o("a")*100)/100};return this._c(a)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=o=>ou((this[o]*this.a+t[o]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=t.length===2?t:"0"+t;const n=(this.g||0).toString(16);e+=n.length===2?n:"0"+n;const r=(this.b||0).toString(16);if(e+=r.length===2?r:"0"+r,typeof this.a=="number"&&this.a>=0&&this.a<1){const o=ou(this.a*255).toString(16);e+=o.length===2?o:"0"+o}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=ou(this.getSaturation()*100),n=ou(this.getLightness()*100);return this.a!==1?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=$T(t,n),r}_c(e){return new this.constructor(e)}getMax(){return typeof this._max=="undefined"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min=="undefined"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(r,o){return parseInt(t[r]+t[o||r],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a=typeof r=="number"?r:1,t<=0){const d=ou(n*255);this.r=d,this.g=d,this.b=d}let o=0,a=0,s=0;const l=e/60,u=(1-Math.abs(2*n-1))*t,c=u*(1-Math.abs(l%2-1));l>=0&&l<1?(o=u,a=c):l>=1&&l<2?(o=c,a=u):l>=2&&l<3?(a=u,s=c):l>=3&&l<4?(a=c,s=u):l>=4&&l<5?(o=c,s=u):l>=5&&l<6&&(o=u,s=c);const h=n-u/2;this.r=ou((o+h)*255),this.g=ou((a+h)*255),this.b=ou((s+h)*255)}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a=typeof r=="number"?r:1;const o=ou(n*255);if(this.r=o,this.g=o,this.b=o,t<=0)return;const a=e/60,s=Math.floor(a),l=a-s,u=ou(n*(1-t)*255),c=ou(n*(1-t*l)*255),h=ou(n*(1-t*(1-l))*255);switch(s){case 0:this.g=h,this.b=u;break;case 1:this.r=c,this.b=u;break;case 2:this.r=u,this.b=h;break;case 3:this.r=u,this.g=c;break;case 4:this.r=h,this.g=u;break;case 5:default:this.g=u,this.b=c;break}}fromHsvString(e){const t=Wae(e,PGe);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Wae(e,PGe);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Wae(e,(n,r)=>r.includes("%")?ou(n/100*255):n);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}const NL=2,LGe=.16,Y3i=.05,X3i=.05,K3i=.15,BGe=5,FGe=4,Z3i=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function NGe(i,e,t){let n;return Math.round(i.h)>=60&&Math.round(i.h)<=240?n=t?Math.round(i.h)-NL*e:Math.round(i.h)+NL*e:n=t?Math.round(i.h)+NL*e:Math.round(i.h)-NL*e,n<0?n+=360:n>=360&&(n-=360),n}function HGe(i,e,t){if(i.h===0&&i.s===0)return i.s;let n;return t?n=i.s-LGe*e:e===FGe?n=i.s+LGe:n=i.s+Y3i*e,n>1&&(n=1),t&&e===BGe&&n>.1&&(n=.1),n<.06&&(n=.06),Math.round(n*100)/100}function $Ge(i,e,t){let n;return t?n=i.v+X3i*e:n=i.v-K3i*e,n=Math.max(0,Math.min(1,n)),Math.round(n*100)/100}function Q3i(i,e={}){const t=[],n=new yS(i),r=n.toHsv();for(let o=BGe;o>0;o-=1){const a=new yS({h:NGe(r,o,!0),s:HGe(r,o,!0),v:$Ge(r,o,!0)});t.push(a)}t.push(n);for(let o=1;o<=FGe;o+=1){const a=new yS({h:NGe(r,o),s:HGe(r,o),v:$Ge(r,o)});t.push(a)}return e.theme==="dark"?Z3i.map(({index:o,amount:a})=>new yS(e.backgroundColor||"#141414").mix(t[o],a).toHexString()):t.map(o=>o.toHexString())}const Vae=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Vae.primary=Vae[5];function J3i(){return!!(typeof window!="undefined"&&window.document&&window.document.createElement)}function exi(i,e){if(!i)return!1;if(i.contains)return i.contains(e);let t=e;for(;t;){if(t===i)return!0;t=t.parentNode}return!1}const zGe="data-rc-order",WGe="data-rc-priority",txi="rc-util-key",jae=new Map;function VGe({mark:i}={}){return i?i.startsWith("data-")?i:`data-${i}`:txi}function Uae(i){return i.attachTo?i.attachTo:document.querySelector("head")||document.body}function ixi(i){return i==="queue"?"prependQueue":i?"prepend":"append"}function Gae(i){return Array.from((jae.get(i)||i).children).filter(e=>e.tagName==="STYLE")}function jGe(i,e={}){if(!J3i())return null;const{csp:t,prepend:n,priority:r=0}=e,o=ixi(n),a=o==="prependQueue",s=document.createElement("style");s.setAttribute(zGe,o),a&&r&&s.setAttribute(WGe,`${r}`),t!=null&&t.nonce&&(s.nonce=t==null?void 0:t.nonce),s.innerHTML=i;const l=Uae(e),{firstChild:u}=l;if(n){if(a){const c=(e.styles||Gae(l)).filter(h=>{if(!["prepend","prependQueue"].includes(h.getAttribute(zGe)))return!1;const d=Number(h.getAttribute(WGe)||0);return r>=d});if(c.length)return l.insertBefore(s,c[c.length-1].nextSibling),s}l.insertBefore(s,u)}else l.appendChild(s);return s}function nxi(i,e={}){let{styles:t}=e;return t||(t=Gae(Uae(e))),t.find(n=>n.getAttribute(VGe(e))===i)}function rxi(i,e){const t=jae.get(i);if(!t||!exi(document,t)){const n=jGe("",e),{parentNode:r}=n;jae.set(i,r),i.removeChild(n)}}function oxi(i,e,t={}){var l,u,c;const n=Uae(t),r=Gae(n),o=Pi(ke({},t),{styles:r});rxi(n,o);const a=nxi(e,o);if(a)return(l=o.csp)!=null&&l.nonce&&a.nonce!==((u=o.csp)==null?void 0:u.nonce)&&(a.nonce=(c=o.csp)==null?void 0:c.nonce),a.innerHTML!==i&&(a.innerHTML=i),a;const s=jGe(i,o);return s.setAttribute(VGe(o),e),s}function UGe(i){var e;return(e=i==null?void 0:i.getRootNode)==null?void 0:e.call(i)}function axi(i){return UGe(i)instanceof ShadowRoot}function sxi(i){return axi(i)?UGe(i):null}var GGe={};let qae={};const Yae=[],lxi=i=>{Yae.push(i)};function uxi(i,e){if(GGe.NODE_ENV!=="production"&&!i&&console!==void 0){const t=Yae.reduce((n,r)=>r(n!=null?n:"","warning"),e);t&&console.error(`Warning: ${t}`)}}function cxi(i,e){if(GGe.NODE_ENV!=="production"&&!i&&console!==void 0){const t=Yae.reduce((n,r)=>r(n!=null?n:"","note"),e);t&&console.warn(`Note: ${t}`)}}function hxi(){qae={}}function qGe(i,e,t){!e&&!qae[t]&&(i(!1,t),qae[t]=!0)}function HL(i,e){qGe(uxi,i,e)}function dxi(i,e){qGe(cxi,i,e)}HL.preMessage=lxi,HL.resetWarned=hxi,HL.noteOnce=dxi;function fxi(i){return i.replace(/-(.)/g,(e,t)=>t.toUpperCase())}function Xae(i,e){HL(i,`[@ant-design/icons] ${e}`)}function YGe(i){return typeof i=="object"&&typeof i.name=="string"&&typeof i.theme=="string"&&(typeof i.icon=="object"||typeof i.icon=="function")}function XGe(i={}){return Object.keys(i).reduce((e,t)=>{const n=i[t];switch(t){case"class":e.className=n,delete e.class;break;default:delete e[t],e[fxi(t)]=n}return e},{})}function Kae(i,e,t){return t?ce.createElement(i.tag,ke(ke({key:e},XGe(i.attrs)),t),(i.children||[]).map((n,r)=>Kae(n,`${e}-${i.tag}-${r}`))):ce.createElement(i.tag,ke({key:e},XGe(i.attrs)),(i.children||[]).map((n,r)=>Kae(n,`${e}-${i.tag}-${r}`)))}function KGe(i){return Q3i(i)[0]}function ZGe(i){return i?Array.isArray(i)?i:[i]:[]}const gxi={width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",focusable:"false"},pxi=`
10589
+ `,Hae=({visible:i,title:e,message:t})=>i?we.jsx(G3i,{className:"error-container",children:we.jsx(QA,{status:"error",title:e,subTitle:t})}):null,kGe=ce.createContext(null);function OGe(){const i=ce.useContext(kGe);if(i===void 0||Object.keys(i).length===0)throw new Error("useGPTVisContext must be used within a GPTVisContext.Provider");return i}const IGe="3.0.10",$ae=ce.createContext({});function DGe(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=DGe(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function zae(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=DGe(i))&&(n&&(n+=" "),n+=e);return n}const q3i={aliceblue:"9ehhb",antiquewhite:"9sgk7",aqua:"1ekf",aquamarine:"4zsno",azure:"9eiv3",beige:"9lhp8",bisque:"9zg04",black:"0",blanchedalmond:"9zhe5",blue:"73",blueviolet:"5e31e",brown:"6g016",burlywood:"8ouiv",cadetblue:"3qba8",chartreuse:"4zshs",chocolate:"87k0u",coral:"9yvyo",cornflowerblue:"3xael",cornsilk:"9zjz0",crimson:"8l4xo",cyan:"1ekf",darkblue:"3v",darkcyan:"rkb",darkgoldenrod:"776yz",darkgray:"6mbhl",darkgreen:"jr4",darkgrey:"6mbhl",darkkhaki:"7ehkb",darkmagenta:"5f91n",darkolivegreen:"3bzfz",darkorange:"9yygw",darkorchid:"5z6x8",darkred:"5f8xs",darksalmon:"9441m",darkseagreen:"5lwgf",darkslateblue:"2th1n",darkslategray:"1ugcv",darkslategrey:"1ugcv",darkturquoise:"14up",darkviolet:"5rw7n",deeppink:"9yavn",deepskyblue:"11xb",dimgray:"442g9",dimgrey:"442g9",dodgerblue:"16xof",firebrick:"6y7tu",floralwhite:"9zkds",forestgreen:"1cisi",fuchsia:"9y70f",gainsboro:"8m8kc",ghostwhite:"9pq0v",goldenrod:"8j4f4",gold:"9zda8",gray:"50i2o",green:"pa8",greenyellow:"6senj",grey:"50i2o",honeydew:"9eiuo",hotpink:"9yrp0",indianred:"80gnw",indigo:"2xcoy",ivory:"9zldc",khaki:"9edu4",lavenderblush:"9ziet",lavender:"90c8q",lawngreen:"4vk74",lemonchiffon:"9zkct",lightblue:"6s73a",lightcoral:"9dtog",lightcyan:"8s1rz",lightgoldenrodyellow:"9sjiq",lightgray:"89jo3",lightgreen:"5nkwg",lightgrey:"89jo3",lightpink:"9z6wx",lightsalmon:"9z2ii",lightseagreen:"19xgq",lightskyblue:"5arju",lightslategray:"4nwk9",lightslategrey:"4nwk9",lightsteelblue:"6wau6",lightyellow:"9zlcw",lime:"1edc",limegreen:"1zcxe",linen:"9shk6",magenta:"9y70f",maroon:"4zsow",mediumaquamarine:"40eju",mediumblue:"5p",mediumorchid:"79qkz",mediumpurple:"5r3rv",mediumseagreen:"2d9ip",mediumslateblue:"4tcku",mediumspringgreen:"1di2",mediumturquoise:"2uabw",mediumvioletred:"7rn9h",midnightblue:"z980",mintcream:"9ljp6",mistyrose:"9zg0x",moccasin:"9zfzp",navajowhite:"9zest",navy:"3k",oldlace:"9wq92",olive:"50hz4",olivedrab:"472ub",orange:"9z3eo",orangered:"9ykg0",orchid:"8iu3a",palegoldenrod:"9bl4a",palegreen:"5yw0o",paleturquoise:"6v4ku",palevioletred:"8k8lv",papayawhip:"9zi6t",peachpuff:"9ze0p",peru:"80oqn",pink:"9z8wb",plum:"8nba5",powderblue:"6wgdi",purple:"4zssg",rebeccapurple:"3zk49",red:"9y6tc",rosybrown:"7cv4f",royalblue:"2jvtt",saddlebrown:"5fmkz",salmon:"9rvci",sandybrown:"9jn1c",seagreen:"1tdnb",seashell:"9zje6",sienna:"6973h",silver:"7ir40",skyblue:"5arjf",slateblue:"45e4t",slategray:"4e100",slategrey:"4e100",snow:"9zke2",springgreen:"1egv",steelblue:"2r1kk",tan:"87yx8",teal:"pds",thistle:"8ggk8",tomato:"9yqfb",turquoise:"2j4r4",violet:"9b10u",wheat:"9ld4j",white:"9zldr",whitesmoke:"9lhpx",yellow:"9zl6o",yellowgreen:"61fzm"},ou=Math.round;function Wae(i,e){const t=i.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],n=t.map(r=>parseFloat(r));for(let r=0;r<3;r+=1)n[r]=e(n[r]||0,t[r]||"",r);return t[3]?n[3]=t[3].includes("%")?n[3]/100:n[3]:n[3]=1,n}const PGe=(i,e,t)=>t===0?i:i/100;function $T(i,e){const t=e||255;return i>t?t:i<0?0:i}class yS{constructor(e){sc(this,"isValid",!0);sc(this,"r",0);sc(this,"g",0);sc(this,"b",0);sc(this,"a",1);sc(this,"_h");sc(this,"_s");sc(this,"_l");sc(this,"_v");sc(this,"_max");sc(this,"_min");sc(this,"_brightness");function t(n){return n[0]in e&&n[1]in e&&n[2]in e}if(e)if(typeof e=="string"){let r=function(o){return n.startsWith(o)};const n=e.trim();if(/^#?[A-F\d]{3,8}$/i.test(n))this.fromHexString(n);else if(r("rgb"))this.fromRgbString(n);else if(r("hsl"))this.fromHslString(n);else if(r("hsv")||r("hsb"))this.fromHsvString(n);else{const o=q3i[n.toLowerCase()];o&&this.fromHexString(parseInt(o,36).toString(16).padStart(6,"0"))}}else if(e instanceof yS)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=$T(e.r),this.g=$T(e.g),this.b=$T(e.b),this.a=typeof e.a=="number"?$T(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else if(t("hsv"))this.fromHsv(e);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e))}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(o){const a=o/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)}const t=e(this.r),n=e(this.g),r=e(this.b);return .2126*t+.7152*n+.0722*r}getHue(){if(typeof this._h=="undefined"){const e=this.getMax()-this.getMin();e===0?this._h=0:this._h=ou(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(typeof this._s=="undefined"){const e=this.getMax()-this.getMin();e===0?this._s=0:this._s=e/this.getMax()}return this._s}getLightness(){return typeof this._l=="undefined"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v=="undefined"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness=="undefined"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,o=s=>(n[s]-this[s])*r+this[s],a={r:ou(o("r")),g:ou(o("g")),b:ou(o("b")),a:ou(o("a")*100)/100};return this._c(a)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=o=>ou((this[o]*this.a+t[o]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=t.length===2?t:"0"+t;const n=(this.g||0).toString(16);e+=n.length===2?n:"0"+n;const r=(this.b||0).toString(16);if(e+=r.length===2?r:"0"+r,typeof this.a=="number"&&this.a>=0&&this.a<1){const o=ou(this.a*255).toString(16);e+=o.length===2?o:"0"+o}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=ou(this.getSaturation()*100),n=ou(this.getLightness()*100);return this.a!==1?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=$T(t,n),r}_c(e){return new this.constructor(e)}getMax(){return typeof this._max=="undefined"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min=="undefined"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(r,o){return parseInt(t[r]+t[o||r],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a=typeof r=="number"?r:1,t<=0){const d=ou(n*255);this.r=d,this.g=d,this.b=d}let o=0,a=0,s=0;const l=e/60,u=(1-Math.abs(2*n-1))*t,c=u*(1-Math.abs(l%2-1));l>=0&&l<1?(o=u,a=c):l>=1&&l<2?(o=c,a=u):l>=2&&l<3?(a=u,s=c):l>=3&&l<4?(a=c,s=u):l>=4&&l<5?(o=c,s=u):l>=5&&l<6&&(o=u,s=c);const h=n-u/2;this.r=ou((o+h)*255),this.g=ou((a+h)*255),this.b=ou((s+h)*255)}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a=typeof r=="number"?r:1;const o=ou(n*255);if(this.r=o,this.g=o,this.b=o,t<=0)return;const a=e/60,s=Math.floor(a),l=a-s,u=ou(n*(1-t)*255),c=ou(n*(1-t*l)*255),h=ou(n*(1-t*(1-l))*255);switch(s){case 0:this.g=h,this.b=u;break;case 1:this.r=c,this.b=u;break;case 2:this.r=u,this.b=h;break;case 3:this.r=u,this.g=c;break;case 4:this.r=h,this.g=u;break;case 5:default:this.g=u,this.b=c;break}}fromHsvString(e){const t=Wae(e,PGe);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Wae(e,PGe);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Wae(e,(n,r)=>r.includes("%")?ou(n/100*255):n);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}const NL=2,LGe=.16,Y3i=.05,X3i=.05,K3i=.15,BGe=5,FGe=4,Z3i=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function NGe(i,e,t){let n;return Math.round(i.h)>=60&&Math.round(i.h)<=240?n=t?Math.round(i.h)-NL*e:Math.round(i.h)+NL*e:n=t?Math.round(i.h)+NL*e:Math.round(i.h)-NL*e,n<0?n+=360:n>=360&&(n-=360),n}function HGe(i,e,t){if(i.h===0&&i.s===0)return i.s;let n;return t?n=i.s-LGe*e:e===FGe?n=i.s+LGe:n=i.s+Y3i*e,n>1&&(n=1),t&&e===BGe&&n>.1&&(n=.1),n<.06&&(n=.06),Math.round(n*100)/100}function $Ge(i,e,t){let n;return t?n=i.v+X3i*e:n=i.v-K3i*e,n=Math.max(0,Math.min(1,n)),Math.round(n*100)/100}function Q3i(i,e={}){const t=[],n=new yS(i),r=n.toHsv();for(let o=BGe;o>0;o-=1){const a=new yS({h:NGe(r,o,!0),s:HGe(r,o,!0),v:$Ge(r,o,!0)});t.push(a)}t.push(n);for(let o=1;o<=FGe;o+=1){const a=new yS({h:NGe(r,o),s:HGe(r,o),v:$Ge(r,o)});t.push(a)}return e.theme==="dark"?Z3i.map(({index:o,amount:a})=>new yS(e.backgroundColor||"#141414").mix(t[o],a).toHexString()):t.map(o=>o.toHexString())}const Vae=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];Vae.primary=Vae[5];function J3i(){return!!(typeof window!="undefined"&&window.document&&window.document.createElement)}function exi(i,e){if(!i)return!1;if(i.contains)return i.contains(e);let t=e;for(;t;){if(t===i)return!0;t=t.parentNode}return!1}const zGe="data-rc-order",WGe="data-rc-priority",txi="rc-util-key",jae=new Map;function VGe({mark:i}={}){return i?i.startsWith("data-")?i:`data-${i}`:txi}function Uae(i){return i.attachTo?i.attachTo:document.querySelector("head")||document.body}function ixi(i){return i==="queue"?"prependQueue":i?"prepend":"append"}function Gae(i){return Array.from((jae.get(i)||i).children).filter(e=>e.tagName==="STYLE")}function jGe(i,e={}){if(!J3i())return null;const{csp:t,prepend:n,priority:r=0}=e,o=ixi(n),a=o==="prependQueue",s=document.createElement("style");s.setAttribute(zGe,o),a&&r&&s.setAttribute(WGe,`${r}`),t!=null&&t.nonce&&(s.nonce=t==null?void 0:t.nonce),s.innerHTML=i;const l=Uae(e),{firstChild:u}=l;if(n){if(a){const c=(e.styles||Gae(l)).filter(h=>{if(!["prepend","prependQueue"].includes(h.getAttribute(zGe)))return!1;const d=Number(h.getAttribute(WGe)||0);return r>=d});if(c.length)return l.insertBefore(s,c[c.length-1].nextSibling),s}l.insertBefore(s,u)}else l.appendChild(s);return s}function nxi(i,e={}){let{styles:t}=e;return t||(t=Gae(Uae(e))),t.find(n=>n.getAttribute(VGe(e))===i)}function rxi(i,e){const t=jae.get(i);if(!t||!exi(document,t)){const n=jGe("",e),{parentNode:r}=n;jae.set(i,r),i.removeChild(n)}}function oxi(i,e,t={}){var l,u,c;const n=Uae(t),r=Gae(n),o=Pi(ke({},t),{styles:r});rxi(n,o);const a=nxi(e,o);if(a)return(l=o.csp)!=null&&l.nonce&&a.nonce!==((u=o.csp)==null?void 0:u.nonce)&&(a.nonce=(c=o.csp)==null?void 0:c.nonce),a.innerHTML!==i&&(a.innerHTML=i),a;const s=jGe(i,o);return s.setAttribute(VGe(o),e),s}function UGe(i){var e;return(e=i==null?void 0:i.getRootNode)==null?void 0:e.call(i)}function axi(i){return UGe(i)instanceof ShadowRoot}function sxi(i){return axi(i)?UGe(i):null}var GGe={};let qae={};const Yae=[],lxi=i=>{Yae.push(i)};function uxi(i,e){if(GGe.NODE_ENV!=="production"&&!i&&console!==void 0){const t=Yae.reduce((n,r)=>r(n!=null?n:"","warning"),e);t&&console.error(`Warning: ${t}`)}}function cxi(i,e){if(GGe.NODE_ENV!=="production"&&!i&&console!==void 0){const t=Yae.reduce((n,r)=>r(n!=null?n:"","note"),e);t&&console.warn(`Note: ${t}`)}}function hxi(){qae={}}function qGe(i,e,t){!e&&!qae[t]&&(i(!1,t),qae[t]=!0)}function HL(i,e){qGe(uxi,i,e)}function dxi(i,e){qGe(cxi,i,e)}HL.preMessage=lxi,HL.resetWarned=hxi,HL.noteOnce=dxi;function fxi(i){return i.replace(/-(.)/g,(e,t)=>t.toUpperCase())}function Xae(i,e){HL(i,`[@ant-design/icons] ${e}`)}function YGe(i){return typeof i=="object"&&typeof i.name=="string"&&typeof i.theme=="string"&&(typeof i.icon=="object"||typeof i.icon=="function")}function XGe(i={}){return Object.keys(i).reduce((e,t)=>{const n=i[t];switch(t){case"class":e.className=n,delete e.class;break;default:delete e[t],e[fxi(t)]=n}return e},{})}function Kae(i,e,t){return t?ce.createElement(i.tag,ke(ke({key:e},XGe(i.attrs)),t),(i.children||[]).map((n,r)=>Kae(n,`${e}-${i.tag}-${r}`))):ce.createElement(i.tag,ke({key:e},XGe(i.attrs)),(i.children||[]).map((n,r)=>Kae(n,`${e}-${i.tag}-${r}`)))}function KGe(i){return Q3i(i)[0]}function ZGe(i){return i?Array.isArray(i)?i:[i]:[]}const gxi={width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",focusable:"false"},pxi=`
10590
10590
  .anticon {
10591
10591
  display: inline-flex;
10592
10592
  align-items: center;
@@ -10723,7 +10723,7 @@ ${r}
10723
10723
  }
10724
10724
  }
10725
10725
  `}
10726
- `,rd=i=>{var l;const s=i,{prefix:e,allowClear:t}=s,n=Rh(s,["prefix","allowClear"]),[r,o]=ce.useState((l=i==null?void 0:i.open)!=null?l:!1);ce.useEffect(()=>{(i==null?void 0:i.open)!==void 0&&o(i==null?void 0:i.open)},[i==null?void 0:i.open]);const a=u=>{if(i!=null&&i.onOpenChange){i==null||i.onOpenChange(u);return}o(u)};return we.jsxs(Yf,{theme:Xxi,children:[we.jsx(Zxi,{}),we.jsx(Kxi,{className:r?"open":"",children:we.jsx(hm,ke({prefix:e?we.jsx("span",{className:r?"open":"",children:e}):void 0,suffixIcon:we.jsxs(we.Fragment,{children:[r&&we.jsx("div",{className:"suffixIcon",children:we.jsx(rse,{style:{color:"#008CD6",pointerEvents:"none"}})}),!r&&we.jsx("div",{className:"suffixIcon",children:we.jsx(Jae,{style:{color:"#89898a",pointerEvents:"none"}})})]}),maxTagCount:"responsive",allowClear:t?{clearIcon:we.jsx(ase,{className:"clear-icon"})}:!1,onOpenChange:a},n))})]})},Qxi="http://localhost";class Jxi{constructor({baseURL:e=Qxi,host:t,protocol:n,timeout:r=6e5,headers:o}={}){var s,l,u;this.host=t||((s=window.location)==null?void 0:s.host),this.protocol=n||(["http:","https:"].includes((l=window==null?void 0:window.location)==null?void 0:l.protocol)?(u=window==null?void 0:window.location)==null?void 0:u.protocol:void 0);const a=new URL(this.host||this.protocol?`${this.protocol||"https:"}//${this.host||"localhost"}`:e,window.location.href);this.baseURL=a.href.replace(/\/+$/,""),this.host=a.host,this.protocol=a.protocol,this.timeout=r,this.headers=o||{"Content-Type":"application/json"},this.instance=Xs.create({baseURL:this.baseURL,timeout:this.timeout,headers:this.headers})}get(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"GET"}))})}delete(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"DELETE"}))})}put(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"PUT"}))})}post(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"POST"}))})}patch(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"PATCH"}))})}ping(){return this.request({url:"/api/ping",method:"GET",retry:1})}request(e){return ga(this,null,function*(){return this.instance(e).then(t=>{const{status:n,config:r}=t;return(r==null?void 0:r.method)==="delete"&&(n===200||n===201)?{message:"delete success"}:{data:t.data}}).catch(t=>Promise.reject(t))})}}const WT=new Jxi,eSi=i=>mAt({},v$e,i,t=>{if(Array.isArray(t))return t}),tSi=[{key:"basic",label:"Basic",value:"basic"},{key:"customSql",label:"Custom SQL",value:"customSql"}],hse=[{key:"equal",label:"Equal",value:"equal"},{key:"notEqual",label:"Not equal",value:"not equal"},{key:"isNull",label:"Is null",value:"is null"},{key:"isNotNull",label:"Is not null",value:"is not null"},{key:"greaterThan",label:"Greater than",value:"greater than"},{key:"greaterThanOrEqualto",label:"Greater than or equal to",value:"greater than or equal to"},{key:"lessThan",label:"Less than",value:"less than"},{key:"lessThanEqualTo",label:"Less than or equal to",value:"less than or equal to"},{key:"contains",label:"Contains",value:"contains"},{key:"notContains",label:"Not contains",value:"not contains"},{key:"StartsWith",label:"Starts with",value:"starts with"},{key:"doesNotStartWith",label:"Does not start with",value:"does not start with"},{key:"endsWith",label:"Ends with",value:"ends with"},{key:"doesNotEndWith",label:"Does not end with",value:"does not end with"}],iSi={equal:"=",notEqual:"!=",isNull:"IS NULL",isNotNull:"IS NOT NULL",greaterThan:">",greaterThanOrEqualto:">=",lessThan:"<",lessThanEqualTo:"<=",contains:"LIKE",notContains:"NOT LIKE",StartsWith:"LIKE",doesNotStartWith:"NOT LIKE",endsWith:"LIKE",doesNotEndWith:"NOT LIKE"},nSi=[{key:"where",label:"WHERE",value:"WHERE"},{key:"having",label:"HAVING",value:"HAVING"}];function dse(i,e){const t=e==null?void 0:e.find(n=>n.value===i.dimensionId||n.label===i.name);return t?{datasetName:t.datasetName,dimensionColumn:t.dimensionColumn,englishName:t.englishName,dimensionId:t.value}:null}const rSi=i=>i?i==null?void 0:i.map(e=>ke({},e.subFilter)):[],oSi=i=>{const e="/metricInsight/api/v1/metric/"+i;return WT.get({url:e}).then(t=>t.data||[])},aSi=i=>{const e="/metricInsight/api/v1/dimension/metric?mode=intersect&metricIds="+i.join(",");return WT.get({url:e}).then(t=>{var n;return((n=t==null?void 0:t.data)==null?void 0:n.items)||[]})},sSi=i=>WT.post({url:"/metricInsight/api/v1/mql/params",data:i}).then(t=>(t==null?void 0:t.data)||[]),lSi=(i,e)=>i!=null&&i.mql?cSi(i,e):uSi(e),uSi=({timeRange:i,metrics:e,dimensions:t,timeGrain:n,filters:r,queryMetricOrgId:o})=>{const a=e==null?void 0:e.map(f=>f.value),s=a==null?void 0:a[0],l=t==null?void 0:t.some(f=>f.value==="metricTime");let u=t,c;l&&(u=t==null?void 0:t.filter(f=>f.value!=="metricTime"),c={dimensionName:"metricTime",dimensionUnit:n});const h={orgId:o,metricIds:a,timeRange:i,dimensionIds:u==null?void 0:u.map(f=>f.value)};(i==null?void 0:i.type)==="custom"&&(i!=null&&i.custom)&&(h.timeRange.custom={from:Ir(i.custom.from).format(GM),to:Ir(i.custom.to).format(GM)}),c&&(h.timeDimension=c),r&&r.length>0&&(h.filters=r.map(f=>({conjunction:"AND",subFilter:ke({},f)})));const d=`/metricInsight/api/v1/metric/${s}/preview`;return WT.post({url:d,data:h}).then(f=>(f==null?void 0:f.data)||[])},cSi=(i,{timeRange:e,metrics:t,dimensions:n,timeGrain:r,filters:o,queryMetricOrgId:a,queryType:s})=>{const l=i==null?void 0:i.mql,u={dimensions:[],metricDefinitions:{},metrics:[],timeConstraint:{},filters:{},orders:(l==null?void 0:l.orders)||{},limits:(l==null?void 0:l.limits)||{},orgId:a,queryType:s},c=n==null?void 0:n.map(f=>{let g=(f==null?void 0:f.englishName)||(f==null?void 0:f.label);return f.value==="metricTime"&&(g="metric_time__"+r),g});u.dimensions={};let h=o==null?void 0:o.map(f=>{var g;return f.type==="basic"?dSi(f==null?void 0:f.basic):f.type==="customSql"?(g=f==null?void 0:f.sql)==null?void 0:g.filterCondition:null}).filter(f=>f!==null&&f.trim()!=="");return t==null||t.forEach(f=>{const g=(f==null?void 0:f.displayName)||(f==null?void 0:f.label);u.metrics.push(g),u.dimensions[g]=c,u.metricDefinitions[g]=f.metricDefinitions,u.filters[g]=h||[],u.timeConstraint[g]=e||{}}),WT.post({url:"/metricInsight/api/v1/mql/query",data:u}).then(f=>{var g;return((g=f==null?void 0:f.data)==null?void 0:g[0])||[]})},hSi=i=>{const{data:e}=i;if(!e)return[];if(!(e!=null&&e.columns)||!(e!=null&&e.rows))return[];const{columns:t,rows:n}=e,r={};return t.forEach((a,s)=>{r[a.name]=s}),n.map(a=>{const s={};return t.forEach((l,u)=>{if(a.row[u]!==void 0){const c=l.name;s[c]=a.row[u].v}}),s})},dSi=i=>{var s;const e=(i==null?void 0:i.englishName)||(i==null?void 0:i.dimensionColumn),t=i==null?void 0:i.condition,n=i==null?void 0:i.value,r=(s=hse.find(l=>l.value===t))==null?void 0:s.key,o=iSi[r];if(!e||!o)throw new Error("Invalid filter configuration");if(r==="isNull"||r==="isNotNull")return`${e} ${o}`;if(o==="LIKE"||o==="NOT LIKE"){let l=n;return t==="contains"?l=`%${n}%`:t==="StartsWith"?l=`${n}%`:t==="endsWith"?l=`%${n}`:t==="notContains"?l=`%${n}%`:t==="doesNotStartWith"?l=`${n}%`:t==="doesNotEndWith"&&(l=`%${n}`),`${e} ${o} '${l}'`}const a=typeof n=="string"?`'${n}'`:n;return`${e} ${o} ${a}`},fSi={metricInsight:{queryMql2Params:sSi,queryChartData:lSi,queryMetricId:oSi,queryDimensions:aSi,transformData:hSi},simpleJson:{}},oqe=i=>{const e=Jh(),{setError:t,setLoading:n}=Qh();return ce.useMemo(()=>{const o=fSi[i];return{queryMql2Params:o.queryMql2Params?aqe(o.queryMql2Params,t,n,e):()=>Promise.resolve({}),queryMetricId:o.queryMetricId?aqe(o.queryMetricId,t,n,e):()=>Promise.resolve({}),queryDimensions:o.queryDimensions?o.queryDimensions:()=>Promise.resolve({}),queryChartData:o.queryChartData?o.queryChartData:()=>Promise.resolve({}),transformData:a=>o.transformData?o.transformData({data:a}):a}},[i])};function aqe(i,e,t,n){return((...r)=>ga(null,null,function*(){try{return yield i(...r)}catch(o){let a=o==null?void 0:o.message;throw typeof o=="string"&&(a=o),t(!1),e({visible:!0,title:n.formatMessage({id:"metricError"}),message:a||"error"}),o}}))}const sqe=[{key:"none",label:"None",value:"none"},{key:"number",label:"Number",value:"number"},{key:"percentage_raw",label:"Percentage (raw)",value:"percentage_raw",desc:"1→1%"},{key:"percentage_scaled",label:"Percentage (scaled)",value:"percentage_scaled",desc:"1→100%"}],gSi={none:"",number:"",percentage_raw:"%",percentage_scaled:"%",celsius:"°C",fahrenheit:"°F",CNY:"¥",USD:"$",GBP:"£",EUR:"€"};function lqe(i,e){if(!i&&!e)return"";let t="",n="";return i&&i!=="none"&&(t=i),e&&e!=="none"&&(n=gSi[e]||e),t+(n?" "+n:"")}function pSi(i,e,t){if(!i)return null;const{dimensionDetailList:n,displayName:r,metricId:o,derivationMethod:a}=i,s={value:o,label:r},l=fse(n,a,t),c=((e==null?void 0:e.dimensions)||[(e==null?void 0:e.xField)||(e==null?void 0:e.nameField)]).map(d=>l.find(f=>d===f.label||d===f.value)).filter(Boolean),h=ySi(r,i);return{metrics:[s],dimensions:c,dissionOptions:l,dataFormat:h}}function mSi(i,e){const{metrics:t}=e,n=cqe(i),r=[],o={};return((n==null?void 0:n.metrics)||[]).forEach(s=>{var p,m;const l=(p=n==null?void 0:n.metricDefinitions)==null?void 0:p[s],u=l==null?void 0:l.refMetric,c=l==null?void 0:l.variables;let h;!u&&c?h=Object.values(c).map(v=>v==null?void 0:v.refMetric):h=[u];let d=[],f=[],g=!1;((m=l==null?void 0:l.indirections)==null?void 0:m.length)>0&&!c&&(g=!0),t.forEach(v=>{if(!g&&v.englishName===u){const b=v==null?void 0:v.metricUnit;o[s]={formatType:(b==null?void 0:b.type)||"none",decimalPlaces:(b==null?void 0:b.decimal)||0,suffix:lqe(b==null?void 0:b.valueUnit,b==null?void 0:b.formatUnit)}}else o[s]={formatType:"none",decimalPlaces:0,suffix:""};h!=null&&h.includes(v==null?void 0:v.englishName)&&!f.includes(v==null?void 0:v.metricId)&&(d.push(v),f.push(v==null?void 0:v.metricId))}),r.push({isDerived:g,displayName:s,label:s,value:"uuid-"+IV(6),metricDefinitions:l,atomicMetricIds:f,atomicMetricsInfo:d})}),{metricsOptions:r,dataFormat:o}}function vSi(i,e,t,n){const{metricsOptions:r,dataFormat:o}=e,{dimensions:a,timeDimension:s={},filters:l=[]}=i,u=Pi(ke({},n),{dataType:"TIMESTAMP"}),c=uqe(r),h=fse(t,c,n),d=a==null?void 0:a.map(f=>h.find(g=>(f==null?void 0:f.displayName)===g.label||(f==null?void 0:f.dimensionId)===g.value)).filter(Boolean);return(s==null?void 0:s.dimensionName)===(n==null?void 0:n.value)&&d.unshift(u),{metrics:r,dataFormat:o,dimensions:d,dissionOptions:h,timeDimension:s,filters:l,queryMetricOrgId:i==null?void 0:i.orgId}}function uqe(i){const e=[];return i==null||i.forEach(t=>{var n;t!=null&&t.atomicMetricsInfo&&((n=t==null?void 0:t.atomicMetricsInfo)==null||n.forEach(r=>{hl(r==null?void 0:r.derivationMethod)?e.push(...r.derivationMethod):Wh(r==null?void 0:r.derivationMethod)&&e.push(r.derivationMethod)}))}),e==null?void 0:e[0]}function bSi(i,e){var r,o,a,s,l;let t=!1,n=!1;if(!(e!=null&&e.enabled))return{defaultSelected:t,defaultDisabled:n};if((e==null?void 0:e.method)==="Ranking"&&(e!=null&&e.ranking)){const u=((r=e.ranking)==null?void 0:r.dimensions)||[],c=((o=e.ranking)==null?void 0:o.ranges)||[];return{defaultSelected:[...u,...c].includes(i),defaultDisabled:n}}if((e==null?void 0:e.method)==="Proportion"&&(e!=null&&e.proportion)){const u=((a=e.proportion)==null?void 0:a.dimensions)||[],c=((s=e.proportion)==null?void 0:s.ranges)||[];return{defaultSelected:[...u,...c].includes(i),defaultDisabled:n}}if((e==null?void 0:e.method)==="Custom"&&((l=e==null?void 0:e.custom)==null?void 0:l.length)>0){const u=e.custom,c=u.findIndex(h=>(h==null?void 0:h.dimension)===i);return c!==-1&&(c===u.length-1?t=!0:(t=!1,n=!0)),{defaultSelected:t,defaultDisabled:n}}return{defaultSelected:t,defaultDisabled:n}}const ySi=(i,e)=>{var t,n;if(i&&((t=e==null?void 0:e.computationalAttributes)!=null&&t.format)){const r=(n=e==null?void 0:e.computationalAttributes)==null?void 0:n.format;return{[i]:{formatType:(r==null?void 0:r.type)||"none",decimalPlaces:(r==null?void 0:r.decimal)||0,suffix:lqe(r==null?void 0:r.valueUnit,r==null?void 0:r.formatUnit)}}}return null};function cqe(i){let e={};if(typeof i=="object")e=i;else if(typeof i=="string")try{e=JSON.parse(i)}catch(t){console.error(t)}return e}function fse(i,e,t){const n=(i==null?void 0:i.map(r=>{const{defaultSelected:o,defaultDisabled:a}=bSi(r.dimensionId,e);return{label:r.displayName,value:r.dimensionId,englishName:r.englishName,dataType:r.dimensionColumnType,datasetName:r.datasetName,dimensionColumn:r.dimensionColumn,defaultSelected:o,defaultDisabled:a,disabled:o||a}}))||[];return n.unshift(Pi(ke({},t),{dataType:"TIMESTAMP",englishName:t.label,datasetName:void 0,dimensionColumn:void 0,defaultSelected:!1,defaultDisabled:!1,disabled:!1})),n}const _Si=[{key:"custom",label:"Custom",value:"custom"},{key:"today",label:"Today",value:"today"},{key:"last7Days",label:"Last 7 days",value:"last7Days"},{key:"last30Days",label:"Last 30 days",value:"last30Days"},{key:"last1Year",label:"Last year",value:"last1Year"},{key:"thisWeek",label:"This week",value:"thisWeek"},{key:"thisMonth",label:"This month",value:"thisMonth"},{key:"thisQuarter",label:"This quarter",value:"thisQuarter"},{key:"thisYear",label:"This year",value:"thisYear"},{key:"weekToDate",label:"Week-to-date",value:"weekToDate"},{key:"monthToDate",label:"Month-to-date",value:"monthToDate"},{key:"quarterToDate",label:"Quarter-to-date",value:"quarterToDate"},{key:"yearToDate",label:"Year-to-date",value:"yearToDate"},{key:"advanced",label:"Advanced",value:"advanced"}],CSi=[{key:"lastPeriod",label:"Last N period",value:"lastPeriod"},{key:"periodAgo",label:"N periods ago",value:"periodAgo"},{key:"periodBoundary",label:"Current/previous period boundary",value:"periodBoundary"}],xSi=[{key:"current",label:"Current",value:"current"},{key:"previous",label:"Previous",value:"previous"}],CS=[{key:"minute",label:"Minute",value:"minute"},{key:"hour",label:"Hour",value:"hour"},{key:"day",label:"Day",value:"day"},{key:"week",label:"Week",value:"week"},{key:"month",label:"Month",value:"month"},{key:"quarter",label:"Quarter",value:"quarter"},{key:"year",label:"Year",value:"year"}],hqe=[{key:"minute",label:"Minute",value:"minute"},{key:"hour",label:"Hour",value:"hour"},{key:"year",label:"Year",value:"year"},{key:"quarter",label:"Quarter",value:"quarter"},{key:"month",label:"Month",value:"month"},{key:"week",label:"Week",value:"week"},{key:"day",label:"Day",value:"day"}],SSi=[{key:"first",label:"First",value:"first"},{key:"last",label:"Last",value:"last"}],dqe={type:"lastPeriod",lastPeriod:{range:7,unit:"day"},periodAgo:{range:7,unit:"day"},periodBoundary:{periodType:"current",periodUnit:"month",periodRange:void 0,boundaryType:"first",boundaryUnit:"day"}},VT={second:0,minute:1,hour:2,day:3,week:4,month:5,quarter:6,year:7},wSi=i=>{if(i&&Object.prototype.hasOwnProperty.call(VT,i)){const e=VT[i];return CS.filter(t=>VT[t.value]<e)}return CS},ESi=i=>{const e=VT[i==null?void 0:i.toLowerCase()];return e!==void 0?hqe.filter(t=>VT[t.value]<e):hqe},ASi=(i,e,t)=>{var n,r,o,a,s,l;if((e==null?void 0:e.type)==="custom"&&(n=e==null?void 0:e.custom)!=null&&n.from&&(r=e==null?void 0:e.custom)!=null&&r.to){const u=Ir(e.custom.from).format(Ob),c=Ir(e.custom.to).format(Ob);return`${u}-${c}`}if((e==null?void 0:e.type)==="advanced"&&e.advanced){const u=e.advanced;let c="";if((u==null?void 0:u.type)==="lastPeriod")return t({id:"lastNUnits"},{range:(o=u==null?void 0:u.lastPeriod)==null?void 0:o.range,unit:t({id:"unit"+((a=u.lastPeriod)==null?void 0:a.unit)})});if((u==null?void 0:u.type)==="periodAgo")return t({id:"periodAgoNUnits"},{range:(s=u.periodAgo)==null?void 0:s.range,unit:t({id:"unit"+((l=u.periodAgo)==null?void 0:l.unit)})});if((u==null?void 0:u.type)==="periodBoundary"){const h=u.periodBoundary;if((h==null?void 0:h.periodType)==="current")return t({id:"currentNUnit"},{periodUnit:t({id:"unit"+h.periodUnit}),boundaryType:t({id:h.boundaryType}),boundaryUnit:t({id:"unit"+h.boundaryUnit})});if((h==null?void 0:h.periodType)==="previous")return t({id:"previousNUnits"},{periodRange:h.periodRange,periodUnit:t({id:"unit"+h.periodUnit}),boundaryType:t({id:h.boundaryType}),boundaryUnit:t({id:"unit"+h.boundaryUnit})})}return c}return i},TSi=i=>i==null?void 0:i.dimensionUnit,RSi=(i,e)=>{var t,n,r;if(!(i!=null&&i.type)){const o=e==null?void 0:e.mql;let a;if(a=(t=cqe(o))==null?void 0:t.timeConstraint,!a)return{};const s=Object.keys(a)[0],l=a[s];return l&&typeof l=="object"&&(l==null?void 0:l.type)==="advanced"&&((r=(n=l==null?void 0:l.advanced)==null?void 0:n.custom)!=null&&r.from)?{type:"custom",custom:{from:l.advanced.custom.from,to:l.advanced.custom.to||Ir().format("YYYY-MM-DD HH:mm:ss")}}:{}}return i},MSi=i=>{var e;return(i==null?void 0:i.type)==="custom"&&((e=i==null?void 0:i.custom)!=null&&e.from)?{type:"custom",custom:{from:Ir(i.custom.from).format("YYYY-MM-DD HH:mm:ss"),to:Ir(i.custom.to).format("YYYY-MM-DD HH:mm:ss")}}:i},gse=i=>{const e=Jh(),t=i.type,{queryChartData:n,transformData:r}=oqe(t),{chartJson:o,drillBy:a,setLoading:s,setChartJson:l,setError:u,setDataSourceQueryInfo:c,setChartDrillBy:h}=Qh();return{queryChartDataFromDatasource:(p,m)=>ga(null,null,function*(){var S;console.log("queryChartDataFromDatasource",p);const{metrics:v,dimensions:b,timeGrain:y,dataFormat:_}=p;if(u({visible:!1,title:"",message:""}),p.timeRange=MSi(p.timeRange),v!=null&&v.length){const x=yield n(i,p).catch(R=>{u({visible:!0,title:e.formatMessage({id:"chartDataLoadingFailed"}),message:R.message}),s(!1)});c({fieldInfo:(S=x==null?void 0:x.columns)==null?void 0:S.map(R=>({fieldName:R==null?void 0:R.name,type:R.type}))});const w=r(x);let E=o;jke(o)&&(E=yield Uke(Pi(ke({},o),{data:w})));let A=OV({chartJson:E,metrics:v,dimensions:b,isInit:m});const T=Pi(ke({},A),{data:w,timeGrain:y,dataFormat:_});l(T),s(!1),x&&u({visible:!1,title:"",message:""})}}),queryDrillByChartData:b=>ga(null,[b],function*({queryData:p,setDrillLoading:m,setDrillError:v}){var S;const{metrics:y,dimensions:_}=p;if(y!=null&&y.length){const x=yield n(i,p).catch(k=>{v({visible:!0,title:e.formatMessage({id:"drillDataLoadingFailed"}),message:k.message}),m(!1)}),w=r(x),E=OV({chartJson:o,metrics:y,dimensions:_}),A=Pi(ke({},E),{data:w}),T=zJ(A),R=a;h(Pi(ke({},R),{chartState:{chartJson:A,dataset:T,history:[...((S=R.chartState)==null?void 0:S.history)||[],{chartJson:A,dataset:T}]}})),m(!1),x&&v({visible:!1,title:"",message:""})}}),queyDetailTableData:p=>ga(null,null,function*(){return n(i,Pi(ke({},p),{queryType:"detailed"})).then(m=>r(m))})}},kSi=Es(pl)`
10726
+ `,rd=i=>{var l;const s=i,{prefix:e,allowClear:t}=s,n=Rh(s,["prefix","allowClear"]),[r,o]=ce.useState((l=i==null?void 0:i.open)!=null?l:!1);ce.useEffect(()=>{(i==null?void 0:i.open)!==void 0&&o(i==null?void 0:i.open)},[i==null?void 0:i.open]);const a=u=>{if(i!=null&&i.onOpenChange){i==null||i.onOpenChange(u);return}o(u)};return we.jsxs(Yf,{theme:Xxi,children:[we.jsx(Zxi,{}),we.jsx(Kxi,{className:r?"open":"",children:we.jsx(hm,ke({prefix:e?we.jsx("span",{className:r?"open":"",children:e}):void 0,suffixIcon:we.jsxs(we.Fragment,{children:[r&&we.jsx("div",{className:"suffixIcon",children:we.jsx(rse,{style:{color:"#008CD6",pointerEvents:"none"}})}),!r&&we.jsx("div",{className:"suffixIcon",children:we.jsx(Jae,{style:{color:"#89898a",pointerEvents:"none"}})})]}),maxTagCount:"responsive",allowClear:t?{clearIcon:we.jsx(ase,{className:"clear-icon"})}:!1,onOpenChange:a},n))})]})},Qxi="http://localhost";class Jxi{constructor({baseURL:e=Qxi,host:t,protocol:n,timeout:r=6e5,headers:o}={}){var s,l,u;this.host=t||((s=window.location)==null?void 0:s.host),this.protocol=n||(["http:","https:"].includes((l=window==null?void 0:window.location)==null?void 0:l.protocol)?(u=window==null?void 0:window.location)==null?void 0:u.protocol:void 0);const a=new URL(this.host||this.protocol?`${this.protocol||"https:"}//${this.host||"localhost"}`:e,window.location.href);this.baseURL=a.href.replace(/\/+$/,""),this.host=a.host,this.protocol=a.protocol,this.timeout=r,this.headers=o||{"Content-Type":"application/json"},this.instance=Xs.create({baseURL:this.baseURL,timeout:this.timeout,headers:this.headers})}get(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"GET"}))})}delete(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"DELETE"}))})}put(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"PUT"}))})}post(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"POST"}))})}patch(e){return ga(this,null,function*(){return this.request(Pi(ke({},e),{method:"PATCH"}))})}ping(){return this.request({url:"/api/ping",method:"GET",retry:1})}request(e){return ga(this,null,function*(){return this.instance(e).then(t=>{const{status:n,config:r}=t;return(r==null?void 0:r.method)==="delete"&&(n===200||n===201)?{message:"delete success"}:{data:t.data}}).catch(t=>Promise.reject(t))})}}const WT=new Jxi,eSi=i=>mAt({},v$e,i,t=>{if(Array.isArray(t))return t}),tSi=[{key:"basic",label:"Basic",value:"basic"},{key:"customSql",label:"Custom SQL",value:"customSql"}],hse=[{key:"equal",label:"Equal",value:"equal"},{key:"notEqual",label:"Not equal",value:"not equal"},{key:"isNull",label:"Is null",value:"is null"},{key:"isNotNull",label:"Is not null",value:"is not null"},{key:"greaterThan",label:"Greater than",value:"greater than"},{key:"greaterThanOrEqualto",label:"Greater than or equal to",value:"greater than or equal to"},{key:"lessThan",label:"Less than",value:"less than"},{key:"lessThanEqualTo",label:"Less than or equal to",value:"less than or equal to"},{key:"contains",label:"Contains",value:"contains"},{key:"notContains",label:"Not contains",value:"not contains"},{key:"StartsWith",label:"Starts with",value:"starts with"},{key:"doesNotStartWith",label:"Does not start with",value:"does not start with"},{key:"endsWith",label:"Ends with",value:"ends with"},{key:"doesNotEndWith",label:"Does not end with",value:"does not end with"}],iSi={equal:"=",notEqual:"!=",isNull:"IS NULL",isNotNull:"IS NOT NULL",greaterThan:">",greaterThanOrEqualto:">=",lessThan:"<",lessThanEqualTo:"<=",contains:"LIKE",notContains:"NOT LIKE",StartsWith:"LIKE",doesNotStartWith:"NOT LIKE",endsWith:"LIKE",doesNotEndWith:"NOT LIKE"},nSi=[{key:"where",label:"WHERE",value:"WHERE"},{key:"having",label:"HAVING",value:"HAVING"}];function dse(i,e){const t=e==null?void 0:e.find(n=>n.value===i.dimensionId||n.label===i.name);return t?{datasetName:t.datasetName,dimensionColumn:t.dimensionColumn,englishName:t.englishName,dimensionId:t.value}:null}const rSi=i=>i?i==null?void 0:i.map(e=>ke({},e.subFilter)):[],oSi=i=>{const e="/metricInsight/api/v1/metric/"+i;return WT.get({url:e}).then(t=>t.data||[])},aSi=i=>{const e="/metricInsight/api/v1/dimension/metric?mode=intersect&metricIds="+i.join(",");return WT.get({url:e}).then(t=>{var n;return((n=t==null?void 0:t.data)==null?void 0:n.items)||[]})},sSi=i=>WT.post({url:"/metricInsight/api/v1/mql/params",data:i}).then(t=>(t==null?void 0:t.data)||[]),lSi=(i,e)=>i!=null&&i.mql?cSi(i,e):uSi(e),uSi=({timeRange:i,metrics:e,dimensions:t,timeGrain:n,filters:r,queryMetricOrgId:o})=>{const a=e==null?void 0:e.map(f=>f.value),s=a==null?void 0:a[0],l=t==null?void 0:t.some(f=>f.value==="metricTime");let u=t,c;l&&(u=t==null?void 0:t.filter(f=>f.value!=="metricTime"),c={dimensionName:"metricTime",dimensionUnit:n});const h={orgId:o,metricIds:a,timeRange:i,dimensionIds:u==null?void 0:u.map(f=>f.value)};(i==null?void 0:i.type)==="custom"&&(i!=null&&i.custom)&&(h.timeRange.custom={from:Ir(i.custom.from).format(GM),to:Ir(i.custom.to).format(GM)}),c&&(h.timeDimension=c),r&&r.length>0&&(h.filters=r.map(f=>({conjunction:"AND",subFilter:ke({},f)})));const d=`/metricInsight/api/v1/metric/${s}/preview`;return WT.post({url:d,data:h}).then(f=>(f==null?void 0:f.data)||[])},cSi=(i,{timeRange:e,metrics:t,dimensions:n,timeGrain:r,filters:o,queryMetricOrgId:a,queryType:s})=>{const l=i==null?void 0:i.mql,u={dimensions:[],metricDefinitions:{},metrics:[],timeConstraint:{},filters:{},orders:(l==null?void 0:l.orders)||{},limits:(l==null?void 0:l.limits)||{},orgId:a,queryType:s},c=n==null?void 0:n.map(f=>{let g=(f==null?void 0:f.englishName)||(f==null?void 0:f.label);return f.value==="metricTime"&&(g="metric_time__"+r),g});u.dimensions={};let h=o==null?void 0:o.map(f=>{var g;return f.type==="basic"?dSi(f==null?void 0:f.basic):f.type==="customSql"?(g=f==null?void 0:f.sql)==null?void 0:g.filterCondition:null}).filter(f=>f!==null&&f.trim()!=="");return t==null||t.forEach(f=>{const g=(f==null?void 0:f.displayName)||(f==null?void 0:f.label);u.metrics.push(g),u.dimensions[g]=c,u.metricDefinitions[g]=f.metricDefinitions,u.filters[g]=h||[],u.timeConstraint[g]=e||{}}),WT.post({url:"/metricInsight/api/v1/mql/query",data:u}).then(f=>{var g;return((g=f==null?void 0:f.data)==null?void 0:g[0])||[]})},hSi=i=>{const{data:e}=i;if(!e)return[];if(!(e!=null&&e.columns)||!(e!=null&&e.rows))return[];const{columns:t,rows:n}=e,r={};return t.forEach((a,s)=>{r[a.name]=s}),n.map(a=>{const s={};return t.forEach((l,u)=>{if(a.row[u]!==void 0){const c=l.name;s[c]=a.row[u].v}}),s})},dSi=i=>{var s;const e=(i==null?void 0:i.englishName)||(i==null?void 0:i.dimensionColumn),t=i==null?void 0:i.condition,n=i==null?void 0:i.value,r=(s=hse.find(l=>l.value===t))==null?void 0:s.key,o=iSi[r];if(!e||!o)throw new Error("Invalid filter configuration");if(r==="isNull"||r==="isNotNull")return`${e} ${o}`;if(o==="LIKE"||o==="NOT LIKE"){let l=n;return t==="contains"?l=`%${n}%`:t==="StartsWith"?l=`${n}%`:t==="endsWith"?l=`%${n}`:t==="notContains"?l=`%${n}%`:t==="doesNotStartWith"?l=`${n}%`:t==="doesNotEndWith"&&(l=`%${n}`),`${e} ${o} '${l}'`}const a=typeof n=="string"?`'${n}'`:n;return`${e} ${o} ${a}`},fSi={metricInsight:{queryMql2Params:sSi,queryChartData:lSi,queryMetricId:oSi,queryDimensions:aSi,transformData:hSi},simpleJson:{}},oqe=i=>{const e=Jh(),{setError:t,setLoading:n}=Qh();return ce.useMemo(()=>{const o=fSi[i];return{queryMql2Params:o.queryMql2Params?aqe(o.queryMql2Params,t,n,e):()=>Promise.resolve({}),queryMetricId:o.queryMetricId?aqe(o.queryMetricId,t,n,e):()=>Promise.resolve({}),queryDimensions:o.queryDimensions?o.queryDimensions:()=>Promise.resolve({}),queryChartData:o.queryChartData?o.queryChartData:()=>Promise.resolve({}),transformData:a=>o.transformData?o.transformData({data:a}):a}},[i])};function aqe(i,e,t,n){return((...r)=>ga(null,null,function*(){try{return yield i(...r)}catch(o){let a=o==null?void 0:o.message;throw typeof o=="string"&&(a=o),t(!1),e({visible:!0,title:n.formatMessage({id:"metricError"}),message:a||"error"}),o}}))}const sqe=[{key:"none",label:"None",value:"none"},{key:"number",label:"Number",value:"number"},{key:"percentage_raw",label:"Percentage (raw)",value:"percentage_raw",desc:"1→1%"},{key:"percentage_scaled",label:"Percentage (scaled)",value:"percentage_scaled",desc:"1→100%"}],gSi={none:"",number:"",percentage_raw:"%",percentage_scaled:"%",celsius:"°C",fahrenheit:"°F",CNY:"¥",USD:"$",GBP:"£",EUR:"€"};function lqe(i,e){if(!i&&!e)return"";let t="",n="";return i&&i!=="none"&&(t=i),e&&e!=="none"&&(n=gSi[e]||e),t+(n?" "+n:"")}function pSi(i,e,t){if(!i)return null;const{dimensionDetailList:n,displayName:r,metricId:o,derivationMethod:a}=i,s={value:o,label:r},l=fse(n,a,t),c=((e==null?void 0:e.dimensions)||[(e==null?void 0:e.xField)||(e==null?void 0:e.nameField)]).map(d=>l.find(f=>d===f.label||d===f.value)).filter(Boolean),h=ySi(r,i);return{metrics:[s],dimensions:c,dissionOptions:l,dataFormat:h}}function mSi(i,e){const{metrics:t}=e,n=cqe(i),r=[],o={};return((n==null?void 0:n.metrics)||[]).forEach(s=>{var p,m;const l=(p=n==null?void 0:n.metricDefinitions)==null?void 0:p[s],u=l==null?void 0:l.refMetric,c=l==null?void 0:l.variables;let h;!u&&c?h=Object.values(c).map(v=>v==null?void 0:v.refMetric):h=[u];let d=[],f=[],g=!1;((m=l==null?void 0:l.indirections)==null?void 0:m.length)>0&&!c&&(g=!0),t.forEach(v=>{if(!g&&v.englishName===u){const b=v==null?void 0:v.metricUnit;o[s]={formatType:(b==null?void 0:b.type)||"none",decimalPlaces:(b==null?void 0:b.decimal)||0,suffix:lqe(b==null?void 0:b.valueUnit,b==null?void 0:b.formatUnit)}}else o[s]={formatType:"none",decimalPlaces:0,suffix:""};h!=null&&h.includes(v==null?void 0:v.englishName)&&!f.includes(v==null?void 0:v.metricId)&&(d.push(v),f.push(v==null?void 0:v.metricId))}),r.push({isDerived:g,displayName:s,label:s,value:"uuid-"+IV(6),metricDefinitions:l,atomicMetricIds:f,atomicMetricsInfo:d})}),{metricsOptions:r,dataFormat:o}}function vSi(i,e,t,n){const{dimensions:r,timeDimension:o={},filters:a=[]}=i,{metricsOptions:s,dataFormat:l}=e,u=Pi(ke({},n),{dataType:"TIMESTAMP"}),c=uqe(s),h=fse(t,c,n),d=(r==null?void 0:r.map(f=>h.find(g=>(f==null?void 0:f.displayName)===g.label||(f==null?void 0:f.dimensionId)===g.value)).filter(Boolean))||[];return(o==null?void 0:o.dimensionName)===(n==null?void 0:n.value)&&d.unshift(u),{metrics:s,dataFormat:l,dimensions:d,dissionOptions:h,timeDimension:o,filters:a,queryMetricOrgId:i==null?void 0:i.orgId}}function uqe(i){const e=[];return i==null||i.forEach(t=>{var n;t!=null&&t.atomicMetricsInfo&&((n=t==null?void 0:t.atomicMetricsInfo)==null||n.forEach(r=>{hl(r==null?void 0:r.derivationMethod)?e.push(...r.derivationMethod):Wh(r==null?void 0:r.derivationMethod)&&e.push(r.derivationMethod)}))}),e==null?void 0:e[0]}function bSi(i,e){var r,o,a,s,l;let t=!1,n=!1;if(!(e!=null&&e.enabled))return{defaultSelected:t,defaultDisabled:n};if((e==null?void 0:e.method)==="Ranking"&&(e!=null&&e.ranking)){const u=((r=e.ranking)==null?void 0:r.dimensions)||[],c=((o=e.ranking)==null?void 0:o.ranges)||[];return{defaultSelected:[...u,...c].includes(i),defaultDisabled:n}}if((e==null?void 0:e.method)==="Proportion"&&(e!=null&&e.proportion)){const u=((a=e.proportion)==null?void 0:a.dimensions)||[],c=((s=e.proportion)==null?void 0:s.ranges)||[];return{defaultSelected:[...u,...c].includes(i),defaultDisabled:n}}if((e==null?void 0:e.method)==="Custom"&&((l=e==null?void 0:e.custom)==null?void 0:l.length)>0){const u=e.custom,c=u.findIndex(h=>(h==null?void 0:h.dimension)===i);return c!==-1&&(c===u.length-1?t=!0:(t=!1,n=!0)),{defaultSelected:t,defaultDisabled:n}}return{defaultSelected:t,defaultDisabled:n}}const ySi=(i,e)=>{var t,n;if(i&&((t=e==null?void 0:e.computationalAttributes)!=null&&t.format)){const r=(n=e==null?void 0:e.computationalAttributes)==null?void 0:n.format;return{[i]:{formatType:(r==null?void 0:r.type)||"none",decimalPlaces:(r==null?void 0:r.decimal)||0,suffix:lqe(r==null?void 0:r.valueUnit,r==null?void 0:r.formatUnit)}}}return null};function cqe(i){let e={};if(typeof i=="object")e=i;else if(typeof i=="string")try{e=JSON.parse(i)}catch(t){console.error(t)}return e}function fse(i,e,t){const n=(i==null?void 0:i.map(r=>{const{defaultSelected:o,defaultDisabled:a}=bSi(r.dimensionId,e);return{label:r.displayName,value:r.dimensionId,englishName:r.englishName,dataType:r.dimensionColumnType,datasetName:r.datasetName,dimensionColumn:r.dimensionColumn,defaultSelected:o,defaultDisabled:a,disabled:o||a}}))||[];return n.unshift(Pi(ke({},t),{dataType:"TIMESTAMP",englishName:t.label,datasetName:void 0,dimensionColumn:void 0,defaultSelected:!1,defaultDisabled:!1,disabled:!1})),n}const _Si=[{key:"custom",label:"Custom",value:"custom"},{key:"today",label:"Today",value:"today"},{key:"last7Days",label:"Last 7 days",value:"last7Days"},{key:"last30Days",label:"Last 30 days",value:"last30Days"},{key:"last1Year",label:"Last year",value:"last1Year"},{key:"thisWeek",label:"This week",value:"thisWeek"},{key:"thisMonth",label:"This month",value:"thisMonth"},{key:"thisQuarter",label:"This quarter",value:"thisQuarter"},{key:"thisYear",label:"This year",value:"thisYear"},{key:"weekToDate",label:"Week-to-date",value:"weekToDate"},{key:"monthToDate",label:"Month-to-date",value:"monthToDate"},{key:"quarterToDate",label:"Quarter-to-date",value:"quarterToDate"},{key:"yearToDate",label:"Year-to-date",value:"yearToDate"},{key:"advanced",label:"Advanced",value:"advanced"}],CSi=[{key:"lastPeriod",label:"Last N period",value:"lastPeriod"},{key:"periodAgo",label:"N periods ago",value:"periodAgo"},{key:"periodBoundary",label:"Current/previous period boundary",value:"periodBoundary"}],xSi=[{key:"current",label:"Current",value:"current"},{key:"previous",label:"Previous",value:"previous"}],CS=[{key:"minute",label:"Minute",value:"minute"},{key:"hour",label:"Hour",value:"hour"},{key:"day",label:"Day",value:"day"},{key:"week",label:"Week",value:"week"},{key:"month",label:"Month",value:"month"},{key:"quarter",label:"Quarter",value:"quarter"},{key:"year",label:"Year",value:"year"}],hqe=[{key:"minute",label:"Minute",value:"minute"},{key:"hour",label:"Hour",value:"hour"},{key:"year",label:"Year",value:"year"},{key:"quarter",label:"Quarter",value:"quarter"},{key:"month",label:"Month",value:"month"},{key:"week",label:"Week",value:"week"},{key:"day",label:"Day",value:"day"}],SSi=[{key:"first",label:"First",value:"first"},{key:"last",label:"Last",value:"last"}],dqe={type:"lastPeriod",lastPeriod:{range:7,unit:"day"},periodAgo:{range:7,unit:"day"},periodBoundary:{periodType:"current",periodUnit:"month",periodRange:void 0,boundaryType:"first",boundaryUnit:"day"}},VT={second:0,minute:1,hour:2,day:3,week:4,month:5,quarter:6,year:7},wSi=i=>{if(i&&Object.prototype.hasOwnProperty.call(VT,i)){const e=VT[i];return CS.filter(t=>VT[t.value]<e)}return CS},ESi=i=>{const e=VT[i==null?void 0:i.toLowerCase()];return e!==void 0?hqe.filter(t=>VT[t.value]<e):hqe},ASi=(i,e,t)=>{var n,r,o,a,s,l;if((e==null?void 0:e.type)==="custom"&&(n=e==null?void 0:e.custom)!=null&&n.from&&(r=e==null?void 0:e.custom)!=null&&r.to){const u=Ir(e.custom.from).format(Ob),c=Ir(e.custom.to).format(Ob);return`${u}-${c}`}if((e==null?void 0:e.type)==="advanced"&&e.advanced){const u=e.advanced;let c="";if((u==null?void 0:u.type)==="lastPeriod")return t({id:"lastNUnits"},{range:(o=u==null?void 0:u.lastPeriod)==null?void 0:o.range,unit:t({id:"unit"+((a=u.lastPeriod)==null?void 0:a.unit)})});if((u==null?void 0:u.type)==="periodAgo")return t({id:"periodAgoNUnits"},{range:(s=u.periodAgo)==null?void 0:s.range,unit:t({id:"unit"+((l=u.periodAgo)==null?void 0:l.unit)})});if((u==null?void 0:u.type)==="periodBoundary"){const h=u.periodBoundary;if((h==null?void 0:h.periodType)==="current")return t({id:"currentNUnit"},{periodUnit:t({id:"unit"+h.periodUnit}),boundaryType:t({id:h.boundaryType}),boundaryUnit:t({id:"unit"+h.boundaryUnit})});if((h==null?void 0:h.periodType)==="previous")return t({id:"previousNUnits"},{periodRange:h.periodRange,periodUnit:t({id:"unit"+h.periodUnit}),boundaryType:t({id:h.boundaryType}),boundaryUnit:t({id:"unit"+h.boundaryUnit})})}return c}return i},TSi=i=>i==null?void 0:i.dimensionUnit,RSi=(i,e)=>{var t,n,r;if(!(i!=null&&i.type)){const o=e==null?void 0:e.mql;let a;if(a=(t=cqe(o))==null?void 0:t.timeConstraint,!a)return{};const s=Object.keys(a)[0],l=a[s];return l&&typeof l=="object"&&(l==null?void 0:l.type)==="advanced"&&((r=(n=l==null?void 0:l.advanced)==null?void 0:n.custom)!=null&&r.from)?{type:"custom",custom:{from:l.advanced.custom.from,to:l.advanced.custom.to||Ir().format("YYYY-MM-DD HH:mm:ss")}}:{}}return i},MSi=i=>{var e;return(i==null?void 0:i.type)==="custom"&&((e=i==null?void 0:i.custom)!=null&&e.from)?{type:"custom",custom:{from:Ir(i.custom.from).format("YYYY-MM-DD HH:mm:ss"),to:Ir(i.custom.to).format("YYYY-MM-DD HH:mm:ss")}}:i},gse=i=>{const e=Jh(),t=i.type,{queryChartData:n,transformData:r}=oqe(t),{chartJson:o,drillBy:a,setLoading:s,setChartJson:l,setError:u,setDataSourceQueryInfo:c,setChartDrillBy:h}=Qh();return{queryChartDataFromDatasource:(p,m)=>ga(null,null,function*(){var S;const{metrics:v,dimensions:b,timeGrain:y,dataFormat:_}=p;if(u({visible:!1,title:"",message:""}),p.timeRange=MSi(p.timeRange),v!=null&&v.length){const x=yield n(i,p).catch(R=>{u({visible:!0,title:e.formatMessage({id:"chartDataLoadingFailed"}),message:R.message}),s(!1)});c({fieldInfo:(S=x==null?void 0:x.columns)==null?void 0:S.map(R=>({fieldName:R==null?void 0:R.name,type:R.type}))});const w=r(x);let E=o;jke(o)&&(E=yield Uke(Pi(ke({},o),{data:w})));let A=OV({chartJson:E,metrics:v,dimensions:b,isInit:m});const T=Pi(ke({},A),{data:w,timeGrain:y,dataFormat:_});l(T),s(!1),x&&u({visible:!1,title:"",message:""})}}),queryDrillByChartData:b=>ga(null,[b],function*({queryData:p,setDrillLoading:m,setDrillError:v}){var S;const{metrics:y,dimensions:_}=p;if(y!=null&&y.length){const x=yield n(i,p).catch(k=>{v({visible:!0,title:e.formatMessage({id:"drillDataLoadingFailed"}),message:k.message}),m(!1)}),w=r(x),E=OV({chartJson:o,metrics:y,dimensions:_}),A=Pi(ke({},E),{data:w}),T=zJ(A),R=a;h(Pi(ke({},R),{chartState:{chartJson:A,dataset:T,history:[...((S=R.chartState)==null?void 0:S.history)||[],{chartJson:A,dataset:T}]}})),m(!1),x&&v({visible:!1,title:"",message:""})}}),queyDetailTableData:p=>ga(null,null,function*(){return n(i,Pi(ke({},p),{queryType:"detailed"})).then(m=>r(m))})}},kSi=Es(pl)`
10727
10727
  ${()=>bl`
10728
10728
  &.advt-vis-chart-antd-btn {
10729
10729
  color: #89898a;
@@ -11243,7 +11243,7 @@ ${r}
11243
11243
  }
11244
11244
  }
11245
11245
  `}
11246
- `,xQe=i=>{const[e,t]=ce.useState(null),[n,r]=ce.useState(!1),o=ce.useRef(null);ce.useEffect(()=>{const l=u=>{const c=o.current;c&&!c.contains(u.target)&&r(!1)};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[]);const a=()=>we.jsxs(dg,{className:"actions",justify:"space-between",align:"center",children:[we.jsx(Op,{type:"text",onClick:()=>r(!1),children:we.jsx(ho,{id:"cancel"})}),we.jsx(Op,{type:"text",onClick:()=>{i.onChange&&i.onChange(e==null?void 0:e.dates,e==null?void 0:e.dateStrings),r(!1)},children:we.jsx(ho,{id:"modalApply"})})]}),s=(l,u)=>{t({dates:l,dateStrings:u})};return we.jsxs(Yf,{theme:aRi,children:[we.jsx(lRi,{}),we.jsx("div",{ref:o,children:we.jsx(sRi,ke({suffixIcon:null,renderExtraFooter:a,showNow:!1,needConfirm:!0,onCalendarChange:s,open:n,getPopupContainer:()=>o.current,onClick:()=>r(!n),classNames:{popup:{root:"time-pick-popover"}}},i))})]})},uRi=({customTimeRange:i,onChange:e})=>{var n,r;const t=({from:o,to:a})=>{e({from:o||i.from,to:a||i.to})};return we.jsxs(eRi,{className:"custom-content",children:[we.jsxs("div",{className:"left-content",children:[we.jsx("div",{className:"title",children:we.jsx(ho,{id:"startTime"})}),we.jsx(CQe,{value:i.from,onChange:o=>{t({from:o})}}),we.jsxs("div",{className:"date-time",children:[we.jsx(gm,{value:(n=i.from)==null?void 0:n.format("YYYY/MM/DD")}),we.jsx(xQe,{onChange:o=>{o&&t({from:o})},value:i.from})]})]}),we.jsxs("div",{className:"right-content",children:[we.jsx("div",{className:"title",children:we.jsx(ho,{id:"endTime"})}),we.jsx(CQe,{value:i.to,onChange:o=>{t({to:o})}}),we.jsxs("div",{className:"date-time",children:[we.jsx(gm,{value:(r=i.to)==null?void 0:r.format("YYYY/MM/DD")}),we.jsx(xQe,{onChange:o=>{o&&t({to:o})},value:i.to})]})]})]})},cRi=({type:i,setClose:e,setApply:t,timeRange:n})=>{const[r,o]=ce.useState({from:Ir().subtract(7,"day"),to:Ir()}),[a,s]=ce.useState({type:"lastPeriod",lastPeriod:{range:7,unit:"day"}});ce.useEffect(()=>{var u,c;i==="custom"&&(u=n==null?void 0:n.custom)!=null&&u.from&&(c=n==null?void 0:n.custom)!=null&&c.to&&o({from:Ir(n.custom.from),to:Ir(n.custom.to)}),i==="advanced"&&n!=null&&n.advanced&&s(n.advanced)},[n]);const l=()=>{if(i==="custom"){const u=Ir(r.from).format(Ob),c=Ir(r.to).format(Ob);t({type:"custom",custom:{from:u,to:c}})}i==="advanced"&&t({type:"advanced",advanced:ke({},a)})};return we.jsxs(J8i,{className:"time-popover-container",children:[we.jsxs("div",{className:"time-popover-header",children:[we.jsx(pl,{className:"icon-box",type:"text",onClick:()=>e(!0),children:we.jsx(p0,{component:iRi})}),we.jsx("span",{className:"time-title",children:we.jsx(ho,{id:i})})]}),we.jsxs("div",{className:"time-popover-content",children:[i==="custom"&&we.jsx(uRi,{customTimeRange:r,onChange:u=>o(u)}),i==="advanced"&&we.jsx(rRi,{advancedTimeRange:a,onChange:u=>{s(u)}})]}),we.jsxs("div",{className:"time-footer",children:[we.jsx("div",{className:"time-footer-btn cancel-btn",children:we.jsx(Op,{type:"text",onClick:()=>e(),children:we.jsx(ho,{id:"cancel"})})}),we.jsx("div",{className:"time-footer-btn apply-btn",children:we.jsx(Op,{type:"text",onClick:l,children:we.jsx(ho,{id:"modalApply"})})})]})]})},hRi=({timeRange:i,onChange:e})=>{const{formatMessage:t}=Jh(),[n,r]=ce.useState(!1),[o,a]=ce.useState(!1),s=ce.useRef(null),[l,u]=ce.useState("");ce.useEffect(()=>{const g=p=>{var b,y;const m=(b=s.current)==null?void 0:b.contains(p.target),v=(y=document.querySelector(".advanced-select-dropdown"))==null?void 0:y.contains(p.target);!m&&!v&&a(!1)};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]),ce.useEffect(()=>{i&&((i.type==="custom"||i.type==="advanced")&&u(i.type),i.type==="basic"&&i.basic&&u(i==null?void 0:i.basic),i.type||u(""))},[i]);const c=g=>{e(g),a(!1)},h=g=>{if(g==="custom"||g==="advanced"){u(g),a(!0);return}o&&a(!1),e({type:g?"basic":"",basic:g||""})},d=({label:g,value:p})=>p==="custom"||p==="advanced"?ASi(g,i,t):g,f=g=>{const p=g.value==="advanced"||g.value==="custom";return we.jsxs(dg,{align:"center",justify:"space-between",onClick:()=>{(g.value==="advanced"||g.value==="custom")&&a(!0)},children:[we.jsx("span",{className:"label",children:g.label}),p&&we.jsx("span",{className:"icon",children:we.jsx(ise,{})})]})};return we.jsxs(Q8i,{ref:s,children:[we.jsx(rd,{className:"time-range-select",prefix:we.jsx(ho,{id:"timeRange"}),value:l,options:Yd(_Si),optionRender:f,labelRender:d,open:n,onChange:h,getPopupContainer:()=>s.current,onOpenChange:g=>{g&&((i==null?void 0:i.type)==="advanced"||(i==null?void 0:i.type)==="custom")&&a(!o),r(g)},allowClear:!0}),o&&we.jsx(cRi,{type:l,timeRange:i,setClose:g=>{a(!1),i&&e(ke({},i)),g&&r(!0)},setApply:c})]})};function dRi({theme:i,dataSource:e}){const t=Jh(),[n,r]=ce.useState([]),[o,a]=ce.useState([]),s={label:t.formatMessage({id:"metricTime"}),value:"metricTime"},{chartJson:l,setDataSourceQueryInfo:u,setLoading:c,setError:h,setControllerConfig:d,setChartDrillBy:f}=Qh(),[g,p]=ce.useState({metrics:[],dimensions:[]}),{queryDimensions:m,queryMql2Params:v,queryMetricId:b}=oqe(e==null?void 0:e.type),{queryChartDataFromDatasource:y}=gse(e),_=L=>{const F=ke({metrics:(L==null?void 0:L.metrics)||[],dimensions:(L==null?void 0:L.dimensions)||[],timeRange:RSi(L==null?void 0:L.timeRange,e)||{},timeGrain:TSi(L==null?void 0:L.timeDimension)||(L==null?void 0:L.timeGrain)||(l==null?void 0:l.timeGrain),filters:rSi(L==null?void 0:L.filters)},L);p(F),r(L==null?void 0:L.metrics),a((L==null?void 0:L.dissionOptions)||[]),u({metrics:(L==null?void 0:L.metrics)||[],dimensions:(L==null?void 0:L.dissionOptions)||[]}),d(F);const W=Pi(ke({},F),{dataFormat:L==null?void 0:L.dataFormat});y(W,!0)},S=L=>ga(null,null,function*(){var W;const F=yield v(L);if(F&&Array.isArray(F)&&F.length>0){const V=F[0],G=mSi(L,V),z=(W=G==null?void 0:G.metricsOptions)==null?void 0:W.flatMap(J=>J==null?void 0:J.atomicMetricIds),X=z?[...new Set(z)]:[];if(!(X!=null&&X.length)){h({visible:!0,title:"Error",message:"metric is missing"}),c(!1);return}const j=yield m(X),H=vSi(V,G,j,s);_(H)}}),x=L=>ga(null,null,function*(){var V,G;if(!((V=L==null?void 0:L.metricIds)!=null&&V.length)){h({visible:!0,title:"Error",message:"metric is missing"}),c(!1);return}const F=yield b((G=L==null?void 0:L.metricIds)==null?void 0:G[0]),W=pSi(F,l,s);_(Pi(ke({},W),{timeGrain:L==null?void 0:L.timeGrain,timeRange:L==null?void 0:L.timeRange,filters:L==null?void 0:L.filters}))});ce.useEffect(()=>{(e==null?void 0:e.type)==="metricInsight"&&(e!=null&&e.mql?S(e.mql):e!=null&&e.params?x(e.params):(c(!1),h({visible:!0,title:"Error",message:"mql or params is missing "})))},[e]);const w=()=>{c(!0),f({visible:!1,config:{},chartState:{}}),d(ke({},g)),y(Pi(ke({},g),{dataFormat:l==null?void 0:l.dataFormat}))},E=()=>{const{metrics:L}=g;return!(L!=null&&L.length)},A=(L,F)=>{p(W=>Pi(ke({},W),{[L]:F}))};if(e!=null&&e.hideControls)return null;const{timeRange:T,metrics:R,dimensions:k,timeGrain:O,filters:P}=g;return we.jsxs(Z8i,{className:"chart-controllers",theme:i,children:[we.jsxs("div",{className:"controllers",children:[we.jsx("div",{className:"controllers-icon",children:we.jsx(p0,{component:qxi})}),we.jsxs("div",{className:"controllers-content",children:[we.jsxs("div",{className:"row-item",children:[we.jsx(hRi,{timeRange:T,onChange:L=>A("timeRange",L)}),we.jsx(rd,{mode:"multiple",prefix:we.jsx(ho,{id:"metric"}),options:n,value:R,onChange:L=>{if(L.length>0){const F=n.filter(G=>L.includes(G.value));A("metrics",F);const W=F==null?void 0:F.flatMap(G=>G==null?void 0:G.atomicMetricIds),V=W?[...new Set(W)]:[];m(V).then(G=>{const z=uqe(F),X=fse(G,z,s);a(X)})}}})]}),we.jsxs("div",{className:"row-item",children:[we.jsx(rd,{mode:"multiple",prefix:we.jsx(ho,{id:"dimension"}),value:k,options:o,onChange:L=>{const F=L.map(G=>o.find(z=>z.value===G)).filter(G=>G!==void 0),W=F==null?void 0:F.some(G=>G.value===s.value);W!==!!O&&A("timeGrain",W?O||"day":""),A("dimensions",F)}}),we.jsx(rd,{prefix:we.jsx(ho,{id:"timeGrain"}),value:O,options:Yd(CS),onChange:L=>A("timeGrain",L),allowClear:!0})]})]})]}),we.jsxs("div",{className:"controllers",children:[we.jsx("div",{className:"controllers-icon",children:we.jsx(p0,{component:Yxi})}),we.jsx(K8i,{filters:P,onChange:L=>A("filters",L)})]}),we.jsx("div",{className:"apply-btns",children:we.jsx(pl,{disabled:E(),type:"primary",onClick:w,children:we.jsx(ho,{id:"apply"})})})]})}const SQe=i=>M.createElement("svg",ke({width:"1em",height:"1em",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i),M.createElement("path",{d:"M8.82166 9.99921L5.28613 13.5347L6.46464 14.7132L10.0002 11.1777L13.5357 14.7133L14.7142 13.5348L11.1787 9.99921L14.7142 6.46367L13.5357 5.28516L10.0002 8.82069L6.46467 5.28519L5.28616 6.4637L8.82166 9.99921Z",fill:"#89898A"})),fRi=Es.div`
11246
+ `,xQe=i=>{const[e,t]=ce.useState(null),[n,r]=ce.useState(!1),o=ce.useRef(null);ce.useEffect(()=>{const l=u=>{const c=o.current;c&&!c.contains(u.target)&&r(!1)};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[]);const a=()=>we.jsxs(dg,{className:"actions",justify:"space-between",align:"center",children:[we.jsx(Op,{type:"text",onClick:()=>r(!1),children:we.jsx(ho,{id:"cancel"})}),we.jsx(Op,{type:"text",onClick:()=>{i.onChange&&i.onChange(e==null?void 0:e.dates,e==null?void 0:e.dateStrings),r(!1)},children:we.jsx(ho,{id:"modalApply"})})]}),s=(l,u)=>{t({dates:l,dateStrings:u})};return we.jsxs(Yf,{theme:aRi,children:[we.jsx(lRi,{}),we.jsx("div",{ref:o,children:we.jsx(sRi,ke({suffixIcon:null,renderExtraFooter:a,showNow:!1,needConfirm:!0,onCalendarChange:s,open:n,getPopupContainer:()=>o.current,onClick:()=>r(!n),classNames:{popup:{root:"time-pick-popover"}}},i))})]})},uRi=({customTimeRange:i,onChange:e})=>{var n,r;const t=({from:o,to:a})=>{e({from:o||i.from,to:a||i.to})};return we.jsxs(eRi,{className:"custom-content",children:[we.jsxs("div",{className:"left-content",children:[we.jsx("div",{className:"title",children:we.jsx(ho,{id:"startTime"})}),we.jsx(CQe,{value:i.from,onChange:o=>{t({from:o})}}),we.jsxs("div",{className:"date-time",children:[we.jsx(gm,{value:(n=i.from)==null?void 0:n.format("YYYY/MM/DD")}),we.jsx(xQe,{onChange:o=>{o&&t({from:o})},value:i.from})]})]}),we.jsxs("div",{className:"right-content",children:[we.jsx("div",{className:"title",children:we.jsx(ho,{id:"endTime"})}),we.jsx(CQe,{value:i.to,onChange:o=>{t({to:o})}}),we.jsxs("div",{className:"date-time",children:[we.jsx(gm,{value:(r=i.to)==null?void 0:r.format("YYYY/MM/DD")}),we.jsx(xQe,{onChange:o=>{o&&t({to:o})},value:i.to})]})]})]})},cRi=({type:i,setClose:e,setApply:t,timeRange:n})=>{const[r,o]=ce.useState({from:Ir().subtract(7,"day"),to:Ir()}),[a,s]=ce.useState({type:"lastPeriod",lastPeriod:{range:7,unit:"day"}});ce.useEffect(()=>{var u,c;i==="custom"&&(u=n==null?void 0:n.custom)!=null&&u.from&&(c=n==null?void 0:n.custom)!=null&&c.to&&o({from:Ir(n.custom.from),to:Ir(n.custom.to)}),i==="advanced"&&n!=null&&n.advanced&&s(n.advanced)},[n]);const l=()=>{if(i==="custom"){const u=Ir(r.from).format(Ob),c=Ir(r.to).format(Ob);t({type:"custom",custom:{from:u,to:c}})}i==="advanced"&&t({type:"advanced",advanced:ke({},a)})};return we.jsxs(J8i,{className:"time-popover-container",children:[we.jsxs("div",{className:"time-popover-header",children:[we.jsx(pl,{className:"icon-box",type:"text",onClick:()=>e(!0),children:we.jsx(p0,{component:iRi})}),we.jsx("span",{className:"time-title",children:we.jsx(ho,{id:i})})]}),we.jsxs("div",{className:"time-popover-content",children:[i==="custom"&&we.jsx(uRi,{customTimeRange:r,onChange:u=>o(u)}),i==="advanced"&&we.jsx(rRi,{advancedTimeRange:a,onChange:u=>{s(u)}})]}),we.jsxs("div",{className:"time-footer",children:[we.jsx("div",{className:"time-footer-btn cancel-btn",children:we.jsx(Op,{type:"text",onClick:()=>e(),children:we.jsx(ho,{id:"cancel"})})}),we.jsx("div",{className:"time-footer-btn apply-btn",children:we.jsx(Op,{type:"text",onClick:l,children:we.jsx(ho,{id:"modalApply"})})})]})]})},hRi=({timeRange:i,onChange:e})=>{const{formatMessage:t}=Jh(),[n,r]=ce.useState(!1),[o,a]=ce.useState(!1),s=ce.useRef(null),[l,u]=ce.useState("");ce.useEffect(()=>{const g=p=>{var b,y;const m=(b=s.current)==null?void 0:b.contains(p.target),v=(y=document.querySelector(".advanced-select-dropdown"))==null?void 0:y.contains(p.target);!m&&!v&&a(!1)};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[]),ce.useEffect(()=>{i&&((i.type==="custom"||i.type==="advanced")&&u(i.type),i.type==="basic"&&i.basic&&u(i==null?void 0:i.basic),i.type||u(""))},[i]);const c=g=>{e(g),a(!1)},h=g=>{if(g==="custom"||g==="advanced"){u(g),a(!0);return}o&&a(!1),e({type:g?"basic":"",basic:g||""})},d=({label:g,value:p})=>p==="custom"||p==="advanced"?ASi(g,i,t):g,f=g=>{const p=g.value==="advanced"||g.value==="custom";return we.jsxs(dg,{align:"center",justify:"space-between",onClick:()=>{(g.value==="advanced"||g.value==="custom")&&a(!0)},children:[we.jsx("span",{className:"label",children:g.label}),p&&we.jsx("span",{className:"icon",children:we.jsx(ise,{})})]})};return we.jsxs(Q8i,{ref:s,children:[we.jsx(rd,{className:"time-range-select",prefix:we.jsx(ho,{id:"timeRange"}),value:l,options:Yd(_Si),optionRender:f,labelRender:d,open:n,onChange:h,getPopupContainer:()=>s.current,onOpenChange:g=>{g&&((i==null?void 0:i.type)==="advanced"||(i==null?void 0:i.type)==="custom")&&a(!o),r(g)},allowClear:!0}),o&&we.jsx(cRi,{type:l,timeRange:i,setClose:g=>{a(!1),i&&e(ke({},i)),g&&r(!0)},setApply:c})]})};function dRi({theme:i,dataSource:e}){const t=Jh(),[n,r]=ce.useState([]),[o,a]=ce.useState([]),s={label:t.formatMessage({id:"metricTime"}),value:"metricTime"},{chartJson:l,setDataSourceQueryInfo:u,setLoading:c,setError:h,setControllerConfig:d,setChartDrillBy:f}=Qh(),[g,p]=ce.useState({metrics:[],dimensions:[]}),{queryDimensions:m,queryMql2Params:v,queryMetricId:b}=oqe(e==null?void 0:e.type),{queryChartDataFromDatasource:y}=gse(e),_=L=>{const F={metrics:(L==null?void 0:L.metrics)||[],dimensions:(L==null?void 0:L.dimensions)||[],timeRange:RSi(L==null?void 0:L.timeRange,e)||{},timeGrain:TSi(L==null?void 0:L.timeDimension)||(L==null?void 0:L.timeGrain)||(l==null?void 0:l.timeGrain),filters:rSi(L==null?void 0:L.filters),queryMetricOrgId:L==null?void 0:L.queryMetricOrgId};p(F),r(L==null?void 0:L.metrics),a((L==null?void 0:L.dissionOptions)||[]),u({metrics:(L==null?void 0:L.metrics)||[],dimensions:(L==null?void 0:L.dissionOptions)||[]}),d(F);const W=Pi(ke({},F),{dataFormat:L==null?void 0:L.dataFormat});y(W,!0)},S=L=>ga(null,null,function*(){var W;const F=yield v(L);if(F&&Array.isArray(F)&&F.length>0){const V=F[0],G=mSi(L,V),z=(W=G==null?void 0:G.metricsOptions)==null?void 0:W.flatMap(J=>J==null?void 0:J.atomicMetricIds),X=z?[...new Set(z)]:[];if(!(X!=null&&X.length)){h({visible:!0,title:"Error",message:"metric is missing"}),c(!1);return}const j=yield m(X),H=vSi(V,G,j,s);_(H)}}),x=L=>ga(null,null,function*(){var V,G;if(!((V=L==null?void 0:L.metricIds)!=null&&V.length)){h({visible:!0,title:"Error",message:"metric is missing"}),c(!1);return}const F=yield b((G=L==null?void 0:L.metricIds)==null?void 0:G[0]),W=pSi(F,l,s);_(Pi(ke({},W),{timeGrain:L==null?void 0:L.timeGrain,timeRange:L==null?void 0:L.timeRange,filters:L==null?void 0:L.filters}))});ce.useEffect(()=>{(e==null?void 0:e.type)==="metricInsight"&&(e!=null&&e.mql?S(e.mql):e!=null&&e.params?x(e.params):(c(!1),h({visible:!0,title:"Error",message:"mql or params is missing "})))},[e]);const w=()=>{c(!0),f({visible:!1,config:{},chartState:{}}),d(ke({},g)),y(Pi(ke({},g),{dataFormat:l==null?void 0:l.dataFormat}))},E=()=>{const{metrics:L}=g;return!(L!=null&&L.length)},A=(L,F)=>{p(W=>Pi(ke({},W),{[L]:F}))};if(e!=null&&e.hideControls)return null;const{timeRange:T,metrics:R,dimensions:k,timeGrain:O,filters:P}=g;return we.jsxs(Z8i,{className:"chart-controllers",theme:i,children:[we.jsxs("div",{className:"controllers",children:[we.jsx("div",{className:"controllers-icon",children:we.jsx(p0,{component:qxi})}),we.jsxs("div",{className:"controllers-content",children:[we.jsxs("div",{className:"row-item",children:[we.jsx(hRi,{timeRange:T,onChange:L=>A("timeRange",L)}),we.jsx(rd,{mode:"multiple",prefix:we.jsx(ho,{id:"metric"}),options:n,value:R,onChange:L=>{if(L.length>0){const F=n.filter(G=>L.includes(G.value));A("metrics",F);const W=F==null?void 0:F.flatMap(G=>G==null?void 0:G.atomicMetricIds),V=W?[...new Set(W)]:[];m(V).then(G=>{const z=uqe(F),X=fse(G,z,s);a(X)})}}})]}),we.jsxs("div",{className:"row-item",children:[we.jsx(rd,{mode:"multiple",prefix:we.jsx(ho,{id:"dimension"}),value:k,options:o,onChange:L=>{const F=L.map(G=>o.find(z=>z.value===G)).filter(G=>G!==void 0),W=F==null?void 0:F.some(G=>G.value===s.value);W!==!!O&&A("timeGrain",W?O||"day":""),A("dimensions",F)}}),we.jsx(rd,{prefix:we.jsx(ho,{id:"timeGrain"}),value:O,options:Yd(CS),onChange:L=>A("timeGrain",L),allowClear:!0})]})]})]}),we.jsxs("div",{className:"controllers",children:[we.jsx("div",{className:"controllers-icon",children:we.jsx(p0,{component:Yxi})}),we.jsx(K8i,{filters:P,onChange:L=>A("filters",L)})]}),we.jsx("div",{className:"apply-btns",children:we.jsx(pl,{disabled:E(),type:"primary",onClick:w,children:we.jsx(ho,{id:"apply"})})})]})}const SQe=i=>M.createElement("svg",ke({width:"1em",height:"1em",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i),M.createElement("path",{d:"M8.82166 9.99921L5.28613 13.5347L6.46464 14.7132L10.0002 11.1777L13.5357 14.7133L14.7142 13.5348L11.1787 9.99921L14.7142 6.46367L13.5357 5.28516L10.0002 8.82069L6.46467 5.28519L5.28616 6.4637L8.82166 9.99921Z",fill:"#89898A"})),fRi=Es.div`
11247
11247
  ${i=>{const{theme:e}=i;return{position:"absolute",top:0,left:0,height:"100%",width:"100%",zIndex:999,background:e==="dark"?"#333":"#fff",".header":{height:"48px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",boxSizing:"border-box"},".title":{height:"32px",lineHeight:"32px",fontSize:"14px",fontWeight:"700",color:e==="dark"?"#C8C8C8":"#323233",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginRight:"8px"},".advt-vis-chart-antd-btn-icon>.anticon":{fontSize:"20px"},".detail-data-table":{height:"calc(100% - 48px)"}}}}
11248
11248
  `,gRi=({dataSource:i})=>{const{dataDetail:e,setDataDetail:t,controllerConfig:n}=Qh(),{queyDetailTableData:r}=gse(i),[o,a]=ce.useState([]),s=Jh();return ce.useEffect(()=>{e!=null&&e.visible&&(t(Pi(ke({},e),{loading:!0})),r(n).then(l=>{a(l),t(Pi(ke({},e),{error:"",loading:!1}))}).catch(l=>{a([]),t(Pi(ke({},e),{error:l==null?void 0:l.message}))}))},[e==null?void 0:e.visible,n]),we.jsxs(fRi,{children:[we.jsxs("div",{className:"header",children:[we.jsx("div",{className:"title",children:we.jsx(ho,{id:"DetailData"})}),we.jsx("div",{className:"",children:we.jsx(pl,{className:"del-button",type:"text",icon:we.jsx(p0,{component:SQe,style:{fontSize:"20px"}}),onClick:()=>{t({visible:!1,error:"",loading:!1})}})})]}),we.jsxs("div",{className:"detail-data-table",children:[!(e!=null&&e.loading)&&!e.error&&we.jsx(Fae,{data:o}),(e==null?void 0:e.loading)&&we.jsx(HT,{}),e.error&&we.jsx(Hae,{message:e.error,visible:!0,title:s.formatMessage({id:"detailDataError"})})]})]})},pRi=Es.div`
11249
11249
  ${()=>bl`
Binary file
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const version = "3.0.9";
1
+ declare const version = "3.0.10";
2
2
  export default version;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@advt-gpt-chart/package",
3
3
  "private": false,
4
- "version": "3.0.9",
4
+ "version": "3.0.10",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"