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MACxC5tB,IAAU+iB,EAAAA,aAAAA,QACZ/iB,EAAQ+iB,EAAAA,aAAAA,MAGV2M,EAAWU,WACXhZ,EAAIgY,eAENJ,KAAOuE,IACL,IAAIC,EAAAA,EAAAA,2BAA0BD,GAC5BtxB,EAAQsxB,EAAI/F,cAGd,IAAIiG,EAAAA,EAAAA,0BAAyBF,GAAM,CACjC,GAAIA,EAAIrxB,MAAO,CACb,IAAIA,GAAQorB,EAAAA,EAAAA,GAAiBiG,EAAIrxB,OAIjC,OAHAA,EAAMsrB,QAAW,4BAA2BtrB,EAAMsrB,UAClDxtB,EAAQ+iB,EAAAA,aAAAA,WACR2M,EAAWV,KAAK,CAAEhvB,MAAAA,EAAO6V,KAAM,CAACA,GAAO6K,IAAAA,EAAKxe,MAAAA,IAEvC,GACLqxB,EAAIvzB,QAAUuuB,EAAAA,2BAAAA,WACdgF,EAAIvzB,QAAUuuB,EAAAA,2BAAAA,QAKd,YAHIgF,EAAI/F,SACNvrB,EAAQsxB,EAAI/F,UAIhBrrB,QAAQ+sB,IAAI,eAAgBqE,OAKlC,MAAO,KACLnc,EAAIgY,kBAUVsE,YAAYb,GACV,OAAOj2B,KAAKs1B,WAAWW,GAASa,eAKpC,IAAIX,EAAgB,G,8TCtRpB,MAAMY,EAAiC,CACrCC,UAAU34B,GACDA,GAASA,aAAiB44B,EAAAA,GAGnCC,UAAU74B,GACR,MAAM84B,EAAMC,EAAAA,GAAc/4B,IAEpB,MAAEg5B,EAAF,MAASC,GAAU,IAAIC,eAI7B,OAFAH,EAAAA,GAAeD,EAAKE,GAEb,CAACC,EAAO,CAACA,KAGlBE,YAAYn5B,IACVA,EAAMo5B,QAECL,EAAAA,GAA0B/4B,KAGrC+4B,EAAAA,GAAAA,IAA6B,oBAAqBL","sources":["webpack://grafana/./packages/grafana-data/src/datetime/parser.ts","webpack://grafana/./packages/grafana-data/src/events/eventFactory.ts","webpack://grafana/./packages/grafana-data/src/events/types.ts","webpack://grafana/./packages/grafana-data/src/field/FieldConfigOptionsRegistry.tsx","webpack://grafana/./packages/grafana-data/src/field/fieldComparers.ts","webpack://grafana/./packages/grafana-data/src/field/fieldState.ts","webpack://grafana/./packages/grafana-data/src/text/sanitize.ts","webpack://grafana/./packages/grafana-data/src/themes/createV1Theme.ts","webpack://grafana/./packages/grafana-data/src/themes/createTheme.ts","webpack://grafana/./packages/grafana-data/src/themes/createComponents.ts","webpack://grafana/./packages/grafana-data/src/themes/palette.ts","webpack://grafana/./packages/grafana-data/src/transformations/fieldReducer.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/fieldTypeMatcher.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/ids.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/predicates.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/refIdMatcher.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/simpleFieldMatcher.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/equalMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/nullMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/numericMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/rangeMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/matchers/valueMatchers/regexMatchers.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/ensureColumns.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/filter.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/filterByName.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/filterByRefId.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/ids.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/joinDataFrames.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/merge.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/noop.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/organize.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/rename.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/seriesToColumns.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/seriesToRows.ts","webpack://grafana/./packages/grafana-data/src/transformations/transformers/sortBy.ts","webpack://grafana/./packages/grafana-data/src/types/data.ts","webpack://grafana/./packages/grafana-data/src/types/dataFrame.ts","webpack://grafana/./packages/grafana-data/src/types/fieldColor.ts","webpack://grafana/./packages/grafana-data/src/types/theme.ts","webpack://grafana/./packages/grafana-data/src/types/thresholds.ts","webpack://grafana/./packages/grafana-data/src/types/valueMapping.ts","webpack://grafana/./packages/grafana-data/src/utils/Registry.ts","webpack://grafana/./packages/grafana-data/src/utils/anyToNumber.ts","webpack://grafana/./packages/grafana-data/src/utils/binaryOperators.ts","webpack://grafana/./packages/grafana-data/src/utils/fieldParser.ts","webpack://grafana/./packages/grafana-data/src/utils/makeClassES5Compatible.ts","webpack://grafana/./packages/grafana-data/src/valueFormats/arithmeticFormatters.ts","webpack://grafana/./packages/grafana-data/src/valueFormats/categories.ts","webpack://grafana/./packages/grafana-data/src/valueFormats/dateTimeFormatters.ts","webpack://grafana/./packages/grafana-data/src/valueFormats/symbolFormatters.ts","webpack://grafana/./packages/grafana-data/src/vector/ArrayVector.ts","webpack://grafana/./packages/grafana-data/src/vector/AsNumberVector.ts","webpack://grafana/./packages/grafana-data/src/vector/BinaryOperationVector.ts","webpack://grafana/./packages/grafana-data/src/vector/ConstantVector.ts","webpack://grafana/./packages/grafana-data/src/vector/RowVector.ts","webpack://grafana/./packages/grafana-data/src/vector/SortedVector.ts","webpack://grafana/./packages/grafana-data/src/vector/vectorToArray.ts","webpack://grafana/./packages/grafana-runtime/src/utils/toDataQueryError.ts","webpack://grafana/./public/app/features/live/centrifuge/channel.ts","webpack://grafana/./public/app/features/live/centrifuge/service.ts","webpack://grafana/./public/app/features/live/centrifuge/transferHandlers.ts"],"sourcesContent":["/* eslint-disable id-blacklist, no-restricted-imports, @typescript-eslint/ban-types */\nimport moment, { MomentInput } from 'moment-timezone';\nimport { DateTimeInput, DateTime, isDateTime } from './moment_wrapper';\nimport { DateTimeOptions, getTimeZone } from './common';\nimport { parse, isValid } from './datemath';\nimport { lowerCase } from 'lodash';\nimport { systemDateFormats } from './formats';\n\n/**\n * The type that describes options that can be passed when parsing a date and time value.\n * @public\n */\nexport interface DateTimeOptionsWhenParsing extends DateTimeOptions {\n /**\n * If the input is a Grafana quick date, e.g. now-6h, then you can specify this to control\n * whether the last part of the date and time value is included or excluded.\n *\n * Example: now-6h and the current time is 12:20:00 if roundUp is set to true\n * the returned DateTime value will be 06:00:00.\n */\n roundUp?: boolean;\n fiscalYearStartMonth?: number;\n}\n\ntype DateTimeParser = (value: DateTimeInput, options?: T) => DateTime;\n\n/**\n * Helper function to parse a number, text or Date to a DateTime value. If a timeZone is supplied the incoming value\n * is parsed with that timeZone as a base. The only exception to this is if the passed value is in a UTC-based\n * format. Then it will use UTC as the base. If no format is specified the current system format will be assumed.\n *\n * It can also parse the Grafana quick date and time format, e.g. now-6h will be parsed as Date.now() - 6 hours and\n * returned as a valid DateTime value.\n *\n * If no options are supplied, then default values are used. For more details please see {@link DateTimeOptions}.\n *\n * @param value - should be a parsable date and time value\n * @param options\n *\n * @public\n */\nexport const dateTimeParse: DateTimeParser = (value, options?): DateTime => {\n if (isDateTime(value)) {\n return value;\n }\n\n if (typeof value === 'string') {\n return parseString(value, options);\n }\n\n return parseOthers(value, options);\n};\n\nconst parseString = (value: string, options?: DateTimeOptionsWhenParsing): DateTime => {\n if (value.indexOf('now') !== -1) {\n if (!isValid(value)) {\n return moment() as DateTime;\n }\n\n const parsed = parse(value, options?.roundUp, options?.timeZone, options?.fiscalYearStartMonth);\n return parsed || (moment() as DateTime);\n }\n\n const timeZone = getTimeZone(options);\n const zone = moment.tz.zone(timeZone);\n const format = options?.format ?? systemDateFormats.fullDate;\n\n if (zone && zone.name) {\n return moment.tz(value, format, zone.name) as DateTime;\n }\n\n switch (lowerCase(timeZone)) {\n case 'utc':\n return moment.utc(value, format) as DateTime;\n default:\n return moment(value, format) as DateTime;\n }\n};\n\nconst parseOthers = (value: DateTimeInput, options?: DateTimeOptionsWhenParsing): DateTime => {\n const date = value as MomentInput;\n const timeZone = getTimeZone(options);\n const zone = moment.tz.zone(timeZone);\n\n if (zone && zone.name) {\n return moment.tz(date, zone.name) as DateTime;\n }\n\n switch (lowerCase(timeZone)) {\n case 'utc':\n return moment.utc(date) as DateTime;\n default:\n return moment(date) as DateTime;\n }\n};\n","import { AppEvent } from './types';\n\nconst typeList: Set = new Set();\n\nexport function eventFactory(name: string): AppEvent {\n if (typeList.has(name)) {\n throw new Error(`There is already an event defined with type '${name}'`);\n }\n\n typeList.add(name);\n return { name };\n}\n","import { Unsubscribable, Observable } from 'rxjs';\n\n/**\n * @alpha\n * internal interface\n */\nexport interface BusEvent {\n readonly type: string;\n readonly payload?: any;\n readonly origin?: EventBus;\n}\n\n/**\n * @alpha\n * Base event type\n */\nexport abstract class BusEventBase implements BusEvent {\n readonly type: string;\n readonly payload?: any;\n readonly origin?: EventBus;\n\n constructor() {\n //@ts-ignore\n this.type = this.__proto__.constructor.type;\n }\n}\n\n/**\n * @alpha\n * Base event type with payload\n */\nexport abstract class BusEventWithPayload extends BusEventBase {\n readonly payload: T;\n\n constructor(payload: T) {\n super();\n this.payload = payload;\n }\n}\n\n/*\n * Interface for an event type constructor\n */\nexport interface BusEventType {\n type: string;\n new (...args: any[]): T;\n}\n\n/**\n * @alpha\n * Event callback/handler type\n */\nexport interface BusEventHandler {\n (event: T): void;\n}\n\n/**\n * @alpha\n * Main minimal interface\n */\nexport interface EventFilterOptions {\n onlyLocal: boolean;\n}\n\n/**\n * @alpha\n * Main minimal interface\n */\nexport interface EventBus {\n /**\n * Publish single vent\n */\n publish(event: T): void;\n\n /**\n * Get observable of events\n */\n getStream(eventType: BusEventType): Observable;\n\n /**\n * Subscribe to an event stream\n *\n * This function is a wrapper around the `getStream(...)` function\n */\n subscribe(eventType: BusEventType, handler: BusEventHandler): Unsubscribable;\n\n /**\n * Remove all event subscriptions\n */\n removeAllListeners(): void;\n\n /**\n * Returns a new bus scoped that knows where it exists in a heiarchy\n *\n * @internal -- This is included for internal use only should not be used directly\n */\n newScopedBus(key: string, filter: EventFilterOptions): EventBus;\n}\n\n/**\n * @public\n * @deprecated event type\n */\nexport interface AppEvent {\n readonly name: string;\n payload?: T;\n}\n\n/** @public */\nexport interface LegacyEmitter {\n /**\n * @deprecated use $emit\n */\n emit(event: AppEvent | string, payload?: T): void;\n\n /**\n * @deprecated use $on\n */\n on(event: AppEvent | string, handler: LegacyEventHandler, scope?: any): void;\n\n /**\n * @deprecated use $on\n */\n off(event: AppEvent | string, handler: (payload?: T | any) => void): void;\n}\n\n/** @public */\nexport interface LegacyEventHandler {\n (payload: T): void;\n wrapper?: (event: BusEvent) => void;\n}\n\n/** @alpha */\nexport interface EventBusExtended extends EventBus, LegacyEmitter {}\n","import { Registry } from '../utils/Registry';\nimport { FieldConfigPropertyItem } from '../types/fieldOverrides';\n\nexport class FieldConfigOptionsRegistry extends Registry {}\n","import { Field, FieldType } from '../types/dataFrame';\nimport { Vector } from '../types/vector';\nimport { dateTime } from '../datetime';\nimport { isNumber } from 'lodash';\n\ntype IndexComparer = (a: number, b: number) => number;\n\n/** @public */\nexport const fieldIndexComparer = (field: Field, reverse = false): IndexComparer => {\n const values = field.values;\n\n switch (field.type) {\n case FieldType.number:\n return numericIndexComparer(values, reverse);\n case FieldType.string:\n return stringIndexComparer(values, reverse);\n case FieldType.boolean:\n return booleanIndexComparer(values, reverse);\n case FieldType.time:\n return timeIndexComparer(values, reverse);\n default:\n return naturalIndexComparer(reverse);\n }\n};\n\n/** @public */\nexport const timeComparer = (a: any, b: any): number => {\n if (!a || !b) {\n return falsyComparer(a, b);\n }\n\n if (isNumber(a) && isNumber(b)) {\n return numericComparer(a, b);\n }\n\n if (dateTime(a).isBefore(b)) {\n return -1;\n }\n\n if (dateTime(b).isBefore(a)) {\n return 1;\n }\n\n return 0;\n};\n\n/** @public */\nexport const numericComparer = (a: number, b: number): number => {\n return a - b;\n};\n\n/** @public */\nexport const stringComparer = (a: string, b: string): number => {\n if (!a || !b) {\n return falsyComparer(a, b);\n }\n return a.localeCompare(b);\n};\n\nexport const booleanComparer = (a: boolean, b: boolean): number => {\n return falsyComparer(a, b);\n};\n\nconst falsyComparer = (a: any, b: any): number => {\n if (!a && b) {\n return 1;\n }\n\n if (a && !b) {\n return -1;\n }\n\n return 0;\n};\n\nconst timeIndexComparer = (values: Vector, reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n const vA = values.get(a);\n const vB = values.get(b);\n return reverse ? timeComparer(vB, vA) : timeComparer(vA, vB);\n };\n};\n\nconst booleanIndexComparer = (values: Vector, reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n const vA: boolean = values.get(a);\n const vB: boolean = values.get(b);\n return reverse ? booleanComparer(vB, vA) : booleanComparer(vA, vB);\n };\n};\n\nconst numericIndexComparer = (values: Vector, reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n const vA: number = values.get(a);\n const vB: number = values.get(b);\n return reverse ? numericComparer(vB, vA) : numericComparer(vA, vB);\n };\n};\n\nconst stringIndexComparer = (values: Vector, reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n const vA: string = values.get(a);\n const vB: string = values.get(b);\n return reverse ? stringComparer(vB, vA) : stringComparer(vA, vB);\n };\n};\n\nconst naturalIndexComparer = (reverse: boolean): IndexComparer => {\n return (a: number, b: number): number => {\n return reverse ? numericComparer(b, a) : numericComparer(a, b);\n };\n};\n","import { DataFrame, Field, TIME_SERIES_VALUE_FIELD_NAME, FieldType, TIME_SERIES_TIME_FIELD_NAME } from '../types';\nimport { formatLabels } from '../utils/labels';\n\n/**\n * Get an appropriate display title\n */\nexport function getFrameDisplayName(frame: DataFrame, index?: number) {\n if (frame.name) {\n return frame.name;\n }\n\n // Single field with tags\n const valuesWithLabels: Field[] = [];\n for (const field of frame.fields) {\n if (field.labels && Object.keys(field.labels).length > 0) {\n valuesWithLabels.push(field);\n }\n }\n\n if (valuesWithLabels.length === 1) {\n return formatLabels(valuesWithLabels[0].labels!);\n }\n\n // list all the\n if (index === undefined) {\n return frame.fields\n .filter((f) => f.type !== FieldType.time)\n .map((f) => getFieldDisplayName(f, frame))\n .join(', ');\n }\n\n if (frame.refId) {\n return `Series (${frame.refId})`;\n }\n\n return `Series (${index})`;\n}\n\nexport function getFieldDisplayName(field: Field, frame?: DataFrame, allFrames?: DataFrame[]): string {\n const existingTitle = field.state?.displayName;\n\n if (existingTitle) {\n return existingTitle;\n }\n\n const displayName = calculateFieldDisplayName(field, frame, allFrames);\n field.state = field.state || {};\n field.state.displayName = displayName;\n\n return displayName;\n}\n\n/**\n * Get an appropriate display name. If the 'displayName' field config is set, use that.\n */\nfunction calculateFieldDisplayName(field: Field, frame?: DataFrame, allFrames?: DataFrame[]): string {\n const hasConfigTitle = field.config?.displayName && field.config?.displayName.length;\n\n let displayName = hasConfigTitle ? field.config!.displayName! : field.name;\n\n if (hasConfigTitle) {\n return displayName;\n }\n\n if (frame && field.config?.displayNameFromDS) {\n return field.config.displayNameFromDS;\n }\n\n // This is an ugly exception for time field\n // For time series we should normally treat time field with same name\n // But in case it has a join source we should handle it as normal field\n if (field.type === FieldType.time && !field.labels) {\n return displayName ?? TIME_SERIES_TIME_FIELD_NAME;\n }\n\n let parts: string[] = [];\n let frameNamesDiffer = false;\n\n if (allFrames && allFrames.length > 1) {\n for (let i = 1; i < allFrames.length; i++) {\n const frame = allFrames[i];\n if (frame.name !== allFrames[i - 1].name) {\n frameNamesDiffer = true;\n break;\n }\n }\n }\n\n let frameNameAdded = false;\n let labelsAdded = false;\n\n if (frameNamesDiffer && frame?.name) {\n parts.push(frame.name);\n frameNameAdded = true;\n }\n\n if (field.name && field.name !== TIME_SERIES_VALUE_FIELD_NAME) {\n parts.push(field.name);\n }\n\n if (field.labels && frame) {\n let singleLabelName = getSingleLabelName(allFrames ?? [frame]);\n\n if (!singleLabelName) {\n let allLabels = formatLabels(field.labels);\n if (allLabels) {\n parts.push(allLabels);\n labelsAdded = true;\n }\n } else if (field.labels[singleLabelName]) {\n parts.push(field.labels[singleLabelName]);\n labelsAdded = true;\n }\n }\n\n // if we have not added frame name and no labels, and field name = Value, we should add frame name\n if (frame && !frameNameAdded && !labelsAdded && field.name === TIME_SERIES_VALUE_FIELD_NAME) {\n if (frame.name && frame.name.length > 0) {\n parts.push(frame.name);\n frameNameAdded = true;\n }\n }\n\n if (parts.length) {\n displayName = parts.join(' ');\n } else if (field.name) {\n displayName = field.name;\n } else {\n displayName = TIME_SERIES_VALUE_FIELD_NAME;\n }\n\n // Ensure unique field name\n if (displayName === field.name) {\n displayName = getUniqueFieldName(field, frame);\n }\n\n return displayName;\n}\n\nfunction getUniqueFieldName(field: Field, frame?: DataFrame) {\n let dupeCount = 0;\n let foundSelf = false;\n\n if (frame) {\n for (let i = 0; i < frame.fields.length; i++) {\n const otherField = frame.fields[i];\n\n if (field === otherField) {\n foundSelf = true;\n\n if (dupeCount > 0) {\n dupeCount++;\n break;\n }\n } else if (field.name === otherField.name) {\n dupeCount++;\n\n if (foundSelf) {\n break;\n }\n }\n }\n }\n\n if (dupeCount) {\n return `${field.name} ${dupeCount}`;\n }\n\n return field.name;\n}\n\n/**\n * Checks all data frames and return name of label if there is only one label name in all frames\n */\nfunction getSingleLabelName(frames: DataFrame[]): string | null {\n let singleName: string | null = null;\n\n for (let i = 0; i < frames.length; i++) {\n const frame = frames[i];\n\n for (const field of frame.fields) {\n if (!field.labels) {\n continue;\n }\n\n // yes this should be in!\n for (const labelKey in field.labels) {\n if (singleName === null) {\n singleName = labelKey;\n } else if (labelKey !== singleName) {\n return null;\n }\n }\n }\n }\n\n return singleName;\n}\n","import xss from 'xss';\nimport { sanitizeUrl as braintreeSanitizeUrl } from '@braintree/sanitize-url';\n\nconst XSSWL = Object.keys(xss.whiteList).reduce((acc, element) => {\n // @ts-ignore\n acc[element] = xss.whiteList[element].concat(['class', 'style']);\n return acc;\n}, {});\n\nconst sanitizeXSS = new xss.FilterXSS({\n whiteList: XSSWL,\n});\n\n/**\n * Returns string safe from XSS attacks.\n *\n * Even though we allow the style-attribute, there's still default filtering applied to it\n * Info: https://github.com/leizongmin/js-xss#customize-css-filter\n * Whitelist: https://github.com/leizongmin/js-css-filter/blob/master/lib/default.js\n */\nexport function sanitize(unsanitizedString: string): string {\n try {\n return sanitizeXSS.process(unsanitizedString);\n } catch (error) {\n console.error('String could not be sanitized', unsanitizedString);\n return unsanitizedString;\n }\n}\n\nexport function sanitizeUrl(url: string): string {\n return braintreeSanitizeUrl(url);\n}\n\nexport function hasAnsiCodes(input: string): boolean {\n return /\\u001b\\[\\d{1,2}m/.test(input);\n}\n\nexport function escapeHtml(str: string): string {\n return String(str).replace(/&/g, '&').replace(//g, '>').replace(/\"/g, '"');\n}\n","import { GrafanaTheme, GrafanaThemeCommons, GrafanaThemeType } from '../types';\nimport { GrafanaTheme2 } from './types';\n\nexport function createV1Theme(theme: Omit): GrafanaTheme {\n const oldCommon: GrafanaThemeCommons = {\n name: 'Grafana Default',\n typography: {\n fontFamily: {\n sansSerif: theme.typography.fontFamily,\n monospace: theme.typography.fontFamilyMonospace,\n },\n size: {\n base: `${theme.typography.fontSize}px`,\n xs: theme.typography.size.xs,\n sm: theme.typography.size.sm,\n md: theme.typography.size.md,\n lg: theme.typography.size.lg,\n },\n heading: {\n h1: theme.typography.h1.fontSize,\n h2: theme.typography.h2.fontSize,\n h3: theme.typography.h3.fontSize,\n h4: theme.typography.h4.fontSize,\n h5: theme.typography.h5.fontSize,\n h6: theme.typography.h6.fontSize,\n },\n weight: {\n light: theme.typography.fontWeightLight,\n regular: theme.typography.fontWeightRegular,\n semibold: theme.typography.fontWeightMedium,\n bold: theme.typography.fontWeightBold,\n },\n lineHeight: {\n xs: theme.typography.bodySmall.lineHeight,\n sm: theme.typography.bodySmall.lineHeight,\n md: theme.typography.body.lineHeight,\n lg: theme.typography.h2.lineHeight,\n },\n link: {\n decoration: 'none',\n hoverDecoration: 'none',\n },\n },\n breakpoints: {\n xs: `${theme.breakpoints.values.xs}px`,\n sm: `${theme.breakpoints.values.sm}px`,\n md: `${theme.breakpoints.values.md}px`,\n lg: `${theme.breakpoints.values.lg}px`,\n xl: `${theme.breakpoints.values.xl}px`,\n xxl: `${theme.breakpoints.values.xxl}px`,\n },\n spacing: {\n base: theme.spacing.gridSize,\n insetSquishMd: theme.spacing(0.5, 1),\n d: theme.spacing(2),\n xxs: theme.spacing(0.25),\n xs: theme.spacing(0.5),\n sm: theme.spacing(1),\n md: theme.spacing(2),\n lg: theme.spacing(3),\n xl: theme.spacing(4),\n gutter: theme.spacing(4),\n\n // Next-gen forms spacing variables\n // TODO: Move variables definition to respective components when implementing\n formSpacingBase: theme.spacing.gridSize,\n formMargin: `${theme.spacing.gridSize * 4}px`,\n formFieldsetMargin: `${theme.spacing.gridSize * 2}px`,\n formInputHeight: theme.spacing.gridSize * 4,\n formButtonHeight: theme.spacing.gridSize * 4,\n formInputPaddingHorizontal: `${theme.spacing.gridSize}px`,\n\n // Used for icons do define spacing between icon and input field\n // Applied on the right(prefix) or left(suffix)\n formInputAffixPaddingHorizontal: `${theme.spacing.gridSize / 2}px`,\n\n formInputMargin: `${theme.spacing.gridSize * 2}px`,\n formLabelPadding: '0 0 0 2px',\n formLabelMargin: `0 0 ${theme.spacing.gridSize / 2 + 'px'} 0`,\n formValidationMessagePadding: '4px 8px',\n formValidationMessageMargin: '4px 0 0 0',\n inlineFormMargin: '4px',\n },\n border: {\n radius: {\n sm: theme.shape.borderRadius(1),\n md: theme.shape.borderRadius(2),\n lg: theme.shape.borderRadius(3),\n },\n width: {\n sm: '1px',\n },\n },\n height: {\n sm: theme.spacing.gridSize * theme.components.height.sm,\n md: theme.spacing.gridSize * theme.components.height.md,\n lg: theme.spacing.gridSize * theme.components.height.lg,\n },\n panelPadding: theme.components.panel.padding * theme.spacing.gridSize,\n panelHeaderHeight: theme.spacing.gridSize * theme.components.panel.headerHeight,\n zIndex: theme.zIndex,\n };\n\n const basicColors = {\n ...commonColorsPalette,\n black: '#000000',\n white: '#ffffff',\n dark1: '#141414',\n dark2: '#161719',\n dark3: '#1f1f20',\n dark4: '#212124',\n dark5: '#222426',\n dark6: '#262628',\n dark7: '#292a2d',\n dark8: '#2f2f32',\n dark9: '#343436',\n dark10: '#424345',\n gray1: '#555555',\n gray2: '#8e8e8e',\n gray3: '#b3b3b3',\n gray4: '#d8d9da',\n gray5: '#ececec',\n gray6: '#f4f5f8', // not used in dark theme\n gray7: '#fbfbfb', // not used in dark theme\n redBase: '#e02f44',\n redShade: '#c4162a',\n greenBase: '#299c46',\n greenShade: '#23843b',\n red: '#d44a3a',\n yellow: '#ecbb13',\n purple: '#9933cc',\n variable: '#32d1df',\n orange: '#eb7b18',\n orangeDark: '#ff780a',\n };\n\n const backgrounds = {\n bg1: theme.colors.background.primary,\n bg2: theme.colors.background.secondary,\n bg3: theme.colors.action.hover,\n dashboardBg: theme.colors.background.canvas,\n bgBlue1: theme.colors.primary.main,\n bgBlue2: theme.colors.primary.shade,\n };\n\n const borders = {\n border1: theme.colors.border.weak,\n border2: theme.colors.border.medium,\n border3: theme.colors.border.strong,\n };\n\n const textColors = {\n textStrong: theme.colors.text.maxContrast,\n textHeading: theme.colors.text.primary,\n text: theme.colors.text.primary,\n textSemiWeak: theme.colors.text.secondary,\n textWeak: theme.colors.text.secondary,\n textFaint: theme.colors.text.disabled,\n textBlue: theme.colors.primary.text,\n };\n\n const form = {\n // Next-gen forms functional colors\n formLabel: theme.colors.text.primary,\n formDescription: theme.colors.text.secondary,\n formInputBg: theme.components.input.background,\n formInputBgDisabled: theme.colors.action.disabledBackground,\n formInputBorder: theme.components.input.borderColor,\n formInputBorderHover: theme.components.input.borderHover,\n formInputBorderActive: theme.colors.primary.border,\n formInputBorderInvalid: theme.colors.error.border,\n formInputPlaceholderText: theme.colors.text.disabled,\n formInputText: theme.components.input.text,\n formInputDisabledText: theme.colors.action.disabledText,\n formFocusOutline: theme.colors.primary.main,\n formValidationMessageText: theme.colors.error.contrastText,\n formValidationMessageBg: theme.colors.error.main,\n };\n\n return {\n ...oldCommon,\n type: theme.colors.mode === 'dark' ? GrafanaThemeType.Dark : GrafanaThemeType.Light,\n isDark: theme.isDark,\n isLight: theme.isLight,\n name: theme.name,\n palette: {\n ...basicColors,\n brandPrimary: basicColors.orange,\n brandSuccess: theme.colors.success.main,\n brandWarning: theme.colors.warning.main,\n brandDanger: theme.colors.error.main,\n queryRed: theme.colors.error.text,\n queryGreen: theme.colors.success.text,\n queryPurple: '#fe85fc',\n queryOrange: basicColors.orange,\n online: theme.colors.success.main,\n warn: theme.colors.success.main,\n critical: theme.colors.success.main,\n },\n colors: {\n ...backgrounds,\n ...borders,\n ...form,\n ...textColors,\n\n bodyBg: theme.colors.background.canvas,\n panelBg: theme.components.panel.background,\n panelBorder: theme.components.panel.borderColor,\n pageHeaderBg: theme.colors.background.canvas,\n pageHeaderBorder: theme.colors.background.canvas,\n\n dropdownBg: form.formInputBg,\n dropdownShadow: basicColors.black,\n dropdownOptionHoverBg: backgrounds.bg2,\n\n link: theme.colors.text.primary,\n linkDisabled: theme.colors.text.disabled,\n linkHover: theme.colors.text.maxContrast,\n linkExternal: theme.colors.text.link,\n },\n shadows: {\n listItem: 'none',\n },\n visualization: theme.visualization,\n };\n}\n\nconst commonColorsPalette = {\n // New greys palette used by next-gen form elements\n gray98: '#f7f8fa',\n gray97: '#f1f5f9',\n gray95: '#e9edf2',\n gray90: '#dce1e6',\n gray85: '#c7d0d9',\n gray70: '#9fa7b3',\n gray60: '#7b8087',\n gray33: '#464c54',\n gray25: '#2c3235',\n gray15: '#202226',\n gray10: '#141619',\n gray05: '#0b0c0e',\n\n // New blues palette used by next-gen form elements\n blue95: '#5794f2', // blue95\n blue85: '#33a2e5', // blueText\n blue80: '#3274d9', // blue80\n blue77: '#1f60c4', // blue77\n\n // New reds palette used by next-gen form elements\n red88: '#e02f44',\n};\n","import { createBreakpoints } from './breakpoints';\nimport { createComponents } from './createComponents';\nimport { createColors, ThemeColorsInput } from './createColors';\nimport { createShadows } from './createShadows';\nimport { createShape, ThemeShapeInput } from './createShape';\nimport { createSpacing, ThemeSpacingOptions } from './createSpacing';\nimport { createTransitions } from './createTransitions';\nimport { createTypography, ThemeTypographyInput } from './createTypography';\nimport { createV1Theme } from './createV1Theme';\nimport { GrafanaTheme2 } from './types';\nimport { zIndex } from './zIndex';\nimport { createVisualizationColors } from './createVisualizationColors';\n\n/** @internal */\nexport interface NewThemeOptions {\n name?: string;\n colors?: ThemeColorsInput;\n spacing?: ThemeSpacingOptions;\n shape?: ThemeShapeInput;\n typography?: ThemeTypographyInput;\n}\n\n/** @internal */\nexport function createTheme(options: NewThemeOptions = {}): GrafanaTheme2 {\n const {\n name = 'Dark',\n colors: colorsInput = {},\n spacing: spacingInput = {},\n shape: shapeInput = {},\n typography: typographyInput = {},\n } = options;\n\n const colors = createColors(colorsInput);\n const breakpoints = createBreakpoints();\n const spacing = createSpacing(spacingInput);\n const shape = createShape(shapeInput);\n const typography = createTypography(colors, typographyInput);\n const shadows = createShadows(colors);\n const transitions = createTransitions();\n const components = createComponents(colors, shadows);\n const visualization = createVisualizationColors(colors);\n\n const theme = {\n name,\n isDark: colors.mode === 'dark',\n isLight: colors.mode === 'light',\n colors,\n breakpoints,\n spacing,\n shape,\n components,\n typography,\n shadows,\n transitions,\n visualization,\n zIndex: {\n ...zIndex,\n },\n };\n\n return {\n ...theme,\n v1: createV1Theme(theme),\n };\n}\n","import { ThemeColors } from './createColors';\nimport { ThemeShadows } from './createShadows';\n\n/** @beta */\nexport interface ThemeComponents {\n /** Applies to normal buttons, inputs, radio buttons, etc */\n height: {\n sm: number;\n md: number;\n lg: number;\n };\n input: {\n background: string;\n borderColor: string;\n borderHover: string;\n text: string;\n };\n tooltip: {\n text: string;\n background: string;\n };\n panel: {\n padding: number;\n headerHeight: number;\n borderColor: string;\n boxShadow: string;\n background: string;\n };\n dropdown: {\n background: string;\n };\n overlay: {\n background: string;\n };\n dashboard: {\n background: string;\n padding: number;\n };\n sidemenu: {\n width: number;\n };\n}\n\nexport function createComponents(colors: ThemeColors, shadows: ThemeShadows): ThemeComponents {\n const panel = {\n padding: 1,\n headerHeight: 4,\n background: colors.background.primary,\n borderColor: colors.border.weak,\n boxShadow: 'none',\n };\n\n const input = {\n borderColor: colors.border.medium,\n borderHover: colors.border.strong,\n text: colors.text.primary,\n background: colors.mode === 'dark' ? colors.background.canvas : colors.background.primary,\n };\n\n return {\n height: {\n sm: 3,\n md: 4,\n lg: 6,\n },\n input,\n panel,\n dropdown: {\n background: input.background,\n },\n tooltip: {\n background: colors.mode === 'light' ? '#555' : colors.background.secondary,\n text: colors.mode === 'light' ? '#FFF' : colors.text.primary,\n },\n dashboard: {\n background: colors.background.canvas,\n padding: 1,\n },\n overlay: {\n background: colors.mode === 'dark' ? 'rgba(0, 0, 0, 0.45)' : 'rgba(208, 209, 211, 0.24)',\n },\n sidemenu: {\n width: 48,\n },\n };\n}\n","export const palette = {\n white: '#fff',\n black: '#000',\n\n gray25: '#2c3235',\n gray15: '#22252b', //'#202226',\n gray10: '#181b1f', // old '#141619',\n gray05: '#111217', // old '#0b0c0e',\n\n // new from figma,\n darkLayer0: '#18181A',\n darkLayer1: '#212124',\n darkLayer2: '#2a2a2f', // figma used #34343B but a bit too bright\n\n darkBorder1: '#34343B',\n darkBorder2: '#64646B',\n\n // Dashboard bg / layer 0 (light theme)\n gray90: '#F4F5F5',\n // Card bg / layer 1\n gray100: '#F4F5F5',\n // divider line\n gray80: '#D0D1D3',\n // from figma\n lightBorder1: '#E4E7E7',\n\n blueDarkMain: '#3D71D9', // '#4165F5',\n blueDarkText: '#6E9FFF', // '#58a6ff', //'#33a2e5', // '#5790FF',\n redDarkMain: '#D10E5C',\n redDarkText: '#FF5286',\n greenDarkMain: '#1A7F4B',\n greenDarkText: '#6CCF8E',\n orangeDarkMain: '#F5B73D',\n orangeDarkText: '#F8D06B',\n\n blueLightMain: '#3871DC',\n blueLightText: '#1F62E0',\n redLightMain: '#E0226E',\n redLightText: '#CF0E5B',\n greenLightMain: '#1B855E',\n greenLightText: '#0A764E',\n orangeLightMain: '#FAD34A',\n orangeLightText: '#8A6C00',\n};\n","// Libraries\nimport { isNumber } from 'lodash';\n\nimport { NullValueMode, Field, FieldState, FieldCalcs, FieldType } from '../types/index';\nimport { Registry, RegistryItem } from '../utils/Registry';\n\nexport enum ReducerID {\n sum = 'sum',\n max = 'max',\n min = 'min',\n logmin = 'logmin',\n mean = 'mean',\n last = 'last',\n first = 'first',\n count = 'count',\n range = 'range',\n diff = 'diff',\n diffperc = 'diffperc',\n delta = 'delta',\n step = 'step',\n firstNotNull = 'firstNotNull',\n lastNotNull = 'lastNotNull',\n changeCount = 'changeCount',\n distinctCount = 'distinctCount',\n allIsZero = 'allIsZero',\n allIsNull = 'allIsNull',\n allValues = 'allValues',\n}\n\n// Internal function\ntype FieldReducer = (field: Field, ignoreNulls: boolean, nullAsZero: boolean) => FieldCalcs;\n\nexport interface FieldReducerInfo extends RegistryItem {\n // Internal details\n emptyInputResult?: any; // typically null, but some things like 'count' & 'sum' should be zero\n standard: boolean; // The most common stats can all be calculated in a single pass\n reduce?: FieldReducer;\n}\n\ninterface ReduceFieldOptions {\n field: Field;\n reducers: string[]; // The stats to calculate\n}\n\n/**\n * @returns an object with a key for each selected stat\n * NOTE: This will also modify the 'field.state' object,\n * leaving values in a cache until cleared.\n */\nexport function reduceField(options: ReduceFieldOptions): FieldCalcs {\n const { field, reducers } = options;\n\n if (!field || !reducers || reducers.length < 1) {\n return {};\n }\n\n if (field.state?.calcs) {\n // Find the values we need to calculate\n const missing: string[] = [];\n for (const s of reducers) {\n if (!field.state.calcs.hasOwnProperty(s)) {\n missing.push(s);\n }\n }\n if (missing.length < 1) {\n return {\n ...field.state.calcs,\n };\n }\n }\n if (!field.state) {\n field.state = {} as FieldState;\n }\n\n const queue = fieldReducers.list(reducers);\n\n // Return early for empty series\n // This lets the concrete implementations assume at least one row\n const data = field.values;\n if (data.length < 1) {\n const calcs = { ...field.state.calcs } as FieldCalcs;\n for (const reducer of queue) {\n calcs[reducer.id] = reducer.emptyInputResult !== null ? reducer.emptyInputResult : null;\n }\n return (field.state.calcs = calcs);\n }\n\n const { nullValueMode } = field.config;\n const ignoreNulls = nullValueMode === NullValueMode.Ignore;\n const nullAsZero = nullValueMode === NullValueMode.AsZero;\n\n // Avoid calculating all the standard stats if possible\n if (queue.length === 1 && queue[0].reduce) {\n const values = queue[0].reduce(field, ignoreNulls, nullAsZero);\n field.state.calcs = {\n ...field.state.calcs,\n ...values,\n };\n return values;\n }\n\n // For now everything can use the standard stats\n let values = doStandardCalcs(field, ignoreNulls, nullAsZero);\n\n for (const reducer of queue) {\n if (!values.hasOwnProperty(reducer.id) && reducer.reduce) {\n values = {\n ...values,\n ...reducer.reduce(field, ignoreNulls, nullAsZero),\n };\n }\n }\n\n field.state.calcs = {\n ...field.state.calcs,\n ...values,\n };\n return values;\n}\n\n// ------------------------------------------------------------------------------\n//\n// No Exported symbols below here.\n//\n// ------------------------------------------------------------------------------\n\nexport const fieldReducers = new Registry(() => [\n {\n id: ReducerID.lastNotNull,\n name: 'Last *',\n description: 'Last non-null value',\n standard: true,\n aliasIds: ['current'],\n reduce: calculateLastNotNull,\n },\n {\n id: ReducerID.last,\n name: 'Last',\n description: 'Last value',\n standard: true,\n reduce: calculateLast,\n },\n { id: ReducerID.first, name: 'First', description: 'First Value', standard: true, reduce: calculateFirst },\n {\n id: ReducerID.firstNotNull,\n name: 'First',\n description: 'First non-null value',\n standard: true,\n reduce: calculateFirstNotNull,\n },\n { id: ReducerID.min, name: 'Min', description: 'Minimum Value', standard: true },\n { id: ReducerID.max, name: 'Max', description: 'Maximum Value', standard: true },\n { id: ReducerID.mean, name: 'Mean', description: 'Average Value', standard: true, aliasIds: ['avg'] },\n {\n id: ReducerID.sum,\n name: 'Total',\n description: 'The sum of all values',\n emptyInputResult: 0,\n standard: true,\n aliasIds: ['total'],\n },\n {\n id: ReducerID.count,\n name: 'Count',\n description: 'Number of values in response',\n emptyInputResult: 0,\n standard: true,\n },\n {\n id: ReducerID.range,\n name: 'Range',\n description: 'Difference between minimum and maximum values',\n standard: true,\n },\n {\n id: ReducerID.delta,\n name: 'Delta',\n description: 'Cumulative change in value',\n standard: true,\n },\n {\n id: ReducerID.step,\n name: 'Step',\n description: 'Minimum interval between values',\n standard: true,\n },\n {\n id: ReducerID.diff,\n name: 'Difference',\n description: 'Difference between first and last values',\n standard: true,\n },\n {\n id: ReducerID.logmin,\n name: 'Min (above zero)',\n description: 'Used for log min scale',\n standard: true,\n },\n {\n id: ReducerID.allIsZero,\n name: 'All Zeros',\n description: 'All values are zero',\n emptyInputResult: false,\n standard: true,\n },\n {\n id: ReducerID.allIsNull,\n name: 'All Nulls',\n description: 'All values are null',\n emptyInputResult: true,\n standard: true,\n },\n {\n id: ReducerID.changeCount,\n name: 'Change Count',\n description: 'Number of times the value changes',\n standard: false,\n reduce: calculateChangeCount,\n },\n {\n id: ReducerID.distinctCount,\n name: 'Distinct Count',\n description: 'Number of distinct values',\n standard: false,\n reduce: calculateDistinctCount,\n },\n {\n id: ReducerID.diffperc,\n name: 'Difference percent',\n description: 'Percentage difference between first and last values',\n standard: true,\n },\n {\n id: ReducerID.allValues,\n name: 'All values',\n description: 'Returns an array with all values',\n standard: false,\n reduce: (field: Field) => ({ allValues: field.values.toArray() }),\n },\n]);\n\nexport function doStandardCalcs(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const calcs = {\n sum: 0,\n max: -Number.MAX_VALUE,\n min: Number.MAX_VALUE,\n logmin: Number.MAX_VALUE,\n mean: null,\n last: null,\n first: null,\n lastNotNull: null,\n firstNotNull: null,\n count: 0,\n nonNullCount: 0,\n allIsNull: true,\n allIsZero: true,\n range: null,\n diff: null,\n delta: 0,\n step: Number.MAX_VALUE,\n diffperc: 0,\n\n // Just used for calculations -- not exposed as a stat\n previousDeltaUp: true,\n } as FieldCalcs;\n\n const data = field.values;\n calcs.count = data.length;\n\n const isNumberField = field.type === FieldType.number || FieldType.time;\n\n for (let i = 0; i < data.length; i++) {\n let currentValue = data.get(i);\n\n if (i === 0) {\n calcs.first = currentValue;\n }\n\n calcs.last = currentValue;\n\n if (currentValue === null) {\n if (ignoreNulls) {\n continue;\n }\n if (nullAsZero) {\n currentValue = 0;\n }\n }\n\n if (currentValue != null) {\n // null || undefined\n const isFirst = calcs.firstNotNull === null;\n if (isFirst) {\n calcs.firstNotNull = currentValue;\n }\n\n if (isNumberField) {\n calcs.sum += currentValue;\n calcs.allIsNull = false;\n calcs.nonNullCount++;\n\n if (!isFirst) {\n const step = currentValue - calcs.lastNotNull!;\n if (calcs.step > step) {\n calcs.step = step; // the minimum interval\n }\n\n if (calcs.lastNotNull! > currentValue) {\n // counter reset\n calcs.previousDeltaUp = false;\n if (i === data.length - 1) {\n // reset on last\n calcs.delta += currentValue;\n }\n } else {\n if (calcs.previousDeltaUp) {\n calcs.delta += step; // normal increment\n } else {\n calcs.delta += currentValue; // account for counter reset\n }\n calcs.previousDeltaUp = true;\n }\n }\n\n if (currentValue > calcs.max) {\n calcs.max = currentValue;\n }\n\n if (currentValue < calcs.min) {\n calcs.min = currentValue;\n }\n\n if (currentValue < calcs.logmin && currentValue > 0) {\n calcs.logmin = currentValue;\n }\n }\n\n if (currentValue !== 0) {\n calcs.allIsZero = false;\n }\n\n calcs.lastNotNull = currentValue;\n }\n }\n\n if (calcs.max === -Number.MAX_VALUE) {\n calcs.max = null;\n }\n\n if (calcs.min === Number.MAX_VALUE) {\n calcs.min = null;\n }\n\n if (calcs.step === Number.MAX_VALUE) {\n calcs.step = null;\n }\n\n if (calcs.nonNullCount > 0) {\n calcs.mean = calcs.sum! / calcs.nonNullCount;\n }\n\n if (calcs.allIsNull) {\n calcs.allIsZero = false;\n }\n\n if (calcs.max !== null && calcs.min !== null) {\n calcs.range = calcs.max - calcs.min;\n }\n\n if (isNumber(calcs.firstNotNull) && isNumber(calcs.lastNotNull)) {\n calcs.diff = calcs.lastNotNull - calcs.firstNotNull;\n }\n\n if (isNumber(calcs.firstNotNull) && isNumber(calcs.diff)) {\n calcs.diffperc = calcs.diff / calcs.firstNotNull;\n }\n return calcs;\n}\n\nfunction calculateFirst(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n return { first: field.values.get(0) };\n}\n\nfunction calculateFirstNotNull(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n for (let idx = 0; idx < data.length; idx++) {\n const v = data.get(idx);\n if (v != null && v !== undefined) {\n return { firstNotNull: v };\n }\n }\n return { firstNotNull: null };\n}\n\nfunction calculateLast(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n return { last: data.get(data.length - 1) };\n}\n\nfunction calculateLastNotNull(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n let idx = data.length - 1;\n while (idx >= 0) {\n const v = data.get(idx--);\n if (v != null && v !== undefined) {\n return { lastNotNull: v };\n }\n }\n return { lastNotNull: null };\n}\n\nfunction calculateChangeCount(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n let count = 0;\n let first = true;\n let last: any = null;\n for (let i = 0; i < data.length; i++) {\n let currentValue = data.get(i);\n if (currentValue === null) {\n if (ignoreNulls) {\n continue;\n }\n if (nullAsZero) {\n currentValue = 0;\n }\n }\n if (!first && last !== currentValue) {\n count++;\n }\n first = false;\n last = currentValue;\n }\n\n return { changeCount: count };\n}\n\nfunction calculateDistinctCount(field: Field, ignoreNulls: boolean, nullAsZero: boolean): FieldCalcs {\n const data = field.values;\n const distinct = new Set();\n for (let i = 0; i < data.length; i++) {\n let currentValue = data.get(i);\n if (currentValue === null) {\n if (ignoreNulls) {\n continue;\n }\n if (nullAsZero) {\n currentValue = 0;\n }\n }\n distinct.add(currentValue);\n }\n return { distinctCount: distinct.size };\n}\n","import { Field, FieldType, DataFrame } from '../../types/dataFrame';\nimport { FieldMatcherID } from './ids';\nimport { FieldMatcherInfo } from '../../types/transformations';\n\n// General Field matcher\nconst fieldTypeMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.byType,\n name: 'Field Type',\n description: 'match based on the field type',\n defaultOptions: FieldType.number,\n\n get: (type: FieldType) => {\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n return type === field.type;\n };\n },\n\n getOptionsDisplayText: (type: FieldType) => {\n return `Field type: ${type}`;\n },\n};\n\n// Numeric Field matcher\n// This gets its own entry so it shows up in the dropdown\nconst numericMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.numeric,\n name: 'Numeric Fields',\n description: 'Fields with type number',\n\n get: () => {\n return fieldTypeMatcher.get(FieldType.number);\n },\n\n getOptionsDisplayText: () => {\n return 'Numeric Fields';\n },\n};\n\n// Time Field matcher\nconst timeMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.time,\n name: 'Time Fields',\n description: 'Fields with type time',\n\n get: () => {\n return fieldTypeMatcher.get(FieldType.time);\n },\n\n getOptionsDisplayText: () => {\n return 'Time Fields';\n },\n};\n\n/**\n * Registry Initialization\n */\nexport function getFieldTypeMatchers(): FieldMatcherInfo[] {\n return [fieldTypeMatcher, numericMatcher, timeMatcher];\n}\n","// This needs to be in its own file to avoid circular references\n\n// Builtin Predicates\n// not using 'any' and 'never' since they are reserved keywords\nexport enum MatcherID {\n anyMatch = 'anyMatch', // checks children\n allMatch = 'allMatch', // checks children\n invertMatch = 'invertMatch', // checks child\n alwaysMatch = 'alwaysMatch',\n neverMatch = 'neverMatch',\n}\n\nexport enum FieldMatcherID {\n // Specific Types\n numeric = 'numeric',\n time = 'time', // Can be multiple times\n first = 'first',\n firstTimeField = 'firstTimeField', // Only the first fime field\n\n // With arguments\n byType = 'byType',\n byName = 'byName',\n byNames = 'byNames',\n byRegexp = 'byRegexp',\n byRegexpOrNames = 'byRegexpOrNames',\n byFrameRefID = 'byFrameRefID',\n // byIndex = 'byIndex',\n // byLabel = 'byLabel',\n}\n\n/**\n * Field name matchers\n */\nexport enum FrameMatcherID {\n byName = 'byName',\n byRefId = 'byRefId',\n byIndex = 'byIndex',\n byLabel = 'byLabel',\n}\n\n/**\n * @public\n */\nexport enum ValueMatcherID {\n regex = 'regex',\n isNull = 'isNull',\n isNotNull = 'isNotNull',\n greater = 'greater',\n greaterOrEqual = 'greaterOrEqual',\n lower = 'lower',\n lowerOrEqual = 'lowerOrEqual',\n equal = 'equal',\n notEqual = 'notEqual',\n between = 'between',\n}\n","import { Field, DataFrame, FieldType } from '../../types/dataFrame';\nimport { MatcherID } from './ids';\nimport { getFieldMatcher, fieldMatchers, getFrameMatchers, frameMatchers } from '../matchers';\nimport { FieldMatcherInfo, MatcherConfig, FrameMatcherInfo } from '../../types/transformations';\n\nconst anyFieldMatcher: FieldMatcherInfo = {\n id: MatcherID.anyMatch,\n name: 'Any',\n description: 'Any child matches (OR)',\n excludeFromPicker: true,\n defaultOptions: [], // empty array\n\n get: (options: MatcherConfig[]) => {\n const children = options.map((option) => {\n return getFieldMatcher(option);\n });\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n for (const child of children) {\n if (child(field, frame, allFrames)) {\n return true;\n }\n }\n return false;\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig[]) => {\n let text = '';\n for (const sub of options) {\n if (text.length > 0) {\n text += ' OR ';\n }\n const matcher = fieldMatchers.get(sub.id);\n text += matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(sub) : matcher.name;\n }\n return text;\n },\n};\n\nconst anyFrameMatcher: FrameMatcherInfo = {\n id: MatcherID.anyMatch,\n name: 'Any',\n description: 'Any child matches (OR)',\n excludeFromPicker: true,\n defaultOptions: [], // empty array\n\n get: (options: MatcherConfig[]) => {\n const children = options.map((option) => {\n return getFrameMatchers(option);\n });\n return (frame: DataFrame) => {\n for (const child of children) {\n if (child(frame)) {\n return true;\n }\n }\n return false;\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig[]) => {\n let text = '';\n for (const sub of options) {\n if (text.length > 0) {\n text += ' OR ';\n }\n const matcher = frameMatchers.get(sub.id);\n text += matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(sub) : matcher.name;\n }\n return text;\n },\n};\n\nconst allFieldsMatcher: FieldMatcherInfo = {\n id: MatcherID.allMatch,\n name: 'All',\n description: 'Everything matches (AND)',\n excludeFromPicker: true,\n defaultOptions: [], // empty array\n\n get: (options: MatcherConfig[]) => {\n const children = options.map((option) => {\n return getFieldMatcher(option);\n });\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n for (const child of children) {\n if (!child(field, frame, allFrames)) {\n return false;\n }\n }\n return true;\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig[]) => {\n let text = '';\n for (const sub of options) {\n if (text.length > 0) {\n text += ' AND ';\n }\n const matcher = fieldMatchers.get(sub.id); // Ugho what about frame\n text += matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(sub) : matcher.name;\n }\n return text;\n },\n};\n\nconst allFramesMatcher: FrameMatcherInfo = {\n id: MatcherID.allMatch,\n name: 'All',\n description: 'Everything matches (AND)',\n excludeFromPicker: true,\n defaultOptions: [], // empty array\n\n get: (options: MatcherConfig[]) => {\n const children = options.map((option) => {\n return getFrameMatchers(option);\n });\n return (frame: DataFrame) => {\n for (const child of children) {\n if (!child(frame)) {\n return false;\n }\n }\n return true;\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig[]) => {\n let text = '';\n for (const sub of options) {\n if (text.length > 0) {\n text += ' AND ';\n }\n const matcher = frameMatchers.get(sub.id);\n text += matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(sub) : matcher.name;\n }\n return text;\n },\n};\n\nconst notFieldMatcher: FieldMatcherInfo = {\n id: MatcherID.invertMatch,\n name: 'NOT',\n description: 'Inverts other matchers',\n excludeFromPicker: true,\n\n get: (option: MatcherConfig) => {\n const check = getFieldMatcher(option);\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n return !check(field, frame, allFrames);\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig) => {\n const matcher = fieldMatchers.get(options.id);\n const text = matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(options.options) : matcher.name;\n return 'NOT ' + text;\n },\n};\n\nconst notFrameMatcher: FrameMatcherInfo = {\n id: MatcherID.invertMatch,\n name: 'NOT',\n description: 'Inverts other matchers',\n excludeFromPicker: true,\n\n get: (option: MatcherConfig) => {\n const check = getFrameMatchers(option);\n return (frame: DataFrame) => {\n return !check(frame);\n };\n },\n\n getOptionsDisplayText: (options: MatcherConfig) => {\n const matcher = frameMatchers.get(options.id);\n const text = matcher.getOptionsDisplayText ? matcher.getOptionsDisplayText(options.options) : matcher.name;\n return 'NOT ' + text;\n },\n};\n\nexport const alwaysFieldMatcher = (field: Field) => {\n return true;\n};\n\nexport const alwaysFrameMatcher = (frame: DataFrame) => {\n return true;\n};\n\nexport const neverFieldMatcher = (field: Field) => {\n return false;\n};\n\nexport const notTimeFieldMatcher = (field: Field) => {\n return field.type !== FieldType.time;\n};\n\nexport const neverFrameMatcher = (frame: DataFrame) => {\n return false;\n};\n\nconst alwaysFieldMatcherInfo: FieldMatcherInfo = {\n id: MatcherID.alwaysMatch,\n name: 'All Fields',\n description: 'Always Match',\n\n get: (option: any) => {\n return alwaysFieldMatcher;\n },\n\n getOptionsDisplayText: (options: any) => {\n return 'Always';\n },\n};\n\nconst alwaysFrameMatcherInfo: FrameMatcherInfo = {\n id: MatcherID.alwaysMatch,\n name: 'All Frames',\n description: 'Always Match',\n\n get: (option: any) => {\n return alwaysFrameMatcher;\n },\n\n getOptionsDisplayText: (options: any) => {\n return 'Always';\n },\n};\n\nconst neverFieldMatcherInfo: FieldMatcherInfo = {\n id: MatcherID.neverMatch,\n name: 'No Fields',\n description: 'Never Match',\n excludeFromPicker: true,\n\n get: (option: any) => {\n return neverFieldMatcher;\n },\n\n getOptionsDisplayText: (options: any) => {\n return 'Never';\n },\n};\n\nconst neverFrameMatcherInfo: FrameMatcherInfo = {\n id: MatcherID.neverMatch,\n name: 'No Frames',\n description: 'Never Match',\n\n get: (option: any) => {\n return neverFrameMatcher;\n },\n\n getOptionsDisplayText: (options: any) => {\n return 'Never';\n },\n};\n\nexport function getFieldPredicateMatchers(): FieldMatcherInfo[] {\n return [anyFieldMatcher, allFieldsMatcher, notFieldMatcher, alwaysFieldMatcherInfo, neverFieldMatcherInfo];\n}\n\nexport function getFramePredicateMatchers(): FrameMatcherInfo[] {\n return [anyFrameMatcher, allFramesMatcher, notFrameMatcher, alwaysFrameMatcherInfo, neverFrameMatcherInfo];\n}\n","import { DataFrame } from '../../types/dataFrame';\nimport { FrameMatcherID } from './ids';\nimport { FrameMatcherInfo } from '../../types/transformations';\nimport { stringToJsRegex } from '../../text';\n\n// General Field matcher\nconst refIdMacher: FrameMatcherInfo = {\n id: FrameMatcherID.byRefId,\n name: 'Query refId',\n description: 'match the refId',\n defaultOptions: 'A',\n\n get: (pattern: string) => {\n const regex = stringToJsRegex(pattern);\n return (frame: DataFrame) => {\n return regex.test(frame.refId || '');\n };\n },\n\n getOptionsDisplayText: (pattern: string) => {\n return `RefID: ${pattern}`;\n },\n};\n\nexport function getRefIdMatchers(): FrameMatcherInfo[] {\n return [refIdMacher];\n}\n","import { Field, FieldType, DataFrame } from '../../types/dataFrame';\nimport { FieldMatcherID } from './ids';\nimport { FieldMatcherInfo } from '../../types/transformations';\n\nconst firstFieldMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.first,\n name: 'First Field',\n description: 'The first field in the frame',\n\n get: (type: FieldType) => {\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n return field === frame.fields[0];\n };\n },\n\n getOptionsDisplayText: () => {\n return `First field`;\n },\n};\n\nconst firstTimeFieldMatcher: FieldMatcherInfo = {\n id: FieldMatcherID.firstTimeField,\n name: 'First time field',\n description: 'The first field of type time in a frame',\n\n get: (type: FieldType) => {\n return (field: Field, frame: DataFrame, allFrames: DataFrame[]) => {\n return field.type === FieldType.time && field === frame.fields.find((f) => f.type === FieldType.time);\n };\n },\n\n getOptionsDisplayText: () => {\n return `First time field`;\n },\n};\n\n/**\n * Registry Initialization\n */\nexport function getSimpleFieldMatchers(): FieldMatcherInfo[] {\n return [firstFieldMatcher, firstTimeFieldMatcher];\n}\n","import { Field } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\nimport { BasicValueMatcherOptions } from './types';\n\nconst isEqualValueMatcher: ValueMatcherInfo = {\n id: ValueMatcherID.equal,\n name: 'Is equal',\n description: 'Match where value for given field is equal to options value.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n // eslint-disable-next-line eqeqeq\n return value == options.value;\n };\n },\n getOptionsDisplayText: () => {\n return `Matches all rows where field is null.`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({ value: '' }),\n};\n\nconst isNotEqualValueMatcher: ValueMatcherInfo = {\n id: ValueMatcherID.notEqual,\n name: 'Is not equal',\n description: 'Match where value for given field is not equal to options value.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n // eslint-disable-next-line eqeqeq\n return value != options.value;\n };\n },\n getOptionsDisplayText: () => {\n return `Matches all rows where field is not null.`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({ value: '' }),\n};\n\nexport const getEqualValueMatchers = (): ValueMatcherInfo[] => [isEqualValueMatcher, isNotEqualValueMatcher];\n","import { Field } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\nimport { ValueMatcherOptions } from './types';\n\nconst isNullValueMatcher: ValueMatcherInfo = {\n id: ValueMatcherID.isNull,\n name: 'Is null',\n description: 'Match where value for given field is null.',\n get: () => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n return value == null;\n };\n },\n getOptionsDisplayText: () => {\n return `Matches all rows where field is null.`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({}),\n};\n\nconst isNotNullValueMatcher: ValueMatcherInfo = {\n id: ValueMatcherID.isNotNull,\n name: 'Is not null',\n description: 'Match where value for given field is not null.',\n get: () => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n return value != null;\n };\n },\n getOptionsDisplayText: () => {\n return `Matches all rows where field is not null.`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({}),\n};\n\nexport const getNullValueMatchers = (): ValueMatcherInfo[] => [isNullValueMatcher, isNotNullValueMatcher];\n","import { Field, FieldType } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\nimport { BasicValueMatcherOptions } from './types';\n\nconst isGreaterValueMatcher: ValueMatcherInfo> = {\n id: ValueMatcherID.greater,\n name: 'Is greater',\n description: 'Match when field value is greater than option.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value > options.value;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is greater than: ${options.value}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ value: 0 }),\n};\n\nconst isGreaterOrEqualValueMatcher: ValueMatcherInfo> = {\n id: ValueMatcherID.greaterOrEqual,\n name: 'Is greater or equal',\n description: 'Match when field value is greater than or equal to option.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value >= options.value;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is greater than or equal to: ${options.value}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ value: 0 }),\n};\n\nconst isLowerValueMatcher: ValueMatcherInfo> = {\n id: ValueMatcherID.lower,\n name: 'Is lower',\n description: 'Match when field value is lower than option.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value < options.value;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is lower than: ${options.value}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ value: 0 }),\n};\n\nconst isLowerOrEqualValueMatcher: ValueMatcherInfo> = {\n id: ValueMatcherID.lowerOrEqual,\n name: 'Is lower or equal',\n description: 'Match when field value is lower or equal than option.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value <= options.value;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is lower or equal than: ${options.value}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ value: 0 }),\n};\n\nexport const getNumericValueMatchers = (): ValueMatcherInfo[] => [\n isGreaterValueMatcher,\n isGreaterOrEqualValueMatcher,\n isLowerValueMatcher,\n isLowerOrEqualValueMatcher,\n];\n","import { Field, FieldType } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\nimport { RangeValueMatcherOptions } from './types';\n\nconst isBetweenValueMatcher: ValueMatcherInfo> = {\n id: ValueMatcherID.between,\n name: 'Is between',\n description: 'Match when field value is between given option values.',\n get: (options) => {\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n if (isNaN(value)) {\n return false;\n }\n return value > options.from && value < options.to;\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is between ${options.from} and ${options.to}.`;\n },\n isApplicable: (field) => field.type === FieldType.number,\n getDefaultOptions: () => ({ from: 0, to: 100 }),\n};\n\nexport const getRangeValueMatchers = (): ValueMatcherInfo[] => [isBetweenValueMatcher];\n","import { Field } from '../../../types/dataFrame';\nimport { ValueMatcherInfo } from '../../../types/transformations';\nimport { ValueMatcherID } from '../ids';\nimport { BasicValueMatcherOptions } from './types';\n\nconst regexValueMatcher: ValueMatcherInfo> = {\n id: ValueMatcherID.regex,\n name: 'Regex',\n description: 'Match when field value is matching regex.',\n get: (options) => {\n const regex = new RegExp(options.value);\n\n return (valueIndex: number, field: Field) => {\n const value = field.values.get(valueIndex);\n return regex.test(value);\n };\n },\n getOptionsDisplayText: (options) => {\n return `Matches all rows where field value is matching regex: ${options.value}`;\n },\n isApplicable: () => true,\n getDefaultOptions: () => ({ value: '.*' }),\n};\n\nexport const getRegexValueMatcher = (): ValueMatcherInfo[] => [regexValueMatcher];\n","import { seriesToColumnsTransformer } from './seriesToColumns';\nimport { DataFrame } from '../../types/dataFrame';\nimport { getTimeField } from '../../dataframe/processDataFrame';\nimport { SynchronousDataTransformerInfo } from '../../types/transformations';\nimport { DataTransformerID } from './ids';\nimport { map } from 'rxjs/operators';\n\nexport const ensureColumnsTransformer: SynchronousDataTransformerInfo = {\n id: DataTransformerID.ensureColumns,\n name: 'Ensure Columns Transformer',\n description: 'Will check if current data frames is series or columns. If in series it will convert to columns.',\n\n operator: (options) => (source) => source.pipe(map((data) => ensureColumnsTransformer.transformer(options)(data))),\n\n transformer: (options: any) => (frames: DataFrame[]) => {\n // Assume timeseries should first be joined by time\n const timeFieldName = findConsistentTimeFieldName(frames);\n\n if (frames.length > 1 && timeFieldName) {\n return seriesToColumnsTransformer.transformer({\n byField: timeFieldName,\n })(frames);\n }\n return frames;\n },\n};\n\n/**\n * Find the name for the time field used in all frames (if one exists)\n */\nfunction findConsistentTimeFieldName(data: DataFrame[]): string | undefined {\n let name: string | undefined = undefined;\n for (const frame of data) {\n const { timeField } = getTimeField(frame);\n if (!timeField) {\n return undefined; // Not timeseries\n }\n if (!name) {\n name = timeField.name;\n } else if (name !== timeField.name) {\n // Second frame has a different time column?!\n return undefined;\n }\n }\n return name;\n}\n","import { map } from 'rxjs/operators';\n\nimport { noopTransformer } from './noop';\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { DataTransformerID } from './ids';\nimport { DataTransformerInfo, MatcherConfig } from '../../types/transformations';\nimport { getFieldMatcher, getFrameMatchers } from '../matchers';\n\nexport interface FilterOptions {\n include?: MatcherConfig;\n exclude?: MatcherConfig;\n}\n\nexport const filterFieldsTransformer: DataTransformerInfo = {\n id: DataTransformerID.filterFields,\n name: 'Filter Fields',\n description: 'select a subset of fields',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options: FilterOptions) => (source) => {\n if (!options.include && !options.exclude) {\n return source.pipe(noopTransformer.operator({}));\n }\n\n return source.pipe(\n map((data) => {\n const include = options.include ? getFieldMatcher(options.include) : null;\n const exclude = options.exclude ? getFieldMatcher(options.exclude) : null;\n\n const processed: DataFrame[] = [];\n for (const series of data) {\n // Find the matching field indexes\n const fields: Field[] = [];\n for (let i = 0; i < series.fields.length; i++) {\n const field = series.fields[i];\n\n if (exclude) {\n if (exclude(field, series, data)) {\n continue;\n }\n if (!include) {\n fields.push(field);\n }\n }\n if (include && include(field, series, data)) {\n fields.push(field);\n }\n }\n\n if (!fields.length) {\n continue;\n }\n const copy = {\n ...series, // all the other properties\n fields, // but a different set of fields\n };\n processed.push(copy);\n }\n return processed;\n })\n );\n },\n};\n\nexport const filterFramesTransformer: DataTransformerInfo = {\n id: DataTransformerID.filterFrames,\n name: 'Filter Frames',\n description: 'select a subset of frames',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) => {\n if (!options.include && !options.exclude) {\n return source.pipe(noopTransformer.operator({}));\n }\n\n return source.pipe(\n map((data) => {\n const include = options.include ? getFrameMatchers(options.include) : null;\n const exclude = options.exclude ? getFrameMatchers(options.exclude) : null;\n\n const processed: DataFrame[] = [];\n for (const series of data) {\n if (exclude) {\n if (exclude(series)) {\n continue;\n }\n if (!include) {\n processed.push(series);\n }\n }\n if (include && include(series)) {\n processed.push(series);\n }\n }\n return processed;\n })\n );\n },\n};\n","import { DataTransformerID } from './ids';\nimport { DataTransformerInfo, MatcherConfig } from '../../types/transformations';\nimport { FieldMatcherID } from '../matchers/ids';\nimport { filterFieldsTransformer } from './filter';\nimport { RegexpOrNamesMatcherOptions } from '../matchers/nameMatcher';\n\nexport interface FilterFieldsByNameTransformerOptions {\n include?: RegexpOrNamesMatcherOptions;\n exclude?: RegexpOrNamesMatcherOptions;\n}\n\nexport const filterFieldsByNameTransformer: DataTransformerInfo = {\n id: DataTransformerID.filterFieldsByName,\n name: 'Filter fields by name',\n description: 'select a subset of fields',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) =>\n source.pipe(\n filterFieldsTransformer.operator({\n include: getMatcherConfig(options.include),\n exclude: getMatcherConfig(options.exclude),\n })\n ),\n};\n\nconst getMatcherConfig = (options?: RegexpOrNamesMatcherOptions): MatcherConfig | undefined => {\n if (!options) {\n return undefined;\n }\n\n const { names, pattern } = options;\n\n if ((!Array.isArray(names) || names.length === 0) && !pattern) {\n return undefined;\n }\n\n if (!pattern) {\n return { id: FieldMatcherID.byNames, options: { names } };\n }\n\n if (!Array.isArray(names) || names.length === 0) {\n return { id: FieldMatcherID.byRegexp, options: pattern };\n }\n\n return { id: FieldMatcherID.byRegexpOrNames, options };\n};\n","import { DataTransformerID } from './ids';\nimport { filterFramesTransformer, FilterOptions } from './filter';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { FrameMatcherID } from '../matchers/ids';\n\nexport interface FilterFramesByRefIdTransformerOptions {\n include?: string;\n exclude?: string;\n}\n\nexport const filterFramesByRefIdTransformer: DataTransformerInfo = {\n id: DataTransformerID.filterByRefId,\n name: 'Filter data by query refId',\n description: 'select a subset of results',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) => {\n const filterOptions: FilterOptions = {};\n if (options.include) {\n filterOptions.include = {\n id: FrameMatcherID.byRefId,\n options: options.include,\n };\n }\n if (options.exclude) {\n filterOptions.exclude = {\n id: FrameMatcherID.byRefId,\n options: options.exclude,\n };\n }\n\n return source.pipe(filterFramesTransformer.operator(filterOptions));\n },\n};\n","export enum DataTransformerID {\n // join = 'join', // Pick a field and merge all series based on that field\n append = 'append',\n // rotate = 'rotate', // Columns to rows\n reduce = 'reduce',\n order = 'order',\n organize = 'organize',\n rename = 'rename',\n calculateField = 'calculateField',\n seriesToColumns = 'seriesToColumns',\n seriesToRows = 'seriesToRows',\n merge = 'merge',\n concatenate = 'concatenate',\n labelsToFields = 'labelsToFields',\n filterFields = 'filterFields',\n filterFieldsByName = 'filterFieldsByName',\n filterFrames = 'filterFrames',\n filterByRefId = 'filterByRefId',\n renameByRegex = 'renameByRegex',\n filterByValue = 'filterByValue',\n noop = 'noop',\n ensureColumns = 'ensureColumns',\n groupBy = 'groupBy',\n sortBy = 'sortBy',\n histogram = 'histogram',\n configFromData = 'configFromData',\n rowsToFields = 'rowsToFields',\n prepareTimeSeries = 'prepareTimeSeries',\n convertFieldType = 'convertFieldType',\n fieldLookup = 'fieldLookup',\n extractFields = 'extractFields',\n}\n","import { DataFrame, Field, FieldMatcher, FieldType, Vector } from '../../types';\nimport { ArrayVector } from '../../vector';\nimport { fieldMatchers } from '../matchers';\nimport { FieldMatcherID } from '../matchers/ids';\nimport { getTimeField, sortDataFrame } from '../../dataframe';\n\nexport function pickBestJoinField(data: DataFrame[]): FieldMatcher {\n const { timeField } = getTimeField(data[0]);\n if (timeField) {\n return fieldMatchers.get(FieldMatcherID.firstTimeField).get({});\n }\n let common: string[] = [];\n for (const f of data[0].fields) {\n if (f.type === FieldType.number) {\n common.push(f.name);\n }\n }\n\n for (let i = 1; i < data.length; i++) {\n const names: string[] = [];\n for (const f of data[0].fields) {\n if (f.type === FieldType.number) {\n names.push(f.name);\n }\n }\n common = common.filter((v) => !names.includes(v));\n }\n\n return fieldMatchers.get(FieldMatcherID.byName).get(common[0]);\n}\n\n/**\n * @alpha\n */\nexport interface JoinOptions {\n /**\n * The input fields\n */\n frames: DataFrame[];\n\n /**\n * The field to join -- frames that do not have this field will be droppped\n */\n joinBy?: FieldMatcher;\n\n /**\n * Optionally filter the non-join fields\n */\n keep?: FieldMatcher;\n\n /**\n * When the result is a single frame, this will to a quick check to see if the values are sorted,\n * and sort if necessary. If the first/last values are in order the whole vector is assumed to be\n * sorted\n */\n enforceSort?: boolean;\n\n /**\n * @internal -- used when we need to keep a reference to the original frame/field index\n */\n keepOriginIndices?: boolean;\n}\n\nfunction getJoinMatcher(options: JoinOptions): FieldMatcher {\n return options.joinBy ?? pickBestJoinField(options.frames);\n}\n\n/**\n * This will return a single frame joined by the first matching field. When a join field is not specified,\n * the default will use the first time field\n */\nexport function outerJoinDataFrames(options: JoinOptions): DataFrame | undefined {\n if (!options.frames?.length) {\n return;\n }\n\n if (options.frames.length === 1) {\n let frame = options.frames[0];\n let frameCopy = frame;\n\n const joinFieldMatcher = getJoinMatcher(options);\n let joinIndex = frameCopy.fields.findIndex((f) => joinFieldMatcher(f, frameCopy, options.frames));\n\n if (options.keepOriginIndices) {\n frameCopy = {\n ...frame,\n fields: frame.fields.map((f, fieldIndex) => {\n const copy = { ...f };\n const origin = {\n frameIndex: 0,\n fieldIndex,\n };\n if (copy.state) {\n copy.state.origin = origin;\n } else {\n copy.state = { origin };\n }\n return copy;\n }),\n };\n\n // Make sure the join field is first\n if (joinIndex > 0) {\n const joinField = frameCopy.fields[joinIndex];\n const fields = frameCopy.fields.filter((f, idx) => idx !== joinIndex);\n fields.unshift(joinField);\n frameCopy.fields = fields;\n joinIndex = 0;\n }\n }\n\n if (options.enforceSort) {\n if (joinIndex >= 0) {\n if (!isLikelyAscendingVector(frameCopy.fields[joinIndex].values)) {\n frameCopy = sortDataFrame(frameCopy, joinIndex);\n }\n }\n }\n\n if (options.keep) {\n let fields = frameCopy.fields.filter(\n (f, fieldIdx) => fieldIdx === joinIndex || options.keep!(f, frameCopy, options.frames)\n );\n\n // mutate already copied frame\n if (frame !== frameCopy) {\n frameCopy.fields = fields;\n } else {\n frameCopy = {\n ...frame,\n fields,\n };\n }\n }\n\n return frameCopy;\n }\n\n const nullModes: JoinNullMode[][] = [];\n const allData: AlignedData[] = [];\n const originalFields: Field[] = [];\n const joinFieldMatcher = getJoinMatcher(options);\n\n for (let frameIndex = 0; frameIndex < options.frames.length; frameIndex++) {\n const frame = options.frames[frameIndex];\n\n if (!frame || !frame.fields?.length) {\n continue; // skip the frame\n }\n\n const nullModesFrame: JoinNullMode[] = [NULL_REMOVE];\n let join: Field | undefined = undefined;\n let fields: Field[] = [];\n\n for (let fieldIndex = 0; fieldIndex < frame.fields.length; fieldIndex++) {\n const field = frame.fields[fieldIndex];\n field.state = field.state || {};\n\n if (!join && joinFieldMatcher(field, frame, options.frames)) {\n join = field;\n } else {\n if (options.keep && !options.keep(field, frame, options.frames)) {\n continue; // skip field\n }\n\n // Support the standard graph span nulls field config\n let spanNulls = field.config.custom?.spanNulls;\n nullModesFrame.push(spanNulls === true ? NULL_REMOVE : spanNulls === -1 ? NULL_RETAIN : NULL_EXPAND);\n\n let labels = field.labels ?? {};\n if (frame.name) {\n labels = { ...labels, name: frame.name };\n }\n\n fields.push({\n ...field,\n labels, // add the name label from frame\n });\n }\n\n if (options.keepOriginIndices) {\n field.state.origin = {\n frameIndex,\n fieldIndex,\n };\n }\n }\n\n if (!join) {\n continue; // skip the frame\n }\n\n if (originalFields.length === 0) {\n originalFields.push(join); // first join field\n }\n\n nullModes.push(nullModesFrame);\n const a: AlignedData = [join.values.toArray()]; //\n\n for (const field of fields) {\n a.push(field.values.toArray());\n originalFields.push(field);\n // clear field displayName state\n delete field.state?.displayName;\n }\n\n allData.push(a);\n }\n\n const joined = join(allData, nullModes);\n\n return {\n // ...options.data[0], // keep name, meta?\n length: joined[0].length,\n fields: originalFields.map((f, index) => ({\n ...f,\n values: new ArrayVector(joined[index]),\n })),\n };\n}\n\n//--------------------------------------------------------------------------------\n// Below here is copied from uplot (MIT License)\n// https://github.com/leeoniya/uPlot/blob/master/src/utils.js#L325\n// This avoids needing to import uplot into the data package\n//--------------------------------------------------------------------------------\n\n// Copied from uplot\nexport type AlignedData = [number[], ...Array>];\n\n// nullModes\nconst NULL_REMOVE = 0; // nulls are converted to undefined (e.g. for spanGaps: true)\nconst NULL_RETAIN = 1; // nulls are retained, with alignment artifacts set to undefined (default)\nconst NULL_EXPAND = 2; // nulls are expanded to include any adjacent alignment artifacts\n\ntype JoinNullMode = number; // NULL_IGNORE | NULL_RETAIN | NULL_EXPAND;\n\n// sets undefined values to nulls when adjacent to existing nulls (minesweeper)\nfunction nullExpand(yVals: Array, nullIdxs: number[], alignedLen: number) {\n for (let i = 0, xi, lastNullIdx = -1; i < nullIdxs.length; i++) {\n let nullIdx = nullIdxs[i];\n\n if (nullIdx > lastNullIdx) {\n xi = nullIdx - 1;\n while (xi >= 0 && yVals[xi] == null) {\n yVals[xi--] = null;\n }\n\n xi = nullIdx + 1;\n while (xi < alignedLen && yVals[xi] == null) {\n yVals[(lastNullIdx = xi++)] = null;\n }\n }\n }\n}\n\n// nullModes is a tables-matched array indicating how to treat nulls in each series\nexport function join(tables: AlignedData[], nullModes?: number[][]) {\n const xVals = new Set();\n\n for (let ti = 0; ti < tables.length; ti++) {\n let t = tables[ti];\n let xs = t[0];\n let len = xs.length;\n\n for (let i = 0; i < len; i++) {\n xVals.add(xs[i]);\n }\n }\n\n let data = [Array.from(xVals).sort((a, b) => a - b)];\n\n let alignedLen = data[0].length;\n\n let xIdxs = new Map();\n\n for (let i = 0; i < alignedLen; i++) {\n xIdxs.set(data[0][i], i);\n }\n\n for (let ti = 0; ti < tables.length; ti++) {\n let t = tables[ti];\n let xs = t[0];\n\n for (let si = 1; si < t.length; si++) {\n let ys = t[si];\n\n let yVals = Array(alignedLen).fill(undefined);\n\n let nullMode = nullModes ? nullModes[ti][si] : NULL_RETAIN;\n\n let nullIdxs = [];\n\n for (let i = 0; i < ys.length; i++) {\n let yVal = ys[i];\n let alignedIdx = xIdxs.get(xs[i]);\n\n if (yVal === null) {\n if (nullMode !== NULL_REMOVE) {\n yVals[alignedIdx] = yVal;\n\n if (nullMode === NULL_EXPAND) {\n nullIdxs.push(alignedIdx);\n }\n }\n } else {\n yVals[alignedIdx] = yVal;\n }\n }\n\n nullExpand(yVals, nullIdxs, alignedLen);\n\n data.push(yVals);\n }\n }\n\n return data;\n}\n\n// Quick test if the first and last points look to be ascending\n// Only exported for tests\nexport function isLikelyAscendingVector(data: Vector): boolean {\n let first: any = undefined;\n\n for (let idx = 0; idx < data.length; idx++) {\n const v = data.get(idx);\n if (v != null) {\n if (first != null) {\n if (first > v) {\n return false; // descending\n }\n break;\n }\n first = v;\n }\n }\n\n let idx = data.length - 1;\n while (idx >= 0) {\n const v = data.get(idx--);\n if (v != null) {\n if (first > v) {\n return false;\n }\n return true;\n }\n }\n\n return true; // only one non-null point\n}\n","import { map } from 'rxjs/operators';\n\nimport { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { omit } from 'lodash';\nimport { ArrayVector } from '../../vector/ArrayVector';\nimport { MutableDataFrame } from '../../dataframe';\n\ninterface ValuePointer {\n key: string;\n index: number;\n}\n\nexport interface MergeTransformerOptions {}\n\nexport const mergeTransformer: DataTransformerInfo = {\n id: DataTransformerID.merge,\n name: 'Merge series/tables',\n description: 'Merges multiple series/tables into a single serie/table',\n defaultOptions: {},\n operator: (options) => (source) =>\n source.pipe(\n map((dataFrames) => {\n if (!Array.isArray(dataFrames) || dataFrames.length <= 1) {\n return dataFrames;\n }\n\n const data = dataFrames.filter((frame) => frame.fields.length > 0);\n\n if (data.length === 0) {\n return [dataFrames[0]];\n }\n\n const fieldNames = new Set();\n const fieldIndexByName: Record> = {};\n const fieldNamesForKey: string[] = [];\n const dataFrame = new MutableDataFrame();\n\n for (let frameIndex = 0; frameIndex < data.length; frameIndex++) {\n const frame = data[frameIndex];\n\n for (let fieldIndex = 0; fieldIndex < frame.fields.length; fieldIndex++) {\n const field = frame.fields[fieldIndex];\n\n if (!fieldNames.has(field.name)) {\n dataFrame.addField(copyFieldStructure(field));\n fieldNames.add(field.name);\n }\n\n fieldIndexByName[field.name] = fieldIndexByName[field.name] || {};\n fieldIndexByName[field.name][frameIndex] = fieldIndex;\n\n if (data.length - 1 !== frameIndex) {\n continue;\n }\n\n if (fieldExistsInAllFrames(fieldIndexByName, field, data)) {\n fieldNamesForKey.push(field.name);\n }\n }\n }\n\n if (fieldNamesForKey.length === 0) {\n return dataFrames;\n }\n\n const valuesByKey: Record>> = {};\n const valuesInOrder: ValuePointer[] = [];\n const keyFactory = createKeyFactory(data, fieldIndexByName, fieldNamesForKey);\n const valueMapper = createValueMapper(data, fieldNames, fieldIndexByName);\n\n for (let frameIndex = 0; frameIndex < data.length; frameIndex++) {\n const frame = data[frameIndex];\n\n for (let valueIndex = 0; valueIndex < frame.length; valueIndex++) {\n const key = keyFactory(frameIndex, valueIndex);\n const value = valueMapper(frameIndex, valueIndex);\n\n if (!Array.isArray(valuesByKey[key])) {\n valuesByKey[key] = [value];\n valuesInOrder.push(createPointer(key, valuesByKey));\n continue;\n }\n\n let valueWasMerged = false;\n\n valuesByKey[key] = valuesByKey[key].map((existing) => {\n if (!isMergable(existing, value)) {\n return existing;\n }\n valueWasMerged = true;\n return { ...existing, ...value };\n });\n\n if (!valueWasMerged) {\n valuesByKey[key].push(value);\n valuesInOrder.push(createPointer(key, valuesByKey));\n }\n }\n }\n\n for (const pointer of valuesInOrder) {\n const value = valuesByKey[pointer.key][pointer.index];\n\n if (value) {\n dataFrame.add(value);\n }\n }\n\n return [dataFrame];\n })\n ),\n};\n\nconst copyFieldStructure = (field: Field): Field => {\n return {\n ...omit(field, ['values', 'state', 'labels', 'config']),\n values: new ArrayVector(),\n config: {\n ...omit(field.config, 'displayName'),\n },\n };\n};\n\nconst createKeyFactory = (\n data: DataFrame[],\n fieldPointerByName: Record>,\n keyFieldNames: string[]\n) => {\n const factoryIndex = keyFieldNames.reduce((index: Record, fieldName) => {\n return Object.keys(fieldPointerByName[fieldName]).reduce((index: Record, frameIndex) => {\n index[frameIndex] = index[frameIndex] || [];\n index[frameIndex].push(fieldPointerByName[fieldName][frameIndex]);\n return index;\n }, index);\n }, {});\n\n return (frameIndex: number, valueIndex: number): string => {\n return factoryIndex[frameIndex].reduce((key: string, fieldIndex: number) => {\n return key + data[frameIndex].fields[fieldIndex].values.get(valueIndex);\n }, '');\n };\n};\n\nconst createValueMapper = (\n data: DataFrame[],\n fieldByName: Set,\n fieldIndexByName: Record>\n) => {\n return (frameIndex: number, valueIndex: number) => {\n const value: Record = {};\n const fieldNames = Array.from(fieldByName);\n\n for (const fieldName of fieldNames) {\n const fieldIndexByFrameIndex = fieldIndexByName[fieldName];\n if (!fieldIndexByFrameIndex) {\n continue;\n }\n\n const fieldIndex = fieldIndexByFrameIndex[frameIndex];\n if (typeof fieldIndex !== 'number') {\n continue;\n }\n\n const frame = data[frameIndex];\n if (!frame || !frame.fields) {\n continue;\n }\n\n const field = frame.fields[fieldIndex];\n if (!field || !field.values) {\n continue;\n }\n\n value[fieldName] = field.values.get(valueIndex);\n }\n\n return value;\n };\n};\n\nconst isMergable = (existing: Record, value: Record): boolean => {\n let mergable = true;\n\n for (const prop in value) {\n if (typeof existing[prop] === 'undefined') {\n continue;\n }\n\n if (existing[prop] === null) {\n continue;\n }\n\n if (existing[prop] !== value[prop]) {\n mergable = false;\n break;\n }\n }\n\n return mergable;\n};\n\nconst fieldExistsInAllFrames = (\n fieldIndexByName: Record>,\n field: Field,\n data: DataFrame[]\n) => {\n return Object.keys(fieldIndexByName[field.name]).length === data.length;\n};\n\nconst createPointer = (key: string, valuesByKey: Record>>): ValuePointer => {\n return {\n key,\n index: valuesByKey[key].length - 1,\n };\n};\n","import { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\n\nexport interface NoopTransformerOptions {\n include?: string;\n exclude?: string;\n}\n\nexport const noopTransformer: DataTransformerInfo = {\n id: DataTransformerID.noop,\n name: 'noop',\n description: 'No-operation transformer',\n defaultOptions: {},\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options: NoopTransformerOptions) => (source) => source,\n};\n","import { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { orderFieldsTransformer, OrderFieldsTransformerOptions } from './order';\nimport { filterFieldsByNameTransformer } from './filterByName';\nimport { renameFieldsTransformer, RenameFieldsTransformerOptions } from './rename';\n\nexport interface OrganizeFieldsTransformerOptions\n extends OrderFieldsTransformerOptions,\n RenameFieldsTransformerOptions {\n excludeByName: Record;\n}\n\nexport const organizeFieldsTransformer: DataTransformerInfo = {\n id: DataTransformerID.organize,\n name: 'Organize fields by name',\n description: 'Order, filter and rename fields based on configuration given by user',\n defaultOptions: {\n excludeByName: {},\n indexByName: {},\n renameByName: {},\n },\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) =>\n source.pipe(\n filterFieldsByNameTransformer.operator({\n exclude: { names: mapToExcludeArray(options.excludeByName) },\n }),\n orderFieldsTransformer.operator(options),\n renameFieldsTransformer.operator(options)\n ),\n};\n\nconst mapToExcludeArray = (excludeByName: Record): string[] => {\n if (!excludeByName) {\n return [];\n }\n\n return Object.keys(excludeByName).filter((name) => excludeByName[name]);\n};\n","import { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { DataFrame, Field } from '../../types/dataFrame';\nimport { getFieldDisplayName } from '../../field/fieldState';\nimport { map } from 'rxjs/operators';\n\nexport interface RenameFieldsTransformerOptions {\n renameByName: Record;\n}\n\nexport const renameFieldsTransformer: DataTransformerInfo = {\n id: DataTransformerID.rename,\n name: 'Rename fields by name',\n description: 'Rename fields based on configuration given by user',\n defaultOptions: {\n renameByName: {},\n },\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) =>\n source.pipe(\n map((data) => {\n const renamer = createRenamer(options.renameByName);\n\n if (!Array.isArray(data) || data.length === 0) {\n return data;\n }\n\n return data.map((frame) => ({\n ...frame,\n fields: renamer(frame),\n }));\n })\n ),\n};\n\nconst createRenamer = (renameByName: Record) => (frame: DataFrame): Field[] => {\n if (!renameByName || Object.keys(renameByName).length === 0) {\n return frame.fields;\n }\n\n return frame.fields.map((field) => {\n const displayName = getFieldDisplayName(field, frame);\n const renameTo = renameByName[displayName];\n\n if (typeof renameTo !== 'string' || renameTo.length === 0) {\n return field;\n }\n\n return {\n ...field,\n config: {\n ...field.config,\n displayName: renameTo,\n },\n state: {\n ...field.state,\n displayName: renameTo,\n },\n };\n });\n};\n","import { map } from 'rxjs/operators';\n\nimport { DataFrame, SynchronousDataTransformerInfo, FieldMatcher } from '../../types';\nimport { DataTransformerID } from './ids';\nimport { outerJoinDataFrames } from './joinDataFrames';\nimport { fieldMatchers } from '../matchers';\nimport { FieldMatcherID } from '../matchers/ids';\n\nexport interface SeriesToColumnsOptions {\n byField?: string; // empty will pick the field automatically\n}\n\nexport const seriesToColumnsTransformer: SynchronousDataTransformerInfo = {\n id: DataTransformerID.seriesToColumns,\n name: 'Series as columns', // Called 'Outer join' in the UI!\n description: 'Groups series by field and returns values as columns',\n defaultOptions: {\n byField: undefined, // DEFAULT_KEY_FIELD,\n },\n\n operator: (options) => (source) => source.pipe(map((data) => seriesToColumnsTransformer.transformer(options)(data))),\n\n transformer: (options: SeriesToColumnsOptions) => {\n let joinBy: FieldMatcher | undefined = undefined;\n return (data: DataFrame[]) => {\n if (data.length > 1) {\n if (options.byField && !joinBy) {\n joinBy = fieldMatchers.get(FieldMatcherID.byName).get(options.byField);\n }\n const joined = outerJoinDataFrames({ frames: data, joinBy });\n if (joined) {\n return [joined];\n }\n }\n return data;\n };\n },\n};\n","import { omit } from 'lodash';\nimport { map } from 'rxjs/operators';\n\nimport { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport {\n Field,\n FieldType,\n TIME_SERIES_METRIC_FIELD_NAME,\n TIME_SERIES_TIME_FIELD_NAME,\n TIME_SERIES_VALUE_FIELD_NAME,\n} from '../../types/dataFrame';\nimport { isTimeSeries } from '../../dataframe/utils';\nimport { MutableDataFrame, sortDataFrame } from '../../dataframe';\nimport { ArrayVector } from '../../vector';\nimport { getFrameDisplayName } from '../../field/fieldState';\n\nexport interface SeriesToRowsTransformerOptions {}\n\nexport const seriesToRowsTransformer: DataTransformerInfo = {\n id: DataTransformerID.seriesToRows,\n name: 'Series to rows',\n description: 'Combines multiple series into a single serie and appends a column with metric name per value.',\n defaultOptions: {},\n operator: (options) => (source) =>\n source.pipe(\n map((data) => {\n if (!Array.isArray(data) || data.length <= 1) {\n return data;\n }\n\n if (!isTimeSeries(data)) {\n return data;\n }\n\n const timeFieldByIndex: Record = {};\n const targetFields = new Set();\n const dataFrame = new MutableDataFrame();\n const metricField: Field = {\n name: TIME_SERIES_METRIC_FIELD_NAME,\n values: new ArrayVector(),\n config: {},\n type: FieldType.string,\n };\n\n for (let frameIndex = 0; frameIndex < data.length; frameIndex++) {\n const frame = data[frameIndex];\n\n for (let fieldIndex = 0; fieldIndex < frame.fields.length; fieldIndex++) {\n const field = frame.fields[fieldIndex];\n\n if (field.type === FieldType.time) {\n timeFieldByIndex[frameIndex] = fieldIndex;\n\n if (!targetFields.has(TIME_SERIES_TIME_FIELD_NAME)) {\n dataFrame.addField(copyFieldStructure(field, TIME_SERIES_TIME_FIELD_NAME));\n dataFrame.addField(metricField);\n targetFields.add(TIME_SERIES_TIME_FIELD_NAME);\n }\n continue;\n }\n\n if (!targetFields.has(TIME_SERIES_VALUE_FIELD_NAME)) {\n dataFrame.addField(copyFieldStructure(field, TIME_SERIES_VALUE_FIELD_NAME));\n targetFields.add(TIME_SERIES_VALUE_FIELD_NAME);\n }\n }\n }\n\n for (let frameIndex = 0; frameIndex < data.length; frameIndex++) {\n const frame = data[frameIndex];\n\n for (let valueIndex = 0; valueIndex < frame.length; valueIndex++) {\n const timeFieldIndex = timeFieldByIndex[frameIndex];\n const valueFieldIndex = timeFieldIndex === 0 ? 1 : 0;\n\n dataFrame.add({\n [TIME_SERIES_TIME_FIELD_NAME]: frame.fields[timeFieldIndex].values.get(valueIndex),\n [TIME_SERIES_METRIC_FIELD_NAME]: getFrameDisplayName(frame),\n [TIME_SERIES_VALUE_FIELD_NAME]: frame.fields[valueFieldIndex].values.get(valueIndex),\n });\n }\n }\n\n return [sortDataFrame(dataFrame, 0, true)];\n })\n ),\n};\n\nconst copyFieldStructure = (field: Field, name: string): Field => {\n return {\n ...omit(field, ['values', 'state', 'labels', 'config', 'name']),\n name: name,\n values: new ArrayVector(),\n config: {\n ...omit(field.config, ['displayName', 'displayNameFromDS']),\n },\n };\n};\n","import { map } from 'rxjs/operators';\n\nimport { DataTransformerID } from './ids';\nimport { DataTransformerInfo } from '../../types/transformations';\nimport { DataFrame } from '../../types';\nimport { getFieldDisplayName } from '../../field';\nimport { sortDataFrame } from '../../dataframe';\n\nexport interface SortByField {\n field: string;\n desc?: boolean;\n index?: number;\n}\n\nexport interface SortByTransformerOptions {\n // NOTE: this structure supports an array, however only the first entry is used\n // future versions may support multi-sort options\n sort: SortByField[];\n}\n\nexport const sortByTransformer: DataTransformerInfo = {\n id: DataTransformerID.sortBy,\n name: 'Sort by',\n description: 'Sort fields in a frame',\n defaultOptions: {\n fields: {},\n },\n\n /**\n * Return a modified copy of the series. If the transform is not or should not\n * be applied, just return the input series\n */\n operator: (options) => (source) =>\n source.pipe(\n map((data) => {\n if (!Array.isArray(data) || data.length === 0 || !options?.sort?.length) {\n return data;\n }\n return sortDataFrames(data, options.sort);\n })\n ),\n};\n\nexport function sortDataFrames(data: DataFrame[], sort: SortByField[]): DataFrame[] {\n return data.map((frame) => {\n const s = attachFieldIndex(frame, sort);\n if (s.length && s[0].index != null) {\n return sortDataFrame(frame, s[0].index, s[0].desc);\n }\n return frame;\n });\n}\n\nfunction attachFieldIndex(frame: DataFrame, sort: SortByField[]): SortByField[] {\n return sort.map((s) => {\n if (s.index != null) {\n // null or undefined\n return s;\n }\n return {\n ...s,\n index: frame.fields.findIndex((f) => s.field === getFieldDisplayName(f, frame)),\n };\n });\n}\n","import { DataFrameDTO, FieldConfig } from './dataFrame';\nimport { DataTransformerConfig } from './transformations';\nimport { ApplyFieldOverrideOptions } from './fieldOverrides';\nimport { PanelPluginDataSupport } from '.';\nimport { DataTopic } from './query';\nimport { DataFrameType } from './dataFrameTypes';\n\nexport type KeyValue = Record;\n\n/**\n * Represent panel data loading state.\n * @public\n */\nexport enum LoadingState {\n NotStarted = 'NotStarted',\n Loading = 'Loading',\n Streaming = 'Streaming',\n Done = 'Done',\n Error = 'Error',\n}\n\n// Should be kept in sync with grafana-plugin-sdk-go/data/frame_meta.go\nexport type PreferredVisualisationType = 'graph' | 'table' | 'logs' | 'trace' | 'nodeGraph';\n\n/**\n * @public\n */\nexport interface QueryResultMeta {\n type?: DataFrameType;\n\n /** DatasSource Specific Values */\n custom?: Record;\n\n /** Stats */\n stats?: QueryResultMetaStat[];\n\n /** Meta Notices */\n notices?: QueryResultMetaNotice[];\n\n /** Used to track transformation ids that where part of the processing */\n transformations?: string[];\n\n /** Currently used to show results in Explore only in preferred visualisation option */\n preferredVisualisationType?: PreferredVisualisationType;\n\n /** The path for live stream updates for this frame */\n channel?: string;\n\n /**\n * Optionally identify which topic the frame should be assigned to.\n * A value specified in the response will override what the request asked for.\n */\n dataTopic?: DataTopic;\n\n /**\n * This is the raw query sent to the underlying system. All macros and templating\n * as been applied. When metadata contains this value, it will be shown in the query inspector\n */\n executedQueryString?: string;\n\n /**\n * A browsable path on the datasource\n */\n path?: string;\n\n /**\n * defaults to '/'\n */\n pathSeparator?: string;\n\n /**\n * Legacy data source specific, should be moved to custom\n * */\n alignmentPeriod?: number; // used by cloud monitoring\n searchWords?: string[]; // used by log models and loki\n limit?: number; // used by log models and loki\n json?: boolean; // used to keep track of old json doc values\n instant?: boolean;\n}\n\nexport interface QueryResultMetaStat extends FieldConfig {\n displayName: string;\n value: number;\n}\n\n/**\n * QueryResultMetaNotice is a structure that provides user notices for query result data\n * @public\n */\nexport interface QueryResultMetaNotice {\n /**\n * Specify the notice severity\n */\n severity: 'info' | 'warning' | 'error';\n\n /**\n * Notice descriptive text\n */\n text: string;\n\n /**\n * An optional link that may be displayed in the UI.\n * This value may be an absolute URL or relative to grafana root\n */\n link?: string;\n\n /**\n * Optionally suggest an appropriate tab for the panel inspector\n */\n inspect?: 'meta' | 'error' | 'data' | 'stats';\n}\n\n/**\n * @public\n */\nexport interface QueryResultBase {\n /**\n * Matches the query target refId\n */\n refId?: string;\n\n /**\n * Used by some backend data sources to communicate back info about the execution (generated sql, timing)\n */\n meta?: QueryResultMeta;\n}\n\nexport interface Labels {\n [key: string]: string;\n}\nexport interface Column {\n text: string; // For a Column, the 'text' is the field name\n filterable?: boolean;\n unit?: string;\n custom?: Record;\n}\n\nexport interface TableData extends QueryResultBase {\n name?: string;\n columns: Column[];\n rows: any[][];\n type?: string;\n}\n\nexport type TimeSeriesValue = number | null;\n\nexport type TimeSeriesPoints = TimeSeriesValue[][];\n\nexport interface TimeSeries extends QueryResultBase {\n target: string;\n /**\n * If name is manually configured via an alias / legend pattern\n */\n title?: string;\n datapoints: TimeSeriesPoints;\n unit?: string;\n tags?: Labels;\n}\n\nexport enum NullValueMode {\n Null = 'null',\n Ignore = 'connected',\n AsZero = 'null as zero',\n}\n\n/**\n * Describes and API for exposing panel specific data configurations.\n */\nexport interface DataConfigSource {\n configRev?: number;\n getDataSupport: () => PanelPluginDataSupport;\n getTransformations: () => DataTransformerConfig[] | undefined;\n getFieldOverrideOptions: () => ApplyFieldOverrideOptions | undefined;\n snapshotData?: DataFrameDTO[];\n}\n","import { ThresholdsConfig } from './thresholds';\nimport { ValueMapping } from './valueMapping';\nimport { QueryResultBase, Labels, NullValueMode } from './data';\nimport { DisplayProcessor, DisplayValue } from './displayValue';\nimport { DataLink, LinkModel } from './dataLink';\nimport { Vector } from './vector';\nimport { FieldColor } from './fieldColor';\nimport { ScopedVars } from './ScopedVars';\n\n/** @public */\nexport enum FieldType {\n time = 'time', // or date\n number = 'number',\n string = 'string',\n boolean = 'boolean',\n // Used to detect that the value is some kind of trace data to help with the visualisation and processing.\n trace = 'trace',\n other = 'other', // Object, Array, etc\n}\n\n/**\n * @public\n * Every property is optional\n *\n * Plugins may extend this with additional properties. Something like series overrides\n */\nexport interface FieldConfig {\n /**\n * The display value for this field. This supports template variables blank is auto\n */\n displayName?: string;\n\n /**\n * This can be used by data sources that return and explicit naming structure for values and labels\n * When this property is configured, this value is used rather than the default naming strategy.\n */\n displayNameFromDS?: string;\n\n /**\n * Human readable field metadata\n */\n description?: string;\n\n /**\n * An explict path to the field in the datasource. When the frame meta includes a path,\n * This will default to `${frame.meta.path}/${field.name}\n *\n * When defined, this value can be used as an identifier within the datasource scope, and\n * may be used to update the results\n */\n path?: string;\n\n /**\n * True if data source can write a value to the path. Auth/authz are supported separately\n */\n writeable?: boolean;\n\n /**\n * True if data source field supports ad-hoc filters\n */\n filterable?: boolean;\n\n // Numeric Options\n unit?: string;\n decimals?: number | null; // Significant digits (for display)\n min?: number | null;\n max?: number | null;\n\n // Convert input values into a display string\n mappings?: ValueMapping[];\n\n // Map numeric values to states\n thresholds?: ThresholdsConfig;\n\n // Map values to a display color\n color?: FieldColor;\n\n // Used when reducing field values\n nullValueMode?: NullValueMode;\n\n // The behavior when clicking on a result\n links?: DataLink[];\n\n // Alternative to empty string\n noValue?: string;\n\n // Panel Specific Values\n custom?: TOptions;\n}\n\n/** @public */\nexport interface ValueLinkConfig {\n /**\n * Result of field reduction\n */\n calculatedValue?: DisplayValue;\n /**\n * Index of the value row within Field. Should be provided only when value is not a result of a reduction\n */\n valueRowIndex?: number;\n}\n\nexport interface Field> {\n /**\n * Name of the field (column)\n */\n name: string;\n /**\n * Field value type (string, number, etc)\n */\n type: FieldType;\n /**\n * Meta info about how field and how to display it\n */\n config: FieldConfig;\n values: V; // The raw field values\n labels?: Labels;\n\n /**\n * Cached values with appropriate display and id values\n */\n state?: FieldState | null;\n\n /**\n * Convert text to the field value\n */\n parse?: (value: any) => T;\n\n /**\n * Convert a value for display\n */\n display?: DisplayProcessor;\n\n /**\n * Get value data links with variables interpolated\n */\n getLinks?: (config: ValueLinkConfig) => Array>;\n}\n\n/** @alpha */\nexport interface FieldState {\n /**\n * An appropriate name for the field (does not include frame info)\n */\n displayName?: string | null;\n\n /**\n * Cache of reduced values\n */\n calcs?: FieldCalcs;\n\n /**\n * The numeric range for values in this field. This value will respect the min/max\n * set in field config, or when set to `auto` this will have the min/max for all data\n * in the response\n */\n range?: NumericRange;\n\n /**\n * Appropriate values for templating\n */\n scopedVars?: ScopedVars;\n\n /**\n * Series index is index for this field in a larger data set that can span multiple DataFrames\n * Useful for assigning color to series by looking up a color in a palette using this index\n */\n seriesIndex?: number;\n\n /**\n * Location of this field within the context frames results\n *\n * @internal -- we will try to make this unnecessary\n */\n origin?: DataFrameFieldIndex;\n}\n\n/** @public */\nexport interface NumericRange {\n min?: number | null;\n max?: number | null;\n delta: number;\n}\n\nexport interface DataFrame extends QueryResultBase {\n name?: string;\n fields: Field[]; // All fields of equal length\n\n // The number of rows\n length: number;\n}\n\n/**\n * @public\n * Like a field, but properties are optional and values may be a simple array\n */\nexport interface FieldDTO {\n name: string; // The column name\n type?: FieldType;\n config?: FieldConfig;\n values?: Vector | T[]; // toJSON will always be T[], input could be either\n labels?: Labels;\n}\n\n/**\n * @public\n * Like a DataFrame, but fields may be a FieldDTO\n */\nexport interface DataFrameDTO extends QueryResultBase {\n name?: string;\n fields: Array;\n}\n\nexport interface FieldCalcs extends Record {}\n\nexport const TIME_SERIES_VALUE_FIELD_NAME = 'Value';\nexport const TIME_SERIES_TIME_FIELD_NAME = 'Time';\nexport const TIME_SERIES_METRIC_FIELD_NAME = 'Metric';\n\n/**\n * Describes where a specific data frame field is located within a\n * dataset of type DataFrame[]\n *\n * @internal -- we will try to make this unnecessary\n */\nexport interface DataFrameFieldIndex {\n frameIndex: number;\n fieldIndex: number;\n}\n","/**\n * @public\n */\nexport enum FieldColorModeId {\n Thresholds = 'thresholds',\n PaletteClassic = 'palette-classic',\n PaletteSaturated = 'palette-saturated',\n ContinuousGrYlRd = 'continuous-GrYlRd',\n Fixed = 'fixed',\n}\n\n/**\n * @public\n */\nexport interface FieldColor {\n /** The main color scheme mode */\n mode: FieldColorModeId | string;\n /** Stores the fixed color value if mode is fixed */\n fixedColor?: string;\n /** Some visualizations need to know how to assign a series color from by value color schemes */\n seriesBy?: FieldColorSeriesByMode;\n}\n\n/**\n * @beta\n */\nexport type FieldColorSeriesByMode = 'min' | 'max' | 'last';\n\nexport const FALLBACK_COLOR = 'gray';\n","import { ThemeVisualizationColors } from '../themes';\n\nexport enum GrafanaThemeType {\n Light = 'light',\n Dark = 'dark',\n}\n\nexport interface GrafanaThemeCommons {\n name: string;\n // TODO: not sure if should be a part of theme\n breakpoints: {\n xs: string;\n sm: string;\n md: string;\n lg: string;\n xl: string;\n xxl: string;\n };\n typography: {\n fontFamily: {\n sansSerif: string;\n monospace: string;\n };\n size: {\n base: string;\n xs: string;\n sm: string;\n md: string;\n lg: string;\n };\n weight: {\n light: number;\n regular: number;\n semibold: number;\n bold: number;\n };\n lineHeight: {\n xs: number; //1\n sm: number; //1.1\n md: number; // 4/3\n lg: number; // 1.5\n };\n // TODO: Refactor to use size instead of custom defs\n heading: {\n h1: string;\n h2: string;\n h3: string;\n h4: string;\n h5: string;\n h6: string;\n };\n link: {\n decoration: string;\n hoverDecoration: string;\n };\n };\n spacing: {\n base: number;\n insetSquishMd: string;\n d: string;\n xxs: string;\n xs: string;\n sm: string;\n md: string;\n lg: string;\n xl: string;\n gutter: string;\n\n // Next-gen forms spacing variables\n // TODO: Move variables definition to respective components when implementing\n formSpacingBase: number;\n formMargin: string;\n formFieldsetMargin: string;\n formInputHeight: number;\n formButtonHeight: number;\n formInputPaddingHorizontal: string;\n // Used for icons do define spacing between icon and input field\n // Applied on the right(prefix) or left(suffix)\n formInputAffixPaddingHorizontal: string;\n formInputMargin: string;\n formLabelPadding: string;\n formLabelMargin: string;\n formValidationMessagePadding: string;\n formValidationMessageMargin: string;\n inlineFormMargin: string;\n };\n border: {\n radius: {\n sm: string;\n md: string;\n lg: string;\n };\n width: {\n sm: string;\n };\n };\n height: {\n sm: number;\n md: number;\n lg: number;\n };\n panelPadding: number;\n panelHeaderHeight: number;\n zIndex: {\n dropdown: number;\n navbarFixed: number;\n sidemenu: number;\n tooltip: number;\n modalBackdrop: number;\n modal: number;\n portal: number;\n typeahead: number;\n };\n}\n\nexport interface GrafanaTheme extends GrafanaThemeCommons {\n type: GrafanaThemeType;\n isDark: boolean;\n isLight: boolean;\n palette: {\n black: string;\n white: string;\n dark1: string;\n dark2: string;\n dark3: string;\n dark4: string;\n dark5: string;\n dark6: string;\n dark7: string;\n dark8: string;\n dark9: string;\n dark10: string;\n gray1: string;\n gray2: string;\n gray3: string;\n gray4: string;\n gray5: string;\n gray6: string;\n gray7: string;\n\n // New greys palette used by next-gen form elements\n gray98: string;\n gray97: string;\n gray95: string;\n gray90: string;\n gray85: string;\n gray70: string;\n gray60: string;\n gray33: string;\n gray25: string;\n gray15: string;\n gray10: string;\n gray05: string;\n\n // New blues palette used by next-gen form elements\n blue95: string;\n blue85: string;\n blue80: string;\n blue77: string;\n\n // New reds palette used by next-gen form elements\n red88: string;\n\n // Accent colors\n redBase: string;\n redShade: string;\n greenBase: string;\n greenShade: string;\n red: string;\n yellow: string;\n purple: string;\n orange: string;\n orangeDark: string;\n queryRed: string;\n queryGreen: string;\n queryPurple: string;\n queryOrange: string;\n brandPrimary: string;\n brandSuccess: string;\n brandWarning: string;\n brandDanger: string;\n\n // Status colors\n online: string;\n warn: string;\n critical: string;\n };\n colors: {\n bg1: string;\n bg2: string;\n bg3: string;\n border1: string;\n border2: string;\n border3: string;\n\n bgBlue1: string;\n bgBlue2: string;\n\n dashboardBg: string;\n bodyBg: string;\n panelBg: string;\n panelBorder: string;\n pageHeaderBg: string;\n pageHeaderBorder: string;\n\n dropdownBg: string;\n dropdownShadow: string;\n dropdownOptionHoverBg: string;\n\n // Link colors\n link: string;\n linkDisabled: string;\n linkHover: string;\n linkExternal: string;\n\n // Text colors\n textStrong: string;\n textHeading: string;\n text: string;\n textSemiWeak: string;\n textWeak: string;\n textFaint: string;\n textBlue: string;\n\n // Next-gen forms functional colors\n formLabel: string;\n formDescription: string;\n formInputBg: string;\n formInputBgDisabled: string;\n formInputBorder: string;\n formInputBorderHover: string;\n formInputBorderActive: string;\n formInputBorderInvalid: string;\n formFocusOutline: string;\n formInputText: string;\n formInputDisabledText: string;\n formInputPlaceholderText: string;\n formValidationMessageText: string;\n formValidationMessageBg: string;\n };\n shadows: {\n listItem: string;\n };\n visualization: ThemeVisualizationColors;\n}\n","export interface Threshold {\n value: number;\n color: string;\n /**\n * Warning, Error, LowLow, Low, OK, High, HighHigh etc\n */\n state?: string;\n}\n\n/**\n * Display mode\n */\nexport enum ThresholdsMode {\n Absolute = 'absolute',\n /**\n * between 0 and 1 (based on min/max)\n */\n Percentage = 'percentage',\n}\n\n/**\n * Config that is passed to the ThresholdsEditor\n */\nexport interface ThresholdsConfig {\n mode: ThresholdsMode;\n\n /**\n * Must be sorted by 'value', first value is always -Infinity\n */\n steps: Threshold[];\n}\n","/**\n * @alpha\n */\nexport enum MappingType {\n ValueToText = 'value', // was 1\n RangeToText = 'range', // was 2\n RegexToText = 'regex',\n SpecialValue = 'special',\n}\n\n/**\n * @alpha\n */\nexport interface ValueMappingResult {\n text?: string;\n color?: string;\n index?: number;\n}\n\n/**\n * @alpha\n */\ninterface BaseValueMap {\n type: MappingType;\n options: T;\n}\n\n/**\n * @alpha\n */\nexport interface ValueMap extends BaseValueMap> {\n type: MappingType.ValueToText;\n}\n\n/**\n * @alpha\n */\nexport interface RangeMapOptions {\n from: number | null; // changed from string\n to: number | null;\n result: ValueMappingResult;\n}\n\n/**\n * @alpha\n */\nexport interface RangeMap extends BaseValueMap {\n type: MappingType.RangeToText;\n}\n\n/**\n * @alpha\n */\nexport interface RegexMapOptions {\n pattern: string;\n result: ValueMappingResult;\n}\n\n/**\n * @alpha\n */\nexport interface RegexMap extends BaseValueMap {\n type: MappingType.RegexToText;\n}\n\n/**\n * @alpha\n */\nexport interface SpecialValueOptions {\n match: SpecialValueMatch;\n result: ValueMappingResult;\n}\n\n/**\n * @alpha\n */\nexport enum SpecialValueMatch {\n True = 'true',\n False = 'false',\n Null = 'null',\n NaN = 'nan',\n NullAndNaN = 'null+nan',\n Empty = 'empty',\n}\n\n/**\n * @alpha\n */\nexport interface SpecialValueMap extends BaseValueMap {\n type: MappingType.SpecialValue;\n}\n\n/**\n * @alpha\n */\nexport type ValueMapping = ValueMap | RangeMap | RegexMap | SpecialValueMap;\n","import { PluginState } from '../types';\nimport { SelectableValue } from '../types/select';\n\nexport interface RegistryItem {\n id: string; // Unique Key -- saved in configs\n name: string; // Display Name, can change without breaking configs\n description?: string;\n aliasIds?: string[]; // when the ID changes, we may want backwards compatibility ('current' => 'last')\n\n /**\n * Some extensions should not be user selectable\n * like: 'all' and 'any' matchers;\n */\n excludeFromPicker?: boolean;\n\n /**\n * Optional feature state\n */\n state?: PluginState;\n}\n\nexport interface RegistryItemWithOptions extends RegistryItem {\n /**\n * Convert the options to a string\n */\n getOptionsDisplayText?: (options: TOptions) => string;\n\n /**\n * Default options used if nothing else is specified\n */\n defaultOptions?: TOptions;\n}\n\ninterface RegistrySelectInfo {\n options: Array>;\n current: Array>;\n}\n\nexport class Registry {\n private ordered: T[] = [];\n private byId = new Map();\n private initialized = false;\n\n constructor(private init?: () => T[]) {}\n\n setInit = (init: () => T[]) => {\n if (this.initialized) {\n throw new Error('Registry already initialized');\n }\n this.init = init;\n };\n\n getIfExists(id: string | undefined): T | undefined {\n if (!this.initialized) {\n this.initialize();\n }\n\n if (id) {\n return this.byId.get(id);\n }\n\n return undefined;\n }\n\n private initialize() {\n if (this.init) {\n for (const ext of this.init()) {\n this.register(ext);\n }\n }\n this.sort();\n this.initialized = true;\n }\n\n get(id: string): T {\n const v = this.getIfExists(id);\n if (!v) {\n throw new Error(`\"${id}\" not found in: ${this.list().map((v) => v.id)}`);\n }\n return v;\n }\n\n selectOptions(current?: string[], filter?: (ext: T) => boolean): RegistrySelectInfo {\n if (!this.initialized) {\n this.initialize();\n }\n\n const select = {\n options: [],\n current: [],\n } as RegistrySelectInfo;\n\n const currentOptions: Record> = {};\n if (current) {\n for (const id of current) {\n currentOptions[id] = {};\n }\n }\n\n for (const ext of this.ordered) {\n if (ext.excludeFromPicker) {\n continue;\n }\n if (filter && !filter(ext)) {\n continue;\n }\n\n const option = {\n value: ext.id,\n label: ext.name,\n description: ext.description,\n };\n\n if (ext.state === PluginState.alpha) {\n option.label += ' (alpha)';\n }\n\n select.options.push(option);\n if (currentOptions[ext.id]) {\n currentOptions[ext.id] = option;\n }\n }\n\n if (current) {\n // this makes sure we preserve the order of ids\n select.current = Object.values(currentOptions);\n }\n\n return select;\n }\n\n /**\n * Return a list of values by ID, or all values if not specified\n */\n list(ids?: any[]): T[] {\n if (!this.initialized) {\n this.initialize();\n }\n\n if (ids) {\n const found: T[] = [];\n for (const id of ids) {\n const v = this.getIfExists(id);\n if (v) {\n found.push(v);\n }\n }\n return found;\n }\n\n return this.ordered;\n }\n\n isEmpty(): boolean {\n if (!this.initialized) {\n this.initialize();\n }\n\n return this.ordered.length === 0;\n }\n\n register(ext: T) {\n if (this.byId.has(ext.id)) {\n throw new Error('Duplicate Key:' + ext.id);\n }\n\n this.byId.set(ext.id, ext);\n this.ordered.push(ext);\n\n if (ext.aliasIds) {\n for (const alias of ext.aliasIds) {\n if (!this.byId.has(alias)) {\n this.byId.set(alias, ext);\n }\n }\n }\n\n if (this.initialized) {\n this.sort();\n }\n }\n\n private sort() {\n // TODO sort the list\n }\n}\n","import { toNumber } from 'lodash';\n\n/**\n * Will return any value as a number or NaN\n *\n * @internal\n * */\nexport function anyToNumber(value: any): number {\n if (typeof value === 'number') {\n return value;\n }\n\n if (value === '' || value === null || value === undefined || Array.isArray(value)) {\n return NaN; // lodash calls them 0\n }\n\n if (typeof value === 'boolean') {\n return value ? 1 : 0;\n }\n\n return toNumber(value);\n}\n","import { RegistryItem, Registry } from './Registry';\n\nexport enum BinaryOperationID {\n Add = '+',\n Subtract = '-',\n Divide = '/',\n Multiply = '*',\n}\n\nexport type BinaryOperation = (left: number, right: number) => number;\n\ninterface BinaryOperatorInfo extends RegistryItem {\n operation: BinaryOperation;\n}\n\nexport const binaryOperators = new Registry(() => {\n return [\n {\n id: BinaryOperationID.Add,\n name: 'Add',\n operation: (a: number, b: number) => a + b,\n },\n {\n id: BinaryOperationID.Subtract,\n name: 'Subtract',\n operation: (a: number, b: number) => a - b,\n },\n {\n id: BinaryOperationID.Multiply,\n name: 'Multiply',\n operation: (a: number, b: number) => a * b,\n },\n {\n id: BinaryOperationID.Divide,\n name: 'Divide',\n operation: (a: number, b: number) => a / b,\n },\n ];\n});\n","import { Field, FieldType } from '../types/dataFrame';\nimport { guessFieldTypeFromValue } from '../dataframe/processDataFrame';\n\nexport function makeFieldParser(value: any, field: Field): (value: string) => any {\n if (!field.type) {\n if (field.name === 'time' || field.name === 'Time') {\n field.type = FieldType.time;\n } else {\n field.type = guessFieldTypeFromValue(value);\n }\n }\n\n if (field.type === FieldType.number) {\n return (value: string) => {\n return parseFloat(value);\n };\n }\n\n // Will convert anything that starts with \"T\" to true\n if (field.type === FieldType.boolean) {\n return (value: string) => {\n return !(value[0] === 'F' || value[0] === 'f' || value[0] === '0');\n };\n }\n\n // Just pass the string back\n return (value: string) => value;\n}\n","/**\n * @beta\n * Proxies a ES6 class so that it can be used as a base class for an ES5 class\n */\nexport function makeClassES5Compatible(ES6Class: T): T {\n return (new Proxy(ES6Class as any, {\n // ES5 code will call it like a function using super\n apply(target, self, argumentsList) {\n if (typeof Reflect === 'undefined' || !Reflect.construct) {\n alert('Browser is too old');\n }\n\n return Reflect.construct(target, argumentsList, self.constructor);\n },\n }) as unknown) as T;\n}\n","import { toFixed, FormattedValue } from './valueFormats';\nimport { DecimalCount } from '../types/displayValue';\n\nexport function toPercent(size: number, decimals: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n return { text: toFixed(size, decimals), suffix: '%' };\n}\n\nexport function toPercentUnit(size: number, decimals: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n return { text: toFixed(100 * size, decimals), suffix: '%' };\n}\n\nexport function toHex0x(value: number, decimals: DecimalCount): FormattedValue {\n if (value == null) {\n return { text: '' };\n }\n const asHex = toHex(value, decimals);\n if (asHex.text.substring(0, 1) === '-') {\n asHex.text = '-0x' + asHex.text.substring(1);\n } else {\n asHex.text = '0x' + asHex.text;\n }\n return asHex;\n}\n\nexport function toHex(value: number, decimals: DecimalCount): FormattedValue {\n if (value == null) {\n return { text: '' };\n }\n return {\n text: parseFloat(toFixed(value, decimals)).toString(16).toUpperCase(),\n };\n}\n\nexport function sci(value: number, decimals: DecimalCount): FormattedValue {\n if (value == null) {\n return { text: '' };\n }\n return { text: value.toExponential(decimals as number) };\n}\n","import {\n locale,\n scaledUnits,\n simpleCountUnit,\n toFixedUnit,\n ValueFormatCategory,\n stringFormater,\n booleanValueFormatter,\n} from './valueFormats';\nimport {\n dateTimeAsIso,\n dateTimeAsIsoNoDateIfToday,\n dateTimeAsUS,\n dateTimeAsUSNoDateIfToday,\n getDateTimeAsLocalFormat,\n getDateTimeAsLocalFormatNoDateIfToday,\n dateTimeFromNow,\n toClockMilliseconds,\n toClockSeconds,\n toDays,\n toDurationInDaysHoursMinutesSeconds,\n toDurationInHoursMinutesSeconds,\n toDurationInMilliseconds,\n toDurationInSeconds,\n toHours,\n toMicroSeconds,\n toMilliSeconds,\n toMinutes,\n toNanoSeconds,\n toSeconds,\n toTimeTicks,\n dateTimeSystemFormatter,\n} from './dateTimeFormatters';\nimport { toHex, sci, toHex0x, toPercent, toPercentUnit } from './arithmeticFormatters';\nimport { binaryPrefix, currency, SIPrefix } from './symbolFormatters';\n\nexport const getCategories = (): ValueFormatCategory[] => [\n {\n name: 'Misc',\n formats: [\n { name: 'none', id: 'none', fn: toFixedUnit('') },\n { name: 'String', id: 'string', fn: stringFormater },\n {\n name: 'short',\n id: 'short',\n fn: scaledUnits(1000, ['', ' K', ' Mil', ' Bil', ' Tri', ' Quadr', ' Quint', ' Sext', ' Sept']),\n },\n { name: 'Percent (0-100)', id: 'percent', fn: toPercent },\n { name: 'Percent (0.0-1.0)', id: 'percentunit', fn: toPercentUnit },\n { name: 'Humidity (%H)', id: 'humidity', fn: toFixedUnit('%H') },\n { name: 'Decibel', id: 'dB', fn: toFixedUnit('dB') },\n { name: 'Hexadecimal (0x)', id: 'hex0x', fn: toHex0x },\n { name: 'Hexadecimal', id: 'hex', fn: toHex },\n { name: 'Scientific notation', id: 'sci', fn: sci },\n { name: 'Locale format', id: 'locale', fn: locale },\n { name: 'Pixels', id: 'pixel', fn: toFixedUnit('px') },\n ],\n },\n {\n name: 'Acceleration',\n formats: [\n { name: 'Meters/sec²', id: 'accMS2', fn: toFixedUnit('m/sec²') },\n { name: 'Feet/sec²', id: 'accFS2', fn: toFixedUnit('f/sec²') },\n { name: 'G unit', id: 'accG', fn: toFixedUnit('g') },\n ],\n },\n {\n name: 'Angle',\n formats: [\n { name: 'Degrees (°)', id: 'degree', fn: toFixedUnit('°') },\n { name: 'Radians', id: 'radian', fn: toFixedUnit('rad') },\n { name: 'Gradian', id: 'grad', fn: toFixedUnit('grad') },\n { name: 'Arc Minutes', id: 'arcmin', fn: toFixedUnit('arcmin') },\n { name: 'Arc Seconds', id: 'arcsec', fn: toFixedUnit('arcsec') },\n ],\n },\n {\n name: 'Area',\n formats: [\n { name: 'Square Meters (m²)', id: 'areaM2', fn: toFixedUnit('m²') },\n { name: 'Square Feet (ft²)', id: 'areaF2', fn: toFixedUnit('ft²') },\n { name: 'Square Miles (mi²)', id: 'areaMI2', fn: toFixedUnit('mi²') },\n ],\n },\n {\n name: 'Computation',\n formats: [\n { name: 'FLOP/s', id: 'flops', fn: SIPrefix('FLOPS') },\n { name: 'MFLOP/s', id: 'mflops', fn: SIPrefix('FLOPS', 2) },\n { name: 'GFLOP/s', id: 'gflops', fn: SIPrefix('FLOPS', 3) },\n { name: 'TFLOP/s', id: 'tflops', fn: SIPrefix('FLOPS', 4) },\n { name: 'PFLOP/s', id: 'pflops', fn: SIPrefix('FLOPS', 5) },\n { name: 'EFLOP/s', id: 'eflops', fn: SIPrefix('FLOPS', 6) },\n { name: 'ZFLOP/s', id: 'zflops', fn: SIPrefix('FLOPS', 7) },\n { name: 'YFLOP/s', id: 'yflops', fn: SIPrefix('FLOPS', 8) },\n ],\n },\n {\n name: 'Concentration',\n formats: [\n { name: 'parts-per-million (ppm)', id: 'ppm', fn: toFixedUnit('ppm') },\n { name: 'parts-per-billion (ppb)', id: 'conppb', fn: toFixedUnit('ppb') },\n { name: 'nanogram per cubic meter (ng/m³)', id: 'conngm3', fn: toFixedUnit('ng/m³') },\n { name: 'nanogram per normal cubic meter (ng/Nm³)', id: 'conngNm3', fn: toFixedUnit('ng/Nm³') },\n { name: 'microgram per cubic meter (μg/m³)', id: 'conμgm3', fn: toFixedUnit('μg/m³') },\n { name: 'microgram per normal cubic meter (μg/Nm³)', id: 'conμgNm3', fn: toFixedUnit('μg/Nm³') },\n { name: 'milligram per cubic meter (mg/m³)', id: 'conmgm3', fn: toFixedUnit('mg/m³') },\n { name: 'milligram per normal cubic meter (mg/Nm³)', id: 'conmgNm3', fn: toFixedUnit('mg/Nm³') },\n { name: 'gram per cubic meter (g/m³)', id: 'congm3', fn: toFixedUnit('g/m³') },\n { name: 'gram per normal cubic meter (g/Nm³)', id: 'congNm3', fn: toFixedUnit('g/Nm³') },\n { name: 'milligrams per decilitre (mg/dL)', id: 'conmgdL', fn: toFixedUnit('mg/dL') },\n { name: 'millimoles per litre (mmol/L)', id: 'conmmolL', fn: toFixedUnit('mmol/L') },\n ],\n },\n {\n name: 'Currency',\n formats: [\n { name: 'Dollars ($)', id: 'currencyUSD', fn: currency('$') },\n { name: 'Pounds (£)', id: 'currencyGBP', fn: currency('£') },\n { name: 'Euro (€)', id: 'currencyEUR', fn: currency('€') },\n { name: 'Yen (¥)', id: 'currencyJPY', fn: currency('¥') },\n { name: 'Rubles (₽)', id: 'currencyRUB', fn: currency('₽') },\n { name: 'Hryvnias (₴)', id: 'currencyUAH', fn: currency('₴') },\n { name: 'Real (R$)', id: 'currencyBRL', fn: currency('R$') },\n { name: 'Danish Krone (kr)', id: 'currencyDKK', fn: currency('kr', true) },\n { name: 'Icelandic Króna (kr)', id: 'currencyISK', fn: currency('kr', true) },\n { name: 'Norwegian Krone (kr)', id: 'currencyNOK', fn: currency('kr', true) },\n { name: 'Swedish Krona (kr)', id: 'currencySEK', fn: currency('kr', true) },\n { name: 'Czech koruna (czk)', id: 'currencyCZK', fn: currency('czk') },\n { name: 'Swiss franc (CHF)', id: 'currencyCHF', fn: currency('CHF') },\n { name: 'Polish Złoty (PLN)', id: 'currencyPLN', fn: currency('PLN') },\n { name: 'Bitcoin (฿)', id: 'currencyBTC', fn: currency('฿') },\n { name: 'Milli Bitcoin (฿)', id: 'currencymBTC', fn: currency('mBTC') },\n { name: 'Micro Bitcoin (฿)', id: 'currencyμBTC', fn: currency('μBTC') },\n { name: 'South African Rand (R)', id: 'currencyZAR', fn: currency('R') },\n { name: 'Indian Rupee (₹)', id: 'currencyINR', fn: currency('₹') },\n { name: 'South Korean Won (₩)', id: 'currencyKRW', fn: currency('₩') },\n { name: 'Indonesian Rupiah (Rp)', id: 'currencyIDR', fn: currency('Rp') },\n { name: 'Philippine Peso (PHP)', id: 'currencyPHP', fn: currency('PHP') },\n { name: 'Vietnamese Dong (VND)', id: 'currencyVND', fn: currency('đ', true) },\n ],\n },\n {\n name: 'Data',\n formats: [\n { name: 'bytes(IEC)', id: 'bytes', fn: binaryPrefix('B') },\n { name: 'bytes(SI)', id: 'decbytes', fn: SIPrefix('B') },\n { name: 'bits(IEC)', id: 'bits', fn: binaryPrefix('b') },\n { name: 'bits(SI)', id: 'decbits', fn: SIPrefix('b') },\n { name: 'kibibytes', id: 'kbytes', fn: binaryPrefix('B', 1) },\n { name: 'kilobytes', id: 'deckbytes', fn: SIPrefix('B', 1) },\n { name: 'mebibytes', id: 'mbytes', fn: binaryPrefix('B', 2) },\n { name: 'megabytes', id: 'decmbytes', fn: SIPrefix('B', 2) },\n { name: 'gibibytes', id: 'gbytes', fn: binaryPrefix('B', 3) },\n { name: 'gigabytes', id: 'decgbytes', fn: SIPrefix('B', 3) },\n { name: 'tebibytes', id: 'tbytes', fn: binaryPrefix('B', 4) },\n { name: 'terabytes', id: 'dectbytes', fn: SIPrefix('B', 4) },\n { name: 'pebibytes', id: 'pbytes', fn: binaryPrefix('B', 5) },\n { name: 'petabytes', id: 'decpbytes', fn: SIPrefix('B', 5) },\n ],\n },\n {\n name: 'Data rate',\n formats: [\n { name: 'packets/sec', id: 'pps', fn: SIPrefix('p/s') },\n { name: 'bytes/sec(IEC)', id: 'binBps', fn: binaryPrefix('B/s') },\n { name: 'bytes/sec(SI)', id: 'Bps', fn: SIPrefix('B/s') },\n { name: 'bits/sec(IEC)', id: 'binbps', fn: binaryPrefix('b/s') },\n { name: 'bits/sec(SI)', id: 'bps', fn: SIPrefix('b/s') },\n { name: 'kibibytes/sec', id: 'KiBs', fn: binaryPrefix('B/s', 1) },\n { name: 'kibibits/sec', id: 'Kibits', fn: binaryPrefix('b/s', 1) },\n { name: 'kilobytes/sec', id: 'KBs', fn: SIPrefix('B/s', 1) },\n { name: 'kilobits/sec', id: 'Kbits', fn: SIPrefix('b/s', 1) },\n { name: 'mibibytes/sec', id: 'MiBs', fn: binaryPrefix('B/s', 2) },\n { name: 'mibibits/sec', id: 'Mibits', fn: binaryPrefix('b/s', 2) },\n { name: 'megabytes/sec', id: 'MBs', fn: SIPrefix('B/s', 2) },\n { name: 'megabits/sec', id: 'Mbits', fn: SIPrefix('b/s', 2) },\n { name: 'gibibytes/sec', id: 'GiBs', fn: binaryPrefix('B/s', 3) },\n { name: 'gibibits/sec', id: 'Gibits', fn: binaryPrefix('b/s', 3) },\n { name: 'gigabytes/sec', id: 'GBs', fn: SIPrefix('B/s', 3) },\n { name: 'gigabits/sec', id: 'Gbits', fn: SIPrefix('b/s', 3) },\n { name: 'tebibytes/sec', id: 'TiBs', fn: binaryPrefix('B/s', 4) },\n { name: 'tebibits/sec', id: 'Tibits', fn: binaryPrefix('b/s', 4) },\n { name: 'terabytes/sec', id: 'TBs', fn: SIPrefix('B/s', 4) },\n { name: 'terabits/sec', id: 'Tbits', fn: SIPrefix('b/s', 4) },\n { name: 'petibytes/sec', id: 'PiBs', fn: binaryPrefix('B/s', 5) },\n { name: 'petibits/sec', id: 'Pibits', fn: binaryPrefix('b/s', 5) },\n { name: 'petabytes/sec', id: 'PBs', fn: SIPrefix('B/s', 5) },\n { name: 'petabits/sec', id: 'Pbits', fn: SIPrefix('b/s', 5) },\n ],\n },\n {\n name: 'Date & time',\n formats: [\n { name: 'Datetime ISO', id: 'dateTimeAsIso', fn: dateTimeAsIso },\n { name: 'Datetime ISO (No date if today)', id: 'dateTimeAsIsoNoDateIfToday', fn: dateTimeAsIsoNoDateIfToday },\n { name: 'Datetime US', id: 'dateTimeAsUS', fn: dateTimeAsUS },\n { name: 'Datetime US (No date if today)', id: 'dateTimeAsUSNoDateIfToday', fn: dateTimeAsUSNoDateIfToday },\n { name: 'Datetime local', id: 'dateTimeAsLocal', fn: getDateTimeAsLocalFormat() },\n {\n name: 'Datetime local (No date if today)',\n id: 'dateTimeAsLocalNoDateIfToday',\n fn: getDateTimeAsLocalFormatNoDateIfToday(),\n },\n { name: 'Datetime default', id: 'dateTimeAsSystem', fn: dateTimeSystemFormatter },\n { name: 'From Now', id: 'dateTimeFromNow', fn: dateTimeFromNow },\n ],\n },\n {\n name: 'Energy',\n formats: [\n { name: 'Watt (W)', id: 'watt', fn: SIPrefix('W') },\n { name: 'Kilowatt (kW)', id: 'kwatt', fn: SIPrefix('W', 1) },\n { name: 'Megawatt (MW)', id: 'megwatt', fn: SIPrefix('W', 2) },\n { name: 'Gigawatt (GW)', id: 'gwatt', fn: SIPrefix('W', 3) },\n { name: 'Milliwatt (mW)', id: 'mwatt', fn: SIPrefix('W', -1) },\n { name: 'Watt per square meter (W/m²)', id: 'Wm2', fn: toFixedUnit('W/m²') },\n { name: 'Volt-ampere (VA)', id: 'voltamp', fn: SIPrefix('VA') },\n { name: 'Kilovolt-ampere (kVA)', id: 'kvoltamp', fn: SIPrefix('VA', 1) },\n { name: 'Volt-ampere reactive (var)', id: 'voltampreact', fn: SIPrefix('var') },\n { name: 'Kilovolt-ampere reactive (kVAr)', id: 'kvoltampreact', fn: SIPrefix('VAr', 1) },\n { name: 'Watt-hour (Wh)', id: 'watth', fn: SIPrefix('Wh') },\n { name: 'Watt-hour per Kilogram (Wh/kg)', id: 'watthperkg', fn: SIPrefix('Wh/kg') },\n { name: 'Kilowatt-hour (kWh)', id: 'kwatth', fn: SIPrefix('Wh', 1) },\n { name: 'Kilowatt-min (kWm)', id: 'kwattm', fn: SIPrefix('W-Min', 1) },\n { name: 'Ampere-hour (Ah)', id: 'amph', fn: SIPrefix('Ah') },\n { name: 'Kiloampere-hour (kAh)', id: 'kamph', fn: SIPrefix('Ah', 1) },\n { name: 'Milliampere-hour (mAh)', id: 'mamph', fn: SIPrefix('Ah', -1) },\n { name: 'Joule (J)', id: 'joule', fn: SIPrefix('J') },\n { name: 'Electron volt (eV)', id: 'ev', fn: SIPrefix('eV') },\n { name: 'Ampere (A)', id: 'amp', fn: SIPrefix('A') },\n { name: 'Kiloampere (kA)', id: 'kamp', fn: SIPrefix('A', 1) },\n { name: 'Milliampere (mA)', id: 'mamp', fn: SIPrefix('A', -1) },\n { name: 'Volt (V)', id: 'volt', fn: SIPrefix('V') },\n { name: 'Kilovolt (kV)', id: 'kvolt', fn: SIPrefix('V', 1) },\n { name: 'Millivolt (mV)', id: 'mvolt', fn: SIPrefix('V', -1) },\n { name: 'Decibel-milliwatt (dBm)', id: 'dBm', fn: SIPrefix('dBm') },\n { name: 'Ohm (Ω)', id: 'ohm', fn: SIPrefix('Ω') },\n { name: 'Kiloohm (kΩ)', id: 'kohm', fn: SIPrefix('Ω', 1) },\n { name: 'Megaohm (MΩ)', id: 'Mohm', fn: SIPrefix('Ω', 2) },\n { name: 'Farad (F)', id: 'farad', fn: SIPrefix('F') },\n { name: 'Microfarad (µF)', id: 'µfarad', fn: SIPrefix('F', -2) },\n { name: 'Nanofarad (nF)', id: 'nfarad', fn: SIPrefix('F', -3) },\n { name: 'Picofarad (pF)', id: 'pfarad', fn: SIPrefix('F', -4) },\n { name: 'Femtofarad (fF)', id: 'ffarad', fn: SIPrefix('F', -5) },\n { name: 'Henry (H)', id: 'henry', fn: SIPrefix('H') },\n { name: 'Millihenry (mH)', id: 'mhenry', fn: SIPrefix('H', -1) },\n { name: 'Microhenry (µH)', id: 'µhenry', fn: SIPrefix('H', -2) },\n { name: 'Lumens (Lm)', id: 'lumens', fn: SIPrefix('Lm') },\n ],\n },\n {\n name: 'Flow',\n formats: [\n { name: 'Gallons/min (gpm)', id: 'flowgpm', fn: toFixedUnit('gpm') },\n { name: 'Cubic meters/sec (cms)', id: 'flowcms', fn: toFixedUnit('cms') },\n { name: 'Cubic feet/sec (cfs)', id: 'flowcfs', fn: toFixedUnit('cfs') },\n { name: 'Cubic feet/min (cfm)', id: 'flowcfm', fn: toFixedUnit('cfm') },\n { name: 'Litre/hour', id: 'litreh', fn: toFixedUnit('L/h') },\n { name: 'Litre/min (L/min)', id: 'flowlpm', fn: toFixedUnit('L/min') },\n { name: 'milliLitre/min (mL/min)', id: 'flowmlpm', fn: toFixedUnit('mL/min') },\n { name: 'Lux (lx)', id: 'lux', fn: toFixedUnit('lux') },\n ],\n },\n {\n name: 'Force',\n formats: [\n { name: 'Newton-meters (Nm)', id: 'forceNm', fn: SIPrefix('Nm') },\n { name: 'Kilonewton-meters (kNm)', id: 'forcekNm', fn: SIPrefix('Nm', 1) },\n { name: 'Newtons (N)', id: 'forceN', fn: SIPrefix('N') },\n { name: 'Kilonewtons (kN)', id: 'forcekN', fn: SIPrefix('N', 1) },\n ],\n },\n {\n name: 'Hash rate',\n formats: [\n { name: 'hashes/sec', id: 'Hs', fn: SIPrefix('H/s') },\n { name: 'kilohashes/sec', id: 'KHs', fn: SIPrefix('H/s', 1) },\n { name: 'megahashes/sec', id: 'MHs', fn: SIPrefix('H/s', 2) },\n { name: 'gigahashes/sec', id: 'GHs', fn: SIPrefix('H/s', 3) },\n { name: 'terahashes/sec', id: 'THs', fn: SIPrefix('H/s', 4) },\n { name: 'petahashes/sec', id: 'PHs', fn: SIPrefix('H/s', 5) },\n { name: 'exahashes/sec', id: 'EHs', fn: SIPrefix('H/s', 6) },\n ],\n },\n {\n name: 'Mass',\n formats: [\n { name: 'milligram (mg)', id: 'massmg', fn: SIPrefix('g', -1) },\n { name: 'gram (g)', id: 'massg', fn: SIPrefix('g') },\n { name: 'pound (lb)', id: 'masslb', fn: toFixedUnit('lb') },\n { name: 'kilogram (kg)', id: 'masskg', fn: SIPrefix('g', 1) },\n { name: 'metric ton (t)', id: 'masst', fn: toFixedUnit('t') },\n ],\n },\n {\n name: 'Length',\n formats: [\n { name: 'millimeter (mm)', id: 'lengthmm', fn: SIPrefix('m', -1) },\n { name: 'inch (in)', id: 'lengthin', fn: toFixedUnit('in') },\n { name: 'feet (ft)', id: 'lengthft', fn: toFixedUnit('ft') },\n { name: 'meter (m)', id: 'lengthm', fn: SIPrefix('m') },\n { name: 'kilometer (km)', id: 'lengthkm', fn: SIPrefix('m', 1) },\n { name: 'mile (mi)', id: 'lengthmi', fn: toFixedUnit('mi') },\n ],\n },\n {\n name: 'Pressure',\n formats: [\n { name: 'Millibars', id: 'pressurembar', fn: SIPrefix('bar', -1) },\n { name: 'Bars', id: 'pressurebar', fn: SIPrefix('bar') },\n { name: 'Kilobars', id: 'pressurekbar', fn: SIPrefix('bar', 1) },\n { name: 'Pascals', id: 'pressurepa', fn: SIPrefix('Pa') },\n { name: 'Hectopascals', id: 'pressurehpa', fn: toFixedUnit('hPa') },\n { name: 'Kilopascals', id: 'pressurekpa', fn: toFixedUnit('kPa') },\n { name: 'Inches of mercury', id: 'pressurehg', fn: toFixedUnit('\"Hg') },\n { name: 'PSI', id: 'pressurepsi', fn: scaledUnits(1000, ['psi', 'ksi', 'Mpsi']) },\n ],\n },\n {\n name: 'Radiation',\n formats: [\n { name: 'Becquerel (Bq)', id: 'radbq', fn: SIPrefix('Bq') },\n { name: 'curie (Ci)', id: 'radci', fn: SIPrefix('Ci') },\n { name: 'Gray (Gy)', id: 'radgy', fn: SIPrefix('Gy') },\n { name: 'rad', id: 'radrad', fn: SIPrefix('rad') },\n { name: 'Sievert (Sv)', id: 'radsv', fn: SIPrefix('Sv') },\n { name: 'milliSievert (mSv)', id: 'radmsv', fn: SIPrefix('Sv', -1) },\n { name: 'microSievert (µSv)', id: 'radusv', fn: SIPrefix('Sv', -2) },\n { name: 'rem', id: 'radrem', fn: SIPrefix('rem') },\n { name: 'Exposure (C/kg)', id: 'radexpckg', fn: SIPrefix('C/kg') },\n { name: 'roentgen (R)', id: 'radr', fn: SIPrefix('R') },\n { name: 'Sievert/hour (Sv/h)', id: 'radsvh', fn: SIPrefix('Sv/h') },\n { name: 'milliSievert/hour (mSv/h)', id: 'radmsvh', fn: SIPrefix('Sv/h', -1) },\n { name: 'microSievert/hour (µSv/h)', id: 'radusvh', fn: SIPrefix('Sv/h', -2) },\n ],\n },\n {\n name: 'Rotational Speed',\n formats: [\n { name: 'Revolutions per minute (rpm)', id: 'rotrpm', fn: toFixedUnit('rpm') },\n { name: 'Hertz (Hz)', id: 'rothz', fn: SIPrefix('Hz') },\n { name: 'Radians per second (rad/s)', id: 'rotrads', fn: toFixedUnit('rad/s') },\n { name: 'Degrees per second (°/s)', id: 'rotdegs', fn: toFixedUnit('°/s') },\n ],\n },\n {\n name: 'Temperature',\n formats: [\n { name: 'Celsius (°C)', id: 'celsius', fn: toFixedUnit('°C') },\n { name: 'Fahrenheit (°F)', id: 'fahrenheit', fn: toFixedUnit('°F') },\n { name: 'Kelvin (K)', id: 'kelvin', fn: toFixedUnit('K') },\n ],\n },\n {\n name: 'Time',\n formats: [\n { name: 'Hertz (1/s)', id: 'hertz', fn: SIPrefix('Hz') },\n { name: 'nanoseconds (ns)', id: 'ns', fn: toNanoSeconds },\n { name: 'microseconds (µs)', id: 'µs', fn: toMicroSeconds },\n { name: 'milliseconds (ms)', id: 'ms', fn: toMilliSeconds },\n { name: 'seconds (s)', id: 's', fn: toSeconds },\n { name: 'minutes (m)', id: 'm', fn: toMinutes },\n { name: 'hours (h)', id: 'h', fn: toHours },\n { name: 'days (d)', id: 'd', fn: toDays },\n { name: 'duration (ms)', id: 'dtdurationms', fn: toDurationInMilliseconds },\n { name: 'duration (s)', id: 'dtdurations', fn: toDurationInSeconds },\n { name: 'duration (hh:mm:ss)', id: 'dthms', fn: toDurationInHoursMinutesSeconds },\n { name: 'duration (d hh:mm:ss)', id: 'dtdhms', fn: toDurationInDaysHoursMinutesSeconds },\n { name: 'Timeticks (s/100)', id: 'timeticks', fn: toTimeTicks },\n { name: 'clock (ms)', id: 'clockms', fn: toClockMilliseconds },\n { name: 'clock (s)', id: 'clocks', fn: toClockSeconds },\n ],\n },\n {\n name: 'Throughput',\n formats: [\n { name: 'counts/sec (cps)', id: 'cps', fn: simpleCountUnit('c/s') },\n { name: 'ops/sec (ops)', id: 'ops', fn: simpleCountUnit('ops/s') },\n { name: 'requests/sec (rps)', id: 'reqps', fn: simpleCountUnit('req/s') },\n { name: 'reads/sec (rps)', id: 'rps', fn: simpleCountUnit('rd/s') },\n { name: 'writes/sec (wps)', id: 'wps', fn: simpleCountUnit('wr/s') },\n { name: 'I/O ops/sec (iops)', id: 'iops', fn: simpleCountUnit('io/s') },\n { name: 'counts/min (cpm)', id: 'cpm', fn: simpleCountUnit('c/m') },\n { name: 'ops/min (opm)', id: 'opm', fn: simpleCountUnit('ops/m') },\n { name: 'reads/min (rpm)', id: 'rpm', fn: simpleCountUnit('rd/m') },\n { name: 'writes/min (wpm)', id: 'wpm', fn: simpleCountUnit('wr/m') },\n ],\n },\n {\n name: 'Velocity',\n formats: [\n { name: 'meters/second (m/s)', id: 'velocityms', fn: toFixedUnit('m/s') },\n { name: 'kilometers/hour (km/h)', id: 'velocitykmh', fn: toFixedUnit('km/h') },\n { name: 'miles/hour (mph)', id: 'velocitymph', fn: toFixedUnit('mph') },\n { name: 'knot (kn)', id: 'velocityknot', fn: toFixedUnit('kn') },\n ],\n },\n {\n name: 'Volume',\n formats: [\n { name: 'millilitre (mL)', id: 'mlitre', fn: SIPrefix('L', -1) },\n { name: 'litre (L)', id: 'litre', fn: SIPrefix('L') },\n { name: 'cubic meter', id: 'm3', fn: toFixedUnit('m³') },\n { name: 'Normal cubic meter', id: 'Nm3', fn: toFixedUnit('Nm³') },\n { name: 'cubic decimeter', id: 'dm3', fn: toFixedUnit('dm³') },\n { name: 'gallons', id: 'gallons', fn: toFixedUnit('gal') },\n ],\n },\n {\n name: 'Boolean',\n formats: [\n { name: 'True / False', id: 'bool', fn: booleanValueFormatter('True', 'False') },\n { name: 'Yes / No', id: 'bool_yes_no', fn: booleanValueFormatter('Yes', 'No') },\n { name: 'On / Off', id: 'bool_on_off', fn: booleanValueFormatter('On', 'Off') },\n ],\n },\n];\n","import { toDuration as duration, toUtc, dateTime } from '../datetime/moment_wrapper';\n\nimport { toFixed, toFixedScaled, FormattedValue, ValueFormatter } from './valueFormats';\nimport { DecimalCount } from '../types/displayValue';\nimport { TimeZone } from '../types';\nimport { dateTimeFormat, dateTimeFormatTimeAgo, localTimeFormat, systemDateFormats } from '../datetime';\n\ninterface IntervalsInSeconds {\n [interval: string]: number;\n}\n\nexport enum Interval {\n Year = 'year',\n Month = 'month',\n Week = 'week',\n Day = 'day',\n Hour = 'hour',\n Minute = 'minute',\n Second = 'second',\n Millisecond = 'millisecond',\n}\n\nconst UNITS = [\n Interval.Year,\n Interval.Month,\n Interval.Week,\n Interval.Day,\n Interval.Hour,\n Interval.Minute,\n Interval.Second,\n Interval.Millisecond,\n];\n\nconst INTERVALS_IN_SECONDS: IntervalsInSeconds = {\n [Interval.Year]: 31536000,\n [Interval.Month]: 2592000,\n [Interval.Week]: 604800,\n [Interval.Day]: 86400,\n [Interval.Hour]: 3600,\n [Interval.Minute]: 60,\n [Interval.Second]: 1,\n [Interval.Millisecond]: 0.001,\n};\n\nexport function toNanoSeconds(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 1000) {\n return { text: toFixed(size, decimals), suffix: ' ns' };\n } else if (Math.abs(size) < 1000000) {\n return toFixedScaled(size / 1000, decimals, ' µs');\n } else if (Math.abs(size) < 1000000000) {\n return toFixedScaled(size / 1000000, decimals, ' ms');\n } else if (Math.abs(size) < 60000000000) {\n return toFixedScaled(size / 1000000000, decimals, ' s');\n } else if (Math.abs(size) < 3600000000000) {\n return toFixedScaled(size / 60000000000, decimals, ' min');\n } else if (Math.abs(size) < 86400000000000) {\n return toFixedScaled(size / 3600000000000, decimals, ' hour');\n } else {\n return toFixedScaled(size / 86400000000000, decimals, ' day');\n }\n}\n\nexport function toMicroSeconds(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 1000) {\n return { text: toFixed(size, decimals), suffix: ' µs' };\n } else if (Math.abs(size) < 1000000) {\n return toFixedScaled(size / 1000, decimals, ' ms');\n } else {\n return toFixedScaled(size / 1000000, decimals, ' s');\n }\n}\n\nexport function toMilliSeconds(size: number, decimals?: DecimalCount, scaledDecimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 1000) {\n return { text: toFixed(size, decimals), suffix: ' ms' };\n } else if (Math.abs(size) < 60000) {\n // Less than 1 min\n return toFixedScaled(size / 1000, decimals, ' s');\n } else if (Math.abs(size) < 3600000) {\n // Less than 1 hour, divide in minutes\n return toFixedScaled(size / 60000, decimals, ' min');\n } else if (Math.abs(size) < 86400000) {\n // Less than one day, divide in hours\n return toFixedScaled(size / 3600000, decimals, ' hour');\n } else if (Math.abs(size) < 31536000000) {\n // Less than one year, divide in days\n return toFixedScaled(size / 86400000, decimals, ' day');\n }\n\n return toFixedScaled(size / 31536000000, decimals, ' year');\n}\n\nexport function trySubstract(value1: DecimalCount, value2: DecimalCount): DecimalCount {\n if (value1 !== null && value1 !== undefined && value2 !== null && value2 !== undefined) {\n return value1 - value2;\n }\n return undefined;\n}\n\nexport function toSeconds(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n // If 0, use s unit instead of ns\n if (size === 0) {\n return { text: '0', suffix: ' s' };\n }\n\n // Less than 1 µs, divide in ns\n if (Math.abs(size) < 0.000001) {\n return toFixedScaled(size * 1e9, decimals, ' ns');\n }\n // Less than 1 ms, divide in µs\n if (Math.abs(size) < 0.001) {\n return toFixedScaled(size * 1e6, decimals, ' µs');\n }\n // Less than 1 second, divide in ms\n if (Math.abs(size) < 1) {\n return toFixedScaled(size * 1e3, decimals, ' ms');\n }\n\n if (Math.abs(size) < 60) {\n return { text: toFixed(size, decimals), suffix: ' s' };\n } else if (Math.abs(size) < 3600) {\n // Less than 1 hour, divide in minutes\n return toFixedScaled(size / 60, decimals, ' min');\n } else if (Math.abs(size) < 86400) {\n // Less than one day, divide in hours\n return toFixedScaled(size / 3600, decimals, ' hour');\n } else if (Math.abs(size) < 604800) {\n // Less than one week, divide in days\n return toFixedScaled(size / 86400, decimals, ' day');\n } else if (Math.abs(size) < 31536000) {\n // Less than one year, divide in week\n return toFixedScaled(size / 604800, decimals, ' week');\n }\n\n return toFixedScaled(size / 3.15569e7, decimals, ' year');\n}\n\nexport function toMinutes(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 60) {\n return { text: toFixed(size, decimals), suffix: ' min' };\n } else if (Math.abs(size) < 1440) {\n return toFixedScaled(size / 60, decimals, ' hour');\n } else if (Math.abs(size) < 10080) {\n return toFixedScaled(size / 1440, decimals, ' day');\n } else if (Math.abs(size) < 604800) {\n return toFixedScaled(size / 10080, decimals, ' week');\n } else {\n return toFixedScaled(size / 5.25948e5, decimals, ' year');\n }\n}\n\nexport function toHours(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 24) {\n return { text: toFixed(size, decimals), suffix: ' hour' };\n } else if (Math.abs(size) < 168) {\n return toFixedScaled(size / 24, decimals, ' day');\n } else if (Math.abs(size) < 8760) {\n return toFixedScaled(size / 168, decimals, ' week');\n } else {\n return toFixedScaled(size / 8760, decimals, ' year');\n }\n}\n\nexport function toDays(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (Math.abs(size) < 7) {\n return { text: toFixed(size, decimals), suffix: ' day' };\n } else if (Math.abs(size) < 365) {\n return toFixedScaled(size / 7, decimals, ' week');\n } else {\n return toFixedScaled(size / 365, decimals, ' year');\n }\n}\n\nexport function toDuration(size: number, decimals: DecimalCount, timeScale: Interval): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n if (size === 0) {\n return { text: '0', suffix: ' ' + timeScale + 's' };\n }\n\n if (size < 0) {\n const v = toDuration(-size, decimals, timeScale);\n if (!v.suffix) {\n v.suffix = '';\n }\n v.suffix += ' ago';\n return v;\n }\n\n // convert $size to milliseconds\n // intervals_in_seconds uses seconds (duh), convert them to milliseconds here to minimize floating point errors\n size *= INTERVALS_IN_SECONDS[timeScale] * 1000;\n\n const strings = [];\n\n // after first value >= 1 print only $decimals more\n let decrementDecimals = false;\n let decimalsCount = 0;\n\n if (decimals !== null && decimals !== undefined) {\n decimalsCount = decimals as number;\n }\n\n for (let i = 0; i < UNITS.length && decimalsCount >= 0; i++) {\n const interval = INTERVALS_IN_SECONDS[UNITS[i]] * 1000;\n const value = size / interval;\n if (value >= 1 || decrementDecimals) {\n decrementDecimals = true;\n const floor = Math.floor(value);\n const unit = UNITS[i] + (floor !== 1 ? 's' : '');\n strings.push(floor + ' ' + unit);\n size = size % interval;\n decimalsCount--;\n }\n }\n\n return { text: strings.join(', ') };\n}\n\nexport function toClock(size: number, decimals?: DecimalCount): FormattedValue {\n if (size === null) {\n return { text: '' };\n }\n\n // < 1 second\n if (size < 1000) {\n return {\n text: toUtc(size).format('SSS\\\\m\\\\s'),\n };\n }\n\n // < 1 minute\n if (size < 60000) {\n let format = 'ss\\\\s:SSS\\\\m\\\\s';\n if (decimals === 0) {\n format = 'ss\\\\s';\n }\n return { text: toUtc(size).format(format) };\n }\n\n // < 1 hour\n if (size < 3600000) {\n let format = 'mm\\\\m:ss\\\\s:SSS\\\\m\\\\s';\n if (decimals === 0) {\n format = 'mm\\\\m';\n } else if (decimals === 1) {\n format = 'mm\\\\m:ss\\\\s';\n }\n return { text: toUtc(size).format(format) };\n }\n\n let format = 'mm\\\\m:ss\\\\s:SSS\\\\m\\\\s';\n\n const hours = `${('0' + Math.floor(duration(size, 'milliseconds').asHours())).slice(-2)}h`;\n\n if (decimals === 0) {\n format = '';\n } else if (decimals === 1) {\n format = 'mm\\\\m';\n } else if (decimals === 2) {\n format = 'mm\\\\m:ss\\\\s';\n }\n\n const text = format ? `${hours}:${toUtc(size).format(format)}` : hours;\n return { text };\n}\n\nexport function toDurationInMilliseconds(size: number, decimals: DecimalCount): FormattedValue {\n return toDuration(size, decimals, Interval.Millisecond);\n}\n\nexport function toDurationInSeconds(size: number, decimals: DecimalCount): FormattedValue {\n return toDuration(size, decimals, Interval.Second);\n}\n\nexport function toDurationInHoursMinutesSeconds(size: number): FormattedValue {\n if (size < 0) {\n const v = toDurationInHoursMinutesSeconds(-size);\n if (!v.suffix) {\n v.suffix = '';\n }\n v.suffix += ' ago';\n return v;\n }\n const strings = [];\n const numHours = Math.floor(size / 3600);\n const numMinutes = Math.floor((size % 3600) / 60);\n const numSeconds = Math.floor((size % 3600) % 60);\n numHours > 9 ? strings.push('' + numHours) : strings.push('0' + numHours);\n numMinutes > 9 ? strings.push('' + numMinutes) : strings.push('0' + numMinutes);\n numSeconds > 9 ? strings.push('' + numSeconds) : strings.push('0' + numSeconds);\n return { text: strings.join(':') };\n}\n\nexport function toDurationInDaysHoursMinutesSeconds(size: number): FormattedValue {\n if (size < 0) {\n const v = toDurationInDaysHoursMinutesSeconds(-size);\n if (!v.suffix) {\n v.suffix = '';\n }\n v.suffix += ' ago';\n return v;\n }\n let dayString = '';\n const numDays = Math.floor(size / (24 * 3600));\n if (numDays > 0) {\n dayString = numDays + ' d ';\n }\n const hmsString = toDurationInHoursMinutesSeconds(size - numDays * 24 * 3600);\n return { text: dayString + hmsString.text };\n}\n\nexport function toTimeTicks(size: number, decimals: DecimalCount): FormattedValue {\n return toSeconds(size / 100, decimals);\n}\n\nexport function toClockMilliseconds(size: number, decimals: DecimalCount): FormattedValue {\n return toClock(size, decimals);\n}\n\nexport function toClockSeconds(size: number, decimals: DecimalCount): FormattedValue {\n return toClock(size * 1000, decimals);\n}\n\nexport function toDateTimeValueFormatter(pattern: string, todayPattern?: string): ValueFormatter {\n return (value: number, decimals: DecimalCount, scaledDecimals: DecimalCount, timeZone?: TimeZone): FormattedValue => {\n if (todayPattern) {\n if (dateTime().isSame(value, 'day')) {\n return {\n text: dateTimeFormat(value, { format: todayPattern, timeZone }),\n };\n }\n }\n return { text: dateTimeFormat(value, { format: pattern, timeZone }) };\n };\n}\n\nexport const dateTimeAsIso = toDateTimeValueFormatter('YYYY-MM-DD HH:mm:ss');\nexport const dateTimeAsIsoNoDateIfToday = toDateTimeValueFormatter('YYYY-MM-DD HH:mm:ss', 'HH:mm:ss');\nexport const dateTimeAsUS = toDateTimeValueFormatter('MM/DD/YYYY h:mm:ss a');\nexport const dateTimeAsUSNoDateIfToday = toDateTimeValueFormatter('MM/DD/YYYY h:mm:ss a', 'h:mm:ss a');\n\nexport function getDateTimeAsLocalFormat() {\n return toDateTimeValueFormatter(\n localTimeFormat({\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n })\n );\n}\n\nexport function getDateTimeAsLocalFormatNoDateIfToday() {\n return toDateTimeValueFormatter(\n localTimeFormat({\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n }),\n localTimeFormat({\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n })\n );\n}\n\nexport function dateTimeSystemFormatter(\n value: number,\n decimals: DecimalCount,\n scaledDecimals: DecimalCount,\n timeZone?: TimeZone,\n showMs?: boolean\n): FormattedValue {\n return {\n text: dateTimeFormat(value, {\n format: showMs ? systemDateFormats.fullDateMS : systemDateFormats.fullDate,\n timeZone,\n }),\n };\n}\n\nexport function dateTimeFromNow(\n value: number,\n decimals: DecimalCount,\n scaledDecimals: DecimalCount,\n timeZone?: TimeZone\n): FormattedValue {\n return { text: dateTimeFormatTimeAgo(value, { timeZone }) };\n}\n","import { scaledUnits, ValueFormatter } from './valueFormats';\nimport { DecimalCount } from '../types/displayValue';\n\nexport function currency(symbol: string, asSuffix?: boolean): ValueFormatter {\n const units = ['', 'K', 'M', 'B', 'T'];\n const scaler = scaledUnits(1000, units);\n return (size: number, decimals?: DecimalCount, scaledDecimals?: DecimalCount) => {\n if (size === null) {\n return { text: '' };\n }\n const scaled = scaler(size, decimals, scaledDecimals);\n if (asSuffix) {\n scaled.suffix = scaled.suffix !== undefined ? `${scaled.suffix}${symbol}` : undefined;\n } else {\n scaled.prefix = symbol;\n }\n return scaled;\n };\n}\n\nexport function getOffsetFromSIPrefix(c: string): number {\n switch (c) {\n case 'f':\n return -5;\n case 'p':\n return -4;\n case 'n':\n return -3;\n case 'μ': // Two different unicode chars for µ\n case 'µ':\n return -2;\n case 'm':\n return -1;\n case '':\n return 0;\n case 'k':\n return 1;\n case 'M':\n return 2;\n case 'G':\n return 3;\n case 'T':\n return 4;\n case 'P':\n return 5;\n case 'E':\n return 6;\n case 'Z':\n return 7;\n case 'Y':\n return 8;\n }\n return 0;\n}\n\nexport function binaryPrefix(unit: string, offset = 0): ValueFormatter {\n const prefixes = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'].slice(offset);\n const units = prefixes.map((p) => {\n return ' ' + p + unit;\n });\n return scaledUnits(1024, units);\n}\n\nexport function SIPrefix(unit: string, offset = 0): ValueFormatter {\n let prefixes = ['f', 'p', 'n', 'µ', 'm', '', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];\n prefixes = prefixes.slice(5 + (offset || 0));\n const units = prefixes.map((p) => {\n return ' ' + p + unit;\n });\n return scaledUnits(1000, units);\n}\n","import { MutableVector } from '../types/vector';\nimport { FunctionalVector } from './FunctionalVector';\n\n/**\n * @public\n */\nexport class ArrayVector extends FunctionalVector implements MutableVector {\n buffer: T[];\n\n constructor(buffer?: T[]) {\n super();\n this.buffer = buffer ? buffer : [];\n }\n\n get length() {\n return this.buffer.length;\n }\n\n add(value: T) {\n this.buffer.push(value);\n }\n\n get(index: number): T {\n return this.buffer[index];\n }\n\n set(index: number, value: T) {\n this.buffer[index] = value;\n }\n\n reverse() {\n this.buffer.reverse();\n }\n\n toArray(): T[] {\n return this.buffer;\n }\n\n toJSON(): T[] {\n return this.buffer;\n }\n}\n","import { Vector } from '../types';\nimport { FunctionalVector } from './FunctionalVector';\n\n/**\n * This will force all values to be numbers\n *\n * @public\n */\nexport class AsNumberVector extends FunctionalVector {\n constructor(private field: Vector) {\n super();\n }\n\n get length() {\n return this.field.length;\n }\n\n get(index: number) {\n return +this.field.get(index);\n }\n}\n","import { Vector } from '../types/vector';\nimport { vectorToArray } from './vectorToArray';\nimport { BinaryOperation } from '../utils/binaryOperators';\n\n/**\n * @public\n */\nexport class BinaryOperationVector implements Vector {\n constructor(private left: Vector, private right: Vector, private operation: BinaryOperation) {}\n\n get length(): number {\n return this.left.length;\n }\n\n get(index: number): number {\n return this.operation(this.left.get(index), this.right.get(index));\n }\n\n toArray(): number[] {\n return vectorToArray(this);\n }\n\n toJSON(): number[] {\n return vectorToArray(this);\n }\n}\n","import { Vector } from '../types/vector';\n\n/**\n * @public\n */\nexport class ConstantVector implements Vector {\n constructor(private value: T, private len: number) {}\n\n get length() {\n return this.len;\n }\n\n get(index: number): T {\n return this.value;\n }\n\n toArray(): T[] {\n const arr = new Array(this.length);\n return arr.fill(this.value);\n }\n\n toJSON(): T[] {\n return this.toArray();\n }\n}\n","import { Vector } from '../types';\nimport { vectorToArray } from './vectorToArray';\n\n/**\n * RowVector makes the row values look like a vector\n * @internal\n */\nexport class RowVector implements Vector {\n constructor(private columns: Vector[]) {}\n\n rowIndex = 0;\n\n get length(): number {\n return this.columns.length;\n }\n\n get(index: number): number {\n return this.columns[index].get(this.rowIndex);\n }\n\n toArray(): number[] {\n return vectorToArray(this);\n }\n\n toJSON(): number[] {\n return vectorToArray(this);\n }\n}\n","import { Vector } from '../types/vector';\nimport { vectorToArray } from './vectorToArray';\n\n/**\n * Values are returned in the order defined by the input parameter\n */\nexport class SortedVector implements Vector {\n constructor(private source: Vector, private order: number[]) {}\n\n get length(): number {\n return this.source.length;\n }\n\n get(index: number): T {\n return this.source.get(this.order[index]);\n }\n\n toArray(): T[] {\n return vectorToArray(this);\n }\n\n toJSON(): T[] {\n return vectorToArray(this);\n }\n}\n","import { Vector } from '../types/vector';\n\nexport function vectorToArray(v: Vector): T[] {\n const arr: T[] = Array(v.length);\n for (let i = 0; i < v.length; i++) {\n arr[i] = v.get(i);\n }\n return arr;\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 | Object): DataQueryError {\n const error = (err || {}) as DataQueryError;\n\n if (!error.message) {\n if (typeof err === 'string' || err instanceof String) {\n return { message: err } as DataQueryError;\n }\n\n let message = 'Query error';\n if (error.message) {\n message = error.message;\n } else if (error.data && error.data.message) {\n message = error.data.message;\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 LiveChannelStatusEvent,\n LiveChannelEvent,\n LiveChannelEventType,\n LiveChannelConnectionState,\n LiveChannelPresenceStatus,\n LiveChannelAddress,\n DataFrameJSON,\n isValidLiveChannelAddress,\n} from '@grafana/data';\nimport Centrifuge, {\n JoinLeaveContext,\n PublicationContext,\n SubscribeErrorContext,\n SubscribeSuccessContext,\n SubscriptionEvents,\n UnsubscribeContext,\n} from 'centrifuge/dist/centrifuge';\n\nimport { Subject, of, Observable } from 'rxjs';\n\n/**\n * Internal class that maps Centrifuge support to GrafanaLive\n */\nexport class CentrifugeLiveChannel {\n readonly currentStatus: LiveChannelStatusEvent;\n\n readonly opened = Date.now();\n readonly id: string;\n readonly addr: LiveChannelAddress;\n\n readonly stream = new Subject>();\n\n // Hold on to the last header with schema\n lastMessageWithSchema?: DataFrameJSON;\n\n subscription?: Centrifuge.Subscription;\n shutdownCallback?: () => void;\n initalized?: boolean;\n\n constructor(id: string, addr: LiveChannelAddress) {\n this.id = id;\n this.addr = addr;\n this.currentStatus = {\n type: LiveChannelEventType.Status,\n id,\n timestamp: this.opened,\n state: LiveChannelConnectionState.Pending,\n };\n if (!isValidLiveChannelAddress(addr)) {\n this.currentStatus.state = LiveChannelConnectionState.Invalid;\n this.currentStatus.error = 'invalid channel address';\n }\n }\n\n // This should only be called when centrifuge is connected\n initalize(): SubscriptionEvents {\n if (this.initalized) {\n throw new Error('Channel already initalized: ' + this.id);\n }\n this.initalized = true;\n\n const events: SubscriptionEvents = {\n // Called when a message is recieved from the socket\n publish: (ctx: PublicationContext) => {\n try {\n if (ctx.data) {\n if (ctx.data.schema) {\n this.lastMessageWithSchema = ctx.data as DataFrameJSON;\n }\n\n this.stream.next({\n type: LiveChannelEventType.Message,\n message: ctx.data,\n });\n }\n\n // Clear any error messages\n if (this.currentStatus.error) {\n this.currentStatus.timestamp = Date.now();\n delete this.currentStatus.error;\n this.sendStatus();\n }\n } catch (err) {\n console.log('publish error', this.addr, err);\n this.currentStatus.error = err;\n this.currentStatus.timestamp = Date.now();\n this.sendStatus();\n }\n },\n error: (ctx: SubscribeErrorContext) => {\n this.currentStatus.timestamp = Date.now();\n this.currentStatus.error = ctx.error;\n this.sendStatus();\n },\n subscribe: (ctx: SubscribeSuccessContext) => {\n this.currentStatus.timestamp = Date.now();\n this.currentStatus.state = LiveChannelConnectionState.Connected;\n delete this.currentStatus.error;\n\n if (ctx.data?.schema) {\n this.lastMessageWithSchema = ctx.data as DataFrameJSON;\n }\n\n this.sendStatus(ctx.data);\n },\n unsubscribe: (ctx: UnsubscribeContext) => {\n this.currentStatus.timestamp = Date.now();\n this.currentStatus.state = LiveChannelConnectionState.Disconnected;\n this.sendStatus();\n },\n };\n\n events.join = (ctx: JoinLeaveContext) => {\n this.stream.next({ type: LiveChannelEventType.Join, user: ctx.info.user });\n };\n events.leave = (ctx: JoinLeaveContext) => {\n this.stream.next({ type: LiveChannelEventType.Leave, user: ctx.info.user });\n };\n return events;\n }\n\n private sendStatus(message?: any) {\n const copy = { ...this.currentStatus };\n if (message) {\n copy.message = message;\n }\n this.stream.next(copy);\n }\n\n disconnectIfNoListeners = () => {\n const count = this.stream.observers.length;\n if (count === 0) {\n this.disconnect();\n }\n };\n\n /**\n * Get the stream of events and\n */\n getStream() {\n return new Observable((subscriber) => {\n subscriber.next({ ...this.currentStatus });\n const sub = this.stream.subscribe(subscriber);\n return () => {\n sub.unsubscribe();\n const count = this.stream.observers.length;\n\n // Wait 1/4 second to fully disconnect\n if (count === 0) {\n setTimeout(this.disconnectIfNoListeners, 250);\n }\n };\n }) as Observable>;\n }\n\n /**\n * This is configured by the server when the config supports presence\n */\n async getPresence(): Promise {\n if (!this.subscription) {\n return Promise.reject('not subscribed');\n }\n\n return this.subscription!.presence().then((v) => {\n return {\n users: Object.keys(v.presence),\n };\n });\n }\n\n /**\n * This will close and terminate all streams for this channel\n */\n disconnect() {\n this.currentStatus.state = LiveChannelConnectionState.Shutdown;\n this.currentStatus.timestamp = Date.now();\n\n if (this.subscription) {\n this.subscription.unsubscribe();\n this.subscription.removeAllListeners(); // they keep all listeners attached after unsubscribe\n this.subscription = undefined;\n }\n\n this.stream.complete();\n\n this.stream.next({ ...this.currentStatus });\n this.stream.complete();\n\n if (this.shutdownCallback) {\n this.shutdownCallback();\n }\n }\n\n shutdownWithError(err: string) {\n this.currentStatus.error = err;\n this.sendStatus();\n this.disconnect();\n }\n}\n\nexport function getErrorChannel(msg: string, id: string, addr: LiveChannelAddress) {\n return {\n id,\n opened: Date.now(),\n addr,\n\n // return an error\n getStream: () =>\n of({\n type: LiveChannelEventType.Status,\n id,\n timestamp: Date.now(),\n state: LiveChannelConnectionState.Invalid,\n error: msg,\n }),\n\n // already disconnected\n disconnect: () => {},\n };\n}\n","import Centrifuge from 'centrifuge/dist/centrifuge';\nimport { LiveDataStreamOptions } from '@grafana/runtime';\nimport { toDataQueryError } from '@grafana/runtime/src/utils/toDataQueryError';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport {\n DataFrame,\n DataFrameJSON,\n dataFrameToJSON,\n DataQueryResponse,\n isLiveChannelMessageEvent,\n isLiveChannelStatusEvent,\n LiveChannelAddress,\n LiveChannelConnectionState,\n LiveChannelEvent,\n LiveChannelPresenceStatus,\n LoadingState,\n StreamingDataFrame,\n toDataFrameDTO,\n} from '@grafana/data';\nimport { CentrifugeLiveChannel } from './channel';\n\nexport type CentrifugeSrvDeps = {\n appUrl: string;\n orgId: number;\n orgRole: string;\n sessionId: string;\n liveEnabled: boolean;\n dataStreamSubscriberReadiness: Observable;\n};\n\nexport interface CentrifugeSrv {\n /**\n * Listen for changes to the connection state\n */\n getConnectionState(): Observable;\n\n /**\n * Watch for messages in a channel\n */\n getStream(address: LiveChannelAddress): Observable>;\n\n /**\n * Connect to a channel and return results as DataFrames\n */\n getDataStream(options: LiveDataStreamOptions): Observable;\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;\n}\n\nexport class CentrifugeService implements CentrifugeSrv {\n readonly open = new Map();\n readonly centrifuge: Centrifuge;\n readonly connectionState: BehaviorSubject;\n readonly connectionBlocker: Promise;\n private dataStreamSubscriberReady = true;\n\n constructor(private deps: CentrifugeSrvDeps) {\n deps.dataStreamSubscriberReadiness.subscribe((next) => (this.dataStreamSubscriberReady = next));\n const liveUrl = `${deps.appUrl.replace(/^http/, 'ws')}/api/live/ws`;\n this.centrifuge = new Centrifuge(liveUrl, {});\n this.centrifuge.setConnectData({\n sessionId: deps.sessionId,\n orgId: deps.orgId,\n });\n // orgRole is set when logged in *or* anonomus users can use grafana\n if (deps.liveEnabled && deps.orgRole !== '') {\n this.centrifuge.connect(); // do connection\n }\n this.connectionState = new BehaviorSubject(this.centrifuge.isConnected());\n this.connectionBlocker = new Promise((resolve) => {\n if (this.centrifuge.isConnected()) {\n return resolve();\n }\n const connectListener = () => {\n resolve();\n this.centrifuge.removeListener('connect', connectListener);\n };\n this.centrifuge.addListener('connect', connectListener);\n });\n\n // Register global listeners\n this.centrifuge.on('connect', this.onConnect);\n this.centrifuge.on('disconnect', this.onDisconnect);\n this.centrifuge.on('publish', this.onServerSideMessage);\n }\n\n //----------------------------------------------------------\n // Internal functions\n //----------------------------------------------------------\n\n private onConnect = (context: any) => {\n this.connectionState.next(true);\n };\n\n private onDisconnect = (context: any) => {\n this.connectionState.next(false);\n };\n\n private onServerSideMessage = (context: any) => {\n console.log('Publication from server-side channel', context);\n };\n\n /**\n * Get a channel. If the scope, namespace, or path is invalid, a shutdown\n * channel will be returned with an error state indicated in its status\n */\n private getChannel(addr: LiveChannelAddress): CentrifugeLiveChannel {\n const id = `${this.deps.orgId}/${addr.scope}/${addr.namespace}/${addr.path}`;\n let channel = this.open.get(id);\n if (channel != null) {\n return channel;\n }\n\n channel = new CentrifugeLiveChannel(id, addr);\n if (channel.currentStatus.state === LiveChannelConnectionState.Invalid) {\n return channel;\n }\n channel.shutdownCallback = () => {\n this.open.delete(id); // remove it from the list of open channels\n };\n this.open.set(id, channel);\n\n // Initialize the channel in the background\n this.initChannel(channel).catch((err) => {\n if (channel) {\n channel.currentStatus.state = LiveChannelConnectionState.Invalid;\n channel.shutdownWithError(err);\n }\n this.open.delete(id);\n });\n\n // return the not-yet initalized channel\n return channel;\n }\n\n private async initChannel(channel: CentrifugeLiveChannel): Promise {\n const events = channel.initalize();\n if (!this.centrifuge.isConnected()) {\n await this.connectionBlocker;\n }\n channel.subscription = this.centrifuge.subscribe(channel.id, events);\n return;\n }\n\n //----------------------------------------------------------\n // Exported functions\n //----------------------------------------------------------\n\n /**\n * Listen for changes to the connection state\n */\n getConnectionState() {\n return this.connectionState.asObservable();\n }\n\n /**\n * Watch for messages in a channel\n */\n getStream(address: LiveChannelAddress): Observable> {\n return this.getChannel(address).getStream();\n }\n\n /**\n * Connect to a channel and return results as DataFrames\n */\n getDataStream(options: LiveDataStreamOptions): Observable {\n return new Observable((subscriber) => {\n const channel = this.getChannel(options.addr);\n const key = options.key ?? `xstr/${streamCounter++}`;\n let data: StreamingDataFrame | undefined = undefined;\n let filtered: DataFrame | undefined = undefined;\n let state = LoadingState.Streaming;\n let lastWidth = -1;\n\n const process = (msg: DataFrameJSON) => {\n if (!data) {\n data = new StreamingDataFrame(msg, options.buffer);\n } else {\n data.push(msg);\n }\n state = LoadingState.Streaming;\n const sameWidth = lastWidth === data.fields.length;\n lastWidth = data.fields.length;\n\n // Filter out fields\n if (!filtered || msg.schema || !sameWidth) {\n filtered = data;\n if (options.filter) {\n const { fields } = options.filter;\n if (fields?.length) {\n filtered = {\n ...data,\n fields: data.fields.filter((f) => fields.includes(f.name)),\n };\n }\n }\n }\n\n if (this.dataStreamSubscriberReady) {\n filtered.length = data.length; // make sure they stay up-to-date\n subscriber.next({\n state,\n data: [\n // workaround for serializing issues when sending DataFrame from web worker to the main thread\n // DataFrame is making use of ArrayVectors which are es6 classes and thus not cloneable out of the box\n // `toDataFrameDTO` converts ArrayVectors into native arrays.\n toDataFrameDTO(filtered),\n ],\n key,\n });\n }\n };\n\n if (options.frame) {\n process(dataFrameToJSON(options.frame));\n } else if (channel.lastMessageWithSchema) {\n process(channel.lastMessageWithSchema);\n }\n\n const sub = channel.getStream().subscribe({\n error: (err: any) => {\n console.log('LiveQuery [error]', { err }, options.addr);\n state = LoadingState.Error;\n subscriber.next({ state, data: [data], key, error: toDataQueryError(err) });\n sub.unsubscribe(); // close after error\n },\n complete: () => {\n console.log('LiveQuery [complete]', options.addr);\n if (state !== LoadingState.Error) {\n state = LoadingState.Done;\n }\n // or track errors? subscriber.next({ state, data: [data], key });\n subscriber.complete();\n sub.unsubscribe();\n },\n next: (evt: LiveChannelEvent) => {\n if (isLiveChannelMessageEvent(evt)) {\n process(evt.message);\n return;\n }\n if (isLiveChannelStatusEvent(evt)) {\n if (evt.error) {\n let error = toDataQueryError(evt.error);\n error.message = `Streaming channel error: ${error.message}`;\n state = LoadingState.Error;\n subscriber.next({ state, data: [data], key, error });\n return;\n } else if (\n evt.state === LiveChannelConnectionState.Connected ||\n evt.state === LiveChannelConnectionState.Pending\n ) {\n if (evt.message) {\n process(evt.message);\n }\n return;\n }\n console.log('ignore state', evt);\n }\n },\n });\n\n return () => {\n sub.unsubscribe();\n };\n });\n }\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 {\n return this.getChannel(address).getPresence();\n }\n}\n\n// This is used to give a unique key for each stream. The actual value does not matter\nlet streamCounter = 0;\n","import * as comlink from 'comlink';\nimport { Subscriber } from 'rxjs';\n\n// Observers, ie. functions passed to `observable.subscribe(...)`, are converted to a subclass of `Subscriber` before they are sent to the source Observable.\n// The conversion happens internally in the RxJS library - this transfer handler is catches them and wraps them with a proxy\nconst subscriberTransferHandler: any = {\n canHandle(value: any): boolean {\n return value && value instanceof Subscriber;\n },\n\n serialize(value: Function): [MessagePort, Transferable[]] {\n const obj = comlink.proxy(value);\n\n const { port1, port2 } = new MessageChannel();\n\n comlink.expose(obj, port1);\n\n return [port2, [port2]];\n },\n\n deserialize(value: MessagePort): comlink.Remote {\n value.start();\n\n return comlink.wrap(value);\n },\n};\ncomlink.transferHandlers.set('SubscriberHandler', subscriberTransferHandler);\n"],"names":["dateTimeParse","value","options","isDateTime","parseString","parseOthers","indexOf","isValid","moment","parse","roundUp","timeZone","fiscalYearStartMonth","getTimeZone","zone","format","systemDateFormats","name","lowerCase","date","typeList","Set","eventFactory","has","Error","add","BusEventBase","constructor","this","type","__proto__","BusEventWithPayload","payload","super","FieldConfigOptionsRegistry","Registry","fieldIndexComparer","field","reverse","values","FieldType","numericIndexComparer","stringIndexComparer","booleanIndexComparer","timeIndexComparer","naturalIndexComparer","timeComparer","a","b","isNumber","numericComparer","dateTime","isBefore","falsyComparer","stringComparer","localeCompare","booleanComparer","vA","get","vB","getFrameDisplayName","frame","index","valuesWithLabels","fields","labels","Object","keys","length","push","formatLabels","undefined","filter","f","map","getFieldDisplayName","join","refId","allFrames","existingTitle","state","displayName","hasConfigTitle","config","displayNameFromDS","TIME_SERIES_TIME_FIELD_NAME","parts","frameNamesDiffer","i","frameNameAdded","labelsAdded","TIME_SERIES_VALUE_FIELD_NAME","singleLabelName","frames","singleName","labelKey","getSingleLabelName","allLabels","dupeCount","foundSelf","otherField","getUniqueFieldName","calculateFieldDisplayName","XSSWL","xss","reduce","acc","element","concat","sanitizeXSS","whiteList","sanitize","unsanitizedString","process","error","console","sanitizeUrl","url","braintreeSanitizeUrl","hasAnsiCodes","input","test","escapeHtml","str","String","replace","createV1Theme","theme","oldCommon","typography","fontFamily","sansSerif","monospace","fontFamilyMonospace","size","base","fontSize","xs","sm","md","lg","heading","h1","h2","h3","h4","h5","h6","weight","light","fontWeightLight","regular","fontWeightRegular","semibold","fontWeightMedium","bold","fontWeightBold","lineHeight","bodySmall","body","link","decoration","hoverDecoration","breakpoints","xl","xxl","spacing","gridSize","insetSquishMd","d","xxs","gutter","formSpacingBase","formMargin","formFieldsetMargin","formInputHeight","formButtonHeight","formInputPaddingHorizontal","formInputAffixPaddingHorizontal","formInputMargin","formLabelPadding","formLabelMargin","formValidationMessagePadding","formValidationMessageMargin","inlineFormMargin","border","radius","shape","borderRadius","width","height","components","panelPadding","panel","padding","panelHeaderHeight","headerHeight","zIndex","basicColors","commonColorsPalette","black","white","dark1","dark2","dark3","dark4","dark5","dark6","dark7","dark8","dark9","dark10","gray1","gray2","gray3","gray4","gray5","gray6","gray7","redBase","redShade","greenBase","greenShade","red","yellow","purple","variable","orange","orangeDark","backgrounds","bg1","colors","background","primary","bg2","secondary","bg3","action","hover","dashboardBg","canvas","bgBlue1","main","bgBlue2","shade","borders","border1","weak","border2","medium","border3","strong","textColors","textStrong","text","maxContrast","textHeading","textSemiWeak","textWeak","textFaint","disabled","textBlue","form","formLabel","formDescription","formInputBg","formInputBgDisabled","disabledBackground","formInputBorder","borderColor","formInputBorderHover","borderHover","formInputBorderActive","formInputBorderInvalid","formInputPlaceholderText","formInputText","formInputDisabledText","disabledText","formFocusOutline","formValidationMessageText","contrastText","formValidationMessageBg","mode","GrafanaThemeType","isDark","isLight","palette","brandPrimary","brandSuccess","success","brandWarning","warning","brandDanger","queryRed","queryGreen","queryPurple","queryOrange","online","warn","critical","bodyBg","panelBg","panelBorder","pageHeaderBg","pageHeaderBorder","dropdownBg","dropdownShadow","dropdownOptionHoverBg","linkDisabled","linkHover","linkExternal","shadows","listItem","visualization","gray98","gray97","gray95","gray90","gray85","gray70","gray60","gray33","gray25","gray15","gray10","gray05","blue95","blue85","blue80","blue77","red88","createTheme","colorsInput","spacingInput","shapeInput","typographyInput","createColors","createBreakpoints","createSpacing","createShape","createTypography","createShadows","transitions","createTransitions","boxShadow","dropdown","tooltip","dashboard","overlay","sidemenu","createComponents","createVisualizationColors","v1","darkLayer0","darkLayer1","darkLayer2","darkBorder1","darkBorder2","gray100","gray80","lightBorder1","blueDarkMain","blueDarkText","redDarkMain","redDarkText","greenDarkMain","greenDarkText","orangeDarkMain","orangeDarkText","blueLightMain","blueLightText","redLightMain","redLightText","greenLightMain","greenLightText","orangeLightMain","orangeLightText","ReducerID","reduceField","reducers","calcs","missing","s","hasOwnProperty","queue","fieldReducers","list","reducer","id","emptyInputResult","nullValueMode","ignoreNulls","NullValueMode","nullAsZero","doStandardCalcs","lastNotNull","description","standard","aliasIds","calculateLastNotNull","last","calculateLast","first","calculateFirst","firstNotNull","calculateFirstNotNull","min","max","mean","sum","count","range","delta","step","diff","logmin","allIsZero","allIsNull","changeCount","calculateChangeCount","distinctCount","calculateDistinctCount","diffperc","allValues","toArray","Number","MAX_VALUE","nonNullCount","previousDeltaUp","data","isNumberField","currentValue","isFirst","idx","v","distinct","fieldTypeMatcher","FieldMatcherID","defaultOptions","getOptionsDisplayText","numericMatcher","timeMatcher","getFieldTypeMatchers","MatcherID","FrameMatcherID","ValueMatcherID","anyFieldMatcher","excludeFromPicker","children","option","getFieldMatcher","child","sub","matcher","fieldMatchers","anyFrameMatcher","getFrameMatchers","frameMatchers","allFieldsMatcher","allFramesMatcher","notFieldMatcher","check","notFrameMatcher","alwaysFieldMatcher","alwaysFrameMatcher","neverFieldMatcher","notTimeFieldMatcher","neverFrameMatcher","alwaysFieldMatcherInfo","alwaysFrameMatcherInfo","neverFieldMatcherInfo","neverFrameMatcherInfo","getFieldPredicateMatchers","getFramePredicateMatchers","refIdMacher","pattern","regex","stringToJsRegex","getRefIdMatchers","firstFieldMatcher","firstTimeFieldMatcher","find","getSimpleFieldMatchers","isEqualValueMatcher","valueIndex","isApplicable","getDefaultOptions","isNotEqualValueMatcher","getEqualValueMatchers","isNullValueMatcher","isNotNullValueMatcher","getNullValueMatchers","isGreaterValueMatcher","isNaN","isGreaterOrEqualValueMatcher","isLowerValueMatcher","isLowerOrEqualValueMatcher","getNumericValueMatchers","isBetweenValueMatcher","from","to","getRangeValueMatchers","regexValueMatcher","RegExp","getRegexValueMatcher","ensureColumnsTransformer","DataTransformerID","operator","source","pipe","transformer","timeFieldName","timeField","getTimeField","findConsistentTimeFieldName","seriesToColumnsTransformer","byField","filterFieldsTransformer","include","exclude","processed","series","copy","noopTransformer","filterFramesTransformer","filterFieldsByNameTransformer","getMatcherConfig","names","Array","isArray","filterFramesByRefIdTransformer","filterOptions","getJoinMatcher","joinBy","common","includes","pickBestJoinField","outerJoinDataFrames","frameCopy","joinFieldMatcher","joinIndex","findIndex","keepOriginIndices","fieldIndex","origin","frameIndex","joinField","unshift","enforceSort","isLikelyAscendingVector","sortDataFrame","keep","fieldIdx","nullModes","allData","originalFields","nullModesFrame","NULL_REMOVE","spanNulls","custom","NULL_RETAIN","NULL_EXPAND","joined","ArrayVector","nullExpand","yVals","nullIdxs","alignedLen","xi","lastNullIdx","nullIdx","tables","xVals","ti","len","sort","xIdxs","Map","set","t","si","ys","fill","nullMode","yVal","alignedIdx","mergeTransformer","dataFrames","fieldNames","fieldIndexByName","fieldNamesForKey","dataFrame","MutableDataFrame","addField","copyFieldStructure","fieldExistsInAllFrames","valuesByKey","valuesInOrder","keyFactory","createKeyFactory","valueMapper","createValueMapper","key","createPointer","valueWasMerged","existing","isMergable","pointer","omit","fieldPointerByName","keyFieldNames","factoryIndex","fieldName","fieldByName","fieldIndexByFrameIndex","mergable","prop","organizeFieldsTransformer","excludeByName","indexByName","renameByName","mapToExcludeArray","orderFieldsTransformer","renameFieldsTransformer","renamer","createRenamer","renameTo","seriesToRowsTransformer","isTimeSeries","timeFieldByIndex","targetFields","metricField","TIME_SERIES_METRIC_FIELD_NAME","timeFieldIndex","valueFieldIndex","sortByTransformer","attachFieldIndex","desc","sortDataFrames","LoadingState","FieldColorModeId","FALLBACK_COLOR","ThresholdsMode","MappingType","SpecialValueMatch","init","initialized","getIfExists","initialize","byId","ext","register","selectOptions","current","select","currentOptions","ordered","label","PluginState","ids","found","isEmpty","alias","anyToNumber","NaN","toNumber","BinaryOperationID","binaryOperators","Add","operation","Subtract","Multiply","Divide","makeFieldParser","guessFieldTypeFromValue","parseFloat","makeClassES5Compatible","ES6Class","Proxy","apply","target","self","argumentsList","Reflect","construct","alert","toPercent","decimals","toFixed","suffix","toPercentUnit","toHex0x","asHex","toHex","substring","toString","toUpperCase","sci","toExponential","getCategories","formats","fn","toFixedUnit","stringFormater","scaledUnits","locale","SIPrefix","currency","binaryPrefix","dateTimeAsIso","dateTimeAsIsoNoDateIfToday","dateTimeAsUS","dateTimeAsUSNoDateIfToday","getDateTimeAsLocalFormat","getDateTimeAsLocalFormatNoDateIfToday","dateTimeSystemFormatter","dateTimeFromNow","toNanoSeconds","toMicroSeconds","toMilliSeconds","toSeconds","toMinutes","toHours","toDays","toDurationInMilliseconds","toDurationInSeconds","toDurationInHoursMinutesSeconds","toDurationInDaysHoursMinutesSeconds","toTimeTicks","toClockMilliseconds","toClockSeconds","simpleCountUnit","booleanValueFormatter","Interval","UNITS","Year","Month","Week","Day","Hour","Minute","Second","Millisecond","INTERVALS_IN_SECONDS","Math","abs","toFixedScaled","scaledDecimals","toDuration","timeScale","strings","decrementDecimals","decimalsCount","interval","floor","unit","toClock","toUtc","hours","duration","asHours","slice","numHours","numMinutes","numSeconds","dayString","numDays","toDateTimeValueFormatter","todayPattern","isSame","dateTimeFormat","localTimeFormat","year","month","day","hour","minute","second","showMs","dateTimeFormatTimeAgo","symbol","asSuffix","scaler","scaled","prefix","getOffsetFromSIPrefix","c","offset","units","p","prefixes","FunctionalVector","buffer","toJSON","AsNumberVector","BinaryOperationVector","left","right","vectorToArray","ConstantVector","RowVector","columns","rowIndex","SortedVector","order","arr","toDataQueryError","err","message","status","statusText","CentrifugeLiveChannel","addr","Date","now","Subject","stream","observers","disconnect","currentStatus","LiveChannelEventType","timestamp","opened","LiveChannelConnectionState","isValidLiveChannelAddress","initalize","initalized","events","publish","ctx","schema","lastMessageWithSchema","next","sendStatus","log","subscribe","unsubscribe","user","info","leave","getStream","Observable","subscriber","setTimeout","disconnectIfNoListeners","subscription","presence","then","users","Promise","reject","removeAllListeners","complete","shutdownCallback","shutdownWithError","CentrifugeService","deps","context","connectionState","dataStreamSubscriberReadiness","dataStreamSubscriberReady","liveUrl","appUrl","centrifuge","Centrifuge","setConnectData","sessionId","orgId","liveEnabled","orgRole","connect","BehaviorSubject","isConnected","connectionBlocker","resolve","connectListener","removeListener","addListener","on","onConnect","onDisconnect","onServerSideMessage","getChannel","scope","namespace","path","channel","open","delete","initChannel","catch","getConnectionState","asObservable","address","getDataStream","streamCounter","filtered","lastWidth","msg","StreamingDataFrame","sameWidth","toDataFrameDTO","dataFrameToJSON","evt","isLiveChannelMessageEvent","isLiveChannelStatusEvent","getPresence","subscriberTransferHandler","canHandle","Subscriber","serialize","obj","comlink","port1","port2","MessageChannel","deserialize","start"],"sourceRoot":""}