@aquera/data-visualizer-sdk 0.0.13 → 0.0.15
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/ask-aquera/src/ask-aquera-config.d.ts +14 -0
- package/{chunk-MWFURRDC.js → chunk-47JFEXYX.js} +9 -9
- package/chunk-BWOCVRQM.js +11 -0
- package/chunk-CJKWIGF2.js +1 -0
- package/chunk-ECS6WNSC.js +11 -0
- package/chunk-L4MRZUKM.js +8 -0
- package/{chunk-ABVJ65LF.js → chunk-L764UFCZ.js} +1 -1
- package/{chunk-2H2RWKP5.js → chunk-LF44PEDM.js} +1 -1
- package/{chunk-PBLP5EZH.js → chunk-O6T6EAR2.js} +633 -633
- package/{chunk-Z5FDX7CX.js → chunk-U4S2XPPP.js} +3 -3
- package/chunk-XUJBDACP.js +10 -0
- package/chunk-YVK6OFZS.js +2 -0
- package/index.d.ts +19 -4
- package/main.js +1 -1
- package/manage-dashboards/src/manage-dashboards-config.d.ts +250 -0
- package/package.json +2 -2
- package/styles.css +1 -1
- package/chunk-BD43HU4Y.js +0 -12
- package/chunk-NA6Z7CGT.js +0 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var r=(function(s){return s[s.State=0]="State",s[s.Transition=1]="Transition",s[s.Sequence=2]="Sequence",s[s.Group=3]="Group",s[s.Animate=4]="Animate",s[s.Keyframes=5]="Keyframes",s[s.Style=6]="Style",s[s.Trigger=7]="Trigger",s[s.Reference=8]="Reference",s[s.AnimateChild=9]="AnimateChild",s[s.AnimateRef=10]="AnimateRef",s[s.Query=11]="Query",s[s.Stagger=12]="Stagger",s})(r||{}),_="*";function a(s,t){return{type:r.Trigger,name:s,definitions:t,options:{}}}function c(s,t=null){return{type:r.Animate,styles:t,timings:s}}function y(s,t=null){return{type:r.Sequence,steps:s,options:t}}function F(s){return{type:r.Style,styles:s,offset:null}}function S(s,t,e=null){return{type:r.Transition,expr:s,animation:t,options:e}}var l=class{_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_originalOnDoneFns=[];_originalOnStartFns=[];_started=!1;_destroyed=!1;_finished=!1;_position=0;parentPlayer=null;totalTime;constructor(t=0,e=0){this.totalTime=t+e}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(t=>t()),this._onDoneFns=[])}onStart(t){this._originalOnStartFns.push(t),this._onStartFns.push(t)}onDone(t){this._originalOnDoneFns.push(t),this._onDoneFns.push(t)}onDestroy(t){this._onDestroyFns.push(t)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(t=>t()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(t=>t()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(t){this._position=this.totalTime?t*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(t){let e=t=="start"?this._onStartFns:this._onDoneFns;e.forEach(n=>n()),e.length=0}},u=class{_onDoneFns=[];_onStartFns=[];_finished=!1;_started=!1;_destroyed=!1;_onDestroyFns=[];parentPlayer=null;totalTime=0;players;constructor(t){this.players=t;let e=0,n=0,o=0,h=this.players.length;h==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(i=>{i.onDone(()=>{++e==h&&this._onFinish()}),i.onDestroy(()=>{++n==h&&this._onDestroy()}),i.onStart(()=>{++o==h&&this._onStart()})}),this.totalTime=this.players.reduce((i,f)=>Math.max(i,f.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(t=>t()),this._onDoneFns=[])}init(){this.players.forEach(t=>t.init())}onStart(t){this._onStartFns.push(t)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(t=>t()),this._onStartFns=[])}onDone(t){this._onDoneFns.push(t)}onDestroy(t){this._onDestroyFns.push(t)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(t=>t.play())}pause(){this.players.forEach(t=>t.pause())}restart(){this.players.forEach(t=>t.restart())}finish(){this._onFinish(),this.players.forEach(t=>t.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(t=>t.destroy()),this._onDestroyFns.forEach(t=>t()),this._onDestroyFns=[])}reset(){this.players.forEach(t=>t.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(t){let e=t*this.totalTime;this.players.forEach(n=>{let o=n.totalTime?Math.min(1,e/n.totalTime):1;n.setPosition(o)})}getPosition(){let t=this.players.reduce((e,n)=>e===null||n.totalTime>e.totalTime?n:e,null);return t!=null?t.getPosition():0}beforeDestroy(){this.players.forEach(t=>{t.beforeDestroy&&t.beforeDestroy()})}triggerCallback(t){let e=t=="start"?this._onStartFns:this._onDoneFns;e.forEach(n=>n()),e.length=0}},g="!";export{r as a,_ as b,a as c,c as d,y as e,F as f,S as g,l as h,u as i,g as j};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
@angular/animations/fesm2022/_private_export-chunk.mjs:
|
|
5
|
+
(**
|
|
6
|
+
* @license Angular v21.2.18
|
|
7
|
+
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
8
|
+
* License: MIT
|
|
9
|
+
*)
|
|
10
|
+
*/
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$ as Ot,$a as Ht,B as _t,D as yt,Da as Rt,Ea as Nt,F as ce,G as Ct,J as vt,Ja as Ae,Ka as ye,L as xt,M as wt,Ma as zt,N as Pt,Na as Fe,O as Mt,Oa as Vt,P as Dt,Q as kt,R as St,Ra as T,S as ge,V as pe,Va as Ge,Wa as Wt,X as Le,_a as qt,a as je,aa as Tt,ab as Lt,b as Ze,bb as Ee,c as lt,ca as ke,d as Me,da as Se,fa as Oe,fb as $e,g as De,gb as Gt,i as q,ib as $t,j as K,k as dt,l as ct,m as gt,n as pt,na as Te,oa as At,p as ht,pa as Ft,q as mt,qa as _e,r as ie,s as ut,sa as Et,t as ft,ta as It,v as de,w as bt}from"./chunk-O6T6EAR2.js";import{Ab as M,Bb as ot,Eb as b,Ga as tt,Gb as d,Ha as nt,Jb as ae,Kb as j,La as c,Lb as Z,N as B,Ob as R,Pb as at,Qb as te,R as Ke,S as v,Sb as w,Tb as W,Ub as He,X as u,Xa as we,Y as f,Z as Qe,_ as Je,ab as z,ac as se,ba as Xe,bc as ne,cc as le,d as Ye,da as me,ea as xe,fb as L,gc as fe,ha as et,ia as m,kb as it,la as X,lb as ee,lc as S,mb as _,nb as y,ob as U,oc as be,p as A,pa as re,pb as rt,pc as Y,qb as F,rb as E,rc as st,sb as C,tb as s,ub as l,vb as h,wb as oe,xb as Pe,yb as ue,zb as V}from"./chunk-U4S2XPPP.js";import{a as P,b as H}from"./chunk-ZW5NV4UO.js";function Qt(){return{dashboardsTitle:"Dashboards",loadingDashboards:"Loading dashboards\u2026",noDashboardsTitle:"No dashboards yet",noDashboardsSub:"Generate one from your data, or create it in the builder.",generateDashboardButton:"Generate dashboard",refreshButton:"Refresh",exportButton:"Export",editButton:"Edit",renamePlaceholder:"Dashboard name",askAqueraButton:"Ask Aquera",errors:{loadFailedFallback:"Could not load dashboards",saveFailedFallback:"Could not save the dashboard",refreshFailedFallback:"Could not refresh the dashboard",exportFailedFallback:"Could not export the dashboard"}}}function Jt(){return{mcpGateway:de.MCP_GATEWAY_ENABLED??!1,aiPrompt:!0,autoGenerate:!0,export:!0,rename:!0,refresh:!0,executiveSummary:!0,edit:!0}}function Bt(){return{baseUrl:de.baseUrl??"",mcpUrl:de.MCP_URL??null,tokenizedOrigins:[de.baseUrl].filter(r=>!!r),headers:{},customerId:null,productId:null,productName:null,authMode:"inherit",authToken:null,getToken:null,resolvedToken:null,onUnauthorized:null,ssoEnabled:de.SSO_ENABLED??!1,features:Jt(),ui:{theme:"light",density:"comfortable",header:!0,locale:"en"},copy:Qt(),hrefs:{askAquera:"/ask-aquera",builder:"/manage-dashboards"},initialDashboardId:null}}var Ut=mt("dashboards",Bt);function D(){return Ut.read()}function jt(r){let t=Bt(),e=H(P(P({},t),ie(r)),{features:P(P({},t.features),ie(r.features??{})),ui:P(P({},t.ui),ie(r.ui??{})),hrefs:P(P({},t.hrefs),ie(r.hrefs??{})),copy:H(P(P({},t.copy),ie(r.copy??{})),{errors:P(P({},t.copy.errors),ie(r.copy?.errors??{}))}),headers:P(P({},t.headers),r.headers??{})});return r.tokenizedOrigins||(e.tokenizedOrigins=[e.baseUrl,e.mcpUrl].filter(n=>!!n)),Ut.write(e)}var G=class r{requests$=new Ye;requests=this.requests$.asObservable();toAskAquera(){this.requests$.next({to:D().hrefs.askAquera})}toAskAqueraDashboard(t,e){this.requests$.next({to:`${D().hrefs.askAquera}/dashboard/${t}`,queryParams:e})}toBuilder(t){this.requests$.next({to:`${D().hrefs.builder}/${t}`})}static \u0275fac=function(e){return new(e||r)};static \u0275prov=B({token:r,factory:r.\u0275fac})};var k={get baseUrl(){return D().baseUrl},get MCP_URL(){return D().mcpUrl??""},get MCP_GATEWAY_ENABLED(){return D().features.mcpGateway},get SSO_ENABLED(){return D().ssoEnabled}};function Zt(){return D().customerId??""}function O(){return D().productId??""}var he=class r{constructor(t){this.http=t}http;tokenStore=v(ce);publishRepo=v(T);lastSentCustomerId=null;lastSentProductId=null;get customerId(){return this.tokenStore.tenantId()??""}mcpGatewayUrl(){return`${k.baseUrl}/dviz-mcp`}async callMcpTool(t,e={}){let n=this.customerId,i=O(),o={};n!==this.lastSentCustomerId&&(o.customerId=n),i!==this.lastSentProductId&&(o.productId=i);let a;try{a=await A(this.http.post(this.mcpGatewayUrl(),{jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:t,arguments:e}},{headers:{Accept:"application/json, text/event-stream"},params:o})),this.lastSentCustomerId=n,this.lastSentProductId=i}catch(p){throw p instanceof q?new Error(p.error?.error?.message||p.error?.message||p.message):p}if(a.error)throw new Error(a.error.message);let g=a.result;if(g?.isError)throw new Error(g.structuredContent?.error?.message??g.content?.[0]?.text??`${t} failed`);return g?.structuredContent??{}}async loadDashboards(){return(await this.publishRepo.listDashboards({published:"true",limit:100})).filter(e=>e.isPublished===!0||e.version==="published").map(e=>({id:e.id,name:e.name??"Untitled",description:e.description,createdAt:e.createdAt??new Date().toISOString(),updatedAt:e.updatedAt,isAutoGenerated:e.isAutoGenerated===!0,category:e.category??null}))}async renameDashboard(t,e){if(!k.MCP_GATEWAY_ENABLED){try{await A(this.http.put(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/dashboards/${t}?published=true`,{name:e}))}catch(n){throw n instanceof q?new Error(n.error?.error||n.message):n}return}await this.callMcpTool("updateDashboard",{dashboardId:t,name:e,published:!0})}async fetchDashboard(t){let e,n=!1;if(k.MCP_GATEWAY_ENABLED){let i=await this.callMcpTool("getDashboard",{dashboardId:t,published:"true"});e=i?.dashboard??{},n=i?.canRefresh===!0}else{let i=await A(this.http.get(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/dashboards/${t}?published=true`));e=i?.data??i,n=i?.canRefresh===!0}return{id:e.id,name:e.name??"Untitled",widgets:await this.mapAndHydrateWidgets(e.widgets),connectionId:e.connectionId,isPipeline:e.isPipeline,adapterType:e.adapterType,category:e.category??null,canRefresh:n}}async refreshDashboard(t){if(!k.MCP_GATEWAY_ENABLED){let n=await A(this.http.post(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/dashboards/${t}/refresh`,{})),i=n?.data??n;return{widgets:await this.mapAndHydrateWidgets(i?.widgets)}}let e=await this.callMcpTool("refreshDashboard",{dashboardId:t});return{widgets:await this.mapAndHydrateWidgets(e?.refresh?.widgets)}}async previewWidgetTemplateDetailPanel(t){return(await A(this.http.post(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/widget-templates/${t}/detail-panel`,{}))).data}async previewWidgetDetailPanelDefinition(t){return(await A(this.http.post(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/widget-templates/preview-detail-panel`,{detailPanel:t}))).data}async mapAndHydrateWidgets(t){let e=(t??[]).map(n=>({id:n.id,title:n.title,type:n.widgetType??"chart",layout:n.layout??{x:0,y:0,w:12,h:4},nileConfig:{chart:n.chart??n.config?.chart??{},aq:n.config?.aq??{},_meta:n.config?._meta},drilldownBy:Array.isArray(n.drilldownBy)?n.drilldownBy:void 0,dataSourceId:n.dataSourceId,queryMeta:n.queryMeta,category:n.category??null}));return await Promise.all(e.map(n=>ye(n.nileConfig))),e}static \u0275fac=function(e){return new(e||r)(Ke(K))};static \u0275prov=B({token:r,factory:r.\u0275fac,providedIn:"root"})};var $=class r{http=v(K);tokenStore=v(ce);get customerId(){return this.tokenStore.tenantId()??""}async fetchGridPage(t,e,n,i,o,a,g,p){let x=`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/data-grid/${t}?pageIndex=${e}&pageSize=${n}`,N=(i??[]).filter(J=>J&&J.value!=null&&String(J.value).trim()!=="");return N.length&&(x+=`&filters=${encodeURIComponent(JSON.stringify(N))}`),o&&Object.keys(o).length&&(x+=`&dashboardFilters=${encodeURIComponent(JSON.stringify(o))}`),g&&g.length&&(x+=`&resolvedFilters=${encodeURIComponent(JSON.stringify(g))}`),a&&(x+=`&dashboardId=${encodeURIComponent(a)}`),p&&(x+=`&conversationId=${encodeURIComponent(p)}`),A(this.http.get(x))}async generateWidget(t,e){let n=vt()?{prompt:t}:{prompt:t,dataSourceId:e},i;try{i=await A(this.http.post(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/widget/generate`,n))}catch(g){if(g instanceof q){let p=g.error?.error||g.message;throw new Error(p)}throw g}if(i?.success===!1)throw new Error(i.error||"Request failed");let o=i?.data??i;if(!o?.config)throw new Error("Invalid response from widget generate API");let a=o;return await ye(a.config),a}async filterSuggest(t,e,n,i){let o=n.filter(p=>!!p.id).map(p=>({widgetId:p.id})),a;try{a=await A(this.http.post(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/dashboards/${t}/filter/suggest?status=${i??"draft"}`,{query:e,refreshCache:!1,widgets:o}))}catch(p){throw p instanceof q?new Error(p.error?.error||p.message):p}if(a?.success===!1)throw new Error(a.error||"Request failed");let g=a?.data??a??{};return{nextToken:g.nextToken,completions:Array.isArray(g.completions)?g.completions:[],suggestions:Array.isArray(g.suggestions)?g.suggestions:[]}}async applyFilters(t,e,n,i,o,a){let g=await new Promise((qe,ve)=>{let Ue=this.http.post(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/dashboards/${n}/filter/apply?status=${i??"draft"}`,Vt(t,e,a)).subscribe({next:I=>qe(I),error:I=>{I instanceof q?ve(new Error(I.error?.error||I.message)):ve(I)}});if(o){if(o.aborted){Ue.unsubscribe();let I=new Error("Aborted");I.name="AbortError",ve(I);return}o.addEventListener("abort",()=>{Ue.unsubscribe();let I=new Error("Aborted");I.name="AbortError",ve(I)},{once:!0})}});if(g?.success===!1)throw new Error(g.error||"Request failed");let p=g?.data??g,x=Array.isArray(p)?p:p?.widgets;if(!Array.isArray(x))throw new Error("Invalid response from apply-filters API");let N=!Array.isArray(p)&&Array.isArray(p?.resolvedFilters)?p.resolvedFilters:[],J=!Array.isArray(p)&&Array.isArray(p?.filterGroups)?p.filterGroups:[];return await Promise.all(x.map(qe=>ye(qe.config))),{widgets:x,resolvedFilters:N,filterGroups:J}}static \u0275fac=function(e){return new(e||r)};static \u0275prov=B({token:r,factory:r.\u0275fac,providedIn:"root"})};var en=["grid"];function tn(r,t){if(r&1&&w(0),r&2){let e=d(2);He(" ",e.widgetDetailPanelTitle," ")}}function nn(r,t){r&1&&h(0,"nile-skeleton-loader",6)}function rn(r,t){if(r&1&&h(0,"shared-dashboard-grid",8),r&2){let e=d(2);C("widgets",e.widgetDetailPanelWidgets)("widgetsLoading",e.widgetDetailPanelLoading)("editMode",!1)("selectable",!1)("canSetAlert",!1)("canAddToStory",!1)("canForecast",!1)}}function on(r,t){r&1&&(s(0,"div",9)(1,"div",10),h(2,"nile-skeleton-loader",11)(3,"nile-skeleton-loader",11)(4,"nile-skeleton-loader",11),l(),h(5,"nile-skeleton-loader",12),l())}function an(r,t){if(r&1){let e=M();s(0,"div",2)(1,"div",4)(2,"nile-breadcrumb",5),b("nile-click",function(){u(e);let i=d();return f(i.closeWidgetDetailPanel())}),s(3,"nile-breadcrumb-item"),w(4),l(),s(5,"nile-breadcrumb-item"),_(6,tn,1,1)(7,nn,1,0,"nile-skeleton-loader",6),l()()(),s(8,"div",7),_(9,rn,1,7,"shared-dashboard-grid",8)(10,on,6,0,"div",9),l()()}if(r&2){let e=d();c(4),He(" ",e.dashboardName," "),c(2),y(e.widgetDetailPanelTitle?6:7),c(3),y(e.widgetDetailPanelWidgets.length?9:e.widgetDetailPanelLoading?10:-1)}}var Ce=class r{widgets=[];dashboardId=null;applyingFilters=!1;widgetDetailPanelOpen=!1;widgetDetailPanelLoading=!1;widgetDetailPanelTitle=null;widgetDetailPanelWidgets=[];dashboardName=null;widgetDetailPanelSkeletonSlots=[];widgetDetailPanelSkeletonHeight(){return this.widgetDetailPanelSkeletonSlots.length?Math.max(...this.widgetDetailPanelSkeletonSlots.map(t=>(t.y+t.h)*72)):0}async onKpiWidgetClicked(t){if(this.widgetDetailPanelLoading)return;let e=t.config?._meta,n=e?.templateId??null,i=e?.detailPanel??null;if(!(!n&&!i)){this.beginCardMorph(t.id),this.runViewTransition(()=>{this.widgetDetailPanelOpen=!0,this.widgetDetailPanelLoading=!0,this.widgetDetailPanelTitle=i?.title??t.title??null,this.widgetDetailPanelSkeletonSlots=(i?.widgets??[]).map(o=>o.layout).filter(o=>!!o),this.widgetDetailPanelWidgets=this.detailPanelPlaceholders(i),this.cdr.markForCheck()});try{let o=i?await this.dashboardsService.previewWidgetDetailPanelDefinition(i):await this.dashboardsService.previewWidgetTemplateDetailPanel(String(n));if(!o.widgets.length){this.widgetDetailPanelOpen=!1;return}this.widgetDetailPanelTitle=o.title??t.title??null;let a=o.widgets.map((g,p)=>H(P({},g),{id:`detail-panel-${p}`}));this.widgetDetailPanelWidgets=a.every(g=>g.layout)?a:Le(a)}catch{this.widgetDetailPanelOpen=!1}finally{this.widgetDetailPanelLoading=!1,this.cdr.markForCheck()}}}detailPanelPlaceholders(t){let e=t?.widgets??[];if(!e.length)return[];let n=e.map((i,o)=>H(P({},i),{id:`detail-panel-${o}`}));return n.every(i=>i.layout)?n:Le(n)}closeWidgetDetailPanel(){this.runViewTransition(()=>{this.widgetDetailPanelOpen=!1,this.widgetDetailPanelTitle=null,this.widgetDetailPanelWidgets=[],this.widgetDetailPanelSkeletonSlots=[],this.cdr.markForCheck()},"back")}currentTimeRange=null;lastMonitoredTotal=null;isRefreshingData=!1;activeDashboardFilters=null;activeResolvedFilters=null;activeFilterGroups=[];applySummary=null;alertDrawerOpen=!1;alertWidget=null;alertFilterPredicates=null;alertFilterHasOr=!1;alertAuthoringMode="widget";alertSource=null;gridRef;http=v(K);zone=v(xe);navigator=v(G);openAiService=v($);dashboardsService=v(he);forecastService=v(Tt);cdr=v(st);appRef=v(it);hostEl=v(re);static MORPH_NAME="dv-detail-morph";morphSourceEl=null;beginCardMorph(t){if(!t||typeof CSS>"u"||!CSS.escape)return!1;let e=this.hostEl.nativeElement.querySelector(`.widget-card[data-widget-id="${CSS.escape(String(t))}"]`);if(!e)return!1;let n=e.getBoundingClientRect();return n.height>0&&n.bottom>0&&n.top<window.innerHeight?(e.style.viewTransitionName=r.MORPH_NAME,this.morphSourceEl=e,this.hostEl.nativeElement.classList.add("dv-morphing"),!0):!1}endCardMorph(){this.morphSourceEl&&(this.morphSourceEl.style.removeProperty("view-transition-name"),this.morphSourceEl=null),this.hostEl.nativeElement.classList.remove("dv-morphing")}runViewTransition(t,e="forward"){let n=document,i=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if(typeof n.startViewTransition!="function"||i){t(),this.endCardMorph();return}let o=document.documentElement;e==="back"&&(o.dataset.vtDirection="back");let a=()=>{delete o.dataset.vtDirection,this.endCardMorph()};n.startViewTransition(()=>{t(),this.appRef.tick()})?.finished?.then(a,a)??a()}sessionMap=new Map;primedFilterWidgets=new Set;filterSuggestCache=new Map;filterSuggestInflight=new Set;applyFiltersSeq=0;applyFiltersAbort;viewInited=!1;openInBuilder(){!this.dashboardId||!D().features.edit||this.navigator.toBuilder(this.dashboardId)}set config(t){let e=t?.id??null,n=e!==this.dashboardId;if(n&&(this.primedFilterWidgets.clear(),this.filterSuggestCache.clear(),this.filterSuggestInflight.clear(),this.activeDashboardFilters=null,this.activeResolvedFilters=null,this.activeFilterGroups=[],this.applySummary=null,this.currentTimeRange=null,this.lastMonitoredTotal=null),!t){this.widgets=[],this.dashboardId=null,this.alertSource=null,this.dashboardName=null;return}this.dashboardId=e,this.dashboardName=t.name??null,this.alertSource={connectionId:t.connectionId,isPipeline:t.isPipeline,adapterType:t.adapterType},this.widgets=(t.widgets??[]).map(o=>({id:o.id,title:o.title??"",widgetType:o.type??"chart",layout:o.layout,config:o.nileConfig,drilldownBy:o.drilldownBy,dataSourceId:o.dataSourceId,queryMeta:o.queryMeta,category:o.category??null})),this.forecastable=t.forecastable??{};let i=this.collectInitialFilters(this.widgets);i?this.applyInitialFilters(i):n&&t.canRefresh&&this.refreshLoadedDashboardData(e),this.viewInited&&queueMicrotask(()=>this.primeFilterWidgets())}async refreshLoadedDashboardData(t){this.isRefreshingData=!0;try{let{widgets:e}=await this.dashboardsService.refreshDashboard(t);this.dashboardId===t&&!this.activeDashboardFilters&&(this.widgets=e.map(n=>({id:n.id,title:n.title??"",widgetType:n.type??"chart",layout:n.layout,config:n.nileConfig,drilldownBy:n.drilldownBy,dataSourceId:n.dataSourceId,queryMeta:n.queryMeta,category:n.category??null})))}catch(e){console.error("Failed to refresh dashboard data:",e)}finally{this.isRefreshingData=!1,this.cdr.markForCheck()}}collectInitialFilters(t){let e={};for(let n of t){let i=n.config?.chart;if(i?.type==="filter")for(let o of i.controls??[]){if(!o.id)continue;let a=o.value;a!=null&&(typeof a=="string"&&a.trim()===""||(e[o.id]=a))}}return Object.keys(e).length>0?e:null}async applyInitialFilters(t){let e=this.widgets.filter(o=>!pe(o));if(e.length===0||!this.dashboardId)return;this.applyFiltersAbort?.abort();let n=new AbortController;this.applyFiltersAbort=n;let i=++this.applyFiltersSeq;this.applyingFilters=!0;try{let{widgets:o,resolvedFilters:a,filterGroups:g}=await this.openAiService.applyFilters(e,t,this.dashboardId,"published",n.signal,{timeRange:this.currentTimeRange??void 0});if(i!==this.applyFiltersSeq)return;this.widgets=ge(this.widgets,o),this.activeDashboardFilters=t,this.activeResolvedFilters=a,this.activeFilterGroups=g,this.applySummary=Fe(o,this.buildActiveFilters(t))}catch(o){if(o?.name==="AbortError")return;console.error("Apply initial filters failed:",o)}finally{i===this.applyFiltersSeq&&(this.applyingFilters=!1),this.cdr.markForCheck()}}ngAfterViewInit(){this.viewInited=!0,queueMicrotask(()=>this.primeFilterWidgets())}alertTargetWidget(){let t=this.widgets.filter(n=>!pe(n)),e=t.filter(n=>!!n.config?.chart?.gridId);return e.length===1?e[0]:t.find(n=>!!n.queryMeta?.sql)??null}onWidgetPatchedByGrid(t){this.widgets=this.widgets.map(e=>e.id===t.id?t:e),this.cdr.markForCheck()}forecastable={};forecastBusy=new Set;forecastingWidgetId=null;async onForecast(t){let e=this.dashboardId,n=String(t.widget.id);if(!(!e||this.forecastBusy.has(n))){this.forecastBusy.add(n),this.forecastingWidgetId=n,this.cdr.markForCheck();try{let i=t.enable?await this.forecastService.addToWidget(e,n,t.settings??{}):await this.forecastService.removeFromWidget(e,n);if(t.enable&&i?.guardrails&&i.guardrails.passed===!1)return;i?.widget&&this.applyForecastedWidget(i.widget),_e({variant:"success",title:t.enable?t.settings?"Forecast updated":"Forecast added":"Forecast removed",content:t.enable?"The projection is shown with its confidence range.":"The chart is back to its measured history."})}catch{}finally{this.forecastBusy.delete(n),this.forecastingWidgetId=null,this.cdr.markForCheck()}}}applyForecastedWidget(t){this.widgets=this.widgets.map(e=>String(e.id)===String(t.id)?H(P({},e),{config:t.config?.chart??t.nileConfig??e.config,queryMeta:t.queryMeta??e.queryMeta}):e)}onSetAlert(t){if(pe(t)){let e=this.alertTargetWidget();if(!e)return;this.alertWidget=e,this.alertFilterPredicates=this.activeResolvedFilters,this.alertFilterHasOr=this.activeFilterGroups.length>1,this.alertAuthoringMode="filter"}else this.alertWidget=t,this.alertFilterPredicates=null,this.alertFilterHasOr=!1,this.alertAuthoringMode="widget";this.alertDrawerOpen=!0,this.cdr.markForCheck()}onAlertClosed(){this.alertDrawerOpen=!1,this.cdr.markForCheck()}onAlertSaved(){this.alertDrawerOpen=!1,this.cdr.markForCheck()}onFilterChange(t){let e=t.widgetId,n=t.controlId;!e||!n||this.dashboardId&&this.fetchSuggestionsOnce(e,n,this.dashboardId)}fetchSuggestionsOnce(t,e,n){let i=this.filterSuggestCache.get(t);if(i){this.gridRef?.patchFilterSuggestions(t,e,i);return}this.filterSuggestInflight.has(t)||(this.filterSuggestInflight.add(t),(async()=>{try{let o=await this.openAiService.filterSuggest(n,"",this.widgets,"published");this.applyFilterSuggestions(t,e,o)}catch(o){console.warn("Filter suggest failed:",o)}finally{this.filterSuggestInflight.delete(t)}})())}async onFilterSubmit(t){if(this.isEmptyFilters(t.filters)){await this.reloadDashboard();return}let e=this.widgets.filter(o=>!pe(o));if(e.length===0||!this.dashboardId)return;this.applyFiltersAbort?.abort();let n=new AbortController;this.applyFiltersAbort=n;let i=++this.applyFiltersSeq;this.applyingFilters=!0;try{let{widgets:o,resolvedFilters:a,filterGroups:g}=await this.openAiService.applyFilters(e,t.filters,this.dashboardId,"published",n.signal,{mode:t.mode,prompt:t.prompt,timeRange:this.currentTimeRange??void 0});if(i!==this.applyFiltersSeq)return;this.widgets=ge(this.widgets,o),this.activeDashboardFilters=t.filters,this.lastMonitoredTotal=null,this.activeResolvedFilters=a,this.activeFilterGroups=g,this.applySummary=Fe(o,this.buildActiveFilters(t.filters))}catch(o){if(o?.name==="AbortError")return;console.error("Apply filters failed:",o)}finally{i===this.applyFiltersSeq&&(this.applyingFilters=!1),this.cdr.markForCheck()}}async applyTimeRange(t){this.currentTimeRange=t;let e=this.widgets.filter(o=>!pe(o));if(e.length===0||!this.dashboardId)return;this.applyFiltersAbort?.abort();let n=new AbortController;this.applyFiltersAbort=n;let i=++this.applyFiltersSeq;this.applyingFilters=!0;try{let o=this.activeDashboardFilters??{},{widgets:a,resolvedFilters:g,filterGroups:p}=await this.openAiService.applyFilters(e,o,this.dashboardId,"published",n.signal,{resolvedFilters:this.activeResolvedFilters??[],timeRange:t??void 0});if(i!==this.applyFiltersSeq)return;this.widgets=ge(this.widgets,a),this.activeResolvedFilters=g,this.activeFilterGroups=p,this.applySummary=Fe(a,this.buildActiveFilters(o)),t&&this.checkForNewSinceLastCheck(t)}catch(o){if(o?.name==="AbortError")return;console.error("Apply time range failed:",o)}finally{i===this.applyFiltersSeq&&(this.applyingFilters=!1),this.cdr.markForCheck()}}checkForNewSinceLastCheck(t){if(!(Math.abs(Date.now()-new Date(t.to).getTime())<6e4))return;let n=this.kpiTotal(this.widgets);n!=null&&(this.lastMonitoredTotal=n)}kpiTotal(t){let e=0,n=!1;for(let i of t){let o=i.config?.chart;if(o?.type!=="kpi")continue;let a=Number(o.value);Number.isFinite(a)&&(e+=a,n=!0)}return n?e:null}buildActiveFilters(t){return Nt(t,e=>this.filterFieldLabel(e))}filterFieldLabel(t){for(let e of this.filterSuggestCache.values()){let n=e.find(i=>i.type==="attribute"&&i.id===t);if(n)return n.label}return t}isEmptyFilters(t){if(!t)return!0;for(let e of Object.values(t))if(e!=null&&!(typeof e=="string"&&e.trim()==="")&&!(typeof e=="object"&&Object.keys(e).length===0))return!1;return!0}async reloadDashboard(){if(!this.dashboardId)return;this.applyFiltersAbort?.abort();let t=++this.applyFiltersSeq;this.applyingFilters=!0,this.activeDashboardFilters=null,this.lastMonitoredTotal=null,this.activeResolvedFilters=null,this.activeFilterGroups=[],this.applySummary=null;try{let e=await this.dashboardsService.fetchDashboard(this.dashboardId);if(t!==this.applyFiltersSeq)return;this.widgets=(e.widgets??[]).map(n=>({id:n.id,title:n.title??"",widgetType:n.type??"chart",layout:n.layout,config:zt(n.nileConfig),drilldownBy:n.drilldownBy,dataSourceId:n.dataSourceId,queryMeta:n.queryMeta,category:n.category??null}))}catch(e){console.error("Reload dashboard failed:",e)}finally{t===this.applyFiltersSeq&&(this.applyingFilters=!1),this.cdr.markForCheck()}this.currentTimeRange&&t===this.applyFiltersSeq&&await this.applyTimeRange(this.currentTimeRange)}primeFilterWidgets(){if(this.dashboardId)for(let t of this.widgets){if(this.primedFilterWidgets.has(t.id))continue;let e=t.config?.chart;if(e?.type!=="filter")continue;let n=e.controls?.find(i=>i.variant==="prompt"||i.variant==="expression"||i.variant==="hybrid")??e.controls?.find(i=>i.id);n?.id&&(this.primedFilterWidgets.add(t.id),this.fetchSuggestionsOnce(t.id,n.id,this.dashboardId))}}applyFilterSuggestions(t,e,n){let i=Array.isArray(n.suggestions)?n.suggestions:[];if(!i.length){n.nextToken&&i.push({id:n.nextToken.value,label:n.nextToken.label,type:"attribute"});for(let o of n.completions)i.push({label:o,type:"suggestion"})}i.length!==0&&(this.filterSuggestCache.set(t,i),this.gridRef?.patchFilterSuggestions(t,e,i))}async onAiSend(t){if(!this.dashboardId)return;let e=this.sessionMap.get(t.widgetId)??t.sessionId;this.sessionMap.set(t.widgetId,e);try{let n=Zt(),i=await A(this.http.post(`${k.baseUrl}/api/customers/${n}/products/${O()}/workforce/dashboards/${this.dashboardId}/widgets/${t.widgetId}/chat`,{message:t.message,sessionId:e})),o=i?.reply?.content;o&&(this.sessionMap.set(t.widgetId,i.sessionId??e),this.zone.run(()=>{t.chartEl?.addAiResponse?.(o)}))}catch(n){console.error("Chat request failed:",n),this.zone.run(()=>{t.chartEl?.addAiResponse?.("Sorry, I couldn't process your request. Please try again.")})}}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=z({type:r,selectors:[["app-dashboard-viewer"]],viewQuery:function(e,n){if(e&1&&ae(en,5),e&2){let i;j(i=Z())&&(n.gridRef=i.first)}},inputs:{config:"config"},features:[se([{provide:Mt,useFactory:t=>t.fetchGridPage.bind(t),deps:[$]},{provide:kt,useFactory:t=>t.fetchFilterValues.bind(t),deps:[T]},Oe(T),ke(T),Se(T),Te(T)])],decls:4,vars:21,consts:[["grid",""],[3,"forecast","aiSend","openAiBuilder","filterSubmit","filterChange","widgetChartTypeChanged","widgetFiltersChanged","widgetColorChanged","setAlert","widgetClick","widgets","editMode","dashboardId","persistToPublished","widgetsLoading","dashboardFilters","resolvedFilters","applySummary","canSetAlert","canAddToStory","canForecast","forecastable","forecastingWidgetId"],[1,"aq-detail-overlay"],[3,"closed","saved","open","widget","dashboardId","source","filterPredicates","filterHasOr","authoringMode"],[1,"aq-detail-overlay__crumbs"],[3,"nile-click"],["variant","text","width","160","height","16"],[1,"aq-detail-overlay__body"],[3,"widgets","widgetsLoading","editMode","selectable","canSetAlert","canAddToStory","canForecast"],[1,"aq-detail-skeleton"],[1,"aq-detail-skeleton__row"],["variant","rectangular","width","100%","height","96","border-radius","12px"],["variant","rectangular","width","100%","height","280","border-radius","12px"]],template:function(e,n){e&1&&(s(0,"shared-dashboard-grid",1,0),b("forecast",function(o){return n.onForecast(o)})("aiSend",function(o){return n.onAiSend(o)})("openAiBuilder",function(){return n.openInBuilder()})("filterSubmit",function(o){return n.onFilterSubmit(o)})("filterChange",function(o){return n.onFilterChange(o)})("widgetChartTypeChanged",function(o){return n.onWidgetPatchedByGrid(o)})("widgetFiltersChanged",function(o){return n.onWidgetPatchedByGrid(o)})("widgetColorChanged",function(o){return n.onWidgetPatchedByGrid(o)})("setAlert",function(o){return n.onSetAlert(o)})("widgetClick",function(o){return n.onKpiWidgetClicked(o)}),l(),_(2,an,11,3,"div",2),s(3,"app-alert-drawer",3),b("closed",function(){return n.onAlertClosed()})("saved",function(){return n.onAlertSaved()}),l()),e&2&&(C("widgets",n.widgets)("editMode",!1)("dashboardId",n.dashboardId)("persistToPublished",!0)("widgetsLoading",n.applyingFilters||n.isRefreshingData)("dashboardFilters",n.activeDashboardFilters)("resolvedFilters",n.activeResolvedFilters)("applySummary",n.applySummary)("canSetAlert",!0)("canAddToStory",!1)("canForecast",!0)("forecastable",n.forecastable)("forecastingWidgetId",n.forecastingWidgetId),c(2),y(n.widgetDetailPanelOpen?2:-1),c(),C("open",n.alertDrawerOpen)("widget",n.alertWidget)("dashboardId",n.dashboardId)("source",n.alertSource)("filterPredicates",n.alertFilterPredicates)("filterHasOr",n.alertFilterHasOr)("authoringMode",n.alertAuthoringMode))},dependencies:[De,Ae,Ee],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;position:relative;height:100%;view-transition-name:dv-viewer-pane}.aq-detail-overlay[_ngcontent-%COMP%]{position:absolute;inset:0;z-index:50;display:flex;flex-direction:column;background:#fff;view-transition-name:dv-detail-morph}.dv-morphing[_nghost-%COMP%]{view-transition-name:none}.aq-detail-overlay__crumbs[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;box-sizing:border-box;min-height:56px;padding:10px 20px;border-bottom:1px solid #eaecf0;flex-shrink:0}.aq-detail-overlay__crumbs[_ngcontent-%COMP%] nile-breadcrumb[_ngcontent-%COMP%]{display:inline-flex;align-items:center}.aq-detail-overlay__body[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;overflow:auto;padding:20px;background:var(--nile-color-bg-subtle, #fbfbfd)}.aq-detail-skeleton[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.aq-detail-skeleton__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.aq-detail-skeleton-grid[_ngcontent-%COMP%]{position:relative;width:100%}.aq-detail-skeleton-slot[_ngcontent-%COMP%]{position:absolute}.dv-skel-card[_ngcontent-%COMP%]{height:100%;display:flex;flex-direction:column;box-sizing:border-box;background:var(--ng-colors-bg-primary, #fff);border-radius:var(--ng-radius-xl, 12px);box-shadow:var(--ng-shadow-sm);overflow:hidden}.dv-skel-card__head[_ngcontent-%COMP%]{padding:13px 14px;border-bottom:1px solid #eef1f6;flex-shrink:0}.dv-skel-card__body[_ngcontent-%COMP%]{flex:1;min-height:0;padding:12px 14px}.dv-skel-card__body[_ngcontent-%COMP%] nile-skeleton-loader[_ngcontent-%COMP%], .dv-skel-card__body[_ngcontent-%COMP%] nile-skeleton-loader[_ngcontent-%COMP%]::part(base){height:100%}']})};var Re=class r{http=v(K);tokenStore=v(ce);get customerId(){return this.tokenStore.tenantId()??""}async chat(t,e,n,i){let o=await new Promise((a,g)=>{let p=this.http.post(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/dashboards/${e}/chat`,{message:t,sessionId:n}).subscribe({next:x=>a(x),error:x=>{x instanceof q?g(new Error(x.error?.error||x.message)):g(x)}});if(i){if(i.aborted){p.unsubscribe();let x=new Error("Aborted");x.name="AbortError",g(x);return}i.addEventListener("abort",()=>{p.unsubscribe();let x=new Error("Aborted");x.name="AbortError",g(x)},{once:!0})}});if(!o?.success)throw new Error("Chat request failed");return o}async getSuggestions(t){if(!t)return[];let e;try{e=await A(this.http.get(`${k.baseUrl}/api/customers/${this.customerId}/products/${O()}/workforce/dashboards/${t}/chat/suggestions`))}catch(n){throw n instanceof q?new Error(n.error?.error||n.message):n}if(Array.isArray(e))return e;if(e.success===!1)throw new Error("Suggestions request failed");return e.suggestions??e.data??[]}static \u0275fac=function(e){return new(e||r)};static \u0275prov=B({token:r,factory:r.\u0275fac,providedIn:"root"})};var ln=["sliderGrid"],dn=r=>({"recommend-window":r}),cn=()=>({variant:"welcome"}),gn=()=>[1,2,3,4],pn=r=>({"mic-listening":r}),hn=r=>({disabled:r}),Yt=(r,t)=>t.title;function mn(r,t){r&1&&V(0)}function un(r,t){r&1&&(s(0,"div",18),h(1,"nile-skeleton-loader",19),l())}function fn(r,t){r&1&&(s(0,"div",17),F(1,un,2,0,"div",18,U),l()),r&2&&(c(),E(ne(0,gn)))}function bn(r,t){if(r&1){let e=M();s(0,"button",23),b("click",function(){let i=u(e).$implicit,o=d(5);return f(o.runPrompt(i.title))}),s(1,"div",24),h(2,"nile-icon",25),l(),s(3,"span",26),w(4),l()()}if(r&2){let e=t.$implicit;c(4),W(e.title)}}function _n(r,t){if(r&1){let e=M();s(0,"div",17),F(1,bn,5,1,"button",20,Yt),l(),s(3,"button",21),b("click",function(){u(e);let i=d(4);return f(i.openPromptGallery())}),h(4,"nile-glyph",22),s(5,"span"),w(6,"View prompt gallery"),l()()}if(r&2){let e=d(4);c(),E(e.topRecommended())}}function yn(r,t){if(r&1&&(s(0,"div",9)(1,"div",12),h(2,"nile-icon",13),l(),s(3,"h2",14),w(4,"What would you like to ask?"),l(),s(5,"p",15),w(6,"Ask anything about your dashboard."),l(),L(7,mn,1,0,"ng-container",16),_(8,fn,3,1,"div",17)(9,_n,7,0),l()),r&2){let e=d(3),n=R(3);c(7),C("ngTemplateOutlet",n)("ngTemplateOutletContext",ne(3,cn)),c(),y(e.loadingSuggestions()?8:e.recommended().length>0?9:-1)}}function Cn(r,t){r&1&&(s(0,"div",10),h(1,"nile-icon",27),s(2,"div",28),w(3,"Generating your answer..."),l()()),r&2&&(c(),C("name","loader")("size","20"))}function vn(r,t){if(r&1&&(s(0,"div",29)(1,"div",30)(2,"span"),w(3),l()()()),r&2){let e=d().$implicit;c(3),W(e.content)}}function xn(r,t){if(r&1&&(s(0,"div")(1,"div",31),h(2,"nile-glyph",32),l(),s(3,"div",33),h(4,"div",34),l()()),r&2){let e=d().$implicit;c(4),C("innerHTML",e.content,nt)}}function wn(r,t){if(r&1&&(_(0,vn,4,1,"div",29),_(1,xn,5,1,"div")),r&2){let e=t.$implicit;y(e.role==="user"?0:-1),c(),y(e.role==="assistant"?1:-1)}}function Pn(r,t){r&1&&V(0)}function Mn(r,t){if(r&1&&L(0,Pn,1,0,"ng-container",35),r&2){d(3);let e=R(3);C("ngTemplateOutlet",e)}}function Dn(r,t){if(r&1){let e=M();s(0,"button",23),b("click",function(){let i=u(e).$implicit,o=d(4);return f(o.onGalleryPromptClick(i.title))}),s(1,"div",24),h(2,"nile-icon",25),l(),s(3,"span",26),w(4),l()()}if(r&2){let e=t.$implicit;c(4),W(e.title)}}function kn(r,t){if(r&1){let e=M();s(0,"div",11)(1,"div",36)(2,"span",37),w(3,"Prompt gallery"),l(),s(4,"button",38),b("click",function(){u(e);let i=d(3);return f(i.closePromptGallery())}),h(5,"nile-glyph",39),l()(),s(6,"div",40)(7,"p",41),w(8,"Pick a suggestion to get started."),l(),s(9,"div",42),F(10,Dn,5,1,"button",20,Yt),l()()()}if(r&2){let e=d(3);c(10),E(e.recommended())}}function Sn(r,t){if(r&1){let e=M();s(0,"div",6)(1,"nile-glyph",7),b("click",function(){u(e);let i=d(2);return f(i.closePanel.emit())}),l()(),s(2,"div",8),_(3,yn,10,4,"div",9),_(4,Cn,4,2,"div",10),F(5,wn,2,2,null,null,U),l(),_(7,Mn,1,1,"ng-container"),_(8,kn,12,0,"div",11)}if(r&2){let e,n,i,o,a=d(2);c(2),C("ngClass",le(5,dn,!(!((e=a.chatsDetails())==null||e.message==null)&&e.message.length))),c(),y(!((n=a.chatsDetails())==null||n.message==null)&&n.message.length?-1:3),c(),y(a.isGenerating()?4:-1),c(),E((i=a.chatsDetails())==null?null:i.message),c(2),y(!((o=a.chatsDetails())==null||o.message==null)&&o.message.length?7:-1),c(),y(a.showPromptGallery()?8:-1)}}function On(r,t){if(r&1){let e=M();s(0,"div",43),b("pointerdown",function(i){u(e);let o=d(2);return f(o.onResizeStart(i))})("pointermove",function(i){u(e);let o=d(2);return f(o.onResizeMove(i))})("pointerup",function(i){u(e);let o=d(2);return f(o.onResizeEnd(i))})("pointercancel",function(i){u(e);let o=d(2);return f(o.onResizeEnd(i))}),l(),s(1,"div",44)(2,"div",45)(3,"shared-dashboard-grid",46,1),b("filterSubmit",function(i){u(e);let o=d(2);return f(o.onSliderFilterSubmit(i))})("filterChange",function(i){u(e);let o=d(2);return f(o.onSliderFilterChange(i))})("widgetChartTypeChanged",function(i){u(e);let o=d(2);return f(o.onSliderWidgetPatched(i))})("widgetFiltersChanged",function(i){u(e);let o=d(2);return f(o.onSliderWidgetPatched(i))})("setAlert",function(i){u(e);let o=d(2);return f(o.onSetAlert(i))}),l(),s(5,"app-alert-drawer",47),b("closed",function(){u(e);let i=d(2);return f(i.onAlertClosed())})("saved",function(){u(e);let i=d(2);return f(i.onAlertClosed())}),l()()()}if(r&2){let e=d(2);c(3),C("widgets",e.sliderWidgets())("editMode",!1)("outerMargin",!1)("dashboardId",e.dashboardId())("dashboardFilters",e.activeDashboardFilters())("resolvedFilters",e.activeResolvedFilters())("persistToPublished",!0)("canSetAlert",!0)("canAddToStory",!1),c(2),C("open",e.alertDrawerOpen())("widget",e.alertWidget())("dashboardId",e.dashboardId())("source",e.alertSource())}}function Tn(r,t){if(r&1&&(s(0,"div",4)(1,"div",5),_(2,Sn,9,7),l(),_(3,On,6,13),l()),r&2){let e=d();te("chat-layout--resizing",e.isResizing()),c(),at("flex",e.chatColumnWidthPct()!==null?"0 0 "+e.chatColumnWidthPct()+"%":null),te("chat-column--split",!!e.dashboardConfig()&&!e.chatOnly()),c(),y(e.loadingChat()?-1:2),c(),y(e.dashboardConfig()&&!e.chatOnly()?3:-1)}}function An(r,t){if(r&1){let e=M();s(0,"div",48)(1,"label",49)(2,"input",50),b("input",function(i){u(e);let o=d();return f(o.queryString.set(i.target.value))})("keyup.enter",function(){u(e);let i=d();return f(i.postMessage())}),l(),s(3,"div",51)(4,"div",52)(5,"nile-glyph",53),b("click",function(){u(e);let i=d();return f(i.toggleMic())}),l(),s(6,"nile-glyph",54),b("click",function(){u(e);let i=d();return f(i.isGenerating()?i.cancelGenerate():i.postMessage())}),l()()()()()}if(r&2){let e=t.variant,n=d();te("input-query-container--welcome",e==="welcome"),c(2),C("value",n.queryString()),c(3),C("name",n.isMicListening()?"ng-mic":"ng-mic-off")("ngClass",le(8,pn,n.isMicListening())),c(),C("name",n.isGenerating()?"ng-circle-stop":"ng-send")("size",n.isGenerating()?"18":"16")("ngClass",le(10,hn,!n.isGenerating()&&!n.queryString()))}}var Ne=class r{constructor(t,e,n){this.chatService=t;this.openAiService=e;this.sanitizer=n;X(()=>{let o=this.dashboardId();o&&this.loadSuggestions(o)});let i=null;X(()=>{let o=this.dashboardConfig(),a=o?.id??null;a!==i&&(this.primedFilterWidgets.clear(),i=a);let g=(o?.widgets??[]).map(p=>({id:p.id,title:p.title??"",widgetType:p.type??"chart",layout:p.layout,config:p.nileConfig,drilldownBy:p.drilldownBy,queryMeta:p.queryMeta,dataSourceId:p.dataSourceId}));this.sliderWidgets.set(g),queueMicrotask(()=>this.primeFilterWidgets())})}chatService;openAiService;sanitizer;closePanel=new me;dashboardId=Y("");dashboardName=Y("");dashboardConfig=Y(null);chatOnly=Y(!1);initialPrompt=Y("");allChats=m([]);chatsDetails=m(null);isGenerating=m(!1);queryString=m("");searchTerm=m("");selectedChatContextId=m("");loadingChat=m(!1);loadingAllChat=m(!1);isDeleting=m(!1);isMicListening=m(!1);recognition=null;micBaseText="";silenceTimer=null;micSilenceMs=5e3;recommended=m([]);topRecommended=S(()=>this.recommended().slice(0,4));loadingSuggestions=m(!1);showPromptGallery=m(!1);chatColumnWidthPct=m(null);isResizing=m(!1);resizeRect=null;resizePointerId=null;resizeRafPending=!1;sliderWidgets=m([]);activeDashboardFilters=m(null);activeResolvedFilters=m(null);alertDrawerOpen=m(!1);alertWidget=m(null);onSetAlert(t){this.alertWidget.set(t),this.alertDrawerOpen.set(!0)}onSliderWidgetPatched(t){this.sliderWidgets.update(e=>e.map(n=>n.id===t.id?t:n))}onAlertClosed(){this.alertDrawerOpen.set(!1)}alertSource=S(()=>{let t=this.dashboardConfig();return t?{connectionId:t.connectionId,isPipeline:t.isPipeline,adapterType:t.adapterType}:null});sliderGridRef;applyingFilters=m(!1);filterSuggestTimers=new Map;filterSuggestSeq=new Map;primedFilterWidgets=new Set;applyFiltersSeq=0;applyFiltersAbort;generateAbort;formattedChats=S(()=>this.buildFormattedChats(this.allChats()));filteredFormattedChats=S(()=>{let t=this.formattedChats(),e=this.searchTerm().toLowerCase().trim();if(!e)return t;let n=i=>i.filter(o=>o.displayName.toLowerCase().includes(e));return{today:n(t.today),yesterday:n(t.yesterday),older:n(t.older)}});ngOnInit(){this.createNewChat();let t=this.initialPrompt();t&&(this.queryString.set(t),this.postMessage())}async loadSuggestions(t){this.loadingSuggestions.set(!0);try{let e=await this.chatService.getSuggestions(t);this.recommended.set(e.map(n=>({title:n})))}catch(e){console.error("Failed to load chat suggestions:",e),this.recommended.set([])}finally{this.loadingSuggestions.set(!1)}}runPrompt(t){this.queryString.set(t),this.postMessage()}openPromptGallery(){this.showPromptGallery.set(!0)}closePromptGallery(){this.showPromptGallery.set(!1)}onGalleryPromptClick(t){this.closePromptGallery(),this.runPrompt(t)}isFilterWidget(t){return t?.config?.chart?.type==="filter"}onSliderFilterChange(t){let e=t.widgetId,n=t.controlId;if(!e||!n)return;let i=this.dashboardId();if(!i)return;let o=this.filterSuggestTimers.get(e);o&&clearTimeout(o);let a=(t.query??"").trim();if(!a)return;let g=(this.filterSuggestSeq.get(e)??0)+1;this.filterSuggestSeq.set(e,g);let p=setTimeout(async()=>{try{let x=this.sliderWidgets(),N=await this.openAiService.filterSuggest(i,a,x,"published");if(this.filterSuggestSeq.get(e)!==g)return;this.applyFilterSuggestions(e,n,N)}catch(x){console.warn("Filter suggest failed:",x)}},400);this.filterSuggestTimers.set(e,p)}async onSliderFilterSubmit(t){let e=this.sliderWidgets(),n=e.filter(a=>!this.isFilterWidget(a));if(n.length===0)return;this.applyFiltersAbort?.abort();let i=new AbortController;this.applyFiltersAbort=i;let o=++this.applyFiltersSeq;this.applyingFilters.set(!0);try{let{widgets:a,resolvedFilters:g}=await this.openAiService.applyFilters(n,t.filters,this.dashboardId(),"published",i.signal,{mode:t.mode,prompt:t.prompt});if(o!==this.applyFiltersSeq)return;this.sliderWidgets.set(ge(e,a)),this.activeDashboardFilters.set(t.filters),this.activeResolvedFilters.set(g)}catch(a){if(a?.name==="AbortError"||o!==this.applyFiltersSeq)return;let g=a instanceof Error?a.message:"Failed to apply filters.";this.pushSystemMessage("error",`Apply filters failed: ${g}`)}finally{o===this.applyFiltersSeq&&this.applyingFilters.set(!1)}}primeFilterWidgets(){let t=this.dashboardId();if(!t)return;let e=this.sliderWidgets();for(let n of e){if(this.primedFilterWidgets.has(n.id))continue;let i=n.config?.chart;if(i?.type!=="filter")continue;let o=i.controls?.find(g=>g.variant==="expression"||g.variant==="hybrid");if(!o?.id)continue;this.primedFilterWidgets.add(n.id);let a=o.id;(async()=>{try{let g=await this.openAiService.filterSuggest(t,"",e,"published");this.applyFilterSuggestions(n.id,a,g)}catch(g){this.primedFilterWidgets.delete(n.id),console.warn("Filter suggest prime failed:",g)}})()}}applyFilterSuggestions(t,e,n){let i=Array.isArray(n.suggestions)?n.suggestions:[];if(!i.length){n.nextToken&&i.push({id:n.nextToken.value,label:n.nextToken.label,type:"attribute"});for(let o of n.completions)i.push({label:o,type:"suggestion"})}i.length!==0&&this.sliderGridRef?.patchFilterSuggestions(t,e,i)}onResizeStart(t){t.preventDefault();let e=t.currentTarget,n=e.parentElement;n&&(this.resizeRect=n.getBoundingClientRect(),e.setPointerCapture(t.pointerId),this.resizePointerId=t.pointerId,this.isResizing.set(!0))}onResizeMove(t){if(!this.isResizing()||!this.resizeRect)return;let n=(t.clientX-this.resizeRect.left)/this.resizeRect.width*100,i=Math.min(75,Math.max(20,n));this.chatColumnWidthPct.set(i),this.scheduleGridReflow()}onResizeEnd(t){let e=t.currentTarget;this.resizePointerId!==null&&e.hasPointerCapture?.(this.resizePointerId)&&e.releasePointerCapture(this.resizePointerId),this.isResizing.set(!1),this.resizeRect=null,this.resizePointerId=null,this.scheduleGridReflow()}scheduleGridReflow(){this.resizeRafPending||(this.resizeRafPending=!0,requestAnimationFrame(()=>{this.resizeRafPending=!1,window.dispatchEvent(new Event("resize"))}))}createNewChat(){let t={id:crypto.randomUUID(),displayName:"New Chat",createdOn:new Date().toISOString(),sessionId:crypto.randomUUID(),message:[]};this.allChats.update(e=>[t,...e]),this.getChatDetails(t.id)}getChatDetails(t){this.selectedChatContextId.set(t);let e=this.allChats().find(n=>n.id===t);e&&this.chatsDetails.set(e),this.loadingChat.set(!1)}deleteChat(t){if(this.isDeleting.set(!0),this.allChats.update(e=>e.filter(n=>n.id!==t)),this.isDeleting.set(!1),this.chatsDetails()?.id===t){let e=this.allChats();e.length?this.getChatDetails(e[0].id):this.createNewChat()}}onSearchChat(t){this.searchTerm.set(t)}async postMessage(){let t=this.queryString().trim();if(!t||this.isGenerating())return;this.chatsDetails()||this.createNewChat();let e=this.chatsDetails();e.message.unshift({role:"user",content:t}),e.displayName==="New Chat"&&(e.displayName=t.length>20?t.substring(0,20):t,this.allChats.update(i=>[...i])),this.chatsDetails.set(P({},e)),this.queryString.set(""),this.isGenerating.set(!0);let n=new AbortController;this.generateAbort=n;try{let i=await this.chatService.chat(t,this.dashboardId(),e.sessionId,n.signal);e.sessionId=i.sessionId,e.message.unshift({role:"assistant",content:this.sanitizeHtml(i.reply.content)})}catch(i){if(i instanceof Error&&i.name==="AbortError")e.message=e.message.filter((o,a)=>!(a===0&&o.role==="user"));else{let o=i instanceof Error?i.message:"Failed to get response.";this.pushSystemMessage("error",`Chat failed: ${o}`)}}finally{this.generateAbort===n&&(this.generateAbort=void 0),this.chatsDetails.set(P({},e)),this.isGenerating.set(!1)}}cancelGenerate(){this.generateAbort?.abort()}toggleMic(){this.isMicListening()?(this.clearSilenceTimer(),this.recognition?.stop()):this.startListening()}startListening(){let t=window,e=t.SpeechRecognition??t.webkitSpeechRecognition;e&&(this.micBaseText=this.queryString(),this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.lang="en-US",this.recognition.onresult=n=>{let i="";for(let a=0;a<n.results.length;a++)i+=n.results[a][0].transcript;let o=this.micBaseText&&!this.micBaseText.endsWith(" ")?" ":"";this.queryString.set(this.micBaseText+o+i),this.resetSilenceTimer()},this.recognition.onend=()=>{this.clearSilenceTimer(),this.isMicListening.set(!1),this.recognition=null},this.recognition.start(),this.isMicListening.set(!0),this.resetSilenceTimer())}resetSilenceTimer(){this.clearSilenceTimer(),this.silenceTimer=setTimeout(()=>{this.silenceTimer=null,this.recognition?.stop(),this.queryString().trim()&&this.postMessage()},this.micSilenceMs)}clearSilenceTimer(){this.silenceTimer!==null&&(clearTimeout(this.silenceTimer),this.silenceTimer=null)}pushSystemMessage(t,e){let n=this.chatsDetails();if(!n){t==="success"&&this.showToast("Done",e);return}let i=String(e).trim().replace(/[.!?]+$/,"").replace(/[<>&]/g,a=>a==="<"?"<":a===">"?">":"&"),o=t==="error"?`ERROR: ${i}!`:i;n.message.unshift({role:"assistant",content:this.sanitizeHtml(`<p class="chat-system chat-system--${t}">${o}</p>`)}),this.chatsDetails.set(P({},n))}showToast(t,e){let n=document.createElement("nile-toast");n.variant="success",n.title=t,n.content=e,n.duration=5e3,n.closable=!0,n.toast(),Ft()}sanitizeHtml(t){return this.sanitizer.sanitize(tt.HTML,t)??""}buildFormattedChats(t){let e=[...t].sort((i,o)=>new Date(o.createdOn).getTime()-new Date(i.createdOn).getTime()),n={today:[],yesterday:[],older:[]};return e.forEach(i=>{this.isToday(i.createdOn)?n.today.push(i):this.isYesterday(i.createdOn)?n.yesterday.push(i):n.older.push(i)}),n}isToday(t){let e=new Date(t),n=new Date;return e.getDate()===n.getDate()&&e.getMonth()===n.getMonth()&&e.getFullYear()===n.getFullYear()}isYesterday(t){let e=new Date(t),n=new Date;return n.setDate(n.getDate()-1),e.getDate()===n.getDate()&&e.getMonth()===n.getMonth()&&e.getFullYear()===n.getFullYear()}static \u0275fac=function(e){return new(e||r)(we(Re),we($),we(gt))};static \u0275cmp=z({type:r,selectors:[["db-ai-prompt-panel"]],viewQuery:function(e,n){if(e&1&&ae(ln,5),e&2){let i;j(i=Z())&&(n.sliderGridRef=i.first)}},inputs:{dashboardId:[1,"dashboardId"],dashboardName:[1,"dashboardName"],dashboardConfig:[1,"dashboardConfig"],chatOnly:[1,"chatOnly"],initialPrompt:[1,"initialPrompt"]},outputs:{closePanel:"closePanel"},features:[se([])],decls:4,vars:1,consts:[["promptInput",""],["sliderGrid",""],[1,"qna-panel"],[1,"chat-layout",3,"chat-layout--resizing"],[1,"chat-layout"],[1,"chat-column"],[1,"chat-header"],["name","close","size","16",1,"close-panel-icon",3,"click"],[1,"chat-message-container",3,"ngClass"],[1,"welcome-section"],[1,"generating-loader"],[1,"contained-panel","prompt-gallery-panel"],[1,"ai-badge","ai-badge--md","welcome-icon-wrap"],["color","#2970ff","name","smartcode","size","20"],[1,"welcome-title"],[1,"welcome-subtitle"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"recommended"],[1,"recommended-box","skeleton-box"],[2,"width","100%","height","64px","border-radius","12px"],["type","button",1,"recommended-box"],["type","button",1,"browse-more",3,"click"],["name","ng-lightbulb-05","method","stroke","size","14"],["type","button",1,"recommended-box",3,"click"],[1,"ai-badge","ai-badge--sm","rec-icon-wrap"],["color","#2970ff","name","ng-lightbulb-05","size","16","method","stroke"],[1,"rec-title"],[3,"name","size"],[1,"generating-text"],[1,"user-row"],[1,"user"],[1,"ai-badge","ai-badge--sm","assistant-icon"],["name","ng-stars-02","method","stroke","size","16","color","#2970ff"],[1,"assistant"],[1,"assistant-body",3,"innerHTML"],[4,"ngTemplateOutlet"],[1,"contained-panel__header"],[1,"contained-panel__title"],["type","button","aria-label","Close",1,"contained-panel__close",3,"click"],["name","close","size","16"],[1,"contained-panel__body"],[1,"prompt-gallery-subtitle"],[1,"prompt-gallery"],["role","separator","aria-orientation","vertical","aria-label","Resize chat column",1,"chat-layout__resizer",3,"pointerdown","pointermove","pointerup","pointercancel"],[1,"dashboard-slider"],[1,"dashboard-slider__body"],[3,"filterSubmit","filterChange","widgetChartTypeChanged","widgetFiltersChanged","setAlert","widgets","editMode","outerMargin","dashboardId","dashboardFilters","resolvedFilters","persistToPublished","canSetAlert","canAddToStory"],[3,"closed","saved","open","widget","dashboardId","source"],[1,"input-query-container"],[1,"chat-input-pill"],["type","text","placeholder","Enter your query",1,"input-query",3,"input","keyup.enter","value"],[1,"pill-toolbar"],[1,"pill-toolbar__right"],["method","stroke",1,"mic-icon",3,"click","name","ngClass"],["method","stroke",1,"send-icon",3,"click","name","size","ngClass"]],template:function(e,n){e&1&&(s(0,"div",2),_(1,Tn,4,8,"div",3),l(),L(2,An,7,12,"ng-template",null,0,fe)),e&2&&(c(),y(n.loadingAllChat()?-1:1))},dependencies:[De,lt,Me,Rt,Ae,Ee],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;height:100%;min-height:0}.qna-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;background:var(--ng-colors-bg-secondary, #f9fafb);font-family:var(--ng-font-family-body)}.chat-layout[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:row;overflow:hidden;min-height:0;container-type:inline-size}.chat-layout.chat-layout--resizing[_ngcontent-%COMP%]{cursor:col-resize;-webkit-user-select:none;user-select:none}.chat-layout.chat-layout--resizing[_ngcontent-%COMP%] .chat-column[_ngcontent-%COMP%]{transition:none!important}.chat-layout.chat-layout--resizing[_ngcontent-%COMP%] .chat-layout__resizer[_ngcontent-%COMP%]:after{opacity:1}.chat-layout__resizer[_ngcontent-%COMP%]{flex:0 0 1px;align-self:stretch;cursor:col-resize;touch-action:none;-webkit-user-select:none;user-select:none;position:relative;background:transparent}.chat-layout__resizer[_ngcontent-%COMP%]:before{content:"";position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%);width:1px;background:var(--ng-colors-border-secondary, #e9eaeb);transition:background .15s}.chat-layout__resizer[_ngcontent-%COMP%]:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:4px;height:36px;border-radius:999px;background:#2970ff;opacity:0;transition:opacity .15s;pointer-events:none}.chat-layout__resizer[_ngcontent-%COMP%]:hover:before{background:#2970ff;opacity:0;transition:opacity .15s;pointer-events:none}.chat-layout__resizer[_ngcontent-%COMP%]:hover:after{opacity:1}.dashboard-slider[_ngcontent-%COMP%]{flex:1 1 auto;display:flex;flex-direction:column;overflow:hidden;min-width:0;min-height:0;background:var(--ng-colors-bg-secondary, #f9fafb);animation:_ngcontent-%COMP%_slider-in .25s ease-out}.dashboard-slider__header[_ngcontent-%COMP%]{height:56px;padding:0 16px;border-bottom:1px solid var(--ng-colors-border-secondary, #e9eaeb);flex-shrink:0;background:#fff;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box}.dashboard-slider__title[_ngcontent-%COMP%]{font-size:13px;font-weight:600;color:var(--ng-colors-text-primary-900, #181d27)}.dashboard-slider__body[_ngcontent-%COMP%]{flex:1;min-height:0;min-width:0;overflow:auto;padding:8px}.dashboard-slider__body[_ngcontent-%COMP%] > shared-dashboard-grid[_ngcontent-%COMP%]{display:block;min-width:calc(66.6667cqw - 32px)}@keyframes _ngcontent-%COMP%_slider-in{0%{transform:translate(24px);opacity:0}to{transform:translate(0);opacity:1}}.chat-column[_ngcontent-%COMP%]{flex:1 1 auto;display:flex;flex-direction:column;overflow:hidden;min-width:0;position:relative;background:#fff;container-type:inline-size;transition:flex-basis .3s ease,flex .3s ease}.chat-column.chat-column--split[_ngcontent-%COMP%]{flex:0 0 33.333%}.chat-column[_ngcontent-%COMP%] .chat-header[_ngcontent-%COMP%]{padding:16px 16px 8px;flex-shrink:0;background:#fff;display:flex;align-items:center;justify-content:flex-end}.chat-column[_ngcontent-%COMP%] .chat-header[_ngcontent-%COMP%] .close-panel-icon[_ngcontent-%COMP%]{cursor:pointer;color:var(--ng-colors-text-tertiary-600, #535862);transition:color .15s}.chat-column[_ngcontent-%COMP%] .chat-header[_ngcontent-%COMP%] .close-panel-icon[_ngcontent-%COMP%]:hover{color:var(--ng-colors-text-primary-900, #181d27)}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%]{flex:1;overflow:auto;padding:20px 24px;display:flex;flex-direction:column-reverse}.chat-column[_ngcontent-%COMP%] .chat-message-container.recommend-window[_ngcontent-%COMP%]{justify-content:center;align-items:center;padding:32px 40px}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .user-row[_ngcontent-%COMP%]{display:flex;flex-direction:row-reverse;justify-content:flex-start;align-items:flex-start;gap:8px;margin-bottom:20px;margin-top:8px}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .user[_ngcontent-%COMP%]{flex:0 1 auto;min-width:0}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .user[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{background:#eff4ff;color:var(--ng-colors-text-primary-900, #181d27);padding:9px 14px;border-radius:14px 14px 2px;font-size:14px;display:inline-block;max-width:100%;text-align:left}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .user-icon[_ngcontent-%COMP%]{flex-shrink:0;width:28px;height:28px;border-radius:50%;background:#eff4ff;color:#2970ff;display:inline-flex;align-items:center;justify-content:center}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .assistant-icon[_ngcontent-%COMP%]{margin-bottom:6px}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .assistant[_ngcontent-%COMP%]{padding:14px 16px;background:var(--ng-colors-bg-secondary, #f9fafb);border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:2px 14px 14px;margin-bottom:14px;font-size:14px;line-height:1.65;color:var(--ng-colors-text-primary-900, #181d27)}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .generating-loader[_ngcontent-%COMP%]{padding:10px 14px;height:40px;display:flex;gap:8px;align-items:center;background:var(--ng-colors-bg-secondary, #f9fafb);border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:8px;font-size:13px;color:var(--ng-colors-text-tertiary-600, #535862);width:fit-content}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .welcome-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:12px;width:100%;max-width:820px;text-align:center}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .welcome-section[_ngcontent-%COMP%] .welcome-icon-wrap[_ngcontent-%COMP%]{margin-bottom:4px}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .welcome-section[_ngcontent-%COMP%] .welcome-title[_ngcontent-%COMP%]{margin:0;font-size:22px;font-weight:700;color:var(--ng-colors-text-primary-900, #181d27);letter-spacing:-.02em}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .welcome-section[_ngcontent-%COMP%] .welcome-subtitle[_ngcontent-%COMP%]{margin:0 0 8px;font-size:14px;color:var(--ng-colors-text-tertiary-600, #535862);max-width:440px;line-height:1.6}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .browse-more[_ngcontent-%COMP%]{margin-top:4px;align-self:flex-end;display:inline-flex;align-items:center;gap:6px;padding:6px 4px;background:transparent;border:0;cursor:pointer;font-size:12px;font-weight:500;color:var(--ng-colors-text-tertiary-600, #535862);transition:color .15s}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .browse-more[_ngcontent-%COMP%]:hover{color:#2970ff}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .recommended[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;width:100%}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .recommended[_ngcontent-%COMP%] .recommended-box[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;font:inherit;color:inherit;border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:14px;padding:18px;cursor:pointer;transition:border-color .18s,box-shadow .18s,transform .15s;background:#fff;text-align:left}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .recommended[_ngcontent-%COMP%] .recommended-box[_ngcontent-%COMP%]:hover{border-color:#2970ff;box-shadow:0 6px 24px #2970ff1a;transform:translateY(-2px)}.chat-column[_ngcontent-%COMP%] .chat-message-container[_ngcontent-%COMP%] .recommended[_ngcontent-%COMP%] .recommended-box[_ngcontent-%COMP%] .rec-title[_ngcontent-%COMP%]{font-size:13px;font-weight:600;color:var(--ng-colors-text-primary-900, #181d27);text-transform:capitalize;line-height:1.4}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%]{padding:14px 24px 18px;display:flex;justify-content:center;flex-shrink:0;background:#fff}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .chat-input-pill[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;width:100%;max-width:760px;padding:14px 16px 12px;background:#fff;border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:24px;box-shadow:0 1px 2px #1018280a,0 8px 24px #1018280f;cursor:text;transition:border-color .15s,box-shadow .15s}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .chat-input-pill[_ngcontent-%COMP%]:focus-within{border-color:#2970ff;box-shadow:0 0 0 3px #2970ff1f}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .input-query[_ngcontent-%COMP%]{width:100%;min-width:0;border:0;outline:0;background:transparent;padding:6px 2px;font:inherit;font-size:15px;color:var(--ng-colors-text-primary-900, #181d27);text-overflow:ellipsis}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .input-query[_ngcontent-%COMP%]::placeholder{color:var(--ng-colors-text-tertiary-600, #717680);overflow:hidden;text-overflow:ellipsis}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .pill-toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:8px}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .pill-toolbar__right[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .send-icon[_ngcontent-%COMP%]{cursor:pointer;flex-shrink:0;transition:opacity .15s,transform .15s}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .send-icon[_ngcontent-%COMP%]:hover{transform:translate(2px)}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .send-icon.disabled[_ngcontent-%COMP%]{opacity:.2;pointer-events:none}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .mic-icon[_ngcontent-%COMP%]{cursor:pointer;color:var(--ng-colors-text-tertiary-600, #535862);transition:color .15s}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .mic-icon[_ngcontent-%COMP%]:hover{color:#2970ff}.chat-column[_ngcontent-%COMP%] .input-query-container[_ngcontent-%COMP%] .mic-icon.mic-listening[_ngcontent-%COMP%]{color:#e53e3e;animation:_ngcontent-%COMP%_mic-pulse 1.2s ease-in-out infinite}.chat-column[_ngcontent-%COMP%] .input-query-container.input-query-container--welcome[_ngcontent-%COMP%]{border-top:0;background:transparent;padding:4px 0 12px;width:100%;max-width:680px}@keyframes _ngcontent-%COMP%_mic-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(1.3)}}.dashboard-slider__body[_ngcontent-%COMP%]{padding:unset}.contained-panel[_ngcontent-%COMP%]{position:absolute;inset:0;display:flex;flex-direction:column;background:#fff;border-left:1px solid var(--ng-colors-border-secondary, #e9eaeb);box-shadow:-8px 0 24px #10182814;z-index:var(--z-floating);animation:_ngcontent-%COMP%_contained-slide .25s ease-out}.contained-panel__header[_ngcontent-%COMP%]{height:56px;padding:0 16px;border-bottom:1px solid var(--ng-colors-border-secondary, #e9eaeb);flex-shrink:0;background:#fff;display:flex;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box}.contained-panel__close[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:4px;border:0;outline:0;background:transparent;color:var(--ng-colors-text-tertiary-600, #535862);cursor:pointer;transition:color .15s;flex-shrink:0}.contained-panel__close[_ngcontent-%COMP%]:hover{color:var(--ng-colors-text-primary-900, #181d27)}.contained-panel__title[_ngcontent-%COMP%]{font-size:14px;font-weight:600;color:var(--ng-colors-text-primary-900, #181d27);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.contained-panel__body[_ngcontent-%COMP%]{flex:1;min-height:0;overflow:auto;padding:16px 20px 20px}.prompt-gallery-subtitle[_ngcontent-%COMP%]{margin:0 0 24px;font-size:13px;color:var(--ng-colors-text-tertiary-600, #535862)}.prompt-gallery[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr;gap:12px;padding:6px 6px 8px}.prompt-gallery[_ngcontent-%COMP%] .recommended-box[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:10px;border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:12px;padding:12px 16px;cursor:pointer;background:#fff;text-align:left;font:inherit;color:inherit;transition:border-color .18s,box-shadow .18s,transform .15s}.prompt-gallery[_ngcontent-%COMP%] .recommended-box[_ngcontent-%COMP%]:hover{border-color:#2970ff;box-shadow:0 6px 24px #2970ff1a;transform:translateY(-2px)}.prompt-gallery[_ngcontent-%COMP%] .recommended-box[_ngcontent-%COMP%] .rec-title[_ngcontent-%COMP%]{font-size:13px;font-weight:500;color:var(--ng-colors-text-secondary-700, #414651);line-height:1.45}@keyframes _ngcontent-%COMP%_contained-slide{0%{transform:translate(8px);opacity:0}to{transform:translate(0);opacity:1}}.chat-system[_ngcontent-%COMP%]{margin:4px 0;font-size:13px;line-height:1.4;color:var(--ng-colors-text-tertiary-600, #535862)}.chat-system--error[_ngcontent-%COMP%]{color:var(--ng-colors-fg-error-primary, #d92d20);font-weight:500}']})};var Fn=r=>[r];function En(r,t){if(r&1&&ue(0,"nile-progress-bar",4),r&2){let e=d();ot("value",e.percent())}}var ze=class r{streamId;done=new me;failed=new me;streamService=v(Lt);totalCharts=m(0);widgetPhases=m([]);phaseLabel=m("Connecting to your data\u2026");dashboardNumber=m(0);barKey=m(0);pendingNewDashboard=!0;readyCount=S(()=>this.widgetPhases().filter(t=>t==="building"||t==="saving").length);percent=S(()=>{let t=this.totalCharts();if(!t)return 0;let e=this.widgetPhases(),n=0;for(let i=0;i<t;i++){let o=e[i];n+=o==="building"||o==="saving"?1:o==="querying"?.66:o==="analyzing"?.33:0}return Math.round(Math.min(1,n/t)*100)});countLabel=S(()=>{let t=this.totalCharts(),e=this.dashboardNumber();return!t||!e?"":`Dashboard ${e} \xB7 ${this.readyCount()} of ${t} charts`});finished=!1;dispose=null;ngOnInit(){if(!this.streamId){this.failed.emit();return}this.dispose=this.streamService.stream(this.streamId,t=>this.onEvent(t))}ngOnDestroy(){this.teardown()}onEvent(t){switch(t.kind){case"progress":{this.pendingNewDashboard&&(this.dashboardNumber.update(e=>e+1),this.pendingNewDashboard=!1),this.totalCharts.set(t.totalWidgets),this.widgetPhases.update(e=>{let n=[...e];return n[t.widgetIndex]=Ht(n[t.widgetIndex],t.phase),n}),this.phaseLabel.set(t.label);break}case"dashboard-start":{this.resetForNextDashboard(t.dashboardName?`Setting up ${t.dashboardName}\u2026`:"Preparing the next dashboard\u2026");break}case"saved":{this.resetForNextDashboard("Preparing the next dashboard\u2026");break}case"complete":{t.dashboardIds.length>0?this.finish(()=>this.done.emit(t.dashboardIds)):this.finish(()=>this.failed.emit());break}case"error":{t.dashboardIds.length>0?this.finish(()=>this.done.emit(t.dashboardIds)):this.finish(()=>this.failed.emit());break}}}resetForNextDashboard(t){this.barKey.update(e=>e+1),this.pendingNewDashboard=!0,this.totalCharts.set(0),this.widgetPhases.set([]),this.phaseLabel.set(t)}finish(t){this.finished||(this.finished=!0,this.teardown(),t())}teardown(){this.dispose?.(),this.dispose=null}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=z({type:r,selectors:[["app-dashboard-generating"]],inputs:{streamId:"streamId"},outputs:{done:"done",failed:"failed"},decls:13,vars:4,consts:[["role","status","aria-live","polite",1,"genbar"],["variant","informative","size","medium","pulse","",1,"genbar__light"],[1,"genbar__title"],["aria-hidden","true",1,"genbar__divider"],[1,"genbar__bar",3,"value"],[1,"genbar__count"],[1,"genbar__live"],["aria-hidden","true",1,"genbar__spinner"],[1,"genbar__status"]],template:function(e,n){e&1&&(oe(0,"div",0),ue(1,"nile-status-light",1),oe(2,"span",2),w(3,"Generating your dashboards"),Pe(),ue(4,"span",3),F(5,En,1,1,"nile-progress-bar",4,rt),oe(7,"span",5),w(8),Pe(),oe(9,"div",6),ue(10,"nile-spinner",7),oe(11,"span",8),w(12),Pe()()()),e&2&&(c(5),E(le(2,Fn,n.barKey())),c(3),W(n.countLabel()),c(4),W(n.phaseLabel()))},styles:["[_nghost-%COMP%]{display:block;width:100%}.genbar[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--ng-spacing-md, 12px);width:100%;min-width:0;padding-inline-start:var(--ng-spacing-lg, 16px)}.genbar__light[_ngcontent-%COMP%]{flex:none}.genbar__title[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm, 14px);font-weight:var(--ng-font-weight-semibold, 600);line-height:var(--ng-line-height-text-sm, 1.4);color:var(--ng-colors-text-primary-900, #181d27);white-space:nowrap}.genbar__divider[_ngcontent-%COMP%]{width:1px;height:20px;background:var(--ng-colors-border-secondary, #e9eaeb);flex:none}.genbar__bar[_ngcontent-%COMP%]{width:160px;flex:none}.genbar__count[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm, 14px);line-height:var(--ng-line-height-text-sm, 1.4);color:var(--ng-colors-text-tertiary-600, #535862);white-space:nowrap}.genbar__live[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto;flex:none;min-width:0}.genbar__spinner[_ngcontent-%COMP%]{font-size:14px;--indicator-color: #2970ff;--track-color: rgba(41, 112, 255, .2);flex:none}.genbar__status[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm, 14px);line-height:var(--ng-line-height-text-sm, 1.4);color:var(--ng-colors-text-tertiary-600, #535862);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px}@media(max-width:760px){.genbar__divider[_ngcontent-%COMP%], .genbar__bar[_ngcontent-%COMP%], .genbar__count[_ngcontent-%COMP%]{display:none}}"]})};var In=["tabsScroller"],Kt=()=>({subtitle:"Explore your dashboards or ask your data a question"}),Rn=()=>({subtitle:"Setting up your initial dashboards \u2014 crafting a starter set from your data."}),Nn=(r,t)=>t.id;function zn(r,t){if(r&1&&(s(0,"header",8),V(1,16),l()),r&2){d(2);let e=R(5);c(),C("ngTemplateOutlet",e)("ngTemplateOutletContext",ne(2,Kt))}}function Vn(r,t){if(r&1&&h(0,"nile-skeleton-loader",11),r&2){let e=t.$implicit;ee("width",e)}}function Wn(r,t){r&1&&h(0,"nile-skeleton-loader",14)}function qn(r,t){r&1&&V(0)}function Hn(r,t){if(r&1&&(s(0,"div",5)(1,"div",7),_(2,zn,2,3,"header",8),s(3,"div",9)(4,"div",10),F(5,Vn,1,1,"nile-skeleton-loader",11,U),l(),h(7,"span",12)(8,"nile-skeleton-loader",13),F(9,Wn,1,0,"nile-skeleton-loader",14,U),l(),L(11,qn,1,0,"ng-container",15),l()()),r&2){let e=d(),n=R(7);c(2),y(e.showHeader()?2:-1),c(3),E(e.skeletonTabWidths),c(4),E(e.skeletonActionBtns),c(2),C("ngTemplateOutlet",n)}}function Ln(r,t){if(r&1&&(s(0,"header",8),V(1,16),l()),r&2){d(2);let e=R(5);c(),C("ngTemplateOutlet",e)("ngTemplateOutletContext",ne(2,Rn))}}function Gn(r,t){if(r&1){let e=M();s(0,"app-dashboard-generating",18),b("done",function(i){u(e);let o=d(2);return f(o.onGenerationDone(i))})("failed",function(){u(e);let i=d(2);return f(i.onGenerationFailed())}),l()}if(r&2){let e=d(2);C("streamId",e.generationStreamId())}}function $n(r,t){r&1&&V(0)}function Bn(r,t){if(r&1&&(s(0,"div",6)(1,"div",7),_(2,Ln,2,3,"header",8),s(3,"div",9),_(4,Gn,1,1,"app-dashboard-generating",17),l()(),L(5,$n,1,0,"ng-container",15),l()),r&2){let e=d(),n=R(7);c(2),y(e.showHeader()?2:-1),c(2),y(e.features().autoGenerate?4:-1),c(),C("ngTemplateOutlet",n)}}function Un(r,t){if(r&1&&(s(0,"header",8),V(1,16),l()),r&2){d(2);let e=R(5);c(),C("ngTemplateOutlet",e)("ngTemplateOutletContext",ne(2,Kt))}}function jn(r,t){r&1&&h(0,"nile-glyph",47)}function Zn(r,t){if(r&1){let e=M();s(0,"span",49),b("click",function(i){return i.stopPropagation()}),s(1,"input",50,3),b("input",function(){u(e);let i=R(2),o=d(4);return f(o.onRenameInputChange(i.value))})("keydown",function(i){u(e);let o=d().$implicit,a=d(3);return f(a.onRenameInputKeydown(i,o))})("click",function(i){return i.stopPropagation()}),l(),s(3,"button",51),b("click",function(i){u(e);let o=d().$implicit,a=d(3);return f(a.commitRenameDashboard(o,i))}),h(4,"nile-glyph",52),l()()}if(r&2){let e=d().$implicit,n=d(3);c(),C("value",n.renamingValue())("disabled",n.isRenamingDashboard()),ee("data-dashboard-id",e.id),c(2),C("disabled",n.isRenamingDashboard())}}function Yn(r,t){if(r&1){let e=M();s(0,"button",55),b("click",function(i){u(e);let o=d(2).$implicit,a=d(3);return f(a.startRenameDashboard(o,i))}),h(1,"nile-glyph",56),l()}}function Kn(r,t){if(r&1&&(s(0,"span",53),w(1),l(),_(2,Yn,2,0,"button",54)),r&2){let e=d().$implicit,n=d(3);c(),W(e.name),c(),y(n.features().rename&&!e.isAutoGenerated?2:-1)}}function Qn(r,t){if(r&1){let e=M();s(0,"nile-nav-tab",46),b("click",function(){let i=u(e).$implicit,o=d(3);return f(o.setActiveTab(i.id))}),_(1,jn,1,0,"nile-glyph",47),_(2,Zn,5,4,"span",48)(3,Kn,3,2),l()}if(r&2){let e=t.$implicit,n=d(3);ee("panel",e.id),c(),y(e.isAutoGenerated?1:-1),c(),y(n.renamingDashboardId()===e.id?2:3)}}function Jn(r,t){if(r&1){let e=M();s(0,"app-time-range-picker",57),b("apply",function(i){u(e);let o=d(3);return f(o.onTimeRangeApply(i))}),l()}if(r&2){let e=d(3);C("resetKey",e.activeTabId())}}function Xn(r,t){r&1&&h(0,"span",37)}function ei(r,t){if(r&1){let e=M();s(0,"nile-lite-tooltip",42)(1,"button",58),b("click",function(){u(e);let i=d(3);return f(i.refreshActiveDashboard())}),h(2,"nile-glyph",59),l()()}if(r&2){let e=d(3);c(),C("disabled",!e.activeTabId()||e.refreshingDashboard()),c(),te("home-refresh-glyph--spinning",e.refreshingDashboard())}}function ti(r,t){if(r&1){let e=M();s(0,"nile-lite-tooltip",44)(1,"button",60),b("click",function(){u(e);let i=d(3);return f(i.selectHomeMenuItem("executiveSummary"))}),h(2,"nile-glyph",61),l()()}}function ni(r,t){if(r&1){let e=M();s(0,"nile-dropdown",62),b("nile-hide",function(){u(e);let i=d(3);return f(i.downloadMenuOpen.set(!1))}),s(1,"nile-lite-tooltip",63)(2,"button",64),b("click",function(){u(e);let i=d(3);return f(i.downloadMenuOpen.set(!i.downloadMenuOpen()))}),h(3,"nile-glyph",65),l()(),s(4,"nile-menu")(5,"nile-menu-item",66),b("click",function(){u(e);let i=d(3);return i.downloadMenuOpen.set(!1),f(i.selectHomeMenuItem("exportPdf"))}),h(6,"nile-glyph",67),w(7," Download as PDF "),l(),s(8,"nile-menu-item",66),b("click",function(){u(e);let i=d(3);return i.downloadMenuOpen.set(!1),f(i.selectHomeMenuItem("exportPng"))}),h(9,"nile-glyph",68),w(10," Download as PNG "),l()()()}if(r&2){let e=d(3);C("open",e.downloadMenuOpen())}}function ii(r,t){if(r&1){let e=M();s(0,"div",23)(1,"button",24),b("click",function(){u(e);let i=d(2);return f(i.scrollTabs(-1))}),h(2,"nile-glyph",25),l(),s(3,"div",26,2),b("scroll",function(){u(e);let i=d(2);return f(i.onTabsScroll())}),s(5,"nile-nav-tab-group",27),h(6,"nile-nav-tab",28),F(7,Qn,4,3,"nile-nav-tab",29,Nn),l()(),s(9,"button",30),b("click",function(){u(e);let i=d(2);return f(i.scrollTabs(1))}),h(10,"nile-glyph",31),l(),h(11,"span",12),_(12,Jn,1,1,"app-time-range-picker",32),s(13,"nile-dropdown",33),b("nile-hide",function(){u(e);let i=d(2);return f(i.categoryFilterOpen.set(!1))}),s(14,"nile-lite-tooltip",34)(15,"button",35),b("click",function(){u(e);let i=d(2);return f(i.categoryFilterOpen.set(!i.categoryFilterOpen()))}),h(16,"nile-glyph",36),_(17,Xn,1,0,"span",37),l()(),s(18,"shared-category-filter-row",38),b("mousedown",function(i){return i.stopPropagation()})("selectionChange",function(i){u(e);let o=d(2);return f(o.onCategoryFilterChange(i))}),l()(),s(19,"nile-lite-tooltip",39)(20,"button",40),b("click",function(){u(e);let i=d(2);return f(i.goToCreateDashboard())}),h(21,"nile-glyph",41),l()(),_(22,ei,3,3,"nile-lite-tooltip",42),s(23,"div",43),_(24,ti,3,0,"nile-lite-tooltip",44),_(25,ni,11,1,"nile-dropdown",45),l()()}if(r&2){let e=d(2);te("is-scrollable",e.canScrollLeft()||e.canScrollRight()),c(),C("disabled",!e.canScrollLeft()),c(4),ee("value",e.activeTabId()||"__sentinel__"),c(2),E(e.visibleDashboards()),c(2),C("disabled",!e.canScrollRight()),c(3),y(e.activeTabId()?12:-1),c(),C("open",e.categoryFilterOpen()),c(4),y(e.selectedCategory()?17:-1),c(),C("selected",e.selectedCategory()),c(2),C("disabled",e.creatingDashboard()),c(2),y(e.features().refresh?22:-1),c(2),y(e.features().executiveSummary?24:-1),c(),y(e.features().export?25:-1)}}function ri(r,t){if(r&1&&(s(0,"nile-nav-tab-panel",69),h(1,"app-dashboard-viewer",71),l()),r&2){let e=d(3);ee("name",e.activeTabId()),c(),C("config",e.loadedDashboards().get(e.activeTabId()))}}function oi(r,t){r&1&&V(0)}function ai(r,t){if(r&1&&(s(0,"div",70),L(1,oi,1,0,"ng-container",15),l()),r&2){d(3);let e=R(7);c(),C("ngTemplateOutlet",e)}}function si(r,t){if(r&1&&_(0,ri,2,2,"nile-nav-tab-panel",69)(1,ai,2,1,"div",70),r&2){let e=d(2);y(e.loadedDashboards().has(e.activeTabId())?0:e.isTabLoading()||e.refreshingDashboard()?1:-1)}}function li(r,t){if(r&1){let e=M();s(0,"div",20)(1,"h2",72),w(2,"No dashboards in this category"),l(),s(3,"p",73),w(4,"Try a different category, or clear the filter to see everything."),l(),s(5,"nile-button",74),b("click",function(){u(e);let i=d(2);return f(i.onCategoryFilterChange(null))}),w(6," Clear filter "),l()()}}function di(r,t){if(r&1){let e=M();s(0,"div",20)(1,"div",75),Qe(),s(2,"svg",76),h(3,"rect",77)(4,"rect",78)(5,"rect",79),s(6,"rect",80),h(7,"animate",81)(8,"animate",82),l(),s(9,"rect",83),h(10,"animate",84)(11,"animate",85),l(),s(12,"rect",86),h(13,"animate",87)(14,"animate",88),l(),s(15,"rect",89),h(16,"animate",90)(17,"animate",91),l(),s(18,"rect",92),h(19,"animate",93)(20,"animate",94),l(),h(21,"rect",95)(22,"rect",96)(23,"circle",97),s(24,"circle",98),h(25,"animate",99),l(),h(26,"rect",100)(27,"rect",101),s(28,"path",102),h(29,"animate",103),l(),s(30,"circle",104),h(31,"animate",105),l()()(),Je(),s(32,"h2",72),w(33,"Build your dashboard"),l(),s(34,"p",73),w(35," Tap the below button to generate dashboard. "),l(),s(36,"nile-button",106),b("click",function(){u(e);let i=d(2);return f(i.goToCreateDashboard())}),h(37,"nile-glyph",107),w(38," Create dashboard "),l()()}if(r&2){let e=d(2);c(36),ee("disabled",e.creatingDashboard()?"":null)}}function ci(r,t){if(r&1){let e=M();s(0,"db-ai-prompt-panel",108),b("closePanel",function(){u(e);let i=d(2);return f(i.showAiPanel.set(!1))}),l()}if(r&2){let e=d(2);C("dashboardId",e.activeTabId())("dashboardName",e.activeDashboardName())("dashboardConfig",e.loadedDashboards().get(e.activeTabId())??null)("chatOnly",e.aiChatOnly())("initialPrompt",e.aiInitialPrompt())}}function gi(r,t){if(r&1){let e=M();s(0,"div",6)(1,"div",7),_(2,Un,2,3,"header",8),_(3,ii,26,13,"div",19),_(4,si,2,1)(5,li,7,0,"div",20)(6,di,39,1,"div",20),s(7,"nile-drawer",21),b("nile-request-close",function(){u(e);let i=d();return f(i.showAiPanel.set(!1))}),_(8,ci,1,5,"db-ai-prompt-panel",22),l()()()}if(r&2){let e=d();c(2),y(e.showHeader()?2:-1),c(),y(e.allDashboards().length>0?3:-1),c(),y(e.activeTabId()?4:e.allDashboards().length>0?5:e.allDashboards().length===0?6:-1),c(3),C("open",e.showAiPanel()),c(),y(e.features().aiPrompt&&e.showAiPanel()?8:-1)}}function pi(r,t){if(r&1&&(s(0,"div",109)(1,"h1",110),w(2,"Dashboards"),l(),s(3,"p",111),w(4),l()()),r&2){let e=t.subtitle;c(4),W(e)}}function hi(r,t){r&1&&(s(0,"div",114)(1,"div",117),h(2,"nile-skeleton-loader",118)(3,"nile-skeleton-loader",119),l(),h(4,"nile-skeleton-loader",120),s(5,"div",121),h(6,"nile-skeleton-loader",122)(7,"nile-skeleton-loader",123),l(),h(8,"nile-skeleton-loader",124),l())}function mi(r,t){r&1&&(s(0,"div",116)(1,"div",125)(2,"div",126),h(3,"nile-skeleton-loader",127)(4,"nile-skeleton-loader",128),l(),h(5,"nile-skeleton-loader",129),l(),h(6,"nile-skeleton-loader",130),l())}function ui(r,t){if(r&1&&(s(0,"div",112)(1,"div",113),F(2,hi,9,0,"div",114,U),l(),s(4,"div",115),F(5,mi,7,0,"div",116,U),l()()),r&2){let e=d();c(2),E(e.skeletonKpis),c(3),E(e.skeletonWidgets)}}var Be=4,Ve=class r{MAX_TABS=Be;tabsScrollerEl;dashboardViewerRef;timeRangePickerRef;onTimeRangeApply(t){this.dashboardViewerRef?.applyTimeRange(t)}tabsScrollLeft=m(0);tabsClientWidth=m(0);tabsScrollWidth=m(0);canScrollLeft=S(()=>this.tabsScrollLeft()>0);canScrollRight=S(()=>this.tabsScrollLeft()+this.tabsClientWidth()<this.tabsScrollWidth()-1);onTabsScroll(){this.updateTabsScrollState()}updateTabsScrollState(){let t=this.tabsScrollerEl?.nativeElement;t&&(this.tabsScrollLeft.set(t.scrollLeft),this.tabsClientWidth.set(t.clientWidth),this.tabsScrollWidth.set(t.scrollWidth))}scrollTabs(t){let e=this.tabsScrollerEl?.nativeElement;e&&e.scrollBy({left:t*e.clientWidth*.8,behavior:"smooth"})}scrollActiveTabIntoView(){let t=this.tabsScrollerEl?.nativeElement;if(!t)return;let e=this.activeTabId();if(!e)return;let n=window.CSS&&CSS.escape?CSS.escape(e):e.replace(/"/g,'\\"'),i=t.querySelector(`nile-nav-tab[panel="${n}"]`);if(!i)return;let o=i.getBoundingClientRect(),a=t.getBoundingClientRect(),g=16;o.right>a.right?t.scrollBy({left:o.right-a.right+g,behavior:"smooth"}):o.left<a.left&&t.scrollBy({left:o.left-a.left-g,behavior:"smooth"})}onWindowResize=()=>this.ngZone.run(()=>this.updateTabsScrollState());showAiPanel=m(!1);aiChatOnly=m(!1);aiInitialPrompt=m("");allDashboards=m([]);selectedCategory=m(null);dashboardCategories=Gt;categoryFilterOpen=m(!1);visibleDashboards=S(()=>{let t=this.selectedCategory(),e=this.allDashboards();return t?e.filter(n=>n.category?.includes(t)):e});activeTabs=m([]);activeTabId=m("");loadedDashboards=m(new Map);isLoading=m(!0);isTabLoading=m(!1);skeletonTabWidths=[72,220,140];skeletonKpis=Array.from({length:4});skeletonWidgets=Array.from({length:4});skeletonActionBtns=Array.from({length:4});showMore=S(()=>this.allDashboards().length>0);activeDashboardName=S(()=>this.allDashboards().find(t=>t.id===this.activeTabId())?.name??"");activeConfig=S(()=>this.loadedDashboards().get(this.activeTabId())??null);isExporting=m(!1);showExportDropdown=m(!1);downloadMenuOpen=m(!1);creatingDashboard=m(!1);generationStreamId=m("");isGenerating=S(()=>this.generationStreamId()!=="");generationSettled=!1;showHeader(){return D().ui.header}features(){return D().features}copy(){return D().copy}service=v(he);ngZone=v(xe);el=v(re);navigator=v(G);routeProgress=v(It);autoDashboard=v(qt);goToCreateDashboard(){this.creatingDashboard()||(this.creatingDashboard.set(!0),this.navigator.toAskAquera())}constructor(){X(()=>{this.activeTabId(),this.allDashboards(),queueMicrotask(()=>this.scrollActiveTabIntoView())})}ngAfterViewChecked(){this.updateTabsScrollState()}onExportTriggerClick(){this.showExportDropdown.set(!this.showExportDropdown())}selectHomeMenuItem(t){if(t==="askAi")this.aiChatOnly.set(!0),this.aiInitialPrompt.set(""),this.showAiPanel.set(!0);else if(t==="executiveSummary"){let e=this.activeTabId();e&&this.navigator.toAskAqueraDashboard(e,{summary:1})}else t==="exportPdf"?this.exportDashboardPdf():t==="exportPng"&&this.exportDashboardPng()}getDashboardTarget(){let t=this.activeTabId();return this.el.nativeElement.querySelector(`nile-nav-tab-panel[name="${t}"] app-dashboard-viewer gridster`)}async exportDashboardPdf(){if(this.isExporting())return;let t=this.getDashboardTarget();if(t){this.showExportDropdown.set(!1),this.isExporting.set(!0),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)));try{let e=t.scrollWidth,n=t.scrollHeight,i=await Ge(t,{quality:1,width:e,height:n,cacheBust:!0,backgroundColor:"#ffffff",style:{height:`${n}px`,maxHeight:"none",overflow:"visible"}}),o=this.activeDashboardName()||"Dashboard",a=90,g=new Wt({orientation:e>n?"landscape":"portrait",unit:"px",format:[e,n+a]});g.setFillColor(245,245,248),g.rect(0,0,e,a,"F"),g.setFont("helvetica","bold"),g.setFontSize(28),g.setTextColor(50,50,60),g.text(o,e/2,a/2+7,{align:"center"}),g.addImage(i,"JPEG",0,a,e,n),g.save(`${o}.pdf`)}finally{this.isExporting.set(!1)}}}async exportDashboardPng(){if(this.isExporting())return;let t=this.getDashboardTarget();if(t){this.showExportDropdown.set(!1),this.isExporting.set(!0),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)));try{let e=t.scrollWidth,n=t.scrollHeight,i=await Ge(t,{quality:1,width:e,height:n,cacheBust:!0,backgroundColor:"#ffffff",style:{height:`${n}px`,maxHeight:"none",overflow:"visible"}}),o=this.activeDashboardName()||"Dashboard",a=90,g=document.createElement("canvas");g.width=e,g.height=n+a;let p=g.getContext("2d");p.fillStyle="#f5f5f8",p.fillRect(0,0,e,a),p.fillStyle="#32323c",p.font="bold 28px helvetica",p.textAlign="center",p.textBaseline="middle",p.fillText(o,e/2,a/2+7);let x=new Image;x.src=i,await new Promise(J=>{x.onload=()=>J()}),p.drawImage(x,0,a,e,n);let N=document.createElement("a");N.href=g.toDataURL("image/png"),N.download=`${o}.png`,N.click()}finally{this.isExporting.set(!1)}}}toggleAiPanel(){this.showAiPanel.update(t=>!t)}onToggleAiPanel=()=>this.ngZone.run(()=>this.showAiPanel.update(t=>!t));ngOnInit(){this.loadList(),window.addEventListener("dv:toggle-ai-panel",this.onToggleAiPanel),window.addEventListener("resize",this.onWindowResize)}ngOnDestroy(){window.removeEventListener("dv:toggle-ai-panel",this.onToggleAiPanel),window.removeEventListener("resize",this.onWindowResize)}async loadList(){this.isLoading.set(!0);try{let t=await this.routeProgress.track(this.service.loadDashboards());this.ngZone.run(()=>{this.allDashboards.set(t);let e=t.slice(0,Be);this.activeTabs.set(e),e.length>0&&!this.activeTabId()&&(this.activeTabId.set(e[0].id),this.loadTab(e[0].id))}),t.length===0&&await this.checkAutoDashboard()}catch(t){console.error("Failed to load dashboards list:",t)}finally{this.ngZone.run(()=>this.isLoading.set(!1))}}async checkAutoDashboard(){if(!(this.generationSettled||this.isGenerating()))try{let t=await this.autoDashboard.trigger();t?.success&&!t.skipped&&t.streamId&&this.ngZone.run(()=>{this.generationStreamId.set(t.streamId)})}catch{}}onGenerationDone(t){this.generationSettled=!0,this.generationStreamId.set("");let e=t.length;this.loadList().then(()=>{this.showReadyToast(e>1?`${e} dashboards are ready`:"Your dashboard is ready")})}onGenerationFailed(){this.generationSettled=!0,this.generationStreamId.set("")}showReadyToast(t){_e({variant:"success",title:"All set",content:t})}async loadTab(t){if(!this.loadedDashboards().has(t)){this.isTabLoading.set(!0);try{let e=await this.routeProgress.track(this.service.fetchDashboard(t));this.ngZone.run(()=>{let n=new Map(this.loadedDashboards());n.set(t,e),this.loadedDashboards.set(n)})}catch(e){console.error(`Failed to load dashboard ${t}:`,e)}finally{this.ngZone.run(()=>this.isTabLoading.set(!1))}}}refreshingDashboard=m(!1);async refreshActiveDashboard(){let t=this.activeTabId();if(!t||this.refreshingDashboard())return;let e=this.loadedDashboards().get(t);this.refreshingDashboard.set(!0),this.ngZone.run(()=>{let n=new Map(this.loadedDashboards());n.delete(t),this.loadedDashboards.set(n)});try{let n=await this.routeProgress.track(this.service.fetchDashboard(t));this.ngZone.run(()=>{let i=new Map(this.loadedDashboards());i.set(t,n),this.loadedDashboards.set(i)})}catch(n){console.error(`Failed to refresh dashboard ${t}:`,n),e&&this.ngZone.run(()=>{let i=new Map(this.loadedDashboards());i.set(t,e),this.loadedDashboards.set(i)})}finally{this.ngZone.run(()=>{this.refreshingDashboard.set(!1),queueMicrotask(()=>this.timeRangePickerRef?.reapply())})}}onTabChange(t){let e=t.detail.value;e!==this.activeTabId()&&this.setActiveTab(e)}onCategoryFilterChange(t){this.selectedCategory.set(t),this.categoryFilterOpen.set(!1);let e=this.visibleDashboards();e.some(n=>n.id===this.activeTabId())||(e.length>0?this.setActiveTab(e[0].id):this.activeTabId.set(""))}setActiveTab(t){this.showAiPanel.set(!1),this.activeTabId.set(t),this.loadTab(t)}isInActiveTabs(t){return this.activeTabs().some(e=>e.id===t)}canAdd(){return this.activeTabs().length<Be}isLastActiveDashboard(t){return this.activeTabs().length===1&&this.isInActiveTabs(t)}renamingDashboardId=m(null);renamingValue=m("");isRenamingDashboard=m(!1);startRenameDashboard(t,e){e.stopPropagation(),!t.isAutoGenerated&&(this.renamingDashboardId.set(t.id),this.renamingValue.set(t.name),queueMicrotask(()=>{let n=this.el.nativeElement.querySelector(`.tab-rename-input[data-dashboard-id="${t.id}"]`);n?.focus(),n?.select()}))}onRenameInputChange(t){this.renamingValue.set(t)}onRenameInputKeydown(t,e){t.key==="Enter"?(t.preventDefault(),this.commitRenameDashboard(e)):t.key==="Escape"&&(t.preventDefault(),this.cancelRenameDashboard(t))}cancelRenameDashboard(t){t?.stopPropagation(),this.renamingDashboardId.set(null),this.renamingValue.set("")}async commitRenameDashboard(t,e){e?.stopPropagation();let n=this.renamingValue().trim();if(!n||n===t.name){this.cancelRenameDashboard();return}this.isRenamingDashboard.set(!0);try{await this.service.renameDashboard(t.id,n),this.ngZone.run(()=>{let i=o=>o.map(a=>a.id===t.id?H(P({},a),{name:n}):a);this.allDashboards.update(i),this.activeTabs.update(i),this.renamingDashboardId.set(null),this.renamingValue.set("")}),_e({variant:"success",title:"Renamed",content:"Dashboard renamed."})}catch{}finally{this.ngZone.run(()=>this.isRenamingDashboard.set(!1))}}onDashboardToggle(t,e){if(e){if(!this.canAdd())return;this.activeTabs.update(n=>[...n,t]),this.setActiveTab(t.id)}else{let n=this.activeTabId()===t.id;if(this.activeTabs.update(i=>i.filter(o=>o.id!==t.id)),n){let i=this.activeTabs();i.length>0?this.setActiveTab(i[0].id):this.activeTabId.set("")}}}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=z({type:r,selectors:[["dvz-dashboards-page"]],viewQuery:function(e,n){if(e&1&&ae(In,5)(Ce,5)($e,5),e&2){let i;j(i=Z())&&(n.tabsScrollerEl=i.first),j(i=Z())&&(n.dashboardViewerRef=i.first),j(i=Z())&&(n.timeRangePickerRef=i.first)}},decls:8,vars:3,consts:[["pageTitleBlock",""],["dashboardSkeleton",""],["tabsScroller",""],["renameInput",""],[1,"home-page"],["aria-hidden","true",1,"tabs-wrapper","home-skeleton"],[1,"tabs-wrapper"],[1,"tabs-bar"],[1,"home-nav"],[1,"tabs-bar__nav","home-skeleton__tabs-row"],[1,"home-skeleton__tab-pills"],["variant","rounded","height","28",1,"home-skeleton__tab"],["aria-hidden","true",1,"home-menu-divider"],["variant","rounded","width","32","height","28","border-radius","8px"],["variant","circular","width","28","height","28"],[4,"ngTemplateOutlet"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"streamId"],[3,"done","failed","streamId"],[1,"tabs-bar__nav",3,"is-scrollable"],[1,"home-empty-state"],["contained","","no-header","","placement","end","label","Ask",1,"home-ai-drawer",3,"nile-request-close","open"],[3,"dashboardId","dashboardName","dashboardConfig","chatOnly","initialPrompt"],[1,"tabs-bar__nav"],["type","button","aria-label","Scroll tabs left",1,"tabs-scroll-btn","tabs-scroll-btn--left",3,"click","disabled"],["name","ng-chevron-left","method","stroke","size","16"],[1,"tabs-scroller",3,"scroll"],["variant","filled",1,"dashboard-tab-group"],["slot","nav","panel","__sentinel__",1,"tab-sentinel"],["slot","nav"],["type","button","aria-label","Scroll tabs right",1,"tabs-scroll-btn","tabs-scroll-btn--right",3,"click","disabled"],["name","ng-chevron-right","method","stroke","size","16"],[3,"resetKey"],["hoist","","placement","bottom-end",1,"home-category-filter",3,"nile-hide","open"],["slot","trigger","content","Filter by category"],["type","button","aria-label","Filter by category",1,"home-action-btn",3,"click"],["name","ng-filter-lines","method","stroke","size","18"],["aria-hidden","true",1,"home-category-filter__dot"],["variant","menu",1,"home-category-filter__panel",3,"mousedown","selectionChange","selected"],["content","Create dashboard"],["type","button","aria-label","Create dashboard",1,"home-action-btn",3,"click","disabled"],["name","ng-plus","method","stroke","size","18"],["content","Refresh dashboard"],[1,"home-actions"],["content","Executive Summary"],["placement","bottom-end",1,"home-download",3,"open"],["slot","nav",3,"click"],["name","ng-stars-02","method","stroke","size","14","color","#7a5af8","aria-label","Auto-generated dashboard",1,"tab-auto-badge"],[1,"tab-rename"],[1,"tab-rename",3,"click"],["type","text",1,"tab-rename-input",3,"input","keydown","click","value","disabled"],["type","button","aria-label","Save dashboard name",1,"tab-rename-save",3,"click","disabled"],["name","ng-check","method","stroke","size","14","color","#2970ff"],[1,"tab-label"],["type","button","aria-label","Rename dashboard",1,"tab-edit-btn"],["type","button","aria-label","Rename dashboard",1,"tab-edit-btn",3,"click"],["name","ng-edit-02","method","stroke","size","12"],[3,"apply","resetKey"],["type","button","aria-label","Refresh dashboard",1,"home-action-btn",3,"click","disabled"],["name","ng-refresh-ccw","method","stroke","size","18",1,"home-refresh-glyph"],["type","button","aria-label","Executive Summary",1,"home-action-btn",3,"click"],["name","ng-file-02","method","stroke","size","18"],["placement","bottom-end",1,"home-download",3,"nile-hide","open"],["slot","trigger","content","Download"],["type","button","aria-label","Download",1,"home-action-btn",3,"click"],["name","ng-download-01","method","stroke","size","18"],[3,"click"],["slot","prefix","name","ng-file-06","method","stroke","size","14"],["slot","prefix","name","ng-image-03","method","stroke","size","14"],["active","",1,"viewer-scroll-container"],["aria-hidden","true",1,"home-skeleton"],[3,"config"],[1,"home-empty-state__title"],[1,"home-empty-state__desc"],["variant","tertiary",3,"click"],[1,"home-empty-state__graphic"],["viewBox","0 0 380 140","aria-hidden","true","preserveAspectRatio","xMidYMid meet"],["x","40","y","20","width","300","height","100","rx","8","fill","#fff","stroke","#80AED3","stroke-width","1.5","stroke-dasharray","4 4"],["x","56","y","36","width","84","height","68","rx","6","fill","#F7FAFC","stroke","#E6E9EB"],["x","64","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["x","64","y","80","width","6","height","20","rx","1","fill","#005EA6","opacity","0.7"],["attributeName","height","values","20;14;20","dur","2s","repeatCount","indefinite"],["attributeName","y","values","80;86;80","dur","2s","repeatCount","indefinite"],["x","76","y","74","width","6","height","26","rx","1","fill","#005EA6"],["attributeName","height","values","26;18;26","dur","2s","begin","0.2s","repeatCount","indefinite"],["attributeName","y","values","74;82;74","dur","2s","begin","0.2s","repeatCount","indefinite"],["x","88","y","68","width","6","height","32","rx","1","fill","#005EA6","opacity","0.85"],["attributeName","height","values","32;24;32","dur","2s","begin","0.4s","repeatCount","indefinite"],["attributeName","y","values","68;76;68","dur","2s","begin","0.4s","repeatCount","indefinite"],["x","100","y","78","width","6","height","22","rx","1","fill","#005EA6","opacity","0.6"],["attributeName","height","values","22;16;22","dur","2s","begin","0.6s","repeatCount","indefinite"],["attributeName","y","values","78;84;78","dur","2s","begin","0.6s","repeatCount","indefinite"],["x","112","y","66","width","6","height","34","rx","1","fill","#005EA6","opacity","0.85"],["attributeName","height","values","34;26;34","dur","2s","begin","0.8s","repeatCount","indefinite"],["attributeName","y","values","66;74;66","dur","2s","begin","0.8s","repeatCount","indefinite"],["x","148","y","36","width","84","height","68","rx","6","fill","#F7FAFC","stroke","#E6E9EB"],["x","156","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["cx","190","cy","78","r","14","fill","none","stroke","#E6EFF6","stroke-width","5"],["cx","190","cy","78","r","14","fill","none","stroke","#005EA6","stroke-width","5","stroke-linecap","round","stroke-dasharray","88","stroke-dashoffset","88","transform","rotate(-90 190 78)"],["attributeName","stroke-dashoffset","values","88;22;22;88","keyTimes","0;0.5;0.85;1","dur","2.6s","repeatCount","indefinite"],["x","240","y","36","width","84","height","68","rx","6","fill","#F7FAFC","stroke","#E6E9EB"],["x","248","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["d","M 250 92 L 264 80 L 278 86 L 292 72 L 306 78 L 320 64","fill","none","stroke","#005EA6","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round","stroke-dasharray","200","stroke-dashoffset","200"],["attributeName","stroke-dashoffset","values","200;0;0;200","keyTimes","0;0.5;0.85;1","dur","2.6s","repeatCount","indefinite"],["cx","320","cy","64","r","2.5","fill","#005EA6"],["attributeName","opacity","values","0;0;1;1;0","keyTimes","0;0.45;0.55;0.85;1","dur","2.6s","repeatCount","indefinite"],["variant","primary","aria-label","Create dashboard",1,"home-empty-state__cta",3,"click"],["slot","prefix","name","ng-plus","size","16"],[3,"closePanel","dashboardId","dashboardName","dashboardConfig","chatOnly","initialPrompt"],[1,"home-nav__title-block"],[1,"home-nav__title"],[1,"home-nav__sub"],[1,"home-skeleton__panel"],[1,"home-skeleton__kpis"],[1,"home-skeleton__kpi"],[1,"home-skeleton__widgets"],[1,"home-skeleton__widget"],[1,"home-skeleton__kpi-head"],["variant","text","width","56%","height","14"],["variant","rounded","width","32","height","32","border-radius","8px"],["variant","text","width","48%","height","30"],[1,"home-skeleton__kpi-row"],["variant","rounded","width","72","height","20","border-radius","999px"],["variant","text","width","38%","height","11"],["variant","rounded","width","100%","height","44","border-radius","8px",1,"home-skeleton__kpi-spark"],[1,"home-skeleton__widget-head"],[1,"home-skeleton__widget-titles"],["variant","text","width","42%","height","16"],["variant","text","width","64%","height","11"],["variant","circular","width","20","height","20"],["variant","rounded","width","100%","height","100%","border-radius","10px",1,"home-skeleton__widget-chart"]],template:function(e,n){e&1&&(s(0,"div",4),_(1,Hn,12,2,"div",5),_(2,Bn,6,3,"div",6),_(3,gi,9,5,"div",6),l(),L(4,pi,5,1,"ng-template",null,0,fe)(6,ui,7,0,"ng-template",null,1,fe)),e&2&&(c(),y(n.isLoading()?1:-1),c(),y(!n.isLoading()&&n.isGenerating()?2:-1),c(),y(!n.isLoading()&&!n.isGenerating()?3:-1))},dependencies:[Me,Ce,Ne,ze,$e,$t],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;height:100%;min-height:0}.home-page[_ngcontent-%COMP%]{height:100%;min-height:0;display:flex;flex-direction:column;background:var(--ng-colors-bg-active);overflow:visible;position:relative}.loading-state[_ngcontent-%COMP%], .empty-state[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:200px;color:var(--ng-colors-text-tertiary-600)}.home-empty-state[_ngcontent-%COMP%]{margin:24px;padding:56px 32px;display:flex;flex-direction:column;align-items:center;text-align:center;background:var(--ng-colors-bg-primary);border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:12px}.home-empty-state__graphic[_ngcontent-%COMP%]{width:380px;max-width:100%;height:140px;margin-bottom:24px;display:block}.home-empty-state__graphic[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{display:block;width:100%;height:100%}.home-empty-state__title[_ngcontent-%COMP%]{margin:0 0 8px;font-size:16px;font-weight:600;color:var(--ng-colors-text-primary-900, #181d27);letter-spacing:-.01em}.home-empty-state__desc[_ngcontent-%COMP%]{margin:0;max-width:480px;font-size:14px;line-height:1.5;color:var(--ng-colors-text-tertiary-600, #535862)}.home-empty-state__cta[_ngcontent-%COMP%]{margin-top:24px}.toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;height:64px;padding:0 38px;background:var(--ng-componentcolors-alpha-white-100);border-bottom:1px solid var(--ng-componentcolors-alpha-black-10);position:fixed;top:var(--nav-height, 56px);left:0;right:0;z-index:var(--z-header)}.toolbar__right[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--ng-spacing-3, 12px)}.tabs-wrapper[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;min-height:0}.tabs-bar[_ngcontent-%COMP%]{position:relative;min-height:0;display:flex;flex-direction:column}.tabs-bar[_ngcontent-%COMP%] .home-nav[_ngcontent-%COMP%]{position:sticky;top:0;z-index:var(--z-sticky-row);display:flex;align-items:center;justify-content:space-between;gap:16px;height:76px;margin:0;padding:0 22px;background:var(--ng-componentcolors-alpha-white-100, #ffffff);border-bottom:1px solid var(--ng-colors-border-secondary, #e9eaeb);flex-shrink:0}.tabs-bar[_ngcontent-%COMP%] .home-nav__title-block[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;min-width:0}.tabs-bar[_ngcontent-%COMP%] .home-nav__title[_ngcontent-%COMP%]{margin:0;font-size:16px;font-weight:600;color:var(--ng-colors-text-primary-900, #181d27);line-height:1.2;letter-spacing:-.01em}.tabs-bar[_ngcontent-%COMP%] .home-nav__sub[_ngcontent-%COMP%]{margin:0;font-size:13px;font-weight:400;color:var(--ng-colors-text-tertiary-600, #535862);line-height:1.3}.tabs-bar[_ngcontent-%COMP%] .tabs-bar__nav[_ngcontent-%COMP%]{position:sticky;top:76px;height:56px;display:flex;align-items:center;gap:4px;z-index:var(--z-sticky-row);min-width:0;margin:0;padding:22px;background:var(--ng-componentcolors-alpha-white-100, #ffffff);border-bottom:1px solid var(--ng-colors-border-secondary, #e9eaeb)}.tabs-bar[_ngcontent-%COMP%] .home-menu-divider[_ngcontent-%COMP%]{width:1px;height:20px;background:var(--ng-colors-border-secondary, #e9eaeb);margin:0 6px 0 8px;flex-shrink:0}.tabs-bar[_ngcontent-%COMP%] .tabs-scroller[_ngcontent-%COMP%]{flex:1;min-width:0;overflow-x:auto;overflow-y:hidden;position:relative;scrollbar-width:none}.tabs-bar[_ngcontent-%COMP%] .tabs-scroller[_ngcontent-%COMP%]::-webkit-scrollbar{display:none}.tabs-bar[_ngcontent-%COMP%] .dashboard-tab-group[_ngcontent-%COMP%]{display:block;width:max-content;min-width:100%}.tabs-bar[_ngcontent-%COMP%] .tab-sentinel[_ngcontent-%COMP%]{display:none!important}.tabs-bar[_ngcontent-%COMP%] .tab-auto-badge[_ngcontent-%COMP%]{display:inline-flex;vertical-align:text-bottom;margin-right:4px;flex:0 0 auto}.tabs-bar[_ngcontent-%COMP%] .tab-label[_ngcontent-%COMP%]{white-space:nowrap}.tabs-bar[_ngcontent-%COMP%] .tab-edit-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-left:4px;padding:0;border:0;background:transparent;border-radius:4px;color:var(--ng-colors-text-tertiary-600, #535862);cursor:pointer;opacity:0;pointer-events:none;flex:0 0 auto;transition:background .15s,opacity .15s,color .15s}.tabs-bar[_ngcontent-%COMP%] .tab-edit-btn[_ngcontent-%COMP%]:hover, .tabs-bar[_ngcontent-%COMP%] .tab-edit-btn[_ngcontent-%COMP%]:focus-visible{background:var(--ng-colors-bg-active, #e9eaeb);color:var(--ng-colors-text-primary-900, #181d27)}.tabs-bar[_ngcontent-%COMP%] nile-nav-tab[_ngcontent-%COMP%]:hover .tab-edit-btn[_ngcontent-%COMP%], .tabs-bar[_ngcontent-%COMP%] .tab-edit-btn[_ngcontent-%COMP%]:focus-visible{opacity:1;pointer-events:auto}.tabs-bar[_ngcontent-%COMP%] .tab-rename[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:4px}.tabs-bar[_ngcontent-%COMP%] .tab-rename-input[_ngcontent-%COMP%]{width:140px;height:24px;padding:0 6px;font-size:13px;font-weight:600;color:var(--ng-colors-text-primary-900, #181d27);background:#fff;border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:6px;outline:none}.tabs-bar[_ngcontent-%COMP%] .tab-rename-input[_ngcontent-%COMP%]:focus{border-color:#2970ff;box-shadow:0 0 0 3px #2970ff29}.tabs-bar[_ngcontent-%COMP%] .tab-rename-save[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:0;background:transparent;border-radius:4px;cursor:pointer;flex:0 0 auto}.tabs-bar[_ngcontent-%COMP%] .tab-rename-save[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--ng-colors-bg-quaternary, #f2f4f7)}.tabs-bar[_ngcontent-%COMP%] .tab-rename-save[_ngcontent-%COMP%]:disabled{cursor:default;opacity:.5}.tabs-bar[_ngcontent-%COMP%] .tabs-scroll-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;outline:0;background:transparent;color:var(--ng-colors-text-tertiary-600, #535862);cursor:pointer;border-radius:6px;flex-shrink:0;opacity:0;pointer-events:none;transition:opacity .15s,background .15s,color .15s}.tabs-bar[_ngcontent-%COMP%] .tabs-scroll-btn[_ngcontent-%COMP%]:hover, .tabs-bar[_ngcontent-%COMP%] .tabs-scroll-btn[_ngcontent-%COMP%]:focus, .tabs-bar[_ngcontent-%COMP%] .tabs-scroll-btn[_ngcontent-%COMP%]:focus-visible{outline:0;background:var(--ng-colors-bg-active, #e9eaeb);color:var(--ng-colors-text-primary-900, #181d27)}.tabs-bar[_ngcontent-%COMP%] .tabs-scroll-btn[disabled][_ngcontent-%COMP%]{cursor:default;color:var(--ng-colors-text-disabled, #a4a7ae);background:transparent}.tabs-bar[_ngcontent-%COMP%] .tabs-bar__nav.is-scrollable[_ngcontent-%COMP%]:hover .tabs-scroll-btn[_ngcontent-%COMP%], .tabs-bar[_ngcontent-%COMP%] .tabs-bar__nav.is-scrollable[_ngcontent-%COMP%]:focus-within .tabs-scroll-btn[_ngcontent-%COMP%]{opacity:1;pointer-events:auto}.more-menu[_ngcontent-%COMP%]{width:260px;max-height:320px;overflow-y:auto;padding:var(--ng-spacing-xs) 0}.more-menu-item[_ngcontent-%COMP%]{padding:var(--ng-spacing-xs) var(--ng-spacing-md);display:flex;align-items:center;cursor:pointer}.more-menu-item[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.more-menu-item[_ngcontent-%COMP%] nile-checkbox[_ngcontent-%COMP%]{width:100%}nile-tab-panel[_ngcontent-%COMP%], nile-nav-tab-panel[_ngcontent-%COMP%]{display:block;height:100%}.panel-loading[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:200px}.home-skeleton__tabs-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.home-skeleton__tab-pills[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px;flex-shrink:0}.home-skeleton__tab[_ngcontent-%COMP%]{flex:0 0 auto}.home-skeleton__panel[_ngcontent-%COMP%]{flex:1;min-height:0;padding:18px 24px 32px;display:flex;flex-direction:column;gap:16px;overflow:auto}.home-skeleton__kpis[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}@media(max-width:1100px){.home-skeleton__kpis[_ngcontent-%COMP%]{grid-template-columns:repeat(2,1fr)}}.home-skeleton__kpi[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px;padding:18px 20px;border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:12px;background:#fff}.home-skeleton__kpi-head[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px}.home-skeleton__kpi-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;margin-top:4px}.home-skeleton__kpi-spark[_ngcontent-%COMP%]{margin-top:6px}.home-skeleton__widgets[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}@media(max-width:900px){.home-skeleton__widgets[_ngcontent-%COMP%]{grid-template-columns:1fr}}.home-skeleton__widget[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:18px;padding:20px 22px;border:1px solid var(--ng-colors-border-secondary, #e9eaeb);border-radius:12px;background:#fff;min-height:320px}.home-skeleton__widget-head[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.home-skeleton__widget-titles[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}.home-skeleton__widget-chart[_ngcontent-%COMP%]{display:block;flex:1;min-height:0}.viewer-scroll-container[_ngcontent-%COMP%]{display:block;flex:1;min-height:0;overflow:auto}.viewer-scroll-container[_ngcontent-%COMP%]::part(base){padding:unset;min-height:100%}[_nghost-%COMP%] .viewer-scroll-container:has(.aq-detail-overlay){overflow:hidden}app-dashboard-viewer[_ngcontent-%COMP%], nile-dashboard-viewer[_ngcontent-%COMP%]{display:block;width:100%;height:100%}.export-menu[_ngcontent-%COMP%] nile-menu-item[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm, 14px);font-weight:var(--ng-font-weight-medium, 500)}.home-actions[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.home-action-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;outline:0;background:transparent;color:var(--ng-colors-text-tertiary-600, #535862);cursor:pointer;border-radius:6px;flex-shrink:0}.home-action-btn[_ngcontent-%COMP%]:hover, .home-action-btn[_ngcontent-%COMP%]:focus, .home-action-btn[_ngcontent-%COMP%]:focus-visible{outline:0;background:var(--ng-colors-bg-active, #e9eaeb);color:var(--ng-colors-text-primary-900, #181d27)}.home-category-filter[_ngcontent-%COMP%] .home-action-btn[_ngcontent-%COMP%]{position:relative}.home-category-filter__dot[_ngcontent-%COMP%]{position:absolute;top:3px;right:3px;width:6px;height:6px;border-radius:50%;background:var(--ng-colors-fg-brand-primary-600)}.home-category-filter[_ngcontent-%COMP%]::part(panel){background:transparent;box-shadow:none;border-radius:0}.home-category-filter__panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1px;min-width:200px;max-height:320px;overflow-y:auto;padding:6px;background:var(--ng-colors-bg-primary);border:1px solid var(--ng-colors-border-primary);border-radius:var(--ng-radius-lg);box-shadow:var(--ng-shadow-lg)}.home-refresh-glyph[_ngcontent-%COMP%]{display:inline-flex;transform-origin:50% 50%}.home-refresh-glyph--spinning[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_home-refresh-spin .9s linear infinite}@keyframes _ngcontent-%COMP%_home-refresh-spin{to{transform:rotate(360deg)}}.home-ai-drawer[_ngcontent-%COMP%]::part(base){z-index:var(--z-drawer, 900)}.home-ai-drawer[_ngcontent-%COMP%]::part(panel){width:100%;max-width:100%}.home-ai-drawer[_ngcontent-%COMP%]::part(body){padding:0;overflow:hidden}.home-ai-drawer[_ngcontent-%COMP%] db-ai-prompt-panel[_ngcontent-%COMP%]{display:block;height:100%;min-height:0}.home-category-filter__heading[_ngcontent-%COMP%]{display:block;padding:6px 10px 4px;font-size:10.5px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--ng-colors-text-tertiary-600)}.home-category-filter__item[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:7px 10px;border:0;border-radius:7px;background:transparent;font:inherit;font-size:13px;color:var(--ng-colors-text-secondary-700);text-align:left;white-space:nowrap;cursor:pointer}.home-category-filter__item[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.home-category-filter__item.is-active[_ngcontent-%COMP%]{color:var(--ng-colors-fg-brand-primary-600);font-weight:600;background:var(--ng-colors-bg-secondary)}.home-category-filter__label[_ngcontent-%COMP%]{min-width:0;overflow:hidden;text-overflow:ellipsis}']})};function fi(r,t){r&1&&h(0,"dvz-dashboards-page")}var We=class r{config=Y(void 0);ready=be({alias:"dvz-ready"});error=be({alias:"dvz-error"});unauthorized=be({alias:"dvz-unauthorized"});navigate=be({alias:"dvz-navigate"});host=v(re);navigator=v(G);destroyRef=v(Xe);stopAdopting=null;stopTokenRefresh=null;stopUi=null;configured=!1;constructor(){X(()=>{let t=this.config();t&&this.apply(t)}),this.navigator.requests.pipe(Et(this.destroyRef)).subscribe(t=>this.navigate.emit(t)),queueMicrotask(()=>{let t=this.host.nativeElement.shadowRoot;t&&(this.stopAdopting=je(t))})}async apply(t){let e=t.auth;Ct(t.api.baseUrl),bt(t.api,e);let n=jt({baseUrl:t.api.baseUrl,mcpUrl:t.api.mcpUrl,tokenizedOrigins:t.api.tokenizedOrigins,headers:t.api.headers,customerId:t.tenant.customerId??null,productId:t.tenant.productId,productName:t.tenant.productName??null,authMode:e.mode,authToken:e.mode==="token"?e.token:null,getToken:e.mode==="callback"?e.getToken:null,onUnauthorized:()=>this.unauthorized.emit(),features:t.features,ui:t.ui,copy:t.copy,hrefs:t.hrefs,initialDashboardId:t.initial?.dashboardId??null});this.stopUi?.(),this.stopUi=Ze(this.host.nativeElement,t.ui),xt({productId:t.tenant.productId,name:t.tenant.productName}),yt(()=>this.unauthorized.emit());let i=n;if(await ut(i),this.stopTokenRefresh??=ft(i),!this.configured){this.configured=!0;let o=D();this.ready.emit({customerId:o.customerId??"",productId:o.productId??""})}}ngOnDestroy(){this.stopAdopting?.(),this.stopTokenRefresh?.(),this.stopUi?.()}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=z({type:r,selectors:[["dvz-dashboards-root"]],inputs:{config:[1,"config"]},outputs:{ready:"dvz-ready",error:"dvz-error",unauthorized:"dvz-unauthorized",navigate:"dvz-navigate"},features:[se([G])],decls:1,vars:1,template:function(e,n){e&1&&_(0,fi,1,0,"dvz-dashboards-page"),e&2&&y(n.config()?0:-1)},dependencies:[Ve],styles:[`:host{display:block;height:100%;min-height:0}
|
|
2
|
+
`],encapsulation:3,changeDetection:0})};ht();var bi="dvz-dashboards";function _i(r={}){return pt(We,bi,[et(),_t(),dt(ct([wt])),{provide:Pt,useFactory:()=>D().baseUrl},Dt($),St(T),Ot(T),Oe(T),ke(T),Se(T),Te(T),At(T)],r)}_i();export{bi as a,_i as b};
|
package/index.d.ts
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* WHY HAND-AUTHORED. The implementation imports @aquera/dvz-core,
|
|
5
5
|
* @shared/data-access-auth and @shared/components; running `tsc --declaration`
|
|
6
6
|
* against it drags every one of those internal libraries' types into the emit.
|
|
7
|
-
* Only the
|
|
7
|
+
* Only the *-config.ts files compile standalone, so only they are generated.
|
|
8
8
|
* See the "Trap" note in the SDK README.
|
|
9
9
|
*
|
|
10
|
-
* The generated files land under ask-aquera/src
|
|
11
|
-
* declarations tsconfig roots at the SDK
|
|
12
|
-
* the re-export paths below.
|
|
10
|
+
* The generated files land under ask-aquera/src/, dashboards/src/ and
|
|
11
|
+
* manage-dashboards/src/ because the declarations tsconfig roots at the SDK
|
|
12
|
+
* directory to reach every sibling — hence the re-export paths below.
|
|
13
13
|
*
|
|
14
14
|
* KEEP IN SYNC with src/element.ts and src/index.ts by hand.
|
|
15
15
|
*/
|
|
@@ -21,6 +21,7 @@ export interface DefineOptions {
|
|
|
21
21
|
/** The tags this package registers unless a host asks for others. */
|
|
22
22
|
export declare const DVZ_ASK_TAG: 'dvz-ask';
|
|
23
23
|
export declare const DVZ_DASHBOARDS_TAG: 'dvz-dashboards';
|
|
24
|
+
export declare const DVZ_MANAGE_DASHBOARDS_TAG: 'dvz-manage-dashboards';
|
|
24
25
|
export declare const DATA_VISUALIZER_SDK_VERSION: string;
|
|
25
26
|
|
|
26
27
|
export interface DataVizWindowDebug {
|
|
@@ -35,8 +36,16 @@ declare global {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Publish the host's backends into the store the SDK reads. The elements do this
|
|
41
|
+
* themselves from `el.config`; call it at bootstrap only if something reads the
|
|
42
|
+
* environment before an element mounts. Missing from 0.0.13.
|
|
43
|
+
*/
|
|
44
|
+
export declare function setDvzEnv(values: Record<string, unknown>): void;
|
|
45
|
+
|
|
38
46
|
export declare function defineDvzAsk(opts?: DefineOptions): Promise<void>;
|
|
39
47
|
export declare function defineDvzDashboards(opts?: DefineOptions): Promise<void>;
|
|
48
|
+
export declare function defineDvzManageDashboards(opts?: DefineOptions): Promise<void>;
|
|
40
49
|
|
|
41
50
|
/** Register every component in this package. Idempotent — each define is memoised per tag. */
|
|
42
51
|
export declare function defineDvzAll(): Promise<void>;
|
|
@@ -47,3 +56,9 @@ export type {
|
|
|
47
56
|
DvzDashboardsCopy,
|
|
48
57
|
DvzDashboardsEventMap,
|
|
49
58
|
} from './dashboards/src/dashboards-config';
|
|
59
|
+
export type {
|
|
60
|
+
DvzManageDashboardsConfig,
|
|
61
|
+
DvzManageDashboardsElement,
|
|
62
|
+
DvzManageDashboardsEventMap,
|
|
63
|
+
DvzManageDashboardsView,
|
|
64
|
+
} from './manage-dashboards/src/manage-dashboards-config';
|
package/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,b as
|
|
1
|
+
import{a as d,b as f}from"./chunk-BWOCVRQM.js";import"./chunk-XUJBDACP.js";import{a as i,b as n}from"./chunk-47JFEXYX.js";import{a as t,b as D}from"./chunk-YVK6OFZS.js";import{u as s}from"./chunk-O6T6EAR2.js";import"./chunk-JP5QY5S6.js";import"./chunk-U4S2XPPP.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-T4WJW6GR.js";import"./chunk-QXVITQOV.js";import"./chunk-I4TM4AGJ.js";import"./chunk-F6YL5NFN.js";import"./chunk-ATUZQYGW.js";import"./chunk-XCT4UKLK.js";import"./chunk-4XZ7RFFX.js";import"./chunk-YHTLTPEH.js";import"./chunk-LFSX3TZJ.js";import"./chunk-BTDKTIE6.js";import"./chunk-5CTM6JVQ.js";import"./chunk-W2HKCDVZ.js";import"./chunk-MPGDQZRI.js";import"./chunk-HOS2FAXH.js";import"./chunk-INJSG5RK.js";import"./chunk-RCWO45CI.js";import"./chunk-ZW5NV4UO.js";var p="0.0.15",a=p;function g(){typeof window>"u"||(window.dataViz={packageName:"@aquera/data-visualizer-sdk",version:a,getVersion:()=>a})}g();async function A(){let[{defineDvzAsk:e},{defineDvzDashboards:o},{defineDvzManageDashboards:r}]=await Promise.all([import("./chunk-LF44PEDM.js"),import("./chunk-L764UFCZ.js"),import("./chunk-CJKWIGF2.js")]);await Promise.all([e(),o(),r()])}export{a as DATA_VISUALIZER_SDK_VERSION,i as DVZ_ASK_TAG,t as DVZ_DASHBOARDS_TAG,d as DVZ_MANAGE_DASHBOARDS_TAG,A as defineDvzAll,n as defineDvzAsk,D as defineDvzDashboards,f as defineDvzManageDashboards,s as setDvzEnv};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public config contract for <dvz-manage-dashboards>.
|
|
3
|
+
*
|
|
4
|
+
* SCOPE OF THE ELEMENT. It renders the category filter and the dashboard card
|
|
5
|
+
* grid — and, when one is open, the builder. It does NOT render the page title,
|
|
6
|
+
* the subtitle, or the search / "Create dashboard" toolbar above them: that
|
|
7
|
+
* chrome belongs to the host, which already owns the surrounding page and its
|
|
8
|
+
* permissions. Two consequences for this contract:
|
|
9
|
+
* - `search` is a DOM PROPERTY (`el.search = '…'`), not a config field, since
|
|
10
|
+
* the host's box owns the value and it changes per keystroke.
|
|
11
|
+
* - `ui.header` has nothing to hide here; it is kept only because `ui` is the
|
|
12
|
+
* shape every SDK element shares.
|
|
13
|
+
* The grid's own empty-state CTA is unaffected — that is content, not chrome.
|
|
14
|
+
*
|
|
15
|
+
* ZERO IMPORTS, deliberately — including of `DvzBaseConfig`, which it otherwise
|
|
16
|
+
* mirrors field for field. This is the one module in the package that
|
|
17
|
+
* `tsc --declaration` can compile standalone, which is what makes a real
|
|
18
|
+
* generated `.d.ts` for the public contract possible. Importing core here would
|
|
19
|
+
* drag @aquera/dvz-core (and through it @shared/*) into the emit. See the "Trap"
|
|
20
|
+
* note in the SDK README and tooling/build-package.mjs.
|
|
21
|
+
*/
|
|
22
|
+
export interface DvzManageDashboardsConfig {
|
|
23
|
+
api: {
|
|
24
|
+
/** Required. The dashboards backend. */
|
|
25
|
+
baseUrl: string;
|
|
26
|
+
mcpUrl?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Absolute origins allowed to receive the bearer token. Defaults to the
|
|
29
|
+
* backends named above — set it only to widen or restrict that.
|
|
30
|
+
*/
|
|
31
|
+
tokenizedOrigins?: string[];
|
|
32
|
+
/** Extra headers on every request (tracing ids, tenancy hints, …). */
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
tenant: {
|
|
36
|
+
/** Overrides the session cookie's tenant when set. */
|
|
37
|
+
customerId?: string;
|
|
38
|
+
productId: string;
|
|
39
|
+
/** Some backend behaviour keys off the product NAME as well as its id. */
|
|
40
|
+
productName?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* 'inherit' — reuse the host page's existing Aquera session (cookie / SDK).
|
|
44
|
+
* Only meaningful inside an Aquera-owned page.
|
|
45
|
+
* 'token' — a static bearer. Simple, but the host must re-set it on expiry.
|
|
46
|
+
* 'callback' — recommended for embedding. Called to obtain a fresh bearer, so
|
|
47
|
+
* expiry stays the host's concern and no refresh logic crosses over.
|
|
48
|
+
*/
|
|
49
|
+
auth: {
|
|
50
|
+
mode: 'inherit';
|
|
51
|
+
ssoEnabled?: boolean;
|
|
52
|
+
} | {
|
|
53
|
+
mode: 'token';
|
|
54
|
+
token: string;
|
|
55
|
+
} | {
|
|
56
|
+
mode: 'callback';
|
|
57
|
+
getToken: () => string | Promise<string>;
|
|
58
|
+
};
|
|
59
|
+
/** Turn surfaces off. Everything defaults to on. */
|
|
60
|
+
features?: {
|
|
61
|
+
/** Route reads through the MCP gateway instead of the REST API. */
|
|
62
|
+
mcpGateway?: boolean;
|
|
63
|
+
/** The "Create dashboard" action on the list page. */
|
|
64
|
+
create?: boolean;
|
|
65
|
+
/** The category filter row on the list page. */
|
|
66
|
+
categoryFilter?: boolean;
|
|
67
|
+
/** Per-card delete. */
|
|
68
|
+
delete?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The builder itself. Default on.
|
|
71
|
+
*
|
|
72
|
+
* OFF makes this a LIST-ONLY element: opening a dashboard stops being an
|
|
73
|
+
* internal view swap and becomes a `dvz-navigate` to `hrefs.builder`. That is
|
|
74
|
+
* how WFI's Settings screen embeds it — "Manage Dashboards" is one tab there,
|
|
75
|
+
* and clicking a card has always left Settings for the full-page builder
|
|
76
|
+
* rather than nesting an 8k-line editor inside a tab panel.
|
|
77
|
+
*/
|
|
78
|
+
builder?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The actions that deep-link a dashboard into Ask Aquera. Off means the
|
|
81
|
+
* element never asks the host to navigate there.
|
|
82
|
+
*/
|
|
83
|
+
askAquera?: boolean;
|
|
84
|
+
};
|
|
85
|
+
ui?: {
|
|
86
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
87
|
+
density?: 'comfortable' | 'compact';
|
|
88
|
+
/** Hide the element's own header when the host supplies its own chrome. */
|
|
89
|
+
header?: boolean;
|
|
90
|
+
locale?: string;
|
|
91
|
+
};
|
|
92
|
+
/** 'none' (default) — the element never touches the URL; it emits dvz-navigate. */
|
|
93
|
+
routing?: 'none' | 'memory' | 'hash';
|
|
94
|
+
/**
|
|
95
|
+
* Where the element's outbound navigations point. The element never routes
|
|
96
|
+
* itself — these are the `to` values it emits on `dvz-navigate`, so a host that
|
|
97
|
+
* mounts the SDK under different paths can relabel them without patching the
|
|
98
|
+
* element.
|
|
99
|
+
*
|
|
100
|
+
* Opening a dashboard is normally NOT here, unlike <dvz-dashboards>: the builder
|
|
101
|
+
* is inside this element, so it is internal view state rather than a navigation.
|
|
102
|
+
* `builder` below is the exception, and only applies when
|
|
103
|
+
* `features.builder` is off. See manage-dashboards-navigator.service.ts.
|
|
104
|
+
*/
|
|
105
|
+
hrefs?: {
|
|
106
|
+
/** Target of the Ask Aquera actions. Default '/ask-aquera'. */
|
|
107
|
+
askAquera?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Where opening a dashboard goes when `features.builder` is off. The id is
|
|
110
|
+
* appended. Default '/manage-dashboards'. Ignored when the builder is on,
|
|
111
|
+
* because then there is nowhere to navigate to.
|
|
112
|
+
*/
|
|
113
|
+
builder?: string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Open straight into the builder for one dashboard instead of the list. The
|
|
117
|
+
* element's equivalent of deep-linking `/manage-dashboards/:id`.
|
|
118
|
+
*/
|
|
119
|
+
initial?: {
|
|
120
|
+
dashboardId?: string;
|
|
121
|
+
/** Preselect a connection in the builder — the old `?datasource=`. */
|
|
122
|
+
datasource?: string;
|
|
123
|
+
/** Open the create-dashboard flow — the old `?tool=createDashboard`. */
|
|
124
|
+
createDashboard?: boolean;
|
|
125
|
+
/** Open one of the AI panel's tool drawers — the old `?tool=` values. */
|
|
126
|
+
tool?: 'widgetLibrary' | 'allDashboards' | 'allPipelines';
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Which of the element's two views is showing. Set as a DOM property —
|
|
131
|
+
* `el.view = { dashboardId: 'abc' }` — SEPARATELY from `config`.
|
|
132
|
+
*
|
|
133
|
+
* WHY IT IS NOT PART OF `config.initial`. `initial` is applied once, on the first
|
|
134
|
+
* config, so that a host re-assigning `el.config` (a rotated token, a theme
|
|
135
|
+
* switch) does not yank the user out of the dashboard they have open. But a host
|
|
136
|
+
* that mirrors this element into its own URL needs the opposite: an ongoing,
|
|
137
|
+
* re-assignable channel, so browser back/forward can put the element back where
|
|
138
|
+
* the URL says it should be. Hence a second property.
|
|
139
|
+
*
|
|
140
|
+
* Together with the `dvz-view-changed` event this is a two-way binding: the
|
|
141
|
+
* element reports where it went, the host writes it into the URL, and a later
|
|
142
|
+
* history navigation writes it back. Assigning the value the element just
|
|
143
|
+
* reported is a no-op, so the two do not loop.
|
|
144
|
+
*
|
|
145
|
+
* A host that does not care about URLs can ignore both halves entirely.
|
|
146
|
+
*/
|
|
147
|
+
export interface DvzManageDashboardsView {
|
|
148
|
+
/** `null` or absent shows the All Dashboards list. */
|
|
149
|
+
dashboardId?: string | null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The element as the DOM sees it — every property a host assigns, in one type.
|
|
153
|
+
*
|
|
154
|
+
* WHY THIS EXISTS. `config` and `view` had named types but `search` had none, so
|
|
155
|
+
* a TypeScript host had no way to discover it and had to hand-write the
|
|
156
|
+
* intersection cast. Both of WFI's own hosts did exactly that, twice, which is
|
|
157
|
+
* the signal that it belonged in the package.
|
|
158
|
+
*
|
|
159
|
+
* const el = document.querySelector('dvz-manage-dashboards') as DvzManageDashboardsElement;
|
|
160
|
+
* el.config = { … };
|
|
161
|
+
* el.search = 'onboarding';
|
|
162
|
+
*/
|
|
163
|
+
export interface DvzManageDashboardsElement extends HTMLElement {
|
|
164
|
+
/** Set as a DOM property — never an attribute; it carries functions. */
|
|
165
|
+
config: DvzManageDashboardsConfig;
|
|
166
|
+
/** Which view is showing. Re-assignable; see DvzManageDashboardsView. */
|
|
167
|
+
view: DvzManageDashboardsView;
|
|
168
|
+
/**
|
|
169
|
+
* The list's search term. Push the RAW value — the query is server-side and
|
|
170
|
+
* the element debounces it by 300ms, so a host that debounces too only adds
|
|
171
|
+
* lag. Assigning '' clears the filter.
|
|
172
|
+
*/
|
|
173
|
+
search: string;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Events <dvz-manage-dashboards> dispatches, as CustomEvent detail payloads.
|
|
177
|
+
*
|
|
178
|
+
* The `dvz-` prefix is not cosmetic: an output aliased plain `error` would
|
|
179
|
+
* collide with the DOM's own error event.
|
|
180
|
+
*/
|
|
181
|
+
export interface DvzManageDashboardsEventMap {
|
|
182
|
+
'dvz-ready': {
|
|
183
|
+
customerId: string;
|
|
184
|
+
productId: string;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* NOT EMITTED YET. Declared because it is part of `DvzBaseEventMap` and both
|
|
188
|
+
* sibling elements declare it the same way — removing it here alone would make
|
|
189
|
+
* this the one element with a different base shape. Nothing in the lifted
|
|
190
|
+
* source raises it; failures surface as in-page toasts instead. Wire it before
|
|
191
|
+
* telling an embedder to listen for it.
|
|
192
|
+
*/
|
|
193
|
+
'dvz-error': {
|
|
194
|
+
message: string;
|
|
195
|
+
code?: string | number;
|
|
196
|
+
};
|
|
197
|
+
'dvz-unauthorized': Record<string, never>;
|
|
198
|
+
/** The element wants the host to navigate. It never touches the URL itself. */
|
|
199
|
+
'dvz-navigate': {
|
|
200
|
+
to: string;
|
|
201
|
+
queryParams?: Record<string, string | number>;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* The element swapped between its own two views — the list and the builder.
|
|
205
|
+
*
|
|
206
|
+
* This is NOT `dvz-navigate`: nothing left the element and the host is not being
|
|
207
|
+
* asked to do anything. It is reported so a host that mounts the element on a
|
|
208
|
+
* route with an id segment can keep that URL honest (and so deep links, refresh
|
|
209
|
+
* and the back button keep working, as they did when these were two routes).
|
|
210
|
+
* Ignore it and the element still works — the URL just stops moving.
|
|
211
|
+
*/
|
|
212
|
+
'dvz-view-changed': {
|
|
213
|
+
view: 'list' | 'builder';
|
|
214
|
+
dashboardId: string | null;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Something was created, renamed, published or deleted. Unlike <dvz-dashboards> —
|
|
218
|
+
* whose config file explains why it does NOT offer a changed-event — this
|
|
219
|
+
* element is the WRITE surface, so a host showing a dashboard list beside it has
|
|
220
|
+
* a real reason to know.
|
|
221
|
+
*
|
|
222
|
+
* NO PAYLOAD, deliberately. It is re-emitted from `DashboardsBus.changes$`,
|
|
223
|
+
* which is an `Observable<void>` shared across MFEs through a window-scoped
|
|
224
|
+
* Subject — the notifying call sites pass nothing. Declaring `{ action,
|
|
225
|
+
* dashboardId }` here would put fields in the contract that no emitter can
|
|
226
|
+
* fill; a host that needs specifics refetches its list, which is what the
|
|
227
|
+
* in-repo consumers of the bus already do.
|
|
228
|
+
*/
|
|
229
|
+
'dvz-dashboard-changed': Record<string, never>;
|
|
230
|
+
/**
|
|
231
|
+
* The dashboard list settled — after a load, a search, a category change or a
|
|
232
|
+
* page change.
|
|
233
|
+
*
|
|
234
|
+
* Exists so a host that supplies its own search box (which is the normal
|
|
235
|
+
* arrangement, since the box is not in this element) can render a result
|
|
236
|
+
* count, a spinner, or its own no-results message beside it. Without it search
|
|
237
|
+
* is drive-only: the host can set the term but learns nothing about the
|
|
238
|
+
* outcome, and the count is stranded inside the element's own footer.
|
|
239
|
+
*
|
|
240
|
+
* `total` is the server's count for the current filter; `shown` is how many
|
|
241
|
+
* rows this page rendered.
|
|
242
|
+
*/
|
|
243
|
+
'dvz-list-changed': {
|
|
244
|
+
total: number;
|
|
245
|
+
shown: number;
|
|
246
|
+
loading: boolean;
|
|
247
|
+
search: string;
|
|
248
|
+
category: string | null;
|
|
249
|
+
};
|
|
250
|
+
}
|