@splunk/visualization-context 25.1.0 → 25.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/IconRegistry.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 23);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 24);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -133,19 +133,19 @@ module.exports = require("@babel/runtime/helpers/getPrototypeOf");
133
133
  module.exports = require("@splunk/visualization-context/Provider");
134
134
 
135
135
  /***/ }),
136
- /* 7 */
136
+ /* 7 */,
137
+ /* 8 */
137
138
  /***/ (function(module, exports) {
138
139
 
139
140
  module.exports = require("@babel/runtime/helpers/inherits");
140
141
 
141
142
  /***/ }),
142
- /* 8 */
143
+ /* 9 */
143
144
  /***/ (function(module, exports) {
144
145
 
145
146
  module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
146
147
 
147
148
  /***/ }),
148
- /* 9 */,
149
149
  /* 10 */
150
150
  /***/ (function(module, exports) {
151
151
 
@@ -540,7 +540,8 @@ module.exports = require("@babel/runtime/helpers/get");
540
540
  /* 20 */,
541
541
  /* 21 */,
542
542
  /* 22 */,
543
- /* 23 */
543
+ /* 23 */,
544
+ /* 24 */
544
545
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
545
546
 
546
547
  "use strict";
@@ -551,9 +552,9 @@ __webpack_require__.r(__webpack_exports__);
551
552
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
552
553
  /* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13);
553
554
  /* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_2__);
554
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
555
+ /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8);
555
556
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
556
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
557
+ /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
557
558
  /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
558
559
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
559
560
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/BaseRegistry.js","webpack:///external \"@babel/runtime/helpers/get\"","webpack:///./src/IconRegistry.js"],"names":["BaseRegistry","provider","_","console","cachedProvider","providerType","type","isDefault","url","id","obj","options","offset","count","ids","IconRegistry","dataURI"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kD;;;;;;ACAA,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;;ACAA,kE;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AACA;AACA;AAEA;AACA;AACA;;IACMA,Y;AACF,0BAAc;AAAA;;AACV;AACA;AACH;;;;;AAMD;AACJ;AACA;AACA;AACA;AACI,uCAA0B;AACtB,UAAIC,QAAQ,YAAZ,+EAAkC;AAC9B;AACH;;AACD,YAAM,UAAUC,+DAAC,CAAjB,kBAAiB,CAAX,CAAN;AACH;AAED;AACJ;AACA;A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,CAARA,WAHtB,EAGsBA,CAHtB;;AAAA;AAGUS,mBAHV,iBAGUA;AAHV;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;AAOA;AACJ;AACA;AACA;AACA;AACA;;;;;yLACI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA4BC,uBAA5B,8DAAsC;AAAEC,wBAAM,EAAR;AAAaC,uBAAK,EAAE;AAApB,iBAAVF;AAClBV,wBADV,GACqB,kBADrB,YACqB,CAAXA;AADV;AAAA,uBAEsBA,QAAQ,CAARA,QAFtB,OAEsBA,CAFtB;;AAAA;AAEUa,mBAFV,iBAEUA;AAFV;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;WA/JA,kBAAgB;AACZ,aAAO,IAAP,YAAO,EAAP;AACH;;;;;;AAoKL,6E;;;;;;ACnLA,uD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AAEA;AACA;AACA;;IACMC,Y;;;;;;;;;;;;;;AAOF;AACJ;AACA;AACA;AACA;AACI,uCAA0B;AACtB,aAAO,YAAY,CAAZ,uBAAoC,gBAAI;AAAA,eAAIC,OAAO,CAAPA,iCAAmC,CAAvC;AAA/C,OAAO,CAAP;AACH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;;;;WACI,iDAAwC;AACpC,UAAI,CAAC,sBAAL,OAAK,CAAL,EAAqC;AACjC,cAAM,UAAUd,+DAAC,CAAjB,2EAAiB,CAAX,CAAN;AACH;;AAED;AACH;;;WA5BD,kBAAgB;AACZ,aAAO,IAAP,YAAO,EAAP;AACH;;;;EAHsBF,qD;;6EAArBe,Y,uBAKyB,O;;AA2B/B,6E","file":"IconRegistry.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 23);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\n/**\n * Base Registry\n */\nclass BaseRegistry {\n constructor() {\n this.cachedProviders = {};\n this.defaultProvider = null;\n }\n\n static create() {\n return new BaseRegistry();\n }\n\n /**\n * check whether user defined provider extends the base provider\n * @param {Provider} provider\n * @returns {Boolean}\n */\n isValidProvider(provider) {\n if (provider instanceof Provider) {\n return true;\n }\n throw new Error(_('Invalid Provider'));\n }\n\n /**\n * add default provider to cache\n * @param {Provider} provider\n */\n addDefaultProvider(provider) {\n if (this.isValidProvider(provider)) {\n this.addProvider(provider);\n this.defaultProvider = provider;\n }\n }\n\n /**\n * add provider to cache\n * @param {Provider} provider\n */\n addProvider(provider) {\n if (this.isValidProvider(provider)) {\n if (this.cachedProviders[provider.getType()]) {\n // eslint-disable-next-line\n console.warn(`The provider \"${provider.getType()}\" existed already.`);\n }\n this.cachedProviders[provider.getType()] = provider;\n }\n }\n\n /**\n * delete provider\n * @param {String} providerType\n */\n deleteProvider(providerType) {\n const cachedProvider = this.cachedProviders[providerType];\n if (!cachedProvider) {\n // eslint-disable-next-line\n console.warn(`The provider \"${providerType}\" does not existed`);\n return;\n }\n\n if (this.defaultProvider && providerType === this.defaultProvider.getType()) {\n this.defaultProvider = null;\n }\n delete this.cachedProviders[providerType];\n }\n\n /**\n * find provider from cache\n * @param {String} type\n * @returns {Provider} provider\n */\n findProvider(type) {\n const provider = this.cachedProviders[type];\n if (provider) {\n return provider;\n }\n throw new Error(_('Provider not found'));\n }\n\n /**\n * list all providers\n * @return {Object} provider = { type: 'local', isDefault: true }\n */\n listProviders() {\n return Object.keys(this.cachedProviders).map(type => ({\n type,\n isDefault: type === this.defaultProvider.getType(),\n }));\n }\n\n /**\n * check whether src is a http url or a url used for icon/image-registry (e.g. 'kvstore://image123')\n */\n isResourceURL(url) {\n if (!url || url.indexOf('://') < 0) {\n return false;\n }\n\n const { type } = this.parseURL(url);\n return type !== 'http' && type !== 'https';\n }\n\n /**\n * parse provider type and id from the url\n * @params {String} url 'kvstore://image123'\n * @returns {Object} obj\n * @returns {String} obj.type 'kvstore'\n * @returns {String} obj.id 'image123'\n */\n parseURL(url) {\n if (url) {\n const [type, id] = url.split('://');\n\n if (type && id) {\n return { type, id };\n }\n }\n throw new Error(_('Invalid url'));\n }\n\n /**\n * upload\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore' or 'sui' or 'local'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n async upload(dataURI, metaData, providerType) {\n if (providerType == null && this.defaultProvider == null) {\n throw new Error(_('No valid provider was found. Please add a provider'));\n }\n const provider = providerType ? this.findProvider(providerType) : this.defaultProvider;\n const id = await provider.upload(dataURI, metaData);\n return `${provider.getType()}://${id}`;\n }\n\n /**\n * get object by url\n * @param {String} url 'kvstore://image123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async getByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.getById(id);\n return obj;\n }\n\n /**\n * delete object by url\n * @param {String} url 'kvstore://image123' || 'sui://icon123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async deleteByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.deleteById(id);\n return obj;\n }\n\n /**\n * list all object ids\n * @params {String} providerType e.g. 'kvstore' or 'sui'\n * @params {Object} options\n * @returns {Array} ids\n */\n async listIds(providerType, options = { offset: 0, count: 100 }) {\n const provider = this.findProvider(providerType);\n const ids = await provider.listIds(options);\n return ids;\n }\n}\n\nexport default BaseRegistry;\n","module.exports = require(\"@babel/runtime/helpers/get\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport BaseRegistry from './BaseRegistry';\n\n/**\n * Icon Registry\n */\nclass IconRegistry extends BaseRegistry {\n static create() {\n return new IconRegistry();\n }\n\n static VALID_MEDIA_TYPES = ['svg'];\n\n /**\n * check if the the media type from the dataURI belongs to the supported types\n * @param {DataURI} dataURI\n * @returns {Boolean}\n */\n isValidMediaType(dataURI) {\n return IconRegistry.VALID_MEDIA_TYPES.some(type => dataURI.indexOf(`image/${type}`) > -1);\n }\n\n /**\n * upload image if the image format is supported\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore', or 'sui'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n upload(dataURI, metaData, providerType) {\n if (!this.isValidMediaType(dataURI)) {\n throw new Error(_('The format of the uploaded file is not supported. Please upload svg file.'));\n }\n\n return super.upload(dataURI, metaData, providerType);\n }\n}\n\nexport default IconRegistry;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/BaseRegistry.js","webpack:///external \"@babel/runtime/helpers/get\"","webpack:///./src/IconRegistry.js"],"names":["BaseRegistry","provider","_","console","cachedProvider","providerType","type","isDefault","url","id","obj","options","offset","count","ids","IconRegistry","dataURI"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kD;;;;;;ACAA,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;ACAA,kE;;;;;;ACAA,iE;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;AACA;AACA;AAEA;AACA;AACA;;IACMA,Y;AACF,0BAAc;AAAA;;AACV;AACA;AACH;;;;;A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HsBF,qD;;6EAArBe,Y,uBAKyB,O;;AA2B/B,6E","file":"IconRegistry.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 24);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\n/**\n * Base Registry\n */\nclass BaseRegistry {\n constructor() {\n this.cachedProviders = {};\n this.defaultProvider = null;\n }\n\n static create() {\n return new BaseRegistry();\n }\n\n /**\n * check whether user defined provider extends the base provider\n * @param {Provider} provider\n * @returns {Boolean}\n */\n isValidProvider(provider) {\n if (provider instanceof Provider) {\n return true;\n }\n throw new Error(_('Invalid Provider'));\n }\n\n /**\n * add default provider to cache\n * @param {Provider} provider\n */\n addDefaultProvider(provider) {\n if (this.isValidProvider(provider)) {\n this.addProvider(provider);\n this.defaultProvider = provider;\n }\n }\n\n /**\n * add provider to cache\n * @param {Provider} provider\n */\n addProvider(provider) {\n if (this.isValidProvider(provider)) {\n if (this.cachedProviders[provider.getType()]) {\n // eslint-disable-next-line\n console.warn(`The provider \"${provider.getType()}\" existed already.`);\n }\n this.cachedProviders[provider.getType()] = provider;\n }\n }\n\n /**\n * delete provider\n * @param {String} providerType\n */\n deleteProvider(providerType) {\n const cachedProvider = this.cachedProviders[providerType];\n if (!cachedProvider) {\n // eslint-disable-next-line\n console.warn(`The provider \"${providerType}\" does not existed`);\n return;\n }\n\n if (this.defaultProvider && providerType === this.defaultProvider.getType()) {\n this.defaultProvider = null;\n }\n delete this.cachedProviders[providerType];\n }\n\n /**\n * find provider from cache\n * @param {String} type\n * @returns {Provider} provider\n */\n findProvider(type) {\n const provider = this.cachedProviders[type];\n if (provider) {\n return provider;\n }\n throw new Error(_('Provider not found'));\n }\n\n /**\n * list all providers\n * @return {Object} provider = { type: 'local', isDefault: true }\n */\n listProviders() {\n return Object.keys(this.cachedProviders).map(type => ({\n type,\n isDefault: type === this.defaultProvider.getType(),\n }));\n }\n\n /**\n * check whether src is a http url or a url used for icon/image-registry (e.g. 'kvstore://image123')\n */\n isResourceURL(url) {\n if (!url || url.indexOf('://') < 0) {\n return false;\n }\n\n const { type } = this.parseURL(url);\n return type !== 'http' && type !== 'https';\n }\n\n /**\n * parse provider type and id from the url\n * @params {String} url 'kvstore://image123'\n * @returns {Object} obj\n * @returns {String} obj.type 'kvstore'\n * @returns {String} obj.id 'image123'\n */\n parseURL(url) {\n if (url) {\n const [type, id] = url.split('://');\n\n if (type && id) {\n return { type, id };\n }\n }\n throw new Error(_('Invalid url'));\n }\n\n /**\n * upload\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore' or 'sui' or 'local'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n async upload(dataURI, metaData, providerType) {\n if (providerType == null && this.defaultProvider == null) {\n throw new Error(_('No valid provider was found. Please add a provider'));\n }\n const provider = providerType ? this.findProvider(providerType) : this.defaultProvider;\n const id = await provider.upload(dataURI, metaData);\n return `${provider.getType()}://${id}`;\n }\n\n /**\n * get object by url\n * @param {String} url 'kvstore://image123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async getByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.getById(id);\n return obj;\n }\n\n /**\n * delete object by url\n * @param {String} url 'kvstore://image123' || 'sui://icon123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async deleteByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.deleteById(id);\n return obj;\n }\n\n /**\n * list all object ids\n * @params {String} providerType e.g. 'kvstore' or 'sui'\n * @params {Object} options\n * @returns {Array} ids\n */\n async listIds(providerType, options = { offset: 0, count: 100 }) {\n const provider = this.findProvider(providerType);\n const ids = await provider.listIds(options);\n return ids;\n }\n}\n\nexport default BaseRegistry;\n","module.exports = require(\"@babel/runtime/helpers/get\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport BaseRegistry from './BaseRegistry';\n\n/**\n * Icon Registry\n */\nclass IconRegistry extends BaseRegistry {\n static create() {\n return new IconRegistry();\n }\n\n static VALID_MEDIA_TYPES = ['svg'];\n\n /**\n * check if the the media type from the dataURI belongs to the supported types\n * @param {DataURI} dataURI\n * @returns {Boolean}\n */\n isValidMediaType(dataURI) {\n return IconRegistry.VALID_MEDIA_TYPES.some(type => dataURI.indexOf(`image/${type}`) > -1);\n }\n\n /**\n * upload image if the image format is supported\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore', or 'sui'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n upload(dataURI, metaData, providerType) {\n if (!this.isValidMediaType(dataURI)) {\n throw new Error(_('The format of the uploaded file is not supported. Please upload svg file.'));\n }\n\n return super.upload(dataURI, metaData, providerType);\n }\n}\n\nexport default IconRegistry;\n"],"sourceRoot":""}
package/ImageContext.js CHANGED
@@ -87,31 +87,31 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 24);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 25);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
94
94
 
95
- /***/ 24:
95
+ /***/ 25:
96
96
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
97
97
 
98
98
  "use strict";
99
99
  __webpack_require__.r(__webpack_exports__);
100
100
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageContextProvider", function() { return ImageContextProvider; });
101
101
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageContextConsumer", function() { return ImageContextConsumer; });
102
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
102
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7);
103
103
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
104
104
  /* global __VISION_VERSION__ */
105
105
 
106
106
  var ImageContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext();
107
- ImageContext.displayName = "data-splunk-visualization-version-ImageContext-".concat("25.1.0 - 812a9a4d8");
107
+ ImageContext.displayName = "data-splunk-visualization-version-ImageContext-".concat("25.3.0 - dae70ec02");
108
108
  var ImageContextProvider = ImageContext.Provider;
109
109
  var ImageContextConsumer = ImageContext.Consumer;
110
110
  /* harmony default export */ __webpack_exports__["default"] = (ImageContext);
111
111
 
112
112
  /***/ }),
113
113
 
114
- /***/ 9:
114
+ /***/ 7:
115
115
  /***/ (function(module, exports) {
116
116
 
117
117
  module.exports = require("react");
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/ImageContext.jsx","webpack:///external \"react\""],"names":["ImageContext","React","ImageContextProvider","ImageContextConsumer"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA,IAAMA,YAAY,gBAAGC,4CAAK,CAA1B,aAAqBA,EAArB;AACAD,YAAY,CAAZA;AAEO,IAAME,oBAAoB,GAAGF,YAAY,CAAzC;AACA,IAAMG,oBAAoB,GAAGH,YAAY,CAAzC;AACP,6E;;;;;;;ACRA,kC","file":"ImageContext.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 24);\n","/* global __VISION_VERSION__ */\nimport React from 'react';\n\nconst ImageContext = React.createContext();\nImageContext.displayName = `data-splunk-visualization-version-ImageContext-${__VISION_VERSION__}`;\n\nexport const ImageContextProvider = ImageContext.Provider;\nexport const ImageContextConsumer = ImageContext.Consumer;\nexport default ImageContext;\n","module.exports = require(\"react\");"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/ImageContext.jsx","webpack:///external \"react\""],"names":["ImageContext","React","ImageContextProvider","ImageContextConsumer"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA,IAAMA,YAAY,gBAAGC,4CAAK,CAA1B,aAAqBA,EAArB;AACAD,YAAY,CAAZA;AAEO,IAAME,oBAAoB,GAAGF,YAAY,CAAzC;AACA,IAAMG,oBAAoB,GAAGH,YAAY,CAAzC;AACP,6E;;;;;;;ACRA,kC","file":"ImageContext.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 25);\n","/* global __VISION_VERSION__ */\nimport React from 'react';\n\nconst ImageContext = React.createContext();\nImageContext.displayName = `data-splunk-visualization-version-ImageContext-${__VISION_VERSION__}`;\n\nexport const ImageContextProvider = ImageContext.Provider;\nexport const ImageContextConsumer = ImageContext.Consumer;\nexport default ImageContext;\n","module.exports = require(\"react\");"],"sourceRoot":""}
package/ImageRegistry.js CHANGED
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 25);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 26);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -133,19 +133,19 @@ module.exports = require("@babel/runtime/helpers/getPrototypeOf");
133
133
  module.exports = require("@splunk/visualization-context/Provider");
134
134
 
135
135
  /***/ }),
