@aquera/data-visualizer-sdk 0.0.47 → 0.0.48

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.
@@ -1,10 +1,10 @@
1
- import{$ as un,$a as $n,A as Jt,Aa as In,B as Zt,C as en,Ca as $e,D as tn,E as nn,F as on,G as an,Ga as We,I as rn,K as ln,L as ae,M as sn,Ma as Be,Na as Ue,O as ge,Oa as Ge,Pa as je,Qa as He,R as dn,Ra as Ye,Sa as Ke,T as cn,Ta as Qe,U as pn,Ua as Vn,V as _n,Va as pt,X as ze,Xa as Rn,Ya as zn,Z as gn,Za as Nn,_a as Ln,a as qt,aa as mn,b as Dt,ba as Ne,c as Wt,ca as hn,da as Pe,db as Wn,ea as dt,eb as Bn,f as Bt,fa as ct,fb as Un,ga as Cn,gb as Gn,h as Ut,ha as fn,hb as ue,ia as xn,ja as yn,jb as jn,k as Gt,ka as bn,l as oe,la as vn,m as _e,ma as wn,n as jt,na as kn,o as Ht,oa as Pn,pa as An,pb as _t,q as Yt,r as st,ra as Mn,rb as Hn,s as Kt,sa as Sn,t as Qt,ta as Le,ua as Tn,va as qn,vb as Yn,w as Xt,wa as Dn,wb as gt,xa as Fn,xb as Kn,ya as On,z as ee,za as En}from"./chunk-S2DSQJ32.js";import{$b as Rt,Ab as C,Eb as fe,Fb as k,Jb as u,Lb as r,Ma as ot,Na as Ve,O as ie,Oa as l,Ob as Vt,Pb as xe,Qb as ye,T as N,Tb as de,Ub as Z,Vb as W,Wb as at,Xb as c,Y as _,Yb as y,Z as g,Zb as q,_b as Y,ca as Ft,fa as Ot,fb as we,fc as zt,gc as pe,hc as rt,ia as Et,ic as Nt,ja as f,kb as ke,kc as Lt,lc as Re,ma as Ce,p as E,pb as It,pc as $t,qb as M,qc as D,ra as Ie,rb as m,sb as h,tb as G,tc as Te,uc as lt,vb as F,wb as O,xb as b,yb as s,zb as d}from"./chunk-NLJHXQFB.js";import{a as w,b as T,d as Ee}from"./chunk-ZW5NV4UO.js";function Ni(){return{filters:!0,undoRedo:!0,widgetSelection:!0,publishAsDashboard:!0,addToDashboard:!0}}function Li(){return{enabled:!0,dataset:!0,pipeline:!0}}function $i(){return{enabled:!0,ask:!0,changeChartType:!0,manageFilters:!0,customizeColors:!0,chartData:!0,setAlert:!0,forecast:!0,addToStory:!1,exportPng:!0,exportCsv:!0,print:!0,tweak:!0,edit:!0,delete:!0}}function Qn(){return{baseUrl:ee.baseUrl??"",mcpUrl:ee.MCP_URL??"",adminApiUrl:ee.ADMIN_API_URL??"",utilitiesUrl:ee.UTILITIES_ENGINE_URL??"",proxyUrl:ee.PROXY_BASEAPI_URL??"",tokenizedOrigins:[ee.baseUrl,ee.ADMIN_API_URL,ee.MCP_URL,ee.UTILITIES_ENGINE_URL,ee.PROXY_BASEAPI_URL].filter(i=>!!i),headers:{},customerId:null,productId:null,productName:null,authMode:"inherit",authToken:null,getToken:null,onUnauthorized:null,ssoEnabled:ee.SSO_ENABLED??!1,features:{mcpGateway:ee.MCP_GATEWAY_ENABLED??!1,forecast:!0,connections:!0,attachments:!0,stories:!1,promptGallery:!0,xray:!0,welcomePrompts:!0,dashboardsMenu:!0,executiveSummary:!0,alerts:!0,library:!0,tools:!0,chat:!0,widgetMenu:$i(),scopePicker:Li(),canvas:Ni()},ui:{theme:"light",density:"comfortable",header:!0,locale:"en"},copy:Wi(),routing:"none",initial:{dashboardId:null,conversationId:null,summary:!1},chatDefaults:{indexName:null,planningMode:!0}}}function Wi(){return{composerPlaceholder:"Ask anything about your workforce data\u2026",welcomeTitle:"What would you like to ask?",welcomeSubtitle:"Ask anything about your workforce data.",dropFilesOverlay:"Drop images or Excel files to attach",replyButton:"Reply",defineItButton:"Define it",submitAnswersButton:"Submit answers",givePlanButton:"Give me the plan \u2192",somethingElseButton:"Something else? Tell me what to do \u2192",chatDraftPlaceholderWidget:"Tell me what to check instead\u2026",chatDraftPlaceholderClarification:"Tell me more\u2026",chatDraftPlaceholderPlan:"Tell me what to change about this widget\u2026",chatDraftPlaceholderIntake:"Type your own answer\u2026",filterValuePlaceholder:"Value\u2026",promptGallerySearchPlaceholder:"Search prompts\u2026",promptGalleryLabel:"Prompt gallery",xrayLabel:"X-ray a dataset",xrayDrawerTitle:"X-ray a dataset",xrayDatasetLabel:"Dataset",xrayEntitySearchPlaceholder:"Search tables and indexes\u2026",xrayTopicPlaceholder:"Optional \u2014 what should this dashboard show?",xrayRunLabel:"X-ray this",xrayNoSources:"No data sources are configured yet.",xrayNoEntities:"Nothing to x-ray on this data source.",xrayNoEntitiesMatch:"No tables or indexes match",xrayLoadingSources:"Loading data sources\u2026",xrayLoadingEntities:"Loading tables\u2026",xrayAnalyzing:"Analyzing this data\u2026",xrayBuilding:"Building your dashboard\u2026",xrayBuiltOne:"Built 1 widget\u2026",xrayBuiltMany:"Built {n} widgets\u2026",xrayFailed:"The x-ray could not be completed.",xrayPickHint:"Pick one to build a dashboard",xrayFieldsLabel:"fields",xrayTablesNoun:"tables",xrayIndexesNoun:"indexes",xrayFocusToggle:"Add a focus (optional)",noPromptsMatch:"No prompts match",noPromptsYet:"No prompts yet.",noChoiceOptions:"No options available to choose from.",noChartTypesFit:"No other chart types fit this widget's data.",noFilterableFields:"No filterable fields found for this chart's data.",dashboardNamePlaceholder:"Enter a name\u2026",saveDashboardDialogLabel:"Save as dashboard",saveDashboardButton:"Save dashboard",cancelButton:"Cancel",applyButton:"Apply",forecastSettingsLabel:"Forecast settings",forecastButton:"Forecast",removeForecastButton:"Remove forecast",newConversationLabel:"New conversation",newDashboardLabel:"New dashboard",noConversationsYet:"No conversations yet",noDashboardsYet:"No dashboards yet",searchConversationsPlaceholder:"Search conversations\u2026",searchDashboardsPlaceholder:"Search dashboards\u2026",noResultsMatchFilters:"No results match your filters",renameLabel:"Rename",deleteLabel:"Delete",groupToday:"Today",groupYesterday:"Yesterday",groupPrevious7Days:"Previous 7 days",groupOlder:"Older",noDatasetsFound:"No datasets found",noPipelinesFound:"No pipelines found",createAlertButton:"Create alert",addToLibraryButton:"Add to library",addToDashboardButton:"Add to dashboard",addToCurrentDashboardButton:"Add to current dashboard",addToStoryButton:"Add to Story",publishAsDashboardButton:"Publish as a new dashboard",viewButton:"View",recomputeButton:"Recompute",chatTabLabel:"Conversation",libraryTabLabel:"Library",toolsTabLabel:"Tools",cohortBuilderTitle:"Build a cohort",cohortBuilderSubtitle:"Two steps \u2014 pick a criterion, then review who matches.",cohortStep1Label:"Choose a criterion",cohortStep2Label:"Review matches",cohortMatchSummary:"{matchCount} people match, of {totalCount} in the log",cohortViewAllLink:"View all {matchCount} \u2192",cohortShowFewerLink:"Show fewer",cohortMatchesTruncatedNote:"Showing the first {shown} of {matchCount}.",cohortPreviewWidgetButton:"Preview widget",cohortAddToCanvasDisclaimer:"Adds this cohort directly to the canvas \u2014 it is not saved to the widget library.",cohortAddToCanvasButton:"Add to canvas",cohortDetailCaption:"1 criterion \xB7 live membership \xB7 derived from the Aquera log",cohortDetailCoverage:"scanned {events} events across {systems} systems",cohortExportRowsButton:"Export rows (CSV)",cohortCopyDefinitionButton:"Copy definition",cohortEmptyMatchesMessage:"No identities in the log currently match this criterion.",cohortPreviewErrorMessage:"Couldn't load matches for this criterion.",cohortPreviewRetryButton:"Retry",cohortCriteriaErrorMessage:"Couldn't load the criteria list.",cohortLogUnavailableMessage:"This tenant has no identity log yet, so cohorts cannot be built here. Connect a source system to start recording identity events.",cohortNamesWithheldMessage:"Names are not available for this cohort.",cohortMembersForbiddenMessage:"You do not have access to the names in this cohort.",cohortMembersErrorMessage:"Couldn't load the full list.",cohortCopyDefinitionConfirmation:"Cohort definition copied to clipboard",detailCanvasCrumbLabel:"Canvas",detailDashboardCrumbLabel:"Dashboard",detailCrumbLabel:"Detail",libraryIntroTitle:"Start from a pre-canned widget or dashboard",libraryIntro:"\u2014 pick what you need, then refine it on the canvas.",libraryWidgetsTabLabel:"Widgets",libraryDashboardsTabLabel:"Dashboards",librarySearchWidgetsPlaceholder:"Search widgets\u2026",librarySearchDashboardsPlaceholder:"Search dashboards\u2026",libraryAllCategoryLabel:"All",librarySelectAllButton:"Select all",libraryClearSelectionButton:"Clear",librarySelectedCount:"{n} selected",libraryAddToCanvasButton:"Add {n} to canvas",libraryWidgetCountChip:"{n} widgets",noWidgetsMatch:"No widgets match your search.",noWidgetsInCategory:"No widgets in this category yet.",noDashboardsMatch:"No dashboards match your search.",noDashboardsInCategory:"No dashboards in this category yet.",emptyCanvasTitle:"Your canvas is empty",emptyCanvasSubtitle:"Add widgets or a whole dashboard from the Library \u2014 or ask a question in Chat.",connectionsTitle:"Connections",connectionsBreadcrumbHome:"Ask Aquera",registerConnectionTitle:"Register connection",registerConnectionButton:"Register connection",registerAndTestButton:"Register & test",registeringButton:"Registering\u2026",testConnectionButton:"Test",loadingConnections:"Loading connections\u2026",noConnectionsTitle:"No connections yet",noConnectionsSub:"Register a connection to start using Ask Aquera with your data source.",connectionNamePlaceholder:"Primary",displayNamePlaceholder:"My workforce data",errors:{assistantErrorFallback:"Failed to generate a response. Please try again.",connectionTestFailedFallback:"Connection failed",couldntForecastWidget:"Couldn't forecast this widget.",couldntLoadDatasetsOrPipelines:"Failed to load datasets / pipelines",couldntOpenConversation:"Couldn't open that conversation. Please try again.",couldntDeleteConversation:"Couldn't delete that conversation. Please try again.",couldntCreateDashboard:"Couldn't create the dashboard. Please try again.",couldntRenameConversation:"Couldn't rename that conversation. Please try again.",tooManyExcelAttachments:"You can attach up to 10 Excel files.",tooManyNonExcelAttachments:"You can attach only one non-Excel file.",unsupportedFileType:"isn't a supported file type.",fileTooLarge:"is larger than 10 MB.",couldntUpdateForecast:"Couldn't update that forecast. Please try again.",couldntSaveToLibrary:"Couldn't save that to your widget library. Please try again.",couldntApplyFilter:"Couldn't apply that filter. Please try again.",couldntAddToDashboard:"Couldn't add this to the dashboard. Please try again.",couldntPublishDashboard:"Couldn't publish the dashboard. Please try again.",couldntRenameDashboard:"Couldn't rename the dashboard. Please try again.",couldntDeleteDashboard:"Couldn't delete that dashboard. Please try again.",couldntGenerateSummary:"Failed to generate summary.",couldntSaveDashboard:"Couldn't save the dashboard. Please try again.",chartTypeChangeFailed:"Chart type change failed"}}}var Xn=Qt("dvz-ask",Qn);function I(){return Xn.read()}function ut(i){let t=Qn(),e=T(w(w({},t),re(i)),{features:T(w(w({},t.features),re(i.features??{})),{widgetMenu:w(w({},t.features.widgetMenu),re(i.features?.widgetMenu??{})),scopePicker:w(w({},t.features.scopePicker),re(i.features?.scopePicker??{})),canvas:w(w({},t.features.canvas),re(i.features?.canvas??{}))}),ui:w(w({},t.ui),re(i.ui??{})),copy:T(w(w({},t.copy),re(i.copy??{})),{errors:w(w({},t.copy.errors),re(i.copy?.errors??{}))}),initial:w(w({},t.initial),re(i.initial??{})),chatDefaults:w(w({},t.chatDefaults),re(i.chatDefaults??{})),headers:w(w({},t.headers),i.headers??{})});return i.tokenizedOrigins||(e.tokenizedOrigins=[e.baseUrl,e.adminApiUrl,e.mcpUrl,e.utilitiesUrl,e.proxyUrl].filter(n=>!!n)),Xn.write(e)}async function Ae(){return Xt(I())}function Jn(i,t){return i.replace("{n}",String(t))}function re(i){let t={};for(let[e,n]of Object.entries(i))n!==void 0&&(t[e]=n);return t}var be=class i{http=N(_e);tokenStore=N(ae);get customerId(){return I().customerId??this.tokenStore.tenantId()??""}async fetchGridPage(t,e,n,o,a,p,x,v){let A=`${I().baseUrl}/api/customers/${this.customerId}/products/${ge()}/workforce/data-grid/${t}?pageIndex=${e}&pageSize=${n}`,S=(o??[]).filter(P=>P&&P.value!=null&&String(P.value).trim()!=="");return S.length&&(A+=`&filters=${encodeURIComponent(JSON.stringify(S))}`),a&&Object.keys(a).length&&(A+=`&dashboardFilters=${encodeURIComponent(JSON.stringify(a))}`),x&&x.length&&(A+=`&resolvedFilters=${encodeURIComponent(JSON.stringify(x))}`),p&&(A+=`&dashboardId=${encodeURIComponent(p)}`),v&&(A+=`&conversationId=${encodeURIComponent(v)}`),E(this.http.get(A))}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};var mt=["image/png","image/jpeg","image/webp","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"],Zn=10*1024*1024,ht=1,Ct=10,Bi=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"];function ft(i,t){return Bi.includes(t)||/\.(xls|xlsx)$/i.test(i)}var me=class i{http=N(_e);tokenStore=N(ae);async bearer(){return await Ae()??await ln()??this.tokenStore.accessToken()??""}lastSentCustomerId=null;lastSentProductId=null;get customerId(){return I().customerId??this.tokenStore.tenantId()??""}get productId(){return I().productId??ge()}get baseUrl(){return`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce`}v1(t){return Jt(t,this.customerId,null,this.productId)}mcpGatewayUrl(){return`${I().baseUrl}/dviz-mcp`}async callMcpTool(t,e={},n){let o=this.customerId,a=this.productId,p=w({},n);o!==this.lastSentCustomerId&&(p.customerId=o),a!==this.lastSentProductId&&(p.productId=a);let x;try{x=await E(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:p})),this.lastSentCustomerId=o,this.lastSentProductId=a}catch(A){throw A instanceof oe?new Error(A.error?.error?.message||A.error?.message||A.message):A}if(x.error)throw new Error(x.error.message);let v=x.result;if(v?.isError)throw new Error(v.structuredContent?.error?.message??v.content?.[0]?.text??`${t} failed`);return v?.structuredContent??{}}async listConversations(t=30){return!this.customerId||!this.productId?[]:I().features.mcpGateway?(await this.callMcpTool("listConversations",{limit:t,status:"active"}))?.conversations??[]:(await E(this.http.get(`${this.baseUrl}/conversations?limit=${t}&status=active`)))?.data??[]}async getConversation(t){if(!t)return null;if(!I().features.mcpGateway){let x=await E(this.http.get(`${this.baseUrl}/conversations/${t}`));if(!x?.data)return null;let a=x.data,{messages:v}=a;return{conversation:Ee(a,["messages"]),messages:v??[]}}let e=await this.callMcpTool("getConversation",{conversationId:t});if(!e?.conversation)return null;let p=e.conversation,{messages:n}=p;return{conversation:Ee(p,["messages"]),messages:n??[]}}async updateConversation(t,e){await E(this.http.patch(`${this.baseUrl}/conversations/${t}`,e))}async deleteConversation(t){if(!I().features.mcpGateway){await E(this.http.delete(`${this.baseUrl}/conversations/${t}`));return}await this.callMcpTool("deleteConversation",{conversationId:t})}async streamChat(t,e,n,o,a,p,x,v){return p?.length||!I().features.mcpGateway?this.streamChatViaSse(t,e,n,o,a,p,x,v):this.sendChatViaGateway(t,e,n,o,a)}async sendChatViaGateway(t,e,n,o,a){let p={message:e};t&&(p.conversationId=t),o&&(p.connectionId=o);let x=Date.now(),v=new URL(this.mcpGatewayUrl());v.searchParams.set("customerId",this.customerId),v.searchParams.set("productId",this.productId);let A=await this.bearer(),S=!1,P=!1,z=R=>{switch(S=!0,R?.kind){case"text":n.onText(R.text??"");break;case"toolCall":n.onToolStart(R.toolId,R.uiLabel??"");break;case"toolResult":n.onToolResult(R.toolId,R.uiDetail??"",!!R.error);break;case"data":{let V=R.payload;V?.data_type==="adhoc_viz"?n.onDataPart(V):V?.data_type==="dashboard_title"?n.onDashboardTitle?.(V.data?.title??""):V?.data_type==="choice"?n.onChoice?.(V.data):V?.data_type==="layout_patch"&&n.onLayoutPatch?.(V.data);break}case"error":n.onError(R.message??"Unknown error");break}},Q=R=>{if(R?.isError){let $=R.structuredContent?.error?.message??R.content?.[0]?.text??"askAquera failed";n.onError($),n.onFinish("error",t??""),P=!0;return}let V=R?.structuredContent??{};if(!S){n.onText(V.responseText??V.text??""),V.dashboardTitle&&n.onDashboardTitle?.(V.dashboardTitle);let $=V.widget?[V.widget]:V.widgets??[];for(let j of $)n.onDataPart({type:"data",data_type:"adhoc_viz",version:1,data:j})}n.onFinish("stop",V.conversationId??t??""),P=!0},U=R=>{if(R.method==="notifications/gateway/stream"){z(R.params??{});return}if(R.id===x){if(R.error){n.onError(R.error.message??"askAquera failed"),n.onFinish("error",t??""),P=!0;return}Q(R.result)}},K;try{K=await fetch(v.toString(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",Authorization:`Bearer ${A}`},body:JSON.stringify({jsonrpc:"2.0",id:x,method:"tools/call",params:{name:"askAquera",arguments:p}}),signal:a})}catch(R){if(R instanceof DOMException&&R.name==="AbortError")throw R;n.onError(R instanceof Error?R.message:String(R)),n.onFinish("error",t??"");return}if(!K.ok){let R=await K.text().catch(()=>K.statusText);n.onError(`Request failed (${K.status}): ${R}`),n.onFinish("error",t??"");return}if(!(K.headers.get("content-type")??"").includes("text/event-stream")||!K.body){let R=await K.json().catch(()=>null);if(!R){n.onError("Invalid response from server"),n.onFinish("error",t??"");return}U(R);return}let ne=K.body.getReader(),L=new TextDecoder,J="";for(;;){let{done:R,value:V}=await ne.read();if(R)break;J+=L.decode(V,{stream:!0});let $=J.split(`
1
+ import{$ as un,$a as $n,A as Jt,Aa as In,B as Zt,C as en,Ca as $e,D as tn,E as nn,F as on,G as an,Ga as We,I as rn,K as ln,L as ae,M as sn,Ma as Be,Na as Ue,O as ge,Oa as Ge,Pa as je,Qa as He,R as dn,Ra as Ye,Sa as Ke,T as cn,Ta as Qe,U as pn,Ua as Vn,V as _n,Va as pt,X as ze,Xa as Rn,Ya as zn,Z as gn,Za as Nn,_a as Ln,a as qt,aa as mn,b as Dt,ba as Ne,c as Wt,ca as hn,da as Pe,db as Wn,ea as dt,eb as Bn,f as Bt,fa as ct,fb as Un,ga as Cn,gb as Gn,h as Ut,ha as fn,hb as ue,ia as xn,ja as yn,jb as jn,k as Gt,ka as bn,l as oe,la as vn,m as _e,ma as wn,n as jt,na as kn,o as Ht,oa as Pn,pa as An,pb as _t,q as Yt,r as st,ra as Mn,rb as Hn,s as Kt,sa as Sn,t as Qt,ta as Le,ua as Tn,va as qn,vb as Yn,w as Xt,wa as Dn,wb as gt,xa as Fn,xb as Kn,ya as On,z as ee,za as En}from"./chunk-4P72HN3K.js";import{$b as Rt,Ab as C,Eb as fe,Fb as k,Jb as u,Lb as r,Ma as ot,Na as Ve,O as ie,Oa as l,Ob as Vt,Pb as xe,Qb as ye,T as N,Tb as de,Ub as Z,Vb as W,Wb as at,Xb as c,Y as _,Yb as y,Z as g,Zb as q,_b as Y,ca as Ft,fa as Ot,fb as we,fc as zt,gc as pe,hc as rt,ia as Et,ic as Nt,ja as f,kb as ke,kc as Lt,lc as Re,ma as Ce,p as E,pb as It,pc as $t,qb as M,qc as D,ra as Ie,rb as m,sb as h,tb as G,tc as Te,uc as lt,vb as F,wb as O,xb as b,yb as s,zb as d}from"./chunk-NLJHXQFB.js";import{a as w,b as T,d as Ee}from"./chunk-ZW5NV4UO.js";function Ni(){return{filters:!0,undoRedo:!0,widgetSelection:!0,publishAsDashboard:!0,addToDashboard:!0}}function Li(){return{enabled:!0,dataset:!0,pipeline:!0}}function $i(){return{enabled:!0,ask:!0,changeChartType:!0,manageFilters:!0,customizeColors:!0,chartData:!0,setAlert:!0,forecast:!0,addToStory:!1,exportPng:!0,exportCsv:!0,print:!0,tweak:!0,edit:!0,delete:!0}}function Qn(){return{baseUrl:ee.baseUrl??"",mcpUrl:ee.MCP_URL??"",adminApiUrl:ee.ADMIN_API_URL??"",utilitiesUrl:ee.UTILITIES_ENGINE_URL??"",proxyUrl:ee.PROXY_BASEAPI_URL??"",tokenizedOrigins:[ee.baseUrl,ee.ADMIN_API_URL,ee.MCP_URL,ee.UTILITIES_ENGINE_URL,ee.PROXY_BASEAPI_URL].filter(i=>!!i),headers:{},customerId:null,productId:null,productName:null,authMode:"inherit",authToken:null,getToken:null,onUnauthorized:null,ssoEnabled:ee.SSO_ENABLED??!1,features:{mcpGateway:ee.MCP_GATEWAY_ENABLED??!1,forecast:!0,connections:!0,attachments:!0,stories:!1,promptGallery:!0,xray:!0,welcomePrompts:!0,dashboardsMenu:!0,executiveSummary:!0,alerts:!0,library:!0,tools:!0,chat:!0,widgetMenu:$i(),scopePicker:Li(),canvas:Ni()},ui:{theme:"light",density:"comfortable",header:!0,locale:"en"},copy:Wi(),routing:"none",initial:{dashboardId:null,conversationId:null,summary:!1},chatDefaults:{indexName:null,planningMode:!0}}}function Wi(){return{composerPlaceholder:"Ask anything about your workforce data\u2026",welcomeTitle:"What would you like to ask?",welcomeSubtitle:"Ask anything about your workforce data.",dropFilesOverlay:"Drop images or Excel files to attach",replyButton:"Reply",defineItButton:"Define it",submitAnswersButton:"Submit answers",givePlanButton:"Give me the plan \u2192",somethingElseButton:"Something else? Tell me what to do \u2192",chatDraftPlaceholderWidget:"Tell me what to check instead\u2026",chatDraftPlaceholderClarification:"Tell me more\u2026",chatDraftPlaceholderPlan:"Tell me what to change about this widget\u2026",chatDraftPlaceholderIntake:"Type your own answer\u2026",filterValuePlaceholder:"Value\u2026",promptGallerySearchPlaceholder:"Search prompts\u2026",promptGalleryLabel:"Prompt gallery",xrayLabel:"X-ray a dataset",xrayDrawerTitle:"X-ray a dataset",xrayDatasetLabel:"Dataset",xrayEntitySearchPlaceholder:"Search tables and indexes\u2026",xrayTopicPlaceholder:"Optional \u2014 what should this dashboard show?",xrayRunLabel:"X-ray this",xrayNoSources:"No data sources are configured yet.",xrayNoEntities:"Nothing to x-ray on this data source.",xrayNoEntitiesMatch:"No tables or indexes match",xrayLoadingSources:"Loading data sources\u2026",xrayLoadingEntities:"Loading tables\u2026",xrayAnalyzing:"Analyzing this data\u2026",xrayBuilding:"Building your dashboard\u2026",xrayBuiltOne:"Built 1 widget\u2026",xrayBuiltMany:"Built {n} widgets\u2026",xrayFailed:"The x-ray could not be completed.",xrayPickHint:"Pick one to build a dashboard",xrayFieldsLabel:"fields",xrayTablesNoun:"tables",xrayIndexesNoun:"indexes",xrayFocusToggle:"Add a focus (optional)",noPromptsMatch:"No prompts match",noPromptsYet:"No prompts yet.",noChoiceOptions:"No options available to choose from.",noChartTypesFit:"No other chart types fit this widget's data.",noFilterableFields:"No filterable fields found for this chart's data.",dashboardNamePlaceholder:"Enter a name\u2026",saveDashboardDialogLabel:"Save as dashboard",saveDashboardButton:"Save dashboard",cancelButton:"Cancel",applyButton:"Apply",forecastSettingsLabel:"Forecast settings",forecastButton:"Forecast",removeForecastButton:"Remove forecast",newConversationLabel:"New conversation",newDashboardLabel:"New dashboard",noConversationsYet:"No conversations yet",noDashboardsYet:"No dashboards yet",searchConversationsPlaceholder:"Search conversations\u2026",searchDashboardsPlaceholder:"Search dashboards\u2026",noResultsMatchFilters:"No results match your filters",renameLabel:"Rename",deleteLabel:"Delete",groupToday:"Today",groupYesterday:"Yesterday",groupPrevious7Days:"Previous 7 days",groupOlder:"Older",noDatasetsFound:"No datasets found",noPipelinesFound:"No pipelines found",createAlertButton:"Create alert",addToLibraryButton:"Add to library",addToDashboardButton:"Add to dashboard",addToCurrentDashboardButton:"Add to current dashboard",addToStoryButton:"Add to Story",publishAsDashboardButton:"Publish as a new dashboard",viewButton:"View",recomputeButton:"Recompute",chatTabLabel:"Conversation",libraryTabLabel:"Library",toolsTabLabel:"Tools",cohortBuilderTitle:"Build a cohort",cohortBuilderSubtitle:"Two steps \u2014 pick a criterion, then review who matches.",cohortStep1Label:"Choose a criterion",cohortStep2Label:"Review matches",cohortMatchSummary:"{matchCount} people match, of {totalCount} in the log",cohortViewAllLink:"View all {matchCount} \u2192",cohortShowFewerLink:"Show fewer",cohortMatchesTruncatedNote:"Showing the first {shown} of {matchCount}.",cohortPreviewWidgetButton:"Preview widget",cohortAddToCanvasDisclaimer:"Adds this cohort directly to the canvas \u2014 it is not saved to the widget library.",cohortAddToCanvasButton:"Add to canvas",cohortDetailCaption:"1 criterion \xB7 live membership \xB7 derived from the Aquera log",cohortDetailCoverage:"scanned {events} events across {systems} systems",cohortExportRowsButton:"Export rows (CSV)",cohortCopyDefinitionButton:"Copy definition",cohortEmptyMatchesMessage:"No identities in the log currently match this criterion.",cohortPreviewErrorMessage:"Couldn't load matches for this criterion.",cohortPreviewRetryButton:"Retry",cohortCriteriaErrorMessage:"Couldn't load the criteria list.",cohortLogUnavailableMessage:"This tenant has no identity log yet, so cohorts cannot be built here. Connect a source system to start recording identity events.",cohortNamesWithheldMessage:"Names are not available for this cohort.",cohortMembersForbiddenMessage:"You do not have access to the names in this cohort.",cohortMembersErrorMessage:"Couldn't load the full list.",cohortCopyDefinitionConfirmation:"Cohort definition copied to clipboard",detailCanvasCrumbLabel:"Canvas",detailDashboardCrumbLabel:"Dashboard",detailCrumbLabel:"Detail",libraryIntroTitle:"Start from a pre-canned widget or dashboard",libraryIntro:"\u2014 pick what you need, then refine it on the canvas.",libraryWidgetsTabLabel:"Widgets",libraryDashboardsTabLabel:"Dashboards",librarySearchWidgetsPlaceholder:"Search widgets\u2026",librarySearchDashboardsPlaceholder:"Search dashboards\u2026",libraryAllCategoryLabel:"All",librarySelectAllButton:"Select all",libraryClearSelectionButton:"Clear",librarySelectedCount:"{n} selected",libraryAddToCanvasButton:"Add {n} to canvas",libraryWidgetCountChip:"{n} widgets",noWidgetsMatch:"No widgets match your search.",noWidgetsInCategory:"No widgets in this category yet.",noDashboardsMatch:"No dashboards match your search.",noDashboardsInCategory:"No dashboards in this category yet.",emptyCanvasTitle:"Your canvas is empty",emptyCanvasSubtitle:"Add widgets or a whole dashboard from the Library \u2014 or ask a question in Chat.",connectionsTitle:"Connections",connectionsBreadcrumbHome:"Ask Aquera",registerConnectionTitle:"Register connection",registerConnectionButton:"Register connection",registerAndTestButton:"Register & test",registeringButton:"Registering\u2026",testConnectionButton:"Test",loadingConnections:"Loading connections\u2026",noConnectionsTitle:"No connections yet",noConnectionsSub:"Register a connection to start using Ask Aquera with your data source.",connectionNamePlaceholder:"Primary",displayNamePlaceholder:"My workforce data",errors:{assistantErrorFallback:"Failed to generate a response. Please try again.",connectionTestFailedFallback:"Connection failed",couldntForecastWidget:"Couldn't forecast this widget.",couldntLoadDatasetsOrPipelines:"Failed to load datasets / pipelines",couldntOpenConversation:"Couldn't open that conversation. Please try again.",couldntDeleteConversation:"Couldn't delete that conversation. Please try again.",couldntCreateDashboard:"Couldn't create the dashboard. Please try again.",couldntRenameConversation:"Couldn't rename that conversation. Please try again.",tooManyExcelAttachments:"You can attach up to 10 Excel files.",tooManyNonExcelAttachments:"You can attach only one non-Excel file.",unsupportedFileType:"isn't a supported file type.",fileTooLarge:"is larger than 10 MB.",couldntUpdateForecast:"Couldn't update that forecast. Please try again.",couldntSaveToLibrary:"Couldn't save that to your widget library. Please try again.",couldntApplyFilter:"Couldn't apply that filter. Please try again.",couldntAddToDashboard:"Couldn't add this to the dashboard. Please try again.",couldntPublishDashboard:"Couldn't publish the dashboard. Please try again.",couldntRenameDashboard:"Couldn't rename the dashboard. Please try again.",couldntDeleteDashboard:"Couldn't delete that dashboard. Please try again.",couldntGenerateSummary:"Failed to generate summary.",couldntSaveDashboard:"Couldn't save the dashboard. Please try again.",chartTypeChangeFailed:"Chart type change failed"}}}var Xn=Qt("dvz-ask",Qn);function I(){return Xn.read()}function ut(i){let t=Qn(),e=T(w(w({},t),re(i)),{features:T(w(w({},t.features),re(i.features??{})),{widgetMenu:w(w({},t.features.widgetMenu),re(i.features?.widgetMenu??{})),scopePicker:w(w({},t.features.scopePicker),re(i.features?.scopePicker??{})),canvas:w(w({},t.features.canvas),re(i.features?.canvas??{}))}),ui:w(w({},t.ui),re(i.ui??{})),copy:T(w(w({},t.copy),re(i.copy??{})),{errors:w(w({},t.copy.errors),re(i.copy?.errors??{}))}),initial:w(w({},t.initial),re(i.initial??{})),chatDefaults:w(w({},t.chatDefaults),re(i.chatDefaults??{})),headers:w(w({},t.headers),i.headers??{})});return i.tokenizedOrigins||(e.tokenizedOrigins=[e.baseUrl,e.adminApiUrl,e.mcpUrl,e.utilitiesUrl,e.proxyUrl].filter(n=>!!n)),Xn.write(e)}async function Ae(){return Xt(I())}function Jn(i,t){return i.replace("{n}",String(t))}function re(i){let t={};for(let[e,n]of Object.entries(i))n!==void 0&&(t[e]=n);return t}var be=class i{http=N(_e);tokenStore=N(ae);get customerId(){return I().customerId??this.tokenStore.tenantId()??""}async fetchGridPage(t,e,n,o,a,p,x,v){let A=`${I().baseUrl}/api/customers/${this.customerId}/products/${ge()}/workforce/data-grid/${t}?pageIndex=${e}&pageSize=${n}`,S=(o??[]).filter(P=>P&&P.value!=null&&String(P.value).trim()!=="");return S.length&&(A+=`&filters=${encodeURIComponent(JSON.stringify(S))}`),a&&Object.keys(a).length&&(A+=`&dashboardFilters=${encodeURIComponent(JSON.stringify(a))}`),x&&x.length&&(A+=`&resolvedFilters=${encodeURIComponent(JSON.stringify(x))}`),p&&(A+=`&dashboardId=${encodeURIComponent(p)}`),v&&(A+=`&conversationId=${encodeURIComponent(v)}`),E(this.http.get(A))}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};var mt=["image/png","image/jpeg","image/webp","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"],Zn=10*1024*1024,ht=1,Ct=10,Bi=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"];function ft(i,t){return Bi.includes(t)||/\.(xls|xlsx)$/i.test(i)}var me=class i{http=N(_e);tokenStore=N(ae);async bearer(){return await Ae()??await ln()??this.tokenStore.accessToken()??""}lastSentCustomerId=null;lastSentProductId=null;get customerId(){return I().customerId??this.tokenStore.tenantId()??""}get productId(){return I().productId??ge()}get baseUrl(){return`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce`}v1(t){return Jt(t,this.customerId,null,this.productId)}mcpGatewayUrl(){return`${I().baseUrl}/dviz-mcp`}async callMcpTool(t,e={},n){let o=this.customerId,a=this.productId,p=w({},n);o!==this.lastSentCustomerId&&(p.customerId=o),a!==this.lastSentProductId&&(p.productId=a);let x;try{x=await E(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:p})),this.lastSentCustomerId=o,this.lastSentProductId=a}catch(A){throw A instanceof oe?new Error(A.error?.error?.message||A.error?.message||A.message):A}if(x.error)throw new Error(x.error.message);let v=x.result;if(v?.isError)throw new Error(v.structuredContent?.error?.message??v.content?.[0]?.text??`${t} failed`);return v?.structuredContent??{}}async listConversations(t=30){return!this.customerId||!this.productId?[]:I().features.mcpGateway?(await this.callMcpTool("listConversations",{limit:t,status:"active"}))?.conversations??[]:(await E(this.http.get(`${this.baseUrl}/conversations?limit=${t}&status=active`)))?.data??[]}async getConversation(t){if(!t)return null;if(!I().features.mcpGateway){let x=await E(this.http.get(`${this.baseUrl}/conversations/${t}`));if(!x?.data)return null;let a=x.data,{messages:v}=a;return{conversation:Ee(a,["messages"]),messages:v??[]}}let e=await this.callMcpTool("getConversation",{conversationId:t});if(!e?.conversation)return null;let p=e.conversation,{messages:n}=p;return{conversation:Ee(p,["messages"]),messages:n??[]}}async updateConversation(t,e){await E(this.http.patch(`${this.baseUrl}/conversations/${t}`,e))}async deleteConversation(t){if(!I().features.mcpGateway){await E(this.http.delete(`${this.baseUrl}/conversations/${t}`));return}await this.callMcpTool("deleteConversation",{conversationId:t})}async streamChat(t,e,n,o,a,p,x,v){return p?.length||!I().features.mcpGateway?this.streamChatViaSse(t,e,n,o,a,p,x,v):this.sendChatViaGateway(t,e,n,o,a)}async sendChatViaGateway(t,e,n,o,a){let p={message:e};t&&(p.conversationId=t),o&&(p.connectionId=o);let x=Date.now(),v=new URL(this.mcpGatewayUrl());v.searchParams.set("customerId",this.customerId),v.searchParams.set("productId",this.productId);let A=await this.bearer(),S=!1,P=!1,z=R=>{switch(S=!0,R?.kind){case"text":n.onText(R.text??"");break;case"toolCall":n.onToolStart(R.toolId,R.uiLabel??"");break;case"toolResult":n.onToolResult(R.toolId,R.uiDetail??"",!!R.error);break;case"data":{let V=R.payload;V?.data_type==="adhoc_viz"?n.onDataPart(V):V?.data_type==="dashboard_title"?n.onDashboardTitle?.(V.data?.title??""):V?.data_type==="choice"?n.onChoice?.(V.data):V?.data_type==="layout_patch"&&n.onLayoutPatch?.(V.data);break}case"error":n.onError(R.message??"Unknown error");break}},Q=R=>{if(R?.isError){let $=R.structuredContent?.error?.message??R.content?.[0]?.text??"askAquera failed";n.onError($),n.onFinish("error",t??""),P=!0;return}let V=R?.structuredContent??{};if(!S){n.onText(V.responseText??V.text??""),V.dashboardTitle&&n.onDashboardTitle?.(V.dashboardTitle);let $=V.widget?[V.widget]:V.widgets??[];for(let j of $)n.onDataPart({type:"data",data_type:"adhoc_viz",version:1,data:j})}n.onFinish("stop",V.conversationId??t??""),P=!0},U=R=>{if(R.method==="notifications/gateway/stream"){z(R.params??{});return}if(R.id===x){if(R.error){n.onError(R.error.message??"askAquera failed"),n.onFinish("error",t??""),P=!0;return}Q(R.result)}},K;try{K=await fetch(v.toString(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",Authorization:`Bearer ${A}`},body:JSON.stringify({jsonrpc:"2.0",id:x,method:"tools/call",params:{name:"askAquera",arguments:p}}),signal:a})}catch(R){if(R instanceof DOMException&&R.name==="AbortError")throw R;n.onError(R instanceof Error?R.message:String(R)),n.onFinish("error",t??"");return}if(!K.ok){let R=await K.text().catch(()=>K.statusText);n.onError(`Request failed (${K.status}): ${R}`),n.onFinish("error",t??"");return}if(!(K.headers.get("content-type")??"").includes("text/event-stream")||!K.body){let R=await K.json().catch(()=>null);if(!R){n.onError("Invalid response from server"),n.onFinish("error",t??"");return}U(R);return}let ne=K.body.getReader(),L=new TextDecoder,J="";for(;;){let{done:R,value:V}=await ne.read();if(R)break;J+=L.decode(V,{stream:!0});let $=J.split(`
2
2
 
3
3
  `);J=$.pop()??"";for(let j of $){let H=j.split(`
4
4
  `).find(B=>B.startsWith("data:"));if(H){try{U(JSON.parse(H.slice(5).trim()))}catch{}if(P)return}}}P||(n.onError("Stream ended unexpectedly"),n.onFinish("error",t??""))}async streamChatViaSse(t,e,n,o,a,p,x,v){let A=await this.bearer(),S=this.v1(`${this.baseUrl}/v1/conversations/chat`),P={message:e};t&&(P.conversationId=t),o&&(P.connectionId=o),p?.length&&(P.attachments=p),x&&(P.isPipeline=!0),v&&(P.dashboardId=v);let{indexName:z,planningMode:Q}=I().chatDefaults;z&&(P.indexName=z),Q===!1&&(P.planningMode=!1);let U=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${A}`},body:JSON.stringify(P),signal:a});if(!U.ok){let L=await U.text().catch(()=>U.statusText);n.onError(`Request failed (${U.status}): ${L}`);return}if(!U.body){n.onError("No response body received");return}let K=U.body.getReader(),X=new TextDecoder,ne="";for(;;){let{done:L,value:J}=await K.read();if(L)break;ne+=X.decode(J,{stream:!0});let R=ne.split(`
5
5
  `);ne=R.pop()??"";for(let V of R){let $=V.trim();$&&this.parseLine($,n)}}ne.trim()&&this.parseLine(ne.trim(),n)}async getSuggestedPrompts(t,e){if(!this.customerId||!this.productId)return{widgetSuggestions:[],conversationStarters:[]};let n={};return t&&(n.connectionId=t),e&&(n.isPipeline="true"),I().features.mcpGateway?await this.callMcpTool("getSuggestedPrompts",{},n)??{widgetSuggestions:[],conversationStarters:[]}:(await E(this.http.get(`${this.baseUrl}/conversations/suggested-prompts`,{params:n})))?.data??{widgetSuggestions:[],conversationStarters:[]}}async listDashboards(t=20){return!this.customerId||!this.productId?[]:I().features.mcpGateway?(await this.callMcpTool("listDashboards",{limit:t,published:"all"}))?.dashboards??[]:(await E(this.http.get(`${this.baseUrl}/dashboards?limit=${t}`)))?.data??[]}async getDashboard(t){if(!t)return null;if(!I().features.mcpGateway){let n=await E(this.http.get(`${this.baseUrl}/dashboards/${t}`));return n?.data??n??null}return(await this.callMcpTool("getDashboard",{dashboardId:t}))?.dashboard??null}async listDashboardsForConversation(t){if(!t||!this.customerId||!this.productId)return[];if(!I().features.mcpGateway){let n=await E(this.http.get(`${this.baseUrl}/dashboards?conversationId=${encodeURIComponent(t)}`)),o=n?.data??n;return Array.isArray(o)?o:[]}return(await this.callMcpTool("listDashboards",{conversationId:t,published:"all"}))?.dashboards??[]}async changeAdhocChartType(t,e){let n;try{n=await E(this.http.post(`${this.baseUrl}/conversations/change-type`,{widgetConfig:t,newChartType:e}))}catch(o){throw o instanceof oe?new Error(o.error?.error||o.message):o}if(n?.success===!1||!n?.chart)throw new Error(n?.error||"Chart type change failed");return n.chart}async listAdhocFilterFields(t){let e;try{e=await E(this.http.post(`${this.baseUrl}/conversations/filter-fields`,{widgets:t}))}catch(n){throw n instanceof oe?new Error(n.error?.error||n.message):n}if(e?.success===!1)throw new Error(e?.error||"Could not load filter fields");return e?.fields??[]}async fetchDashboardSummary(t){let e;try{e=await E(this.http.post(`${this.baseUrl}/dashboards/${t}/summary`,{}))}catch(o){throw o instanceof oe?new Error(o.error?.error||o.message):o}if(e?.success===!1)throw new Error(e?.error||"Could not generate summary");let n=e?.data;return typeof n=="string"?n:n?.summary??""}async chatWithAdhocWidget(t,e,n){let o;try{o=await E(this.http.post(this.v1(`${this.baseUrl}/conversations/widget-chat`),{widget:t,message:e,sessionId:n}))}catch(a){throw a instanceof oe?new Error(a.error?.error||a.message):a}if(o?.success===!1||!o?.reply?.content)throw new Error(o?.error||"Could not process the request");return{sessionId:o.sessionId??n,content:o.reply.content}}async fetchAdhocFilterValues(t,e,n=""){let o;try{o=await E(this.http.post(`${this.baseUrl}/conversations/filter-values`,{widgets:t,field:e,prefix:n}))}catch(a){throw a instanceof oe?new Error(a.error?.error||a.message):a}if(o?.success===!1)throw new Error(o?.error||"Could not load filter values");return{field:e,values:o?.values??[],complete:o?.complete??!0}}async applyAdhocFilter(t,e){let n;try{n=await E(this.http.post(`${this.baseUrl}/conversations/filter-apply`,{widgetConfig:t,filters:e}))}catch(o){throw o instanceof oe?new Error(o.error?.error||o.message):o}if(n?.success===!1||!n?.chart)throw new Error(n?.error||"Filter could not be applied");return n.chart}async filterSuggest(t,e,n,o="draft"){let a=n.filter(v=>!!v.id).map(v=>({widgetId:v.id})),p;try{p=await E(this.http.post(`${this.baseUrl}/dashboards/${t}/filter/suggest?status=${o}`,{query:e,refreshCache:!1,widgets:a}))}catch(v){throw v instanceof oe?new Error(v.error?.error||v.message):v}if(p?.success===!1)throw new Error(p.error||"Request failed");let x=p?.data??{completions:[],suggestions:[]};return{nextToken:x.nextToken,completions:Array.isArray(x.completions)?x.completions:[],suggestions:Array.isArray(x.suggestions)?x.suggestions:[]}}async applyFilters(t,e,n,o="draft",a,p){let x=await new Promise((Q,U)=>{let K=this.http.post(`${this.baseUrl}/dashboards/${n}/filter/apply?status=${o}`,Bn(t,e,p)).subscribe({next:X=>Q(X),error:X=>{U(X instanceof oe?new Error(X.error?.error||X.message):X)}});if(a){if(a.aborted){K.unsubscribe();let X=new Error("Aborted");X.name="AbortError",U(X);return}a.addEventListener("abort",()=>{K.unsubscribe();let X=new Error("Aborted");X.name="AbortError",U(X)},{once:!0})}});if(x?.success===!1)throw new Error(x.error||"Request failed");let v=x?.data??x,A=Array.isArray(v)?v:v?.widgets;if(!Array.isArray(A))throw new Error("Invalid response from apply-filters API");let S=!Array.isArray(v)&&Array.isArray(v?.resolvedFilters)?v.resolvedFilters:[],P=!Array.isArray(v)&&typeof v?.filterExplanation=="string"?v.filterExplanation:typeof x?.filterExplanation=="string"?x.filterExplanation:null,z=P&&P.trim()?P.trim():null;return{widgets:A,resolvedFilters:S,filterExplanation:z}}async uploadAttachment(t,e){let n=await this.bearer(),o=new FormData;o.append("file",t,t.name);let a=await fetch(`${this.baseUrl}/uploads`,{method:"POST",headers:{Authorization:`Bearer ${n}`},body:o,signal:e?.signal});if(!a.ok){let v=await a.text().catch(()=>a.statusText);throw new Error(`Upload failed (${a.status}): ${v}`)}let p=await a.json().catch(()=>null),x=p?.data?.key??p?.key;if(!x)throw new Error("Upload failed: malformed response");return{key:x}}async listDashboardCategories(){return(await E(this.http.get(`${this.baseUrl}/category-templates/categories`))).data}async listAllCategoryTemplates(){return(await E(this.http.get(this.v1(`${this.baseUrl}/category-templates/templates`)))).data}async previewCategoryTemplateStream(t,e){let n=await this.bearer(),o=this.v1(`${this.baseUrl}/category-templates/${t}/preview`),a;try{a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({})})}catch(S){e.onError(S instanceof Error?S.message:"Network error");return}if(!a.ok){let S=await a.json().catch(()=>null);e.onError(S?.error??`Request failed (${a.status})`);return}if(!a.body){e.onError("No response body received");return}let p=a.body.getReader(),x=new TextDecoder,v="",A=S=>{let P=S.trim();if(!P)return;let z;try{z=JSON.parse(P)}catch{return}switch(z.type){case"template":e.onTemplate?.(z.template);break;case"widget":e.onWidget(z.widget);break;case"skipped":e.onSkipped?.(z.title,z.reason);break;case"error":e.onError(z.message);break;case"done":e.onDone?.();break;default:break}};for(;;){let{done:S,value:P}=await p.read();if(S)break;v+=x.decode(P,{stream:!0});let z=v.split(`
6
6
  `);v=z.pop()??"";for(let Q of z)A(Q)}v.trim()&&A(v)}async listXraySources(){return!this.customerId||!this.productId?[]:(await E(this.http.get(`${this.baseUrl}/xray/sources`)))?.data?.connections??[]}async listXrayEntities(t,e,n){if(!this.customerId||!this.productId)return{adapterType:"",entities:[]};let o=new Gt;return e&&(o=o.set("datasetId",e)),n&&(o=o.set("search",n)),(await E(this.http.get(`${this.baseUrl}/xray/sources/${t}/entities`,{params:o})))?.data??{adapterType:"",entities:[]}}async xrayPreviewStream(t,e,n){await this.readNdjsonStream(`${this.baseUrl}/xray/sources/${t}/preview`,e,o=>{switch(o.type){case"profile":n.onProfile?.(o.profile);break;case"semantic":n.onSemantic?.(o.semanticRead);break;case"widget":n.onWidget(o.widget);break;case"layout":n.onLayout?.(o.layouts);break;case"conversation":n.onConversation?.(o.conversationId);break;case"summary":n.onSummary?.(o.summary);break;case"empty":n.onEmpty?.(o.message);break;case"error":n.onError(o.message);break;case"done":n.onDone?.(o.widgetCount,o.title,o.conversationId??null);break;default:break}},n.onError)}async readNdjsonStream(t,e,n,o){let a=await this.bearer(),p;try{p=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(e??{})})}catch(P){o(P instanceof Error?P.message:"Network error");return}if(!p.ok){let P=await p.json().catch(()=>null);o(P?.error??`Request failed (${p.status})`);return}if(!p.body){o("No response body received");return}let x=p.body.getReader(),v=new TextDecoder,A="",S=P=>{let z=P.trim();if(z)try{n(JSON.parse(z))}catch{}};for(;;){let{done:P,value:z}=await x.read();if(P)break;A+=v.decode(z,{stream:!0});let Q=A.split(`
7
- `);A=Q.pop()??"";for(let U of Q)S(U)}A.trim()&&S(A)}async createDashboardFromTemplate(t){return(await E(this.http.post(`${this.baseUrl}/category-templates/${t}/dashboard`,{}))).data}async listWidgetTemplates(){return(await E(this.http.get(this.v1(`${this.baseUrl}/widget-templates`)))).data}async previewWidgetTemplate(t){return(await E(this.http.post(`${this.baseUrl}/widget-templates/${t}/preview`,{}))).data}async loadAllWidgetTemplatePreviews(){return(await E(this.http.post(this.v1(`${this.baseUrl}/widget-templates/preview-all`),{}))).data}async previewWidgetTemplateDetailPanel(t){return(await E(this.http.post(`${this.baseUrl}/widget-templates/${t}/detail-panel`,{}))).data}async previewWidgetDetailPanelDefinition(t){return(await E(this.http.post(`${this.baseUrl}/widget-templates/preview-detail-panel`,{detailPanel:t}))).data}async createDashboard(t){let a=t,{published:e}=a,n=Ee(a,["published"]);return I().features.mcpGateway?(await this.callMcpTool("createDashboard",w(w({},n),e?{published:!0}:{}))).dashboard:(await E(this.http.post(`${this.baseUrl}/dashboards${e?"?published=true":""}`,n))).data}async publishDashboard(t){return I().features.mcpGateway?(await this.callMcpTool("publishDashboard",{dashboardId:t}))?.publishedDashboardId??t:(await E(this.http.post(`${this.baseUrl}/dashboards/${t}/publish`,{})))?.data?.publishedDashboardId??t}async updateDashboard(t,e){await E(this.http.put(`${this.baseUrl}/dashboards/${t}?published=false`,e))}async deleteDashboard(t){if(!I().features.mcpGateway){await E(this.http.delete(`${this.baseUrl}/dashboards/${t}`));return}await this.callMcpTool("deleteDashboard",{dashboardId:t})}async register(t){return(await E(this.http.post(`${I().baseUrl}/api/customers/${this.customerId}/workforce/register`,t))).data}async listConnections(){return!this.customerId||!this.productId?[]:(await E(this.http.get(`${this.baseUrl}/connections`)))?.data??[]}async listDatasets(){return!this.customerId||!this.productId?[]:((await E(this.http.get(`${this.baseUrl}/connections/datasets`)))?.data??[]).map(e=>({id:e.id,name:e.name}))}async listPipelines(){if(!this.customerId||!this.productId)return[];let t=`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/applications/orchestrations/v2?startIndex=0&limit=100`;return((await E(this.http.get(t)))?.data??[]).map(n=>({id:n.publicOrchestrationGuid??n.guid??n.id??"",name:n.name})).filter(n=>n.id)}async createConnection(t,e){return(await E(this.http.post(`${this.baseUrl}/connections`,{name:t,config:e}))).data}async updateConnection(t,e){return(await E(this.http.put(`${this.baseUrl}/connections/${t}`,e))).data}async testConnection(t){return(await E(this.http.post(`${this.baseUrl}/connections/${t}/test`,{}))).data}async deleteConnection(t){await E(this.http.delete(`${this.baseUrl}/connections/${t}`))}parseLine(t,e){let n=t.indexOf(":");if(n===-1)return;let o=t.slice(0,n),a;try{a=JSON.parse(t.slice(n+1))}catch{return}switch(o){case"f":break;case"0":e.onText(a.text??"");break;case"9":{let p=a;e.onToolStart(p.toolCallId,p.uiLabel??p.toolName??"");break}case"a":{let p=a;e.onToolResult(p.toolCallId,p.result?.uiDetail??"",p.result?.error??!1);break}case"2":{let p=a;p.data_type==="adhoc_viz"?e.onDataPart(p):p.data_type==="dashboard_title"?e.onDashboardTitle?.(p.data?.title??""):p.data_type==="choice"?e.onChoice?.(p.data):p.data_type==="layout_patch"&&e.onLayoutPatch?.(p.data);break}case"3":e.onError(a.error??"Unknown error");break;case"d":{let p=a;e.onFinish(p.finishReason??"stop",p.conversationId??"");break}}}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};function ei({hasMessages:i,artifactOpen:t,builderOpen:e}){return t?"split":e?"builder":i?"conversation":"idle"}function ti(i,t){return i==="chat"?t.chat:i==="library"?t.library:i==="tools"?t.tools:!0}function ni(i){return[i.chat,i.library,i.tools].filter(Boolean).length>1}var Me=class i{http=N(_e);tokenStore=N(ae);get customerId(){return I().customerId??this.tokenStore.tenantId()??""}get productId(){return I().productId??ge()}get baseUrl(){return`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce`}async listCriteria(){return(await E(this.http.get(`${this.baseUrl}/cohort-criteria?category=cohort`)))?.criteria??[]}async previewCriterion(t){return E(this.http.get(`${this.baseUrl}/cohorts/preview?criterion=${encodeURIComponent(t)}`))}async getDetail(t){return E(this.http.get(`${this.baseUrl}/cohorts/detail?criterion=${encodeURIComponent(t)}`))}async listMembers(t,e){return(await E(this.http.get(`${this.baseUrl}/cohorts/members?criterion=${encodeURIComponent(t)}&limit=${e}`)))?.members??[]}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};function oi(i,t,e){return{chart:w({type:"kpi",variant:"card",value:t},e?{description:e}:{}),aq:{chartTitle:i,ai:{enabled:!1}}}}function ii(i,t,e,n){return{title:t,componentName:i,widgetType:"chart",config:e,layout:n}}function ai(i){let t=i.kpis.map((x,v)=>ii("nile-kpi-chart",x.label,oi(x.label,x.value),{x:v*3,y:0,w:3,h:2})),e=i.systemRows.length,n=e<i.systemCount?`Underlying rows \xB7 top ${e} of ${i.systemCount} systems`:`Underlying rows \xB7 ${e} ${e===1?"system":"systems"}`,o=x=>i.systemRows.some(v=>v[x]>0),a=[{accessorKey:"system",header:"System"},{accessorKey:"events",header:"Events"},...o("errors")?[{accessorKey:"errors",header:"Errors"}]:[],...o("orphans")?[{accessorKey:"orphans",header:"Orphans"}]:[]],p=ii("nile-data-grid",n,{chart:{type:"grid",columns:a,data:i.systemRows},aq:{chartTitle:n,ai:{enabled:!1}}},{x:0,y:2,w:12,h:6});return[...t,p]}var Ui={kpis:[{label:"Matches",value:""},{label:"% of population",value:""},{label:"Events from these people",value:""},{label:"Orphan events among them",value:""}],systemRows:[],systemCount:0,eventTotal:0,scan:{events:0,systems:0}};function ri(i,t=1){return{title:i.cohortTitle,componentName:"nile-kpi-chart",config:{title:i.cohortTitle,componentName:"nile-kpi-chart",widgetType:"chart",category:"cohort",config:T(w({},oi(i.cohortTitle,i.matchCount,`${t} ${t===1?"criterion":"criteria"} \xB7 live membership`)),{_meta:{cohortId:i.criterionId,detailPanel:{title:i.cohortTitle,cohortId:i.criterionId,widgets:ai(Ui)}}}),layout:{x:0,y:0,w:3,h:3}}}}function Xe(i,t){return{title:i.cohortTitle,widgets:ai(t),skipped:[]}}var Gi="__evidence-curated";function ji(i,t){return`${i}${Gi}-${t}`}function Hi(i){let t=i?.config?._meta;if(!t||typeof t!="object")return null;let e=t,n=typeof e.templateId=="string"&&e.templateId?e.templateId:null,o=typeof e.cohortId=="string"&&e.cohortId?e.cohortId:null,a=e.detailPanel&&typeof e.detailPanel=="object"?e.detailPanel:null;return!n&&!o&&!a?null:{templateId:n,cohortId:o,detailPanel:a}}var Yi=2;function Ki(i){if(!i||typeof i!="object")return;let t=i;if(![t.x,t.y,t.w,t.h].every(x=>typeof x=="number"&&Number.isFinite(x)))return;let{x:n,y:o,w:a,h:p}=t;if(!(a<=0||p<=0))return{x:n,y:o,w:a,h:Math.max(Yi,Math.ceil(p))}}function Qi(i,t){return i==="kpi"?"nile-kpi-chart":i==="grid"?"nile-data-grid":typeof t=="string"&&t?t:void 0}function xt(i,t){let e=Array.isArray(i?.widgets)?i.widgets:[],n=[];for(let o of e){if(!o||typeof o!="object")continue;let a=o,p=a.config??a??{},x=p.chart??{},v=T(w({},p),{chart:x,aq:p.aq??{}}),A={id:ji(t,n.length),title:typeof a.title=="string"?a.title:"",widgetType:a.widgetType==="kpi"?"kpi":"chart",config:v,drilldownBy:Array.isArray(a.drilldownBy)?a.drilldownBy:[],category:a.category??null},S=Qi(x.type,a.componentName);S&&(A.componentName=S);let P=Ki(a.layout);P&&(A.layout=P),typeof a.summary=="string"&&(A.summary=a.summary),a.queryMeta&&typeof a.queryMeta=="object"&&(A.queryMeta=a.queryMeta),typeof a.dataSourceId=="string"&&(A.dataSourceId=a.dataSourceId),n.push(A)}return n}var Je=class i{svc=N(me);cohort=N(Me);async resolveEvidence(t){let e=Hi(t);if(!e)return[];if(e.cohortId){let[n,o]=await Promise.all([this.cohort.previewCriterion(e.cohortId),this.cohort.getDetail(e.cohortId)]);return xt(Xe(n,o),t.id)}return e.detailPanel?e.detailPanel.widgets?.length?xt(await this.svc.previewWidgetDetailPanelDefinition(e.detailPanel),t.id):[]:e.templateId?xt(await this.svc.previewWidgetTemplateDetailPanel(e.templateId),t.id):[]}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};function yt(i){return!!i&&i.matchCount>0&&!i.sampleMatches?.length}function li(i){return!i||yt(i)?!1:i.matchCount>Math.min(i.sampleMatches?.length??0,3)}function si(i,t,e){return e&&t?t:i?.sampleMatches?.slice(0,3)??[]}function di(i,t){return!!i&&!!t&&t.length<i.matchCount}function bt(i){let t=i?.status;return t===503?"unavailable":t===403?"forbidden":"failed"}function ci(i,t,e){let n=e||"Working",o=i.map(p=>p.id==="thinking"&&p.status==="running"?T(w({},p),{status:"done"}):p),a=o.findIndex(p=>p.status==="running"&&p.baseLabel===n);if(a>=0){let p=o[a],x=[...o];return x[a]=T(w({},p),{callIds:[...p.callIds,t],pending:p.pending+1}),x}return[...o,{id:t,callIds:[t],pending:1,baseLabel:n,label:n,status:"running"}]}function pi(i,t,e,n){return i.map(o=>{if(!o.callIds.includes(t))return o;let a=Math.max(0,o.pending-1);return T(w({},o),{pending:a,detail:n?o.detail:e||o.detail,status:a===0?"done":o.status})})}function vt(i){let{finishReason:t,sawError:e,producedContent:n}=i;return t==="error"?!0:t==null?e:e&&!n}var _i=i=>T(w({},i),{isStreaming:!1,thinking:void 0,hasError:!0});function gi(i,t,e){return i.some(n=>n.id===t)?i.map(n=>n.id===t?_i(n):n):[...i,_i(e(t))]}var Ze=class i{http=N(_e);tokenStore=N(ae);get customerId(){return I().customerId??this.tokenStore.tenantId()??""}get productId(){return I().productId??ge()}get apiUrl(){return`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforcebot/forecast`}cachedContext=null;context(){return this.cachedContext?this.cachedContext:(this.cachedContext=E(this.http.get(`${this.apiUrl}/context`)).catch(t=>(console.info('[ask-aquera] forecast context unavailable \u2014 "forecast this" will not be claimed.',t),null)),this.cachedContext)}async compute(t){try{return await E(this.http.post(`${this.apiUrl}/compute`,t))}catch(e){let n=e,o=n?.error?.error;throw Object.assign(new Error(o||`Forecast failed (HTTP ${n?.status??"?"})`),{status:n?.status,code:n?.error?.code,isRefusal:n?.status===422})}}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ji=[/\bforecast(?:ing|s|ed)?\b/i,/\bpredict(?:ion|ions|ive|s|ed)?\b/i,/\bproject(?:ion|ions|ed)\b/i,/\bproject\s+(?:our|the|this|that|my|its|their|his|her|forward)\b/i,/\bproject\s+\w+(?:\s+\w+)?\s+forward\b/i,/\bextrapolat\w*/i,/\bnext\s+(?:week|month|quarter|year|\d+\s+(?:weeks?|months?|quarters?|years?))\b/i,/\bby\s+(?:year[-\s]?end|end\s+of\s+(?:the\s+)?year|EOY)\b/i,/\bby\s+Q[1-4]\b/i,/\bthrough\s+(?:year[-\s]?end|end\s+of\s+(?:the\s+)?year)\b/i,/\bhow\s+many\s+\w+\s+will\s+we\b/i,/\bwhat\s+will\s+\w+\s+(?:be|look\s+like)\b/i,/\btrend\s+(?:this\s+)?forward\b/i,/\brun[-\s]?rate\s+to\b/i],Zi=[/\bforecast\s+(?:this|that|it)\b/i,/\bextend\s+(?:this|that|it)\b/i,/\bproject\s+(?:this|that|it)\s+forward\b/i,/\btrend\s+(?:this|that|it)\s+forward\b/i,/\b(?:this|that)\s+chart\b/i,/\bsame\s+chart\b/i],eo={Weekly:{week:1,month:4,quarter:13,year:52},Monthly:{week:1,month:1,quarter:3,year:12},Quarterly:{week:1,month:1,quarter:1,year:4},Yearly:{week:1,month:1,quarter:1,year:1}},to=[[/\b(?:weekly|by\s+week|per\s+week|week\s+over\s+week)\b/i,"Weekly"],[/\b(?:monthly|by\s+month|per\s+month|month\s+over\s+month)\b/i,"Monthly"],[/\b(?:quarterly|by\s+quarter|per\s+quarter)\b/i,"Quarterly"],[/\b(?:yearly|annually|annual|per\s+year)\b|\bby\s+year\b(?!\s*-?\s*end)/i,"Yearly"]];function wt(i,t,e=new Date){let n=(i??"").trim();if(!n)return null;let o=Zi.some(x=>x.test(n)),a=no(n,Ji);if(!a&&!o)return null;let p=io(n);return{extendsExisting:o,metric:oo(n,t),horizon:ao(n,p??t.defaults.granularity,e),granularity:p,trigger:a||"refers to an existing chart"}}function no(i,t){for(let e of t){let n=e.exec(i);if(n)return n[0]}return""}function io(i){for(let[t,e]of to)if(t.test(i))return e}function oo(i,t){let e=i.toLowerCase();return t.metrics.flatMap(o=>[o.label,...o.aliases].map(a=>({id:o.id,alias:a.toLowerCase()}))).sort((o,a)=>a.alias.length-o.alias.length).find(o=>e.includes(o.alias))?.id}function ao(i,t,e){let n=eo[t],o=/\bnext\s+(\d+)\s+(weeks?|months?|quarters?|years?)\b/i.exec(i);if(o){let x=Number(o[1]),v=o[2].toLowerCase().replace(/s$/,"");return Math.max(1,Math.round(x*n[v]))}let a=/\bnext\s+(week|month|quarter|year)\b/i.exec(i);if(a){let x=a[1].toLowerCase();return Math.max(1,n[x])}if(/\b(?:by|through)\s+(?:year[-\s]?end|end\s+of\s+(?:the\s+)?year|EOY)\b/i.test(i))return ro(t,e);let p=/\bby\s+Q([1-4])\b/i.exec(i);if(p)return lo(t,Number(p[1]),e)}function ro(i,t){let e=12-(t.getMonth()+1);return Math.max(1,ui(e,i))}function lo(i,t,e){let n=Math.floor(e.getMonth()/3)+1,o=t>=n?t-n:4-n+t,a=Math.max(1,o*3);return Math.max(1,ui(a,i))}function ui(i,t){switch(t){case"Weekly":return Math.round(i*4.345);case"Quarterly":return Math.max(1,Math.round(i/3));case"Yearly":return Math.max(1,Math.round(i/12));default:return i}}var so=new Set(["line","area","spline","areaspline"]),kt="(?:jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec)[a-z]*",le="(?:19|20)\\d{2}",mi="(?:0?[1-9]|[12]\\d|3[01])",Pt="(?:0?[1-9]|1[0-2])",co=[new RegExp(`^${le}[-/.]${Pt}(?:[-/.]${mi})?$`,"i"),new RegExp(`^${mi}[-/.]${Pt}[-/.]${le}$`,"i"),new RegExp(`^${Pt}[-/.]${le}$`,"i"),new RegExp(`^${le}-?w\\d{1,2}$`,"i"),new RegExp(`^w(?:ee)?k\\s*\\d{1,2}[,\\s]+${le}$`,"i"),new RegExp(`^${kt}[\\s-]*'?\\d{2}$`,"i"),new RegExp(`^${kt}[\\s-]*${le}$`,"i"),new RegExp(`^${le}[\\s-]*${kt}$`,"i"),new RegExp(`^q[1-4][\\s-]*${le}$`,"i"),new RegExp(`^${le}[\\s-]*q[1-4]$`,"i"),new RegExp("^fy\\s*'?\\d{2,4}$","i"),new RegExp(`^${le}$`)];function po(i){let t=(i??[]).map(n=>String(n??"").trim()).filter(Boolean);return t.length<3?!1:t.filter(n=>co.some(o=>o.test(n))).length/t.length>=.8}var _o=[/forecast/i,/confidence/i,/project/i,/upper|lower/i,/band/i,/target/i],Ci=3;function et(i){return i?.config?.chart??i?.chart??{}}function fi(i){let t=et(i);return t?.enableForecasting===!0?!0:(Array.isArray(t?.data)?t.data:[]).some(n=>Array.isArray(n?.projected)&&n.projected.length>0)}function tt(i){let t=et(i),e=String(t?.type??"").toLowerCase();if(!so.has(e))return!1;let n=go(i);if(!n||n.values.length<Ci)return!1;let o=vi(t);return o.length?po(o):!!n.times?.length}function go(i){let t=et(i),e=bi(t);if(!e.length)return null;let n=e.find(o=>!wi(o.name))??e[0];return yi(t,n)}function xi(i){let t=et(i),e=bi(t).filter(o=>!wi(o.name)),n=[];return e.forEach((o,a)=>{let p=yi(t,o);p&&n.push(T(w({},p),{name:o.name||(e.length>1?`Series ${a+1}`:"")}))}),n}function yi(i,t){let e=mo(t.data),n=e.map(p=>p.value);if(n.length<Ci)return null;let o=e.every(p=>p.time!==void 0)?e.map(p=>p.time):void 0,a=vi(i).slice(0,n.length);return w({labels:a.length===n.length?a:o?o.map(p=>uo(p)):n.map((p,x)=>String(x+1)),values:n},o?{times:o}:{})}function uo(i){return new Date(i).toLocaleDateString("en-US",{month:"short",year:"numeric"})}function bi(i){let t=i?.options?.series;if(Array.isArray(t)&&t.length)return t.filter(n=>Array.isArray(n?.data)).map(n=>({name:String(n.name??""),data:n.data}));let e=i?.data;return Array.isArray(e)&&e.length?e.every(n=>typeof n=="number"||n===null)?[{name:"",data:e}]:e.filter(n=>Array.isArray(n?.data)||Array.isArray(n?.actual)).map(n=>({name:String(n.name??""),data:Array.isArray(n.actual)?n.actual:n.data})):[]}function vi(i){let t=i?.categories;if(Array.isArray(t)&&t.length)return t.map(String);let e=i?.options?.xAxis?.categories;return Array.isArray(e)&&e.length?e.map(String):[]}function wi(i){return _o.some(t=>t.test(i))}function mo(i){let t=[];for(let e of i){let n=ho(e);if(n===null)break;t.push(n)}return t}function ho(i){if(typeof i=="number"&&Number.isFinite(i))return{value:i};if(Array.isArray(i)&&i.length===2&&typeof i[1]=="number")return w({value:i[1]},typeof i[0]=="number"?{time:i[0]}:{});if(i&&typeof i=="object"&&typeof i.y=="number"){let t=i;return w({value:t.y},typeof t.x=="number"?{time:t.x}:{})}return null}var Mt={Weekly:{Weekly:1,Monthly:4,Quarterly:13,Yearly:52},Monthly:{Monthly:1,Quarterly:3,Yearly:12},Quarterly:{Quarterly:1,Yearly:4},Yearly:{Yearly:1}},At={Weekly:{plural:"weeks",singular:"week",adjective:"weekly"},Monthly:{plural:"months",singular:"month",adjective:"monthly"},Quarterly:{plural:"quarters",singular:"quarter",adjective:"quarterly"},Yearly:{plural:"years",singular:"year",adjective:"yearly"}},hi=4;function Co(i,t,e){let n=Mt[t]?.[e];return n?Math.max(1,Math.floor(i/n)):null}function ki(i,t,e){return e.map(n=>{let o=At[n]??At.Monthly,a=Co(t,i,n);return a===null?{value:n,enabled:!1,fittedPeriods:0,maxHorizon:0,label:o,reason:`needs ${o.adjective} data, but this series is ${At[i]?.adjective??i.toLowerCase()}`}:a<hi?{value:n,enabled:!1,fittedPeriods:a,maxHorizon:0,label:o,reason:`only ${a} ${a===1?o.singular:o.plural} of history, needs at least ${hi}`}:{value:n,enabled:!0,fittedPeriods:a,maxHorizon:Math.max(1,Math.floor(a/2)),label:o}})}function Pi(i,t,e,n){if(t===e)return Math.max(1,Math.min(i,n));let o=Mt[t]?.[e],a=Mt[e]?.[t],p=o?i/o:a?i*a:i;return Math.max(1,Math.min(Math.round(p),n))}var fo="#2970FF",Ai="#7A5AF8";var Mi={Weekly:6048e5,Monthly:26298e5,Quarterly:78894e5,Yearly:315576e5},Si={Weekly:"Week",Monthly:"Month",Quarterly:"Quarter",Yearly:"Year"};function xo(i,t){if(i.times?.length===i.values.length)return i.times;let e=Date.now(),n=i.values.length;return i.values.map((o,a)=>Math.round(e-(n-1-a)*t))}function Ti(i,t){let e=new Date(i);switch(t){case"Weekly":return e.toLocaleDateString("en-US",{day:"numeric",month:"short",year:"numeric"});case"Quarterly":return`Q${Math.floor(e.getMonth()/3)+1} ${e.getFullYear()}`;case"Yearly":return String(e.getFullYear());default:return e.toLocaleDateString("en-US",{month:"short",year:"numeric"})}}function qi(i,t){let e=Mi[i.granularity]??Mi.Monthly,n=xo(i.history,e),o=n[n.length-1]??Date.now(),a=i.forecastTimes?.length===t.length?i.forecastTimes:t.map((P,z)=>Math.round(o+(z+1)*e)),p=t.length>0,x=[...n.map(P=>Ti(P,i.granularity)),...p?a.map(P=>Ti(P,i.granularity)):[]],v=(i.series?.length??0)>1,A=v?i.series.map(P=>w({name:P.note?`${P.name} \xB7 ${P.note}`:P.name,actual:P.values},P.points?.length?{projected:P.points.map(z=>z.value),interval:P.points.map(z=>[z.low,z.high])}:{})):[w({name:"Actuals",color:fo,actual:i.history.values},p?{projected:t.map(P=>P.value),interval:t.map(P=>[P.low,P.high])}:{})],S={type:"line",enableForecasting:!0,categories:x,data:A,lineWidth:2,showMarkers:!1,valueSuffix:i.valueSuffix??"",xAxisTitle:Si[i.granularity]??Si.Monthly,projection:T(w({start:null},v?{}:{color:Ai}),{dashStyle:"Dash",showNowLine:!0,nowLabel:"",bandLabel:"Projected",interval:T(w({name:`${i.confidence}% confidence`},v?{}:{color:Ai}),{opacity:.16,level:i.confidence})}),legend:{show:!0},height:"400px",loading:!1,options:{}};return{title:i.chartTitle,componentName:"nile-line-chart",widgetType:"chart",config:{aq:{chartTitle:i.chartTitle,chartSubtitle:i.chartSubtitle},chart:S},queryMeta:{sql:`-- forecast:${i.metric}`}}}function St(i,t=[]){let e=i.guardrails?.passed?i.points??[]:[],n=e[e.length-1],o=w({horizon:i.horizon,confidence:i.confidence,granularity:i.granularity},n?{value:n.value,low:n.low,high:n.high}:{}),a=e.length?qe(i.narrative,o):i.guardrails?.body?`I can't forecast this reliably. ${i.guardrails.body}`:"I can't forecast this series.",p=yo(i,t),x=i.skipped??[],v=(i.meta??[]).map(A=>({label:A.label,value:qe(A.value,o)}));return x.length&&p.length>1&&v.push({label:"Series",value:`${p.length-x.length} of ${p.length} forecast \u2014 ${x.map(A=>A.name).join(", ")} left as history`}),{chart:bo(i,e,p),answer:a,meta:v,points:e,horizon:i.horizon,granularity:i.granularity,confidence:i.confidence,maxHorizon:i.maxHorizon}}function yo(i,t){let e=i.forecasts??[];if(e.length<2&&!(i.skipped?.length&&e.length))return[];let n=p=>String(p??"").toLowerCase().replace(/[^a-z0-9]/g,""),o=new Map(t.map(p=>[n(p.name??""),p])),a=e.map(p=>({name:p.name,values:p.history?.values??o.get(n(p.name))?.values??[],points:i.guardrails?.passed?p.points??[]:[]}));for(let p of i.skipped??[]){let x=o.get(n(p.name));x?.values?.length&&a.push({name:p.name,values:x.values,note:"not forecast"})}return a}function bo(i,t,e=[]){return qi(e.length?T(w({},i),{series:e}):i,t)}function qe(i,t){return String(i??"").replace(/\{\{(\w+)\}\}/g,(e,n)=>n in t?String(t[n]):e)}function Tt(i){if(i.forecast||i.isStreaming||i.charts?.length!==1)return!1;let t=i.charts[0]?.config;return fi(t)?!1:tt(t)}var wo=["aqChat"],ko=["artifactGrid"],Po=["composerEl"],Ao=["aiExecutiveSummary"],Mo=()=>[1,2,3,4],Se=()=>[],Oi=i=>({$implicit:i}),te=(i,t)=>t.id,se=(i,t)=>t.key,So=(i,t)=>t.templateId,To=(i,t)=>t.identityKey,Ei=(i,t)=>t.label,Ii=(i,t)=>t.component,qo=(i,t)=>t.name,nt=(i,t)=>t.value,Do=(i,t)=>t.action,Fo=(i,t)=>t.datasetId,Oo=(i,t)=>t.schema+"."+t.name;function Eo(i,t){if(i&1){let e=k();s(0,"button",32),u("click",function(){_(e);let o=r();return g(o.addReplyQuote())}),C(1,"nile-glyph",33),c(2),d()}if(i&2){let e=t,n=r();Z("top",e.top,"px")("left",e.left,"px"),W("reply-badge--below",!e.above),l(2),q(" ",n.copy().replyButton," ")}}function Io(i,t){if(i&1&&(s(0,"nile-nav-tab",50),c(1),d()),i&2){let e=r(3);l(),y(e.copy().chatTabLabel)}}function Vo(i,t){if(i&1&&(s(0,"nile-nav-tab",51),c(1),d()),i&2){let e=r(3);l(),y(e.copy().libraryTabLabel)}}function Ro(i,t){if(i&1&&(s(0,"nile-nav-tab",52),c(1),d()),i&2){let e=r(3);l(),y(e.copy().toolsTabLabel)}}function zo(i,t){if(i&1){let e=k();s(0,"nile-nav-tab-group",49),u("nile-tab-change",function(o){_(e);let a=r(2);return g(a.setChatPaneTab(o.detail.value))}),m(1,Io,2,1,"nile-nav-tab",50),m(2,Vo,2,1,"nile-nav-tab",51),m(3,Ro,2,1,"nile-nav-tab",52),d()}if(i&2){let e=r(2);M("value",e.chatPaneTab()),l(),h(e.features().chat?1:-1),l(),h(e.features().library?2:-1),l(),h(e.features().tools?3:-1)}}function No(i,t){if(i&1){let e=k();s(0,"span",37),C(1,"nile-glyph",53),s(2,"span",54),c(3),d(),s(4,"button",55),u("click",function(){_(e);let o=r(2);return g(o.clearScope())}),C(5,"nile-glyph",56),d()()}if(i&2){let e=t;l(),b("name",e.kind==="dataset"?"ng-database":"ng-dataflow-04"),l(2),Y("",e.kind==="dataset"?"Dataset":"Pipeline",": ",e.name)}}function Lo(i,t){i&1&&(s(0,"div",66),C(1,"nile-skeleton-loader",67)(2,"nile-skeleton-loader",68),d())}function $o(i,t){i&1&&C(0,"nile-glyph",72)}function Wo(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.selectScope("dataset",o))}),s(1,"span",71),c(2),d(),m(3,$o,1,0,"nile-glyph",72),d()}if(i&2){let e,n=t.$implicit,o=r(5);l(2),y(n.name),l(),h(((e=o.selectedScope())==null?null:e.id)===n.id?3:-1)}}function Bo(i,t){if(i&1&&(s(0,"div",69),c(1),d()),i&2){let e=r(5);l(),y(e.copy().noDatasetsFound)}}function Uo(i,t){if(i&1&&F(0,Wo,4,2,"nile-menu-item",null,te,!1,Bo,2,1,"div",69),i&2){let e=r(4);O(e.datasets())}}function Go(i,t){if(i&1&&(s(0,"nile-menu-item")(1,"nile-dropdown",61)(2,"span",62),C(3,"nile-glyph",63),s(4,"span",64),c(5,"Dataset"),d(),C(6,"nile-glyph",65),d(),s(7,"nile-menu"),m(8,Lo,3,0,"div",66)(9,Uo,3,1),d()()()),i&2){let e=r(3);l(8),h(e.scopeLoading()?8:9)}}function jo(i,t){i&1&&(s(0,"div",66),C(1,"nile-skeleton-loader",67)(2,"nile-skeleton-loader",68),d())}function Ho(i,t){i&1&&C(0,"nile-glyph",72)}function Yo(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.selectScope("pipeline",o))}),s(1,"span",71),c(2),d(),m(3,Ho,1,0,"nile-glyph",72),d()}if(i&2){let e,n=t.$implicit,o=r(5);l(2),y(n.name),l(),h(((e=o.selectedScope())==null?null:e.id)===n.id?3:-1)}}function Ko(i,t){if(i&1&&(s(0,"div",69),c(1),d()),i&2){let e=r(5);l(),y(e.copy().noPipelinesFound)}}function Qo(i,t){if(i&1&&F(0,Yo,4,2,"nile-menu-item",null,te,!1,Ko,2,1,"div",69),i&2){let e=r(4);O(e.pipelines())}}function Xo(i,t){if(i&1&&(s(0,"nile-menu-item")(1,"nile-dropdown",61)(2,"span",62),C(3,"nile-glyph",73),s(4,"span",64),c(5,"Pipeline"),d(),C(6,"nile-glyph",65),d(),s(7,"nile-menu"),m(8,jo,3,0,"div",66)(9,Qo,3,1),d()()()),i&2){let e=r(3);l(8),h(e.scopeLoading()?8:9)}}function Jo(i,t){if(i&1){let e=k();s(0,"nile-dropdown",57),u("nile-hide",function(){_(e);let o=r(2);return g(o.closeScopeMenu())}),s(1,"nile-lite-tooltip",58)(2,"button",59),u("click",function(){_(e);let o=r(2);return g(o.openScopeMenu())}),C(3,"nile-glyph",60),d()(),s(4,"nile-menu"),m(5,Go,10,1,"nile-menu-item"),m(6,Xo,10,1,"nile-menu-item"),d()()}if(i&2){let e=r(2);b("open",e.showScopePicker()),l(5),h(e.features().scopePicker.dataset?5:-1),l(),h(e.features().scopePicker.pipeline?6:-1)}}function Zo(i,t){if(i&1&&(s(0,"nile-menu-item",74)(1,"div",75),C(2,"nile-skeleton-loader",76),s(3,"div",77),C(4,"nile-skeleton-loader",78)(5,"nile-skeleton-loader",79),d()()()),i&2){let e=t.$implicit;l(3),Z("max-width",e,"px")}}function ea(i,t){if(i&1&&F(0,Zo,6,2,"nile-menu-item",74,G),i&2){let e=r(2);O(e.menuSkeletonRows)}}function ta(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(2);l(),y(e.copy().noResultsMatchFilters)}}function na(i,t){if(i&1){let e=k();s(0,"input",88),u("ngModelChange",function(o){_(e);let a=r(5);return g(a.renameDraft.set(o))})("click",function(o){return o.stopPropagation()})("keydown.enter",function(o){_(e);let a=r().$implicit,p=r(4);return g(p.commitRenameConversation(o,a))})("keydown.escape",function(o){_(e);let a=r(5);return g(a.cancelRename(o))})("blur",function(o){_(e);let a=r().$implicit,p=r(4);return g(p.commitRenameConversation(o,a))}),d()}if(i&2){let e=r(5);b("ngModel",e.renameDraft())}}function ia(i,t){if(i&1&&(s(0,"span",89),c(1),d(),s(2,"span",90),c(3),d()),i&2){let e=r().$implicit,n=r(4);b("title",e.title||"Untitled"),l(),y(e.title||"Untitled"),l(2),y(n.conversationMeta(e))}}function oa(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.selectConversation(o.id))}),s(1,"div",75),C(2,"nile-glyph",81),s(3,"div",77),m(4,na,1,1,"input",82)(5,ia,4,3),d(),s(6,"div",83)(7,"button",84),u("click",function(o){let a=_(e).$implicit,p=r(4);return g(p.startRename(o,a.id,a.title))}),C(8,"nile-glyph",85),d(),s(9,"button",86),u("click",function(o){let a=_(e).$implicit,p=r(4);return g(p.deleteConversation(o,a.id))}),C(10,"nile-glyph",87),d()()()()}if(i&2){let e=t.$implicit,n=r(4);M("active",e.id===n.activeConversationId()?"":null),l(4),h(n.renamingId()===e.id?4:5),l(3),M("aria-label",n.copy().renameLabel),l(2),M("aria-label",n.copy().deleteLabel)}}function aa(i,t){if(i&1&&(s(0,"div",80),c(1),d(),F(2,oa,11,4,"nile-menu-item",null,te)),i&2){let e=t.$implicit;l(),y(e.label),l(),O(e.items)}}function ra(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(3);l(),y(e.copy().noConversationsYet)}}function la(i,t){if(i&1&&F(0,aa,4,1,null,null,se,!1,ra,2,1,"div",46),i&2){let e=r(2);O(e.groupedConversations())}}function sa(i,t){if(i&1&&(s(0,"nile-menu-item",74)(1,"div",75),C(2,"nile-skeleton-loader",76),s(3,"div",77),C(4,"nile-skeleton-loader",78)(5,"nile-skeleton-loader",95),d()()()),i&2){let e=t.$implicit;l(3),Z("max-width",e,"px")}}function da(i,t){if(i&1&&F(0,sa,6,2,"nile-menu-item",74,G),i&2){let e=r(3);O(e.menuSkeletonRows)}}function ca(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(3);l(),y(e.copy().noResultsMatchFilters)}}function pa(i,t){if(i&1){let e=k();s(0,"input",88),u("ngModelChange",function(o){_(e);let a=r(6);return g(a.renameDraft.set(o))})("click",function(o){return o.stopPropagation()})("keydown.enter",function(o){_(e);let a=r().$implicit,p=r(5);return g(p.commitRenameDashboard(o,a))})("keydown.escape",function(o){_(e);let a=r(6);return g(a.cancelRename(o))})("blur",function(o){_(e);let a=r().$implicit,p=r(5);return g(p.commitRenameDashboard(o,a))}),d()}if(i&2){let e=r(6);b("ngModel",e.renameDraft())}}function _a(i,t){if(i&1&&(s(0,"span",89),c(1),d(),s(2,"span",90),c(3),d()),i&2){let e=r().$implicit,n=r(5);b("title",e.name||"Untitled"),l(),y(e.name||"Untitled"),l(2),y(n.dashboardMeta(e))}}function ga(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.openRelatedDashboard(o.id))}),s(1,"div",75),C(2,"nile-glyph",96),s(3,"div",77),m(4,pa,1,1,"input",82)(5,_a,4,3),d(),s(6,"div",83)(7,"button",84),u("click",function(o){let a=_(e).$implicit,p=r(5);return g(p.startRename(o,a.id,a.name))}),C(8,"nile-glyph",85),d(),s(9,"button",86),u("click",function(o){let a=_(e).$implicit,p=r(5);return g(p.deleteDashboardFromMenu(o,a.id))}),C(10,"nile-glyph",87),d()()()()}if(i&2){let e=t.$implicit,n=r(5);M("active",n.builderOpen()&&e.id===n.builderDashboardId()?"":null),l(4),h(n.renamingId()===e.id?4:5),l(3),M("aria-label",n.copy().renameLabel),l(2),M("aria-label",n.copy().deleteLabel)}}function ua(i,t){if(i&1&&(s(0,"div",80),c(1),d(),F(2,ga,11,4,"nile-menu-item",null,te)),i&2){let e=t.$implicit;l(),y(e.label),l(),O(e.items)}}function ma(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(4);l(),y(e.copy().noDashboardsYet)}}function ha(i,t){if(i&1&&F(0,ua,4,1,null,null,se,!1,ma,2,1,"div",46),i&2){let e=r(3);O(e.groupedDashboards())}}function Ca(i,t){if(i&1){let e=k();s(0,"nile-dropdown",91),u("nile-hide",function(){_(e);let o=r(2);return g(o.showRelatedDashboards.set(!1))}),s(1,"nile-lite-tooltip",92)(2,"button",93),u("click",function(){_(e);let o=r(2);return g(o.showRelatedDashboards.set(!o.showRelatedDashboards()))}),C(3,"nile-glyph",94),d()(),s(4,"nile-menu",43),u("nile-search-value",function(o){_(e);let a=r(2);return g(a.dashSearch.set((o.detail==null?null:o.detail.value)??""))}),s(5,"nile-menu-item",44),u("click",function(){_(e);let o=r(2);return g(o.openNewDashboard())}),C(6,"nile-glyph",45),c(7),d(),m(8,da,2,0)(9,ca,2,1,"div",46)(10,ha,3,1),d()()}if(i&2){let e=r(2);b("open",e.showRelatedDashboards()),l(4),M("noResultsMessage",e.copy().noResultsMatchFilters),l(3),q(" ",e.copy().newDashboardLabel," "),l(),h(e.dashboardsLoading()?8:e.dashSearchEmpty()?9:10)}}function fa(i,t){if(i&1){let e=k();s(0,"nile-lite-tooltip",48)(1,"button",97),u("click",function(){_(e);let o=r(2);return g(o.openGallery())}),C(2,"nile-glyph",98),d()()}}function xa(i,t){if(i&1){let e=k();s(0,"header",12)(1,"div",34),m(2,zo,4,4,"nile-nav-tab-group",35),d(),s(3,"div",36),m(4,No,6,3,"span",37),m(5,Jo,7,3,"nile-dropdown",38),s(6,"nile-dropdown",39),u("nile-hide",function(){_(e);let o=r();return g(o.showConversationPicker.set(!1))}),s(7,"nile-lite-tooltip",40)(8,"button",41),u("click",function(){_(e);let o=r();return g(o.showConversationPicker.set(!o.showConversationPicker()))}),C(9,"nile-glyph",42),d()(),s(10,"nile-menu",43),u("nile-search-value",function(o){_(e);let a=r();return g(a.convSearch.set((o.detail==null?null:o.detail.value)??""))}),s(11,"nile-menu-item",44),u("click",function(){_(e);let o=r();return g(o.newConversation())}),C(12,"nile-glyph",45),c(13),d(),m(14,ea,2,0)(15,ta,2,1,"div",46)(16,la,3,1),d()(),m(17,Ca,11,4,"nile-dropdown",47),m(18,fa,3,0,"nile-lite-tooltip",48),d()()}if(i&2){let e,n=r();l(2),h(n.tabsVisible()?2:-1),l(2),h((e=n.features().connections&&n.selectedScope())?4:-1,e),l(),h(n.features().scopePicker.enabled?5:-1),l(),b("open",n.showConversationPicker()),l(2),b("disabled",n.isStreaming()),l(2),M("noResultsMessage",n.copy().noResultsMatchFilters),l(3),q(" ",n.copy().newConversationLabel," "),l(),h(n.conversationsLoading()?14:n.convSearchEmpty()?15:16),l(3),h(n.features().dashboardsMenu?17:-1),l(),h(n.features().promptGallery?18:-1)}}function ya(i,t){if(i&1){let e=k();s(0,"button",112),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.selectWidgetTemplateCategory(o.key))}),c(1),s(2,"span",113),c(3),d()()}if(i&2){let e=t.$implicit,n=r(4);W("aq-picker-chip--active",n.widgetTemplateActiveCategory()===e.key),l(),q("",e.label," "),l(2),y(n.widgetTemplateCountForCategory(e.key))}}function ba(i,t){if(i&1){let e=k();s(0,"div",110)(1,"button",112),u("click",function(){_(e);let o=r(3);return g(o.selectWidgetTemplateCategory("all"))}),c(2),s(3,"span",113),c(4),d()(),F(5,ya,4,4,"button",114,se),d()}if(i&2){let e=r(3);l(),W("aq-picker-chip--active",e.widgetTemplateActiveCategory()==="all"),l(),q("",e.copy().libraryAllCategoryLabel," "),l(2),y(e.widgetTemplateAllTemplates().length),l(),O(e.templateCategories())}}function va(i,t){if(i&1&&C(0,"nile-skeleton-loader",116),i&2){let e=t.$implicit;Z("width",e,"px")}}function wa(i,t){if(i&1&&(s(0,"div",111),F(1,va,1,2,"nile-skeleton-loader",115,G),d()),i&2){let e=r(3);l(),O(e.libraryChipSkeletonWidths)}}function ka(i,t){if(i&1){let e=k();s(0,"nile-input",108),u("nile-input",function(o){_(e);let a=r(2);return g(a.librarySearch.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r(2);return g(a.librarySearch.set((o.detail==null?null:o.detail.value)??""))}),C(1,"nile-glyph",109),d(),m(2,ba,7,4,"div",110)(3,wa,3,0,"div",111)}if(i&2){let e=r(2);b("placeholder",e.copy().librarySearchWidgetsPlaceholder)("value",e.librarySearch()),l(2),h(!e.templateCategoriesLoading()&&!e.widgetTemplateTemplatesLoading()?2:3)}}function Pa(i,t){if(i&1){let e=k();s(0,"button",112),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.selectTemplateCategory(o.key))}),c(1),s(2,"span",113),c(3),d()()}if(i&2){let e=t.$implicit,n=r(4);W("aq-picker-chip--active",n.templateActiveCategory()===e.key),l(),q("",e.label," "),l(2),y(n.templateCountForCategory(e.key))}}function Aa(i,t){if(i&1){let e=k();s(0,"div",110)(1,"button",112),u("click",function(){_(e);let o=r(3);return g(o.selectTemplateCategory("all"))}),c(2),s(3,"span",113),c(4),d()(),F(5,Pa,4,4,"button",114,se),d()}if(i&2){let e=r(3);l(),W("aq-picker-chip--active",e.templateActiveCategory()==="all"),l(),q("",e.copy().libraryAllCategoryLabel," "),l(2),y(e.templateAllTemplates().length),l(),O(e.templateCategories())}}function Ma(i,t){if(i&1&&C(0,"nile-skeleton-loader",116),i&2){let e=t.$implicit;Z("width",e,"px")}}function Sa(i,t){if(i&1&&(s(0,"div",111),F(1,Ma,1,2,"nile-skeleton-loader",115,G),d()),i&2){let e=r(3);l(),O(e.libraryChipSkeletonWidths)}}function Ta(i,t){if(i&1){let e=k();s(0,"nile-input",108),u("nile-input",function(o){_(e);let a=r(2);return g(a.librarySearch.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r(2);return g(a.librarySearch.set((o.detail==null?null:o.detail.value)??""))}),C(1,"nile-glyph",109),d(),m(2,Aa,7,4,"div",110)(3,Sa,3,0,"div",111)}if(i&2){let e=r(2);b("placeholder",e.copy().librarySearchDashboardsPlaceholder)("value",e.librarySearch()),l(2),h(e.templateCategoriesLoading()?3:2)}}function qa(i,t){if(i&1&&(s(0,"div",123),C(1,"nile-skeleton-loader",124)(2,"nile-skeleton-loader",125)(3,"nile-skeleton-loader",126)(4,"nile-skeleton-loader",127),d()),i&2){let e=t.$implicit;l(),M("width",e)}}function Da(i,t){if(i&1&&(s(0,"div",118)(1,"div",119),C(2,"nile-skeleton-loader",120)(3,"nile-skeleton-loader",121),d(),s(4,"div",122),F(5,qa,5,1,"div",123,G),d()()),i&2){let e=t.$implicit;l(5),O(e)}}function Fa(i,t){if(i&1&&(s(0,"div",117),F(1,Da,7,0,"div",118,G),d()),i&2){let e=r(3);l(),O(e.librarySkeletonGroups)}}function Oa(i,t){if(i&1){let e=k();s(0,"div",132),u("click",function(){let o=_(e).$implicit,a=r(6);return g(a.openWidgetDetailFromCard(o.templateId))}),C(1,"nile-kpi-chart",133),s(2,"button",134),u("click",function(o){let a=_(e).$implicit,p=r(6);return o.stopPropagation(),g(p.toggleWidgetTemplateSelection(a.templateId))}),C(3,"nile-glyph",135),d()()}if(i&2){let e=t.$implicit,n=r(6);W("aq-lib-card-wrap--selected",n.widgetTemplatePickerSelectedIds().includes(e.templateId)),l(),b("label",e.title)("description",e.desc??"")("value",e.value)("loading",e.loading)("sparkline",e.sparkline)("options",n.libraryKpiChartOptions)("sparklineColor",n.brandSparklineColor()),l(),W("aq-lib-card__check--on",n.widgetTemplatePickerSelectedIds().includes(e.templateId))}}function Ea(i,t){if(i&1){let e=k();s(0,"div",118)(1,"div",119)(2,"span",129),c(3),d(),s(4,"button",130),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.toggleLibraryGroupSelection(o.cards))}),c(5),d()(),s(6,"div",122),F(7,Oa,4,11,"div",131,So),d()()}if(i&2){let e=t.$implicit,n=r(5);l(3),Y("",e.label," \xB7 ",e.cards.length),l(2),q(" ",n.isGroupFullySelected(e.cards)?n.copy().libraryClearSelectionButton:n.copy().librarySelectAllButton," "),l(2),O(e.cards)}}function Ia(i,t){if(i&1&&F(0,Ea,9,3,"div",118,se),i&2){let e=r(4);O(e.libraryWidgetGroups())}}function Va(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(4);l(),y(e.librarySearch()?e.copy().noWidgetsMatch:e.copy().noWidgetsInCategory)}}function Ra(i,t){if(i&1&&m(0,Ia,2,0)(1,Va,2,1,"div",128),i&2){let e=r(3);h(e.libraryWidgetGroups().length?0:1)}}function za(i,t){if(i&1&&m(0,Fa,3,0,"div",117)(1,Ra,2,1),i&2){let e=r(2);h(e.templateCategoriesLoading()||e.widgetTemplateTemplatesLoading()?0:1)}}function Na(i,t){if(i&1&&(s(0,"div",137),C(1,"nile-skeleton-loader",138),s(2,"div",139),C(3,"nile-skeleton-loader",124)(4,"nile-skeleton-loader",126)(5,"nile-skeleton-loader",140),d()()),i&2){let e=t.$implicit;l(3),M("width",e)}}function La(i,t){if(i&1&&(s(0,"div",118)(1,"div",119),C(2,"nile-skeleton-loader",120),d(),s(3,"div",136),F(4,Na,6,1,"div",137,G),d()()),i&2){let e=t.$implicit;l(4),O(e)}}function $a(i,t){if(i&1&&(s(0,"div",117),F(1,La,6,0,"div",118,G),d()),i&2){let e=r(3);l(),O(e.librarySkeletonGroups)}}function Wa(i,t){if(i&1&&(s(0,"div",144),C(1,"db-dash-card-chart",152),d()),i&2){let e=r().$implicit;l(),b("config",e.preview)}}function Ba(i,t){i&1&&(s(0,"div",145),C(1,"span",153)(2,"span",154)(3,"span",155)(4,"span",156)(5,"span",157),d())}function Ua(i,t){if(i&1&&(s(0,"span",146),C(1,"nile-glyph",158),c(2),d()),i&2){let e=r().$implicit,n=r(5);l(2),q(" ",n.withCount(n.copy().libraryWidgetCountChip,(e.widgets==null?null:e.widgets.length)??0)," ")}}function Ga(i,t){if(i&1&&(s(0,"div",150),c(1),d()),i&2){let e=r().$implicit;l(),y(e.description)}}function ja(i,t){if(i&1){let e=k();s(0,"button",142),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.openWidgetDetailPanelForTemplate(o))}),s(1,"div",143),m(2,Wa,2,1,"div",144)(3,Ba,6,0,"div",145),m(4,Ua,3,1,"span",146),d(),s(5,"div",147)(6,"div",148)(7,"span",149),c(8),d(),m(9,Ga,2,1,"div",150),d(),C(10,"nile-glyph",151),d()()}if(i&2){let e=t.$implicit;l(2),h(e.preview!=null&&e.preview.chart?2:3),l(2),h(e.widgets!=null&&e.widgets.length?4:-1),l(4),y(e.name),l(),h(e.description?9:-1)}}function Ha(i,t){if(i&1&&(s(0,"div",118)(1,"div",119)(2,"span",129),c(3),d()(),s(4,"div",136),F(5,ja,11,4,"button",141,te),d()()),i&2){let e=t.$implicit;l(3),Y("",e.label," \xB7 ",e.templates.length),l(2),O(e.templates)}}function Ya(i,t){if(i&1&&F(0,Ha,7,2,"div",118,se),i&2){let e=r(3);O(e.libraryDashboardGroups())}}function Ka(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(3);l(),y(e.librarySearch()?e.copy().noDashboardsMatch:e.copy().noDashboardsInCategory)}}function Qa(i,t){if(i&1&&m(0,$a,3,0,"div",117)(1,Ya,2,0)(2,Ka,2,1,"div",128),i&2){let e=r(2);h(e.templateTemplatesLoading()?0:e.libraryDashboardGroups().length?1:2)}}function Xa(i,t){if(i&1){let e=k();s(0,"div",107)(1,"span",159),c(2),d(),s(3,"nile-button",22),u("click",function(){_(e);let o=r(2);return g(o.addSelectedWidgetTemplates())}),C(4,"nile-glyph",160),c(5),d()()}if(i&2){let e=r(2);l(2),q(" ",e.withCount(e.copy().librarySelectedCount,e.widgetTemplatePickerSelectedIds().length)," "),l(3),q(" ",e.withCount(e.copy().libraryAddToCanvasButton,e.widgetTemplatePickerSelectedIds().length)," ")}}function Ja(i,t){if(i&1){let e=k();s(0,"div",13)(1,"div",99)(2,"p",100)(3,"strong",101),c(4),d(),c(5),d(),s(6,"nile-nav-tab-group",102),u("nile-tab-change",function(o){_(e);let a=r();return a.artifactPickerTab.set(o.detail.value),a.widgetTemplatePickerSelectedIds.set([]),g(a.librarySearch.set(""))}),s(7,"nile-nav-tab",103),c(8),s(9,"span",104),c(10),d()(),s(11,"nile-nav-tab",105),c(12),s(13,"span",104),c(14),d()()(),m(15,ka,4,3)(16,Ta,4,3),d(),s(17,"div",106),m(18,za,2,1)(19,Qa,3,1),d(),m(20,Xa,6,2,"div",107),d()}if(i&2){let e=r();l(4),y(e.copy().libraryIntroTitle),l(),q(" ",e.copy().libraryIntro," "),l(),M("value",e.artifactPickerTab()),l(2),y(e.copy().libraryWidgetsTabLabel),l(2),y(e.widgetTemplateAllTemplates().length),l(2),y(e.copy().libraryDashboardsTabLabel),l(2),y(e.templateAllTemplates().length),l(),h(e.artifactPickerTab()==="kpis"?15:16),l(3),h(e.artifactPickerTab()==="kpis"?18:19),l(2),h(e.artifactPickerTab()==="kpis"&&e.widgetTemplatePickerSelectedIds().length?20:-1)}}function Za(i,t){i&1&&(s(0,"div",182),C(1,"nile-skeleton-loader",183)(2,"nile-skeleton-loader",184),d())}function er(i,t){if(i&1&&F(0,Za,3,0,"div",182,G),i&2){let e=r(2);O(e.cohortCriteriaSkeletonRows)}}function tr(i,t){if(i&1&&(s(0,"p",185),c(1),d()),i&2){let e=r(3);l(),y(e.copy().cohortLogUnavailableMessage)}}function nr(i,t){if(i&1){let e=k();s(0,"p",185),c(1),d(),s(2,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.retryCohortCriteria())}),c(3),d()}if(i&2){let e=r(3);l(),y(e.copy().cohortCriteriaErrorMessage),l(2),q(" ",e.copy().cohortPreviewRetryButton," ")}}function ir(i,t){i&1&&(s(0,"div",170),m(1,tr,2,1,"p",185)(2,nr,4,2),d()),i&2&&(l(),h(t==="unavailable"?1:2))}function or(i,t){if(i&1){let e=k();s(0,"button",187),u("click",function(){let o=_(e).$implicit,a=r(3);return g(a.selectCohortCriterion(o.id))}),C(1,"span",188),s(2,"span",189),c(3),d()()}if(i&2){let e=t.$implicit,n=r(3);W("is-selected",n.selectedCriterionId()===e.id),M("aria-checked",n.selectedCriterionId()===e.id),l(3),y(e.label)}}function ar(i,t){if(i&1&&F(0,or,4,4,"button",186,te),i&2){let e=r(2);O(e.cohortCriteria())}}function rr(i,t){i&1&&(s(0,"div",191)(1,"span",192),C(2,"nile-skeleton-loader",76),d(),C(3,"nile-skeleton-loader",193)(4,"nile-skeleton-loader",194),d())}function lr(i,t){if(i&1&&(s(0,"div",171),C(1,"nile-skeleton-loader",190),F(2,rr,5,0,"div",191,G),d()),i&2){let e=r(2);l(2),O(e.cohortMatchSkeletonRows)}}function sr(i,t){if(i&1&&(s(0,"p",196),c(1),d()),i&2){let e=r(3);l(),y(e.copy().cohortEmptyMatchesMessage)}}function dr(i,t){if(i&1&&(s(0,"p",196),c(1),d()),i&2){let e=r(3);l(),y(e.copy().cohortNamesWithheldMessage)}}function cr(i,t){if(i&1&&(s(0,"span",201),c(1),d()),i&2){let e=r().$implicit;l(),q("",e.daysInState,"d")}}function pr(i,t){if(i&1&&(s(0,"div",198)(1,"span",200),c(2),d(),m(3,cr,2,1,"span",201),d()),i&2){let e=t.$implicit;l(2),y(e.name??"\u2014"),l(),h(e.daysInState!==null&&e.daysInState!==void 0?3:-1)}}function _r(i,t){i&1&&(s(0,"div",202)(1,"span",192),C(2,"nile-skeleton-loader",76),d(),C(3,"nile-skeleton-loader",193)(4,"nile-skeleton-loader",194),d())}function gr(i,t){if(i&1&&F(0,_r,5,0,"div",202,G),i&2){let e=r(4);O(e.cohortMatchSkeletonRows)}}function ur(i,t){if(i&1&&(s(0,"p",199),c(1),d()),i&2){let e=r(4);l(),y(e.cohortMatchesTruncatedNote())}}function mr(i,t){if(i&1&&(s(0,"p",199),c(1),d()),i&2){let e=r(4);l(),y(e.copy().cohortMembersForbiddenMessage)}}function hr(i,t){if(i&1&&(s(0,"p",199),c(1),d()),i&2){let e=r(5);l(),y(e.copy().cohortMembersErrorMessage)}}function Cr(i,t){if(i&1){let e=k();s(0,"button",204),u("click",function(){_(e);let o=r(5);return g(o.toggleAllCohortMatches())}),c(1),d()}if(i&2){let e=r(5);b("disabled",e.cohortMembersLoading()),M("aria-expanded",e.cohortMatchesExpanded())("aria-busy",e.cohortMembersLoading()?"true":null),l(),y(e.cohortViewAllLabel())}}function fr(i,t){if(i&1&&(m(0,hr,2,1,"p",199),m(1,Cr,2,4,"button",203)),i&2){let e=r(4);h(e.cohortMembersError()==="failed"?0:-1),l(),h(e.cohortHasMoreMatches()?1:-1)}}function xr(i,t){if(i&1&&(s(0,"div",197),F(1,pr,4,2,"div",198,To),m(3,gr,2,0),d(),m(4,ur,2,1,"p",199),m(5,mr,2,1,"p",199)(6,fr,2,2)),i&2){let e=r(3);W("is-expanded",e.cohortMatchesExpanded()),l(),O(e.visibleCohortMatches()),l(2),h(e.cohortMembersLoading()?3:-1),l(),h(e.cohortMatchesExpanded()&&e.cohortMatchesTruncated()?4:-1),l(),h(e.cohortMembersError()==="forbidden"?5:6)}}function yr(i,t){if(i&1&&(s(0,"div",172)(1,"p",195),c(2),d(),m(3,sr,2,1,"p",196)(4,dr,2,1,"p",196)(5,xr,7,5),d()),i&2){let e=r(2);l(2),y(e.cohortMatchSummary()),l(),h(t.matchCount===0?3:e.cohortNamesWithheld()?4:5)}}function br(i,t){if(i&1&&(s(0,"p",185),c(1),d()),i&2){let e=r(3);l(),y(e.copy().cohortLogUnavailableMessage)}}function vr(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){let o=_(e),a=r(4);return g(a.selectCohortCriterion(o))}),c(1),d()}if(i&2){let e=r(4);l(),q(" ",e.copy().cohortPreviewRetryButton," ")}}function wr(i,t){if(i&1&&(s(0,"p",185),c(1),d(),m(2,vr,2,1,"nile-button",205)),i&2){let e,n=r(3);l(),y(n.copy().cohortPreviewErrorMessage),l(),h((e=n.selectedCriterionId())?2:-1,e)}}function kr(i,t){i&1&&(s(0,"div",173),m(1,br,2,1,"p",185)(2,wr,3,2),d()),i&2&&(l(),h(t==="unavailable"?1:2))}function Pr(i,t){if(i&1){let e=k();s(0,"div",14)(1,"div",161)(2,"span",162),C(3,"nile-glyph",163),d(),s(4,"span",164),c(5),d()(),s(6,"p",165),c(7),d(),s(8,"div",166)(9,"span",167),c(10,"1"),d(),s(11,"span",168),c(12),d()(),s(13,"div",169),m(14,er,2,0)(15,ir,3,1,"div",170)(16,ar,2,0),d(),s(17,"div",166)(18,"span",167),c(19,"2"),d(),s(20,"span",168),c(21),d()(),m(22,lr,4,0,"div",171)(23,yr,6,2,"div",172)(24,kr,3,1,"div",173),C(25,"div",174),s(26,"div",175)(27,"p",176),c(28),d(),s(29,"div",177)(30,"nile-button",178),u("click",function(){_(e);let o=r();return g(o.addCohortToCanvas())}),C(31,"nile-glyph",179),c(32),d(),s(33,"nile-button",180),u("click",function(){_(e);let o=r();return g(o.addCohortToCanvas())}),C(34,"nile-glyph",181),c(35),d()()()()}if(i&2){let e,n,o=r();l(5),y(o.copy().cohortBuilderTitle),l(2),y(o.copy().cohortBuilderSubtitle),l(5),y(o.copy().cohortStep1Label),l(),M("aria-label",o.copy().cohortStep1Label),l(),h(o.cohortCriteriaLoading()&&!o.cohortCriteria().length?14:(e=o.cohortCriteriaError())?15:16,e),l(7),y(o.copy().cohortStep2Label),l(),h(o.cohortPreviewLoading()?22:(n=o.cohortPreview())?23:(n=o.cohortPreviewError())?24:-1,n),l(6),y(o.copy().cohortAddToCanvasDisclaimer),l(2),M("disabled",o.cohortPreview()?null:""),l(2),q(" ",o.copy().cohortPreviewWidgetButton," "),l(),M("disabled",o.cohortPreview()?null:""),l(2),q(" ",o.copy().cohortAddToCanvasButton," ")}}function Ar(i,t){i&1&&(s(0,"div",216),C(1,"nile-skeleton-loader",217),s(2,"div",218),C(3,"nile-skeleton-loader",78),d()())}function Mr(i,t){i&1&&(s(0,"div",215),F(1,Ar,4,0,"div",216,G),d()),i&2&&(l(),O(pe(0,Mo)))}function Sr(i,t){if(i&1&&(s(0,"span",225),c(1),d()),i&2){let e=r().$implicit;l(),y(e.badge)}}function Tr(i,t){if(i&1){let e=k();s(0,"button",222),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.onWelcomePromptPick(o))}),C(1,"nile-glyph",223),s(2,"span",224),c(3),d(),m(4,Sr,2,1,"span",225),d()}if(i&2){let e=t.$implicit;W("prompt-card--ai",e.tone==="ai"),l(),M("name",e.icon)("color",e.tone==="ai"?"#7a5af8":"var(--ng-colors-text-quaternary-500)"),l(2),y(e.label),l(),h(e.badge?4:-1)}}function qr(i,t){if(i&1&&(s(0,"div",219),F(1,Tr,5,6,"button",221,Ei),d()),i&2){let e=r(4);l(),O(e.welcomePromptCards())}}function Dr(i,t){if(i&1){let e=k();s(0,"button",227),u("click",function(){_(e);let o=r(5);return g(o.openGallery())}),C(1,"nile-glyph",228),s(2,"span"),c(3),d()()}if(i&2){let e=r(5);l(3),y(e.copy().promptGalleryLabel)}}function Fr(i,t){if(i&1){let e=k();s(0,"button",227),u("click",function(){_(e);let o=r(5);return g(o.openXray())}),C(1,"nile-glyph",229),s(2,"span"),c(3),d()()}if(i&2){let e=r(5);l(3),y(e.copy().xrayLabel)}}function Or(i,t){if(i&1&&(s(0,"div",220),m(1,Dr,4,1,"button",226),m(2,Fr,4,1,"button",226),d()),i&2){let e=r(4);l(),h(e.features().promptGallery?1:-1),l(),h(e.features().xray?2:-1)}}function Er(i,t){if(i&1&&(m(0,qr,3,0,"div",219),m(1,Or,3,2,"div",220)),i&2){let e=r(3);h(e.features().welcomePrompts?0:-1),l(),h(e.features().promptGallery||e.features().xray?1:-1)}}function Ir(i,t){if(i&1&&(s(0,"div",206)(1,"div",208)(2,"div",209),C(3,"nile-glyph",210),d(),s(4,"h2",211),c(5),d(),s(6,"p",212),c(7),d(),s(8,"div",213),fe(9,214),d(),m(10,Mr,3,1,"div",215)(11,Er,2,2),d()()),i&2){let e=r(2),n=de(8);l(5),y(e.copy().welcomeTitle),l(2),y(e.copy().welcomeSubtitle),l(2),b("ngTemplateOutlet",n),l(),h(e.features().welcomePrompts&&!e.welcomePromptCards().length?10:11)}}function Vr(i,t){i&1&&(s(0,"div",232),C(1,"nile-skeleton-loader",233),d(),s(2,"div",234),C(3,"nile-skeleton-loader",235)(4,"nile-skeleton-loader",236)(5,"nile-skeleton-loader",237),d(),s(6,"div",232),C(7,"nile-skeleton-loader",238),d(),s(8,"div",234),C(9,"nile-skeleton-loader",239)(10,"nile-skeleton-loader",240),d())}function Rr(i,t){if(i&1&&(s(0,"div",242),C(1,"nile-glyph",246),s(2,"span",247),c(3),d()()),i&2){let e=r(2).$implicit;l(3),y(e.quotedText)}}function zr(i,t){if(i&1&&(s(0,"span",252),c(1),d()),i&2){let e=r().$implicit;l(),y(e.answer)}}function Nr(i,t){if(i&1&&(s(0,"div",248),C(1,"nile-glyph",249),s(2,"div",250)(3,"span",251),c(4),d(),m(5,zr,2,1,"span",252),d()()),i&2){let e=t.$implicit;l(4),y(e.title),l(),h(e.answer&&e.answer!=="Use this"?5:-1)}}function Lr(i,t){if(i&1&&(s(0,"div",243),F(1,Nr,6,2,"div",248,G),d()),i&2){let e=r(2).$implicit,n=r(4);l(),O(n.answerSummaryRows(e))}}function $r(i,t){if(i&1&&(s(0,"span",244),c(1),d()),i&2){let e=r(2).$implicit;l(),y(e.text)}}function Wr(i,t){if(i&1&&(s(0,"div",253),C(1,"nile-glyph",254),s(2,"span",255),c(3),d()()),i&2){let e=t.$implicit;l(),M("name",e.contentType.startsWith("image/")?"ng-image-03":"ng-file-06"),l(),M("title",e.name),l(),y(e.name)}}function Br(i,t){if(i&1&&(s(0,"div",245),F(1,Wr,4,3,"div",253,se),d()),i&2){let e=r(2).$implicit;l(),O(e.attachments??pe(0,Se))}}function Ur(i,t){if(i&1&&(s(0,"nile-ai-chat-bubble",241),m(1,Rr,4,1,"div",242),m(2,Lr,3,0,"div",243)(3,$r,2,1,"span",244),m(4,Br,3,1,"div",245),d()),i&2){let e=r().$implicit;b("role","user"),l(),h(e.quotedText?1:-1),l(),h(e.answerSummary?2:3),l(2),h(e.attachments!=null&&e.attachments.length?4:-1)}}function Gr(i,t){if(i&1&&C(0,"nile-ai-steps",256),i&2){let e=r(2).$implicit;b("steps",e.tools)}}function jr(i,t){if(i&1&&C(0,"nile-ai-token-stream",265),i&2){let e=r(4).$implicit,n=r(4);b("text",n.cleanText(e.text))("speedMs",n.streamSpeed)}}function Hr(i,t){if(i&1&&C(0,"nile-markdown",266),i&2){let e=r(4).$implicit,n=r(4);b("value",n.cleanMarkdown(e.text))}}function Yr(i,t){if(i&1&&m(0,jr,1,2,"nile-ai-token-stream",265)(1,Hr,1,1,"nile-markdown",266),i&2){let e=r(3).$implicit;h(e.isStreaming?0:1)}}function Kr(i,t){if(i&1&&(s(0,"span",267),c(1),d()),i&2){let e=r().$implicit;l(),Y("Setup ",e.step.current," of ",e.step.total)}}function Qr(i,t){i&1&&(s(0,"span",276),c(1),d()),i&2&&(l(),y(t))}function Xr(i,t){if(i&1&&(s(0,"span",278),c(1),d()),i&2){let e=r().$implicit;l(),y(e.hint)}}function Jr(i,t){if(i&1&&(s(0,"span"),c(1),d()),i&2){let e=r().$implicit;at("choice-card__chip"+(e.tone?" choice-card__chip--"+e.tone:"")),l(),y(e.text)}}function Zr(i,t){if(i&1&&m(0,Jr,2,3,"span",280),i&2){let e=t.$implicit;h(e.tone!=="green"&&e.tone!=="yellow"&&e.tone!=="red"?0:-1)}}function el(i,t){if(i&1&&(s(0,"span",279),F(1,Zr,1,1,null,null,G),d()),i&2){let e=r().$implicit;l(),O(e.meta)}}function tl(i,t){if(i&1&&(s(0,"nile-radio",272)(1,"span",273)(2,"span",274),c(3),d(),s(4,"span",275),m(5,Qr,2,1,"span",276),s(6,"span",277),c(7),d(),m(8,Xr,2,1,"span",278),m(9,el,3,0,"span",279),d()()()),i&2){let e,n=t.$implicit,o=t.$index,a=t.$index,p=r(2).$implicit,x=r(3).$implicit,v=r(4);W("choice-card--chosen",(p.selected||p.draftSelection)===n.id)("choice-card--locked",!!p.selected||v.isStreaming()),M("name","choice-"+x.id+"-"+o)("value",n.id)("checked",(p.selected||p.draftSelection)===n.id?"":null)("disabled",p.selected||v.isStreaming()?"":null),l(3),y(a+1),l(2),h((e=v.optionBadgeText(n))?5:-1,e),l(2),y(v.optionPrimaryText(n)),l(),h(!v.optionBadgeText(n)&&n.hint?8:-1),l(),h(n.meta!=null&&n.meta.length?9:-1)}}function nl(i,t){if(i&1){let e=k();s(0,"nile-radio-group",270),u("nile-change",function(o){_(e);let a=r().$implicit,p=r(3).$implicit,x=r(4);return g(x.onChoiceChange(p,a,o.detail.value))}),F(1,tl,10,13,"nile-radio",271,te),d()}if(i&2){let e=r(),n=e.$implicit,o=e.$index,a=r(3).$implicit,p=r(4);M("label",n.prompt||"Choose an index")("name","choice-"+a.id+"-"+o)("value",n.selected||n.draftSelection||null)("disabled",n.selected||p.isStreaming()?"":null),l(),O(n.options)}}function il(i,t){if(i&1&&(s(0,"p",269),c(1),d()),i&2){let e=r(8);l(),y(e.copy().noChoiceOptions)}}function ol(i,t){if(i&1&&c(0),i&2){let e=r(3).$implicit;q(" \u2713 Something else: ",e.chatDraftText," (edit) ")}}function al(i,t){if(i&1&&(C(0,"nile-glyph",286),c(1)),i&2){let e=r(10);l(),q(" ",e.copy().somethingElseButton," ")}}function rl(i,t){if(i&1){let e=k();s(0,"button",283),u("click",function(){_(e);let o=r(3).$implicit,a=r(3).$implicit,p=r(4);return g(p.requestPlan(a,o))}),c(1),d()}if(i&2){let e=r(10);b("disabled",e.isStreaming()),l(),q(" ",e.copy().givePlanButton," ")}}function ll(i,t){if(i&1){let e=k();s(0,"button",287),u("click",function(){_(e);let o=r(3).$implicit,a=r(3).$implicit,p=r(4);return g(p.previewWidget(a,o))}),C(1,"nile-glyph",288),c(2),d()}if(i&2){let e=r(3).$implicit,n=r(7);b("disabled",n.isStreaming()),l(2),q(' Preview "',n.choiceTitle(e),'" ')}}function sl(i,t){if(i&1){let e=k();s(0,"div",281)(1,"button",283),u("click",function(){_(e);let o=r(2).$implicit,a=r(3).$implicit,p=r(4);return g(p.openChatDraft(a,o))}),m(2,ol,1,1)(3,al,2,1),d(),m(4,rl,2,2,"button",284),m(5,ll,3,2,"button",285),d()}if(i&2){let e=r(2).$implicit,n=r(7);l(),b("disabled",n.isStreaming()),l(),h(e.chatDraftText!=null&&e.chatDraftText.trim()?2:3),l(2),h(e.kind==="clarification"?4:-1),l(),h(e.kind==="widget_plan"?5:-1)}}function dl(i,t){if(i&1){let e=k();s(0,"div",282)(1,"span",289),c(2,"Something else"),d(),s(3,"div",290)(4,"nile-input",291),u("nile-input",function(o){_(e);let a=r(2).$implicit,p=r(3).$implicit,x=r(4);return g(x.onChatDraftTextChange(p,a,o.detail.value))})("keydown.enter",function(){_(e);let o=r(2).$implicit,a=r(3).$implicit,p=r(4);return g(p.defineChatDraft(a,o))}),d(),s(5,"nile-button",22),u("click",function(){_(e);let o=r(2).$implicit,a=r(3).$implicit,p=r(4);return g(p.defineChatDraft(a,o))}),c(6),d()()()}if(i&2){let e=r(2).$implicit,n=r(7);l(4),b("value",e.chatDraftText??""),M("placeholder",e.kind==="widget_clarification"?n.copy().chatDraftPlaceholderWidget:e.kind==="widget_plan"?n.copy().chatDraftPlaceholderPlan:e.kind==="plan_intake"?n.copy().chatDraftPlaceholderIntake:n.copy().chatDraftPlaceholderClarification)("disabled",n.isStreaming()?"":null),l(),M("disabled",!(e.chatDraftText!=null&&e.chatDraftText.trim())||n.isStreaming()?"":null),l(),q(" ",n.copy().defineItButton," ")}}function cl(i,t){if(i&1&&m(0,sl,6,4,"div",281)(1,dl,7,5,"div",282),i&2){let e=r().$implicit;h(e.chatOpen?1:0)}}function pl(i,t){if(i&1&&(s(0,"div",259),m(1,Kr,2,2,"span",267),m(2,nl,3,4,"nile-radio-group",268)(3,il,2,1,"p",269),m(4,cl,2,1),d()),i&2){let e=t.$implicit;l(),h(e.step?1:-1),l(),h(e.options.length?2:3),l(2),h((e.kind==="widget_clarification"||e.kind==="clarification"||e.kind==="widget_plan"||e.kind==="plan_intake")&&!e.selected&&e.options.length?4:-1)}}function _l(i,t){if(i&1){let e=k();s(0,"button",292),u("click",function(){_(e);let o=r(3).$implicit,a=r(4);return g(a.resumeChoicePanel(o))}),c(1),d()}if(i&2){let e=r(3).$implicit,n=r(4);l(),Y(" ",n.panelAnsweredCount(e.choices??pe(2,Se))," of ",(e.choices??pe(3,Se)).length," answered \u2014 Resume ")}}function gl(i,t){i&1&&(s(0,"span",294),C(1,"span",300),c(2,"Live "),d())}function ul(i,t){i&1&&(s(0,"span",295),c(1,"Preview"),d())}function ml(i,t){i&1&&C(0,"div",303)}function hl(i,t){if(i&1&&C(0,"nile-glyph",307),i&2){let e=r().$implicit;Z("color",e.color),b("name",e.glyph)("method",e.method||"stroke")}}function Cl(i,t){if(i&1){let e=k();m(0,ml,1,0,"div",303),s(1,"nile-menu-item",304),u("click",function(){let o=_(e).$implicit;r();let a=de(1),p=r(4).$implicit;return r(4).onInlineWidgetMenuItem(p,o),g(a.hide())}),s(2,"span",305),m(3,hl,1,4,"nile-glyph",306),c(4),d()()}if(i&2){let e=t.$implicit;h(e.divider?0:-1),l(3),h(e.glyph?3:-1),l(),q(" ",e.label," ")}}function fl(i,t){if(i&1&&(s(0,"nile-dropdown",296,4)(2,"button",301),C(3,"nile-glyph",302),d(),s(4,"nile-menu"),F(5,Cl,5,3,null,null,se),d()()),i&2){let e=r(4).$implicit,n=r(4);l(5),O(n.inlineWidgetMenuItems(e))}}function xl(i,t){i&1&&(s(0,"div",311),C(1,"nile-spinner",314),s(2,"span"),c(3,"Loading chart types\u2026"),d()())}function yl(i,t){if(i&1&&(s(0,"p",312),c(1),d()),i&2){let e=r(9);l(),y(e.copy().noChartTypesFit)}}function bl(i,t){i&1&&C(0,"nile-spinner",314)}function vl(i,t){if(i&1&&C(0,"nile-glyph",319),i&2){let e=r().$implicit,n=r(11);b("name",n.chartTypeIcon(e.type))}}function wl(i,t){if(i&1){let e=k();s(0,"button",318),u("click",function(){let o=_(e).$implicit,a=r(11);return g(a.selectInlineChartType(o.component))}),m(1,bl,1,0,"nile-spinner",314)(2,vl,1,1,"nile-glyph",319),s(3,"span"),c(4),d()()}if(i&2){let e=t.$implicit,n=r(11);M("disabled",n.inlineChartTypeApplying()?"":null),l(),h(n.inlineChartTypeApplyingComponent()===e.component?1:2),l(3),y(e.label)}}function kl(i,t){if(i&1&&(s(0,"p",315),c(1,"Recommended"),d(),s(2,"div",316),F(3,wl,5,3,"button",317,Ii),d()),i&2){let e=r(10);l(3),O(e.inlineSensibleChartTypes())}}function Pl(i,t){i&1&&C(0,"nile-spinner",314)}function Al(i,t){if(i&1&&C(0,"nile-glyph",319),i&2){let e=r().$implicit,n=r(11);b("name",n.chartTypeIcon(e.type))}}function Ml(i,t){if(i&1){let e=k();s(0,"button",321),u("click",function(){let o=_(e).$implicit,a=r(11);return g(a.selectInlineChartType(o.component))}),m(1,Pl,1,0,"nile-spinner",314)(2,Al,1,1,"nile-glyph",319),s(3,"span"),c(4),d()()}if(i&2){let e=t.$implicit,n=r(11);M("disabled",n.inlineChartTypeApplying()?"":null),l(),h(n.inlineChartTypeApplyingComponent()===e.component?1:2),l(3),y(e.label)}}function Sl(i,t){if(i&1&&(s(0,"p",315),c(1,"Other types"),d(),s(2,"div",316),F(3,Ml,5,3,"button",320,Ii),d()),i&2){let e=r(10);l(3),O(e.inlineOtherChartTypes())}}function Tl(i,t){if(i&1&&(m(0,kl,5,0),m(1,Sl,5,0)),i&2){let e=r(9);h(e.inlineSensibleChartTypes().length>0?0:-1),l(),h(e.inlineOtherChartTypes().length>0?1:-1)}}function ql(i,t){if(i&1&&(s(0,"p",313),c(1),d()),i&2){let e=r(9);l(),y(e.inlineChartTypeError())}}function Dl(i,t){if(i&1){let e=k();s(0,"nile-dropdown",308),u("nile-hide",function(){_(e);let o=r(8);return g(o.closeInlineChartTypePicker())}),C(1,"span",309),s(2,"div",310),m(3,xl,4,0,"div",311)(4,yl,2,1,"p",312)(5,Tl,2,2),m(6,ql,2,1,"p",313),d()()}if(i&2){let e=r(4).$implicit,n=r(4);b("open",n.inlineChartTypePickerFor()===e.charts[0]),l(3),h(n.inlineChartTypeLoading()?3:n.inlineChartTypeOptions().length===0?4:5),l(3),h(n.inlineChartTypeError()?6:-1)}}function Fl(i,t){if(i&1){let e=k();s(0,"span",324),c(1),s(2,"button",325),u("click",function(){let o=_(e).$implicit,a=r(6).$implicit,p=r(4);return g(p.removeInlineFilter(a.charts[0],o.id))}),C(3,"nile-glyph",326),d()()}if(i&2){let e=t.$implicit,n=r(6).$implicit,o=r(4);l(),q(" ",o.inlineFilterChipLabel(n.charts[0],e)," "),l(),M("disabled",o.inlineFilterApplying()?"":null)}}function Ol(i,t){if(i&1&&(s(0,"div",323),F(1,Fl,4,2,"span",324,te),d()),i&2){let e=r(5).$implicit,n=r(4);l(),O(n.inlineActiveFilters(e.charts[0]))}}function El(i,t){i&1&&(s(0,"div",311),C(1,"nile-spinner",314),s(2,"span"),c(3,"Loading filterable fields\u2026"),d()())}function Il(i,t){if(i&1&&(s(0,"p",313),c(1),d()),i&2){let e=r(9);l(),y(e.inlineFilterFieldsError())}}function Vl(i,t){if(i&1&&(s(0,"p",312),c(1),d()),i&2){let e=r(9);l(),y(e.copy().noFilterableFields)}}function Rl(i,t){if(i&1&&(s(0,"option",329),c(1),d()),i&2){let e=t.$implicit;b("value",e.name),l(),y(e.label)}}function zl(i,t){if(i&1&&(s(0,"option",329),c(1),d()),i&2){let e=t.$implicit;b("value",e.value),l(),y(e.label)}}function Nl(i,t){i&1&&(s(0,"div",311),C(1,"nile-spinner",330),s(2,"span"),c(3,"Loading values\u2026"),d()())}function Ll(i,t){if(i&1){let e=k();s(0,"input",334),u("ngModelChange",function(o){_(e);let a=r(11);return g(a.inlineFilterBuilderValue.set(o))})("keydown.enter",function(){_(e);let o=r(7).$implicit,a=r(4);return g(a.addInlineFilter(o.charts[0]))}),d()}if(i&2){let e=r(11);b("placeholder",e.copy().filterValuePlaceholder)("ngModel",e.inlineFilterBuilderValue())}}function $l(i,t){if(i&1){let e=k();s(0,"span",336),c(1,"and"),d(),s(2,"input",335),u("ngModelChange",function(o){_(e);let a=r(12);return g(a.inlineFilterBuilderValue2.set(o))}),d()}if(i&2){let e=r(12);l(2),b("ngModel",e.inlineFilterBuilderValue2())}}function Wl(i,t){if(i&1){let e=k();s(0,"input",335),u("ngModelChange",function(o){_(e);let a=r(11);return g(a.inlineFilterBuilderValue.set(o))}),d(),m(1,$l,3,1)}if(i&2){let e,n=r(7).$implicit,o=r(4);b("ngModel",o.inlineFilterBuilderValue()),l(),h((e=o.inlineFilterSelectedOperator(n.charts[0]))!=null&&e.needsSecondValue?1:-1)}}function Bl(i,t){if(i&1){let e=k();s(0,"span",336),c(1,"and"),d(),s(2,"input",338),u("ngModelChange",function(o){_(e);let a=r(12);return g(a.inlineFilterBuilderValue2.set(o))}),d()}if(i&2){let e=r(12);l(2),b("placeholder",e.copy().filterValuePlaceholder)("ngModel",e.inlineFilterBuilderValue2())}}function Ul(i,t){if(i&1){let e=k();s(0,"input",337),u("ngModelChange",function(o){_(e);let a=r(11);return g(a.inlineFilterBuilderValue.set(o))})("keydown.enter",function(){_(e);let o=r(7).$implicit,a=r(4);return g(a.addInlineFilter(o.charts[0]))}),d(),m(1,Bl,3,2)}if(i&2){let e,n=r(7).$implicit,o=r(4);b("placeholder",o.copy().filterValuePlaceholder)("ngModel",o.inlineFilterBuilderValue()),l(),h((e=o.inlineFilterSelectedOperator(n.charts[0]))!=null&&e.needsSecondValue?1:-1)}}function Gl(i,t){if(i&1){let e=k();s(0,"label",339)(1,"input",340),u("change",function(){let o=_(e).$implicit,a=r(12);return g(a.toggleInlineFilterMultiValue(o.value))}),d(),s(2,"span"),c(3),d()()}if(i&2){let e=t.$implicit,n=r(12);l(),b("checked",n.inlineFilterBuilderValues().includes(e.value)),l(2),Y("",e.label,"",e.count!=null?" ("+e.count+")":"")}}function jl(i,t){if(i&1&&(s(0,"div",332),F(1,Gl,4,3,"label",339,nt),d()),i&2){let e=r(11);l(),O(e.inlineFilterValuesFor(e.inlineFilterBuilderFieldId()))}}function Hl(i,t){if(i&1&&(s(0,"option",329),c(1),d()),i&2){let e=t.$implicit;b("value",e.value),l(),Y("",e.label,"",e.count!=null?" ("+e.count+")":"")}}function Yl(i,t){if(i&1){let e=k();s(0,"select",328),u("ngModelChange",function(o){_(e);let a=r(11);return g(a.inlineFilterBuilderValue.set(o))}),s(1,"option",341),c(2,"Select\u2026"),d(),F(3,Hl,2,3,"option",329,nt),d()}if(i&2){let e=r(11);b("ngModel",e.inlineFilterBuilderValue()),l(3),O(e.inlineFilterValuesFor(e.inlineFilterBuilderFieldId()))}}function Kl(i,t){if(i&1&&m(0,Ll,1,2,"input",331)(1,Wl,2,2)(2,Ul,2,3)(3,jl,3,0,"div",332)(4,Yl,5,1,"select",333),i&2){let e,n=r(6).$implicit,o=r(4);h((e=(e=o.inlineFilterSelectedOperator(n.charts[0]))==null?null:e.valueKind)==="text"?0:e==="date"?1:e==="number"?2:e==="multi-select"?3:e==="select"?4:-1)}}function Ql(i,t){if(i&1&&(s(0,"p",313),c(1),d()),i&2){let e=r(10);l(),y(e.inlineFilterApplyError())}}function Xl(i,t){if(i&1){let e=k();s(0,"div",327)(1,"select",328),u("ngModelChange",function(o){_(e);let a=r(5).$implicit,p=r(4);return g(p.onInlineFilterFieldChange(a.charts[0],o))}),F(2,Rl,2,2,"option",329,qo),d(),s(4,"select",328),u("ngModelChange",function(o){_(e);let a=r(9);return g(a.onInlineFilterOperatorChange(o))}),F(5,zl,2,2,"option",329,nt),d(),m(7,Nl,4,0,"div",311)(8,Kl,5,1),s(9,"nile-button",21),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.addInlineFilter(o.charts[0]))}),c(10," Add filter "),d()(),m(11,Ql,2,1,"p",313)}if(i&2){let e=r(5).$implicit,n=r(4);l(),b("ngModel",n.inlineFilterBuilderFieldId()),l(),O(n.inlineFilterFields(e.charts[0])),l(2),b("ngModel",n.inlineFilterBuilderOperator()),l(),O(n.inlineFilterOperators(e.charts[0])),l(2),h(n.inlineFilterValuesLoading()?7:8),l(2),M("loading",n.inlineFilterApplying()?"":null)("disabled",n.inlineFilterApplying()?"":null),l(2),h(n.inlineFilterApplyError()?11:-1)}}function Jl(i,t){if(i&1){let e=k();s(0,"nile-dropdown",308),u("nile-hide",function(){_(e);let o=r(8);return g(o.closeInlineFilterBuilder())}),C(1,"span",309),s(2,"div",322)(3,"p",312),c(4,"Filters this preview only \u2014 nothing is saved."),d(),m(5,Ol,3,0,"div",323),m(6,El,4,0,"div",311)(7,Il,2,1,"p",313)(8,Vl,2,1,"p",312)(9,Xl,12,6),d()()}if(i&2){let e=r(4).$implicit,n=r(4);b("open",n.inlineFilterPickerFor()===e.charts[0]),l(5),h(n.inlineActiveFilters(e.charts[0]).length>0?5:-1),l(),h(n.inlineFilterFieldsLoading()?6:n.inlineFilterFieldsError()?7:n.inlineFilterFields(e.charts[0]).length===0?8:9)}}function Zl(i,t){if(i&1&&(s(0,"span",342)(1,"span",343),c(2),d(),s(3,"span",344),c(4),d()()),i&2){let e=t.$implicit;l(2),q("",e.label,":"),l(2),y(e.value)}}function es(i,t){if(i&1&&(s(0,"div",298),F(1,Zl,5,2,"span",342,Ei),d()),i&2){let e=r(4).$implicit;l(),O(e.forecastMeta??pe(0,Se))}}function ts(i,t){if(i&1){let e=k();s(0,"nile-button",345),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.tryAlternatePreview(o.charts[0]))}),c(1),d()}if(i&2){let e=r(5).$implicit,n=r(4);b("disabled",n.isStreaming()),l(),q(' Try "',n.previewAltLabel(e.charts[0]),'" instead ')}}function ns(i,t){if(i&1){let e=k();s(0,"nile-button",345),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.skipPreview(o.charts[0]))}),c(1," Skip this widget "),d(),m(2,ts,2,2,"nile-button",346),s(3,"nile-button",347),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.acceptPreview(o.charts[0]))}),C(4,"nile-glyph",160),c(5," Add to dashboard "),d()}if(i&2){let e=r(4).$implicit,n=r(4);b("disabled",n.isStreaming()),l(2),h(n.previewAltLabel(e.charts[0])?2:-1),l(),b("disabled",n.isStreaming())}}function is(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(10);l(),y(e.copy().noResultsMatchFilters)}}function os(i,t){i&1&&fe(0)}function as(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(8).$implicit,p=r(4);return g(p.addInlineToExisting(a.charts,o.id))}),ke(1,os,1,0,"ng-container",353),d()}if(i&2){let e=t.$implicit;r(12);let n=de(40);l(),b("ngTemplateOutlet",n)("ngTemplateOutletContext",rt(2,Oi,e))}}function rs(i,t){if(i&1&&(s(0,"div",80),c(1),d(),F(2,as,2,4,"nile-menu-item",null,te)),i&2){let e=t.$implicit;l(),y(e.label),l(),O(e.items)}}function ls(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(11);l(),y(e.copy().noDashboardsYet)}}function ss(i,t){if(i&1&&F(0,rs,4,1,null,null,se,!1,ls,2,1,"div",46),i&2){let e=r(10);O(e.groupedPickerDashboards())}}function ds(i,t){if(i&1){let e=k();s(0,"nile-dropdown",351),u("nile-hide",function(){_(e);let o=r(9);return g(o.inlinePickerFor.set(null))}),s(1,"nile-button",352),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.inlinePickerFor.set(a.inlinePickerFor()===o.id?null:o.id))}),C(2,"nile-glyph",160),c(3),d(),s(4,"nile-menu",43),u("nile-search-value",function(o){_(e);let a=r(9);return g(a.pickerSearch.set((o.detail==null?null:o.detail.value)??""))}),s(5,"nile-menu-item",44),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.addInlineWidget(o.charts))}),C(6,"nile-glyph",45),c(7),d(),m(8,is,2,1,"div",46)(9,ss,3,1),d()()}if(i&2){let e=r(5).$implicit,n=r(4);b("open",n.inlinePickerFor()===e.id),l(),M("loading",n.committingAction()==="add"?"":null)("disabled",n.committingAction()?"":null),l(2),q(" ",n.copy().addToDashboardButton," "),l(),M("noResultsMessage",n.copy().noResultsMatchFilters),l(3),q(" ",n.copy().newDashboardLabel," "),l(),h(n.pickerSearchEmpty()?8:9)}}function cs(i,t){if(i&1){let e=k();s(0,"nile-button",22),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.addInlineDefault(o.charts))}),C(1,"nile-glyph",160),c(2),d()}if(i&2){let e=r(9);M("loading",e.committingAction()==="add"?"":null)("disabled",e.committingAction()?"":null),l(2),q(" ",e.builderOpen()?e.copy().addToCurrentDashboardButton:e.copy().addToDashboardButton," ")}}function ps(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.addToLibrary(o.charts[0]))}),C(1,"nile-glyph",348),c(2),d(),m(3,ds,10,7,"nile-dropdown",349)(4,cs,3,3,"nile-button",350)}if(i&2){let e=r(8);l(2),q(" ",e.copy().addToLibraryButton," "),l(),h(!e.builderOpen()&&e.conversationDashboards().length>1?3:4)}}function _s(i,t){if(i&1){let e=k();s(0,"div",261)(1,"div")(2,"shared-nile-chart-widget",293),u("aiSend",function(o){_(e);let a=r(7);return g(a.onInlineAiSend(o))}),m(3,gl,3,0,"span",294),m(4,ul,2,0,"span",295),m(5,fl,7,0,"nile-dropdown",296),m(6,Dl,7,3,"nile-dropdown",297),m(7,Jl,10,3,"nile-dropdown",297),d()(),m(8,es,3,1,"div",298),s(9,"div",299),m(10,ns,6,3)(11,ps,5,2),d()()}if(i&2){let e=r(3).$implicit,n=r(4);l(),at(n.inlineChartClass(e.charts[0])),l(),b("config",n.inlineDisplayConfig(e.charts[0]))("loading",!!e.forecastRecomputing||n.isInlineRecordsLoading(e.charts[0]))("widgetId",e.id)("conversationId",n.activeConversationId()),l(),h(e.forecast?3:-1),l(),h(n.isPreviewChart(e.charts[0])?4:-1),l(),h(n.inlineWidgetMenuItems(e).length?5:-1),l(),h(n.isFilterChart(e.charts[0])?-1:6),l(),h(n.isFilterChart(e.charts[0])?-1:7),l(),h(e.forecastMeta!=null&&e.forecastMeta.length?8:-1),l(2),h(n.isPreviewChart(e.charts[0])?10:11)}}function gs(i,t){i&1&&(s(0,"span",295),c(1,"Preview"),d(),c(2," \xB7 "))}function us(i,t){if(i&1){let e=k();s(0,"nile-button",345),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.tryAlternatePreview(o.charts[0]))}),c(1),d()}if(i&2){let e=r(5).$implicit,n=r(4);b("disabled",n.isStreaming()),l(),q(' Try "',n.previewAltLabel(e.charts[0]),'" instead ')}}function ms(i,t){if(i&1){let e=k();s(0,"div",299)(1,"nile-button",345),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.skipPreview(o.charts[0]))}),c(2," Skip this widget "),d(),m(3,us,2,2,"nile-button",346),s(4,"nile-button",347),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.acceptPreview(o.charts[0]))}),C(5,"nile-glyph",160),c(6," Add to dashboard "),d()()}if(i&2){let e=r(4).$implicit,n=r(4);l(),b("disabled",n.isStreaming()),l(2),h(n.previewAltLabel(e.charts[0])?3:-1),l(),b("disabled",n.isStreaming())}}function hs(i,t){if(i&1){let e=k();s(0,"div",354),u("click",function(){_(e);let o=r(3).$implicit,a=r(4);return g(a.openArtifact(o.charts,o.id))}),s(1,"div",355),C(2,"nile-glyph",356),d(),s(3,"div",357)(4,"span",358),c(5),d(),s(6,"span",359),m(7,gs,3,0),c(8),d()(),s(9,"nile-button",22),u("click",function(o){_(e);let a=r(3).$implicit,p=r(4);return o.stopPropagation(),g(p.openArtifact(a.charts,a.id))}),c(10),C(11,"nile-glyph",360),d()(),m(12,ms,7,3,"div",299)}if(i&2){let e=r(3).$implicit,n=r(4);l(5),y(e.dashboardTitle||e.charts[0].title),l(2),h(n.isPreviewChart(e.charts[0])?7:-1),l(),Y(" Dashboard \xB7 ",e.charts.length," widget",e.charts.length!==1?"s":""," "),l(2),q(" ",n.copy().viewButton," "),l(2),h(e.charts.length===1&&n.isPreviewChart(e.charts[0])?12:-1)}}function Cs(i,t){if(i&1){let e=k();s(0,"div",262),C(1,"nile-glyph",361),s(2,"span",362),c(3),d(),s(4,"button",363),u("click",function(){_(e);let o=r(3).$implicit,a=r(4);return g(a.recomputeStoredForecast(o))}),c(5),d()()}if(i&2){let e=r(3).$implicit,n=r(4);l(3),y(n.restoredForecastLabel(e)),l(),b("disabled",n.isStreaming()),l(),q(" ",n.copy().recomputeButton," ")}}function fs(i,t){if(i&1&&C(0,"nile-glyph",366),i&2){let e=r().$implicit;M("name",e.icon)("color",e.tone==="ai"?"#7a5af8":"var(--ng-colors-text-quaternary-500)")}}function xs(i,t){if(i&1&&(s(0,"span",368),c(1),d()),i&2){let e=r().$implicit;l(),y(e.badge)}}function ys(i,t){if(i&1){let e=k();s(0,"button",365),u("click",function(){let o=_(e).$implicit,a=r(4).$implicit,p=r(4);return g(p.onFollowUp(o,a))}),m(1,fs,1,2,"nile-glyph",366),s(2,"span",367),c(3),d(),m(4,xs,2,1,"span",368),d()}if(i&2){let e=t.$implicit,n=r(8);W("follow-up--ai",e.tone==="ai"),b("disabled",n.isStreaming()),l(),h(e.icon?1:-1),l(2),y(e.label),l(),h(e.badge?4:-1)}}function bs(i,t){if(i&1&&(s(0,"div",263),F(1,ys,5,6,"button",364,Do),d()),i&2){let e=r(3).$implicit;l(),O(e.followUps??pe(0,Se))}}function vs(i,t){if(i&1&&(s(0,"div",264),C(1,"nile-glyph",369),s(2,"span",370),c(3),d()()),i&2){let e=r(7);l(3),y(e.copy().errors.assistantErrorFallback)}}function ws(i,t){if(i&1&&(s(0,"nile-ai-chat-bubble",257)(1,"div",258),m(2,Yr,2,1),F(3,pl,5,3,"div",259,G),m(5,_l,2,4,"button",260),m(6,_s,12,13,"div",261)(7,hs,13,6),m(8,Cs,6,3,"div",262),m(9,bs,3,1,"div",263),m(10,vs,4,1,"div",264),d()()),i&2){let e=r(2).$implicit,n=r(4);b("role","ai")("hideIcon",!0),l(2),h(e.text&&!n.suppressTextFor(e)?2:-1),l(),O(n.nonPanelChoices(e)),l(2),h(n.isMultiChoice(e)&&n.isChoicePanelDismissed(e)&&!n.isChoicePanelComplete(e.choices??pe(8,Se))?5:-1),l(),h(e.charts.length===1&&!n.isDataGrid(e.charts[0])?6:e.charts.length?7:-1),l(2),h(n.isRestoredForecast(e)?8:-1),l(),h(e.followUps!=null&&e.followUps.length?9:-1),l(),h(e.hasError?10:-1)}}function ks(i,t){if(i&1&&(m(0,Gr,1,1,"nile-ai-steps",256),m(1,ws,11,9,"nile-ai-chat-bubble",257)),i&2){let e=r().$implicit;h(e.isStreaming&&(e.tools!=null&&e.tools.length)?0:-1),l(),h(e.text||e.charts.length||e.choices!=null&&e.choices.length||e.hasError?1:-1)}}function Ps(i,t){if(i&1&&(m(0,Ur,5,4,"nile-ai-chat-bubble",241),m(1,ks,2,2)),i&2){let e=t.$implicit;h(e.role==="user"?0:-1),l(),h(e.role==="assistant"?1:-1)}}function As(i,t){if(i&1&&F(0,Ps,2,2,null,null,te),i&2){let e=r(3);O(e.messages())}}function Ms(i,t){if(i&1&&(s(0,"span",373),c(1),d()),i&2){let e=r(2);l(),Rt("",t," ",e.index+1," OF ",e.choices.length)}}function Ss(i,t){if(i&1&&(s(0,"span",373),c(1),d()),i&2){let e=r(2);l(),Y("",e.index+1," OF ",e.choices.length)}}function Ts(i,t){i&1&&(s(0,"span",387),c(1),d()),i&2&&(l(),y(t))}function qs(i,t){if(i&1&&(s(0,"span",389),c(1),d()),i&2){let e=r().$implicit;l(),y(e.hint)}}function Ds(i,t){if(i&1){let e=k();s(0,"nile-radio",383),u("click",function(){_(e);let o=r(2),a=r(4);return g(a.onPanelSkip(o.msg))}),s(1,"span",384)(2,"span",385),c(3),d(),s(4,"span",386),m(5,Ts,2,1,"span",387),s(6,"span",388),c(7),d(),m(8,qs,2,1,"span",389),d()()()}if(i&2){let e,n=t.$implicit,o=t.$index,a=r(2),p=r(4);M("name","choice-panel-"+a.msg.id+"-"+a.index)("value",n.id)("checked",(a.choices[a.index].draftSelection||a.choices[a.index].selected)===n.id?"":null)("disabled",p.isStreaming()?"":null),l(3),y(o+1),l(2),h((e=p.optionBadgeText(n))?5:-1,e),l(2),y(p.optionPrimaryText(n)),l(),h(!p.optionBadgeText(n)&&n.hint?8:-1)}}function Fs(i,t){if(i&1){let e=k();s(0,"button",287),u("click",function(){_(e);let o=r(3),a=r(4);return g(a.previewWidget(o.msg,o.choices[o.index]))}),C(1,"nile-glyph",288),c(2),d()}if(i&2){let e=r(3),n=r(4);b("disabled",n.isStreaming()),l(2),q(' Preview "',n.choiceTitle(e.choices[e.index]),'" ')}}function Os(i,t){if(i&1){let e=k();s(0,"button",283),u("click",function(){_(e);let o=r(3),a=r(4);return g(a.requestPlan(o.msg,o.choices[o.index]))}),c(1),d()}if(i&2){let e=r(7);b("disabled",e.isStreaming()),l(),q(" ",e.copy().givePlanButton," ")}}function Es(i,t){if(i&1){let e=k();s(0,"div",281)(1,"button",283),u("click",function(){_(e);let o=r(2),a=r(4);return g(a.openChatDraft(o.msg,o.choices[o.index]))}),C(2,"nile-glyph",286),c(3),d(),m(4,Fs,3,2,"button",285),m(5,Os,2,2,"button",284),s(6,"button",390),u("click",function(){_(e);let o=r(2),a=r(4);return g(a.onPanelSkip(o.msg))}),c(7," Skip "),d()()}if(i&2){let e=r(2),n=r(4);l(),b("disabled",n.isStreaming()),l(2),q(" ",n.copy().somethingElseButton," "),l(),h(e.choices[e.index].kind==="widget_plan"?4:-1),l(),h(e.choices[e.index].kind==="clarification"?5:-1),l(),M("disabled",n.isStreaming()?"":null)}}function Is(i,t){if(i&1){let e=k();s(0,"div",282)(1,"div",290)(2,"nile-input",291),u("nile-input",function(o){_(e);let a=r(2),p=r(4);return g(p.onChatDraftTextChange(a.msg,a.choices[a.index],o.detail.value))})("keydown.enter",function(){_(e);let o=r(2),a=r(4);return g(a.onPanelChatDraftConfirm(o.msg,o.choices[o.index]))}),d(),s(3,"nile-button",22),u("click",function(){_(e);let o=r(2),a=r(4);return g(a.onPanelChatDraftConfirm(o.msg,o.choices[o.index]))}),c(4),d()()()}if(i&2){let e=r(2),n=r(4);l(2),b("value",e.choices[e.index].chatDraftText??""),M("placeholder",n.chatDraftPlaceholderFor(e.choices[e.index]))("disabled",n.isStreaming()?"":null),l(),M("disabled",!(e.choices[e.index].chatDraftText!=null&&e.choices[e.index].chatDraftText.trim())||n.isStreaming()?"":null),l(),q(" ",n.copy().defineItButton," ")}}function Vs(i,t){if(i&1){let e=k();s(0,"div",372),m(1,Ms,2,3,"span",373)(2,Ss,2,2,"span",373),s(3,"div",374)(4,"button",375),u("click",function(){_(e);let o=r(),a=r(4);return g(a.onPanelPrev(o.msg))}),C(5,"nile-glyph",376),d(),s(6,"button",375),u("click",function(){_(e);let o=r(),a=r(4);return g(a.onPanelSkip(o.msg))}),C(7,"nile-glyph",377),d(),s(8,"button",378),u("click",function(){_(e);let o=r(),a=r(4);return g(a.dismissChoicePanel(o.msg))}),C(9,"nile-glyph",379),d()()(),s(10,"nile-radio-group",380),u("nile-change",function(o){_(e);let a=r(),p=r(4);return g(p.onChoiceChange(a.msg,a.choices[a.index],o.detail.value))}),F(11,Ds,9,8,"nile-radio",381,te),d(),m(13,Es,8,5,"div",281)(14,Is,5,5,"div",282),s(15,"p",382),c(16,"\u2191\u2193 to navigate \xB7 \u21B5 to select \xB7 or type below"),d()}if(i&2){let e,n=r(),o=r(4);l(),h((e=o.panelBadgeLabel(n.choices[n.index]))?1:2,e),l(3),M("disabled",n.index===0?"":null),l(2),M("disabled",o.isStreaming()?"":null),l(4),M("label",n.choices[n.index].prompt||"Choose an option")("name","choice-panel-"+n.msg.id+"-"+n.index)("value",n.choices[n.index].draftSelection||n.choices[n.index].selected||null)("disabled",o.isStreaming()?"":null),l(),O(n.choices[n.index].options),l(2),h(n.choices[n.index].chatOpen?14:13)}}function Rs(i,t){if(i&1&&(s(0,"li",392)(1,"span",394),c(2),d(),s(3,"span",395),c(4),d()()),i&2){let e=t.$implicit,n=r(6);l(2),y(n.choiceTitle(e)),l(2),y(n.panelAnswerLabel(e))}}function zs(i,t){if(i&1){let e=k();s(0,"div",372)(1,"span",373),c(2,"READY TO SUBMIT"),d(),s(3,"button",378),u("click",function(){_(e);let o=r(),a=r(4);return g(a.dismissChoicePanel(o.msg))}),C(4,"nile-glyph",379),d()(),s(5,"ul",391),F(6,Rs,5,2,"li",392,G),d(),s(8,"div",393)(9,"button",375),u("click",function(){_(e);let o=r(),a=r(4);return g(a.onPanelPrev(o.msg))}),C(10,"nile-glyph",376),c(11," Back "),d(),s(12,"nile-button",22),u("click",function(){_(e);let o=r(),a=r(4);return g(a.submitChoices(o.msg))}),c(13),d()()}if(i&2){let e=r(),n=r(4);l(6),O(e.choices),l(6),M("disabled",!n.hasPendingDraft(e.msg)||n.isStreaming()?"":null),l(),q(" ",n.copy().submitAnswersButton," ")}}function Ns(i,t){if(i&1&&(s(0,"div",371),m(1,Vs,17,8)(2,zs,14,2),d()),i&2){let e=t;l(),h(e.index<e.choices.length?1:2)}}function Ls(i,t){if(i&1&&(s(0,"div",231),m(1,Ns,3,1,"div",371),fe(2,214),d()),i&2){let e,n=r(3),o=de(8);l(),h((e=n.activeChoicePanel())?1:-1,e),l(),b("ngTemplateOutlet",o)}}function $s(i,t){if(i&1){let e=k();s(0,"nile-ai-chat",230,3),u("mouseup",function(o){_(e);let a=r(2);return g(a.onThreadMouseUp(o))}),m(2,Vr,11,0)(3,As,2,0),m(4,Ls,3,2,"div",231),d()}if(i&2){let e=r(2);l(2),h(e.loadingConversation()?2:3),l(2),h(e.messages().length?4:-1)}}function Ws(i,t){if(i&1&&m(0,Ir,12,4,"div",206)(1,$s,5,2,"nile-ai-chat",207),i&2){let e=r();h(!e.loadingConversation()&&!e.messages().length?0:1)}}function Bs(i,t){if(i&1&&(s(0,"div",397),C(1,"nile-glyph",404),s(2,"span"),c(3),d()()),i&2){let e=r(2);l(3),y(e.copy().dropFilesOverlay)}}function Us(i,t){if(i&1){let e=k();s(0,"div",398),C(1,"nile-glyph",33),s(2,"span",405),c(3),d(),s(4,"button",406),u("click",function(){_(e);let o=r(2);return g(o.clearReplyQuote())}),C(5,"nile-glyph",407),d()()}i&2&&(l(3),y(t))}function Gs(i,t){i&1&&C(0,"nile-spinner",410)}function js(i,t){if(i&1){let e=k();s(0,"button",413),u("click",function(){_(e);let o=r().$implicit,a=r(3);return g(a.retryAttachment(o.id))}),c(1,"Retry"),d()}}function Hs(i,t){if(i&1){let e=k();s(0,"div",409),C(1,"nile-glyph",254),s(2,"span",255),c(3),d(),m(4,Gs,1,0,"nile-spinner",410)(5,js,2,0,"button",411),s(6,"button",412),u("click",function(){let o=_(e).$implicit,a=r(3);return g(a.removeAttachment(o.id))}),C(7,"nile-glyph",407),d()()}if(i&2){let e=t.$implicit;W("aq-chip--error",e.status==="error"),l(),M("name",e.contentType.startsWith("image/")?"ng-image-03":"ng-file-06"),l(),M("title",e.name),l(),y(e.name),l(),h(e.status==="uploading"?4:e.status==="error"?5:-1)}}function Ys(i,t){if(i&1&&(s(0,"div",399),F(1,Hs,8,6,"div",408,te),d()),i&2){let e=r(2);l(),O(e.attachments())}}function Ks(i,t){if(i&1){let e=k();s(0,"nile-button",414),u("click",function(){_(e),r();let o=de(5);return g(o.click())}),C(1,"nile-glyph",415),d()}if(i&2){let e=r(2);M("disabled",e.isStreaming()||e.attachAtCapacity()?"":null)}}function Qs(i,t){if(i&1){let e=k();s(0,"div",396),u("dragenter",function(o){_(e);let a=r();return g(a.onComposerDragEnter(o))})("dragover",function(o){_(e);let a=r();return g(a.onComposerDragOver(o))})("dragleave",function(o){_(e);let a=r();return g(a.onComposerDragLeave(o))})("drop",function(o){_(e);let a=r();return g(a.onComposerDrop(o))}),m(1,Bs,4,1,"div",397),m(2,Us,6,1,"div",398),m(3,Ys,3,0,"div",399),s(4,"input",400,5),u("change",function(o){_(e);let a=r();return g(a.onFilesPicked(o))}),d(),s(6,"nile-ai-prompt",401,6),u("keydown",function(o){_(e);let a=r();return g(a.onComposerKeydown(o))})("nile-change",function(o){_(e);let a=r();return g(a.inputText.set((o.detail==null?null:o.detail.value)??""))})("nile-submit",function(o){_(e);let a=r();return g(a.onComposerSubmit(o.detail==null?null:o.detail.value))})("nile-stop",function(){_(e);let o=r();return g(o.stopStream())}),s(8,"div",402),u("click",function(o){return o.stopPropagation()}),m(9,Ks,2,1,"nile-button",403),d()()()}if(i&2){let e,n=r();W("aq-composer-wrap--dragover",n.isDraggingFile()),l(),h(n.features().attachments&&n.isDraggingFile()?1:-1),l(),h((e=n.replyQuote())?2:-1,e),l(),h(n.features().attachments&&n.attachments().length?3:-1),l(),M("accept",n.acceptUploadTypes),l(2),W("aq-attach-full",n.attachAtCapacity()),b("placeholder",n.copy().composerPlaceholder)("hideModel",!0)("hideAddContext",!0)("rows",1)("speechLang","en-US")("value",n.inputText())("loading",n.isStreaming()),l(3),h(n.features().attachments?9:-1)}}function Xs(i,t){if(i&1){let e=k();s(0,"div",416),u("pointerdown",function(o){_(e);let a=r();return g(a.startChatResize(o))}),d()}if(i&2){let e=r();W("is-active",e.isResizing())}}function Js(i,t){if(i&1){let e=k();s(0,"div",432),C(1,"nile-glyph",433),s(2,"nile-slide-toggle",434),u("nile-change",function(o){_(e);let a=r(3);return g(a.onFiltersToggle(o.detail.checked))}),d()()}if(i&2){let e=r(3);W("aq-filters-pill--active",e.artifactHasFilter()),l(2),b("isChecked",e.artifactHasFilter())}}function Zs(i,t){if(i&1){let e=k();s(0,"div",428)(1,"nile-button",435),u("click",function(){_(e);let o=r(3);return g(o.undoCanvas())}),C(2,"nile-glyph",436),c(3," Undo "),d(),s(4,"nile-button",437),u("click",function(){_(e);let o=r(3);return g(o.redoCanvas())}),C(5,"nile-glyph",438),d()()}if(i&2){let e=r(3);l(),M("disabled",e.canUndoCanvas()?null:""),l(3),M("disabled",e.canRedoCanvas()?null:""),l(),M("color",e.canRedoCanvas()?"var(--ng-colors-text-secondary-700)":"var(--ng-colors-text-placeholder-subtle)")}}function ed(i,t){if(i&1){let e=k();s(0,"div",418)(1,"div",423)(2,"span",424),c(3,"Preview"),d(),s(4,"span",425),c(5),d()(),s(6,"div",426),m(7,Js,3,3,"div",427),m(8,Zs,6,3,"div",428),C(9,"span",429),s(10,"nile-button",430),u("click",function(){_(e);let o=r(2);return g(o.closeArtifact())}),C(11,"nile-glyph",431),d()()()}if(i&2){let e=r(2);l(5),y(e.artifactSubtitle()),l(2),h(e.features().canvas.filters?7:-1),l(),h(e.features().canvas.undoRedo?8:-1)}}function td(i,t){if(i&1&&(s(0,"div",420),C(1,"nile-glyph",439),s(2,"p",440),c(3),d(),s(4,"p",441),c(5),d()()),i&2){let e=r(2);l(3),y(e.copy().emptyCanvasTitle),l(2),y(e.copy().emptyCanvasSubtitle)}}function nd(i,t){if(i&1){let e=k();s(0,"shared-dashboard-grid",442,7),u("selectionChange",function(o){_(e);let a=r(2);return g(a.onSelectionChange(o))})("forecast",function(o){_(e);let a=r(2);return g(a.onArtifactForecast(o))})("setAlert",function(o){_(e);let a=r(2);return g(a.onSetAlert(o))})("filterSubmit",function(o){_(e);let a=r(2);return g(a.onArtifactFilterSubmit(o))})("filterChange",function(o){_(e);let a=r(2);return g(a.onArtifactFilterChange(o))})("dslWidgetUpdated",function(o){_(e);let a=r(2);return g(a.onDslWidgetUpdated(o))})("dslEditorClosed",function(){_(e);let o=r(2);return g(o.onArtifactDslEditorClosed())})("widgetClick",function(o){_(e);let a=r(2);return g(a.onKpiWidgetClicked(o))})("aiSend",function(o){_(e);let a=r(2);return g(a.onArtifactAiSend(o))}),d()}if(i&2){let e=r(2);b("widgets",e.artifactWidgets())("filtersEnabled",!!e.builderDashboardId())("conversationId",e.activeConversationId())("editMode",!1)("selectable",e.features().canvas.widgetSelection)("canSetAlert",!0)("canAddToStory",e.widgetMenu().addToStory)("canForecast",!0)("showWidgetMenu",e.widgetMenu().enabled)("canAsk",e.widgetMenu().ask)("canChangeChartType",e.widgetMenu().changeChartType)("canManageFilters",e.widgetMenu().manageFilters)("canCustomizeColors",e.widgetMenu().customizeColors)("canViewChartData",e.widgetMenu().chartData)("canExportPng",e.widgetMenu().exportPng)("canExportCsv",e.widgetMenu().exportCsv)("canPrint",e.widgetMenu().print)("forecastable",e.artifactForecastable())("forecastingWidgetId",e.artifactForecastingId())("showEditDslInViewMode",!0)("widgetsLoading",e.applyingFilters())("dashboardFilters",e.activeDashboardFilters())("resolvedFilters",e.activeResolvedFilters())("applySummary",e.applySummary())("filterExplanation",e.filterExplanation())("detailPanel",!0)("detailRootLabel","Canvas")}}function id(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){let o=_(e),a=r(3);return g(a.forecastFromChart(o))}),C(1,"nile-glyph",444),c(2),d()}if(i&2){let e=r(3);l(2),q(" ",e.copy().forecastButton," ")}}function od(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.openStoryPicker())}),C(1,"nile-glyph",445),c(2),d()}if(i&2){let e=r(3);M("disabled",e.committingAction()||!e.hasSelection()?"":null),l(2),q(" ",e.copy().addToStoryButton," ")}}function ad(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.publishAsNewDashboard())}),c(1),d()}if(i&2){let e=r(3);M("loading",e.committingAction()==="publish"?"":null)("disabled",e.committingAction()||!e.hasSelection()?"":null),l(),q(" ",e.copy().publishAsDashboardButton," ")}}function rd(i,t){}function ld(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(4);l(),y(e.copy().noResultsMatchFilters)}}function sd(i,t){i&1&&fe(0)}function dd(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(6);return a.showAddPicker.set(!1),g(a.addToExistingDashboard(o.id))}),ke(1,sd,1,0,"ng-container",353),d()}if(i&2){let e=t.$implicit;r(6);let n=de(40);l(),b("ngTemplateOutlet",n)("ngTemplateOutletContext",rt(2,Oi,e))}}function cd(i,t){if(i&1&&(s(0,"div",80),c(1),d(),F(2,dd,2,4,"nile-menu-item",null,te)),i&2){let e=t.$implicit;l(),y(e.label),l(),O(e.items)}}function pd(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(5);l(),y(e.copy().noDashboardsYet)}}function _d(i,t){if(i&1&&F(0,cd,4,1,null,null,se,!1,pd,2,1,"div",46),i&2){let e=r(4);O(e.groupedPickerDashboards())}}function gd(i,t){if(i&1){let e=k();s(0,"nile-dropdown",446),u("nile-hide",function(){_(e);let o=r(3);return g(o.showAddPicker.set(!1))}),s(1,"nile-button",352),u("click",function(){_(e);let o=r(3);return g(o.showAddPicker.set(!o.showAddPicker()))}),C(2,"nile-glyph",160),c(3),d(),s(4,"nile-menu",43),u("nile-search-value",function(o){_(e);let a=r(3);return g(a.pickerSearch.set((o.detail==null?null:o.detail.value)??""))}),s(5,"nile-menu-item",44),u("click",function(){_(e);let o=r(3);return o.showAddPicker.set(!1),g(o.addArtifactToDashboard())}),C(6,"nile-glyph",45),c(7),d(),m(8,ld,2,1,"div",46)(9,_d,3,1),d()()}if(i&2){let e=r(3);b("open",e.showAddPicker()),l(),M("loading",e.committingAction()==="add"?"":null)("disabled",e.committingAction()||!e.hasSelection()?"":null),l(2),q(" ",e.copy().addToDashboardButton," "),l(),M("noResultsMessage",e.copy().noResultsMatchFilters),l(3),q(" ",e.copy().newDashboardLabel," "),l(),h(e.pickerSearchEmpty()?8:9)}}function ud(i,t){if(i&1){let e=k();s(0,"nile-button",22),u("click",function(){_(e);let o=r(3);return g(o.addArtifactToDashboard())}),C(1,"nile-glyph",160),c(2),d()}if(i&2){let e=r(3);M("loading",e.committingAction()==="add"?"":null)("disabled",e.committingAction()||!e.hasSelection()?"":null),l(2),q(" ",e.builderOpen()?e.copy().addToCurrentDashboardButton:e.copy().addToDashboardButton," ")}}function md(i,t){if(i&1&&(s(0,"div",422),m(1,id,3,1,"nile-button",205),m(2,od,3,2,"nile-button",205),m(3,ad,2,3,"nile-button",205),m(4,rd,0,0)(5,gd,10,7,"nile-dropdown",443)(6,ud,3,3,"nile-button",350),d()),i&2){let e,n=r(2);l(),h((e=n.artifactForecastMsg())?1:-1,e),l(),h(-1),l(),h(n.features().canvas.publishAsDashboard?3:-1),l(),h(n.features().canvas.addToDashboard?!n.builderOpen()&&n.conversationDashboards().length>1?5:6:4)}}function hd(i,t){if(i&1&&(s(0,"aside",417),m(1,ed,12,3,"div",418),s(2,"div",419),m(3,td,6,2,"div",420)(4,nd,2,27,"shared-dashboard-grid",421),d(),m(5,md,7,4,"div",422),fe(6,214),d()),i&2){let e=r(),n=de(35);W("aq-artifact-pane--dsl-only",e.dslOnlyArtifact()),l(),h(e.dslOnlyArtifact()?-1:1),l(2),h(e.artifactWidgets().length===0?3:4),l(2),h(!e.dslOnlyArtifact()&&e.artifactFooterHasActions()?5:-1),l(),b("ngTemplateOutlet",n)}}function Cd(i,t){i&1&&C(0,"nile-spinner",458)}function fd(i,t){i&1&&C(0,"nile-glyph",459)}function xd(i,t){if(i&1){let e=k();s(0,"input",455),u("input",function(o){_(e);let a=r(2);return g(a.dashboardTitleDraft.set(o.target.value))})("keydown.enter",function(){_(e);let o=r(2);return g(o.commitDashboardTitle())})("keydown.escape",function(){_(e);let o=r(2);return g(o.cancelEditDashboardTitle())}),d(),s(1,"nile-lite-tooltip",456)(2,"button",457),u("click",function(){_(e);let o=r(2);return g(o.commitDashboardTitle())}),m(3,Cd,1,0,"nile-spinner",458)(4,fd,1,0,"nile-glyph",459),d()()}if(i&2){let e=r(2);b("value",e.dashboardTitleDraft()),l(2),b("disabled",e.renamingDashboard()),l(),h(e.renamingDashboard()?3:4)}}function yd(i,t){i&1&&C(0,"nile-skeleton-loader",449)}function bd(i,t){if(i&1){let e=k();s(0,"nile-lite-tooltip",461)(1,"button",462),u("click",function(){_(e);let o=r(3);return g(o.startEditDashboardTitle())}),C(2,"nile-glyph",463),d()()}}function vd(i,t){if(i&1&&(s(0,"span",460),c(1),d(),m(2,bd,3,0,"nile-lite-tooltip",461)),i&2){let e=r(2);l(),y((e.builderRef==null?null:e.builderRef.dashboardName())||"Dashboard"),l(),h(e.builderDashboardId()?2:-1)}}function wd(i,t){if(i&1){let e=k();s(0,"section",17)(1,"header",447)(2,"div",34)(3,"nile-button",430),u("click",function(){_(e);let o=r();return g(o.closeBuilder())}),C(4,"nile-glyph",448),d(),m(5,xd,5,3)(6,yd,1,0,"nile-skeleton-loader",449)(7,vd,3,2),d(),s(8,"div",36)(9,"nile-lite-tooltip",450)(10,"button",451),u("click",function(){_(e);let o=r();return g(o.toggleBuilderFullscreen())}),C(11,"nile-glyph",452),d()(),s(12,"shared-builder-toolbar",453),u("action",function(o){_(e);let a=r();return g(a.onBuilderMenuAction(o))}),d()()(),s(13,"shared-builder-host",454),u("exitBuilder",function(){_(e);let o=r();return g(o.closeBuilder())})("executiveSummary",function(o){_(e);let a=r();return g(a.onExecutiveSummary(o))})("galleryPrompt",function(o){_(e);let a=r();return g(a.inputText.set(o))})("published",function(o){_(e);let a=r();return g(a.onBuilderPublished(o))})("widgetClick",function(o){_(e);let a=r();return g(a.onKpiWidgetClicked(o))}),d(),fe(14,214),d()}if(i&2){let e=r(),n=de(35);l(5),h(e.editingDashboardTitle()?5:e.builderRef!=null&&e.builderRef.loading()?6:7),l(4),b("content",e.builderFullscreen()?"Exit full screen":"Full screen"),l(),M("aria-label",e.builderFullscreen()?"Exit full screen":"Full screen"),l(),M("name",e.builderFullscreen()?"ng-minimize":"ng-maximize"),l(),b("canToggleFilter",!0)("hasFilter",(e.builderRef==null?null:e.builderRef.hasFilter())??!1)("canForecast",!0)("anyForecastOn",(e.builderRef==null?null:e.builderRef.anyForecastOn())??!1)("editMode",(e.builderRef==null?null:e.builderRef.editMode())??!0)("showFullscreen",!1)("fullscreen",e.builderFullscreen())("busy",(e.builderRef==null?null:e.builderRef.isPublishing())??!1)("exporting",(e.builderRef==null?null:e.builderRef.isExporting())??!1)("showPromptGallery",!1)("canPublish",(e.builderRef==null?null:e.builderRef.canPublish())??!0),l(),b("dashboardId",e.builderDashboardId())("preseeded",e.builderPreseeded())("galleryPrompts",e.suggestions())("canAddToStory",e.widgetMenu().addToStory)("showWidgetMenu",e.widgetMenu().enabled)("canAsk",e.widgetMenu().ask)("canChangeChartType",e.widgetMenu().changeChartType)("canManageFilters",e.widgetMenu().manageFilters)("canCustomizeColors",e.widgetMenu().customizeColors)("canViewChartData",e.widgetMenu().chartData)("canExportPng",e.widgetMenu().exportPng)("canExportCsv",e.widgetMenu().exportCsv)("canPrint",e.widgetMenu().print)("canTweak",e.widgetMenu().tweak)("canEdit",e.widgetMenu().edit)("canDelete",e.widgetMenu().delete),l(),b("ngTemplateOutlet",n)}}function kd(i,t){if(i&1){let e=k();s(0,"label",474)(1,"input",475),u("change",function(){let o=_(e).$implicit,a=r(3);return g(a.onGranularityPick(o))}),d(),s(2,"span"),c(3),d()()}if(i&2){let e=t.$implicit,n=r(2);W("fs-segment--on",n.granularity===e.value)("fs-segment--off",!e.enabled),M("title",e.reason||null),l(),b("value",e.value)("checked",n.granularity===e.value)("disabled",!e.enabled),l(2),y(e.value)}}function Pd(i,t){i&1&&(s(0,"p",468),c(1),d()),i&2&&(l(),y(t))}function Ad(i,t){if(i&1&&(s(0,"p",468),c(1),d()),i&2){let e=r();l(),y(e.granularityNote)}}function Md(i,t){if(i&1&&(s(0,"div",464)(1,"span",476),c(2,"Model"),d(),s(3,"div",477)(4,"p",478),c(5),d(),s(6,"p",479),c(7),d()()()),i&2){let e=t;l(5),y(e.title),l(2),y(e.body)}}function Sd(i,t){if(i&1&&(s(0,"div",464)(1,"span",476),c(2,"Guardrails"),d(),s(3,"div",480)(4,"p",478),C(5,"nile-glyph",481),c(6),d(),s(7,"p",479),c(8),d()()()),i&2){let e=t;l(3),W("fs-card--pass",e.passed)("fs-card--warn",!e.passed),l(2),M("name",e.passed?"ng-check":"ng-alert-circle")("color",e.passed?"var(--ng-colors-fg-success-primary)":"var(--ng-colors-fg-warning-primary)"),l(),q(" ",e.title," "),l(2),y(e.body)}}function Td(i,t){if(i&1){let e=k();s(0,"div",464)(1,"label",465),c(2," Horizon \u2014 "),s(3,"span",466),c(4),d()(),s(5,"input",467),u("input",function(o){_(e);let a=r(2);return g(a.onHorizonInput(o.target.value))}),d(),s(6,"p",468),c(7),d()(),s(8,"div",464)(9,"span",469),c(10,"Granularity"),d(),s(11,"div",470),F(12,kd,4,9,"label",471,nt),d(),m(14,Pd,2,1,"p",468)(15,Ad,2,1,"p",468),d(),s(16,"div",464)(17,"label",472),c(18," Confidence interval \u2014 "),s(19,"span",466),c(20),d()(),s(21,"input",473),u("input",function(o){_(e);let a=r(2);return g(a.onConfidenceIndexInput(o.target.value))}),d(),s(22,"p",468),c(23),d()(),m(24,Md,8,2,"div",464),m(25,Sd,9,8,"div",464)}if(i&2){let e,n,o,a=t,p=r(),x=r();l(4),Y("",p.horizon," ",x.horizonUnit()),l(),Z("--fs-fill",x.horizonFill()),b("value",p.horizon),M("max",x.horizonMax())("aria-valuetext",p.horizon+" "+x.horizonUnit()),l(2),y(x.horizonNote()),l(5),O(x.granularityChoices()),l(2),h((e=x.unavailableGranularityNote())?14:15,e),l(6),q("",p.confidence,"%"),l(),Z("--fs-fill",x.confidenceFill()),b("value",x.confidenceIndex()),M("max",a.confidenceLevels.length-1)("aria-valuetext",p.confidence+"%"),l(2),y(a.confidenceNote),l(),h((n=a.modelCard)?24:-1,n),l(),h((o=a.guardrails)?25:-1,o)}}function qd(i,t){if(i&1&&m(0,Td,26,18),i&2){let e,n=r();h((e=n.forecastCopy())?0:-1,e)}}function Dd(i,t){if(i&1&&(s(0,"div",485),C(1,"nile-skeleton-loader",486),s(2,"div",487),C(3,"nile-skeleton-loader",78),d()()),i&2){let e=t.$implicit;l(2),Z("width",e,"px")}}function Fd(i,t){if(i&1&&(s(0,"div",483),F(1,Dd,4,2,"div",485,G),d()),i&2){let e=r(2);l(),O(e.gallerySkeletonRows)}}function Od(i,t){if(i&1){let e=k();s(0,"nile-ai-prompts",488),u("nile-item-click",function(o){_(e);let a=r(2);return g(a.onGalleryPromptPick(o.detail==null?null:o.detail.data))}),d()}if(i&2){let e=r(2);b("items",e.galleryPromptItems())("vertical",!0)("wrap",!0)}}function Ed(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(2);l(),Y("",e.copy().noPromptsMatch,' "',e.gallerySearch(),'".')}}function Id(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(2);l(),y(e.copy().noPromptsYet)}}function Vd(i,t){if(i&1){let e=k();s(0,"nile-input",482),u("nile-input",function(o){_(e);let a=r();return g(a.gallerySearch.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r();return g(a.gallerySearch.set((o.detail==null?null:o.detail.value)??""))}),C(1,"nile-glyph",109),d(),m(2,Fd,3,0,"div",483)(3,Od,1,3,"nile-ai-prompts",484)(4,Ed,2,2,"div",128)(5,Id,2,1,"div",128)}if(i&2){let e=r();b("placeholder",e.copy().promptGallerySearchPlaceholder)("value",e.gallerySearch()),l(2),h(e.suggestionsLoading()?2:e.filteredGalleryPrompts().length?3:e.gallerySearch().trim()?4:5)}}function Rd(i,t){if(i&1&&(s(0,"div",489),c(1),d()),i&2){let e=r(2);l(),y(e.copy().xrayLoadingSources)}}function zd(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(2);l(),y(e.copy().xrayNoSources)}}function Nd(i,t){i&1&&C(0,"nile-glyph",72)}function Ld(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.onXrayDatasetPick(o.datasetId))}),s(1,"span",504),c(2),d(),m(3,Nd,1,0,"nile-glyph",72),d()}if(i&2){let e=t.$implicit,n=r(4);l(2),y(e.label),l(),h(n.xraySelectedDatasetId()===e.datasetId?3:-1)}}function $d(i,t){if(i&1){let e=k();s(0,"nile-dropdown",499),u("nile-hide",function(){_(e);let o=r(3);return g(o.xrayDatasetMenuOpen.set(!1))}),s(1,"button",500),u("click",function(){_(e);let o=r(3);return g(o.xrayDatasetMenuOpen.set(!o.xrayDatasetMenuOpen()))}),C(2,"nile-glyph",501),s(3,"span",502),c(4),d(),C(5,"nile-glyph",503),d(),s(6,"nile-menu"),F(7,Ld,4,2,"nile-menu-item",null,Fo),d()()}if(i&2){let e=r(3);b("open",e.xrayDatasetMenuOpen()),l(4),y(e.xraySelectedDatasetLabel()),l(3),O(e.xrayDatasets())}}function Wd(i,t){if(i&1&&(s(0,"div",496),C(1,"nile-glyph",505),s(2,"span"),c(3),d()()),i&2){let e=r(3);l(3),y(e.xrayError())}}function Bd(i,t){if(i&1&&(s(0,"div",497),C(1,"nile-spinner",506),s(2,"p",507),c(3),d(),s(4,"p",508),c(5),d()()),i&2){let e=r(3);l(3),y(e.xrayStatus()==="analyzing"?e.copy().xrayAnalyzing:e.copy().xrayBuilding),l(2),y(e.xrayRunningEntityLabel())}}function Ud(i,t){if(i&1&&(s(0,"div",509),C(1,"nile-skeleton-loader",486)(2,"nile-skeleton-loader",510),d()),i&2){let e=t.$implicit;l(2),b("width",e)}}function Gd(i,t){if(i&1&&(s(0,"div",498),F(1,Ud,3,1,"div",509,G),d()),i&2){let e=r(3);l(),O(e.xraySkeletonRows)}}function jd(i,t){if(i&1&&(s(0,"span",518),c(1),d()),i&2){let e=r().$implicit;l(),q("",e.schema,".")}}function Hd(i,t){if(i&1&&(s(0,"span",519),c(1),d()),i&2){let e=r().$implicit,n=r(4);l(),Y("",e.fieldCount," ",n.copy().xrayFieldsLabel)}}function Yd(i,t){if(i&1){let e=k();s(0,"button",515),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.runXray(o))}),C(1,"nile-glyph",516),s(2,"span",517),m(3,jd,2,1,"span",518),c(4),d(),m(5,Hd,2,2,"span",519),s(6,"span",520),C(7,"nile-glyph",229),s(8,"span"),c(9),d()()()}if(i&2){let e=t.$implicit,n=r(4);b("disabled",n.xrayRunning())("title",n.xrayEntityLabel(e)),l(),b("name",e.kind==="index"?"ng-layers-three-01":"ng-table"),l(2),h(e.schema?3:-1),l(),q("",e.name," "),l(),h(e.fieldCount?5:-1),l(4),y(n.copy().xrayRunLabel)}}function Kd(i,t){if(i&1&&(s(0,"div",511)(1,"span",512),c(2),d(),s(3,"span",513),c(4),d()(),s(5,"div",498),F(6,Yd,10,7,"button",514,Oo),d()),i&2){let e=r(3);l(2),Y("",e.xrayFilteredEntities().length," ",e.xrayEntityNoun()),l(2),y(e.copy().xrayPickHint),l(2),O(e.xrayFilteredEntities())}}function Qd(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(3);l(),Y("",e.copy().xrayNoEntitiesMatch,' "',e.xrayEntitySearch(),'".')}}function Xd(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(3);l(),y(e.copy().xrayNoEntities)}}function Jd(i,t){if(i&1){let e=k();m(0,$d,9,2,"nile-dropdown",490),s(1,"nile-input",491),u("nile-input",function(o){_(e);let a=r(2);return g(a.xrayEntitySearch.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r(2);return g(a.xrayEntitySearch.set((o.detail==null?null:o.detail.value)??""))}),C(2,"nile-glyph",109),d(),s(3,"details",492)(4,"summary",493),C(5,"nile-glyph",494),s(6,"span"),c(7),d()(),s(8,"nile-input",495),u("nile-input",function(o){_(e);let a=r(2);return g(a.xrayTopic.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r(2);return g(a.xrayTopic.set((o.detail==null?null:o.detail.value)??""))}),d()(),m(9,Wd,4,1,"div",496),m(10,Bd,6,2,"div",497)(11,Gd,3,0,"div",498)(12,Kd,8,3)(13,Qd,2,2,"div",128)(14,Xd,2,1,"div",128)}if(i&2){let e=r(2);h(e.xrayDatasets().length>1?0:-1),l(),b("placeholder",e.copy().xrayEntitySearchPlaceholder)("value",e.xrayEntitySearch()),l(2),b("open",!!e.xrayTopic()),l(4),y(e.copy().xrayFocusToggle),l(),b("placeholder",e.copy().xrayTopicPlaceholder)("value",e.xrayTopic()),l(),h(e.xrayError()?9:-1),l(),h(e.xrayRunning()?10:e.xrayEntitiesLoading()?11:e.xrayFilteredEntities().length?12:e.xrayEntitySearch().trim()?13:14)}}function Zd(i,t){if(i&1&&m(0,Rd,2,1,"div",489)(1,zd,2,1,"div",128)(2,Jd,15,9),i&2){let e=r();h(e.xraySourcesLoading()?0:e.xraySources().length?2:1)}}function ec(i,t){i&1&&(s(0,"nile-breadcrumb-item"),c(1),d()),i&2&&(l(),q(" ",t," "))}function tc(i,t){i&1&&c(0),i&2&&q(" ",t," ")}function nc(i,t){i&1&&C(0,"nile-skeleton-loader",524)}function ic(i,t){if(i&1&&(s(0,"p",526),c(1),d()),i&2){let e=r(3);l(),y(e.cohortDetailCaption())}}function oc(i,t){if(i&1&&C(0,"nile-skeleton-loader",533),i&2){let e=t.$implicit;Z("left",e.x/12*100,"%")("top",e.y*72,"px")("width","calc("+e.w/12*100+"% - 12px)")("height",e.h*72-12,"px")}}function ac(i,t){if(i&1&&(s(0,"div",531),F(1,oc,1,8,"nile-skeleton-loader",532,G),d()),i&2){let e=r(4);Z("height",e.widgetDetailPanelSkeletonHeight(),"px"),l(),O(e.widgetDetailPanelSkeletonSlots())}}function rc(i,t){i&1&&(s(0,"div",530)(1,"div",534),C(2,"nile-skeleton-loader",535)(3,"nile-skeleton-loader",535)(4,"nile-skeleton-loader",535),d(),C(5,"nile-skeleton-loader",536),d())}function lc(i,t){if(i&1&&m(0,ac,3,2,"div",529)(1,rc,6,0,"div",530),i&2){let e=r(3);h(e.widgetDetailPanelSkeletonSlots().length?0:1)}}function sc(i,t){if(i&1){let e=k();s(0,"shared-dashboard-grid",537),u("selectionChange",function(o){_(e);let a=r(3);return g(a.widgetDetailPanelSelectedIds.set(o))}),d()}if(i&2){let e=r(3);b("widgets",e.widgetDetailPanelWidgets())("editMode",!1)("selectable",e.widgetDetailPanelKind()==="dashboard")("selectedWidgetIds",e.widgetDetailPanelSelectedIds())("canSetAlert",!1)("canAddToStory",!1)("canForecast",!1)("showWidgetMenu",!1)}}function dc(i,t){if(i&1){let e=k();s(0,"div",528)(1,"span",538),c(2),d(),s(3,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.toggleSelectAllDetailPanelWidgets())}),c(4),d(),s(5,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.addSelectedDetailPanelWidgetsToCanvas())}),C(6,"nile-glyph",539),c(7),d(),s(8,"nile-button",22),u("click",function(){_(e);let o=r(3);return g(o.replaceCanvasWithDetailPanel())}),C(9,"nile-glyph",540),c(10," Replace canvas "),d()()}if(i&2){let e=r(3);l(2),Y(" ",e.widgetDetailPanelSelectedIds().length," of ",e.widgetDetailPanelWidgets().length," selected "),l(2),q(" ",e.isDetailPanelFullySelected()?"Deselect all":"Select all"," "),l(),M("disabled",e.widgetDetailPanelSelectedIds().length?null:""),l(2),q(" Add ",e.widgetDetailPanelSelectedIds().length," to canvas "),l(),M("disabled",e.widgetDetailPanelWidgets().length?null:"")}}function cc(i,t){if(i&1){let e=k();s(0,"div",528)(1,"nile-button",22),u("click",function(){_(e);let o=r(3);return g(o.exportCohortRowsCsv())}),C(2,"nile-glyph",541),c(3),d(),s(4,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.copyCohortDefinition())}),C(5,"nile-glyph",542),c(6),d()()}if(i&2){let e=r(3);l(),M("disabled",e.detailPanelCohortData()?null:""),l(2),q(" ",e.copy().cohortExportRowsButton," "),l(),M("disabled",e.detailPanelCohortData()?null:""),l(2),q(" ",e.copy().cohortCopyDefinitionButton," ")}}function pc(i,t){if(i&1){let e=k();s(0,"div",528)(1,"nile-button",22),u("click",function(){_(e);let o=r(3);return g(o.addWidgetTemplateFromDetailPanel())}),C(2,"nile-glyph",160),c(3," Add to dashboard "),d()()}}function _c(i,t){if(i&1){let e=k();s(0,"div",521)(1,"div",522)(2,"nile-breadcrumb",523),u("nile-click",function(){_(e);let o=r(2);return g(o.closeWidgetDetailPanel())}),s(3,"nile-breadcrumb-item"),c(4),d(),m(5,ec,2,1,"nile-breadcrumb-item"),s(6,"nile-breadcrumb-item"),m(7,tc,1,1)(8,nc,1,0,"nile-skeleton-loader",524),d()()(),s(9,"div",525),m(10,ic,2,1,"p",526),m(11,lc,2,1)(12,sc,1,8,"shared-dashboard-grid",527),d(),m(13,dc,11,6,"div",528)(14,cc,7,4,"div",528)(15,pc,4,0,"div",528),d()}if(i&2){let e,n,o=r(2);l(4),q(" ",o.detailRootCrumb()," "),l(),h((e=o.detailPanelWidgetCrumb())?5:-1,e),l(2),h((n=o.detailPanelLastCrumb())?7:8,n),l(3),h(o.detailPanelCohortId()?10:-1),l(),h(o.widgetDetailPanelLoading()?11:12),l(2),h(o.widgetDetailPanelKind()==="dashboard"?13:o.detailPanelCohortId()?14:o.widgetDetailPanelCanAdd()?15:-1)}}function gc(i,t){if(i&1&&m(0,_c,16,6,"div",521),i&2){let e=r();h(e.widgetDetailPanelOpen()?0:-1)}}function uc(i,t){if(i&1){let e=k();s(0,"app-alert-drawer",543),u("closed",function(){_(e);let o=r();return g(o.onAlertClosed())})("saved",function(){_(e);let o=r();return g(o.onAlertClosed())}),d()}if(i&2){let e,n=r();b("open",n.alertDrawerOpen())("widget",n.alertWidget())("dashboardId",null)("source",n.alertSource())("sourceName",((e=n.selectedScope())==null?null:e.name)??"")("authoringMode","chat")}}function mc(i,t){i&1&&C(0,"nile-executive-summary",30,8)}function hc(i,t){if(i&1){let e=k();s(0,"app-story-picker-drawer",544),u("closed",function(){_(e);let o=r();return g(o.closeStoryPicker())})("added",function(){_(e);let o=r();return g(o.onAddedToStory())}),d()}if(i&2){let e=r();b("open",e.storyPickerOpen())("widget",e.storyPickerWidget())}}function Cc(i,t){if(i&1&&(s(0,"div",75),C(1,"nile-glyph",96),s(2,"div",77)(3,"span",89),c(4),d(),s(5,"span",90),c(6),d()()()),i&2){let e=t.$implicit,n=r();l(3),b("title",e.name||"Untitled"),l(),y(e.name||"Untitled"),l(2),y(n.dashboardMeta(e))}}function he(){return Math.random().toString(36).slice(2)}function fc(i){if(!i.length)return i;let t=new Map;for(let a of i){let p=t.get(a.y)??[];p.push(a),t.set(a.y,p)}let e=[...t.keys()].sort((a,p)=>a-p),n=[],o=0;for(let a of e){let p=t.get(a);for(let x of p)n.push(T(w({},x),{y:o}));o+=Math.max(...p.map(x=>x.h))}return n}var xc=4,yc="forecast-settings",bc="forecast-this";function Vi(i){return i.split(`
7
+ `);A=Q.pop()??"";for(let U of Q)S(U)}A.trim()&&S(A)}async createDashboardFromTemplate(t){return(await E(this.http.post(`${this.baseUrl}/category-templates/${t}/dashboard`,{}))).data}async listWidgetTemplates(){return(await E(this.http.get(this.v1(`${this.baseUrl}/widget-templates`)))).data}async previewWidgetTemplate(t){return(await E(this.http.post(this.v1(`${this.baseUrl}/widget-templates/${t}/preview`),{}))).data}async loadAllWidgetTemplatePreviews(){return(await E(this.http.post(this.v1(`${this.baseUrl}/widget-templates/preview-all`),{}))).data}async previewWidgetTemplateDetailPanel(t){return(await E(this.http.post(this.v1(`${this.baseUrl}/widget-templates/${t}/detail-panel`),{}))).data}async previewWidgetDetailPanelDefinition(t){return(await E(this.http.post(`${this.baseUrl}/widget-templates/preview-detail-panel`,{detailPanel:t}))).data}async createDashboard(t){let a=t,{published:e}=a,n=Ee(a,["published"]);return I().features.mcpGateway?(await this.callMcpTool("createDashboard",w(w({},n),e?{published:!0}:{}))).dashboard:(await E(this.http.post(`${this.baseUrl}/dashboards${e?"?published=true":""}`,n))).data}async publishDashboard(t){return I().features.mcpGateway?(await this.callMcpTool("publishDashboard",{dashboardId:t}))?.publishedDashboardId??t:(await E(this.http.post(`${this.baseUrl}/dashboards/${t}/publish`,{})))?.data?.publishedDashboardId??t}async updateDashboard(t,e){await E(this.http.put(`${this.baseUrl}/dashboards/${t}?published=false`,e))}async deleteDashboard(t){if(!I().features.mcpGateway){await E(this.http.delete(`${this.baseUrl}/dashboards/${t}`));return}await this.callMcpTool("deleteDashboard",{dashboardId:t})}async register(t){return(await E(this.http.post(`${I().baseUrl}/api/customers/${this.customerId}/workforce/register`,t))).data}async listConnections(){return!this.customerId||!this.productId?[]:(await E(this.http.get(`${this.baseUrl}/connections`)))?.data??[]}async listDatasets(){return!this.customerId||!this.productId?[]:((await E(this.http.get(`${this.baseUrl}/connections/datasets`)))?.data??[]).map(e=>({id:e.id,name:e.name}))}async listPipelines(){if(!this.customerId||!this.productId)return[];let t=`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/applications/orchestrations/v2?startIndex=0&limit=100`;return((await E(this.http.get(t)))?.data??[]).map(n=>({id:n.publicOrchestrationGuid??n.guid??n.id??"",name:n.name})).filter(n=>n.id)}async createConnection(t,e){return(await E(this.http.post(`${this.baseUrl}/connections`,{name:t,config:e}))).data}async updateConnection(t,e){return(await E(this.http.put(`${this.baseUrl}/connections/${t}`,e))).data}async testConnection(t){return(await E(this.http.post(`${this.baseUrl}/connections/${t}/test`,{}))).data}async deleteConnection(t){await E(this.http.delete(`${this.baseUrl}/connections/${t}`))}parseLine(t,e){let n=t.indexOf(":");if(n===-1)return;let o=t.slice(0,n),a;try{a=JSON.parse(t.slice(n+1))}catch{return}switch(o){case"f":break;case"0":e.onText(a.text??"");break;case"9":{let p=a;e.onToolStart(p.toolCallId,p.uiLabel??p.toolName??"");break}case"a":{let p=a;e.onToolResult(p.toolCallId,p.result?.uiDetail??"",p.result?.error??!1);break}case"2":{let p=a;p.data_type==="adhoc_viz"?e.onDataPart(p):p.data_type==="dashboard_title"?e.onDashboardTitle?.(p.data?.title??""):p.data_type==="choice"?e.onChoice?.(p.data):p.data_type==="layout_patch"&&e.onLayoutPatch?.(p.data);break}case"3":e.onError(a.error??"Unknown error");break;case"d":{let p=a;e.onFinish(p.finishReason??"stop",p.conversationId??"");break}}}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};function ei({hasMessages:i,artifactOpen:t,builderOpen:e}){return t?"split":e?"builder":i?"conversation":"idle"}function ti(i,t){return i==="chat"?t.chat:i==="library"?t.library:i==="tools"?t.tools:!0}function ni(i){return[i.chat,i.library,i.tools].filter(Boolean).length>1}var Me=class i{http=N(_e);tokenStore=N(ae);get customerId(){return I().customerId??this.tokenStore.tenantId()??""}get productId(){return I().productId??ge()}get baseUrl(){return`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce`}async listCriteria(){return(await E(this.http.get(`${this.baseUrl}/cohort-criteria?category=cohort`)))?.criteria??[]}async previewCriterion(t){return E(this.http.get(`${this.baseUrl}/cohorts/preview?criterion=${encodeURIComponent(t)}`))}async getDetail(t){return E(this.http.get(`${this.baseUrl}/cohorts/detail?criterion=${encodeURIComponent(t)}`))}async listMembers(t,e){return(await E(this.http.get(`${this.baseUrl}/cohorts/members?criterion=${encodeURIComponent(t)}&limit=${e}`)))?.members??[]}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};function oi(i,t,e){return{chart:w({type:"kpi",variant:"card",value:t},e?{description:e}:{}),aq:{chartTitle:i,ai:{enabled:!1}}}}function ii(i,t,e,n){return{title:t,componentName:i,widgetType:"chart",config:e,layout:n}}function ai(i){let t=i.kpis.map((x,v)=>ii("nile-kpi-chart",x.label,oi(x.label,x.value),{x:v*3,y:0,w:3,h:2})),e=i.systemRows.length,n=e<i.systemCount?`Underlying rows \xB7 top ${e} of ${i.systemCount} systems`:`Underlying rows \xB7 ${e} ${e===1?"system":"systems"}`,o=x=>i.systemRows.some(v=>v[x]>0),a=[{accessorKey:"system",header:"System"},{accessorKey:"events",header:"Events"},...o("errors")?[{accessorKey:"errors",header:"Errors"}]:[],...o("orphans")?[{accessorKey:"orphans",header:"Orphans"}]:[]],p=ii("nile-data-grid",n,{chart:{type:"grid",columns:a,data:i.systemRows},aq:{chartTitle:n,ai:{enabled:!1}}},{x:0,y:2,w:12,h:6});return[...t,p]}var Ui={kpis:[{label:"Matches",value:""},{label:"% of population",value:""},{label:"Events from these people",value:""},{label:"Orphan events among them",value:""}],systemRows:[],systemCount:0,eventTotal:0,scan:{events:0,systems:0}};function ri(i,t=1){return{title:i.cohortTitle,componentName:"nile-kpi-chart",config:{title:i.cohortTitle,componentName:"nile-kpi-chart",widgetType:"chart",category:"cohort",config:T(w({},oi(i.cohortTitle,i.matchCount,`${t} ${t===1?"criterion":"criteria"} \xB7 live membership`)),{_meta:{cohortId:i.criterionId,detailPanel:{title:i.cohortTitle,cohortId:i.criterionId,widgets:ai(Ui)}}}),layout:{x:0,y:0,w:3,h:3}}}}function Xe(i,t){return{title:i.cohortTitle,widgets:ai(t),skipped:[]}}var Gi="__evidence-curated";function ji(i,t){return`${i}${Gi}-${t}`}function Hi(i){let t=i?.config?._meta;if(!t||typeof t!="object")return null;let e=t,n=typeof e.templateId=="string"&&e.templateId?e.templateId:null,o=typeof e.cohortId=="string"&&e.cohortId?e.cohortId:null,a=e.detailPanel&&typeof e.detailPanel=="object"?e.detailPanel:null;return!n&&!o&&!a?null:{templateId:n,cohortId:o,detailPanel:a}}var Yi=2;function Ki(i){if(!i||typeof i!="object")return;let t=i;if(![t.x,t.y,t.w,t.h].every(x=>typeof x=="number"&&Number.isFinite(x)))return;let{x:n,y:o,w:a,h:p}=t;if(!(a<=0||p<=0))return{x:n,y:o,w:a,h:Math.max(Yi,Math.ceil(p))}}function Qi(i,t){return i==="kpi"?"nile-kpi-chart":i==="grid"?"nile-data-grid":typeof t=="string"&&t?t:void 0}function xt(i,t){let e=Array.isArray(i?.widgets)?i.widgets:[],n=[];for(let o of e){if(!o||typeof o!="object")continue;let a=o,p=a.config??a??{},x=p.chart??{},v=T(w({},p),{chart:x,aq:p.aq??{}}),A={id:ji(t,n.length),title:typeof a.title=="string"?a.title:"",widgetType:a.widgetType==="kpi"?"kpi":"chart",config:v,drilldownBy:Array.isArray(a.drilldownBy)?a.drilldownBy:[],category:a.category??null},S=Qi(x.type,a.componentName);S&&(A.componentName=S);let P=Ki(a.layout);P&&(A.layout=P),typeof a.summary=="string"&&(A.summary=a.summary),a.queryMeta&&typeof a.queryMeta=="object"&&(A.queryMeta=a.queryMeta),typeof a.dataSourceId=="string"&&(A.dataSourceId=a.dataSourceId),n.push(A)}return n}var Je=class i{svc=N(me);cohort=N(Me);async resolveEvidence(t){let e=Hi(t);if(!e)return[];if(e.cohortId){let[n,o]=await Promise.all([this.cohort.previewCriterion(e.cohortId),this.cohort.getDetail(e.cohortId)]);return xt(Xe(n,o),t.id)}return e.detailPanel?e.detailPanel.widgets?.length?xt(await this.svc.previewWidgetDetailPanelDefinition(e.detailPanel),t.id):[]:e.templateId?xt(await this.svc.previewWidgetTemplateDetailPanel(e.templateId),t.id):[]}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};function yt(i){return!!i&&i.matchCount>0&&!i.sampleMatches?.length}function li(i){return!i||yt(i)?!1:i.matchCount>Math.min(i.sampleMatches?.length??0,3)}function si(i,t,e){return e&&t?t:i?.sampleMatches?.slice(0,3)??[]}function di(i,t){return!!i&&!!t&&t.length<i.matchCount}function bt(i){let t=i?.status;return t===503?"unavailable":t===403?"forbidden":"failed"}function ci(i,t,e){let n=e||"Working",o=i.map(p=>p.id==="thinking"&&p.status==="running"?T(w({},p),{status:"done"}):p),a=o.findIndex(p=>p.status==="running"&&p.baseLabel===n);if(a>=0){let p=o[a],x=[...o];return x[a]=T(w({},p),{callIds:[...p.callIds,t],pending:p.pending+1}),x}return[...o,{id:t,callIds:[t],pending:1,baseLabel:n,label:n,status:"running"}]}function pi(i,t,e,n){return i.map(o=>{if(!o.callIds.includes(t))return o;let a=Math.max(0,o.pending-1);return T(w({},o),{pending:a,detail:n?o.detail:e||o.detail,status:a===0?"done":o.status})})}function vt(i){let{finishReason:t,sawError:e,producedContent:n}=i;return t==="error"?!0:t==null?e:e&&!n}var _i=i=>T(w({},i),{isStreaming:!1,thinking:void 0,hasError:!0});function gi(i,t,e){return i.some(n=>n.id===t)?i.map(n=>n.id===t?_i(n):n):[...i,_i(e(t))]}var Ze=class i{http=N(_e);tokenStore=N(ae);get customerId(){return I().customerId??this.tokenStore.tenantId()??""}get productId(){return I().productId??ge()}get apiUrl(){return`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforcebot/forecast`}cachedContext=null;context(){return this.cachedContext?this.cachedContext:(this.cachedContext=E(this.http.get(`${this.apiUrl}/context`)).catch(t=>(console.info('[ask-aquera] forecast context unavailable \u2014 "forecast this" will not be claimed.',t),null)),this.cachedContext)}async compute(t){try{return await E(this.http.post(`${this.apiUrl}/compute`,t))}catch(e){let n=e,o=n?.error?.error;throw Object.assign(new Error(o||`Forecast failed (HTTP ${n?.status??"?"})`),{status:n?.status,code:n?.error?.code,isRefusal:n?.status===422})}}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ji=[/\bforecast(?:ing|s|ed)?\b/i,/\bpredict(?:ion|ions|ive|s|ed)?\b/i,/\bproject(?:ion|ions|ed)\b/i,/\bproject\s+(?:our|the|this|that|my|its|their|his|her|forward)\b/i,/\bproject\s+\w+(?:\s+\w+)?\s+forward\b/i,/\bextrapolat\w*/i,/\bnext\s+(?:week|month|quarter|year|\d+\s+(?:weeks?|months?|quarters?|years?))\b/i,/\bby\s+(?:year[-\s]?end|end\s+of\s+(?:the\s+)?year|EOY)\b/i,/\bby\s+Q[1-4]\b/i,/\bthrough\s+(?:year[-\s]?end|end\s+of\s+(?:the\s+)?year)\b/i,/\bhow\s+many\s+\w+\s+will\s+we\b/i,/\bwhat\s+will\s+\w+\s+(?:be|look\s+like)\b/i,/\btrend\s+(?:this\s+)?forward\b/i,/\brun[-\s]?rate\s+to\b/i],Zi=[/\bforecast\s+(?:this|that|it)\b/i,/\bextend\s+(?:this|that|it)\b/i,/\bproject\s+(?:this|that|it)\s+forward\b/i,/\btrend\s+(?:this|that|it)\s+forward\b/i,/\b(?:this|that)\s+chart\b/i,/\bsame\s+chart\b/i],eo={Weekly:{week:1,month:4,quarter:13,year:52},Monthly:{week:1,month:1,quarter:3,year:12},Quarterly:{week:1,month:1,quarter:1,year:4},Yearly:{week:1,month:1,quarter:1,year:1}},to=[[/\b(?:weekly|by\s+week|per\s+week|week\s+over\s+week)\b/i,"Weekly"],[/\b(?:monthly|by\s+month|per\s+month|month\s+over\s+month)\b/i,"Monthly"],[/\b(?:quarterly|by\s+quarter|per\s+quarter)\b/i,"Quarterly"],[/\b(?:yearly|annually|annual|per\s+year)\b|\bby\s+year\b(?!\s*-?\s*end)/i,"Yearly"]];function wt(i,t,e=new Date){let n=(i??"").trim();if(!n)return null;let o=Zi.some(x=>x.test(n)),a=no(n,Ji);if(!a&&!o)return null;let p=io(n);return{extendsExisting:o,metric:oo(n,t),horizon:ao(n,p??t.defaults.granularity,e),granularity:p,trigger:a||"refers to an existing chart"}}function no(i,t){for(let e of t){let n=e.exec(i);if(n)return n[0]}return""}function io(i){for(let[t,e]of to)if(t.test(i))return e}function oo(i,t){let e=i.toLowerCase();return t.metrics.flatMap(o=>[o.label,...o.aliases].map(a=>({id:o.id,alias:a.toLowerCase()}))).sort((o,a)=>a.alias.length-o.alias.length).find(o=>e.includes(o.alias))?.id}function ao(i,t,e){let n=eo[t],o=/\bnext\s+(\d+)\s+(weeks?|months?|quarters?|years?)\b/i.exec(i);if(o){let x=Number(o[1]),v=o[2].toLowerCase().replace(/s$/,"");return Math.max(1,Math.round(x*n[v]))}let a=/\bnext\s+(week|month|quarter|year)\b/i.exec(i);if(a){let x=a[1].toLowerCase();return Math.max(1,n[x])}if(/\b(?:by|through)\s+(?:year[-\s]?end|end\s+of\s+(?:the\s+)?year|EOY)\b/i.test(i))return ro(t,e);let p=/\bby\s+Q([1-4])\b/i.exec(i);if(p)return lo(t,Number(p[1]),e)}function ro(i,t){let e=12-(t.getMonth()+1);return Math.max(1,ui(e,i))}function lo(i,t,e){let n=Math.floor(e.getMonth()/3)+1,o=t>=n?t-n:4-n+t,a=Math.max(1,o*3);return Math.max(1,ui(a,i))}function ui(i,t){switch(t){case"Weekly":return Math.round(i*4.345);case"Quarterly":return Math.max(1,Math.round(i/3));case"Yearly":return Math.max(1,Math.round(i/12));default:return i}}var so=new Set(["line","area","spline","areaspline"]),kt="(?:jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec)[a-z]*",le="(?:19|20)\\d{2}",mi="(?:0?[1-9]|[12]\\d|3[01])",Pt="(?:0?[1-9]|1[0-2])",co=[new RegExp(`^${le}[-/.]${Pt}(?:[-/.]${mi})?$`,"i"),new RegExp(`^${mi}[-/.]${Pt}[-/.]${le}$`,"i"),new RegExp(`^${Pt}[-/.]${le}$`,"i"),new RegExp(`^${le}-?w\\d{1,2}$`,"i"),new RegExp(`^w(?:ee)?k\\s*\\d{1,2}[,\\s]+${le}$`,"i"),new RegExp(`^${kt}[\\s-]*'?\\d{2}$`,"i"),new RegExp(`^${kt}[\\s-]*${le}$`,"i"),new RegExp(`^${le}[\\s-]*${kt}$`,"i"),new RegExp(`^q[1-4][\\s-]*${le}$`,"i"),new RegExp(`^${le}[\\s-]*q[1-4]$`,"i"),new RegExp("^fy\\s*'?\\d{2,4}$","i"),new RegExp(`^${le}$`)];function po(i){let t=(i??[]).map(n=>String(n??"").trim()).filter(Boolean);return t.length<3?!1:t.filter(n=>co.some(o=>o.test(n))).length/t.length>=.8}var _o=[/forecast/i,/confidence/i,/project/i,/upper|lower/i,/band/i,/target/i],Ci=3;function et(i){return i?.config?.chart??i?.chart??{}}function fi(i){let t=et(i);return t?.enableForecasting===!0?!0:(Array.isArray(t?.data)?t.data:[]).some(n=>Array.isArray(n?.projected)&&n.projected.length>0)}function tt(i){let t=et(i),e=String(t?.type??"").toLowerCase();if(!so.has(e))return!1;let n=go(i);if(!n||n.values.length<Ci)return!1;let o=vi(t);return o.length?po(o):!!n.times?.length}function go(i){let t=et(i),e=bi(t);if(!e.length)return null;let n=e.find(o=>!wi(o.name))??e[0];return yi(t,n)}function xi(i){let t=et(i),e=bi(t).filter(o=>!wi(o.name)),n=[];return e.forEach((o,a)=>{let p=yi(t,o);p&&n.push(T(w({},p),{name:o.name||(e.length>1?`Series ${a+1}`:"")}))}),n}function yi(i,t){let e=mo(t.data),n=e.map(p=>p.value);if(n.length<Ci)return null;let o=e.every(p=>p.time!==void 0)?e.map(p=>p.time):void 0,a=vi(i).slice(0,n.length);return w({labels:a.length===n.length?a:o?o.map(p=>uo(p)):n.map((p,x)=>String(x+1)),values:n},o?{times:o}:{})}function uo(i){return new Date(i).toLocaleDateString("en-US",{month:"short",year:"numeric"})}function bi(i){let t=i?.options?.series;if(Array.isArray(t)&&t.length)return t.filter(n=>Array.isArray(n?.data)).map(n=>({name:String(n.name??""),data:n.data}));let e=i?.data;return Array.isArray(e)&&e.length?e.every(n=>typeof n=="number"||n===null)?[{name:"",data:e}]:e.filter(n=>Array.isArray(n?.data)||Array.isArray(n?.actual)).map(n=>({name:String(n.name??""),data:Array.isArray(n.actual)?n.actual:n.data})):[]}function vi(i){let t=i?.categories;if(Array.isArray(t)&&t.length)return t.map(String);let e=i?.options?.xAxis?.categories;return Array.isArray(e)&&e.length?e.map(String):[]}function wi(i){return _o.some(t=>t.test(i))}function mo(i){let t=[];for(let e of i){let n=ho(e);if(n===null)break;t.push(n)}return t}function ho(i){if(typeof i=="number"&&Number.isFinite(i))return{value:i};if(Array.isArray(i)&&i.length===2&&typeof i[1]=="number")return w({value:i[1]},typeof i[0]=="number"?{time:i[0]}:{});if(i&&typeof i=="object"&&typeof i.y=="number"){let t=i;return w({value:t.y},typeof t.x=="number"?{time:t.x}:{})}return null}var Mt={Weekly:{Weekly:1,Monthly:4,Quarterly:13,Yearly:52},Monthly:{Monthly:1,Quarterly:3,Yearly:12},Quarterly:{Quarterly:1,Yearly:4},Yearly:{Yearly:1}},At={Weekly:{plural:"weeks",singular:"week",adjective:"weekly"},Monthly:{plural:"months",singular:"month",adjective:"monthly"},Quarterly:{plural:"quarters",singular:"quarter",adjective:"quarterly"},Yearly:{plural:"years",singular:"year",adjective:"yearly"}},hi=4;function Co(i,t,e){let n=Mt[t]?.[e];return n?Math.max(1,Math.floor(i/n)):null}function ki(i,t,e){return e.map(n=>{let o=At[n]??At.Monthly,a=Co(t,i,n);return a===null?{value:n,enabled:!1,fittedPeriods:0,maxHorizon:0,label:o,reason:`needs ${o.adjective} data, but this series is ${At[i]?.adjective??i.toLowerCase()}`}:a<hi?{value:n,enabled:!1,fittedPeriods:a,maxHorizon:0,label:o,reason:`only ${a} ${a===1?o.singular:o.plural} of history, needs at least ${hi}`}:{value:n,enabled:!0,fittedPeriods:a,maxHorizon:Math.max(1,Math.floor(a/2)),label:o}})}function Pi(i,t,e,n){if(t===e)return Math.max(1,Math.min(i,n));let o=Mt[t]?.[e],a=Mt[e]?.[t],p=o?i/o:a?i*a:i;return Math.max(1,Math.min(Math.round(p),n))}var fo="#2970FF",Ai="#7A5AF8";var Mi={Weekly:6048e5,Monthly:26298e5,Quarterly:78894e5,Yearly:315576e5},Si={Weekly:"Week",Monthly:"Month",Quarterly:"Quarter",Yearly:"Year"};function xo(i,t){if(i.times?.length===i.values.length)return i.times;let e=Date.now(),n=i.values.length;return i.values.map((o,a)=>Math.round(e-(n-1-a)*t))}function Ti(i,t){let e=new Date(i);switch(t){case"Weekly":return e.toLocaleDateString("en-US",{day:"numeric",month:"short",year:"numeric"});case"Quarterly":return`Q${Math.floor(e.getMonth()/3)+1} ${e.getFullYear()}`;case"Yearly":return String(e.getFullYear());default:return e.toLocaleDateString("en-US",{month:"short",year:"numeric"})}}function qi(i,t){let e=Mi[i.granularity]??Mi.Monthly,n=xo(i.history,e),o=n[n.length-1]??Date.now(),a=i.forecastTimes?.length===t.length?i.forecastTimes:t.map((P,z)=>Math.round(o+(z+1)*e)),p=t.length>0,x=[...n.map(P=>Ti(P,i.granularity)),...p?a.map(P=>Ti(P,i.granularity)):[]],v=(i.series?.length??0)>1,A=v?i.series.map(P=>w({name:P.note?`${P.name} \xB7 ${P.note}`:P.name,actual:P.values},P.points?.length?{projected:P.points.map(z=>z.value),interval:P.points.map(z=>[z.low,z.high])}:{})):[w({name:"Actuals",color:fo,actual:i.history.values},p?{projected:t.map(P=>P.value),interval:t.map(P=>[P.low,P.high])}:{})],S={type:"line",enableForecasting:!0,categories:x,data:A,lineWidth:2,showMarkers:!1,valueSuffix:i.valueSuffix??"",xAxisTitle:Si[i.granularity]??Si.Monthly,projection:T(w({start:null},v?{}:{color:Ai}),{dashStyle:"Dash",showNowLine:!0,nowLabel:"",bandLabel:"Projected",interval:T(w({name:`${i.confidence}% confidence`},v?{}:{color:Ai}),{opacity:.16,level:i.confidence})}),legend:{show:!0},height:"400px",loading:!1,options:{}};return{title:i.chartTitle,componentName:"nile-line-chart",widgetType:"chart",config:{aq:{chartTitle:i.chartTitle,chartSubtitle:i.chartSubtitle},chart:S},queryMeta:{sql:`-- forecast:${i.metric}`}}}function St(i,t=[]){let e=i.guardrails?.passed?i.points??[]:[],n=e[e.length-1],o=w({horizon:i.horizon,confidence:i.confidence,granularity:i.granularity},n?{value:n.value,low:n.low,high:n.high}:{}),a=e.length?qe(i.narrative,o):i.guardrails?.body?`I can't forecast this reliably. ${i.guardrails.body}`:"I can't forecast this series.",p=yo(i,t),x=i.skipped??[],v=(i.meta??[]).map(A=>({label:A.label,value:qe(A.value,o)}));return x.length&&p.length>1&&v.push({label:"Series",value:`${p.length-x.length} of ${p.length} forecast \u2014 ${x.map(A=>A.name).join(", ")} left as history`}),{chart:bo(i,e,p),answer:a,meta:v,points:e,horizon:i.horizon,granularity:i.granularity,confidence:i.confidence,maxHorizon:i.maxHorizon}}function yo(i,t){let e=i.forecasts??[];if(e.length<2&&!(i.skipped?.length&&e.length))return[];let n=p=>String(p??"").toLowerCase().replace(/[^a-z0-9]/g,""),o=new Map(t.map(p=>[n(p.name??""),p])),a=e.map(p=>({name:p.name,values:p.history?.values??o.get(n(p.name))?.values??[],points:i.guardrails?.passed?p.points??[]:[]}));for(let p of i.skipped??[]){let x=o.get(n(p.name));x?.values?.length&&a.push({name:p.name,values:x.values,note:"not forecast"})}return a}function bo(i,t,e=[]){return qi(e.length?T(w({},i),{series:e}):i,t)}function qe(i,t){return String(i??"").replace(/\{\{(\w+)\}\}/g,(e,n)=>n in t?String(t[n]):e)}function Tt(i){if(i.forecast||i.isStreaming||i.charts?.length!==1)return!1;let t=i.charts[0]?.config;return fi(t)?!1:tt(t)}var wo=["aqChat"],ko=["artifactGrid"],Po=["composerEl"],Ao=["aiExecutiveSummary"],Mo=()=>[1,2,3,4],Se=()=>[],Oi=i=>({$implicit:i}),te=(i,t)=>t.id,se=(i,t)=>t.key,So=(i,t)=>t.templateId,To=(i,t)=>t.identityKey,Ei=(i,t)=>t.label,Ii=(i,t)=>t.component,qo=(i,t)=>t.name,nt=(i,t)=>t.value,Do=(i,t)=>t.action,Fo=(i,t)=>t.datasetId,Oo=(i,t)=>t.schema+"."+t.name;function Eo(i,t){if(i&1){let e=k();s(0,"button",32),u("click",function(){_(e);let o=r();return g(o.addReplyQuote())}),C(1,"nile-glyph",33),c(2),d()}if(i&2){let e=t,n=r();Z("top",e.top,"px")("left",e.left,"px"),W("reply-badge--below",!e.above),l(2),q(" ",n.copy().replyButton," ")}}function Io(i,t){if(i&1&&(s(0,"nile-nav-tab",50),c(1),d()),i&2){let e=r(3);l(),y(e.copy().chatTabLabel)}}function Vo(i,t){if(i&1&&(s(0,"nile-nav-tab",51),c(1),d()),i&2){let e=r(3);l(),y(e.copy().libraryTabLabel)}}function Ro(i,t){if(i&1&&(s(0,"nile-nav-tab",52),c(1),d()),i&2){let e=r(3);l(),y(e.copy().toolsTabLabel)}}function zo(i,t){if(i&1){let e=k();s(0,"nile-nav-tab-group",49),u("nile-tab-change",function(o){_(e);let a=r(2);return g(a.setChatPaneTab(o.detail.value))}),m(1,Io,2,1,"nile-nav-tab",50),m(2,Vo,2,1,"nile-nav-tab",51),m(3,Ro,2,1,"nile-nav-tab",52),d()}if(i&2){let e=r(2);M("value",e.chatPaneTab()),l(),h(e.features().chat?1:-1),l(),h(e.features().library?2:-1),l(),h(e.features().tools?3:-1)}}function No(i,t){if(i&1){let e=k();s(0,"span",37),C(1,"nile-glyph",53),s(2,"span",54),c(3),d(),s(4,"button",55),u("click",function(){_(e);let o=r(2);return g(o.clearScope())}),C(5,"nile-glyph",56),d()()}if(i&2){let e=t;l(),b("name",e.kind==="dataset"?"ng-database":"ng-dataflow-04"),l(2),Y("",e.kind==="dataset"?"Dataset":"Pipeline",": ",e.name)}}function Lo(i,t){i&1&&(s(0,"div",66),C(1,"nile-skeleton-loader",67)(2,"nile-skeleton-loader",68),d())}function $o(i,t){i&1&&C(0,"nile-glyph",72)}function Wo(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.selectScope("dataset",o))}),s(1,"span",71),c(2),d(),m(3,$o,1,0,"nile-glyph",72),d()}if(i&2){let e,n=t.$implicit,o=r(5);l(2),y(n.name),l(),h(((e=o.selectedScope())==null?null:e.id)===n.id?3:-1)}}function Bo(i,t){if(i&1&&(s(0,"div",69),c(1),d()),i&2){let e=r(5);l(),y(e.copy().noDatasetsFound)}}function Uo(i,t){if(i&1&&F(0,Wo,4,2,"nile-menu-item",null,te,!1,Bo,2,1,"div",69),i&2){let e=r(4);O(e.datasets())}}function Go(i,t){if(i&1&&(s(0,"nile-menu-item")(1,"nile-dropdown",61)(2,"span",62),C(3,"nile-glyph",63),s(4,"span",64),c(5,"Dataset"),d(),C(6,"nile-glyph",65),d(),s(7,"nile-menu"),m(8,Lo,3,0,"div",66)(9,Uo,3,1),d()()()),i&2){let e=r(3);l(8),h(e.scopeLoading()?8:9)}}function jo(i,t){i&1&&(s(0,"div",66),C(1,"nile-skeleton-loader",67)(2,"nile-skeleton-loader",68),d())}function Ho(i,t){i&1&&C(0,"nile-glyph",72)}function Yo(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.selectScope("pipeline",o))}),s(1,"span",71),c(2),d(),m(3,Ho,1,0,"nile-glyph",72),d()}if(i&2){let e,n=t.$implicit,o=r(5);l(2),y(n.name),l(),h(((e=o.selectedScope())==null?null:e.id)===n.id?3:-1)}}function Ko(i,t){if(i&1&&(s(0,"div",69),c(1),d()),i&2){let e=r(5);l(),y(e.copy().noPipelinesFound)}}function Qo(i,t){if(i&1&&F(0,Yo,4,2,"nile-menu-item",null,te,!1,Ko,2,1,"div",69),i&2){let e=r(4);O(e.pipelines())}}function Xo(i,t){if(i&1&&(s(0,"nile-menu-item")(1,"nile-dropdown",61)(2,"span",62),C(3,"nile-glyph",73),s(4,"span",64),c(5,"Pipeline"),d(),C(6,"nile-glyph",65),d(),s(7,"nile-menu"),m(8,jo,3,0,"div",66)(9,Qo,3,1),d()()()),i&2){let e=r(3);l(8),h(e.scopeLoading()?8:9)}}function Jo(i,t){if(i&1){let e=k();s(0,"nile-dropdown",57),u("nile-hide",function(){_(e);let o=r(2);return g(o.closeScopeMenu())}),s(1,"nile-lite-tooltip",58)(2,"button",59),u("click",function(){_(e);let o=r(2);return g(o.openScopeMenu())}),C(3,"nile-glyph",60),d()(),s(4,"nile-menu"),m(5,Go,10,1,"nile-menu-item"),m(6,Xo,10,1,"nile-menu-item"),d()()}if(i&2){let e=r(2);b("open",e.showScopePicker()),l(5),h(e.features().scopePicker.dataset?5:-1),l(),h(e.features().scopePicker.pipeline?6:-1)}}function Zo(i,t){if(i&1&&(s(0,"nile-menu-item",74)(1,"div",75),C(2,"nile-skeleton-loader",76),s(3,"div",77),C(4,"nile-skeleton-loader",78)(5,"nile-skeleton-loader",79),d()()()),i&2){let e=t.$implicit;l(3),Z("max-width",e,"px")}}function ea(i,t){if(i&1&&F(0,Zo,6,2,"nile-menu-item",74,G),i&2){let e=r(2);O(e.menuSkeletonRows)}}function ta(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(2);l(),y(e.copy().noResultsMatchFilters)}}function na(i,t){if(i&1){let e=k();s(0,"input",88),u("ngModelChange",function(o){_(e);let a=r(5);return g(a.renameDraft.set(o))})("click",function(o){return o.stopPropagation()})("keydown.enter",function(o){_(e);let a=r().$implicit,p=r(4);return g(p.commitRenameConversation(o,a))})("keydown.escape",function(o){_(e);let a=r(5);return g(a.cancelRename(o))})("blur",function(o){_(e);let a=r().$implicit,p=r(4);return g(p.commitRenameConversation(o,a))}),d()}if(i&2){let e=r(5);b("ngModel",e.renameDraft())}}function ia(i,t){if(i&1&&(s(0,"span",89),c(1),d(),s(2,"span",90),c(3),d()),i&2){let e=r().$implicit,n=r(4);b("title",e.title||"Untitled"),l(),y(e.title||"Untitled"),l(2),y(n.conversationMeta(e))}}function oa(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.selectConversation(o.id))}),s(1,"div",75),C(2,"nile-glyph",81),s(3,"div",77),m(4,na,1,1,"input",82)(5,ia,4,3),d(),s(6,"div",83)(7,"button",84),u("click",function(o){let a=_(e).$implicit,p=r(4);return g(p.startRename(o,a.id,a.title))}),C(8,"nile-glyph",85),d(),s(9,"button",86),u("click",function(o){let a=_(e).$implicit,p=r(4);return g(p.deleteConversation(o,a.id))}),C(10,"nile-glyph",87),d()()()()}if(i&2){let e=t.$implicit,n=r(4);M("active",e.id===n.activeConversationId()?"":null),l(4),h(n.renamingId()===e.id?4:5),l(3),M("aria-label",n.copy().renameLabel),l(2),M("aria-label",n.copy().deleteLabel)}}function aa(i,t){if(i&1&&(s(0,"div",80),c(1),d(),F(2,oa,11,4,"nile-menu-item",null,te)),i&2){let e=t.$implicit;l(),y(e.label),l(),O(e.items)}}function ra(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(3);l(),y(e.copy().noConversationsYet)}}function la(i,t){if(i&1&&F(0,aa,4,1,null,null,se,!1,ra,2,1,"div",46),i&2){let e=r(2);O(e.groupedConversations())}}function sa(i,t){if(i&1&&(s(0,"nile-menu-item",74)(1,"div",75),C(2,"nile-skeleton-loader",76),s(3,"div",77),C(4,"nile-skeleton-loader",78)(5,"nile-skeleton-loader",95),d()()()),i&2){let e=t.$implicit;l(3),Z("max-width",e,"px")}}function da(i,t){if(i&1&&F(0,sa,6,2,"nile-menu-item",74,G),i&2){let e=r(3);O(e.menuSkeletonRows)}}function ca(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(3);l(),y(e.copy().noResultsMatchFilters)}}function pa(i,t){if(i&1){let e=k();s(0,"input",88),u("ngModelChange",function(o){_(e);let a=r(6);return g(a.renameDraft.set(o))})("click",function(o){return o.stopPropagation()})("keydown.enter",function(o){_(e);let a=r().$implicit,p=r(5);return g(p.commitRenameDashboard(o,a))})("keydown.escape",function(o){_(e);let a=r(6);return g(a.cancelRename(o))})("blur",function(o){_(e);let a=r().$implicit,p=r(5);return g(p.commitRenameDashboard(o,a))}),d()}if(i&2){let e=r(6);b("ngModel",e.renameDraft())}}function _a(i,t){if(i&1&&(s(0,"span",89),c(1),d(),s(2,"span",90),c(3),d()),i&2){let e=r().$implicit,n=r(5);b("title",e.name||"Untitled"),l(),y(e.name||"Untitled"),l(2),y(n.dashboardMeta(e))}}function ga(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.openRelatedDashboard(o.id))}),s(1,"div",75),C(2,"nile-glyph",96),s(3,"div",77),m(4,pa,1,1,"input",82)(5,_a,4,3),d(),s(6,"div",83)(7,"button",84),u("click",function(o){let a=_(e).$implicit,p=r(5);return g(p.startRename(o,a.id,a.name))}),C(8,"nile-glyph",85),d(),s(9,"button",86),u("click",function(o){let a=_(e).$implicit,p=r(5);return g(p.deleteDashboardFromMenu(o,a.id))}),C(10,"nile-glyph",87),d()()()()}if(i&2){let e=t.$implicit,n=r(5);M("active",n.builderOpen()&&e.id===n.builderDashboardId()?"":null),l(4),h(n.renamingId()===e.id?4:5),l(3),M("aria-label",n.copy().renameLabel),l(2),M("aria-label",n.copy().deleteLabel)}}function ua(i,t){if(i&1&&(s(0,"div",80),c(1),d(),F(2,ga,11,4,"nile-menu-item",null,te)),i&2){let e=t.$implicit;l(),y(e.label),l(),O(e.items)}}function ma(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(4);l(),y(e.copy().noDashboardsYet)}}function ha(i,t){if(i&1&&F(0,ua,4,1,null,null,se,!1,ma,2,1,"div",46),i&2){let e=r(3);O(e.groupedDashboards())}}function Ca(i,t){if(i&1){let e=k();s(0,"nile-dropdown",91),u("nile-hide",function(){_(e);let o=r(2);return g(o.showRelatedDashboards.set(!1))}),s(1,"nile-lite-tooltip",92)(2,"button",93),u("click",function(){_(e);let o=r(2);return g(o.showRelatedDashboards.set(!o.showRelatedDashboards()))}),C(3,"nile-glyph",94),d()(),s(4,"nile-menu",43),u("nile-search-value",function(o){_(e);let a=r(2);return g(a.dashSearch.set((o.detail==null?null:o.detail.value)??""))}),s(5,"nile-menu-item",44),u("click",function(){_(e);let o=r(2);return g(o.openNewDashboard())}),C(6,"nile-glyph",45),c(7),d(),m(8,da,2,0)(9,ca,2,1,"div",46)(10,ha,3,1),d()()}if(i&2){let e=r(2);b("open",e.showRelatedDashboards()),l(4),M("noResultsMessage",e.copy().noResultsMatchFilters),l(3),q(" ",e.copy().newDashboardLabel," "),l(),h(e.dashboardsLoading()?8:e.dashSearchEmpty()?9:10)}}function fa(i,t){if(i&1){let e=k();s(0,"nile-lite-tooltip",48)(1,"button",97),u("click",function(){_(e);let o=r(2);return g(o.openGallery())}),C(2,"nile-glyph",98),d()()}}function xa(i,t){if(i&1){let e=k();s(0,"header",12)(1,"div",34),m(2,zo,4,4,"nile-nav-tab-group",35),d(),s(3,"div",36),m(4,No,6,3,"span",37),m(5,Jo,7,3,"nile-dropdown",38),s(6,"nile-dropdown",39),u("nile-hide",function(){_(e);let o=r();return g(o.showConversationPicker.set(!1))}),s(7,"nile-lite-tooltip",40)(8,"button",41),u("click",function(){_(e);let o=r();return g(o.showConversationPicker.set(!o.showConversationPicker()))}),C(9,"nile-glyph",42),d()(),s(10,"nile-menu",43),u("nile-search-value",function(o){_(e);let a=r();return g(a.convSearch.set((o.detail==null?null:o.detail.value)??""))}),s(11,"nile-menu-item",44),u("click",function(){_(e);let o=r();return g(o.newConversation())}),C(12,"nile-glyph",45),c(13),d(),m(14,ea,2,0)(15,ta,2,1,"div",46)(16,la,3,1),d()(),m(17,Ca,11,4,"nile-dropdown",47),m(18,fa,3,0,"nile-lite-tooltip",48),d()()}if(i&2){let e,n=r();l(2),h(n.tabsVisible()?2:-1),l(2),h((e=n.features().connections&&n.selectedScope())?4:-1,e),l(),h(n.features().scopePicker.enabled?5:-1),l(),b("open",n.showConversationPicker()),l(2),b("disabled",n.isStreaming()),l(2),M("noResultsMessage",n.copy().noResultsMatchFilters),l(3),q(" ",n.copy().newConversationLabel," "),l(),h(n.conversationsLoading()?14:n.convSearchEmpty()?15:16),l(3),h(n.features().dashboardsMenu?17:-1),l(),h(n.features().promptGallery?18:-1)}}function ya(i,t){if(i&1){let e=k();s(0,"button",112),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.selectWidgetTemplateCategory(o.key))}),c(1),s(2,"span",113),c(3),d()()}if(i&2){let e=t.$implicit,n=r(4);W("aq-picker-chip--active",n.widgetTemplateActiveCategory()===e.key),l(),q("",e.label," "),l(2),y(n.widgetTemplateCountForCategory(e.key))}}function ba(i,t){if(i&1){let e=k();s(0,"div",110)(1,"button",112),u("click",function(){_(e);let o=r(3);return g(o.selectWidgetTemplateCategory("all"))}),c(2),s(3,"span",113),c(4),d()(),F(5,ya,4,4,"button",114,se),d()}if(i&2){let e=r(3);l(),W("aq-picker-chip--active",e.widgetTemplateActiveCategory()==="all"),l(),q("",e.copy().libraryAllCategoryLabel," "),l(2),y(e.widgetTemplateAllTemplates().length),l(),O(e.templateCategories())}}function va(i,t){if(i&1&&C(0,"nile-skeleton-loader",116),i&2){let e=t.$implicit;Z("width",e,"px")}}function wa(i,t){if(i&1&&(s(0,"div",111),F(1,va,1,2,"nile-skeleton-loader",115,G),d()),i&2){let e=r(3);l(),O(e.libraryChipSkeletonWidths)}}function ka(i,t){if(i&1){let e=k();s(0,"nile-input",108),u("nile-input",function(o){_(e);let a=r(2);return g(a.librarySearch.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r(2);return g(a.librarySearch.set((o.detail==null?null:o.detail.value)??""))}),C(1,"nile-glyph",109),d(),m(2,ba,7,4,"div",110)(3,wa,3,0,"div",111)}if(i&2){let e=r(2);b("placeholder",e.copy().librarySearchWidgetsPlaceholder)("value",e.librarySearch()),l(2),h(!e.templateCategoriesLoading()&&!e.widgetTemplateTemplatesLoading()?2:3)}}function Pa(i,t){if(i&1){let e=k();s(0,"button",112),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.selectTemplateCategory(o.key))}),c(1),s(2,"span",113),c(3),d()()}if(i&2){let e=t.$implicit,n=r(4);W("aq-picker-chip--active",n.templateActiveCategory()===e.key),l(),q("",e.label," "),l(2),y(n.templateCountForCategory(e.key))}}function Aa(i,t){if(i&1){let e=k();s(0,"div",110)(1,"button",112),u("click",function(){_(e);let o=r(3);return g(o.selectTemplateCategory("all"))}),c(2),s(3,"span",113),c(4),d()(),F(5,Pa,4,4,"button",114,se),d()}if(i&2){let e=r(3);l(),W("aq-picker-chip--active",e.templateActiveCategory()==="all"),l(),q("",e.copy().libraryAllCategoryLabel," "),l(2),y(e.templateAllTemplates().length),l(),O(e.templateCategories())}}function Ma(i,t){if(i&1&&C(0,"nile-skeleton-loader",116),i&2){let e=t.$implicit;Z("width",e,"px")}}function Sa(i,t){if(i&1&&(s(0,"div",111),F(1,Ma,1,2,"nile-skeleton-loader",115,G),d()),i&2){let e=r(3);l(),O(e.libraryChipSkeletonWidths)}}function Ta(i,t){if(i&1){let e=k();s(0,"nile-input",108),u("nile-input",function(o){_(e);let a=r(2);return g(a.librarySearch.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r(2);return g(a.librarySearch.set((o.detail==null?null:o.detail.value)??""))}),C(1,"nile-glyph",109),d(),m(2,Aa,7,4,"div",110)(3,Sa,3,0,"div",111)}if(i&2){let e=r(2);b("placeholder",e.copy().librarySearchDashboardsPlaceholder)("value",e.librarySearch()),l(2),h(e.templateCategoriesLoading()?3:2)}}function qa(i,t){if(i&1&&(s(0,"div",123),C(1,"nile-skeleton-loader",124)(2,"nile-skeleton-loader",125)(3,"nile-skeleton-loader",126)(4,"nile-skeleton-loader",127),d()),i&2){let e=t.$implicit;l(),M("width",e)}}function Da(i,t){if(i&1&&(s(0,"div",118)(1,"div",119),C(2,"nile-skeleton-loader",120)(3,"nile-skeleton-loader",121),d(),s(4,"div",122),F(5,qa,5,1,"div",123,G),d()()),i&2){let e=t.$implicit;l(5),O(e)}}function Fa(i,t){if(i&1&&(s(0,"div",117),F(1,Da,7,0,"div",118,G),d()),i&2){let e=r(3);l(),O(e.librarySkeletonGroups)}}function Oa(i,t){if(i&1){let e=k();s(0,"div",132),u("click",function(){let o=_(e).$implicit,a=r(6);return g(a.openWidgetDetailFromCard(o.templateId))}),C(1,"nile-kpi-chart",133),s(2,"button",134),u("click",function(o){let a=_(e).$implicit,p=r(6);return o.stopPropagation(),g(p.toggleWidgetTemplateSelection(a.templateId))}),C(3,"nile-glyph",135),d()()}if(i&2){let e=t.$implicit,n=r(6);W("aq-lib-card-wrap--selected",n.widgetTemplatePickerSelectedIds().includes(e.templateId)),l(),b("label",e.title)("description",e.desc??"")("value",e.value)("loading",e.loading)("sparkline",e.sparkline)("options",n.libraryKpiChartOptions)("sparklineColor",n.brandSparklineColor()),l(),W("aq-lib-card__check--on",n.widgetTemplatePickerSelectedIds().includes(e.templateId))}}function Ea(i,t){if(i&1){let e=k();s(0,"div",118)(1,"div",119)(2,"span",129),c(3),d(),s(4,"button",130),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.toggleLibraryGroupSelection(o.cards))}),c(5),d()(),s(6,"div",122),F(7,Oa,4,11,"div",131,So),d()()}if(i&2){let e=t.$implicit,n=r(5);l(3),Y("",e.label," \xB7 ",e.cards.length),l(2),q(" ",n.isGroupFullySelected(e.cards)?n.copy().libraryClearSelectionButton:n.copy().librarySelectAllButton," "),l(2),O(e.cards)}}function Ia(i,t){if(i&1&&F(0,Ea,9,3,"div",118,se),i&2){let e=r(4);O(e.libraryWidgetGroups())}}function Va(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(4);l(),y(e.librarySearch()?e.copy().noWidgetsMatch:e.copy().noWidgetsInCategory)}}function Ra(i,t){if(i&1&&m(0,Ia,2,0)(1,Va,2,1,"div",128),i&2){let e=r(3);h(e.libraryWidgetGroups().length?0:1)}}function za(i,t){if(i&1&&m(0,Fa,3,0,"div",117)(1,Ra,2,1),i&2){let e=r(2);h(e.templateCategoriesLoading()||e.widgetTemplateTemplatesLoading()?0:1)}}function Na(i,t){if(i&1&&(s(0,"div",137),C(1,"nile-skeleton-loader",138),s(2,"div",139),C(3,"nile-skeleton-loader",124)(4,"nile-skeleton-loader",126)(5,"nile-skeleton-loader",140),d()()),i&2){let e=t.$implicit;l(3),M("width",e)}}function La(i,t){if(i&1&&(s(0,"div",118)(1,"div",119),C(2,"nile-skeleton-loader",120),d(),s(3,"div",136),F(4,Na,6,1,"div",137,G),d()()),i&2){let e=t.$implicit;l(4),O(e)}}function $a(i,t){if(i&1&&(s(0,"div",117),F(1,La,6,0,"div",118,G),d()),i&2){let e=r(3);l(),O(e.librarySkeletonGroups)}}function Wa(i,t){if(i&1&&(s(0,"div",144),C(1,"db-dash-card-chart",152),d()),i&2){let e=r().$implicit;l(),b("config",e.preview)}}function Ba(i,t){i&1&&(s(0,"div",145),C(1,"span",153)(2,"span",154)(3,"span",155)(4,"span",156)(5,"span",157),d())}function Ua(i,t){if(i&1&&(s(0,"span",146),C(1,"nile-glyph",158),c(2),d()),i&2){let e=r().$implicit,n=r(5);l(2),q(" ",n.withCount(n.copy().libraryWidgetCountChip,(e.widgets==null?null:e.widgets.length)??0)," ")}}function Ga(i,t){if(i&1&&(s(0,"div",150),c(1),d()),i&2){let e=r().$implicit;l(),y(e.description)}}function ja(i,t){if(i&1){let e=k();s(0,"button",142),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.openWidgetDetailPanelForTemplate(o))}),s(1,"div",143),m(2,Wa,2,1,"div",144)(3,Ba,6,0,"div",145),m(4,Ua,3,1,"span",146),d(),s(5,"div",147)(6,"div",148)(7,"span",149),c(8),d(),m(9,Ga,2,1,"div",150),d(),C(10,"nile-glyph",151),d()()}if(i&2){let e=t.$implicit;l(2),h(e.preview!=null&&e.preview.chart?2:3),l(2),h(e.widgets!=null&&e.widgets.length?4:-1),l(4),y(e.name),l(),h(e.description?9:-1)}}function Ha(i,t){if(i&1&&(s(0,"div",118)(1,"div",119)(2,"span",129),c(3),d()(),s(4,"div",136),F(5,ja,11,4,"button",141,te),d()()),i&2){let e=t.$implicit;l(3),Y("",e.label," \xB7 ",e.templates.length),l(2),O(e.templates)}}function Ya(i,t){if(i&1&&F(0,Ha,7,2,"div",118,se),i&2){let e=r(3);O(e.libraryDashboardGroups())}}function Ka(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(3);l(),y(e.librarySearch()?e.copy().noDashboardsMatch:e.copy().noDashboardsInCategory)}}function Qa(i,t){if(i&1&&m(0,$a,3,0,"div",117)(1,Ya,2,0)(2,Ka,2,1,"div",128),i&2){let e=r(2);h(e.templateTemplatesLoading()?0:e.libraryDashboardGroups().length?1:2)}}function Xa(i,t){if(i&1){let e=k();s(0,"div",107)(1,"span",159),c(2),d(),s(3,"nile-button",22),u("click",function(){_(e);let o=r(2);return g(o.addSelectedWidgetTemplates())}),C(4,"nile-glyph",160),c(5),d()()}if(i&2){let e=r(2);l(2),q(" ",e.withCount(e.copy().librarySelectedCount,e.widgetTemplatePickerSelectedIds().length)," "),l(3),q(" ",e.withCount(e.copy().libraryAddToCanvasButton,e.widgetTemplatePickerSelectedIds().length)," ")}}function Ja(i,t){if(i&1){let e=k();s(0,"div",13)(1,"div",99)(2,"p",100)(3,"strong",101),c(4),d(),c(5),d(),s(6,"nile-nav-tab-group",102),u("nile-tab-change",function(o){_(e);let a=r();return a.artifactPickerTab.set(o.detail.value),a.widgetTemplatePickerSelectedIds.set([]),g(a.librarySearch.set(""))}),s(7,"nile-nav-tab",103),c(8),s(9,"span",104),c(10),d()(),s(11,"nile-nav-tab",105),c(12),s(13,"span",104),c(14),d()()(),m(15,ka,4,3)(16,Ta,4,3),d(),s(17,"div",106),m(18,za,2,1)(19,Qa,3,1),d(),m(20,Xa,6,2,"div",107),d()}if(i&2){let e=r();l(4),y(e.copy().libraryIntroTitle),l(),q(" ",e.copy().libraryIntro," "),l(),M("value",e.artifactPickerTab()),l(2),y(e.copy().libraryWidgetsTabLabel),l(2),y(e.widgetTemplateAllTemplates().length),l(2),y(e.copy().libraryDashboardsTabLabel),l(2),y(e.templateAllTemplates().length),l(),h(e.artifactPickerTab()==="kpis"?15:16),l(3),h(e.artifactPickerTab()==="kpis"?18:19),l(2),h(e.artifactPickerTab()==="kpis"&&e.widgetTemplatePickerSelectedIds().length?20:-1)}}function Za(i,t){i&1&&(s(0,"div",182),C(1,"nile-skeleton-loader",183)(2,"nile-skeleton-loader",184),d())}function er(i,t){if(i&1&&F(0,Za,3,0,"div",182,G),i&2){let e=r(2);O(e.cohortCriteriaSkeletonRows)}}function tr(i,t){if(i&1&&(s(0,"p",185),c(1),d()),i&2){let e=r(3);l(),y(e.copy().cohortLogUnavailableMessage)}}function nr(i,t){if(i&1){let e=k();s(0,"p",185),c(1),d(),s(2,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.retryCohortCriteria())}),c(3),d()}if(i&2){let e=r(3);l(),y(e.copy().cohortCriteriaErrorMessage),l(2),q(" ",e.copy().cohortPreviewRetryButton," ")}}function ir(i,t){i&1&&(s(0,"div",170),m(1,tr,2,1,"p",185)(2,nr,4,2),d()),i&2&&(l(),h(t==="unavailable"?1:2))}function or(i,t){if(i&1){let e=k();s(0,"button",187),u("click",function(){let o=_(e).$implicit,a=r(3);return g(a.selectCohortCriterion(o.id))}),C(1,"span",188),s(2,"span",189),c(3),d()()}if(i&2){let e=t.$implicit,n=r(3);W("is-selected",n.selectedCriterionId()===e.id),M("aria-checked",n.selectedCriterionId()===e.id),l(3),y(e.label)}}function ar(i,t){if(i&1&&F(0,or,4,4,"button",186,te),i&2){let e=r(2);O(e.cohortCriteria())}}function rr(i,t){i&1&&(s(0,"div",191)(1,"span",192),C(2,"nile-skeleton-loader",76),d(),C(3,"nile-skeleton-loader",193)(4,"nile-skeleton-loader",194),d())}function lr(i,t){if(i&1&&(s(0,"div",171),C(1,"nile-skeleton-loader",190),F(2,rr,5,0,"div",191,G),d()),i&2){let e=r(2);l(2),O(e.cohortMatchSkeletonRows)}}function sr(i,t){if(i&1&&(s(0,"p",196),c(1),d()),i&2){let e=r(3);l(),y(e.copy().cohortEmptyMatchesMessage)}}function dr(i,t){if(i&1&&(s(0,"p",196),c(1),d()),i&2){let e=r(3);l(),y(e.copy().cohortNamesWithheldMessage)}}function cr(i,t){if(i&1&&(s(0,"span",201),c(1),d()),i&2){let e=r().$implicit;l(),q("",e.daysInState,"d")}}function pr(i,t){if(i&1&&(s(0,"div",198)(1,"span",200),c(2),d(),m(3,cr,2,1,"span",201),d()),i&2){let e=t.$implicit;l(2),y(e.name??"\u2014"),l(),h(e.daysInState!==null&&e.daysInState!==void 0?3:-1)}}function _r(i,t){i&1&&(s(0,"div",202)(1,"span",192),C(2,"nile-skeleton-loader",76),d(),C(3,"nile-skeleton-loader",193)(4,"nile-skeleton-loader",194),d())}function gr(i,t){if(i&1&&F(0,_r,5,0,"div",202,G),i&2){let e=r(4);O(e.cohortMatchSkeletonRows)}}function ur(i,t){if(i&1&&(s(0,"p",199),c(1),d()),i&2){let e=r(4);l(),y(e.cohortMatchesTruncatedNote())}}function mr(i,t){if(i&1&&(s(0,"p",199),c(1),d()),i&2){let e=r(4);l(),y(e.copy().cohortMembersForbiddenMessage)}}function hr(i,t){if(i&1&&(s(0,"p",199),c(1),d()),i&2){let e=r(5);l(),y(e.copy().cohortMembersErrorMessage)}}function Cr(i,t){if(i&1){let e=k();s(0,"button",204),u("click",function(){_(e);let o=r(5);return g(o.toggleAllCohortMatches())}),c(1),d()}if(i&2){let e=r(5);b("disabled",e.cohortMembersLoading()),M("aria-expanded",e.cohortMatchesExpanded())("aria-busy",e.cohortMembersLoading()?"true":null),l(),y(e.cohortViewAllLabel())}}function fr(i,t){if(i&1&&(m(0,hr,2,1,"p",199),m(1,Cr,2,4,"button",203)),i&2){let e=r(4);h(e.cohortMembersError()==="failed"?0:-1),l(),h(e.cohortHasMoreMatches()?1:-1)}}function xr(i,t){if(i&1&&(s(0,"div",197),F(1,pr,4,2,"div",198,To),m(3,gr,2,0),d(),m(4,ur,2,1,"p",199),m(5,mr,2,1,"p",199)(6,fr,2,2)),i&2){let e=r(3);W("is-expanded",e.cohortMatchesExpanded()),l(),O(e.visibleCohortMatches()),l(2),h(e.cohortMembersLoading()?3:-1),l(),h(e.cohortMatchesExpanded()&&e.cohortMatchesTruncated()?4:-1),l(),h(e.cohortMembersError()==="forbidden"?5:6)}}function yr(i,t){if(i&1&&(s(0,"div",172)(1,"p",195),c(2),d(),m(3,sr,2,1,"p",196)(4,dr,2,1,"p",196)(5,xr,7,5),d()),i&2){let e=r(2);l(2),y(e.cohortMatchSummary()),l(),h(t.matchCount===0?3:e.cohortNamesWithheld()?4:5)}}function br(i,t){if(i&1&&(s(0,"p",185),c(1),d()),i&2){let e=r(3);l(),y(e.copy().cohortLogUnavailableMessage)}}function vr(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){let o=_(e),a=r(4);return g(a.selectCohortCriterion(o))}),c(1),d()}if(i&2){let e=r(4);l(),q(" ",e.copy().cohortPreviewRetryButton," ")}}function wr(i,t){if(i&1&&(s(0,"p",185),c(1),d(),m(2,vr,2,1,"nile-button",205)),i&2){let e,n=r(3);l(),y(n.copy().cohortPreviewErrorMessage),l(),h((e=n.selectedCriterionId())?2:-1,e)}}function kr(i,t){i&1&&(s(0,"div",173),m(1,br,2,1,"p",185)(2,wr,3,2),d()),i&2&&(l(),h(t==="unavailable"?1:2))}function Pr(i,t){if(i&1){let e=k();s(0,"div",14)(1,"div",161)(2,"span",162),C(3,"nile-glyph",163),d(),s(4,"span",164),c(5),d()(),s(6,"p",165),c(7),d(),s(8,"div",166)(9,"span",167),c(10,"1"),d(),s(11,"span",168),c(12),d()(),s(13,"div",169),m(14,er,2,0)(15,ir,3,1,"div",170)(16,ar,2,0),d(),s(17,"div",166)(18,"span",167),c(19,"2"),d(),s(20,"span",168),c(21),d()(),m(22,lr,4,0,"div",171)(23,yr,6,2,"div",172)(24,kr,3,1,"div",173),C(25,"div",174),s(26,"div",175)(27,"p",176),c(28),d(),s(29,"div",177)(30,"nile-button",178),u("click",function(){_(e);let o=r();return g(o.addCohortToCanvas())}),C(31,"nile-glyph",179),c(32),d(),s(33,"nile-button",180),u("click",function(){_(e);let o=r();return g(o.addCohortToCanvas())}),C(34,"nile-glyph",181),c(35),d()()()()}if(i&2){let e,n,o=r();l(5),y(o.copy().cohortBuilderTitle),l(2),y(o.copy().cohortBuilderSubtitle),l(5),y(o.copy().cohortStep1Label),l(),M("aria-label",o.copy().cohortStep1Label),l(),h(o.cohortCriteriaLoading()&&!o.cohortCriteria().length?14:(e=o.cohortCriteriaError())?15:16,e),l(7),y(o.copy().cohortStep2Label),l(),h(o.cohortPreviewLoading()?22:(n=o.cohortPreview())?23:(n=o.cohortPreviewError())?24:-1,n),l(6),y(o.copy().cohortAddToCanvasDisclaimer),l(2),M("disabled",o.cohortPreview()?null:""),l(2),q(" ",o.copy().cohortPreviewWidgetButton," "),l(),M("disabled",o.cohortPreview()?null:""),l(2),q(" ",o.copy().cohortAddToCanvasButton," ")}}function Ar(i,t){i&1&&(s(0,"div",216),C(1,"nile-skeleton-loader",217),s(2,"div",218),C(3,"nile-skeleton-loader",78),d()())}function Mr(i,t){i&1&&(s(0,"div",215),F(1,Ar,4,0,"div",216,G),d()),i&2&&(l(),O(pe(0,Mo)))}function Sr(i,t){if(i&1&&(s(0,"span",225),c(1),d()),i&2){let e=r().$implicit;l(),y(e.badge)}}function Tr(i,t){if(i&1){let e=k();s(0,"button",222),u("click",function(){let o=_(e).$implicit,a=r(5);return g(a.onWelcomePromptPick(o))}),C(1,"nile-glyph",223),s(2,"span",224),c(3),d(),m(4,Sr,2,1,"span",225),d()}if(i&2){let e=t.$implicit;W("prompt-card--ai",e.tone==="ai"),l(),M("name",e.icon)("color",e.tone==="ai"?"#7a5af8":"var(--ng-colors-text-quaternary-500)"),l(2),y(e.label),l(),h(e.badge?4:-1)}}function qr(i,t){if(i&1&&(s(0,"div",219),F(1,Tr,5,6,"button",221,Ei),d()),i&2){let e=r(4);l(),O(e.welcomePromptCards())}}function Dr(i,t){if(i&1){let e=k();s(0,"button",227),u("click",function(){_(e);let o=r(5);return g(o.openGallery())}),C(1,"nile-glyph",228),s(2,"span"),c(3),d()()}if(i&2){let e=r(5);l(3),y(e.copy().promptGalleryLabel)}}function Fr(i,t){if(i&1){let e=k();s(0,"button",227),u("click",function(){_(e);let o=r(5);return g(o.openXray())}),C(1,"nile-glyph",229),s(2,"span"),c(3),d()()}if(i&2){let e=r(5);l(3),y(e.copy().xrayLabel)}}function Or(i,t){if(i&1&&(s(0,"div",220),m(1,Dr,4,1,"button",226),m(2,Fr,4,1,"button",226),d()),i&2){let e=r(4);l(),h(e.features().promptGallery?1:-1),l(),h(e.features().xray?2:-1)}}function Er(i,t){if(i&1&&(m(0,qr,3,0,"div",219),m(1,Or,3,2,"div",220)),i&2){let e=r(3);h(e.features().welcomePrompts?0:-1),l(),h(e.features().promptGallery||e.features().xray?1:-1)}}function Ir(i,t){if(i&1&&(s(0,"div",206)(1,"div",208)(2,"div",209),C(3,"nile-glyph",210),d(),s(4,"h2",211),c(5),d(),s(6,"p",212),c(7),d(),s(8,"div",213),fe(9,214),d(),m(10,Mr,3,1,"div",215)(11,Er,2,2),d()()),i&2){let e=r(2),n=de(8);l(5),y(e.copy().welcomeTitle),l(2),y(e.copy().welcomeSubtitle),l(2),b("ngTemplateOutlet",n),l(),h(e.features().welcomePrompts&&!e.welcomePromptCards().length?10:11)}}function Vr(i,t){i&1&&(s(0,"div",232),C(1,"nile-skeleton-loader",233),d(),s(2,"div",234),C(3,"nile-skeleton-loader",235)(4,"nile-skeleton-loader",236)(5,"nile-skeleton-loader",237),d(),s(6,"div",232),C(7,"nile-skeleton-loader",238),d(),s(8,"div",234),C(9,"nile-skeleton-loader",239)(10,"nile-skeleton-loader",240),d())}function Rr(i,t){if(i&1&&(s(0,"div",242),C(1,"nile-glyph",246),s(2,"span",247),c(3),d()()),i&2){let e=r(2).$implicit;l(3),y(e.quotedText)}}function zr(i,t){if(i&1&&(s(0,"span",252),c(1),d()),i&2){let e=r().$implicit;l(),y(e.answer)}}function Nr(i,t){if(i&1&&(s(0,"div",248),C(1,"nile-glyph",249),s(2,"div",250)(3,"span",251),c(4),d(),m(5,zr,2,1,"span",252),d()()),i&2){let e=t.$implicit;l(4),y(e.title),l(),h(e.answer&&e.answer!=="Use this"?5:-1)}}function Lr(i,t){if(i&1&&(s(0,"div",243),F(1,Nr,6,2,"div",248,G),d()),i&2){let e=r(2).$implicit,n=r(4);l(),O(n.answerSummaryRows(e))}}function $r(i,t){if(i&1&&(s(0,"span",244),c(1),d()),i&2){let e=r(2).$implicit;l(),y(e.text)}}function Wr(i,t){if(i&1&&(s(0,"div",253),C(1,"nile-glyph",254),s(2,"span",255),c(3),d()()),i&2){let e=t.$implicit;l(),M("name",e.contentType.startsWith("image/")?"ng-image-03":"ng-file-06"),l(),M("title",e.name),l(),y(e.name)}}function Br(i,t){if(i&1&&(s(0,"div",245),F(1,Wr,4,3,"div",253,se),d()),i&2){let e=r(2).$implicit;l(),O(e.attachments??pe(0,Se))}}function Ur(i,t){if(i&1&&(s(0,"nile-ai-chat-bubble",241),m(1,Rr,4,1,"div",242),m(2,Lr,3,0,"div",243)(3,$r,2,1,"span",244),m(4,Br,3,1,"div",245),d()),i&2){let e=r().$implicit;b("role","user"),l(),h(e.quotedText?1:-1),l(),h(e.answerSummary?2:3),l(2),h(e.attachments!=null&&e.attachments.length?4:-1)}}function Gr(i,t){if(i&1&&C(0,"nile-ai-steps",256),i&2){let e=r(2).$implicit;b("steps",e.tools)}}function jr(i,t){if(i&1&&C(0,"nile-ai-token-stream",265),i&2){let e=r(4).$implicit,n=r(4);b("text",n.cleanText(e.text))("speedMs",n.streamSpeed)}}function Hr(i,t){if(i&1&&C(0,"nile-markdown",266),i&2){let e=r(4).$implicit,n=r(4);b("value",n.cleanMarkdown(e.text))}}function Yr(i,t){if(i&1&&m(0,jr,1,2,"nile-ai-token-stream",265)(1,Hr,1,1,"nile-markdown",266),i&2){let e=r(3).$implicit;h(e.isStreaming?0:1)}}function Kr(i,t){if(i&1&&(s(0,"span",267),c(1),d()),i&2){let e=r().$implicit;l(),Y("Setup ",e.step.current," of ",e.step.total)}}function Qr(i,t){i&1&&(s(0,"span",276),c(1),d()),i&2&&(l(),y(t))}function Xr(i,t){if(i&1&&(s(0,"span",278),c(1),d()),i&2){let e=r().$implicit;l(),y(e.hint)}}function Jr(i,t){if(i&1&&(s(0,"span"),c(1),d()),i&2){let e=r().$implicit;at("choice-card__chip"+(e.tone?" choice-card__chip--"+e.tone:"")),l(),y(e.text)}}function Zr(i,t){if(i&1&&m(0,Jr,2,3,"span",280),i&2){let e=t.$implicit;h(e.tone!=="green"&&e.tone!=="yellow"&&e.tone!=="red"?0:-1)}}function el(i,t){if(i&1&&(s(0,"span",279),F(1,Zr,1,1,null,null,G),d()),i&2){let e=r().$implicit;l(),O(e.meta)}}function tl(i,t){if(i&1&&(s(0,"nile-radio",272)(1,"span",273)(2,"span",274),c(3),d(),s(4,"span",275),m(5,Qr,2,1,"span",276),s(6,"span",277),c(7),d(),m(8,Xr,2,1,"span",278),m(9,el,3,0,"span",279),d()()()),i&2){let e,n=t.$implicit,o=t.$index,a=t.$index,p=r(2).$implicit,x=r(3).$implicit,v=r(4);W("choice-card--chosen",(p.selected||p.draftSelection)===n.id)("choice-card--locked",!!p.selected||v.isStreaming()),M("name","choice-"+x.id+"-"+o)("value",n.id)("checked",(p.selected||p.draftSelection)===n.id?"":null)("disabled",p.selected||v.isStreaming()?"":null),l(3),y(a+1),l(2),h((e=v.optionBadgeText(n))?5:-1,e),l(2),y(v.optionPrimaryText(n)),l(),h(!v.optionBadgeText(n)&&n.hint?8:-1),l(),h(n.meta!=null&&n.meta.length?9:-1)}}function nl(i,t){if(i&1){let e=k();s(0,"nile-radio-group",270),u("nile-change",function(o){_(e);let a=r().$implicit,p=r(3).$implicit,x=r(4);return g(x.onChoiceChange(p,a,o.detail.value))}),F(1,tl,10,13,"nile-radio",271,te),d()}if(i&2){let e=r(),n=e.$implicit,o=e.$index,a=r(3).$implicit,p=r(4);M("label",n.prompt||"Choose an index")("name","choice-"+a.id+"-"+o)("value",n.selected||n.draftSelection||null)("disabled",n.selected||p.isStreaming()?"":null),l(),O(n.options)}}function il(i,t){if(i&1&&(s(0,"p",269),c(1),d()),i&2){let e=r(8);l(),y(e.copy().noChoiceOptions)}}function ol(i,t){if(i&1&&c(0),i&2){let e=r(3).$implicit;q(" \u2713 Something else: ",e.chatDraftText," (edit) ")}}function al(i,t){if(i&1&&(C(0,"nile-glyph",286),c(1)),i&2){let e=r(10);l(),q(" ",e.copy().somethingElseButton," ")}}function rl(i,t){if(i&1){let e=k();s(0,"button",283),u("click",function(){_(e);let o=r(3).$implicit,a=r(3).$implicit,p=r(4);return g(p.requestPlan(a,o))}),c(1),d()}if(i&2){let e=r(10);b("disabled",e.isStreaming()),l(),q(" ",e.copy().givePlanButton," ")}}function ll(i,t){if(i&1){let e=k();s(0,"button",287),u("click",function(){_(e);let o=r(3).$implicit,a=r(3).$implicit,p=r(4);return g(p.previewWidget(a,o))}),C(1,"nile-glyph",288),c(2),d()}if(i&2){let e=r(3).$implicit,n=r(7);b("disabled",n.isStreaming()),l(2),q(' Preview "',n.choiceTitle(e),'" ')}}function sl(i,t){if(i&1){let e=k();s(0,"div",281)(1,"button",283),u("click",function(){_(e);let o=r(2).$implicit,a=r(3).$implicit,p=r(4);return g(p.openChatDraft(a,o))}),m(2,ol,1,1)(3,al,2,1),d(),m(4,rl,2,2,"button",284),m(5,ll,3,2,"button",285),d()}if(i&2){let e=r(2).$implicit,n=r(7);l(),b("disabled",n.isStreaming()),l(),h(e.chatDraftText!=null&&e.chatDraftText.trim()?2:3),l(2),h(e.kind==="clarification"?4:-1),l(),h(e.kind==="widget_plan"?5:-1)}}function dl(i,t){if(i&1){let e=k();s(0,"div",282)(1,"span",289),c(2,"Something else"),d(),s(3,"div",290)(4,"nile-input",291),u("nile-input",function(o){_(e);let a=r(2).$implicit,p=r(3).$implicit,x=r(4);return g(x.onChatDraftTextChange(p,a,o.detail.value))})("keydown.enter",function(){_(e);let o=r(2).$implicit,a=r(3).$implicit,p=r(4);return g(p.defineChatDraft(a,o))}),d(),s(5,"nile-button",22),u("click",function(){_(e);let o=r(2).$implicit,a=r(3).$implicit,p=r(4);return g(p.defineChatDraft(a,o))}),c(6),d()()()}if(i&2){let e=r(2).$implicit,n=r(7);l(4),b("value",e.chatDraftText??""),M("placeholder",e.kind==="widget_clarification"?n.copy().chatDraftPlaceholderWidget:e.kind==="widget_plan"?n.copy().chatDraftPlaceholderPlan:e.kind==="plan_intake"?n.copy().chatDraftPlaceholderIntake:n.copy().chatDraftPlaceholderClarification)("disabled",n.isStreaming()?"":null),l(),M("disabled",!(e.chatDraftText!=null&&e.chatDraftText.trim())||n.isStreaming()?"":null),l(),q(" ",n.copy().defineItButton," ")}}function cl(i,t){if(i&1&&m(0,sl,6,4,"div",281)(1,dl,7,5,"div",282),i&2){let e=r().$implicit;h(e.chatOpen?1:0)}}function pl(i,t){if(i&1&&(s(0,"div",259),m(1,Kr,2,2,"span",267),m(2,nl,3,4,"nile-radio-group",268)(3,il,2,1,"p",269),m(4,cl,2,1),d()),i&2){let e=t.$implicit;l(),h(e.step?1:-1),l(),h(e.options.length?2:3),l(2),h((e.kind==="widget_clarification"||e.kind==="clarification"||e.kind==="widget_plan"||e.kind==="plan_intake")&&!e.selected&&e.options.length?4:-1)}}function _l(i,t){if(i&1){let e=k();s(0,"button",292),u("click",function(){_(e);let o=r(3).$implicit,a=r(4);return g(a.resumeChoicePanel(o))}),c(1),d()}if(i&2){let e=r(3).$implicit,n=r(4);l(),Y(" ",n.panelAnsweredCount(e.choices??pe(2,Se))," of ",(e.choices??pe(3,Se)).length," answered \u2014 Resume ")}}function gl(i,t){i&1&&(s(0,"span",294),C(1,"span",300),c(2,"Live "),d())}function ul(i,t){i&1&&(s(0,"span",295),c(1,"Preview"),d())}function ml(i,t){i&1&&C(0,"div",303)}function hl(i,t){if(i&1&&C(0,"nile-glyph",307),i&2){let e=r().$implicit;Z("color",e.color),b("name",e.glyph)("method",e.method||"stroke")}}function Cl(i,t){if(i&1){let e=k();m(0,ml,1,0,"div",303),s(1,"nile-menu-item",304),u("click",function(){let o=_(e).$implicit;r();let a=de(1),p=r(4).$implicit;return r(4).onInlineWidgetMenuItem(p,o),g(a.hide())}),s(2,"span",305),m(3,hl,1,4,"nile-glyph",306),c(4),d()()}if(i&2){let e=t.$implicit;h(e.divider?0:-1),l(3),h(e.glyph?3:-1),l(),q(" ",e.label," ")}}function fl(i,t){if(i&1&&(s(0,"nile-dropdown",296,4)(2,"button",301),C(3,"nile-glyph",302),d(),s(4,"nile-menu"),F(5,Cl,5,3,null,null,se),d()()),i&2){let e=r(4).$implicit,n=r(4);l(5),O(n.inlineWidgetMenuItems(e))}}function xl(i,t){i&1&&(s(0,"div",311),C(1,"nile-spinner",314),s(2,"span"),c(3,"Loading chart types\u2026"),d()())}function yl(i,t){if(i&1&&(s(0,"p",312),c(1),d()),i&2){let e=r(9);l(),y(e.copy().noChartTypesFit)}}function bl(i,t){i&1&&C(0,"nile-spinner",314)}function vl(i,t){if(i&1&&C(0,"nile-glyph",319),i&2){let e=r().$implicit,n=r(11);b("name",n.chartTypeIcon(e.type))}}function wl(i,t){if(i&1){let e=k();s(0,"button",318),u("click",function(){let o=_(e).$implicit,a=r(11);return g(a.selectInlineChartType(o.component))}),m(1,bl,1,0,"nile-spinner",314)(2,vl,1,1,"nile-glyph",319),s(3,"span"),c(4),d()()}if(i&2){let e=t.$implicit,n=r(11);M("disabled",n.inlineChartTypeApplying()?"":null),l(),h(n.inlineChartTypeApplyingComponent()===e.component?1:2),l(3),y(e.label)}}function kl(i,t){if(i&1&&(s(0,"p",315),c(1,"Recommended"),d(),s(2,"div",316),F(3,wl,5,3,"button",317,Ii),d()),i&2){let e=r(10);l(3),O(e.inlineSensibleChartTypes())}}function Pl(i,t){i&1&&C(0,"nile-spinner",314)}function Al(i,t){if(i&1&&C(0,"nile-glyph",319),i&2){let e=r().$implicit,n=r(11);b("name",n.chartTypeIcon(e.type))}}function Ml(i,t){if(i&1){let e=k();s(0,"button",321),u("click",function(){let o=_(e).$implicit,a=r(11);return g(a.selectInlineChartType(o.component))}),m(1,Pl,1,0,"nile-spinner",314)(2,Al,1,1,"nile-glyph",319),s(3,"span"),c(4),d()()}if(i&2){let e=t.$implicit,n=r(11);M("disabled",n.inlineChartTypeApplying()?"":null),l(),h(n.inlineChartTypeApplyingComponent()===e.component?1:2),l(3),y(e.label)}}function Sl(i,t){if(i&1&&(s(0,"p",315),c(1,"Other types"),d(),s(2,"div",316),F(3,Ml,5,3,"button",320,Ii),d()),i&2){let e=r(10);l(3),O(e.inlineOtherChartTypes())}}function Tl(i,t){if(i&1&&(m(0,kl,5,0),m(1,Sl,5,0)),i&2){let e=r(9);h(e.inlineSensibleChartTypes().length>0?0:-1),l(),h(e.inlineOtherChartTypes().length>0?1:-1)}}function ql(i,t){if(i&1&&(s(0,"p",313),c(1),d()),i&2){let e=r(9);l(),y(e.inlineChartTypeError())}}function Dl(i,t){if(i&1){let e=k();s(0,"nile-dropdown",308),u("nile-hide",function(){_(e);let o=r(8);return g(o.closeInlineChartTypePicker())}),C(1,"span",309),s(2,"div",310),m(3,xl,4,0,"div",311)(4,yl,2,1,"p",312)(5,Tl,2,2),m(6,ql,2,1,"p",313),d()()}if(i&2){let e=r(4).$implicit,n=r(4);b("open",n.inlineChartTypePickerFor()===e.charts[0]),l(3),h(n.inlineChartTypeLoading()?3:n.inlineChartTypeOptions().length===0?4:5),l(3),h(n.inlineChartTypeError()?6:-1)}}function Fl(i,t){if(i&1){let e=k();s(0,"span",324),c(1),s(2,"button",325),u("click",function(){let o=_(e).$implicit,a=r(6).$implicit,p=r(4);return g(p.removeInlineFilter(a.charts[0],o.id))}),C(3,"nile-glyph",326),d()()}if(i&2){let e=t.$implicit,n=r(6).$implicit,o=r(4);l(),q(" ",o.inlineFilterChipLabel(n.charts[0],e)," "),l(),M("disabled",o.inlineFilterApplying()?"":null)}}function Ol(i,t){if(i&1&&(s(0,"div",323),F(1,Fl,4,2,"span",324,te),d()),i&2){let e=r(5).$implicit,n=r(4);l(),O(n.inlineActiveFilters(e.charts[0]))}}function El(i,t){i&1&&(s(0,"div",311),C(1,"nile-spinner",314),s(2,"span"),c(3,"Loading filterable fields\u2026"),d()())}function Il(i,t){if(i&1&&(s(0,"p",313),c(1),d()),i&2){let e=r(9);l(),y(e.inlineFilterFieldsError())}}function Vl(i,t){if(i&1&&(s(0,"p",312),c(1),d()),i&2){let e=r(9);l(),y(e.copy().noFilterableFields)}}function Rl(i,t){if(i&1&&(s(0,"option",329),c(1),d()),i&2){let e=t.$implicit;b("value",e.name),l(),y(e.label)}}function zl(i,t){if(i&1&&(s(0,"option",329),c(1),d()),i&2){let e=t.$implicit;b("value",e.value),l(),y(e.label)}}function Nl(i,t){i&1&&(s(0,"div",311),C(1,"nile-spinner",330),s(2,"span"),c(3,"Loading values\u2026"),d()())}function Ll(i,t){if(i&1){let e=k();s(0,"input",334),u("ngModelChange",function(o){_(e);let a=r(11);return g(a.inlineFilterBuilderValue.set(o))})("keydown.enter",function(){_(e);let o=r(7).$implicit,a=r(4);return g(a.addInlineFilter(o.charts[0]))}),d()}if(i&2){let e=r(11);b("placeholder",e.copy().filterValuePlaceholder)("ngModel",e.inlineFilterBuilderValue())}}function $l(i,t){if(i&1){let e=k();s(0,"span",336),c(1,"and"),d(),s(2,"input",335),u("ngModelChange",function(o){_(e);let a=r(12);return g(a.inlineFilterBuilderValue2.set(o))}),d()}if(i&2){let e=r(12);l(2),b("ngModel",e.inlineFilterBuilderValue2())}}function Wl(i,t){if(i&1){let e=k();s(0,"input",335),u("ngModelChange",function(o){_(e);let a=r(11);return g(a.inlineFilterBuilderValue.set(o))}),d(),m(1,$l,3,1)}if(i&2){let e,n=r(7).$implicit,o=r(4);b("ngModel",o.inlineFilterBuilderValue()),l(),h((e=o.inlineFilterSelectedOperator(n.charts[0]))!=null&&e.needsSecondValue?1:-1)}}function Bl(i,t){if(i&1){let e=k();s(0,"span",336),c(1,"and"),d(),s(2,"input",338),u("ngModelChange",function(o){_(e);let a=r(12);return g(a.inlineFilterBuilderValue2.set(o))}),d()}if(i&2){let e=r(12);l(2),b("placeholder",e.copy().filterValuePlaceholder)("ngModel",e.inlineFilterBuilderValue2())}}function Ul(i,t){if(i&1){let e=k();s(0,"input",337),u("ngModelChange",function(o){_(e);let a=r(11);return g(a.inlineFilterBuilderValue.set(o))})("keydown.enter",function(){_(e);let o=r(7).$implicit,a=r(4);return g(a.addInlineFilter(o.charts[0]))}),d(),m(1,Bl,3,2)}if(i&2){let e,n=r(7).$implicit,o=r(4);b("placeholder",o.copy().filterValuePlaceholder)("ngModel",o.inlineFilterBuilderValue()),l(),h((e=o.inlineFilterSelectedOperator(n.charts[0]))!=null&&e.needsSecondValue?1:-1)}}function Gl(i,t){if(i&1){let e=k();s(0,"label",339)(1,"input",340),u("change",function(){let o=_(e).$implicit,a=r(12);return g(a.toggleInlineFilterMultiValue(o.value))}),d(),s(2,"span"),c(3),d()()}if(i&2){let e=t.$implicit,n=r(12);l(),b("checked",n.inlineFilterBuilderValues().includes(e.value)),l(2),Y("",e.label,"",e.count!=null?" ("+e.count+")":"")}}function jl(i,t){if(i&1&&(s(0,"div",332),F(1,Gl,4,3,"label",339,nt),d()),i&2){let e=r(11);l(),O(e.inlineFilterValuesFor(e.inlineFilterBuilderFieldId()))}}function Hl(i,t){if(i&1&&(s(0,"option",329),c(1),d()),i&2){let e=t.$implicit;b("value",e.value),l(),Y("",e.label,"",e.count!=null?" ("+e.count+")":"")}}function Yl(i,t){if(i&1){let e=k();s(0,"select",328),u("ngModelChange",function(o){_(e);let a=r(11);return g(a.inlineFilterBuilderValue.set(o))}),s(1,"option",341),c(2,"Select\u2026"),d(),F(3,Hl,2,3,"option",329,nt),d()}if(i&2){let e=r(11);b("ngModel",e.inlineFilterBuilderValue()),l(3),O(e.inlineFilterValuesFor(e.inlineFilterBuilderFieldId()))}}function Kl(i,t){if(i&1&&m(0,Ll,1,2,"input",331)(1,Wl,2,2)(2,Ul,2,3)(3,jl,3,0,"div",332)(4,Yl,5,1,"select",333),i&2){let e,n=r(6).$implicit,o=r(4);h((e=(e=o.inlineFilterSelectedOperator(n.charts[0]))==null?null:e.valueKind)==="text"?0:e==="date"?1:e==="number"?2:e==="multi-select"?3:e==="select"?4:-1)}}function Ql(i,t){if(i&1&&(s(0,"p",313),c(1),d()),i&2){let e=r(10);l(),y(e.inlineFilterApplyError())}}function Xl(i,t){if(i&1){let e=k();s(0,"div",327)(1,"select",328),u("ngModelChange",function(o){_(e);let a=r(5).$implicit,p=r(4);return g(p.onInlineFilterFieldChange(a.charts[0],o))}),F(2,Rl,2,2,"option",329,qo),d(),s(4,"select",328),u("ngModelChange",function(o){_(e);let a=r(9);return g(a.onInlineFilterOperatorChange(o))}),F(5,zl,2,2,"option",329,nt),d(),m(7,Nl,4,0,"div",311)(8,Kl,5,1),s(9,"nile-button",21),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.addInlineFilter(o.charts[0]))}),c(10," Add filter "),d()(),m(11,Ql,2,1,"p",313)}if(i&2){let e=r(5).$implicit,n=r(4);l(),b("ngModel",n.inlineFilterBuilderFieldId()),l(),O(n.inlineFilterFields(e.charts[0])),l(2),b("ngModel",n.inlineFilterBuilderOperator()),l(),O(n.inlineFilterOperators(e.charts[0])),l(2),h(n.inlineFilterValuesLoading()?7:8),l(2),M("loading",n.inlineFilterApplying()?"":null)("disabled",n.inlineFilterApplying()?"":null),l(2),h(n.inlineFilterApplyError()?11:-1)}}function Jl(i,t){if(i&1){let e=k();s(0,"nile-dropdown",308),u("nile-hide",function(){_(e);let o=r(8);return g(o.closeInlineFilterBuilder())}),C(1,"span",309),s(2,"div",322)(3,"p",312),c(4,"Filters this preview only \u2014 nothing is saved."),d(),m(5,Ol,3,0,"div",323),m(6,El,4,0,"div",311)(7,Il,2,1,"p",313)(8,Vl,2,1,"p",312)(9,Xl,12,6),d()()}if(i&2){let e=r(4).$implicit,n=r(4);b("open",n.inlineFilterPickerFor()===e.charts[0]),l(5),h(n.inlineActiveFilters(e.charts[0]).length>0?5:-1),l(),h(n.inlineFilterFieldsLoading()?6:n.inlineFilterFieldsError()?7:n.inlineFilterFields(e.charts[0]).length===0?8:9)}}function Zl(i,t){if(i&1&&(s(0,"span",342)(1,"span",343),c(2),d(),s(3,"span",344),c(4),d()()),i&2){let e=t.$implicit;l(2),q("",e.label,":"),l(2),y(e.value)}}function es(i,t){if(i&1&&(s(0,"div",298),F(1,Zl,5,2,"span",342,Ei),d()),i&2){let e=r(4).$implicit;l(),O(e.forecastMeta??pe(0,Se))}}function ts(i,t){if(i&1){let e=k();s(0,"nile-button",345),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.tryAlternatePreview(o.charts[0]))}),c(1),d()}if(i&2){let e=r(5).$implicit,n=r(4);b("disabled",n.isStreaming()),l(),q(' Try "',n.previewAltLabel(e.charts[0]),'" instead ')}}function ns(i,t){if(i&1){let e=k();s(0,"nile-button",345),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.skipPreview(o.charts[0]))}),c(1," Skip this widget "),d(),m(2,ts,2,2,"nile-button",346),s(3,"nile-button",347),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.acceptPreview(o.charts[0]))}),C(4,"nile-glyph",160),c(5," Add to dashboard "),d()}if(i&2){let e=r(4).$implicit,n=r(4);b("disabled",n.isStreaming()),l(2),h(n.previewAltLabel(e.charts[0])?2:-1),l(),b("disabled",n.isStreaming())}}function is(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(10);l(),y(e.copy().noResultsMatchFilters)}}function os(i,t){i&1&&fe(0)}function as(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(8).$implicit,p=r(4);return g(p.addInlineToExisting(a.charts,o.id))}),ke(1,os,1,0,"ng-container",353),d()}if(i&2){let e=t.$implicit;r(12);let n=de(40);l(),b("ngTemplateOutlet",n)("ngTemplateOutletContext",rt(2,Oi,e))}}function rs(i,t){if(i&1&&(s(0,"div",80),c(1),d(),F(2,as,2,4,"nile-menu-item",null,te)),i&2){let e=t.$implicit;l(),y(e.label),l(),O(e.items)}}function ls(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(11);l(),y(e.copy().noDashboardsYet)}}function ss(i,t){if(i&1&&F(0,rs,4,1,null,null,se,!1,ls,2,1,"div",46),i&2){let e=r(10);O(e.groupedPickerDashboards())}}function ds(i,t){if(i&1){let e=k();s(0,"nile-dropdown",351),u("nile-hide",function(){_(e);let o=r(9);return g(o.inlinePickerFor.set(null))}),s(1,"nile-button",352),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.inlinePickerFor.set(a.inlinePickerFor()===o.id?null:o.id))}),C(2,"nile-glyph",160),c(3),d(),s(4,"nile-menu",43),u("nile-search-value",function(o){_(e);let a=r(9);return g(a.pickerSearch.set((o.detail==null?null:o.detail.value)??""))}),s(5,"nile-menu-item",44),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.addInlineWidget(o.charts))}),C(6,"nile-glyph",45),c(7),d(),m(8,is,2,1,"div",46)(9,ss,3,1),d()()}if(i&2){let e=r(5).$implicit,n=r(4);b("open",n.inlinePickerFor()===e.id),l(),M("loading",n.committingAction()==="add"?"":null)("disabled",n.committingAction()?"":null),l(2),q(" ",n.copy().addToDashboardButton," "),l(),M("noResultsMessage",n.copy().noResultsMatchFilters),l(3),q(" ",n.copy().newDashboardLabel," "),l(),h(n.pickerSearchEmpty()?8:9)}}function cs(i,t){if(i&1){let e=k();s(0,"nile-button",22),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.addInlineDefault(o.charts))}),C(1,"nile-glyph",160),c(2),d()}if(i&2){let e=r(9);M("loading",e.committingAction()==="add"?"":null)("disabled",e.committingAction()?"":null),l(2),q(" ",e.builderOpen()?e.copy().addToCurrentDashboardButton:e.copy().addToDashboardButton," ")}}function ps(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.addToLibrary(o.charts[0]))}),C(1,"nile-glyph",348),c(2),d(),m(3,ds,10,7,"nile-dropdown",349)(4,cs,3,3,"nile-button",350)}if(i&2){let e=r(8);l(2),q(" ",e.copy().addToLibraryButton," "),l(),h(!e.builderOpen()&&e.conversationDashboards().length>1?3:4)}}function _s(i,t){if(i&1){let e=k();s(0,"div",261)(1,"div")(2,"shared-nile-chart-widget",293),u("aiSend",function(o){_(e);let a=r(7);return g(a.onInlineAiSend(o))}),m(3,gl,3,0,"span",294),m(4,ul,2,0,"span",295),m(5,fl,7,0,"nile-dropdown",296),m(6,Dl,7,3,"nile-dropdown",297),m(7,Jl,10,3,"nile-dropdown",297),d()(),m(8,es,3,1,"div",298),s(9,"div",299),m(10,ns,6,3)(11,ps,5,2),d()()}if(i&2){let e=r(3).$implicit,n=r(4);l(),at(n.inlineChartClass(e.charts[0])),l(),b("config",n.inlineDisplayConfig(e.charts[0]))("loading",!!e.forecastRecomputing||n.isInlineRecordsLoading(e.charts[0]))("widgetId",e.id)("conversationId",n.activeConversationId()),l(),h(e.forecast?3:-1),l(),h(n.isPreviewChart(e.charts[0])?4:-1),l(),h(n.inlineWidgetMenuItems(e).length?5:-1),l(),h(n.isFilterChart(e.charts[0])?-1:6),l(),h(n.isFilterChart(e.charts[0])?-1:7),l(),h(e.forecastMeta!=null&&e.forecastMeta.length?8:-1),l(2),h(n.isPreviewChart(e.charts[0])?10:11)}}function gs(i,t){i&1&&(s(0,"span",295),c(1,"Preview"),d(),c(2," \xB7 "))}function us(i,t){if(i&1){let e=k();s(0,"nile-button",345),u("click",function(){_(e);let o=r(5).$implicit,a=r(4);return g(a.tryAlternatePreview(o.charts[0]))}),c(1),d()}if(i&2){let e=r(5).$implicit,n=r(4);b("disabled",n.isStreaming()),l(),q(' Try "',n.previewAltLabel(e.charts[0]),'" instead ')}}function ms(i,t){if(i&1){let e=k();s(0,"div",299)(1,"nile-button",345),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.skipPreview(o.charts[0]))}),c(2," Skip this widget "),d(),m(3,us,2,2,"nile-button",346),s(4,"nile-button",347),u("click",function(){_(e);let o=r(4).$implicit,a=r(4);return g(a.acceptPreview(o.charts[0]))}),C(5,"nile-glyph",160),c(6," Add to dashboard "),d()()}if(i&2){let e=r(4).$implicit,n=r(4);l(),b("disabled",n.isStreaming()),l(2),h(n.previewAltLabel(e.charts[0])?3:-1),l(),b("disabled",n.isStreaming())}}function hs(i,t){if(i&1){let e=k();s(0,"div",354),u("click",function(){_(e);let o=r(3).$implicit,a=r(4);return g(a.openArtifact(o.charts,o.id))}),s(1,"div",355),C(2,"nile-glyph",356),d(),s(3,"div",357)(4,"span",358),c(5),d(),s(6,"span",359),m(7,gs,3,0),c(8),d()(),s(9,"nile-button",22),u("click",function(o){_(e);let a=r(3).$implicit,p=r(4);return o.stopPropagation(),g(p.openArtifact(a.charts,a.id))}),c(10),C(11,"nile-glyph",360),d()(),m(12,ms,7,3,"div",299)}if(i&2){let e=r(3).$implicit,n=r(4);l(5),y(e.dashboardTitle||e.charts[0].title),l(2),h(n.isPreviewChart(e.charts[0])?7:-1),l(),Y(" Dashboard \xB7 ",e.charts.length," widget",e.charts.length!==1?"s":""," "),l(2),q(" ",n.copy().viewButton," "),l(2),h(e.charts.length===1&&n.isPreviewChart(e.charts[0])?12:-1)}}function Cs(i,t){if(i&1){let e=k();s(0,"div",262),C(1,"nile-glyph",361),s(2,"span",362),c(3),d(),s(4,"button",363),u("click",function(){_(e);let o=r(3).$implicit,a=r(4);return g(a.recomputeStoredForecast(o))}),c(5),d()()}if(i&2){let e=r(3).$implicit,n=r(4);l(3),y(n.restoredForecastLabel(e)),l(),b("disabled",n.isStreaming()),l(),q(" ",n.copy().recomputeButton," ")}}function fs(i,t){if(i&1&&C(0,"nile-glyph",366),i&2){let e=r().$implicit;M("name",e.icon)("color",e.tone==="ai"?"#7a5af8":"var(--ng-colors-text-quaternary-500)")}}function xs(i,t){if(i&1&&(s(0,"span",368),c(1),d()),i&2){let e=r().$implicit;l(),y(e.badge)}}function ys(i,t){if(i&1){let e=k();s(0,"button",365),u("click",function(){let o=_(e).$implicit,a=r(4).$implicit,p=r(4);return g(p.onFollowUp(o,a))}),m(1,fs,1,2,"nile-glyph",366),s(2,"span",367),c(3),d(),m(4,xs,2,1,"span",368),d()}if(i&2){let e=t.$implicit,n=r(8);W("follow-up--ai",e.tone==="ai"),b("disabled",n.isStreaming()),l(),h(e.icon?1:-1),l(2),y(e.label),l(),h(e.badge?4:-1)}}function bs(i,t){if(i&1&&(s(0,"div",263),F(1,ys,5,6,"button",364,Do),d()),i&2){let e=r(3).$implicit;l(),O(e.followUps??pe(0,Se))}}function vs(i,t){if(i&1&&(s(0,"div",264),C(1,"nile-glyph",369),s(2,"span",370),c(3),d()()),i&2){let e=r(7);l(3),y(e.copy().errors.assistantErrorFallback)}}function ws(i,t){if(i&1&&(s(0,"nile-ai-chat-bubble",257)(1,"div",258),m(2,Yr,2,1),F(3,pl,5,3,"div",259,G),m(5,_l,2,4,"button",260),m(6,_s,12,13,"div",261)(7,hs,13,6),m(8,Cs,6,3,"div",262),m(9,bs,3,1,"div",263),m(10,vs,4,1,"div",264),d()()),i&2){let e=r(2).$implicit,n=r(4);b("role","ai")("hideIcon",!0),l(2),h(e.text&&!n.suppressTextFor(e)?2:-1),l(),O(n.nonPanelChoices(e)),l(2),h(n.isMultiChoice(e)&&n.isChoicePanelDismissed(e)&&!n.isChoicePanelComplete(e.choices??pe(8,Se))?5:-1),l(),h(e.charts.length===1&&!n.isDataGrid(e.charts[0])?6:e.charts.length?7:-1),l(2),h(n.isRestoredForecast(e)?8:-1),l(),h(e.followUps!=null&&e.followUps.length?9:-1),l(),h(e.hasError?10:-1)}}function ks(i,t){if(i&1&&(m(0,Gr,1,1,"nile-ai-steps",256),m(1,ws,11,9,"nile-ai-chat-bubble",257)),i&2){let e=r().$implicit;h(e.isStreaming&&(e.tools!=null&&e.tools.length)?0:-1),l(),h(e.text||e.charts.length||e.choices!=null&&e.choices.length||e.hasError?1:-1)}}function Ps(i,t){if(i&1&&(m(0,Ur,5,4,"nile-ai-chat-bubble",241),m(1,ks,2,2)),i&2){let e=t.$implicit;h(e.role==="user"?0:-1),l(),h(e.role==="assistant"?1:-1)}}function As(i,t){if(i&1&&F(0,Ps,2,2,null,null,te),i&2){let e=r(3);O(e.messages())}}function Ms(i,t){if(i&1&&(s(0,"span",373),c(1),d()),i&2){let e=r(2);l(),Rt("",t," ",e.index+1," OF ",e.choices.length)}}function Ss(i,t){if(i&1&&(s(0,"span",373),c(1),d()),i&2){let e=r(2);l(),Y("",e.index+1," OF ",e.choices.length)}}function Ts(i,t){i&1&&(s(0,"span",387),c(1),d()),i&2&&(l(),y(t))}function qs(i,t){if(i&1&&(s(0,"span",389),c(1),d()),i&2){let e=r().$implicit;l(),y(e.hint)}}function Ds(i,t){if(i&1){let e=k();s(0,"nile-radio",383),u("click",function(){_(e);let o=r(2),a=r(4);return g(a.onPanelSkip(o.msg))}),s(1,"span",384)(2,"span",385),c(3),d(),s(4,"span",386),m(5,Ts,2,1,"span",387),s(6,"span",388),c(7),d(),m(8,qs,2,1,"span",389),d()()()}if(i&2){let e,n=t.$implicit,o=t.$index,a=r(2),p=r(4);M("name","choice-panel-"+a.msg.id+"-"+a.index)("value",n.id)("checked",(a.choices[a.index].draftSelection||a.choices[a.index].selected)===n.id?"":null)("disabled",p.isStreaming()?"":null),l(3),y(o+1),l(2),h((e=p.optionBadgeText(n))?5:-1,e),l(2),y(p.optionPrimaryText(n)),l(),h(!p.optionBadgeText(n)&&n.hint?8:-1)}}function Fs(i,t){if(i&1){let e=k();s(0,"button",287),u("click",function(){_(e);let o=r(3),a=r(4);return g(a.previewWidget(o.msg,o.choices[o.index]))}),C(1,"nile-glyph",288),c(2),d()}if(i&2){let e=r(3),n=r(4);b("disabled",n.isStreaming()),l(2),q(' Preview "',n.choiceTitle(e.choices[e.index]),'" ')}}function Os(i,t){if(i&1){let e=k();s(0,"button",283),u("click",function(){_(e);let o=r(3),a=r(4);return g(a.requestPlan(o.msg,o.choices[o.index]))}),c(1),d()}if(i&2){let e=r(7);b("disabled",e.isStreaming()),l(),q(" ",e.copy().givePlanButton," ")}}function Es(i,t){if(i&1){let e=k();s(0,"div",281)(1,"button",283),u("click",function(){_(e);let o=r(2),a=r(4);return g(a.openChatDraft(o.msg,o.choices[o.index]))}),C(2,"nile-glyph",286),c(3),d(),m(4,Fs,3,2,"button",285),m(5,Os,2,2,"button",284),s(6,"button",390),u("click",function(){_(e);let o=r(2),a=r(4);return g(a.onPanelSkip(o.msg))}),c(7," Skip "),d()()}if(i&2){let e=r(2),n=r(4);l(),b("disabled",n.isStreaming()),l(2),q(" ",n.copy().somethingElseButton," "),l(),h(e.choices[e.index].kind==="widget_plan"?4:-1),l(),h(e.choices[e.index].kind==="clarification"?5:-1),l(),M("disabled",n.isStreaming()?"":null)}}function Is(i,t){if(i&1){let e=k();s(0,"div",282)(1,"div",290)(2,"nile-input",291),u("nile-input",function(o){_(e);let a=r(2),p=r(4);return g(p.onChatDraftTextChange(a.msg,a.choices[a.index],o.detail.value))})("keydown.enter",function(){_(e);let o=r(2),a=r(4);return g(a.onPanelChatDraftConfirm(o.msg,o.choices[o.index]))}),d(),s(3,"nile-button",22),u("click",function(){_(e);let o=r(2),a=r(4);return g(a.onPanelChatDraftConfirm(o.msg,o.choices[o.index]))}),c(4),d()()()}if(i&2){let e=r(2),n=r(4);l(2),b("value",e.choices[e.index].chatDraftText??""),M("placeholder",n.chatDraftPlaceholderFor(e.choices[e.index]))("disabled",n.isStreaming()?"":null),l(),M("disabled",!(e.choices[e.index].chatDraftText!=null&&e.choices[e.index].chatDraftText.trim())||n.isStreaming()?"":null),l(),q(" ",n.copy().defineItButton," ")}}function Vs(i,t){if(i&1){let e=k();s(0,"div",372),m(1,Ms,2,3,"span",373)(2,Ss,2,2,"span",373),s(3,"div",374)(4,"button",375),u("click",function(){_(e);let o=r(),a=r(4);return g(a.onPanelPrev(o.msg))}),C(5,"nile-glyph",376),d(),s(6,"button",375),u("click",function(){_(e);let o=r(),a=r(4);return g(a.onPanelSkip(o.msg))}),C(7,"nile-glyph",377),d(),s(8,"button",378),u("click",function(){_(e);let o=r(),a=r(4);return g(a.dismissChoicePanel(o.msg))}),C(9,"nile-glyph",379),d()()(),s(10,"nile-radio-group",380),u("nile-change",function(o){_(e);let a=r(),p=r(4);return g(p.onChoiceChange(a.msg,a.choices[a.index],o.detail.value))}),F(11,Ds,9,8,"nile-radio",381,te),d(),m(13,Es,8,5,"div",281)(14,Is,5,5,"div",282),s(15,"p",382),c(16,"\u2191\u2193 to navigate \xB7 \u21B5 to select \xB7 or type below"),d()}if(i&2){let e,n=r(),o=r(4);l(),h((e=o.panelBadgeLabel(n.choices[n.index]))?1:2,e),l(3),M("disabled",n.index===0?"":null),l(2),M("disabled",o.isStreaming()?"":null),l(4),M("label",n.choices[n.index].prompt||"Choose an option")("name","choice-panel-"+n.msg.id+"-"+n.index)("value",n.choices[n.index].draftSelection||n.choices[n.index].selected||null)("disabled",o.isStreaming()?"":null),l(),O(n.choices[n.index].options),l(2),h(n.choices[n.index].chatOpen?14:13)}}function Rs(i,t){if(i&1&&(s(0,"li",392)(1,"span",394),c(2),d(),s(3,"span",395),c(4),d()()),i&2){let e=t.$implicit,n=r(6);l(2),y(n.choiceTitle(e)),l(2),y(n.panelAnswerLabel(e))}}function zs(i,t){if(i&1){let e=k();s(0,"div",372)(1,"span",373),c(2,"READY TO SUBMIT"),d(),s(3,"button",378),u("click",function(){_(e);let o=r(),a=r(4);return g(a.dismissChoicePanel(o.msg))}),C(4,"nile-glyph",379),d()(),s(5,"ul",391),F(6,Rs,5,2,"li",392,G),d(),s(8,"div",393)(9,"button",375),u("click",function(){_(e);let o=r(),a=r(4);return g(a.onPanelPrev(o.msg))}),C(10,"nile-glyph",376),c(11," Back "),d(),s(12,"nile-button",22),u("click",function(){_(e);let o=r(),a=r(4);return g(a.submitChoices(o.msg))}),c(13),d()()}if(i&2){let e=r(),n=r(4);l(6),O(e.choices),l(6),M("disabled",!n.hasPendingDraft(e.msg)||n.isStreaming()?"":null),l(),q(" ",n.copy().submitAnswersButton," ")}}function Ns(i,t){if(i&1&&(s(0,"div",371),m(1,Vs,17,8)(2,zs,14,2),d()),i&2){let e=t;l(),h(e.index<e.choices.length?1:2)}}function Ls(i,t){if(i&1&&(s(0,"div",231),m(1,Ns,3,1,"div",371),fe(2,214),d()),i&2){let e,n=r(3),o=de(8);l(),h((e=n.activeChoicePanel())?1:-1,e),l(),b("ngTemplateOutlet",o)}}function $s(i,t){if(i&1){let e=k();s(0,"nile-ai-chat",230,3),u("mouseup",function(o){_(e);let a=r(2);return g(a.onThreadMouseUp(o))}),m(2,Vr,11,0)(3,As,2,0),m(4,Ls,3,2,"div",231),d()}if(i&2){let e=r(2);l(2),h(e.loadingConversation()?2:3),l(2),h(e.messages().length?4:-1)}}function Ws(i,t){if(i&1&&m(0,Ir,12,4,"div",206)(1,$s,5,2,"nile-ai-chat",207),i&2){let e=r();h(!e.loadingConversation()&&!e.messages().length?0:1)}}function Bs(i,t){if(i&1&&(s(0,"div",397),C(1,"nile-glyph",404),s(2,"span"),c(3),d()()),i&2){let e=r(2);l(3),y(e.copy().dropFilesOverlay)}}function Us(i,t){if(i&1){let e=k();s(0,"div",398),C(1,"nile-glyph",33),s(2,"span",405),c(3),d(),s(4,"button",406),u("click",function(){_(e);let o=r(2);return g(o.clearReplyQuote())}),C(5,"nile-glyph",407),d()()}i&2&&(l(3),y(t))}function Gs(i,t){i&1&&C(0,"nile-spinner",410)}function js(i,t){if(i&1){let e=k();s(0,"button",413),u("click",function(){_(e);let o=r().$implicit,a=r(3);return g(a.retryAttachment(o.id))}),c(1,"Retry"),d()}}function Hs(i,t){if(i&1){let e=k();s(0,"div",409),C(1,"nile-glyph",254),s(2,"span",255),c(3),d(),m(4,Gs,1,0,"nile-spinner",410)(5,js,2,0,"button",411),s(6,"button",412),u("click",function(){let o=_(e).$implicit,a=r(3);return g(a.removeAttachment(o.id))}),C(7,"nile-glyph",407),d()()}if(i&2){let e=t.$implicit;W("aq-chip--error",e.status==="error"),l(),M("name",e.contentType.startsWith("image/")?"ng-image-03":"ng-file-06"),l(),M("title",e.name),l(),y(e.name),l(),h(e.status==="uploading"?4:e.status==="error"?5:-1)}}function Ys(i,t){if(i&1&&(s(0,"div",399),F(1,Hs,8,6,"div",408,te),d()),i&2){let e=r(2);l(),O(e.attachments())}}function Ks(i,t){if(i&1){let e=k();s(0,"nile-button",414),u("click",function(){_(e),r();let o=de(5);return g(o.click())}),C(1,"nile-glyph",415),d()}if(i&2){let e=r(2);M("disabled",e.isStreaming()||e.attachAtCapacity()?"":null)}}function Qs(i,t){if(i&1){let e=k();s(0,"div",396),u("dragenter",function(o){_(e);let a=r();return g(a.onComposerDragEnter(o))})("dragover",function(o){_(e);let a=r();return g(a.onComposerDragOver(o))})("dragleave",function(o){_(e);let a=r();return g(a.onComposerDragLeave(o))})("drop",function(o){_(e);let a=r();return g(a.onComposerDrop(o))}),m(1,Bs,4,1,"div",397),m(2,Us,6,1,"div",398),m(3,Ys,3,0,"div",399),s(4,"input",400,5),u("change",function(o){_(e);let a=r();return g(a.onFilesPicked(o))}),d(),s(6,"nile-ai-prompt",401,6),u("keydown",function(o){_(e);let a=r();return g(a.onComposerKeydown(o))})("nile-change",function(o){_(e);let a=r();return g(a.inputText.set((o.detail==null?null:o.detail.value)??""))})("nile-submit",function(o){_(e);let a=r();return g(a.onComposerSubmit(o.detail==null?null:o.detail.value))})("nile-stop",function(){_(e);let o=r();return g(o.stopStream())}),s(8,"div",402),u("click",function(o){return o.stopPropagation()}),m(9,Ks,2,1,"nile-button",403),d()()()}if(i&2){let e,n=r();W("aq-composer-wrap--dragover",n.isDraggingFile()),l(),h(n.features().attachments&&n.isDraggingFile()?1:-1),l(),h((e=n.replyQuote())?2:-1,e),l(),h(n.features().attachments&&n.attachments().length?3:-1),l(),M("accept",n.acceptUploadTypes),l(2),W("aq-attach-full",n.attachAtCapacity()),b("placeholder",n.copy().composerPlaceholder)("hideModel",!0)("hideAddContext",!0)("rows",1)("speechLang","en-US")("value",n.inputText())("loading",n.isStreaming()),l(3),h(n.features().attachments?9:-1)}}function Xs(i,t){if(i&1){let e=k();s(0,"div",416),u("pointerdown",function(o){_(e);let a=r();return g(a.startChatResize(o))}),d()}if(i&2){let e=r();W("is-active",e.isResizing())}}function Js(i,t){if(i&1){let e=k();s(0,"div",432),C(1,"nile-glyph",433),s(2,"nile-slide-toggle",434),u("nile-change",function(o){_(e);let a=r(3);return g(a.onFiltersToggle(o.detail.checked))}),d()()}if(i&2){let e=r(3);W("aq-filters-pill--active",e.artifactHasFilter()),l(2),b("isChecked",e.artifactHasFilter())}}function Zs(i,t){if(i&1){let e=k();s(0,"div",428)(1,"nile-button",435),u("click",function(){_(e);let o=r(3);return g(o.undoCanvas())}),C(2,"nile-glyph",436),c(3," Undo "),d(),s(4,"nile-button",437),u("click",function(){_(e);let o=r(3);return g(o.redoCanvas())}),C(5,"nile-glyph",438),d()()}if(i&2){let e=r(3);l(),M("disabled",e.canUndoCanvas()?null:""),l(3),M("disabled",e.canRedoCanvas()?null:""),l(),M("color",e.canRedoCanvas()?"var(--ng-colors-text-secondary-700)":"var(--ng-colors-text-placeholder-subtle)")}}function ed(i,t){if(i&1){let e=k();s(0,"div",418)(1,"div",423)(2,"span",424),c(3,"Preview"),d(),s(4,"span",425),c(5),d()(),s(6,"div",426),m(7,Js,3,3,"div",427),m(8,Zs,6,3,"div",428),C(9,"span",429),s(10,"nile-button",430),u("click",function(){_(e);let o=r(2);return g(o.closeArtifact())}),C(11,"nile-glyph",431),d()()()}if(i&2){let e=r(2);l(5),y(e.artifactSubtitle()),l(2),h(e.features().canvas.filters?7:-1),l(),h(e.features().canvas.undoRedo?8:-1)}}function td(i,t){if(i&1&&(s(0,"div",420),C(1,"nile-glyph",439),s(2,"p",440),c(3),d(),s(4,"p",441),c(5),d()()),i&2){let e=r(2);l(3),y(e.copy().emptyCanvasTitle),l(2),y(e.copy().emptyCanvasSubtitle)}}function nd(i,t){if(i&1){let e=k();s(0,"shared-dashboard-grid",442,7),u("selectionChange",function(o){_(e);let a=r(2);return g(a.onSelectionChange(o))})("forecast",function(o){_(e);let a=r(2);return g(a.onArtifactForecast(o))})("setAlert",function(o){_(e);let a=r(2);return g(a.onSetAlert(o))})("filterSubmit",function(o){_(e);let a=r(2);return g(a.onArtifactFilterSubmit(o))})("filterChange",function(o){_(e);let a=r(2);return g(a.onArtifactFilterChange(o))})("dslWidgetUpdated",function(o){_(e);let a=r(2);return g(a.onDslWidgetUpdated(o))})("dslEditorClosed",function(){_(e);let o=r(2);return g(o.onArtifactDslEditorClosed())})("widgetClick",function(o){_(e);let a=r(2);return g(a.onKpiWidgetClicked(o))})("aiSend",function(o){_(e);let a=r(2);return g(a.onArtifactAiSend(o))}),d()}if(i&2){let e=r(2);b("widgets",e.artifactWidgets())("filtersEnabled",!!e.builderDashboardId())("conversationId",e.activeConversationId())("editMode",!1)("selectable",e.features().canvas.widgetSelection)("canSetAlert",!0)("canAddToStory",e.widgetMenu().addToStory)("canForecast",!0)("showWidgetMenu",e.widgetMenu().enabled)("canAsk",e.widgetMenu().ask)("canChangeChartType",e.widgetMenu().changeChartType)("canManageFilters",e.widgetMenu().manageFilters)("canCustomizeColors",e.widgetMenu().customizeColors)("canViewChartData",e.widgetMenu().chartData)("canExportPng",e.widgetMenu().exportPng)("canExportCsv",e.widgetMenu().exportCsv)("canPrint",e.widgetMenu().print)("forecastable",e.artifactForecastable())("forecastingWidgetId",e.artifactForecastingId())("showEditDslInViewMode",!0)("widgetsLoading",e.applyingFilters())("dashboardFilters",e.activeDashboardFilters())("resolvedFilters",e.activeResolvedFilters())("applySummary",e.applySummary())("filterExplanation",e.filterExplanation())("detailPanel",!0)("detailRootLabel","Canvas")}}function id(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){let o=_(e),a=r(3);return g(a.forecastFromChart(o))}),C(1,"nile-glyph",444),c(2),d()}if(i&2){let e=r(3);l(2),q(" ",e.copy().forecastButton," ")}}function od(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.openStoryPicker())}),C(1,"nile-glyph",445),c(2),d()}if(i&2){let e=r(3);M("disabled",e.committingAction()||!e.hasSelection()?"":null),l(2),q(" ",e.copy().addToStoryButton," ")}}function ad(i,t){if(i&1){let e=k();s(0,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.publishAsNewDashboard())}),c(1),d()}if(i&2){let e=r(3);M("loading",e.committingAction()==="publish"?"":null)("disabled",e.committingAction()||!e.hasSelection()?"":null),l(),q(" ",e.copy().publishAsDashboardButton," ")}}function rd(i,t){}function ld(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(4);l(),y(e.copy().noResultsMatchFilters)}}function sd(i,t){i&1&&fe(0)}function dd(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(6);return a.showAddPicker.set(!1),g(a.addToExistingDashboard(o.id))}),ke(1,sd,1,0,"ng-container",353),d()}if(i&2){let e=t.$implicit;r(6);let n=de(40);l(),b("ngTemplateOutlet",n)("ngTemplateOutletContext",rt(2,Oi,e))}}function cd(i,t){if(i&1&&(s(0,"div",80),c(1),d(),F(2,dd,2,4,"nile-menu-item",null,te)),i&2){let e=t.$implicit;l(),y(e.label),l(),O(e.items)}}function pd(i,t){if(i&1&&(s(0,"div",46),c(1),d()),i&2){let e=r(5);l(),y(e.copy().noDashboardsYet)}}function _d(i,t){if(i&1&&F(0,cd,4,1,null,null,se,!1,pd,2,1,"div",46),i&2){let e=r(4);O(e.groupedPickerDashboards())}}function gd(i,t){if(i&1){let e=k();s(0,"nile-dropdown",446),u("nile-hide",function(){_(e);let o=r(3);return g(o.showAddPicker.set(!1))}),s(1,"nile-button",352),u("click",function(){_(e);let o=r(3);return g(o.showAddPicker.set(!o.showAddPicker()))}),C(2,"nile-glyph",160),c(3),d(),s(4,"nile-menu",43),u("nile-search-value",function(o){_(e);let a=r(3);return g(a.pickerSearch.set((o.detail==null?null:o.detail.value)??""))}),s(5,"nile-menu-item",44),u("click",function(){_(e);let o=r(3);return o.showAddPicker.set(!1),g(o.addArtifactToDashboard())}),C(6,"nile-glyph",45),c(7),d(),m(8,ld,2,1,"div",46)(9,_d,3,1),d()()}if(i&2){let e=r(3);b("open",e.showAddPicker()),l(),M("loading",e.committingAction()==="add"?"":null)("disabled",e.committingAction()||!e.hasSelection()?"":null),l(2),q(" ",e.copy().addToDashboardButton," "),l(),M("noResultsMessage",e.copy().noResultsMatchFilters),l(3),q(" ",e.copy().newDashboardLabel," "),l(),h(e.pickerSearchEmpty()?8:9)}}function ud(i,t){if(i&1){let e=k();s(0,"nile-button",22),u("click",function(){_(e);let o=r(3);return g(o.addArtifactToDashboard())}),C(1,"nile-glyph",160),c(2),d()}if(i&2){let e=r(3);M("loading",e.committingAction()==="add"?"":null)("disabled",e.committingAction()||!e.hasSelection()?"":null),l(2),q(" ",e.builderOpen()?e.copy().addToCurrentDashboardButton:e.copy().addToDashboardButton," ")}}function md(i,t){if(i&1&&(s(0,"div",422),m(1,id,3,1,"nile-button",205),m(2,od,3,2,"nile-button",205),m(3,ad,2,3,"nile-button",205),m(4,rd,0,0)(5,gd,10,7,"nile-dropdown",443)(6,ud,3,3,"nile-button",350),d()),i&2){let e,n=r(2);l(),h((e=n.artifactForecastMsg())?1:-1,e),l(),h(-1),l(),h(n.features().canvas.publishAsDashboard?3:-1),l(),h(n.features().canvas.addToDashboard?!n.builderOpen()&&n.conversationDashboards().length>1?5:6:4)}}function hd(i,t){if(i&1&&(s(0,"aside",417),m(1,ed,12,3,"div",418),s(2,"div",419),m(3,td,6,2,"div",420)(4,nd,2,27,"shared-dashboard-grid",421),d(),m(5,md,7,4,"div",422),fe(6,214),d()),i&2){let e=r(),n=de(35);W("aq-artifact-pane--dsl-only",e.dslOnlyArtifact()),l(),h(e.dslOnlyArtifact()?-1:1),l(2),h(e.artifactWidgets().length===0?3:4),l(2),h(!e.dslOnlyArtifact()&&e.artifactFooterHasActions()?5:-1),l(),b("ngTemplateOutlet",n)}}function Cd(i,t){i&1&&C(0,"nile-spinner",458)}function fd(i,t){i&1&&C(0,"nile-glyph",459)}function xd(i,t){if(i&1){let e=k();s(0,"input",455),u("input",function(o){_(e);let a=r(2);return g(a.dashboardTitleDraft.set(o.target.value))})("keydown.enter",function(){_(e);let o=r(2);return g(o.commitDashboardTitle())})("keydown.escape",function(){_(e);let o=r(2);return g(o.cancelEditDashboardTitle())}),d(),s(1,"nile-lite-tooltip",456)(2,"button",457),u("click",function(){_(e);let o=r(2);return g(o.commitDashboardTitle())}),m(3,Cd,1,0,"nile-spinner",458)(4,fd,1,0,"nile-glyph",459),d()()}if(i&2){let e=r(2);b("value",e.dashboardTitleDraft()),l(2),b("disabled",e.renamingDashboard()),l(),h(e.renamingDashboard()?3:4)}}function yd(i,t){i&1&&C(0,"nile-skeleton-loader",449)}function bd(i,t){if(i&1){let e=k();s(0,"nile-lite-tooltip",461)(1,"button",462),u("click",function(){_(e);let o=r(3);return g(o.startEditDashboardTitle())}),C(2,"nile-glyph",463),d()()}}function vd(i,t){if(i&1&&(s(0,"span",460),c(1),d(),m(2,bd,3,0,"nile-lite-tooltip",461)),i&2){let e=r(2);l(),y((e.builderRef==null?null:e.builderRef.dashboardName())||"Dashboard"),l(),h(e.builderDashboardId()?2:-1)}}function wd(i,t){if(i&1){let e=k();s(0,"section",17)(1,"header",447)(2,"div",34)(3,"nile-button",430),u("click",function(){_(e);let o=r();return g(o.closeBuilder())}),C(4,"nile-glyph",448),d(),m(5,xd,5,3)(6,yd,1,0,"nile-skeleton-loader",449)(7,vd,3,2),d(),s(8,"div",36)(9,"nile-lite-tooltip",450)(10,"button",451),u("click",function(){_(e);let o=r();return g(o.toggleBuilderFullscreen())}),C(11,"nile-glyph",452),d()(),s(12,"shared-builder-toolbar",453),u("action",function(o){_(e);let a=r();return g(a.onBuilderMenuAction(o))}),d()()(),s(13,"shared-builder-host",454),u("exitBuilder",function(){_(e);let o=r();return g(o.closeBuilder())})("executiveSummary",function(o){_(e);let a=r();return g(a.onExecutiveSummary(o))})("galleryPrompt",function(o){_(e);let a=r();return g(a.inputText.set(o))})("published",function(o){_(e);let a=r();return g(a.onBuilderPublished(o))})("widgetClick",function(o){_(e);let a=r();return g(a.onKpiWidgetClicked(o))}),d(),fe(14,214),d()}if(i&2){let e=r(),n=de(35);l(5),h(e.editingDashboardTitle()?5:e.builderRef!=null&&e.builderRef.loading()?6:7),l(4),b("content",e.builderFullscreen()?"Exit full screen":"Full screen"),l(),M("aria-label",e.builderFullscreen()?"Exit full screen":"Full screen"),l(),M("name",e.builderFullscreen()?"ng-minimize":"ng-maximize"),l(),b("canToggleFilter",!0)("hasFilter",(e.builderRef==null?null:e.builderRef.hasFilter())??!1)("canForecast",!0)("anyForecastOn",(e.builderRef==null?null:e.builderRef.anyForecastOn())??!1)("editMode",(e.builderRef==null?null:e.builderRef.editMode())??!0)("showFullscreen",!1)("fullscreen",e.builderFullscreen())("busy",(e.builderRef==null?null:e.builderRef.isPublishing())??!1)("exporting",(e.builderRef==null?null:e.builderRef.isExporting())??!1)("showPromptGallery",!1)("canPublish",(e.builderRef==null?null:e.builderRef.canPublish())??!0),l(),b("dashboardId",e.builderDashboardId())("preseeded",e.builderPreseeded())("galleryPrompts",e.suggestions())("canAddToStory",e.widgetMenu().addToStory)("showWidgetMenu",e.widgetMenu().enabled)("canAsk",e.widgetMenu().ask)("canChangeChartType",e.widgetMenu().changeChartType)("canManageFilters",e.widgetMenu().manageFilters)("canCustomizeColors",e.widgetMenu().customizeColors)("canViewChartData",e.widgetMenu().chartData)("canExportPng",e.widgetMenu().exportPng)("canExportCsv",e.widgetMenu().exportCsv)("canPrint",e.widgetMenu().print)("canTweak",e.widgetMenu().tweak)("canEdit",e.widgetMenu().edit)("canDelete",e.widgetMenu().delete),l(),b("ngTemplateOutlet",n)}}function kd(i,t){if(i&1){let e=k();s(0,"label",474)(1,"input",475),u("change",function(){let o=_(e).$implicit,a=r(3);return g(a.onGranularityPick(o))}),d(),s(2,"span"),c(3),d()()}if(i&2){let e=t.$implicit,n=r(2);W("fs-segment--on",n.granularity===e.value)("fs-segment--off",!e.enabled),M("title",e.reason||null),l(),b("value",e.value)("checked",n.granularity===e.value)("disabled",!e.enabled),l(2),y(e.value)}}function Pd(i,t){i&1&&(s(0,"p",468),c(1),d()),i&2&&(l(),y(t))}function Ad(i,t){if(i&1&&(s(0,"p",468),c(1),d()),i&2){let e=r();l(),y(e.granularityNote)}}function Md(i,t){if(i&1&&(s(0,"div",464)(1,"span",476),c(2,"Model"),d(),s(3,"div",477)(4,"p",478),c(5),d(),s(6,"p",479),c(7),d()()()),i&2){let e=t;l(5),y(e.title),l(2),y(e.body)}}function Sd(i,t){if(i&1&&(s(0,"div",464)(1,"span",476),c(2,"Guardrails"),d(),s(3,"div",480)(4,"p",478),C(5,"nile-glyph",481),c(6),d(),s(7,"p",479),c(8),d()()()),i&2){let e=t;l(3),W("fs-card--pass",e.passed)("fs-card--warn",!e.passed),l(2),M("name",e.passed?"ng-check":"ng-alert-circle")("color",e.passed?"var(--ng-colors-fg-success-primary)":"var(--ng-colors-fg-warning-primary)"),l(),q(" ",e.title," "),l(2),y(e.body)}}function Td(i,t){if(i&1){let e=k();s(0,"div",464)(1,"label",465),c(2," Horizon \u2014 "),s(3,"span",466),c(4),d()(),s(5,"input",467),u("input",function(o){_(e);let a=r(2);return g(a.onHorizonInput(o.target.value))}),d(),s(6,"p",468),c(7),d()(),s(8,"div",464)(9,"span",469),c(10,"Granularity"),d(),s(11,"div",470),F(12,kd,4,9,"label",471,nt),d(),m(14,Pd,2,1,"p",468)(15,Ad,2,1,"p",468),d(),s(16,"div",464)(17,"label",472),c(18," Confidence interval \u2014 "),s(19,"span",466),c(20),d()(),s(21,"input",473),u("input",function(o){_(e);let a=r(2);return g(a.onConfidenceIndexInput(o.target.value))}),d(),s(22,"p",468),c(23),d()(),m(24,Md,8,2,"div",464),m(25,Sd,9,8,"div",464)}if(i&2){let e,n,o,a=t,p=r(),x=r();l(4),Y("",p.horizon," ",x.horizonUnit()),l(),Z("--fs-fill",x.horizonFill()),b("value",p.horizon),M("max",x.horizonMax())("aria-valuetext",p.horizon+" "+x.horizonUnit()),l(2),y(x.horizonNote()),l(5),O(x.granularityChoices()),l(2),h((e=x.unavailableGranularityNote())?14:15,e),l(6),q("",p.confidence,"%"),l(),Z("--fs-fill",x.confidenceFill()),b("value",x.confidenceIndex()),M("max",a.confidenceLevels.length-1)("aria-valuetext",p.confidence+"%"),l(2),y(a.confidenceNote),l(),h((n=a.modelCard)?24:-1,n),l(),h((o=a.guardrails)?25:-1,o)}}function qd(i,t){if(i&1&&m(0,Td,26,18),i&2){let e,n=r();h((e=n.forecastCopy())?0:-1,e)}}function Dd(i,t){if(i&1&&(s(0,"div",485),C(1,"nile-skeleton-loader",486),s(2,"div",487),C(3,"nile-skeleton-loader",78),d()()),i&2){let e=t.$implicit;l(2),Z("width",e,"px")}}function Fd(i,t){if(i&1&&(s(0,"div",483),F(1,Dd,4,2,"div",485,G),d()),i&2){let e=r(2);l(),O(e.gallerySkeletonRows)}}function Od(i,t){if(i&1){let e=k();s(0,"nile-ai-prompts",488),u("nile-item-click",function(o){_(e);let a=r(2);return g(a.onGalleryPromptPick(o.detail==null?null:o.detail.data))}),d()}if(i&2){let e=r(2);b("items",e.galleryPromptItems())("vertical",!0)("wrap",!0)}}function Ed(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(2);l(),Y("",e.copy().noPromptsMatch,' "',e.gallerySearch(),'".')}}function Id(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(2);l(),y(e.copy().noPromptsYet)}}function Vd(i,t){if(i&1){let e=k();s(0,"nile-input",482),u("nile-input",function(o){_(e);let a=r();return g(a.gallerySearch.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r();return g(a.gallerySearch.set((o.detail==null?null:o.detail.value)??""))}),C(1,"nile-glyph",109),d(),m(2,Fd,3,0,"div",483)(3,Od,1,3,"nile-ai-prompts",484)(4,Ed,2,2,"div",128)(5,Id,2,1,"div",128)}if(i&2){let e=r();b("placeholder",e.copy().promptGallerySearchPlaceholder)("value",e.gallerySearch()),l(2),h(e.suggestionsLoading()?2:e.filteredGalleryPrompts().length?3:e.gallerySearch().trim()?4:5)}}function Rd(i,t){if(i&1&&(s(0,"div",489),c(1),d()),i&2){let e=r(2);l(),y(e.copy().xrayLoadingSources)}}function zd(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(2);l(),y(e.copy().xrayNoSources)}}function Nd(i,t){i&1&&C(0,"nile-glyph",72)}function Ld(i,t){if(i&1){let e=k();s(0,"nile-menu-item",70),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.onXrayDatasetPick(o.datasetId))}),s(1,"span",504),c(2),d(),m(3,Nd,1,0,"nile-glyph",72),d()}if(i&2){let e=t.$implicit,n=r(4);l(2),y(e.label),l(),h(n.xraySelectedDatasetId()===e.datasetId?3:-1)}}function $d(i,t){if(i&1){let e=k();s(0,"nile-dropdown",499),u("nile-hide",function(){_(e);let o=r(3);return g(o.xrayDatasetMenuOpen.set(!1))}),s(1,"button",500),u("click",function(){_(e);let o=r(3);return g(o.xrayDatasetMenuOpen.set(!o.xrayDatasetMenuOpen()))}),C(2,"nile-glyph",501),s(3,"span",502),c(4),d(),C(5,"nile-glyph",503),d(),s(6,"nile-menu"),F(7,Ld,4,2,"nile-menu-item",null,Fo),d()()}if(i&2){let e=r(3);b("open",e.xrayDatasetMenuOpen()),l(4),y(e.xraySelectedDatasetLabel()),l(3),O(e.xrayDatasets())}}function Wd(i,t){if(i&1&&(s(0,"div",496),C(1,"nile-glyph",505),s(2,"span"),c(3),d()()),i&2){let e=r(3);l(3),y(e.xrayError())}}function Bd(i,t){if(i&1&&(s(0,"div",497),C(1,"nile-spinner",506),s(2,"p",507),c(3),d(),s(4,"p",508),c(5),d()()),i&2){let e=r(3);l(3),y(e.xrayStatus()==="analyzing"?e.copy().xrayAnalyzing:e.copy().xrayBuilding),l(2),y(e.xrayRunningEntityLabel())}}function Ud(i,t){if(i&1&&(s(0,"div",509),C(1,"nile-skeleton-loader",486)(2,"nile-skeleton-loader",510),d()),i&2){let e=t.$implicit;l(2),b("width",e)}}function Gd(i,t){if(i&1&&(s(0,"div",498),F(1,Ud,3,1,"div",509,G),d()),i&2){let e=r(3);l(),O(e.xraySkeletonRows)}}function jd(i,t){if(i&1&&(s(0,"span",518),c(1),d()),i&2){let e=r().$implicit;l(),q("",e.schema,".")}}function Hd(i,t){if(i&1&&(s(0,"span",519),c(1),d()),i&2){let e=r().$implicit,n=r(4);l(),Y("",e.fieldCount," ",n.copy().xrayFieldsLabel)}}function Yd(i,t){if(i&1){let e=k();s(0,"button",515),u("click",function(){let o=_(e).$implicit,a=r(4);return g(a.runXray(o))}),C(1,"nile-glyph",516),s(2,"span",517),m(3,jd,2,1,"span",518),c(4),d(),m(5,Hd,2,2,"span",519),s(6,"span",520),C(7,"nile-glyph",229),s(8,"span"),c(9),d()()()}if(i&2){let e=t.$implicit,n=r(4);b("disabled",n.xrayRunning())("title",n.xrayEntityLabel(e)),l(),b("name",e.kind==="index"?"ng-layers-three-01":"ng-table"),l(2),h(e.schema?3:-1),l(),q("",e.name," "),l(),h(e.fieldCount?5:-1),l(4),y(n.copy().xrayRunLabel)}}function Kd(i,t){if(i&1&&(s(0,"div",511)(1,"span",512),c(2),d(),s(3,"span",513),c(4),d()(),s(5,"div",498),F(6,Yd,10,7,"button",514,Oo),d()),i&2){let e=r(3);l(2),Y("",e.xrayFilteredEntities().length," ",e.xrayEntityNoun()),l(2),y(e.copy().xrayPickHint),l(2),O(e.xrayFilteredEntities())}}function Qd(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(3);l(),Y("",e.copy().xrayNoEntitiesMatch,' "',e.xrayEntitySearch(),'".')}}function Xd(i,t){if(i&1&&(s(0,"div",128),c(1),d()),i&2){let e=r(3);l(),y(e.copy().xrayNoEntities)}}function Jd(i,t){if(i&1){let e=k();m(0,$d,9,2,"nile-dropdown",490),s(1,"nile-input",491),u("nile-input",function(o){_(e);let a=r(2);return g(a.xrayEntitySearch.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r(2);return g(a.xrayEntitySearch.set((o.detail==null?null:o.detail.value)??""))}),C(2,"nile-glyph",109),d(),s(3,"details",492)(4,"summary",493),C(5,"nile-glyph",494),s(6,"span"),c(7),d()(),s(8,"nile-input",495),u("nile-input",function(o){_(e);let a=r(2);return g(a.xrayTopic.set((o.detail==null?null:o.detail.value)??""))})("nile-change",function(o){_(e);let a=r(2);return g(a.xrayTopic.set((o.detail==null?null:o.detail.value)??""))}),d()(),m(9,Wd,4,1,"div",496),m(10,Bd,6,2,"div",497)(11,Gd,3,0,"div",498)(12,Kd,8,3)(13,Qd,2,2,"div",128)(14,Xd,2,1,"div",128)}if(i&2){let e=r(2);h(e.xrayDatasets().length>1?0:-1),l(),b("placeholder",e.copy().xrayEntitySearchPlaceholder)("value",e.xrayEntitySearch()),l(2),b("open",!!e.xrayTopic()),l(4),y(e.copy().xrayFocusToggle),l(),b("placeholder",e.copy().xrayTopicPlaceholder)("value",e.xrayTopic()),l(),h(e.xrayError()?9:-1),l(),h(e.xrayRunning()?10:e.xrayEntitiesLoading()?11:e.xrayFilteredEntities().length?12:e.xrayEntitySearch().trim()?13:14)}}function Zd(i,t){if(i&1&&m(0,Rd,2,1,"div",489)(1,zd,2,1,"div",128)(2,Jd,15,9),i&2){let e=r();h(e.xraySourcesLoading()?0:e.xraySources().length?2:1)}}function ec(i,t){i&1&&(s(0,"nile-breadcrumb-item"),c(1),d()),i&2&&(l(),q(" ",t," "))}function tc(i,t){i&1&&c(0),i&2&&q(" ",t," ")}function nc(i,t){i&1&&C(0,"nile-skeleton-loader",524)}function ic(i,t){if(i&1&&(s(0,"p",526),c(1),d()),i&2){let e=r(3);l(),y(e.cohortDetailCaption())}}function oc(i,t){if(i&1&&C(0,"nile-skeleton-loader",533),i&2){let e=t.$implicit;Z("left",e.x/12*100,"%")("top",e.y*72,"px")("width","calc("+e.w/12*100+"% - 12px)")("height",e.h*72-12,"px")}}function ac(i,t){if(i&1&&(s(0,"div",531),F(1,oc,1,8,"nile-skeleton-loader",532,G),d()),i&2){let e=r(4);Z("height",e.widgetDetailPanelSkeletonHeight(),"px"),l(),O(e.widgetDetailPanelSkeletonSlots())}}function rc(i,t){i&1&&(s(0,"div",530)(1,"div",534),C(2,"nile-skeleton-loader",535)(3,"nile-skeleton-loader",535)(4,"nile-skeleton-loader",535),d(),C(5,"nile-skeleton-loader",536),d())}function lc(i,t){if(i&1&&m(0,ac,3,2,"div",529)(1,rc,6,0,"div",530),i&2){let e=r(3);h(e.widgetDetailPanelSkeletonSlots().length?0:1)}}function sc(i,t){if(i&1){let e=k();s(0,"shared-dashboard-grid",537),u("selectionChange",function(o){_(e);let a=r(3);return g(a.widgetDetailPanelSelectedIds.set(o))}),d()}if(i&2){let e=r(3);b("widgets",e.widgetDetailPanelWidgets())("editMode",!1)("selectable",e.widgetDetailPanelKind()==="dashboard")("selectedWidgetIds",e.widgetDetailPanelSelectedIds())("canSetAlert",!1)("canAddToStory",!1)("canForecast",!1)("showWidgetMenu",!1)}}function dc(i,t){if(i&1){let e=k();s(0,"div",528)(1,"span",538),c(2),d(),s(3,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.toggleSelectAllDetailPanelWidgets())}),c(4),d(),s(5,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.addSelectedDetailPanelWidgetsToCanvas())}),C(6,"nile-glyph",539),c(7),d(),s(8,"nile-button",22),u("click",function(){_(e);let o=r(3);return g(o.replaceCanvasWithDetailPanel())}),C(9,"nile-glyph",540),c(10," Replace canvas "),d()()}if(i&2){let e=r(3);l(2),Y(" ",e.widgetDetailPanelSelectedIds().length," of ",e.widgetDetailPanelWidgets().length," selected "),l(2),q(" ",e.isDetailPanelFullySelected()?"Deselect all":"Select all"," "),l(),M("disabled",e.widgetDetailPanelSelectedIds().length?null:""),l(2),q(" Add ",e.widgetDetailPanelSelectedIds().length," to canvas "),l(),M("disabled",e.widgetDetailPanelWidgets().length?null:"")}}function cc(i,t){if(i&1){let e=k();s(0,"div",528)(1,"nile-button",22),u("click",function(){_(e);let o=r(3);return g(o.exportCohortRowsCsv())}),C(2,"nile-glyph",541),c(3),d(),s(4,"nile-button",21),u("click",function(){_(e);let o=r(3);return g(o.copyCohortDefinition())}),C(5,"nile-glyph",542),c(6),d()()}if(i&2){let e=r(3);l(),M("disabled",e.detailPanelCohortData()?null:""),l(2),q(" ",e.copy().cohortExportRowsButton," "),l(),M("disabled",e.detailPanelCohortData()?null:""),l(2),q(" ",e.copy().cohortCopyDefinitionButton," ")}}function pc(i,t){if(i&1){let e=k();s(0,"div",528)(1,"nile-button",22),u("click",function(){_(e);let o=r(3);return g(o.addWidgetTemplateFromDetailPanel())}),C(2,"nile-glyph",160),c(3," Add to dashboard "),d()()}}function _c(i,t){if(i&1){let e=k();s(0,"div",521)(1,"div",522)(2,"nile-breadcrumb",523),u("nile-click",function(){_(e);let o=r(2);return g(o.closeWidgetDetailPanel())}),s(3,"nile-breadcrumb-item"),c(4),d(),m(5,ec,2,1,"nile-breadcrumb-item"),s(6,"nile-breadcrumb-item"),m(7,tc,1,1)(8,nc,1,0,"nile-skeleton-loader",524),d()()(),s(9,"div",525),m(10,ic,2,1,"p",526),m(11,lc,2,1)(12,sc,1,8,"shared-dashboard-grid",527),d(),m(13,dc,11,6,"div",528)(14,cc,7,4,"div",528)(15,pc,4,0,"div",528),d()}if(i&2){let e,n,o=r(2);l(4),q(" ",o.detailRootCrumb()," "),l(),h((e=o.detailPanelWidgetCrumb())?5:-1,e),l(2),h((n=o.detailPanelLastCrumb())?7:8,n),l(3),h(o.detailPanelCohortId()?10:-1),l(),h(o.widgetDetailPanelLoading()?11:12),l(2),h(o.widgetDetailPanelKind()==="dashboard"?13:o.detailPanelCohortId()?14:o.widgetDetailPanelCanAdd()?15:-1)}}function gc(i,t){if(i&1&&m(0,_c,16,6,"div",521),i&2){let e=r();h(e.widgetDetailPanelOpen()?0:-1)}}function uc(i,t){if(i&1){let e=k();s(0,"app-alert-drawer",543),u("closed",function(){_(e);let o=r();return g(o.onAlertClosed())})("saved",function(){_(e);let o=r();return g(o.onAlertClosed())}),d()}if(i&2){let e,n=r();b("open",n.alertDrawerOpen())("widget",n.alertWidget())("dashboardId",null)("source",n.alertSource())("sourceName",((e=n.selectedScope())==null?null:e.name)??"")("authoringMode","chat")}}function mc(i,t){i&1&&C(0,"nile-executive-summary",30,8)}function hc(i,t){if(i&1){let e=k();s(0,"app-story-picker-drawer",544),u("closed",function(){_(e);let o=r();return g(o.closeStoryPicker())})("added",function(){_(e);let o=r();return g(o.onAddedToStory())}),d()}if(i&2){let e=r();b("open",e.storyPickerOpen())("widget",e.storyPickerWidget())}}function Cc(i,t){if(i&1&&(s(0,"div",75),C(1,"nile-glyph",96),s(2,"div",77)(3,"span",89),c(4),d(),s(5,"span",90),c(6),d()()()),i&2){let e=t.$implicit,n=r();l(3),b("title",e.name||"Untitled"),l(),y(e.name||"Untitled"),l(2),y(n.dashboardMeta(e))}}function he(){return Math.random().toString(36).slice(2)}function fc(i){if(!i.length)return i;let t=new Map;for(let a of i){let p=t.get(a.y)??[];p.push(a),t.set(a.y,p)}let e=[...t.keys()].sort((a,p)=>a-p),n=[],o=0;for(let a of e){let p=t.get(a);for(let x of p)n.push(T(w({},x),{y:o}));o+=Math.max(...p.map(x=>x.h))}return n}var xc=4,yc="forecast-settings",bc="forecast-this";function Vi(i){return i.split(`
8
8
  `).map(t=>{let e=/^For "[^"]+":\s*(.*)$/.exec(t);return e?e[1]:t}).join(`
9
9
  `)}function Di(i){return{id:i.id,role:i.role,text:i.role==="user"?Vi(i.content):i.content,charts:(i.charts??[]).map(t=>{let e=t;return{title:e.title??"Chart",componentName:e.componentName??"",config:t}}),dashboardTitle:i.dashboardTitle??void 0,forecastSpec:i.forecastSpec??void 0,choices:i.choices??void 0,isStreaming:!1,hasError:!1}}var De=class i{alertDrawerOpen=f(!1);alertWidget=f(null);onSetAlert(t){this.alertWidget.set(t),this.alertDrawerOpen.set(!0)}onAlertClosed(){this.alertDrawerOpen.set(!1)}alertSource=D(()=>{let t=gt(this.selectedScope());if(t)return t;let e=this.conversationConnectionId();return e?{connectionId:e}:null});chartDataSourceId(t){return(t?.config??{}).dataSourceId??null}canCreateAlert(t){return!!this.alertSource()||!!this.chartDataSourceId(t)}createAlertFromChart(t){this.canCreateAlert(t)&&(this.isFilterChart(t)||this.onSetAlert(T(w({},this.artifactToWidget(t)),{id:"chat-alert"})))}aqChatEl;builderRef;artifactGridRef;composerRef;aiExecutiveSummaryEl;svc=N(me);tokenStore=N(ae);destroyRef=N(Ft);hostEl=N(Ie);features(){return I().features}widgetMenu(){return I().features.widgetMenu}copy(){return I().copy}showHeader(){return I().ui.header}withCount(t,e){return Jn(t,e)}zone=N(Ot);appRef=N(It);route=N(en);router=N(tn);dashboardState=N(Cn);publishRepo=N(ue);globalWidget=N(jn);forecastApi=N(Ze);cohort=N(Me);forecastService=N(xn);loading=f(!0);conversations=f([]);activeConversationId=f(null);conversationCustomerId=f(null);conversationConnectionId=f(null);messages=f([]);inputText=f("");isStreaming=f(!1);streamAbort=null;suggestions=f([]);suggestionsLoading=f(!0);suggestionsSeq=0;showConversationPicker=f(!1);showRelatedDashboards=f(!1);loadingConversation=f(!1);editingTitle=f(!1);titleDraft=f("");editingDashboardTitle=f(!1);dashboardTitleDraft=f("");renamingDashboard=f(!1);conversationsLoading=f(!0);dashboardsLoading=f(!0);menuSkeletonRows=[188,142,205];gallerySkeletonRows=[420,300,480,360,260,400];librarySkeletonGroups=[["62%","48%"],["55%","70%"]];libraryChipSkeletonWidths=[58,96,84,78,86,88,100,104,76,88];savingDashboard=f(!1);committingAction=f(null);conversationDashboards=f([]);showAddPicker=f(!1);inlinePickerFor=f(null);inlineChartTypePickerFor=f(null);inlineChartTypeOptions=f([]);inlineChartTypeLoading=f(!1);inlineChartTypePickerSeq=0;inlineChartTypeApplying=f(!1);inlineChartTypeError=f(null);inlineFilterPickerFor=f(null);showScopePicker=f(!1);datasets=f([]);pipelines=f([]);scopeLoading=f(!1);selectedScope=f(null);scopeListsLoaded=!1;saveDialogOpen=f(!1);saveDashboardName=f("");chatPaneTab=f("chat");tabsVisible=D(()=>ni(this.features()));cohortCriteria=f([]);selectedCriterionId=f(null);cohortPreview=f(null);cohortCriteriaLoaded=!1;cohortCriteriaLoading=f(!1);cohortCriteriaError=f(null);cohortPreviewLoading=f(!1);cohortPreviewError=f(null);cohortCriteriaSkeletonRows=[0,1,2,3];cohortMatchSkeletonRows=[0,1,2];cohortMatchesExpanded=f(!1);cohortAllMatches=f(null);cohortMembersLoading=f(!1);cohortMembersError=f(null);static COHORT_MEMBER_LIMIT=100;visibleCohortMatches=D(()=>si(this.cohortPreview(),this.cohortAllMatches(),this.cohortMatchesExpanded()));cohortNamesWithheld=D(()=>yt(this.cohortPreview()));cohortHasMoreMatches=D(()=>li(this.cohortPreview()));cohortMatchesTruncated=D(()=>di(this.cohortPreview(),this.cohortAllMatches()));cohortMatchesTruncatedNote=D(()=>{let t=this.cohortPreview(),e=this.cohortAllMatches();return!t||!e?"":this.copy().cohortMatchesTruncatedNote.replace("{shown}",String(e.length)).replace("{matchCount}",String(t.matchCount))});cohortMatchSummary=D(()=>{let t=this.cohortPreview();return t?this.copy().cohortMatchSummary.replace("{matchCount}",String(t.matchCount)).replace("{totalCount}",String(t.totalCount)):""});cohortViewAllLabel=D(()=>{let t=this.cohortPreview();return t?this.cohortMatchesExpanded()?this.copy().cohortShowFewerLink:this.copy().cohortViewAllLink.replace("{matchCount}",String(t.matchCount)):""});async loadCohortCriteria(){if(!this.cohortCriteriaLoaded){this.cohortCriteriaLoading.set(!0),this.cohortCriteriaError.set(null);try{this.cohortCriteria.set(await this.cohort.listCriteria()),this.cohortCriteriaLoaded=!0}catch(t){this.cohortCriteriaError.set(bt(t))}finally{this.cohortCriteriaLoading.set(!1)}}}async retryCohortCriteria(){this.cohortCriteriaLoaded=!1,await this.loadCohortCriteria()}async selectCohortCriterion(t){this.selectedCriterionId.set(t),this.cohortPreview.set(null),this.cohortPreviewError.set(null),this.resetCohortMatchExpansion(),this.cohortPreviewLoading.set(!0);try{let e=await this.cohort.previewCriterion(t);if(this.selectedCriterionId()!==t)return;this.cohortPreview.set(e)}catch(e){if(this.selectedCriterionId()!==t)return;this.cohortPreview.set(null),this.cohortPreviewError.set(bt(e))}finally{this.selectedCriterionId()===t&&this.cohortPreviewLoading.set(!1)}}resetCohortMatchExpansion(){this.cohortMatchesExpanded.set(!1),this.cohortAllMatches.set(null),this.cohortMembersError.set(null),this.cohortMembersLoading.set(!1)}async toggleAllCohortMatches(){if(this.cohortMatchesExpanded()){this.cohortMatchesExpanded.set(!1);return}let t=this.selectedCriterionId();if(!(!t||this.cohortMembersLoading())){if(this.cohortAllMatches()){this.cohortMatchesExpanded.set(!0);return}this.cohortMembersError.set(null),this.cohortMembersLoading.set(!0);try{let e=await this.cohort.listMembers(t,i.COHORT_MEMBER_LIMIT);if(this.selectedCriterionId()!==t)return;this.cohortAllMatches.set(e),this.cohortMatchesExpanded.set(!0)}catch(e){if(this.selectedCriterionId()!==t)return;this.cohortMembersError.set(e?.status===403?"forbidden":"failed")}finally{this.selectedCriterionId()===t&&this.cohortMembersLoading.set(!1)}}}addCohortToCanvas(){let t=this.cohortPreview();if(!t||this.activeArtifact().some(o=>{let a=o.config;return(a?.config?._meta?.cohortId??a?._meta?.cohortId)===t.criterionId}))return;this.pushCanvasHistory();let n=ri(t);this.bucketExtraCharts.update(o=>[...o,n]),this.ensureArtifactPaneOpen()}setChatPaneTab(t){ti(t,this.features())&&(this.chatPaneTab.set(t),(t==="library"||t==="tools")&&this.ensureArtifactPaneOpen(),t==="library"&&this.prefetchWidgetTemplateCatalog(),t==="tools"&&this.loadCohortCriteria())}galleryOpen=f(!1);gallerySearch=f("");templateCategories=f([]);templateAllTemplates=f([]);templateCategoriesLoading=f(!1);templateTemplatesLoading=f(!1);templateActiveCategory=f("all");widgetTemplateAllTemplates=f([]);widgetTemplateTemplatesLoading=f(!1);widgetTemplateActiveCategory=f("all");selectWidgetTemplateCategory(t){this.widgetTemplateActiveCategory.set(t)}widgetTemplatePickerSelectedIds=f([]);toggleWidgetTemplateSelection(t){this.widgetTemplatePickerSelectedIds.update(e=>e.includes(t)?e.filter(n=>n!==t):[...e,t])}addSelectedWidgetTemplates(){let t=this.widgetTemplatePickerSelectedIds();t.length&&(this.asOneCanvasStep(()=>{for(let e of t)this.selectWidgetTemplate(e)}),this.widgetTemplatePickerSelectedIds.set([]))}widgetTemplateCountForCategory(t){return this.widgetTemplateAllTemplates().filter(e=>e.category===t).length}librarySearch=f("");libraryKpiChartOptions={exporting:{enabled:!1},credits:{enabled:!1}};brandSparklineColor=f(On);readBrandSparklineColor(){this.brandSparklineColor.set(En(this.hostEl.nativeElement))}widgetTemplateCard(t){let e=this.widgetTemplatePreviews(),a=e.get(t.id)?.config?.config?.chart;return{templateId:t.id,title:t.widgetName,desc:t.description,value:a?.value??"\u2014",loading:!e.has(t.id),sparkline:a?.sparkline??[]}}libraryWidgetGroups=D(()=>{let t=this.widgetTemplateActiveCategory(),e=this.librarySearch().trim().toLowerCase();return(t==="all"?this.templateCategories():this.templateCategories().filter(o=>o.key===t)).map(o=>({key:o.key,label:o.label,cards:this.widgetTemplateAllTemplates().filter(a=>a.category===o.key).filter(a=>!e||a.widgetName.toLowerCase().includes(e)||(a.description??"").toLowerCase().includes(e)).map(a=>this.widgetTemplateCard(a))})).filter(o=>o.cards.length>0)});isGroupFullySelected(t){let e=this.widgetTemplatePickerSelectedIds();return t.length>0&&t.every(n=>e.includes(n.templateId))}toggleLibraryGroupSelection(t){let e=t.map(o=>o.templateId),n=this.isGroupFullySelected(t);this.widgetTemplatePickerSelectedIds.update(o=>{let a=new Set(o);return n?e.forEach(p=>a.delete(p)):e.forEach(p=>a.add(p)),[...a]})}openWidgetDetailFromCard(t){let e=this.widgetTemplatePreviews().get(t);if(!e)return;let n=T(w({},this.artifactToWidget(e)),{id:`kpi-gallery-${t}`});this.openWidgetDetailPanelForWidget(n,!0)}runViewTransition(t,e="forward"){let n=document,o=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if(typeof n.startViewTransition!="function"||o){t();return}let a=document.documentElement;e==="back"&&(a.dataset.vtDirection="back");let p=()=>delete a.dataset.vtDirection;n.startViewTransition(()=>{t(),this.appRef.tick()})?.finished?.then(p,p)??p()}artifactPickerTab=f("kpis");templateCountForCategory(t){return this.templateAllTemplates().filter(e=>e.category===t).length}libraryDashboardGroups=D(()=>{let t=this.templateActiveCategory(),e=this.librarySearch().trim().toLowerCase();return(t==="all"?this.templateCategories():this.templateCategories().filter(o=>o.key===t)).map(o=>({key:o.key,label:o.label,templates:this.templateAllTemplates().filter(a=>a.category===o.key).filter(a=>!e||a.name.toLowerCase().includes(e)||(a.description??"").toLowerCase().includes(e))})).filter(o=>o.templates.length>0)});widgetTemplatePreviews=f(new Map);widgetTemplateSourceId=f(null);widgetDetailPanelOpen=f(!1);widgetDetailPanelLoading=f(!1);widgetDetailPanelTitle=f(null);widgetDetailPanelRaw=f([]);widgetDetailPanelTemplateId=f(null);widgetDetailPanelCanAdd=f(!1);widgetDetailPanelKind=f("widget");widgetDetailPanelSourceWidgetTitle=f(null);detailPanelWidgetCrumb=D(()=>this.widgetDetailPanelKind()==="widget"?this.widgetDetailPanelSourceWidgetTitle():null);detailPanelLastCrumb=D(()=>{let t=this.widgetDetailPanelTitle();return t?t===this.detailPanelWidgetCrumb()?this.copy().detailCrumbLabel:t:null});widgetDetailPanelSelectedIds=f([]);widgetDetailPanelSourceTemplateId=f(null);detailPanelCohortId=f(null);detailPanelCohortData=f(null);cohortDetailCaption=D(()=>{let t=this.copy().cohortDetailCaption,e=this.detailPanelCohortData()?.detail?.scan;if(!e)return t;let n=this.copy().cohortDetailCoverage.replace("{events}",String(e.events)).replace("{systems}",String(e.systems));return`${t} \xB7 ${n}`});widgetDetailPanelSkeletonSlots=f([]);widgetDetailPanelSkeletonHeight=D(()=>{let t=this.widgetDetailPanelSkeletonSlots();return t.length?Math.max(...t.map(e=>(e.y+e.h)*72)):0});widgetDetailPanelWidgets=D(()=>{let t=this.widgetDetailPanelRaw().map((e,n)=>T(w({},this.artifactToWidget(e)),{id:`detail-panel-${n}`}));return dt(t)});filteredGalleryPrompts=D(()=>{let t=this.gallerySearch().trim().toLowerCase(),e=this.suggestions();return t?e.filter(n=>n.toLowerCase().includes(t)):e});welcomePromptCards=D(()=>{let t=this.forecastContext();return this.suggestions().slice(0,xc).map(e=>(I().features.forecast&&t?!!wt(e,t):!1)?{label:e,icon:"ng-stars-02",badge:"FORECAST",tone:"ai"}:{label:e,icon:"ng-lightbulb-05",tone:"plain"})});galleryPromptItems=D(()=>this.filteredGalleryPrompts().map(t=>({key:t,label:t,icon:"ng-lightbulb-05"})));artifactSourceMsgId=f(null);activeArtifactRaw=f([]);artifactForcedOpen=f(!1);templateSourceId=f(null);bucketExtraCharts=f([]);activeArtifact=D(()=>{let t=this.artifactSourceMsgId(),e=t?this.messages().find(o=>o.id===t)?.charts??this.activeArtifactRaw():this.activeArtifactRaw(),n=this.bucketExtraCharts();return n.length?[...e,...n]:e});artifactOpen=D(()=>this.artifactForcedOpen()||this.activeArtifact().length>0);dslOnlyArtifact=f(!1);CANVAS_HISTORY_LIMIT=25;canvasUndoStack=f([]);canvasRedoStack=f([]);canUndoCanvas=D(()=>this.canvasUndoStack().length>0);canRedoCanvas=D(()=>this.canvasRedoStack().length>0);canvasHistorySuspended=!1;snapshotCanvas(){return{base:[...this.activeArtifactRaw()],extras:[...this.bucketExtraCharts()],sourceMsgId:this.artifactSourceMsgId(),templateSourceId:this.templateSourceId(),widgetTemplateSourceId:this.widgetTemplateSourceId(),saveName:this.saveDashboardName()}}restoreCanvas(t){this.artifactSourceMsgId.set(t.sourceMsgId),this.activeArtifactRaw.set(t.base),this.bucketExtraCharts.set(t.extras),this.templateSourceId.set(t.templateSourceId),this.widgetTemplateSourceId.set(t.widgetTemplateSourceId),this.saveDashboardName.set(t.saveName),this.selectedWidgetIds.set([]),this.ensureArtifactPaneOpen()}pushCanvasHistory(){this.canvasHistorySuspended||(this.canvasUndoStack.update(t=>[...t,this.snapshotCanvas()].slice(-this.CANVAS_HISTORY_LIMIT)),this.canvasRedoStack.set([]))}asOneCanvasStep(t){this.pushCanvasHistory(),this.canvasHistorySuspended=!0;try{t()}finally{this.canvasHistorySuspended=!1}}undoCanvas(){let t=this.canvasUndoStack();t.length&&(this.canvasRedoStack.update(e=>[...e,this.snapshotCanvas()].slice(-this.CANVAS_HISTORY_LIMIT)),this.canvasUndoStack.set(t.slice(0,-1)),this.restoreCanvas(t[t.length-1]))}redoCanvas(){let t=this.canvasRedoStack();t.length&&(this.canvasUndoStack.update(e=>[...e,this.snapshotCanvas()].slice(-this.CANVAS_HISTORY_LIMIT)),this.canvasRedoStack.set(t.slice(0,-1)),this.restoreCanvas(t[t.length-1]))}ensureArtifactPaneOpen(){this.artifactForcedOpen()||this.artifactForcedOpen.set(!0)}artifactTitle=D(()=>{let t=this.mostRecentDashboardTitle();return t||(this.activeArtifact().find(n=>!this.isFilterChart(n))?.title??this.activeArtifact()[0]?.title??"Untitled canvas")});artifactSubtitle=D(()=>{let t=this.activeArtifact().filter(e=>!this.isFilterChart(e)).length;return`${this.artifactTitle()} \xB7 ${t} widget${t===1?"":"s"}`});isFilterChart(t){if(!t)return!1;let e=t.config??{};return Ne({componentName:(e.componentName??t.componentName??"").toLowerCase(),config:e.config??e})}mostRecentDashboardTitle(){let t=this.artifactSourceMsgId();if(!t)return;let e=this.messages(),n=e.findIndex(o=>o.id===t);for(let o=n;o>=0;o--)if(e[o]?.dashboardTitle)return e[o].dashboardTitle}baseArtifactWidgets=D(()=>{let t=this.artifactSourceMsgId()??"artifact",e=this.activeArtifact().map((o,a)=>T(w({},this.artifactToWidget(o)),{id:`${t}-${a}`})),n=dt(e);return hn(n)});filterOverlay=f(new Map);forecastOverlay=f(new Map);artifactForecastable=f({});artifactForecastingId=f(null);artifactWidgets=D(()=>{let t=this.baseArtifactWidgets(),e=this.filterOverlay(),n=this.forecastOverlay();return!e.size&&!n.size?t:t.map(o=>{let a=e.get(o.id),p=a?T(w({},o),{config:a.config,edited:a.edited}):o,x=n.get(o.id);return x?T(w({},p),{config:x}):p})});async onArtifactForecast(t){let e=String(t.widget.id);if(!this.artifactForecastingId()){if(!t.enable){this.forecastOverlay.update(n=>{let o=new Map(n);return o.delete(e),o});return}this.artifactForecastingId.set(e);try{let n=await this.forecastService.forecastWidget(t.widget);if(n?.guardrails&&n.guardrails.passed===!1)return;n?.widget?.config&&this.forecastOverlay.update(o=>new Map(o).set(e,n.widget.config))}catch{}finally{this.artifactForecastingId.set(null)}}}async loadArtifactForecastable(){let t=this.baseArtifactWidgets();if(!t.length){this.artifactForecastable.set({});return}this.artifactForecastable.set(await this.forecastService.probeWidgets(t))}applyingFilters=f(!1);activeDashboardFilters=f(null);activeResolvedFilters=f(null);applySummary=f(null);filterExplanation=f(null);applyFiltersSeq=0;applyFiltersAbort=null;filterSuggestCache=new Map;filterSuggestInflight=new Set;selectedWidgetIds=f([]);hasSelection=D(()=>this.features().canvas.widgetSelection?this.selectedWidgetIds().length>0:this.artifactWidgets().length>0);selectedArtifactCharts=D(()=>{if(!this.features().canvas.widgetSelection)return this.activeArtifact();let t=new Set(this.selectedWidgetIds()),e=this.artifactWidgets();return this.activeArtifact().filter((n,o)=>t.has(e[o]?.id))});artifactFooterHasActions=D(()=>{let t=this.features().canvas;return t.publishAsDashboard||t.addToDashboard||!!this.artifactForecastMsg()});builderOpen=f(!1);detailRootCrumb=D(()=>this.builderOpen()?this.builderRef?.dashboardName?.()?.trim()||this.copy().detailDashboardCrumbLabel:this.copy().detailCanvasCrumbLabel);builderDashboardId=f(null);builderPreseeded=f(!1);builderFullscreen=f(!1);chatPaneWidth=f(null);isResizing=f(!1);layoutMode=D(()=>ei({hasMessages:this.messages().length>0,artifactOpen:this.artifactOpen()&&!this.dslOnlyArtifact(),builderOpen:this.builderOpen()}));chatPaneStyleWidth=D(()=>{if(this.builderFullscreen())return null;let t=this.layoutMode();return t==="split"||t==="builder"?this.chatPaneWidth():null});customerId=()=>{let t=this.tokenStore.tenantId();return I().customerId??t??""};attachments=f([]);uploadsInFlight=D(()=>this.attachments().some(t=>t.status==="uploading"));excelCount=D(()=>this.attachments().filter(t=>ft(t.name,t.contentType)).length);nonExcelCount=D(()=>this.attachments().length-this.excelCount());attachAtCapacity=D(()=>this.nonExcelCount()>=ht&&this.excelCount()>=Ct);acceptUploadTypes=[...mt,".xls",".xlsx"].join(",");dragDepth=0;isDraggingFile=f(!1);canSend=D(()=>{let t=this.inputText().trim().length>0,e=this.attachments().some(n=>n.status==="ready");return(t||e)&&!this.isStreaming()&&!this.uploadsInFlight()});quoteBadge=f(null);replyQuote=f(null);activeConversation=D(()=>this.conversations().find(t=>t.id===this.activeConversationId())??null);forecastTitle=f(null);activeConversationTitle=D(()=>this.activeConversation()?.title??this.forecastTitle()??"New conversation");static FALLBACK_PROMPTS=["Give me a dashboard overview of my workforce","Show headcount breakdown by department","What are the top metrics I should be tracking?","Analyze trends over the last quarter","Show me employee distribution by location"];constructor(){Ce(()=>{let t=this.customerId(),e=this.selectedScope();if(!t)return;let n=e?e.id:null,o=e?.kind==="pipeline",a=++this.suggestionsSeq;this.suggestionsLoading.set(!0),this.svc.getSuggestedPrompts(n,o).then(p=>{if(a!==this.suggestionsSeq)return;let x=[...p.widgetSuggestions??[],...p.conversationStarters??[]];this.suggestions.set(x.length?x:i.FALLBACK_PROMPTS)}).catch(()=>{a===this.suggestionsSeq&&this.suggestions.set(i.FALLBACK_PROMPTS)}).finally(()=>{a===this.suggestionsSeq&&this.suggestionsLoading.set(!1)})}),this.forecastApi.context().then(t=>this.forecastContext.set(t)),Ce(()=>{let t=this.customerId();t&&$t(()=>{let e=this.conversationCustomerId();!e||e===t||this.resetForTenantChange()})})}resetForTenantChange(){this.activeConversationId.set(null),this.conversationCustomerId.set(null),this.conversationConnectionId.set(null),this.messages.set([]),this.conversations.set([]),this.closeArtifact(),this.builderOpen.set(!1),this.builderPreseeded.set(!1),this.builderDashboardId.set(null),this.conversationsLoading.set(!0),this.svc.listConversations().then(t=>this.conversations.set(t)).catch(()=>this.conversations.set([])).finally(()=>this.conversationsLoading.set(!1)),this.loadConversationDashboards()}async ngOnInit(){this.destroyRef.onDestroy(pn(()=>this.readBrandSparklineColor())),this.readBrandSparklineColor();try{this.conversationsLoading.set(!0);let o=await this.svc.listConversations().catch(()=>[]);this.conversations.set(o)}finally{this.conversationsLoading.set(!1),this.loading.set(!1)}this.loadConversationDashboards(),this.prefetchTemplateCatalog();let t=I().initial,e=this.route.snapshot.queryParamMap.get("summary")==="1",n=t.dashboardId??this.route.snapshot.paramMap.get("id");n&&(this.builderPreseeded.set(!1),this.builderDashboardId.set(n),this.builderOpen.set(!0),t.summary||e?this.onExecutiveSummary(n).then(()=>{e&&this.router.navigate([],{relativeTo:this.route,queryParams:{},replaceUrl:!0})}):this.restoreThreadForDashboard(n))}async restoreThreadForDashboard(t){try{let e=null;if(e=(await this.svc.getDashboard(t).catch(()=>null))?.conversationId??null,e||(e=(await this.svc.listDashboards(100).catch(()=>[])).find(p=>p.id===t)?.conversationId??null),!e)return;let o=await this.svc.getConversation(e);if(!o)return;this.activeConversationId.set(e),this.conversationCustomerId.set(this.customerId()),this.conversationConnectionId.set(o.conversation.connectionId??null),this.messages.set(o.messages.map(Di)),this.loadConversationDashboards(),this.scrollToBottom()}catch{}}streamSpeed=[6,18];openScopeMenu(){let t=!this.showScopePicker();this.showScopePicker.set(t),t&&this.loadScopeLists()}async loadScopeLists(){if(!this.scopeListsLoaded){this.scopeListsLoaded=!0,this.scopeLoading.set(!0);try{let[t,e]=await Promise.allSettled([this.svc.listDatasets(),this.svc.listPipelines()]);t.status==="fulfilled"&&this.datasets.set(t.value),e.status==="fulfilled"&&this.pipelines.set(e.value),[t,e].filter(o=>o.status==="rejected").length>0&&(this.scopeListsLoaded=!1)}finally{this.scopeLoading.set(!1)}}}selectScope(t,e){this.selectedScope.set({kind:t,id:e.id,name:e.name}),this.showScopePicker.set(!1)}clearScope(){this.selectedScope.set(null)}dashboardSource(){return gt(this.selectedScope())??{}}closeScopeMenu(){this.showScopePicker.set(!1)}async selectConversation(t,e=!1){if(this.showConversationPicker.set(!1),!(t===this.activeConversationId()&&!e)){this.loading.set(!0),this.loadingConversation.set(!0);try{let n=await this.svc.getConversation(t);if(!n)return;this.activeConversationId.set(t),this.conversationCustomerId.set(this.customerId()),this.conversationConnectionId.set(n.conversation.connectionId??null),this.messages.set(n.messages.map(Di)),this.loadConversationDashboards(),this.scrollToBottom()}catch{}finally{this.loading.set(!1),this.loadingConversation.set(!1)}}}async deleteConversation(t,e){t.stopPropagation();try{await this.svc.deleteConversation(e),this.conversations.update(n=>n.filter(o=>o.id!==e)),this.activeConversationId()===e&&(this.activeConversationId.set(null),this.conversationCustomerId.set(null),this.conversationConnectionId.set(null),this.messages.set([]))}catch{}}newConversation(){this.forecastTitle.set(null),this.closeForecastSettings(),this.appliedForecastSettings.set(null),this.activeConversationId.set(null),this.conversationCustomerId.set(null),this.conversationConnectionId.set(null),this.messages.set([]),this.showConversationPicker.set(!1)}openRelatedDashboard(t){this.showRelatedDashboards.set(!1),this.closeArtifact(),this.builderPreseeded.set(!1),this.builderDashboardId.set(t),this.builderOpen.set(!0)}async openNewDashboard(){if(!this.savingDashboard()){this.showRelatedDashboards.set(!1),this.savingDashboard.set(!0);try{let t="Untitled Dashboard";this.closeArtifact(),this.dashboardState.resetDashboard(),this.dashboardState.setDashboardName(t);let e=await this.svc.createDashboard(T(w({name:t,conversationId:this.activeConversationId()??void 0},this.dashboardSource()),{widgets:[]}));this.dashboardState.setDashboardId(e.id),this.builderPreseeded.set(!0),this.builderDashboardId.set(e.id),this.builderOpen.set(!0)}catch{}finally{this.savingDashboard.set(!1)}}}convSearch=f("");dashSearch=f("");renamingId=f(null);renameDraft=f("");static BUCKETS=[{key:"today",maxDays:0},{key:"yesterday",maxDays:1},{key:"week",maxDays:7},{key:"older",maxDays:1/0}];daysAgo(t){if(!t)return 1/0;let e=new Date(t);if(Number.isNaN(e.getTime()))return 1/0;let n=new Date;n.setHours(0,0,0,0);let o=new Date(e);return o.setHours(0,0,0,0),Math.round((n.getTime()-o.getTime())/864e5)}relativeStamp(t){if(!t)return"";let e=new Date(t);return Number.isNaN(e.getTime())?"":this.daysAgo(t)===0?e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}bucketLabel(t){let e=this.copy();return t==="today"?e.groupToday:t==="yesterday"?e.groupYesterday:t==="week"?e.groupPrevious7Days:e.groupOlder}groupByRecency(t,e){let n=[],o=[...t].sort((a,p)=>new Date(e(p)??0).getTime()-new Date(e(a)??0).getTime());for(let a of i.BUCKETS){let p=o.filter(x=>this.daysAgo(e(x))<=a.maxDays);if(p.length&&n.push({key:a.key,label:this.bucketLabel(a.key),items:p}),o=o.filter(x=>this.daysAgo(e(x))>a.maxDays),!o.length)break}return n}matches(t,e){return e?(t??"").toLowerCase().includes(e.toLowerCase()):!0}groupedConversations=D(()=>this.groupByRecency(this.conversations().filter(t=>this.matches(t.title,this.convSearch())),t=>t.updatedAt));groupedDashboards=D(()=>this.groupByRecency(this.conversationDashboards().filter(t=>this.matches(t.name,this.dashSearch())),t=>t.updatedAt));pickerSearch=f("");groupedPickerDashboards=D(()=>this.groupByRecency(this.conversationDashboards().filter(t=>this.matches(t.name,this.pickerSearch())),t=>t.updatedAt));pickerSearchEmpty=D(()=>!!this.pickerSearch()&&this.groupedPickerDashboards().length===0);convSearchEmpty=D(()=>!!this.convSearch()&&this.groupedConversations().length===0);dashSearchEmpty=D(()=>!!this.dashSearch()&&this.groupedDashboards().length===0);countClause(t,e){return typeof t!="number"||!Number.isFinite(t)?"":`${t} ${e}${t===1?"":"s"}`}conversationMeta(t){let e=this.relativeStamp(t.lastMessageAt??t.updatedAt);return[this.countClause(t.messageCount,"message"),e].filter(Boolean).join(" \xB7 ")}dashboardMeta(t){let e=this.relativeStamp(t.updatedAt);return[this.countClause(t.widgetCount,"widget"),e].filter(Boolean).join(" \xB7 ")}startRename(t,e,n){t.stopPropagation(),this.renamingId.set(e),this.renameDraft.set(n??"")}cancelRename(t){t?.stopPropagation(),this.renamingId.set(null)}async commitRenameConversation(t,e){t.stopPropagation();let n=this.renameDraft().trim();if(this.renamingId.set(null),!(!n||n===e.title))try{await this.svc.updateConversation(e.id,{title:n}),this.conversations.update(o=>o.map(a=>a.id===e.id?T(w({},a),{title:n}):a))}catch{}}async commitRenameDashboard(t,e){t.stopPropagation();let n=this.renameDraft().trim();if(this.renamingId.set(null),!(!n||n===e.name))try{await this.svc.updateDashboard(e.id,{name:n}),this.conversationDashboards.update(o=>o.map(a=>a.id===e.id?T(w({},a),{name:n}):a))}catch{}}async deleteDashboardFromMenu(t,e){t.stopPropagation();try{await this.svc.deleteDashboard(e),this.conversationDashboards.update(n=>n.filter(o=>o.id!==e)),this.builderDashboardId()===e&&this.builderOpen.set(!1)}catch{}}startEditTitle(){this.activeConversationId()&&(this.titleDraft.set(this.activeConversationTitle()),this.editingTitle.set(!0))}cancelEditTitle(){this.editingTitle.set(!1)}async commitTitle(){if(!this.editingTitle())return;this.editingTitle.set(!1);let t=this.activeConversationId(),e=this.titleDraft().trim();if(!(!t||!e||e===this.activeConversationTitle()))try{await this.svc.updateConversation(t,{title:e}),this.conversations.update(n=>n.map(o=>o.id===t?T(w({},o),{title:e}):o))}catch{}}onFilesPicked(t){let e=t.target,n=Array.from(e.files??[]);e.value="";for(let o of n)this.startUpload(o)}onComposerDragOver(t){this.attachAtCapacity()||this.isStreaming()||(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="copy"))}onComposerDragEnter(t){this.attachAtCapacity()||this.isStreaming()||t.dataTransfer?.types.includes("Files")&&(t.preventDefault(),this.dragDepth++,this.isDraggingFile.set(!0))}onComposerDragLeave(t){t.preventDefault(),this.dragDepth=Math.max(0,this.dragDepth-1),this.dragDepth===0&&this.isDraggingFile.set(!1)}onComposerDrop(t){if(t.preventDefault(),this.dragDepth=0,this.isDraggingFile.set(!1),this.attachAtCapacity()||this.isStreaming())return;let e=Array.from(t.dataTransfer?.files??[]);for(let n of e)this.startUpload(n)}startUpload(t){let e=ft(t.name,t.type);if(e&&this.excelCount()>=Ct||!e&&this.nonExcelCount()>=ht||!e&&!mt.includes(t.type)||t.size>Zn||this.attachments().some(x=>x.name===t.name&&x.size===t.size&&x.file?.lastModified===t.lastModified))return;let o=he(),a=new AbortController,p={id:o,name:t.name,contentType:t.type,size:t.size,status:"uploading",progress:0,file:t,abort:a};this.attachments.update(x=>[...x,p]),this.runUpload(o,t,a)}async runUpload(t,e,n){try{let{key:o}=await this.svc.uploadAttachment(e,{signal:n.signal});this.patchAttachment(t,{status:"ready",key:o,progress:100})}catch(o){if(n.signal.aborted)return;console.error("[ask-aquera] attachment upload failed",o),this.patchAttachment(t,{status:"error"})}}patchAttachment(t,e){this.attachments.update(n=>n.map(o=>o.id===t?w(w({},o),e):o))}removeAttachment(t){this.attachments().find(e=>e.id===t)?.abort?.abort(),this.attachments.update(e=>e.filter(n=>n.id!==t))}retryAttachment(t){let e=this.attachments().find(o=>o.id===t);if(!e?.file)return;let n=new AbortController;this.patchAttachment(t,{status:"uploading",progress:0,abort:n}),this.runUpload(t,e.file,n)}isMultiChoice(t){return(t.choices?.length??0)>1}onChoiceChange(t,e,n){if(!n||e.selected||this.isStreaming())return;let o=e.options.find(a=>a.id===n);o&&(this.isMultiChoice(t)?this.updateAssistantMsg(t.id,a=>({choices:(a.choices??[]).map(p=>p===e?T(w({},p),{draftSelection:o.id,chatOpen:!1,chatDraftText:void 0}):p)})):this.selectChoice(t,e,o))}selectChoice(t,e,n){e.selected||this.isStreaming()||(this.updateAssistantMsg(t.id,o=>({choices:(o.choices??[]).map(a=>a===e?T(w({},a),{selected:n.id,draftSelection:void 0,chatOpen:!1,chatDraftText:void 0}):a)})),this.pendingDisplayOverride=`${this.choiceTitle(e)}: ${n.label}`,this.inputText.set(n.reply??n.label),this.sendMessage())}hasPendingDraft(t){return!!t.choices?.some(e=>!e.selected&&(e.draftSelection||e.chatDraftText?.trim()))}submitChoices(t){if(this.isStreaming())return;let e=[],n=[];this.updateAssistantMsg(t.id,o=>({choices:(o.choices??[]).map(a=>{if(a.selected)return a;let p=a.chatDraftText?.trim();if(p)return e.push(this.chatDraftReply(a,p)),n.push(`${this.choiceTitle(a)}: ${p}`),T(w({},a),{selected:"__chat__",draftSelection:void 0,chatOpen:!1});if(!a.draftSelection)return a;let x=a.options.find(v=>v.id===a.draftSelection);return x&&(e.push(x.reply??x.label),n.push(`${this.choiceTitle(a)}: ${x.label}`)),T(w({},a),{selected:a.draftSelection,draftSelection:void 0})})})),e.length&&(this.inputText.set(e.join(`
10
10
  `)),this.pendingDisplayOverride=n.join(`