{"version":3,"sources":["jsdelivr-header.js","/npm/@google-web-components/google-chart@5.1.0/google-chart.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;iXCWQ,KAAM,IAAK,eAAiB,aAC5B,aAAe,2BAEf,mBAAoB,cAA+B,cAE3D,MAAM,eAAiB,CAAC,QAAS,UAQ3B,YAAgD,CACpD,KAAQ,YACR,IAAO,WACP,SAAU,oBACV,OAAU,cACV,SAAY,WACZ,YAAe,mBACf,OAAU,cACV,MAAS,aACT,MAAS,QACT,MAAS,QACT,IAAO,WACP,UAAa,YACb,KAAQ,YACR,UAAW,qBACX,IAAO,WACP,IAAO,WACP,OAAU,SACV,QAAW,eACX,aAAc,wBACd,eAAgB,mBAChB,MAAS,QACT,SAAY,WACZ,QAAW,UACX,SAAY,mBAkER,MAAO,oBAAoB,WAAjC,WAAA,G,oBA6EE,KAAA,KAAO,SAcP,KAAA,OAAmB,GA6BnB,KAAA,aAAwB,EAgBxB,KAAA,UAA4B,EAgB5B,KAAA,UAA8B,EAyB9B,KAAA,UAAuC,EAavC,KAAA,UAAgD,EAkBhD,KAAA,eAA6D,EAM7D,KAAA,OAAQ,EAMkB,KAAA,WACoB,EAKtC,KAAA,aAAuD,KAEvD,KAAA,qBAAoC,CA6M9C,CA3MqB,MAAA,GACjB,OAAO,IAAI;;;KAIb,CAEmB,YAAA,GACjB,mBAAmB,KAAK,WAAY,eAAe,aAC9C,MAAK,IACJ,KAAK,aAAe,EACpB,KAAK,cACL,OAAO,cAAc,OAAO,YAAY,EAAc,SAAS,KAC7D,KAAK,OAAQ,EACT,KAAK,WACP,KAAK,kBACP,IAEF,OAAO,cAAc,OAAO,YACxB,EAAc,UAAU,KACtB,KAAK,UAAY,EAAa,WAAY,cAAc,IAE9D,KAAK,gBAAgB,eAAgB,EAAa,GAE1D,CAEmB,OAAA,CAAQ,GACrB,EAAkB,IAAI,SAAS,KAAK,eACpC,EAAkB,IAAI,SAAW,EAAk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AAC,KAAM,S,qCAiBjB,WAAA,CADC,SAAS,CAAC,KAAM,S,qCA0BjB,WAAA,CADC,SAAS,CAAC,KAAM,U,qCAcjB,WAAA,CADC,SAAS,CAAC,KAAM,U,qCAmBjB,WAAA,CADC,SAAS,CAAC,KAAM,S,0CAaS,WAAA,CAAzB,SAAS,CAAC,KAAM,U,sCAuNnB,eAAe,OAAO,eAAgB","file":"/npm/@google-web-components/google-chart@5.1.0/google-chart.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@google-web-components/google-chart@5.1.0/google-chart.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * @license\n * Copyright 2014-2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {html, css, LitElement} from 'lit';\nimport {property} from 'lit/decorators.js';\n\nimport {createChartWrapper, dataTable, DataTableLike} from './loader.js';\n\nconst DEFAULT_EVENTS = ['ready', 'select'];\n\n/**\n * Constructor names for supported chart types.\n *\n * `ChartWrapper` expects a constructor name and assumes `google.visualization`\n *  as the default namespace.\n */\nconst CHART_TYPES: Record<string, string|undefined> = {\n  'area': 'AreaChart',\n  'bar': 'BarChart',\n  'md-bar': 'google.charts.Bar',\n  'bubble': 'BubbleChart',\n  'calendar': 'Calendar',\n  'candlestick': 'CandlestickChart',\n  'column': 'ColumnChart',\n  'combo': 'ComboChart',\n  'gantt': 'Gantt',\n  'gauge': 'Gauge',\n  'geo': 'GeoChart',\n  'histogram': 'Histogram',\n  'line': 'LineChart',\n  'md-line': 'google.charts.Line',\n  'org': 'OrgChart',\n  'pie': 'PieChart',\n  'sankey': 'Sankey',\n  'scatter': 'ScatterChart',\n  'md-scatter': 'google.charts.Scatter',\n  'stepped-area': 'SteppedAreaChart',\n  'table': 'Table',\n  'timeline': 'Timeline',\n  'treemap': 'TreeMap',\n  'wordtree': 'WordTree',\n};\n\n/**\n * `google-chart` encapsulates Google Charts as a web component, allowing you to\n * easily visualize data. From simple line charts to complex hierarchical tree\n * maps, the chart element provides a number of ready-to-use chart types.\n *\n * ```html\n * <google-chart\n *     type='pie'\n *     options='{\"title\": \"Distribution of days in 2001Q1\"}'\n *     cols='[{\"label\":\"Month\", \"type\":\"string\"}, {\"label\":\"Days\",\n *         \"type\":\"number\"}]' rows='[[\"Jan\", 31],[\"Feb\", 28],[\"Mar\", 31]]'>\n *   </google-chart>\n * ```\n *\n * Note: if you're passing JSON as attributes, single quotes are necessary to be\n * valid JSON. See\n * https://www.polymer-project.org/1.0/docs/devguide/properties#configuring-object-and-array-properties.\n *\n * Height and width are specified as style attributes:\n * ```css\n * google-chart {\n *   height: 300px;\n *   width: 50em;\n * }\n * ```\n *\n * Data can be provided in one of three ways:\n *\n * - Via the `cols` and `rows` attributes:\n *   ```\n *   cols='[{\"label\":\"Mth\", \"type\":\"string\"},{\"label\":\"Days\", \"type\":\"number\"}]'\n *   rows='[[\"Jan\", 31],[\"Feb\", 28],[\"Mar\", 31]]'\n *   ```\n *\n * - Via the `data` attribute, passing in the data directly:\n *   ```\n *   data='[[\"Month\", \"Days\"], [\"Jan\", 31], [\"Feb\", 28], [\"Mar\", 31]]'\n *   ```\n *\n * - Via the `data` attribute, passing in the URL to a resource containing the\n *   data, in JSON format:\n *   ```\n *   data='http://example.com/chart-data.json'\n *   ```\n *\n * - Via the `data` attribute, passing in a Google DataTable object:\n *   ```\n *   data='{{dataTable}}'\n *   ```\n *\n * - Via the `view` attribute, passing in a Google DataView object:\n *   ```\n *   view='{{dataView}}'\n *   ```\n *\n * You can display the charts in locales other than \"en\" by setting the `lang`\n * attribute on the `html` tag of your document:\n * ```\n * <html lang=\"ja\">\n * ```\n *\n * @demo demo/index.html\n */\nexport class GoogleChart extends LitElement {\n  /** @nocollapse */\n  static override styles = css`\n    :host {\n      display: -webkit-flex;\n      display: -ms-flex;\n      display: flex;\n      margin: 0;\n      padding: 0;\n      width: 400px;\n      height: 300px;\n    }\n\n    :host([hidden]) {\n      display: none;\n    }\n\n    :host([type=\"gauge\"]) {\n      width: 300px;\n      height: 300px;\n    }\n\n    #chartdiv {\n      width: 100%;\n    }\n\n    /* Workaround for slow initial ready event for tables. */\n    .google-visualization-table-loadtest {\n      padding-left: 6px;\n    }\n  `;\n\n  /**\n   * Fired after a chart type is rendered and ready for interaction.\n   *\n   * @event google-chart-ready\n   * @param {{chart: !Object}} detail The raw chart object.\n   */\n\n  /**\n   * Fired when the user makes a selection in the chart.\n   *\n   * @event google-chart-select\n   * @param {{chart: !Object}} detail The raw chart object.\n   */\n\n  /**\n   * Type of the chart.\n   *\n   * Should be one of:\n   * - `area`\n   * - `(md-)bar`\n   * - `bubble`\n   * - `calendar`\n   * - `candlestick`\n   * - `column`\n   * - `combo`\n   * - `gantt`\n   * - `gauge`\n   * - `geo`\n   * - `histogram`\n   * - `(md-)line`\n   * - `org`\n   * - `pie`\n   * - `sankey`\n   * - `(md-)scatter`\n   * - `stepped-area`\n   * - `table`\n   * - `timeline`\n   * - `treemap`\n   * - `wordtree`\n   *\n   * See <a\n   * href=\"https://google-developers.appspot.com/chart/interactive/docs/gallery\">Google\n   * Visualization API reference (Chart Gallery)</a> for details.\n   */\n  @property({type: String, reflect: true})\n  type = 'column';\n\n  /**\n   * Enumerates the chart events that should be fired.\n   *\n   * Charts support a variety of events. By default, this element only\n   * fires on `ready` and `select`. If you would like to be notified of\n   * other chart events, use this property to list them.\n   * Events `ready` and `select` are always fired.\n   *\n   * Changes to this property are _not_ observed. Events are attached only\n   * at chart construction time.\n   */\n  @property({type: Array})\n  events: string[] = [];\n\n  /**\n   * Sets the options for the chart.\n   *\n   * Example:\n   * ```\n   * {\n   *   title: \"Chart title goes here\",\n   *   hAxis: {title: \"Categories\"},\n   *   vAxis: {title: \"Values\", minValue: 0, maxValue: 2},\n   *   legend: \"none\"\n   * }\n   * ```\n   * See <a\n   * href=\"https://google-developers.appspot.com/chart/interactive/docs/gallery\">Google\n   * Visualization API reference (Chart Gallery)</a> for the options available\n   * to each chart type.\n   *\n   * Setting this property always redraws the chart. If you would like to make\n   * changes to a sub-property, be sure to reassign the property:\n   * ```\n   * const options = googleChart.options;\n   * options.vAxis.logScale = true;\n   * googleChart.options = options;\n   * ```\n   * (Note: Missing parent properties are not automatically created.)\n   */\n  @property({type: Object, hasChanged: () => true})\n  options: {}|undefined = undefined;\n\n  /**\n   * Sets the data columns for this object.\n   *\n   * When specifying data with `cols` you must also specify `rows`, and\n   * not specify `data`.\n   *\n   * Example:\n   * <pre>[{label: \"Categories\", type: \"string\"},\n   *  {label: \"Value\", type: \"number\"}]</pre>\n   * See <a\n   * href=\"https://google-developers.appspot.com/chart/interactive/docs/reference#DataTable_addColumn\">Google\n   * Visualization API reference (addColumn)</a> for column definition format.\n   */\n  @property({type: Array})\n  cols: unknown[]|undefined = undefined;\n\n  /**\n   * Sets the data rows for this object.\n   *\n   * When specifying data with `rows` you must also specify `cols`, and\n   * not specify `data`.\n   *\n   * Example:\n   * <pre>[[\"Category 1\", 1.0],\n   *  [\"Category 2\", 1.1]]</pre>\n   * See <a\n   * href=\"https://google-developers.appspot.com/chart/interactive/docs/reference#addrow\">Google\n   * Visualization API reference (addRow)</a> for row format.\n   */\n  @property({type: Array})\n  rows: unknown[][]|undefined = undefined;\n\n  /**\n   * Sets the entire dataset for this object.\n   * Can be used to provide the data directly, or to provide a URL from\n   * which to request the data.\n   *\n   * The data format can be a two-dimensional array or the DataTable format\n   * expected by Google Charts.\n   * See <a\n   * href=\"https://google-developers.appspot.com/chart/interactive/docs/reference#DataTable\">Google\n   * Visualization API reference (DataTable constructor)</a> for data table\n   * format details.\n   *\n   * When specifying data with `data` you must not specify `cols` or `rows`.\n   *\n   * Example:\n   * ```\n   * [[\"Categories\", \"Value\"],\n   *  [\"Category 1\", 1.0],\n   *  [\"Category 2\", 1.1]]\n   * ```\n   */\n  // Note: type: String, because it is parsed manually in the observer.\n  @property({type: String})\n  data: DataTableLike|string|undefined = undefined;\n\n  /**\n   * Sets the entire dataset for this object to a Google DataView.\n   *\n   * See <a\n   * href=\"https://google-developers.appspot.com/chart/interactive/docs/reference#dataview-class\">Google\n   * Visualization API reference (DataView)</a> for details.\n   *\n   * When specifying data with `view` you must not specify `data`, `cols` or\n   * `rows`.\n   */\n  @property({type: Object})\n  view: google.visualization.DataView|undefined = undefined;\n\n  /**\n   * Selected datapoint(s) in the chart.\n   *\n   * An array of objects, each with a numeric row and/or column property.\n   * `row` and `column` are the zero-based row or column number of an item\n   * in the data table to select.\n   *\n   * To select a whole column, set row to null;\n   * to select a whole row, set column to null.\n   *\n   * Example:\n   * ```\n   * [{row:0,column:1}, {row:1, column:null}]\n   * ```\n   */\n  @property({type: Array})\n  selection: google.visualization.ChartSelection[]|undefined = undefined;\n\n  /**\n   * Whether the chart is currently rendered.\n   * @export\n   */\n  drawn = false;\n\n  /**\n   * Internal data displayed on the chart.\n   */\n  // tslint:disable-next-line:enforce-name-casing\n  @property({type: Object}) _data: google.visualization.DataTable|\n      google.visualization.DataView|undefined = undefined;\n\n  /**\n   * Internal chart object.\n   */\n  private chartWrapper: google.visualization.ChartWrapper|null = null;\n\n  private redrawTimeoutId: number|undefined = undefined;\n\n  protected override render() {\n    return html`\n      <div id=\"styles\"></div>\n      <div id=\"chartdiv\"></div>\n    `;\n  }\n\n  protected override firstUpdated() {\n    createChartWrapper(this.shadowRoot!.getElementById('chartdiv')!)\n        .then(chartWrapper => {\n          this.chartWrapper = chartWrapper;\n          this.typeChanged();\n          google.visualization.events.addListener(chartWrapper, 'ready', () => {\n            this.drawn = true;\n            if (this.selection) {\n              this.selectionChanged();\n            }\n          });\n          google.visualization.events.addListener(\n              chartWrapper, 'select', () => {\n                this.selection = chartWrapper.getChart()!.getSelection();\n              });\n          this.propagateEvents(DEFAULT_EVENTS, chartWrapper);\n        });\n  }\n\n  protected override updated(changedProperties: Map<string, unknown>) {\n    if (changedProperties.has('type')) this.typeChanged();\n    if (changedProperties.has('rows') || changedProperties.has('cols')) {\n      this.rowsOrColumnsChanged();\n    }\n    if (changedProperties.has('data')) this.dataChanged();\n    if (changedProperties.has('view')) this.viewChanged();\n    if (changedProperties.has('_data') ||\n        changedProperties.has('options')) this.redraw();\n    if (changedProperties.has('selection')) this.selectionChanged();\n  }\n\n  /** Reacts to chart type change. */\n  private typeChanged() {\n    if (this.chartWrapper == null) return;\n    this.chartWrapper.setChartType(CHART_TYPES[this.type] || this.type);\n    const lastChart = this.chartWrapper.getChart();\n    google.visualization.events.addOneTimeListener(\n        this.chartWrapper, 'ready', () => {\n          // Ready event fires after `chartWrapper` is initialized.\n          const chart = this.chartWrapper!.getChart();\n          if (chart !== lastChart) {\n            this.propagateEvents(\n                this.events.filter(\n                    (eventName) => !DEFAULT_EVENTS.includes(eventName)),\n                chart);\n          }\n          const stylesDiv = this.shadowRoot!.getElementById('styles')!;\n          if (!stylesDiv.children.length) {\n            this.localizeGlobalStylesheets(stylesDiv);\n          }\n        });\n    this.redraw();\n  }\n\n  /**\n   * Adds listeners to propagate events from the chart.\n   */\n  private propagateEvents(events: string[], eventTarget: unknown) {\n    for (const eventName of events) {\n      google.visualization.events.addListener(\n          eventTarget, eventName, (event: unknown) => {\n            this.dispatchEvent(new CustomEvent(`google-chart-${eventName}`, {\n              bubbles: true,\n              composed: true,\n              detail: {\n                // Events fire after `chartWrapper` is initialized.\n                chart: this.chartWrapper!.getChart(),\n                data: event,\n              }\n            }));\n          });\n    }\n  }\n\n  /** Sets the selectiton on the chart. */\n  private selectionChanged() {\n    if (this.chartWrapper == null) return;\n    const chart = this.chartWrapper.getChart();\n    if (chart == null) return;\n    if (chart.setSelection) {\n      // Workaround for timeline chart which emits select event on setSelection.\n      // See issue #256.\n      if (this.type === 'timeline') {\n        const oldSelection = JSON.stringify(chart.getSelection());\n        const newSelection = JSON.stringify(this.selection);\n        if (newSelection === oldSelection) return;\n      }\n      chart.setSelection(this.selection);\n    }\n  }\n\n  /**\n   * Redraws the chart.\n   *\n   * Called automatically when data/type/selection attributes change.\n   * Call manually to handle view updates, page resizes, etc.\n   */\n  redraw() {\n    if (this.chartWrapper == null || this._data == null) return;\n    // `ChartWrapper` can be initialized with `DataView` instead of `DataTable`.\n    this.chartWrapper.setDataTable(\n        this._data as google.visualization.DataTable);\n    this.chartWrapper.setOptions(this.options || {});\n\n    this.drawn = false;\n    if (this.redrawTimeoutId !== undefined) clearTimeout(this.redrawTimeoutId);\n    this.redrawTimeoutId = window.setTimeout(() => {\n      // Drawing happens after `chartWrapper` is initialized.\n      this.chartWrapper!.draw();\n    }, 5);\n  }\n\n  /**\n   * Returns the chart serialized as an image URI.\n   *\n   * Call this after the chart is drawn (`google-chart-ready` event).\n   */\n  get imageURI(): string|null {\n    if (this.chartWrapper == null) return null;\n    const chart = this.chartWrapper.getChart();\n    return chart && (chart as google.visualization.ChartBaseRenderable).getImageURI();\n  }\n\n  /** Handles changes to the `view` attribute. */\n  private viewChanged() {\n    if (!this.view) return;\n    this._data = this.view;\n  }\n\n  /** Handles changes to the rows & columns attributes. */\n  private async rowsOrColumnsChanged() {\n    const {rows, cols} = this;\n    if (!rows || !cols) return;\n    try {\n      const dt = await dataTable({cols});\n      dt.addRows(rows);\n      this._data = dt;\n    } catch (reason) {\n      this.shadowRoot!.getElementById('chartdiv')!.textContent = String(reason);\n    }\n  }\n\n  /**\n   * Handles changes to the `data` attribute.\n   */\n  private dataChanged() {\n    let data = this.data;\n    let dataPromise;\n    if (!data) {\n      return;\n    }\n\n    let isString = false;\n\n    // Polymer 2 will not call observer if type:Object is set and fails, so\n    // we must parse the string ourselves.\n    try {\n      // Try to deserialize the value of the `data` property which might be a\n      // serialized array.\n      data = JSON.parse(data as string) as DataTableLike;\n    } catch (e) {\n      isString = typeof data === 'string' || data instanceof String;\n    }\n\n    if (isString) {\n      // Load data asynchronously, from external URL.\n      dataPromise = fetch(data as string).then(response => response.json());\n    } else {\n      // Data is all ready to be processed.\n      dataPromise = Promise.resolve(data);\n    }\n    dataPromise.then(dataTable).then(data => {\n      this._data = data;\n    });\n  }\n\n  /**\n   * Queries global document head for Google Charts `link#load-css-*` and clones\n   * them into the local root's `div#styles` element for shadow dom support.\n   */\n  private localizeGlobalStylesheets(stylesDiv: HTMLElement) {\n    // Get all Google Charts stylesheets.\n    const stylesheets = Array.from(document.head.querySelectorAll(\n        'link[rel=\"stylesheet\"][type=\"text/css\"][id^=\"load-css-\"]'));\n\n    for (const stylesheet of stylesheets) {\n      // Clone necessary stylesheet attributes.\n      const clonedStylesheet = document.createElement('link');\n      clonedStylesheet.setAttribute('rel', 'stylesheet');\n      clonedStylesheet.setAttribute('type', 'text/css');\n      // `href` is always present.\n      clonedStylesheet.setAttribute('href', stylesheet.getAttribute('href')!);\n\n      stylesDiv.appendChild(clonedStylesheet);\n    }\n  }\n}\n\ncustomElements.define('google-chart', GoogleChart);\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    'google-chart': GoogleChart;\n  }\n}\n"]}