136
- /* 7 */
136
+ /* 7 */,
137
+ /* 8 */
137
138
  /***/ (function(module, exports) {
138
139
 
139
140
  module.exports = require("@babel/runtime/helpers/inherits");
140
141
 
141
142
  /***/ }),
142
- /* 8 */
143
+ /* 9 */
143
144
  /***/ (function(module, exports) {
144
145
 
145
146
  module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
146
147
 
147
148
  /***/ }),
148
- /* 9 */,
149
149
  /* 10 */
150
150
  /***/ (function(module, exports) {
151
151
 
@@ -542,7 +542,8 @@ module.exports = require("@babel/runtime/helpers/get");
542
542
  /* 22 */,
543
543
  /* 23 */,
544
544
  /* 24 */,
545
- /* 25 */
545
+ /* 25 */,
546
+ /* 26 */
546
547
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
547
548
 
548
549
  "use strict";
@@ -553,9 +554,9 @@ __webpack_require__.r(__webpack_exports__);
553
554
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
554
555
  /* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13);
555
556
  /* harmony import */ var _babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_get__WEBPACK_IMPORTED_MODULE_2__);
556
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
557
+ /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8);
557
558
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
558
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
559
+ /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
559
560
  /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
560
561
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
561
562
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/BaseRegistry.js","webpack:///external \"@babel/runtime/helpers/get\"","webpack:///./src/ImageRegistry.js"],"names":["BaseRegistry","provider","_","console","cachedProvider","providerType","type","isDefault","url","id","obj","options","offset","count","ids","ImageRegistry","validMediaType","VALID_MEDIA_TYPES","regex"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kD;;;;;;ACAA,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4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AAO,uBAAP,OAAO,CAAP;AAFJ,OAAO,CAAP;AAIH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;;;;WACI,iDAA0F;AAAA,UAAlDU,cAAkD,uEAAjCD,aAAa,CAACE,iBAAmB;;AACtF,UAAI,CAAC,+BAAL,cAAK,CAAL,EAAqD;AACjD,cAAM,UACFf,+DAAC,2EACsEc,cAAc,CAAdA,KADtE,IACsEA,CADtE,EADL,GACK,EADC,CAAN;AAOH;;AAED;AACH;;;WArCD,kBAAgB;AACZ,aAAO,IAAP,aAAO,EAAP;AACH;;;;EAHuBhB,qD;;6EAAtBe,a,uBAKyB,qC;;AAoC/B,8E","file":"ImageRegistry.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 25);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\n/**\n * Base Registry\n */\nclass BaseRegistry {\n constructor() {\n this.cachedProviders = {};\n this.defaultProvider = null;\n }\n\n static create() {\n return new BaseRegistry();\n }\n\n /**\n * check whether user defined provider extends the base provider\n * @param {Provider} provider\n * @returns {Boolean}\n */\n isValidProvider(provider) {\n if (provider instanceof Provider) {\n return true;\n }\n throw new Error(_('Invalid Provider'));\n }\n\n /**\n * add default provider to cache\n * @param {Provider} provider\n */\n addDefaultProvider(provider) {\n if (this.isValidProvider(provider)) {\n this.addProvider(provider);\n this.defaultProvider = provider;\n }\n }\n\n /**\n * add provider to cache\n * @param {Provider} provider\n */\n addProvider(provider) {\n if (this.isValidProvider(provider)) {\n if (this.cachedProviders[provider.getType()]) {\n // eslint-disable-next-line\n console.warn(`The provider \"${provider.getType()}\" existed already.`);\n }\n this.cachedProviders[provider.getType()] = provider;\n }\n }\n\n /**\n * delete provider\n * @param {String} providerType\n */\n deleteProvider(providerType) {\n const cachedProvider = this.cachedProviders[providerType];\n if (!cachedProvider) {\n // eslint-disable-next-line\n console.warn(`The provider \"${providerType}\" does not existed`);\n return;\n }\n\n if (this.defaultProvider && providerType === this.defaultProvider.getType()) {\n this.defaultProvider = null;\n }\n delete this.cachedProviders[providerType];\n }\n\n /**\n * find provider from cache\n * @param {String} type\n * @returns {Provider} provider\n */\n findProvider(type) {\n const provider = this.cachedProviders[type];\n if (provider) {\n return provider;\n }\n throw new Error(_('Provider not found'));\n }\n\n /**\n * list all providers\n * @return {Object} provider = { type: 'local', isDefault: true }\n */\n listProviders() {\n return Object.keys(this.cachedProviders).map(type => ({\n type,\n isDefault: type === this.defaultProvider.getType(),\n }));\n }\n\n /**\n * check whether src is a http url or a url used for icon/image-registry (e.g. 'kvstore://image123')\n */\n isResourceURL(url) {\n if (!url || url.indexOf('://') < 0) {\n return false;\n }\n\n const { type } = this.parseURL(url);\n return type !== 'http' && type !== 'https';\n }\n\n /**\n * parse provider type and id from the url\n * @params {String} url 'kvstore://image123'\n * @returns {Object} obj\n * @returns {String} obj.type 'kvstore'\n * @returns {String} obj.id 'image123'\n */\n parseURL(url) {\n if (url) {\n const [type, id] = url.split('://');\n\n if (type && id) {\n return { type, id };\n }\n }\n throw new Error(_('Invalid url'));\n }\n\n /**\n * upload\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore' or 'sui' or 'local'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n async upload(dataURI, metaData, providerType) {\n if (providerType == null && this.defaultProvider == null) {\n throw new Error(_('No valid provider was found. Please add a provider'));\n }\n const provider = providerType ? this.findProvider(providerType) : this.defaultProvider;\n const id = await provider.upload(dataURI, metaData);\n return `${provider.getType()}://${id}`;\n }\n\n /**\n * get object by url\n * @param {String} url 'kvstore://image123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async getByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.getById(id);\n return obj;\n }\n\n /**\n * delete object by url\n * @param {String} url 'kvstore://image123' || 'sui://icon123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async deleteByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.deleteById(id);\n return obj;\n }\n\n /**\n * list all object ids\n * @params {String} providerType e.g. 'kvstore' or 'sui'\n * @params {Object} options\n * @returns {Array} ids\n */\n async listIds(providerType, options = { offset: 0, count: 100 }) {\n const provider = this.findProvider(providerType);\n const ids = await provider.listIds(options);\n return ids;\n }\n}\n\nexport default BaseRegistry;\n","module.exports = require(\"@babel/runtime/helpers/get\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport BaseRegistry from './BaseRegistry';\n\n/**\n * Image Registry\n */\nclass ImageRegistry extends BaseRegistry {\n static create() {\n return new ImageRegistry();\n }\n\n static VALID_MEDIA_TYPES = ['png', 'jpeg', 'svg', 'gif', 'webp'];\n\n /**\n * check if the the media type from the dataURI belongs to the supported types\n * @param {DataURI} dataURI\n * @returns {Boolean}\n */\n isValidMediaType(dataURI, validMediaType = ImageRegistry.VALID_MEDIA_TYPES) {\n return validMediaType.some(type => {\n const regex = `^data:image\\\\/${type === 'svg' ? `${type}\\\\+xml` : type};base64,.*$`;\n return new RegExp(regex).test(dataURI);\n });\n }\n\n /**\n * upload image if the image format is supported\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore', or 'sui'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n upload(dataURI, metaData, providerType, validMediaType = ImageRegistry.VALID_MEDIA_TYPES) {\n if (!this.isValidMediaType(dataURI, validMediaType)) {\n throw new Error(\n _(\n `The format of the uploaded file is not supported. Please upload ${validMediaType.join(\n ', '\n )}.`\n )\n );\n }\n\n return super.upload(dataURI, metaData, providerType);\n }\n}\n\nexport default ImageRegistry;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/BaseRegistry.js","webpack:///external \"@babel/runtime/helpers/get\"","webpack:///./src/ImageRegistry.js"],"names":["BaseRegistry","provider","_","console","cachedProvider","providerType","type","isDefault","url","id","obj","options","offset","count","ids","ImageRegistry","validMediaType","VALID_MEDIA_TYPES","regex"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;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BA,QAAQ,CAARA,QAFtB,OAEsBA,CAFtB;;AAAA;AAEUa,mBAFV,iBAEUA;AAFV;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;WA/JA,kBAAgB;AACZ,aAAO,IAAP,YAAO,EAAP;AACH;;;;;;AAoKL,6E;;;;;;ACnLA,uD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AAEA;AACA;AACA;;IACMC,a;;;;;;;;;;;;;;AAOF;AACJ;AACA;AACA;AACA;AACI,uCAA4E;AAAA,UAAlDC,cAAkD,uEAAjCD,aAAa,CAACE,iBAAmB;AACxE,aAAO,cAAc,CAAd,KAAoB,gBAAQ;AAC/B,YAAMC,KAAK,2BAAoBZ,IAAI,KAAJA,oCAApB,MAAX,aAAW,CAAX;AACA,eAAO,uBAAP,OAAO,CAAP;AAFJ,OAAO,CAAP;AAIH;AAED;AACJ;AACA;AACA;AACA;AACA;AACA;;;;WACI,iDAA0F;AAAA,UAAlDU,cAAkD,uEAAjCD,aAAa,CAACE,iBAAmB;;AACtF,UAAI,CAAC,+BAAL,cAAK,CAAL,EAAqD;AACjD,cAAM,UACFf,+DAAC,2EACsEc,cAAc,CAAdA,KADtE,IACsEA,CADtE,EADL,GACK,EADC,CAAN;AAOH;;AAED;AACH;;;WArCD,kBAAgB;AACZ,aAAO,IAAP,aAAO,EAAP;AACH;;;;EAHuBhB,qD;;6EAAtBe,a,uBAKyB,qC;;AAoC/B,8E","file":"ImageRegistry.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 26);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\n/**\n * Base Registry\n */\nclass BaseRegistry {\n constructor() {\n this.cachedProviders = {};\n this.defaultProvider = null;\n }\n\n static create() {\n return new BaseRegistry();\n }\n\n /**\n * check whether user defined provider extends the base provider\n * @param {Provider} provider\n * @returns {Boolean}\n */\n isValidProvider(provider) {\n if (provider instanceof Provider) {\n return true;\n }\n throw new Error(_('Invalid Provider'));\n }\n\n /**\n * add default provider to cache\n * @param {Provider} provider\n */\n addDefaultProvider(provider) {\n if (this.isValidProvider(provider)) {\n this.addProvider(provider);\n this.defaultProvider = provider;\n }\n }\n\n /**\n * add provider to cache\n * @param {Provider} provider\n */\n addProvider(provider) {\n if (this.isValidProvider(provider)) {\n if (this.cachedProviders[provider.getType()]) {\n // eslint-disable-next-line\n console.warn(`The provider \"${provider.getType()}\" existed already.`);\n }\n this.cachedProviders[provider.getType()] = provider;\n }\n }\n\n /**\n * delete provider\n * @param {String} providerType\n */\n deleteProvider(providerType) {\n const cachedProvider = this.cachedProviders[providerType];\n if (!cachedProvider) {\n // eslint-disable-next-line\n console.warn(`The provider \"${providerType}\" does not existed`);\n return;\n }\n\n if (this.defaultProvider && providerType === this.defaultProvider.getType()) {\n this.defaultProvider = null;\n }\n delete this.cachedProviders[providerType];\n }\n\n /**\n * find provider from cache\n * @param {String} type\n * @returns {Provider} provider\n */\n findProvider(type) {\n const provider = this.cachedProviders[type];\n if (provider) {\n return provider;\n }\n throw new Error(_('Provider not found'));\n }\n\n /**\n * list all providers\n * @return {Object} provider = { type: 'local', isDefault: true }\n */\n listProviders() {\n return Object.keys(this.cachedProviders).map(type => ({\n type,\n isDefault: type === this.defaultProvider.getType(),\n }));\n }\n\n /**\n * check whether src is a http url or a url used for icon/image-registry (e.g. 'kvstore://image123')\n */\n isResourceURL(url) {\n if (!url || url.indexOf('://') < 0) {\n return false;\n }\n\n const { type } = this.parseURL(url);\n return type !== 'http' && type !== 'https';\n }\n\n /**\n * parse provider type and id from the url\n * @params {String} url 'kvstore://image123'\n * @returns {Object} obj\n * @returns {String} obj.type 'kvstore'\n * @returns {String} obj.id 'image123'\n */\n parseURL(url) {\n if (url) {\n const [type, id] = url.split('://');\n\n if (type && id) {\n return { type, id };\n }\n }\n throw new Error(_('Invalid url'));\n }\n\n /**\n * upload\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore' or 'sui' or 'local'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n async upload(dataURI, metaData, providerType) {\n if (providerType == null && this.defaultProvider == null) {\n throw new Error(_('No valid provider was found. Please add a provider'));\n }\n const provider = providerType ? this.findProvider(providerType) : this.defaultProvider;\n const id = await provider.upload(dataURI, metaData);\n return `${provider.getType()}://${id}`;\n }\n\n /**\n * get object by url\n * @param {String} url 'kvstore://image123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async getByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.getById(id);\n return obj;\n }\n\n /**\n * delete object by url\n * @param {String} url 'kvstore://image123' || 'sui://icon123'\n * @returns {Object} obj e.g. an image object or icon\n */\n async deleteByURL(url) {\n const { type, id } = this.parseURL(url);\n const provider = this.findProvider(type);\n const obj = await provider.deleteById(id);\n return obj;\n }\n\n /**\n * list all object ids\n * @params {String} providerType e.g. 'kvstore' or 'sui'\n * @params {Object} options\n * @returns {Array} ids\n */\n async listIds(providerType, options = { offset: 0, count: 100 }) {\n const provider = this.findProvider(providerType);\n const ids = await provider.listIds(options);\n return ids;\n }\n}\n\nexport default BaseRegistry;\n","module.exports = require(\"@babel/runtime/helpers/get\");","/* eslint-disable class-methods-use-this */\nimport { _ } from '@splunk/ui-utils/i18n';\nimport BaseRegistry from './BaseRegistry';\n\n/**\n * Image Registry\n */\nclass ImageRegistry extends BaseRegistry {\n static create() {\n return new ImageRegistry();\n }\n\n static VALID_MEDIA_TYPES = ['png', 'jpeg', 'svg', 'gif', 'webp'];\n\n /**\n * check if the the media type from the dataURI belongs to the supported types\n * @param {DataURI} dataURI\n * @returns {Boolean}\n */\n isValidMediaType(dataURI, validMediaType = ImageRegistry.VALID_MEDIA_TYPES) {\n return validMediaType.some(type => {\n const regex = `^data:image\\\\/${type === 'svg' ? `${type}\\\\+xml` : type};base64,.*$`;\n return new RegExp(regex).test(dataURI);\n });\n }\n\n /**\n * upload image if the image format is supported\n * @param {DataURI} dataURI\n * @param {Object} metaData\n * @param {String} providerType e.g. 'kvstore', or 'sui'\n * @returns {String} id e.g. 'kvstore://image123'\n */\n upload(dataURI, metaData, providerType, validMediaType = ImageRegistry.VALID_MEDIA_TYPES) {\n if (!this.isValidMediaType(dataURI, validMediaType)) {\n throw new Error(\n _(\n `The format of the uploaded file is not supported. Please upload ${validMediaType.join(\n ', '\n )}.`\n )\n );\n }\n\n return super.upload(dataURI, metaData, providerType);\n }\n}\n\nexport default ImageRegistry;\n"],"sourceRoot":""}
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 26);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 27);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -133,19 +133,19 @@ module.exports = require("@babel/runtime/helpers/getPrototypeOf");
133
133
  module.exports = require("@splunk/visualization-context/Provider");
