@aquera/data-visualizer-sdk 0.0.40 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{chunk-5ZVDCCLT.js → chunk-3ZOIHHON.js} +1 -1
- package/{chunk-CCS4AZTM.js → chunk-5PJFIQQV.js} +1 -1
- package/{chunk-TSSIT4HP.js → chunk-GZIZ45JW.js} +1 -1
- package/{chunk-4XZFPFUO.js → chunk-N6FSICJH.js} +1 -1
- package/{chunk-MAL6O7D5.js → chunk-PSLZ3MHD.js} +1 -1
- package/{chunk-ENDHTKIB.js → chunk-SONPE6N4.js} +2 -2
- package/{chunk-AQHMVQFH.js → chunk-ZGE223RR.js} +1 -1
- package/main.js +1 -1
- package/package.json +1 -1
|
@@ -40497,7 +40497,7 @@ ${t.error.stack}</pre
|
|
|
40497
40497
|
`,Vm=null;function eF(i){!i||typeof CSSStyleSheet>"u"||customElements.whenDefined("nile-calendar").then(()=>{let e=0,t=()=>{let M=i.shadowRoot;if(!M){if(++e>30)return;requestAnimationFrame(t);return}Vm||(Vm=new CSSStyleSheet,Vm.replaceSync(PYt)),!M.adoptedStyleSheets.includes(Vm)&&(M.adoptedStyleSheets=[...M.adoptedStyleSheets,Vm])};t()})}var tF=[{id:"1d",label:"1d",amount:1,unit:"days"},{id:"1w",label:"1wk",amount:1,unit:"weeks"},{id:"1mo",label:"1mo",amount:1,unit:"months"},{id:"1y",label:"1yr",amount:1,unit:"years"}];var RYt={Minutes:[5,10,15,30,45].map(i=>({amount:i,unit:"minutes"})),Hours:[1,2,3,6,8,12].map(i=>({amount:i,unit:"hours"})),Days:[1,2,3,4,5,6].map(i=>({amount:i,unit:"days"})),Weeks:[1,2,3,4].map(i=>({amount:i,unit:"weeks"})),Months:[1,2,3,6,9,12].map(i=>({amount:i,unit:"months"})),Years:[1,2,3,5].map(i=>({amount:i,unit:"years"}))},VYt={minutes:6e4,hours:36e5,days:864e5,weeks:6048e5};function fst(i,e){let t=i.getUTCFullYear()*12+i.getUTCMonth()-e,M=Math.floor(t/12),n=t-M*12,r=new Date(Date.UTC(M,n+1,0)).getUTCDate(),o=Math.min(i.getUTCDate(),r);return new Date(Date.UTC(M,n,o,i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds()))}function iF(i,e,t){let M=t.getTime(),n;return e==="months"?n=fst(t,i).getTime():e==="years"?n=fst(t,i*12).getTime():n=M-i*VYt[e],{from:new Date(n).toISOString(),to:new Date(M).toISOString()}}var BYt=["calendar"],FYt=(i,e)=>e.id;function HYt(i,e){if(i&1){let t=Le();C(0,"button",11),Ae("click",function(){let n=P(t).$implicit,r=p();return R(r.selectPreset(n.id))}),Y(1),b()}if(i&2){let t=e.$implicit,M=p();Wt("trp-pill--active",M.activePresetId()===t.id),L(),yi(" ",t.label," ")}}function JYt(i,e){if(i&1){let t=Le();C(0,"button",12),Ae("click",function(){P(t);let n=p();return R(n.clearWindow())}),Zt(1,"nile-glyph",13),b()}}var Bm=class i{presets=tF;calendarRef;thisYear=new Date().getFullYear();calendarStartYear=this.thisYear-100;calendarEndYear=this.thisYear+20;resetKey=at(null);apply=Xi();applied=ke(null);customOpen=ke(!1);calendarValue=At(()=>{let e=this.applied();if(!e)return null;let{from:t,to:M}=this.resolveRangeFor(e);return JSON.stringify({startDate:t,endDate:M})});activePresetId=At(()=>{let e=this.applied();return!e||e.kind!=="relative"?null:this.presets.find(t=>t.amount===e.amount&&t.unit===e.unit)?.id??null});hasActiveFilter=At(()=>this.applied()!==null);isCustomActive=At(()=>this.applied()!==null&&this.activePresetId()===null);customLabel=At(()=>{let e=this.applied();return!e||this.activePresetId()?"Custom":e.kind==="relative"?`Last ${e.amount} ${e.unit}`:"Custom range"});constructor(){eo(()=>{this.resetKey(),fM(()=>{this.applied.set(null),this.customOpen.set(!1)})})}selectPreset(e){let t=this.presets.find(n=>n.id===e);if(!t)return;if(this.activePresetId()===e){this.clearWindow();return}let M={kind:"relative",amount:t.amount,unit:t.unit};this.applied.set(M),this.customOpen.set(!1),this.apply.emit(this.resolveRangeFor(M))}ngAfterViewInit(){eF(this.calendarRef?.nativeElement)}openCustom(){this.customOpen.set(!0),eF(this.calendarRef?.nativeElement)}onCalendarChange(e){let{startDate:t,endDate:M}=e.detail??{};if(!t||!M)return;let n={kind:"absolute",from:t.toISOString(),to:M.toISOString()};this.applied.set(n),this.customOpen.set(!1),this.apply.emit(this.resolveRangeFor(n))}onCalendarClear(){this.clearWindow()}clearWindow(){this.applied.set(null),this.customOpen.set(!1),this.apply.emit(null)}cancelCustom(){this.customOpen.set(!1)}reapply(){let e=this.applied();e&&this.apply.emit(this.resolveRangeFor(e))}resolveRangeFor(e){return e.kind==="relative"?iF(e.amount,e.unit,new Date):{from:e.from,to:e.to}}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["app-time-range-picker"]],viewQuery:function(t,M){if(t&1&&eN(BYt,5),t&2){let n;ll(n=gl())&&(M.calendarRef=n.first)}},inputs:{resetKey:[1,"resetKey"]},outputs:{apply:"apply"},decls:13,vars:11,consts:[["calendar",""],[1,"trp"],["role","group","aria-label","Time range",1,"trp-pills"],[1,"trp-presets"],["type","button",1,"trp-pill",3,"trp-pill--active"],["hoist","","placement","bottom-start",3,"nile-hide","open"],["type","button","slot","trigger",1,"trp-pill","trp-pill--custom",3,"click"],[1,"trp-pill--custom__label"],["name","ng-calendar","method","stroke","size","18"],["range","","allowClear","","doubleClickUnselect","","showMonthDropdown","","showYearDropdown","","showManualInputs","","dateFormat","YYYY-MM-DD",3,"mousedown","nile-change","nile-clear","startYear","endYear"],["type","button","aria-label","Clear time range",1,"trp-clear"],["type","button",1,"trp-pill",3,"click"],["type","button","aria-label","Clear time range",1,"trp-clear",3,"click"],["name","ng-x-close","method","stroke","size","16","color","var(--ng-colors-text-tertiary-600)"]],template:function(t,M){t&1&&(C(0,"div",1)(1,"div",2)(2,"div",3),ht(3,HYt,2,3,"button",4,FYt),b(),C(5,"nile-dropdown",5),Ae("nile-hide",function(){return M.cancelCustom()}),C(6,"button",6),Ae("click",function(){return M.openCustom()}),C(7,"span",7),Y(8),b(),Zt(9,"nile-glyph",8),b(),C(10,"nile-calendar",9,0),Ae("mousedown",function(r){return r.stopPropagation()})("nile-change",function(r){return M.onCalendarChange(r)})("nile-clear",function(){return M.onCalendarClear()}),b()(),he(12,JYt,2,0,"button",10),b()()),t&2&&(L(),Wt("trp-pills--expanded",M.customOpen()),L(2),xt(M.presets),L(2),Ue("open",M.customOpen()),L(),Wt("trp-pill--active",M.isCustomActive()),L(2),it(M.customLabel()),L(),It("color",M.hasActiveFilter()?"var(--ng-colors-bg-brand-solid)":"var(--ng-colors-text-tertiary-600)"),L(),Ue("startYear",M.calendarStartYear)("endYear",M.calendarEndYear),It("value",M.calendarValue()),L(2),xe(M.hasActiveFilter()?12:-1))},styles:[".trp[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-shrink:0}.trp-pills[_ngcontent-%COMP%]{display:flex;align-items:center;gap:0;padding:3px}.trp-pill[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;padding:5px 10px;font-family:inherit;font-size:var(--ng-font-size-text-xs);font-weight:var(--ng-font-weight-medium);color:var(--ng-colors-text-tertiary-600);background:transparent;border:none;border-radius:var(--ng-radius-md);cursor:pointer;transition:background .15s,color .15s}.trp-pill[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-primary)}.trp-pill--active[_ngcontent-%COMP%]{color:var(--ng-colors-fg-brand-primary-600);background:var(--ng-colors-bg-primary);font-weight:var(--ng-font-weight-semibold)}.trp-pill--custom[_ngcontent-%COMP%]{white-space:nowrap;gap:0;transition:background .15s,color .15s,padding-left .25s ease,padding-right .25s ease}.trp-pill--custom__label[_ngcontent-%COMP%]{display:inline-block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:140px;margin-right:4px;opacity:1;transition:max-width .25s ease,opacity .15s ease,margin-right .25s ease}.trp-clear[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:24px;height:24px;margin-left:2px;padding:0;background:transparent;border:none;border-radius:var(--ng-radius-md);cursor:pointer;transition:background .15s}.trp-clear[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-primary)}.trp-pill--custom[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{transition:color .15s}.trp-presets[_ngcontent-%COMP%]{display:flex;align-items:center;gap:2px;overflow:hidden;max-width:220px;margin-right:2px;opacity:1;transition:max-width .25s ease,opacity .15s ease,margin-right .25s ease}.trp-pills[_ngcontent-%COMP%]:not(:hover):not(:focus-within):not(.trp-pills--expanded) .trp-presets[_ngcontent-%COMP%]{max-width:0;margin-right:0;opacity:0;pointer-events:none}.trp-pills[_ngcontent-%COMP%]:not(:hover):not(:focus-within):not(.trp-pills--expanded) .trp-pill--custom__label[_ngcontent-%COMP%]{max-width:0;margin-right:0;opacity:0}.trp-pills[_ngcontent-%COMP%]:not(:hover):not(:focus-within):not(.trp-pills--expanded) .trp-pill--custom[_ngcontent-%COMP%]{padding-left:6px;padding-right:6px}"]})};var GYt=(i,e)=>e.mode,$Yt=(i,e)=>e.label,XYt=(i,e)=>e.id,qYt=(i,e)=>e.op;function KYt(i,e){if(i&1){let t=Le();$(0,"button",16),Ze("click",function(){let n=P(t).$implicit;p();let r=Dx(2);return p().pickMode(n.mode),R(r.hide())}),Mt(1,"nile-glyph",17),$(2,"span",18)(3,"span",19),Y(4),ee(),$(5,"span",20),Y(6),ee()(),$(7,"span",21),Y(8),ee()()}if(i&2){let t=e.$implicit,M=p(2);Wt("is-active",t.mode===M.activeMode().mode),It("aria-checked",t.mode===M.activeMode().mode),L(),ot("name",t.icon),L(3),it(t.label),L(2),it(t.desc),L(2),it(t.mode===M.activeMode().mode?"\u2713":"")}}function eZt(i,e){if(i&1&&($(0,"div",2)(1,"nile-dropdown",8,0)(3,"button",9),Mt(4,"nile-glyph",10),$(5,"span",11),Y(6),ee(),$(7,"span",12),Y(8,"\u25BE"),ee()(),$(9,"div",13)(10,"span",14),Y(11,"Filter with"),ee(),ht(12,KYt,9,7,"button",15,GYt),ee()()()),i&2){let t=p();L(3),ot("disabled",t.inert()),L(),ot("name",t.activeMode().icon),L(2),it(t.activeMode().label),L(6),xt(t.modes)}}function tZt(i,e){if(i&1){let t=Le();$(0,"button",30),Ze("click",function(){P(t);let n=p().$index,r=p(2);return R(r.toggleJoin(n))}),Y(1),ee()}if(i&2){let t=p().$implicit,M=p(2);ot("disabled",M.inert()),It("aria-label","Join with "+(t.connector==="or"?"OR":"AND")+" \u2014 click to change"),L(),it(t.connector==="or"?"OR":"AND")}}function iZt(i,e){if(i&1){let t=Le();he(0,tZt,2,3,"button",24),$(1,"span",25)(2,"span",26),Y(3),ee(),$(4,"span",27),Y(5),ee(),$(6,"span",28),Y(7),ee(),$(8,"button",29),Ze("click",function(){let n=P(t).$index,r=p(2);return R(r.removeChip(n))}),Y(9,"\u2715"),ee()()}if(i&2){let t=e.$implicit,M=e.$index,n=p(2);xe(M>0?0:-1),L(3),it(n.fieldLabel(t.field)),L(2),it(n.opLabel(t.op)),L(2),it(n.valueLabel(t)),L(),ot("disabled",n.inert()),It("aria-label","Remove filter "+n.fieldLabel(t.field))}}function MZt(i,e){if(i&1){let t=Le();$(0,"div",4),ht(1,iZt,10,6,null,null,Mr),$(3,"span",22)(4,"nile-button",23),Ze("click",function(){P(t);let n=p();return R(n.openCondPop())}),Y(5," + Add filter "),ee()()()}if(i&2){let t=p();L(),xt(t.conditions()),L(3),It("disabled",t.inert()?"":null)}}function nZt(i,e){if(i&1&&($(0,"span",42),Y(1),ee()),i&2){let t=p(2);Wt("is-error",!!t.exprState().error)("is-warn",t.exprState().partial),L(),it(t.exprState().error?"!":t.exprState().partial?"~":"\u2713")}}function rZt(i,e){if(i&1&&Mt(0,"span",45),i&2){let t=e.$implicit;aM("width",t,"%")}}function oZt(i,e){if(i&1&&(ht(0,rZt,1,2,"span",43,Ho),$(2,"span",44),Y(3,"Loading values\u2026"),ee()),i&2){let t=p(3);xt(t.skeletonRows)}}function aZt(i,e){if(i&1){let t=Le();$(0,"button",47),Ze("click",function(){let n=P(t).$implicit,r=p(4);return R(r.applySuggestion(n.insert))}),$(1,"span",48),Y(2),ee(),$(3,"span",49),Y(4),ee()()}if(i&2){let t=e.$implicit;L(2),it(t.label),L(),Wt("is-badge",t.hint==="CONNECTOR"||t.hint==="KEYWORD"||t.hint==="value"),L(),it(t.hint)}}function sZt(i,e){if(i&1&&ht(0,aZt,5,4,"button",46,$Yt),i&2){let t=p(3);xt(t.suggestions())}}function lZt(i,e){if(i&1&&($(0,"span",36),he(1,oZt,4,0)(2,sZt,2,0),ee()),i&2){let t=p(2);It("aria-busy",t.suggestLoading()),L(),xe(t.suggestLoading()?1:2)}}function gZt(i,e){if(i&1&&($(0,"span",38),Y(1),ee()),i&2){let t=p(2);L(),it(t.exprState().error)}}function NZt(i,e){i&1&&($(0,"span",39),Y(1,"Valid, but "),$(2,"code"),Y(3,"or"),ee(),Y(4," / bare "),$(5,"code"),Y(6,"not"),ee(),Y(7," / grouping are dropped on apply."),ee())}function uZt(i,e){i&1&&($(0,"span",40),Y(1,"Valid"),ee())}function cZt(i,e){if(i&1){let t=Le();$(0,"span",31)(1,"span",32),Mt(2,"nile-glyph",33),ee(),$(3,"input",34),Ze("ngModelChange",function(n){P(t);let r=p();return r.exprDraft.set(n),R(r.suggestDismissed.set(!1))})("focus",function(){P(t);let n=p();return R(n.suggestDismissed.set(!1))})("keydown",function(n){P(t);let r=p();return R(r.onExprKeydown(n))}),ee(),he(4,nZt,2,5,"span",35),he(5,lZt,3,2,"span",36),ee(),$(6,"span",37),he(7,gZt,2,1,"span",38)(8,NZt,8,0,"span",39)(9,uZt,2,0,"span",40),ee(),$(10,"nile-button",41),Ze("click",function(){P(t);let n=p();return R(n.runExpression())}),Y(11,"Run"),ee()}if(i&2){let t=p();Wt("is-error",t.exprState().error),L(3),ot("disabled",t.inert())("ngModel",t.exprDraft()),It("aria-expanded",t.suggestions().length>0),L(),xe(t.exprState().empty?-1:4),L(),xe(t.suggestLoading()||t.suggestions().length?5:-1),L(2),xe(t.exprState().error?7:t.exprState().partial?8:t.exprState().ok?9:-1),L(3),It("disabled",t.inert()||!t.exprState().ok?"":null)}}function DZt(i,e){if(i&1){let t=Le();$(0,"span",50)(1,"span",51),Mt(2,"nile-glyph",52),ee(),$(3,"input",53),Ze("ngModelChange",function(n){P(t);let r=p();return R(r.promptDraft.set(n))})("keydown",function(n){P(t);let r=p();return R(r.onPromptKeydown(n))}),ee()(),$(4,"nile-button",41),Ze("click",function(){P(t);let n=p();return R(n.askPrompt())}),Y(5,"Ask"),ee()}if(i&2){let t=p();L(3),ot("disabled",t.inert())("ngModel",t.promptDraft()),L(),It("disabled",t.inert()||!t.promptDraft().trim()?"":null)}}function IZt(i,e){if(i&1&&($(0,"span",54),Y(1),ee()),i&2){let t=p(2);L(),Jo("",t.chipCount()," ",t.chipCount()===1?"filter":"filters")}}function dZt(i,e){if(i&1){let t=Le();he(0,IZt,2,2,"span",54),$(1,"nile-button",55),Ze("click",function(){P(t);let n=p();return R(n.onClearAll())}),Y(2,"Clear all"),ee()}if(i&2){let t=p();xe(t.mode()==="manual"&&t.chipCount()>0?0:-1),L(),It("disabled",t.inert()||!t.canClear()?"":null)}}function jZt(i,e){if(i&1){let t=Le();$(0,"span",56)(1,"app-time-range-picker",57),Ze("apply",function(n){P(t);let r=p();return R(r.timeRangeApply.emit(n))}),ee()()}if(i&2){let t=p();Wt("rail__time--divided",t.showFilterControls()),L(),ot("resetKey",t.timeFilterResetKey())}}function yZt(i,e){if(i&1&&($(0,"nile-option",63),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.id),L(),it(t.label)}}function TZt(i,e){if(i&1&&($(0,"nile-option",63),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.op),L(),it(t.label)}}function AZt(i,e){i&1&&($(0,"span",65),Mt(1,"span",72),ee())}function zZt(i,e){if(i&1&&($(0,"nile-option",63),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t),L(),it(t)}}function hZt(i,e){if(i&1){let t=Le();$(0,"nile-select",73),Ze("nile-change",function(n){P(t);let r=p(2);return R(r.draftValue.set(n.target.value))}),ht(1,zZt,2,2,"nile-option",63,Ho),ee()}if(i&2){let t=p(2);ot("value",t.draftValue()),L(),xt(t.draftValueOptions())}}function xZt(i,e){if(i&1){let t=Le();$(0,"nile-input",74),Ze("nile-change",function(n){P(t);let r=p(2);return R(r.draftValue.set(n.target.value))}),ee()}if(i&2){let t=p(2);ot("value",t.draftValue())}}function pZt(i,e){if(i&1){let t=Le();$(0,"div",68)(1,"span",75),Y(2,"Join with"),ee(),$(3,"div",76)(4,"button",77),Ze("click",function(){P(t);let n=p(2);return R(n.draftJoin.set("and"))}),Y(5,"AND"),ee(),$(6,"button",77),Ze("click",function(){P(t);let n=p(2);return R(n.draftJoin.set("or"))}),Y(7,"OR"),ee()()()}if(i&2){let t=p(2);L(4),Wt("is-active",t.draftJoin()==="and"),L(2),Wt("is-active",t.draftJoin()==="or")}}function LZt(i,e){if(i&1){let t=Le();$(0,"div",7)(1,"div",58)(2,"span",59),Y(3,"Add condition"),ee(),$(4,"span",60),Y(5,"Manual filters"),ee()(),$(6,"div",61)(7,"nile-select",62),Ze("nile-change",function(n){P(t);let r=p();return R(r.onDraftFieldChange(n.target.value))}),ht(8,yZt,2,2,"nile-option",63,XYt),ee(),$(10,"nile-select",64),Ze("nile-change",function(n){P(t);let r=p();return R(r.onDraftOpChange(n.target.value))}),ht(11,TZt,2,2,"nile-option",63,qYt),ee(),he(13,AZt,2,0,"span",65)(14,hZt,3,1,"nile-select",66)(15,xZt,1,1,"nile-input",67),ee(),he(16,pZt,8,4,"div",68),$(17,"div",69)(18,"nile-button",70),Ze("click",function(){P(t);let n=p();return R(n.condPopOpen.set(!1))}),Y(19,"Cancel"),ee(),$(20,"nile-button",71),Ze("click",function(){P(t);let n=p();return R(n.applyDraft())}),Y(21,"Apply filter"),ee()()()}if(i&2){let t=p();L(7),ot("value",t.draftField()),L(),xt(t.fields()),L(2),ot("value",t.draftOp()),L(),xt(t.operators),L(2),xe(t.draftValuesLoading()?13:t.draftValueOptions().length?14:15),L(3),xe(t.conditions().length?16:-1),L(4),It("disabled",t.canApplyDraft()?null:"")}}var OZt=new Set(["NILE-SELECT","NILE-OPTION","NILE-INPUT"]);function mZt(i){let t=(i instanceof Error?i.message:String(i)).split(`
|
|
40498
40498
|
`).map(r=>r.trim()).filter(Boolean),M=[...t].reverse().find(r=>/^(Expecting|Unrecognized|Unexpected)/i.test(r));return M?M.replace(/\s+/g," "):t.find(r=>/lexical error/i.test(r))??t[0]??"Invalid expression"}var EZt=new Set(["==","!=","<","<=",">",">=","~="]),Q3=class i{mode=at("prompt");conditions=at([]);catalog=at([]);expression=at("");busy=at(!1);disabled=at(!1);inert=At(()=>this.busy()||this.disabled());valueFetcher=at(null);showFilterControls=at(!0);showTimeFilter=at(!1);timeFilterResetKey=at(null);modeChange=Xi();conditionsChange=Xi();expressionRun=Xi();promptAsk=Xi();clearAll=Xi();timeRangeApply=Xi();modeMenuOpen=ke(!1);condPopOpen=ke(!1);exprDraft=ke("");promptDraft=ke("");draftField=ke("");draftOp=ke("==");draftValue=ke("");draftJoin=ke("and");modes=[{mode:"prompt",icon:"ng-brain",label:"Prompt",desc:"Ask in plain words and let it build the filter."},{mode:"expression",icon:"ng-square-function",label:"Filtrex expression",desc:'Type a validated expression, e.g. status != "Success".'},{mode:"manual",icon:"ng-filter-lines",label:"Manual filters",desc:"Pick a field, operator and value \u2014 combined with AND / OR."}];operators=vm.map(e=>({op:e,label:e0[e]}));activeMode=At(()=>this.modes.find(e=>e.mode===this.mode())??this.modes[0]);panelMode=At(()=>this.showFilterControls()?this.mode():"none");fields=At(()=>this.catalog().filter(e=>e.type==="attribute").map(e=>({id:e.id??e.name??e.label,label:e.label})));draftAttr=At(()=>this.catalog().find(e=>(e.id??e.name??e.label)===this.draftField()));draftValues=ke([]);draftValuesLoading=ke(!1);draftValueSeq=0;draftValueOptions=At(()=>{let e=this.draftValues();return e.length?[...e]:[...this.draftAttr()?.sampleValues??[]]});requestDraftValues(e){this.draftValues.set([]);let t=this.valueFetcher();if(!t||!e){this.draftValuesLoading.set(!1);return}this.draftValuesLoading.set(!0);let M=++this.draftValueSeq;t(e,"").then(n=>{M===this.draftValueSeq&&(this.draftValues.set(n.map(r=>String(r.label??r.value))),this.draftValuesLoading.set(!1))}).catch(()=>{M===this.draftValueSeq&&(this.draftValues.set([]),this.draftValuesLoading.set(!1))})}canApplyDraft=At(()=>!!this.draftField()&&this.draftValue().trim().length>0);chipCount=At(()=>this.conditions().length);canClear=At(()=>this.mode()==="manual"?this.chipCount()>0:this.mode()==="expression"?this.exprDraft().trim().length>0||this.expression().trim().length>0:this.promptDraft().trim().length>0);fieldLabel(e){return this.catalog().find(M=>(M.id??M.name??M.label)===e)?.label??e}opLabel(e){return e0[e]??e}valueLabel(e){return FB(e)}clauseError(e){let t=null;try{t=x3(e)}catch{return null}let M=t?.type==="Compound"?t.body??[]:[t];for(let n=0;n<M.length;n++){let r=M[n];if(n%2===1){if(!(r?.type==="Identifier"&&/^(and|or)$/i.test(r.name??"")))return'Expected "and" or "or" between conditions';continue}if(!i.isPredicate(r)){let o=i.nameOf(r);return o?`"${o}" is not a condition yet \u2014 add an operator and a value, e.g. ${o} == "\u2026"`:"Incomplete condition \u2014 expected field, operator and value"}}return M.length%2===0?"Expression ends with a connector \u2014 add another condition":null}static nameOf(e){let t=e;if(t?.type==="Identifier")return t.name??null;if(t?.type==="MemberExpression"){let M=i.nameOf(t.object),n=i.nameOf(t.property);return M&&n?`${M}.${n}`:null}return null}static isPredicate(e){let t=e;return t?.type?t.type==="BinaryExpression"?EZt.has(t.operator??""):t.type==="UnaryExpression"?(t.operator??"").toLowerCase()==="not"&&i.isPredicate(t.argument):t.type==="CallExpression":!1}exprState=At(()=>{let e=this.exprDraft().trim();if(!e)return{ok:!1,empty:!0,error:null,partial:!1};if(/\b(and|or)\s*$/i.test(e))return{ok:!1,empty:!1,error:"Expression ends with a connector \u2014 add another condition",partial:!1};try{QG(e)}catch(M){return{ok:!1,empty:!1,error:mZt(M),partial:!1}}let t=this.clauseError(e);return t?{ok:!1,empty:!1,error:t,partial:!1}:Wm(e)?{ok:!0,empty:!1,error:null,partial:!1}:{ok:!0,empty:!1,error:null,partial:!0}});skeletonRows=[72,54,63,45];suggestDismissed=ke(!1);suggestContext=At(()=>{let e=this.exprDraft(),t=/\s+(?:and|or)\s+/gi,M=0;for(let c=t.exec(e);c;c=t.exec(e))M=c.index+c[0].length;let n=e.slice(M),r=/^(\s*)([A-Za-z_][\w.]*)?(\s*)(==|!=|<=|>=|~=|<|>)?(\s*)(.*)$/.exec(n),o=r?.[1]??"",a=r?.[2]??"",s=r?.[3]??"",l=r?.[4]??"",N=r?.[6]??"";if(l){let c=/^("[^"]*"|'[^']*'|-?\d+(?:\.\d+)?)(\s*)$/.exec(N);return c?c[2].length>0?{kind:"joiner",from:e.length,partial:"",field:a}:{kind:"none",from:e.length,partial:"",field:a}:{kind:"value",from:e.length-N.length,partial:N,field:a}}return a&&s?{kind:"op",from:e.length,partial:"",field:a}:{kind:"field",from:M+o.length,partial:a,field:""}});suggestingValue=At(()=>!this.suggestDismissed()&&this.suggestContext().kind==="value");suggestLoading=At(()=>this.suggestingValue()&&this.exprValuesLoading()&&!this.fetchedValues().length);suggestions=At(()=>{if(this.suggestDismissed())return[];let e=this.suggestContext(),t=e.partial.replace(/^["']/,"").toLowerCase();if(e.kind==="field")return this.catalog().filter(o=>o.type==="attribute").map(o=>({id:o.id??o.name??o.label,label:o.label})).filter(o=>!t||o.id.toLowerCase().includes(t)||o.label.toLowerCase().includes(t)).slice(0,8).map(o=>({label:o.id,hint:o.label,insert:o.id}));if(e.kind==="op")return this.operators.slice(0,8).map(o=>({label:o.op,hint:o.label,insert:o.op}));if(e.kind==="none")return[];if(e.kind==="joiner")return[{label:"and",hint:"CONNECTOR",insert:"and"},{label:"or",hint:"CONNECTOR",insert:"or"}];let M=this.catalog().find(o=>(o.id??o.name??o.label)===e.field),n=this.fetchedValues();return(n.length?n:[...M?.sampleValues??[]]).filter(o=>!t||String(o).toLowerCase().includes(t)).slice(0,8).map(o=>({label:String(o),hint:"value",insert:`"${String(o)}"`}))});fetchedFor=ke("");fetchedValues=ke([]);exprValuesLoading=ke(!1);fetchSeq=0;valueLookup=eo(()=>{let e=this.suggestContext();e.kind==="value"&&e.field&&this.requestValues()});requestValues(){let e=this.suggestContext();if(e.kind!=="value"||!e.field)return;let t=e.field+"\0"+e.partial.replace(/^["']/,"");if(this.fetchedFor()===t)return;let M=this.valueFetcher();if(!M)return;this.fetchedFor.set(t),this.exprValuesLoading.set(!0);let n=++this.fetchSeq;M(e.field,e.partial.replace(/^["']/,"")).then(r=>{n===this.fetchSeq&&(this.fetchedValues.set(r.map(o=>String(o.label??o.value))),this.exprValuesLoading.set(!1))}).catch(()=>{n===this.fetchSeq&&(this.fetchedValues.set([]),this.exprValuesLoading.set(!1))})}dismissSuggestions(){this.suggestDismissed.set(!0)}applySuggestion(e){let t=this.suggestContext(),n=this.exprDraft().slice(0,Math.max(0,t.from)),r=t.kind==="op"||n&&!/[\s(]$/.test(n)?" ":"";this.exprDraft.set(n+r+e+" ")}host=Fe(ir);onDocumentClick(e){let t=e.composedPath?.()??[];if(t.some(r=>r instanceof HTMLElement&&OZt.has(r.tagName)))return;let M=this.host.nativeElement,n=t.indexOf(M);if(n!==-1){let r=t.slice(0,n),o=N=>r.some(c=>c instanceof HTMLElement&&c.matches?.(N)),a=o(".rail__mode"),s=o(".pop--cond, .add-filter"),l=o(".inline-wrap");a||this.modeMenuOpen.set(!1),s||this.condPopOpen.set(!1),l||this.suggestDismissed.set(!0);return}this.modeMenuOpen.set(!1),this.condPopOpen.set(!1),this.suggestDismissed.set(!0)}onEscape(){this.modeMenuOpen.set(!1),this.condPopOpen.set(!1),this.suggestDismissed.set(!0)}pickMode(e){this.modeMenuOpen.set(!1),e!==this.mode()&&(this.resetDrafts(),this.modeChange.emit(e))}resetDrafts(){this.exprDraft.set(""),this.promptDraft.set(""),this.condPopOpen.set(!1),this.suggestDismissed.set(!0),this.draftField.set(""),this.draftOp.set("=="),this.draftValue.set(""),this.draftJoin.set("and")}openCondPop(){let e=this.fields()[0]?.id??"";this.draftField.set(e),this.draftOp.set("=="),this.draftValue.set(""),this.draftJoin.set("and"),this.condPopOpen.set(!0),this.requestDraftValues(e)}onDraftOpChange(e){let t=this.operators.find(M=>M.op===e);t&&this.draftOp.set(t.op)}onDraftFieldChange(e){this.draftField.set(e),this.requestDraftValues(e),this.draftValue.set("")}applyDraft(){if(!this.canApplyDraft())return;let e=x({field:this.draftField(),op:this.draftOp(),value:this.draftValue().trim()},this.conditions().length&&this.draftJoin()==="or"?{connector:"or"}:{});this.conditionsChange.emit([...this.conditions(),e]),this.condPopOpen.set(!1)}removeChip(e){let t=this.conditions().filter((M,n)=>n!==e);t.length&&(t[0]=U(x({},t[0]),{connector:void 0})),this.conditionsChange.emit(t)}toggleJoin(e){let t=[...this.conditions()],M=t[e];M&&(t[e]=U(x({},M),{connector:M.connector==="or"?"and":"or"}),this.conditionsChange.emit(t))}runExpression(){let e=this.exprDraft().trim();e&&!this.exprState().ok||(this.suggestDismissed.set(!0),this.expressionRun.emit(e))}askPrompt(){this.promptAsk.emit(this.promptDraft().trim())}onExprKeydown(e){if(e.key==="Escape"){this.dismissSuggestions();return}this.suggestDismissed.set(!1),e.key==="Enter"&&(e.preventDefault(),this.runExpression())}onPromptKeydown(e){e.key==="Enter"&&(e.preventDefault(),this.askPrompt())}onClearAll(){this.resetDrafts(),this.clearAll.emit()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["shared-filter-rail"]],hostBindings:function(t,M){t&1&&Ze("click",function(r){return M.onDocumentClick(r)},O5)("keydown.escape",function(){return M.onEscape()},O5)},inputs:{mode:[1,"mode"],conditions:[1,"conditions"],catalog:[1,"catalog"],expression:[1,"expression"],busy:[1,"busy"],disabled:[1,"disabled"],valueFetcher:[1,"valueFetcher"],showFilterControls:[1,"showFilterControls"],showTimeFilter:[1,"showTimeFilter"],timeFilterResetKey:[1,"timeFilterResetKey"]},outputs:{modeChange:"modeChange",conditionsChange:"conditionsChange",expressionRun:"expressionRun",promptAsk:"promptAsk",clearAll:"clearAll",timeRangeApply:"timeRangeApply"},decls:10,vars:8,consts:[["modeDropdown",""],[1,"rail"],[1,"rail__mode"],[1,"rail__panel"],[1,"rail__chips"],[1,"rail__right"],[1,"rail__time",3,"rail__time--divided"],["role","dialog","aria-label","Add condition",1,"pop","pop--cond"],["placement","bottom-start","distance","6",1,"mode-dropdown"],["slot","trigger","type","button","aria-haspopup","menu",1,"mode-btn",3,"disabled"],["method","stroke","size","16",1,"mode-btn__ico",3,"name"],[1,"mode-btn__label"],["aria-hidden","true",1,"mode-btn__caret"],["role","menu",1,"mode-menu"],[1,"mode-menu__heading"],["type","button","role","menuitemradio",1,"mode-item",3,"is-active"],["type","button","role","menuitemradio",1,"mode-item",3,"click"],["method","stroke","size","16",1,"mode-item__ico",3,"name"],[1,"mode-item__text"],[1,"mode-item__label"],[1,"mode-item__desc"],["aria-hidden","true",1,"mode-item__check"],[1,"add-filter"],["variant","ghost",1,"add-filter__btn",3,"click"],["type","button",1,"join-badge",3,"disabled"],[1,"chip"],[1,"chip__f"],[1,"chip__op"],[1,"chip__val"],["type","button",1,"chip__x",3,"click","disabled"],["type","button",1,"join-badge",3,"click","disabled"],[1,"inline-wrap","inline-wrap--suggest"],["aria-hidden","true",1,"inline-wrap__badge","inline-wrap__badge--fx"],["name","ng-square-function","method","stroke","size","15"],["type","text","spellcheck","false","aria-label","Filtrex expression","placeholder",'status != "Success" and department == "Engineering"',"autocomplete","off","role","combobox","aria-autocomplete","list",1,"inline-wrap__input",3,"ngModelChange","focus","keydown","disabled","ngModel"],["aria-hidden","true",1,"inline-wrap__state",3,"is-error","is-warn"],["role","listbox",1,"suggest"],["role","status",1,"inline-status"],[1,"is-error"],[1,"is-warn"],[1,"is-ok"],["variant","primary",1,"run-btn",3,"click"],["aria-hidden","true",1,"inline-wrap__state"],["aria-hidden","true",1,"suggest__skeleton",3,"width"],["role","status",1,"suggest__loading"],["aria-hidden","true",1,"suggest__skeleton"],["type","button","role","option",1,"suggest__item"],["type","button","role","option",1,"suggest__item",3,"click"],[1,"suggest__label"],[1,"suggest__hint"],[1,"inline-wrap"],["aria-hidden","true",1,"inline-wrap__badge","inline-wrap__badge--ai"],["name","ng-brain","method","stroke","size","15"],["type","text","aria-label","Ask your data","placeholder","Ask your data \u2014 e.g. failed provisioning for Engineering last week",1,"inline-wrap__input",3,"ngModelChange","keydown","disabled","ngModel"],[1,"match-label"],["variant","secondary",1,"clear-all",3,"click"],[1,"rail__time"],[3,"apply","resetKey"],[1,"pop__head"],[1,"pop__title"],[1,"pop__sub"],[1,"builder"],["aria-label","Field","portal","","noWidthSync","","searchEnabled","","placeholder","Field",1,"builder__select",3,"nile-change","value"],[3,"value"],["aria-label","Operator","portal","","placeholder","Operator",1,"builder__select",3,"nile-change","value"],["role","status","aria-label","Loading values",1,"builder__skeleton"],["aria-label","Value","portal","","noWidthSync","","searchEnabled","","placeholder","Value",1,"builder__select",3,"value"],["aria-label","Value","placeholder","Value",1,"builder__input",3,"value"],[1,"join-row"],[1,"pop__footer"],["variant","secondary",1,"btn-ghost",3,"click"],["variant","primary",1,"btn-primary",3,"click"],[1,"builder__skeleton-bar"],["aria-label","Value","portal","","noWidthSync","","searchEnabled","","placeholder","Value",1,"builder__select",3,"nile-change","value"],["aria-label","Value","placeholder","Value",1,"builder__input",3,"nile-change","value"],[1,"join-row__label"],[1,"join-toggle"],["type","button",3,"click"]],template:function(t,M){if(t&1&&($(0,"div",1),he(1,eZt,14,3,"div",2),$(2,"div",3),he(3,MZt,6,1,"div",4)(4,cZt,12,9)(5,DZt,6,3),ee(),$(6,"div",5),he(7,dZt,3,2),he(8,jZt,2,3,"span",6),ee(),he(9,LZt,22,5,"div",7),ee()),t&2){let n;Wt("rail--inert",M.disabled()),It("aria-disabled",M.disabled()?"true":null),L(),xe(M.showFilterControls()?1:-1),L(2),xe((n=M.panelMode())==="manual"?3:n==="expression"?4:n==="prompt"?5:-1),L(4),xe(M.showFilterControls()?7:-1),L(),xe(M.showTimeFilter()?8:-1),L(),xe(M.condPopOpen()?9:-1)}},dependencies:[Go,wj,Gh,a3,Om,Bm],styles:['@charset "UTF-8";.rail[_ngcontent-%COMP%]{position:relative;z-index:var(--z-sticky);display:flex;align-items:center;gap:10px;margin:0;padding:12px 20px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));border-bottom:1px solid var(--ng-colors-border-secondary, #e9edf3);border-radius:0;font-size:13px}.rail__mode[_ngcontent-%COMP%]{position:relative;flex:none;height:34px;padding-right:10px;border-right:1px solid var(--ng-colors-border-secondary, #e9edf3)}.mode-btn[_ngcontent-%COMP%]{display:flex;align-items:center;gap:7px;height:34px;padding:0 11px;border:1px solid var(--ng-colors-border-secondary);border-radius:7px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));font:inherit;font-size:13px;font-weight:600;color:var(--ng-colors-text-secondary-700);white-space:nowrap;cursor:pointer}.mode-btn[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--ng-colors-border-primary);background:var(--ng-colors-bg-secondary)}.mode-btn[_ngcontent-%COMP%]:disabled{cursor:not-allowed;opacity:.6}.mode-btn__ico[_ngcontent-%COMP%]{flex:none;display:inline-flex;color:var(--ng-colors-fg-brand-primary-600, #1d4ed8)}.mode-btn__caret[_ngcontent-%COMP%]{font-size:9px;color:var(--ng-colors-fg-quaternary-400)}.mode-dropdown[_ngcontent-%COMP%]::part(panel){background:transparent;box-shadow:none;border-radius:0}.mode-menu[_ngcontent-%COMP%]{width:286px;display:flex;flex-direction:column;gap:2px;padding:6px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));border:1px solid var(--ng-colors-border-secondary);border-radius:11px;box-shadow:0 18px 40px -12px #0f172a47}.mode-menu__heading[_ngcontent-%COMP%]{padding:6px 8px 4px;font-size:10.5px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--ng-colors-fg-quaternary-400)}.mode-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:9px;width:100%;padding:8px 9px;border:0;border-radius:8px;background:transparent;font:inherit;text-align:left;cursor:pointer}.mode-item[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-tertiary)}.mode-item.is-active[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary)}.mode-item__ico[_ngcontent-%COMP%]{flex:none;width:20px;margin-top:1px;display:inline-flex;justify-content:center;color:var(--ng-colors-text-secondary-700)}.mode-item__text[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1px;min-width:0}.mode-item__label[_ngcontent-%COMP%]{font-size:13px;font-weight:650;color:var(--ng-colors-text-secondary-700)}.mode-item__desc[_ngcontent-%COMP%]{font-size:11.5px;line-height:1.35;color:var(--ng-colors-fg-quaternary-400)}.mode-item__check[_ngcontent-%COMP%]{flex:none;margin-left:auto;padding-left:8px;font-size:11px;color:var(--ng-colors-fg-brand-primary-600, #1d4ed8)}.mode-item.is-active[_ngcontent-%COMP%] .mode-item__ico[_ngcontent-%COMP%], .mode-item.is-active[_ngcontent-%COMP%] .mode-item__label[_ngcontent-%COMP%]{color:var(--ng-colors-fg-brand-primary-600, #1d4ed8)}.rail__panel[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;align-items:center;gap:6px;flex-wrap:nowrap}.rail__chips[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;align-items:center;gap:6px;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:var(--ng-colors-border-primary) transparent;overscroll-behavior-x:contain}.rail__chips[_ngcontent-%COMP%]::-webkit-scrollbar{height:6px}.rail__chips[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.rail__chips[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--ng-colors-border-primary);border-radius:3px}.rail__chips[_ngcontent-%COMP%] > .chip[_ngcontent-%COMP%], .rail__chips[_ngcontent-%COMP%] > .join-badge[_ngcontent-%COMP%], .rail__chips[_ngcontent-%COMP%] > .add-filter[_ngcontent-%COMP%]{flex:0 0 auto}.chip[_ngcontent-%COMP%]{display:flex;align-items:stretch;height:34px;max-width:340px;border:1px solid var(--ng-colors-border-secondary);border-radius:7px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));overflow:hidden}.chip__f[_ngcontent-%COMP%]{display:flex;align-items:center;padding:0 8px;background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-quaternary-500);white-space:nowrap}.chip__op[_ngcontent-%COMP%]{display:flex;align-items:center;padding:0 6px;font-size:12px;color:var(--ng-colors-fg-quaternary-400);white-space:nowrap}.chip__val[_ngcontent-%COMP%]{display:flex;align-items:center;padding:0 6px 0 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;color:var(--ng-colors-text-primary-900)}.chip__x[_ngcontent-%COMP%]{flex:none;width:24px;border:0;border-left:1px solid var(--ng-colors-border-tertiary);background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));font-size:12px;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.chip__x[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--ng-colors-bg-error-primary);color:var(--ng-colors-fg-error-primary, var(--ng-colors-text-error-primary-600))}.chip__x[_ngcontent-%COMP%]:disabled{cursor:not-allowed}.join-badge[_ngcontent-%COMP%]{padding:2px 6px;border:1px solid var(--ng-colors-border-secondary);border-radius:5px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));font:inherit;font-size:10.5px;font-weight:800;letter-spacing:.06em;color:var(--ng-colors-text-quaternary-500);cursor:pointer}.join-badge[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--ng-colors-bg-brand-secondary);color:var(--ng-colors-fg-brand-primary-600, #1d4ed8)}.join-badge[_ngcontent-%COMP%]:disabled{cursor:not-allowed}.add-filter[_ngcontent-%COMP%]{display:inline-flex;flex:none;height:34px;border:1px dashed var(--ng-colors-border-primary);border-radius:7px;overflow:hidden}.add-filter__btn[_ngcontent-%COMP%]{--nile-height-40px: 34px;--nile-spacing-10px: 0;--nile-spacing-14px: 10px;--nile-radius-base-standard: 0;--nile-colors-dark-900: var(--ng-colors-fg-brand-primary-600, #1d4ed8)}.inline-wrap[_ngcontent-%COMP%]{flex:1 1 auto;min-width:300px;display:flex;align-items:stretch;height:34px;border:1px solid var(--ng-colors-border-secondary);border-radius:7px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));overflow:hidden}.inline-wrap.is-error[_ngcontent-%COMP%]{border-color:var(--ng-colors-border-error-subtle)}.inline-wrap__badge[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;flex:none;width:30px;padding:0;border-radius:6px 0 0 6px}.inline-wrap__badge[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{flex:none;line-height:0}.inline-wrap__badge--fx[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary);color:var(--ng-colors-fg-brand-primary-600, #1d4ed8)}.inline-wrap__badge--ai[_ngcontent-%COMP%]{background:var(--ng-componentcolors-utility-purple-50);color:var(--ng-componentcolors-utility-purple-600)}.inline-wrap__input[_ngcontent-%COMP%]{flex:1;min-width:0;border:0;padding:0 10px;background:transparent;font:inherit;font-size:13px;color:var(--ng-colors-text-primary-900)}.inline-wrap__input[_ngcontent-%COMP%]:focus{outline:none}.inline-wrap__input[_ngcontent-%COMP%]::placeholder{color:var(--ng-colors-fg-quaternary-400)}.inline-wrap__state[_ngcontent-%COMP%]{display:grid;place-items:center;width:26px;font-size:11px;font-weight:800;color:var(--ng-componentcolors-utility-success-700)}.inline-wrap__state.is-warn[_ngcontent-%COMP%]{color:var(--ng-componentcolors-utility-warning-700)}.inline-wrap__state.is-error[_ngcontent-%COMP%]{color:var(--ng-colors-text-error-primary-hover)}.inline-status[_ngcontent-%COMP%]{flex:0 1 auto;min-width:0;font-size:11.5px;line-height:1.3}.inline-status[_ngcontent-%COMP%] .is-ok[_ngcontent-%COMP%]{color:var(--ng-componentcolors-utility-success-700)}.inline-status[_ngcontent-%COMP%] .is-warn[_ngcontent-%COMP%]{color:var(--ng-componentcolors-utility-warning-700)}.inline-status[_ngcontent-%COMP%] .is-error[_ngcontent-%COMP%]{color:var(--ng-colors-text-error-primary-hover)}.inline-status[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{padding:0 3px;border-radius:3px;background:var(--ng-colors-bg-tertiary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.run-btn[_ngcontent-%COMP%]{flex:none;--nile-height-40px: 34px;--nile-spacing-10px: 0;--nile-spacing-14px: 16px}.rail__right[_ngcontent-%COMP%]{flex:none;display:flex;align-items:center;gap:12px;height:34px}.match-label[_ngcontent-%COMP%]{font-size:12px;color:var(--ng-colors-fg-quaternary-400);font-variant-numeric:tabular-nums;white-space:nowrap}.clear-all[_ngcontent-%COMP%]{--nile-height-40px: 34px;--nile-spacing-10px: 0;--nile-spacing-14px: 10px}.rail__time[_ngcontent-%COMP%]{flex:none;display:flex;align-items:center;height:34px}.rail__time--divided[_ngcontent-%COMP%]{padding-left:10px;border-left:1px solid var(--ng-colors-border-secondary, #e9edf3)}.pop[_ngcontent-%COMP%]{position:absolute;top:calc(100% - 2px);left:20px;z-index:50;width:560px;max-height:calc(100vh - 190px);display:flex;flex-direction:column;gap:12px;padding:14px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));border:1px solid var(--ng-colors-border-secondary);border-radius:12px;box-shadow:0 20px 44px -14px #0f172a4d;overflow-y:auto}.pop__head[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px}.pop__title[_ngcontent-%COMP%]{font-size:13px;font-weight:700;color:var(--ng-colors-text-primary-900)}.pop__sub[_ngcontent-%COMP%]{font-size:11.5px;color:var(--ng-colors-fg-quaternary-400)}.builder[_ngcontent-%COMP%]{display:grid;grid-template-columns:1.25fr .7fr 1.15fr;gap:8px;align-items:start}.builder__select[_ngcontent-%COMP%], .builder__input[_ngcontent-%COMP%]{display:block;min-width:0;width:100%}.join-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.join-row__label[_ngcontent-%COMP%]{font-size:12px;color:var(--ng-colors-fg-quaternary-400)}.join-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:2px;padding:2px;background:var(--ng-colors-bg-tertiary);border-radius:7px}.join-toggle[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:3px 9px;border:0;border-radius:5px;background:transparent;font:inherit;font-size:12px;font-weight:700;color:var(--ng-colors-text-quaternary-500);cursor:pointer}.join-toggle[_ngcontent-%COMP%] button.is-active[_ngcontent-%COMP%]{background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));color:var(--ng-colors-fg-brand-primary-600, #1d4ed8);box-shadow:0 1px 2px #0f172a1f}.pop__footer[_ngcontent-%COMP%]{position:sticky;bottom:-14px;display:flex;justify-content:flex-end;gap:8px;margin:0 -14px -14px;padding:10px 14px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));border-top:1px solid var(--ng-colors-border-tertiary)}.btn-ghost[_ngcontent-%COMP%]{--nile-height-40px: 31px;--nile-spacing-10px: 0;--nile-spacing-14px: 11px}.btn-primary[_ngcontent-%COMP%]{--nile-height-40px: 31px;--nile-spacing-10px: 0;--nile-spacing-14px: 13px}.inline-wrap--suggest[_ngcontent-%COMP%]{position:relative;overflow:visible}.suggest[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 4px);left:0;z-index:70;min-width:260px;max-height:240px;display:flex;flex-direction:column;padding:4px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));border:1px solid var(--ng-colors-border-secondary);border-radius:9px;box-shadow:0 16px 36px -12px #0f172a47;overflow-y:auto}.suggest__item[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:8px;padding:6px 8px;border:0;border-radius:6px;background:transparent;font:inherit;text-align:left;cursor:pointer}.suggest__item[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-tertiary)}.suggest__label[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--ng-colors-text-primary-900)}.suggest__hint[_ngcontent-%COMP%]{margin-left:auto;font-size:11px;color:var(--ng-colors-fg-quaternary-400);white-space:nowrap}.builder__skeleton[_ngcontent-%COMP%]{display:block;width:100%;height:36px;padding:10px;border:1px solid var(--ng-colors-border-secondary);border-radius:8px;background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));box-sizing:border-box}.builder__skeleton-bar[_ngcontent-%COMP%]{display:block;height:14px;border-radius:4px;background:linear-gradient(90deg,var(--ng-colors-bg-tertiary) 25%,var(--ng-colors-bg-quaternary) 37%,var(--ng-colors-bg-tertiary) 63%);background-size:400% 100%;animation:_ngcontent-%COMP%_builder-skeleton 1.3s ease-in-out infinite}@keyframes _ngcontent-%COMP%_builder-skeleton{0%{background-position:100% 50%}to{background-position:0 50%}}@media(prefers-reduced-motion:reduce){.builder__skeleton-bar[_ngcontent-%COMP%]{animation:none}}.suggest__skeleton[_ngcontent-%COMP%]{display:block;height:12px;margin:7px 8px;border-radius:4px;background:linear-gradient(90deg,var(--ng-colors-bg-tertiary) 25%,var(--ng-colors-bg-quaternary) 37%,var(--ng-colors-bg-tertiary) 63%);background-size:400% 100%;animation:_ngcontent-%COMP%_builder-skeleton 1.3s ease-in-out infinite}.suggest__loading[_ngcontent-%COMP%]{display:block;padding:2px 8px 6px;font-size:11px;color:var(--ng-colors-fg-quaternary-400)}@media(prefers-reduced-motion:reduce){.suggest__skeleton[_ngcontent-%COMP%]{animation:none}}.suggest__hint.is-badge[_ngcontent-%COMP%]{padding:2px 6px;border-radius:999px;background:var(--ng-colors-bg-tertiary);font-size:9.5px;font-weight:700;letter-spacing:.06em;color:var(--ng-colors-text-quaternary-500);text-transform:uppercase}.rail--inert[_ngcontent-%COMP%]{opacity:.55;pointer-events:none;-webkit-user-select:none;user-select:none}'],changeDetection:0})};var U3=new $t("FILTER_VALUES_FETCHER");function fZt(i){return{provide:U3,useFactory:e=>e.fetchFilterValues.bind(e),deps:[i]}}var Fm=new $t("DSL_EDITOR_FETCHER");function Sst(i){return{provide:Fm,useFactory:e=>({generate:e.generateWidgetDsl.bind(e),apply:e.applyWidgetDsl.bind(e)}),deps:[i]}}var Hm=new $t("CHART_TYPE_FETCHER");function wst(i){return{provide:Hm,useFactory:e=>({list:e.listChartTypes.bind(e),change:e.changeWidgetChartType.bind(e),changeAdhoc:e.changeAdhocChartType?e.changeAdhocChartType.bind(e):void 0}),deps:[i]}}var Jm=new $t("WIDGET_FILTER_FETCHER");function Cst(i){return{provide:Jm,useFactory:e=>({add:e.addWidgetFilter.bind(e),remove:e.removeWidgetFilter.bind(e)}),deps:[i]}}var Gm=new $t("FILTER_DEFAULT_FETCHER");function kst(i){return{provide:Gm,useFactory:e=>({set:e.setFilterDefault.bind(e)}),deps:[i]}}var SZt=new Set(["today","yesterday","last-7-days","last-30-days","this-month","last-month"]),bst=[{value:"today",label:"Today"},{value:"yesterday",label:"Yesterday"},{value:"last-7-days",label:"Last 7 days"},{value:"last-30-days",label:"Last 30 days"},{value:"this-month",label:"This month"},{value:"last-month",label:"Last month"}];function Jc(i){return i==="date"?[{value:"today",label:"Today",valueKind:"none"},{value:"yesterday",label:"Yesterday",valueKind:"none"},{value:"last-7-days",label:"Last 7 days",valueKind:"none"},{value:"last-30-days",label:"Last 30 days",valueKind:"none"},{value:"this-month",label:"This month",valueKind:"none"},{value:"last-month",label:"Last month",valueKind:"none"},{value:"is",label:"is on",valueKind:"date"},{value:"is-not",label:"is not on",valueKind:"date"},{value:"before",label:"is before",valueKind:"date"},{value:"after",label:"is after",valueKind:"date"},{value:"on-or-before",label:"is on or before",valueKind:"date"},{value:"on-or-after",label:"is on or after",valueKind:"date"},{value:"between",label:"is between",valueKind:"date",needsSecondValue:!0},{value:"is-empty",label:"is empty",valueKind:"none"},{value:"is-not-empty",label:"is not empty",valueKind:"none"}]:i==="number"?[{value:"is",label:"= (equals)",valueKind:"number"},{value:"is-not",label:"\u2260 (not equal to)",valueKind:"number"},{value:"gt",label:"> (greater than)",valueKind:"number"},{value:"lt",label:"< (less than)",valueKind:"number"},{value:"gte",label:"\u2265 (at least)",valueKind:"number"},{value:"lte",label:"\u2264 (at most)",valueKind:"number"},{value:"between",label:"is between",valueKind:"number",needsSecondValue:!0},{value:"is-empty",label:"is empty",valueKind:"none"},{value:"is-not-empty",label:"is not empty",valueKind:"none"}]:i==="boolean"?[{value:"is",label:"is",valueKind:"select"},{value:"is-not",label:"is not",valueKind:"select"},{value:"is-empty",label:"is empty",valueKind:"none"},{value:"is-not-empty",label:"is not empty",valueKind:"none"}]:[{value:"is",label:"is",valueKind:"select"},{value:"is-not",label:"is not",valueKind:"select"},{value:"contains",label:"contains",valueKind:"text"},{value:"not-contains",label:"does not contain",valueKind:"text"},{value:"starts-with",label:"starts with",valueKind:"text"},{value:"ends-with",label:"ends with",valueKind:"text"},{value:"is-any-of",label:"is any of",valueKind:"multi-select"},{value:"is-none-of",label:"is none of",valueKind:"multi-select"},{value:"is-empty",label:"is empty",valueKind:"none"},{value:"is-not-empty",label:"is not empty",valueKind:"none"}]}function v3(i){return i==="string"||i==="boolean"}function Qj(i){return String(i).padStart(2,"0")}function MF(i,e){let t=new Date(`${i}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()+e),`${t.getUTCFullYear()}-${Qj(t.getUTCMonth()+1)}-${Qj(t.getUTCDate())}`}function wZt(i,e){return new Date(Date.UTC(i,e+1,0)).getUTCDate()}function nF(i){let e=new Date,t=`${e.getUTCFullYear()}-${Qj(e.getUTCMonth()+1)}-${Qj(e.getUTCDate())}`;switch(i){case"yesterday":{let M=MF(t,-1);return{from:M,to:M}}case"last-7-days":return{from:MF(t,-6),to:t};case"last-30-days":return{from:MF(t,-29),to:t};case"this-month":return{from:`${e.getUTCFullYear()}-${Qj(e.getUTCMonth()+1)}-01`,to:t};case"last-month":{let M=e.getUTCMonth(),n=e.getUTCFullYear(),r=M===0?11:M-1,o=M===0?n-1:n;return{from:`${o}-${Qj(r+1)}-01`,to:`${o}-${Qj(r+1)}-${Qj(wZt(o,r))}`}}default:return{from:t,to:t}}}var CZt={is:"equals","is-not":"not_equals",contains:"contains","not-contains":"not_contains","starts-with":"starts_with","ends-with":"ends_with",gt:"gt",lt:"lt",gte:"gte",lte:"lte",before:"lt",after:"gt","on-or-before":"lte","on-or-after":"gte","is-empty":"not_exists","is-not-empty":"exists"};function $m(i){if(SZt.has(i.operator)){let{from:e,to:t}=nF(i.operator);return{field:i.fieldId,operation:"between",value:[e,t]}}return i.operator==="between"?{field:i.fieldId,operation:"between",value:[i.value??"",i.value2??""]}:i.operator==="is-any-of"?{field:i.fieldId,operation:"in",value:i.values??[]}:i.operator==="is-none-of"?{field:i.fieldId,operation:"not_in",value:i.values??[]}:{field:i.fieldId,operation:CZt[i.operator]??"equals",value:i.value??""}}function Y3(i,e,t){let M=Jc(t).find(r=>r.value===i.operator),n=M?.label??i.operator;return M?.valueKind==="none"?`${e} ${n}`:M?.valueKind==="multi-select"?`${e} ${n} ${(i.values??[]).join(", ")}`:i.operator==="between"?`${e} ${n} ${i.value} and ${i.value2??""}`:`${e} ${n} ${i.value}`}var Xm=new $t("ADHOC_FILTER_FETCHER");function Qst(i){return{provide:Xm,useFactory:e=>({listFields:e.listAdhocFilterFields.bind(e),fetchValues:e.fetchAdhocFilterValues.bind(e),apply:e.applyAdhocFilter.bind(e)}),deps:[i]}}var Ust={number:"ng-number",bar:"ng-chart-bar",column:"ng-chart-column",line:"ng-chart-line",area:"ng-chart-area",spline:"ng-chart-spline",stacked:"ng-chart-bar-stacked",cluster:"ng-chart-bar-big",pie:"ng-chart-pie",donut:"ng-donut",funnel:"ng-funnel",scatter:"ng-chart-scatter",bubble:"ng-bubbles",radar:"ng-radar",histogram:"ng-chart-column-increasing",areaNegative:"ng-trending-down",areaSpline:"ng-spline",columnPyramid:"ng-pyramid",gauge:"ng-gauge",waterfall:"ng-chart-candlestick",heatmap:"ng-grid-3x3",map:"ng-map",areaRange:"ng-waves",columnRange:"ng-sliders-vertical",dumbbell:"ng-dumbbell","line-column":"ng-chart-no-axes-combined",timeline:"ng-chart-gantt",table:"ng-table",grid:"ng-table"},kZt="ng-layout-dashboard";function Z3(i){return Object.prototype.hasOwnProperty.call(Ust,i)?Ust[i]:kZt}function Yst(i,e=!1){let t=[],M=e,n=()=>{let r=M;return M=!1,r||void 0};return i.canChangeChartType&&t.push({type:"custom",label:"Change chart type",id:"changeChartType",glyph:"ng-chart-bar",divider:n()}),i.canManageFilters&&t.push({type:"custom",label:"Apply filter",id:"manageFilters",glyph:"ng-filter-lines",divider:n()}),i.canCustomizeColors&&t.push({type:"custom",label:"Customize colors",id:"customizeColors",glyph:"ng-palette",divider:n()}),i.canSetAlert&&t.push({type:"custom",label:"Set Alert",id:"setAlert",glyph:"ng-bell-01",divider:n()}),(i.canForecast||i.hasForecast)&&t.push({type:"custom",label:i.hasForecast?"Remove forecast":"Forecast",id:"forecast",glyph:i.hasForecast?"ng-trending-down":"ng-trend-up-01",divider:n()}),i.isKpi||(t.push({type:"default",label:"Export PNG",downloadPng:!0,glyph:"ng-image-03",divider:t.length>0}),t.push({type:"default",label:"Export CSV",downloadCsv:!0,glyph:"ng-file-06"}),t.push({type:"default",label:"Print",print:!0,glyph:"ng-printer"})),t}function Zst(i,e,t){let M=i.filter(e).map(a=>U(x({},a),{divider:!1})),n=i.filter(t).map(a=>U(x({},a),{divider:!1})),r=i.filter(a=>!e(a)&&!t(a));if(!M.length&&!n.length)return i;let o=[...M,...r,...n];return M.length&&r.length&&(o[M.length]=U(x({},o[M.length]),{divider:!0})),r.length&&n.length&&(o[M.length+r.length]=U(x({},o[M.length+r.length]),{divider:!0})),o}var vst=6,_3={key:"inspect",label:"Inspect",glyph:"ng-scan-search",keys:["viewData","viewRecords","viewDetailPanel","editDsl"]};function _st(i){let e=l=>({key:l.key,label:l.label,glyph:l.glyph,method:l.method,color:l.color,item:l,children:[]}),t=new Set(_3.keys),M=i.filter(l=>t.has(l.key)),n=M.length>1,r=n?i.findIndex(l=>t.has(l.key)):-1,o=[[]];i.forEach((l,N)=>{if(n&&t.has(l.key)&&N!==r)return;let c=o[o.length-1];if(l.divider&&c.length&&(c=[],o.push(c)),N===r){c.push({key:`fold:${_3.key}`,label:_3.label,glyph:_3.glyph,method:"stroke",item:null,children:M});return}c.push(e(l))});for(let l of o.splice(vst))o[o.length-1].push(...l);let a=Array.from({length:vst},(l,N)=>({key:`seg${N}`,nodes:o[N]??[],first:!1})),s=a.find(l=>l.nodes.length);return s&&(s.first=!0),a}var Wst=["#3C67DE","#12B76A","#F79009","#F04438","#7A5AF8","#0BA5EC","#EE46BC","#EAAA08","#155EEF","#17B26A"];function rF(i){let e=i?.data;return Array.isArray(e)&&e.length>0&&e.every(t=>t&&typeof t=="object"&&Array.isArray(t.data))}function Pst(i){let e=i?.chart;return rF(e)?e.data.map((t,M)=>({index:M,name:typeof t.name=="string"&&t.name?t.name:`Series ${M+1}`,color:typeof t.color=="string"?t.color:Wst[M%Wst.length]})):null}function Rst(i){return rF(i?.chart)}function Vst(i,e,t){let M=i?.chart;return!rF(M)||!M.data[e]?i:U(x({},i),{chart:U(x({},M),{data:M.data.map((r,o)=>o===e?U(x({},r),{color:t}):r)})})}var bZt=new Set(["script","script_fields","scripted_metric","scripted_upsert","delete_by_query","update_by_query","reindex","update","delete","index","indices","_delete_by_query"]);function W3(i){if(i===null||typeof i!="object")return null;if(Array.isArray(i)){for(let e of i){let t=W3(e);if(t)return t}return null}for(let[e,t]of Object.entries(i)){if(bZt.has(e))return e;let M=W3(t);if(M)return M}return null}function QZt(i){let e=i.replace(/;\s*$/,"");return e.includes(";")?{ok:!1,error:"Only a single statement is allowed"}:/^(select|with)\b/i.test(e)?/\b(insert|update|delete|drop|alter|truncate|merge|create|exec|execute|grant|revoke|into)\b/i.test(e)?{ok:!1,error:"This statement isn't read-only \u2014 the DSL editor accepts SELECT/WITH queries only"}:/\b(sp_|xp_)\w*/i.test(e)?{ok:!1,error:"Stored/extended procedures aren't allowed"}:{ok:!0,error:null}:{ok:!1,error:"Only a read-only SELECT/WITH statement is allowed"}}function Uj(i,e="json"){let t=(i??"").trim();if(!t)return{ok:!1,error:"Query is empty"};if(e==="sql")return QZt(t);let M;try{M=JSON.parse(t)}catch(r){return{ok:!1,error:`Not valid JSON: ${r instanceof Error?r.message:String(r)}`}}if(M===null||typeof M!="object"||Array.isArray(M))return{ok:!1,error:"The DSL body must be a JSON object"};let n=W3(M);return n?{ok:!1,error:`"${n}" is not allowed \u2014 the DSL editor accepts read-only search/aggregation queries only`}:{ok:!0,error:null}}function qm(i,e="json"){if(e==="sql")return i;try{return JSON.stringify(JSON.parse(i),null,2)}catch{return null}}var Bst=800;function oF(i,e){let t=(i??"").split(`
|
|
40499
40499
|
`),M=(e??"").split(`
|
|
40500
|
-
`);if(t.length>Bst||M.length>Bst)return[...t.map(l=>({kind:"remove",text:l})),...M.map(l=>({kind:"add",text:l}))];let n=M.length+1,r=new Int32Array((t.length+1)*n);for(let l=t.length-1;l>=0;l--)for(let N=M.length-1;N>=0;N--)r[l*n+N]=t[l]===M[N]?r[(l+1)*n+(N+1)]+1:Math.max(r[(l+1)*n+N],r[l*n+(N+1)]);let o=[],a=0,s=0;for(;a<t.length&&s<M.length;)t[a]===M[s]?(o.push({kind:"context",text:t[a]}),a++,s++):r[(a+1)*n+s]>=r[a*n+(s+1)]?(o.push({kind:"remove",text:t[a]}),a++):(o.push({kind:"add",text:M[s]}),s++);for(;a<t.length;)o.push({kind:"remove",text:t[a++]});for(;s<M.length;)o.push({kind:"add",text:M[s++]});return o}function aF(i){return i.filter(e=>e.kind!=="context")}var EA=new $t("RECORDS_FETCHER");function Fst(i){return{provide:EA,useFactory:e=>({fetch:e.fetchWidgetRecords.bind(e)}),deps:[i]}}var vj=new $t("WIDGET_EVIDENCE_PROVIDERS");function UZt(i,e){return{provide:vj,multi:!0,useFactory:t=>({order:i,contribute:t.resolveEvidence.bind(t)}),deps:[e]}}var vZt=12,YZt=2,ZZt=4;function _Zt(i){let e=i?.h;return typeof e!="number"||!Number.isFinite(e)||e<=0?ZZt:Math.max(YZt,Math.ceil(e))}function sF(i){let e=0;return i.map(t=>{let M=_Zt(t.layout),n={x:0,y:e,w:vZt,h:M};return e+=M,U(x({},t),{layout:n})})}var fA={SOURCE:0,CURATED:20,CHART_DATA:40,RECORDS:60,PROVENANCE:80};async function lF(i,e,t,M){let n=[...i].sort((o,a)=>o.order-a.order),r=n.map(()=>[]);return await Promise.all(n.map(async(o,a)=>{try{r[a]=await o.contribute(e,t)}catch{r[a]=[]}M?.(r.flat())})),r.flat()}var R3=2,Hst=Object.freeze([]),WZt=Object.freeze([]),P3=class{rootLabel;providers;collect;nextId=1;levelStack=ke(Hst);levels=this.levelStack.asReadonly();depth=At(()=>this.levelStack().length);isOpen=At(()=>this.depth()>0);canOpen=At(()=>this.depth()<R3);current=At(()=>{let e=this.levelStack();return e.length>0?e[e.length-1]:null});loading=At(()=>this.current()?.pending??!1);failed=At(()=>this.current()?.failed??!1);content=At(()=>this.current()?.content??WZt);breadcrumb=At(()=>{let e=this.levelStack(),t=[this.rootLabel(),...e.map(n=>n.label)],M=t.filter((n,r)=>r===0||n!==t[r-1]);return M.map((n,r)=>({label:n,current:r===M.length-1}))});constructor(e){let{rootLabel:t}=e;this.rootLabel=typeof t=="function"?t:()=>t,this.providers=e.providers,this.collect=e.collect??lF}async open(e,t){if(!this.canOpen())return;let M=this.nextId++,n=this.depth();this.levelStack.update(r=>[...r,{id:M,widget:e,label:e.title??"",depth:n,content:[],pending:!0,failed:!1}]);try{let r=await this.collect(this.providers,e,U(x({},t),{depth:n}),o=>{o.length&&this.settle(M,{content:sF(o),pending:!1,failed:!1})});this.settle(M,{content:sF(r),pending:!1,failed:!1})}catch{this.settle(M,{content:[],pending:!1,failed:!0})}}back(){let e=this.levelStack();if(e.length!==0){if(e.length===1){this.close();return}this.levelStack.set(e.slice(0,-1))}}close(){this.levelStack().length!==0&&this.levelStack.set(Hst)}settle(e,t){this.levelStack.update(M=>{let n=M.findIndex(o=>o.id===e);if(n===-1)return M;let r=M.slice();return r[n]=x(x({},M[n]),t),r})}};var PZt=["crumbBar"],RZt=["footerSlot"],VZt=[[["","panel-footer",""]],"*"],BZt=["[panel-footer]","*"];function FZt(i,e){if(i&1){let t=Le();C(0,"nile-breadcrumb-item",8),Ae("keydown.enter",function(n){let r=P(t),o=r.$index,a=r.$count,s=p();return R(s.onCrumbKey(n,o===a-1))})("keydown.space",function(n){let r=P(t),o=r.$index,a=r.$count,s=p();return R(s.onCrumbKey(n,o===a-1))}),Y(1),b()}if(i&2){let t=e.$implicit,M=e.$index,n=e.$count;It("tabindex",M===n-1?null:0),L(),it(t.label)}}function HZt(i,e){if(i&1&&Zt(0,"nile-skeleton-loader",14),i&2){let t=e.$implicit;aM("height",t,"%")}}function JZt(i,e){if(i&1&&(C(0,"div",9),Zt(1,"nile-skeleton-loader",10)(2,"nile-skeleton-loader",11),C(3,"div",12),ht(4,HZt,1,2,"nile-skeleton-loader",13,Mr),b()()),i&2){let t=p(2);L(4),xt(t.skeletonRows)}}function GZt(i,e){if(i&1&&(C(0,"div",6),ht(1,JZt,6,0,"div",9,Mr),b()),i&2){let t=p();L(),xt(t.skeletonCards)}}function $Zt(i,e){i&1&&sl(0,1)}var Km=[],eE=class i{constructor(e){this.host=e;let t=typeof document<"u"?document.activeElement:null;this.focusOnOpen=t instanceof HTMLElement&&t!==document.body?t:null,Km.push(this),document.addEventListener("keydown",this.onDocumentKeydown)}host;crumbs=at([]);loading=at(!1);label=at("Widget detail");closed=Xi();crumbBar;footerSlot;focusOnOpen;footerWatcher;accessibleName=At(()=>{let e=this.crumbs();return e.length?e[e.length-1].label:this.label()});ngAfterViewInit(){this.focusIntoPanel(),this.measureFooter(),typeof MutationObserver<"u"&&this.footerSlot&&(this.footerWatcher=new MutationObserver(()=>this.measureFooter()),this.footerWatcher.observe(this.footerSlot.nativeElement,{childList:!0}))}ngOnDestroy(){document.removeEventListener("keydown",this.onDocumentKeydown);let e=Km.indexOf(this);e!==-1&&Km.splice(e,1),this.footerWatcher?.disconnect(),this.restoreFocus()}onClose(){this.closed.emit()}onCrumbKey(e,t){t||(e.preventDefault(),this.closed.emit())}onDocumentKeydown=e=>{e.key==="Escape"&&(e.defaultPrevented||Km[Km.length-1]===this&&this.closed.emit())};focusIntoPanel(){this.crumbBar?.nativeElement.focus({preventScroll:!0})}restoreFocus(){let e=this.focusOnOpen;if(!e||!e.isConnected)return;let t=document.activeElement;(t===null||t===document.body||this.host.nativeElement.contains(t))&&e.focus({preventScroll:!0})}skeletonCards=[0,1];skeletonRows=[92,78,86,64,72];measureFooter(){let e=this.footerSlot?.nativeElement;if(!e)return;Array.from(e.childNodes).some(M=>M.nodeType===Node.ELEMENT_NODE||M.nodeType===Node.TEXT_NODE&&(M.textContent??"").trim().length>0)?e.removeAttribute("hidden"):e.setAttribute("hidden","")}static \u0275fac=function(t){return new(t||i)(ni(ir))};static \u0275cmp=rM({type:i,selectors:[["shared-widget-detail-panel"]],viewQuery:function(t,M){if(t&1&&eN(PZt,7)(RZt,7),t&2){let n;ll(n=gl())&&(M.crumbBar=n.first),ll(n=gl())&&(M.footerSlot=n.first)}},inputs:{crumbs:[1,"crumbs"],loading:[1,"loading"],label:[1,"label"]},outputs:{closed:"closed"},ngContentSelectors:BZt,decls:12,vars:3,consts:[["crumbBar",""],["footerSlot",""],["role","region",1,"detail-panel"],["tabindex","-1",1,"detail-panel__crumbs"],[3,"nile-click"],[1,"detail-panel__body"],["aria-hidden","true",1,"detail-panel__skeleton"],["hidden","",1,"detail-panel__footer"],[3,"keydown.enter","keydown.space"],[1,"detail-panel__sk-card"],["variant","text","width","40%","height","15"],["variant","text","width","55%","height","10"],[1,"detail-panel__sk-rows"],["variant","rectangular","width","100%","height","100%",3,"height"],["variant","rectangular","width","100%","height","100%"]],template:function(t,M){t&1&&(tu(VZt),C(0,"div",2)(1,"div",3,0)(3,"nile-breadcrumb",4),Ae("nile-click",function(){return M.onClose()}),ht(4,FZt,2,2,"nile-breadcrumb-item",null,Mr),b()(),C(6,"div",5),he(7,GZt,3,0,"div",6)(8,$Zt,1,0),b(),C(9,"div",7,1),sl(11),b()()),t&2&&(It("aria-label",M.accessibleName()),L(4),xt(M.crumbs()),L(2),It("aria-busy",M.loading()),L(),xe(M.loading()?7:8))},dependencies:[Go],styles:['@charset "UTF-8";.detail-panel[_ngcontent-%COMP%]{position:absolute;inset:0;z-index:var(--z-floating, 50);display:flex;flex-direction:column;background:var(--ng-colors-bg-primary);animation:_ngcontent-%COMP%_detail-panel-slide-in .16s ease}.detail-panel__crumbs[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--ng-spacing-3, 12px);box-sizing:border-box;height:var(--aq-header-h, 56px);padding:0 var(--ng-spacing-5, 20px);border-bottom:1px solid var(--ng-colors-border-secondary);flex-shrink:0}.detail-panel__crumbs[_ngcontent-%COMP%]:focus{outline:none}.detail-panel__crumbs[_ngcontent-%COMP%] nile-breadcrumb[_ngcontent-%COMP%]{display:inline-flex;align-items:center}.detail-panel__crumbs[_ngcontent-%COMP%] nile-breadcrumb-item[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--ng-colors-border-brand);outline-offset:2px;border-radius:var(--ng-radius-xs, 4px)}.detail-panel__body[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;overflow:auto;scrollbar-width:none;-ms-overflow-style:none;padding:var(--ng-spacing-5, 20px);background:var(--ng-colors-bg-secondary)}.detail-panel__body[_ngcontent-%COMP%]::-webkit-scrollbar{width:0;height:0}.detail-panel__skeleton[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--ng-spacing-4, 16px)}.detail-panel__sk-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;padding:16px;min-height:240px;border-radius:var(--ng-radius-xl, 12px);background:var(--ng-colors-bg-primary);box-shadow:var(--ng-shadow-sm)}.detail-panel__sk-rows[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-end;gap:8px;min-height:0;margin-top:8px}.detail-panel__sk-rows[_ngcontent-%COMP%] nile-skeleton-loader[_ngcontent-%COMP%]{flex:1}.detail-panel__footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:var(--ng-spacing-2, 8px);padding:var(--ng-spacing-3, 12px) var(--ng-spacing-5, 20px);border-top:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary);flex-shrink:0}.detail-panel__footer[hidden][_ngcontent-%COMP%]{display:none}@keyframes _ngcontent-%COMP%_detail-panel-slide-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}'],changeDetection:0})};var t0=new $t("STORIES_FETCHER");function XZt(i){return{provide:t0,useFactory:i}}var qZt="wf.pendingStoryScene";function gF(i){try{sessionStorage.setItem(qZt,JSON.stringify(i))}catch{}}function KZt(i){return/\bWHERE\b([\s\S]*?)(?:\bGROUP BY\b|\bORDER BY\b|\bLIMIT\b|$)/i.exec(i)?.[1]?.trim().replace(/\s+/g," ")||null}function e_t(i){let e=i?.query?.bool,t=[...e?.filter??[],...e?.must??[]],M=[];for(let n of t){let r=n;if(r.term)for(let[o,a]of Object.entries(r.term))M.push(`${o.replace(/\.keyword$/,"")} = ${String(a)}`);else if(r.terms)for(let[o,a]of Object.entries(r.terms))M.push(`${o.replace(/\.keyword$/,"")} in [${a.join(", ")}]`);else if(r.range)for(let[o,a]of Object.entries(r.range)){let s=Object.entries(a).map(([l,N])=>`${l} ${N}`).join(" ");M.push(`${o} ${s}`)}else if(r.match)for(let[o,a]of Object.entries(r.match))M.push(`${o} ~ "${String(a)}"`)}return M.length?M.join(" AND "):null}function i0(i){let e=[],t=i.config?.aq,M=t?.summary??t?.chartSubtitle;M&&e.push({label:"Summary",text:M}),i.edited===!1?e.push({label:"Filter",text:Rm(i)}):i.edited===!0&&e.push({label:"Filter",text:"Reflects the active dashboard filter"});let n=i.queryMeta,r=n?.sql?KZt(n.sql):n?.dsl?e_t(n.dsl):null;return r&&e.push({label:"Filters applied",text:r}),e}function Gc(i){if(!i)return{columns:[],rows:[]};let e=i.data,t=i.value;if(t!=null&&!Array.isArray(e)){let M=i.label||"value";return{columns:[M],rows:[{[M]:t}]}}if(Array.isArray(e)&&e.length){let M=e[0],n=M?.data;if(Array.isArray(n)&&!Array.isArray(n[0])&&typeof n[0]!="object"){let r=e,a=(i.categories??n.map((s,l)=>l+1)).map((s,l)=>{let N={category:s};for(let c of r)N[c.name??"value"]=c.data?.[l]??null;return N});return{columns:["category",...r.map(s=>s.name??"value")],rows:a}}if(Array.isArray(n)&&Array.isArray(n[0]))return{columns:["x","y"],rows:n.map(([o,a])=>({x:o,y:a}))};if(M&&typeof M=="object"&&"y"in M)return{columns:["name","value"],rows:e.map(o=>({name:o.name,value:o.y}))};if(typeof M=="number")return{columns:["value"],rows:e.map(r=>({value:r}))};if(M&&typeof M=="object")return{columns:Object.keys(M),rows:e}}return{columns:[],rows:[]}}function Jst(i,e){return async(t,M,n,r)=>{let o=await i(t,M,n,r),a=e.match(M,n);if(!a.length)return o;let s=new Set(a.map(I=>String(I))),l=o.values.map(I=>s.has(String(I.value))?U(x({},I),{observed:!0}):I),N=new Set(o.values.map(I=>String(I.value))),D=[...a.filter(I=>!N.has(String(I))).map(I=>({value:I,label:String(I),observed:!0})),...l.filter(I=>I.observed),...l.filter(I=>!I.observed)];return U(x({},o),{values:D})}}var t_t=[[["","panel-footer",""]]],i_t=["[panel-footer]"],M_t=["ngProjectAs","[panel-footer]",5,["","panel-footer",""]],V3=(i,e)=>e.id,NF=(i,e)=>e.key,$st=(i,e)=>e.component,n_t=(i,e)=>e.index,Yj=(i,e)=>e.value,Xst=(i,e)=>e.name,r_t=(i,e)=>e.drillDownName,o_t=(i,e)=>e.label;function a_t(i,e){if(i&1){let t=Le();$(0,"shared-filter-rail",41),Ze("modeChange",function(n){P(t);let r=p();return R(r.onRailModeChange(n))})("conditionsChange",function(n){P(t);let r=p();return R(r.onRailConditions(n))})("expressionRun",function(n){P(t);let r=p();return R(r.onRailExpressionRun(n))})("promptAsk",function(n){P(t);let r=p();return R(r.onRailPromptAsk(n))})("clearAll",function(){P(t);let n=p();return R(n.onRailClearAll())})("timeRangeApply",function(n){P(t);let r=p();return R(r.onRailTimeRange(n))}),ee()}if(i&2){let t=p();ot("mode",t.railMode())("conditions",t.railConditions())("catalog",t.railCatalog())("expression",t.railExpression())("busy",t.widgetsLoading)("valueFetcher",t.valueFetcher())("showFilterControls",t.hasFilterWidget())("disabled",!t.filtersEnabled)("showTimeFilter",t.timeFilterEnabled)("timeFilterResetKey",t.dashboardId)}}function s_t(i,e){if(i&1&&($(0,"div",2),Mt(1,"nile-glyph",42),$(2,"span",43),Y(3),ee()()),i&2){let t=p();L(3),it(t.filterExplanation)}}function l_t(i,e){i&1&&($(0,"div",45),Mt(1,"nile-skeleton-loader",48)(2,"nile-skeleton-loader",49)(3,"nile-skeleton-loader",50),ee())}function g_t(i,e){if(i&1&&Mt(0,"nile-skeleton-loader",57),i&2){let t=e.$implicit;aM("height",t,"%")}}function N_t(i,e){if(i&1&&($(0,"div",47),Mt(1,"nile-skeleton-loader",51)(2,"nile-skeleton-loader",52),$(3,"div",53),ht(4,g_t,1,2,"nile-skeleton-loader",54,Mr),ee(),$(6,"div",55),Mt(7,"nile-skeleton-loader",56)(8,"nile-skeleton-loader",56),ee()()),i&2){let t=p(2);L(4),xt(t.skeletonBars)}}function u_t(i,e){if(i&1&&($(0,"div",3)(1,"div",44),ht(2,l_t,4,0,"div",45,Mr),ee(),$(4,"div",46),ht(5,N_t,9,0,"div",47,Mr),ee()()),i&2){let t=p();L(2),xt(t.skeletonKpis),L(3),xt(t.skeletonCharts)}}function c_t(i,e){i&1&&($(0,"p"),Y(1,"Tap the canvas above to generate charts, KPIs, and tables \u2014 or pick from the library."),ee())}function D_t(i,e){if(i&1){let t=Le();$(0,"nile-button",92),Ze("click",function(){P(t);let n=p(2);return R(n.openAiBuilder.emit())}),Mt(1,"nile-glyph",93),Y(2," Add widget "),ee()}}function I_t(i,e){if(i&1){let t=Le();$(0,"div",58)(1,"div",59),Ze("click",function(){P(t);let n=p();return R(n.editMode&&n.openAiBuilder.emit())})("keydown.enter",function(){P(t);let n=p();return R(n.editMode&&n.openAiBuilder.emit())})("keydown.space",function(n){P(t);let r=p();return r.editMode&&r.openAiBuilder.emit(),R(r.editMode&&n.preventDefault())}),KJ(),$(2,"svg",60),Mt(3,"rect",61)(4,"rect",62)(5,"rect",63),$(6,"rect",64),Mt(7,"animate",65)(8,"animate",66),ee(),$(9,"rect",67),Mt(10,"animate",68)(11,"animate",69),ee(),$(12,"rect",70),Mt(13,"animate",71)(14,"animate",72),ee(),$(15,"rect",73),Mt(16,"animate",74)(17,"animate",75),ee(),$(18,"rect",76),Mt(19,"animate",77)(20,"animate",78),ee(),Mt(21,"rect",79)(22,"rect",80)(23,"circle",81),$(24,"circle",82),Mt(25,"animate",83),ee(),Mt(26,"rect",84)(27,"rect",85),$(28,"path",86),Mt(29,"animate",87),ee(),$(30,"circle",88),Mt(31,"animate",89),ee()()(),eG(),$(32,"h3"),Y(33,"Add widgets to build your dashboard"),ee(),ux(34,c_t,2,0,"p",90)(35,D_t,3,0,"nile-button",91),ee()}if(i&2){let t=p();L(),It("role",t.editMode?"button":null)("tabindex",t.editMode?0:null),L(33),ot("ngIf",t.editMode),L(),ot("ngIf",!t.editMode)}}function d_t(i,e){if(i&1&&($(0,"div",98)(1,"span",105)(2,"nile-lite-tooltip",106),Mt(3,"nile-glyph",107),ee(),$(4,"span",108),Y(5),ee()()()),i&2){let t=p().$implicit,M=p(2);L(),It("aria-label",M.reasonText(t)),L(),ot("content",M.reasonText(t)),L(3),it(M.reasonText(t))}}function j_t(i,e){i&1&&($(0,"div",101),Mt(1,"nile-glyph",109),ee())}function y_t(i,e){if(i&1){let t=Le();$(0,"div",102)(1,"nile-checkbox",110),Ze("nile-change",function(n){P(t);let r=p().$implicit,o=p(2);return R(o.toggleSelection(r.id,n.detail.checked))}),ee()()}if(i&2){let t=p().$implicit,M=p(2);L(),It("checked",M.isSelected(t.id)?"":null)}}function T_t(i,e){if(i&1&&Mt(0,"nile-glyph",118),i&2){let t=p(2).$implicit;ot("name",t.glyph)("method",t.method||"stroke")}}function A_t(i,e){i&1&&($(0,"nile-context-menu-item",120),Y(1,"Loading stories\u2026"),ee())}function z_t(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",123),Ze("click",function(){let n=P(t).$implicit,r=p(9);return R(r.chooseStory(n.id))}),Y(1),ee()}if(i&2){let t=e.$implicit;L(),it(t.title||"Untitled story")}}function h_t(i,e){if(i&1){let t=Le();ht(0,z_t,2,1,"nile-context-menu-item",null,V3),$(2,"nile-context-menu-item",121),Ze("click",function(){P(t);let n=p(8);return R(n.chooseStory(null))}),Mt(3,"nile-glyph",122),Y(4," Add as new story "),ee()}if(i&2){let t=p(8);xt(t.storyOptions)}}function x_t(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",117),Ze("mouseenter",function(){P(t);let n=p(5).$implicit,r=p(2);return R(r.loadStoriesFor(n.id))})("focusin",function(){P(t);let n=p(5).$implicit,r=p(2);return R(r.loadStoriesFor(n.id))}),he(1,T_t,1,2,"nile-glyph",118),Y(2),$(3,"nile-context-submenu",119)(4,"nile-context-menu-group"),he(5,A_t,2,0,"nile-context-menu-item",120)(6,h_t,5,0),ee()()()}if(i&2){let t=p().$implicit,M=p(6);L(),xe(t.glyph?1:-1),L(),yi(" ",t.label," "),L(3),xe(M.storyLoading?5:6)}}function p_t(i,e){if(i&1&&Mt(0,"nile-glyph",118),i&2){let t=p().$implicit;aM("color",t.color),ot("name",t.glyph)("method",t.method||"stroke")}}function L_t(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){let n=P(t).$implicit,r=p(6).$implicit,o=p(2);return R(o.onOwnMenuItem(r,n))}),he(1,p_t,1,4,"nile-glyph",125),Y(2),ee()}if(i&2){let t=e.$implicit;L(),xe(t.glyph?1:-1),L(),yi(" ",t.label," ")}}function O_t(i,e){if(i&1&&($(0,"nile-context-menu-item",116),Mt(1,"nile-glyph",118),Y(2),$(3,"nile-context-submenu",119)(4,"nile-context-menu-group"),ht(5,L_t,3,2,"nile-context-menu-item",116,NF),ee()()()),i&2){let t=p().$implicit;L(),ot("name",t.glyph)("method",t.method||"stroke"),L(),yi(" ",t.label," "),L(3),xt(t.children)}}function m_t(i,e){if(i&1&&Mt(0,"nile-glyph",118),i&2){let t=p(3).$implicit;aM("color",t.color),ot("name",t.glyph)("method",t.method||"stroke")}}function E_t(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){let n=P(t),r=p(6).$implicit,o=p(2);return R(o.onOwnMenuItem(r,n))}),he(1,m_t,1,4,"nile-glyph",125),Y(2),ee()}if(i&2){let t=p(2).$implicit;L(),xe(t.glyph?1:-1),L(),yi(" ",t.label," ")}}function f_t(i,e){if(i&1&&he(0,E_t,3,2,"nile-context-menu-item",116),i&2){let t,M=p().$implicit;xe((t=M.item)?0:-1,t)}}function S_t(i,e){if(i&1&&he(0,x_t,7,3,"nile-context-menu-item",116)(1,O_t,7,3,"nile-context-menu-item",116)(2,f_t,1,1),i&2){let t=e.$implicit;xe(t.key==="addToStory"?0:t.children.length?1:2)}}function w_t(i,e){if(i&1&&($(0,"nile-context-menu-group",115),ht(1,S_t,3,1,null,null,NF),ee()),i&2){let t=e.$implicit;Wt("widget-menu__group--empty",!t.nodes.length)("widget-menu__group--first",t.first),L(),xt(t.nodes)}}function C_t(i,e){if(i&1){let t=Le();$(0,"button",111),Ze("click",function(){P(t);let n=p(2).$implicit,r=p(2);return R(r.openWidgetKebab(n))}),Mt(1,"nile-glyph",112),ee(),$(2,"nile-context-menu",113),Ze("nile-change",function(n){P(t);let r=p(2).$implicit,o=p(2);return R(o.onWidgetKebabChange(r,n))}),ht(3,w_t,3,4,"nile-context-menu-group",114,NF),ee()}if(i&2){let t=p(2).$implicit,M=p(2);ot("id",M.kebabIdFor(t.id)),It("aria-expanded",M.menuOpenWidgetId===t.id),L(2),ot("open",M.menuOpenWidgetId===t.id),It("for",M.kebabIdFor(t.id)),L(),xt(M.widgetMenuGroupsFor(t))}}function k_t(i,e){if(i&1&&ht(0,C_t,5,4,null,null,Ho),i&2){let t=p().$implicit,M=p(2);xt(M.widgetMenuEpochFor(t.id))}}function b_t(i,e){i&1&&($(0,"div",130),Mt(1,"nile-spinner",133),$(2,"span"),Y(3,"Loading chart types\u2026"),ee()())}function Q_t(i,e){i&1&&($(0,"p",131),Y(1,"No other chart types fit this widget's data."),ee())}function U_t(i,e){i&1&&Mt(0,"nile-spinner",133)}function v_t(i,e){if(i&1&&Mt(0,"nile-glyph",138),i&2){let t=p().$implicit,M=p(6);ot("name",M.chartTypeIcon(t.type))}}function Y_t(i,e){if(i&1){let t=Le();$(0,"button",137),Ze("click",function(){let n=P(t).$implicit,r=p(6);return R(r.selectChartType(n.component))}),he(1,U_t,1,0,"nile-spinner",133)(2,v_t,1,1,"nile-glyph",138),$(3,"span"),Y(4),ee()()}if(i&2){let t=e.$implicit,M=p(6);Wt("type-picker__tile--current",t.component===M.chartTypeCurrentComponent),It("aria-current",t.component===M.chartTypeCurrentComponent?"true":null)("disabled",M.chartTypeApplying?"":null),L(),xe(M.chartTypeApplyingComponent===t.component?1:2),L(3),it(t.label)}}function Z_t(i,e){if(i&1&&($(0,"p",134),Y(1,"Recommended"),ee(),$(2,"div",135),ht(3,Y_t,5,6,"button",136,$st),ee()),i&2){let t=p(5);L(3),xt(t.sensibleChartTypes())}}function __t(i,e){i&1&&Mt(0,"nile-spinner",133)}function W_t(i,e){if(i&1&&Mt(0,"nile-glyph",138),i&2){let t=p().$implicit,M=p(6);ot("name",M.chartTypeIcon(t.type))}}function P_t(i,e){if(i&1){let t=Le();$(0,"button",140),Ze("click",function(){let n=P(t).$implicit,r=p(6);return R(r.selectChartType(n.component))}),he(1,__t,1,0,"nile-spinner",133)(2,W_t,1,1,"nile-glyph",138),$(3,"span"),Y(4),ee()()}if(i&2){let t=e.$implicit,M=p(6);Wt("type-picker__tile--current",t.component===M.chartTypeCurrentComponent),It("aria-current",t.component===M.chartTypeCurrentComponent?"true":null)("disabled",M.chartTypeApplying?"":null),L(),xe(M.chartTypeApplyingComponent===t.component?1:2),L(3),it(t.label)}}function R_t(i,e){if(i&1&&($(0,"p",134),Y(1,"Other types"),ee(),$(2,"div",135),ht(3,P_t,5,6,"button",139,$st),ee()),i&2){let t=p(5);L(3),xt(t.otherChartTypes())}}function V_t(i,e){if(i&1&&(he(0,Z_t,5,0),he(1,R_t,5,0)),i&2){let t=p(4);xe(t.sensibleChartTypes().length>0?0:-1),L(),xe(t.otherChartTypes().length>0?1:-1)}}function B_t(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(4);L(),it(t.chartTypeError)}}function F_t(i,e){if(i&1){let t=Le();$(0,"nile-dropdown",126),Ze("nile-hide",function(){P(t);let n=p().$implicit,r=p(2);return R(r.chartTypePickerWidgetId===n.id&&r.closeChartTypePicker())}),$(1,"button",127),Mt(2,"nile-glyph",128),ee(),$(3,"div",129),he(4,b_t,4,0,"div",130)(5,Q_t,2,0,"p",131)(6,V_t,2,2),he(7,B_t,2,1,"p",132),ee()()}if(i&2){let t=p().$implicit,M=p(2);ot("open",M.chartTypePickerWidgetId===t.id),L(4),xe(M.chartTypeLoading?4:M.chartTypeOptions.length===0?5:6),L(3),xe(M.chartTypeError?7:-1)}}function H_t(i,e){if(i&1){let t=Le();$(0,"label",143)(1,"span",144)(2,"input",145),Ze("change",function(n){let r=P(t).$implicit,o=p(4);return R(o.selectSeriesColor(r.index,n.target.value))}),ee()(),$(3,"span",146),Y(4),ee()()}if(i&2){let t=e.$implicit;L(2),ot("value",t.color),L(2),it(t.name)}}function J_t(i,e){if(i&1){let t=Le();$(0,"nile-dropdown",126),Ze("nile-hide",function(){P(t);let n=p().$implicit,r=p(2);return R(r.colorPickerWidgetId===n.id&&r.closeColorPicker())}),$(1,"button",127),Mt(2,"nile-glyph",141),ee(),$(3,"div",142)(4,"p",134),Y(5,"Series colors"),ee(),ht(6,H_t,5,2,"label",143,n_t),ee()()}if(i&2){let t=p().$implicit,M=p(2);ot("open",M.colorPickerWidgetId===t.id),L(6),xt(M.colorPickerSeries())}}function G_t(i,e){if(i&1){let t=Le();$(0,"span",152),Y(1),$(2,"button",153),Ze("click",function(){let n=P(t).$implicit,r=p(6);return R(n.id&&r.removeFilterFromBuilder(n.id))}),Mt(3,"nile-glyph",154),ee()()}if(i&2){let t=e.$implicit,M=p(6);L(),hG(" ",t.field," ",t.operation," ",t.value," "),L(),It("disabled",M.filterBuilderRemovingId?"":null)}}function $_t(i,e){if(i&1&&($(0,"div",149),ht(1,G_t,4,4,"span",152,V3),ee()),i&2){let t=p(5);L(),xt(t.filterBuilderActiveFilters())}}function X_t(i,e){if(i&1){let t=Le();$(0,"button",156),Ze("click",function(){let n=P(t).$implicit,r=p(4).$implicit,o=p(2);return R(o.applyQuickTimeFilter(r,n.value))}),Y(1),ee()}if(i&2){let t=e.$implicit,M=p(6);It("disabled",M.filterBuilderApplying?"":null),L(),yi(" ",t.label," ")}}function q_t(i,e){if(i&1&&($(0,"div",150),ht(1,X_t,2,2,"button",155,Yj),ee()),i&2){let t=p(5);L(),xt(t.quickTimePresets)}}function K_t(i,e){i&1&&($(0,"div",130),Mt(1,"nile-spinner",133),$(2,"span"),Y(3,"Loading filterable fields\u2026"),ee()())}function eWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(5);L(),it(t.ephemeralFilterFieldsError)}}function tWt(i,e){i&1&&($(0,"p",131),Y(1,"No filterable fields found for this widget's data."),ee())}function iWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.name),L(),it(t.label)}}function MWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.value),L(),it(t.label)}}function nWt(i,e){if(i&1){let t=Le();$(0,"input",164),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.filterBuilderValue,n)||(r.filterBuilderValue=n),R(n)}),Ze("keydown.enter",function(){P(t);let n=p(7);return R(n.submitFilterBuilder())}),ee()}if(i&2){let t=p(7);Nl("ngModel",t.filterBuilderValue)}}function rWt(i,e){if(i&1){let t=Le();$(0,"span",166),Y(1,"and"),ee(),$(2,"input",165),cl("ngModelChange",function(n){P(t);let r=p(8);return ul(r.filterBuilderValue2,n)||(r.filterBuilderValue2=n),R(n)}),ee()}if(i&2){let t=p(8);L(2),Nl("ngModel",t.filterBuilderValue2)}}function oWt(i,e){if(i&1){let t=Le();$(0,"input",165),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.filterBuilderValue,n)||(r.filterBuilderValue=n),R(n)}),ee(),he(1,rWt,3,1)}if(i&2){let t,M=p(7);Nl("ngModel",M.filterBuilderValue),L(),xe((t=M.filterBuilderSelectedOperator())!=null&&t.needsSecondValue?1:-1)}}function aWt(i,e){if(i&1){let t=Le();$(0,"span",166),Y(1,"and"),ee(),$(2,"input",168),cl("ngModelChange",function(n){P(t);let r=p(8);return ul(r.filterBuilderValue2,n)||(r.filterBuilderValue2=n),R(n)}),ee()}if(i&2){let t=p(8);L(2),Nl("ngModel",t.filterBuilderValue2)}}function sWt(i,e){if(i&1){let t=Le();$(0,"input",167),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.filterBuilderValue,n)||(r.filterBuilderValue=n),R(n)}),Ze("keydown.enter",function(){P(t);let n=p(7);return R(n.submitFilterBuilder())}),ee(),he(1,aWt,3,1)}if(i&2){let t,M=p(7);Nl("ngModel",M.filterBuilderValue),L(),xe((t=M.filterBuilderSelectedOperator())!=null&&t.needsSecondValue?1:-1)}}function lWt(i,e){if(i&1){let t=Le();$(0,"label",169)(1,"input",170),Ze("change",function(){let n=P(t).$implicit,r=p(8);return R(r.toggleFilterBuilderMultiValue(n.value))}),ee(),$(2,"span"),Y(3),ee()()}if(i&2){let t=e.$implicit,M=p(8);L(),ot("checked",M.filterBuilderValues.includes(t.value)),L(2),Jo("",t.label,"",t.count!=null?" ("+t.count+")":"")}}function gWt(i,e){if(i&1&&($(0,"div",162),ht(1,lWt,4,3,"label",169,Yj),ee()),i&2){let t=p(5).$implicit,M=p(2);L(),xt(M.filterValuesFor(t,M.filterBuilderField))}}function NWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.value),L(),Jo("",t.label,"",t.count!=null?" ("+t.count+")":"")}}function uWt(i,e){if(i&1){let t=Le();$(0,"select",157),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.filterBuilderValue,n)||(r.filterBuilderValue=n),R(n)}),$(1,"option",171),Y(2,"Select\u2026"),ee(),ht(3,NWt,2,3,"option",158,Yj),ee()}if(i&2){let t=p(5).$implicit,M=p(2);Nl("ngModel",M.filterBuilderValue),L(3),xt(M.filterValuesFor(t,M.filterBuilderField))}}function cWt(i,e){if(i&1&&he(0,nWt,1,1,"input",161)(1,oWt,2,2)(2,sWt,2,2)(3,gWt,3,0,"div",162)(4,uWt,5,1,"select",163),i&2){let t,M=p(6);xe((t=(t=M.filterBuilderSelectedOperator())==null?null:t.valueKind)==="text"?0:t==="date"?1:t==="number"?2:t==="multi-select"?3:t==="select"?4:-1)}}function DWt(i,e){i&1&&($(0,"div",160),Mt(1,"nile-spinner",172),$(2,"span"),Y(3,"Loading values\u2026"),ee()())}function IWt(i,e){if(i&1){let t=Le();$(0,"div",151)(1,"select",157),Ze("ngModelChange",function(n){P(t);let r=p(5);return R(r.onFilterBuilderFieldChange(n))}),ht(2,iWt,2,2,"option",158,Xst),ee(),$(4,"select",157),Ze("ngModelChange",function(n){P(t);let r=p(5);return R(r.onFilterBuilderOperatorChange(n))}),ht(5,MWt,2,2,"option",158,Yj),ee(),he(7,cWt,5,1),$(8,"nile-button",159),Ze("click",function(){P(t);let n=p(5);return R(n.submitFilterBuilder())}),Y(9," Add filter "),ee(),he(10,DWt,4,0,"div",160),ee()}if(i&2){let t=p(5);L(),ot("ngModel",t.filterBuilderField),L(),xt(t.filterBuilderFields()),L(2),ot("ngModel",t.filterBuilderOperation),L(),xt(t.filterBuilderOperators()),L(2),xe(t.ephemeralFilterValuesLoading?-1:7),L(),It("loading",t.filterBuilderApplying?"":null)("disabled",t.filterBuilderApplying||t.ephemeralFilterValuesLoading?"":null),L(2),xe(t.ephemeralFilterValuesLoading?10:-1)}}function dWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(5);L(),it(t.filterBuilderError)}}function jWt(i,e){if(i&1&&(he(0,$_t,3,0,"div",149),he(1,q_t,3,0,"div",150),he(2,K_t,4,0,"div",130)(3,eWt,2,1,"p",132)(4,tWt,2,0,"p",131)(5,IWt,11,6,"div",151),he(6,dWt,2,1,"p",132)),i&2){let t=p(2).$implicit,M=p(2);xe(M.filterBuilderActiveFilters().length>0?0:-1),L(),xe(M.timeWindowField(t)?1:-1),L(),xe(M.ephemeralFilterFieldsLoading?2:M.ephemeralFilterFieldsError?3:M.filterBuilderFields().length===0?4:5),L(4),xe(M.filterBuilderError?6:-1)}}function yWt(i,e){if(i&1){let t=Le();$(0,"span",152),Y(1),$(2,"button",153),Ze("click",function(){let n=P(t).$implicit,r=p(6);return R(r.removeEphemeralFilter(n.id))}),Mt(3,"nile-glyph",154),ee()()}if(i&2){let t=e.$implicit,M=p(6);L(),yi(" ",M.ephemeralFilterChipLabel(t)," "),L(),It("disabled",M.ephemeralFilterApplying?"":null)}}function TWt(i,e){if(i&1&&($(0,"div",149),ht(1,yWt,4,2,"span",152,V3),ee()),i&2){let t=p(5);L(),xt(t.ephemeralFilterActiveFilters())}}function AWt(i,e){if(i&1){let t=Le();$(0,"button",156),Ze("click",function(){let n=P(t).$implicit,r=p(4).$implicit,o=p(2);return R(o.applyQuickTimeFilter(r,n.value))}),Y(1),ee()}if(i&2){let t=e.$implicit,M=p(6);It("disabled",M.ephemeralFilterApplying?"":null),L(),yi(" ",t.label," ")}}function zWt(i,e){if(i&1&&($(0,"div",150),ht(1,AWt,2,2,"button",155,Yj),ee()),i&2){let t=p(5);L(),xt(t.quickTimePresets)}}function hWt(i,e){i&1&&($(0,"div",130),Mt(1,"nile-spinner",133),$(2,"span"),Y(3,"Loading filterable fields\u2026"),ee()())}function xWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(5);L(),it(t.ephemeralFilterFieldsError)}}function pWt(i,e){i&1&&($(0,"p",131),Y(1,"No filterable fields found for this widget's data."),ee())}function LWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.name),L(),it(t.label)}}function OWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.value),L(),it(t.label)}}function mWt(i,e){if(i&1){let t=Le();$(0,"input",164),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.ephemeralFilterBuilderValue,n)||(r.ephemeralFilterBuilderValue=n),R(n)}),Ze("keydown.enter",function(){P(t);let n=p(7);return R(n.addEphemeralFilter())}),ee()}if(i&2){let t=p(7);Nl("ngModel",t.ephemeralFilterBuilderValue)}}function EWt(i,e){if(i&1){let t=Le();$(0,"span",166),Y(1,"and"),ee(),$(2,"input",165),cl("ngModelChange",function(n){P(t);let r=p(8);return ul(r.ephemeralFilterBuilderValue2,n)||(r.ephemeralFilterBuilderValue2=n),R(n)}),ee()}if(i&2){let t=p(8);L(2),Nl("ngModel",t.ephemeralFilterBuilderValue2)}}function fWt(i,e){if(i&1){let t=Le();$(0,"input",165),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.ephemeralFilterBuilderValue,n)||(r.ephemeralFilterBuilderValue=n),R(n)}),ee(),he(1,EWt,3,1)}if(i&2){let t,M=p(7);Nl("ngModel",M.ephemeralFilterBuilderValue),L(),xe((t=M.ephemeralFilterSelectedOperator())!=null&&t.needsSecondValue?1:-1)}}function SWt(i,e){if(i&1){let t=Le();$(0,"span",166),Y(1,"and"),ee(),$(2,"input",168),cl("ngModelChange",function(n){P(t);let r=p(8);return ul(r.ephemeralFilterBuilderValue2,n)||(r.ephemeralFilterBuilderValue2=n),R(n)}),ee()}if(i&2){let t=p(8);L(2),Nl("ngModel",t.ephemeralFilterBuilderValue2)}}function wWt(i,e){if(i&1){let t=Le();$(0,"input",167),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.ephemeralFilterBuilderValue,n)||(r.ephemeralFilterBuilderValue=n),R(n)}),Ze("keydown.enter",function(){P(t);let n=p(7);return R(n.addEphemeralFilter())}),ee(),he(1,SWt,3,1)}if(i&2){let t,M=p(7);Nl("ngModel",M.ephemeralFilterBuilderValue),L(),xe((t=M.ephemeralFilterSelectedOperator())!=null&&t.needsSecondValue?1:-1)}}function CWt(i,e){if(i&1){let t=Le();$(0,"label",169)(1,"input",170),Ze("change",function(){let n=P(t).$implicit,r=p(8);return R(r.toggleEphemeralFilterMultiValue(n.value))}),ee(),$(2,"span"),Y(3),ee()()}if(i&2){let t=e.$implicit,M=p(8);L(),ot("checked",M.ephemeralFilterBuilderValues.includes(t.value)),L(2),Jo("",t.label,"",t.count!=null?" ("+t.count+")":"")}}function kWt(i,e){if(i&1&&($(0,"div",162),ht(1,CWt,4,3,"label",169,Yj),ee()),i&2){let t=p(5).$implicit,M=p(2);L(),xt(M.filterValuesFor(t,M.ephemeralFilterBuilderFieldId))}}function bWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.value),L(),Jo("",t.label,"",t.count!=null?" ("+t.count+")":"")}}function QWt(i,e){if(i&1){let t=Le();$(0,"select",157),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.ephemeralFilterBuilderValue,n)||(r.ephemeralFilterBuilderValue=n),R(n)}),$(1,"option",171),Y(2,"Select\u2026"),ee(),ht(3,bWt,2,3,"option",158,Yj),ee()}if(i&2){let t=p(5).$implicit,M=p(2);Nl("ngModel",M.ephemeralFilterBuilderValue),L(3),xt(M.filterValuesFor(t,M.ephemeralFilterBuilderFieldId))}}function UWt(i,e){if(i&1&&he(0,mWt,1,1,"input",161)(1,fWt,2,2)(2,wWt,2,2)(3,kWt,3,0,"div",162)(4,QWt,5,1,"select",163),i&2){let t,M=p(6);xe((t=(t=M.ephemeralFilterSelectedOperator())==null?null:t.valueKind)==="text"?0:t==="date"?1:t==="number"?2:t==="multi-select"?3:t==="select"?4:-1)}}function vWt(i,e){i&1&&($(0,"div",160),Mt(1,"nile-spinner",172),$(2,"span"),Y(3,"Loading values\u2026"),ee()())}function YWt(i,e){if(i&1){let t=Le();$(0,"div",151)(1,"select",157),Ze("ngModelChange",function(n){P(t);let r=p(5);return R(r.onEphemeralFilterFieldChange(n))}),ht(2,LWt,2,2,"option",158,Xst),ee(),$(4,"select",157),Ze("ngModelChange",function(n){P(t);let r=p(5);return R(r.onEphemeralFilterOperatorChange(n))}),ht(5,OWt,2,2,"option",158,Yj),ee(),he(7,UWt,5,1),$(8,"nile-button",159),Ze("click",function(){P(t);let n=p(5);return R(n.addEphemeralFilter())}),Y(9," Add filter "),ee(),he(10,vWt,4,0,"div",160),ee()}if(i&2){let t=p(5);L(),ot("ngModel",t.ephemeralFilterBuilderFieldId),L(),xt(t.ephemeralFilterFields()),L(2),ot("ngModel",t.ephemeralFilterBuilderOperator),L(),xt(t.ephemeralFilterOperators()),L(2),xe(t.ephemeralFilterValuesLoading?-1:7),L(),It("loading",t.ephemeralFilterApplying?"":null)("disabled",t.ephemeralFilterApplying||t.ephemeralFilterValuesLoading?"":null),L(2),xe(t.ephemeralFilterValuesLoading?10:-1)}}function ZWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(5);L(),it(t.ephemeralFilterApplyError)}}function _Wt(i,e){if(i&1&&($(0,"p",131),Y(1,"Filters this preview only \u2014 nothing is saved."),ee(),he(2,TWt,3,0,"div",149),he(3,zWt,3,0,"div",150),he(4,hWt,4,0,"div",130)(5,xWt,2,1,"p",132)(6,pWt,2,0,"p",131)(7,YWt,11,6,"div",151),he(8,ZWt,2,1,"p",132)),i&2){let t=p(2).$implicit,M=p(2);L(2),xe(M.ephemeralFilterActiveFilters().length>0?2:-1),L(),xe(M.timeWindowField(t)?3:-1),L(),xe(M.ephemeralFilterFieldsLoading?4:M.ephemeralFilterFieldsError?5:M.ephemeralFilterFields().length===0?6:7),L(4),xe(M.ephemeralFilterApplyError?8:-1)}}function WWt(i,e){if(i&1){let t=Le();$(0,"nile-dropdown",126),Ze("nile-hide",function(){P(t);let n=p().$implicit,r=p(2);return R((r.dashboardId?r.filterBuilderWidgetId:r.ephemeralFilterBuilderWidgetId)===n.id&&(r.dashboardId?r.closeFilterBuilder():r.closeEphemeralFilterBuilder()))}),$(1,"button",127),Mt(2,"nile-glyph",147),ee(),$(3,"div",148),he(4,jWt,7,4)(5,_Wt,9,4),ee()()}if(i&2){let t=p().$implicit,M=p(2);ot("open",(M.dashboardId?M.filterBuilderWidgetId:M.ephemeralFilterBuilderWidgetId)===t.id),L(4),xe(M.dashboardId?4:5)}}function PWt(i,e){if(i&1){let t=Le();$(0,"div",104)(1,"button",173),Ze("click",function(){P(t);let n=p().$implicit,r=p(2);return R(r.applyDataViewFilter(n))}),Y(2," Apply filter "),ee()()}}function RWt(i,e){i&1&&($(0,"div",180),Mt(1,"nile-glyph",184),ee())}function VWt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"tweak"))}),Mt(1,"nile-glyph",185),Y(2," Tweak "),ee(),$(3,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"edit"))}),Mt(4,"nile-glyph",186),Y(5," Edit "),ee(),$(6,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"delete"))}),Mt(7,"nile-glyph",187),Y(8," Delete "),ee()}}function BWt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"setAlert"))}),Mt(1,"nile-glyph",188),Y(2," Set Alert "),ee()}}function FWt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"toggleFilterDefault"))}),Mt(1,"nile-glyph",189),Y(2),ee()}if(i&2){let t=p(4).$implicit,M=p(2);L(),ot("name",M.isFilterDefaultActive(t)?"ng-x-close":"ng-check"),L(),yi(" ",M.isFilterDefaultActive(t)?"Clear default filter":"Set current filter as default"," ")}}function HWt(i,e){if(i&1){let t=Le();$(0,"div",178),he(1,RWt,2,0,"div",180),$(2,"button",181),Ze("click",function(){P(t);let n=p(3).$implicit,r=p(2);return R(r.openFilterKebab(n))}),Mt(3,"nile-glyph",182),ee(),$(4,"nile-context-menu",113),Ze("nile-change",function(n){P(t);let r=p(3).$implicit,o=p(2);return R(o.onFilterKebabChange(r,n))}),$(5,"nile-context-menu-group",183),he(6,VWt,9,0),he(7,BWt,3,0,"nile-context-menu-item",116),he(8,FWt,3,2,"nile-context-menu-item",116),ee()()()}if(i&2){let t=p(3).$implicit,M=p(2);L(),xe(M.editMode?1:-1),L(),ot("id",M.kebabIdFor(t.id,"filter")),It("aria-expanded",M.filterKebabWidgetId===t.id),L(2),ot("open",M.filterKebabWidgetId===t.id),It("for",M.kebabIdFor(t.id,"filter")),L(2),xe(M.editMode?6:-1),L(),xe(M.showSetAlertFor(t)?7:-1),L(),xe(M.canToggleFilterDefault(t)?8:-1)}}function JWt(i,e){if(i&1){let t=Le();$(0,"div",175)(1,"div",176)(2,"span",177),Y(3),ee()(),he(4,HWt,9,8,"div",178),ee(),$(5,"shared-manual-filter-panel",179),Ze("conditionsChange",function(n){P(t);let r=p(2).$implicit,o=p(2);return R(o.onManualConditionsChange(r,n))})("contentHeight",function(n){P(t);let r=p(2).$implicit,o=p(2);return R(o.onFilterContentHeight(r,n))})("overflowCountChange",function(n){P(t);let r=p(2).$implicit,o=p(2);return R(o.onFilterOverflow(r,n))}),ee()}if(i&2){let t=p(2).$implicit,M=p(2);L(3),it(M.filterHeaderTitle),L(),xe((M.editMode||M.showSetAlertFor(t))&&M.showWidgetMenu?4:-1),L(),ot("catalog",M.catalogFor(t.id))("conditions",M.manualStateFor(t.id).conditions)("catalogLoading",!M.catalogFor(t.id).length)("disabled",M.widgetsLoading)("valueFetcher",M.valueFetcher())("onDashboardFields",M.observedFields())("recentlyUsedFields",M.recentlyUsedFields())("expanded",M.expandedFilterId()===t.id)}}function GWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(4);L(),it(t.filterDefaultError)}}function $Wt(i,e){if(i&1){let t=Le();$(0,"div",174)(1,"span",190),Ze("click",function(){P(t);let n=p(2).$implicit,r=p(2);return R(r.toggleFilterExpand(n))})("keydown.enter",function(){P(t);let n=p(2).$implicit,r=p(2);return R(r.toggleFilterExpand(n))}),Y(2),ee()()}if(i&2){let t=p(2).$implicit,M=p(2);L(2),yi(" ",M.expandedFilterId()===t.id?"Show less":"+"+M.filterOverflowFor(t.id)+" more"," ")}}function XWt(i,e){if(i&1&&(he(0,JWt,6,10),he(1,GWt,2,1,"p",132),he(2,$Wt,3,1,"div",174)),i&2){let t=p().$implicit,M=p(2);xe(M.isManualMode(t.id)?0:-1),L(),xe(M.filterDefaultError?1:-1),L(),xe(M.isManualMode(t.id)&&(M.filterOverflowFor(t.id)>0||M.expandedFilterId()===t.id)?2:-1)}}function qWt(i,e){if(i&1){let t=Le();$(0,"gridster-item",96)(1,"div",97),he(2,d_t,6,3,"div",98),$(3,"div",99),Ze("click",function(n){let r=P(t).$implicit,o=p(2);return R(o.onWidgetBodyClick(r,n))}),$(4,"shared-nile-chart-widget",100),Ze("aiSend",function(n){P(t);let r=p(2);return R(r.onAiSend(n))})("filterSubmit",function(n){P(t);let r=p(2);return R(r.onFilterSubmit(n))})("filterChange",function(n){P(t);let r=p(2);return R(r.onFilterChange(n))})("chartClick",function(n){let r=P(t).$implicit,o=p(2);return R(o.onChartClick(r,n))})("chartSelection",function(n){let r=P(t).$implicit,o=p(2);return R(o.onChartSelection(r,n))})("chartSelectionReset",function(){let n=P(t).$implicit,r=p(2);return R(r.onChartSelectionReset(n))})("cellFilter",function(n){let r=P(t).$implicit,o=p(2);return R(o.onCellFilter(r,n))})("dataViewFilterChange",function(n){let r=P(t).$implicit,o=p(2);return R(o.onDataViewFilterChange(r.id,n))})("gridFilterVerdict",function(n){P(t);let r=p(2);return R(r.onGridFilterVerdict(n))})("menuAction",function(n){let r=P(t).$implicit,o=p(2);return R(o.onMenuAction(r,n))})("remounted",function(){let n=P(t).$implicit,r=p(2);return R(r.onWidgetRemounted(n.id))}),he(5,j_t,2,0,"div",101),he(6,y_t,2,1,"div",102),he(7,k_t,2,0),he(8,F_t,8,3,"nile-dropdown",103),he(9,J_t,8,1,"nile-dropdown",103),he(10,WWt,6,2,"nile-dropdown",103),ee(),he(11,PWt,3,0,"div",104),ee(),he(12,XWt,3,3),ee()()}if(i&2){let t,M=e.$implicit,n=p(2);Wt("gridster-item--menu-open",n.hasOpenOverlay(M.id)),ot("item",n.getItemForWidget(M)),L(),Wt("widget-card--filter-inactive",n.showFilterNotice(M))("widget-card--filter",n.isFilterWidget(M))("widget-card--menu-open",n.hasOpenOverlay(M.id)),It("data-widget-id",M.id),L(),xe(n.showFilterNotice(M)?2:-1),L(),Wt("widget-body--hidden",n.isFilterWidget(M)&&n.isManualMode(M.id)),L(),ot("config",n.displayConfigFor(M))("drilldownBy",M.drilldownBy)("widgetId",M.id)("widgetTitle",M.title)("chromePinned",n.editMode||n.selectable)("loading",n.widgetsLoading&&!n.isFilterWidget(M)||M.id===n.tweakingWidgetId||n.isRecordsLoading(M)||M.id===n.forecastingWidgetId)("menu",n.chartMenuFor(M))("dashboardFilters",n.dashboardFilters)("resolvedFilters",n.resolvedFilters)("dashboardId",n.dashboardId)("conversationId",n.conversationId)("cellFilterEnabled",n.hasFilterWidget()&&n.viewModeFor(M)!=="data"),L(),xe(n.editMode?5:-1),L(),xe(n.selectable?6:-1),L(),xe(n.showWidgetMenu&&((t=n.menuFor(M).items)!=null&&t.length)?7:-1),L(),xe(n.canShowChartTypePicker(M)?8:-1),L(),xe(n.canShowColorPicker(M)?9:-1),L(),xe(n.canShowFilterPicker(M)?10:-1),L(),xe(n.viewModeFor(M)==="data"&&n.hasPendingDataViewFilter(M)?11:-1),L(),xe(n.isFilterWidget(M)?12:-1)}}function KWt(i,e){if(i&1&&($(0,"gridster",94),ht(1,qWt,13,33,"gridster-item",95,V3),ee()),i&2){let t=p();Wt("grid-hidden",t.widgets.length===0&&t.editMode),ot("options",t.options),L(),xt(t.gridWidgets())}}function ePt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){let n=P(t).$implicit,r=p(2);return R(r.pickDrillOption(n))}),Mt(1,"nile-glyph",194),Y(2),ee()}if(i&2){let t=e.$implicit;L(),It("name",t.drillDownIcon||"ng-tag"),L(),yi(" ",t.drillDownName," ")}}function tPt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-group")(1,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(2);return R(n.pickAddAsFilter())}),Mt(2,"nile-glyph",195),Y(3," Add as filter "),ee()()}}function iPt(i,e){if(i&1){let t=Le();Mt(0,"span",191),$(1,"nile-context-menu",192),Ze("nile-change",function(n){P(t);let r=p();return R(r.onDrillMenuChange(n))}),$(2,"nile-context-menu-group",193),ht(3,ePt,3,2,"nile-context-menu-item",116,r_t),ee(),he(5,tPt,4,0,"nile-context-menu-group"),ee()}if(i&2){let t=e,M=p();aM("left",t.x,"px")("top",t.y,"px"),ot("id",M.drillAnchorId),L(),ot("open",!0),It("for",M.drillAnchorId),L(2),xt(t.options),L(2),xe(t.conditions!=null&&t.conditions.length?5:-1)}}function MPt(i,e){if(i&1){let t=Le();$(0,"button",196),Ze("click",function(){let n=P(t).$implicit,r=p();return R(r.useTweakExample(n))}),Mt(1,"nile-glyph",197),$(2,"span"),Y(3),ee()()}if(i&2){let t=e.$implicit;L(3),it(t)}}function nPt(i,e){if(i&1&&($(0,"span",19),Y(1),ee()),i&2){let t=p();L(),it(t.dslChartTypeLabel)}}function rPt(i,e){if(i&1){let t=Le();$(0,"nile-button",13),Ze("click",function(){P(t);let n=p();return R(n.resetDslQuery())}),Mt(1,"nile-glyph",198),Y(2," Reset to saved query "),ee()}if(i&2){let t=p();It("disabled",t.dslApplying?"":null)}}function oPt(i,e){if(i&1){let t=Le();$(0,"div",23),Mt(1,"nile-glyph",199),$(2,"span",200),Y(3),ee(),$(4,"button",201),Ze("click",function(){P(t);let n=p();return R(n.dslError=null)}),Mt(5,"nile-glyph",202),ee()()}if(i&2){let t=p();L(3),it(t.dslError)}}function aPt(i,e){if(i&1){let t=Le();$(0,"section",25)(1,"header",27)(2,"span",28),Y(3,"Query"),ee(),$(4,"span",203)(5,"button",204),Ze("click",function(){P(t);let n=p();return R(n.formatDslQuery())}),Mt(6,"nile-glyph",205),Y(7," Format "),ee(),$(8,"button",206),Ze("click",function(){P(t);let n=p();return R(n.copyDslQuery())}),Mt(9,"nile-glyph",207),Y(10),ee(),$(11,"span",208),Mt(12,"nile-glyph",207),Y(13),ee()()(),$(14,"nile-code-editor",209),Ze("nile-change",function(n){P(t);let r=p();return R(r.onDslTextChange(n.detail.value))}),ee()()}if(i&2){let t=p();L(5),ot("disabled",t.dslApplying),L(4),It("name",t.dslCopied?"ng-check":"ng-copy"),L(),yi(" ",t.dslCopied?"Copied":"Copy"," "),L(),Wt("dsl-validity--ok",t.dslValidity.ok),It("title",t.dslValidity.error),L(),It("name",t.dslValidity.ok?"ng-check":"ng-alert-triangle"),L(),yi(" ",t.dslValidity.ok?"Valid "+t.dslTerm:"Invalid "+t.dslTerm," "),L(),ot("expandable",!1)("value",t.dslQueryText),It("language",t.dslCodeEditorLanguage)("readonly",t.dslApplying?"":null)}}function sPt(i,e){if(i&1&&($(0,"span",30),Y(1),ee()),i&2){let t=p();L(),Jo(" ",t.dslTurns.length," ",t.dslTurns.length===1?"change":"changes"," this session ")}}function lPt(i,e){i&1&&($(0,"p",32),Y(1," Describe a change and the assistant rewrites the query. Nothing is saved until you apply. "),ee())}function gPt(i,e){if(i&1&&($(0,"div",217)(1,"span",218),Y(2),ee(),$(3,"span",219),Y(4),ee()()),i&2){let t=e.$implicit;zG("dsl-diff-line--"+t.kind),L(2),it(t.kind==="add"?"+":t.kind==="remove"?"\u2212":" "),L(2),it(t.text)}}function NPt(i,e){if(i&1&&($(0,"div",212),ht(1,gPt,5,4,"div",216,Mr),ee()),i&2){let t=p(),M=t.$implicit,n=t.$index,r=p();L(),xt(r.dslExpandedTurn===n?M.diff:M.changed)}}function uPt(i,e){if(i&1){let t=Le();$(0,"button",220),Ze("click",function(){P(t);let n=p().$index,r=p();return R(r.toggleDslDiff(n))}),Y(1),ee()}if(i&2){let t=p().$index,M=p();L(),yi(" ",M.dslExpandedTurn===t?"Hide full diff":"View full diff"," ")}}function cPt(i,e){if(i&1){let t=Le();$(0,"button",221),Ze("click",function(){P(t);let n=p().$index,r=p();return R(r.undoDslTurn(n))}),Y(1," Undo this change "),ee()}if(i&2){let t=p().$index,M=p();ot("disabled",M.dslApplying||M.dslGenerating)("title",t===M.dslTurns.length-1?"Restore the query to before this change":"Restore the query to before this change \u2014 later changes are discarded")}}function DPt(i,e){if(i&1&&(Mt(0,"nile-ai-chat-bubble",33),$(1,"nile-ai-chat-bubble",210)(2,"p",211),Y(3),ee(),he(4,NPt,3,0,"div",212),$(5,"nile-ai-message-actions",213),he(6,uPt,2,1,"button",214),he(7,cPt,2,2,"button",215),ee()()),i&2){let t=e.$implicit,M=p();ot("role","user")("message",t.prompt),L(),ot("role","ai")("agent","Query assistant")("icon","ng-code"),L(2),it(t.summary),L(),xe(M.dslDevMode&&t.wasModified&&t.changed.length?4:-1),L(),ot("copy",M.dslDevMode)("copyValue",t.after),L(),xe(M.dslDevMode&&t.wasModified&&t.changed.length?6:-1),L(),xe(t.wasModified?7:-1)}}function IPt(i,e){if(i&1&&Mt(0,"nile-ai-chat-bubble",33),i&2){let t=p();ot("role","user")("message",t.dslPendingPrompt)}}function dPt(i,e){i&1&&Mt(0,"nile-ai-chat-bubble",34),i&2&&ot("role","ai")("agent","Query assistant")("icon","ng-code")("thinking","")("loading",!0)}function jPt(i,e){if(i&1){let t=Le();$(0,"button",231),Ze("click",function(){let n=P(t).$implicit,r=p(2);return R(r.onForecastGranularity(n))}),Y(1),ee()}if(i&2){let t=e.$implicit,M=p(2);Wt("fc-seg__btn--on",M.forecastDraft.granularity===t),L(),it(t)}}function yPt(i,e){if(i&1){let t=Le();$(0,"button",231),Ze("click",function(){let n=P(t).$implicit,r=p(2);return R(r.onForecastConfidence(n))}),Y(1),ee()}if(i&2){let t=e.$implicit,M=p(2);Wt("fc-seg__btn--on",M.forecastDraft.confidence===t),L(),yi("",t,"%")}}function TPt(i,e){if(i&1&&($(0,"span",232),Y(1),$(2,"strong"),Y(3),ee()()),i&2){let t=e.$implicit;L(),it(t.label),L(2),it(t.value)}}function APt(i,e){i&1&&($(0,"span",226),Y(1,"This forecast"),ee(),ht(2,TPt,4,2,"span",232,o_t)),i&2&&(L(2),xt(e))}function zPt(i,e){if(i&1){let t=Le();$(0,"div",222)(1,"label",223),Y(2," Horizon \u2014 "),$(3,"strong"),Y(4),ee(),Y(5),ee(),$(6,"input",224),Ze("input",function(n){P(t);let r=p();return R(r.onForecastHorizon(n.target.value))}),ee(),$(7,"p",225),Y(8),ee(),$(9,"span",226),Y(10,"Granularity"),ee(),$(11,"div",227),ht(12,jPt,2,3,"button",228,Ho),ee(),$(14,"p",225),Y(15,"Coarser buckets are reachable; finer ones are not."),ee(),$(16,"span",226),Y(17,"Confidence interval \u2014 "),$(18,"strong"),Y(19),ee()(),$(20,"div",229),ht(21,yPt,2,3,"button",228,Ho),ee(),$(23,"p",225),Y(24,"A wider band is more likely to contain the real value. 80% is a good default."),ee(),he(25,APt,4,0),ee(),$(26,"div",230)(27,"nile-button",13),Ze("click",function(){P(t);let n=p();return R(n.closeForecastSettings())}),Y(28,"Cancel"),ee(),$(29,"nile-button",14),Ze("click",function(){P(t);let n=p();return R(n.applyForecastSettings())}),Y(30,"Apply"),ee()()}if(i&2){let t,M=p();L(4),it(M.forecastDraft.horizon),L(),Jo(" ",M.forecastPeriodWord,"",M.forecastDraft.horizon===1?"":"s"," "),L(),ot("value",M.forecastDraft.horizon),It("max",M.forecastMaxHorizon),L(2),yi("Capped at ",M.forecastMaxHorizon," for this widget \u2014 half the history the model was fitted on."),L(4),xt(M.forecastGranularities),L(7),yi("",M.forecastDraft.confidence,"%"),L(2),xt(M.forecastConfidences),L(4),xe((t=M.forecastProvenance)?25:-1,t)}}function hPt(i,e){if(i&1){let t=Le();$(0,"shared-widget-detail-panel",233),Ze("closed",function(){P(t);let n=p();return R(n.closeDetailLevel())}),Mt(1,"shared-dashboard-grid",234),sl(2,0,M_t),ee()}if(i&2){let t=p();ot("crumbs",t.detail.breadcrumb())("loading",t.detail.loading())("label",t.detailRootLabel),L(),ot("widgets",t.detail.content())("editMode",!1)("showWidgetMenu",!1)("selectable",!1)("autoHeight",!0)("dashboardId",t.dashboardId)("resolvedFilters",t.resolvedFilters)("detailPanel",t.detailPanel)("detailDepth",t.detailDepth+1)("detailRootLabel",t.detailRootLabel)}}var Gst=2e3,xPt={line:"Line chart",area:"Area chart",bar:"Bar chart",column:"Column chart",pie:"Pie chart",donut:"Donut chart",scatter:"Scatter chart",heatmap:"Heatmap",funnel:"Funnel chart",gauge:"Gauge",radar:"Radar chart",waterfall:"Waterfall chart",kpi:"KPI",table:"Table",grid:"Data grid"},wA=class i{constructor(e,t,M=null,n=null,r=null,o=null,a=null,s=null,l=null,N=null,c=null,D=null,I=null){this.host=e;this.observed=t;this.filterValuesFetcher=M;this.dslEditorFetcher=n;this.recordsFetcher=r;this.chartTypeFetcher=o;this.widgetFilterFetcher=a;this.adhocFilterFetcher=s;this.filterDefaultFetcher=l;this.evidenceProviders=N;this.storiesFetcher=c;this.router=D;this.cdr=I;this.decorated=this.filterValuesFetcher?Jst(this.filterValuesFetcher,this.observed):null}host;observed;filterValuesFetcher;dslEditorFetcher;recordsFetcher;chartTypeFetcher;widgetFilterFetcher;adhocFilterFetcher;filterDefaultFetcher;evidenceProviders;storiesFetcher;router;cdr;widgets=[];editMode=!0;autoHeight=!1;dashboardId=null;conversationId=null;persistToPublished=!1;filtersEnabled=!0;tweakingWidgetId=null;forecastingWidgetId=null;loading=!1;outerMargin=!0;canvasBackgroundColor=null;widgetsLoading=!1;showTweakInViewMode=!1;showEditDslInViewMode=!1;canSetAlert=!1;canAddToStory=!1;canForecast=!1;canAsk=!0;canChangeChartType=!0;canManageFilters=!0;canCustomizeColors=!0;canViewChartData=!0;canExportPng=!0;canExportCsv=!0;canPrint=!0;canTweak=!0;canEdit=!0;canDelete=!0;forecastable={};showWidgetMenu=!0;selectable=!1;detailPanel=!1;detailDepth=0;detailRootLabel="Dashboard";openDetailPanel(e){this.detailPanel&&pPt(e)&&(this.detailDepth>=R3||!this.detail.canOpen()||(this.detail.open(e,{depth:this.detailDepth,dashboardId:this.dashboardId,filters:this.resolvedFilters??[]}),this.pushDetailHistoryEntry()))}detailHistoryEntries=0;suppressPopstate=0;popStateHandler=()=>{if(this.suppressPopstate>0){this.suppressPopstate--;return}this.detailHistoryEntries!==0&&(this.detailHistoryEntries--,this.detail.isOpen()&&(this.detail.back(),this.cdr?.markForCheck()))};pushDetailHistoryEntry(){typeof history>"u"||history.pushState(U(x({},history.state??{}),{dvzDetailLevel:++this.detailHistoryEntries}),"")}spendDetailHistory(e){let t=Math.min(e,this.detailHistoryEntries);t<=0||typeof history>"u"||(this.detailHistoryEntries-=t,this.suppressPopstate+=t,history.go(-t))}closeDetailLevel(e=!1){let t=this.detail.depth();if(t!==0){if(e){this.detail.close(),this.spendDetailHistory(t);return}this.detail.back(),this.spendDetailHistory(1)}}_detail;get detail(){return this._detail??=new P3({rootLabel:()=>this.detailRootLabel,providers:this.evidenceProviders??[]})}selectedWidgetIds=null;dashboardFilters=null;resolvedFilters=null;applySummary=null;filterExplanation=null;timeFilterEnabled=!1;static FILTER_LAYER_INDEX=10;filterHeaderTitle=km;skeletonKpis=[0,1,2,3];skeletonCharts=[0,1,2,3];skeletonBars=[55,80,42,92,65,48,75];remove=new Xt;editWidget=new Xt;openAiBuilder=new Xt;updateLayout=new Xt;aiSend=new Xt;tweakWidget=new Xt;dslWidgetUpdated=new Xt;dslEditorClosed=new Xt;widgetChartTypeChanged=new Xt;widgetFiltersChanged=new Xt;widgetColorChanged=new Xt;filterSubmit=new Xt;filterChange=new Xt;timeRangeApply=new Xt;selectionChange=new Xt;setAlert=new Xt;addToStory=new Xt;widgetClick=new Xt;forecast=new Xt;selectedIds=new Set;tweakTargetId=null;tweakPromptText="";tweakSubmitting=!1;tweakExamples=["Convert this into a bar chart and make the title shorter","Convert this into a column chart and make red color","Convert this into a pie chart and use a blue pallete"];gridsterItems=[];options={gridType:IM.VerticalFixed,displayGrid:qh.OnDragAndResize,compactType:dn.None,pushItems:!0,swap:!1,margin:8,outerMargin:!1,maxLayerIndex:i.FILTER_LAYER_INDEX,minCols:12,maxCols:12,minRows:4,defaultItemCols:6,defaultItemRows:4,fixedRowHeight:72,disableAutoPositionOnConflict:!0,mobileBreakpoint:0,initCallback:(e,t)=>{this.gridApi=t,this.gridInstance=e},draggable:{enabled:!0,ignoreContent:!0,dragHandleClass:"widget-drag-handle",stop:()=>this.scheduleGestureReconcile()},resizable:{enabled:!0,handles:{s:!0,e:!0,n:!0,w:!0,se:!0,ne:!0,sw:!0,nw:!0},stop:()=>this.scheduleGestureReconcile()}};gridApi=null;gridInstance=null;expandedFilterId=ke(null);filterContentHeights=new Map;filterExtraRows=new Map;filterOverflowCounts=ke(new Map);resizeObserver=null;resizeRaf=0;lastGridWidth=0;lastGridHeight=0;ngOnChanges(e){(e.editMode||e.showTweakInViewMode||e.showEditDslInViewMode||e.showWidgetMenu||e.canAddToStory)&&this.menuCache.clear(),e.editMode&&(this.options=U(x({},this.options),{outerMargin:!this.editMode,draggable:U(x({},this.options.draggable),{enabled:this.editMode}),resizable:U(x({},this.options.resizable),{enabled:this.editMode}),displayGrid:this.editMode?qh.OnDragAndResize:qh.None})),e.outerMargin&&(this.options=U(x({},this.options),{outerMargin:this.outerMargin})),e.autoHeight&&(this.options=U(x({},this.options),{setGridSize:this.autoHeight})),e.dashboardId&&(this.observed.clear(),this.observedFields.set([]),this.menuCache.clear(),this.autoAppliedDefaultForDashboardId=null),(e.dashboardFilters&&!e.dashboardFilters.firstChange||e.resolvedFilters&&!e.resolvedFilters.firstChange)&&this.clearEphemeralOverrides(),e.widgets&&(this.observed.publish(Lst(this.widgets)),this.observedFields.set(this.observed.fields()),this.expandedFilterId.set(null),this.filterExtraRows.clear(),this.filterOverflowCounts.set(new Map),this.syncGridsterItems(),this.pruneManualState(),this.pruneEphemeralFilterState(),this.maybeAutoApplyDefaultFilter(),this.selectable?this.syncDefaultSelection():this.resetSelection()),e.selectable&&!this.selectable&&this.resetSelection(),e.selectedWidgetIds&&!e.widgets&&this.selectable&&this.syncDefaultSelection()}reasonText(e){let t=e?.id?this.gridFilterVerdicts.get(e.id):void 0;return t&&!t.applied?Rm({reason:t.reason}):Rm(e)}gridFilterVerdicts=new Map;onGridFilterVerdict(e){if(!e?.widgetId)return;let t=this.gridFilterVerdicts.get(e.widgetId);t&&t.applied===e.applied&&t.reason===e.reason||(this.gridFilterVerdicts.set(e.widgetId,{applied:e.applied,reason:e.reason}),this.cdr?.markForCheck())}showFilterNotice(e){if(!e)return!1;if(e.edited===!1)return!0;let t=e.id?this.gridFilterVerdicts.get(e.id):void 0;return!!t&&!t.applied}static DEFAULT_MANUAL_STATE={mode:"prompt",conditions:[]};static EMPTY_CATALOG=[];static SYNTHETIC_FILTER_KEY="manual-filter";manualFilterStates=ke(new Map);filterCatalogs=ke(new Map);observedFields=ke([]);recentlyUsedFields=ke([]);manualStateFor(e){return this.manualFilterStates().get(e)??i.DEFAULT_MANUAL_STATE}isManualMode(e){return this.manualStateFor(e).mode==="manual"}catalogFor(e){return this.filterCatalogs().get(e)??i.EMPTY_CATALOG}boundValueFetcher=async(e,t)=>{let M=this.dashboardId;if(!this.decorated||!M)return[];let n=(this.resolvedFilters??[]).filter(N=>N.field!==e),r=n.length>0?{resolvedFilters:n}:{};if(!(t??"").trim())return(await this.decorated(M,e,t,n.length>0?r:void 0)).values;let a=await this.decorated(M,e,t,U(x({},r),{matchMode:"substring"}));if(a.values.length>0)return a.values;let s=await this.decorated(M,e,t,U(x({},r),{matchMode:"fuzzy"}));return s.values.length>0?s.values:(await this.decorated(M,e,t,U(x({},r),{matchMode:"semantic"}))).values};valueFetcher(){return this.decorated&&this.dashboardId?this.boundValueFetcher:null}decorated=null;ngAfterViewInit(){if(typeof window<"u"&&window.addEventListener("popstate",this.popStateHandler),typeof ResizeObserver>"u"||typeof window>"u")return;let e=this.host.nativeElement.querySelector(".canvas-wrap")??this.host.nativeElement;this.lastGridWidth=e.clientWidth,this.lastGridHeight=e.clientHeight,this.resizeObserver=new ResizeObserver(()=>{this.resizeRaf&&cancelAnimationFrame(this.resizeRaf),this.resizeRaf=requestAnimationFrame(()=>{let t=e.clientWidth,M=e.clientHeight;t===this.lastGridWidth&&M===this.lastGridHeight||(this.lastGridWidth=t,this.lastGridHeight=M,this.gridApi?.resize(),window.dispatchEvent(new Event("resize")))})}),this.resizeObserver.observe(e)}ngOnDestroy(){this.resizeRaf&&cancelAnimationFrame(this.resizeRaf),this.resizeObserver?.disconnect(),this.resizeObserver=null,typeof window<"u"&&window.removeEventListener("popstate",this.popStateHandler)}setManualState(e,t){this.manualFilterStates.update(M=>new Map(M).set(e,t))}firstFilterWidget(){return this.widgets.find(e=>this.isFilterWidget(e))}autoAppliedDefaultForDashboardId=null;maybeAutoApplyDefaultFilter(){if(this.autoAppliedDefaultForDashboardId===this.dashboardId)return;let e=this.firstFilterWidget(),t=this.filterDefaultControl(e);!e||!t?.autoApply||!t.defaultValue?.trim()||(this.autoAppliedDefaultForDashboardId=this.dashboardId,this.applyExpression(e,t.defaultValue))}filterDefaultControl(e){return e?.config?.chart?.controls?.[0]}filterDefaultBusy=!1;filterDefaultError=null;canToggleFilterDefault(e){return this.isFilterWidget(e)&&!!this.filterDefaultFetcher&&!!this.dashboardId}isFilterDefaultActive(e){return!!this.filterDefaultControl(e)?.autoApply}async toggleFilterDefault(e){if(!this.filterDefaultFetcher||!this.dashboardId||this.filterDefaultBusy)return;let t=this.filterDefaultControl(e),M=!!t?.autoApply,n=M?"":(this.lastAppliedFilter.get(e.id)??t?.value??"").trim();if(!M&&!n){this.filterDefaultError="Apply a filter first, then set it as the default.",this.cdr?.markForCheck();return}this.filterDefaultBusy=!0,this.filterDefaultError=null,this.cdr?.markForCheck();try{let r=await this.filterDefaultFetcher.set(this.dashboardId,e.id,n,!M,this.persistToPublished);this.widgetFiltersChanged.emit(r)}catch(r){this.filterDefaultError=r instanceof Error?r.message:"Could not update the default filter"}finally{this.filterDefaultBusy=!1,this.cdr?.markForCheck()}}hasFilterWidget(){return this.widgets.some(e=>this.isFilterWidget(e))}expressionControlIdOf(e){return e.config?.chart?.controls?.find(n=>(n.variant==="expression"||n.variant==="hybrid")&&n.id)?.id??null}chartWidgetFor(e){return this.chartWidgets?.find(t=>t.widgetId===e)}activeFilterMode(e){return this.manualStateFor(e.id).mode}gridWidgetsCache=null;gridWidgets(){let e=this.railReplacesCard(),t=this.gridWidgetsCache;if(t&&t.src===this.widgets&&t.rail===e)return t.out;let M=e?this.widgets.filter(n=>!this.isFilterWidget(n)):this.widgets;return this.gridWidgetsCache={src:this.widgets,rail:e,out:M},M}railVisible(){return this.hasFilterWidget()||this.timeFilterEnabled}railReplacesCard(){return this.hasFilterWidget()}railShift(){if(!this.railReplacesCard())return null;let e=this.firstFilterWidget();if(!e)return null;let t=this.gridsterItems.find(M=>M.widgetId===e.id)??this.buildItem(e);return{y:Number(t.y??0),rows:Number(t.rows??0)}}railItemsCache=null;railItems(){let e=this.railShift();if(!e)return null;let t=this.railItemsCache;if(t&&t.src===this.widgets&&t.edit===this.editMode)return t.map;let M=new Map;for(let n of this.widgets){if(this.isFilterWidget(n))continue;let r=this.gridsterItems.find(a=>a.widgetId===n.id)??this.buildItem(n),o=Number(r.y??0);M.set(n.id,U(x({},r),{y:o>e.y?Math.max(0,o-e.rows):o}))}return this.railItemsCache={src:this.widgets,edit:this.editMode,map:M},M}railMode(){let e=this.firstFilterWidget();return e?this.manualStateFor(e.id).mode:"prompt"}railConditions(){let e=this.firstFilterWidget();return e?this.manualStateFor(e.id).conditions:[]}railCatalog(){let e=this.firstFilterWidget();return e?this.catalogFor(e.id):[]}railExpression(){let e=this.firstFilterWidget();return e?this.chartWidgetFor(e.id)?.getLiveExpression()?.value??"":""}onRailModeChange(e){let t=this.firstFilterWidget();t&&this.useFilterMode(t,e)}onRailConditions(e){let t=this.firstFilterWidget();t&&this.onManualConditionsChange(t,e)}onRailExpressionRun(e){let t=this.firstFilterWidget();t&&(this.chartWidgetFor(t.id)?.setFilterExpression(e),this.applyExpression(t,e,{mode:"expression"}))}onRailPromptAsk(e){let t=this.firstFilterWidget();t&&this.applyExpression(t,e,{mode:"prompt",prompt:e})}onRailClearAll(){let e=this.firstFilterWidget();e&&(this.setManualState(e.id,U(x({},this.manualStateFor(e.id)),{conditions:[]})),this.chartWidgetFor(e.id)?.setFilterExpression(""),this.applyExpression(e,""))}onRailTimeRange(e){this.timeRangeApply.emit(e)}useFilterMode(e,t){if(this.activeFilterMode(e)===t)return;this.collapseExpandedFilter(),this.filterOverflowCounts.update(o=>{let a=new Map(o);return a.delete(e.id),a});let n=this.chartWidgetFor(e.id),r=this.manualStateFor(e.id);if(t==="manual"){this.setManualState(e.id,{mode:"manual",conditions:[]}),this.requestCatalog(e),this.syncAppliedFilter(e,"");return}if(t==="expression"){n?.setFilterMode("expression",""),this.setManualState(e.id,U(x({},r),{mode:"expression",conditions:[]})),this.requestCatalog(e),this.syncAppliedFilter(e,"");return}n?.setFilterMode("prompt",""),this.setManualState(e.id,U(x({},r),{mode:"prompt",conditions:[]})),this.syncAppliedFilter(e,"")}lastAppliedFilter=new Map;syncAppliedFilter(e,t){let M=(t??"").trim();(this.lastAppliedFilter.get(e.id)??"")!==M&&this.applyExpression(e,M)}onManualConditionsChange(e,t){this.setManualState(e.id,{mode:"manual",conditions:t}),this.trackRecentlyUsed(t),t.length||this.collapseExpandedFilter(),this.applyManualConditions(e)}trackRecentlyUsed(e){let t=e.map(M=>M.field).filter(M=>!!M);t.length&&this.recentlyUsedFields.update(M=>{let n=new Set,r=[];for(let o of[...t,...M])n.has(o)||(n.add(o),r.push(o));return r.slice(0,20)})}applyExpression(e,t,M){let n=this.expressionControlIdOf(e)??i.SYNTHETIC_FILTER_KEY,r=t.trim();this.lastAppliedFilter.set(e.id,r),this.filterSubmit.emit(x(x({widgetId:e.id,filters:r?{[n]:t}:{},errors:{}},M?.mode?{mode:M.mode}:{}),M?.mode==="prompt"&&r?{prompt:t}:{}))}applyManualConditions(e){this.applyExpression(e,YI(this.manualStateFor(e.id).conditions))}addFilterConditions(e){if(!e.length)return;let t=this.firstFilterWidget();if(!t)return;let M=this.manualStateFor(t.id),n=M.conditions;if(M.mode==="prompt")n=_m(this.resolvedFilters??[]);else if(M.mode==="expression"){let r=this.chartWidgetFor(t.id)?.getLiveExpression()?.value??"";if(r.trim()){let o=$B(r);if(o===null){if(Wm(r)){let a=`${r.trim()} and ${YI(e)}`;this.chartWidgetFor(t.id)?.setFilterExpression(a),this.applyExpression(t,a),this.requestCatalog(t);return}console.warn("[dashboard-filter] live expression uses or/not/grouping the apply engine can't combine with a click-added condition; leaving the expression unchanged.");return}n=o}else n=_m(this.resolvedFilters??[])}this.setManualState(t.id,{mode:"manual",conditions:HB(n,e)}),this.applyManualConditions(t),this.requestCatalog(t)}requestCatalog(e){let M=e.config?.chart?.controls?.find(n=>n.id)?.id;M&&this.filterChange.emit({widgetId:e.id,controlId:M,query:""})}pruneManualState(){let e=new Set(this.widgets.map(t=>t.id));this.manualFilterStates.update(t=>new Map([...t].filter(([M])=>e.has(M)))),this.filterCatalogs.update(t=>new Map([...t].filter(([M])=>e.has(M))));for(let t of[...this.lastAppliedFilter.keys()])e.has(t)||this.lastAppliedFilter.delete(t)}isSelected(e){return this.selectedIds.has(e)}toggleSelection(e,t){t?this.selectedIds.add(e):this.selectedIds.delete(e),this.selectionChange.emit([...this.selectedIds])}resetSelection(){this.lastWidgetIdsKey="",this.selectedIds.size!==0&&(this.selectedIds.clear(),queueMicrotask(()=>this.selectionChange.emit([])))}lastWidgetIdsKey="";syncDefaultSelection(){let e=this.widgets.map(r=>r.id),t=e.join("|")+"::"+(this.selectedWidgetIds?this.selectedWidgetIds.join(","):"*");if(t===this.lastWidgetIdsKey)return;this.lastWidgetIdsKey=t;let M=this.selectedWidgetIds,n=M!=null?e.filter(r=>M.includes(r)):e;this.selectedIds=new Set(n),queueMicrotask(()=>this.selectionChange.emit([...this.selectedIds]))}getItemForWidget(e){let t=this.railItems()?.get(e.id);if(t)return t;let M=this.gridsterItems.find(n=>n.widgetId===e.id);return M||this.buildItem(e)}toggleFilterExpand(e){this.expandedFilterId()===e.id?(this.expandedFilterId.set(null),this.filterExtraRows.delete(e.id)):(this.expandedFilterId.set(e.id),this.filterExtraRows.set(e.id,this.computeExtraRows(e))),this.syncGridsterItems()}onFilterContentHeight(e,t){if(this.filterContentHeights.set(e.id,t),this.expandedFilterId()!==e.id)return;let M=this.computeExtraRows(e);M!==(this.filterExtraRows.get(e.id)??0)&&(this.filterExtraRows.set(e.id,M),this.syncGridsterItems())}onFilterOverflow(e,t){this.filterOverflowCounts.update(M=>new Map(M).set(e.id,t))}filterOverflowFor(e){return this.filterOverflowCounts().get(e)??0}computeExtraRows(e){let t=this.filterContentHeights.get(e.id)??0,M=this.gridInstance?.curRowHeight??0;if(M<=0||t<=0)return 3;let r=Math.max(0,t-76);return Math.ceil(r/M)}expandedExtraRowsFor(e){return this.expandedFilterId()===e?this.filterExtraRows.get(e)??0:0}collapseExpandedFilter(){this.expandedFilterId()!==null&&(this.expandedFilterId.set(null),this.filterExtraRows.clear(),this.syncGridsterItems())}isKpi(e){return e.widgetType==="kpi"?!0:e.config?.chart?.type==="kpi"}isFilterWidget(e){return e.config?.chart?.type==="filter"}showSetAlertFor(e){return this.canSetAlert&&this.showWidgetMenu}showAddToStoryFor(e){return this.canAddToStory&&this.showWidgetMenu&&!!this.storiesFetcher&&!this.isFilterWidget(e)}hasForecast(e){return!!e?.config?.forecast?.enabled}showForecastFor(e){return!this.canForecast||!this.showWidgetMenu?!1:this.hasForecast(e)||!!this.forecastable[e.id]?.forecastable}isDslEditableWidget(e){let t=e.queryMeta?.adapterType;if(!t||!["opensearch","postgres","mssql"].includes(t))return!1;if(this.dashboardId)return!0;let M=e.queryMeta;return!!(M?.sql||M?.dsl)}widgetViewMode=ke(new Map);widgetRecords=ke(new Map);widgetRecordsLoading=ke(new Set);dataViewFilters=ke(new Map);confirmedDataViewFilters=ke(new Map);viewModeFor(e){return this.widgetViewMode().get(e.id)??"chart"}onDataViewFilterChange(e,t){let M=new Map(this.dataViewFilters());if(t?.length?M.set(e,t):M.delete(e),this.dataViewFilters.set(M),!t?.length&&this.confirmedDataViewFilters().has(e)){let n=new Map(this.confirmedDataViewFilters());n.delete(e),this.confirmedDataViewFilters.set(n)}}hasPendingDataViewFilter(e){return(this.dataViewFilters().get(e.id)?.length??0)>0}applyDataViewFilter(e){let t=this.dataViewFilters().get(e.id),M=new Map(this.confirmedDataViewFilters());if(t?.length?M.set(e.id,t):M.delete(e.id),this.confirmedDataViewFilters.set(M),this.widgetRecords().has(e.id)){let n=new Map(this.widgetRecords());n.delete(e.id),this.widgetRecords.set(n)}this.viewRecords(e)}widgetDataRows(e){return Gc(e.config?.chart)}recordsChartFor(e){return this.widgetRecords().get(e.id)??null}isRecordsLoading(e){return this.widgetRecordsLoading().has(e.id)}displayConfigFor(e){let t=this.viewModeFor(e);if(t==="data")return U(x({},e.config),{chart:this.buildDataViewChart(e)});if(t==="records"){let o=this.recordsChartFor(e);if(o)return o.config}let M=this.ephemeralKey(e),n=this.ephemeralFilterResult.get(M);return n?n?.config??e.config:this.ephemeralChartOverride.get(M)?.config??e.config}ephemeralKey(e){return`${e.id}::${e.title??""}`}ephemeralChartOverride=new Map;ephemeralFilters=new Map;ephemeralFilterSeq=0;ephemeralFilterFieldsCache=new Map;filterValuesCache=new Map;ephemeralFilterBaseConfig=new Map;ephemeralFilterResult=new Map;clearEphemeralOverrides(){!this.ephemeralChartOverride.size&&!this.ephemeralFilterResult.size&&!this.ephemeralFilters.size||(this.ephemeralChartOverride.clear(),this.ephemeralFilters.clear(),this.ephemeralFilterBaseConfig.clear(),this.ephemeralFilterResult.clear(),this.cdr?.markForCheck())}pruneEphemeralFilterState(){let e=new Set(this.widgets.map(M=>this.ephemeralKey(M))),t=M=>{for(let n of e)if(M===n||M.startsWith(`${n}::`))return!0;return!1};for(let M of[this.ephemeralChartOverride,this.ephemeralFilters,this.ephemeralFilterFieldsCache,this.ephemeralFilterBaseConfig,this.ephemeralFilterResult])for(let n of M.keys())e.has(n)||M.delete(n);for(let M of this.filterValuesCache.keys())t(M)||this.filterValuesCache.delete(M)}buildDataViewChart(e){let{columns:t,rows:M}=this.widgetDataRows(e);if(!(e.config?.chart?.type==="kpi"))return{type:"grid",data:M,columns:t.map(s=>({id:s,header:s,accessorKey:s,enableSorting:!0}))};let r=M[0]?.[t[0]]??null,o=i0(e);return{type:"grid",data:[{field:"Value",text:r,emphasize:!0},...o.map(s=>({field:s.label,text:s.text}))],columns:[{id:"field",header:"Field",accessorKey:"field",enableSorting:!1,width:"140px",cell:s=>j`<strong>${s.value}</strong>`},{id:"text",header:"Value",accessorKey:"text",enableSorting:!1,cell:s=>{let N=s.row.emphasize?"display:block;overflow-x:auto;white-space:nowrap;font-size:22px;font-weight:700;":"display:block;overflow-x:auto;white-space:nowrap;";return j`<span style=${N}>${s.value}</span>`}}]}}hasQueryableData(e){if(!this.recordsFetcher)return!1;let t=!!e.queryMeta?.sql,M=e.config?.chart?.type==="grid";return t&&!M}setWidgetViewMode(e,t){let M=new Map(this.widgetViewMode());t==="chart"?M.delete(e):M.set(e,t),this.widgetViewMode.set(M)}async viewRecords(e){if(this.setWidgetViewMode(e.id,"records"),!this.recordsFetcher||this.widgetRecords().has(e.id))return;let t=new Set(this.widgetRecordsLoading());t.add(e.id),this.widgetRecordsLoading.set(t);try{let M=this.confirmedDataViewFilters().get(e.id),n=M?.length?M.map(a=>({field:a.id,operation:"contains",value:a.value})):void 0,r=await this.recordsFetcher.fetch(e,n),o=new Map(this.widgetRecords());o.set(e.id,r.empty?null:r.chart),this.widgetRecords.set(o)}catch{let M=new Map(this.widgetRecords());M.set(e.id,null),this.widgetRecords.set(M)}finally{let M=new Set(this.widgetRecordsLoading());M.delete(e.id),this.widgetRecordsLoading.set(M),this.cdr?.markForCheck()}}menuCache=new Map;disabledMenu={enabled:!1,items:[]};menuFor(e){if(!this.showWidgetMenu)return this.disabledMenu;let t=this.isKpi(e),M=this.isFilterWidget(e),n=this.isDslEditableWidget(e),r=n?this.dslMenuLabelFor(e):null,o=this.showSetAlertFor(e),a=this.viewModeFor(e),s=this.hasQueryableData(e),l=M&&!!this.filterDefaultControl(e)?.autoApply,N=this.showForecastFor(e),c=this.hasForecast(e),D=`${this.canAsk}:${this.canChangeChartType}:${this.canManageFilters}:${this.canCustomizeColors}:${this.canViewChartData}:${this.canExportPng}:${this.canExportCsv}:${this.canPrint}:${this.canTweak}:${this.canEdit}:${this.canDelete}`,I=`${t}:${o}:${M}:${n}:${r}:${a}:${s}:${l}:${N}:${c}:${D}:${this.detailPanel}`,d=this.menuCache.get(I);if(d)return d;let y=[],A,z=O=>{if(!M){if(this.detailPanel){y.push({type:"custom",label:"Details",id:"viewDetailPanel",glyph:"ng-layers-three-01",divider:O});return}this.canViewChartData&&(a==="chart"?y.push({type:"custom",label:"Chart Data",id:"viewData",glyph:"ng-table",divider:O}):(y.push({type:"custom",label:"View Chart",id:"viewChart",glyph:"ng-chart-bar",divider:O}),s&&a!=="records"&&y.push({type:"custom",label:"View Records",id:"viewRecords",glyph:"ng-database"})))}},E=O=>{M||(this.canShowChartTypePicker(e)&&(y.push({type:"custom",label:"Change chart type",id:"changeChartType",glyph:"ng-chart-bar",divider:O}),O=!1),this.canShowFilterPicker(e)&&(y.push({type:"custom",label:"Apply filter",id:"manageFilters",glyph:"ng-filter-lines",divider:O}),O=!1),this.canShowColorPicker(e)&&y.push({type:"custom",label:"Customize colors",id:"customizeColors",glyph:"ng-palette",divider:O}))},S=O=>{!M||!this.filterDefaultFetcher||!this.dashboardId||y.push({type:"custom",label:l?"Clear default filter":"Set current filter as default",id:"toggleFilterDefault",glyph:l?"ng-x-close":"ng-check",divider:O})};return this.editMode?(this.canTweak&&y.push({type:"custom",label:"Tweak",id:"tweak",glyph:"ng-wand-sparkles"}),this.canEdit&&y.push({type:"custom",label:"Edit",id:"edit",glyph:"ng-edit-02"}),E(!1),S(!1),!M&&r&&y.push({type:"custom",label:r,id:"editDsl",glyph:"ng-code"}),z(!1),this.canDelete&&y.push({type:"custom",label:"Delete",id:"delete",glyph:"ng-trash-01"}),o&&y.push({type:"custom",label:"Set Alert",id:"setAlert",glyph:"ng-bell-01",divider:!0}),N&&y.push({type:"custom",label:c?"Remove forecast":"Forecast",id:"forecast",glyph:c?"ng-trending-down":"ng-trend-up-01"}),N&&c&&y.push({type:"custom",label:"Forecast settings\u2026",id:"forecastSettings",glyph:"ng-sliders-horizontal"}),t||(this.canExportPng&&y.push({type:"default",label:"Export PNG",downloadPng:!0,glyph:"ng-image-03",divider:!0}),this.canExportCsv&&y.push({type:"default",label:"Export CSV",downloadCsv:!0,glyph:"ng-file-06",divider:!this.canExportPng}),this.canPrint&&y.push({type:"default",label:"Print",print:!0,glyph:"ng-printer"})),A={enabled:!0,items:y}):(this.showTweakInViewMode&&this.canTweak&&y.push({type:"custom",label:"Tweak",id:"tweak",glyph:"ng-wand-sparkles"}),E(y.length>0),S(y.length>0),this.showEditDslInViewMode&&!M&&r&&y.push({type:"custom",label:r,id:"editDsl",glyph:"ng-code"}),z(y.length>0),o&&y.push({type:"custom",label:"Set Alert",id:"setAlert",glyph:"ng-bell-01",divider:y.length>0}),N&&y.push({type:"custom",label:c?"Remove forecast":"Forecast",id:"forecast",glyph:c?"ng-trending-down":"ng-trend-up-01"}),N&&c&&y.push({type:"custom",label:"Forecast settings\u2026",id:"forecastSettings",glyph:"ng-sliders-horizontal"}),t||(this.canExportPng&&y.push({type:"default",label:"Export PNG",downloadPng:!0,glyph:"ng-image-03",divider:y.length>0}),this.canExportCsv&&y.push({type:"default",label:"Export CSV",downloadCsv:!0,glyph:"ng-file-06",divider:!this.canExportPng&&y.length>0}),this.canPrint&&y.push({type:"default",label:"Print",print:!0,glyph:"ng-printer"})),A={enabled:y.length>0,items:y}),this.menuCache.set(I,A),A}onMenuAction(e,t){switch(t){case"ask":this.chartWidgets?.find(M=>M.widgetId===e.id)?.openAiChat();break;case"tweak":this.openTweak(e.id);break;case"edit":this.editWidget.emit(e.id);break;case"editDsl":this.openDslEditor(e.id);break;case"changeChartType":this.toggleChartTypePicker(e.id);break;case"manageFilters":this.toggleFilterPicker(e.id);break;case"customizeColors":this.toggleColorPicker(e.id);break;case"toggleFilterDefault":this.toggleFilterDefault(e);break;case"viewDetailPanel":this.openDetailPanel(e);break;case"viewData":this.setWidgetViewMode(e.id,"data");break;case"viewChart":this.setWidgetViewMode(e.id,"chart");break;case"viewRecords":this.viewRecords(e);break;case"delete":this.remove.emit(e.id);break;case"setAlert":this.setAlert.emit(e);break;case"addToStory":this.addToStory.emit(e);break;case"forecast":this.forecast.emit({widget:e,enable:!this.hasForecast(e)});break;case"forecastSettings":this.openForecastSettings(e.id);break}}drillContextMenu=null;static WIDGET_BODY_INERT_CLICK='button, a, input, select, textarea, nile-checkbox, nile-dropdown, .widget-drag-handle, [role="button"], .highcharts-point, .highcharts-data-label, .highcharts-tooltip, .highcharts-legend-item, td, th, tr';onWidgetBodyClick(e,t){for(let M of t.composedPath())if(M instanceof Element){if(M.matches(i.WIDGET_BODY_INERT_CLICK))return;if(M.classList.contains("widget-body"))break}this.widgetClick.emit(e)}onChartClick(e,t){let M=this.hasFilterWidget()?XB({pointName:t.pointName,pointY:t.pointY,seriesName:t.seriesName},e.queryMeta):[],n=this.resolveDrillOptions(e,t);if(n.length===0){!e.drilldownBy?.length&&M.length&&this.addFilterConditions(M);return}if(M.length===0){if(n.length===1){this.drillIntoOption(e.id,t.point,n[0]);return}this.drillContextMenu={widgetId:e.id,x:t.x,y:t.y,options:n,point:t.point,conditions:null};return}this.drillContextMenu={widgetId:e.id,x:t.x,y:t.y,options:n,point:t.point,conditions:M}}resolveDrillOptions(e,t){if(!e.drilldownBy?.length)return[];let n=e.config.chart?.data?.find(r=>r.name===t.pointName)?.drilldown;return n?e.drilldownBy.flatMap(r=>(r.series??[]).filter(o=>o.id===n)):[]}pickDrillOption(e){let t=this.drillContextMenu;t&&(this.drillIntoOption(t.widgetId,t.point,e),this.drillContextMenu=null)}pickAddAsFilter(){let e=this.drillContextMenu;this.drillContextMenu=null,e?.conditions?.length&&this.addFilterConditions(e.conditions)}closeDrillContextMenu(){this.drillContextMenu=null}drillIntoOption(e,t,M){this.chartWidgets?.find(n=>n.widgetId===e)?.drillIntoSeries(t,{id:M.id,name:M.drillDownName,data:M.data,type:M.type})}onAiSend(e){this.aiSend.emit(e)}onCellFilter(e,t){this.addFilterConditions([{field:t.field,op:"==",value:t.value}])}onChartSelection(e,t){let M=this.firstFilterWidget();if(!M)return;let n=this.timeWindowField(e);if(!n){console.warn("[dashboard-filter] zoom ignored: no date field resolvable for widget",e.id,e.title);return}let r={field:n,op:"between",value:[new Date(t.min).toISOString(),new Date(t.max).toISOString()]},a=[..._m(this.resolvedFilters??[]).filter(l=>l.field!==n),r],s=YI(a);this.setManualState(M.id,{mode:"manual",conditions:a}),this.chartWidgetFor(M.id)?.setFilterExpression(s),this.applyExpression(M,s),this.requestCatalog(M)}onChartSelectionReset(e){let t=this.firstFilterWidget();if(!t)return;let M=this.manualStateFor(t.id),n=M.mode==="manual"&&M.conditions.length?M.conditions:_m(this.resolvedFilters??[]),r=this.timeWindowField(e),o=r?n.filter(a=>a.field!==r):[];o.length!==n.length&&(this.setManualState(t.id,{mode:"manual",conditions:o}),this.chartWidgetFor(t.id)?.setFilterExpression(YI(o)),this.applyManualConditions(t),o.length||this.collapseExpandedFilter())}timeWindowField(e){return this.dateHistogramField(e)??pst(e.queryMeta)??this.catalogDateField(e)}catalogDateField(e){return this.ephemeralFilterFieldsCache.get(this.ephemeralKey(e))?.find(M=>M.type==="date")?.name??null}dateHistogramField(e){let t=null,M=n=>{if(!(t||!n||typeof n!="object")){if(Array.isArray(n)){n.forEach(M);return}for(let[r,o]of Object.entries(n)){if((r==="date_histogram"||r==="auto_date_histogram")&&o&&typeof o=="object"&&typeof o.field=="string"){t=o.field;return}M(o)}}};return M(e.queryMeta?.dsl),t}onFilterSubmit(e){if(e.widgetId){let t=Object.values(e.filters??{}),M=t.length===1&&typeof t[0]=="string"?t[0]:null;this.lastAppliedFilter.set(e.widgetId,t.length===0?"":(M??JSON.stringify(e.filters)).trim())}this.filterSubmit.emit(e)}onFilterChange(e){this.filterChange.emit(e)}chartWidgets;patchFilterSuggestions(e,t,M){this.observedFields.set(this.observed.fields()),this.filterCatalogs.update(r=>new Map(r).set(e,[...M])),this.chartWidgets?.find(r=>r.widgetId===e)?.patchControlSuggestions(t,this.rankCatalogForExpression(M))}rankCatalogForExpression(e){let t=e.filter(r=>r.type==="attribute"&&m3(r)),M=e.filter(r=>r.type!=="attribute");return[...E3(t,{onDashboard:this.observedFields(),recentlyUsed:this.recentlyUsedFields()}),...M]}openTweak(e){this.tweakTargetId=e,this.tweakPromptText="",this.tweakSubmitting=!1}useTweakExample(e){this.tweakPromptText=e}closeTweak(){this.tweakTargetId=null,this.tweakPromptText="",this.tweakSubmitting=!1}submitTweak(){let e=this.tweakTargetId,t=this.tweakPromptText.trim();!e||!t||this.tweakSubmitting||(this.tweakSubmitting=!0,this.tweakWidget.emit({widgetId:e,prompt:t}),this.closeTweak())}canShowChartTypePicker(e){return!this.canChangeChartType||!this.showWidgetMenu||this.isFilterWidget(e)?!1:!!this.chartTypeFetcher?.changeAdhoc}canShowColorPicker(e){return!this.canCustomizeColors||!this.showWidgetMenu||this.isFilterWidget(e)?!1:Rst(this.displayConfigFor(e))}canShowFilterPicker(e){return!this.canManageFilters||!this.showWidgetMenu||this.isFilterWidget(e)?!1:this.dashboardId?!!this.widgetFilterFetcher:!!this.adhocFilterFetcher}toggleChartTypePicker(e){if(this.chartTypePickerWidgetId===e){this.closeChartTypePicker();return}this.openChartTypePicker(e)}menuItemsFor(e){return(this.menuFor(e).items??[]).map(t=>{if(t.type==="custom")return{key:t.id,label:t.label,glyph:t.glyph,divider:t.divider,method:t.method,color:t.color,kind:"custom"};let M=t.downloadPng?"exportPng":t.downloadCsv?"exportCsv":"print";return{key:M,label:t.label??M,glyph:t.glyph,divider:t.divider,kind:M}})}chartMenuFor(e){return this.chartMenuDisabled}chartMenuDisabled={enabled:!1};nileChartElFor(e){return this.chartWidgets?.find(M=>M.widgetId===e)?.chartRef?.nativeElement??null}async runChartAction(e,t){let M=this.nileChartElFor(e.id);try{t==="exportPng"?await M?.exportChart?.("image/png"):t==="exportCsv"?await M?.downloadCsv?.():await M?.printChart?.()}catch{}}menuOpenWidgetId=null;hasOpenOverlay(e){return this.menuOpenWidgetId===e||this.chartTypePickerWidgetId===e||this.filterBuilderWidgetId===e||this.ephemeralFilterBuilderWidgetId===e||this.storyPickerWidgetId===e}closeWidgetMenu(e){if(!e?.hide)return;let t=()=>{e.hide?.()};typeof requestAnimationFrame=="function"?requestAnimationFrame(t):t()}onOwnMenuItem(e,t,M){this.closeWidgetMenu(M),t.kind==="custom"?this.onMenuAction(e,t.key):this.runChartAction(e,t.kind)}static gridInstanceSeq=0;kebabScope=`dg${++i.gridInstanceSeq}`;widgetMenuEpoch=new Map;widgetMenuEpochArr=new Map;widgetMenuEpochFor(e){let t=this.widgetMenuEpoch.get(e)??0,M=this.widgetMenuEpochArr.get(e);if(M&&M[0]===t)return M;let n=[t];return this.widgetMenuEpochArr.set(e,n),n}onWidgetRemounted(e){this.menuOpenWidgetId===e&&(this.menuOpenWidgetId=null),this.widgetMenuEpoch.set(e,(this.widgetMenuEpoch.get(e)??0)+1),this.cdr?.markForCheck()}kebabIdFor(e,t="chart"){return`${this.kebabScope}-${t}-kebab-${e}`}drillAnchorId=`${this.kebabScope}-drill-anchor`;widgetMenuGroupCache=new Map;widgetMenuGroupsFor(e){let t=this.menuFor(e).items,M=this.widgetMenuGroupCache.get(e.id);if(M&&M.src===t)return M.groups;let n=_st(this.menuItemsFor(e));return this.widgetMenuGroupCache.set(e.id,{src:t,groups:n}),n}kebabToggleGuard=null;acceptKebabPress(e){let t=this.kebabToggleGuard;return this.kebabToggleGuard=null,!(t&&t.id===e&&Date.now()-t.at<350)}stampKebabClose(e,t){let M=t.detail?.reason;this.kebabToggleGuard=M==="outside-click"?{id:e,at:Date.now()}:null}openWidgetKebab(e){this.acceptKebabPress(this.kebabIdFor(e.id))&&(this.menuOpenWidgetId=e.id,this.cdr?.markForCheck())}onWidgetKebabChange(e,t){let M=t.detail?.type;if(M==="open"){this.menuOpenWidgetId=e.id,this.cdr?.markForCheck();return}M!=="close"||this.menuOpenWidgetId!==e.id||(this.menuOpenWidgetId=null,this.stampKebabClose(this.kebabIdFor(e.id),t),this.storyPickerWidgetId===e.id&&!this.storyCommitting&&this.closeStoryPicker(),this.cdr?.markForCheck())}filterKebabWidgetId=null;openFilterKebab(e){this.acceptKebabPress(this.kebabIdFor(e.id,"filter"))&&(this.filterKebabWidgetId=e.id,this.cdr?.markForCheck())}onFilterKebabChange(e,t){let M=t.detail?.type;if(M==="open"){this.filterKebabWidgetId=e.id,this.cdr?.markForCheck();return}M!=="close"||this.filterKebabWidgetId!==e.id||(this.filterKebabWidgetId=null,this.stampKebabClose(this.kebabIdFor(e.id,"filter"),t),this.cdr?.markForCheck())}onDrillMenuChange(e){e.detail?.type==="close"&&(this.closeDrillContextMenu(),this.cdr?.markForCheck())}storyPickerWidgetId=null;storyOptions=[];storyLoading=!1;storySkeletons=Array.from({length:3});storyCommitting=null;storyPickerSeq=0;loadStoriesFor(e){this.storyPickerWidgetId!==e&&this.openStoryPicker(e)}async openStoryPicker(e){this.storyPickerWidgetId=e,this.storyOptions=[],this.storyLoading=!0;let t=++this.storyPickerSeq;this.cdr?.markForCheck();try{let M=await this.storiesFetcher?.listStories()??[];if(t!==this.storyPickerSeq)return;this.storyOptions=M}catch{t===this.storyPickerSeq&&(this.storyOptions=[])}finally{t===this.storyPickerSeq&&(this.storyLoading=!1,this.cdr?.markForCheck())}}closeStoryPicker(){this.storyPickerWidgetId=null,this.storyOptions=[],this.storyLoading=!1,this.storyCommitting=null,this.cdr?.markForCheck()}async chooseStory(e){let t=this.widgets.find(M=>M.id===this.storyPickerWidgetId);if(!(!this.storiesFetcher||!t||this.storyCommitting)){this.storyCommitting=e??"new",this.cdr?.markForCheck();try{let M=e??(await this.storiesFetcher.createStory(t.title??"")).id;if(!M)throw new Error("no story id");gF({storyId:M,widget:t,source:{kind:"dashboard",label:t.title??"Widget"}}),this.closeStoryPicker(),await this.router?.navigate(["/stories",M],{queryParams:{mode:"edit"}})}catch{this.storyCommitting=null,this.cdr?.markForCheck()}}}toggleFilterPicker(e){if(this.dashboardId){if(this.filterBuilderWidgetId===e){this.closeFilterBuilder();return}this.openFilterBuilder(e)}else{if(this.ephemeralFilterBuilderWidgetId===e){this.closeEphemeralFilterBuilder();return}this.openEphemeralFilterBuilder(e)}}chartTypePickerWidgetId=null;chartTypeOptions=[];chartTypeLoading=!1;chartTypeApplying=!1;chartTypeError=null;chartTypePickerSeq=0;chartTypeCurrentComponent=null;chartTypeIcon(e){return Z3(e)}sensibleChartTypes(){return this.chartTypeOptions.filter(e=>e.sensible)}otherChartTypes(){return this.chartTypeOptions.filter(e=>!e.sensible)}async openChartTypePicker(e){let t=this.widgets.find(n=>n.id===e);if(!t||!this.chartTypeFetcher)return;let M=++this.chartTypePickerSeq;this.chartTypePickerWidgetId=e,this.chartTypeOptions=[],this.chartTypeError=null,this.chartTypeCurrentComponent=this.ephemeralChartOverride.get(this.ephemeralKey(t))?.componentName||t.componentName||null,this.chartTypeLoading=!0,this.cdr?.markForCheck();try{let n=await this.chartTypeFetcher.list(t);if(M!==this.chartTypePickerSeq)return;this.chartTypeOptions=n}catch(n){if(M!==this.chartTypePickerSeq)return;this.chartTypeError=n instanceof Error?n.message:"Could not load chart types"}finally{M===this.chartTypePickerSeq&&(this.chartTypeLoading=!1),this.cdr?.markForCheck()}}closeChartTypePicker(){this.chartTypePickerWidgetId=null,this.chartTypeCurrentComponent=null,this.chartTypeOptions=[],this.chartTypeLoading=!1,this.chartTypeApplying=!1,this.chartTypeApplyingComponent=null,this.chartTypeError=null}colorPickerWidgetId=null;colorPickerSeries(){let e=this.colorPickerWidgetId?this.widgets.find(t=>t.id===this.colorPickerWidgetId):null;return e?Pst(this.displayConfigFor(e))??[]:[]}toggleColorPicker(e){if(this.colorPickerWidgetId===e){this.closeColorPicker();return}this.colorPickerWidgetId=e}closeColorPicker(){this.colorPickerWidgetId=null}selectSeriesColor(e,t){let M=this.colorPickerWidgetId,n=M?this.widgets.find(s=>s.id===M):null;if(!n)return;let r=this.ephemeralKey(n),o=this.displayConfigFor(n),a=Vst(o,e,t);this.ephemeralChartOverride.set(r,{componentName:n.componentName??"",config:a}),this.cdr?.markForCheck(),this.widgetColorChanged.emit(U(x({},n),{config:a}))}chartTypeApplyingComponent=null;async selectChartType(e){let t=this.chartTypePickerWidgetId,M=t?this.widgets.find(r=>r.id===t):null,n=this.chartTypeFetcher?.changeAdhoc;if(!(!M||!n||this.chartTypeApplying)){this.chartTypeApplying=!0,this.chartTypeApplyingComponent=e,this.chartTypeError=null;try{let r=this.ephemeralKey(M),o=await n(M,e);this.ephemeralChartOverride.set(r,{componentName:o.componentName??e,config:o.config}),this.ephemeralFilters.delete(r),this.ephemeralFilterFieldsCache.delete(r),this.ephemeralFilterBaseConfig.delete(r),this.ephemeralFilterResult.delete(r),this.closeChartTypePicker()}catch(r){this.chartTypeError=r instanceof Error?r.message:"Chart type change failed"}finally{this.chartTypeApplying=!1,this.chartTypeApplyingComponent=null,this.cdr?.markForCheck()}}}filterBuilderWidgetId=null;filterBuilderField="";filterBuilderOperation="";filterBuilderValue="";filterBuilderValue2="";filterBuilderValues=[];filterBuilderApplying=!1;filterBuilderRemovingId=null;filterBuilderError=null;filterBuilderWidget(){let e=this.filterBuilderWidgetId;return e?this.widgets.find(t=>t.id===e)??null:null}filterBuilderFields(){let e=this.filterBuilderWidget();return e?this.ephemeralFilterFieldsCache.get(this.ephemeralKey(e))??[]:[]}filterBuilderSelectedField(){return this.filterBuilderFields().find(e=>e.name===this.filterBuilderField)}filterBuilderOperators(){let e=this.filterBuilderSelectedField();return e?Jc(e.type):[]}filterBuilderSelectedOperator(){return this.filterBuilderOperators().find(e=>e.value===this.filterBuilderOperation)}filterBuilderActiveFilters(){let t=this.filterBuilderWidget()?.config?._meta?.filters;return Array.isArray(t)?t:[]}resetFilterBuilderValues(){this.filterBuilderValue="",this.filterBuilderValue2="",this.filterBuilderValues=[]}async openFilterBuilder(e){this.filterBuilderWidgetId=e,this.resetFilterBuilderValues(),this.filterBuilderError=null,this.ephemeralFilterFieldsError=null,this.filterBuilderApplying=!1,this.filterBuilderRemovingId=null;let t=this.widgets.find(r=>r.id===e)??null,M=t?this.ephemeralKey(t):null;if(t&&M&&!this.ephemeralFilterFieldsCache.has(M)&&this.adhocFilterFetcher){this.ephemeralFilterFieldsLoading=!0,this.cdr?.markForCheck();try{let r=await this.adhocFilterFetcher.listFields([t]);this.ephemeralFilterFieldsCache.set(M,r)}catch(r){this.ephemeralFilterFieldsError=r instanceof Error?r.message:"Could not load filter fields"}finally{this.ephemeralFilterFieldsLoading=!1,this.cdr?.markForCheck()}}let n=this.filterBuilderFields()[0];this.filterBuilderField=n?.name??"",this.filterBuilderOperation=n?Jc(n.type)[0].value:"",t&&n&&this.ensureFilterValuesLoaded(t,n),this.cdr?.markForCheck()}closeFilterBuilder(){this.filterBuilderWidgetId=null,this.filterBuilderField="",this.filterBuilderOperation="",this.resetFilterBuilderValues(),this.filterBuilderError=null,this.filterBuilderApplying=!1,this.filterBuilderRemovingId=null}onFilterBuilderFieldChange(e){this.filterBuilderField=e;let t=this.filterBuilderFields().find(n=>n.name===e);this.filterBuilderOperation=t?Jc(t.type)[0].value:"",this.resetFilterBuilderValues();let M=this.filterBuilderWidget();M&&t&&this.ensureFilterValuesLoaded(M,t)}onFilterBuilderOperatorChange(e){this.filterBuilderOperation=e,this.resetFilterBuilderValues()}toggleFilterBuilderMultiValue(e){let t=this.filterBuilderValues.indexOf(e);t>=0?this.filterBuilderValues.splice(t,1):this.filterBuilderValues.push(e)}async submitFilterBuilder(){let e=this.filterBuilderWidget(),t=this.filterBuilderField,M=this.filterBuilderOperation;if(!e||!this.widgetFilterFetcher||!this.dashboardId||!t||!M||this.filterBuilderApplying)return;let n=this.filterBuilderOperators().find(o=>o.value===M);if(!n)return;let r;if(n.valueKind==="none")r={id:"",fieldId:t,operator:M};else if(n.valueKind==="multi-select"){if(this.filterBuilderValues.length===0)return;r={id:"",fieldId:t,operator:M,values:[...this.filterBuilderValues]}}else{let o=this.filterBuilderValue.trim();if(!o)return;let a=n.needsSecondValue?this.filterBuilderValue2.trim():void 0;if(n.needsSecondValue&&!a)return;r={id:"",fieldId:t,operator:M,value:o,value2:a}}this.filterBuilderApplying=!0,this.filterBuilderError=null;try{let o=await this.widgetFilterFetcher.add(this.dashboardId,e.id,$m(r),this.persistToPublished);this.widgetFiltersChanged.emit(o),this.resetFilterBuilderValues()}catch(o){this.filterBuilderError=o instanceof Error?o.message:"Filter could not be applied"}finally{this.filterBuilderApplying=!1,this.cdr?.markForCheck()}}async removeFilterFromBuilder(e){let t=this.filterBuilderWidgetId,M=t?this.widgets.find(n=>n.id===t):null;if(!(!M||!this.widgetFilterFetcher||!this.dashboardId||this.filterBuilderRemovingId)){this.filterBuilderRemovingId=e,this.filterBuilderError=null;try{let n=await this.widgetFilterFetcher.remove(this.dashboardId,M.id,e,this.persistToPublished);this.widgetFiltersChanged.emit(n)}catch(n){this.filterBuilderError=n instanceof Error?n.message:"Filter could not be removed"}finally{this.filterBuilderRemovingId=null,this.cdr?.markForCheck()}}}ephemeralFilterBuilderWidgetId=null;ephemeralFilterBuilderFieldId=null;ephemeralFilterBuilderOperator=null;ephemeralFilterBuilderValue="";ephemeralFilterBuilderValue2="";ephemeralFilterBuilderValues=[];ephemeralFilterFieldsLoading=!1;ephemeralFilterFieldsError=null;ephemeralFilterValuesLoading=!1;ephemeralFilterApplying=!1;ephemeralFilterApplyError=null;toggleEphemeralFilterMultiValue(e){let t=this.ephemeralFilterBuilderValues.indexOf(e);t>=0?this.ephemeralFilterBuilderValues.splice(t,1):this.ephemeralFilterBuilderValues.push(e)}ephemeralFilterWidget(){let e=this.ephemeralFilterBuilderWidgetId;return e?this.widgets.find(t=>t.id===e)??null:null}async openEphemeralFilterBuilder(e){this.ephemeralFilterBuilderWidgetId=e,this.ephemeralFilterApplyError=null,this.ephemeralFilterFieldsError=null;let t=this.ephemeralFilterWidget(),M=t?this.ephemeralKey(t):null;if(t&&M&&!this.ephemeralFilterFieldsCache.has(M)&&this.adhocFilterFetcher){this.ephemeralFilterFieldsLoading=!0,this.cdr?.markForCheck();try{let r=await this.adhocFilterFetcher.listFields([t]);this.ephemeralFilterFieldsCache.set(M,r)}catch(r){this.ephemeralFilterFieldsError=r instanceof Error?r.message:"Could not load filter fields"}finally{this.ephemeralFilterFieldsLoading=!1,this.cdr?.markForCheck()}}let n=this.ephemeralFilterFields()[0];this.ephemeralFilterBuilderFieldId=n?.name??null,this.ephemeralFilterBuilderOperator=n?Jc(n.type)[0].value:null,this.resetEphemeralFilterBuilderValues(),t&&n&&this.ensureFilterValuesLoaded(t,n)}closeEphemeralFilterBuilder(){this.ephemeralFilterBuilderWidgetId=null}resetEphemeralFilterBuilderValues(){this.ephemeralFilterBuilderValue="",this.ephemeralFilterBuilderValue2="",this.ephemeralFilterBuilderValues=[]}ephemeralFilterFields(){let e=this.ephemeralFilterWidget();return e?this.ephemeralFilterFieldsCache.get(this.ephemeralKey(e))??[]:[]}ephemeralFilterSelectedField(){return this.ephemeralFilterFields().find(e=>e.name===this.ephemeralFilterBuilderFieldId)}async ensureFilterValuesLoaded(e,t){let M=`${this.ephemeralKey(e)}::${t.name}`;if(!(!v3(t.type)||this.filterValuesCache.has(M)||!this.adhocFilterFetcher)){this.ephemeralFilterValuesLoading=!0,this.cdr?.markForCheck();try{let n=await this.adhocFilterFetcher.fetchValues([e],t.name);this.filterValuesCache.set(M,n.values)}catch{this.filterValuesCache.set(M,[])}finally{this.ephemeralFilterValuesLoading=!1,this.cdr?.markForCheck()}}}filterValuesFor(e,t){return!e||!t?[]:this.filterValuesCache.get(`${this.ephemeralKey(e)}::${t}`)??[]}onEphemeralFilterFieldChange(e){this.ephemeralFilterBuilderFieldId=e;let t=this.ephemeralFilterFields().find(n=>n.name===e);this.ephemeralFilterBuilderOperator=t?Jc(t.type)[0].value:null,this.resetEphemeralFilterBuilderValues();let M=this.ephemeralFilterWidget();M&&t&&this.ensureFilterValuesLoaded(M,t)}onEphemeralFilterOperatorChange(e){this.ephemeralFilterBuilderOperator=e,this.resetEphemeralFilterBuilderValues()}ephemeralFilterOperators(){let e=this.ephemeralFilterSelectedField();return e?Jc(e.type):[]}ephemeralFilterSelectedOperator(){return this.ephemeralFilterOperators().find(e=>e.value===this.ephemeralFilterBuilderOperator)}ephemeralFilterActiveFilters(){let e=this.ephemeralFilterWidget();return e?this.ephemeralFilters.get(this.ephemeralKey(e))??[]:[]}ephemeralFilterChipLabel(e){let t=this.ephemeralFilterFields().find(M=>M.name===e.fieldId);return Y3(e,t?.label??e.fieldId,t?.type??"string")}async reapplyEphemeralFilters(e,t,M){if(!this.adhocFilterFetcher)return!1;if(!M.length)return this.ephemeralFilterResult.delete(t),this.ephemeralFilterBaseConfig.delete(t),!0;let n=this.ephemeralChartOverride.get(t),r=this.ephemeralFilterBaseConfig.get(t)??U(x({},e),{componentName:n?.componentName??e.componentName,config:n?.config??e.config});this.ephemeralFilterApplying=!0,this.ephemeralFilterApplyError=null,this.cdr?.markForCheck();try{let o=M.map($m),a=await this.adhocFilterFetcher.apply(r,o);return this.ephemeralFilterBaseConfig.set(t,r),this.ephemeralFilterResult.set(t,a),!0}catch(o){return this.ephemeralFilterApplyError=o instanceof Error?o.message:"Filter could not be applied",!1}finally{this.ephemeralFilterApplying=!1,this.cdr?.markForCheck()}}async addEphemeralFilter(){let e=this.ephemeralFilterWidget(),t=this.ephemeralFilterBuilderFieldId,M=this.ephemeralFilterBuilderOperator;if(!e||!t||!M||this.ephemeralFilterApplying)return;let n=this.ephemeralFilterOperators().find(l=>l.value===M);if(!n)return;let r;if(n.valueKind==="none")r={id:`ef${++this.ephemeralFilterSeq}`,fieldId:t,operator:M};else if(n.valueKind==="multi-select"){if(this.ephemeralFilterBuilderValues.length===0)return;r={id:`ef${++this.ephemeralFilterSeq}`,fieldId:t,operator:M,values:[...this.ephemeralFilterBuilderValues]}}else{let l=this.ephemeralFilterBuilderValue.trim();if(!l)return;let N=n.needsSecondValue?this.ephemeralFilterBuilderValue2.trim():void 0;if(n.needsSecondValue&&!N)return;r={id:`ef${++this.ephemeralFilterSeq}`,fieldId:t,operator:M,value:l,value2:N}}let o=this.ephemeralKey(e),a=[...this.ephemeralFilters.get(o)??[],r];await this.reapplyEphemeralFilters(e,o,a)&&(this.ephemeralFilters.set(o,a),this.resetEphemeralFilterBuilderValues(),this.cdr?.markForCheck())}async removeEphemeralFilter(e){let t=this.ephemeralFilterWidget();if(!t||this.ephemeralFilterApplying)return;let M=this.ephemeralKey(t),n=(this.ephemeralFilters.get(M)??[]).filter(o=>o.id!==e);await this.reapplyEphemeralFilters(t,M,n)&&(n.length?this.ephemeralFilters.set(M,n):this.ephemeralFilters.delete(M),this.cdr?.markForCheck())}async clearEphemeralFilters(){let e=this.ephemeralFilterWidget();if(!e||this.ephemeralFilterApplying)return;let t=this.ephemeralKey(e);await this.reapplyEphemeralFilters(e,t,[]),this.ephemeralFilters.delete(t),this.cdr?.markForCheck()}quickTimePresets=bst;async applyQuickTimeFilter(e,t){let M=this.timeWindowField(e);if(!M)return;if(this.dashboardId){if(!this.widgetFilterFetcher||this.filterBuilderApplying)return;this.filterBuilderApplying=!0,this.filterBuilderError=null;try{let{from:s,to:l}=nF(t),N=await this.widgetFilterFetcher.add(this.dashboardId,e.id,{field:M,operation:"between",value:[s,l]},this.persistToPublished);this.widgetFiltersChanged.emit(N)}catch(s){this.filterBuilderError=s instanceof Error?s.message:"Filter could not be applied"}finally{this.filterBuilderApplying=!1,this.cdr?.markForCheck()}return}let n=this.ephemeralKey(e),r={id:`ef${++this.ephemeralFilterSeq}`,fieldId:M,operator:t},o=[...this.ephemeralFilters.get(n)??[],r];await this.reapplyEphemeralFilters(e,n,o)&&(this.ephemeralFilters.set(n,o),this.cdr?.markForCheck())}dslEditorWidgetId=null;dslQueryText="";dslPromptText="";dslGenerating=!1;dslApplying=!1;dslError=null;dslBaselineText="";dslTurns=[];dslPendingPrompt=null;dslValidity={ok:!1,error:"Query is empty"};dslExpandedTurn=-1;dslCopied=!1;dslCopiedTimer=null;dslDevMode=!1;toggleDslDevMode(){this.dslDevMode=!this.dslDevMode}forecastSettingsWidgetId=null;forecastDraft=null;forecastGranularities=["Weekly","Monthly","Quarterly","Yearly"];forecastConfidences=[80,90,95];get forecastSettingsWidget(){return this.widgets.find(e=>e.id===this.forecastSettingsWidgetId)??null}get forecastMaxHorizon(){let e=String(this.forecastSettingsWidgetId??"");return this.forecastable[e]?.maxHorizon??24}get forecastPeriodWord(){return{Weekly:"week",Monthly:"month",Quarterly:"quarter",Yearly:"year"}[this.forecastDraft?.granularity??"Monthly"]??"period"}get forecastProvenance(){let e=this.forecastSettingsWidget?.config?.forecast;if(!e?.enabled)return null;let t=[];e.modelFamily&&t.push({label:"Model",value:String(e.modelFamily)});let M=e.historyWindow?.points;if(Number.isFinite(M)){let a={Weekly:"weeks",Monthly:"months",Quarterly:"quarters",Yearly:"years"}[e.granularity]??"periods";t.push({label:"History",value:`${M} ${a}`})}if(Number.isFinite(e.typicalError)?t.push({label:"Typical error",value:`${Number(e.typicalError).toFixed(2)} MASE`}):t.push({label:"Typical error",value:"not scored \u2014 too little history to backtest"}),Number.isFinite(e.vsNaive)){let o=Math.round(Math.abs(Number(e.vsNaive))*100),a=Number(e.vsNaive)>=0?`${o}% better`:`${o}% worse`,s=Number.isFinite(e.naiveMase)?` (${e.naiveKey==="snaive"?"seasonal naive":"naive"} scores ${Number(e.naiveMase).toFixed(2)})`:"";t.push({label:"vs naive",value:`${a}${s}`})}e.boundaryPeriod&&t.push({label:"From",value:String(e.boundaryPeriod)});let n=Array.isArray(e.seriesSkipped)?e.seriesSkipped:[],r=Array.isArray(e.seriesForecast)?e.seriesForecast.length:0;if(n.length&&t.push({label:"Series",value:`${r} of ${r+n.length} forecast`}),e.lastComputedAt){let o=new Date(e.lastComputedAt);Number.isNaN(o.getTime())||t.push({label:"Computed",value:o.toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})})}return t.length?t:null}openForecastSettings(e){let M=this.widgets.find(n=>n.id===e)?.config?.forecast??{};this.forecastSettingsWidgetId=e,this.forecastDraft={horizon:Number(M.horizon)||6,granularity:String(M.granularity||"Monthly"),confidence:Number(M.confidence)||80}}closeForecastSettings(){this.forecastSettingsWidgetId=null,this.forecastDraft=null}onForecastHorizon(e){if(!this.forecastDraft)return;let t=Math.max(1,Math.min(this.forecastMaxHorizon,Math.floor(Number(e)||1)));this.forecastDraft=U(x({},this.forecastDraft),{horizon:t})}onForecastGranularity(e){this.forecastDraft&&(this.forecastDraft=U(x({},this.forecastDraft),{granularity:e}))}onForecastConfidence(e){this.forecastDraft&&(this.forecastDraft=U(x({},this.forecastDraft),{confidence:e}))}applyForecastSettings(){let e=this.forecastSettingsWidget,t=this.forecastDraft;!e||!t||(this.forecast.emit({widget:e,enable:!0,settings:x({},t)}),this.closeForecastSettings())}openDslEditor(e){let t=this.widgets.find(o=>o.id===e);this.dslEditorWidgetId=e;let M=this.dslCodeEditorLanguage,n=t?.queryMeta?.sql,r=n&&qm(n,M)||n||"";this.dslQueryText=r,this.dslBaselineText=r,this.dslPromptText="",this.dslPendingPrompt=null,this.dslTurns=[],this.dslExpandedTurn=-1,this.dslGenerating=!1,this.dslApplying=!1,this.dslError=null,this.dslValidity=Uj(r,M),this.dslDevMode=!1}get dslEditorWidget(){return this.widgets.find(e=>e.id===this.dslEditorWidgetId)??null}get dslChartTypeLabel(){let e=this.dslEditorWidget?.config?.chart?.type;return e?xPt[e]??`${e.charAt(0).toUpperCase()}${e.slice(1)} chart`:""}get dslCodeEditorLanguage(){let e=this.dslEditorWidget?.queryMeta?.adapterType;return e==="postgres"||e==="mssql"?"sql":"json"}static DSL_TERM_BY_ADAPTER={mssql:"SQL",postgres:"query"};dslTermFor(e){return e&&i.DSL_TERM_BY_ADAPTER[e]||"DSL"}dslMenuLabelFor(e){let t=e.queryMeta?.adapterType,M=this.dslTermFor(t);return`${M.charAt(0).toUpperCase()}${M.slice(1)}`}get dslTerm(){return this.dslTermFor(this.dslEditorWidget?.queryMeta?.adapterType)}get dslDirty(){return this.dslQueryText!==this.dslBaselineText}onDslTextChange(e){this.dslQueryText=e,this.dslValidity=Uj(e,this.dslCodeEditorLanguage)}formatDslQuery(){let e=qm(this.dslQueryText,this.dslCodeEditorLanguage);e!==null&&this.onDslTextChange(e)}async copyDslQuery(){try{await navigator.clipboard.writeText(this.dslQueryText),this.dslCopied=!0,this.dslCopiedTimer&&clearTimeout(this.dslCopiedTimer),this.dslCopiedTimer=setTimeout(()=>{this.dslCopied=!1,this.cdr?.markForCheck()},1500)}catch{}this.cdr?.markForCheck()}resetDslQuery(){this.dslQueryText=this.dslBaselineText,this.dslValidity=Uj(this.dslBaselineText,this.dslCodeEditorLanguage),this.dslTurns=[],this.dslExpandedTurn=-1,this.dslError=null}toggleDslDiff(e){this.dslExpandedTurn=this.dslExpandedTurn===e?-1:e}undoDslTurn(e){let t=this.dslTurns[e];t&&(this.dslQueryText=t.before,this.dslValidity=Uj(t.before,this.dslCodeEditorLanguage),this.dslTurns=this.dslTurns.slice(0,e),this.dslExpandedTurn=-1,this.dslError=null)}closeDslEditor(){this.dslApplying||!this.dslCloseAllowed()||this.resetDslEditorState()}onDslRequestClose(e){if(e.stopPropagation(),this.dslApplying||!this.dslCloseAllowed()){e.preventDefault();return}this.resetDslEditorState()}onDslDrawerHidden(){this.dslEditorWidgetId===null||this.dslApplying||(this.resetDslEditorState(),this.cdr?.markForCheck())}dslCloseAllowed(){return!this.dslDirty||typeof window>"u"?!0:window.confirm("Discard your unapplied changes to this query?")}onDslComposerSubmit(e){typeof e=="string"&&(this.dslPromptText=e),this.generateDsl()}dslRefFor(e){if(this.dashboardId&&e.id)return{widgetId:e.id};let t=e.config?.chart;return{componentName:e.componentName,type:t?.type,title:e.title,originalWidget:e}}async generateDsl(){let e=this.dslEditorWidget,t=this.dslPromptText.trim();if(!e||!t||this.dslGenerating||this.dslApplying||!this.dslEditorFetcher)return;let M=this.dslRefFor(e);if(!M)return;if(t.length>Gst){this.dslError=`That instruction is too long (${t.length} of ${Gst} characters).`;return}let n=this.dslQueryText;this.dslPromptText="",this.dslPendingPrompt=t,this.dslGenerating=!0,this.dslError=null;try{let r=this.dslTurns[this.dslTurns.length-1],o=await this.dslEditorFetcher.generate(M,t,{currentQuery:n,lastTurn:r?{prompt:r.prompt,summary:r.summary}:void 0}),a=qm(o.sql,this.dslCodeEditorLanguage)??o.sql;this.dslQueryText=a,this.dslValidity=Uj(a,this.dslCodeEditorLanguage);let s=oF(n,a),l=aF(s),N=o.wasModified===!0,c=o.summary??(N?"Updated the query.":"The assistant made no changes to the query.");this.dslTurns=[...this.dslTurns,{prompt:t,before:n,after:a,summary:c,wasModified:N,diff:s,changed:l}],this.dslExpandedTurn=-1}catch(r){this.dslError=r instanceof Error?r.message:"DSL generation failed",this.dslPromptText=t}finally{this.dslPendingPrompt=null,this.dslGenerating=!1,this.cdr?.markForCheck()}}async applyDsl(){let e=this.dslEditorWidget;if(!e||this.dslApplying||this.dslGenerating||!this.dslEditorFetcher)return;let t=this.dslRefFor(e);if(!t||!this.dslDirty)return;let M=Uj(this.dslQueryText,this.dslCodeEditorLanguage);if(!M.ok){this.dslError=M.error;return}this.dslApplying=!0,this.dslError=null;try{let n=await this.dslEditorFetcher.apply(t,this.dslQueryText);this.dslWidgetUpdated.emit(n),this.closeDslEditorForce()}catch(n){this.dslError=n instanceof Error?n.message:"Apply failed"}finally{this.dslApplying=!1,this.cdr?.markForCheck()}}closeDslEditorForce(){this.resetDslEditorState()}resetDslEditorState(){let e=this.dslEditorWidgetId!==null;this.dslEditorWidgetId=null,this.dslPromptText="",this.dslPendingPrompt=null,this.dslQueryText="",this.dslBaselineText="",this.dslTurns=[],this.dslExpandedTurn=-1,this.dslError=null,this.dslCopied=!1,this.dslDevMode=!1,this.dslCopiedTimer&&(clearTimeout(this.dslCopiedTimer),this.dslCopiedTimer=null),e&&this.dslEditorClosed.emit()}syncGridsterItems(){let e=new Map;for(let t of this.gridsterItems)e.set(t.widgetId,t);this.gridsterItems=this.widgets.map(t=>{let M=e.get(t.id),n=t.layout,r=n?this.clampItemGeometry(n,t):null;return M&&r&&(M.x!==r.x||M.y!==r.y||M.cols!==r.cols||M.rows!==r.rows+this.expandedExtraRowsFor(t.id))?this.buildItem(t):M??this.buildItem(t)})}static HEADER_ALLOWANCE_PX=110;static HEATMAP_ROW_PX=36;minRowsForDeclaredHeight(e,t){let M=e.config?.chart,n=0,r=M?.height;if(typeof r=="string"){let o=parseInt(r,10);Number.isFinite(o)&&o>0&&(n=Math.max(n,Math.ceil((o+i.HEADER_ALLOWANCE_PX)/72)))}if(M?.type==="heatmap"&&Array.isArray(M.yCategories)){let o=M.yCategories.length*i.HEATMAP_ROW_PX;n=Math.max(n,Math.ceil((o+i.HEADER_ALLOWANCE_PX)/72))}return Math.max(t,n)}computeRowInflationOffsets(){let t=new Map,M=new Array(12).fill(0),n=this.widgets.filter(r=>!!r.layout).sort((r,o)=>r.layout.y-o.layout.y);for(let r of n){let o=Math.max(0,Math.min(r.layout.x,11)),a=Math.max(1,Math.min(r.layout.w,12-o)),s=0;for(let I=o;I<o+a;I++)s=Math.max(s,M[I]);let l=r.layout.y+s,N=r.layout.h,c=this.minRowsForDeclaredHeight(r,N);t.set(r.id,{y:l,rows:c});let D=s+(c-N);for(let I=o;I<o+a;I++)M[I]=Math.max(M[I],D)}return t}clampItemGeometry(e,t){let M=Math.max(1,Math.min(e.w,12)),n=Math.max(0,Math.min(e.x,12-M));if(!t)return{x:n,y:e.y,cols:M,rows:e.h};let r=this.computeRowInflationOffsets().get(t.id);return{x:n,y:r?.y??e.y,cols:M,rows:r?.rows??this.minRowsForDeclaredHeight(t,e.h)}}buildItem(e){let t=e.widgetType==="kpi"?4:6,M=e.widgetType==="kpi"?2:4,n=e.layout??{x:0,y:0,w:t,h:M},{x:r,y:o,cols:a,rows:s}=this.clampItemGeometry(n,e);return x({x:r,y:o,cols:a,rows:s+this.expandedExtraRowsFor(e.id),minItemCols:2,minItemRows:2,widgetId:e.id},this.isFilterWidget(e)?{layerIndex:i.FILTER_LAYER_INDEX}:{})}scheduleGestureReconcile(){setTimeout(()=>this.reconcileLayoutAfterGesture(),0)}reconcileLayoutAfterGesture(){let e=this.railShift();for(let t of this.widgets){if(this.isFilterWidget(t))continue;let M=t.id,n=t.layout;if(!n)continue;let r=this.getItemForWidget(t),a=!!e&&Number(n.y??0)>e.y?Number(r.y??0)+e.rows:Number(r.y??0),s={x:r.x,y:a,w:r.cols,h:r.rows-this.expandedExtraRowsFor(M)},l=this.clampItemGeometry(n);l.x===s.x&&l.y===s.y&&l.cols===s.w&&l.rows===s.h||this.updateLayout.emit({id:M,layout:s})}}static \u0275fac=function(t){return new(t||i)(ni(ir),ni(bj),ni(U3,8),ni(Fm,8),ni(EA,8),ni(Hm,8),ni(Jm,8),ni(Xm,8),ni(Gm,8),ni(vj,8),ni(t0,8),ni(Yl,8),ni(Dl,8))};static \u0275cmp=rM({type:i,selectors:[["shared-dashboard-grid"]],viewQuery:function(t,M){if(t&1&&eN(ZI,5),t&2){let n;ll(n=gl())&&(M.chartWidgets=n)}},hostVars:2,hostBindings:function(t,M){t&2&&Wt("auto-height",M.autoHeight)},inputs:{widgets:"widgets",editMode:"editMode",autoHeight:"autoHeight",dashboardId:"dashboardId",conversationId:"conversationId",persistToPublished:"persistToPublished",filtersEnabled:"filtersEnabled",tweakingWidgetId:"tweakingWidgetId",forecastingWidgetId:"forecastingWidgetId",loading:"loading",outerMargin:"outerMargin",canvasBackgroundColor:"canvasBackgroundColor",widgetsLoading:"widgetsLoading",showTweakInViewMode:"showTweakInViewMode",showEditDslInViewMode:"showEditDslInViewMode",canSetAlert:"canSetAlert",canAddToStory:"canAddToStory",canForecast:"canForecast",canAsk:"canAsk",canChangeChartType:"canChangeChartType",canManageFilters:"canManageFilters",canCustomizeColors:"canCustomizeColors",canViewChartData:"canViewChartData",canExportPng:"canExportPng",canExportCsv:"canExportCsv",canPrint:"canPrint",canTweak:"canTweak",canEdit:"canEdit",canDelete:"canDelete",forecastable:"forecastable",showWidgetMenu:"showWidgetMenu",selectable:"selectable",detailPanel:"detailPanel",detailDepth:"detailDepth",detailRootLabel:"detailRootLabel",selectedWidgetIds:"selectedWidgetIds",dashboardFilters:"dashboardFilters",resolvedFilters:"resolvedFilters",applySummary:"applySummary",filterExplanation:"filterExplanation",timeFilterEnabled:"timeFilterEnabled"},outputs:{remove:"remove",editWidget:"editWidget",openAiBuilder:"openAiBuilder",updateLayout:"updateLayout",aiSend:"aiSend",tweakWidget:"tweakWidget",dslWidgetUpdated:"dslWidgetUpdated",dslEditorClosed:"dslEditorClosed",widgetChartTypeChanged:"widgetChartTypeChanged",widgetFiltersChanged:"widgetFiltersChanged",widgetColorChanged:"widgetColorChanged",filterSubmit:"filterSubmit",filterChange:"filterChange",timeRangeApply:"timeRangeApply",selectionChange:"selectionChange",setAlert:"setAlert",addToStory:"addToStory",widgetClick:"widgetClick",forecast:"forecast"},features:[tN([bj]),Qo],ngContentSelectors:i_t,decls:58,vars:39,consts:[[3,"mode","conditions","catalog","expression","busy","valueFetcher","showFilterControls","disabled","showTimeFilter","timeFilterResetKey"],[1,"canvas-wrap"],["role","status",1,"filter-explanation"],["aria-hidden","true",1,"loading-grid"],["class","empty-state",4,"ngIf"],[3,"options","grid-hidden",4,"ngIf"],["label","Tweak widget",1,"tweak-dialog",3,"nile-request-close","open"],[1,"tweak-dialog__body"],[1,"tweak-dialog__hint"],[1,"tweak-dialog__examples"],["type","button",1,"tweak-dialog__example"],["rows","4","placeholder","Describe the tweak\u2026","autofocus","",1,"tweak-dialog__input",3,"ngModelChange","ngModel"],["slot","footer",1,"tweak-dialog__footer"],["variant","secondary","size","small",3,"click"],["variant","primary","size","small",3,"click"],["label","Edit DSL query","placement","end",1,"dsl-editor-drawer",3,"nile-request-close","nile-hide","open","preventOverlayClose"],["slot","label",1,"dsl-editor-drawer__label"],[1,"dsl-editor-drawer__title-row"],[1,"dsl-editor-drawer__title"],[1,"dsl-editor-drawer__badge"],["slot","header-actions",1,"dsl-editor-drawer__header-actions"],["variant","secondary","size","small"],["slot","prefix","method","stroke","size","14"],["role","alert",1,"dsl-pane__error","dsl-pane__error--global"],[1,"dsl-editor-drawer__body"],[1,"dsl-pane","dsl-pane--query"],[1,"dsl-pane","dsl-pane--assistant"],[1,"dsl-pane__toolbar"],[1,"dsl-pane__toolbar-label"],["name","smart-code","method","fill","size","14","color","var(--ng-colors-border-brand)"],[1,"dsl-pane__toolbar-meta"],[1,"dsl-chat",3,"autoScroll"],[1,"dsl-chat__empty"],[1,"dsl-bubble","dsl-bubble--user",3,"role","message"],[1,"dsl-bubble","dsl-bubble--ai",3,"role","agent","icon","thinking","loading"],["slot","footer",1,"dsl-composer",3,"nile-input","nile-submit","placeholder","value","disabled","maxRows","submitOnEnter"],["slot","footer",1,"dsl-editor-drawer__footer"],[1,"dsl-editor-drawer__footer-note"],[1,"dsl-editor-drawer__footer-actions"],["label","Forecast settings","placement","end",1,"forecast-settings-drawer",3,"nile-request-close","nile-hide","open"],[3,"crumbs","loading","label"],[3,"modeChange","conditionsChange","expressionRun","promptAsk","clearAll","timeRangeApply","mode","conditions","catalog","expression","busy","valueFetcher","showFilterControls","disabled","showTimeFilter","timeFilterResetKey"],["name","ng-info-circle","method","stroke","size","16","color","var(--ng-colors-text-tertiary-600)"],[1,"filter-explanation__text"],[1,"loading-grid__kpis"],[1,"widget-card","sk-card","sk-card--kpi"],[1,"loading-grid__charts"],[1,"widget-card","sk-card","sk-card--chart"],["variant","text","width","65%","height","13"],["variant","text","width","90%","height","10"],["variant","text","width","45%","height","30",1,"sk-card__value"],["variant","text","width","40%","height","15"],["variant","text","width","55%","height","10"],[1,"sk-bars"],["variant","rectangular","width","100%","height","100%",1,"sk-bar",3,"height"],[1,"sk-legend"],["variant","rounded","width","100%","height","11"],["variant","rectangular","width","100%","height","100%",1,"sk-bar"],[1,"empty-state"],[1,"empty-state__graphic",3,"click","keydown.enter","keydown.space"],["viewBox","0 0 380 140","aria-hidden","true","preserveAspectRatio","xMidYMid meet"],["x","40","y","20","width","300","height","100","rx","8","stroke","#80AED3","stroke-width","1.5","stroke-dasharray","4 4",2,"fill","var(--ng-colors-bg-primary)"],["x","56","y","36","width","84","height","68","rx","6",2,"fill","var(--ng-colors-bg-secondary)","stroke","var(--ng-colors-border-secondary)"],["x","64","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["x","64","y","80","width","6","height","20","rx","1","fill","#005EA6","opacity","0.7"],["attributeName","height","values","20;14;20","dur","2s","repeatCount","indefinite"],["attributeName","y","values","80;86;80","dur","2s","repeatCount","indefinite"],["x","76","y","74","width","6","height","26","rx","1","fill","#005EA6"],["attributeName","height","values","26;18;26","dur","2s","begin","0.2s","repeatCount","indefinite"],["attributeName","y","values","74;82;74","dur","2s","begin","0.2s","repeatCount","indefinite"],["x","88","y","68","width","6","height","32","rx","1","fill","#005EA6","opacity","0.85"],["attributeName","height","values","32;24;32","dur","2s","begin","0.4s","repeatCount","indefinite"],["attributeName","y","values","68;76;68","dur","2s","begin","0.4s","repeatCount","indefinite"],["x","100","y","78","width","6","height","22","rx","1","fill","#005EA6","opacity","0.6"],["attributeName","height","values","22;16;22","dur","2s","begin","0.6s","repeatCount","indefinite"],["attributeName","y","values","78;84;78","dur","2s","begin","0.6s","repeatCount","indefinite"],["x","112","y","66","width","6","height","34","rx","1","fill","#005EA6","opacity","0.85"],["attributeName","height","values","34;26;34","dur","2s","begin","0.8s","repeatCount","indefinite"],["attributeName","y","values","66;74;66","dur","2s","begin","0.8s","repeatCount","indefinite"],["x","148","y","36","width","84","height","68","rx","6",2,"fill","var(--ng-colors-bg-secondary)","stroke","var(--ng-colors-border-secondary)"],["x","156","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["cx","190","cy","78","r","14","fill","none","stroke-width","5",2,"stroke","var(--ng-colors-border-secondary)"],["cx","190","cy","78","r","14","fill","none","stroke","#005EA6","stroke-width","5","stroke-linecap","round","stroke-dasharray","88","stroke-dashoffset","88","transform","rotate(-90 190 78)"],["attributeName","stroke-dashoffset","values","88;22;22;88","keyTimes","0;0.5;0.85;1","dur","2.6s","repeatCount","indefinite"],["x","240","y","36","width","84","height","68","rx","6",2,"fill","var(--ng-colors-bg-secondary)","stroke","var(--ng-colors-border-secondary)"],["x","248","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["d","M 250 92 L 264 80 L 278 86 L 292 72 L 306 78 L 320 64","fill","none","stroke","#005EA6","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round","stroke-dasharray","200","stroke-dashoffset","200"],["attributeName","stroke-dashoffset","values","200;0;0;200","keyTimes","0;0.5;0.85;1","dur","2.6s","repeatCount","indefinite"],["cx","320","cy","64","r","2.5","fill","#005EA6"],["attributeName","opacity","values","0;0;1;1;0","keyTimes","0;0.45;0.55;0.85;1","dur","2.6s","repeatCount","indefinite"],[4,"ngIf"],["variant","primary","class","empty-state__cta","aria-label","Add widget",3,"click",4,"ngIf"],["variant","primary","aria-label","Add widget",1,"empty-state__cta",3,"click"],["slot","prefix","name","ng-plus","size","16"],[3,"options"],[3,"item","gridster-item--menu-open"],[3,"item"],[1,"widget-card"],[1,"widget-card__filter-overlay"],[1,"widget-body",3,"click"],[3,"aiSend","filterSubmit","filterChange","chartClick","chartSelection","chartSelectionReset","cellFilter","dataViewFilterChange","gridFilterVerdict","menuAction","remounted","config","drilldownBy","widgetId","widgetTitle","chromePinned","loading","menu","dashboardFilters","resolvedFilters","dashboardId","conversationId","cellFilterEnabled"],["header-lead","","title","Drag to move",1,"widget-drag-handle"],["header-lead","",1,"widget-select"],["hoist","","placement","bottom-end","distance","6",1,"widget-header-dropdown",3,"open"],[2,"position","absolute","inset","auto 0 0 0","display","flex","justify-content","flex-end","padding","8px 16px","background","linear-gradient(to top, var(--ng-colors-bg-primary, var(--ng-colors-bg-primary)) 70%, transparent)","pointer-events","none"],[1,"widget-card__filter-overlay-label"],[3,"content"],["name","ng-alert-triangle","method","stroke","size","24","color","var(--ng-colors-border-warning)"],[1,"widget-card__filter-note"],["name","ng-dots-grid","method","stroke","size","16",1,"drag-icon"],[3,"nile-change"],["type","button","aria-haspopup","menu","aria-label","Widget actions",1,"widget-menu__trigger",3,"click","id"],["name","ng-dots-vertical","method","stroke","size","16"],["trigger","manual","zindex","700",1,"widget-menu",3,"nile-change","open"],[1,"widget-menu__group",3,"widget-menu__group--empty","widget-menu__group--first"],[1,"widget-menu__group"],[1,"widget-menu__item"],[1,"widget-menu__item",3,"mouseenter","focusin"],["slot","icon","size","15",3,"name","method"],["zindex","701"],["disabled",""],[1,"widget-menu__story-new",3,"click"],["slot","icon","name","ng-plus","method","stroke","size","14"],[3,"click"],[1,"widget-menu__item",3,"click"],["slot","icon","size","15",3,"name","method","color"],["hoist","","placement","bottom-end","distance","6",1,"widget-header-dropdown",3,"nile-hide","open"],["slot","trigger","type","button","tabindex","-1","aria-hidden","true",1,"widget-header-btn","widget-header-btn--hidden-anchor"],["name","ng-chart-bar","method","stroke","size","16"],[1,"type-picker__panel"],[1,"inline-action__loading"],[1,"inline-action__hint"],[1,"inline-action__error"],["size","16"],[1,"type-picker__section"],[1,"type-picker__grid"],["type","button",1,"type-picker__tile","type-picker__tile--sensible",3,"type-picker__tile--current"],["type","button",1,"type-picker__tile","type-picker__tile--sensible",3,"click"],["method","stroke","size","16",3,"name"],["type","button",1,"type-picker__tile",3,"type-picker__tile--current"],["type","button",1,"type-picker__tile",3,"click"],["name","ng-palette","method","stroke","size","16"],[1,"color-picker__panel"],[1,"color-picker__row"],[1,"color-picker__swatch-input"],["type","color",3,"change","value"],[1,"color-picker__name"],["name","ng-filter-lines","method","stroke","size","16"],[1,"filter-builder__panel"],[1,"filter-builder__active"],[1,"filter-builder__quick-time"],[1,"filter-builder__form"],[1,"filter-builder__chip"],["type","button",1,"filter-builder__chip-remove",3,"click"],["name","ng-x-close","method","stroke","size","10"],["type","button",1,"filter-builder__quick-time-chip"],["type","button",1,"filter-builder__quick-time-chip",3,"click"],[1,"filter-builder__select",3,"ngModelChange","ngModel"],[3,"value"],["variant","secondary","size","small",1,"filter-builder__add-btn",3,"click"],[1,"inline-action__loading","inline-action__loading--compact"],["type","text","placeholder","Value\u2026",1,"filter-builder__input",3,"ngModel"],[1,"filter-builder__multi"],[1,"filter-builder__select",3,"ngModel"],["type","text","placeholder","Value\u2026",1,"filter-builder__input",3,"ngModelChange","keydown.enter","ngModel"],["type","date",1,"filter-builder__input",3,"ngModelChange","ngModel"],[1,"filter-builder__and"],["type","number","placeholder","Value\u2026",1,"filter-builder__input",3,"ngModelChange","keydown.enter","ngModel"],["type","number","placeholder","Value\u2026",1,"filter-builder__input",3,"ngModelChange","ngModel"],[1,"filter-builder__multi-item"],["type","checkbox",3,"change","checked"],["value","","disabled",""],["size","12"],["type","button",2,"pointer-events","auto","border","0","border-radius","var(--ng-radius-md, 8px)","padding","6px 14px","font","600 12px/1.2 inherit","color","var(--ng-colors-text-white)","background","var(--ng-colors-bg-brand-solid)","cursor","pointer",3,"click"],[1,"widget-card__filter-footer"],[1,"widget-card__manual-header"],[1,"widget-card__manual-titles"],[1,"widget-card__manual-title"],[1,"widget-card__manual-actions"],[1,"widget-card__manual",3,"conditionsChange","contentHeight","overflowCountChange","catalog","conditions","catalogLoading","disabled","valueFetcher","onDashboardFields","recentlyUsedFields","expanded"],[1,"widget-drag-handle"],["type","button","aria-haspopup","menu","aria-label","Widget actions",1,"widget-card__kebab",3,"click","id"],["name","ng-dots-vertical","method","stroke","size","18"],[1,"widget-menu__group","widget-menu__group--first"],["name","ng-dots-grid","method","stroke",1,"drag-icon"],["slot","icon","name","ng-wand-sparkles","method","stroke","size","14"],["slot","icon","name","ng-edit-02","method","stroke","size","14"],["slot","icon","name","ng-trash-01","method","stroke","size","14"],["slot","icon","name","ng-bell-01","method","stroke","size","14"],["slot","icon","method","stroke","size","14",3,"name"],["role","button","tabindex","0",1,"widget-card__mode-link",3,"click","keydown.enter"],["aria-hidden","true",1,"drill-context-menu__anchor",3,"id"],["trigger","manual","zindex","700",1,"drill-context-menu",3,"nile-change","open"],["label","Drill Down"],["slot","icon","method","stroke","size","14"],["slot","icon","name","filter","method","stroke","size","14"],["type","button",1,"tweak-dialog__example",3,"click"],["name","ng-wand-sparkles","method","stroke","size","12"],["slot","prefix","name","ng-refresh-ccw","method","stroke","size","14"],["name","ng-alert-circle","method","stroke","size","16"],[1,"dsl-pane__error-text"],["type","button","aria-label","Dismiss error",1,"dsl-pane__error-dismiss",3,"click"],["name","ng-x-close","method","stroke","size","14"],[1,"dsl-pane__toolbar-actions"],["type","button",1,"dsl-tool-btn",3,"click","disabled"],["name","ng-braces","method","stroke","size","13"],["type","button",1,"dsl-tool-btn",3,"click"],["method","stroke","size","13"],[1,"dsl-validity"],["multiline","","hasScroller","","lineNumbersMultiline","","enableFoldGutters","","enableSearch","",1,"dsl-pane__editor",3,"nile-change","expandable","value"],[1,"dsl-bubble","dsl-bubble--ai",3,"role","agent","icon"],[1,"dsl-turn__summary"],[1,"dsl-turn__diff"],[1,"dsl-turn__actions",3,"copy","copyValue"],["type","button",1,"dsl-turn__action"],["type","button",1,"dsl-turn__action",3,"disabled","title"],[1,"dsl-diff-line",3,"class"],[1,"dsl-diff-line"],[1,"dsl-diff-line__sign"],[1,"dsl-diff-line__text"],["type","button",1,"dsl-turn__action",3,"click"],["type","button",1,"dsl-turn__action",3,"click","disabled","title"],[1,"fc-panel"],["for","fc-horizon",1,"fc-label"],["id","fc-horizon","type","range","min","1",1,"fc-range",3,"input","value"],[1,"fc-hint"],[1,"fc-label"],["role","group","aria-label","Granularity",1,"fc-seg"],["type","button",1,"fc-seg__btn",3,"fc-seg__btn--on"],["role","group","aria-label","Confidence interval",1,"fc-seg"],["slot","footer",1,"fc-actions"],["type","button",1,"fc-seg__btn",3,"click"],[1,"fc-fact"],[3,"closed","crumbs","loading","label"],[3,"widgets","editMode","showWidgetMenu","selectable","autoHeight","dashboardId","resolvedFilters","detailPanel","detailDepth","detailRootLabel"]],template:function(t,M){if(t&1&&(tu(t_t),he(0,a_t,1,10,"shared-filter-rail",0),$(1,"div",1),he(2,s_t,4,1,"div",2),he(3,u_t,7,0,"div",3),ux(4,I_t,36,4,"div",4)(5,KWt,3,3,"gridster",5),he(6,iPt,6,8),$(7,"nile-dialog",6),Ze("nile-request-close",function(r){return r.stopPropagation(),M.closeTweak()}),$(8,"div",7)(9,"p",8),Y(10,"Describe the change you want \u2014 or pick one of these to start:"),ee(),$(11,"div",9),ht(12,MPt,4,1,"button",10,Ho),ee(),$(14,"textarea",11),cl("ngModelChange",function(r){return ul(M.tweakPromptText,r)||(M.tweakPromptText=r),r}),ee()(),$(15,"div",12)(16,"nile-button",13),Ze("click",function(){return M.closeTweak()}),Y(17,"Cancel"),ee(),$(18,"nile-button",14),Ze("click",function(){return M.submitTweak()}),Y(19," Apply tweak "),ee()()(),$(20,"nile-drawer",15),Ze("nile-request-close",function(r){return M.onDslRequestClose(r)})("nile-hide",function(){return M.onDslDrawerHidden()}),$(21,"div",16)(22,"span",17)(23,"span",18),Y(24),ee(),he(25,nPt,2,1,"span",19),ee()(),$(26,"div",20),he(27,rPt,3,1,"nile-button",21),$(28,"nile-button",13),Ze("click",function(){return M.toggleDslDevMode()}),Mt(29,"nile-glyph",22),Y(30," Open in editor "),ee()(),he(31,oPt,6,1,"div",23),$(32,"div",24),he(33,aPt,15,12,"section",25),$(34,"aside",26)(35,"header",27)(36,"span",28),Mt(37,"nile-glyph",29),Y(38," Assistant "),ee(),he(39,sPt,2,2,"span",30),ee(),$(40,"nile-ai-chat",31),he(41,lPt,2,0,"p",32),ht(42,DPt,8,11,null,null,Mr),he(44,IPt,1,2,"nile-ai-chat-bubble",33),he(45,dPt,1,5,"nile-ai-chat-bubble",34),$(46,"nile-ai-prompt-input",35),Ze("nile-input",function(r){return M.dslPromptText=(r.detail==null?null:r.detail.value)??""})("nile-submit",function(r){return M.onDslComposerSubmit(r.detail==null?null:r.detail.value)}),ee()()()(),$(47,"div",36)(48,"span",37),Y(49,"Applying re-runs the query and redraws this widget only."),ee(),$(50,"span",38)(51,"nile-button",13),Ze("click",function(){return M.closeDslEditor()}),Y(52,"Cancel"),ee(),$(53,"nile-button",14),Ze("click",function(){return M.applyDsl()}),Y(54," Apply changes "),ee()()()(),$(55,"nile-drawer",39),Ze("nile-request-close",function(){return M.closeForecastSettings()})("nile-hide",function(){return M.closeForecastSettings()}),he(56,zPt,31,8),ee()(),he(57,hPt,3,13,"shared-widget-detail-panel",40)),t&2){let n;xe(!M.loading&&M.railVisible()?0:-1),L(),aM("background-color",M.canvasBackgroundColor||null),Wt("view-mode",!M.editMode||M.loading),L(),xe(!M.loading&&M.filterExplanation?2:-1),L(),xe(M.loading?3:-1),L(),ot("ngIf",!M.loading&&M.widgets.length===0),L(),ot("ngIf",!M.loading),L(),xe((n=M.drillContextMenu)?6:-1,n),L(),ot("open",M.tweakTargetId!==null),L(5),xt(M.tweakExamples),L(2),Nl("ngModel",M.tweakPromptText),L(4),It("disabled",M.tweakPromptText.trim()?null:""),L(2),ot("open",M.dslEditorWidgetId!==null)("preventOverlayClose",M.dslApplying),L(4),it((M.dslEditorWidget==null?null:M.dslEditorWidget.title)||"Edit DSL query"),L(),xe(M.dslChartTypeLabel?25:-1),L(2),xe(M.dslDirty?27:-1),L(2),It("name",M.dslDevMode?"ng-chevron-down":"ng-chevron-up"),L(2),xe(M.dslError?31:-1),L(2),xe(M.dslDevMode?33:-1),L(),Wt("dsl-pane--assistant-full",!M.dslDevMode),L(5),xe(M.dslTurns.length?39:-1),L(),ot("autoScroll",!0),L(),xe(!M.dslTurns.length&&!M.dslGenerating?41:-1),L(),xt(M.dslTurns),L(2),xe(M.dslPendingPrompt?44:-1),L(),xe(M.dslGenerating?45:-1),L(),ot("placeholder","Describe a change to this query\u2026")("value",M.dslPromptText)("disabled",M.dslGenerating||M.dslApplying)("maxRows",6)("submitOnEnter",!0),L(5),It("disabled",M.dslApplying?"":null),L(2),It("loading",M.dslApplying?"":null)("disabled",!M.dslDirty||!M.dslValidity.ok||M.dslApplying||M.dslGenerating?"":null),L(2),ot("open",M.forecastSettingsWidgetId!==null),L(),xe(M.forecastDraft?56:-1),L(),xe(M.detailPanel&&M.detail.isOpen()?57:-1)}},dependencies:()=>[i,Go,H5,wj,Jat,$at,Gh,OB,l3,a3,Om,ZI,b3,Q3,eE,I3,ast],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;height:100%;min-height:100%;position:relative}shared-filter-rail[_ngcontent-%COMP%]{position:sticky;top:0;z-index:var(--z-sticky, 10);display:block}[_nghost-%COMP%]:has(.canvas-wrap:not(.view-mode)){width:100%;min-width:100%}.canvas-wrap[_ngcontent-%COMP%]{min-height:0;height:100%;border-radius:var(--ng-radius-xl, 12px);width:100%;min-width:100%;box-sizing:border-box;padding:8px;background-color:var(--ng-colors-bg-brand-primary);background-image:radial-gradient(circle,var(--ng-colors-bg-brand-secondary) 1px,transparent 1px);background-size:24px 24px;box-shadow:inset 0 2px 8px #0000000a;transition:background .25s ease}[_nghost-%COMP%] gridster{min-height:0;height:100%;max-height:100%;background:transparent!important;border-radius:var(--ng-radius-xl, 12px)}.auto-height[_nghost-%COMP%] gridster{overflow:visible!important;max-height:none;min-height:0}.auto-height[_nghost-%COMP%]{height:auto;min-height:0}[_nghost-%COMP%] gridster .gridster-row{border-top:1px solid var(--ng-colors-bg-brand-secondary)!important;border-bottom:1px solid var(--ng-colors-bg-brand-secondary)!important}[_nghost-%COMP%] gridster .gridster-column{border-left:1px solid var(--ng-colors-bg-brand-secondary)!important;border-right:1px solid var(--ng-colors-bg-brand-secondary)!important}.grid-hidden[_ngcontent-%COMP%]{display:none!important}.canvas-wrap.view-mode[_ngcontent-%COMP%]{box-shadow:none;padding-left:12px;background-image:none;background-color:transparent;width:100%}.canvas-wrap.view-mode[_ngcontent-%COMP%] gridster{border-color:transparent;box-shadow:none;gap:0}[_nghost-%COMP%] gridster-item{overflow:visible;background:transparent!important;border-radius:var(--ng-radius-xl, 12px)}[_nghost-%COMP%] .gridster-item-resizable-handler{z-index:var(--z-sticky)}.widget-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;min-height:0;border-radius:var(--ng-radius-xl, 12px);background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));box-shadow:var(--ng-shadow-sm);overflow:hidden;transition:box-shadow var(--ng-transition-duration-default, .25s) ease;position:relative}.loading-grid[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;padding:8px}.loading-grid__kpis[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}@media(max-width:900px){.loading-grid__kpis[_ngcontent-%COMP%]{grid-template-columns:repeat(2,minmax(0,1fr))}}.loading-grid__charts[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}@media(max-width:900px){.loading-grid__charts[_ngcontent-%COMP%]{grid-template-columns:1fr}}.sk-card[_ngcontent-%COMP%]{padding:16px;gap:10px}.sk-card--kpi[_ngcontent-%COMP%]{min-height:128px}.sk-card--chart[_ngcontent-%COMP%]{min-height:300px}.sk-card__value[_ngcontent-%COMP%]{margin-top:auto}.sk-bars[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-end;gap:8px;min-height:0;margin-top:8px}.sk-bars[_ngcontent-%COMP%] .sk-bar[_ngcontent-%COMP%]{flex:1}.sk-legend[_ngcontent-%COMP%]{display:flex;gap:12px;margin-top:12px}.sk-legend[_ngcontent-%COMP%] nile-skeleton-loader[_ngcontent-%COMP%]{flex:0 0 64px}.widget-drag-handle[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:var(--ng-spacing-1);border-radius:var(--ng-radius-md);color:var(--ng-colors-text-tertiary-600);cursor:grab;opacity:0;transition:opacity .15s ease,background .15s ease,color .15s ease}.widget-drag-handle[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.widget-drag-handle[_ngcontent-%COMP%]:active{cursor:grabbing}.widget-drag-handle[_ngcontent-%COMP%] .drag-icon[_ngcontent-%COMP%]{display:inline-flex}.widget-card[_ngcontent-%COMP%]:hover .widget-drag-handle[_ngcontent-%COMP%], .widget-card[_ngcontent-%COMP%]:focus-within .widget-drag-handle[_ngcontent-%COMP%], .widget-drag-handle[_ngcontent-%COMP%]:active{opacity:1}.widget-select[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;height:24px}.widget-menu-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;height:24px;padding:0 2px;border:0;outline:0;background:transparent;color:var(--ng-colors-text-tertiary-600);cursor:pointer;transition:color .15s}.widget-menu-btn[_ngcontent-%COMP%]:hover, .widget-menu-btn[_ngcontent-%COMP%]:focus, .widget-menu-btn[_ngcontent-%COMP%]:focus-visible, .widget-menu-btn[_ngcontent-%COMP%]:active{background:transparent;outline:0;color:var(--ng-colors-text-primary-900)}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-body[_ngcontent-%COMP%]{filter:grayscale(1)}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-card__filter-overlay[_ngcontent-%COMP%]{position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;background:#fff9;cursor:not-allowed}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-card__filter-overlay-label[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;max-width:calc(100% - 32px);color:var(--ng-colors-border-warning);font-size:12px;font-weight:500}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-card__filter-note[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-body[_ngcontent-%COMP%], .widget-card--filter-inactive[_ngcontent-%COMP%] .widget-drag-handle[_ngcontent-%COMP%], .widget-card--filter-inactive[_ngcontent-%COMP%] .widget-menu__trigger[_ngcontent-%COMP%]{pointer-events:none}.widget-body[_ngcontent-%COMP%]{flex:1;min-height:0;overflow:hidden}.widget-card--filter[_ngcontent-%COMP%], .widget-card--filter[_ngcontent-%COMP%] .widget-body[_ngcontent-%COMP%], .widget-card--filter[_ngcontent-%COMP%] shared-nile-chart-widget[_ngcontent-%COMP%]{overflow:visible}.widget-body--hidden[_ngcontent-%COMP%]{display:none}.widget-card__manual[_ngcontent-%COMP%]{flex:1;min-height:0}.widget-card__manual-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:var(--ng-spacing-lg);padding:var(--nile-spacing-xl, var(--ng-spacing-xl)) var(--nile-spacing-3xl, var(--ng-spacing-3xl)) var(--nile-spacing-lg, var(--ng-spacing-lg));border-bottom:1px solid var(--ng-colors-border-secondary)}.widget-card__manual-titles[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-width:0;flex:1 1 auto}.widget-card__manual-title[_ngcontent-%COMP%]{margin:0;font-family:var(--ng-font-family-display);font-size:var(--ng-font-size-text-l);font-weight:var(--ng-font-weight-semibold);color:var(--ng-colors-text-primary-900);line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;width:100%}.widget-card__manual-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--ng-spacing-xs);flex-shrink:0;margin-right:calc(-1 * var(--ng-spacing-1))}.widget-card__kebab[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:var(--ng-spacing-1);border:none;border-radius:var(--ng-radius-md);background:transparent;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.widget-card__kebab[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.widget-card__filter-footer[_ngcontent-%COMP%]{position:absolute;right:var(--ng-spacing-3);bottom:var(--ng-spacing-1-5);z-index:1;display:flex;align-items:center;gap:var(--ng-spacing-2);justify-content:flex-end;pointer-events:none}.widget-card__mode-link[_ngcontent-%COMP%]{font-size:12px;cursor:pointer;pointer-events:auto;color:var(--ng-colors-fg-brand-primary-600)}.widget-card__mode-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:calc(100vh - var(--db-toolbar-height, 56px) - 128px);padding:var(--ng-spacing-12, 48px) var(--ng-spacing-6, 24px);text-align:center;gap:var(--ng-spacing-3, 12px)}.empty-icon-wrap[_ngcontent-%COMP%]{margin-bottom:var(--ng-spacing-3, 12px)}.empty-state__graphic[_ngcontent-%COMP%]{width:380px;max-width:100%;height:140px;margin-bottom:var(--ng-spacing-4, 16px);display:block;cursor:pointer;border-radius:12px;outline:none;transition:transform .15s ease,filter .15s ease}.empty-state__graphic[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{display:block;width:100%;height:100%}.empty-state__graphic[_ngcontent-%COMP%]:hover, .empty-state__graphic[_ngcontent-%COMP%]:focus-visible{transform:translateY(-2px);filter:drop-shadow(0 6px 18px rgba(0,94,166,.18))}.empty-state[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:var(--ng-font-size-text-xl, 20px);font-weight:var(--ng-font-weight-semibold, 600);color:var(--ng-colors-text-primary-900)}.empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:var(--ng-font-size-text-sm, 14px);color:var(--ng-colors-text-tertiary-600);max-width:380px;line-height:1.6}.tweak-dialog[_ngcontent-%COMP%]::part(panel){width:520px;max-width:92vw;border-radius:14px}.tweak-dialog__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;padding:4px 0 12px}.tweak-dialog__hint[_ngcontent-%COMP%]{margin:0;font-size:13px;color:var(--ng-colors-text-tertiary-600);line-height:1.5}.tweak-dialog__examples[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.tweak-dialog__example[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--ng-colors-border-secondary);border-radius:10px;background:var(--ng-colors-bg-primary);color:var(--ng-colors-text-secondary-700);font-size:12px;font-weight:500;text-align:left;cursor:pointer;transition:border-color .15s,background .15s,color .15s}.tweak-dialog__example[_ngcontent-%COMP%]:hover{border-color:var(--ng-colors-border-brand);color:var(--ng-colors-border-brand);background:var(--ng-colors-bg-brand-primary)}.tweak-dialog__example[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand);flex-shrink:0}.tweak-dialog__example[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tweak-dialog__input[_ngcontent-%COMP%]{width:100%;min-height:96px;padding:10px 12px;border:1px solid var(--ng-colors-border-secondary);border-radius:10px;background:var(--ng-colors-bg-primary);font:inherit;font-size:14px;color:var(--ng-colors-text-primary-900);resize:vertical;box-sizing:border-box;outline:0;transition:border-color .15s,box-shadow .15s}.tweak-dialog__input[_ngcontent-%COMP%]:focus{border-color:var(--ng-colors-border-brand);box-shadow:0 0 0 3px #2970ff26}.tweak-dialog__footer[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:8px}.widget-header-btn[_ngcontent-%COMP%]{position:relative;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;margin:0 2px;box-sizing:border-box;border:none;border-radius:6px;background:transparent;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.widget-header-btn[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.widget-header-btn--hidden-anchor[_ngcontent-%COMP%]{width:0;height:0;padding:0;margin:0;opacity:0;pointer-events:none;overflow:hidden}.widget-header-dropdown[_ngcontent-%COMP%]{width:0;margin-left:calc(-1 * var(--ng-spacing-xs, 4px))}.widget-header-dropdown[_ngcontent-%COMP%]::part(panel){width:320px;max-width:92vw;overflow-y:auto}.type-picker__panel[_ngcontent-%COMP%], .filter-builder__panel[_ngcontent-%COMP%], .color-picker__panel[_ngcontent-%COMP%]{background:var(--ng-colors-bg-primary);border:1px solid var(--ng-colors-border-secondary);border-radius:12px;box-shadow:0 8px 24px #10182824;padding:10px;box-sizing:border-box;max-height:min(70vh,var(--auto-size-available-height, 70vh));overflow-y:auto}.inline-action__loading[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:8px;min-height:56px;font-size:13px;color:var(--ng-colors-text-tertiary-600)}.inline-action__hint[_ngcontent-%COMP%]{margin:0 0 6px;font-size:12px;color:var(--ng-colors-text-tertiary-600)}.inline-action__error[_ngcontent-%COMP%]{margin:6px 0 0;font-size:12px;color:var(--ng-colors-text-error-primary-600)}.type-picker__section[_ngcontent-%COMP%]{margin:14px 0 6px;font-size:11px;font-weight:600;letter-spacing:.02em;text-transform:uppercase;color:var(--ng-colors-text-tertiary-600)}.type-picker__section[_ngcontent-%COMP%]:first-child{margin-top:0}.type-picker__grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.type-picker__tile[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:8px 4px;box-sizing:border-box;height:60px;position:relative;border:1px solid var(--ng-colors-border-secondary);border-radius:8px;background:var(--ng-colors-bg-primary);color:var(--ng-colors-text-secondary-700);font-size:11px;font-weight:500;cursor:pointer}.type-picker__tile[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-text-quaternary-500)}.type-picker__tile[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--ng-colors-border-brand);color:var(--ng-colors-border-brand)}.type-picker__tile[_ngcontent-%COMP%]:hover:not(:disabled) nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand)}.type-picker__tile[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--ng-colors-border-brand);outline-offset:1px}.type-picker__tile[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.type-picker__tile--sensible[_ngcontent-%COMP%]{border-color:var(--ng-colors-bg-brand-secondary);background:var(--ng-colors-bg-brand-primary)}.type-picker__tile--sensible[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand)}.type-picker__tile--current[_ngcontent-%COMP%]{border-color:var(--ng-colors-bg-brand-solid);background:var(--ng-colors-bg-brand-solid);color:var(--ng-colors-text-white);font-weight:600}.type-picker__tile--current[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-white)}.type-picker__tile--current[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--ng-colors-bg-brand-solid-hover);background:var(--ng-colors-bg-brand-solid);color:var(--ng-colors-text-white)}.type-picker__tile--current[_ngcontent-%COMP%]:hover:not(:disabled) nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-white)}.type-picker__tile--current[_ngcontent-%COMP%]:after{content:"";position:absolute;top:5px;right:7px;width:4px;height:8px;border:solid var(--ng-colors-fg-white);border-width:0 1.5px 1.5px 0;transform:rotate(45deg)}.color-picker__row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:6px 4px;border-radius:6px;cursor:pointer}.color-picker__row[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-tertiary)}.color-picker__swatch-input[_ngcontent-%COMP%]{display:inline-flex;width:22px;height:22px;border-radius:6px;overflow:hidden;border:1px solid var(--ng-colors-border-secondary);flex:0 0 auto}.color-picker__swatch-input[_ngcontent-%COMP%] input[type=color][_ngcontent-%COMP%]{width:100%;height:100%;padding:0;border:none;cursor:pointer}.color-picker__swatch-input[_ngcontent-%COMP%] input[type=color][_ngcontent-%COMP%]::-webkit-color-swatch-wrapper{padding:0}.color-picker__swatch-input[_ngcontent-%COMP%] input[type=color][_ngcontent-%COMP%]::-webkit-color-swatch{border:none}.color-picker__swatch-input[_ngcontent-%COMP%] input[type=color][_ngcontent-%COMP%]::-moz-color-swatch{border:none}.color-picker__name[_ngcontent-%COMP%]{font-size:13px;color:var(--ng-colors-text-secondary-700)}.widget-menu__trigger[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:var(--ng-spacing-1);border:none;border-radius:var(--ng-radius-md);background:transparent;color:var(--ng-colors-text-tertiary-600);cursor:pointer}.widget-menu__trigger[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.widget-menu[_ngcontent-%COMP%]{display:contents}.widget-menu__item[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{flex:none;color:var(--ng-colors-text-tertiary-600)}.widget-menu__group--empty[_ngcontent-%COMP%]{display:none}nile-context-menu-group.widget-menu__group.widget-menu__group--first[_ngcontent-%COMP%]:before{display:none}.widget-menu__story-new[_ngcontent-%COMP%]::part(item){border-top:var(--ng-stroke-width-1) solid var(--ng-colors-border-secondary);color:var(--ng-colors-fg-brand-primary-600);font-weight:var(--ng-font-weight-semibold)}.widget-header-dropdown[_ngcontent-%COMP%]::part(base){display:block}.widget-header-dropdown[_ngcontent-%COMP%]::part(panel){z-index:var(--z-popover, 700)}.widget-card--menu-open[_ngcontent-%COMP%]{overflow:visible;z-index:1}.gridster-item--menu-open[_ngcontent-%COMP%]{z-index:var(--z-popover, 700)!important}.widget-card--menu-open[_ngcontent-%COMP%] nile-chart::part(chart-card){clip-path:none}.story-picker__panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:264px;box-sizing:border-box;padding:10px;background:var(--ng-colors-bg-primary);border:1px solid var(--ng-colors-border-secondary);border-radius:var(--ng-radius-lg);max-height:min(60vh,var(--auto-size-available-height, 60vh))}.story-picker__section[_ngcontent-%COMP%]{margin:0 0 6px;font-size:var(--ng-font-size-text-xs);font-weight:var(--ng-font-weight-semibold);letter-spacing:.02em;text-transform:uppercase;color:var(--ng-colors-text-tertiary-600)}.story-picker__list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;overflow-y:auto;min-height:0}.story-picker__row[_ngcontent-%COMP%], .story-picker__new[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;width:100%;padding:7px 8px;box-sizing:border-box;border:none;border-radius:var(--ng-radius-md);background:transparent;color:var(--ng-colors-text-secondary-700);font-size:var(--ng-font-size-text-sm);text-align:left;cursor:pointer}.story-picker__row[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%], .story-picker__new[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-text-tertiary-600);flex:none}.story-picker__row[_ngcontent-%COMP%]:hover:not(:disabled), .story-picker__new[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.story-picker__row[_ngcontent-%COMP%]:disabled, .story-picker__new[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.story-picker__name[_ngcontent-%COMP%]{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.story-picker__count[_ngcontent-%COMP%]{flex:none;font-size:var(--ng-font-size-text-xs);color:var(--ng-colors-text-tertiary-600)}.story-picker__new[_ngcontent-%COMP%]{margin-top:6px;padding-top:10px;border-top:1px solid var(--ng-colors-border-secondary);border-radius:0;color:var(--ng-colors-fg-brand-primary-600);font-weight:var(--ng-font-weight-semibold)}.story-picker__new[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-brand-primary-600)}.filter-builder__active[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}.filter-builder__chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border-radius:999px;background:var(--ng-colors-bg-brand-primary);color:var(--ng-colors-text-secondary-700);font-size:12px}.filter-builder__chip-remove[_ngcontent-%COMP%]{display:inline-flex;border:none;background:none;padding:0;cursor:pointer;color:inherit}.filter-builder__quick-time[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}.filter-builder__quick-time-chip[_ngcontent-%COMP%]{padding:4px 9px;border-radius:999px;border:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary);color:var(--ng-colors-text-secondary-700);font-size:12px;cursor:pointer}.filter-builder__quick-time-chip[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--ng-colors-border-brand);color:var(--ng-colors-border-brand)}.filter-builder__quick-time-chip[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.filter-builder__form[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.filter-builder__select[_ngcontent-%COMP%], .filter-builder__input[_ngcontent-%COMP%]{flex:1 1 100%;min-width:0;padding:7px 8px;box-sizing:border-box;border:1px solid var(--ng-colors-border-secondary);border-radius:7px;background:var(--ng-colors-bg-primary);font:inherit;font-size:12px;color:var(--ng-colors-text-primary-900)}.filter-builder__field-label[_ngcontent-%COMP%]{padding:6px 2px;font-size:12px;font-weight:600;color:var(--ng-colors-text-primary-900)}.filter-builder__and[_ngcontent-%COMP%]{font-size:12px;color:var(--ng-colors-text-tertiary-600)}.filter-builder__multi[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;max-height:160px;overflow-y:auto;width:100%}.filter-builder__multi-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px;padding:4px 2px;font-size:12px;color:var(--ng-colors-text-secondary-700);cursor:pointer}.filter-builder__multi-item[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.filter-builder__add-btn[_ngcontent-%COMP%]{flex:0 0 auto;align-self:flex-start;position:sticky;bottom:0;background:var(--ng-colors-bg-primary);padding-top:4px;z-index:1}.filter-builder__add-btn[_ngcontent-%COMP%]::part(base){padding:4px 10px;font-size:12px;min-height:0}.inline-action__loading--compact[_ngcontent-%COMP%]{min-height:0;justify-content:flex-start;gap:6px;font-size:12px}.drill-context-menu[_ngcontent-%COMP%]{display:contents}.filter-explanation[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--ng-spacing-xs, 4px);margin:0 0 var(--ng-spacing-sm, 8px);color:var(--ng-colors-text-tertiary-600);font-size:var(--ng-font-size-text-xs);line-height:1.4}.filter-explanation__text[_ngcontent-%COMP%]{min-width:0}.drill-context-menu__anchor[_ngcontent-%COMP%]{position:fixed;display:inline-block;width:0;height:0}.dsl-editor-drawer[_ngcontent-%COMP%]::part(base){z-index:var(--z-drawer, 900);left:var(--sidebar-width, 250px);width:calc(100vw - var(--sidebar-width, 250px));transition:left .25s ease,width .25s ease}.dsl-editor-drawer[_ngcontent-%COMP%]::part(overlay){left:var(--sidebar-width, 250px);transition:left .25s ease}.dsl-editor-drawer[_ngcontent-%COMP%]::part(panel){width:100%;max-width:none}.dsl-editor-drawer[_ngcontent-%COMP%]::part(header){align-items:flex-start;padding:14px 20px;border-bottom:1px solid var(--ng-colors-border-secondary)}.dsl-editor-drawer[_ngcontent-%COMP%]::part(body){padding:0;overflow:hidden}.dsl-editor-drawer[_ngcontent-%COMP%]::part(footer){padding:12px 20px;border-top:1px solid var(--ng-colors-border-secondary)}.dsl-editor-drawer__label[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:3px;min-width:0}.dsl-editor-drawer__title-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;min-width:0}.dsl-editor-drawer__title[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:var(--ng-colors-text-primary-900);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsl-editor-drawer__badge[_ngcontent-%COMP%]{flex:0 0 auto;padding:1px 7px;border:1px solid var(--ng-colors-border-secondary);border-radius:6px;background:var(--ng-colors-bg-secondary);font-size:11px;font-weight:500;color:var(--ng-colors-text-tertiary-600);white-space:nowrap}.dsl-editor-drawer__header-actions[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px}.dsl-editor-drawer__body[_ngcontent-%COMP%]{display:flex;align-items:stretch;height:100%;min-height:0;--dsl-toolbar-h: 42px}.dsl-pane[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-height:0}.dsl-pane--query[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0}.dsl-pane--assistant[_ngcontent-%COMP%]{flex:0 0 380px;width:380px;border-left:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-secondary, #fcfcfd)}.dsl-pane--assistant.dsl-pane--assistant-full[_ngcontent-%COMP%]{flex:1 1 auto;width:auto;border-left:none}@media(max-width:1024px){.dsl-pane--assistant[_ngcontent-%COMP%]{flex-basis:320px;width:320px}}.dsl-pane__toolbar[_ngcontent-%COMP%]{flex:0 0 var(--dsl-toolbar-h, 42px);height:var(--dsl-toolbar-h, 42px);box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 16px;border-bottom:1px solid var(--ng-colors-border-secondary)}.dsl-pane__toolbar-label[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--ng-colors-text-secondary-700)}.dsl-pane__toolbar-actions[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:4px}.dsl-pane__toolbar-meta[_ngcontent-%COMP%]{font-size:11.5px;color:var(--ng-colors-text-tertiary-600)}.dsl-tool-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border:0;border-radius:6px;background:transparent;font:inherit;font-size:12px;color:var(--ng-colors-text-secondary-700);cursor:pointer;transition:background .12s}.dsl-tool-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--ng-colors-bg-secondary)}.dsl-tool-btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.dsl-validity[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:5px;margin-left:4px;padding:3px 9px;border-radius:999px;background:var(--ng-colors-bg-error-primary);font-size:11.5px;font-weight:500;color:var(--ng-colors-text-error-primary-hover);white-space:nowrap}.dsl-validity.dsl-validity--ok[_ngcontent-%COMP%]{background:var(--ng-colors-bg-success-primary);color:var(--ng-componentcolors-utility-success-700)}.dsl-pane__editor[_ngcontent-%COMP%]{display:block;flex:1 1 auto;min-height:160px;overflow:hidden}.dsl-pane__editor[_ngcontent-%COMP%]::part(code-editor-base){height:100%;overflow-y:auto;box-sizing:border-box;border:0;border-radius:0}.dsl-pane__error[_ngcontent-%COMP%]{flex:0 0 auto;display:flex;align-items:flex-start;gap:8px;padding:10px 16px;border-top:1px solid var(--ng-colors-border-error-subtle);background:var(--ng-colors-bg-error-primary);color:var(--ng-colors-text-error-primary-hover);font-size:12.5px;line-height:1.45}.dsl-pane__error[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{flex:0 0 auto;margin-top:1px}.dsl-pane__error--global[_ngcontent-%COMP%]{border-top:none;border-bottom:1px solid var(--ng-colors-border-error-subtle)}.dsl-pane__error-text[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0;word-break:break-word}.dsl-pane__error-dismiss[_ngcontent-%COMP%]{flex:0 0 auto;padding:2px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer}.dsl-pane__error-dismiss[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-error-primary)}.dsl-chat[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;display:block}.dsl-chat[_ngcontent-%COMP%]::part(viewport){padding:14px 12px}.dsl-chat[_ngcontent-%COMP%]::part(messages){gap:12px}.dsl-chat[_ngcontent-%COMP%]::part(footer){padding:10px 12px;border-top:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary)}.dsl-chat__empty[_ngcontent-%COMP%]{margin:0 4px;font-size:12.5px;line-height:1.5;color:var(--ng-colors-text-tertiary-600)}.dsl-bubble--ai[_ngcontent-%COMP%]::part(message){display:flex;flex-direction:column;gap:8px}.dsl-bubble--user[_ngcontent-%COMP%]::part(message){font-size:12.5px;line-height:1.45}.dsl-turn__summary[_ngcontent-%COMP%]{margin:0 0 6px;font-size:13px;line-height:1.5;color:var(--ng-colors-text-primary-900)}.dsl-turn__diff[_ngcontent-%COMP%]{max-height:220px;overflow-y:auto;overflow-x:hidden;border:1px solid var(--ng-colors-border-secondary);border-radius:8px;background:var(--ng-colors-bg-primary);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;line-height:1.55}.dsl-diff-line[_ngcontent-%COMP%]{display:flex;gap:6px;padding:1px 8px;white-space:pre-wrap;overflow-wrap:anywhere}.dsl-diff-line--add[_ngcontent-%COMP%]{background:var(--ng-colors-bg-success-primary);color:var(--ng-componentcolors-utility-success-700)}.dsl-diff-line--remove[_ngcontent-%COMP%]{background:var(--ng-colors-bg-error-primary);color:var(--ng-colors-text-error-primary-hover)}.dsl-diff-line--context[_ngcontent-%COMP%]{color:var(--ng-colors-text-tertiary-600)}.dsl-diff-line__sign[_ngcontent-%COMP%]{flex:0 0 auto;width:8px;opacity:.75}.dsl-diff-line__text[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0}.dsl-turn__actions[_ngcontent-%COMP%]{display:block}.dsl-turn__actions[_ngcontent-%COMP%]::part(base){align-items:center;gap:2px}.dsl-turn__action[_ngcontent-%COMP%]{padding:3px 6px;border:0;border-radius:6px;background:transparent;font:inherit;font-size:11.5px;color:var(--ng-colors-fg-brand-primary-600);cursor:pointer;transition:background .12s}.dsl-turn__action[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--ng-colors-bg-brand-primary)}.dsl-turn__action[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.dsl-composer[_ngcontent-%COMP%]{display:block}.dsl-composer[_ngcontent-%COMP%]::part(textarea){font-size:13px}.dsl-editor-drawer__footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%}.dsl-editor-drawer__footer-note[_ngcontent-%COMP%]{font-size:12px;color:var(--ng-colors-text-tertiary-600)}.dsl-editor-drawer__footer-actions[_ngcontent-%COMP%]{display:inline-flex;gap:8px}.fc-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.fc-label[_ngcontent-%COMP%]{font-size:14px;font-weight:600;color:var(--ng-colors-text-primary-900);margin-top:12px}.fc-label[_ngcontent-%COMP%]:first-child{margin-top:0}.fc-hint[_ngcontent-%COMP%]{font-size:13px;color:var(--ng-colors-text-tertiary-600);margin:0 0 4px}.fc-range[_ngcontent-%COMP%]{width:100%;accent-color:var(--ng-colors-bg-brand-solid, #7a5af8)}.fc-seg[_ngcontent-%COMP%]{display:flex;gap:4px;background:var(--ng-colors-bg-secondary);border-radius:8px;padding:3px}.fc-seg__btn[_ngcontent-%COMP%]{flex:1;border:0;background:transparent;border-radius:6px;padding:6px 8px;font:inherit;font-size:13px;color:var(--ng-colors-text-secondary-700);cursor:pointer}.fc-seg__btn--on[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-solid, #7a5af8);color:var(--ng-colors-text-white);font-weight:600}.fc-actions[_ngcontent-%COMP%]{display:inline-flex;gap:8px}.fc-fact[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:12px;margin-top:6px;font-size:12px;color:var(--ng-colors-text-quaternary-500)}.fc-fact[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:var(--ng-colors-text-secondary-700);font-weight:600}']})};function pPt(i){return i.config?._meta?.evidence?.openable!==!1}var B3="https://ui-cdn.dev.aqueralabs.com/maps",LPt={"custom/world":`${B3}/world.topo.json`,"custom/us-states":`${B3}/us-all.topo.json`,"custom/us-counties":`${B3}/us-counties.topo.json`,"custom/europe":`${B3}/europe.topo.json`},uF=new Map,elt=new WeakMap;function OPt(i){let e=uF.get(i);return e||(e=fetch(i).then(t=>{if(!t.ok)throw uF.delete(i),new Error(`Failed to fetch topo ${i}: ${t.status}`);return t.json()}),uF.set(i,e)),e}async function cF(i){if(typeof i!="string"||i==="none")return;let e=LPt[i];if(e)try{return await OPt(e)}catch(t){console.error("[map-topo] fetch failed:",t);return}}async function qst(i){if(typeof i.mapData!="string")return;let e=i.mapData,t=await cF(e);if(t===void 0){delete i.mapData;return}elt.set(i,e),i.mapData=t}async function Rl(i){let e=i?.chart;if(!e||e.type!=="map")return;let t=[qst(e)];for(let M of e.options?.series??[])t.push(qst(M));await Promise.all(t)}async function tlt(i){await Promise.all(i.map(e=>Rl(e.config??null)))}function Kst(i){if(typeof i.mapData=="string"||i.mapData==null)return x({},i);let e=elt.get(i);return e===void 0?x({},i):U(x({},i),{mapData:e})}function CA(i){let e=i?.chart;if(!e||e.type!=="map")return i;let t=e.options?.series,M=Array.isArray(t)?t.map(Kst):t,n=x(x({},Kst(e)),e.options!==void 0?{options:x(x({},e.options),M!==void 0?{series:M}:{})}:{});return U(x({},i),{chart:n})}function ilt(i){let e=i;return e?.chart?.type!=="filter"||!Array.isArray(e.chart.controls)?i:U(x({},i),{chart:U(x({},e.chart),{controls:e.chart.controls.map(t=>U(x({},t),{value:""}))})})}function tE(i,e){let t=Array.isArray(i)?i:[],M=Array.isArray(e)?e:[],n=t.length;if(n===0)return{perField:[],anyPartial:!1};let r=M.map(({field:a,label:s})=>{let l=[],N=0;for(let c of t){let D=Array.isArray(c.skippedFilters)&&c.skippedFilters.includes(a),I=c.edited===!1||c.filterApplied===!1;D||I?l.push(c.title||c.id):(c.filterApplied===!0||c.edited===!0)&&(N+=1)}return{field:a,label:s||a,appliedCount:N,total:n,skippedWidgetTitles:l}}),o=r.some(a=>a.skippedWidgetTitles.length>0);return{perField:r,anyPartial:o}}function F3(i,e,t){let M=t?.timeRange?{timeRange:t.timeRange}:{};return t?.resolvedFilters?x({widgets:i,attribute:"attribute",filters:t.resolvedFilters},M):t?.mode==="prompt"&&typeof t.prompt=="string"&&t.prompt.trim()!==""?x({widgets:i,attribute:"prompt",prompt:t.prompt},M):x({widgets:i,filters:e},M)}function mPt(i,e){let t=new Map;for(let M of e)M?.id&&t.set(M.id,M);return i.map(M=>{let n=M?.id?t.get(M.id):void 0;if(n){let r=n.config,o=M.config;return U(x(x({},M),n),{config:r??o})}return Mlt(M)})}function Mlt(i){if(!("edited"in i||"reason"in i||"filterApplied"in i||"filteredRowCount"in i||"partial"in i||"skippedFilters"in i))return i;let l=i,{edited:t,reason:M,filterApplied:n,filteredRowCount:r,partial:o,skippedFilters:a}=l;return $e(l,["edited","reason","filterApplied","filteredRowCount","partial","skippedFilters"])}function EPt(i,e,t){let M=i.filter(a=>!t(a)),n=M.length===e.length,r=new Set,o=new Map;return e.forEach((a,s)=>{let l;if(a.title&&(l=i.find(N=>N.title===a.title&&!r.has(N.id))),!l&&n){let N=M[s];l=N&&!r.has(N.id)?N:void 0}l&&(r.add(l.id),o.set(l.id,a))}),o}var DF="dashboard-filter";function IF(){return{id:DF,title:"Filters",widgetType:"chart",componentName:"nile-filter-widget",layout:{x:0,y:0,w:12,h:2},summary:"Filter every widget on this dashboard.",config:{aq:{autocomplete:[]},chart:{type:"filter",controls:[{id:DF,label:"",description:"",value:"",defaultValue:"",autoApply:!1,selection:"single",variant:"prompt",showClearIcon:!0,suggestions:[],suggestionInsert:"replace",typeSpeedMs:60,pauseBeforeDeleteMs:1400,pauseBetweenMs:400,promptPlaceholders:["Filter by any field\u2026"],expressionPlaceholders:['field == "value"'],queryLanguage:{enabled:!1}}]}}}}function Ug(i){return i.config?.chart?.type==="filter"||i.componentName==="nile-filter-widget"}function jF(i,e=2,t=12){let M=i.reduce((a,s)=>Ug(s)?a+1:a,0);if(M===0)return i;let n=Array.from({length:M},(a,s)=>({x:0,y:s*e,w:t,h:e})),r=[...n],o=0;return i.map(a=>{if(Ug(a))return U(x({},a),{layout:n[o++]});if(!a.layout)return a;let{x:s,w:l,h:N}=a.layout,c=a.layout.y,D=!0;for(;D;){D=!1;for(let d of r)s<d.x+d.w&&s+l>d.x&&c<d.y+d.h&&c+N>d.y&&(c=d.y+d.h,D=!0)}let I={x:s,y:c,w:l,h:N};return r.push(I),U(x({},a),{layout:I})})}function fPt(i){if(Ug(i))return"filter";let e=i.config?.chart?.type;return i.componentName==="nile-kpi-chart"||e==="kpi"||i.widgetType==="kpi"?"kpi":i.componentName==="nile-data-grid"||e==="grid"||i.widgetType==="grid"?"grid":"chart"}var SPt=10,wPt=88,CPt=40,kPt=48,bPt=3,QPt=8;function UPt(i){let e=i.config?.chart,t=Number(e?.pagination?.pageSize)||SPt,M=e?.serverPagination===!0&&typeof e?.gridId=="string",n=Number(e?.totalItems),r=e?.data,o=Number.isFinite(n)?n:M?null:Array.isArray(r)?r.length:null,a=o==null?t:Math.min(o,t),s=wPt+a*CPt+kPt,l=Math.ceil(s/72);return Math.min(QPt,Math.max(bPt,l))}function vPt(i){let e=i.config?.chart?.sparkline;return Array.isArray(e)&&e.length>=2}function YPt(i){let e=i.config?.chart?.type;return i.componentName==="nile-master-detail-chart"||e==="master-detail"}function yF(i,e=12){let t=i.map(fPt),M=t.filter(Z=>Z==="filter").length,n=t.filter(Z=>Z==="kpi").length,r=0,o=r;r+=M*2;let a=r,s=n===2||n===3||n===4||n===6,l=s?n:Math.min(4,n),N=s?e/n:3,c=i.some((Z,B)=>t[B]==="kpi"&&vPt(Z))?3:2;r+=l?Math.ceil(n/l)*c:0;let D=4,I=Math.max(1,Math.floor(e/2)),d=[];{let Z=0,B=r;for(let q=0;q<i.length;q++)if(t[q]==="chart"){if(YPt(i[q])){Z!==0&&(Z=0,B+=D),d.push({x:0,y:B,w:e,h:D}),B+=D;continue}Z+I>e&&(Z=0,B+=D),d.push({x:Z,y:B,w:I,h:D}),Z+=I}if(Z===I){let q=d[d.length-1];q&&(q.w=e)}Z>0&&(B+=D),r=B}let y=r,A=i.filter((Z,B)=>t[B]==="grid").map(Z=>UPt(Z)),z=[];A.reduce((Z,B,q)=>(z[q]=Z,Z+B),0);let E=0,S=0,O=0,v=0;return i.map((Z,B)=>{let q;switch(t[B]){case"filter":{let W=E++;q={x:0,y:o+W*2,w:e,h:2};break}case"kpi":{let W=S++,Ne=Math.floor(W/l);q={x:W%l*N,y:a+Ne*c,w:N,h:c};break}case"grid":{let W=v++;q={x:0,y:y+z[W],w:e,h:A[W]};break}default:{q=d[O++];break}}return U(x({},Z),{layout:q})})}function dF(i,e){return!!i&&[i.x,i.y,i.w,i.h].every(Number.isFinite)&&i.x>=0&&i.y>=0&&i.w>0&&i.h>0&&i.x+i.w<=e}function ZPt(i,e){return i.x<e.x+e.w&&i.x+i.w>e.x&&i.y<e.y+e.h&&i.y+i.h>e.y}function iE(i,e=12){let t=i.map(n=>n.layout);return t.some(n=>!dF(n,e))||t.some((n,r)=>dF(n,e)&&t.slice(r+1).some(o=>dF(o,e)&&ZPt(n,o)))?yF(i,e):i}function H3(i,e){let t=i.config?.chart;return typeof t?.gridId!="string"||!t.gridId.startsWith("tpl:")?i:U(x({},i),{config:U(x({},i.config),{chart:U(x({},t),{gridId:e})})})}var M0=class i{stateSubject=new Ta(this.createEmpty("My Dashboard"));dirtySubject=new Ta(!1);mutationsSubject=new ya;filterBaseline=null;pendingLayoutBatch=null;layoutUndoStack=[];layoutRedoStack=[];static LAYOUT_HISTORY_LIMIT=50;canUndoLayoutSubject=new Ta(!1);canRedoLayoutSubject=new Ta(!1);state$=this.stateSubject.asObservable();dirty$=this.dirtySubject.asObservable();mutations$=this.mutationsSubject.asObservable();canUndoLayout$=this.canUndoLayoutSubject.asObservable();canRedoLayout$=this.canRedoLayoutSubject.asObservable();nothingToPublish$=df([this.state$,this.dirty$]).pipe(Tr(([e,t])=>e.version==="published"&&!t),GJ());get snapshot(){return this.stateSubject.value}get isDirty(){return this.dirtySubject.value}get canUndoLayout(){return this.canUndoLayoutSubject.value}get canRedoLayout(){return this.canRedoLayoutSubject.value}get isAutoGenerated(){return this.snapshot.isAutoGenerated===!0}setDashboardName(e){this.patchState({name:e.trim()||"Untitled Dashboard"})}setDashboardId(e){!e||this.snapshot.id===e||this.patchState({id:e})}addWidget(e,t){if("type"in e&&!("widgetType"in e))return this.addChartWidget(e);let M=e,n=this.snapshot.widgets,r=M.widgetType==="kpi"?2:4,o=M.widgetType==="kpi"?4:6,a=t?.placeExplicitly&&M.layout?M.layout:{x:0,y:this.computeMaxY(n,r),w:Math.min(Math.max(1,M.layout?.w||o),12),h:Math.max(1,M.layout?.h||r)},s=crypto.randomUUID(),l=U(x({},H3(M,s)),{id:s,layout:a}),N=[...n,l],c=!t?.placeExplicitly&&this.isFilterWidget(l)?this.normalizeFilterLayouts(N):N;return this.patchState({widgets:c}),l.id}addWidgets(e){if(!e.length)return[];let t=this.snapshot.widgets,M=t.some(N=>Ug(N)),n=M?e.filter(N=>!Ug(N)):e,r=n.filter(N=>!Ug(N)&&N.layout).map(N=>N.layout.y),o=M&&r.length?Math.min(...r):0,a=this.computeMaxY(t,0),s=[];for(let N of n){let c=N.widgetType==="kpi"?2:4,D=N.widgetType==="kpi"?4:6,I;Ug(N)?I={x:0,y:0,w:12,h:2}:N.layout?I={x:N.layout.x,y:N.layout.y-o+a,w:Math.min(Math.max(1,N.layout.w||D),12),h:Math.max(1,N.layout.h||c)}:I={x:0,y:this.computeMaxY([...t,...s],c),w:D,h:c};let d=crypto.randomUUID();s.push(U(x({},H3(N,d)),{id:d,layout:I}))}let l=this.normalizeFilterLayouts([...t,...s]);return this.patchState({widgets:l}),s.map(N=>N.id)}addChartWidget(e){let n=e,{title:t}=n,M=$e(n,["title"]);return this.addWidget({title:t,widgetType:"chart",config:{chart:M,aq:{}}})}addKpiWidget(e){return this.addWidget({title:e.label,widgetType:"kpi",config:{chart:e,aq:{}}})}updateWidget(e,t){let M=this.snapshot.widgets.map(n=>n.id===e?x(x({},n),t):n);this.patchState({widgets:M})}applyFilterView(e){if(!e.length)return;this.filterBaseline||(this.filterBaseline=this.snapshot.widgets.map(n=>x({},n)));let t=new Map(e.map(n=>[n.id,n])),M=this.snapshot.widgets.map(n=>{let r=t.get(n.id);return r?U(x(x({},n),r),{layout:n.layout??r.layout}):n});this.stateSubject.next(U(x({},this.snapshot),{widgets:M}))}restoreFilterBaseline(){if(!this.filterBaseline)return!1;let e=this.filterBaseline;return this.filterBaseline=null,this.stateSubject.next(U(x({},this.snapshot),{widgets:e})),!0}updateWidgetLayout(e,t){this.recordLayoutUndo(e);let M=this.snapshot.widgets.map(n=>n.id===e?U(x({},n),{layout:t}):n);this.patchState({widgets:M})}hasFilterWidget(){return this.snapshot.widgets.some(e=>Ug(e))}toggleFilterWidget(){let e=this.snapshot.widgets.find(r=>Ug(r));if(e){let r=e.layout,o=r?r.y+r.h:0,a=r?.h??0;this.patchState({widgets:this.snapshot.widgets.filter(s=>s.id!==e.id).map(s=>!s.layout||s.layout.y<o?s:U(x({},s),{layout:U(x({},s.layout),{y:Math.max(0,s.layout.y-a)})}))});return}let n=IF(),{id:t}=n,M=$e(n,["id"]);this.addWidget(M)}removeWidget(e){this.patchState({widgets:this.snapshot.widgets.filter(t=>t.id!==e)})}updateWidgetLayouts(e){if(!e.length)return;e.forEach(n=>this.recordLayoutUndo(n.id));let t=new Map(e.map(n=>[n.id,n.layout])),M=this.snapshot.widgets.map(n=>{let r=t.get(n.id);return r?U(x({},n),{layout:x({},r)}):n});this.patchState({widgets:M})}undoLayout(){let e=this.layoutUndoStack.pop();e&&(this.applyLayoutEntries(e,"before"),this.layoutRedoStack.push(e),this.syncLayoutHistoryFlags())}redoLayout(){let e=this.layoutRedoStack.pop();e&&(this.applyLayoutEntries(e,"after"),this.layoutUndoStack.push(e),this.syncLayoutHistoryFlags())}recordLayoutUndo(e){if(this.pendingLayoutBatch||(this.pendingLayoutBatch=new Map,queueMicrotask(()=>this.commitPendingLayoutBatch())),this.pendingLayoutBatch.has(e))return;let t=this.snapshot.widgets.find(M=>M.id===e)?.layout;t&&this.pendingLayoutBatch.set(e,t)}commitPendingLayoutBatch(){let e=this.pendingLayoutBatch;if(this.pendingLayoutBatch=null,!e||e.size===0)return;let t=[];for(let[M,n]of e){let r=this.snapshot.widgets.find(o=>o.id===M)?.layout;r&&!this.layoutsEqual(n,r)&&t.push({id:M,before:n,after:x({},r)})}t.length&&(this.layoutUndoStack.push(t),this.layoutUndoStack.length>i.LAYOUT_HISTORY_LIMIT&&this.layoutUndoStack.shift(),this.layoutRedoStack=[],this.syncLayoutHistoryFlags())}applyLayoutEntries(e,t){let M=new Map(e.map(r=>[r.id,r[t]])),n=this.snapshot.widgets.map(r=>{let o=M.get(r.id);return o?U(x({},r),{layout:x({},o)}):r});this.patchState({widgets:n})}layoutsEqual(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h}syncLayoutHistoryFlags(){this.canUndoLayoutSubject.next(this.layoutUndoStack.length>0),this.canRedoLayoutSubject.next(this.layoutRedoStack.length>0)}clearLayoutHistory(){this.pendingLayoutBatch=null,this.layoutUndoStack=[],this.layoutRedoStack=[],this.syncLayoutHistoryFlags()}replaceDashboard(e){let t=e.widgets.map((n,r)=>U(x({},n),{widgetType:n.widgetType??"chart",layout:n.layout??{x:0,y:r*4,w:n.widgetType==="kpi"?4:6,h:n.widgetType==="kpi"?2:4}})),M=U(x({},e),{widgets:iE(this.normalizeFilterLayouts(this.clampLayoutsToCols(t)))});this.filterBaseline=null,this.clearLayoutHistory(),this.stateSubject.next(M),this.dirtySubject.next(!1)}clampLayoutsToCols(e,t=12){let M=[];return e.map(n=>{let r=n.layout;if(!r)return n;let o=Math.max(1,Math.min(r.w,t)),a=Math.max(0,Math.min(r.x,t-o)),s=r.h,l=r.y,N=I=>M.some(d=>a<d.x+d.w&&a+o>d.x&&I<d.y+d.h&&I+s>d.y),c=Math.max(s,1);for(;N(l);)l+=c;let D={x:a,y:l,w:o,h:s};return M.push(D),U(x({},n),{layout:D})})}isFilterWidget(e){return Ug(e)}normalizeFilterLayouts(e,t=2,M=12){return jF(e,t,M)}resetDashboard(){this.filterBaseline=null,this.clearLayoutHistory(),this.stateSubject.next(this.createEmpty("My Dashboard")),this.dirtySubject.next(!1)}markClean(){this.stateSubject.next(U(x({},this.stateSubject.value),{version:"published"})),this.dirtySubject.next(!1)}createEmpty(e){return{id:crypto.randomUUID(),name:e,widgets:[],updatedAt:new Date().toISOString()}}computeMaxY(e,t){return e.reduce((M,n)=>{let r=n.layout?.y??0,o=n.layout?.h??t;return Math.max(M,r+o)},0)}patchState(e){let t=U(x(x({},this.snapshot),e),{updatedAt:new Date().toISOString()});this.stateSubject.next(t),this.dirtySubject.next(!0),this.mutationsSubject.next(t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var _Pt=6,WPt="__evidence-chart-data",PPt="Chart data";function RPt(i){return`${i}${WPt}`}var nlt={order:fA.CHART_DATA,contribute(i){let{columns:e,rows:t}=Gc(i.config?.chart);return t.length?[{id:RPt(i.id),title:PPt,widgetType:"chart",componentName:"nile-data-grid",config:{chart:{type:"grid",data:t,columns:e.map(M=>({accessorKey:M,header:M}))},aq:{}},layout:{x:0,y:0,w:12,h:_Pt}}]:[]}};var VPt="__evidence-provenance";function BPt(i){return`${i}${VPt}`}var rlt="How this was computed",FPt=[{accessorKey:"label",header:"Field"},{accessorKey:"text",header:"Value"}];function HPt(i){let e=[],t=i.config?.chart,M=t?.type;typeof M=="string"&&M&&e.push({label:"Chart type",text:M});let n=i.queryMeta,r=n?.indexName??n?.table;r&&e.push({label:"Source",text:r});let{rows:o}=Gc(t);return o.length&&e.push({label:"Rows",text:String(o.length)}),e}function JPt(i){if(!i)return[];let e=[...i0(i),...HPt(i)];return e.length?[{id:BPt(i.id),title:rlt,widgetType:"chart",componentName:"nile-data-grid",layout:{x:0,y:0,w:12,h:Math.max(2,e.length+1)},config:{chart:{type:"grid",columns:FPt.map(t=>x({},t)),data:e},aq:{chartTitle:rlt,ai:{enabled:!1}}}}]:[]}var olt={order:fA.PROVENANCE,contribute:i=>JPt(i)};var GPt="__evidence-records";function $Pt(i){return`${i}${GPt}`}var XPt="Records",qPt=2,KPt=8,e9t=i=>Math.min(KPt,Math.max(qPt,i+1));function t9t(i){let e=!!i.queryMeta?.sql,t=i.config?.chart?.type==="grid";return e&&!t}function i9t(i){if(!Array.isArray(i))return[];let e=[];for(let t of i){if(typeof t=="string"){e.push({accessorKey:t,header:t});continue}if(!t||typeof t!="object")continue;let M=t,n=typeof M.accessorKey=="string"?M.accessorKey:typeof M.field=="string"?M.field:null;if(!n)continue;let r=typeof M.header=="string"?M.header:typeof M.headerName=="string"?M.headerName:n;e.push({accessorKey:n,header:r})}return e}function alt(i){return{order:fA.RECORDS,async contribute(e,t){if(!i||!e||!t9t(e))return[];let M=await i.fetch(e,t.filters.length?t.filters:void 0);if(!M||M.empty||!M.chart)return[];let n=M.chart.config?.chart??{},r=Array.isArray(n.data)?n.data:[];if(!r.length)return[];let o=i9t(n.columns),a=o.length?o:Gc(n).columns.map(s=>({accessorKey:s,header:s}));return[{id:$Pt(e.id),title:XPt,widgetType:"chart",componentName:"nile-data-grid",layout:{x:0,y:0,w:12,h:e9t(r.length)},config:{chart:{type:"grid",columns:a,data:[...r]},aq:{}}}]}}}function M9t(){return[{provide:vj,multi:!0,useValue:nlt},{provide:vj,multi:!0,useFactory:i=>alt(i),deps:[[new x5,EA]]},{provide:vj,multi:!0,useValue:olt}]}function slt(i){return Array.isArray(i)?i.map(e=>({id:String(e?.id??""),label:String(e?.label??""),score:Number(e?.score??0),totalRows:Number(e?.totalRows??0),layouts:(Array.isArray(e?.widgets)?e.widgets:[]).filter(t=>t?.id&&t?.layout).map(t=>({id:String(t.id),layout:t.layout}))})).filter(e=>e.id&&e.layouts.length>0):[]}function n9t(i){return!i?.chart||i.chart.type!=="grid"||i.chart.stickyHeader!==void 0?i:U(x({},i),{chart:U(x({},i.chart),{stickyHeader:!0})})}function r9t(i,e){return{title:i.title,widgetType:i.widgetType,layout:i.layout,dataSourceId:e??i.dataSourceId,config:i.config,drilldownBy:i.drilldownBy}}var n0=class i{http=Fe(yo);tokenStore=Fe(vr);dashboardsPath=Fe(K2);inFlightSaves=new Map;lastSentCustomerId=null;lastSentProductId=null;get customerId(){return this.tokenStore.tenantId()??""}withPublished(e,t){return t===void 0?e:`${e}${e.includes("?")?"&":"?"}published=${t}`}mcpGatewayUrl(){return`${dt.baseUrl}/dviz-mcp`}async callMcpTool(e,t={}){let M=this.customerId,n=Oi(),r={};M!==this.lastSentCustomerId&&(r.customerId=M),n!==this.lastSentProductId&&(r.productId=n);let o;try{o=await oi(this.http.post(this.mcpGatewayUrl(),{jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:e,arguments:t}},{headers:{Accept:"application/json, text/event-stream"},params:r})),this.lastSentCustomerId=M,this.lastSentProductId=n}catch(s){throw s instanceof qM?new Error(s.error?.error?.message||s.error?.message||s.message):s}if(o.error)throw new Error(o.error.message);let a=o.result;if(a?.isError)throw new Error(a.structuredContent?.error?.message??a.content?.[0]?.text??`${e} failed`);return a?.structuredContent??{}}async publishToApi(e,t,M){return t?(await this.updateDashboardMeta(t,e),t):await this.createDashboard(e,void 0,M)}async updateDashboardMeta(e,t){if(!dt.MCP_GATEWAY_ENABLED){let M=null;try{M=await oi(this.http.put(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`,{name:t,description:t}))}catch(n){throw n instanceof qM?new Error(n.error?.error||n.message):n}if(M?.success===!1)throw new Error(M.error||"Failed to update dashboard");return}await this.callMcpTool("updateDashboard",{dashboardId:e,name:t,description:t})}async renameDashboard(e,t){await this.updateDashboardMeta(e,t)}async publishDashboard(e,t){if(!dt.MCP_GATEWAY_ENABLED){let M=null,n={};t&&(n.name=t,n.description=t);try{M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/publish`,n))}catch(r){throw r instanceof qM?new Error(r.error?.error||r.message):r}if(M?.success===!1)throw new Error(M.error||"Failed to publish dashboard");return}await this.callMcpTool("publishDashboard",{dashboardId:e})}async saveDraft(e,t){let n=(this.inFlightSaves.get(e)??Promise.resolve()).catch(()=>{}).then(()=>this.runSaveDraft(e,t));this.inFlightSaves.set(e,n);try{await n}finally{this.inFlightSaves.get(e)===n&&this.inFlightSaves.delete(e)}}async runSaveDraft(e,t){let M=iE(t.widgets).map(n=>({id:n.id,title:n.title,summary:n.summary,widgetType:n.widgetType,componentName:n.componentName,layout:n.layout??{x:0,y:0,w:6,h:4},config:CA(n.config),queryMeta:n.queryMeta,dataSourceId:n.dataSourceId,drilldownBy:n.drilldownBy}));if(!dt.MCP_GATEWAY_ENABLED){let n=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}?published=false`;await oi(this.http.put(n,{widgets:M}));return}await this.callMcpTool("updateDashboard",{dashboardId:e,widgets:M,published:!1})}async listDashboards(e){if(!dt.MCP_GATEWAY_ENABLED){let n={};e?.published!==void 0&&(n.published=e.published),e?.limit!==void 0&&(n.limit=String(e.limit)),e?.offset!==void 0&&(n.offset=String(e.offset)),e?.conversationId!==void 0&&(n.conversationId=e.conversationId);let r=await oi(this.http.get(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}`,{params:n})),o=r?.data??r;return Array.isArray(o)?o:[]}let t={};return e?.published!==void 0&&(t.published=e.published),e?.limit!==void 0&&(t.limit=e.limit),e?.offset!==void 0&&(t.offset=e.offset),e?.conversationId!==void 0&&(t.conversationId=e.conversationId),(await this.callMcpTool("listDashboards",t))?.dashboards??[]}async createDashboard(e,t,M){if(!dt.MCP_GATEWAY_ENABLED){let o;try{o=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}`,x({name:e,description:t??e},M??{})))}catch(s){throw s instanceof qM?new Error(s.error?.error||s.message):s}if(o?.success===!1)throw new Error(o.error||"Failed to create dashboard");let a=o?.data?.id??o?.id;if(!a)throw new Error("No dashboard ID returned from API");return a}let r=(await this.callMcpTool("createDashboard",x({name:e,description:t??e},M??{})))?.dashboard?.id;if(!r)throw new Error("No dashboard ID returned from API");return r}async deleteWidget(e,t,M){if(!dt.MCP_GATEWAY_ENABLED){let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}`;await oi(this.http.delete(this.withPublished(r,M)));return}let n={dashboardId:e,widgetId:t};M!==void 0&&(n.published=M),await this.callMcpTool("removeDashboardWidget",n)}async listChartTypes(e){let t;try{t=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/chart-types`,{widgetConfig:e}))}catch(M){throw M instanceof qM?new Error(M.error?.error||M.message):M}if(t?.success===!1)throw new Error(t?.error||"Could not load chart types");return t?.types??[]}async changeAdhocChartType(e,t){let M;try{M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/change-type`,{widgetConfig:e,newChartType:t}))}catch(n){throw n instanceof qM?new Error(n.error?.error||n.message):n}if(M?.success===!1||!M?.chart)throw new Error(M?.error||"Chart type change failed");return M.chart}async listAdhocFilterFields(e){let t;try{t=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/filter-fields`,{widgets:e}))}catch(M){throw M instanceof qM?new Error(M.error?.error||M.message):M}if(t?.success===!1)throw new Error(t?.error||"Could not load filter fields");return t?.fields??[]}async fetchAdhocFilterValues(e,t,M=""){let n;try{n=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/filter-values`,{widgets:e,field:t,prefix:M}))}catch(r){throw r instanceof qM?new Error(r.error?.error||r.message):r}if(n?.success===!1)throw new Error(n?.error||"Could not load filter values");return{field:t,values:n?.values??[],complete:n?.complete??!0}}async applyAdhocFilter(e,t){let M;try{M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/filter-apply`,{widgetConfig:e,filters:t}))}catch(n){throw n instanceof qM?new Error(n.error?.error||n.message):n}if(M?.success===!1||!M?.chart)throw new Error(M?.error||"Filter could not be applied");return M.chart}async changeWidgetChartType(e,t,M,n){let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}`,o;try{o=await oi(this.http.patch(this.withPublished(r,n),{chartType:M}))}catch(a){throw a instanceof qM?new Error(a.error?.error||a.message):a}if(o?.success===!1||!o?.data)throw new Error(o?.error||"Chart type change failed");return o.data}async addWidgetFilter(e,t,M,n){let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}/filters`,o;try{o=await oi(this.http.post(this.withPublished(r,n),M))}catch(a){throw a instanceof qM?new Error(a.error?.error||a.message):a}if(o?.success===!1||!o?.data)throw new Error(o?.error||"Filter could not be applied");return o.data}async removeWidgetFilter(e,t,M,n){let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}/filters/${M}`,o;try{o=await oi(this.http.delete(this.withPublished(r,n)))}catch(a){throw a instanceof qM?new Error(a.error?.error||a.message):a}if(o?.success===!1||!o?.data)throw new Error(o?.error||"Filter could not be removed");return o.data}async setFilterDefault(e,t,M,n,r){let o=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}/filter-default`,a;try{a=await oi(this.http.patch(this.withPublished(o,r),{defaultValue:M,autoApply:n}))}catch(s){throw s instanceof qM?new Error(s.error?.error||s.message):s}if(a?.success===!1||!a?.data)throw new Error(a?.error||"Default filter could not be updated");return a.data}async deleteDashboard(e){if(!dt.MCP_GATEWAY_ENABLED){await oi(this.http.delete(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`));return}await this.callMcpTool("deleteDashboard",{dashboardId:e})}async discardDraft(e){if(!dt.MCP_GATEWAY_ENABLED){let t=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`;await oi(this.http.delete(this.withPublished(t,!1)));return}await this.callMcpTool("deleteDashboard",{dashboardId:e,published:!1})}async refreshDashboard(e){if(!dt.MCP_GATEWAY_ENABLED){let M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/refresh`,{}));if(M?.success===!1)throw new Error(M.error||"Failed to refresh dashboard");return{widgets:await this.mapAndHydrateWidgets(M?.data?.widgets)}}let t=await this.callMcpTool("refreshDashboard",{dashboardId:e});return{widgets:await this.mapAndHydrateWidgets(t?.refresh?.widgets)}}async rearrangeDashboard(e,t){let M=e.map(s=>{let l=s.config?.chart,N=l?{chart:{type:l.type,height:l.height,yCategories:l.yCategories,sparkline:l.sparkline,visibleRows:l.visibleRows,rowCount:l.rowCount}}:void 0;return{id:s.id,title:s.title??"",widgetType:s.widgetType??"chart",chartType:l?.type,config:N,layout:s.layout}});if(!dt.MCP_GATEWAY_ENABLED){let s;try{s=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/rearrange`,{widgets:M,dashboardId:t??void 0}))}catch(I){if(I instanceof qM){let d=new Error(I.error?.error||I.message);throw d.status=I.status,d}throw I}if(s?.success===!1)throw new Error(s.error||"Failed to rearrange dashboard");let l=s?.data??s,c=(Array.isArray(l)?l:l?.widgets??[]).filter(I=>I?.id&&I?.layout).map(I=>({id:String(I.id),layout:I.layout})),D=s?.meta?.count??c.length;return{layouts:c,widgetCount:D,options:slt(l?.options)}}let n=await this.callMcpTool("rearrangeDashboardWidgets",{widgets:M}),o=(n?.widgets??[]).filter(s=>s?.id&&s?.layout).map(s=>({id:String(s.id),layout:s.layout})),a=n?.count??o.length;return{layouts:o,widgetCount:a,options:slt(n?.options)}}async fetchDashboardSummary(e,t){let M=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/summary`,n=await oi(this.http.post(this.withPublished(M,t),{})),r=n?.data??n;return typeof r=="string"?r:r?.summary??""}async runExecutiveSummaryChat(e,t){let M=await oi(this.http.get(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`)),n=(M?.data??M)?.conversationId??null;if(!n)throw new Error("This dashboard has no conversation to summarise yet.");let r=this.tokenStore.accessToken()??"",o=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce`,a=await fetch(`${o}/v1/conversations/chat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({conversationId:n,message:t,dashboardId:e})});if(!a.ok||!a.body){let I=await a.text().catch(()=>a.statusText);throw new Error(`Request failed (${a.status}): ${I}`)}let s=a.body.getReader(),l=new TextDecoder,N="",c="",D=I=>{let d=I.trim();if(!d)return;let y=d.indexOf(":");if(!(y===-1||d.slice(0,y)!=="0"))try{c+=JSON.parse(d.slice(y+1))?.text??""}catch{}};for(;;){let{done:I,value:d}=await s.read();if(I)break;N+=l.decode(d,{stream:!0});let y=N.split(`
|
|
40500
|
+
`);if(t.length>Bst||M.length>Bst)return[...t.map(l=>({kind:"remove",text:l})),...M.map(l=>({kind:"add",text:l}))];let n=M.length+1,r=new Int32Array((t.length+1)*n);for(let l=t.length-1;l>=0;l--)for(let N=M.length-1;N>=0;N--)r[l*n+N]=t[l]===M[N]?r[(l+1)*n+(N+1)]+1:Math.max(r[(l+1)*n+N],r[l*n+(N+1)]);let o=[],a=0,s=0;for(;a<t.length&&s<M.length;)t[a]===M[s]?(o.push({kind:"context",text:t[a]}),a++,s++):r[(a+1)*n+s]>=r[a*n+(s+1)]?(o.push({kind:"remove",text:t[a]}),a++):(o.push({kind:"add",text:M[s]}),s++);for(;a<t.length;)o.push({kind:"remove",text:t[a++]});for(;s<M.length;)o.push({kind:"add",text:M[s++]});return o}function aF(i){return i.filter(e=>e.kind!=="context")}var EA=new $t("RECORDS_FETCHER");function Fst(i){return{provide:EA,useFactory:e=>({fetch:e.fetchWidgetRecords.bind(e)}),deps:[i]}}var vj=new $t("WIDGET_EVIDENCE_PROVIDERS");function UZt(i,e){return{provide:vj,multi:!0,useFactory:t=>({order:i,contribute:t.resolveEvidence.bind(t)}),deps:[e]}}var vZt=12,YZt=2,ZZt=4;function _Zt(i){let e=i?.h;return typeof e!="number"||!Number.isFinite(e)||e<=0?ZZt:Math.max(YZt,Math.ceil(e))}function sF(i){let e=0;return i.map(t=>{let M=_Zt(t.layout),n={x:0,y:e,w:vZt,h:M};return e+=M,U(x({},t),{layout:n})})}var fA={SOURCE:0,CURATED:20,CHART_DATA:40,RECORDS:60,PROVENANCE:80};async function lF(i,e,t,M){let n=[...i].sort((o,a)=>o.order-a.order),r=n.map(()=>[]);return await Promise.all(n.map(async(o,a)=>{try{r[a]=await o.contribute(e,t)}catch{r[a]=[]}M?.(r.flat())})),r.flat()}var R3=2,Hst=Object.freeze([]),WZt=Object.freeze([]),P3=class{rootLabel;providers;collect;nextId=1;levelStack=ke(Hst);levels=this.levelStack.asReadonly();depth=At(()=>this.levelStack().length);isOpen=At(()=>this.depth()>0);canOpen=At(()=>this.depth()<R3);current=At(()=>{let e=this.levelStack();return e.length>0?e[e.length-1]:null});loading=At(()=>this.current()?.pending??!1);failed=At(()=>this.current()?.failed??!1);content=At(()=>this.current()?.content??WZt);breadcrumb=At(()=>{let e=this.levelStack(),t=[this.rootLabel(),...e.map(n=>n.label)],M=t.filter((n,r)=>r===0||n!==t[r-1]);return M.map((n,r)=>({label:n,current:r===M.length-1}))});constructor(e){let{rootLabel:t}=e;this.rootLabel=typeof t=="function"?t:()=>t,this.providers=e.providers,this.collect=e.collect??lF}async open(e,t){if(!this.canOpen())return;let M=this.nextId++,n=this.depth();this.levelStack.update(r=>[...r,{id:M,widget:e,label:e.title??"",depth:n,content:[],pending:!0,failed:!1}]);try{let r=await this.collect(this.providers,e,U(x({},t),{depth:n}),o=>{o.length&&this.settle(M,{content:sF(o),pending:!1,failed:!1})});this.settle(M,{content:sF(r),pending:!1,failed:!1})}catch{this.settle(M,{content:[],pending:!1,failed:!0})}}back(){let e=this.levelStack();if(e.length!==0){if(e.length===1){this.close();return}this.levelStack.set(e.slice(0,-1))}}close(){this.levelStack().length!==0&&this.levelStack.set(Hst)}settle(e,t){this.levelStack.update(M=>{let n=M.findIndex(o=>o.id===e);if(n===-1)return M;let r=M.slice();return r[n]=x(x({},M[n]),t),r})}};var PZt=["crumbBar"],RZt=["footerSlot"],VZt=[[["","panel-footer",""]],"*"],BZt=["[panel-footer]","*"];function FZt(i,e){if(i&1){let t=Le();C(0,"nile-breadcrumb-item",8),Ae("keydown.enter",function(n){let r=P(t),o=r.$index,a=r.$count,s=p();return R(s.onCrumbKey(n,o===a-1))})("keydown.space",function(n){let r=P(t),o=r.$index,a=r.$count,s=p();return R(s.onCrumbKey(n,o===a-1))}),Y(1),b()}if(i&2){let t=e.$implicit,M=e.$index,n=e.$count;It("tabindex",M===n-1?null:0),L(),it(t.label)}}function HZt(i,e){if(i&1&&Zt(0,"nile-skeleton-loader",14),i&2){let t=e.$implicit;aM("height",t,"%")}}function JZt(i,e){if(i&1&&(C(0,"div",9),Zt(1,"nile-skeleton-loader",10)(2,"nile-skeleton-loader",11),C(3,"div",12),ht(4,HZt,1,2,"nile-skeleton-loader",13,Mr),b()()),i&2){let t=p(2);L(4),xt(t.skeletonRows)}}function GZt(i,e){if(i&1&&(C(0,"div",6),ht(1,JZt,6,0,"div",9,Mr),b()),i&2){let t=p();L(),xt(t.skeletonCards)}}function $Zt(i,e){i&1&&sl(0,1)}var Km=[],eE=class i{constructor(e){this.host=e;let t=typeof document<"u"?document.activeElement:null;this.focusOnOpen=t instanceof HTMLElement&&t!==document.body?t:null,Km.push(this),document.addEventListener("keydown",this.onDocumentKeydown)}host;crumbs=at([]);loading=at(!1);label=at("Widget detail");closed=Xi();crumbBar;footerSlot;focusOnOpen;footerWatcher;accessibleName=At(()=>{let e=this.crumbs();return e.length?e[e.length-1].label:this.label()});ngAfterViewInit(){this.focusIntoPanel(),this.measureFooter(),typeof MutationObserver<"u"&&this.footerSlot&&(this.footerWatcher=new MutationObserver(()=>this.measureFooter()),this.footerWatcher.observe(this.footerSlot.nativeElement,{childList:!0}))}ngOnDestroy(){document.removeEventListener("keydown",this.onDocumentKeydown);let e=Km.indexOf(this);e!==-1&&Km.splice(e,1),this.footerWatcher?.disconnect(),this.restoreFocus()}onClose(){this.closed.emit()}onCrumbKey(e,t){t||(e.preventDefault(),this.closed.emit())}onDocumentKeydown=e=>{e.key==="Escape"&&(e.defaultPrevented||Km[Km.length-1]===this&&this.closed.emit())};focusIntoPanel(){this.crumbBar?.nativeElement.focus({preventScroll:!0})}restoreFocus(){let e=this.focusOnOpen;if(!e||!e.isConnected)return;let t=document.activeElement;(t===null||t===document.body||this.host.nativeElement.contains(t))&&e.focus({preventScroll:!0})}skeletonCards=[0,1];skeletonRows=[92,78,86,64,72];measureFooter(){let e=this.footerSlot?.nativeElement;if(!e)return;Array.from(e.childNodes).some(M=>M.nodeType===Node.ELEMENT_NODE||M.nodeType===Node.TEXT_NODE&&(M.textContent??"").trim().length>0)?e.removeAttribute("hidden"):e.setAttribute("hidden","")}static \u0275fac=function(t){return new(t||i)(ni(ir))};static \u0275cmp=rM({type:i,selectors:[["shared-widget-detail-panel"]],viewQuery:function(t,M){if(t&1&&eN(PZt,7)(RZt,7),t&2){let n;ll(n=gl())&&(M.crumbBar=n.first),ll(n=gl())&&(M.footerSlot=n.first)}},inputs:{crumbs:[1,"crumbs"],loading:[1,"loading"],label:[1,"label"]},outputs:{closed:"closed"},ngContentSelectors:BZt,decls:12,vars:3,consts:[["crumbBar",""],["footerSlot",""],["role","region",1,"detail-panel"],["tabindex","-1",1,"detail-panel__crumbs"],[3,"nile-click"],[1,"detail-panel__body"],["aria-hidden","true",1,"detail-panel__skeleton"],["hidden","",1,"detail-panel__footer"],[3,"keydown.enter","keydown.space"],[1,"detail-panel__sk-card"],["variant","text","width","40%","height","15"],["variant","text","width","55%","height","10"],[1,"detail-panel__sk-rows"],["variant","rectangular","width","100%","height","100%",3,"height"],["variant","rectangular","width","100%","height","100%"]],template:function(t,M){t&1&&(tu(VZt),C(0,"div",2)(1,"div",3,0)(3,"nile-breadcrumb",4),Ae("nile-click",function(){return M.onClose()}),ht(4,FZt,2,2,"nile-breadcrumb-item",null,Mr),b()(),C(6,"div",5),he(7,GZt,3,0,"div",6)(8,$Zt,1,0),b(),C(9,"div",7,1),sl(11),b()()),t&2&&(It("aria-label",M.accessibleName()),L(4),xt(M.crumbs()),L(2),It("aria-busy",M.loading()),L(),xe(M.loading()?7:8))},dependencies:[Go],styles:['@charset "UTF-8";.detail-panel[_ngcontent-%COMP%]{position:absolute;inset:0;z-index:var(--z-floating, 50);display:flex;flex-direction:column;background:var(--ng-colors-bg-primary);animation:_ngcontent-%COMP%_detail-panel-slide-in .16s ease}.detail-panel__crumbs[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--ng-spacing-3, 12px);box-sizing:border-box;height:var(--aq-header-h, 56px);padding:0 var(--ng-spacing-5, 20px);border-bottom:1px solid var(--ng-colors-border-secondary);flex-shrink:0}.detail-panel__crumbs[_ngcontent-%COMP%]:focus{outline:none}.detail-panel__crumbs[_ngcontent-%COMP%] nile-breadcrumb[_ngcontent-%COMP%]{display:inline-flex;align-items:center}.detail-panel__crumbs[_ngcontent-%COMP%] nile-breadcrumb-item[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--ng-colors-border-brand);outline-offset:2px;border-radius:var(--ng-radius-xs, 4px)}.detail-panel__body[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;overflow:auto;scrollbar-width:none;-ms-overflow-style:none;padding:var(--ng-spacing-5, 20px);background:var(--ng-colors-bg-secondary)}.detail-panel__body[_ngcontent-%COMP%]::-webkit-scrollbar{width:0;height:0}.detail-panel__skeleton[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--ng-spacing-4, 16px)}.detail-panel__sk-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;padding:16px;min-height:240px;border-radius:var(--ng-radius-xl, 12px);background:var(--ng-colors-bg-primary);box-shadow:var(--ng-shadow-sm)}.detail-panel__sk-rows[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-end;gap:8px;min-height:0;margin-top:8px}.detail-panel__sk-rows[_ngcontent-%COMP%] nile-skeleton-loader[_ngcontent-%COMP%]{flex:1}.detail-panel__footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:var(--ng-spacing-2, 8px);padding:var(--ng-spacing-3, 12px) var(--ng-spacing-5, 20px);border-top:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary);flex-shrink:0}.detail-panel__footer[hidden][_ngcontent-%COMP%]{display:none}@keyframes _ngcontent-%COMP%_detail-panel-slide-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}'],changeDetection:0})};var t0=new $t("STORIES_FETCHER");function XZt(i){return{provide:t0,useFactory:i}}var qZt="wf.pendingStoryScene";function gF(i){try{sessionStorage.setItem(qZt,JSON.stringify(i))}catch{}}function KZt(i){return/\bWHERE\b([\s\S]*?)(?:\bGROUP BY\b|\bORDER BY\b|\bLIMIT\b|$)/i.exec(i)?.[1]?.trim().replace(/\s+/g," ")||null}function e_t(i){let e=i?.query?.bool,t=[...e?.filter??[],...e?.must??[]],M=[];for(let n of t){let r=n;if(r.term)for(let[o,a]of Object.entries(r.term))M.push(`${o.replace(/\.keyword$/,"")} = ${String(a)}`);else if(r.terms)for(let[o,a]of Object.entries(r.terms))M.push(`${o.replace(/\.keyword$/,"")} in [${a.join(", ")}]`);else if(r.range)for(let[o,a]of Object.entries(r.range)){let s=Object.entries(a).map(([l,N])=>`${l} ${N}`).join(" ");M.push(`${o} ${s}`)}else if(r.match)for(let[o,a]of Object.entries(r.match))M.push(`${o} ~ "${String(a)}"`)}return M.length?M.join(" AND "):null}function i0(i){let e=[],t=i.config?.aq,M=t?.summary??t?.chartSubtitle;M&&e.push({label:"Summary",text:M}),i.edited===!1?e.push({label:"Filter",text:Rm(i)}):i.edited===!0&&e.push({label:"Filter",text:"Reflects the active dashboard filter"});let n=i.queryMeta,r=n?.sql?KZt(n.sql):n?.dsl?e_t(n.dsl):null;return r&&e.push({label:"Filters applied",text:r}),e}function Gc(i){if(!i)return{columns:[],rows:[]};let e=i.data,t=i.value;if(t!=null&&!Array.isArray(e)){let M=i.label||"value";return{columns:[M],rows:[{[M]:t}]}}if(Array.isArray(e)&&e.length){let M=e[0],n=M?.data;if(Array.isArray(n)&&!Array.isArray(n[0])&&typeof n[0]!="object"){let r=e,a=(i.categories??n.map((s,l)=>l+1)).map((s,l)=>{let N={category:s};for(let c of r)N[c.name??"value"]=c.data?.[l]??null;return N});return{columns:["category",...r.map(s=>s.name??"value")],rows:a}}if(Array.isArray(n)&&Array.isArray(n[0]))return{columns:["x","y"],rows:n.map(([o,a])=>({x:o,y:a}))};if(M&&typeof M=="object"&&"y"in M)return{columns:["name","value"],rows:e.map(o=>({name:o.name,value:o.y}))};if(typeof M=="number")return{columns:["value"],rows:e.map(r=>({value:r}))};if(M&&typeof M=="object")return{columns:Object.keys(M),rows:e}}return{columns:[],rows:[]}}function Jst(i,e){return async(t,M,n,r)=>{let o=await i(t,M,n,r),a=e.match(M,n);if(!a.length)return o;let s=new Set(a.map(I=>String(I))),l=o.values.map(I=>s.has(String(I.value))?U(x({},I),{observed:!0}):I),N=new Set(o.values.map(I=>String(I.value))),D=[...a.filter(I=>!N.has(String(I))).map(I=>({value:I,label:String(I),observed:!0})),...l.filter(I=>I.observed),...l.filter(I=>!I.observed)];return U(x({},o),{values:D})}}var t_t=[[["","panel-footer",""]]],i_t=["[panel-footer]"],M_t=["ngProjectAs","[panel-footer]",5,["","panel-footer",""]],V3=(i,e)=>e.id,NF=(i,e)=>e.key,$st=(i,e)=>e.component,n_t=(i,e)=>e.index,Yj=(i,e)=>e.value,Xst=(i,e)=>e.name,r_t=(i,e)=>e.drillDownName,o_t=(i,e)=>e.label;function a_t(i,e){if(i&1){let t=Le();$(0,"shared-filter-rail",41),Ze("modeChange",function(n){P(t);let r=p();return R(r.onRailModeChange(n))})("conditionsChange",function(n){P(t);let r=p();return R(r.onRailConditions(n))})("expressionRun",function(n){P(t);let r=p();return R(r.onRailExpressionRun(n))})("promptAsk",function(n){P(t);let r=p();return R(r.onRailPromptAsk(n))})("clearAll",function(){P(t);let n=p();return R(n.onRailClearAll())})("timeRangeApply",function(n){P(t);let r=p();return R(r.onRailTimeRange(n))}),ee()}if(i&2){let t=p();ot("mode",t.railMode())("conditions",t.railConditions())("catalog",t.railCatalog())("expression",t.railExpression())("busy",t.widgetsLoading)("valueFetcher",t.valueFetcher())("showFilterControls",t.hasFilterWidget())("disabled",!t.filtersEnabled)("showTimeFilter",t.timeFilterEnabled)("timeFilterResetKey",t.dashboardId)}}function s_t(i,e){if(i&1&&($(0,"div",2),Mt(1,"nile-glyph",42),$(2,"span",43),Y(3),ee()()),i&2){let t=p();L(3),it(t.filterExplanation)}}function l_t(i,e){i&1&&($(0,"div",45),Mt(1,"nile-skeleton-loader",48)(2,"nile-skeleton-loader",49)(3,"nile-skeleton-loader",50),ee())}function g_t(i,e){if(i&1&&Mt(0,"nile-skeleton-loader",57),i&2){let t=e.$implicit;aM("height",t,"%")}}function N_t(i,e){if(i&1&&($(0,"div",47),Mt(1,"nile-skeleton-loader",51)(2,"nile-skeleton-loader",52),$(3,"div",53),ht(4,g_t,1,2,"nile-skeleton-loader",54,Mr),ee(),$(6,"div",55),Mt(7,"nile-skeleton-loader",56)(8,"nile-skeleton-loader",56),ee()()),i&2){let t=p(2);L(4),xt(t.skeletonBars)}}function u_t(i,e){if(i&1&&($(0,"div",3)(1,"div",44),ht(2,l_t,4,0,"div",45,Mr),ee(),$(4,"div",46),ht(5,N_t,9,0,"div",47,Mr),ee()()),i&2){let t=p();L(2),xt(t.skeletonKpis),L(3),xt(t.skeletonCharts)}}function c_t(i,e){i&1&&($(0,"p"),Y(1,"Tap the canvas above to generate charts, KPIs, and tables \u2014 or pick from the library."),ee())}function D_t(i,e){if(i&1){let t=Le();$(0,"nile-button",92),Ze("click",function(){P(t);let n=p(2);return R(n.openAiBuilder.emit())}),Mt(1,"nile-glyph",93),Y(2," Add widget "),ee()}}function I_t(i,e){if(i&1){let t=Le();$(0,"div",58)(1,"div",59),Ze("click",function(){P(t);let n=p();return R(n.editMode&&n.openAiBuilder.emit())})("keydown.enter",function(){P(t);let n=p();return R(n.editMode&&n.openAiBuilder.emit())})("keydown.space",function(n){P(t);let r=p();return r.editMode&&r.openAiBuilder.emit(),R(r.editMode&&n.preventDefault())}),KJ(),$(2,"svg",60),Mt(3,"rect",61)(4,"rect",62)(5,"rect",63),$(6,"rect",64),Mt(7,"animate",65)(8,"animate",66),ee(),$(9,"rect",67),Mt(10,"animate",68)(11,"animate",69),ee(),$(12,"rect",70),Mt(13,"animate",71)(14,"animate",72),ee(),$(15,"rect",73),Mt(16,"animate",74)(17,"animate",75),ee(),$(18,"rect",76),Mt(19,"animate",77)(20,"animate",78),ee(),Mt(21,"rect",79)(22,"rect",80)(23,"circle",81),$(24,"circle",82),Mt(25,"animate",83),ee(),Mt(26,"rect",84)(27,"rect",85),$(28,"path",86),Mt(29,"animate",87),ee(),$(30,"circle",88),Mt(31,"animate",89),ee()()(),eG(),$(32,"h3"),Y(33,"Add widgets to build your dashboard"),ee(),ux(34,c_t,2,0,"p",90)(35,D_t,3,0,"nile-button",91),ee()}if(i&2){let t=p();L(),It("role",t.editMode?"button":null)("tabindex",t.editMode?0:null),L(33),ot("ngIf",t.editMode),L(),ot("ngIf",!t.editMode)}}function d_t(i,e){if(i&1&&($(0,"div",98)(1,"span",105)(2,"nile-lite-tooltip",106),Mt(3,"nile-glyph",107),ee(),$(4,"span",108),Y(5),ee()()()),i&2){let t=p().$implicit,M=p(2);L(),It("aria-label",M.reasonText(t)),L(),ot("content",M.reasonText(t)),L(3),it(M.reasonText(t))}}function j_t(i,e){i&1&&($(0,"div",101),Mt(1,"nile-glyph",109),ee())}function y_t(i,e){if(i&1){let t=Le();$(0,"div",102)(1,"nile-checkbox",110),Ze("nile-change",function(n){P(t);let r=p().$implicit,o=p(2);return R(o.toggleSelection(r.id,n.detail.checked))}),ee()()}if(i&2){let t=p().$implicit,M=p(2);L(),It("checked",M.isSelected(t.id)?"":null)}}function T_t(i,e){if(i&1&&Mt(0,"nile-glyph",118),i&2){let t=p(2).$implicit;ot("name",t.glyph)("method",t.method||"stroke")}}function A_t(i,e){i&1&&($(0,"nile-context-menu-item",120),Y(1,"Loading stories\u2026"),ee())}function z_t(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",123),Ze("click",function(){let n=P(t).$implicit,r=p(9);return R(r.chooseStory(n.id))}),Y(1),ee()}if(i&2){let t=e.$implicit;L(),it(t.title||"Untitled story")}}function h_t(i,e){if(i&1){let t=Le();ht(0,z_t,2,1,"nile-context-menu-item",null,V3),$(2,"nile-context-menu-item",121),Ze("click",function(){P(t);let n=p(8);return R(n.chooseStory(null))}),Mt(3,"nile-glyph",122),Y(4," Add as new story "),ee()}if(i&2){let t=p(8);xt(t.storyOptions)}}function x_t(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",117),Ze("mouseenter",function(){P(t);let n=p(5).$implicit,r=p(2);return R(r.loadStoriesFor(n.id))})("focusin",function(){P(t);let n=p(5).$implicit,r=p(2);return R(r.loadStoriesFor(n.id))}),he(1,T_t,1,2,"nile-glyph",118),Y(2),$(3,"nile-context-submenu",119)(4,"nile-context-menu-group"),he(5,A_t,2,0,"nile-context-menu-item",120)(6,h_t,5,0),ee()()()}if(i&2){let t=p().$implicit,M=p(6);L(),xe(t.glyph?1:-1),L(),yi(" ",t.label," "),L(3),xe(M.storyLoading?5:6)}}function p_t(i,e){if(i&1&&Mt(0,"nile-glyph",118),i&2){let t=p().$implicit;aM("color",t.color),ot("name",t.glyph)("method",t.method||"stroke")}}function L_t(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){let n=P(t).$implicit,r=p(6).$implicit,o=p(2);return R(o.onOwnMenuItem(r,n))}),he(1,p_t,1,4,"nile-glyph",125),Y(2),ee()}if(i&2){let t=e.$implicit;L(),xe(t.glyph?1:-1),L(),yi(" ",t.label," ")}}function O_t(i,e){if(i&1&&($(0,"nile-context-menu-item",116),Mt(1,"nile-glyph",118),Y(2),$(3,"nile-context-submenu",119)(4,"nile-context-menu-group"),ht(5,L_t,3,2,"nile-context-menu-item",116,NF),ee()()()),i&2){let t=p().$implicit;L(),ot("name",t.glyph)("method",t.method||"stroke"),L(),yi(" ",t.label," "),L(3),xt(t.children)}}function m_t(i,e){if(i&1&&Mt(0,"nile-glyph",118),i&2){let t=p(3).$implicit;aM("color",t.color),ot("name",t.glyph)("method",t.method||"stroke")}}function E_t(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){let n=P(t),r=p(6).$implicit,o=p(2);return R(o.onOwnMenuItem(r,n))}),he(1,m_t,1,4,"nile-glyph",125),Y(2),ee()}if(i&2){let t=p(2).$implicit;L(),xe(t.glyph?1:-1),L(),yi(" ",t.label," ")}}function f_t(i,e){if(i&1&&he(0,E_t,3,2,"nile-context-menu-item",116),i&2){let t,M=p().$implicit;xe((t=M.item)?0:-1,t)}}function S_t(i,e){if(i&1&&he(0,x_t,7,3,"nile-context-menu-item",116)(1,O_t,7,3,"nile-context-menu-item",116)(2,f_t,1,1),i&2){let t=e.$implicit;xe(t.key==="addToStory"?0:t.children.length?1:2)}}function w_t(i,e){if(i&1&&($(0,"nile-context-menu-group",115),ht(1,S_t,3,1,null,null,NF),ee()),i&2){let t=e.$implicit;Wt("widget-menu__group--empty",!t.nodes.length)("widget-menu__group--first",t.first),L(),xt(t.nodes)}}function C_t(i,e){if(i&1){let t=Le();$(0,"button",111),Ze("click",function(){P(t);let n=p(2).$implicit,r=p(2);return R(r.openWidgetKebab(n))}),Mt(1,"nile-glyph",112),ee(),$(2,"nile-context-menu",113),Ze("nile-change",function(n){P(t);let r=p(2).$implicit,o=p(2);return R(o.onWidgetKebabChange(r,n))}),ht(3,w_t,3,4,"nile-context-menu-group",114,NF),ee()}if(i&2){let t=p(2).$implicit,M=p(2);ot("id",M.kebabIdFor(t.id)),It("aria-expanded",M.menuOpenWidgetId===t.id),L(2),ot("open",M.menuOpenWidgetId===t.id),It("for",M.menuOpenWidgetId===t.id?M.kebabIdFor(t.id):null),L(),xt(M.widgetMenuGroupsFor(t))}}function k_t(i,e){if(i&1&&ht(0,C_t,5,4,null,null,Ho),i&2){let t=p().$implicit,M=p(2);xt(M.widgetMenuEpochFor(t.id))}}function b_t(i,e){i&1&&($(0,"div",130),Mt(1,"nile-spinner",133),$(2,"span"),Y(3,"Loading chart types\u2026"),ee()())}function Q_t(i,e){i&1&&($(0,"p",131),Y(1,"No other chart types fit this widget's data."),ee())}function U_t(i,e){i&1&&Mt(0,"nile-spinner",133)}function v_t(i,e){if(i&1&&Mt(0,"nile-glyph",138),i&2){let t=p().$implicit,M=p(6);ot("name",M.chartTypeIcon(t.type))}}function Y_t(i,e){if(i&1){let t=Le();$(0,"button",137),Ze("click",function(){let n=P(t).$implicit,r=p(6);return R(r.selectChartType(n.component))}),he(1,U_t,1,0,"nile-spinner",133)(2,v_t,1,1,"nile-glyph",138),$(3,"span"),Y(4),ee()()}if(i&2){let t=e.$implicit,M=p(6);Wt("type-picker__tile--current",t.component===M.chartTypeCurrentComponent),It("aria-current",t.component===M.chartTypeCurrentComponent?"true":null)("disabled",M.chartTypeApplying?"":null),L(),xe(M.chartTypeApplyingComponent===t.component?1:2),L(3),it(t.label)}}function Z_t(i,e){if(i&1&&($(0,"p",134),Y(1,"Recommended"),ee(),$(2,"div",135),ht(3,Y_t,5,6,"button",136,$st),ee()),i&2){let t=p(5);L(3),xt(t.sensibleChartTypes())}}function __t(i,e){i&1&&Mt(0,"nile-spinner",133)}function W_t(i,e){if(i&1&&Mt(0,"nile-glyph",138),i&2){let t=p().$implicit,M=p(6);ot("name",M.chartTypeIcon(t.type))}}function P_t(i,e){if(i&1){let t=Le();$(0,"button",140),Ze("click",function(){let n=P(t).$implicit,r=p(6);return R(r.selectChartType(n.component))}),he(1,__t,1,0,"nile-spinner",133)(2,W_t,1,1,"nile-glyph",138),$(3,"span"),Y(4),ee()()}if(i&2){let t=e.$implicit,M=p(6);Wt("type-picker__tile--current",t.component===M.chartTypeCurrentComponent),It("aria-current",t.component===M.chartTypeCurrentComponent?"true":null)("disabled",M.chartTypeApplying?"":null),L(),xe(M.chartTypeApplyingComponent===t.component?1:2),L(3),it(t.label)}}function R_t(i,e){if(i&1&&($(0,"p",134),Y(1,"Other types"),ee(),$(2,"div",135),ht(3,P_t,5,6,"button",139,$st),ee()),i&2){let t=p(5);L(3),xt(t.otherChartTypes())}}function V_t(i,e){if(i&1&&(he(0,Z_t,5,0),he(1,R_t,5,0)),i&2){let t=p(4);xe(t.sensibleChartTypes().length>0?0:-1),L(),xe(t.otherChartTypes().length>0?1:-1)}}function B_t(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(4);L(),it(t.chartTypeError)}}function F_t(i,e){if(i&1){let t=Le();$(0,"nile-dropdown",126),Ze("nile-hide",function(){P(t);let n=p().$implicit,r=p(2);return R(r.chartTypePickerWidgetId===n.id&&r.closeChartTypePicker())}),$(1,"button",127),Mt(2,"nile-glyph",128),ee(),$(3,"div",129),he(4,b_t,4,0,"div",130)(5,Q_t,2,0,"p",131)(6,V_t,2,2),he(7,B_t,2,1,"p",132),ee()()}if(i&2){let t=p().$implicit,M=p(2);ot("open",M.chartTypePickerWidgetId===t.id),L(4),xe(M.chartTypeLoading?4:M.chartTypeOptions.length===0?5:6),L(3),xe(M.chartTypeError?7:-1)}}function H_t(i,e){if(i&1){let t=Le();$(0,"label",143)(1,"span",144)(2,"input",145),Ze("change",function(n){let r=P(t).$implicit,o=p(4);return R(o.selectSeriesColor(r.index,n.target.value))}),ee()(),$(3,"span",146),Y(4),ee()()}if(i&2){let t=e.$implicit;L(2),ot("value",t.color),L(2),it(t.name)}}function J_t(i,e){if(i&1){let t=Le();$(0,"nile-dropdown",126),Ze("nile-hide",function(){P(t);let n=p().$implicit,r=p(2);return R(r.colorPickerWidgetId===n.id&&r.closeColorPicker())}),$(1,"button",127),Mt(2,"nile-glyph",141),ee(),$(3,"div",142)(4,"p",134),Y(5,"Series colors"),ee(),ht(6,H_t,5,2,"label",143,n_t),ee()()}if(i&2){let t=p().$implicit,M=p(2);ot("open",M.colorPickerWidgetId===t.id),L(6),xt(M.colorPickerSeries())}}function G_t(i,e){if(i&1){let t=Le();$(0,"span",152),Y(1),$(2,"button",153),Ze("click",function(){let n=P(t).$implicit,r=p(6);return R(n.id&&r.removeFilterFromBuilder(n.id))}),Mt(3,"nile-glyph",154),ee()()}if(i&2){let t=e.$implicit,M=p(6);L(),hG(" ",t.field," ",t.operation," ",t.value," "),L(),It("disabled",M.filterBuilderRemovingId?"":null)}}function $_t(i,e){if(i&1&&($(0,"div",149),ht(1,G_t,4,4,"span",152,V3),ee()),i&2){let t=p(5);L(),xt(t.filterBuilderActiveFilters())}}function X_t(i,e){if(i&1){let t=Le();$(0,"button",156),Ze("click",function(){let n=P(t).$implicit,r=p(4).$implicit,o=p(2);return R(o.applyQuickTimeFilter(r,n.value))}),Y(1),ee()}if(i&2){let t=e.$implicit,M=p(6);It("disabled",M.filterBuilderApplying?"":null),L(),yi(" ",t.label," ")}}function q_t(i,e){if(i&1&&($(0,"div",150),ht(1,X_t,2,2,"button",155,Yj),ee()),i&2){let t=p(5);L(),xt(t.quickTimePresets)}}function K_t(i,e){i&1&&($(0,"div",130),Mt(1,"nile-spinner",133),$(2,"span"),Y(3,"Loading filterable fields\u2026"),ee()())}function eWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(5);L(),it(t.ephemeralFilterFieldsError)}}function tWt(i,e){i&1&&($(0,"p",131),Y(1,"No filterable fields found for this widget's data."),ee())}function iWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.name),L(),it(t.label)}}function MWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.value),L(),it(t.label)}}function nWt(i,e){if(i&1){let t=Le();$(0,"input",164),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.filterBuilderValue,n)||(r.filterBuilderValue=n),R(n)}),Ze("keydown.enter",function(){P(t);let n=p(7);return R(n.submitFilterBuilder())}),ee()}if(i&2){let t=p(7);Nl("ngModel",t.filterBuilderValue)}}function rWt(i,e){if(i&1){let t=Le();$(0,"span",166),Y(1,"and"),ee(),$(2,"input",165),cl("ngModelChange",function(n){P(t);let r=p(8);return ul(r.filterBuilderValue2,n)||(r.filterBuilderValue2=n),R(n)}),ee()}if(i&2){let t=p(8);L(2),Nl("ngModel",t.filterBuilderValue2)}}function oWt(i,e){if(i&1){let t=Le();$(0,"input",165),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.filterBuilderValue,n)||(r.filterBuilderValue=n),R(n)}),ee(),he(1,rWt,3,1)}if(i&2){let t,M=p(7);Nl("ngModel",M.filterBuilderValue),L(),xe((t=M.filterBuilderSelectedOperator())!=null&&t.needsSecondValue?1:-1)}}function aWt(i,e){if(i&1){let t=Le();$(0,"span",166),Y(1,"and"),ee(),$(2,"input",168),cl("ngModelChange",function(n){P(t);let r=p(8);return ul(r.filterBuilderValue2,n)||(r.filterBuilderValue2=n),R(n)}),ee()}if(i&2){let t=p(8);L(2),Nl("ngModel",t.filterBuilderValue2)}}function sWt(i,e){if(i&1){let t=Le();$(0,"input",167),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.filterBuilderValue,n)||(r.filterBuilderValue=n),R(n)}),Ze("keydown.enter",function(){P(t);let n=p(7);return R(n.submitFilterBuilder())}),ee(),he(1,aWt,3,1)}if(i&2){let t,M=p(7);Nl("ngModel",M.filterBuilderValue),L(),xe((t=M.filterBuilderSelectedOperator())!=null&&t.needsSecondValue?1:-1)}}function lWt(i,e){if(i&1){let t=Le();$(0,"label",169)(1,"input",170),Ze("change",function(){let n=P(t).$implicit,r=p(8);return R(r.toggleFilterBuilderMultiValue(n.value))}),ee(),$(2,"span"),Y(3),ee()()}if(i&2){let t=e.$implicit,M=p(8);L(),ot("checked",M.filterBuilderValues.includes(t.value)),L(2),Jo("",t.label,"",t.count!=null?" ("+t.count+")":"")}}function gWt(i,e){if(i&1&&($(0,"div",162),ht(1,lWt,4,3,"label",169,Yj),ee()),i&2){let t=p(5).$implicit,M=p(2);L(),xt(M.filterValuesFor(t,M.filterBuilderField))}}function NWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.value),L(),Jo("",t.label,"",t.count!=null?" ("+t.count+")":"")}}function uWt(i,e){if(i&1){let t=Le();$(0,"select",157),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.filterBuilderValue,n)||(r.filterBuilderValue=n),R(n)}),$(1,"option",171),Y(2,"Select\u2026"),ee(),ht(3,NWt,2,3,"option",158,Yj),ee()}if(i&2){let t=p(5).$implicit,M=p(2);Nl("ngModel",M.filterBuilderValue),L(3),xt(M.filterValuesFor(t,M.filterBuilderField))}}function cWt(i,e){if(i&1&&he(0,nWt,1,1,"input",161)(1,oWt,2,2)(2,sWt,2,2)(3,gWt,3,0,"div",162)(4,uWt,5,1,"select",163),i&2){let t,M=p(6);xe((t=(t=M.filterBuilderSelectedOperator())==null?null:t.valueKind)==="text"?0:t==="date"?1:t==="number"?2:t==="multi-select"?3:t==="select"?4:-1)}}function DWt(i,e){i&1&&($(0,"div",160),Mt(1,"nile-spinner",172),$(2,"span"),Y(3,"Loading values\u2026"),ee()())}function IWt(i,e){if(i&1){let t=Le();$(0,"div",151)(1,"select",157),Ze("ngModelChange",function(n){P(t);let r=p(5);return R(r.onFilterBuilderFieldChange(n))}),ht(2,iWt,2,2,"option",158,Xst),ee(),$(4,"select",157),Ze("ngModelChange",function(n){P(t);let r=p(5);return R(r.onFilterBuilderOperatorChange(n))}),ht(5,MWt,2,2,"option",158,Yj),ee(),he(7,cWt,5,1),$(8,"nile-button",159),Ze("click",function(){P(t);let n=p(5);return R(n.submitFilterBuilder())}),Y(9," Add filter "),ee(),he(10,DWt,4,0,"div",160),ee()}if(i&2){let t=p(5);L(),ot("ngModel",t.filterBuilderField),L(),xt(t.filterBuilderFields()),L(2),ot("ngModel",t.filterBuilderOperation),L(),xt(t.filterBuilderOperators()),L(2),xe(t.ephemeralFilterValuesLoading?-1:7),L(),It("loading",t.filterBuilderApplying?"":null)("disabled",t.filterBuilderApplying||t.ephemeralFilterValuesLoading?"":null),L(2),xe(t.ephemeralFilterValuesLoading?10:-1)}}function dWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(5);L(),it(t.filterBuilderError)}}function jWt(i,e){if(i&1&&(he(0,$_t,3,0,"div",149),he(1,q_t,3,0,"div",150),he(2,K_t,4,0,"div",130)(3,eWt,2,1,"p",132)(4,tWt,2,0,"p",131)(5,IWt,11,6,"div",151),he(6,dWt,2,1,"p",132)),i&2){let t=p(2).$implicit,M=p(2);xe(M.filterBuilderActiveFilters().length>0?0:-1),L(),xe(M.timeWindowField(t)?1:-1),L(),xe(M.ephemeralFilterFieldsLoading?2:M.ephemeralFilterFieldsError?3:M.filterBuilderFields().length===0?4:5),L(4),xe(M.filterBuilderError?6:-1)}}function yWt(i,e){if(i&1){let t=Le();$(0,"span",152),Y(1),$(2,"button",153),Ze("click",function(){let n=P(t).$implicit,r=p(6);return R(r.removeEphemeralFilter(n.id))}),Mt(3,"nile-glyph",154),ee()()}if(i&2){let t=e.$implicit,M=p(6);L(),yi(" ",M.ephemeralFilterChipLabel(t)," "),L(),It("disabled",M.ephemeralFilterApplying?"":null)}}function TWt(i,e){if(i&1&&($(0,"div",149),ht(1,yWt,4,2,"span",152,V3),ee()),i&2){let t=p(5);L(),xt(t.ephemeralFilterActiveFilters())}}function AWt(i,e){if(i&1){let t=Le();$(0,"button",156),Ze("click",function(){let n=P(t).$implicit,r=p(4).$implicit,o=p(2);return R(o.applyQuickTimeFilter(r,n.value))}),Y(1),ee()}if(i&2){let t=e.$implicit,M=p(6);It("disabled",M.ephemeralFilterApplying?"":null),L(),yi(" ",t.label," ")}}function zWt(i,e){if(i&1&&($(0,"div",150),ht(1,AWt,2,2,"button",155,Yj),ee()),i&2){let t=p(5);L(),xt(t.quickTimePresets)}}function hWt(i,e){i&1&&($(0,"div",130),Mt(1,"nile-spinner",133),$(2,"span"),Y(3,"Loading filterable fields\u2026"),ee()())}function xWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(5);L(),it(t.ephemeralFilterFieldsError)}}function pWt(i,e){i&1&&($(0,"p",131),Y(1,"No filterable fields found for this widget's data."),ee())}function LWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.name),L(),it(t.label)}}function OWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.value),L(),it(t.label)}}function mWt(i,e){if(i&1){let t=Le();$(0,"input",164),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.ephemeralFilterBuilderValue,n)||(r.ephemeralFilterBuilderValue=n),R(n)}),Ze("keydown.enter",function(){P(t);let n=p(7);return R(n.addEphemeralFilter())}),ee()}if(i&2){let t=p(7);Nl("ngModel",t.ephemeralFilterBuilderValue)}}function EWt(i,e){if(i&1){let t=Le();$(0,"span",166),Y(1,"and"),ee(),$(2,"input",165),cl("ngModelChange",function(n){P(t);let r=p(8);return ul(r.ephemeralFilterBuilderValue2,n)||(r.ephemeralFilterBuilderValue2=n),R(n)}),ee()}if(i&2){let t=p(8);L(2),Nl("ngModel",t.ephemeralFilterBuilderValue2)}}function fWt(i,e){if(i&1){let t=Le();$(0,"input",165),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.ephemeralFilterBuilderValue,n)||(r.ephemeralFilterBuilderValue=n),R(n)}),ee(),he(1,EWt,3,1)}if(i&2){let t,M=p(7);Nl("ngModel",M.ephemeralFilterBuilderValue),L(),xe((t=M.ephemeralFilterSelectedOperator())!=null&&t.needsSecondValue?1:-1)}}function SWt(i,e){if(i&1){let t=Le();$(0,"span",166),Y(1,"and"),ee(),$(2,"input",168),cl("ngModelChange",function(n){P(t);let r=p(8);return ul(r.ephemeralFilterBuilderValue2,n)||(r.ephemeralFilterBuilderValue2=n),R(n)}),ee()}if(i&2){let t=p(8);L(2),Nl("ngModel",t.ephemeralFilterBuilderValue2)}}function wWt(i,e){if(i&1){let t=Le();$(0,"input",167),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.ephemeralFilterBuilderValue,n)||(r.ephemeralFilterBuilderValue=n),R(n)}),Ze("keydown.enter",function(){P(t);let n=p(7);return R(n.addEphemeralFilter())}),ee(),he(1,SWt,3,1)}if(i&2){let t,M=p(7);Nl("ngModel",M.ephemeralFilterBuilderValue),L(),xe((t=M.ephemeralFilterSelectedOperator())!=null&&t.needsSecondValue?1:-1)}}function CWt(i,e){if(i&1){let t=Le();$(0,"label",169)(1,"input",170),Ze("change",function(){let n=P(t).$implicit,r=p(8);return R(r.toggleEphemeralFilterMultiValue(n.value))}),ee(),$(2,"span"),Y(3),ee()()}if(i&2){let t=e.$implicit,M=p(8);L(),ot("checked",M.ephemeralFilterBuilderValues.includes(t.value)),L(2),Jo("",t.label,"",t.count!=null?" ("+t.count+")":"")}}function kWt(i,e){if(i&1&&($(0,"div",162),ht(1,CWt,4,3,"label",169,Yj),ee()),i&2){let t=p(5).$implicit,M=p(2);L(),xt(M.filterValuesFor(t,M.ephemeralFilterBuilderFieldId))}}function bWt(i,e){if(i&1&&($(0,"option",158),Y(1),ee()),i&2){let t=e.$implicit;ot("value",t.value),L(),Jo("",t.label,"",t.count!=null?" ("+t.count+")":"")}}function QWt(i,e){if(i&1){let t=Le();$(0,"select",157),cl("ngModelChange",function(n){P(t);let r=p(7);return ul(r.ephemeralFilterBuilderValue,n)||(r.ephemeralFilterBuilderValue=n),R(n)}),$(1,"option",171),Y(2,"Select\u2026"),ee(),ht(3,bWt,2,3,"option",158,Yj),ee()}if(i&2){let t=p(5).$implicit,M=p(2);Nl("ngModel",M.ephemeralFilterBuilderValue),L(3),xt(M.filterValuesFor(t,M.ephemeralFilterBuilderFieldId))}}function UWt(i,e){if(i&1&&he(0,mWt,1,1,"input",161)(1,fWt,2,2)(2,wWt,2,2)(3,kWt,3,0,"div",162)(4,QWt,5,1,"select",163),i&2){let t,M=p(6);xe((t=(t=M.ephemeralFilterSelectedOperator())==null?null:t.valueKind)==="text"?0:t==="date"?1:t==="number"?2:t==="multi-select"?3:t==="select"?4:-1)}}function vWt(i,e){i&1&&($(0,"div",160),Mt(1,"nile-spinner",172),$(2,"span"),Y(3,"Loading values\u2026"),ee()())}function YWt(i,e){if(i&1){let t=Le();$(0,"div",151)(1,"select",157),Ze("ngModelChange",function(n){P(t);let r=p(5);return R(r.onEphemeralFilterFieldChange(n))}),ht(2,LWt,2,2,"option",158,Xst),ee(),$(4,"select",157),Ze("ngModelChange",function(n){P(t);let r=p(5);return R(r.onEphemeralFilterOperatorChange(n))}),ht(5,OWt,2,2,"option",158,Yj),ee(),he(7,UWt,5,1),$(8,"nile-button",159),Ze("click",function(){P(t);let n=p(5);return R(n.addEphemeralFilter())}),Y(9," Add filter "),ee(),he(10,vWt,4,0,"div",160),ee()}if(i&2){let t=p(5);L(),ot("ngModel",t.ephemeralFilterBuilderFieldId),L(),xt(t.ephemeralFilterFields()),L(2),ot("ngModel",t.ephemeralFilterBuilderOperator),L(),xt(t.ephemeralFilterOperators()),L(2),xe(t.ephemeralFilterValuesLoading?-1:7),L(),It("loading",t.ephemeralFilterApplying?"":null)("disabled",t.ephemeralFilterApplying||t.ephemeralFilterValuesLoading?"":null),L(2),xe(t.ephemeralFilterValuesLoading?10:-1)}}function ZWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(5);L(),it(t.ephemeralFilterApplyError)}}function _Wt(i,e){if(i&1&&($(0,"p",131),Y(1,"Filters this preview only \u2014 nothing is saved."),ee(),he(2,TWt,3,0,"div",149),he(3,zWt,3,0,"div",150),he(4,hWt,4,0,"div",130)(5,xWt,2,1,"p",132)(6,pWt,2,0,"p",131)(7,YWt,11,6,"div",151),he(8,ZWt,2,1,"p",132)),i&2){let t=p(2).$implicit,M=p(2);L(2),xe(M.ephemeralFilterActiveFilters().length>0?2:-1),L(),xe(M.timeWindowField(t)?3:-1),L(),xe(M.ephemeralFilterFieldsLoading?4:M.ephemeralFilterFieldsError?5:M.ephemeralFilterFields().length===0?6:7),L(4),xe(M.ephemeralFilterApplyError?8:-1)}}function WWt(i,e){if(i&1){let t=Le();$(0,"nile-dropdown",126),Ze("nile-hide",function(){P(t);let n=p().$implicit,r=p(2);return R((r.dashboardId?r.filterBuilderWidgetId:r.ephemeralFilterBuilderWidgetId)===n.id&&(r.dashboardId?r.closeFilterBuilder():r.closeEphemeralFilterBuilder()))}),$(1,"button",127),Mt(2,"nile-glyph",147),ee(),$(3,"div",148),he(4,jWt,7,4)(5,_Wt,9,4),ee()()}if(i&2){let t=p().$implicit,M=p(2);ot("open",(M.dashboardId?M.filterBuilderWidgetId:M.ephemeralFilterBuilderWidgetId)===t.id),L(4),xe(M.dashboardId?4:5)}}function PWt(i,e){if(i&1){let t=Le();$(0,"div",104)(1,"button",173),Ze("click",function(){P(t);let n=p().$implicit,r=p(2);return R(r.applyDataViewFilter(n))}),Y(2," Apply filter "),ee()()}}function RWt(i,e){i&1&&($(0,"div",180),Mt(1,"nile-glyph",184),ee())}function VWt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"tweak"))}),Mt(1,"nile-glyph",185),Y(2," Tweak "),ee(),$(3,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"edit"))}),Mt(4,"nile-glyph",186),Y(5," Edit "),ee(),$(6,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"delete"))}),Mt(7,"nile-glyph",187),Y(8," Delete "),ee()}}function BWt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"setAlert"))}),Mt(1,"nile-glyph",188),Y(2," Set Alert "),ee()}}function FWt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(4).$implicit,r=p(2);return R(r.onMenuAction(n,"toggleFilterDefault"))}),Mt(1,"nile-glyph",189),Y(2),ee()}if(i&2){let t=p(4).$implicit,M=p(2);L(),ot("name",M.isFilterDefaultActive(t)?"ng-x-close":"ng-check"),L(),yi(" ",M.isFilterDefaultActive(t)?"Clear default filter":"Set current filter as default"," ")}}function HWt(i,e){if(i&1){let t=Le();$(0,"div",178),he(1,RWt,2,0,"div",180),$(2,"button",181),Ze("click",function(){P(t);let n=p(3).$implicit,r=p(2);return R(r.openFilterKebab(n))}),Mt(3,"nile-glyph",182),ee(),$(4,"nile-context-menu",113),Ze("nile-change",function(n){P(t);let r=p(3).$implicit,o=p(2);return R(o.onFilterKebabChange(r,n))}),$(5,"nile-context-menu-group",183),he(6,VWt,9,0),he(7,BWt,3,0,"nile-context-menu-item",116),he(8,FWt,3,2,"nile-context-menu-item",116),ee()()()}if(i&2){let t=p(3).$implicit,M=p(2);L(),xe(M.editMode?1:-1),L(),ot("id",M.kebabIdFor(t.id,"filter")),It("aria-expanded",M.filterKebabWidgetId===t.id),L(2),ot("open",M.filterKebabWidgetId===t.id),It("for",M.kebabIdFor(t.id,"filter")),L(2),xe(M.editMode?6:-1),L(),xe(M.showSetAlertFor(t)?7:-1),L(),xe(M.canToggleFilterDefault(t)?8:-1)}}function JWt(i,e){if(i&1){let t=Le();$(0,"div",175)(1,"div",176)(2,"span",177),Y(3),ee()(),he(4,HWt,9,8,"div",178),ee(),$(5,"shared-manual-filter-panel",179),Ze("conditionsChange",function(n){P(t);let r=p(2).$implicit,o=p(2);return R(o.onManualConditionsChange(r,n))})("contentHeight",function(n){P(t);let r=p(2).$implicit,o=p(2);return R(o.onFilterContentHeight(r,n))})("overflowCountChange",function(n){P(t);let r=p(2).$implicit,o=p(2);return R(o.onFilterOverflow(r,n))}),ee()}if(i&2){let t=p(2).$implicit,M=p(2);L(3),it(M.filterHeaderTitle),L(),xe((M.editMode||M.showSetAlertFor(t))&&M.showWidgetMenu?4:-1),L(),ot("catalog",M.catalogFor(t.id))("conditions",M.manualStateFor(t.id).conditions)("catalogLoading",!M.catalogFor(t.id).length)("disabled",M.widgetsLoading)("valueFetcher",M.valueFetcher())("onDashboardFields",M.observedFields())("recentlyUsedFields",M.recentlyUsedFields())("expanded",M.expandedFilterId()===t.id)}}function GWt(i,e){if(i&1&&($(0,"p",132),Y(1),ee()),i&2){let t=p(4);L(),it(t.filterDefaultError)}}function $Wt(i,e){if(i&1){let t=Le();$(0,"div",174)(1,"span",190),Ze("click",function(){P(t);let n=p(2).$implicit,r=p(2);return R(r.toggleFilterExpand(n))})("keydown.enter",function(){P(t);let n=p(2).$implicit,r=p(2);return R(r.toggleFilterExpand(n))}),Y(2),ee()()}if(i&2){let t=p(2).$implicit,M=p(2);L(2),yi(" ",M.expandedFilterId()===t.id?"Show less":"+"+M.filterOverflowFor(t.id)+" more"," ")}}function XWt(i,e){if(i&1&&(he(0,JWt,6,10),he(1,GWt,2,1,"p",132),he(2,$Wt,3,1,"div",174)),i&2){let t=p().$implicit,M=p(2);xe(M.isManualMode(t.id)?0:-1),L(),xe(M.filterDefaultError?1:-1),L(),xe(M.isManualMode(t.id)&&(M.filterOverflowFor(t.id)>0||M.expandedFilterId()===t.id)?2:-1)}}function qWt(i,e){if(i&1){let t=Le();$(0,"gridster-item",96)(1,"div",97),he(2,d_t,6,3,"div",98),$(3,"div",99),Ze("click",function(n){let r=P(t).$implicit,o=p(2);return R(o.onWidgetBodyClick(r,n))}),$(4,"shared-nile-chart-widget",100),Ze("aiSend",function(n){P(t);let r=p(2);return R(r.onAiSend(n))})("filterSubmit",function(n){P(t);let r=p(2);return R(r.onFilterSubmit(n))})("filterChange",function(n){P(t);let r=p(2);return R(r.onFilterChange(n))})("chartClick",function(n){let r=P(t).$implicit,o=p(2);return R(o.onChartClick(r,n))})("chartSelection",function(n){let r=P(t).$implicit,o=p(2);return R(o.onChartSelection(r,n))})("chartSelectionReset",function(){let n=P(t).$implicit,r=p(2);return R(r.onChartSelectionReset(n))})("cellFilter",function(n){let r=P(t).$implicit,o=p(2);return R(o.onCellFilter(r,n))})("dataViewFilterChange",function(n){let r=P(t).$implicit,o=p(2);return R(o.onDataViewFilterChange(r.id,n))})("gridFilterVerdict",function(n){P(t);let r=p(2);return R(r.onGridFilterVerdict(n))})("menuAction",function(n){let r=P(t).$implicit,o=p(2);return R(o.onMenuAction(r,n))})("remounted",function(){let n=P(t).$implicit,r=p(2);return R(r.onWidgetRemounted(n.id))}),he(5,j_t,2,0,"div",101),he(6,y_t,2,1,"div",102),he(7,k_t,2,0),he(8,F_t,8,3,"nile-dropdown",103),he(9,J_t,8,1,"nile-dropdown",103),he(10,WWt,6,2,"nile-dropdown",103),ee(),he(11,PWt,3,0,"div",104),ee(),he(12,XWt,3,3),ee()()}if(i&2){let t,M=e.$implicit,n=p(2);Wt("gridster-item--menu-open",n.hasOpenOverlay(M.id)),ot("item",n.getItemForWidget(M)),L(),Wt("widget-card--filter-inactive",n.showFilterNotice(M))("widget-card--filter",n.isFilterWidget(M))("widget-card--menu-open",n.hasOpenOverlay(M.id)),It("data-widget-id",M.id),L(),xe(n.showFilterNotice(M)?2:-1),L(),Wt("widget-body--hidden",n.isFilterWidget(M)&&n.isManualMode(M.id)),L(),ot("config",n.displayConfigFor(M))("drilldownBy",M.drilldownBy)("widgetId",M.id)("widgetTitle",M.title)("chromePinned",n.editMode||n.selectable)("loading",n.widgetsLoading&&!n.isFilterWidget(M)||M.id===n.tweakingWidgetId||n.isRecordsLoading(M)||M.id===n.forecastingWidgetId)("menu",n.chartMenuFor(M))("dashboardFilters",n.dashboardFilters)("resolvedFilters",n.resolvedFilters)("dashboardId",n.dashboardId)("conversationId",n.conversationId)("cellFilterEnabled",n.hasFilterWidget()&&n.viewModeFor(M)!=="data"),L(),xe(n.editMode?5:-1),L(),xe(n.selectable?6:-1),L(),xe(n.showWidgetMenu&&((t=n.menuFor(M).items)!=null&&t.length)?7:-1),L(),xe(n.canShowChartTypePicker(M)?8:-1),L(),xe(n.canShowColorPicker(M)?9:-1),L(),xe(n.canShowFilterPicker(M)?10:-1),L(),xe(n.viewModeFor(M)==="data"&&n.hasPendingDataViewFilter(M)?11:-1),L(),xe(n.isFilterWidget(M)?12:-1)}}function KWt(i,e){if(i&1&&($(0,"gridster",94),ht(1,qWt,13,33,"gridster-item",95,V3),ee()),i&2){let t=p();Wt("grid-hidden",t.widgets.length===0&&t.editMode),ot("options",t.options),L(),xt(t.gridWidgets())}}function ePt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-item",124),Ze("click",function(){let n=P(t).$implicit,r=p(2);return R(r.pickDrillOption(n))}),Mt(1,"nile-glyph",194),Y(2),ee()}if(i&2){let t=e.$implicit;L(),It("name",t.drillDownIcon||"ng-tag"),L(),yi(" ",t.drillDownName," ")}}function tPt(i,e){if(i&1){let t=Le();$(0,"nile-context-menu-group")(1,"nile-context-menu-item",124),Ze("click",function(){P(t);let n=p(2);return R(n.pickAddAsFilter())}),Mt(2,"nile-glyph",195),Y(3," Add as filter "),ee()()}}function iPt(i,e){if(i&1){let t=Le();Mt(0,"span",191),$(1,"nile-context-menu",192),Ze("nile-change",function(n){P(t);let r=p();return R(r.onDrillMenuChange(n))}),$(2,"nile-context-menu-group",193),ht(3,ePt,3,2,"nile-context-menu-item",116,r_t),ee(),he(5,tPt,4,0,"nile-context-menu-group"),ee()}if(i&2){let t=e,M=p();aM("left",t.x,"px")("top",t.y,"px"),ot("id",M.drillAnchorId),L(),ot("open",!0),It("for",M.drillAnchorId),L(2),xt(t.options),L(2),xe(t.conditions!=null&&t.conditions.length?5:-1)}}function MPt(i,e){if(i&1){let t=Le();$(0,"button",196),Ze("click",function(){let n=P(t).$implicit,r=p();return R(r.useTweakExample(n))}),Mt(1,"nile-glyph",197),$(2,"span"),Y(3),ee()()}if(i&2){let t=e.$implicit;L(3),it(t)}}function nPt(i,e){if(i&1&&($(0,"span",19),Y(1),ee()),i&2){let t=p();L(),it(t.dslChartTypeLabel)}}function rPt(i,e){if(i&1){let t=Le();$(0,"nile-button",13),Ze("click",function(){P(t);let n=p();return R(n.resetDslQuery())}),Mt(1,"nile-glyph",198),Y(2," Reset to saved query "),ee()}if(i&2){let t=p();It("disabled",t.dslApplying?"":null)}}function oPt(i,e){if(i&1){let t=Le();$(0,"div",23),Mt(1,"nile-glyph",199),$(2,"span",200),Y(3),ee(),$(4,"button",201),Ze("click",function(){P(t);let n=p();return R(n.dslError=null)}),Mt(5,"nile-glyph",202),ee()()}if(i&2){let t=p();L(3),it(t.dslError)}}function aPt(i,e){if(i&1){let t=Le();$(0,"section",25)(1,"header",27)(2,"span",28),Y(3,"Query"),ee(),$(4,"span",203)(5,"button",204),Ze("click",function(){P(t);let n=p();return R(n.formatDslQuery())}),Mt(6,"nile-glyph",205),Y(7," Format "),ee(),$(8,"button",206),Ze("click",function(){P(t);let n=p();return R(n.copyDslQuery())}),Mt(9,"nile-glyph",207),Y(10),ee(),$(11,"span",208),Mt(12,"nile-glyph",207),Y(13),ee()()(),$(14,"nile-code-editor",209),Ze("nile-change",function(n){P(t);let r=p();return R(r.onDslTextChange(n.detail.value))}),ee()()}if(i&2){let t=p();L(5),ot("disabled",t.dslApplying),L(4),It("name",t.dslCopied?"ng-check":"ng-copy"),L(),yi(" ",t.dslCopied?"Copied":"Copy"," "),L(),Wt("dsl-validity--ok",t.dslValidity.ok),It("title",t.dslValidity.error),L(),It("name",t.dslValidity.ok?"ng-check":"ng-alert-triangle"),L(),yi(" ",t.dslValidity.ok?"Valid "+t.dslTerm:"Invalid "+t.dslTerm," "),L(),ot("expandable",!1)("value",t.dslQueryText),It("language",t.dslCodeEditorLanguage)("readonly",t.dslApplying?"":null)}}function sPt(i,e){if(i&1&&($(0,"span",30),Y(1),ee()),i&2){let t=p();L(),Jo(" ",t.dslTurns.length," ",t.dslTurns.length===1?"change":"changes"," this session ")}}function lPt(i,e){i&1&&($(0,"p",32),Y(1," Describe a change and the assistant rewrites the query. Nothing is saved until you apply. "),ee())}function gPt(i,e){if(i&1&&($(0,"div",217)(1,"span",218),Y(2),ee(),$(3,"span",219),Y(4),ee()()),i&2){let t=e.$implicit;zG("dsl-diff-line--"+t.kind),L(2),it(t.kind==="add"?"+":t.kind==="remove"?"\u2212":" "),L(2),it(t.text)}}function NPt(i,e){if(i&1&&($(0,"div",212),ht(1,gPt,5,4,"div",216,Mr),ee()),i&2){let t=p(),M=t.$implicit,n=t.$index,r=p();L(),xt(r.dslExpandedTurn===n?M.diff:M.changed)}}function uPt(i,e){if(i&1){let t=Le();$(0,"button",220),Ze("click",function(){P(t);let n=p().$index,r=p();return R(r.toggleDslDiff(n))}),Y(1),ee()}if(i&2){let t=p().$index,M=p();L(),yi(" ",M.dslExpandedTurn===t?"Hide full diff":"View full diff"," ")}}function cPt(i,e){if(i&1){let t=Le();$(0,"button",221),Ze("click",function(){P(t);let n=p().$index,r=p();return R(r.undoDslTurn(n))}),Y(1," Undo this change "),ee()}if(i&2){let t=p().$index,M=p();ot("disabled",M.dslApplying||M.dslGenerating)("title",t===M.dslTurns.length-1?"Restore the query to before this change":"Restore the query to before this change \u2014 later changes are discarded")}}function DPt(i,e){if(i&1&&(Mt(0,"nile-ai-chat-bubble",33),$(1,"nile-ai-chat-bubble",210)(2,"p",211),Y(3),ee(),he(4,NPt,3,0,"div",212),$(5,"nile-ai-message-actions",213),he(6,uPt,2,1,"button",214),he(7,cPt,2,2,"button",215),ee()()),i&2){let t=e.$implicit,M=p();ot("role","user")("message",t.prompt),L(),ot("role","ai")("agent","Query assistant")("icon","ng-code"),L(2),it(t.summary),L(),xe(M.dslDevMode&&t.wasModified&&t.changed.length?4:-1),L(),ot("copy",M.dslDevMode)("copyValue",t.after),L(),xe(M.dslDevMode&&t.wasModified&&t.changed.length?6:-1),L(),xe(t.wasModified?7:-1)}}function IPt(i,e){if(i&1&&Mt(0,"nile-ai-chat-bubble",33),i&2){let t=p();ot("role","user")("message",t.dslPendingPrompt)}}function dPt(i,e){i&1&&Mt(0,"nile-ai-chat-bubble",34),i&2&&ot("role","ai")("agent","Query assistant")("icon","ng-code")("thinking","")("loading",!0)}function jPt(i,e){if(i&1){let t=Le();$(0,"button",231),Ze("click",function(){let n=P(t).$implicit,r=p(2);return R(r.onForecastGranularity(n))}),Y(1),ee()}if(i&2){let t=e.$implicit,M=p(2);Wt("fc-seg__btn--on",M.forecastDraft.granularity===t),L(),it(t)}}function yPt(i,e){if(i&1){let t=Le();$(0,"button",231),Ze("click",function(){let n=P(t).$implicit,r=p(2);return R(r.onForecastConfidence(n))}),Y(1),ee()}if(i&2){let t=e.$implicit,M=p(2);Wt("fc-seg__btn--on",M.forecastDraft.confidence===t),L(),yi("",t,"%")}}function TPt(i,e){if(i&1&&($(0,"span",232),Y(1),$(2,"strong"),Y(3),ee()()),i&2){let t=e.$implicit;L(),it(t.label),L(2),it(t.value)}}function APt(i,e){i&1&&($(0,"span",226),Y(1,"This forecast"),ee(),ht(2,TPt,4,2,"span",232,o_t)),i&2&&(L(2),xt(e))}function zPt(i,e){if(i&1){let t=Le();$(0,"div",222)(1,"label",223),Y(2," Horizon \u2014 "),$(3,"strong"),Y(4),ee(),Y(5),ee(),$(6,"input",224),Ze("input",function(n){P(t);let r=p();return R(r.onForecastHorizon(n.target.value))}),ee(),$(7,"p",225),Y(8),ee(),$(9,"span",226),Y(10,"Granularity"),ee(),$(11,"div",227),ht(12,jPt,2,3,"button",228,Ho),ee(),$(14,"p",225),Y(15,"Coarser buckets are reachable; finer ones are not."),ee(),$(16,"span",226),Y(17,"Confidence interval \u2014 "),$(18,"strong"),Y(19),ee()(),$(20,"div",229),ht(21,yPt,2,3,"button",228,Ho),ee(),$(23,"p",225),Y(24,"A wider band is more likely to contain the real value. 80% is a good default."),ee(),he(25,APt,4,0),ee(),$(26,"div",230)(27,"nile-button",13),Ze("click",function(){P(t);let n=p();return R(n.closeForecastSettings())}),Y(28,"Cancel"),ee(),$(29,"nile-button",14),Ze("click",function(){P(t);let n=p();return R(n.applyForecastSettings())}),Y(30,"Apply"),ee()()}if(i&2){let t,M=p();L(4),it(M.forecastDraft.horizon),L(),Jo(" ",M.forecastPeriodWord,"",M.forecastDraft.horizon===1?"":"s"," "),L(),ot("value",M.forecastDraft.horizon),It("max",M.forecastMaxHorizon),L(2),yi("Capped at ",M.forecastMaxHorizon," for this widget \u2014 half the history the model was fitted on."),L(4),xt(M.forecastGranularities),L(7),yi("",M.forecastDraft.confidence,"%"),L(2),xt(M.forecastConfidences),L(4),xe((t=M.forecastProvenance)?25:-1,t)}}function hPt(i,e){if(i&1){let t=Le();$(0,"shared-widget-detail-panel",233),Ze("closed",function(){P(t);let n=p();return R(n.closeDetailLevel())}),Mt(1,"shared-dashboard-grid",234),sl(2,0,M_t),ee()}if(i&2){let t=p();ot("crumbs",t.detail.breadcrumb())("loading",t.detail.loading())("label",t.detailRootLabel),L(),ot("widgets",t.detail.content())("editMode",!1)("showWidgetMenu",!1)("selectable",!1)("autoHeight",!0)("dashboardId",t.dashboardId)("resolvedFilters",t.resolvedFilters)("detailPanel",t.detailPanel)("detailDepth",t.detailDepth+1)("detailRootLabel",t.detailRootLabel)}}var Gst=2e3,xPt={line:"Line chart",area:"Area chart",bar:"Bar chart",column:"Column chart",pie:"Pie chart",donut:"Donut chart",scatter:"Scatter chart",heatmap:"Heatmap",funnel:"Funnel chart",gauge:"Gauge",radar:"Radar chart",waterfall:"Waterfall chart",kpi:"KPI",table:"Table",grid:"Data grid"},wA=class i{constructor(e,t,M=null,n=null,r=null,o=null,a=null,s=null,l=null,N=null,c=null,D=null,I=null){this.host=e;this.observed=t;this.filterValuesFetcher=M;this.dslEditorFetcher=n;this.recordsFetcher=r;this.chartTypeFetcher=o;this.widgetFilterFetcher=a;this.adhocFilterFetcher=s;this.filterDefaultFetcher=l;this.evidenceProviders=N;this.storiesFetcher=c;this.router=D;this.cdr=I;this.decorated=this.filterValuesFetcher?Jst(this.filterValuesFetcher,this.observed):null}host;observed;filterValuesFetcher;dslEditorFetcher;recordsFetcher;chartTypeFetcher;widgetFilterFetcher;adhocFilterFetcher;filterDefaultFetcher;evidenceProviders;storiesFetcher;router;cdr;widgets=[];editMode=!0;autoHeight=!1;dashboardId=null;conversationId=null;persistToPublished=!1;filtersEnabled=!0;tweakingWidgetId=null;forecastingWidgetId=null;loading=!1;outerMargin=!0;canvasBackgroundColor=null;widgetsLoading=!1;showTweakInViewMode=!1;showEditDslInViewMode=!1;canSetAlert=!1;canAddToStory=!1;canForecast=!1;canAsk=!0;canChangeChartType=!0;canManageFilters=!0;canCustomizeColors=!0;canViewChartData=!0;canExportPng=!0;canExportCsv=!0;canPrint=!0;canTweak=!0;canEdit=!0;canDelete=!0;forecastable={};showWidgetMenu=!0;selectable=!1;detailPanel=!1;detailDepth=0;detailRootLabel="Dashboard";openDetailPanel(e){this.detailPanel&&pPt(e)&&(this.detailDepth>=R3||!this.detail.canOpen()||(this.detail.open(e,{depth:this.detailDepth,dashboardId:this.dashboardId,filters:this.resolvedFilters??[]}),this.pushDetailHistoryEntry()))}detailHistoryEntries=0;suppressPopstate=0;popStateHandler=()=>{if(this.suppressPopstate>0){this.suppressPopstate--;return}this.detailHistoryEntries!==0&&(this.detailHistoryEntries--,this.detail.isOpen()&&(this.detail.back(),this.cdr?.markForCheck()))};pushDetailHistoryEntry(){typeof history>"u"||history.pushState(U(x({},history.state??{}),{dvzDetailLevel:++this.detailHistoryEntries}),"")}spendDetailHistory(e){let t=Math.min(e,this.detailHistoryEntries);t<=0||typeof history>"u"||(this.detailHistoryEntries-=t,this.suppressPopstate+=t,history.go(-t))}closeDetailLevel(e=!1){let t=this.detail.depth();if(t!==0){if(e){this.detail.close(),this.spendDetailHistory(t);return}this.detail.back(),this.spendDetailHistory(1)}}_detail;get detail(){return this._detail??=new P3({rootLabel:()=>this.detailRootLabel,providers:this.evidenceProviders??[]})}selectedWidgetIds=null;dashboardFilters=null;resolvedFilters=null;applySummary=null;filterExplanation=null;timeFilterEnabled=!1;static FILTER_LAYER_INDEX=10;filterHeaderTitle=km;skeletonKpis=[0,1,2,3];skeletonCharts=[0,1,2,3];skeletonBars=[55,80,42,92,65,48,75];remove=new Xt;editWidget=new Xt;openAiBuilder=new Xt;updateLayout=new Xt;aiSend=new Xt;tweakWidget=new Xt;dslWidgetUpdated=new Xt;dslEditorClosed=new Xt;widgetChartTypeChanged=new Xt;widgetFiltersChanged=new Xt;widgetColorChanged=new Xt;filterSubmit=new Xt;filterChange=new Xt;timeRangeApply=new Xt;selectionChange=new Xt;setAlert=new Xt;addToStory=new Xt;widgetClick=new Xt;forecast=new Xt;selectedIds=new Set;tweakTargetId=null;tweakPromptText="";tweakSubmitting=!1;tweakExamples=["Convert this into a bar chart and make the title shorter","Convert this into a column chart and make red color","Convert this into a pie chart and use a blue pallete"];gridsterItems=[];options={gridType:IM.VerticalFixed,displayGrid:qh.OnDragAndResize,compactType:dn.None,pushItems:!0,swap:!1,margin:8,outerMargin:!1,maxLayerIndex:i.FILTER_LAYER_INDEX,minCols:12,maxCols:12,minRows:4,defaultItemCols:6,defaultItemRows:4,fixedRowHeight:72,disableAutoPositionOnConflict:!0,mobileBreakpoint:0,initCallback:(e,t)=>{this.gridApi=t,this.gridInstance=e},draggable:{enabled:!0,ignoreContent:!0,dragHandleClass:"widget-drag-handle",stop:()=>this.scheduleGestureReconcile()},resizable:{enabled:!0,handles:{s:!0,e:!0,n:!0,w:!0,se:!0,ne:!0,sw:!0,nw:!0},stop:()=>this.scheduleGestureReconcile()}};gridApi=null;gridInstance=null;expandedFilterId=ke(null);filterContentHeights=new Map;filterExtraRows=new Map;filterOverflowCounts=ke(new Map);resizeObserver=null;resizeRaf=0;lastGridWidth=0;lastGridHeight=0;ngOnChanges(e){(e.editMode||e.showTweakInViewMode||e.showEditDslInViewMode||e.showWidgetMenu||e.canAddToStory)&&this.menuCache.clear(),e.editMode&&(this.options=U(x({},this.options),{outerMargin:!this.editMode,draggable:U(x({},this.options.draggable),{enabled:this.editMode}),resizable:U(x({},this.options.resizable),{enabled:this.editMode}),displayGrid:this.editMode?qh.OnDragAndResize:qh.None})),e.outerMargin&&(this.options=U(x({},this.options),{outerMargin:this.outerMargin})),e.autoHeight&&(this.options=U(x({},this.options),{setGridSize:this.autoHeight})),e.dashboardId&&(this.observed.clear(),this.observedFields.set([]),this.menuCache.clear(),this.autoAppliedDefaultForDashboardId=null),(e.dashboardFilters&&!e.dashboardFilters.firstChange||e.resolvedFilters&&!e.resolvedFilters.firstChange)&&this.clearEphemeralOverrides(),e.widgets&&(this.observed.publish(Lst(this.widgets)),this.observedFields.set(this.observed.fields()),this.expandedFilterId.set(null),this.filterExtraRows.clear(),this.filterOverflowCounts.set(new Map),this.syncGridsterItems(),this.pruneManualState(),this.pruneEphemeralFilterState(),this.maybeAutoApplyDefaultFilter(),this.selectable?this.syncDefaultSelection():this.resetSelection()),e.selectable&&!this.selectable&&this.resetSelection(),e.selectedWidgetIds&&!e.widgets&&this.selectable&&this.syncDefaultSelection()}reasonText(e){let t=e?.id?this.gridFilterVerdicts.get(e.id):void 0;return t&&!t.applied?Rm({reason:t.reason}):Rm(e)}gridFilterVerdicts=new Map;onGridFilterVerdict(e){if(!e?.widgetId)return;let t=this.gridFilterVerdicts.get(e.widgetId);t&&t.applied===e.applied&&t.reason===e.reason||(this.gridFilterVerdicts.set(e.widgetId,{applied:e.applied,reason:e.reason}),this.cdr?.markForCheck())}showFilterNotice(e){if(!e)return!1;if(e.edited===!1)return!0;let t=e.id?this.gridFilterVerdicts.get(e.id):void 0;return!!t&&!t.applied}static DEFAULT_MANUAL_STATE={mode:"prompt",conditions:[]};static EMPTY_CATALOG=[];static SYNTHETIC_FILTER_KEY="manual-filter";manualFilterStates=ke(new Map);filterCatalogs=ke(new Map);observedFields=ke([]);recentlyUsedFields=ke([]);manualStateFor(e){return this.manualFilterStates().get(e)??i.DEFAULT_MANUAL_STATE}isManualMode(e){return this.manualStateFor(e).mode==="manual"}catalogFor(e){return this.filterCatalogs().get(e)??i.EMPTY_CATALOG}boundValueFetcher=async(e,t)=>{let M=this.dashboardId;if(!this.decorated||!M)return[];let n=(this.resolvedFilters??[]).filter(N=>N.field!==e),r=n.length>0?{resolvedFilters:n}:{};if(!(t??"").trim())return(await this.decorated(M,e,t,n.length>0?r:void 0)).values;let a=await this.decorated(M,e,t,U(x({},r),{matchMode:"substring"}));if(a.values.length>0)return a.values;let s=await this.decorated(M,e,t,U(x({},r),{matchMode:"fuzzy"}));return s.values.length>0?s.values:(await this.decorated(M,e,t,U(x({},r),{matchMode:"semantic"}))).values};valueFetcher(){return this.decorated&&this.dashboardId?this.boundValueFetcher:null}decorated=null;ngAfterViewInit(){if(typeof window<"u"&&window.addEventListener("popstate",this.popStateHandler),typeof ResizeObserver>"u"||typeof window>"u")return;let e=this.host.nativeElement.querySelector(".canvas-wrap")??this.host.nativeElement;this.lastGridWidth=e.clientWidth,this.lastGridHeight=e.clientHeight,this.resizeObserver=new ResizeObserver(()=>{this.resizeRaf&&cancelAnimationFrame(this.resizeRaf),this.resizeRaf=requestAnimationFrame(()=>{let t=e.clientWidth,M=e.clientHeight;t===this.lastGridWidth&&M===this.lastGridHeight||(this.lastGridWidth=t,this.lastGridHeight=M,this.gridApi?.resize(),window.dispatchEvent(new Event("resize")))})}),this.resizeObserver.observe(e)}ngOnDestroy(){this.resizeRaf&&cancelAnimationFrame(this.resizeRaf),this.resizeObserver?.disconnect(),this.resizeObserver=null,typeof window<"u"&&window.removeEventListener("popstate",this.popStateHandler),this.unwatchKebabScroll()}setManualState(e,t){this.manualFilterStates.update(M=>new Map(M).set(e,t))}firstFilterWidget(){return this.widgets.find(e=>this.isFilterWidget(e))}autoAppliedDefaultForDashboardId=null;maybeAutoApplyDefaultFilter(){if(this.autoAppliedDefaultForDashboardId===this.dashboardId)return;let e=this.firstFilterWidget(),t=this.filterDefaultControl(e);!e||!t?.autoApply||!t.defaultValue?.trim()||(this.autoAppliedDefaultForDashboardId=this.dashboardId,this.applyExpression(e,t.defaultValue))}filterDefaultControl(e){return e?.config?.chart?.controls?.[0]}filterDefaultBusy=!1;filterDefaultError=null;canToggleFilterDefault(e){return this.isFilterWidget(e)&&!!this.filterDefaultFetcher&&!!this.dashboardId}isFilterDefaultActive(e){return!!this.filterDefaultControl(e)?.autoApply}async toggleFilterDefault(e){if(!this.filterDefaultFetcher||!this.dashboardId||this.filterDefaultBusy)return;let t=this.filterDefaultControl(e),M=!!t?.autoApply,n=M?"":(this.lastAppliedFilter.get(e.id)??t?.value??"").trim();if(!M&&!n){this.filterDefaultError="Apply a filter first, then set it as the default.",this.cdr?.markForCheck();return}this.filterDefaultBusy=!0,this.filterDefaultError=null,this.cdr?.markForCheck();try{let r=await this.filterDefaultFetcher.set(this.dashboardId,e.id,n,!M,this.persistToPublished);this.widgetFiltersChanged.emit(r)}catch(r){this.filterDefaultError=r instanceof Error?r.message:"Could not update the default filter"}finally{this.filterDefaultBusy=!1,this.cdr?.markForCheck()}}hasFilterWidget(){return this.widgets.some(e=>this.isFilterWidget(e))}expressionControlIdOf(e){return e.config?.chart?.controls?.find(n=>(n.variant==="expression"||n.variant==="hybrid")&&n.id)?.id??null}chartWidgetFor(e){return this.chartWidgets?.find(t=>t.widgetId===e)}activeFilterMode(e){return this.manualStateFor(e.id).mode}gridWidgetsCache=null;gridWidgets(){let e=this.railReplacesCard(),t=this.gridWidgetsCache;if(t&&t.src===this.widgets&&t.rail===e)return t.out;let M=e?this.widgets.filter(n=>!this.isFilterWidget(n)):this.widgets;return this.gridWidgetsCache={src:this.widgets,rail:e,out:M},M}railVisible(){return this.hasFilterWidget()||this.timeFilterEnabled}railReplacesCard(){return this.hasFilterWidget()}railShift(){if(!this.railReplacesCard())return null;let e=this.firstFilterWidget();if(!e)return null;let t=this.gridsterItems.find(M=>M.widgetId===e.id)??this.buildItem(e);return{y:Number(t.y??0),rows:Number(t.rows??0)}}railItemsCache=null;railItems(){let e=this.railShift();if(!e)return null;let t=this.railItemsCache;if(t&&t.src===this.widgets&&t.edit===this.editMode)return t.map;let M=new Map;for(let n of this.widgets){if(this.isFilterWidget(n))continue;let r=this.gridsterItems.find(a=>a.widgetId===n.id)??this.buildItem(n),o=Number(r.y??0);M.set(n.id,U(x({},r),{y:o>e.y?Math.max(0,o-e.rows):o}))}return this.railItemsCache={src:this.widgets,edit:this.editMode,map:M},M}railMode(){let e=this.firstFilterWidget();return e?this.manualStateFor(e.id).mode:"prompt"}railConditions(){let e=this.firstFilterWidget();return e?this.manualStateFor(e.id).conditions:[]}railCatalog(){let e=this.firstFilterWidget();return e?this.catalogFor(e.id):[]}railExpression(){let e=this.firstFilterWidget();return e?this.chartWidgetFor(e.id)?.getLiveExpression()?.value??"":""}onRailModeChange(e){let t=this.firstFilterWidget();t&&this.useFilterMode(t,e)}onRailConditions(e){let t=this.firstFilterWidget();t&&this.onManualConditionsChange(t,e)}onRailExpressionRun(e){let t=this.firstFilterWidget();t&&(this.chartWidgetFor(t.id)?.setFilterExpression(e),this.applyExpression(t,e,{mode:"expression"}))}onRailPromptAsk(e){let t=this.firstFilterWidget();t&&this.applyExpression(t,e,{mode:"prompt",prompt:e})}onRailClearAll(){let e=this.firstFilterWidget();e&&(this.setManualState(e.id,U(x({},this.manualStateFor(e.id)),{conditions:[]})),this.chartWidgetFor(e.id)?.setFilterExpression(""),this.applyExpression(e,""))}onRailTimeRange(e){this.timeRangeApply.emit(e)}useFilterMode(e,t){if(this.activeFilterMode(e)===t)return;this.collapseExpandedFilter(),this.filterOverflowCounts.update(o=>{let a=new Map(o);return a.delete(e.id),a});let n=this.chartWidgetFor(e.id),r=this.manualStateFor(e.id);if(t==="manual"){this.setManualState(e.id,{mode:"manual",conditions:[]}),this.requestCatalog(e),this.syncAppliedFilter(e,"");return}if(t==="expression"){n?.setFilterMode("expression",""),this.setManualState(e.id,U(x({},r),{mode:"expression",conditions:[]})),this.requestCatalog(e),this.syncAppliedFilter(e,"");return}n?.setFilterMode("prompt",""),this.setManualState(e.id,U(x({},r),{mode:"prompt",conditions:[]})),this.syncAppliedFilter(e,"")}lastAppliedFilter=new Map;syncAppliedFilter(e,t){let M=(t??"").trim();(this.lastAppliedFilter.get(e.id)??"")!==M&&this.applyExpression(e,M)}onManualConditionsChange(e,t){this.setManualState(e.id,{mode:"manual",conditions:t}),this.trackRecentlyUsed(t),t.length||this.collapseExpandedFilter(),this.applyManualConditions(e)}trackRecentlyUsed(e){let t=e.map(M=>M.field).filter(M=>!!M);t.length&&this.recentlyUsedFields.update(M=>{let n=new Set,r=[];for(let o of[...t,...M])n.has(o)||(n.add(o),r.push(o));return r.slice(0,20)})}applyExpression(e,t,M){let n=this.expressionControlIdOf(e)??i.SYNTHETIC_FILTER_KEY,r=t.trim();this.lastAppliedFilter.set(e.id,r),this.filterSubmit.emit(x(x({widgetId:e.id,filters:r?{[n]:t}:{},errors:{}},M?.mode?{mode:M.mode}:{}),M?.mode==="prompt"&&r?{prompt:t}:{}))}applyManualConditions(e){this.applyExpression(e,YI(this.manualStateFor(e.id).conditions))}addFilterConditions(e){if(!e.length)return;let t=this.firstFilterWidget();if(!t)return;let M=this.manualStateFor(t.id),n=M.conditions;if(M.mode==="prompt")n=_m(this.resolvedFilters??[]);else if(M.mode==="expression"){let r=this.chartWidgetFor(t.id)?.getLiveExpression()?.value??"";if(r.trim()){let o=$B(r);if(o===null){if(Wm(r)){let a=`${r.trim()} and ${YI(e)}`;this.chartWidgetFor(t.id)?.setFilterExpression(a),this.applyExpression(t,a),this.requestCatalog(t);return}console.warn("[dashboard-filter] live expression uses or/not/grouping the apply engine can't combine with a click-added condition; leaving the expression unchanged.");return}n=o}else n=_m(this.resolvedFilters??[])}this.setManualState(t.id,{mode:"manual",conditions:HB(n,e)}),this.applyManualConditions(t),this.requestCatalog(t)}requestCatalog(e){let M=e.config?.chart?.controls?.find(n=>n.id)?.id;M&&this.filterChange.emit({widgetId:e.id,controlId:M,query:""})}pruneManualState(){let e=new Set(this.widgets.map(t=>t.id));this.manualFilterStates.update(t=>new Map([...t].filter(([M])=>e.has(M)))),this.filterCatalogs.update(t=>new Map([...t].filter(([M])=>e.has(M))));for(let t of[...this.lastAppliedFilter.keys()])e.has(t)||this.lastAppliedFilter.delete(t)}isSelected(e){return this.selectedIds.has(e)}toggleSelection(e,t){t?this.selectedIds.add(e):this.selectedIds.delete(e),this.selectionChange.emit([...this.selectedIds])}resetSelection(){this.lastWidgetIdsKey="",this.selectedIds.size!==0&&(this.selectedIds.clear(),queueMicrotask(()=>this.selectionChange.emit([])))}lastWidgetIdsKey="";syncDefaultSelection(){let e=this.widgets.map(r=>r.id),t=e.join("|")+"::"+(this.selectedWidgetIds?this.selectedWidgetIds.join(","):"*");if(t===this.lastWidgetIdsKey)return;this.lastWidgetIdsKey=t;let M=this.selectedWidgetIds,n=M!=null?e.filter(r=>M.includes(r)):e;this.selectedIds=new Set(n),queueMicrotask(()=>this.selectionChange.emit([...this.selectedIds]))}getItemForWidget(e){let t=this.railItems()?.get(e.id);if(t)return t;let M=this.gridsterItems.find(n=>n.widgetId===e.id);return M||this.buildItem(e)}toggleFilterExpand(e){this.expandedFilterId()===e.id?(this.expandedFilterId.set(null),this.filterExtraRows.delete(e.id)):(this.expandedFilterId.set(e.id),this.filterExtraRows.set(e.id,this.computeExtraRows(e))),this.syncGridsterItems()}onFilterContentHeight(e,t){if(this.filterContentHeights.set(e.id,t),this.expandedFilterId()!==e.id)return;let M=this.computeExtraRows(e);M!==(this.filterExtraRows.get(e.id)??0)&&(this.filterExtraRows.set(e.id,M),this.syncGridsterItems())}onFilterOverflow(e,t){this.filterOverflowCounts.update(M=>new Map(M).set(e.id,t))}filterOverflowFor(e){return this.filterOverflowCounts().get(e)??0}computeExtraRows(e){let t=this.filterContentHeights.get(e.id)??0,M=this.gridInstance?.curRowHeight??0;if(M<=0||t<=0)return 3;let r=Math.max(0,t-76);return Math.ceil(r/M)}expandedExtraRowsFor(e){return this.expandedFilterId()===e?this.filterExtraRows.get(e)??0:0}collapseExpandedFilter(){this.expandedFilterId()!==null&&(this.expandedFilterId.set(null),this.filterExtraRows.clear(),this.syncGridsterItems())}isKpi(e){return e.widgetType==="kpi"?!0:e.config?.chart?.type==="kpi"}isFilterWidget(e){return e.config?.chart?.type==="filter"}showSetAlertFor(e){return this.canSetAlert&&this.showWidgetMenu}showAddToStoryFor(e){return this.canAddToStory&&this.showWidgetMenu&&!!this.storiesFetcher&&!this.isFilterWidget(e)}hasForecast(e){return!!e?.config?.forecast?.enabled}showForecastFor(e){return!this.canForecast||!this.showWidgetMenu?!1:this.hasForecast(e)||!!this.forecastable[e.id]?.forecastable}isDslEditableWidget(e){let t=e.queryMeta?.adapterType;if(!t||!["opensearch","postgres","mssql"].includes(t))return!1;if(this.dashboardId)return!0;let M=e.queryMeta;return!!(M?.sql||M?.dsl)}widgetViewMode=ke(new Map);widgetRecords=ke(new Map);widgetRecordsLoading=ke(new Set);dataViewFilters=ke(new Map);confirmedDataViewFilters=ke(new Map);viewModeFor(e){return this.widgetViewMode().get(e.id)??"chart"}onDataViewFilterChange(e,t){let M=new Map(this.dataViewFilters());if(t?.length?M.set(e,t):M.delete(e),this.dataViewFilters.set(M),!t?.length&&this.confirmedDataViewFilters().has(e)){let n=new Map(this.confirmedDataViewFilters());n.delete(e),this.confirmedDataViewFilters.set(n)}}hasPendingDataViewFilter(e){return(this.dataViewFilters().get(e.id)?.length??0)>0}applyDataViewFilter(e){let t=this.dataViewFilters().get(e.id),M=new Map(this.confirmedDataViewFilters());if(t?.length?M.set(e.id,t):M.delete(e.id),this.confirmedDataViewFilters.set(M),this.widgetRecords().has(e.id)){let n=new Map(this.widgetRecords());n.delete(e.id),this.widgetRecords.set(n)}this.viewRecords(e)}widgetDataRows(e){return Gc(e.config?.chart)}recordsChartFor(e){return this.widgetRecords().get(e.id)??null}isRecordsLoading(e){return this.widgetRecordsLoading().has(e.id)}displayConfigFor(e){let t=this.viewModeFor(e);if(t==="data")return U(x({},e.config),{chart:this.buildDataViewChart(e)});if(t==="records"){let o=this.recordsChartFor(e);if(o)return o.config}let M=this.ephemeralKey(e),n=this.ephemeralFilterResult.get(M);return n?n?.config??e.config:this.ephemeralChartOverride.get(M)?.config??e.config}ephemeralKey(e){return`${e.id}::${e.title??""}`}ephemeralChartOverride=new Map;ephemeralFilters=new Map;ephemeralFilterSeq=0;ephemeralFilterFieldsCache=new Map;filterValuesCache=new Map;ephemeralFilterBaseConfig=new Map;ephemeralFilterResult=new Map;clearEphemeralOverrides(){!this.ephemeralChartOverride.size&&!this.ephemeralFilterResult.size&&!this.ephemeralFilters.size||(this.ephemeralChartOverride.clear(),this.ephemeralFilters.clear(),this.ephemeralFilterBaseConfig.clear(),this.ephemeralFilterResult.clear(),this.cdr?.markForCheck())}pruneEphemeralFilterState(){let e=new Set(this.widgets.map(M=>this.ephemeralKey(M))),t=M=>{for(let n of e)if(M===n||M.startsWith(`${n}::`))return!0;return!1};for(let M of[this.ephemeralChartOverride,this.ephemeralFilters,this.ephemeralFilterFieldsCache,this.ephemeralFilterBaseConfig,this.ephemeralFilterResult])for(let n of M.keys())e.has(n)||M.delete(n);for(let M of this.filterValuesCache.keys())t(M)||this.filterValuesCache.delete(M)}buildDataViewChart(e){let{columns:t,rows:M}=this.widgetDataRows(e);if(!(e.config?.chart?.type==="kpi"))return{type:"grid",data:M,columns:t.map(s=>({id:s,header:s,accessorKey:s,enableSorting:!0}))};let r=M[0]?.[t[0]]??null,o=i0(e);return{type:"grid",data:[{field:"Value",text:r,emphasize:!0},...o.map(s=>({field:s.label,text:s.text}))],columns:[{id:"field",header:"Field",accessorKey:"field",enableSorting:!1,width:"140px",cell:s=>j`<strong>${s.value}</strong>`},{id:"text",header:"Value",accessorKey:"text",enableSorting:!1,cell:s=>{let N=s.row.emphasize?"display:block;overflow-x:auto;white-space:nowrap;font-size:22px;font-weight:700;":"display:block;overflow-x:auto;white-space:nowrap;";return j`<span style=${N}>${s.value}</span>`}}]}}hasQueryableData(e){if(!this.recordsFetcher)return!1;let t=!!e.queryMeta?.sql,M=e.config?.chart?.type==="grid";return t&&!M}setWidgetViewMode(e,t){let M=new Map(this.widgetViewMode());t==="chart"?M.delete(e):M.set(e,t),this.widgetViewMode.set(M)}async viewRecords(e){if(this.setWidgetViewMode(e.id,"records"),!this.recordsFetcher||this.widgetRecords().has(e.id))return;let t=new Set(this.widgetRecordsLoading());t.add(e.id),this.widgetRecordsLoading.set(t);try{let M=this.confirmedDataViewFilters().get(e.id),n=M?.length?M.map(a=>({field:a.id,operation:"contains",value:a.value})):void 0,r=await this.recordsFetcher.fetch(e,n),o=new Map(this.widgetRecords());o.set(e.id,r.empty?null:r.chart),this.widgetRecords.set(o)}catch{let M=new Map(this.widgetRecords());M.set(e.id,null),this.widgetRecords.set(M)}finally{let M=new Set(this.widgetRecordsLoading());M.delete(e.id),this.widgetRecordsLoading.set(M),this.cdr?.markForCheck()}}menuCache=new Map;disabledMenu={enabled:!1,items:[]};menuFor(e){if(!this.showWidgetMenu)return this.disabledMenu;let t=this.isKpi(e),M=this.isFilterWidget(e),n=this.isDslEditableWidget(e),r=n?this.dslMenuLabelFor(e):null,o=this.showSetAlertFor(e),a=this.viewModeFor(e),s=this.hasQueryableData(e),l=M&&!!this.filterDefaultControl(e)?.autoApply,N=this.showForecastFor(e),c=this.hasForecast(e),D=`${this.canAsk}:${this.canChangeChartType}:${this.canManageFilters}:${this.canCustomizeColors}:${this.canViewChartData}:${this.canExportPng}:${this.canExportCsv}:${this.canPrint}:${this.canTweak}:${this.canEdit}:${this.canDelete}`,I=`${t}:${o}:${M}:${n}:${r}:${a}:${s}:${l}:${N}:${c}:${D}:${this.detailPanel}`,d=this.menuCache.get(I);if(d)return d;let y=[],A,z=O=>{if(!M){if(this.detailPanel){y.push({type:"custom",label:"Details",id:"viewDetailPanel",glyph:"ng-layers-three-01",divider:O});return}this.canViewChartData&&(a==="chart"?y.push({type:"custom",label:"Chart Data",id:"viewData",glyph:"ng-table",divider:O}):(y.push({type:"custom",label:"View Chart",id:"viewChart",glyph:"ng-chart-bar",divider:O}),s&&a!=="records"&&y.push({type:"custom",label:"View Records",id:"viewRecords",glyph:"ng-database"})))}},E=O=>{M||(this.canShowChartTypePicker(e)&&(y.push({type:"custom",label:"Change chart type",id:"changeChartType",glyph:"ng-chart-bar",divider:O}),O=!1),this.canShowFilterPicker(e)&&(y.push({type:"custom",label:"Apply filter",id:"manageFilters",glyph:"ng-filter-lines",divider:O}),O=!1),this.canShowColorPicker(e)&&y.push({type:"custom",label:"Customize colors",id:"customizeColors",glyph:"ng-palette",divider:O}))},S=O=>{!M||!this.filterDefaultFetcher||!this.dashboardId||y.push({type:"custom",label:l?"Clear default filter":"Set current filter as default",id:"toggleFilterDefault",glyph:l?"ng-x-close":"ng-check",divider:O})};return this.editMode?(this.canTweak&&y.push({type:"custom",label:"Tweak",id:"tweak",glyph:"ng-wand-sparkles"}),this.canEdit&&y.push({type:"custom",label:"Edit",id:"edit",glyph:"ng-edit-02"}),E(!1),S(!1),!M&&r&&y.push({type:"custom",label:r,id:"editDsl",glyph:"ng-code"}),z(!1),this.canDelete&&y.push({type:"custom",label:"Delete",id:"delete",glyph:"ng-trash-01"}),o&&y.push({type:"custom",label:"Set Alert",id:"setAlert",glyph:"ng-bell-01",divider:!0}),N&&y.push({type:"custom",label:c?"Remove forecast":"Forecast",id:"forecast",glyph:c?"ng-trending-down":"ng-trend-up-01"}),N&&c&&y.push({type:"custom",label:"Forecast settings\u2026",id:"forecastSettings",glyph:"ng-sliders-horizontal"}),t||(this.canExportPng&&y.push({type:"default",label:"Export PNG",downloadPng:!0,glyph:"ng-image-03",divider:!0}),this.canExportCsv&&y.push({type:"default",label:"Export CSV",downloadCsv:!0,glyph:"ng-file-06",divider:!this.canExportPng}),this.canPrint&&y.push({type:"default",label:"Print",print:!0,glyph:"ng-printer"})),A={enabled:!0,items:y}):(this.showTweakInViewMode&&this.canTweak&&y.push({type:"custom",label:"Tweak",id:"tweak",glyph:"ng-wand-sparkles"}),E(y.length>0),S(y.length>0),this.showEditDslInViewMode&&!M&&r&&y.push({type:"custom",label:r,id:"editDsl",glyph:"ng-code"}),z(y.length>0),o&&y.push({type:"custom",label:"Set Alert",id:"setAlert",glyph:"ng-bell-01",divider:y.length>0}),N&&y.push({type:"custom",label:c?"Remove forecast":"Forecast",id:"forecast",glyph:c?"ng-trending-down":"ng-trend-up-01"}),N&&c&&y.push({type:"custom",label:"Forecast settings\u2026",id:"forecastSettings",glyph:"ng-sliders-horizontal"}),t||(this.canExportPng&&y.push({type:"default",label:"Export PNG",downloadPng:!0,glyph:"ng-image-03",divider:y.length>0}),this.canExportCsv&&y.push({type:"default",label:"Export CSV",downloadCsv:!0,glyph:"ng-file-06",divider:!this.canExportPng&&y.length>0}),this.canPrint&&y.push({type:"default",label:"Print",print:!0,glyph:"ng-printer"})),A={enabled:y.length>0,items:y}),this.menuCache.set(I,A),A}onMenuAction(e,t){switch(t){case"ask":this.chartWidgets?.find(M=>M.widgetId===e.id)?.openAiChat();break;case"tweak":this.openTweak(e.id);break;case"edit":this.editWidget.emit(e.id);break;case"editDsl":this.openDslEditor(e.id);break;case"changeChartType":this.toggleChartTypePicker(e.id);break;case"manageFilters":this.toggleFilterPicker(e.id);break;case"customizeColors":this.toggleColorPicker(e.id);break;case"toggleFilterDefault":this.toggleFilterDefault(e);break;case"viewDetailPanel":this.openDetailPanel(e);break;case"viewData":this.setWidgetViewMode(e.id,"data");break;case"viewChart":this.setWidgetViewMode(e.id,"chart");break;case"viewRecords":this.viewRecords(e);break;case"delete":this.remove.emit(e.id);break;case"setAlert":this.setAlert.emit(e);break;case"addToStory":this.addToStory.emit(e);break;case"forecast":this.forecast.emit({widget:e,enable:!this.hasForecast(e)});break;case"forecastSettings":this.openForecastSettings(e.id);break}}drillContextMenu=null;static WIDGET_BODY_INERT_CLICK='button, a, input, select, textarea, nile-checkbox, nile-dropdown, .widget-drag-handle, [role="button"], .highcharts-point, .highcharts-data-label, .highcharts-tooltip, .highcharts-legend-item, td, th, tr';onWidgetBodyClick(e,t){for(let M of t.composedPath())if(M instanceof Element){if(M.matches(i.WIDGET_BODY_INERT_CLICK))return;if(M.classList.contains("widget-body"))break}this.widgetClick.emit(e)}onChartClick(e,t){let M=this.hasFilterWidget()?XB({pointName:t.pointName,pointY:t.pointY,seriesName:t.seriesName},e.queryMeta):[],n=this.resolveDrillOptions(e,t);if(n.length===0){!e.drilldownBy?.length&&M.length&&this.addFilterConditions(M);return}if(M.length===0){if(n.length===1){this.drillIntoOption(e.id,t.point,n[0]);return}this.drillContextMenu={widgetId:e.id,x:t.x,y:t.y,options:n,point:t.point,conditions:null};return}this.drillContextMenu={widgetId:e.id,x:t.x,y:t.y,options:n,point:t.point,conditions:M}}resolveDrillOptions(e,t){if(!e.drilldownBy?.length)return[];let n=e.config.chart?.data?.find(r=>r.name===t.pointName)?.drilldown;return n?e.drilldownBy.flatMap(r=>(r.series??[]).filter(o=>o.id===n)):[]}pickDrillOption(e){let t=this.drillContextMenu;t&&(this.drillIntoOption(t.widgetId,t.point,e),this.drillContextMenu=null)}pickAddAsFilter(){let e=this.drillContextMenu;this.drillContextMenu=null,e?.conditions?.length&&this.addFilterConditions(e.conditions)}closeDrillContextMenu(){this.drillContextMenu=null}drillIntoOption(e,t,M){this.chartWidgets?.find(n=>n.widgetId===e)?.drillIntoSeries(t,{id:M.id,name:M.drillDownName,data:M.data,type:M.type})}onAiSend(e){this.aiSend.emit(e)}onCellFilter(e,t){this.addFilterConditions([{field:t.field,op:"==",value:t.value}])}onChartSelection(e,t){let M=this.firstFilterWidget();if(!M)return;let n=this.timeWindowField(e);if(!n){console.warn("[dashboard-filter] zoom ignored: no date field resolvable for widget",e.id,e.title);return}let r={field:n,op:"between",value:[new Date(t.min).toISOString(),new Date(t.max).toISOString()]},a=[..._m(this.resolvedFilters??[]).filter(l=>l.field!==n),r],s=YI(a);this.setManualState(M.id,{mode:"manual",conditions:a}),this.chartWidgetFor(M.id)?.setFilterExpression(s),this.applyExpression(M,s),this.requestCatalog(M)}onChartSelectionReset(e){let t=this.firstFilterWidget();if(!t)return;let M=this.manualStateFor(t.id),n=M.mode==="manual"&&M.conditions.length?M.conditions:_m(this.resolvedFilters??[]),r=this.timeWindowField(e),o=r?n.filter(a=>a.field!==r):[];o.length!==n.length&&(this.setManualState(t.id,{mode:"manual",conditions:o}),this.chartWidgetFor(t.id)?.setFilterExpression(YI(o)),this.applyManualConditions(t),o.length||this.collapseExpandedFilter())}timeWindowField(e){return this.dateHistogramField(e)??pst(e.queryMeta)??this.catalogDateField(e)}catalogDateField(e){return this.ephemeralFilterFieldsCache.get(this.ephemeralKey(e))?.find(M=>M.type==="date")?.name??null}dateHistogramField(e){let t=null,M=n=>{if(!(t||!n||typeof n!="object")){if(Array.isArray(n)){n.forEach(M);return}for(let[r,o]of Object.entries(n)){if((r==="date_histogram"||r==="auto_date_histogram")&&o&&typeof o=="object"&&typeof o.field=="string"){t=o.field;return}M(o)}}};return M(e.queryMeta?.dsl),t}onFilterSubmit(e){if(e.widgetId){let t=Object.values(e.filters??{}),M=t.length===1&&typeof t[0]=="string"?t[0]:null;this.lastAppliedFilter.set(e.widgetId,t.length===0?"":(M??JSON.stringify(e.filters)).trim())}this.filterSubmit.emit(e)}onFilterChange(e){this.filterChange.emit(e)}chartWidgets;patchFilterSuggestions(e,t,M){this.observedFields.set(this.observed.fields()),this.filterCatalogs.update(r=>new Map(r).set(e,[...M])),this.chartWidgets?.find(r=>r.widgetId===e)?.patchControlSuggestions(t,this.rankCatalogForExpression(M))}rankCatalogForExpression(e){let t=e.filter(r=>r.type==="attribute"&&m3(r)),M=e.filter(r=>r.type!=="attribute");return[...E3(t,{onDashboard:this.observedFields(),recentlyUsed:this.recentlyUsedFields()}),...M]}openTweak(e){this.tweakTargetId=e,this.tweakPromptText="",this.tweakSubmitting=!1}useTweakExample(e){this.tweakPromptText=e}closeTweak(){this.tweakTargetId=null,this.tweakPromptText="",this.tweakSubmitting=!1}submitTweak(){let e=this.tweakTargetId,t=this.tweakPromptText.trim();!e||!t||this.tweakSubmitting||(this.tweakSubmitting=!0,this.tweakWidget.emit({widgetId:e,prompt:t}),this.closeTweak())}canShowChartTypePicker(e){return!this.canChangeChartType||!this.showWidgetMenu||this.isFilterWidget(e)?!1:!!this.chartTypeFetcher?.changeAdhoc}canShowColorPicker(e){return!this.canCustomizeColors||!this.showWidgetMenu||this.isFilterWidget(e)?!1:Rst(this.displayConfigFor(e))}canShowFilterPicker(e){return!this.canManageFilters||!this.showWidgetMenu||this.isFilterWidget(e)?!1:this.dashboardId?!!this.widgetFilterFetcher:!!this.adhocFilterFetcher}toggleChartTypePicker(e){if(this.chartTypePickerWidgetId===e){this.closeChartTypePicker();return}this.openChartTypePicker(e)}menuItemsFor(e){return(this.menuFor(e).items??[]).map(t=>{if(t.type==="custom")return{key:t.id,label:t.label,glyph:t.glyph,divider:t.divider,method:t.method,color:t.color,kind:"custom"};let M=t.downloadPng?"exportPng":t.downloadCsv?"exportCsv":"print";return{key:M,label:t.label??M,glyph:t.glyph,divider:t.divider,kind:M}})}chartMenuFor(e){return this.chartMenuDisabled}chartMenuDisabled={enabled:!1};nileChartElFor(e){return this.chartWidgets?.find(M=>M.widgetId===e)?.chartRef?.nativeElement??null}async runChartAction(e,t){let M=this.nileChartElFor(e.id);try{t==="exportPng"?await M?.exportChart?.("image/png"):t==="exportCsv"?await M?.downloadCsv?.():await M?.printChart?.()}catch{}}menuOpenWidgetId=null;hasOpenOverlay(e){return this.menuOpenWidgetId===e||this.chartTypePickerWidgetId===e||this.filterBuilderWidgetId===e||this.ephemeralFilterBuilderWidgetId===e||this.storyPickerWidgetId===e}closeWidgetMenu(e){if(!e?.hide)return;let t=()=>{e.hide?.()};typeof requestAnimationFrame=="function"?requestAnimationFrame(t):t()}onOwnMenuItem(e,t,M){this.closeWidgetMenu(M),t.kind==="custom"?this.onMenuAction(e,t.key):this.runChartAction(e,t.kind)}static gridInstanceSeq=0;kebabScope=`dg${++i.gridInstanceSeq}`;widgetMenuEpoch=new Map;widgetMenuEpochArr=new Map;widgetMenuEpochFor(e){let t=this.widgetMenuEpoch.get(e)??0,M=this.widgetMenuEpochArr.get(e);if(M&&M[0]===t)return M;let n=[t];return this.widgetMenuEpochArr.set(e,n),n}onWidgetRemounted(e){this.menuOpenWidgetId===e&&(this.menuOpenWidgetId=null,this.unwatchKebabScroll()),this.widgetMenuEpoch.set(e,(this.widgetMenuEpoch.get(e)??0)+1),this.cdr?.markForCheck()}kebabIdFor(e,t="chart"){return`${this.kebabScope}-${t}-kebab-${e}`}drillAnchorId=`${this.kebabScope}-drill-anchor`;widgetMenuGroupCache=new Map;widgetMenuGroupsFor(e){let t=this.menuFor(e).items,M=this.widgetMenuGroupCache.get(e.id);if(M&&M.src===t)return M.groups;let n=_st(this.menuItemsFor(e));return this.widgetMenuGroupCache.set(e.id,{src:t,groups:n}),n}kebabToggleGuard=null;acceptKebabPress(e){let t=this.kebabToggleGuard;return this.kebabToggleGuard=null,!(t&&t.id===e&&Date.now()-t.at<350)}stampKebabClose(e,t){let M=t.detail?.reason;this.kebabToggleGuard=M==="outside-click"?{id:e,at:Date.now()}:null}openWidgetKebab(e){this.acceptKebabPress(this.kebabIdFor(e.id))&&(this.menuOpenWidgetId=e.id,this.watchKebabScroll(),this.cdr?.markForCheck())}detachKebabScroll;lastWindowScroll=null;kebabScrollRaf=0;watchKebabScroll(){if(this.detachKebabScroll||typeof window>"u")return;let e=this.host?.nativeElement;if(!e)return;let t=n=>{this.lastWindowScroll=n},M=n=>{this.menuOpenWidgetId&&this.lastWindowScroll!==n&&(this.kebabScrollRaf||(this.kebabScrollRaf=requestAnimationFrame(()=>{this.kebabScrollRaf=0,this.menuOpenWidgetId&&(this.closeKebabIfTriggerScrolledOut()||window.dispatchEvent(new Event("scroll")))})))};window.addEventListener("scroll",t,!0),e.addEventListener("scroll",M,!0),this.detachKebabScroll=()=>{window.removeEventListener("scroll",t,!0),e.removeEventListener("scroll",M,!0),this.kebabScrollRaf&&cancelAnimationFrame(this.kebabScrollRaf),this.kebabScrollRaf=0,this.lastWindowScroll=null}}closeKebabIfTriggerScrolledOut(){let e=this.host?.nativeElement,t=this.menuOpenWidgetId;if(!e||!t)return!1;let M=e.getRootNode(),n="getElementById"in M?M.getElementById(this.kebabIdFor(t)):null;if(!n)return!1;let r=n.getBoundingClientRect(),o=e.getBoundingClientRect();return r.bottom>o.top&&r.top<o.bottom?!1:(this.menuOpenWidgetId=null,this.unwatchKebabScroll(),this.cdr?.markForCheck(),!0)}unwatchKebabScroll(){this.detachKebabScroll?.(),this.detachKebabScroll=void 0}onWidgetKebabChange(e,t){let M=t.detail?.type;if(M==="open"){this.menuOpenWidgetId=e.id,this.cdr?.markForCheck();return}M!=="close"||this.menuOpenWidgetId!==e.id||(this.menuOpenWidgetId=null,this.unwatchKebabScroll(),this.stampKebabClose(this.kebabIdFor(e.id),t),this.storyPickerWidgetId===e.id&&!this.storyCommitting&&this.closeStoryPicker(),this.cdr?.markForCheck())}filterKebabWidgetId=null;openFilterKebab(e){this.acceptKebabPress(this.kebabIdFor(e.id,"filter"))&&(this.filterKebabWidgetId=e.id,this.cdr?.markForCheck())}onFilterKebabChange(e,t){let M=t.detail?.type;if(M==="open"){this.filterKebabWidgetId=e.id,this.cdr?.markForCheck();return}M!=="close"||this.filterKebabWidgetId!==e.id||(this.filterKebabWidgetId=null,this.stampKebabClose(this.kebabIdFor(e.id,"filter"),t),this.cdr?.markForCheck())}onDrillMenuChange(e){e.detail?.type==="close"&&(this.closeDrillContextMenu(),this.cdr?.markForCheck())}storyPickerWidgetId=null;storyOptions=[];storyLoading=!1;storySkeletons=Array.from({length:3});storyCommitting=null;storyPickerSeq=0;loadStoriesFor(e){this.storyPickerWidgetId!==e&&this.openStoryPicker(e)}async openStoryPicker(e){this.storyPickerWidgetId=e,this.storyOptions=[],this.storyLoading=!0;let t=++this.storyPickerSeq;this.cdr?.markForCheck();try{let M=await this.storiesFetcher?.listStories()??[];if(t!==this.storyPickerSeq)return;this.storyOptions=M}catch{t===this.storyPickerSeq&&(this.storyOptions=[])}finally{t===this.storyPickerSeq&&(this.storyLoading=!1,this.cdr?.markForCheck())}}closeStoryPicker(){this.storyPickerWidgetId=null,this.storyOptions=[],this.storyLoading=!1,this.storyCommitting=null,this.cdr?.markForCheck()}async chooseStory(e){let t=this.widgets.find(M=>M.id===this.storyPickerWidgetId);if(!(!this.storiesFetcher||!t||this.storyCommitting)){this.storyCommitting=e??"new",this.cdr?.markForCheck();try{let M=e??(await this.storiesFetcher.createStory(t.title??"")).id;if(!M)throw new Error("no story id");gF({storyId:M,widget:t,source:{kind:"dashboard",label:t.title??"Widget"}}),this.closeStoryPicker(),await this.router?.navigate(["/stories",M],{queryParams:{mode:"edit"}})}catch{this.storyCommitting=null,this.cdr?.markForCheck()}}}toggleFilterPicker(e){if(this.dashboardId){if(this.filterBuilderWidgetId===e){this.closeFilterBuilder();return}this.openFilterBuilder(e)}else{if(this.ephemeralFilterBuilderWidgetId===e){this.closeEphemeralFilterBuilder();return}this.openEphemeralFilterBuilder(e)}}chartTypePickerWidgetId=null;chartTypeOptions=[];chartTypeLoading=!1;chartTypeApplying=!1;chartTypeError=null;chartTypePickerSeq=0;chartTypeCurrentComponent=null;chartTypeIcon(e){return Z3(e)}sensibleChartTypes(){return this.chartTypeOptions.filter(e=>e.sensible)}otherChartTypes(){return this.chartTypeOptions.filter(e=>!e.sensible)}async openChartTypePicker(e){let t=this.widgets.find(n=>n.id===e);if(!t||!this.chartTypeFetcher)return;let M=++this.chartTypePickerSeq;this.chartTypePickerWidgetId=e,this.chartTypeOptions=[],this.chartTypeError=null,this.chartTypeCurrentComponent=this.ephemeralChartOverride.get(this.ephemeralKey(t))?.componentName||t.componentName||null,this.chartTypeLoading=!0,this.cdr?.markForCheck();try{let n=await this.chartTypeFetcher.list(t);if(M!==this.chartTypePickerSeq)return;this.chartTypeOptions=n}catch(n){if(M!==this.chartTypePickerSeq)return;this.chartTypeError=n instanceof Error?n.message:"Could not load chart types"}finally{M===this.chartTypePickerSeq&&(this.chartTypeLoading=!1),this.cdr?.markForCheck()}}closeChartTypePicker(){this.chartTypePickerWidgetId=null,this.chartTypeCurrentComponent=null,this.chartTypeOptions=[],this.chartTypeLoading=!1,this.chartTypeApplying=!1,this.chartTypeApplyingComponent=null,this.chartTypeError=null}colorPickerWidgetId=null;colorPickerSeries(){let e=this.colorPickerWidgetId?this.widgets.find(t=>t.id===this.colorPickerWidgetId):null;return e?Pst(this.displayConfigFor(e))??[]:[]}toggleColorPicker(e){if(this.colorPickerWidgetId===e){this.closeColorPicker();return}this.colorPickerWidgetId=e}closeColorPicker(){this.colorPickerWidgetId=null}selectSeriesColor(e,t){let M=this.colorPickerWidgetId,n=M?this.widgets.find(s=>s.id===M):null;if(!n)return;let r=this.ephemeralKey(n),o=this.displayConfigFor(n),a=Vst(o,e,t);this.ephemeralChartOverride.set(r,{componentName:n.componentName??"",config:a}),this.cdr?.markForCheck(),this.widgetColorChanged.emit(U(x({},n),{config:a}))}chartTypeApplyingComponent=null;async selectChartType(e){let t=this.chartTypePickerWidgetId,M=t?this.widgets.find(r=>r.id===t):null,n=this.chartTypeFetcher?.changeAdhoc;if(!(!M||!n||this.chartTypeApplying)){this.chartTypeApplying=!0,this.chartTypeApplyingComponent=e,this.chartTypeError=null;try{let r=this.ephemeralKey(M),o=await n(M,e);this.ephemeralChartOverride.set(r,{componentName:o.componentName??e,config:o.config}),this.ephemeralFilters.delete(r),this.ephemeralFilterFieldsCache.delete(r),this.ephemeralFilterBaseConfig.delete(r),this.ephemeralFilterResult.delete(r),this.closeChartTypePicker()}catch(r){this.chartTypeError=r instanceof Error?r.message:"Chart type change failed"}finally{this.chartTypeApplying=!1,this.chartTypeApplyingComponent=null,this.cdr?.markForCheck()}}}filterBuilderWidgetId=null;filterBuilderField="";filterBuilderOperation="";filterBuilderValue="";filterBuilderValue2="";filterBuilderValues=[];filterBuilderApplying=!1;filterBuilderRemovingId=null;filterBuilderError=null;filterBuilderWidget(){let e=this.filterBuilderWidgetId;return e?this.widgets.find(t=>t.id===e)??null:null}filterBuilderFields(){let e=this.filterBuilderWidget();return e?this.ephemeralFilterFieldsCache.get(this.ephemeralKey(e))??[]:[]}filterBuilderSelectedField(){return this.filterBuilderFields().find(e=>e.name===this.filterBuilderField)}filterBuilderOperators(){let e=this.filterBuilderSelectedField();return e?Jc(e.type):[]}filterBuilderSelectedOperator(){return this.filterBuilderOperators().find(e=>e.value===this.filterBuilderOperation)}filterBuilderActiveFilters(){let t=this.filterBuilderWidget()?.config?._meta?.filters;return Array.isArray(t)?t:[]}resetFilterBuilderValues(){this.filterBuilderValue="",this.filterBuilderValue2="",this.filterBuilderValues=[]}async openFilterBuilder(e){this.filterBuilderWidgetId=e,this.resetFilterBuilderValues(),this.filterBuilderError=null,this.ephemeralFilterFieldsError=null,this.filterBuilderApplying=!1,this.filterBuilderRemovingId=null;let t=this.widgets.find(r=>r.id===e)??null,M=t?this.ephemeralKey(t):null;if(t&&M&&!this.ephemeralFilterFieldsCache.has(M)&&this.adhocFilterFetcher){this.ephemeralFilterFieldsLoading=!0,this.cdr?.markForCheck();try{let r=await this.adhocFilterFetcher.listFields([t]);this.ephemeralFilterFieldsCache.set(M,r)}catch(r){this.ephemeralFilterFieldsError=r instanceof Error?r.message:"Could not load filter fields"}finally{this.ephemeralFilterFieldsLoading=!1,this.cdr?.markForCheck()}}let n=this.filterBuilderFields()[0];this.filterBuilderField=n?.name??"",this.filterBuilderOperation=n?Jc(n.type)[0].value:"",t&&n&&this.ensureFilterValuesLoaded(t,n),this.cdr?.markForCheck()}closeFilterBuilder(){this.filterBuilderWidgetId=null,this.filterBuilderField="",this.filterBuilderOperation="",this.resetFilterBuilderValues(),this.filterBuilderError=null,this.filterBuilderApplying=!1,this.filterBuilderRemovingId=null}onFilterBuilderFieldChange(e){this.filterBuilderField=e;let t=this.filterBuilderFields().find(n=>n.name===e);this.filterBuilderOperation=t?Jc(t.type)[0].value:"",this.resetFilterBuilderValues();let M=this.filterBuilderWidget();M&&t&&this.ensureFilterValuesLoaded(M,t)}onFilterBuilderOperatorChange(e){this.filterBuilderOperation=e,this.resetFilterBuilderValues()}toggleFilterBuilderMultiValue(e){let t=this.filterBuilderValues.indexOf(e);t>=0?this.filterBuilderValues.splice(t,1):this.filterBuilderValues.push(e)}async submitFilterBuilder(){let e=this.filterBuilderWidget(),t=this.filterBuilderField,M=this.filterBuilderOperation;if(!e||!this.widgetFilterFetcher||!this.dashboardId||!t||!M||this.filterBuilderApplying)return;let n=this.filterBuilderOperators().find(o=>o.value===M);if(!n)return;let r;if(n.valueKind==="none")r={id:"",fieldId:t,operator:M};else if(n.valueKind==="multi-select"){if(this.filterBuilderValues.length===0)return;r={id:"",fieldId:t,operator:M,values:[...this.filterBuilderValues]}}else{let o=this.filterBuilderValue.trim();if(!o)return;let a=n.needsSecondValue?this.filterBuilderValue2.trim():void 0;if(n.needsSecondValue&&!a)return;r={id:"",fieldId:t,operator:M,value:o,value2:a}}this.filterBuilderApplying=!0,this.filterBuilderError=null;try{let o=await this.widgetFilterFetcher.add(this.dashboardId,e.id,$m(r),this.persistToPublished);this.widgetFiltersChanged.emit(o),this.resetFilterBuilderValues()}catch(o){this.filterBuilderError=o instanceof Error?o.message:"Filter could not be applied"}finally{this.filterBuilderApplying=!1,this.cdr?.markForCheck()}}async removeFilterFromBuilder(e){let t=this.filterBuilderWidgetId,M=t?this.widgets.find(n=>n.id===t):null;if(!(!M||!this.widgetFilterFetcher||!this.dashboardId||this.filterBuilderRemovingId)){this.filterBuilderRemovingId=e,this.filterBuilderError=null;try{let n=await this.widgetFilterFetcher.remove(this.dashboardId,M.id,e,this.persistToPublished);this.widgetFiltersChanged.emit(n)}catch(n){this.filterBuilderError=n instanceof Error?n.message:"Filter could not be removed"}finally{this.filterBuilderRemovingId=null,this.cdr?.markForCheck()}}}ephemeralFilterBuilderWidgetId=null;ephemeralFilterBuilderFieldId=null;ephemeralFilterBuilderOperator=null;ephemeralFilterBuilderValue="";ephemeralFilterBuilderValue2="";ephemeralFilterBuilderValues=[];ephemeralFilterFieldsLoading=!1;ephemeralFilterFieldsError=null;ephemeralFilterValuesLoading=!1;ephemeralFilterApplying=!1;ephemeralFilterApplyError=null;toggleEphemeralFilterMultiValue(e){let t=this.ephemeralFilterBuilderValues.indexOf(e);t>=0?this.ephemeralFilterBuilderValues.splice(t,1):this.ephemeralFilterBuilderValues.push(e)}ephemeralFilterWidget(){let e=this.ephemeralFilterBuilderWidgetId;return e?this.widgets.find(t=>t.id===e)??null:null}async openEphemeralFilterBuilder(e){this.ephemeralFilterBuilderWidgetId=e,this.ephemeralFilterApplyError=null,this.ephemeralFilterFieldsError=null;let t=this.ephemeralFilterWidget(),M=t?this.ephemeralKey(t):null;if(t&&M&&!this.ephemeralFilterFieldsCache.has(M)&&this.adhocFilterFetcher){this.ephemeralFilterFieldsLoading=!0,this.cdr?.markForCheck();try{let r=await this.adhocFilterFetcher.listFields([t]);this.ephemeralFilterFieldsCache.set(M,r)}catch(r){this.ephemeralFilterFieldsError=r instanceof Error?r.message:"Could not load filter fields"}finally{this.ephemeralFilterFieldsLoading=!1,this.cdr?.markForCheck()}}let n=this.ephemeralFilterFields()[0];this.ephemeralFilterBuilderFieldId=n?.name??null,this.ephemeralFilterBuilderOperator=n?Jc(n.type)[0].value:null,this.resetEphemeralFilterBuilderValues(),t&&n&&this.ensureFilterValuesLoaded(t,n)}closeEphemeralFilterBuilder(){this.ephemeralFilterBuilderWidgetId=null}resetEphemeralFilterBuilderValues(){this.ephemeralFilterBuilderValue="",this.ephemeralFilterBuilderValue2="",this.ephemeralFilterBuilderValues=[]}ephemeralFilterFields(){let e=this.ephemeralFilterWidget();return e?this.ephemeralFilterFieldsCache.get(this.ephemeralKey(e))??[]:[]}ephemeralFilterSelectedField(){return this.ephemeralFilterFields().find(e=>e.name===this.ephemeralFilterBuilderFieldId)}async ensureFilterValuesLoaded(e,t){let M=`${this.ephemeralKey(e)}::${t.name}`;if(!(!v3(t.type)||this.filterValuesCache.has(M)||!this.adhocFilterFetcher)){this.ephemeralFilterValuesLoading=!0,this.cdr?.markForCheck();try{let n=await this.adhocFilterFetcher.fetchValues([e],t.name);this.filterValuesCache.set(M,n.values)}catch{this.filterValuesCache.set(M,[])}finally{this.ephemeralFilterValuesLoading=!1,this.cdr?.markForCheck()}}}filterValuesFor(e,t){return!e||!t?[]:this.filterValuesCache.get(`${this.ephemeralKey(e)}::${t}`)??[]}onEphemeralFilterFieldChange(e){this.ephemeralFilterBuilderFieldId=e;let t=this.ephemeralFilterFields().find(n=>n.name===e);this.ephemeralFilterBuilderOperator=t?Jc(t.type)[0].value:null,this.resetEphemeralFilterBuilderValues();let M=this.ephemeralFilterWidget();M&&t&&this.ensureFilterValuesLoaded(M,t)}onEphemeralFilterOperatorChange(e){this.ephemeralFilterBuilderOperator=e,this.resetEphemeralFilterBuilderValues()}ephemeralFilterOperators(){let e=this.ephemeralFilterSelectedField();return e?Jc(e.type):[]}ephemeralFilterSelectedOperator(){return this.ephemeralFilterOperators().find(e=>e.value===this.ephemeralFilterBuilderOperator)}ephemeralFilterActiveFilters(){let e=this.ephemeralFilterWidget();return e?this.ephemeralFilters.get(this.ephemeralKey(e))??[]:[]}ephemeralFilterChipLabel(e){let t=this.ephemeralFilterFields().find(M=>M.name===e.fieldId);return Y3(e,t?.label??e.fieldId,t?.type??"string")}async reapplyEphemeralFilters(e,t,M){if(!this.adhocFilterFetcher)return!1;if(!M.length)return this.ephemeralFilterResult.delete(t),this.ephemeralFilterBaseConfig.delete(t),!0;let n=this.ephemeralChartOverride.get(t),r=this.ephemeralFilterBaseConfig.get(t)??U(x({},e),{componentName:n?.componentName??e.componentName,config:n?.config??e.config});this.ephemeralFilterApplying=!0,this.ephemeralFilterApplyError=null,this.cdr?.markForCheck();try{let o=M.map($m),a=await this.adhocFilterFetcher.apply(r,o);return this.ephemeralFilterBaseConfig.set(t,r),this.ephemeralFilterResult.set(t,a),!0}catch(o){return this.ephemeralFilterApplyError=o instanceof Error?o.message:"Filter could not be applied",!1}finally{this.ephemeralFilterApplying=!1,this.cdr?.markForCheck()}}async addEphemeralFilter(){let e=this.ephemeralFilterWidget(),t=this.ephemeralFilterBuilderFieldId,M=this.ephemeralFilterBuilderOperator;if(!e||!t||!M||this.ephemeralFilterApplying)return;let n=this.ephemeralFilterOperators().find(l=>l.value===M);if(!n)return;let r;if(n.valueKind==="none")r={id:`ef${++this.ephemeralFilterSeq}`,fieldId:t,operator:M};else if(n.valueKind==="multi-select"){if(this.ephemeralFilterBuilderValues.length===0)return;r={id:`ef${++this.ephemeralFilterSeq}`,fieldId:t,operator:M,values:[...this.ephemeralFilterBuilderValues]}}else{let l=this.ephemeralFilterBuilderValue.trim();if(!l)return;let N=n.needsSecondValue?this.ephemeralFilterBuilderValue2.trim():void 0;if(n.needsSecondValue&&!N)return;r={id:`ef${++this.ephemeralFilterSeq}`,fieldId:t,operator:M,value:l,value2:N}}let o=this.ephemeralKey(e),a=[...this.ephemeralFilters.get(o)??[],r];await this.reapplyEphemeralFilters(e,o,a)&&(this.ephemeralFilters.set(o,a),this.resetEphemeralFilterBuilderValues(),this.cdr?.markForCheck())}async removeEphemeralFilter(e){let t=this.ephemeralFilterWidget();if(!t||this.ephemeralFilterApplying)return;let M=this.ephemeralKey(t),n=(this.ephemeralFilters.get(M)??[]).filter(o=>o.id!==e);await this.reapplyEphemeralFilters(t,M,n)&&(n.length?this.ephemeralFilters.set(M,n):this.ephemeralFilters.delete(M),this.cdr?.markForCheck())}async clearEphemeralFilters(){let e=this.ephemeralFilterWidget();if(!e||this.ephemeralFilterApplying)return;let t=this.ephemeralKey(e);await this.reapplyEphemeralFilters(e,t,[]),this.ephemeralFilters.delete(t),this.cdr?.markForCheck()}quickTimePresets=bst;async applyQuickTimeFilter(e,t){let M=this.timeWindowField(e);if(!M)return;if(this.dashboardId){if(!this.widgetFilterFetcher||this.filterBuilderApplying)return;this.filterBuilderApplying=!0,this.filterBuilderError=null;try{let{from:s,to:l}=nF(t),N=await this.widgetFilterFetcher.add(this.dashboardId,e.id,{field:M,operation:"between",value:[s,l]},this.persistToPublished);this.widgetFiltersChanged.emit(N)}catch(s){this.filterBuilderError=s instanceof Error?s.message:"Filter could not be applied"}finally{this.filterBuilderApplying=!1,this.cdr?.markForCheck()}return}let n=this.ephemeralKey(e),r={id:`ef${++this.ephemeralFilterSeq}`,fieldId:M,operator:t},o=[...this.ephemeralFilters.get(n)??[],r];await this.reapplyEphemeralFilters(e,n,o)&&(this.ephemeralFilters.set(n,o),this.cdr?.markForCheck())}dslEditorWidgetId=null;dslQueryText="";dslPromptText="";dslGenerating=!1;dslApplying=!1;dslError=null;dslBaselineText="";dslTurns=[];dslPendingPrompt=null;dslValidity={ok:!1,error:"Query is empty"};dslExpandedTurn=-1;dslCopied=!1;dslCopiedTimer=null;dslDevMode=!1;toggleDslDevMode(){this.dslDevMode=!this.dslDevMode}forecastSettingsWidgetId=null;forecastDraft=null;forecastGranularities=["Weekly","Monthly","Quarterly","Yearly"];forecastConfidences=[80,90,95];get forecastSettingsWidget(){return this.widgets.find(e=>e.id===this.forecastSettingsWidgetId)??null}get forecastMaxHorizon(){let e=String(this.forecastSettingsWidgetId??"");return this.forecastable[e]?.maxHorizon??24}get forecastPeriodWord(){return{Weekly:"week",Monthly:"month",Quarterly:"quarter",Yearly:"year"}[this.forecastDraft?.granularity??"Monthly"]??"period"}get forecastProvenance(){let e=this.forecastSettingsWidget?.config?.forecast;if(!e?.enabled)return null;let t=[];e.modelFamily&&t.push({label:"Model",value:String(e.modelFamily)});let M=e.historyWindow?.points;if(Number.isFinite(M)){let a={Weekly:"weeks",Monthly:"months",Quarterly:"quarters",Yearly:"years"}[e.granularity]??"periods";t.push({label:"History",value:`${M} ${a}`})}if(Number.isFinite(e.typicalError)?t.push({label:"Typical error",value:`${Number(e.typicalError).toFixed(2)} MASE`}):t.push({label:"Typical error",value:"not scored \u2014 too little history to backtest"}),Number.isFinite(e.vsNaive)){let o=Math.round(Math.abs(Number(e.vsNaive))*100),a=Number(e.vsNaive)>=0?`${o}% better`:`${o}% worse`,s=Number.isFinite(e.naiveMase)?` (${e.naiveKey==="snaive"?"seasonal naive":"naive"} scores ${Number(e.naiveMase).toFixed(2)})`:"";t.push({label:"vs naive",value:`${a}${s}`})}e.boundaryPeriod&&t.push({label:"From",value:String(e.boundaryPeriod)});let n=Array.isArray(e.seriesSkipped)?e.seriesSkipped:[],r=Array.isArray(e.seriesForecast)?e.seriesForecast.length:0;if(n.length&&t.push({label:"Series",value:`${r} of ${r+n.length} forecast`}),e.lastComputedAt){let o=new Date(e.lastComputedAt);Number.isNaN(o.getTime())||t.push({label:"Computed",value:o.toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})})}return t.length?t:null}openForecastSettings(e){let M=this.widgets.find(n=>n.id===e)?.config?.forecast??{};this.forecastSettingsWidgetId=e,this.forecastDraft={horizon:Number(M.horizon)||6,granularity:String(M.granularity||"Monthly"),confidence:Number(M.confidence)||80}}closeForecastSettings(){this.forecastSettingsWidgetId=null,this.forecastDraft=null}onForecastHorizon(e){if(!this.forecastDraft)return;let t=Math.max(1,Math.min(this.forecastMaxHorizon,Math.floor(Number(e)||1)));this.forecastDraft=U(x({},this.forecastDraft),{horizon:t})}onForecastGranularity(e){this.forecastDraft&&(this.forecastDraft=U(x({},this.forecastDraft),{granularity:e}))}onForecastConfidence(e){this.forecastDraft&&(this.forecastDraft=U(x({},this.forecastDraft),{confidence:e}))}applyForecastSettings(){let e=this.forecastSettingsWidget,t=this.forecastDraft;!e||!t||(this.forecast.emit({widget:e,enable:!0,settings:x({},t)}),this.closeForecastSettings())}openDslEditor(e){let t=this.widgets.find(o=>o.id===e);this.dslEditorWidgetId=e;let M=this.dslCodeEditorLanguage,n=t?.queryMeta?.sql,r=n&&qm(n,M)||n||"";this.dslQueryText=r,this.dslBaselineText=r,this.dslPromptText="",this.dslPendingPrompt=null,this.dslTurns=[],this.dslExpandedTurn=-1,this.dslGenerating=!1,this.dslApplying=!1,this.dslError=null,this.dslValidity=Uj(r,M),this.dslDevMode=!1}get dslEditorWidget(){return this.widgets.find(e=>e.id===this.dslEditorWidgetId)??null}get dslChartTypeLabel(){let e=this.dslEditorWidget?.config?.chart?.type;return e?xPt[e]??`${e.charAt(0).toUpperCase()}${e.slice(1)} chart`:""}get dslCodeEditorLanguage(){let e=this.dslEditorWidget?.queryMeta?.adapterType;return e==="postgres"||e==="mssql"?"sql":"json"}static DSL_TERM_BY_ADAPTER={mssql:"SQL",postgres:"query"};dslTermFor(e){return e&&i.DSL_TERM_BY_ADAPTER[e]||"DSL"}dslMenuLabelFor(e){let t=e.queryMeta?.adapterType,M=this.dslTermFor(t);return`${M.charAt(0).toUpperCase()}${M.slice(1)}`}get dslTerm(){return this.dslTermFor(this.dslEditorWidget?.queryMeta?.adapterType)}get dslDirty(){return this.dslQueryText!==this.dslBaselineText}onDslTextChange(e){this.dslQueryText=e,this.dslValidity=Uj(e,this.dslCodeEditorLanguage)}formatDslQuery(){let e=qm(this.dslQueryText,this.dslCodeEditorLanguage);e!==null&&this.onDslTextChange(e)}async copyDslQuery(){try{await navigator.clipboard.writeText(this.dslQueryText),this.dslCopied=!0,this.dslCopiedTimer&&clearTimeout(this.dslCopiedTimer),this.dslCopiedTimer=setTimeout(()=>{this.dslCopied=!1,this.cdr?.markForCheck()},1500)}catch{}this.cdr?.markForCheck()}resetDslQuery(){this.dslQueryText=this.dslBaselineText,this.dslValidity=Uj(this.dslBaselineText,this.dslCodeEditorLanguage),this.dslTurns=[],this.dslExpandedTurn=-1,this.dslError=null}toggleDslDiff(e){this.dslExpandedTurn=this.dslExpandedTurn===e?-1:e}undoDslTurn(e){let t=this.dslTurns[e];t&&(this.dslQueryText=t.before,this.dslValidity=Uj(t.before,this.dslCodeEditorLanguage),this.dslTurns=this.dslTurns.slice(0,e),this.dslExpandedTurn=-1,this.dslError=null)}closeDslEditor(){this.dslApplying||!this.dslCloseAllowed()||this.resetDslEditorState()}onDslRequestClose(e){if(e.stopPropagation(),this.dslApplying||!this.dslCloseAllowed()){e.preventDefault();return}this.resetDslEditorState()}onDslDrawerHidden(){this.dslEditorWidgetId===null||this.dslApplying||(this.resetDslEditorState(),this.cdr?.markForCheck())}dslCloseAllowed(){return!this.dslDirty||typeof window>"u"?!0:window.confirm("Discard your unapplied changes to this query?")}onDslComposerSubmit(e){typeof e=="string"&&(this.dslPromptText=e),this.generateDsl()}dslRefFor(e){if(this.dashboardId&&e.id)return{widgetId:e.id};let t=e.config?.chart;return{componentName:e.componentName,type:t?.type,title:e.title,originalWidget:e}}async generateDsl(){let e=this.dslEditorWidget,t=this.dslPromptText.trim();if(!e||!t||this.dslGenerating||this.dslApplying||!this.dslEditorFetcher)return;let M=this.dslRefFor(e);if(!M)return;if(t.length>Gst){this.dslError=`That instruction is too long (${t.length} of ${Gst} characters).`;return}let n=this.dslQueryText;this.dslPromptText="",this.dslPendingPrompt=t,this.dslGenerating=!0,this.dslError=null;try{let r=this.dslTurns[this.dslTurns.length-1],o=await this.dslEditorFetcher.generate(M,t,{currentQuery:n,lastTurn:r?{prompt:r.prompt,summary:r.summary}:void 0}),a=qm(o.sql,this.dslCodeEditorLanguage)??o.sql;this.dslQueryText=a,this.dslValidity=Uj(a,this.dslCodeEditorLanguage);let s=oF(n,a),l=aF(s),N=o.wasModified===!0,c=o.summary??(N?"Updated the query.":"The assistant made no changes to the query.");this.dslTurns=[...this.dslTurns,{prompt:t,before:n,after:a,summary:c,wasModified:N,diff:s,changed:l}],this.dslExpandedTurn=-1}catch(r){this.dslError=r instanceof Error?r.message:"DSL generation failed",this.dslPromptText=t}finally{this.dslPendingPrompt=null,this.dslGenerating=!1,this.cdr?.markForCheck()}}async applyDsl(){let e=this.dslEditorWidget;if(!e||this.dslApplying||this.dslGenerating||!this.dslEditorFetcher)return;let t=this.dslRefFor(e);if(!t||!this.dslDirty)return;let M=Uj(this.dslQueryText,this.dslCodeEditorLanguage);if(!M.ok){this.dslError=M.error;return}this.dslApplying=!0,this.dslError=null;try{let n=await this.dslEditorFetcher.apply(t,this.dslQueryText);this.dslWidgetUpdated.emit(n),this.closeDslEditorForce()}catch(n){this.dslError=n instanceof Error?n.message:"Apply failed"}finally{this.dslApplying=!1,this.cdr?.markForCheck()}}closeDslEditorForce(){this.resetDslEditorState()}resetDslEditorState(){let e=this.dslEditorWidgetId!==null;this.dslEditorWidgetId=null,this.dslPromptText="",this.dslPendingPrompt=null,this.dslQueryText="",this.dslBaselineText="",this.dslTurns=[],this.dslExpandedTurn=-1,this.dslError=null,this.dslCopied=!1,this.dslDevMode=!1,this.dslCopiedTimer&&(clearTimeout(this.dslCopiedTimer),this.dslCopiedTimer=null),e&&this.dslEditorClosed.emit()}syncGridsterItems(){let e=new Map;for(let t of this.gridsterItems)e.set(t.widgetId,t);this.gridsterItems=this.widgets.map(t=>{let M=e.get(t.id),n=t.layout,r=n?this.clampItemGeometry(n,t):null;return M&&r&&(M.x!==r.x||M.y!==r.y||M.cols!==r.cols||M.rows!==r.rows+this.expandedExtraRowsFor(t.id))?this.buildItem(t):M??this.buildItem(t)})}static HEADER_ALLOWANCE_PX=110;static HEATMAP_ROW_PX=36;minRowsForDeclaredHeight(e,t){let M=e.config?.chart,n=0,r=M?.height;if(typeof r=="string"){let o=parseInt(r,10);Number.isFinite(o)&&o>0&&(n=Math.max(n,Math.ceil((o+i.HEADER_ALLOWANCE_PX)/72)))}if(M?.type==="heatmap"&&Array.isArray(M.yCategories)){let o=M.yCategories.length*i.HEATMAP_ROW_PX;n=Math.max(n,Math.ceil((o+i.HEADER_ALLOWANCE_PX)/72))}return Math.max(t,n)}computeRowInflationOffsets(){let t=new Map,M=new Array(12).fill(0),n=this.widgets.filter(r=>!!r.layout).sort((r,o)=>r.layout.y-o.layout.y);for(let r of n){let o=Math.max(0,Math.min(r.layout.x,11)),a=Math.max(1,Math.min(r.layout.w,12-o)),s=0;for(let I=o;I<o+a;I++)s=Math.max(s,M[I]);let l=r.layout.y+s,N=r.layout.h,c=this.minRowsForDeclaredHeight(r,N);t.set(r.id,{y:l,rows:c});let D=s+(c-N);for(let I=o;I<o+a;I++)M[I]=Math.max(M[I],D)}return t}clampItemGeometry(e,t){let M=Math.max(1,Math.min(e.w,12)),n=Math.max(0,Math.min(e.x,12-M));if(!t)return{x:n,y:e.y,cols:M,rows:e.h};let r=this.computeRowInflationOffsets().get(t.id);return{x:n,y:r?.y??e.y,cols:M,rows:r?.rows??this.minRowsForDeclaredHeight(t,e.h)}}buildItem(e){let t=e.widgetType==="kpi"?4:6,M=e.widgetType==="kpi"?2:4,n=e.layout??{x:0,y:0,w:t,h:M},{x:r,y:o,cols:a,rows:s}=this.clampItemGeometry(n,e);return x({x:r,y:o,cols:a,rows:s+this.expandedExtraRowsFor(e.id),minItemCols:2,minItemRows:2,widgetId:e.id},this.isFilterWidget(e)?{layerIndex:i.FILTER_LAYER_INDEX}:{})}scheduleGestureReconcile(){setTimeout(()=>this.reconcileLayoutAfterGesture(),0)}reconcileLayoutAfterGesture(){let e=this.railShift();for(let t of this.widgets){if(this.isFilterWidget(t))continue;let M=t.id,n=t.layout;if(!n)continue;let r=this.getItemForWidget(t),a=!!e&&Number(n.y??0)>e.y?Number(r.y??0)+e.rows:Number(r.y??0),s={x:r.x,y:a,w:r.cols,h:r.rows-this.expandedExtraRowsFor(M)},l=this.clampItemGeometry(n);l.x===s.x&&l.y===s.y&&l.cols===s.w&&l.rows===s.h||this.updateLayout.emit({id:M,layout:s})}}static \u0275fac=function(t){return new(t||i)(ni(ir),ni(bj),ni(U3,8),ni(Fm,8),ni(EA,8),ni(Hm,8),ni(Jm,8),ni(Xm,8),ni(Gm,8),ni(vj,8),ni(t0,8),ni(Yl,8),ni(Dl,8))};static \u0275cmp=rM({type:i,selectors:[["shared-dashboard-grid"]],viewQuery:function(t,M){if(t&1&&eN(ZI,5),t&2){let n;ll(n=gl())&&(M.chartWidgets=n)}},hostVars:2,hostBindings:function(t,M){t&2&&Wt("auto-height",M.autoHeight)},inputs:{widgets:"widgets",editMode:"editMode",autoHeight:"autoHeight",dashboardId:"dashboardId",conversationId:"conversationId",persistToPublished:"persistToPublished",filtersEnabled:"filtersEnabled",tweakingWidgetId:"tweakingWidgetId",forecastingWidgetId:"forecastingWidgetId",loading:"loading",outerMargin:"outerMargin",canvasBackgroundColor:"canvasBackgroundColor",widgetsLoading:"widgetsLoading",showTweakInViewMode:"showTweakInViewMode",showEditDslInViewMode:"showEditDslInViewMode",canSetAlert:"canSetAlert",canAddToStory:"canAddToStory",canForecast:"canForecast",canAsk:"canAsk",canChangeChartType:"canChangeChartType",canManageFilters:"canManageFilters",canCustomizeColors:"canCustomizeColors",canViewChartData:"canViewChartData",canExportPng:"canExportPng",canExportCsv:"canExportCsv",canPrint:"canPrint",canTweak:"canTweak",canEdit:"canEdit",canDelete:"canDelete",forecastable:"forecastable",showWidgetMenu:"showWidgetMenu",selectable:"selectable",detailPanel:"detailPanel",detailDepth:"detailDepth",detailRootLabel:"detailRootLabel",selectedWidgetIds:"selectedWidgetIds",dashboardFilters:"dashboardFilters",resolvedFilters:"resolvedFilters",applySummary:"applySummary",filterExplanation:"filterExplanation",timeFilterEnabled:"timeFilterEnabled"},outputs:{remove:"remove",editWidget:"editWidget",openAiBuilder:"openAiBuilder",updateLayout:"updateLayout",aiSend:"aiSend",tweakWidget:"tweakWidget",dslWidgetUpdated:"dslWidgetUpdated",dslEditorClosed:"dslEditorClosed",widgetChartTypeChanged:"widgetChartTypeChanged",widgetFiltersChanged:"widgetFiltersChanged",widgetColorChanged:"widgetColorChanged",filterSubmit:"filterSubmit",filterChange:"filterChange",timeRangeApply:"timeRangeApply",selectionChange:"selectionChange",setAlert:"setAlert",addToStory:"addToStory",widgetClick:"widgetClick",forecast:"forecast"},features:[tN([bj]),Qo],ngContentSelectors:i_t,decls:58,vars:39,consts:[[3,"mode","conditions","catalog","expression","busy","valueFetcher","showFilterControls","disabled","showTimeFilter","timeFilterResetKey"],[1,"canvas-wrap"],["role","status",1,"filter-explanation"],["aria-hidden","true",1,"loading-grid"],["class","empty-state",4,"ngIf"],[3,"options","grid-hidden",4,"ngIf"],["label","Tweak widget",1,"tweak-dialog",3,"nile-request-close","open"],[1,"tweak-dialog__body"],[1,"tweak-dialog__hint"],[1,"tweak-dialog__examples"],["type","button",1,"tweak-dialog__example"],["rows","4","placeholder","Describe the tweak\u2026","autofocus","",1,"tweak-dialog__input",3,"ngModelChange","ngModel"],["slot","footer",1,"tweak-dialog__footer"],["variant","secondary","size","small",3,"click"],["variant","primary","size","small",3,"click"],["label","Edit DSL query","placement","end",1,"dsl-editor-drawer",3,"nile-request-close","nile-hide","open","preventOverlayClose"],["slot","label",1,"dsl-editor-drawer__label"],[1,"dsl-editor-drawer__title-row"],[1,"dsl-editor-drawer__title"],[1,"dsl-editor-drawer__badge"],["slot","header-actions",1,"dsl-editor-drawer__header-actions"],["variant","secondary","size","small"],["slot","prefix","method","stroke","size","14"],["role","alert",1,"dsl-pane__error","dsl-pane__error--global"],[1,"dsl-editor-drawer__body"],[1,"dsl-pane","dsl-pane--query"],[1,"dsl-pane","dsl-pane--assistant"],[1,"dsl-pane__toolbar"],[1,"dsl-pane__toolbar-label"],["name","smart-code","method","fill","size","14","color","var(--ng-colors-border-brand)"],[1,"dsl-pane__toolbar-meta"],[1,"dsl-chat",3,"autoScroll"],[1,"dsl-chat__empty"],[1,"dsl-bubble","dsl-bubble--user",3,"role","message"],[1,"dsl-bubble","dsl-bubble--ai",3,"role","agent","icon","thinking","loading"],["slot","footer",1,"dsl-composer",3,"nile-input","nile-submit","placeholder","value","disabled","maxRows","submitOnEnter"],["slot","footer",1,"dsl-editor-drawer__footer"],[1,"dsl-editor-drawer__footer-note"],[1,"dsl-editor-drawer__footer-actions"],["label","Forecast settings","placement","end",1,"forecast-settings-drawer",3,"nile-request-close","nile-hide","open"],[3,"crumbs","loading","label"],[3,"modeChange","conditionsChange","expressionRun","promptAsk","clearAll","timeRangeApply","mode","conditions","catalog","expression","busy","valueFetcher","showFilterControls","disabled","showTimeFilter","timeFilterResetKey"],["name","ng-info-circle","method","stroke","size","16","color","var(--ng-colors-text-tertiary-600)"],[1,"filter-explanation__text"],[1,"loading-grid__kpis"],[1,"widget-card","sk-card","sk-card--kpi"],[1,"loading-grid__charts"],[1,"widget-card","sk-card","sk-card--chart"],["variant","text","width","65%","height","13"],["variant","text","width","90%","height","10"],["variant","text","width","45%","height","30",1,"sk-card__value"],["variant","text","width","40%","height","15"],["variant","text","width","55%","height","10"],[1,"sk-bars"],["variant","rectangular","width","100%","height","100%",1,"sk-bar",3,"height"],[1,"sk-legend"],["variant","rounded","width","100%","height","11"],["variant","rectangular","width","100%","height","100%",1,"sk-bar"],[1,"empty-state"],[1,"empty-state__graphic",3,"click","keydown.enter","keydown.space"],["viewBox","0 0 380 140","aria-hidden","true","preserveAspectRatio","xMidYMid meet"],["x","40","y","20","width","300","height","100","rx","8","stroke","#80AED3","stroke-width","1.5","stroke-dasharray","4 4",2,"fill","var(--ng-colors-bg-primary)"],["x","56","y","36","width","84","height","68","rx","6",2,"fill","var(--ng-colors-bg-secondary)","stroke","var(--ng-colors-border-secondary)"],["x","64","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["x","64","y","80","width","6","height","20","rx","1","fill","#005EA6","opacity","0.7"],["attributeName","height","values","20;14;20","dur","2s","repeatCount","indefinite"],["attributeName","y","values","80;86;80","dur","2s","repeatCount","indefinite"],["x","76","y","74","width","6","height","26","rx","1","fill","#005EA6"],["attributeName","height","values","26;18;26","dur","2s","begin","0.2s","repeatCount","indefinite"],["attributeName","y","values","74;82;74","dur","2s","begin","0.2s","repeatCount","indefinite"],["x","88","y","68","width","6","height","32","rx","1","fill","#005EA6","opacity","0.85"],["attributeName","height","values","32;24;32","dur","2s","begin","0.4s","repeatCount","indefinite"],["attributeName","y","values","68;76;68","dur","2s","begin","0.4s","repeatCount","indefinite"],["x","100","y","78","width","6","height","22","rx","1","fill","#005EA6","opacity","0.6"],["attributeName","height","values","22;16;22","dur","2s","begin","0.6s","repeatCount","indefinite"],["attributeName","y","values","78;84;78","dur","2s","begin","0.6s","repeatCount","indefinite"],["x","112","y","66","width","6","height","34","rx","1","fill","#005EA6","opacity","0.85"],["attributeName","height","values","34;26;34","dur","2s","begin","0.8s","repeatCount","indefinite"],["attributeName","y","values","66;74;66","dur","2s","begin","0.8s","repeatCount","indefinite"],["x","148","y","36","width","84","height","68","rx","6",2,"fill","var(--ng-colors-bg-secondary)","stroke","var(--ng-colors-border-secondary)"],["x","156","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["cx","190","cy","78","r","14","fill","none","stroke-width","5",2,"stroke","var(--ng-colors-border-secondary)"],["cx","190","cy","78","r","14","fill","none","stroke","#005EA6","stroke-width","5","stroke-linecap","round","stroke-dasharray","88","stroke-dashoffset","88","transform","rotate(-90 190 78)"],["attributeName","stroke-dashoffset","values","88;22;22;88","keyTimes","0;0.5;0.85;1","dur","2.6s","repeatCount","indefinite"],["x","240","y","36","width","84","height","68","rx","6",2,"fill","var(--ng-colors-bg-secondary)","stroke","var(--ng-colors-border-secondary)"],["x","248","y","44","width","40","height","3","rx","1.5","fill","#80AED3"],["d","M 250 92 L 264 80 L 278 86 L 292 72 L 306 78 L 320 64","fill","none","stroke","#005EA6","stroke-width","1.5","stroke-linecap","round","stroke-linejoin","round","stroke-dasharray","200","stroke-dashoffset","200"],["attributeName","stroke-dashoffset","values","200;0;0;200","keyTimes","0;0.5;0.85;1","dur","2.6s","repeatCount","indefinite"],["cx","320","cy","64","r","2.5","fill","#005EA6"],["attributeName","opacity","values","0;0;1;1;0","keyTimes","0;0.45;0.55;0.85;1","dur","2.6s","repeatCount","indefinite"],[4,"ngIf"],["variant","primary","class","empty-state__cta","aria-label","Add widget",3,"click",4,"ngIf"],["variant","primary","aria-label","Add widget",1,"empty-state__cta",3,"click"],["slot","prefix","name","ng-plus","size","16"],[3,"options"],[3,"item","gridster-item--menu-open"],[3,"item"],[1,"widget-card"],[1,"widget-card__filter-overlay"],[1,"widget-body",3,"click"],[3,"aiSend","filterSubmit","filterChange","chartClick","chartSelection","chartSelectionReset","cellFilter","dataViewFilterChange","gridFilterVerdict","menuAction","remounted","config","drilldownBy","widgetId","widgetTitle","chromePinned","loading","menu","dashboardFilters","resolvedFilters","dashboardId","conversationId","cellFilterEnabled"],["header-lead","","title","Drag to move",1,"widget-drag-handle"],["header-lead","",1,"widget-select"],["hoist","","placement","bottom-end","distance","6",1,"widget-header-dropdown",3,"open"],[2,"position","absolute","inset","auto 0 0 0","display","flex","justify-content","flex-end","padding","8px 16px","background","linear-gradient(to top, var(--ng-colors-bg-primary, var(--ng-colors-bg-primary)) 70%, transparent)","pointer-events","none"],[1,"widget-card__filter-overlay-label"],[3,"content"],["name","ng-alert-triangle","method","stroke","size","24","color","var(--ng-colors-border-warning)"],[1,"widget-card__filter-note"],["name","ng-dots-grid","method","stroke","size","16",1,"drag-icon"],[3,"nile-change"],["type","button","aria-haspopup","menu","aria-label","Widget actions",1,"widget-menu__trigger",3,"click","id"],["name","ng-dots-vertical","method","stroke","size","16"],["trigger","manual","zindex","700",1,"widget-menu",3,"nile-change","open"],[1,"widget-menu__group",3,"widget-menu__group--empty","widget-menu__group--first"],[1,"widget-menu__group"],[1,"widget-menu__item"],[1,"widget-menu__item",3,"mouseenter","focusin"],["slot","icon","size","15",3,"name","method"],["zindex","701"],["disabled",""],[1,"widget-menu__story-new",3,"click"],["slot","icon","name","ng-plus","method","stroke","size","14"],[3,"click"],[1,"widget-menu__item",3,"click"],["slot","icon","size","15",3,"name","method","color"],["hoist","","placement","bottom-end","distance","6",1,"widget-header-dropdown",3,"nile-hide","open"],["slot","trigger","type","button","tabindex","-1","aria-hidden","true",1,"widget-header-btn","widget-header-btn--hidden-anchor"],["name","ng-chart-bar","method","stroke","size","16"],[1,"type-picker__panel"],[1,"inline-action__loading"],[1,"inline-action__hint"],[1,"inline-action__error"],["size","16"],[1,"type-picker__section"],[1,"type-picker__grid"],["type","button",1,"type-picker__tile","type-picker__tile--sensible",3,"type-picker__tile--current"],["type","button",1,"type-picker__tile","type-picker__tile--sensible",3,"click"],["method","stroke","size","16",3,"name"],["type","button",1,"type-picker__tile",3,"type-picker__tile--current"],["type","button",1,"type-picker__tile",3,"click"],["name","ng-palette","method","stroke","size","16"],[1,"color-picker__panel"],[1,"color-picker__row"],[1,"color-picker__swatch-input"],["type","color",3,"change","value"],[1,"color-picker__name"],["name","ng-filter-lines","method","stroke","size","16"],[1,"filter-builder__panel"],[1,"filter-builder__active"],[1,"filter-builder__quick-time"],[1,"filter-builder__form"],[1,"filter-builder__chip"],["type","button",1,"filter-builder__chip-remove",3,"click"],["name","ng-x-close","method","stroke","size","10"],["type","button",1,"filter-builder__quick-time-chip"],["type","button",1,"filter-builder__quick-time-chip",3,"click"],[1,"filter-builder__select",3,"ngModelChange","ngModel"],[3,"value"],["variant","secondary","size","small",1,"filter-builder__add-btn",3,"click"],[1,"inline-action__loading","inline-action__loading--compact"],["type","text","placeholder","Value\u2026",1,"filter-builder__input",3,"ngModel"],[1,"filter-builder__multi"],[1,"filter-builder__select",3,"ngModel"],["type","text","placeholder","Value\u2026",1,"filter-builder__input",3,"ngModelChange","keydown.enter","ngModel"],["type","date",1,"filter-builder__input",3,"ngModelChange","ngModel"],[1,"filter-builder__and"],["type","number","placeholder","Value\u2026",1,"filter-builder__input",3,"ngModelChange","keydown.enter","ngModel"],["type","number","placeholder","Value\u2026",1,"filter-builder__input",3,"ngModelChange","ngModel"],[1,"filter-builder__multi-item"],["type","checkbox",3,"change","checked"],["value","","disabled",""],["size","12"],["type","button",2,"pointer-events","auto","border","0","border-radius","var(--ng-radius-md, 8px)","padding","6px 14px","font","600 12px/1.2 inherit","color","var(--ng-colors-text-white)","background","var(--ng-colors-bg-brand-solid)","cursor","pointer",3,"click"],[1,"widget-card__filter-footer"],[1,"widget-card__manual-header"],[1,"widget-card__manual-titles"],[1,"widget-card__manual-title"],[1,"widget-card__manual-actions"],[1,"widget-card__manual",3,"conditionsChange","contentHeight","overflowCountChange","catalog","conditions","catalogLoading","disabled","valueFetcher","onDashboardFields","recentlyUsedFields","expanded"],[1,"widget-drag-handle"],["type","button","aria-haspopup","menu","aria-label","Widget actions",1,"widget-card__kebab",3,"click","id"],["name","ng-dots-vertical","method","stroke","size","18"],[1,"widget-menu__group","widget-menu__group--first"],["name","ng-dots-grid","method","stroke",1,"drag-icon"],["slot","icon","name","ng-wand-sparkles","method","stroke","size","14"],["slot","icon","name","ng-edit-02","method","stroke","size","14"],["slot","icon","name","ng-trash-01","method","stroke","size","14"],["slot","icon","name","ng-bell-01","method","stroke","size","14"],["slot","icon","method","stroke","size","14",3,"name"],["role","button","tabindex","0",1,"widget-card__mode-link",3,"click","keydown.enter"],["aria-hidden","true",1,"drill-context-menu__anchor",3,"id"],["trigger","manual","zindex","700",1,"drill-context-menu",3,"nile-change","open"],["label","Drill Down"],["slot","icon","method","stroke","size","14"],["slot","icon","name","filter","method","stroke","size","14"],["type","button",1,"tweak-dialog__example",3,"click"],["name","ng-wand-sparkles","method","stroke","size","12"],["slot","prefix","name","ng-refresh-ccw","method","stroke","size","14"],["name","ng-alert-circle","method","stroke","size","16"],[1,"dsl-pane__error-text"],["type","button","aria-label","Dismiss error",1,"dsl-pane__error-dismiss",3,"click"],["name","ng-x-close","method","stroke","size","14"],[1,"dsl-pane__toolbar-actions"],["type","button",1,"dsl-tool-btn",3,"click","disabled"],["name","ng-braces","method","stroke","size","13"],["type","button",1,"dsl-tool-btn",3,"click"],["method","stroke","size","13"],[1,"dsl-validity"],["multiline","","hasScroller","","lineNumbersMultiline","","enableFoldGutters","","enableSearch","",1,"dsl-pane__editor",3,"nile-change","expandable","value"],[1,"dsl-bubble","dsl-bubble--ai",3,"role","agent","icon"],[1,"dsl-turn__summary"],[1,"dsl-turn__diff"],[1,"dsl-turn__actions",3,"copy","copyValue"],["type","button",1,"dsl-turn__action"],["type","button",1,"dsl-turn__action",3,"disabled","title"],[1,"dsl-diff-line",3,"class"],[1,"dsl-diff-line"],[1,"dsl-diff-line__sign"],[1,"dsl-diff-line__text"],["type","button",1,"dsl-turn__action",3,"click"],["type","button",1,"dsl-turn__action",3,"click","disabled","title"],[1,"fc-panel"],["for","fc-horizon",1,"fc-label"],["id","fc-horizon","type","range","min","1",1,"fc-range",3,"input","value"],[1,"fc-hint"],[1,"fc-label"],["role","group","aria-label","Granularity",1,"fc-seg"],["type","button",1,"fc-seg__btn",3,"fc-seg__btn--on"],["role","group","aria-label","Confidence interval",1,"fc-seg"],["slot","footer",1,"fc-actions"],["type","button",1,"fc-seg__btn",3,"click"],[1,"fc-fact"],[3,"closed","crumbs","loading","label"],[3,"widgets","editMode","showWidgetMenu","selectable","autoHeight","dashboardId","resolvedFilters","detailPanel","detailDepth","detailRootLabel"]],template:function(t,M){if(t&1&&(tu(t_t),he(0,a_t,1,10,"shared-filter-rail",0),$(1,"div",1),he(2,s_t,4,1,"div",2),he(3,u_t,7,0,"div",3),ux(4,I_t,36,4,"div",4)(5,KWt,3,3,"gridster",5),he(6,iPt,6,8),$(7,"nile-dialog",6),Ze("nile-request-close",function(r){return r.stopPropagation(),M.closeTweak()}),$(8,"div",7)(9,"p",8),Y(10,"Describe the change you want \u2014 or pick one of these to start:"),ee(),$(11,"div",9),ht(12,MPt,4,1,"button",10,Ho),ee(),$(14,"textarea",11),cl("ngModelChange",function(r){return ul(M.tweakPromptText,r)||(M.tweakPromptText=r),r}),ee()(),$(15,"div",12)(16,"nile-button",13),Ze("click",function(){return M.closeTweak()}),Y(17,"Cancel"),ee(),$(18,"nile-button",14),Ze("click",function(){return M.submitTweak()}),Y(19," Apply tweak "),ee()()(),$(20,"nile-drawer",15),Ze("nile-request-close",function(r){return M.onDslRequestClose(r)})("nile-hide",function(){return M.onDslDrawerHidden()}),$(21,"div",16)(22,"span",17)(23,"span",18),Y(24),ee(),he(25,nPt,2,1,"span",19),ee()(),$(26,"div",20),he(27,rPt,3,1,"nile-button",21),$(28,"nile-button",13),Ze("click",function(){return M.toggleDslDevMode()}),Mt(29,"nile-glyph",22),Y(30," Open in editor "),ee()(),he(31,oPt,6,1,"div",23),$(32,"div",24),he(33,aPt,15,12,"section",25),$(34,"aside",26)(35,"header",27)(36,"span",28),Mt(37,"nile-glyph",29),Y(38," Assistant "),ee(),he(39,sPt,2,2,"span",30),ee(),$(40,"nile-ai-chat",31),he(41,lPt,2,0,"p",32),ht(42,DPt,8,11,null,null,Mr),he(44,IPt,1,2,"nile-ai-chat-bubble",33),he(45,dPt,1,5,"nile-ai-chat-bubble",34),$(46,"nile-ai-prompt-input",35),Ze("nile-input",function(r){return M.dslPromptText=(r.detail==null?null:r.detail.value)??""})("nile-submit",function(r){return M.onDslComposerSubmit(r.detail==null?null:r.detail.value)}),ee()()()(),$(47,"div",36)(48,"span",37),Y(49,"Applying re-runs the query and redraws this widget only."),ee(),$(50,"span",38)(51,"nile-button",13),Ze("click",function(){return M.closeDslEditor()}),Y(52,"Cancel"),ee(),$(53,"nile-button",14),Ze("click",function(){return M.applyDsl()}),Y(54," Apply changes "),ee()()()(),$(55,"nile-drawer",39),Ze("nile-request-close",function(){return M.closeForecastSettings()})("nile-hide",function(){return M.closeForecastSettings()}),he(56,zPt,31,8),ee()(),he(57,hPt,3,13,"shared-widget-detail-panel",40)),t&2){let n;xe(!M.loading&&M.railVisible()?0:-1),L(),aM("background-color",M.canvasBackgroundColor||null),Wt("view-mode",!M.editMode||M.loading),L(),xe(!M.loading&&M.filterExplanation?2:-1),L(),xe(M.loading?3:-1),L(),ot("ngIf",!M.loading&&M.widgets.length===0),L(),ot("ngIf",!M.loading),L(),xe((n=M.drillContextMenu)?6:-1,n),L(),ot("open",M.tweakTargetId!==null),L(5),xt(M.tweakExamples),L(2),Nl("ngModel",M.tweakPromptText),L(4),It("disabled",M.tweakPromptText.trim()?null:""),L(2),ot("open",M.dslEditorWidgetId!==null)("preventOverlayClose",M.dslApplying),L(4),it((M.dslEditorWidget==null?null:M.dslEditorWidget.title)||"Edit DSL query"),L(),xe(M.dslChartTypeLabel?25:-1),L(2),xe(M.dslDirty?27:-1),L(2),It("name",M.dslDevMode?"ng-chevron-down":"ng-chevron-up"),L(2),xe(M.dslError?31:-1),L(2),xe(M.dslDevMode?33:-1),L(),Wt("dsl-pane--assistant-full",!M.dslDevMode),L(5),xe(M.dslTurns.length?39:-1),L(),ot("autoScroll",!0),L(),xe(!M.dslTurns.length&&!M.dslGenerating?41:-1),L(),xt(M.dslTurns),L(2),xe(M.dslPendingPrompt?44:-1),L(),xe(M.dslGenerating?45:-1),L(),ot("placeholder","Describe a change to this query\u2026")("value",M.dslPromptText)("disabled",M.dslGenerating||M.dslApplying)("maxRows",6)("submitOnEnter",!0),L(5),It("disabled",M.dslApplying?"":null),L(2),It("loading",M.dslApplying?"":null)("disabled",!M.dslDirty||!M.dslValidity.ok||M.dslApplying||M.dslGenerating?"":null),L(2),ot("open",M.forecastSettingsWidgetId!==null),L(),xe(M.forecastDraft?56:-1),L(),xe(M.detailPanel&&M.detail.isOpen()?57:-1)}},dependencies:()=>[i,Go,H5,wj,Jat,$at,Gh,OB,l3,a3,Om,ZI,b3,Q3,eE,I3,ast],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;height:100%;min-height:100%;position:relative}shared-filter-rail[_ngcontent-%COMP%]{position:sticky;top:0;z-index:var(--z-sticky, 10);display:block}[_nghost-%COMP%]:has(.canvas-wrap:not(.view-mode)){width:100%;min-width:100%}.canvas-wrap[_ngcontent-%COMP%]{min-height:0;height:100%;border-radius:var(--ng-radius-xl, 12px);width:100%;min-width:100%;box-sizing:border-box;padding:8px;background-color:var(--ng-colors-bg-brand-primary);background-image:radial-gradient(circle,var(--ng-colors-bg-brand-secondary) 1px,transparent 1px);background-size:24px 24px;box-shadow:inset 0 2px 8px #0000000a;transition:background .25s ease}[_nghost-%COMP%] gridster{min-height:0;height:100%;max-height:100%;background:transparent!important;border-radius:var(--ng-radius-xl, 12px)}.auto-height[_nghost-%COMP%] gridster{overflow:visible!important;max-height:none;min-height:0}.auto-height[_nghost-%COMP%]{height:auto;min-height:0}[_nghost-%COMP%] gridster .gridster-row{border-top:1px solid var(--ng-colors-bg-brand-secondary)!important;border-bottom:1px solid var(--ng-colors-bg-brand-secondary)!important}[_nghost-%COMP%] gridster .gridster-column{border-left:1px solid var(--ng-colors-bg-brand-secondary)!important;border-right:1px solid var(--ng-colors-bg-brand-secondary)!important}.grid-hidden[_ngcontent-%COMP%]{display:none!important}.canvas-wrap.view-mode[_ngcontent-%COMP%]{box-shadow:none;padding-left:12px;background-image:none;background-color:transparent;width:100%}.canvas-wrap.view-mode[_ngcontent-%COMP%] gridster{border-color:transparent;box-shadow:none;gap:0}[_nghost-%COMP%] gridster-item{overflow:visible;background:transparent!important;border-radius:var(--ng-radius-xl, 12px)}[_nghost-%COMP%] .gridster-item-resizable-handler{z-index:var(--z-sticky)}.widget-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;min-height:0;border-radius:var(--ng-radius-xl, 12px);background:var(--ng-colors-bg-primary, var(--ng-colors-bg-primary));box-shadow:var(--ng-shadow-sm);overflow:hidden;transition:box-shadow var(--ng-transition-duration-default, .25s) ease;position:relative}.loading-grid[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;padding:8px}.loading-grid__kpis[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}@media(max-width:900px){.loading-grid__kpis[_ngcontent-%COMP%]{grid-template-columns:repeat(2,minmax(0,1fr))}}.loading-grid__charts[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}@media(max-width:900px){.loading-grid__charts[_ngcontent-%COMP%]{grid-template-columns:1fr}}.sk-card[_ngcontent-%COMP%]{padding:16px;gap:10px}.sk-card--kpi[_ngcontent-%COMP%]{min-height:128px}.sk-card--chart[_ngcontent-%COMP%]{min-height:300px}.sk-card__value[_ngcontent-%COMP%]{margin-top:auto}.sk-bars[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-end;gap:8px;min-height:0;margin-top:8px}.sk-bars[_ngcontent-%COMP%] .sk-bar[_ngcontent-%COMP%]{flex:1}.sk-legend[_ngcontent-%COMP%]{display:flex;gap:12px;margin-top:12px}.sk-legend[_ngcontent-%COMP%] nile-skeleton-loader[_ngcontent-%COMP%]{flex:0 0 64px}.widget-drag-handle[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:var(--ng-spacing-1);border-radius:var(--ng-radius-md);color:var(--ng-colors-text-tertiary-600);cursor:grab;opacity:0;transition:opacity .15s ease,background .15s ease,color .15s ease}.widget-drag-handle[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.widget-drag-handle[_ngcontent-%COMP%]:active{cursor:grabbing}.widget-drag-handle[_ngcontent-%COMP%] .drag-icon[_ngcontent-%COMP%]{display:inline-flex}.widget-card[_ngcontent-%COMP%]:hover .widget-drag-handle[_ngcontent-%COMP%], .widget-card[_ngcontent-%COMP%]:focus-within .widget-drag-handle[_ngcontent-%COMP%], .widget-drag-handle[_ngcontent-%COMP%]:active{opacity:1}.widget-select[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;height:24px}.widget-menu-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;height:24px;padding:0 2px;border:0;outline:0;background:transparent;color:var(--ng-colors-text-tertiary-600);cursor:pointer;transition:color .15s}.widget-menu-btn[_ngcontent-%COMP%]:hover, .widget-menu-btn[_ngcontent-%COMP%]:focus, .widget-menu-btn[_ngcontent-%COMP%]:focus-visible, .widget-menu-btn[_ngcontent-%COMP%]:active{background:transparent;outline:0;color:var(--ng-colors-text-primary-900)}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-body[_ngcontent-%COMP%]{filter:grayscale(1)}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-card__filter-overlay[_ngcontent-%COMP%]{position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;background:#fff9;cursor:not-allowed}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-card__filter-overlay-label[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;max-width:calc(100% - 32px);color:var(--ng-colors-border-warning);font-size:12px;font-weight:500}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-card__filter-note[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.widget-card--filter-inactive[_ngcontent-%COMP%] .widget-body[_ngcontent-%COMP%], .widget-card--filter-inactive[_ngcontent-%COMP%] .widget-drag-handle[_ngcontent-%COMP%], .widget-card--filter-inactive[_ngcontent-%COMP%] .widget-menu__trigger[_ngcontent-%COMP%]{pointer-events:none}.widget-body[_ngcontent-%COMP%]{flex:1;min-height:0;overflow:hidden}.widget-card--filter[_ngcontent-%COMP%], .widget-card--filter[_ngcontent-%COMP%] .widget-body[_ngcontent-%COMP%], .widget-card--filter[_ngcontent-%COMP%] shared-nile-chart-widget[_ngcontent-%COMP%]{overflow:visible}.widget-body--hidden[_ngcontent-%COMP%]{display:none}.widget-card__manual[_ngcontent-%COMP%]{flex:1;min-height:0}.widget-card__manual-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:var(--ng-spacing-lg);padding:var(--nile-spacing-xl, var(--ng-spacing-xl)) var(--nile-spacing-3xl, var(--ng-spacing-3xl)) var(--nile-spacing-lg, var(--ng-spacing-lg));border-bottom:1px solid var(--ng-colors-border-secondary)}.widget-card__manual-titles[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-width:0;flex:1 1 auto}.widget-card__manual-title[_ngcontent-%COMP%]{margin:0;font-family:var(--ng-font-family-display);font-size:var(--ng-font-size-text-l);font-weight:var(--ng-font-weight-semibold);color:var(--ng-colors-text-primary-900);line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;width:100%}.widget-card__manual-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--ng-spacing-xs);flex-shrink:0;margin-right:calc(-1 * var(--ng-spacing-1))}.widget-card__kebab[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:var(--ng-spacing-1);border:none;border-radius:var(--ng-radius-md);background:transparent;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.widget-card__kebab[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.widget-card__filter-footer[_ngcontent-%COMP%]{position:absolute;right:var(--ng-spacing-3);bottom:var(--ng-spacing-1-5);z-index:1;display:flex;align-items:center;gap:var(--ng-spacing-2);justify-content:flex-end;pointer-events:none}.widget-card__mode-link[_ngcontent-%COMP%]{font-size:12px;cursor:pointer;pointer-events:auto;color:var(--ng-colors-fg-brand-primary-600)}.widget-card__mode-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:calc(100vh - var(--db-toolbar-height, 56px) - 128px);padding:var(--ng-spacing-12, 48px) var(--ng-spacing-6, 24px);text-align:center;gap:var(--ng-spacing-3, 12px)}.empty-icon-wrap[_ngcontent-%COMP%]{margin-bottom:var(--ng-spacing-3, 12px)}.empty-state__graphic[_ngcontent-%COMP%]{width:380px;max-width:100%;height:140px;margin-bottom:var(--ng-spacing-4, 16px);display:block;cursor:pointer;border-radius:12px;outline:none;transition:transform .15s ease,filter .15s ease}.empty-state__graphic[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{display:block;width:100%;height:100%}.empty-state__graphic[_ngcontent-%COMP%]:hover, .empty-state__graphic[_ngcontent-%COMP%]:focus-visible{transform:translateY(-2px);filter:drop-shadow(0 6px 18px rgba(0,94,166,.18))}.empty-state[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:var(--ng-font-size-text-xl, 20px);font-weight:var(--ng-font-weight-semibold, 600);color:var(--ng-colors-text-primary-900)}.empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:var(--ng-font-size-text-sm, 14px);color:var(--ng-colors-text-tertiary-600);max-width:380px;line-height:1.6}.tweak-dialog[_ngcontent-%COMP%]::part(panel){width:520px;max-width:92vw;border-radius:14px}.tweak-dialog__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;padding:4px 0 12px}.tweak-dialog__hint[_ngcontent-%COMP%]{margin:0;font-size:13px;color:var(--ng-colors-text-tertiary-600);line-height:1.5}.tweak-dialog__examples[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.tweak-dialog__example[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid var(--ng-colors-border-secondary);border-radius:10px;background:var(--ng-colors-bg-primary);color:var(--ng-colors-text-secondary-700);font-size:12px;font-weight:500;text-align:left;cursor:pointer;transition:border-color .15s,background .15s,color .15s}.tweak-dialog__example[_ngcontent-%COMP%]:hover{border-color:var(--ng-colors-border-brand);color:var(--ng-colors-border-brand);background:var(--ng-colors-bg-brand-primary)}.tweak-dialog__example[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand);flex-shrink:0}.tweak-dialog__example[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tweak-dialog__input[_ngcontent-%COMP%]{width:100%;min-height:96px;padding:10px 12px;border:1px solid var(--ng-colors-border-secondary);border-radius:10px;background:var(--ng-colors-bg-primary);font:inherit;font-size:14px;color:var(--ng-colors-text-primary-900);resize:vertical;box-sizing:border-box;outline:0;transition:border-color .15s,box-shadow .15s}.tweak-dialog__input[_ngcontent-%COMP%]:focus{border-color:var(--ng-colors-border-brand);box-shadow:0 0 0 3px #2970ff26}.tweak-dialog__footer[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:8px}.widget-header-btn[_ngcontent-%COMP%]{position:relative;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;margin:0 2px;box-sizing:border-box;border:none;border-radius:6px;background:transparent;color:var(--ng-colors-fg-quaternary-400);cursor:pointer}.widget-header-btn[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.widget-header-btn--hidden-anchor[_ngcontent-%COMP%]{width:0;height:0;padding:0;margin:0;opacity:0;pointer-events:none;overflow:hidden}.widget-header-dropdown[_ngcontent-%COMP%]{width:0;margin-left:calc(-1 * var(--ng-spacing-xs, 4px))}.widget-header-dropdown[_ngcontent-%COMP%]::part(panel){width:320px;max-width:92vw;overflow-y:auto}.type-picker__panel[_ngcontent-%COMP%], .filter-builder__panel[_ngcontent-%COMP%], .color-picker__panel[_ngcontent-%COMP%]{background:var(--ng-colors-bg-primary);border:1px solid var(--ng-colors-border-secondary);border-radius:12px;box-shadow:0 8px 24px #10182824;padding:10px;box-sizing:border-box;max-height:min(70vh,var(--auto-size-available-height, 70vh));overflow-y:auto}.inline-action__loading[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:8px;min-height:56px;font-size:13px;color:var(--ng-colors-text-tertiary-600)}.inline-action__hint[_ngcontent-%COMP%]{margin:0 0 6px;font-size:12px;color:var(--ng-colors-text-tertiary-600)}.inline-action__error[_ngcontent-%COMP%]{margin:6px 0 0;font-size:12px;color:var(--ng-colors-text-error-primary-600)}.type-picker__section[_ngcontent-%COMP%]{margin:14px 0 6px;font-size:11px;font-weight:600;letter-spacing:.02em;text-transform:uppercase;color:var(--ng-colors-text-tertiary-600)}.type-picker__section[_ngcontent-%COMP%]:first-child{margin-top:0}.type-picker__grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.type-picker__tile[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:8px 4px;box-sizing:border-box;height:60px;position:relative;border:1px solid var(--ng-colors-border-secondary);border-radius:8px;background:var(--ng-colors-bg-primary);color:var(--ng-colors-text-secondary-700);font-size:11px;font-weight:500;cursor:pointer}.type-picker__tile[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-text-quaternary-500)}.type-picker__tile[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--ng-colors-border-brand);color:var(--ng-colors-border-brand)}.type-picker__tile[_ngcontent-%COMP%]:hover:not(:disabled) nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand)}.type-picker__tile[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--ng-colors-border-brand);outline-offset:1px}.type-picker__tile[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.type-picker__tile--sensible[_ngcontent-%COMP%]{border-color:var(--ng-colors-bg-brand-secondary);background:var(--ng-colors-bg-brand-primary)}.type-picker__tile--sensible[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand)}.type-picker__tile--current[_ngcontent-%COMP%]{border-color:var(--ng-colors-bg-brand-solid);background:var(--ng-colors-bg-brand-solid);color:var(--ng-colors-text-white);font-weight:600}.type-picker__tile--current[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-white)}.type-picker__tile--current[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--ng-colors-bg-brand-solid-hover);background:var(--ng-colors-bg-brand-solid);color:var(--ng-colors-text-white)}.type-picker__tile--current[_ngcontent-%COMP%]:hover:not(:disabled) nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-white)}.type-picker__tile--current[_ngcontent-%COMP%]:after{content:"";position:absolute;top:5px;right:7px;width:4px;height:8px;border:solid var(--ng-colors-fg-white);border-width:0 1.5px 1.5px 0;transform:rotate(45deg)}.color-picker__row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:6px 4px;border-radius:6px;cursor:pointer}.color-picker__row[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-tertiary)}.color-picker__swatch-input[_ngcontent-%COMP%]{display:inline-flex;width:22px;height:22px;border-radius:6px;overflow:hidden;border:1px solid var(--ng-colors-border-secondary);flex:0 0 auto}.color-picker__swatch-input[_ngcontent-%COMP%] input[type=color][_ngcontent-%COMP%]{width:100%;height:100%;padding:0;border:none;cursor:pointer}.color-picker__swatch-input[_ngcontent-%COMP%] input[type=color][_ngcontent-%COMP%]::-webkit-color-swatch-wrapper{padding:0}.color-picker__swatch-input[_ngcontent-%COMP%] input[type=color][_ngcontent-%COMP%]::-webkit-color-swatch{border:none}.color-picker__swatch-input[_ngcontent-%COMP%] input[type=color][_ngcontent-%COMP%]::-moz-color-swatch{border:none}.color-picker__name[_ngcontent-%COMP%]{font-size:13px;color:var(--ng-colors-text-secondary-700)}.widget-menu__trigger[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:var(--ng-spacing-1);border:none;border-radius:var(--ng-radius-md);background:transparent;color:var(--ng-colors-text-tertiary-600);cursor:pointer}.widget-menu__trigger[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.widget-menu[_ngcontent-%COMP%]{display:contents}.widget-menu__item[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{flex:none;color:var(--ng-colors-text-tertiary-600)}.widget-menu__group--empty[_ngcontent-%COMP%]{display:none}nile-context-menu-group.widget-menu__group.widget-menu__group--first[_ngcontent-%COMP%]:before{display:none}.widget-menu__story-new[_ngcontent-%COMP%]::part(item){border-top:var(--ng-stroke-width-1) solid var(--ng-colors-border-secondary);color:var(--ng-colors-fg-brand-primary-600);font-weight:var(--ng-font-weight-semibold)}.widget-header-dropdown[_ngcontent-%COMP%]::part(base){display:block}.widget-header-dropdown[_ngcontent-%COMP%]::part(panel){z-index:var(--z-popover, 700)}.widget-card--menu-open[_ngcontent-%COMP%]{overflow:visible;z-index:1}.gridster-item--menu-open[_ngcontent-%COMP%]{z-index:var(--z-popover, 700)!important}.widget-card--menu-open[_ngcontent-%COMP%] nile-chart::part(chart-card){clip-path:none}.story-picker__panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:264px;box-sizing:border-box;padding:10px;background:var(--ng-colors-bg-primary);border:1px solid var(--ng-colors-border-secondary);border-radius:var(--ng-radius-lg);max-height:min(60vh,var(--auto-size-available-height, 60vh))}.story-picker__section[_ngcontent-%COMP%]{margin:0 0 6px;font-size:var(--ng-font-size-text-xs);font-weight:var(--ng-font-weight-semibold);letter-spacing:.02em;text-transform:uppercase;color:var(--ng-colors-text-tertiary-600)}.story-picker__list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;overflow-y:auto;min-height:0}.story-picker__row[_ngcontent-%COMP%], .story-picker__new[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;width:100%;padding:7px 8px;box-sizing:border-box;border:none;border-radius:var(--ng-radius-md);background:transparent;color:var(--ng-colors-text-secondary-700);font-size:var(--ng-font-size-text-sm);text-align:left;cursor:pointer}.story-picker__row[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%], .story-picker__new[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-text-tertiary-600);flex:none}.story-picker__row[_ngcontent-%COMP%]:hover:not(:disabled), .story-picker__new[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900)}.story-picker__row[_ngcontent-%COMP%]:disabled, .story-picker__new[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.story-picker__name[_ngcontent-%COMP%]{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.story-picker__count[_ngcontent-%COMP%]{flex:none;font-size:var(--ng-font-size-text-xs);color:var(--ng-colors-text-tertiary-600)}.story-picker__new[_ngcontent-%COMP%]{margin-top:6px;padding-top:10px;border-top:1px solid var(--ng-colors-border-secondary);border-radius:0;color:var(--ng-colors-fg-brand-primary-600);font-weight:var(--ng-font-weight-semibold)}.story-picker__new[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{color:var(--ng-colors-fg-brand-primary-600)}.filter-builder__active[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}.filter-builder__chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border-radius:999px;background:var(--ng-colors-bg-brand-primary);color:var(--ng-colors-text-secondary-700);font-size:12px}.filter-builder__chip-remove[_ngcontent-%COMP%]{display:inline-flex;border:none;background:none;padding:0;cursor:pointer;color:inherit}.filter-builder__quick-time[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}.filter-builder__quick-time-chip[_ngcontent-%COMP%]{padding:4px 9px;border-radius:999px;border:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary);color:var(--ng-colors-text-secondary-700);font-size:12px;cursor:pointer}.filter-builder__quick-time-chip[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--ng-colors-border-brand);color:var(--ng-colors-border-brand)}.filter-builder__quick-time-chip[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.filter-builder__form[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.filter-builder__select[_ngcontent-%COMP%], .filter-builder__input[_ngcontent-%COMP%]{flex:1 1 100%;min-width:0;padding:7px 8px;box-sizing:border-box;border:1px solid var(--ng-colors-border-secondary);border-radius:7px;background:var(--ng-colors-bg-primary);font:inherit;font-size:12px;color:var(--ng-colors-text-primary-900)}.filter-builder__field-label[_ngcontent-%COMP%]{padding:6px 2px;font-size:12px;font-weight:600;color:var(--ng-colors-text-primary-900)}.filter-builder__and[_ngcontent-%COMP%]{font-size:12px;color:var(--ng-colors-text-tertiary-600)}.filter-builder__multi[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;max-height:160px;overflow-y:auto;width:100%}.filter-builder__multi-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px;padding:4px 2px;font-size:12px;color:var(--ng-colors-text-secondary-700);cursor:pointer}.filter-builder__multi-item[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.filter-builder__add-btn[_ngcontent-%COMP%]{flex:0 0 auto;align-self:flex-start;position:sticky;bottom:0;background:var(--ng-colors-bg-primary);padding-top:4px;z-index:1}.filter-builder__add-btn[_ngcontent-%COMP%]::part(base){padding:4px 10px;font-size:12px;min-height:0}.inline-action__loading--compact[_ngcontent-%COMP%]{min-height:0;justify-content:flex-start;gap:6px;font-size:12px}.drill-context-menu[_ngcontent-%COMP%]{display:contents}.filter-explanation[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--ng-spacing-xs, 4px);margin:0 0 var(--ng-spacing-sm, 8px);color:var(--ng-colors-text-tertiary-600);font-size:var(--ng-font-size-text-xs);line-height:1.4}.filter-explanation__text[_ngcontent-%COMP%]{min-width:0}.drill-context-menu__anchor[_ngcontent-%COMP%]{position:fixed;display:inline-block;width:0;height:0}.dsl-editor-drawer[_ngcontent-%COMP%]::part(base){z-index:var(--z-drawer, 900);left:var(--sidebar-width, 250px);width:calc(100vw - var(--sidebar-width, 250px));transition:left .25s ease,width .25s ease}.dsl-editor-drawer[_ngcontent-%COMP%]::part(overlay){left:var(--sidebar-width, 250px);transition:left .25s ease}.dsl-editor-drawer[_ngcontent-%COMP%]::part(panel){width:100%;max-width:none}.dsl-editor-drawer[_ngcontent-%COMP%]::part(header){align-items:flex-start;padding:14px 20px;border-bottom:1px solid var(--ng-colors-border-secondary)}.dsl-editor-drawer[_ngcontent-%COMP%]::part(body){padding:0;overflow:hidden}.dsl-editor-drawer[_ngcontent-%COMP%]::part(footer){padding:12px 20px;border-top:1px solid var(--ng-colors-border-secondary)}.dsl-editor-drawer__label[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:3px;min-width:0}.dsl-editor-drawer__title-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;min-width:0}.dsl-editor-drawer__title[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:var(--ng-colors-text-primary-900);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsl-editor-drawer__badge[_ngcontent-%COMP%]{flex:0 0 auto;padding:1px 7px;border:1px solid var(--ng-colors-border-secondary);border-radius:6px;background:var(--ng-colors-bg-secondary);font-size:11px;font-weight:500;color:var(--ng-colors-text-tertiary-600);white-space:nowrap}.dsl-editor-drawer__header-actions[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px}.dsl-editor-drawer__body[_ngcontent-%COMP%]{display:flex;align-items:stretch;height:100%;min-height:0;--dsl-toolbar-h: 42px}.dsl-pane[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-height:0}.dsl-pane--query[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0}.dsl-pane--assistant[_ngcontent-%COMP%]{flex:0 0 380px;width:380px;border-left:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-secondary, #fcfcfd)}.dsl-pane--assistant.dsl-pane--assistant-full[_ngcontent-%COMP%]{flex:1 1 auto;width:auto;border-left:none}@media(max-width:1024px){.dsl-pane--assistant[_ngcontent-%COMP%]{flex-basis:320px;width:320px}}.dsl-pane__toolbar[_ngcontent-%COMP%]{flex:0 0 var(--dsl-toolbar-h, 42px);height:var(--dsl-toolbar-h, 42px);box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 16px;border-bottom:1px solid var(--ng-colors-border-secondary)}.dsl-pane__toolbar-label[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--ng-colors-text-secondary-700)}.dsl-pane__toolbar-actions[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:4px}.dsl-pane__toolbar-meta[_ngcontent-%COMP%]{font-size:11.5px;color:var(--ng-colors-text-tertiary-600)}.dsl-tool-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border:0;border-radius:6px;background:transparent;font:inherit;font-size:12px;color:var(--ng-colors-text-secondary-700);cursor:pointer;transition:background .12s}.dsl-tool-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--ng-colors-bg-secondary)}.dsl-tool-btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.dsl-validity[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:5px;margin-left:4px;padding:3px 9px;border-radius:999px;background:var(--ng-colors-bg-error-primary);font-size:11.5px;font-weight:500;color:var(--ng-colors-text-error-primary-hover);white-space:nowrap}.dsl-validity.dsl-validity--ok[_ngcontent-%COMP%]{background:var(--ng-colors-bg-success-primary);color:var(--ng-componentcolors-utility-success-700)}.dsl-pane__editor[_ngcontent-%COMP%]{display:block;flex:1 1 auto;min-height:160px;overflow:hidden}.dsl-pane__editor[_ngcontent-%COMP%]::part(code-editor-base){height:100%;overflow-y:auto;box-sizing:border-box;border:0;border-radius:0}.dsl-pane__error[_ngcontent-%COMP%]{flex:0 0 auto;display:flex;align-items:flex-start;gap:8px;padding:10px 16px;border-top:1px solid var(--ng-colors-border-error-subtle);background:var(--ng-colors-bg-error-primary);color:var(--ng-colors-text-error-primary-hover);font-size:12.5px;line-height:1.45}.dsl-pane__error[_ngcontent-%COMP%] nile-glyph[_ngcontent-%COMP%]{flex:0 0 auto;margin-top:1px}.dsl-pane__error--global[_ngcontent-%COMP%]{border-top:none;border-bottom:1px solid var(--ng-colors-border-error-subtle)}.dsl-pane__error-text[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0;word-break:break-word}.dsl-pane__error-dismiss[_ngcontent-%COMP%]{flex:0 0 auto;padding:2px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer}.dsl-pane__error-dismiss[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-error-primary)}.dsl-chat[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;display:block}.dsl-chat[_ngcontent-%COMP%]::part(viewport){padding:14px 12px}.dsl-chat[_ngcontent-%COMP%]::part(messages){gap:12px}.dsl-chat[_ngcontent-%COMP%]::part(footer){padding:10px 12px;border-top:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary)}.dsl-chat__empty[_ngcontent-%COMP%]{margin:0 4px;font-size:12.5px;line-height:1.5;color:var(--ng-colors-text-tertiary-600)}.dsl-bubble--ai[_ngcontent-%COMP%]::part(message){display:flex;flex-direction:column;gap:8px}.dsl-bubble--user[_ngcontent-%COMP%]::part(message){font-size:12.5px;line-height:1.45}.dsl-turn__summary[_ngcontent-%COMP%]{margin:0 0 6px;font-size:13px;line-height:1.5;color:var(--ng-colors-text-primary-900)}.dsl-turn__diff[_ngcontent-%COMP%]{max-height:220px;overflow-y:auto;overflow-x:hidden;border:1px solid var(--ng-colors-border-secondary);border-radius:8px;background:var(--ng-colors-bg-primary);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;line-height:1.55}.dsl-diff-line[_ngcontent-%COMP%]{display:flex;gap:6px;padding:1px 8px;white-space:pre-wrap;overflow-wrap:anywhere}.dsl-diff-line--add[_ngcontent-%COMP%]{background:var(--ng-colors-bg-success-primary);color:var(--ng-componentcolors-utility-success-700)}.dsl-diff-line--remove[_ngcontent-%COMP%]{background:var(--ng-colors-bg-error-primary);color:var(--ng-colors-text-error-primary-hover)}.dsl-diff-line--context[_ngcontent-%COMP%]{color:var(--ng-colors-text-tertiary-600)}.dsl-diff-line__sign[_ngcontent-%COMP%]{flex:0 0 auto;width:8px;opacity:.75}.dsl-diff-line__text[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0}.dsl-turn__actions[_ngcontent-%COMP%]{display:block}.dsl-turn__actions[_ngcontent-%COMP%]::part(base){align-items:center;gap:2px}.dsl-turn__action[_ngcontent-%COMP%]{padding:3px 6px;border:0;border-radius:6px;background:transparent;font:inherit;font-size:11.5px;color:var(--ng-colors-fg-brand-primary-600);cursor:pointer;transition:background .12s}.dsl-turn__action[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--ng-colors-bg-brand-primary)}.dsl-turn__action[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.dsl-composer[_ngcontent-%COMP%]{display:block}.dsl-composer[_ngcontent-%COMP%]::part(textarea){font-size:13px}.dsl-editor-drawer__footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%}.dsl-editor-drawer__footer-note[_ngcontent-%COMP%]{font-size:12px;color:var(--ng-colors-text-tertiary-600)}.dsl-editor-drawer__footer-actions[_ngcontent-%COMP%]{display:inline-flex;gap:8px}.fc-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.fc-label[_ngcontent-%COMP%]{font-size:14px;font-weight:600;color:var(--ng-colors-text-primary-900);margin-top:12px}.fc-label[_ngcontent-%COMP%]:first-child{margin-top:0}.fc-hint[_ngcontent-%COMP%]{font-size:13px;color:var(--ng-colors-text-tertiary-600);margin:0 0 4px}.fc-range[_ngcontent-%COMP%]{width:100%;accent-color:var(--ng-colors-bg-brand-solid, #7a5af8)}.fc-seg[_ngcontent-%COMP%]{display:flex;gap:4px;background:var(--ng-colors-bg-secondary);border-radius:8px;padding:3px}.fc-seg__btn[_ngcontent-%COMP%]{flex:1;border:0;background:transparent;border-radius:6px;padding:6px 8px;font:inherit;font-size:13px;color:var(--ng-colors-text-secondary-700);cursor:pointer}.fc-seg__btn--on[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-solid, #7a5af8);color:var(--ng-colors-text-white);font-weight:600}.fc-actions[_ngcontent-%COMP%]{display:inline-flex;gap:8px}.fc-fact[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:12px;margin-top:6px;font-size:12px;color:var(--ng-colors-text-quaternary-500)}.fc-fact[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:var(--ng-colors-text-secondary-700);font-weight:600}']})};function pPt(i){return i.config?._meta?.evidence?.openable!==!1}var B3="https://ui-cdn.dev.aqueralabs.com/maps",LPt={"custom/world":`${B3}/world.topo.json`,"custom/us-states":`${B3}/us-all.topo.json`,"custom/us-counties":`${B3}/us-counties.topo.json`,"custom/europe":`${B3}/europe.topo.json`},uF=new Map,elt=new WeakMap;function OPt(i){let e=uF.get(i);return e||(e=fetch(i).then(t=>{if(!t.ok)throw uF.delete(i),new Error(`Failed to fetch topo ${i}: ${t.status}`);return t.json()}),uF.set(i,e)),e}async function cF(i){if(typeof i!="string"||i==="none")return;let e=LPt[i];if(e)try{return await OPt(e)}catch(t){console.error("[map-topo] fetch failed:",t);return}}async function qst(i){if(typeof i.mapData!="string")return;let e=i.mapData,t=await cF(e);if(t===void 0){delete i.mapData;return}elt.set(i,e),i.mapData=t}async function Rl(i){let e=i?.chart;if(!e||e.type!=="map")return;let t=[qst(e)];for(let M of e.options?.series??[])t.push(qst(M));await Promise.all(t)}async function tlt(i){await Promise.all(i.map(e=>Rl(e.config??null)))}function Kst(i){if(typeof i.mapData=="string"||i.mapData==null)return x({},i);let e=elt.get(i);return e===void 0?x({},i):U(x({},i),{mapData:e})}function CA(i){let e=i?.chart;if(!e||e.type!=="map")return i;let t=e.options?.series,M=Array.isArray(t)?t.map(Kst):t,n=x(x({},Kst(e)),e.options!==void 0?{options:x(x({},e.options),M!==void 0?{series:M}:{})}:{});return U(x({},i),{chart:n})}function ilt(i){let e=i;return e?.chart?.type!=="filter"||!Array.isArray(e.chart.controls)?i:U(x({},i),{chart:U(x({},e.chart),{controls:e.chart.controls.map(t=>U(x({},t),{value:""}))})})}function tE(i,e){let t=Array.isArray(i)?i:[],M=Array.isArray(e)?e:[],n=t.length;if(n===0)return{perField:[],anyPartial:!1};let r=M.map(({field:a,label:s})=>{let l=[],N=0;for(let c of t){let D=Array.isArray(c.skippedFilters)&&c.skippedFilters.includes(a),I=c.edited===!1||c.filterApplied===!1;D||I?l.push(c.title||c.id):(c.filterApplied===!0||c.edited===!0)&&(N+=1)}return{field:a,label:s||a,appliedCount:N,total:n,skippedWidgetTitles:l}}),o=r.some(a=>a.skippedWidgetTitles.length>0);return{perField:r,anyPartial:o}}function F3(i,e,t){let M=t?.timeRange?{timeRange:t.timeRange}:{};return t?.resolvedFilters?x({widgets:i,attribute:"attribute",filters:t.resolvedFilters},M):t?.mode==="prompt"&&typeof t.prompt=="string"&&t.prompt.trim()!==""?x({widgets:i,attribute:"prompt",prompt:t.prompt},M):x({widgets:i,filters:e},M)}function mPt(i,e){let t=new Map;for(let M of e)M?.id&&t.set(M.id,M);return i.map(M=>{let n=M?.id?t.get(M.id):void 0;if(n){let r=n.config,o=M.config;return U(x(x({},M),n),{config:r??o})}return Mlt(M)})}function Mlt(i){if(!("edited"in i||"reason"in i||"filterApplied"in i||"filteredRowCount"in i||"partial"in i||"skippedFilters"in i))return i;let l=i,{edited:t,reason:M,filterApplied:n,filteredRowCount:r,partial:o,skippedFilters:a}=l;return $e(l,["edited","reason","filterApplied","filteredRowCount","partial","skippedFilters"])}function EPt(i,e,t){let M=i.filter(a=>!t(a)),n=M.length===e.length,r=new Set,o=new Map;return e.forEach((a,s)=>{let l;if(a.title&&(l=i.find(N=>N.title===a.title&&!r.has(N.id))),!l&&n){let N=M[s];l=N&&!r.has(N.id)?N:void 0}l&&(r.add(l.id),o.set(l.id,a))}),o}var DF="dashboard-filter";function IF(){return{id:DF,title:"Filters",widgetType:"chart",componentName:"nile-filter-widget",layout:{x:0,y:0,w:12,h:2},summary:"Filter every widget on this dashboard.",config:{aq:{autocomplete:[]},chart:{type:"filter",controls:[{id:DF,label:"",description:"",value:"",defaultValue:"",autoApply:!1,selection:"single",variant:"prompt",showClearIcon:!0,suggestions:[],suggestionInsert:"replace",typeSpeedMs:60,pauseBeforeDeleteMs:1400,pauseBetweenMs:400,promptPlaceholders:["Filter by any field\u2026"],expressionPlaceholders:['field == "value"'],queryLanguage:{enabled:!1}}]}}}}function Ug(i){return i.config?.chart?.type==="filter"||i.componentName==="nile-filter-widget"}function jF(i,e=2,t=12){let M=i.reduce((a,s)=>Ug(s)?a+1:a,0);if(M===0)return i;let n=Array.from({length:M},(a,s)=>({x:0,y:s*e,w:t,h:e})),r=[...n],o=0;return i.map(a=>{if(Ug(a))return U(x({},a),{layout:n[o++]});if(!a.layout)return a;let{x:s,w:l,h:N}=a.layout,c=a.layout.y,D=!0;for(;D;){D=!1;for(let d of r)s<d.x+d.w&&s+l>d.x&&c<d.y+d.h&&c+N>d.y&&(c=d.y+d.h,D=!0)}let I={x:s,y:c,w:l,h:N};return r.push(I),U(x({},a),{layout:I})})}function fPt(i){if(Ug(i))return"filter";let e=i.config?.chart?.type;return i.componentName==="nile-kpi-chart"||e==="kpi"||i.widgetType==="kpi"?"kpi":i.componentName==="nile-data-grid"||e==="grid"||i.widgetType==="grid"?"grid":"chart"}var SPt=10,wPt=88,CPt=40,kPt=48,bPt=3,QPt=8;function UPt(i){let e=i.config?.chart,t=Number(e?.pagination?.pageSize)||SPt,M=e?.serverPagination===!0&&typeof e?.gridId=="string",n=Number(e?.totalItems),r=e?.data,o=Number.isFinite(n)?n:M?null:Array.isArray(r)?r.length:null,a=o==null?t:Math.min(o,t),s=wPt+a*CPt+kPt,l=Math.ceil(s/72);return Math.min(QPt,Math.max(bPt,l))}function vPt(i){let e=i.config?.chart?.sparkline;return Array.isArray(e)&&e.length>=2}function YPt(i){let e=i.config?.chart?.type;return i.componentName==="nile-master-detail-chart"||e==="master-detail"}function yF(i,e=12){let t=i.map(fPt),M=t.filter(Z=>Z==="filter").length,n=t.filter(Z=>Z==="kpi").length,r=0,o=r;r+=M*2;let a=r,s=n===2||n===3||n===4||n===6,l=s?n:Math.min(4,n),N=s?e/n:3,c=i.some((Z,B)=>t[B]==="kpi"&&vPt(Z))?3:2;r+=l?Math.ceil(n/l)*c:0;let D=4,I=Math.max(1,Math.floor(e/2)),d=[];{let Z=0,B=r;for(let q=0;q<i.length;q++)if(t[q]==="chart"){if(YPt(i[q])){Z!==0&&(Z=0,B+=D),d.push({x:0,y:B,w:e,h:D}),B+=D;continue}Z+I>e&&(Z=0,B+=D),d.push({x:Z,y:B,w:I,h:D}),Z+=I}if(Z===I){let q=d[d.length-1];q&&(q.w=e)}Z>0&&(B+=D),r=B}let y=r,A=i.filter((Z,B)=>t[B]==="grid").map(Z=>UPt(Z)),z=[];A.reduce((Z,B,q)=>(z[q]=Z,Z+B),0);let E=0,S=0,O=0,v=0;return i.map((Z,B)=>{let q;switch(t[B]){case"filter":{let W=E++;q={x:0,y:o+W*2,w:e,h:2};break}case"kpi":{let W=S++,Ne=Math.floor(W/l);q={x:W%l*N,y:a+Ne*c,w:N,h:c};break}case"grid":{let W=v++;q={x:0,y:y+z[W],w:e,h:A[W]};break}default:{q=d[O++];break}}return U(x({},Z),{layout:q})})}function dF(i,e){return!!i&&[i.x,i.y,i.w,i.h].every(Number.isFinite)&&i.x>=0&&i.y>=0&&i.w>0&&i.h>0&&i.x+i.w<=e}function ZPt(i,e){return i.x<e.x+e.w&&i.x+i.w>e.x&&i.y<e.y+e.h&&i.y+i.h>e.y}function iE(i,e=12){let t=i.map(n=>n.layout);return t.some(n=>!dF(n,e))||t.some((n,r)=>dF(n,e)&&t.slice(r+1).some(o=>dF(o,e)&&ZPt(n,o)))?yF(i,e):i}function H3(i,e){let t=i.config?.chart;return typeof t?.gridId!="string"||!t.gridId.startsWith("tpl:")?i:U(x({},i),{config:U(x({},i.config),{chart:U(x({},t),{gridId:e})})})}var M0=class i{stateSubject=new Ta(this.createEmpty("My Dashboard"));dirtySubject=new Ta(!1);mutationsSubject=new ya;filterBaseline=null;pendingLayoutBatch=null;layoutUndoStack=[];layoutRedoStack=[];static LAYOUT_HISTORY_LIMIT=50;canUndoLayoutSubject=new Ta(!1);canRedoLayoutSubject=new Ta(!1);state$=this.stateSubject.asObservable();dirty$=this.dirtySubject.asObservable();mutations$=this.mutationsSubject.asObservable();canUndoLayout$=this.canUndoLayoutSubject.asObservable();canRedoLayout$=this.canRedoLayoutSubject.asObservable();nothingToPublish$=df([this.state$,this.dirty$]).pipe(Tr(([e,t])=>e.version==="published"&&!t),GJ());get snapshot(){return this.stateSubject.value}get isDirty(){return this.dirtySubject.value}get canUndoLayout(){return this.canUndoLayoutSubject.value}get canRedoLayout(){return this.canRedoLayoutSubject.value}get isAutoGenerated(){return this.snapshot.isAutoGenerated===!0}setDashboardName(e){this.patchState({name:e.trim()||"Untitled Dashboard"})}setDashboardId(e){!e||this.snapshot.id===e||this.patchState({id:e})}addWidget(e,t){if("type"in e&&!("widgetType"in e))return this.addChartWidget(e);let M=e,n=this.snapshot.widgets,r=M.widgetType==="kpi"?2:4,o=M.widgetType==="kpi"?4:6,a=t?.placeExplicitly&&M.layout?M.layout:{x:0,y:this.computeMaxY(n,r),w:Math.min(Math.max(1,M.layout?.w||o),12),h:Math.max(1,M.layout?.h||r)},s=crypto.randomUUID(),l=U(x({},H3(M,s)),{id:s,layout:a}),N=[...n,l],c=!t?.placeExplicitly&&this.isFilterWidget(l)?this.normalizeFilterLayouts(N):N;return this.patchState({widgets:c}),l.id}addWidgets(e){if(!e.length)return[];let t=this.snapshot.widgets,M=t.some(N=>Ug(N)),n=M?e.filter(N=>!Ug(N)):e,r=n.filter(N=>!Ug(N)&&N.layout).map(N=>N.layout.y),o=M&&r.length?Math.min(...r):0,a=this.computeMaxY(t,0),s=[];for(let N of n){let c=N.widgetType==="kpi"?2:4,D=N.widgetType==="kpi"?4:6,I;Ug(N)?I={x:0,y:0,w:12,h:2}:N.layout?I={x:N.layout.x,y:N.layout.y-o+a,w:Math.min(Math.max(1,N.layout.w||D),12),h:Math.max(1,N.layout.h||c)}:I={x:0,y:this.computeMaxY([...t,...s],c),w:D,h:c};let d=crypto.randomUUID();s.push(U(x({},H3(N,d)),{id:d,layout:I}))}let l=this.normalizeFilterLayouts([...t,...s]);return this.patchState({widgets:l}),s.map(N=>N.id)}addChartWidget(e){let n=e,{title:t}=n,M=$e(n,["title"]);return this.addWidget({title:t,widgetType:"chart",config:{chart:M,aq:{}}})}addKpiWidget(e){return this.addWidget({title:e.label,widgetType:"kpi",config:{chart:e,aq:{}}})}updateWidget(e,t){let M=this.snapshot.widgets.map(n=>n.id===e?x(x({},n),t):n);this.patchState({widgets:M})}applyFilterView(e){if(!e.length)return;this.filterBaseline||(this.filterBaseline=this.snapshot.widgets.map(n=>x({},n)));let t=new Map(e.map(n=>[n.id,n])),M=this.snapshot.widgets.map(n=>{let r=t.get(n.id);return r?U(x(x({},n),r),{layout:n.layout??r.layout}):n});this.stateSubject.next(U(x({},this.snapshot),{widgets:M}))}restoreFilterBaseline(){if(!this.filterBaseline)return!1;let e=this.filterBaseline;return this.filterBaseline=null,this.stateSubject.next(U(x({},this.snapshot),{widgets:e})),!0}updateWidgetLayout(e,t){this.recordLayoutUndo(e);let M=this.snapshot.widgets.map(n=>n.id===e?U(x({},n),{layout:t}):n);this.patchState({widgets:M})}hasFilterWidget(){return this.snapshot.widgets.some(e=>Ug(e))}toggleFilterWidget(){let e=this.snapshot.widgets.find(r=>Ug(r));if(e){let r=e.layout,o=r?r.y+r.h:0,a=r?.h??0;this.patchState({widgets:this.snapshot.widgets.filter(s=>s.id!==e.id).map(s=>!s.layout||s.layout.y<o?s:U(x({},s),{layout:U(x({},s.layout),{y:Math.max(0,s.layout.y-a)})}))});return}let n=IF(),{id:t}=n,M=$e(n,["id"]);this.addWidget(M)}removeWidget(e){this.patchState({widgets:this.snapshot.widgets.filter(t=>t.id!==e)})}updateWidgetLayouts(e){if(!e.length)return;e.forEach(n=>this.recordLayoutUndo(n.id));let t=new Map(e.map(n=>[n.id,n.layout])),M=this.snapshot.widgets.map(n=>{let r=t.get(n.id);return r?U(x({},n),{layout:x({},r)}):n});this.patchState({widgets:M})}undoLayout(){let e=this.layoutUndoStack.pop();e&&(this.applyLayoutEntries(e,"before"),this.layoutRedoStack.push(e),this.syncLayoutHistoryFlags())}redoLayout(){let e=this.layoutRedoStack.pop();e&&(this.applyLayoutEntries(e,"after"),this.layoutUndoStack.push(e),this.syncLayoutHistoryFlags())}recordLayoutUndo(e){if(this.pendingLayoutBatch||(this.pendingLayoutBatch=new Map,queueMicrotask(()=>this.commitPendingLayoutBatch())),this.pendingLayoutBatch.has(e))return;let t=this.snapshot.widgets.find(M=>M.id===e)?.layout;t&&this.pendingLayoutBatch.set(e,t)}commitPendingLayoutBatch(){let e=this.pendingLayoutBatch;if(this.pendingLayoutBatch=null,!e||e.size===0)return;let t=[];for(let[M,n]of e){let r=this.snapshot.widgets.find(o=>o.id===M)?.layout;r&&!this.layoutsEqual(n,r)&&t.push({id:M,before:n,after:x({},r)})}t.length&&(this.layoutUndoStack.push(t),this.layoutUndoStack.length>i.LAYOUT_HISTORY_LIMIT&&this.layoutUndoStack.shift(),this.layoutRedoStack=[],this.syncLayoutHistoryFlags())}applyLayoutEntries(e,t){let M=new Map(e.map(r=>[r.id,r[t]])),n=this.snapshot.widgets.map(r=>{let o=M.get(r.id);return o?U(x({},r),{layout:x({},o)}):r});this.patchState({widgets:n})}layoutsEqual(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h}syncLayoutHistoryFlags(){this.canUndoLayoutSubject.next(this.layoutUndoStack.length>0),this.canRedoLayoutSubject.next(this.layoutRedoStack.length>0)}clearLayoutHistory(){this.pendingLayoutBatch=null,this.layoutUndoStack=[],this.layoutRedoStack=[],this.syncLayoutHistoryFlags()}replaceDashboard(e){let t=e.widgets.map((n,r)=>U(x({},n),{widgetType:n.widgetType??"chart",layout:n.layout??{x:0,y:r*4,w:n.widgetType==="kpi"?4:6,h:n.widgetType==="kpi"?2:4}})),M=U(x({},e),{widgets:iE(this.normalizeFilterLayouts(this.clampLayoutsToCols(t)))});this.filterBaseline=null,this.clearLayoutHistory(),this.stateSubject.next(M),this.dirtySubject.next(!1)}clampLayoutsToCols(e,t=12){let M=[];return e.map(n=>{let r=n.layout;if(!r)return n;let o=Math.max(1,Math.min(r.w,t)),a=Math.max(0,Math.min(r.x,t-o)),s=r.h,l=r.y,N=I=>M.some(d=>a<d.x+d.w&&a+o>d.x&&I<d.y+d.h&&I+s>d.y),c=Math.max(s,1);for(;N(l);)l+=c;let D={x:a,y:l,w:o,h:s};return M.push(D),U(x({},n),{layout:D})})}isFilterWidget(e){return Ug(e)}normalizeFilterLayouts(e,t=2,M=12){return jF(e,t,M)}resetDashboard(){this.filterBaseline=null,this.clearLayoutHistory(),this.stateSubject.next(this.createEmpty("My Dashboard")),this.dirtySubject.next(!1)}markClean(){this.stateSubject.next(U(x({},this.stateSubject.value),{version:"published"})),this.dirtySubject.next(!1)}createEmpty(e){return{id:crypto.randomUUID(),name:e,widgets:[],updatedAt:new Date().toISOString()}}computeMaxY(e,t){return e.reduce((M,n)=>{let r=n.layout?.y??0,o=n.layout?.h??t;return Math.max(M,r+o)},0)}patchState(e){let t=U(x(x({},this.snapshot),e),{updatedAt:new Date().toISOString()});this.stateSubject.next(t),this.dirtySubject.next(!0),this.mutationsSubject.next(t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var _Pt=6,WPt="__evidence-chart-data",PPt="Chart data";function RPt(i){return`${i}${WPt}`}var nlt={order:fA.CHART_DATA,contribute(i){let{columns:e,rows:t}=Gc(i.config?.chart);return t.length?[{id:RPt(i.id),title:PPt,widgetType:"chart",componentName:"nile-data-grid",config:{chart:{type:"grid",data:t,columns:e.map(M=>({accessorKey:M,header:M}))},aq:{}},layout:{x:0,y:0,w:12,h:_Pt}}]:[]}};var VPt="__evidence-provenance";function BPt(i){return`${i}${VPt}`}var rlt="How this was computed",FPt=[{accessorKey:"label",header:"Field"},{accessorKey:"text",header:"Value"}];function HPt(i){let e=[],t=i.config?.chart,M=t?.type;typeof M=="string"&&M&&e.push({label:"Chart type",text:M});let n=i.queryMeta,r=n?.indexName??n?.table;r&&e.push({label:"Source",text:r});let{rows:o}=Gc(t);return o.length&&e.push({label:"Rows",text:String(o.length)}),e}function JPt(i){if(!i)return[];let e=[...i0(i),...HPt(i)];return e.length?[{id:BPt(i.id),title:rlt,widgetType:"chart",componentName:"nile-data-grid",layout:{x:0,y:0,w:12,h:Math.max(2,e.length+1)},config:{chart:{type:"grid",columns:FPt.map(t=>x({},t)),data:e},aq:{chartTitle:rlt,ai:{enabled:!1}}}}]:[]}var olt={order:fA.PROVENANCE,contribute:i=>JPt(i)};var GPt="__evidence-records";function $Pt(i){return`${i}${GPt}`}var XPt="Records",qPt=2,KPt=8,e9t=i=>Math.min(KPt,Math.max(qPt,i+1));function t9t(i){let e=!!i.queryMeta?.sql,t=i.config?.chart?.type==="grid";return e&&!t}function i9t(i){if(!Array.isArray(i))return[];let e=[];for(let t of i){if(typeof t=="string"){e.push({accessorKey:t,header:t});continue}if(!t||typeof t!="object")continue;let M=t,n=typeof M.accessorKey=="string"?M.accessorKey:typeof M.field=="string"?M.field:null;if(!n)continue;let r=typeof M.header=="string"?M.header:typeof M.headerName=="string"?M.headerName:n;e.push({accessorKey:n,header:r})}return e}function alt(i){return{order:fA.RECORDS,async contribute(e,t){if(!i||!e||!t9t(e))return[];let M=await i.fetch(e,t.filters.length?t.filters:void 0);if(!M||M.empty||!M.chart)return[];let n=M.chart.config?.chart??{},r=Array.isArray(n.data)?n.data:[];if(!r.length)return[];let o=i9t(n.columns),a=o.length?o:Gc(n).columns.map(s=>({accessorKey:s,header:s}));return[{id:$Pt(e.id),title:XPt,widgetType:"chart",componentName:"nile-data-grid",layout:{x:0,y:0,w:12,h:e9t(r.length)},config:{chart:{type:"grid",columns:a,data:[...r]},aq:{}}}]}}}function M9t(){return[{provide:vj,multi:!0,useValue:nlt},{provide:vj,multi:!0,useFactory:i=>alt(i),deps:[[new x5,EA]]},{provide:vj,multi:!0,useValue:olt}]}function slt(i){return Array.isArray(i)?i.map(e=>({id:String(e?.id??""),label:String(e?.label??""),score:Number(e?.score??0),totalRows:Number(e?.totalRows??0),layouts:(Array.isArray(e?.widgets)?e.widgets:[]).filter(t=>t?.id&&t?.layout).map(t=>({id:String(t.id),layout:t.layout}))})).filter(e=>e.id&&e.layouts.length>0):[]}function n9t(i){return!i?.chart||i.chart.type!=="grid"||i.chart.stickyHeader!==void 0?i:U(x({},i),{chart:U(x({},i.chart),{stickyHeader:!0})})}function r9t(i,e){return{title:i.title,widgetType:i.widgetType,layout:i.layout,dataSourceId:e??i.dataSourceId,config:i.config,drilldownBy:i.drilldownBy}}var n0=class i{http=Fe(yo);tokenStore=Fe(vr);dashboardsPath=Fe(K2);inFlightSaves=new Map;lastSentCustomerId=null;lastSentProductId=null;get customerId(){return this.tokenStore.tenantId()??""}withPublished(e,t){return t===void 0?e:`${e}${e.includes("?")?"&":"?"}published=${t}`}mcpGatewayUrl(){return`${dt.baseUrl}/dviz-mcp`}async callMcpTool(e,t={}){let M=this.customerId,n=Oi(),r={};M!==this.lastSentCustomerId&&(r.customerId=M),n!==this.lastSentProductId&&(r.productId=n);let o;try{o=await oi(this.http.post(this.mcpGatewayUrl(),{jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:e,arguments:t}},{headers:{Accept:"application/json, text/event-stream"},params:r})),this.lastSentCustomerId=M,this.lastSentProductId=n}catch(s){throw s instanceof qM?new Error(s.error?.error?.message||s.error?.message||s.message):s}if(o.error)throw new Error(o.error.message);let a=o.result;if(a?.isError)throw new Error(a.structuredContent?.error?.message??a.content?.[0]?.text??`${e} failed`);return a?.structuredContent??{}}async publishToApi(e,t,M){return t?(await this.updateDashboardMeta(t,e),t):await this.createDashboard(e,void 0,M)}async updateDashboardMeta(e,t){if(!dt.MCP_GATEWAY_ENABLED){let M=null;try{M=await oi(this.http.put(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`,{name:t,description:t}))}catch(n){throw n instanceof qM?new Error(n.error?.error||n.message):n}if(M?.success===!1)throw new Error(M.error||"Failed to update dashboard");return}await this.callMcpTool("updateDashboard",{dashboardId:e,name:t,description:t})}async renameDashboard(e,t){await this.updateDashboardMeta(e,t)}async publishDashboard(e,t){if(!dt.MCP_GATEWAY_ENABLED){let M=null,n={};t&&(n.name=t,n.description=t);try{M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/publish`,n))}catch(r){throw r instanceof qM?new Error(r.error?.error||r.message):r}if(M?.success===!1)throw new Error(M.error||"Failed to publish dashboard");return}await this.callMcpTool("publishDashboard",{dashboardId:e})}async saveDraft(e,t){let n=(this.inFlightSaves.get(e)??Promise.resolve()).catch(()=>{}).then(()=>this.runSaveDraft(e,t));this.inFlightSaves.set(e,n);try{await n}finally{this.inFlightSaves.get(e)===n&&this.inFlightSaves.delete(e)}}async runSaveDraft(e,t){let M=iE(t.widgets).map(n=>({id:n.id,title:n.title,summary:n.summary,widgetType:n.widgetType,componentName:n.componentName,layout:n.layout??{x:0,y:0,w:6,h:4},config:CA(n.config),queryMeta:n.queryMeta,dataSourceId:n.dataSourceId,drilldownBy:n.drilldownBy}));if(!dt.MCP_GATEWAY_ENABLED){let n=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}?published=false`;await oi(this.http.put(n,{widgets:M}));return}await this.callMcpTool("updateDashboard",{dashboardId:e,widgets:M,published:!1})}async listDashboards(e){if(!dt.MCP_GATEWAY_ENABLED){let n={};e?.published!==void 0&&(n.published=e.published),e?.limit!==void 0&&(n.limit=String(e.limit)),e?.offset!==void 0&&(n.offset=String(e.offset)),e?.conversationId!==void 0&&(n.conversationId=e.conversationId);let r=await oi(this.http.get(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}`,{params:n})),o=r?.data??r;return Array.isArray(o)?o:[]}let t={};return e?.published!==void 0&&(t.published=e.published),e?.limit!==void 0&&(t.limit=e.limit),e?.offset!==void 0&&(t.offset=e.offset),e?.conversationId!==void 0&&(t.conversationId=e.conversationId),(await this.callMcpTool("listDashboards",t))?.dashboards??[]}async createDashboard(e,t,M){if(!dt.MCP_GATEWAY_ENABLED){let o;try{o=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}`,x({name:e,description:t??e},M??{})))}catch(s){throw s instanceof qM?new Error(s.error?.error||s.message):s}if(o?.success===!1)throw new Error(o.error||"Failed to create dashboard");let a=o?.data?.id??o?.id;if(!a)throw new Error("No dashboard ID returned from API");return a}let r=(await this.callMcpTool("createDashboard",x({name:e,description:t??e},M??{})))?.dashboard?.id;if(!r)throw new Error("No dashboard ID returned from API");return r}async deleteWidget(e,t,M){if(!dt.MCP_GATEWAY_ENABLED){let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}`;await oi(this.http.delete(this.withPublished(r,M)));return}let n={dashboardId:e,widgetId:t};M!==void 0&&(n.published=M),await this.callMcpTool("removeDashboardWidget",n)}async listChartTypes(e){let t;try{t=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/chart-types`,{widgetConfig:e}))}catch(M){throw M instanceof qM?new Error(M.error?.error||M.message):M}if(t?.success===!1)throw new Error(t?.error||"Could not load chart types");return t?.types??[]}async changeAdhocChartType(e,t){let M;try{M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/change-type`,{widgetConfig:e,newChartType:t}))}catch(n){throw n instanceof qM?new Error(n.error?.error||n.message):n}if(M?.success===!1||!M?.chart)throw new Error(M?.error||"Chart type change failed");return M.chart}async listAdhocFilterFields(e){let t;try{t=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/filter-fields`,{widgets:e}))}catch(M){throw M instanceof qM?new Error(M.error?.error||M.message):M}if(t?.success===!1)throw new Error(t?.error||"Could not load filter fields");return t?.fields??[]}async fetchAdhocFilterValues(e,t,M=""){let n;try{n=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/filter-values`,{widgets:e,field:t,prefix:M}))}catch(r){throw r instanceof qM?new Error(r.error?.error||r.message):r}if(n?.success===!1)throw new Error(n?.error||"Could not load filter values");return{field:t,values:n?.values??[],complete:n?.complete??!0}}async applyAdhocFilter(e,t){let M;try{M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/filter-apply`,{widgetConfig:e,filters:t}))}catch(n){throw n instanceof qM?new Error(n.error?.error||n.message):n}if(M?.success===!1||!M?.chart)throw new Error(M?.error||"Filter could not be applied");return M.chart}async changeWidgetChartType(e,t,M,n){let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}`,o;try{o=await oi(this.http.patch(this.withPublished(r,n),{chartType:M}))}catch(a){throw a instanceof qM?new Error(a.error?.error||a.message):a}if(o?.success===!1||!o?.data)throw new Error(o?.error||"Chart type change failed");return o.data}async addWidgetFilter(e,t,M,n){let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}/filters`,o;try{o=await oi(this.http.post(this.withPublished(r,n),M))}catch(a){throw a instanceof qM?new Error(a.error?.error||a.message):a}if(o?.success===!1||!o?.data)throw new Error(o?.error||"Filter could not be applied");return o.data}async removeWidgetFilter(e,t,M,n){let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}/filters/${M}`,o;try{o=await oi(this.http.delete(this.withPublished(r,n)))}catch(a){throw a instanceof qM?new Error(a.error?.error||a.message):a}if(o?.success===!1||!o?.data)throw new Error(o?.error||"Filter could not be removed");return o.data}async setFilterDefault(e,t,M,n,r){let o=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/widgets/${t}/filter-default`,a;try{a=await oi(this.http.patch(this.withPublished(o,r),{defaultValue:M,autoApply:n}))}catch(s){throw s instanceof qM?new Error(s.error?.error||s.message):s}if(a?.success===!1||!a?.data)throw new Error(a?.error||"Default filter could not be updated");return a.data}async deleteDashboard(e){if(!dt.MCP_GATEWAY_ENABLED){await oi(this.http.delete(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`));return}await this.callMcpTool("deleteDashboard",{dashboardId:e})}async discardDraft(e){if(!dt.MCP_GATEWAY_ENABLED){let t=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`;await oi(this.http.delete(this.withPublished(t,!1)));return}await this.callMcpTool("deleteDashboard",{dashboardId:e,published:!1})}async refreshDashboard(e){if(!dt.MCP_GATEWAY_ENABLED){let M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/refresh`,{}));if(M?.success===!1)throw new Error(M.error||"Failed to refresh dashboard");return{widgets:await this.mapAndHydrateWidgets(M?.data?.widgets)}}let t=await this.callMcpTool("refreshDashboard",{dashboardId:e});return{widgets:await this.mapAndHydrateWidgets(t?.refresh?.widgets)}}async rearrangeDashboard(e,t){let M=e.map(s=>{let l=s.config?.chart,N=l?{chart:{type:l.type,height:l.height,yCategories:l.yCategories,sparkline:l.sparkline,visibleRows:l.visibleRows,rowCount:l.rowCount}}:void 0;return{id:s.id,title:s.title??"",widgetType:s.widgetType??"chart",chartType:l?.type,config:N,layout:s.layout}});if(!dt.MCP_GATEWAY_ENABLED){let s;try{s=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/rearrange`,{widgets:M,dashboardId:t??void 0}))}catch(I){if(I instanceof qM){let d=new Error(I.error?.error||I.message);throw d.status=I.status,d}throw I}if(s?.success===!1)throw new Error(s.error||"Failed to rearrange dashboard");let l=s?.data??s,c=(Array.isArray(l)?l:l?.widgets??[]).filter(I=>I?.id&&I?.layout).map(I=>({id:String(I.id),layout:I.layout})),D=s?.meta?.count??c.length;return{layouts:c,widgetCount:D,options:slt(l?.options)}}let n=await this.callMcpTool("rearrangeDashboardWidgets",{widgets:M}),o=(n?.widgets??[]).filter(s=>s?.id&&s?.layout).map(s=>({id:String(s.id),layout:s.layout})),a=n?.count??o.length;return{layouts:o,widgetCount:a,options:slt(n?.options)}}async fetchDashboardSummary(e,t){let M=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/summary`,n=await oi(this.http.post(this.withPublished(M,t),{})),r=n?.data??n;return typeof r=="string"?r:r?.summary??""}async runExecutiveSummaryChat(e,t){let M=await oi(this.http.get(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`)),n=(M?.data??M)?.conversationId??null;if(!n)throw new Error("This dashboard has no conversation to summarise yet.");let r=this.tokenStore.accessToken()??"",o=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce`,a=await fetch(`${o}/v1/conversations/chat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({conversationId:n,message:t,dashboardId:e})});if(!a.ok||!a.body){let I=await a.text().catch(()=>a.statusText);throw new Error(`Request failed (${a.status}): ${I}`)}let s=a.body.getReader(),l=new TextDecoder,N="",c="",D=I=>{let d=I.trim();if(!d)return;let y=d.indexOf(":");if(!(y===-1||d.slice(0,y)!=="0"))try{c+=JSON.parse(d.slice(y+1))?.text??""}catch{}};for(;;){let{done:I,value:d}=await s.read();if(I)break;N+=l.decode(d,{stream:!0});let y=N.split(`
|
|
40501
40501
|
`);N=y.pop()??"";for(let A of y)D(A)}return N.trim()&&D(N.trim()),c}async fetchDashboardChat(e,t,M){let n=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/chat`,{message:t,sessionId:M}));if(n&&n.success===!1)throw new Error(n?.error||"Chat request failed");let r=n?.sessionId??M,o=n?.reply?.content??n?.message??n?.response??n?.content??"";return{sessionId:r,content:o}}async tweakWidget(e){let t="widgetId"in e?{widgetId:e.widgetId,prompt:e.prompt}:{widgetConfig:r9t(e.widget,e.dataSourceId),prompt:e.prompt};if(!dt.MCP_GATEWAY_ENABLED){let r;try{r=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/modify`,t))}catch(a){throw a instanceof qM?new Error(a.error?.error||a.message):a}if(r?.success===!1)throw new Error(r.error||"Tweak failed");let o=r?.chart;if(!o?.config)throw new Error("Invalid response from tweak API");return await Rl(o.config),o}let n=(await this.callMcpTool("modifyWidget",t))?.chart;if(!n?.config)throw new Error("Invalid response from tweak API");return await Rl(n.config),n}async generateWidgetDsl(e,t,M){let n="widgetId"in e?{widgetId:e.widgetId,prompt:t,currentQuery:M?.currentQuery,lastTurn:M?.lastTurn}:{widget:e.originalWidget,prompt:t,currentQuery:M?.currentQuery,lastTurn:M?.lastTurn},r;try{r=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/dsl/generate`,n))}catch(o){throw o instanceof qM?new Error(o.error?.error||o.message):o}if(r?.success===!1||!r?.sql)throw new Error(r?.error||"DSL generation failed");return{sql:r.sql,summary:r.summary??null,wasModified:r.wasModified===!0}}async applyWidgetDsl(e,t){if("widgetId"in e){let r;try{r=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/dsl/apply`,{widgetId:e.widgetId,dsl:t}))}catch(o){throw o instanceof qM?new Error(o.error?.error||o.message):o}if(r?.success===!1||!r?.chart)throw new Error(r?.error||"Apply failed");return await Rl(r.chart.config),r.chart}let M;try{M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/dsl/apply`,{widget:e.originalWidget,dsl:t,componentName:e.componentName,type:e.type,title:e.title}))}catch(r){throw r instanceof qM?new Error(r.error?.error||r.message):r}if(M?.success===!1||!M?.chart)throw new Error(M?.error||"Apply failed");let n=U(x({},e.originalWidget),{config:U(x({},e.originalWidget.config),{chart:M.chart}),queryMeta:M.queryMeta??e.originalWidget.queryMeta});return await Rl(n.config),n}async fetchWidgetRecords(e,t){let M;try{M=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/records`,t?.length?{widgetConfig:e,filters:t}:{widgetConfig:e}))}catch(n){throw n instanceof qM?new Error(n.error?.error||n.message):n}if(M?.success===!1)throw new Error(M?.error||"Fetching records failed");return M?.empty||!M?.chart?{chart:null,empty:!0}:(await Rl(M.chart.config),{chart:M.chart})}async filterSuggest(e,t,M,n){let r=M.filter(s=>!!s.id).map(s=>{let l={widgetId:s.id};return s.queryMeta&&(l.queryMeta=s.queryMeta),s.dataSourceId&&(l.dataSourceId=s.dataSourceId),l}),o;try{o=await oi(this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/filter/suggest?status=${n??"draft"}`,{query:t,refreshCache:!1,widgets:r}))}catch(s){throw s instanceof qM?new Error(s.error?.error||s.message):s}if(o?.success===!1)throw new Error(o.error||"Request failed");let a=o?.data??o??{};return{nextToken:a.nextToken,completions:Array.isArray(a.completions)?a.completions:[],suggestions:Array.isArray(a.suggestions)?a.suggestions:[]}}fetchFilterValues=async(e,t,M,n)=>{let r={field:t,values:[],complete:!1};if(!e||!t)return r;let a=`${`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}/filter/values`}?field=${encodeURIComponent(t)}&prefix=${encodeURIComponent(M??"")}`,s=n?.resolvedFilters;Array.isArray(s)&&s.length>0&&(a+=`&resolvedFilters=${encodeURIComponent(JSON.stringify(s))}`);let l=n?.dashboardFilters;l&&typeof l=="object"&&Object.keys(l).length>0&&(a+=`&dashboardFilters=${encodeURIComponent(JSON.stringify(l))}`);let N=n?.matchMode;(N==="substring"||N==="fuzzy"||N==="semantic")&&(a+=`&match=${N}`);try{let c=await oi(this.http.get(a)),I=(c?.data?.values??[]).map(d=>typeof d=="string"?d?{value:d,label:d}:null:typeof d?.label=="string"&&d.label?{value:d.label,label:d.label,count:d.count}:null).filter(d=>d!==null);return{field:t,values:I,complete:c?.data?.complete??!1,source:c?.data?.source??"sql_prefix"}}catch{return r}};async applyFilters(e,t,M,n,r,o){let a=await new Promise((c,D)=>{let I=this.http.post(`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${M}/filter/apply?status=${n??"draft"}`,F3(e,t,o)).subscribe({next:d=>c(d),error:d=>{d instanceof qM?D(new Error(d.error?.error||d.message)):D(d)}});if(r){if(r.aborted){I.unsubscribe();let d=new Error("Aborted");d.name="AbortError",D(d);return}r.addEventListener("abort",()=>{I.unsubscribe();let d=new Error("Aborted");d.name="AbortError",D(d)},{once:!0})}});if(a?.success===!1)throw new Error(a.error||"Request failed");let s=a?.data??a,l=Array.isArray(s)?s:s?.widgets;if(!Array.isArray(l))throw new Error("Invalid response from apply-filters API");let N=!Array.isArray(s)&&Array.isArray(s?.resolvedFilters)?s.resolvedFilters:[];return await Promise.all(l.map(c=>Rl(c.config))),{widgets:l,resolvedFilters:N}}async fetchDashboard(e,t){let M,n=!1;if(dt.MCP_GATEWAY_ENABLED){let r={dashboardId:e};t!==void 0&&(r.published=t?"true":"false");let o=await this.callMcpTool("getDashboard",r);M=o?.dashboard??{},n=o?.canRefresh===!0}else{let r=`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/${this.dashboardsPath}/${e}`,o=await oi(this.http.get(this.withPublished(r,t)));M=o?.data??o,n=o?.canRefresh===!0}return this.toDashboardState(M,n)}async toDashboardState(e,t=!1){return{id:e.id,name:e.name??"Untitled",widgets:await this.mapAndHydrateWidgets(e.widgets),updatedAt:e.updatedAt??new Date().toISOString(),isAutoGenerated:e.isAutoGenerated===!0,connectionId:e.connectionId,isPipeline:e.isPipeline===!0,adapterType:e.adapterType,forecastable:e.forecastable??{},canRefresh:t,version:e.version==="published"?"published":e.version==="draft"?"draft":void 0}}async mapAndHydrateWidgets(e){let t=(e??[]).map(M=>{let n=M.config??{},r=n9t(U(x({},n),{chart:M.chart??n.chart??{},aq:n.aq??{}}));return{id:M.id,title:M.title,summary:M.summary,widgetType:M.widgetType??"chart",componentName:M.componentName,layout:M.layout,config:r,queryMeta:M.queryMeta,dataSourceId:M.dataSourceId,drilldownBy:Array.isArray(M.drilldownBy)?M.drilldownBy:void 0}});return await Promise.all(t.map(M=>Rl(M.config))),t}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var ME=class i{http=Fe(yo);tokenStore=Fe(vr);base(e){let t=this.tokenStore.tenantId()??"";return`${dt.baseUrl}/api/customers/${t}/products/${Oi()}/workforce/dashboards/${e}`}async probe(e){try{return(await oi(this.http.get(`${this.base(e)}/forecastable`)))?.widgets??{}}catch(t){return console.info("[dashboards] forecast probe unavailable \u2014 no forecast actions offered.",t),{}}}async probeWidgets(e){if(!e?.length)return{};try{let t=this.tokenStore.tenantId()??"";return(await oi(this.http.post(`${dt.baseUrl}/api/customers/${t}/products/${Oi()}/workforce/dashboards/forecastable`,{widgets:e})))?.widgets??{}}catch(t){return console.info("[dashboards] widget forecast probe unavailable \u2014 no forecast actions offered.",t),{}}}async forecastWidget(e,t={}){let M=this.tokenStore.tenantId()??"";return oi(this.http.post(`${dt.baseUrl}/api/customers/${M}/products/${Oi()}/workforce/dashboards/forecast-widget`,x({widget:e},t)))}async addToWidget(e,t,M={}){return oi(this.http.post(`${this.base(e)}/widgets/${t}/forecast`,M))}async removeFromWidget(e,t){return oi(this.http.delete(`${this.base(e)}/widgets/${t}/forecast`))}async toggleDashboard(e,t){return oi(this.http.post(`${this.base(e)}/forecast`,{enabled:t}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};function J3(i){return(i??[]).map(e=>{let t=e?.config?.chart??{},M=Array.isArray(t.categories)?t.categories:[],n=Array.isArray(t.data)?t.data.length:0,r=String(M[0]??""),o=String(M[M.length-1]??"");return`${e?.id}:${M.length}:${n}:${r}:${o}`}).join("|")}function llt(){requestAnimationFrame(()=>{let i=document.body.querySelector(".nile-toast-stack");i&&Object.assign(i.style,{position:"fixed",top:"16px",right:"16px",left:"auto",bottom:"auto",zIndex:"var(--z-toast)",display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-end"})})}function kA(i){let e=document.createElement("nile-toast");e.variant=i.variant??"success",i.title!==void 0?(e.title=i.title,e.content=i.content):e.title=i.content,e.duration=i.duration??5e3,e.closable=i.closable??!0,e.toast(),llt()}var o9t=[/\b(?:insert\s+into|delete\s+from|update\s+[\w".]+\s+set|create\s+table|alter\s+table|drop\s+table)\b/i,/\bselect\b[\s\S]*\bfrom\b/i,/\b(?:column|relation|table|constraint|function)\s+"[^"]+"\s+(?:of\s+relation\s+"[^"]+"\s+)?(?:does\s+not\s+exist|already\s+exists)/i,/\bviolates\s+(?:unique|foreign\s+key|not-null|check)\s+constraint\b/i,/\bsyntax\s+error\s+at\s+or\s+near\b/i,/\$\d+\s*,\s*\$\d+/,/\n\s*at\s+\S+/,/\bnode_modules[/\\]/,/\b(?:ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|SequelizeError|KnexTimeoutError)\b/,/^\s*[[{]/,/^Http failure response for /i];function G3(i){let e=(i??"").trim();return e?e.length>240?!0:o9t.some(t=>t.test(e)):!1}function TF(i,e="Something went wrong. Please try again."){let t=(i??"").trim();return t?G3(t)?e:t:e}var zF="dvz.dashboard.timeFilter",glt="dvz-time-filter-preference-changed",nE=class i{prefs=ke(AF());constructor(){window.addEventListener(glt,()=>this.prefs.set(AF())),window.addEventListener("storage",e=>{(e.key===null||e.key===zF)&&this.prefs.set(AF())})}enabled(e){return At(()=>{let t=e();return!!t&&this.prefs()[t]===!0})}isEnabled(e){return!!e&&this.prefs()[e]===!0}toggle(e){e&&this.set(e,!this.isEnabled(e))}set(e,t){if(!e)return;let M=U(x({},this.prefs()),{[e]:t});this.prefs.set(M),a9t(M),window.dispatchEvent(new Event(glt))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};function AF(){try{let i=localStorage.getItem(zF);if(!i)return{};let e=JSON.parse(i);if(!e||typeof e!="object"||Array.isArray(e))return{};let t={};for(let[M,n]of Object.entries(e))t[M]=n===!0;return t}catch{return{}}}function a9t(i){try{localStorage.setItem(zF,JSON.stringify(i))}catch{}}var r0=class i{http=Fe(yo);tokenStore=Fe(vr);get customerId(){return this.tokenStore.tenantId()??""}get baseWidgetsUrl(){return`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/global-widgets`}async getAll(e="",t=""){let M=new URLSearchParams;e&&M.set("widgetType",e),t&&M.set("tag",t);let n=M.toString(),r=`${this.baseWidgetsUrl}${n?"?"+n:""}`,o=await oi(this.http.get(r)),s=(o?.data??o??[]).map(l=>U(x({},l),{config:l.config??l.chart??l.kpi??{}}));return await Promise.all(s.map(l=>Rl(l.config))),s}async getById(e){let t=await oi(this.http.get(`${this.baseWidgetsUrl}/${e}`)),M=t?.data??t;return await Rl(M?.config),M}async add(e){let t={title:e.title,summary:e.summary,widgetType:e.widgetType,componentName:e.componentName,layout:e.layout,config:CA(e.config),drilldownBy:e.drilldownBy,drilldownOptions:e.drilldownOptions},M=await oi(this.http.post(this.baseWidgetsUrl,t));return M?.data??M}async update(e,t){let M={};t.title&&(M.title=t.title),t.summary&&(M.summary=t.summary),t.widgetType&&(M.widgetType=t.widgetType),t.componentName&&(M.componentName=t.componentName),t.layout&&(M.layout=t.layout),t.config&&(M.config=CA(t.config)),t.drilldownBy&&(M.drilldownBy=t.drilldownBy),t.drilldownOptions&&(M.drilldownOptions=t.drilldownOptions);let n=await oi(this.http.put(`${this.baseWidgetsUrl}/${e}`,M));return n?.data??n}async remove(e){await oi(this.http.delete(`${this.baseWidgetsUrl}/${e}`))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var o0=class i{http=Fe(yo);tokenStore=Fe(vr);get customerId(){return this.tokenStore.tenantId()??""}baseUrl(e){return`${dt.baseUrl}/api/customers/${this.customerId}/products/${Oi()}/workforce/widget/${e}/drilldown-options`}async listDrilldown(e){return(await oi(this.http.get(this.baseUrl(e))))?.data?.options??[]}async applyDrilldown(e,t){let M=await oi(this.http.put(`${this.baseUrl(e)}/enabled`,{enabledIds:t}));return{options:M?.data?.options??[],drilldownBy:M?.data?.drilldownBy??[]}}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var s9t=()=>[120,170,160,110,90,175,105,130,95,155],l9t=(i,e)=>e.key,g9t=(i,e)=>e.id;function N9t(i,e){if(i&1&&(C(0,"nile-nav-tab",2),Y(1),b()),i&2){let t=e.$implicit;It("panel",t.key),L(),it(t.label)}}function u9t(i,e){if(i&1){let t=Le();C(0,"nile-input",19),Ae("nile-change",function(n){P(t);let r=p(2);return R(r.onTitleChange(n))}),b()}if(i&2){let t=p(2);Ue("value",t.titleValue)}}function c9t(i,e){if(i&1){let t=Le();C(0,"nile-input",19),Ae("nile-change",function(n){P(t);let r=p(2);return R(r.onSubtitleChange(n))}),b()}if(i&2){let t=p(2);Ue("value",t.subtitleValue)}}function D9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-input",20),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.height=n.detail.value,R(r.onChartEdit())}),b()(),C(2,"div",4)(3,"nile-input",21),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.toggleLabel=n.detail.value,R(r.onChartEdit())}),b()(),C(4,"div",4)(5,"nile-slide-toggle",22),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.showLegend=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(2);L(),Ue("value",t.chartState.height),L(2),Ue("value",t.chartState.toggleLabel),L(2),Ue("isChecked",t.chartState.showLegend)}}function I9t(i,e){if(i&1){let t=Le();C(0,"nile-input",24),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.loadingText=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("value",t.kpi.loadingText)}}function d9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"div",5)(2,"div",6),Y(3,"Tooltip"),b(),C(4,"nile-slide-toggle",7),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.tooltipEnabled=n.detail.checked,R(r.onKpiEdit())}),b()()(),C(5,"div",4)(6,"div",5)(7,"div",6),Y(8,"Loading"),b(),C(9,"nile-slide-toggle",7),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.loading=n.detail.checked,R(r.onKpiEdit())}),b()(),he(10,I9t,1,1,"nile-input",23),b()}if(i&2){let t=p(2);L(4),Ue("isChecked",t.kpi.tooltipEnabled),L(5),Ue("isChecked",t.kpi.loading),L(),xe(t.kpi.loading?10:-1)}}function j9t(i,e){if(i&1){let t=Le();C(0,"nile-nav-tab-panel",25)(1,"div",4)(2,"nile-input",49),Ae("nile-change",function(n){P(t);let r=p(3);return r.chartState.xAxisTitle=n.detail.value,R(r.onChartEdit())}),b(),C(3,"nile-input",50),Ae("nile-change",function(n){P(t);let r=p(3);return r.chartState.yAxisTitle=n.detail.value,R(r.onChartEdit())}),b()()()}if(i&2){let t=p(3);L(2),Ue("value",t.chartState.xAxisTitle),L(),Ue("value",t.chartState.yAxisTitle)}}function y9t(i,e){if(i&1){let t=Le();C(0,"nile-nav-tab-panel",26)(1,"nile-slide-toggle",51),Ae("nile-change",function(n){P(t);let r=p(3);return r.chartState.showDataLabels=n.detail.checked,R(r.onChartEdit())}),b(),C(2,"p",10),Y(3,"Configure labels displayed on each slice."),b()()}if(i&2){let t=p(3);L(),Ue("isChecked",t.chartState.showDataLabels)}}function T9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-input",52),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.innerSize=n.detail.value,R(r.onChartEdit())}),b(),C(2,"nile-slide-toggle",53),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.semiCircle=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("value",t.chartState.innerSize),L(),Ue("isChecked",t.chartState.semiCircle)}}function A9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-slide-toggle",54),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.stacked=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("isChecked",t.chartState.stacked)}}function z9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-slide-toggle",55),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.showArea=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("isChecked",t.chartState.showArea)}}function h9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-select",56),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.stackMode=n.target.value,R(r.onChartEdit())}),C(2,"nile-option",57),Y(3,"Normal"),b(),C(4,"nile-option",58),Y(5,"Percent"),b()(),C(6,"nile-input",59),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.pointPadding=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("value",t.chartState.stackMode),L(5),Ue("value",t.chartState.pointPadding)}}function x9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-input",60),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.groupPadding=n.detail.value,R(r.onChartEdit())}),b(),C(2,"nile-input",59),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.pointPadding=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("value",t.chartState.groupPadding),L(),Ue("value",t.chartState.pointPadding)}}function p9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(5);return r.chartState.histogramColor=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(5);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.histogramColor||"#005EA6")}}function L9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"div",29)(2,"span",30),Y(3,"Color"),b(),C(4,"button",31),Ae("click",function(){P(t);let n=p(4);return R(n.toggleColorPicker("histogramColor"))}),C(5,"span",32),Y(6,"Pick color"),b()(),he(7,p9t,1,5,"nile-color-picker",33),b(),C(8,"nile-input",61),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.binsNumber=n.detail.value,R(r.onChartEdit())}),b(),C(9,"nile-input",62),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.binWidth=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(4),aM("background",t.chartState.histogramColor||"#005EA6"),L(3),xe(t.openColorPicker==="histogramColor"?7:-1),L(),Ue("value",t.chartState.binsNumber),L(),Ue("value",t.chartState.binWidth)}}function O9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-slide-toggle",64),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.horizontal=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("isChecked",t.chartState.horizontal)}}function m9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(5);return r.chartState.lowMarkerColor=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(5);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.lowMarkerColor||"var(--ng-colors-text-error-primary-hover)")}}function E9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(5);return r.chartState.connectorColor=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(5);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.connectorColor||"var(--ng-colors-text-placeholder)")}}function f9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-slide-toggle",64),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.horizontal=n.detail.checked,R(r.onChartEdit())}),b(),C(2,"div",29)(3,"span",30),Y(4,"Low marker color"),b(),C(5,"button",31),Ae("click",function(){P(t);let n=p(4);return R(n.toggleColorPicker("lowMarkerColor"))}),C(6,"span",32),Y(7,"Pick color"),b()(),he(8,m9t,1,5,"nile-color-picker",33),b(),C(9,"div",29)(10,"span",30),Y(11,"Connector color"),b(),C(12,"button",31),Ae("click",function(){P(t);let n=p(4);return R(n.toggleColorPicker("connectorColor"))}),C(13,"span",32),Y(14,"Pick color"),b()(),he(15,E9t,1,5,"nile-color-picker",33),b()()}if(i&2){let t=p(4);L(),Ue("isChecked",t.chartState.horizontal),L(4),aM("background",t.chartState.lowMarkerColor||"var(--ng-colors-text-error-primary-hover)"),L(3),xe(t.openColorPicker==="lowMarkerColor"?8:-1),L(4),aM("background",t.chartState.connectorColor||"var(--ng-colors-text-placeholder)"),L(3),xe(t.openColorPicker==="connectorColor"?15:-1)}}function S9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-slide-toggle",65),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.datetimeAxis=n.detail.checked,R(r.onChartEdit())}),b(),C(2,"nile-slide-toggle",66),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.inverted=n.detail.checked,R(r.onChartEdit())}),b(),C(3,"nile-slide-toggle",67),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.alternateLabels=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("isChecked",t.chartState.datetimeAxis),L(),Ue("isChecked",t.chartState.inverted),L(),Ue("isChecked",t.chartState.alternateLabels)}}function w9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-input",68),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gaugeMin=n.detail.value,R(r.onChartEdit())}),b(),C(2,"nile-input",69),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gaugeMax=n.detail.value,R(r.onChartEdit())}),b(),C(3,"nile-input",70),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gaugeSuffix=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("value",t.chartState.gaugeMin),L(),Ue("value",t.chartState.gaugeMax),L(),Ue("value",t.chartState.gaugeSuffix)}}function C9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-slide-toggle",71),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gridStriped=n.detail.checked,R(r.onChartEdit())}),b(),C(2,"nile-slide-toggle",72),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gridHoverable=n.detail.checked,R(r.onChartEdit())}),b(),C(3,"nile-slide-toggle",73),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gridStickyHeader=n.detail.checked,R(r.onChartEdit())}),b(),C(4,"nile-input",74),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gridEmptyMessage=n.detail.value,R(r.onChartEdit())}),b(),C(5,"nile-input",75),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gridLoadingMessage=n.detail.value,R(r.onChartEdit())}),b(),C(6,"nile-input",76),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.gridNoMatchMessage=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("isChecked",t.chartState.gridStriped),L(),Ue("isChecked",t.chartState.gridHoverable),L(),Ue("isChecked",t.chartState.gridStickyHeader),L(),Ue("value",t.chartState.gridEmptyMessage),L(),Ue("value",t.chartState.gridLoadingMessage),L(),Ue("value",t.chartState.gridNoMatchMessage)}}function k9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(5);return r.chartState.bellcurveColor=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(5);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.bellcurveColor||"#005EA6")}}function b9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(5);return r.chartState.bellcurveFill=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(5);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.bellcurveFill||"#005EA6")}}function Q9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"div",29)(2,"span",30),Y(3,"Color"),b(),C(4,"button",31),Ae("click",function(){P(t);let n=p(4);return R(n.toggleColorPicker("bellcurveColor"))}),C(5,"span",32),Y(6,"Pick color"),b()(),he(7,k9t,1,5,"nile-color-picker",33),b(),C(8,"div",29)(9,"span",30),Y(10,"Fill color"),b(),C(11,"button",31),Ae("click",function(){P(t);let n=p(4);return R(n.toggleColorPicker("bellcurveFill"))}),C(12,"span",32),Y(13,"Pick color"),b()(),he(14,b9t,1,5,"nile-color-picker",33),b(),C(15,"nile-input",77),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.intervals=n.detail.value,R(r.onChartEdit())}),b(),C(16,"nile-input",78),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.pointsInInterval=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(4),aM("background",t.chartState.bellcurveColor||"#005EA6"),L(3),xe(t.openColorPicker==="bellcurveColor"?7:-1),L(4),aM("background",t.chartState.bellcurveFill||"#005EA6"),L(3),xe(t.openColorPicker==="bellcurveFill"?14:-1),L(),Ue("value",t.chartState.intervals),L(),Ue("value",t.chartState.pointsInInterval)}}function U9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-input",79),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.threshold=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("value",t.chartState.threshold)}}function v9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-input",80),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.innerSize=n.detail.value,R(r.onChartEdit())}),b(),C(2,"nile-input",81),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.paneSize=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("value",t.chartState.innerSize),L(),Ue("value",t.chartState.paneSize)}}function Y9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(5);return r.chartState.fanLineColor=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(5);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.fanLineColor||"#005EA6")}}function Z9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"div",29)(2,"span",30),Y(3,"Line color"),b(),C(4,"button",31),Ae("click",function(){P(t);let n=p(4);return R(n.toggleColorPicker("fanLineColor"))}),C(5,"span",32),Y(6,"Pick color"),b()(),he(7,Y9t,1,5,"nile-color-picker",33),b(),C(8,"nile-input",82),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.forecastStartIndex=n.detail.value,R(r.onChartEdit())}),b(),C(9,"nile-input",83),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.forecastBandLabel=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(4),aM("background",t.chartState.fanLineColor||"#005EA6"),L(3),xe(t.openColorPicker==="fanLineColor"?7:-1),L(),Ue("value",t.chartState.forecastStartIndex),L(),Ue("value",t.chartState.forecastBandLabel)}}function _9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-slide-toggle",66),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.inverted=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("isChecked",t.chartState.inverted)}}function W9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(5);return r.chartState.minColor=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(5);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.minColor||"#FFFFFF")}}function P9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(5);return r.chartState.maxColor=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(5);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.maxColor||"#005EA6")}}function R9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-input",84),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.colorMin=n.detail.value,R(r.onChartEdit())}),b(),C(2,"nile-input",85),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.colorMax=n.detail.value,R(r.onChartEdit())}),b(),C(3,"div",29)(4,"span",30),Y(5,"Min color"),b(),C(6,"button",31),Ae("click",function(){P(t);let n=p(4);return R(n.toggleColorPicker("minColor"))}),C(7,"span",32),Y(8,"Pick color"),b()(),he(9,W9t,1,5,"nile-color-picker",33),b(),C(10,"div",29)(11,"span",30),Y(12,"Max color"),b(),C(13,"button",31),Ae("click",function(){P(t);let n=p(4);return R(n.toggleColorPicker("maxColor"))}),C(14,"span",32),Y(15,"Pick color"),b()(),he(16,P9t,1,5,"nile-color-picker",33),b(),C(17,"nile-input",86),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.colorAxisTitle=n.detail.value,R(r.onChartEdit())}),b(),C(18,"nile-slide-toggle",51),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.showDataLabels=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("value",t.chartState.colorMin),L(),Ue("value",t.chartState.colorMax),L(4),aM("background",t.chartState.minColor||"#FFFFFF"),L(3),xe(t.openColorPicker==="minColor"?9:-1),L(4),aM("background",t.chartState.maxColor||"#005EA6"),L(3),xe(t.openColorPicker==="maxColor"?16:-1),L(),Ue("value",t.chartState.colorAxisTitle),L(),Ue("isChecked",t.chartState.showDataLabels)}}function V9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-slide-toggle",65),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.datetimeAxis=n.detail.checked,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("isChecked",t.chartState.datetimeAxis)}}function B9t(i,e){if(i&1){let t=Le();C(0,"div",4)(1,"nile-input",87),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.columnAxisTitle=n.detail.value,R(r.onChartEdit())}),b(),C(2,"nile-input",88),Ae("nile-change",function(n){P(t);let r=p(4);return r.chartState.lineAxisTitle=n.detail.value,R(r.onChartEdit())}),b()()}if(i&2){let t=p(4);L(),Ue("value",t.chartState.columnAxisTitle),L(),Ue("value",t.chartState.lineAxisTitle)}}function F9t(i,e){if(i&1&&(C(0,"nile-nav-tab-panel",27)(1,"p",10),Y(2),pG(3,"titlecase"),b(),he(4,T9t,3,2,"div",4),he(5,A9t,2,1,"div",4),he(6,z9t,2,1,"div",4),he(7,h9t,7,2,"div",4),he(8,x9t,3,2,"div",4),he(9,L9t,10,5,"div",4),he(10,O9t,2,1,"div",4),he(11,f9t,16,7,"div",4),he(12,S9t,4,3,"div",4),he(13,w9t,4,3,"div",4),he(14,C9t,7,6,"div",4),he(15,Q9t,17,8,"div",4),he(16,U9t,2,1,"div",4),he(17,v9t,3,2,"div",4),he(18,Z9t,10,5,"div",4),he(19,_9t,2,1,"div",4),he(20,R9t,19,10,"div",4),he(21,V9t,2,1,"div",4),he(22,B9t,3,2,"div",4),b()),i&2){let t=p(3);L(2),yi(" Configure options specific to ",LG(3,20,t.chartType)," charts. "),L(2),xe(t.isDonut?4:-1),L(),xe(t.isAreaFamily?5:-1),L(),xe(t.isRadarFamily?6:-1),L(),xe(t.isStacked?7:-1),L(),xe(t.isCluster?8:-1),L(),xe(t.isHistogram?9:-1),L(),xe(t.isBoxplot?10:-1),L(),xe(t.isDumbbell?11:-1),L(),xe(t.isTimeline?12:-1),L(),xe(t.isGauge?13:-1),L(),xe(t.isGrid?14:-1),L(),xe(t.isBellcurve?15:-1),L(),xe(t.isAreaNegative?16:-1),L(),xe(t.isRadialBar?17:-1),L(),xe(t.isFan?18:-1),L(),xe(t.isOrganization?19:-1),L(),xe(t.isHeatmap?20:-1),L(),xe(t.isXrange?21:-1),L(),xe(t.isLineColumn?22:-1)}}function H9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.chartState.chartBg=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.chartBg||"#FFFFFF")}}function J9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.chartState.loadingColor=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.loadingColor||"var(--ng-colors-text-tertiary-600)")}}function G9t(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.chartState.loadingBg=n.detail.value,R(r.onChartEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.chartState.loadingBg||"#FFFFFF")}}function $9t(i,e){if(i&1&&(C(0,"li",91)(1,"span",92),Zt(2,"nile-skeleton-loader",93)(3,"nile-skeleton-loader",94),b()()),i&2){let t=e.$implicit;L(3),It("width",t)}}function X9t(i,e){i&1&&(Zt(0,"nile-skeleton-loader",89),C(1,"ul",90),ht(2,$9t,4,1,"li",91,Mr),b()),i&2&&(L(2),xt(Nd(0,s9t)))}function q9t(i,e){i&1&&(C(0,"p",10),Y(1,"No drilldown options available for this widget."),b())}function K9t(i,e){if(i&1){let t=Le();C(0,"li",91)(1,"label",92)(2,"input",97),Ae("change",function(n){let r=P(t).$implicit,o=p(5);return R(o.onDrilldownToggle(r.id,n.target.checked))}),b(),C(3,"span",98),Y(4),b()()()}if(i&2){let t=e.$implicit;L(2),Ue("checked",t.enabled),L(2),it(t.drillDownName)}}function eRt(i,e){if(i&1){let t=Le();C(0,"nile-input",95),Ae("nile-input",function(n){P(t);let r=p(4);return R(r.drilldownSearch.set(n.detail.value))}),b(),C(1,"ul",96),ht(2,K9t,5,2,"li",91,g9t),b()}if(i&2){let t=p(4);Ue("value",t.drilldownSearch()),L(2),xt(t.visibleDrilldownOptions())}}function tRt(i,e){if(i&1&&(C(0,"nile-nav-tab-panel",48)(1,"p",10),Y(2,"Pick the dimensions users can drill into from this widget."),b(),he(3,X9t,4,1)(4,q9t,2,0,"p",10)(5,eRt,4,1),b()),i&2){let t=p(3);L(3),xe(t.drilldownLoading()?3:t.drilldownOptions().length===0?4:5)}}function iRt(i,e){if(i&1){let t=Le();he(0,j9t,4,2,"nile-nav-tab-panel",25),he(1,y9t,4,1,"nile-nav-tab-panel",26),he(2,F9t,23,22,"nile-nav-tab-panel",27),C(3,"nile-nav-tab-panel",28)(4,"p",10),Y(5,"Customize the chart container's background, border, shadow, and padding."),b(),C(6,"div",4)(7,"div",29)(8,"span",30),Y(9,"Background"),b(),C(10,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("chartBg"))}),C(11,"span",32),Y(12,"Pick color"),b()(),he(13,H9t,1,5,"nile-color-picker",33),b(),C(14,"nile-input",34),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.chartBorder=n.detail.value,R(r.onChartEdit())}),b(),C(15,"nile-input",35),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.chartBorderRadius=n.detail.value,R(r.onChartEdit())}),b(),C(16,"nile-input",36),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.chartShadow=n.detail.value,R(r.onChartEdit())}),b(),C(17,"nile-input",37),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.chartPadding=n.detail.value,R(r.onChartEdit())}),b(),C(18,"nile-input",38),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.chartMinHeight=n.detail.value,R(r.onChartEdit())}),b()()(),C(19,"nile-nav-tab-panel",39)(20,"p",10),Y(21,"Customize the appearance of the loading overlay."),b(),C(22,"div",4)(23,"nile-slide-toggle",40),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.loading=n.detail.checked,R(r.onChartEdit())}),b(),C(24,"nile-input",41),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.loadingText=n.detail.value,R(r.onChartEdit())}),b(),C(25,"div",29)(26,"span",30),Y(27,"Text color"),b(),C(28,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("loadingColor"))}),C(29,"span",32),Y(30,"Pick color"),b()(),he(31,J9t,1,5,"nile-color-picker",33),b(),C(32,"div",29)(33,"span",30),Y(34,"Background"),b(),C(35,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("loadingBg"))}),C(36,"span",32),Y(37,"Pick color"),b()(),he(38,G9t,1,5,"nile-color-picker",33),b(),C(39,"nile-input",42),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.loadingFontSize=n.detail.value,R(r.onChartEdit())}),b(),C(40,"nile-input",43),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.loadingFontFamily=n.detail.value,R(r.onChartEdit())}),b()()(),C(41,"nile-nav-tab-panel",44)(42,"nile-slide-toggle",45),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.aiEnabled=n.detail.checked,R(r.onChartEdit())}),b(),C(43,"div",4)(44,"nile-input",46),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.aiPlaceholder=n.detail.value,R(r.onChartEdit())}),b(),C(45,"nile-input",47),Ae("nile-change",function(n){P(t);let r=p(2);return r.chartState.aiWelcomeMessage=n.detail.value,R(r.onChartEdit())}),b()()(),he(46,tRt,6,1,"nile-nav-tab-panel",48)}if(i&2){let t=p(2);xe(t.hasAxes?0:-1),L(),xe(t.isPieFamily?1:-1),L(),xe(t.hasSeriesSection?2:-1),L(8),aM("background",t.chartState.chartBg||"#FFFFFF"),L(3),xe(t.openColorPicker==="chartBg"?13:-1),L(),Ue("value",t.chartState.chartBorder),L(),Ue("value",t.chartState.chartBorderRadius),L(),Ue("value",t.chartState.chartShadow),L(),Ue("value",t.chartState.chartPadding),L(),Ue("value",t.chartState.chartMinHeight),L(5),Ue("isChecked",t.chartState.loading),L(),Ue("value",t.chartState.loadingText),L(4),aM("background",t.chartState.loadingColor||"var(--ng-colors-text-tertiary-600)"),L(3),xe(t.openColorPicker==="loadingColor"?31:-1),L(4),aM("background",t.chartState.loadingBg||"#FFFFFF"),L(3),xe(t.openColorPicker==="loadingBg"?38:-1),L(),Ue("value",t.chartState.loadingFontSize),L(),Ue("value",t.chartState.loadingFontFamily),L(2),Ue("isChecked",t.chartState.aiEnabled),L(2),Ue("value",t.chartState.aiPlaceholder),L(),Ue("value",t.chartState.aiWelcomeMessage),L(),xe(t.hasDrilldown?46:-1)}}function MRt(i,e){if(i&1){let t=Le();C(0,"p",10),Y(1," Define the value range that the gauge will represent. "),b(),C(2,"div",4)(3,"div",11)(4,"nile-input",151),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeMin=n.detail.value,R(r.onKpiEdit())}),b(),C(5,"nile-input",152),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeMax=n.detail.value,R(r.onKpiEdit())}),b()()()}if(i&2){let t=p(3);L(4),Ue("value",t.kpi.gaugeMin),L(),Ue("value",t.kpi.gaugeMax)}}function nRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.valueColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.valueColor||"var(--ng-colors-text-primary-900)")}}function rRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.labelColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.labelColor||"var(--ng-colors-text-tertiary-600)")}}function oRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.descriptionColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.descriptionColor||"var(--ng-colors-text-quaternary-500)")}}function aRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.prefixSuffixColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.prefixSuffixColor||"var(--ng-colors-text-quaternary-500)")}}function sRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.trendUpColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.trendUpColor||"var(--ng-componentcolors-utility-success-700)")}}function lRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.trendDownColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.trendDownColor||"var(--ng-colors-text-error-primary-hover)")}}function gRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.trendNeutralColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.trendNeutralColor||"var(--ng-colors-text-quaternary-500)")}}function NRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.sparklineColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.sparklineColor||t.brandSparklineColor())}}function uRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(4);return r.kpi.gaugeColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(4);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.gaugeColor||"#005EA6")}}function cRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(4);return r.kpi.gaugeTrackColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(4);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.gaugeTrackColor||"var(--ng-colors-border-secondary)")}}function DRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(4);return r.kpi.gaugeLabelColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(4);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.gaugeLabelColor||"var(--ng-colors-text-primary-900)")}}function IRt(i,e){if(i&1){let t=Le();C(0,"nile-nav-tab-panel",144)(1,"p",10),Y(2,"Customize the gauge ring appearance. The value range is configured in the Variant tab."),b(),C(3,"div",4)(4,"div",29)(5,"span",30),Y(6,"Color"),b(),C(7,"button",31),Ae("click",function(){P(t);let n=p(3);return R(n.toggleColorPicker("gaugeColor"))}),C(8,"span",32),Y(9,"Pick color"),b()(),he(10,uRt,1,5,"nile-color-picker",33),b(),C(11,"div",29)(12,"span",30),Y(13,"Track color"),b(),C(14,"button",31),Ae("click",function(){P(t);let n=p(3);return R(n.toggleColorPicker("gaugeTrackColor"))}),C(15,"span",32),Y(16,"Pick color"),b()(),he(17,cRt,1,5,"nile-color-picker",33),b(),C(18,"nile-input",153),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeHeight=n.detail.value,R(r.onKpiEdit())}),b(),C(19,"div",11)(20,"nile-input",154),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeStartAngle=n.detail.value,R(r.onKpiEdit())}),b(),C(21,"nile-input",155),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeEndAngle=n.detail.value,R(r.onKpiEdit())}),b()(),C(22,"div",11)(23,"nile-input",156),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeInnerRadius=n.detail.value,R(r.onKpiEdit())}),b(),C(24,"nile-input",157),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeOuterRadius=n.detail.value,R(r.onKpiEdit())}),b()(),C(25,"nile-slide-toggle",158),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeRounded=n.detail.checked,R(r.onKpiEdit())}),b(),C(26,"div",11)(27,"nile-input",159),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeLabelFontSize=n.detail.value,R(r.onKpiEdit())}),b(),C(28,"nile-input",160),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeLabelFontWeight=n.detail.value,R(r.onKpiEdit())}),b()(),C(29,"div",29)(30,"span",30),Y(31,"Label color"),b(),C(32,"button",31),Ae("click",function(){P(t);let n=p(3);return R(n.toggleColorPicker("gaugeLabelColor"))}),C(33,"span",32),Y(34,"Pick color"),b()(),he(35,DRt,1,5,"nile-color-picker",33),b(),C(36,"nile-input",161),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.gaugeLabelYOffset=n.detail.value,R(r.onKpiEdit())}),b()()()}if(i&2){let t=p(3);L(7),aM("background",t.kpi.gaugeColor||"#005EA6"),L(3),xe(t.openColorPicker==="gaugeColor"?10:-1),L(4),aM("background",t.kpi.gaugeTrackColor||"var(--ng-colors-border-secondary)"),L(3),xe(t.openColorPicker==="gaugeTrackColor"?17:-1),L(),Ue("value",t.kpi.gaugeHeight),L(2),Ue("value",t.kpi.gaugeStartAngle),L(),Ue("value",t.kpi.gaugeEndAngle),L(2),Ue("value",t.kpi.gaugeInnerRadius),L(),Ue("value",t.kpi.gaugeOuterRadius),L(),Ue("isChecked",t.kpi.gaugeRounded),L(2),Ue("value",t.kpi.gaugeLabelFontSize),L(),Ue("value",t.kpi.gaugeLabelFontWeight),L(4),aM("background",t.kpi.gaugeLabelColor||"var(--ng-colors-text-primary-900)"),L(3),xe(t.openColorPicker==="gaugeLabelColor"?35:-1),L(),Ue("value",t.kpi.gaugeLabelYOffset)}}function dRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.cardBackground=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.cardBackground||"#FFFFFF")}}function jRt(i,e){if(i&1){let t=Le();C(0,"nile-color-picker",63),Ae("nile-change",function(n){P(t);let r=p(3);return r.kpi.cardBorderColor=n.detail.value,R(r.onKpiEdit())}),b()}if(i&2){let t=p(3);Ue("showCanvas",!0)("showHue",!0)("showInputs",!0)("showActions",!1)("value",t.kpi.cardBorderColor||"var(--ng-colors-border-secondary)")}}function yRt(i,e){if(i&1){let t=Le();C(0,"nile-nav-tab-panel",99)(1,"div",4)(2,"nile-select",100),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.variant=n.target.value,R(r.onKpiEdit())}),C(3,"nile-option",101),Y(4,"Default"),b(),C(5,"nile-option",102),Y(6,"Card"),b(),C(7,"nile-option",103),Y(8,"Gauge"),b()()(),he(9,MRt,6,2),b(),C(10,"nile-nav-tab-panel",104)(11,"p",10),Y(12,"Customize the appearance of the primary KPI value."),b(),C(13,"div",4)(14,"nile-input",105),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.valueFontSize=n.detail.value,R(r.onKpiEdit())}),b(),C(15,"div",29)(16,"span",30),Y(17,"Color"),b(),C(18,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("valueColor"))}),C(19,"span",32),Y(20,"Pick color"),b()(),he(21,nRt,1,5,"nile-color-picker",33),b()()(),C(22,"nile-nav-tab-panel",106)(23,"p",10),Y(24,"Configure how the value is formatted for display."),b(),C(25,"div",4)(26,"nile-select",107),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.valueFormat=n.target.value,R(r.onKpiEdit())}),C(27,"nile-option",108),Y(28,"Auto"),b(),C(29,"nile-option",109),Y(30,"None"),b(),C(31,"nile-option",110),Y(32,"Thousands (K)"),b(),C(33,"nile-option",111),Y(34,"Millions (M)"),b(),C(35,"nile-option",112),Y(36,"Billions (B)"),b(),C(37,"nile-option",113),Y(38,"Trillions (T)"),b()(),C(39,"nile-input",114),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.precision=n.detail.value,R(r.onKpiEdit())}),b(),C(40,"nile-input",115),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.unit=n.detail.value,R(r.onKpiEdit())}),b(),C(41,"nile-input",116),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.locale=n.detail.value,R(r.onKpiEdit())}),b(),C(42,"nile-select",117),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.numberSystem=n.target.value,R(r.onKpiEdit())}),C(43,"nile-option",118),Y(44,"International"),b(),C(45,"nile-option",119),Y(46,"Indian"),b()()()(),C(47,"nile-nav-tab-panel",120)(48,"p",10),Y(49,"Customize the appearance of the label displayed above the value."),b(),C(50,"div",4)(51,"div",29)(52,"span",30),Y(53,"Color"),b(),C(54,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("labelColor"))}),C(55,"span",32),Y(56,"Pick color"),b()(),he(57,rRt,1,5,"nile-color-picker",33),b(),C(58,"nile-input",42),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.labelFontSize=n.detail.value,R(r.onKpiEdit())}),b(),C(59,"nile-input",121),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.labelFontWeight=n.detail.value,R(r.onKpiEdit())}),b()()(),C(60,"nile-nav-tab-panel",122)(61,"p",10),Y(62,"Customize the supporting text displayed below the value."),b(),C(63,"div",4)(64,"div",29)(65,"span",30),Y(66,"Color"),b(),C(67,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("descriptionColor"))}),C(68,"span",32),Y(69,"Pick color"),b()(),he(70,oRt,1,5,"nile-color-picker",33),b(),C(71,"nile-input",123),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.descriptionFontSize=n.detail.value,R(r.onKpiEdit())}),b()()(),C(72,"nile-nav-tab-panel",124)(73,"p",10),Y(74,' Configure text displayed before or after the value (e.g. "$", "%"). '),b(),C(75,"div",4)(76,"nile-slide-toggle",125),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.showPrefix=n.detail.checked,R(r.onKpiEdit())}),b(),C(77,"nile-slide-toggle",126),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.showSuffix=n.detail.checked,R(r.onKpiEdit())}),b()(),C(78,"div",4)(79,"div",29)(80,"span",30),Y(81,"Color"),b(),C(82,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("prefixSuffixColor"))}),C(83,"span",32),Y(84,"Pick color"),b()(),he(85,aRt,1,5,"nile-color-picker",33),b(),C(86,"nile-input",127),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.prefixSuffixFontSize=n.detail.value,R(r.onKpiEdit())}),b()()(),C(87,"nile-nav-tab-panel",128)(88,"nile-slide-toggle",129),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.showTrend=n.detail.checked,R(r.onKpiEdit())}),b(),C(89,"p",10),Y(90," Configure the trend indicator and percentage change. "),b(),C(91,"div",4)(92,"nile-select",130),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.trendDirection=n.target.value,R(r.onKpiEdit())}),C(93,"nile-option",131),Y(94,"Up"),b(),C(95,"nile-option",132),Y(96,"Down"),b(),C(97,"nile-option",133),Y(98,"Neutral"),b()(),C(99,"nile-input",134),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.trendLabel=n.detail.value,R(r.onKpiEdit())}),b()(),C(100,"div",4)(101,"div",29)(102,"span",30),Y(103,"Up color"),b(),C(104,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("trendUpColor"))}),C(105,"span",32),Y(106,"Pick color"),b()(),he(107,sRt,1,5,"nile-color-picker",33),b(),C(108,"div",29)(109,"span",30),Y(110,"Down color"),b(),C(111,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("trendDownColor"))}),C(112,"span",32),Y(113,"Pick color"),b()(),he(114,lRt,1,5,"nile-color-picker",33),b(),C(115,"div",29)(116,"span",30),Y(117,"Neutral color"),b(),C(118,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("trendNeutralColor"))}),C(119,"span",32),Y(120,"Pick color"),b()(),he(121,gRt,1,5,"nile-color-picker",33),b()()(),C(122,"nile-nav-tab-panel",135)(123,"nile-slide-toggle",136),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.showSparkline=n.detail.checked,R(r.onKpiEdit())}),b(),C(124,"p",10),Y(125," Configure the compact trend chart displayed below the value. "),b(),C(126,"div",4)(127,"nile-select",137),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.sparklineType=n.target.value,R(r.onKpiEdit())}),C(128,"nile-option",138),Y(129,"Area"),b(),C(130,"nile-option",139),Y(131,"Line"),b()(),C(132,"div",29)(133,"span",30),Y(134,"Color"),b(),C(135,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("sparklineColor"))}),C(136,"span",32),Y(137,"Pick color"),b()(),he(138,NRt,1,5,"nile-color-picker",33),b(),C(139,"nile-input",140),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.sparklineHeight=n.detail.value,R(r.onKpiEdit())}),b(),C(140,"nile-input",141),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.sparklineLineWidth=n.detail.value,R(r.onKpiEdit())}),b(),C(141,"nile-input",142),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.sparklineFillOpacity=n.detail.value,R(r.onKpiEdit())}),b(),C(142,"nile-slide-toggle",143),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.sparklineMarkers=n.detail.checked,R(r.onKpiEdit())}),b()()(),he(143,IRt,37,18,"nile-nav-tab-panel",144),C(144,"nile-nav-tab-panel",145)(145,"p",10),Y(146,"Customize the card's background, border, shadow, and padding."),b(),C(147,"div",4)(148,"div",29)(149,"span",30),Y(150,"Background"),b(),C(151,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("cardBackground"))}),C(152,"span",32),Y(153,"Pick color"),b()(),he(154,dRt,1,5,"nile-color-picker",33),b(),C(155,"div",29)(156,"span",30),Y(157,"Border color"),b(),C(158,"button",31),Ae("click",function(){P(t);let n=p(2);return R(n.toggleColorPicker("cardBorderColor"))}),C(159,"span",32),Y(160,"Pick color"),b()(),he(161,jRt,1,5,"nile-color-picker",33),b(),C(162,"nile-input",146),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.cardBorderWidth=n.detail.value,R(r.onKpiEdit())}),b(),C(163,"nile-input",35),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.cardBorderRadius=n.detail.value,R(r.onKpiEdit())}),b(),C(164,"nile-input",36),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.cardShadow=n.detail.value,R(r.onKpiEdit())}),b(),C(165,"nile-input",147),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.cardShadowHover=n.detail.value,R(r.onKpiEdit())}),b(),C(166,"div",11)(167,"nile-input",148),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.cardPaddingVertical=n.detail.value,R(r.onKpiEdit())}),b(),C(168,"nile-input",149),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.cardPaddingHorizontal=n.detail.value,R(r.onKpiEdit())}),b()(),C(169,"nile-input",150),Ae("nile-change",function(n){P(t);let r=p(2);return r.kpi.contentGap=n.detail.value,R(r.onKpiEdit())}),b()()()}if(i&2){let t=p(2);L(2),Ue("value",t.kpi.variant),L(7),xe(t.kpi.variant==="gauge"?9:-1),L(5),Ue("value",t.kpi.valueFontSize),L(4),aM("background",t.kpi.valueColor||"var(--ng-colors-text-primary-900)"),L(3),xe(t.openColorPicker==="valueColor"?21:-1),L(5),Ue("value",t.kpi.valueFormat),L(13),Ue("value",t.kpi.precision),L(),Ue("value",t.kpi.unit),L(),Ue("value",t.kpi.locale),L(),Ue("value",t.kpi.numberSystem),L(12),aM("background",t.kpi.labelColor||"var(--ng-colors-text-tertiary-600)"),L(3),xe(t.openColorPicker==="labelColor"?57:-1),L(),Ue("value",t.kpi.labelFontSize),L(),Ue("value",t.kpi.labelFontWeight),L(8),aM("background",t.kpi.descriptionColor||"var(--ng-colors-text-quaternary-500)"),L(3),xe(t.openColorPicker==="descriptionColor"?70:-1),L(),Ue("value",t.kpi.descriptionFontSize),L(5),Ue("isChecked",t.kpi.showPrefix),L(),Ue("isChecked",t.kpi.showSuffix),L(5),aM("background",t.kpi.prefixSuffixColor||"var(--ng-colors-text-quaternary-500)"),L(3),xe(t.openColorPicker==="prefixSuffixColor"?85:-1),L(),Ue("value",t.kpi.prefixSuffixFontSize),L(2),Ue("isChecked",t.kpi.showTrend),L(4),Ue("value",t.kpi.trendDirection),L(7),Ue("value",t.kpi.trendLabel),L(5),aM("background",t.kpi.trendUpColor||"var(--ng-componentcolors-utility-success-700)"),L(3),xe(t.openColorPicker==="trendUpColor"?107:-1),L(4),aM("background",t.kpi.trendDownColor||"var(--ng-colors-text-error-primary-hover)"),L(3),xe(t.openColorPicker==="trendDownColor"?114:-1),L(4),aM("background",t.kpi.trendNeutralColor||"var(--ng-colors-text-quaternary-500)"),L(3),xe(t.openColorPicker==="trendNeutralColor"?121:-1),L(2),Ue("isChecked",t.kpi.showSparkline),L(4),Ue("value",t.kpi.sparklineType),L(8),aM("background",t.kpi.sparklineColor||t.brandSparklineColor()),L(3),xe(t.openColorPicker==="sparklineColor"?138:-1),L(),Ue("value",t.kpi.sparklineHeight),L(),Ue("value",t.kpi.sparklineLineWidth),L(),Ue("value",t.kpi.sparklineFillOpacity),L(),Ue("isChecked",t.kpi.sparklineMarkers),L(),xe(t.kpi.variant==="gauge"?143:-1),L(8),aM("background",t.kpi.cardBackground||"#FFFFFF"),L(3),xe(t.openColorPicker==="cardBackground"?154:-1),L(4),aM("background",t.kpi.cardBorderColor||"var(--ng-colors-border-secondary)"),L(3),xe(t.openColorPicker==="cardBorderColor"?161:-1),L(),Ue("value",t.kpi.cardBorderWidth),L(),Ue("value",t.kpi.cardBorderRadius),L(),Ue("value",t.kpi.cardShadow),L(),Ue("value",t.kpi.cardShadowHover),L(2),Ue("value",t.kpi.cardPaddingVertical),L(),Ue("value",t.kpi.cardPaddingHorizontal),L(),Ue("value",t.kpi.contentGap)}}function TRt(i,e){if(i&1){let t=Le();C(0,"div",0)(1,"nile-nav-tab-group",1),ht(2,N9t,2,2,"nile-nav-tab",2,l9t),C(4,"nile-nav-tab-panel",3)(5,"div",4)(6,"div",5)(7,"div",6),Y(8,"Title"),b(),C(9,"nile-slide-toggle",7),Ae("nile-change",function(n){P(t);let r=p();return r.showTitle=n.detail.checked,R(r.onToggleTitle())}),b()(),he(10,u9t,1,1,"nile-input",8),b(),C(11,"div",4)(12,"div",5)(13,"div",6),Y(14,"Subtitle"),b(),C(15,"nile-slide-toggle",7),Ae("nile-change",function(n){P(t);let r=p();return r.showSubtitle=n.detail.checked,R(r.onToggleSubtitle())}),b()(),he(16,c9t,1,1,"nile-input",8),b(),he(17,D9t,6,3),he(18,d9t,11,3),b(),he(19,iRt,47,25),he(20,yRt,170,61),C(21,"nile-nav-tab-panel",9)(22,"p",10),Y(23,"Configure the widget's grid position and size. Click Save changes to apply."),b(),C(24,"div",4)(25,"div",11)(26,"nile-input",12),Ae("nile-change",function(n){P(t);let r=p();return R(r.onPosChange("x",n))}),b(),C(27,"nile-input",13),Ae("nile-change",function(n){P(t);let r=p();return R(r.onPosChange("y",n))}),b()(),C(28,"div",11)(29,"nile-input",14),Ae("nile-change",function(n){P(t);let r=p();return R(r.onPosChange("w",n))}),b(),C(30,"nile-input",15),Ae("nile-change",function(n){P(t);let r=p();return R(r.onPosChange("h",n))}),b()()()()(),C(31,"div",16)(32,"nile-button",17),Ae("click",function(){P(t);let n=p();return R(n.onDiscard())}),Y(33," Discard "),b(),C(34,"nile-button",18),Ae("click",function(){P(t);let n=p();return R(n.onSave())}),Y(35," Save changes "),b()()()}if(i&2){let t=p();L(2),xt(t.categories),L(7),Ue("isChecked",t.showTitle),L(),xe(t.showTitle?10:-1),L(5),Ue("isChecked",t.showSubtitle),L(),xe(t.showSubtitle?16:-1),L(),xe(t.isKpi?-1:17),L(),xe(t.isKpi?18:-1),L(),xe(t.isKpi?-1:19),L(),xe(t.isKpi?20:-1),L(6),Ue("value",t.posX),L(),Ue("value",t.posY),L(2),Ue("value",t.posW),L(),Ue("value",t.posH),L(2),It("disabled",t.isDirty?null:""),L(2),It("disabled",t.isDirty?null:"")}}var Nlt={variant:"default",tooltipEnabled:!0,sparklineMarkers:!1,gaugeRounded:!0,showSparkline:!0,showTrend:!0,showPrefix:!0,showSuffix:!0,loading:!1,loadingText:"",valueFontSize:"",valueColor:"",trendUpColor:"",trendDownColor:"",trendNeutralColor:"",sparklineColor:"",sparklineHeight:"",sparklineLineWidth:"",sparklineType:"area",sparklineFillOpacity:"",gaugeColor:"",gaugeTrackColor:"",gaugeHeight:"",gaugeStartAngle:"",gaugeEndAngle:"",gaugeInnerRadius:"",gaugeOuterRadius:"",gaugeLabelFontSize:"",gaugeLabelFontWeight:"",gaugeLabelColor:"",gaugeLabelYOffset:"",cardBackground:"",cardBorderColor:"",cardBorderWidth:"",cardBorderRadius:"",cardShadow:"",cardShadowHover:"",cardPaddingVertical:"",cardPaddingHorizontal:"",contentGap:"",labelColor:"",labelFontSize:"",labelFontWeight:"",descriptionColor:"",descriptionFontSize:"",prefixSuffixColor:"",prefixSuffixFontSize:"",trendDirection:"",trendLabel:"",gaugeValue:"",gaugeMin:"",gaugeMax:"",valueFormat:"",precision:"",unit:"",locale:"",numberSystem:""},ult={height:"",toggleLabel:"",showLegend:!0,chartBg:"",chartBorderRadius:"",chartBorder:"",chartShadow:"",chartPadding:"",chartMinHeight:"",loading:!1,loadingText:"",loadingColor:"",loadingFontSize:"",loadingFontFamily:"",loadingBg:"",aiEnabled:!1,aiPlaceholder:"",aiWelcomeMessage:"",xAxisTitle:"",yAxisTitle:"",showDataLabels:!1,innerSize:"",semiCircle:!1,stacked:!1,showArea:!1,stackMode:"",pointPadding:"",groupPadding:"",histogramColor:"",binsNumber:"",binWidth:"",horizontal:!1,lowMarkerColor:"",connectorColor:"",datetimeAxis:!1,inverted:!1,alternateLabels:!1,gaugeMin:"",gaugeMax:"",gaugeSuffix:"",gridStriped:!1,gridHoverable:!1,gridStickyHeader:!0,gridEmptyMessage:"",gridLoadingMessage:"",gridNoMatchMessage:"",bellcurveColor:"",bellcurveFill:"",intervals:"",pointsInInterval:"",threshold:"",paneSize:"",fanLineColor:"",forecastStartIndex:"",forecastBandLabel:"",colorMin:"",colorMax:"",minColor:"",maxColor:"",colorAxisTitle:"",columnAxisTitle:"",lineAxisTitle:""},ARt=new Set(["pie","donut","funnel","variablePie"]),zRt=new Set(["pie","donut","funnel","variablePie","gauge","radar","spiderweb","organization","flame","euler","heatmap","map"]),hRt=new Set(["area","areaSpline","invertedArea"]),a0=class i{widget=null;close=new Xt;updateWidget=new Xt;updateLayout=new Xt;applyDrilldown=new Xt;drilldownLoadingChange=new Xt;brandSparklineColor=ke(LA);hostEl=Fe(ir);themeUnwatch;ngAfterViewInit(){this.readBrandSparklineColor(),this.themeUnwatch=mA(()=>this.readBrandSparklineColor())}ngOnDestroy(){this.themeUnwatch?.()}readBrandSparklineColor(){this.brandSparklineColor.set(OA(this.hostEl.nativeElement))}titleValue="";subtitleValue="";showTitle=!0;showSubtitle=!0;titleStash="";subtitleStash="";chartType="";posX="";posY="";posW="";posH="";kpi=x({},Nlt);chartState=x({},ult);isDirty=!1;layoutDirty=!1;lastHydratedWidgetId=null;openColorPicker=null;drilldownOptions=ke([]);drilldownLoading=ke(!1);drilldownSearch=ke("");drilldownBaseline=ke([]);visibleDrilldownOptions=At(()=>{let e=this.drilldownSearch().trim().toLowerCase(),t=this.drilldownOptions();return e?t.filter(M=>M.drillDownName.toLowerCase().includes(e)||M.field.toLowerCase().includes(e)):t});drilldownDirty=At(()=>{let e=this.enabledIdsOf(this.drilldownOptions()),t=this.drilldownBaseline();return e.length!==t.length?!0:e.some((M,n)=>M!==t[n])});drilldownService=Fe(o0);toggleColorPicker(e){this.openColorPicker=this.openColorPicker===e?null:e}get hasDrilldown(){if(this.isKpi)return!1;if(this.widget?.drilldownBy&&this.widget.drilldownBy.length>0)return!0;let e=this.widget?.config?.chart?.data;return Array.isArray(e)?e.some(t=>t&&typeof t=="object"&&!!t.drilldown):!1}get isKpi(){return this.widget?.widgetType==="kpi"||this.chartType==="kpi"}get isDonut(){return this.chartType==="donut"}get isPieFamily(){return ARt.has(this.chartType)}get hasAxes(){return!zRt.has(this.chartType)}get isAreaFamily(){return hRt.has(this.chartType)}get isRadarFamily(){return this.chartType==="radar"||this.chartType==="spiderweb"}get isStacked(){return this.chartType==="stacked"}get isCluster(){return this.chartType==="cluster"}get isHistogram(){return this.chartType==="histogram"}get isBoxplot(){return this.chartType==="boxplot"}get isTimeline(){return this.chartType==="timeline"}get isDumbbell(){return this.chartType==="dumbbell"||this.chartType==="dumbbellLower"||this.chartType==="dumbbellUpper"}get isGauge(){return this.chartType==="gauge"}get isGrid(){return this.chartType==="grid"}get isBellcurve(){return this.chartType==="bellcurve"}get isAreaNegative(){return this.chartType==="areaNegative"}get isRadialBar(){return this.chartType==="radialBar"}get isFan(){return this.chartType==="fan"}get isOrganization(){return this.chartType==="organization"}get isHeatmap(){return this.chartType==="heatmap"}get isXrange(){return this.chartType==="xrange"}get isLineColumn(){return this.chartType==="line-column"}get isFunnel(){return this.chartType==="funnel"}get hasSeriesSection(){return this.isDonut||this.isAreaFamily||this.isRadarFamily||this.isStacked||this.isCluster||this.isHistogram||this.isBoxplot||this.isTimeline||this.isDumbbell||this.isGauge||this.isGrid||this.isBellcurve||this.isAreaNegative||this.isRadialBar||this.isFan||this.isOrganization||this.isHeatmap||this.isXrange||this.isLineColumn}get categories(){if(this.isKpi){let t=[{key:"general",label:"General"},{key:"variant",label:"Variant"},{key:"value",label:"Value"},{key:"formatting",label:"Formatting"},{key:"label",label:"Label"},{key:"description",label:"Description"},{key:"prefixSuffix",label:"Prefix & Suffix"},{key:"trend",label:"Trend"},{key:"sparkline",label:"Sparkline"},{key:"gauge",label:"Gauge"},{key:"cardChrome",label:"Card Chrome"},{key:"layout",label:"Layout"}];return this.kpi.variant==="gauge"?t:t.filter(M=>M.key!=="gauge")}let e=[{key:"general",label:"General"}];return this.hasAxes&&e.push({key:"axes",label:"Axes"}),this.isPieFamily&&e.push({key:"dataLabels",label:"Data Labels"}),this.hasSeriesSection&&e.push({key:"series",label:"Series"}),this.hasDrilldown&&e.push({key:"drilldown",label:"Drilldown"}),e.push({key:"appearance",label:"Container Styling"},{key:"loading",label:"Loading"},{key:"aiPanel",label:"Ask Panel"},{key:"layout",label:"Layout"}),e}ngOnChanges(e){let t=e.widget;t&&(t.previousValue==null&&this.widget&&(this.lastHydratedWidgetId=null),this.widget&&this.hydrateFromWidget(this.widget))}hydrateFromWidget(e){let t=this.lastHydratedWidgetId===e.id;this.lastHydratedWidgetId=e.id;let M=e.layout??{x:0,y:0,w:6,h:4};if(this.posX=String(M.x),this.posY=String(M.y),this.posW=String(M.w),this.posH=String(M.h),t)return;let n=e.config?.aq??{},r=n.chartTitle??e.title??"",o=n.chartSubtitle??"",a=n._chartTitle??"",s=n._chartSubtitle??"";this.showTitle=!(r===""&&a!==""),this.showSubtitle=!(o===""&&s!==""),this.titleValue=this.showTitle?r:"",this.subtitleValue=this.showSubtitle?o:"",this.titleStash=a,this.subtitleStash=s,this.chartType=e.config?.chart?.type??"",this.isDirty=!1,e.widgetType==="kpi"||this.chartType==="kpi"?(this.kpi=this.readKpi(e.config?.chart??{}),this.chartState=x({},ult)):(this.chartState=this.readChart(e.config?.chart??{},n),this.kpi=x({},Nlt)),this.drilldownOptions.set([]),this.drilldownSearch.set(""),this.hasDrilldown&&this.loadDrilldownOptions(e.id)}async loadDrilldownOptions(e){this.drilldownLoading.set(!0);try{let t=await this.drilldownService.listDrilldown(e);this.lastHydratedWidgetId===e&&(this.drilldownOptions.set(t),this.drilldownBaseline.set(this.enabledIdsOf(t)))}catch{this.lastHydratedWidgetId===e&&(this.drilldownOptions.set([]),this.drilldownBaseline.set([]))}finally{this.lastHydratedWidgetId===e&&this.drilldownLoading.set(!1)}}enabledIdsOf(e){return e.filter(t=>t.enabled).map(t=>t.id).sort()}readKpi(e){let t=N=>N==null?"":String(N),M=N=>N!==!1,n=N=>N===!0,r=(N,c,D)=>{let I=t(N);return D.includes(I)?I:c},o=e.sparkline,a=e.trendValue,s=e.prefix,l=e.suffix;return{variant:r(e.variant,"default",["default","card","gauge"]),tooltipEnabled:M(e.tooltipEnabled),sparklineMarkers:n(e.sparklineMarkers),gaugeRounded:M(e.gaugeRounded),showSparkline:Array.isArray(o)?o.length>0:!0,showTrend:a!==null,showPrefix:s!=="",showSuffix:l!=="",loading:n(e.loading),loadingText:t(e.loadingText),valueFontSize:t(e.valueFontSize),valueColor:t(e.valueColor),trendUpColor:t(e.trendUpColor),trendDownColor:t(e.trendDownColor),trendNeutralColor:t(e.trendNeutralColor),sparklineColor:t(e.sparklineColor),sparklineHeight:t(e.sparklineHeight),sparklineLineWidth:t(e.sparklineLineWidth),sparklineType:r(e.sparklineType,"area",["area","line"]),sparklineFillOpacity:t(e.sparklineFillOpacity),gaugeColor:t(e.gaugeColor),gaugeTrackColor:t(e.gaugeTrackColor),gaugeHeight:t(e.gaugeHeight),gaugeStartAngle:t(e.gaugeStartAngle),gaugeEndAngle:t(e.gaugeEndAngle),gaugeInnerRadius:t(e.gaugeInnerRadius),gaugeOuterRadius:t(e.gaugeOuterRadius),gaugeLabelFontSize:t(e.gaugeLabelFontSize),gaugeLabelFontWeight:t(e.gaugeLabelFontWeight),gaugeLabelColor:t(e.gaugeLabelColor),gaugeLabelYOffset:t(e.gaugeLabelYOffset),cardBackground:t(e.cardBackground),cardBorderColor:t(e.cardBorderColor),cardBorderWidth:t(e.cardBorderWidth),cardBorderRadius:t(e.cardBorderRadius),cardShadow:t(e.cardShadow),cardShadowHover:t(e.cardShadowHover),cardPaddingVertical:t(e.cardPaddingVertical),cardPaddingHorizontal:t(e.cardPaddingHorizontal),contentGap:t(e.contentGap),labelColor:t(e.labelColor),labelFontSize:t(e.labelFontSize),labelFontWeight:t(e.labelFontWeight),descriptionColor:t(e.descriptionColor),descriptionFontSize:t(e.descriptionFontSize),prefixSuffixColor:t(e.prefixSuffixColor),prefixSuffixFontSize:t(e.prefixSuffixFontSize),trendDirection:r(e.trendDirection,"",["","up","down","neutral"]),trendLabel:t(e.trendLabel),gaugeValue:t(e.gaugeValue),gaugeMin:t(e.gaugeMin),gaugeMax:t(e.gaugeMax),valueFormat:r(e.valueFormat,"",["","auto","none","K","M","B","T"]),precision:t(e.precision),unit:t(e.unit),locale:t(e.locale),numberSystem:r(e.numberSystem,"",["","indian","international"])}}readChart(e,t){let M=I=>I==null?"":String(I),n=(I,d)=>typeof I=="boolean"?I:d,r=I=>I!==!1,o=I=>I===!0,a=(I,d,y)=>{let A=M(I);return y.includes(A)?A:d},s=String(e.type??""),l=new Set(["timeline","dumbbell","dumbbellLower","dumbbellUpper","fan","flame","funnel","columnDrilldown"]),N=t.ai,c=e.ai,D=N??c??{};return{height:M(e.height),toggleLabel:M(t.toggleLabel),showLegend:l.has(s)?o(e.showLegend):r(e.showLegend),chartBg:M(e.chartBg),chartBorderRadius:M(e.chartBorderRadius),chartBorder:M(e.chartBorder),chartShadow:M(e.chartShadow),chartPadding:M(e.chartPadding),chartMinHeight:M(e.chartMinHeight),loading:o(e.loading),loadingText:M(e.loadingText),loadingColor:M(e.loadingColor),loadingFontSize:M(e.loadingFontSize),loadingFontFamily:M(e.loadingFontFamily),loadingBg:M(e.loadingBg),aiEnabled:o(D.enabled),aiPlaceholder:M(D.placeholder),aiWelcomeMessage:M(D.welcomeMessage),xAxisTitle:M(e.xAxisTitle),yAxisTitle:M(e.yAxisTitle),showDataLabels:r(e.showDataLabels),innerSize:M(e.innerSize),semiCircle:o(e.semiCircle),stacked:o(e.stacked),showArea:o(e.showArea),stackMode:a(e.stackMode,"",["","normal","percent"]),pointPadding:M(e.pointPadding),groupPadding:M(e.groupPadding),histogramColor:M(e.histogramColor),binsNumber:M(e.binsNumber),binWidth:M(e.binWidth),horizontal:o(e.horizontal),lowMarkerColor:M(e.lowMarkerColor),connectorColor:M(e.connectorColor),datetimeAxis:r(e.datetimeAxis),inverted:s==="organization"?r(e.inverted):o(e.inverted),alternateLabels:r(e.alternateLabels),gaugeMin:M(e.min),gaugeMax:M(e.max),gaugeSuffix:M(e.suffix),gridStriped:n(e.striped,!1),gridHoverable:n(e.hoverable,!1),gridStickyHeader:n(e.stickyHeader,!0),gridEmptyMessage:M(e.emptyMessage),gridLoadingMessage:M(e.loadingMessage),gridNoMatchMessage:M(e.noMatchMessage),bellcurveColor:M(e.bellcurveColor),bellcurveFill:M(e.bellcurveFill),intervals:M(e.intervals),pointsInInterval:M(e.pointsInInterval),threshold:M(e.threshold),paneSize:M(e.paneSize),fanLineColor:M(e.lineColor),forecastStartIndex:M(e.forecastStartIndex),forecastBandLabel:M(e.forecastBandLabel),colorMin:M(e.colorMin),colorMax:M(e.colorMax),minColor:M(e.minColor),maxColor:M(e.maxColor),colorAxisTitle:M(e.colorAxisTitle),columnAxisTitle:M(e.columnAxisTitle),lineAxisTitle:M(e.lineAxisTitle)}}applyKpiVisibility(e,t,M,n,r){let o=`_${t}`;if(M){let a=e[t];if(n(a))delete e[o];else{let s=e[o];n(s)&&(e[t]=s),delete e[o]}}else{let a=e[t];n(a)&&(e[o]=a),e[t]=r}}writeKpiAppearance(){let e=x({},this.widget?.config.chart??{});e.type="kpi";let t=this.kpi,M=(a,s)=>{s?e[a]=s:delete e[a]},n=(a,s)=>{if(s===""){delete e[a];return}let l=Number(s);Number.isNaN(l)?delete e[a]:e[a]=l},r=(a,s)=>{e[a]=s},o=(a,s,l)=>{s&&s!==l?e[a]=s:delete e[a]};if(o("variant",t.variant,"default"),r("tooltipEnabled",t.tooltipEnabled),r("sparklineMarkers",t.sparklineMarkers),r("loading",t.loading),this.applyKpiVisibility(e,"sparkline",t.showSparkline,a=>Array.isArray(a)&&a.length>0,[]),this.applyKpiVisibility(e,"trendValue",t.showTrend,a=>typeof a=="number",null),this.applyKpiVisibility(e,"prefix",t.showPrefix,a=>typeof a=="string"&&a!=="",""),this.applyKpiVisibility(e,"suffix",t.showSuffix,a=>typeof a=="string"&&a!=="",""),M("loadingText",t.loadingText),M("valueFontSize",t.valueFontSize),M("valueColor",t.valueColor),M("trendUpColor",t.trendUpColor),M("trendDownColor",t.trendDownColor),M("trendNeutralColor",t.trendNeutralColor),M("sparklineColor",t.sparklineColor),n("sparklineHeight",t.sparklineHeight),n("sparklineLineWidth",t.sparklineLineWidth),o("sparklineType",t.sparklineType,"area"),n("sparklineFillOpacity",t.sparklineFillOpacity),o("trendDirection",t.trendDirection,""),M("trendLabel",t.trendLabel),t.variant==="gauge"){M("gaugeColor",t.gaugeColor),M("gaugeTrackColor",t.gaugeTrackColor),n("gaugeHeight",t.gaugeHeight),n("gaugeStartAngle",t.gaugeStartAngle),n("gaugeEndAngle",t.gaugeEndAngle),M("gaugeInnerRadius",t.gaugeInnerRadius),M("gaugeOuterRadius",t.gaugeOuterRadius),r("gaugeRounded",t.gaugeRounded),n("gaugeLabelFontSize",t.gaugeLabelFontSize),n("gaugeLabelFontWeight",t.gaugeLabelFontWeight),M("gaugeLabelColor",t.gaugeLabelColor),n("gaugeLabelYOffset",t.gaugeLabelYOffset),n("gaugeMin",t.gaugeMin),n("gaugeMax",t.gaugeMax);let a=e.value,s=typeof a=="number"?a:parseFloat(String(a));typeof a<"u"&&a!==""&&!Number.isNaN(s)&&(e.gaugeValue=s)}if(M("cardBackground",t.cardBackground),M("cardBorderColor",t.cardBorderColor),M("cardBorderWidth",t.cardBorderWidth),M("cardBorderRadius",t.cardBorderRadius),M("cardShadow",t.cardShadow),M("cardShadowHover",t.cardShadowHover),M("cardPaddingVertical",t.cardPaddingVertical),M("cardPaddingHorizontal",t.cardPaddingHorizontal),M("contentGap",t.contentGap),M("labelColor",t.labelColor),M("labelFontSize",t.labelFontSize),M("labelFontWeight",t.labelFontWeight),M("descriptionColor",t.descriptionColor),M("descriptionFontSize",t.descriptionFontSize),M("prefixSuffixColor",t.prefixSuffixColor),M("prefixSuffixFontSize",t.prefixSuffixFontSize),o("valueFormat",t.valueFormat,""),t.precision==="")delete e.precision;else{let a=Number(t.precision);Number.isNaN(a)?delete e.precision:e.precision=a}return M("unit",t.unit),M("locale",t.locale),o("numberSystem",t.numberSystem,""),e}writeChartAppearance(){let e=x({},this.widget?.config.chart??{}),t=this.chartState,M=(N,c)=>{c?e[N]=c:delete e[N]},n=(N,c)=>{if(c===""){delete e[N];return}let D=Number(c);Number.isNaN(D)?delete e[N]:e[N]=D},r=(N,c)=>{e[N]=c},o=(N,c,D)=>{D?e[N]=c:delete e[N]};M("height",t.height),delete e.toggleLabel,delete e.ai,r("showLegend",t.showLegend),M("chartBg",t.chartBg),M("chartBorderRadius",t.chartBorderRadius),M("chartBorder",t.chartBorder),M("chartShadow",t.chartShadow),M("chartPadding",t.chartPadding),M("chartMinHeight",t.chartMinHeight);let a=x({},e.options??{}),s=x({},a.chart??{});t.chartBg?s.backgroundColor=t.chartBg:delete s.backgroundColor,a.chart=s,e.options=a,r("loading",t.loading),M("loadingText",t.loadingText),M("loadingColor",t.loadingColor),M("loadingFontSize",t.loadingFontSize),M("loadingFontFamily",t.loadingFontFamily),M("loadingBg",t.loadingBg),this.hasAxes?(M("xAxisTitle",t.xAxisTitle),M("yAxisTitle",t.yAxisTitle)):(delete e.xAxisTitle,delete e.yAxisTitle);let l=N=>{for(let c of N)delete e[c]};return this.isPieFamily||this.isHeatmap?r("showDataLabels",t.showDataLabels):delete e.showDataLabels,this.isDonut?(M("innerSize",t.innerSize),r("semiCircle",t.semiCircle)):this.isRadialBar?(M("innerSize",t.innerSize),M("paneSize",t.paneSize),delete e.semiCircle):l(["innerSize","semiCircle","paneSize"]),this.isAreaFamily?o("stacked",t.stacked,t.stacked):delete e.stacked,this.isAreaNegative?n("threshold",t.threshold):delete e.threshold,this.isRadarFamily?o("showArea",t.showArea,t.showArea):delete e.showArea,this.isStacked?(t.stackMode?e.stackMode=t.stackMode:delete e.stackMode,n("pointPadding",t.pointPadding)):this.isCluster?(n("groupPadding",t.groupPadding),n("pointPadding",t.pointPadding),delete e.stackMode):l(["stackMode","groupPadding","pointPadding"]),this.isHistogram?(M("histogramColor",t.histogramColor),M("binsNumber",t.binsNumber),n("binWidth",t.binWidth)):l(["histogramColor","binsNumber","binWidth"]),this.isBoxplot||this.isDumbbell?o("horizontal",t.horizontal,t.horizontal):delete e.horizontal,this.isDumbbell?(M("lowMarkerColor",t.lowMarkerColor),M("connectorColor",t.connectorColor)):l(["lowMarkerColor","connectorColor"]),this.isTimeline||this.isXrange?o("datetimeAxis",t.datetimeAxis,t.datetimeAxis):delete e.datetimeAxis,this.isTimeline||this.isOrganization?o("inverted",t.inverted,t.inverted):delete e.inverted,this.isTimeline?o("alternateLabels",t.alternateLabels,t.alternateLabels):delete e.alternateLabels,this.isGauge?(n("min",t.gaugeMin),n("max",t.gaugeMax),M("suffix",t.gaugeSuffix)):l(["min","max","suffix"]),this.isGrid?(r("striped",t.gridStriped),r("hoverable",t.gridHoverable),r("stickyHeader",t.gridStickyHeader),M("emptyMessage",t.gridEmptyMessage),M("loadingMessage",t.gridLoadingMessage),M("noMatchMessage",t.gridNoMatchMessage)):l(["striped","hoverable","stickyHeader","emptyMessage","loadingMessage","noMatchMessage"]),this.isBellcurve?(M("bellcurveColor",t.bellcurveColor),M("bellcurveFill",t.bellcurveFill),n("intervals",t.intervals),n("pointsInInterval",t.pointsInInterval)):l(["bellcurveColor","bellcurveFill","intervals","pointsInInterval"]),this.isFan?(M("lineColor",t.fanLineColor),n("forecastStartIndex",t.forecastStartIndex),M("forecastBandLabel",t.forecastBandLabel)):l(["lineColor","forecastStartIndex","forecastBandLabel"]),this.isHeatmap?(n("colorMin",t.colorMin),n("colorMax",t.colorMax),M("minColor",t.minColor),M("maxColor",t.maxColor),M("colorAxisTitle",t.colorAxisTitle)):l(["colorMin","colorMax","minColor","maxColor","colorAxisTitle"]),this.isLineColumn?(M("columnAxisTitle",t.columnAxisTitle),M("lineAxisTitle",t.lineAxisTitle)):l(["columnAxisTitle","lineAxisTitle"]),e}writeAq(){let e=this.widget?.config.aq??{},t=x({},e);if(this.applyAqVisibility(t,"chartTitle","_chartTitle",this.showTitle,this.titleValue,this.titleStash),this.applyAqVisibility(t,"chartSubtitle","_chartSubtitle",this.showSubtitle,this.subtitleValue,this.subtitleStash),!this.isKpi){let M=this.chartState;if(M.toggleLabel?t.toggleLabel=M.toggleLabel:delete t.toggleLabel,M.aiEnabled||M.aiPlaceholder||M.aiWelcomeMessage){let n={enabled:M.aiEnabled};M.aiPlaceholder&&(n.placeholder=M.aiPlaceholder),M.aiWelcomeMessage&&(n.welcomeMessage=M.aiWelcomeMessage),t.ai=n}else delete t.ai}return t}applyAqVisibility(e,t,M,n,r,o){n?(r?e[t]=r:delete e[t],delete e[M]):(e[t]="",o?e[M]=o:delete e[M])}onTitleChange(e){this.titleValue=e.detail?.value??"",this.isDirty=!0}onSubtitleChange(e){this.subtitleValue=e.detail?.value??"",this.isDirty=!0}onToggleTitle(){this.showTitle?(this.titleValue=this.titleStash,this.titleStash=""):(this.titleStash=this.titleValue,this.titleValue=""),this.isDirty=!0}onToggleSubtitle(){this.showSubtitle?(this.subtitleValue=this.subtitleStash,this.subtitleStash=""):(this.subtitleStash=this.subtitleValue,this.subtitleValue=""),this.isDirty=!0}onKpiEdit(){this.isDirty=!0}onChartEdit(){this.isDirty=!0}onDrilldownToggle(e,t){this.drilldownOptions.update(M=>M.map(n=>n.id===e?U(x({},n),{enabled:t}):n)),this.isDirty=!0}resetKpiColor(e){this.kpi[e]="",this.isDirty=!0}resetChartColor(e){this.chartState[e]="",this.isDirty=!0}onSave(){if(!this.widget)return;let t={chart:this.isKpi?this.writeKpiAppearance():this.writeChartAppearance(),aq:this.writeAq()};this.updateWidget.emit({id:this.widget.id,config:t,title:this.titleValue}),this.layoutDirty&&(this.updateLayout.emit({id:this.widget.id,layout:{x:parseInt(this.posX,10)||0,y:parseInt(this.posY,10)||0,w:Math.max(1,parseInt(this.posW,10)||1),h:Math.max(1,parseInt(this.posH,10)||1)}}),this.layoutDirty=!1),this.drilldownDirty()&&this.saveDrilldownEnabled(this.widget.id),this.isDirty=!1}async saveDrilldownEnabled(e){this.drilldownLoadingChange.emit({id:e,loading:!0});try{let t=await this.drilldownService.applyDrilldown(e,this.enabledIdsOf(this.drilldownOptions()));if(this.lastHydratedWidgetId!==e)return;this.drilldownOptions.set(t.options),this.drilldownBaseline.set(this.enabledIdsOf(t.options)),this.applyDrilldown.emit({id:e,drilldownBy:t.drilldownBy})}catch{}finally{this.drilldownLoadingChange.emit({id:e,loading:!1})}}onDiscard(){this.widget&&(this.lastHydratedWidgetId=null,this.layoutDirty=!1,this.hydrateFromWidget(this.widget))}onPosChange(e,t){let M=t.detail?.value??"0",n=Math.max(0,parseInt(M,10)||0);switch(e){case"x":this.posX=String(n);break;case"y":this.posY=String(n);break;case"w":this.posW=String(Math.max(1,n));break;case"h":this.posH=String(Math.max(1,n));break}this.isDirty=!0,this.layoutDirty=!0}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["db-widget-settings"]],inputs:{widget:"widget"},outputs:{close:"close",updateWidget:"updateWidget",updateLayout:"updateLayout",applyDrilldown:"applyDrilldown",drilldownLoadingChange:"drilldownLoadingChange"},features:[Qo],decls:1,vars:1,consts:[[1,"settings-layout"],["placement","start","indicator-placement","left",1,"settings-tabs"],["slot","nav"],["name","general"],[1,"setting-group"],[1,"toggle-row"],[1,"toggle-row__label"],[3,"nile-change","isChecked"],[3,"value"],["name","layout"],[1,"category-help"],[1,"field-row"],["label","Column","type","number",3,"nile-change","value"],["label","Row","type","number",3,"nile-change","value"],["label","Width","type","number",3,"nile-change","value"],["label","Height","type","number",3,"nile-change","value"],[1,"save-bar"],["variant","tertiary","size","small",3,"click"],["variant","primary",3,"click"],[3,"nile-change","value"],["label","Height","placeholder","320px",3,"nile-change","value"],["label","Toggle label",3,"nile-change","value"],["label","Show legend",3,"nile-change","isChecked"],["placeholder","Loading...",3,"value"],["placeholder","Loading...",3,"nile-change","value"],["name","axes"],["name","dataLabels"],["name","series"],["name","appearance"],[1,"field"],[1,"field__label"],["type","button","aria-label","Pick color",1,"color-swatch",3,"click"],[1,"visually-hidden"],["mode","inline","type","picker",3,"showCanvas","showHue","showInputs","showActions","value"],["label","Border","placeholder","1px solid var(--ng-colors-border-secondary)",3,"nile-change","value"],["label","Border radius","placeholder","12px",3,"nile-change","value"],["label","Shadow","placeholder","0 1px 2px rgba(0,0,0,0.06)",3,"nile-change","value"],["label","Padding","placeholder","16px",3,"nile-change","value"],["label","Min height","placeholder","320px",3,"nile-change","value"],["name","loading"],["label","Loading state",3,"nile-change","isChecked"],["label","Loading text","placeholder","Loading...",3,"nile-change","value"],["label","Font size","placeholder","14px",3,"nile-change","value"],["label","Font family","placeholder","inherit",3,"nile-change","value"],["name","aiPanel"],["label","Enable ask panel",3,"nile-change","isChecked"],["label","Placeholder",3,"nile-change","value"],["label","Welcome message",3,"nile-change","value"],["name","drilldown"],["label","X-axis title",3,"nile-change","value"],["label","Y-axis title",3,"nile-change","value"],["label","Show data labels",3,"nile-change","isChecked"],["label","Inner size","placeholder","60%",3,"nile-change","value"],["label","Semi-circle",3,"nile-change","isChecked"],["label","Stacked",3,"nile-change","isChecked"],["label","Show area fill",3,"nile-change","isChecked"],["label","Stack mode",3,"nile-change","value"],["value","normal"],["value","percent"],["type","number","label","Point padding (0\u20130.5)","placeholder","0.1",3,"nile-change","value"],["type","number","label","Group padding (0\u20130.5)","placeholder","0.2",3,"nile-change","value"],["label","Number of bins","placeholder","(auto)",3,"nile-change","value"],["type","number","label","Bin width","placeholder","(auto)",3,"nile-change","value"],["mode","inline","type","picker",3,"nile-change","showCanvas","showHue","showInputs","showActions","value"],["label","Horizontal orientation",3,"nile-change","isChecked"],["label","Datetime axis",3,"nile-change","isChecked"],["label","Inverted",3,"nile-change","isChecked"],["label","Alternate labels",3,"nile-change","isChecked"],["type","number","label","Min",3,"nile-change","value"],["type","number","label","Max",3,"nile-change","value"],["label","Suffix","placeholder","%",3,"nile-change","value"],["label","Striped rows",3,"nile-change","isChecked"],["label","Hoverable",3,"nile-change","isChecked"],["label","Sticky header",3,"nile-change","isChecked"],["label","Empty message","placeholder","No data",3,"nile-change","value"],["label","Loading message","placeholder","Loading...",3,"nile-change","value"],["label","No match message","placeholder","No matching results",3,"nile-change","value"],["type","number","label","Intervals",3,"nile-change","value"],["type","number","label","Points in interval",3,"nile-change","value"],["type","number","label","Threshold",3,"nile-change","value"],["label","Inner size","placeholder","40%",3,"nile-change","value"],["label","Pane size","placeholder","100%",3,"nile-change","value"],["type","number","label","Forecast start index",3,"nile-change","value"],["label","Forecast band label",3,"nile-change","value"],["type","number","label","Color min",3,"nile-change","value"],["type","number","label","Color max",3,"nile-change","value"],["label","Color axis title",3,"nile-change","value"],["label","Column axis title",3,"nile-change","value"],["label","Line axis title",3,"nile-change","value"],["variant","rounded","height","38",1,"drilldown-skeleton__input"],[1,"drilldown-list","drilldown-list--loading"],[1,"drilldown-item"],[1,"drilldown-item__label"],["variant","rounded","width","16","height","16"],["variant","rounded","height","14"],["placeholder","Search drilldown",3,"nile-input","value"],[1,"drilldown-list"],["type","checkbox",1,"drilldown-item__checkbox",3,"change","checked"],[1,"drilldown-item__name"],["name","variant"],["label","Style",3,"nile-change","value"],["value","default"],["value","card"],["value","gauge"],["name","value"],["label","Font size","placeholder","(default)",3,"nile-change","value"],["name","formatting"],["label","Format",3,"nile-change","value"],["value","auto"],["value","none"],["value","K"],["value","M"],["value","B"],["value","T"],["type","number","label","Precision","placeholder","2",3,"nile-change","value"],["label","Unit","placeholder","USD",3,"nile-change","value"],["label","Locale","placeholder","en-US",3,"nile-change","value"],["label","Number system",3,"nile-change","value"],["value","international"],["value","indian"],["name","label"],["label","Font weight","placeholder","500",3,"nile-change","value"],["name","description"],["label","Font size","placeholder","12px",3,"nile-change","value"],["name","prefixSuffix"],["label","Show prefix",3,"nile-change","isChecked"],["label","Show suffix",3,"nile-change","isChecked"],["label","Font size","placeholder","16px",3,"nile-change","value"],["name","trend"],["label","Show trend",3,"nile-change","isChecked"],["label","Direction",3,"nile-change","value"],["value","up"],["value","down"],["value","neutral"],["label","Label","placeholder","vs last period",3,"nile-change","value"],["name","sparkline"],["label","Show sparkline",3,"nile-change","isChecked"],["label","Type",3,"nile-change","value"],["value","area"],["value","line"],["type","number","label","Height (px)","placeholder","48",3,"nile-change","value"],["type","number","label","Line width","placeholder","2",3,"nile-change","value"],["type","number","label","Fill opacity (0\u20131)","placeholder","0.2","step","0.1","min","0","max","1",3,"nile-change","value"],["label","Show markers",3,"nile-change","isChecked"],["name","gauge"],["name","cardChrome"],["label","Border width","placeholder","1px",3,"nile-change","value"],["label","Shadow (hover)","placeholder","0 4px 8px rgba(0,0,0,0.08)",3,"nile-change","value"],["label","Padding Y","placeholder","16px",3,"nile-change","value"],["label","Padding X","placeholder","20px",3,"nile-change","value"],["label","Content gap","placeholder","8px",3,"nile-change","value"],["type","number","label","Min","placeholder","0",3,"nile-change","value"],["type","number","label","Max","placeholder","100",3,"nile-change","value"],["type","number","label","Height (px)","placeholder","160",3,"nile-change","value"],["type","number","label","Start angle","placeholder","0",3,"nile-change","value"],["type","number","label","End angle","placeholder","360",3,"nile-change","value"],["label","Inner radius","placeholder","80%",3,"nile-change","value"],["label","Outer radius","placeholder","100%",3,"nile-change","value"],["label","Rounded caps",3,"nile-change","isChecked"],["type","number","label","Label font size","placeholder","28",3,"nile-change","value"],["type","number","label","Label font weight","placeholder","600",3,"nile-change","value"],["type","number","label","Label Y offset","placeholder","-25",3,"nile-change","value"]],template:function(t,M){t&1&&he(0,TRt,36,14,"div",0),t&2&&xe(M.widget?0:-1)},dependencies:[Go,wj,$5],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;height:100%;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.settings-layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--ng-colors-bg-primary)}.settings-tabs[_ngcontent-%COMP%]{flex:1;min-height:0;overflow:hidden;display:block;--white-space: nowrap;--word-break: normal;--overflow-wrap: normal}.settings-tabs[_ngcontent-%COMP%]::part(base){height:100%}.settings-tabs[_ngcontent-%COMP%]::part(nav){width:160px;height:100%;min-height:0}.settings-tabs[_ngcontent-%COMP%]::part(tabs){flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;border-inline-end:unset}.settings-tabs[_ngcontent-%COMP%] nile-nav-tab[_ngcontent-%COMP%]::part(base){overflow:hidden;text-overflow:ellipsis}.settings-tabs[_ngcontent-%COMP%]::part(body){height:94%;min-height:0;overflow-y:auto;padding:12px 17px}nile-nav-tab-panel[_ngcontent-%COMP%]::part(base){display:flex;flex-direction:column;padding:var(--padding);gap:12px}nile-nav-tab-panel[_ngcontent-%COMP%] > *[_ngcontent-%COMP%] + *[_ngcontent-%COMP%]{margin-top:14px}nile-nav-tab-panel[_ngcontent-%COMP%] nile-input[_ngcontent-%COMP%]::part(form-control-label), nile-nav-tab-panel[_ngcontent-%COMP%] nile-select[_ngcontent-%COMP%]::part(form-control-label), nile-nav-tab-panel[_ngcontent-%COMP%] nile-slide-toggle[_ngcontent-%COMP%]::part(form-control-label), nile-nav-tab-panel[_ngcontent-%COMP%] nile-input[_ngcontent-%COMP%]::part(label), nile-nav-tab-panel[_ngcontent-%COMP%] nile-select[_ngcontent-%COMP%]::part(label), nile-nav-tab-panel[_ngcontent-%COMP%] nile-slide-toggle[_ngcontent-%COMP%]::part(label){font-size:var(--ng-font-size-text-sm);font-weight:var(--ng-font-weight-medium);color:var(--ng-colors-text-secondary-700)}.category-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding-bottom:10px;border-bottom:1px solid var(--ng-colors-border-tertiary)}.category-title[_ngcontent-%COMP%]{margin:0;font-size:var(--ng-font-size-text-md);font-weight:var(--ng-font-weight-semibold);color:var(--ng-colors-text-primary-900);letter-spacing:-.01em}.category-help[_ngcontent-%COMP%]{margin:-4px 0 0;font-size:var(--ng-font-size-text-sm);color:var(--ng-colors-text-tertiary-600);line-height:1.5}.visibility-toggle[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px;padding:4px 10px 4px 8px;border:1px solid var(--ng-colors-border-primary);border-radius:999px;background:var(--ng-colors-bg-primary);font-size:var(--ng-font-size-text-sm);color:var(--ng-colors-text-secondary-700);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .12s ease,background .12s ease}.visibility-toggle[_ngcontent-%COMP%]:hover{border-color:var(--ng-colors-border-brand);background:#2970ff0a}.visibility-toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{margin:0;cursor:pointer}.setting-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.toggle-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px}.toggle-row__label[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm);font-weight:var(--ng-font-weight-medium);color:var(--ng-colors-text-secondary-700)}.setting-group--disabled[_ngcontent-%COMP%]{opacity:.4;pointer-events:none}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px}.field--row[_ngcontent-%COMP%]{flex-direction:row;align-items:center;gap:10px}.field-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px}.field-row[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{min-width:0}.field__label[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm);font-weight:var(--ng-font-weight-medium);color:var(--ng-colors-text-secondary-700);flex:1}input[type=checkbox][_ngcontent-%COMP%]{appearance:none;-webkit-appearance:none;position:relative;width:34px;height:20px;margin:0;flex-shrink:0;background:var(--ng-colors-border-primary);border:0;border-radius:999px;cursor:pointer;outline:none;transition:background .15s ease}input[type=checkbox][_ngcontent-%COMP%]:before{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;background:var(--ng-colors-bg-primary);border-radius:50%;box-shadow:0 1px 2px #0000002e;transition:transform .15s ease}input[type=checkbox][_ngcontent-%COMP%]:checked{background:var(--ng-colors-fg-brand-primary-600)}input[type=checkbox][_ngcontent-%COMP%]:checked:before{transform:translate(14px)}input[type=checkbox][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 3px #2970ff40}input[type=checkbox][_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.field--row[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{margin-right:4px}.field__input[_ngcontent-%COMP%]{width:100%;max-width:360px;padding:8px 12px;font-size:var(--ng-font-size-text-sm);border:1px solid var(--ng-colors-border-primary);border-radius:8px;background:var(--ng-colors-bg-primary);color:var(--ng-colors-text-primary-900);box-sizing:border-box;transition:border-color .12s ease,box-shadow .12s ease}.field__input[_ngcontent-%COMP%]:hover{border-color:var(--ng-colors-fg-quaternary-400)}select.field__input[_ngcontent-%COMP%]{appearance:auto;cursor:pointer}.field__input[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--ng-colors-border-brand);box-shadow:0 0 0 3px #2970ff2e}.field__color[_ngcontent-%COMP%]{width:28px;height:28px;padding:0;border:1px solid var(--ng-colors-border-primary);border-radius:6px;background:var(--ng-colors-bg-primary);cursor:pointer;flex-shrink:0;transition:border-color .12s ease,transform .1s ease}.field__color[_ngcontent-%COMP%]:hover{border-color:var(--ng-colors-border-brand);transform:scale(1.04)}.field__color[_ngcontent-%COMP%]::-webkit-color-swatch-wrapper{padding:2px}.field__color[_ngcontent-%COMP%]::-webkit-color-swatch{border:none;border-radius:4px}.color-swatch[_ngcontent-%COMP%]{width:28px;height:28px;padding:0;border:1px solid var(--ng-colors-border-primary);border-radius:6px;cursor:pointer;flex-shrink:0;transition:border-color .12s ease,transform .1s ease}.color-swatch[_ngcontent-%COMP%]:hover{border-color:var(--ng-colors-border-brand);transform:scale(1.04)}.visually-hidden[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.field__reset[_ngcontent-%COMP%]{padding:3px 10px;font-size:var(--ng-font-size-text-xs);background:transparent;border:1px solid var(--ng-colors-border-primary);border-radius:6px;color:var(--ng-colors-text-tertiary-600);cursor:pointer;flex-shrink:0;transition:background .12s ease,color .12s ease,border-color .12s ease}.field__reset[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary);color:var(--ng-colors-text-primary-900);border-color:var(--ng-colors-fg-quaternary-400)}nile-input[_ngcontent-%COMP%]{width:100%;max-width:26vw;display:block}.drilldown-list[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.drilldown-item[_ngcontent-%COMP%]{padding:6px 4px}.drilldown-item__label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;cursor:pointer}.drilldown-item__name[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm);font-weight:var(--ng-font-weight-medium);color:var(--ng-colors-text-secondary-700)}.drilldown-skeleton__input[_ngcontent-%COMP%]{display:block;width:100%;max-width:26vw}.drilldown-list--loading[_ngcontent-%COMP%] .drilldown-item__label[_ngcontent-%COMP%]{cursor:default}input.drilldown-item__checkbox[type=checkbox][_ngcontent-%COMP%]{appearance:auto;-webkit-appearance:auto;width:16px;height:16px;border-radius:4px;background:transparent;cursor:pointer;accent-color:var(--ng-colors-fg-brand-primary-600)}input.drilldown-item__checkbox[type=checkbox][_ngcontent-%COMP%]:before{content:none}.save-bar[_ngcontent-%COMP%]{display:flex;gap:8px;justify-content:flex-end;padding:14px 28px;border-top:1px solid var(--ng-colors-border-tertiary);background:var(--ng-colors-bg-primary);box-shadow:0 -6px 16px -8px #1018280f}']})};var s0=class i{dashboardName=at("");isPublishing=at(!1);publish=new Xt;dismissed=new Xt;editableName="";constructor(){eo(()=>{this.editableName=this.dashboardName()})}get currentName(){return this.editableName}onDashboardNameChange(e){let t=e;this.editableName=t.detail?.value??""}confirmPublish(){this.publish.emit(this.editableName.trim())}cancelConfirm(){this.dismissed.emit()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["db-publish-dialog"]],inputs:{dashboardName:[1,"dashboardName"],isPublishing:[1,"isPublishing"]},outputs:{publish:"publish",dismissed:"dismissed"},decls:9,vars:3,consts:[[1,"publish-panel"],[1,"panel-desc"],["label","Name","placeholder","Untitled Dashboard",3,"nile-input","value"],[1,"confirm-footer"],["variant","secondary",3,"click"],["variant","primary",3,"click","disabled","loading"]],template:function(t,M){t&1&&(C(0,"div",0)(1,"p",1),Y(2," Give the dashboard a name your team will recognise, then publish it. "),b(),C(3,"nile-input",2),Ae("nile-input",function(r){return M.onDashboardNameChange(r)}),b(),C(4,"div",3)(5,"nile-button",4),Ae("click",function(){return M.cancelConfirm()}),Y(6,"Cancel"),b(),C(7,"nile-button",5),Ae("click",function(){return M.confirmPublish()}),Y(8," Publish "),b()()()),t&2&&(L(3),Ue("value",M.editableName),L(4),Ue("disabled",!M.currentName.trim()||M.isPublishing())("loading",M.isPublishing()))},dependencies:[Go,wj],styles:[".publish-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--ng-spacing-3, 12px)}.panel-title[_ngcontent-%COMP%]{margin:0;font-size:var(--ng-font-size-text-md, 16px);font-weight:var(--ng-font-weight-bold, 700);color:var(--ng-colors-text-primary-900)}.panel-desc[_ngcontent-%COMP%]{margin:0;font-size:var(--ng-font-size-text-xs, 12px);color:var(--ng-colors-text-tertiary-600);line-height:var(--ng-line-height-text-xs, 18px)}nile-input[_ngcontent-%COMP%], nile-button[_ngcontent-%COMP%]{width:100%}.confirm-footer[_ngcontent-%COMP%]{display:flex;gap:var(--ng-spacing-2, 8px);justify-content:flex-end;margin-top:var(--ng-spacing-2, 8px)}.confirm-footer[_ngcontent-%COMP%] nile-button[_ngcontent-%COMP%]{width:auto}.section-title[_ngcontent-%COMP%]{margin:0;font-size:var(--ng-font-size-text-sm, 14px);font-weight:var(--ng-font-weight-semibold, 600);color:var(--ng-colors-text-primary-900)}.saved-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--ng-spacing-2, 8px)}.saved-item[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:var(--ng-spacing-2-5, 10px) var(--ng-spacing-3, 12px);background:var(--ng-colors-bg-secondary);border-radius:var(--ng-radius-md, 8px);cursor:pointer;transition:all var(--ng-transition-duration-fast, .1s) ease;border:1px solid transparent}.saved-item[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary-hover)}.saved-item.selected[_ngcontent-%COMP%]{border-color:var(--ng-colors-border-brand);background:var(--ng-colors-bg-brand-primary)}.saved-info[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;min-width:0}.saved-name[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm, 14px);font-weight:var(--ng-font-weight-semibold, 600);color:var(--ng-colors-text-primary-900);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.saved-meta[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-xs, 12px);color:var(--ng-colors-text-quaternary-500)}.saved-actions[_ngcontent-%COMP%]{display:flex;gap:var(--ng-spacing-1, 4px);flex-shrink:0}.no-saved-state[_ngcontent-%COMP%]{text-align:center;padding:var(--ng-spacing-4, 16px) 0}.no-saved-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font-size:var(--ng-font-size-text-sm, 14px);color:var(--ng-colors-text-quaternary-500);margin:0}"]})};function clt(i,e){if(i.match(/^[a-z]+:\/\//i))return i;if(i.match(/^\/\//))return window.location.protocol+i;if(i.match(/^[a-z]+:/i))return i;let t=document.implementation.createHTMLDocument(),M=t.createElement("base"),n=t.createElement("a");return t.head.appendChild(M),t.body.appendChild(n),e&&(M.href=e),n.href=i,n.href}var Dlt=(()=>{let i=0,e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(i+=1,`u${e()}${i}`)})();function Pu(i){let e=[];for(let t=0,M=i.length;t<M;t++)e.push(i[t]);return e}var l0=null;function X3(i={}){return l0||(i.includeStyleProperties?(l0=i.includeStyleProperties,l0):(l0=Pu(window.getComputedStyle(document.documentElement)),l0))}function $3(i,e){let M=(i.ownerDocument.defaultView||window).getComputedStyle(i).getPropertyValue(e);return M?parseFloat(M.replace("px","")):0}function xRt(i){let e=$3(i,"border-left-width"),t=$3(i,"border-right-width");return i.clientWidth+e+t}function pRt(i){let e=$3(i,"border-top-width"),t=$3(i,"border-bottom-width");return i.clientHeight+e+t}function hF(i,e={}){let t=e.width||xRt(i),M=e.height||pRt(i);return{width:t,height:M}}function Ilt(){let i,e;try{e=process}catch{}let t=e&&e.env?e.env.devicePixelRatio:null;return t&&(i=parseInt(t,10),Number.isNaN(i)&&(i=1)),i||window.devicePixelRatio||1}var vg=16384;function dlt(i){(i.width>vg||i.height>vg)&&(i.width>vg&&i.height>vg?i.width>i.height?(i.height*=vg/i.width,i.width=vg):(i.width*=vg/i.height,i.height=vg):i.width>vg?(i.height*=vg/i.width,i.width=vg):(i.width*=vg/i.height,i.height=vg))}function g0(i){return new Promise((e,t)=>{let M=new Image;M.onload=()=>{M.decode().then(()=>{requestAnimationFrame(()=>e(M))})},M.onerror=t,M.crossOrigin="anonymous",M.decoding="async",M.src=i})}async function LRt(i){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function jlt(i,e,t){let M="http://www.w3.org/2000/svg",n=document.createElementNS(M,"svg"),r=document.createElementNS(M,"foreignObject");return n.setAttribute("width",`${e}`),n.setAttribute("height",`${t}`),n.setAttribute("viewBox",`0 0 ${e} ${t}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),n.appendChild(r),r.appendChild(i),LRt(n)}var ys=(i,e)=>{if(i instanceof e)return!0;let t=Object.getPrototypeOf(i);return t===null?!1:t.constructor.name===e.name||ys(t,e)};function ORt(i){let e=i.getPropertyValue("content");return`${i.cssText} content: '${e.replace(/'|"/g,"")}';`}function mRt(i,e){return X3(e).map(t=>{let M=i.getPropertyValue(t),n=i.getPropertyPriority(t);return`${t}: ${M}${n?" !important":""};`}).join(" ")}function ERt(i,e,t,M){let n=`.${i}:${e}`,r=t.cssText?ORt(t):mRt(t,M);return document.createTextNode(`${n}{${r}}`)}function ylt(i,e,t,M){let n=window.getComputedStyle(i,t),r=n.getPropertyValue("content");if(r===""||r==="none")return;let o=Dlt();try{e.className=`${e.className} ${o}`}catch{return}let a=document.createElement("style");a.appendChild(ERt(o,t,n,M)),e.appendChild(a)}function Tlt(i,e,t){ylt(i,e,":before",t),ylt(i,e,":after",t)}var Alt="application/font-woff",zlt="image/jpeg",fRt={woff:Alt,woff2:Alt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:zlt,jpeg:zlt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function SRt(i){let e=/\.([^./]*?)$/g.exec(i);return e?e[1]:""}function N0(i){let e=SRt(i).toLowerCase();return fRt[e]||""}function wRt(i){return i.split(/,/)[1]}function rE(i){return i.search(/^(data:)/)!==-1}function pF(i,e){return`data:${e};base64,${i}`}async function LF(i,e,t){let M=await fetch(i,e);if(M.status===404)throw new Error(`Resource "${M.url}" not found`);let n=await M.blob();return new Promise((r,o)=>{let a=new FileReader;a.onerror=o,a.onloadend=()=>{try{r(t({res:M,result:a.result}))}catch(s){o(s)}},a.readAsDataURL(n)})}var xF={};function CRt(i,e,t){let M=i.replace(/\?.*/,"");return t&&(M=i),/ttf|otf|eot|woff2?/i.test(M)&&(M=M.replace(/.*\//,"")),e?`[${e}]${M}`:M}async function u0(i,e,t){let M=CRt(i,e,t.includeQueryParams);if(xF[M]!=null)return xF[M];t.cacheBust&&(i+=(/\?/.test(i)?"&":"?")+new Date().getTime());let n;try{let r=await LF(i,t.fetchRequestInit,({res:o,result:a})=>(e||(e=o.headers.get("Content-Type")||""),wRt(a)));n=pF(r,e)}catch(r){n=t.imagePlaceholder||"";let o=`Failed to fetch resource: ${i}`;r&&(o=typeof r=="string"?r:r.message),o&&console.warn(o)}return xF[M]=n,n}async function kRt(i){let e=i.toDataURL();return e==="data:,"?i.cloneNode(!1):g0(e)}async function bRt(i,e){if(i.currentSrc){let r=document.createElement("canvas"),o=r.getContext("2d");r.width=i.clientWidth,r.height=i.clientHeight,o?.drawImage(i,0,0,r.width,r.height);let a=r.toDataURL();return g0(a)}let t=i.poster,M=N0(t),n=await u0(t,M,e);return g0(n)}async function QRt(i,e){var t;try{if(!((t=i?.contentDocument)===null||t===void 0)&&t.body)return await oE(i.contentDocument.body,e,!0)}catch{}return i.cloneNode(!1)}async function URt(i,e){return ys(i,HTMLCanvasElement)?kRt(i):ys(i,HTMLVideoElement)?bRt(i,e):ys(i,HTMLIFrameElement)?QRt(i,e):i.cloneNode(hlt(i))}var vRt=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SLOT",hlt=i=>i.tagName!=null&&i.tagName.toUpperCase()==="SVG";async function YRt(i,e,t){var M,n;if(hlt(e))return e;let r=[];return vRt(i)&&i.assignedNodes?r=Pu(i.assignedNodes()):ys(i,HTMLIFrameElement)&&(!((M=i.contentDocument)===null||M===void 0)&&M.body)?r=Pu(i.contentDocument.body.childNodes):r=Pu(((n=i.shadowRoot)!==null&&n!==void 0?n:i).childNodes),r.length===0||ys(i,HTMLVideoElement)||await r.reduce((o,a)=>o.then(()=>oE(a,t)).then(s=>{s&&e.appendChild(s)}),Promise.resolve()),e}function ZRt(i,e,t){let M=e.style;if(!M)return;let n=window.getComputedStyle(i);n.cssText?(M.cssText=n.cssText,M.transformOrigin=n.transformOrigin):X3(t).forEach(r=>{let o=n.getPropertyValue(r);r==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),ys(i,HTMLIFrameElement)&&r==="display"&&o==="inline"&&(o="block"),r==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),M.setProperty(r,o,n.getPropertyPriority(r))})}function _Rt(i,e){ys(i,HTMLTextAreaElement)&&(e.innerHTML=i.value),ys(i,HTMLInputElement)&&e.setAttribute("value",i.value)}function WRt(i,e){if(ys(i,HTMLSelectElement)){let M=Array.from(e.children).find(n=>i.value===n.getAttribute("value"));M&&M.setAttribute("selected","")}}function PRt(i,e,t){return ys(e,Element)&&(ZRt(i,e,t),Tlt(i,e,t),_Rt(i,e),WRt(i,e)),e}async function RRt(i,e){let t=i.querySelectorAll?i.querySelectorAll("use"):[];if(t.length===0)return i;let M={};for(let r=0;r<t.length;r++){let a=t[r].getAttribute("xlink:href");if(a){let s=i.querySelector(a),l=document.querySelector(a);!s&&l&&!M[a]&&(M[a]=await oE(l,e,!0))}}let n=Object.values(M);if(n.length){let r="http://www.w3.org/1999/xhtml",o=document.createElementNS(r,"svg");o.setAttribute("xmlns",r),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";let a=document.createElementNS(r,"defs");o.appendChild(a);for(let s=0;s<n.length;s++)a.appendChild(n[s]);i.appendChild(o)}return i}async function oE(i,e,t){return!t&&e.filter&&!e.filter(i)?null:Promise.resolve(i).then(M=>URt(M,e)).then(M=>YRt(i,M,e)).then(M=>PRt(i,M,e)).then(M=>RRt(M,e))}var xlt=/url\((['"]?)([^'"]+?)\1\)/g,VRt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,BRt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function FRt(i){let e=i.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function HRt(i){let e=[];return i.replace(xlt,(t,M,n)=>(e.push(n),t)),e.filter(t=>!rE(t))}async function JRt(i,e,t,M,n){try{let r=t?clt(e,t):e,o=N0(e),a;if(n){let s=await n(r);a=pF(s,o)}else a=await u0(r,o,M);return i.replace(FRt(e),`$1${a}$3`)}catch{}return i}function GRt(i,{preferredFontFormat:e}){return e?i.replace(BRt,t=>{for(;;){let[M,,n]=VRt.exec(t)||[];if(!n)return"";if(n===e)return`src: ${M};`}}):i}function OF(i){return i.search(xlt)!==-1}async function q3(i,e,t){if(!OF(i))return i;let M=GRt(i,t);return HRt(M).reduce((r,o)=>r.then(a=>JRt(a,o,e,t)),Promise.resolve(M))}async function c0(i,e,t){var M;let n=(M=e.style)===null||M===void 0?void 0:M.getPropertyValue(i);if(n){let r=await q3(n,null,t);return e.style.setProperty(i,r,e.style.getPropertyPriority(i)),!0}return!1}async function $Rt(i,e){await c0("background",i,e)||await c0("background-image",i,e),await c0("mask",i,e)||await c0("-webkit-mask",i,e)||await c0("mask-image",i,e)||await c0("-webkit-mask-image",i,e)}async function XRt(i,e){let t=ys(i,HTMLImageElement);if(!(t&&!rE(i.src))&&!(ys(i,SVGImageElement)&&!rE(i.href.baseVal)))return;let M=t?i.src:i.href.baseVal,n=await u0(M,N0(M),e);await new Promise((r,o)=>{i.onload=r,i.onerror=e.onImageErrorHandler?(...s)=>{try{r(e.onImageErrorHandler(...s))}catch(l){o(l)}}:o;let a=i;a.decode&&(a.decode=r),a.loading==="lazy"&&(a.loading="eager"),t?(i.srcset="",i.src=n):i.href.baseVal=n})}async function qRt(i,e){let M=Pu(i.childNodes).map(n=>mF(n,e));await Promise.all(M).then(()=>i)}async function mF(i,e){ys(i,Element)&&(await $Rt(i,e),await XRt(i,e),await qRt(i,e))}function plt(i,e){let{style:t}=i;e.backgroundColor&&(t.backgroundColor=e.backgroundColor),e.width&&(t.width=`${e.width}px`),e.height&&(t.height=`${e.height}px`);let M=e.style;return M!=null&&Object.keys(M).forEach(n=>{t[n]=M[n]}),i}var Llt={};async function Olt(i){let e=Llt[i];if(e!=null)return e;let M=await(await fetch(i)).text();return e={url:i,cssText:M},Llt[i]=e,e}async function mlt(i,e){let t=i.cssText,M=/url\(["']?([^"')]+)["']?\)/g,r=(t.match(/url\([^)]+\)/g)||[]).map(async o=>{let a=o.replace(M,"$1");return a.startsWith("https://")||(a=new URL(a,i.url).href),LF(a,e.fetchRequestInit,({result:s})=>(t=t.replace(o,`url(${s})`),[o,s]))});return Promise.all(r).then(()=>t)}function Elt(i){if(i==null)return[];let e=[],t=/(\/\*[\s\S]*?\*\/)/gi,M=i.replace(t,""),n=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let s=n.exec(M);if(s===null)break;e.push(s[0])}M=M.replace(n,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(o,"gi");for(;;){let s=r.exec(M);if(s===null){if(s=a.exec(M),s===null)break;r.lastIndex=a.lastIndex}else a.lastIndex=r.lastIndex;e.push(s[0])}return e}async function KRt(i,e){let t=[],M=[];return i.forEach(n=>{if("cssRules"in n)try{Pu(n.cssRules||[]).forEach((r,o)=>{if(r.type===CSSRule.IMPORT_RULE){let a=o+1,s=r.href,l=Olt(s).then(N=>mlt(N,e)).then(N=>Elt(N).forEach(c=>{try{n.insertRule(c,c.startsWith("@import")?a+=1:n.cssRules.length)}catch(D){console.error("Error inserting rule from remote css",{rule:c,error:D})}})).catch(N=>{console.error("Error loading remote css",N.toString())});M.push(l)}})}catch(r){let o=i.find(a=>a.href==null)||document.styleSheets[0];n.href!=null&&M.push(Olt(n.href).then(a=>mlt(a,e)).then(a=>Elt(a).forEach(s=>{o.insertRule(s,o.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",r)}}),Promise.all(M).then(()=>(i.forEach(n=>{if("cssRules"in n)try{Pu(n.cssRules||[]).forEach(r=>{t.push(r)})}catch(r){console.error(`Error while reading CSS rules from ${n.href}`,r)}}),t))}function eVt(i){return i.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>OF(e.style.getPropertyValue("src")))}async function tVt(i,e){if(i.ownerDocument==null)throw new Error("Provided element is not within a Document");let t=Pu(i.ownerDocument.styleSheets),M=await KRt(t,e);return eVt(M)}function flt(i){return i.trim().replace(/["']/g,"")}function iVt(i){let e=new Set;function t(M){(M.style.fontFamily||getComputedStyle(M).fontFamily).split(",").forEach(r=>{e.add(flt(r))}),Array.from(M.children).forEach(r=>{r instanceof HTMLElement&&t(r)})}return t(i),e}async function Slt(i,e){let t=await tVt(i,e),M=iVt(i);return(await Promise.all(t.filter(r=>M.has(flt(r.style.fontFamily))).map(r=>{let o=r.parentStyleSheet?r.parentStyleSheet.href:null;return q3(r.cssText,o,e)}))).join(`
|
|
40502
40502
|
`)}async function wlt(i,e){let t=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await Slt(i,e);if(t){let M=document.createElement("style"),n=document.createTextNode(t);M.appendChild(n),i.firstChild?i.insertBefore(M,i.firstChild):i.appendChild(M)}}async function MVt(i,e={}){let{width:t,height:M}=hF(i,e),n=await oE(i,e,!0);return await wlt(n,e),await mF(n,e),plt(n,e),await jlt(n,t,M)}async function nVt(i,e={}){let{width:t,height:M}=hF(i,e),n=await MVt(i,e),r=await g0(n),o=document.createElement("canvas"),a=o.getContext("2d"),s=e.pixelRatio||Ilt(),l=e.canvasWidth||t,N=e.canvasHeight||M;return o.width=l*s,o.height=N*s,e.skipAutoScale||dlt(o),o.style.width=`${l}`,o.style.height=`${N}`,e.backgroundColor&&(a.fillStyle=e.backgroundColor,a.fillRect(0,0,o.width,o.height)),a.drawImage(r,0,0,o.width,o.height),o}async function EF(i,e={}){return(await nVt(i,e)).toDataURL("image/jpeg",e.quality||1)}var Ru=Uint8Array,Yg=Uint16Array,kF=Int32Array,bF=new Ru([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),QF=new Ru([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Clt=new Ru([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ult=function(i,e){for(var t=new Yg(31),M=0;M<31;++M)t[M]=e+=1<<i[M-1];for(var n=new kF(t[30]),M=1;M<30;++M)for(var r=t[M];r<t[M+1];++r)n[r]=r-t[M]<<5|M;return{b:t,r:n}},vlt=Ult(bF,2),rVt=vlt.b,SF=vlt.r;rVt[28]=258,SF[258]=28;var Ylt=Ult(QF,0),Czr=Ylt.b,klt=Ylt.r,wF=new Yg(32768);for(GM=0;GM<32768;++GM)_I=(GM&43690)>>1|(GM&21845)<<1,_I=(_I&52428)>>2|(_I&13107)<<2,_I=(_I&61680)>>4|(_I&3855)<<4,wF[GM]=((_I&65280)>>8|(_I&255)<<8)>>1;var _I,GM,lE=function(i,e,t){for(var M=i.length,n=0,r=new Yg(e);n<M;++n)i[n]&&++r[i[n]-1];var o=new Yg(e);for(n=1;n<e;++n)o[n]=o[n-1]+r[n-1]<<1;var a;if(t){a=new Yg(1<<e);var s=15-e;for(n=0;n<M;++n)if(i[n])for(var l=n<<4|i[n],N=e-i[n],c=o[i[n]-1]++<<N,D=c|(1<<N)-1;c<=D;++c)a[wF[c]>>s]=l}else for(a=new Yg(M),n=0;n<M;++n)i[n]&&(a[n]=wF[o[i[n]-1]++]>>15-i[n]);return a},bA=new Ru(288);for(GM=0;GM<144;++GM)bA[GM]=8;var GM;for(GM=144;GM<256;++GM)bA[GM]=9;var GM;for(GM=256;GM<280;++GM)bA[GM]=7;var GM;for(GM=280;GM<288;++GM)bA[GM]=8;var GM,K3=new Ru(32);for(GM=0;GM<32;++GM)K3[GM]=5;var GM,oVt=lE(bA,9,0);var aVt=lE(K3,5,0);var Zlt=function(i){return(i+7)/8|0},sVt=function(i,e,t){return(e==null||e<0)&&(e=0),(t==null||t>i.length)&&(t=i.length),new Ru(i.subarray(e,t))};var WI=function(i,e,t){t<<=e&7;var M=e/8|0;i[M]|=t,i[M+1]|=t>>8},aE=function(i,e,t){t<<=e&7;var M=e/8|0;i[M]|=t,i[M+1]|=t>>8,i[M+2]|=t>>16},fF=function(i,e){for(var t=[],M=0;M<i.length;++M)i[M]&&t.push({s:M,f:i[M]});var n=t.length,r=t.slice();if(!n)return{t:Wlt,l:0};if(n==1){var o=new Ru(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(v,Z){return v.f-Z.f}),t.push({s:-1,f:25001});var a=t[0],s=t[1],l=0,N=1,c=2;for(t[0]={s:-1,f:a.f+s.f,l:a,r:s};N!=n-1;)a=t[t[l].f<t[c].f?l++:c++],s=t[l!=N&&t[l].f<t[c].f?l++:c++],t[N++]={s:-1,f:a.f+s.f,l:a,r:s};for(var D=r[0].s,M=1;M<n;++M)r[M].s>D&&(D=r[M].s);var I=new Yg(D+1),d=CF(t[N-1],I,0);if(d>e){var M=0,y=0,A=d-e,z=1<<A;for(r.sort(function(Z,B){return I[B.s]-I[Z.s]||Z.f-B.f});M<n;++M){var E=r[M].s;if(I[E]>e)y+=z-(1<<d-I[E]),I[E]=e;else break}for(y>>=A;y>0;){var S=r[M].s;I[S]<e?y-=1<<e-I[S]++-1:++M}for(;M>=0&&y;--M){var O=r[M].s;I[O]==e&&(--I[O],++y)}d=e}return{t:new Ru(I),l:d}},CF=function(i,e,t){return i.s==-1?Math.max(CF(i.l,e,t+1),CF(i.r,e,t+1)):e[i.s]=t},blt=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new Yg(++e),M=0,n=i[0],r=1,o=function(s){t[M++]=s},a=1;a<=e;++a)if(i[a]==n&&a!=e)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=i[a]}return{c:t.subarray(0,M),n:e}},sE=function(i,e){for(var t=0,M=0;M<e.length;++M)t+=i[M]*e[M];return t},_lt=function(i,e,t){var M=t.length,n=Zlt(e+2);i[n]=M&255,i[n+1]=M>>8,i[n+2]=i[n]^255,i[n+3]=i[n+1]^255;for(var r=0;r<M;++r)i[n+r+4]=t[r];return(n+4+M)*8},Qlt=function(i,e,t,M,n,r,o,a,s,l,N){WI(e,N++,t),++n[256];for(var c=fF(n,15),D=c.t,I=c.l,d=fF(r,15),y=d.t,A=d.l,z=blt(D),E=z.c,S=z.n,O=blt(y),v=O.c,Z=O.n,B=new Yg(19),q=0;q<E.length;++q)++B[E[q]&31];for(var q=0;q<v.length;++q)++B[v[q]&31];for(var W=fF(B,7),Ne=W.t,_=W.l,X=19;X>4&&!Ne[Clt[X-1]];--X);var ne=l+5<<3,ae=sE(n,bA)+sE(r,K3)+o,pe=sE(n,D)+sE(r,y)+o+14+3*X+sE(B,Ne)+2*B[16]+3*B[17]+7*B[18];if(s>=0&&ne<=ae&&ne<=pe)return _lt(e,N,i.subarray(s,s+l));var Me,De,Ie,me;if(WI(e,N,1+(pe<ae)),N+=2,pe<ae){Me=lE(D,I,0),De=D,Ie=lE(y,A,0),me=y;var Qe=lE(Ne,_,0);WI(e,N,S-257),WI(e,N+5,Z-1),WI(e,N+10,X-4),N+=14;for(var q=0;q<X;++q)WI(e,N+3*q,Ne[Clt[q]]);N+=3*X;for(var Ye=[E,v],F=0;F<2;++F)for(var le=Ye[F],q=0;q<le.length;++q){var J=le[q]&31;WI(e,N,Qe[J]),N+=Ne[J],J>15&&(WI(e,N,le[q]>>5&127),N+=le[q]>>12)}}else Me=oVt,De=bA,Ie=aVt,me=K3;for(var q=0;q<a;++q){var ue=M[q];if(ue>255){var J=ue>>18&31;aE(e,N,Me[J+257]),N+=De[J+257],J>7&&(WI(e,N,ue>>23&31),N+=bF[J]);var ze=ue&31;aE(e,N,Ie[ze]),N+=me[ze],ze>3&&(aE(e,N,ue>>5&8191),N+=QF[ze])}else aE(e,N,Me[ue]),N+=De[ue]}return aE(e,N,Me[256]),N+De[256]},lVt=new kF([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Wlt=new Ru(0),gVt=function(i,e,t,M,n,r){var o=r.z||i.length,a=new Ru(M+o+5*(1+Math.ceil(o/7e3))+n),s=a.subarray(M,a.length-n),l=r.l,N=(r.r||0)&7;if(e){N&&(s[0]=r.r>>3);for(var c=lVt[e-1],D=c>>13,I=c&8191,d=(1<<t)-1,y=r.p||new Yg(32768),A=r.h||new Yg(d+1),z=Math.ceil(t/3),E=2*z,S=function(Vt){return(i[Vt]^i[Vt+1]<<z^i[Vt+2]<<E)&d},O=new kF(25e3),v=new Yg(288),Z=new Yg(32),B=0,q=0,W=r.i||0,Ne=0,_=r.w||0,X=0;W+2<o;++W){var ne=S(W),ae=W&32767,pe=A[ne];if(y[ae]=pe,A[ne]=ae,_<=W){var Me=o-W;if((B>7e3||Ne>24576)&&(Me>423||!l)){N=Qlt(i,s,0,O,v,Z,q,Ne,X,W-X,N),Ne=B=q=0,X=W;for(var De=0;De<286;++De)v[De]=0;for(var De=0;De<30;++De)Z[De]=0}var Ie=2,me=0,Qe=I,Ye=ae-pe&32767;if(Me>2&&ne==S(W-Ye))for(var F=Math.min(D,Me)-1,le=Math.min(32767,W),J=Math.min(258,Me);Ye<=le&&--Qe&&ae!=pe;){if(i[W+Ie]==i[W+Ie-Ye]){for(var ue=0;ue<J&&i[W+ue]==i[W+ue-Ye];++ue);if(ue>Ie){if(Ie=ue,me=Ye,ue>F)break;for(var ze=Math.min(Ye,ue-2),Ee=0,De=0;De<ze;++De){var we=W-Ye+De&32767,_e=y[we],Re=we-_e&32767;Re>Ee&&(Ee=Re,pe=we)}}}ae=pe,pe=y[ae],Ye+=ae-pe&32767}if(me){O[Ne++]=268435456|SF[Ie]<<18|klt[me];var Be=SF[Ie]&31,Dt=klt[me]&31;q+=bF[Be]+QF[Dt],++v[257+Be],++Z[Dt],_=W+Ie,++B}else O[Ne++]=i[W],++v[i[W]]}}for(W=Math.max(W,_);W<o;++W)O[Ne++]=i[W],++v[i[W]];N=Qlt(i,s,l,O,v,Z,q,Ne,X,W-X,N),l||(r.r=N&7|s[N/8|0]<<3,N-=7,r.h=A,r.p=y,r.i=W,r.w=_)}else{for(var W=r.w||0;W<o+l;W+=65535){var Ot=W+65535;Ot>=o&&(s[N/8|0]=l,Ot=o),N=_lt(s,N+1,i.subarray(W,Ot))}r.i=o}return sVt(a,0,M+Zlt(N)+n)};var Plt=function(){var i=1,e=0;return{p:function(t){for(var M=i,n=e,r=t.length|0,o=0;o!=r;){for(var a=Math.min(o+2655,r);o<a;++o)n+=M+=t[o];M=(M&65535)+15*(M>>16),n=(n&65535)+15*(n>>16)}i=M,e=n},d:function(){return i%=65521,e%=65521,(i&255)<<24|(i&65280)<<8|(e&255)<<8|e>>8}}},NVt=function(i,e,t,M,n){if(!n&&(n={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),o=new Ru(r.length+i.length);o.set(r),o.set(i,r.length),i=o,n.w=r.length}return gVt(i,e.level==null?6:e.level,e.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+e.mem,t,M,n)};var Rlt=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};var uVt=function(i,e){var t=e.level,M=t==0?0:t<6?1:t==9?3:2;if(i[0]=120,i[1]=M<<6|(e.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,e.dictionary){var n=Plt();n.p(e.dictionary),Rlt(i,2,n.d())}};function eQ(i,e){e||(e={});var t=Plt();t.p(i);var M=NVt(i,e,e.dictionary?6:2,4);return uVt(M,e),Rlt(M,M.length-4,t.d()),M}var cVt=typeof TextDecoder<"u"&&new TextDecoder,DVt=0;try{cVt.decode(Wlt,{stream:!0}),DVt=1}catch{}function Vlt(i){if(Array.isArray(i))return i}function Blt(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var M,n,r,o,a=[],s=!0,l=!1;try{if(r=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;s=!1}else for(;!(s=(M=r.call(t)).done)&&(a.push(M.value),a.length!==e);s=!0);}catch(N){l=!0,n=N}finally{try{if(!s&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(l)throw n}}return a}}function UF(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,M=Array(e);t<e;t++)M[t]=i[t];return M}function Flt(i,e){if(i){if(typeof i=="string")return UF(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?UF(i,e):void 0}}function Hlt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
40503
40503
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vF(i,e){return Vlt(i)||Blt(i,e)||Flt(i,e)||Hlt()}function YF(i,e="utf8"){return new TextDecoder(e).decode(i)}var IVt=new TextEncoder;function Jlt(i){return IVt.encode(i)}var dVt=1024*8,jVt=(()=>{let i=new Uint8Array(4),e=new Uint32Array(i.buffer);return!((e[0]=1)&i[0])})(),ZF={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array},gE=class i{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(e=dVt,t={}){let M=!1;typeof e=="number"?e=new ArrayBuffer(e):(M=!0,this.lastWrittenByte=e.byteLength);let n=t.offset?t.offset>>>0:0,r=e.byteLength-n,o=n;(ArrayBuffer.isView(e)||e instanceof i)&&(e.byteLength!==e.buffer.byteLength&&(o=e.byteOffset+n),e=e.buffer),M?this.lastWrittenByte=r:this.lastWrittenByte=0,this.buffer=e,this.length=r,this.byteLength=r,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,r),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let e=this._marks.pop();if(e===void 0)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){let M=(this.offset+e)*2,n=new Uint8Array(M);n.set(new Uint8Array(this.buffer)),this.buffer=n.buffer,this.length=M,this.byteLength=M,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,"uint8")}readArray(e,t){let M=ZF[t].BYTES_PER_ELEMENT*e,n=this.byteOffset+this.offset,r=this.buffer.slice(n,n+M);if(this.littleEndian===jVt&&t!=="uint8"&&t!=="int8"){let a=new Uint8Array(this.buffer.slice(n,n+M));a.reverse();let s=new ZF[t](a.buffer);return this.offset+=M,s.reverse(),s}let o=new ZF[t](r);return this.offset+=M,o}readInt16(){let e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){let e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){let e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){let e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){let e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){let e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){let e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){let e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let t="";for(let M=0;M<e;M++)t+=this.readChar();return t}readUtf8(e=1){return YF(this.readBytes(e))}decodeText(e=1,t="utf8"){return YF(this.readBytes(e),t)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let t=0;t<e.length;t++)this._data.setUint8(this.offset++,e[t]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let t=0;t<e.length;t++)this.writeUint8(e.charCodeAt(t));return this}writeUtf8(e){return this.writeBytes(Jlt(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}};function A0(i){let e=i.length;for(;--e>=0;)i[e]=0}var yVt=0,Qgt=1,TVt=2,AVt=3,zVt=258,lH=29,pE=256,jE=pE+1+lH,d0=30,gH=19,Ugt=2*jE+1,QA=15,_F=16,hVt=7,NH=256,vgt=16,Ygt=17,Zgt=18,eH=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),oQ=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),xVt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),_gt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pVt=512,RI=new Array((jE+2)*2);A0(RI);var DE=new Array(d0*2);A0(DE);var yE=new Array(pVt);A0(yE);var TE=new Array(zVt-AVt+1);A0(TE);var uH=new Array(lH);A0(uH);var aQ=new Array(d0);A0(aQ);function WF(i,e,t,M,n){this.static_tree=i,this.extra_bits=e,this.extra_base=t,this.elems=M,this.max_length=n,this.has_stree=i&&i.length}var Wgt,Pgt,Rgt;function PF(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Vgt=i=>i<256?yE[i]:yE[256+(i>>>7)],AE=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Vl=(i,e,t)=>{i.bi_valid>_F-t?(i.bi_buf|=e<<i.bi_valid&65535,AE(i,i.bi_buf),i.bi_buf=e>>_F-i.bi_valid,i.bi_valid+=t-_F):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},qc=(i,e,t)=>{Vl(i,t[e*2],t[e*2+1])},Bgt=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},LVt=i=>{i.bi_valid===16?(AE(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},OVt=(i,e)=>{let t=e.dyn_tree,M=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,s=e.stat_desc.max_length,l,N,c,D,I,d,y=0;for(D=0;D<=QA;D++)i.bl_count[D]=0;for(t[i.heap[i.heap_max]*2+1]=0,l=i.heap_max+1;l<Ugt;l++)N=i.heap[l],D=t[t[N*2+1]*2+1]+1,D>s&&(D=s,y++),t[N*2+1]=D,!(N>M)&&(i.bl_count[D]++,I=0,N>=a&&(I=o[N-a]),d=t[N*2],i.opt_len+=d*(D+I),r&&(i.static_len+=d*(n[N*2+1]+I)));if(y!==0){do{for(D=s-1;i.bl_count[D]===0;)D--;i.bl_count[D]--,i.bl_count[D+1]+=2,i.bl_count[s]--,y-=2}while(y>0);for(D=s;D!==0;D--)for(N=i.bl_count[D];N!==0;)c=i.heap[--l],!(c>M)&&(t[c*2+1]!==D&&(i.opt_len+=(D-t[c*2+1])*t[c*2],t[c*2+1]=D),N--)}},Fgt=(i,e,t)=>{let M=new Array(QA+1),n=0,r,o;for(r=1;r<=QA;r++)n=n+t[r-1]<<1,M[r]=n;for(o=0;o<=e;o++){let a=i[o*2+1];a!==0&&(i[o*2]=Bgt(M[a]++,a))}},mVt=()=>{let i,e,t,M,n,r=new Array(QA+1);for(t=0,M=0;M<lH-1;M++)for(uH[M]=t,i=0;i<1<<eH[M];i++)TE[t++]=M;for(TE[t-1]=M,n=0,M=0;M<16;M++)for(aQ[M]=n,i=0;i<1<<oQ[M];i++)yE[n++]=M;for(n>>=7;M<d0;M++)for(aQ[M]=n<<7,i=0;i<1<<oQ[M]-7;i++)yE[256+n++]=M;for(e=0;e<=QA;e++)r[e]=0;for(i=0;i<=143;)RI[i*2+1]=8,i++,r[8]++;for(;i<=255;)RI[i*2+1]=9,i++,r[9]++;for(;i<=279;)RI[i*2+1]=7,i++,r[7]++;for(;i<=287;)RI[i*2+1]=8,i++,r[8]++;for(Fgt(RI,jE+1,r),i=0;i<d0;i++)DE[i*2+1]=5,DE[i*2]=Bgt(i,5);Wgt=new WF(RI,eH,pE+1,jE,QA),Pgt=new WF(DE,oQ,0,d0,QA),Rgt=new WF(new Array(0),xVt,0,gH,hVt)},Hgt=i=>{let e;for(e=0;e<jE;e++)i.dyn_ltree[e*2]=0;for(e=0;e<d0;e++)i.dyn_dtree[e*2]=0;for(e=0;e<gH;e++)i.bl_tree[e*2]=0;i.dyn_ltree[NH*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Jgt=i=>{i.bi_valid>8?AE(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},Glt=(i,e,t,M)=>{let n=e*2,r=t*2;return i[n]<i[r]||i[n]===i[r]&&M[e]<=M[t]},RF=(i,e,t)=>{let M=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&Glt(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!Glt(e,M,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=M},$lt=(i,e,t)=>{let M,n,r=0,o,a;if(i.sym_next!==0)do M=i.pending_buf[i.sym_buf+r++]&255,M+=(i.pending_buf[i.sym_buf+r++]&255)<<8,n=i.pending_buf[i.sym_buf+r++],M===0?qc(i,n,e):(o=TE[n],qc(i,o+pE+1,e),a=eH[o],a!==0&&(n-=uH[o],Vl(i,n,a)),M--,o=Vgt(M),qc(i,o,t),a=oQ[o],a!==0&&(M-=aQ[o],Vl(i,M,a)));while(r<i.sym_next);qc(i,NH,e)},tH=(i,e)=>{let t=e.dyn_tree,M=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems,o,a,s=-1,l;for(i.heap_len=0,i.heap_max=Ugt,o=0;o<r;o++)t[o*2]!==0?(i.heap[++i.heap_len]=s=o,i.depth[o]=0):t[o*2+1]=0;for(;i.heap_len<2;)l=i.heap[++i.heap_len]=s<2?++s:0,t[l*2]=1,i.depth[l]=0,i.opt_len--,n&&(i.static_len-=M[l*2+1]);for(e.max_code=s,o=i.heap_len>>1;o>=1;o--)RF(i,t,o);l=r;do o=i.heap[1],i.heap[1]=i.heap[i.heap_len--],RF(i,t,1),a=i.heap[1],i.heap[--i.heap_max]=o,i.heap[--i.heap_max]=a,t[l*2]=t[o*2]+t[a*2],i.depth[l]=(i.depth[o]>=i.depth[a]?i.depth[o]:i.depth[a])+1,t[o*2+1]=t[a*2+1]=l,i.heap[1]=l++,RF(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],OVt(i,e),Fgt(t,s,i.bl_count)},Xlt=(i,e,t)=>{let M,n=-1,r,o=e[1],a=0,s=7,l=4;for(o===0&&(s=138,l=3),e[(t+1)*2+1]=65535,M=0;M<=t;M++)r=o,o=e[(M+1)*2+1],!(++a<s&&r===o)&&(a<l?i.bl_tree[r*2]+=a:r!==0?(r!==n&&i.bl_tree[r*2]++,i.bl_tree[vgt*2]++):a<=10?i.bl_tree[Ygt*2]++:i.bl_tree[Zgt*2]++,a=0,n=r,o===0?(s=138,l=3):r===o?(s=6,l=3):(s=7,l=4))},qlt=(i,e,t)=>{let M,n=-1,r,o=e[1],a=0,s=7,l=4;for(o===0&&(s=138,l=3),M=0;M<=t;M++)if(r=o,o=e[(M+1)*2+1],!(++a<s&&r===o)){if(a<l)do qc(i,r,i.bl_tree);while(--a!==0);else r!==0?(r!==n&&(qc(i,r,i.bl_tree),a--),qc(i,vgt,i.bl_tree),Vl(i,a-3,2)):a<=10?(qc(i,Ygt,i.bl_tree),Vl(i,a-3,3)):(qc(i,Zgt,i.bl_tree),Vl(i,a-11,7));a=0,n=r,o===0?(s=138,l=3):r===o?(s=6,l=3):(s=7,l=4)}},EVt=i=>{let e;for(Xlt(i,i.dyn_ltree,i.l_desc.max_code),Xlt(i,i.dyn_dtree,i.d_desc.max_code),tH(i,i.bl_desc),e=gH-1;e>=3&&i.bl_tree[_gt[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},fVt=(i,e,t,M)=>{let n;for(Vl(i,e-257,5),Vl(i,t-1,5),Vl(i,M-4,4),n=0;n<M;n++)Vl(i,i.bl_tree[_gt[n]*2+1],3);qlt(i,i.dyn_ltree,e-1),qlt(i,i.dyn_dtree,t-1)},SVt=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return 0;if(i.dyn_ltree[18]!==0||i.dyn_ltree[20]!==0||i.dyn_ltree[26]!==0)return 1;for(t=32;t<pE;t++)if(i.dyn_ltree[t*2]!==0)return 1;return 0},Klt=!1,wVt=i=>{Klt||(mVt(),Klt=!0),i.l_desc=new PF(i.dyn_ltree,Wgt),i.d_desc=new PF(i.dyn_dtree,Pgt),i.bl_desc=new PF(i.bl_tree,Rgt),i.bi_buf=0,i.bi_valid=0,Hgt(i)},Ggt=(i,e,t,M)=>{Vl(i,(yVt<<1)+(M?1:0),3),Jgt(i),AE(i,t),AE(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},CVt=i=>{Vl(i,Qgt<<1,3),qc(i,NH,RI),LVt(i)},kVt=(i,e,t,M)=>{let n,r,o=0;i.level>0?(i.strm.data_type===2&&(i.strm.data_type=SVt(i)),tH(i,i.l_desc),tH(i,i.d_desc),o=EVt(i),n=i.opt_len+3+7>>>3,r=i.static_len+3+7>>>3,r<=n&&(n=r)):n=r=t+5,t+4<=n&&e!==-1?Ggt(i,e,t,M):i.strategy===4||r===n?(Vl(i,(Qgt<<1)+(M?1:0),3),$lt(i,RI,DE)):(Vl(i,(TVt<<1)+(M?1:0),3),fVt(i,i.l_desc.max_code+1,i.d_desc.max_code+1,o+1),$lt(i,i.dyn_ltree,i.dyn_dtree)),Hgt(i),M&&Jgt(i)},bVt=(i,e,t)=>(i.pending_buf[i.sym_buf+i.sym_next++]=e,i.pending_buf[i.sym_buf+i.sym_next++]=e>>8,i.pending_buf[i.sym_buf+i.sym_next++]=t,e===0?i.dyn_ltree[t*2]++:(i.matches++,e--,i.dyn_ltree[(TE[t]+pE+1)*2]++,i.dyn_dtree[Vgt(e)*2]++),i.sym_next===i.sym_end),QVt=wVt,UVt=Ggt,vVt=kVt,YVt=bVt,ZVt=CVt,_Vt={_tr_init:QVt,_tr_stored_block:UVt,_tr_flush_block:vVt,_tr_tally:YVt,_tr_align:ZVt},WVt=(i,e,t,M)=>{let n=i&65535|0,r=i>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[M++]|0,r=r+n|0;while(--o);n%=65521,r%=65521}return n|r<<16|0},zE=WVt,PVt=()=>{let i,e=[];for(var t=0;t<256;t++){i=t;for(var M=0;M<8;M++)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i}return e},RVt=new Uint32Array(PVt()),VVt=(i,e,t,M)=>{let n=RVt,r=M+t;i^=-1;for(let o=M;o<r;o++)i=i>>>8^n[(i^e[o])&255];return i^-1},ga=VVt,YA={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},z0={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:BVt,_tr_stored_block:iH,_tr_flush_block:FVt,_tr_tally:Wj,_tr_align:HVt}=_Vt,{Z_NO_FLUSH:Pj,Z_PARTIAL_FLUSH:JVt,Z_FULL_FLUSH:GVt,Z_FINISH:WN,Z_BLOCK:egt,Z_OK:Wa,Z_STREAM_END:tgt,Z_STREAM_ERROR:Kc,Z_DATA_ERROR:$Vt,Z_BUF_ERROR:VF,Z_DEFAULT_COMPRESSION:XVt,Z_FILTERED:qVt,Z_HUFFMAN_ONLY:tQ,Z_RLE:KVt,Z_FIXED:eBt,Z_DEFAULT_STRATEGY:tBt,Z_UNKNOWN:iBt,Z_DEFLATED:gQ}=z0,MBt=9,nBt=15,rBt=8,oBt=29,aBt=256,MH=aBt+1+oBt,sBt=30,lBt=19,gBt=2*MH+1,NBt=15,QM=3,_j=258,eD=_j+QM+1,uBt=32,y0=42,cH=57,nH=69,rH=73,oH=91,aH=103,UA=113,uE=666,Xs=1,h0=2,ZA=3,x0=4,cBt=3,vA=(i,e)=>(i.msg=YA[e],e),igt=i=>i*2-(i>4?9:0),Zj=i=>{let e=i.length;for(;--e>=0;)i[e]=0},DBt=i=>{let e,t,M,n=i.w_size;e=i.hash_size,M=e;do t=i.head[--M],i.head[M]=t>=n?t-n:0;while(--e);e=n,M=e;do t=i.prev[--M],i.prev[M]=t>=n?t-n:0;while(--e)},DH=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,_A=(i,e)=>{let t;if(i.legacy_hash)t=i.ins_h=DH(i,i.ins_h,i.window[e+QM-1]);else{let n=i.window,r=n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24;t=i.ins_h=Math.imul(r,66521)+66521>>>16&i.hash_mask}let M=i.prev[e&i.w_mask]=i.head[t];return i.head[t]=e,M},Zg=i=>{let e=i.state,t=e.pending;t>i.avail_out&&(t=i.avail_out),t!==0&&(i.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),i.next_out),i.next_out+=t,e.pending_out+=t,i.total_out+=t,i.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},_g=(i,e)=>{FVt(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Zg(i.strm)},$M=(i,e)=>{i.pending_buf[i.pending++]=e},NE=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},sH=(i,e,t,M)=>{let n=i.avail_in;return n>M&&(n=M),n===0?0:(i.avail_in-=n,e.set(i.input.subarray(i.next_in,i.next_in+n),t),i.state.wrap===1?i.adler=zE(i.adler,e,n,t):i.state.wrap===2&&(i.adler=ga(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},$gt=(i,e)=>{let t=i.max_chain_length,M=i.strstart,n,r,o=i.prev_length,a=i.nice_match,s=i.strstart>i.w_size-eD?i.strstart-(i.w_size-eD):0,l=i.window,N=i.w_mask,c=i.prev,D=i.strstart+_j,I=l[M+o-1],d=l[M+o];i.prev_length>=i.good_match&&(t>>=2),a>i.lookahead&&(a=i.lookahead);do if(n=e,!(l[n+o]!==d||l[n+o-1]!==I||l[n]!==l[M]||l[++n]!==l[M+1])){M+=2,n++;do;while(l[++M]===l[++n]&&l[++M]===l[++n]&&l[++M]===l[++n]&&l[++M]===l[++n]&&l[++M]===l[++n]&&l[++M]===l[++n]&&l[++M]===l[++n]&&l[++M]===l[++n]&&M<D);if(r=_j-(D-M),M=D-_j,r>o){if(i.match_start=e,o=r,r>=a)break;I=l[M+o-1],d=l[M+o]}}while((e=c[e&N])>s&&--t!==0);return o<=i.lookahead?o:i.lookahead},T0=i=>{let e=i.w_size,t,M,n;do{if(M=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-eD)&&(i.window.set(i.window.subarray(e,e+e-M),0),i.match_start-=e,i.strstart-=e,i.block_start-=e,i.insert>i.strstart&&(i.insert=i.strstart),DBt(i),M+=e),i.strm.avail_in===0)break;if(t=sH(i.strm,i.window,i.strstart+i.lookahead,M),i.lookahead+=t,i.legacy_hash){if(i.lookahead+i.insert>=QM)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=DH(i,i.ins_h,i.window[n+1]);i.insert&&(_A(i,n),n++,i.insert--,!(i.lookahead+i.insert<QM)););}else if(i.lookahead+i.insert>QM)for(n=i.strstart-i.insert;i.insert&&(_A(i,n),n++,i.insert--,!(i.lookahead+i.insert<=QM)););}while(i.lookahead<eD&&i.strm.avail_in!==0)},Xgt=(i,e)=>{let t=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,M,n,r,o=0,a=i.strm.avail_in;do{if(M=65535,r=i.bi_valid+42>>3,i.strm.avail_out<r||(r=i.strm.avail_out-r,n=i.strstart-i.block_start,M>n+i.strm.avail_in&&(M=n+i.strm.avail_in),M>r&&(M=r),M<t&&(M===0&&e!==WN||e===Pj||M!==n+i.strm.avail_in)))break;o=e===WN&&M===n+i.strm.avail_in?1:0,iH(i,0,0,o),i.pending_buf[i.pending-4]=M,i.pending_buf[i.pending-3]=M>>8,i.pending_buf[i.pending-2]=~M,i.pending_buf[i.pending-1]=~M>>8,Zg(i.strm),n&&(n>M&&(n=M),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+n),i.strm.next_out),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n,i.block_start+=n,M-=n),M&&(sH(i.strm,i.strm.output,i.strm.next_out,M),i.strm.next_out+=M,i.strm.avail_out-=M,i.strm.total_out+=M)}while(o===0);return a-=i.strm.avail_in,a&&(a>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=a&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-a,i.strm.next_in),i.strstart),i.strstart+=a,i.insert+=a>i.w_size-i.insert?i.w_size-i.insert:a),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),o?x0:e!==Pj&&e!==WN&&i.strm.avail_in===0&&i.strstart===i.block_start?h0:(r=i.window_size-i.strstart,i.strm.avail_in>r&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,r+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),r>i.strm.avail_in&&(r=i.strm.avail_in),r&&(sH(i.strm,i.window,i.strstart,r),i.strstart+=r,i.insert+=r>i.w_size-i.insert?i.w_size-i.insert:r),i.high_water<i.strstart&&(i.high_water=i.strstart),r=i.bi_valid+42>>3,r=i.pending_buf_size-r>65535?65535:i.pending_buf_size-r,t=r>i.w_size?i.w_size:r,n=i.strstart-i.block_start,(n>=t||(n||e===WN)&&e!==Pj&&i.strm.avail_in===0&&n<=r)&&(M=n>r?r:n,o=e===WN&&i.strm.avail_in===0&&M===n?1:0,iH(i,i.block_start,M,o),i.block_start+=M,Zg(i.strm)),o?ZA:Xs)},BF=(i,e)=>{let t,M;for(;;){if(i.lookahead<eD){if(T0(i),i.lookahead<eD&&e===Pj)return Xs;if(i.lookahead===0)break}if(t=0,i.lookahead>=QM&&(t=_A(i,i.strstart)),t!==0&&i.strstart-t<=i.w_size-eD&&(i.match_length=$gt(i,t)),i.match_length>=QM)if(M=Wj(i,i.strstart-i.match_start,i.match_length-QM),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=QM){i.match_length--;do i.strstart++,t=_A(i,i.strstart);while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.legacy_hash&&(i.ins_h=i.window[i.strstart],i.ins_h=DH(i,i.ins_h,i.window[i.strstart+1]));else M=Wj(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(M&&(_g(i,!1),i.strm.avail_out===0))return Xs}return i.insert=i.strstart<QM-1?i.strstart:QM-1,e===WN?(_g(i,!0),i.strm.avail_out===0?ZA:x0):i.sym_next&&(_g(i,!1),i.strm.avail_out===0)?Xs:h0},D0=(i,e)=>{let t,M,n;for(;;){if(i.lookahead<eD){if(T0(i),i.lookahead<eD&&e===Pj)return Xs;if(i.lookahead===0)break}if(t=0,i.lookahead>=QM&&(t=_A(i,i.strstart)),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=QM-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-eD&&(i.match_length=$gt(i,t),i.match_length<=5&&(i.strategy===qVt||i.match_length===QM&&i.strstart-i.match_start>4096)&&(i.match_length=QM-1)),i.prev_length>=QM&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-QM,M=Wj(i,i.strstart-1-i.prev_match,i.prev_length-QM),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(t=_A(i,i.strstart));while(--i.prev_length!==0);if(i.match_available=0,i.match_length=QM-1,i.strstart++,M&&(_g(i,!1),i.strm.avail_out===0))return Xs}else if(i.match_available){if(M=Wj(i,0,i.window[i.strstart-1]),M&&_g(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return Xs}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(M=Wj(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<QM-1?i.strstart:QM-1,e===WN?(_g(i,!0),i.strm.avail_out===0?ZA:x0):i.sym_next&&(_g(i,!1),i.strm.avail_out===0)?Xs:h0},IBt=(i,e)=>{let t,M,n,r,o=i.window;for(;;){if(i.lookahead<=_j){if(T0(i),i.lookahead<=_j&&e===Pj)return Xs;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=QM&&i.strstart>0&&(n=i.strstart-1,M=o[n],M===o[++n]&&M===o[++n]&&M===o[++n])){r=i.strstart+_j;do;while(M===o[++n]&&M===o[++n]&&M===o[++n]&&M===o[++n]&&M===o[++n]&&M===o[++n]&&M===o[++n]&&M===o[++n]&&n<r);i.match_length=_j-(r-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=QM?(t=Wj(i,1,i.match_length-QM),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=Wj(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(_g(i,!1),i.strm.avail_out===0))return Xs}return i.insert=0,e===WN?(_g(i,!0),i.strm.avail_out===0?ZA:x0):i.sym_next&&(_g(i,!1),i.strm.avail_out===0)?Xs:h0},dBt=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(T0(i),i.lookahead===0)){if(e===Pj)return Xs;break}if(i.match_length=0,t=Wj(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(_g(i,!1),i.strm.avail_out===0))return Xs}return i.insert=0,e===WN?(_g(i,!0),i.strm.avail_out===0?ZA:x0):i.sym_next&&(_g(i,!1),i.strm.avail_out===0)?Xs:h0};function $c(i,e,t,M,n){this.good_length=i,this.max_lazy=e,this.nice_length=t,this.max_chain=M,this.func=n}var cE=[new $c(0,0,0,0,Xgt),new $c(4,4,8,4,BF),new $c(4,5,16,8,BF),new $c(4,6,32,32,BF),new $c(4,4,16,16,D0),new $c(8,16,32,32,D0),new $c(8,16,128,128,D0),new $c(8,32,128,256,D0),new $c(32,128,258,1024,D0),new $c(32,258,258,4096,D0)],jBt=i=>{i.window_size=2*i.w_size,Zj(i.head),i.max_lazy_match=cE[i.level].max_lazy,i.good_match=cE[i.level].good_length,i.nice_match=cE[i.level].nice_length,i.max_chain_length=cE[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=QM-1,i.match_available=0,i.ins_h=0};function yBt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=gQ,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.legacy_hash=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(gBt*2),this.dyn_dtree=new Uint16Array((2*sBt+1)*2),this.bl_tree=new Uint16Array((2*lBt+1)*2),Zj(this.dyn_ltree),Zj(this.dyn_dtree),Zj(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(NBt+1),this.heap=new Uint16Array(2*MH+1),Zj(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*MH+1),Zj(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var LE=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==y0&&e.status!==cH&&e.status!==nH&&e.status!==rH&&e.status!==oH&&e.status!==aH&&e.status!==UA&&e.status!==uE?1:0},qgt=i=>{if(LE(i))return vA(i,Kc);i.total_in=i.total_out=0,i.data_type=iBt;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?cH:e.wrap?y0:UA,i.adler=e.wrap===2?0:1,e.last_flush=-2,BVt(e),Wa},Kgt=i=>{let e=qgt(i);return e===Wa&&jBt(i.state),e},TBt=(i,e)=>LE(i)||i.state.wrap!==2?Kc:(i.state.gzhead=e,Wa),eNt=(i,e,t,M,n,r,o)=>{if(!i)return Kc;let a=1;if(e===XVt&&(e=6),M<0?(a=0,M=-M):M>15&&(a=2,M-=16),n<1||n>MBt||t!==gQ||M<8||M>15||e<0||e>9||r<0||r>eBt||M===8&&a!==1)return vA(i,Kc);M===8&&(M=9);let s=new yBt;return i.state=s,s.strm=i,s.status=y0,s.wrap=a,s.gzhead=null,s.w_bits=M,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.legacy_hash=o?1:0,s.hash_bits=n+7,!s.legacy_hash&&s.hash_bits<15&&(s.hash_bits=15),s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+QM-1)/QM),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=r,s.method=t,Kgt(i)},ABt=(i,e)=>eNt(i,e,gQ,nBt,rBt,tBt),zBt=(i,e)=>{if(LE(i)||e>egt||e<0)return i?vA(i,Kc):Kc;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===uE&&e!==WN)return vA(i,i.avail_out===0?VF:Kc);let M=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Zg(i),i.avail_out===0)return t.last_flush=-1,Wa}else if(i.avail_in===0&&igt(e)<=igt(M)&&e!==WN)return vA(i,VF);if(t.status===uE&&i.avail_in!==0)return vA(i,VF);if(t.status===y0&&t.wrap===0&&(t.status=UA),t.status===y0){let n=gQ+(t.w_bits-8<<4)<<8,r=-1;if(t.strategy>=tQ||t.level<2?r=0:t.level<6?r=1:t.level===6?r=2:r=3,n|=r<<6,t.strstart!==0&&(n|=uBt),n+=31-n%31,NE(t,n),t.strstart!==0&&(NE(t,i.adler>>>16),NE(t,i.adler&65535)),i.adler=1,t.status=UA,Zg(i),t.pending!==0)return t.last_flush=-1,Wa}if(t.status===cH){if(i.adler=0,$M(t,31),$M(t,139),$M(t,8),t.gzhead)$M(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),$M(t,t.gzhead.time&255),$M(t,t.gzhead.time>>8&255),$M(t,t.gzhead.time>>16&255),$M(t,t.gzhead.time>>24&255),$M(t,t.level===9?2:t.strategy>=tQ||t.level<2?4:0),$M(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&($M(t,t.gzhead.extra.length&255),$M(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=ga(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=nH;else if($M(t,0),$M(t,0),$M(t,0),$M(t,0),$M(t,0),$M(t,t.level===9?2:t.strategy>=tQ||t.level<2?4:0),$M(t,cBt),t.status=UA,Zg(i),t.pending!==0)return t.last_flush=-1,Wa}if(t.status===nH){if(t.gzhead.extra){let n=t.pending,r=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+r>t.pending_buf_size;){let a=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(i.adler=ga(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=a,Zg(i),t.pending!==0)return t.last_flush=-1,Wa;n=0,r-=a}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+r),t.pending),t.pending+=r,t.gzhead.hcrc&&t.pending>n&&(i.adler=ga(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=rH}if(t.status===rH){if(t.gzhead.name){let n=t.pending,r;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=ga(i.adler,t.pending_buf,t.pending-n,n)),Zg(i),t.pending!==0)return t.last_flush=-1,Wa;n=0}t.gzindex<t.gzhead.name.length?r=t.gzhead.name.charCodeAt(t.gzindex++)&255:r=0,$M(t,r)}while(r!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=ga(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=oH}if(t.status===oH){if(t.gzhead.comment){let n=t.pending,r;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=ga(i.adler,t.pending_buf,t.pending-n,n)),Zg(i),t.pending!==0)return t.last_flush=-1,Wa;n=0}t.gzindex<t.gzhead.comment.length?r=t.gzhead.comment.charCodeAt(t.gzindex++)&255:r=0,$M(t,r)}while(r!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=ga(i.adler,t.pending_buf,t.pending-n,n))}t.status=aH}if(t.status===aH){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Zg(i),t.pending!==0))return t.last_flush=-1,Wa;$M(t,i.adler&255),$M(t,i.adler>>8&255),i.adler=0}if(t.status=UA,Zg(i),t.pending!==0)return t.last_flush=-1,Wa}if(i.avail_in!==0||t.lookahead!==0||e!==Pj&&t.status!==uE){let n=t.level===0?Xgt(t,e):t.strategy===tQ?dBt(t,e):t.strategy===KVt?IBt(t,e):cE[t.level].func(t,e);if((n===ZA||n===x0)&&(t.status=uE),n===Xs||n===ZA)return i.avail_out===0&&(t.last_flush=-1),Wa;if(n===h0&&(e===JVt?HVt(t):e!==egt&&(iH(t,0,0,!1),e===GVt&&(Zj(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Zg(i),i.avail_out===0))return t.last_flush=-1,Wa}return e!==WN?Wa:t.wrap<=0?tgt:(t.wrap===2?($M(t,i.adler&255),$M(t,i.adler>>8&255),$M(t,i.adler>>16&255),$M(t,i.adler>>24&255),$M(t,i.total_in&255),$M(t,i.total_in>>8&255),$M(t,i.total_in>>16&255),$M(t,i.total_in>>24&255)):(NE(t,i.adler>>>16),NE(t,i.adler&65535)),Zg(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Wa:tgt)},hBt=i=>{if(LE(i))return Kc;let e=i.state.status;return i.state=null,e===UA?vA(i,$Vt):Wa},xBt=(i,e)=>{let t=e.length;if(LE(i))return Kc;let M=i.state,n=M.wrap;if(n===2||n===1&&M.status!==y0||M.lookahead)return Kc;if(n===1&&(i.adler=zE(i.adler,e,t,0)),M.wrap=0,t>=M.w_size){n===0&&(Zj(M.head),M.strstart=0,M.block_start=0,M.insert=0);let s=new Uint8Array(M.w_size);s.set(e.subarray(t-M.w_size,t),0),e=s,t=M.w_size}let r=i.avail_in,o=i.next_in,a=i.input;for(i.avail_in=t,i.next_in=0,i.input=e,T0(M);M.lookahead>=QM;){let s=M.strstart,l=M.lookahead-(QM-1);do _A(M,s),s++;while(--l);M.strstart=s,M.lookahead=QM-1,T0(M)}return M.strstart+=M.lookahead,M.block_start=M.strstart,M.insert=M.lookahead,M.lookahead=0,M.match_length=M.prev_length=QM-1,M.match_available=0,i.next_in=o,i.input=a,i.avail_in=r,M.wrap=n,Wa},pBt=ABt,LBt=eNt,OBt=Kgt,mBt=qgt,EBt=TBt,fBt=zBt,SBt=hBt,wBt=xBt,CBt="pako deflate (from Nodeca project)",IE={deflateInit:pBt,deflateInit2:LBt,deflateReset:OBt,deflateResetKeep:mBt,deflateSetHeader:EBt,deflate:fBt,deflateEnd:SBt,deflateSetDictionary:wBt,deflateInfo:CBt},kBt=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),bBt=function(i){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let M in t)kBt(t,M)&&(i[M]=t[M])}}return i},QBt=i=>{let e=0;for(let M=0,n=i.length;M<n;M++)e+=i[M].length;let t=new Uint8Array(e);for(let M=0,n=0,r=i.length;M<r;M++){let o=i[M];t.set(o,n),n+=o.length}return t},NQ={assign:bBt,flattenChunks:QBt},tNt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{tNt=!1}var hE=new Uint8Array(256);for(let i=0;i<256;i++)hE[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;hE[254]=hE[255]=1;var UBt=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let e,t,M,n,r,o=i.length,a=0;for(n=0;n<o;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<o&&(M=i.charCodeAt(n+1),(M&64512)===56320&&(t=65536+(t-55296<<10)+(M-56320),n++)),a+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(a),r=0,n=0;r<a;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<o&&(M=i.charCodeAt(n+1),(M&64512)===56320&&(t=65536+(t-55296<<10)+(M-56320),n++)),t<128?e[r++]=t:t<2048?(e[r++]=192|t>>>6,e[r++]=128|t&63):t<65536?(e[r++]=224|t>>>12,e[r++]=128|t>>>6&63,e[r++]=128|t&63):(e[r++]=240|t>>>18,e[r++]=128|t>>>12&63,e[r++]=128|t>>>6&63,e[r++]=128|t&63);return e},vBt=(i,e)=>{if(e<65534&&i.subarray&&tNt)return String.fromCharCode.apply(null,i.length===e?i:i.subarray(0,e));let t="";for(let M=0;M<e;M++)t+=String.fromCharCode(i[M]);return t},YBt=(i,e)=>{let t=e||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,e));let M,n,r=new Array(t*2);for(n=0,M=0;M<t;){let o=i[M++];if(o<128){r[n++]=o;continue}let a=hE[o];if(a>4){r[n++]=65533,M+=a-1;continue}for(o&=a===2?31:a===3?15:7;a>1&&M<t;)o=o<<6|i[M++]&63,a--;if(a>1){r[n++]=65533;continue}o<65536?r[n++]=o:(o-=65536,r[n++]=55296|o>>10&1023,r[n++]=56320|o&1023)}return vBt(r,n)},ZBt=(i,e)=>{e=e||i.length,e>i.length&&(e=i.length);let t=e-1;for(;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+hE[i[t]]>e?t:e},xE={string2buf:UBt,buf2string:YBt,utf8border:ZBt};function _Bt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var iNt=_Bt,MNt=Object.prototype.toString,{Z_NO_FLUSH:WBt,Z_SYNC_FLUSH:PBt,Z_FULL_FLUSH:RBt,Z_FINISH:VBt,Z_OK:sQ,Z_STREAM_END:BBt,Z_DEFAULT_COMPRESSION:FBt,Z_DEFAULT_STRATEGY:HBt,Z_DEFLATED:JBt}=z0,GBt={level:FBt,method:JBt,chunkSize:16384,windowBits:15,memLevel:8,strategy:HBt,legacyHash:!0};function OE(i){this.options=NQ.assign({},GBt,i||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new iNt,this.strm.avail_out=0;let t=IE.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy,e.legacyHash);if(t!==sQ)throw new Error(YA[t]);if(e.header&&IE.deflateSetHeader(this.strm,e.header),e.dictionary){let M;if(typeof e.dictionary=="string"?M=xE.string2buf(e.dictionary):MNt.call(e.dictionary)==="[object ArrayBuffer]"?M=new Uint8Array(e.dictionary):M=e.dictionary,t=IE.deflateSetDictionary(this.strm,M),t!==sQ)throw new Error(YA[t]);this._dict_set=!0}}OE.prototype.push=function(i,e){let t=this.strm,M=this.options.chunkSize,n,r;if(this.ended)return!1;for(e===~~e?r=e:r=e===!0?VBt:WBt,typeof i=="string"?t.input=xE.string2buf(i):MNt.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(M),t.next_out=0,t.avail_out=M),(r===PBt||r===RBt)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=IE.deflate(t,r),n===BBt)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=IE.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===sQ;if(t.avail_out===0){this.onData(t.output);continue}if(r>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};OE.prototype.onData=function(i){this.chunks.push(i)};OE.prototype.onEnd=function(i){i===sQ&&(this.result=NQ.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function IH(i,e){let t=new OE(e);if(t.push(i,!0),t.err)throw t.msg||YA[t.err];return t.result}function $Bt(i,e){return e=e||{},e.raw=!0,IH(i,e)}function XBt(i,e){return e=e||{},e.gzip=!0,IH(i,e)}var qBt=OE,KBt=IH,eFt=$Bt,tFt=XBt,iFt=z0,MFt={Deflate:qBt,deflate:KBt,deflateRaw:eFt,gzip:tFt,constants:iFt},iQ=16209,nFt=16191,rFt=function(e,t){let M,n,r,o,a,s,l,N,c,D,I,d,y,A,z,E,S,O,v,Z,B,q,W,Ne,_=e.state;M=e.next_in,W=e.input,n=M+(e.avail_in-5),r=e.next_out,Ne=e.output,o=r-(t-e.avail_out),a=r+(e.avail_out-257),s=_.dmax,l=_.wsize,N=_.whave,c=_.wnext,D=_.window,I=_.hold,d=_.bits,y=_.lencode,A=_.distcode,z=(1<<_.lenbits)-1,E=(1<<_.distbits)-1;e:do{d<15&&(I+=W[M++]<<d,d+=8,I+=W[M++]<<d,d+=8),S=y[I&z];t:for(;;){if(O=S>>>24,I>>>=O,d-=O,O=S>>>16&255,O===0)Ne[r++]=S&65535;else if(O&16){v=S&65535,O&=15,O&&(d<O&&(I+=W[M++]<<d,d+=8),v+=I&(1<<O)-1,I>>>=O,d-=O),d<15&&(I+=W[M++]<<d,d+=8,I+=W[M++]<<d,d+=8),S=A[I&E];i:for(;;){if(O=S>>>24,I>>>=O,d-=O,O=S>>>16&255,O&16){if(Z=S&65535,O&=15,d<O&&(I+=W[M++]<<d,d+=8,d<O&&(I+=W[M++]<<d,d+=8)),Z+=I&(1<<O)-1,Z>s){e.msg="invalid distance too far back",_.mode=iQ;break e}if(I>>>=O,d-=O,O=r-o,Z>O){if(O=Z-O,O>N&&_.sane){e.msg="invalid distance too far back",_.mode=iQ;break e}if(B=0,q=D,c===0){if(B+=l-O,O<v){v-=O;do Ne[r++]=D[B++];while(--O);B=r-Z,q=Ne}}else if(c<O){if(B+=l+c-O,O-=c,O<v){v-=O;do Ne[r++]=D[B++];while(--O);if(B=0,c<v){O=c,v-=O;do Ne[r++]=D[B++];while(--O);B=r-Z,q=Ne}}}else if(B+=c-O,O<v){v-=O;do Ne[r++]=D[B++];while(--O);B=r-Z,q=Ne}for(;v>2;)Ne[r++]=q[B++],Ne[r++]=q[B++],Ne[r++]=q[B++],v-=3;v&&(Ne[r++]=q[B++],v>1&&(Ne[r++]=q[B++]))}else{B=r-Z;do Ne[r++]=Ne[B++],Ne[r++]=Ne[B++],Ne[r++]=Ne[B++],v-=3;while(v>2);v&&(Ne[r++]=Ne[B++],v>1&&(Ne[r++]=Ne[B++]))}}else if((O&64)===0){S=A[(S&65535)+(I&(1<<O)-1)];continue i}else{e.msg="invalid distance code",_.mode=iQ;break e}break}}else if((O&64)===0){S=y[(S&65535)+(I&(1<<O)-1)];continue t}else if(O&32){_.mode=nFt;break e}else{e.msg="invalid literal/length code",_.mode=iQ;break e}break}}while(M<n&&r<a);v=d>>3,M-=v,d-=v<<3,I&=(1<<d)-1,e.next_in=M,e.next_out=r,e.avail_in=M<n?5+(n-M):5-(M-n),e.avail_out=r<a?257+(a-r):257-(r-a),_.hold=I,_.bits=d},I0=15,Mgt=852,ngt=592,rgt=0,FF=1,ogt=2,oFt=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),aFt=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,199,75]),sFt=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),lFt=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),gFt=(i,e,t,M,n,r,o,a)=>{let s=a.bits,l=0,N=0,c=0,D=0,I=0,d=0,y=0,A=0,z=0,E=0,S,O,v,Z,B,q=null,W,Ne=new Uint16Array(I0+1),_=new Uint16Array(I0+1),X=null,ne,ae,pe;for(l=0;l<=I0;l++)Ne[l]=0;for(N=0;N<M;N++)Ne[e[t+N]]++;for(I=s,D=I0;D>=1&&Ne[D]===0;D--);if(I>D&&(I=D),D===0)return n[r++]=1<<24|64<<16|0,n[r++]=1<<24|64<<16|0,a.bits=1,0;for(c=1;c<D&&Ne[c]===0;c++);for(I<c&&(I=c),A=1,l=1;l<=I0;l++)if(A<<=1,A-=Ne[l],A<0)return-1;if(A>0&&(i===rgt||D!==1))return-1;for(_[1]=0,l=1;l<I0;l++)_[l+1]=_[l]+Ne[l];for(N=0;N<M;N++)e[t+N]!==0&&(o[_[e[t+N]]++]=N);if(i===rgt?(q=X=o,W=20):i===FF?(q=oFt,X=aFt,W=257):(q=sFt,X=lFt,W=0),E=0,N=0,l=c,B=r,d=I,y=0,v=-1,z=1<<I,Z=z-1,i===FF&&z>Mgt||i===ogt&&z>ngt)return 1;for(;;){ne=l-y,o[N]+1<W?(ae=0,pe=o[N]):o[N]>=W?(ae=X[o[N]-W],pe=q[o[N]-W]):(ae=96,pe=0),S=1<<l-y,O=1<<d,c=O;do O-=S,n[B+(E>>y)+O]=ne<<24|ae<<16|pe|0;while(O!==0);for(S=1<<l-1;E&S;)S>>=1;if(S!==0?(E&=S-1,E+=S):E=0,N++,--Ne[l]===0){if(l===D)break;l=e[t+o[N]]}if(l>I&&(E&Z)!==v){for(y===0&&(y=I),B+=c,d=l-y,A=1<<d;d+y<D&&(A-=Ne[d+y],!(A<=0));)d++,A<<=1;if(z+=1<<d,i===FF&&z>Mgt||i===ogt&&z>ngt)return 1;v=E&Z,n[v]=I<<24|d<<16|B-r|0}}return E!==0&&(n[B+E]=l-y<<24|64<<16|0),a.bits=I,0},dE=gFt,NFt=0,nNt=1,rNt=2,{Z_FINISH:agt,Z_BLOCK:uFt,Z_TREES:MQ,Z_OK:WA,Z_STREAM_END:cFt,Z_NEED_DICT:DFt,Z_STREAM_ERROR:PN,Z_DATA_ERROR:oNt,Z_MEM_ERROR:aNt,Z_BUF_ERROR:IFt,Z_DEFLATED:sgt}=z0,uQ=16180,lgt=16181,ggt=16182,Ngt=16183,ugt=16184,cgt=16185,Dgt=16186,Igt=16187,dgt=16188,jgt=16189,lQ=16190,PI=16191,HF=16192,ygt=16193,JF=16194,Tgt=16195,Agt=16196,zgt=16197,hgt=16198,nQ=16199,rQ=16200,xgt=16201,pgt=16202,Lgt=16203,Ogt=16204,mgt=16205,GF=16206,Egt=16207,fgt=16208,pr=16209,sNt=16210,lNt=16211,dFt=852,jFt=592,yFt=15,TFt=yFt,Sgt=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function AFt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var PA=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<uQ||e.mode>lNt?1:0},gNt=i=>{if(PA(i))return PN;let e=i.state;return i.total_in=i.total_out=e.total=0,i.msg="",e.wrap&&(i.adler=e.wrap&1),e.mode=uQ,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(dFt),e.distcode=e.distdyn=new Int32Array(jFt),e.sane=1,e.back=-1,WA},NNt=i=>{if(PA(i))return PN;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,gNt(i)},uNt=(i,e)=>{let t;if(PA(i))return PN;let M=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?PN:(M.window!==null&&M.wbits!==e&&(M.window=null),M.wrap=t,M.wbits=e,NNt(i))},cNt=(i,e)=>{if(!i)return PN;let t=new AFt;i.state=t,t.strm=i,t.window=null,t.mode=uQ;let M=uNt(i,e);return M!==WA&&(i.state=null),M},zFt=i=>cNt(i,TFt),wgt=!0,$F,XF,hFt=i=>{if(wgt){$F=new Int32Array(512),XF=new Int32Array(32);let e=0;for(;e<144;)i.lens[e++]=8;for(;e<256;)i.lens[e++]=9;for(;e<280;)i.lens[e++]=7;for(;e<288;)i.lens[e++]=8;for(dE(nNt,i.lens,0,288,$F,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;dE(rNt,i.lens,0,32,XF,0,i.work,{bits:5}),wgt=!1}i.lencode=$F,i.lenbits=9,i.distcode=XF,i.distbits=5},DNt=(i,e,t,M)=>{let n,r=i.state;return r.window===null&&(r.window=new Uint8Array(1<<r.wbits)),r.wsize===0&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0),M>=r.wsize?(r.window.set(e.subarray(t-r.wsize,t),0),r.wnext=0,r.whave=r.wsize):(n=r.wsize-r.wnext,n>M&&(n=M),r.window.set(e.subarray(t-M,t-M+n),r.wnext),M-=n,M?(r.window.set(e.subarray(t-M,t),0),r.wnext=M,r.whave=r.wsize):(r.wnext+=n,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=n))),0},xFt=(i,e)=>{let t,M,n,r,o,a,s,l,N,c,D,I,d,y,A=0,z,E,S,O,v,Z,B,q,W=new Uint8Array(4),Ne,_,X=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(PA(i)||!i.output||!i.input&&i.avail_in!==0)return PN;t=i.state,t.mode===PI&&(t.mode=HF),o=i.next_out,n=i.output,s=i.avail_out,r=i.next_in,M=i.input,a=i.avail_in,l=t.hold,N=t.bits,c=a,D=s,q=WA;e:for(;;)switch(t.mode){case uQ:if(t.wrap===0){t.mode=HF;break}for(;N<16;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if(t.wrap&2&&l===35615){t.wbits===0&&(t.wbits=15),t.check=0,W[0]=l&255,W[1]=l>>>8&255,t.check=ga(t.check,W,2,0),l=0,N=0,t.mode=lgt;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){i.msg="incorrect header check",t.mode=pr;break}if((l&15)!==sgt){i.msg="unknown compression method",t.mode=pr;break}if(l>>>=4,N-=4,B=(l&15)+8,t.wbits===0&&(t.wbits=B),B>15||B>t.wbits){i.msg="invalid window size",t.mode=pr;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=l&512?jgt:PI,l=0,N=0;break;case lgt:for(;N<16;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if(t.flags=l,(t.flags&255)!==sgt){i.msg="unknown compression method",t.mode=pr;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=pr;break}t.head&&(t.head.text=l>>8&1),t.flags&512&&t.wrap&4&&(W[0]=l&255,W[1]=l>>>8&255,t.check=ga(t.check,W,2,0)),l=0,N=0,t.mode=ggt;case ggt:for(;N<32;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}t.head&&(t.head.time=l),t.flags&512&&t.wrap&4&&(W[0]=l&255,W[1]=l>>>8&255,W[2]=l>>>16&255,W[3]=l>>>24&255,t.check=ga(t.check,W,4,0)),l=0,N=0,t.mode=Ngt;case Ngt:for(;N<16;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}t.head&&(t.head.xflags=l&255,t.head.os=l>>8),t.flags&512&&t.wrap&4&&(W[0]=l&255,W[1]=l>>>8&255,t.check=ga(t.check,W,2,0)),l=0,N=0,t.mode=ugt;case ugt:if(t.flags&1024){for(;N<16;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}t.length=l,t.head&&(t.head.extra_len=l),t.flags&512&&t.wrap&4&&(W[0]=l&255,W[1]=l>>>8&255,t.check=ga(t.check,W,2,0)),l=0,N=0}else t.head&&(t.head.extra=null);t.mode=cgt;case cgt:if(t.flags&1024&&(I=t.length,I>a&&(I=a),I&&(t.head&&(B=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(M.subarray(r,r+I),B)),t.flags&512&&t.wrap&4&&(t.check=ga(t.check,M,I,r)),a-=I,r+=I,t.length-=I),t.length))break e;t.length=0,t.mode=Dgt;case Dgt:if(t.flags&2048){if(a===0)break e;I=0;do B=M[r+I++],t.head&&B&&t.length<65536&&(t.head.name+=String.fromCharCode(B));while(B&&I<a);if(t.flags&512&&t.wrap&4&&(t.check=ga(t.check,M,I,r)),a-=I,r+=I,B)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Igt;case Igt:if(t.flags&4096){if(a===0)break e;I=0;do B=M[r+I++],t.head&&B&&t.length<65536&&(t.head.comment+=String.fromCharCode(B));while(B&&I<a);if(t.flags&512&&t.wrap&4&&(t.check=ga(t.check,M,I,r)),a-=I,r+=I,B)break e}else t.head&&(t.head.comment=null);t.mode=dgt;case dgt:if(t.flags&512){for(;N<16;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if(t.wrap&4&&l!==(t.check&65535)){i.msg="header crc mismatch",t.mode=pr;break}l=0,N=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=PI;break;case jgt:for(;N<32;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}i.adler=t.check=Sgt(l),l=0,N=0,t.mode=lQ;case lQ:if(t.havedict===0)return i.next_out=o,i.avail_out=s,i.next_in=r,i.avail_in=a,t.hold=l,t.bits=N,DFt;i.adler=t.check=1,t.mode=PI;case PI:if(e===uFt||e===MQ)break e;case HF:if(t.last){l>>>=N&7,N-=N&7,t.mode=GF;break}for(;N<3;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}switch(t.last=l&1,l>>>=1,N-=1,l&3){case 0:t.mode=ygt;break;case 1:if(hFt(t),t.mode=nQ,e===MQ){l>>>=2,N-=2;break e}break;case 2:t.mode=Agt;break;case 3:i.msg="invalid block type",t.mode=pr}l>>>=2,N-=2;break;case ygt:for(l>>>=N&7,N-=N&7;N<32;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if((l&65535)!==(l>>>16^65535)){i.msg="invalid stored block lengths",t.mode=pr;break}if(t.length=l&65535,l=0,N=0,t.mode=JF,e===MQ)break e;case JF:t.mode=Tgt;case Tgt:if(I=t.length,I){if(I>a&&(I=a),I>s&&(I=s),I===0)break e;n.set(M.subarray(r,r+I),o),a-=I,r+=I,s-=I,o+=I,t.length-=I;break}t.mode=PI;break;case Agt:for(;N<14;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if(t.nlen=(l&31)+257,l>>>=5,N-=5,t.ndist=(l&31)+1,l>>>=5,N-=5,t.ncode=(l&15)+4,l>>>=4,N-=4,t.nlen>286||t.ndist>30){i.msg="too many length or distance symbols",t.mode=pr;break}t.have=0,t.mode=zgt;case zgt:for(;t.have<t.ncode;){for(;N<3;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}t.lens[X[t.have++]]=l&7,l>>>=3,N-=3}for(;t.have<19;)t.lens[X[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,Ne={bits:t.lenbits},q=dE(NFt,t.lens,0,19,t.lencode,0,t.work,Ne),t.lenbits=Ne.bits,q){i.msg="invalid code lengths set",t.mode=pr;break}t.have=0,t.mode=hgt;case hgt:for(;t.have<t.nlen+t.ndist;){for(;A=t.lencode[l&(1<<t.lenbits)-1],z=A>>>24,E=A>>>16&255,S=A&65535,!(z<=N);){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if(S<16)l>>>=z,N-=z,t.lens[t.have++]=S;else{if(S===16){for(_=z+2;N<_;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if(l>>>=z,N-=z,t.have===0){i.msg="invalid bit length repeat",t.mode=pr;break}B=t.lens[t.have-1],I=3+(l&3),l>>>=2,N-=2}else if(S===17){for(_=z+3;N<_;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}l>>>=z,N-=z,B=0,I=3+(l&7),l>>>=3,N-=3}else{for(_=z+7;N<_;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}l>>>=z,N-=z,B=0,I=11+(l&127),l>>>=7,N-=7}if(t.have+I>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=pr;break}for(;I--;)t.lens[t.have++]=B}}if(t.mode===pr)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=pr;break}if(t.lenbits=9,Ne={bits:t.lenbits},q=dE(nNt,t.lens,0,t.nlen,t.lencode,0,t.work,Ne),t.lenbits=Ne.bits,q){i.msg="invalid literal/lengths set",t.mode=pr;break}if(t.distbits=6,t.distcode=t.distdyn,Ne={bits:t.distbits},q=dE(rNt,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,Ne),t.distbits=Ne.bits,q){i.msg="invalid distances set",t.mode=pr;break}if(t.mode=nQ,e===MQ)break e;case nQ:t.mode=rQ;case rQ:if(a>=6&&s>=258){i.next_out=o,i.avail_out=s,i.next_in=r,i.avail_in=a,t.hold=l,t.bits=N,rFt(i,D),o=i.next_out,n=i.output,s=i.avail_out,r=i.next_in,M=i.input,a=i.avail_in,l=t.hold,N=t.bits,t.mode===PI&&(t.back=-1);break}for(t.back=0;A=t.lencode[l&(1<<t.lenbits)-1],z=A>>>24,E=A>>>16&255,S=A&65535,!(z<=N);){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if(E&&(E&240)===0){for(O=z,v=E,Z=S;A=t.lencode[Z+((l&(1<<O+v)-1)>>O)],z=A>>>24,E=A>>>16&255,S=A&65535,!(O+z<=N);){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}l>>>=O,N-=O,t.back+=O}if(l>>>=z,N-=z,t.back+=z,t.length=S,E===0){t.mode=mgt;break}if(E&32){t.back=-1,t.mode=PI;break}if(E&64){i.msg="invalid literal/length code",t.mode=pr;break}t.extra=E&15,t.mode=xgt;case xgt:if(t.extra){for(_=t.extra;N<_;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}t.length+=l&(1<<t.extra)-1,l>>>=t.extra,N-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=pgt;case pgt:for(;A=t.distcode[l&(1<<t.distbits)-1],z=A>>>24,E=A>>>16&255,S=A&65535,!(z<=N);){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if((E&240)===0){for(O=z,v=E,Z=S;A=t.distcode[Z+((l&(1<<O+v)-1)>>O)],z=A>>>24,E=A>>>16&255,S=A&65535,!(O+z<=N);){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}l>>>=O,N-=O,t.back+=O}if(l>>>=z,N-=z,t.back+=z,E&64){i.msg="invalid distance code",t.mode=pr;break}t.offset=S,t.extra=E&15,t.mode=Lgt;case Lgt:if(t.extra){for(_=t.extra;N<_;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}t.offset+=l&(1<<t.extra)-1,l>>>=t.extra,N-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){i.msg="invalid distance too far back",t.mode=pr;break}t.mode=Ogt;case Ogt:if(s===0)break e;if(I=D-s,t.offset>I){if(I=t.offset-I,I>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=pr;break}I>t.wnext?(I-=t.wnext,d=t.wsize-I):d=t.wnext-I,I>t.length&&(I=t.length),y=t.window}else y=n,d=o-t.offset,I=t.length;I>s&&(I=s),s-=I,t.length-=I;do n[o++]=y[d++];while(--I);t.length===0&&(t.mode=rQ);break;case mgt:if(s===0)break e;n[o++]=t.length,s--,t.mode=rQ;break;case GF:if(t.wrap){for(;N<32;){if(a===0)break e;a--,l|=M[r++]<<N,N+=8}if(D-=s,i.total_out+=D,t.total+=D,t.wrap&4&&D&&(i.adler=t.check=t.flags?ga(t.check,n,D,o-D):zE(t.check,n,D,o-D)),D=s,t.wrap&4&&(t.flags?l:Sgt(l))!==t.check){i.msg="incorrect data check",t.mode=pr;break}l=0,N=0}t.mode=Egt;case Egt:if(t.wrap&&t.flags){for(;N<32;){if(a===0)break e;a--,l+=M[r++]<<N,N+=8}if(t.wrap&4&&l!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=pr;break}l=0,N=0}t.mode=fgt;case fgt:q=cFt;break e;case pr:q=oNt;break e;case sNt:return aNt;case lNt:default:return PN}return i.next_out=o,i.avail_out=s,i.next_in=r,i.avail_in=a,t.hold=l,t.bits=N,(t.wsize||D!==i.avail_out&&t.mode<pr&&(t.mode<GF||e!==agt))&&DNt(i,i.output,i.next_out,D-i.avail_out),c-=i.avail_in,D-=i.avail_out,i.total_in+=c,i.total_out+=D,t.total+=D,t.wrap&4&&D&&(i.adler=t.check=t.flags?ga(t.check,n,D,i.next_out-D):zE(t.check,n,D,i.next_out-D)),i.data_type=t.bits+(t.last?64:0)+(t.mode===PI?128:0)+(t.mode===nQ||t.mode===JF?256:0),(c===0&&D===0||e===agt)&&q===WA&&(q=IFt),q},pFt=i=>{if(PA(i))return PN;let e=i.state;return e.window&&(e.window=null),i.state=null,WA},LFt=(i,e)=>{if(PA(i))return PN;let t=i.state;return(t.wrap&2)===0?PN:(t.head=e,e.done=!1,WA)},OFt=(i,e)=>{let t=e.length,M,n,r;return PA(i)||(M=i.state,M.wrap!==0&&M.mode!==lQ)?PN:M.mode===lQ&&(n=1,n=zE(n,e,t,0),n!==M.check)?oNt:(r=DNt(i,e,t,t),r?(M.mode=sNt,aNt):(M.havedict=1,WA))},mFt=NNt,EFt=uNt,fFt=gNt,SFt=zFt,wFt=cNt,CFt=xFt,kFt=pFt,bFt=LFt,QFt=OFt,UFt="pako inflate (from Nodeca project)",Xc={inflateReset:mFt,inflateReset2:EFt,inflateResetKeep:fFt,inflateInit:SFt,inflateInit2:wFt,inflate:CFt,inflateEnd:kFt,inflateGetHeader:bFt,inflateSetDictionary:QFt,inflateInfo:UFt};function vFt(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var YFt=vFt,INt=Object.prototype.toString,{Z_NO_FLUSH:ZFt,Z_FINISH:Cgt,Z_OK:j0,Z_STREAM_END:qF,Z_NEED_DICT:KF,Z_STREAM_ERROR:_Ft,Z_DATA_ERROR:kgt,Z_MEM_ERROR:WFt,Z_BUF_ERROR:bgt}=z0,PFt={chunkSize:1024*64,windowBits:15,to:""};function mE(i){this.options=NQ.assign({},PFt,i||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(i&&i.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new iNt,this.strm.avail_out=0;let t=Xc.inflateInit2(this.strm,e.windowBits);if(t!==j0)throw new Error(YA[t]);if(this.header=new YFt,Xc.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=xE.string2buf(e.dictionary):INt.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Xc.inflateSetDictionary(this.strm,e.dictionary),t!==j0)))throw new Error(YA[t])}mE.prototype.push=function(i,e){let t=this.strm,M=this.options.chunkSize,n=this.options.dictionary,r,o,a;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?Cgt:ZFt,INt.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(M),t.next_out=0,t.avail_out=M),r=Xc.inflate(t,o),r===KF&&n&&(r=Xc.inflateSetDictionary(t,n),r===j0?r=Xc.inflate(t,o):r===kgt&&(r=KF));t.avail_in>0&&r===qF&&t.state.wrap&2&&t.state.flags!==0&&t.input[t.next_in]!==0;)Xc.inflateReset(t),r=Xc.inflate(t,o);switch(r){case _Ft:case kgt:case KF:case WFt:return this.onEnd(r),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||r===qF||o>0))if(this.options.to==="string"){let s=xE.utf8border(t.output,t.next_out),l=t.next_out-s,N=xE.buf2string(t.output,s);t.next_out=l,t.avail_out=M-l,l&&t.output.set(t.output.subarray(s,s+l),0),this.onData(N)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out)),t.avail_out=0,t.next_out=0;if(!((r===j0||r===bgt)&&a===0)){if(r===qF)return r=Xc.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(t.avail_in===0){if(o===Cgt)return r=Xc.inflateEnd(this.strm),this.onEnd(r===j0?bgt:r),this.ended=!0,!1;break}}}return!0};mE.prototype.onData=function(i){this.chunks.push(i)};mE.prototype.onEnd=function(i){i===j0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=NQ.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function dH(i,e){let t=new mE(e);if(t.push(i,!0),t.err)throw t.msg||YA[t.err];return t.result}function RFt(i,e){return e=e||{},e.raw=!0,dH(i,e)}var VFt=mE,BFt=dH,FFt=RFt,HFt=dH,JFt=z0,GFt={Inflate:VFt,inflate:BFt,inflateRaw:FFt,ungzip:HFt,constants:JFt},{Deflate:Jzr,deflate:Gzr,deflateRaw:$zr,gzip:Xzr}=MFt,{Inflate:$Ft,inflate:XFt,inflateRaw:qzr,ungzip:Kzr}=GFt;var jH=$Ft,dNt=XFt;var yNt=[];for(let i=0;i<256;i++){let e=i;for(let t=0;t<8;t++)e&1?e=3988292384^e>>>1:e=e>>>1;yNt[i]=e}var jNt=4294967295;function qFt(i,e,t){let M=i;for(let n=0;n<t;n++)M=yNt[(M^e[n])&255]^M>>>8;return M}function KFt(i,e){return(qFt(jNt,i,e)^jNt)>>>0}function yH(i,e,t){let M=i.readUint32(),n=KFt(new Uint8Array(i.buffer,i.byteOffset+i.offset-e-4,e),e);if(n!==M)throw new Error(`CRC mismatch for chunk ${t}. Expected ${M}, found ${n}`)}function cQ(i,e,t){for(let M=0;M<t;M++)e[M]=i[M]}function DQ(i,e,t,M){let n=0;for(;n<M;n++)e[n]=i[n];for(;n<t;n++)e[n]=i[n]+e[n-M]&255}function IQ(i,e,t,M){let n=0;if(t.length===0)for(;n<M;n++)e[n]=i[n];else for(;n<M;n++)e[n]=i[n]+t[n]&255}function dQ(i,e,t,M,n){let r=0;if(t.length===0){for(;r<n;r++)e[r]=i[r];for(;r<M;r++)e[r]=i[r]+(e[r-n]>>1)&255}else{for(;r<n;r++)e[r]=i[r]+(t[r]>>1)&255;for(;r<M;r++)e[r]=i[r]+(e[r-n]+t[r]>>1)&255}}function jQ(i,e,t,M,n){let r=0;if(t.length===0){for(;r<n;r++)e[r]=i[r];for(;r<M;r++)e[r]=i[r]+e[r-n]&255}else{for(;r<n;r++)e[r]=i[r]+t[r]&255;for(;r<M;r++)e[r]=i[r]+eHt(e[r-n],t[r],t[r-n])&255}}function eHt(i,e,t){let M=i+e-t,n=Math.abs(M-i),r=Math.abs(M-e),o=Math.abs(M-t);return n<=r&&n<=o?i:r<=o?e:t}function TNt(i,e,t,M,n,r){switch(i){case 0:cQ(e,t,n);break;case 1:DQ(e,t,n,r);break;case 2:IQ(e,t,M,n);break;case 3:dQ(e,t,M,n,r);break;case 4:jQ(e,t,M,n,r);break;default:throw new Error(`Unsupported filter: ${i}`)}}var tHt=new Uint16Array([255]),iHt=new Uint8Array(tHt.buffer),MHt=iHt[0]===255;function ANt(i){let{data:e,width:t,height:M,channels:n,depth:r}=i,o=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],a=Math.ceil(r/8)*n,s=new Uint8Array(M*t*a),l=0;for(let N=0;N<7;N++){let c=o[N],D=Math.ceil((t-c.x)/c.xStep),I=Math.ceil((M-c.y)/c.yStep);if(D<=0||I<=0)continue;let d=D*a,y=new Uint8Array(d);for(let A=0;A<I;A++){let z=e[l++],E=e.subarray(l,l+d);l+=d;let S=new Uint8Array(d);TNt(z,E,S,y,d,a),y.set(S);for(let O=0;O<D;O++){let v=c.x+O*c.xStep,Z=c.y+A*c.yStep;if(!(v>=t||Z>=M))for(let B=0;B<a;B++)s[(Z*t+v)*a+B]=S[O*a+B]}}}if(r===16){let N=new Uint16Array(s.buffer);if(MHt)for(let c=0;c<N.length;c++)N[c]=nHt(N[c]);return N}else return s}function nHt(i){return(i&255)<<8|i>>8&255}var rHt=new Uint16Array([255]),oHt=new Uint8Array(rHt.buffer),aHt=oHt[0]===255,sHt=new Uint8Array(0);function TH(i){let{data:e,width:t,height:M,channels:n,depth:r}=i,o=Math.ceil(r/8)*n,a=Math.ceil(r/8*n*t),s=new Uint8Array(M*a),l=sHt,N=0,c,D;for(let I=0;I<M;I++){switch(c=e.subarray(N+1,N+1+a),D=s.subarray(I*a,(I+1)*a),e[N]){case 0:cQ(c,D,a);break;case 1:DQ(c,D,a,o);break;case 2:IQ(c,D,l,a);break;case 3:dQ(c,D,l,a,o);break;case 4:jQ(c,D,l,a,o);break;default:throw new Error(`Unsupported filter: ${e[N]}`)}l=D,N+=a+1}if(r===16){let I=new Uint16Array(s.buffer);if(aHt)for(let d=0;d<I.length;d++)I[d]=lHt(I[d]);return I}else return s}function lHt(i){return(i&255)<<8|i>>8&255}var yQ=Uint8Array.of(137,80,78,71,13,10,26,10);function AH(i){if(!zNt(i.readBytes(yQ.length)))throw new Error("wrong PNG signature")}function zNt(i){if(i.length<yQ.length)return!1;for(let e=0;e<yQ.length;e++)if(i[e]!==yQ[e])return!1;return!0}var hNt="tEXt",NHt=0,xNt=new TextDecoder("latin1");function uHt(i){if(DHt(i),i.length===0||i.length>79)throw new Error("keyword length must be between 1 and 79")}var cHt=/^[\u0000-\u00FF]*$/;function DHt(i){if(!cHt.test(i))throw new Error("invalid latin1 text")}function pNt(i,e,t){let M=zH(e);i[M]=IHt(e,t-M.length-1)}function zH(i){for(i.mark();i.readByte()!==NHt;);let e=i.offset;i.reset();let t=xNt.decode(i.readBytes(e-i.offset-1));return i.skip(1),uHt(t),t}function IHt(i,e){return xNt.decode(i.readBytes(e))}var qs={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},EE={UNKNOWN:-1,DEFLATE:0},TQ={UNKNOWN:-1,ADAPTIVE:0},fE={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},SE={NONE:0,BACKGROUND:1,PREVIOUS:2},AQ={SOURCE:0,OVER:1};var zQ=class extends gE{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(e,t={}){super(e);let{checkCrc:M=!1}=t;this._checkCrc=M,this._inflator=new jH,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=EE.UNKNOWN,this._filterMethod=TQ.UNKNOWN,this._interlaceMethod=fE.UNKNOWN,this._colorType=qs.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(AH(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeChunk(e,t)}return this.decodeImage(),this._png}decodeApng(){for(AH(this);!this._end;){let e=this.readUint32(),t=this.readChars(4);this.decodeApngChunk(e,t)}return this.decodeApngImage(),this._apng}decodeChunk(e,t){let M=this.offset;switch(t){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(e);break;case"IDAT":this.decodeIDAT(e);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(e);break;case"iCCP":this.decodeiCCP(e);break;case hNt:pNt(this._png.text,this,e);break;case"pHYs":this.decodepHYs();break;default:this.skip(e);break}if(this.offset-M!==e)throw new Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?yH(this,e+4,t):this.skip(4)}decodeApngChunk(e,t){let M=this.offset;switch(t!=="fdAT"&&t!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),t){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(e);break;default:this.decodeChunk(e,t),this.offset=M+e;break}if(this.offset-M!==e)throw new Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?yH(this,e+4,t):this.skip(4)}decodeIHDR(){let e=this._png;e.width=this.readUint32(),e.height=this.readUint32(),e.depth=dHt(this.readUint8());let t=this.readUint8();this._colorType=t;let M;switch(t){case qs.GREYSCALE:M=1;break;case qs.TRUECOLOUR:M=3;break;case qs.INDEXED_COLOUR:M=1;break;case qs.GREYSCALE_ALPHA:M=2;break;case qs.TRUECOLOUR_ALPHA:M=4;break;case qs.UNKNOWN:default:throw new Error(`Unknown color type: ${t}`)}if(this._png.channels=M,this._compressionMethod=this.readUint8(),this._compressionMethod!==EE.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){let e={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(e)}decodePLTE(e){if(e%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${e}`);let t=e/3;this._hasPalette=!0;let M=[];this._palette=M;for(let n=0;n<t;n++)M.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(e){this._writingDataChunks=!0;let t=e,M=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,M,t)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(e)}decodeFDAT(e){this._writingDataChunks=!0;let t=e,M=this.offset+this.byteOffset;if(M+=4,t-=4,this._inflator.push(new Uint8Array(this.buffer,M,t)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(e)}decodetRNS(e){switch(this._colorType){case qs.GREYSCALE:case qs.TRUECOLOUR:{if(e%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${e}`);if(e/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${e/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(e/2);for(let t=0;t<e/2;t++)this._transparency[t]=this.readUint16();break}case qs.INDEXED_COLOUR:{if(e>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${e} vs ${this._palette.length})`);let t=0;for(;t<e;t++){let M=this.readByte();this._palette[t].push(M)}for(;t<this._palette.length;t++)this._palette[t].push(255);break}case qs.UNKNOWN:case qs.GREYSCALE_ALPHA:case qs.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(e){let t=zH(this),M=this.readUint8();if(M!==EE.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${M}`);let n=this.readBytes(e-t.length-2);this._png.iccEmbeddedProfile={name:t,profile:dNt(n)}}decodepHYs(){let e=this.readUint32(),t=this.readUint32(),M=this.readByte();this._png.resolution={x:e,y:t,unit:M}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let e=0;e<this._numberOfFrames;e++){let t={sequenceNumber:this._frames[e].sequenceNumber,delayNumber:this._frames[e].delayNumber,delayDenominator:this._frames[e].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},M=this._frames.at(e);if(M){if(M.data=TH({data:M.data,width:M.width,height:M.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),e===0||M.xOffset===0&&M.yOffset===0&&M.width===this._png.width&&M.height===this._png.height)t.data=M.data;else{let n=this._apng.frames.at(e-1);this.disposeFrame(M,n,t),this.addFrameDataToCanvas(t,M)}this._apng.frames.push(t)}}return this._apng}disposeFrame(e,t,M){switch(e.disposeOp){case SE.NONE:break;case SE.BACKGROUND:for(let n=0;n<this._png.height;n++)for(let r=0;r<this._png.width;r++){let o=(n*e.width+r)*this._png.channels;for(let a=0;a<this._png.channels;a++)M.data[o+a]=0}break;case SE.PREVIOUS:M.data.set(t.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(e,t){let M=1<<this._png.depth,n=(r,o)=>{let a=((r+t.yOffset)*this._png.width+t.xOffset+o)*this._png.channels,s=(r*t.width+o)*this._png.channels;return{index:a,frameIndex:s}};switch(t.blendOp){case AQ.SOURCE:for(let r=0;r<t.height;r++)for(let o=0;o<t.width;o++){let{index:a,frameIndex:s}=n(r,o);for(let l=0;l<this._png.channels;l++)e.data[a+l]=t.data[s+l]}break;case AQ.OVER:for(let r=0;r<t.height;r++)for(let o=0;o<t.width;o++){let{index:a,frameIndex:s}=n(r,o);for(let l=0;l<this._png.channels;l++){let N=t.data[s+this._png.channels-1]/M,c=l%(this._png.channels-1)===0?1:t.data[s+l],D=Math.floor(N*c+(1-N)*e.data[a+l]);e.data[a+l]+=D}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);let e=this._isAnimated?(this._frames?.at(0)).data:this._inflator.result;if(this._filterMethod!==TQ.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===fE.NO_INTERLACE)this._png.data=TH({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===fE.ADAM7)this._png.data=ANt({data:e,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){let e=this._inflator.result,t=this._frames.at(-1);t?t.data=e:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:SE.NONE,blendOp:AQ.SOURCE,data:e}),this._inflator=new jH,this._writingDataChunks=!1}};function dHt(i){if(i!==1&&i!==2&&i!==4&&i!==8&&i!==16)throw new Error(`invalid bit depth: ${i}`);return i}function LNt(i,e){return new zQ(i,e).decode()}var Ui=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function hH(){Ui.console&&typeof Ui.console.log=="function"&&Ui.console.log.apply(Ui.console,arguments)}var Kn={log:hH,warn:function(i){Ui.console&&(typeof Ui.console.warn=="function"?Ui.console.warn.apply(Ui.console,arguments):hH.call(null,arguments))},error:function(i){Ui.console&&(typeof Ui.console.error=="function"?Ui.console.error.apply(Ui.console,arguments):hH(i))}};function xH(i,e,t){var M=new XMLHttpRequest;M.open("GET",i),M.responseType="blob",M.onload=function(){RA(M.response,e,t)},M.onerror=function(){Kn.error("could not download file")},M.send()}function ONt(i){var e=new XMLHttpRequest;e.open("HEAD",i,!1);try{e.send()}catch{}return e.status>=200&&e.status<=299}function hQ(i){try{i.dispatchEvent(new MouseEvent("click"))}catch{var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),i.dispatchEvent(e)}}var RA=Ui.saveAs||((typeof window>"u"?"undefined":vn(window))!=="object"||window!==Ui?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(i,e,t){var M=Ui.URL||Ui.webkitURL,n=document.createElement("a");e=e||i.name||"download",n.download=e,n.rel="noopener",typeof i=="string"?(n.href=i,n.origin!==location.origin?ONt(n.href)?xH(i,e,t):hQ(n,n.target="_blank"):hQ(n)):(n.href=M.createObjectURL(i),setTimeout(function(){M.revokeObjectURL(n.href)},4e4),setTimeout(function(){hQ(n)},0))}:"msSaveOrOpenBlob"in navigator?function(i,e,t){if(e=e||i.name||"download",typeof i=="string")if(ONt(i))xH(i,e,t);else{var M=document.createElement("a");M.href=i,M.target="_blank",setTimeout(function(){hQ(M)})}else navigator.msSaveOrOpenBlob((function(n,r){return r===void 0?r={autoBom:!1}:vn(r)!=="object"&&(Kn.warn("Deprecated: Expected third argument to be a object"),r={autoBom:!r}),r.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(n.type)?new Blob(["\uFEFF",n],{type:n.type}):n})(i,t),e)}:function(i,e,t,M){if((M=M||open("","_blank"))&&(M.document.title=M.document.body.innerText="downloading..."),typeof i=="string")return xH(i,e,t);var n=i.type==="application/octet-stream",r=/constructor/i.test(Ui.HTMLElement)||Ui.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||n&&r)&&(typeof FileReader>"u"?"undefined":vn(FileReader))==="object"){var a=new FileReader;a.onloadend=function(){var N=a.result;N=o?N:N.replace(/^data:[^;]*;/,"data:attachment/file;"),M?M.location.href=N:location=N,M=null},a.readAsDataURL(i)}else{var s=Ui.URL||Ui.webkitURL,l=s.createObjectURL(i);M?M.location=l:location.href=l,M=null,setTimeout(function(){s.revokeObjectURL(l)},4e4)}});function $Nt(i){var e;i=i||"",this.ok=!1,i.charAt(0)=="#"&&(i=i.substr(1,6)),i={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[i=(i=i.replace(/ /g,"")).toLowerCase()]||i;for(var t=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],M=0;M<t.length;M++){var n=t[M].re,r=t[M].process,o=n.exec(i);o&&(e=r(o),this.r=e[0],this.g=e[1],this.b=e[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var a=this.r.toString(16),s=this.g.toString(16),l=this.b.toString(16);return a.length==1&&(a="0"+a),s.length==1&&(s="0"+s),l.length==1&&(l="0"+l),"#"+a+s+l}}var OQ=Ui.atob.bind(Ui),mNt=Ui.btoa.bind(Ui);function pH(i,e){var t=i[0],M=i[1],n=i[2],r=i[3];t=Ts(t,M,n,r,e[0],7,-680876936),r=Ts(r,t,M,n,e[1],12,-389564586),n=Ts(n,r,t,M,e[2],17,606105819),M=Ts(M,n,r,t,e[3],22,-1044525330),t=Ts(t,M,n,r,e[4],7,-176418897),r=Ts(r,t,M,n,e[5],12,1200080426),n=Ts(n,r,t,M,e[6],17,-1473231341),M=Ts(M,n,r,t,e[7],22,-45705983),t=Ts(t,M,n,r,e[8],7,1770035416),r=Ts(r,t,M,n,e[9],12,-1958414417),n=Ts(n,r,t,M,e[10],17,-42063),M=Ts(M,n,r,t,e[11],22,-1990404162),t=Ts(t,M,n,r,e[12],7,1804603682),r=Ts(r,t,M,n,e[13],12,-40341101),n=Ts(n,r,t,M,e[14],17,-1502002290),t=As(t,M=Ts(M,n,r,t,e[15],22,1236535329),n,r,e[1],5,-165796510),r=As(r,t,M,n,e[6],9,-1069501632),n=As(n,r,t,M,e[11],14,643717713),M=As(M,n,r,t,e[0],20,-373897302),t=As(t,M,n,r,e[5],5,-701558691),r=As(r,t,M,n,e[10],9,38016083),n=As(n,r,t,M,e[15],14,-660478335),M=As(M,n,r,t,e[4],20,-405537848),t=As(t,M,n,r,e[9],5,568446438),r=As(r,t,M,n,e[14],9,-1019803690),n=As(n,r,t,M,e[3],14,-187363961),M=As(M,n,r,t,e[8],20,1163531501),t=As(t,M,n,r,e[13],5,-1444681467),r=As(r,t,M,n,e[2],9,-51403784),n=As(n,r,t,M,e[7],14,1735328473),t=zs(t,M=As(M,n,r,t,e[12],20,-1926607734),n,r,e[5],4,-378558),r=zs(r,t,M,n,e[8],11,-2022574463),n=zs(n,r,t,M,e[11],16,1839030562),M=zs(M,n,r,t,e[14],23,-35309556),t=zs(t,M,n,r,e[1],4,-1530992060),r=zs(r,t,M,n,e[4],11,1272893353),n=zs(n,r,t,M,e[7],16,-155497632),M=zs(M,n,r,t,e[10],23,-1094730640),t=zs(t,M,n,r,e[13],4,681279174),r=zs(r,t,M,n,e[0],11,-358537222),n=zs(n,r,t,M,e[3],16,-722521979),M=zs(M,n,r,t,e[6],23,76029189),t=zs(t,M,n,r,e[9],4,-640364487),r=zs(r,t,M,n,e[12],11,-421815835),n=zs(n,r,t,M,e[15],16,530742520),t=hs(t,M=zs(M,n,r,t,e[2],23,-995338651),n,r,e[0],6,-198630844),r=hs(r,t,M,n,e[7],10,1126891415),n=hs(n,r,t,M,e[14],15,-1416354905),M=hs(M,n,r,t,e[5],21,-57434055),t=hs(t,M,n,r,e[12],6,1700485571),r=hs(r,t,M,n,e[3],10,-1894986606),n=hs(n,r,t,M,e[10],15,-1051523),M=hs(M,n,r,t,e[1],21,-2054922799),t=hs(t,M,n,r,e[8],6,1873313359),r=hs(r,t,M,n,e[15],10,-30611744),n=hs(n,r,t,M,e[6],15,-1560198380),M=hs(M,n,r,t,e[13],21,1309151649),t=hs(t,M,n,r,e[4],6,-145523070),r=hs(r,t,M,n,e[11],10,-1120210379),n=hs(n,r,t,M,e[2],15,718787259),M=hs(M,n,r,t,e[9],21,-343485551),i[0]=Vj(t,i[0]),i[1]=Vj(M,i[1]),i[2]=Vj(n,i[2]),i[3]=Vj(r,i[3])}function kQ(i,e,t,M,n,r){return e=Vj(Vj(e,i),Vj(M,r)),Vj(e<<n|e>>>32-n,t)}function Ts(i,e,t,M,n,r,o){return kQ(e&t|~e&M,i,e,n,r,o)}function As(i,e,t,M,n,r,o){return kQ(e&M|t&~M,i,e,n,r,o)}function zs(i,e,t,M,n,r,o){return kQ(e^t^M,i,e,n,r,o)}function hs(i,e,t,M,n,r,o){return kQ(t^(e|~M),i,e,n,r,o)}function XNt(i){var e,t=i.length,M=[1732584193,-271733879,-1732584194,271733878];for(e=64;e<=i.length;e+=64)pH(M,jHt(i.substring(e-64,e)));i=i.substring(e-64);var n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<i.length;e++)n[e>>2]|=i.charCodeAt(e)<<(e%4<<3);if(n[e>>2]|=128<<(e%4<<3),e>55)for(pH(M,n),e=0;e<16;e++)n[e]=0;return n[14]=8*t,pH(M,n),M}function jHt(i){var e,t=[];for(e=0;e<64;e+=4)t[e>>2]=i.charCodeAt(e)+(i.charCodeAt(e+1)<<8)+(i.charCodeAt(e+2)<<16)+(i.charCodeAt(e+3)<<24);return t}var ENt="0123456789abcdef".split("");function yHt(i){for(var e="",t=0;t<4;t++)e+=ENt[i>>8*t+4&15]+ENt[i>>8*t&15];return e}function THt(i){return String.fromCharCode(255&i,(65280&i)>>8,(16711680&i)>>16,(4278190080&i)>>24)}function SH(i){return XNt(i).map(THt).join("")}var AHt=(function(i){for(var e=0;e<i.length;e++)i[e]=yHt(i[e]);return i.join("")})(XNt("hello"))!="5d41402abc4b2a76b9719d911017c592";function Vj(i,e){if(AHt){var t=(65535&i)+(65535&e);return(i>>16)+(e>>16)+(t>>16)<<16|65535&t}return i+e&4294967295}function wH(i,e){var t,M,n,r;if(i!==t){for(var o=(n=i,r=1+(256/i.length|0),new Array(r+1).join(n)),a=[],s=0;s<256;s++)a[s]=s;var l=0;for(s=0;s<256;s++){var N=a[s];l=(l+N+o.charCodeAt(s))%256,a[s]=a[l],a[l]=N}t=i,M=a}else a=M;var c=e.length,D=0,I=0,d="";for(s=0;s<c;s++)I=(I+(N=a[D=(D+1)%256]))%256,a[D]=a[I],a[I]=N,o=a[(a[D]+a[I])%256],d+=String.fromCharCode(e.charCodeAt(s)^o);return d}var fNt={print:4,modify:8,copy:16,"annot-forms":32};function O0(i,e,t,M){this.v=1,this.r=2;var n=192;i.forEach(function(a){if(fNt.perm!==void 0)throw new Error("Invalid permission: "+a);n+=fNt[a]}),this.padding="(\xBFN^Nu\x8AAd\0NV\xFF\xFA\b..\0\xB6\xD0h>\x80/\f\xA9\xFEdSiz";var r=(e+this.padding).substr(0,32),o=(t+this.padding).substr(0,32);this.O=this.processOwnerPassword(r,o),this.P=-(1+(255^n)),this.encryptionKey=SH(r+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(M)).substr(0,5),this.U=wH(this.encryptionKey,this.padding)}function m0(i){if(/[^\u0000-\u00ff]/.test(i))throw new Error("Invalid PDF Name Object: "+i+", Only accept ASCII characters.");for(var e="",t=i.length,M=0;M<t;M++){var n=i.charCodeAt(M);e+=n<33||n===35||n===37||n===40||n===41||n===47||n===60||n===62||n===91||n===93||n===123||n===125||n>126?"#"+("0"+n.toString(16)).slice(-2):i[M]}return e}function SNt(i){if(vn(i)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var e={};this.subscribe=function(t,M,n){if(n=n||!1,typeof t!="string"||typeof M!="function"||typeof n!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");e.hasOwnProperty(t)||(e[t]={});var r=Math.random().toString(35);return e[t][r]=[M,!!n],r},this.unsubscribe=function(t){for(var M in e)if(e[M][t])return delete e[M][t],Object.keys(e[M]).length===0&&delete e[M],!0;return!1},this.publish=function(t){if(e.hasOwnProperty(t)){var M=Array.prototype.slice.call(arguments,1),n=[];for(var r in e[t]){var o=e[t][r];try{o[0].apply(i,M)}catch(a){Ui.console&&Kn.error("jsPDF PubSub Error",a.message,a)}o[1]&&n.push(r)}n.length&&n.forEach(this.unsubscribe)}},this.getTopics=function(){return e}}function wQ(i){if(!(this instanceof wQ))return new wQ(i);var e="opacity,stroke-opacity".split(",");for(var t in i)i.hasOwnProperty(t)&&e.indexOf(t)>=0&&(this[t]=i[t]);this.id="",this.objectNumber=-1}function qNt(i,e){this.gState=i,this.matrix=e,this.id="",this.objectNumber=-1}function VA(i,e,t,M,n){if(!(this instanceof VA))return new VA(i,e,t,M,n);this.type=i==="axial"?2:3,this.coords=e,this.colors=t,qNt.call(this,M,n)}function E0(i,e,t,M,n){if(!(this instanceof E0))return new E0(i,e,t,M,n);this.boundingBox=i,this.xStep=e,this.yStep=t,this.stream="",this.cloneIndex=0,qNt.call(this,M,n)}function Ii(i){var e,t=typeof arguments[0]=="string"?arguments[0]:"p",M=arguments[1],n=arguments[2],r=arguments[3],o=[],a=1,s=16,l="S",N=null;vn(i=i||{})==="object"&&(t=i.orientation,M=i.unit||M,n=i.format||n,r=i.compress||i.compressPdf||r,(N=i.encryption||null)!==null&&(N.userPassword=N.userPassword||"",N.ownerPassword=N.ownerPassword||"",N.userPermissions=N.userPermissions||[]),a=typeof i.userUnit=="number"?Math.abs(i.userUnit):1,i.precision!==void 0&&(e=i.precision),i.floatPrecision!==void 0&&(s=i.floatPrecision),l=i.defaultPathOperation||"S"),o=i.filters||(r===!0?["FlateEncode"]:o),M=M||"mm",t=(""+(t||"P")).toLowerCase();var c=i.putOnlyUsedFonts||!1,D={},I={internal:{},__private__:{}};I.__private__.PubSub=SNt;var d="1.3",y=I.__private__.getPdfVersion=function(){return d};I.__private__.setPdfVersion=function(m){d=m};var A={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};I.__private__.getPageFormats=function(){return A};var z=I.__private__.getPageFormat=function(m){return A[m]};n=n||"a4";var E="compat",S="advanced",O=E;function v(){this.saveGraphicsState(),ge(new hi(ai,0,0,-ai,0,Kj()*ai).toString()+" cm"),this.setFontSize(this.getFontSize()/ai),l="n",O=S}function Z(){this.restoreGraphicsState(),l="S",O=E}var B=I.__private__.combineFontStyleAndFontWeight=function(m,H){if(m=="bold"&&H=="normal"||m=="bold"&&H==400||m=="normal"&&H=="italic"||m=="bold"&&H=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return H&&(m=H==400||H==="normal"?m==="italic"?"italic":"normal":H!=700&&H!=="bold"||m!=="normal"?(H==700?"bold":H)+""+m:"bold"),m};I.advancedAPI=function(m){var H=O===E;return H&&v.call(this),typeof m!="function"||(m(this),H&&Z.call(this)),this},I.compatAPI=function(m){var H=O===S;return H&&Z.call(this),typeof m!="function"||(m(this),H&&v.call(this)),this},I.isAdvancedAPI=function(){return O===S};var q,W=function(m){if(O!==S)throw new Error(m+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},Ne=I.roundToPrecision=I.__private__.roundToPrecision=function(m,H){var ye=e||H;if(isNaN(m)||isNaN(ye))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return m.toFixed(ye).replace(/0+$/,"")};q=I.hpf=I.__private__.hpf=typeof s=="number"?function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.hpf");return Ne(m,s)}:s==="smart"?function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.hpf");return Ne(m,m>-1&&m<1?16:5)}:function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.hpf");return Ne(m,16)};var _=I.f2=I.__private__.f2=function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.f2");return Ne(m,2)},X=I.__private__.f3=function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.f3");return Ne(m,3)},ne=I.scale=I.__private__.scale=function(m){if(isNaN(m))throw new Error("Invalid argument passed to jsPDF.scale");return O===E?m*ai:O===S?m:void 0},ae=function(m){return ne((function(H){return O===E?Kj()-H:O===S?H:void 0})(m))};I.__private__.setPrecision=I.setPrecision=function(m){typeof parseInt(m,10)=="number"&&(e=parseInt(m,10))};var pe,Me="00000000000000000000000000000000",De=I.__private__.getFileId=function(){return Me},Ie=I.__private__.setFileId=function(m){return Me=m!==void 0&&/^[a-fA-F0-9]{32}$/.test(m)?m.toUpperCase():Me.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),N!==null&&(Eo=new O0(N.userPermissions,N.userPassword,N.ownerPassword,Me)),Me};I.setFileId=function(m){return Ie(m),this},I.getFileId=function(){return De()};var me=I.__private__.convertDateToPDFDate=function(m){var H=m.getTimezoneOffset(),ye=H<0?"+":"-",fe=Math.floor(Math.abs(H/60)),be=Math.abs(H%60),et=[ye,J(fe),"'",J(be),"'"].join("");return["D:",m.getFullYear(),J(m.getMonth()+1),J(m.getDate()),J(m.getHours()),J(m.getMinutes()),J(m.getSeconds()),et].join("")},Qe=I.__private__.convertPDFDateToDate=function(m){var H=parseInt(m.substr(2,4),10),ye=parseInt(m.substr(6,2),10)-1,fe=parseInt(m.substr(8,2),10),be=parseInt(m.substr(10,2),10),et=parseInt(m.substr(12,2),10),lt=parseInt(m.substr(14,2),10);return new Date(H,ye,fe,be,et,lt,0)},Ye=I.__private__.setCreationDate=function(m){var H;if(m===void 0&&(m=new Date),m instanceof Date)H=me(m);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(m))throw new Error("Invalid argument passed to jsPDF.setCreationDate");H=m}return pe=H},F=I.__private__.getCreationDate=function(m){var H=pe;return m==="jsDate"&&(H=Qe(pe)),H};I.setCreationDate=function(m){return Ye(m),this},I.getCreationDate=function(m){return F(m)};var le,J=I.__private__.padd2=function(m){return("0"+parseInt(m)).slice(-2)},ue=I.__private__.padd2Hex=function(m){return("00"+(m=m.toString())).substr(m.length)},ze=0,Ee=[],we=[],_e=0,Re=[],Be=[],Dt=!1,Ot=we;I.__private__.setCustomOutputDestination=function(m){Dt=!0,Ot=m};var Vt=function(m){Dt||(Ot=m)};I.__private__.resetCustomOutputDestination=function(){Dt=!1,Ot=we};var ge=I.__private__.out=function(m){return m=m.toString(),_e+=m.length+1,Ot.push(m),Ot},nt=I.__private__.write=function(m){return ge(arguments.length===1?m.toString():Array.prototype.join.call(arguments," "))},zi=I.__private__.getArrayBuffer=function(m){for(var H=m.length,ye=new ArrayBuffer(H),fe=new Uint8Array(ye);H--;)fe[H]=m.charCodeAt(H);return ye},st=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];I.__private__.getStandardFonts=function(){return st};var rt=i.fontSize||16;I.__private__.setFontSize=I.setFontSize=function(m){return rt=O===S?m/ai:m,this};var kt,jt=I.__private__.getFontSize=I.getFontSize=function(){return O===E?rt:rt*ai},ii=i.R2L||!1;I.__private__.setR2L=I.setR2L=function(m){return ii=m,this},I.__private__.getR2L=I.getR2L=function(){return ii};var Rt,MM=I.__private__.setZoomMode=function(m){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(m))kt=m;else if(isNaN(m)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(m)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+m+'" is not recognized.');kt=m}else kt=parseInt(m,10)};I.__private__.getZoomMode=function(){return kt};var Wi,qe=I.__private__.setPageMode=function(m){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(m)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+m+'" is not recognized.');Rt=m};I.__private__.getPageMode=function(){return Rt};var zt=I.__private__.setLayoutMode=function(m){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(m)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+m+'" is not recognized.');Wi=m};I.__private__.getLayoutMode=function(){return Wi},I.__private__.setDisplayMode=I.setDisplayMode=function(m,H,ye){return MM(m),zt(H),qe(ye),this};var wt={title:"",subject:"",author:"",keywords:"",creator:""};I.__private__.getDocumentProperty=function(m){if(Object.keys(wt).indexOf(m)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return wt[m]},I.__private__.getDocumentProperties=function(){return wt},I.__private__.setDocumentProperties=I.setProperties=I.setDocumentProperties=function(m){for(var H in wt)wt.hasOwnProperty(H)&&m[H]&&(wt[H]=m[H]);return this},I.__private__.setDocumentProperty=function(m,H){if(Object.keys(wt).indexOf(m)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return wt[m]=H};var Et,ai,Bt,gr,lM,We={},yt={},Pt=[],St={},Ni={},Jt={},Ai={},UM=null,Ki=0,di=[],AM=new SNt(I),Wg=i.hotfixes||[],Lr={},VN={},el=[],hi=function m(H,ye,fe,be,et,lt){if(!(this instanceof m))return new m(H,ye,fe,be,et,lt);isNaN(H)&&(H=1),isNaN(ye)&&(ye=0),isNaN(fe)&&(fe=0),isNaN(be)&&(be=1),isNaN(et)&&(et=0),isNaN(lt)&&(lt=0),this._matrix=[H,ye,fe,be,et,lt]};Object.defineProperty(hi.prototype,"sx",{get:function(){return this._matrix[0]},set:function(m){this._matrix[0]=m}}),Object.defineProperty(hi.prototype,"shy",{get:function(){return this._matrix[1]},set:function(m){this._matrix[1]=m}}),Object.defineProperty(hi.prototype,"shx",{get:function(){return this._matrix[2]},set:function(m){this._matrix[2]=m}}),Object.defineProperty(hi.prototype,"sy",{get:function(){return this._matrix[3]},set:function(m){this._matrix[3]=m}}),Object.defineProperty(hi.prototype,"tx",{get:function(){return this._matrix[4]},set:function(m){this._matrix[4]=m}}),Object.defineProperty(hi.prototype,"ty",{get:function(){return this._matrix[5]},set:function(m){this._matrix[5]=m}}),Object.defineProperty(hi.prototype,"a",{get:function(){return this._matrix[0]},set:function(m){this._matrix[0]=m}}),Object.defineProperty(hi.prototype,"b",{get:function(){return this._matrix[1]},set:function(m){this._matrix[1]=m}}),Object.defineProperty(hi.prototype,"c",{get:function(){return this._matrix[2]},set:function(m){this._matrix[2]=m}}),Object.defineProperty(hi.prototype,"d",{get:function(){return this._matrix[3]},set:function(m){this._matrix[3]=m}}),Object.defineProperty(hi.prototype,"e",{get:function(){return this._matrix[4]},set:function(m){this._matrix[4]=m}}),Object.defineProperty(hi.prototype,"f",{get:function(){return this._matrix[5]},set:function(m){this._matrix[5]=m}}),Object.defineProperty(hi.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(hi.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(hi.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(hi.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),hi.prototype.join=function(m){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(q).join(m)},hi.prototype.multiply=function(m){var H=m.sx*this.sx+m.shy*this.shx,ye=m.sx*this.shy+m.shy*this.sy,fe=m.shx*this.sx+m.sy*this.shx,be=m.shx*this.shy+m.sy*this.sy,et=m.tx*this.sx+m.ty*this.shx+this.tx,lt=m.tx*this.shy+m.ty*this.sy+this.ty;return new hi(H,ye,fe,be,et,lt)},hi.prototype.decompose=function(){var m=this.sx,H=this.shy,ye=this.shx,fe=this.sy,be=this.tx,et=this.ty,lt=Math.sqrt(m*m+H*H),Mi=(m/=lt)*ye+(H/=lt)*fe;ye-=m*Mi,fe-=H*Mi;var ci=Math.sqrt(ye*ye+fe*fe);return Mi/=ci,m*(fe/=ci)<H*(ye/=ci)&&(m=-m,H=-H,Mi=-Mi,lt=-lt),{scale:new hi(lt,0,0,ci,0,0),translate:new hi(1,0,0,1,be,et),rotate:new hi(m,H,-H,m,0,0),skew:new hi(1,0,Mi,1,0,0)}},hi.prototype.toString=function(m){return this.join(" ")},hi.prototype.inversed=function(){var m=this.sx,H=this.shy,ye=this.shx,fe=this.sy,be=this.tx,et=this.ty,lt=1/(m*fe-H*ye),Mi=fe*lt,ci=-H*lt,vi=-ye*lt,$i=m*lt;return new hi(Mi,ci,vi,$i,-Mi*be-vi*et,-ci*be-$i*et)},hi.prototype.applyToPoint=function(m){var H=m.x*this.sx+m.y*this.shx+this.tx,ye=m.x*this.shy+m.y*this.sy+this.ty;return new gD(H,ye)},hi.prototype.applyToRectangle=function(m){var H=this.applyToPoint(m),ye=this.applyToPoint(new gD(m.x+m.w,m.y+m.h));return new W0(H.x,H.y,ye.x-H.x,ye.y-H.y)},hi.prototype.clone=function(){var m=this.sx,H=this.shy,ye=this.shx,fe=this.sy,be=this.tx,et=this.ty;return new hi(m,H,ye,fe,be,et)},I.Matrix=hi;var nD=I.matrixMult=function(m,H){return H.multiply(m)},rD=new hi(1,0,0,1,0,0);I.unitMatrix=I.identityMatrix=rD;var Pg=function(m,H){if(!Ni[m]){var ye=(H instanceof VA?"Sh":"P")+(Object.keys(St).length+1).toString(10);H.id=ye,Ni[m]=ye,St[ye]=H,AM.publish("addPattern",H)}};I.ShadingPattern=VA,I.TilingPattern=E0,I.addShadingPattern=function(m,H){return W("addShadingPattern()"),Pg(m,H),this},I.beginTilingPattern=function(m){W("beginTilingPattern()"),P0(m.boundingBox[0],m.boundingBox[1],m.boundingBox[2]-m.boundingBox[0],m.boundingBox[3]-m.boundingBox[1],m.matrix)},I.endTilingPattern=function(m,H){W("endTilingPattern()"),H.stream=Be[le].join(`
|
|
@@ -40576,7 +40576,7 @@ endbfchar
|
|
|
40576
40576
|
CMapName currentdict /CMap defineresource pop
|
|
40577
40577
|
end
|
|
40578
40578
|
end`};e.events.push(["putFont",function(r){(function(o){var a=o.font,s=o.out,l=o.newObject,N=o.putStream;if(a.metadata instanceof i.API.TTFFont&&a.encoding==="Identity-H"){for(var c=a.metadata.Unicode.widths,D=a.metadata.subset.encode(a.metadata.glyIdsUsed,1),I="",d=0;d<D.length;d++)I+=String.fromCharCode(D[d]);var y=l();N({data:I,addLength1:!0,objectId:y}),s("endobj");var A=l();N({data:M(a.metadata.toUnicode),addLength1:!0,objectId:A}),s("endobj");var z=l();s("<<"),s("/Type /FontDescriptor"),s("/FontName /"+m0(a.fontName)),s("/FontFile2 "+y+" 0 R"),s("/FontBBox "+i.API.PDFObject.convert(a.metadata.bbox)),s("/Flags "+a.metadata.flags),s("/StemV "+a.metadata.stemV),s("/ItalicAngle "+a.metadata.italicAngle),s("/Ascent "+a.metadata.ascender),s("/Descent "+a.metadata.decender),s("/CapHeight "+a.metadata.capHeight),s(">>"),s("endobj");var E=l();s("<<"),s("/Type /Font"),s("/BaseFont /"+m0(a.fontName)),s("/FontDescriptor "+z+" 0 R"),s("/W "+i.API.PDFObject.convert(c)),s("/CIDToGIDMap /Identity"),s("/DW 1000"),s("/Subtype /CIDFontType2"),s("/CIDSystemInfo"),s("<<"),s("/Supplement 0"),s("/Registry (Adobe)"),s("/Ordering ("+a.encoding+")"),s(">>"),s(">>"),s("endobj"),a.objectNumber=l(),s("<<"),s("/Type /Font"),s("/Subtype /Type0"),s("/ToUnicode "+A+" 0 R"),s("/BaseFont /"+m0(a.fontName)),s("/Encoding /"+a.encoding),s("/DescendantFonts ["+E+" 0 R]"),s(">>"),s("endobj"),a.isAlreadyPutted=!0}})(r)}]),e.events.push(["putFont",function(r){(function(o){var a=o.font,s=o.out,l=o.newObject,N=o.putStream;if(a.metadata instanceof i.API.TTFFont&&a.encoding==="WinAnsiEncoding"){for(var c=a.metadata.rawData,D="",I=0;I<c.length;I++)D+=String.fromCharCode(c[I]);var d=l();N({data:D,addLength1:!0,objectId:d}),s("endobj");var y=l();N({data:M(a.metadata.toUnicode),addLength1:!0,objectId:y}),s("endobj");var A=l();s("<<"),s("/Descent "+a.metadata.decender),s("/CapHeight "+a.metadata.capHeight),s("/StemV "+a.metadata.stemV),s("/Type /FontDescriptor"),s("/FontFile2 "+d+" 0 R"),s("/Flags 96"),s("/FontBBox "+i.API.PDFObject.convert(a.metadata.bbox)),s("/FontName /"+m0(a.fontName)),s("/ItalicAngle "+a.metadata.italicAngle),s("/Ascent "+a.metadata.ascender),s(">>"),s("endobj"),a.objectNumber=l();for(var z=0;z<a.metadata.hmtx.widths.length;z++)a.metadata.hmtx.widths[z]=parseInt(a.metadata.hmtx.widths[z]*(1e3/a.metadata.head.unitsPerEm));s("<</Subtype/TrueType/Type/Font/ToUnicode "+y+" 0 R/BaseFont/"+m0(a.fontName)+"/FontDescriptor "+A+" 0 R/Encoding/"+a.encoding+" /FirstChar 29 /LastChar 255 /Widths "+i.API.PDFObject.convert(a.metadata.hmtx.widths)+">>"),s("endobj"),a.isAlreadyPutted=!0}})(r)}]);var n=function(r){var o,a=r.text||"",s=r.x,l=r.y,N=r.options||{},c=r.mutex||{},D=c.pdfEscape,I=c.activeFontKey,d=c.fonts,y=I,A="",z=0,E="",S=d[y].encoding;if(d[y].encoding!=="Identity-H")return{text:a,x:s,y:l,options:N,mutex:c};for(E=a,y=I,Array.isArray(a)&&(E=a[0]),z=0;z<E.length;z+=1)d[y].metadata.hasOwnProperty("cmap")&&(o=d[y].metadata.cmap.unicode.codeMap[E[z].charCodeAt(0)]),o||E[z].charCodeAt(0)<256&&d[y].metadata.hasOwnProperty("Unicode")?A+=E[z]:A+="";var O="";return parseInt(y.slice(1))<14||S==="WinAnsiEncoding"?O=D(A,y).split("").map(function(v){return v.charCodeAt(0).toString(16)}).join(""):S==="Identity-H"&&(O=t(A,d[y])),c.isHex=!0,{text:O,x:s,y:l,options:N,mutex:c}};e.events.push(["postProcessText",function(r){var o=r.text||"",a=[],s={text:o,x:r.x,y:r.y,options:r.options,mutex:r.mutex};if(Array.isArray(o)){var l=0;for(l=0;l<o.length;l+=1)Array.isArray(o[l])&&o[l].length===3?a.push([n(Object.assign({},s,{text:o[l][0]})).text,o[l][1],o[l][2]]):a.push(n(Object.assign({},s,{text:o[l]})).text);r.text=a}else r.text=n(Object.assign({},s,{text:o})).text}])})(Ii),(function(i){var e=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};i.existsFileInVFS=function(t){return e.call(this),this.internal.vFS[t]!==void 0},i.addFileToVFS=function(t,M){return e.call(this),this.internal.vFS[t]=M,this},i.getFileFromVFS=function(t){return e.call(this),this.internal.vFS[t]!==void 0?this.internal.vFS[t]:null}})(Ii.API),(function(i){i.__bidiEngine__=i.prototype.__bidiEngine__=function(M){var n,r,o,a,s,l,N,c=e,D=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],I=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],d={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},y={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},A=["(",")","(","<",">","<","[","]","[","{","}","{","\xAB","\xBB","\xAB","\u2039","\u203A","\u2039","\u2045","\u2046","\u2045","\u207D","\u207E","\u207D","\u208D","\u208E","\u208D","\u2264","\u2265","\u2264","\u2329","\u232A","\u2329","\uFE59","\uFE5A","\uFE59","\uFE5B","\uFE5C","\uFE5B","\uFE5D","\uFE5E","\uFE5D","\uFE64","\uFE65","\uFE64"],z=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),E=!1,S=0;this.__bidiEngine__={};var O=function(_){var X=_.charCodeAt(),ne=X>>8,ae=y[ne];return ae!==void 0?c[256*ae+(255&X)]:ne===252||ne===253?"AL":z.test(ne)?"L":ne===8?"R":"N"},v=function(_){for(var X,ne=0;ne<_.length;ne++){if((X=O(_.charAt(ne)))==="L")return!1;if(X==="R")return!0}return!1},Z=function(_,X,ne,ae){var pe,Me,De,Ie,me=X[ae];switch(me){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":E=!1;break;case"N":case"AN":break;case"EN":E&&(me="AN");break;case"AL":E=!0,me="R";break;case"WS":case"BN":me="N";break;case"CS":ae<1||ae+1>=X.length||(pe=ne[ae-1])!=="EN"&&pe!=="AN"||(Me=X[ae+1])!=="EN"&&Me!=="AN"?me="N":E&&(Me="AN"),me=Me===pe?Me:"N";break;case"ES":me=(pe=ae>0?ne[ae-1]:"B")==="EN"&&ae+1<X.length&&X[ae+1]==="EN"?"EN":"N";break;case"ET":if(ae>0&&ne[ae-1]==="EN"){me="EN";break}if(E){me="N";break}for(De=ae+1,Ie=X.length;De<Ie&&X[De]==="ET";)De++;me=De<Ie&&X[De]==="EN"?"EN":"N";break;case"NSM":if(o&&!a){for(Ie=X.length,De=ae+1;De<Ie&&X[De]==="NSM";)De++;if(De<Ie){var Qe=_[ae],Ye=Qe>=1425&&Qe<=2303||Qe===64286;if(pe=X[De],Ye&&(pe==="R"||pe==="AL")){me="R";break}}}me=ae<1||(pe=X[ae-1])==="B"?"N":ne[ae-1];break;case"B":E=!1,n=!0,me=S;break;case"S":r=!0,me="N"}return me},B=function(_,X,ne){var ae=_.split("");return ne&&q(ae,ne,{hiLevel:S}),ae.reverse(),X&&X.reverse(),ae.join("")},q=function(_,X,ne){var ae,pe,Me,De,Ie,me=-1,Qe=_.length,Ye=0,F=[],le=S?I:D,J=[];for(E=!1,n=!1,r=!1,pe=0;pe<Qe;pe++)J[pe]=O(_[pe]);for(Me=0;Me<Qe;Me++){if(Ie=Ye,F[Me]=Z(_,J,F,Me),ae=240&(Ye=le[Ie][d[F[Me]]]),Ye&=15,X[Me]=De=le[Ye][5],ae>0)if(ae===16){for(pe=me;pe<Me;pe++)X[pe]=1;me=-1}else me=-1;if(le[Ye][6])me===-1&&(me=Me);else if(me>-1){for(pe=me;pe<Me;pe++)X[pe]=De;me=-1}J[Me]==="B"&&(X[Me]=0),ne.hiLevel|=De}r&&(function(ue,ze,Ee){for(var we=0;we<Ee;we++)if(ue[we]==="S"){ze[we]=S;for(var _e=we-1;_e>=0&&ue[_e]==="WS";_e--)ze[_e]=S}})(J,X,Qe)},W=function(_,X,ne,ae,pe){if(!(pe.hiLevel<_)){if(_===1&&S===1&&!n)return X.reverse(),void(ne&&ne.reverse());for(var Me,De,Ie,me,Qe=X.length,Ye=0;Ye<Qe;){if(ae[Ye]>=_){for(Ie=Ye+1;Ie<Qe&&ae[Ie]>=_;)Ie++;for(me=Ye,De=Ie-1;me<De;me++,De--)Me=X[me],X[me]=X[De],X[De]=Me,ne&&(Me=ne[me],ne[me]=ne[De],ne[De]=Me);Ye=Ie}Ye++}}},Ne=function(_,X,ne){var ae=_.split(""),pe={hiLevel:S};return ne||(ne=[]),q(ae,ne,pe),(function(Me,De,Ie){if(Ie.hiLevel!==0&&N)for(var me,Qe=0;Qe<Me.length;Qe++)De[Qe]===1&&(me=A.indexOf(Me[Qe]))>=0&&(Me[Qe]=A[me+1])})(ae,ne,pe),W(2,ae,X,ne,pe),W(1,ae,X,ne,pe),ae.join("")};return this.__bidiEngine__.doBidiReorder=function(_,X,ne){if((function(pe,Me){if(Me)for(var De=0;De<pe.length;De++)Me[De]=De;a===void 0&&(a=v(pe)),l===void 0&&(l=v(pe))})(_,X),o||!s||l)if(o&&s&&a^l)S=a?1:0,_=B(_,X,ne);else if(!o&&s&&l)S=a?1:0,_=Ne(_,X,ne),_=B(_,X);else if(!o||a||s||l){if(o&&!s&&a^l)_=B(_,X),a?(S=0,_=Ne(_,X,ne)):(S=1,_=Ne(_,X,ne),_=B(_,X));else if(o&&a&&!s&&l)S=1,_=Ne(_,X,ne),_=B(_,X);else if(!o&&!s&&a^l){var ae=N;a?(S=1,_=Ne(_,X,ne),S=0,N=!1,_=Ne(_,X,ne),N=ae):(S=0,_=Ne(_,X,ne),_=B(_,X),S=1,N=!1,_=Ne(_,X,ne),N=ae,_=B(_,X))}}else S=0,_=Ne(_,X,ne);else S=a?1:0,_=Ne(_,X,ne);return _},this.__bidiEngine__.setOptions=function(_){_&&(o=_.isInputVisual,s=_.isOutputVisual,a=_.isInputRtl,l=_.isOutputRtl,N=_.isSymmetricSwapping)},this.__bidiEngine__.setOptions(M),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],t=new i.__bidiEngine__({isInputVisual:!0});i.API.events.push(["postProcessText",function(M){var n=M.text;M.x,M.y;var r=M.options||{};M.mutex,r.lang;var o=[];if(r.isInputVisual=typeof r.isInputVisual!="boolean"||r.isInputVisual,t.setOptions(r),Object.prototype.toString.call(n)==="[object Array]"){var a=0;for(o=[],a=0;a<n.length;a+=1)Object.prototype.toString.call(n[a])==="[object Array]"?o.push([t.doBidiReorder(n[a][0]),n[a][1],n[a][2]]):o.push([t.doBidiReorder(n[a])]);M.text=o}else M.text=t.doBidiReorder(n);t.setOptions({isInputVisual:!0})}])})(Ii),Ii.API.TTFFont=(function(){function i(e){var t;if(this.rawData=e,t=this.contents=new Bj(e),this.contents.pos=4,t.readString(4)==="ttcf")throw new Error("TTCF not supported.");t.pos=0,this.parse(),this.subset=new qHt(this),this.registerTTF()}return i.open=function(e){return new i(e)},i.prototype.parse=function(){return this.directory=new YHt(this.contents),this.head=new _Ht(this),this.name=new BHt(this),this.cmap=new aut(this),this.toUnicode={},this.hhea=new WHt(this),this.maxp=new FHt(this),this.hmtx=new HHt(this),this.post=new RHt(this),this.os2=new PHt(this),this.loca=new XHt(this),this.glyf=new JHt(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},i.prototype.registerTTF=function(){var e,t,M,n,r;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=function(){var o,a,s,l;for(l=[],o=0,a=(s=this.bbox).length;o<a;o++)e=s[o],l.push(Math.round(e*this.scaleFactor));return l}.call(this),this.stemV=0,this.post.exists?(M=255&(n=this.post.italic_angle),32768&(t=n>>16)&&(t=-(1+(65535^t))),this.italicAngle=+(t+"."+M)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(r=this.familyClass)===1||r===2||r===3||r===4||r===5||r===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},i.prototype.characterToGlyph=function(e){var t;return((t=this.cmap.unicode)!=null?t.codeMap[e]:void 0)||0},i.prototype.widthOfGlyph=function(e){var t;return t=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*t},i.prototype.widthOfString=function(e,t,M){var n,r,o,a;for(o=0,r=0,a=(e=""+e).length;0<=a?r<a:r>a;r=0<=a?++r:--r)n=e.charCodeAt(r),o+=this.widthOfGlyph(this.characterToGlyph(n))+M*(1e3/t)||0;return o*(t/1e3)},i.prototype.lineHeight=function(e,t){var M;return t==null&&(t=!1),M=t?this.lineGap:0,(this.ascender+M-this.decender)/1e3*e},i})();var Fu,Bj=(function(){function i(e){this.data=e??[],this.pos=0,this.length=this.data.length}return i.prototype.readByte=function(){return this.data[this.pos++]},i.prototype.writeByte=function(e){return this.data[this.pos++]=e},i.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},i.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},i.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},i.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},i.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},i.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},i.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},i.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},i.prototype.readString=function(e){var t,M;for(M=[],t=0;0<=e?t<e:t>e;t=0<=e?++t:--t)M[t]=String.fromCharCode(this.readByte());return M.join("")},i.prototype.writeString=function(e){var t,M,n;for(n=[],t=0,M=e.length;0<=M?t<M:t>M;t=0<=M?++t:--t)n.push(this.writeByte(e.charCodeAt(t)));return n},i.prototype.readShort=function(){return this.readInt16()},i.prototype.writeShort=function(e){return this.writeInt16(e)},i.prototype.readLongLong=function(){var e,t,M,n,r,o,a,s;return e=this.readByte(),t=this.readByte(),M=this.readByte(),n=this.readByte(),r=this.readByte(),o=this.readByte(),a=this.readByte(),s=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^t)+1099511627776*(255^M)+4294967296*(255^n)+16777216*(255^r)+65536*(255^o)+256*(255^a)+(255^s)+1):72057594037927940*e+281474976710656*t+1099511627776*M+4294967296*n+16777216*r+65536*o+256*a+s},i.prototype.writeLongLong=function(e){var t,M;return t=Math.floor(e/4294967296),M=4294967295&e,this.writeByte(t>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t),this.writeByte(M>>24&255),this.writeByte(M>>16&255),this.writeByte(M>>8&255),this.writeByte(255&M)},i.prototype.readInt=function(){return this.readInt32()},i.prototype.writeInt=function(e){return this.writeInt32(e)},i.prototype.read=function(e){var t,M;for(t=[],M=0;0<=e?M<e:M>e;M=0<=e?++M:--M)t.push(this.readByte());return t},i.prototype.write=function(e){var t,M,n,r;for(r=[],M=0,n=e.length;M<n;M++)t=e[M],r.push(this.writeByte(t));return r},i})(),YHt=(function(){var i;function e(t){var M,n,r;for(this.scalarType=t.readInt(),this.tableCount=t.readShort(),this.searchRange=t.readShort(),this.entrySelector=t.readShort(),this.rangeShift=t.readShort(),this.tables={},n=0,r=this.tableCount;0<=r?n<r:n>r;n=0<=r?++n:--n)M={tag:t.readString(4),checksum:t.readInt(),offset:t.readInt(),length:t.readInt()},this.tables[M.tag]=M}return e.prototype.encode=function(t){var M,n,r,o,a,s,l,N,c,D,I,d,y;for(y in I=Object.keys(t).length,s=Math.log(2),c=16*Math.floor(Math.log(I)/s),o=Math.floor(c/s),N=16*I-c,(n=new Bj).writeInt(this.scalarType),n.writeShort(I),n.writeShort(c),n.writeShort(o),n.writeShort(N),r=16*I,l=n.pos+r,a=null,d=[],t)for(D=t[y],n.writeString(y),n.writeInt(i(D)),n.writeInt(l),n.writeInt(D.length),d=d.concat(D),y==="head"&&(a=l),l+=D.length;l%4;)d.push(0),l++;return n.write(d),M=2981146554-i(n.data),n.pos=a+8,n.writeUInt32(M),n.data},i=function(t){var M,n,r,o;for(t=sut.call(t);t.length%4;)t.push(0);for(r=new Bj(t),n=0,M=0,o=t.length;M<o;M=M+=4)n+=r.readUInt32();return 4294967295&n},e})(),ZHt={}.hasOwnProperty,MD=function(i,e){for(var t in e)ZHt.call(e,t)&&(i[t]=e[t]);function M(){this.constructor=i}return M.prototype=e.prototype,i.prototype=new M,i.__super__=e.prototype,i};Fu=(function(){function i(e){var t;this.file=e,t=this.file.directory.tables[this.tag],this.exists=!!t,t&&(this.offset=t.offset,this.length=t.length,this.parse(this.file.contents))}return i.prototype.parse=function(){},i.prototype.encode=function(){},i.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},i})();var _Ht=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="head",i.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},i.prototype.encode=function(e){var t;return(t=new Bj).writeInt(this.version),t.writeInt(this.revision),t.writeInt(this.checkSumAdjustment),t.writeInt(this.magicNumber),t.writeShort(this.flags),t.writeShort(this.unitsPerEm),t.writeLongLong(this.created),t.writeLongLong(this.modified),t.writeShort(this.xMin),t.writeShort(this.yMin),t.writeShort(this.xMax),t.writeShort(this.yMax),t.writeShort(this.macStyle),t.writeShort(this.lowestRecPPEM),t.writeShort(this.fontDirectionHint),t.writeShort(e),t.writeShort(this.glyphDataFormat),t.data},i})(),GNt=(function(){function i(e,t){var M,n,r,o,a,s,l,N,c,D,I,d,y,A,z,E,S;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=t+e.readInt(),c=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(s=0;s<256;++s)this.codeMap[s]=e.readByte();break;case 4:for(I=e.readUInt16(),D=I/2,e.pos+=6,r=(function(){var O,v;for(v=[],s=O=0;0<=D?O<D:O>D;s=0<=D?++O:--O)v.push(e.readUInt16());return v})(),e.pos+=2,y=(function(){var O,v;for(v=[],s=O=0;0<=D?O<D:O>D;s=0<=D?++O:--O)v.push(e.readUInt16());return v})(),l=(function(){var O,v;for(v=[],s=O=0;0<=D?O<D:O>D;s=0<=D?++O:--O)v.push(e.readUInt16());return v})(),N=(function(){var O,v;for(v=[],s=O=0;0<=D?O<D:O>D;s=0<=D?++O:--O)v.push(e.readUInt16());return v})(),n=(this.length-e.pos+this.offset)/2,a=(function(){var O,v;for(v=[],s=O=0;0<=n?O<n:O>n;s=0<=n?++O:--O)v.push(e.readUInt16());return v})(),s=z=0,S=r.length;z<S;s=++z)for(A=r[s],M=E=d=y[s];d<=A?E<=A:E>=A;M=d<=A?++E:--E)N[s]===0?o=M+l[s]:(o=a[N[s]/2+(M-d)-(D-s)]||0)!==0&&(o+=l[s]),this.codeMap[M]=65535&o}e.pos=c}return i.encode=function(e,t){var M,n,r,o,a,s,l,N,c,D,I,d,y,A,z,E,S,O,v,Z,B,q,W,Ne,_,X,ne,ae,pe,Me,De,Ie,me,Qe,Ye,F,le,J,ue,ze,Ee,we,_e,Re,Be,Dt;switch(ae=new Bj,o=Object.keys(e).sort(function(Ot,Vt){return Ot-Vt}),t){case"macroman":for(y=0,A=(function(){var Ot=[];for(d=0;d<256;++d)Ot.push(0);return Ot})(),E={0:0},r={},pe=0,me=o.length;pe<me;pe++)E[_e=e[n=o[pe]]]==null&&(E[_e]=++y),r[n]={old:e[n],new:E[e[n]]},A[n]=E[e[n]];return ae.writeUInt16(1),ae.writeUInt16(0),ae.writeUInt32(12),ae.writeUInt16(0),ae.writeUInt16(262),ae.writeUInt16(0),ae.write(A),{charMap:r,subtable:ae.data,maxGlyphID:y+1};case"unicode":for(X=[],c=[],S=0,E={},M={},z=l=null,Me=0,Qe=o.length;Me<Qe;Me++)E[v=e[n=o[Me]]]==null&&(E[v]=++S),M[n]={old:v,new:E[v]},a=E[v]-n,z!=null&&a===l||(z&&c.push(z),X.push(n),l=a),z=n;for(z&&c.push(z),c.push(65535),X.push(65535),Ne=2*(W=X.length),q=2*Math.pow(Math.log(W)/Math.LN2,2),D=Math.log(q/2)/Math.LN2,B=2*W-q,s=[],Z=[],I=[],d=De=0,Ye=X.length;De<Ye;d=++De){if(_=X[d],N=c[d],_===65535){s.push(0),Z.push(0);break}if(_-(ne=M[_].new)>=32768)for(s.push(0),Z.push(2*(I.length+W-d)),n=Ie=_;_<=N?Ie<=N:Ie>=N;n=_<=N?++Ie:--Ie)I.push(M[n].new);else s.push(ne-_),Z.push(0)}for(ae.writeUInt16(3),ae.writeUInt16(1),ae.writeUInt32(12),ae.writeUInt16(4),ae.writeUInt16(16+8*W+2*I.length),ae.writeUInt16(0),ae.writeUInt16(Ne),ae.writeUInt16(q),ae.writeUInt16(D),ae.writeUInt16(B),Ee=0,F=c.length;Ee<F;Ee++)n=c[Ee],ae.writeUInt16(n);for(ae.writeUInt16(0),we=0,le=X.length;we<le;we++)n=X[we],ae.writeUInt16(n);for(Re=0,J=s.length;Re<J;Re++)a=s[Re],ae.writeUInt16(a);for(Be=0,ue=Z.length;Be<ue;Be++)O=Z[Be],ae.writeUInt16(O);for(Dt=0,ze=I.length;Dt<ze;Dt++)y=I[Dt],ae.writeUInt16(y);return{charMap:M,subtable:ae.data,maxGlyphID:S+1}}},i})(),aut=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="cmap",i.prototype.parse=function(e){var t,M,n;for(e.pos=this.offset,this.version=e.readUInt16(),n=e.readUInt16(),this.tables=[],this.unicode=null,M=0;0<=n?M<n:M>n;M=0<=n?++M:--M)t=new GNt(e,this.offset),this.tables.push(t),t.isUnicode&&this.unicode==null&&(this.unicode=t);return!0},i.encode=function(e,t){var M,n;return t==null&&(t="macroman"),M=GNt.encode(e,t),(n=new Bj).writeUInt16(0),n.writeUInt16(1),M.table=n.data.concat(M.subtable),M},i})(),WHt=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="hhea",i.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},i})(),PHt=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="OS/2",i.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=(function(){var t,M;for(M=[],t=0;t<10;++t)M.push(e.readByte());return M})(),this.charRange=(function(){var t,M;for(M=[],t=0;t<4;++t)M.push(e.readInt());return M})(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=(function(){var t,M;for(M=[],t=0;t<2;t=++t)M.push(e.readInt());return M})(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},i})(),RHt=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="post",i.prototype.parse=function(e){var t,M,n;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:case 196608:break;case 131072:var r;for(M=e.readUInt16(),this.glyphNameIndex=[],r=0;0<=M?r<M:r>M;r=0<=M?++r:--r)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],n=[];e.pos<this.offset+this.length;)t=e.readByte(),n.push(this.names.push(e.readString(t)));return n;case 151552:return M=e.readUInt16(),this.offsets=e.read(M);case 262144:return this.map=function(){var o,a,s;for(s=[],r=o=0,a=this.file.maxp.numGlyphs;0<=a?o<a:o>a;r=0<=a?++o:--o)s.push(e.readUInt32());return s}.call(this)}},i})(),VHt=function(i,e){this.raw=i,this.length=i.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},BHt=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="name",i.prototype.parse=function(e){var t,M,n,r,o,a,s,l,N,c,D;for(e.pos=this.offset,e.readShort(),t=e.readShort(),a=e.readShort(),M=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)M.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+a+e.readShort()});for(s={},r=N=0,c=M.length;N<c;r=++N)n=M[r],e.pos=n.offset,l=e.readString(n.length),o=new VHt(l,n),s[D=n.nameID]==null&&(s[D]=[]),s[n.nameID].push(o);this.strings=s,this.copyright=s[0],this.fontFamily=s[1],this.fontSubfamily=s[2],this.uniqueSubfamily=s[3],this.fontName=s[4],this.version=s[5];try{this.postscriptName=s[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=s[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=s[7],this.manufacturer=s[8],this.designer=s[9],this.description=s[10],this.vendorUrl=s[11],this.designerUrl=s[12],this.license=s[13],this.licenseUrl=s[14],this.preferredFamily=s[15],this.preferredSubfamily=s[17],this.compatibleFull=s[18],this.sampleText=s[19]},i})(),FHt=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="maxp",i.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},i})(),HHt=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="hmtx",i.prototype.parse=function(e){var t,M,n,r,o,a,s;for(e.pos=this.offset,this.metrics=[],t=0,a=this.file.hhea.numberOfMetrics;0<=a?t<a:t>a;t=0<=a?++t:--t)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(n=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var l,N;for(N=[],t=l=0;0<=n?l<n:l>n;t=0<=n?++l:--l)N.push(e.readInt16());return N})(),this.widths=function(){var l,N,c,D;for(D=[],l=0,N=(c=this.metrics).length;l<N;l++)r=c[l],D.push(r.advance);return D}.call(this),M=this.widths[this.widths.length-1],s=[],t=o=0;0<=n?o<n:o>n;t=0<=n?++o:--o)s.push(this.widths.push(M));return s},i.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},i})(),sut=[].slice,JHt=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="glyf",i.prototype.parse=function(){return this.cache={}},i.prototype.glyphFor=function(e){var t,M,n,r,o,a,s,l,N,c;return e in this.cache?this.cache[e]:(r=this.file.loca,t=this.file.contents,M=r.indexOf(e),(n=r.lengthOf(e))===0?this.cache[e]=null:(t.pos=this.offset+M,o=(a=new Bj(t.read(n))).readShort(),l=a.readShort(),c=a.readShort(),s=a.readShort(),N=a.readShort(),this.cache[e]=o===-1?new $Ht(a,l,c,s,N):new GHt(a,o,l,c,s,N),this.cache[e]))},i.prototype.encode=function(e,t,M){var n,r,o,a,s;for(o=[],r=[],a=0,s=t.length;a<s;a++)n=e[t[a]],r.push(o.length),n&&(o=o.concat(n.encode(M)));return r.push(o.length),{table:o,offsets:r}},i})(),GHt=(function(){function i(e,t,M,n,r,o){this.raw=e,this.numberOfContours=t,this.xMin=M,this.yMin=n,this.xMax=r,this.yMax=o,this.compound=!1}return i.prototype.encode=function(){return this.raw.data},i})(),$Ht=(function(){function i(e,t,M,n,r){var o,a;for(this.raw=e,this.xMin=t,this.yMin=M,this.xMax=n,this.yMax=r,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;a=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&a;)o.pos+=1&a?4:2,128&a?o.pos+=8:64&a?o.pos+=4:8&a&&(o.pos+=2)}return i.prototype.encode=function(){var e,t,M;for(t=new Bj(sut.call(this.raw.data)),e=0,M=this.glyphIDs.length;e<M;++e)t.pos=this.glyphOffsets[e];return t.data},i})(),XHt=(function(){function i(){return i.__super__.constructor.apply(this,arguments)}return MD(i,Fu),i.prototype.tag="loca",i.prototype.parse=function(e){var t,M;return e.pos=this.offset,t=this.file.head.indexToLocFormat,this.offsets=t===0?function(){var n,r;for(r=[],M=0,n=this.length;M<n;M+=2)r.push(2*e.readUInt16());return r}.call(this):function(){var n,r;for(r=[],M=0,n=this.length;M<n;M+=4)r.push(e.readUInt32());return r}.call(this)},i.prototype.indexOf=function(e){return this.offsets[e]},i.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},i.prototype.encode=function(e,t){for(var M=new Uint32Array(this.offsets.length),n=0,r=0,o=0;o<M.length;++o)if(M[o]=n,r<t.length&&t[r]==o){++r,M[o]=n;var a=this.offsets[o],s=this.offsets[o+1]-a;s>0&&(n+=s)}for(var l=new Array(4*M.length),N=0;N<M.length;++N)l[4*N+3]=255&M[N],l[4*N+2]=(65280&M[N])>>8,l[4*N+1]=(16711680&M[N])>>16,l[4*N]=(4278190080&M[N])>>24;return l},i})(),qHt=(function(){function i(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return i.prototype.generateCmap=function(){var e,t,M,n,r;for(t in n=this.font.cmap.tables[0].codeMap,e={},r=this.subset)M=r[t],e[t]=n[M];return e},i.prototype.glyphsFor=function(e){var t,M,n,r,o,a,s;for(n={},o=0,a=e.length;o<a;o++)n[r=e[o]]=this.font.glyf.glyphFor(r);for(r in t=[],n)(M=n[r])!=null&&M.compound&&t.push.apply(t,M.glyphIDs);if(t.length>0)for(r in s=this.glyphsFor(t))M=s[r],n[r]=M;return n},i.prototype.encode=function(e,t){var M,n,r,o,a,s,l,N,c,D,I,d,y,A,z;for(n in M=aut.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(e),I={0:0},z=M.charMap)I[(s=z[n]).old]=s.new;for(d in D=M.maxGlyphID,o)d in I||(I[d]=D++);return N=(function(E){var S,O;for(S in O={},E)O[E[S]]=S;return O})(I),c=Object.keys(N).sort(function(E,S){return E-S}),y=(function(){var E,S,O;for(O=[],E=0,S=c.length;E<S;E++)a=c[E],O.push(N[a]);return O})(),r=this.font.glyf.encode(o,y,I),l=this.font.loca.encode(r.offsets,y),A={cmap:this.font.cmap.raw(),glyf:r.table,loca:l,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(t)},this.font.os2.exists&&(A["OS/2"]=this.font.os2.raw()),this.font.directory.encode(A)},i})();Ii.API.PDFObject=(function(){var i;function e(){}return i=function(t,M){return(Array(M+1).join("0")+t).slice(-M)},e.convert=function(t){var M,n,r,o;if(Array.isArray(t))return"["+(function(){var a,s,l;for(l=[],a=0,s=t.length;a<s;a++)M=t[a],l.push(e.convert(M));return l})().join(" ")+"]";if(typeof t=="string")return"/"+t;if(t?.isString)return"("+t+")";if(t instanceof Date)return"(D:"+i(t.getUTCFullYear(),4)+i(t.getUTCMonth(),2)+i(t.getUTCDate(),2)+i(t.getUTCHours(),2)+i(t.getUTCMinutes(),2)+i(t.getUTCSeconds(),2)+"Z)";if({}.toString.call(t)==="[object Object]"){for(n in r=["<<"],t)o=t[n],r.push("/"+n+" "+e.convert(o));return r.push(">>"),r.join(`
|
|
40579
|
-
`)}return""+t},e})();var KHt=[[["","toolPanel",""]],[["","summaryDrawer",""]]],eJt=["[toolPanel]","[summaryDrawer]"],tJt=(i,e)=>e.id;function iJt(i,e){i&1&&Mt(0,"nile-skeleton-loader",12)}function MJt(i,e){i&1&&($(0,"div",13),Y(1,"Create charts, save widgets, and build your library."),ee())}function nJt(i,e){if(i&1){let t=Le();$(0,"nile-card")(1,"div",15),Mt(2,"shared-nile-chart-widget",16),ee(),$(3,"div",17)(4,"nile-button",18),Ze("click",function(){let n=P(t).$implicit,r=p(3);return R(r.addFromLibrary(n.id))}),Y(5,"+ Add to dashboard"),ee(),$(6,"nile-glyph",19),Ze("click",function(){let n=P(t).$implicit,r=p(3);return R(r.removeFromLibrary(n.id))}),ee()()()}if(i&2){let t=e.$implicit;L(2),ot("config",t.config)("drilldownBy",t.drilldownBy)}}function rJt(i,e){if(i&1&&($(0,"div",14),ht(1,nJt,7,2,"nile-card",null,tJt),ee()),i&2){let t=p(2);L(),xt(t.globalWidgets())}}function oJt(i,e){if(i&1){let t=Le();$(0,"aside",7)(1,"div",8)(2,"span"),Y(3,"Widget library"),ee(),$(4,"nile-button",9),Ze("click",function(){P(t);let n=p();return R(n.libraryOpen.set(!1))}),Mt(5,"nile-glyph",10),ee()(),$(6,"div",11),he(7,iJt,1,0,"nile-skeleton-loader",12)(8,MJt,2,0,"div",13)(9,rJt,3,0,"div",14),ee()()}if(i&2){let t=p();L(7),xe(t.globalWidgetsLoading()?7:t.globalWidgets().length?9:8)}}function aJt(i,e){if(i&1){let t=Le();$(0,"button",21),Ze("click",function(){let n=P(t).$implicit,r=p(2);return R(r.pickGalleryPrompt(n))}),Y(1),ee()}if(i&2){let t=e.$implicit;L(),it(t)}}function sJt(i,e){if(i&1){let t=Le();$(0,"aside",7)(1,"div",8)(2,"span"),Y(3,"Prompt gallery"),ee(),$(4,"nile-button",9),Ze("click",function(){P(t);let n=p();return R(n.galleryOpen.set(!1))}),Mt(5,"nile-glyph",10),ee()(),$(6,"div",11)(7,"p",13),Y(8,"Pick a suggestion to get started."),ee(),ht(9,aJt,2,1,"button",20,Ho),ee()()}if(i&2){let t=p();L(9),xt(t.galleryPrompts)}}var bQ=class i{state=Fe(M0);publishRepo=Fe(n0);forecastService=Fe(ME);globalWidget=Fe(r0);timeFilterPref=Fe(nE);destroyRef=Fe(rl);dashboardId=null;preseeded=!1;_dashboardId=null;dashboardIdSignal=ke(null);gridRef;showLibraryPanel=at(!0);showGalleryPanel=at(!0);canAddToStory=at(!1);showWidgetMenu=at(!0);canAsk=at(!0);canChangeChartType=at(!0);canManageFilters=at(!0);canCustomizeColors=at(!0);canViewChartData=at(!0);canExportPng=at(!0);canExportCsv=at(!0);canPrint=at(!0);canTweak=at(!0);canEdit=at(!0);canDelete=at(!0);ngOnChanges(e){e.dashboardId&&(this._dashboardId!==this.dashboardId&&(this.primedFilterWidgets.clear(),this.filterCatalogCache.clear(),this.activeDashboardFilters.set(null),this.activeResolvedFilters.set(null),this.applySummary.set(null)),this._dashboardId=this.dashboardId,this.dashboardIdSignal.set(this.dashboardId),this.dashboardId&&!this.preseeded?this.loadDashboardFromApi(this.dashboardId):this.dashboardId&&this.loadForecastability(this.dashboardId))}galleryPrompts=[];exitBuilder=new Xt;deleted=new Xt;executiveSummary=new Xt;galleryPrompt=new Xt;published=new Xt;widgetClick=new Xt;widgets=ke([]);dashboardName=ke("Untitled Dashboard");editMode=ke(!0);editingWidget=ke(null);tweakingWidgetId=ke(null);savedWidgetIds=new Set;showPublishDialog=ke(!1);isPublishing=ke(!1);loading=ke(!1);isExporting=ke(!1);isRearranging=ke(!1);libraryOpen=ke(!1);galleryOpen=ke(!1);globalWidgets=ke([]);globalWidgetsLoading=ke(!1);hasWidgets=At(()=>this.widgets().length>0);nothingToPublish=Eat(this.state.nothingToPublish$,{initialValue:!1});canPublish=At(()=>!this.nothingToPublish());applyingFilters=ke(!1);activeDashboardFilters=ke(null);activeResolvedFilters=ke(null);applySummary=ke(null);applyFiltersSeq=0;applyFiltersAbort=null;primedFilterWidgets=new Set;filterCatalogCache=new Map;initialFilterAppliedFor=new Set;constructor(){this.state.state$.pipe(TB(this.destroyRef)).subscribe(e=>{this.widgets.set(e.widgets),this.dashboardName.set(e.name);let t=J3(e.widgets);this._dashboardId&&t!==this.probedWidgetIds&&(this.probedWidgetIds=t,this.loadForecastability(this._dashboardId))}),this.state.mutations$.pipe(qg(()=>!!this._dashboardId),yf(0),TB(this.destroyRef)).subscribe(e=>{!this.state.isDirty||this.isPublishing()||this.publishRepo.saveDraft(this._dashboardId,e)}),eo(()=>{this.widgets(),queueMicrotask(()=>this.primeFilterWidgets())}),eo(()=>{let e=this.widgets(),t=this._dashboardId;if(!t||e.length===0||this.initialFilterAppliedFor.has(t))return;let M=this.collectInitialFilters(e);M&&(this.initialFilterAppliedFor.add(t),this.applyInitialFilters(M))})}onUpdateLayout(e){this.state.updateWidgetLayout(e.id,e.layout)}onRemove(e){this.state.removeWidget(e),this.editingWidget()?.id===e&&this.editingWidget.set(null)}onEditWidget(e){let t=this.state.snapshot.widgets.find(M=>M.id===e);this.editingWidget.set(t?x({},t):null)}async onTweakWidget(e){this.tweakingWidgetId.set(e.widgetId);try{let t=this.savedWidgetIds.has(e.widgetId),M=this.state.snapshot.widgets.find(o=>o.id===e.widgetId),n=await this.publishRepo.tweakWidget(t||!M?{widgetId:e.widgetId,prompt:e.prompt}:{widget:M,prompt:e.prompt}),r={config:n.config};n.title!==void 0&&(r.title=n.title),n.widgetType!==void 0&&(r.widgetType=n.widgetType),n.componentName!==void 0&&(r.componentName=n.componentName),n.summary!==void 0&&(r.summary=n.summary),n.layout&&(r.layout=n.layout),n.drilldownBy&&(r.drilldownBy=n.drilldownBy),this.state.updateWidget(e.widgetId,r)}catch(t){console.error("Tweak failed:",t)}finally{this.tweakingWidgetId.set(null)}}onDslWidgetUpdated(e){this.state.updateWidget(e.id,{config:e.config,queryMeta:e.queryMeta})}onWidgetChartTypeChanged(e){this.state.updateWidget(e.id,{componentName:e.componentName,config:e.config})}onWidgetFiltersChanged(e){this.state.updateWidget(e.id,{config:e.config})}onUpdateWidget(e){let t={config:e.config};e.title&&(t.title=e.title),this.state.updateWidget(e.id,t),this.refreshEditing(e.id)}onDrawerUpdateLayout(e){this.state.updateWidgetLayout(e.id,e.layout),this.refreshEditing(e.id)}onApplyDrilldown(e){this.state.updateWidget(e.id,{drilldownBy:e.drilldownBy}),this.refreshEditing(e.id)}refreshEditing(e){let t=this.state.snapshot.widgets.find(M=>M.id===e);t&&this.editingWidget.set(x({},t))}isFilterWidget(e){return e?.config?.chart?.type==="filter"}isEmptyFilters(e){if(!e)return!0;for(let t of Object.values(e))if(t!=null&&!(typeof t=="string"&&t.trim()==="")&&!(typeof t=="object"&&Object.keys(t).length===0))return!1;return!0}async onFilterSubmit(e){if(this.isEmptyFilters(e.filters)){await this.reloadDashboardForFilterClear();return}let t=this.state.snapshot.widgets.filter(o=>!this.isFilterWidget(o));if(t.length===0)return;let M=this._dashboardId;if(!M)return;this.applyFiltersAbort?.abort();let n=new AbortController;this.applyFiltersAbort=n;let r=++this.applyFiltersSeq;this.applyingFilters.set(!0);try{let{widgets:o,resolvedFilters:a}=await this.publishRepo.applyFilters(t,e.filters,M,"draft",n.signal,{mode:e.mode,prompt:e.prompt});if(r!==this.applyFiltersSeq)return;this.state.applyFilterView(o),this.activeDashboardFilters.set(e.filters),this.activeResolvedFilters.set(a),this.applySummary.set(tE(o,this.buildActiveFilters(e.filters)))}catch(o){if(o?.name==="AbortError"||r!==this.applyFiltersSeq)return;console.error("Apply filters failed:",o)}finally{r===this.applyFiltersSeq&&this.applyingFilters.set(!1)}}onFilterChange(e){if(!e.widgetId||!e.controlId||e.query!=="")return;let t=this._dashboardId;if(!t)return;let M=this.widgets(),{widgetId:n,controlId:r}=e;this.primedFilterWidgets.add(n),(async()=>{try{let o=await this.publishRepo.filterSuggest(t,"",M,"draft");this.applyFilterSuggestions(n,r,o)}catch(o){console.warn("[sug] filterSuggest FAILED",o)}})()}async reloadDashboardForFilterClear(){let e=this._dashboardId;if(!e)return;this.applyFiltersAbort?.abort();let t=++this.applyFiltersSeq;this.applyingFilters.set(!0),this.activeDashboardFilters.set(null),this.activeResolvedFilters.set(null),this.applySummary.set(null);try{if(this.preseeded&&this.state.restoreFilterBaseline())return;let M=await this.publishRepo.fetchDashboard(e);if(t!==this.applyFiltersSeq)return;this.state.replaceDashboard(M)}catch(M){if(t!==this.applyFiltersSeq)return;console.error("Reload dashboard failed:",M)}finally{t===this.applyFiltersSeq&&this.applyingFilters.set(!1)}}primeFilterWidgets(){for(let e of this.widgets()){let t=e.config?.chart;if(t?.type!=="filter")continue;let M=t.controls?.find(n=>n.variant==="prompt"||n.variant==="expression"||n.variant==="hybrid")??t.controls?.find(n=>n.id);M?.id&&this.primeFilterWidget(e.id,M.id)}}primeFilterWidget(e,t){let M=this._dashboardId;if(!M||!e||!t||this.primedFilterWidgets.has(e))return;this.primedFilterWidgets.add(e);let n=this.widgets();(async()=>{try{let r=await this.publishRepo.filterSuggest(M,"",n,"draft");this.applyFilterSuggestions(e,t,r)}catch(r){this.primedFilterWidgets.delete(e),console.warn("Filter suggest prime failed:",r)}})()}applyFilterSuggestions(e,t,M){let n=Array.isArray(M.suggestions)?[...M.suggestions]:[];if(!n.length){M.nextToken&&n.push({id:M.nextToken.value,label:M.nextToken.label,type:"attribute"});for(let r of M.completions)n.push({label:r,type:"suggestion"})}n.length!==0&&(this.filterCatalogCache.set(e,n),this.gridRef?.patchFilterSuggestions(e,t,n))}buildActiveFilters(e){return p3(e,t=>this.filterFieldLabel(t))}filterFieldLabel(e){for(let t of this.filterCatalogCache.values()){let M=t.find(n=>n.type==="attribute"&&n.id===e);if(M)return M.label}return e}collectInitialFilters(e){let t={};for(let M of e){let n=M.config?.chart;if(n?.type==="filter")for(let r of n.controls??[]){if(!r.id)continue;let o=r.value;o!=null&&(typeof o=="string"&&o.trim()===""||(t[r.id]=o))}}return Object.keys(t).length>0?t:null}async applyInitialFilters(e){let t=this.state.snapshot.widgets.filter(o=>!this.isFilterWidget(o));if(t.length===0)return;let M=this._dashboardId;if(!M)return;this.applyFiltersAbort?.abort();let n=new AbortController;this.applyFiltersAbort=n;let r=++this.applyFiltersSeq;this.applyingFilters.set(!0);try{let{widgets:o,resolvedFilters:a}=await this.publishRepo.applyFilters(t,e,M,"draft",n.signal);if(r!==this.applyFiltersSeq)return;this.state.applyFilterView(o),this.activeDashboardFilters.set(e),this.activeResolvedFilters.set(a),this.applySummary.set(tE(o,this.buildActiveFilters(e)))}catch(o){if(o?.name==="AbortError"||r!==this.applyFiltersSeq)return;console.error("Apply filters failed:",o)}finally{r===this.applyFiltersSeq&&this.applyingFilters.set(!1)}}async loadDashboardFromApi(e){this.loading.set(!0);try{let t=await this.publishRepo.fetchDashboard(e);this.state.replaceDashboard(t),this.savedWidgetIds=new Set(t.widgets.map(M=>M.id)),this.forecastable.set(t.forecastable??{}),this.probedWidgetIds=J3(t.widgets)}catch{this.state.resetDashboard(),this.savedWidgetIds=new Set}finally{this.loading.set(!1)}}openPublish(){let e=this.dashboardName().trim();if(e&&e!=="Untitled Dashboard"&&this._dashboardId){this.publish(e);return}this.showPublishDialog.set(!0)}async publish(e){if(this.isPublishing())return;let t=this._dashboardId;if(t){this.isPublishing.set(!0);try{let M=e.trim()||"Untitled Dashboard";await this.publishRepo.saveDraft(t,this.state.snapshot),M!==this.state.snapshot.name&&await this.publishRepo.renameDashboard(t,M),await this.publishRepo.publishDashboard(t,M),this.state.setDashboardName(M),this.state.markClean(),this.showPublishDialog.set(!1),this.published.emit(M)}catch(M){kA({variant:"warning",title:"Not published",content:TF(M instanceof Error?M.message:"","Couldn't publish the dashboard. Please try again.")})}finally{this.isPublishing.set(!1)}}}async renameTo(e){let t=this._dashboardId,M=e.trim();!t||!M||M===this.state.snapshot.name||(await this.publishRepo.renameDashboard(t,M),this.state.setDashboardName(M))}togglePreview(){this.editMode.update(e=>!e)}forecastable=ke({});forecastingWidgetId=ke(null);forecastBusy=new Set;probedWidgetIds="";async loadForecastability(e){let t=this.widgets(),M=t.length?await this.forecastService.probeWidgets(t):await this.forecastService.probe(e);this._dashboardId===e&&this.forecastable.set(M)}async onForecast(e){let t=String(e.widget.id),M=this._dashboardId;if(!(!M||this.forecastBusy.has(t))){this.forecastBusy.add(t),this.forecastingWidgetId.set(t);try{let n=e.enable?await this.forecastService.addToWidget(M,t,e.settings??{}):await this.forecastService.removeFromWidget(M,t);if(e.enable&&n?.guardrails&&n.guardrails.passed===!1)return;n?.widget&&this.replaceWidget(n.widget),kA({variant:"success",title:e.enable?"Forecast added":"Forecast removed",content:e.enable?"The projection is shown with its confidence range.":"The chart is back to its measured history."})}catch{}finally{this.forecastBusy.delete(t),this.forecastingWidgetId.set(null)}}}forecastingAll=ke(!1);async onForecastDashboard(e){let t=this._dashboardId;if(!(!t||this.forecastingAll())){this.forecastingAll.set(!0);try{let M=await this.forecastService.toggleDashboard(t,e);for(let o of M.widgets??[])this.replaceWidget(o);let n=M.applied?.length??0,r=M.skipped?.length??0;n&&kA({variant:"success",title:e?`Forecast added to ${n} widget${n===1?"":"s"}`:`Forecast removed from ${n} widget${n===1?"":"s"}`,content:r?`${r} skipped \u2014 ${M.skipped[0]?.message??"not forecastable"}`:"Projections are shown with their confidence range."}),this.loadForecastability(t)}catch{}finally{this.forecastingAll.set(!1)}}}anyForecastOn=At(()=>this.widgets().some(e=>!!e?.config?.forecast?.enabled));replaceWidget(e){this.widgets.update(t=>t.map(M=>String(M.id)===String(e.id)?e:M))}onMenuAction(e){switch(e){case"preview":this.editMode.set(!1);break;case"edit":this.editMode.set(!0);break;case"publish":this.openPublish();break;case"delete":this.deleteDashboard();break;case"exportPdf":this.exportPdf();break;case"exportPng":this.exportPng();break;case"rearrange":this.rearrange();break;case"widgetLibrary":this.openLibrary();break;case"executiveSummary":this._dashboardId&&this.executiveSummary.emit(this._dashboardId);break;case"promptGallery":this.libraryOpen.set(!1),this.galleryOpen.set(!0);break;case"forecastAll":this.onForecastDashboard(!this.anyForecastOn());break;case"toggleFilter":this.state.toggleFilterWidget();break;case"toggleTimeFilter":this.timeFilterPref.toggle(this._dashboardId);break}}hasFilter=At(()=>this.widgets().some(e=>this.isFilterWidget(e)));hasTimeFilter=this.timeFilterPref.enabled(this.dashboardIdSignal);async deleteDashboard(){let e=this._dashboardId;e&&(await this.publishRepo.deleteDashboard(e),this.deleted.emit(e),this.exitBuilder.emit())}getCaptureTarget(){return document.querySelector("shared-builder-host shared-dashboard-grid gridster")}async exportPdf(){if(this.isExporting())return;let e=this.getCaptureTarget();if(e){this.isExporting.set(!0),await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));try{let t=e.scrollWidth,M=e.scrollHeight,n=await EF(e,{quality:1,width:t,height:M,cacheBust:!0,backgroundColor:"#ffffff",style:{height:`${M}px`,maxHeight:"none",overflow:"visible"}}),r=this.dashboardName()||"Dashboard",o=90,a=new Ii({orientation:t>M?"landscape":"portrait",unit:"px",format:[t,M+o]});a.setFillColor(245,245,248),a.rect(0,0,t,o,"F"),a.setFont("helvetica","bold"),a.setFontSize(28),a.setTextColor(50,50,60),a.text(r,t/2,o/2+7,{align:"center"}),a.addImage(n,"JPEG",0,o,t,M),a.save(`${r}.pdf`)}finally{this.isExporting.set(!1)}}}async exportPng(){if(this.isExporting())return;let e=this.getCaptureTarget();if(e){this.isExporting.set(!0),await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));try{let t=e.scrollWidth,M=e.scrollHeight,n=await EF(e,{quality:1,width:t,height:M,cacheBust:!0,backgroundColor:"#ffffff",style:{height:`${M}px`,maxHeight:"none",overflow:"visible"}}),r=this.dashboardName()||"Dashboard",o=90,a=document.createElement("canvas");a.width=t,a.height=M+o;let s=a.getContext("2d");s.fillStyle="#f5f5f8",s.fillRect(0,0,t,o),s.fillStyle="#32323c",s.font="bold 28px helvetica",s.textAlign="center",s.textBaseline="middle",s.fillText(r,t/2,o/2+7);let l=new Image;l.src=n,await new Promise(c=>{l.onload=()=>c()}),s.drawImage(l,0,o,t,M);let N=document.createElement("a");N.href=a.toDataURL("image/png"),N.download=`${r}.png`,N.click()}finally{this.isExporting.set(!1)}}}async rearrange(){if(this.isRearranging())return;let e=this.state.snapshot.widgets;if(e.length!==0){this.isRearranging.set(!0);try{let{layouts:t}=await this.publishRepo.rearrangeDashboard(e,this._dashboardId);t.length&&this.state.updateWidgetLayouts(t)}finally{this.isRearranging.set(!1)}}}async openLibrary(){if(this.galleryOpen.set(!1),this.libraryOpen.set(!0),!this.globalWidgetsLoading()){this.globalWidgetsLoading.set(!0);try{this.globalWidgets.set(await this.globalWidget.getAll())}catch{this.globalWidgets.set([])}finally{this.globalWidgetsLoading.set(!1)}}}addFromLibrary(e){let t=this.globalWidgets().find(o=>o.id===e);if(!t)return;let r=t,{id:M}=r,n=$e(r,["id"]);this.state.addWidget(n),this.libraryOpen.set(!1)}async removeFromLibrary(e){await this.globalWidget.remove(e),this.globalWidgets.update(t=>t.filter(M=>M.id!==e))}pickGalleryPrompt(e){this.galleryPrompt.emit(e),this.galleryOpen.set(!1)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["shared-builder-host"]],viewQuery:function(t,M){if(t&1&&eN(wA,5),t&2){let n;ll(n=gl())&&(M.gridRef=n.first)}},inputs:{dashboardId:"dashboardId",preseeded:"preseeded",showLibraryPanel:[1,"showLibraryPanel"],showGalleryPanel:[1,"showGalleryPanel"],canAddToStory:[1,"canAddToStory"],showWidgetMenu:[1,"showWidgetMenu"],canAsk:[1,"canAsk"],canChangeChartType:[1,"canChangeChartType"],canManageFilters:[1,"canManageFilters"],canCustomizeColors:[1,"canCustomizeColors"],canViewChartData:[1,"canViewChartData"],canExportPng:[1,"canExportPng"],canExportCsv:[1,"canExportCsv"],canPrint:[1,"canPrint"],canTweak:[1,"canTweak"],canEdit:[1,"canEdit"],canDelete:[1,"canDelete"],galleryPrompts:"galleryPrompts"},outputs:{exitBuilder:"exitBuilder",deleted:"deleted",executiveSummary:"executiveSummary",galleryPrompt:"galleryPrompt",published:"published",widgetClick:"widgetClick"},features:[Qo],ngContentSelectors:eJt,decls:12,vars:32,consts:[[1,"aq-builder"],[3,"forecast","updateLayout","remove","editWidget","tweakWidget","dslWidgetUpdated","widgetChartTypeChanged","widgetFiltersChanged","filterSubmit","filterChange","widgetClick","widgets","editMode","dashboardId","loading","widgetsLoading","tweakingWidgetId","dashboardFilters","resolvedFilters","applySummary","canForecast","canAddToStory","forecastable","forecastingWidgetId","showWidgetMenu","canAsk","canChangeChartType","canManageFilters","canCustomizeColors","canViewChartData","canExportPng","canExportCsv","canPrint","canTweak","canEdit","canDelete"],["placement","end",1,"aq-builder__settings",3,"nile-request-close","open"],["slot","label"],[3,"close","updateWidget","updateLayout","applyDrilldown","widget"],["label","Publish",3,"nile-request-close"],[3,"publish","dismissed","dashboardName","isPublishing"],[1,"aq-tool-panel"],[1,"aq-tool-panel__header"],["circle","","variant","ghost","size","small",3,"click"],["name","ng-x","method","stroke","size","16"],[1,"aq-tool-panel__body"],[2,"width","100%","height","120px","border-radius","8px","display","block"],[1,"aq-tool-empty"],[1,"aq-widget-lib-grid"],[1,"aq-widget-lib-card__preview"],[3,"config","drilldownBy"],[1,"aq-widget-lib-card__footer"],["variant","primary","size","small",3,"click"],["name","ng-trash-01","method","stroke","size","14","color","var(--ng-colors-fg-error-primary)",3,"click"],["type","button",1,"aq-gallery-prompt"],["type","button",1,"aq-gallery-prompt",3,"click"]],template:function(t,M){t&1&&(tu(KHt),$(0,"div",0)(1,"shared-dashboard-grid",1),Ze("forecast",function(r){return M.onForecast(r)})("updateLayout",function(r){return M.onUpdateLayout(r)})("remove",function(r){return M.onRemove(r)})("editWidget",function(r){return M.onEditWidget(r)})("tweakWidget",function(r){return M.onTweakWidget(r)})("dslWidgetUpdated",function(r){return M.onDslWidgetUpdated(r)})("widgetChartTypeChanged",function(r){return M.onWidgetChartTypeChanged(r)})("widgetFiltersChanged",function(r){return M.onWidgetFiltersChanged(r)})("filterSubmit",function(r){return M.onFilterSubmit(r)})("filterChange",function(r){return M.onFilterChange(r)})("widgetClick",function(r){return M.widgetClick.emit(r)}),ee(),$(2,"nile-drawer",2),Ze("nile-request-close",function(){return M.editingWidget.set(null)}),$(3,"span",3),Y(4,"Widget Settings"),ee(),$(5,"db-widget-settings",4),Ze("close",function(){return M.editingWidget.set(null)})("updateWidget",function(r){return M.onUpdateWidget(r)})("updateLayout",function(r){return M.onDrawerUpdateLayout(r)})("applyDrilldown",function(r){return M.onApplyDrilldown(r)}),ee()(),$(6,"nile-dialog",5),Ze("nile-request-close",function(){return M.showPublishDialog.set(!1)}),$(7,"db-publish-dialog",6),Ze("publish",function(r){return M.publish(r)})("dismissed",function(){return M.showPublishDialog.set(!1)}),ee()(),sl(8),he(9,oJt,10,1,"aside",7),he(10,sJt,11,0,"aside",7),sl(11,1),ee()),t&2&&(L(),ot("widgets",M.widgets())("editMode",M.editMode())("dashboardId",M.dashboardId)("loading",M.loading())("widgetsLoading",M.isRearranging()||M.applyingFilters()||M.forecastingAll())("tweakingWidgetId",M.tweakingWidgetId())("dashboardFilters",M.activeDashboardFilters())("resolvedFilters",M.activeResolvedFilters())("applySummary",M.applySummary())("canForecast",!0)("canAddToStory",M.canAddToStory())("forecastable",M.forecastable())("forecastingWidgetId",M.forecastingWidgetId())("showWidgetMenu",M.showWidgetMenu())("canAsk",M.canAsk())("canChangeChartType",M.canChangeChartType())("canManageFilters",M.canManageFilters())("canCustomizeColors",M.canCustomizeColors())("canViewChartData",M.canViewChartData())("canExportPng",M.canExportPng())("canExportCsv",M.canExportCsv())("canPrint",M.canPrint())("canTweak",M.canTweak())("canEdit",M.canEdit())("canDelete",M.canDelete()),L(),ot("open",!!M.editingWidget()),L(3),ot("widget",M.editingWidget()),L(),It("open",M.showPublishDialog()?"":null),L(),ot("dashboardName",M.dashboardName())("isPublishing",M.isPublishing()),L(2),xe(M.showLibraryPanel()&&M.libraryOpen()?9:-1),L(),xe(M.showGalleryPanel()&&M.galleryOpen()?10:-1))},dependencies:[Go,wA,a0,s0,ZI],styles:[".aq-builder[_ngcontent-%COMP%]{position:relative;height:100%;width:100%;overflow:auto;background:var(--ng-colors-bg-secondary)}.aq-builder[_ngcontent-%COMP%] .canvas-wrap, .aq-builder[_ngcontent-%COMP%] gridster{border-radius:0!important}.aq-tool-panel[_ngcontent-%COMP%]{position:absolute;top:0;right:0;width:360px;height:100%;background:var(--ng-colors-bg-primary);border-left:1px solid var(--ng-colors-border-secondary);display:flex;flex-direction:column;z-index:5}.aq-tool-panel__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;height:var(--aq-header-h, 56px);padding:0 16px;border-bottom:1px solid var(--ng-colors-border-secondary);font-weight:600}.aq-tool-panel__body[_ngcontent-%COMP%]{flex:1;overflow:auto;padding:16px}.aq-widget-lib-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr;gap:12px}.aq-widget-lib-card__preview[_ngcontent-%COMP%]{height:140px}.aq-widget-lib-card__footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-top:8px}.aq-tool-empty[_ngcontent-%COMP%]{color:var(--ng-colors-text-quaternary-500);font-size:13px;margin:0 0 12px}.aq-gallery-prompt[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%;text-align:left;gap:10px;border:1px solid var(--ng-colors-border-secondary);border-radius:12px;padding:12px 16px;background:var(--ng-colors-bg-primary);cursor:pointer;font:inherit;font-size:13px;font-weight:500;color:var(--ng-colors-text-secondary-700);line-height:1.4;transition:border-color .18s,box-shadow .18s,transform .15s}.aq-gallery-prompt[_ngcontent-%COMP%] + .aq-gallery-prompt[_ngcontent-%COMP%]{margin-top:8px}.aq-gallery-prompt[_ngcontent-%COMP%]:hover{border-color:var(--ng-colors-border-brand);box-shadow:0 6px 24px #2970ff1a;transform:translateY(-2px)}"]})};function QH(i,e){let t=i?.chart;if(t?.type!=="kpi")return;let M=t.sparkline;if(!Array.isArray(M)||M.length===0)return;let n=t.sparklineColor||OA(e),r=t.sparklineLineWidth??2,o=t.sparklineFillOpacity??.2,a=t.sparklineType??"area",s=t.sparklineMarkers??!1,l=Math.round(Math.min(1,Math.max(0,o))*255).toString(16).padStart(2,"0"),N=a==="area"?{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,n+l],[1,n+"00"]]}:void 0;return U(x({},i),{chart:{type:a,data:[{name:"Trend",data:M,color:n}],options:{plotOptions:{[a]:x({lineWidth:r,lineColor:n,marker:{enabled:s}},N&&{fillColor:N})}}}})}function UH(i){let e=i?.aq??{},t=i?.chart??{},Ne=e,{chartTitle:M,chartSubtitle:n,ai:r,switchable:o,toggleLabel:a,summary:s}=Ne,l=$e(Ne,["chartTitle","chartSubtitle","ai","switchable","toggleLabel","summary"]),_=t,{chartTitle:N,chartSubtitle:c,menu:D,switchableTypes:I,ai:d,summary:y,toggleLabel:A,xAxisTitle:z,yAxisTitle:E,legend:S,showLegend:O,showDataLabels:v,options:Z}=_,B=$e(_,["chartTitle","chartSubtitle","menu","switchableTypes","ai","summary","toggleLabel","xAxisTitle","yAxisTitle","legend","showLegend","showDataLabels","options"]),q=Z??{},W=q.plotOptions??{};return U(x({},i),{aq:l,chart:U(x({},B),{chartBg:"transparent",chartBorder:"none",chartBorderRadius:"0",chartShadow:"none",chartPadding:"0",showDataLabels:!1,options:U(x({},q),{title:{text:""},subtitle:{text:""},xAxis:[{visible:!1}],yAxis:[{visible:!1},{visible:!1}],legend:{enabled:!1},plotOptions:U(x({},W),{series:U(x({},W.series??{}),{dataLabels:{enabled:!1}}),pie:U(x({},W.pie??{}),{dataLabels:{enabled:!1},showInLegend:!1})})})})})}function lut(i,e){if(!i)return;let t=QH(i.config,e)??i.config,M=Kh(t,i.drilldownBy);return{id:i.id,title:i.title,widgetType:i.widgetType,layout:i.layout,config:UH(M)}}var lJt=["chart"],QQ=class i{config;chartRef;hostEl=Fe(ir);themeUnwatch;viewReady=!1;ngAfterViewInit(){this.viewReady=!0,this.applyConfig(),this.themeUnwatch=mA(()=>{this.viewReady&&this.isKpiConfig&&this.applyConfig()})}ngOnChanges(e){this.viewReady&&e.config&&this.applyConfig()}ngOnDestroy(){this.themeUnwatch?.()}get isKpiConfig(){return qB(this.config?.chart)}headerLessConfig(e){let t=e;if(!qB(t.chart))return e;let M=x({},t.chart??{}),n=x({},t.aq??{});return C3(M,n,null,this.hostEl.nativeElement),U(x({},e),{chart:M,aq:n})}applyConfig(){let e=this.chartRef?.nativeElement;if(!e||!this.config)return;e.config=this.headerLessConfig(this.config);let t=()=>this.flattenCardChrome(e);e.updateComplete?e.updateComplete.then(t):customElements.whenDefined("nile-chart").then(()=>{let M=e.updateComplete;M?M.then(t):requestAnimationFrame(t)})}flattenCardChrome(e){let t=e.shadowRoot?.querySelector(".nile-chart-card");t&&(t.style.background="transparent",t.style.border="none",t.style.borderRadius="0",t.style.boxShadow="none",t.style.padding="0")}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["db-dash-card-chart"]],viewQuery:function(t,M){if(t&1&&eN(lJt,5),t&2){let n;ll(n=gl())&&(M.chartRef=n.first)}},inputs:{config:"config"},features:[Qo],decls:2,vars:1,consts:[["chart",""],["fit",""]],template:function(t,M){t&1&&Zt(0,"nile-chart",1,0),t&2&&It("no-header",M.isKpiConfig?"":null)},styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;width:100%;height:100%}nile-chart[_ngcontent-%COMP%]{display:block;width:100%;height:100%}nile-chart[_ngcontent-%COMP%]::part(ai-trigger){display:none}nile-chart[_ngcontent-%COMP%]::part(header){border-bottom:none}'],changeDetection:0})};var vH="wfi.theme",gut="(prefers-color-scheme: dark)";function uJt(i){return i==="light"||i==="dark"||i==="system"}var YH=class i{_choice=ke(this.readStoredChoice());_systemDark=ke(this.readSystemDark());choice=this._choice.asReadonly();resolved=At(()=>{let e=this._choice();return e!=="system"?e:this._systemDark()?"dark":"light"});isDark=At(()=>this.resolved()==="dark");constructor(){this.apply(),this.watchSystem()}set(e){this._choice.set(e),this.persist(e),this.apply()}toggle(){this.set(this.resolved()==="dark"?"light":"dark")}apply(){typeof document>"u"||(document.documentElement.dataset.theme=this.resolved())}watchSystem(){if(typeof window>"u"||typeof window.matchMedia!="function")return;window.matchMedia(gut).addEventListener("change",t=>{this._systemDark.set(t.matches),this._choice()==="system"&&this.apply()})}readSystemDark(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(gut).matches}readStoredChoice(){try{let e=localStorage.getItem(vH);if(uJt(e))return e}catch{}return"light"}persist(e){try{localStorage.setItem(vH,e)}catch{}}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};function cJt(i){let e=(i??"").trim();return e?Su.getMarked().parse(e,{async:!1}):""}function DJt(i){if(i&&typeof i=="object")return i;if(typeof i=="string"){let e=i.trim();if(!e.startsWith("{"))return null;try{let t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}return null}function IJt(...i){for(let e of i)if(typeof e=="string"&&e.trim())return e.trim();return null}function dJt(i,e="Something went wrong. Please try again."){let t=i??{},M=DJt(t.error),n=IJt(M?.error,M?.message,M?.detail);if(n&&!G3(n))return n;switch(!0){case t.status===0:return"Couldn't reach the server. Check your connection and try again.";case t.status===401:return"Your session has expired. Sign in again to continue.";case t.status===403:return"You don't have permission to do this.";case t.status===404:return"That's no longer available. Refresh and try again.";case t.status===409:return"That conflicts with something that already exists.";case t.status===413:return"That file is too large.";case t.status===429:return"Too many requests. Wait a moment and try again.";case(typeof t.status=="number"&&t.status>=500):return"The server had a problem. Try again in a moment.";default:return e}}var ZH="__dvRouteProgressHub__";function jJt(){return typeof window>"u"?{count:0,listeners:new Set}:(window[ZH]||(window[ZH]={count:0,listeners:new Set}),window[ZH])}var UQ=class i{hub=jJt();_inFlight=ke(this.hub.count);inFlight=this._inFlight.asReadonly();constructor(){let e=()=>this._inFlight.set(this.hub.count);this.hub.listeners.add(e),Fe(rl).onDestroy(()=>this.hub.listeners.delete(e))}start(){this.hub.count++,this.notify();let e=!1;return()=>{e||(e=!0,this.hub.count=Math.max(0,this.hub.count-1),this.notify())}}async track(e){let t=this.start();try{return await e}finally{t()}}notify(){let e=Array.from(this.hub.listeners);for(let t of e)t()}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var Hu=class i{constructor(e){this.http=e}http;baseUrl=Fe(Tm);tokenStore=Fe(vr);get customerId(){return this.tokenStore.tenantId()??""}get productId(){return Oi()}get headers(){return new ic({"X-Customer-ID":this.customerId})}async listConnectionTables(e,t,M="mssql"){let n=t?.page??1,r=t?.pageSize??20,o=t?.type??"any",a=`${this.baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce/connections/${e}/tables?page=${n}&pageSize=${r}&type=${o}&includeDdl=false`,s=await oi(this.http.get(a));return{tables:s?.data??[],meta:{total:s?.meta?.total??0,page:s?.meta?.page??n,pageSize:s?.meta?.pageSize??r,totalPages:s?.meta?.totalPages??1,database:s?.meta?.database}}}async exploreConnectionTable(e,t,M="mssql"){return(await oi(this.http.get(`${this.baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce/connections/${e}/tables/explore?table=${encodeURIComponent(t)}`))).data}async exploreOpenSearchIndex(e,t){let M=await oi(this.http.get(`${this.baseUrl}/api/customers/${this.customerId}/products/${this.productId}/OS-connections/${e}/indexes/explore?index=${encodeURIComponent(t)}`,{headers:this.headers}));return{index:t,fields:yJt(M?.data??{})}}async exploreTablesBatched(e,t,M=5,n="mssql",r){return Nut(t,o=>this.exploreConnectionTable(e,o,n),M,r)}async exploreOpenSearchIndexesBatched(e,t,M=5){return Nut(t,n=>this.exploreOpenSearchIndex(e,n),M)}static \u0275fac=function(t){return new(t||i)(Ji(yo))};static \u0275prov=Ct({token:i,factory:i.\u0275fac})};async function Nut(i,e,t,M){let n=Math.max(1,t),r=[];for(let o=0;o<i.length;o+=n){let a=await Promise.allSettled(i.slice(o,o+n).map(e));r.push(...a),M?.(r.length,i.length)}return r}function yJt(i){let e=i.fields;if(Array.isArray(e))return e.map(r=>{let o=r,a=o.name??o.field,s=o.dataType??o.type;return a?{name:a,dataType:s??"unknown"}:null}).filter(r=>!!r);let t=i.mappings??i,M=uut(t);if(!M)return[];let n=[];return cut(M,"",n),n}function uut(i){if(!i||typeof i!="object")return null;let e=i.properties;if(e&&typeof e=="object")return e;for(let t of Object.values(i))if(t&&typeof t=="object"){let M=uut(t);if(M)return M}return null}function cut(i,e,t){for(let[M,n]of Object.entries(i)){if(!n||typeof n!="object")continue;let r=n,o=e?`${e}.${M}`:M,a=r.properties;if(a)cut(a,o,t);else{let s=r.type??"unknown";t.push({name:o,dataType:s})}}}var TJt=()=>[1,2,3,4];function AJt(i,e){return this.itemKey(e)}var zJt=(i,e)=>e.name;function hJt(i,e){if(i&1&&(C(0,"span",4),Y(1),b()),i&2){let t=p();L(),yi("\xB7 ",t.listMeta().database)}}function xJt(i,e){i&1&&Zt(0,"span",22)}function pJt(i,e){if(i&1){let t=Le();C(0,"div",5)(1,"nile-button",20),Ae("click",function(){P(t);let n=p();return R(n.cancel.emit())}),Y(2,"Cancel"),b(),C(3,"nile-button",21),Ae("click",function(){P(t);let n=p();return R(n.update.emit())}),he(4,xJt,1,0,"span",22),Y(5," Update "),b()()}if(i&2){let t=p();L(3),It("loading",t.updating?"":null)("disabled",t.updating?"":null),L(),xe(t.updating?4:-1)}}function LJt(i,e){if(i&1&&(C(0,"div",6),Zt(1,"nile-glyph",23),C(2,"span"),Y(3),b()()),i&2){let t=p();L(3),it(t.loadError())}}function OJt(i,e){i&1&&(C(0,"div",24),Zt(1,"nile-skeleton-loader",25),C(2,"div",26),Zt(3,"nile-skeleton-loader",27)(4,"nile-skeleton-loader",28),b()())}function mJt(i,e){if(i&1&&ht(0,OJt,5,0,"div",24,Ho),i&2){let t=p();xt(t.skeletonRows)}}function EJt(i,e){i&1&&(C(0,"div",16),Y(1,"No tables match."),b())}function fJt(i,e){if(i&1){let t=Le();C(0,"nile-checkbox",36),Ae("click",function(n){return n.stopPropagation()})("nile-change",function(){P(t);let n=p().$implicit,r=p(2);return R(r.toggleTableSelection(n))}),b()}if(i&2){let t=p().$implicit,M=p(2);It("checked",M.isTableChecked(t)?"":null)}}function SJt(i,e){if(i&1&&(C(0,"span",35),Y(1),b()),i&2){let t=p().$implicit,M=p(2);L(),Jo(" ",M.exploredEntity(M.itemKey(t)).selectedColumns.size,"/",M.exploredEntity(M.itemKey(t)).columns.length," cols ")}}function wJt(i,e){if(i&1&&(C(0,"span",35),Y(1),b()),i&2){let t=p().$implicit;L(),yi("",t.rowCount," rows")}}function CJt(i,e){if(i&1){let t=Le();C(0,"div",30),he(1,fJt,1,1,"nile-checkbox",31),C(2,"button",32),Ae("click",function(){let n=P(t).$implicit,r=p(2);return R(r.selectListItem(n))}),C(3,"span",33),Y(4),b(),C(5,"span",26)(6,"span",34),Y(7),b(),he(8,SJt,2,2,"span",35)(9,wJt,2,1,"span",35),b()()()}if(i&2){let t=e.$implicit,M=p(2);Wt("cs__table-row--multi",M.multiSelect)("cs__table-row--active",M.selectedKey()===M.itemKey(t)),L(),xe(M.multiSelect?1:-1),L(),Wt("cs__table--active",M.selectedKey()===M.itemKey(t)),L(2),it(M.itemKey(t)),L(2),Wt("cs__table-badge--root",M.isPreselected(t))("cs__table-badge--related",!M.isPreselected(t)),L(),it(M.isPreselected(t)?"selected":t.type==="VIEW"?"view":"table"),L(),xe(M.isExplored(t)?8:9)}}function kJt(i,e){if(i&1&&ht(0,CJt,10,14,"div",29,AJt,!0),i&2){let t=p();xt(t.filteredList())}}function bJt(i,e){i&1&&(C(0,"div",41),Zt(1,"nile-skeleton-loader",44)(2,"nile-skeleton-loader",45),b())}function QJt(i,e){i&1&&(C(0,"div",43)(1,"span",46),Zt(2,"nile-skeleton-loader",47),b(),C(3,"span",48),Zt(4,"nile-skeleton-loader",49),b(),C(5,"span",50),Zt(6,"nile-skeleton-loader",49),b(),C(7,"span",51),Zt(8,"nile-skeleton-loader",49),b(),C(9,"span",52),Zt(10,"nile-skeleton-loader",49),b()())}function UJt(i,e){if(i&1&&(C(0,"div",37)(1,"div",38),Zt(2,"nile-skeleton-loader",39),b(),C(3,"div",40),ht(4,bJt,3,0,"div",41,Ho),b()(),C(6,"div",42),ht(7,QJt,11,0,"div",43,Ho),b()),i&2){let t=p();L(4),xt(Nd(0,TJt)),L(3),xt(t.skeletonRows)}}function vJt(i,e){i&1&&Zt(0,"nile-glyph",66)}function YJt(i,e){if(i&1&&(C(0,"span",67),Y(1),b()),i&2){let t=p().$implicit;L(),yi("len:",t.maxLength===-1?"max":t.maxLength)}}function ZJt(i,e){if(i&1&&(C(0,"span",68),Y(1),b()),i&2){let t=p().$implicit;L(),yi("p:",t.precision)}}function _Jt(i,e){if(i&1&&(C(0,"span",69),Y(1),b()),i&2){let t=p().$implicit;L(),yi("s:",t.scale)}}function WJt(i,e){i&1&&(C(0,"span",70),Y(1,"\u2014"),b())}function PJt(i,e){if(i&1){let t=Le();C(0,"label",64)(1,"span",46)(2,"nile-checkbox",65),Ae("nile-change",function(){let n=P(t).$implicit,r=p(),o=p();return R(o.toggleColumn(r,n.name))}),b()(),C(3,"span",48),Y(4),he(5,vJt,1,0,"nile-glyph",66),b(),C(6,"span",50),Y(7),b(),C(8,"span",51),he(9,YJt,2,1,"span",67),he(10,ZJt,2,1,"span",68),he(11,_Jt,2,1,"span",69),he(12,WJt,2,0,"span",70),b(),C(13,"span",52),Y(14),b()()}if(i&2){let t=e.$implicit,M=p();Wt("cs__col--selected",M.selectedColumns.has(t.name)),L(2),It("checked",M.selectedColumns.has(t.name)?"":null),L(2),yi(" ",t.name," "),L(),xe(t.isPrimaryKey?5:-1),L(2),it(t.dataType),L(2),xe(t.maxLength!=null?9:-1),L(),xe(t.precision!=null?10:-1),L(),xe(t.scale!=null?11:-1),L(),xe(t.maxLength==null&&t.precision==null&&t.scale==null?12:-1),L(),Wt("cs__col-null--required",!t.nullable),L(),yi(" ",t.nullable?"NULL":"NOT NULL"," ")}}function RJt(i,e){if(i&1){let t=Le();C(0,"div",37)(1,"div",38)(2,"span",53),Y(3),b(),C(4,"span",34),Y(5),b()(),C(6,"div",40)(7,"div",41)(8,"span",54),Y(9,"COLUMNS"),b(),C(10,"span",55),Y(11),b()(),C(12,"div",41)(13,"span",54),Y(14,"SELECTED"),b(),C(15,"span",55),Y(16),b()(),C(17,"div",41)(18,"span",54),Y(19,"ROWS"),b(),C(20,"span",55),Y(21),b()(),C(22,"div",41)(23,"span",54),Y(24,"NULLABLE"),b(),C(25,"span",55),Y(26),b()()()(),C(27,"div",42)(28,"div",56)(29,"span",57)(30,"nile-checkbox",58),Ae("nile-change",function(){let n=P(t),r=p();return R(r.toggleAllColumns(n))}),b()(),C(31,"span",59),Y(32,"Column"),b(),C(33,"span",60),Y(34,"Type"),b(),C(35,"span",61),Y(36,"Precision"),b(),C(37,"span",62),Y(38,"Nullable"),b()(),ht(39,PJt,15,13,"label",63,zJt),b()}if(i&2){let t=e,M=p();L(3),it(M.entityKey(t)),L(),Wt("cs__table-badge--root",t.isRoot)("cs__table-badge--related",!t.isRoot),L(),it(t.isRoot?"selected":"browsing"),L(6),it(t.columns.length),L(5),it(M.selectedSelectedCount()),L(5),it(t.rowCount),L(5),it(M.selectedNullableCount()),L(4),It("checked",M.isAllSelected(t)?"":null)("indeterminate",M.isIndeterminate(t)?"":null),L(9),xt(t.columns)}}function VJt(i,e){i&1&&(C(0,"div",18),Y(1,"Select a table to view its columns."),b())}function BJt(i,e){if(i&1){let t=Le();C(0,"nile-pagination",71),Ae("nile-change",function(n){P(t);let r=p();return R(r.onPageChange(n))}),b()}if(i&2){let t=p();It("totalitems",t.listMeta().total)("currentpage",t.currentPage())("pagesize",t.pageSize())}}var _H=class i{constructor(e){this.schemaExplorer=e}schemaExplorer;connectionId;adapterType="mssql";tables=[];preselectedColumns={};showActions=!1;updating=!1;multiSelect=!1;cancel=new Xt;update=new Xt;selectedTablesChange=new Xt;selectedTables=ke(new Set);entities=ke([]);isLoading=ke(!1);loadError=ke("");tableList=ke([]);listMeta=ke({total:0,page:1,pageSize:20,totalPages:1});currentPage=ke(1);pageSize=ke(20);typeFilter=ke("any");search=ke("");selectedKey=ke(null);exploringKey=ke(null);isSelectingAll=ke(!1);selectAllProgress=ke(null);skeletonRows=[1,2,3,4,5,6];preselectedKeys=new Set;preselectedColumnsByKey=new Map;touchedKeys=new Set;ngOnInit(){for(let e of this.tables)this.preselectedKeys.add(e.toLowerCase());for(let[e,t]of Object.entries(this.preselectedColumns))this.preselectedColumnsByKey.set(e.toLowerCase(),t);this.multiSelect&&this.selectedTables.set(new Set(this.tables)),this.loadTables(),this.multiSelect&&this.tables.length===0&&this.selectAllAcrossPages()}isTableChecked(e){return this.selectedTables().has(this.itemKey(e))}async toggleTableSelection(e){let t=this.itemKey(e);this.touchedKeys.add(t);let M=this.selectedTables().has(t);this.selectedTables.update(n=>{let r=new Set(n);return M?r.delete(t):r.add(t),r}),this.selectedTablesChange.emit([...this.selectedTables()]),!M&&!this.entities().some(n=>this.entityKey(n)===t)&&await this.selectListItem(e)}filteredList=At(()=>{let e=this.search().trim().toLowerCase();return e?this.tableList().filter(t=>`${t.schema}.${t.table}`.toLowerCase().includes(e)):this.tableList()});isPreselected(e){return this.preselectedKeys.has(`${e.schema}.${e.table}`.toLowerCase())}itemKey(e){return`${e.schema}.${e.table}`}isExplored(e){let t=this.itemKey(e);return this.entities().some(M=>this.entityKey(M)===t)}exploredEntity(e){return this.entities().find(t=>this.entityKey(t)===e)}setTypeFilter(e){this.typeFilter()!==e&&(this.typeFilter.set(e),this.currentPage.set(1),this.loadTables())}onPageChange(e){let t=e.detail;t&&(this.currentPage.set(t.page),this.pageSize.set(t.pageSize),this.loadTables())}onSearch(e){let M=e.detail?.value??e.target?.value??"";this.search.set(M)}async loadTables(){this.isLoading.set(!0),this.loadError.set("");try{let{tables:e,meta:t}=await this.schemaExplorer.listConnectionTables(this.connectionId,{page:this.currentPage(),pageSize:this.pageSize(),type:this.typeFilter()},this.adapterType);this.tableList.set(e),this.listMeta.set(t),!this.selectedKey()&&e.length&&await this.selectListItem(e[0])}catch(e){this.loadError.set(e instanceof Error?e.message:"Failed to load tables.")}finally{this.isLoading.set(!1)}}async selectAllAcrossPages(){this.isSelectingAll.set(!0);try{let e=[],M=1,n=1;do{let{tables:N,meta:c}=await this.schemaExplorer.listConnectionTables(this.connectionId,{page:M,pageSize:100,type:"any"},this.adapterType);e.push(...N),n=c.totalPages||1,M++}while(M<=n);let r=e.filter(N=>!this.touchedKeys.has(this.itemKey(N)));if(!r.length)return;this.selectedTables.update(N=>new Set([...N,...r.map(c=>this.itemKey(c))])),this.selectedTablesChange.emit([...this.selectedTables()]);let o=new Set(this.entities().map(N=>this.entityKey(N))),a=r.filter(N=>!o.has(this.itemKey(N)));if(!a.length)return;this.selectAllProgress.set({done:0,total:a.length});let l=(await this.schemaExplorer.exploreTablesBatched(this.connectionId,a.map(N=>this.itemKey(N)),5,this.adapterType,(N,c)=>this.selectAllProgress.set({done:N,total:c}))).map((N,c)=>N.status==="fulfilled"?this.toEntity(a[c],N.value):null).filter(N=>N!==null);l.length&&this.entities.update(N=>{let c=new Set(N.map(I=>this.entityKey(I))),D=l.filter(I=>!c.has(this.entityKey(I)));return D.length?[...N,...D]:N})}catch(e){this.loadError.set(e instanceof Error?e.message:"Failed to select all tables.")}finally{this.isSelectingAll.set(!1),this.selectAllProgress.set(null)}}async selectListItem(e){let t=this.itemKey(e);if(this.selectedKey.set(t),!this.entities().some(M=>this.entityKey(M)===t)){this.exploringKey.set(t);try{await this.ensureExplored(e)}catch(M){this.loadError.set(M instanceof Error?M.message:"Failed to explore table.")}finally{this.exploringKey.set(null)}}}async ensureExplored(e){let t=this.itemKey(e);if(this.entities().some(n=>this.entityKey(n)===t))return;let M=await this.schemaExplorer.exploreConnectionTable(this.connectionId,t,this.adapterType);this.entities().some(n=>this.entityKey(n)===t)||this.entities.update(n=>[...n,this.toEntity(e,M)])}toEntity(e,t){let M=this.itemKey(e),n=t.table.schema==="%"?"dbo":t.table.schema,r=this.preselectedKeys.has(M.toLowerCase()),o=this.preselectedColumnsByKey.get(M.toLowerCase());return{tableName:t.table.name,schema:n,rowCount:t.table.rowCount,columns:t.columns,primaryKey:t.primaryKey,relatedTables:t.relatedTables,referencedBy:t.referencedBy,showAll:!1,selectedColumns:o?.length?new Set(t.columns.filter(a=>o.includes(a.name)).map(a=>a.name)):new Set(t.columns.map(a=>a.name)),isRoot:r}}selectedEntity=At(()=>{let e=this.selectedKey();return e?this.entities().find(t=>this.entityKey(t)===e)??null:null});selectedNullableCount=At(()=>{let e=this.selectedEntity();return e?e.columns.filter(t=>t.nullable).length:0});selectedSelectedCount=At(()=>{let e=this.selectedEntity();return e?e.selectedColumns.size:0});entityKey(e){return`${e.schema}.${e.tableName}`}toggleColumn(e,t){this.entities.update(M=>M.map(n=>{if(n!==e)return n;let r=new Set(n.selectedColumns);return r.has(t)?r.delete(t):r.add(t),U(x({},n),{selectedColumns:r})}))}toggleAllColumns(e){this.entities.update(t=>t.map(M=>{if(M!==e)return M;let n=M.columns.every(r=>M.selectedColumns.has(r.name));return U(x({},M),{selectedColumns:n?new Set:new Set(M.columns.map(r=>r.name))})}))}isAllSelected(e){return e.columns.length>0&&e.columns.every(t=>e.selectedColumns.has(t.name))}isIndeterminate(e){let t=e.columns.filter(M=>e.selectedColumns.has(M.name)).length;return t>0&&t<e.columns.length}static \u0275fac=function(t){return new(t||i)(ni(Hu))};static \u0275cmp=rM({type:i,selectors:[["app-er-diagram"]],inputs:{connectionId:"connectionId",adapterType:"adapterType",tables:"tables",preselectedColumns:"preselectedColumns",showActions:"showActions",updating:"updating",multiSelect:"multiSelect"},outputs:{cancel:"cancel",update:"update",selectedTablesChange:"selectedTablesChange"},features:[tN([Hu])],decls:32,vars:14,consts:[[1,"cs"],[1,"cs__head"],[1,"cs__head-left"],[1,"cs__title"],[1,"cs__conn"],[1,"cs__actions"],[1,"cs__empty","cs__empty--error"],[1,"cs__body"],[1,"cs__tables"],[1,"cs__tables-head"],[1,"cs__tables-title"],[1,"cs__tables-count"],["placeholder","Search tables\u2026",1,"cs__search",3,"nile-input","input","value"],[1,"cs__filters"],["type","button",1,"cs__filter",3,"click"],[1,"cs__tablelist"],[1,"cs__empty","cs__empty--mini"],[1,"cs__columns"],[1,"cs__empty"],["variant","fluid","pagesizeoptions","[10,20,50,100]",1,"cs__pagination"],["variant","tertiary",3,"click"],["variant","primary",3,"click"],["slot","prefix",1,"btn-spinner","btn-spinner--light"],["name","ng-alert-circle","size","20","method","stroke"],[1,"cs__table","cs__table--skeleton"],[1,"cs__skeleton","cs__skeleton--name"],[1,"cs__table-meta"],[1,"cs__skeleton","cs__skeleton--badge"],[1,"cs__skeleton","cs__skeleton--meta"],[1,"cs__table-row",3,"cs__table-row--multi","cs__table-row--active"],[1,"cs__table-row"],[1,"cs__table-check"],["type","button",1,"cs__table",3,"click"],[1,"cs__table-name"],[1,"cs__table-badge"],[1,"cs__table-rows"],[1,"cs__table-check",3,"click","nile-change"],[1,"cs__cols-head"],[1,"cs__head-titlerow"],[1,"cs__skeleton","cs__skeleton--title"],[1,"cs__stats"],[1,"cs__stat"],[1,"cs__col-rows"],[1,"cs__col","cs__col--skeleton"],[1,"cs__skeleton","cs__skeleton--stat-label"],[1,"cs__skeleton","cs__skeleton--stat-value"],[1,"cs__col-check"],[1,"cs__skeleton","cs__skeleton--check"],[1,"cs__col-name"],[1,"cs__skeleton","cs__skeleton--cell"],[1,"cs__col-type"],[1,"cs__col-meta"],[1,"cs__col-null"],[1,"cs__cols-name"],[1,"cs__stat-label"],[1,"cs__stat-value"],[1,"cs__col","cs__col--header"],[1,"cs__col-check","cs__col-th"],["title","Toggle all columns",3,"nile-change"],[1,"cs__col-name","cs__col-th"],[1,"cs__col-type","cs__col-th"],[1,"cs__col-meta","cs__col-th"],[1,"cs__col-null","cs__col-th"],[1,"cs__col","cs__col--row",3,"cs__col--selected"],[1,"cs__col","cs__col--row"],[3,"nile-change"],["name","ng-key-01","method","stroke","size","12","title","Primary key",1,"cs__pk"],["title","Max length",1,"cs__chip"],["title","Precision",1,"cs__chip"],["title","Scale",1,"cs__chip"],[1,"cs__chip","cs__chip--dim"],["variant","fluid","pagesizeoptions","[10,20,50,100]",1,"cs__pagination",3,"nile-change"]],template:function(t,M){if(t&1&&(C(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),Y(4,"Schema"),b(),he(5,hJt,2,1,"span",4),b(),he(6,pJt,6,3,"div",5),b(),he(7,LJt,4,1,"div",6),C(8,"div",7)(9,"aside",8)(10,"div",9)(11,"span",10),Y(12,"Tables"),b(),C(13,"span",11),Y(14),b()(),C(15,"nile-input",12),Ae("nile-input",function(r){return M.onSearch(r)})("input",function(r){return M.onSearch(r)}),b(),C(16,"div",13)(17,"button",14),Ae("click",function(){return M.setTypeFilter("any")}),Y(18,"All"),b(),C(19,"button",14),Ae("click",function(){return M.setTypeFilter("table")}),Y(20,"Tables"),b(),C(21,"button",14),Ae("click",function(){return M.setTypeFilter("view")}),Y(22,"Views"),b()(),C(23,"div",15),he(24,mJt,2,0)(25,EJt,2,0,"div",16)(26,kJt,2,0),b()(),C(27,"section",17),he(28,UJt,9,1)(29,RJt,41,12)(30,VJt,2,0,"div",18),b()(),he(31,BJt,1,3,"nile-pagination",19),b()),t&2){let n;L(5),xe(M.listMeta().database?5:-1),L(),xe(M.showActions?6:-1),L(),xe(M.loadError()?7:-1),L(7),yi("",M.listMeta().total," items"),L(),Ue("value",M.search()),L(2),Wt("cs__filter--active",M.typeFilter()==="any"),L(2),Wt("cs__filter--active",M.typeFilter()==="table"),L(2),Wt("cs__filter--active",M.typeFilter()==="view"),L(3),xe(M.isLoading()&&M.tableList().length===0?24:M.filteredList().length===0?25:26),L(4),xe(M.exploringKey()&&!M.selectedEntity()?28:(n=M.selectedEntity())?29:30,n),L(3),xe(M.listMeta().totalPages>1?31:-1)}},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0}.cs[_ngcontent-%COMP%]{background:var(--ng-colors-bg-primary);overflow:hidden;display:flex;flex-direction:column;flex:1;max-height:100%;border:1px solid var(--ng-colors-border-secondary);border-radius:12px;box-shadow:0 1px 2px #0a0d120d}.cs__head[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid var(--ng-colors-border-secondary);font-size:13px;flex-shrink:0}.cs__head-left[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:8px}.cs__actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.cs__title[_ngcontent-%COMP%]{font-weight:600;color:var(--ng-colors-text-primary-900)}.cs__conn[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:var(--ng-colors-text-tertiary-600);font-size:12px}.cs__body[_ngcontent-%COMP%]{display:grid;grid-template-columns:280px 1fr;flex:1 1 auto;min-height:0;overflow:hidden}.cs__tables[_ngcontent-%COMP%]{display:flex;flex-direction:column;border-right:1px solid var(--ng-colors-border-secondary);min-height:0}.cs__tables-head[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between;padding:12px 14px 6px}.cs__tables-title[_ngcontent-%COMP%]{font-size:13px;font-weight:600;color:var(--ng-colors-text-primary-900)}.cs__tables-count[_ngcontent-%COMP%]{font-size:11px;color:var(--ng-colors-text-tertiary-600)}.cs__search[_ngcontent-%COMP%]{padding:4px 12px 8px}.cs__filters[_ngcontent-%COMP%]{display:flex;gap:6px;padding:0 12px 10px;flex-wrap:wrap}.cs__filter[_ngcontent-%COMP%]{background:var(--ng-colors-bg-secondary);border:0;border-radius:999px;padding:4px 12px;font-size:12px;color:var(--ng-colors-text-tertiary-600);cursor:pointer;transition:background .1s ease,color .1s ease}.cs__filter[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-quaternary)}.cs__filter--active[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary);color:var(--ng-colors-border-brand);font-weight:500}.cs__tablelist[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:4px 6px 8px;min-height:0}.cs__pagination[_ngcontent-%COMP%]{display:block;flex-shrink:0;border-top:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary)}.cs__table-row[_ngcontent-%COMP%]{display:flex;align-items:stretch;gap:4px}.cs__table-row--multi[_ngcontent-%COMP%] .cs__table[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0}.cs__table-check[_ngcontent-%COMP%]{align-self:center;flex-shrink:0;padding-left:4px}.cs__table[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:stretch;width:100%;text-align:left;background:transparent;border:0;padding:10px 12px;border-radius:8px;cursor:pointer;gap:4px;transition:background .12s ease}.cs__table[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.cs__table--active[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary)}.cs__table--active[_ngcontent-%COMP%] .cs__table-name[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand);font-weight:500}.cs__table-name[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;color:var(--ng-colors-text-primary-900);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cs__table-meta[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:6px}.cs__table-rows[_ngcontent-%COMP%]{font-size:11px;color:var(--ng-colors-text-tertiary-600)}.cs__table-badge[_ngcontent-%COMP%]{display:inline-block;font-size:9.5px;font-weight:500;letter-spacing:.4px;text-transform:uppercase;padding:1px 6px;border-radius:999px}.cs__table-badge--root[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand);background:var(--ng-colors-bg-brand-primary)}.cs__table-badge--related[_ngcontent-%COMP%]{color:var(--ng-colors-text-tertiary-600);background:var(--ng-colors-bg-secondary)}.cs__columns[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-height:0;background:var(--ng-colors-bg-secondary-subtle)}.cs__cols-head[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding:14px 18px;border-bottom:1px solid var(--ng-colors-border-secondary);flex-shrink:0}.cs__head-titlerow[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px}.cs__cols-name[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;color:var(--ng-colors-text-primary-900)}.cs__stats[_ngcontent-%COMP%]{display:flex;gap:24px}.cs__stat[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px}.cs__stat-label[_ngcontent-%COMP%]{font-size:10px;font-weight:600;letter-spacing:.4px;color:var(--ng-colors-text-tertiary-600)}.cs__stat-value[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:14px;color:var(--ng-colors-text-primary-900)}.cs__col-rows[_ngcontent-%COMP%]{flex:1;overflow-y:auto;background:transparent}.cs__col[_ngcontent-%COMP%]{display:grid;grid-template-columns:36px minmax(160px,1.4fr) 120px 1fr 110px;align-items:center;width:100%;text-align:left;padding:8px 14px;gap:10px;cursor:pointer;border-bottom:1px solid var(--ng-colors-border-tertiary);margin:0;transition:background .12s ease}.cs__col--row[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.cs__col--selected[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary)}.cs__col--header[_ngcontent-%COMP%]{cursor:default;background:var(--ng-colors-bg-secondary);position:sticky;top:0;z-index:1}.cs__col-th[_ngcontent-%COMP%]{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;color:var(--ng-colors-text-tertiary-600);font-family:-apple-system,BlinkMacSystemFont,sans-serif}.cs__col-check[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}.cs__col-name[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;color:var(--ng-colors-text-primary-900);display:inline-flex;align-items:center;gap:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cs__pk[_ngcontent-%COMP%]{color:var(--ng-colors-fg-warning-primary);flex-shrink:0}.cs__col-type[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;color:var(--ng-colors-text-tertiary-600)}.cs__col-meta[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:4px;flex-wrap:wrap}.cs__chip[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:10px;color:var(--ng-colors-text-tertiary-600);background:var(--ng-colors-bg-secondary);border-radius:4px;padding:1px 5px}.cs__chip--dim[_ngcontent-%COMP%]{opacity:.5}.cs__col-null[_ngcontent-%COMP%]{display:inline-block;justify-self:start;font-size:10px;font-weight:500;letter-spacing:.3px;color:var(--ng-colors-text-tertiary-600);background:var(--ng-colors-bg-secondary);border-radius:4px;padding:2px 6px}.cs__col-null--required[_ngcontent-%COMP%]{color:var(--ng-colors-fg-success-primary);background:var(--ng-colors-bg-success-secondary)}.cs__empty[_ngcontent-%COMP%]{padding:24px;text-align:center;font-size:13px;color:var(--ng-colors-text-tertiary-600);display:flex;flex-direction:column;align-items:center;gap:8px}.cs__empty--error[_ngcontent-%COMP%]{color:var(--ng-colors-fg-error-primary)}.cs__empty--mini[_ngcontent-%COMP%]{padding:14px;font-size:12px}.cs__skeleton[_ngcontent-%COMP%]{display:block;border-radius:4px}.cs__skeleton--name[_ngcontent-%COMP%]{width:70%;height:14px}.cs__skeleton--badge[_ngcontent-%COMP%]{width:56px;height:12px;border-radius:999px}.cs__skeleton--meta[_ngcontent-%COMP%]{width:50px;height:12px}.cs__skeleton--title[_ngcontent-%COMP%]{width:240px;height:16px}.cs__skeleton--stat-label[_ngcontent-%COMP%]{width:60px;height:10px;margin-bottom:4px}.cs__skeleton--stat-value[_ngcontent-%COMP%]{width:36px;height:16px}.cs__skeleton--check[_ngcontent-%COMP%]{width:16px;height:16px;border-radius:4px}.cs__skeleton--cell[_ngcontent-%COMP%]{height:12px;width:80%}.cs__table--skeleton[_ngcontent-%COMP%]{cursor:default}.cs__table--skeleton[_ngcontent-%COMP%]:hover{background:transparent}.cs__col--skeleton[_ngcontent-%COMP%]{cursor:default}.cs__col--skeleton[_ngcontent-%COMP%]:hover{background:transparent}"]})};function Iut(i,e){return this.entityKey(e)}var dut=(i,e)=>e.name;function FJt(i,e){i&1&&(C(0,"div",1),Zt(1,"span",5),C(2,"span"),Y(3,"Loading index schemas\u2026"),b()())}function HJt(i,e){if(i&1&&(C(0,"div",2),Zt(1,"nile-glyph",6),C(2,"p"),Y(3),b()()),i&2){let t=p();L(3),it(t.loadError())}}function JJt(i,e){i&1&&(C(0,"div",1),Zt(1,"nile-glyph",7),C(2,"p"),Y(3,"No indices loaded."),b()())}function GJt(i,e){if(i&1){let t=Le();C(0,"button",17),Ae("click",function(){let n=P(t).$index,r=p(2);return R(r.selectIndex(n))}),C(1,"nile-checkbox",18),Ae("click",function(n){return n.stopPropagation()})("nile-change",function(){let n=P(t).$implicit,r=p(2);return R(r.toggleAllColumns(n))}),b(),C(2,"span",19),Y(3),b(),C(4,"span",20)(5,"span",21),Y(6),b(),Zt(7,"nile-glyph",22),b()()}if(i&2){let t=e.$implicit,M=e.$index,n=p(2);Wt("obj-row--active",M===n.selectedIdx()),L(),It("checked",n.isAllSelected(t)?"":null)("indeterminate",n.isIndeterminate(t)?"":null)("aria-label","Toggle "+t.tableName),L(2),it(t.tableName),L(2),Wt("obj-count--on",t.selectedColumns.size>0),L(),Jo(" ",t.selectedColumns.size,"/",t.columns.length," ")}}function $Jt(i,e){if(i&1){let t=Le();C(0,"button",30),Ae("click",function(){let n=P(t).$implicit,r=p(),o=p(2);return R(o.toggleColumn(r,n.name))}),C(1,"nile-checkbox",31),Ae("click",function(n){return n.stopPropagation()})("nile-change",function(){let n=P(t).$implicit,r=p(),o=p(2);return R(o.toggleColumn(r,n.name))}),b(),C(2,"span",32),Y(3),b(),C(4,"span",33),Y(5),b()()}if(i&2){let t=e.$implicit,M=p();Wt("field-row--on",M.selectedColumns.has(t.name)),L(),It("checked",M.selectedColumns.has(t.name)?"":null),L(2),it(t.name),L(2),it(t.dataType)}}function XJt(i,e){if(i&1){let t=Le();C(0,"div",16)(1,"div",11)(2,"div",23)(3,"h4",24),Y(4),b(),C(5,"p",25),Y(6),b()(),C(7,"div",26)(8,"nile-button",27),Ae("click",function(){let n=P(t),r=p(2);return R(r.toggleAllColumns(n))}),Y(9),b()()(),C(10,"div",28),ht(11,$Jt,6,5,"button",29,dut),b()()}if(i&2){let t=e,M=p(2);L(4),it(t.tableName),L(2),Jo("",t.selectedColumns.size," of ",t.columns.length," fields selected"),L(3),yi(" ",M.isAllSelected(t)?"Clear all":"Select all"," "),L(2),xt(t.columns)}}function qJt(i,e){if(i&1&&(C(0,"section",3)(1,"div",8)(2,"div",9)(3,"div",10)(4,"div",11)(5,"div")(6,"div",12),Y(7,"Indices"),b(),C(8,"div",13),Y(9),b()()(),C(10,"div",14),ht(11,GJt,8,10,"button",15,Iut,!0),b()(),he(13,XJt,13,4,"div",16),b()()()),i&2){let t,M=p();L(9),yi("",M.entities().length," total"),L(2),xt(M.entities()),L(2),xe((t=M.selectedEntity())?13:-1,t)}}function KJt(i,e){if(i&1){let t=Le();C(0,"li",46)(1,"label",48)(2,"nile-checkbox",41),Ae("nile-change",function(){let n=P(t).$implicit,r=p().$implicit,o=p(2);return R(o.toggleColumn(r,n.name))}),b(),C(3,"span",49),Y(4),b(),C(5,"span",50),Y(6),b()()()}if(i&2){let t=e.$implicit,M=p().$implicit;L(2),It("checked",M.selectedColumns.has(t.name)?"":null),L(),Ue("title",t.name),L(),it(t.name),L(2),it(t.dataType)}}function eGt(i,e){i&1&&Y(0," Show less ")}function tGt(i,e){if(i&1&&Y(0),i&2){let t=p(2).$implicit;yi(" Load ",t.columns.length-5," more\u2026 ")}}function iGt(i,e){if(i&1){let t=Le();C(0,"button",51),Ae("click",function(){P(t);let n=p().$implicit,r=p(2);return R(r.toggleShowAll(n))}),he(1,eGt,1,0)(2,tGt,1,1),b()}if(i&2){let t=p().$implicit;L(),xe(t.showAll?1:2)}}function MGt(i,e){if(i&1){let t=Le();C(0,"div",38)(1,"div",39)(2,"label",40)(3,"nile-checkbox",41),Ae("nile-change",function(){let n=P(t).$implicit,r=p(2);return R(r.toggleAllColumns(n))}),b()(),C(4,"div",42),Zt(5,"nile-glyph",35),C(6,"span",43),Y(7),b()(),C(8,"span",44),Y(9,"index"),b()(),C(10,"ul",45),ht(11,KJt,7,4,"li",46,dut),b(),he(13,iGt,3,1,"button",47),b()}if(i&2){let t=e.$implicit,M=p(2);It("data-key",M.entityKey(t)),L(3),It("checked",M.isAllSelected(t)?"":null)("indeterminate",M.isIndeterminate(t)?"":null),L(3),Ue("title",M.entityKey(t)),L(),yi(" ",t.tableName," "),L(4),xt(M.visibleColumns(t)),L(2),xe(t.columns.length>5?13:-1)}}function nGt(i,e){if(i&1&&(C(0,"div",4)(1,"div",34),Zt(2,"nile-glyph",35),C(3,"span"),Y(4,"Indices"),b(),C(5,"span",36),Y(6),b()(),C(7,"div",37),ht(8,MGt,14,6,"div",38,Iut,!0),b()()),i&2){let t=p();L(6),it(t.entities().length),L(2),xt(t.entities())}}var WH=class i{constructor(e){this.schemaExplorer=e}schemaExplorer;connectionId;indexNames=[];preselectedFields={};masterDetail=!1;entities=ke([]);isLoading=ke(!1);loadError=ke("");selectedIdx=ke(0);selectedEntity=At(()=>this.entities()[this.selectedIdx()]);VISIBLE_COLS=5;ngOnInit(){this.loadSchema()}async loadSchema(){this.isLoading.set(!0),this.loadError.set(""),this.entities.set([]);try{let e=await this.schemaExplorer.exploreOpenSearchIndexesBatched(this.connectionId,this.indexNames),t=[];e.forEach((M,n)=>{let r=this.indexNames[n];if(M.status!=="fulfilled")return;let o=M.value,a=o.fields.map((N,c)=>({ordinal:c+1,name:N.name,dataType:N.dataType,nullable:!0,isPrimaryKey:!1})),s=this.preselectedFields[r],l=s&&s.length>0?new Set(a.filter(N=>s.includes(N.name)).map(N=>N.name)):new Set(a.map(N=>N.name));t.push({tableName:o.index,schema:"",rowCount:0,columns:a,primaryKey:[],relatedTables:[],referencedBy:[],showAll:!1,selectedColumns:l,isRoot:!0})}),this.entities.set(t)}catch(e){this.loadError.set(e instanceof Error?e.message:"Failed to load index schemas.")}finally{this.isLoading.set(!1)}}entityKey(e){return e.tableName}selectIndex(e){this.selectedIdx.set(e)}visibleColumns(e){return e.showAll?e.columns:e.columns.slice(0,this.VISIBLE_COLS)}toggleShowAll(e){this.entities.update(t=>t.map(M=>M===e?U(x({},M),{showAll:!M.showAll}):M))}toggleColumn(e,t){this.entities.update(M=>M.map(n=>{if(n!==e)return n;let r=new Set(n.selectedColumns);return r.has(t)?r.delete(t):r.add(t),U(x({},n),{selectedColumns:r})}))}toggleAllColumns(e){this.entities.update(t=>t.map(M=>{if(M!==e)return M;let n=M.columns.every(r=>M.selectedColumns.has(r.name));return U(x({},M),{selectedColumns:n?new Set:new Set(M.columns.map(r=>r.name))})}))}isAllSelected(e){return e.columns.length>0&&e.columns.every(t=>e.selectedColumns.has(t.name))}isIndeterminate(e){let t=e.columns.filter(M=>e.selectedColumns.has(M.name)).length;return t>0&&t<e.columns.length}static \u0275fac=function(t){return new(t||i)(ni(Hu))};static \u0275cmp=rM({type:i,selectors:[["app-os-schema-viewer"]],inputs:{connectionId:"connectionId",indexNames:"indexNames",preselectedFields:"preselectedFields",masterDetail:"masterDetail"},features:[tN([Hu])],decls:6,vars:1,consts:[[1,"erd-canvas"],[1,"erd-placeholder"],[1,"erd-placeholder","erd-placeholder--error"],[1,"section-card","scope-card"],[1,"erd-section"],[1,"erd-spinner","erd-spinner--lg"],["name","ng-alert-circle","size","36","method","stroke"],["name","ng-dataflow-02","size","40","method","stroke",1,"erd-empty-icon"],[1,"scope-detail"],[1,"scope-split"],[1,"obj-pane"],[1,"pane-head"],[1,"pane-title"],[1,"pane-sub"],[1,"obj-list"],["type","button",1,"obj-row",3,"obj-row--active"],[1,"field-pane"],["type","button",1,"obj-row",3,"click"],["size","small",1,"obj-row__cbx",3,"click","nile-change"],[1,"obj-row__name"],[1,"obj-row__meta"],[1,"obj-count"],["name","ng-chevron-right","method","stroke","size","14",1,"obj-row__chev"],[1,"fr-head"],[1,"fr-title"],[1,"fr-sub"],[1,"fr-tools"],["size","sm","variant","tertiary",3,"click"],[1,"field-list"],["type","button",1,"field-row",3,"field-row--on"],["type","button",1,"field-row",3,"click"],["size","small",1,"field-row__cbx",3,"click","nile-change"],[1,"field-row__name"],[1,"field-row__type"],[1,"erd-section-label"],["name","ng-dataflow-02","size","13","method","stroke"],[1,"erd-section-count"],[1,"erd-grid"],[1,"er-entity","er-entity--root"],[1,"er-entity__header"],["title","Toggle all fields",1,"er-entity__select-all"],[3,"nile-change"],[1,"er-entity__title"],[1,"er-entity__name",3,"title"],[1,"er-entity__badge","er-entity__badge--root"],[1,"er-entity__cols"],[1,"er-entity__col-row"],[1,"er-entity__load-more"],[1,"er-entity__col-label"],[1,"col-name",3,"title"],[1,"col-type"],[1,"er-entity__load-more",3,"click"]],template:function(t,M){t&1&&(C(0,"div",0),he(1,FJt,4,0,"div",1)(2,HJt,4,1,"div",2)(3,JJt,4,0,"div",1)(4,qJt,14,2,"section",3)(5,nGt,10,1,"div",4),b()),t&2&&(L(),xe(M.isLoading()?1:M.loadError()?2:M.entities().length===0?3:M.masterDetail?4:5))},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.erd-canvas[_ngcontent-%COMP%]{flex:1;overflow:auto;display:flex;flex-direction:column;gap:24px;padding:24px 40px}.erd-placeholder[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;flex:1;color:var(--ng-colors-text-tertiary-600);text-align:center;padding:32px}.erd-placeholder[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font-size:.875rem;max-width:280px;margin:0}.erd-placeholder--error[_ngcontent-%COMP%]{color:var(--ng-colors-text-error-primary-600)}.erd-empty-icon[_ngcontent-%COMP%]{opacity:.35}.erd-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.erd-section-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px;font-size:.75rem;font-weight:600;color:var(--ng-colors-text-secondary-700);text-transform:uppercase;letter-spacing:.04em}.erd-section-count[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;background:var(--ng-colors-bg-tertiary);color:var(--ng-colors-text-tertiary-600);border-radius:10px;padding:1px 7px}.erd-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;align-items:start}.er-entity[_ngcontent-%COMP%]{background:var(--ng-colors-bg-primary);border:1px solid var(--ng-colors-border-secondary);border-radius:8px;overflow:hidden}.er-entity--root[_ngcontent-%COMP%]{border-color:var(--ng-colors-border-brand)}.er-entity--related[_ngcontent-%COMP%]{border-color:var(--ng-colors-border-secondary)}.er-entity__header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px;padding:8px 10px;background:var(--ng-colors-bg-secondary);border-bottom:1px solid var(--ng-colors-border-secondary)}.er-entity__select-all[_ngcontent-%COMP%]{flex-shrink:0;cursor:pointer}.er-entity__title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:5px;flex:1;min-width:0;color:var(--ng-colors-fg-quaternary-400)}.er-entity__name[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ng-colors-text-primary-900)}.er-entity__badge[_ngcontent-%COMP%]{font-size:.6rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;border-radius:4px;padding:1px 5px;flex-shrink:0}.er-entity__badge--root[_ngcontent-%COMP%]{color:var(--ng-colors-text-brand-secondary-700);background:var(--ng-colors-bg-brand-primary)}.er-entity__cols[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0}.er-entity__col-row[_ngcontent-%COMP%]{border-bottom:1px solid var(--ng-colors-border-secondary)}.er-entity__col-row[_ngcontent-%COMP%]:last-child{border-bottom:none}.er-entity__col-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:5px;padding:5px 10px;cursor:pointer;font-size:.75rem;transition:background .1s}.er-entity__col-label[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.er-entity__load-more[_ngcontent-%COMP%]{width:100%;padding:5px;background:none;border:none;border-top:1px solid var(--ng-colors-border-secondary);color:var(--ng-colors-text-brand-secondary-700);font-size:.73rem;cursor:pointer;text-align:center;transition:background .1s}.er-entity__load-more[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-brand-primary)}.col-name[_ngcontent-%COMP%]{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.col-type[_ngcontent-%COMP%]{font-size:.67rem;color:var(--ng-colors-text-tertiary-600);white-space:nowrap;flex-shrink:0}.erd-spinner[_ngcontent-%COMP%]{display:inline-block;width:16px;height:16px;border:2px solid rgba(0,0,0,.12);border-top-color:currentColor;border-radius:50%;animation:_ngcontent-%COMP%_erd-spin .7s linear infinite;flex-shrink:0}.erd-spinner--lg[_ngcontent-%COMP%]{width:28px;height:28px;border-width:3px}@keyframes _ngcontent-%COMP%_erd-spin{to{transform:rotate(360deg)}}.section-card.scope-card[_ngcontent-%COMP%]{flex:1;min-height:0;display:flex;flex-direction:column;border-radius:16px;border:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary);box-shadow:0 1px 2px #0a0d120d;padding:20px;overflow:hidden}.scope-detail[_ngcontent-%COMP%]{flex:1;min-height:0;display:flex;border:1px solid var(--ng-colors-border-secondary);border-radius:12px;overflow:hidden}.scope-split[_ngcontent-%COMP%]{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,.95fr) minmax(0,1.05fr);grid-template-rows:minmax(0,1fr)}@media(max-width:860px){.scope-split[_ngcontent-%COMP%]{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) minmax(0,1fr)}}.obj-pane[_ngcontent-%COMP%], .field-pane[_ngcontent-%COMP%]{padding:22px 24px;display:flex;flex-direction:column;gap:14px;min-width:0;min-height:0}.field-pane[_ngcontent-%COMP%]{border-left:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-secondary-subtle)}@media(max-width:860px){.field-pane[_ngcontent-%COMP%]{border-left:none;border-top:1px solid var(--ng-colors-border-secondary)}}.pane-head[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.pane-title[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:var(--ng-colors-text-primary-900)}.pane-sub[_ngcontent-%COMP%]{font-size:12.5px;color:var(--ng-colors-text-tertiary-600);margin-top:1px}.obj-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;flex:1;min-height:0;overflow-y:auto;margin:0 -8px;padding:0 8px}.obj-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;width:100%;text-align:left;background:transparent;border:0;padding:11px 12px;cursor:pointer;border-radius:8px;transition:background .12s}.obj-row[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.obj-row--active[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary)}.obj-row__name[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0;font-size:14px;font-weight:600;color:var(--ng-colors-text-primary-900);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.obj-row__meta[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;flex-shrink:0}.obj-row__chev[_ngcontent-%COMP%]{color:var(--ng-colors-fg-quaternary-400);display:inline-flex}.obj-row__cbx[_ngcontent-%COMP%]{flex-shrink:0}.obj-count[_ngcontent-%COMP%]{font-size:12.5px;font-variant-numeric:tabular-nums;color:var(--ng-colors-fg-quaternary-400);font-weight:500}.obj-count--on[_ngcontent-%COMP%]{color:var(--ng-colors-text-secondary-700)}.fr-head[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;min-width:0}.fr-title[_ngcontent-%COMP%]{margin:0;font-size:15px;font-weight:600;color:var(--ng-colors-text-primary-900)}.fr-sub[_ngcontent-%COMP%]{margin:0;font-size:12.5px;color:var(--ng-colors-text-quaternary-500)}.fr-tools[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}.field-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow-y:auto;margin:0 -8px;padding:0 8px}.field-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:11px;width:100%;text-align:left;background:transparent;border:0;padding:9px 12px;cursor:pointer;border-radius:8px;transition:background .12s,box-shadow .12s}.field-row[_ngcontent-%COMP%] + .field-row[_ngcontent-%COMP%]{box-shadow:0 -1px 0 var(--ng-colors-border-tertiary)}.field-row[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-primary);box-shadow:0 1px 2px #0a0d120d}.field-row__name[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;color:var(--ng-colors-text-secondary-700);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.field-row--on[_ngcontent-%COMP%] .field-row__name[_ngcontent-%COMP%]{color:var(--ng-colors-text-primary-900)}.field-row__type[_ngcontent-%COMP%]{flex-shrink:0;font-size:12px;color:var(--ng-colors-text-quaternary-500);white-space:nowrap}.field-row__cbx[_ngcontent-%COMP%]{flex-shrink:0;pointer-events:none}"]})};var PH=class i{http=Fe(yo);tokenStore=Fe(vr);triggerUrl(){let e=hA()||dt.baseUrl,t=(this.tokenStore.tenantId()??"").trim(),M=Oi().trim();return!t||!M?null:`${e}/api/customers/${t}/products/${M}/workforce/auto-dashboard/trigger`}async trigger(){let e=this.triggerUrl();return e?oi(this.http.post(e,{})):{success:!1,skipped:!0}}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var rGt={analyzing:"Understanding your data\u2026",querying:"Crunching the numbers\u2026",building:"Drawing your charts\u2026",saving:"Saving your dashboard\u2026"};function jut(i){let e=(i??"").toLowerCase();return e.includes("sav")?"saving":e.includes("building")||e.includes("chart")?"building":e.includes("running")?"querying":"analyzing"}function VH(i){return i.phase??jut(i.message)}function BH(i,e){return i.label?.trim()||i.message?.trim()||rGt[e]}var oGt=["analyzing","querying","building","saving"];function RH(i){let e=oGt.indexOf(i);return e<0?0:e}function aGt(i,e){return i&&RH(i)>=RH(e)?i:e}function FH(i){let e="message",t=[];for(let M of i.split(`
|
|
40579
|
+
`)}return""+t},e})();var KHt=[[["","toolPanel",""]],[["","summaryDrawer",""]]],eJt=["[toolPanel]","[summaryDrawer]"],tJt=(i,e)=>e.id;function iJt(i,e){i&1&&Mt(0,"nile-skeleton-loader",12)}function MJt(i,e){i&1&&($(0,"div",13),Y(1,"Create charts, save widgets, and build your library."),ee())}function nJt(i,e){if(i&1){let t=Le();$(0,"nile-card")(1,"div",15),Mt(2,"shared-nile-chart-widget",16),ee(),$(3,"div",17)(4,"nile-button",18),Ze("click",function(){let n=P(t).$implicit,r=p(3);return R(r.addFromLibrary(n.id))}),Y(5,"+ Add to dashboard"),ee(),$(6,"nile-glyph",19),Ze("click",function(){let n=P(t).$implicit,r=p(3);return R(r.removeFromLibrary(n.id))}),ee()()()}if(i&2){let t=e.$implicit;L(2),ot("config",t.config)("drilldownBy",t.drilldownBy)}}function rJt(i,e){if(i&1&&($(0,"div",14),ht(1,nJt,7,2,"nile-card",null,tJt),ee()),i&2){let t=p(2);L(),xt(t.globalWidgets())}}function oJt(i,e){if(i&1){let t=Le();$(0,"aside",7)(1,"div",8)(2,"span"),Y(3,"Widget library"),ee(),$(4,"nile-button",9),Ze("click",function(){P(t);let n=p();return R(n.libraryOpen.set(!1))}),Mt(5,"nile-glyph",10),ee()(),$(6,"div",11),he(7,iJt,1,0,"nile-skeleton-loader",12)(8,MJt,2,0,"div",13)(9,rJt,3,0,"div",14),ee()()}if(i&2){let t=p();L(7),xe(t.globalWidgetsLoading()?7:t.globalWidgets().length?9:8)}}function aJt(i,e){if(i&1){let t=Le();$(0,"button",21),Ze("click",function(){let n=P(t).$implicit,r=p(2);return R(r.pickGalleryPrompt(n))}),Y(1),ee()}if(i&2){let t=e.$implicit;L(),it(t)}}function sJt(i,e){if(i&1){let t=Le();$(0,"aside",7)(1,"div",8)(2,"span"),Y(3,"Prompt gallery"),ee(),$(4,"nile-button",9),Ze("click",function(){P(t);let n=p();return R(n.galleryOpen.set(!1))}),Mt(5,"nile-glyph",10),ee()(),$(6,"div",11)(7,"p",13),Y(8,"Pick a suggestion to get started."),ee(),ht(9,aJt,2,1,"button",20,Ho),ee()()}if(i&2){let t=p();L(9),xt(t.galleryPrompts)}}var bQ=class i{state=Fe(M0);publishRepo=Fe(n0);forecastService=Fe(ME);globalWidget=Fe(r0);timeFilterPref=Fe(nE);destroyRef=Fe(rl);dashboardId=null;preseeded=!1;_dashboardId=null;dashboardIdSignal=ke(null);gridRef;showLibraryPanel=at(!0);showGalleryPanel=at(!0);canAddToStory=at(!1);showWidgetMenu=at(!0);canAsk=at(!0);canChangeChartType=at(!0);canManageFilters=at(!0);canCustomizeColors=at(!0);canViewChartData=at(!0);canExportPng=at(!0);canExportCsv=at(!0);canPrint=at(!0);canTweak=at(!0);canEdit=at(!0);canDelete=at(!0);ngOnChanges(e){e.dashboardId&&(this._dashboardId!==this.dashboardId&&(this.primedFilterWidgets.clear(),this.filterCatalogCache.clear(),this.activeDashboardFilters.set(null),this.activeResolvedFilters.set(null),this.applySummary.set(null)),this._dashboardId=this.dashboardId,this.dashboardIdSignal.set(this.dashboardId),this.dashboardId&&!this.preseeded?this.loadDashboardFromApi(this.dashboardId):this.dashboardId&&this.loadForecastability(this.dashboardId))}galleryPrompts=[];exitBuilder=new Xt;deleted=new Xt;executiveSummary=new Xt;galleryPrompt=new Xt;published=new Xt;widgetClick=new Xt;widgets=ke([]);dashboardName=ke("Untitled Dashboard");editMode=ke(!0);editingWidget=ke(null);tweakingWidgetId=ke(null);savedWidgetIds=new Set;showPublishDialog=ke(!1);isPublishing=ke(!1);loading=ke(!1);isExporting=ke(!1);isRearranging=ke(!1);libraryOpen=ke(!1);galleryOpen=ke(!1);globalWidgets=ke([]);globalWidgetsLoading=ke(!1);hasWidgets=At(()=>this.widgets().length>0);nothingToPublish=Eat(this.state.nothingToPublish$,{initialValue:!1});canPublish=At(()=>!this.nothingToPublish());applyingFilters=ke(!1);activeDashboardFilters=ke(null);activeResolvedFilters=ke(null);applySummary=ke(null);applyFiltersSeq=0;applyFiltersAbort=null;primedFilterWidgets=new Set;filterCatalogCache=new Map;initialFilterAppliedFor=new Set;constructor(){this.state.state$.pipe(TB(this.destroyRef)).subscribe(e=>{this.widgets.set(e.widgets),this.dashboardName.set(e.name);let t=J3(e.widgets);this._dashboardId&&t!==this.probedWidgetIds&&(this.probedWidgetIds=t,this.loadForecastability(this._dashboardId))}),this.state.mutations$.pipe(qg(()=>!!this._dashboardId),yf(0),TB(this.destroyRef)).subscribe(e=>{!this.state.isDirty||this.isPublishing()||this.publishRepo.saveDraft(this._dashboardId,e)}),eo(()=>{this.widgets(),queueMicrotask(()=>this.primeFilterWidgets())}),eo(()=>{let e=this.widgets(),t=this._dashboardId;if(!t||e.length===0||this.initialFilterAppliedFor.has(t))return;let M=this.collectInitialFilters(e);M&&(this.initialFilterAppliedFor.add(t),this.applyInitialFilters(M))})}onUpdateLayout(e){this.state.updateWidgetLayout(e.id,e.layout)}onRemove(e){this.state.removeWidget(e),this.editingWidget()?.id===e&&this.editingWidget.set(null)}onEditWidget(e){let t=this.state.snapshot.widgets.find(M=>M.id===e);this.editingWidget.set(t?x({},t):null)}async onTweakWidget(e){this.tweakingWidgetId.set(e.widgetId);try{let t=this.savedWidgetIds.has(e.widgetId),M=this.state.snapshot.widgets.find(o=>o.id===e.widgetId),n=await this.publishRepo.tweakWidget(t||!M?{widgetId:e.widgetId,prompt:e.prompt}:{widget:M,prompt:e.prompt}),r={config:n.config};n.title!==void 0&&(r.title=n.title),n.widgetType!==void 0&&(r.widgetType=n.widgetType),n.componentName!==void 0&&(r.componentName=n.componentName),n.summary!==void 0&&(r.summary=n.summary),n.layout&&(r.layout=n.layout),n.drilldownBy&&(r.drilldownBy=n.drilldownBy),this.state.updateWidget(e.widgetId,r)}catch(t){console.error("Tweak failed:",t)}finally{this.tweakingWidgetId.set(null)}}onDslWidgetUpdated(e){this.state.updateWidget(e.id,{config:e.config,queryMeta:e.queryMeta})}onWidgetChartTypeChanged(e){this.state.updateWidget(e.id,{componentName:e.componentName,config:e.config})}onWidgetFiltersChanged(e){this.state.updateWidget(e.id,{config:e.config})}onUpdateWidget(e){let t={config:e.config};e.title&&(t.title=e.title),this.state.updateWidget(e.id,t),this.refreshEditing(e.id)}onDrawerUpdateLayout(e){this.state.updateWidgetLayout(e.id,e.layout),this.refreshEditing(e.id)}onApplyDrilldown(e){this.state.updateWidget(e.id,{drilldownBy:e.drilldownBy}),this.refreshEditing(e.id)}refreshEditing(e){let t=this.state.snapshot.widgets.find(M=>M.id===e);t&&this.editingWidget.set(x({},t))}isFilterWidget(e){return e?.config?.chart?.type==="filter"}isEmptyFilters(e){if(!e)return!0;for(let t of Object.values(e))if(t!=null&&!(typeof t=="string"&&t.trim()==="")&&!(typeof t=="object"&&Object.keys(t).length===0))return!1;return!0}async onFilterSubmit(e){if(this.isEmptyFilters(e.filters)){await this.reloadDashboardForFilterClear();return}let t=this.state.snapshot.widgets.filter(o=>!this.isFilterWidget(o));if(t.length===0)return;let M=this._dashboardId;if(!M)return;this.applyFiltersAbort?.abort();let n=new AbortController;this.applyFiltersAbort=n;let r=++this.applyFiltersSeq;this.applyingFilters.set(!0);try{let{widgets:o,resolvedFilters:a}=await this.publishRepo.applyFilters(t,e.filters,M,"draft",n.signal,{mode:e.mode,prompt:e.prompt});if(r!==this.applyFiltersSeq)return;this.state.applyFilterView(o),this.activeDashboardFilters.set(e.filters),this.activeResolvedFilters.set(a),this.applySummary.set(tE(o,this.buildActiveFilters(e.filters)))}catch(o){if(o?.name==="AbortError"||r!==this.applyFiltersSeq)return;console.error("Apply filters failed:",o)}finally{r===this.applyFiltersSeq&&this.applyingFilters.set(!1)}}onFilterChange(e){if(!e.widgetId||!e.controlId||e.query!=="")return;let t=this._dashboardId;if(!t)return;let M=this.widgets(),{widgetId:n,controlId:r}=e;this.primedFilterWidgets.add(n),(async()=>{try{let o=await this.publishRepo.filterSuggest(t,"",M,"draft");this.applyFilterSuggestions(n,r,o)}catch(o){console.warn("[sug] filterSuggest FAILED",o)}})()}async reloadDashboardForFilterClear(){let e=this._dashboardId;if(!e)return;this.applyFiltersAbort?.abort();let t=++this.applyFiltersSeq;this.applyingFilters.set(!0),this.activeDashboardFilters.set(null),this.activeResolvedFilters.set(null),this.applySummary.set(null);try{if(this.preseeded&&this.state.restoreFilterBaseline())return;let M=await this.publishRepo.fetchDashboard(e);if(t!==this.applyFiltersSeq)return;this.state.replaceDashboard(M)}catch(M){if(t!==this.applyFiltersSeq)return;console.error("Reload dashboard failed:",M)}finally{t===this.applyFiltersSeq&&this.applyingFilters.set(!1)}}primeFilterWidgets(){for(let e of this.widgets()){let t=e.config?.chart;if(t?.type!=="filter")continue;let M=t.controls?.find(n=>n.variant==="prompt"||n.variant==="expression"||n.variant==="hybrid")??t.controls?.find(n=>n.id);M?.id&&this.primeFilterWidget(e.id,M.id)}}primeFilterWidget(e,t){let M=this._dashboardId;if(!M||!e||!t||this.primedFilterWidgets.has(e))return;this.primedFilterWidgets.add(e);let n=this.widgets();(async()=>{try{let r=await this.publishRepo.filterSuggest(M,"",n,"draft");this.applyFilterSuggestions(e,t,r)}catch(r){this.primedFilterWidgets.delete(e),console.warn("Filter suggest prime failed:",r)}})()}applyFilterSuggestions(e,t,M){let n=Array.isArray(M.suggestions)?[...M.suggestions]:[];if(!n.length){M.nextToken&&n.push({id:M.nextToken.value,label:M.nextToken.label,type:"attribute"});for(let r of M.completions)n.push({label:r,type:"suggestion"})}n.length!==0&&(this.filterCatalogCache.set(e,n),this.gridRef?.patchFilterSuggestions(e,t,n))}buildActiveFilters(e){return p3(e,t=>this.filterFieldLabel(t))}filterFieldLabel(e){for(let t of this.filterCatalogCache.values()){let M=t.find(n=>n.type==="attribute"&&n.id===e);if(M)return M.label}return e}collectInitialFilters(e){let t={};for(let M of e){let n=M.config?.chart;if(n?.type==="filter")for(let r of n.controls??[]){if(!r.id)continue;let o=r.value;o!=null&&(typeof o=="string"&&o.trim()===""||(t[r.id]=o))}}return Object.keys(t).length>0?t:null}async applyInitialFilters(e){let t=this.state.snapshot.widgets.filter(o=>!this.isFilterWidget(o));if(t.length===0)return;let M=this._dashboardId;if(!M)return;this.applyFiltersAbort?.abort();let n=new AbortController;this.applyFiltersAbort=n;let r=++this.applyFiltersSeq;this.applyingFilters.set(!0);try{let{widgets:o,resolvedFilters:a}=await this.publishRepo.applyFilters(t,e,M,"draft",n.signal);if(r!==this.applyFiltersSeq)return;this.state.applyFilterView(o),this.activeDashboardFilters.set(e),this.activeResolvedFilters.set(a),this.applySummary.set(tE(o,this.buildActiveFilters(e)))}catch(o){if(o?.name==="AbortError"||r!==this.applyFiltersSeq)return;console.error("Apply filters failed:",o)}finally{r===this.applyFiltersSeq&&this.applyingFilters.set(!1)}}async loadDashboardFromApi(e){this.loading.set(!0);try{let t=await this.publishRepo.fetchDashboard(e);this.state.replaceDashboard(t),this.savedWidgetIds=new Set(t.widgets.map(M=>M.id)),this.forecastable.set(t.forecastable??{}),this.probedWidgetIds=J3(t.widgets)}catch{this.state.resetDashboard(),this.savedWidgetIds=new Set}finally{this.loading.set(!1)}}openPublish(){let e=this.dashboardName().trim();if(e&&e!=="Untitled Dashboard"&&this._dashboardId){this.publish(e);return}this.showPublishDialog.set(!0)}async publish(e){if(this.isPublishing())return;let t=this._dashboardId;if(t){this.isPublishing.set(!0);try{let M=e.trim()||"Untitled Dashboard";await this.publishRepo.saveDraft(t,this.state.snapshot),M!==this.state.snapshot.name&&await this.publishRepo.renameDashboard(t,M),await this.publishRepo.publishDashboard(t,M),this.state.setDashboardName(M),this.state.markClean(),this.showPublishDialog.set(!1),this.published.emit(M)}catch(M){kA({variant:"warning",title:"Not published",content:TF(M instanceof Error?M.message:"","Couldn't publish the dashboard. Please try again.")})}finally{this.isPublishing.set(!1)}}}async renameTo(e){let t=this._dashboardId,M=e.trim();!t||!M||M===this.state.snapshot.name||(await this.publishRepo.renameDashboard(t,M),this.state.setDashboardName(M))}togglePreview(){this.editMode.update(e=>!e)}forecastable=ke({});forecastingWidgetId=ke(null);forecastBusy=new Set;probedWidgetIds="";async loadForecastability(e){let t=this.widgets(),M=t.length?await this.forecastService.probeWidgets(t):await this.forecastService.probe(e);this._dashboardId===e&&this.forecastable.set(M)}async onForecast(e){let t=String(e.widget.id),M=this._dashboardId;if(!(!M||this.forecastBusy.has(t))){this.forecastBusy.add(t),this.forecastingWidgetId.set(t);try{let n=e.enable?await this.forecastService.addToWidget(M,t,e.settings??{}):await this.forecastService.removeFromWidget(M,t);if(e.enable&&n?.guardrails&&n.guardrails.passed===!1)return;n?.widget&&this.replaceWidget(n.widget),kA({variant:"success",title:e.enable?"Forecast added":"Forecast removed",content:e.enable?"The projection is shown with its confidence range.":"The chart is back to its measured history."})}catch{}finally{this.forecastBusy.delete(t),this.forecastingWidgetId.set(null)}}}forecastingAll=ke(!1);async onForecastDashboard(e){let t=this._dashboardId;if(!(!t||this.forecastingAll())){this.forecastingAll.set(!0);try{let M=await this.forecastService.toggleDashboard(t,e);for(let o of M.widgets??[])this.replaceWidget(o);let n=M.applied?.length??0,r=M.skipped?.length??0;n&&kA({variant:"success",title:e?`Forecast added to ${n} widget${n===1?"":"s"}`:`Forecast removed from ${n} widget${n===1?"":"s"}`,content:r?`${r} skipped \u2014 ${M.skipped[0]?.message??"not forecastable"}`:"Projections are shown with their confidence range."}),this.loadForecastability(t)}catch{}finally{this.forecastingAll.set(!1)}}}anyForecastOn=At(()=>this.widgets().some(e=>!!e?.config?.forecast?.enabled));replaceWidget(e){this.widgets.update(t=>t.map(M=>String(M.id)===String(e.id)?e:M))}onMenuAction(e){switch(e){case"preview":this.editMode.set(!1);break;case"edit":this.editMode.set(!0);break;case"publish":this.openPublish();break;case"delete":this.deleteDashboard();break;case"exportPdf":this.exportPdf();break;case"exportPng":this.exportPng();break;case"rearrange":this.rearrange();break;case"widgetLibrary":this.openLibrary();break;case"executiveSummary":this._dashboardId&&this.executiveSummary.emit(this._dashboardId);break;case"promptGallery":this.libraryOpen.set(!1),this.galleryOpen.set(!0);break;case"forecastAll":this.onForecastDashboard(!this.anyForecastOn());break;case"toggleFilter":this.state.toggleFilterWidget();break;case"toggleTimeFilter":this.timeFilterPref.toggle(this._dashboardId);break}}hasFilter=At(()=>this.widgets().some(e=>this.isFilterWidget(e)));hasTimeFilter=this.timeFilterPref.enabled(this.dashboardIdSignal);async deleteDashboard(){let e=this._dashboardId;e&&(await this.publishRepo.deleteDashboard(e),this.deleted.emit(e),this.exitBuilder.emit())}getCaptureTarget(){return document.querySelector("shared-builder-host shared-dashboard-grid gridster")}async exportPdf(){if(this.isExporting())return;let e=this.getCaptureTarget();if(e){this.isExporting.set(!0),await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));try{let t=e.scrollWidth,M=e.scrollHeight,n=await EF(e,{quality:1,width:t,height:M,cacheBust:!0,backgroundColor:"#ffffff",style:{height:`${M}px`,maxHeight:"none",overflow:"visible"}}),r=this.dashboardName()||"Dashboard",o=90,a=new Ii({orientation:t>M?"landscape":"portrait",unit:"px",format:[t,M+o]});a.setFillColor(245,245,248),a.rect(0,0,t,o,"F"),a.setFont("helvetica","bold"),a.setFontSize(28),a.setTextColor(50,50,60),a.text(r,t/2,o/2+7,{align:"center"}),a.addImage(n,"JPEG",0,o,t,M),a.save(`${r}.pdf`)}finally{this.isExporting.set(!1)}}}async exportPng(){if(this.isExporting())return;let e=this.getCaptureTarget();if(e){this.isExporting.set(!0),await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)));try{let t=e.scrollWidth,M=e.scrollHeight,n=await EF(e,{quality:1,width:t,height:M,cacheBust:!0,backgroundColor:"#ffffff",style:{height:`${M}px`,maxHeight:"none",overflow:"visible"}}),r=this.dashboardName()||"Dashboard",o=90,a=document.createElement("canvas");a.width=t,a.height=M+o;let s=a.getContext("2d");s.fillStyle="#f5f5f8",s.fillRect(0,0,t,o),s.fillStyle="#32323c",s.font="bold 28px helvetica",s.textAlign="center",s.textBaseline="middle",s.fillText(r,t/2,o/2+7);let l=new Image;l.src=n,await new Promise(c=>{l.onload=()=>c()}),s.drawImage(l,0,o,t,M);let N=document.createElement("a");N.href=a.toDataURL("image/png"),N.download=`${r}.png`,N.click()}finally{this.isExporting.set(!1)}}}async rearrange(){if(this.isRearranging())return;let e=this.state.snapshot.widgets;if(e.length!==0){this.isRearranging.set(!0);try{let{layouts:t}=await this.publishRepo.rearrangeDashboard(e,this._dashboardId);t.length&&this.state.updateWidgetLayouts(t)}finally{this.isRearranging.set(!1)}}}async openLibrary(){if(this.galleryOpen.set(!1),this.libraryOpen.set(!0),!this.globalWidgetsLoading()){this.globalWidgetsLoading.set(!0);try{this.globalWidgets.set(await this.globalWidget.getAll())}catch{this.globalWidgets.set([])}finally{this.globalWidgetsLoading.set(!1)}}}addFromLibrary(e){let t=this.globalWidgets().find(o=>o.id===e);if(!t)return;let r=t,{id:M}=r,n=$e(r,["id"]);this.state.addWidget(n),this.libraryOpen.set(!1)}async removeFromLibrary(e){await this.globalWidget.remove(e),this.globalWidgets.update(t=>t.filter(M=>M.id!==e))}pickGalleryPrompt(e){this.galleryPrompt.emit(e),this.galleryOpen.set(!1)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["shared-builder-host"]],viewQuery:function(t,M){if(t&1&&eN(wA,5),t&2){let n;ll(n=gl())&&(M.gridRef=n.first)}},inputs:{dashboardId:"dashboardId",preseeded:"preseeded",showLibraryPanel:[1,"showLibraryPanel"],showGalleryPanel:[1,"showGalleryPanel"],canAddToStory:[1,"canAddToStory"],showWidgetMenu:[1,"showWidgetMenu"],canAsk:[1,"canAsk"],canChangeChartType:[1,"canChangeChartType"],canManageFilters:[1,"canManageFilters"],canCustomizeColors:[1,"canCustomizeColors"],canViewChartData:[1,"canViewChartData"],canExportPng:[1,"canExportPng"],canExportCsv:[1,"canExportCsv"],canPrint:[1,"canPrint"],canTweak:[1,"canTweak"],canEdit:[1,"canEdit"],canDelete:[1,"canDelete"],galleryPrompts:"galleryPrompts"},outputs:{exitBuilder:"exitBuilder",deleted:"deleted",executiveSummary:"executiveSummary",galleryPrompt:"galleryPrompt",published:"published",widgetClick:"widgetClick"},features:[Qo],ngContentSelectors:eJt,decls:12,vars:32,consts:[[1,"aq-builder"],[3,"forecast","updateLayout","remove","editWidget","tweakWidget","dslWidgetUpdated","widgetChartTypeChanged","widgetFiltersChanged","filterSubmit","filterChange","widgetClick","widgets","editMode","dashboardId","loading","widgetsLoading","tweakingWidgetId","dashboardFilters","resolvedFilters","applySummary","canForecast","canAddToStory","forecastable","forecastingWidgetId","showWidgetMenu","canAsk","canChangeChartType","canManageFilters","canCustomizeColors","canViewChartData","canExportPng","canExportCsv","canPrint","canTweak","canEdit","canDelete"],["placement","end",1,"aq-builder__settings",3,"nile-request-close","open"],["slot","label"],[3,"close","updateWidget","updateLayout","applyDrilldown","widget"],["label","Publish",3,"nile-request-close"],[3,"publish","dismissed","dashboardName","isPublishing"],[1,"aq-tool-panel"],[1,"aq-tool-panel__header"],["circle","","variant","ghost","size","small",3,"click"],["name","ng-x","method","stroke","size","16"],[1,"aq-tool-panel__body"],[2,"width","100%","height","120px","border-radius","8px","display","block"],[1,"aq-tool-empty"],[1,"aq-widget-lib-grid"],[1,"aq-widget-lib-card__preview"],[3,"config","drilldownBy"],[1,"aq-widget-lib-card__footer"],["variant","primary","size","small",3,"click"],["name","ng-trash-01","method","stroke","size","14","color","var(--ng-colors-fg-error-primary)",3,"click"],["type","button",1,"aq-gallery-prompt"],["type","button",1,"aq-gallery-prompt",3,"click"]],template:function(t,M){t&1&&(tu(KHt),$(0,"div",0)(1,"shared-dashboard-grid",1),Ze("forecast",function(r){return M.onForecast(r)})("updateLayout",function(r){return M.onUpdateLayout(r)})("remove",function(r){return M.onRemove(r)})("editWidget",function(r){return M.onEditWidget(r)})("tweakWidget",function(r){return M.onTweakWidget(r)})("dslWidgetUpdated",function(r){return M.onDslWidgetUpdated(r)})("widgetChartTypeChanged",function(r){return M.onWidgetChartTypeChanged(r)})("widgetFiltersChanged",function(r){return M.onWidgetFiltersChanged(r)})("filterSubmit",function(r){return M.onFilterSubmit(r)})("filterChange",function(r){return M.onFilterChange(r)})("widgetClick",function(r){return M.widgetClick.emit(r)}),ee(),$(2,"nile-drawer",2),Ze("nile-request-close",function(){return M.editingWidget.set(null)}),$(3,"span",3),Y(4,"Widget Settings"),ee(),$(5,"db-widget-settings",4),Ze("close",function(){return M.editingWidget.set(null)})("updateWidget",function(r){return M.onUpdateWidget(r)})("updateLayout",function(r){return M.onDrawerUpdateLayout(r)})("applyDrilldown",function(r){return M.onApplyDrilldown(r)}),ee()(),$(6,"nile-dialog",5),Ze("nile-request-close",function(){return M.showPublishDialog.set(!1)}),$(7,"db-publish-dialog",6),Ze("publish",function(r){return M.publish(r)})("dismissed",function(){return M.showPublishDialog.set(!1)}),ee()(),sl(8),he(9,oJt,10,1,"aside",7),he(10,sJt,11,0,"aside",7),sl(11,1),ee()),t&2&&(L(),ot("widgets",M.widgets())("editMode",M.editMode())("dashboardId",M.dashboardId)("loading",M.loading())("widgetsLoading",M.isRearranging()||M.isPublishing()||M.applyingFilters()||M.forecastingAll())("tweakingWidgetId",M.tweakingWidgetId())("dashboardFilters",M.activeDashboardFilters())("resolvedFilters",M.activeResolvedFilters())("applySummary",M.applySummary())("canForecast",!0)("canAddToStory",M.canAddToStory())("forecastable",M.forecastable())("forecastingWidgetId",M.forecastingWidgetId())("showWidgetMenu",M.showWidgetMenu())("canAsk",M.canAsk())("canChangeChartType",M.canChangeChartType())("canManageFilters",M.canManageFilters())("canCustomizeColors",M.canCustomizeColors())("canViewChartData",M.canViewChartData())("canExportPng",M.canExportPng())("canExportCsv",M.canExportCsv())("canPrint",M.canPrint())("canTweak",M.canTweak())("canEdit",M.canEdit())("canDelete",M.canDelete()),L(),ot("open",!!M.editingWidget()),L(3),ot("widget",M.editingWidget()),L(),It("open",M.showPublishDialog()?"":null),L(),ot("dashboardName",M.dashboardName())("isPublishing",M.isPublishing()),L(2),xe(M.showLibraryPanel()&&M.libraryOpen()?9:-1),L(),xe(M.showGalleryPanel()&&M.galleryOpen()?10:-1))},dependencies:[Go,wA,a0,s0,ZI],styles:[".aq-builder[_ngcontent-%COMP%]{position:relative;height:100%;width:100%;overflow:auto;background:var(--ng-colors-bg-secondary)}.aq-builder[_ngcontent-%COMP%] .canvas-wrap, .aq-builder[_ngcontent-%COMP%] gridster{border-radius:0!important}.aq-tool-panel[_ngcontent-%COMP%]{position:absolute;top:0;right:0;width:360px;height:100%;background:var(--ng-colors-bg-primary);border-left:1px solid var(--ng-colors-border-secondary);display:flex;flex-direction:column;z-index:5}.aq-tool-panel__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;height:var(--aq-header-h, 56px);padding:0 16px;border-bottom:1px solid var(--ng-colors-border-secondary);font-weight:600}.aq-tool-panel__body[_ngcontent-%COMP%]{flex:1;overflow:auto;padding:16px}.aq-widget-lib-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr;gap:12px}.aq-widget-lib-card__preview[_ngcontent-%COMP%]{height:140px}.aq-widget-lib-card__footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-top:8px}.aq-tool-empty[_ngcontent-%COMP%]{color:var(--ng-colors-text-quaternary-500);font-size:13px;margin:0 0 12px}.aq-gallery-prompt[_ngcontent-%COMP%]{display:flex;align-items:center;width:100%;text-align:left;gap:10px;border:1px solid var(--ng-colors-border-secondary);border-radius:12px;padding:12px 16px;background:var(--ng-colors-bg-primary);cursor:pointer;font:inherit;font-size:13px;font-weight:500;color:var(--ng-colors-text-secondary-700);line-height:1.4;transition:border-color .18s,box-shadow .18s,transform .15s}.aq-gallery-prompt[_ngcontent-%COMP%] + .aq-gallery-prompt[_ngcontent-%COMP%]{margin-top:8px}.aq-gallery-prompt[_ngcontent-%COMP%]:hover{border-color:var(--ng-colors-border-brand);box-shadow:0 6px 24px #2970ff1a;transform:translateY(-2px)}"]})};function QH(i,e){let t=i?.chart;if(t?.type!=="kpi")return;let M=t.sparkline;if(!Array.isArray(M)||M.length===0)return;let n=t.sparklineColor||OA(e),r=t.sparklineLineWidth??2,o=t.sparklineFillOpacity??.2,a=t.sparklineType??"area",s=t.sparklineMarkers??!1,l=Math.round(Math.min(1,Math.max(0,o))*255).toString(16).padStart(2,"0"),N=a==="area"?{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,n+l],[1,n+"00"]]}:void 0;return U(x({},i),{chart:{type:a,data:[{name:"Trend",data:M,color:n}],options:{plotOptions:{[a]:x({lineWidth:r,lineColor:n,marker:{enabled:s}},N&&{fillColor:N})}}}})}function UH(i){let e=i?.aq??{},t=i?.chart??{},Ne=e,{chartTitle:M,chartSubtitle:n,ai:r,switchable:o,toggleLabel:a,summary:s}=Ne,l=$e(Ne,["chartTitle","chartSubtitle","ai","switchable","toggleLabel","summary"]),_=t,{chartTitle:N,chartSubtitle:c,menu:D,switchableTypes:I,ai:d,summary:y,toggleLabel:A,xAxisTitle:z,yAxisTitle:E,legend:S,showLegend:O,showDataLabels:v,options:Z}=_,B=$e(_,["chartTitle","chartSubtitle","menu","switchableTypes","ai","summary","toggleLabel","xAxisTitle","yAxisTitle","legend","showLegend","showDataLabels","options"]),q=Z??{},W=q.plotOptions??{};return U(x({},i),{aq:l,chart:U(x({},B),{chartBg:"transparent",chartBorder:"none",chartBorderRadius:"0",chartShadow:"none",chartPadding:"0",showDataLabels:!1,options:U(x({},q),{title:{text:""},subtitle:{text:""},xAxis:[{visible:!1}],yAxis:[{visible:!1},{visible:!1}],legend:{enabled:!1},plotOptions:U(x({},W),{series:U(x({},W.series??{}),{dataLabels:{enabled:!1}}),pie:U(x({},W.pie??{}),{dataLabels:{enabled:!1},showInLegend:!1})})})})})}function lut(i,e){if(!i)return;let t=QH(i.config,e)??i.config,M=Kh(t,i.drilldownBy);return{id:i.id,title:i.title,widgetType:i.widgetType,layout:i.layout,config:UH(M)}}var lJt=["chart"],QQ=class i{config;chartRef;hostEl=Fe(ir);themeUnwatch;viewReady=!1;ngAfterViewInit(){this.viewReady=!0,this.applyConfig(),this.themeUnwatch=mA(()=>{this.viewReady&&this.isKpiConfig&&this.applyConfig()})}ngOnChanges(e){this.viewReady&&e.config&&this.applyConfig()}ngOnDestroy(){this.themeUnwatch?.()}get isKpiConfig(){return qB(this.config?.chart)}headerLessConfig(e){let t=e;if(!qB(t.chart))return e;let M=x({},t.chart??{}),n=x({},t.aq??{});return C3(M,n,null,this.hostEl.nativeElement),U(x({},e),{chart:M,aq:n})}applyConfig(){let e=this.chartRef?.nativeElement;if(!e||!this.config)return;e.config=this.headerLessConfig(this.config);let t=()=>this.flattenCardChrome(e);e.updateComplete?e.updateComplete.then(t):customElements.whenDefined("nile-chart").then(()=>{let M=e.updateComplete;M?M.then(t):requestAnimationFrame(t)})}flattenCardChrome(e){let t=e.shadowRoot?.querySelector(".nile-chart-card");t&&(t.style.background="transparent",t.style.border="none",t.style.borderRadius="0",t.style.boxShadow="none",t.style.padding="0")}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=rM({type:i,selectors:[["db-dash-card-chart"]],viewQuery:function(t,M){if(t&1&&eN(lJt,5),t&2){let n;ll(n=gl())&&(M.chartRef=n.first)}},inputs:{config:"config"},features:[Qo],decls:2,vars:1,consts:[["chart",""],["fit",""]],template:function(t,M){t&1&&Zt(0,"nile-chart",1,0),t&2&&It("no-header",M.isKpiConfig?"":null)},styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block;width:100%;height:100%}nile-chart[_ngcontent-%COMP%]{display:block;width:100%;height:100%}nile-chart[_ngcontent-%COMP%]::part(ai-trigger){display:none}nile-chart[_ngcontent-%COMP%]::part(header){border-bottom:none}'],changeDetection:0})};var vH="wfi.theme",gut="(prefers-color-scheme: dark)";function uJt(i){return i==="light"||i==="dark"||i==="system"}var YH=class i{_choice=ke(this.readStoredChoice());_systemDark=ke(this.readSystemDark());choice=this._choice.asReadonly();resolved=At(()=>{let e=this._choice();return e!=="system"?e:this._systemDark()?"dark":"light"});isDark=At(()=>this.resolved()==="dark");constructor(){this.apply(),this.watchSystem()}set(e){this._choice.set(e),this.persist(e),this.apply()}toggle(){this.set(this.resolved()==="dark"?"light":"dark")}apply(){typeof document>"u"||(document.documentElement.dataset.theme=this.resolved())}watchSystem(){if(typeof window>"u"||typeof window.matchMedia!="function")return;window.matchMedia(gut).addEventListener("change",t=>{this._systemDark.set(t.matches),this._choice()==="system"&&this.apply()})}readSystemDark(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(gut).matches}readStoredChoice(){try{let e=localStorage.getItem(vH);if(uJt(e))return e}catch{}return"light"}persist(e){try{localStorage.setItem(vH,e)}catch{}}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};function cJt(i){let e=(i??"").trim();return e?Su.getMarked().parse(e,{async:!1}):""}function DJt(i){if(i&&typeof i=="object")return i;if(typeof i=="string"){let e=i.trim();if(!e.startsWith("{"))return null;try{let t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}return null}function IJt(...i){for(let e of i)if(typeof e=="string"&&e.trim())return e.trim();return null}function dJt(i,e="Something went wrong. Please try again."){let t=i??{},M=DJt(t.error),n=IJt(M?.error,M?.message,M?.detail);if(n&&!G3(n))return n;switch(!0){case t.status===0:return"Couldn't reach the server. Check your connection and try again.";case t.status===401:return"Your session has expired. Sign in again to continue.";case t.status===403:return"You don't have permission to do this.";case t.status===404:return"That's no longer available. Refresh and try again.";case t.status===409:return"That conflicts with something that already exists.";case t.status===413:return"That file is too large.";case t.status===429:return"Too many requests. Wait a moment and try again.";case(typeof t.status=="number"&&t.status>=500):return"The server had a problem. Try again in a moment.";default:return e}}var ZH="__dvRouteProgressHub__";function jJt(){return typeof window>"u"?{count:0,listeners:new Set}:(window[ZH]||(window[ZH]={count:0,listeners:new Set}),window[ZH])}var UQ=class i{hub=jJt();_inFlight=ke(this.hub.count);inFlight=this._inFlight.asReadonly();constructor(){let e=()=>this._inFlight.set(this.hub.count);this.hub.listeners.add(e),Fe(rl).onDestroy(()=>this.hub.listeners.delete(e))}start(){this.hub.count++,this.notify();let e=!1;return()=>{e||(e=!0,this.hub.count=Math.max(0,this.hub.count-1),this.notify())}}async track(e){let t=this.start();try{return await e}finally{t()}}notify(){let e=Array.from(this.hub.listeners);for(let t of e)t()}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var Hu=class i{constructor(e){this.http=e}http;baseUrl=Fe(Tm);tokenStore=Fe(vr);get customerId(){return this.tokenStore.tenantId()??""}get productId(){return Oi()}get headers(){return new ic({"X-Customer-ID":this.customerId})}async listConnectionTables(e,t,M="mssql"){let n=t?.page??1,r=t?.pageSize??20,o=t?.type??"any",a=`${this.baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce/connections/${e}/tables?page=${n}&pageSize=${r}&type=${o}&includeDdl=false`,s=await oi(this.http.get(a));return{tables:s?.data??[],meta:{total:s?.meta?.total??0,page:s?.meta?.page??n,pageSize:s?.meta?.pageSize??r,totalPages:s?.meta?.totalPages??1,database:s?.meta?.database}}}async exploreConnectionTable(e,t,M="mssql"){return(await oi(this.http.get(`${this.baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce/connections/${e}/tables/explore?table=${encodeURIComponent(t)}`))).data}async exploreOpenSearchIndex(e,t){let M=await oi(this.http.get(`${this.baseUrl}/api/customers/${this.customerId}/products/${this.productId}/OS-connections/${e}/indexes/explore?index=${encodeURIComponent(t)}`,{headers:this.headers}));return{index:t,fields:yJt(M?.data??{})}}async exploreTablesBatched(e,t,M=5,n="mssql",r){return Nut(t,o=>this.exploreConnectionTable(e,o,n),M,r)}async exploreOpenSearchIndexesBatched(e,t,M=5){return Nut(t,n=>this.exploreOpenSearchIndex(e,n),M)}static \u0275fac=function(t){return new(t||i)(Ji(yo))};static \u0275prov=Ct({token:i,factory:i.\u0275fac})};async function Nut(i,e,t,M){let n=Math.max(1,t),r=[];for(let o=0;o<i.length;o+=n){let a=await Promise.allSettled(i.slice(o,o+n).map(e));r.push(...a),M?.(r.length,i.length)}return r}function yJt(i){let e=i.fields;if(Array.isArray(e))return e.map(r=>{let o=r,a=o.name??o.field,s=o.dataType??o.type;return a?{name:a,dataType:s??"unknown"}:null}).filter(r=>!!r);let t=i.mappings??i,M=uut(t);if(!M)return[];let n=[];return cut(M,"",n),n}function uut(i){if(!i||typeof i!="object")return null;let e=i.properties;if(e&&typeof e=="object")return e;for(let t of Object.values(i))if(t&&typeof t=="object"){let M=uut(t);if(M)return M}return null}function cut(i,e,t){for(let[M,n]of Object.entries(i)){if(!n||typeof n!="object")continue;let r=n,o=e?`${e}.${M}`:M,a=r.properties;if(a)cut(a,o,t);else{let s=r.type??"unknown";t.push({name:o,dataType:s})}}}var TJt=()=>[1,2,3,4];function AJt(i,e){return this.itemKey(e)}var zJt=(i,e)=>e.name;function hJt(i,e){if(i&1&&(C(0,"span",4),Y(1),b()),i&2){let t=p();L(),yi("\xB7 ",t.listMeta().database)}}function xJt(i,e){i&1&&Zt(0,"span",22)}function pJt(i,e){if(i&1){let t=Le();C(0,"div",5)(1,"nile-button",20),Ae("click",function(){P(t);let n=p();return R(n.cancel.emit())}),Y(2,"Cancel"),b(),C(3,"nile-button",21),Ae("click",function(){P(t);let n=p();return R(n.update.emit())}),he(4,xJt,1,0,"span",22),Y(5," Update "),b()()}if(i&2){let t=p();L(3),It("loading",t.updating?"":null)("disabled",t.updating?"":null),L(),xe(t.updating?4:-1)}}function LJt(i,e){if(i&1&&(C(0,"div",6),Zt(1,"nile-glyph",23),C(2,"span"),Y(3),b()()),i&2){let t=p();L(3),it(t.loadError())}}function OJt(i,e){i&1&&(C(0,"div",24),Zt(1,"nile-skeleton-loader",25),C(2,"div",26),Zt(3,"nile-skeleton-loader",27)(4,"nile-skeleton-loader",28),b()())}function mJt(i,e){if(i&1&&ht(0,OJt,5,0,"div",24,Ho),i&2){let t=p();xt(t.skeletonRows)}}function EJt(i,e){i&1&&(C(0,"div",16),Y(1,"No tables match."),b())}function fJt(i,e){if(i&1){let t=Le();C(0,"nile-checkbox",36),Ae("click",function(n){return n.stopPropagation()})("nile-change",function(){P(t);let n=p().$implicit,r=p(2);return R(r.toggleTableSelection(n))}),b()}if(i&2){let t=p().$implicit,M=p(2);It("checked",M.isTableChecked(t)?"":null)}}function SJt(i,e){if(i&1&&(C(0,"span",35),Y(1),b()),i&2){let t=p().$implicit,M=p(2);L(),Jo(" ",M.exploredEntity(M.itemKey(t)).selectedColumns.size,"/",M.exploredEntity(M.itemKey(t)).columns.length," cols ")}}function wJt(i,e){if(i&1&&(C(0,"span",35),Y(1),b()),i&2){let t=p().$implicit;L(),yi("",t.rowCount," rows")}}function CJt(i,e){if(i&1){let t=Le();C(0,"div",30),he(1,fJt,1,1,"nile-checkbox",31),C(2,"button",32),Ae("click",function(){let n=P(t).$implicit,r=p(2);return R(r.selectListItem(n))}),C(3,"span",33),Y(4),b(),C(5,"span",26)(6,"span",34),Y(7),b(),he(8,SJt,2,2,"span",35)(9,wJt,2,1,"span",35),b()()()}if(i&2){let t=e.$implicit,M=p(2);Wt("cs__table-row--multi",M.multiSelect)("cs__table-row--active",M.selectedKey()===M.itemKey(t)),L(),xe(M.multiSelect?1:-1),L(),Wt("cs__table--active",M.selectedKey()===M.itemKey(t)),L(2),it(M.itemKey(t)),L(2),Wt("cs__table-badge--root",M.isPreselected(t))("cs__table-badge--related",!M.isPreselected(t)),L(),it(M.isPreselected(t)?"selected":t.type==="VIEW"?"view":"table"),L(),xe(M.isExplored(t)?8:9)}}function kJt(i,e){if(i&1&&ht(0,CJt,10,14,"div",29,AJt,!0),i&2){let t=p();xt(t.filteredList())}}function bJt(i,e){i&1&&(C(0,"div",41),Zt(1,"nile-skeleton-loader",44)(2,"nile-skeleton-loader",45),b())}function QJt(i,e){i&1&&(C(0,"div",43)(1,"span",46),Zt(2,"nile-skeleton-loader",47),b(),C(3,"span",48),Zt(4,"nile-skeleton-loader",49),b(),C(5,"span",50),Zt(6,"nile-skeleton-loader",49),b(),C(7,"span",51),Zt(8,"nile-skeleton-loader",49),b(),C(9,"span",52),Zt(10,"nile-skeleton-loader",49),b()())}function UJt(i,e){if(i&1&&(C(0,"div",37)(1,"div",38),Zt(2,"nile-skeleton-loader",39),b(),C(3,"div",40),ht(4,bJt,3,0,"div",41,Ho),b()(),C(6,"div",42),ht(7,QJt,11,0,"div",43,Ho),b()),i&2){let t=p();L(4),xt(Nd(0,TJt)),L(3),xt(t.skeletonRows)}}function vJt(i,e){i&1&&Zt(0,"nile-glyph",66)}function YJt(i,e){if(i&1&&(C(0,"span",67),Y(1),b()),i&2){let t=p().$implicit;L(),yi("len:",t.maxLength===-1?"max":t.maxLength)}}function ZJt(i,e){if(i&1&&(C(0,"span",68),Y(1),b()),i&2){let t=p().$implicit;L(),yi("p:",t.precision)}}function _Jt(i,e){if(i&1&&(C(0,"span",69),Y(1),b()),i&2){let t=p().$implicit;L(),yi("s:",t.scale)}}function WJt(i,e){i&1&&(C(0,"span",70),Y(1,"\u2014"),b())}function PJt(i,e){if(i&1){let t=Le();C(0,"label",64)(1,"span",46)(2,"nile-checkbox",65),Ae("nile-change",function(){let n=P(t).$implicit,r=p(),o=p();return R(o.toggleColumn(r,n.name))}),b()(),C(3,"span",48),Y(4),he(5,vJt,1,0,"nile-glyph",66),b(),C(6,"span",50),Y(7),b(),C(8,"span",51),he(9,YJt,2,1,"span",67),he(10,ZJt,2,1,"span",68),he(11,_Jt,2,1,"span",69),he(12,WJt,2,0,"span",70),b(),C(13,"span",52),Y(14),b()()}if(i&2){let t=e.$implicit,M=p();Wt("cs__col--selected",M.selectedColumns.has(t.name)),L(2),It("checked",M.selectedColumns.has(t.name)?"":null),L(2),yi(" ",t.name," "),L(),xe(t.isPrimaryKey?5:-1),L(2),it(t.dataType),L(2),xe(t.maxLength!=null?9:-1),L(),xe(t.precision!=null?10:-1),L(),xe(t.scale!=null?11:-1),L(),xe(t.maxLength==null&&t.precision==null&&t.scale==null?12:-1),L(),Wt("cs__col-null--required",!t.nullable),L(),yi(" ",t.nullable?"NULL":"NOT NULL"," ")}}function RJt(i,e){if(i&1){let t=Le();C(0,"div",37)(1,"div",38)(2,"span",53),Y(3),b(),C(4,"span",34),Y(5),b()(),C(6,"div",40)(7,"div",41)(8,"span",54),Y(9,"COLUMNS"),b(),C(10,"span",55),Y(11),b()(),C(12,"div",41)(13,"span",54),Y(14,"SELECTED"),b(),C(15,"span",55),Y(16),b()(),C(17,"div",41)(18,"span",54),Y(19,"ROWS"),b(),C(20,"span",55),Y(21),b()(),C(22,"div",41)(23,"span",54),Y(24,"NULLABLE"),b(),C(25,"span",55),Y(26),b()()()(),C(27,"div",42)(28,"div",56)(29,"span",57)(30,"nile-checkbox",58),Ae("nile-change",function(){let n=P(t),r=p();return R(r.toggleAllColumns(n))}),b()(),C(31,"span",59),Y(32,"Column"),b(),C(33,"span",60),Y(34,"Type"),b(),C(35,"span",61),Y(36,"Precision"),b(),C(37,"span",62),Y(38,"Nullable"),b()(),ht(39,PJt,15,13,"label",63,zJt),b()}if(i&2){let t=e,M=p();L(3),it(M.entityKey(t)),L(),Wt("cs__table-badge--root",t.isRoot)("cs__table-badge--related",!t.isRoot),L(),it(t.isRoot?"selected":"browsing"),L(6),it(t.columns.length),L(5),it(M.selectedSelectedCount()),L(5),it(t.rowCount),L(5),it(M.selectedNullableCount()),L(4),It("checked",M.isAllSelected(t)?"":null)("indeterminate",M.isIndeterminate(t)?"":null),L(9),xt(t.columns)}}function VJt(i,e){i&1&&(C(0,"div",18),Y(1,"Select a table to view its columns."),b())}function BJt(i,e){if(i&1){let t=Le();C(0,"nile-pagination",71),Ae("nile-change",function(n){P(t);let r=p();return R(r.onPageChange(n))}),b()}if(i&2){let t=p();It("totalitems",t.listMeta().total)("currentpage",t.currentPage())("pagesize",t.pageSize())}}var _H=class i{constructor(e){this.schemaExplorer=e}schemaExplorer;connectionId;adapterType="mssql";tables=[];preselectedColumns={};showActions=!1;updating=!1;multiSelect=!1;cancel=new Xt;update=new Xt;selectedTablesChange=new Xt;selectedTables=ke(new Set);entities=ke([]);isLoading=ke(!1);loadError=ke("");tableList=ke([]);listMeta=ke({total:0,page:1,pageSize:20,totalPages:1});currentPage=ke(1);pageSize=ke(20);typeFilter=ke("any");search=ke("");selectedKey=ke(null);exploringKey=ke(null);isSelectingAll=ke(!1);selectAllProgress=ke(null);skeletonRows=[1,2,3,4,5,6];preselectedKeys=new Set;preselectedColumnsByKey=new Map;touchedKeys=new Set;ngOnInit(){for(let e of this.tables)this.preselectedKeys.add(e.toLowerCase());for(let[e,t]of Object.entries(this.preselectedColumns))this.preselectedColumnsByKey.set(e.toLowerCase(),t);this.multiSelect&&this.selectedTables.set(new Set(this.tables)),this.loadTables(),this.multiSelect&&this.tables.length===0&&this.selectAllAcrossPages()}isTableChecked(e){return this.selectedTables().has(this.itemKey(e))}async toggleTableSelection(e){let t=this.itemKey(e);this.touchedKeys.add(t);let M=this.selectedTables().has(t);this.selectedTables.update(n=>{let r=new Set(n);return M?r.delete(t):r.add(t),r}),this.selectedTablesChange.emit([...this.selectedTables()]),!M&&!this.entities().some(n=>this.entityKey(n)===t)&&await this.selectListItem(e)}filteredList=At(()=>{let e=this.search().trim().toLowerCase();return e?this.tableList().filter(t=>`${t.schema}.${t.table}`.toLowerCase().includes(e)):this.tableList()});isPreselected(e){return this.preselectedKeys.has(`${e.schema}.${e.table}`.toLowerCase())}itemKey(e){return`${e.schema}.${e.table}`}isExplored(e){let t=this.itemKey(e);return this.entities().some(M=>this.entityKey(M)===t)}exploredEntity(e){return this.entities().find(t=>this.entityKey(t)===e)}setTypeFilter(e){this.typeFilter()!==e&&(this.typeFilter.set(e),this.currentPage.set(1),this.loadTables())}onPageChange(e){let t=e.detail;t&&(this.currentPage.set(t.page),this.pageSize.set(t.pageSize),this.loadTables())}onSearch(e){let M=e.detail?.value??e.target?.value??"";this.search.set(M)}async loadTables(){this.isLoading.set(!0),this.loadError.set("");try{let{tables:e,meta:t}=await this.schemaExplorer.listConnectionTables(this.connectionId,{page:this.currentPage(),pageSize:this.pageSize(),type:this.typeFilter()},this.adapterType);this.tableList.set(e),this.listMeta.set(t),!this.selectedKey()&&e.length&&await this.selectListItem(e[0])}catch(e){this.loadError.set(e instanceof Error?e.message:"Failed to load tables.")}finally{this.isLoading.set(!1)}}async selectAllAcrossPages(){this.isSelectingAll.set(!0);try{let e=[],M=1,n=1;do{let{tables:N,meta:c}=await this.schemaExplorer.listConnectionTables(this.connectionId,{page:M,pageSize:100,type:"any"},this.adapterType);e.push(...N),n=c.totalPages||1,M++}while(M<=n);let r=e.filter(N=>!this.touchedKeys.has(this.itemKey(N)));if(!r.length)return;this.selectedTables.update(N=>new Set([...N,...r.map(c=>this.itemKey(c))])),this.selectedTablesChange.emit([...this.selectedTables()]);let o=new Set(this.entities().map(N=>this.entityKey(N))),a=r.filter(N=>!o.has(this.itemKey(N)));if(!a.length)return;this.selectAllProgress.set({done:0,total:a.length});let l=(await this.schemaExplorer.exploreTablesBatched(this.connectionId,a.map(N=>this.itemKey(N)),5,this.adapterType,(N,c)=>this.selectAllProgress.set({done:N,total:c}))).map((N,c)=>N.status==="fulfilled"?this.toEntity(a[c],N.value):null).filter(N=>N!==null);l.length&&this.entities.update(N=>{let c=new Set(N.map(I=>this.entityKey(I))),D=l.filter(I=>!c.has(this.entityKey(I)));return D.length?[...N,...D]:N})}catch(e){this.loadError.set(e instanceof Error?e.message:"Failed to select all tables.")}finally{this.isSelectingAll.set(!1),this.selectAllProgress.set(null)}}async selectListItem(e){let t=this.itemKey(e);if(this.selectedKey.set(t),!this.entities().some(M=>this.entityKey(M)===t)){this.exploringKey.set(t);try{await this.ensureExplored(e)}catch(M){this.loadError.set(M instanceof Error?M.message:"Failed to explore table.")}finally{this.exploringKey.set(null)}}}async ensureExplored(e){let t=this.itemKey(e);if(this.entities().some(n=>this.entityKey(n)===t))return;let M=await this.schemaExplorer.exploreConnectionTable(this.connectionId,t,this.adapterType);this.entities().some(n=>this.entityKey(n)===t)||this.entities.update(n=>[...n,this.toEntity(e,M)])}toEntity(e,t){let M=this.itemKey(e),n=t.table.schema==="%"?"dbo":t.table.schema,r=this.preselectedKeys.has(M.toLowerCase()),o=this.preselectedColumnsByKey.get(M.toLowerCase());return{tableName:t.table.name,schema:n,rowCount:t.table.rowCount,columns:t.columns,primaryKey:t.primaryKey,relatedTables:t.relatedTables,referencedBy:t.referencedBy,showAll:!1,selectedColumns:o?.length?new Set(t.columns.filter(a=>o.includes(a.name)).map(a=>a.name)):new Set(t.columns.map(a=>a.name)),isRoot:r}}selectedEntity=At(()=>{let e=this.selectedKey();return e?this.entities().find(t=>this.entityKey(t)===e)??null:null});selectedNullableCount=At(()=>{let e=this.selectedEntity();return e?e.columns.filter(t=>t.nullable).length:0});selectedSelectedCount=At(()=>{let e=this.selectedEntity();return e?e.selectedColumns.size:0});entityKey(e){return`${e.schema}.${e.tableName}`}toggleColumn(e,t){this.entities.update(M=>M.map(n=>{if(n!==e)return n;let r=new Set(n.selectedColumns);return r.has(t)?r.delete(t):r.add(t),U(x({},n),{selectedColumns:r})}))}toggleAllColumns(e){this.entities.update(t=>t.map(M=>{if(M!==e)return M;let n=M.columns.every(r=>M.selectedColumns.has(r.name));return U(x({},M),{selectedColumns:n?new Set:new Set(M.columns.map(r=>r.name))})}))}isAllSelected(e){return e.columns.length>0&&e.columns.every(t=>e.selectedColumns.has(t.name))}isIndeterminate(e){let t=e.columns.filter(M=>e.selectedColumns.has(M.name)).length;return t>0&&t<e.columns.length}static \u0275fac=function(t){return new(t||i)(ni(Hu))};static \u0275cmp=rM({type:i,selectors:[["app-er-diagram"]],inputs:{connectionId:"connectionId",adapterType:"adapterType",tables:"tables",preselectedColumns:"preselectedColumns",showActions:"showActions",updating:"updating",multiSelect:"multiSelect"},outputs:{cancel:"cancel",update:"update",selectedTablesChange:"selectedTablesChange"},features:[tN([Hu])],decls:32,vars:14,consts:[[1,"cs"],[1,"cs__head"],[1,"cs__head-left"],[1,"cs__title"],[1,"cs__conn"],[1,"cs__actions"],[1,"cs__empty","cs__empty--error"],[1,"cs__body"],[1,"cs__tables"],[1,"cs__tables-head"],[1,"cs__tables-title"],[1,"cs__tables-count"],["placeholder","Search tables\u2026",1,"cs__search",3,"nile-input","input","value"],[1,"cs__filters"],["type","button",1,"cs__filter",3,"click"],[1,"cs__tablelist"],[1,"cs__empty","cs__empty--mini"],[1,"cs__columns"],[1,"cs__empty"],["variant","fluid","pagesizeoptions","[10,20,50,100]",1,"cs__pagination"],["variant","tertiary",3,"click"],["variant","primary",3,"click"],["slot","prefix",1,"btn-spinner","btn-spinner--light"],["name","ng-alert-circle","size","20","method","stroke"],[1,"cs__table","cs__table--skeleton"],[1,"cs__skeleton","cs__skeleton--name"],[1,"cs__table-meta"],[1,"cs__skeleton","cs__skeleton--badge"],[1,"cs__skeleton","cs__skeleton--meta"],[1,"cs__table-row",3,"cs__table-row--multi","cs__table-row--active"],[1,"cs__table-row"],[1,"cs__table-check"],["type","button",1,"cs__table",3,"click"],[1,"cs__table-name"],[1,"cs__table-badge"],[1,"cs__table-rows"],[1,"cs__table-check",3,"click","nile-change"],[1,"cs__cols-head"],[1,"cs__head-titlerow"],[1,"cs__skeleton","cs__skeleton--title"],[1,"cs__stats"],[1,"cs__stat"],[1,"cs__col-rows"],[1,"cs__col","cs__col--skeleton"],[1,"cs__skeleton","cs__skeleton--stat-label"],[1,"cs__skeleton","cs__skeleton--stat-value"],[1,"cs__col-check"],[1,"cs__skeleton","cs__skeleton--check"],[1,"cs__col-name"],[1,"cs__skeleton","cs__skeleton--cell"],[1,"cs__col-type"],[1,"cs__col-meta"],[1,"cs__col-null"],[1,"cs__cols-name"],[1,"cs__stat-label"],[1,"cs__stat-value"],[1,"cs__col","cs__col--header"],[1,"cs__col-check","cs__col-th"],["title","Toggle all columns",3,"nile-change"],[1,"cs__col-name","cs__col-th"],[1,"cs__col-type","cs__col-th"],[1,"cs__col-meta","cs__col-th"],[1,"cs__col-null","cs__col-th"],[1,"cs__col","cs__col--row",3,"cs__col--selected"],[1,"cs__col","cs__col--row"],[3,"nile-change"],["name","ng-key-01","method","stroke","size","12","title","Primary key",1,"cs__pk"],["title","Max length",1,"cs__chip"],["title","Precision",1,"cs__chip"],["title","Scale",1,"cs__chip"],[1,"cs__chip","cs__chip--dim"],["variant","fluid","pagesizeoptions","[10,20,50,100]",1,"cs__pagination",3,"nile-change"]],template:function(t,M){if(t&1&&(C(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),Y(4,"Schema"),b(),he(5,hJt,2,1,"span",4),b(),he(6,pJt,6,3,"div",5),b(),he(7,LJt,4,1,"div",6),C(8,"div",7)(9,"aside",8)(10,"div",9)(11,"span",10),Y(12,"Tables"),b(),C(13,"span",11),Y(14),b()(),C(15,"nile-input",12),Ae("nile-input",function(r){return M.onSearch(r)})("input",function(r){return M.onSearch(r)}),b(),C(16,"div",13)(17,"button",14),Ae("click",function(){return M.setTypeFilter("any")}),Y(18,"All"),b(),C(19,"button",14),Ae("click",function(){return M.setTypeFilter("table")}),Y(20,"Tables"),b(),C(21,"button",14),Ae("click",function(){return M.setTypeFilter("view")}),Y(22,"Views"),b()(),C(23,"div",15),he(24,mJt,2,0)(25,EJt,2,0,"div",16)(26,kJt,2,0),b()(),C(27,"section",17),he(28,UJt,9,1)(29,RJt,41,12)(30,VJt,2,0,"div",18),b()(),he(31,BJt,1,3,"nile-pagination",19),b()),t&2){let n;L(5),xe(M.listMeta().database?5:-1),L(),xe(M.showActions?6:-1),L(),xe(M.loadError()?7:-1),L(7),yi("",M.listMeta().total," items"),L(),Ue("value",M.search()),L(2),Wt("cs__filter--active",M.typeFilter()==="any"),L(2),Wt("cs__filter--active",M.typeFilter()==="table"),L(2),Wt("cs__filter--active",M.typeFilter()==="view"),L(3),xe(M.isLoading()&&M.tableList().length===0?24:M.filteredList().length===0?25:26),L(4),xe(M.exploringKey()&&!M.selectedEntity()?28:(n=M.selectedEntity())?29:30,n),L(3),xe(M.listMeta().totalPages>1?31:-1)}},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0}.cs[_ngcontent-%COMP%]{background:var(--ng-colors-bg-primary);overflow:hidden;display:flex;flex-direction:column;flex:1;max-height:100%;border:1px solid var(--ng-colors-border-secondary);border-radius:12px;box-shadow:0 1px 2px #0a0d120d}.cs__head[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid var(--ng-colors-border-secondary);font-size:13px;flex-shrink:0}.cs__head-left[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:8px}.cs__actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.cs__title[_ngcontent-%COMP%]{font-weight:600;color:var(--ng-colors-text-primary-900)}.cs__conn[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:var(--ng-colors-text-tertiary-600);font-size:12px}.cs__body[_ngcontent-%COMP%]{display:grid;grid-template-columns:280px 1fr;flex:1 1 auto;min-height:0;overflow:hidden}.cs__tables[_ngcontent-%COMP%]{display:flex;flex-direction:column;border-right:1px solid var(--ng-colors-border-secondary);min-height:0}.cs__tables-head[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between;padding:12px 14px 6px}.cs__tables-title[_ngcontent-%COMP%]{font-size:13px;font-weight:600;color:var(--ng-colors-text-primary-900)}.cs__tables-count[_ngcontent-%COMP%]{font-size:11px;color:var(--ng-colors-text-tertiary-600)}.cs__search[_ngcontent-%COMP%]{padding:4px 12px 8px}.cs__filters[_ngcontent-%COMP%]{display:flex;gap:6px;padding:0 12px 10px;flex-wrap:wrap}.cs__filter[_ngcontent-%COMP%]{background:var(--ng-colors-bg-secondary);border:0;border-radius:999px;padding:4px 12px;font-size:12px;color:var(--ng-colors-text-tertiary-600);cursor:pointer;transition:background .1s ease,color .1s ease}.cs__filter[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-quaternary)}.cs__filter--active[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary);color:var(--ng-colors-border-brand);font-weight:500}.cs__tablelist[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:4px 6px 8px;min-height:0}.cs__pagination[_ngcontent-%COMP%]{display:block;flex-shrink:0;border-top:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary)}.cs__table-row[_ngcontent-%COMP%]{display:flex;align-items:stretch;gap:4px}.cs__table-row--multi[_ngcontent-%COMP%] .cs__table[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0}.cs__table-check[_ngcontent-%COMP%]{align-self:center;flex-shrink:0;padding-left:4px}.cs__table[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:stretch;width:100%;text-align:left;background:transparent;border:0;padding:10px 12px;border-radius:8px;cursor:pointer;gap:4px;transition:background .12s ease}.cs__table[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.cs__table--active[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary)}.cs__table--active[_ngcontent-%COMP%] .cs__table-name[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand);font-weight:500}.cs__table-name[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;color:var(--ng-colors-text-primary-900);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cs__table-meta[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:6px}.cs__table-rows[_ngcontent-%COMP%]{font-size:11px;color:var(--ng-colors-text-tertiary-600)}.cs__table-badge[_ngcontent-%COMP%]{display:inline-block;font-size:9.5px;font-weight:500;letter-spacing:.4px;text-transform:uppercase;padding:1px 6px;border-radius:999px}.cs__table-badge--root[_ngcontent-%COMP%]{color:var(--ng-colors-border-brand);background:var(--ng-colors-bg-brand-primary)}.cs__table-badge--related[_ngcontent-%COMP%]{color:var(--ng-colors-text-tertiary-600);background:var(--ng-colors-bg-secondary)}.cs__columns[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-height:0;background:var(--ng-colors-bg-secondary-subtle)}.cs__cols-head[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding:14px 18px;border-bottom:1px solid var(--ng-colors-border-secondary);flex-shrink:0}.cs__head-titlerow[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px}.cs__cols-name[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;color:var(--ng-colors-text-primary-900)}.cs__stats[_ngcontent-%COMP%]{display:flex;gap:24px}.cs__stat[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px}.cs__stat-label[_ngcontent-%COMP%]{font-size:10px;font-weight:600;letter-spacing:.4px;color:var(--ng-colors-text-tertiary-600)}.cs__stat-value[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:14px;color:var(--ng-colors-text-primary-900)}.cs__col-rows[_ngcontent-%COMP%]{flex:1;overflow-y:auto;background:transparent}.cs__col[_ngcontent-%COMP%]{display:grid;grid-template-columns:36px minmax(160px,1.4fr) 120px 1fr 110px;align-items:center;width:100%;text-align:left;padding:8px 14px;gap:10px;cursor:pointer;border-bottom:1px solid var(--ng-colors-border-tertiary);margin:0;transition:background .12s ease}.cs__col--row[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.cs__col--selected[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary)}.cs__col--header[_ngcontent-%COMP%]{cursor:default;background:var(--ng-colors-bg-secondary);position:sticky;top:0;z-index:1}.cs__col-th[_ngcontent-%COMP%]{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;color:var(--ng-colors-text-tertiary-600);font-family:-apple-system,BlinkMacSystemFont,sans-serif}.cs__col-check[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}.cs__col-name[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;color:var(--ng-colors-text-primary-900);display:inline-flex;align-items:center;gap:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cs__pk[_ngcontent-%COMP%]{color:var(--ng-colors-fg-warning-primary);flex-shrink:0}.cs__col-type[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11.5px;color:var(--ng-colors-text-tertiary-600)}.cs__col-meta[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:4px;flex-wrap:wrap}.cs__chip[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:10px;color:var(--ng-colors-text-tertiary-600);background:var(--ng-colors-bg-secondary);border-radius:4px;padding:1px 5px}.cs__chip--dim[_ngcontent-%COMP%]{opacity:.5}.cs__col-null[_ngcontent-%COMP%]{display:inline-block;justify-self:start;font-size:10px;font-weight:500;letter-spacing:.3px;color:var(--ng-colors-text-tertiary-600);background:var(--ng-colors-bg-secondary);border-radius:4px;padding:2px 6px}.cs__col-null--required[_ngcontent-%COMP%]{color:var(--ng-colors-fg-success-primary);background:var(--ng-colors-bg-success-secondary)}.cs__empty[_ngcontent-%COMP%]{padding:24px;text-align:center;font-size:13px;color:var(--ng-colors-text-tertiary-600);display:flex;flex-direction:column;align-items:center;gap:8px}.cs__empty--error[_ngcontent-%COMP%]{color:var(--ng-colors-fg-error-primary)}.cs__empty--mini[_ngcontent-%COMP%]{padding:14px;font-size:12px}.cs__skeleton[_ngcontent-%COMP%]{display:block;border-radius:4px}.cs__skeleton--name[_ngcontent-%COMP%]{width:70%;height:14px}.cs__skeleton--badge[_ngcontent-%COMP%]{width:56px;height:12px;border-radius:999px}.cs__skeleton--meta[_ngcontent-%COMP%]{width:50px;height:12px}.cs__skeleton--title[_ngcontent-%COMP%]{width:240px;height:16px}.cs__skeleton--stat-label[_ngcontent-%COMP%]{width:60px;height:10px;margin-bottom:4px}.cs__skeleton--stat-value[_ngcontent-%COMP%]{width:36px;height:16px}.cs__skeleton--check[_ngcontent-%COMP%]{width:16px;height:16px;border-radius:4px}.cs__skeleton--cell[_ngcontent-%COMP%]{height:12px;width:80%}.cs__table--skeleton[_ngcontent-%COMP%]{cursor:default}.cs__table--skeleton[_ngcontent-%COMP%]:hover{background:transparent}.cs__col--skeleton[_ngcontent-%COMP%]{cursor:default}.cs__col--skeleton[_ngcontent-%COMP%]:hover{background:transparent}"]})};function Iut(i,e){return this.entityKey(e)}var dut=(i,e)=>e.name;function FJt(i,e){i&1&&(C(0,"div",1),Zt(1,"span",5),C(2,"span"),Y(3,"Loading index schemas\u2026"),b()())}function HJt(i,e){if(i&1&&(C(0,"div",2),Zt(1,"nile-glyph",6),C(2,"p"),Y(3),b()()),i&2){let t=p();L(3),it(t.loadError())}}function JJt(i,e){i&1&&(C(0,"div",1),Zt(1,"nile-glyph",7),C(2,"p"),Y(3,"No indices loaded."),b()())}function GJt(i,e){if(i&1){let t=Le();C(0,"button",17),Ae("click",function(){let n=P(t).$index,r=p(2);return R(r.selectIndex(n))}),C(1,"nile-checkbox",18),Ae("click",function(n){return n.stopPropagation()})("nile-change",function(){let n=P(t).$implicit,r=p(2);return R(r.toggleAllColumns(n))}),b(),C(2,"span",19),Y(3),b(),C(4,"span",20)(5,"span",21),Y(6),b(),Zt(7,"nile-glyph",22),b()()}if(i&2){let t=e.$implicit,M=e.$index,n=p(2);Wt("obj-row--active",M===n.selectedIdx()),L(),It("checked",n.isAllSelected(t)?"":null)("indeterminate",n.isIndeterminate(t)?"":null)("aria-label","Toggle "+t.tableName),L(2),it(t.tableName),L(2),Wt("obj-count--on",t.selectedColumns.size>0),L(),Jo(" ",t.selectedColumns.size,"/",t.columns.length," ")}}function $Jt(i,e){if(i&1){let t=Le();C(0,"button",30),Ae("click",function(){let n=P(t).$implicit,r=p(),o=p(2);return R(o.toggleColumn(r,n.name))}),C(1,"nile-checkbox",31),Ae("click",function(n){return n.stopPropagation()})("nile-change",function(){let n=P(t).$implicit,r=p(),o=p(2);return R(o.toggleColumn(r,n.name))}),b(),C(2,"span",32),Y(3),b(),C(4,"span",33),Y(5),b()()}if(i&2){let t=e.$implicit,M=p();Wt("field-row--on",M.selectedColumns.has(t.name)),L(),It("checked",M.selectedColumns.has(t.name)?"":null),L(2),it(t.name),L(2),it(t.dataType)}}function XJt(i,e){if(i&1){let t=Le();C(0,"div",16)(1,"div",11)(2,"div",23)(3,"h4",24),Y(4),b(),C(5,"p",25),Y(6),b()(),C(7,"div",26)(8,"nile-button",27),Ae("click",function(){let n=P(t),r=p(2);return R(r.toggleAllColumns(n))}),Y(9),b()()(),C(10,"div",28),ht(11,$Jt,6,5,"button",29,dut),b()()}if(i&2){let t=e,M=p(2);L(4),it(t.tableName),L(2),Jo("",t.selectedColumns.size," of ",t.columns.length," fields selected"),L(3),yi(" ",M.isAllSelected(t)?"Clear all":"Select all"," "),L(2),xt(t.columns)}}function qJt(i,e){if(i&1&&(C(0,"section",3)(1,"div",8)(2,"div",9)(3,"div",10)(4,"div",11)(5,"div")(6,"div",12),Y(7,"Indices"),b(),C(8,"div",13),Y(9),b()()(),C(10,"div",14),ht(11,GJt,8,10,"button",15,Iut,!0),b()(),he(13,XJt,13,4,"div",16),b()()()),i&2){let t,M=p();L(9),yi("",M.entities().length," total"),L(2),xt(M.entities()),L(2),xe((t=M.selectedEntity())?13:-1,t)}}function KJt(i,e){if(i&1){let t=Le();C(0,"li",46)(1,"label",48)(2,"nile-checkbox",41),Ae("nile-change",function(){let n=P(t).$implicit,r=p().$implicit,o=p(2);return R(o.toggleColumn(r,n.name))}),b(),C(3,"span",49),Y(4),b(),C(5,"span",50),Y(6),b()()()}if(i&2){let t=e.$implicit,M=p().$implicit;L(2),It("checked",M.selectedColumns.has(t.name)?"":null),L(),Ue("title",t.name),L(),it(t.name),L(2),it(t.dataType)}}function eGt(i,e){i&1&&Y(0," Show less ")}function tGt(i,e){if(i&1&&Y(0),i&2){let t=p(2).$implicit;yi(" Load ",t.columns.length-5," more\u2026 ")}}function iGt(i,e){if(i&1){let t=Le();C(0,"button",51),Ae("click",function(){P(t);let n=p().$implicit,r=p(2);return R(r.toggleShowAll(n))}),he(1,eGt,1,0)(2,tGt,1,1),b()}if(i&2){let t=p().$implicit;L(),xe(t.showAll?1:2)}}function MGt(i,e){if(i&1){let t=Le();C(0,"div",38)(1,"div",39)(2,"label",40)(3,"nile-checkbox",41),Ae("nile-change",function(){let n=P(t).$implicit,r=p(2);return R(r.toggleAllColumns(n))}),b()(),C(4,"div",42),Zt(5,"nile-glyph",35),C(6,"span",43),Y(7),b()(),C(8,"span",44),Y(9,"index"),b()(),C(10,"ul",45),ht(11,KJt,7,4,"li",46,dut),b(),he(13,iGt,3,1,"button",47),b()}if(i&2){let t=e.$implicit,M=p(2);It("data-key",M.entityKey(t)),L(3),It("checked",M.isAllSelected(t)?"":null)("indeterminate",M.isIndeterminate(t)?"":null),L(3),Ue("title",M.entityKey(t)),L(),yi(" ",t.tableName," "),L(4),xt(M.visibleColumns(t)),L(2),xe(t.columns.length>5?13:-1)}}function nGt(i,e){if(i&1&&(C(0,"div",4)(1,"div",34),Zt(2,"nile-glyph",35),C(3,"span"),Y(4,"Indices"),b(),C(5,"span",36),Y(6),b()(),C(7,"div",37),ht(8,MGt,14,6,"div",38,Iut,!0),b()()),i&2){let t=p();L(6),it(t.entities().length),L(2),xt(t.entities())}}var WH=class i{constructor(e){this.schemaExplorer=e}schemaExplorer;connectionId;indexNames=[];preselectedFields={};masterDetail=!1;entities=ke([]);isLoading=ke(!1);loadError=ke("");selectedIdx=ke(0);selectedEntity=At(()=>this.entities()[this.selectedIdx()]);VISIBLE_COLS=5;ngOnInit(){this.loadSchema()}async loadSchema(){this.isLoading.set(!0),this.loadError.set(""),this.entities.set([]);try{let e=await this.schemaExplorer.exploreOpenSearchIndexesBatched(this.connectionId,this.indexNames),t=[];e.forEach((M,n)=>{let r=this.indexNames[n];if(M.status!=="fulfilled")return;let o=M.value,a=o.fields.map((N,c)=>({ordinal:c+1,name:N.name,dataType:N.dataType,nullable:!0,isPrimaryKey:!1})),s=this.preselectedFields[r],l=s&&s.length>0?new Set(a.filter(N=>s.includes(N.name)).map(N=>N.name)):new Set(a.map(N=>N.name));t.push({tableName:o.index,schema:"",rowCount:0,columns:a,primaryKey:[],relatedTables:[],referencedBy:[],showAll:!1,selectedColumns:l,isRoot:!0})}),this.entities.set(t)}catch(e){this.loadError.set(e instanceof Error?e.message:"Failed to load index schemas.")}finally{this.isLoading.set(!1)}}entityKey(e){return e.tableName}selectIndex(e){this.selectedIdx.set(e)}visibleColumns(e){return e.showAll?e.columns:e.columns.slice(0,this.VISIBLE_COLS)}toggleShowAll(e){this.entities.update(t=>t.map(M=>M===e?U(x({},M),{showAll:!M.showAll}):M))}toggleColumn(e,t){this.entities.update(M=>M.map(n=>{if(n!==e)return n;let r=new Set(n.selectedColumns);return r.has(t)?r.delete(t):r.add(t),U(x({},n),{selectedColumns:r})}))}toggleAllColumns(e){this.entities.update(t=>t.map(M=>{if(M!==e)return M;let n=M.columns.every(r=>M.selectedColumns.has(r.name));return U(x({},M),{selectedColumns:n?new Set:new Set(M.columns.map(r=>r.name))})}))}isAllSelected(e){return e.columns.length>0&&e.columns.every(t=>e.selectedColumns.has(t.name))}isIndeterminate(e){let t=e.columns.filter(M=>e.selectedColumns.has(M.name)).length;return t>0&&t<e.columns.length}static \u0275fac=function(t){return new(t||i)(ni(Hu))};static \u0275cmp=rM({type:i,selectors:[["app-os-schema-viewer"]],inputs:{connectionId:"connectionId",indexNames:"indexNames",preselectedFields:"preselectedFields",masterDetail:"masterDetail"},features:[tN([Hu])],decls:6,vars:1,consts:[[1,"erd-canvas"],[1,"erd-placeholder"],[1,"erd-placeholder","erd-placeholder--error"],[1,"section-card","scope-card"],[1,"erd-section"],[1,"erd-spinner","erd-spinner--lg"],["name","ng-alert-circle","size","36","method","stroke"],["name","ng-dataflow-02","size","40","method","stroke",1,"erd-empty-icon"],[1,"scope-detail"],[1,"scope-split"],[1,"obj-pane"],[1,"pane-head"],[1,"pane-title"],[1,"pane-sub"],[1,"obj-list"],["type","button",1,"obj-row",3,"obj-row--active"],[1,"field-pane"],["type","button",1,"obj-row",3,"click"],["size","small",1,"obj-row__cbx",3,"click","nile-change"],[1,"obj-row__name"],[1,"obj-row__meta"],[1,"obj-count"],["name","ng-chevron-right","method","stroke","size","14",1,"obj-row__chev"],[1,"fr-head"],[1,"fr-title"],[1,"fr-sub"],[1,"fr-tools"],["size","sm","variant","tertiary",3,"click"],[1,"field-list"],["type","button",1,"field-row",3,"field-row--on"],["type","button",1,"field-row",3,"click"],["size","small",1,"field-row__cbx",3,"click","nile-change"],[1,"field-row__name"],[1,"field-row__type"],[1,"erd-section-label"],["name","ng-dataflow-02","size","13","method","stroke"],[1,"erd-section-count"],[1,"erd-grid"],[1,"er-entity","er-entity--root"],[1,"er-entity__header"],["title","Toggle all fields",1,"er-entity__select-all"],[3,"nile-change"],[1,"er-entity__title"],[1,"er-entity__name",3,"title"],[1,"er-entity__badge","er-entity__badge--root"],[1,"er-entity__cols"],[1,"er-entity__col-row"],[1,"er-entity__load-more"],[1,"er-entity__col-label"],[1,"col-name",3,"title"],[1,"col-type"],[1,"er-entity__load-more",3,"click"]],template:function(t,M){t&1&&(C(0,"div",0),he(1,FJt,4,0,"div",1)(2,HJt,4,1,"div",2)(3,JJt,4,0,"div",1)(4,qJt,14,2,"section",3)(5,nGt,10,1,"div",4),b()),t&2&&(L(),xe(M.isLoading()?1:M.loadError()?2:M.entities().length===0?3:M.masterDetail?4:5))},styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.erd-canvas[_ngcontent-%COMP%]{flex:1;overflow:auto;display:flex;flex-direction:column;gap:24px;padding:24px 40px}.erd-placeholder[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;flex:1;color:var(--ng-colors-text-tertiary-600);text-align:center;padding:32px}.erd-placeholder[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font-size:.875rem;max-width:280px;margin:0}.erd-placeholder--error[_ngcontent-%COMP%]{color:var(--ng-colors-text-error-primary-600)}.erd-empty-icon[_ngcontent-%COMP%]{opacity:.35}.erd-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.erd-section-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px;font-size:.75rem;font-weight:600;color:var(--ng-colors-text-secondary-700);text-transform:uppercase;letter-spacing:.04em}.erd-section-count[_ngcontent-%COMP%]{font-size:.7rem;font-weight:600;background:var(--ng-colors-bg-tertiary);color:var(--ng-colors-text-tertiary-600);border-radius:10px;padding:1px 7px}.erd-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;align-items:start}.er-entity[_ngcontent-%COMP%]{background:var(--ng-colors-bg-primary);border:1px solid var(--ng-colors-border-secondary);border-radius:8px;overflow:hidden}.er-entity--root[_ngcontent-%COMP%]{border-color:var(--ng-colors-border-brand)}.er-entity--related[_ngcontent-%COMP%]{border-color:var(--ng-colors-border-secondary)}.er-entity__header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px;padding:8px 10px;background:var(--ng-colors-bg-secondary);border-bottom:1px solid var(--ng-colors-border-secondary)}.er-entity__select-all[_ngcontent-%COMP%]{flex-shrink:0;cursor:pointer}.er-entity__title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:5px;flex:1;min-width:0;color:var(--ng-colors-fg-quaternary-400)}.er-entity__name[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ng-colors-text-primary-900)}.er-entity__badge[_ngcontent-%COMP%]{font-size:.6rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em;border-radius:4px;padding:1px 5px;flex-shrink:0}.er-entity__badge--root[_ngcontent-%COMP%]{color:var(--ng-colors-text-brand-secondary-700);background:var(--ng-colors-bg-brand-primary)}.er-entity__cols[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0}.er-entity__col-row[_ngcontent-%COMP%]{border-bottom:1px solid var(--ng-colors-border-secondary)}.er-entity__col-row[_ngcontent-%COMP%]:last-child{border-bottom:none}.er-entity__col-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:5px;padding:5px 10px;cursor:pointer;font-size:.75rem;transition:background .1s}.er-entity__col-label[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.er-entity__load-more[_ngcontent-%COMP%]{width:100%;padding:5px;background:none;border:none;border-top:1px solid var(--ng-colors-border-secondary);color:var(--ng-colors-text-brand-secondary-700);font-size:.73rem;cursor:pointer;text-align:center;transition:background .1s}.er-entity__load-more[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-brand-primary)}.col-name[_ngcontent-%COMP%]{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.col-type[_ngcontent-%COMP%]{font-size:.67rem;color:var(--ng-colors-text-tertiary-600);white-space:nowrap;flex-shrink:0}.erd-spinner[_ngcontent-%COMP%]{display:inline-block;width:16px;height:16px;border:2px solid rgba(0,0,0,.12);border-top-color:currentColor;border-radius:50%;animation:_ngcontent-%COMP%_erd-spin .7s linear infinite;flex-shrink:0}.erd-spinner--lg[_ngcontent-%COMP%]{width:28px;height:28px;border-width:3px}@keyframes _ngcontent-%COMP%_erd-spin{to{transform:rotate(360deg)}}.section-card.scope-card[_ngcontent-%COMP%]{flex:1;min-height:0;display:flex;flex-direction:column;border-radius:16px;border:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-primary);box-shadow:0 1px 2px #0a0d120d;padding:20px;overflow:hidden}.scope-detail[_ngcontent-%COMP%]{flex:1;min-height:0;display:flex;border:1px solid var(--ng-colors-border-secondary);border-radius:12px;overflow:hidden}.scope-split[_ngcontent-%COMP%]{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,.95fr) minmax(0,1.05fr);grid-template-rows:minmax(0,1fr)}@media(max-width:860px){.scope-split[_ngcontent-%COMP%]{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) minmax(0,1fr)}}.obj-pane[_ngcontent-%COMP%], .field-pane[_ngcontent-%COMP%]{padding:22px 24px;display:flex;flex-direction:column;gap:14px;min-width:0;min-height:0}.field-pane[_ngcontent-%COMP%]{border-left:1px solid var(--ng-colors-border-secondary);background:var(--ng-colors-bg-secondary-subtle)}@media(max-width:860px){.field-pane[_ngcontent-%COMP%]{border-left:none;border-top:1px solid var(--ng-colors-border-secondary)}}.pane-head[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.pane-title[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:var(--ng-colors-text-primary-900)}.pane-sub[_ngcontent-%COMP%]{font-size:12.5px;color:var(--ng-colors-text-tertiary-600);margin-top:1px}.obj-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;flex:1;min-height:0;overflow-y:auto;margin:0 -8px;padding:0 8px}.obj-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;width:100%;text-align:left;background:transparent;border:0;padding:11px 12px;cursor:pointer;border-radius:8px;transition:background .12s}.obj-row[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-secondary)}.obj-row--active[_ngcontent-%COMP%]{background:var(--ng-colors-bg-brand-primary)}.obj-row__name[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0;font-size:14px;font-weight:600;color:var(--ng-colors-text-primary-900);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.obj-row__meta[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;flex-shrink:0}.obj-row__chev[_ngcontent-%COMP%]{color:var(--ng-colors-fg-quaternary-400);display:inline-flex}.obj-row__cbx[_ngcontent-%COMP%]{flex-shrink:0}.obj-count[_ngcontent-%COMP%]{font-size:12.5px;font-variant-numeric:tabular-nums;color:var(--ng-colors-fg-quaternary-400);font-weight:500}.obj-count--on[_ngcontent-%COMP%]{color:var(--ng-colors-text-secondary-700)}.fr-head[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;min-width:0}.fr-title[_ngcontent-%COMP%]{margin:0;font-size:15px;font-weight:600;color:var(--ng-colors-text-primary-900)}.fr-sub[_ngcontent-%COMP%]{margin:0;font-size:12.5px;color:var(--ng-colors-text-quaternary-500)}.fr-tools[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}.field-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow-y:auto;margin:0 -8px;padding:0 8px}.field-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:11px;width:100%;text-align:left;background:transparent;border:0;padding:9px 12px;cursor:pointer;border-radius:8px;transition:background .12s,box-shadow .12s}.field-row[_ngcontent-%COMP%] + .field-row[_ngcontent-%COMP%]{box-shadow:0 -1px 0 var(--ng-colors-border-tertiary)}.field-row[_ngcontent-%COMP%]:hover{background:var(--ng-colors-bg-primary);box-shadow:0 1px 2px #0a0d120d}.field-row__name[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;color:var(--ng-colors-text-secondary-700);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.field-row--on[_ngcontent-%COMP%] .field-row__name[_ngcontent-%COMP%]{color:var(--ng-colors-text-primary-900)}.field-row__type[_ngcontent-%COMP%]{flex-shrink:0;font-size:12px;color:var(--ng-colors-text-quaternary-500);white-space:nowrap}.field-row__cbx[_ngcontent-%COMP%]{flex-shrink:0;pointer-events:none}"]})};var PH=class i{http=Fe(yo);tokenStore=Fe(vr);triggerUrl(){let e=hA()||dt.baseUrl,t=(this.tokenStore.tenantId()??"").trim(),M=Oi().trim();return!t||!M?null:`${e}/api/customers/${t}/products/${M}/workforce/auto-dashboard/trigger`}async trigger(){let e=this.triggerUrl();return e?oi(this.http.post(e,{})):{success:!1,skipped:!0}}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Ct({token:i,factory:i.\u0275fac,providedIn:"root"})};var rGt={analyzing:"Understanding your data\u2026",querying:"Crunching the numbers\u2026",building:"Drawing your charts\u2026",saving:"Saving your dashboard\u2026"};function jut(i){let e=(i??"").toLowerCase();return e.includes("sav")?"saving":e.includes("building")||e.includes("chart")?"building":e.includes("running")?"querying":"analyzing"}function VH(i){return i.phase??jut(i.message)}function BH(i,e){return i.label?.trim()||i.message?.trim()||rGt[e]}var oGt=["analyzing","querying","building","saving"];function RH(i){let e=oGt.indexOf(i);return e<0?0:e}function aGt(i,e){return i&&RH(i)>=RH(e)?i:e}function FH(i){let e="message",t=[];for(let M of i.split(`
|
|
40580
40580
|
`))!M||M.startsWith(":")||(M.startsWith("event:")?e=M.slice(6).trim():M.startsWith("data:")&&t.push(M.slice(5).trim()));return t.length===0?null:{event:e,data:t.join(`
|
|
40581
40581
|
`)}}function HH(i,e){return new Promise(t=>{if(e.aborted){t();return}let M=setTimeout(()=>{e.removeEventListener("abort",n),t()},i),n=()=>{clearTimeout(M),t()};e.addEventListener("abort",n,{once:!0})})}var JH=class i{static RECONNECT_MS=2500;static MAX_RECONNECTS=1;tokenStore=Fe(vr);stream(e,t){if(!e)return()=>{};let M=new AbortController,n=!1,r=[],o=s=>{s.kind==="saved"&&s.dashboardId&&r.push(s.dashboardId),t(s)};return(async()=>{let s=i.MAX_RECONNECTS;for(;!n;){let l=!1;try{l=await this.consume(e,o,M.signal)}catch(N){if(n||M.signal.aborted)return;console.warn("[auto-dashboard] stream dropped:",N)}if(n||l)return;if(s<=0){o({kind:"error",message:"stream-ended",dashboardIds:[...r]});return}s-=1,await HH(i.RECONNECT_MS,M.signal)}})(),()=>{n=!0,M.abort()}}streamUrl(e){let t=hA()||dt.baseUrl,M=this.tokenStore.tenantId()??"",n=Oi();return`${t}/api/customers/${M}/products/${n}/workforce/auto-dashboard/stream/${e}`}async consume(e,t,M){let n=this.tokenStore.accessToken()??"",r=await fetch(this.streamUrl(e),{method:"GET",headers:x({Accept:"text/event-stream"},n?{Authorization:`Bearer ${n}`}:{}),signal:M});if(!r.ok||!r.body)throw new Error(`auto-dashboard stream HTTP ${r.status}`);let o=r.body.getReader(),a=new TextDecoder,s="",l=!1;for(;;){let{value:N,done:c}=await o.read();if(c)break;s=(s+a.decode(N,{stream:!0})).replace(/\r\n/g,`
|
|
40582
40582
|
`);let D;for(;(D=s.indexOf(`
|