1import{Ec as mt,Mb as lt,Wg as ct,Xg as pt,Yg as xt,Zg as ut,_g as ht,d as tt,id as dt,k as et,kh as vt,lc as st,ve as P}from"./chunk-X5J6QTCG.js";import{$ as k,$a as c,Ad as J,Fa as l,Fb as F,Gb as z,Ib as t,Jb as u,Ka as b,Kb as _,L as V,Ma as D,Na as L,Qb as G,Rb as Y,Sa as I,Sb as Q,U as T,Wc as K,Xa as M,Yc as Z,_ as W,ba as q,bb as p,be as ot,cc as X,d as A,dc as j,eb as B,fa as C,fb as U,fi as rt,ga as g,gb as h,hb as e,hd as H,ib as i,jb as x,lc as y,nc as w,pj as O,qb as S,sb as f,tb as d,vd as it,xd as nt,yd as at}from"./chunk-SMW7PHYX.js";import"./chunk-BMIYOSOG.js";var R=(()=>{let s=class s{constructor(r){this.webAPI=r,this.baseUrl="admin/app-insights"}getCustomEvents(r=100,o=null,m=[]){let v=new H().set("limit",r.toString());return o&&(v=v.set("before",o.toISOString())),m&&m.length>0&&m.forEach($=>{v=v.append("eventTypes",$.toString())}),this.webAPI.getData(`${this.baseUrl}/custom-events`,v)}getCustomMetrics(r=100,o=null){let m=new H().set("limit",r.toString());return o&&(m=m.set("before",o.toISOString())),this.webAPI.getData(`${this.baseUrl}/custom-metrics`,m)}getCustomEventById(r){return this.webAPI.getData(`${this.baseUrl}/custom-events/${encodeURIComponent(r)}`)}};s.\u0275fac=function(o){return new(o||s)(q(rt))},s.\u0275prov=W({token:s,factory:s.\u0275fac,providedIn:"root"});let n=s;return n})();var E=(function(n){return n.HighConnectionCount="HighConnectionCount",n.SlowDatabaseConnection="SlowDatabaseConnection",n.ExtremelyLongConnection="ExtremelyLongConnection",n.ConnectionPoolLeak="ConnectionPoolLeak",n.AIPhotoValidation="AIPhotoValidation",n})(E||{});var wt=()=>({minWidth:"250px"}),ft=n=>["/admin/app-insights/events",n];function Tt(n,s){if(n&1){let a=S();t(0,` 2 `),e(1,"div",10),t(2,` 3 `),e(3,"p-multiSelect",11),Q("ngModelChange",function(o){C(a);let m=d();return Y(m.selectedEventTypes,o)||(m.selectedEventTypes=o),g(o)}),t(4,` 4 `),i(),t(5,` 5 `),e(6,"button",12),f("click",function(){C(a);let o=d();return g(o.loadEvents())}),t(7,` 6 `),x(8,"i",13),t(9,` Fetch 7 `),i(),t(10,` 8 `),i(),t(11,` 9 `)}if(n&2){let a=d();l(3),z(X(8,wt)),h("options",a.eventTypesOptions),G("ngModel",a.selectedEventTypes),h("maxSelectedLabels",1),l(3),h("disabled",a.loading),l(2),F("fa-spin",a.loading)}}function At(n,s){if(n&1){let a=S();t(0,` 10 `),e(1,"div",14),t(2,` 11 `),e(3,"button",12),f("click",function(){C(a);let o=d();return g(o.refresh())}),t(4,` 12 `),x(5,"i",13),t(6,` Refresh 13 `),i(),t(7,` 14 `),i(),t(8,` 15 `)}if(n&2){let a=d();l(3),h("disabled",a.loading),l(2),F("fa-spin",a.loading)}}function kt(n,s){n&1&&(t(0,` 16 `),e(1,"tr"),t(2,` 17 `),e(3,"th",15),t(4,"Time"),i(),t(5,` 18 `),e(6,"th",16),t(7,"Event"),i(),t(8,` 19 `),e(9,"th",17),t(10,"Duration"),i(),t(11,` 20 `),e(12,"th"),t(13,"Summary"),i(),t(14,` 21 `),e(15,"th",18),t(16,"Actions"),i(),t(17,` 22 `),i(),t(18,` 23 `))}function Dt(n,s){if(n&1&&(t(0,` 24 `),e(1,"div",23),t(2),i(),t(3,` 25 `)),n&2){let a=d().$implicit;l(2),u(a.appRoleInstance)}}function Lt(n,s){if(n&1&&(t(0,` 26 `),e(1,"span",24),t(2,` 27 `),e(3,"strong"),t(4,"Active connections:"),i(),t(5),i(),t(6,` 28 `)),n&2){let a=d().$implicit;l(5),_(` 29 `,a.customMeasurements==null?null:a.customMeasurements.ActiveConnections,` 30 `)}}function Mt(n,s){if(n&1&&(t(0,` 31 `),e(1,"code",25),t(2),i(),t(3,` 32 `)),n&2){let a=d().$implicit,r=d();l(),h("title",a.customDimensions==null?null:a.customDimensions.LastCommand),l(),_(` 33 `,r.getSummary(a.customDimensions==null?null:a.customDimensions.LastCommand),` 34 `)}}
34function Ot(n,s){if(n&1&&(t(0,` 35 `),e(1,"tr"),t(2,` 36 `),e(3,"td",19),t(4,` 37 `),e(5,"a",20),t(6),y(7,"date"),i(),t(8,` 38 `),i(),t(9,` 39 `),e(10,"td"),t(11,` 40 `),e(12,"div",21),t(13),i(),t(14,` 41 `),c(15,Dt,4,1),i(),t(16,` 42 `),e(17,"td"),t(18),y(19,"number"),i(),t(20,` 43 `),e(21,"td"),t(22,` 44 `),c(23,Lt,7,1)(24,Mt,4,2),i(),t(25,` 45 `),e(26,"td"),t(27,` 46 `),e(28,"button",22),t(29,` 47 Details 48 `),i(),t(30,` 49 `),i(),t(31,` 50 `),i(),t(32,` 51 `)),n&2){let a=s.$implicit;l(5),h("routerLink",j(14,ft,a.id)),l(),_(` 52 `,w(7,8,a.timestamp,"short"),` 53 `),l(7),u(a.name),l(2),p(a.appRoleInstance?15:-1),l(3),u(w(19,11,a.customMeasurements==null?null:a.customMeasurements.DurationSeconds,"1.2-2")),l(5),p(a.name==="HighConnectionCount"?23:24),l(5),h("routerLink",j(16,ft,a.id)),M("aria-label","View details for event "+a.id)}}function Pt(n,s){n&1&&(t(0,` 54 `),e(1,"tr"),t(2,` 55 `),e(3,"td",26),t(4,"No events found"),i(),t(5,` 56 `),i(),t(6,` 57 `))}function Nt(n,s){if(n&1){let a=S();t(0,` 58 `),e(1,"div",27),t(2,` 59 `),e(3,"button",28),f("click",function(){C(a);let o=d();return g(o.loadEvents(!0))}),t(4,` 60 Load More 61 `),i(),t(5,` 62 `),i(),t(6,` 63 `)}if(n&2){let a=d();l(3),h("disabled",a.loading)}}function Rt(n,s){n&1&&(t(0,` 64 `),e(1,"tr"),t(2,` 65 `),e(3,"th"),t(4,"Timestamp"),i(),t(5,` 66 `),e(6,"th"),t(7,"Metric Name"),i(),t(8,` 67 `),e(9,"th"),t(10,"Value"),i(),t(11,` 68 `),e(12,"th"),t(13,"Event Source"),i(),t(14,` 69 `),i(),t(15,` 70 `))}function $t(n,s){if(n&1&&(t(0,` 71 `),e(1,"tr"),t(2,` 72 `),e(3,"td"),t(4),y(5,"date"),i(),t(6,` 73 `),e(7,"td"),t(8),i(),t(9,` 74 `),e(10,"td"),t(11),i(),t(12,` 75 `),e(13,"td"),t(14),i(),t(15,` 76 `),i(),t(16,` 77 `)),n&2){let a=s.$implicit;l(4),u(w(5,4,a.timestamp,"medium")),l(4),u(a.metricName),l(3),u(a.value),l(3),u(a.eventSource)}}function Vt(n,s){n&1&&(t(0,` 78 `),e(1,"tr"),t(2,` 79 `),e(3,"td",29),t(4,"No metrics found"),i(),t(5,` 80 `),i(),t(6,` 81 `))}function Bt(n,s){if(n&1){let a=S();t(0,` 82 `),e(1,"div",27),t(2,` 83 `),e(3,"button",28),f("click",function(){C(a);let o=d();return g(o.loadMetrics(!0))}),t(4,` 84 Load More 85 `),i(),t(5,` 86 `),i(),t(6,` 87 `)}if(n&2){let a=d();l(3),h("disabled",a.loading)}}var Ct=(()=>{let s=class s{constructor(r,o){this.appInsightsService=r,this.siteDataService=o,this.unsubscribe$=new A,this.customEvents=[],this.customMetrics=[],this.limit=100,this.loading=!1,this.eventsCursor=null,this.metricsCursor=null,this.hasMoreEvents=!0,this.hasMoreMetrics=!0,this.activeTabIndex=0,this.eventTypesOptions=[{label:"High Connection Count",value:E.HighConnectionCount},{label:"Slow Database Connection",value:E.SlowDatabaseConnection},{label:"Extremely Long Connection",value:E.ExtremelyLongConnection}
87,{label:"Connection Pool Leak",value:E.ConnectionPoolLeak}],this.selectedEventTypes=[E.HighConnectionCount,E.SlowDatabaseConnection,E.ExtremelyLongConnection,E.ConnectionPoolLeak]}ngOnInit(){this.loadEvents()}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}onTabChange(r){this.activeTabIndex=typeof r=="number"?r:Number(r??0),this.activeTabIndex===0&&this.customEvents.length===0?this.loadEvents():this.activeTabIndex===1&&this.customMetrics.length===0&&this.loadMetrics()}refresh(){this.activeTabIndex===0?this.loadEvents():this.loadMetrics()}loadEvents(r=!1){this.loading||(this.selectedEventTypes.length===0&&(this.selectedEventTypes=this.eventTypesOptions.map(o=>o.value)),this.loading=!0,r||(this.customEvents=[],this.eventsCursor=null,this.hasMoreEvents=!0),this.appInsightsService.getCustomEvents(this.limit,this.eventsCursor,this.selectedEventTypes).pipe(T(this.unsubscribe$),V(()=>{this.loading=!1,this.siteDataService.hideSiteLoader()})).subscribe({next:o=>{o.length<this.limit&&(this.hasMoreEvents=!1),o.length>0&&(this.customEvents=[...this.customEvents,...o],this.eventsCursor=new Date(o[o.length-1].timestamp))},error:o=>console.error("Error loading events:",o)}))}loadMetrics(r=!1){this.loading||(this.loading=!0,r||(this.customMetrics=[],this.metricsCursor=null,this.hasMoreMetrics=!0),this.appInsightsService.getCustomMetrics(this.limit,this.metricsCursor).pipe(T(this.unsubscribe$),V(()=>{this.loading=!1,this.siteDataService.hideSiteLoader()})).subscribe({next:o=>{o.length<this.limit&&(this.hasMoreMetrics=!1),o.length>0&&(this.customMetrics=[...this.customMetrics,...o],this.metricsCursor=new Date(o[o.length-1].timestamp))},error:o=>console.error("Error loading metrics:",o)}))}formatSql(r){return r?r.replace(/\s+(SELECT|FROM|WHERE|ORDER BY|GROUP BY|HAVING|LEFT JOIN|INNER JOIN|RIGHT JOIN|OUTER JOIN|JOIN)\s+/gi,` 88$1 `).trim():""}getSummary(r,o=160){if(!r)return"";let m=r.replace(/\s+/g," ").trim();return m.length>o?`${m.substring(0,o)}\u2026`:m}};s.\u0275fac=function(o){return new(o||s)(b(R),b(O))},s.\u0275cmp=D({type:s,selectors:[["app-app-insights-list"]],standalone:!1,decls:56,vars:14,consts:[["role","main",3,"keydown.enter"],[3,"pageTitle"],[1,"row","mb-3"],[3,"valueChange","value"],[3,"value"],[1,"table-responsive"],[1,"table","table-striped","table-sm",3,"value","loading"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"col-12"],["placeholder","All Event Types","selectedItemsLabel","{0} items selected",1,"mr-2",3,"ngModelChange","options","ngModel","maxSelectedLabels"],[1,"btn","btn-primary",3,"click","disabled"],[1,"fa","fa-refresh"],[1,"col-12","text-right"],[2,"width","140px"],[2,"width","220px"],[2,"width","90px"],[2,"width","110px"],[1,"text-nowrap"],[1,"text-primary","text-decoration-none",3,"routerLink"],[1,"font-weight-bold"],["type","button",1,"btn","btn-sm",3,"routerLink"],[1,"text-smallest","text-muted"],[1,"text-small"],[1,"text-small","text-muted","d-inline-block","text-truncate",2,"max-width","100%",3,"title"],["colspan","5",1,"text-center"],[1,"text-center","mt-3"],[1,"btn","btn-secondary",3,"click","disabled"],["colspan","4",1,"text-center"]],template:function(o,m){o&1&&(e(0,"main",0),f("keydown.enter",function(){return m.refresh()}),t(1,` 89 `),x(2,"app-admin-header",1),t(3,` 90 91 `),e(4,"div",2),t(5,` 92 `),c(6,Tt,12,9),c(7,At,9,3),i(),t(8,` 93 94 `),e(9,"p-tabs",3),f("valueChange",function($){return m.onTabChange($)}),t(10,` 95 `),e(11,"p-tablist"),t(12,` 96 `),e(13,"p-tab",4),t(14,"Custom Events"),i(),t(15,` 97 `),e(16,"p-tab",4),t(17,"Custom Metrics"),i(),t(18,` 98 `),i(),t(19,` 99 `),e(20,"p-tabpanels"),t(21,` 100 `),e(22,"p-tabpanel",4),t(23,` 101 `),e(24,"div",5),t(25,` 102 `),e(26,"p-table",6),t(27,` 103 `),I(28,kt,19,0,"ng-template",7),t(29,` 104 `),I(30,Ot,33,18,"ng-template",8),t(31,` 105 `),I(32,Pt,7,0,"ng-template",9),t(33,` 106 `),i(),t(34,` 107 `),i(),t(35,` 108 `),c(36,Nt,7,1),i(),t(37,` 109 `),e(38,"p-tabpanel",4),t(39,` 110 `),e(40,"div",5),t(41,` 111 `),e(42,"p-table",6),t(43,` 112 `),I(44,Rt,16,0,"ng-template",7),t(45,` 113 `),I(46,$t,17,7,"ng-template",8),t(47,` 114 `),I(48,Vt,7,0,"ng-template",9),t(49,` 115 `),i(),t(50,` 116 `),i(),t(51,` 117 `),c(52,Bt,7,1),i(),t(53,` 118 `),i(),t(54,` 119 `),i(),t(55,` 120`),i()),o&2&&(l(2),h("pageTitle","App Insights"),l(4),p(m.activeTabIndex===0?6:-1),l(),p(m.activeTabIndex===1?7:-1),l(2),h("value",m.activeTabIndex),l(4),h("value",0),l(3),h("value",1),l(6),h("value",0),l(4),h("value",m.customEvents)("loading",m.loading),l(10),p(m.hasMoreEvents&&m.customEvents.length>0?36:-1),l(2),h("value",1),l(4),h("value",m.customMetrics)("loading",m.loading),l(10),p(m.hasMoreMetrics&&m.customMetrics.length>0?52:-1))},dependencies:[tt,et,at,ot,P,mt,st,ct,ht,ut,pt,xt,Z,K],styles:[".sql-tooltip{max-width:80vw!important;width:fit-content;white-space:pre-wrap!important;word-break:break-word!important} .sql-tooltip .p-tooltip-text{font-family:monospace;font-size:12px;background-color:var(--blue-75);color:var(--grey-900);padding:10px;border-radius:4px;box-shadow:0 3px 6px #00000029,0 3px 6px #0000003b}"]});let n=s;return n})();var gt=(n,s)=>s.key;function Ut(n,s){n&1&&(t(0,` 121 `),e(1,"div",2),t(2,` 122 `),e(3,"div",3),t(4,` 123 `),e(5,"span",4),t(6,"Loading event details..."),i(),t(7,` 124 `),i(),t(8,` 125 `),e(9,"p",5),t(10,"Loading event details..."),i(),t(11,` 126 `),i(),t(12,` 127 `))}
127function Ft(n,s){if(n&1&&(t(0,` 128 `),e(1,"div",6),t(2,` 129 `),e(3,"app-inline-alert",7),t(4),i(),t(5,` 130 `),i(),t(6,` 131 `)),n&2){let a=d();l(4),_(` 132 `,a.error,` 133 `)}}function jt(n,s){if(n&1&&(t(0,` 134 `),e(1,"span",30),t(2),i(),t(3,` 135 `)),n&2){let a=d(3);l(2),_("(",a.event.appRoleInstance,")")}}function Ht(n,s){if(n&1&&(t(0,` 136 `),e(1,"div",14),t(2,` 137 `),e(3,"strong"),t(4,"Source"),i(),t(5),c(6,jt,4,1),i(),t(7,` 138 `)),n&2){let a=d(2);l(5),_(`: 139 `,a.event.appRoleName,` 140 `),l(),p(a.event.appRoleInstance?6:-1)}}function Jt(n,s){if(n&1&&(t(0,` 141 `),e(1,"div",32),t(2),i(),t(3,` 142 `)),n&2){let a=d(3);l(2),u(a.event.operationName)}}function Wt(n,s){if(n&1&&(t(0,` 143 `),x(1,"hr"),t(2,` 144 `),e(3,"div",20),t(4,` 145 `),e(5,"span",21),t(6,"Operation Id"),i(),t(7,` 146 `),e(8,"div",22),t(9,` 147 `),x(10,"i",31),t(11,` 148 `),e(12,"code",24),t(13),i(),t(14,` 149 `),i(),t(15,` 150 `),c(16,Jt,4,1),i(),t(17,` 151 `)),n&2){let a=d(2);l(13),u(a.event.operationId),l(3),p(a.event.operationName?16:-1)}}function qt(n,s){if(n&1&&(t(0,` 152 `),x(1,"hr"),t(2,` 153 `),e(3,"div",20),t(4,` 154 `),e(5,"span",21),t(6,"Session Id"),i(),t(7,` 155 `),e(8,"div",22),t(9,` 156 `),x(10,"i",33),t(11,` 157 `),e(12,"code",24),t(13),i(),t(14,` 158 `),i(),t(15,` 159 `),i(),t(16,` 160 `)),n&2){let a=d(2);l(13),u(a.event.sessionId)}}function zt(n,s){if(n&1&&(t(0,` 161 `),x(1,"hr"),t(2,` 162 `),e(3,"div",34),t(4,` 163 `),e(5,"span",21),t(6,"User Id"),i(),t(7,` 164 `),e(8,"div",22),t(9,` 165 `),x(10,"i",35),t(11,` 166 `),e(12,"code",24),t(13),i(),t(14,` 167 `),i(),t(15,` 168 `),i(),t(16,` 169 `)),n&2){let a=d(2);l(13),u(a.event.userId)}}function Gt(n,s){if(n&1&&(t(0,` 170 `),e(1,"div",36),t(2,` 171 `),x(3,"i",37),t(4,` 172 `),e(5,"code"),t(6),i(),t(7,` 173 `),i(),t(8,` 174 `)),n&2){let a=d(3);l(6),u(a.event.clientIP)}}function Yt(n,s){if(n&1&&(t(0,` 175 `),e(1,"div",36),t(2,` 176 `),x(3,"i",38),t(4),i(),t(5,` 177 `)),n&2){let a=d(3);l(4),_(` 178 `,a.event.clientType,` 179 `)}}function Qt(n,s){if(n&1&&(t(0,` 180 `),e(1,"div",36),t(2,` 181 `),x(3,"i",39),t(4),i(),t(5,` 182 `)),n&2){let a=d(3);l(4),_(` 183 `,a.event.clientBrowser,` 184 `)}}function Xt(n,s){if(n&1&&(t(0,` 185 `),e(1,"div",36),t(2,` 186 `),x(3,"i",40),t(4),i(),t(5,` 187 `)),n&2){let a=d(3);l(4),_(` 188 `,a.event.clientOS,` 189 `)}}function Kt(n,s){n&1&&(e(0,"span"),t(1,", "),i())}function Zt(n,s){if(n&1&&(t(0,` 190 `),e(1,"div",34),t(2,` 191 `),x(3,"i",41),t(4),c(5,Kt,2,0,"span"),t(6),i(),t(7,` 192 `)),n&2){let a=d(3);l(4),_(` 193 `,a.event.clientCity),l(),p(a.event.clientCity&&a.event.clientCountryOrRegion?5:-1),l(),_("",a.event.clientCountryOrRegion,` 194 `)}}
194function te(n,s){if(n&1&&(t(0,` 195 `),e(1,"div",18),t(2,` 196 `),e(3,"div",19),t(4,"Client"),i(),t(5,` 197 `),x(6,"hr"),t(7,` 198 `),c(8,Gt,9,1),c(9,Yt,6,1),c(10,Qt,6,1),c(11,Xt,6,1),c(12,Zt,8,3),i(),t(13,` 199 `)),n&2){let a=d(2);l(8),p(a.event.clientIP?8:-1),l(),p(a.event.clientType?9:-1),l(),p(a.event.clientBrowser?10:-1),l(),p(a.event.clientOS?11:-1),l(),p(a.event.clientCity||a.event.clientCountryOrRegion?12:-1)}}function ee(n,s){if(n&1&&(t(0,` 200 `),e(1,"tr"),t(2,` 201 `),e(3,"td",43),t(4),i(),t(5,` 202 `),e(6,"td",44),t(7),i(),t(8,` 203 `),i(),t(9,` 204 `)),n&2){let a=s.$implicit;l(4),u(a.key),l(3),u(a.value)}}function ie(n,s){if(n&1&&(t(0,` 205 `),e(1,"div",18),t(2,` 206 `),e(3,"div",19),t(4,"Measurements"),i(),t(5,` 207 `),x(6,"hr"),t(7,` 208 `),e(8,"table",42),t(9,` 209 `),e(10,"tbody"),t(11,` 210 `),B(12,ee,10,2,null,null,gt),i(),t(14,` 211 `),i(),t(15,` 212 `),i(),t(16,` 213 `)),n&2){let a=d(2);l(12),U(a.measurementEntries)}}function ne(n,s){if(n&1){let a=S();t(0,` 214 `),e(1,"div",18),t(2,` 215 `),e(3,"div",26),t(4,` 216 `),e(5,"div",27),t(6,"Last SQL Command"),i(),t(7,` 217 `),e(8,"button",45),f("click",function(){C(a);let o=d(2);return g(o.copyValue(o.lastCommand))}),t(9,` 218 `),x(10,"i",46),t(11,`Copy 219 `),i(),t(12,` 220 `),i(),t(13,` 221 `),x(14,"hr"),t(15,` 222 `),e(16,"div",47),t(17,` 223 `),e(18,"pre",48),t(19),i(),t(20,` 224 `),i(),t(21,` 225 `),i(),t(22,` 226 `)}if(n&2){let a=d(2);l(19),u(a.formatSql(a.lastCommand))}}function ae(n,s){n&1&&(t(0,` 227 `),e(1,"app-inline-alert",49),t(2,` 228 No custom dimensions reported for this event. 229 `),i(),t(3,` 230 `)),n&2&&(l(),h("isInline",!0))}function oe(n,s){if(n&1&&(t(0,` 231 `),e(1,"pre",58),t(2),i(),t(3,` 232 `)),n&2){let a=d().$implicit;l(2),u(a.value)}}function re(n,s){if(n&1&&(t(0,` 233 `),e(1,"span",59),t(2),i(),t(3,` 234 `)),n&2){let a=d().$implicit;l(2),u(a.value)}}function le(n,s){if(n&1){let a=S();t(0,` 235 `),e(1,"tr"),t(2,` 236 `),e(3,"td",53),t(4),i(),t(5,` 237 `),e(6,"td",54),t(7,` 238 `),c(8,oe,4,1)(9,re,4,1),i(),t(10,` 239 `),e(11,"td",55),t(12,` 240 `),e(13,"button",56),f("click",function(){let o=C(a).$implicit,m=d(3);return g(m.copyValue(o.value))}),t(14,` 241 `),x(15,"i",57),t(16,` 242 `),i(),t(17,` 243 `),i(),t(18,` 244 `),i(),t(19,` 245 `)}if(n&2){let a=s.$implicit;l(4),u(a.key),l(4),p(a.isLong?8:9),l(5),M("aria-label","Copy value of "+a.key)}}function se(n,s){if(n&1&&(t(0,` 246 `),e(1,"table",50),t(2,` 247 `),e(3,"thead"),t(4,` 248 `),e(5,"tr"),t(6,` 249 `),e(7,"th",51),t(8,"Key"),i(),t(9,` 250 `),e(10,"th"),t(11,"Value"),i(),t(12,` 251 `),x(13,"th",52),t(14,` 252 `),i(),t(15,` 253 `),i(),t(16,` 254 `),e(17,"tbody"),t(18,` 255 `),B(19,le,20,3,null,null,gt),i(),t(21,` 256 `),i(),t(22,` 257 `)),n&2){let a=d(2);l(19),U(a.dimensionEntries)}}
257function me(n,s){if(n&1){let a=S();t(0,` 258 `),e(1,"div"),t(2,` 259 `),t(3,` 260 `),e(4,"div",8),t(5,` 261 `),e(6,"span",9),t(7,` 262 `),e(8,"span",10),t(9,` 263 `),x(10,"i",11),t(11,` 264 `),i(),t(12,` 265 `),i(),t(13,` 266 `),e(14,"span",12),t(15,` 267 `),e(16,"h2",13),t(17),i(),t(18,` 268 `),e(19,"div",14),t(20,` 269 `),e(21,"strong"),t(22,"Timestamp"),i(),t(23),y(24,"utcDate"),e(25,"span",15),t(26),y(27,"utcDate"),i(),t(28,` 270 `),i(),t(29,` 271 `),c(30,Ht,8,2),i(),t(31,` 272 `),i(),t(32,` 273 `),x(33,"hr"),t(34,` 274 275 `),e(35,"div",16),t(36,` 276 `),t(37,` 277 `),e(38,"div",17),t(39,` 278 `),t(40,` 279 `),e(41,"div",18),t(42,` 280 `),e(43,"div",19),t(44,"Identifiers"),i(),t(45,` 281 `),x(46,"hr"),t(47,` 282 `),e(48,"div",20),t(49,` 283 `),e(50,"span",21),t(51,"Event Id"),i(),t(52,` 284 `),e(53,"div",22),t(54,` 285 `),x(55,"i",23),t(56,` 286 `),e(57,"code",24),t(58),i(),t(59,` 287 `),i(),t(60,` 288 `),i(),t(61,` 289 `),c(62,Wt,18,2),c(63,qt,17,1),c(64,zt,17,1),i(),t(65,` 290 291 `),t(66,` 292 `),c(67,te,14,5),c(68,ie,17,0),i(),t(69,` 293 294 `),t(70,` 295 `),e(71,"div",25),t(72,` 296 `),t(73,` 297 `),c(74,ne,23,1),e(75,"div",18),t(76,` 298 `),e(77,"div",26),t(78,` 299 `),e(79,"div",27),t(80,"Custom Dimensions"),i(),t(81,` 300 `),e(82,"button",28),f("click",function(){C(a);let o=d();return g(o.copyAiPayload())}),t(83,` 301 `),x(84,"i",29),t(85,`Copy for AI 302 `),i(),t(86,` 303 `),i(),t(87,` 304 `),x(88,"hr"),t(89,` 305 `),c(90,ae,4,1)(91,se,23,0),i(),t(92,` 306 `),i(),t(93,` 307 `),i(),t(94,` 308 `),i(),t(95,` 309 `)}if(n&2){let a=d();l(17),u(a.event.name),l(6),_(`: 310 `,w(24,12,a.event.timestamp,"EEEE, MMMM d, y"),` 311 `),l(3),u(w(27,15,a.event.timestamp,"h:mm:ss a")),l(4),p(a.event.appRoleInstance||a.event.appRoleName?30:-1),l(28),u(a.event.id),l(4),p(a.event.operationId?62:-1),l(),p(a.event.sessionId?63:-1),l(),p(a.event.userId?64:-1),l(3),p(a.event.clientIP||a.event.clientType||a.event.clientBrowser||a.event.clientOS||a.event.clientCity||a.event.clientCountryOrRegion?67:-1),l(),p(a.measurementEntries.length>0?68:-1),l(6),p(a.lastCommand?74:-1),l(16),p(a.dimensionEntries.length===0?90:91)}}var Et=(()=>{let s=class s{constructor(r,o,m,v){this.route=r,this.router=o,this.appInsightsService=m,this.siteDataService=v,this.unsubscribe$=new A,this.event=null,this.loading=!1,this.error="",this.dimensionEntries=[],this.measurementEntries=[]}ngOnInit(){this.route.params.pipe(T(this.unsubscribe$)).subscribe({next:r=>{let o=r.id;o?this.loadEvent(o):(this.error="Invalid event id",this.siteDataService.hideSiteLoader())},error:()=>{this.error="Unable to load route parameters",this.siteDataService.hideSiteLoader()}})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}loadEvent(r){this.loading=!0,this.error="",this.appInsightsService.getCustomEventById(r).pipe(T(this.unsubscribe$)).subscribe({next:o=>{this.event=o,this.dimensionEntries=this.toEntries(o?.customDimensions),this.measurementEntries=this.toEntries(o?.customMeasurements),this.loading=!1,this.siteDataService.hideSiteLoader()},error:o=>{console.error("Error loading custom event:",o),this.error=o?.status===404?"Custom event not found. It may have aged out of the App Insights retention window.":"Failed to load event details. Please try again.",this.loading=!1,this.siteDataService.hide
311SiteLoader()}})}toEntries(r){return!r||typeof r!="object"?[]:Object.keys(r).sort((o,m)=>o.localeCompare(m)).map(o=>{let m=r[o],v=m==null?"":typeof m=="object"?JSON.stringify(m,null,2):String(m);return{key:o,value:v,isLong:v.length>120||v.includes(` 312`)}})}formatSql(r){return r?r.replace(/\s+(SELECT|FROM|WHERE|ORDER BY|GROUP BY|HAVING|LEFT JOIN|INNER JOIN|RIGHT JOIN|OUTER JOIN|JOIN|UNION ALL|UNION|INSERT INTO|UPDATE|SET|VALUES|DECLARE|EXEC|EXECUTE)\s+/gi,` 313$1 `).trim():""}get lastCommand(){return this.event?.customDimensions?.LastCommand||""}buildAiPayload(){if(!this.event)return"";let r=this.event,o=[];if(o.push(`# App Insights Custom Event: ${r.name}`),o.push(""),o.push("## Overview"),o.push(`- Timestamp (UTC): ${r.timestamp}`),o.push(`- Event Id: ${r.id}`),r.operationId&&o.push(`- Operation Id: ${r.operationId}`),r.operationName&&o.push(`- Operation Name: ${r.operationName}`),r.appRoleName&&o.push(`- App Role: ${r.appRoleName}`),r.appRoleInstance&&o.push(`- App Role Instance: ${r.appRoleInstance}`),r.sessionId&&o.push(`- Session Id: ${r.sessionId}`),r.userId&&o.push(`- User Id: ${r.userId}`),r.clientIP&&o.push(`- Client IP: ${r.clientIP}`),r.clientType&&o.push(`- Client Type: ${r.clientType}`),r.clientBrowser&&o.push(`- Client Browser: ${r.clientBrowser}`),r.clientOS&&o.push(`- Client OS: ${r.clientOS}`),(r.clientCity||r.clientCountryOrRegion)&&o.push(`- Client Location: ${[r.clientCity,r.clientCountryOrRegion].filter(Boolean).join(", ")}`),this.measurementEntries.length>0){o.push(""),o.push("## Measurements");for(let m of this.measurementEntries)o.push(`- ${m.key}: ${m.value}`)}if(this.dimensionEntries.length>0){o.push(""),o.push("## Custom Dimensions");for(let m of this.dimensionEntries)m.key!=="LastCommand"&&o.push(`- ${m.key}: ${m.value}`)}return this.lastCommand&&(o.push(""),o.push("## Last SQL Command"),o.push("```sql"),o.push(this.formatSql(this.lastCommand)),o.push("```")),o.push(""),o.push("## Ask"),o.push("Please investigate this telemetry event. Identify likely root causes, flag any anti-patterns (long-running queries, missing indexes, connection leaks, unbounded result sets, N+1, etc.), and suggest concrete remediations."),o.join(` 314`)}copyAiPayload(){let r=this.buildAiPayload();r&&navigator.clipboard.writeText(r).then(()=>this.siteDataService.showSiteSuccessAlert?.("Copied AI investigation payload to clipboard."),()=>this.siteDataService.showSiteErrorAlert?.("Unable to copy to clipboard."))}copyValue(r){r&&navigator.clipboard.writeText(r).then(()=>this.siteDataService.showSiteSuccessAlert?.("Copied to clipboard."),()=>this.siteDataService.showSiteErrorAlert?.("Unable to copy to clipboard."))}goBack(){this.router.navigate(["/admin/app-insights"])}};s.\u0275fac=function(o){return new(o||s)(b(it),b(nt),b(R),b(O))},s.\u0275cmp=D({type:s,selectors:[["app-app-insights-event-detail"]],standalone:!1,decls:10,vars:7,consts:[["role","main"],["parentLinkUrl","../../",3,"primaryBtnAction","pageTitle","showBackButton","primaryBtnText","primaryBtnIcon"],[1,"text-center","py-5"],["role","status",1,"spinner-border","text-primary"],[1,"sr-only"],[1,"mt-2","text-muted"],[1,"mb-3"],["alertType","error"],[1,"row","d-flex","align-items-center","justify-content-between","mb-3"],[1,"col-auto"],[1,"large-circle","user-initials","user4"],[1,"fa-regular","fa-chart-line"],[1,"col"],[1,"mb-0"],[1,"text-small"],[1,"time-part"],[1,"row"],[1,"col-12","col-md-4"],[1,"card","edit-card","mb-4"],[1,"text-h3"],[1,"info-item","mb-3"],[1,"d-inline-block","text-h5"],[1,"info-value","url-container"],["aria-hidden","true",1,"fa-regular","fa-fingerprint","me-2"],[1,"url-text","text-break"],[1,"col-12","col-md-8"],[1,"d-flex","justify-content-between","align-items-center"],[1,"text-h3","mb-0"],["type","button","aria-label","Copy full AI investigation payload",1,"btn","btn-sm",3,"click"],[1,"fa-regular","fa-robot","mr-1"],[1,"text-muted"],["aria-hidden","true",1,"fa-regular","fa-link","me-2"],[1,"text-smallest","text-muted","mt-1"],["aria-hidden","true",1,"fa-regular","fa-clock","me-2"],[1,"info-item"],["aria-hidden","true",1,"fa-regular","fa-user","me-2"],[1,"info-item","mb-2"],["aria-hidden","true",1,"fa-regular","fa-network-wired","me-2"],["aria-hidden","true",1,"fa-regular","fa-display","me-2"],["aria-hidden","true",1,"fa-regular","fa-window-maximize","me-2"],["aria-hidden","true",1,"fa-regular","fa-computer","me-2"],["aria-hidden","true",1,"fa-regular","fa-location-dot","me-2"],[1,"table","table-sm","mb-0"],[1,"text-h5"],[1,"text-right","font-monospaced"],["type","button","aria-label","Copy SQL to clipboard",1,"btn","btn-sm",3,"click"],[1,"fa-regular","fa-copy","mr-1"],[1,"stack-trace-wrapper"],[1,"stack-trace-container"],[3,"isInline"],[1,"table","table-sm","table-striped"],[2,"width","220px"],[2,"width","60px"],[1,"text-h5","align-top"],[1,"align-top"],[1,"text-right","align-top"],["type","button",1,"btn","btn-sm","btn-naked",3,"click"],[1,"fa-regular","fa-copy"],[1,"dim-pre","font-monospaced"],[1,"font-monospaced","text-break"]],template:function(o,m){o&1&&(e(0,"main",0),t(1,` 315 `),e(2,"app-admin-header",1),f("primaryBtnAction",function(){return m.copyAiPayload()}),t(3,` 316 `),i(),t(4,` 317 318 `),t(5,` 319 `),c(6,Ut,13,0),c(7,Ft,7,1),c(8,me,96,18),i(),t(9,` 320`)),o&2&&(l(2),h("pageTitle","Event Details")("showBackButton",!0)("primaryBtnText","Copy for AI")("primaryBtnIcon","fa-regular fa-robot"),l(4),p(m.loading?6:-1),l(),p(m.error?7:-1),l(),p(m.event&&!m.loading?8:-1))},dependencies:[lt,P,dt],styles:[".dim-pre[_ngcontent-%COMP%]{background:var(--grey-100);border:1px solid var(--border-color);border-radius:var(--border-radius);padding:.75rem 1rem;margin:0;max-height:320px;overflow:auto;white-space:pre-wrap;word-break:break-word;font-size:var(--text-medium)}.stack-trace-wrapper[_ngcontent-%COMP%]{position:relative}.stack-trace-container[_ngcontent-%COMP%]{background:linear-gradient(135deg,var(--grey-900) 0%,var(--grey-800) 100%);border:none;border-radius:var(--border-radius-lg);padding:1.5rem;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:var(--text-medium);line-height:1.6;color:var(--color-white);white-space:pre-wrap;word-break:break-word;max-height:600px;overflow-y:auto;margin:0;box-shadow:inset 0 2px 10px #0000004d}.stack-trace-container[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.stack-trace-container[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#ffffff1a;border-radius:var(--border-radius)}.stack-trace-container[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#ffffff4d;border-radius:var(--border-radius)}.stack-trace-container[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#ffffff80}.url-container[_ngcontent-%COMP%]{background:var(--grey-100);border:1px solid var(--border-color);border-radius:var(--border-radius-lg);padding:.5rem .75rem}.url-container[_ngcontent-%COMP%] .url-text[_ngcontent-%COMP%]{background:transparent;border:none;color:var(--grey-800);font-size:var(--text-medium);word-break:break-all}"]});let n=s;return n})();var de=[{path:"",component:Ct},{path:"events/:id",component:Et}],St=(()=>{let s=class s{};s.\u0275fac=function(o){return new(o||s)},s.\u0275mod=L({type:s}),s.\u0275inj=k({imports:[J.forChild(de),J]});let n=s;return n})();var Ye=(()=>{let s=class s{};s.\u0275fac=function(o){return new(o||s)},s.\u0275mod=L({type:s}),s.\u0275inj=k({imports:[vt,St]});let n=s;return n})();export{Ye as AppInsightsModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.