@opengis/bi 1.0.28 → 1.0.29

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/bi.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l as f } from "./import-file-nBKuPZWn.js";
1
+ import { l as f } from "./import-file-SGbMr5Cs.js";
2
2
  export {
3
3
  f as default
4
4
  };
package/dist/bi.umd.cjs CHANGED
@@ -81,7 +81,7 @@ echarts.use([`+se+"]);":"Unknown series "+Q))}return}if(d==="tooltip"){if(P){vf.
81
81
  `,"Illegal config:",f,`.
82
82
  `)),Pr(i));var E=m?tP(m):null;m&&!E&&(tl.NODE_ENV!=="production"&&(i=$n("Invalid parser name "+m+`.
83
83
  `,"Illegal config:",f,`.
84
- `)),Pr(i)),a.push({dimIdx:D.index,parser:E,comparator:new iP(v,_)})});var o=e.sourceFormat;o!==Tn&&o!==ro&&(tl.NODE_ENV!=="production"&&(i='sourceFormat "'+o+'" is not supported yet'),Pr(i));for(var s=[],l=0,h=e.count();l<h;l++)s.push(e.getRawDataItem(l));return s.sort(function(f,d){for(var v=0;v<a.length;v++){var m=a[v],_=e.retrieveValueFromItem(f,m.dimIdx),b=e.retrieveValueFromItem(d,m.dimIdx);m.parser&&(_=m.parser(_),b=m.parser(b));var S=m.comparator.evaluate(_,b);if(S!==0)return S}return 0}),{data:s}}};function ese(r){r.registerTransform(Joe),r.registerTransform(Qoe)}var tse=function(r){Ne(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.prototype.init=function(t,i,n){r.prototype.init.call(this,t,i,n),this._sourceManager=new uP(this),cP(this)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),cP(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:hs},e}(or),rse=function(r){Ne(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.type="dataset",e}(fi);function ise(r){r.registerComponentModel(tse),r.registerComponentView(rse)}var xs=ls.CMD;function Yf(r,e){return Math.abs(r-e)<1e-5}function LC(r){var e=r.data,t=r.len(),i=[],n,a=0,o=0,s=0,l=0;function h(ne,ue){n&&n.length>2&&i.push(n),n=[ne,ue]}function f(ne,ue,de,_e){Yf(ne,de)&&Yf(ue,_e)||n.push(ne,ue,de,_e,de,_e)}function d(ne,ue,de,_e,Ie,Ce){var Oe=Math.abs(ue-ne),Ue=Math.tan(Oe/4)*4/3,He=ue<ne?-1:1,Ke=Math.cos(ne),mt=Math.sin(ne),yt=Math.cos(ue),Ct=Math.sin(ue),_r=Ke*Ie+de,Ar=mt*Ce+_e,Nt=yt*Ie+de,xt=Ct*Ce+_e,Ut=Ie*Ue*He,ft=Ce*Ue*He;n.push(_r-Ut*mt,Ar+ft*Ke,Nt+Ut*Ct,xt-ft*yt,Nt,xt)}for(var v,m,_,b,S=0;S<t;){var D=e[S++],E=S===1;switch(E&&(a=e[S],o=e[S+1],s=a,l=o,(D===xs.L||D===xs.C||D===xs.Q)&&(n=[s,l])),D){case xs.M:a=s=e[S++],o=l=e[S++],h(s,l);break;case xs.L:v=e[S++],m=e[S++],f(a,o,v,m),a=v,o=m;break;case xs.C:n.push(e[S++],e[S++],e[S++],e[S++],a=e[S++],o=e[S++]);break;case xs.Q:v=e[S++],m=e[S++],_=e[S++],b=e[S++],n.push(a+2/3*(v-a),o+2/3*(m-o),_+2/3*(v-_),b+2/3*(m-b),_,b),a=_,o=b;break;case xs.A:var P=e[S++],z=e[S++],V=e[S++],F=e[S++],U=e[S++],j=e[S++]+U;S+=1;var Z=!e[S++];v=Math.cos(U)*V+P,m=Math.sin(U)*F+z,E?(s=v,l=m,h(s,l)):f(a,o,v,m),a=Math.cos(j)*V+P,o=Math.sin(j)*F+z;for(var X=(Z?-1:1)*Math.PI/2,Q=U;Z?Q>j:Q<j;Q+=X){var se=Z?Math.max(Q+X,j):Math.min(Q+X,j);d(Q,se,P,z,V,F)}break;case xs.R:s=a=e[S++],l=o=e[S++],v=s+e[S++],m=l+e[S++],h(v,l),f(v,l,v,m),f(v,m,s,m),f(s,m,s,l),f(s,l,v,l);break;case xs.Z:n&&f(a,o,s,l),a=s,o=l;break}}return n&&n.length>2&&i.push(n),i}function RC(r,e,t,i,n,a,o,s,l,h){if(Yf(r,t)&&Yf(e,i)&&Yf(n,o)&&Yf(a,s)){l.push(o,s);return}var f=2/h,d=f*f,v=o-r,m=s-e,_=Math.sqrt(v*v+m*m);v/=_,m/=_;var b=t-r,S=i-e,D=n-o,E=a-s,P=b*b+S*S,z=D*D+E*E;if(P<d&&z<d){l.push(o,s);return}var V=v*b+m*S,F=-v*D-m*E,U=P-V*V,j=z-F*F;if(U<d&&V>=0&&j<d&&F>=0){l.push(o,s);return}var Z=[],X=[];Dl(r,t,n,o,.5,Z),Dl(e,i,a,s,.5,X),RC(Z[0],X[0],Z[1],X[1],Z[2],X[2],Z[3],X[3],l,h),RC(Z[4],X[4],Z[5],X[5],Z[6],X[6],Z[7],X[7],l,h)}function nse(r,e){var t=LC(r),i=[];e=e||1;for(var n=0;n<t.length;n++){var a=t[n],o=[],s=a[0],l=a[1];o.push(s,l);for(var h=2;h<a.length;){var f=a[h++],d=a[h++],v=a[h++],m=a[h++],_=a[h++],b=a[h++];RC(s,l,f,d,v,m,_,b,o,e),s=_,l=b}i.push(o)}return i}function V3(r,e,t){var i=r[e],n=r[1-e],a=Math.abs(i/n),o=Math.ceil(Math.sqrt(a*t)),s=Math.floor(t/o);s===0&&(s=1,o=t);for(var l=[],h=0;h<o;h++)l.push(s);var f=o*s,d=t-f;if(d>0)for(var h=0;h<d;h++)l[h%o]+=1;return l}function F3(r,e,t){for(var i=r.r0,n=r.r,a=r.startAngle,o=r.endAngle,s=Math.abs(o-a),l=s*n,h=n-i,f=l>Math.abs(h),d=V3([l,h],f?0:1,e),v=(f?s:h)/d.length,m=0;m<d.length;m++)for(var _=(f?h:s)/d[m],b=0;b<d[m];b++){var S={};f?(S.startAngle=a+v*m,S.endAngle=a+v*(m+1),S.r0=i+_*b,S.r=i+_*(b+1)):(S.startAngle=a+_*b,S.endAngle=a+_*(b+1),S.r0=i+v*m,S.r=i+v*(m+1)),S.clockwise=r.clockwise,S.cx=r.cx,S.cy=r.cy,t.push(S)}}function ase(r,e,t){for(var i=r.width,n=r.height,a=i>n,o=V3([i,n],a?0:1,e),s=a?"width":"height",l=a?"height":"width",h=a?"x":"y",f=a?"y":"x",d=r[s]/o.length,v=0;v<o.length;v++)for(var m=r[l]/o[v],_=0;_<o[v];_++){var b={};b[h]=v*d,b[f]=_*m,b[s]=d,b[l]=m,b.x+=r.x,b.y+=r.y,t.push(b)}}function $3(r,e,t,i){return r*i-t*e}function ose(r,e,t,i,n,a,o,s){var l=t-r,h=i-e,f=o-n,d=s-a,v=$3(f,d,l,h);if(Math.abs(v)<1e-6)return null;var m=r-n,_=e-a,b=$3(m,_,f,d)/v;return b<0||b>1?null:new qt(b*l+r,b*h+e)}function sse(r,e,t){var i=new qt;qt.sub(i,t,e),i.normalize();var n=new qt;qt.sub(n,r,e);var a=n.dot(i);return a}function Kf(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function lse(r,e,t){for(var i=r.length,n=[],a=0;a<i;a++){var o=r[a],s=r[(a+1)%i],l=ose(o[0],o[1],s[0],s[1],e.x,e.y,t.x,t.y);l&&n.push({projPt:sse(l,e,t),pt:l,idx:a})}if(n.length<2)return[{points:r},{points:r}];n.sort(function(S,D){return S.projPt-D.projPt});var h=n[0],f=n[n.length-1];if(f.idx<h.idx){var d=h;h=f,f=d}for(var v=[h.pt.x,h.pt.y],m=[f.pt.x,f.pt.y],_=[v],b=[m],a=h.idx+1;a<=f.idx;a++)Kf(_,r[a].slice());Kf(_,m),Kf(_,v);for(var a=f.idx+1;a<=h.idx+i;a++)Kf(b,r[a%i].slice());return Kf(b,v),Kf(b,m),[{points:_},{points:b}]}function G3(r){var e=r.points,t=[],i=[];uy(e,t,i);var n=new Kt(t[0],t[1],i[0]-t[0],i[1]-t[1]),a=n.width,o=n.height,s=n.x,l=n.y,h=new qt,f=new qt;return a>o?(h.x=f.x=s+a/2,h.y=l,f.y=l+o):(h.y=f.y=l+o/2,h.x=s,f.x=s+a),lse(e,h,f)}function P0(r,e,t,i){if(t===1)i.push(e);else{var n=Math.floor(t/2),a=r(e);P0(r,a[0],n,i),P0(r,a[1],t-n,i)}return i}function use(r,e){for(var t=[],i=0;i<e;i++)t.push(q1(r));return t}function cse(r,e){e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel}function hse(r){for(var e=[],t=0;t<r.length;)e.push([r[t++],r[t++]]);return e}function fse(r,e){var t=[],i=r.shape,n;switch(r.type){case"rect":ase(i,e,t),n=mr;break;case"sector":F3(i,e,t),n=Hn;break;case"circle":F3({r0:0,r:i.r,startAngle:0,endAngle:Math.PI*2,cx:i.cx,cy:i.cy},e,t),n=Hn;break;default:var a=r.getComputedTransform(),o=a?Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1],a[2]*a[2]+a[3]*a[3])):1,s=je(nse(r.getUpdatedPathProxy(),o),function(D){return hse(D)}),l=s.length;if(l===0)P0(G3,{points:s[0]},e,t);else if(l===e)for(var h=0;h<l;h++)t.push({points:s[h]});else{var f=0,d=je(s,function(D){var E=[],P=[];uy(D,E,P);var z=(P[1]-E[1])*(P[0]-E[0]);return f+=z,{poly:D,area:z}});d.sort(function(D,E){return E.area-D.area});for(var v=e,h=0;h<l;h++){var m=d[h];if(v<=0)break;var _=h===l-1?v:Math.ceil(m.area/f*e);_<0||(P0(G3,{points:m.poly},_,t),v-=_)}}n=Wn;break}if(!n)return use(r,e);for(var b=[],h=0;h<t.length;h++){var S=new n;S.setShape(t[h]),cse(r,S),b.push(S)}return b}function dse(r,e){var t=r.length,i=e.length;if(t===i)return[r,e];for(var n=[],a=[],o=t<i?r:e,s=Math.min(t,i),l=Math.abs(i-t)/6,h=(s-2)/6,f=Math.ceil(l/h)+1,d=[o[0],o[1]],v=l,m=2;m<s;){var _=o[m-2],b=o[m-1],S=o[m++],D=o[m++],E=o[m++],P=o[m++],z=o[m++],V=o[m++];if(v<=0){d.push(S,D,E,P,z,V);continue}for(var F=Math.min(v,f-1)+1,U=1;U<=F;U++){var j=U/F;Dl(_,S,E,z,j,n),Dl(b,D,P,V,j,a),_=n[3],b=a[3],d.push(n[1],a[1],n[2],a[2],_,b),S=n[5],D=a[5],E=n[6],P=a[6]}v-=F-1}return o===r?[d,e]:[r,d]}function U3(r,e){for(var t=r.length,i=r[t-2],n=r[t-1],a=[],o=0;o<e.length;)a[o++]=i,a[o++]=n;return a}function pse(r,e){for(var t,i,n,a=[],o=[],s=0;s<Math.max(r.length,e.length);s++){var l=r[s],h=e[s],f=void 0,d=void 0;l?h?(t=dse(l,h),f=t[0],d=t[1],i=f,n=d):(d=U3(n||l,l),f=l):(f=U3(i||h,h),d=h),a.push(f),o.push(d)}return[a,o]}function H3(r){for(var e=0,t=0,i=0,n=r.length,a=0,o=n-2;a<n;o=a,a+=2){var s=r[o],l=r[o+1],h=r[a],f=r[a+1],d=s*f-h*l;e+=d,t+=(s+h)*d,i+=(l+f)*d}return e===0?[r[0]||0,r[1]||0]:[t/e/3,i/e/3,e]}function vse(r,e,t,i){for(var n=(r.length-2)/6,a=1/0,o=0,s=r.length,l=s-2,h=0;h<n;h++){for(var f=h*6,d=0,v=0;v<s;v+=2){var m=v===0?f:(f+v-2)%l+2,_=r[m]-t[0],b=r[m+1]-t[1],S=e[v]-i[0],D=e[v+1]-i[1],E=S-_,P=D-b;d+=E*E+P*P}d<a&&(a=d,o=h)}return o}function gse(r){for(var e=[],t=r.length,i=0;i<t;i+=2)e[i]=r[t-i-2],e[i+1]=r[t-i-1];return e}function mse(r,e,t,i){for(var n=[],a,o=0;o<r.length;o++){var s=r[o],l=e[o],h=H3(s),f=H3(l);a==null&&(a=h[2]<0!=f[2]<0);var d=[],v=[],m=0,_=1/0,b=[],S=s.length;a&&(s=gse(s));for(var D=vse(s,l,h,f)*6,E=S-2,P=0;P<E;P+=2){var z=(D+P)%E+2;d[P+2]=s[z]-h[0],d[P+3]=s[z+1]-h[1]}d[0]=s[D]-h[0],d[1]=s[D+1]-h[1];for(var V=i/t,F=-i/2;F<=i/2;F+=V){for(var U=Math.sin(F),j=Math.cos(F),Z=0,P=0;P<s.length;P+=2){var X=d[P],Q=d[P+1],se=l[P]-f[0],ne=l[P+1]-f[1],ue=se*j-ne*U,de=se*U+ne*j;b[P]=ue,b[P+1]=de;var _e=ue-X,Ie=de-Q;Z+=_e*_e+Ie*Ie}if(Z<_){_=Z,m=F;for(var Ce=0;Ce<b.length;Ce++)v[Ce]=b[Ce]}}n.push({from:d,to:v,fromCp:h,toCp:f,rotation:-m})}return n}function L0(r){return r.__isCombineMorphing}var W3="__mOriginal_";function R0(r,e,t){var i=W3+e,n=r[i]||r[e];r[i]||(r[i]=r[e]);var a=t.replace,o=t.after,s=t.before;r[e]=function(){var l=arguments,h;return s&&s.apply(this,l),a?h=a.apply(this,l):h=n.apply(this,l),o&&o.apply(this,l),h}}function Zv(r,e){var t=W3+e;r[t]&&(r[e]=r[t],r[t]=null)}function j3(r,e){for(var t=0;t<r.length;t++)for(var i=r[t],n=0;n<i.length;){var a=i[n],o=i[n+1];i[n++]=e[0]*a+e[2]*o+e[4],i[n++]=e[1]*a+e[3]*o+e[5]}}function Z3(r,e){var t=r.getUpdatedPathProxy(),i=e.getUpdatedPathProxy(),n=pse(LC(t),LC(i)),a=n[0],o=n[1],s=r.getComputedTransform(),l=e.getComputedTransform();function h(){this.transform=null}s&&j3(a,s),l&&j3(o,l),R0(e,"updateTransform",{replace:h}),e.transform=null;var f=mse(a,o,10,Math.PI),d=[];R0(e,"buildPath",{replace:function(v){for(var m=e.__morphT,_=1-m,b=[],S=0;S<f.length;S++){var D=f[S],E=D.from,P=D.to,z=D.rotation*m,V=D.fromCp,F=D.toCp,U=Math.sin(z),j=Math.cos(z);Mm(b,V,F,m);for(var Z=0;Z<E.length;Z+=2){var X=E[Z],Q=E[Z+1],se=P[Z],ne=P[Z+1],ue=X*_+se*m,de=Q*_+ne*m;d[Z]=ue*j-de*U+b[0],d[Z+1]=ue*U+de*j+b[1]}var _e=d[0],Ie=d[1];v.moveTo(_e,Ie);for(var Z=2;Z<E.length;){var se=d[Z++],ne=d[Z++],Ce=d[Z++],Oe=d[Z++],Ue=d[Z++],He=d[Z++];_e===se&&Ie===ne&&Ce===Ue&&Oe===He?v.lineTo(Ue,He):v.bezierCurveTo(se,ne,Ce,Oe,Ue,He),_e=Ue,Ie=He}}}})}function zC(r,e,t){if(!r||!e)return e;var i=t.done,n=t.during;Z3(r,e),e.__morphT=0;function a(){Zv(e,"buildPath"),Zv(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return e.animateTo({__morphT:1},Pt({during:function(o){e.dirtyShape(),n&&n(o)},done:function(){a(),i&&i()}},t)),e}function yse(r,e,t,i,n,a){var o=16;r=n===t?0:Math.round(32767*(r-t)/(n-t)),e=a===i?0:Math.round(32767*(e-i)/(a-i));for(var s=0,l,h=(1<<o)/2;h>0;h/=2){var f=0,d=0;(r&h)>0&&(f=1),(e&h)>0&&(d=1),s+=h*h*(3*f^d),d===0&&(f===1&&(r=h-1-r,e=h-1-e),l=r,r=e,e=l)}return s}function z0(r){var e=1/0,t=1/0,i=-1/0,n=-1/0,a=je(r,function(s){var l=s.getBoundingRect(),h=s.getComputedTransform(),f=l.x+l.width/2+(h?h[4]:0),d=l.y+l.height/2+(h?h[5]:0);return e=Math.min(f,e),t=Math.min(d,t),i=Math.max(f,i),n=Math.max(d,n),[f,d]}),o=je(a,function(s,l){return{cp:s,z:yse(s[0],s[1],e,t,i,n),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function q3(r){return fse(r.path,r.count)}function NC(){return{fromIndividuals:[],toIndividuals:[],count:0}}function _se(r,e,t){var i=[];function n(V){for(var F=0;F<V.length;F++){var U=V[F];L0(U)?n(U.childrenRef()):U instanceof ar&&i.push(U)}}n(r);var a=i.length;if(!a)return NC();var o=t.dividePath||q3,s=o({path:e,count:a});if(s.length!==a)return console.error("Invalid morphing: unmatched splitted path"),NC();i=z0(i),s=z0(s);for(var l=t.done,h=t.during,f=t.individualDelay,d=new Ns,v=0;v<a;v++){var m=i[v],_=s[v];_.parent=e,_.copyTransform(d),f||Z3(m,_)}e.__isCombineMorphing=!0,e.childrenRef=function(){return s};function b(V){for(var F=0;F<s.length;F++)s[F].addSelfToZr(V)}R0(e,"addSelfToZr",{after:function(V){b(V)}}),R0(e,"removeSelfFromZr",{after:function(V){for(var F=0;F<s.length;F++)s[F].removeSelfFromZr(V)}});function S(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,Zv(e,"addSelfToZr"),Zv(e,"removeSelfFromZr")}var D=s.length;if(f)for(var E=D,P=function(){E--,E===0&&(S(),l&&l())},v=0;v<D;v++){var z=f?Pt({delay:(t.delay||0)+f(v,D,i[v],s[v]),done:P},t):t;zC(i[v],s[v],z)}else e.__morphT=0,e.animateTo({__morphT:1},Pt({during:function(V){for(var F=0;F<D;F++){var U=s[F];U.__morphT=e.__morphT,U.dirtyShape()}h&&h(V)},done:function(){S();for(var V=0;V<r.length;V++)Zv(r[V],"updateTransform");l&&l()}},t));return e.__zr&&b(e.__zr),{fromIndividuals:i,toIndividuals:s,count:D}}function xse(r,e,t){var i=e.length,n=[],a=t.dividePath||q3;function o(m){for(var _=0;_<m.length;_++){var b=m[_];L0(b)?o(b.childrenRef()):b instanceof ar&&n.push(b)}}if(L0(r)){o(r.childrenRef());var s=n.length;if(s<i)for(var l=0,h=s;h<i;h++)n.push(q1(n[l++%s]));n.length=i}else{n=a({path:r,count:i});for(var f=r.getComputedTransform(),h=0;h<n.length;h++)n[h].setLocalTransform(f);if(n.length!==i)return console.error("Invalid morphing: unmatched splitted path"),NC()}n=z0(n),e=z0(e);for(var d=t.individualDelay,h=0;h<i;h++){var v=d?Pt({delay:(t.delay||0)+d(h,i,n[h],e[h])},t):t;zC(n[h],e[h],v)}return{fromIndividuals:n,toIndividuals:e,count:e.length}}function X3(r){return We(r[0])}function Y3(r,e){for(var t=[],i=r.length,n=0;n<i;n++)t.push({one:r[n],many:[]});for(var n=0;n<e.length;n++){var a=e[n].length,o=void 0;for(o=0;o<a;o++)t[o%i].many.push(e[n][o])}for(var s=0,n=i-1;n>=0;n--)if(!t[n].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var a=l.length,h=Math.ceil(a/2);t[n].many=l.slice(h,a),t[s].many=l.slice(0,h),s++}return t}var bse={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),i=0;i<r.count;i++){var n=q1(r.path);n.setStyle("opacity",t),e.push(n)}return e},split:null};function OC(r,e,t,i,n,a){if(!r.length||!e.length)return;var o=rf("update",i,n);if(!(o&&o.duration>0))return;var s=i.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),h,f;X3(r)&&(h=r,f=e),X3(e)&&(h=e,f=r);function d(D,E,P,z,V){var F=D.many,U=D.one;if(F.length===1&&!V){var j=E?F[0]:U,Z=E?U:F[0];if(L0(j))d({many:[j],one:Z},!0,P,z,!0);else{var X=s?Pt({delay:s(P,z)},l):l;zC(j,Z,X),a(j,Z,j,Z,X)}}else for(var Q=Pt({dividePath:bse[t],individualDelay:s&&function(Ie,Ce,Oe,Ue){return s(Ie+P,z)}},l),se=E?_se(F,U,Q):xse(U,F,Q),ne=se.fromIndividuals,ue=se.toIndividuals,de=ne.length,_e=0;_e<de;_e++){var X=s?Pt({delay:s(_e,de)},l):l;a(ne[_e],ue[_e],E?F[_e]:D.one,E?D.one:F[_e],X)}}for(var v=h?h===r:r.length>e.length,m=h?Y3(f,h):Y3(v?e:r,[v?r:e]),_=0,b=0;b<m.length;b++)_+=m[b].many.length;for(var S=0,b=0;b<m.length;b++)d(m[b],v,S,_),S+=m[b].many.length}function rh(r){if(!r)return[];if(We(r)){for(var e=[],t=0;t<r.length;t++)e.push(rh(r[t]));return e}var i=[];return r.traverse(function(n){n instanceof ar&&!n.disableMorphing&&!n.invisible&&!n.ignore&&i.push(n)}),i}var BC={},K3=1e4,wse=0,J3=1,Q3=2,Sse=gr();function Tse(r,e){for(var t=r.dimensions,i=0;i<t.length;i++){var n=r.getDimensionInfo(t[i]);if(n&&n.otherDims[e]===0)return t[i]}}function Cse(r,e,t){var i=r.getDimensionInfo(t),n=i&&i.ordinalMeta;if(i){var a=r.get(i.name,e);return n&&n.categories[a]||a+""}}function eF(r,e,t,i){var n=i?"itemChildGroupId":"itemGroupId",a=Tse(r,n);if(a){var o=Cse(r,e,a);return o}var s=r.getRawDataItem(e),l=i?"childGroupId":"groupId";if(s&&s[l])return s[l]+"";if(!i)return t||r.getId(e)}function tF(r){var e=[];return J(r,function(t){var i=t.data,n=t.dataGroupId;if(i.count()>K3){BC.NODE_ENV!=="production"&&di("Universal transition is disabled on large data > 10k.");return}for(var a=i.getIndices(),o=0;o<a.length;o++)e.push({data:i,groupId:eF(i,o,n,!1),childGroupId:eF(i,o,n,!0),divide:t.divide,dataIndex:o})}),e}function VC(r,e,t){r.traverse(function(i){i instanceof ar&&ui(i,{style:{opacity:0}},e,{dataIndex:t,isFrom:!0})})}function FC(r){if(r.parent){var e=r.getComputedTransform();r.setLocalTransform(e),r.parent.remove(r)}}function Jf(r){r.stopAnimation(),r.isGroup&&r.traverse(function(e){e.stopAnimation()})}function Dse(r,e,t){var i=rf("update",t,e);i&&r.traverse(function(n){if(n instanceof Ka){var a=RH(n);a&&n.animateFrom({style:a},i)}})}function Ase(r,e){var t=r.length;if(t!==e.length)return!1;for(var i=0;i<t;i++){var n=r[i],a=e[i];if(n.data.getId(n.dataIndex)!==a.data.getId(a.dataIndex))return!1}return!0}function rF(r,e,t){var i=tF(r),n=tF(e);function a(P,z,V,F,U){(V||P)&&z.animateFrom({style:V&&V!==P?Fe(Fe({},V.style),P.style):P.style},U)}var o=!1,s=wse,l=gt(),h=gt();i.forEach(function(P){P.groupId&&l.set(P.groupId,!0),P.childGroupId&&h.set(P.childGroupId,!0)});for(var f=0;f<n.length;f++){var d=n[f].groupId;if(h.get(d)){s=J3;break}var v=n[f].childGroupId;if(v&&l.get(v)){s=Q3;break}}function m(P,z){return function(V){var F=V.data,U=V.dataIndex;return z?F.getId(U):P?s===J3?V.childGroupId:V.groupId:s===Q3?V.childGroupId:V.groupId}}var _=Ase(i,n),b={};if(!_)for(var f=0;f<n.length;f++){var S=n[f],D=S.data.getItemGraphicEl(S.dataIndex);D&&(b[D.id]=!0)}function E(P,z){var V=i[z],F=n[P],U=F.data.hostModel,j=V.data.getItemGraphicEl(V.dataIndex),Z=F.data.getItemGraphicEl(F.dataIndex);if(j===Z){Z&&Dse(Z,F.dataIndex,U);return}j&&b[j.id]||Z&&(Jf(Z),j?(Jf(j),FC(j),o=!0,OC(rh(j),rh(Z),F.divide,U,P,a)):VC(Z,U,P))}new js(i,n,m(!0,_),m(!1,_),null,"multiple").update(E).updateManyToOne(function(P,z){var V=n[P],F=V.data,U=F.hostModel,j=F.getItemGraphicEl(V.dataIndex),Z=kr(je(z,function(X){return i[X].data.getItemGraphicEl(i[X].dataIndex)}),function(X){return X&&X!==j&&!b[X.id]});j&&(Jf(j),Z.length?(J(Z,function(X){Jf(X),FC(X)}),o=!0,OC(rh(Z),rh(j),V.divide,U,P,a)):VC(j,U,V.dataIndex))}).updateOneToMany(function(P,z){var V=i[z],F=V.data.getItemGraphicEl(V.dataIndex);if(!(F&&b[F.id])){var U=kr(je(P,function(Z){return n[Z].data.getItemGraphicEl(n[Z].dataIndex)}),function(Z){return Z&&Z!==F}),j=n[P[0]].data.hostModel;U.length&&(J(U,function(Z){return Jf(Z)}),F?(Jf(F),FC(F),o=!0,OC(rh(F),rh(U),V.divide,j,P[0],a)):J(U,function(Z){return VC(Z,j,P[0])}))}}).updateManyToMany(function(P,z){new js(z,P,function(V){return i[V].data.getId(i[V].dataIndex)},function(V){return n[V].data.getId(n[V].dataIndex)}).update(function(V,F){E(P[V],z[F])}).execute()}).execute(),o&&J(e,function(P){var z=P.data,V=z.hostModel,F=V&&t.getViewOfSeriesModel(V),U=rf("update",V,0);F&&V.isAnimationEnabled()&&U&&U.duration>0&&F.group.traverse(function(j){j instanceof ar&&!j.animators.length&&j.animateFrom({style:{opacity:0}},U)})})}function iF(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function nF(r){return We(r)?r.sort().join(","):r}function iu(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function Ise(r,e){var t=gt(),i=gt(),n=gt();J(r.oldSeries,function(o,s){var l=r.oldDataGroupIds[s],h=r.oldData[s],f=iF(o),d=nF(f);i.set(d,{dataGroupId:l,data:h}),We(f)&&J(f,function(v){n.set(v,{key:d,dataGroupId:l,data:h})})});function a(o){t.get(o)&&di("Duplicated seriesKey in universalTransition "+o)}return J(e.updatedSeries,function(o){if(o.isUniversalTransitionEnabled()&&o.isAnimationEnabled()){var s=o.get("dataGroupId"),l=o.getData(),h=iF(o),f=nF(h),d=i.get(f);if(d)BC.NODE_ENV!=="production"&&a(f),t.set(f,{oldSeries:[{dataGroupId:d.dataGroupId,divide:iu(d.data),data:d.data}],newSeries:[{dataGroupId:s,divide:iu(l),data:l}]});else if(We(h)){BC.NODE_ENV!=="production"&&a(f);var v=[];J(h,function(b){var S=i.get(b);S.data&&v.push({dataGroupId:S.dataGroupId,divide:iu(S.data),data:S.data})}),v.length&&t.set(f,{oldSeries:v,newSeries:[{dataGroupId:s,data:l,divide:iu(l)}]})}else{var m=n.get(h);if(m){var _=t.get(m.key);_||(_={oldSeries:[{dataGroupId:m.dataGroupId,data:m.data,divide:iu(m.data)}],newSeries:[]},t.set(m.key,_)),_.newSeries.push({dataGroupId:s,data:l,divide:iu(l)})}}}}),t}function aF(r,e){for(var t=0;t<r.length;t++){var i=e.seriesIndex!=null&&e.seriesIndex===r[t].seriesIndex||e.seriesId!=null&&e.seriesId===r[t].id;if(i)return t}}function Mse(r,e,t,i){var n=[],a=[];J(Fr(r.from),function(o){var s=aF(e.oldSeries,o);s>=0&&n.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:iu(e.oldData[s]),groupIdDim:o.dimension})}),J(Fr(r.to),function(o){var s=aF(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();a.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:iu(l),groupIdDim:o.dimension})}}),n.length>0&&a.length>0&&rF(n,a,i)}function Ese(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){J(Fr(i.seriesTransition),function(n){J(Fr(n.to),function(a){for(var o=i.updatedSeries,s=0;s<o.length;s++)(a.seriesIndex!=null&&a.seriesIndex===o[s].seriesIndex||a.seriesId!=null&&a.seriesId===o[s].id)&&(o[s][Ky]=!0)})})}),r.registerUpdateLifecycle("series:transition",function(e,t,i){var n=Sse(t);if(n.oldSeries&&i.updatedSeries&&i.optionChanged){var a=i.seriesTransition;if(a)J(Fr(a),function(m){Mse(m,n,i,t)});else{var o=Ise(n,i);J(o.keys(),function(m){var _=o.get(m);rF(_.oldSeries,_.newSeries,t)})}J(i.updatedSeries,function(m){m[Ky]&&(m[Ky]=!1)})}for(var s=e.getSeries(),l=n.oldSeries=[],h=n.oldDataGroupIds=[],f=n.oldData=[],d=0;d<s.length;d++){var v=s[d].getData();v.count()<K3&&(l.push(s[d]),h.push(s[d].get("dataGroupId")),f.push(v))}})}rr([pq]),rr([uq]),rr([zq,Yq,oX,UX,tY,UY,yK,rJ,CJ,kJ,$J,zQ,see,_ee,zee,Vee,Yee,ite,pte,xte,Ete,dre]),rr(Pre),rr(aie),rr(UN),rr(yie),rr(cB),rr(Sie),rr(Pie),rr(bne),rr($ne),rr(Bv),rr(aae),rr(lae),rr(yae),rr(Dae),rr(Lae),rr(Vae),rr(Yae),rr(voe),rr(h3),rr(v3),rr(Noe),rr(k3),rr(L3),rr($oe),rr(ese),rr(ise),rr(Ese),rr(DZ);class kse{static getTooltipOptions(e=!0){return{show:e,axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}}}}class N0{static getLabelOptions(e={}){return{show:(e==null?void 0:e.show_label)||(e==null?void 0:e.show)||!1,fontSize:"10",position:(e==null?void 0:e.position)||"inside",formatter:(e==null?void 0:e.formatter)||"{d}%",...e}}static getLegendOpions(e={}){return{...e,position:(e==null?void 0:e.position)||"bottom"}}}const Pse={show_label:!1,show_legend:!1,label:null,legend:{position:null},colors:null,color:null,title:null};function Lse(){const r="0123456789ABCDEF";let e="#";for(let t=0;t<6;t+=1)e+=r[Math.floor(Math.random()*16)];return e}function ih(r=Pse){var t;const e={label:{show:r==null?void 0:r.show_label,formatter:(r==null?void 0:r.formatter)||(i=>mi(i)),...(r==null?void 0:r.label)||{}},legend:{...r.legend,[(t=r.legend)==null?void 0:t.position]:"0",show:r.show_legend||!1},barWidth:"70%",grid:{borderColor:"#e5e7eb"},title:{...(r==null?void 0:r.title)||{}}};return(r!=null&&r.colors||r!=null&&r.color)&&(e.color=(r==null?void 0:r.colors)||(r==null?void 0:r.color)||null),e}function oF(r){return{color:"#9ca3af",fontSize:10,fontFamily:"Inter, ui-sans-serif, system-ui",fontWeight:400,label:r==null?void 0:r.label,show:!0,formatter:(r==null?void 0:r.formatter)||(t=>mi(t)),margin:(r==null?void 0:r.margin)||7,interval:(r==null?void 0:r.interval)||"auto",rotate:(r==null?void 0:r.rotate)||0}}const sF=["#d3c7e6","#bedae3","#f8e9cb","#ff8c8c","#c5d8be","#ffc6c6","#ffc39a","#fff7c5","#d8ffc0","#d4f7ff"],da={props:["source","style","widget","dashboard","title","currentWidget","widgetData"],data(){return{sourceData:null,styleData:null,widgetName:"",dimensions:[],dashboardName:"",titleCharts:"",widgetInstance:null}},mounted(){window.addEventListener("resize",this.handleResize),window.addEventListener(`update-data-${this.widget}`,this.checkCustomEvent),window.addEventListener(`update-style-${this.widget}`,this.checkCustomStyleEvent)},unmounted(){window.removeEventListener(`update-data-${this.widget}`,this.checkCustomEvent),window.removeEventListener(`update-style-${this.widget}`,this.checkCustomStyleEvent)},watch:{sourceData:{async handler(){setTimeout(()=>{this==null||this.onChangedData()},0)}}},methods:{checkCustomStyleEvent(r){this.changeOptionsByName(r.chartId,r.options)},checkCustomEvent({filterUrl:r}){this.getDataFromURL(r)},handleResize(){this.widgetInstance&&this.widgetInstance.resize()},async getDataFromURL(r){var e,t,i,n;try{const a=await vr.get(r);this.sourceData=((e=a.data)==null?void 0:e.source)||[],this.$emit("update:widgetData",a.data),this.dimensions=Object.keys(((t=this.sourceData)==null?void 0:t[0])||{}),this.titleCharts=this.style?this.style:((i=a.data)==null?void 0:i.title)||"",this.styleData=((n=a.data)==null?void 0:n.style)||{}}catch(a){console.error(a)}},getValues(){return this.sourceData.map(r=>{var e;return parseFloat(r[(e=this.columns)==null?void 0:e[1]])})},formatDate(r){const e=new Date(r);if(isNaN(e))return r;const t=String(e.getDate()).padStart(2,"0"),n=["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"][e.getMonth()],a=e.getFullYear();return`${t} ${n} ${a}`},async getData(){var r;try{if(this.source)this.sourceData=[...this.source],this.styleData=this.style,this.titleCharts=this.title,this.dimensions=Object.keys(((r=this.sourceData)==null?void 0:r[0])||{});else{this.widgetName=this.widget,this.dashboardName=this.dashboard;const e=this.dashboardName?`/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}`:`/bi-data?&widget=${this.widgetName}`;await this.getDataFromURL(e)}}catch(e){console.error(e)}},async initChart(r,e,t){var i,n,a,o,s,l,h;this.widgetInstance&&this.widgetInstance.clear();try{const f=this.$refs.chart,d=f_(f),v={tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"transparent",shadowColor:"transparent",padding:[0,0,0,0],borderWidth:0,formatter:m=>{var D;const _=(D=m[0])==null?void 0:D.axisValue;let S=`
84
+ `)),Pr(i)),a.push({dimIdx:D.index,parser:E,comparator:new iP(v,_)})});var o=e.sourceFormat;o!==Tn&&o!==ro&&(tl.NODE_ENV!=="production"&&(i='sourceFormat "'+o+'" is not supported yet'),Pr(i));for(var s=[],l=0,h=e.count();l<h;l++)s.push(e.getRawDataItem(l));return s.sort(function(f,d){for(var v=0;v<a.length;v++){var m=a[v],_=e.retrieveValueFromItem(f,m.dimIdx),b=e.retrieveValueFromItem(d,m.dimIdx);m.parser&&(_=m.parser(_),b=m.parser(b));var S=m.comparator.evaluate(_,b);if(S!==0)return S}return 0}),{data:s}}};function ese(r){r.registerTransform(Joe),r.registerTransform(Qoe)}var tse=function(r){Ne(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.prototype.init=function(t,i,n){r.prototype.init.call(this,t,i,n),this._sourceManager=new uP(this),cP(this)},e.prototype.mergeOption=function(t,i){r.prototype.mergeOption.call(this,t,i),cP(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:hs},e}(or),rse=function(r){Ne(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.type="dataset",e}(fi);function ise(r){r.registerComponentModel(tse),r.registerComponentView(rse)}var xs=ls.CMD;function Yf(r,e){return Math.abs(r-e)<1e-5}function LC(r){var e=r.data,t=r.len(),i=[],n,a=0,o=0,s=0,l=0;function h(ne,ue){n&&n.length>2&&i.push(n),n=[ne,ue]}function f(ne,ue,de,_e){Yf(ne,de)&&Yf(ue,_e)||n.push(ne,ue,de,_e,de,_e)}function d(ne,ue,de,_e,Ie,Ce){var Oe=Math.abs(ue-ne),Ue=Math.tan(Oe/4)*4/3,He=ue<ne?-1:1,Ke=Math.cos(ne),mt=Math.sin(ne),yt=Math.cos(ue),Ct=Math.sin(ue),_r=Ke*Ie+de,Ar=mt*Ce+_e,Nt=yt*Ie+de,xt=Ct*Ce+_e,Ut=Ie*Ue*He,ft=Ce*Ue*He;n.push(_r-Ut*mt,Ar+ft*Ke,Nt+Ut*Ct,xt-ft*yt,Nt,xt)}for(var v,m,_,b,S=0;S<t;){var D=e[S++],E=S===1;switch(E&&(a=e[S],o=e[S+1],s=a,l=o,(D===xs.L||D===xs.C||D===xs.Q)&&(n=[s,l])),D){case xs.M:a=s=e[S++],o=l=e[S++],h(s,l);break;case xs.L:v=e[S++],m=e[S++],f(a,o,v,m),a=v,o=m;break;case xs.C:n.push(e[S++],e[S++],e[S++],e[S++],a=e[S++],o=e[S++]);break;case xs.Q:v=e[S++],m=e[S++],_=e[S++],b=e[S++],n.push(a+2/3*(v-a),o+2/3*(m-o),_+2/3*(v-_),b+2/3*(m-b),_,b),a=_,o=b;break;case xs.A:var P=e[S++],z=e[S++],V=e[S++],F=e[S++],U=e[S++],j=e[S++]+U;S+=1;var Z=!e[S++];v=Math.cos(U)*V+P,m=Math.sin(U)*F+z,E?(s=v,l=m,h(s,l)):f(a,o,v,m),a=Math.cos(j)*V+P,o=Math.sin(j)*F+z;for(var X=(Z?-1:1)*Math.PI/2,Q=U;Z?Q>j:Q<j;Q+=X){var se=Z?Math.max(Q+X,j):Math.min(Q+X,j);d(Q,se,P,z,V,F)}break;case xs.R:s=a=e[S++],l=o=e[S++],v=s+e[S++],m=l+e[S++],h(v,l),f(v,l,v,m),f(v,m,s,m),f(s,m,s,l),f(s,l,v,l);break;case xs.Z:n&&f(a,o,s,l),a=s,o=l;break}}return n&&n.length>2&&i.push(n),i}function RC(r,e,t,i,n,a,o,s,l,h){if(Yf(r,t)&&Yf(e,i)&&Yf(n,o)&&Yf(a,s)){l.push(o,s);return}var f=2/h,d=f*f,v=o-r,m=s-e,_=Math.sqrt(v*v+m*m);v/=_,m/=_;var b=t-r,S=i-e,D=n-o,E=a-s,P=b*b+S*S,z=D*D+E*E;if(P<d&&z<d){l.push(o,s);return}var V=v*b+m*S,F=-v*D-m*E,U=P-V*V,j=z-F*F;if(U<d&&V>=0&&j<d&&F>=0){l.push(o,s);return}var Z=[],X=[];Dl(r,t,n,o,.5,Z),Dl(e,i,a,s,.5,X),RC(Z[0],X[0],Z[1],X[1],Z[2],X[2],Z[3],X[3],l,h),RC(Z[4],X[4],Z[5],X[5],Z[6],X[6],Z[7],X[7],l,h)}function nse(r,e){var t=LC(r),i=[];e=e||1;for(var n=0;n<t.length;n++){var a=t[n],o=[],s=a[0],l=a[1];o.push(s,l);for(var h=2;h<a.length;){var f=a[h++],d=a[h++],v=a[h++],m=a[h++],_=a[h++],b=a[h++];RC(s,l,f,d,v,m,_,b,o,e),s=_,l=b}i.push(o)}return i}function V3(r,e,t){var i=r[e],n=r[1-e],a=Math.abs(i/n),o=Math.ceil(Math.sqrt(a*t)),s=Math.floor(t/o);s===0&&(s=1,o=t);for(var l=[],h=0;h<o;h++)l.push(s);var f=o*s,d=t-f;if(d>0)for(var h=0;h<d;h++)l[h%o]+=1;return l}function F3(r,e,t){for(var i=r.r0,n=r.r,a=r.startAngle,o=r.endAngle,s=Math.abs(o-a),l=s*n,h=n-i,f=l>Math.abs(h),d=V3([l,h],f?0:1,e),v=(f?s:h)/d.length,m=0;m<d.length;m++)for(var _=(f?h:s)/d[m],b=0;b<d[m];b++){var S={};f?(S.startAngle=a+v*m,S.endAngle=a+v*(m+1),S.r0=i+_*b,S.r=i+_*(b+1)):(S.startAngle=a+_*b,S.endAngle=a+_*(b+1),S.r0=i+v*m,S.r=i+v*(m+1)),S.clockwise=r.clockwise,S.cx=r.cx,S.cy=r.cy,t.push(S)}}function ase(r,e,t){for(var i=r.width,n=r.height,a=i>n,o=V3([i,n],a?0:1,e),s=a?"width":"height",l=a?"height":"width",h=a?"x":"y",f=a?"y":"x",d=r[s]/o.length,v=0;v<o.length;v++)for(var m=r[l]/o[v],_=0;_<o[v];_++){var b={};b[h]=v*d,b[f]=_*m,b[s]=d,b[l]=m,b.x+=r.x,b.y+=r.y,t.push(b)}}function $3(r,e,t,i){return r*i-t*e}function ose(r,e,t,i,n,a,o,s){var l=t-r,h=i-e,f=o-n,d=s-a,v=$3(f,d,l,h);if(Math.abs(v)<1e-6)return null;var m=r-n,_=e-a,b=$3(m,_,f,d)/v;return b<0||b>1?null:new qt(b*l+r,b*h+e)}function sse(r,e,t){var i=new qt;qt.sub(i,t,e),i.normalize();var n=new qt;qt.sub(n,r,e);var a=n.dot(i);return a}function Kf(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function lse(r,e,t){for(var i=r.length,n=[],a=0;a<i;a++){var o=r[a],s=r[(a+1)%i],l=ose(o[0],o[1],s[0],s[1],e.x,e.y,t.x,t.y);l&&n.push({projPt:sse(l,e,t),pt:l,idx:a})}if(n.length<2)return[{points:r},{points:r}];n.sort(function(S,D){return S.projPt-D.projPt});var h=n[0],f=n[n.length-1];if(f.idx<h.idx){var d=h;h=f,f=d}for(var v=[h.pt.x,h.pt.y],m=[f.pt.x,f.pt.y],_=[v],b=[m],a=h.idx+1;a<=f.idx;a++)Kf(_,r[a].slice());Kf(_,m),Kf(_,v);for(var a=f.idx+1;a<=h.idx+i;a++)Kf(b,r[a%i].slice());return Kf(b,v),Kf(b,m),[{points:_},{points:b}]}function G3(r){var e=r.points,t=[],i=[];uy(e,t,i);var n=new Kt(t[0],t[1],i[0]-t[0],i[1]-t[1]),a=n.width,o=n.height,s=n.x,l=n.y,h=new qt,f=new qt;return a>o?(h.x=f.x=s+a/2,h.y=l,f.y=l+o):(h.y=f.y=l+o/2,h.x=s,f.x=s+a),lse(e,h,f)}function P0(r,e,t,i){if(t===1)i.push(e);else{var n=Math.floor(t/2),a=r(e);P0(r,a[0],n,i),P0(r,a[1],t-n,i)}return i}function use(r,e){for(var t=[],i=0;i<e;i++)t.push(q1(r));return t}function cse(r,e){e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel}function hse(r){for(var e=[],t=0;t<r.length;)e.push([r[t++],r[t++]]);return e}function fse(r,e){var t=[],i=r.shape,n;switch(r.type){case"rect":ase(i,e,t),n=mr;break;case"sector":F3(i,e,t),n=Hn;break;case"circle":F3({r0:0,r:i.r,startAngle:0,endAngle:Math.PI*2,cx:i.cx,cy:i.cy},e,t),n=Hn;break;default:var a=r.getComputedTransform(),o=a?Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1],a[2]*a[2]+a[3]*a[3])):1,s=je(nse(r.getUpdatedPathProxy(),o),function(D){return hse(D)}),l=s.length;if(l===0)P0(G3,{points:s[0]},e,t);else if(l===e)for(var h=0;h<l;h++)t.push({points:s[h]});else{var f=0,d=je(s,function(D){var E=[],P=[];uy(D,E,P);var z=(P[1]-E[1])*(P[0]-E[0]);return f+=z,{poly:D,area:z}});d.sort(function(D,E){return E.area-D.area});for(var v=e,h=0;h<l;h++){var m=d[h];if(v<=0)break;var _=h===l-1?v:Math.ceil(m.area/f*e);_<0||(P0(G3,{points:m.poly},_,t),v-=_)}}n=Wn;break}if(!n)return use(r,e);for(var b=[],h=0;h<t.length;h++){var S=new n;S.setShape(t[h]),cse(r,S),b.push(S)}return b}function dse(r,e){var t=r.length,i=e.length;if(t===i)return[r,e];for(var n=[],a=[],o=t<i?r:e,s=Math.min(t,i),l=Math.abs(i-t)/6,h=(s-2)/6,f=Math.ceil(l/h)+1,d=[o[0],o[1]],v=l,m=2;m<s;){var _=o[m-2],b=o[m-1],S=o[m++],D=o[m++],E=o[m++],P=o[m++],z=o[m++],V=o[m++];if(v<=0){d.push(S,D,E,P,z,V);continue}for(var F=Math.min(v,f-1)+1,U=1;U<=F;U++){var j=U/F;Dl(_,S,E,z,j,n),Dl(b,D,P,V,j,a),_=n[3],b=a[3],d.push(n[1],a[1],n[2],a[2],_,b),S=n[5],D=a[5],E=n[6],P=a[6]}v-=F-1}return o===r?[d,e]:[r,d]}function U3(r,e){for(var t=r.length,i=r[t-2],n=r[t-1],a=[],o=0;o<e.length;)a[o++]=i,a[o++]=n;return a}function pse(r,e){for(var t,i,n,a=[],o=[],s=0;s<Math.max(r.length,e.length);s++){var l=r[s],h=e[s],f=void 0,d=void 0;l?h?(t=dse(l,h),f=t[0],d=t[1],i=f,n=d):(d=U3(n||l,l),f=l):(f=U3(i||h,h),d=h),a.push(f),o.push(d)}return[a,o]}function H3(r){for(var e=0,t=0,i=0,n=r.length,a=0,o=n-2;a<n;o=a,a+=2){var s=r[o],l=r[o+1],h=r[a],f=r[a+1],d=s*f-h*l;e+=d,t+=(s+h)*d,i+=(l+f)*d}return e===0?[r[0]||0,r[1]||0]:[t/e/3,i/e/3,e]}function vse(r,e,t,i){for(var n=(r.length-2)/6,a=1/0,o=0,s=r.length,l=s-2,h=0;h<n;h++){for(var f=h*6,d=0,v=0;v<s;v+=2){var m=v===0?f:(f+v-2)%l+2,_=r[m]-t[0],b=r[m+1]-t[1],S=e[v]-i[0],D=e[v+1]-i[1],E=S-_,P=D-b;d+=E*E+P*P}d<a&&(a=d,o=h)}return o}function gse(r){for(var e=[],t=r.length,i=0;i<t;i+=2)e[i]=r[t-i-2],e[i+1]=r[t-i-1];return e}function mse(r,e,t,i){for(var n=[],a,o=0;o<r.length;o++){var s=r[o],l=e[o],h=H3(s),f=H3(l);a==null&&(a=h[2]<0!=f[2]<0);var d=[],v=[],m=0,_=1/0,b=[],S=s.length;a&&(s=gse(s));for(var D=vse(s,l,h,f)*6,E=S-2,P=0;P<E;P+=2){var z=(D+P)%E+2;d[P+2]=s[z]-h[0],d[P+3]=s[z+1]-h[1]}d[0]=s[D]-h[0],d[1]=s[D+1]-h[1];for(var V=i/t,F=-i/2;F<=i/2;F+=V){for(var U=Math.sin(F),j=Math.cos(F),Z=0,P=0;P<s.length;P+=2){var X=d[P],Q=d[P+1],se=l[P]-f[0],ne=l[P+1]-f[1],ue=se*j-ne*U,de=se*U+ne*j;b[P]=ue,b[P+1]=de;var _e=ue-X,Ie=de-Q;Z+=_e*_e+Ie*Ie}if(Z<_){_=Z,m=F;for(var Ce=0;Ce<b.length;Ce++)v[Ce]=b[Ce]}}n.push({from:d,to:v,fromCp:h,toCp:f,rotation:-m})}return n}function L0(r){return r.__isCombineMorphing}var W3="__mOriginal_";function R0(r,e,t){var i=W3+e,n=r[i]||r[e];r[i]||(r[i]=r[e]);var a=t.replace,o=t.after,s=t.before;r[e]=function(){var l=arguments,h;return s&&s.apply(this,l),a?h=a.apply(this,l):h=n.apply(this,l),o&&o.apply(this,l),h}}function Zv(r,e){var t=W3+e;r[t]&&(r[e]=r[t],r[t]=null)}function j3(r,e){for(var t=0;t<r.length;t++)for(var i=r[t],n=0;n<i.length;){var a=i[n],o=i[n+1];i[n++]=e[0]*a+e[2]*o+e[4],i[n++]=e[1]*a+e[3]*o+e[5]}}function Z3(r,e){var t=r.getUpdatedPathProxy(),i=e.getUpdatedPathProxy(),n=pse(LC(t),LC(i)),a=n[0],o=n[1],s=r.getComputedTransform(),l=e.getComputedTransform();function h(){this.transform=null}s&&j3(a,s),l&&j3(o,l),R0(e,"updateTransform",{replace:h}),e.transform=null;var f=mse(a,o,10,Math.PI),d=[];R0(e,"buildPath",{replace:function(v){for(var m=e.__morphT,_=1-m,b=[],S=0;S<f.length;S++){var D=f[S],E=D.from,P=D.to,z=D.rotation*m,V=D.fromCp,F=D.toCp,U=Math.sin(z),j=Math.cos(z);Mm(b,V,F,m);for(var Z=0;Z<E.length;Z+=2){var X=E[Z],Q=E[Z+1],se=P[Z],ne=P[Z+1],ue=X*_+se*m,de=Q*_+ne*m;d[Z]=ue*j-de*U+b[0],d[Z+1]=ue*U+de*j+b[1]}var _e=d[0],Ie=d[1];v.moveTo(_e,Ie);for(var Z=2;Z<E.length;){var se=d[Z++],ne=d[Z++],Ce=d[Z++],Oe=d[Z++],Ue=d[Z++],He=d[Z++];_e===se&&Ie===ne&&Ce===Ue&&Oe===He?v.lineTo(Ue,He):v.bezierCurveTo(se,ne,Ce,Oe,Ue,He),_e=Ue,Ie=He}}}})}function zC(r,e,t){if(!r||!e)return e;var i=t.done,n=t.during;Z3(r,e),e.__morphT=0;function a(){Zv(e,"buildPath"),Zv(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return e.animateTo({__morphT:1},Pt({during:function(o){e.dirtyShape(),n&&n(o)},done:function(){a(),i&&i()}},t)),e}function yse(r,e,t,i,n,a){var o=16;r=n===t?0:Math.round(32767*(r-t)/(n-t)),e=a===i?0:Math.round(32767*(e-i)/(a-i));for(var s=0,l,h=(1<<o)/2;h>0;h/=2){var f=0,d=0;(r&h)>0&&(f=1),(e&h)>0&&(d=1),s+=h*h*(3*f^d),d===0&&(f===1&&(r=h-1-r,e=h-1-e),l=r,r=e,e=l)}return s}function z0(r){var e=1/0,t=1/0,i=-1/0,n=-1/0,a=je(r,function(s){var l=s.getBoundingRect(),h=s.getComputedTransform(),f=l.x+l.width/2+(h?h[4]:0),d=l.y+l.height/2+(h?h[5]:0);return e=Math.min(f,e),t=Math.min(d,t),i=Math.max(f,i),n=Math.max(d,n),[f,d]}),o=je(a,function(s,l){return{cp:s,z:yse(s[0],s[1],e,t,i,n),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function q3(r){return fse(r.path,r.count)}function NC(){return{fromIndividuals:[],toIndividuals:[],count:0}}function _se(r,e,t){var i=[];function n(V){for(var F=0;F<V.length;F++){var U=V[F];L0(U)?n(U.childrenRef()):U instanceof ar&&i.push(U)}}n(r);var a=i.length;if(!a)return NC();var o=t.dividePath||q3,s=o({path:e,count:a});if(s.length!==a)return console.error("Invalid morphing: unmatched splitted path"),NC();i=z0(i),s=z0(s);for(var l=t.done,h=t.during,f=t.individualDelay,d=new Ns,v=0;v<a;v++){var m=i[v],_=s[v];_.parent=e,_.copyTransform(d),f||Z3(m,_)}e.__isCombineMorphing=!0,e.childrenRef=function(){return s};function b(V){for(var F=0;F<s.length;F++)s[F].addSelfToZr(V)}R0(e,"addSelfToZr",{after:function(V){b(V)}}),R0(e,"removeSelfFromZr",{after:function(V){for(var F=0;F<s.length;F++)s[F].removeSelfFromZr(V)}});function S(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,Zv(e,"addSelfToZr"),Zv(e,"removeSelfFromZr")}var D=s.length;if(f)for(var E=D,P=function(){E--,E===0&&(S(),l&&l())},v=0;v<D;v++){var z=f?Pt({delay:(t.delay||0)+f(v,D,i[v],s[v]),done:P},t):t;zC(i[v],s[v],z)}else e.__morphT=0,e.animateTo({__morphT:1},Pt({during:function(V){for(var F=0;F<D;F++){var U=s[F];U.__morphT=e.__morphT,U.dirtyShape()}h&&h(V)},done:function(){S();for(var V=0;V<r.length;V++)Zv(r[V],"updateTransform");l&&l()}},t));return e.__zr&&b(e.__zr),{fromIndividuals:i,toIndividuals:s,count:D}}function xse(r,e,t){var i=e.length,n=[],a=t.dividePath||q3;function o(m){for(var _=0;_<m.length;_++){var b=m[_];L0(b)?o(b.childrenRef()):b instanceof ar&&n.push(b)}}if(L0(r)){o(r.childrenRef());var s=n.length;if(s<i)for(var l=0,h=s;h<i;h++)n.push(q1(n[l++%s]));n.length=i}else{n=a({path:r,count:i});for(var f=r.getComputedTransform(),h=0;h<n.length;h++)n[h].setLocalTransform(f);if(n.length!==i)return console.error("Invalid morphing: unmatched splitted path"),NC()}n=z0(n),e=z0(e);for(var d=t.individualDelay,h=0;h<i;h++){var v=d?Pt({delay:(t.delay||0)+d(h,i,n[h],e[h])},t):t;zC(n[h],e[h],v)}return{fromIndividuals:n,toIndividuals:e,count:e.length}}function X3(r){return We(r[0])}function Y3(r,e){for(var t=[],i=r.length,n=0;n<i;n++)t.push({one:r[n],many:[]});for(var n=0;n<e.length;n++){var a=e[n].length,o=void 0;for(o=0;o<a;o++)t[o%i].many.push(e[n][o])}for(var s=0,n=i-1;n>=0;n--)if(!t[n].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var a=l.length,h=Math.ceil(a/2);t[n].many=l.slice(h,a),t[s].many=l.slice(0,h),s++}return t}var bse={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),i=0;i<r.count;i++){var n=q1(r.path);n.setStyle("opacity",t),e.push(n)}return e},split:null};function OC(r,e,t,i,n,a){if(!r.length||!e.length)return;var o=rf("update",i,n);if(!(o&&o.duration>0))return;var s=i.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),h,f;X3(r)&&(h=r,f=e),X3(e)&&(h=e,f=r);function d(D,E,P,z,V){var F=D.many,U=D.one;if(F.length===1&&!V){var j=E?F[0]:U,Z=E?U:F[0];if(L0(j))d({many:[j],one:Z},!0,P,z,!0);else{var X=s?Pt({delay:s(P,z)},l):l;zC(j,Z,X),a(j,Z,j,Z,X)}}else for(var Q=Pt({dividePath:bse[t],individualDelay:s&&function(Ie,Ce,Oe,Ue){return s(Ie+P,z)}},l),se=E?_se(F,U,Q):xse(U,F,Q),ne=se.fromIndividuals,ue=se.toIndividuals,de=ne.length,_e=0;_e<de;_e++){var X=s?Pt({delay:s(_e,de)},l):l;a(ne[_e],ue[_e],E?F[_e]:D.one,E?D.one:F[_e],X)}}for(var v=h?h===r:r.length>e.length,m=h?Y3(f,h):Y3(v?e:r,[v?r:e]),_=0,b=0;b<m.length;b++)_+=m[b].many.length;for(var S=0,b=0;b<m.length;b++)d(m[b],v,S,_),S+=m[b].many.length}function rh(r){if(!r)return[];if(We(r)){for(var e=[],t=0;t<r.length;t++)e.push(rh(r[t]));return e}var i=[];return r.traverse(function(n){n instanceof ar&&!n.disableMorphing&&!n.invisible&&!n.ignore&&i.push(n)}),i}var BC={},K3=1e4,wse=0,J3=1,Q3=2,Sse=gr();function Tse(r,e){for(var t=r.dimensions,i=0;i<t.length;i++){var n=r.getDimensionInfo(t[i]);if(n&&n.otherDims[e]===0)return t[i]}}function Cse(r,e,t){var i=r.getDimensionInfo(t),n=i&&i.ordinalMeta;if(i){var a=r.get(i.name,e);return n&&n.categories[a]||a+""}}function eF(r,e,t,i){var n=i?"itemChildGroupId":"itemGroupId",a=Tse(r,n);if(a){var o=Cse(r,e,a);return o}var s=r.getRawDataItem(e),l=i?"childGroupId":"groupId";if(s&&s[l])return s[l]+"";if(!i)return t||r.getId(e)}function tF(r){var e=[];return J(r,function(t){var i=t.data,n=t.dataGroupId;if(i.count()>K3){BC.NODE_ENV!=="production"&&di("Universal transition is disabled on large data > 10k.");return}for(var a=i.getIndices(),o=0;o<a.length;o++)e.push({data:i,groupId:eF(i,o,n,!1),childGroupId:eF(i,o,n,!0),divide:t.divide,dataIndex:o})}),e}function VC(r,e,t){r.traverse(function(i){i instanceof ar&&ui(i,{style:{opacity:0}},e,{dataIndex:t,isFrom:!0})})}function FC(r){if(r.parent){var e=r.getComputedTransform();r.setLocalTransform(e),r.parent.remove(r)}}function Jf(r){r.stopAnimation(),r.isGroup&&r.traverse(function(e){e.stopAnimation()})}function Dse(r,e,t){var i=rf("update",t,e);i&&r.traverse(function(n){if(n instanceof Ka){var a=RH(n);a&&n.animateFrom({style:a},i)}})}function Ase(r,e){var t=r.length;if(t!==e.length)return!1;for(var i=0;i<t;i++){var n=r[i],a=e[i];if(n.data.getId(n.dataIndex)!==a.data.getId(a.dataIndex))return!1}return!0}function rF(r,e,t){var i=tF(r),n=tF(e);function a(P,z,V,F,U){(V||P)&&z.animateFrom({style:V&&V!==P?Fe(Fe({},V.style),P.style):P.style},U)}var o=!1,s=wse,l=gt(),h=gt();i.forEach(function(P){P.groupId&&l.set(P.groupId,!0),P.childGroupId&&h.set(P.childGroupId,!0)});for(var f=0;f<n.length;f++){var d=n[f].groupId;if(h.get(d)){s=J3;break}var v=n[f].childGroupId;if(v&&l.get(v)){s=Q3;break}}function m(P,z){return function(V){var F=V.data,U=V.dataIndex;return z?F.getId(U):P?s===J3?V.childGroupId:V.groupId:s===Q3?V.childGroupId:V.groupId}}var _=Ase(i,n),b={};if(!_)for(var f=0;f<n.length;f++){var S=n[f],D=S.data.getItemGraphicEl(S.dataIndex);D&&(b[D.id]=!0)}function E(P,z){var V=i[z],F=n[P],U=F.data.hostModel,j=V.data.getItemGraphicEl(V.dataIndex),Z=F.data.getItemGraphicEl(F.dataIndex);if(j===Z){Z&&Dse(Z,F.dataIndex,U);return}j&&b[j.id]||Z&&(Jf(Z),j?(Jf(j),FC(j),o=!0,OC(rh(j),rh(Z),F.divide,U,P,a)):VC(Z,U,P))}new js(i,n,m(!0,_),m(!1,_),null,"multiple").update(E).updateManyToOne(function(P,z){var V=n[P],F=V.data,U=F.hostModel,j=F.getItemGraphicEl(V.dataIndex),Z=kr(je(z,function(X){return i[X].data.getItemGraphicEl(i[X].dataIndex)}),function(X){return X&&X!==j&&!b[X.id]});j&&(Jf(j),Z.length?(J(Z,function(X){Jf(X),FC(X)}),o=!0,OC(rh(Z),rh(j),V.divide,U,P,a)):VC(j,U,V.dataIndex))}).updateOneToMany(function(P,z){var V=i[z],F=V.data.getItemGraphicEl(V.dataIndex);if(!(F&&b[F.id])){var U=kr(je(P,function(Z){return n[Z].data.getItemGraphicEl(n[Z].dataIndex)}),function(Z){return Z&&Z!==F}),j=n[P[0]].data.hostModel;U.length&&(J(U,function(Z){return Jf(Z)}),F?(Jf(F),FC(F),o=!0,OC(rh(F),rh(U),V.divide,j,P[0],a)):J(U,function(Z){return VC(Z,j,P[0])}))}}).updateManyToMany(function(P,z){new js(z,P,function(V){return i[V].data.getId(i[V].dataIndex)},function(V){return n[V].data.getId(n[V].dataIndex)}).update(function(V,F){E(P[V],z[F])}).execute()}).execute(),o&&J(e,function(P){var z=P.data,V=z.hostModel,F=V&&t.getViewOfSeriesModel(V),U=rf("update",V,0);F&&V.isAnimationEnabled()&&U&&U.duration>0&&F.group.traverse(function(j){j instanceof ar&&!j.animators.length&&j.animateFrom({style:{opacity:0}},U)})})}function iF(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function nF(r){return We(r)?r.sort().join(","):r}function iu(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function Ise(r,e){var t=gt(),i=gt(),n=gt();J(r.oldSeries,function(o,s){var l=r.oldDataGroupIds[s],h=r.oldData[s],f=iF(o),d=nF(f);i.set(d,{dataGroupId:l,data:h}),We(f)&&J(f,function(v){n.set(v,{key:d,dataGroupId:l,data:h})})});function a(o){t.get(o)&&di("Duplicated seriesKey in universalTransition "+o)}return J(e.updatedSeries,function(o){if(o.isUniversalTransitionEnabled()&&o.isAnimationEnabled()){var s=o.get("dataGroupId"),l=o.getData(),h=iF(o),f=nF(h),d=i.get(f);if(d)BC.NODE_ENV!=="production"&&a(f),t.set(f,{oldSeries:[{dataGroupId:d.dataGroupId,divide:iu(d.data),data:d.data}],newSeries:[{dataGroupId:s,divide:iu(l),data:l}]});else if(We(h)){BC.NODE_ENV!=="production"&&a(f);var v=[];J(h,function(b){var S=i.get(b);S.data&&v.push({dataGroupId:S.dataGroupId,divide:iu(S.data),data:S.data})}),v.length&&t.set(f,{oldSeries:v,newSeries:[{dataGroupId:s,data:l,divide:iu(l)}]})}else{var m=n.get(h);if(m){var _=t.get(m.key);_||(_={oldSeries:[{dataGroupId:m.dataGroupId,data:m.data,divide:iu(m.data)}],newSeries:[]},t.set(m.key,_)),_.newSeries.push({dataGroupId:s,data:l,divide:iu(l)})}}}}),t}function aF(r,e){for(var t=0;t<r.length;t++){var i=e.seriesIndex!=null&&e.seriesIndex===r[t].seriesIndex||e.seriesId!=null&&e.seriesId===r[t].id;if(i)return t}}function Mse(r,e,t,i){var n=[],a=[];J(Fr(r.from),function(o){var s=aF(e.oldSeries,o);s>=0&&n.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:iu(e.oldData[s]),groupIdDim:o.dimension})}),J(Fr(r.to),function(o){var s=aF(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();a.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:iu(l),groupIdDim:o.dimension})}}),n.length>0&&a.length>0&&rF(n,a,i)}function Ese(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,i){J(Fr(i.seriesTransition),function(n){J(Fr(n.to),function(a){for(var o=i.updatedSeries,s=0;s<o.length;s++)(a.seriesIndex!=null&&a.seriesIndex===o[s].seriesIndex||a.seriesId!=null&&a.seriesId===o[s].id)&&(o[s][Ky]=!0)})})}),r.registerUpdateLifecycle("series:transition",function(e,t,i){var n=Sse(t);if(n.oldSeries&&i.updatedSeries&&i.optionChanged){var a=i.seriesTransition;if(a)J(Fr(a),function(m){Mse(m,n,i,t)});else{var o=Ise(n,i);J(o.keys(),function(m){var _=o.get(m);rF(_.oldSeries,_.newSeries,t)})}J(i.updatedSeries,function(m){m[Ky]&&(m[Ky]=!1)})}for(var s=e.getSeries(),l=n.oldSeries=[],h=n.oldDataGroupIds=[],f=n.oldData=[],d=0;d<s.length;d++){var v=s[d].getData();v.count()<K3&&(l.push(s[d]),h.push(s[d].get("dataGroupId")),f.push(v))}})}rr([pq]),rr([uq]),rr([zq,Yq,oX,UX,tY,UY,yK,rJ,CJ,kJ,$J,zQ,see,_ee,zee,Vee,Yee,ite,pte,xte,Ete,dre]),rr(Pre),rr(aie),rr(UN),rr(yie),rr(cB),rr(Sie),rr(Pie),rr(bne),rr($ne),rr(Bv),rr(aae),rr(lae),rr(yae),rr(Dae),rr(Lae),rr(Vae),rr(Yae),rr(voe),rr(h3),rr(v3),rr(Noe),rr(k3),rr(L3),rr($oe),rr(ese),rr(ise),rr(Ese),rr(DZ);class kse{static getTooltipOptions(e=!0){return{show:e,axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}}}}class N0{static getLabelOptions(e={}){return{show:(e==null?void 0:e.show_label)||(e==null?void 0:e.show)||!1,fontSize:"10",position:(e==null?void 0:e.position)||"inside",formatter:(e==null?void 0:e.formatter)||"{d}%",...e}}static getLegendOpions(e={}){return{...e,position:(e==null?void 0:e.position)||"bottom"}}}const Pse={show_label:!1,show_legend:!1,label:null,legend:{position:null},colors:null,color:null,title:null};function Lse(){const r="0123456789ABCDEF";let e="#";for(let t=0;t<6;t+=1)e+=r[Math.floor(Math.random()*16)];return e}function ih(r=Pse){var t;const e={label:{show:r==null?void 0:r.show_label,formatter:(r==null?void 0:r.formatter)||(i=>mi(i)),...(r==null?void 0:r.label)||{}},legend:{...r.legend,[(t=r.legend)==null?void 0:t.position]:"0",show:r.show_legend||!1},barWidth:"70%",grid:{borderColor:"#e5e7eb"},title:{...(r==null?void 0:r.title)||{}}};return(r!=null&&r.colors||r!=null&&r.color)&&(e.color=(r==null?void 0:r.colors)||(r==null?void 0:r.color)||null),e}function oF(r){return{color:"#9ca3af",fontSize:10,fontFamily:"Inter, ui-sans-serif, system-ui",fontWeight:400,label:r==null?void 0:r.label,show:!0,formatter:(r==null?void 0:r.formatter)||(t=>mi(t)),margin:(r==null?void 0:r.margin)||7,interval:(r==null?void 0:r.interval)||"auto",rotate:(r==null?void 0:r.rotate)||0}}const sF=["#d3c7e6","#bedae3","#f8e9cb","#ff8c8c","#c5d8be","#ffc6c6","#ffc39a","#fff7c5","#d8ffc0","#d4f7ff"],da={props:["source","style","widget","dashboard","title","currentWidget","widgetData","prefix"],data(){return{sourceData:null,styleData:null,widgetName:"",dimensions:[],dashboardName:"",titleCharts:"",widgetInstance:null}},mounted(){window.addEventListener("resize",this.handleResize),window.addEventListener(`update-data-${this.widget}`,this.checkCustomEvent),window.addEventListener(`update-style-${this.widget}`,this.checkCustomStyleEvent)},unmounted(){window.removeEventListener(`update-data-${this.widget}`,this.checkCustomEvent),window.removeEventListener(`update-style-${this.widget}`,this.checkCustomStyleEvent)},watch:{sourceData:{async handler(){setTimeout(()=>{this==null||this.onChangedData()},0)}}},methods:{checkCustomStyleEvent(r){this.changeOptionsByName(r.chartId,r.options)},checkCustomEvent({filterUrl:r}){this.getDataFromURL(r)},handleResize(){this.widgetInstance&&this.widgetInstance.resize()},async getDataFromURL(r){var e,t,i,n;try{const a=await vr.get(r);this.sourceData=((e=a.data)==null?void 0:e.source)||[],this.$emit("update:widgetData",a.data),this.dimensions=Object.keys(((t=this.sourceData)==null?void 0:t[0])||{}),this.titleCharts=this.style?this.style:((i=a.data)==null?void 0:i.title)||"",this.styleData=((n=a.data)==null?void 0:n.style)||{}}catch(a){console.error(a)}},getValues(){return this.sourceData.map(r=>{var e;return parseFloat(r[(e=this.columns)==null?void 0:e[1]])})},formatDate(r){const e=new Date(r);if(isNaN(e))return r;const t=String(e.getDate()).padStart(2,"0"),n=["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"][e.getMonth()],a=e.getFullYear();return`${t} ${n} ${a}`},async getData(){var r;try{if(this.source)this.sourceData=[...this.source],this.styleData=this.style,this.titleCharts=this.title,this.dimensions=Object.keys(((r=this.sourceData)==null?void 0:r[0])||{});else{this.widgetName=this.widget,this.dashboardName=this.dashboard;const e=this.dashboardName?`${this.prefix||""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}`:`${this.prefix||""}/bi-data?&widget=${this.widgetName}`;await this.getDataFromURL(e)}}catch(e){console.error(e)}},async initChart(r,e,t){var i,n,a,o,s,l,h;this.widgetInstance&&this.widgetInstance.clear();try{const f=this.$refs.chart,d=f_(f),v={tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"transparent",shadowColor:"transparent",padding:[0,0,0,0],borderWidth:0,formatter:m=>{var D;const _=(D=m[0])==null?void 0:D.axisValue;let S=`
85
85
  <div style="background-color: rgba(255, 255, 255, 0.7)" class="border border-gray-200 text-gray-800 rounded-lg shadow-md dark:bg-neutral-800 dark:border-neutral-700 min-w-28">
86
86
  <div class="font-semibold text-sm border-b border-solid border-gray-200 text-gray-800 rounded-t-lg dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-200 px-2 py-1">
87
87
  ${_?this.formatDate(_):"N/A"}
@@ -94,10 +94,10 @@ echarts.use([`+se+"]);":"Unknown series "+Q))}return}if(d==="tooltip"){if(P){vf.
94
94
  </span>
95
95
  <span>${this.getMetricValue(E==null?void 0:E.data)}</span>
96
96
  </div>
97
- `}),S+="</div>",S}},xAxis:{data:e!=null&&e.length?e:null,type:e?"category":"value",name:((n=(i=this.styleData)==null?void 0:i.x_axis)==null?void 0:n.name)||"",axisLabel:{...oF((a=this.styleData)==null?void 0:a.x_axis),formatter:m=>{var b,S;const _=this.formatDate(m);return((S=(b=this.styleData)==null?void 0:b.x_axis)==null?void 0:S.overflow)==="ellipsis"&&_.length>10?`${_.slice(0,10)}...`:_}}},yAxis:{data:t!=null&&t.length?t:null,type:t?"category":"value",name:((s=(o=this.styleData)==null?void 0:o.y_axis)==null?void 0:s.name)||"",axisLabel:oF((l=this.styleData)==null?void 0:l.y_axis)},series:r!=null&&r.length?r:null,...ih(this.styleData),grid:{bottom:"0%",right:"0%",left:"0%",top:"20px",containLabel:!0,...((h=this.styleData)==null?void 0:h.grid)||{}}};await d.setOption(v),d.resize(),this.widgetInstance=d,this.$emit("update:currentWidget",d)}catch(f){console.error(f)}},async setSeriesOption(r,e){const t=r.getOption(),{series:i=[]}=t,n=i.map(a=>({...a,...e}));r.setOption({...t,series:n})},async changeOptionsByName(r,e){const t=document.getElementById(r);if(!t)return null;const i=sS(t);if(!i)return null;const n=i.getOption();e.seriesOptions&&this.setSeriesOption(i,e.seriesOptions),i.setOption({...n,...e.options,tooltip:{...kse.getTooltipOptions(e.options.tooltip.show)}})},async changeData(r){var e;try{let t=this.dashboard?`/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`:`/bi-data?&widget=${this.widget}`;(e=r==null?void 0:r.granularity)!=null&&e.length&&(t+=`&granularity=${r.granularity}`),r!=null&&r.metrics&&(t+=`&metrics=${r.metrics}`),this.getDataFromURL(t)}catch(t){console.error(t)}},async setFilter(r){const e=`/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}${r||""}`;await this.getDataFromURL(e)},async changeStyle(r,e){this.styleData[r]=e,this.onChangedData()},getMetricValue(r){var i;const e=(r==null?void 0:r.metric)||r;return parseFloat(e)?(i=mi(e,{notation:"standard"}))==null?void 0:i.replaceAll(","," "):e}}},hr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},Rse={name:"VsBar",mixins:[da],data(){return{resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var e;this.getData(),this.onChangedData();const r=(e=this.$refs)==null?void 0:e.chart;r&&(this.resizeObserver=new ResizeObserver(()=>{var t;this.widgetInstance&&((t=this.widgetInstance)==null||t.resize())}),this.resizeObserver.observe(r))},unmounted(){this.resizeObserver.disconnect()},methods:{async onChangedData(){try{if(this.sourceData){await this.$nextTick();const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e,t,i,n,a;try{if(!((r=this.sourceData)!=null&&r.length))return{series:[],xs:[],ys:void 0};const o=Array.from(new Set(this.sourceData.filter(v=>v[this.dimensions[0]]).map(v=>v[this.dimensions[0]])));let s;this.dimensions[0].includes("date")?s=o.map(v=>Xo(v)):s=[...o];let l,h;((e=this.styleData)==null?void 0:e.horizontal)===!0?h=[...s]:l=[...s];const f=this.sourceData.filter(v=>parseFloat(v[this.dimensions[1]])&&v[this.dimensions[0]]).map(v=>parseFloat(v[this.dimensions[1]]));let d;return((t=this.styleData)==null?void 0:t.stack)!==!1?d=this.prepareStackData():((i=this.styleData)==null?void 0:i.negative_waterfall)===!0?d=this.prepareNegativeWaterfall():((n=this.styleData)==null?void 0:n.waterfall)===!0?d=this.prepareWaterfallData(f):((a=this.styleData)==null?void 0:a.accumulative)===!0?d=this.prepareAccumulative(f):d=this.dimensions.slice(1).map((m,_)=>({name:m,type:"bar",stack:`a${_}`,data:this.sourceData.filter(b=>parseFloat(b[m])&&m).map(b=>parseFloat(b[m]))})),{series:d,xs:l,ys:h}}catch(o){return console.error(o),{series:[],xs:[],ys:[]}}},prepareWaterfallData(r){let e=r.reduce((a,o)=>a+o,0);const t=[e,...r],i=t.map((a,o)=>{if(o===0)return 0;const s=e-a;return e-=a,s>=0?s:0});return[{type:"bar",stack:"Total",itemStyle:{borderColor:"transparent",color:"transparent"},data:i,tooltip:{show:!1}},{name:this.title?this.title:this.dimensions[0],type:"bar",stack:"Total",data:t}]},prepareStackData(){return this.dimensions.slice(1).map(t=>({name:t,type:"bar",stack:"a",data:this.sourceData.filter(i=>parseFloat(i[t])&&t).map(i=>parseFloat(i[t]))}))},prepareNegativeWaterfall(){const r=this.sourceData.map(a=>Number.isNaN(a[this.dimensions[1]])?0:Number(a[this.dimensions[1]])),e=this.sourceData.map(a=>Number.isNaN(a[this.dimensions[2]])?0:Number(a[this.dimensions[2]]));let t=0;const i=r.map((a,o)=>{const s=t;return t+=Number.isNaN(a)?0:a,o===0&&(t-=Number.isNaN(e[o])?0:e[o]),t-=Number.isNaN(e[o+1])?0:e[o+1],s>=0?s:0});return[{type:"bar",stack:"a",itemStyle:{borderColor:"transparent",color:"transparent"},data:i,tooltip:{show:!1}},{name:this.dimensions[1],type:"bar",stack:"a",data:r},{name:this.dimensions[2],type:"bar",stack:"a",data:e}]},prepareAccumulative(r){let e=0;const t=r.map(n=>(e+=n,e));return[{name:this.titleCharts,type:"bar",stack:"Total",data:t}]}}},zse=["id"];function Nse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full w-full min-h-[200px]"},null,8,zse)}const $C=hr(Rse,[["render",Nse]]),Ose=Object.freeze(Object.defineProperty({__proto__:null,default:$C},Symbol.toStringTag,{value:"Module"})),Bse={name:"VsPie",props:["currentWidget"],mixins:[da],data(){return{chartInstance:null,resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var t;await this.$nextTick(),await this.getData();const{series:r}=this.prepareData()||{};r&&this.initChart(r);const e=(t=this.$refs)==null?void 0:t.chart;e&&(this.resizeObserver=new ResizeObserver(()=>{this.chartInstance&&this.chartInstance.resize()}),this.resizeObserver.observe(e))},unmounted(){var r;(r=this.resizeObserver)==null||r.disconnect()},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&this.initChart(r,e,t)}}catch(r){console.error(r)}},buildTooltipForDonut(r,e){const{name:t,value:i,percent:n}=r;return`
97
+ `}),S+="</div>",S}},xAxis:{data:e!=null&&e.length?e:null,type:e?"category":"value",name:((n=(i=this.styleData)==null?void 0:i.x_axis)==null?void 0:n.name)||"",axisLabel:{...oF((a=this.styleData)==null?void 0:a.x_axis),formatter:m=>{var b,S;const _=this.formatDate(m);return((S=(b=this.styleData)==null?void 0:b.x_axis)==null?void 0:S.overflow)==="ellipsis"&&_.length>10?`${_.slice(0,10)}...`:_}}},yAxis:{data:t!=null&&t.length?t:null,type:t?"category":"value",name:((s=(o=this.styleData)==null?void 0:o.y_axis)==null?void 0:s.name)||"",axisLabel:oF((l=this.styleData)==null?void 0:l.y_axis)},series:r!=null&&r.length?r:null,...ih(this.styleData),grid:{bottom:"0%",right:"0%",left:"0%",top:"20px",containLabel:!0,...((h=this.styleData)==null?void 0:h.grid)||{}}};await d.setOption(v),d.resize(),this.widgetInstance=d,this.$emit("update:currentWidget",d)}catch(f){console.error(f)}},async setSeriesOption(r,e){const t=r.getOption(),{series:i=[]}=t,n=i.map(a=>({...a,...e}));r.setOption({...t,series:n})},async changeOptionsByName(r,e){const t=document.getElementById(r);if(!t)return null;const i=sS(t);if(!i)return null;const n=i.getOption();e.seriesOptions&&this.setSeriesOption(i,e.seriesOptions),i.setOption({...n,...e.options,tooltip:{...kse.getTooltipOptions(e.options.tooltip.show)}})},async changeData(r){var e;try{let t=this.dashboard?`${this.prefix||""}/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`:`${this.prefix||""}/bi-data?&widget=${this.widget}`;(e=r==null?void 0:r.granularity)!=null&&e.length&&(t+=`&granularity=${r.granularity}`),r!=null&&r.metrics&&(t+=`&metrics=${r.metrics}`),this.getDataFromURL(t)}catch(t){console.error(t)}},async setFilter(r){const e=`${this.prefix||""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}${r||""}`;await this.getDataFromURL(e)},async changeStyle(r,e){this.styleData[r]=e,this.onChangedData()},getMetricValue(r){var i;const e=(r==null?void 0:r.metric)||r;return parseFloat(e)?(i=mi(e,{notation:"standard"}))==null?void 0:i.replaceAll(","," "):e}}},hr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},Rse={name:"VsBar",mixins:[da],data(){return{resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var e;this.getData(),this.onChangedData();const r=(e=this.$refs)==null?void 0:e.chart;r&&(this.resizeObserver=new ResizeObserver(()=>{var t;this.widgetInstance&&((t=this.widgetInstance)==null||t.resize())}),this.resizeObserver.observe(r))},unmounted(){this.resizeObserver.disconnect()},methods:{async onChangedData(){try{if(this.sourceData){await this.$nextTick();const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e,t,i,n,a;try{if(!((r=this.sourceData)!=null&&r.length))return{series:[],xs:[],ys:void 0};const o=Array.from(new Set(this.sourceData.filter(v=>v[this.dimensions[0]]).map(v=>v[this.dimensions[0]])));let s;this.dimensions[0].includes("date")?s=o.map(v=>Xo(v)):s=[...o];let l,h;((e=this.styleData)==null?void 0:e.horizontal)===!0?h=[...s]:l=[...s];const f=this.sourceData.filter(v=>parseFloat(v[this.dimensions[1]])&&v[this.dimensions[0]]).map(v=>parseFloat(v[this.dimensions[1]]));let d;return((t=this.styleData)==null?void 0:t.stack)!==!1?d=this.prepareStackData():((i=this.styleData)==null?void 0:i.negative_waterfall)===!0?d=this.prepareNegativeWaterfall():((n=this.styleData)==null?void 0:n.waterfall)===!0?d=this.prepareWaterfallData(f):((a=this.styleData)==null?void 0:a.accumulative)===!0?d=this.prepareAccumulative(f):d=this.dimensions.slice(1).map((m,_)=>({name:m,type:"bar",stack:`a${_}`,data:this.sourceData.filter(b=>parseFloat(b[m])&&m).map(b=>parseFloat(b[m]))})),{series:d,xs:l,ys:h}}catch(o){return console.error(o),{series:[],xs:[],ys:[]}}},prepareWaterfallData(r){let e=r.reduce((a,o)=>a+o,0);const t=[e,...r],i=t.map((a,o)=>{if(o===0)return 0;const s=e-a;return e-=a,s>=0?s:0});return[{type:"bar",stack:"Total",itemStyle:{borderColor:"transparent",color:"transparent"},data:i,tooltip:{show:!1}},{name:this.title?this.title:this.dimensions[0],type:"bar",stack:"Total",data:t}]},prepareStackData(){return this.dimensions.slice(1).map(t=>({name:t,type:"bar",stack:"a",data:this.sourceData.filter(i=>parseFloat(i[t])&&t).map(i=>parseFloat(i[t]))}))},prepareNegativeWaterfall(){const r=this.sourceData.map(a=>Number.isNaN(a[this.dimensions[1]])?0:Number(a[this.dimensions[1]])),e=this.sourceData.map(a=>Number.isNaN(a[this.dimensions[2]])?0:Number(a[this.dimensions[2]]));let t=0;const i=r.map((a,o)=>{const s=t;return t+=Number.isNaN(a)?0:a,o===0&&(t-=Number.isNaN(e[o])?0:e[o]),t-=Number.isNaN(e[o+1])?0:e[o+1],s>=0?s:0});return[{type:"bar",stack:"a",itemStyle:{borderColor:"transparent",color:"transparent"},data:i,tooltip:{show:!1}},{name:this.dimensions[1],type:"bar",stack:"a",data:r},{name:this.dimensions[2],type:"bar",stack:"a",data:e}]},prepareAccumulative(r){let e=0;const t=r.map(n=>(e+=n,e));return[{name:this.titleCharts,type:"bar",stack:"Total",data:t}]}}},zse=["id"];function Nse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full w-full min-h-[200px]"},null,8,zse)}const $C=hr(Rse,[["render",Nse]]),Ose=Object.freeze(Object.defineProperty({__proto__:null,default:$C},Symbol.toStringTag,{value:"Module"})),Bse={name:"VsPie",props:["currentWidget"],mixins:[da],data(){return{chartInstance:null,resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var t;await this.$nextTick(),await this.getData();const{series:r}=this.prepareData()||{};r&&this.initChart(r);const e=(t=this.$refs)==null?void 0:t.chart;e&&(this.resizeObserver=new ResizeObserver(()=>{this.chartInstance&&this.chartInstance.resize()}),this.resizeObserver.observe(e))},unmounted(){var r;(r=this.resizeObserver)==null||r.disconnect()},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&this.initChart(r,e,t)}}catch(r){console.error(r)}},buildTooltipForDonut(r,e){const{name:t,value:i,percent:n}=r;return`
98
98
  <div style="background-color:${e[0]}; font-size:12px; font-family:Helvetica, Arial, sans-serif; color:#ffff; padding:5px; border-radius:5px;">
99
99
  ${t==null?void 0:t.replace("null","Не визначено")}: ${mi(i)} (${n}%)
100
- </div>`},prepareData(){var r,e,t;try{const i=Array.from(new Set(this.sourceData.map(d=>d[this.dimensions[0]]))),n=Array.from(new Set(this.sourceData.map(d=>d[this.dimensions[1]]))),a=parseInt(this.sourceData.reduce((d,v)=>d+parseFloat(v==null?void 0:v.metric),0),10),o=i.map((d,v)=>{const m=(n[v]/a*100).toFixed(2);return{name:`${d} (${m}%)`,value:n[v]}}),s=((r=this.styleData)==null?void 0:r.innerRadius)||"0%",l=((e=this.styleData)==null?void 0:e.outerRadius)||"100%",h=[s,l];return this.styleData.legend=N0.getLegendOpions({borderRadius:10,height:"100%",padding:10,type:"scroll",itemWidth:14,itemHeight:14,formatter:d=>d==null?void 0:d.replace("null","Не визначено"),textStyle:{fontSize:"14px"},...this.styleData.legend}),this.styleData.label=N0.getLabelOptions(this.styleData.label),this.styleData.show_legend=((t=this.styleData)==null?void 0:t.show_legend)||!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:h,center:["50%","60%"],height:"75%",...ih(this.styleData),data:o}]}}catch(i){return console.error(i),null}},async initChart(r){try{const e=this.$refs.chart;this.chartInstance=f_(e);const t={tooltip:{trigger:"item",formatter:i=>this.buildTooltipForDonut(i,[i.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:r,...ih({...this.styleData})};this.chartInstance.setOption(t),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{this.chartInstance.resize()})}catch(e){console.error(e)}}}},Vse=["id"];function Fse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,Vse)}const GC=hr(Bse,[["render",Fse]]),$se=Object.freeze(Object.defineProperty({__proto__:null,default:GC},Symbol.toStringTag,{value:"Module"})),Gse={name:"VsLine",mixins:[da],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:r,xs:e}=this.prepareData();r&&this.initChart(r,e)},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e;try{const t=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[0]])));let i;this.dimensions[0].includes("date")?i=t.map(o=>Xo(o)):i=[...t];const n=this.sourceData.map(o=>parseFloat(o[this.dimensions[1]]));let a;return(r=this.styleData)!=null&&r.stack?a=this.dimensions.slice(1).map(s=>({name:s,type:"line",stack:"a",areaStyle:this.styleData.area?{}:null,data:this.sourceData.filter(l=>parseFloat(l[s])).map(l=>parseFloat(l[s]))})):a=[{name:this.title,type:"line",areaStyle:(e=this.styleData)!=null&&e.area?{}:null,data:n,stack:"a"}],{series:a,xs:i}}catch(t){return console.error(t),null}}}},Use=["id"];function Hse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:n.uniqueID,ref:"chart",style:{height:"400px"}},null,8,Use)}const UC=hr(Gse,[["render",Hse]]),Wse=Object.freeze(Object.defineProperty({__proto__:null,default:UC},Symbol.toStringTag,{value:"Module"})),jse={name:"VsStat",mixins:[da],data(){return{restDimensions:[],sumValue:0,columns:null,showTooltip:-1}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){this.columns=Object.keys(this.sourceData[0]);const r=this.getValues();this.sumValue=r.reduce((e,t)=>e+t,0),this.sourceData.forEach((e,t)=>{e.color=t<sF.length-1?sF[t]:Lse()})},formattedValue(r){const e=parseFloat(r);return mi(e)}}},Zse={class:"flex flex-col w-full h-full pt-[16px] rounded-xl"},qse={class:"flex flex-col justify-between w-full h-full"},Xse={class:"w-full h-full pb-6 space-y-4"},Yse={class:"flex w-full h-3 rounded-full gap-x-1 min-h-3 custom-x-scrollbar"},Kse=["onMouseover"],Jse={key:0,class:"absolute top-[-1] left-1/2 transform -translate-x-1/2 -translate-y-full bg-black text-white rounded px-2 py-1"},Qse={class:"h-[calc(100%-20px)] w-full custom-scrollbar"},ele={class:"grid items-center justify-between grid-cols-2 py-2 gap-x-4"},tle={class:"flex items-center"},rle={class:"text-sm text-gray-800"},ile={class:"text-end"},nle={class:"text-sm text-gray-500"};function ale(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Zse,[N.createElementVNode("div",qse,[N.createElementVNode("div",Xse,[N.createElementVNode("div",Yse,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>{var l,h,f,d;return N.openBlock(),N.createElementBlock("div",{class:N.normalizeClass(["flex flex-col min-w-[5px] justify-center min-h-2.5 h-2.5 text-xs text-white text-center whitespace-nowrap",`bg-[${o.color}]`]),style:N.normalizeStyle({width:`${parseFloat(o==null?void 0:o[(l=n.columns)==null?void 0:l[1]])/n.sumValue*100}%`}),role:"progressbar","aria-valuenow":"42","aria-valuemin":"0","aria-valuemax":"100",onMouseover:v=>n.showTooltip=s,onMouseleave:e[0]||(e[0]=v=>n.showTooltip=-1)},[n.showTooltip>-1?(N.openBlock(),N.createElementBlock("div",Jse,N.toDisplayString(r.sourceData[n.showTooltip][n.columns[0]])+" "+N.toDisplayString((parseFloat((d=(h=r.sourceData)==null?void 0:h[n.showTooltip])==null?void 0:d[(f=n.columns)==null?void 0:f[1]])/n.sumValue*100).toFixed(2))+"% ",1)):N.createCommentVNode("",!0)],46,Kse)}),256))]),N.createElementVNode("ul",Qse,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,o=>{var s,l;return N.openBlock(),N.createElementBlock("li",ele,[N.createElementVNode("div",tle,[N.createElementVNode("span",{class:N.normalizeClass(["shrink-0 size-2.5 inline-block rounded-sm me-2.5 min-w-[10px] w-[10px] h-[10px] min-h-[10px]",`bg-[${o.color}]`])},null,2),N.createElementVNode("span",rle,N.toDisplayString((o==null?void 0:o[(s=n.columns)==null?void 0:s[0]])||"Не визначено"),1)]),N.createElementVNode("div",ile,[N.createElementVNode("span",nle,N.toDisplayString(a.formattedValue(o==null?void 0:o[(l=n.columns)==null?void 0:l[1]])||"-"),1)])])}),256))])])])])}const HC=hr(jse,[["render",ale]]),ole=Object.freeze(Object.defineProperty({__proto__:null,default:HC},Symbol.toStringTag,{value:"Module"})),sle={name:"VsProgressBar",mixins:[da],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){var e;this.columns=Object.keys((e=this.sourceData)==null?void 0:e[0])||null;const r=this.getValues();this.maxValue=Math.max(...r)},formattedValue(r){return mi(r)}}},lle={key:0,class:"flex flex-col h-full pt-[16px] rounded-xl"},ule={class:"h-full pt-0 pb-6 space-y-4"},cle={class:"h-full space-y-4 custom-scrollbar"},hle={class:"flex items-center justify-between mr-2 gap-x-2"},fle={class:"grid items-center w-full grid-cols-2 gap-x-2"},dle={class:"text-sm text-gray-800"},ple={class:"flex justify-end",role:"progressbar","aria-valuenow":"100","aria-valuemin":"0","aria-valuemax":"100"},vle={class:"min-w-[60px] text-end"},gle={class:"text-sm text-gray-500"};function mle(r,e,t,i,n,a){return n.columns?(N.openBlock(),N.createElementBlock("div",lle,[N.createElementVNode("div",ule,[N.createElementVNode("ul",cle,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>(N.openBlock(),N.createElementBlock("li",hle,[N.createElementVNode("div",fle,[N.createElementVNode("span",dle,N.toDisplayString(o[n.columns[0]]),1),N.createElementVNode("div",ple,[N.createElementVNode("div",{class:"h-1.5 flex flex-col justify-center overflow-hidden bg-indigo-500 rounded-full text-xs text-white text-center whitespace-nowrap",style:N.normalizeStyle({width:`${parseFloat(o[n.columns[1]])/n.maxValue*100}%`})},null,4)])]),N.createElementVNode("div",vle,[N.createElementVNode("span",gle,N.toDisplayString(a.formattedValue(o[n.columns[1]])),1)])]))),256))])])])):N.createCommentVNode("",!0)}const WC=hr(sle,[["render",mle]]),yle=Object.freeze(Object.defineProperty({__proto__:null,default:WC},Symbol.toStringTag,{value:"Module"})),_le={name:"VsListbar",mixins:[da],props:["source"],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch(r){console.error(r)}},prepareData(){var e;this.columns=Object.keys(this.sourceData[0]);const r=this.sourceData.map(t=>{var i;return t[(i=this.columns)==null?void 0:i[1]]});this.maxValue=Math.max(...r),this.restDimensions=(e=this.columns)==null?void 0:e.filter((t,i)=>i!==0)},formattedValue(r){return mi(r)},getWidth(r){return`${r/this.maxValue*100}%`}}},xle={class:"h-full pt-[20px] list-bar"},ble={class:"space-y-2 custom-scrollbar h-[calc(100%-20px)]"},wle={class:"relative w-full truncate"},Sle={class:"relative z-[1] text-sm block py-1 px-2 w-full text-sm truncate text-gray-800"},Tle={class:"text-[14px] text-gray-500"};function Cle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",xle,[N.createElementVNode("ul",ble,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>{var l,h,f;return N.openBlock(),N.createElementBlock("li",{key:s,class:"flex items-center justify-between w-full gap-x-2"},[N.createElementVNode("div",wle,[N.createElementVNode("span",Sle,N.toDisplayString((o==null?void 0:o[(l=n.columns)==null?void 0:l[0]])||"Без категорії"),1),N.createElementVNode("div",{class:N.normalizeClass(["absolute inset-y-0 h-full rounded start-0",o!=null&&o[(h=n.columns)==null?void 0:h[0]]?"bg-indigo-100":"bg-gray-100"]),style:N.normalizeStyle({width:a.getWidth(o==null?void 0:o[(f=n.columns)==null?void 0:f[1]])})},null,6)]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.restDimensions,(d,v)=>(N.openBlock(),N.createElementBlock("div",{key:v,class:"w-20 mr-2 text-end"},[N.createElementVNode("span",Tle,N.toDisplayString(a.formattedValue(o==null?void 0:o[d])),1)]))),128))])}),128))])])}const O0=hr(_le,[["render",Cle]]),Dle=Object.freeze(Object.defineProperty({__proto__:null,default:O0},Symbol.toStringTag,{value:"Module"})),jC={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},Ale=["onClick"],Ile={class:"flex items-center justify-between w-full"},Mle={key:0},Ele={__name:"vs-bi-dropdown",props:{title:String,options:[Array,String],value:{type:String}},emits:["selected"],setup(r,{emit:e}){const t=r,i=e,n=N.ref(!1),a=N.ref(t.value||null),o=N.ref(null),s=N.computed(()=>typeof t.options=="string"?t.options.split(",").map((m,_)=>({id:_,text:m.trim()})):t.options),l=N.computed(()=>{const m=s.value.find(_=>(_.id||_)===a.value);return m?m.text||m:t.title}),h=m=>{a.value=m.id||m,n.value=!1,i("selected",(m==null?void 0:m.id)||m),document.removeEventListener("click",f)},f=m=>{o.value&&!o.value.contains(m.target)&&(n.value=!1,document.removeEventListener("click",f))},d=()=>{n.value=!n.value,n.value?setTimeout(()=>{document.addEventListener("click",f)},200):document.removeEventListener("click",f)},v=m=>(jC==null?void 0:jC[m])||m;return N.onUnmounted(()=>{document.removeEventListener("click",f)}),(m,_)=>(N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("button",{type:"button","aria-expanded":"true",class:"hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative group pr-2 -ms-2 py-1.5 pl-2.5 inline-flex shrink-0 justify-center items-center gap-x-1.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 before:absolute before:inset-0 before:z-[1] dark:text-neutral-400 dark:hover:bg-neutral-800 dark:focus:bg-neutral-700",onClick:d},[N.createTextVNode(N.toDisplayString(v(l.value))+" ",1),_[0]||(_[0]=N.createElementVNode("svg",{class:"shrink-0 size-3.5 text-gray-600 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),n.value?(N.openBlock(),N.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:o,"data-hs-select-dropdown":"",class:"absolute mt-2 z-50 w-48 p-1 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-950 opened",role:"listbox",tabindex:"-1","aria-orientation":"vertical",style:{"margin-top":"10px"}},[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(s.value,b=>(N.openBlock(),N.createElementBlock("div",{key:b.id||b,class:"cursor-pointer selected hs-selected:bg-gray-100 dark:hs-selected:bg-neutral-800 py-1.5 px-2 w-full text-[13px] text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:S=>h(b)},[N.createElementVNode("div",Ile,[N.createElementVNode("span",null,N.toDisplayString(v(b.text||b)),1),a.value===(b.id||b)?(N.openBlock(),N.createElementBlock("span",Mle,_[1]||(_[1]=[N.createElementVNode("svg",{class:"shrink-0 h-3.5 w-3.5 text-gray-800 dark:text-neutral-200",xmlns:"http:.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)]))):N.createCommentVNode("",!0)])],8,Ale))),128))],512)):N.createCommentVNode("",!0)],64))}},kle={"bi-bar":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Ose)),"bi-number":N.defineAsyncComponent(()=>Promise.resolve().then(()=>The)),"bi-text":N.defineAsyncComponent(()=>Promise.resolve().then(()=>sfe)),"bi-listbar":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Dle)),"bi-pie":N.defineAsyncComponent(()=>Promise.resolve().then(()=>$se)),"bi-donut":N.defineAsyncComponent(()=>Promise.resolve().then(()=>hfe)),"bi-line":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Wse)),"bi-stat":N.defineAsyncComponent(()=>Promise.resolve().then(()=>ole)),"bi-pivot":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Fue)),"bi-progress":N.defineAsyncComponent(()=>Promise.resolve().then(()=>yle)),"bi-funnel":N.defineAsyncComponent(()=>Promise.resolve().then(()=>vfe)),"bi-map":N.defineAsyncComponent(()=>Promise.resolve().then(()=>wde)),"bi-cluster":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Ide)),"bi-table":N.defineAsyncComponent(()=>Promise.resolve().then(()=>$de))},Ple={class:"flex items-center space-x-2"},Lle=N.defineComponent({__name:"vs-bi-switch",props:N.mergeModels({leftLabel:{},rightLabel:{},modelValue:{type:Boolean}},{modelValue:{default:()=>!1,type:Boolean},modelModifiers:{}}),emits:N.mergeModels(["update:is-enabled"],["update:modelValue"]),setup(r,{emit:e}){const t=e,i=N.useModel(r,"modelValue"),n=()=>{t("update:is-enabled",i)};return(a,o)=>(N.openBlock(),N.createElementBlock("div",Ple,[a.leftLabel?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(["transition-colors",{"text-blue-500":!i.value}])},N.toDisplayString(a.leftLabel),3)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>i.value=s),type:"checkbox",class:"relative w-11 h-6 p-px bg-gray-100 border-transparent text-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:ring-blue-600 disabled:opacity-50 disabled:pointer-events-none checked:bg-none checked:text-blue-600 checked:border-blue-600 focus:checked:border-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-600 before:inline-block before:size-5 before:bg-white checked:before:bg-blue-200 before:translate-x-0 checked:before:translate-x-full before:rounded-full before:shadow before:h-5 before:w-5 before:transform before:ring-0 before:transition before:ease-in-out before:duration-200 dark:before:bg-neutral-400 dark:checked:before:bg-blue-200",onChange:n},null,544),[[N.vModelCheckbox,i.value]]),a.rightLabel?(N.openBlock(),N.createElementBlock("div",{key:1,class:N.normalizeClass(["transition-colors",{"text-blue-500":i.value}])},N.toDisplayString(a.rightLabel),3)):N.createCommentVNode("",!0)]))}}),Rle={},zle={class:"flex items-center justify-center h-full"};function Nle(r,e){return N.openBlock(),N.createElementBlock("div",zle,e[0]||(e[0]=[N.createElementVNode("div",{class:"text-center text-gray-500"},[N.createElementVNode("h2",{class:"text-2xl font-bold"},"No data available")],-1)]))}const Ole=hr(Rle,[["render",Nle]]),Ble={},Vle={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Fle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",Vle,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),N.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),N.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const $le={components:{VsBiDropdown:Ele,VsBiSwitch:Lle,VsNoDataChart:Ole,IconDownload:hr(Ble,[["render",Fle]]),...kle},props:{dashboard:{type:String},prefix:{type:String,default:""},widget:{type:String},filterURl:{type:String},dashboardWidgets:{type:Object},selectedWidget:{type:String}},data(){return{checked:[],selected:[],currentWidget:null,widgetData:[]}},computed:{computedTitle(){var e,t;const r=(e=this.dashboardWidgets)==null?void 0:e.find(i=>i.name===this.widget);return((t=r==null?void 0:r.data)==null?void 0:t.title)||(r==null?void 0:r.title)||""},computedType(){var e;const r=(e=this.dashboardWidgets)==null?void 0:e.find(t=>t.name===this.widget);return console.log(r),(r==null?void 0:r.type)||"text"},controls(){var e;return Object.keys(((e=this.widgetData)==null?void 0:e.controls)||{}).map(t=>{var i,n,a;return{name:t,options:typeof((i=this.widgetData)==null?void 0:i.controls)=="boolean"?!1:(a=(n=this.widgetData)==null?void 0:n.controls)==null?void 0:a[t]}})}},watch:{filterURl(r){var e,t;(t=(e=this.$refs)==null?void 0:e.chart)==null||t.setFilter(r)},selectedWidget(r,e){var t;r!==e&&r===((t=this.widgetData)==null?void 0:t.id)&&this.$emit("update:current-widget-data",this.widgetData)},widgetData(r,e){if((r==null?void 0:r.id)===(e==null?void 0:e.id))return;const i=new URLSearchParams(window.top.location.search).get("widget");i&&i===(r==null?void 0:r.id)&&this.$emit("update:current-widget-data",r)}},methods:{changeStyleHandler(r,e){var t;(t=this.$refs.chart)==null||t.changeStyle(r,e)},selectedOptionHandler(r,e){let t=!0;this.selected.forEach(i=>{i.name===e&&(i.option=r,t=!1)}),t&&this.selected.push({name:e,option:r}),this.makeUpUrl()},makeUpUrl(){var e;let r=`${this.prefix}/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`;this.selected.forEach((t,i)=>{r+=`&${t.name}=${t.option}`}),(e=this.$refs.chart)==null||e.getDataFromURL(r)},exportChart(){if(this.currentWidget){const r=this.currentWidget.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),e=document.createElement("a");e.href=r,e.download="chart.png",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}}},Gle={ref:"widget",class:"box-border relative h-full p-4 bg-white border border-gray-200 select-auto rounded-xl"},Ule={class:"text-[16px] flex max-w-full items-center min-h-0 flex justify-between max-h-[50px] h-fit shrink-0"},Hle={class:"flex items-center justify-between w-full"},Wle={class:"grid"},jle={class:"text-gray-800 max-h-[30px] inline-block font-semibold font-[24px] overflow-hidden"},Zle={class:"flex flex-col justify-end"},qle={key:0,class:"flex items-center justify-end w-full gap-2"},Xle={class:"w-full h-full"};function Yle(r,e,t,i,n,a){var f,d,v;const o=N.resolveComponent("VsBiDropdown"),s=N.resolveComponent("VsBiSwitch"),l=N.resolveComponent("IconDownload"),h=N.resolveComponent("VsNoDataChart");return N.openBlock(),N.createElementBlock("div",Gle,[N.createElementVNode("div",Ule,[N.createElementVNode("div",Hle,[N.createElementVNode("div",Wle,[N.createElementVNode("span",jle,N.toDisplayString(a.computedTitle),1)]),N.createElementVNode("div",Zle,[(f=a.controls)!=null&&f.length?(N.openBlock(),N.createElementBlock("span",qle,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList((d=a.controls)==null?void 0:d.filter(m=>(m==null?void 0:m.options)&&(m==null?void 0:m.name)!=="export"),m=>{var _;return N.openBlock(),N.createElementBlock("div",null,[Array.isArray(m==null?void 0:m.options)?(N.openBlock(),N.createBlock(o,{key:0,title:m==null?void 0:m.name,options:m==null?void 0:m.options,value:(_=n.widgetData)==null?void 0:_.data[m==null?void 0:m.name],onSelected:b=>a.selectedOptionHandler(b,m==null?void 0:m.name)},null,8,["title","options","value","onSelected"])):typeof m.options=="boolean"?(N.openBlock(),N.createBlock(s,{key:1,"left-label":m==null?void 0:m.name,"is-enabled":m==null?void 0:m.options,"onUpdate:isEnabled":b=>a.changeStyleHandler(m==null?void 0:m.name,b)},null,8,["left-label","is-enabled","onUpdate:isEnabled"])):N.createCommentVNode("",!0)])}),256)),(v=a.controls)!=null&&v.some(m=>(m==null?void 0:m.name)==="export")?(N.openBlock(),N.createElementBlock("button",{key:0,onClick:e[0]||(e[0]=(...m)=>a.exportChart&&a.exportChart(...m)),class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center"},[N.createVNode(l,{height:"16",width:"16",class:"text-gray-800"})])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0)])])]),N.createElementVNode("div",Xle,[n.widgetData?(N.openBlock(),N.createBlock(N.resolveDynamicComponent("bi-"+a.computedType),{key:0,currentWidget:n.currentWidget,"onUpdate:currentWidget":e[1]||(e[1]=m=>n.currentWidget=m),widgetData:n.widgetData,"onUpdate:widgetData":e[2]||(e[2]=m=>n.widgetData=m),ref:"chart",dashboard:t.dashboard,widget:t.widget},null,40,["currentWidget","widgetData","dashboard","widget"])):(N.openBlock(),N.createBlock(h,{key:1,class:"w-full h-full"}))])],512)}const qv=hr($le,[["render",Yle]]),Kle={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},Jle={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},Qle={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},eue={class:"max-w-sm mx-auto mt-6"},tue={class:"font-medium text-gray-800 dark:text-neutral-200"},rue={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function iue(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Jle,[N.createElementVNode("div",null,[N.createElementVNode("div",Qle,[e[0]||(e[0]=N.createStaticVNode('<svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg>',1)),N.createElementVNode("div",eue,[N.createElementVNode("p",tue,N.toDisplayString(t.title),1),N.createElementVNode("p",rue,N.toDisplayString(t.text),1)])])])])}const ZC=hr(Kle,[["render",iue]]),nue={},aue={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function oue(r,e){return N.openBlock(),N.createElementBlock("svg",aue,e[0]||(e[0]=[N.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const sue=hr(nue,[["render",oue]]),lue={},uue={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-refresh"};function cue(r,e){return N.openBlock(),N.createElementBlock("svg",uue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"},null,-1),N.createElementVNode("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},null,-1)]))}const hue={components:{filterIcon:sue,refreshIcon:hr(lue,[["render",cue]])},props:["filterScheme"],emits:["filters:changed"],data(){return{rows:[],isFilterVisible:!1,rowList:[],activeFilters:"",filters:{}}},async mounted(){const e=await(await new URLSearchParams(window.top.location.search)).get("filter");this.filters.url=e||""},computed:{activeFiltersCount(){var r,e;return(r=this.filters)!=null&&r.url?((e=this.filters)==null?void 0:e.url.split("=").length)-1:0}},methods:{toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},handleFilterChange(r){var e,t;this.filters=r,this.activeFilters=(t=(e=this.$refs)==null?void 0:e.filter)==null?void 0:t.activeFilters,this.$emit("filters:changed",this.filters)},resetFilters(){this.$refs.filter&&this.$refs.filter.clearAll(),this.isFilterVisible=!1,this.$emit("filters:changed",""),this.activeFilters=null},closeFilter({target:r}){this.isFilterVisible&&r.classList.contains("filter-container")&&(this.isFilterVisible=!1)}}},fue={class:"flex items-center"},due={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"};function pue(r,e,t,i,n,a){const o=N.resolveComponent("filterIcon"),s=N.resolveComponent("VsFilterList");return N.openBlock(),N.createElementBlock("div",fue,[t.filterScheme?(N.openBlock(),N.createBlock(s,{key:0,ref:"filter",scheme:t.filterScheme,closeFilterBtn:!0,onFilterClose:e[1]||(e[1]=l=>n.isFilterVisible=!1),layout:"default","apply-vue-router":"",history:"",view:"plain",token:r.table,name:"filter",footer:!0,background:!0,onFilterChange:a.handleFilterChange},{button:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"py-2 px-2.5 ml-3 h-[38px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:e[0]||(e[0]=(...l)=>a.toggleFilterShown&&a.toggleFilterShown(...l))},[N.createVNode(o),e[2]||(e[2]=N.createTextVNode(" Фільтри ")),a.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",due,N.toDisplayString(a.activeFiltersCount),1)):N.createCommentVNode("",!0)])]),_:1},8,["scheme","token","onFilterChange"])):N.createCommentVNode("",!0)])}const vue={props:["dashboardData","filters"],components:{VsFilterHeader:hr(hue,[["render",pue]])}},gue={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 mt-2 rounded-xl mb-2 pt-[3px] justify-between items-center"},mue={class:"grow"},yue={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},_ue={type:"button",class:"inline-flex items-center text-sm gap-x-2 text-stone-800 hover:text-stone-500 focus:outline-none focus:text-stone-500 dark:text-neutral-200 dark:hover:text-neutral-400 dark:focus:text-neutral-400","data-clipboard-target":"#hs-erc","data-clipboard-action":"copy","data-clipboard-success-text":"Copied"};function xue(r,e,t,i,n,a){var s,l;const o=N.resolveComponent("VsFilterHeader");return N.openBlock(),N.createElementBlock("div",gue,[N.createElementVNode("div",mue,[N.createElementVNode("h1",yue,N.toDisplayString((s=t.dashboardData)==null?void 0:s.title),1),N.createElementVNode("button",_ue,N.toDisplayString((l=t.dashboardData)==null?void 0:l.description),1)]),N.createVNode(o,{filterScheme:t.filters,"onFilters:changed":e[0]||(e[0]=h=>r.$emit("filters:changed",h))},null,8,["filterScheme"])])}const bue={components:{VsWidget:qv,VsNewNodata:ZC,VsHeader:hr(vue,[["render",xue]])},props:["id","prefix"],data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},async mounted(){vr.defaults.baseURL=this.prefix||"/api",await this.fetchData()},methods:{async fetchData(){if(this.id)try{const{data:r}=await vr.get(`/bi-dashboard/${this.id}`);this.dashboardData=r}catch(r){console.error(r)}},columnClass(r){const e=r!=null&&r.col?r==null?void 0:r.col:12;return{1:"md:w-1/12 sm:w-full",2:"md:w-1/6 sm:w-full",3:"md:w-1/4 sm:w-full",4:"md:w-1/3 sm:w-full",6:"md:w-1/2 sm:w-full",8:"md:w-2/3 sm:w-full",10:"md:w-5/6 sm:w-full",12:"w-full"}[e]||"w-full"},async filterHandler(r){var t;this.filterURl="";let e="&filter=";(t=r==null?void 0:r.url)!=null&&t.length&&(r.url.split("|").forEach(n=>{const a=n.split("=");e+=`${a[0]}=${a[1]}`}),this.filterURl+=e)}}},wue={class:"w-full pb-8 overflow-y-auto"},Sue={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function Tue(r,e,t,i,n,a){var h,f,d;const o=N.resolveComponent("VsHeader"),s=N.resolveComponent("VsNewNodata"),l=N.resolveComponent("VsWidget");return N.openBlock(),N.createElementBlock("div",wue,[N.createElementVNode("div",null,[(h=n.dashboardData)!=null&&h.filters?(N.openBlock(),N.createBlock(o,{key:0,filters:(f=n.dashboardData)==null?void 0:f.filters,dashboardData:n.dashboardData,"onFilters:changed":e[0]||(e[0]=v=>a.filterHandler(v))},null,8,["filters","dashboardData"])):N.createCommentVNode("",!0)]),N.createElementVNode("div",Sue,[n.error||!n.dashboardData?(N.openBlock(),N.createBlock(s,{key:0,class:"col-span-12"})):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(((d=n.dashboardData)==null?void 0:d.panels)||[],(v,m)=>{var _;return N.openBlock(),N.createElementBlock("div",{key:m,class:N.normalizeClass([`col-span-${v.col||12}`,"flex flex-col gap-[10px]"])},[(_=v.widgets)!=null&&_.length?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:0},N.renderList(v.widgets,b=>(N.openBlock(),N.createBlock(l,{key:b,dashboard:t.id,widget:b,"dashboard-widgets":n.dashboardData.widgets,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))),128)):(N.openBlock(),N.createBlock(l,{key:1,class:"max-h-[460px] flex flex-col",dashboard:t.id,widget:v.widget,"dashboard-widgets":n.dashboardData.widgets,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))],2)}),128))])])}const lF=hr(bue,[["render",Tue]]),Cue={name:"VsPivotTable",mixins:[da],data(){return{values:null,xs:null,products:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){try{const r=Array.from(new Set(this.sourceData.map(e=>e[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=r.map(e=>Xo(e)):this.xs=[...r],this.products=this.dimensions.filter((e,t)=>t!=0),this.values=this.products.map((e,t)=>({name:e,data:this.sourceData.filter(i=>parseFloat(i[e])).map(i=>mi(parseFloat(i[e])))}))}catch(r){console.error(r)}}}},Due={class:"flex flex-col h-full p-5 space-y-4 rounded-xl custom-scrollbar"},Aue={class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 custom-scrollbar"},Iue={class:"inline-block min-w-full align-middle"},Mue={class:"min-w-full divide-y divide-gray-200"},Eue={class:"space-x-2"},kue={scope:"col",class:"xl:min-w-[120px] min-w-48"},Pue={class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"},Lue={class:"divide-y divide-gray-200 text-[12px]"},Rue={class:"py-3 size-px whitespace-nowrap"},zue={class:"flex items-center gap-x-3"},Nue={class:"font-medium text-gray-800"},Oue={class:"py-3 size-px whitespace-nowrap"},Bue={class:"text-gray-600"};function Vue(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Due,[N.createElementVNode("div",Aue,[N.createElementVNode("div",Iue,[N.createElementVNode("table",Mue,[N.createElementVNode("thead",null,[N.createElementVNode("tr",Eue,[e[0]||(e[0]=N.createElementVNode("th",{scope:"col",class:"min-w-[200px]"},[N.createElementVNode("div",{class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"})],-1)),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.xs,o=>(N.openBlock(),N.createElementBlock("th",kue,[N.createElementVNode("div",Pue,N.toDisplayString(o),1)]))),256))])]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.values,o=>(N.openBlock(),N.createElementBlock("tbody",Lue,[N.createElementVNode("tr",null,[N.createElementVNode("td",Rue,[N.createElementVNode("div",zue,[N.createElementVNode("span",Nue,N.toDisplayString(o.name),1)])]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.xs,(s,l)=>(N.openBlock(),N.createElementBlock("td",Oue,[N.createElementVNode("span",Bue,N.toDisplayString(o.data[l]),1)]))),256))])]))),256))])])])])}const qC=hr(Cue,[["render",Vue]]),Fue=Object.freeze(Object.defineProperty({__proto__:null,default:qC},Symbol.toStringTag,{value:"Module"})),$ue={},Gue={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Uue(r,e){return N.openBlock(),N.createElementBlock("svg",Gue,e[0]||(e[0]=[N.createElementVNode("path",{d:"M3.3335 8H12.6668",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M8 3.33325V12.6666",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const Hue=hr($ue,[["render",Uue]]),Wue={},jue={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"mr-3"};function Zue(r,e){return N.openBlock(),N.createElementBlock("svg",jue,e[0]||(e[0]=[N.createElementVNode("path",{d:"M6.41667 11.0833C8.994 11.0833 11.0833 8.994 11.0833 6.41667C11.0833 3.83934 8.994 1.75 6.41667 1.75C3.83934 1.75 1.75 3.83934 1.75 6.41667C1.75 8.994 3.83934 11.0833 6.41667 11.0833Z",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M12.25 12.25L9.7417 9.7417",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const que=hr(Wue,[["render",Zue]]),Xue={},Yue={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Kue(r,e){return N.openBlock(),N.createElementBlock("svg",Yue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),N.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),N.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Jue=hr(Xue,[["render",Kue]]),Que={},ece={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-lock"};function tce(r,e){return N.openBlock(),N.createElementBlock("svg",ece,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z"},null,-1),N.createElementVNode("path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"},null,-1),N.createElementVNode("path",{d:"M8 11v-4a4 4 0 1 1 8 0v4"},null,-1)]))}const rce=hr(Que,[["render",tce]]),ice=[{type:"Text",key:"name",label:"Назва",validators:["required"],original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"title",label:"Заголовок",validators:["required"],original:{type:"Text",ua:"Титул",col:8}},{type:"Text",key:"description",label:"Опис",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"words",label:"Ключові слова",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],nce={components:{plusIcon:Hue,searchIcon:que,IconLock:rce,IconImport:Jue},props:["selectedDashboard","prefix"],emits:["update:selectedDashboard","add","update"],mounted(){vr.defaults.baseURL=this.prefix||"/api",this.getFileItems(),this.getList()},data(){return{searchQuery:"",scheme:null,formValues:{},formCreateValues:{},isVisible:!1,isVisibleFormDashboard:!1,fileItems:null,list:null,addDashboardForm:ice}},methods:{async getFileItems(){var r;try{const{data:e}=await vr.get("/bi-dashboard?type=file");this.scheme={dashboard:{type:"Checkbox",ua:"Дашборди",options:(r=e==null?void 0:e.rows)==null?void 0:r.map(({name:t,title:i})=>({id:t,text:i}))}}}catch{}},async getList(){try{const{data:r}=await vr.get("/bi-dashboard?type=db");this.list=r.rows.filter(e=>e.type==="db")}catch(r){console.error(r)}},async dashboardImport(){try{await vr.get(`/bi-dashboard-import?dashboard=${this.formValues.dashboard}`),this.isVisible=!1,this.formValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд імпортовано успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі імпортувати дашборд виникла помилка"})}},async createDashboard(){try{await this.$refs.form.doValidation(),await vr.post("/bi-dashboard",this.formCreateValues),this.isVisibleFormDashboard=!1,this.formCreateValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд створено успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі створити дашборд виникла помилка"})}}},computed:{filteredList(){var e;const r=this.searchQuery.toLowerCase();return(e=this.list)==null?void 0:e.filter(t=>(t==null?void 0:t.title)&&(t==null?void 0:t.title.toLowerCase().includes(r))||(t==null?void 0:t.name)&&(t==null?void 0:t.name.toLowerCase().includes(r)))}}},ace={class:"h-full w-[300px] shrink-0 bg-white border-r border-gray-200 flex flex-col"},oce={class:"flex h-[49px] border-b justify-between px-[16px] items-center"},sce={class:"flex items-center gap-2"},lce={class:"flex items-center gap-2 px-[10px] py-2"},uce={class:"relative w-full"},cce={class:"px-[10px] flex flex-col gap-[2px] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300"},hce=["item","onClick"],fce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},dce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function pce(r,e,t,i,n,a){const o=N.resolveComponent("IconImport"),s=N.resolveComponent("VsPopover"),l=N.resolveComponent("plusIcon"),h=N.resolveComponent("IconLock"),f=N.resolveComponent("VsForm"),d=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",ace,[N.createElementVNode("div",oce,[e[13]||(e[13]=N.createElementVNode("div",{class:"text-[20px]"},[N.createTextVNode("Editor "),N.createElementVNode("span",{class:"text-[#666666]"})],-1)),N.createElementVNode("div",sce,[N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] text-blue-500 w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[0]||(e[0]=v=>n.isVisible=!0)},[N.createVNode(o,{height:"18",width:"18"})])]),default:N.withCtx(()=>[e[11]||(e[11]=N.createTextVNode(" Імпортувати дашборд "))]),_:1}),N.createVNode(s,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[1]||(e[1]=v=>n.isVisibleFormDashboard=!0)},[N.createVNode(l)])]),default:N.withCtx(()=>[e[12]||(e[12]=N.createTextVNode(" Створити дашборд "))]),_:1})])]),N.createElementVNode("div",lce,[N.createElementVNode("div",uce,[N.withDirectives(N.createElementVNode("input",{"onUpdate:modelValue":e[2]||(e[2]=v=>n.searchQuery=v),class:"flex-1 text-[13px] w-full h-[38px] px-3 text-gray-800 rounded-lg !border-none bg-gray-100 placeholder-gray-800 focus:outline-2 focus:outline-blue-600",placeholder:"Пошук..."},null,512),[[N.vModelText,n.searchQuery]])])]),N.createElementVNode("div",cce,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(a.filteredList,(v,m)=>(N.openBlock(),N.createElementBlock("div",{key:m,item:v,class:N.normalizeClass(["flex items-center cursor-pointer hover:bg-[#F3F4F6] py-1.5 px-2 text-[13px] text-gray-800 rounded-lg",{"bg-gray-100 outline-none":v.name===t.selectedDashboard}]),onClick:_=>r.$emit("update:selectedDashboard",v==null?void 0:v.name)},[N.createTextVNode(N.toDisplayString((v==null?void 0:v.title)||(v==null?void 0:v.name))+" ",1),v!=null&&v.public?N.createCommentVNode("",!0):(N.openBlock(),N.createBlock(h,{key:0,height:"12",width:"12",class:"ml-1 shrink-0"}))],10,hce))),128))])]),N.createVNode(d,{visible:n.isVisible,"onUpdate:visible":e[6]||(e[6]=v=>n.isVisible=v),title:"Імпортувати"},{footer:N.withCtx(()=>[N.createElementVNode("div",fce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[4]||(e[4]=v=>n.isVisible=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[5]||(e[5]=(...v)=>a.dashboardImport&&a.dashboardImport(...v)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Імпортувати ")])]),default:N.withCtx(()=>{var v;return[N.createTextVNode(N.toDisplayString((v=n.fileItems)==null?void 0:v.map(({name:m,title:_})=>({value:m,text:_})))+" ",1),N.createVNode(f,{scheme:n.scheme,modelValue:n.formValues,"onUpdate:modelValue":e[3]||(e[3]=m=>n.formValues=m)},null,8,["scheme","modelValue"])]}),_:1},8,["visible"]),N.createVNode(d,{visible:n.isVisibleFormDashboard,"onUpdate:visible":e[10]||(e[10]=v=>n.isVisibleFormDashboard=v),title:"Створити дашборд"},{footer:N.withCtx(()=>[N.createElementVNode("div",dce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=v=>n.isVisibleFormDashboard=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[9]||(e[9]=(...v)=>a.createDashboard&&a.createDashboard(...v)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(f,{ref:"form",scheme:n.addDashboardForm,modelValue:n.formCreateValues,"onUpdate:modelValue":e[7]||(e[7]=v=>n.formCreateValues=v)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const vce=hr(nce,[["render",pce]]),gce={},mce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function yce(r,e){return N.openBlock(),N.createElementBlock("svg",mce,e[0]||(e[0]=[N.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const uF=hr(gce,[["render",yce]]),_ce={},xce={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function bce(r,e){return N.openBlock(),N.createElementBlock("svg",xce,e[0]||(e[0]=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)]))}const wce=hr(_ce,[["render",bce]]),Sce={},Tce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit"};function Cce(r,e){return N.openBlock(),N.createElementBlock("svg",Tce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"},null,-1),N.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"},null,-1),N.createElementVNode("path",{d:"M16 5l3 3"},null,-1)]))}const cF=hr(Sce,[["render",Cce]]),Dce={class:"pt-[10px]"},Ace={__name:"vs-editor-form-style",props:{widgetName:{type:String},data:{type:Object,default:()=>{}}},setup(r){var v,m,_,b,S,D;const{$notify:e}=N.getCurrentInstance().proxy,t=r,i=N.ref(null),n={show:{label:"Label",type:"switcher",title:"Show label"},rotate:{type:"number",label:"Rotate angel",conditions:["show","==",!0]},align:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"center",text:"Center"},{id:"left",text:"Left"},{id:"right",text:"Right"}]},position:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"top",text:"Top"},{id:"right",text:"Right"},{id:"left",text:"Left"},{id:"bottom",text:"Bottom"}]}},a={show:{label:"Legend",type:"switcher",title:"Show legend"}},o={show:{label:"Tooltip ",type:"switcher",title:"Show tooltip"}},s=N.ref({...((m=(v=t.data)==null?void 0:v.style)==null?void 0:m.label)||{}}),l=N.ref({...((b=(_=t.data)==null?void 0:_.style)==null?void 0:b.legend)||{}}),h=N.ref({...((D=(S=t.data)==null?void 0:S.style)==null?void 0:D.tooltip)||{}}),f=()=>{const E=new CustomEvent(`update-style-${t.widgetName}`);E.chartId=t.widgetName,E.options={options:{legend:l.value,tooltip:h.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(E)};N.watch(s,f,{deep:!0}),N.watch(l,f,{deep:!0}),N.watch(h,f,{deep:!0});const d=async()=>{try{await vr.put(`/bi-dashboard/${i.value}/${t.widgetName}`,{style:{legend:l.value,tooltip:h.value,label:s.value}});const E=new CustomEvent(`update-style-${t.widgetName}`);E.chartId=t.widgetName,E.options={options:{legend:l.value,tooltip:h.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(E),await e({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await e({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const E=new URLSearchParams(window.top.location.search);i.value=E.get("dashboard")}),(E,P)=>{const z=N.resolveComponent("VsButton"),V=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",Dce,[N.createVNode(z,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:d},{default:N.withCtx(()=>P[3]||(P[3]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(V,{scheme:n,modelValue:s.value,"onUpdate:modelValue":P[0]||(P[0]=F=>s.value=F),class:"p-0"},null,8,["modelValue"]),N.createVNode(V,{scheme:a,modelValue:l.value,"onUpdate:modelValue":P[1]||(P[1]=F=>l.value=F),class:"p-0"},null,8,["modelValue"]),N.createVNode(V,{scheme:o,modelValue:h.value,"onUpdate:modelValue":P[2]||(P[2]=F=>h.value=F),class:"p-0"},null,8,["modelValue"])])}}},Ice={class:"pt-[10px]"},Mce={__name:"vs-editor-form-data",props:{widgetName:{type:String},data:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(r,{emit:e}){var h,f,d,v,m,_,b,S,D,E,P,z,V,F,U,j,Z,X,Q,se;const{$notify:t}=N.getCurrentInstance().proxy,i=r,n=N.ref(null),a={text:{type:"Text",label:"Text",conditions:["type","==","text"]},x:{type:"radio",label:"X Axis",view:"buttons",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:(f=(h=i.columns)==null?void 0:h.filter(ne=>(ne==null?void 0:ne.type)=="text"||(ne==null?void 0:ne.type)==="date"||(ne==null?void 0:ne.type)==="timestamp without time zone"||(ne==null?void 0:ne.type)==="boolean"||(ne==null?void 0:ne.type)==="integer"))==null?void 0:f.map(({name:ne,type:ue})=>({id:ne,label:ne,type:ue}))},metric:{type:"radio",label:"Y Axis",view:"buttons",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:[{id:"count",label:"count"},...(v=(d=i.columns)==null?void 0:d.filter(ne=>(ne==null?void 0:ne.type)==="numeric"||(ne==null?void 0:ne.type)==="double precision"))==null?void 0:v.map(({name:ne,type:ue})=>({id:ne,label:ne,type:ue}))]},groupby:{type:"radio",label:"Groupby",view:"buttons",style:{size:"xs"},options:[{id:"null",label:"null"},...(_=(m=i.columns)==null?void 0:m.filter(ne=>(ne==null?void 0:ne.type)=="text"||(ne==null?void 0:ne.type)==="boolean"||(ne==null?void 0:ne.type)==="integer"))==null?void 0:_.map(({name:ne})=>({id:ne,label:ne}))],conditions:["type","==","bar"]},columns:{type:"checkbox",label:"Columns",style:{size:"xs"},options:(b=i.columns)==null?void 0:b.map(({name:ne})=>ne),conditions:["type","in",["table","map"]]},granularity:{type:"radio",label:"Granularity",options:[{id:"year",label:"year"},{id:"quarter",label:"quarter"},{id:"month",label:"month"},{id:"week",label:"week"}],conditions:["x.type","==","date"]},type:{type:"Text",hidden:!0}},o=N.ref({x:((D=(S=i.data)==null?void 0:S.data)==null?void 0:D.x)||null,metric:((P=(E=i.data)==null?void 0:E.data)==null?void 0:P.metric)||null,columns:((V=(z=i.data)==null?void 0:z.data)==null?void 0:V.columns)||null,granularity:((U=(F=i.data)==null?void 0:F.data)==null?void 0:U.granularity)||null,type:((Z=(j=i.data)==null?void 0:j.data)==null?void 0:Z.type)||((X=i.data)==null?void 0:X.type)||null,groupby:((se=(Q=i.data)==null?void 0:Q.data)==null?void 0:se.groupby)||null}),s=async()=>{try{await vr.put(`/bi-dashboard/${n.value}/${i.widgetName}`,{data:o.value});let ne=`/bi-data?dashboard=${n.value}&widget=${i.widgetName}`;Object.entries(o.value).forEach(([de,_e])=>{ne+=`&${de}=${_e}`});const ue=new CustomEvent(`update-data-${i.widgetName}`);ue.filterUrl=ne,window.dispatchEvent(ue),await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}},l=async()=>{try{let ne=`/bi-data?dashboard=${n.value}&widget=${i.widgetName}`;Object.entries(o.value).forEach(([de,_e])=>{ne+=`&${de}=${_e}`});const ue=new CustomEvent(`update-data-${i.widgetName}`);ue.filterUrl=ne,window.dispatchEvent(ue)}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.watch(o,(ne,ue)=>{var Ie,Ce;const de=(Ie=Object.entries(ne))==null?void 0:Ie.reduce((Oe,[Ue,He])=>He?Oe+He:Oe),_e=(Ce=Object.entries(ue))==null?void 0:Ce.reduce((Oe,[Ue,He])=>He?Oe+He:Oe);de!==_e&&l()},{deep:!0}),N.onMounted(()=>{const ne=new URLSearchParams(window.top.location.search);n.value=ne.get("dashboard")}),(ne,ue)=>{const de=N.resolveComponent("VsButton"),_e=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",Ice,[N.createVNode(de,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:s},{default:N.withCtx(()=>ue[1]||(ue[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(_e,{scheme:a,modelValue:o.value,"onUpdate:modelValue":ue[0]||(ue[0]=Ie=>o.value=Ie)},null,8,["modelValue"])])}}},Ece={class:"pt-[10px]"},kce={__name:"vs-editor-form-yaml",props:{yamlValue:{type:null,default:()=>""},widgetName:{type:String},data:{type:Object}},setup(r){const e=N.ref(null),{$notify:t}=N.getCurrentInstance().proxy,i=r,n=(l,{dimensions:h,source:f})=>{const d=l.getOption(),{data:v,...m}=(d==null?void 0:d.series)[0],[,..._]=h||[],b=_.map((S,D)=>({...(d==null?void 0:d.series[D])||{},data:f.map(E=>E[D+1]),name:S}));l==null||l.setOption({...d||{},dataset:{dimensions:h,source:f},series:b,xAxis:{type:"category"},yAxis:{}},!0)},a=l=>{const h=document.getElementById(l);if(!h)return null;const f=sS(h);return f||null},o=N.ref(i.yamlValue),s=async()=>{try{await vr.put(`/bi-dashboard/${e.value}/${i.widgetName}`,{yml:o.value});const l=a(i.widgetName);if(l){const{data:h}=await vr.get(`/bi-data?dashboard=${e.value}&widget=${i.widgetName}`);n(l,h)}await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const l=new URLSearchParams(window.top.location.search);e.value=l.get("dashboard")}),(l,h)=>{const f=N.resolveComponent("VsButton"),d=N.resolveComponent("VsFormAce");return N.openBlock(),N.createElementBlock("div",Ece,[N.createVNode(f,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:s},{default:N.withCtx(()=>h[1]||(h[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(d,{modelValue:o.value,"onUpdate:modelValue":h[0]||(h[0]=v=>o.value=v),value:o.value,fontSize:"12px"},null,8,["modelValue","value"])])}}},Pce={class:"pt-[10px]"},hF={"vs-editor-form-style":Ace,"vs-editor-form-data":Mce,"vs-editor-form-yaml":kce,"vs-editor-form-controls":{__name:"vs-editor-form-controls",props:{widgetName:{type:String},controls:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(r,{emit:e}){var h;const{$notify:t}=N.getCurrentInstance().proxy,i=e,n=r,a=N.ref(null),o={granularity:{ua:"Granularity",type:"checkbox",options:["week","month","quarter","year"]},export:{ua:"Export",type:"Switcher"},groupby:{ua:"Groupby",type:"checkbox",options:(h=n.columns)==null?void 0:h.map(({name:f})=>f)}},s=N.ref(n.controls||{}),l=async()=>{try{await vr.put(`/bi-dashboard/${a.value}/${n.widgetName}`,{controls:s.value}),await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"}),staticTypes!=null&&staticTypes.includes(s.value.type)&&i("update-dashboard")}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const f=new URLSearchParams(window.top.location.search);a.value=f.get("dashboard")}),(f,d)=>{const v=N.resolveComponent("VsButton"),m=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",Pce,[N.createVNode(v,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:l},{default:N.withCtx(()=>d[1]||(d[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(m,{scheme:o,modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=_=>s.value=_)},null,8,["modelValue"])])}}}},Lce={class:"h-full flex flex-col bg-white shrink-0 !w-[400px] border-l"},Rce={key:0},zce={class:"border-b flex items-center px-[10px] h-[49px] border-transparent border-solid border-b-gray-200"},Nce={class:"flex gap-2 ml-auto"},Oce={class:"h-[calc(100vh-110px)] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},Bce={key:0},Vce={key:1},Fce={class:"p-4"},$ce={class:"flex justify-end mt-4 gap-x-3"},Gce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Uce={__name:"vs-editor-forms",props:N.mergeModels({selectedWidgetData:{type:Object,required:!1,default:null},selectedDashboard:{type:String,default:()=>""},currentWidgetData:{type:String,default:()=>""}},{selectedWidget:{},selectedWidgetModifiers:{}}),emits:N.mergeModels(["update-data"],["update:selectedWidget"]),setup(r,{emit:e}){var D,E;const t=(E=(D=N.getCurrentInstance())==null?void 0:D.proxy)==null?void 0:E.$notify,i=e,n=r,a=N.ref(!1),o=N.ref(!0),s=N.ref(!1),l=N.ref({}),h=N.useModel(r,"selectedWidget"),f=["table","text","number","stat","progress","listbar","map","pivot"],d=N.ref("data"),v=async()=>{try{await vr.delete(`/bi-dashboard/${n.selectedDashboard}/${n.selectedWidgetData.name}`);const P=new URL(window.top.location.href);P.searchParams.set("dashboard",n.selectedDashboard),P.searchParams.delete("widget"),window.top.history.pushState({},"",P),i("update-data"),a.value=!1,t({type:"success",title:"Успішно!",message:"Віджет успішно видалено"})}catch(P){console.error(P),t({type:"error",title:"Помилка!",message:"При спробі видалити віджет виникла помилка"})}},m=N.computed(()=>{const P=[{id:"data",label:"Дані"},{id:"style",label:"Стилі"},{id:"yaml",label:"{ }"},{id:"controls",label:"Контролси"}];return P==null?void 0:P.filter(z=>{var V,F,U;return z.id==="style"?!(f!=null&&f.includes(((V=n.selectedWidgetData)==null?void 0:V.type)||((U=(F=n.selectedWidgetData)==null?void 0:F.data)==null?void 0:U.type))):!0})}),_=()=>{var P,z,V;l.value={title:(P=n.selectedWidgetData)==null?void 0:P.title,type:(z=n.selectedWidgetData)==null?void 0:z.type,table:(V=n.selectedWidgetData)==null?void 0:V.table_name},s.value=!0},b=async()=>{try{await vr.put(`/bi-dashboard/${n.selectedDashboard}/${n.selectedWidgetData.name}`,l.value),t({type:"success",title:"Успішно!",message:"Дані успішно змінено"}),await i("update-data"),s.value=!1}catch{t({type:"error",title:"Помилка!",message:"При спробі внести зміни виникла помилка"})}};N.watch(h,P=>{o.value=!1;const z=new URL(window.top.location.href);P?(z.searchParams.set("widget",P),window.top.history.pushState({},"",z)):(z.searchParams.delete("widget"),window.top.history.pushState({},"",z)),setTimeout(()=>o.value=!0)});const S={title:{type:"text",ua:"Заголовок",placeholder:"Заголовок",validators:["required"]},type:{type:"radio",view:"buttons",validators:["required"],slots:{label:'<div style="width: 120px; height:160px" class="flex gap-[12px] flex-col"><img class="block" style="height: calc(100% - 40px)" :src="`https://cdn.softpro.ua/data/icons/bi/${id}.png`"/><span class="font-[500]">{{ label }}</span></div>'},options:[{label:"Bar",id:"bar"},{label:"Funnel",id:"funnel"},{label:"Line",id:"line"},{label:"List bar",id:"listbar"},{label:"Number",id:"number"},{label:"Pie",id:"pie"},{label:"Donut",id:"donut"},{label:"Pivot",id:"pivot"},{label:"Table",id:"table"},{label:"Progress",id:"progress"},{label:"Stat",id:"stat"},{label:"Text",id:"text"},{label:"Map",id:"map"}]},table:{type:"text",ua:"Таблиця",placeholder:"Таблиця"}};return(P,z)=>{var X,Q,se,ne,ue,de,_e,Ie;const V=N.resolveComponent("VsFormRadio"),F=N.resolveComponent("VsPopover"),U=N.resolveComponent("VsConfirm"),j=N.resolveComponent("VsForm"),Z=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",Lce,[r.selectedWidgetData?(N.openBlock(),N.createElementBlock("div",Rce,[N.createElementVNode("div",zce,[o.value?(N.openBlock(),N.createBlock(V,{key:0,options:m.value,modelValue:d.value,"onUpdate:modelValue":z[0]||(z[0]=Ce=>d.value=Ce),view:"buttons"},null,8,["options","modelValue"])):(N.openBlock(),N.createBlock(V,{key:1,options:m.value,modelValue:d.value,"onUpdate:modelValue":z[1]||(z[1]=Ce=>d.value=Ce),view:"buttons"},null,8,["options","modelValue"])),N.createElementVNode("div",Nce,[N.createVNode(F,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{onClick:_,class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200"},[N.createVNode(cF,{class:"h-[16px]"})])]),default:N.withCtx(()=>[z[10]||(z[10]=N.createTextVNode(" Редагувати віджет "))]),_:1}),N.createVNode(F,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:z[2]||(z[2]=Ce=>a.value=!0)},[N.createVNode(N.unref(uF),{class:"h-[16px]"})])]),default:N.withCtx(()=>[z[11]||(z[11]=N.createTextVNode(" Видалити віджет "))]),_:1})])]),N.createElementVNode("div",Oce,[o.value&&r.currentWidgetData?(N.openBlock(),N.createElementBlock("div",Bce,[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(N.unref(hF)["vs-editor-form-"+d.value]),{widgetName:(X=r.selectedWidgetData)==null?void 0:X.name,yamlValue:((Q=r.selectedWidgetData)==null?void 0:Q.yml)||"",data:r.selectedWidgetData,controls:(se=r.selectedWidgetData)==null?void 0:se.controls,columns:(ne=r.currentWidgetData)==null?void 0:ne.columns,onUpdateDashboard:z[3]||(z[3]=Ce=>P.$emit("update-dashboard"))},null,40,["widgetName","yamlValue","data","controls","columns"]))])):(N.openBlock(),N.createElementBlock("div",Vce,[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(N.unref(hF)["vs-editor-form-"+d.value]),{widgetName:(ue=r.selectedWidgetData)==null?void 0:ue.name,yamlValue:((de=r.selectedWidgetData)==null?void 0:de.yml)||"",data:r.selectedWidgetData,controls:(_e=r.selectedWidgetData)==null?void 0:_e.controls,columns:(Ie=r.currentWidgetData)==null?void 0:Ie.columns,onUpdateDashboard:z[4]||(z[4]=Ce=>P.$emit("update-dashboard"))},null,40,["widgetName","yamlValue","data","controls","columns"]))])),N.createVNode(U,{visible:a.value,"onUpdate:visible":z[6]||(z[6]=Ce=>a.value=Ce),title:"Ви впевнені?"},{default:N.withCtx(()=>[N.createElementVNode("div",Fce,[z[12]||(z[12]=N.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей віджет? ",-1)),N.createElementVNode("div",$ce,[N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:z[5]||(z[5]=Ce=>a.value=!1)}," Скасувати "),N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:v}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"])])])):(N.openBlock(),N.createBlock(ZC,{key:1,title:"Оберіть один з віджетів",text:""}))]),N.createVNode(Z,{visible:s.value,"onUpdate:visible":z[9]||(z[9]=Ce=>s.value=Ce),title:"Редагувати віджет"},{footer:N.withCtx(()=>[N.createElementVNode("div",Gce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:z[8]||(z[8]=Ce=>s.value=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:b,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(j,{scheme:S,modelValue:l.value,"onUpdate:modelValue":z[7]||(z[7]=Ce=>l.value=Ce)},null,8,["modelValue"])]),_:1},8,["visible"])],64)}}},Hce={},Wce={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-plus"};function jce(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",Wce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M12 5l0 14"},null,-1),N.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const Zce=hr(Hce,[["render",jce]]),qce={class:"mb-4 overflow-auto scrollbar max-h-96"},Xce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Yce={__name:"vs-editor-create-widget",props:{columns:{type:Array,default:()=>[]},selectedDashboard:String},emits:"update-data",setup(r,{emit:e}){var f;const t=(f=N.getCurrentInstance().proxy)==null?void 0:f.$notify,i=e,n=r,a=N.ref(!1),o=N.ref({}),s=N.ref(),l=async()=>{try{await s.value.doValidation(),await vr.post(`/bi-dashboard/${n.selectedDashboard}`,o.value),await t({type:"success",title:"Успішно!",message:"Віджет успішно створено"}),await i("update-data"),o.value={},a.value=!1}catch{t({type:"error",title:"Помилка!",message:"При спробі створити віджет сталася помилка"})}},h=N.computed(()=>{var d,v,m,_;return{title:{type:"text",label:"Widget title",placeholder:"Widget title",validators:["required"]},x:{type:"radio",label:"X Axis",view:"buttons",style:{size:"xs"},validators:["required"],options:(v=(d=n.columns)==null?void 0:d.filter(b=>(b==null?void 0:b.type)=="text"||(b==null?void 0:b.type)==="date"||(b==null?void 0:b.type)==="timestamp without time zone"||(b==null?void 0:b.type)==="boolean"||(b==null?void 0:b.type)==="integer"))==null?void 0:v.map(({name:b,type:S})=>({id:b,label:b,type:S}))},metric:{type:"radio",label:"Y Axis",view:"buttons",validators:["required"],style:{size:"xs"},options:[{id:"count",label:"count"},...(_=(m=n.columns)==null?void 0:m.filter(b=>(b==null?void 0:b.type)==="numeric"||(b==null?void 0:b.type)==="double precision"))==null?void 0:_.map(({name:b,type:S})=>({id:b,label:b,type:S}))]},col:{type:"radio",label:"Columns count",validators:["required"],options:[{id:1,label:1},{id:2,label:2},{id:3,label:3},{id:4,label:4},{id:6,label:6},{id:9,label:9},{id:12,label:12}]},type:{type:"radio",view:"buttons",validators:["required"],slots:{label:'<div style="width: 120px; height:160px" class="flex gap-[12px] flex-col"><img class="block" style="height: calc(100% - 40px)" :src="`https://cdn.softpro.ua/data/icons/bi/${id}.png`"/><span class="font-[500]">{{ label }}</span></div>'},options:[{label:"Bar",id:"bar"},{label:"Funnel",id:"funnel"},{label:"Line",id:"line"},{label:"List bar",id:"listbar"},{label:"Number",id:"number"},{label:"Pie",id:"pie"},{label:"Donut",id:"donut"},{label:"Pivot",id:"pivot"},{label:"Table",id:"table"},{label:"Progress",id:"progress"},{label:"Stat",id:"stat"},{label:"Text",id:"text"},{label:"Map",id:"map"}]}}});return(d,v)=>{const m=N.resolveComponent("VsPopover"),_=N.resolveComponent("VsForm"),b=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock("div",null,[N.createVNode(m,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("div",null,[N.createElementVNode("button",{class:"z-50 flex items-center justify-center h-[50px] !w-[50px] text-2xl text-white transition-colors bg-blue-500 rounded-full cursor-pointer hover:bg-blue-700",onClick:v[0]||(v[0]=S=>a.value=!0)},[N.createVNode(Zce,{height:"20",width:"20"})])])]),default:N.withCtx(()=>[v[4]||(v[4]=N.createTextVNode(" Створити віджет "))]),_:1}),N.createVNode(b,{visible:a.value,"onUpdate:visible":v[3]||(v[3]=S=>a.value=S),title:"Створити віджет"},{footer:N.withCtx(()=>[N.createElementVNode("div",Xce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:v[2]||(v[2]=S=>a.value=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Створити ")])]),default:N.withCtx(()=>[N.createElementVNode("div",qce,[N.createVNode(_,{ref_key:"form",ref:s,scheme:h.value,modelValue:o.value,"onUpdate:modelValue":v[1]||(v[1]=S=>o.value=S)},null,8,["scheme","modelValue"])])]),_:1},8,["visible"])])}}},Kce={},Jce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-box-left-stretch"};function Qce(r,e){return N.openBlock(),N.createElementBlock("svg",Jce,e[0]||(e[0]=[N.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"></path><path d="M9 17h-2"></path><path d="M13 12h-6"></path><path d="M11 7h-4"></path>',5)]))}const ehe=hr(Kce,[["render",Qce]]),the={},rhe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-filter"};function ihe(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",rhe,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const nhe={components:{deleteIcon:uF,editIcon:cF,IconGrid:ehe,IconFilter:hr(the,[["render",ihe]])},watch:{dashboardData(r){var t,i;if(this.formEditValue={title:r==null?void 0:r.title,description:r==null?void 0:r.description,table_name:r==null?void 0:r.table_name,db:r==null?void 0:r.db,public:r==null?void 0:r.public,words:r==null?void 0:r.words},!((t=r==null?void 0:r.panels)!=null&&t.length))return[];const e=(i=r==null?void 0:r.panels)==null?void 0:i.map(n=>{var s,l;const{title:a="",type:o=""}=((l=(s=r==null?void 0:r.widgets)==null?void 0:s.find(h=>(h==null?void 0:h.name)===(n==null?void 0:n.widget)))==null?void 0:l.data)||{};return{title:a,type:o,...n}});this.formGridValue={panels:e},this.formFilterValue={filters:(r==null?void 0:r.filters)||null}}},data(){return{isDeleteConfirm:!1,isFormEdit:!1,isFormGrid:!1,isFormFilter:!1,formEditValue:{},formGridValue:{},formFilterValue:{},editDashboardScheme:[{type:"Text",key:"title",label:"Заголовок",validators:["required"]},{type:"Text",key:"description",label:"Опис"},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці"},{type:"Text",key:"words",label:"Ключові слова"},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],editGridScheme:[{type:"DataTable",ua:"Панелі",key:"panels",editable:!1,addition:!1,colModel:[{name:"title",ua:"Назва",type:"Text",key:"col"},{name:"type",ua:"Тип",type:"Text",key:"col",disabled:!0},{name:"widget",type:"Text",ua:"Назва",key:"widget",hiddenCol:!0},{name:"col",ua:"Кількість стовпчиків",type:"Text",key:"col"}]}],editFilterScheme:[{name:"filters",type:"DataTable",colModel:[{ua:"Підпис",type:"Text",key:"label"},{ua:"Тип",type:"Text",key:"type"}]}]}},props:{selected:{type:String,default:()=>""},dashboardData:{type:Object,default:()=>{}},selectedWidgetData:{type:Object,default:()=>{}}},methods:{async editDashboard(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formEdit)==null||e.doValidation(),await vr.put(`/bi-dashboard/${this.selected}`,this.formEditValue),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormEdit=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"при спробі оновити дані виникла помилка"})}},async editDashboardGrid(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formGrid)==null||e.doValidation(),await vr.put(`/bi-dashboard/${this.selected}`,{...this.formEditValue,...this.formGridValue}),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormGrid=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі оновити дані виникла помилка"})}},async editDashboardFilters(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formFilter)==null||e.doValidation(),await vr.put(`/bi-dashboard/${this.selected}`,{...this.formEditValue,...this.formGridValue,...this.formFilterValue}),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormFilter=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі оновити дані виникла помилка"})}},async deleteDashboard(){try{await vr.delete(`/bi-dashboard/${this.selected}`);const r=new URL(window.top.location.href);r.searchParams.delete("dashboard"),r.searchParams.delete("widget"),window.history.pushState({},"",r),await this.$notify({title:"Успішно!",type:"success",message:"Дашборд видалено успішно"}),this.isDeleteConfirm=!1,await this.$emit("update:selected",null),await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі видалити дашборд виникла помилка"})}}}},ahe={class:"bg-white h-[49px] min-h-[49px] mb-[8px] flex justify-between px-[10px] py-[15px] items-center border-b border-b-solid border-b-gray-200"},ohe={class:"flex items-center gap-2 text-center truncate grow lg:text-start"},she={class:"block text-sm font-semibold leading-4 text-gray-800 truncate"},lhe={class:"text-[12px] text-gray-500"},uhe={key:0,class:"flex"},che={class:"pr-[5px] flex items-center gap-[8px] mr-[5px] flex"},hhe={class:"p-4"},fhe={class:"flex justify-end mt-4 gap-x-3"},dhe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},phe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},vhe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function ghe(r,e,t,i,n,a){var _,b,S,D,E;const o=N.resolveComponent("IconFilter"),s=N.resolveComponent("VsPopover"),l=N.resolveComponent("IconGrid"),h=N.resolveComponent("editIcon"),f=N.resolveComponent("deleteIcon"),d=N.resolveComponent("VsConfirm"),v=N.resolveComponent("VsForm"),m=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",ahe,[N.createElementVNode("div",null,[N.createElementVNode("div",ohe,[N.createElementVNode("span",she,N.toDisplayString((_=t.dashboardData)==null?void 0:_.title)+" "+N.toDisplayString((b=t.selectedWidgetData)!=null&&b.title?` / ${(S=t.selectedWidgetData)==null?void 0:S.title}`:""),1),N.createElementVNode("span",lhe,N.toDisplayString((D=t.selectedWidgetData)!=null&&D.table_name?`${(E=t.selectedWidgetData)==null?void 0:E.table_name}`:""),1)])]),t.selected?(N.openBlock(),N.createElementBlock("div",uhe,[N.createElementVNode("div",che,[N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[0]||(e[0]=P=>n.isFormFilter=!0)},[N.createVNode(o,{class:"h-[16px] text-gray-500"})])]),default:N.withCtx(()=>[e[19]||(e[19]=N.createTextVNode(" Редагувати фільтри "))]),_:1}),N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[1]||(e[1]=P=>n.isFormGrid=!0)},[N.createVNode(l,{class:"h-[16px] text-gray-500"})])]),default:N.withCtx(()=>[e[20]||(e[20]=N.createTextVNode(" Редагувати структуру дашборду "))]),_:1}),N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[2]||(e[2]=P=>n.isFormEdit=!0)},[N.createVNode(h,{class:"h-[16px]"})])]),default:N.withCtx(()=>[e[21]||(e[21]=N.createTextVNode(" Редагувати дашборд "))]),_:1}),N.createVNode(s,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{onClick:e[3]||(e[3]=P=>n.isDeleteConfirm=!0),class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200"},[N.createVNode(f,{class:"h-[16px]"})])]),default:N.withCtx(()=>[e[22]||(e[22]=N.createTextVNode(" Видалити дашборд "))]),_:1})])])):N.createCommentVNode("",!0)]),N.createVNode(d,{visible:n.isDeleteConfirm,"onUpdate:visible":e[6]||(e[6]=P=>n.isDeleteConfirm=P),size:"small",title:"Ви впевнені?"},{default:N.withCtx(()=>[N.createElementVNode("div",hhe,[e[23]||(e[23]=N.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей дашборд? ",-1)),N.createElementVNode("div",fhe,[N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=P=>n.isDeleteConfirm=!1)}," Скасувати "),N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[5]||(e[5]=(...P)=>a.deleteDashboard&&a.deleteDashboard(...P))}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormEdit,"onUpdate:visible":e[10]||(e[10]=P=>n.isFormEdit=P),title:"Редагувати дашборд"},{footer:N.withCtx(()=>[N.createElementVNode("div",dhe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=P=>n.isFormEdit=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[9]||(e[9]=(...P)=>a.editDashboard&&a.editDashboard(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formEdit",scheme:n.editDashboardScheme,modelValue:n.formEditValue,"onUpdate:modelValue":e[7]||(e[7]=P=>n.formEditValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormGrid,"onUpdate:visible":e[14]||(e[14]=P=>n.isFormGrid=P),title:"Редагувати структуру дашборду"},{footer:N.withCtx(()=>[N.createElementVNode("div",phe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[12]||(e[12]=P=>n.isFormGrid=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[13]||(e[13]=(...P)=>a.editDashboardGrid&&a.editDashboardGrid(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formgrid",scheme:n.editGridScheme,modelValue:n.formGridValue,"onUpdate:modelValue":e[11]||(e[11]=P=>n.formGridValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormFilter,"onUpdate:visible":e[18]||(e[18]=P=>n.isFormFilter=P),title:"Редагувати фільтри"},{footer:N.withCtx(()=>[N.createElementVNode("div",vhe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[16]||(e[16]=P=>n.isFormFilter=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[17]||(e[17]=(...P)=>a.editDashboardFilters&&a.editDashboardFilters(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formFilter",scheme:n.editFilterScheme,modelValue:n.formFilterValue,"onUpdate:modelValue":e[15]||(e[15]=P=>n.formFilterValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const mhe=hr(nhe,[["render",ghe]]),yhe={class:"relative flex-grow h-full"},_he={class:"grid flex-grow w-full grid-cols-12 gap-4 p-[10px] h-[calc(100%-120px)] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},xhe=hr({__name:"vs-editor",props:{prefix:String,customClass:{type:String,default:()=>"w-screen h-screen"}},setup(r){const e=r;vr.defaults.baseURL=e.prefix||"/api";const t=N.ref(""),i=N.ref(""),n=N.ref(null),a=N.ref(null),o=async()=>{if(!t.value){n.value=null;return}try{const{data:l}=await vr.get(`/bi-dashboard/${t.value}`);n.value=l}catch(l){console.error(l)}},s=N.computed(()=>{var l,h,f;return(f=Array.isArray((l=n.value)==null?void 0:l.widgets)?(h=n.value)==null?void 0:h.widgets:[])==null?void 0:f.find(d=>(d==null?void 0:d.name)===i.value)});return N.watch(t,(l,h)=>{var d,v,m;h&&(i.value="");const f=new URL(window.top.location.href);l?((d=f==null?void 0:f.searchParams)==null||d.set("dashboard",l),(m=(v=window.top)==null?void 0:v.history)==null||m.pushState({},"",f),o()):(f==null||f.searchParams.delete("dashboard"),f==null||f.searchParams.delete("widget"))}),N.onMounted(()=>{const l=new URLSearchParams(window.top.location.search);t.value=l.get("dashboard"),i.value=l.get("widget"),o()}),(l,h)=>{var f;return N.openBlock(),N.createElementBlock("div",{class:N.normalizeClass(["flex w-full h-full",[r.customClass]])},[N.createVNode(vce,{ref:"MenuNativeRouting",prefix:r.prefix,selectedDashboard:t.value,"onUpdate:selectedDashboard":h[0]||(h[0]=d=>t.value=d)},null,8,["prefix","selectedDashboard"]),N.createElementVNode("div",yhe,[N.createVNode(mhe,{selected:t.value,"onUpdate:selected":h[1]||(h[1]=d=>t.value=d),dashboardData:n.value,selectedWidgetData:s.value,prefix:r.prefix,onUpdateEditor:h[2]||(h[2]=()=>{var d;o(),(d=l.$refs.MenuNativeRouting)==null||d.getList()})},null,8,["selected","dashboardData","selectedWidgetData","prefix"]),N.createElementVNode("div",_he,[n.value?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:1},N.renderList(n.value.panels,(d,v)=>{var m;return N.openBlock(),N.createElementBlock("div",{key:v,class:N.normalizeClass([`col-span-${d.col||12}`,"flex flex-col gap-[10px]"])},[(m=d.widgets)!=null&&m.length?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:0},N.renderList(d.widgets,_=>(N.openBlock(),N.createBlock(qv,{onClick:b=>i.value=_,"onUpdate:currentWidgetData":h[3]||(h[3]=b=>a.value=b),key:_,dashboard:t.value,widget:_,selectedWidget:i.value,"dashboard-widgets":n.value.widgets,class:N.normalizeClass({"border border-blue-500":i.value===_})},null,8,["onClick","dashboard","widget","selectedWidget","dashboard-widgets","class"]))),128)):(N.openBlock(),N.createBlock(qv,{key:1,onClick:_=>i.value=d.widget,"onUpdate:currentWidgetData":h[4]||(h[4]=_=>a.value=_),class:N.normalizeClass(["max-h-[460px] flex flex-col",{"border border-blue-500":i.value===d.widget}]),dashboard:t.value,widget:d.widget,selectedWidget:i.value,"dashboard-widgets":n.value.widgets},null,8,["onClick","class","dashboard","widget","selectedWidget","dashboard-widgets"]))],2)}),128)):(N.openBlock(),N.createBlock(ZC,{key:0,class:"col-span-12"}))]),t.value?(N.openBlock(),N.createBlock(Yce,{key:0,class:"bottom-[10px] left-[10px] absolute",columns:(f=n.value)==null?void 0:f.columns,selectedDashboard:t.value,onUpdateData:o},null,8,["columns","selectedDashboard"])):N.createCommentVNode("",!0)]),N.createVNode(Uce,{selectedWidget:i.value,"onUpdate:selectedWidget":h[5]||(h[5]=d=>i.value=d),selectedWidgetData:s.value,currentWidgetData:a.value,selectedDashboard:t.value,onUpdateData:o},null,8,["selectedWidget","selectedWidgetData","currentWidgetData","selectedDashboard"])],2)}}},[["__scopeId","data-v-4dda1ae7"]]),fF={install:r=>{r.component("VsBar",$C),r.component("VsLine",UC),r.component("VsPie",GC),r.component("VsStat",HC),r.component("VsDashboard",lF),r.component("VsWidget",qv),r.component("VsProgressBar",WC),r.component("VsListBar",O0),r.component("VsPivotTable",qC),r.component("VsEditor",xhe)},components:{VsBar:$C,VsLine:UC,VsPie:GC,VsStat:HC,VsDashboard:lF,VsProgressBar:WC,VsListBar:O0,VsPivotTable:qC,VsWidget:qv}};typeof window<"u"&&(window.v3bi=fF);const bhe={name:"VsNumber",mixins:[da],data(){return{number:""}},computed:{formattedNumber(){return _6(this.number)},prefix(){var r,e;return(r=this.styleData)!=null&&r.prefix?(e=this.styleData)==null?void 0:e.prefix:""}},watch:{sourceData:{async handler(){this.getNumber()},deep:!0}},async mounted(){await this.getData(),this.getNumber()},methods:{onChangedData(){try{this.sourceData&&this.getNumber()}catch(r){console.error(r)}},async getNumber(){var r,e;try{this.number=((e=this.sourceData[0])==null?void 0:e[Object.keys((r=this.sourceData)==null?void 0:r[0])])||0}catch(t){console.error(t)}}}},whe={class:"text-lg lg:text-xl xl:text-2xl text-gray-800 h-[32px] flex items-center"};function She(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",whe,N.toDisplayString(a.prefix)+N.toDisplayString(a.formattedNumber),1)}const The=Object.freeze(Object.defineProperty({__proto__:null,default:hr(bhe,[["render",She]])},Symbol.toStringTag,{value:"Module"}));function XC(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let nh=XC();function dF(r){nh=r}const pF=/[&<>"']/,Che=new RegExp(pF.source,"g"),vF=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Dhe=new RegExp(vF.source,"g"),Ahe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},gF=r=>Ahe[r];function Ea(r,e){if(e){if(pF.test(r))return r.replace(Che,gF)}else if(vF.test(r))return r.replace(Dhe,gF);return r}const Ihe=/(^|[^\[])\^/g;function ii(r,e){let t=typeof r=="string"?r:r.source;e=e||"";const i={replace:(n,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(Ihe,"$1"),t=t.replace(n,o),i},getRegex:()=>new RegExp(t,e)};return i}function mF(r){try{r=encodeURI(r).replace(/%25/g,"%")}catch{return null}return r}const Xv={exec:()=>null};function yF(r,e){const t=r.replace(/\|/g,(a,o,s)=>{let l=!1,h=o;for(;--h>=0&&s[h]==="\\";)l=!l;return l?"|":" |"}),i=t.split(/ \|/);let n=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function Yv(r,e,t){const i=r.length;if(i===0)return"";let n=0;for(;n<i&&r.charAt(i-n-1)===e;)n++;return r.slice(0,i-n)}function Mhe(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<r.length;i++)if(r[i]==="\\")i++;else if(r[i]===e[0])t++;else if(r[i]===e[1]&&(t--,t<0))return i;return-1}function _F(r,e,t,i){const n=e.href,a=e.title?Ea(e.title):null,o=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){i.state.inLink=!0;const s={type:"link",raw:t,href:n,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,s}return{type:"image",raw:t,href:n,title:a,text:Ea(o)}}function Ehe(r,e){const t=r.match(/^(\s+)(?:```)/);if(t===null)return e;const i=t[1];return e.split(`
100
+ </div>`},prepareData(){var r,e,t;try{const i=Array.from(new Set(this.sourceData.map(d=>d[this.dimensions[0]]))),n=Array.from(new Set(this.sourceData.map(d=>d[this.dimensions[1]]))),a=parseInt(this.sourceData.reduce((d,v)=>d+parseFloat(v==null?void 0:v.metric),0),10),o=i.map((d,v)=>{const m=(n[v]/a*100).toFixed(2);return{name:`${d} (${m}%)`,value:n[v]}}),s=((r=this.styleData)==null?void 0:r.innerRadius)||"0%",l=((e=this.styleData)==null?void 0:e.outerRadius)||"100%",h=[s,l];return this.styleData.legend=N0.getLegendOpions({borderRadius:10,height:"100%",padding:10,type:"scroll",itemWidth:14,itemHeight:14,formatter:d=>d==null?void 0:d.replace("null","Не визначено"),textStyle:{fontSize:"14px"},...this.styleData.legend}),this.styleData.label=N0.getLabelOptions(this.styleData.label),this.styleData.show_legend=((t=this.styleData)==null?void 0:t.show_legend)||!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:h,center:["50%","60%"],height:"75%",...ih(this.styleData),data:o}]}}catch(i){return console.error(i),null}},async initChart(r){try{const e=this.$refs.chart;this.chartInstance=f_(e);const t={tooltip:{trigger:"item",formatter:i=>this.buildTooltipForDonut(i,[i.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:r,...ih({...this.styleData})};this.chartInstance.setOption(t),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{this.chartInstance.resize()})}catch(e){console.error(e)}}}},Vse=["id"];function Fse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:a.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,Vse)}const GC=hr(Bse,[["render",Fse]]),$se=Object.freeze(Object.defineProperty({__proto__:null,default:GC},Symbol.toStringTag,{value:"Module"})),Gse={name:"VsLine",mixins:[da],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:r,xs:e}=this.prepareData();r&&this.initChart(r,e)},methods:{onChangedData(){try{if(this.sourceData){const{series:r,xs:e,ys:t}=this.prepareData();r&&(this==null||this.initChart(r,e,t))}}catch(r){console.error(r)}},prepareData(){var r,e;try{const t=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[0]])));let i;this.dimensions[0].includes("date")?i=t.map(o=>Xo(o)):i=[...t];const n=this.sourceData.map(o=>parseFloat(o[this.dimensions[1]]));let a;return(r=this.styleData)!=null&&r.stack?a=this.dimensions.slice(1).map(s=>({name:s,type:"line",stack:"a",areaStyle:this.styleData.area?{}:null,data:this.sourceData.filter(l=>parseFloat(l[s])).map(l=>parseFloat(l[s]))})):a=[{name:this.title,type:"line",areaStyle:(e=this.styleData)!=null&&e.area?{}:null,data:n,stack:"a"}],{series:a,xs:i}}catch(t){return console.error(t),null}}}},Use=["id"];function Hse(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",{id:n.uniqueID,ref:"chart",style:{height:"400px"}},null,8,Use)}const UC=hr(Gse,[["render",Hse]]),Wse=Object.freeze(Object.defineProperty({__proto__:null,default:UC},Symbol.toStringTag,{value:"Module"})),jse={name:"VsStat",mixins:[da],data(){return{restDimensions:[],sumValue:0,columns:null,showTooltip:-1}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){this.columns=Object.keys(this.sourceData[0]);const r=this.getValues();this.sumValue=r.reduce((e,t)=>e+t,0),this.sourceData.forEach((e,t)=>{e.color=t<sF.length-1?sF[t]:Lse()})},formattedValue(r){const e=parseFloat(r);return mi(e)}}},Zse={class:"flex flex-col w-full h-full pt-[16px] rounded-xl"},qse={class:"flex flex-col justify-between w-full h-full"},Xse={class:"w-full h-full pb-6 space-y-4"},Yse={class:"flex w-full h-3 rounded-full gap-x-1 min-h-3 custom-x-scrollbar"},Kse=["onMouseover"],Jse={key:0,class:"absolute top-[-1] left-1/2 transform -translate-x-1/2 -translate-y-full bg-black text-white rounded px-2 py-1"},Qse={class:"h-[calc(100%-20px)] w-full custom-scrollbar"},ele={class:"grid items-center justify-between grid-cols-2 py-2 gap-x-4"},tle={class:"flex items-center"},rle={class:"text-sm text-gray-800"},ile={class:"text-end"},nle={class:"text-sm text-gray-500"};function ale(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Zse,[N.createElementVNode("div",qse,[N.createElementVNode("div",Xse,[N.createElementVNode("div",Yse,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>{var l,h,f,d;return N.openBlock(),N.createElementBlock("div",{class:N.normalizeClass(["flex flex-col min-w-[5px] justify-center min-h-2.5 h-2.5 text-xs text-white text-center whitespace-nowrap",`bg-[${o.color}]`]),style:N.normalizeStyle({width:`${parseFloat(o==null?void 0:o[(l=n.columns)==null?void 0:l[1]])/n.sumValue*100}%`}),role:"progressbar","aria-valuenow":"42","aria-valuemin":"0","aria-valuemax":"100",onMouseover:v=>n.showTooltip=s,onMouseleave:e[0]||(e[0]=v=>n.showTooltip=-1)},[n.showTooltip>-1?(N.openBlock(),N.createElementBlock("div",Jse,N.toDisplayString(r.sourceData[n.showTooltip][n.columns[0]])+" "+N.toDisplayString((parseFloat((d=(h=r.sourceData)==null?void 0:h[n.showTooltip])==null?void 0:d[(f=n.columns)==null?void 0:f[1]])/n.sumValue*100).toFixed(2))+"% ",1)):N.createCommentVNode("",!0)],46,Kse)}),256))]),N.createElementVNode("ul",Qse,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,o=>{var s,l;return N.openBlock(),N.createElementBlock("li",ele,[N.createElementVNode("div",tle,[N.createElementVNode("span",{class:N.normalizeClass(["shrink-0 size-2.5 inline-block rounded-sm me-2.5 min-w-[10px] w-[10px] h-[10px] min-h-[10px]",`bg-[${o.color}]`])},null,2),N.createElementVNode("span",rle,N.toDisplayString((o==null?void 0:o[(s=n.columns)==null?void 0:s[0]])||"Не визначено"),1)]),N.createElementVNode("div",ile,[N.createElementVNode("span",nle,N.toDisplayString(a.formattedValue(o==null?void 0:o[(l=n.columns)==null?void 0:l[1]])||"-"),1)])])}),256))])])])])}const HC=hr(jse,[["render",ale]]),ole=Object.freeze(Object.defineProperty({__proto__:null,default:HC},Symbol.toStringTag,{value:"Module"})),sle={name:"VsProgressBar",mixins:[da],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){var e;this.columns=Object.keys((e=this.sourceData)==null?void 0:e[0])||null;const r=this.getValues();this.maxValue=Math.max(...r)},formattedValue(r){return mi(r)}}},lle={key:0,class:"flex flex-col h-full pt-[16px] rounded-xl"},ule={class:"h-full pt-0 pb-6 space-y-4"},cle={class:"h-full space-y-4 custom-scrollbar"},hle={class:"flex items-center justify-between mr-2 gap-x-2"},fle={class:"grid items-center w-full grid-cols-2 gap-x-2"},dle={class:"text-sm text-gray-800"},ple={class:"flex justify-end",role:"progressbar","aria-valuenow":"100","aria-valuemin":"0","aria-valuemax":"100"},vle={class:"min-w-[60px] text-end"},gle={class:"text-sm text-gray-500"};function mle(r,e,t,i,n,a){return n.columns?(N.openBlock(),N.createElementBlock("div",lle,[N.createElementVNode("div",ule,[N.createElementVNode("ul",cle,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>(N.openBlock(),N.createElementBlock("li",hle,[N.createElementVNode("div",fle,[N.createElementVNode("span",dle,N.toDisplayString(o[n.columns[0]]),1),N.createElementVNode("div",ple,[N.createElementVNode("div",{class:"h-1.5 flex flex-col justify-center overflow-hidden bg-indigo-500 rounded-full text-xs text-white text-center whitespace-nowrap",style:N.normalizeStyle({width:`${parseFloat(o[n.columns[1]])/n.maxValue*100}%`})},null,4)])]),N.createElementVNode("div",vle,[N.createElementVNode("span",gle,N.toDisplayString(a.formattedValue(o[n.columns[1]])),1)])]))),256))])])])):N.createCommentVNode("",!0)}const WC=hr(sle,[["render",mle]]),yle=Object.freeze(Object.defineProperty({__proto__:null,default:WC},Symbol.toStringTag,{value:"Module"})),_le={name:"VsListbar",mixins:[da],props:["source"],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch(r){console.error(r)}},prepareData(){var e;this.columns=Object.keys(this.sourceData[0]);const r=this.sourceData.map(t=>{var i;return t[(i=this.columns)==null?void 0:i[1]]});this.maxValue=Math.max(...r),this.restDimensions=(e=this.columns)==null?void 0:e.filter((t,i)=>i!==0)},formattedValue(r){return mi(r)},getWidth(r){return`${r/this.maxValue*100}%`}}},xle={class:"h-full pt-[20px] list-bar"},ble={class:"space-y-2 custom-scrollbar h-[calc(100%-20px)]"},wle={class:"relative w-full truncate"},Sle={class:"relative z-[1] text-sm block py-1 px-2 w-full text-sm truncate text-gray-800"},Tle={class:"text-[14px] text-gray-500"};function Cle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",xle,[N.createElementVNode("ul",ble,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(r.sourceData,(o,s)=>{var l,h,f;return N.openBlock(),N.createElementBlock("li",{key:s,class:"flex items-center justify-between w-full gap-x-2"},[N.createElementVNode("div",wle,[N.createElementVNode("span",Sle,N.toDisplayString((o==null?void 0:o[(l=n.columns)==null?void 0:l[0]])||"Без категорії"),1),N.createElementVNode("div",{class:N.normalizeClass(["absolute inset-y-0 h-full rounded start-0",o!=null&&o[(h=n.columns)==null?void 0:h[0]]?"bg-indigo-100":"bg-gray-100"]),style:N.normalizeStyle({width:a.getWidth(o==null?void 0:o[(f=n.columns)==null?void 0:f[1]])})},null,6)]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.restDimensions,(d,v)=>(N.openBlock(),N.createElementBlock("div",{key:v,class:"w-20 mr-2 text-end"},[N.createElementVNode("span",Tle,N.toDisplayString(a.formattedValue(o==null?void 0:o[d])),1)]))),128))])}),128))])])}const O0=hr(_le,[["render",Cle]]),Dle=Object.freeze(Object.defineProperty({__proto__:null,default:O0},Symbol.toStringTag,{value:"Module"})),jC={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},Ale=["onClick"],Ile={class:"flex items-center justify-between w-full"},Mle={key:0},Ele={__name:"vs-bi-dropdown",props:{title:String,options:[Array,String],value:{type:String}},emits:["selected"],setup(r,{emit:e}){const t=r,i=e,n=N.ref(!1),a=N.ref(t.value||null),o=N.ref(null),s=N.computed(()=>typeof t.options=="string"?t.options.split(",").map((m,_)=>({id:_,text:m.trim()})):t.options),l=N.computed(()=>{const m=s.value.find(_=>(_.id||_)===a.value);return m?m.text||m:t.title}),h=m=>{a.value=m.id||m,n.value=!1,i("selected",(m==null?void 0:m.id)||m),document.removeEventListener("click",f)},f=m=>{o.value&&!o.value.contains(m.target)&&(n.value=!1,document.removeEventListener("click",f))},d=()=>{n.value=!n.value,n.value?setTimeout(()=>{document.addEventListener("click",f)},200):document.removeEventListener("click",f)},v=m=>(jC==null?void 0:jC[m])||m;return N.onUnmounted(()=>{document.removeEventListener("click",f)}),(m,_)=>(N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("button",{type:"button","aria-expanded":"true",class:"hs-select-disabled:pointer-events-none hs-select-disabled:opacity-50 relative group pr-2 -ms-2 py-1.5 pl-2.5 inline-flex shrink-0 justify-center items-center gap-x-1.5 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 before:absolute before:inset-0 before:z-[1] dark:text-neutral-400 dark:hover:bg-neutral-800 dark:focus:bg-neutral-700",onClick:d},[N.createTextVNode(N.toDisplayString(v(l.value))+" ",1),_[0]||(_[0]=N.createElementVNode("svg",{class:"shrink-0 size-3.5 text-gray-600 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),n.value?(N.openBlock(),N.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:o,"data-hs-select-dropdown":"",class:"absolute mt-2 z-50 w-48 p-1 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-950 opened",role:"listbox",tabindex:"-1","aria-orientation":"vertical",style:{"margin-top":"10px"}},[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(s.value,b=>(N.openBlock(),N.createElementBlock("div",{key:b.id||b,class:"cursor-pointer selected hs-selected:bg-gray-100 dark:hs-selected:bg-neutral-800 py-1.5 px-2 w-full text-[13px] text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:S=>h(b)},[N.createElementVNode("div",Ile,[N.createElementVNode("span",null,N.toDisplayString(v(b.text||b)),1),a.value===(b.id||b)?(N.openBlock(),N.createElementBlock("span",Mle,_[1]||(_[1]=[N.createElementVNode("svg",{class:"shrink-0 h-3.5 w-3.5 text-gray-800 dark:text-neutral-200",xmlns:"http:.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[N.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)]))):N.createCommentVNode("",!0)])],8,Ale))),128))],512)):N.createCommentVNode("",!0)],64))}},kle={"bi-bar":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Ose)),"bi-number":N.defineAsyncComponent(()=>Promise.resolve().then(()=>The)),"bi-text":N.defineAsyncComponent(()=>Promise.resolve().then(()=>sfe)),"bi-listbar":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Dle)),"bi-pie":N.defineAsyncComponent(()=>Promise.resolve().then(()=>$se)),"bi-donut":N.defineAsyncComponent(()=>Promise.resolve().then(()=>hfe)),"bi-line":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Wse)),"bi-stat":N.defineAsyncComponent(()=>Promise.resolve().then(()=>ole)),"bi-pivot":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Fue)),"bi-progress":N.defineAsyncComponent(()=>Promise.resolve().then(()=>yle)),"bi-funnel":N.defineAsyncComponent(()=>Promise.resolve().then(()=>vfe)),"bi-map":N.defineAsyncComponent(()=>Promise.resolve().then(()=>wde)),"bi-cluster":N.defineAsyncComponent(()=>Promise.resolve().then(()=>Ide)),"bi-table":N.defineAsyncComponent(()=>Promise.resolve().then(()=>$de))},Ple={class:"flex items-center space-x-2"},Lle=N.defineComponent({__name:"vs-bi-switch",props:N.mergeModels({leftLabel:{},rightLabel:{},modelValue:{type:Boolean}},{modelValue:{default:()=>!1,type:Boolean},modelModifiers:{}}),emits:N.mergeModels(["update:is-enabled"],["update:modelValue"]),setup(r,{emit:e}){const t=e,i=N.useModel(r,"modelValue"),n=()=>{t("update:is-enabled",i)};return(a,o)=>(N.openBlock(),N.createElementBlock("div",Ple,[a.leftLabel?(N.openBlock(),N.createElementBlock("div",{key:0,class:N.normalizeClass(["transition-colors",{"text-blue-500":!i.value}])},N.toDisplayString(a.leftLabel),3)):N.createCommentVNode("",!0),N.withDirectives(N.createElementVNode("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>i.value=s),type:"checkbox",class:"relative w-11 h-6 p-px bg-gray-100 border-transparent text-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:ring-blue-600 disabled:opacity-50 disabled:pointer-events-none checked:bg-none checked:text-blue-600 checked:border-blue-600 focus:checked:border-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-600 before:inline-block before:size-5 before:bg-white checked:before:bg-blue-200 before:translate-x-0 checked:before:translate-x-full before:rounded-full before:shadow before:h-5 before:w-5 before:transform before:ring-0 before:transition before:ease-in-out before:duration-200 dark:before:bg-neutral-400 dark:checked:before:bg-blue-200",onChange:n},null,544),[[N.vModelCheckbox,i.value]]),a.rightLabel?(N.openBlock(),N.createElementBlock("div",{key:1,class:N.normalizeClass(["transition-colors",{"text-blue-500":i.value}])},N.toDisplayString(a.rightLabel),3)):N.createCommentVNode("",!0)]))}}),Rle={},zle={class:"flex items-center justify-center h-full"};function Nle(r,e){return N.openBlock(),N.createElementBlock("div",zle,e[0]||(e[0]=[N.createElementVNode("div",{class:"text-center text-gray-500"},[N.createElementVNode("h2",{class:"text-2xl font-bold"},"No data available")],-1)]))}const Ole=hr(Rle,[["render",Nle]]),Ble={},Vle={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Fle(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",Vle,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),N.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),N.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const $le={components:{VsBiDropdown:Ele,VsBiSwitch:Lle,VsNoDataChart:Ole,IconDownload:hr(Ble,[["render",Fle]]),...kle},props:{dashboard:{type:String},prefix:{type:String,default:""},widget:{type:String},filterURl:{type:String},dashboardWidgets:{type:Object},selectedWidget:{type:String}},data(){return{checked:[],selected:[],currentWidget:null,widgetData:[]}},computed:{computedTitle(){var e,t;const r=(e=this.dashboardWidgets)==null?void 0:e.find(i=>i.name===this.widget);return((t=r==null?void 0:r.data)==null?void 0:t.title)||(r==null?void 0:r.title)||""},computedType(){var e;const r=(e=this.dashboardWidgets)==null?void 0:e.find(t=>t.name===this.widget);return console.log(r),(r==null?void 0:r.type)||"text"},controls(){var e;return Object.keys(((e=this.widgetData)==null?void 0:e.controls)||{}).map(t=>{var i,n,a;return{name:t,options:typeof((i=this.widgetData)==null?void 0:i.controls)=="boolean"?!1:(a=(n=this.widgetData)==null?void 0:n.controls)==null?void 0:a[t]}})}},watch:{filterURl(r){var e,t;(t=(e=this.$refs)==null?void 0:e.chart)==null||t.setFilter(r)},selectedWidget(r,e){var t;r!==e&&r===((t=this.widgetData)==null?void 0:t.id)&&this.$emit("update:current-widget-data",this.widgetData)},widgetData(r,e){if((r==null?void 0:r.id)===(e==null?void 0:e.id))return;const i=new URLSearchParams(window.top.location.search).get("widget");i&&i===(r==null?void 0:r.id)&&this.$emit("update:current-widget-data",r)}},methods:{changeStyleHandler(r,e){var t;(t=this.$refs.chart)==null||t.changeStyle(r,e)},selectedOptionHandler(r,e){let t=!0;this.selected.forEach(i=>{i.name===e&&(i.option=r,t=!1)}),t&&this.selected.push({name:e,option:r}),this.makeUpUrl()},makeUpUrl(){var e;let r=`${this.prefix}/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`;this.selected.forEach((t,i)=>{r+=`&${t.name}=${t.option}`}),(e=this.$refs.chart)==null||e.getDataFromURL(r)},exportChart(){if(this.currentWidget){const r=this.currentWidget.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),e=document.createElement("a");e.href=r,e.download="chart.png",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}}},Gle={ref:"widget",class:"box-border relative h-full p-4 bg-white border border-gray-200 select-auto rounded-xl"},Ule={class:"text-[16px] flex max-w-full items-center min-h-0 flex justify-between max-h-[50px] h-fit shrink-0"},Hle={class:"flex items-center justify-between w-full"},Wle={class:"grid"},jle={class:"text-gray-800 max-h-[30px] inline-block font-semibold font-[24px] overflow-hidden"},Zle={class:"flex flex-col justify-end"},qle={key:0,class:"flex items-center justify-end w-full gap-2"},Xle={class:"w-full h-full"};function Yle(r,e,t,i,n,a){var f,d,v;const o=N.resolveComponent("VsBiDropdown"),s=N.resolveComponent("VsBiSwitch"),l=N.resolveComponent("IconDownload"),h=N.resolveComponent("VsNoDataChart");return N.openBlock(),N.createElementBlock("div",Gle,[N.createElementVNode("div",Ule,[N.createElementVNode("div",Hle,[N.createElementVNode("div",Wle,[N.createElementVNode("span",jle,N.toDisplayString(a.computedTitle),1)]),N.createElementVNode("div",Zle,[(f=a.controls)!=null&&f.length?(N.openBlock(),N.createElementBlock("span",qle,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList((d=a.controls)==null?void 0:d.filter(m=>(m==null?void 0:m.options)&&(m==null?void 0:m.name)!=="export"),m=>{var _;return N.openBlock(),N.createElementBlock("div",null,[Array.isArray(m==null?void 0:m.options)?(N.openBlock(),N.createBlock(o,{key:0,title:m==null?void 0:m.name,options:m==null?void 0:m.options,value:(_=n.widgetData)==null?void 0:_.data[m==null?void 0:m.name],onSelected:b=>a.selectedOptionHandler(b,m==null?void 0:m.name)},null,8,["title","options","value","onSelected"])):typeof m.options=="boolean"?(N.openBlock(),N.createBlock(s,{key:1,"left-label":m==null?void 0:m.name,"is-enabled":m==null?void 0:m.options,"onUpdate:isEnabled":b=>a.changeStyleHandler(m==null?void 0:m.name,b)},null,8,["left-label","is-enabled","onUpdate:isEnabled"])):N.createCommentVNode("",!0)])}),256)),(v=a.controls)!=null&&v.some(m=>(m==null?void 0:m.name)==="export")?(N.openBlock(),N.createElementBlock("button",{key:0,onClick:e[0]||(e[0]=(...m)=>a.exportChart&&a.exportChart(...m)),class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center"},[N.createVNode(l,{height:"16",width:"16",class:"text-gray-800"})])):N.createCommentVNode("",!0)])):N.createCommentVNode("",!0)])])]),N.createElementVNode("div",Xle,[n.widgetData?(N.openBlock(),N.createBlock(N.resolveDynamicComponent("bi-"+a.computedType),{key:0,currentWidget:n.currentWidget,"onUpdate:currentWidget":e[1]||(e[1]=m=>n.currentWidget=m),widgetData:n.widgetData,"onUpdate:widgetData":e[2]||(e[2]=m=>n.widgetData=m),ref:"chart",dashboard:t.dashboard,prefix:t.prefix,widget:t.widget},null,40,["currentWidget","widgetData","dashboard","prefix","widget"])):(N.openBlock(),N.createBlock(h,{key:1,class:"w-full h-full"}))])],512)}const qv=hr($le,[["render",Yle]]),Kle={props:{title:{type:String,default:()=>"Дані для відображення відсутні"},text:{type:String,default:()=>"Змініть параметри пошуку або спробуйте пізніше"}}},Jle={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},Qle={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},eue={class:"max-w-sm mx-auto mt-6"},tue={class:"font-medium text-gray-800 dark:text-neutral-200"},rue={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"};function iue(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Jle,[N.createElementVNode("div",null,[N.createElementVNode("div",Qle,[e[0]||(e[0]=N.createStaticVNode('<svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg>',1)),N.createElementVNode("div",eue,[N.createElementVNode("p",tue,N.toDisplayString(t.title),1),N.createElementVNode("p",rue,N.toDisplayString(t.text),1)])])])])}const ZC=hr(Kle,[["render",iue]]),nue={},aue={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function oue(r,e){return N.openBlock(),N.createElementBlock("svg",aue,e[0]||(e[0]=[N.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const sue=hr(nue,[["render",oue]]),lue={},uue={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-refresh"};function cue(r,e){return N.openBlock(),N.createElementBlock("svg",uue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"},null,-1),N.createElementVNode("path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},null,-1)]))}const hue={components:{filterIcon:sue,refreshIcon:hr(lue,[["render",cue]])},props:["filterScheme"],emits:["filters:changed"],data(){return{rows:[],isFilterVisible:!1,rowList:[],activeFilters:"",filters:{}}},async mounted(){const e=await(await new URLSearchParams(window.top.location.search)).get("filter");this.filters.url=e||""},computed:{activeFiltersCount(){var r,e;return(r=this.filters)!=null&&r.url?((e=this.filters)==null?void 0:e.url.split("=").length)-1:0}},methods:{toggleFilterShown(){this.isFilterVisible=!this.isFilterVisible},handleFilterChange(r){var e,t;this.filters=r,this.activeFilters=(t=(e=this.$refs)==null?void 0:e.filter)==null?void 0:t.activeFilters,this.$emit("filters:changed",this.filters)},resetFilters(){this.$refs.filter&&this.$refs.filter.clearAll(),this.isFilterVisible=!1,this.$emit("filters:changed",""),this.activeFilters=null},closeFilter({target:r}){this.isFilterVisible&&r.classList.contains("filter-container")&&(this.isFilterVisible=!1)}}},fue={class:"flex items-center"},due={key:0,class:"font-medium text-[10px] min-w-[16px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full"};function pue(r,e,t,i,n,a){const o=N.resolveComponent("filterIcon"),s=N.resolveComponent("VsFilterList");return N.openBlock(),N.createElementBlock("div",fue,[t.filterScheme?(N.openBlock(),N.createBlock(s,{key:0,ref:"filter",scheme:t.filterScheme,closeFilterBtn:!0,onFilterClose:e[1]||(e[1]=l=>n.isFilterVisible=!1),layout:"default","apply-vue-router":"",history:"",view:"plain",token:r.table,name:"filter",footer:!0,background:!0,onFilterChange:a.handleFilterChange},{button:N.withCtx(()=>[N.createElementVNode("button",{type:"button",class:"py-2 px-2.5 ml-3 h-[38px] inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50",onClick:e[0]||(e[0]=(...l)=>a.toggleFilterShown&&a.toggleFilterShown(...l))},[N.createVNode(o),e[2]||(e[2]=N.createTextVNode(" Фільтри ")),a.activeFiltersCount>=1?(N.openBlock(),N.createElementBlock("span",due,N.toDisplayString(a.activeFiltersCount),1)):N.createCommentVNode("",!0)])]),_:1},8,["scheme","token","onFilterChange"])):N.createCommentVNode("",!0)])}const vue={props:["dashboardData","filters"],components:{VsFilterHeader:hr(hue,[["render",pue]])}},gue={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 mt-2 rounded-xl mb-2 pt-[3px] justify-between items-center"},mue={class:"grow"},yue={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},_ue={type:"button",class:"inline-flex items-center text-sm gap-x-2 text-stone-800 hover:text-stone-500 focus:outline-none focus:text-stone-500 dark:text-neutral-200 dark:hover:text-neutral-400 dark:focus:text-neutral-400","data-clipboard-target":"#hs-erc","data-clipboard-action":"copy","data-clipboard-success-text":"Copied"};function xue(r,e,t,i,n,a){var s,l;const o=N.resolveComponent("VsFilterHeader");return N.openBlock(),N.createElementBlock("div",gue,[N.createElementVNode("div",mue,[N.createElementVNode("h1",yue,N.toDisplayString((s=t.dashboardData)==null?void 0:s.title),1),N.createElementVNode("button",_ue,N.toDisplayString((l=t.dashboardData)==null?void 0:l.description),1)]),N.createVNode(o,{filterScheme:t.filters,"onFilters:changed":e[0]||(e[0]=h=>r.$emit("filters:changed",h))},null,8,["filterScheme"])])}const bue={components:{VsWidget:qv,VsNewNodata:ZC,VsHeader:hr(vue,[["render",xue]])},props:["id","prefix"],data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},async mounted(){vr.defaults.baseURL=this.prefix||"/api",await this.fetchData()},methods:{async fetchData(){if(this.id)try{const{data:r}=await vr.get(`/bi-dashboard/${this.id}`);this.dashboardData=r}catch(r){console.error(r)}},columnClass(r){const e=r!=null&&r.col?r==null?void 0:r.col:12;return{1:"md:w-1/12 sm:w-full",2:"md:w-1/6 sm:w-full",3:"md:w-1/4 sm:w-full",4:"md:w-1/3 sm:w-full",6:"md:w-1/2 sm:w-full",8:"md:w-2/3 sm:w-full",10:"md:w-5/6 sm:w-full",12:"w-full"}[e]||"w-full"},async filterHandler(r){var t;this.filterURl="";let e="&filter=";(t=r==null?void 0:r.url)!=null&&t.length&&(r.url.split("|").forEach(n=>{const a=n.split("=");e+=`${a[0]}=${a[1]}`}),this.filterURl+=e)}}},wue={class:"w-full pb-8 overflow-y-auto"},Sue={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function Tue(r,e,t,i,n,a){var h,f,d;const o=N.resolveComponent("VsHeader"),s=N.resolveComponent("VsNewNodata"),l=N.resolveComponent("VsWidget");return N.openBlock(),N.createElementBlock("div",wue,[N.createElementVNode("div",null,[(h=n.dashboardData)!=null&&h.filters?(N.openBlock(),N.createBlock(o,{key:0,filters:(f=n.dashboardData)==null?void 0:f.filters,dashboardData:n.dashboardData,"onFilters:changed":e[0]||(e[0]=v=>a.filterHandler(v))},null,8,["filters","dashboardData"])):N.createCommentVNode("",!0)]),N.createElementVNode("div",Sue,[n.error||!n.dashboardData?(N.openBlock(),N.createBlock(s,{key:0,class:"col-span-12"})):N.createCommentVNode("",!0),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(((d=n.dashboardData)==null?void 0:d.panels)||[],(v,m)=>{var _;return N.openBlock(),N.createElementBlock("div",{key:m,class:N.normalizeClass([`col-span-${v.col||12}`,"flex flex-col gap-[10px]"])},[(_=v.widgets)!=null&&_.length?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:0},N.renderList(v.widgets,b=>(N.openBlock(),N.createBlock(l,{key:b,dashboard:t.id,widget:b,"dashboard-widgets":n.dashboardData.widgets,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))),128)):(N.openBlock(),N.createBlock(l,{key:1,class:"max-h-[460px] flex flex-col",dashboard:t.id,widget:v.widget,"dashboard-widgets":n.dashboardData.widgets,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))],2)}),128))])])}const lF=hr(bue,[["render",Tue]]),Cue={name:"VsPivotTable",mixins:[da],data(){return{values:null,xs:null,products:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){try{const r=Array.from(new Set(this.sourceData.map(e=>e[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=r.map(e=>Xo(e)):this.xs=[...r],this.products=this.dimensions.filter((e,t)=>t!=0),this.values=this.products.map((e,t)=>({name:e,data:this.sourceData.filter(i=>parseFloat(i[e])).map(i=>mi(parseFloat(i[e])))}))}catch(r){console.error(r)}}}},Due={class:"flex flex-col h-full p-5 space-y-4 rounded-xl custom-scrollbar"},Aue={class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 custom-scrollbar"},Iue={class:"inline-block min-w-full align-middle"},Mue={class:"min-w-full divide-y divide-gray-200"},Eue={class:"space-x-2"},kue={scope:"col",class:"xl:min-w-[120px] min-w-48"},Pue={class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"},Lue={class:"divide-y divide-gray-200 text-[12px]"},Rue={class:"py-3 size-px whitespace-nowrap"},zue={class:"flex items-center gap-x-3"},Nue={class:"font-medium text-gray-800"},Oue={class:"py-3 size-px whitespace-nowrap"},Bue={class:"text-gray-600"};function Vue(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",Due,[N.createElementVNode("div",Aue,[N.createElementVNode("div",Iue,[N.createElementVNode("table",Mue,[N.createElementVNode("thead",null,[N.createElementVNode("tr",Eue,[e[0]||(e[0]=N.createElementVNode("th",{scope:"col",class:"min-w-[200px]"},[N.createElementVNode("div",{class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"})],-1)),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.xs,o=>(N.openBlock(),N.createElementBlock("th",kue,[N.createElementVNode("div",Pue,N.toDisplayString(o),1)]))),256))])]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.values,o=>(N.openBlock(),N.createElementBlock("tbody",Lue,[N.createElementVNode("tr",null,[N.createElementVNode("td",Rue,[N.createElementVNode("div",zue,[N.createElementVNode("span",Nue,N.toDisplayString(o.name),1)])]),(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(n.xs,(s,l)=>(N.openBlock(),N.createElementBlock("td",Oue,[N.createElementVNode("span",Bue,N.toDisplayString(o.data[l]),1)]))),256))])]))),256))])])])])}const qC=hr(Cue,[["render",Vue]]),Fue=Object.freeze(Object.defineProperty({__proto__:null,default:qC},Symbol.toStringTag,{value:"Module"})),$ue={},Gue={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Uue(r,e){return N.openBlock(),N.createElementBlock("svg",Gue,e[0]||(e[0]=[N.createElementVNode("path",{d:"M3.3335 8H12.6668",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M8 3.33325V12.6666",stroke:"#1E40AF","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const Hue=hr($ue,[["render",Uue]]),Wue={},jue={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"mr-3"};function Zue(r,e){return N.openBlock(),N.createElementBlock("svg",jue,e[0]||(e[0]=[N.createElementVNode("path",{d:"M6.41667 11.0833C8.994 11.0833 11.0833 8.994 11.0833 6.41667C11.0833 3.83934 8.994 1.75 6.41667 1.75C3.83934 1.75 1.75 3.83934 1.75 6.41667C1.75 8.994 3.83934 11.0833 6.41667 11.0833Z",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),N.createElementVNode("path",{d:"M12.25 12.25L9.7417 9.7417",stroke:"#6B7280","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const que=hr(Wue,[["render",Zue]]),Xue={},Yue={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-upload"};function Kue(r,e){return N.openBlock(),N.createElementBlock("svg",Yue,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),N.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),N.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Jue=hr(Xue,[["render",Kue]]),Que={},ece={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-lock"};function tce(r,e){return N.openBlock(),N.createElementBlock("svg",ece,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z"},null,-1),N.createElementVNode("path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"},null,-1),N.createElementVNode("path",{d:"M8 11v-4a4 4 0 1 1 8 0v4"},null,-1)]))}const rce=hr(Que,[["render",tce]]),ice=[{type:"Text",key:"name",label:"Назва",validators:["required"],original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"title",label:"Заголовок",validators:["required"],original:{type:"Text",ua:"Титул",col:8}},{type:"Text",key:"description",label:"Опис",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"words",label:"Ключові слова",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці",original:{type:"Text",ua:"Назва",col:8}},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],nce={components:{plusIcon:Hue,searchIcon:que,IconLock:rce,IconImport:Jue},props:["selectedDashboard","prefix"],emits:["update:selectedDashboard","add","update"],mounted(){vr.defaults.baseURL=this.prefix||"/api",this.getFileItems(),this.getList()},data(){return{searchQuery:"",scheme:null,formValues:{},formCreateValues:{},isVisible:!1,isVisibleFormDashboard:!1,fileItems:null,list:null,addDashboardForm:ice}},methods:{async getFileItems(){var r;try{const{data:e}=await vr.get("/bi-dashboard?type=file");this.scheme={dashboard:{type:"Checkbox",ua:"Дашборди",options:(r=e==null?void 0:e.rows)==null?void 0:r.map(({name:t,title:i})=>({id:t,text:i}))}}}catch{}},async getList(){try{const{data:r}=await vr.get("/bi-dashboard?type=db");this.list=r.rows.filter(e=>e.type==="db")}catch(r){console.error(r)}},async dashboardImport(){try{await vr.get(`/bi-dashboard-import?dashboard=${this.formValues.dashboard}`),this.isVisible=!1,this.formValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд імпортовано успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі імпортувати дашборд виникла помилка"})}},async createDashboard(){try{await this.$refs.form.doValidation(),await vr.post("/bi-dashboard",this.formCreateValues),this.isVisibleFormDashboard=!1,this.formCreateValues={},this.$notify({type:"success",title:"Успішно!",message:"Дашборд створено успішно"}),this.getList()}catch{this.$notify({type:"error",title:"Помилка!",message:"При спробі створити дашборд виникла помилка"})}}},computed:{filteredList(){var e;const r=this.searchQuery.toLowerCase();return(e=this.list)==null?void 0:e.filter(t=>(t==null?void 0:t.title)&&(t==null?void 0:t.title.toLowerCase().includes(r))||(t==null?void 0:t.name)&&(t==null?void 0:t.name.toLowerCase().includes(r)))}}},ace={class:"h-full w-[300px] shrink-0 bg-white border-r border-gray-200 flex flex-col"},oce={class:"flex h-[49px] border-b justify-between px-[16px] items-center"},sce={class:"flex items-center gap-2"},lce={class:"flex items-center gap-2 px-[10px] py-2"},uce={class:"relative w-full"},cce={class:"px-[10px] flex flex-col gap-[2px] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300"},hce=["item","onClick"],fce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},dce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function pce(r,e,t,i,n,a){const o=N.resolveComponent("IconImport"),s=N.resolveComponent("VsPopover"),l=N.resolveComponent("plusIcon"),h=N.resolveComponent("IconLock"),f=N.resolveComponent("VsForm"),d=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",ace,[N.createElementVNode("div",oce,[e[13]||(e[13]=N.createElementVNode("div",{class:"text-[20px]"},[N.createTextVNode("Editor "),N.createElementVNode("span",{class:"text-[#666666]"})],-1)),N.createElementVNode("div",sce,[N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] text-blue-500 w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[0]||(e[0]=v=>n.isVisible=!0)},[N.createVNode(o,{height:"18",width:"18"})])]),default:N.withCtx(()=>[e[11]||(e[11]=N.createTextVNode(" Імпортувати дашборд "))]),_:1}),N.createVNode(s,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"bg-[#DBEAFE] h-[38px] w-[38px] flex items-center hover:bg-blue-300 duration-300 justify-center rounded-lg shrink-0",onClick:e[1]||(e[1]=v=>n.isVisibleFormDashboard=!0)},[N.createVNode(l)])]),default:N.withCtx(()=>[e[12]||(e[12]=N.createTextVNode(" Створити дашборд "))]),_:1})])]),N.createElementVNode("div",lce,[N.createElementVNode("div",uce,[N.withDirectives(N.createElementVNode("input",{"onUpdate:modelValue":e[2]||(e[2]=v=>n.searchQuery=v),class:"flex-1 text-[13px] w-full h-[38px] px-3 text-gray-800 rounded-lg !border-none bg-gray-100 placeholder-gray-800 focus:outline-2 focus:outline-blue-600",placeholder:"Пошук..."},null,512),[[N.vModelText,n.searchQuery]])])]),N.createElementVNode("div",cce,[(N.openBlock(!0),N.createElementBlock(N.Fragment,null,N.renderList(a.filteredList,(v,m)=>(N.openBlock(),N.createElementBlock("div",{key:m,item:v,class:N.normalizeClass(["flex items-center cursor-pointer hover:bg-[#F3F4F6] py-1.5 px-2 text-[13px] text-gray-800 rounded-lg",{"bg-gray-100 outline-none":v.name===t.selectedDashboard}]),onClick:_=>r.$emit("update:selectedDashboard",v==null?void 0:v.name)},[N.createTextVNode(N.toDisplayString((v==null?void 0:v.title)||(v==null?void 0:v.name))+" ",1),v!=null&&v.public?N.createCommentVNode("",!0):(N.openBlock(),N.createBlock(h,{key:0,height:"12",width:"12",class:"ml-1 shrink-0"}))],10,hce))),128))])]),N.createVNode(d,{visible:n.isVisible,"onUpdate:visible":e[6]||(e[6]=v=>n.isVisible=v),title:"Імпортувати"},{footer:N.withCtx(()=>[N.createElementVNode("div",fce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[4]||(e[4]=v=>n.isVisible=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[5]||(e[5]=(...v)=>a.dashboardImport&&a.dashboardImport(...v)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Імпортувати ")])]),default:N.withCtx(()=>{var v;return[N.createTextVNode(N.toDisplayString((v=n.fileItems)==null?void 0:v.map(({name:m,title:_})=>({value:m,text:_})))+" ",1),N.createVNode(f,{scheme:n.scheme,modelValue:n.formValues,"onUpdate:modelValue":e[3]||(e[3]=m=>n.formValues=m)},null,8,["scheme","modelValue"])]}),_:1},8,["visible"]),N.createVNode(d,{visible:n.isVisibleFormDashboard,"onUpdate:visible":e[10]||(e[10]=v=>n.isVisibleFormDashboard=v),title:"Створити дашборд"},{footer:N.withCtx(()=>[N.createElementVNode("div",dce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=v=>n.isVisibleFormDashboard=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[9]||(e[9]=(...v)=>a.createDashboard&&a.createDashboard(...v)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(f,{ref:"form",scheme:n.addDashboardForm,modelValue:n.formCreateValues,"onUpdate:modelValue":e[7]||(e[7]=v=>n.formCreateValues=v)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const vce=hr(nce,[["render",pce]]),gce={},mce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function yce(r,e){return N.openBlock(),N.createElementBlock("svg",mce,e[0]||(e[0]=[N.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const uF=hr(gce,[["render",yce]]),_ce={},xce={class:"shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function bce(r,e){return N.openBlock(),N.createElementBlock("svg",xce,e[0]||(e[0]=[N.createElementVNode("path",{d:"M18 6 6 18"},null,-1),N.createElementVNode("path",{d:"m6 6 12 12"},null,-1)]))}const wce=hr(_ce,[["render",bce]]),Sce={},Tce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit"};function Cce(r,e){return N.openBlock(),N.createElementBlock("svg",Tce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"},null,-1),N.createElementVNode("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"},null,-1),N.createElementVNode("path",{d:"M16 5l3 3"},null,-1)]))}const cF=hr(Sce,[["render",Cce]]),Dce={class:"pt-[10px]"},Ace={__name:"vs-editor-form-style",props:{widgetName:{type:String},data:{type:Object,default:()=>{}}},setup(r){var v,m,_,b,S,D;const{$notify:e}=N.getCurrentInstance().proxy,t=r,i=N.ref(null),n={show:{label:"Label",type:"switcher",title:"Show label"},rotate:{type:"number",label:"Rotate angel",conditions:["show","==",!0]},align:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"center",text:"Center"},{id:"left",text:"Left"},{id:"right",text:"Right"}]},position:{type:"radio",view:"buttons",style:{size:"xs"},conditions:["show","==",!0],options:[{id:"top",text:"Top"},{id:"right",text:"Right"},{id:"left",text:"Left"},{id:"bottom",text:"Bottom"}]}},a={show:{label:"Legend",type:"switcher",title:"Show legend"}},o={show:{label:"Tooltip ",type:"switcher",title:"Show tooltip"}},s=N.ref({...((m=(v=t.data)==null?void 0:v.style)==null?void 0:m.label)||{}}),l=N.ref({...((b=(_=t.data)==null?void 0:_.style)==null?void 0:b.legend)||{}}),h=N.ref({...((D=(S=t.data)==null?void 0:S.style)==null?void 0:D.tooltip)||{}}),f=()=>{const E=new CustomEvent(`update-style-${t.widgetName}`);E.chartId=t.widgetName,E.options={options:{legend:l.value,tooltip:h.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(E)};N.watch(s,f,{deep:!0}),N.watch(l,f,{deep:!0}),N.watch(h,f,{deep:!0});const d=async()=>{try{await vr.put(`/bi-dashboard/${i.value}/${t.widgetName}`,{style:{legend:l.value,tooltip:h.value,label:s.value}});const E=new CustomEvent(`update-style-${t.widgetName}`);E.chartId=t.widgetName,E.options={options:{legend:l.value,tooltip:h.value,label:s.value},seriesOptions:s.value},window.dispatchEvent(E),await e({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await e({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const E=new URLSearchParams(window.top.location.search);i.value=E.get("dashboard")}),(E,P)=>{const z=N.resolveComponent("VsButton"),V=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",Dce,[N.createVNode(z,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:d},{default:N.withCtx(()=>P[3]||(P[3]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(V,{scheme:n,modelValue:s.value,"onUpdate:modelValue":P[0]||(P[0]=F=>s.value=F),class:"p-0"},null,8,["modelValue"]),N.createVNode(V,{scheme:a,modelValue:l.value,"onUpdate:modelValue":P[1]||(P[1]=F=>l.value=F),class:"p-0"},null,8,["modelValue"]),N.createVNode(V,{scheme:o,modelValue:h.value,"onUpdate:modelValue":P[2]||(P[2]=F=>h.value=F),class:"p-0"},null,8,["modelValue"])])}}},Ice={class:"pt-[10px]"},Mce={__name:"vs-editor-form-data",props:{widgetName:{type:String},data:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(r,{emit:e}){var h,f,d,v,m,_,b,S,D,E,P,z,V,F,U,j,Z,X,Q,se;const{$notify:t}=N.getCurrentInstance().proxy,i=r,n=N.ref(null),a={text:{type:"Text",label:"Text",conditions:["type","==","text"]},x:{type:"radio",label:"X Axis",view:"buttons",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:(f=(h=i.columns)==null?void 0:h.filter(ne=>(ne==null?void 0:ne.type)=="text"||(ne==null?void 0:ne.type)==="date"||(ne==null?void 0:ne.type)==="timestamp without time zone"||(ne==null?void 0:ne.type)==="boolean"||(ne==null?void 0:ne.type)==="integer"))==null?void 0:f.map(({name:ne,type:ue})=>({id:ne,label:ne,type:ue}))},metric:{type:"radio",label:"Y Axis",view:"buttons",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:[{id:"count",label:"count"},...(v=(d=i.columns)==null?void 0:d.filter(ne=>(ne==null?void 0:ne.type)==="numeric"||(ne==null?void 0:ne.type)==="double precision"))==null?void 0:v.map(({name:ne,type:ue})=>({id:ne,label:ne,type:ue}))]},groupby:{type:"radio",label:"Groupby",view:"buttons",style:{size:"xs"},options:[{id:"null",label:"null"},...(_=(m=i.columns)==null?void 0:m.filter(ne=>(ne==null?void 0:ne.type)=="text"||(ne==null?void 0:ne.type)==="boolean"||(ne==null?void 0:ne.type)==="integer"))==null?void 0:_.map(({name:ne})=>({id:ne,label:ne}))],conditions:["type","==","bar"]},columns:{type:"checkbox",label:"Columns",style:{size:"xs"},options:(b=i.columns)==null?void 0:b.map(({name:ne})=>ne),conditions:["type","in",["table","map"]]},granularity:{type:"radio",label:"Granularity",options:[{id:"year",label:"year"},{id:"quarter",label:"quarter"},{id:"month",label:"month"},{id:"week",label:"week"}],conditions:["x.type","==","date"]},type:{type:"Text",hidden:!0}},o=N.ref({x:((D=(S=i.data)==null?void 0:S.data)==null?void 0:D.x)||null,metric:((P=(E=i.data)==null?void 0:E.data)==null?void 0:P.metric)||null,columns:((V=(z=i.data)==null?void 0:z.data)==null?void 0:V.columns)||null,granularity:((U=(F=i.data)==null?void 0:F.data)==null?void 0:U.granularity)||null,type:((Z=(j=i.data)==null?void 0:j.data)==null?void 0:Z.type)||((X=i.data)==null?void 0:X.type)||null,groupby:((se=(Q=i.data)==null?void 0:Q.data)==null?void 0:se.groupby)||null}),s=async()=>{try{await vr.put(`/bi-dashboard/${n.value}/${i.widgetName}`,{data:o.value});let ne=`/bi-data?dashboard=${n.value}&widget=${i.widgetName}`;Object.entries(o.value).forEach(([de,_e])=>{ne+=`&${de}=${_e}`});const ue=new CustomEvent(`update-data-${i.widgetName}`);ue.filterUrl=ne,window.dispatchEvent(ue),await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}},l=async()=>{try{let ne=`/bi-data?dashboard=${n.value}&widget=${i.widgetName}`;Object.entries(o.value).forEach(([de,_e])=>{ne+=`&${de}=${_e}`});const ue=new CustomEvent(`update-data-${i.widgetName}`);ue.filterUrl=ne,window.dispatchEvent(ue)}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.watch(o,(ne,ue)=>{var Ie,Ce;const de=(Ie=Object.entries(ne))==null?void 0:Ie.reduce((Oe,[Ue,He])=>He?Oe+He:Oe),_e=(Ce=Object.entries(ue))==null?void 0:Ce.reduce((Oe,[Ue,He])=>He?Oe+He:Oe);de!==_e&&l()},{deep:!0}),N.onMounted(()=>{const ne=new URLSearchParams(window.top.location.search);n.value=ne.get("dashboard")}),(ne,ue)=>{const de=N.resolveComponent("VsButton"),_e=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",Ice,[N.createVNode(de,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:s},{default:N.withCtx(()=>ue[1]||(ue[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(_e,{scheme:a,modelValue:o.value,"onUpdate:modelValue":ue[0]||(ue[0]=Ie=>o.value=Ie)},null,8,["modelValue"])])}}},Ece={class:"pt-[10px]"},kce={__name:"vs-editor-form-yaml",props:{yamlValue:{type:null,default:()=>""},widgetName:{type:String},data:{type:Object}},setup(r){const e=N.ref(null),{$notify:t}=N.getCurrentInstance().proxy,i=r,n=(l,{dimensions:h,source:f})=>{const d=l.getOption(),{data:v,...m}=(d==null?void 0:d.series)[0],[,..._]=h||[],b=_.map((S,D)=>({...(d==null?void 0:d.series[D])||{},data:f.map(E=>E[D+1]),name:S}));l==null||l.setOption({...d||{},dataset:{dimensions:h,source:f},series:b,xAxis:{type:"category"},yAxis:{}},!0)},a=l=>{const h=document.getElementById(l);if(!h)return null;const f=sS(h);return f||null},o=N.ref(i.yamlValue),s=async()=>{try{await vr.put(`/bi-dashboard/${e.value}/${i.widgetName}`,{yml:o.value});const l=a(i.widgetName);if(l){const{data:h}=await vr.get(`/bi-data?dashboard=${e.value}&widget=${i.widgetName}`);n(l,h)}await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const l=new URLSearchParams(window.top.location.search);e.value=l.get("dashboard")}),(l,h)=>{const f=N.resolveComponent("VsButton"),d=N.resolveComponent("VsFormAce");return N.openBlock(),N.createElementBlock("div",Ece,[N.createVNode(f,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:s},{default:N.withCtx(()=>h[1]||(h[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(d,{modelValue:o.value,"onUpdate:modelValue":h[0]||(h[0]=v=>o.value=v),value:o.value,fontSize:"12px"},null,8,["modelValue","value"])])}}},Pce={class:"pt-[10px]"},hF={"vs-editor-form-style":Ace,"vs-editor-form-data":Mce,"vs-editor-form-yaml":kce,"vs-editor-form-controls":{__name:"vs-editor-form-controls",props:{widgetName:{type:String},controls:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(r,{emit:e}){var h;const{$notify:t}=N.getCurrentInstance().proxy,i=e,n=r,a=N.ref(null),o={granularity:{ua:"Granularity",type:"checkbox",options:["week","month","quarter","year"]},export:{ua:"Export",type:"Switcher"},groupby:{ua:"Groupby",type:"checkbox",options:(h=n.columns)==null?void 0:h.map(({name:f})=>f)}},s=N.ref(n.controls||{}),l=async()=>{try{await vr.put(`/bi-dashboard/${a.value}/${n.widgetName}`,{controls:s.value}),await t({type:"success",title:"Успішно!",message:"Дані успішно оновлено"}),staticTypes!=null&&staticTypes.includes(s.value.type)&&i("update-dashboard")}catch{await t({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return N.onMounted(()=>{const f=new URLSearchParams(window.top.location.search);a.value=f.get("dashboard")}),(f,d)=>{const v=N.resolveComponent("VsButton"),m=N.resolveComponent("VsForm");return N.openBlock(),N.createElementBlock("div",Pce,[N.createVNode(v,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:l},{default:N.withCtx(()=>d[1]||(d[1]=[N.createTextVNode(" Зберегти ")])),_:1}),N.createVNode(m,{scheme:o,modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=_=>s.value=_)},null,8,["modelValue"])])}}}},Lce={class:"h-full flex flex-col bg-white shrink-0 !w-[400px] border-l"},Rce={key:0},zce={class:"border-b flex items-center px-[10px] h-[49px] border-transparent border-solid border-b-gray-200"},Nce={class:"flex gap-2 ml-auto"},Oce={class:"h-[calc(100vh-110px)] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},Bce={key:0},Vce={key:1},Fce={class:"p-4"},$ce={class:"flex justify-end mt-4 gap-x-3"},Gce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Uce={__name:"vs-editor-forms",props:N.mergeModels({selectedWidgetData:{type:Object,required:!1,default:null},selectedDashboard:{type:String,default:()=>""},currentWidgetData:{type:String,default:()=>""}},{selectedWidget:{},selectedWidgetModifiers:{}}),emits:N.mergeModels(["update-data"],["update:selectedWidget"]),setup(r,{emit:e}){var D,E;const t=(E=(D=N.getCurrentInstance())==null?void 0:D.proxy)==null?void 0:E.$notify,i=e,n=r,a=N.ref(!1),o=N.ref(!0),s=N.ref(!1),l=N.ref({}),h=N.useModel(r,"selectedWidget"),f=["table","text","number","stat","progress","listbar","map","pivot"],d=N.ref("data"),v=async()=>{try{await vr.delete(`/bi-dashboard/${n.selectedDashboard}/${n.selectedWidgetData.name}`);const P=new URL(window.top.location.href);P.searchParams.set("dashboard",n.selectedDashboard),P.searchParams.delete("widget"),window.top.history.pushState({},"",P),i("update-data"),a.value=!1,t({type:"success",title:"Успішно!",message:"Віджет успішно видалено"})}catch(P){console.error(P),t({type:"error",title:"Помилка!",message:"При спробі видалити віджет виникла помилка"})}},m=N.computed(()=>{const P=[{id:"data",label:"Дані"},{id:"style",label:"Стилі"},{id:"yaml",label:"{ }"},{id:"controls",label:"Контролси"}];return P==null?void 0:P.filter(z=>{var V,F,U;return z.id==="style"?!(f!=null&&f.includes(((V=n.selectedWidgetData)==null?void 0:V.type)||((U=(F=n.selectedWidgetData)==null?void 0:F.data)==null?void 0:U.type))):!0})}),_=()=>{var P,z,V;l.value={title:(P=n.selectedWidgetData)==null?void 0:P.title,type:(z=n.selectedWidgetData)==null?void 0:z.type,table:(V=n.selectedWidgetData)==null?void 0:V.table_name},s.value=!0},b=async()=>{try{await vr.put(`/bi-dashboard/${n.selectedDashboard}/${n.selectedWidgetData.name}`,l.value),t({type:"success",title:"Успішно!",message:"Дані успішно змінено"}),await i("update-data"),s.value=!1}catch{t({type:"error",title:"Помилка!",message:"При спробі внести зміни виникла помилка"})}};N.watch(h,P=>{o.value=!1;const z=new URL(window.top.location.href);P?(z.searchParams.set("widget",P),window.top.history.pushState({},"",z)):(z.searchParams.delete("widget"),window.top.history.pushState({},"",z)),setTimeout(()=>o.value=!0)});const S={title:{type:"text",ua:"Заголовок",placeholder:"Заголовок",validators:["required"]},type:{type:"radio",view:"buttons",validators:["required"],slots:{label:'<div style="width: 120px; height:160px" class="flex gap-[12px] flex-col"><img class="block" style="height: calc(100% - 40px)" :src="`https://cdn.softpro.ua/data/icons/bi/${id}.png`"/><span class="font-[500]">{{ label }}</span></div>'},options:[{label:"Bar",id:"bar"},{label:"Funnel",id:"funnel"},{label:"Line",id:"line"},{label:"List bar",id:"listbar"},{label:"Number",id:"number"},{label:"Pie",id:"pie"},{label:"Donut",id:"donut"},{label:"Pivot",id:"pivot"},{label:"Table",id:"table"},{label:"Progress",id:"progress"},{label:"Stat",id:"stat"},{label:"Text",id:"text"},{label:"Map",id:"map"}]},table:{type:"text",ua:"Таблиця",placeholder:"Таблиця"}};return(P,z)=>{var X,Q,se,ne,ue,de,_e,Ie;const V=N.resolveComponent("VsFormRadio"),F=N.resolveComponent("VsPopover"),U=N.resolveComponent("VsConfirm"),j=N.resolveComponent("VsForm"),Z=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",Lce,[r.selectedWidgetData?(N.openBlock(),N.createElementBlock("div",Rce,[N.createElementVNode("div",zce,[o.value?(N.openBlock(),N.createBlock(V,{key:0,options:m.value,modelValue:d.value,"onUpdate:modelValue":z[0]||(z[0]=Ce=>d.value=Ce),view:"buttons"},null,8,["options","modelValue"])):(N.openBlock(),N.createBlock(V,{key:1,options:m.value,modelValue:d.value,"onUpdate:modelValue":z[1]||(z[1]=Ce=>d.value=Ce),view:"buttons"},null,8,["options","modelValue"])),N.createElementVNode("div",Nce,[N.createVNode(F,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{onClick:_,class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200"},[N.createVNode(cF,{class:"h-[16px]"})])]),default:N.withCtx(()=>[z[10]||(z[10]=N.createTextVNode(" Редагувати віджет "))]),_:1}),N.createVNode(F,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:z[2]||(z[2]=Ce=>a.value=!0)},[N.createVNode(N.unref(uF),{class:"h-[16px]"})])]),default:N.withCtx(()=>[z[11]||(z[11]=N.createTextVNode(" Видалити віджет "))]),_:1})])]),N.createElementVNode("div",Oce,[o.value&&r.currentWidgetData?(N.openBlock(),N.createElementBlock("div",Bce,[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(N.unref(hF)["vs-editor-form-"+d.value]),{widgetName:(X=r.selectedWidgetData)==null?void 0:X.name,yamlValue:((Q=r.selectedWidgetData)==null?void 0:Q.yml)||"",data:r.selectedWidgetData,controls:(se=r.selectedWidgetData)==null?void 0:se.controls,columns:(ne=r.currentWidgetData)==null?void 0:ne.columns,onUpdateDashboard:z[3]||(z[3]=Ce=>P.$emit("update-dashboard"))},null,40,["widgetName","yamlValue","data","controls","columns"]))])):(N.openBlock(),N.createElementBlock("div",Vce,[(N.openBlock(),N.createBlock(N.resolveDynamicComponent(N.unref(hF)["vs-editor-form-"+d.value]),{widgetName:(ue=r.selectedWidgetData)==null?void 0:ue.name,yamlValue:((de=r.selectedWidgetData)==null?void 0:de.yml)||"",data:r.selectedWidgetData,controls:(_e=r.selectedWidgetData)==null?void 0:_e.controls,columns:(Ie=r.currentWidgetData)==null?void 0:Ie.columns,onUpdateDashboard:z[4]||(z[4]=Ce=>P.$emit("update-dashboard"))},null,40,["widgetName","yamlValue","data","controls","columns"]))])),N.createVNode(U,{visible:a.value,"onUpdate:visible":z[6]||(z[6]=Ce=>a.value=Ce),title:"Ви впевнені?"},{default:N.withCtx(()=>[N.createElementVNode("div",Fce,[z[12]||(z[12]=N.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей віджет? ",-1)),N.createElementVNode("div",$ce,[N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:z[5]||(z[5]=Ce=>a.value=!1)}," Скасувати "),N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:v}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"])])])):(N.openBlock(),N.createBlock(ZC,{key:1,title:"Оберіть один з віджетів",text:""}))]),N.createVNode(Z,{visible:s.value,"onUpdate:visible":z[9]||(z[9]=Ce=>s.value=Ce),title:"Редагувати віджет"},{footer:N.withCtx(()=>[N.createElementVNode("div",Gce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:z[8]||(z[8]=Ce=>s.value=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:b,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(j,{scheme:S,modelValue:l.value,"onUpdate:modelValue":z[7]||(z[7]=Ce=>l.value=Ce)},null,8,["modelValue"])]),_:1},8,["visible"])],64)}}},Hce={},Wce={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-plus"};function jce(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",Wce,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M12 5l0 14"},null,-1),N.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const Zce=hr(Hce,[["render",jce]]),qce={class:"mb-4 overflow-auto scrollbar max-h-96"},Xce={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Yce={__name:"vs-editor-create-widget",props:{columns:{type:Array,default:()=>[]},selectedDashboard:String},emits:"update-data",setup(r,{emit:e}){var f;const t=(f=N.getCurrentInstance().proxy)==null?void 0:f.$notify,i=e,n=r,a=N.ref(!1),o=N.ref({}),s=N.ref(),l=async()=>{try{await s.value.doValidation(),await vr.post(`/bi-dashboard/${n.selectedDashboard}`,o.value),await t({type:"success",title:"Успішно!",message:"Віджет успішно створено"}),await i("update-data"),o.value={},a.value=!1}catch{t({type:"error",title:"Помилка!",message:"При спробі створити віджет сталася помилка"})}},h=N.computed(()=>{var d,v,m,_;return{title:{type:"text",label:"Widget title",placeholder:"Widget title",validators:["required"]},x:{type:"radio",label:"X Axis",view:"buttons",style:{size:"xs"},validators:["required"],options:(v=(d=n.columns)==null?void 0:d.filter(b=>(b==null?void 0:b.type)=="text"||(b==null?void 0:b.type)==="date"||(b==null?void 0:b.type)==="timestamp without time zone"||(b==null?void 0:b.type)==="boolean"||(b==null?void 0:b.type)==="integer"))==null?void 0:v.map(({name:b,type:S})=>({id:b,label:b,type:S}))},metric:{type:"radio",label:"Y Axis",view:"buttons",validators:["required"],style:{size:"xs"},options:[{id:"count",label:"count"},...(_=(m=n.columns)==null?void 0:m.filter(b=>(b==null?void 0:b.type)==="numeric"||(b==null?void 0:b.type)==="double precision"))==null?void 0:_.map(({name:b,type:S})=>({id:b,label:b,type:S}))]},col:{type:"radio",label:"Columns count",validators:["required"],options:[{id:1,label:1},{id:2,label:2},{id:3,label:3},{id:4,label:4},{id:6,label:6},{id:9,label:9},{id:12,label:12}]},type:{type:"radio",view:"buttons",validators:["required"],slots:{label:'<div style="width: 120px; height:160px" class="flex gap-[12px] flex-col"><img class="block" style="height: calc(100% - 40px)" :src="`https://cdn.softpro.ua/data/icons/bi/${id}.png`"/><span class="font-[500]">{{ label }}</span></div>'},options:[{label:"Bar",id:"bar"},{label:"Funnel",id:"funnel"},{label:"Line",id:"line"},{label:"List bar",id:"listbar"},{label:"Number",id:"number"},{label:"Pie",id:"pie"},{label:"Donut",id:"donut"},{label:"Pivot",id:"pivot"},{label:"Table",id:"table"},{label:"Progress",id:"progress"},{label:"Stat",id:"stat"},{label:"Text",id:"text"},{label:"Map",id:"map"}]}}});return(d,v)=>{const m=N.resolveComponent("VsPopover"),_=N.resolveComponent("VsForm"),b=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock("div",null,[N.createVNode(m,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("div",null,[N.createElementVNode("button",{class:"z-50 flex items-center justify-center h-[50px] !w-[50px] text-2xl text-white transition-colors bg-blue-500 rounded-full cursor-pointer hover:bg-blue-700",onClick:v[0]||(v[0]=S=>a.value=!0)},[N.createVNode(Zce,{height:"20",width:"20"})])])]),default:N.withCtx(()=>[v[4]||(v[4]=N.createTextVNode(" Створити віджет "))]),_:1}),N.createVNode(b,{visible:a.value,"onUpdate:visible":v[3]||(v[3]=S=>a.value=S),title:"Створити віджет"},{footer:N.withCtx(()=>[N.createElementVNode("div",Xce,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:v[2]||(v[2]=S=>a.value=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Створити ")])]),default:N.withCtx(()=>[N.createElementVNode("div",qce,[N.createVNode(_,{ref_key:"form",ref:s,scheme:h.value,modelValue:o.value,"onUpdate:modelValue":v[1]||(v[1]=S=>o.value=S)},null,8,["scheme","modelValue"])])]),_:1},8,["visible"])])}}},Kce={},Jce={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-box-left-stretch"};function Qce(r,e){return N.openBlock(),N.createElementBlock("svg",Jce,e[0]||(e[0]=[N.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"></path><path d="M9 17h-2"></path><path d="M13 12h-6"></path><path d="M11 7h-4"></path>',5)]))}const ehe=hr(Kce,[["render",Qce]]),the={},rhe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-filter"};function ihe(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("svg",rhe,e[0]||(e[0]=[N.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),N.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const nhe={components:{deleteIcon:uF,editIcon:cF,IconGrid:ehe,IconFilter:hr(the,[["render",ihe]])},watch:{dashboardData(r){var t,i;if(this.formEditValue={title:r==null?void 0:r.title,description:r==null?void 0:r.description,table_name:r==null?void 0:r.table_name,db:r==null?void 0:r.db,public:r==null?void 0:r.public,words:r==null?void 0:r.words},!((t=r==null?void 0:r.panels)!=null&&t.length))return[];const e=(i=r==null?void 0:r.panels)==null?void 0:i.map(n=>{var s,l;const{title:a="",type:o=""}=((l=(s=r==null?void 0:r.widgets)==null?void 0:s.find(h=>(h==null?void 0:h.name)===(n==null?void 0:n.widget)))==null?void 0:l.data)||{};return{title:a,type:o,...n}});this.formGridValue={panels:e},this.formFilterValue={filters:(r==null?void 0:r.filters)||null}}},data(){return{isDeleteConfirm:!1,isFormEdit:!1,isFormGrid:!1,isFormFilter:!1,formEditValue:{},formGridValue:{},formFilterValue:{},editDashboardScheme:[{type:"Text",key:"title",label:"Заголовок",validators:["required"]},{type:"Text",key:"description",label:"Опис"},{type:"Text",key:"table_name",validators:["required"],label:"Назва таблиці"},{type:"Text",key:"words",label:"Ключові слова"},{type:"Text",key:"db",label:"База даних",original:{type:"Text",ua:"Назва",col:8}},{type:"Switcher",key:"public",label:"Публічний",original:{type:"Text",ua:"Назва",col:8}}],editGridScheme:[{type:"DataTable",ua:"Панелі",key:"panels",editable:!1,addition:!1,colModel:[{name:"title",ua:"Назва",type:"Text",key:"col"},{name:"type",ua:"Тип",type:"Text",key:"col",disabled:!0},{name:"widget",type:"Text",ua:"Назва",key:"widget",hiddenCol:!0},{name:"col",ua:"Кількість стовпчиків",type:"Text",key:"col"}]}],editFilterScheme:[{name:"filters",type:"DataTable",colModel:[{ua:"Підпис",type:"Text",key:"label"},{ua:"Тип",type:"Text",key:"type"}]}]}},props:{selected:{type:String,default:()=>""},dashboardData:{type:Object,default:()=>{}},selectedWidgetData:{type:Object,default:()=>{}}},methods:{async editDashboard(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formEdit)==null||e.doValidation(),await vr.put(`/bi-dashboard/${this.selected}`,this.formEditValue),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormEdit=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"при спробі оновити дані виникла помилка"})}},async editDashboardGrid(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formGrid)==null||e.doValidation(),await vr.put(`/bi-dashboard/${this.selected}`,{...this.formEditValue,...this.formGridValue}),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormGrid=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі оновити дані виникла помилка"})}},async editDashboardFilters(){var r,e;try{(e=(r=this.$refs)==null?void 0:r.formFilter)==null||e.doValidation(),await vr.put(`/bi-dashboard/${this.selected}`,{...this.formEditValue,...this.formGridValue,...this.formFilterValue}),await this.$notify({title:"Успішно!",type:"success",message:"Дані успішно оновлено"}),this.isFormFilter=!1,await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі оновити дані виникла помилка"})}},async deleteDashboard(){try{await vr.delete(`/bi-dashboard/${this.selected}`);const r=new URL(window.top.location.href);r.searchParams.delete("dashboard"),r.searchParams.delete("widget"),window.history.pushState({},"",r),await this.$notify({title:"Успішно!",type:"success",message:"Дашборд видалено успішно"}),this.isDeleteConfirm=!1,await this.$emit("update:selected",null),await this.$emit("update-editor")}catch{this.$notify({title:"Помилка!",type:"error",message:"При спробі видалити дашборд виникла помилка"})}}}},ahe={class:"bg-white h-[49px] min-h-[49px] mb-[8px] flex justify-between px-[10px] py-[15px] items-center border-b border-b-solid border-b-gray-200"},ohe={class:"flex items-center gap-2 text-center truncate grow lg:text-start"},she={class:"block text-sm font-semibold leading-4 text-gray-800 truncate"},lhe={class:"text-[12px] text-gray-500"},uhe={key:0,class:"flex"},che={class:"pr-[5px] flex items-center gap-[8px] mr-[5px] flex"},hhe={class:"p-4"},fhe={class:"flex justify-end mt-4 gap-x-3"},dhe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},phe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},vhe={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function ghe(r,e,t,i,n,a){var _,b,S,D,E;const o=N.resolveComponent("IconFilter"),s=N.resolveComponent("VsPopover"),l=N.resolveComponent("IconGrid"),h=N.resolveComponent("editIcon"),f=N.resolveComponent("deleteIcon"),d=N.resolveComponent("VsConfirm"),v=N.resolveComponent("VsForm"),m=N.resolveComponent("VsDialog");return N.openBlock(),N.createElementBlock(N.Fragment,null,[N.createElementVNode("div",ahe,[N.createElementVNode("div",null,[N.createElementVNode("div",ohe,[N.createElementVNode("span",she,N.toDisplayString((_=t.dashboardData)==null?void 0:_.title)+" "+N.toDisplayString((b=t.selectedWidgetData)!=null&&b.title?` / ${(S=t.selectedWidgetData)==null?void 0:S.title}`:""),1),N.createElementVNode("span",lhe,N.toDisplayString((D=t.selectedWidgetData)!=null&&D.table_name?`${(E=t.selectedWidgetData)==null?void 0:E.table_name}`:""),1)])]),t.selected?(N.openBlock(),N.createElementBlock("div",uhe,[N.createElementVNode("div",che,[N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[0]||(e[0]=P=>n.isFormFilter=!0)},[N.createVNode(o,{class:"h-[16px] text-gray-500"})])]),default:N.withCtx(()=>[e[19]||(e[19]=N.createTextVNode(" Редагувати фільтри "))]),_:1}),N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[1]||(e[1]=P=>n.isFormGrid=!0)},[N.createVNode(l,{class:"h-[16px] text-gray-500"})])]),default:N.withCtx(()=>[e[20]||(e[20]=N.createTextVNode(" Редагувати структуру дашборду "))]),_:1}),N.createVNode(s,{placement:"left",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200",onClick:e[2]||(e[2]=P=>n.isFormEdit=!0)},[N.createVNode(h,{class:"h-[16px]"})])]),default:N.withCtx(()=>[e[21]||(e[21]=N.createTextVNode(" Редагувати дашборд "))]),_:1}),N.createVNode(s,{placement:"right",trigger:"hover"},{reference:N.withCtx(()=>[N.createElementVNode("button",{onClick:e[3]||(e[3]=P=>n.isDeleteConfirm=!0),class:"h-[30px] w-[30px] rounded-full bg-gray-100 flex items-center justify-center duration-300 hover:bg-gray-200"},[N.createVNode(f,{class:"h-[16px]"})])]),default:N.withCtx(()=>[e[22]||(e[22]=N.createTextVNode(" Видалити дашборд "))]),_:1})])])):N.createCommentVNode("",!0)]),N.createVNode(d,{visible:n.isDeleteConfirm,"onUpdate:visible":e[6]||(e[6]=P=>n.isDeleteConfirm=P),size:"small",title:"Ви впевнені?"},{default:N.withCtx(()=>[N.createElementVNode("div",hhe,[e[23]||(e[23]=N.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей дашборд? ",-1)),N.createElementVNode("div",fhe,[N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=P=>n.isDeleteConfirm=!1)}," Скасувати "),N.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[5]||(e[5]=(...P)=>a.deleteDashboard&&a.deleteDashboard(...P))}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormEdit,"onUpdate:visible":e[10]||(e[10]=P=>n.isFormEdit=P),title:"Редагувати дашборд"},{footer:N.withCtx(()=>[N.createElementVNode("div",dhe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[8]||(e[8]=P=>n.isFormEdit=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[9]||(e[9]=(...P)=>a.editDashboard&&a.editDashboard(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formEdit",scheme:n.editDashboardScheme,modelValue:n.formEditValue,"onUpdate:modelValue":e[7]||(e[7]=P=>n.formEditValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormGrid,"onUpdate:visible":e[14]||(e[14]=P=>n.isFormGrid=P),title:"Редагувати структуру дашборду"},{footer:N.withCtx(()=>[N.createElementVNode("div",phe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[12]||(e[12]=P=>n.isFormGrid=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[13]||(e[13]=(...P)=>a.editDashboardGrid&&a.editDashboardGrid(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formgrid",scheme:n.editGridScheme,modelValue:n.formGridValue,"onUpdate:modelValue":e[11]||(e[11]=P=>n.formGridValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"]),N.createVNode(m,{visible:n.isFormFilter,"onUpdate:visible":e[18]||(e[18]=P=>n.isFormFilter=P),title:"Редагувати фільтри"},{footer:N.withCtx(()=>[N.createElementVNode("div",vhe,[N.createElementVNode("button",{style:{border:"1px solid #000"},onClick:e[16]||(e[16]=P=>n.isFormFilter=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Скасувати "),N.createElementVNode("button",{onClick:e[17]||(e[17]=(...P)=>a.editDashboardFilters&&a.editDashboardFilters(...P)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:N.withCtx(()=>[N.createVNode(v,{ref:"formFilter",scheme:n.editFilterScheme,modelValue:n.formFilterValue,"onUpdate:modelValue":e[15]||(e[15]=P=>n.formFilterValue=P)},null,8,["scheme","modelValue"])]),_:1},8,["visible"])],64)}const mhe=hr(nhe,[["render",ghe]]),yhe={class:"relative flex-grow h-full"},_he={class:"grid flex-grow w-full grid-cols-12 gap-4 p-[10px] h-[calc(100%-120px)] overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},xhe=hr({__name:"vs-editor",props:{prefix:String,customClass:{type:String,default:()=>"w-screen h-screen"}},setup(r){const e=r;vr.defaults.baseURL=e.prefix||"/api";const t=N.ref(""),i=N.ref(""),n=N.ref(null),a=N.ref(null),o=async()=>{if(!t.value){n.value=null;return}try{const{data:l}=await vr.get(`/bi-dashboard/${t.value}`);n.value=l}catch(l){console.error(l)}},s=N.computed(()=>{var l,h,f;return(f=Array.isArray((l=n.value)==null?void 0:l.widgets)?(h=n.value)==null?void 0:h.widgets:[])==null?void 0:f.find(d=>(d==null?void 0:d.name)===i.value)});return N.watch(t,(l,h)=>{var d,v,m;h&&(i.value="");const f=new URL(window.top.location.href);l?((d=f==null?void 0:f.searchParams)==null||d.set("dashboard",l),(m=(v=window.top)==null?void 0:v.history)==null||m.pushState({},"",f),o()):(f==null||f.searchParams.delete("dashboard"),f==null||f.searchParams.delete("widget"))}),N.onMounted(()=>{const l=new URLSearchParams(window.top.location.search);t.value=l.get("dashboard"),i.value=l.get("widget"),o()}),(l,h)=>{var f;return N.openBlock(),N.createElementBlock("div",{class:N.normalizeClass(["flex w-full h-full",[r.customClass]])},[N.createVNode(vce,{ref:"MenuNativeRouting",prefix:r.prefix,selectedDashboard:t.value,"onUpdate:selectedDashboard":h[0]||(h[0]=d=>t.value=d)},null,8,["prefix","selectedDashboard"]),N.createElementVNode("div",yhe,[N.createVNode(mhe,{selected:t.value,"onUpdate:selected":h[1]||(h[1]=d=>t.value=d),dashboardData:n.value,selectedWidgetData:s.value,prefix:r.prefix,onUpdateEditor:h[2]||(h[2]=()=>{var d;o(),(d=l.$refs.MenuNativeRouting)==null||d.getList()})},null,8,["selected","dashboardData","selectedWidgetData","prefix"]),N.createElementVNode("div",_he,[n.value?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:1},N.renderList(n.value.panels,(d,v)=>{var m;return N.openBlock(),N.createElementBlock("div",{key:v,class:N.normalizeClass([`col-span-${d.col||12}`,"flex flex-col gap-[10px]"])},[(m=d.widgets)!=null&&m.length?(N.openBlock(!0),N.createElementBlock(N.Fragment,{key:0},N.renderList(d.widgets,_=>(N.openBlock(),N.createBlock(qv,{onClick:b=>i.value=_,"onUpdate:currentWidgetData":h[3]||(h[3]=b=>a.value=b),key:_,dashboard:t.value,widget:_,selectedWidget:i.value,"dashboard-widgets":n.value.widgets,class:N.normalizeClass({"border border-blue-500":i.value===_})},null,8,["onClick","dashboard","widget","selectedWidget","dashboard-widgets","class"]))),128)):(N.openBlock(),N.createBlock(qv,{key:1,onClick:_=>i.value=d.widget,"onUpdate:currentWidgetData":h[4]||(h[4]=_=>a.value=_),class:N.normalizeClass(["max-h-[460px] flex flex-col",{"border border-blue-500":i.value===d.widget}]),dashboard:t.value,widget:d.widget,selectedWidget:i.value,"dashboard-widgets":n.value.widgets},null,8,["onClick","class","dashboard","widget","selectedWidget","dashboard-widgets"]))],2)}),128)):(N.openBlock(),N.createBlock(ZC,{key:0,class:"col-span-12"}))]),t.value?(N.openBlock(),N.createBlock(Yce,{key:0,class:"bottom-[10px] left-[10px] absolute",columns:(f=n.value)==null?void 0:f.columns,selectedDashboard:t.value,onUpdateData:o},null,8,["columns","selectedDashboard"])):N.createCommentVNode("",!0)]),N.createVNode(Uce,{selectedWidget:i.value,"onUpdate:selectedWidget":h[5]||(h[5]=d=>i.value=d),selectedWidgetData:s.value,currentWidgetData:a.value,selectedDashboard:t.value,onUpdateData:o},null,8,["selectedWidget","selectedWidgetData","currentWidgetData","selectedDashboard"])],2)}}},[["__scopeId","data-v-4dda1ae7"]]),fF={install:r=>{r.component("VsBar",$C),r.component("VsLine",UC),r.component("VsPie",GC),r.component("VsStat",HC),r.component("VsDashboard",lF),r.component("VsWidget",qv),r.component("VsProgressBar",WC),r.component("VsListBar",O0),r.component("VsPivotTable",qC),r.component("VsEditor",xhe)},components:{VsBar:$C,VsLine:UC,VsPie:GC,VsStat:HC,VsDashboard:lF,VsProgressBar:WC,VsListBar:O0,VsPivotTable:qC,VsWidget:qv}};typeof window<"u"&&(window.v3bi=fF);const bhe={name:"VsNumber",mixins:[da],data(){return{number:""}},computed:{formattedNumber(){return _6(this.number)},prefix(){var r,e;return(r=this.styleData)!=null&&r.prefix?(e=this.styleData)==null?void 0:e.prefix:""}},watch:{sourceData:{async handler(){this.getNumber()},deep:!0}},async mounted(){await this.getData(),this.getNumber()},methods:{onChangedData(){try{this.sourceData&&this.getNumber()}catch(r){console.error(r)}},async getNumber(){var r,e;try{this.number=((e=this.sourceData[0])==null?void 0:e[Object.keys((r=this.sourceData)==null?void 0:r[0])])||0}catch(t){console.error(t)}}}},whe={class:"text-lg lg:text-xl xl:text-2xl text-gray-800 h-[32px] flex items-center"};function She(r,e,t,i,n,a){return N.openBlock(),N.createElementBlock("div",whe,N.toDisplayString(a.prefix)+N.toDisplayString(a.formattedNumber),1)}const The=Object.freeze(Object.defineProperty({__proto__:null,default:hr(bhe,[["render",She]])},Symbol.toStringTag,{value:"Module"}));function XC(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let nh=XC();function dF(r){nh=r}const pF=/[&<>"']/,Che=new RegExp(pF.source,"g"),vF=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Dhe=new RegExp(vF.source,"g"),Ahe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},gF=r=>Ahe[r];function Ea(r,e){if(e){if(pF.test(r))return r.replace(Che,gF)}else if(vF.test(r))return r.replace(Dhe,gF);return r}const Ihe=/(^|[^\[])\^/g;function ii(r,e){let t=typeof r=="string"?r:r.source;e=e||"";const i={replace:(n,a)=>{let o=typeof a=="string"?a:a.source;return o=o.replace(Ihe,"$1"),t=t.replace(n,o),i},getRegex:()=>new RegExp(t,e)};return i}function mF(r){try{r=encodeURI(r).replace(/%25/g,"%")}catch{return null}return r}const Xv={exec:()=>null};function yF(r,e){const t=r.replace(/\|/g,(a,o,s)=>{let l=!1,h=o;for(;--h>=0&&s[h]==="\\";)l=!l;return l?"|":" |"}),i=t.split(/ \|/);let n=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function Yv(r,e,t){const i=r.length;if(i===0)return"";let n=0;for(;n<i&&r.charAt(i-n-1)===e;)n++;return r.slice(0,i-n)}function Mhe(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<r.length;i++)if(r[i]==="\\")i++;else if(r[i]===e[0])t++;else if(r[i]===e[1]&&(t--,t<0))return i;return-1}function _F(r,e,t,i){const n=e.href,a=e.title?Ea(e.title):null,o=r[1].replace(/\\([\[\]])/g,"$1");if(r[0].charAt(0)!=="!"){i.state.inLink=!0;const s={type:"link",raw:t,href:n,title:a,text:o,tokens:i.inlineTokens(o)};return i.state.inLink=!1,s}return{type:"image",raw:t,href:n,title:a,text:Ea(o)}}function Ehe(r,e){const t=r.match(/^(\s+)(?:```)/);if(t===null)return e;const i=t[1];return e.split(`
101
101
  `).map(n=>{const a=n.match(/^\s+/);if(a===null)return n;const[o]=a;return o.length>=i.length?n.slice(i.length):n}).join(`
102
102
  `)}class B0{constructor(e){hi(this,"options");hi(this,"rules");hi(this,"lexer");this.options=e||nh}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const i=t[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Yv(i,`
103
103
  `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const i=t[0],n=Ehe(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(/#$/.test(i)){const n=Yv(i,"#");(this.options.pedantic||!n||/ $/.test(n))&&(i=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Yv(t[0],`
@@ -45700,7 +45700,8 @@ const QD = [
45700
45700
  "dashboard",
45701
45701
  "title",
45702
45702
  "currentWidget",
45703
- "widgetData"
45703
+ "widgetData",
45704
+ "prefix"
45704
45705
  ],
45705
45706
  data() {
45706
45707
  return {
@@ -45779,7 +45780,7 @@ const QD = [
45779
45780
  this.sourceData = [...this.source], this.styleData = this.style, this.titleCharts = this.title, this.dimensions = Object.keys(((r = this.sourceData) == null ? void 0 : r[0]) || {});
45780
45781
  else {
45781
45782
  this.widgetName = this.widget, this.dashboardName = this.dashboard;
45782
- const t = this.dashboardName ? `/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}` : `/bi-data?&widget=${this.widgetName}`;
45783
+ const t = this.dashboardName ? `${this.prefix || ""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}` : `${this.prefix || ""}/bi-data?&widget=${this.widgetName}`;
45783
45784
  await this.getDataFromURL(t);
45784
45785
  }
45785
45786
  } catch (t) {
@@ -45882,14 +45883,14 @@ const QD = [
45882
45883
  async changeData(r) {
45883
45884
  var t;
45884
45885
  try {
45885
- let e = this.dashboard ? `/bi-data?dashboard=${this.dashboard}&widget=${this.widget}` : `/bi-data?&widget=${this.widget}`;
45886
+ let e = this.dashboard ? `${this.prefix || ""}/bi-data?dashboard=${this.dashboard}&widget=${this.widget}` : `${this.prefix || ""}/bi-data?&widget=${this.widget}`;
45886
45887
  (t = r == null ? void 0 : r.granularity) != null && t.length && (e += `&granularity=${r.granularity}`), r != null && r.metrics && (e += `&metrics=${r.metrics}`), this.getDataFromURL(e);
45887
45888
  } catch (e) {
45888
45889
  console.error(e);
45889
45890
  }
45890
45891
  },
45891
45892
  async setFilter(r) {
45892
- const t = `/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}${r || ""}`;
45893
+ const t = `${this.prefix || ""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}${r || ""}`;
45893
45894
  await this.getDataFromURL(t);
45894
45895
  },
45895
45896
  async changeStyle(r, t) {
@@ -46596,19 +46597,19 @@ const g_ = /* @__PURE__ */ jt(Mj, [["render", kj]]), Nj = /* @__PURE__ */ Object
46596
46597
  }
46597
46598
  }, Fj = {
46598
46599
  "bi-bar": nr(() => Promise.resolve().then(() => Yq)),
46599
- "bi-number": nr(() => import("./vs-number-amN4sYu6.js")),
46600
- "bi-text": nr(() => import("./vs-text-DJpxMHE3.js")),
46600
+ "bi-number": nr(() => import("./vs-number-CnPxB9Zt.js")),
46601
+ "bi-text": nr(() => import("./vs-text-DUHwwnnV.js")),
46601
46602
  "bi-listbar": nr(() => Promise.resolve().then(() => Nj)),
46602
46603
  "bi-pie": nr(() => Promise.resolve().then(() => jq)),
46603
- "bi-donut": nr(() => import("./vs-donut-QxB7xUy1.js")),
46604
+ "bi-donut": nr(() => import("./vs-donut-B-KfTP_b.js")),
46604
46605
  "bi-line": nr(() => Promise.resolve().then(() => tj)),
46605
46606
  "bi-stat": nr(() => Promise.resolve().then(() => pj)),
46606
46607
  "bi-pivot": nr(() => Promise.resolve().then(() => QK)),
46607
46608
  "bi-progress": nr(() => Promise.resolve().then(() => Aj)),
46608
- "bi-funnel": nr(() => import("./vs-funnel-bar-BBWwOerT.js")),
46609
- "bi-map": nr(() => import("./vs-map-DYBDyDP3.js")),
46610
- "bi-cluster": nr(() => import("./vs-map-cluster-BM_cd8Xs.js")),
46611
- "bi-table": nr(() => import("./vs-table-Bm5TzNWN.js"))
46609
+ "bi-funnel": nr(() => import("./vs-funnel-bar-DSTBJljM.js")),
46610
+ "bi-map": nr(() => import("./vs-map-DKyZvjn9.js")),
46611
+ "bi-cluster": nr(() => import("./vs-map-cluster-CkJhoifg.js")),
46612
+ "bi-table": nr(() => import("./vs-table-B7EHFI8w.js"))
46612
46613
  }, Gj = { class: "flex items-center space-x-2" }, Hj = /* @__PURE__ */ xP({
46613
46614
  __name: "vs-bi-switch",
46614
46615
  props: /* @__PURE__ */ cc({
@@ -46833,8 +46834,9 @@ function oK(r, t, e, n, a, i) {
46833
46834
  "onUpdate:widgetData": t[2] || (t[2] = (v) => a.widgetData = v),
46834
46835
  ref: "chart",
46835
46836
  dashboard: e.dashboard,
46837
+ prefix: e.prefix,
46836
46838
  widget: e.widget
46837
- }, null, 40, ["currentWidget", "widgetData", "dashboard", "widget"])) : (X(), _e(u, {
46839
+ }, null, 40, ["currentWidget", "widgetData", "dashboard", "prefix", "widget"])) : (X(), _e(u, {
46838
46840
  key: 1,
46839
46841
  class: "w-full h-full"
46840
46842
  }))
@@ -1,5 +1,5 @@
1
1
  import { createElementBlock as Bt, openBlock as Ft, createElementVNode as lt, createStaticVNode as Gp, resolveComponent as Uo, createCommentVNode as jo, createVNode as $o, toDisplayString as Ls, Fragment as ou, renderList as lu, normalizeStyle as Gh, normalizeClass as cu, withDirectives as Hp, vShow as Xp } from "vue";
2
- import { _ as gn, V as Wp } from "./import-file-nBKuPZWn.js";
2
+ import { _ as gn, V as Wp } from "./import-file-SGbMr5Cs.js";
3
3
  const Kp = {}, Jp = {
4
4
  class: "shrink-0 size-3",
5
5
  xmlns: "http://www.w3.org/2000/svg",
@@ -1,4 +1,4 @@
1
- import { _ as y, c as D, i as g, a as c, b as h, P as l } from "./import-file-nBKuPZWn.js";
1
+ import { _ as y, c as D, i as g, a as c, b as h, P as l } from "./import-file-SGbMr5Cs.js";
2
2
  import { createElementBlock as b, openBlock as x } from "vue";
3
3
  const _ = {
4
4
  name: "VsPie",
@@ -1,4 +1,4 @@
1
- import { _ as n, c, i as h, b as o, d as l, a as d } from "./import-file-nBKuPZWn.js";
1
+ import { _ as n, c, i as h, b as o, d as l, a as d } from "./import-file-SGbMr5Cs.js";
2
2
  import { createElementBlock as p, openBlock as u } from "vue";
3
3
  const m = {
4
4
  name: "VsFunnelBar",
@@ -1,5 +1,5 @@
1
- import { l as g, m as M } from "./map-component-mixin-eyru7mUO.js";
2
- import { _ as w, c as y } from "./import-file-nBKuPZWn.js";
1
+ import { l as g, m as M } from "./map-component-mixin-DRaF15KA.js";
2
+ import { _ as w, c as y } from "./import-file-SGbMr5Cs.js";
3
3
  import { resolveComponent as i, createElementBlock as _, openBlock as u, createElementVNode as r, createBlock as V, createCommentVNode as v, createVNode as d } from "vue";
4
4
  const x = {
5
5
  mixins: [y, g, M],
@@ -1,5 +1,5 @@
1
- import { l as w, m as V, p as _ } from "./map-component-mixin-eyru7mUO.js";
2
- import { _ as v, c as C } from "./import-file-nBKuPZWn.js";
1
+ import { l as w, m as V, p as _ } from "./map-component-mixin-DRaF15KA.js";
2
+ import { _ as v, c as C } from "./import-file-SGbMr5Cs.js";
3
3
  import { resolveComponent as a, createElementBlock as $, openBlock as h, createVNode as s, createElementVNode as u, createBlock as x, createCommentVNode as L } from "vue";
4
4
  const k = {
5
5
  mixins: [C, w, V],
@@ -1,4 +1,4 @@
1
- import { _ as c, c as o, f as n } from "./import-file-nBKuPZWn.js";
1
+ import { _ as c, c as o, f as n } from "./import-file-SGbMr5Cs.js";
2
2
  import { createElementBlock as i, openBlock as m, toDisplayString as s } from "vue";
3
3
  const u = {
4
4
  name: "VsNumber",
@@ -1,4 +1,4 @@
1
- import { _ as m, c as f, d as _, a as b } from "./import-file-nBKuPZWn.js";
1
+ import { _ as m, c as f, d as _, a as b } from "./import-file-SGbMr5Cs.js";
2
2
  import { createElementBlock as a, openBlock as r, createElementVNode as s, Fragment as n, renderList as c, toDisplayString as d } from "vue";
3
3
  const x = {
4
4
  name: "VsTable",
@@ -1,7 +1,7 @@
1
1
  var ge = Object.defineProperty;
2
2
  var ke = (c, e, t) => e in c ? ge(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
3
3
  var k = (c, e, t) => ke(c, typeof e != "symbol" ? e + "" : e, t);
4
- import { _ as de, c as xe } from "./import-file-nBKuPZWn.js";
4
+ import { _ as de, c as xe } from "./import-file-SGbMr5Cs.js";
5
5
  import { createElementBlock as V, openBlock as J, createCommentVNode as be } from "vue";
6
6
  function Q() {
7
7
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/bi",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "BI data visualization module",
5
5
  "main": "dist/bi.js",
6
6
  "browser": "dist/bi.umd.cjs",