@opengis/bi 1.2.20 → 1.2.21

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.umd.cjs CHANGED
@@ -1,9 +1,9 @@
1
- (function(z,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(z=typeof globalThis<"u"?globalThis:z||self,e(z.bi={},z.Vue))})(this,function(z,e){"use strict";var Ni=Object.defineProperty;var Si=(z,e,X)=>e in z?Ni(z,e,{enumerable:!0,configurable:!0,writable:!0,value:X}):z[e]=X;var S=(z,e,X)=>Si(z,typeof e!="symbol"?e+"":e,X);/**
1
+ (function(z,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(z=typeof globalThis<"u"?globalThis:z||self,e(z.bi={},z.Vue))})(this,function(z,e){"use strict";var Ci=Object.defineProperty;var Di=(z,e,X)=>e in z?Ci(z,e,{enumerable:!0,configurable:!0,writable:!0,value:X}):z[e]=X;var S=(z,e,X)=>Di(z,typeof e!="symbol"?e+"":e,X);/**
2
2
  * @license lucide-vue-next v0.546.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const X=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ss=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),rs=s=>{const t=ss(s);return t.charAt(0).toUpperCase()+t.slice(1)},ns=(...s)=>s.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Ue=s=>s==="";/**
6
+ */const X=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ts=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),ss=s=>{const t=ts(s);return t.charAt(0).toUpperCase()+t.slice(1)},rs=(...s)=>s.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),Ue=s=>s==="";/**
7
7
  * @license lucide-vue-next v0.546.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
@@ -13,32 +13,32 @@
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const os=({name:s,iconNode:t,absoluteStrokeWidth:r,"absolute-stroke-width":n,strokeWidth:o,"stroke-width":l,size:a=se.width,color:i=se.stroke,...c},{slots:p})=>e.h("svg",{...se,...c,width:a,height:a,stroke:i,"stroke-width":Ue(r)||Ue(n)||r===!0||n===!0?Number(o||l||se["stroke-width"])*24/Number(a):o||l||se["stroke-width"],class:ns("lucide",c.class,...s?[`lucide-${X(rs(s))}-icon`,`lucide-${X(s)}`]:["lucide-icon"])},[...t.map(d=>e.h(...d)),...p.default?[p.default()]:[]]);/**
16
+ */const ns=({name:s,iconNode:t,absoluteStrokeWidth:r,"absolute-stroke-width":n,strokeWidth:o,"stroke-width":l,size:a=se.width,color:i=se.stroke,...c},{slots:p})=>e.h("svg",{...se,...c,width:a,height:a,stroke:i,"stroke-width":Ue(r)||Ue(n)||r===!0||n===!0?Number(o||l||se["stroke-width"])*24/Number(a):o||l||se["stroke-width"],class:rs("lucide",c.class,...s?[`lucide-${X(ss(s))}-icon`,`lucide-${X(s)}`]:["lucide-icon"])},[...t.map(d=>e.h(...d)),...p.default?[p.default()]:[]]);/**
17
17
  * @license lucide-vue-next v0.546.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const M=(s,t)=>(r,{slots:n,attrs:o})=>e.h(os,{...o,...r,iconNode:t,name:s},n);/**
21
+ */const M=(s,t)=>(r,{slots:n,attrs:o})=>e.h(ns,{...o,...r,iconNode:t,name:s},n);/**
22
22
  * @license lucide-vue-next v0.546.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const as=M("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
26
+ */const os=M("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
27
27
  * @license lucide-vue-next v0.546.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const ls=M("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);/**
31
+ */const as=M("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);/**
32
32
  * @license lucide-vue-next v0.546.0 - ISC
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const is=M("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
36
+ */const ls=M("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
37
37
  * @license lucide-vue-next v0.546.0 - ISC
38
38
  *
39
39
  * This source code is licensed under the ISC license.
40
40
  * See the LICENSE file in the root directory of this source tree.
41
- */const ve=M("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);/**
41
+ */const is=M("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);/**
42
42
  * @license lucide-vue-next v0.546.0 - ISC
43
43
  *
44
44
  * This source code is licensed under the ISC license.
@@ -78,7 +78,7 @@
78
78
  *
79
79
  * This source code is licensed under the ISC license.
80
80
  * See the LICENSE file in the root directory of this source tree.
81
- */const He=M("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
81
+ */const ve=M("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
82
82
  * @license lucide-vue-next v0.546.0 - ISC
83
83
  *
84
84
  * This source code is licensed under the ISC license.
@@ -103,9 +103,9 @@
103
103
  *
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
- */const Ge=M("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Ce={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},ks=["onClick"],ws={class:"flex items-center justify-between w-full"},_s={key:0},$s=e.defineComponent({__name:"vs-bi-dropdown",props:{title:{},options:{},value:{default:null}},emits:["selected"],setup(s,{emit:t}){const r=s,n=t,o=e.ref(!1),l=e.ref(r.value??null),a=e.ref(null),i=e.computed(()=>{const g=r.options;return typeof g=="string"?g.split(",").map((u,x)=>({id:x,text:u.trim()})):Array.isArray(g)?g:[]}),c=e.computed(()=>{const g=i.value.find(u=>(u.id??u)===l.value);return g?g.text??String(g):r.title??""}),p=g=>{const u=(g==null?void 0:g.id)??g;l.value=u,o.value=!1,n("selected",u),document.removeEventListener("click",d)},d=g=>{a.value&&!a.value.contains(g.target)&&(o.value=!1,document.removeEventListener("click",d))},h=()=>{o.value=!o.value,o.value?setTimeout(()=>{document.addEventListener("click",d)},200):document.removeEventListener("click",d)},m=g=>(Ce==null?void 0:Ce[g])??g;return e.onUnmounted(()=>{document.removeEventListener("click",d)}),(g,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.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:h},[e.createTextVNode(e.toDisplayString(m(c.value))+" ",1),u[0]||(u[0]=e.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"},[e.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),o.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:a,"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"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x.id||x,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:k=>p(x)},[e.createElementVNode("div",ws,[e.createElementVNode("span",null,e.toDisplayString(m(x.text||x)),1),l.value===(x.id||x)?(e.openBlock(),e.createElementBlock("span",_s,u[1]||(u[1]=[e.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"},[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)]))):e.createCommentVNode("",!0)])],8,ks))),128))],512)):e.createCommentVNode("",!0)],64))}}),Vs={class:"flex items-center space-x-2"},Es=e.defineComponent({__name:"vs-bi-switch",props:e.mergeModels({leftLabel:{},rightLabel:{},modelValue:{type:Boolean}},{modelValue:{default:()=>!1,type:Boolean},modelModifiers:{}}),emits:e.mergeModels(["update:is-enabled"],["update:modelValue"]),setup(s,{emit:t}){const r=t,n=e.useModel(s,"modelValue"),o=()=>{r("update:is-enabled",n)};return(l,a)=>(e.openBlock(),e.createElementBlock("div",Vs,[l.leftLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["transition-colors",{"text-blue-500":!n.value}])},e.toDisplayString(l.leftLabel),3)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=i=>n.value=i),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:o},null,544),[[e.vModelCheckbox,n.value]]),l.rightLabel?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["transition-colors",{"text-blue-500":n.value}])},e.toDisplayString(l.rightLabel),3)):e.createCommentVNode("",!0)]))}}),D=(s,t)=>{const r=s.__vccOpts||s;for(const[n,o]of t)r[n]=o;return r},Cs={},Bs={class:"flex items-center justify-center h-full"};function Ds(s,t){return e.openBlock(),e.createElementBlock("div",Bs,t[0]||(t[0]=[e.createElementVNode("div",{class:"text-center text-gray-500"},[e.createElementVNode("h2",{class:"text-2xl font-bold"},"No data available")],-1)]))}const Ns=D(Cs,[["render",Ds]]),Ze={"bi-bar":e.defineAsyncComponent(()=>Promise.resolve().then(()=>No)),"bi-number":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Wa)),"bi-text":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Ga)),"bi-listbar":e.defineAsyncComponent(()=>Promise.resolve().then(()=>_a)),"bi-pie":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Po)),"bi-donut":e.defineAsyncComponent(()=>Promise.resolve().then(()=>To)),"bi-line":e.defineAsyncComponent(()=>Promise.resolve().then(()=>jo)),"bi-stat":e.defineAsyncComponent(()=>Promise.resolve().then(()=>sa)),"bi-pivot":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Ra)),"bi-progress":e.defineAsyncComponent(()=>Promise.resolve().then(()=>ua)),"bi-funnel":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Ka)),"bi-map":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Ql)),"bi-cluster":e.defineAsyncComponent(()=>Promise.resolve().then(()=>fi)),"bi-table":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Di))};let Qe="/api";function ge(s){Qe=s||"/api"}function Ss(s,t){const r=Qe.replace(/\/$/,""),o=s.startsWith("http")||s.startsWith("//")||r&&s.startsWith(r)?s:`${r}${s.startsWith("/")?s:`/${s}`}`;if(!t||!Object.keys(t).length)return o;const l=new URLSearchParams;Object.entries(t).forEach(([i,c])=>{c!==void 0&&c!==""&&l.set(i,String(c))});const a=l.toString();return a?`${o}${o.includes("?")?"&":"?"}${a}`:o}async function be(s,t={}){const{params:r,...n}=t,o=Ss(s,r),l=await fetch(o,{...n,headers:{"Content-Type":"application/json",...n.headers}});if(!l.ok){const i=new Error(l.statusText);throw i.status=l.status,i}const a=await l.text();if(a)try{return JSON.parse(a)}catch{return a}}const T={get(s,t){return be(s,{...t,method:"GET"})},post(s,t){return be(s,{method:"POST",body:t!=null?JSON.stringify(t):void 0})},put(s,t){return be(s,{method:"PUT",body:t!=null?JSON.stringify(t):void 0})},delete(s){return be(s,{method:"DELETE"})}},zs={key:0,class:"text-[16px] flex max-w-full items-center min-h-0 justify-between max-h-[50px] h-fit shrink-0"},Ls={class:"flex items-center justify-between w-full gap-2"},Ts={class:"flex items-center gap-2 min-w-0"},Is={class:"text-gray-800 max-h-[30px] inline-block line-clamp-1 font-semibold"},Ms={class:"flex flex-col justify-end"},Fs={key:0,class:"flex items-center justify-end w-full gap-2"},Ps={class:"w-full h-full"},re=e.defineComponent({__name:"vs-widget",props:{dashboard:{},prefix:{default:""},widget:{},filterURl:{},dashboardWidgets:{},selectedWidget:{}},emits:["update:current-widget-data"],setup(s,{emit:t}){const r=s,n=t,o=e.ref(null),l=e.ref(null),a=e.ref(null),i=e.ref({}),c=e.ref([]),p=e.computed(()=>{var y,b;const f=(y=r.dashboardWidgets)==null?void 0:y.find(_=>_.name===r.widget);return((b=f==null?void 0:f.data)==null?void 0:b.title)??(f==null?void 0:f.title)??""}),d=e.computed(()=>{var y;const f=(y=r.dashboardWidgets)==null?void 0:y.find(b=>b.name===r.widget);return(f==null?void 0:f.type)??"text"}),h=e.computed(()=>{var y;const f=(y=i.value)==null?void 0:y.controls;return!f||typeof f=="boolean"?[]:Object.keys(f).map(b=>({name:b,options:f[b]}))}),m=e.computed(()=>{const f=d.value?`bi-${d.value}`:"";return f&&f in Ze?Ze[f]:null});function g(f,y){var b,_;(_=(b=l.value)==null?void 0:b.changeStyle)==null||_.call(b,f,y)}function u(f,y){const b=c.value.find(_=>_.name===y);b?b.option=f:c.value.push({name:y,option:f}),x()}function x(){var y,b;let f=`/bi-data?dashboard=${r.dashboard}&widget=${r.widget}`;c.value.forEach(_=>{f+=`&${_.name}=${_.option}`}),(b=(y=l.value)==null?void 0:y.getDataFromURL)==null||b.call(y,f)}function k(){const f=a.value;if(f!=null&&f.getDataURL){const y=f.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),b=document.createElement("a");b.href=y,b.download="chart.png",document.body.appendChild(b),b.click(),document.body.removeChild(b)}}return e.onMounted(()=>{r.prefix&&ge(r.prefix)}),e.watch(()=>r.filterURl,f=>{var y,b;f&&((b=(y=l.value)==null?void 0:y.setFilter)==null||b.call(y,f))}),e.watch(()=>r.selectedWidget,(f,y)=>{var b;f!==y&&f===((b=i.value)==null?void 0:b.id)&&n("update:current-widget-data",i.value)}),e.watch(i,(f,y)=>{if((f==null?void 0:f.id)===(y==null?void 0:y.id))return;const b=typeof window<"u"?new URLSearchParams(window.top.location.search).get("widget"):null;b&&b===(f==null?void 0:f.id)&&n("update:current-widget-data",f)},{deep:!0}),(f,y)=>{var b,_,$,w,L,F,R,q,U;return e.openBlock(),e.createElementBlock("div",{ref_key:"widgetRef",ref:o,class:e.normalizeClass(["box-border relative h-full p-4 bg-white border border-gray-200 rounded-xl shadow-sm select-auto",[(_=(b=i.value)==null?void 0:b.style)!=null&&_.height?`max-h-[${(w=($=i.value)==null?void 0:$.style)==null?void 0:w.height}px] h-[${(F=(L=i.value)==null?void 0:L.style)==null?void 0:F.height}px]`:"max-h-[460px]"]])},[["text","cluster","map"].includes(d.value)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",zs,[e.createElementVNode("div",Ls,[e.createElementVNode("div",Ts,[e.createElementVNode("span",Is,e.toDisplayString(p.value),1)]),e.createElementVNode("div",Ms,[(R=h.value)!=null&&R.length?(e.openBlock(),e.createElementBlock("span",Fs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList((q=h.value)==null?void 0:q.filter(V=>(V==null?void 0:V.options)&&(V==null?void 0:V.name)!=="export"),V=>{var v,Z;return e.openBlock(),e.createElementBlock("div",{key:V==null?void 0:V.name},[Array.isArray(V==null?void 0:V.options)?(e.openBlock(),e.createBlock($s,{key:0,title:V==null?void 0:V.name,options:V==null?void 0:V.options,value:((Z=(v=i.value)==null?void 0:v.data)==null?void 0:Z[V==null?void 0:V.name])??null,onSelected:G=>u(G,V==null?void 0:V.name)},null,8,["title","options","value","onSelected"])):typeof V.options=="boolean"?(e.openBlock(),e.createBlock(Es,{key:1,"left-label":V==null?void 0:V.name,"model-value":!!(V!=null&&V.options),"onUpdate:isEnabled":G=>g(V==null?void 0:V.name,G)},null,8,["left-label","model-value","onUpdate:isEnabled"])):e.createCommentVNode("",!0)])}),128)),(U=h.value)!=null&&U.some(V=>(V==null?void 0:V.name)==="export")?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center",onClick:k},[e.createVNode(e.unref(ls),{size:16,class:"text-gray-800"})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])])])),e.createElementVNode("div",Ps,[m.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value),{key:0,ref_key:"chartRef",ref:l,"current-widget":a.value,"onUpdate:currentWidget":y[0]||(y[0]=V=>a.value=V),"widget-data":i.value,"onUpdate:widgetData":y[1]||(y[1]=V=>i.value=V),dashboard:f.dashboard,title:p.value,widget:f.widget},null,40,["current-widget","widget-data","dashboard","title","widget"])):(e.openBlock(),e.createBlock(Ns,{key:1,class:"w-full h-full"}))])],2)}}}),Rs={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},As={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},Os={class:"max-w-sm mx-auto mt-6"},js={class:"font-medium text-gray-800 dark:text-neutral-200"},Ws={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"},ye=e.defineComponent({__name:"vs-new-nodata",props:{title:{default:"Дані для відображення відсутні"},text:{default:"Змініть параметри пошуку або спробуйте пізніше"}},setup(s){return(t,r)=>(e.openBlock(),e.createElementBlock("div",Rs,[e.createElementVNode("div",null,[e.createElementVNode("div",As,[r[0]||(r[0]=e.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)),e.createElementVNode("div",Os,[e.createElementVNode("p",js,e.toDisplayString(t.title),1),e.createElementVNode("p",Ws,e.toDisplayString(t.text),1)])])])]))}}),qs={components:{filterIcon:{__name:"filter",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ve),e.mergeProps(t.$attrs,{size:24}),null,16))}}},props:["filterScheme"],emits:["filters:changed"]},Us={class:"flex items-center"},vs={key:0,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 opacity-60 cursor-not-allowed",disabled:"",title:"Фільтри вимкнено (v3-filter видалено)"};function Hs(s,t,r,n,o,l){const a=e.resolveComponent("filterIcon");return e.openBlock(),e.createElementBlock("div",Us,[r.filterScheme?(e.openBlock(),e.createElementBlock("button",vs,[e.createVNode(a),t[0]||(t[0]=e.createTextVNode(" Фільтри "))])):e.createCommentVNode("",!0)])}const Gs={components:{VsFilterHeader:D(qs,[["render",Hs]])},props:{dashboardData:{type:Object,default:null},filters:{type:Array,default:null}}},Zs={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 rounded-xl mb-2 pt-[3px] justify-between items-center"},Qs={class:"grow"},Xs={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},Ks={key:0,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"},Js={key:0,class:"flex items-center gap-3"};function Ys(s,t,r,n,o,l){var i,c,p;const a=e.resolveComponent("VsFilterHeader");return e.openBlock(),e.createElementBlock("div",Zs,[e.createElementVNode("div",Qs,[e.createElementVNode("h1",Xs,e.toDisplayString((i=r.dashboardData)==null?void 0:i.title),1),(c=r.dashboardData)!=null&&c.description?(e.openBlock(),e.createElementBlock("button",Ks,e.toDisplayString((p=r.dashboardData)==null?void 0:p.description),1)):e.createCommentVNode("",!0)]),r.filters?(e.openBlock(),e.createElementBlock("div",Js,[e.createVNode(a,{filterScheme:r.filters,"onFilters:changed":t[0]||(t[0]=d=>s.$emit("filters:changed",d))},null,8,["filterScheme"])])):e.createCommentVNode("",!0)])}const er=D(Gs,[["render",Ys]]);var Xe={},Ke;(function(s){s.pop="pop",s.push="push"})(Ke||(Ke={}));var Je;(function(s){s.back="back",s.forward="forward",s.unknown=""})(Je||(Je={}));var Ye;(function(s){s[s.aborted=4]="aborted",s[s.cancelled=8]="cancelled",s[s.duplicated=16]="duplicated"})(Ye||(Ye={}));const tr=Symbol(Xe.NODE_ENV!=="production"?"router":""),sr=Symbol(Xe.NODE_ENV!=="production"?"route location":"");function Be(){return e.inject(tr)}function rr(s){return e.inject(sr)}const nr={key:0,class:"text-gray-400 shrink-0"},or=["onClick"],ar=["onClick"],lr={key:4,class:"text-gray-900 font-medium truncate"},et={__name:"vs-breadcrumbs",props:{items:{type:Array,default:()=>[]},compact:{type:Boolean,default:!1}},setup(s){const t=s,r=Be(),n=e.computed(()=>Array.isArray(t.items)?t.items:[]);function o(l){r!=null&&r.push?r.push(l):typeof l=="string"&&(window!=null&&window.location)&&(window.location.href=l)}return(l,a)=>{const i=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(["flex items-center gap-2 text-sm text-gray-600",s.compact?"py-1":"py-6"]),"aria-label":"Breadcrumb"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(c,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[p>0?(e.openBlock(),e.createElementBlock("span",nr,[e.createVNode(e.unref(as),{class:"w-4 h-4"})])):e.createCommentVNode("",!0),typeof c.onClick=="function"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"hover:text-gray-900 transition-colors cursor-pointer",onClick:d=>c.onClick()},e.toDisplayString(c.label),9,or)):e.unref(r)&&c.to?(e.openBlock(),e.createBlock(i,{key:2,to:c.to,class:"hover:text-gray-900 transition-colors"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["to"])):c.to?(e.openBlock(),e.createElementBlock("span",{key:3,class:"hover:text-gray-900 transition-colors cursor-pointer",onClick:d=>o(c.to)},e.toDisplayString(c.label),9,ar)):(e.openBlock(),e.createElementBlock("span",lr,e.toDisplayString(c.label),1))],64))),128))],2)}}},ir={components:{VsWidget:re,VsNewNodata:ye,VsHeader:er,VsBreadcrumbs:et},props:["id","prefix"],data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},async mounted(){ge(this.prefix||"/api"),await this.fetchData()},methods:{async fetchData(){if(this.id)try{const s=await T.get(`/bi-dashboard/${this.id}`);this.dashboardData=s}catch(s){console.error(s)}},columnClass(s){const t=s!=null&&s.col?s==null?void 0:s.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"}[t]||"w-full"},async filterHandler(s){var r;this.filterURl="";let t="&filter=";(r=s==null?void 0:s.url)!=null&&r.length&&(s.url.split("|").forEach(o=>{const l=o.split("=");t+=`${l[0]}=${l[1]}`}),this.filterURl+=t)}}},cr={class:"w-full pb-8 overflow-y-auto mx-auto"},dr={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function pr(s,t,r,n,o,l){var c;const a=e.resolveComponent("VsNewNodata"),i=e.resolveComponent("VsWidget");return e.openBlock(),e.createElementBlock("div",cr,[e.createElementVNode("div",dr,[o.error||!o.dashboardData?(e.openBlock(),e.createBlock(a,{key:0,class:"col-span-12"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(((c=o.dashboardData)==null?void 0:c.panels)||[],(p,d)=>{var h;return e.openBlock(),e.createElementBlock("div",{key:d,class:e.normalizeClass([`col-span-${p.col||12}`,"flex flex-col gap-[10px]"])},[(h=p.widgets)!=null&&h.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(p.widgets,m=>(e.openBlock(),e.createBlock(i,{key:m,dashboard:r.id,widget:m,"dashboard-widgets":o.dashboardData.widgets,"filter-u-rl":o.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))),128)):(e.openBlock(),e.createBlock(i,{key:1,class:"flex flex-col",dashboard:r.id,widget:p.widget,"dashboard-widgets":o.dashboardData.widgets,"filter-u-rl":o.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))],2)}),128))])])}const hr=D(ir,[["render",pr]]),mr={key:0,class:"vs-modal-wrapper fixed inset-0 flex items-center justify-center p-4"},ur={class:"flex items-center justify-between shrink-0 py-2.5 px-4 border-b border-gray-200 dark:border-[#454545]"},fr={class:"font-medium text-gray-800 dark:text-white"},gr={class:"vs-modal-content flex-1 min-h-0 overflow-auto p-4"},br={key:0,class:"shrink-0 border-t border-gray-200 dark:border-neutral-700"},ne=D({__name:"vs-modal",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},size:{type:String,default:"medium"},closeClickBack:{type:Boolean,default:!1},teleport:{type:String,default:"#modal"}},emits:["close","update:visible"],setup(s,{emit:t}){const r=s,n=t,o=e.computed(()=>r.size==="small"?"md:max-w-[40%] w-full max-w-md":r.size==="lg"?"md:max-w-[70%] w-full max-w-4xl":"md:max-w-[50%] w-full max-w-lg");function l(){n("update:visible",!1),n("close")}function a(i){i.key==="Escape"&&l()}return e.onMounted(()=>{window.addEventListener("keydown",a)}),e.onUnmounted(()=>{window.removeEventListener("keydown",a)}),(i,c)=>(e.openBlock(),e.createBlock(e.Teleport,{to:s.teleport},[s.visible?(e.openBlock(),e.createElementBlock("div",mr,[e.createElementVNode("div",{class:"absolute inset-0 bg-black/50","aria-hidden":"true",onMousedown:c[0]||(c[0]=p=>s.closeClickBack&&p.target===p.currentTarget&&l())},null,32),e.createVNode(e.Transition,{name:"vs-modal",appear:""},{default:e.withCtx(()=>[s.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["vs-modal-panel relative flex flex-col bg-white dark:bg-[#1A1A1A] rounded-xl shadow-xl max-h-[85vh] min-w-0 border border-gray-200 dark:border-[#454545]",o.value]),role:"dialog","aria-modal":"true",onMousedown:c[1]||(c[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",ur,[e.createElementVNode("h3",fr,e.toDisplayString(s.title),1),e.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center rounded-full bg-gray-100 text-gray-800 hover:bg-gray-200 dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-300","aria-label":"Закрити",onClick:l},c[2]||(c[2]=[e.createElementVNode("svg",{class:"w-4 h-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e.createElementVNode("div",gr,[e.renderSlot(i.$slots,"default",{},void 0,!0)]),i.$slots.footer?(e.openBlock(),e.createElementBlock("div",br,[e.renderSlot(i.$slots,"footer",{},void 0,!0)])):e.createCommentVNode("",!0)],34)):e.createCommentVNode("",!0)]),_:3})])):e.createCommentVNode("",!0)],8,["to"]))}},[["__scopeId","data-v-5722a50f"]]),yr={__name:"icon-plus",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(He),e.mergeProps(t.$attrs,{size:24}),null,16))}},xr={class:"mb-4 overflow-auto scrollbar max-h-96"},kr={__name:"vs-editor-create-widget",props:{columns:{type:Array,default:()=>[]},selectedDashboard:String,inline:{type:Boolean,default:!1}},emits:"update-data",setup(s,{expose:t,emit:r}){var u;const n=e.defineAsyncComponent(()=>import("@opengis/form")),o=(u=e.getCurrentInstance().proxy)==null?void 0:u.$notify,l=r,a=s,i=e.ref(!1),c=e.ref({}),p=e.ref();function d(){i.value=!0}function h(){i.value=!1}t({open:d,close:h});const m=async()=>{try{await p.value.doValidation(),await T.post(`/bi-dashboard/${a.selectedDashboard}`,c.value),await o({type:"success",title:"Успішно!",message:"Віджет успішно створено"}),await l("update-data"),c.value={},i.value=!1}catch{o({type:"error",title:"Помилка!",message:"При спробі створити віджет сталася помилка"})}},g=e.computed(()=>{var x,k,f,y;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:(k=(x=a.columns)==null?void 0:x.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:k.map(({name:b,type:_})=>({id:b,label:b,type:_}))},metric:{type:"radio",label:"Y Axis",view:"buttons",validators:["required"],style:{size:"xs"},options:[{id:"count",label:"count"},...(y=(f=a.columns)==null?void 0:f.filter(b=>(b==null?void 0:b.type)==="numeric"||(b==null?void 0:b.type)==="double precision"))==null?void 0:y.map(({name:b,type:_})=>({id:b,label:b,type:_}))]},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"}]},table:{type:"Text",ua:"Table",placeholder:"Table"},query:{type:"Text",ua:"Query",placeholder:"Query"},cls:{type:"Text",ua:"Cls",placeholder:"Cls"}}});return(x,k)=>{const f=e.resolveComponent("VsPopover");return e.openBlock(),e.createElementBlock("div",null,[s.inline?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(f,{key:0,placement:"right",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("div",null,[e.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:d},[e.createVNode(yr,{height:"20",width:"20"})])])]),default:e.withCtx(()=>[k[1]||(k[1]=e.createTextVNode(" Створити віджет "))]),_:1})),e.createVNode(ne,{teleport:"#modal",visible:i.value,title:"Створити віджет",onClose:h},{footer:e.withCtx(()=>[e.createElementVNode("div",{class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:h,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"}," Скасувати "),e.createElementVNode("button",{onClick:m,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:e.withCtx(()=>[e.createElementVNode("div",xr,[e.createVNode(e.unref(n),{ref_key:"form",ref:p,schema:g.value,values:c.value,"onUpdate:values":k[0]||(k[0]=y=>c.value=y)},null,8,["schema","values"])])]),_:1},8,["visible"])])}}},tt={__name:"delete",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(xs),e.mergeProps(t.$attrs,{size:24}),null,16))}},De={__name:"close",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(Ge),e.mergeProps(t.$attrs,{size:24}),null,16))}},st={__name:"edit",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(fs),e.mergeProps(t.$attrs,{size:24}),null,16))}},wr={class:"space-y-4"},_r={__name:"vs-editor-form-style",props:{widgetName:{type:String},data:{type:Object,default:()=>{}}},setup(s,{expose:t}){var u,x,k,f,y,b;const r=e.defineAsyncComponent(()=>import("@opengis/form")),{$notify:n}=e.getCurrentInstance().proxy,o=s,l=e.ref(null),a={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"}]}},i={show:{label:"Legend",type:"switcher",title:"Show legend"}},c={show:{label:"Tooltip ",type:"switcher",title:"Show tooltip"}},p=e.ref({...((x=(u=o.data)==null?void 0:u.style)==null?void 0:x.label)||{}}),d=e.ref({...((f=(k=o.data)==null?void 0:k.style)==null?void 0:f.legend)||{}}),h=e.ref({...((b=(y=o.data)==null?void 0:y.style)==null?void 0:b.tooltip)||{}}),m=()=>{const _=new CustomEvent(`update-style-${o.widgetName}`);_.chartId=o.widgetName,_.options={options:{legend:d.value,tooltip:h.value,label:p.value},seriesOptions:p.value},window.dispatchEvent(_)};e.watch(p,m,{deep:!0}),e.watch(d,m,{deep:!0}),e.watch(h,m,{deep:!0});const g=async()=>{try{await T.put(`/bi-dashboard/${l.value}/${o.widgetName}`,{style:{legend:d.value,tooltip:h.value,label:p.value}});const _=new CustomEvent(`update-style-${o.widgetName}`);_.chartId=o.widgetName,_.options={options:{legend:d.value,tooltip:h.value,label:p.value},seriesOptions:p.value},window.dispatchEvent(_),n({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{n({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.onMounted(()=>{const _=new URLSearchParams(window.top.location.search);l.value=_.get("dashboard")}),t({requestUpdateWidget:g}),(_,$)=>(e.openBlock(),e.createElementBlock("div",wr,[e.createVNode(e.unref(r),{schema:a,values:p.value,"onUpdate:values":$[0]||($[0]=w=>p.value=w),class:"p-0"},null,8,["values"]),e.createVNode(e.unref(r),{schema:i,values:d.value,"onUpdate:values":$[1]||($[1]=w=>d.value=w),class:"p-0"},null,8,["values"]),e.createVNode(e.unref(r),{schema:c,values:h.value,"onUpdate:values":$[2]||($[2]=w=>h.value=w),class:"p-0"},null,8,["values"])]))}};function Ne(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let K=Ne();function rt(s){K=s}const nt=/[&<>"']/,$r=new RegExp(nt.source,"g"),ot=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Vr=new RegExp(ot.source,"g"),Er={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},at=s=>Er[s];function A(s,t){if(t){if(nt.test(s))return s.replace($r,at)}else if(ot.test(s))return s.replace(Vr,at);return s}const Cr=/(^|[^\[])\^/g;function N(s,t){let r=typeof s=="string"?s:s.source;t=t||"";const n={replace:(o,l)=>{let a=typeof l=="string"?l:l.source;return a=a.replace(Cr,"$1"),r=r.replace(o,a),n},getRegex:()=>new RegExp(r,t)};return n}function lt(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}const oe={exec:()=>null};function it(s,t){const r=s.replace(/\|/g,(l,a,i)=>{let c=!1,p=a;for(;--p>=0&&i[p]==="\\";)c=!c;return c?"|":" |"}),n=r.split(/ \|/);let o=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;o<n.length;o++)n[o]=n[o].trim().replace(/\\\|/g,"|");return n}function ae(s,t,r){const n=s.length;if(n===0)return"";let o=0;for(;o<n&&s.charAt(n-o-1)===t;)o++;return s.slice(0,n-o)}function Br(s,t){if(s.indexOf(t[1])===-1)return-1;let r=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===t[0])r++;else if(s[n]===t[1]&&(r--,r<0))return n;return-1}function ct(s,t,r,n){const o=t.href,l=t.title?A(t.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const i={type:"link",raw:r,href:o,title:l,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,i}return{type:"image",raw:r,href:o,title:l,text:A(a)}}function Dr(s,t){const r=s.match(/^(\s+)(?:```)/);if(r===null)return t;const n=r[1];return t.split(`
106
+ */const He=M("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Be={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},ks=["onClick"],ws={class:"flex items-center justify-between w-full"},_s={key:0},$s=e.defineComponent({__name:"vs-bi-dropdown",props:{title:{},options:{},value:{default:null}},emits:["selected"],setup(s,{emit:t}){const r=s,n=t,o=e.ref(!1),l=e.ref(r.value??null),a=e.ref(null),i=e.computed(()=>{const f=r.options;return typeof f=="string"?f.split(",").map((m,x)=>({id:x,text:m.trim()})):Array.isArray(f)?f:[]}),c=e.computed(()=>{const f=i.value.find(m=>(m.id??m)===l.value);return f?f.text??String(f):r.title??""}),p=f=>{const m=(f==null?void 0:f.id)??f;l.value=m,o.value=!1,n("selected",m),document.removeEventListener("click",d)},d=f=>{a.value&&!a.value.contains(f.target)&&(o.value=!1,document.removeEventListener("click",d))},h=()=>{o.value=!o.value,o.value?setTimeout(()=>{document.addEventListener("click",d)},200):document.removeEventListener("click",d)},g=f=>(Be==null?void 0:Be[f])??f;return e.onUnmounted(()=>{document.removeEventListener("click",d)}),(f,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.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:h},[e.createTextVNode(e.toDisplayString(g(c.value))+" ",1),m[0]||(m[0]=e.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"},[e.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),o.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:a,"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"}},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x.id||x,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:k=>p(x)},[e.createElementVNode("div",ws,[e.createElementVNode("span",null,e.toDisplayString(g(x.text||x)),1),l.value===(x.id||x)?(e.openBlock(),e.createElementBlock("span",_s,m[1]||(m[1]=[e.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"},[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)]))):e.createCommentVNode("",!0)])],8,ks))),128))],512)):e.createCommentVNode("",!0)],64))}}),Vs={class:"flex items-center space-x-2"},Es=e.defineComponent({__name:"vs-bi-switch",props:e.mergeModels({leftLabel:{},rightLabel:{},modelValue:{type:Boolean}},{modelValue:{default:()=>!1,type:Boolean},modelModifiers:{}}),emits:e.mergeModels(["update:is-enabled"],["update:modelValue"]),setup(s,{emit:t}){const r=t,n=e.useModel(s,"modelValue"),o=()=>{r("update:is-enabled",n)};return(l,a)=>(e.openBlock(),e.createElementBlock("div",Vs,[l.leftLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["transition-colors",{"text-blue-500":!n.value}])},e.toDisplayString(l.leftLabel),3)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=i=>n.value=i),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:o},null,544),[[e.vModelCheckbox,n.value]]),l.rightLabel?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["transition-colors",{"text-blue-500":n.value}])},e.toDisplayString(l.rightLabel),3)):e.createCommentVNode("",!0)]))}}),D=(s,t)=>{const r=s.__vccOpts||s;for(const[n,o]of t)r[n]=o;return r},Bs={},Cs={class:"flex items-center justify-center h-full"};function Ds(s,t){return e.openBlock(),e.createElementBlock("div",Cs,t[0]||(t[0]=[e.createElementVNode("div",{class:"text-center text-gray-500"},[e.createElementVNode("h2",{class:"text-2xl font-bold"},"No data available")],-1)]))}const Ns=D(Bs,[["render",Ds]]),Ge={"bi-bar":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Co)),"bi-number":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Oa)),"bi-text":e.defineAsyncComponent(()=>Promise.resolve().then(()=>va)),"bi-listbar":e.defineAsyncComponent(()=>Promise.resolve().then(()=>ka)),"bi-pie":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Mo)),"bi-donut":e.defineAsyncComponent(()=>Promise.resolve().then(()=>zo)),"bi-line":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Ao)),"bi-stat":e.defineAsyncComponent(()=>Promise.resolve().then(()=>ea)),"bi-pivot":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Pa)),"bi-progress":e.defineAsyncComponent(()=>Promise.resolve().then(()=>ha)),"bi-funnel":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Qa)),"bi-map":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Gl)),"bi-cluster":e.defineAsyncComponent(()=>Promise.resolve().then(()=>mi)),"bi-table":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Bi))};let Ze="/api";function ge(s){Ze=s||"/api"}function Ss(s,t){const r=Ze.replace(/\/$/,""),o=s.startsWith("http")||s.startsWith("//")||r&&s.startsWith(r)?s:`${r}${s.startsWith("/")?s:`/${s}`}`;if(!t||!Object.keys(t).length)return o;const l=new URLSearchParams;Object.entries(t).forEach(([i,c])=>{c!==void 0&&c!==""&&l.set(i,String(c))});const a=l.toString();return a?`${o}${o.includes("?")?"&":"?"}${a}`:o}async function be(s,t={}){const{params:r,...n}=t,o=Ss(s,r),l=await fetch(o,{...n,headers:{"Content-Type":"application/json",...n.headers}});if(!l.ok){const i=new Error(l.statusText);throw i.status=l.status,i}const a=await l.text();if(a)try{return JSON.parse(a)}catch{return a}}const T={get(s,t){return be(s,{...t,method:"GET"})},post(s,t){return be(s,{method:"POST",body:t!=null?JSON.stringify(t):void 0})},put(s,t){return be(s,{method:"PUT",body:t!=null?JSON.stringify(t):void 0})},delete(s){return be(s,{method:"DELETE"})}},zs={key:0,class:"text-[16px] flex max-w-full items-center min-h-0 justify-between max-h-[50px] h-fit shrink-0"},Ls={class:"flex items-center justify-between w-full gap-2"},Ts={class:"flex items-center gap-2 min-w-0"},Is={class:"text-gray-800 max-h-[30px] inline-block line-clamp-1 font-semibold"},Ms={class:"flex flex-col justify-end"},Ps={key:0,class:"flex items-center justify-end w-full gap-2"},Rs={class:"w-full h-full"},re=e.defineComponent({__name:"vs-widget",props:{dashboard:{},prefix:{default:""},widget:{},filterURl:{},dashboardWidgets:{},selectedWidget:{}},emits:["update:current-widget-data"],setup(s,{emit:t}){const r=s,n=t,o=e.ref(null),l=e.ref(null),a=e.ref(null),i=e.ref({}),c=e.ref([]),p=e.computed(()=>{var y,b;const u=(y=r.dashboardWidgets)==null?void 0:y.find(_=>_.name===r.widget);return((b=u==null?void 0:u.data)==null?void 0:b.title)??(u==null?void 0:u.title)??""}),d=e.computed(()=>{var y;const u=(y=r.dashboardWidgets)==null?void 0:y.find(b=>b.name===r.widget);return(u==null?void 0:u.type)??"text"}),h=e.computed(()=>{var y;const u=(y=i.value)==null?void 0:y.controls;return!u||typeof u=="boolean"?[]:Object.keys(u).map(b=>({name:b,options:u[b]}))}),g=e.computed(()=>{const u=d.value?`bi-${d.value}`:"";return u&&u in Ge?Ge[u]:null});function f(u,y){var b,_;(_=(b=l.value)==null?void 0:b.changeStyle)==null||_.call(b,u,y)}function m(u,y){const b=c.value.find(_=>_.name===y);b?b.option=u:c.value.push({name:y,option:u}),x()}function x(){var y,b;let u=`/bi-data?dashboard=${r.dashboard}&widget=${r.widget}`;c.value.forEach(_=>{u+=`&${_.name}=${_.option}`}),(b=(y=l.value)==null?void 0:y.getDataFromURL)==null||b.call(y,u)}function k(){const u=a.value;if(u!=null&&u.getDataURL){const y=u.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),b=document.createElement("a");b.href=y,b.download="chart.png",document.body.appendChild(b),b.click(),document.body.removeChild(b)}}return e.onMounted(()=>{r.prefix&&ge(r.prefix)}),e.watch(()=>r.filterURl,u=>{var y,b;u&&((b=(y=l.value)==null?void 0:y.setFilter)==null||b.call(y,u))}),e.watch(()=>r.selectedWidget,(u,y)=>{var b;u!==y&&u===((b=i.value)==null?void 0:b.id)&&n("update:current-widget-data",i.value)}),e.watch(i,(u,y)=>{if((u==null?void 0:u.id)===(y==null?void 0:y.id))return;const b=typeof window<"u"?new URLSearchParams(window.top.location.search).get("widget"):null;b&&b===(u==null?void 0:u.id)&&n("update:current-widget-data",u)},{deep:!0}),(u,y)=>{var b,_,$,w,L,P,F,q,U;return e.openBlock(),e.createElementBlock("div",{ref_key:"widgetRef",ref:o,class:e.normalizeClass(["box-border relative h-full p-4 bg-white border border-gray-200 rounded-xl shadow-sm select-auto",[(_=(b=i.value)==null?void 0:b.style)!=null&&_.height?`max-h-[${(w=($=i.value)==null?void 0:$.style)==null?void 0:w.height}px] h-[${(P=(L=i.value)==null?void 0:L.style)==null?void 0:P.height}px]`:"max-h-[460px]"]])},[["text","cluster","map"].includes(d.value)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",zs,[e.createElementVNode("div",Ls,[e.createElementVNode("div",Ts,[e.createElementVNode("span",Is,e.toDisplayString(p.value),1)]),e.createElementVNode("div",Ms,[(F=h.value)!=null&&F.length?(e.openBlock(),e.createElementBlock("span",Ps,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList((q=h.value)==null?void 0:q.filter(V=>(V==null?void 0:V.options)&&(V==null?void 0:V.name)!=="export"),V=>{var v,Z;return e.openBlock(),e.createElementBlock("div",{key:V==null?void 0:V.name},[Array.isArray(V==null?void 0:V.options)?(e.openBlock(),e.createBlock($s,{key:0,title:V==null?void 0:V.name,options:V==null?void 0:V.options,value:((Z=(v=i.value)==null?void 0:v.data)==null?void 0:Z[V==null?void 0:V.name])??null,onSelected:G=>m(G,V==null?void 0:V.name)},null,8,["title","options","value","onSelected"])):typeof V.options=="boolean"?(e.openBlock(),e.createBlock(Es,{key:1,"left-label":V==null?void 0:V.name,"model-value":!!(V!=null&&V.options),"onUpdate:isEnabled":G=>f(V==null?void 0:V.name,G)},null,8,["left-label","model-value","onUpdate:isEnabled"])):e.createCommentVNode("",!0)])}),128)),(U=h.value)!=null&&U.some(V=>(V==null?void 0:V.name)==="export")?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center",onClick:k},[e.createVNode(e.unref(as),{size:16,class:"text-gray-800"})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])])])),e.createElementVNode("div",Rs,[g.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.value),{key:0,ref_key:"chartRef",ref:l,"current-widget":a.value,"onUpdate:currentWidget":y[0]||(y[0]=V=>a.value=V),"widget-data":i.value,"onUpdate:widgetData":y[1]||(y[1]=V=>i.value=V),dashboard:u.dashboard,title:p.value,widget:u.widget},null,40,["current-widget","widget-data","dashboard","title","widget"])):(e.openBlock(),e.createBlock(Ns,{key:1,class:"w-full h-full"}))])],2)}}}),Fs={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},As={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},Os={class:"max-w-sm mx-auto mt-6"},js={class:"font-medium text-gray-800 dark:text-neutral-200"},Ws={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"},ye=e.defineComponent({__name:"vs-new-nodata",props:{title:{default:"Дані для відображення відсутні"},text:{default:"Змініть параметри пошуку або спробуйте пізніше"}},setup(s){return(t,r)=>(e.openBlock(),e.createElementBlock("div",Fs,[e.createElementVNode("div",null,[e.createElementVNode("div",As,[r[0]||(r[0]=e.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)),e.createElementVNode("div",Os,[e.createElementVNode("p",js,e.toDisplayString(t.title),1),e.createElementVNode("p",Ws,e.toDisplayString(t.text),1)])])])]))}}),qs={components:{filterIcon:{__name:"filter",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(is),e.mergeProps(t.$attrs,{size:24}),null,16))}}},props:["filterScheme"],emits:["filters:changed"]},Us={class:"flex items-center"},vs={key:0,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 opacity-60 cursor-not-allowed",disabled:"",title:"Фільтри вимкнено (v3-filter видалено)"};function Hs(s,t,r,n,o,l){const a=e.resolveComponent("filterIcon");return e.openBlock(),e.createElementBlock("div",Us,[r.filterScheme?(e.openBlock(),e.createElementBlock("button",vs,[e.createVNode(a),t[0]||(t[0]=e.createTextVNode(" Фільтри "))])):e.createCommentVNode("",!0)])}const Gs={components:{VsFilterHeader:D(qs,[["render",Hs]])},props:{dashboardData:{type:Object,default:null},filters:{type:Array,default:null}}},Zs={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 rounded-xl mb-2 pt-[3px] justify-between items-center"},Qs={class:"grow"},Xs={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},Js={key:0,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"},Ks={key:0,class:"flex items-center gap-3"};function Ys(s,t,r,n,o,l){var i,c,p;const a=e.resolveComponent("VsFilterHeader");return e.openBlock(),e.createElementBlock("div",Zs,[e.createElementVNode("div",Qs,[e.createElementVNode("h1",Xs,e.toDisplayString((i=r.dashboardData)==null?void 0:i.title),1),(c=r.dashboardData)!=null&&c.description?(e.openBlock(),e.createElementBlock("button",Js,e.toDisplayString((p=r.dashboardData)==null?void 0:p.description),1)):e.createCommentVNode("",!0)]),r.filters?(e.openBlock(),e.createElementBlock("div",Ks,[e.createVNode(a,{filterScheme:r.filters,"onFilters:changed":t[0]||(t[0]=d=>s.$emit("filters:changed",d))},null,8,["filterScheme"])])):e.createCommentVNode("",!0)])}const er=D(Gs,[["render",Ys]]);var Qe={},Xe;(function(s){s.pop="pop",s.push="push"})(Xe||(Xe={}));var Je;(function(s){s.back="back",s.forward="forward",s.unknown=""})(Je||(Je={}));var Ke;(function(s){s[s.aborted=4]="aborted",s[s.cancelled=8]="cancelled",s[s.duplicated=16]="duplicated"})(Ke||(Ke={}));const tr=Symbol(Qe.NODE_ENV!=="production"?"router":""),sr=Symbol(Qe.NODE_ENV!=="production"?"route location":"");function Ce(){return e.inject(tr)}function rr(s){return e.inject(sr)}const nr={key:0,class:"text-gray-400 shrink-0"},or=["onClick"],ar=["onClick"],lr={key:4,class:"text-gray-900 font-medium truncate"},Ye={__name:"vs-breadcrumbs",props:{items:{type:Array,default:()=>[]},compact:{type:Boolean,default:!1}},setup(s){const t=s,r=Ce(),n=e.computed(()=>Array.isArray(t.items)?t.items:[]);function o(l){r!=null&&r.push?r.push(l):typeof l=="string"&&(window!=null&&window.location)&&(window.location.href=l)}return(l,a)=>{const i=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(["flex items-center gap-2 text-sm text-gray-600",s.compact?"py-1":"py-6"]),"aria-label":"Breadcrumb"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(c,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[p>0?(e.openBlock(),e.createElementBlock("span",nr,[e.createVNode(e.unref(os),{class:"w-4 h-4"})])):e.createCommentVNode("",!0),typeof c.onClick=="function"?(e.openBlock(),e.createElementBlock("span",{key:1,class:"hover:text-gray-900 transition-colors cursor-pointer",onClick:d=>c.onClick()},e.toDisplayString(c.label),9,or)):e.unref(r)&&c.to?(e.openBlock(),e.createBlock(i,{key:2,to:c.to,class:"hover:text-gray-900 transition-colors"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["to"])):c.to?(e.openBlock(),e.createElementBlock("span",{key:3,class:"hover:text-gray-900 transition-colors cursor-pointer",onClick:d=>o(c.to)},e.toDisplayString(c.label),9,ar)):(e.openBlock(),e.createElementBlock("span",lr,e.toDisplayString(c.label),1))],64))),128))],2)}}},ir={components:{VsWidget:re,VsNewNodata:ye,VsHeader:er,VsBreadcrumbs:Ye},props:["id","prefix"],data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},async mounted(){ge(this.prefix||"/api"),await this.fetchData()},methods:{async fetchData(){if(this.id)try{const s=await T.get(`/bi-dashboard/${this.id}`);this.dashboardData=s}catch(s){console.error(s)}},columnClass(s){const t=s!=null&&s.col?s==null?void 0:s.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"}[t]||"w-full"},async filterHandler(s){var r;this.filterURl="";let t="&filter=";(r=s==null?void 0:s.url)!=null&&r.length&&(s.url.split("|").forEach(o=>{const l=o.split("=");t+=`${l[0]}=${l[1]}`}),this.filterURl+=t)}}},cr={class:"w-full pb-8 overflow-y-auto mx-auto"},dr={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function pr(s,t,r,n,o,l){var c;const a=e.resolveComponent("VsNewNodata"),i=e.resolveComponent("VsWidget");return e.openBlock(),e.createElementBlock("div",cr,[e.createElementVNode("div",dr,[o.error||!o.dashboardData?(e.openBlock(),e.createBlock(a,{key:0,class:"col-span-12"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(((c=o.dashboardData)==null?void 0:c.panels)||[],(p,d)=>{var h;return e.openBlock(),e.createElementBlock("div",{key:d,class:e.normalizeClass([`col-span-${p.col||12}`,"flex flex-col gap-[10px]"])},[(h=p.widgets)!=null&&h.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(p.widgets,g=>(e.openBlock(),e.createBlock(i,{key:g,dashboard:r.id,widget:g,"dashboard-widgets":o.dashboardData.widgets,"filter-u-rl":o.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))),128)):(e.openBlock(),e.createBlock(i,{key:1,class:"flex flex-col",dashboard:r.id,widget:p.widget,"dashboard-widgets":o.dashboardData.widgets,"filter-u-rl":o.filterURl},null,8,["dashboard","widget","dashboard-widgets","filter-u-rl"]))],2)}),128))])])}const hr=D(ir,[["render",pr]]),mr={key:0,class:"vs-modal-wrapper fixed inset-0 flex items-center justify-center p-4"},ur={class:"flex items-center justify-between shrink-0 py-2.5 px-4 border-b border-gray-200 dark:border-[#454545]"},fr={class:"font-medium text-gray-800 dark:text-white"},gr={class:"vs-modal-content flex-1 min-h-0 overflow-auto p-4"},br={key:0,class:"shrink-0 border-t border-gray-200 dark:border-neutral-700"},ne=D({__name:"vs-modal",props:{visible:{type:Boolean,default:!1},title:{type:String,default:""},size:{type:String,default:"medium"},closeClickBack:{type:Boolean,default:!1},teleport:{type:String,default:"#modal"}},emits:["close","update:visible"],setup(s,{emit:t}){const r=s,n=t,o=e.computed(()=>r.size==="small"?"md:max-w-[40%] w-full max-w-md":r.size==="lg"?"md:max-w-[70%] w-full max-w-4xl":"md:max-w-[50%] w-full max-w-lg");function l(){n("update:visible",!1),n("close")}function a(i){i.key==="Escape"&&l()}return e.onMounted(()=>{window.addEventListener("keydown",a)}),e.onUnmounted(()=>{window.removeEventListener("keydown",a)}),(i,c)=>(e.openBlock(),e.createBlock(e.Teleport,{to:s.teleport},[s.visible?(e.openBlock(),e.createElementBlock("div",mr,[e.createElementVNode("div",{class:"absolute inset-0 bg-black/50","aria-hidden":"true",onMousedown:c[0]||(c[0]=p=>s.closeClickBack&&p.target===p.currentTarget&&l())},null,32),e.createVNode(e.Transition,{name:"vs-modal",appear:""},{default:e.withCtx(()=>[s.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["vs-modal-panel relative flex flex-col bg-white dark:bg-[#1A1A1A] rounded-xl shadow-xl max-h-[85vh] min-w-0 border border-gray-200 dark:border-[#454545]",o.value]),role:"dialog","aria-modal":"true",onMousedown:c[1]||(c[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",ur,[e.createElementVNode("h3",fr,e.toDisplayString(s.title),1),e.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center rounded-full bg-gray-100 text-gray-800 hover:bg-gray-200 dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-300","aria-label":"Закрити",onClick:l},c[2]||(c[2]=[e.createElementVNode("svg",{class:"w-4 h-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e.createElementVNode("div",gr,[e.renderSlot(i.$slots,"default",{},void 0,!0)]),i.$slots.footer?(e.openBlock(),e.createElementBlock("div",br,[e.renderSlot(i.$slots,"footer",{},void 0,!0)])):e.createCommentVNode("",!0)],34)):e.createCommentVNode("",!0)]),_:3})])):e.createCommentVNode("",!0)],8,["to"]))}},[["__scopeId","data-v-5722a50f"]]),yr={__name:"icon-plus",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ve),e.mergeProps(t.$attrs,{size:24}),null,16))}},xr={class:"mb-4 overflow-auto scrollbar max-h-96"},kr={__name:"vs-editor-create-widget",props:{columns:{type:Array,default:()=>[]},selectedDashboard:String,inline:{type:Boolean,default:!1}},emits:"update-data",setup(s,{expose:t,emit:r}){var m;const n=e.defineAsyncComponent(()=>import("@opengis/form")),o=(m=e.getCurrentInstance().proxy)==null?void 0:m.$notify,l=r,a=s,i=e.ref(!1),c=e.ref({}),p=e.ref();function d(){i.value=!0}function h(){i.value=!1}t({open:d,close:h});const g=async()=>{try{await p.value.doValidation(),await T.post(`/bi-dashboard/${a.selectedDashboard}`,c.value),await o({type:"success",title:"Успішно!",message:"Віджет успішно створено"}),await l("update-data"),c.value={},i.value=!1}catch{o({type:"error",title:"Помилка!",message:"При спробі створити віджет сталася помилка"})}},f=e.computed(()=>{var x,k,u,y;return{title:{type:"text",label:"Widget title",placeholder:"Widget title",validators:["required"]},x:{type:"select",label:"X Axis",view:"buttons",style:{size:"xs"},validators:["required"],options:(k=(x=a.columns)==null?void 0:x.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:k.map(({name:b,type:_})=>({id:b,text:b,type:_}))},metric:{type:"select",label:"Y Axis",view:"buttons",validators:["required"],style:{size:"xs"},options:[{id:"count",label:"count"},...(y=(u=a.columns)==null?void 0:u.filter(b=>(b==null?void 0:b.type)==="numeric"||(b==null?void 0:b.type)==="double precision"))==null?void 0:y.map(({name:b,type:_})=>({id:b,text:b,type:_}))]},col:{type:"select",label:"Columns count",validators:["required"],options:[{id:1,label:1},{id:2,text:2},{id:3,text:3},{id:4,text:4},{id:6,text:6},{id:9,text:9},{id:12,text:12}]},type:{type:"select",view:"buttons",label:"Type",validators:["required"],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:"Table",placeholder:"Table"},query:{type:"Text",ua:"Query",placeholder:"Query"},cls:{type:"Text",ua:"Cls",placeholder:"Cls"}}});return(x,k)=>{const u=e.resolveComponent("VsPopover");return e.openBlock(),e.createElementBlock("div",null,[s.inline?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(u,{key:0,placement:"right",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("div",null,[e.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:d},[e.createVNode(yr,{height:"20",width:"20"})])])]),default:e.withCtx(()=>[k[1]||(k[1]=e.createTextVNode(" Створити віджет "))]),_:1})),e.createVNode(ne,{teleport:"#modal",visible:i.value,title:"Створити віджет",onClose:h},{footer:e.withCtx(()=>[e.createElementVNode("div",{class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:h,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"}," Скасувати "),e.createElementVNode("button",{onClick:g,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:e.withCtx(()=>[e.createElementVNode("div",xr,[e.createVNode(e.unref(n),{ref_key:"form",ref:p,schema:f.value,values:c.value,"onUpdate:values":k[0]||(k[0]=y=>c.value=y)},null,8,["schema","values"])])]),_:1},8,["visible"])])}}},et={__name:"delete",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(xs),e.mergeProps(t.$attrs,{size:24}),null,16))}},De={__name:"close",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(He),e.mergeProps(t.$attrs,{size:24}),null,16))}},tt={__name:"edit",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(fs),e.mergeProps(t.$attrs,{size:24}),null,16))}},wr={class:"space-y-4"},_r={__name:"vs-editor-form-style",props:{widgetName:{type:String},data:{type:Object,default:()=>{}}},setup(s,{expose:t}){var m,x,k,u,y,b;const r=e.defineAsyncComponent(()=>import("@opengis/form")),{$notify:n}=e.getCurrentInstance().proxy,o=s,l=e.ref(null),a={show:{label:"Label",type:"switcher",title:"Show label"},rotate:{type:"number",label:"Rotate angel",conditions:["show","==",!0]},align:{type:"select",view:"buttons",label:"Align",conditions:["show","==",!0],options:[{id:"center",text:"Center"},{id:"left",text:"Left"},{id:"right",text:"Right"}]},position:{type:"select",label:"Position",conditions:["show","==",!0],options:[{id:"top",text:"Top"},{id:"right",text:"Right"},{id:"left",text:"Left"},{id:"bottom",text:"Bottom"}]}},i={show:{label:"Legend",type:"switcher",title:"Show legend"}},c={show:{label:"Tooltip ",type:"switcher",title:"Show tooltip"}},p=e.ref({...((x=(m=o.data)==null?void 0:m.style)==null?void 0:x.label)||{}}),d=e.ref({...((u=(k=o.data)==null?void 0:k.style)==null?void 0:u.legend)||{}}),h=e.ref({...((b=(y=o.data)==null?void 0:y.style)==null?void 0:b.tooltip)||{}}),g=()=>{const _=new CustomEvent(`update-style-${o.widgetName}`);_.chartId=o.widgetName,_.options={options:{legend:d.value,tooltip:h.value,label:p.value},seriesOptions:p.value},window.dispatchEvent(_)};e.watch(p,g,{deep:!0}),e.watch(d,g,{deep:!0}),e.watch(h,g,{deep:!0});const f=async()=>{try{await T.put(`/bi-dashboard/${l.value}/${o.widgetName}`,{style:{legend:d.value,tooltip:h.value,label:p.value}});const _=new CustomEvent(`update-style-${o.widgetName}`);_.chartId=o.widgetName,_.options={options:{legend:d.value,tooltip:h.value,label:p.value},seriesOptions:p.value},window.dispatchEvent(_),n({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{n({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.onMounted(()=>{const _=new URLSearchParams(window.top.location.search);l.value=_.get("dashboard")}),t({requestUpdateWidget:f}),(_,$)=>(e.openBlock(),e.createElementBlock("div",wr,[e.createVNode(e.unref(r),{schema:a,values:p.value,"onUpdate:values":$[0]||($[0]=w=>p.value=w),class:"p-0"},null,8,["values"]),e.createVNode(e.unref(r),{schema:i,values:d.value,"onUpdate:values":$[1]||($[1]=w=>d.value=w),class:"p-0"},null,8,["values"]),e.createVNode(e.unref(r),{schema:c,values:h.value,"onUpdate:values":$[2]||($[2]=w=>h.value=w),class:"p-0"},null,8,["values"])]))}};function Ne(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let J=Ne();function st(s){J=s}const rt=/[&<>"']/,$r=new RegExp(rt.source,"g"),nt=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Vr=new RegExp(nt.source,"g"),Er={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ot=s=>Er[s];function A(s,t){if(t){if(rt.test(s))return s.replace($r,ot)}else if(nt.test(s))return s.replace(Vr,ot);return s}const Br=/(^|[^\[])\^/g;function N(s,t){let r=typeof s=="string"?s:s.source;t=t||"";const n={replace:(o,l)=>{let a=typeof l=="string"?l:l.source;return a=a.replace(Br,"$1"),r=r.replace(o,a),n},getRegex:()=>new RegExp(r,t)};return n}function at(s){try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}const oe={exec:()=>null};function lt(s,t){const r=s.replace(/\|/g,(l,a,i)=>{let c=!1,p=a;for(;--p>=0&&i[p]==="\\";)c=!c;return c?"|":" |"}),n=r.split(/ \|/);let o=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;o<n.length;o++)n[o]=n[o].trim().replace(/\\\|/g,"|");return n}function ae(s,t,r){const n=s.length;if(n===0)return"";let o=0;for(;o<n&&s.charAt(n-o-1)===t;)o++;return s.slice(0,n-o)}function Cr(s,t){if(s.indexOf(t[1])===-1)return-1;let r=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===t[0])r++;else if(s[n]===t[1]&&(r--,r<0))return n;return-1}function it(s,t,r,n){const o=t.href,l=t.title?A(t.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const i={type:"link",raw:r,href:o,title:l,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,i}return{type:"image",raw:r,href:o,title:l,text:A(a)}}function Dr(s,t){const r=s.match(/^(\s+)(?:```)/);if(r===null)return t;const n=r[1];return t.split(`
107
107
  `).map(o=>{const l=o.match(/^\s+/);if(l===null)return o;const[a]=l;return a.length>=n.length?o.slice(n.length):o}).join(`
108
- `)}class xe{constructor(t){S(this,"options");S(this,"rules");S(this,"lexer");this.options=t||K}space(t){const r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){const r=this.rules.block.code.exec(t);if(r){const n=r[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:ae(n,`
108
+ `)}class xe{constructor(t){S(this,"options");S(this,"rules");S(this,"lexer");this.options=t||J}space(t){const r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){const r=this.rules.block.code.exec(t);if(r){const n=r[0].replace(/^(?: {1,4}| {0,3}\t)/gm,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:ae(n,`
109
109
  `)}}}fences(t){const r=this.rules.block.fences.exec(t);if(r){const n=r[0],o=Dr(n,r[3]||"");return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:o}}}heading(t){const r=this.rules.block.heading.exec(t);if(r){let n=r[2].trim();if(/#$/.test(n)){const o=ae(n,"#");(this.options.pedantic||!o||/ $/.test(o))&&(n=o.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:ae(r[0],`
110
110
  `)}}blockquote(t){const r=this.rules.block.blockquote.exec(t);if(r){let n=ae(r[0],`
111
111
  `).split(`
@@ -113,22 +113,22 @@
113
113
  `),h=d.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
114
114
  $1`).replace(/^ {0,3}>[ \t]?/gm,"");o=o?`${o}
115
115
  ${d}`:d,l=l?`${l}
116
- ${h}`:h;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,a,!0),this.lexer.state.top=m,n.length===0)break;const g=a[a.length-1];if((g==null?void 0:g.type)==="code")break;if((g==null?void 0:g.type)==="blockquote"){const u=g,x=u.raw+`
116
+ ${h}`:h;const g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,a,!0),this.lexer.state.top=g,n.length===0)break;const f=a[a.length-1];if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){const m=f,x=m.raw+`
117
117
  `+n.join(`
118
- `),k=this.blockquote(x);a[a.length-1]=k,o=o.substring(0,o.length-u.raw.length)+k.raw,l=l.substring(0,l.length-u.text.length)+k.text;break}else if((g==null?void 0:g.type)==="list"){const u=g,x=u.raw+`
118
+ `),k=this.blockquote(x);a[a.length-1]=k,o=o.substring(0,o.length-m.raw.length)+k.raw,l=l.substring(0,l.length-m.text.length)+k.text;break}else if((f==null?void 0:f.type)==="list"){const m=f,x=m.raw+`
119
119
  `+n.join(`
120
- `),k=this.list(x);a[a.length-1]=k,o=o.substring(0,o.length-g.raw.length)+k.raw,l=l.substring(0,l.length-u.raw.length)+k.raw,n=x.substring(a[a.length-1].raw.length).split(`
120
+ `),k=this.list(x);a[a.length-1]=k,o=o.substring(0,o.length-f.raw.length)+k.raw,l=l.substring(0,l.length-m.raw.length)+k.raw,n=x.substring(a[a.length-1].raw.length).split(`
121
121
  `);continue}}return{type:"blockquote",raw:o,tokens:a,text:l}}}list(t){let r=this.rules.block.list.exec(t);if(r){let n=r[1].trim();const o=n.length>1,l={type:"list",raw:"",ordered:o,start:o?+n.slice(0,-1):"",loose:!1,items:[]};n=o?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=o?n:"[*+-]");const a=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);let i=!1;for(;t;){let c=!1,p="",d="";if(!(r=a.exec(t))||this.rules.block.hr.test(t))break;p=r[0],t=t.substring(p.length);let h=r[2].split(`
122
- `,1)[0].replace(/^\t+/,f=>" ".repeat(3*f.length)),m=t.split(`
123
- `,1)[0],g=!h.trim(),u=0;if(this.options.pedantic?(u=2,d=h.trimStart()):g?u=r[1].length+1:(u=r[2].search(/[^ ]/),u=u>4?1:u,d=h.slice(u),u+=r[1].length),g&&/^[ \t]*$/.test(m)&&(p+=m+`
124
- `,t=t.substring(m.length+1),c=!0),!c){const f=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),b=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),_=new RegExp(`^ {0,${Math.min(3,u-1)}}#`),$=new RegExp(`^ {0,${Math.min(3,u-1)}}<(?:[a-z].*>|!--)`,"i");for(;t;){const w=t.split(`
125
- `,1)[0];let L;if(m=w,this.options.pedantic?(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g," "),L=m):L=m.replace(/\t/g," "),b.test(m)||_.test(m)||$.test(m)||f.test(m)||y.test(m))break;if(L.search(/[^ ]/)>=u||!m.trim())d+=`
126
- `+L.slice(u);else{if(g||h.replace(/\t/g," ").search(/[^ ]/)>=4||b.test(h)||_.test(h)||y.test(h))break;d+=`
127
- `+m}!g&&!m.trim()&&(g=!0),p+=w+`
128
- `,t=t.substring(w.length+1),h=L.slice(u)}}l.loose||(i?l.loose=!0:/\n[ \t]*\n[ \t]*$/.test(p)&&(i=!0));let x=null,k;this.options.gfm&&(x=/^\[[ xX]\] /.exec(d),x&&(k=x[0]!=="[ ] ",d=d.replace(/^\[[ xX]\] +/,""))),l.items.push({type:"list_item",raw:p,task:!!x,checked:k,loose:!1,text:d,tokens:[]}),l.raw+=p}l.items[l.items.length-1].raw=l.items[l.items.length-1].raw.trimEnd(),l.items[l.items.length-1].text=l.items[l.items.length-1].text.trimEnd(),l.raw=l.raw.trimEnd();for(let c=0;c<l.items.length;c++)if(this.lexer.state.top=!1,l.items[c].tokens=this.lexer.blockTokens(l.items[c].text,[]),!l.loose){const p=l.items[c].tokens.filter(h=>h.type==="space"),d=p.length>0&&p.some(h=>/\n.*\n/.test(h.raw));l.loose=d}if(l.loose)for(let c=0;c<l.items.length;c++)l.items[c].loose=!0;return l}}html(t){const r=this.rules.block.html.exec(t);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(t){const r=this.rules.block.def.exec(t);if(r){const n=r[1].toLowerCase().replace(/\s+/g," "),o=r[2]?r[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:o,title:l}}}table(t){const r=this.rules.block.table.exec(t);if(!r||!/[:|]/.test(r[2]))return;const n=it(r[1]),o=r[2].replace(/^\||\| *$/g,"").split("|"),l=r[3]&&r[3].trim()?r[3].replace(/\n[ \t]*$/,"").split(`
129
- `):[],a={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===o.length){for(const i of o)/^ *-+: *$/.test(i)?a.align.push("right"):/^ *:-+: *$/.test(i)?a.align.push("center"):/^ *:-+ *$/.test(i)?a.align.push("left"):a.align.push(null);for(let i=0;i<n.length;i++)a.header.push({text:n[i],tokens:this.lexer.inline(n[i]),header:!0,align:a.align[i]});for(const i of l)a.rows.push(it(i,a.header.length).map((c,p)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:a.align[p]})));return a}}lheading(t){const r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){const r=this.rules.block.paragraph.exec(t);if(r){const n=r[1].charAt(r[1].length-1)===`
130
- `?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){const r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:A(r[1])}}tag(t){const r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&/^<a /i.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){const r=this.rules.inline.link.exec(t);if(r){const n=r[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=ae(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=Br(r[2],"()");if(a>-1){const c=(r[0].indexOf("!")===0?5:4)+r[1].length+a;r[2]=r[2].substring(0,a),r[0]=r[0].substring(0,c).trim(),r[3]=""}}let o=r[2],l="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);a&&(o=a[1],l=a[3])}else l=r[3]?r[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(n)?o=o.slice(1):o=o.slice(1,-1)),ct(r,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer)}}reflink(t,r){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const o=(n[2]||n[1]).replace(/\s+/g," "),l=r[o.toLowerCase()];if(!l){const a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return ct(n,l,n[0],this.lexer)}}emStrong(t,r,n=""){let o=this.rules.inline.emStrongLDelim.exec(t);if(!o||o[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const a=[...o[0]].length-1;let i,c,p=a,d=0;const h=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,r=r.slice(-1*t.length+a);(o=h.exec(r))!=null;){if(i=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!i)continue;if(c=[...i].length,o[3]||o[4]){p+=c;continue}else if((o[5]||o[6])&&a%3&&!((a+c)%3)){d+=c;continue}if(p-=c,p>0)continue;c=Math.min(c,c+p+d);const m=[...o[0]][0].length,g=t.slice(0,a+o.index+m+c);if(Math.min(a,c)%2){const x=g.slice(1,-1);return{type:"em",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}const u=g.slice(2,-2);return{type:"strong",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(t){const r=this.rules.inline.code.exec(t);if(r){let n=r[2].replace(/\n/g," ");const o=/[^ ]/.test(n),l=/^ /.test(n)&&/ $/.test(n);return o&&l&&(n=n.substring(1,n.length-1)),n=A(n,!0),{type:"codespan",raw:r[0],text:n}}}br(t){const r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){const r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){const r=this.rules.inline.autolink.exec(t);if(r){let n,o;return r[2]==="@"?(n=A(r[1]),o="mailto:"+n):(n=A(r[1]),o=n),{type:"link",raw:r[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let r;if(r=this.rules.inline.url.exec(t)){let o,l;if(r[2]==="@")o=A(r[0]),l="mailto:"+o;else{let a;do a=r[0],r[0]=((n=this.rules.inline._backpedal.exec(r[0]))==null?void 0:n[0])??"";while(a!==r[0]);o=A(r[0]),r[1]==="www."?l="http://"+r[0]:l=r[0]}return{type:"link",raw:r[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(t){const r=this.rules.inline.text.exec(t);if(r){let n;return this.lexer.state.inRawBlock?n=r[0]:n=A(r[0]),{type:"text",raw:r[0],text:n}}}}const Nr=/^(?:[ \t]*(?:\n|$))+/,Sr=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,le=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Lr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,dt=/(?:[*+-]|\d{1,9}[.)])/,pt=N(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,dt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Se=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Tr=/^[^\n]+/,ze=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ir=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ze).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Mr=N(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,dt).getRegex(),ke="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Le=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Fr=N("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Le).replace("tag",ke).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ht=N(Se).replace("hr",le).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex(),Te={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ht).getRegex(),code:Sr,def:Ir,fences:zr,heading:Lr,hr:le,html:Fr,lheading:pt,list:Mr,newline:Nr,paragraph:ht,table:oe,text:Tr},mt=N("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",le).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex(),Pr={...Te,table:mt,paragraph:N(Se).replace("hr",le).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",mt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex()},Rr={...Te,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Le).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:oe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(Se).replace("hr",le).replace("heading",` *#{1,6} *[^
131
- ]`).replace("lheading",pt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ut=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ar=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ft=/^( {2,}|\\)\n(?!\s*$)/,Or=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ie="\\p{P}\\p{S}",jr=N(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ie).getRegex(),Wr=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,qr=N(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ie).getRegex(),Ur=N("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ie).getRegex(),vr=N("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ie).getRegex(),Hr=N(/\\([punct])/,"gu").replace(/punct/g,ie).getRegex(),Gr=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Zr=N(Le).replace("(?:-->|$)","-->").getRegex(),Qr=N("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Zr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),we=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Xr=N(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",we).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gt=N(/^!?\[(label)\]\[(ref)\]/).replace("label",we).replace("ref",ze).getRegex(),bt=N(/^!?\[(ref)\](?:\[\])?/).replace("ref",ze).getRegex(),Kr=N("reflink|nolink(?!\\()","g").replace("reflink",gt).replace("nolink",bt).getRegex(),Ie={_backpedal:oe,anyPunctuation:Hr,autolink:Gr,blockSkip:Wr,br:ft,code:Ar,del:oe,emStrongLDelim:qr,emStrongRDelimAst:Ur,emStrongRDelimUnd:vr,escape:ut,link:Xr,nolink:bt,punctuation:jr,reflink:gt,reflinkSearch:Kr,tag:Qr,text:Or,url:oe},Jr={...Ie,link:N(/^!?\[(label)\]\((.*?)\)/).replace("label",we).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",we).getRegex()},Me={...Ie,escape:N(ut).replace("])","~|])").getRegex(),url:N(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Yr={...Me,br:N(ft).replace("{2,}","*").getRegex(),text:N(Me.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_e={normal:Te,gfm:Pr,pedantic:Rr},ce={normal:Ie,gfm:Me,breaks:Yr,pedantic:Jr};class O{constructor(t){S(this,"tokens");S(this,"options");S(this,"state");S(this,"tokenizer");S(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||K,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={block:_e.normal,inline:ce.normal};this.options.pedantic?(r.block=_e.pedantic,r.inline=ce.pedantic):this.options.gfm&&(r.block=_e.gfm,this.options.breaks?r.inline=ce.breaks:r.inline=ce.gfm),this.tokenizer.rules=r}static get rules(){return{block:_e,inline:ce}}static lex(t,r){return new O(r).lex(t)}static lexInline(t,r){return new O(r).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
122
+ `,1)[0].replace(/^\t+/,u=>" ".repeat(3*u.length)),g=t.split(`
123
+ `,1)[0],f=!h.trim(),m=0;if(this.options.pedantic?(m=2,d=h.trimStart()):f?m=r[1].length+1:(m=r[2].search(/[^ ]/),m=m>4?1:m,d=h.slice(m),m+=r[1].length),f&&/^[ \t]*$/.test(g)&&(p+=g+`
124
+ `,t=t.substring(g.length+1),c=!0),!c){const u=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,m-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),b=new RegExp(`^ {0,${Math.min(3,m-1)}}(?:\`\`\`|~~~)`),_=new RegExp(`^ {0,${Math.min(3,m-1)}}#`),$=new RegExp(`^ {0,${Math.min(3,m-1)}}<(?:[a-z].*>|!--)`,"i");for(;t;){const w=t.split(`
125
+ `,1)[0];let L;if(g=w,this.options.pedantic?(g=g.replace(/^ {1,4}(?=( {4})*[^ ])/g," "),L=g):L=g.replace(/\t/g," "),b.test(g)||_.test(g)||$.test(g)||u.test(g)||y.test(g))break;if(L.search(/[^ ]/)>=m||!g.trim())d+=`
126
+ `+L.slice(m);else{if(f||h.replace(/\t/g," ").search(/[^ ]/)>=4||b.test(h)||_.test(h)||y.test(h))break;d+=`
127
+ `+g}!f&&!g.trim()&&(f=!0),p+=w+`
128
+ `,t=t.substring(w.length+1),h=L.slice(m)}}l.loose||(i?l.loose=!0:/\n[ \t]*\n[ \t]*$/.test(p)&&(i=!0));let x=null,k;this.options.gfm&&(x=/^\[[ xX]\] /.exec(d),x&&(k=x[0]!=="[ ] ",d=d.replace(/^\[[ xX]\] +/,""))),l.items.push({type:"list_item",raw:p,task:!!x,checked:k,loose:!1,text:d,tokens:[]}),l.raw+=p}l.items[l.items.length-1].raw=l.items[l.items.length-1].raw.trimEnd(),l.items[l.items.length-1].text=l.items[l.items.length-1].text.trimEnd(),l.raw=l.raw.trimEnd();for(let c=0;c<l.items.length;c++)if(this.lexer.state.top=!1,l.items[c].tokens=this.lexer.blockTokens(l.items[c].text,[]),!l.loose){const p=l.items[c].tokens.filter(h=>h.type==="space"),d=p.length>0&&p.some(h=>/\n.*\n/.test(h.raw));l.loose=d}if(l.loose)for(let c=0;c<l.items.length;c++)l.items[c].loose=!0;return l}}html(t){const r=this.rules.block.html.exec(t);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(t){const r=this.rules.block.def.exec(t);if(r){const n=r[1].toLowerCase().replace(/\s+/g," "),o=r[2]?r[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:o,title:l}}}table(t){const r=this.rules.block.table.exec(t);if(!r||!/[:|]/.test(r[2]))return;const n=lt(r[1]),o=r[2].replace(/^\||\| *$/g,"").split("|"),l=r[3]&&r[3].trim()?r[3].replace(/\n[ \t]*$/,"").split(`
129
+ `):[],a={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===o.length){for(const i of o)/^ *-+: *$/.test(i)?a.align.push("right"):/^ *:-+: *$/.test(i)?a.align.push("center"):/^ *:-+ *$/.test(i)?a.align.push("left"):a.align.push(null);for(let i=0;i<n.length;i++)a.header.push({text:n[i],tokens:this.lexer.inline(n[i]),header:!0,align:a.align[i]});for(const i of l)a.rows.push(lt(i,a.header.length).map((c,p)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:a.align[p]})));return a}}lheading(t){const r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){const r=this.rules.block.paragraph.exec(t);if(r){const n=r[1].charAt(r[1].length-1)===`
130
+ `?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){const r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:A(r[1])}}tag(t){const r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&/^<a /i.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){const r=this.rules.inline.link.exec(t);if(r){const n=r[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=ae(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=Cr(r[2],"()");if(a>-1){const c=(r[0].indexOf("!")===0?5:4)+r[1].length+a;r[2]=r[2].substring(0,a),r[0]=r[0].substring(0,c).trim(),r[3]=""}}let o=r[2],l="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);a&&(o=a[1],l=a[3])}else l=r[3]?r[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(n)?o=o.slice(1):o=o.slice(1,-1)),it(r,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer)}}reflink(t,r){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const o=(n[2]||n[1]).replace(/\s+/g," "),l=r[o.toLowerCase()];if(!l){const a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return it(n,l,n[0],this.lexer)}}emStrong(t,r,n=""){let o=this.rules.inline.emStrongLDelim.exec(t);if(!o||o[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const a=[...o[0]].length-1;let i,c,p=a,d=0;const h=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,r=r.slice(-1*t.length+a);(o=h.exec(r))!=null;){if(i=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!i)continue;if(c=[...i].length,o[3]||o[4]){p+=c;continue}else if((o[5]||o[6])&&a%3&&!((a+c)%3)){d+=c;continue}if(p-=c,p>0)continue;c=Math.min(c,c+p+d);const g=[...o[0]][0].length,f=t.slice(0,a+o.index+g+c);if(Math.min(a,c)%2){const x=f.slice(1,-1);return{type:"em",raw:f,text:x,tokens:this.lexer.inlineTokens(x)}}const m=f.slice(2,-2);return{type:"strong",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(t){const r=this.rules.inline.code.exec(t);if(r){let n=r[2].replace(/\n/g," ");const o=/[^ ]/.test(n),l=/^ /.test(n)&&/ $/.test(n);return o&&l&&(n=n.substring(1,n.length-1)),n=A(n,!0),{type:"codespan",raw:r[0],text:n}}}br(t){const r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){const r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){const r=this.rules.inline.autolink.exec(t);if(r){let n,o;return r[2]==="@"?(n=A(r[1]),o="mailto:"+n):(n=A(r[1]),o=n),{type:"link",raw:r[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let r;if(r=this.rules.inline.url.exec(t)){let o,l;if(r[2]==="@")o=A(r[0]),l="mailto:"+o;else{let a;do a=r[0],r[0]=((n=this.rules.inline._backpedal.exec(r[0]))==null?void 0:n[0])??"";while(a!==r[0]);o=A(r[0]),r[1]==="www."?l="http://"+r[0]:l=r[0]}return{type:"link",raw:r[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(t){const r=this.rules.inline.text.exec(t);if(r){let n;return this.lexer.state.inRawBlock?n=r[0]:n=A(r[0]),{type:"text",raw:r[0],text:n}}}}const Nr=/^(?:[ \t]*(?:\n|$))+/,Sr=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zr=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,le=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Lr=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ct=/(?:[*+-]|\d{1,9}[.)])/,dt=N(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ct).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Se=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Tr=/^[^\n]+/,ze=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ir=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ze).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Mr=N(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ct).getRegex(),ke="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Le=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Pr=N("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Le).replace("tag",ke).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pt=N(Se).replace("hr",le).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex(),Te={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",pt).getRegex(),code:Sr,def:Ir,fences:zr,heading:Lr,hr:le,html:Pr,lheading:dt,list:Mr,newline:Nr,paragraph:pt,table:oe,text:Tr},ht=N("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",le).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex(),Rr={...Te,table:ht,paragraph:N(Se).replace("hr",le).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ht).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ke).getRegex()},Fr={...Te,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Le).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:oe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(Se).replace("hr",le).replace("heading",` *#{1,6} *[^
131
+ ]`).replace("lheading",dt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},mt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ar=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ut=/^( {2,}|\\)\n(?!\s*$)/,Or=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ie="\\p{P}\\p{S}",jr=N(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ie).getRegex(),Wr=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,qr=N(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ie).getRegex(),Ur=N("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ie).getRegex(),vr=N("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ie).getRegex(),Hr=N(/\\([punct])/,"gu").replace(/punct/g,ie).getRegex(),Gr=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Zr=N(Le).replace("(?:-->|$)","-->").getRegex(),Qr=N("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Zr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),we=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Xr=N(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",we).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ft=N(/^!?\[(label)\]\[(ref)\]/).replace("label",we).replace("ref",ze).getRegex(),gt=N(/^!?\[(ref)\](?:\[\])?/).replace("ref",ze).getRegex(),Jr=N("reflink|nolink(?!\\()","g").replace("reflink",ft).replace("nolink",gt).getRegex(),Ie={_backpedal:oe,anyPunctuation:Hr,autolink:Gr,blockSkip:Wr,br:ut,code:Ar,del:oe,emStrongLDelim:qr,emStrongRDelimAst:Ur,emStrongRDelimUnd:vr,escape:mt,link:Xr,nolink:gt,punctuation:jr,reflink:ft,reflinkSearch:Jr,tag:Qr,text:Or,url:oe},Kr={...Ie,link:N(/^!?\[(label)\]\((.*?)\)/).replace("label",we).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",we).getRegex()},Me={...Ie,escape:N(mt).replace("])","~|])").getRegex(),url:N(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Yr={...Me,br:N(ut).replace("{2,}","*").getRegex(),text:N(Me.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_e={normal:Te,gfm:Rr,pedantic:Fr},ce={normal:Ie,gfm:Me,breaks:Yr,pedantic:Kr};class O{constructor(t){S(this,"tokens");S(this,"options");S(this,"state");S(this,"tokenizer");S(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||J,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={block:_e.normal,inline:ce.normal};this.options.pedantic?(r.block=_e.pedantic,r.inline=ce.pedantic):this.options.gfm&&(r.block=_e.gfm,this.options.breaks?r.inline=ce.breaks:r.inline=ce.gfm),this.tokenizer.rules=r}static get rules(){return{block:_e,inline:ce}}static lex(t,r){return new O(r).lex(t)}static lexInline(t,r){return new O(r).inlineTokens(t)}lex(t){t=t.replace(/\r\n|\r/g,`
132
132
  `),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],n=!1){this.options.pedantic&&(t=t.replace(/\t/g," ").replace(/^ +$/gm,""));let o,l,a;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(i=>(o=i.call({lexer:this},t,r))?(t=t.substring(o.raw.length),r.push(o),!0):!1))){if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length),o.raw.length===1&&r.length>0?r[r.length-1].raw+=`
133
133
  `:r.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length),l=r[r.length-1],l&&(l.type==="paragraph"||l.type==="text")?(l.raw+=`
134
134
  `+o.raw,l.text+=`
@@ -138,7 +138,7 @@ ${h}`:h;const m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
138
138
  `+o.raw,l.text+=`
139
139
  `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=l.text):r.push(o),n=a.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length),l=r[r.length-1],l&&l.type==="text"?(l.raw+=`
140
140
  `+o.raw,l.text+=`
141
- `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=l.text):r.push(o);continue}if(t){const i="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n,o,l,a=t,i,c,p;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,i.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(c||(p=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(n=d.call({lexer:this},t,r))?(t=t.substring(n.raw.length),r.push(n),!0):!1))){if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),o=r[r.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length),o=r[r.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(n=this.tokenizer.emStrong(t,a,p)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length),r.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length),r.push(n);continue}if(l=t,this.options.extensions&&this.options.extensions.startInline){let d=1/0;const h=t.slice(1);let m;this.options.extensions.startInline.forEach(g=>{m=g.call({lexer:this},h),typeof m=="number"&&m>=0&&(d=Math.min(d,m))}),d<1/0&&d>=0&&(l=t.substring(0,d+1))}if(n=this.tokenizer.inlineText(l)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(p=n.raw.slice(-1)),c=!0,o=r[r.length-1],o&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(t){const d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return r}}class $e{constructor(t){S(this,"options");S(this,"parser");this.options=t||K}space(t){return""}code({text:t,lang:r,escaped:n}){var a;const o=(a=(r||"").match(/^\S*/))==null?void 0:a[0],l=t.replace(/\n$/,"")+`
141
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=l.text):r.push(o);continue}if(t){const i="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n,o,l,a=t,i,c,p;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,i.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(c||(p=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(n=d.call({lexer:this},t,r))?(t=t.substring(n.raw.length),r.push(n),!0):!1))){if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),o=r[r.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length),o=r[r.length-1],o&&n.type==="text"&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(n=this.tokenizer.emStrong(t,a,p)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length),r.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length),r.push(n);continue}if(l=t,this.options.extensions&&this.options.extensions.startInline){let d=1/0;const h=t.slice(1);let g;this.options.extensions.startInline.forEach(f=>{g=f.call({lexer:this},h),typeof g=="number"&&g>=0&&(d=Math.min(d,g))}),d<1/0&&d>=0&&(l=t.substring(0,d+1))}if(n=this.tokenizer.inlineText(l)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(p=n.raw.slice(-1)),c=!0,o=r[r.length-1],o&&o.type==="text"?(o.raw+=n.raw,o.text+=n.text):r.push(n);continue}if(t){const d="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return r}}class $e{constructor(t){S(this,"options");S(this,"parser");this.options=t||J}space(t){return""}code({text:t,lang:r,escaped:n}){var a;const o=(a=(r||"").match(/^\S*/))==null?void 0:a[0],l=t.replace(/\n$/,"")+`
142
142
  `;return o?'<pre><code class="language-'+A(o)+'">'+(n?l:A(l,!0))+`</code></pre>
143
143
  `:"<pre><code>"+(n?l:A(l,!0))+`</code></pre>
144
144
  `}blockquote({tokens:t}){return`<blockquote>
@@ -156,14 +156,14 @@ ${this.parser.parse(t)}</blockquote>
156
156
  `}tablerow({text:t}){return`<tr>
157
157
  ${t}</tr>
158
158
  `}tablecell(t){const r=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+r+`</${n}>
159
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${t}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:r,tokens:n}){const o=this.parser.parseInline(n),l=lt(t);if(l===null)return o;t=l;let a='<a href="'+t+'"';return r&&(a+=' title="'+r+'"'),a+=">"+o+"</a>",a}image({href:t,title:r,text:n}){const o=lt(t);if(o===null)return n;t=o;let l=`<img src="${t}" alt="${n}"`;return r&&(l+=` title="${r}"`),l+=">",l}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):t.text}}class Fe{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}}class j{constructor(t){S(this,"options");S(this,"renderer");S(this,"textRenderer");this.options=t||K,this.options.renderer=this.options.renderer||new $e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Fe}static parse(t,r){return new j(r).parse(t)}static parseInline(t,r){return new j(r).parseInline(t)}parse(t,r=!0){let n="";for(let o=0;o<t.length;o++){const l=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){const i=l,c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(i.type)){n+=c||"";continue}}const a=l;switch(a.type){case"space":{n+=this.renderer.space(a);continue}case"hr":{n+=this.renderer.hr(a);continue}case"heading":{n+=this.renderer.heading(a);continue}case"code":{n+=this.renderer.code(a);continue}case"table":{n+=this.renderer.table(a);continue}case"blockquote":{n+=this.renderer.blockquote(a);continue}case"list":{n+=this.renderer.list(a);continue}case"html":{n+=this.renderer.html(a);continue}case"paragraph":{n+=this.renderer.paragraph(a);continue}case"text":{let i=a,c=this.renderer.text(i);for(;o+1<t.length&&t[o+1].type==="text";)i=t[++o],c+=`
160
- `+this.renderer.text(i);r?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c}]}):n+=c;continue}default:{const i='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}parseInline(t,r){r=r||this.renderer;let n="";for(let o=0;o<t.length;o++){const l=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){const i=this.options.extensions.renderers[l.type].call({parser:this},l);if(i!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=i||"";continue}}const a=l;switch(a.type){case"escape":{n+=r.text(a);break}case"html":{n+=r.html(a);break}case"link":{n+=r.link(a);break}case"image":{n+=r.image(a);break}case"strong":{n+=r.strong(a);break}case"em":{n+=r.em(a);break}case"codespan":{n+=r.codespan(a);break}case"br":{n+=r.br(a);break}case"del":{n+=r.del(a);break}case"text":{n+=r.text(a);break}default:{const i='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}}class de{constructor(t){S(this,"options");S(this,"block");this.options=t||K}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?O.lex:O.lexInline}provideParser(){return this.block?j.parse:j.parseInline}}S(de,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class en{constructor(...t){S(this,"defaults",Ne());S(this,"options",this.setOptions);S(this,"parse",this.parseMarkdown(!0));S(this,"parseInline",this.parseMarkdown(!1));S(this,"Parser",j);S(this,"Renderer",$e);S(this,"TextRenderer",Fe);S(this,"Lexer",O);S(this,"Tokenizer",xe);S(this,"Hooks",de);this.use(...t)}walkTokens(t,r){var o,l;let n=[];for(const a of t)switch(n=n.concat(r.call(this,a)),a.type){case"table":{const i=a;for(const c of i.header)n=n.concat(this.walkTokens(c.tokens,r));for(const c of i.rows)for(const p of c)n=n.concat(this.walkTokens(p.tokens,r));break}case"list":{const i=a;n=n.concat(this.walkTokens(i.items,r));break}default:{const i=a;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[i.type]?this.defaults.extensions.childTokens[i.type].forEach(c=>{const p=i[c].flat(1/0);n=n.concat(this.walkTokens(p,r))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,r)))}}return n}use(...t){const r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const a=r.renderers[l.name];a?r.renderers[l.name]=function(...i){let c=l.renderer.apply(this,i);return c===!1&&(c=a.apply(this,i)),c}:r.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const a=r[l.level];a?a.unshift(l.tokenizer):r[l.level]=[l.tokenizer],l.start&&(l.level==="block"?r.startBlock?r.startBlock.push(l.start):r.startBlock=[l.start]:l.level==="inline"&&(r.startInline?r.startInline.push(l.start):r.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(r.childTokens[l.name]=l.childTokens)}),o.extensions=r),n.renderer){const l=this.defaults.renderer||new $e(this.defaults);for(const a in n.renderer){if(!(a in l))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;const i=a,c=n.renderer[i],p=l[i];l[i]=(...d)=>{let h=c.apply(l,d);return h===!1&&(h=p.apply(l,d)),h||""}}o.renderer=l}if(n.tokenizer){const l=this.defaults.tokenizer||new xe(this.defaults);for(const a in n.tokenizer){if(!(a in l))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;const i=a,c=n.tokenizer[i],p=l[i];l[i]=(...d)=>{let h=c.apply(l,d);return h===!1&&(h=p.apply(l,d)),h}}o.tokenizer=l}if(n.hooks){const l=this.defaults.hooks||new de;for(const a in n.hooks){if(!(a in l))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;const i=a,c=n.hooks[i],p=l[i];de.passThroughHooks.has(a)?l[i]=d=>{if(this.defaults.async)return Promise.resolve(c.call(l,d)).then(m=>p.call(l,m));const h=c.call(l,d);return p.call(l,h)}:l[i]=(...d)=>{let h=c.apply(l,d);return h===!1&&(h=p.apply(l,d)),h}}o.hooks=l}if(n.walkTokens){const l=this.defaults.walkTokens,a=n.walkTokens;o.walkTokens=function(i){let c=[];return c.push(a.call(this,i)),l&&(c=c.concat(l.call(this,i))),c}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,r){return O.lex(t,r??this.defaults)}parser(t,r){return j.parse(t,r??this.defaults)}parseMarkdown(t){return(n,o)=>{const l={...o},a={...this.defaults,...l},i=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&l.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));a.hooks&&(a.hooks.options=a,a.hooks.block=t);const c=a.hooks?a.hooks.provideLexer():t?O.lex:O.lexInline,p=a.hooks?a.hooks.provideParser():t?j.parse:j.parseInline;if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then(d=>c(d,a)).then(d=>a.hooks?a.hooks.processAllTokens(d):d).then(d=>a.walkTokens?Promise.all(this.walkTokens(d,a.walkTokens)).then(()=>d):d).then(d=>p(d,a)).then(d=>a.hooks?a.hooks.postprocess(d):d).catch(i);try{a.hooks&&(n=a.hooks.preprocess(n));let d=c(n,a);a.hooks&&(d=a.hooks.processAllTokens(d)),a.walkTokens&&this.walkTokens(d,a.walkTokens);let h=p(d,a);return a.hooks&&(h=a.hooks.postprocess(h)),h}catch(d){return i(d)}}}onError(t,r){return n=>{if(n.message+=`
161
- Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+A(n.message+"",!0)+"</pre>";return r?Promise.resolve(o):o}if(r)return Promise.reject(n);throw n}}}const J=new en;function B(s,t){return J.parse(s,t)}B.options=B.setOptions=function(s){return J.setOptions(s),B.defaults=J.defaults,rt(B.defaults),B},B.getDefaults=Ne,B.defaults=K,B.use=function(...s){return J.use(...s),B.defaults=J.defaults,rt(B.defaults),B},B.walkTokens=function(s,t){return J.walkTokens(s,t)},B.parseInline=J.parseInline,B.Parser=j,B.parser=j.parse,B.Renderer=$e,B.TextRenderer=Fe,B.Lexer=O,B.lexer=O.lex,B.Tokenizer=xe,B.Hooks=de,B.parse=B,B.options,B.setOptions,B.use,B.walkTokens,B.parseInline,j.parse,O.lex;const tn={class:"space-y-4"},sn={__name:"vs-editor-form-data",props:{widgetName:{type:String},dashboardId:{type:String,default:""},data:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(s,{expose:t,emit:r}){var _,$,w,L,F,R,q,U,V,v,Z,G,he,me,ue,I,Q,fe,jt,Wt,qt,Ut,vt,Ht,Gt,Zt,Qt,Xt,Kt,Jt,Yt,es;const n=e.defineAsyncComponent(()=>import("@opengis/form")),{$notify:o}=e.getCurrentInstance().proxy,l=r,a=s,i=e.ref(null),c=e.ref([]),p=e.computed(()=>{const E=a.columns??[];return E.length?E:c.value}),d=e.computed(()=>a.dashboardId||i.value);async function h(){const E=d.value;if(!(p.value.length||!E||!a.widgetName))try{const C=await T.get(`/bi-data?dashboard=${E}&widget=${a.widgetName}`);Array.isArray(C==null?void 0:C.columns)&&C.columns.length&&(c.value=C.columns)}catch{}}const m=E=>(E==null?void 0:E.name)!=null?{id:E.name,text:E.title||E.name}:null,g=E=>Array.isArray(E)?[...E].sort((C,H)=>{const te=C.text&&C.text!==C.id,ts=H.text&&H.text!==H.id;return te&&!ts?-1:!te&&ts?1:(C.text||"").localeCompare(H.text||"",void 0,{sensitivity:"base"})}):E,u=e.computed(()=>{const E=(p.value??[]).filter(C=>(C==null?void 0:C.type)=="text"||(C==null?void 0:C.type)==="date"||(C==null?void 0:C.type)==="timestamp without time zone"||(C==null?void 0:C.type)==="boolean"||(C==null?void 0:C.type)==="integer").map(m).filter(Boolean);return g(E)}),x=e.computed(()=>`${a.widgetName}-${u.value.length}-${(p.value??[]).length}`),k=e.computed(()=>({text:{type:"Text",label:"Text",conditions:["type","==","text"]},x:{type:"select",label:"X Axis",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:[...u.value]},cls:{label:"X Axis classifier",type:"text",conditions:["type","not_in",["text","table","map","cluster"]]},y_type:{label:"Y type",type:"select",options:[{id:"columns",text:"columns"},{id:"function",text:"function"}],conditions:["type","not_in",["text","table","map","number","cluster"]]},tableSQL:{label:"tableSQL",type:"text",hidden:!0},metric:{type:"select",label:"Y Axis",conditions:[["type","not_in",["text","table","map","cluster"]],["y_type","!=","function"]],options:[{id:"count",text:"count"},...g(p.value.filter(E=>(E==null?void 0:E.type)==="numeric"||(E==null?void 0:E.type)==="double precision").map(m).filter(Boolean))]},fx:{type:"text",label:"Function",conditions:[["y_type","==","function"]]},query:{label:"Query",type:"text",conditions:["type","not_in",["text","table","map","number"]]},groupby:{type:"select",label:"Groupby",view:"buttons",style:{size:"xs"},options:[{id:"null",text:"null"},...g(p.value.filter(E=>(E==null?void 0:E.type)=="text"||(E==null?void 0:E.type)==="boolean"||(E==null?void 0:E.type)==="integer").map(m).filter(Boolean))],conditions:["type","==","bar"]},columns:{type:"checkbox",label:"Columns",style:{size:"xs"},options:g((p.value??[]).map(m).filter(Boolean)),conditions:["type","in",["table","map"]]},granularity:{type:"radio",label:"Granularity",options:[{id:"year",text:"year"},{id:"quarter",text:"quarter"},{id:"month",text:"month"},{id:"week",text:"week"}],conditions:["x.type","==","date"]},type:{type:"Text",hidden:!0}})),f=e.ref({x:(($=(_=a.data)==null?void 0:_.data)==null?void 0:$.x)||((w=a.data)==null?void 0:w.x)||null,metric:((F=(L=a.data)==null?void 0:L.data)==null?void 0:F.metric)||((R=a.data)==null?void 0:R.metric)||null,columns:((U=(q=a.data)==null?void 0:q.data)==null?void 0:U.columns)||((V=a.data)==null?void 0:V.columns)||null,granularity:((Z=(v=a.data)==null?void 0:v.data)==null?void 0:Z.granularity)||((G=a.data)==null?void 0:G.granularity)||null,type:((me=(he=a.data)==null?void 0:he.data)==null?void 0:me.type)||((ue=a.data)==null?void 0:ue.type)||null,groupby:((Q=(I=a.data)==null?void 0:I.data)==null?void 0:Q.groupby)||a.data.groupby||null,fx:((jt=(fe=a.data)==null?void 0:fe.data)==null?void 0:jt.fx)||((Wt=a.data)==null?void 0:Wt.fx)||null,query:((Ut=(qt=a.data)==null?void 0:qt.data)==null?void 0:Ut.query)||((vt=a.data)==null?void 0:vt.query)||null,y_type:((Gt=(Ht=a.data)==null?void 0:Ht.data)==null?void 0:Gt.y_type)||((Zt=a.data)==null?void 0:Zt.y_type)||null,tableSQL:((Xt=(Qt=a.data)==null?void 0:Qt.data)==null?void 0:Xt.tableSQL)||((Kt=a.data)==null?void 0:Kt.tableSQL)||null,cls:((Yt=(Jt=a.data)==null?void 0:Jt.data)==null?void 0:Yt.cls)||((es=a.data)==null?void 0:es.cls)||null}),y=async()=>{try{await T.put(`/bi-dashboard/${d.value}/${a.widgetName}`,{data:f.value});let E=`/bi-data?dashboard=${d.value}&widget=${a.widgetName}`;Object.entries(f.value).forEach(([H,te])=>{E+=`&${H}=${te}`});const C=new CustomEvent(`update-data-${a.widgetName}`);C.filterUrl=E,window.dispatchEvent(C),l("update-dashboard"),o({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{o({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}},b=async()=>{try{let E=`/bi-data?dashboard=${d.value}&widget=${a.widgetName}`;Object.entries(f.value).forEach(([H,te])=>{E+=`&${H}=${te}`});const C=new CustomEvent(`update-data-${a.widgetName}`);C.filterUrl=E,window.dispatchEvent(C),l("update-dashboard")}catch{await o({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.watch(f,()=>{b()},{deep:!0}),e.onMounted(()=>{const E=new URLSearchParams(window.top.location.search);i.value=E.get("dashboard"),h()}),e.watch(()=>[a.widgetName,a.dashboardId,i.value],()=>{c.value=[],h()},{immediate:!0}),t({requestUpdateWidget:y}),(E,C)=>(e.openBlock(),e.createElementBlock("div",tn,[(e.openBlock(),e.createBlock(e.unref(n),{key:x.value,schema:k.value,values:f.value,"onUpdate:values":C[0]||(C[0]=H=>f.value=H)},null,8,["schema","values"]))]))}},rn={class:"space-y-4"},nn={__name:"vs-editor-form-yaml",props:{yamlValue:{type:null,default:()=>""},widgetName:{type:String},data:{type:Object}},setup(s,{expose:t}){const r=typeof window<"u"?window.echarts:null,n=e.defineAsyncComponent(()=>import("@opengis/form").then(h=>h.VsInputMonaco)),o=e.ref(null),{$notify:l}=e.getCurrentInstance().proxy,a=s,i=(h,{dimensions:m,source:g})=>{const u=h.getOption(),{data:x,...k}=(u==null?void 0:u.series)[0],[,...f]=m||[],y=f.map((b,_)=>({...(u==null?void 0:u.series[_])||{},data:g.map($=>$[_+1]),name:b}));h==null||h.setOption({...u||{},dataset:{dimensions:m,source:g},series:y,xAxis:{type:"category"},yAxis:{}},!0)},c=h=>{const m=document.getElementById(h);if(!m)return null;const g=r==null?void 0:r.getInstanceByDom(m);return g||null},p=e.ref(a.yamlValue),d=async()=>{try{await T.put(`/bi-dashboard/${o.value}/${a.widgetName}`,{yml:p.value});const h=c(a.widgetName);if(h){const m=await T.get(`/bi-data?dashboard=${o.value}&widget=${a.widgetName}`);i(h,m)}l({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{l({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.onMounted(()=>{const h=new URLSearchParams(window.top.location.search);o.value=h.get("dashboard")}),t({requestUpdateWidget:d}),(h,m)=>(e.openBlock(),e.createElementBlock("div",rn,[e.createVNode(e.unref(n),{modelValue:p.value,"onUpdate:modelValue":m[0]||(m[0]=g=>p.value=g),syntax:"yaml",theme:"vs-light",height:400,minimap:!1},null,8,["modelValue"])]))}},on={class:"pt-[10px]"},yt={"vs-editor-form-style":_r,"vs-editor-form-data":sn,"vs-editor-form-yaml":nn,"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(s,{emit:t}){var d;const r=e.defineAsyncComponent(()=>import("@opengis/form")),{$notify:n}=e.getCurrentInstance().proxy,o=t,l=s,a=e.ref(null),i={granularity:{ua:"Granularity",type:"checkbox",options:["week","month","quarter","year"]},export:{ua:"Export",type:"Switcher"},groupby:{ua:"Groupby",type:"checkbox",options:(d=l.columns)==null?void 0:d.map(({name:h})=>h)}},c=e.ref(l.controls||{}),p=async()=>{try{await T.put(`/bi-dashboard/${a.value}/${l.widgetName}`,{controls:c.value}),await n({type:"success",title:"Успішно!",message:"Дані успішно оновлено"}),staticTypes!=null&&staticTypes.includes(c.value.type)&&o("update-dashboard")}catch{await n({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.onMounted(()=>{const h=new URLSearchParams(window.top.location.search);a.value=h.get("dashboard")}),(h,m)=>{const g=e.resolveComponent("VsButton");return e.openBlock(),e.createElementBlock("div",on,[e.createVNode(g,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:p},{default:e.withCtx(()=>m[1]||(m[1]=[e.createTextVNode(" Зберегти ")])),_:1}),e.createVNode(e.unref(r),{schema:i,values:c.value,"onUpdate:values":m[0]||(m[0]=u=>c.value=u)},null,8,["values"])])}}}},an={key:0,class:"p-4 text-sm text-amber-700 bg-amber-50 rounded-lg"},xt={__name:"editor-tab-error-boundary",props:{tabComponent:{type:Object,default:null},tabKey:{type:[String,Number],default:""}},emits:["update-dashboard"],setup(s,{expose:t}){const r=s,n=e.ref(null);function o(){var a,i;(i=(a=n.value)==null?void 0:a.requestUpdateWidget)==null||i.call(a)}t({save:o});const l=e.ref(!1);return e.onErrorCaptured((a,i,c)=>(console.error("Editor tab error:",a,c),l.value=!0,!1)),e.watch(()=>r.tabComponent,()=>{l.value=!1},{immediate:!0}),(a,i)=>l.value?(e.openBlock(),e.createElementBlock("div",an," Помилка завантаження вмісту. Переключіть таб або оновіть сторінку. ")):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.tabComponent),e.mergeProps({ref_key:"tabRef",ref:n,key:s.tabKey||"tab"},a.$attrs,{onUpdateDashboard:i[0]||(i[0]=c=>a.$emit("update-dashboard"))}),null,16))}},ln={class:"h-full flex flex-col bg-white shrink-0 !w-[400px] border rounded-xl overflow-hidden border-gray-200"},cn={key:0,class:"flex flex-col min-h-0 flex-1"},dn={class:"flex items-center border-b border-gray-200 bg-white shrink-0 px-4 h-[49px]"},pn={class:"flex items-center gap-6 min-w-0"},hn=["onClick"],mn={key:0,class:"absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 rounded-full"},un={class:"flex items-center gap-1 ml-auto shrink-0"},fn={key:1,class:"flex-1 min-h-0 overflow-auto px-4 py-4 [&::-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"},gn={key:0},bn={key:1},yn={class:"p-4"},xn={class:"flex justify-end mt-4 gap-x-3"},kn={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},wn={__name:"vs-editor-forms",props:e.mergeModels({selectedWidgetData:{type:Object,required:!1,default:null},selectedDashboard:{type:String,default:()=>""},currentWidgetData:{type:String,default:()=>""}},{selectedWidget:{},selectedWidgetModifiers:{}}),emits:e.mergeModels(["update-data"],["update:selectedWidget"]),setup(s,{emit:t}){var b,_;const r=e.defineAsyncComponent(()=>import("@opengis/form")),n=(_=(b=e.getCurrentInstance())==null?void 0:b.proxy)==null?void 0:_.$notify,o=t,l=e.ref(null),a=s,i=e.ref(!1),c=e.ref(!0),p=e.ref(!1),d=e.ref({}),h=e.useModel(s,"selectedWidget"),m=["table","text","number","stat","progress","listbar","map","pivot"],g=e.ref("data"),u=async()=>{try{await T.delete(`/bi-dashboard/${a.selectedDashboard}/${a.selectedWidgetData.name}`);const $=new URL(window.top.location.href);$.searchParams.set("dashboard",a.selectedDashboard),$.searchParams.delete("widget"),window.top.history.pushState({},"",$),o("update-data"),i.value=!1,n({type:"success",title:"Успішно!",message:"Віджет успішно видалено"})}catch($){console.error($),n({type:"error",title:"Помилка!",message:"При спробі видалити віджет виникла помилка"})}},x=e.computed(()=>{const $=[{id:"data",label:"Дані"},{id:"style",label:"Стилі"},{id:"yaml",label:"{ }"}];return $==null?void 0:$.filter(w=>{var L,F,R;return w.id==="style"?!(m!=null&&m.includes(((L=a.selectedWidgetData)==null?void 0:L.type)||((R=(F=a.selectedWidgetData)==null?void 0:F.data)==null?void 0:R.type))):!0})}),k=()=>{var $,w,L,F,R,q,U,V,v;d.value={title:($=a.selectedWidgetData)==null?void 0:$.title,type:(w=a.selectedWidgetData)==null?void 0:w.type,table:(L=a.selectedWidgetData)==null?void 0:L.table_name,query:(R=(F=a.selectedWidgetData)==null?void 0:F.data)==null?void 0:R.query,x:(U=(q=a.selectedWidgetData)==null?void 0:q.data)==null?void 0:U.x,cls:(v=(V=a.selectedWidgetData)==null?void 0:V.data)==null?void 0:v.cls},p.value=!0},f=async()=>{try{await T.put(`/bi-dashboard/${a.selectedDashboard}/${a.selectedWidgetData.name}`,d.value),n({type:"success",title:"Успішно!",message:"Дані успішно змінено"}),await o("update-data"),p.value=!1}catch{n({type:"error",title:"Помилка!",message:"При спробі внести зміни виникла помилка"})}};e.watch(h,$=>{c.value=!1;const w=new URL(window.top.location.href);$?(w.searchParams.set("widget",$),window.top.history.pushState({},"",w)):(w.searchParams.delete("widget"),window.top.history.pushState({},"",w)),setTimeout(()=>c.value=!0)});const y={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:"Таблиця"},query:{type:"Text",ua:"Query",placeholder:"Query"},x:{type:"Text",ua:"X Axis",placeholder:"X Axis"},cls:{type:"Text",ua:"Cls",placeholder:"Cls"}};return($,w)=>{var F,R,q,U,V,v,Z,G,he,me,ue;const L=e.resolveComponent("VsPopover");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",ln,[s.selectedWidgetData?(e.openBlock(),e.createElementBlock("div",cn,[e.createElementVNode("div",dn,[e.createElementVNode("nav",pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,I=>(e.openBlock(),e.createElementBlock("button",{key:I.id,type:"button",class:e.normalizeClass(["relative pb-3 pt-1 text-sm font-medium transition-colors whitespace-nowrap",g.value===I.id?"text-blue-600":"text-gray-600 hover:text-gray-900"]),onClick:Q=>g.value=I.id},[e.createTextVNode(e.toDisplayString(I.label)+" ",1),g.value===I.id?(e.openBlock(),e.createElementBlock("span",mn)):e.createCommentVNode("",!0)],10,hn))),128))]),e.createElementVNode("div",un,[e.createVNode(L,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"h-8 w-8 flex items-center justify-center rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors",title:"Зберегти",onClick:w[0]||(w[0]=I=>{var Q,fe;return(fe=(Q=l.value)==null?void 0:Q.save)==null?void 0:fe.call(Q)})},[e.createVNode(e.unref(gs),{class:"h-4 w-4"})])]),default:e.withCtx(()=>[w[9]||(w[9]=e.createTextVNode(" Зберегти "))]),_:1}),e.createVNode(L,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"h-8 w-8 flex items-center justify-center rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors",onClick:k},[e.createVNode(st,{class:"h-4 w-4"})])]),default:e.withCtx(()=>[w[10]||(w[10]=e.createTextVNode(" Редагувати віджет "))]),_:1}),e.createVNode(L,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"h-8 w-8 flex items-center justify-center rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors",onClick:w[1]||(w[1]=I=>i.value=!0)},[e.createVNode(e.unref(tt),{class:"h-4 w-4"})])]),default:e.withCtx(()=>[w[11]||(w[11]=e.createTextVNode(" Видалити віджет "))]),_:1})])]),(F=s.currentWidgetData)!=null&&F.status?(e.openBlock(),e.createBlock(ye,{key:0,title:(R=s.currentWidgetData)==null?void 0:R.title,text:(q=s.currentWidgetData)==null?void 0:q.message},null,8,["title","text"])):(e.openBlock(),e.createElementBlock("div",fn,[c.value&&s.currentWidgetData?(e.openBlock(),e.createElementBlock("div",gn,[e.createVNode(xt,{ref_key:"tabPanelRef",ref:l,"tab-key":g.value,"tab-component":e.unref(yt)["vs-editor-form-"+g.value],widgetName:(U=s.selectedWidgetData)==null?void 0:U.name,dashboardId:s.selectedDashboard,yamlValue:((V=s.selectedWidgetData)==null?void 0:V.yml)||"",data:s.selectedWidgetData,controls:(v=s.selectedWidgetData)==null?void 0:v.controls,columns:(Z=s.currentWidgetData)==null?void 0:Z.columns,onUpdateDashboard:w[2]||(w[2]=I=>$.$emit("update-data"))},null,8,["tab-key","tab-component","widgetName","dashboardId","yamlValue","data","controls","columns"])])):(e.openBlock(),e.createElementBlock("div",bn,[e.createVNode(xt,{ref_key:"tabPanelRef",ref:l,"tab-key":g.value,"tab-component":e.unref(yt)["vs-editor-form-"+g.value],widgetName:(G=s.selectedWidgetData)==null?void 0:G.name,dashboardId:s.selectedDashboard,yamlValue:((he=s.selectedWidgetData)==null?void 0:he.yml)||"",data:s.selectedWidgetData,controls:(me=s.selectedWidgetData)==null?void 0:me.controls,columns:(ue=s.currentWidgetData)==null?void 0:ue.columns,onUpdateDashboard:w[3]||(w[3]=I=>$.$emit("update-data"))},null,8,["tab-key","tab-component","widgetName","dashboardId","yamlValue","data","controls","columns"])])),e.createVNode(ne,{teleport:"#modal",visible:i.value,title:"Ви впевнені?",onClose:w[5]||(w[5]=I=>i.value=!1)},{default:e.withCtx(()=>[e.createElementVNode("div",yn,[w[12]||(w[12]=e.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей віджет? ",-1)),e.createElementVNode("div",xn,[e.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:w[4]||(w[4]=I=>i.value=!1)}," Скасувати "),e.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:u}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"])]))])):(e.openBlock(),e.createBlock(ye,{key:1,title:"Оберіть один з віджетів",text:"",class:"p-4"}))]),e.createVNode(ne,{teleport:"#modal",visible:p.value,title:"Редагувати віджет",onClose:w[8]||(w[8]=I=>p.value=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",kn,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:w[7]||(w[7]=I=>p.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 hover:bg-gray-100 duration-300"}," Скасувати "),e.createElementVNode("button",{onClick:f,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 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:e.withCtx(()=>[y?(e.openBlock(),e.createBlock(e.unref(r),{key:0,schema:y,values:d.value,"onUpdate:values":w[6]||(w[6]=I=>d.value=I)},null,8,["values"])):e.createCommentVNode("",!0)]),_:1},8,["visible"])],64)}}},_n={class:"overflow-hidden flex flex-col min-h-[480px]"},$n={class:"flex-1 flex min-h-0 gap-4"},Vn={class:"flex-1 min-w-0 pb-4 overflow-auto bg-gray-50/50"},En={class:"w-[400px] shrink-0 flex flex-col"},Cn={__name:"vs-widget-editor-panel",props:{selectedWidget:{type:String,default:""},selectedWidgetData:{type:Object,default:null},currentWidgetData:{type:Object,default:null},selectedDashboard:{type:String,default:""},dashboardWidgets:{type:Array,default:()=>[]}},emits:["update:selectedWidget","update-data"],setup(s,{emit:t}){const r=s,n=t,o=e.computed({get:()=>r.selectedWidget,set:l=>n("update:selectedWidget",l)});return(l,a)=>(e.openBlock(),e.createElementBlock("div",_n,[e.createElementVNode("div",$n,[e.createElementVNode("div",Vn,[e.createVNode(re,{dashboard:s.selectedDashboard,widget:s.selectedWidget,"selected-widget":s.selectedWidget,"dashboard-widgets":s.dashboardWidgets,"filter-u-rl":void 0,class:"max-h-full"},null,8,["dashboard","widget","selected-widget","dashboard-widgets"])]),e.createElementVNode("div",En,[e.createVNode(wn,{selectedWidget:o.value,"onUpdate:selectedWidget":a[0]||(a[0]=i=>o.value=i),selectedWidgetData:s.selectedWidgetData,currentWidgetData:s.currentWidgetData,selectedDashboard:s.selectedDashboard,onUpdateData:a[1]||(a[1]=i=>l.$emit("update-data"))},null,8,["selectedWidget","selectedWidgetData","currentWidgetData","selectedDashboard"])])])]))}},kt={__name:"icon-grid",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(hs),e.mergeProps(t.$attrs,{size:24}),null,16))}},Bn={__name:"icon-filter",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ve),e.mergeProps(t.$attrs,{size:24}),null,16))}},wt={__name:"icon-table",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ys),e.mergeProps(t.$attrs,{size:24}),null,16))}},Dn={__name:"icon-more",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(is),e.mergeProps(t.$attrs,{size:24}),null,16))}},Nn=e.defineAsyncComponent(()=>import("@opengis/form")),Sn={components:{VsModal:ne,VForm:Nn,deleteIcon:tt,editIcon:st,IconGrid:kt,IconMore:Dn,IconFilter:Bn,IconTable:wt},watch:{dashboardData:{handler(s){var r,n;if(this.formEditValue={title:s==null?void 0:s.title,description:s==null?void 0:s.description,table_name:s==null?void 0:s.table_name,db:s==null?void 0:s.db,public:s==null?void 0:s.public,words:s==null?void 0:s.words},!((r=s==null?void 0:s.panels)!=null&&r.length)){this.formGridValue={panels:[]},this.formFilterValue={filters:(s==null?void 0:s.filters)||null};return}const t=(n=s==null?void 0:s.panels)==null?void 0:n.map(o=>{var i,c;const{title:l="",type:a=""}=((c=(i=s==null?void 0:s.widgets)==null?void 0:i.find(p=>(p==null?void 0:p.name)===(o==null?void 0:o.widget)))==null?void 0:c.data)||{};return{title:l,type:a,...o}});this.formGridValue={panels:t},this.formFilterValue={filters:(s==null?void 0:s.filters)||null}},immediate:!0}},data(){return{isDeleteConfirm:!1,isFormEdit:!1,isFormGrid:!1,isFormFilter:!1,isVisibleTableColumns:!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:()=>{}},columns:{type:Array}},methods:{async editDashboard(){var s,t;try{(t=(s=this.$refs)==null?void 0:s.formEdit)==null||t.doValidation(),await T.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 s,t;try{(t=(s=this.$refs)==null?void 0:s.formGrid)==null||t.doValidation(),await T.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 s,t;try{(t=(s=this.$refs)==null?void 0:s.formFilter)==null||t.doValidation(),await T.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 T.delete(`/bi-dashboard/${this.selected}`);const s=new URL(window.top.location.href);s.searchParams.delete("dashboard"),s.searchParams.delete("widget"),window.history.pushState({},"",s),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:"При спробі видалити дашборд виникла помилка"})}},closePopover(){document.body.click()}}},zn={key:0,class:"flex items-center gap-4"},Ln={class:"h-[30px] w-[30px] flex items-center justify-center"},Tn={class:"flex flex-col items-start -ml-2 -mr-2"},In={class:"p-4"},Mn={class:"flex justify-end mt-4 gap-x-3"},Fn={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Pn={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Rn={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function An(s,t,r,n,o,l){const a=e.resolveComponent("IconFilter"),i=e.resolveComponent("VsPopover"),c=e.resolveComponent("IconGrid"),p=e.resolveComponent("IconMore"),d=e.resolveComponent("VsModal"),h=e.resolveComponent("VForm");return e.openBlock(),e.createElementBlock("div",null,[r.selected?(e.openBlock(),e.createElementBlock("div",zn,[e.createVNode(i,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{class:"h-[30px] w-[30px] flex items-center justify-center",onClick:t[0]||(t[0]=m=>o.isFormFilter=!0)},[e.createVNode(a,{class:"h-[20px] text-gray-500"})])]),default:e.withCtx(()=>[t[19]||(t[19]=e.createTextVNode(" Редагувати фільтри "))]),_:1}),e.createVNode(i,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{class:"h-[30px] w-[30px] flex items-center justify-center",onClick:t[1]||(t[1]=m=>o.isFormGrid=!0)},[e.createVNode(c,{class:"h-[20px] text-gray-500"})])]),default:e.withCtx(()=>[t[20]||(t[20]=e.createTextVNode(" Редагувати структуру дашборду "))]),_:1}),e.createVNode(i,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createVNode(i,{placement:"bottom-left"},{reference:e.withCtx(()=>[e.createElementVNode("button",Ln,[e.createVNode(p,{class:"h-[20px]"})])]),default:e.withCtx(()=>[e.createElementVNode("div",Tn,[e.createElementVNode("button",{onClick:t[2]||(t[2]=m=>{l.closePopover(),o.isFormEdit=!0}),class:"px-[8px] py-[4px] hover:bg-gray-100 w-full text-start rounded-lg"}," Редагувати дашборд "),e.createElementVNode("button",{onClick:t[3]||(t[3]=m=>{l.closePopover(),o.isDeleteConfirm=!0}),class:"px-[8px] py-[4px] hover:bg-gray-100 w-full text-start rounded-lg"}," Видалити дашборд ")])]),_:1})]),default:e.withCtx(()=>[t[21]||(t[21]=e.createTextVNode(" Керування дашбордом "))]),_:1})])):e.createCommentVNode("",!0),e.createVNode(d,{teleport:"#modal",visible:o.isDeleteConfirm,size:"small",title:"Ви впевнені?",onClose:t[6]||(t[6]=m=>o.isDeleteConfirm=!1)},{default:e.withCtx(()=>[e.createElementVNode("div",In,[t[22]||(t[22]=e.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей дашборд? ",-1)),e.createElementVNode("div",Mn,[e.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:t[4]||(t[4]=m=>o.isDeleteConfirm=!1)}," Скасувати "),e.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:t[5]||(t[5]=(...m)=>l.deleteDashboard&&l.deleteDashboard(...m))}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"]),e.createVNode(d,{teleport:"#modal",visible:o.isFormEdit,title:"Редагувати дашборд",onClose:t[10]||(t[10]=m=>o.isFormEdit=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",Fn,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:t[8]||(t[8]=m=>o.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"}," Скасувати "),e.createElementVNode("button",{onClick:t[9]||(t[9]=(...m)=>l.editDashboard&&l.editDashboard(...m)),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:e.withCtx(()=>[e.createVNode(h,{ref:"formEdit",schema:o.editDashboardScheme,values:o.formEditValue,"onUpdate:values":t[7]||(t[7]=m=>o.formEditValue=m)},null,8,["schema","values"])]),_:1},8,["visible"]),e.createVNode(d,{teleport:"#modal",visible:o.isFormGrid,title:"Редагувати структуру дашборду",onClose:t[14]||(t[14]=m=>o.isFormGrid=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",Pn,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:t[12]||(t[12]=m=>o.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"}," Скасувати "),e.createElementVNode("button",{onClick:t[13]||(t[13]=(...m)=>l.editDashboardGrid&&l.editDashboardGrid(...m)),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:e.withCtx(()=>[e.createVNode(h,{ref:"formgrid",schema:o.editGridScheme,values:o.formGridValue,"onUpdate:values":t[11]||(t[11]=m=>o.formGridValue=m)},null,8,["schema","values"])]),_:1},8,["visible"]),e.createVNode(d,{teleport:"#modal",visible:o.isFormFilter,title:"Редагувати фільтри",onClose:t[18]||(t[18]=m=>o.isFormFilter=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",Rn,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:t[16]||(t[16]=m=>o.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"}," Скасувати "),e.createElementVNode("button",{onClick:t[17]||(t[17]=(...m)=>l.editDashboardFilters&&l.editDashboardFilters(...m)),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:e.withCtx(()=>[e.createVNode(h,{ref:"formFilter",schema:o.editFilterScheme,values:o.formFilterValue,"onUpdate:values":t[15]||(t[15]=m=>o.formFilterValue=m)},null,8,["schema","values"])]),_:1},8,["visible"])])}const On=D(Sn,[["render",An]]),jn={class:"flex-1 min-w-0 flex flex-col overflow-auto"},Wn={class:"max-w-7xl mx-auto px-6 w-full flex flex-col min-h-0 flex-1"},qn={class:"relative z-10 shrink-0 mt-4 mb-6"},Un={class:"flex items-center text-sm text-gray-600"},vn={key:0,class:"flex items-center justify-between gap-4 mt-3"},Hn={class:"min-w-0"},Gn={class:"text-2xl font-bold text-gray-900"},Zn={key:0,class:"mt-1.5 text-sm text-gray-600"},Qn={class:"flex items-center shrink-0"},Xn={key:1,class:"grid flex-grow w-full grid-cols-12 gap-4 py-4 pr-[15px] min-h-0 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"},Kn=D({__name:"vs-editor",props:{prefix:String,customClass:{type:String,default:()=>"w-screen h-screen"},initialDashboardId:{type:String,default:""}},emits:["back"],setup(s,{emit:t}){const r=s;ge(r.prefix||"/api");const n=t,o=e.inject("biClearDashboard",null),l=e.ref(r.initialDashboardId||""),a=e.ref(""),i=e.ref(null),c=e.ref(null),p=e.ref(null),d=async()=>{if(!l.value){i.value=null;return}try{const g=await T.get(`/bi-dashboard/${l.value}`);i.value=g}catch(g){console.error(g)}},h=e.computed(()=>{var g,u,x;return(x=Array.isArray((g=i.value)==null?void 0:g.widgets)?(u=i.value)==null?void 0:u.widgets:[])==null?void 0:x.find(k=>(k==null?void 0:k.name)===a.value)}),m=e.computed(()=>{var x,k,f,y,b;const u=[o?{label:"Дашборди",onClick:()=>{o(),n("back")}}:{label:"Дашборди",to:"/editor"}];if((x=i.value)!=null&&x.title||l.value){const _=((k=i.value)==null?void 0:k.title)||l.value||"Редактор",$=!!a.value;u.push({label:_,...$?{onClick:()=>{a.value=""}}:{}})}else u.push({label:"Редактор"});if(a.value&&h.value){const _=((y=(f=h.value)==null?void 0:f.data)==null?void 0:y.title)||((b=h.value)==null?void 0:b.title)||a.value;u.push({label:_})}return u});return e.watch(l,(g,u)=>{var k,f,y;u&&(a.value="");const x=new URL(window.top.location.href);g?((k=x==null?void 0:x.searchParams)==null||k.set("dashboard",g),(y=(f=window.top)==null?void 0:f.history)==null||y.pushState({},"",x),d()):(x==null||x.searchParams.delete("dashboard"),x==null||x.searchParams.delete("widget"))}),e.onMounted(()=>{var g,u;if(r.initialDashboardId)l.value=r.initialDashboardId;else{const x=new URLSearchParams(((u=(g=window.top)==null?void 0:g.location)==null?void 0:u.search)||""),k=x.get("dashboard");k&&(l.value=k),a.value=x.get("widget")||""}d()}),(g,u)=>{var x,k;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex w-full h-full",[s.customClass]])},[e.createElementVNode("div",jn,[e.createElementVNode("div",Wn,[e.createElementVNode("div",qn,[e.createElementVNode("div",Un,[e.createVNode(et,{items:m.value,compact:""},null,8,["items"])]),l.value&&i.value?(e.openBlock(),e.createElementBlock("div",vn,[e.createElementVNode("div",Hn,[e.createElementVNode("h1",Gn,e.toDisplayString(i.value.title||l.value),1),i.value.description?(e.openBlock(),e.createElementBlock("p",Zn,e.toDisplayString(i.value.description),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Qn,[a.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors",onClick:u[0]||(u[0]=f=>a.value="")},[e.createVNode(e.unref(Ge),{class:"w-4 h-4"}),u[6]||(u[6]=e.createTextVNode(" Закрити "))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(On,{selected:l.value,"onUpdate:selected":u[1]||(u[1]=f=>l.value=f),dashboardData:i.value,columns:(x=i.value)==null?void 0:x.columns,selectedWidgetData:h.value,prefix:s.prefix,onUpdateEditor:d},null,8,["selected","dashboardData","columns","selectedWidgetData","prefix"]),e.createElementVNode("button",{type:"button",class:"ml-4 flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors shadow-sm font-medium",onClick:u[2]||(u[2]=f=>{var y,b;return(b=(y=p.value)==null?void 0:y.open)==null?void 0:b.call(y)})},u[7]||(u[7]=[e.createElementVNode("span",{class:"leading-none"},"+",-1),e.createTextVNode(" Створити віджет ")])),l.value?(e.openBlock(),e.createBlock(kr,{key:0,ref_key:"createWidgetRef",ref:p,inline:"",columns:(k=i.value)==null?void 0:k.columns,selectedDashboard:l.value,onUpdateData:d},null,8,["columns","selectedDashboard"])):e.createCommentVNode("",!0)],64))])])):e.createCommentVNode("",!0)]),a.value&&i.value?(e.openBlock(),e.createBlock(Cn,{key:0,"selected-widget":a.value,"onUpdate:selectedWidget":u[3]||(u[3]=f=>a.value=f),"selected-widget-data":h.value,"current-widget-data":c.value,"selected-dashboard":l.value,"dashboard-widgets":i.value.widgets||[],onUpdateData:d},null,8,["selected-widget","selected-widget-data","current-widget-data","selected-dashboard","dashboard-widgets"])):(e.openBlock(),e.createElementBlock("div",Xn,[i.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(i.value.panels,(f,y)=>{var b;return e.openBlock(),e.createElementBlock("div",{key:y,class:e.normalizeClass([`col-span-${f.col||12}`,"flex flex-col gap-[10px]"])},[(b=f.widgets)!=null&&b.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(f.widgets,_=>(e.openBlock(),e.createBlock(re,{onClick:$=>a.value=_,"onUpdate:currentWidgetData":u[4]||(u[4]=$=>c.value=$),key:_,dashboard:l.value,widget:_,selectedWidget:a.value,"dashboard-widgets":i.value.widgets,class:e.normalizeClass({"border border-blue-500":a.value===_})},null,8,["onClick","dashboard","widget","selectedWidget","dashboard-widgets","class"]))),128)):(e.openBlock(),e.createBlock(re,{key:1,onClick:_=>a.value=f.widget,"onUpdate:currentWidgetData":u[5]||(u[5]=_=>c.value=_),class:e.normalizeClass(["flex flex-col",{"border border-blue-500":a.value===f.widget}]),dashboard:l.value,widget:f.widget,selectedWidget:a.value,"dashboard-widgets":i.value.widgets},null,8,["onClick","class","dashboard","widget","selectedWidget","dashboard-widgets"]))],2)}),128)):(e.openBlock(),e.createBlock(ye,{key:0,class:"col-span-12"}))]))])])],2)}}},[["__scopeId","data-v-cc75be6a"]]),Jn={class:"w-full h-screen"},Yn=e.defineComponent({__name:"vs-editor-page",props:{prefix:{default:"/api"},dashboardId:{default:""}},emits:["back"],setup(s){const t=s,r=t.prefix,n=t.dashboardId;return(o,l)=>(e.openBlock(),e.createElementBlock("div",Jn,[e.createVNode(Kn,{customClass:"h-full w-full",prefix:e.unref(r),"initial-dashboard-id":e.unref(n),onBack:l[0]||(l[0]=a=>o.$emit("back"))},null,8,["prefix","initial-dashboard-id"])]))}}),eo={class:"relative group h-full"},to={class:"flex items-start gap-3 flex-1 min-h-0"},so={class:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors shrink-0"},ro={class:"flex-1 min-w-0 flex flex-col min-h-0"},no={class:"font-semibold text-gray-900 mb-1 truncate"},oo={key:0,class:"text-sm text-gray-600 mb-2 line-clamp-2 min-h-10"},ao={key:1,class:"text-sm text-gray-600 mb-2 line-clamp-2 min-h-10 invisible","aria-hidden":"true"},lo={key:2,class:"text-sm text-gray-400 mt-1 shrink-0"},io=D({__name:"dashboard-card",props:{title:String,description:String,modified:String,name:String,widgetCount:Number,reserveLines:Number,dashboardRouteName:String,onOpenEditor:Function,onOpenView:Function},setup(s){const t=s,r=Be(),n=e.ref(!1);function o(){var a;t.dashboardRouteName&&(t.onOpenEditor?t.onOpenEditor(t.dashboardRouteName):(a=r==null?void 0:r.push)==null||a.call(r,{path:"/editor",query:{dashboard:t.dashboardRouteName}}))}function l(a){a.target.closest(".dashboard-card-menu")||(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",l)),e.onUnmounted(()=>document.removeEventListener("click",l)),(a,i)=>(e.openBlock(),e.createElementBlock("div",eo,[e.createElementVNode("button",{type:"button",class:"w-full h-full bg-white border border-gray-200 rounded-lg p-6 hover:shadow-md hover:border-blue-200 transition-all text-left animate-fade-in flex flex-col",onClick:o},[e.createElementVNode("div",to,[e.createElementVNode("div",so,[e.createVNode(e.unref(ps),{size:24,class:"w-5 h-5 text-blue-600"})]),e.createElementVNode("div",ro,[e.createElementVNode("h3",no,e.toDisplayString(s.title),1),s.description?(e.openBlock(),e.createElementBlock("p",oo,e.toDisplayString(s.description),1)):(e.openBlock(),e.createElementBlock("p",ao,"   ")),s.widgetCount!=null?(e.openBlock(),e.createElementBlock("p",lo,e.toDisplayString(s.widgetCount)+" віджетів ",1)):e.createCommentVNode("",!0)])])])]))}},[["__scopeId","data-v-cde0f33b"]]),co=[{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}}];function po(s){return!Array.isArray(s)||s.length===0?{}:s.reduce((t,r)=>{if(!r||r.key==null)return t;const{key:n,...o}=r;return t[n]=o,t},{})}const ho={class:"flex-1 bg-gray-50"},mo={class:"max-w-7xl mx-auto px-6 py-8"},uo={class:"mb-6"},fo={class:"flex items-center justify-between mb-6"},go={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},bo={class:"flex items-center space-x-4"},yo={class:"flex-1 relative"},xo={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},ko=e.defineComponent({__name:"all-dashboards-page",props:{prefix:{}},setup(s){const t=e.defineAsyncComponent(()=>import("@opengis/form")),r=po(co),n=e.ref([]),o=e.ref([]);Be();const l=e.inject("biSetDashboard"),a=s,i=e.ref(null),c=e.ref(!1),p=e.ref({});ge(a.prefix||"/api");async function d(){try{const k=await T.get("/bi-dashboard?type=db"),f=Array.isArray(k==null?void 0:k.rows)?k.rows:[];o.value=f,n.value=f.map(y=>({routeName:String(y.name??""),title:y.title??y.name??"Без назви",description:y.description??null,modified:"-",name:"-"}))}catch(k){console.error("Failed to load dashboards",k),o.value=[],n.value=[]}}async function h(){var f,y,b;const k=(y=(f=e.getCurrentInstance())==null?void 0:f.proxy)==null?void 0:y.$notify;try{await((b=i.value)==null?void 0:b.doValidation()),await T.post("/bi-dashboard",p.value),c.value=!1,p.value={},k==null||k({type:"success",title:"Успішно!",message:"Дашборд створено успішно"}),await d()}catch{k==null||k({type:"error",title:"Помилка!",message:"При спробі створити дашборд виникла помилка"})}}e.onMounted(d);const m=e.ref(1),g=()=>{const k=window.innerWidth;m.value=k>=1024?3:k>=768?2:1};e.onMounted(()=>{g(),window.addEventListener("resize",g)}),e.onUnmounted(()=>{window.removeEventListener("resize",g)});const u=k=>k?k.trim().length>70?2:1:0,x=k=>{const f=m.value||1,b=Math.floor(k/f)*f,_=b+f,$=n.value.slice(b,_);let w=0;for(const L of $){const F=u(L.description??null);if(F>w&&(w=F),w===2)break}return w};return e.ref("grid"),(k,f)=>(e.openBlock(),e.createElementBlock("div",ho,[e.createElementVNode("div",mo,[e.createElementVNode("div",uo,[e.createElementVNode("div",fo,[f[5]||(f[5]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-3xl font-bold text-gray-900"},"Дашборди"),e.createElementVNode("p",{class:"mt-2 text-gray-600"}," Керуйте та переглядайте свої аналітичні дашборди ")],-1)),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 px-4 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors shadow-sm font-medium",onClick:f[0]||(f[0]=y=>c.value=!0)},[e.createVNode(e.unref(He),{size:24,class:"w-4 h-4"}),f[4]||(f[4]=e.createElementVNode("span",null,"Новий дашборд",-1))])]),e.createVNode(ne,{teleport:"#modal",visible:c.value,title:"Створити дашборд",onClose:f[3]||(f[3]=y=>c.value=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",go,[e.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border border-gray-200 rounded-lg hover:bg-gray-100 duration-300",onClick:f[2]||(f[2]=y=>c.value=!1)}," Скасувати "),e.createElementVNode("button",{type:"button",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 hover:bg-blue-700 duration-300",onClick:h}," Зберегти ")])]),default:e.withCtx(()=>[e.createVNode(e.unref(t),{ref_key:"createFormRef",ref:i,schema:e.unref(r),values:p.value,"onUpdate:values":f[1]||(f[1]=y=>p.value=y)},null,8,["schema","values"])]),_:1},8,["visible"]),e.createElementVNode("div",bo,[e.createElementVNode("div",yo,[e.createVNode(e.unref(bs),{size:24,class:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),f[6]||(f[6]=e.createElementVNode("input",{type:"text",placeholder:"Пошук дашбордів...",class:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",value:""},null,-1))])])]),e.createElementVNode("div",xo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(y,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:"cursor-pointer h-full"},[e.createVNode(io,{title:y.title,description:y.description,modified:y.modified,name:y.name,reserveLines:x(b),"dashboard-route-name":y.routeName,"on-open-editor":e.unref(l),"on-open-view":e.unref(l)},null,8,["title","description","modified","name","reserveLines","dashboard-route-name","on-open-editor","on-open-view"])]))),128))])])]))}}),wo=e.defineComponent({__name:"editor-root-page",props:{prefix:{default:"/api"}},setup(s){const t=s,r=e.computed(()=>t.prefix),n=e.ref(""),o=rr();e.onMounted(()=>{var i;const a=(i=o==null?void 0:o.query)==null?void 0:i.dashboard;a!=null&&typeof a=="string"&&(n.value=a.trim())});const l=e.computed(()=>n.value.length>0);return e.provide("biSetDashboard",a=>{n.value=a||""}),e.provide("biClearDashboard",()=>{n.value=""}),e.provide("biSelectedDashboardId",e.readonly(n)),(a,i)=>l.value?(e.openBlock(),e.createBlock(Yn,{key:`editor-${n.value}`,prefix:r.value,"dashboard-id":n.value,onBack:i[0]||(i[0]=c=>n.value="")},null,8,["prefix","dashboard-id"])):(e.openBlock(),e.createBlock(ko,{key:0,prefix:r.value},null,8,["prefix"]))}});function W(s,t){const r=s&&typeof s=="object"&&"value"in s?s.value:s;if(r==null)return"";const n=Number(r);return Number.isNaN(n)?String(r):new Intl.NumberFormat("en",t??{notation:"compact"}).format(n)}function pe(s){if(!(s!=null&&s.includes("T")))return s??"";const[t,r,n]=s.split("T")[0].split("-");return`${n}.${r}.${t}`}function _o(s){return Intl.NumberFormat("en").format(s??0)}class $o{static getTooltipOptions(t=!0){return{show:t,axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}}}}const Vo={show_label:!1,show_legend:!1,label:null,legend:{position:null},colors:null,color:null,title:null};function Eo(){const s="0123456789ABCDEF";let t="#";for(let r=0;r<6;r+=1)t+=s[Math.floor(Math.random()*16)];return t}function Y(s=Vo){var r;const t={label:{show:s==null?void 0:s.show_label,formatter:(s==null?void 0:s.formatter)??(n=>W(n)),...(s==null?void 0:s.label)||{}},legend:{...(s==null?void 0:s.legend)||{},[((r=s==null?void 0:s.legend)==null?void 0:r.position)||"bottom"]:"0",show:(s==null?void 0:s.show_legend)||!1},barWidth:"70%",grid:{borderColor:"#e5e7eb"},title:{...(s==null?void 0:s.title)||{}}};return(s!=null&&s.colors||s!=null&&s.color)&&(t.color=(s==null?void 0:s.colors)||(s==null?void 0:s.color)||null),t}function _t(s){return{color:"#9ca3af",fontSize:10,fontFamily:"Inter, ui-sans-serif, system-ui",fontWeight:400,label:s==null?void 0:s.label,show:!0,formatter:(s==null?void 0:s.formatter)??(t=>W(t)),margin:(s==null?void 0:s.margin)??7,interval:(s==null?void 0:s.interval)??"auto",rotate:(s==null?void 0:s.rotate)??0}}const $t=["#d3c7e6","#bedae3","#f8e9cb","#ff8c8c","#c5d8be","#ffc6c6","#ffc39a","#fff7c5","#d8ffc0","#d4f7ff"];class Ve{static getLabelOptions(t={}){return{show:(t==null?void 0:t.show_label)||(t==null?void 0:t.show)||!1,fontSize:"10",position:(t==null?void 0:t.position)||"inside",formatter:(t==null?void 0:t.formatter)||"{d}%",...t}}static getLegendOpions(t={}){return{...t,position:(t==null?void 0:t.position)||"bottom"}}}const ee=typeof window<"u"?window.echarts:null,P={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(s){this.changeOptionsByName(s.chartId,s.options)},checkCustomEvent({filterUrl:s}){this.getDataFromURL(s)},handleResize(){this.widgetInstance&&this.widgetInstance.resize()},async getDataFromURL(s){var t;try{const r=await T.get(s);this.sourceData=(r==null?void 0:r.source)||[],this.$emit("update:widgetData",r),this.dimensions=Object.keys(((t=this.sourceData)==null?void 0:t[0])||{}),this.titleCharts=this.style?this.style:(r==null?void 0:r.title)||"",this.styleData=(r==null?void 0:r.style)||{}}catch(r){const n={message:"Дані не знайдено",title:"Помилка!",type:"error",status:400,id:this.widgetName};(r==null?void 0:r.status)=="404"&&(n.status=404,n.message="Дані не знайдено"),(r==null?void 0:r.status)=="400"&&(n.message="Перевірте налаштування або зверніться до адміністратора"),(r==null?void 0:r.status)=="500"&&(n.message="Сталася помилка сервера"),this.$emit("update:widgetData",n)}},getValues(){return this.sourceData.map(s=>{var t;return parseFloat(s[(t=this.columns)==null?void 0:t[1]])})},formatDate(s){const t=new Date(s);if(isNaN(t))return s;const r=String(t.getDate()).padStart(2,"0"),o=["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"][t.getMonth()],l=t.getFullYear();return`${r} ${o} ${l}`},async getData(){var s;try{if(this.source)this.sourceData=[...this.source],this.styleData=this.style,this.titleCharts=this.title,this.dimensions=Object.keys(((s=this.sourceData)==null?void 0:s[0])||{});else{this.widgetName=this.widget,this.dashboardName=this.dashboard;const t=this.dashboardName?`${this.prefix||""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}`:`${this.prefix||""}/bi-data?&widget=${this.widgetName}`;await this.getDataFromURL(t)}}catch(t){console.error(t)}},async initChart(s,t,r){var n,o,l,a,i,c,p;this.widgetInstance&&this.widgetInstance.clear();try{const d=this.$refs.chart,h=ee==null?void 0:ee.init(d);if(!h)return;const m={tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"transparent",shadowColor:"transparent",padding:[0,0,0,0],borderWidth:0,formatter:g=>{var f;const u=(f=g[0])==null?void 0:f.axisValue;let k=`
159
+ `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${t}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:r,tokens:n}){const o=this.parser.parseInline(n),l=at(t);if(l===null)return o;t=l;let a='<a href="'+t+'"';return r&&(a+=' title="'+r+'"'),a+=">"+o+"</a>",a}image({href:t,title:r,text:n}){const o=at(t);if(o===null)return n;t=o;let l=`<img src="${t}" alt="${n}"`;return r&&(l+=` title="${r}"`),l+=">",l}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):t.text}}class Pe{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}}class j{constructor(t){S(this,"options");S(this,"renderer");S(this,"textRenderer");this.options=t||J,this.options.renderer=this.options.renderer||new $e,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pe}static parse(t,r){return new j(r).parse(t)}static parseInline(t,r){return new j(r).parseInline(t)}parse(t,r=!0){let n="";for(let o=0;o<t.length;o++){const l=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){const i=l,c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(i.type)){n+=c||"";continue}}const a=l;switch(a.type){case"space":{n+=this.renderer.space(a);continue}case"hr":{n+=this.renderer.hr(a);continue}case"heading":{n+=this.renderer.heading(a);continue}case"code":{n+=this.renderer.code(a);continue}case"table":{n+=this.renderer.table(a);continue}case"blockquote":{n+=this.renderer.blockquote(a);continue}case"list":{n+=this.renderer.list(a);continue}case"html":{n+=this.renderer.html(a);continue}case"paragraph":{n+=this.renderer.paragraph(a);continue}case"text":{let i=a,c=this.renderer.text(i);for(;o+1<t.length&&t[o+1].type==="text";)i=t[++o],c+=`
160
+ `+this.renderer.text(i);r?n+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c}]}):n+=c;continue}default:{const i='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}parseInline(t,r){r=r||this.renderer;let n="";for(let o=0;o<t.length;o++){const l=t[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]){const i=this.options.extensions.renderers[l.type].call({parser:this},l);if(i!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=i||"";continue}}const a=l;switch(a.type){case"escape":{n+=r.text(a);break}case"html":{n+=r.html(a);break}case"link":{n+=r.link(a);break}case"image":{n+=r.image(a);break}case"strong":{n+=r.strong(a);break}case"em":{n+=r.em(a);break}case"codespan":{n+=r.codespan(a);break}case"br":{n+=r.br(a);break}case"del":{n+=r.del(a);break}case"text":{n+=r.text(a);break}default:{const i='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}}class de{constructor(t){S(this,"options");S(this,"block");this.options=t||J}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?O.lex:O.lexInline}provideParser(){return this.block?j.parse:j.parseInline}}S(de,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class en{constructor(...t){S(this,"defaults",Ne());S(this,"options",this.setOptions);S(this,"parse",this.parseMarkdown(!0));S(this,"parseInline",this.parseMarkdown(!1));S(this,"Parser",j);S(this,"Renderer",$e);S(this,"TextRenderer",Pe);S(this,"Lexer",O);S(this,"Tokenizer",xe);S(this,"Hooks",de);this.use(...t)}walkTokens(t,r){var o,l;let n=[];for(const a of t)switch(n=n.concat(r.call(this,a)),a.type){case"table":{const i=a;for(const c of i.header)n=n.concat(this.walkTokens(c.tokens,r));for(const c of i.rows)for(const p of c)n=n.concat(this.walkTokens(p.tokens,r));break}case"list":{const i=a;n=n.concat(this.walkTokens(i.items,r));break}default:{const i=a;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[i.type]?this.defaults.extensions.childTokens[i.type].forEach(c=>{const p=i[c].flat(1/0);n=n.concat(this.walkTokens(p,r))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,r)))}}return n}use(...t){const r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const a=r.renderers[l.name];a?r.renderers[l.name]=function(...i){let c=l.renderer.apply(this,i);return c===!1&&(c=a.apply(this,i)),c}:r.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const a=r[l.level];a?a.unshift(l.tokenizer):r[l.level]=[l.tokenizer],l.start&&(l.level==="block"?r.startBlock?r.startBlock.push(l.start):r.startBlock=[l.start]:l.level==="inline"&&(r.startInline?r.startInline.push(l.start):r.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(r.childTokens[l.name]=l.childTokens)}),o.extensions=r),n.renderer){const l=this.defaults.renderer||new $e(this.defaults);for(const a in n.renderer){if(!(a in l))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;const i=a,c=n.renderer[i],p=l[i];l[i]=(...d)=>{let h=c.apply(l,d);return h===!1&&(h=p.apply(l,d)),h||""}}o.renderer=l}if(n.tokenizer){const l=this.defaults.tokenizer||new xe(this.defaults);for(const a in n.tokenizer){if(!(a in l))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;const i=a,c=n.tokenizer[i],p=l[i];l[i]=(...d)=>{let h=c.apply(l,d);return h===!1&&(h=p.apply(l,d)),h}}o.tokenizer=l}if(n.hooks){const l=this.defaults.hooks||new de;for(const a in n.hooks){if(!(a in l))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;const i=a,c=n.hooks[i],p=l[i];de.passThroughHooks.has(a)?l[i]=d=>{if(this.defaults.async)return Promise.resolve(c.call(l,d)).then(g=>p.call(l,g));const h=c.call(l,d);return p.call(l,h)}:l[i]=(...d)=>{let h=c.apply(l,d);return h===!1&&(h=p.apply(l,d)),h}}o.hooks=l}if(n.walkTokens){const l=this.defaults.walkTokens,a=n.walkTokens;o.walkTokens=function(i){let c=[];return c.push(a.call(this,i)),l&&(c=c.concat(l.call(this,i))),c}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,r){return O.lex(t,r??this.defaults)}parser(t,r){return j.parse(t,r??this.defaults)}parseMarkdown(t){return(n,o)=>{const l={...o},a={...this.defaults,...l},i=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&l.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));a.hooks&&(a.hooks.options=a,a.hooks.block=t);const c=a.hooks?a.hooks.provideLexer():t?O.lex:O.lexInline,p=a.hooks?a.hooks.provideParser():t?j.parse:j.parseInline;if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then(d=>c(d,a)).then(d=>a.hooks?a.hooks.processAllTokens(d):d).then(d=>a.walkTokens?Promise.all(this.walkTokens(d,a.walkTokens)).then(()=>d):d).then(d=>p(d,a)).then(d=>a.hooks?a.hooks.postprocess(d):d).catch(i);try{a.hooks&&(n=a.hooks.preprocess(n));let d=c(n,a);a.hooks&&(d=a.hooks.processAllTokens(d)),a.walkTokens&&this.walkTokens(d,a.walkTokens);let h=p(d,a);return a.hooks&&(h=a.hooks.postprocess(h)),h}catch(d){return i(d)}}}onError(t,r){return n=>{if(n.message+=`
161
+ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+A(n.message+"",!0)+"</pre>";return r?Promise.resolve(o):o}if(r)return Promise.reject(n);throw n}}}const K=new en;function C(s,t){return K.parse(s,t)}C.options=C.setOptions=function(s){return K.setOptions(s),C.defaults=K.defaults,st(C.defaults),C},C.getDefaults=Ne,C.defaults=J,C.use=function(...s){return K.use(...s),C.defaults=K.defaults,st(C.defaults),C},C.walkTokens=function(s,t){return K.walkTokens(s,t)},C.parseInline=K.parseInline,C.Parser=j,C.parser=j.parse,C.Renderer=$e,C.TextRenderer=Pe,C.Lexer=O,C.lexer=O.lex,C.Tokenizer=xe,C.Hooks=de,C.parse=C,C.options,C.setOptions,C.use,C.walkTokens,C.parseInline,j.parse,O.lex;const tn={class:"space-y-4"},sn={__name:"vs-editor-form-data",props:{widgetName:{type:String},dashboardId:{type:String,default:""},data:{type:Object,default:()=>{}},columns:{type:Array,default:()=>[]}},emits:["update-dashboard"],setup(s,{expose:t,emit:r}){var _,$,w,L,P,F,q,U,V,v,Z,G,he,me,ue,I,Q,fe,Ot,jt,Wt,qt,Ut,vt,Ht,Gt,Zt,Qt,Xt,Jt,Kt,Yt;const n=e.defineAsyncComponent(()=>import("@opengis/form")),{$notify:o}=e.getCurrentInstance().proxy,l=r,a=s,i=e.ref(null),c=e.ref([]),p=e.computed(()=>{const E=a.columns??[];return E.length?E:c.value}),d=e.computed(()=>a.dashboardId||i.value);async function h(){const E=d.value;if(!(p.value.length||!E||!a.widgetName))try{const B=await T.get(`/bi-data?dashboard=${E}&widget=${a.widgetName}`);Array.isArray(B==null?void 0:B.columns)&&B.columns.length&&(c.value=B.columns)}catch{}}const g=E=>(E==null?void 0:E.name)!=null?{id:E.name,text:E.title||E.name}:null,f=E=>Array.isArray(E)?[...E].sort((B,H)=>{const te=B.text&&B.text!==B.id,es=H.text&&H.text!==H.id;return te&&!es?-1:!te&&es?1:(B.text||"").localeCompare(H.text||"",void 0,{sensitivity:"base"})}):E,m=e.computed(()=>{const E=(p.value??[]).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").map(g).filter(Boolean);return f(E)}),x=e.computed(()=>`${a.widgetName}-${m.value.length}-${(p.value??[]).length}`),k=e.computed(()=>({text:{type:"Text",label:"Text",conditions:["type","==","text"]},x:{type:"select",label:"X Axis",style:{size:"xs"},conditions:["type","not_in",["text","table","map"]],options:[...m.value]},cls:{label:"X Axis classifier",type:"text",conditions:["type","not_in",["text","table","map","cluster"]]},y_type:{label:"Y type",type:"select",options:[{id:"columns",text:"columns"},{id:"function",text:"function"}],conditions:["type","not_in",["text","table","map","number","cluster"]]},tableSQL:{label:"tableSQL",type:"text",hidden:!0},metric:{type:"select",label:"Y Axis",conditions:[["type","not_in",["text","table","map","cluster"]],["y_type","!=","function"]],options:[{id:"count",text:"count"},...f(p.value.filter(E=>(E==null?void 0:E.type)==="numeric"||(E==null?void 0:E.type)==="double precision").map(g).filter(Boolean))]},fx:{type:"text",label:"Function",conditions:[["y_type","==","function"]]},query:{label:"Query",type:"text",conditions:["type","not_in",["text","table","map","number"]]},groupby:{type:"select",label:"Groupby",view:"buttons",style:{size:"xs"},options:[{id:"null",text:"null"},...f(p.value.filter(E=>(E==null?void 0:E.type)=="text"||(E==null?void 0:E.type)==="boolean"||(E==null?void 0:E.type)==="integer").map(g).filter(Boolean))],conditions:["type","==","bar"]},columns:{type:"checkbox",label:"Columns",style:{size:"xs"},options:f((p.value??[]).map(g).filter(Boolean)),conditions:["type","in",["table","map"]]},granularity:{type:"radio",label:"Granularity",options:[{id:"year",text:"year"},{id:"quarter",text:"quarter"},{id:"month",text:"month"},{id:"week",text:"week"}],conditions:["x.type","==","date"]},type:{type:"Text",hidden:!0}})),u=e.ref({x:(($=(_=a.data)==null?void 0:_.data)==null?void 0:$.x)||((w=a.data)==null?void 0:w.x)||null,metric:((P=(L=a.data)==null?void 0:L.data)==null?void 0:P.metric)||((F=a.data)==null?void 0:F.metric)||null,columns:((U=(q=a.data)==null?void 0:q.data)==null?void 0:U.columns)||((V=a.data)==null?void 0:V.columns)||null,granularity:((Z=(v=a.data)==null?void 0:v.data)==null?void 0:Z.granularity)||((G=a.data)==null?void 0:G.granularity)||null,type:((me=(he=a.data)==null?void 0:he.data)==null?void 0:me.type)||((ue=a.data)==null?void 0:ue.type)||null,groupby:((Q=(I=a.data)==null?void 0:I.data)==null?void 0:Q.groupby)||a.data.groupby||null,fx:((Ot=(fe=a.data)==null?void 0:fe.data)==null?void 0:Ot.fx)||((jt=a.data)==null?void 0:jt.fx)||null,query:((qt=(Wt=a.data)==null?void 0:Wt.data)==null?void 0:qt.query)||((Ut=a.data)==null?void 0:Ut.query)||null,y_type:((Ht=(vt=a.data)==null?void 0:vt.data)==null?void 0:Ht.y_type)||((Gt=a.data)==null?void 0:Gt.y_type)||null,tableSQL:((Qt=(Zt=a.data)==null?void 0:Zt.data)==null?void 0:Qt.tableSQL)||((Xt=a.data)==null?void 0:Xt.tableSQL)||null,cls:((Kt=(Jt=a.data)==null?void 0:Jt.data)==null?void 0:Kt.cls)||((Yt=a.data)==null?void 0:Yt.cls)||null}),y=async()=>{try{await T.put(`/bi-dashboard/${d.value}/${a.widgetName}`,{data:u.value});let E=`/bi-data?dashboard=${d.value}&widget=${a.widgetName}`;Object.entries(u.value).forEach(([H,te])=>{E+=`&${H}=${te}`});const B=new CustomEvent(`update-data-${a.widgetName}`);B.filterUrl=E,window.dispatchEvent(B),l("update-dashboard"),o({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{o({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}},b=async()=>{try{let E=`/bi-data?dashboard=${d.value}&widget=${a.widgetName}`;Object.entries(u.value).forEach(([H,te])=>{E+=`&${H}=${te}`});const B=new CustomEvent(`update-data-${a.widgetName}`);B.filterUrl=E,window.dispatchEvent(B),l("update-dashboard")}catch{await o({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.watch(u,()=>{b()},{deep:!0}),e.onMounted(()=>{const E=new URLSearchParams(window.top.location.search);i.value=E.get("dashboard"),h()}),e.watch(()=>[a.widgetName,a.dashboardId,i.value],()=>{c.value=[],h()},{immediate:!0}),t({requestUpdateWidget:y}),(E,B)=>(e.openBlock(),e.createElementBlock("div",tn,[(e.openBlock(),e.createBlock(e.unref(n),{key:x.value,schema:k.value,values:u.value,"onUpdate:values":B[0]||(B[0]=H=>u.value=H)},null,8,["schema","values"]))]))}},rn={class:"space-y-4"},nn={__name:"vs-editor-form-yaml",props:{yamlValue:{type:null,default:()=>""},widgetName:{type:String},data:{type:Object}},setup(s,{expose:t}){const r=typeof window<"u"?window.echarts:null,n=e.defineAsyncComponent(()=>import("@opengis/form").then(h=>h.VsInputMonaco)),o=e.ref(null),{$notify:l}=e.getCurrentInstance().proxy,a=s,i=(h,{dimensions:g,source:f})=>{const m=h.getOption(),{data:x,...k}=(m==null?void 0:m.series)[0],[,...u]=g||[],y=u.map((b,_)=>({...(m==null?void 0:m.series[_])||{},data:f.map($=>$[_+1]),name:b}));h==null||h.setOption({...m||{},dataset:{dimensions:g,source:f},series:y,xAxis:{type:"category"},yAxis:{}},!0)},c=h=>{const g=document.getElementById(h);if(!g)return null;const f=r==null?void 0:r.getInstanceByDom(g);return f||null},p=e.ref(a.yamlValue),d=async()=>{try{await T.put(`/bi-dashboard/${o.value}/${a.widgetName}`,{yml:p.value});const h=c(a.widgetName);if(h){const g=await T.get(`/bi-data?dashboard=${o.value}&widget=${a.widgetName}`);i(h,g)}l({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{l({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.onMounted(()=>{const h=new URLSearchParams(window.top.location.search);o.value=h.get("dashboard")}),t({requestUpdateWidget:d}),(h,g)=>(e.openBlock(),e.createElementBlock("div",rn,[e.createVNode(e.unref(n),{modelValue:p.value,"onUpdate:modelValue":g[0]||(g[0]=f=>p.value=f),syntax:"yaml",theme:"vs-light",height:400,minimap:!1},null,8,["modelValue"])]))}},on={class:"pt-[10px]"},bt={"vs-editor-form-style":_r,"vs-editor-form-data":sn,"vs-editor-form-yaml":nn,"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(s,{emit:t}){var d;const r=e.defineAsyncComponent(()=>import("@opengis/form")),{$notify:n}=e.getCurrentInstance().proxy,o=t,l=s,a=e.ref(null),i={granularity:{ua:"Granularity",type:"checkbox",options:["week","month","quarter","year"]},export:{ua:"Export",type:"Switcher"},groupby:{ua:"Groupby",type:"checkbox",options:(d=l.columns)==null?void 0:d.map(({name:h})=>h)}},c=e.ref(l.controls||{}),p=async()=>{try{await T.put(`/bi-dashboard/${a.value}/${l.widgetName}`,{controls:c.value}),await n({type:"success",title:"Успішно!",message:"Дані успішно оновлено"}),staticTypes!=null&&staticTypes.includes(c.value.type)&&o("update-dashboard")}catch{await n({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.onMounted(()=>{const h=new URLSearchParams(window.top.location.search);a.value=h.get("dashboard")}),(h,g)=>{const f=e.resolveComponent("VsButton");return e.openBlock(),e.createElementBlock("div",on,[e.createVNode(f,{class:"ml-[10px] mb-[10px]",type:"plain",onClick:p},{default:e.withCtx(()=>g[1]||(g[1]=[e.createTextVNode(" Зберегти ")])),_:1}),e.createVNode(e.unref(r),{schema:i,values:c.value,"onUpdate:values":g[0]||(g[0]=m=>c.value=m)},null,8,["values"])])}}}},an={key:0,class:"p-4 text-sm text-amber-700 bg-amber-50 rounded-lg"},yt={__name:"editor-tab-error-boundary",props:{tabComponent:{type:Object,default:null},tabKey:{type:[String,Number],default:""}},emits:["update-dashboard"],setup(s,{expose:t}){const r=s,n=e.ref(null);function o(){var a,i;(i=(a=n.value)==null?void 0:a.requestUpdateWidget)==null||i.call(a)}t({save:o});const l=e.ref(!1);return e.onErrorCaptured((a,i,c)=>(console.error("Editor tab error:",a,c),l.value=!0,!1)),e.watch(()=>r.tabComponent,()=>{l.value=!1},{immediate:!0}),(a,i)=>l.value?(e.openBlock(),e.createElementBlock("div",an," Помилка завантаження вмісту. Переключіть таб або оновіть сторінку. ")):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.tabComponent),e.mergeProps({ref_key:"tabRef",ref:n,key:s.tabKey||"tab"},a.$attrs,{onUpdateDashboard:i[0]||(i[0]=c=>a.$emit("update-dashboard"))}),null,16))}},ln={class:"h-full flex flex-col bg-white shrink-0 !w-[400px] border rounded-xl overflow-hidden border-gray-200"},cn={key:0,class:"flex flex-col min-h-0 flex-1"},dn={class:"flex items-center border-b border-gray-200 bg-white shrink-0 px-4 h-[49px]"},pn={class:"flex items-center gap-6 min-w-0 -mb-[14px]"},hn=["onClick"],mn={key:0,class:"absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 rounded-full"},un={class:"flex items-center gap-1 ml-auto shrink-0"},fn={key:1,class:"flex-1 min-h-0 overflow-auto px-4 py-4 [&::-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"},gn={key:0},bn={key:1},yn={class:"p-4"},xn={class:"flex justify-end mt-4 gap-x-3"},kn={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},wn={__name:"vs-editor-forms",props:e.mergeModels({selectedWidgetData:{type:Object,required:!1,default:null},selectedDashboard:{type:String,default:()=>""},currentWidgetData:{type:String,default:()=>""}},{selectedWidget:{},selectedWidgetModifiers:{}}),emits:e.mergeModels(["update-data"],["update:selectedWidget"]),setup(s,{emit:t}){var b,_;const r=e.defineAsyncComponent(()=>import("@opengis/form")),n=(_=(b=e.getCurrentInstance())==null?void 0:b.proxy)==null?void 0:_.$notify,o=t,l=e.ref(null),a=s,i=e.ref(!1),c=e.ref(!0),p=e.ref(!1),d=e.ref({}),h=e.useModel(s,"selectedWidget"),g=["table","text","number","stat","progress","listbar","map","pivot"],f=e.ref("data"),m=async()=>{try{await T.delete(`/bi-dashboard/${a.selectedDashboard}/${a.selectedWidgetData.name}`);const $=new URL(window.top.location.href);$.searchParams.set("dashboard",a.selectedDashboard),$.searchParams.delete("widget"),window.top.history.pushState({},"",$),o("update-data"),i.value=!1,n({type:"success",title:"Успішно!",message:"Віджет успішно видалено"})}catch($){console.error($),n({type:"error",title:"Помилка!",message:"При спробі видалити віджет виникла помилка"})}},x=e.computed(()=>{const $=[{id:"data",label:"Дані"},{id:"style",label:"Стилі"},{id:"yaml",label:"{ }"}];return $==null?void 0:$.filter(w=>{var L,P,F;return w.id==="style"?!(g!=null&&g.includes(((L=a.selectedWidgetData)==null?void 0:L.type)||((F=(P=a.selectedWidgetData)==null?void 0:P.data)==null?void 0:F.type))):!0})}),k=()=>{var $,w,L,P,F,q,U,V,v;d.value={title:($=a.selectedWidgetData)==null?void 0:$.title,type:(w=a.selectedWidgetData)==null?void 0:w.type,table:(L=a.selectedWidgetData)==null?void 0:L.table_name,query:(F=(P=a.selectedWidgetData)==null?void 0:P.data)==null?void 0:F.query,x:(U=(q=a.selectedWidgetData)==null?void 0:q.data)==null?void 0:U.x,cls:(v=(V=a.selectedWidgetData)==null?void 0:V.data)==null?void 0:v.cls},p.value=!0},u=async()=>{try{await T.put(`/bi-dashboard/${a.selectedDashboard}/${a.selectedWidgetData.name}`,d.value),n({type:"success",title:"Успішно!",message:"Дані успішно змінено"}),await o("update-data"),p.value=!1}catch{n({type:"error",title:"Помилка!",message:"При спробі внести зміни виникла помилка"})}};e.watch(h,$=>{c.value=!1;const w=new URL(window.top.location.href);$?(w.searchParams.set("widget",$),window.top.history.pushState({},"",w)):(w.searchParams.delete("widget"),window.top.history.pushState({},"",w)),setTimeout(()=>c.value=!0)});const y={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:"Таблиця"},query:{type:"Text",ua:"Query",placeholder:"Query"},x:{type:"Text",ua:"X Axis",placeholder:"X Axis"},cls:{type:"Text",ua:"Cls",placeholder:"Cls"}};return($,w)=>{var P,F,q,U,V,v,Z,G,he,me,ue;const L=e.resolveComponent("VsPopover");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",ln,[s.selectedWidgetData?(e.openBlock(),e.createElementBlock("div",cn,[e.createElementVNode("div",dn,[e.createElementVNode("nav",pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,I=>(e.openBlock(),e.createElementBlock("button",{key:I.id,type:"button",class:e.normalizeClass(["relative pb-3 pt-1 text-sm font-medium transition-colors whitespace-nowrap",f.value===I.id?"text-blue-600":"text-gray-600 hover:text-gray-900"]),onClick:Q=>f.value=I.id},[e.createTextVNode(e.toDisplayString(I.label)+" ",1),f.value===I.id?(e.openBlock(),e.createElementBlock("span",mn)):e.createCommentVNode("",!0)],10,hn))),128))]),e.createElementVNode("div",un,[e.createVNode(L,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"h-8 w-8 flex items-center justify-center rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors",title:"Зберегти",onClick:w[0]||(w[0]=I=>{var Q,fe;return(fe=(Q=l.value)==null?void 0:Q.save)==null?void 0:fe.call(Q)})},[e.createVNode(e.unref(gs),{class:"h-4 w-4"})])]),default:e.withCtx(()=>[w[9]||(w[9]=e.createTextVNode(" Зберегти "))]),_:1}),e.createVNode(L,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"h-8 w-8 flex items-center justify-center rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors",onClick:k},[e.createVNode(tt,{class:"h-4 w-4"})])]),default:e.withCtx(()=>[w[10]||(w[10]=e.createTextVNode(" Редагувати віджет "))]),_:1}),e.createVNode(L,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"h-8 w-8 flex items-center justify-center rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 transition-colors",onClick:w[1]||(w[1]=I=>i.value=!0)},[e.createVNode(e.unref(et),{class:"h-4 w-4"})])]),default:e.withCtx(()=>[w[11]||(w[11]=e.createTextVNode(" Видалити віджет "))]),_:1})])]),(P=s.currentWidgetData)!=null&&P.status?(e.openBlock(),e.createBlock(ye,{key:0,title:(F=s.currentWidgetData)==null?void 0:F.title,text:(q=s.currentWidgetData)==null?void 0:q.message},null,8,["title","text"])):(e.openBlock(),e.createElementBlock("div",fn,[c.value&&s.currentWidgetData?(e.openBlock(),e.createElementBlock("div",gn,[e.createVNode(yt,{ref_key:"tabPanelRef",ref:l,"tab-key":f.value,"tab-component":e.unref(bt)["vs-editor-form-"+f.value],widgetName:(U=s.selectedWidgetData)==null?void 0:U.name,dashboardId:s.selectedDashboard,yamlValue:((V=s.selectedWidgetData)==null?void 0:V.yml)||"",data:s.selectedWidgetData,controls:(v=s.selectedWidgetData)==null?void 0:v.controls,columns:(Z=s.currentWidgetData)==null?void 0:Z.columns,onUpdateDashboard:w[2]||(w[2]=I=>$.$emit("update-data"))},null,8,["tab-key","tab-component","widgetName","dashboardId","yamlValue","data","controls","columns"])])):(e.openBlock(),e.createElementBlock("div",bn,[e.createVNode(yt,{ref_key:"tabPanelRef",ref:l,"tab-key":f.value,"tab-component":e.unref(bt)["vs-editor-form-"+f.value],widgetName:(G=s.selectedWidgetData)==null?void 0:G.name,dashboardId:s.selectedDashboard,yamlValue:((he=s.selectedWidgetData)==null?void 0:he.yml)||"",data:s.selectedWidgetData,controls:(me=s.selectedWidgetData)==null?void 0:me.controls,columns:(ue=s.currentWidgetData)==null?void 0:ue.columns,onUpdateDashboard:w[3]||(w[3]=I=>$.$emit("update-data"))},null,8,["tab-key","tab-component","widgetName","dashboardId","yamlValue","data","controls","columns"])])),e.createVNode(ne,{teleport:"#modal",visible:i.value,title:"Ви впевнені?",onClose:w[5]||(w[5]=I=>i.value=!1)},{default:e.withCtx(()=>[e.createElementVNode("div",yn,[w[12]||(w[12]=e.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей віджет? ",-1)),e.createElementVNode("div",xn,[e.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:w[4]||(w[4]=I=>i.value=!1)}," Скасувати "),e.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:m}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"])]))])):(e.openBlock(),e.createBlock(ye,{key:1,title:"Оберіть один з віджетів",text:"",class:"p-4"}))]),e.createVNode(ne,{teleport:"#modal",visible:p.value,title:"Редагувати віджет",onClose:w[8]||(w[8]=I=>p.value=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",kn,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:w[7]||(w[7]=I=>p.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 hover:bg-gray-100 duration-300"}," Скасувати "),e.createElementVNode("button",{onClick:u,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 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:e.withCtx(()=>[y?(e.openBlock(),e.createBlock(e.unref(r),{key:0,schema:y,values:d.value,"onUpdate:values":w[6]||(w[6]=I=>d.value=I)},null,8,["values"])):e.createCommentVNode("",!0)]),_:1},8,["visible"])],64)}}},_n={class:"overflow-hidden flex flex-col min-h-[480px]"},$n={class:"flex-1 flex min-h-0 gap-4"},Vn={class:"flex-1 min-w-0 pb-4 overflow-auto bg-gray-50/50"},En={class:"w-[400px] shrink-0 flex flex-col"},Bn={__name:"vs-widget-editor-panel",props:{selectedWidget:{type:String,default:""},selectedWidgetData:{type:Object,default:null},currentWidgetData:{type:Object,default:null},selectedDashboard:{type:String,default:""},dashboardWidgets:{type:Array,default:()=>[]}},emits:["update:selectedWidget","update-data"],setup(s,{emit:t}){const r=s,n=t,o=e.computed({get:()=>r.selectedWidget,set:l=>n("update:selectedWidget",l)});return(l,a)=>(e.openBlock(),e.createElementBlock("div",_n,[e.createElementVNode("div",$n,[e.createElementVNode("div",Vn,[e.createVNode(re,{dashboard:s.selectedDashboard,widget:s.selectedWidget,"selected-widget":s.selectedWidget,"dashboard-widgets":s.dashboardWidgets,"filter-u-rl":void 0,class:"max-h-full"},null,8,["dashboard","widget","selected-widget","dashboard-widgets"])]),e.createElementVNode("div",En,[e.createVNode(wn,{selectedWidget:o.value,"onUpdate:selectedWidget":a[0]||(a[0]=i=>o.value=i),selectedWidgetData:s.selectedWidgetData,currentWidgetData:s.currentWidgetData,selectedDashboard:s.selectedDashboard,onUpdateData:a[1]||(a[1]=i=>l.$emit("update-data"))},null,8,["selectedWidget","selectedWidgetData","currentWidgetData","selectedDashboard"])])])]))}},xt={__name:"icon-grid",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(hs),e.mergeProps(t.$attrs,{size:24}),null,16))}},kt={__name:"icon-table",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ys),e.mergeProps(t.$attrs,{size:24}),null,16))}},Cn={__name:"icon-more",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ls),e.mergeProps(t.$attrs,{size:24}),null,16))}},Dn=e.defineAsyncComponent(()=>import("@opengis/form")),Nn={components:{VsModal:ne,VForm:Dn,deleteIcon:et,editIcon:tt,IconGrid:xt,IconMore:Cn,IconTable:kt},watch:{dashboardData:{handler(s){var r,n;if(this.formEditValue={title:s==null?void 0:s.title,description:s==null?void 0:s.description,table_name:s==null?void 0:s.table_name,db:s==null?void 0:s.db,public:s==null?void 0:s.public,words:s==null?void 0:s.words},!((r=s==null?void 0:s.panels)!=null&&r.length)){this.formGridValue={panels:[]};return}const t=(n=s==null?void 0:s.panels)==null?void 0:n.map(o=>{var i,c;const{title:l="",type:a=""}=((c=(i=s==null?void 0:s.widgets)==null?void 0:i.find(p=>(p==null?void 0:p.name)===(o==null?void 0:o.widget)))==null?void 0:c.data)||{};return{title:l,type:a,...o}});this.formGridValue={panels:t}},immediate:!0}},data(){return{isDeleteConfirm:!1,isFormEdit:!1,isFormGrid:!1,isVisibleTableColumns:!1,formEditValue:{},formGridValue:{},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"}]}]}},props:{selected:{type:String,default:()=>""},dashboardData:{type:Object,default:()=>{}},selectedWidgetData:{type:Object,default:()=>{}},columns:{type:Array}},methods:{async editDashboard(){var s,t;try{(t=(s=this.$refs)==null?void 0:s.formEdit)==null||t.doValidation(),await T.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 s,t;try{(t=(s=this.$refs)==null?void 0:s.formGrid)==null||t.doValidation(),await T.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 deleteDashboard(){try{await T.delete(`/bi-dashboard/${this.selected}`);const s=new URL(window.top.location.href);s.searchParams.delete("dashboard"),s.searchParams.delete("widget"),window.history.pushState({},"",s),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:"При спробі видалити дашборд виникла помилка"})}},closePopover(){document.body.click()}}},Sn={key:0,class:"flex items-center gap-4"},zn={class:"h-[30px] w-[30px] flex items-center justify-center"},Ln={class:"flex flex-col items-start -ml-2 -mr-2"},Tn={class:"p-4"},In={class:"flex justify-end mt-4 gap-x-3"},Mn={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Pn={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function Rn(s,t,r,n,o,l){const a=e.resolveComponent("IconGrid"),i=e.resolveComponent("VsPopover"),c=e.resolveComponent("IconMore"),p=e.resolveComponent("VsModal"),d=e.resolveComponent("VForm");return e.openBlock(),e.createElementBlock("div",null,[r.selected?(e.openBlock(),e.createElementBlock("div",Sn,[e.createVNode(i,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createElementVNode("button",{class:"h-[30px] w-[30px] flex items-center justify-center",onClick:t[0]||(t[0]=h=>o.isFormGrid=!0)},[e.createVNode(a,{class:"h-[20px] text-gray-500"})])]),default:e.withCtx(()=>[t[14]||(t[14]=e.createTextVNode(" Редагувати структуру дашборду "))]),_:1}),e.createVNode(i,{placement:"left",trigger:"hover"},{reference:e.withCtx(()=>[e.createVNode(i,{placement:"bottom-left"},{reference:e.withCtx(()=>[e.createElementVNode("button",zn,[e.createVNode(c,{class:"h-[20px]"})])]),default:e.withCtx(()=>[e.createElementVNode("div",Ln,[e.createElementVNode("button",{onClick:t[1]||(t[1]=h=>{l.closePopover(),o.isFormEdit=!0}),class:"px-[8px] py-[4px] hover:bg-gray-100 w-full text-start rounded-lg"}," Редагувати дашборд "),e.createElementVNode("button",{onClick:t[2]||(t[2]=h=>{l.closePopover(),o.isDeleteConfirm=!0}),class:"px-[8px] py-[4px] hover:bg-gray-100 w-full text-start rounded-lg"}," Видалити дашборд ")])]),_:1})]),default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Керування дашбордом "))]),_:1})])):e.createCommentVNode("",!0),e.createVNode(p,{teleport:"#modal",visible:o.isDeleteConfirm,size:"small",title:"Ви впевнені?",onClose:t[5]||(t[5]=h=>o.isDeleteConfirm=!1)},{default:e.withCtx(()=>[e.createElementVNode("div",Tn,[t[16]||(t[16]=e.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей дашборд? ",-1)),e.createElementVNode("div",In,[e.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:t[3]||(t[3]=h=>o.isDeleteConfirm=!1)}," Скасувати "),e.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:t[4]||(t[4]=(...h)=>l.deleteDashboard&&l.deleteDashboard(...h))}," Так, я впевнена(ий) ")])])]),_:1},8,["visible"]),e.createVNode(p,{teleport:"#modal",visible:o.isFormEdit,title:"Редагувати дашборд",onClose:t[9]||(t[9]=h=>o.isFormEdit=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",Mn,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:t[7]||(t[7]=h=>o.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"}," Скасувати "),e.createElementVNode("button",{onClick:t[8]||(t[8]=(...h)=>l.editDashboard&&l.editDashboard(...h)),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:e.withCtx(()=>[e.createVNode(d,{ref:"formEdit",schema:o.editDashboardScheme,values:o.formEditValue,"onUpdate:values":t[6]||(t[6]=h=>o.formEditValue=h)},null,8,["schema","values"])]),_:1},8,["visible"]),e.createVNode(p,{teleport:"#modal",visible:o.isFormGrid,title:"Редагувати структуру дашборду",onClose:t[13]||(t[13]=h=>o.isFormGrid=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",Pn,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:t[11]||(t[11]=h=>o.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"}," Скасувати "),e.createElementVNode("button",{onClick:t[12]||(t[12]=(...h)=>l.editDashboardGrid&&l.editDashboardGrid(...h)),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:e.withCtx(()=>[e.createVNode(d,{ref:"formgrid",schema:o.editGridScheme,values:o.formGridValue,"onUpdate:values":t[10]||(t[10]=h=>o.formGridValue=h)},null,8,["schema","values"])]),_:1},8,["visible"])])}const Fn=D(Nn,[["render",Rn]]),An={class:"flex-1 min-w-0 flex flex-col overflow-auto"},On={class:"max-w-7xl mx-auto px-6 w-full flex flex-col min-h-0 flex-1"},jn={class:"relative z-10 shrink-0 mt-4 mb-6"},Wn={class:"flex items-center text-sm text-gray-600"},qn={key:0,class:"flex items-center justify-between gap-4 mt-3"},Un={class:"min-w-0"},vn={class:"text-2xl font-bold text-gray-900"},Hn={key:0,class:"mt-1.5 text-sm text-gray-600"},Gn={class:"flex items-center shrink-0"},Zn={key:1,class:"grid flex-grow w-full grid-cols-12 gap-4 py-4 pr-[15px] min-h-0 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"},Qn=D({__name:"vs-editor",props:{prefix:String,customClass:{type:String,default:()=>"w-screen h-screen"},initialDashboardId:{type:String,default:""}},emits:["back"],setup(s,{emit:t}){const r=s;ge(r.prefix||"/api");const n=t,o=e.inject("biClearDashboard",null),l=e.ref(r.initialDashboardId||""),a=e.ref(""),i=e.ref(null),c=e.ref(null),p=e.ref(null),d=async()=>{if(!l.value){i.value=null;return}try{const f=await T.get(`/bi-dashboard/${l.value}`);i.value=f}catch(f){console.error(f)}},h=e.computed(()=>{var f,m,x;return(x=Array.isArray((f=i.value)==null?void 0:f.widgets)?(m=i.value)==null?void 0:m.widgets:[])==null?void 0:x.find(k=>(k==null?void 0:k.name)===a.value)}),g=e.computed(()=>{var x,k,u,y,b;const m=[o?{label:"Дашборди",onClick:()=>{o(),n("back")}}:{label:"Дашборди",to:"/editor"}];if((x=i.value)!=null&&x.title||l.value){const _=((k=i.value)==null?void 0:k.title)||l.value||"Редактор",$=!!a.value;m.push({label:_,...$?{onClick:()=>{a.value=""}}:{}})}else m.push({label:"Редактор"});if(a.value&&h.value){const _=((y=(u=h.value)==null?void 0:u.data)==null?void 0:y.title)||((b=h.value)==null?void 0:b.title)||a.value;m.push({label:_})}return m});return e.watch(l,(f,m)=>{var k,u,y;m&&(a.value="");const x=new URL(window.top.location.href);f?((k=x==null?void 0:x.searchParams)==null||k.set("dashboard",f),(y=(u=window.top)==null?void 0:u.history)==null||y.pushState({},"",x),d()):(x==null||x.searchParams.delete("dashboard"),x==null||x.searchParams.delete("widget"))}),e.onMounted(()=>{var f,m;if(r.initialDashboardId)l.value=r.initialDashboardId;else{const x=new URLSearchParams(((m=(f=window.top)==null?void 0:f.location)==null?void 0:m.search)||""),k=x.get("dashboard");k&&(l.value=k),a.value=x.get("widget")||""}d()}),(f,m)=>{var x,k;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex w-full h-full",[s.customClass]])},[e.createElementVNode("div",An,[e.createElementVNode("div",On,[e.createElementVNode("div",jn,[e.createElementVNode("div",Wn,[e.createVNode(Ye,{items:g.value,compact:""},null,8,["items"])]),l.value&&i.value?(e.openBlock(),e.createElementBlock("div",qn,[e.createElementVNode("div",Un,[e.createElementVNode("h1",vn,e.toDisplayString(i.value.title||l.value),1),i.value.description?(e.openBlock(),e.createElementBlock("p",Hn,e.toDisplayString(i.value.description),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Gn,[a.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors",onClick:m[0]||(m[0]=u=>a.value="")},[e.createVNode(e.unref(He),{class:"w-4 h-4"}),m[6]||(m[6]=e.createTextVNode(" Закрити "))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(Fn,{selected:l.value,"onUpdate:selected":m[1]||(m[1]=u=>l.value=u),dashboardData:i.value,columns:(x=i.value)==null?void 0:x.columns,selectedWidgetData:h.value,prefix:s.prefix,onUpdateEditor:d},null,8,["selected","dashboardData","columns","selectedWidgetData","prefix"]),e.createElementVNode("button",{type:"button",class:"ml-4 flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors shadow-sm font-medium",onClick:m[2]||(m[2]=u=>{var y,b;return(b=(y=p.value)==null?void 0:y.open)==null?void 0:b.call(y)})},m[7]||(m[7]=[e.createElementVNode("span",{class:"leading-none"},"+",-1),e.createTextVNode(" Створити віджет ")])),l.value?(e.openBlock(),e.createBlock(kr,{key:0,ref_key:"createWidgetRef",ref:p,inline:"",columns:(k=i.value)==null?void 0:k.columns,selectedDashboard:l.value,onUpdateData:d},null,8,["columns","selectedDashboard"])):e.createCommentVNode("",!0)],64))])])):e.createCommentVNode("",!0)]),a.value&&i.value?(e.openBlock(),e.createBlock(Bn,{key:0,"selected-widget":a.value,"onUpdate:selectedWidget":m[3]||(m[3]=u=>a.value=u),"selected-widget-data":h.value,"current-widget-data":c.value,"selected-dashboard":l.value,"dashboard-widgets":i.value.widgets||[],onUpdateData:d},null,8,["selected-widget","selected-widget-data","current-widget-data","selected-dashboard","dashboard-widgets"])):(e.openBlock(),e.createElementBlock("div",Zn,[i.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(i.value.panels,(u,y)=>{var b;return e.openBlock(),e.createElementBlock("div",{key:y,class:e.normalizeClass([`col-span-${u.col||12}`,"flex flex-col gap-[10px]"])},[(b=u.widgets)!=null&&b.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(u.widgets,_=>(e.openBlock(),e.createBlock(re,{onClick:$=>a.value=_,"onUpdate:currentWidgetData":m[4]||(m[4]=$=>c.value=$),key:_,dashboard:l.value,widget:_,selectedWidget:a.value,"dashboard-widgets":i.value.widgets,class:e.normalizeClass({"border border-blue-500":a.value===_})},null,8,["onClick","dashboard","widget","selectedWidget","dashboard-widgets","class"]))),128)):(e.openBlock(),e.createBlock(re,{key:1,onClick:_=>a.value=u.widget,"onUpdate:currentWidgetData":m[5]||(m[5]=_=>c.value=_),class:e.normalizeClass(["flex flex-col",{"border border-blue-500":a.value===u.widget}]),dashboard:l.value,widget:u.widget,selectedWidget:a.value,"dashboard-widgets":i.value.widgets},null,8,["onClick","class","dashboard","widget","selectedWidget","dashboard-widgets"]))],2)}),128)):(e.openBlock(),e.createBlock(ye,{key:0,class:"col-span-12"}))]))])])],2)}}},[["__scopeId","data-v-cc75be6a"]]),Xn={class:"w-full h-screen"},Jn=e.defineComponent({__name:"vs-editor-page",props:{prefix:{default:"/api"},dashboardId:{default:""}},emits:["back"],setup(s){const t=s,r=t.prefix,n=t.dashboardId;return(o,l)=>(e.openBlock(),e.createElementBlock("div",Xn,[e.createVNode(Qn,{customClass:"h-full w-full",prefix:e.unref(r),"initial-dashboard-id":e.unref(n),onBack:l[0]||(l[0]=a=>o.$emit("back"))},null,8,["prefix","initial-dashboard-id"])]))}}),Kn={class:"relative group h-full"},Yn={class:"flex items-start gap-3 flex-1 min-h-0"},eo={class:"p-2 bg-blue-50 rounded-lg group-hover:bg-blue-100 transition-colors shrink-0"},to={class:"flex-1 min-w-0 flex flex-col min-h-0"},so={class:"font-semibold text-gray-900 mb-1 truncate"},ro={key:0,class:"text-sm text-gray-600 mb-2 line-clamp-2 min-h-10"},no={key:1,class:"text-sm text-gray-600 mb-2 line-clamp-2 min-h-10 invisible","aria-hidden":"true"},oo={key:2,class:"text-sm text-gray-400 mt-1 shrink-0"},ao=D({__name:"dashboard-card",props:{title:String,description:String,modified:String,name:String,widgetCount:Number,reserveLines:Number,dashboardRouteName:String,onOpenEditor:Function,onOpenView:Function},setup(s){const t=s,r=Ce(),n=e.ref(!1);function o(){var a;t.dashboardRouteName&&(t.onOpenEditor?t.onOpenEditor(t.dashboardRouteName):(a=r==null?void 0:r.push)==null||a.call(r,{path:"/editor",query:{dashboard:t.dashboardRouteName}}))}function l(a){a.target.closest(".dashboard-card-menu")||(n.value=!1)}return e.onMounted(()=>document.addEventListener("click",l)),e.onUnmounted(()=>document.removeEventListener("click",l)),(a,i)=>(e.openBlock(),e.createElementBlock("div",Kn,[e.createElementVNode("button",{type:"button",class:"w-full h-full bg-white border border-gray-200 rounded-lg p-6 hover:shadow-md hover:border-blue-200 transition-all text-left animate-fade-in flex flex-col",onClick:o},[e.createElementVNode("div",Yn,[e.createElementVNode("div",eo,[e.createVNode(e.unref(ps),{size:24,class:"w-5 h-5 text-blue-600"})]),e.createElementVNode("div",to,[e.createElementVNode("h3",so,e.toDisplayString(s.title),1),s.description?(e.openBlock(),e.createElementBlock("p",ro,e.toDisplayString(s.description),1)):(e.openBlock(),e.createElementBlock("p",no,"   ")),s.widgetCount!=null?(e.openBlock(),e.createElementBlock("p",oo,e.toDisplayString(s.widgetCount)+" віджетів ",1)):e.createCommentVNode("",!0)])])])]))}},[["__scopeId","data-v-cde0f33b"]]),lo=[{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}}];function io(s){return!Array.isArray(s)||s.length===0?{}:s.reduce((t,r)=>{if(!r||r.key==null)return t;const{key:n,...o}=r;return t[n]=o,t},{})}const co={class:"flex-1 bg-gray-50"},po={class:"max-w-7xl mx-auto px-6 py-8"},ho={class:"mb-6"},mo={class:"flex items-center justify-between mb-6"},uo={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},fo={class:"flex items-center space-x-4"},go={class:"flex-1 relative"},bo={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},yo=e.defineComponent({__name:"all-dashboards-page",props:{prefix:{}},setup(s){const t=e.defineAsyncComponent(()=>import("@opengis/form")),r=io(lo),n=e.ref([]),o=e.ref([]);Ce();const l=e.inject("biSetDashboard"),a=s,i=e.ref(null),c=e.ref(!1),p=e.ref({});ge(a.prefix||"/api");async function d(){try{const k=await T.get("/bi-dashboard?type=db"),u=Array.isArray(k==null?void 0:k.rows)?k.rows:[];o.value=u,n.value=u.map(y=>({routeName:String(y.name??""),title:y.title??y.name??"Без назви",description:y.description??null,modified:"-",name:"-"}))}catch(k){console.error("Failed to load dashboards",k),o.value=[],n.value=[]}}async function h(){var u,y,b;const k=(y=(u=e.getCurrentInstance())==null?void 0:u.proxy)==null?void 0:y.$notify;try{await((b=i.value)==null?void 0:b.doValidation()),await T.post("/bi-dashboard",p.value),c.value=!1,p.value={},k==null||k({type:"success",title:"Успішно!",message:"Дашборд створено успішно"}),await d()}catch{k==null||k({type:"error",title:"Помилка!",message:"При спробі створити дашборд виникла помилка"})}}e.onMounted(d);const g=e.ref(1),f=()=>{const k=window.innerWidth;g.value=k>=1024?3:k>=768?2:1};e.onMounted(()=>{f(),window.addEventListener("resize",f)}),e.onUnmounted(()=>{window.removeEventListener("resize",f)});const m=k=>k?k.trim().length>70?2:1:0,x=k=>{const u=g.value||1,b=Math.floor(k/u)*u,_=b+u,$=n.value.slice(b,_);let w=0;for(const L of $){const P=m(L.description??null);if(P>w&&(w=P),w===2)break}return w};return e.ref("grid"),(k,u)=>(e.openBlock(),e.createElementBlock("div",co,[e.createElementVNode("div",po,[e.createElementVNode("div",ho,[e.createElementVNode("div",mo,[u[5]||(u[5]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-3xl font-bold text-gray-900"},"Дашборди"),e.createElementVNode("p",{class:"mt-2 text-gray-600"}," Керуйте та переглядайте свої аналітичні дашборди ")],-1)),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 px-4 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors shadow-sm font-medium",onClick:u[0]||(u[0]=y=>c.value=!0)},[e.createVNode(e.unref(ve),{size:24,class:"w-4 h-4"}),u[4]||(u[4]=e.createElementVNode("span",null,"Новий дашборд",-1))])]),e.createVNode(ne,{teleport:"#modal",visible:c.value,title:"Створити дашборд",onClose:u[3]||(u[3]=y=>c.value=!1)},{footer:e.withCtx(()=>[e.createElementVNode("div",uo,[e.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border border-gray-200 rounded-lg hover:bg-gray-100 duration-300",onClick:u[2]||(u[2]=y=>c.value=!1)}," Скасувати "),e.createElementVNode("button",{type:"button",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 hover:bg-blue-700 duration-300",onClick:h}," Зберегти ")])]),default:e.withCtx(()=>[e.createVNode(e.unref(t),{ref_key:"createFormRef",ref:i,schema:e.unref(r),values:p.value,"onUpdate:values":u[1]||(u[1]=y=>p.value=y)},null,8,["schema","values"])]),_:1},8,["visible"]),e.createElementVNode("div",fo,[e.createElementVNode("div",go,[e.createVNode(e.unref(bs),{size:24,class:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),u[6]||(u[6]=e.createElementVNode("input",{type:"text",placeholder:"Пошук дашбордів...",class:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",value:""},null,-1))])])]),e.createElementVNode("div",bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(y,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:"cursor-pointer h-full"},[e.createVNode(ao,{title:y.title,description:y.description,modified:y.modified,name:y.name,reserveLines:x(b),"dashboard-route-name":y.routeName,"on-open-editor":e.unref(l),"on-open-view":e.unref(l)},null,8,["title","description","modified","name","reserveLines","dashboard-route-name","on-open-editor","on-open-view"])]))),128))])])]))}}),xo=e.defineComponent({__name:"editor-root-page",props:{prefix:{default:"/api"}},setup(s){const t=s,r=e.computed(()=>t.prefix),n=e.ref(""),o=rr();e.onMounted(()=>{var i;const a=(i=o==null?void 0:o.query)==null?void 0:i.dashboard;a!=null&&typeof a=="string"&&(n.value=a.trim())});const l=e.computed(()=>n.value.length>0);return e.provide("biSetDashboard",a=>{n.value=a||""}),e.provide("biClearDashboard",()=>{n.value=""}),e.provide("biSelectedDashboardId",e.readonly(n)),(a,i)=>l.value?(e.openBlock(),e.createBlock(Jn,{key:`editor-${n.value}`,prefix:r.value,"dashboard-id":n.value,onBack:i[0]||(i[0]=c=>n.value="")},null,8,["prefix","dashboard-id"])):(e.openBlock(),e.createBlock(yo,{key:0,prefix:r.value},null,8,["prefix"]))}});function W(s,t){const r=s&&typeof s=="object"&&"value"in s?s.value:s;if(r==null)return"";const n=Number(r);return Number.isNaN(n)?String(r):new Intl.NumberFormat("en",t??{notation:"compact"}).format(n)}function pe(s){if(!(s!=null&&s.includes("T")))return s??"";const[t,r,n]=s.split("T")[0].split("-");return`${n}.${r}.${t}`}function ko(s){return Intl.NumberFormat("en").format(s??0)}class wo{static getTooltipOptions(t=!0){return{show:t,axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}}}}const _o={show_label:!1,show_legend:!1,label:null,legend:{position:null},colors:null,color:null,title:null};function $o(){const s="0123456789ABCDEF";let t="#";for(let r=0;r<6;r+=1)t+=s[Math.floor(Math.random()*16)];return t}function Y(s=_o){var r;const t={label:{show:s==null?void 0:s.show_label,formatter:(s==null?void 0:s.formatter)??(n=>W(n)),...(s==null?void 0:s.label)||{}},legend:{...(s==null?void 0:s.legend)||{},[((r=s==null?void 0:s.legend)==null?void 0:r.position)||"bottom"]:"0",show:(s==null?void 0:s.show_legend)||!1},barWidth:"70%",grid:{borderColor:"#e5e7eb"},title:{...(s==null?void 0:s.title)||{}}};return(s!=null&&s.colors||s!=null&&s.color)&&(t.color=(s==null?void 0:s.colors)||(s==null?void 0:s.color)||null),t}function wt(s){return{color:"#9ca3af",fontSize:10,fontFamily:"Inter, ui-sans-serif, system-ui",fontWeight:400,label:s==null?void 0:s.label,show:!0,formatter:(s==null?void 0:s.formatter)??(t=>W(t)),margin:(s==null?void 0:s.margin)??7,interval:(s==null?void 0:s.interval)??"auto",rotate:(s==null?void 0:s.rotate)??0}}const _t=["#d3c7e6","#bedae3","#f8e9cb","#ff8c8c","#c5d8be","#ffc6c6","#ffc39a","#fff7c5","#d8ffc0","#d4f7ff"];class Ve{static getLabelOptions(t={}){return{show:(t==null?void 0:t.show_label)||(t==null?void 0:t.show)||!1,fontSize:"10",position:(t==null?void 0:t.position)||"inside",formatter:(t==null?void 0:t.formatter)||"{d}%",...t}}static getLegendOpions(t={}){return{...t,position:(t==null?void 0:t.position)||"bottom"}}}const ee=typeof window<"u"?window.echarts:null,R={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(s){this.changeOptionsByName(s.chartId,s.options)},checkCustomEvent({filterUrl:s}){this.getDataFromURL(s)},handleResize(){this.widgetInstance&&this.widgetInstance.resize()},async getDataFromURL(s){var t;try{const r=await T.get(s);this.sourceData=(r==null?void 0:r.source)||[],this.$emit("update:widgetData",r),this.dimensions=Object.keys(((t=this.sourceData)==null?void 0:t[0])||{}),this.titleCharts=this.style?this.style:(r==null?void 0:r.title)||"",this.styleData=(r==null?void 0:r.style)||{}}catch(r){const n={message:"Дані не знайдено",title:"Помилка!",type:"error",status:400,id:this.widgetName};(r==null?void 0:r.status)=="404"&&(n.status=404,n.message="Дані не знайдено"),(r==null?void 0:r.status)=="400"&&(n.message="Перевірте налаштування або зверніться до адміністратора"),(r==null?void 0:r.status)=="500"&&(n.message="Сталася помилка сервера"),this.$emit("update:widgetData",n)}},getValues(){return this.sourceData.map(s=>{var t;return parseFloat(s[(t=this.columns)==null?void 0:t[1]])})},formatDate(s){const t=new Date(s);if(isNaN(t))return s;const r=String(t.getDate()).padStart(2,"0"),o=["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"][t.getMonth()],l=t.getFullYear();return`${r} ${o} ${l}`},async getData(){var s;try{if(this.source)this.sourceData=[...this.source],this.styleData=this.style,this.titleCharts=this.title,this.dimensions=Object.keys(((s=this.sourceData)==null?void 0:s[0])||{});else{this.widgetName=this.widget,this.dashboardName=this.dashboard;const t=this.dashboardName?`${this.prefix||""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}`:`${this.prefix||""}/bi-data?&widget=${this.widgetName}`;await this.getDataFromURL(t)}}catch(t){console.error(t)}},async initChart(s,t,r){var n,o,l,a,i,c,p;this.widgetInstance&&this.widgetInstance.clear();try{const d=this.$refs.chart,h=ee==null?void 0:ee.init(d);if(!h)return;const g={tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"transparent",shadowColor:"transparent",padding:[0,0,0,0],borderWidth:0,formatter:f=>{var u;const m=(u=f[0])==null?void 0:u.axisValue;let k=`
162
162
  <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">
163
163
  <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">
164
- ${u?this.formatDate(u):"N/A"}
164
+ ${m?this.formatDate(m):"N/A"}
165
165
  </div>
166
- `;return g.forEach(y=>{k+=`
166
+ `;return f.forEach(y=>{k+=`
167
167
  <div class="flex justify-between items-center text-xs px-2 py-0.5 text-gray-500 dark:text-neutral-400">
168
168
  <span class="flex items-center">
169
169
  <span class="w-2.5 h-2.5 me-1.5 rounded-sm" style="background-color: ${y.color};"></span>
@@ -171,16 +171,16 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
171
171
  </span>
172
172
  <span>${this.getMetricValue(y==null?void 0:y.data)}</span>
173
173
  </div>
174
- `}),k+="</div>",k}},xAxis:{data:t!=null&&t.length?t:null,type:t?"category":"value",name:((o=(n=this.styleData)==null?void 0:n.x_axis)==null?void 0:o.name)||"",axisLabel:{..._t((l=this.styleData)==null?void 0:l.x_axis),formatter:g=>{var x,k;const u=this.formatDate(g);return((k=(x=this.styleData)==null?void 0:x.x_axis)==null?void 0:k.overflow)==="ellipsis"&&u.length>10?`${u.slice(0,10)}...`:u}}},yAxis:{data:r!=null&&r.length?r:null,type:r?"category":"value",name:((i=(a=this.styleData)==null?void 0:a.y_axis)==null?void 0:i.name)||"",axisLabel:_t((c=this.styleData)==null?void 0:c.y_axis)},series:s!=null&&s.length?s:null,...Y(this.styleData),grid:{bottom:"0%",right:"0%",left:"0%",top:"20px",containLabel:!0,...((p=this.styleData)==null?void 0:p.grid)||{}}};await h.setOption(m),h.resize(),this.widgetInstance=h,this.$emit("update:currentWidget",h)}catch(d){console.error(d)}},async setSeriesOption(s,t){const r=s.getOption(),{series:n=[]}=r,o=n.map(l=>({...l,...t}));s.setOption({...r,series:o})},async changeOptionsByName(s,t){const r=document.getElementById(s);if(!r)return null;const n=ee==null?void 0:ee.getInstanceByDom(r);if(!n)return null;const o=n.getOption();t.seriesOptions&&this.setSeriesOption(n,t.seriesOptions),n.setOption({...o,...t.options,tooltip:{...$o.getTooltipOptions(t.options.tooltip.show)}})},async changeData(s){var t;try{let r=this.dashboard?`${this.prefix||""}/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`:`${this.prefix||""}/bi-data?&widget=${this.widget}`;(t=s==null?void 0:s.granularity)!=null&&t.length&&(r+=`&granularity=${s.granularity}`),s!=null&&s.metrics&&(r+=`&metrics=${s.metrics}`),this.getDataFromURL(r)}catch(r){console.error(r)}},async setFilter(s){const t=`${this.prefix||""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}${s||""}`;await this.getDataFromURL(t)},async changeStyle(s,t){this.styleData[s]=t,this.onChangedData()},getMetricValue(s){var n;const t=(s==null?void 0:s.metric)||s;return parseFloat(t)?(n=W(t,{notation:"standard"}))==null?void 0:n.replaceAll(","," "):t}}},Co={name:"VsBar",mixins:[P],data(){return{resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var t;this.getData(),this.onChangedData();const s=(t=this.$refs)==null?void 0:t.chart;s&&(this.resizeObserver=new ResizeObserver(()=>{var r;this.widgetInstance&&((r=this.widgetInstance)==null||r.resize())}),this.resizeObserver.observe(s))},unmounted(){this.resizeObserver.disconnect()},methods:{async onChangedData(){try{if(this.sourceData){await this.$nextTick();const{series:s,xs:t,ys:r}=this.prepareData();s&&(this==null||this.initChart(s,t,r))}}catch(s){console.error(s)}},prepareData(){var s,t,r,n,o,l;try{if(!((s=this.sourceData)!=null&&s.length))return{series:[],xs:[],ys:void 0};const a=Array.from(new Set(this.sourceData.filter(m=>m[this.dimensions[0]]).map(m=>m[this.dimensions[0]])));let i;this.dimensions[0].includes("date")?i=a.map(m=>pe(m)):i=[...a];let c,p;((t=this.styleData)==null?void 0:t.horizontal)===!0?p=[...i]:c=[...i];const d=this.sourceData.filter(m=>parseFloat(m[this.dimensions[1]])&&m[this.dimensions[0]]).map(m=>parseFloat(m[this.dimensions[1]]));let h;return((r=this.styleData)==null?void 0:r.stack)!==!1?h=this.prepareStackData():((n=this.styleData)==null?void 0:n.negative_waterfall)===!0?h=this.prepareNegativeWaterfall():((o=this.styleData)==null?void 0:o.waterfall)===!0?h=this.prepareWaterfallData(d):((l=this.styleData)==null?void 0:l.accumulative)===!0?h=this.prepareAccumulative(d):h=this.dimensions.slice(1).map((g,u)=>({name:g,type:"bar",stack:`a${u}`,data:this.sourceData.filter(x=>parseFloat(x[g])&&g).map(x=>parseFloat(x[g]))})),{series:h,xs:c,ys:p}}catch(a){return console.error(a),{series:[],xs:[],ys:[]}}},prepareWaterfallData(s){let t=s.reduce((l,a)=>l+a,0);const r=[t,...s],n=r.map((l,a)=>{if(a===0)return 0;const i=t-l;return t-=l,i>=0?i:0});return[{type:"bar",stack:"Total",itemStyle:{borderColor:"transparent",color:"transparent"},data:n,tooltip:{show:!1}},{name:this.title?this.title:this.dimensions[0],type:"bar",stack:"Total",data:r}]},prepareStackData(){return this.dimensions.slice(1).map(r=>({name:r,type:"bar",stack:"a",data:this.sourceData.filter(n=>parseFloat(n[r])&&r).map(n=>parseFloat(n[r]))}))},prepareNegativeWaterfall(){const s=this.sourceData.map(l=>Number.isNaN(l[this.dimensions[1]])?0:Number(l[this.dimensions[1]])),t=this.sourceData.map(l=>Number.isNaN(l[this.dimensions[2]])?0:Number(l[this.dimensions[2]]));let r=0;const n=s.map((l,a)=>{const i=r;return r+=Number.isNaN(l)?0:l,a===0&&(r-=Number.isNaN(t[a])?0:t[a]),r-=Number.isNaN(t[a+1])?0:t[a+1],i>=0?i:0});return[{type:"bar",stack:"a",itemStyle:{borderColor:"transparent",color:"transparent"},data:n,tooltip:{show:!1}},{name:this.dimensions[1],type:"bar",stack:"a",data:s},{name:this.dimensions[2],type:"bar",stack:"a",data:t}]},prepareAccumulative(s){let t=0;const r=s.map(o=>(t+=o,t));return[{name:this.titleCharts,type:"bar",stack:"Total",data:r}]}}},Bo=["id"];function Do(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:l.uniqueID,ref:"chart",class:"h-full w-full min-h-[200px]"},null,8,Bo)}const Pe=D(Co,[["render",Do]]),No=Object.freeze(Object.defineProperty({__proto__:null,default:Pe},Symbol.toStringTag,{value:"Module"}));var Vt=(s=>(s.Dashboard="/dashboard",s.BiPlatform="/bi-platform",s.EditorBase="/editor",s.AllDashboards="/dashboards",s.DashboardByName="/dashboards/:name",s))(Vt||{}),Et;(s=>{(t=>{t.Bar="bar",t.ListBar="listbar",t.Number="number",t.Text="text",t.Pie="pie",t.Heatmap="heatmap",t.Calendar="calendar",t.Line="line",t.Stat="stat",t.Pivot="pivot",t.Funnel="funnel",t.Progress="progress"})(s.Types||(s.Types={}))})(Et||(Et={}));var Ct=(s=>(s.AllDashboards="all-dashboards",s.BiPlatform="bi-platform",s.Dashboard="dashboard",s.Erobota="erobota",s.Datatest="datatest",s.Sourcedate="sourcedate",s.Widgetwidget="widgetwidget",s.Test="test",s.Demo="demo",s.Crm="crm",s.Editor="editor",s.Editordetails="editordetails",s.Dbtables="dbtables",s.Biviewer="biviewer",s.Biviewerinner="biviewerinner",s.Bieditor="bieditor",s.Bieditorinner="bieditorinner",s))(Ct||{});const Re=typeof window<"u"?window.echarts:null,So={name:"VsPie",props:["currentWidget"],mixins:[P],data(){return{chartInstance:null,resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var r;await this.$nextTick(),await this.getData();const{series:s}=this.prepareData()||{};s&&this.initChart(s);const t=(r=this.$refs)==null?void 0:r.chart;t&&(this.resizeObserver=new ResizeObserver(()=>{this.chartInstance&&this.chartInstance.resize()}),this.resizeObserver.observe(t))},beforeUnmount(){var s;(s=this.resizeObserver)==null||s.disconnect()},methods:{onChangedData(){try{if(this.sourceData){const{series:s,xs:t,ys:r}=this.prepareData();s&&this.initChart(s,t,r)}}catch(s){console.error(s)}},buildTooltipForDonut(s,t){const{name:r,value:n,percent:o}=s;return`
174
+ `}),k+="</div>",k}},xAxis:{data:t!=null&&t.length?t:null,type:t?"category":"value",name:((o=(n=this.styleData)==null?void 0:n.x_axis)==null?void 0:o.name)||"",axisLabel:{...wt((l=this.styleData)==null?void 0:l.x_axis),formatter:f=>{var x,k;const m=this.formatDate(f);return((k=(x=this.styleData)==null?void 0:x.x_axis)==null?void 0:k.overflow)==="ellipsis"&&m.length>10?`${m.slice(0,10)}...`:m}}},yAxis:{data:r!=null&&r.length?r:null,type:r?"category":"value",name:((i=(a=this.styleData)==null?void 0:a.y_axis)==null?void 0:i.name)||"",axisLabel:wt((c=this.styleData)==null?void 0:c.y_axis)},series:s!=null&&s.length?s:null,...Y(this.styleData),grid:{bottom:"0%",right:"0%",left:"0%",top:"20px",containLabel:!0,...((p=this.styleData)==null?void 0:p.grid)||{}}};await h.setOption(g),h.resize(),this.widgetInstance=h,this.$emit("update:currentWidget",h)}catch(d){console.error(d)}},async setSeriesOption(s,t){const r=s.getOption(),{series:n=[]}=r,o=n.map(l=>({...l,...t}));s.setOption({...r,series:o})},async changeOptionsByName(s,t){const r=document.getElementById(s);if(!r)return null;const n=ee==null?void 0:ee.getInstanceByDom(r);if(!n)return null;const o=n.getOption();t.seriesOptions&&this.setSeriesOption(n,t.seriesOptions),n.setOption({...o,...t.options,tooltip:{...wo.getTooltipOptions(t.options.tooltip.show)}})},async changeData(s){var t;try{let r=this.dashboard?`${this.prefix||""}/bi-data?dashboard=${this.dashboard}&widget=${this.widget}`:`${this.prefix||""}/bi-data?&widget=${this.widget}`;(t=s==null?void 0:s.granularity)!=null&&t.length&&(r+=`&granularity=${s.granularity}`),s!=null&&s.metrics&&(r+=`&metrics=${s.metrics}`),this.getDataFromURL(r)}catch(r){console.error(r)}},async setFilter(s){const t=`${this.prefix||""}/bi-data?dashboard=${this.dashboardName}&widget=${this.widgetName}${s||""}`;await this.getDataFromURL(t)},async changeStyle(s,t){this.styleData[s]=t,this.onChangedData()},getMetricValue(s){var n;const t=(s==null?void 0:s.metric)||s;return parseFloat(t)?(n=W(t,{notation:"standard"}))==null?void 0:n.replaceAll(","," "):t}}},Vo={name:"VsBar",mixins:[R],data(){return{resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var t;this.getData(),this.onChangedData();const s=(t=this.$refs)==null?void 0:t.chart;s&&(this.resizeObserver=new ResizeObserver(()=>{var r;this.widgetInstance&&((r=this.widgetInstance)==null||r.resize())}),this.resizeObserver.observe(s))},unmounted(){this.resizeObserver.disconnect()},methods:{async onChangedData(){try{if(this.sourceData){await this.$nextTick();const{series:s,xs:t,ys:r}=this.prepareData();s&&(this==null||this.initChart(s,t,r))}}catch(s){console.error(s)}},prepareData(){var s,t,r,n,o,l;try{if(!((s=this.sourceData)!=null&&s.length))return{series:[],xs:[],ys:void 0};const a=Array.from(new Set(this.sourceData.filter(g=>g[this.dimensions[0]]).map(g=>g[this.dimensions[0]])));let i;this.dimensions[0].includes("date")?i=a.map(g=>pe(g)):i=[...a];let c,p;((t=this.styleData)==null?void 0:t.horizontal)===!0?p=[...i]:c=[...i];const d=this.sourceData.filter(g=>parseFloat(g[this.dimensions[1]])&&g[this.dimensions[0]]).map(g=>parseFloat(g[this.dimensions[1]]));let h;return((r=this.styleData)==null?void 0:r.stack)!==!1?h=this.prepareStackData():((n=this.styleData)==null?void 0:n.negative_waterfall)===!0?h=this.prepareNegativeWaterfall():((o=this.styleData)==null?void 0:o.waterfall)===!0?h=this.prepareWaterfallData(d):((l=this.styleData)==null?void 0:l.accumulative)===!0?h=this.prepareAccumulative(d):h=this.dimensions.slice(1).map((f,m)=>({name:f,type:"bar",stack:`a${m}`,data:this.sourceData.filter(x=>parseFloat(x[f])&&f).map(x=>parseFloat(x[f]))})),{series:h,xs:c,ys:p}}catch(a){return console.error(a),{series:[],xs:[],ys:[]}}},prepareWaterfallData(s){let t=s.reduce((l,a)=>l+a,0);const r=[t,...s],n=r.map((l,a)=>{if(a===0)return 0;const i=t-l;return t-=l,i>=0?i:0});return[{type:"bar",stack:"Total",itemStyle:{borderColor:"transparent",color:"transparent"},data:n,tooltip:{show:!1}},{name:this.title?this.title:this.dimensions[0],type:"bar",stack:"Total",data:r}]},prepareStackData(){return this.dimensions.slice(1).map(r=>({name:r,type:"bar",stack:"a",data:this.sourceData.filter(n=>parseFloat(n[r])&&r).map(n=>parseFloat(n[r]))}))},prepareNegativeWaterfall(){const s=this.sourceData.map(l=>Number.isNaN(l[this.dimensions[1]])?0:Number(l[this.dimensions[1]])),t=this.sourceData.map(l=>Number.isNaN(l[this.dimensions[2]])?0:Number(l[this.dimensions[2]]));let r=0;const n=s.map((l,a)=>{const i=r;return r+=Number.isNaN(l)?0:l,a===0&&(r-=Number.isNaN(t[a])?0:t[a]),r-=Number.isNaN(t[a+1])?0:t[a+1],i>=0?i:0});return[{type:"bar",stack:"a",itemStyle:{borderColor:"transparent",color:"transparent"},data:n,tooltip:{show:!1}},{name:this.dimensions[1],type:"bar",stack:"a",data:s},{name:this.dimensions[2],type:"bar",stack:"a",data:t}]},prepareAccumulative(s){let t=0;const r=s.map(o=>(t+=o,t));return[{name:this.titleCharts,type:"bar",stack:"Total",data:r}]}}},Eo=["id"];function Bo(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:l.uniqueID,ref:"chart",class:"h-full w-full min-h-[200px]"},null,8,Eo)}const Re=D(Vo,[["render",Bo]]),Co=Object.freeze(Object.defineProperty({__proto__:null,default:Re},Symbol.toStringTag,{value:"Module"}));var $t=(s=>(s.Dashboard="/dashboard",s.BiPlatform="/bi-platform",s.EditorBase="/editor",s.AllDashboards="/dashboards",s.DashboardByName="/dashboards/:name",s))($t||{}),Vt;(s=>{(t=>{t.Bar="bar",t.ListBar="listbar",t.Number="number",t.Text="text",t.Pie="pie",t.Heatmap="heatmap",t.Calendar="calendar",t.Line="line",t.Stat="stat",t.Pivot="pivot",t.Funnel="funnel",t.Progress="progress"})(s.Types||(s.Types={}))})(Vt||(Vt={}));var Et=(s=>(s.AllDashboards="all-dashboards",s.BiPlatform="bi-platform",s.Dashboard="dashboard",s.Erobota="erobota",s.Datatest="datatest",s.Sourcedate="sourcedate",s.Widgetwidget="widgetwidget",s.Test="test",s.Demo="demo",s.Crm="crm",s.Editor="editor",s.Editordetails="editordetails",s.Dbtables="dbtables",s.Biviewer="biviewer",s.Biviewerinner="biviewerinner",s.Bieditor="bieditor",s.Bieditorinner="bieditorinner",s))(Et||{});const Fe=typeof window<"u"?window.echarts:null,Do={name:"VsPie",props:["currentWidget"],mixins:[R],data(){return{chartInstance:null,resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var r;await this.$nextTick(),await this.getData();const{series:s}=this.prepareData()||{};s&&this.initChart(s);const t=(r=this.$refs)==null?void 0:r.chart;t&&(this.resizeObserver=new ResizeObserver(()=>{this.chartInstance&&this.chartInstance.resize()}),this.resizeObserver.observe(t))},beforeUnmount(){var s;(s=this.resizeObserver)==null||s.disconnect()},methods:{onChangedData(){try{if(this.sourceData){const{series:s,xs:t,ys:r}=this.prepareData();s&&this.initChart(s,t,r)}}catch(s){console.error(s)}},buildTooltipForDonut(s,t){const{name:r,value:n,percent:o}=s;return`
175
175
  <div style="background-color:${t[0]}; font-size:12px; font-family:Helvetica, Arial, sans-serif; color:#ffff; padding:5px; border-radius:5px;">
176
176
  ${r==null?void 0:r.replace("null","Не визначено")}: ${W(n)} (${o}%)
177
- </div>`},prepareData(){var s,t,r,n,o,l;try{if(this.styleData=this.styleData||{},!((s=this.sourceData)!=null&&s.length))return console.warn("No source data available"),null;const a=Array.from(new Set((this.sourceData||[]).map(u=>u[this.dimensions[0]]))),i=Array.from(new Set((this.sourceData||[]).map(u=>u[this.dimensions[1]]))),c=parseInt((this.sourceData||[]).reduce((u,x)=>u+parseFloat((x==null?void 0:x.metric)||0),0),10),p=a.map((u,x)=>{const k=(i[x]/c*100).toFixed(2);return{name:`${u} (${k}%)`,value:i[x]}}),d=((t=this.styleData)==null?void 0:t.innerRadius)||"80%",h=((r=this.styleData)==null?void 0:r.outerRadius)||"100%",m=[d,h];return this.styleData.legend=Ve.getLegendOpions({borderRadius:10,height:"100%",padding:10,bottom:"0",type:"scroll",itemWidth:14,itemHeight:14,formatter:u=>{var x;return(x=u==null?void 0:u.replace("null","Не визначено"))==null?void 0:x.replace("NaN","0.00")},...((n=this.styleData)==null?void 0:n.legend)||{}}),this.styleData.label=Ve.getLabelOptions((o=this.styleData)==null?void 0:o.label),this.styleData.show_legend=((l=this.styleData)==null?void 0:l.show_legend)??!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:m,center:["50%","60%"],height:"75%",...Y(this.styleData),data:p}]}}catch(a){return console.error("Error in prepareData:",a),null}},async initChart(s){try{if(!s){console.warn("No series data available for chart initialization");return}const t=this.$refs.chart;if(!t){console.warn("Chart DOM element not found");return}if(this.chartInstance=Re==null?void 0:Re.init(t),!this.chartInstance)return;const r=parseInt((this.sourceData||[]).reduce((o,l)=>o+parseFloat((l==null?void 0:l.metric)||0),0),10),n={tooltip:{trigger:"item",formatter:o=>this.buildTooltipForDonut(o,[o.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:s,...Y(this.styleData||{}),title:{text:W(r),left:"center",top:"41%",textStyle:{color:"black",fontWeight:400,fontSize:"22px"}}};this.chartInstance.setOption(n),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{var o;(o=this.chartInstance)==null||o.resize()})}catch(t){console.error("Error in initChart:",t)}}}},zo=["id"];function Lo(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:l.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,zo)}const Bt=D(So,[["render",Lo]]),To=Object.freeze(Object.defineProperty({__proto__:null,default:Bt},Symbol.toStringTag,{value:"Module"})),Ae=typeof window<"u"?window.echarts:null,Io={name:"VsPie",props:["currentWidget"],mixins:[P],data(){return{chartInstance:null,resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var r;await this.$nextTick(),await this.getData();const{series:s}=this.prepareData()||{};s&&this.initChart(s);const t=(r=this.$refs)==null?void 0:r.chart;t&&(this.resizeObserver=new ResizeObserver(()=>{this.chartInstance&&this.chartInstance.resize()}),this.resizeObserver.observe(t))},unmounted(){var s;(s=this.resizeObserver)==null||s.disconnect()},methods:{onChangedData(){try{if(this.sourceData){const{series:s,xs:t,ys:r}=this.prepareData();s&&this.initChart(s,t,r)}}catch(s){console.error(s)}},buildTooltipForDonut(s,t){const{name:r,value:n,percent:o}=s;return`
177
+ </div>`},prepareData(){var s,t,r,n,o,l;try{if(this.styleData=this.styleData||{},!((s=this.sourceData)!=null&&s.length))return console.warn("No source data available"),null;const a=Array.from(new Set((this.sourceData||[]).map(m=>m[this.dimensions[0]]))),i=Array.from(new Set((this.sourceData||[]).map(m=>m[this.dimensions[1]]))),c=parseInt((this.sourceData||[]).reduce((m,x)=>m+parseFloat((x==null?void 0:x.metric)||0),0),10),p=a.map((m,x)=>{const k=(i[x]/c*100).toFixed(2);return{name:`${m} (${k}%)`,value:i[x]}}),d=((t=this.styleData)==null?void 0:t.innerRadius)||"80%",h=((r=this.styleData)==null?void 0:r.outerRadius)||"100%",g=[d,h];return this.styleData.legend=Ve.getLegendOpions({borderRadius:10,height:"100%",padding:10,bottom:"0",type:"scroll",itemWidth:14,itemHeight:14,formatter:m=>{var x;return(x=m==null?void 0:m.replace("null","Не визначено"))==null?void 0:x.replace("NaN","0.00")},...((n=this.styleData)==null?void 0:n.legend)||{}}),this.styleData.label=Ve.getLabelOptions((o=this.styleData)==null?void 0:o.label),this.styleData.show_legend=((l=this.styleData)==null?void 0:l.show_legend)??!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:g,center:["50%","60%"],height:"75%",...Y(this.styleData),data:p}]}}catch(a){return console.error("Error in prepareData:",a),null}},async initChart(s){try{if(!s){console.warn("No series data available for chart initialization");return}const t=this.$refs.chart;if(!t){console.warn("Chart DOM element not found");return}if(this.chartInstance=Fe==null?void 0:Fe.init(t),!this.chartInstance)return;const r=parseInt((this.sourceData||[]).reduce((o,l)=>o+parseFloat((l==null?void 0:l.metric)||0),0),10),n={tooltip:{trigger:"item",formatter:o=>this.buildTooltipForDonut(o,[o.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:s,...Y(this.styleData||{}),title:{text:W(r),left:"center",top:"41%",textStyle:{color:"black",fontWeight:400,fontSize:"22px"}}};this.chartInstance.setOption(n),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{var o;(o=this.chartInstance)==null||o.resize()})}catch(t){console.error("Error in initChart:",t)}}}},No=["id"];function So(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:l.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,No)}const Bt=D(Do,[["render",So]]),zo=Object.freeze(Object.defineProperty({__proto__:null,default:Bt},Symbol.toStringTag,{value:"Module"})),Ae=typeof window<"u"?window.echarts:null,Lo={name:"VsPie",props:["currentWidget"],mixins:[R],data(){return{chartInstance:null,resizeObserver:null}},computed:{uniqueID(){return this.widget}},async mounted(){var r;await this.$nextTick(),await this.getData();const{series:s}=this.prepareData()||{};s&&this.initChart(s);const t=(r=this.$refs)==null?void 0:r.chart;t&&(this.resizeObserver=new ResizeObserver(()=>{this.chartInstance&&this.chartInstance.resize()}),this.resizeObserver.observe(t))},unmounted(){var s;(s=this.resizeObserver)==null||s.disconnect()},methods:{onChangedData(){try{if(this.sourceData){const{series:s,xs:t,ys:r}=this.prepareData();s&&this.initChart(s,t,r)}}catch(s){console.error(s)}},buildTooltipForDonut(s,t){const{name:r,value:n,percent:o}=s;return`
178
178
  <div style="background-color:${t[0]}; font-size:12px; font-family:Helvetica, Arial, sans-serif; color:#ffff; padding:5px; border-radius:5px;">
179
179
  ${r==null?void 0:r.replace("null","Не визначено")}: ${W(n)} (${o}%)
180
- </div>`},prepareData(){var s,t,r,n,o;try{this.styleData=this.styleData||{};const l=Array.from(new Set((this.sourceData||[]).map(g=>g[this.dimensions[0]]))),a=Array.from(new Set((this.sourceData||[]).map(g=>g[this.dimensions[1]]))),i=parseInt((this.sourceData||[]).reduce((g,u)=>g+parseFloat(u==null?void 0:u.metric),0),10),c=l.map((g,u)=>{const x=(a[u]/i*100).toFixed(2);return{name:`${g} (${x}%)`,value:a[u]}}),p=((s=this.styleData)==null?void 0:s.innerRadius)||"0%",d=((t=this.styleData)==null?void 0:t.outerRadius)||"100%",h=[p,d];return this.styleData.legend=Ve.getLegendOpions({borderRadius:10,height:"100%",padding:10,type:"scroll",itemWidth:14,itemHeight:14,formatter:g=>g==null?void 0:g.replace("null","Не визначено"),textStyle:{fontSize:"14px"},...((r=this.styleData)==null?void 0:r.legend)||{}}),this.styleData.label=Ve.getLabelOptions((n=this.styleData)==null?void 0:n.label),this.styleData.show_legend=((o=this.styleData)==null?void 0:o.show_legend)??!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:h,center:["50%","60%"],height:"75%",...Y(this.styleData),data:c}]}}catch(l){return console.error("Error in prepareData:",l),null}},async initChart(s){try{if(!s){console.warn("No series data available for chart initialization");return}const t=this.$refs.chart;if(!t){console.warn("Chart DOM element not found");return}if(this.chartInstance=Ae==null?void 0:Ae.init(t),!this.chartInstance)return;const r={tooltip:{trigger:"item",formatter:n=>this.buildTooltipForDonut(n,[n.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:s,...Y(this.styleData||{})};this.chartInstance.setOption(r),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{var n;(n=this.chartInstance)==null||n.resize()})}catch(t){console.error("Error in initChart:",t)}}}},Mo=["id"];function Fo(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:l.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,Mo)}const Dt=D(Io,[["render",Fo]]),Po=Object.freeze(Object.defineProperty({__proto__:null,default:Dt},Symbol.toStringTag,{value:"Module"})),Ro={name:"VsLine",mixins:[P],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:s,xs:t}=this.prepareData();s&&this.initChart(s,t)},methods:{onChangedData(){try{if(this.sourceData){const{series:s,xs:t,ys:r}=this.prepareData();s&&(this==null||this.initChart(s,t,r))}}catch(s){console.error(s)}},prepareData(){var s,t;try{const r=Array.from(new Set(this.sourceData.map(a=>a[this.dimensions[0]])));let n;this.dimensions[0].includes("date")?n=r.map(a=>pe(a)):n=[...r];const o=this.sourceData.map(a=>parseFloat(a[this.dimensions[1]]));let l;return(s=this.styleData)!=null&&s.stack?l=this.dimensions.slice(1).map(i=>({name:i,type:"line",stack:"a",areaStyle:this.styleData.area?{}:null,data:this.sourceData.filter(c=>parseFloat(c[i])).map(c=>parseFloat(c[i]))})):l=[{name:this.title,type:"line",areaStyle:(t=this.styleData)!=null&&t.area?{}:null,data:o,stack:"a"}],{series:l,xs:n}}catch(r){return console.error(r),null}}}},Ao=["id"];function Oo(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:o.uniqueID,ref:"chart",style:{height:"400px"}},null,8,Ao)}const Nt=D(Ro,[["render",Oo]]),jo=Object.freeze(Object.defineProperty({__proto__:null,default:Nt},Symbol.toStringTag,{value:"Module"})),Wo={name:"VsStat",mixins:[P],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 s=this.getValues();this.sumValue=s.reduce((t,r)=>t+r,0),this.sourceData.forEach((t,r)=>{t.color=r<$t.length-1?$t[r]:Eo()})},formattedValue(s){const t=parseFloat(s);return W(t)}}},qo={class:"flex flex-col w-full h-full pt-[16px] rounded-xl"},Uo={class:"flex flex-col justify-between w-full h-full"},vo={class:"w-full h-full pb-6 space-y-4"},Ho={class:"flex w-full h-3 rounded-full gap-x-1 min-h-3 custom-x-scrollbar"},Go=["onMouseover"],Zo={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"},Qo={class:"h-[calc(100%-20px)] w-full custom-scrollbar"},Xo={class:"grid items-center justify-between grid-cols-2 py-2 gap-x-4"},Ko={class:"flex items-center"},Jo={class:"text-sm text-gray-800"},Yo={class:"text-end"},ea={class:"text-sm text-gray-500"};function ta(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",qo,[e.createElementVNode("div",Uo,[e.createElementVNode("div",vo,[e.createElementVNode("div",Ho,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,(a,i)=>{var c,p,d,h;return e.openBlock(),e.createElementBlock("div",{class:e.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-[${a.color}]`]),style:e.normalizeStyle({width:`${parseFloat(a==null?void 0:a[(c=o.columns)==null?void 0:c[1]])/o.sumValue*100}%`}),role:"progressbar","aria-valuenow":"42","aria-valuemin":"0","aria-valuemax":"100",onMouseover:m=>o.showTooltip=i,onMouseleave:t[0]||(t[0]=m=>o.showTooltip=-1)},[o.showTooltip>-1?(e.openBlock(),e.createElementBlock("div",Zo,e.toDisplayString(s.sourceData[o.showTooltip][o.columns[0]])+" "+e.toDisplayString((parseFloat((h=(p=s.sourceData)==null?void 0:p[o.showTooltip])==null?void 0:h[(d=o.columns)==null?void 0:d[1]])/o.sumValue*100).toFixed(2))+"% ",1)):e.createCommentVNode("",!0)],46,Go)}),256))]),e.createElementVNode("ul",Qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,a=>{var i,c;return e.openBlock(),e.createElementBlock("li",Xo,[e.createElementVNode("div",Ko,[e.createElementVNode("span",{class:e.normalizeClass(["shrink-0 size-2.5 inline-block rounded-sm me-2.5 min-w-[10px] w-[10px] h-[10px] min-h-[10px]",`bg-[${a.color}]`])},null,2),e.createElementVNode("span",Jo,e.toDisplayString((a==null?void 0:a[(i=o.columns)==null?void 0:i[0]])||"Не визначено"),1)]),e.createElementVNode("div",Yo,[e.createElementVNode("span",ea,e.toDisplayString(l.formattedValue(a==null?void 0:a[(c=o.columns)==null?void 0:c[1]])||"-"),1)])])}),256))])])])])}const St=D(Wo,[["render",ta]]),sa=Object.freeze(Object.defineProperty({__proto__:null,default:St},Symbol.toStringTag,{value:"Module"})),ra={name:"VsProgressBar",mixins:[P],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){var t;this.columns=Object.keys((t=this.sourceData)==null?void 0:t[0])||null;const s=this.getValues();this.maxValue=Math.max(...s)},formattedValue(s){return W(s)}}},na={key:0,class:"flex flex-col h-full pt-[16px] rounded-xl"},oa={class:"h-full pt-0 pb-6 space-y-4"},aa={class:"h-full space-y-4 custom-scrollbar"},la={class:"flex items-center justify-between mr-2 gap-x-2"},ia={class:"grid items-center w-full grid-cols-2 gap-x-2"},ca={class:"text-sm text-gray-800"},da={class:"flex justify-end",role:"progressbar","aria-valuenow":"100","aria-valuemin":"0","aria-valuemax":"100"},pa={class:"min-w-[60px] text-end"},ha={class:"text-sm text-gray-500"};function ma(s,t,r,n,o,l){return o.columns?(e.openBlock(),e.createElementBlock("div",na,[e.createElementVNode("div",oa,[e.createElementVNode("ul",aa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,(a,i)=>(e.openBlock(),e.createElementBlock("li",la,[e.createElementVNode("div",ia,[e.createElementVNode("span",ca,e.toDisplayString(a[o.columns[0]]),1),e.createElementVNode("div",da,[e.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:e.normalizeStyle({width:`${parseFloat(a[o.columns[1]])/o.maxValue*100}%`})},null,4)])]),e.createElementVNode("div",pa,[e.createElementVNode("span",ha,e.toDisplayString(l.formattedValue(a[o.columns[1]])),1)])]))),256))])])])):e.createCommentVNode("",!0)}const zt=D(ra,[["render",ma]]),ua=Object.freeze(Object.defineProperty({__proto__:null,default:zt},Symbol.toStringTag,{value:"Module"})),fa={name:"VsListbar",mixins:[P],props:["source"],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch(s){console.error(s)}},prepareData(){var t,r,n;this.columns=Object.keys(((t=this.sourceData)==null?void 0:t[0])||{});const s=(r=this.sourceData)==null?void 0:r.map(o=>{var l;return o==null?void 0:o[(l=this.columns)==null?void 0:l[1]]});this.maxValue=Math.max(...s||[]),this.restDimensions=(n=this.columns)==null?void 0:n.filter((o,l)=>l!==0)},formattedValue(s){return W(s)},getWidth(s){return`${s/this.maxValue*100}%`}}},ga={class:"h-full pt-[20px] list-bar"},ba={class:"space-y-2 custom-scrollbar h-full h-[calc(100%-20px)]"},ya={class:"relative w-full truncate"},xa={class:"relative z-[1] text-sm block py-1 px-2 w-full text-sm truncate text-gray-800"},ka={class:"text-[14px] text-gray-500"};function wa(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",ga,[e.createElementVNode("ul",ba,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,(a,i)=>{var c,p,d;return e.openBlock(),e.createElementBlock("li",{key:i,class:"flex items-center justify-between w-full gap-x-2"},[e.createElementVNode("div",ya,[e.createElementVNode("span",xa,e.toDisplayString((a==null?void 0:a[(c=o.columns)==null?void 0:c[0]])||"Без категорії"),1),e.createElementVNode("div",{class:e.normalizeClass(["absolute inset-y-0 h-full rounded start-0",a!=null&&a[(p=o.columns)==null?void 0:p[0]]?"bg-indigo-100":"bg-gray-100"]),style:e.normalizeStyle({width:l.getWidth(a==null?void 0:a[(d=o.columns)==null?void 0:d[1]])})},null,6)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.restDimensions,(h,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"w-20 mr-2 text-end"},[e.createElementVNode("span",ka,e.toDisplayString(l.formattedValue(a==null?void 0:a[h])),1)]))),128))])}),128))])])}const Lt=D(fa,[["render",wa]]),_a=Object.freeze(Object.defineProperty({__proto__:null,default:Lt},Symbol.toStringTag,{value:"Module"})),$a={name:"VsPivotTable",mixins:[P],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 s=Array.from(new Set(this.sourceData.map(t=>t[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=s.map(t=>pe(t)):this.xs=[...s],this.products=this.dimensions.filter((t,r)=>r!=0),this.values=this.products.map((t,r)=>({name:t,data:this.sourceData.filter(n=>parseFloat(n[t])).map(n=>W(parseFloat(n[t])))}))}catch(s){console.error(s)}}}},Va={class:"flex flex-col h-full p-5 space-y-4 rounded-xl custom-scrollbar"},Ea={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"},Ca={class:"inline-block min-w-full align-middle"},Ba={class:"min-w-full divide-y divide-gray-200"},Da={class:"space-x-2"},Na={scope:"col",class:"xl:min-w-[120px] min-w-48"},Sa={class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"},za={class:"divide-y divide-gray-200 text-[12px]"},La={class:"py-3 size-px whitespace-nowrap"},Ta={class:"flex items-center gap-x-3"},Ia={class:"font-medium text-gray-800"},Ma={class:"py-3 size-px whitespace-nowrap"},Fa={class:"text-gray-600"};function Pa(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",Va,[e.createElementVNode("div",Ea,[e.createElementVNode("div",Ca,[e.createElementVNode("table",Ba,[e.createElementVNode("thead",null,[e.createElementVNode("tr",Da,[t[0]||(t[0]=e.createElementVNode("th",{scope:"col",class:"min-w-[200px]"},[e.createElementVNode("div",{class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.xs,a=>(e.openBlock(),e.createElementBlock("th",Na,[e.createElementVNode("div",Sa,e.toDisplayString(a),1)]))),256))])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.values,a=>(e.openBlock(),e.createElementBlock("tbody",za,[e.createElementVNode("tr",null,[e.createElementVNode("td",La,[e.createElementVNode("div",Ta,[e.createElementVNode("span",Ia,e.toDisplayString(a.name),1)])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.xs,(i,c)=>(e.openBlock(),e.createElementBlock("td",Ma,[e.createElementVNode("span",Fa,e.toDisplayString(a.data[c]),1)]))),256))])]))),256))])])])])}const Tt=D($a,[["render",Pa]]),Ra=Object.freeze(Object.defineProperty({__proto__:null,default:Tt},Symbol.toStringTag,{value:"Module"})),Aa={name:"VsNumber",mixins:[P],data(){return{number:""}},computed:{formattedNumber(){return _o(this.number)},prefix(){var s,t;return(s=this.styleData)!=null&&s.prefix?(t=this.styleData)==null?void 0:t.prefix:""}},watch:{sourceData:{async handler(){this.getNumber()},deep:!0}},async mounted(){await this.getData(),this.getNumber()},methods:{onChangedData(){try{this.sourceData&&this.getNumber()}catch(s){console.error(s)}},async getNumber(){var s,t;try{this.number=((t=this.sourceData[0])==null?void 0:t[Object.keys((s=this.sourceData)==null?void 0:s[0])])||0}catch(r){console.error(r)}}}},Oa={class:"text-lg lg:text-xl xl:text-2xl text-gray-800 h-[32px] flex items-center"};function ja(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",Oa,e.toDisplayString(l.prefix)+e.toDisplayString(l.formattedNumber),1)}const Wa=Object.freeze(Object.defineProperty({__proto__:null,default:D(Aa,[["render",ja]])},Symbol.toStringTag,{value:"Module"})),qa={name:"VsText",mixins:[P],data(){return{markedText:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget;try{await this.getData(),this.markedText=B(this.sourceData)}catch(s){console.error(s)}},methods:{onChangedData(){return null}}},Ua=["id"],va=["innerHTML"];function Ha(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:o.uniqueID,class:"relative select-auto h-full rounded-xl text-[12px] box-border bg-white custom-scrollbar text-widget"},[o.markedText?(e.openBlock(),e.createElementBlock("div",{key:0,innerHTML:o.markedText},null,8,va)):e.createCommentVNode("",!0)],8,Ua)}const Ga=Object.freeze(Object.defineProperty({__proto__:null,default:D(qa,[["render",Ha]])},Symbol.toStringTag,{value:"Module"})),Oe=typeof window<"u"?window.echarts:null,Za={name:"VsFunnelBar",mixins:[P],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:s}=this.prepareData();s&&this.initChart(s)},methods:{buildTooltipForDonut(s,t){const{name:r,value:n,percent:o}=s;return`
180
+ </div>`},prepareData(){var s,t,r,n,o;try{this.styleData=this.styleData||{};const l=Array.from(new Set((this.sourceData||[]).map(f=>f[this.dimensions[0]]))),a=Array.from(new Set((this.sourceData||[]).map(f=>f[this.dimensions[1]]))),i=parseInt((this.sourceData||[]).reduce((f,m)=>f+parseFloat(m==null?void 0:m.metric),0),10),c=l.map((f,m)=>{const x=(a[m]/i*100).toFixed(2);return{name:`${f} (${x}%)`,value:a[m]}}),p=((s=this.styleData)==null?void 0:s.innerRadius)||"0%",d=((t=this.styleData)==null?void 0:t.outerRadius)||"100%",h=[p,d];return this.styleData.legend=Ve.getLegendOpions({borderRadius:10,height:"100%",padding:10,type:"scroll",itemWidth:14,itemHeight:14,formatter:f=>f==null?void 0:f.replace("null","Не визначено"),textStyle:{fontSize:"14px"},...((r=this.styleData)==null?void 0:r.legend)||{}}),this.styleData.label=Ve.getLabelOptions((n=this.styleData)==null?void 0:n.label),this.styleData.show_legend=((o=this.styleData)==null?void 0:o.show_legend)??!0,{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"pie",radius:h,center:["50%","60%"],height:"75%",...Y(this.styleData),data:c}]}}catch(l){return console.error("Error in prepareData:",l),null}},async initChart(s){try{if(!s){console.warn("No series data available for chart initialization");return}const t=this.$refs.chart;if(!t){console.warn("Chart DOM element not found");return}if(this.chartInstance=Ae==null?void 0:Ae.init(t),!this.chartInstance)return;const r={tooltip:{trigger:"item",formatter:n=>this.buildTooltipForDonut(n,[n.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[15,15],shadowColor:"transparent",backgroundColor:"transparent"},series:s,...Y(this.styleData||{})};this.chartInstance.setOption(r),this.$emit("update:currentWidget",this.chartInstance),this.chartInstance.resize(),window.addEventListener("resize",()=>{var n;(n=this.chartInstance)==null||n.resize()})}catch(t){console.error("Error in initChart:",t)}}}},To=["id"];function Io(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:l.uniqueID,ref:"chart",class:"h-full min-h-[200px] flex items-center"},null,8,To)}const Ct=D(Lo,[["render",Io]]),Mo=Object.freeze(Object.defineProperty({__proto__:null,default:Ct},Symbol.toStringTag,{value:"Module"})),Po={name:"VsLine",mixins:[R],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:s,xs:t}=this.prepareData();s&&this.initChart(s,t)},methods:{onChangedData(){try{if(this.sourceData){const{series:s,xs:t,ys:r}=this.prepareData();s&&(this==null||this.initChart(s,t,r))}}catch(s){console.error(s)}},prepareData(){var s,t;try{const r=Array.from(new Set(this.sourceData.map(a=>a[this.dimensions[0]])));let n;this.dimensions[0].includes("date")?n=r.map(a=>pe(a)):n=[...r];const o=this.sourceData.map(a=>parseFloat(a[this.dimensions[1]]));let l;return(s=this.styleData)!=null&&s.stack?l=this.dimensions.slice(1).map(i=>({name:i,type:"line",stack:"a",areaStyle:this.styleData.area?{}:null,data:this.sourceData.filter(c=>parseFloat(c[i])).map(c=>parseFloat(c[i]))})):l=[{name:this.title,type:"line",areaStyle:(t=this.styleData)!=null&&t.area?{}:null,data:o,stack:"a"}],{series:l,xs:n}}catch(r){return console.error(r),null}}}},Ro=["id"];function Fo(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:o.uniqueID,ref:"chart",style:{height:"400px"}},null,8,Ro)}const Dt=D(Po,[["render",Fo]]),Ao=Object.freeze(Object.defineProperty({__proto__:null,default:Dt},Symbol.toStringTag,{value:"Module"})),Oo={name:"VsStat",mixins:[R],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 s=this.getValues();this.sumValue=s.reduce((t,r)=>t+r,0),this.sourceData.forEach((t,r)=>{t.color=r<_t.length-1?_t[r]:$o()})},formattedValue(s){const t=parseFloat(s);return W(t)}}},jo={class:"flex flex-col w-full h-full pt-[16px] rounded-xl"},Wo={class:"flex flex-col justify-between w-full h-full"},qo={class:"w-full h-full pb-6 space-y-4"},Uo={class:"flex w-full h-3 rounded-full gap-x-1 min-h-3 custom-x-scrollbar"},vo=["onMouseover"],Ho={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"},Go={class:"h-[calc(100%-20px)] w-full custom-scrollbar"},Zo={class:"grid items-center justify-between grid-cols-2 py-2 gap-x-4"},Qo={class:"flex items-center"},Xo={class:"text-sm text-gray-800"},Jo={class:"text-end"},Ko={class:"text-sm text-gray-500"};function Yo(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",jo,[e.createElementVNode("div",Wo,[e.createElementVNode("div",qo,[e.createElementVNode("div",Uo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,(a,i)=>{var c,p,d,h;return e.openBlock(),e.createElementBlock("div",{class:e.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-[${a.color}]`]),style:e.normalizeStyle({width:`${parseFloat(a==null?void 0:a[(c=o.columns)==null?void 0:c[1]])/o.sumValue*100}%`}),role:"progressbar","aria-valuenow":"42","aria-valuemin":"0","aria-valuemax":"100",onMouseover:g=>o.showTooltip=i,onMouseleave:t[0]||(t[0]=g=>o.showTooltip=-1)},[o.showTooltip>-1?(e.openBlock(),e.createElementBlock("div",Ho,e.toDisplayString(s.sourceData[o.showTooltip][o.columns[0]])+" "+e.toDisplayString((parseFloat((h=(p=s.sourceData)==null?void 0:p[o.showTooltip])==null?void 0:h[(d=o.columns)==null?void 0:d[1]])/o.sumValue*100).toFixed(2))+"% ",1)):e.createCommentVNode("",!0)],46,vo)}),256))]),e.createElementVNode("ul",Go,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,a=>{var i,c;return e.openBlock(),e.createElementBlock("li",Zo,[e.createElementVNode("div",Qo,[e.createElementVNode("span",{class:e.normalizeClass(["shrink-0 size-2.5 inline-block rounded-sm me-2.5 min-w-[10px] w-[10px] h-[10px] min-h-[10px]",`bg-[${a.color}]`])},null,2),e.createElementVNode("span",Xo,e.toDisplayString((a==null?void 0:a[(i=o.columns)==null?void 0:i[0]])||"Не визначено"),1)]),e.createElementVNode("div",Jo,[e.createElementVNode("span",Ko,e.toDisplayString(l.formattedValue(a==null?void 0:a[(c=o.columns)==null?void 0:c[1]])||"-"),1)])])}),256))])])])])}const Nt=D(Oo,[["render",Yo]]),ea=Object.freeze(Object.defineProperty({__proto__:null,default:Nt},Symbol.toStringTag,{value:"Module"})),ta={name:"VsProgressBar",mixins:[R],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch{}},prepareData(){var t;this.columns=Object.keys((t=this.sourceData)==null?void 0:t[0])||null;const s=this.getValues();this.maxValue=Math.max(...s)},formattedValue(s){return W(s)}}},sa={key:0,class:"flex flex-col h-full pt-[16px] rounded-xl"},ra={class:"h-full pt-0 pb-6 space-y-4"},na={class:"h-full space-y-4 custom-scrollbar"},oa={class:"flex items-center justify-between mr-2 gap-x-2"},aa={class:"grid items-center w-full grid-cols-2 gap-x-2"},la={class:"text-sm text-gray-800"},ia={class:"flex justify-end",role:"progressbar","aria-valuenow":"100","aria-valuemin":"0","aria-valuemax":"100"},ca={class:"min-w-[60px] text-end"},da={class:"text-sm text-gray-500"};function pa(s,t,r,n,o,l){return o.columns?(e.openBlock(),e.createElementBlock("div",sa,[e.createElementVNode("div",ra,[e.createElementVNode("ul",na,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,(a,i)=>(e.openBlock(),e.createElementBlock("li",oa,[e.createElementVNode("div",aa,[e.createElementVNode("span",la,e.toDisplayString(a[o.columns[0]]),1),e.createElementVNode("div",ia,[e.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:e.normalizeStyle({width:`${parseFloat(a[o.columns[1]])/o.maxValue*100}%`})},null,4)])]),e.createElementVNode("div",ca,[e.createElementVNode("span",da,e.toDisplayString(l.formattedValue(a[o.columns[1]])),1)])]))),256))])])])):e.createCommentVNode("",!0)}const St=D(ta,[["render",pa]]),ha=Object.freeze(Object.defineProperty({__proto__:null,default:St},Symbol.toStringTag,{value:"Module"})),ma={name:"VsListbar",mixins:[R],props:["source"],data(){return{restDimensions:[],maxValue:0,columns:null}},async mounted(){await this.getData(),this.prepareData()},methods:{onChangedData(){try{this.sourceData&&this.prepareData()}catch(s){console.error(s)}},prepareData(){var t,r,n;this.columns=Object.keys(((t=this.sourceData)==null?void 0:t[0])||{});const s=(r=this.sourceData)==null?void 0:r.map(o=>{var l;return o==null?void 0:o[(l=this.columns)==null?void 0:l[1]]});this.maxValue=Math.max(...s||[]),this.restDimensions=(n=this.columns)==null?void 0:n.filter((o,l)=>l!==0)},formattedValue(s){return W(s)},getWidth(s){return`${s/this.maxValue*100}%`}}},ua={class:"h-full pt-[20px] list-bar"},fa={class:"space-y-2 custom-scrollbar h-full h-[calc(100%-20px)]"},ga={class:"relative w-full truncate"},ba={class:"relative z-[1] text-sm block py-1 px-2 w-full text-sm truncate text-gray-800"},ya={class:"text-[14px] text-gray-500"};function xa(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",ua,[e.createElementVNode("ul",fa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,(a,i)=>{var c,p,d;return e.openBlock(),e.createElementBlock("li",{key:i,class:"flex items-center justify-between w-full gap-x-2"},[e.createElementVNode("div",ga,[e.createElementVNode("span",ba,e.toDisplayString((a==null?void 0:a[(c=o.columns)==null?void 0:c[0]])||"Без категорії"),1),e.createElementVNode("div",{class:e.normalizeClass(["absolute inset-y-0 h-full rounded start-0",a!=null&&a[(p=o.columns)==null?void 0:p[0]]?"bg-indigo-100":"bg-gray-100"]),style:e.normalizeStyle({width:l.getWidth(a==null?void 0:a[(d=o.columns)==null?void 0:d[1]])})},null,6)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.restDimensions,(h,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:"w-20 mr-2 text-end"},[e.createElementVNode("span",ya,e.toDisplayString(l.formattedValue(a==null?void 0:a[h])),1)]))),128))])}),128))])])}const zt=D(ma,[["render",xa]]),ka=Object.freeze(Object.defineProperty({__proto__:null,default:zt},Symbol.toStringTag,{value:"Module"})),wa={name:"VsPivotTable",mixins:[R],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 s=Array.from(new Set(this.sourceData.map(t=>t[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=s.map(t=>pe(t)):this.xs=[...s],this.products=this.dimensions.filter((t,r)=>r!=0),this.values=this.products.map((t,r)=>({name:t,data:this.sourceData.filter(n=>parseFloat(n[t])).map(n=>W(parseFloat(n[t])))}))}catch(s){console.error(s)}}}},_a={class:"flex flex-col h-full p-5 space-y-4 rounded-xl custom-scrollbar"},$a={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"},Va={class:"inline-block min-w-full align-middle"},Ea={class:"min-w-full divide-y divide-gray-200"},Ba={class:"space-x-2"},Ca={scope:"col",class:"xl:min-w-[120px] min-w-48"},Da={class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"},Na={class:"divide-y divide-gray-200 text-[12px]"},Sa={class:"py-3 size-px whitespace-nowrap"},za={class:"flex items-center gap-x-3"},La={class:"font-medium text-gray-800"},Ta={class:"py-3 size-px whitespace-nowrap"},Ia={class:"text-gray-600"};function Ma(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",_a,[e.createElementVNode("div",$a,[e.createElementVNode("div",Va,[e.createElementVNode("table",Ea,[e.createElementVNode("thead",null,[e.createElementVNode("tr",Ba,[t[0]||(t[0]=e.createElementVNode("th",{scope:"col",class:"min-w-[200px]"},[e.createElementVNode("div",{class:"py-2.5 text-text-start flex items-center gap-x-1 text-sm font-normal text-gray-500"})],-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.xs,a=>(e.openBlock(),e.createElementBlock("th",Ca,[e.createElementVNode("div",Da,e.toDisplayString(a),1)]))),256))])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.values,a=>(e.openBlock(),e.createElementBlock("tbody",Na,[e.createElementVNode("tr",null,[e.createElementVNode("td",Sa,[e.createElementVNode("div",za,[e.createElementVNode("span",La,e.toDisplayString(a.name),1)])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.xs,(i,c)=>(e.openBlock(),e.createElementBlock("td",Ta,[e.createElementVNode("span",Ia,e.toDisplayString(a.data[c]),1)]))),256))])]))),256))])])])])}const Lt=D(wa,[["render",Ma]]),Pa=Object.freeze(Object.defineProperty({__proto__:null,default:Lt},Symbol.toStringTag,{value:"Module"})),Ra={name:"VsNumber",mixins:[R],data(){return{number:""}},computed:{formattedNumber(){return ko(this.number)},prefix(){var s,t;return(s=this.styleData)!=null&&s.prefix?(t=this.styleData)==null?void 0:t.prefix:""}},watch:{sourceData:{async handler(){this.getNumber()},deep:!0}},async mounted(){await this.getData(),this.getNumber()},methods:{onChangedData(){try{this.sourceData&&this.getNumber()}catch(s){console.error(s)}},async getNumber(){var s,t;try{this.number=((t=this.sourceData[0])==null?void 0:t[Object.keys((s=this.sourceData)==null?void 0:s[0])])||0}catch(r){console.error(r)}}}},Fa={class:"text-lg lg:text-xl xl:text-2xl text-gray-800 h-[32px] flex items-center"};function Aa(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",Fa,e.toDisplayString(l.prefix)+e.toDisplayString(l.formattedNumber),1)}const Oa=Object.freeze(Object.defineProperty({__proto__:null,default:D(Ra,[["render",Aa]])},Symbol.toStringTag,{value:"Module"})),ja={name:"VsText",mixins:[R],data(){return{markedText:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget;try{await this.getData(),this.markedText=C(this.sourceData)}catch(s){console.error(s)}},methods:{onChangedData(){return null}}},Wa=["id"],qa=["innerHTML"];function Ua(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{id:o.uniqueID,class:"relative select-auto h-full rounded-xl text-[12px] box-border bg-white custom-scrollbar text-widget"},[o.markedText?(e.openBlock(),e.createElementBlock("div",{key:0,innerHTML:o.markedText},null,8,qa)):e.createCommentVNode("",!0)],8,Wa)}const va=Object.freeze(Object.defineProperty({__proto__:null,default:D(ja,[["render",Ua]])},Symbol.toStringTag,{value:"Module"})),Oe=typeof window<"u"?window.echarts:null,Ha={name:"VsFunnelBar",mixins:[R],data(){return{chartInstance:null,uniqueID:null}},async mounted(){this.uniqueID=this.widget,await this.$nextTick(),await this.getData();const{series:s}=this.prepareData();s&&this.initChart(s)},methods:{buildTooltipForDonut(s,t){const{name:r,value:n,percent:o}=s;return`
181
181
  <div style="background-color:${t[0]};font-size: 12px; font-family: Helvetica, Arial, sans-serif;color:#ffff; padding:5px; border-radius:5px; ![box-shadow:none]">
182
182
  ${pe(r)}: ${W(n)} (${o}%)
183
- </div>`},onChangedData(){try{if(this.sourceData){const{series:s,xs:t,ys:r}=this.prepareData();s&&(this==null||this.initChart(s,t,r))}}catch{}},prepareData(){try{const s=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[0]]))),t=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[1]]))),r=s.map((o,l)=>({name:o,value:t[l]}));return{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"funnel",...Y(this.styleData),data:r,height:"80%",emphasis:{label:{show:!1}}}]}}catch(s){console.error(s)}},async initChart(s){try{const t=this.$refs.chart,r=Oe==null?void 0:Oe.init(t);if(!r)return;const n={series:s,...Y(this.styleData),tooltip:{trigger:"item",formatter:o=>this.buildTooltipForDonut(o,[o.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[10,15],shadowColor:"transparent",backgroundColor:"transparent"},itemStyle:{height:"15px"},legend:{borderRadius:10,type:"scroll",itemWidth:14,itemHeight:14,...this.styleData.legend},labelLine:{show:!1},grid:{bottom:"0"}};r.setOption(n),r.resize(),window.addEventListener("resize",()=>{r.resize()})}catch(t){console.error(t)}}}},Qa=["id"];function Xa(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{ref:"chart",id:o.uniqueID,class:"h-[90%] custom-scrollbar min-h-[200px]"},null,8,Qa)}const Ka=Object.freeze(Object.defineProperty({__proto__:null,default:D(Za,[["render",Xa]])},Symbol.toStringTag,{value:"Module"}));function Ja(s){return[{type:"fill",paint:{"fill-color":s.color||"#ccc","fill-outline-color":s.color||"blue","fill-opacity":s.opacity||1}}]}function Ya(s){return[{type:"line",paint:{"line-color":s.color||"#ccc","line-opacity":s.opacity||1}}]}function el(s){return[{type:"circle",paint:{"circle-radius":s.radius||6,"circle-stroke-color":s.stroke||"#ccc","circle-stroke-width":s.width||1,"circle-color":s.color||"blue"}}]}function It(s){if(!s)return null;const t=s.type||"point";return t==="polygon"?Ja(s):t==="line"?Ya(s):el(s)}const je={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(s=>s==null?void 0:s.interactive).map(s=>s.id)}},methods:{moveLayer(s,t=this.map){t.getStyle().layers.forEach(r=>{r.id.match(s)&&t.moveLayer(r.id)})},async setVisible(s,t=!0,r=this.map){if(!s)return;const n=(s==null?void 0:s.id)||s,o=this.layerList.find(a=>a.id===s)||s;if(!(o!=null&&o.id))throw new Error("MixinError: Layer has no id");const l=r.getStyle().layers.filter(a=>a.id.match(n));l.forEach(a=>{r.setLayoutProperty(a.id,"visibility",t?"visible":"none")}),!l.length&&t&&await this.addLayer(o)},async addLayer(s,t=this==null?void 0:this.map){var o,l;const r=this.layerList.find(a=>a.id===s)||s;!this.map.getStyle()||this.map.getStyle().layers.find(a=>a.id===r.id)||(this.layerList.find(a=>a.id===r.id)||this.layerList.push(r),(r.service==="vtile"||r.service==="vector"||(o=r.url)!=null&&o.includes(".vmt"))&&this.addVtileLayer(r,t),r.service==="geojson"&&this.addGeoJsonLayer(r,t),((l=r.url)!=null&&l.includes(".png")||["tms","raster"].includes(r.service))&&await this.addRasterLayer(r,t))},async addRasterLayer(s,t=this==null?void 0:this.map){var r,n;t.getSource(s.id)||(await t.addSource(s.id,{type:"raster",tiles:[s==null?void 0:s.url],tileSize:256,...s!=null&&s.scheme?{scheme:s==null?void 0:s.scheme}:{}}),await t.addLayer({id:s.id,type:"raster",source:s.id,minzoom:0,maxzoom:(s==null?void 0:s.maxzoom)||22},s.basemap?(n=(r=this.map.getStyle().layers)==null?void 0:r[0])==null?void 0:n.id:null))},async addVtileLayer(s,t=this==null?void 0:this.map){var l;const r=["props","pointZoom"].filter(a=>s[a]).map(a=>`&${a}=${s[a]}`),n={type:"vector",tiles:[`${(l=s==null?void 0:s.url)!=null&&l.startsWith("http")?"":window.location.origin}${s==null?void 0:s.url}${r}`],minzoom:s.minzoom||3,maxzoom:s.maxzoom||24};t.addSource(s.id,n),(It(s.style)||s.layers||[]).forEach((a,i)=>{const c={...a,id:`${s.id}-${i}`,source:s.id,"source-layer":a["source-layer"]||s.source||s.id,maxzoom:+a.maxzoom||24,minzoom:+a.minzoom||0};t.addLayer(c)})},async addGeoJsonLayer(s,t=this.map){var o;const r=s.data||((o=s==null?void 0:s.url)!=null&&o.startsWith("http")?"":window.location.origin)+s.url;t.addSource(s.id,{type:"geojson",data:r}),(It(s.style)||s.layers||[]).forEach(l=>{const a={...l,source:s.id,id:l.id||s.id,maxzoom:+l.maxzoom||24,minzoom:+l.minzoom||0,type:l.type||"circle"};t.addLayer(a)})},setLayerData(s,t){this.layerList=this.layerList.map(r=>r.id===s?{...r,...t}:r)},async removeLayer(s,t=this.map){t.getSource(s)&&(await t.getStyle().layers.forEach(async r=>{r.source===s&&await t.removeLayer(r.id)}),await t.removeSource(s))},async setFilter(s,t){var o;const r=this.layerList.find(l=>l.id===s),n=await((o=this.map)==null?void 0:o.getSource(s));if(n&&r.service==="vtile"){await n.setTiles([`${window.location.origin}${r.url}${r.url.includes("?")?"&":"?"}filter=${t}${r.props?`&props=${r.props}`:""}`]);return}n&&r.service},async changeBaseLayer(s){const t=s!=null&&s.id?s:this.layerList.find(n=>n.id===s),{id:r}=t;if(r&&r!==this.activeLayer){if(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),this.activeLayer=r,this.map.getLayer(r)){this.map.setLayoutProperty(r,"visibility","visible");return}await this.addRasterLayer(t)}},async refreshLayer(s,t=this.map){await t.getStyle().layers.forEach(r=>{r.source===s&&t.removeLayer(r.id)}),await t.removeSource(s),this.setVisible(s)}}},tl="https://unpkg.com/maplibre-gl@5.6.2/dist/maplibre-gl.js",sl="https://unpkg.com/maplibre-gl@5.6.2/dist/maplibre-gl.css";let Ee=null;function rl(s){return new Promise((t,r)=>{if(document.querySelector(`script[src="${s}"]`)){t();return}const n=document.createElement("script");n.src=s,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${s}`)),document.head.appendChild(n)})}function nl(s){return new Promise((t,r)=>{if(document.querySelector(`link[href="${s}"]`)){t();return}const n=document.createElement("link");n.rel="stylesheet",n.href=s,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${s}`)),document.head.appendChild(n)})}function Mt(){return typeof window>"u"?Promise.resolve(null):window.maplibregl?Promise.resolve(window.maplibregl):Ee||(Ee=nl(sl).then(()=>rl(tl)).then(()=>window.maplibregl),Ee)}const We={__name:"legend",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ms),e.mergeProps(t.$attrs,{size:24}),null,16))}},qe={pink:["#fde7e2","#feafbe","#fd58a4","#d7038e","#86007b"],blue:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],green:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],pink2:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],red:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],teal:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"]},ol={components:{legendIcon:We,closeIcon:De},props:{mapId:{type:String},colors:{type:Array},sizes:{type:Array,default:()=>[]},cluster:{type:[Boolean,String]},color:{type:String,default:"gray"},colorTitle:{type:String},sizesTitle:{type:String},resizeItem:{type:[Boolean,String],default:!1},changeOpacityItem:{type:[Boolean,String],default:!1}},data(){return{isOpenLegend:!1,palette:qe}},computed:{borderRadius(){return this.cluster?"rounded-sm":"rounded-full"},sortedSizes(){return[...this.sizes].sort((s,t)=>s-t)},maxWidht(){var r;const s=((r=this.sizes)==null?void 0:r.length)-1;return this.calcSize(s)}},methods:{sizeClass(s){return this.resizeItem?`h-[${this.calcSize(s)}] w-[${this.calcSize(s)}] ${this.borderRadius}`:`h-[18px] w-[18px] ${this.borderRadius}`},calcSize(s){return`${10+s*2}px`},getOpacity(s){return(s+1)/this.sortedSizes.length}}},al={class:"w-full absolute max-w-[200px] bg-white border rounded-lg bottom-[10px] right-[50px]"},ll={class:"flex items-center justify-between border-b border-[#0000001A] px-2"},il={class:"w-full flex flex-col gap-[8px] px-2 py-2 max-h-[200px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},cl={key:0,class:"flex flex-col w-full"},dl={key:0,class:"text-xs font-semibold leading-[1.2] text-[#1F2937] mb-[8px]"},pl={class:"flex flex-col gap-[6px]"},hl={class:"text-xs text-[#1F2937] font-normal leading-[1.2]"},ml={key:1,class:"flex flex-col w-full"},ul={key:0,class:"text-xs font-semibold leading-[1.2] text-[#1F2937] mb-[8px]"},fl={class:"flex flex-col gap-[6px]"},gl={class:"flex flex-row items-center justify-start"},bl={class:"text-xs text-[#1F2937] font-normal leading-[1.2]"};function yl(s,t,r,n,o,l){var c,p;const a=e.resolveComponent("legendIcon"),i=e.resolveComponent("closeIcon");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:"flex justify-center items-center rounded-md w-[32px] h-[32px] cursor-pointer bg-white p-1 border-[2px]",onClick:t[0]||(t[0]=d=>o.isOpenLegend=!o.isOpenLegend)},[e.createVNode(a)]),o.isOpenLegend?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:`#wrapper-${r.mapId}`},[e.createElementVNode("div",al,[e.createElementVNode("div",ll,[t[2]||(t[2]=e.createElementVNode("h3",{class:"text-[16px] font-normal text-black"},"Легенда",-1)),e.createElementVNode("button",{type:"button",class:"inline-flex items-center text-sm font-medium text-gray-500 rounded-lg gap-x-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 dark:hover:text-blue-500 dark:focus:text-blue-500",onClick:t[1]||(t[1]=d=>o.isOpenLegend=!1)},[e.createVNode(i,{class:"w-[20px]"})])]),e.createElementVNode("div",il,[(c=r.colors)!=null&&c.length?(e.openBlock(),e.createElementBlock("div",cl,[r.colorTitle?(e.openBlock(),e.createElementBlock("h4",dl,e.toDisplayString(r.colorTitle),1)):e.createCommentVNode("",!0),e.createElementVNode("div",pl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.colors,(d,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:"flex items-center gap-[10px]"},[d.color?(e.openBlock(),e.createElementBlock("div",{key:0,class:"w-[12px] h-[12px] rounded-full",style:e.normalizeStyle({backgroundColor:d.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("p",hl,e.toDisplayString(d.text||d.val),1)]))),128))])])):e.createCommentVNode("",!0),(p=r.sizes)!=null&&p.length?(e.openBlock(),e.createElementBlock("div",ml,[s.sizeTitle?(e.openBlock(),e.createElementBlock("h4",ul,e.toDisplayString(s.sizeTitle),1)):e.createCommentVNode("",!0),e.createElementVNode("div",fl,[l.sortedSizes.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.sortedSizes,(d,h)=>{var m,g,u,x,k;return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",gl,[e.createElementVNode("div",{class:e.normalizeClass([l.maxWidht?`w-[${l.maxWidht}]`:"","mr-[10px]"])},[e.createElementVNode("div",{class:e.normalizeClass(l.sizeClass(h)),style:e.normalizeStyle({backgroundColor:((g=(m=o.palette)==null?void 0:m[r.color])==null?void 0:g[h])||r.color})},null,6)],2),e.createElementVNode("p",bl,e.toDisplayString(h===((u=l.sortedSizes)==null?void 0:u.length)-1?">"+d:h==((x=l.sortedSizes)==null?void 0:x.length)-1?">"+l.sortedSizes[((k=l.sortedSizes)==null?void 0:k.length)-1]:d+"-"+l.sortedSizes[h+1]),1)])])}),256)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])])],8,["to"])):e.createCommentVNode("",!0)],64)}const xl=D(ol,[["render",yl]]),kl={props:["map","coordinates"],data(){return{isMenuVisible:!1}},computed:{getCoordinates(){var t;return!(this!=null&&this.coordinates)||((t=this.coordinates)==null?void 0:t.length)!==2?"":(this==null?void 0:this.coordinates).slice().reverse().map(r=>Number(r).toFixed(5)).join(", ")}}},wl={class:"map__settings"},_l={ref:"attribution",class:"map__settings-attribution map__settings-item mt-[3px]"};function $l(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",wl,[e.createElementVNode("div",_l,[e.withDirectives(e.createElementVNode("div",{ref:"mouse",class:"map__settings-item",style:{"min-width":"115px"}},e.toDisplayString(l.getCoordinates),513),[[e.vShow,l.getCoordinates]])],512)])}const Ft=D(kl,[["render",$l]]),Vl={mixins:[je],props:{map:{type:Object,default:()=>null}},data(){return{baseLayers:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png"},{id:"graymap",name:"Сіра карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",service:"TMS",image:"https://data.gki.com.ua/api-user/rtile/positron/ua/10/601/348.png"}]}},watch:{map(s){s&&s.on("load",this.handleMapLoad)}},created(){this.baseLayers.forEach(s=>{const t={...s,basemap:!0};this.layerList.push(t)})},methods:{handleMapLoad(){this.changeBaseLayer("graymap")},isLayerInFocus(s){return s.id===this.activeLayer}}},El={class:"vs-map-slot-layers"},Cl=["onClick"],Bl=["src"];function Dl(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",El,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.baseLayers,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:e.normalizeClass(["vs-map-slot-layers__layer",{focused:l.isLayerInFocus(a)}]),onClick:i=>s.changeBaseLayer(a.id)},[e.createElementVNode("img",{src:a.image,class:"vs-map-slot-layers__image"},null,8,Bl)],10,Cl))),128))])}const Pt=D(Vl,[["render",Dl]]);function Rt(s,t,r){if(s!==null)for(var n,o,l,a,i,c,p,d=0,h=0,m,g=s.type,u=g==="FeatureCollection",x=g==="Feature",k=u?s.features.length:1,f=0;f<k;f++){p=u?s.features[f].geometry:x?s.geometry:s,m=p?p.type==="GeometryCollection":!1,i=m?p.geometries.length:1;for(var y=0;y<i;y++){var b=0,_=0;if(a=m?p.geometries[y]:p,a!==null){c=a.coordinates;var $=a.type;switch(d=0,$){case null:break;case"Point":if(t(c,h,f,b,_)===!1)return!1;h++,b++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],h,f,b,_)===!1)return!1;h++,$==="MultiPoint"&&b++}$==="LineString"&&b++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(o=0;o<c[n].length-d;o++){if(t(c[n][o],h,f,b,_)===!1)return!1;h++}$==="MultiLineString"&&b++,$==="Polygon"&&_++}$==="Polygon"&&b++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(_=0,o=0;o<c[n].length;o++){for(l=0;l<c[n][o].length-d;l++){if(t(c[n][o][l],h,f,b,_)===!1)return!1;h++}_++}b++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(Rt(a.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Nl(s,t={}){if(s.bbox!=null&&t.recompute!==!0)return s.bbox;const r=[1/0,1/0,-1/0,-1/0];return Rt(s,n=>{r[0]>n[0]&&(r[0]=n[0]),r[1]>n[1]&&(r[1]=n[1]),r[2]<n[0]&&(r[2]=n[0]),r[3]<n[1]&&(r[3]=n[1])}),r}const Sl={props:["bbox","map"],components:{homeIcon:{__name:"home",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ds),e.mergeProps(t.$attrs,{size:24}),null,16))}}},methods:{setBounds(){const s={type:"Feature",geometry:this==null?void 0:this.bbox},t=Nl(s);this.map.fitBounds(t)}}},zl={class:"z-100 flex justify-center items-center rounded-md w-[32px] h-[32px] cursor-pointer bg-white p-1 border-[2px]"};function Ll(s,t,r,n,o,l){const a=e.resolveComponent("homeIcon");return e.openBlock(),e.createElementBlock("div",zl,[e.createVNode(a,{onClick:l.setBounds},null,8,["onClick"])])}const At=D(Sl,[["render",Ll]]),Tl={components:{legendIcon:We,menuIcon:{__name:"menu",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(cs),e.mergeProps(t.$attrs,{size:24}),null,16))}},closeIcon:De},props:["source","count","total","mapId"],data(){return{isOpenLegend:!1,palette:["#69D2E7","yellow","#FE4365"]}},methods:{calcSize(s){return s/this.maxValue*100*50/100}},computed:{maxValue(){var s,t,r,n,o,l;return((s=this.sizes)==null?void 0:s[0])>((r=this.sizes)==null?void 0:r[((t=this.sizes)==null?void 0:t.length)-1])?(n=this.sizes)==null?void 0:n[0]:(l=this.sizes)==null?void 0:l[((o=this.sizes)==null?void 0:o.length)-1]}}},Il={class:"w-full h-[calc(100%-40px)] bg-white"},Ml={class:"w-full flex flex-col gap-[8px] h-[250px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent text-xs"},Fl={class:"relative min-w-full bg-white text-[12px]"},Pl={class:"divide-gray-200 dark:divide-neutral-700"},Rl={class:"px-2 py-1"},Al={class:"px-2 py-1"};function Ol(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",Il,[e.createElementVNode("div",Ml,[e.createElementVNode("table",Fl,[t[0]||(t[0]=e.createElementVNode("thead",{class:"sticky top-[-1px] z-[1] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},[e.createElementVNode("tr",null,[e.createElementVNode("th",{class:"px-2 py-1 text-start"},"Назва"),e.createElementVNode("th",{class:"px-2 py-1 text-start"},"Метрика")])],-1)),e.createElementVNode("tbody",Pl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.source,a=>(e.openBlock(),e.createElementBlock("tr",{key:a.id,class:"border-b cursor-pointer hover:bg-gray-100 odd:bg-gray-50"},[e.createElementVNode("td",Rl,e.toDisplayString(a.title||"—"),1),e.createElementVNode("td",Al,e.toDisplayString(a.metric),1)]))),128))])])])])}const Ot=D(Tl,[["render",Ol]]),jl={mixins:[P,je,{components:{VsMapSetting:Ft,VsMapSlotLayers:Pt,VsMapLegend:xl,VsMapGoHome:At,VsList:Ot},data(){return{mapId:`map-${Math.floor(Math.random()*1e3)}`,layerId:`layer${Math.floor(Math.random()*1e3)}`,map:null,hoverData:null,data:null,coordinatesByMouse:[],showSetting:!1,popup:null,color:"#69D2E7"}},methods:{async createMap(){var r,n;const s=await Mt();if(!s)return;const t={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new s.Map({container:this.mapId,style:t,center:[31,48.5],zoom:((n=(r=this.data)==null?void 0:r.style)==null?void 0:n.zoom)||5,minZoom:3,maxZoom:20,attributionControl:!1}),this.map.addControl(new s.NavigationControl({visualizePitch:!0})),this.map.on("load",()=>{this.loadHandler()}),this.map.on("mousemove",o=>{this.moveMouseHadler(o)}),this.map.on("mouseout",()=>{var o;this.showLegend=!1,this.showSetting=!1,this.coordinatesByMouse=0,(o=this.popup)==null||o.remove()})},getPopoverTitle(s){var t,r,n,o,l;return(r=(t=this.data)==null?void 0:t.colors)!=null&&r.find(a=>a.val===s)?(l=(o=(n=this.data)==null?void 0:n.colors)==null?void 0:o.find(a=>a.val===s))==null?void 0:l.text:s},moveMouseHadler(s){var t;try{const r=this.map.queryRenderedFeatures(s.point),n=((t=r[0])==null?void 0:t.properties)||{};if(!r.length){this.map.getCanvas().style.cursor="",this.popupElement&&this.popupElement.remove();return}this.map.getCanvas().style.cursor="pointer",this.popupElement&&this.popupElement.remove(),this.popupElement=document.createElement("div"),this.popupElement.className="absolute text-gray-800 border border-gray-200 rounded-lg shadow-md min-w-28",this.popupElement.style.backgroundColor="rgba(255, 255, 255, 0.7)",this.popupElement.innerHTML=`<div class="font-semibold text-sm border-b border-solid border-gray-200 text-gray-800 rounded-t-lg px-2 py-1">
183
+ </div>`},onChangedData(){try{if(this.sourceData){const{series:s,xs:t,ys:r}=this.prepareData();s&&(this==null||this.initChart(s,t,r))}}catch{}},prepareData(){try{const s=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[0]]))),t=Array.from(new Set(this.sourceData.map(o=>o[this.dimensions[1]]))),r=s.map((o,l)=>({name:o,value:t[l]}));return{series:[{name:this.titleCharts?this.titleCharts:this.dimensions[0],type:"funnel",...Y(this.styleData),data:r,height:"80%",emphasis:{label:{show:!1}}}]}}catch(s){console.error(s)}},async initChart(s){try{const t=this.$refs.chart,r=Oe==null?void 0:Oe.init(t);if(!r)return;const n={series:s,...Y(this.styleData),tooltip:{trigger:"item",formatter:o=>this.buildTooltipForDonut(o,[o.color]),borderWidth:0,appendToBody:!0,borderColor:"transparent",textStyle:{color:"#000"},padding:[10,15],shadowColor:"transparent",backgroundColor:"transparent"},itemStyle:{height:"15px"},legend:{borderRadius:10,type:"scroll",itemWidth:14,itemHeight:14,...this.styleData.legend},labelLine:{show:!1},grid:{bottom:"0"}};r.setOption(n),r.resize(),window.addEventListener("resize",()=>{r.resize()})}catch(t){console.error(t)}}}},Ga=["id"];function Za(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",{ref:"chart",id:o.uniqueID,class:"h-[90%] custom-scrollbar min-h-[200px]"},null,8,Ga)}const Qa=Object.freeze(Object.defineProperty({__proto__:null,default:D(Ha,[["render",Za]])},Symbol.toStringTag,{value:"Module"}));function Xa(s){return[{type:"fill",paint:{"fill-color":s.color||"#ccc","fill-outline-color":s.color||"blue","fill-opacity":s.opacity||1}}]}function Ja(s){return[{type:"line",paint:{"line-color":s.color||"#ccc","line-opacity":s.opacity||1}}]}function Ka(s){return[{type:"circle",paint:{"circle-radius":s.radius||6,"circle-stroke-color":s.stroke||"#ccc","circle-stroke-width":s.width||1,"circle-color":s.color||"blue"}}]}function Tt(s){if(!s)return null;const t=s.type||"point";return t==="polygon"?Xa(s):t==="line"?Ja(s):Ka(s)}const je={data(){return{layerList:[],activeLayer:""}},computed:{interactiveSources(){return this.layerList.filter(s=>s==null?void 0:s.interactive).map(s=>s.id)}},methods:{moveLayer(s,t=this.map){t.getStyle().layers.forEach(r=>{r.id.match(s)&&t.moveLayer(r.id)})},async setVisible(s,t=!0,r=this.map){if(!s)return;const n=(s==null?void 0:s.id)||s,o=this.layerList.find(a=>a.id===s)||s;if(!(o!=null&&o.id))throw new Error("MixinError: Layer has no id");const l=r.getStyle().layers.filter(a=>a.id.match(n));l.forEach(a=>{r.setLayoutProperty(a.id,"visibility",t?"visible":"none")}),!l.length&&t&&await this.addLayer(o)},async addLayer(s,t=this==null?void 0:this.map){var o,l;const r=this.layerList.find(a=>a.id===s)||s;!this.map.getStyle()||this.map.getStyle().layers.find(a=>a.id===r.id)||(this.layerList.find(a=>a.id===r.id)||this.layerList.push(r),(r.service==="vtile"||r.service==="vector"||(o=r.url)!=null&&o.includes(".vmt"))&&this.addVtileLayer(r,t),r.service==="geojson"&&this.addGeoJsonLayer(r,t),((l=r.url)!=null&&l.includes(".png")||["tms","raster"].includes(r.service))&&await this.addRasterLayer(r,t))},async addRasterLayer(s,t=this==null?void 0:this.map){var r,n;t.getSource(s.id)||(await t.addSource(s.id,{type:"raster",tiles:[s==null?void 0:s.url],tileSize:256,...s!=null&&s.scheme?{scheme:s==null?void 0:s.scheme}:{}}),await t.addLayer({id:s.id,type:"raster",source:s.id,minzoom:0,maxzoom:(s==null?void 0:s.maxzoom)||22},s.basemap?(n=(r=this.map.getStyle().layers)==null?void 0:r[0])==null?void 0:n.id:null))},async addVtileLayer(s,t=this==null?void 0:this.map){var l;const r=["props","pointZoom"].filter(a=>s[a]).map(a=>`&${a}=${s[a]}`),n={type:"vector",tiles:[`${(l=s==null?void 0:s.url)!=null&&l.startsWith("http")?"":window.location.origin}${s==null?void 0:s.url}${r}`],minzoom:s.minzoom||3,maxzoom:s.maxzoom||24};t.addSource(s.id,n),(Tt(s.style)||s.layers||[]).forEach((a,i)=>{const c={...a,id:`${s.id}-${i}`,source:s.id,"source-layer":a["source-layer"]||s.source||s.id,maxzoom:+a.maxzoom||24,minzoom:+a.minzoom||0};t.addLayer(c)})},async addGeoJsonLayer(s,t=this.map){var o;const r=s.data||((o=s==null?void 0:s.url)!=null&&o.startsWith("http")?"":window.location.origin)+s.url;t.addSource(s.id,{type:"geojson",data:r}),(Tt(s.style)||s.layers||[]).forEach(l=>{const a={...l,source:s.id,id:l.id||s.id,maxzoom:+l.maxzoom||24,minzoom:+l.minzoom||0,type:l.type||"circle"};t.addLayer(a)})},setLayerData(s,t){this.layerList=this.layerList.map(r=>r.id===s?{...r,...t}:r)},async removeLayer(s,t=this.map){t.getSource(s)&&(await t.getStyle().layers.forEach(async r=>{r.source===s&&await t.removeLayer(r.id)}),await t.removeSource(s))},async setFilter(s,t){var o;const r=this.layerList.find(l=>l.id===s),n=await((o=this.map)==null?void 0:o.getSource(s));if(n&&r.service==="vtile"){await n.setTiles([`${window.location.origin}${r.url}${r.url.includes("?")?"&":"?"}filter=${t}${r.props?`&props=${r.props}`:""}`]);return}n&&r.service},async changeBaseLayer(s){const t=s!=null&&s.id?s:this.layerList.find(n=>n.id===s),{id:r}=t;if(r&&r!==this.activeLayer){if(this.activeLayer&&this.map.setLayoutProperty(this.activeLayer,"visibility","none"),this.activeLayer=r,this.map.getLayer(r)){this.map.setLayoutProperty(r,"visibility","visible");return}await this.addRasterLayer(t)}},async refreshLayer(s,t=this.map){await t.getStyle().layers.forEach(r=>{r.source===s&&t.removeLayer(r.id)}),await t.removeSource(s),this.setVisible(s)}}},Ya="https://unpkg.com/maplibre-gl@5.6.2/dist/maplibre-gl.js",el="https://unpkg.com/maplibre-gl@5.6.2/dist/maplibre-gl.css";let Ee=null;function tl(s){return new Promise((t,r)=>{if(document.querySelector(`script[src="${s}"]`)){t();return}const n=document.createElement("script");n.src=s,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${s}`)),document.head.appendChild(n)})}function sl(s){return new Promise((t,r)=>{if(document.querySelector(`link[href="${s}"]`)){t();return}const n=document.createElement("link");n.rel="stylesheet",n.href=s,n.onload=()=>t(),n.onerror=()=>r(new Error(`Failed to load ${s}`)),document.head.appendChild(n)})}function It(){return typeof window>"u"?Promise.resolve(null):window.maplibregl?Promise.resolve(window.maplibregl):Ee||(Ee=sl(el).then(()=>tl(Ya)).then(()=>window.maplibregl),Ee)}const We={__name:"legend",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ms),e.mergeProps(t.$attrs,{size:24}),null,16))}},qe={pink:["#fde7e2","#feafbe","#fd58a4","#d7038e","#86007b"],blue:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],green:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],pink2:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],red:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],teal:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"]},rl={components:{legendIcon:We,closeIcon:De},props:{mapId:{type:String},colors:{type:Array},sizes:{type:Array,default:()=>[]},cluster:{type:[Boolean,String]},color:{type:String,default:"gray"},colorTitle:{type:String},sizesTitle:{type:String},resizeItem:{type:[Boolean,String],default:!1},changeOpacityItem:{type:[Boolean,String],default:!1}},data(){return{isOpenLegend:!1,palette:qe}},computed:{borderRadius(){return this.cluster?"rounded-sm":"rounded-full"},sortedSizes(){return[...this.sizes].sort((s,t)=>s-t)},maxWidht(){var r;const s=((r=this.sizes)==null?void 0:r.length)-1;return this.calcSize(s)}},methods:{sizeClass(s){return this.resizeItem?`h-[${this.calcSize(s)}] w-[${this.calcSize(s)}] ${this.borderRadius}`:`h-[18px] w-[18px] ${this.borderRadius}`},calcSize(s){return`${10+s*2}px`},getOpacity(s){return(s+1)/this.sortedSizes.length}}},nl={class:"w-full absolute max-w-[200px] bg-white border rounded-lg bottom-[10px] right-[50px]"},ol={class:"flex items-center justify-between border-b border-[#0000001A] px-2"},al={class:"w-full flex flex-col gap-[8px] px-2 py-2 max-h-[200px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent"},ll={key:0,class:"flex flex-col w-full"},il={key:0,class:"text-xs font-semibold leading-[1.2] text-[#1F2937] mb-[8px]"},cl={class:"flex flex-col gap-[6px]"},dl={class:"text-xs text-[#1F2937] font-normal leading-[1.2]"},pl={key:1,class:"flex flex-col w-full"},hl={key:0,class:"text-xs font-semibold leading-[1.2] text-[#1F2937] mb-[8px]"},ml={class:"flex flex-col gap-[6px]"},ul={class:"flex flex-row items-center justify-start"},fl={class:"text-xs text-[#1F2937] font-normal leading-[1.2]"};function gl(s,t,r,n,o,l){var c,p;const a=e.resolveComponent("legendIcon"),i=e.resolveComponent("closeIcon");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:"flex justify-center items-center rounded-md w-[32px] h-[32px] cursor-pointer bg-white p-1 border-[2px]",onClick:t[0]||(t[0]=d=>o.isOpenLegend=!o.isOpenLegend)},[e.createVNode(a)]),o.isOpenLegend?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:`#wrapper-${r.mapId}`},[e.createElementVNode("div",nl,[e.createElementVNode("div",ol,[t[2]||(t[2]=e.createElementVNode("h3",{class:"text-[16px] font-normal text-black"},"Легенда",-1)),e.createElementVNode("button",{type:"button",class:"inline-flex items-center text-sm font-medium text-gray-500 rounded-lg gap-x-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 dark:hover:text-blue-500 dark:focus:text-blue-500",onClick:t[1]||(t[1]=d=>o.isOpenLegend=!1)},[e.createVNode(i,{class:"w-[20px]"})])]),e.createElementVNode("div",al,[(c=r.colors)!=null&&c.length?(e.openBlock(),e.createElementBlock("div",ll,[r.colorTitle?(e.openBlock(),e.createElementBlock("h4",il,e.toDisplayString(r.colorTitle),1)):e.createCommentVNode("",!0),e.createElementVNode("div",cl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.colors,(d,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:"flex items-center gap-[10px]"},[d.color?(e.openBlock(),e.createElementBlock("div",{key:0,class:"w-[12px] h-[12px] rounded-full",style:e.normalizeStyle({backgroundColor:d.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("p",dl,e.toDisplayString(d.text||d.val),1)]))),128))])])):e.createCommentVNode("",!0),(p=r.sizes)!=null&&p.length?(e.openBlock(),e.createElementBlock("div",pl,[s.sizeTitle?(e.openBlock(),e.createElementBlock("h4",hl,e.toDisplayString(s.sizeTitle),1)):e.createCommentVNode("",!0),e.createElementVNode("div",ml,[l.sortedSizes.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.sortedSizes,(d,h)=>{var g,f,m,x,k;return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ul,[e.createElementVNode("div",{class:e.normalizeClass([l.maxWidht?`w-[${l.maxWidht}]`:"","mr-[10px]"])},[e.createElementVNode("div",{class:e.normalizeClass(l.sizeClass(h)),style:e.normalizeStyle({backgroundColor:((f=(g=o.palette)==null?void 0:g[r.color])==null?void 0:f[h])||r.color})},null,6)],2),e.createElementVNode("p",fl,e.toDisplayString(h===((m=l.sortedSizes)==null?void 0:m.length)-1?">"+d:h==((x=l.sortedSizes)==null?void 0:x.length)-1?">"+l.sortedSizes[((k=l.sortedSizes)==null?void 0:k.length)-1]:d+"-"+l.sortedSizes[h+1]),1)])])}),256)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])])],8,["to"])):e.createCommentVNode("",!0)],64)}const bl=D(rl,[["render",gl]]),yl={props:["map","coordinates"],data(){return{isMenuVisible:!1}},computed:{getCoordinates(){var t;return!(this!=null&&this.coordinates)||((t=this.coordinates)==null?void 0:t.length)!==2?"":(this==null?void 0:this.coordinates).slice().reverse().map(r=>Number(r).toFixed(5)).join(", ")}}},xl={class:"map__settings"},kl={ref:"attribution",class:"map__settings-attribution map__settings-item mt-[3px]"};function wl(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",xl,[e.createElementVNode("div",kl,[e.withDirectives(e.createElementVNode("div",{ref:"mouse",class:"map__settings-item",style:{"min-width":"115px"}},e.toDisplayString(l.getCoordinates),513),[[e.vShow,l.getCoordinates]])],512)])}const Mt=D(yl,[["render",wl]]),_l={mixins:[je],props:{map:{type:Object,default:()=>null}},data(){return{baseLayers:[{id:"orto10",name:"Ortophoto 1:10К",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",service:"TMS",image:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4954/2876.png"},{id:"graymap",name:"Сіра карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",service:"TMS",image:"https://data.gki.com.ua/api-user/rtile/positron/ua/10/601/348.png"}]}},watch:{map(s){s&&s.on("load",this.handleMapLoad)}},created(){this.baseLayers.forEach(s=>{const t={...s,basemap:!0};this.layerList.push(t)})},methods:{handleMapLoad(){this.changeBaseLayer("graymap")},isLayerInFocus(s){return s.id===this.activeLayer}}},$l={class:"vs-map-slot-layers"},Vl=["onClick"],El=["src"];function Bl(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",$l,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.baseLayers,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:e.normalizeClass(["vs-map-slot-layers__layer",{focused:l.isLayerInFocus(a)}]),onClick:i=>s.changeBaseLayer(a.id)},[e.createElementVNode("img",{src:a.image,class:"vs-map-slot-layers__image"},null,8,El)],10,Vl))),128))])}const Pt=D(_l,[["render",Bl]]);function Rt(s,t,r){if(s!==null)for(var n,o,l,a,i,c,p,d=0,h=0,g,f=s.type,m=f==="FeatureCollection",x=f==="Feature",k=m?s.features.length:1,u=0;u<k;u++){p=m?s.features[u].geometry:x?s.geometry:s,g=p?p.type==="GeometryCollection":!1,i=g?p.geometries.length:1;for(var y=0;y<i;y++){var b=0,_=0;if(a=g?p.geometries[y]:p,a!==null){c=a.coordinates;var $=a.type;switch(d=0,$){case null:break;case"Point":if(t(c,h,u,b,_)===!1)return!1;h++,b++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],h,u,b,_)===!1)return!1;h++,$==="MultiPoint"&&b++}$==="LineString"&&b++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(o=0;o<c[n].length-d;o++){if(t(c[n][o],h,u,b,_)===!1)return!1;h++}$==="MultiLineString"&&b++,$==="Polygon"&&_++}$==="Polygon"&&b++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(_=0,o=0;o<c[n].length;o++){for(l=0;l<c[n][o].length-d;l++){if(t(c[n][o][l],h,u,b,_)===!1)return!1;h++}_++}b++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(Rt(a.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Cl(s,t={}){if(s.bbox!=null&&t.recompute!==!0)return s.bbox;const r=[1/0,1/0,-1/0,-1/0];return Rt(s,n=>{r[0]>n[0]&&(r[0]=n[0]),r[1]>n[1]&&(r[1]=n[1]),r[2]<n[0]&&(r[2]=n[0]),r[3]<n[1]&&(r[3]=n[1])}),r}const Dl={props:["bbox","map"],components:{homeIcon:{__name:"home",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(ds),e.mergeProps(t.$attrs,{size:24}),null,16))}}},methods:{setBounds(){const s={type:"Feature",geometry:this==null?void 0:this.bbox},t=Cl(s);this.map.fitBounds(t)}}},Nl={class:"z-100 flex justify-center items-center rounded-md w-[32px] h-[32px] cursor-pointer bg-white p-1 border-[2px]"};function Sl(s,t,r,n,o,l){const a=e.resolveComponent("homeIcon");return e.openBlock(),e.createElementBlock("div",Nl,[e.createVNode(a,{onClick:l.setBounds},null,8,["onClick"])])}const Ft=D(Dl,[["render",Sl]]),zl={components:{legendIcon:We,menuIcon:{__name:"menu",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(cs),e.mergeProps(t.$attrs,{size:24}),null,16))}},closeIcon:De},props:["source","count","total","mapId"],data(){return{isOpenLegend:!1,palette:["#69D2E7","yellow","#FE4365"]}},methods:{calcSize(s){return s/this.maxValue*100*50/100}},computed:{maxValue(){var s,t,r,n,o,l;return((s=this.sizes)==null?void 0:s[0])>((r=this.sizes)==null?void 0:r[((t=this.sizes)==null?void 0:t.length)-1])?(n=this.sizes)==null?void 0:n[0]:(l=this.sizes)==null?void 0:l[((o=this.sizes)==null?void 0:o.length)-1]}}},Ll={class:"w-full h-[calc(100%-40px)] bg-white"},Tl={class:"w-full flex flex-col gap-[8px] h-[250px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent text-xs"},Il={class:"relative min-w-full bg-white text-[12px]"},Ml={class:"divide-gray-200 dark:divide-neutral-700"},Pl={class:"px-2 py-1"},Rl={class:"px-2 py-1"};function Fl(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",Ll,[e.createElementVNode("div",Tl,[e.createElementVNode("table",Il,[t[0]||(t[0]=e.createElementVNode("thead",{class:"sticky top-[-1px] z-[1] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},[e.createElementVNode("tr",null,[e.createElementVNode("th",{class:"px-2 py-1 text-start"},"Назва"),e.createElementVNode("th",{class:"px-2 py-1 text-start"},"Метрика")])],-1)),e.createElementVNode("tbody",Ml,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.source,a=>(e.openBlock(),e.createElementBlock("tr",{key:a.id,class:"border-b cursor-pointer hover:bg-gray-100 odd:bg-gray-50"},[e.createElementVNode("td",Pl,e.toDisplayString(a.title||"—"),1),e.createElementVNode("td",Rl,e.toDisplayString(a.metric),1)]))),128))])])])])}const At=D(zl,[["render",Fl]]),Al={mixins:[R,je,{components:{VsMapSetting:Mt,VsMapSlotLayers:Pt,VsMapLegend:bl,VsMapGoHome:Ft,VsList:At},data(){return{mapId:`map-${Math.floor(Math.random()*1e3)}`,layerId:`layer${Math.floor(Math.random()*1e3)}`,map:null,hoverData:null,data:null,coordinatesByMouse:[],showSetting:!1,popup:null,color:"#69D2E7"}},methods:{async createMap(){var r,n;const s=await It();if(!s)return;const t={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new s.Map({container:this.mapId,style:t,center:[31,48.5],zoom:((n=(r=this.data)==null?void 0:r.style)==null?void 0:n.zoom)||5,minZoom:3,maxZoom:20,attributionControl:!1}),this.map.addControl(new s.NavigationControl({visualizePitch:!0})),this.map.on("load",()=>{this.loadHandler()}),this.map.on("mousemove",o=>{this.moveMouseHadler(o)}),this.map.on("mouseout",()=>{var o;this.showLegend=!1,this.showSetting=!1,this.coordinatesByMouse=0,(o=this.popup)==null||o.remove()})},getPopoverTitle(s){var t,r,n,o,l;return(r=(t=this.data)==null?void 0:t.colors)!=null&&r.find(a=>a.val===s)?(l=(o=(n=this.data)==null?void 0:n.colors)==null?void 0:o.find(a=>a.val===s))==null?void 0:l.text:s},moveMouseHadler(s){var t;try{const r=this.map.queryRenderedFeatures(s.point),n=((t=r[0])==null?void 0:t.properties)||{};if(!r.length){this.map.getCanvas().style.cursor="",this.popupElement&&this.popupElement.remove();return}this.map.getCanvas().style.cursor="pointer",this.popupElement&&this.popupElement.remove(),this.popupElement=document.createElement("div"),this.popupElement.className="absolute text-gray-800 border border-gray-200 rounded-lg shadow-md min-w-28",this.popupElement.style.backgroundColor="rgba(255, 255, 255, 0.7)",this.popupElement.innerHTML=`<div class="font-semibold text-sm border-b border-solid border-gray-200 text-gray-800 rounded-t-lg px-2 py-1">
184
184
  ${this.getPopoverTitle((n==null?void 0:n.x)||(n==null?void 0:n.title)||(n==null?void 0:n.name))||""}
185
185
  </div>
186
186
 
@@ -189,7 +189,7 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
189
189
  <span class="font-medium mr-[6px]">Значення</span>
190
190
  </span>
191
191
  <span>${(n==null?void 0:n.metric)||0}</span>
192
- </div>`;const o=this.map.project(s.lngLat);this.popupElement.style.left=`${o.x}px`,this.popupElement.style.top=`${o.y-60}px`,this.map.getContainer().appendChild(this.popupElement)}catch(r){console.error(r)}}}}],name:"VsMap",async mounted(){await this.getMapData(),await this.createMap()},methods:{async getMapData(){const t=await(await fetch(`/api/bi-map?widget=${this.widget}&dashboard=${this.dashboard}`)).json();this.data=t,this.$emit("update:widgetData",t),setTimeout(()=>{var r;return(r=this.map)==null?void 0:r.resize()})},async loadHandler(){const s=["#69D2E7","yellow","#FE4365"],t=this.data.colors?["match",["get","x"]].concat(this.data.colors.reduce((l,a,i)=>l.concat(a.val,(a==null?void 0:a.color)||s[i]),[])).concat(["gray"]):"blue",r=[5,7,9,11,13],n=this.data.sizes?["case"]:5;this.data.sizes&&(this.data.sizes.reverse().forEach((l,a)=>{n.push([">",["get","metric"],l]),n.push(r[a])}),n.push(5));const o={type:"circle",color:t,width:2,radius:n,stroke:"#eee"};Object.assign(o,this.data.style||{}),this.addVtileLayer({id:"bi",url:`${window.top.location.origin}/api/bi-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,style:o})}}},Wl={class:"w-full h-full"},ql={class:"flex items-start justify-between mb-[6px] w-full"},Ul={class:"text-gray-800 font-[600]"},vl=["id"],Hl=["id"],Gl={class:"absolute flex flex-col right-[10px] top-[105px] gap-1"};function Zl(s,t,r,n,o,l){var d,h,m;const a=e.resolveComponent("VsMapSetting"),i=e.resolveComponent("VsMapSlotLayers"),c=e.resolveComponent("VsMapLegend"),p=e.resolveComponent("VsMapGoHome");return e.openBlock(),e.createElementBlock("div",Wl,[e.createElementVNode("div",ql,[e.createElementVNode("h5",Ul,e.toDisplayString(s.title),1)]),e.createElementVNode("div",{class:"relative w-full h-[calc(100%-40px)]",id:`wrapper-${s.mapId}`},[e.createElementVNode("div",{id:s.mapId,class:"w-full flex items-end relative h-full min-h-[250px]"},null,8,Hl),s.showSetting?(e.openBlock(),e.createBlock(a,{key:0,map:s.map,coordinates:s.coordinatesByMouse},null,8,["map","coordinates"])):e.createCommentVNode("",!0),e.createVNode(i,{map:s.map},null,8,["map"]),e.createElementVNode("div",Gl,[e.createVNode(c,{mapId:s.mapId,colors:(d=s.data)==null?void 0:d.colors,sizes:(h=s.data)==null?void 0:h.sizes,color:s.color,resizeItem:"true"},null,8,["mapId","colors","sizes","color"]),e.createVNode(p,{map:s.map,bbox:(m=s.data)==null?void 0:m.bounds},null,8,["map","bbox"])])],8,vl)])}const Ql=Object.freeze(Object.defineProperty({__proto__:null,default:D(jl,[["render",Zl]])},Symbol.toStringTag,{value:"Module"})),Xl={components:{legendIcon:We,closeIcon:De},props:{mapId:{type:String},colors:{type:Array},sizes:{type:Array,default:()=>[]},cluster:{type:[Boolean,String]},color:{type:String,default:"gray"},colorTitle:{type:String},sizesTitle:{type:String},resizeItem:{type:[Boolean,String],default:!1},changeOpacityItem:{type:[Boolean,String],default:!1}},data(){return{isOpenLegend:!1,palette:qe}},computed:{borderRadius(){return this.cluster?"rounded-sm":"rounded-full"},sortedSizes(){return[...this.sizes].sort((s,t)=>s-t)},maxWidht(){var r;const s=((r=this.sizes)==null?void 0:r.length)-1;return this.calcSize(s)}},methods:{sizeClass(s){return this.resizeItem?`h-[${this.calcSize(s)}] w-[${this.calcSize(s)}] ${this.borderRadius}`:`h-[10px] ${this.borderRadius}`},calcSize(s){return`${10+s*2}px`},getOpacity(s){return(s+1)/this.sortedSizes.length}}},Kl={key:0,class:"absolute flex items-end w-fit bottom-[10px] max-w-[80%] left-[50%] translate-x-[-50%] bg-[rgba(255,255,255,0.7)] p-[10px] rounded"},Jl={class:"w-[80px] mr-[10px]"},Yl=["title"],ei={class:"text-[10px] mb-[2px] text-[#1F2937] font-normal leading-[1.2]"};function ti(s,t,r,n,o,l){var a;return(a=r.sizes)!=null&&a.length?(e.openBlock(),e.createElementBlock("div",Kl,[e.createElementVNode("div",Jl,[t[0]||(t[0]=e.createElementVNode("p",{class:"text-[10px] mb-[2px] text-[#1F2937] leading-[1.2]"}," Дані відсутні ",-1)),e.createElementVNode("div",{class:e.normalizeClass([l.sizeClass(s.index),"w-full border border-gray-500"])},null,2)]),l.sortedSizes.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.sortedSizes,(i,c)=>{var p,d,h,m,g,u,x,k;return e.openBlock(),e.createElementBlock("div",{class:"w-[80px]",title:c===((p=l.sortedSizes)==null?void 0:p.length)-1?">"+i:c==((d=l.sortedSizes)==null?void 0:d.length)-1?">"+l.sortedSizes[((h=l.sortedSizes)==null?void 0:h.length)-1]:i+"-"+l.sortedSizes[c+1]},[e.createElementVNode("p",ei,e.toDisplayString(c===((m=l.sortedSizes)==null?void 0:m.length)-1?">"+parseInt(i):c==((g=l.sortedSizes)==null?void 0:g.length)-1?">"+parseInt(l.sortedSizes[((u=l.sortedSizes)==null?void 0:u.length)-1]):parseInt(i)+"-"+parseInt(l.sortedSizes[c+1])),1),e.createElementVNode("div",{class:e.normalizeClass([l.sizeClass(c),"w-full border border-r-0 border-gray-500"]),style:e.normalizeStyle({backgroundColor:((k=(x=o.palette)==null?void 0:x[r.color])==null?void 0:k[c])||r.color})},null,6)],8,Yl)}),256)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}const si=D(Xl,[["render",ti]]),ri={__name:"icon-map",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(us),e.mergeProps(t.$attrs,{size:24}),null,16))}},ni={mixins:[P,je],components:{VsMapSetting:Ft,VsClusterLegend:si,VsMapGoHome:At,VsList:Ot,VsMapSlotLayers:Pt,VsBar:Pe},data(){return{baseColor:"pink",kattotg:"",options:[{id:"map",text:"Карта",component:ri},{id:"table",text:"Таблиця",component:wt},{id:"chart",text:"Віджет",component:kt}],activeTab:"map",mapId:`map-${Math.floor(Math.random()*1e3)}`,layerId:`layer${Math.floor(Math.random()*1e3)}`,map:null,hoverData:null,data:null,coordinatesByMouse:[],showSetting:!1,popup:null,color:"#69D2E7",label:"<div><icon-map/></div>"}},async mounted(){await this.getMapData(),await this.createMap()},watch:{kattotg(){this.loadHandler()}},methods:{async getMapData(){const s=await T.get(`/bi-cluster?widget=${this.widget}&dashboard=${this.dashboard}`);this.data=s,this.$emit("update:widgetData",this.data),setTimeout(()=>{var t;return(t=this.map)==null?void 0:t.resize()})},async loadHandler(){var n,o,l,a;this.baseColor=((n=this.data.style)==null?void 0:n.color)||"blue";const s=["case"];(a=(l=(o=this.data)==null?void 0:o.sizes)==null?void 0:l.toReversed())==null||a.forEach((i,c)=>{var p,d;s.push([">",["get","metric"],i]),s.push((d=(p=qe[this.baseColor])==null?void 0:p.toReversed())==null?void 0:d[c]),c++}),s.push("gray");const t={type:"polygon",color:s,opacity:.4};Object.assign(t,this.data.style||{}),this.map.getSource("bi")||this.addVtileLayer({id:"bi",url:`${window.location.origin}/api/bi-cluster-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,style:t}),this.map.getLayer("highlighted")&&this.map.removeLayer("highlighted"),this.map.getSource("highlighted")&&this.map.removeSource("highlighted");const r=["case"];this.kattotg&&r.push(["==",["to-string",["get","name"]],String(this.kattotg)],"red"),r.push("transparent"),this.map.addLayer({id:"highlighted",type:"fill",source:"bi","source-layer":"bi",paint:{"fill-color":r,"fill-opacity":.6}})},async createMap(){var r,n;const s=await Mt();if(!s)return;const t={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new s.Map({container:this.mapId,style:t,center:[31,48.5],zoom:((n=(r=this.data)==null?void 0:r.style)==null?void 0:n.zoom)||5,minZoom:3,maxZoom:20,attributionControl:!1}),this.map.addControl(new s.NavigationControl({visualizePitch:!0})),this.map.on("load",()=>{this.loadHandler()}),this.map.on("mousemove",o=>{this.moveMouseHadler(o)}),this.map.on("mouseout",()=>{var o;this.showLegend=!1,this.showSetting=!1,this.coordinatesByMouse=0,(o=this.popup)==null||o.remove()})},moveMouseHadler(s){var t;try{const r=this.map.queryRenderedFeatures(s.point),n=((t=r[0])==null?void 0:t.properties)||{};if(!r.length){this.map.getCanvas().style.cursor="",this.popupElement&&this.popupElement.remove();return}this.map.getCanvas().style.cursor="pointer",this.popupElement&&this.popupElement.remove(),this.popupElement=document.createElement("div"),this.popupElement.className="absolute text-gray-800 border border-gray-200 rounded-lg shadow-md min-w-28",this.popupElement.style.backgroundColor="rgba(255, 255, 255, 0.7)",this.popupElement.innerHTML=`<div class="px-2 py-1 text-sm font-semibold text-gray-800 border-b border-gray-200 border-solid rounded-t-lg">
192
+ </div>`;const o=this.map.project(s.lngLat);this.popupElement.style.left=`${o.x}px`,this.popupElement.style.top=`${o.y-60}px`,this.map.getContainer().appendChild(this.popupElement)}catch(r){console.error(r)}}}}],name:"VsMap",async mounted(){await this.getMapData(),await this.createMap()},methods:{async getMapData(){const t=await(await fetch(`/api/bi-map?widget=${this.widget}&dashboard=${this.dashboard}`)).json();this.data=t,this.$emit("update:widgetData",t),setTimeout(()=>{var r;return(r=this.map)==null?void 0:r.resize()})},async loadHandler(){const s=["#69D2E7","yellow","#FE4365"],t=this.data.colors?["match",["get","x"]].concat(this.data.colors.reduce((l,a,i)=>l.concat(a.val,(a==null?void 0:a.color)||s[i]),[])).concat(["gray"]):"blue",r=[5,7,9,11,13],n=this.data.sizes?["case"]:5;this.data.sizes&&(this.data.sizes.reverse().forEach((l,a)=>{n.push([">",["get","metric"],l]),n.push(r[a])}),n.push(5));const o={type:"circle",color:t,width:2,radius:n,stroke:"#eee"};Object.assign(o,this.data.style||{}),this.addVtileLayer({id:"bi",url:`${window.top.location.origin}/api/bi-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,style:o})}}},Ol={class:"w-full h-full"},jl={class:"flex items-start justify-between mb-[6px] w-full"},Wl={class:"text-gray-800 font-[600]"},ql=["id"],Ul=["id"],vl={class:"absolute flex flex-col right-[10px] top-[105px] gap-1"};function Hl(s,t,r,n,o,l){var d,h,g;const a=e.resolveComponent("VsMapSetting"),i=e.resolveComponent("VsMapSlotLayers"),c=e.resolveComponent("VsMapLegend"),p=e.resolveComponent("VsMapGoHome");return e.openBlock(),e.createElementBlock("div",Ol,[e.createElementVNode("div",jl,[e.createElementVNode("h5",Wl,e.toDisplayString(s.title),1)]),e.createElementVNode("div",{class:"relative w-full h-[calc(100%-40px)]",id:`wrapper-${s.mapId}`},[e.createElementVNode("div",{id:s.mapId,class:"w-full flex items-end relative h-full min-h-[250px]"},null,8,Ul),s.showSetting?(e.openBlock(),e.createBlock(a,{key:0,map:s.map,coordinates:s.coordinatesByMouse},null,8,["map","coordinates"])):e.createCommentVNode("",!0),e.createVNode(i,{map:s.map},null,8,["map"]),e.createElementVNode("div",vl,[e.createVNode(c,{mapId:s.mapId,colors:(d=s.data)==null?void 0:d.colors,sizes:(h=s.data)==null?void 0:h.sizes,color:s.color,resizeItem:"true"},null,8,["mapId","colors","sizes","color"]),e.createVNode(p,{map:s.map,bbox:(g=s.data)==null?void 0:g.bounds},null,8,["map","bbox"])])],8,ql)])}const Gl=Object.freeze(Object.defineProperty({__proto__:null,default:D(Al,[["render",Hl]])},Symbol.toStringTag,{value:"Module"})),Zl={components:{legendIcon:We,closeIcon:De},props:{mapId:{type:String},colors:{type:Array},sizes:{type:Array,default:()=>[]},cluster:{type:[Boolean,String]},color:{type:String,default:"gray"},colorTitle:{type:String},sizesTitle:{type:String},resizeItem:{type:[Boolean,String],default:!1},changeOpacityItem:{type:[Boolean,String],default:!1}},data(){return{isOpenLegend:!1,palette:qe}},computed:{borderRadius(){return this.cluster?"rounded-sm":"rounded-full"},sortedSizes(){return[...this.sizes].sort((s,t)=>s-t)},maxWidht(){var r;const s=((r=this.sizes)==null?void 0:r.length)-1;return this.calcSize(s)}},methods:{sizeClass(s){return this.resizeItem?`h-[${this.calcSize(s)}] w-[${this.calcSize(s)}] ${this.borderRadius}`:`h-[10px] ${this.borderRadius}`},calcSize(s){return`${10+s*2}px`},getOpacity(s){return(s+1)/this.sortedSizes.length}}},Ql={key:0,class:"absolute flex items-end w-fit bottom-[10px] max-w-[80%] left-[50%] translate-x-[-50%] bg-[rgba(255,255,255,0.7)] p-[10px] rounded"},Xl={class:"w-[80px] mr-[10px]"},Jl=["title"],Kl={class:"text-[10px] mb-[2px] text-[#1F2937] font-normal leading-[1.2]"};function Yl(s,t,r,n,o,l){var a;return(a=r.sizes)!=null&&a.length?(e.openBlock(),e.createElementBlock("div",Ql,[e.createElementVNode("div",Xl,[t[0]||(t[0]=e.createElementVNode("p",{class:"text-[10px] mb-[2px] text-[#1F2937] leading-[1.2]"}," Дані відсутні ",-1)),e.createElementVNode("div",{class:e.normalizeClass([l.sizeClass(s.index),"w-full border border-gray-500"])},null,2)]),l.sortedSizes.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.sortedSizes,(i,c)=>{var p,d,h,g,f,m,x,k;return e.openBlock(),e.createElementBlock("div",{class:"w-[80px]",title:c===((p=l.sortedSizes)==null?void 0:p.length)-1?">"+i:c==((d=l.sortedSizes)==null?void 0:d.length)-1?">"+l.sortedSizes[((h=l.sortedSizes)==null?void 0:h.length)-1]:i+"-"+l.sortedSizes[c+1]},[e.createElementVNode("p",Kl,e.toDisplayString(c===((g=l.sortedSizes)==null?void 0:g.length)-1?">"+parseInt(i):c==((f=l.sortedSizes)==null?void 0:f.length)-1?">"+parseInt(l.sortedSizes[((m=l.sortedSizes)==null?void 0:m.length)-1]):parseInt(i)+"-"+parseInt(l.sortedSizes[c+1])),1),e.createElementVNode("div",{class:e.normalizeClass([l.sizeClass(c),"w-full border border-r-0 border-gray-500"]),style:e.normalizeStyle({backgroundColor:((k=(x=o.palette)==null?void 0:x[r.color])==null?void 0:k[c])||r.color})},null,6)],8,Jl)}),256)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}const ei=D(Zl,[["render",Yl]]),ti={__name:"icon-map",setup(s){return(t,r)=>(e.openBlock(),e.createBlock(e.unref(us),e.mergeProps(t.$attrs,{size:24}),null,16))}},si={mixins:[R,je],components:{VsMapSetting:Mt,VsClusterLegend:ei,VsMapGoHome:Ft,VsList:At,VsMapSlotLayers:Pt,VsBar:Re},data(){return{baseColor:"pink",kattotg:"",options:[{id:"map",text:"Карта",component:ti},{id:"table",text:"Таблиця",component:kt},{id:"chart",text:"Віджет",component:xt}],activeTab:"map",mapId:`map-${Math.floor(Math.random()*1e3)}`,layerId:`layer${Math.floor(Math.random()*1e3)}`,map:null,hoverData:null,data:null,coordinatesByMouse:[],showSetting:!1,popup:null,color:"#69D2E7",label:"<div><icon-map/></div>"}},async mounted(){await this.getMapData(),await this.createMap()},watch:{kattotg(){this.loadHandler()}},methods:{async getMapData(){const s=await T.get(`/bi-cluster?widget=${this.widget}&dashboard=${this.dashboard}`);this.data=s,this.$emit("update:widgetData",this.data),setTimeout(()=>{var t;return(t=this.map)==null?void 0:t.resize()})},async loadHandler(){var n,o,l,a;this.baseColor=((n=this.data.style)==null?void 0:n.color)||"blue";const s=["case"];(a=(l=(o=this.data)==null?void 0:o.sizes)==null?void 0:l.toReversed())==null||a.forEach((i,c)=>{var p,d;s.push([">",["get","metric"],i]),s.push((d=(p=qe[this.baseColor])==null?void 0:p.toReversed())==null?void 0:d[c]),c++}),s.push("gray");const t={type:"polygon",color:s,opacity:.4};Object.assign(t,this.data.style||{}),this.map.getSource("bi")||this.addVtileLayer({id:"bi",url:`${window.location.origin}/api/bi-cluster-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,style:t}),this.map.getLayer("highlighted")&&this.map.removeLayer("highlighted"),this.map.getSource("highlighted")&&this.map.removeSource("highlighted");const r=["case"];this.kattotg&&r.push(["==",["to-string",["get","name"]],String(this.kattotg)],"red"),r.push("transparent"),this.map.addLayer({id:"highlighted",type:"fill",source:"bi","source-layer":"bi",paint:{"fill-color":r,"fill-opacity":.6}})},async createMap(){var r,n;const s=await It();if(!s)return;const t={version:8,glyphs:"https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",sources:{},layers:[]};this.map=await new s.Map({container:this.mapId,style:t,center:[31,48.5],zoom:((n=(r=this.data)==null?void 0:r.style)==null?void 0:n.zoom)||5,minZoom:3,maxZoom:20,attributionControl:!1}),this.map.addControl(new s.NavigationControl({visualizePitch:!0})),this.map.on("load",()=>{this.loadHandler()}),this.map.on("mousemove",o=>{this.moveMouseHadler(o)}),this.map.on("mouseout",()=>{var o;this.showLegend=!1,this.showSetting=!1,this.coordinatesByMouse=0,(o=this.popup)==null||o.remove()})},moveMouseHadler(s){var t;try{const r=this.map.queryRenderedFeatures(s.point),n=((t=r[0])==null?void 0:t.properties)||{};if(!r.length){this.map.getCanvas().style.cursor="",this.popupElement&&this.popupElement.remove();return}this.map.getCanvas().style.cursor="pointer",this.popupElement&&this.popupElement.remove(),this.popupElement=document.createElement("div"),this.popupElement.className="absolute text-gray-800 border border-gray-200 rounded-lg shadow-md min-w-28",this.popupElement.style.backgroundColor="rgba(255, 255, 255, 0.7)",this.popupElement.innerHTML=`<div class="px-2 py-1 text-sm font-semibold text-gray-800 border-b border-gray-200 border-solid rounded-t-lg">
193
193
  ${(n==null?void 0:n.x)||(n==null?void 0:n.title)||(n==null?void 0:n.name)||""}
194
194
  </div>
195
195
 
@@ -198,4 +198,4 @@ Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An err
198
198
  <span class="font-medium mr-[6px]">Значення</span>
199
199
  </span>
200
200
  <span>${(n==null?void 0:n.metric)||0}</span>
201
- </div>`;const o=this.map.project(s.lngLat);this.popupElement.style.left=`${o.x}px`,this.popupElement.style.top=`${o.y-60}px`,this.map.getContainer().appendChild(this.popupElement)}catch(r){console.error(r)}}}},oi={class:"h-full"},ai={class:"flex items-start justify-between mb-[6px] w-full"},li={class:"text-gray-800 font-[600]"},ii={class:"flex gap-2"},ci=["onClick"],di=["id"],pi=["id"],hi={class:"absolute flex flex-col right-[10px] top-[105px] gap-1"},mi={class:"h-[calc(250px)]"};function ui(s,t,r,n,o,l){var m,g,u,x,k,f,y,b,_,$;const a=e.resolveComponent("VsMapSetting"),i=e.resolveComponent("VsMapSlotLayers"),c=e.resolveComponent("VsMapGoHome"),p=e.resolveComponent("VsClusterLegend"),d=e.resolveComponent("VsList"),h=e.resolveComponent("VsBar");return e.openBlock(),e.createElementBlock("div",oi,[e.createElementVNode("div",ai,[e.createElementVNode("h3",li,e.toDisplayString(s.title),1),e.createElementVNode("div",ii,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,w=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["p-1 text-gray-700 border rounded",[o.activeTab===(w==null?void 0:w.id)?"ring-2 ring-blue-500":""]]),onClick:L=>o.activeTab=w==null?void 0:w.id},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w==null?void 0:w.component),{height:"16",width:"16"}))],10,ci))),256))])]),e.withDirectives(e.createElementVNode("div",{class:"relative w-full h-[calc(100%-40px)]",id:`wrapper-${o.mapId}`},[e.createElementVNode("div",{id:o.mapId,class:"h-full w-full flex items-end min-h-[250px]"},null,8,pi),o.showSetting?(e.openBlock(),e.createBlock(a,{key:0,map:o.map,coordinates:o.coordinatesByMouse},null,8,["map","coordinates"])):e.createCommentVNode("",!0),e.createVNode(i,{map:o.map},null,8,["map"]),e.createElementVNode("div",hi,[e.createVNode(c,{map:o.map,bbox:(m=o.data)==null?void 0:m.bounds},null,8,["map","bbox"])]),e.createVNode(p,{mapId:o.mapId,colors:(g=o.data)==null?void 0:g.colors,sizes:(u=o.data)==null?void 0:u.sizes,color:o.baseColor,changeOpacityItem:"true",cluster:"true"},null,8,["mapId","colors","sizes","color"])],8,di),[[e.vShow,o.activeTab=="map"]]),e.withDirectives(e.createVNode(d,{mapId:o.mapId,source:(x=o.data)==null?void 0:x.rows,total:((k=o.data)==null?void 0:k.total)||0,count:((f=o.data)==null?void 0:f.count)||0,onKattotg:t[0]||(t[0]=w=>o.kattotg=w)},null,8,["mapId","source","total","count"]),[[e.vShow,o.activeTab=="table"]]),e.withDirectives(e.createElementVNode("div",mi,[(b=(y=o.data)==null?void 0:y.rows)!=null&&b.length?(e.openBlock(),e.createBlock(h,{key:0,source:($=(_=o.data)==null?void 0:_.rows)==null?void 0:$.map(w=>({title:w==null?void 0:w.title,metric:w==null?void 0:w.metric}))},null,8,["source"])):e.createCommentVNode("",!0)],512),[[e.vShow,o.activeTab=="chart"]])])}const fi=Object.freeze(Object.defineProperty({__proto__:null,default:D(ni,[["render",ui]])},Symbol.toStringTag,{value:"Module"})),gi={name:"VsTable",mixins:[P],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 s=Array.from(new Set(this.sourceData.map(t=>t[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=s.map(t=>pe(t)):this.xs=[...s],this.products=this.dimensions.filter((t,r)=>r!=0),this.values=this.products.map((t,r)=>({name:t,data:this.sourceData.filter(n=>parseFloat(n[t])).map(n=>W(parseFloat(n[t])))}))}catch(s){console.error(s)}}}},bi={class:"flex flex-col h-full pt-[16px] pb-[16px] space-y-4 rounded-xl"},yi={class:"overflow-auto h-full [&::-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"},xi={class:"inline-block min-w-full align-middle"},ki={class:"relative min-w-full divide-y divide-gray-200 text-[12px]"},wi={class:"sticky top-0 bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},_i={class:"space-x-2"},$i={scope:"col",class:"xl:min-w-[120px] min-w-48"},Vi={class:"flex items-center px-1 py-3 font-medium text-gray-800 text-start gap-x-1"},Ei={class:"divide-y divide-gray-200"},Ci={class:"text-gray-600"};function Bi(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",bi,[e.createElementVNode("div",yi,[e.createElementVNode("div",xi,[e.createElementVNode("table",ki,[e.createElementVNode("thead",wi,[e.createElementVNode("tr",_i,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.dimensions,a=>(e.openBlock(),e.createElementBlock("th",$i,[e.createElementVNode("div",Vi,e.toDisplayString(a),1)]))),256))])]),e.createElementVNode("tbody",Ei,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,(a,i)=>(e.openBlock(),e.createElementBlock("tr",{key:i},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.dimensions,(c,p)=>(e.openBlock(),e.createElementBlock("td",{key:p,class:"py-3 whitespace-nowrap"},[e.createElementVNode("span",Ci,e.toDisplayString(a==null?void 0:a[c]),1)]))),128))]))),128))])])])])])}const Di=Object.freeze(Object.defineProperty({__proto__:null,default:D(gi,[["render",Bi]])},Symbol.toStringTag,{value:"Module"}));z.EditorRootPage=wo,z.ROUTES_NAMES=Ct,z.Urls=Vt,z.VsBar=Pe,z.VsDashboard=hr,z.VsDonut=Bt,z.VsLine=Nt,z.VsListBar=Lt,z.VsPie=Dt,z.VsPivotTable=Tt,z.VsProgressBar=zt,z.VsStat=St,z.VsWidget=re,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
201
+ </div>`;const o=this.map.project(s.lngLat);this.popupElement.style.left=`${o.x}px`,this.popupElement.style.top=`${o.y-60}px`,this.map.getContainer().appendChild(this.popupElement)}catch(r){console.error(r)}}}},ri={class:"h-full"},ni={class:"flex items-start justify-between mb-[6px] w-full"},oi={class:"text-gray-800 font-[600]"},ai={class:"flex gap-2"},li=["onClick"],ii=["id"],ci=["id"],di={class:"absolute flex flex-col right-[10px] top-[105px] gap-1"},pi={class:"h-[calc(250px)]"};function hi(s,t,r,n,o,l){var g,f,m,x,k,u,y,b,_,$;const a=e.resolveComponent("VsMapSetting"),i=e.resolveComponent("VsMapSlotLayers"),c=e.resolveComponent("VsMapGoHome"),p=e.resolveComponent("VsClusterLegend"),d=e.resolveComponent("VsList"),h=e.resolveComponent("VsBar");return e.openBlock(),e.createElementBlock("div",ri,[e.createElementVNode("div",ni,[e.createElementVNode("h3",oi,e.toDisplayString(s.title),1),e.createElementVNode("div",ai,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,w=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["p-1 text-gray-700 border rounded",[o.activeTab===(w==null?void 0:w.id)?"ring-2 ring-blue-500":""]]),onClick:L=>o.activeTab=w==null?void 0:w.id},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w==null?void 0:w.component),{height:"16",width:"16"}))],10,li))),256))])]),e.withDirectives(e.createElementVNode("div",{class:"relative w-full h-[calc(100%-40px)]",id:`wrapper-${o.mapId}`},[e.createElementVNode("div",{id:o.mapId,class:"h-full w-full flex items-end min-h-[250px]"},null,8,ci),o.showSetting?(e.openBlock(),e.createBlock(a,{key:0,map:o.map,coordinates:o.coordinatesByMouse},null,8,["map","coordinates"])):e.createCommentVNode("",!0),e.createVNode(i,{map:o.map},null,8,["map"]),e.createElementVNode("div",di,[e.createVNode(c,{map:o.map,bbox:(g=o.data)==null?void 0:g.bounds},null,8,["map","bbox"])]),e.createVNode(p,{mapId:o.mapId,colors:(f=o.data)==null?void 0:f.colors,sizes:(m=o.data)==null?void 0:m.sizes,color:o.baseColor,changeOpacityItem:"true",cluster:"true"},null,8,["mapId","colors","sizes","color"])],8,ii),[[e.vShow,o.activeTab=="map"]]),e.withDirectives(e.createVNode(d,{mapId:o.mapId,source:(x=o.data)==null?void 0:x.rows,total:((k=o.data)==null?void 0:k.total)||0,count:((u=o.data)==null?void 0:u.count)||0,onKattotg:t[0]||(t[0]=w=>o.kattotg=w)},null,8,["mapId","source","total","count"]),[[e.vShow,o.activeTab=="table"]]),e.withDirectives(e.createElementVNode("div",pi,[(b=(y=o.data)==null?void 0:y.rows)!=null&&b.length?(e.openBlock(),e.createBlock(h,{key:0,source:($=(_=o.data)==null?void 0:_.rows)==null?void 0:$.map(w=>({title:w==null?void 0:w.title,metric:w==null?void 0:w.metric}))},null,8,["source"])):e.createCommentVNode("",!0)],512),[[e.vShow,o.activeTab=="chart"]])])}const mi=Object.freeze(Object.defineProperty({__proto__:null,default:D(si,[["render",hi]])},Symbol.toStringTag,{value:"Module"})),ui={name:"VsTable",mixins:[R],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 s=Array.from(new Set(this.sourceData.map(t=>t[this.dimensions[0]])));this.dimensions[0].includes("date")?this.xs=s.map(t=>pe(t)):this.xs=[...s],this.products=this.dimensions.filter((t,r)=>r!=0),this.values=this.products.map((t,r)=>({name:t,data:this.sourceData.filter(n=>parseFloat(n[t])).map(n=>W(parseFloat(n[t])))}))}catch(s){console.error(s)}}}},fi={class:"flex flex-col h-full pt-[16px] pb-[16px] space-y-4 rounded-xl"},gi={class:"overflow-auto h-full [&::-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"},bi={class:"inline-block min-w-full align-middle"},yi={class:"relative min-w-full divide-y divide-gray-200 text-[12px]"},xi={class:"sticky top-0 bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},ki={class:"space-x-2"},wi={scope:"col",class:"xl:min-w-[120px] min-w-48"},_i={class:"flex items-center px-1 py-3 font-medium text-gray-800 text-start gap-x-1"},$i={class:"divide-y divide-gray-200"},Vi={class:"text-gray-600"};function Ei(s,t,r,n,o,l){return e.openBlock(),e.createElementBlock("div",fi,[e.createElementVNode("div",gi,[e.createElementVNode("div",bi,[e.createElementVNode("table",yi,[e.createElementVNode("thead",xi,[e.createElementVNode("tr",ki,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.dimensions,a=>(e.openBlock(),e.createElementBlock("th",wi,[e.createElementVNode("div",_i,e.toDisplayString(a),1)]))),256))])]),e.createElementVNode("tbody",$i,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sourceData,(a,i)=>(e.openBlock(),e.createElementBlock("tr",{key:i},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.dimensions,(c,p)=>(e.openBlock(),e.createElementBlock("td",{key:p,class:"py-3 whitespace-nowrap"},[e.createElementVNode("span",Vi,e.toDisplayString(a==null?void 0:a[c]),1)]))),128))]))),128))])])])])])}const Bi=Object.freeze(Object.defineProperty({__proto__:null,default:D(ui,[["render",Ei]])},Symbol.toStringTag,{value:"Module"}));z.EditorRootPage=xo,z.ROUTES_NAMES=Et,z.Urls=$t,z.VsBar=Re,z.VsDashboard=hr,z.VsDonut=Bt,z.VsLine=Dt,z.VsListBar=zt,z.VsPie=Ct,z.VsPivotTable=Lt,z.VsProgressBar=St,z.VsStat=Nt,z.VsWidget=re,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});