⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.72
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
usr
/
share
/
grafana
/
public
/
build
/
View File Name :
6934.fa19d392db34411fb300.js
"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[6934],{6191:(at,he,v)=>{v.d(he,{X:()=>o});var Y=v(32196),q=v(96540),ue=v(40845);const o=({children:ae})=>{const be=(0,ue.of)(ze);return q.createElement("div",{className:be.root},ae)},ze=ae=>({root:(0,Y.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:ae.spacing(3),minHeight:ae.spacing(4)})})},22354:(at,he,v)=>{v.d(he,{W:()=>Ae});var Y=v(32196),q=v(96540),ue=v(40845),o=v(88323),ze=v(4603),ae=Object.defineProperty,be=Object.defineProperties,re=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,H=(T,C,R)=>C in T?ae(T,C,{enumerable:!0,configurable:!0,writable:!0,value:R}):T[C]=R,Ge=(T,C)=>{for(var R in C||(C={}))W.call(C,R)&&H(T,R,C[R]);if(ie)for(var R of ie(C))Ee.call(C,R)&&H(T,R,C[R]);return T},z=(T,C)=>be(T,re(C)),ve=(T,C)=>{var R={};for(var F in T)W.call(T,F)&&C.indexOf(F)<0&&(R[F]=T[F]);if(T!=null&&ie)for(var F of ie(T))C.indexOf(F)<0&&Ee.call(T,F)&&(R[F]=T[F]);return R};function Ae(T){var C=T,{label:R}=C,F=ve(C,["label"]);const me=(0,ue.of)(Te),[pe]=(0,q.useState)(()=>Math.random().toString(16).slice(2)),it={SelectContainer:U,ValueContainer:Q,SingleValue:Q};return q.createElement("div",{className:me.root},R&&q.createElement("label",{className:me.label,htmlFor:pe},R,":","\xA0"),q.createElement(o.l6,z(Ge({openMenuOnFocus:!0,inputId:pe},F),{components:it})))}const U=T=>{const{children:C}=T,R=(0,ue.of)(Te);return q.createElement(ze.K,z(Ge({},T),{className:(0,Y.cx)(T.className,R.container)}),C)},Q=T=>{const{className:C,children:R}=T,F=(0,ue.of)(Te);return q.createElement("div",{className:(0,Y.cx)(C,F.valueContainer)},R)},Te=T=>({root:(0,Y.css)({display:"flex",fontSize:12,alignItems:"center"}),label:(0,Y.css)({color:T.colors.text.secondary,whiteSpace:"nowrap"}),container:(0,Y.css)({background:"none",borderColor:"transparent"}),valueContainer:(0,Y.css)({display:"flex",alignItems:"center",flex:"initial",color:T.colors.text.secondary,fontSize:12})})},76934:(at,he,v)=>{v.r(he),v.d(he,{plugin:()=>Lo});var Y=v(40187),q=v(69129),ue=v(3591),o=v(96540),ze=v(22391),ae=v(68704),be=v(91062),re=v(72574),ie=v(17172),W=v(32264),Ee=v(25994),H=v(42418),Ge=v(17081),z=v(2543),ve=v.n(z),Ae=v(65879);class U{static createISO8601Duration(e,s){const r=["hour","minute","h","m"];return(0,z.includes)(r,s)?`PT${e}${s[0].toUpperCase()}`:`P${e}${s[0].toUpperCase()}`}static createISO8601DurationFromInterval(e){const s=+e.slice(0,e.length-1),r=e[e.length-1];if(e.indexOf("ms")>-1)return U.createISO8601Duration(1,"m");if(e[e.length-1]==="s"){let a=s*60%60;return a<1&&(a=1),U.createISO8601Duration(a,"m")}return U.createISO8601Duration(s,r)}static findClosestTimeGrain(e,s){const r=(0,z.filter)(s,c=>c!=="auto");let a=r[0];const i=Ae.intervalToMs(e);for(let c=0;c
Ae.intervalToMs(r[c])&&(c+1
1?r+"s":r}static createKbnUnitFromISO8601Duration(e){if(e==="auto")return"auto";let s=1;e.substring(0,2)==="PT"&&(s=2);const r=e.substring(s,e.length-1),a=e.substring(e.length-1);return r+U.timeUnitToKbn(+r,a)}static timeUnitToKbn(e,s){return s==="S"?"s":s==="M"?"m":s==="H"?"h":s==="D"?"d":""}}class Q{static parseResponseValues(e,s,r){const a=[];if(!e)return a;for(let i=0;i
i.name.value===s);return a?{primaryAggType:a.primaryAggregationType,supportedAggTypes:a.supportedAggregationTypes||r,supportedTimeGrains:[{label:"Auto",value:"auto"},...Q.parseTimeGrains(a.metricAvailabilities??[])],dimensions:Q.parseDimensions(a.dimensions??[])}:{primaryAggType:"",supportedAggTypes:r,supportedTimeGrains:[],dimensions:[]}}static parseTimeGrains(e){const s=[];return e&&e.forEach(r=>{r.timeGrain&&s.push({label:U.createTimeGrainFromISO8601Duration(r.timeGrain),value:r.timeGrain})}),s}static parseDimensions(e){return e.map(s=>({label:s.localizedValue||s.value,value:s.value}))}static parseSubscriptions(e){const s=[];if(!e)return s;const r="subscriptionId",a="displayName";for(let i=0;i
t.some(s=>s.options?Te(s.options,e):s.value===e),T=(t,e=[])=>{if(e.length===0)return[];const s=e.reduce((r,a)=>(r.add(a),r),new Set);return t.filter(r=>s.has(r.value))},C=t=>({value:t.value,label:t.text}),R=(t,e,s)=>{const r=[...t,e],a=t.map(i=>i.value.toLowerCase()).concat(e.options.map(i=>i.value));return s&&!a.includes(s.toLowerCase())&&r.push({label:s,value:s}),r},F={azureMonitor:"azuremonitor",logAnalytics:"loganalytics",appInsights:"appinsights",resourceGraph:"resourcegraph"};function me(t,e){return typeof t=="string"?e.multi||e.includeAll&&!e.allValue?"'"+t+"'":t:typeof t=="number"?t:(0,z.map)(t,r=>typeof t=="number"?t:"'"+r+"'").join(",")}var pe=v(94701),it=v(34169);const $o={subscriptions:[]};var m=(t=>(t.AzureMonitor="Azure Monitor",t.AzureResourceGraph="Azure Resource Graph",t.AzureTraces="Azure Traces",t.GrafanaTemplateVariableFn="Grafana Template Variable Function",t.LocationsQuery="Azure Regions",t.LogAnalytics="Azure Log Analytics",t.MetricNamesQuery="Azure Metric Names",t.NamespacesQuery="Azure Namespaces",t.ResourceGroupsQuery="Azure Resource Groups",t.ResourceNamesQuery="Azure Resource Names",t.SubscriptionsQuery="Azure Subscriptions",t.WorkspacesQuery="Azure Workspaces",t))(m||{});const Oo={allowedTimeGrainsMs:[],dimensionFilters:[],resources:[]},Uo={resources:[]},Wo={filters:[],resources:[],traceTypes:[]},jo={filters:[]};var K=(t=>(t.Logs="logs",t.Table="table",t.TimeSeries="time_series",t.Trace="trace",t))(K||{});const Xo={filters:[]};var Ne=(t=>(t.Public="AzureCloud",t.China="AzureChinaCloud",t.USGovernment="AzureUSGovernment",t.None="",t))(Ne||{});const Wt=Symbol("Concealed client secret");function Pe(t){return t.jsonData.azureAuthType?t.jsonData.azureAuthType:t.jsonData.tenantId&&t.jsonData.clientId?"clientsecret":W.$.azure.managedIdentityEnabled?"msi":"clientsecret"}function Me(){switch(W.$.azure.cloud){case Ne.Public:case Ne.None:case void 0:return"azuremonitor";case Ne.China:return"chinaazuremonitor";case Ne.USGovernment:return"govazuremonitor";default:throw new Error(`The cloud '${W.$.azure.cloud}' not supported.`)}}function nt(t){switch(t){case"azuremonitor":return"https://portal.azure.com";case"chinaazuremonitor":return"https://portal.azure.cn";case"govazuremonitor":return"https://portal.azure.us";default:throw new Error("The cloud not supported.")}}function ct(t){switch(Pe(t)){case"msi":case"workloadidentity":return Me();case"clientsecret":return t.jsonData.cloudName||Me()}}function jt(t){if(t.secureJsonFields.clientSecret)return Wt;{const e=t.secureJsonData?.clientSecret;return typeof e=="string"&&e.length>0?e:void 0}}function Xt(t){switch(t.authType){case"msi":case"workloadidentity":return!0;case"clientsecret":return!!(t.azureCloud&&t.tenantId&&t.clientId&&t.clientSecret)}}function Bt(t){const e=Pe(t);switch(e){case"msi":case"workloadidentity":return e==="msi"&&W.$.azure.managedIdentityEnabled||e==="workloadidentity"&&W.$.azure.workloadIdentityEnabled?{authType:e}:{authType:"clientsecret",azureCloud:Me()};case"clientsecret":return{authType:"clientsecret",azureCloud:t.jsonData.cloudName||Me(),tenantId:t.jsonData.tenantId,clientId:t.jsonData.clientId,clientSecret:jt(t)}}}function Ht(t,e){switch(e.authType){case"msi":case"workloadidentity":if(e.authType==="msi"&&!W.$.azure.managedIdentityEnabled)throw new Error("Managed Identity authentication is not enabled in Grafana config.");if(e.authType==="workloadidentity"&&!W.$.azure.workloadIdentityEnabled)throw new Error("Workload Identity authentication is not enabled in Grafana config.");return t={...t,jsonData:{...t.jsonData,azureAuthType:e.authType}},t;case"clientsecret":return t={...t,jsonData:{...t.jsonData,azureAuthType:"clientsecret",cloudName:e.azureCloud||Me(),tenantId:e.tenantId,clientId:e.clientId},secureJsonData:{...t.secureJsonData,clientSecret:typeof e.clientSecret=="string"?e.clientSecret:void 0},secureJsonFields:{...t.secureJsonFields,clientSecret:typeof e.clientSecret=="symbol"}},t}}var $=v(88575),D=v(88323),x=v(10354),_=v(55852);const N={components:{configEditor:{authType:{select:"data-testid auth-type"},azureCloud:{input:"data-testid azure-cloud"},tenantID:{input:"data-testid tenant-id"},clientID:{input:"data-testid client-id"},clientSecret:{input:"data-testid client-secret"},loadSubscriptions:{button:"data-testid load-subscriptions"},defaultSubscription:{input:"data-testid default-subscription"}},queryEditor:{header:{select:"data-testid azure-monitor-experimental-header"},resourcePicker:{select:{button:"data-testid resource-picker-select"},search:{input:"data-testid resource-picker-search"},apply:{button:"data-testid resource-picker-apply"},cancel:{button:"data-testid resource-picker-cancel"},advanced:{collapse:"data-testid resource-picker-advanced",subscription:{input:"data-testid resource-picker-subscription"},resourceGroup:{input:"data-testid resource-picker-resource-group"},namespace:{input:"data-testid resource-picker-namespace"},region:{input:"data-testid resource-picker-region"},resource:{input:"data-testid resource-picker-resource"}}},metricsQueryEditor:{container:{input:"data-testid azure-monitor-metrics-query-editor-with-experimental-ui"},metricName:{input:"data-testid metric-name"}},logsQueryEditor:{container:{input:"data-testid azure-monitor-logs-query-editor-with-experimental-ui"},formatSelection:{input:"data-testid format-selection"}},argsQueryEditor:{container:{input:"data-testid azure-monitor-arg-query-editor"},subscriptions:{input:"data-testid azure-monitor-args-subscription"}},tracesQueryEditor:{container:{input:"data-testid azure-monitor-traces-query-editor-with-experimental-ui"},traceTypes:{select:"data-testid azure-monitor-traces-query-editor-trace-types"}}},variableEditor:{queryType:{input:"data-testid query-type"},subscription:{input:"data-testid subscription"},resourceGroup:{input:"data-testid resource-group"},namespace:{input:"data-testid namespace"},resource:{input:"data-testid resource"},region:{input:"data-testid region"}}}},Kt=t=>{const{credentials:e,azureCloudOptions:s,onCredentialsChange:r,disabled:a,managedIdentityEnabled:i,workloadIdentityEnabled:c}=t,n=(0,o.useMemo)(()=>{let f=[{value:"clientsecret",label:"App Registration"}];return i&&f.push({value:"msi",label:"Managed Identity"}),c&&f.push({value:"workloadidentity",label:"Workload Identity"}),f},[i,c]),l=f=>{const p=i?"msi":c?"workloadidentity":"clientsecret",y={...e,authType:f.value||p};r(y)},u=f=>{if(e.authType==="clientsecret"){const p={...e,azureCloud:f.value};r(p)}},d=f=>{if(e.authType==="clientsecret"){const p={...e,tenantId:f.target.value};r(p)}},g=f=>{if(e.authType==="clientsecret"){const p={...e,clientId:f.target.value};r(p)}},b=f=>{if(e.authType==="clientsecret"){const p={...e,clientSecret:f.target.value};r(p)}},h=()=>{if(e.authType==="clientsecret"){const f={...e,clientSecret:""};r(f)}};return o.createElement(be.A,{title:"Authentication"},n.length>1&&o.createElement($.D,{label:"Authentication",description:"Choose the type of authentication to Azure services","data-testid":N.components.configEditor.authType.select,htmlFor:"authentication-type"},o.createElement(D.l6,{className:"width-15",value:n.find(f=>f.value===e.authType),options:n,onChange:l,disabled:a})),e.authType==="clientsecret"&&o.createElement(o.Fragment,null,s&&o.createElement($.D,{label:"Azure Cloud","data-testid":N.components.configEditor.azureCloud.input,htmlFor:"azure-cloud-type",disabled:a},o.createElement(D.l6,{inputId:"azure-cloud-type","aria-label":"Azure Cloud",className:"width-15",value:s.find(f=>f.value===e.azureCloud),options:s,onChange:u})),o.createElement($.D,{label:"Directory (tenant) ID",required:!0,"data-testid":N.components.configEditor.tenantID.input,htmlFor:"tenant-id",invalid:!e.tenantId,error:"Tenant ID is required"},o.createElement(x.p,{"aria-label":"Tenant ID",className:"width-30",placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:e.tenantId||"",onChange:d,disabled:a})),o.createElement($.D,{label:"Application (client) ID",required:!0,"data-testid":N.components.configEditor.clientID.input,htmlFor:"client-id",invalid:!e.clientId,error:"Client ID is required"},o.createElement(x.p,{className:"width-30","aria-label":"Client ID",placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:e.clientId||"",onChange:g,disabled:a})),!a&&(typeof e.clientSecret=="symbol"?o.createElement($.D,{label:"Client Secret",htmlFor:"client-secret",required:!0},o.createElement("div",{className:"width-30",style:{display:"flex",gap:"4px"}},o.createElement(x.p,{"aria-label":"Client Secret",placeholder:"configured",disabled:!0,"data-testid":"client-secret"}),o.createElement(_.$n,{variant:"secondary",type:"button",onClick:h,disabled:a},"Reset"))):o.createElement($.D,{label:"Client Secret","data-testid":N.components.configEditor.clientSecret.input,required:!0,htmlFor:"client-secret",invalid:!e.clientSecret,error:"Client secret is required"},o.createElement(x.p,{className:"width-30","aria-label":"Client Secret",placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:e.clientSecret||"",onChange:b,id:"client-secret",disabled:a})))),t.children)},Ho=null,Jt=t=>{const{credentials:e,disabled:s,options:r,subscriptions:a,getSubscriptions:i,onSubscriptionChange:c,onSubscriptionsChange:n}=t,l=Xt(e),[u,d]=(0,o.useReducer)(h=>h+1,0);(0,o.useEffect)(()=>{if(!i||!l){g([]);return}let h=!1;return i().then(f=>{h||g(f,u)}),()=>{h=!0}},[u]);const g=(h,f=!1)=>{n(h),i&&(f&&!r.subscriptionId&&h.length>0?b(h[0]):r.subscriptionId&&(h.find(y=>y.value===r.subscriptionId)||b(void 0)))},b=h=>c(h?.value);return o.createElement(o.Fragment,null,o.createElement($.D,{label:"Default Subscription","data-testid":N.components.configEditor.defaultSubscription.input,htmlFor:"default-subscription"},o.createElement("div",{className:"width-30",style:{display:"flex",gap:"4px"}},o.createElement(D.l6,{inputId:"default-subscription","aria-label":"Default Subscription",value:r.subscriptionId?a.find(h=>h.value===r.subscriptionId):void 0,options:a,onChange:b,disabled:s}),o.createElement(_.$n,{variant:"secondary",type:"button",onClick:d,disabled:!l||s,"data-testid":N.components.configEditor.loadSubscriptions.button},"Load Subscriptions"))))},Zt=[{value:"azuremonitor",label:"Azure"},{value:"govazuremonitor",label:"Azure US Government"},{value:"chinaazuremonitor",label:"Azure China"}],Yt=t=>{const{updateOptions:e,getSubscriptions:s,options:r}=t,[a,i]=(0,o.useState)([]),c=(0,o.useMemo)(()=>Bt(t.options),[t.options]),n=(d,g)=>{g||i([]),e(b=>Ht({...b,jsonData:{...b.jsonData,subscriptionId:g}},d))},l=d=>i(d),u=d=>e(g=>({...g,jsonData:{...g.jsonData,subscriptionId:d}}));return(0,pe.A)(()=>{(!r.jsonData.authType||!c.authType)&&n(c,r.jsonData.subscriptionId)}),o.createElement(o.Fragment,null,o.createElement(Kt,{managedIdentityEnabled:W.$.azure.managedIdentityEnabled,workloadIdentityEnabled:W.$.azure.workloadIdentityEnabled,credentials:c,azureCloudOptions:Zt,onCredentialsChange:n,disabled:t.options.readOnly},o.createElement(Jt,{subscriptions:a,credentials:c,getSubscriptions:s,disabled:t.options.readOnly,onSubscriptionsChange:l,onSubscriptionChange:u,options:r.jsonData})))},Ko=null;class qt extends o.PureComponent{constructor(e){super(e),this.templateSrv=(0,re.w)(),this.updateOptions=s=>{const r=s(this.props.options);this.props.onOptionsChange(r),this.setState({unsaved:!0})},this.saveOptions=async()=>{this.state.unsaved&&(await(0,ie.AI)().put(`/api/datasources/${this.props.options.id}`,this.props.options).then(s=>{(0,ze.pN)(this.props,"version",s.datasource.version)}),this.setState({unsaved:!1}))},this.getSubscriptions=async()=>{await this.saveOptions();const s="?api-version=2019-03-01";try{const r=await(0,ie.AI)().fetch({url:this.baseURL+s,method:"GET"}).toPromise();return this.setState({error:void 0}),Q.parseSubscriptionsForSelect(r)}catch(r){return(0,ie.NF)(r)&&this.setState({error:{title:"Error requesting subscriptions",description:"Could not request subscriptions from Azure. Check your credentials and try again.",details:r?.data?.message}}),Promise.resolve([])}},this.state={unsaved:!1},this.baseURL=`/api/datasources/${this.props.options.id}/resources/${F.azureMonitor}/subscriptions`}render(){const{options:e,onOptionsChange:s}=this.props,{error:r}=this.state;return o.createElement(o.Fragment,null,o.createElement(ae.I,{dataSourceName:"Azure Monitor",docsLink:"https://grafana.com/docs/grafana/latest/datasources/azure-monitor/",hasRequiredFields:!0}),o.createElement(Ee.c,null),o.createElement(Yt,{options:e,updateOptions:this.updateOptions,getSubscriptions:this.getSubscriptions}),r&&o.createElement(H.F,{severity:"error",title:r.title},o.createElement("p",null,r.description),r.details&&o.createElement("details",{style:{whiteSpace:"pre-wrap"}},r.details)),W.$.secureSocksDSProxyEnabled&&o.createElement(o.Fragment,null,o.createElement(Ee.c,null),o.createElement(be.A,{title:"Additional settings",description:"Additional settings are optional settings that can be configured for more control over your data source. This includes Secure Socks Proxy.",isCollapsible:!0,isInitiallyOpen:e.jsonData.enableSecureSocksProxy!==void 0},o.createElement(Ge.Y,{options:e,onOptionsChange:s}))))}}const Jo=null;var S=v(32196),Qe=v(14110),J=v(68402),Xe=v(32372);function _t(t){return(0,o.isValidElement)(t)?t:ye(t)}function ye(t){if(!t||typeof t!="object")return;if(typeof t.message=="string")return t.message;if(typeof t.data?.error?.message=="string")return t.data.error.message;const e=t.error?.data?.error?.innererror?.innererror?.message||t.error?.data?.error?.innererror?.message||t.error?.data?.error?.message||t.error?.data?.message||t.data?.message||t;if(typeof e=="string")return e;if(e&&e.toString)return e.toString()}function lt(){const[t,e]=(0,o.useState)([]),s=(0,o.useCallback)((a,i)=>{e(c=>{const n=[...c],l=c.findIndex(([u])=>u===a);return l>-1&&n.splice(l,1),i&&n.unshift([a,i]),n})},[]);return[(0,o.useMemo)(()=>{const a=t[0];return a&&_t(a[1])},[t]),s]}var xe=v(71087),ee=v(9e4),te=v(97801);const es=({query:t,onQueryChange:e})=>{const s=(0,o.useCallback)(r=>{e({...t,azureResourceGraph:{...t.azureResourceGraph,query:r}})},[e,t]);return o.createElement(Xe.B,{value:t.azureResourceGraph?.query??"",language:"kusto",height:200,width:"100%",showMiniMap:!1,onBlur:s,onSave:s})};var ts=v(72093),ss=v(81580),oe=v(14186);const ut=18,X=t=>{const{labelWidth:e,inlineField:s,...r}=t;return s?o.createElement(oe.I,{labelWidth:e||ut,...r}):o.createElement(ss.c,{width:e||ut,...r})},rs=({query:t,subscriptions:e,variableOptionGroup:s,onQueryChange:r})=>{const[a,i]=(0,o.useState)(!1),[c,n]=(0,o.useState)([]),l=(0,o.useMemo)(()=>[...e,s],[e,s]);(0,o.useEffect)(()=>{t.subscriptions&&t.subscriptions.length>0?(n(T([...e,...s.options],t.subscriptions)),i(!1)):i(!0)},[t.subscriptions,e,s.options]);const u=d=>{const g=d.filter(b=>b.value==="Select all subscriptions");if(!d||d.length===0)n([]),r({...t,subscriptions:[]}),i(!0);else if(g.length>0){const b=e.map(h=>h.value??"").filter(h=>h!=="Select all subscriptions");r({...t,subscriptions:b})}else{const b=d.map(h=>h.value??"");r({...t,subscriptions:b}),n(T([...e,...s.options],b)),i(!1)}};return o.createElement(X,{label:"Subscriptions","data-testid":N.components.queryEditor.argsQueryEditor.subscriptions.input},o.createElement(o.Fragment,null,o.createElement(D.KF,{isClearable:!0,value:c,inputId:"azure-monitor-subscriptions-field",onChange:u,options:l,width:38}),a?o.createElement(ts.P,null,"At least one subscription must be chosen."):null))},mt="arg-subscriptions";function os(t,e,s){let r=e||[];r.length===0&&s&&(r=[s]),r.length===0&&t.length&&(r=[t[0]]);const a=r.filter(c=>c.includes("$")),i=(0,z.intersection)(r,t).concat(a);return t.length&&r.length>i.length&&(r=i.length>0?i:[t[0]]),r}const pt=({query:t,datasource:e,subscriptionId:s,variableOptionGroup:r,onChange:a,setError:i})=>{const[c,n]=(0,o.useState)([]);return(0,o.useMemo)(()=>{e.getSubscriptions().then(l=>{const u=[{label:"Select all subscriptions",value:"Select all subscriptions",description:"Select all"}],d=l.map(g=>({label:g.text,value:g.value,description:g.value}));n(u.concat(d)),i(mt,void 0),a({...t,subscriptions:os(d.map(g=>g.value),t.subscriptions,t.subscription)})}).catch(l=>i(mt,l))},[e]),o.createElement("span",{"data-testid":N.components.queryEditor.argsQueryEditor.container.input},o.createElement(xe.D,null,o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement(rs,{subscriptions:c,query:t,datasource:e,subscriptionId:s,variableOptionGroup:r,onQueryChange:a,setError:i})))),o.createElement(es,{query:t,datasource:e,subscriptionId:s,variableOptionGroup:r,onQueryChange:a,setError:i}))},dt=({query:t,variableOptionGroup:e,onQueryChange:s,inputId:r,options:a,defaultValue:i,setFormatAs:c,resultFormat:n})=>{const l=(0,o.useMemo)(()=>[...a,e],[e,a]),u=(0,o.useCallback)(d=>{const{value:g}=d;if(!g)return;const b=c(t,g);s(b)},[s,t,c]);return(0,pe.A)(()=>{n?a.find(d=>d.value===n)||u({value:i}):u({value:i})}),o.createElement(X,{label:"Format as","data-testid":N.components.queryEditor.logsQueryEditor.formatSelection.input},o.createElement(D.l6,{inputId:`${r}-format-as-field`,value:n??i,onChange:u,options:l,width:38}))};var Z=v(40845),Be=v(37390),ne=v(14578),He=v(39558),ft=v(82762);const as=({resources:t,onChange:e,renderAdvanced:s})=>{const[r,a]=(0,o.useState)(!!t.length&&JSON.stringify(t).includes("$"));return o.createElement("div",{"data-testid":N.components.queryEditor.resourcePicker.advanced.collapse},o.createElement(ft.S,{collapsible:!0,label:"Advanced",isOpen:r,onToggle:()=>a(!r)},s(t,e),o.createElement(J.$,{v:2})))};var is=v(31511),ns=v(29158),gt=v(10880),I=(t=>(t.Subscription="Subscription",t.ResourceGroup="ResourceGroup",t.Resource="Resource",t.VariableGroup="TemplateVariableGroup",t.Variable="TemplateVariable",t))(I||{});const cs=({isOpen:t,entry:{type:e}})=>{switch(e){case I.Subscription:return o.createElement(ne.I,{name:"layer-group"});case I.ResourceGroup:return o.createElement(ne.I,{name:t?"folder-open":"folder"});case I.Resource:return o.createElement(ne.I,{name:"cube"});case I.VariableGroup:return o.createElement(ne.I,{name:"x"});case I.Variable:return o.createElement(ne.I,{name:"x"});default:return null}},Re=t=>({table:(0,S.css)({width:"100%",tableLayout:"fixed",overflow:"scroll"}),scrollableTable:(0,S.css)({overflow:"auto"}),tableScroller:(0,S.css)({maxHeight:"16vh"}),selectedTableScroller:(0,S.css)({maxHeight:"13vh"}),header:(0,S.css)({background:t.colors.background.secondary}),row:(0,S.css)({borderBottom:`1px solid ${t.colors.border.weak}`,"&:last-of-type":{borderBottomColor:t.colors.border.medium}}),disabledRow:(0,S.css)({opacity:.5}),cell:(0,S.css)({padding:t.spacing(1,1,1,0),width:"25%",overflow:"hidden",textOverflow:"ellipsis","&:first-of-type":{width:"50%",padding:t.spacing(1,1,1,2)}}),collapseButton:(0,S.css)({margin:0}),loadingCell:(0,S.css)({textAlign:"center"}),spinner:(0,S.css)({marginBottom:0}),nestedEntry:(0,S.css)({display:"flex",alignItems:"center"}),entryContentItem:(0,S.css)({margin:t.spacing(0,1,0,0)}),truncated:(0,S.css)({minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),resourceField:(0,S.css)({maxWidth:t.spacing(36),overflow:"hidden"}),resourceFieldButton:(0,S.css)({padding:"7px",textAlign:"left"}),nestedRowCheckbox:(0,S.css)({zIndex:0}),selectionFooter:(0,S.css)({background:t.colors.background.primary,paddingTop:t.spacing(2)}),loadingWrapper:(0,S.css)({textAlign:"center",paddingTop:t.spacing(2),paddingBottom:t.spacing(2),color:t.colors.text.secondary}),resultLimit:(0,S.css)({margin:"4px 0",fontStyle:"italic"}),modal:(0,S.css)({width:t.breakpoints.values.lg})}),ls=({entry:t,isSelected:e,isDisabled:s,isOpen:r,isSelectable:a,level:i,scrollIntoView:c,onToggleCollapse:n,onSelectedChange:l})=>{const u=(0,Z.$j)(),d=(0,Z.of)(Re),g=!!t.children,b=(0,o.useCallback)(()=>{n(t)},[n,t]),h=(0,o.useCallback)(p=>{const y=p.target.checked;l(t,y)},[t,l]),f=`${c?"table":"summary"}_checkbox_${t.uri}`;return(0,o.useEffect)(()=>{e&&c&&document.getElementById(f)?.scrollIntoView({behavior:"smooth",block:"center"})},[]),o.createElement("div",{className:d.nestedEntry,style:{marginLeft:i*(3*u.spacing.gridSize)}},g?o.createElement(ns.K,{className:d.collapseButton,name:r?"angle-down":"angle-right","aria-label":r?`Collapse ${t.name}`:`Expand ${t.name}`,onClick:b,id:t.id}):o.createElement(J.$,{layout:"inline",h:2}),o.createElement(J.$,{layout:"inline",h:2}),a&&o.createElement(o.Fragment,null,o.createElement(gt.S,{id:f,onChange:h,disabled:s,value:e,className:d.nestedRowCheckbox}),o.createElement(J.$,{layout:"inline",h:2})),o.createElement(cs,{entry:t,isOpen:r}),o.createElement(J.$,{layout:"inline",h:1}),o.createElement("label",{htmlFor:f,className:(0,S.cx)(d.entryContentItem,d.truncated)},t.name))};var us=v(1932);class de{static buildResourceUri(e,s,r){const a=[],{subscription:i,resourceGroup:c,metricNamespace:n,resourceName:l}=s;if(i&&(a.push("/subscriptions",i),c&&!r&&(a.push("resourceGroups",c),n&&l))){const u=e.replace(n),d=n.split("/"),g=e.replace(l),b=l.split("/"),h=d.shift();if(h&&a.push("providers",h),u.toLowerCase().startsWith("microsoft.storage/storageaccounts/")&&!g.endsWith("default")&&b.push("default"),b.length>d.length){const f=b.shift();f&&a.push(f)}for(const f in d)a.push(d[f]),a.push(b[f])}return a.join("/")}static buildAzureMonitorGetMetricNamespacesUrl(e,s,r,a,i){let c;if("resourceUri"in r)c=r.resourceUri;else{const{subscription:n,resourceGroup:l,metricNamespace:u,resourceName:d}=r;c=de.buildResourceUri(i,{subscription:n,resourceGroup:l,metricNamespace:u,resourceName:d})}return`${e}${c}/providers/microsoft.insights/metricNamespaces?api-version=${s}${a?"®ion=global":""}`}static buildAzureMonitorGetMetricNamesUrl(e,s,r,a,i,c){let n;const{customNamespace:l,metricNamespace:u}=r;if("resourceUri"in r)n=r.resourceUri;else{const{subscription:g,resourceGroup:b,metricNamespace:h,resourceName:f}=r;n=de.buildResourceUri(a,{subscription:g,resourceGroup:b,metricNamespace:h,resourceName:f},i)}let d=`${e}${n}/providers/microsoft.insights/metricdefinitions?api-version=${s}`;return l&&(d+=`&metricnamespace=${encodeURIComponent(l)}`),i&&!l&&u&&(d+=`&metricnamespace=${encodeURIComponent(u)}`),c&&i&&(d+=`®ion=${c}`),d}}const ms=/\/subscriptions\/(?
[^/]+)(?:\/resourceGroups\/(?
[^/]+)(?:\/providers\/(?
.+))?)?/;function ps(t){if(!t)return{};const e=t.split("/"),s=e.splice(0,2),r=e.splice(0,1);for(;e.length;){const a=e.shift();e.length%2===0?r.push(a):s.push(a)}return{metricNamespace:s.join("/"),resourceName:r.join("/")}}function Ve(t){const s=ms.exec(t)?.groups??{},{subscription:r,resourceGroup:a,metricNamespaceAndResource:i}=s,{metricNamespace:c,resourceName:n}=ps(i);return{subscription:r,resourceGroup:a,metricNamespace:c,resourceName:n}}function fe(t,e){return t.map(s=>j(s,e))}function j(t,e){if(typeof t=="string"){const s=Ve(t);return e&&(s.region=e),s}return t}function Ke(t){return t.map(e=>$e(e))}function $e(t){return t?typeof t=="string"?t:de.buildResourceUri((0,re.w)(),t):""}function ht(t){return!!t.match(/^[A-Z0-9]+/i)}function ds(t,e,s,r){return s?.startsWith("microsoft.storage/storageaccounts")&&(s="microsoft.storage/storageaccounts",r?.endsWith("/default")&&(r=r.slice(0,-8))),t===s&&e===r}function bt(t,e){const s=j(e),r=j(t);return r?.subscription===s?.subscription&&r?.resourceGroup?.toLowerCase()===s?.resourceGroup?.toLowerCase()&&ds(r?.metricNamespace?.toLowerCase(),r?.resourceName,s?.metricNamespace?.toLowerCase(),s?.resourceName)}function fs(t,e){const s=[];return e.forEach(r=>{const a=we(t,r);a&&s.push(a)}),s}function we(t,e){for(const s of t){if(bt(s.uri,e))return s;if(s.children){const r=we(s.children,e);if(r)return r}}}function Je(t,e,s){return(0,us.jM)(t,r=>{const a=we(r,e);a&&(a.children=s)})}function gs(t,e,s){if(e==="logs")return{...t,azureLogAnalytics:{...t.azureLogAnalytics,resources:Ke(s).filter(a=>a!=="")}};if(e==="traces")return{...t,azureTraces:{...t.azureTraces,resources:Ke(s).filter(a=>a!=="")}};const r=s.length?j(s[0]):{};return{...t,subscription:r.subscription,azureMonitor:{...t.azureMonitor,metricNamespace:r.metricNamespace?.toLocaleLowerCase(),region:r.region,resources:fe(s).filter(a=>a.resourceName!==""&&a.metricNamespace!==""&&a.subscription!==""&&a.resourceGroup!==""),metricName:void 0,aggregation:void 0,timeGrain:"",dimensionFilters:[]}}}const vt=({row:t,selectedRows:e,level:s,requestNestedRows:r,onRowSelectedChange:a,selectableEntryTypes:i,scrollIntoView:c,disableRow:n})=>{const l=(0,Z.of)(Re),[u,d]=(0,o.useState)("closed"),g=!!e.find(p=>p.uri.toLowerCase()===t.uri.toLowerCase()),b=!g&&n(t,e),h=u==="open",f=async()=>{if(u==="open"){d("closed");return}d("loading"),r(t).then(()=>d("open")).catch(()=>d("closed"))};return(0,o.useEffect)(()=>{const p=e[0];p&&!!we(t.children??[],p.uri)&&d("open")},[e,t]),o.createElement(o.Fragment,null,o.createElement("tr",{className:(0,S.cx)(l.row,b&&l.disabledRow),key:t.id},o.createElement("td",{className:l.cell},o.createElement(ls,{level:s,isSelected:g,isDisabled:b,isOpen:h,entry:t,onToggleCollapse:f,onSelectedChange:a,isSelectable:i.some(p=>p===t.type),scrollIntoView:c})),o.createElement("td",{className:l.cell},t.typeLabel),o.createElement("td",{className:l.cell},t.location??"-")),h&&t.children&&Object.keys(t.children).length>0&&t.children.map(p=>o.createElement(vt,{key:p.uri,row:p,selectedRows:e,level:s+1,requestNestedRows:r,onRowSelectedChange:a,selectableEntryTypes:i,scrollIntoView:c,disableRow:n})),o.createElement(is.A,{visible:u==="loading"},o.createElement("tr",null,o.createElement("td",{className:(0,S.cx)(l.cell,l.loadingCell),colSpan:3},o.createElement(He._,{text:"Loading...",className:l.spinner})))))},yt=vt,hs=({searchFn:t})=>{const[e,s]=(0,o.useState)(""),r=(0,o.useMemo)(()=>(0,z.debounce)(t,600),[t]);return(0,o.useEffect)(()=>()=>{r.cancel()},[r]),o.createElement(x.p,{"aria-label":"resource search",prefix:o.createElement(ne.I,{name:"search"}),value:e,onChange:a=>{const i=a.currentTarget.value;s(i),r(i)},placeholder:"search for a resource","data-testid":N.components.queryEditor.resourcePicker.search.input})},bs=({resourcePickerData:t,resources:e,onApply:s,onCancel:r,selectableEntryTypes:a,queryType:i,disableRow:c,renderAdvanced:n,selectionNotice:l})=>{const u=(0,Z.of)(Re),[d,g]=(0,o.useState)(!1),[b,h]=(0,o.useState)([]),[f,p]=(0,o.useState)([]),[y,w]=(0,o.useState)(e),[k,E]=(0,o.useState)(void 0),[L,V]=(0,o.useState)(!1),le=l?.(f);(0,o.useEffect)(()=>{w(e)},[e]);const se=(0,o.useCallback)(async()=>{if(!d){try{g(!0);const A=await t.fetchInitialRows(i,fe(y??{}));h(A)}catch(A){E(ye(A))}g(!1)}},[y,d,t,i]);(0,pe.A)(()=>{se()});const De=A=>typeof A=="string"?A!=="":A.subscription&&A.resourceGroup&&A.resourceName&&A.metricNamespace;(0,o.useEffect)(()=>{y||p([]);const A=y.filter(O=>De(O)),P=y&&fs(b,Ke(A));return A?.length>P.length?p(t.parseRows(A)):P&&P.length?p(P):p([])},[y,b,t]);const Le=(0,o.useCallback)(async A=>{if(E(void 0),!A.children?.length)try{const P=await t.fetchAndAppendNestedRow(b,A,i);h(P)}catch(P){throw E(ye(P)),P}},[t,b,i]),je=(0,o.useCallback)((A,P)=>{if(P){const O=i==="logs"?A.uri:fe([A.uri],A.location)[0],Se=y?y.concat(O):[O];w(Se.filter(ge=>De(ge)))}else{const O=y?.filter(Se=>!bt($e(Se),A.uri));w(O)}},[i,y,w]),rt=(0,o.useCallback)(()=>{y&&s(i==="logs"?y:fe(y))},[i,y,s]),ot=(0,o.useCallback)(async A=>{if(E(void 0),V(!1),!A){se();return}try{g(!0);const P=await t.search(A,i);h(P),P.length>=t.resultLimit&&V(!0)}catch(P){E(ye(P))}g(!1)},[se,t,i]);return o.createElement(o.Fragment,null,o.createElement(hs,{searchFn:ot}),L?o.createElement("p",{className:u.resultLimit},"Showing first ",t.resultLimit," results"):o.createElement(J.$,{v:2}),o.createElement("table",{className:u.table},o.createElement("thead",null,o.createElement("tr",{className:(0,S.cx)(u.row,u.header)},o.createElement("td",{className:u.cell},"Scope"),o.createElement("td",{className:u.cell},"Type"),o.createElement("td",{className:u.cell},"Location")))),o.createElement("div",{className:(0,S.cx)(u.scrollableTable,u.tableScroller)},o.createElement("table",{className:u.table},o.createElement("tbody",null,d&&o.createElement("tr",{className:(0,S.cx)(u.row)},o.createElement("td",{className:u.cell},o.createElement(He._,{text:"Loading..."}))),!d&&b.length===0&&o.createElement("tr",{className:(0,S.cx)(u.row)},o.createElement("td",{className:u.cell,"aria-live":"polite"},"No resources found")),!d&&b.map(A=>o.createElement(yt,{key:A.uri,row:A,selectedRows:f,level:0,requestNestedRows:Le,onRowSelectedChange:je,selectableEntryTypes:a,scrollIntoView:!0,disableRow:c}))))),o.createElement("footer",{className:u.selectionFooter},f.length>0&&o.createElement(o.Fragment,null,o.createElement("h5",null,"Selection"),o.createElement("div",{className:(0,S.cx)(u.scrollableTable,u.selectedTableScroller)},o.createElement("table",{className:u.table},o.createElement("tbody",null,f.map(A=>o.createElement(yt,{key:A.uri,row:A,selectedRows:f,level:0,requestNestedRows:Le,onRowSelectedChange:je,selectableEntryTypes:a,disableRow:()=>!1}))))),o.createElement(J.$,{v:2}),le?.length?o.createElement(H.F,{title:"",severity:"info"},le):null),o.createElement(as,{resources:y,onChange:A=>w(A),renderAdvanced:n}),k&&o.createElement(o.Fragment,null,o.createElement(J.$,{v:2}),o.createElement(H.F,{severity:"error",title:"An error occurred while requesting resources from Azure Monitor"},k)),o.createElement(Be.a.ButtonRow,null,o.createElement(_.$n,{onClick:r,variant:"secondary",fill:"outline"},"Cancel"),o.createElement(_.$n,{disabled:!!k||!y.every(De),onClick:rt,"data-testid":N.components.queryEditor.resourcePicker.apply.button},"Apply"))))},vs=({query:t,datasource:e,onQueryChange:s,selectableEntryTypes:r,queryType:a,resources:i,inlineField:c,labelWidth:n,disableRow:l,renderAdvanced:u,selectionNotice:d})=>{const g=(0,Z.of)(Re),[b,h]=(0,o.useState)(!1),f=(0,o.useCallback)(()=>{h(!0)},[]),p=(0,o.useCallback)(()=>{h(!1)},[]),y=(0,o.useCallback)(w=>{s(gs(t,a,w)),p()},[p,s,t,a]);return o.createElement("span",{"data-testid":N.components.queryEditor.resourcePicker.select.button},o.createElement(Be.a,{className:g.modal,title:"Select a resource",isOpen:b,onDismiss:p,trapFocus:!1},o.createElement(bs,{resourcePickerData:e.resourcePickerData,resources:i,onApply:y,onCancel:p,selectableEntryTypes:r,queryType:a,disableRow:l,renderAdvanced:u,selectionNotice:d})),o.createElement(X,{label:"Resource",inlineField:c,labelWidth:n},o.createElement(_.$n,{className:g.resourceFieldButton,variant:"secondary",onClick:f,type:"button"},o.createElement(ys,{resources:i,datasource:e}))))},ys=({resources:t,datasource:e})=>{const[s,r]=(0,o.useState)(fe(t));return(0,o.useEffect)(()=>{r(fe(t))},[t]),t.length?o.createElement(ws,{resources:s}):o.createElement(o.Fragment,null,"Select a resource")},ws=({resources:t})=>{const e=(0,Z.of)(Re);let s="cube";const r=[];return t.forEach(a=>{if(a.resourceName){r.push(a.resourceName.split("/")[0]);return}if(a.resourceGroup){s="folder",r.push(a.resourceGroup);return}if(a.subscription){s="layer-group",r.push(a.subscription);return}}),o.createElement("span",{className:(0,S.cx)(e.truncated,e.resourceField)},o.createElement(ne.I,{name:s}),r.join(", "))},Ze=vs;var Oe=v(3721),wt=v(60029),ks=v(56034);const Ss=t=>({resourceList:(0,S.css)({width:"100%",display:"flex",marginBlock:t.spacing(1)})}),kt=({resources:t,onChange:e})=>{const s=(0,Z.of)(Ss);(0,o.useEffect)(()=>{t.length===0&&e([""])},[t,e]);const r=(c,n)=>{const l=[...t];l[c]=n,e(l)},a=c=>{const n=[...t];n.splice(c,1),e(n)},i=()=>{e(t.concat(""))};return o.createElement(o.Fragment,null,o.createElement(wt.J,null,o.createElement("h6",null,"Resource URI(s)"," ",o.createElement(ks.m,{content:o.createElement(o.Fragment,null,"Manually edit the"," ",o.createElement("a",{href:"https://docs.microsoft.com/en-us/azure/azure-monitor/logs/log-standard-columns#_resourceid",rel:"noopener noreferrer",target:"_blank"},"resource uri"),". Supports the use of multiple template variables (ex: /subscriptions/$subId/resourceGroups/$rg)"),placement:"right",interactive:!0},o.createElement(ne.I,{name:"info-circle"})))),t.map((c,n)=>o.createElement("div",{key:`resource-${n+1}`},o.createElement("div",{className:s.resourceList},o.createElement(x.p,{id:`input-advanced-resource-picker-${n+1}`,value:c,onChange:l=>r(n,l.currentTarget.value),placeholder:"ex: /subscriptions/$subId","data-testid":`input-advanced-resource-picker-${n+1}`}),o.createElement(Oe.Z,{"aria-label":"remove",icon:"times",variant:"secondary",onClick:()=>a(n),"data-testid":"remove-resource",hidden:t.length===1})))),o.createElement(_.$n,{"aria-label":"Add",icon:"plus",variant:"secondary",onClick:i,type:"button"},"Add resource URI"))};function Ye(t,e){return{...t,azureLogAnalytics:{...t.azureLogAnalytics,query:e}}}function zs(t,e){return{...t,azureLogAnalytics:{...t.azureLogAnalytics,resultFormat:e}}}function Es(t,e){return{...t,azureLogAnalytics:{...t.azureLogAnalytics,dashboardTime:e}}}function St(t,e){return{...t,azureLogAnalytics:{...t.azureLogAnalytics,timeColumn:e}}}const As=({query:t,onQueryChange:e,schema:s})=>{const[r,a]=(0,o.useState)();(0,o.useEffect)(()=>{if(!s||!r)return;(async({monaco:l,editor:u},d)=>{try{const g=l.languages,b=u.getModel();b&&await(await(await g.kusto.getKustoWorker())(b?.uri)).setSchema(d)}catch(g){console.error(g)}})(r,s).catch(l=>console.error(l))},[s,r]);const i=(0,o.useCallback)((n,l)=>{a({monaco:l,editor:n})},[]),c=(0,o.useCallback)(n=>{e(Ye(t,n))},[e,t]);return o.createElement(Xe.B,{value:t.azureLogAnalytics?.query??"",language:"kusto",height:200,width:"100%",showMiniMap:!1,onBlur:c,onSave:c,onEditorDidMount:i})};var Ts=v(94354);function Ns({query:t,onQueryChange:e,schema:s}){const[r,a]=(0,o.useState)(),[i,c]=(0,o.useState)(),n=(0,o.useCallback)(u=>e(St(t,u)),[t,e]);(0,o.useEffect)(()=>{if(s&&t.azureLogAnalytics?.dashboardTime){const u=[],d=new Set,g=new Map,b=s.database;if(b)for(const f of b.tables){const p=f.columns.reduce((y,w,k)=>(w.type==="datetime"&&(!f.timespanColumn||f.timespanColumn!==w.name)&&(y.push({value:w.name,label:`${f.name} > ${w.name}`}),d.add(w.name)),y),[]);u.push(...p),f.timespanColumn&&!g.has(f.timespanColumn)&&g.set(f.timespanColumn,{value:f.timespanColumn,label:f.timespanColumn})}c(u);const h=Array.from(g.values());if(a(h),!t.azureLogAnalytics.timeColumn||t.azureLogAnalytics.timeColumn&&!d.has(t.azureLogAnalytics.timeColumn)&&!g.has(t.azureLogAnalytics.timeColumn))if(h&&h.length){n(h[0].value),n(h[0].value);return}else if(u&&u.length){n(u[0].value);return}else{n("TimeGenerated");return}}},[s,t.azureLogAnalytics?.dashboardTime,t.azureLogAnalytics?.timeColumn,n]);const l=(0,o.useCallback)(u=>{if(!u.value)return;const d=St(t,u.value);e(d)},[e,t]);return o.createElement(o.Fragment,null,o.createElement(oe.I,{label:"Time-range",tooltip:o.createElement("span",null,"Specifies the time-range used to query. The ",o.createElement("code",null,"Query")," option will only use time-ranges specified in the query. ",o.createElement("code",null,"Dashboard")," will only use the Grafana time-range.")},o.createElement(Ts.z,{options:[{label:"Query",value:!1},{label:"Dashboard",value:!0}],value:t.azureLogAnalytics?.dashboardTime??!1,size:"md",onChange:u=>e(Es(t,u))})),t.azureLogAnalytics?.dashboardTime&&o.createElement(oe.I,{label:"Time Column",tooltip:o.createElement("span",null,"Specifies the time column used for filtering. Defaults to the first tables ",o.createElement("code",null,"timeSpan")," column, the first ",o.createElement("code",null,"datetime")," column found or ",o.createElement("code",null,"TimeGenerated"),".")},o.createElement(D.l6,{options:[{label:"Default time columns",options:r??[{value:"TimeGenerated",label:"TimeGenerated"}]},{label:"Other time columns",options:i??[]}],onChange:l,value:t.azureLogAnalytics?.timeColumn?t.azureLogAnalytics?.timeColumn:r?r[0]:i?i[0]:{value:"TimeGenerated",label:"TimeGenerated"},allowCustomValue:!0})))}async function Ms(t,e,s){if(e.azureLogAnalytics?.workspace!==void 0&&!e.azureLogAnalytics.resources){const r=ht(e.azureLogAnalytics.workspace);let a;r?a=await t.resourcePickerData.getResourceURIFromWorkspace(e.azureLogAnalytics.workspace):a=e.azureLogAnalytics.workspace;const i={...e,azureLogAnalytics:{...e.azureLogAnalytics,resource:a,workspace:void 0}};delete i.azureLogAnalytics.workspace,s(i)}}function Rs(t,e,s){const[r,a]=(0,o.useState)();return(0,o.useEffect)(()=>{Ms(t,e,s).catch(i=>a({title:"Unable to migrate workspace as a resource",message:i.message}))},[t,e,s]),r}const zt=({query:t,datasource:e,subscriptionId:s,variableOptionGroup:r,onChange:a,setError:i,hideFormatAs:c,timeRange:n,data:l})=>{const u=Rs(e,t,a),d=(f,p)=>{if(p.length===0)return!1;const y=j(f.uri,f.location).metricNamespace?.toLowerCase(),w=j(p[0].uri,p[0].location).metricNamespace?.toLowerCase();return y!==w},[g,b]=(0,o.useState)();(0,o.useEffect)(()=>{t.azureLogAnalytics?.resources&&t.azureLogAnalytics.resources.length&&e.azureLogAnalyticsDatasource.getKustoSchema(t.azureLogAnalytics.resources[0]).then(f=>{b(f)})},[t.azureLogAnalytics?.resources,e.azureLogAnalyticsDatasource]);let h=null;if(l?.series){const f=l.series.find(p=>p.refId===t.refId);f&&f.meta?.custom?.azurePortalLink&&(h=o.createElement(o.Fragment,null,o.createElement(_.z9,{size:"md",target:"_blank",style:{marginTop:"22px"},href:f.meta?.custom?.azurePortalLink},"View query in Azure Portal")))}return o.createElement("span",{"data-testid":N.components.queryEditor.logsQueryEditor.container.input},o.createElement(xe.D,null,o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement(Ze,{query:t,datasource:e,inlineField:!0,labelWidth:10,subscriptionId:s,variableOptionGroup:r,onQueryChange:a,setError:i,selectableEntryTypes:[I.Subscription,I.ResourceGroup,I.Resource,I.Variable],resources:t.azureLogAnalytics?.resources??[],queryType:"logs",disableRow:d,renderAdvanced:(f,p)=>o.createElement(kt,{resources:f,onChange:p}),selectionNotice:()=>"You may only choose items of the same resource type."}),o.createElement(Ns,{query:t,datasource:e,variableOptionGroup:r,onQueryChange:a,setError:i,schema:g}))),o.createElement(As,{query:t,datasource:e,subscriptionId:s,variableOptionGroup:r,onQueryChange:a,setError:i,schema:g}),o.createElement(ee.U,null,o.createElement(te.B,null,!c&&o.createElement(dt,{query:t,datasource:e,subscriptionId:s,variableOptionGroup:r,onQueryChange:a,setError:i,inputId:"azure-monitor-logs",options:[{label:"Log",value:K.Logs},{label:"Time series",value:K.TimeSeries},{label:"Table",value:K.Table}],defaultValue:K.Logs,setFormatAs:zs,resultFormat:t.azureLogAnalytics?.resultFormat}),h,u&&o.createElement(H.F,{title:u.title},u.message)))))};var Et=v(40276),qe=v(10860),Cs=v(28848),Is=v.n(Cs);function Ds({query:t,lang:e,className:s}){const r=(0,Z.$j)(),a=Ls(r),i=Is().highlight(t,e.grammar,e.name);return o.createElement("div",{className:(0,S.cx)(a.editorField,"prism-syntax-highlight",s),"aria-label":"selector",dangerouslySetInnerHTML:{__html:i}})}const Ls=t=>({editorField:(0,S.css)({fontFamily:t.typography.fontFamilyMonospace,fontSize:t.typography.bodySmall.fontSize})}),Fs=[{label:"fields",documentation:"Retrieves the specified fields from log events"},{label:"display",documentation:"Specifies which fields to display in the query results"},{label:"filter",documentation:"Filters the results of a query based on one or more conditions"},{label:"stats",documentation:"Calculates aggregate statistics based on the values of log fields"},{label:"sort",documentation:"Sorts the retrieved log events"},{label:"limit",documentation:"Specifies the number of log events returned by the query"},{label:"parse",documentation:"Extracts data from a log field, creating one or more ephemeral fields that you can process further in the query"}],na=null,ca=null,Gs=[{label:"abs",detail:"abs(a)",documentation:"Absolute value."},{label:"ceil",detail:"ceil(a)",documentation:"Round to ceiling (the smallest integer that is greater than the value of a)."},{label:"floor",detail:"floor(a)",documentation:"Round to floor (the largest integer that is smaller than the value of a)."},{label:"greatest",detail:"greatest(a,b, ... z)",documentation:"Returns the largest value."},{label:"least",detail:"least(a, b, ... z)",documentation:"Returns the smallest value."},{label:"log",detail:"log(a)",documentation:"Natural logarithm."},{label:"sqrt",detail:"sqrt(a)",documentation:"Square root."}],Ps=[{label:"ispresent",detail:"ispresent(fieldname)",documentation:"Returns true if the field exists."},{label:"coalesce",detail:"coalesce(fieldname1, fieldname2, ... fieldnamex)",documentation:"Returns the first non-null value from the list."}],Qs=[{label:"isempty",detail:"isempty(fieldname)",documentation:"Returns true if the field is missing or is an empty string."},{label:"isblank",detail:"isblank(fieldname)",documentation:"Returns true if the field is missing, an empty string, or contains only white space."},{label:"concat",detail:"concat(string1, string2, ... stringz)",documentation:"Concatenates the strings."},{label:"ltrim",detail:"ltrim(string) or ltrim(string1, string2)",documentation:"Remove white space from the left of the string. If the function has a second string argument, it removes the characters of string2 from the left of string1."},{label:"rtrim",detail:"rtrim(string) or rtrim(string1, string2)",documentation:"Remove white space from the right of the string. If the function has a second string argument, it removes the characters of string2 from the right of string1."},{label:"trim",detail:"trim(string) or trim(string1, string2)",documentation:"Remove white space from both ends of the string. If the function has a second string argument, it removes the characters of string2 from both sides of string1."},{label:"strlen",detail:"strlen(string)",documentation:"Returns the length of the string in Unicode code points."},{label:"toupper",detail:"toupper(string)",documentation:"Converts the string to uppercase."},{label:"tolower",detail:"tolower(string)",documentation:"Converts the string to lowercase."},{label:"substr",detail:"substr(string1, x), or substr(string1, x, y)",documentation:"Returns a substring from the index specified by the number argument to the end of the string. If the function has a second number argument, it contains the length of the substring to be retrieved."},{label:"replace",detail:"replace(string1, string2, string3)",documentation:"Replaces all instances of string2 in string1 with string3."},{label:"strcontains",detail:"strcontains(string1, string2)",documentation:"Returns 1 if string1 contains string2 and 0 otherwise."}],xs=[{label:"bin",detail:"bin(period)",documentation:"Rounds the value of @timestamp to the given period and then truncates."},{label:"datefloor",detail:"datefloor(a, period)",documentation:"Truncates the timestamp to the given period."},{label:"dateceil",detail:"dateceil(a, period)",documentation:"Rounds up the timestamp to the given period and then truncates."},{label:"fromMillis",detail:"fromMillis(fieldname)",documentation:"Interprets the input field as the number of milliseconds since the Unix epoch and converts it to a timestamp."},{label:"toMillis",detail:"toMillis(fieldname)",documentation:"Converts the timestamp found in the named field into a number representing the milliseconds since the Unix epoch."}],At=[{label:"isValidIp",detail:"isValidIp(fieldname)",documentation:"Returns true if the field is a valid v4 or v6 IP address."},{label:"isValidIpV4",detail:"isValidIpV4(fieldname)",documentation:"Returns true if the field is a valid v4 IP address."},{label:"isValidIpV6",detail:"isValidIpV6(fieldname)",documentation:"Returns true if the field is a valid v6 IP address."},{label:"isIpInSubnet",detail:"isIpInSubnet(fieldname, string)",documentation:"Returns true if the field is a valid v4 or v6 IP address within the specified v4 or v6 subnet."},{label:"isIpv4InSubnet",detail:"isIpv4InSubnet(fieldname, string)",documentation:"Returns true if the field is a valid v4 IP address within the specified v4 subnet."},{label:"isIpv6InSubnet",detail:"isIpv6InSubnet(fieldname, string)",documentation:"Returns true if the field is a valid v6 IP address within the specified v6 subnet."}],la=[{label:"ispresent",detail:"ispresent(fieldname)",documentation:"Returns true if the field exists."},{label:"isempty",detail:"isempty(fieldname)",documentation:"Returns true if the field is missing or is an empty string."},{label:"isblank",detail:"isblank(fieldname)",documentation:"Returns true if the field is missing, an empty string, or contains only white space."},{label:"strcontains",detail:"strcontains(string1, string2)",documentation:"Returns 1 if string1 contains string2 and 0 otherwise."},...At],Vs=[{label:"avg",detail:"avg(NumericFieldname)",documentation:"The average of the values in the specified field."},{label:"count",detail:"count(fieldname) or count(*)",documentation:"Counts the log records."},{label:"count_distinct",detail:"count_distinct(fieldname)",documentation:"Returns the number of unique values for the field."},{label:"max",detail:"max(fieldname)",documentation:"The maximum of the values for this log field in the queried logs."},{label:"min",detail:"min(fieldname)",documentation:"The minimum of the values for this log field in the queried logs."},{label:"pct",detail:"pct(fieldname, value)",documentation:"A percentile indicates the relative standing of a value in a datas."},{label:"stddev",detail:"stddev(NumericFieldname)",documentation:"The standard deviation of the values in the specified field."},{label:"sum",detail:"sum(NumericFieldname)",documentation:"The sum of the values in the specified field."}],$s=[{label:"earliest",detail:"earliest(fieldname)",documentation:"Returns the value of fieldName from the log event that has the earliest time stamp in the queried logs."},{label:"latest",detail:"latest(fieldname)",documentation:"Returns the value of fieldName from the log event that has the latest time stamp in the queried logs."},{label:"sortsFirst",detail:"sortsFirst(fieldname)",documentation:"Returns the value of fieldName that sorts first in the queried logs."},{label:"sortsLast",detail:"sortsLast(fieldname)",documentation:"Returns the value of fieldName that sorts last in the queried logs."}],Os=[...Vs,...$s],Us=["as","like","by","in","desc","asc"],Ws=[...[...Gs,...Ps,...Qs,...xs,...At],...Os],js={comment:{pattern:/^#.*/,greedy:!0},backticks:{pattern:/`.*?`/,alias:"string",greedy:!0},quote:{pattern:/".*?"/,alias:"string",greedy:!0},regex:{pattern:/\/.*?\/(?=\||\s*$|,)/,greedy:!0},"query-command":{pattern:new RegExp(`\\b(?:${Fs.map(t=>t.label).join("|")})\\b`,"i"),alias:"function"},function:{pattern:new RegExp(`\\b(?:${Ws.map(t=>t.label).join("|")})\\b`,"i")},keyword:{pattern:new RegExp(`(\\s+)(${Us.join("|")})(?=\\s+)`,"i"),lookbehind:!0},"log-group-name":{pattern:/[\.\-_/#A-Za-z0-9]+/},"field-name":{pattern:/(@?[_a-zA-Z]+[_.0-9a-zA-Z]*)|(`((\\`)|([^`]))*?`)/,greedy:!0},number:/\b-?\d+((\.\d*)?([eE][+-]?\d+)?)?\b/,"command-separator":{pattern:/\|/,alias:"punctuation"},"comparison-operator":{pattern:/([<>]=?)|(!?=)/},punctuation:/[{}()`,.]/,whitespace:/\s+/},Xs=t=>{const[e,s]=(0,o.useState)(null),[r,a]=(0,o.useState)({}),[i,c]=(0,o.useState)(null),[n,l]=(0,o.useState)(!0),[u,d]=(0,o.useState)(""),g=(0,Z.of)(Bs),b={grammar:js,name:"kql"},h=(0,o.useMemo)(()=>e?Object.keys(e).map(w=>({label:w,value:w})):[],[e]),f=async()=>{await t.datasource.getAzureLogAnalyticsCheatsheetQueries().then(w=>{w.categories.sort((E,L)=>E.displayName.toLowerCase()===L.displayName.toLowerCase()?0:E.displayName.toLowerCase()
{const V=L.related.queries.map(le=>w.queries.find(se=>se.id===le));return E[L.displayName]=V,a({...r,[L.id]:!1}),E},{});return s(k),c(k),l(!1),k})};(0,o.useEffect)(()=>{e||f()});const p=w=>{const k=Object.keys(i);if(w.length>0&&e){const E=Object.keys(e).reduce((L,V)=>{const le=e[V].filter(se=>se.displayName.toLowerCase().includes(w.toLowerCase()));return k.includes(V)&&(L[V]=le),L},{});return c(E),E}else return Object.keys(i).length!==Object.keys(e).length?(c(i),i):(c(e),e)},y=w=>{if(w.length>0){const E=w.map(L=>L.label).reduce((L,V)=>(L[V]=e[V],L),{});c(E)}else c(e)};return o.createElement("div",null,!n&&i?o.createElement("div",null,o.createElement("div",{className:g.filterAlignment},o.createElement(x.p,{value:u,onChange:w=>{d(w.currentTarget.value);const k=p(w.currentTarget.value);c(k)},placeholder:"Search Logs queries",width:40}),o.createElement($.D,{label:"Categories",className:g.categoryDropdown},o.createElement(D.l6,{options:h,value:"",onChange:w=>y(w),allowCustomValue:!1,backspaceRemovesValue:!0,placeholder:"All categories",isClearable:!0,noOptionsMessage:"Unable to list all categories",formatCreateLabel:w=>`Category: ${w}`,isSearchable:!0,isMulti:!0,width:40}))),o.createElement("div",{className:g.spacing},"Query results:"," ",Object.keys(i).reduce((w,k)=>(w=i[k].length+w,w),0)),o.createElement(Et.E,{showScrollIndicators:!0,autoHeightMax:"350px"},Object.keys(i).map(w=>{if(i[w].length)return o.createElement(ft.S,{label:w+` (${i[w].length})`,collapsible:!0,isOpen:r[w],onToggle:k=>a({...r,[w]:k}),key:w},i[w].map(k=>o.createElement(qe.Z,{className:g.card,key:k.id},o.createElement(qe.Z.Heading,null,k.displayName),o.createElement(Et.E,{showScrollIndicators:!0,autoHeightMax:"100px"},o.createElement(Ds,{"aria-label":`${k.displayName} raw query`,query:k.body,lang:b,className:g.rawQuery})),o.createElement(qe.Z.Actions,null,o.createElement(_.$n,{size:"sm","aria-label":"use this query button",onClick:()=>{t.onChange({refId:"A",queryType:m.LogAnalytics,azureLogAnalytics:{query:k.body},datasource:t.datasource}),(0,Qe.rR)("grafana_azure_cheatsheet_logs_query_selected",{id:k.id,queryName:k.displayName,query:k.body,queryCategories:k.related.categories})}},"Use this query")))))}))):o.createElement(He._,{text:"Loading..."}))},Bs=t=>({card:(0,S.css)({width:"90%",display:"flex",flexDirection:"column"}),rawQuery:(0,S.css)({backgroundColor:`${t.colors.background.primary}`,padding:`${t.spacing(1)}`,marginTop:`${t.spacing(1)}`}),spacing:(0,S.css)({marginBottom:`${t.spacing(1)}`}),filterAlignment:(0,S.css)({display:"flex"}),categoryDropdown:(0,S.css)({margin:"0 0 10px 10px",display:"flex",flexDirection:"row",alignItems:"center"})}),Hs=t=>{const{isOpen:e,onClose:s,datasource:r,onChange:a}=t;return o.createElement(Be.a,{"aria-label":"Kick start your query modal",isOpen:e,title:"Kick start your query",onDismiss:s},o.createElement(Xs,{onChange:i=>{a(i),s()},query:{refId:"A"},datasource:r}))},_e={"microsoft.recoveryservices/vaults/backupfabrics/protectioncontainers/protecteditems":"Backup Items","microsoft.resources/subscriptions":"Subscriptions","microsoft.resources/subscriptions/resourcegroups":"Resource groups","citrix.services/xenappessentials":"Citrix Virtual Apps Essentials","citrix.services/xendesktopessentials":"Citrix Virtual Desktops Essentials","dynatrace.observability/monitors":"Dynatrace","github.enterprise/accounts":"GitHub AE","microsoft.aad/domainservices":"Azure AD Domain Services","microsoft.aadiam/privatelinkforazuread":"Private Link for Azure AD","microsoft.agfoodplatform/farmbeats":"Azure FarmBeats","microsoft.analysisservices/servers":"Analysis Services","microsoft.anybuild/clusters":"AnyBuild clusters","microsoft.apimanagement/service":"API Management services","microsoft.appconfiguration/configurationstores":"App Configuration","microsoft.appplatform/spring":"Azure Spring Cloud","microsoft.attestation/attestationproviders":"Attestation providers","microsoft.authorization/resourcemanagementprivatelinks":"Resource management private links","microsoft.automation/automationaccounts":"Automation Accounts","microsoft.automation/automationaccounts/runbooks":"Runbook","microsoft.autonomoussystems/workspaces":"Bonsai","microsoft.avs/privateclouds":"AVS Private clouds","microsoft.azureactivedirectory/b2cdirectories":"B2C Tenants","microsoft.azureactivedirectory/guestusages":"Guest Usages","microsoft.azurearcdata/datacontrollers":"Azure Arc data controllers","microsoft.azurearcdata/postgresinstances":"Azure Arc-enabled PostgreSQL Hyperscale server groups","microsoft.azurearcdata/sqlmanagedinstances":"SQL managed instances - Azure Arc","microsoft.azurearcdata/sqlserverinstances":"SQL Server - Azure Arc","microsoft.azuredata/sqlserverregistrations":"SQL Server registries","microsoft.azurepercept/accounts":"Azure Percept accounts","microsoft.azurestackhci/clusters":"Azure Stack HCI","microsoft.azurestackhci/virtualmachines":"Azure Stack HCI virtual machine - Azure Arc","microsoft.baremetal/crayservers":"Cray Servers","microsoft.baremetal/monitoringservers":"Monitoring Servers","microsoft.baremetalinfrastructure/baremetalinstances":"BareMetal Instances","microsoft.batch/batchaccounts":"Batch accounts","microsoft.bing/accounts":"Bing Resources","microsoft.botservice/botservices":"Bot Services","microsoft.cache/redis":"Azure Cache for Redis","microsoft.cache/redisenterprise":"Redis Enterprise","microsoft.cdn/cdnwebapplicationfirewallpolicies":"Content Delivery Network WAF policies","microsoft.cdn/profiles (front doors standard/premium":"Preview)","microsoft.cdn/profiles/afdendpoints":"Endpoints","microsoft.cdn/profiles/endpoints":"Endpoints","microsoft.certificateregistration/certificateorders":"App Service Certificates","microsoft.chaos/chaosexperiments":"Chaos Experiments (Classic)","microsoft.chaos/experiments":"Chaos Experiments","microsoft.classiccompute/domainnames":"Cloud services (classic)","microsoft.classiccompute/virtualmachines":"Virtual machines (classic)","microsoft.classicnetwork/networksecuritygroups":"Network security groups (classic)","microsoft.classicnetwork/reservedips":"Reserved IP addresses (classic)","microsoft.classicnetwork/virtualnetworks":"Virtual networks (classic)","microsoft.classicstorage/storageaccounts":"Storage accounts (classic)","microsoft.cloudtest/accounts":"CloudTest Accounts","microsoft.cloudtest/hostedpools":"1ES Hosted Pools","microsoft.cloudtest/images":"CloudTest Images","microsoft.cloudtest/pools":"CloudTest Pools","microsoft.clusterstor/nodes":"ClusterStors","microsoft.cognitiveservices/accounts":"Cognitive Services","microsoft.compute/availabilitysets":"Availability sets","microsoft.compute/capacityreservationgroups":"Capacity Reservation Groups","microsoft.compute/cloudservices":"Cloud services (extended support)","microsoft.compute/diskaccesses":"Disk Accesses","microsoft.compute/diskencryptionsets":"Disk Encryption Sets","microsoft.compute/disks":"Disks","microsoft.compute/galleries":"Azure compute galleries","microsoft.compute/galleries/applications":"VM application definitions","microsoft.compute/galleries/applications/versions":"VM application versions","microsoft.compute/galleries/images":"VM image definitions","microsoft.compute/galleries/images/versions":"VM image versions","microsoft.compute/hostgroups":"Host groups","microsoft.compute/hostgroups/hosts":"Hosts","microsoft.compute/images":"Images","microsoft.compute/proximityplacementgroups":"Proximity placement groups","microsoft.compute/restorepointcollections":"Restore Point Collections","microsoft.compute/snapshots":"Snapshots","microsoft.compute/sshpublickeys":"SSH keys","microsoft.compute/virtualmachines":"Virtual machines","microsoft.compute/virtualmachinescalesets":"Virtual machine scale sets","microsoft.confidentialledger/ledgers":"Confidential Ledgers","microsoft.confluent/organizations":"Confluent organizations","microsoft.connectedcache/cachenodes":"Connected Cache Resources","microsoft.connectedcache/enterprisecustomers":"Connected Cache Resources","microsoft.connectedvehicle/platformaccounts":"Connected Vehicle Platforms","microsoft.connectedvmwarevsphere/vcenters":"VMware vCenters","microsoft.connectedvmwarevsphere/virtualmachines":"VMware + AVS virtual machines","microsoft.containerinstance/containergroups":"Container instances","microsoft.containerregistry/registries":"Container registries","microsoft.containerregistry/registries/replications":"Container registry replications","microsoft.containerregistry/registries/webhooks":"Container registry webhooks","microsoft.containerservice/managedclusters":"Kubernetes services","microsoft.dashboard/grafana":"Grafana Workspaces","microsoft.databox/jobs":"Azure Data Box","microsoft.databoxedge/databoxedgedevices":"Azure Stack Edge / Data Box Gateway","microsoft.databricks/workspaces":"Azure Databricks Services","microsoft.datacatalog/catalogs":"Data Catalog","microsoft.datacollaboration/workspaces":"Project CI","microsoft.datadog/monitors":"Datadog","microsoft.datafactory/datafactories":"Data factories","microsoft.datafactory/factories":"Data factories (V2)","microsoft.datalakeanalytics/accounts":"Data Lake Analytics","microsoft.datalakestore/accounts":"Data Lake Storage Gen1","microsoft.datamigration/services":"Azure Database Migration Services","microsoft.datamigration/services/projects":"Azure Database Migration Projects","microsoft.datamigration/sqlmigrationservices":"Azure Database Migration Services","microsoft.dataprotection/backupvaults":"Backup vaults","microsoft.dataprotection/resourceguards":"Resource Guards (Preview)","microsoft.datareplication/replicationvaults":"Site Recovery Vaults","microsoft.datashare/accounts":"Data Shares","microsoft.dbformariadb/servers":"Azure Database for MariaDB servers","microsoft.dbformysql/flexibleservers":"Azure Database for MySQL flexible servers","microsoft.dbformysql/servers":"Azure Database for MySQL servers","microsoft.dbforpostgresql/flexibleservers":"Azure Database for PostgreSQL flexible servers","microsoft.dbforpostgresql/servergroups":"Azure Database for PostgreSQL server groups","microsoft.dbforpostgresql/servergroupsv2":"Azure Database for PostgreSQL server groups","microsoft.dbforpostgresql/servers":"Azure Database for PostgreSQL servers","microsoft.dbforpostgresql/serversv2":"Azure Database for PostgreSQL servers v2","microsoft.deploymentmanager/rollouts":"Rollouts","microsoft.desktopvirtualization/applicationgroups":"Application groups","microsoft.desktopvirtualization/hostpools":"Host pools","microsoft.desktopvirtualization/scalingplans":"Scaling plans","microsoft.desktopvirtualization/workspaces":"Workspaces","microsoft.devices/iothubs":"IoT Hub","microsoft.devices/provisioningservices":"Device Provisioning Services","microsoft.deviceupdate/accounts":"Device Update for IoT Hubs","microsoft.devops/pipelines":"DevOps Starter","microsoft.devtestlab/labs":"DevTest Labs","microsoft.devtestlab/labs/virtualmachines":"Virtual machines","microsoft.digitaltwins/digitaltwinsinstances":"Azure Digital Twins","microsoft.documentdb/cassandraclusters":"Azure Managed Instance for Apache Cassandra","microsoft.documentdb/databaseaccounts":"Azure Cosmos DB accounts","microsoft.domainregistration/domains":"App Service Domains","microsoft.edgeorder/addresses":"Azure Edge Hardware Center Address","microsoft.edgeorder/orderitems":"Azure Edge Hardware Center","microsoft.elastic/monitors":"Elasticsearch (Elastic Cloud)","microsoft.eventgrid/domains":"Event Grid Domains","microsoft.eventgrid/partnernamespaces":"Event Grid Partner Namespaces","microsoft.eventgrid/partnerregistrations":"Event Grid Partner Registrations","microsoft.eventgrid/partnertopics":"Event Grid Partner Topics","microsoft.eventgrid/systemtopics":"Event Grid System Topics","microsoft.eventgrid/topics":"Event Grid Topics","microsoft.eventhub/clusters":"Event Hubs Clusters","microsoft.eventhub/namespaces":"Event Hubs Namespaces","microsoft.experimentation/experimentworkspaces":"Experiment Workspaces","microsoft.extendedlocation/customlocations":"Custom locations","microsoft.fidalgo/devcenters":"Fidalgo DevCenters","microsoft.fidalgo/networksettings":"Network Configurations","microsoft.fidalgo/projects":"Fidalgo Projects","microsoft.fidalgo/projects/environments":"Fidalgo Environments","microsoft.fluidrelay/fluidrelayservers":"Fluid Relay","microsoft.genomics/accounts":"Genomics accounts","microsoft.hanaonazure/hanainstances":"SAP HANA on Azure","microsoft.hanaonazure/sapmonitors":"Azure Monitors for SAP Solutions","microsoft.hdinsight/clusterpools":"HDInsight cluster pools","microsoft.hdinsight/clusterpools/clusters":"HDInsight gen2 clusters","microsoft.hdinsight/clusterpools/clusters/sessionclusters":"HDInsight session clusters","microsoft.hdinsight/clusters":"HDInsight clusters","microsoft.healthbot/healthbots":"Azure Health Bot","microsoft.healthcareapis/services":"Azure API for FHIR","microsoft.healthcareapis/workspaces":"Healthcare APIs Workspaces","microsoft.healthcareapis/workspaces/dicomservices":"DICOM services","microsoft.healthcareapis/workspaces/fhirservices":"FHIR services","microsoft.healthcareapis/workspaces/iotconnectors":"IoT connectors","microsoft.hpcworkbench/instances":"HPC Workbenches (preview)","microsoft.hpcworkbench/instances/chambers":"Chambers (preview)","microsoft.hpcworkbench/instances/chambers/accessprofiles":"Chamber Profiles (preview)","microsoft.hpcworkbench/instances/chambers/workloads":"Chamber VMs (preview)","microsoft.hpcworkbench/instances/consortiums":"Consortiums (preview)","microsoft.hybridcompute/machines":"Servers - Azure Arc","microsoft.hybridcompute/privatelinkscopes":"Azure Arc Private Link Scopes","microsoft.hybridcontainerservice/provisionedclusters":"Provisioned clusters","microsoft.hybriddata/datamanagers":"StorSimple Data Managers","microsoft.hybridnetwork/devices":"Azure Network Function Manager \u2013 Devices","microsoft.hybridnetwork/networkfunctions":"Azure Network Function Manager \u2013 Network Functions","microsoft.importexport/jobs":"Import/export jobs","microsoft.insights/components":"Application Insights","microsoft.insights/datacollectionendpoints":"Data collection endpoints","microsoft.insights/datacollectionrules":"Data collection rules","microsoft.insights/privatelinkscopes":"Azure Monitor Private Link Scopes","microsoft.insights/webtests":"Availability tests","microsoft.insights/workbooks":"Azure Workbooks","microsoft.insights/workbooktemplates":"Azure Workbook Templates","microsoft.iotcentral/iotapps":"IoT Central Applications","microsoft.keyvault/vaults":"Key vaults","microsoft.kubernetes/connectedclusters":"Kubernetes - Azure Arc","microsoft.kusto/clusters":"Azure Data Explorer Clusters","microsoft.kusto/clusters/databases":"Azure Data Explorer Databases","microsoft.labservices/labaccounts":"Lab accounts","microsoft.labservices/labplans":"Lab plans","microsoft.labservices/labs":"Labs","microsoft.loadtestservice/loadtests":"Azure Load Testing","microsoft.logic/integrationaccounts":"Integration accounts","microsoft.logic/integrationserviceenvironments":"Integration Service Environments","microsoft.logic/integrationserviceenvironments/managedapis":"Managed Connector","microsoft.logic/workflows":"Logic apps","microsoft.logz/monitors":"Logz main account","microsoft.logz/monitors/accounts":"Logz sub account","microsoft.logz/monitors/metricssource":"Logz metrics data source","microsoft.machinelearning/commitmentplans":"Machine Learning Studio (classic) web service plans","microsoft.machinelearning/webservices":"Machine Learning Studio (classic) web services","microsoft.machinelearning/workspaces":"Machine Learning Studio (classic) workspaces","microsoft.machinelearningservices/workspaces":"Machine learning","microsoft.machinelearningservices/workspaces/onlineendpoints":"Machine learning online endpoints","microsoft.machinelearningservices/workspaces/onlineendpoints/deployments":"Machine learning online deployments","microsoft.maintenance/maintenanceconfigurations":"Maintenance Configurations","microsoft.managedidentity/userassignedidentities":"Managed Identities","microsoft.maps/accounts":"Azure Maps Accounts","microsoft.maps/accounts/creators":"Azure Maps Creator Resources","microsoft.media/mediaservices":"Media Services","microsoft.media/mediaservices/liveevents":"Live events","microsoft.media/mediaservices/streamingendpoints":"Streaming Endpoints","microsoft.media/videoanalyzers":"Video Analyzers","microsoft.migrate/projects":"Migration projects","microsoft.mixedreality/objectanchorsaccounts":"Object Anchors Accounts","microsoft.mixedreality/objectunderstandingaccounts":"Object Understanding Accounts","microsoft.mixedreality/remoterenderingaccounts":"Remote Rendering Accounts","microsoft.mixedreality/spatialanchorsaccounts":"Spatial Anchors Accounts","microsoft.mobilenetwork/mobilenetworks":"Mobile Networks","microsoft.mobilenetwork/mobilenetworks/datanetworks":"Data Networks","microsoft.mobilenetwork/mobilenetworks/services":"Services","microsoft.mobilenetwork/mobilenetworks/simpolicies":"Sim Policies","microsoft.mobilenetwork/mobilenetworks/sites":"Mobile Network Sites","microsoft.mobilenetwork/mobilenetworks/slices":"Slices","microsoft.mobilenetwork/packetcorecontrolplanes":"Packet Core Control Planes","microsoft.mobilenetwork/packetcorecontrolplanes/packetcoredataplanes":"Packet Core Data Planes","microsoft.mobilenetwork/packetcorecontrolplanes/packetcoredataplanes/attacheddatanetworks":"Attached Data Networks","microsoft.mobilenetwork/sims":"Sims","microsoft.netapp/netappaccounts":"NetApp accounts","microsoft.netapp/netappaccounts/capacitypools":"Capacity pools","microsoft.netapp/netappaccounts/capacitypools/volumes":"Volumes","microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots":"Snapshots","microsoft.netapp/netappaccounts/snapshotpolicies":"Snapshot policies","microsoft.network/applicationgateways":"Application gateways","microsoft.network/applicationgatewaywebapplicationfirewallpolicies":"Application Gateway WAF policies","microsoft.network/applicationsecuritygroups":"Application security groups","microsoft.network/azurefirewalls":"Firewalls","microsoft.network/bastionhosts":"Bastions","microsoft.network/connections":"Connections","microsoft.network/customipprefixes":"Custom IP Prefixes","microsoft.network/ddosprotectionplans":"DDoS protection plans","microsoft.network/dnsforwardingrulesets":"Dns Forwarding Rulesets","microsoft.network/dnsresolvers":"DNS Private Resolvers","microsoft.network/dnszones":"DNS zones","microsoft.network/expressroutecircuits":"ExpressRoute circuits","microsoft.network/expressrouteports":"ExpressRoute Direct","microsoft.network/firewallpolicies":"Firewall Policies","microsoft.network/frontdoors":"Front Doors","microsoft.network/frontdoorwebapplicationfirewallpolicies":"Web Application Firewall policies (WAF)","microsoft.network/ipgroups":"IP Groups","microsoft.network/loadbalancers":"Load balancers","microsoft.network/localnetworkgateways":"Local network gateways","microsoft.network/natgateways":"NAT gateways","microsoft.network/networkexperimentprofiles":"Internet Analyzer profiles","microsoft.network/networkinterfaces":"Network interfaces","microsoft.network/networkmanagers":"Network Managers","microsoft.network/networksecuritygroups":"Network security groups","microsoft.network/networkwatchers":"Network Watchers","microsoft.network/networkwatchers/connectionmonitors":"Connection Monitors","microsoft.network/networkwatchers/flowlogs":"NSG Flow Logs","microsoft.network/privatednszones":"Private DNS zones","microsoft.network/privateendpoints":"Private endpoints","microsoft.network/privatelinkservices":"Private link services","microsoft.network/publicipaddresses":"Public IP addresses","microsoft.network/publicipprefixes":"Public IP Prefixes","microsoft.network/routefilters":"Route filters","microsoft.network/routetables":"Route tables","microsoft.network/serviceendpointpolicies":"Service endpoint policies","microsoft.network/trafficmanagerprofiles":"Traffic Manager profiles","microsoft.network/virtualnetworkgateways":"Virtual network gateways","microsoft.network/virtualnetworks":"Virtual networks","microsoft.network/virtualwans":"Virtual WANs","microsoft.notificationhubs/namespaces":"Notification Hub Namespaces","microsoft.notificationhubs/namespaces/notificationhubs":"Notification Hubs","microsoft.openenergyplatform/energyservices":"Project Oak Forest","microsoft.openlogisticsplatform/workspaces":"Open Supply Chain Platform","microsoft.operationalinsights/querypacks":"Log Analytics query packs","microsoft.operationalinsights/workspaces":"Log Analytics workspaces","microsoft.operationsmanagement/solutions":"Solutions","microsoft.orbital/contactprofiles":"Contact Profiles","microsoft.orbital/edgesites":"Edge Sites","microsoft.orbital/groundstations":"Ground Stations","microsoft.orbital/l2connections":"L2 Connections","microsoft.orbital/spacecrafts":"Spacecrafts","microsoft.peering/peerings":"Peerings","microsoft.peering/peeringservices":"Peering Services","microsoft.playfab/playeraccountpools":"PlayFab player account pools","microsoft.playfab/titles":"PlayFab titles","microsoft.portal/dashboards":"Shared dashboards","microsoft.powerbidedicated/capacities":"Power BI Embedded","microsoft.purview/accounts":"Microsoft Purview accounts","microsoft.quantum/workspaces":"Quantum Workspaces","microsoft.recommendationsservice/accounts":"Intelligent Recommendations Accounts","microsoft.recommendationsservice/accounts/modeling":"Modeling","microsoft.recommendationsservice/accounts/serviceendpoints":"Service Endpoints","microsoft.recoveryservices/vaults":"Recovery Services vaults","microsoft.redhatopenshift/openshiftclusters":"Azure Red Hat OpenShift","microsoft.relay/namespaces":"Relays","microsoft.resourceconnector/appliances":"Resource bridges","microsoft.resourcegraph/queries":"Resource Graph queries","microsoft.resources/deploymentscripts":"Deployment Scripts","microsoft.resources/templatespecs":"Template specs","microsoft.saas/applications":"Software as a Service (classic)","microsoft.saas/resources":"SaaS","microsoft.scom/managedinstances":"Aquila Instances","microsoft.scvmm/virtualmachines":"SCVMM virtual machine - Azure Arc","microsoft.scvmm/vmmservers":"SCVMM management servers","microsoft.search/searchservices":"Search services","microsoft.securitydetonation/chambers":"Security Detonation Chambers","microsoft.servicebus/namespaces":"Service Bus Namespaces","microsoft.servicefabric/clusters":"Service Fabric clusters","microsoft.servicefabric/managedclusters":"Service Fabric managed clusters","microsoft.serviceshub/connectors":"Services Hub Connectors","microsoft.signalrservice/signalr":"SignalR","microsoft.signalrservice/webpubsub":"Web PubSub Service","microsoft.solutions/applicationdefinitions":"Service catalog managed application definitions","microsoft.solutions/applications":"Managed applications","microsoft.sql/instancepools":"Instance pools","microsoft.sql/managedinstances":"SQL managed instances","microsoft.sql/managedinstances/databases":"Managed databases","microsoft.sql/servers":"SQL servers","microsoft.sql/servers/databases":"SQL databases","microsoft.sql/servers/elasticpools":"SQL elastic pools","microsoft.sql/servers/jobagents":"Elastic Job agents","microsoft.sql/virtualclusters":"Virtual clusters","microsoft.sqlvirtualmachine/sqlvirtualmachines":"SQL virtual machines","microsoft.storage/storageaccounts":"Storage accounts","microsoft.storagecache/amlfilesystems":"Lustre File Systems","microsoft.storagecache/caches":"HPC caches","microsoft.storagepool/diskpools":"Disk Pools","microsoft.storagesync/storagesyncservices":"Storage Sync Services","microsoft.storagesyncdev/storagesyncservices":"Storage Sync Services","microsoft.storagesyncint/storagesyncservices":"Storage Sync Services","microsoft.storsimple/managers":"StorSimple Device Managers","microsoft.streamanalytics/clusters":"Stream Analytics clusters","microsoft.streamanalytics/streamingjobs":"Stream Analytics jobs","microsoft.synapse/privatelinkhubs":"Azure Synapse Analytics (private link hubs)","microsoft.synapse/workspaces":"Azure Synapse Analytics","microsoft.synapse/workspaces/bigdatapools":"Apache Spark pools","microsoft.synapse/workspaces/kustopools":"Data Explorer pools (preview)","microsoft.synapse/workspaces/sqlpools":"Dedicated SQL pools","microsoft.testbase/testbaseaccounts":"Test Base Accounts","microsoft.testbase/testbaseaccounts/packages":"Test Base Packages","microsoft.timeseriesinsights/environments":"Time Series Insights environments","microsoft.timeseriesinsights/environments/eventsources":"Time Series Insights event sources","microsoft.timeseriesinsights/environments/referencedatasets":"Time Series Insights reference data sets","microsoft.videoindexer/accounts":"Video Analyzer for Media","microsoft.virtualmachineimages/imagetemplates":"Image Templates","microsoft.visualstudio/account":"Azure DevOps organizations","microsoft.visualstudio/account/project":"DevOps Starter","microsoft.vmwarecloudsimple/dedicatedcloudnodes":"CloudSimple Nodes","microsoft.vmwarecloudsimple/dedicatedcloudservices":"CloudSimple Services","microsoft.vmwarecloudsimple/virtualmachines":"CloudSimple Virtual Machines","microsoft.vsonline/plans":"Visual Studio Online Plans","microsoft.web/connectiongateways":"On-premises data gateways","microsoft.web/connections":"API Connections","microsoft.web/containerapps":"Container Apps","microsoft.web/customapis":"Logic Apps Custom Connector","microsoft.web/hostingenvironments":"App Service Environments","microsoft.web/kubeenvironments":"App Service Kubernetes Environments","microsoft.web/serverfarms":"App Service plans","microsoft.web/sites":"App Services","microsoft.web/sites/slots":"App Service (Slots)","microsoft.web/staticsites":"Static Web Apps","microsoft.windowsesu/multipleactivationkeys":"Windows Multiple Activation Keys","microsoft.windowsiot/deviceservices":"Windows 10 IoT Core Services","microsoft.workloads/monitors":"Azure Monitors for SAP Solutions (v2)","microsoft.workloads/phpworkloads":"Scalable WordPress on Linux","microsoft.workloads/sapvirtualinstances":"SAP Virtual Instances","microsoft.workloads/sapvirtualinstances/applicationinstances":"SAP app server instances","microsoft.workloads/sapvirtualinstances/centralinstances":"SAP central server instances","microsoft.workloads/sapvirtualinstances/databaseinstances":"SAP database server instances","nginx.nginxplus/nginxdeployments":"NGINX Deployment","providers.test/statefulibizaengines":"VLCentral Help","wandisco.fusion/fusiongroups":"LiveData Planes","wandisco.fusion/fusiongroups/azurezones":"Azure Zones","wandisco.fusion/fusiongroups/azurezones/plugins":"Plugins","wandisco.fusion/fusiongroups/hivereplicationrules":"Hive Replication Rules","wandisco.fusion/fusiongroups/managedonpremzones":"On-premises Zones","wandisco.fusion/fusiongroups/replicationrules":"Replication Rules","wandisco.fusion/migrators":"LiveData Migrators","wandisco.fusion/migrators/exclusiontemplates":"Exclusions","wandisco.fusion/migrators/livedatamigrations":"Migrations","wandisco.fusion/migrators/metadatamigrations":"Metadata Migrations","wandisco.fusion/migrators/metadatatargets":"Metadata Targets","wandisco.fusion/migrators/pathmappings":"Path Mappings","wandisco.fusion/migrators/targets":"Targets","microsoft.security/insights/classification":"Data Sensitivity Security Insights (Preview)","microsoft.security/locations/alerts":"Security Alerts"},Ks={"microsoft.cache/redis":!0,"microsoft.dbforpostgresql/flexibleservers":!0,"microsoft.storagecache/amlfilesystems":!0,"microsoft.databoxedge/databoxedgedevices":!0,"microsoft.dataprotection/backupvaults":!0,"microsoft.netapp/netappaccounts/capacitypools":!0,"microsoft.network/networkwatchers/connectionmonitors":!0,"microsoft.keyvault/vaults":!0,"microsoft.recoveryservices/vaults":!0,"microsoft.sql/servers/databases":!0,"microsoft.sql/servers/elasticpools":!0,"microsoft.compute/virtualmachinescalesets":!0,"microsoft.compute/virtualmachines":!0,"microsoft.signalrservice/webpubsub":!0},Js=["microsoft.aad/domainservices","microsoft.aadiam/azureadmetrics","microsoft.analysisservices/servers","microsoft.apimanagement/service","microsoft.app/containerapps","microsoft.app/managedenvironments","microsoft.appconfiguration/configurationstores","microsoft.appplatform/spring","microsoft.automation/automationaccounts","microsoft.avs/privateclouds","microsoft.azuresphere/catalogs","microsoft.azurestackhci/clusters","microsoft.azurestackresourcemonitor/storageaccountmonitor","microsoft.batch/batchaccounts","microsoft.batchai/workspaces","microsoft.bing/accounts","microsoft.botservice/botservices","microsoft.botservice/botservices/channels","microsoft.botservice/botservices/connections","microsoft.botservice/checknameavailability","microsoft.botservice/hostsettings","microsoft.botservice/listauthserviceproviders","microsoft.botservice/listqnamakerendpointkeys","microsoft.cache/redis","microsoft.cache/redisenterprise","microsoft.cdn/cdnwebapplicationfirewallpolicies","microsoft.cdn/profiles","microsoft.classiccompute/domainnames","microsoft.classiccompute/domainnames/slots/roles","microsoft.classiccompute/virtualmachines","microsoft.classicstorage/storageaccounts","microsoft.classicstorage/storageaccounts/blobservices","microsoft.classicstorage/storageaccounts/fileservices","microsoft.classicstorage/storageaccounts/queueservices","microsoft.classicstorage/storageaccounts/tableservices","microsoft.cloudtest/hostedpools","microsoft.cloudtest/pools","microsoft.clusterstor/nodes","microsoft.codesigning/codesigningaccounts","microsoft.cognitiveservices/accounts","microsoft.communication/communicationservices","microsoft.compute/cloudservices","microsoft.compute/cloudservices/roles","microsoft.compute/disks","microsoft.compute/virtualmachines","microsoft.compute/virtualmachinescalesets","microsoft.compute/virtualmachinescalesets/virtualmachines","microsoft.connectedcache/cachenodes","microsoft.connectedcache/enterprisemcccustomers","microsoft.connectedcache/ispcustomers","microsoft.connectedvehicle/platformaccounts","microsoft.containerinstance/containergroups","microsoft.containerinstance/containerscalesets","microsoft.containerregistry/registries","microsoft.containerservice/managedclusters","microsoft.customerinsights/hubs","microsoft.customproviders/resourceproviders","microsoft.dashboard/grafana","microsoft.databoxedge/databoxedgedevices","microsoft.datacollaboration/workspaces","microsoft.datafactory/datafactories","microsoft.datafactory/factories","microsoft.datalakeanalytics/accounts","microsoft.datalakestore/accounts","microsoft.dataprotection/backupvaults","microsoft.datashare/accounts","microsoft.dbformariadb/servers","microsoft.dbformysql/flexibleservers","microsoft.dbformysql/servers","microsoft.dbforpostgresql/flexibleservers","microsoft.dbforpostgresql/servergroupsv2","microsoft.dbforpostgresql/servers","microsoft.dbforpostgresql/serversv2","microsoft.devices/iothubs","microsoft.devices/provisioningservices","microsoft.digitaltwins/digitaltwinsinstances","microsoft.documentdb/cassandraclusters","microsoft.documentdb/databaseaccounts","microsoft.documentdb/mongoclusters","microsoft.edgezones/edgezones","microsoft.enterpriseknowledgegraph/services","microsoft.eventgrid/domains","microsoft.eventgrid/eventsubscriptions","microsoft.eventgrid/extensiontopics","microsoft.eventgrid/namespaces","microsoft.eventgrid/partnernamespaces","microsoft.eventgrid/partnertopics","microsoft.eventgrid/systemtopics","microsoft.eventgrid/topics","microsoft.eventhub/clusters","microsoft.eventhub/namespaces","microsoft.fabric.admin/fabriclocations","microsoft.hdinsight/clusters","microsoft.healthcareapis/services","microsoft.healthcareapis/workspaces/dicomservices","microsoft.healthcareapis/workspaces/fhirservices","microsoft.healthcareapis/workspaces/iotconnectors","microsoft.healthmodel/healthmodels","microsoft.hybridcontainerservice/provisionedclusters","microsoft.hybridnetwork/networkfunctions","microsoft.hybridnetwork/virtualnetworkfunctions","microsoft.insights/autoscalesettings","microsoft.insights/components","microsoft.iotcentral/iotapps","microsoft.iotspaces/graph","microsoft.keyvault/managedhsms","microsoft.keyvault/vaults","microsoft.kubernetes/connectedclusters","microsoft.kubernetesconfiguration/extensions","microsoft.kusto/clusters","microsoft.logic/integrationserviceenvironments","microsoft.logic/workflows","microsoft.machinelearningservices/workspaces","microsoft.machinelearningservices/workspaces/onlineendpoints","microsoft.machinelearningservices/workspaces/onlineendpoints/deployments","microsoft.managednetworkfabric/internetgateways","microsoft.managednetworkfabric/l3isolationdomains","microsoft.managednetworkfabric/networkdevices","microsoft.maps/accounts","microsoft.media/mediaservices","microsoft.media/mediaservices/liveevents","microsoft.media/mediaservices/streamingendpoints","microsoft.media/videoanalyzers","microsoft.mixedreality/remoterenderingaccounts","microsoft.mixedreality/spatialanchorsaccounts","microsoft.mobilenetwork/packetcorecontrolplanes","microsoft.mobilenetwork/packetcorecontrolplanes/packetcoredataplanes","microsoft.monitor/accounts","microsoft.netapp/netappaccounts/capacitypools","microsoft.netapp/netappaccounts/capacitypools/volumes","microsoft.network/applicationgateways","microsoft.network/azurefirewalls","microsoft.network/bastionhosts","microsoft.network/connections","microsoft.network/dnsforwardingrulesets","microsoft.network/dnsresolvers","microsoft.network/dnszones","microsoft.network/expressroutecircuits","microsoft.network/expressroutecircuits/peerings","microsoft.network/expressroutegateways","microsoft.network/expressrouteports","microsoft.network/frontdoors","microsoft.network/loadbalancers","microsoft.network/natgateways","microsoft.network/networkinterfaces","microsoft.network/networkmanagers/ipampools","microsoft.network/networkvirtualappliances","microsoft.network/networkwatchers","microsoft.network/networkwatchers/connectionmonitors","microsoft.network/p2svpngateways","microsoft.network/privatednszones","microsoft.network/privateendpoints","microsoft.network/privatelinkservices","microsoft.network/publicipaddresses","microsoft.network/publicipprefixes","microsoft.network/trafficmanagerprofiles","microsoft.network/virtualhubs","microsoft.network/virtualnetworkgateways","microsoft.network/virtualnetworks","microsoft.network/virtualrouters","microsoft.network/vpngateways","microsoft.networkanalytics/dataconnectors","microsoft.networkcloud/baremetalmachines","microsoft.networkcloud/clusters","microsoft.networkcloud/storageappliances","microsoft.networkfunction/azuretrafficcollectors","microsoft.notificationhubs/namespaces/notificationhubs","microsoft.operationalinsights/workspaces","microsoft.operationsmanagement/solutions","microsoft.orbital/contactprofiles","microsoft.orbital/l2connections","microsoft.orbital/spacecrafts","microsoft.orbital/terminals","microsoft.peering/peerings","microsoft.peering/peeringservices","microsoft.playfab/titles","microsoft.powerbidedicated/capacities","microsoft.purview/accounts","microsoft.recoveryservices/vaults","microsoft.relay/namespaces","microsoft.resources/subscriptions","microsoft.search/searchservices","microsoft.securitydetonation/chambers","microsoft.securitydetonation/securitydetonationchambers","microsoft.servicebus/namespaces","microsoft.servicefabricmesh/applications","microsoft.servicenetworking/trafficcontrollers","microsoft.signalrservice/signalr","microsoft.signalrservice/signalr/replicas","microsoft.signalrservice/webpubsub","microsoft.signalrservice/webpubsub/replicas","microsoft.singularity/accounts","microsoft.sql/managedinstances","microsoft.sql/servers/databases","microsoft.sql/servers/elasticpools","microsoft.sql/servers/jobagents","microsoft.storage/storageaccounts","microsoft.storage/storageaccounts/blobservices","microsoft.storage/storageaccounts/fileservices","microsoft.storage/storageaccounts/objectreplicationpolicies","microsoft.storage/storageaccounts/queueservices","microsoft.storage/storageaccounts/storagetasks","microsoft.storage/storageaccounts/tableservices","microsoft.storage/storagetasks","microsoft.storagecache/amlfilesystems","microsoft.storagecache/caches","microsoft.storagemover/storagemovers","microsoft.storagesync/storagesyncservices","microsoft.storagetasks/storagetasks","microsoft.streamanalytics/streamingjobs","microsoft.synapse/workspaces","microsoft.synapse/workspaces/bigdatapools","microsoft.synapse/workspaces/kustopools","microsoft.synapse/workspaces/scopepools","microsoft.synapse/workspaces/sqlpools","microsoft.timeseriesinsights/environments","microsoft.timeseriesinsights/environments/eventsources","microsoft.vmwarecloudsimple/virtualmachines","microsoft.voiceservices/communicationsgateways","microsoft.web/containerapps","microsoft.web/hostingenvironments","microsoft.web/hostingenvironments/multirolepools","microsoft.web/hostingenvironments/workerpools","microsoft.web/serverfarms","microsoft.web/sites","microsoft.web/sites/slots","microsoft.web/staticsites","nginx.nginxplus/nginxdeployments","wandisco.fusion/migrators","wandisco.fusion/migrators/datatransferagents","wandisco.fusion/migrators/livedatamigrations","wandisco.fusion/migrators/metadatamigrations"],Zs=["microsoft.aad/domainservices","microsoft.aadiam/azureadmetrics","microsoft.aadiam/tenants","microsoft.agfoodplatform/farmbeats","microsoft.analysisservices/servers","microsoft.apimanagement/service","microsoft.appconfiguration/configurationstores","microsoft.appplatform/spring","microsoft.attestation/attestationproviders","microsoft.automation/automationaccounts","microsoft.autonomousdevelopmentplatform/accounts","microsoft.autonomousdevelopmentplatform/datapools","microsoft.autonomousdevelopmentplatform/workspaces","microsoft.avs/privateclouds","microsoft.azurestackresourcemonitor/storageaccountmonitor","microsoft.batch/batchaccounts","microsoft.batchai/workspaces","microsoft.blockchain/blockchainmembers","microsoft.blockchain/cordamembers","microsoft.botservice/botservices","microsoft.cache/redis","microsoft.cache/redisenterprise","microsoft.cdn/cdnwebapplicationfirewallpolicies","microsoft.cdn/profiles","microsoft.cdn/profiles/endpoints","microsoft.classiccompute/domainnames","microsoft.classiccompute/virtualmachines","microsoft.classicnetwork/networksecuritygroups","microsoft.classicstorage/storageaccounts","microsoft.cognitiveservices/accounts","microsoft.communication/communicationservices","microsoft.compute/disks","microsoft.compute/virtualmachines","microsoft.compute/virtualmachinescalesets","microsoft.connectedcache/cachenodes","microsoft.connectedvehicle/platformaccounts","microsoft.containerinstance/containergroups","microsoft.containerregistry/registries","microsoft.containerservice/managedclusters","microsoft.customerinsights/hubs","microsoft.customproviders/resourceproviders","microsoft.d365customerinsights/instances","microsoft.dashboard/grafana","microsoft.databoxedge/databoxedgedevices","microsoft.databricks/workspaces","microsoft.datacollaboration/workspaces","microsoft.datafactory/datafactories","microsoft.datafactory/factories","microsoft.datalakeanalytics/accounts","microsoft.datalakestore/accounts","microsoft.datashare/accounts","microsoft.dbformariadb/servers","microsoft.dbformysql/flexibleservers","microsoft.dbformysql/servers","microsoft.dbforpostgresql/flexibleservers","microsoft.dbforpostgresql/servergroupsv2","microsoft.dbforpostgresql/servers","microsoft.dbforpostgresql/serversv2","microsoft.desktopvirtualization/applicationgroups","microsoft.desktopvirtualization/hostpools","microsoft.desktopvirtualization/scalingplans","microsoft.desktopvirtualization/workspaces","microsoft.devices/elasticpools/iothubtenants","microsoft.devices/iothubs","microsoft.devices/provisioningservices","microsoft.digitaltwins/digitaltwinsinstances","microsoft.documentdb/cassandraclusters","microsoft.documentdb/databaseaccounts","microsoft.eventgrid/domains","microsoft.eventgrid/partnernamespaces","microsoft.eventgrid/partnertopics","microsoft.eventgrid/systemtopics","microsoft.eventgrid/topics","microsoft.eventhub/clusters","microsoft.eventhub/namespaces","microsoft.experimentation/experimentworkspaces","microsoft.fabric.admin/fabriclocations","microsoft.hdinsight/clusters","microsoft.healthcareapis/services","microsoft.healthcareapis/workspaces/dicomservices","microsoft.healthcareapis/workspaces/fhirservices","microsoft.insights/autoscalesettings","microsoft.insights/components","microsoft.insights/qos","microsoft.iotcentral/iotapps","microsoft.keyvault/managedhsms","microsoft.keyvault/vaults","microsoft.kubernetes/connectedclusters","microsoft.kusto/clusters","microsoft.loadtestservice/loadtests","microsoft.logic/integrationaccounts","microsoft.logic/integrationserviceenvironments","microsoft.logic/workflows","microsoft.machinelearningservices/workspaces","microsoft.media/mediaservices","microsoft.media/mediaservices/liveevents","microsoft.media/mediaservices/streamingendpoints","microsoft.media/videoanalyzers","microsoft.netapp/netappaccounts/capacitypools","microsoft.netapp/netappaccounts/capacitypools/volumes","microsoft.network/applicationgateways","microsoft.network/azurefirewalls","microsoft.network/bastionhosts","microsoft.network/connections","microsoft.network/dnszones","microsoft.network/expressroutecircuits","microsoft.network/expressroutegateways","microsoft.network/expressrouteports","microsoft.network/frontdoors","microsoft.network/loadbalancers","microsoft.network/natgateways","microsoft.network/networkinterfaces","microsoft.network/networksecuritygroups","microsoft.network/networksecurityperimeters","microsoft.network/networkvirtualappliances","microsoft.network/networkwatchers","microsoft.network/networkwatchers/connectionmonitors","microsoft.network/p2svpngateways","microsoft.network/privateendpoints","microsoft.network/privatelinkservices","microsoft.network/publicipaddresses","microsoft.network/trafficmanagerprofiles","microsoft.network/virtualnetworkgateways","microsoft.network/virtualnetworks","microsoft.network/vpngateways","microsoft.networkfunction/azuretrafficcollectors","microsoft.notificationhubs/namespaces","microsoft.notificationhubs/namespaces/notificationhubs","microsoft.openlogisticsplatform/workspaces","microsoft.operationalinsights/workspaces","microsoft.operationsmanagement/solutions","microsoft.peering/peeringservices","microsoft.powerbi/tenants","microsoft.powerbi/tenants/workspaces","microsoft.powerbidedicated/capacities","microsoft.purview/accounts","microsoft.recoveryservices/vaults","microsoft.relay/namespaces","microsoft.resources/subscriptions","microsoft.resources/subscriptions/resourcegroups","microsoft.search/searchservices","microsoft.security/antimalwaresettings","microsoft.securityinsights/settings","microsoft.servicebus/namespaces","microsoft.signalrservice/signalr","microsoft.signalrservice/webpubsub","microsoft.singularity/accounts","microsoft.sql/managedinstances","microsoft.sql/managedinstances/databases","microsoft.sql/servers/databases","microsoft.sql/servers/elasticpools","microsoft.storage/storageaccounts","microsoft.storage/storageaccounts/blobservices","microsoft.storage/storageaccounts/fileservices","microsoft.storage/storageaccounts/queueservices","microsoft.storage/storageaccounts/tableservices","microsoft.storagecache/caches","microsoft.storagesync/storagesyncservices","microsoft.streamanalytics/streamingjobs","microsoft.synapse/workspaces","microsoft.synapse/workspaces/bigdatapools","microsoft.synapse/workspaces/kustopools","microsoft.synapse/workspaces/scopepools","microsoft.synapse/workspaces/sqlpools","microsoft.timeseriesinsights/environments","microsoft.timeseriesinsights/environments/eventsources","microsoft.videoindexer/accounts","microsoft.vmwarecloudsimple/virtualmachines","microsoft.web/hostingenvironments","microsoft.web/hostingenvironments/workerpools","microsoft.web/serverfarms","microsoft.web/sites","microsoft.web/sites/slots"],Ys=t=>({resourceList:(0,S.css)({display:"flex",columnGap:t.spacing(1),flexWrap:"wrap",marginBottom:t.spacing(1)}),resource:(0,S.css)({flex:"0 0 auto"}),resourceLabel:(0,S.css)({padding:t.spacing(1)}),resourceGroupAndName:(0,S.css)({display:"flex",columnGap:t.spacing(.5)})}),qs=({resources:t,onChange:e})=>{const s=(0,Z.of)(Ys);(0,o.useEffect)(()=>{t.length===0&&e([{}])},[t,e]);const r=(n,l)=>{const u=[...t];u[n]=l,e(u)},a=n=>{const l=[...t];l.splice(n,1),e(l)},i=()=>{e(t.concat({subscription:t[0]?.subscription,metricNamespace:t[0]?.metricNamespace,resourceGroup:"",resourceName:""}))},c=n=>{e(t.map(l=>({...l,...n})))};return o.createElement(o.Fragment,null,o.createElement(oe.I,{label:"Subscription",grow:!0,transparent:!0,htmlFor:"input-advanced-resource-picker-subscription",labelWidth:15,"data-testid":N.components.queryEditor.resourcePicker.advanced.subscription.input},o.createElement(x.p,{id:"input-advanced-resource-picker-subscription",value:t[0]?.subscription??"",onChange:n=>c({subscription:n.currentTarget.value}),placeholder:"aaaaaaaa-bbbb-cccc-dddd-eeeeeeee"})),o.createElement(oe.I,{label:"Namespace",grow:!0,transparent:!0,htmlFor:"input-advanced-resource-picker-metricNamespace",labelWidth:15,"data-testid":N.components.queryEditor.resourcePicker.advanced.namespace.input,invalid:t[0]?.metricNamespace?.endsWith("/"),error:'Namespace cannot end with a "/"'},o.createElement(x.p,{id:"input-advanced-resource-picker-metricNamespace",value:t[0]?.metricNamespace??"",onChange:n=>c({metricNamespace:n.currentTarget.value}),placeholder:"Microsoft.Insights/metricNamespaces"})),o.createElement(oe.I,{label:"Region",grow:!0,transparent:!0,htmlFor:"input-advanced-resource-picker-region",labelWidth:15,"data-testid":N.components.queryEditor.resourcePicker.advanced.region.input,tooltip:"The code region of the resource. Optional for one resource but mandatory when selecting multiple ones."},o.createElement(x.p,{id:"input-advanced-resource-picker-region",value:t[0]?.region??"",onChange:n=>c({region:n.currentTarget.value}),placeholder:"northeurope"})),o.createElement("div",{className:s.resourceList},t.map((n,l)=>o.createElement("div",{key:`resource-${l+1}`,className:s.resource},t.length!==1&&o.createElement(wt.J,{className:s.resourceLabel},"Resource ",l+1),o.createElement(oe.I,{label:"Resource Group",transparent:!0,htmlFor:`input-advanced-resource-picker-resourceGroup-${l+1}`,labelWidth:15,"data-testid":N.components.queryEditor.resourcePicker.advanced.resourceGroup.input},o.createElement("div",{className:s.resourceGroupAndName},o.createElement(x.p,{id:`input-advanced-resource-picker-resourceGroup-${l+1}`,value:n?.resourceGroup??"",onChange:u=>r(l,{...n,resourceGroup:u.currentTarget.value}),placeholder:"resource-group"}),o.createElement(Oe.Z,{"aria-label":"remove",icon:"times",variant:"secondary",onClick:()=>a(l),hidden:t.length===1,"data-testid":"remove-resource"}))),o.createElement(oe.I,{label:"Resource Name",transparent:!0,htmlFor:`input-advanced-resource-picker-resourceName-${l+1}`,labelWidth:15,"data-testid":N.components.queryEditor.resourcePicker.advanced.resource.input},o.createElement(x.p,{id:`input-advanced-resource-picker-resourceName-${l+1}`,value:n?.resourceName??"",onChange:u=>r(l,{...n,resourceName:u.currentTarget.value}),placeholder:"name"}))))),o.createElement(_.$n,{"aria-label":"Add",icon:"plus",variant:"secondary",onClick:i,type:"button"},"Add resource"))};function Tt(t,e){return t.azureMonitor?.customNamespace===e?t:e?.toLowerCase().startsWith("microsoft.storage/storageaccounts/")?{...t,azureMonitor:{...t.azureMonitor,metricNamespace:e,metricName:void 0,aggregation:void 0,timeGrain:"",dimensionFilters:[]}}:{...t,azureMonitor:{...t.azureMonitor,customNamespace:e,metricName:void 0,aggregation:void 0,timeGrain:"",dimensionFilters:[]}}}function _s(t,e){return t.azureMonitor?.metricName===e?t:{...t,azureMonitor:{...t.azureMonitor,metricName:e,aggregation:void 0,timeGrain:"",dimensionFilters:[]}}}function er(t,e){return t.azureMonitor?.aggregation===e?t:{...t,azureMonitor:{...t.azureMonitor,aggregation:e}}}function Nt(t,e){return t.azureMonitor?.timeGrain===e?t:{...t,azureMonitor:{...t.azureMonitor,timeGrain:e}}}function Ue(t,e){return t.azureMonitor?.dimensionFilters===e?t:{...t,azureMonitor:{...t.azureMonitor,dimensionFilters:e}}}function tr(t,e="",s="eq",r=[]){const a=t.azureMonitor?.dimensionFilters??[];return Ue(t,[...a,{dimension:e,operator:s,filters:r}])}function fa(t,e){const r=[...t.azureMonitor?.dimensionFilters??[]];return r.splice(e,1),Ue(t,r)}function ga(t,e,s,r){const i=[...t.azureMonitor?.dimensionFilters??[]],c=i[e];return c[s]=r,(s==="dimension"||s==="operator")&&(c.filters=[]),Ue(t,i)}function sr(t,e){return t.azureMonitor?.top===e?t:{...t,azureMonitor:{...t.azureMonitor,top:e}}}function rr(t,e){return t.azureMonitor?.alias===e?t:{...t,azureMonitor:{...t.azureMonitor,alias:e}}}const or=({query:t,variableOptionGroup:e,onQueryChange:s,aggregationOptions:r,isLoading:a})=>{const i=(0,o.useCallback)(n=>{if(!n.value)return;const l=er(t,n.value);s(l)},[s,t]),c=R(r,e,t.azureMonitor?.aggregation);return o.createElement(X,{label:"Aggregation"},o.createElement(D.l6,{inputId:"azure-monitor-metrics-aggregation-field",value:t.azureMonitor?.aggregation||null,onChange:i,options:c,isLoading:a}))};var Mt=v(7650),Rt=v(66864);const ar=(t,e)=>{const[s,r]=(0,o.useState)({});return(0,o.useEffect)(()=>{let a={};if(t?.series?.length){const n=t.series.flat().filter(l=>l.refId===e.refId).flatMap(l=>l.fields).map(l=>l.labels).flat().filter(l=>l!=null);for(const l of n)for(const[u,d]of Object.entries(l)){const g=u.toLowerCase();a[g]?a[g].add(d):a[g]=new Set([d])}}r(i=>{const c={},n=Object.keys(a);if(n.length===0)return i;for(const l of n)i[l]&&a[l].size
{const a=(0,o.useMemo)(()=>e.azureMonitor?.dimensionFilters??[],[e.azureMonitor?.dimensionFilters]),i=ar(t,e),c=[{label:"==",value:"eq"},{label:"!=",value:"ne"},{label:"starts with",value:"sw"}],n=(0,o.useMemo)(()=>{let p=s;return a.length&&(p=s.filter(y=>!a.some(w=>w.dimension===y.value))),p},[a,s]),l=(p,y,w,k)=>{y[p]=w,k(y)},u=p=>n.concat(s.filter(y=>y.value===p)),d=(p,y)=>{const w=Array.from(i[y.toLowerCase()]??[]);return w.find(k=>k===p)?w.map(k=>({value:k,label:k})):[...w,...p&&p!=="*"?[p]:[]].map(k=>({value:k,label:k}))},g=(p,y)=>{const w=d(void 0,y);if(p)for(const k of p)w.find(E=>E.value===k)||w.push({value:k,label:k});return w},b=p=>c.find(y=>y.value===p)?c:[...c,...p?[{label:p,value:p}]:[]],h=p=>{const y=p.map(w=>({dimension:w.dimension??"",operator:w.operator??"eq",filters:w.filters??[]}));r(Ue(e,y))},f=(p,y,w)=>o.createElement(Rt.Gy,{spacing:"none"},o.createElement(D.l6,{menuShouldPortal:!0,placeholder:"Field",value:p.dimension,options:u(p.dimension||""),onChange:k=>l("dimension",p,k.value??"",y)}),o.createElement(D.l6,{menuShouldPortal:!0,placeholder:"Operation",value:p.operator,options:b(p.operator||"eq"),onChange:k=>l("operator",p,k.value??"",y),allowCustomValue:!0}),p.operator==="eq"||p.operator==="ne"?o.createElement(D.KF,{menuShouldPortal:!0,placeholder:"Select value(s)",value:p.filters,options:g(p.filters,p.dimension??""),onChange:k=>l("filters",p,k.map(E=>E.value??""),y),"aria-label":"dimension-labels-select",allowCustomValue:!0}):o.createElement(D.l6,{menuShouldPortal:!0,placeholder:"Select value",value:p.filters?p.filters[0]:"",allowCustomValue:!0,options:d(p.filters?p.filters[0]:"",p.dimension??""),onChange:k=>l("filters",p,[k?.value??""],y),isClearable:!0}),o.createElement(Oe.Z,{"aria-label":"Remove",icon:"times",variant:"secondary",onClick:w,type:"button"}));return o.createElement(X,{label:"Dimensions"},o.createElement(Mt.o,{items:a,onChange:h,renderItem:f}))},nr=({onQueryChange:t,query:e})=>{const[s,r]=(0,o.useState)(e.azureMonitor?.alias??""),a=(0,o.useCallback)(c=>{c.target instanceof HTMLInputElement&&r(c.target.value)},[]),i=(0,o.useCallback)(()=>{const c=rr(e,s);t(c)},[t,e,s]);return o.createElement(X,{label:"Legend format"},o.createElement(x.p,{id:"azure-monitor-metrics-legend-field",placeholder:"Alias patterns",value:s,onChange:a,onBlur:i,width:38}))},cr=({metricNames:t,query:e,variableOptionGroup:s,onQueryChange:r})=>{const a=(0,o.useCallback)(c=>{if(!c.value)return;const n=_s(e,c.value);r(n)},[r,e]),i=R(t,s,e.azureMonitor?.metricName);return o.createElement(X,{label:"Metric","data-testid":N.components.queryEditor.metricsQueryEditor.metricName.input},o.createElement(D.l6,{inputId:"azure-monitor-metrics-metric-field",value:e.azureMonitor?.metricName??null,onChange:a,options:i,allowCustomValue:!0}))},lr=({metricNamespaces:t,query:e,variableOptionGroup:s,onQueryChange:r})=>{const a=(0,o.useCallback)(n=>{if(!n.value)return;const l=Tt(e,n.value);r(l)},[r,e]),i=e.azureMonitor?.customNamespace||e.azureMonitor?.metricNamespace,c=R(t,s,i);return o.createElement(X,{label:"Metric namespace"},o.createElement(D.l6,{inputId:"azure-monitor-metrics-metric-namespace-field",value:i||null,onChange:a,options:c,allowCustomValue:!0}))},ur=({query:t,timeGrainOptions:e,variableOptionGroup:s,onQueryChange:r})=>{const a=(0,o.useCallback)(c=>{if(!c.value)return;const n=Nt(t,c.value);r(n)},[r,t]),i=(0,o.useMemo)(()=>{const c=U.findClosestTimeGrain("1m",e.map(u=>U.createKbnUnitFromISO8601Duration(u.value))||["1m","5m","15m","30m","1h","6h","12h","1d"]),n=e.map(u=>u.value==="auto"?{...u,description:c}:u);return R(n,s,t.azureMonitor?.timeGrain)},[e,s,t.azureMonitor?.timeGrain]);return o.createElement(X,{label:"Time grain"},o.createElement(D.l6,{inputId:"azure-monitor-metrics-time-grain-field",value:t.azureMonitor?.timeGrain,onChange:a,options:i}))},mr=({onQueryChange:t,query:e})=>{const[s,r]=(0,o.useState)(e.azureMonitor?.top??""),a=(0,o.useCallback)(c=>{c.target instanceof HTMLInputElement&&r(c.target.value)},[]),i=(0,o.useCallback)(()=>{const c=sr(e,s);t(c)},[t,e,s]);return o.createElement(X,{label:"Top"},o.createElement(x.p,{id:"azure-monitor-metrics-top-field",value:s,onChange:a,onBlur:i,width:16}))};function Ct(t,e,s){const[r]=(0,o.useState)(()=>Math.random()),[a,i]=(0,o.useState)(),c=(0,o.useMemo)(()=>a??[],[a]);return(0,o.useEffect)(()=>{t().then(n=>{i(n),e(r,void 0)}).catch(n=>{e(r,n)})},s),c}const et=t=>!t||!t.length?{resourceGroup:"",resourceName:""}:{resourceGroup:t[0].resourceGroup??"",resourceName:t[0].resourceName??""},pr=(t,e,s,r)=>{const{subscription:a}=t,{metricNamespace:i,resources:c}=t.azureMonitor??{},{resourceGroup:n,resourceName:l}=et(c);return Ct(async()=>{if(!a||!n||!l)return;const d=await e.azureMonitorDatasource.getMetricNamespaces({subscription:a,metricNamespace:i,resourceGroup:n,resourceName:l},!1),g=Dt(d,i);return!i&&g.length&&s(Tt(t,g[0].value)),g},r,[a,i,n,l])},dr=(t,e,s,r)=>{const{subscription:a}=t,{metricNamespace:i,metricName:c,resources:n,customNamespace:l}=t.azureMonitor??{},{resourceGroup:u,resourceName:d}=et(n),g=(n&&n.length>1)??!1,b=t.azureMonitor?.region??"";return Ct(async()=>{if(!a||!i||!u||!d)return;const h=await e.azureMonitorDatasource.getMetricNames({subscription:a,resourceGroup:u,resourceName:d,metricNamespace:i,customNamespace:l},g,b);return Dt(h,c)},r,[a,u,d,i,l,g])},It={aggOptions:[],timeGrains:[],dimensions:[],isLoading:!1,supportedAggTypes:[],primaryAggType:void 0},fr=(t,e,s)=>{const[r,a]=(0,o.useState)(It),{subscription:i}=t,{resources:c,metricNamespace:n,metricName:l,aggregation:u,timeGrain:d,customNamespace:g,region:b}=t.azureMonitor??{},{resourceGroup:h,resourceName:f}=et(c),p=(c&&c.length>1)??!1;return(0,o.useEffect)(()=>{if(!i||!h||!f||!n||!l){a(It);return}e.azureMonitorDatasource.getMetricMetadata({subscription:i,resourceGroup:h,resourceName:f,metricNamespace:n,metricName:l,customNamespace:g},p,b).then(y=>{const w=(y.supportedAggTypes||[y.primaryAggType]).map(k=>({label:k,value:k}));a({aggOptions:w,timeGrains:y.supportedTimeGrains,dimensions:y.dimensions,isLoading:!1,supportedAggTypes:y.supportedAggTypes??[],primaryAggType:y.primaryAggType})})},[b,e,i,h,f,n,l,g,p]),(0,o.useEffect)(()=>{const y=u||r.primaryAggType,w=d||"auto";(y!==u||w!==d)&&s({...t,azureMonitor:{...t.azureMonitor,aggregation:y,timeGrain:w,allowedTimeGrainsMs:r.timeGrains.filter(k=>k.value!=="auto").map(k=>Ae.intervalToMs(U.createKbnUnitFromISO8601Duration(k.value)))}})},[s,r,u,d,t]),r};function Dt(t,e){const s=t.map(C);return e&&!s.find(r=>r.value===e.toLowerCase())&&s.push({label:e,value:e}),s}const gr=({data:t,query:e,datasource:s,variableOptionGroup:r,onChange:a,setError:i})=>{const c=fr(e,s,a),n=pr(e,s,a,i),l=dr(e,s,a,i),u=e.azureMonitor?.resources?.map(h=>({subscription:e.subscription,resourceGroup:h.resourceGroup,metricNamespace:e.azureMonitor?.metricNamespace,resourceName:h.resourceName,region:e.azureMonitor?.region}))??[],d=h=>Ks[h?.toLocaleLowerCase()??""]??!1,g=(h,f)=>{if(f.length===0)return!1;const p=j(h.uri,h.location),y=j(f[0].uri,f[0].location);return p.subscription!==y.subscription||p.region!==y.region||p.metricNamespace?.toLocaleLowerCase()!==y.metricNamespace?.toLocaleLowerCase()||!d(p.metricNamespace)},b=h=>{if(h.length===0)return"";const f=j(h[0].uri,h[0].location);return d(f.metricNamespace)?"You can select items of the same resource type and location. To select resources of a different resource type or location, please first uncheck your current selection.":""};return o.createElement("span",{"data-testid":N.components.queryEditor.metricsQueryEditor.container.input},o.createElement(xe.D,null,o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement(Ze,{query:e,datasource:s,variableOptionGroup:r,onQueryChange:a,setError:i,selectableEntryTypes:[I.Resource],resources:u??[],queryType:"metrics",disableRow:g,renderAdvanced:(h,f)=>o.createElement(qs,{resources:h,onChange:f}),selectionNotice:b}),o.createElement(lr,{metricNamespaces:n,query:e,datasource:s,variableOptionGroup:r,onQueryChange:a,setError:i}),o.createElement(cr,{metricNames:l,query:e,datasource:s,variableOptionGroup:r,onQueryChange:a,setError:i}),o.createElement(or,{query:e,datasource:s,variableOptionGroup:r,onQueryChange:a,setError:i,aggregationOptions:c?.aggOptions??[],isLoading:c.isLoading}),o.createElement(ur,{query:e,datasource:s,variableOptionGroup:r,onQueryChange:a,setError:i,timeGrainOptions:c?.timeGrains??[]}))),o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement(ir,{data:t,query:e,datasource:s,variableOptionGroup:r,onQueryChange:a,setError:i,dimensionOptions:c?.dimensions??[]}))),o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement(mr,{query:e,datasource:s,variableOptionGroup:r,onQueryChange:a,setError:i}),o.createElement(nr,{query:e,datasource:s,variableOptionGroup:r,onQueryChange:a,setError:i})))))};var hr=v(6191),br=v(22354);const vr=({query:t,onQueryChange:e})=>{const s=[{value:m.AzureMonitor,label:"Metrics"},{value:m.LogAnalytics,label:"Logs"},{value:m.AzureTraces,label:"Traces"},{value:m.AzureResourceGraph,label:"Azure Resource Graph"}],r=(0,o.useCallback)(a=>{a.value&&a.value!==t.queryType&&e({refId:t.refId,datasource:t.datasource,queryType:a.value})},[e,t]);return o.createElement("span",{"data-testid":N.components.queryEditor.header.select},o.createElement(hr.X,null,o.createElement(br.W,{label:"Service",value:t.queryType,placeholder:"Service...",allowCustomValue:!0,options:s,onChange:r})))};var yr=v(84596),Lt=v(75505),wr=v(41987),kr=v(43127),Sr=v(88824),zr=v(9261);const We=(t,e,s,r)=>{t==="filters"?e[t]=s.map(a=>a.value):(e[t]=s.value,t==="property"&&(e.filters=[])),r(e)},Er=async(t,e,s,r,a,i,c)=>{const{azureTraces:n}=t;if(!n)return[];const{resources:l}=n;if(!l||!i)return[];const u=i.property;if(!u)return[];const d=`let ${u} = toscalar(union isfuzzy=true ${s.join(",")} | where $__timeFilter(timestamp) | summarize count=count() by ${u} | summarize make_list(pack_all())); print properties = bag_pack("${u}", ${u});`,g=await(0,Lt.s)(e.azureLogAnalyticsDatasource.query({requestId:"azure-traces-properties-req",interval:"",intervalMs:0,scopedVars:{},timezone:"",startTime:0,app:wr.Jk.Unknown,targets:[{...t,azureLogAnalytics:{resources:l,query:d},queryType:m.LogAnalytics}],range:c||(0,kr.E2)()}));if(g.data.length>0){const b=g.data[0];if(b.fields.length>0){const f=JSON.parse(b.fields[0].values.toArray()[0])[u].map(p=>{let y=p[u];return p[u]===""&&(y="
"),{label:y.toString(),value:p[u].toString(),count:p.count}});return r.set(u,f),a(r),f}}return[]};function Ar(t){function e(s,r,a){return o.createElement(Nr,{...t,item:s,onChange:r,onDelete:a})}return e}const Tr=t=>{const{data:e,innerProps:s,innerRef:r,isFocused:a,isSelected:i}=t,c=(0,Z.$j)(),n=(0,Sr.J)(c),l=u=>{t.selectOption({...e}),u.stopPropagation(),u.preventDefault()};return o.createElement("div",{ref:r,className:(0,S.cx)(n.option,a&&n.optionFocused,i&&n.optionSelected,e.isDisabled&&n.optionDisabled),...s,"aria-label":"Select option",title:e.title,onClick:l,onKeyDown:l,role:"checkbox","aria-checked":i,tabIndex:0},o.createElement("div",{className:n.optionBody},o.createElement(gt.S,{value:i,label:e.label?`${e.label} - (${e.count})`:""})))},Nr=t=>{const{query:e,datasource:s,propertyMap:r,setPropertyMap:a,queryTraceTypes:i,properties:c,item:n,onChange:l,onDelete:u,variableOptionGroup:d,range:g}=t,[b,h]=(0,o.useState)(!1),[f,p]=(0,o.useState)(R(r.get(n.property??"")??[],d)),[y,w]=(0,o.useState)(n.filters?n.filters.map(E=>({value:E,label:E===""?"
":E})):[]),k=async()=>{if(h(!0),n.property&&n.property!==""){const L=r.get(n.property??"");if(L)return p(R(L,d)),h(!1),Promise.resolve(L);{const V=await Er(e,s,i,r,a,n,g);return p(R(V,d)),h(!1),V}}const E=[];return Promise.resolve(E)};return o.createElement(Rt.Gy,{spacing:"none"},o.createElement(D.l6,{menuShouldPortal:!0,placeholder:"Property",value:n.property?{value:n.property,label:n.property}:null,options:R(c.map(E=>({label:E,value:E})),d),onChange:E=>We("property",n,E,l),width:25}),o.createElement(zr.f,{value:n.operation?{label:n.operation==="eq"?"=":"!=",value:n.operation}:void 0,options:[{label:"=",value:"eq"},{label:"!=",value:"ne"}],onChange:E=>We("operation",n,E,l),defaultValue:"eq"}),o.createElement(D.Iv,{blurInputOnSelect:!1,menuShouldPortal:!0,placeholder:"Value",value:y,loadOptions:k,isLoading:b,onOpenMenu:k,onChange:E=>{w(E),E.length===0&&We("filters",n,y,l)},width:35,defaultOptions:f,isClearable:!0,components:{Option:Tr},closeMenuOnSelect:!1,onCloseMenu:()=>We("filters",n,y,l),hideSelectedOptions:!1}),o.createElement(Oe.Z,{"aria-label":"Remove filter",icon:"times",variant:"secondary",onClick:u,type:"button"}))},Ea=null,Mr={availabilityResults:{label:"Availablity Results",description:"Availability test results."},dependencies:{label:"Dependencies",description:"Calls your application makes to other services such as databases or REST APIs."},customEvents:{label:"Custom Events",description:"Calls to TrackEvent that are inserted to monitor usage."},exceptions:{label:"Exceptions",description:"Exceptions that are logged via TrackException, or uncaught exceptions."},pageViews:{label:"Page Views",description:"Web client telemetry to create page view reports."},requests:{label:"Requests",description:"HTTP requests received by the application."},traces:{label:"Traces",description:"Diagnostic logs emitted using TrackTrace and similar methods. Note: Traces are not visualised if the result format is set to Trace"}},Aa={AppAvailabilityResults:"availabilityResults",AppDependencies:"dependencies",AppEvents:"events",AppExceptions:"exceptions",AppPageViews:"pageViews",AppRequests:"requests",AppTraces:"traces"},Rr=["operationId","duration","id","name","problemId","operation_ParentId","timestamp","customDimensions","operation_Name"],Ce={appId:"ResourceGUID",application_Version:"AppVersion",appName:"_ResourceId",client_Browser:"ClientBrowser",client_City:"ClientCity",client_CountryOrRegion:"ClientCountryOrRegion",client_IP:"ClientIP",client_Model:"ClientModel",client_OS:"ClientOS",client_StateOrProvince:"ClientStateOrProvince",client_Type:"ClientType",cloud_RoleInstance:"AppRoleInstance",cloud_RoleName:"AppRoleName",customDimensions:"Properties",customMeasurements:"Measurements",duration:"DurationMs",id:"Id",iKey:"IKey",itemCount:"ItemCount",itemId:"_ItemId",itemType:"Type",name:"Name",operation_Id:"OperationId",operation_Name:"OperationName",operation_ParentId:"OperationParentId",operation_SyntheticSource:"OperationSyntheticSource",performanceBucket:"PerformanceBucket",sdkVersion:"SDKVersion",session_Id:"SessionId",success:"Success",timestamp:"TimeGenerated",user_AccountId:"UserAccountId",user_AuthenticatedId:"UserAuthenticatedId",user_Id:"UserId"},Cr={...Ce,location:"Location",message:"Message",size:"Size"},Ir={...Ce,data:"Data",resultCode:"ResultCode",target:"Target",type:"DependencyType"},Dr=(0,z.omit)(Ce,["duration","id","success","performanceBucket"]),Lr=(0,z.omit)({...Ce,url:"Url"},["success"]),Fr={resultCode:"ResultCode",source:"Source",url:"Url"},Gr=(0,z.omit)({...Ce,assembly:"Assembly",details:"Details",handledAt:"HandledAt",innermostAssembly:"InnermostAssembly",innermostMessage:"InnermostMessage",innermostMethod:"InnermostMethod",innermostType:"InnermostType",message:"Message",method:"Method",outerAssembly:"OuterAssembly",outerMessage:"OuterMessage",outerMethod:"OuterMethod",outerType:"OuterType",problemId:"ProblemId",severityLevel:"SeverityLevel",type:"ExceptionType"},["duration","id","name","performanceBucket","success"]),Pr=(0,z.omit)({message:"Message",severityLevel:"SeverityLevel"},["duration","id","name","performanceBucket","success"]),tt={availabilityResults:Cr,dependencies:Ir,customEvents:Dr,exceptions:Gr,pageViews:Lr,requests:Fr,traces:Pr},Ta=Object.entries(tt).reduce((t,[e,s])=>({...t,[e]:Object.keys((0,z.omit)(s,Rr)).join(",")}),{});function Qr(t,e){return{...t,azureTraces:{...t.azureTraces,operationId:e}}}function xr(t,e){return{...t,azureTraces:{...t.azureTraces,resultFormat:e}}}function Ft(t,e){return{...t,azureTraces:{...t.azureTraces,traceTypes:e}}}function Vr(t,e){return{...t,azureTraces:{...t.azureTraces,filters:e}}}const $r=({query:t,datasource:e,onQueryChange:s,variableOptionGroup:r,range:a})=>{const{azureTraces:i}=t,c=i?.traceTypes?i.traceTypes:Object.keys(tt),n=new Set(["customDimensions","customMeasurements","details","duration","id","itemId","operation_Id","operation_ParentId","timestamp"]),l=(0,z.uniq)(c.map(p=>Object.keys(tt[p])).flat()).filter(p=>!n.has(p)),[u,d]=(0,o.useState)(new Map),g=(0,o.useMemo)(()=>t.azureTraces?.filters??[],[t.azureTraces?.filters]),[b,h]=(0,o.useState)(g);(0,o.useEffect)(()=>{d(new Map)},[t.azureTraces?.resources,t.azureTraces?.traceTypes,t.azureTraces?.operationId]);const f=p=>{let y=!1;const w=p.map(k=>(k.property!==""&&k.filters&&k.filters.length>0&&k.operation!==""?y=!0:y=!1,{property:k.property??"",filters:k.filters??[],operation:k.operation??"eq"}));h(w),(y||g.length>0&&w.length===0)&&s(Vr(t,w))};return o.createElement($.D,{label:"Filters"},o.createElement(Mt.o,{items:b,onChange:f,renderItem:Ar({query:t,datasource:e,propertyMap:u,setPropertyMap:d,queryTraceTypes:c,properties:l,variableOptionGroup:r,range:a})}))},Or=({query:t,variableOptionGroup:e,onQueryChange:s})=>{const r=Object.entries(Mr).map(([n,l])=>({label:l.label,description:l.description,value:n})),a=(0,o.useCallback)(n=>{const l=Ft(t,n.map(u=>u.value??""));s(l)},[s,t]),i=(0,o.useMemo)(()=>[...r,e],[r,e]),c=()=>{const n=r.map(u=>u.value),l=Ft(t,n);return s(l),n};return o.createElement(X,{label:"Event Type"},o.createElement(D.KF,{placeholder:"Choose event types",inputId:"azure-monitor-traces-type-field",value:T([...r,...e.options],t.azureTraces?.traceTypes??c()),onChange:a,options:i,allowCustomValue:!0,isClearable:!0,"aria-label":N.components.queryEditor.tracesQueryEditor.traceTypes.select}))},Ur=({query:t,datasource:e,subscriptionId:s,variableOptionGroup:r,onChange:a,setError:i,range:c})=>{const n=(h,f)=>{if(f.length===0)return!1;const p=j(h.uri,h.location).metricNamespace?.toLowerCase(),y=j(f[0].uri,f[0].location).metricNamespace?.toLowerCase();return p!==y},[l,u]=(0,o.useState)(t.azureTraces?.operationId??""),d=(0,yr.A)(t.azureTraces?.operationId);(0,o.useEffect)(()=>{t.azureTraces?.operationId&&d!==t.azureTraces.operationId&&u(t.azureTraces.operationId)},[u,d,t,l]);const g=(0,o.useCallback)(h=>{h.target instanceof HTMLInputElement&&u(h.target.value)},[]),b=(0,o.useCallback)(h=>{const f=Qr(t,l);a(f)},[a,l,t]);return o.createElement("span",{"data-testid":N.components.queryEditor.tracesQueryEditor.container.input},o.createElement(xe.D,null,o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement(Ze,{query:t,datasource:e,subscriptionId:s,variableOptionGroup:r,onQueryChange:a,setError:i,selectableEntryTypes:[I.Subscription,I.ResourceGroup,I.Resource,I.Variable],resources:t.azureTraces?.resources??[],queryType:"traces",disableRow:n,renderAdvanced:(h,f)=>o.createElement(kt,{resources:h,onChange:f}),selectionNotice:()=>"You may only choose items of the same resource type.",range:c}))),o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement(Or,{datasource:e,onQueryChange:a,query:t,setError:i,variableOptionGroup:r,range:c}),o.createElement(X,{label:"Operation ID"},o.createElement(x.p,{id:"azure-monitor-traces-operation-id-field",value:l,onChange:g,onBlur:b,width:40})))),o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement($r,{datasource:e,onQueryChange:a,query:t,setError:i,variableOptionGroup:r,range:c}))),o.createElement(ee.U,null,o.createElement(te.B,null,o.createElement(dt,{datasource:e,setError:i,query:t,variableOptionGroup:r,onQueryChange:a,inputId:"azure-monitor-traces",options:[{label:"Table",value:K.Table},{label:"Trace",value:K.Trace}],defaultValue:K.Table,setFormatAs:xr,resultFormat:t.azureTraces?.resultFormat,range:c})))))};var Wr=v(32017),jr=v.n(Wr);const Xr="select";function st(t){let e=t;return e.queryType||(e={...e,queryType:m.AzureMonitor}),e=Hr(e),e.queryType===m.AzureMonitor&&e.azureMonitor&&(e=Br(e),e=Kr(e),e=Jr(e),e=Zr(e),e=Yr(e)),(e.azureMonitor?.resourceGroup||e.azureMonitor?.resourceName)&&(e=qr(e)),e.azureLogAnalytics?.resource&&(e={...e,azureLogAnalytics:{...e.azureLogAnalytics,resources:[e.azureLogAnalytics.resource]}},delete e.azureLogAnalytics?.resource),e.azureLogAnalytics&&e.azureLogAnalytics.dashboardTime===void 0&&(e.azureLogAnalytics.intersectTime?e={...e,azureLogAnalytics:{...e.azureLogAnalytics,dashboardTime:!0}}:e={...e,azureLogAnalytics:{...e.azureLogAnalytics,dashboardTime:!1}}),e}function Br(t){let e=t;if(e.azureMonitor?.timeGrainUnit&&e.azureMonitor.timeGrain!=="auto"){const s=U.createISO8601Duration(e.azureMonitor.timeGrain??"auto",e.azureMonitor.timeGrainUnit);e=Nt(e,s),delete e.azureMonitor?.timeGrainUnit}return e}function Hr(t){let e=t;return e.azureLogAnalytics?.query?.match(/\$__from\s/gi)&&(e=Ye(e,e.azureLogAnalytics.query.replace(/\$__from\s/gi,"$__timeFrom() "))),e.azureLogAnalytics?.query?.match(/\$__to\s/gi)&&(e=Ye(e,e.azureLogAnalytics.query.replace(/\$__to\s/gi,"$__timeTo() "))),e}function Kr(t){return!(t.azureMonitor?.metricNamespace&&t.azureMonitor.metricNamespace!==Xr)&&t.azureMonitor?.metricDefinition?{...t,azureMonitor:{...t.azureMonitor,metricNamespace:t.azureMonitor.metricDefinition,metricDefinition:void 0}}:t}function Jr(t){let e=t;const s=e.azureMonitor?.dimension;return s&&s!=="None"&&(e=tr(e,s,"eq",[e.azureMonitor?.dimensionFilter||""])),delete e.azureMonitor?.dimension,delete e.azureMonitor?.dimensionFilter,e}function Zr(t){const e=t.azureMonitor;if(!e)return t;const s=[],r=e.dimensionFilters;return r&&r.length>0&&(r.forEach(a=>{const i={dimension:a.dimension,operator:a.operator};if(!a.filters&&a.filter)s.push({...i,filters:[a.filter]});else{let c=!1;if(a.filters&&a.filter){for(const n of a.filters)if(a.filter===n){c=!0;break}!c&&a.filter!=="*"&&a.filters.push(a.filter),s.push({...i,filters:a.filters})}}}),s.length>0)?{...t,azureMonitor:{...e,dimensionFilters:s}}:t}function Yr(t){if(t.azureMonitor?.resourceUri&&!t.azureMonitor.resourceUri.startsWith("$")){const e=j(t.azureMonitor.resourceUri),s=e?.subscription&&e?.resourceGroup&&e?.resourceName;return{...t,subscription:e?.subscription,azureMonitor:{...t.azureMonitor,resources:[{resourceGroup:e?.resourceGroup,resourceName:e?.resourceName}],metricNamespace:e?.metricNamespace,resourceUri:s?void 0:t.azureMonitor.resourceUri}}}return t}function qr(t){let e=t;return e.azureMonitor?.resourceGroup&&e.azureMonitor?.resourceName&&(e={...e,azureMonitor:{...e.azureMonitor,resources:[{resourceGroup:e.azureMonitor.resourceGroup,resourceName:e.azureMonitor.resourceName}]}},delete e.azureMonitor?.resourceGroup,delete e.azureMonitor?.resourceName),e}const _r={queryType:m.AzureMonitor},eo=t=>{const e=(0,z.defaults)({},t,_r),s=st(e);return jr()(s,t)?t:s},to=(t,e)=>{const s=(0,o.useMemo)(()=>eo(t),[t]);return(0,o.useEffect)(()=>{s!==t&&e(s)},[s,t,e]),s},so=({query:t,datasource:e,onChange:s,onRunQuery:r,data:a,range:i})=>{const[c,n]=lt(),l=(0,o.useMemo)(()=>(0,z.debounce)(r,500),[r]),[u,d]=(0,o.useState)(!1),g=(0,o.useCallback)(p=>{s(p),l()},[s,l]),b=to(t,g),h=b.subscription||e.azureMonitorDatasource.defaultSubscriptionId,f={label:"Template Variables",options:e.getVariables().map(p=>({label:p,value:p}))};return o.createElement("div",{"data-testid":"azure-monitor-query-editor"},o.createElement(Hs,{datasource:e.azureLogAnalyticsDatasource,isOpen:u,onClose:()=>d(!1),onChange:p=>s({...p,queryType:m.LogAnalytics})}),o.createElement("div",{className:(0,S.css)({display:"flex",alignItems:"center"})},o.createElement(vr,{query:b,onQueryChange:g}),b.queryType===m.LogAnalytics&&o.createElement(_.$n,{"aria-label":"Azure logs kick start your query button",variant:"secondary",size:"sm",onClick:()=>{d(p=>!p),(0,Qe.rR)("grafana_azure_logs_query_patterns_opened",{version:"v2",editorMode:b.azureLogAnalytics})}},"Kick start your query")),o.createElement(ro,{data:a,subscriptionId:h,query:b,datasource:e,onChange:g,variableOptionGroup:f,setError:n,range:i}),c&&o.createElement(o.Fragment,null,o.createElement(J.$,{v:2}),o.createElement(H.F,{severity:"error",title:"An error occurred while requesting metadata from Azure Monitor"},c instanceof Error?c.message:c)))},ro=({data:t,subscriptionId:e,query:s,datasource:r,variableOptionGroup:a,onChange:i,setError:c,range:n})=>{switch(s.queryType){case m.AzureMonitor:return o.createElement(gr,{data:t,query:s,datasource:r,onChange:i,variableOptionGroup:a,setError:c});case m.LogAnalytics:return o.createElement(zt,{data:t,subscriptionId:e,query:s,datasource:r,onChange:i,variableOptionGroup:a,setError:c,timeRange:n});case m.AzureResourceGraph:return o.createElement(pt,{subscriptionId:e,query:s,datasource:r,onChange:i,variableOptionGroup:a,setError:c});case m.AzureTraces:return o.createElement(Ur,{subscriptionId:e,query:s,datasource:r,onChange:i,variableOptionGroup:a,setError:c,range:n});default:const l=s.queryType;return o.createElement(H.F,{title:"Unknown query type"},(l==="Application Insights"||l==="Insights Analytics")&&o.createElement(o.Fragment,null,l," was deprecated in Grafana 9. See the"," ",o.createElement("a",{href:"https://grafana.com/docs/grafana/latest/datasources/azuremonitor/deprecated-application-insights/",target:"_blank",rel:"noreferrer"},"deprecation notice")," ","to get more information about how to migrate your queries. This is the current query definition:",o.createElement(Xe.B,{height:"200px",readOnly:!0,language:"json",value:JSON.stringify(s,null,4)})))}},oo=so;var ao=v(45650),io=v(62467),no=v(81160),Gt=v(39070),Ie=v(26657);const co=/([\w\W]+):([\w]+)(?:\s?=\s?([\w\W]+))?/;function lo(t){return t.functions?t.functions.map(e=>{const s=e.parameters&&e.parameters.split(", ").map(r=>{const a=r.match(co);if(!a)return;const[,i,c,n]=a;return{name:i,type:c,defaultValue:n,cslDefaultValue:n}}).filter(r=>!!r);return{name:e.name,body:e.body,inputParameters:s||[]}}):[]}function uo(t,e,s){const r={name:e,tables:t.tables,functions:lo(t),majorVersion:0,minorVersion:0};r.functions.push({name:"$__timeFilter",body:"{ true }",inputParameters:[{name:"timeColumn",type:"System.String",defaultValue:'""',cslDefaultValue:'""'}]},{name:"$__timeFrom",body:"{ datetime(2018-06-05T18:09:58.907Z) }",inputParameters:[]},{name:"$__timeTo",body:"{ datetime(2018-06-05T20:09:58.907Z) }",inputParameters:[]},{name:"$__escapeMulti",body:"{ @'\\grafana-vmNetwork(eth0)Total', @'\\hello!'}",inputParameters:[{name:"$myVar",type:"System.String",defaultValue:"$myVar",cslDefaultValue:"$myVar"}]},{name:"$__contains",body:"{ colName in ('value1','value2') }",inputParameters:[{name:"colName",type:"System.String",defaultValue:"colName",cslDefaultValue:"colName"},{name:"$myVar",type:"System.String",defaultValue:"$myVar",cslDefaultValue:"$myVar"}]});const a=s.map(i=>({name:`$${i.name}`,type:"dynamic"}));return{clusterType:"Engine",cluster:{connectionString:e,databases:[r]},database:r,globalScalarParameters:a}}class mo extends Ie.iy{constructor(e,s=(0,re.w)()){super(e),this.instanceSettings=e,this.templateSrv=s,this.resourcePath=`${F.logAnalytics}`,this.azureMonitorPath=`${F.azureMonitor}/subscriptions`;const r=ct(e);this.azurePortalUrl=nt(r),this.defaultSubscriptionId=this.instanceSettings.jsonData.subscriptionId||""}isConfigured(){return!this.validateDatasource()}filterQuery(e){return e.hide!==!0&&(!!e.azureLogAnalytics?.query&&(!!e.azureLogAnalytics.resources?.length||!!e.azureLogAnalytics.workspace)||!!e.azureTraces?.resources?.length)}async getSubscriptions(){if(!this.isConfigured())return[];const e=`${this.azureMonitorPath}?api-version=2019-03-01`;return await this.getResource(e).then(s=>Q.parseSubscriptions(s))}async getWorkspaces(e){const s=await this.getWorkspaceList(e);return(0,z.map)(s.value,r=>({text:r.name,value:r.id}))||[]}getWorkspaceList(e){const s=this.templateSrv.replace(e||this.defaultSubscriptionId),r=this.azureMonitorPath+`/${s}/providers/Microsoft.OperationalInsights/workspaces?api-version=2017-04-26-preview`;return this.getResource(r)}async getMetadata(e){const s=`${this.resourcePath}/v1${e}/metadata`;return await this.getResource(s)}async getKustoSchema(e){const s=this.templateSrv.replace(e,{},me),r=await this.getMetadata(s);return uo(r,s,this.templateSrv.getVariables())}applyTemplateVariables(e,s){let r;if(e.queryType===m.LogAnalytics&&e.azureLogAnalytics){r=e.azureLogAnalytics;const a=this.expandResourcesForMultipleVariables(r.resources,s);let i=this.templateSrv.replace(r.workspace,s);!i&&!a&&this.firstWorkspace&&(i=this.firstWorkspace);const c=this.templateSrv.replace(r.query,s,me);return{...e,queryType:e.queryType||m.LogAnalytics,azureLogAnalytics:{resultFormat:r.resultFormat,query:c,resources:a,workspace:i,dashboardTime:r.dashboardTime,timeColumn:this.templateSrv.replace(r.timeColumn,s)}}}if(e.queryType===m.AzureTraces&&e.azureTraces){r=e.azureTraces;const a=this.expandResourcesForMultipleVariables(r.resources,s),i=this.templateSrv.replace(r.query,s,me),c=r.traceTypes?.map(l=>this.templateSrv.replace(l,s)),n=(r.filters??[]).filter(l=>!!l.property).map(l=>{const u=l.filters?.map(d=>this.templateSrv.replace(d??"",s));return{property:this.templateSrv.replace(l.property,s),operation:l.operation||"eq",filters:u||[]}});return{...e,queryType:e.queryType||m.AzureTraces,azureTraces:{resultFormat:r.resultFormat,query:i,resources:a,operationId:this.templateSrv.replace(e.azureTraces?.operationId,s),filters:n,traceTypes:c}}}return e}expandResourcesForMultipleVariables(e,s){if(!e)return;const r=[];return e.forEach(a=>{this.templateSrv.replace(a,s,"raw").split(",").forEach(n=>{r.push(n)})}),r}getDeprecatedDefaultWorkSpace(){return this.instanceSettings.jsonData.logAnalyticsDefaultWorkspace}async getDefaultOrFirstSubscription(){return this.defaultSubscriptionId?this.defaultSubscriptionId:(await this.getSubscriptions())[0]?.value}async getFirstWorkspace(){if(this.firstWorkspace)return this.firstWorkspace;const e=await this.getDefaultOrFirstSubscription();if(!e)return;const r=(await this.getWorkspaces(e))[0]?.value;return r&&(this.firstWorkspace=r),r}validateDatasource(){if(Pe(this.instanceSettings)==="clientsecret"){if(!this.isValidConfigField(this.instanceSettings.jsonData.tenantId))return{status:"error",message:"The Tenant Id field is required."};if(!this.isValidConfigField(this.instanceSettings.jsonData.clientId))return{status:"error",message:"The Client Id field is required."}}}isValidConfigField(e){return typeof e=="string"&&e.length>0}async getAzureLogAnalyticsCheatsheetQueries(){return await this.getResource(`${this.resourcePath}/v1/metadata`)}}const po="select";function ke(t){return!!(t&&t!==po)}class fo extends Ie.iy{constructor(e,s=(0,re.w)()){super(e),this.instanceSettings=e,this.templateSrv=s,this.apiVersion="2018-01-01",this.apiPreviewVersion="2017-12-01-preview",this.listByResourceGroupApiVersion="2021-04-01",this.providerApiVersion="2021-04-01",this.locationsApiVersion="2020-01-01",this.defaultSubscriptionId=e.jsonData.subscriptionId;const r=ct(e);this.resourcePath=F.azureMonitor,this.azurePortalUrl=nt(r)}isConfigured(){return!this.validateDatasource()}filterQuery(e){const s=e?.azureMonitor?.resources&&e.azureMonitor.resources.length>0&&e.azureMonitor.resources.every(a=>ke(a.resourceGroup)&&ke(a.resourceName))&&ke(e?.azureMonitor?.metricDefinition||e?.azureMonitor?.metricNamespace),r=ke(e.azureMonitor?.resourceUri);return!!(e.hide!==!0&&(s||r)&&ke(e?.azureMonitor?.metricName)&&ke(e?.azureMonitor?.aggregation))}applyTemplateVariables(e,s){const r=e.azureMonitor;if(!r)throw new Error("Query is not a valid Azure Monitor Metrics query");r.resourceUri&&(r.resourceUri=this.templateSrv.replace(r.resourceUri,s)),r.metricDefinition&&(r.metricDefinition=this.templateSrv.replace(r.metricDefinition,s)),r.timeGrain&&r.timeGrainUnit&&r.timeGrain!=="auto"&&(r.timeGrain=U.createISO8601Duration(r.timeGrain,r.timeGrainUnit));const a=st(e),i=a.azureMonitor;if(!i)throw new Error("Query is not a valid Azure Monitor Metrics query");const c=this.templateSrv.replace(a.subscription||this.defaultSubscriptionId,s),n=i.resources?.map(p=>this.replaceTemplateVariables(p,s)).flat(),l=this.templateSrv.replace(i.metricNamespace,s),u=this.templateSrv.replace(i.customNamespace,s),d=this.templateSrv.replace((i.timeGrain||"").toString(),s),g=this.templateSrv.replace(i.aggregation,s),b=this.templateSrv.replace(i.top||"",s),h=(i.dimensionFilters??[]).filter(p=>p.dimension&&p.dimension!=="None").map(p=>{const y=p.filters?.map(w=>this.templateSrv.replace(w??"",s));return{dimension:this.templateSrv.replace(p.dimension,s),operator:p.operator||"eq",filters:y||[]}}),f={...i,resources:n,metricNamespace:l,customNamespace:u,timeGrain:d,allowedTimeGrainsMs:i.allowedTimeGrainsMs,metricName:this.templateSrv.replace(i.metricName,s),region:this.templateSrv.replace(i.region,s),aggregation:g,dimensionFilters:h,top:b||"10",alias:i.alias};return{...e,subscription:c,queryType:m.AzureMonitor,azureMonitor:f}}async getSubscriptions(){return this.isConfigured()?this.getResource(`${this.resourcePath}/subscriptions?api-version=2019-03-01`).then(e=>Q.parseSubscriptions(e)):[]}getResourceGroups(e){return this.getResource(`${this.resourcePath}/subscriptions/${e}/resourceGroups?api-version=${this.listByResourceGroupApiVersion}`).then(s=>Q.parseResponseValues(s,"name","name"))}async getResourceNames(e,s){const r=this.replaceTemplateVariables(e).map(({metricNamespace:a,subscriptionId:i,resourceGroup:c,region:n})=>{const l=(0,z.startsWith)(a?.toLowerCase(),"microsoft.storage/storageaccounts/")?"microsoft.storage/storageaccounts":a;let u=`${this.resourcePath}/subscriptions/${i}`;c&&(u+=`/resourceGroups/${c}`),u+=`/resources?api-version=${this.listByResourceGroupApiVersion}`;const d=[];return l&&d.push(`resourceType eq '${l}'`),n&&d.push(`location eq '${n}'`),d.length>0&&(u+=`&$filter=${d.join(" and ")}`),s&&(u+=`&$skiptoken=${s}`),this.getResource(u).then(async g=>{let b=[];if((0,z.startsWith)(a?.toLowerCase(),"microsoft.storage/storageaccounts/")){b=Q.parseResourceNames(g,"microsoft.storage/storageaccounts");for(let h=0;h
Q.parseResponseValues(a,"properties.metricNamespaceName","properties.metricNamespaceName")).then(a=>{if(r.toLowerCase().includes("microsoft.storage/storageaccounts")){const i=["microsoft.storage/storageaccounts","microsoft.storage/storageaccounts/blobservices","microsoft.storage/storageaccounts/fileservices","microsoft.storage/storageaccounts/tableservices","microsoft.storage/storageaccounts/queueservices"];for(const c of i)(0,z.find)(a,["value",c.toLowerCase()])||a.push({value:c,text:c})}return a})}getMetricNames(e,s,r){const a=s?this.apiPreviewVersion:this.apiVersion,i=de.buildAzureMonitorGetMetricNamesUrl(this.resourcePath,a,this.replaceSingleTemplateVariables(e),this.templateSrv,s,r);return this.getResource(i).then(c=>Q.parseResponseValues(c,"name.localizedValue","name.value"))}getMetricMetadata(e,s,r){const{metricName:a}=e,i=s?this.apiPreviewVersion:this.apiVersion,c=de.buildAzureMonitorGetMetricNamesUrl(this.resourcePath,i,this.replaceSingleTemplateVariables(e),this.templateSrv,s,r);return this.getResource(c).then(n=>Q.parseMetadata(n,this.templateSrv.replace(a)))}validateDatasource(){if(Pe(this.instanceSettings)==="clientsecret"){if(!this.isValidConfigField(this.instanceSettings.jsonData.tenantId))return{status:"error",message:"The Tenant Id field is required."};if(!this.isValidConfigField(this.instanceSettings.jsonData.clientId))return{status:"error",message:"The Client Id field is required."}}}isValidConfigField(e){return typeof e=="string"&&e.length>0}replaceSingleTemplateVariables(e,s){return this.replaceTemplateVariables(e,s)[0]}replaceTemplateVariables(e,s){const r=[{...e}];return Object.keys(e).forEach(i=>{const c=this.templateSrv.replace(r[0][i],s,"raw");if(c.includes(",")){const n=c.split(","),l=[...r];n.forEach((u,d)=>{l.forEach(g=>{d===0?g[i]=u:r.push({...g,[i]:u})})})}else r.forEach(n=>{n[i]=c})}),r}async getProvider(e){return await this.getResource(`${F.azureMonitor}/providers/${e}?api-version=${this.providerApiVersion}`)}async getLocations(e){const s=new Map;for(const r of e){const a=Q.parseLocations(await this.getResource(`${F.azureMonitor}/subscriptions/${this.templateSrv.replace(r)}/locations?api-version=${this.locationsApiVersion}`));for(const i of a)s.set(i.name,i)}return s}}class go extends Ie.iy{filterQuery(e){return!!e.azureResourceGraph?.query&&!!e.subscriptions&&e.subscriptions.length>0}applyTemplateVariables(e,s){const r=(0,re.w)(),a=e.azureResourceGraph;if(!a)return e;const i=r.getVariables().map(d=>`$${d.name}`),c=ve().find(e.subscriptions,d=>ve().includes(i,d)),l=[...r.replace(c,s,d=>d).split(",").filter(d=>d.length>0),...ve().filter(e.subscriptions,d=>!ve().includes(i,d))],u=r.replace(a.query,s,me);return{...e,queryType:m.AzureResourceGraph,subscriptions:l,azureResourceGraph:{resultFormat:"table",query:u}}}}const ho="/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01",bo=Zs.map(t=>`"${t}"`).join(",");class vo extends Ie.iy{constructor(e,s){super(e),this.resultLimit=200,this.supportedMetricNamespaces="",this.search=async(r,a)=>{let i="resources";a==="logs"&&(i+=` | union resourcecontainers`),i+=` | where id contains "${r}" ${await this.filterByType(a)} | order by tolower(name) asc | limit ${this.resultLimit} `;const{data:c}=await this.makeResourceGraphRequest(i);return c.map(n=>{const l=Ve(n.id);if(!l||!(l.resourceName||l.resourceGroup||l.subscription))throw new Error("unable to fetch resource details");let u=l.subscription??"",d=I.Subscription;return l.resourceName?(u=l.resourceName,d=I.Resource):l.resourceGroup&&(u=l.resourceGroup,d=I.ResourceGroup),{name:n.name,id:u,uri:n.id,resourceGroupName:n.resourceGroup,type:d,typeLabel:_e[n.type]||n.type,location:n.location}})},this.filterByType=async r=>(this.supportedMetricNamespaces===""&&r!=="logs"&&await this.fetchAllNamespaces(),r==="logs"?`| where type in (${bo})`:`| where type in (${this.supportedMetricNamespaces})`),this.resourcePath=`${F.resourceGraph}`,this.azureMonitorDatasource=s}async fetchInitialRows(e,s){const r=await this.getSubscriptions();if(!s)return r;let a=r;const i=s.map(c=>async()=>{if(c.subscription){const n=`/subscriptions/${c.subscription}/resourceGroups/${c.resourceGroup}`;if(c.resourceGroup&&!we(a,n)){const u=await this.getResourceGroupsBySubscriptionId(c.subscription,e);a=Je(a,`/subscriptions/${c.subscription}`,u)}const l=$e(c);if(c.resourceName&&!we(a,l)){const u=await this.getResourcesForResourceGroup(n,e);a=Je(a,n,u)}}});for(const c of i)await c();return a}async fetchAndAppendNestedRow(e,s,r){const a=s.type===I.Subscription?await this.getResourceGroupsBySubscriptionId(s.id,r):await this.getResourcesForResourceGroup(s.uri,r);return Je(e,s.uri,a)}async getSubscriptions(){const e=` resources | join kind=inner ( ResourceContainers | where type == 'microsoft.resources/subscriptions' | project subscriptionName=name, subscriptionURI=id, subscriptionId ) on subscriptionId | summarize count() by subscriptionName, subscriptionURI, subscriptionId | order by subscriptionName desc `;let s=[],r=!1,a;for(;!r;){let i={};a&&(i={$skipToken:a});const c=await this.makeResourceGraphRequest(e,1,i);if(!c.data.length)throw new Error("No subscriptions were found");s=s.concat(c.data),a=c.$skipToken,r=!a}return s.map(i=>({name:i.subscriptionName,id:i.subscriptionId,uri:`/subscriptions/${i.subscriptionId}`,typeLabel:"Subscription",type:I.Subscription,children:[]}))}async getResourceGroupsBySubscriptionId(e,s){const r=` resources | join kind=inner ( ResourceContainers | where type == 'microsoft.resources/subscriptions/resourcegroups' | project resourceGroupURI=id, resourceGroupName=name, resourceGroup, subscriptionId ) on resourceGroup, subscriptionId ${await this.filterByType(s)} | where subscriptionId == '${e}' | summarize count() by resourceGroupName, resourceGroupURI | order by resourceGroupURI asc`;let a=[],i=!1,c;for(;!i;){let n={};c&&(n={$skipToken:c});const l=await this.makeResourceGraphRequest(r,1,n);a=a.concat(l.data),c=l.$skipToken,i=!c}return a.map(n=>{const l=Ve(n.resourceGroupURI);if(!l||!l.resourceGroup)throw new Error("unable to fetch resource groups");return{name:n.resourceGroupName,uri:n.resourceGroupURI,id:l.resourceGroup,type:I.ResourceGroup,typeLabel:"Resource Group",children:[]}})}async getResourcesForResourceGroup(e,s){const{data:r}=await this.makeResourceGraphRequest(` resources | where id hasprefix "${e}/" ${await this.filterByType(s)} `);return r.map(a=>{const i=Ve(a.id);if(!i||!i.resourceName)throw new Error("unable to fetch resource details");return{name:a.name,id:i.resourceName,uri:a.id,resourceGroupName:a.resourceGroup,type:I.Resource,typeLabel:_e[a.type]||a.type,locationDisplayName:a.location,location:a.location}})}async getResourceURIDisplayProperties(e){const{subscription:s,resourceGroup:r,resourceName:a}=j(e)??{};if(!s)throw new Error("Invalid resource URI passed");const i=`/subscriptions/${s}`,c=`${i}/resourceGroups/${r}`,n=` resourcecontainers | where type == "microsoft.resources/subscriptions" | where id =~ "${i}" | project subscriptionName=name, subscriptionId | join kind=leftouter ( resourcecontainers | where type == "microsoft.resources/subscriptions/resourcegroups" | where id =~ "${c}" | project resourceGroupName=name, resourceGroup, subscriptionId ) on subscriptionId | join kind=leftouter ( resources | where id =~ "${e}" | project resourceName=name, subscriptionId ) on subscriptionId | project subscriptionName, resourceGroupName, resourceName `,{data:l}=await this.makeResourceGraphRequest(n);if(!l.length)throw new Error("unable to fetch resource details");const{subscriptionName:u,resourceGroupName:d,resourceName:g}=l[0];return{subscription:u||s,resourceGroup:d||r,resourceName:g||a}}async getResourceURIFromWorkspace(e){const{data:s}=await this.makeResourceGraphRequest(` resources | where properties['customerId'] == "${e}" | project id `);if(!s.length)throw new Error("unable to find resource for workspace "+e);return s[0].id}async makeResourceGraphRequest(e,s=1,r){try{return await this.postResource(this.resourcePath+ho,{query:e,options:{resultFormat:"objectArray",...r}})}catch(a){if(s>0)return this.makeResourceGraphRequest(e,s-1);throw a}}async fetchAllNamespaces(){const e=await this.getSubscriptions();(0,Qe.rR)("grafana_ds_azuremonitor_subscriptions_loaded",{subscriptions:e.length});let s=[];for await(const r of e){const a=await this.azureMonitorDatasource.getMetricNamespaces({resourceUri:`/subscriptions/${r.id}`},!0);if(a){const i=a.map(c=>`"${c.value.toLocaleLowerCase()}"`);s=s.concat(i)}}if(s.length===0)throw new Error("Unable to resolve a list of valid metric namespaces. Validate the datasource configuration is correct and required permissions have been granted for all subscriptions. Grafana requires at least the Reader role to be assigned.");this.supportedMetricNamespaces=(0,z.uniq)(s.concat(Js.map(r=>`"${r}"`))).join(",")}parseRows(e){const s=fe(e),r=[];return s.forEach((a,i)=>{let c=a.resourceName,n=a.resourceName,l=I.Resource;c||(c=a.resourceGroup,n=a.resourceGroup,l=I.ResourceGroup,c||(c=a.subscription,n=a.subscription,l=I.Subscription)),r.push({id:c??"",name:n??"",type:l,uri:$e(a),typeLabel:_e[a.metricNamespace?.toLowerCase()??""]??a.metricNamespace??"",location:a.region})}),r}}function yo(t){const e=typeof t.rawQuery=="string"?t.rawQuery:null,s=typeof t.workspace=="string"?t.workspace:null;if(!(e&&s&&!t.target?.azureLogAnalytics?.query))return t;const r={...t.target??{},refId:t.target?.refId??"Anno",queryType:m.LogAnalytics,azureLogAnalytics:{query:e,resources:[s]}};return{...t,rawQuery:void 0,workspace:void 0,subscription:void 0,queryType:void 0,target:r}}var wo=v(65474),ko=v(29505),ce=v(14236);const Pt=t=>({subscriptions:t.match(/^Subscriptions\(\)/i),resourceGroups:t.match(/^ResourceGroups\(\)/i),resourceGroupsWithSub:t.match(/^ResourceGroups\(([^\)]+?)(,\s?([^,]+?))?\)/i),namespaces:t.match(/^Namespaces\(([^\)]+?)(,\s?([^,]+?))?\)/i),namespacesWithSub:t.match(/^Namespaces\(([^,]+?),\s?([^,]+?)\)/i),resourceNames:t.match(/^ResourceNames\(([^,]+?),\s?([^,]+?)\)/i),resourceNamesWithSub:t.match(/^ResourceNames\(([^,]+?),\s?([^,]+?),\s?(.+?)\)/i),metricNamespace:t.match(/^MetricNamespace\(([^,]+?),\s?([^,]+?),\s?([^,]+?)\)/i),metricNamespaceWithSub:t.match(/^metricnamespace\(([^,]+?),\s?([^,]+?),\s?([^,]+?),\s?([^,]+?)\)/i),metricNames:t.match(/^MetricNames\(([^,]+?),\s?([^,]+?),\s?([^,]+?),\s?([^,]+?)\)/i),metricNamesWithSub:t.match(/^MetricNames\(([^,]+?),\s?([^,]+?),\s?([^,]+?),\s?([^,]+?),\s?(.+?)\)/i),appInsightsMetricNameQuery:t.match(/^AppInsightsMetricNames\(\)/i),appInsightsGroupByQuery:t.match(/^AppInsightsGroupBys\(([^\)]+?)(,\s?([^,]+?))?\)/i),workspacesQuery:t.match(/^workspaces\(\)/i),workspacesQueryWithSub:t.match(/^workspaces\(["']?([^\)]+?)["']?\)/i)}),So=t=>{const e=Pt(t);return Object.keys(e).some(s=>!!e[s])},zo=(t,e)=>{const s=Pt(t),r=e.azureMonitorDatasource.defaultSubscriptionId,a=()=>s.appInsightsMetricNameQuery?{rawQuery:t,kind:"AppInsightsMetricNameQuery"}:s.appInsightsGroupByQuery?{kind:"AppInsightsGroupByQuery",rawQuery:t,metricName:s.appInsightsGroupByQuery[1]}:s.subscriptions?{kind:"SubscriptionsQuery",rawQuery:t}:s.resourceGroupsWithSub?{kind:"ResourceGroupsQuery",rawQuery:t,subscription:s.resourceGroupsWithSub[1]}:s.resourceGroups&&r?{kind:"ResourceGroupsQuery",rawQuery:t,subscription:r}:s.namespacesWithSub?{kind:"MetricNamespaceQuery",rawQuery:t,subscription:s.namespacesWithSub[1],resourceGroup:s.namespacesWithSub[2]}:s.namespaces&&r?{kind:"MetricNamespaceQuery",rawQuery:t,subscription:r,resourceGroup:s.namespaces[1]}:s.resourceNamesWithSub?{kind:"ResourceNamesQuery",rawQuery:t,subscription:s.resourceNamesWithSub[1],resourceGroup:s.resourceNamesWithSub[2],metricNamespace:s.resourceNamesWithSub[3]}:s.resourceNames&&r?{kind:"ResourceNamesQuery",rawQuery:t,subscription:r,resourceGroup:s.resourceNames[1],metricNamespace:s.resourceNames[2]}:s.metricNamespaceWithSub?{kind:"MetricNamespaceQuery",rawQuery:t,subscription:s.metricNamespaceWithSub[1],resourceGroup:s.metricNamespaceWithSub[2],metricNamespace:s.metricNamespaceWithSub[3],resourceName:s.metricNamespaceWithSub[4]}:s.metricNamespace&&r?{kind:"MetricNamespaceQuery",rawQuery:t,subscription:r,resourceGroup:s.metricNamespace[1],metricNamespace:s.metricNamespace[2],resourceName:s.metricNamespace[3]}:s.metricNames&&r&&s.metricNames[3].indexOf(",")===-1?{kind:"MetricNamesQuery",rawQuery:t,subscription:r,resourceGroup:s.metricNames[1],metricNamespace:s.metricNames[2],resourceName:s.metricNames[3]}:s.metricNamesWithSub?{kind:"MetricNamesQuery",rawQuery:t,subscription:s.metricNamesWithSub[1],resourceGroup:s.metricNamesWithSub[2],metricNamespace:s.metricNamesWithSub[3],resourceName:s.metricNamesWithSub[4]}:s.workspacesQueryWithSub?{kind:"WorkspacesQuery",rawQuery:t,subscription:(s.workspacesQueryWithSub[1]||"").trim()}:s.workspacesQuery&&r?{kind:"WorkspacesQuery",rawQuery:t,subscription:r}:{kind:"SubscriptionsQuery",rawQuery:t};return{refId:"A",queryType:m.GrafanaTemplateVariableFn,grafanaTemplateVariableFn:a(),subscription:r}},Eo=async(t,e)=>{const s=e.azureMonitorDatasource.defaultSubscriptionId;let r="";if(t){const a=e.azureLogAnalyticsDatasource.getDeprecatedDefaultWorkSpace();a?ht(a)?r=await e.resourcePickerData.getResourceURIFromWorkspace(a):r=a:r=await e.azureLogAnalyticsDatasource.getFirstWorkspace()||""}return{refId:"A",queryType:m.LogAnalytics,azureLogAnalytics:{query:t,resources:r?[r]:[]},subscription:s}},Ao=t=>{const{queryType:e,grafanaTemplateVariableFn:s}=t;if(e!==m.GrafanaTemplateVariableFn||!s)return t;const r={...t};switch("subscription"in s&&(r.subscription=s.subscription),"resourceGroup"in s&&(r.resourceGroup=s.resourceGroup),"metricNamespace"in s&&(r.namespace=s.metricNamespace),"resourceName"in s&&(r.resource=s.resourceName),s.kind){case"SubscriptionsQuery":r.queryType=m.SubscriptionsQuery;break;case"ResourceGroupsQuery":r.queryType=m.ResourceGroupsQuery;break;case"ResourceNamesQuery":r.queryType=m.ResourceNamesQuery;break;case"MetricNamespaceQuery":r.queryType=m.NamespacesQuery;break;case"MetricDefinitionsQuery":r.queryType=m.NamespacesQuery;break;case"MetricNamesQuery":r.queryType=m.MetricNamesQuery;break;case"WorkspacesQuery":r.queryType=m.WorkspacesQuery;break}return r},Qt=async(t,e)=>typeof t!="string"?t:So(t)?zo(t,e.datasource):Eo(t,e.datasource),xt=async(t,e)=>{let s=await Qt(t,e);return s.queryType===m.GrafanaTemplateVariableFn&&(s=Ao(s)),s},To=({query:t,updateQuery:e,datasource:s})=>{const[r,a]=(0,o.useState)("");(0,o.useEffect)(()=>{a(t.grafanaTemplateVariableFn?.rawQuery||"")},[t.grafanaTemplateVariableFn?.rawQuery]);const i=(0,o.useCallback)(n=>{Qt(n,{datasource:s}).then(l=>{l.queryType===m.GrafanaTemplateVariableFn?e(l):e({...t,grafanaTemplateVariableFn:{kind:"UnknownQuery",rawQuery:n}})})},[s,t,e]),c=n=>{a(n.target.value)};return o.createElement(oe.I,{label:"Grafana template variable function"},o.createElement(x.p,{placeholder:"type a grafana template variable function, ex: Subscriptions()",value:r,onChange:c,onBlur:()=>i(r)}))},Vt={label:"-",value:""},No=t=>{const{query:e,onChange:s,datasource:r}=t,a=[{label:"Subscriptions",value:m.SubscriptionsQuery},{label:"Resource Groups",value:m.ResourceGroupsQuery},{label:"Namespaces",value:m.NamespacesQuery},{label:"Regions",value:m.LocationsQuery},{label:"Resource Names",value:m.ResourceNamesQuery},{label:"Metric Names",value:m.MetricNamesQuery},{label:"Workspaces",value:m.WorkspacesQuery},{label:"Resource Graph",value:m.AzureResourceGraph},{label:"Logs",value:m.LogAnalytics}];typeof t.query=="object"&&t.query.queryType===m.GrafanaTemplateVariableFn&&a.push({label:"Grafana Query Function",value:m.GrafanaTemplateVariableFn});const[i,c]=(0,o.useState)({label:"Template Variables",options:[]}),[n,l]=(0,o.useState)(!1),[u,d]=(0,o.useState)(!1),[g,b]=(0,o.useState)(!1),[h,f]=(0,o.useState)(!1),[p,y]=(0,o.useState)(!1),[w,k]=(0,o.useState)(!1),[E,L]=(0,o.useState)(!1),[V,le]=(0,o.useState)([]),[se,De]=(0,o.useState)([]),[Le,je]=(0,o.useState)([]),[rt,ot]=(0,o.useState)([]),[A,P]=(0,o.useState)([]),[O,Se]=lt(),ge=typeof e=="string"?"":e.queryType;(0,o.useEffect)(()=>{xt(e,{datasource:r}).then(M=>{(0,z.isEqual)(e,M)||s(M)})},[e,r,s]),(0,o.useEffect)(()=>{switch(l(!1),d(!1),b(!1),y(!1),k(!1),L(!1),ge){case m.ResourceGroupsQuery:case m.WorkspacesQuery:l(!0);break;case m.NamespacesQuery:l(!0),d(!0);break;case m.ResourceNamesQuery:l(!0),d(!0),b(!0),f(!0);break;case m.MetricNamesQuery:l(!0),y(!0),k(!0),L(!0);break;case m.LocationsQuery:l(!0);break}},[ge]),(0,o.useEffect)(()=>{const M=[];r.getVariablesRaw().forEach(G=>{(0,z.get)(G,"query.queryType")!==ge&&M.push({label:G.label||G.name,value:`$${G.name}`})}),c({label:"Template Variables",options:M})},[r,ge]),(0,pe.A)(()=>{r.getSubscriptions().then(M=>{le(M.map(G=>({label:G.text,value:G.value})))})});const B=typeof e=="object"&&e.subscription;(0,o.useEffect)(()=>{B&&r.getResourceGroups(B).then(M=>{De(M.map(G=>({label:G.text,value:G.value})))})},[r,B]);const Fe=typeof e=="object"&&e.resourceGroup||"";(0,o.useEffect)(()=>{B&&r.getMetricNamespaces(B,Fe).then(M=>{je(M.map(G=>({label:G.text,value:G.value})))})},[r,B,Fe]),(0,o.useEffect)(()=>{B&&r.azureMonitorDatasource.getLocations([B]).then(M=>{const G=[];M.forEach(Ut=>G.push({label:Ut.displayName,value:Ut.name})),P(G)})},[r,B,Fe]);const $t=typeof e=="object"&&e.namespace||"";if((0,o.useEffect)(()=>{B&&r.getResourceNames(B,Fe,$t).then(M=>{ot(M.map(G=>({label:G.text,value:G.value})))})},[r,B,Fe,$t]),typeof e=="string")return null;const Fo=M=>{M.value&&s({...e,queryType:M.value,subscription:void 0,resourceGroup:void 0,namespace:void 0,resource:void 0})},Go=M=>{M.value&&s({...e,subscription:M.value,resourceGroup:void 0,namespace:void 0,resource:void 0})},Po=M=>{s({...e,resourceGroup:M.value,namespace:void 0,resource:void 0})},Qo=M=>{s({...e,namespace:M.value,resource:void 0})},xo=M=>{s({...e,region:M.value})},Vo=M=>{s({...e,resource:M.value})},Ot=M=>{s(M)};return o.createElement(o.Fragment,null,o.createElement($.D,{label:"Query Type","data-testid":N.components.variableEditor.queryType.input},o.createElement(D.l6,{"aria-label":"select query type",onChange:Fo,options:a,width:25,value:ge})),e.queryType===m.LogAnalytics&&o.createElement(o.Fragment,null,o.createElement(zt,{subscriptionId:e.subscription,query:e,datasource:r,onChange:Ot,variableOptionGroup:i,setError:Se,hideFormatAs:!0}),O&&o.createElement(o.Fragment,null,o.createElement(J.$,{v:2}),o.createElement(H.F,{severity:"error",title:"An error occurred while requesting metadata from Azure Monitor"},O instanceof Error?O.message:O))),e.queryType===m.GrafanaTemplateVariableFn&&o.createElement(To,{query:e,updateQuery:t.onChange,datasource:r}),n&&o.createElement($.D,{label:"Subscription","data-testid":N.components.variableEditor.subscription.input},o.createElement(D.l6,{"aria-label":"select subscription",onChange:Go,options:V.concat(i),width:25,value:e.subscription||null})),(p||u)&&o.createElement($.D,{label:"Resource Group","data-testid":N.components.variableEditor.resourceGroup.input},o.createElement(D.l6,{"aria-label":"select resource group",onChange:Po,options:p?se.concat(i):se.concat(i,Vt),width:25,value:e.resourceGroup||null,placeholder:p?void 0:"Optional"})),(w||g)&&o.createElement($.D,{label:"Namespace","data-testid":N.components.variableEditor.namespace.input},o.createElement(D.l6,{"aria-label":"select namespace",onChange:Qo,options:w?Le.concat(i):Le.concat(i,Vt),width:25,value:e.namespace||null,placeholder:w?void 0:"Optional"})),h&&o.createElement($.D,{label:"Region","data-testid":N.components.variableEditor.region.input},o.createElement(D.l6,{"aria-label":"select region",onChange:xo,options:A.concat(i),width:25,value:e.region||null,placeholder:"Optional"})),E&&o.createElement($.D,{label:"Resource","data-testid":N.components.variableEditor.resource.input},o.createElement(D.l6,{"aria-label":"select resource",onChange:Vo,options:rt.concat(i),width:25,value:e.resource||null})),e.queryType===m.AzureResourceGraph&&o.createElement(o.Fragment,null,o.createElement(pt,{subscriptionId:r.azureLogAnalyticsDatasource.defaultSubscriptionId,query:e,datasource:r,onChange:Ot,variableOptionGroup:i,setError:Se}),O&&o.createElement(o.Fragment,null,o.createElement(J.$,{v:2}),o.createElement(H.F,{severity:"error",title:"An error occurred while requesting metadata from Azure Monitor"},O instanceof Error?O.message:O))))};class Mo extends ko.f5{constructor(e,s=(0,re.w)()){super(),this.datasource=e,this.templateSrv=s,this.editor=No,this.datasource=e}hasValue(...e){return e.every(s=>!!this.templateSrv.replace(s))}query(e){const s=async()=>{const r=await xt(e.targets[0],{datasource:this.datasource});try{switch(r.queryType){case m.SubscriptionsQuery:const a=await this.datasource.getSubscriptions();return{data:a?.length?[(0,ce.Vc)(a)]:[]};case m.ResourceGroupsQuery:if(r.subscription&&this.hasValue(r.subscription)){const c=await this.datasource.getResourceGroups(r.subscription);return{data:c?.length?[(0,ce.Vc)(c)]:[]}}return{data:[]};case m.NamespacesQuery:if(r.subscription&&this.hasValue(r.subscription)){const c=await this.datasource.getMetricNamespaces(r.subscription,r.resourceGroup);return{data:c?.length?[(0,ce.Vc)(c)]:[]}}return{data:[]};case m.ResourceNamesQuery:if(r.subscription&&this.hasValue(r.subscription)){const c=await this.datasource.getResourceNames(r.subscription,r.resourceGroup,r.namespace,r.region);return{data:c?.length?[(0,ce.Vc)(c)]:[]}}return{data:[]};case m.MetricNamesQuery:if(r.subscription&&r.resourceGroup&&r.namespace&&r.resource&&this.hasValue(r.subscription,r.resourceGroup,r.namespace,r.resource)){const c=await this.datasource.getMetricNames(r.subscription,r.resourceGroup,r.namespace,r.resource);return{data:c?.length?[(0,ce.Vc)(c)]:[]}}return{data:[]};case m.WorkspacesQuery:if(r.subscription&&this.hasValue(r.subscription)){const c=await this.datasource.getAzureLogAnalyticsWorkspaces(r.subscription);return{data:c?.length?[(0,ce.Vc)(c)]:[]}}return{data:[]};case m.GrafanaTemplateVariableFn:if(r.grafanaTemplateVariableFn){const c=await this.callGrafanaTemplateVariableFn(r.grafanaTemplateVariableFn);return{data:c?.length?[(0,ce.Vc)(c)]:[]}}return{data:[]};case m.LocationsQuery:if(r.subscription&&this.hasValue(r.subscription)){const c=await this.datasource.azureMonitorDatasource.getLocations([r.subscription]),n=[];return c.forEach(l=>{n.push({text:l.displayName,value:l.name})}),{data:n?.length?[(0,ce.Vc)(n)]:[]}}default:e.targets[0]=r;const i=await(0,Lt.s)(this.datasource.query(e));return{data:i.data,error:i.error?new Error(ye(i.error)):void 0}}}catch(a){return{data:[],error:new Error(ye(a))}}};return(0,wo.H)(s())}callGrafanaTemplateVariableFn(e){return e.kind==="SubscriptionsQuery"?this.datasource.getSubscriptions():e.kind==="ResourceGroupsQuery"?this.datasource.getResourceGroups(this.replaceVariable(e.subscription)):e.kind==="ResourceNamesQuery"?this.datasource.getResourceNames(this.replaceVariable(e.subscription),this.replaceVariable(e.resourceGroup),this.replaceVariable(e.metricNamespace)):e.kind==="MetricNamespaceQuery"?this.datasource.azureMonitorDatasource.getMetricNamespaces(e,!0):e.kind==="MetricNamesQuery"?this.datasource.azureMonitorDatasource.getMetricNames(e):e.kind==="WorkspacesQuery"?this.datasource.azureLogAnalyticsDatasource.getWorkspaces(this.replaceVariable(e.subscription)):null}replaceVariable(e){return this.templateSrv.replace((e||"").trim())}}class Ro extends Ie.iy{constructor(e,s=(0,re.w)()){super(e),this.templateSrv=s,this.annotations={prepareAnnotation:yo},this.pseudoDatasource={},this.azureMonitorDatasource=new fo(e),this.azureLogAnalyticsDatasource=new mo(e),this.azureResourceGraphDatasource=new go(e),this.resourcePickerData=new vo(e,this.azureMonitorDatasource),this.pseudoDatasource={[m.AzureMonitor]:this.azureMonitorDatasource,[m.LogAnalytics]:this.azureLogAnalyticsDatasource,[m.AzureResourceGraph]:this.azureResourceGraphDatasource},this.variables=new Mo(this)}filterQuery(e){return e.queryType?this.pseudoDatasource[e.queryType]?.filterQuery?.(e)??!0:!1}query(e){const s=new Map;for(const a of e.targets){const i=st(a);if(!i.queryType||i.hide||!Co(i))continue;if(!s.has(i.queryType)){const n=(0,z.cloneDeep)(e);n.requestId=`${n.requestId}-${i.refId}`,n.targets=[],s.set(i.queryType,n)}s.get(i.queryType)?.targets.push(i)}const r=Array.from(s.entries()).map(([a,i])=>{const c=a===m.AzureTraces?m.LogAnalytics:a,n=this.pseudoDatasource[c];if(!n)throw new Error("Data source not created for query type "+a);return n.query(i)});return r.length===1?r[0]:r.length>1?(0,ao.p)(r).pipe((0,no.T)(a=>{const i=[];for(const c of a)for(const n of c.data)i.push(n);return{state:Gt.Gu.Done,data:i}})):(0,io.of)({state:Gt.Gu.Done,data:[]})}targetContainsTemplate(e){if(e.subscription&&this.templateSrv.containsTemplate(e.subscription))return!0;let s;return e.queryType===m.AzureMonitor?s=JSON.stringify(e.azureMonitor):e.queryType===m.LogAnalytics?s=JSON.stringify(e.azureLogAnalytics):e.queryType===m.AzureResourceGraph&&(s=JSON.stringify([e.azureResourceGraph,e.subscriptions])),!!s&&this.templateSrv.containsTemplate(s)}getResourceGroups(e){return this.azureMonitorDatasource.getResourceGroups(this.templateSrv.replace(e))}getMetricNamespaces(e,s){let r=`/subscriptions/${e}`;return s&&(r+=`/resourceGroups/${s};`),this.azureMonitorDatasource.getMetricNamespaces({resourceUri:r},!0)}getResourceNames(e,s,r,a){return this.azureMonitorDatasource.getResourceNames({subscriptionId:e,resourceGroup:s,metricNamespace:r,region:a})}getMetricNames(e,s,r,a){return this.azureMonitorDatasource.getMetricNames({subscription:e,resourceGroup:s,metricNamespace:r,resourceName:a})}getAzureLogAnalyticsWorkspaces(e){return this.azureLogAnalyticsDatasource.getWorkspaces(e)}getSubscriptions(){return this.azureMonitorDatasource.getSubscriptions()}interpolateVariablesInQueries(e,s){return e.map(a=>{if(!a.queryType)return a;const i=a.queryType===m.AzureTraces?m.LogAnalytics:a.queryType,c=this.pseudoDatasource[i];return{datasource:c?.getRef(),...c?.applyTemplateVariables(a,s)??a}})}getVariables(){return this.templateSrv.getVariables().map(e=>`$${e.name}`)}getVariablesRaw(){return this.templateSrv.getVariables()}modifyQuery(e,s){if(!s.options)return e;let r=e.azureLogAnalytics?.query;if(r===void 0)return e;switch(s.type){case"ADD_FILTER":{r+=` | where ${s.options.key} == "${s.options.value}"`;break}case"ADD_FILTER_OUT":{r+=` | where ${s.options.key} != "${s.options.value}"`;break}}return{...e,azureLogAnalytics:{...e.azureLogAnalytics,query:r}}}}function Co(t){switch(t.queryType){case m.AzureMonitor:return!!t.azureMonitor;case m.LogAnalytics:return!!t.azureLogAnalytics;case m.AzureResourceGraph:return!!t.azureResourceGraph;case m.AzureTraces:return!!t.azureTraces;case m.GrafanaTemplateVariableFn:return!!t.grafanaTemplateVariableFn;default:return!1}}var Io=v(83572);const Do=t=>{(0,Qe.rR)("grafana_ds_azuremonitor_dashboard_loaded",t)},Lo=new Y.tD(Ro).setConfigEditor(qt).setQueryEditor(oo);(0,ue.J7)().subscribe(q.gc,({payload:{dashboardId:t,orgId:e,userId:s,grafanaVersion:r,queries:a}})=>{const i=a[Io.id],c={hidden:0,visible:0,multiResource:0,count:0};let n={[m.AzureMonitor]:{...c},[m.LogAnalytics]:{...c,grafanaTime:0,queryTime:0},[m.AzureResourceGraph]:{...c},[m.AzureTraces]:{...c,table:0,trace:0,operationIdSpecified:0,eventTypesSpecified:0,filtersSpecified:0},[m.SubscriptionsQuery]:{...c},[m.ResourceGroupsQuery]:{...c},[m.NamespacesQuery]:{...c},[m.ResourceNamesQuery]:{...c},[m.MetricNamesQuery]:{...c},[m.WorkspacesQuery]:{...c},[m.GrafanaTemplateVariableFn]:{...c},[m.LocationsQuery]:{...c},unknown:{...c}};i.forEach(l=>{switch(l.queryType===m.AzureMonitor&&(n[m.AzureMonitor][l.hide?"hidden":"visible"]++,l.azureMonitor?.resources&&l.azureMonitor.resources.length>1&&n[m.AzureMonitor].multiResource++),l.queryType===m.LogAnalytics&&(n[m.LogAnalytics][l.hide?"hidden":"visible"]++,n[m.LogAnalytics][l.azureLogAnalytics?.dashboardTime?"grafanaTime":"queryTime"]++,l.azureLogAnalytics?.resources&&l.azureLogAnalytics.resources.length>1&&n[m.LogAnalytics].multiResource++),l.queryType===m.AzureResourceGraph&&(n[m.AzureResourceGraph][l.hide?"hidden":"visible"]++,l.subscriptions&&l.subscriptions.length>1&&n[m.AzureResourceGraph].multiResource++),l.queryType===m.AzureTraces&&(n[m.AzureTraces][l.hide?"hidden":"visible"]++,l.azureTraces&&(l.azureTraces.resultFormat&&n[m.AzureTraces][l.azureTraces.resultFormat===K.Trace?K.Trace:K.Table]++,l.azureTraces.resources&&l.azureTraces.resources.length>1&&n[m.AzureTraces].multiResource++,l.azureTraces.operationId&&l.azureTraces.operationId!==""&&n[m.AzureTraces].operationIdSpecified++,l.azureTraces.traceTypes&&l.azureTraces.traceTypes.length>0&&n[m.AzureTraces].eventTypesSpecified++,l.azureTraces.filters&&l.azureTraces.filters.length>0&&n[m.AzureTraces].filtersSpecified++)),l.queryType){case m.AzureMonitor:case m.LogAnalytics:case m.AzureResourceGraph:case m.AzureTraces:case m.SubscriptionsQuery:case m.ResourceGroupsQuery:case m.NamespacesQuery:case m.ResourceNamesQuery:case m.MetricNamesQuery:case m.WorkspacesQuery:case m.GrafanaTemplateVariableFn:case m.LocationsQuery:n[l.queryType].count++;break;default:n.unknown.count++}}),i&&i.length>0&&Do({grafana_version:r,dashboard_id:t,org_id:e,azure_monitor_queries:n[m.AzureMonitor].visible,azure_monitor_queries_hidden:n[m.AzureMonitor].hidden,azure_monitor_multiple_resource:n[m.AzureMonitor].multiResource,azure_monitor_query:n[m.AzureMonitor].count,azure_log_analytics_queries:n[m.LogAnalytics].visible,azure_log_analytics_queries_hidden:n[m.LogAnalytics].hidden,azure_log_multiple_resource:n[m.LogAnalytics].multiResource,azure_log_analytics_queries_grafana_time:n[m.LogAnalytics].grafanaTime,azure_log_analytics_queries_query_time:n[m.LogAnalytics].queryTime,azure_log_query:n[m.LogAnalytics].count,azure_resource_graph_queries:n[m.AzureResourceGraph].visible,azure_resource_graph_queries_hidden:n[m.AzureResourceGraph].hidden,azure_resource_graph_multiple_subscription:n[m.AzureResourceGraph].multiResource,azure_resource_graph_query:n[m.AzureResourceGraph].count,azure_traces_queries:n[m.AzureTraces].visible,azure_traces_queries_hidden:n[m.AzureTraces].hidden,azure_traces_multiple_resource:n[m.AzureTraces].multiResource,azure_traces_table:n[m.AzureTraces].table,azure_traces_trace:n[m.AzureTraces].trace,azure_traces_operation_id_specified:n[m.AzureTraces].operationIdSpecified,azure_traces_event_type_specified:n[m.AzureTraces].eventTypesSpecified,azure_traces_filters:n[m.AzureTraces].filtersSpecified,azure_traces_query:n[m.AzureTraces].count,azure_subscriptions_query:n[m.SubscriptionsQuery].count,azure_resource_groups_query:n[m.ResourceGroupsQuery].count,azure_namespaces_query:n[m.NamespacesQuery].count,azure_resource_names_query:n[m.ResourceNamesQuery].count,azure_metric_names_query:n[m.MetricNamesQuery].count,azure_workspaces_query:n[m.WorkspacesQuery].count,azure_grafana_template_variable_query:n[m.GrafanaTemplateVariableFn].count,azure_locations_query:n[m.LocationsQuery].count,azure_unknown_query:n.unknown.count})})},34169:()=>{}}]); //# sourceMappingURL=6934.fa19d392db34411fb300.js.map