134
134
 
135
135
  /***/ }),
136
- /* 7 */
136
+ /* 7 */,
137
+ /* 8 */
137
138
  /***/ (function(module, exports) {
138
139
 
139
140
  module.exports = require("@babel/runtime/helpers/inherits");
140
141
 
141
142
  /***/ }),
142
- /* 8 */
143
+ /* 9 */
143
144
  /***/ (function(module, exports) {
144
145
 
145
146
  module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
146
147
 
147
148
  /***/ }),
148
- /* 9 */,
149
149
  /* 10 */
150
150
  /***/ (function(module, exports) {
151
151
 
@@ -172,7 +172,8 @@ module.exports = require("uuid-v4");
172
172
  /* 23 */,
173
173
  /* 24 */,
174
174
  /* 25 */,
175
- /* 26 */
175
+ /* 26 */,
176
+ /* 27 */
176
177
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
177
178
 
178
179
  "use strict";
@@ -187,9 +188,9 @@ __webpack_require__.r(__webpack_exports__);
187
188
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__);
188
189
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
189
190
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__);
190
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7);
191
+ /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
191
192
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);
192
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
193
+ /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9);
193
194
  /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__);
194
195
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5);
195
196
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__);
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalIconProvider.js"],"names":["b64EncodeUnicode","btoa","String","parseInt","KEY","LocalIconProvider","fetch","response","text","parser","xmlDoc","svg","_","serializer","svgStr","iconDataURI","icon","dataURI","metaData","id","uuid","icons","JSON","localStorage","offset","count","meta","search","results","Object","iconMeta","isSearchedIcon","iconMetaValue","Provider"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kD;;;;;;ACAA,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;;ACAA,kE;;;;;;;;;ACAA,oC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AACA;AAEO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,MAAG;AAAA,SAC/B;AACA;AACA;AACAC,QAAI,CACA,kBAAkB,CAAlB,GAAkB,CAAlB,4BAAmD;AAAA,aAC/CC,MAAM,CAANA,aAAoBC,QAAQ,kBADmB,EACnB,CAA5BD,CAD+C;AADnD,KACA,CADA;AAJ2B;AAA5B;AAUA,IAAME,GAAG,GAAT;AAEP;AACA;AACA;;IACMC,iB;;;;;AACF,+BAAc;AAAA;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IAAQ,CAARA,IAAJ,MAA4B;AACxBd,sBAAI,CAAJA,iBAAsBc,QAAQ,CAA9Bd,IAA8B,CAA9BA;AACH;AAHLU;AAKH;;AAEDE,mBAAO,CAAPA;AACH;AAxBTC;AA2BA;AA/BJ,QAgCE,cAAc;AACZ,cAAM,UAAUjB,+DAAC,CAAjB,gCAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,wBAAe;AACX,UAAI;AACA,YAAMI,IAAI,GAAG,aAAb,EAAa,CAAb;AACA,YAAMK,KAAK,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,QAAzB,GAAyBA,CAAXD,CAAd;AACA,eAAOD,KAAK,CAAZ,EAAY,CAAZ;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,KAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUX,+DAAC,CAAjB,6BAAiB,CAAX,CAAN;AACH;AACJ;;;;EAtH2BqB,8E;;AAyHhC,kF","file":"LocalIconProvider.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 26);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) =>\n String.fromCharCode(parseInt(`0x${p1}`, 16))\n )\n );\n\nexport const KEY = '__icons__';\n\n/**\n * a local icon provider\n */\nclass LocalIconProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n * @return {String} 'local'\n */\n getType() {\n return 'local';\n }\n\n /**\n * upload one new icon\n */\n async upload(dataURI, metaData) {\n // get svg from dataURI\n const response = await fetch(dataURI);\n const text = await response.text();\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n\n if (!svg.getAttribute('viewBox')) {\n throw new Error(_('Please upload a valid svg with viewBox attribute.'));\n }\n\n // reset svg attributes\n svg.setAttribute('preserveAspectRatio', 'none');\n // convert back to dataURI\n const serializer = new XMLSerializer();\n const svgStr = b64EncodeUnicode(serializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n\n // save to localStorage\n try {\n const icon = { dataURI: iconDataURI, metaData };\n const id = uuid();\n let icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n icons = { ...icons, [id]: icon };\n localStorage.setItem(KEY, JSON.stringify(icons));\n return id;\n } catch (error) {\n throw new Error(\n _('The icon cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get one icon by icon id\n */\n getById(id) {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n if (icons[id]) {\n return icons[id];\n }\n throw new Error(_('The icon is not found.'));\n }\n\n /**\n * get all icon ids\n * @params options\n * @params options.meta a list of meta data attribute that would be returned with each id\n * @params options.search a search string to filter the returned icons\n */\n listIds({ offset = 0, count = 100, meta = [], search = null }) {\n try {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n const results = [];\n\n Object.keys(icons)\n .slice(offset, count)\n .forEach(id => {\n const icon = { id };\n const iconMeta = icons[id].metaData || {};\n // If search is a valid string, return the icon with matched meta data\n const isSearchedIcon =\n search != null &&\n Object.keys(iconMeta).some(attr => {\n const iconMetaValue = iconMeta[attr].toLowerCase();\n return iconMetaValue.indexOf(search.toLowerCase()) > -1;\n });\n\n if (search == null || isSearchedIcon) {\n if (meta && meta.length) {\n icon.metaData = {};\n meta.forEach(attr => {\n if (iconMeta[attr] != null) {\n icon.metaData[attr] = iconMeta[attr];\n }\n });\n }\n\n results.push(icon);\n }\n });\n\n return results;\n } catch (error) {\n throw new Error(_('The icon ids cannot be listed.'));\n }\n }\n\n /**\n * delete an icon by icon id\n */\n deleteById(id) {\n try {\n const icon = this.getById(id);\n const icons = JSON.parse(localStorage.getItem(KEY));\n delete icons[id];\n localStorage.setItem(KEY, JSON.stringify(icons));\n return icon;\n } catch (error) {\n throw new Error(_('The icon cannot be deleted.'));\n }\n }\n}\n\nexport default LocalIconProvider;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/regenerator\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/asyncToGenerator\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalIconProvider.js"],"names":["b64EncodeUnicode","btoa","String","parseInt","KEY","LocalIconProvider","fetch","response","text","parser","xmlDoc","svg","_","serializer","svgStr","iconDataURI","icon","dataURI","metaData","id","uuid","icons","JSON","localStorage","offset","count","meta","search","results","Object","iconMeta","isSearchedIcon","iconMetaValue","Provider"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFA,kD;;;;;;ACAA,uD;;;;;;ACAA,kE;;;;;;ACAA,+D;;;;;;ACAA,oE;;;;;;ACAA,kE;;;;;;ACAA,mE;;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;ACAA,kE;;;;;;;;;ACAA,oC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;AACA;AACA;AACA;AAEO,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,MAAG;AAAA,SAC/B;AACA;AACA;AACAC,QAAI,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AsBL,EAAtBK,IAA8C,CAArD;AAJR,WAEI,CAFJ;;AAOA,cAAIL,MAAM,IAANA,QAAJ,gBAAsC;AAClC,gBAAID,IAAI,IAAIA,IAAI,CAAhB,QAAyB;AACrBV,kBAAI,CAAJA;AACAU,kBAAI,CAAJA,QAAa,gBAAQ;AACjB,oBAAII,QAAQ,CAARA,IAAQ,CAARA,IAAJ,MAA4B;AACxBd,sBAAI,CAAJA,iBAAsBc,QAAQ,CAA9Bd,IAA8B,CAA9BA;AACH;AAHLU;AAKH;;AAEDE,mBAAO,CAAPA;AACH;AAxBTC;AA2BA;AA/BJ,QAgCE,cAAc;AACZ,cAAM,UAAUjB,+DAAC,CAAjB,gCAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,wBAAe;AACX,UAAI;AACA,YAAMI,IAAI,GAAG,aAAb,EAAa,CAAb;AACA,YAAMK,KAAK,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,QAAzB,GAAyBA,CAAXD,CAAd;AACA,eAAOD,KAAK,CAAZ,EAAY,CAAZ;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,KAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUX,+DAAC,CAAjB,6BAAiB,CAAX,CAAN;AACH;AACJ;;;;EAtH2BqB,8E;;AAyHhC,kF","file":"LocalIconProvider.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 27);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/regenerator\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/asyncToGenerator\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const b64EncodeUnicode = str =>\n // first we use encodeURIComponent to get percent-encoded UTF-8,\n // then we convert the percent encodings into raw bytes which\n // can be fed into btoa.\n btoa(\n encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) =>\n String.fromCharCode(parseInt(`0x${p1}`, 16))\n )\n );\n\nexport const KEY = '__icons__';\n\n/**\n * a local icon provider\n */\nclass LocalIconProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n * @return {String} 'local'\n */\n getType() {\n return 'local';\n }\n\n /**\n * upload one new icon\n */\n async upload(dataURI, metaData) {\n // get svg from dataURI\n const response = await fetch(dataURI);\n const text = await response.text();\n const parser = new DOMParser();\n const xmlDoc = parser.parseFromString(text, 'text/xml');\n const svg = xmlDoc.getElementsByTagName('svg')[0];\n\n if (!svg.getAttribute('viewBox')) {\n throw new Error(_('Please upload a valid svg with viewBox attribute.'));\n }\n\n // reset svg attributes\n svg.setAttribute('preserveAspectRatio', 'none');\n // convert back to dataURI\n const serializer = new XMLSerializer();\n const svgStr = b64EncodeUnicode(serializer.serializeToString(svg));\n const iconDataURI = `data:image/svg+xml;base64,${svgStr}`;\n\n // save to localStorage\n try {\n const icon = { dataURI: iconDataURI, metaData };\n const id = uuid();\n let icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n icons = { ...icons, [id]: icon };\n localStorage.setItem(KEY, JSON.stringify(icons));\n return id;\n } catch (error) {\n throw new Error(\n _('The icon cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get one icon by icon id\n */\n getById(id) {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n if (icons[id]) {\n return icons[id];\n }\n throw new Error(_('The icon is not found.'));\n }\n\n /**\n * get all icon ids\n * @params options\n * @params options.meta a list of meta data attribute that would be returned with each id\n * @params options.search a search string to filter the returned icons\n */\n listIds({ offset = 0, count = 100, meta = [], search = null }) {\n try {\n const icons = JSON.parse(localStorage.getItem(KEY) || '{}');\n const results = [];\n\n Object.keys(icons)\n .slice(offset, count)\n .forEach(id => {\n const icon = { id };\n const iconMeta = icons[id].metaData || {};\n // If search is a valid string, return the icon with matched meta data\n const isSearchedIcon =\n search != null &&\n Object.keys(iconMeta).some(attr => {\n const iconMetaValue = iconMeta[attr].toLowerCase();\n return iconMetaValue.indexOf(search.toLowerCase()) > -1;\n });\n\n if (search == null || isSearchedIcon) {\n if (meta && meta.length) {\n icon.metaData = {};\n meta.forEach(attr => {\n if (iconMeta[attr] != null) {\n icon.metaData[attr] = iconMeta[attr];\n }\n });\n }\n\n results.push(icon);\n }\n });\n\n return results;\n } catch (error) {\n throw new Error(_('The icon ids cannot be listed.'));\n }\n }\n\n /**\n * delete an icon by icon id\n */\n deleteById(id) {\n try {\n const icon = this.getById(id);\n const icons = JSON.parse(localStorage.getItem(KEY));\n delete icons[id];\n localStorage.setItem(KEY, JSON.stringify(icons));\n return icon;\n } catch (error) {\n throw new Error(_('The icon cannot be deleted.'));\n }\n }\n}\n\nexport default LocalIconProvider;\n"],"sourceRoot":""}
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 27);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 28);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -123,19 +123,19 @@ module.exports = require("@babel/runtime/helpers/getPrototypeOf");
123
123
  module.exports = require("@splunk/visualization-context/Provider");
