{"version":3,"file":"index.cjs","sources":["../../src/services/backendSrv.ts","../../src/services/AngularLoader.ts","../../src/services/dataSourceSrv.ts","../../src/services/LocationSrv.ts","../../src/services/EchoSrv.ts","../../src/services/templateSrv.ts","../../src/services/legacyAngularInjector.ts","../../src/services/live.ts","../../src/config.ts","../../src/services/LocationService.tsx","../../src/services/appEvents.ts","../../src/analytics/utils.ts","../../src/services/SidecarService_EXPERIMENTAL.ts","../../src/services/SidecarContext_EXPERIMENTAL.ts","../../src/services/pluginExtensions/utils.ts","../../src/services/pluginExtensions/getPluginExtensions.ts","../../src/services/pluginExtensions/usePluginExtensions.ts","../../src/services/pluginExtensions/usePluginComponent.ts","../../src/services/pluginExtensions/usePluginComponents.ts","../../src/services/pluginExtensions/usePluginLinks.ts","../../src/services/pluginExtensions/usePluginFunctions.ts","../../src/services/user.ts","../../src/services/RuntimeDataSource.ts","../../src/services/ScopesContext.ts","../../src/analytics/types.ts","../../src/utils/plugin.ts","../../src/utils/licensing.ts","../../src/utils/logging.ts","../../src/utils/toDataQueryError.ts","../../src/utils/queryResponse.ts","../../src/utils/publicDashboardQueryHandler.ts","../../src/utils/DataSourceWithBackend.ts","../../src/components/PanelRenderer.tsx","../../src/components/PanelDataErrorView.tsx","../../src/services/QueryRunner.ts","../../src/components/PluginPage.tsx","../../src/components/DataSourcePicker.tsx","../../src/analytics/plugins/eventProperties.ts","../../src/analytics/plugins/usePluginInteractionReporter.ts","../../src/utils/returnToPrevious.ts","../../src/utils/chromeHeaderHeight.ts","../../src/components/EmbeddedDashboard.tsx","../../src/utils/rbac.ts","../../src/utils/migrationHandler.ts","../../src/components/QueryEditorWithMigration.tsx","../../src/utils/userStorage.tsx","../../src/components/FolderPicker.tsx","../../src/services/CorrelationsService.ts"],"sourcesContent":["import { Observable } from 'rxjs';\n\n/**\n * Used to initiate a remote call via the {@link BackendSrv}\n *\n * @public\n */\nexport type BackendSrvRequest = {\n  /**\n   * Request URL\n   */\n  url: string;\n\n  /**\n   * Number of times to retry the remote call if it fails.\n   */\n  retry?: number;\n\n  /**\n   * HTTP headers that should be passed along with the remote call.\n   * Please have a look at {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch API}\n   * for supported headers.\n   */\n  headers?: Record<string, any>;\n\n  /**\n   * HTTP verb to perform in the remote call GET, POST, PUT etc.\n   */\n  method?: string;\n\n  /**\n   * Set to false an success application alert box will not be shown for successful PUT, DELETE, POST requests\n   */\n  showSuccessAlert?: boolean;\n\n  /**\n   * Set to false to not show an application alert box for request errors\n   */\n  showErrorAlert?: boolean;\n\n  /**\n   * Provided by the initiator to identify a particular remote call. An example\n   * of this is when a datasource plugin triggers a query. If the request id already\n   * exist the backendSrv will try to cancel and replace the previous call with the\n   * new one.\n   */\n  requestId?: string;\n\n  /**\n   * Set to to true to not include call in query inspector\n   */\n  hideFromInspector?: boolean;\n\n  /**\n   * The data to send\n   */\n  data?: any;\n\n  /**\n   * Query params\n   */\n  params?: Record<string, any>;\n\n  /**\n   * Define how the response object should be parsed.  See:\n   *\n   * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data\n   *\n   * By default values are json parsed from text\n   */\n  responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';\n\n  /**\n   * Used to cancel an open connection\n   * https://developer.mozilla.org/en-US/docs/Web/API/AbortController\n   */\n  abortSignal?: AbortSignal;\n\n  /**\n   * The credentials read-only property of the Request interface indicates whether the user agent should send cookies from the other domain in the case of cross-origin requests.\n   */\n  credentials?: RequestCredentials;\n\n  /**\n   * @deprecated withCredentials is deprecated in favor of credentials\n   */\n  withCredentials?: boolean;\n};\n\n/**\n * Response for fetch function in {@link BackendSrv}\n *\n * @public\n */\nexport interface FetchResponse<T = any> {\n  data: T;\n  readonly status: number;\n  readonly statusText: string;\n  readonly ok: boolean;\n  readonly headers: Headers;\n  readonly redirected: boolean;\n  readonly type: ResponseType;\n  readonly url: string;\n  readonly config: BackendSrvRequest;\n  readonly traceId?: string;\n}\n\n/**\n * Error type for fetch function in {@link BackendSrv}\n *\n * @public\n */\nexport interface FetchErrorDataProps {\n  message?: string;\n  status?: string;\n  error?: string | any;\n}\n\n/**\n * Error type for fetch function in {@link BackendSrv}\n *\n * @public\n */\nexport interface FetchError<T = any> {\n  status: number;\n  statusText?: string;\n  data: T;\n  message?: string;\n  cancelled?: boolean;\n  isHandled?: boolean;\n  config: BackendSrvRequest;\n  traceId?: string;\n}\n\nexport function isFetchError<T = any>(e: unknown): e is FetchError<T> {\n  return typeof e === 'object' && e !== null && 'status' in e && 'data' in e;\n}\n\n/**\n * Used to communicate via http(s) to a remote backend such as the Grafana backend,\n * a datasource etc. The BackendSrv is using the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API | Fetch API}\n * under the hood to handle all the communication.\n *\n * The request function can be used to perform a remote call by specifying a {@link BackendSrvRequest}.\n * To make the BackendSrv a bit easier to use we have added a couple of shorthand functions that will\n * use default values executing the request.\n *\n * @remarks\n * By default, Grafana displays an error message alert if the remote call fails. To prevent this from\n * happening `showErrorAlert = true` on the options object.\n *\n * @public\n */\nexport interface BackendSrv {\n  get<T = any>(url: string, params?: any, requestId?: string, options?: Partial<BackendSrvRequest>): Promise<T>;\n  delete<T = unknown>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;\n  post<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;\n  patch<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;\n  put<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;\n\n  /**\n   * @deprecated Use the `.fetch()` function instead. If you prefer to work with a promise\n   * wrap the Observable returned by fetch with the lastValueFrom function, or use the get|delete|post|patch|put methods.\n   * This method is going to be private from Grafana 10.\n   */\n  request<T = unknown>(options: BackendSrvRequest): Promise<T>;\n\n  /**\n   * Special function used to communicate with datasources that will emit core\n   * events that the Grafana QueryInspector and QueryEditor is listening for to be able\n   * to display datasource query information. Can be skipped by adding `option.silent`\n   * when initializing the request.\n   *\n   * @deprecated Use the fetch function instead\n   */\n  datasourceRequest<T = unknown>(options: BackendSrvRequest): Promise<FetchResponse<T>>;\n\n  /**\n   * Observable http request interface\n   */\n  fetch<T>(options: BackendSrvRequest): Observable<FetchResponse<T>>;\n\n  /**\n   * Observe each raw chunk in the response.  This is useful when reading values from\n   * a long living HTTP connection like the kubernetes WATCH command.\n   *\n   * Each chunk includes the full response headers and the `data` property is filled with the chunk.\n   */\n  chunked(options: BackendSrvRequest): Observable<FetchResponse<Uint8Array | undefined>>;\n}\n\nlet singletonInstance: BackendSrv;\n\n/**\n * Used during startup by Grafana to set the BackendSrv so it is available\n * via the {@link getBackendSrv} to the rest of the application.\n *\n * @internal\n */\nexport const setBackendSrv = (instance: BackendSrv) => {\n  singletonInstance = instance;\n};\n\n/**\n * Used to retrieve the {@link BackendSrv} that can be used to communicate\n * via http(s) to a remote backend such as the Grafana backend, a datasource etc.\n *\n * @public\n */\nexport const getBackendSrv = (): BackendSrv => singletonInstance;\n","/**\n * Used to enable rendering of Angular components within a\n * React component without losing proper typings.\n *\n * @example\n * ```typescript\n * class Component extends PureComponent<Props> {\n *   element: HTMLElement;\n *   angularComponent: AngularComponent;\n *\n *   componentDidMount() {\n *     const template = '<angular-component />' // angular template here;\n *     const scopeProps = { ctrl: angularController }; // angular scope properties here\n *     const loader = getAngularLoader();\n *     this.angularComponent = loader.load(this.element, scopeProps, template);\n *   }\n *\n *   componentWillUnmount() {\n *     if (this.angularComponent) {\n *       this.angularComponent.destroy();\n *     }\n *   }\n *\n *   render() {\n *     return (\n *       <div ref={element => (this.element = element)} />\n *     );\n *   }\n * }\n * ```\n *\n * @public\n */\nexport interface AngularComponent {\n  /**\n   * Should be called when the React component will unmount.\n   */\n  destroy(): void;\n  /**\n   * Can be used to trigger a re-render of the Angular component.\n   */\n  digest(): void;\n  /**\n   * Used to access the Angular scope from the React component.\n   */\n  getScope(): any;\n}\n\n/**\n * Used to load an Angular component from the context of a React component.\n * Please see the {@link AngularComponent} for a proper example.\n *\n * @public\n */\nexport interface AngularLoader {\n  /**\n   *\n   * @param elem - the element that the Angular component will be loaded into.\n   * @param scopeProps - values that will be accessed via the Angular scope.\n   * @param template  - template used by the Angular component.\n   */\n  load(elem: any, scopeProps: any, template: string): AngularComponent;\n}\n\nlet instance: AngularLoader;\n\n/**\n * Used during startup by Grafana to set the AngularLoader so it is available\n * via the {@link getAngularLoader} to the rest of the application.\n *\n * @internal\n */\nexport function setAngularLoader(v: AngularLoader) {\n  instance = v;\n}\n\n/**\n * Used to retrieve the {@link AngularLoader} that enables the use of Angular\n * components within a React component.\n *\n * Please see the {@link AngularComponent} for a proper example.\n *\n * @public\n */\nexport function getAngularLoader(): AngularLoader {\n  return instance;\n}\n","import { ScopedVars, DataSourceApi, DataSourceInstanceSettings, DataSourceRef } from '@grafana/data';\n\nimport { RuntimeDataSource } from './RuntimeDataSource';\n\n/**\n * This is the entry point for communicating with a datasource that is added as\n * a plugin (both external and internal). Via this service you will get access\n * to the {@link @grafana/data#DataSourceApi | DataSourceApi} that have a rich API for\n * communicating with the datasource.\n *\n * @public\n */\nexport interface DataSourceSrv {\n  /**\n   * Returns the requested dataSource. If it cannot be found it rejects the promise.\n   * @param ref - The datasource identifier, it can be a name, UID or DataSourceRef (an object with UID),\n   * @param scopedVars - variables used to interpolate a templated passed as name.\n   */\n  get(ref?: DataSourceRef | string | null, scopedVars?: ScopedVars): Promise<DataSourceApi>;\n\n  /**\n   * Get a list of data sources\n   */\n  getList(filters?: GetDataSourceListFilters): DataSourceInstanceSettings[];\n\n  /**\n   * Get settings and plugin metadata by name or uid\n   */\n  getInstanceSettings(\n    ref?: DataSourceRef | string | null,\n    scopedVars?: ScopedVars\n  ): DataSourceInstanceSettings | undefined;\n\n  /**\n   * Reloads the DataSourceSrv\n   */\n  reload(): void;\n\n  /**\n   * Registers a runtime data source. Make sure your data source uid is unique.\n   */\n  registerRuntimeDataSource(entry: RuntimeDataSourceRegistration): void;\n}\n\nexport interface RuntimeDataSourceRegistration {\n  dataSource: RuntimeDataSource;\n}\n\n/** @public */\nexport interface GetDataSourceListFilters {\n  /** Include mixed data source by setting this to true */\n  mixed?: boolean;\n\n  /** Only return data sources that support metrics response */\n  metrics?: boolean;\n\n  /** Only return data sources that support tracing response */\n  tracing?: boolean;\n\n  /** Only return data sources that support logging response */\n  logs?: boolean;\n\n  /** Only return data sources that support annotations */\n  annotations?: boolean;\n\n  /** Only filter data sources that support alerting */\n  alerting?: boolean;\n\n  /**\n   * By default only data sources that can be queried will be returned. Meaning they have tracing,\n   * metrics, logs or annotations flag set in plugin.json file\n   * */\n  all?: boolean;\n\n  /** Set to true to return dashboard data source */\n  dashboard?: boolean;\n\n  /** Set to true to return data source variables */\n  variables?: boolean;\n\n  /** filter list by plugin  */\n  pluginId?: string;\n\n  /** apply a function to filter */\n  filter?: (dataSource: DataSourceInstanceSettings) => boolean;\n\n  /** Only returns datasources matching the specified types (ie. Loki, Prometheus) */\n  type?: string | string[];\n}\n\nlet singletonInstance: DataSourceSrv;\n\n/**\n * Used during startup by Grafana to set the DataSourceSrv so it is available\n * via the {@link getDataSourceSrv} to the rest of the application.\n *\n * @internal\n */\nexport function setDataSourceSrv(instance: DataSourceSrv) {\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link DataSourceSrv} that is the entry point for communicating with\n * a datasource that is added as a plugin (both external and internal).\n *\n * @public\n */\nexport function getDataSourceSrv(): DataSourceSrv {\n  return singletonInstance;\n}\n","import { UrlQueryMap } from '@grafana/data';\n\n/**\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport interface LocationUpdate {\n  /**\n   * Target path where you automatically wants to navigate the user.\n   */\n  path?: string;\n\n  /**\n   * Specify this value if you want to add values to the query string of the URL.\n   */\n  query?: UrlQueryMap;\n\n  /**\n   * If set to true, the query argument will be added to the existing URL.\n   */\n  partial?: boolean;\n\n  /**\n   * Used internally to sync the Redux state from Angular to make sure that the Redux location\n   * state is in sync when navigating using the Angular router.\n   *\n   * @remarks\n   * Do not change this unless you are the Angular router.\n   *\n   * @internal\n   */\n  routeParams?: UrlQueryMap;\n\n  /*\n   * If set to true, this will replace URL state (ie. cause no new browser history).\n   */\n  replace?: boolean;\n}\n\n/**\n * If you need to automatically navigate the user to a new place in the application this should\n * be done via the LocationSrv and it will make sure to update the application state accordingly.\n *\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport interface LocationSrv {\n  update(options: LocationUpdate): void;\n}\n\nlet singletonInstance: LocationSrv;\n\n/**\n * Used during startup by Grafana to set the LocationSrv so it is available\n * via the {@link getLocationSrv} to the rest of the application.\n *\n * @internal\n */\nexport function setLocationSrv(instance: LocationSrv) {\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link LocationSrv} that can be used to automatically navigate\n * the user to a new place in Grafana.\n *\n * @public\n * @deprecated in favor of {@link locationService} and will be removed in Grafana 9\n */\nexport function getLocationSrv(): LocationSrv {\n  return singletonInstance;\n}\n","/**\n * Describes a size with width/height\n *\n * @public\n */\nexport interface SizeMeta {\n  width: number;\n  height: number;\n}\n\n/**\n * Describes the meta information that are sent together with each event.\n *\n * @public\n */\nexport interface EchoMeta {\n  screenSize: SizeMeta;\n  windowSize: SizeMeta;\n  userAgent: string;\n  url?: string;\n  path?: string;\n  /**\n   * A unique browser session\n   */\n  sessionId: string;\n  /**\n   * The current user's username used to login into Grafana e.g. email.\n   */\n  userLogin: string;\n  /**\n   * The current user's unique identifier.\n   */\n  userId: number;\n  /**\n   * True when user is logged in into Grafana.\n   */\n  userSignedIn: boolean;\n  /**\n   * Current user's role\n   */\n  orgRole: string | '';\n  /**\n   * Current user's org\n   */\n  orgId: number;\n  /**\n   * A millisecond epoch\n   */\n  ts: number;\n  /**\n   * A highres timestamp since navigation start\n   */\n  timeSinceNavigationStart: number;\n}\n\n/**\n * Describes echo backends that can be registered to receive of events.\n *\n * @public\n */\nexport interface EchoBackend<T extends EchoEvent = any, O = any> {\n  options: O;\n  supportedEvents: EchoEventType[];\n  flush: () => void;\n  addEvent: (event: T) => void;\n}\n\n/**\n * Describes an echo event.\n *\n * @public\n */\nexport interface EchoEvent<T extends EchoEventType = any, P = any> {\n  type: EchoEventType;\n  /**\n   * Event payload containing event specific data.\n   */\n  payload: P;\n  meta: EchoMeta;\n}\n\n/**\n * Supported echo event types that can be sent via the {@link EchoSrv}.\n *\n * @public\n */\nexport enum EchoEventType {\n  Performance = 'performance',\n  MetaAnalytics = 'meta-analytics',\n  Pageview = 'pageview',\n  Interaction = 'interaction',\n  ExperimentView = 'experimentview',\n  GrafanaJavascriptAgent = 'grafana-javascript-agent',\n}\n\n/**\n * Used to send events to all the registered backends. This should be accessed via the\n * {@link getEchoSrv} function. Will, by default, flush events to the backends every\n * 10s or when the flush function is triggered.\n *\n * @public\n */\nexport interface EchoSrv {\n  /**\n   * Call this to flush current events to the echo backends.\n   */\n  flush(): void;\n  /**\n   * Add a new echo backend to the list of backends that will receive events.\n   */\n  addBackend(backend: EchoBackend): void;\n  /**\n   * Call this to add event that will be sent to the echo backends upon next\n   * flush.\n   *\n   * @param event - Object containing event information.\n   * @param meta - Object that will extend/override the default meta object.\n   */\n  addEvent<T extends EchoEvent>(event: Omit<T, 'meta'>, meta?: {}): void;\n}\n\nlet singletonInstance: EchoSrv;\n\n/**\n * Used during startup by Grafana to set the EchoSrv so it is available\n * via the {@link getEchoSrv} to the rest of the application.\n *\n * @internal\n */\nexport function setEchoSrv(instance: EchoSrv) {\n  // Check if there were any events reported to the FakeEchoSrv (before the main EchoSrv was initialized), and track them\n  if (singletonInstance instanceof FakeEchoSrv) {\n    for (const item of singletonInstance.buffer) {\n      instance.addEvent(item.event, item.meta);\n    }\n  }\n\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link EchoSrv} that can be used to report events to registered\n * echo backends.\n *\n * @public\n */\nexport function getEchoSrv(): EchoSrv {\n  if (!singletonInstance) {\n    singletonInstance = new FakeEchoSrv();\n  }\n\n  return singletonInstance;\n}\n\n/**\n * Used to register echo backends that will receive Grafana echo events during application\n * runtime.\n *\n * @public\n */\nexport const registerEchoBackend = (backend: EchoBackend) => {\n  getEchoSrv().addBackend(backend);\n};\n\nexport class FakeEchoSrv implements EchoSrv {\n  buffer: Array<{ event: Omit<EchoEvent, 'meta'>; meta?: {} | undefined }> = [];\n\n  flush(): void {\n    this.buffer = [];\n  }\n\n  addBackend(backend: EchoBackend): void {}\n\n  addEvent<T extends EchoEvent>(event: Omit<T, 'meta'>, meta?: {} | undefined): void {\n    this.buffer.push({ event, meta });\n  }\n}\n","import { ScopedVars, TimeRange, TypedVariableModel } from '@grafana/data';\n\n/**\n * Can be used to gain more information about an interpolation operation\n */\nexport interface VariableInterpolation {\n  /** The full matched expression including, example: ${varName.field:regex} */\n  match: string;\n  /** In the expression ${varName.field:regex} variableName is varName */\n  variableName: string;\n  /** In the expression ${varName.fields[0].name:regex} the fieldPath is fields[0].name */\n  fieldPath?: string;\n  /** In the expression ${varName:regex} the regex part is the format */\n  format?: string;\n  /** The formatted value of the variable expresion. Will equal match when variable not found or scopedVar was undefined or null **/\n  value: string;\n  // When value === match this will be true, meaning the variable was not found\n  found?: boolean;\n}\n\n/**\n * Via the TemplateSrv consumers get access to all the available template variables\n * that can be used within the current active dashboard.\n *\n * For a more in-depth description visit: https://grafana.com/docs/grafana/latest/reference/templating\n * @public\n */\nexport interface TemplateSrv {\n  /**\n   * List the dashboard variables\n   */\n  getVariables(): TypedVariableModel[];\n\n  /**\n   * Replace the values within the target string.  See also {@link InterpolateFunction}\n   *\n   * Note: interpolations array is being mutated by replace function by adding information about variables that\n   * have been interpolated during replacement. Variables that were specified in the target but not found in\n   * the list of available variables are also added to the array. See {@link VariableInterpolation} for more details.\n   *\n   * @param {VariableInterpolation[]} interpolations an optional map that is updated with interpolated variables\n   */\n  replace(\n    target?: string,\n    scopedVars?: ScopedVars,\n    format?: string | Function,\n    interpolations?: VariableInterpolation[]\n  ): string;\n\n  /**\n   * Checks if a target contains template variables.\n   */\n  containsTemplate(target?: string): boolean;\n\n  /**\n   * Update the current time range to be used when interpolating __from / __to variables.\n   */\n  updateTimeRange(timeRange: TimeRange): void;\n}\n\nlet singletonInstance: TemplateSrv;\n\n/**\n * Used during startup by Grafana to set the TemplateSrv so it is available\n * via the {@link getTemplateSrv} to the rest of the application.\n *\n * @internal\n */\nexport const setTemplateSrv = (instance: TemplateSrv) => {\n  singletonInstance = instance;\n};\n\n/**\n * Used to retrieve the {@link TemplateSrv} that can be used to fetch available\n * template variables.\n *\n * @public\n */\nexport const getTemplateSrv = (): TemplateSrv => singletonInstance;\n","import { auto } from 'angular';\n\nlet singleton: auto.IInjectorService;\n\n/**\n * Used during startup by Grafana to temporarily expose the angular injector to\n * pure javascript plugins using {@link getLegacyAngularInjector}.\n *\n * @internal\n */\nexport const setLegacyAngularInjector = (instance: auto.IInjectorService) => {\n  singleton = instance;\n};\n\n/**\n * WARNING: this function provides a temporary way for plugins to access anything in the\n * angular injector.  While the migration from angular to react continues, there are a few\n * options that do not yet have good alternatives.  Note that use of this function will\n * be removed in the future.\n *\n * @beta\n */\nexport const getLegacyAngularInjector = (): auto.IInjectorService => singleton;\n","import { Observable } from 'rxjs';\n\nimport {\n  DataFrameJSON,\n  DataQueryRequest,\n  DataQueryResponse,\n  LiveChannelAddress,\n  LiveChannelEvent,\n  LiveChannelPresenceStatus,\n  StreamingFrameOptions,\n} from '@grafana/data';\n\n/**\n * @alpha -- experimental\n */\nexport interface LiveDataFilter {\n  fields?: string[];\n}\n\n// StreamingFrameAction and StreamingFrameOptions are now in @grafana/data\nexport { StreamingFrameAction, type StreamingFrameOptions } from '@grafana/data';\n\n/**\n * @alpha\n */\nexport interface LiveDataStreamOptions {\n  addr: LiveChannelAddress;\n  frame?: DataFrameJSON; // initial results\n  key?: string;\n  buffer?: Partial<StreamingFrameOptions>;\n  filter?: LiveDataFilter;\n}\n\n/**\n * @alpha -- experimental: send a normal query request over websockt\n */\nexport interface LiveQueryDataOptions {\n  request: DataQueryRequest;\n  body: unknown; // processed queries, same as sent to `/api/query/ds`\n}\n\n/**\n * @alpha -- experimental\n */\nexport interface GrafanaLiveSrv {\n  /**\n   * Listen for changes to the main service\n   */\n  getConnectionState(): Observable<boolean>;\n\n  /**\n   * Watch for messages in a channel\n   */\n  getStream<T>(address: LiveChannelAddress): Observable<LiveChannelEvent<T>>;\n\n  /**\n   * Connect to a channel and return results as DataFrames\n   */\n  getDataStream(options: LiveDataStreamOptions): Observable<DataQueryResponse>;\n\n  /**\n   * Execute a query over the live websocket and potentiall subscribe to a live channel.\n   *\n   * Since the initial request and subscription are on the same socket, this will support HA setups\n   *\n   * @alpha -- this function requires the feature toggle `queryOverLive` to be set\n   */\n  getQueryData(options: LiveQueryDataOptions): Observable<DataQueryResponse>;\n\n  /**\n   * For channels that support presence, this will request the current state from the server.\n   *\n   * Join and leave messages will be sent to the open stream\n   */\n  getPresence(address: LiveChannelAddress): Promise<LiveChannelPresenceStatus>;\n\n  /**\n   * Publish into a channel\n   *\n   * @alpha -- experimental\n   */\n  publish(address: LiveChannelAddress, data: unknown): Promise<unknown>;\n}\n\nlet singletonInstance: GrafanaLiveSrv;\n\n/**\n * Used during startup by Grafana to set the GrafanaLiveSrv so it is available\n * via the {@link getGrafanaLiveSrv} to the rest of the application.\n *\n * @internal\n */\nexport const setGrafanaLiveSrv = (instance: GrafanaLiveSrv) => {\n  singletonInstance = instance;\n};\n\n/**\n * Used to retrieve the GrafanaLiveSrv that allows you to subscribe to\n * server side events and streams\n *\n * @alpha -- experimental\n */\nexport const getGrafanaLiveSrv = (): GrafanaLiveSrv => singletonInstance;\n","import { merge } from 'lodash';\n\nimport {\n  AuthSettings,\n  BootData,\n  BuildInfo,\n  DataSourceInstanceSettings,\n  FeatureToggles,\n  GrafanaConfig,\n  GrafanaTheme,\n  GrafanaTheme2,\n  LicenseInfo,\n  MapLayerOptions,\n  OAuthSettings,\n  PanelPluginMeta,\n  systemDateFormats,\n  SystemDateFormatSettings,\n  getThemeById,\n  AngularMeta,\n  PluginLoadingStrategy,\n  PluginDependencies,\n  PluginExtensions,\n} from '@grafana/data';\n\nexport interface AzureSettings {\n  cloud?: string;\n  clouds?: AzureCloudInfo[];\n  managedIdentityEnabled: boolean;\n  workloadIdentityEnabled: boolean;\n  userIdentityEnabled: boolean;\n  userIdentityFallbackCredentialsEnabled: boolean;\n  azureEntraPasswordCredentialsEnabled: boolean;\n}\n\nexport interface AzureCloudInfo {\n  name: string;\n  displayName: string;\n}\n\nexport type AppPluginConfig = {\n  id: string;\n  path: string;\n  version: string;\n  preload: boolean;\n  angular: AngularMeta;\n  loadingStrategy: PluginLoadingStrategy;\n  dependencies: PluginDependencies;\n  extensions: PluginExtensions;\n  moduleHash?: string;\n};\n\nexport type PreinstalledPlugin = {\n  id: string;\n  version: string;\n};\n\nexport class GrafanaBootConfig implements GrafanaConfig {\n  publicDashboardAccessToken?: string;\n  publicDashboardsEnabled = true;\n  snapshotEnabled = true;\n  datasources: { [str: string]: DataSourceInstanceSettings } = {};\n  panels: { [key: string]: PanelPluginMeta } = {};\n  apps: Record<string, AppPluginConfig> = {};\n  auth: AuthSettings = {};\n  minRefreshInterval = '';\n  appUrl = '';\n  appSubUrl = '';\n  namespace = 'default';\n  windowTitlePrefix = '';\n  buildInfo: BuildInfo;\n  newPanelTitle = '';\n  bootData: BootData;\n  externalUserMngLinkUrl = '';\n  externalUserMngLinkName = '';\n  externalUserMngInfo = '';\n  externalUserMngAnalytics = false;\n  externalUserMngAnalyticsParams = '';\n  allowOrgCreate = false;\n  feedbackLinksEnabled = true;\n  disableLoginForm = false;\n  defaultDatasource = ''; // UID\n  angularSupportEnabled = false;\n  authProxyEnabled = false;\n  exploreEnabled = false;\n  queryHistoryEnabled = false;\n  helpEnabled = false;\n  profileEnabled = false;\n  newsFeedEnabled = true;\n  ldapEnabled = false;\n  jwtHeaderName = '';\n  jwtUrlLogin = false;\n  sigV4AuthEnabled = false;\n  azureAuthEnabled = false;\n  secureSocksDSProxyEnabled = false;\n  samlEnabled = false;\n  samlName = '';\n  autoAssignOrg = true;\n  verifyEmailEnabled = false;\n  oauth: OAuthSettings = {};\n  rbacEnabled = true;\n  disableUserSignUp = false;\n  loginHint = '';\n  passwordHint = '';\n  loginError: string | undefined = undefined;\n  viewersCanEdit = false;\n  editorsCanAdmin = false;\n  disableSanitizeHtml = false;\n  trustedTypesDefaultPolicyEnabled = false;\n  cspReportOnlyEnabled = false;\n  liveEnabled = true;\n  /** @deprecated Use `theme2` instead. */\n  theme: GrafanaTheme;\n  theme2: GrafanaTheme2;\n  featureToggles: FeatureToggles = {};\n  anonymousEnabled = false;\n  anonymousDeviceLimit: number | undefined = undefined;\n  licenseInfo: LicenseInfo = {} as LicenseInfo;\n  rendererAvailable = false;\n  rendererVersion = '';\n  rendererDefaultImageWidth = 1000;\n  rendererDefaultImageHeight = 500;\n  rendererDefaultImageScale = 1;\n  secretsManagerPluginEnabled = false;\n  supportBundlesEnabled = false;\n  http2Enabled = false;\n  dateFormats?: SystemDateFormatSettings;\n  grafanaJavascriptAgent = {\n    enabled: false,\n    customEndpoint: '',\n    apiKey: '',\n    allInstrumentationsEnabled: false,\n    errorInstrumentalizationEnabled: true,\n    consoleInstrumentalizationEnabled: false,\n    webVitalsInstrumentalizationEnabled: false,\n    tracingInstrumentalizationEnabled: false,\n  };\n  pluginCatalogURL = 'https://grafana.com/grafana/plugins/';\n  pluginAdminEnabled = true;\n  pluginAdminExternalManageEnabled = false;\n  pluginCatalogHiddenPlugins: string[] = [];\n  pluginCatalogManagedPlugins: string[] = [];\n  pluginCatalogPreinstalledPlugins: PreinstalledPlugin[] = [];\n  pluginsCDNBaseURL = '';\n  expressionsEnabled = false;\n  awsAllowedAuthProviders: string[] = [];\n  awsAssumeRoleEnabled = false;\n  azure: AzureSettings = {\n    managedIdentityEnabled: false,\n    workloadIdentityEnabled: false,\n    userIdentityEnabled: false,\n    userIdentityFallbackCredentialsEnabled: false,\n    azureEntraPasswordCredentialsEnabled: false,\n  };\n  caching = {\n    enabled: false,\n  };\n  geomapDefaultBaseLayerConfig?: MapLayerOptions;\n  geomapDisableCustomBaseLayer?: boolean;\n  unifiedAlertingEnabled = false;\n  unifiedAlerting = {\n    minInterval: '',\n    alertStateHistoryBackend: undefined,\n    alertStateHistoryPrimary: undefined,\n  };\n  applicationInsightsConnectionString?: string;\n  applicationInsightsEndpointUrl?: string;\n  recordedQueries = {\n    enabled: true,\n  };\n  featureHighlights = {\n    enabled: false,\n  };\n  reporting = {\n    enabled: true,\n  };\n  analytics = {\n    enabled: true,\n  };\n  googleAnalyticsId: undefined;\n  googleAnalytics4Id: undefined;\n  googleAnalytics4SendManualPageViews = false;\n  rudderstackWriteKey: undefined;\n  rudderstackDataPlaneUrl: undefined;\n  rudderstackSdkUrl: undefined;\n  rudderstackConfigUrl: undefined;\n  rudderstackIntegrationsUrl: undefined;\n  analyticsConsoleReporting = false;\n  dashboardPerformanceMetrics: string[] = [];\n  sqlConnectionLimits = {\n    maxOpenConns: 100,\n    maxIdleConns: 100,\n    connMaxLifetime: 14400,\n  };\n  defaultDatasourceManageAlertsUiToggle = true;\n\n  tokenExpirationDayLimit: undefined;\n  enableFrontendSandboxForPlugins: string[] = [];\n  sharedWithMeFolderUID: string | undefined;\n  rootFolderUID: string | undefined;\n  localFileSystemAvailable: boolean | undefined;\n  cloudMigrationIsTarget: boolean | undefined;\n  cloudMigrationFeedbackURL = '';\n  cloudMigrationPollIntervalMs = 2000;\n  reportingStaticContext?: Record<string, string>;\n  exploreDefaultTimeOffset = '1h';\n  exploreHideLogsDownload: boolean | undefined;\n\n  /**\n   * Language used in Grafana's UI. This is after the user's preference (or deteceted locale) is resolved to one of\n   * Grafana's supported language.\n   */\n  language: string | undefined;\n\n  constructor(options: GrafanaBootConfig) {\n    this.bootData = options.bootData;\n\n    const defaults = {\n      datasources: {},\n      windowTitlePrefix: 'Grafana - ',\n      panels: {},\n      newPanelTitle: 'Panel Title',\n      playlist_timespan: '1m',\n      unsaved_changes_warning: true,\n      appUrl: '',\n      appSubUrl: '',\n      buildInfo: {\n        version: '1.0',\n        commit: '1',\n        env: 'production',\n      },\n      viewersCanEdit: false,\n      editorsCanAdmin: false,\n      disableSanitizeHtml: false,\n    };\n\n    merge(this, defaults, options);\n\n    this.buildInfo = options.buildInfo || defaults.buildInfo;\n\n    if (this.dateFormats) {\n      systemDateFormats.update(this.dateFormats);\n    }\n\n    overrideFeatureTogglesFromUrl(this);\n    overrideFeatureTogglesFromLocalStorage(this);\n\n    if (this.featureToggles.disableAngular) {\n      this.angularSupportEnabled = false;\n    }\n\n    // Creating theme after applying feature toggle overrides in case we need to toggle anything\n    this.theme2 = getThemeById(this.bootData.user.theme);\n    this.bootData.user.lightTheme = this.theme2.isLight;\n    this.theme = this.theme2.v1;\n  }\n}\n\n// localstorage key: grafana.featureToggles\n// example value: panelEditor=1,panelInspector=1\nfunction overrideFeatureTogglesFromLocalStorage(config: GrafanaBootConfig) {\n  const featureToggles = config.featureToggles;\n  const localStorageKey = 'grafana.featureToggles';\n  const localStorageValue = window.localStorage.getItem(localStorageKey);\n  if (localStorageValue) {\n    const features = localStorageValue.split(',');\n    for (const feature of features) {\n      const [featureName, featureValue] = feature.split('=');\n      const toggleState = featureValue === 'true' || featureValue === '1';\n      // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n      featureToggles[featureName as keyof FeatureToggles] = toggleState;\n      console.log(`Setting feature toggle ${featureName} = ${toggleState} via localstorage`);\n    }\n  }\n}\n\nfunction overrideFeatureTogglesFromUrl(config: GrafanaBootConfig) {\n  if (window.location.href.indexOf('__feature') === -1) {\n    return;\n  }\n\n  const isDevelopment = config.buildInfo.env === 'development';\n\n  // Although most flags can not be changed from the URL in production,\n  // some of them are safe (and useful!) to change dynamically from the browser URL\n  const safeRuntimeFeatureFlags = new Set(['queryServiceFromUI', 'dashboardSceneSolo']);\n\n  const params = new URLSearchParams(window.location.search);\n  params.forEach((value, key) => {\n    if (key.startsWith('__feature.')) {\n      const featureToggles = config.featureToggles as Record<string, boolean>;\n      const featureName = key.substring(10);\n\n      const toggleState = value === 'true' || value === ''; // browser rewrites true as ''\n      if (toggleState !== featureToggles[key]) {\n        if (isDevelopment || safeRuntimeFeatureFlags.has(featureName)) {\n          featureToggles[featureName] = toggleState;\n          console.log(`Setting feature toggle ${featureName} = ${toggleState} via url`);\n        } else {\n          console.log(`Unable to change feature toggle ${featureName} via url in production.`);\n        }\n      }\n    }\n  });\n}\n\nconst bootData = (window as any).grafanaBootData || {\n  settings: {},\n  user: {},\n  navTree: [],\n};\n\nconst options = bootData.settings;\noptions.bootData = bootData;\n\n/**\n * Use this to access the {@link GrafanaBootConfig} for the current running Grafana instance.\n *\n * @public\n */\nexport const config = new GrafanaBootConfig(options);\n","import * as H from 'history';\nimport React, { useContext } from 'react';\nimport { BehaviorSubject, Observable } from 'rxjs';\n\nimport { deprecationWarning, UrlQueryMap, urlUtil } from '@grafana/data';\nimport { attachDebugger, createLogger } from '@grafana/ui';\n\nimport { config } from '../config';\n\nimport { LocationUpdate } from './LocationSrv';\n\n/**\n * @public\n * A wrapper to help work with browser location and history\n */\nexport interface LocationService {\n  partial: (query: Record<string, any>, replace?: boolean) => void;\n  push: (location: H.Path | H.LocationDescriptor<any>) => void;\n  replace: (location: H.Path | H.LocationDescriptor<any>) => void;\n  reload: () => void;\n  getLocation: () => H.Location;\n  getHistory: () => H.History;\n  getSearch: () => URLSearchParams;\n  getSearchObject: () => UrlQueryMap;\n  getLocationObservable: () => Observable<H.Location>;\n\n  /**\n   * This is from the old LocationSrv interface\n   * @deprecated use partial, push or replace instead */\n  update: (update: LocationUpdate) => void;\n}\n\n/** @internal */\nexport class HistoryWrapper implements LocationService {\n  private readonly history: H.History;\n  private locationObservable: BehaviorSubject<H.Location>;\n\n  constructor(history?: H.History) {\n    // If no history passed create an in memory one if being called from test\n    this.history =\n      history ||\n      (process.env.NODE_ENV === 'test'\n        ? H.createMemoryHistory({ initialEntries: ['/'] })\n        : H.createBrowserHistory({ basename: config.appSubUrl ?? '/' }));\n\n    this.locationObservable = new BehaviorSubject(this.history.location);\n\n    this.history.listen((location) => {\n      this.locationObservable.next(location);\n    });\n\n    this.partial = this.partial.bind(this);\n    this.push = this.push.bind(this);\n    this.replace = this.replace.bind(this);\n    this.getSearch = this.getSearch.bind(this);\n    this.getHistory = this.getHistory.bind(this);\n    this.getLocation = this.getLocation.bind(this);\n  }\n\n  getLocationObservable() {\n    return this.locationObservable.asObservable();\n  }\n\n  getHistory() {\n    return this.history;\n  }\n\n  getSearch() {\n    return new URLSearchParams(this.history.location.search);\n  }\n\n  partial(query: Record<string, any>, replace?: boolean) {\n    const currentLocation = this.history.location;\n    const newQuery = this.getSearchObject();\n\n    for (const key in query) {\n      // removing params with null | undefined\n      if (query[key] === null || query[key] === undefined) {\n        delete newQuery[key];\n      } else {\n        newQuery[key] = query[key];\n      }\n    }\n\n    const updatedUrl = urlUtil.renderUrl(currentLocation.pathname, newQuery);\n\n    if (replace) {\n      this.history.replace(updatedUrl, this.history.location.state);\n    } else {\n      this.history.push(updatedUrl, this.history.location.state);\n    }\n  }\n\n  push(location: H.Path | H.LocationDescriptor) {\n    this.history.push(location);\n  }\n\n  replace(location: H.Path | H.LocationDescriptor) {\n    this.history.replace(location);\n  }\n\n  reload() {\n    const prevState = (this.history.location.state as any)?.routeReloadCounter;\n    this.history.replace({\n      ...this.history.location,\n      state: { routeReloadCounter: prevState ? prevState + 1 : 1 },\n    });\n  }\n\n  getLocation() {\n    return this.history.location;\n  }\n\n  getSearchObject() {\n    return locationSearchToObject(this.history.location.search);\n  }\n\n  /** @deprecated use partial, push or replace instead */\n  update(options: LocationUpdate) {\n    deprecationWarning('LocationSrv', 'update', 'partial, push or replace');\n    if (options.partial && options.query) {\n      this.partial(options.query, options.partial);\n    } else {\n      const newLocation: H.LocationDescriptor = {\n        pathname: options.path,\n      };\n      if (options.query) {\n        newLocation.search = urlUtil.toUrlParams(options.query);\n      }\n      if (options.replace) {\n        this.replace(newLocation);\n      } else {\n        this.push(newLocation);\n      }\n    }\n  }\n}\n\n/**\n * @public\n * Parses a location search string to an object\n * */\nexport function locationSearchToObject(search: string | number): UrlQueryMap {\n  let queryString = typeof search === 'number' ? String(search) : search;\n\n  if (queryString.length > 0) {\n    if (queryString.startsWith('?')) {\n      return urlUtil.parseKeyValue(queryString.substring(1));\n    }\n    return urlUtil.parseKeyValue(queryString);\n  }\n\n  return {};\n}\n\n/**\n * @public\n */\nexport let locationService: LocationService = new HistoryWrapper();\n\n/**\n * Used for tests only\n * @internal\n */\nexport const setLocationService = (location: LocationService) => {\n  if (process.env.NODE_ENV !== 'test') {\n    throw new Error('locationService can be only overriden in test environment');\n  }\n  locationService = location;\n};\n\nconst navigationLog = createLogger('Router');\n\n/** @internal */\nexport const navigationLogger = navigationLog.logger;\n\n// For debugging purposes the location service is attached to global _debug variable\nattachDebugger('location', locationService, navigationLog);\n\n// Simple context so the location service can be used without being a singleton\nconst LocationServiceContext = React.createContext<LocationService | undefined>(undefined);\n\nexport function useLocationService(): LocationService {\n  const service = useContext(LocationServiceContext);\n  if (!service) {\n    throw new Error('useLocationService must be used within a LocationServiceProvider');\n  }\n  return service;\n}\n\nexport const LocationServiceProvider: React.FC<{ service: LocationService; children: React.ReactNode }> = ({\n  service,\n  children,\n}) => {\n  return <LocationServiceContext.Provider value={service}>{children}</LocationServiceContext.Provider>;\n};\n","import { BusEventBase, BusEventWithPayload, EventBus, GrafanaTheme2, PanelModel, TimeRange } from '@grafana/data';\n\n/**\n * Called when a dashboard is refreshed\n *\n * @public\n */\nexport class RefreshEvent extends BusEventBase {\n  static type = 'refresh';\n}\n\n/**\n * Called when the theme settings change\n *\n * @public\n */\nexport class ThemeChangedEvent extends BusEventWithPayload<GrafanaTheme2> {\n  static type = 'theme-changed';\n}\n\n/**\n * Called when time range is updated\n *\n * @public\n */\nexport class TimeRangeUpdatedEvent extends BusEventWithPayload<TimeRange> {\n  static type = 'time-range-updated';\n}\n\n/**\n * Called to copy a panel JSON into local storage\n *\n * @public\n */\nexport class CopyPanelEvent extends BusEventWithPayload<PanelModel> {\n  static type = 'copy-panel';\n}\n\n// Internal singleton instance\nlet singletonInstance: EventBus;\n\n/**\n * Used during startup by Grafana to set the setAppEvents so it is available\n * via the {@link setAppEvents} to the rest of the application.\n *\n * @internal\n */\nexport function setAppEvents(instance: EventBus) {\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve an event bus that manages application level events\n *\n * @public\n */\nexport function getAppEvents(): EventBus {\n  return singletonInstance;\n}\n","import { config } from '../config';\nimport { locationService } from '../services';\nimport { getEchoSrv, EchoEventType } from '../services/EchoSrv';\n\nimport {\n  ExperimentViewEchoEvent,\n  InteractionEchoEvent,\n  MetaAnalyticsEvent,\n  MetaAnalyticsEventPayload,\n  PageviewEchoEvent,\n} from './types';\n\n/**\n * Helper function to report meta analytics to the {@link EchoSrv}.\n *\n * @public\n */\nexport const reportMetaAnalytics = (payload: MetaAnalyticsEventPayload) => {\n  getEchoSrv().addEvent<MetaAnalyticsEvent>({\n    type: EchoEventType.MetaAnalytics,\n    payload,\n  });\n};\n\n/**\n * Helper function to report pageview events to the {@link EchoSrv}.\n *\n * @public\n */\nexport const reportPageview = () => {\n  const location = locationService.getLocation();\n  const page = `${config.appSubUrl ?? ''}${location.pathname}${location.search}${location.hash}`;\n  getEchoSrv().addEvent<PageviewEchoEvent>({\n    type: EchoEventType.Pageview,\n    payload: {\n      page,\n    },\n  });\n};\n\n/**\n * Helper function to report interaction events to the {@link EchoSrv}.\n *\n * @public\n */\nexport const reportInteraction = (interactionName: string, properties?: Record<string, unknown>) => {\n  // get static reporting context and append it to properties\n  if (config.reportingStaticContext && config.reportingStaticContext instanceof Object) {\n    properties = { ...properties, ...config.reportingStaticContext };\n  }\n  getEchoSrv().addEvent<InteractionEchoEvent>({\n    type: EchoEventType.Interaction,\n    payload: {\n      interactionName,\n      properties,\n    },\n  });\n};\n\n/**\n * Helper function to report experimentview events to the {@link EchoSrv}.\n *\n * @public\n */\nexport const reportExperimentView = (id: string, group: string, variant: string) => {\n  getEchoSrv().addEvent<ExperimentViewEchoEvent>({\n    type: EchoEventType.ExperimentView,\n    payload: {\n      experimentId: id,\n      experimentGroup: group,\n      experimentVariant: variant,\n    },\n  });\n};\n","import * as H from 'history';\nimport { pick } from 'lodash';\nimport { BehaviorSubject, map, Observable } from 'rxjs';\n\nimport { reportInteraction } from '../analytics/utils';\nimport { config } from '../config';\n\nimport { HistoryWrapper, locationService as mainLocationService, LocationService } from './LocationService';\n\n// Only allow sidecar to be opened on these routes. It does not seem to make sense to keep the sidecar opened on\n// config/admin pages for example.\n// At this moment let's be restrictive about where the sidecar can show and add more routes if there is a need.\nconst ALLOW_ROUTES = [\n  /(^\\/d\\/)/, // dashboards\n  /^\\/explore/, // explore + explore metrics\n  /^\\/a\\/[^\\/]+/, // app plugins\n  /^\\/alerting/,\n];\n\n/**\n * This is a service that handles state and operation of a sidecar feature (sideview to render a second app in grafana).\n * At this moment this is highly experimental and if used should be understood to break easily with newer versions.\n * None of this functionality works without a feature toggle `appSidecar` being enabled.\n *\n * Right now this being in a single service is more of a practical tradeoff for easier isolation in the future these\n * APIs may be integrated into other services or features like app extensions, plugin system etc.\n *\n * @experimental\n */\nexport class SidecarService_EXPERIMENTAL {\n  private _initialContext: BehaviorSubject<unknown | undefined>;\n\n  private sidecarLocationService: LocationService;\n  private mainLocationService: LocationService;\n\n  // If true we don't close the sidecar when user navigates to another app or part of Grafana from where the sidecar\n  // was opened.\n  private follow = false;\n\n  // Keep track of where the sidecar was originally opened for autoclose behaviour.\n  private mainLocationWhenOpened: string | undefined;\n\n  private mainOnAllowedRoute = false;\n\n  constructor(mainLocationService: LocationService) {\n    this._initialContext = new BehaviorSubject<unknown | undefined>(undefined);\n    this.mainLocationService = mainLocationService;\n    this.sidecarLocationService = new HistoryWrapper(\n      createLocationStorageHistory({ storageKey: 'grafana.sidecar.history' })\n    );\n    this.handleMainLocationChanges();\n  }\n\n  private assertFeatureEnabled() {\n    if (!config.featureToggles.appSidecar) {\n      console.warn('The `appSidecar` feature toggle is not enabled, doing nothing.');\n      return false;\n    }\n\n    return true;\n  }\n\n  private updateMainLocationWhenOpened() {\n    const pathname = this.mainLocationService.getLocation().pathname;\n    for (const route of ALLOW_ROUTES) {\n      const match = pathname.match(route)?.[0];\n      if (match) {\n        this.mainLocationWhenOpened = match;\n        return;\n      }\n    }\n  }\n\n  /**\n   * Every time the main location changes we check if we should keep the sidecar open or close it based on list\n   * of allowed routes and also based on the follow flag when opening the app.\n   */\n  private handleMainLocationChanges() {\n    this.mainOnAllowedRoute = ALLOW_ROUTES.some((prefix) =>\n      this.mainLocationService.getLocation().pathname.match(prefix)\n    );\n\n    this.mainLocationService.getLocationObservable().subscribe((location) => {\n      this.mainOnAllowedRoute = ALLOW_ROUTES.some((prefix) => location.pathname.match(prefix));\n\n      if (!this.activePluginId) {\n        return;\n      }\n\n      if (!this.mainOnAllowedRoute) {\n        this.closeApp();\n        return;\n      }\n\n      // We check if we moved to some other app or part of grafana from where we opened the sidecar.\n      const isTheSameLocation = Boolean(\n        this.mainLocationWhenOpened && location.pathname.startsWith(this.mainLocationWhenOpened)\n      );\n\n      if (!(isTheSameLocation || this.follow)) {\n        this.closeApp();\n      }\n    });\n  }\n\n  /**\n   * Get current app id of the app in sidecar. This is most probably provisional. In the future\n   * this should be driven by URL addressing so that routing for the apps don't change. Useful just internally\n   * to decide which app to render.\n   *\n   * @experimental\n   */\n  get activePluginIdObservable() {\n    return this.sidecarLocationService.getLocationObservable().pipe(\n      map((val) => {\n        return getPluginIdFromUrl(val?.pathname || '');\n      })\n    );\n  }\n\n  /**\n   * Get initial context which is whatever data was passed when calling the 'openApp' function. This is meant as\n   * a way for the app to initialize it's state based on some context that is passed to it from the primary app.\n   *\n   * @experimental\n   */\n  get initialContextObservable() {\n    return this._initialContext.asObservable();\n  }\n\n  // Get the current value of the subject, this is needed if we want the value immediately. For example if used in\n  // hook in react with useObservable first render would return undefined even if the behaviourSubject has some\n  // value which will be emitted in the next tick and thus next rerender.\n  get initialContext() {\n    return this._initialContext.getValue();\n  }\n\n  /**\n   * @experimental\n   */\n  get activePluginId() {\n    return getPluginIdFromUrl(this.sidecarLocationService.getLocation().pathname);\n  }\n\n  getLocationService() {\n    return this.sidecarLocationService;\n  }\n\n  /**\n   * Opens an app in a sidecar. You can also pass some context object that will be then available to the app.\n   * @deprecated\n   * @experimental\n   */\n  openApp(pluginId: string, context?: unknown) {\n    if (!(this.assertFeatureEnabled() && this.mainOnAllowedRoute)) {\n      return;\n    }\n    this._initialContext.next(context);\n    this.openAppV3({ pluginId, follow: false });\n  }\n\n  /**\n   * Opens an app in a sidecar. You can also relative path inside the app to open.\n   * @deprecated\n   * @experimental\n   */\n  openAppV2(pluginId: string, path?: string) {\n    this.openAppV3({ pluginId, path, follow: false });\n  }\n\n  /**\n   * Opens an app in a sidecar. You can also relative path inside the app to open.\n   * @param options.pluginId Plugin ID of the app to open\n   * @param options.path Relative path inside the app to open\n   * @param options.follow If true, the sidecar will stay open even if the main location change to another app or\n   *   Grafana section\n   *\n   * @experimental\n   */\n  openAppV3(options: { pluginId: string; path?: string; follow?: boolean }) {\n    if (!(this.assertFeatureEnabled() && this.mainOnAllowedRoute)) {\n      return;\n    }\n\n    this.follow = options.follow || false;\n\n    this.updateMainLocationWhenOpened();\n    this.sidecarLocationService.push({ pathname: `/a/${options.pluginId}${options.path || ''}` });\n    reportInteraction('sidecar_service_open_app', { pluginId: options.pluginId, follow: options.follow });\n  }\n\n  /**\n   * @experimental\n   */\n  closeApp() {\n    if (!this.assertFeatureEnabled()) {\n      return;\n    }\n\n    this.follow = false;\n    this.mainLocationWhenOpened = undefined;\n    this._initialContext.next(undefined);\n    this.sidecarLocationService.replace({ pathname: '/' });\n\n    reportInteraction('sidecar_service_close_app');\n  }\n\n  /**\n   * This is mainly useful inside an app extensions which are executed outside the main app context but can work\n   * differently depending on whether their app is currently rendered or not.\n   *\n   * This is also true only in case a sidecar is opened. In other cases, just to check if a single app is opened\n   * probably does not make sense.\n   *\n   * This means these are the states and the result of this function:\n   * Single app is opened: false (may seem strange from considering the function name, but the main point of\n   *   this is to recognize when the app needs to do specific alteration in context of running next to second app)\n   * 2 apps are opened and pluginId is the one in the main window: true\n   * 2 apps are opened and pluginId is the one in the sidecar window: true\n   * 2 apps are opened and pluginId is not one of those: false\n   *\n   * @experimental\n   */\n  isAppOpened(pluginId: string) {\n    if (!this.assertFeatureEnabled()) {\n      return false;\n    }\n\n    const result = !!(this.activePluginId && (this.activePluginId === pluginId || getMainAppPluginId() === pluginId));\n    reportInteraction('sidecar_service_is_app_opened', { pluginId, isOpened: result });\n    return result;\n  }\n}\n\nconst pluginIdUrlRegex = /a\\/([^\\/]+)/;\nfunction getPluginIdFromUrl(url: string) {\n  return url.match(pluginIdUrlRegex)?.[1];\n}\n\n// The app plugin that is \"open\" in the main Grafana view\nfunction getMainAppPluginId() {\n  // TODO: not great but we have to get a handle on the other locationService used for the main view and easiest way\n  //   right now is through this global singleton\n  const { pathname } = mainLocationService.getLocation();\n\n  // A naive way to sort of simulate core features being an app and having an appID\n  let mainApp = getPluginIdFromUrl(pathname);\n  if (!mainApp && pathname.match(/\\/explore/)) {\n    mainApp = 'explore';\n  }\n\n  if (!mainApp && pathname.match(/\\/d\\//)) {\n    mainApp = 'dashboards';\n  }\n\n  return mainApp || 'unknown';\n}\n\ntype LocalStorageHistoryOptions = {\n  storageKey: string;\n};\n\ninterface LocationStorageHistory extends H.MemoryHistory {\n  getLocationObservable(): Observable<H.Location | undefined>;\n}\n\n/**\n * Simple wrapper over the memory history that persists the location in the localStorage.\n *\n * @param options\n */\nfunction createLocationStorageHistory(options: LocalStorageHistoryOptions): LocationStorageHistory {\n  const storedLocation = localStorage.getItem(options.storageKey);\n  const initialEntry = storedLocation ? JSON.parse(storedLocation) : '/';\n  const locationSubject = new BehaviorSubject<H.Location | undefined>(initialEntry);\n  const memoryHistory = H.createMemoryHistory({ initialEntries: [initialEntry] });\n\n  let currentLocation = memoryHistory.location;\n\n  function maybeUpdateLocation() {\n    if (memoryHistory.location !== currentLocation) {\n      localStorage.setItem(\n        options.storageKey,\n        JSON.stringify(pick(memoryHistory.location, 'pathname', 'search', 'hash'))\n      );\n      currentLocation = memoryHistory.location;\n      locationSubject.next(memoryHistory.location);\n    }\n  }\n\n  // This creates a sort of proxy over the memory location just to add the localStorage persistence and the location\n  // observer. We could achieve the same effect by a listener but that would create a memory leak as there would be no\n  // reasonable way to unsubcribe the listener later on.\n  // Another issue is that react router for some reason does not care about proper `this` binding and just calls these\n  // as normal functions. So if this were to be a class we would still need to bind each of these methods to the\n  // instance so at that moment this just seems easier.\n  return {\n    ...memoryHistory,\n    // Getter aren't destructured as getter but as values, so they have to be still here even though we are not\n    // modifying them.\n    get index() {\n      return memoryHistory.index;\n    },\n    get entries() {\n      return memoryHistory.entries;\n    },\n    get length() {\n      return memoryHistory.length;\n    },\n    get action() {\n      return memoryHistory.action;\n    },\n    get location() {\n      return memoryHistory.location;\n    },\n    push(location: H.Path | H.LocationDescriptor<H.LocationState>, state?: H.LocationState) {\n      memoryHistory.push(location, state);\n      maybeUpdateLocation();\n    },\n    replace(location: H.Path | H.LocationDescriptor<H.LocationState>, state?: H.LocationState) {\n      memoryHistory.replace(location, state);\n      maybeUpdateLocation();\n    },\n    go(n: number) {\n      memoryHistory.go(n);\n      maybeUpdateLocation();\n    },\n    goBack() {\n      memoryHistory.goBack();\n      maybeUpdateLocation();\n    },\n    goForward() {\n      memoryHistory.goForward();\n      maybeUpdateLocation();\n    },\n    getLocationObservable() {\n      return locationSubject.asObservable();\n    },\n  };\n}\n\nexport const sidecarServiceSingleton_EXPERIMENTAL = new SidecarService_EXPERIMENTAL(mainLocationService);\n","import { createContext, useContext } from 'react';\nimport { useObservable } from 'react-use';\n\nimport { SidecarService_EXPERIMENTAL, sidecarServiceSingleton_EXPERIMENTAL } from './SidecarService_EXPERIMENTAL';\n\nexport const SidecarContext_EXPERIMENTAL = createContext<SidecarService_EXPERIMENTAL>(\n  sidecarServiceSingleton_EXPERIMENTAL\n);\n\n/**\n * This is the main way to interact with the sidecar service inside a react context. It provides a wrapper around the\n * service props so that even though they are observables we just pass actual values to the components.\n *\n * @experimental\n */\nexport function useSidecar_EXPERIMENTAL() {\n  // As the sidecar service functionality is behind feature flag this does not need to be for now\n  const service = useContext(SidecarContext_EXPERIMENTAL);\n\n  if (!service) {\n    throw new Error('No SidecarContext found');\n  }\n\n  const initialContext = useObservable(service.initialContextObservable, service.initialContext);\n  const activePluginId = useObservable(service.activePluginIdObservable, service.activePluginId);\n  const locationService = service.getLocationService();\n\n  return {\n    activePluginId,\n    initialContext,\n    locationService,\n    // TODO: currently this allows anybody to open any app, in the future we should probably scope this to the\n    //  current app but that means we will need to incorporate this better into the plugin platform APIs which\n    //  we will do once the functionality is reasonably stable\n    openApp: (pluginId: string, context?: unknown) => {\n      return service.openApp(pluginId, context);\n    },\n    openAppV2: (pluginId: string, path?: string) => {\n      return service.openAppV2(pluginId, path);\n    },\n    openAppV3: (options: { pluginId: string; path?: string; follow?: boolean }) => {\n      return service.openAppV3(options);\n    },\n    closeApp: () => service.closeApp(),\n    isAppOpened: (pluginId: string) => {\n      return service.isAppOpened(pluginId);\n    },\n  };\n}\n","import {\n  type PluginExtension,\n  type PluginExtensionComponent,\n  type PluginExtensionLink,\n  PluginExtensionTypes,\n} from '@grafana/data';\n\nexport function isPluginExtensionLink(extension: PluginExtension | undefined): extension is PluginExtensionLink {\n  if (!extension) {\n    return false;\n  }\n  return extension.type === PluginExtensionTypes.link && ('path' in extension || 'onClick' in extension);\n}\n\nexport function isPluginExtensionComponent(\n  extension: PluginExtension | undefined\n): extension is PluginExtensionComponent {\n  if (!extension) {\n    return false;\n  }\n  return extension.type === PluginExtensionTypes.component && 'component' in extension;\n}\n","import type { PluginExtension, PluginExtensionLink, PluginExtensionComponent } from '@grafana/data';\n\nimport { isPluginExtensionComponent, isPluginExtensionLink } from './utils';\n\nexport type GetPluginExtensions<T = PluginExtension> = (\n  options: GetPluginExtensionsOptions\n) => GetPluginExtensionsResult<T>;\n\nexport type UsePluginExtensions<T = PluginExtension> = (\n  options: GetPluginExtensionsOptions\n) => UsePluginExtensionsResult<T>;\n\nexport type GetPluginExtensionsOptions = {\n  extensionPointId: string;\n  // Make sure this object is properly memoized and not mutated.\n  context?: object | Record<string | symbol, unknown>;\n  limitPerPlugin?: number;\n};\n\nexport type GetPluginExtensionsResult<T = PluginExtension> = {\n  extensions: T[];\n};\n\nexport type UsePluginExtensionsResult<T = PluginExtension> = {\n  extensions: T[];\n  isLoading: boolean;\n};\n\nlet singleton: GetPluginExtensions | undefined;\n\nexport function setPluginExtensionGetter(instance: GetPluginExtensions): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setPluginExtensionGetter() function should only be called once, when Grafana is starting.');\n  }\n  singleton = instance;\n}\n\nfunction getPluginExtensionGetter(): GetPluginExtensions {\n  if (!singleton) {\n    throw new Error('getPluginExtensionGetter() can only be used after the Grafana instance has started.');\n  }\n  return singleton;\n}\n\nexport const getPluginExtensions: GetPluginExtensions = (options) => getPluginExtensionGetter()(options);\n\nexport const getPluginLinkExtensions: GetPluginExtensions<PluginExtensionLink> = (options) => {\n  const { extensions } = getPluginExtensions(options);\n\n  return {\n    extensions: extensions.filter(isPluginExtensionLink),\n  };\n};\n\n// This getter doesn't support the `context` option (contextual information can be passed in as component props)\nexport const getPluginComponentExtensions = <Props = {}>(options: {\n  extensionPointId: string;\n  limitPerPlugin?: number;\n}): { extensions: Array<PluginExtensionComponent<Props>> } => {\n  const { extensions } = getPluginExtensions(options);\n  const componentExtensions = extensions.filter(isPluginExtensionComponent) as Array<PluginExtensionComponent<Props>>;\n\n  return {\n    extensions: componentExtensions,\n  };\n};\n","import { useMemo } from 'react';\n\nimport { PluginExtensionComponent, PluginExtensionLink } from '@grafana/data';\n\nimport { GetPluginExtensionsOptions, UsePluginExtensions, UsePluginExtensionsResult } from './getPluginExtensions';\nimport { isPluginExtensionComponent, isPluginExtensionLink } from './utils';\n\nlet singleton: UsePluginExtensions | undefined;\n\nexport function setPluginExtensionsHook(hook: UsePluginExtensions): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setPluginExtensionsHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\n/**\n * @deprecated Use either usePluginLinks() or usePluginComponents() instead.\n */\nexport function usePluginExtensions(options: GetPluginExtensionsOptions): UsePluginExtensionsResult {\n  if (!singleton) {\n    throw new Error('usePluginExtensions(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(options);\n}\n\n/**\n * @deprecated Use usePluginLinks() instead.\n */\nexport function usePluginLinkExtensions(\n  options: GetPluginExtensionsOptions\n): UsePluginExtensionsResult<PluginExtensionLink> {\n  const { extensions, isLoading } = usePluginExtensions(options);\n\n  return useMemo(() => {\n    return {\n      extensions: extensions.filter(isPluginExtensionLink),\n      isLoading,\n    };\n  }, [extensions, isLoading]);\n}\n\n/**\n * @deprecated Use usePluginComponents() instead.\n */\nexport function usePluginComponentExtensions<Props = {}>(\n  options: GetPluginExtensionsOptions\n): { extensions: Array<PluginExtensionComponent<Props>>; isLoading: boolean } {\n  const { extensions, isLoading } = usePluginExtensions(options);\n\n  return useMemo(\n    () => ({\n      extensions: extensions.filter(isPluginExtensionComponent) as Array<PluginExtensionComponent<Props>>,\n      isLoading,\n    }),\n    [extensions, isLoading]\n  );\n}\n","export type UsePluginComponent<Props extends object = {}> = (componentId: string) => UsePluginComponentResult<Props>;\n\nexport type UsePluginComponentResult<Props = {}> = {\n  component: React.ComponentType<Props> | undefined | null;\n  isLoading: boolean;\n};\n\nlet singleton: UsePluginComponent | undefined;\n\nexport function setPluginComponentHook(hook: UsePluginComponent): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setPluginComponentHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\nexport function usePluginComponent<Props extends object = {}>(componentId: string): UsePluginComponentResult<Props> {\n  if (!singleton) {\n    throw new Error('setPluginComponentHook(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(componentId) as UsePluginComponentResult<Props>;\n}\n","import { type ComponentTypeWithExtensionMeta } from '@grafana/data';\n\nexport type UsePluginComponentsOptions = {\n  extensionPointId: string;\n  limitPerPlugin?: number;\n};\n\nexport type UsePluginComponentsResult<Props = {}> = {\n  components: Array<ComponentTypeWithExtensionMeta<Props>>;\n  isLoading: boolean;\n};\n\nexport type UsePluginComponents<Props extends object = {}> = (\n  options: UsePluginComponentsOptions\n) => UsePluginComponentsResult<Props>;\n\nlet singleton: UsePluginComponents | undefined;\n\nexport function setPluginComponentsHook(hook: UsePluginComponents): void {\n  // We allow overriding the hook in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setPluginComponentsHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\nexport function usePluginComponents<Props extends object = {}>(\n  options: UsePluginComponentsOptions\n): UsePluginComponentsResult<Props> {\n  if (!singleton) {\n    throw new Error('setPluginComponentsHook(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(options) as UsePluginComponentsResult<Props>;\n}\n","import { PluginExtensionLink } from '@grafana/data';\n\nexport type UsePluginLinksOptions = {\n  extensionPointId: string;\n  context?: object | Record<string | symbol, unknown>;\n  limitPerPlugin?: number;\n};\n\nexport type UsePluginLinksResult = {\n  isLoading: boolean;\n  links: PluginExtensionLink[];\n};\n\nexport type UsePluginLinks = (options: UsePluginLinksOptions) => UsePluginLinksResult;\n\nlet singleton: UsePluginLinks | undefined;\n\nexport function setPluginLinksHook(hook: UsePluginLinks): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setPluginLinksHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\nexport function usePluginLinks(options: UsePluginLinksOptions): UsePluginLinksResult {\n  if (!singleton) {\n    throw new Error('setPluginLinksHook(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(options);\n}\n","import { PluginExtensionFunction } from '@grafana/data';\n\nexport type UsePluginFunctionsOptions = {\n  extensionPointId: string;\n  limitPerPlugin?: number;\n};\n\nexport type UsePluginFunctionsResult<Signature> = {\n  isLoading: boolean;\n  functions: Array<PluginExtensionFunction<Signature>>;\n};\n\nexport type UsePluginFunctions<T> = (options: UsePluginFunctionsOptions) => UsePluginFunctionsResult<T>;\n\nlet singleton: UsePluginFunctions<unknown> | undefined;\n\nexport function setPluginFunctionsHook(hook: UsePluginFunctions<unknown>): void {\n  // We allow overriding the registry in tests\n  if (singleton && process.env.NODE_ENV !== 'test') {\n    throw new Error('setUsePluginFunctionsHook() function should only be called once, when Grafana is starting.');\n  }\n  singleton = hook;\n}\n\nexport function usePluginFunctions<T>(options: UsePluginFunctionsOptions): UsePluginFunctionsResult<T> {\n  if (!singleton) {\n    throw new Error('usePluginFunctions(options) can only be used after the Grafana instance has started.');\n  }\n  return singleton(options) as UsePluginFunctionsResult<T>;\n}\n","import { CurrentUser } from '@grafana/data';\n\nlet singletonInstance: CurrentUser | null = null;\n\n/**\n * Used during startup by Grafana to set the current user so it is available\n * for rbac checks.\n *\n * @internal\n */\nexport function setCurrentUser(instance: CurrentUser) {\n  if (singletonInstance) {\n    throw new Error('User should only be set once, when Grafana is starting.');\n  }\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the current user.\n *\n * @internal\n *\n */\nexport function getCurrentUser(): CurrentUser {\n  if (!singletonInstance) {\n    throw new Error('User can only be used after Grafana instance has started.');\n  }\n  return singletonInstance;\n}\n","import {\n  DataQuery,\n  DataSourceApi,\n  DataSourceInstanceSettings,\n  PluginType,\n  TestDataSourceResponse,\n} from '@grafana/data';\n\nexport abstract class RuntimeDataSource<TQuery extends DataQuery = DataQuery> extends DataSourceApi<TQuery> {\n  public instanceSettings: DataSourceInstanceSettings;\n\n  public constructor(pluginId: string, uid: string) {\n    const instanceSettings: DataSourceInstanceSettings = {\n      name: 'RuntimeDataSource-' + pluginId,\n      uid: uid,\n      type: pluginId,\n      id: 1,\n      readOnly: true,\n      jsonData: {},\n      access: 'direct',\n      meta: {\n        id: pluginId,\n        name: 'RuntimeDataSource-' + pluginId,\n        type: PluginType.datasource,\n        info: {\n          author: {\n            name: '',\n          },\n          description: '',\n          links: [],\n          logos: {\n            large: '',\n            small: '',\n          },\n          screenshots: [],\n          updated: '',\n          version: '',\n        },\n        module: '',\n        baseUrl: '',\n      },\n    };\n\n    super(instanceSettings);\n    this.instanceSettings = instanceSettings;\n  }\n\n  public testDatasource(): Promise<TestDataSourceResponse> {\n    return Promise.resolve({\n      status: 'success',\n      message: '',\n    });\n  }\n}\n","import { createContext, useContext } from 'react';\nimport { useObservable } from 'react-use';\nimport { Observable } from 'rxjs';\n\nimport { Scope } from '@grafana/data';\n\nexport interface ScopesContextValueState {\n  drawerOpened: boolean;\n  enabled: boolean;\n  loading: boolean;\n  readOnly: boolean;\n  value: Scope[];\n}\n\nexport interface ScopesContextValue {\n  /**\n   * Current state.\n   */\n  state: ScopesContextValueState;\n\n  /**\n   * Observable that emits the current state.\n   */\n  stateObservable: Observable<ScopesContextValue['state']>;\n\n  /**\n   * Change the selected scopes. The service takes care about loading them and propagating the changes.\n   * @param scopeNames\n   */\n  changeScopes(scopeNames: string[]): void;\n\n  /**\n   * Set read-only mode.\n   * If `readOnly` is `true`, the selector will be set to read-only and the dashboards panel will be closed.\n   */\n  setReadOnly(readOnly: boolean): void;\n\n  /**\n   * Enable or disable the usage of scopes.\n   * This will hide the selector and the dashboards panel, and it will stop propagating the scopes to the query object.\n   */\n  setEnabled(enabled: boolean): void;\n}\n\nexport const ScopesContext = createContext<ScopesContextValue | undefined>(undefined);\n\nexport function useScopes(): ScopesContextValue | undefined {\n  const context = useContext(ScopesContext);\n\n  useObservable(context?.stateObservable ?? new Observable(), context?.state);\n\n  return context\n    ? {\n        state: context.state,\n        stateObservable: context.stateObservable,\n        changeScopes: context.changeScopes,\n        setReadOnly: context.setReadOnly,\n        setEnabled: context.setEnabled,\n      }\n    : undefined;\n}\n","import { CoreApp } from '@grafana/data';\n\nimport { EchoEvent, EchoEventType } from '../services/EchoSrv';\n\n/**\n * Describes the basic dashboard information that can be passed as the meta\n * analytics payload.\n *\n * @public\n */\nexport interface DashboardInfo {\n  /** @deprecated -- use UID not internal ID */\n  dashboardId: number;\n  dashboardUid: string;\n  dashboardName: string;\n  folderName?: string;\n}\n\n/**\n * Describes the data request information passed as the meta analytics payload.\n *\n * @public\n */\nexport interface DataRequestInfo extends Partial<DashboardInfo> {\n  source?: CoreApp | string;\n  datasourceName: string;\n  datasourceId: number;\n  datasourceUid: string;\n  datasourceType: string;\n  panelId?: number;\n  panelPluginId?: string;\n  panelName?: string;\n  duration: number;\n  error?: string;\n  dataSize?: number;\n}\n\n/**\n * The meta analytics events that can be added to the echo service.\n *\n * @public\n */\nexport enum MetaAnalyticsEventName {\n  DashboardView = 'dashboard-view',\n  DataRequest = 'data-request',\n}\n\n/**\n * Describes the payload of a dashboard view event.\n *\n * @public\n */\nexport interface DashboardViewEventPayload extends DashboardInfo {\n  eventName: MetaAnalyticsEventName.DashboardView;\n}\n\n/**\n * Describes the payload of a data request event.\n *\n * @public\n */\nexport interface DataRequestEventPayload extends DataRequestInfo {\n  eventName: MetaAnalyticsEventName.DataRequest;\n  totalQueries?: number;\n  cachedQueries?: number;\n}\n\n/**\n * Describes the meta analytics payload passed with the {@link MetaAnalyticsEvent}\n *\n * @public\n */\nexport type MetaAnalyticsEventPayload = DashboardViewEventPayload | DataRequestEventPayload;\n\n/**\n * Describes meta analytics event with predefined {@link EchoEventType.EchoEventType} type.\n *\n * @public\n */\nexport interface MetaAnalyticsEvent extends EchoEvent<EchoEventType.MetaAnalytics, MetaAnalyticsEventPayload> {}\n\n/**\n * Describes the payload of a pageview event.\n *\n * @public\n */\nexport interface PageviewEchoEventPayload {\n  page: string;\n}\n\n/**\n * Describes pageview event with predefined {@link EchoEventType.EchoEventType} type.\n *\n * @public\n */\nexport type PageviewEchoEvent = EchoEvent<EchoEventType.Pageview, PageviewEchoEventPayload>;\n\n/**\n * Describes the payload of a user interaction event.\n *\n * @public\n */\nexport interface InteractionEchoEventPayload {\n  interactionName: string;\n  properties?: Record<string, any>;\n}\n\n/**\n * Describes interaction event with predefined {@link EchoEventType.EchoEventType} type.\n *\n * @public\n */\nexport type InteractionEchoEvent = EchoEvent<EchoEventType.Interaction, InteractionEchoEventPayload>;\n\n/**\n * Describes the payload of an experimentview event.\n *\n * @public\n */\nexport interface ExperimentViewEchoEventPayload {\n  experimentId: string;\n  experimentGroup: string;\n  experimentVariant: string;\n}\n\n/**\n * Describes experimentview event with predefined {@link EchoEventType.EchoEventType} type.\n *\n * @public\n */\nexport type ExperimentViewEchoEvent = EchoEvent<EchoEventType.ExperimentView, ExperimentViewEchoEventPayload>;\n\n/**\n * Pageview event typeguard.\n *\n * @public\n */\nexport const isPageviewEvent = (event: EchoEvent): event is PageviewEchoEvent => {\n  return Boolean(event.payload.page);\n};\n\n/**\n * Interaction event typeguard.\n *\n * @public\n */\nexport const isInteractionEvent = (event: EchoEvent): event is InteractionEchoEvent => {\n  return Boolean(event.payload.interactionName);\n};\n\n/**\n * Experimentview event typeguard.\n *\n * @public\n */\nexport const isExperimentViewEvent = (event: EchoEvent): event is ExperimentViewEchoEvent => {\n  return Boolean(event.payload.experimentId);\n};\n","import { PanelPlugin } from '@grafana/data';\n\nimport { config } from '../config';\n\n/**\n * Option to specify a plugin css that should be applied for the dark\n * and the light theme.\n *\n * @public\n */\nexport interface PluginCssOptions {\n  light: string;\n  dark: string;\n}\n\n/**\n * Use this to load css for a Grafana plugin by specifying a {@link PluginCssOptions}\n * containing styling for the dark and the light theme.\n *\n * @param options - plugin styling for light and dark theme.\n * @public\n */\nexport async function loadPluginCss(options: PluginCssOptions): Promise<System.Module | void> {\n  try {\n    const cssPath = config.bootData.user.theme === 'light' ? options.light : options.dark;\n    return window.System.import(cssPath);\n  } catch (err) {\n    console.error(err);\n  }\n}\n\ninterface PluginImportUtils {\n  importPanelPlugin: (id: string) => Promise<PanelPlugin>;\n  getPanelPluginFromCache: (id: string) => PanelPlugin | undefined;\n}\n\nlet pluginImportUtils: PluginImportUtils | undefined;\n\nexport function setPluginImportUtils(utils: PluginImportUtils) {\n  if (pluginImportUtils) {\n    throw new Error('pluginImportUtils should only be set once, when Grafana is starting.');\n  }\n\n  pluginImportUtils = utils;\n}\n\nexport function getPluginImportUtils(): PluginImportUtils {\n  if (!pluginImportUtils) {\n    throw new Error('pluginImportUtils can only be used after Grafana instance has started.');\n  }\n\n  return pluginImportUtils;\n}\n","import { config } from '../config';\n\nexport const featureEnabled = (feature: string): boolean => {\n  const { enabledFeatures } = config.licenseInfo;\n  return enabledFeatures && enabledFeatures[feature];\n};\n","import { faro, LogContext, LogLevel } from '@grafana/faro-web-sdk';\n\nimport { config } from '../config';\n\nexport { LogLevel };\n\n/**\n * Log a message at INFO level\n * @public\n */\nexport function logInfo(message: string, contexts?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushLog([message], {\n      level: LogLevel.INFO,\n      context: contexts,\n    });\n  }\n}\n\n/**\n * Log a message at WARNING level\n *\n * @public\n */\nexport function logWarning(message: string, contexts?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushLog([message], {\n      level: LogLevel.WARN,\n      context: contexts,\n    });\n  }\n}\n\n/**\n * Log a message at DEBUG level\n *\n * @public\n */\nexport function logDebug(message: string, contexts?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushLog([message], {\n      level: LogLevel.DEBUG,\n      context: contexts,\n    });\n  }\n}\n\n/**\n * Log an error\n *\n * @public\n */\nexport function logError(err: Error, contexts?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushError(err, {\n      context: contexts,\n    });\n  }\n}\n\n/**\n * Log a measurement\n *\n * @public\n */\nexport type MeasurementValues = Record<string, number>;\nexport function logMeasurement(type: string, values: MeasurementValues, context?: LogContext) {\n  if (config.grafanaJavascriptAgent.enabled) {\n    faro.api.pushMeasurement(\n      {\n        type,\n        values,\n      },\n      { context: context }\n    );\n  }\n}\n\nexport interface MonitoringLogger {\n  logDebug: (message: string, contexts?: LogContext) => void;\n  logInfo: (message: string, contexts?: LogContext) => void;\n  logWarning: (message: string, contexts?: LogContext) => void;\n  logError: (error: Error, contexts?: LogContext) => void;\n  logMeasurement: (type: string, measurement: MeasurementValues, contexts?: LogContext) => void;\n}\n/**\n * Creates a monitoring logger with five levels of logging methods: `logDebug`, `logInfo`, `logWarning`, `logError`, and `logMeasurement`.\n * These methods use `faro.api.pushX` web SDK methods to report these logs or errors to the Faro collector.\n *\n * @param {string} source - Identifier for the source of the log messages.\n * @param {LogContext} [defaultContext] - Context to be included in every log message.\n *\n * @returns {MonitoringLogger} Logger object with five methods:\n * - `logDebug(message: string, contexts?: LogContext)`: Logs a debug message.\n * - `logInfo(message: string, contexts?: LogContext)`: Logs an informational message.\n * - `logWarning(message: string, contexts?: LogContext)`: Logs a warning message.\n * - `logError(error: Error, contexts?: LogContext)`: Logs an error message.\n * - `logMeasurement(measurement: Omit<MeasurementEvent, 'timestamp'>, contexts?: LogContext)`: Logs a measurement.\n * Each method combines the `defaultContext` (if provided), the `source`, and an optional `LogContext` parameter into a full context that is included with the log message.\n */\nexport function createMonitoringLogger(source: string, defaultContext?: LogContext): MonitoringLogger {\n  const createFullContext = (contexts?: LogContext) => ({\n    source: source,\n    ...defaultContext,\n    ...contexts,\n  });\n\n  return {\n    /**\n     * Logs a debug message with optional additional context.\n     * @param {string} message - The debug message to be logged.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logDebug: (message: string, contexts?: LogContext) => logDebug(message, createFullContext(contexts)),\n\n    /**\n     * Logs an informational message with optional additional context.\n     * @param {string} message - The informational message to be logged.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logInfo: (message: string, contexts?: LogContext) => logInfo(message, createFullContext(contexts)),\n\n    /**\n     * Logs a warning message with optional additional context.\n     * @param {string} message - The warning message to be logged.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logWarning: (message: string, contexts?: LogContext) => logWarning(message, createFullContext(contexts)),\n\n    /**\n     * Logs an error with optional additional context.\n     * @param {Error} error - The error object to be logged.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logError: (error: Error, contexts?: LogContext) => logError(error, createFullContext(contexts)),\n\n    /**\n     * Logs an measurement with optional additional context.\n     * @param {MeasurementEvent} measurement - The measurement object to be recorded.\n     * @param {LogContext} [contexts] - Optional additional context to be included.\n     */\n    logMeasurement: (type: string, measurement: MeasurementValues, contexts?: LogContext) =>\n      logMeasurement(type, measurement, createFullContext(contexts)),\n  };\n}\n","import { DataQueryError } from '@grafana/data';\n\n/**\n * Convert an object into a DataQueryError -- if this is an HTTP response,\n * it will put the correct values in the error field\n *\n * @public\n */\nexport function toDataQueryError(err: DataQueryError | string | unknown): DataQueryError {\n  const error: DataQueryError = err || {};\n\n  if (!error.message) {\n    if (typeof err === 'string') {\n      return { message: err };\n    }\n\n    let message = 'Query error';\n    if (error.message) {\n      message = error.message;\n    } else if (error.data && error.data.message && error.data?.message !== 'Query data error') {\n      message = error.data.message;\n    } else if (error?.data?.message === 'Query data error' && error?.data?.error) {\n      message = error.data.error;\n    } else if (error.data && error.data.error) {\n      message = error.data.error;\n    } else if (error.status) {\n      message = `Query error: ${error.status} ${error.statusText}`;\n    }\n    error.message = message;\n  }\n\n  return error;\n}\n","import {\n  DataQueryResponse,\n  KeyValue,\n  LoadingState,\n  DataQueryError,\n  TimeSeries,\n  TableData,\n  toDataFrame,\n  DataFrame,\n  MetricFindValue,\n  FieldType,\n  DataQuery,\n  DataFrameJSON,\n  dataFrameFromJSON,\n  QueryResultMetaNotice,\n} from '@grafana/data';\n\nimport { FetchError, FetchResponse } from '../services';\n\nimport { HealthCheckResultDetails } from './DataSourceWithBackend';\nimport { toDataQueryError } from './toDataQueryError';\n\nexport const cachedResponseNotice: QueryResultMetaNotice = { severity: 'info', text: 'Cached response' };\n\n/**\n * Single response object from a backend data source. Properties are optional but response should contain at least\n * an error or a some data (but can contain both). Main way to send data is with dataframes attribute as series and\n * tables data attributes are legacy formats.\n *\n * @internal\n */\nexport interface DataResponse {\n  error?: string;\n  refId?: string;\n  frames?: DataFrameJSON[];\n  status?: number;\n\n  // Legacy TSDB format...\n  series?: TimeSeries[];\n  tables?: TableData[];\n}\n\n/**\n * This is the type of response expected form backend datasource.\n *\n * @internal\n */\nexport interface BackendDataSourceResponse {\n  results: KeyValue<DataResponse>;\n}\n\n/**\n * Parse the results from /api/ds/query into a DataQueryResponse\n *\n * @param res - the HTTP response data.\n * @param queries - optional DataQuery array that will order the response based on the order of query refId's.\n *\n * @public\n */\nexport function toDataQueryResponse(\n  res:\n    | { data: BackendDataSourceResponse | undefined }\n    | FetchResponse<BackendDataSourceResponse | undefined>\n    | DataQueryError,\n  queries?: DataQuery[]\n): DataQueryResponse {\n  const rsp: DataQueryResponse = { data: [], state: LoadingState.Done };\n\n  const traceId = 'traceId' in res ? res.traceId : undefined;\n\n  if (traceId != null) {\n    rsp.traceIds = [traceId];\n  }\n\n  // If the response isn't in a correct shape we just ignore the data and pass empty DataQueryResponse.\n  const fetchResponse = res as FetchResponse;\n  if (fetchResponse.data?.results) {\n    const results = fetchResponse.data.results;\n    const refIDs = queries?.length ? queries.map((q) => q.refId) : Object.keys(results);\n    const cachedResponse = isCachedResponse(fetchResponse);\n    const data: DataResponse[] = [];\n\n    for (const refId of refIDs) {\n      const dr = results[refId];\n      if (!dr) {\n        continue;\n      }\n      dr.refId = refId;\n      data.push(dr);\n    }\n\n    for (const dr of data) {\n      if (dr.error) {\n        const errorObj: DataQueryError = {\n          refId: dr.refId,\n          message: dr.error,\n          status: dr.status,\n        };\n        if (traceId != null) {\n          errorObj.traceId = traceId;\n        }\n        if (!rsp.error) {\n          rsp.error = { ...errorObj };\n        }\n        if (rsp.errors) {\n          rsp.errors.push({ ...errorObj });\n        } else {\n          rsp.errors = [{ ...errorObj }];\n        }\n        rsp.state = LoadingState.Error;\n      }\n\n      if (dr.frames?.length) {\n        for (let js of dr.frames) {\n          if (cachedResponse) {\n            js = addCacheNotice(js);\n          }\n          const df = dataFrameFromJSON(js);\n          if (!df.refId) {\n            df.refId = dr.refId;\n          }\n          rsp.data.push(df);\n        }\n        continue; // the other tests are legacy\n      }\n\n      if (dr.series?.length) {\n        for (const s of dr.series) {\n          if (!s.refId) {\n            s.refId = dr.refId;\n          }\n          rsp.data.push(toDataFrame(s));\n        }\n      }\n\n      if (dr.tables?.length) {\n        for (const s of dr.tables) {\n          if (!s.refId) {\n            s.refId = dr.refId;\n          }\n          rsp.data.push(toDataFrame(s));\n        }\n      }\n    }\n  }\n\n  // When it is not an OK response, make sure the error gets added\n  if (fetchResponse.status && fetchResponse.status !== 200) {\n    if (rsp.state !== LoadingState.Error) {\n      rsp.state = LoadingState.Error;\n    }\n    if (!rsp.error) {\n      rsp.error = toDataQueryError(res);\n    }\n  }\n\n  return rsp;\n}\n\nfunction isCachedResponse(res: FetchResponse<BackendDataSourceResponse | undefined>): boolean {\n  const headers = res?.headers;\n  if (!headers || !headers.get) {\n    return false;\n  }\n  return headers.get('X-Cache') === 'HIT';\n}\n\nfunction addCacheNotice(frame: DataFrameJSON): DataFrameJSON {\n  return {\n    ...frame,\n    schema: {\n      ...frame.schema,\n      fields: [...(frame.schema?.fields ?? [])],\n      meta: {\n        ...frame.schema?.meta,\n        notices: [...(frame.schema?.meta?.notices ?? []), cachedResponseNotice],\n        isCachedResponse: true,\n      },\n    },\n  };\n}\n\nexport interface TestingStatus {\n  message?: string | null;\n  status?: string | null;\n  details?: HealthCheckResultDetails;\n}\n\n/**\n * Data sources using api/ds/query to test data sources can use this function to\n * handle errors and convert them to TestingStatus object.\n *\n * If possible, this should be avoided in favor of implementing /health endpoint\n * and testing data source with DataSourceWithBackend.testDataSource()\n *\n * Re-thrown errors are handled by testDataSource() in public/app/features/datasources/state/actions.ts\n *\n * @returns {TestingStatus}\n */\nexport function toTestingStatus(err: FetchError): TestingStatus {\n  const queryResponse = toDataQueryResponse(err);\n  // POST api/ds/query errors returned as { message: string, error: string } objects\n  if (queryResponse.error?.data?.message) {\n    return {\n      status: 'error',\n      message: queryResponse.error.data.message,\n      details: queryResponse.error?.data?.error ? { message: queryResponse.error.data.error } : undefined,\n    };\n  }\n  // POST api/ds/query errors returned in results object\n  else if (queryResponse.error?.refId && queryResponse.error?.message) {\n    return {\n      status: 'error',\n      message: queryResponse.error.message,\n    };\n  }\n\n  throw err;\n}\n\n/**\n * Return the first string or non-time field as the value\n *\n * @beta\n */\nexport function frameToMetricFindValue(frame: DataFrame): MetricFindValue[] {\n  if (!frame || !frame.length) {\n    return [];\n  }\n\n  const values: MetricFindValue[] = [];\n  let field = frame.fields.find((f) => f.type === FieldType.string);\n  if (!field) {\n    field = frame.fields.find((f) => f.type !== FieldType.time);\n  }\n  if (field) {\n    for (let i = 0; i < field.values.length; i++) {\n      values.push({ text: '' + field.values[i] });\n    }\n  }\n  return values;\n}\n","import { catchError, Observable, of, switchMap } from 'rxjs';\n\nimport { DataQuery, DataQueryRequest, DataQueryResponse } from '@grafana/data';\n\nimport { config } from '../config';\nimport { getBackendSrv } from '../services/backendSrv';\n\nimport { BackendDataSourceResponse, toDataQueryResponse } from './queryResponse';\n\nexport function publicDashboardQueryHandler(request: DataQueryRequest<DataQuery>): Observable<DataQueryResponse> {\n  const {\n    intervalMs,\n    maxDataPoints,\n    requestId,\n    panelId,\n    queryCachingTTL,\n    range: { from: fromRange, to: toRange },\n  } = request;\n  // Return early if no queries exist\n  if (!request.targets.length) {\n    return of({ data: [] });\n  }\n\n  const body = {\n    intervalMs,\n    maxDataPoints,\n    queryCachingTTL,\n    timeRange: {\n      from: fromRange.valueOf().toString(),\n      to: toRange.valueOf().toString(),\n      timezone: request.timezone,\n    },\n  };\n\n  return getBackendSrv()\n    .fetch<BackendDataSourceResponse>({\n      url: `/api/public/dashboards/${config.publicDashboardAccessToken!}/panels/${panelId}/query`,\n      method: 'POST',\n      data: body,\n      requestId,\n    })\n    .pipe(\n      switchMap((raw) => {\n        return of(toDataQueryResponse(raw, request.targets));\n      }),\n      catchError((err) => {\n        return of(toDataQueryResponse(err));\n      })\n    );\n}\n","import { lastValueFrom, merge, Observable, of } from 'rxjs';\nimport { catchError, switchMap } from 'rxjs/operators';\n\nimport {\n  DataFrame,\n  dataFrameToJSON,\n  DataQuery,\n  DataQueryRequest,\n  DataQueryResponse,\n  TestDataSourceResponse,\n  DataSourceApi,\n  DataSourceInstanceSettings,\n  DataSourceJsonData,\n  DataSourceRef,\n  getDataSourceRef,\n  makeClassES5Compatible,\n  parseLiveChannelAddress,\n  ScopedVars,\n  AdHocVariableFilter,\n} from '@grafana/data';\n\nimport { reportInteraction } from '../analytics/utils';\nimport { config } from '../config';\nimport {\n  BackendSrvRequest,\n  FetchResponse,\n  getBackendSrv,\n  getDataSourceSrv,\n  getGrafanaLiveSrv,\n  StreamingFrameAction,\n  StreamingFrameOptions,\n} from '../services';\n\nimport { publicDashboardQueryHandler } from './publicDashboardQueryHandler';\nimport { BackendDataSourceResponse, toDataQueryResponse } from './queryResponse';\n\n/**\n * @internal\n */\nexport const ExpressionDatasourceRef = Object.freeze({\n  type: '__expr__',\n  uid: '__expr__',\n  name: 'Expression',\n});\n\n/**\n * @public\n */\nexport function isExpressionReference(ref?: DataSourceRef | string | null): boolean {\n  if (!ref) {\n    return false;\n  }\n  const v = typeof ref === 'string' ? ref : ref.type;\n  return v === ExpressionDatasourceRef.type || v === ExpressionDatasourceRef.name || v === '-100'; // -100 was a legacy accident that should be removed\n}\n\nexport class HealthCheckError extends Error {\n  details: HealthCheckResultDetails;\n\n  constructor(message: string, details: HealthCheckResultDetails) {\n    super(message);\n    this.details = details;\n    this.name = 'HealthCheckError';\n  }\n}\n\n/**\n * Describes the current health status of a data source plugin.\n *\n * @public\n */\nexport enum HealthStatus {\n  Unknown = 'UNKNOWN',\n  OK = 'OK',\n  Error = 'ERROR',\n}\n\n// Internal for now\nenum PluginRequestHeaders {\n  PluginID = 'X-Plugin-Id', // can be used for routing\n  DatasourceUID = 'X-Datasource-Uid', // can be used for routing/ load balancing\n  DashboardUID = 'X-Dashboard-Uid', // mainly useful for debugging slow queries\n  PanelID = 'X-Panel-Id', // mainly useful for debugging slow queries\n  PanelPluginId = 'X-Panel-Plugin-Id',\n  QueryGroupID = 'X-Query-Group-Id', // mainly useful to find related queries with query splitting\n  FromExpression = 'X-Grafana-From-Expr', // used by datasources to identify expression queries\n  SkipQueryCache = 'X-Cache-Skip', // used by datasources to skip the query cache\n}\n\n/**\n * Describes the details in the payload returned when checking the health of a data source\n * plugin.\n *\n * If the 'message' key exists, this will be displayed in the error message in DataSourceSettingsPage\n * If the 'verboseMessage' key exists, this will be displayed in the expandable details in the error message in DataSourceSettingsPage\n *\n * @public\n */\nexport type HealthCheckResultDetails = Record<string, unknown> | undefined;\n\n/**\n * Describes the payload returned when checking the health of a data source\n * plugin.\n *\n * @public\n */\nexport interface HealthCheckResult {\n  status: HealthStatus;\n  message: string;\n  details: HealthCheckResultDetails;\n}\n\n/**\n * Extend this class to implement a data source plugin that is depending on the Grafana\n * backend API.\n *\n * @public\n */\nclass DataSourceWithBackend<\n  TQuery extends DataQuery = DataQuery,\n  TOptions extends DataSourceJsonData = DataSourceJsonData,\n> extends DataSourceApi<TQuery, TOptions> {\n  constructor(instanceSettings: DataSourceInstanceSettings<TOptions>) {\n    super(instanceSettings);\n  }\n\n  /**\n   * Ideally final -- any other implementation may not work as expected\n   */\n  query(request: DataQueryRequest<TQuery>): Observable<DataQueryResponse> {\n    if (config.publicDashboardAccessToken) {\n      return publicDashboardQueryHandler(request);\n    }\n\n    const { intervalMs, maxDataPoints, queryCachingTTL, range, requestId, hideFromInspector = false } = request;\n    let targets = request.targets;\n\n    let hasExpr = false;\n    const pluginIDs = new Set<string>();\n    const dsUIDs = new Set<string>();\n    const queries: DataQuery[] = targets.map((q) => {\n      let datasource = this.getRef();\n      let datasourceId = this.id;\n      let shouldApplyTemplateVariables = true;\n\n      if (isExpressionReference(q.datasource)) {\n        hasExpr = true;\n        return {\n          ...q,\n          datasource: ExpressionDatasourceRef,\n        };\n      }\n\n      if (q.datasource) {\n        const ds = getDataSourceSrv().getInstanceSettings(q.datasource, request.scopedVars);\n\n        if (!ds) {\n          throw new Error(`Unknown Datasource: ${JSON.stringify(q.datasource)}`);\n        }\n\n        const dsRef = ds.rawRef ?? getDataSourceRef(ds);\n        const dsId = ds.id;\n        if (dsRef.uid !== datasource.uid || datasourceId !== dsId) {\n          datasource = dsRef;\n          datasourceId = dsId;\n          // If the query is using a different datasource, we would need to retrieve the datasource\n          // instance (async) and apply the template variables but it seems it's not necessary for now.\n          shouldApplyTemplateVariables = false;\n        }\n      }\n      if (datasource.type?.length) {\n        pluginIDs.add(datasource.type);\n      }\n      if (datasource.uid?.length) {\n        dsUIDs.add(datasource.uid);\n      }\n      return {\n        ...(shouldApplyTemplateVariables ? this.applyTemplateVariables(q, request.scopedVars, request.filters) : q),\n        datasource,\n        datasourceId, // deprecated!\n        intervalMs,\n        maxDataPoints,\n        queryCachingTTL,\n      };\n    });\n\n    // Return early if no queries exist\n    if (!queries.length) {\n      return of({ data: [] });\n    }\n\n    const body = {\n      queries,\n      from: range?.from.valueOf().toString(),\n      to: range?.to.valueOf().toString(),\n    };\n\n    if (config.featureToggles.queryOverLive) {\n      return getGrafanaLiveSrv().getQueryData({\n        request,\n        body,\n      });\n    }\n\n    const headers: Record<string, string> = request.headers ?? {};\n    headers[PluginRequestHeaders.PluginID] = Array.from(pluginIDs).join(', ');\n    headers[PluginRequestHeaders.DatasourceUID] = Array.from(dsUIDs).join(', ');\n\n    let url = '/api/ds/query?ds_type=' + this.type;\n\n    // Use the new query service\n    if (config.featureToggles.queryServiceFromUI) {\n      if (!(config.featureToggles.queryService || config.featureToggles.grafanaAPIServerWithExperimentalAPIs)) {\n        console.warn('feature toggle queryServiceFromUI also requires the queryService to be running');\n      } else {\n        if (!hasExpr && dsUIDs.size === 1) {\n          // TODO? can we talk directly to the apiserver?\n        }\n        url = `/apis/query.grafana.app/v0alpha1/namespaces/${config.namespace}/query?ds_type=' + this.type`;\n      }\n    }\n\n    if (hasExpr) {\n      headers[PluginRequestHeaders.FromExpression] = 'true';\n      url += '&expression=true';\n    }\n\n    // Appending request ID to url to facilitate client-side performance metrics. See #65244 for more context.\n    if (requestId) {\n      url += `&requestId=${requestId}`;\n    }\n\n    if (request.dashboardUID) {\n      headers[PluginRequestHeaders.DashboardUID] = request.dashboardUID;\n      if (request.panelId) {\n        headers[PluginRequestHeaders.PanelID] = `${request.panelId}`;\n      }\n    }\n    if (request.panelPluginId) {\n      headers[PluginRequestHeaders.PanelPluginId] = `${request.panelPluginId}`;\n    }\n    if (request.queryGroupId) {\n      headers[PluginRequestHeaders.QueryGroupID] = `${request.queryGroupId}`;\n    }\n    if (request.skipQueryCache) {\n      headers[PluginRequestHeaders.SkipQueryCache] = 'true';\n    }\n    return getBackendSrv()\n      .fetch<BackendDataSourceResponse>({\n        url,\n        method: 'POST',\n        data: body,\n        requestId,\n        hideFromInspector,\n        headers,\n      })\n      .pipe(\n        switchMap((raw) => {\n          const rsp = toDataQueryResponse(raw, queries);\n          // Check if any response should subscribe to a live stream\n          if (rsp.data?.length && rsp.data.find((f: DataFrame) => f.meta?.channel)) {\n            return toStreamingDataResponse(rsp, request, this.streamOptionsProvider);\n          }\n          return of(rsp);\n        }),\n        catchError((err) => {\n          return of(toDataQueryResponse(err));\n        })\n      );\n  }\n\n  /** Get request headers with plugin ID+UID set */\n  protected getRequestHeaders(): Record<string, string> {\n    const headers: Record<string, string> = {};\n    headers[PluginRequestHeaders.PluginID] = this.type;\n    headers[PluginRequestHeaders.DatasourceUID] = this.uid;\n    return headers;\n  }\n\n  /**\n   * Apply template variables for explore\n   */\n  interpolateVariablesInQueries(queries: TQuery[], scopedVars: ScopedVars, filters?: AdHocVariableFilter[]): TQuery[] {\n    return queries.map((q) => this.applyTemplateVariables(q, scopedVars, filters));\n  }\n\n  /**\n   * Override to apply template variables and adhoc filters.  The result is usually also `TQuery`, but sometimes this can\n   * be used to modify the query structure before sending to the backend.\n   *\n   * NOTE: if you do modify the structure or use template variables, alerting queries may not work\n   * as expected\n   *\n   * @virtual\n   */\n  applyTemplateVariables(query: TQuery, scopedVars: ScopedVars, filters?: AdHocVariableFilter[]) {\n    return query;\n  }\n\n  /**\n   * Optionally override the streaming behavior\n   */\n  streamOptionsProvider: StreamOptionsProvider<TQuery> = standardStreamOptionsProvider;\n\n  /**\n   * Make a GET request to the datasource resource path\n   */\n  async getResource<T = any>(\n    path: string,\n    params?: BackendSrvRequest['params'],\n    options?: Partial<BackendSrvRequest>\n  ): Promise<T> {\n    const headers = this.getRequestHeaders();\n    const result = await lastValueFrom(\n      getBackendSrv().fetch<T>({\n        ...options,\n        method: 'GET',\n        headers: options?.headers ? { ...options.headers, ...headers } : headers,\n        params: params ?? options?.params,\n        url: `/api/datasources/uid/${this.uid}/resources/${path}`,\n      })\n    );\n    return result.data;\n  }\n\n  /**\n   * Send a POST request to the datasource resource path\n   */\n  async postResource<T = unknown>(\n    path: string,\n    data?: BackendSrvRequest['data'],\n    options?: Partial<BackendSrvRequest>\n  ): Promise<T> {\n    const headers = this.getRequestHeaders();\n    const result = await lastValueFrom(\n      getBackendSrv().fetch<T>({\n        ...options,\n        method: 'POST',\n        headers: options?.headers ? { ...options.headers, ...headers } : headers,\n        data: data ?? { ...data },\n        url: `/api/datasources/uid/${this.uid}/resources/${path}`,\n      })\n    );\n    return result.data;\n  }\n\n  /**\n   * Run the datasource healthcheck\n   */\n  async callHealthCheck(): Promise<HealthCheckResult> {\n    return lastValueFrom(\n      getBackendSrv().fetch<HealthCheckResult>({\n        method: 'GET',\n        url: `/api/datasources/uid/${this.uid}/health`,\n        showErrorAlert: false,\n        headers: this.getRequestHeaders(),\n      })\n    )\n      .then((v: FetchResponse<HealthCheckResult>) => v.data)\n      .catch((err) => {\n        let properties: Record<string, string> = {\n          plugin_id: this.meta?.id || '',\n          plugin_version: this.meta?.info?.version || '',\n          datasource_healthcheck_status: err?.data?.status || 'error',\n          datasource_healthcheck_message: err?.data?.message || '',\n        };\n        reportInteraction('datasource_health_check_completed', properties);\n        return err.data;\n      });\n  }\n\n  /**\n   * Checks the plugin health\n   * see public/app/features/datasources/state/actions.ts for what needs to be returned here\n   */\n  async testDatasource(): Promise<TestDataSourceResponse> {\n    return this.callHealthCheck().then((res) => {\n      if (res.status === HealthStatus.OK) {\n        return {\n          status: 'success',\n          message: res.message,\n        };\n      }\n\n      return Promise.reject({\n        status: 'error',\n        message: res.message,\n        error: new HealthCheckError(res.message, res.details),\n      });\n    });\n  }\n}\n\n/**\n * @internal exported for tests\n */\nexport function toStreamingDataResponse<TQuery extends DataQuery = DataQuery>(\n  rsp: DataQueryResponse,\n  req: DataQueryRequest<TQuery>,\n  getter: (req: DataQueryRequest<TQuery>, frame: DataFrame) => Partial<StreamingFrameOptions>\n): Observable<DataQueryResponse> {\n  const live = getGrafanaLiveSrv();\n  if (!live) {\n    return of(rsp); // add warning?\n  }\n\n  const staticdata: DataFrame[] = [];\n  const streams: Array<Observable<DataQueryResponse>> = [];\n  for (const f of rsp.data) {\n    const addr = parseLiveChannelAddress(f.meta?.channel);\n    if (addr) {\n      const frame: DataFrame = f;\n      streams.push(\n        live.getDataStream({\n          addr,\n          buffer: getter(req, frame),\n          frame: dataFrameToJSON(f),\n        })\n      );\n    } else {\n      staticdata.push(f);\n    }\n  }\n  if (staticdata.length) {\n    streams.push(of({ ...rsp, data: staticdata }));\n  }\n  if (streams.length === 1) {\n    return streams[0]; // avoid merge wrapper\n  }\n  return merge(...streams);\n}\n\n/**\n * This allows data sources to customize the streaming connection query\n *\n * @public\n */\nexport type StreamOptionsProvider<TQuery extends DataQuery = DataQuery> = (\n  request: DataQueryRequest<TQuery>,\n  frame: DataFrame\n) => Partial<StreamingFrameOptions>;\n\n/**\n * @public\n */\nexport const standardStreamOptionsProvider: StreamOptionsProvider = (request: DataQueryRequest, frame: DataFrame) => {\n  const opts: Partial<StreamingFrameOptions> = {\n    maxLength: request.maxDataPoints ?? 500,\n    action: StreamingFrameAction.Append,\n  };\n\n  // For recent queries, clamp to the current time range\n  if (request.rangeRaw?.to === 'now') {\n    opts.maxDelta = request.range.to.valueOf() - request.range.from.valueOf();\n  }\n  return opts;\n};\n\n//@ts-ignore\nDataSourceWithBackend = makeClassES5Compatible(DataSourceWithBackend);\n\nexport { DataSourceWithBackend };\n","import * as React from 'react';\n\nimport { AbsoluteTimeRange, FieldConfigSource, PanelData } from '@grafana/data';\n\n/**\n * Describes the properties that can be passed to the PanelRenderer.\n *\n * @typeParam P - Panel options type for the panel being rendered.\n * @typeParam F - Field options type for the panel being rendered.\n *\n * @internal\n */\nexport interface PanelRendererProps<P extends object = {}, F extends object = {}> {\n  data?: PanelData;\n  pluginId: string;\n  title: string;\n  options?: Partial<P>;\n  onOptionsChange?: (options: P) => void;\n  onFieldConfigChange?: (config: FieldConfigSource<F>) => void;\n  onChangeTimeRange?: (timeRange: AbsoluteTimeRange) => void;\n  fieldConfig?: FieldConfigSource<Partial<F>>;\n  timeZone?: string;\n  width: number;\n  height: number;\n}\n\n/**\n * Simplified type with defaults that describes the PanelRenderer.\n *\n * @internal\n */\nexport type PanelRendererType<P extends object = {}, F extends object = {}> = React.ComponentType<\n  PanelRendererProps<P, F>\n>;\n\n/**\n * PanelRenderer component that will be set via the {@link setPanelRenderer} function\n * when Grafana starts. The implementation being used during runtime lives in Grafana\n * core.\n *\n * @internal\n */\nexport let PanelRenderer: PanelRendererType = () => {\n  return <div>PanelRenderer can only be used after Grafana instance has been started.</div>;\n};\n\n/**\n * Used to bootstrap the PanelRenderer during application start so the PanelRenderer\n * is exposed via runtime.\n *\n * @internal\n */\nexport function setPanelRenderer(renderer: PanelRendererType) {\n  PanelRenderer = renderer;\n}\n","import * as React from 'react';\n\nimport { FieldConfigSource, PanelData, VisualizationSuggestion } from '@grafana/data';\n\n/**\n * Describes the properties that can be passed to the PanelDataErrorView.\n *\n * @alpha\n */\nexport interface PanelDataErrorViewProps {\n  message?: string;\n  panelId: number;\n  data: PanelData;\n  fieldConfig?: FieldConfigSource;\n  needsTimeField?: boolean;\n  needsNumberField?: boolean;\n  needsStringField?: boolean;\n  suggestions?: VisualizationSuggestion[];\n}\n\n/**\n * Simplified type with defaults that describes the PanelDataErrorView.\n *\n * @internal\n */\nexport type PanelDataErrorViewType = React.ComponentType<PanelDataErrorViewProps>;\n\n/**\n * PanelDataErrorView allows panels to show a consistent error message when\n * the result structure does not meet expected criteria\n *\n * @alpha\n */\nexport let PanelDataErrorView: PanelDataErrorViewType = ({ message }) => {\n  return <div>Unable to render data: {message}.</div>;\n};\n\n/**\n * Used to bootstrap the PanelDataErrorView during application start so the\n * PanelDataErrorView is exposed via runtime.\n *\n * @internal\n */\nexport function setPanelDataErrorView(renderer: PanelDataErrorViewType) {\n  PanelDataErrorView = renderer;\n}\n","import { Observable } from 'rxjs';\n\nimport { DataQueryRequest, DataSourceApi, PanelData, QueryRunner } from '@grafana/data';\n\nlet factory: QueryRunnerFactory | undefined;\n\n/**\n * @internal\n */\nexport type QueryRunnerFactory = () => QueryRunner;\n\n/**\n * Used to bootstrap the {@link createQueryRunner} during application start.\n *\n * @internal\n */\nexport const setQueryRunnerFactory = (instance: QueryRunnerFactory): void => {\n  if (factory) {\n    throw new Error('Runner should only be set when Grafana is starting.');\n  }\n  factory = instance;\n};\n\n/**\n * Used to create QueryRunner instances from outside the core Grafana application.\n * This is helpful to be able to create a QueryRunner to execute queries in e.g. an app plugin.\n *\n * @internal\n */\nexport const createQueryRunner = (): QueryRunner => {\n  if (!factory) {\n    throw new Error('`createQueryRunner` can only be used after Grafana instance has started.');\n  }\n  return factory();\n};\n\ntype RunRequestFn = (\n  datasource: DataSourceApi,\n  request: DataQueryRequest,\n  queryFunction?: typeof datasource.query\n) => Observable<PanelData>;\n\nlet runRequest: RunRequestFn | undefined;\n\n/**\n * Used to exspose runRequest implementation to libraries, i.e. @grafana/scenes\n *\n * @internal\n */\nexport function setRunRequest(fn: RunRequestFn): void {\n  if (runRequest && process.env.NODE_ENV !== 'test') {\n    throw new Error('runRequest function should only be set once, when Grafana is starting.');\n  }\n  runRequest = fn;\n}\n\nexport function getRunRequest(): RunRequestFn {\n  if (!runRequest) {\n    throw new Error('getRunRequest can only be used after Grafana instance has started.');\n  }\n  return runRequest;\n}\n","import * as React from 'react';\n\nimport { NavModelItem, PageLayoutType } from '@grafana/data';\n\nexport interface PageInfoItem {\n  label: string;\n  value: React.ReactNode;\n}\n\nexport interface PluginPageProps {\n  /** Can be used to place actions inline with the heading */\n  info?: PageInfoItem[];\n  /** Can be used to place actions inline with the heading */\n  actions?: React.ReactNode;\n  /** Can be used to customize rendering of title */\n  renderTitle?: (title: string) => React.ReactNode;\n  /** Shown under main heading */\n  subTitle?: React.ReactNode;\n  pageNav?: NavModelItem;\n  children: React.ReactNode;\n  layout?: PageLayoutType;\n}\n\nexport type PluginPageType = React.ComponentType<PluginPageProps>;\n\nexport let PluginPage: PluginPageType = ({ children }) => {\n  return <div>{children}</div>;\n};\n\n/**\n * Used to bootstrap the PluginPage during application start\n * is exposed via runtime.\n *\n * @internal\n */\nexport function setPluginPage(component: PluginPageType) {\n  PluginPage = component;\n}\n","// Libraries\nimport { PureComponent } from 'react';\n\n// Components\nimport {\n  DataSourceInstanceSettings,\n  DataSourceRef,\n  getDataSourceUID,\n  isUnsignedPluginSignature,\n  SelectableValue,\n} from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { ActionMeta, PluginSignatureBadge, Select, Stack } from '@grafana/ui';\n\nimport { getDataSourceSrv } from '../services/dataSourceSrv';\n\nimport { ExpressionDatasourceRef } from './../utils/DataSourceWithBackend';\n\n/**\n * Component props description for the {@link DataSourcePicker}\n *\n * @internal\n */\nexport interface DataSourcePickerProps {\n  onChange: (ds: DataSourceInstanceSettings) => void;\n  current: DataSourceRef | string | null; // uid\n  hideTextValue?: boolean;\n  onBlur?: () => void;\n  autoFocus?: boolean;\n  openMenuOnFocus?: boolean;\n  placeholder?: string;\n  tracing?: boolean;\n  mixed?: boolean;\n  dashboard?: boolean;\n  metrics?: boolean;\n  type?: string | string[];\n  annotations?: boolean;\n  variables?: boolean;\n  alerting?: boolean;\n  pluginId?: string;\n  /** If true,we show only DSs with logs; and if true, pluginId shouldnt be passed in */\n  logs?: boolean;\n  // If set to true and there is no value select will be empty, otherwise it will preselect default data source\n  noDefault?: boolean;\n  width?: number;\n  inputId?: string;\n  filter?: (dataSource: DataSourceInstanceSettings) => boolean;\n  onClear?: () => void;\n  invalid?: boolean;\n  disabled?: boolean;\n  isLoading?: boolean;\n}\n\n/**\n * Component state description for the {@link DataSourcePicker}\n *\n * @internal\n */\nexport interface DataSourcePickerState {\n  error?: string;\n}\n\n/**\n * Component to be able to select a datasource from the list of installed and enabled\n * datasources in the current Grafana instance.\n *\n * @internal\n */\nexport class DataSourcePicker extends PureComponent<DataSourcePickerProps, DataSourcePickerState> {\n  dataSourceSrv = getDataSourceSrv();\n\n  static defaultProps: Partial<DataSourcePickerProps> = {\n    autoFocus: false,\n    openMenuOnFocus: false,\n    placeholder: 'Select data source',\n  };\n\n  state: DataSourcePickerState = {};\n\n  constructor(props: DataSourcePickerProps) {\n    super(props);\n  }\n\n  componentDidMount() {\n    const { current } = this.props;\n    const dsSettings = this.dataSourceSrv.getInstanceSettings(current);\n    if (!dsSettings) {\n      this.setState({ error: 'Could not find data source ' + current });\n    }\n  }\n\n  onChange = (item: SelectableValue<string>, actionMeta: ActionMeta) => {\n    if (actionMeta.action === 'clear' && this.props.onClear) {\n      this.props.onClear();\n      return;\n    }\n\n    const dsSettings = this.dataSourceSrv.getInstanceSettings(item.value);\n\n    if (dsSettings) {\n      this.props.onChange(dsSettings);\n      this.setState({ error: undefined });\n    }\n  };\n\n  private getCurrentValue(): SelectableValue<string> | undefined {\n    const { current, hideTextValue, noDefault } = this.props;\n    if (!current && noDefault) {\n      return;\n    }\n\n    const ds = this.dataSourceSrv.getInstanceSettings(current);\n\n    if (ds) {\n      return {\n        label: ds.name.slice(0, 37),\n        value: ds.uid,\n        imgUrl: ds.meta.info.logos.small,\n        hideText: hideTextValue,\n        meta: ds.meta,\n      };\n    }\n\n    const uid = getDataSourceUID(current);\n\n    if (uid === ExpressionDatasourceRef.uid || uid === ExpressionDatasourceRef.name) {\n      return { label: uid, value: uid, hideText: hideTextValue };\n    }\n\n    return {\n      label: (uid ?? 'no name') + ' - not found',\n      value: uid ?? undefined,\n      imgUrl: '',\n      hideText: hideTextValue,\n    };\n  }\n\n  getDataSourceOptions() {\n    const { alerting, tracing, metrics, mixed, dashboard, variables, annotations, pluginId, type, filter, logs } =\n      this.props;\n\n    const options = this.dataSourceSrv\n      .getList({\n        alerting,\n        tracing,\n        metrics,\n        logs,\n        dashboard,\n        mixed,\n        variables,\n        annotations,\n        pluginId,\n        filter,\n        type,\n      })\n      .map((ds) => ({\n        value: ds.name,\n        label: `${ds.name}${ds.isDefault ? ' (default)' : ''}`,\n        imgUrl: ds.meta.info.logos.small,\n        meta: ds.meta,\n      }));\n\n    return options;\n  }\n\n  render() {\n    const {\n      autoFocus,\n      onBlur,\n      onClear,\n      openMenuOnFocus,\n      placeholder,\n      width,\n      inputId,\n      disabled = false,\n      isLoading = false,\n    } = this.props;\n    const { error } = this.state;\n    const options = this.getDataSourceOptions();\n    const value = this.getCurrentValue();\n    const isClearable = typeof onClear === 'function';\n\n    return (\n      <div\n        aria-label=\"Data source picker select container\"\n        data-testid={selectors.components.DataSourcePicker.container}\n      >\n        <Select\n          isLoading={isLoading}\n          disabled={disabled}\n          aria-label={'Select a data source'}\n          data-testid={selectors.components.DataSourcePicker.inputV2}\n          inputId={inputId || 'data-source-picker'}\n          className=\"ds-picker select-container\"\n          isMulti={false}\n          isClearable={isClearable}\n          backspaceRemovesValue={false}\n          onChange={this.onChange}\n          options={options}\n          autoFocus={autoFocus}\n          onBlur={onBlur}\n          width={width}\n          openMenuOnFocus={openMenuOnFocus}\n          maxMenuHeight={500}\n          placeholder={placeholder}\n          noOptionsMessage=\"No datasources found\"\n          value={value ?? null}\n          invalid={Boolean(error) || Boolean(this.props.invalid)}\n          getOptionLabel={(o) => {\n            if (o.meta && isUnsignedPluginSignature(o.meta.signature) && o !== value) {\n              return (\n                <Stack alignItems=\"center\" justifyContent=\"space-between\">\n                  <span>{o.label}</span> <PluginSignatureBadge status={o.meta.signature} />\n                </Stack>\n              );\n            }\n            return o.label || '';\n          }}\n        />\n      </div>\n    );\n  }\n}\n","import { DataSourceInstanceSettings, PluginMeta } from '@grafana/data';\n\nimport { config } from '../../config';\n\nexport type PluginEventProperties = {\n  grafana_version: string;\n  plugin_type: string;\n  plugin_version: string;\n  plugin_id: string;\n  plugin_name: string;\n};\n\nexport function createPluginEventProperties(meta: PluginMeta): PluginEventProperties {\n  return {\n    grafana_version: config.buildInfo.version,\n    plugin_type: String(meta.type),\n    plugin_version: meta.info.version,\n    plugin_id: meta.id,\n    plugin_name: meta.name,\n  };\n}\n\nexport type DataSourcePluginEventProperties = PluginEventProperties & {\n  datasource_uid: string;\n};\n\nexport function createDataSourcePluginEventProperties(\n  instanceSettings: DataSourceInstanceSettings\n): DataSourcePluginEventProperties {\n  return {\n    ...createPluginEventProperties(instanceSettings.meta),\n    datasource_uid: instanceSettings.uid,\n  };\n}\n","import { useMemo } from 'react';\n\nimport { isDataSourcePluginContext, usePluginContext } from '@grafana/data';\n\nimport { reportInteraction } from '../utils';\n\nimport { createDataSourcePluginEventProperties, createPluginEventProperties } from './eventProperties';\n\nconst namePrefix = 'grafana_plugin_';\n\nexport function usePluginInteractionReporter(): typeof reportInteraction {\n  const context = usePluginContext();\n\n  return useMemo(() => {\n    // Happens when the hook is not used inside a plugin (e.g. in core Grafana)\n    if (!context) {\n      throw new Error(\n        `No PluginContext found. The usePluginInteractionReporter() hook can only be used from a plugin.`\n      );\n    }\n\n    const info = isDataSourcePluginContext(context)\n      ? createDataSourcePluginEventProperties(context.instanceSettings)\n      : createPluginEventProperties(context.meta);\n\n    return (interactionName: string, properties?: Record<string, unknown>) => {\n      if (!validInteractionName(interactionName)) {\n        throw new Error(`Interactions reported in plugins should start with: \"${namePrefix}\".`);\n      }\n      return reportInteraction(interactionName, { ...properties, ...info });\n    };\n  }, [context]);\n}\n\nfunction validInteractionName(interactionName: string): boolean {\n  return interactionName.startsWith(namePrefix) && interactionName.length > namePrefix.length;\n}\n","type ReturnToPreviousHook = () => (title: string, href?: string) => void;\n\nlet rtpHook: ReturnToPreviousHook | undefined = undefined;\n\nexport const setReturnToPreviousHook = (hook: ReturnToPreviousHook) => {\n  rtpHook = hook;\n};\n\n/**\n * Guidelines:\n * - Only use the ‘Return to previous’ functionality when the user is sent to another context, such as from Alerting to a dashboard.\n * - Specify a button title that identifies the page to return to in the most understandable way. Do not use text such as ‘Back to the previous page’. Be specific.\n */\nexport const useReturnToPrevious: ReturnToPreviousHook = () => {\n  if (!rtpHook) {\n    if (process.env.NODE_ENV !== 'production') {\n      throw new Error('useReturnToPrevious hook not found in @grafana/runtime');\n    }\n    return () => console.error('ReturnToPrevious hook not found');\n  }\n\n  return rtpHook();\n};\n","type ChromeHeaderHeightHook = () => number;\n\nlet chromeHeaderHeightHook: ChromeHeaderHeightHook | undefined = undefined;\n\nexport const setChromeHeaderHeightHook = (hook: ChromeHeaderHeightHook) => {\n  chromeHeaderHeightHook = hook;\n};\n\nexport const useChromeHeaderHeight = () => {\n  if (!chromeHeaderHeightHook) {\n    if (process.env.NODE_ENV !== 'production') {\n      throw new Error('useChromeHeaderHeight hook not found in @grafana/runtime');\n    }\n    console.error('useChromeHeaderHeight hook not found');\n  }\n\n  return chromeHeaderHeightHook?.();\n};\n","import * as React from 'react';\n\nexport interface EmbeddedDashboardProps {\n  uid?: string;\n  /**\n   * Use this property to override initial time and variable state.\n   * Example: ?from=now-5m&to=now&var-varname=value1\n   */\n  initialState?: string;\n  /**\n   * Is called when ever the internal embedded dashboards url state changes.\n   * Can be used to sync the internal url state (Which is not synced to URL) with the external context, or to\n   * preserve some of the state when moving to other embedded dashboards.\n   */\n  onStateChange?: (state: string) => void;\n}\n\n/**\n * Returns a React component that renders an embedded dashboard.\n * @alpha\n */\nexport let EmbeddedDashboard: React.ComponentType<EmbeddedDashboardProps> = () => {\n  throw new Error('EmbeddedDashboard requires runtime initialization');\n};\n\n/**\n *\n * @internal\n */\nexport function setEmbeddedDashboard(component: React.ComponentType<EmbeddedDashboardProps>) {\n  EmbeddedDashboard = component;\n}\n","import {\n  userHasPermission,\n  userHasPermissionInMetadata,\n  userHasAllPermissions,\n  userHasAnyPermission,\n  WithAccessControlMetadata,\n} from '@grafana/data';\n\nimport { getCurrentUser } from '../services/user';\n\nexport const hasPermission = (action: string) => userHasPermission(action, getCurrentUser());\n\nexport const hasPermissionInMetadata = (action: string, object: WithAccessControlMetadata) =>\n  userHasPermissionInMetadata(action, object);\n\nexport const hasAllPermissions = (actions: string[]) => userHasAllPermissions(actions, getCurrentUser());\n\nexport const hasAnyPermission = (actions: string[]) => userHasAnyPermission(actions, getCurrentUser());\n","import { DataQueryRequest } from '@grafana/data';\nimport { DataQuery } from '@grafana/schema';\n\nimport { config } from '../config';\nimport { getBackendSrv } from '../services';\n\nimport { DataSourceWithBackend } from './DataSourceWithBackend';\n\n/**\n * @alpha Experimental: Plugins implementing MigrationHandler interface will automatically have their queries migrated.\n */\nexport interface MigrationHandler {\n  hasBackendMigration: boolean;\n  shouldMigrate(query: DataQuery): boolean;\n}\n\nexport function isMigrationHandler(object: unknown): object is MigrationHandler {\n  return object instanceof DataSourceWithBackend && 'hasBackendMigration' in object && 'shouldMigrate' in object;\n}\n\nasync function postMigrateRequest<TQuery extends DataQuery>(queries: TQuery[]): Promise<TQuery[]> {\n  if (!(config.featureToggles.grafanaAPIServerWithExperimentalAPIs || config.featureToggles.datasourceAPIServers)) {\n    console.warn('migrateQuery is only available with the experimental API server');\n    return queries;\n  }\n\n  // Obtaining the GroupName from the plugin ID as done in the backend, this is temporary until we have a better way to obtain it\n  // https://github.com/grafana/grafana/blob/e013cd427cb0457177e11f19ebd30bc523b36c76/pkg/plugins/apiserver.go#L10\n  const dsnameURL = queries[0].datasource?.type?.replace(/^(grafana-)?(.*?)(-datasource)?$/, '$2');\n  const groupName = `${dsnameURL}.datasource.grafana.app`;\n  // Asuming apiVersion is v0alpha1, we'll need to obtain it from a trusted source\n  const apiVersion = 'v0alpha1';\n  const url = `/apis/${groupName}/${apiVersion}/namespaces/${config.namespace}/queryconvert`;\n  const request = {\n    queries: queries.map((query) => {\n      return {\n        ...query,\n        JSON: query, // JSON is not part of the type but it should be what holds the query\n      };\n    }),\n  };\n  const res = await getBackendSrv().post(url, request);\n  return res.queries.map((query: { JSON: TQuery }) => query.JSON);\n}\n\n/**\n * @alpha Experimental: Calls migration endpoint with one query. Requires grafanaAPIServerWithExperimentalAPIs or datasourceAPIServers feature toggle.\n */\nexport async function migrateQuery<TQuery extends DataQuery>(\n  datasource: MigrationHandler,\n  query: TQuery\n): Promise<TQuery> {\n  if (!datasource.hasBackendMigration || !datasource.shouldMigrate(query)) {\n    return query;\n  }\n  const res = await postMigrateRequest([query]);\n  return res[0];\n}\n\n/**\n * @alpha Experimental: Calls migration endpoint with multiple queries. Requires grafanaAPIServerWithExperimentalAPIs or datasourceAPIServers feature toggle.\n */\nexport async function migrateRequest<TQuery extends DataQuery>(\n  datasource: MigrationHandler,\n  request: DataQueryRequest<TQuery>\n): Promise<DataQueryRequest<TQuery>> {\n  if (!datasource.hasBackendMigration || !request.targets.some((query) => datasource.shouldMigrate(query))) {\n    return request;\n  }\n  const res = await postMigrateRequest(request.targets);\n  return { ...request, targets: res };\n}\n","import React, { useEffect, useState } from 'react';\nimport Skeleton from 'react-loading-skeleton';\n\nimport { DataSourceApi, DataSourceOptionsType, DataSourceQueryType, QueryEditorProps } from '@grafana/data';\nimport { DataQuery, DataSourceJsonData } from '@grafana/schema';\n\nimport { isMigrationHandler, migrateQuery } from '../utils/migrationHandler';\n\n/**\n * @alpha Experimental: QueryEditorWithMigration is a higher order component that wraps the QueryEditor component\n * and ensures that the query is migrated before being passed to the QueryEditor.\n */\nexport function QueryEditorWithMigration<\n  DSType extends DataSourceApi<TQuery, TOptions>,\n  TQuery extends DataQuery = DataSourceQueryType<DSType>,\n  TOptions extends DataSourceJsonData = DataSourceOptionsType<DSType>,\n>(QueryEditor: React.ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>) {\n  const WithExtra = (props: QueryEditorProps<DSType, TQuery, TOptions>) => {\n    const [migrated, setMigrated] = useState(false);\n    const [query, setQuery] = useState(props.query);\n\n    useEffect(() => {\n      if (props.query && isMigrationHandler(props.datasource)) {\n        migrateQuery(props.datasource, props.query).then((migrated) => {\n          props.onChange(migrated);\n          setQuery(migrated);\n          setMigrated(true);\n        });\n      } else {\n        setMigrated(true);\n      }\n    }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n    useEffect(() => {\n      setQuery(props.query);\n    }, [props.query]);\n\n    if (!migrated) {\n      return <Skeleton containerTestId=\"react-loading-skeleton-testid\" height={75} />;\n    }\n    return <QueryEditor {...props} query={query} />;\n  };\n  return WithExtra;\n}\n","import { get } from 'lodash';\nimport { lastValueFrom } from 'rxjs';\n\nimport { usePluginContext } from '@grafana/data';\n\nimport { config } from '../config';\nimport { BackendSrvRequest, getBackendSrv } from '../services';\n\nconst baseURL = `/apis/userstorage.grafana.app/v0alpha1/namespaces/${config.namespace}/user-storage`;\n\ninterface RequestOptions extends BackendSrvRequest {\n  manageError?: (err: unknown) => { error: unknown };\n  showErrorAlert?: boolean;\n\n  // rtk codegen sets this\n  body?: BackendSrvRequest['data'];\n}\n\nexport type UserStorageSpec = {\n  data: { [key: string]: string };\n};\n\nasync function apiRequest<T>(requestOptions: RequestOptions) {\n  try {\n    const { data: responseData, ...meta } = await lastValueFrom(\n      getBackendSrv().fetch<T>({\n        ...requestOptions,\n        url: baseURL + requestOptions.url,\n        data: requestOptions.body,\n      })\n    );\n    return { data: responseData, meta };\n  } catch (error) {\n    return requestOptions.manageError ? requestOptions.manageError(error) : { error };\n  }\n}\n\n/**\n * A class for interacting with the backend user storage.\n * Unexported because it is currently only be used through the useUserStorage hook.\n */\nclass UserStorage {\n  private service: string;\n  private resourceName: string;\n  private userUID: string;\n  private canUseUserStorage: boolean;\n  private storageSpec: UserStorageSpec | null | undefined;\n\n  constructor(service: string) {\n    this.service = service;\n    this.userUID = config.bootData.user.uid === '' ? config.bootData.user.id.toString() : config.bootData.user.uid;\n    this.resourceName = `${service}:${this.userUID}`;\n    this.canUseUserStorage = config.featureToggles.userStorageAPI === true && config.bootData.user.isSignedIn;\n  }\n\n  private async init() {\n    if (this.storageSpec !== undefined) {\n      return;\n    }\n    const userStorage = await apiRequest<{ spec: UserStorageSpec }>({\n      url: `/${this.resourceName}`,\n      method: 'GET',\n      showErrorAlert: false,\n    });\n    if ('error' in userStorage) {\n      if (get(userStorage, 'error.status') !== 404) {\n        console.error('Failed to get user storage', userStorage.error);\n      }\n      // No user storage found, return null\n      this.storageSpec = null;\n    } else {\n      this.storageSpec = userStorage.data.spec;\n    }\n  }\n\n  async getItem(key: string): Promise<string | null> {\n    if (!this.canUseUserStorage) {\n      // Fallback to localStorage\n      return localStorage.getItem(this.resourceName);\n    }\n    // Ensure this.storageSpec is initialized\n    await this.init();\n    if (!this.storageSpec) {\n      // Also, fallback to localStorage for backward compatibility once userStorageAPI is enabled\n      return localStorage.getItem(this.resourceName);\n    }\n    return this.storageSpec.data[key];\n  }\n\n  async setItem(key: string, value: string): Promise<void> {\n    if (!this.canUseUserStorage) {\n      // Fallback to localStorage\n      localStorage.setItem(key, value);\n      return;\n    }\n\n    const newData = { data: { [key]: value } };\n    // Ensure this.storageSpec is initialized\n    await this.init();\n\n    if (!this.storageSpec) {\n      // No user storage found, create a new one\n      await apiRequest<UserStorageSpec>({\n        url: `/`,\n        method: 'POST',\n        body: {\n          metadata: { name: this.resourceName, labels: { user: this.userUID, service: this.service } },\n          spec: newData,\n        },\n      });\n      this.storageSpec = newData;\n      return;\n    }\n\n    // Update existing user storage\n    this.storageSpec.data[key] = value;\n    await apiRequest<UserStorageSpec>({\n      headers: { 'Content-Type': 'application/merge-patch+json' },\n      url: `/${this.resourceName}`,\n      method: 'PATCH',\n      body: { spec: newData },\n    });\n  }\n}\n\nexport interface PluginUserStorage {\n  /**\n   * Retrieves an item from the backend user storage or local storage if not enabled.\n   * @param key - The key of the item to retrieve.\n   * @returns A promise that resolves to the item value or null if not found.\n   */\n  getItem(key: string): Promise<string | null>;\n  /**\n   * Sets an item in the backend user storage or local storage if not enabled.\n   * @param key - The key of the item to set.\n   * @param value - The value of the item to set.\n   * @returns A promise that resolves when the item is set.\n   */\n  setItem(key: string, value: string): Promise<void>;\n}\n\n/**\n * A hook for interacting with the backend user storage (or local storage if not enabled).\n * @returns An scoped object for a plugin and a user with getItem and setItem functions.\n * @alpha Experimental\n */\nexport function usePluginUserStorage(): PluginUserStorage {\n  const context = usePluginContext();\n  if (!context) {\n    throw new Error(`No PluginContext found. The usePluginUserStorage() hook can only be used from a plugin.`);\n  }\n  return new UserStorage(context?.meta.id);\n}\n","import * as React from 'react';\n\ninterface FolderPickerProps {\n  /* Folder UID to show as selected */\n  value?: string;\n\n  /** Show an invalid state around the folder picker */\n  invalid?: boolean;\n\n  /* Whether to show the root 'Dashboards' (formally General) folder as selectable */\n  showRootFolder?: boolean;\n\n  /* Folder UIDs to exclude from the picker, to prevent invalid operations */\n  excludeUIDs?: string[];\n\n  /* Show folders matching this permission, mainly used to also show folders user can view. Defaults to showing only folders user has Edit  */\n  permission?: 'view' | 'edit';\n\n  /* Callback for when the user selects a folder */\n  onChange?: (folderUID: string | undefined, folderName: string | undefined) => void;\n\n  /* Whether the picker should be clearable */\n  clearable?: boolean;\n}\n\ntype FolderPickerComponentType = React.ComponentType<FolderPickerProps>;\n\nlet FolderPickerComponent: FolderPickerComponentType | undefined;\n\n/**\n * Used to bootstrap the FolderPicker during application start\n *\n * @internal\n */\nexport function setFolderPicker(component: FolderPickerComponentType) {\n  FolderPickerComponent = component;\n}\n\nexport function FolderPicker(props: FolderPickerProps) {\n  if (FolderPickerComponent) {\n    return <FolderPickerComponent {...props} />;\n  }\n\n  if (process.env.NODE_ENV !== 'production') {\n    return <div>@grafana/runtime FolderPicker is not set</div>;\n  }\n\n  return null;\n}\n","import {\n  DataFrame,\n  DataLinkPostProcessor,\n  DataLinkTransformationConfig,\n  DataSourceInstanceSettings,\n  TimeRange,\n} from '@grafana/data';\n\nexport type CorrelationConfigQuery = {\n  field: string;\n  target: object; // for queries, this contains anything that would go in the query editor, so any extension off DataQuery a datasource would have, and needs to be generic.\n  transformations?: DataLinkTransformationConfig[];\n};\n\nexport type CorrelationConfigExternal = {\n  field: string;\n  target: {\n    url: string; // For external, this simply contains a URL\n  };\n  transformations?: DataLinkTransformationConfig[];\n};\n\ntype CorrelationBase = {\n  uid: string;\n  sourceUID: string;\n  label?: string;\n  description?: string;\n  provisioned: boolean;\n  orgId?: number;\n};\n\n/**\n * @alpha\n */\nexport type CorrelationExternal = CorrelationBase & {\n  type: 'external';\n  config: CorrelationConfigExternal;\n};\n\n/**\n * @alpha\n */\nexport type CorrelationQuery = CorrelationBase & {\n  type: 'query';\n  config: CorrelationConfigQuery;\n  targetUID: string;\n};\n\n/**\n * @alpha\n */\nexport type CorrelationData =\n  | (Omit<CorrelationExternal, 'sourceUID'> & {\n      source: DataSourceInstanceSettings;\n    })\n  | (Omit<CorrelationQuery, 'sourceUID' | 'targetUID'> & {\n      source: DataSourceInstanceSettings;\n      target: DataSourceInstanceSettings;\n    });\n\n/**\n * @alpha\n */\nexport interface CorrelationsData {\n  correlations: CorrelationData[];\n  page: number;\n  limit: number;\n  totalCount: number;\n}\n\n/**\n * Used to work with user defined correlations.\n * Should be accessed via {@link getCorrelationsService} function.\n *\n * @alpha\n */\nexport interface CorrelationsService {\n  /**\n   * Creates data links in data frames from provided correlations\n   *\n   * @param dataFrames list of data frames to be processed\n   * @param correlations list of of possible correlations that can be applied\n   * @param dataFrameRefIdToDataSourceUid a map that for provided refId references corresponding data source ui\n   */\n  attachCorrelationsToDataFrames: (\n    dataFrames: DataFrame[],\n    correlations: CorrelationData[],\n    dataFrameRefIdToDataSourceUid: Record<string, string>\n  ) => DataFrame[];\n\n  /**\n   * Creates a link post processor function that handles correlation transformations\n   *\n   * @param timeRange The current time range\n   */\n  correlationsDataLinkPostProcessorFactory: (timeRange: TimeRange) => DataLinkPostProcessor;\n\n  /**\n   * Loads all the correlations defined for the given data sources.\n   *\n   * @param sourceUIDs Data source UIDs\n   */\n  getCorrelationsBySourceUIDs: (sourceUIDs: string[]) => Promise<CorrelationsData>;\n}\n\nlet singletonInstance: CorrelationsService;\n\n/**\n * Used during startup by Grafana to set the CorrelationsService so it is available\n * via {@link getCorrelationsService} to the rest of the application.\n *\n * @internal\n */\nexport function setCorrelationsService(instance: CorrelationsService) {\n  singletonInstance = instance;\n}\n\n/**\n * Used to retrieve the {@link CorrelationsService}.\n *\n * @alpha\n */\nexport function getCorrelationsService(): CorrelationsService {\n  return singletonInstance;\n}\n"],"names":["singletonInstance","EchoEventType","singleton","options","merge","systemDateFormats","getThemeById","config","H","BehaviorSubject","urlUtil","deprecationWarning","locationService","createLogger","attachDebugger","React","useContext","BusEventBase","BusEventWithPayload","mainLocationService","map","pick","createContext","useObservable","PluginExtensionTypes","useMemo","DataSourceApi","PluginType","Observable","MetaAnalyticsEventName","faro","LogLevel","LoadingState","data","dataFrameFromJSON","toDataFrame","FieldType","of","switchMap","catchError","HealthStatus","_a","getDataSourceRef","lastValueFrom","parseLiveChannelAddress","dataFrameToJSON","StreamingFrameAction","makeClassES5Compatible","jsx","PureComponent","getDataSourceUID","selectors","Select","isUnsignedPluginSignature","jsxs","Stack","PluginSignatureBadge","usePluginContext","isDataSourcePluginContext","EmbeddedDashboard","userHasPermission","userHasPermissionInMetadata","userHasAllPermissions","userHasAnyPermission","useState","useEffect","migrated","Skeleton","get"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsIO,SAAS,aAAsB,CAAgC,EAAA;AACpE,EAAA,OAAO,OAAO,CAAM,KAAA,QAAA,IAAY,MAAM,IAAQ,IAAA,QAAA,IAAY,KAAK,MAAU,IAAA,CAAA;AAC3E;AAuDA,IAAIA,mBAAA;AAQS,MAAA,aAAA,GAAgB,CAAC,QAAyB,KAAA;AACrD,EAAoBA,mBAAA,GAAA,QAAA;AACtB;AAQO,MAAM,gBAAgB,MAAkBA;;ACjJ/C,IAAI,QAAA;AAQG,SAAS,iBAAiB,CAAkB,EAAA;AACjD,EAAW,QAAA,GAAA,CAAA;AACb;AAUO,SAAS,gBAAkC,GAAA;AAChD,EAAO,OAAA,QAAA;AACT;;ACIA,IAAIA,mBAAA;AAQG,SAAS,iBAAiB,QAAyB,EAAA;AACxD,EAAoBA,mBAAA,GAAA,QAAA;AACtB;AAQO,SAAS,gBAAkC,GAAA;AAChD,EAAO,OAAAA,mBAAA;AACT;;AC5DA,IAAIA,mBAAA;AAQG,SAAS,eAAe,QAAuB,EAAA;AACpD,EAAoBA,mBAAA,GAAA,QAAA;AACtB;AASO,SAAS,cAA8B,GAAA;AAC5C,EAAO,OAAAA,mBAAA;AACT;;ACeY,IAAA,aAAA,qBAAAC,cAAL,KAAA;AACL,EAAAA,eAAA,aAAc,CAAA,GAAA,aAAA;AACd,EAAAA,eAAA,eAAgB,CAAA,GAAA,gBAAA;AAChB,EAAAA,eAAA,UAAW,CAAA,GAAA,UAAA;AACX,EAAAA,eAAA,aAAc,CAAA,GAAA,aAAA;AACd,EAAAA,eAAA,gBAAiB,CAAA,GAAA,gBAAA;AACjB,EAAAA,eAAA,wBAAyB,CAAA,GAAA,0BAAA;AANf,EAAAA,OAAAA,cAAAA;AAAA,CAAA,EAAA,aAA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