UNPKG

@opengis/bi

Version:

BI data visualization module

138 lines 225 kB
(function(j,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],e):(j=typeof globalThis<"u"?globalThis:j||self,e(j.bi={},j.Vue,j.vueRouter))})(this,function(j,e,K){"use strict";var ed=Object.defineProperty;var td=(j,e,K)=>e in j?ed(j,e,{enumerable:!0,configurable:!0,writable:!0,value:K}):j[e]=K;var O=(j,e,K)=>td(j,typeof e!="symbol"?e+"":e,K);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fr=r=>{for(const t in r)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ke=r=>r==="";/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gr=(...r)=>r.filter((t,s,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===s).join(" ").trim();/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ye=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const br=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,o)=>o?o.toUpperCase():s.toLowerCase());/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yr=r=>{const t=br(r);return t.charAt(0).toUpperCase()+t.slice(1)};/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var ue={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xr=({name:r,iconNode:t,absoluteStrokeWidth:s,"absolute-stroke-width":o,strokeWidth:n,"stroke-width":a,size:l=ue.width,color:i=ue.stroke,...c},{slots:d})=>e.h("svg",{...ue,...c,width:l,height:l,stroke:i,"stroke-width":Ke(s)||Ke(o)||s===!0||o===!0?Number(n||a||ue["stroke-width"])*24/Number(l):n||a||ue["stroke-width"],class:gr("lucide",c.class,...r?[`lucide-${Ye(yr(r))}-icon`,`lucide-${Ye(r)}`]:["lucide-icon"]),...!d.default&&!fr(c)&&{"aria-hidden":"true"}},[...t.map(p=>e.h(...p)),...d.default?[d.default()]:[]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q=(r,t)=>(s,{slots:o,attrs:n})=>e.h(xr,{...n,...s,iconNode:t,name:r},o);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kr=Q("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wr=Q("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _r=Q("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"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const et=Q("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"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $r=Q("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"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Er=Q("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Br=Q("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vr=Q("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cr=Q("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dr=Q("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nr=Q("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sr=Q("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tt=Q("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zr=Q("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rt=Q("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lr=Q("table-2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tr=Q("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/** * @license lucide-vue-next v0.577.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const st=Q("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Ie={week:"Тиждень",month:"Місяць",quarter:"Квартал",year:"Рік"},Ir=["onClick"],Mr={class:"flex items-center justify-between w-full"},vr={key:0},Pr=e.defineComponent({__name:"vs-bi-dropdown",props:{title:{},options:{},value:{default:null}},emits:["selected"],setup(r,{emit:t}){const s=r,o=t,n=e.ref(!1),a=e.ref(s.value??null),l=e.ref(null),i=e.computed(()=>{const m=s.options;return typeof m=="string"?m.split(",").map((f,x)=>({id:x,text:f.trim()})):Array.isArray(m)?m:[]}),c=e.computed(()=>{const m=i.value.find(f=>(f.id??f)===a.value);return m?m.text??String(m):s.title??""}),d=m=>{const f=(m==null?void 0:m.id)??m;a.value=f,n.value=!1,o("selected",f),document.removeEventListener("click",p)},p=m=>{l.value&&!l.value.contains(m.target)&&(n.value=!1,document.removeEventListener("click",p))},h=()=>{n.value=!n.value,n.value?setTimeout(()=>{document.addEventListener("click",p)},200):document.removeEventListener("click",p)},u=m=>(Ie==null?void 0:Ie[m])??m;return e.onUnmounted(()=>{document.removeEventListener("click",p)}),(m,f)=>(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(u(c.value))+" ",1),f[0]||(f[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))]),n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"biDropdown",ref:l,"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:b=>d(x)},[e.createElementVNode("div",Mr,[e.createElementVNode("span",null,e.toDisplayString(u(x.text||x)),1),a.value===(x.id||x)?(e.openBlock(),e.createElementBlock("span",vr,[...f[1]||(f[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,Ir))),128))],512)):e.createCommentVNode("",!0)],64))}}),Fr={class:"flex items-center space-x-2"},jr=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(r,{emit:t}){const s=t,o=e.useModel(r,"modelValue"),n=()=>{s("update:is-enabled",o)};return(a,l)=>(e.openBlock(),e.createElementBlock("div",Fr,[r.leftLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["transition-colors",{"text-blue-500":!o.value}])},e.toDisplayString(r.leftLabel),3)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=i=>o.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:n},null,544),[[e.vModelCheckbox,o.value]]),r.rightLabel?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["transition-colors",{"text-blue-500":o.value}])},e.toDisplayString(r.rightLabel),3)):e.createCommentVNode("",!0)]))}}),R=(r,t)=>{const s=r.__vccOpts||r;for(const[o,n]of t)s[o]=n;return s},Rr={},Wr={class:"flex items-center justify-center h-full"};function Ar(r,t){return e.openBlock(),e.createElementBlock("div",Wr,[...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 Or=R(Rr,[["render",Ar]]),ot={"bi-bar":e.defineAsyncComponent(()=>Promise.resolve().then(()=>el)),"bi-number":e.defineAsyncComponent(()=>Promise.resolve().then(()=>ui)),"bi-text":e.defineAsyncComponent(()=>Promise.resolve().then(()=>yi)),"bi-listbar":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Gl)),"bi-pie":e.defineAsyncComponent(()=>Promise.resolve().then(()=>il)),"bi-donut":e.defineAsyncComponent(()=>Promise.resolve().then(()=>ol)),"bi-line":e.defineAsyncComponent(()=>Promise.resolve().then(()=>hl)),"bi-stat":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Cl)),"bi-pivot":e.defineAsyncComponent(()=>Promise.resolve().then(()=>ci)),"bi-progress":e.defineAsyncComponent(()=>Promise.resolve().then(()=>jl)),"bi-funnel":e.defineAsyncComponent(()=>Promise.resolve().then(()=>_i)),"bi-map":e.defineAsyncComponent(()=>Promise.resolve().then(()=>kc)),"bi-cluster":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Rc)),"bi-table":e.defineAsyncComponent(()=>Promise.resolve().then(()=>Yc))};let nt="/api";function $e(r){nt=r||"/api"}function qr(r,t){const s=nt.replace(/\/$/,""),n=r.startsWith("http")||r.startsWith("//")||s&&r.startsWith(s)?r:`${s}${r.startsWith("/")?r:`/${r}`}`;if(!t||!Object.keys(t).length)return n;const a=new URLSearchParams;Object.entries(t).forEach(([i,c])=>{c!==void 0&&c!==""&&a.set(i,String(c))});const l=a.toString();return l?`${n}${n.includes("?")?"&":"?"}${l}`:n}async function Ee(r,t={}){const{params:s,...o}=t,n=qr(r,s),a={...o.headers};o.body!=null&&(a["Content-Type"]=a["Content-Type"]??"application/json");const l=await fetch(n,{...o,headers:a});if(!l.ok){const c=new Error(l.statusText);throw c.status=l.status,c}const i=await l.text();if(i)try{return JSON.parse(i)}catch{return i}}const G={get(r,t){return Ee(r,{...t,method:"GET"})},post(r,t){return Ee(r,{method:"POST",body:t!=null?JSON.stringify(t):void 0})},put(r,t){return Ee(r,{method:"PUT",body:t!=null?JSON.stringify(t):void 0})},delete(r){return Ee(r,{method:"DELETE"})}};function at(r){if(r==null)return"";const t=String(r);return/[",\n\r]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function Ur(r,t){const s=t.map(at).join(","),o=r.map(n=>t.map(a=>at(n[a])).join(",")).join(`\r `);return`${s}\r ${o}`}function lt(r,t,s){const o=new Blob([t],{type:`${s};charset=utf-8`}),n=URL.createObjectURL(o),a=document.createElement("a");a.href=n,a.download=r,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n)}function it(r,t){return((r||t).replace(/[<>:"/\\|?*\u0000-\u001f]/g,"_").trim()||t).slice(0,120)}function ee(r,t){const s=r&&typeof r=="object"&&"value"in r?r.value:r;if(s==null)return"";const o=Number(s);return Number.isNaN(o)?String(s):new Intl.NumberFormat("en",t??{notation:"compact"}).format(o)}function me(r){if(!(r!=null&&r.includes("T")))return r??"";const[t,s,o]=r.split("T")[0].split("-");return`${o}.${s}.${t}`}const ct={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};function Me(r){if(r==null||r==="")return"";if(r instanceof Date&&!Number.isNaN(r.getTime()))return new Intl.DateTimeFormat("uk-UA",ct).format(r);const t=String(r).trim(),s=t.includes("T")?t:t.replace(/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})/,"$1T$2"),o=new Date(s);return Number.isNaN(o.getTime())?t:new Intl.DateTimeFormat("uk-UA",ct).format(o)}function Hr(r){return Intl.NumberFormat("en").format(r??0)}const Gr={key:0,class:"text-[16px] flex max-w-full items-center min-h-0 justify-between h-fit shrink-0"},Zr={class:"flex items-center justify-between w-full gap-2"},Qr={class:"flex flex-col gap-0.5 min-w-0"},Jr={class:"text-gray-800 inline-block line-clamp-1 font-semibold"},Xr={key:0,class:"text-xs text-gray-400 font-normal line-clamp-1"},Kr={class:"flex items-center gap-1 shrink-0"},Yr=["aria-expanded"],es={key:0,class:"absolute right-0 mt-1 z-50 min-w-[180px] p-1 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] border border-gray-100",role:"menu"},ts={class:"flex flex-col justify-end"},rs={key:0,class:"flex items-center justify-end w-full gap-2"},ss={key:1,class:"text-xs text-gray-400 mb-2 shrink-0"},os="Експорт даних віджета",ns="Завантажити CSV",as="Завантажити JSON",ls="Експорт зображення (PNG)",fe=e.defineComponent({__name:"vs-widget",props:{config:{default:null},data:{default:null},dashboard:{},prefix:{default:""},widget:{},height:{},filterURl:{},dashboardWidgets:{},selectedWidget:{},prefetchedData:{default:null}},emits:["update:current-widget-data"],setup(r,{emit:t}){function s(g){if(g==null||g==="")return null;if(g instanceof Date)return g;if(typeof g=="object"){const E=g.widget,w=g.dashboard;return E!=null&&E!==""?E:w!=null&&w!==""?w:null}return g}const o=r,n=t,a=e.ref(null),l=e.ref(null),i=e.ref(null),c=e.ref({}),d=e.ref([]),p=e.ref(!1),h=e.ref(null),u=e.computed(()=>{const g=o.config;return o.widget||(g==null?void 0:g.widget)||(g==null?void 0:g.widgetId)||(g==null?void 0:g.id)||(g==null?void 0:g.name)||""}),m=e.computed(()=>{const g=o.config;return o.dashboard||(g==null?void 0:g.dashboard)||(g==null?void 0:g.dashboardId)||""}),f=e.computed(()=>{var g;return o.prefix||((g=o.config)==null?void 0:g.prefix)||""}),x=e.computed(()=>o.data||o.prefetchedData||null);function b(g){const E=g.source;if(Array.isArray(E)&&E[0]&&typeof E[0]=="object")return Object.keys(E[0]);const w=g.columns;return Array.isArray(w)&&w.length?w.map(T=>typeof T=="string"?T:(T==null?void 0:T.name)??"").filter(Boolean):[]}const _=e.computed(()=>{const g=c.value;if((g==null?void 0:g.status)!=null&&g.status>=400)return!1;const E=g==null?void 0:g.source;return Array.isArray(E)&&E.length>0&&b(g).length>0});function k(){p.value=!1,document.removeEventListener("click",y)}function y(g){const E=h.value;E&&!E.contains(g.target)&&k()}function C(){p.value=!p.value,p.value?setTimeout(()=>document.addEventListener("click",y),0):document.removeEventListener("click",y)}function z(){const g=c.value,E=g==null?void 0:g.source;if(!Array.isArray(E)||!E.length)return;const w=b(g);if(!w.length)return;const T=Ur(E,w),U=it(B.value||u.value||"widget","widget");lt(`${U}.csv`,`\uFEFF${T}`,"text/csv"),k()}function $(g,E){return g.map(w=>{const T={};for(const U of E)U in w&&(T[U]=w[U]);return T})}function D(){const g=c.value,E=g==null?void 0:g.source;if(!Array.isArray(E)||!E.length)return;const w=b(g),T=$(E,w),U={title:B.value,widget:u.value,columns:w,source:T},S=it(B.value||u.value||"widget","widget");lt(`${S}.json`,JSON.stringify(U,null,2),"application/json"),k()}const B=e.computed(()=>{var E,w,T;const g=(E=o.dashboardWidgets)==null?void 0:E.find(U=>U.name===u.value);return((w=g==null?void 0:g.data)==null?void 0:w.title)??(g==null?void 0:g.title)??((T=o.config)==null?void 0:T.title)??""}),L=e.computed(()=>{var S,ne,ae;const g=s((S=c.value)==null?void 0:S.last_update),E=s((ne=x.value)==null?void 0:ne.last_update),w=g??E;if(w!=null)return Me(w);const T=(ae=o.dashboardWidgets)==null?void 0:ae.find(le=>le.name===u.value),U=s(T==null?void 0:T.last_update)??(T==null?void 0:T.updated_at)??null;return Me(U)}),M=e.computed(()=>{var w,T,U;const g=(w=o.dashboardWidgets)==null?void 0:w.find(S=>S.name===u.value),E=(T=x.value)==null?void 0:T.type;return(g==null?void 0:g.type)??((U=o.config)==null?void 0:U.type)??E??"text"}),q=e.computed(()=>{var g,E,w;return o.height||((g=o.config)==null?void 0:g.height)||((w=(E=c.value)==null?void 0:E.style)==null?void 0:w.height)||480}),H=e.computed(()=>{var E;const g=(E=c.value)==null?void 0:E.controls;return!g||typeof g=="boolean"?[]:Object.keys(g).map(w=>({name:w,options:g[w]}))}),Z=e.computed(()=>{const g=M.value?`bi-${M.value}`:"";return g&&g in ot?ot[g]:null});function N(g,E){var w,T;(T=(w=l.value)==null?void 0:w.changeStyle)==null||T.call(w,g,E)}function V(g,E){const w=d.value.find(T=>T.name===E);w?w.option=g:d.value.push({name:E,option:g}),v()}function v(){var E,w;let g=`/bi-data?dashboard=${m.value}&widget=${u.value}`;d.value.forEach(T=>{g+=`&${T.name}=${T.option}`}),(w=(E=l.value)==null?void 0:E.getDataFromURL)==null||w.call(E,g)}function A(){const g=i.value;if(g!=null&&g.getDataURL){const E=g.getDataURL({type:"png",pixelRatio:2,backgroundColor:"#ffffff"}),w=document.createElement("a");w.href=E,w.download="chart.png",document.body.appendChild(w),w.click(),document.body.removeChild(w)}}return e.onMounted(()=>{f.value&&$e(f.value)}),e.onUnmounted(()=>{document.removeEventListener("click",y)}),e.watch(()=>o.filterURl,g=>{var E,w;g&&((w=(E=l.value)==null?void 0:E.setFilter)==null||w.call(E,g))}),e.watch(()=>o.selectedWidget,(g,E)=>{var w;g!==E&&g===((w=c.value)==null?void 0:w.id)&&n("update:current-widget-data",c.value)}),e.watch(c,(g,E)=>{(g==null?void 0:g.id)!==(E==null?void 0:E.id)&&n("update:current-widget-data",g)},{deep:!0}),(g,E)=>{var w,T,U;return e.openBlock(),e.createElementBlock("div",{ref_key:"widgetRef",ref:a,class:"box-border relative p-4 bg-white border border-gray-200 rounded-xl shadow-sm select-auto overflow-hidden mb-2 last:mb-0 flex flex-col min-h-0",style:e.normalizeStyle({height:q.value+"px",maxHeight:q.value+"px"})},[["text","cluster","map"].includes(M.value)?L.value?(e.openBlock(),e.createElementBlock("p",ss," Оновлено: "+e.toDisplayString(L.value),1)):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Gr,[e.createElementVNode("div",Zr,[e.createElementVNode("div",Qr,[e.createElementVNode("span",Jr,e.toDisplayString(B.value),1),L.value?(e.openBlock(),e.createElementBlock("span",Xr," Оновлено: "+e.toDisplayString(L.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Kr,[_.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dataExportRootRef",ref:h,class:"relative"},[e.createElementVNode("button",{type:"button",class:"h-[32px] w-[32px] rounded-lg hover:bg-gray-100 duration-100 flex items-center justify-center",title:os,"aria-haspopup":"menu","aria-expanded":p.value,onClick:e.withModifiers(C,["stop"])},[e.createVNode(e.unref(et),{size:16,class:"text-gray-800"})],8,Yr),p.value?(e.openBlock(),e.createElementBlock("div",es,[e.createElementVNode("button",{type:"button",role:"menuitem",class:"w-full text-left py-1.5 px-2 text-[13px] text-gray-800 rounded-lg hover:bg-gray-100",onClick:z},e.toDisplayString(ns)),e.createElementVNode("button",{type:"button",role:"menuitem",class:"w-full text-left py-1.5 px-2 text-[13px] text-gray-800 rounded-lg hover:bg-gray-100",onClick:D},e.toDisplayString(as))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",ts,[(w=H.value)!=null&&w.length?(e.openBlock(),e.createElementBlock("span",rs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList((T=H.value)==null?void 0:T.filter(S=>(S==null?void 0:S.options)&&(S==null?void 0:S.name)!=="export"),S=>{var ne,ae;return e.openBlock(),e.createElementBlock("div",{key:S==null?void 0:S.name},[Array.isArray(S==null?void 0:S.options)?(e.openBlock(),e.createBlock(Pr,{key:0,title:S==null?void 0:S.name,options:S==null?void 0:S.options,value:((ae=(ne=c.value)==null?void 0:ne.data)==null?void 0:ae[S==null?void 0:S.name])??null,onSelected:le=>V(le,S==null?void 0:S.name)},null,8,["title","options","value","onSelected"])):typeof S.options=="boolean"?(e.openBlock(),e.createBlock(jr,{key:1,"left-label":S==null?void 0:S.name,"model-value":!!(S!=null&&S.options),"onUpdate:isEnabled":le=>N(S==null?void 0:S.name,le)},null,8,["left-label","model-value","onUpdate:isEnabled"])):e.createCommentVNode("",!0)])}),128)),(U=H.value)!=null&&U.some(S=>(S==null?void 0:S.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",title:ls,onClick:A},[e.createVNode(e.unref(_r),{size:16,class:"text-gray-800"})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])])])])),e.createElementVNode("div",{class:"w-full flex-1 min-h-0",onClick:E[2]||(E[2]=e.withModifiers(()=>{},["stop"]))},[Z.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Z.value),{key:0,ref_key:"chartRef",ref:l,"current-widget":i.value,"onUpdate:currentWidget":E[0]||(E[0]=S=>i.value=S),"widget-data":c.value,"onUpdate:widgetData":E[1]||(E[1]=S=>c.value=S),config:r.config,dashboard:m.value,title:B.value,widget:u.value,prefix:f.value,"prefetched-data":x.value},null,40,["current-widget","widget-data","config","dashboard","title","widget","prefix","prefetched-data"])):(e.openBlock(),e.createBlock(Or,{key:1,class:"w-full h-full"}))])],4)}}}),is={class:"w-full overflow-hidden rounded vs-table-interface__table-wrp h-fit"},cs={class:"p-5 min-h-[500px] flex flex-col justify-center items-center text-center"},ds={class:"max-w-sm mx-auto mt-6"},ps={class:"font-medium text-gray-800 dark:text-neutral-200"},hs={class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"},Be=e.defineComponent({__name:"vs-new-nodata",props:{title:{default:"Дані для відображення відсутні"},text:{default:"Змініть параметри пошуку або спробуйте пізніше"}},setup(r){return(t,s)=>(e.openBlock(),e.createElementBlock("div",is,[e.createElementVNode("div",null,[e.createElementVNode("div",cs,[s[0]||(s[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",ds,[e.createElementVNode("p",ps,e.toDisplayString(r.title),1),e.createElementVNode("p",hs,e.toDisplayString(r.text),1)])])])]))}}),us={components:{filterIcon:{__name:"filter",setup(r){return(t,s)=>(e.openBlock(),e.createBlock(e.unref($r),e.mergeProps(t.$attrs,{size:24}),null,16))}}},props:["filterScheme"],emits:["filters:changed"]},ms={class:"flex items-center"},fs={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 gs(r,t,s,o,n,a){const l=e.resolveComponent("filterIcon");return e.openBlock(),e.createElementBlock("div",ms,[s.filterScheme?(e.openBlock(),e.createElementBlock("button",fs,[e.createVNode(l),t[0]||(t[0]=e.createTextVNode(" Фільтри ",-1))])):e.createCommentVNode("",!0)])}const bs={components:{VsFilterHeader:R(us,[["render",gs]])},props:{dashboardData:{type:Object,default:null},filters:{type:Array,default:null}}},ys={class:"bg-white px-5 flex gap-4 h-[90px] border border-gray-200 rounded-xl mb-2 pt-[3px] justify-between items-center"},xs={class:"grow"},ks={class:"text-lg font-semibold text-stone-800 dark:text-neutral-200"},ws={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"},_s={key:0,class:"flex items-center gap-3"};function $s(r,t,s,o,n,a){var i,c,d;const l=e.resolveComponent("VsFilterHeader");return e.openBlock(),e.createElementBlock("div",ys,[e.createElementVNode("div",xs,[e.createElementVNode("h1",ks,e.toDisplayString((i=s.dashboardData)==null?void 0:i.title),1),(c=s.dashboardData)!=null&&c.description?(e.openBlock(),e.createElementBlock("button",ws,e.toDisplayString((d=s.dashboardData)==null?void 0:d.description),1)):e.createCommentVNode("",!0)]),s.filters?(e.openBlock(),e.createElementBlock("div",_s,[e.createVNode(l,{filterScheme:s.filters,"onFilters:changed":t[0]||(t[0]=p=>r.$emit("filters:changed",p))},null,8,["filterScheme"])])):e.createCommentVNode("",!0)])}const Es=R(bs,[["render",$s]]),Bs={key:0,class:"text-gray-400 shrink-0"},Vs=["onClick"],Cs=["onClick"],Ds={key:4,class:"text-gray-900 font-medium truncate"},dt={__name:"vs-breadcrumbs",props:{items:{type:Array,default:()=>[]},compact:{type:Boolean,default:!1}},setup(r){const t=r,s=K.useRouter(),o=e.computed(()=>Array.isArray(t.items)?t.items:[]);function n(a){s!=null&&s.push?s.push(a):typeof a=="string"&&(window!=null&&window.location)&&(window.location.href=a)}return(a,l)=>{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",r.compact?"py-1":"py-6"]),"aria-label":"Breadcrumb"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(c,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[d>0?(e.openBlock(),e.createElementBlock("span",Bs,[e.createVNode(e.unref(wr),{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:p=>c.onClick()},e.toDisplayString(c.label),9,Vs)):e.unref(s)&&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:p=>n(c.to)},e.toDisplayString(c.label),9,Cs)):(e.openBlock(),e.createElementBlock("span",Ds,e.toDisplayString(c.label),1))],64))),128))],2)}}},Ns={components:{VsWidget:fe,VsNewNodata:Be,VsHeader:Es,VsBreadcrumbs:dt},props:{id:{type:String,default:""},prefix:{type:String,default:""},config:{type:Object,default:null},data:{type:Object,default:null}},data(){return{widgets:[],panels:[],error:!1,selectedPanel:"",filterURl:null,dashboardData:null}},computed:{resolvedDashboardId(){var r,t,s;return this.id||((r=this.config)==null?void 0:r.dashboard)||((t=this.config)==null?void 0:t.dashboardId)||((s=this.config)==null?void 0:s.id)||""},resolvedPrefix(){var r;return this.prefix||((r=this.config)==null?void 0:r.prefix)||"/api"},resolvedDashboardData(){var r;return this.data?(r=this.data)!=null&&r.dashboardData&&typeof this.data.dashboardData=="object"?this.data.dashboardData:this.data:this.dashboardData},widgetPrefetchedMap(){return!this.data||typeof this.data!="object"?null:[this.data.widgetResponses,this.data.widgetsData,this.data.prefetchedData,this.data.data].find(t=>t&&typeof t=="object"&&!Array.isArray(t))||null}},watch:{data:{immediate:!0,handler(r){r&&(this.dashboardData=r,this.error=!1)}},resolvedPrefix:{immediate:!0,handler(r){$e(r||"/api")}},async resolvedDashboardId(r,t){!this.data&&r&&r!==t&&await this.fetchData()}},async mounted(){if(this.data){this.dashboardData=this.data;return}await this.fetchData()},methods:{async fetchData(){if(!(this.data||!this.resolvedDashboardId))try{const r=await G.get(`/bi-dashboard/${this.resolvedDashboardId}`);this.dashboardData=r,this.error=!1}catch(r){this.error=!0,console.error(r)}},columnClass(r){const t=r!=null&&r.col?r==null?void 0:r.col:12;return{1:"md:w-1/12 sm:w-full",2:"md:w-1/6 sm:w-full",3:"md:w-1/4 sm:w-full",4:"md:w-1/3 sm:w-full",6:"md:w-1/2 sm:w-full",8:"md:w-2/3 sm:w-full",10:"md:w-5/6 sm:w-full",12:"w-full"}[t]||"w-full"},async filterHandler(r){var s;this.filterURl="";let t="&filter=";(s=r==null?void 0:r.url)!=null&&s.length&&(r.url.split("|").forEach(n=>{const a=n.split("=");t+=`${a[0]}=${a[1]}`}),this.filterURl+=t)},getPrefetchedWidgetData(r){return!r||!this.widgetPrefetchedMap?null:this.widgetPrefetchedMap[r]||null}}},Ss={class:"w-full pb-8 overflow-y-auto mx-auto"},zs={class:"grid flex-grow w-full grid-cols-12 gap-4 h-fit"};function Ls(r,t,s,o,n,a){var c;const l=e.resolveComponent("VsNewNodata"),i=e.resolveComponent("VsWidget");return e.openBlock(),e.createElementBlock("div",Ss,[e.createElementVNode("div",zs,[n.error||!a.resolvedDashboardData?(e.openBlock(),e.createBlock(l,{key:0,class:"col-span-12"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(((c=a.resolvedDashboardData)==null?void 0:c.panels)||[],(d,p)=>{var h,u;return e.openBlock(),e.createElementBlock("div",{key:d.widget||((h=d.widgets)==null?void 0:h.join("-"))||p,class:e.normalizeClass([`col-span-12 lg:col-span-${d.col||12}`,"flex flex-col gap-[10px]"])},[(u=d.widgets)!=null&&u.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.widgets,m=>(e.openBlock(),e.createBlock(i,{key:m,dashboard:a.resolvedDashboardId,widget:m,"dashboard-widgets":a.resolvedDashboardData.widgets,"prefetched-data":a.getPrefetchedWidgetData(m),"filter-u-rl":n.filterURl,height:d.height},null,8,["dashboard","widget","dashboard-widgets","prefetched-data","filter-u-rl","height"]))),128)):(e.openBlock(),e.createBlock(i,{key:1,class:"flex flex-col",dashboard:a.resolvedDashboardId,widget:d.widget,"dashboard-widgets":a.resolvedDashboardData.widgets,"prefetched-data":a.getPrefetchedWidgetData(d.widget),height:d.height,"filter-u-rl":n.filterURl},null,8,["dashboard","widget","dashboard-widgets","prefetched-data","height","filter-u-rl"]))],2)}),128))])])}const Ts=R(Ns,[["render",Ls]]);var pt=(r=>(r.Dashboard="/dashboard",r.BiPlatform="/bi-platform",r.EditorBase="/editor",r.AllDashboards="/dashboards",r.DashboardByName="/dashboards/:name",r))(pt||{}),ht;(r=>{(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"})(r.Types||(r.Types={}))})(ht||(ht={}));var J=(r=>(r.AllDashboards="all-dashboards",r.BiPlatform="bi-platform",r.Dashboard="dashboard",r.Erobota="erobota",r.Datatest="datatest",r.Sourcedate="sourcedate",r.Widgetwidget="widgetwidget",r.Test="test",r.Demo="demo",r.Crm="crm",r.Editor="editor-all-dashboards",r.EditorDashboard="editor-dashboard",r.EditorWidget="editor-widget",r.Editordetails="editordetails",r.Dbtables="dbtables",r.Biviewer="biviewer",r.Biviewerinner="biviewerinner",r.Bieditor="bieditor",r.Bieditorinner="bieditorinner",r))(J||{});const Is={key:0,class:"vs-modal-wrapper fixed inset-0 flex items-center justify-center p-4"},Ms={class:"flex items-center justify-between shrink-0 py-2.5 px-4 border-b border-gray-200 dark:border-[#454545]"},vs={class:"font-medium text-gray-800 dark:text-white"},Ps={class:"vs-modal-content flex-1 min-h-0 overflow-auto p-4"},Fs={key:0,class:"shrink-0 border-t border-gray-200 dark:border-neutral-700"},ge=R({__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(r,{emit:t}){const s=r,o=t,n=e.computed(()=>s.size==="small"?"md:max-w-[40%] w-full max-w-md":s.size==="lg"?"md:max-w-[70%] w-full max-w-4xl":"md:max-w-[80%] lg:max-w-[50%] w-full max-w-lg");function a(){o("update:visible",!1),o("close")}function l(i){i.key==="Escape"&&a()}return e.onMounted(()=>{window.addEventListener("keydown",l)}),e.onUnmounted(()=>{window.removeEventListener("keydown",l)}),(i,c)=>(e.openBlock(),e.createBlock(e.Teleport,{to:r.teleport},[r.visible?(e.openBlock(),e.createElementBlock("div",Is,[e.createElementVNode("div",{class:"absolute inset-0 bg-black/50","aria-hidden":"true",onMousedown:c[0]||(c[0]=d=>r.closeClickBack&&d.target===d.currentTarget&&a())},null,32),e.createVNode(e.Transition,{name:"vs-modal",appear:""},{default:e.withCtx(()=>[r.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]",n.value]),role:"dialog","aria-modal":"true",onMousedown:c[1]||(c[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",Ms,[e.createElementVNode("h3",vs,e.toDisplayString(r.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:a},[...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",Ps,[e.renderSlot(i.$slots,"default",{},void 0,!0)]),i.$slots.footer?(e.openBlock(),e.createElementBlock("div",Fs,[e.renderSlot(i.$slots,"footer",{},void 0,!0)])):e.createCommentVNode("",!0)],34)):e.createCommentVNode("",!0)]),_:3})])):e.createCommentVNode("",!0)],8,["to"]))}},[["__scopeId","data-v-e08bae19"]]),js={__name:"icon-plus",setup(r){return(t,s)=>(e.openBlock(),e.createBlock(e.unref(tt),e.mergeProps(t.$attrs,{size:24}),null,16))}},Rs={class:"mb-4 overflow-auto scrollbar max-h-96"},Ws={__name:"vs-editor-create-widget",props:{columns:{type:Array,default:()=>[]},selectedDashboard:String,inline:{type:Boolean,default:!1}},emits:["update-data"],setup(r,{expose:t,emit:s}){var f;const o=e.defineAsyncComponent(()=>import("@opengis/form")),n=(f=e.getCurrentInstance().proxy)==null?void 0:f.$notify,a=s,l=r,i=e.ref(!1),c=e.ref({}),d=e.ref();function p(){i.value=!0}function h(){i.value=!1}t({open:p,close:h});const u=async()=>{var x;try{const b=(x=d.value)==null?void 0:x.doValidation;typeof b=="function"&&await b(),await G.post(`/bi-dashboard/${l.selectedDashboard}`,c.value),await n({type:"success",title:"Успішно!",message:"Віджет успішно створено"}),await a("update-data"),c.value={},i.value=!1}catch(b){const _=(b==null?void 0:b.message)||"При спробі створити віджет сталася помилка. Перевірте обов'язкові поля (зокрема Type).";n==null||n({type:"error",title:"Помилка!",message:_})}},m=e.computed(()=>{var x,b,_,k;return{title:{type:"text",label:"Назва віджета",placeholder:"Назва віджета",validators:["required"]},x:{type:"select",label:"Вісь X",view:"buttons",style:{size:"xs"},validators:["required"],options:(b=(x=l.columns)==null?void 0:x.filter(y=>(y==null?void 0:y.type)=="text"||(y==null?void 0:y.type)==="date"||(y==null?void 0:y.type)==="timestamp without time zone"||(y==null?void 0:y.type)==="boolean"||(y==null?void 0:y.type)==="integer"))==null?void 0:b.map(({name:y,type:C})=>({id:y,text:y,type:C}))},metric:{type:"select",label:"Вісь Y",view:"buttons",validators:["required"],style:{size:"xs"},options:[{id:"count",label:"count"},...(k=(_=l.columns)==null?void 0:_.filter(y=>(y==null?void 0:y.type)==="numeric"||(y==null?void 0:y.type)==="double precision"))==null?void 0:k.map(({name:y,type:C})=>({id:y,text:y,type:C}))]},col:{type:"select",label:"Кількість колонок",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}]},height:{type:"Text",label:"Висота",placeholder:"Висота"},type:{type:"select",view:"buttons",label:"Тип віджета",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"}]},text:{type:"Text",ua:"Текст",placeholder:"Текст",conditions:["type","==","text"]},table:{type:"Text",ua:"Таблиця",placeholder:"Таблиця"},query:{type:"Text",ua:"Запит (query)",placeholder:"Запит (query)"},cls:{type:"Text",ua:"Клас (cls)",placeholder:"Клас (cls)"}}});return(x,b)=>{const _=e.resolveComponent("VsPopover");return e.openBlock(),e.createElementBlock("div",null,[r.inline?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_,{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:p},[e.createVNode(js,{height:"20",width:"20"})])])]),default:e.withCtx(()=>[b[1]||(b[1]=e.createTextVNode(" Створити віджет ",-1))]),_:1})),e.createVNode(ge,{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: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 !border-gray-200 hover:bg-blue-700 duration-300"}," Створити ")])]),default:e.withCtx(()=>[e.createElementVNode("div",Rs,[e.createVNode(e.unref(o),{ref_key:"form",ref:d,schema:m.value,values:c.value,"onUpdate:values":b[0]||(b[0]=k=>c.value=k)},null,8,["schema","values"])])]),_:1},8,["visible"])])}}},ut={__name:"delete",setup(r){return(t,s)=>(e.openBlock(),e.createBlock(e.unref(Tr),e.mergeProps(t.$attrs,{size:24}),null,16))}},ve={__name:"close",setup(r){return(t,s)=>(e.openBlock(),e.createBlock(e.unref(st),e.mergeProps(t.$attrs,{size:24}),null,16))}},mt={__name:"edit",setup(r){return(t,s)=>(e.openBlock(),e.createBlock(e.unref(Sr),e.mergeProps(t.$attrs,{size:24}),null,16))}},As={class:"space-y-4"},Os={__name:"vs-editor-form-style",props:{widgetName:{type:String},dashboardId:{type:String,default:""},data:{type:Object,default:()=>{}}},emits:["update-dashboard"],setup(r,{expose:t,emit:s}){var C,z,$,D;const o=e.defineAsyncComponent(()=>import("@opengis/form")),{$notify:n}=e.getCurrentInstance().proxy,a=s,l=r,i=e.ref(null),c=e.computed(()=>l.dashboardId||i.value),d=((C=l.data)==null?void 0:C.type)||(($=(z=l.data)==null?void 0:z.data)==null?void 0:$.type),h={pie:{label:!1,legend:!0,tooltip:!0},donut:{label:!1,legend:!0,tooltip:!0},bar:{label:!1,legend:!1,tooltip:!0},line:{label:!1,legend:!1,tooltip:!0},funnel:{label:!1,legend:!1,tooltip:!0}}[d]||{label:!1,legend:!1,tooltip:!0},u={show:{label:"Легенда",type:"switcher",title:"Показати легенду"}},m={show:{label:"Тултіп",type:"switcher",title:"Показати тултіп"}},f=(D=l.data)==null?void 0:D.style,x=e.ref(f!=null&&f.label?{...f.label}:{show:h.label}),b=e.ref(f!=null&&f.legend?{...f.legend}:{show:h.legend}),_=e.ref(f!=null&&f.tooltip?{...f.tooltip}:{show:h.tooltip}),k=()=>{const B=new CustomEvent(`update-style-${l.widgetName}`);B.chartId=l.widgetName,B.options={options:{legend:b.value,tooltip:_.value,label:x.value},seriesOptions:x.value},window.dispatchEvent(B)};e.watch(x,k,{deep:!0}),e.watch(b,k,{deep:!0}),e.watch(_,k,{deep:!0});const y=async()=>{try{await G.put(`/bi-dashboard/${c.value}/${l.widgetName}`,{style:{legend:b.value,tooltip:_.value,label:x.value}});const B=new CustomEvent(`update-style-${l.widgetName}`);B.chartId=l.widgetName,B.options={options:{legend:b.value,tooltip:_.value,label:x.value},seriesOptions:x.value},window.dispatchEvent(B),a("update-dashboard"),n({type:"success",title:"Успішно!",message:"Дані успішно оновлено"})}catch{n({type:"error",title:"Помилка!",message:"При спробі оновити данні сталася помилка"})}};return e.onMounted(()=>{const B=new URLSearchParams(window.top.location.search);i.value=B.get("dashboard"),k()}),t({requestUpdateWidget:y}),(B,L)=>(e.openBlock(),e.createElementBlock("div",As,[e.createVNode(e.unref(o),{schema:u,values:b.value,"onUpdate:values":L[0]||(L[0]=M=>b.value=M),class:"p-0"},null,8,["values"]),e.createVNode(e.unref(o),{schema:m,values:_.value,"onUpdate:values":L[1]||(L[1]=M=>_.value=M),class:"p-0"},null,8,["values"])]))}};function Pe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:n