124
124
 
125
125
  /***/ }),
126
- /* 7 */
126
+ /* 7 */,
127
+ /* 8 */
127
128
  /***/ (function(module, exports) {
128
129
 
129
130
  module.exports = require("@babel/runtime/helpers/inherits");
130
131
 
131
132
  /***/ }),
132
- /* 8 */
133
+ /* 9 */
133
134
  /***/ (function(module, exports) {
134
135
 
135
136
  module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");
136
137
 
137
138
  /***/ }),
138
- /* 9 */,
139
139
  /* 10 */
140
140
  /***/ (function(module, exports) {
141
141
 
@@ -163,7 +163,8 @@ module.exports = require("uuid-v4");
163
163
  /* 24 */,
164
164
  /* 25 */,
165
165
  /* 26 */,
166
- /* 27 */
166
+ /* 27 */,
167
+ /* 28 */
167
168
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
168
169
 
169
170
  "use strict";
@@ -175,9 +176,9 @@ __webpack_require__.r(__webpack_exports__);
175
176
  /* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
176
177
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
177
178
  /* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
178
- /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
179
+ /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8);
179
180
  /* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
180
- /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
181
+ /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
181
182
  /* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
182
183
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
183
184
  /* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalImageProvider.js"],"names":["KEY","LocalImageProvider","id","uuid","imageObject","dataURI","metaData","images","JSON","localStorage","_","offset","count","imageIDS","Object","Provider"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;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UACFC,+DAAC,CADL,+EACK,CADC,CAAN;AAGH;AACJ;AAED;AACJ;AACA;;;;WACI,0BAAiB;AACb,UAAMH,MAAM,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,gBAA1B,IAAeD,CAAf;AACA,UAAMJ,WAAW,GAAGG,MAAM,CAA1B,OAA0B,CAA1B;;AACA,uBAAiB;AACb;AACH;;AACD,YAAM,UAAUG,+DAAC,CAAjB,yBAAiB,CAAX,CAAN;AACH;AAED;AACJ;AACA;;;;WACI,uBAA2B;AAAA,UAAjBC,MAAiB,QAAjBA,MAAiB;AAAA,UAATC,KAAS,QAATA,KAAS;;AACvB,UAAI;AACA,YAAML,MAAM,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,gBAA1B,IAAeD,CAAf;AACA,YAAMK,QAAQ,GAAGC,MAAM,CAANA,KAAjB,MAAiBA,CAAjB;AACA,eAAOD,QAAQ,CAARA,cAAP,KAAOA,CAAP;AAHJ,QAIE,cAAc;AACZ,cAAM,UAAUH,+DAAC,CAAjB,iCAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,6BAAoB;AAChB,UAAI;AACA,YAAMN,WAAW,GAAG,aAApB,OAAoB,CAApB;AACA,YAAMG,MAAM,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,QAA1B,GAA0BA,CAAXD,CAAf;AACA,eAAOD,MAAM,CAAb,OAAa,CAAb;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,MAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUC,+DAAC,CAAjB,8BAAiB,CAAX,CAAN;AACH;AACJ;;;;EApE4BK,6E;;AAuEjC,mF","file":"LocalImageProvider.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 27);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const KEY = '__images__';\n\n/**\n * a pure frontend local image provider\n */\nclass LocalImageProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n */\n getType() {\n return 'local';\n }\n\n /**\n * add a new image\n */\n upload(dataURI, metaData) {\n try {\n const id = uuid();\n const imageObject = { dataURI, metaData };\n let images = JSON.parse(localStorage.getItem(KEY) || '{}');\n images = { ...images, [id]: imageObject };\n localStorage.setItem(KEY, JSON.stringify(images));\n return id;\n } catch (error) {\n throw new Error(\n _('The image cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get image by imageID\n */\n getById(imageID) {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageObject = images[imageID];\n if (imageObject) {\n return imageObject;\n }\n throw new Error(_('The image is not found.'));\n }\n\n /**\n * get all imageIDs\n */\n listIds({ offset, count }) {\n try {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageIDS = Object.keys(images);\n return imageIDS.slice(offset, count);\n } catch (error) {\n throw new Error(_('The image ids cannot be listed.'));\n }\n }\n\n /**\n * delete an image by dataID\n */\n deleteById(imageID) {\n try {\n const imageObject = this.getById(imageID);\n const images = JSON.parse(localStorage.getItem(KEY));\n delete images[imageID];\n localStorage.setItem(KEY, JSON.stringify(images));\n return imageObject;\n } catch (error) {\n throw new Error(_('The image cannot be deleted.'));\n }\n }\n}\n\nexport default LocalImageProvider;\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@splunk/ui-utils/i18n\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/visualization-context/Provider\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/defineProperty\"","webpack:///external \"uuid-v4\"","webpack:///./src/LocalImageProvider.js"],"names":["KEY","LocalImageProvider","id","uuid","imageObject","dataURI","metaData","images","JSON","localStorage","_","offset","count","imageIDS","Object","Provider"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA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AACvB,UAAI;AACA,YAAML,MAAM,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,gBAA1B,IAAeD,CAAf;AACA,YAAMK,QAAQ,GAAGC,MAAM,CAANA,KAAjB,MAAiBA,CAAjB;AACA,eAAOD,QAAQ,CAARA,cAAP,KAAOA,CAAP;AAHJ,QAIE,cAAc;AACZ,cAAM,UAAUH,+DAAC,CAAjB,iCAAiB,CAAX,CAAN;AACH;AACJ;AAED;AACJ;AACA;;;;WACI,6BAAoB;AAChB,UAAI;AACA,YAAMN,WAAW,GAAG,aAApB,OAAoB,CAApB;AACA,YAAMG,MAAM,GAAGC,IAAI,CAAJA,MAAWC,YAAY,CAAZA,QAA1B,GAA0BA,CAAXD,CAAf;AACA,eAAOD,MAAM,CAAb,OAAa,CAAb;AACAE,oBAAY,CAAZA,aAA0BD,IAAI,CAAJA,UAA1BC,MAA0BD,CAA1BC;AACA;AALJ,QAME,cAAc;AACZ,cAAM,UAAUC,+DAAC,CAAjB,8BAAiB,CAAX,CAAN;AACH;AACJ;;;;EApE4BK,6E;;AAuEjC,mF","file":"LocalImageProvider.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 28);\n","module.exports = require(\"@splunk/ui-utils/i18n\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/visualization-context/Provider\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"uuid-v4\");","/* eslint-disable class-methods-use-this,no-useless-constructor */\nimport uuid from 'uuid-v4';\nimport { _ } from '@splunk/ui-utils/i18n';\nimport Provider from '@splunk/visualization-context/Provider';\n\nexport const KEY = '__images__';\n\n/**\n * a pure frontend local image provider\n */\nclass LocalImageProvider extends Provider {\n constructor() {\n super();\n }\n\n /**\n * return provider type\n */\n getType() {\n return 'local';\n }\n\n /**\n * add a new image\n */\n upload(dataURI, metaData) {\n try {\n const id = uuid();\n const imageObject = { dataURI, metaData };\n let images = JSON.parse(localStorage.getItem(KEY) || '{}');\n images = { ...images, [id]: imageObject };\n localStorage.setItem(KEY, JSON.stringify(images));\n return id;\n } catch (error) {\n throw new Error(\n _('The image cannot be uploaded. Please check whether your localStorage is full.')\n );\n }\n }\n\n /**\n * get image by imageID\n */\n getById(imageID) {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageObject = images[imageID];\n if (imageObject) {\n return imageObject;\n }\n throw new Error(_('The image is not found.'));\n }\n\n /**\n * get all imageIDs\n */\n listIds({ offset, count }) {\n try {\n const images = JSON.parse(localStorage.getItem(KEY) || '{}');\n const imageIDS = Object.keys(images);\n return imageIDS.slice(offset, count);\n } catch (error) {\n throw new Error(_('The image ids cannot be listed.'));\n }\n }\n\n /**\n * delete an image by dataID\n */\n deleteById(imageID) {\n try {\n const imageObject = this.getById(imageID);\n const images = JSON.parse(localStorage.getItem(KEY));\n delete images[imageID];\n localStorage.setItem(KEY, JSON.stringify(images));\n return imageObject;\n } catch (error) {\n throw new Error(_('The image cannot be deleted.'));\n }\n }\n}\n\nexport default LocalImageProvider;\n"],"sourceRoot":""}