/*!
 * Copyright © 2018 Splunk Inc.
 * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
 * in part without a valid written license from Splunk Inc. is PROHIBITED.
 */
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 65);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, exports) {

module.exports = require("prop-types");

/***/ }),

/***/ 1:
/***/ (function(module, exports) {

module.exports = require("react");

/***/ }),

/***/ 10:
/***/ (function(module, exports) {

module.exports = require("@splunk/visualization-color-palettes");

/***/ }),

/***/ 11:
/***/ (function(module, exports) {

module.exports = require("@splunk/charting-bundle");

/***/ }),

/***/ 12:
/***/ (function(module, exports) {

module.exports = require("@splunk/visualizations-shared/propUtils");

/***/ }),

/***/ 13:
/***/ (function(module, exports) {

module.exports = require("@splunk/react-visualizations/common/Charting");

/***/ }),

/***/ 18:
/***/ (function(module, exports) {

module.exports = require("lodash/isEmpty");

/***/ }),

/***/ 3:
/***/ (function(module, exports) {

module.exports = require("@splunk/visualizations-shared/SanitizeProps");

/***/ }),

/***/ 4:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/extends");

/***/ }),

/***/ 6:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/defineProperty");

/***/ }),

/***/ 65:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _splunk_react_visualizations_common_Charting__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13);
/* harmony import */ var _splunk_react_visualizations_common_Charting__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_splunk_react_visualizations_common_Charting__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11);
/* harmony import */ var _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8);
/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(18);
/* harmony import */ var lodash_isEmpty__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash_isEmpty__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(12);
/* harmony import */ var _splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _splunk_visualizations_shared_SanitizeProps__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3);
/* harmony import */ var _splunk_visualizations_shared_SanitizeProps__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_SanitizeProps__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var _splunk_visualization_color_palettes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(10);
/* harmony import */ var _splunk_visualization_color_palettes__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualization_color_palettes__WEBPACK_IMPORTED_MODULE_10__);



function ownKeys(object, enumerableOnly) {
  var keys = Object.keys(object);

  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    if (enumerableOnly) symbols = symbols.filter(function (sym) {
      return Object.getOwnPropertyDescriptor(object, sym).enumerable;
    });
    keys.push.apply(keys, symbols);
  }

  return keys;
}

function _objectSpread(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};

    if (i % 2) {
      ownKeys(Object(source), true).forEach(function (key) {
        _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
      ownKeys(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }
  }

  return target;
}











var Pie = function Pie(_ref) {
  var props = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({}, _ref);

  var width = props.width,
      height = props.height,
      style = props.style,
      themeKey = props.themeKey,
      pieLabels = props.pieLabels,
      pieValues = props.pieValues,
      labelTitle = props.labelTitle,
      valueTitle = props.valueTitle,
      onPointClick = props.onPointClick,
      colorPalette = props.colorPalette;

  var chartOptions = _objectSpread(_objectSpread({}, lodash_omit__WEBPACK_IMPORTED_MODULE_6___default()(props, ['width', 'height', 'onEventTrigger', 'style', 'pieLabels', 'pieValues', 'labelTitle', 'valueTitle', 'colorPalette', 'innerSize', 'legendPlacement', 'legendLabelOverflowMode', 'onPointClick', 'showLabels', 'showLegend', 'showPercent', 'sliceCollapsingLabel', 'sliceCollapsingThreshold'])), {}, {
    chart: 'pie',
    'chart.showLabels': props.showLabels,
    'chart.showPercent': props.showPercent,
    'chart.showLegend': props.showLegend,
    'legend.placement': props.legendPlacement,
    'legend.labelStyle.overflowMode': props.legendLabelOverflowMode,
    'chart.pieInnerSize': props.innerSize,
    'chart.sliceCollapsingThreshold': props.sliceCollapsingThreshold,
    'chart.sliceCollapsingLabel': props.sliceCollapsingLabel
  }); // splunk charting expects certain options like 'seriesColors', 'fieldColors' etc to be a string


  var convertedChartOptions = Object(_splunk_visualizations_shared_propUtils__WEBPACK_IMPORTED_MODULE_8__["convertPropsToString"])({
    vizProps: chartOptions,
    propNames: ['seriesColors', 'fieldColors']
  }); // copy convertedChartOptions into chartOptions

  Object.assign(chartOptions, convertedChartOptions);
  var primaryDataSet = {};
  primaryDataSet.fields = [{
    name: labelTitle
  }, {
    name: valueTitle
  }];
  primaryDataSet.columns = [pieLabels, pieValues];
  var chartData = !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_7___default()(primaryDataSet) ? _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_5___default.a.extractChartReadyData(primaryDataSet) : null;

  var onClick = function onClick(_ref2) {
    var type = _ref2.type,
        originalEvent = _ref2.originalEvent,
        payload = _ref2.payload;

    if (type === 'point.click') {
      onPointClick({
        payload: payload,
        originalEvent: originalEvent
      });
    }
  };

  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(_splunk_react_visualizations_common_Charting__WEBPACK_IMPORTED_MODULE_4___default.a, {
    width: width,
    height: height,
    style: style,
    themeKey: themeKey,
    chartData: chartData,
    options: chartOptions,
    onEventTrigger: onPointClick,
    onClick: onClick,
    colorPalette: colorPalette
  });
};

Pie.propTypes = {
  width: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.number]),
  height: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.number]),
  onPointClick: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.func,
  style: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object,
  themeKey: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string,
  pieLabels: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string),
  pieValues: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string),
  showLabels: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.bool,
  showPercent: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.bool,
  showLegend: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.bool,
  legendPlacement: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.oneOf(['right', 'left', 'top', 'bottom', 'none']),
  legendLabelOverflowMode: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.oneOf(['ellipsisEnd', 'ellipsisMiddle', 'ellipsisStart', 'ellipsisNone']),
  innerSize: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.number,
  sliceCollapsingLabel: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string,
  sliceCollapsingThreshold: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.number,
  backgroundColor: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string,
  foregroundColor: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string,
  seriesColors: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string)]),
  fieldColors: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object]),
  fontColor: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string,
  labelTitle: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string,
  valueTitle: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string,
  colorPalette: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.array
};
Pie.defaultProps = {
  height: 250,
  width: '100%',
  style: {},
  themeKey: 'prismaDark',
  showLabels: true,
  showPercent: false,
  showLegend: false,
  legendPlacement: 'right',
  legendLabelOverflowMode: 'ellipsisMiddle',
  innerSize: 0,
  sliceCollapsingLabel: 'other',
  sliceCollapsingThreshold: 0.01,
  labelTitle: 'component',
  valueTitle: 'count',
  onPointClick: function onPointClick() {},
  colorPalette: _splunk_visualization_color_palettes__WEBPACK_IMPORTED_MODULE_10__["CATEGORICAL"]
};
/* harmony default export */ __webpack_exports__["default"] = (Object(_splunk_visualizations_shared_SanitizeProps__WEBPACK_IMPORTED_MODULE_9__["withSanitizedProps"])(Pie));

/***/ }),

/***/ 8:
/***/ (function(module, exports) {

module.exports = require("lodash/omit");

/***/ })

/******/ });
//# sourceMappingURL=Pie.js.map