text: define(["exports", "../simple-picker/simple-picker.js", "../simple-icon/lib/simple-icon-lite.js", "../simple-icon/lib/simple-icons.js", "../simple-icon/lib/simple-iconset.js"], function (_exports, _simplePicker, _simpleIconLite, _simpleIcons, _simpleIconset) {
    "use strict";
  
    Object.defineProperty(_exports, "__esModule", {
      value: true
    });
    _exports.SimpleIconPicker = void 0;
  
    function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
  
    function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  
    function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; }
  
    function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  
    /**
     * `simple-icon-picker`
     * Uses simple-picker to create an icon picker
     * @element simple-icon-picker
     * @customElement
     *
     * @demo ./demo/index.html
     */
    var SimpleIconPicker = /*#__PURE__*/function (_SimplePicker) {
      babelHelpers.inherits(SimpleIconPicker, _SimplePicker);
  
      var _super = _createSuper(SimpleIconPicker);
  
      function SimpleIconPicker() {
        var _this;
  
        babelHelpers.classCallCheck(this, SimpleIconPicker);
        _this = _super.call(this);
        _this.hideOptionLabels = true;
        _this.allowNull = false;
        _this.icons = [];
        _this.value = null;
        _this.options = [];
        _this.optionsPerRow = 10;
        return _this;
      }
      /**
       * LitElement life cycle - property changed callback
       */
  
  
      babelHelpers.createClass(SimpleIconPicker, [{
        key: "updated",
        value: function updated(changedProperties) {
          var _this2 = this;
  
          if (babelHelpers.get(babelHelpers.getPrototypeOf(SimpleIconPicker.prototype), "updated", this)) {
            babelHelpers.get(babelHelpers.getPrototypeOf(SimpleIconPicker.prototype), "updated", this).call(this, changedProperties);
          }
  
          changedProperties.forEach(function (oldValue, propName) {
            if (["optionsPerRow", "icons", "allowNull", "__iconList"].includes(propName)) {
              clearTimeout(_this2.__rebuild);
              _this2.__rebuild = setTimeout(function () {
                _this2._getOptions();
              }, 0);
            }
  
            if (propName == "value") {
              /**
               * fires when value changes
               * @event value-changed
               */
              _this2.dispatchEvent(new CustomEvent("value-changed", {
                detail: {
                  value: _this2[propName]
                }
              }));
            }
          });
        }
        /**
         * LitElement life cycle - ready callback
         */
  
      }, {
        key: "firstUpdated",
        value: function firstUpdated(changedProperties) {
          if (babelHelpers.get(babelHelpers.getPrototypeOf(SimpleIconPicker.prototype), "firstUpdated", this)) {
            babelHelpers.get(babelHelpers.getPrototypeOf(SimpleIconPicker.prototype), "firstUpdated", this).call(this, changedProperties);
          }
        }
        /**
         * gets icons that are registered in SimpleIconsetStore and filters based on include/exclude lists
         *
         * @returns {array}
         * @memberof SimpleIconPicker
         */
  
      }, {
        key: "_getStoredIcons",
        value: function _getStoredIcons() {
          var icons = _simpleIconset.SimpleIconsetStore && _simpleIconset.SimpleIconsetStore.iconlist ? _simpleIconset.SimpleIconsetStore.iconlist : [],
              includeSets = this.includeSets && this.includeSets.length > 0 ? babelHelpers.typeof(this.includeSets) !== babelHelpers.typeof([]) ? JSON.parse(this.includeSets) : this.includeSets : false,
              excludeSets = this.excludeSets && this.excludeSets.length > 0 ? babelHelpers.typeof(this.excludeSets) !== babelHelpers.typeof([]) ? JSON.parse(this.excludeSets) : this.excludeSets : false,
              exclude = this.exclude && this.exclude.length > 0 ? babelHelpers.typeof(this.exclude) !== babelHelpers.typeof([]) ? JSON.parse(this.exclude) : this.exclude : false;
          if (includeSets || excludeSets || exclude) icons = icons.filter(function (icon) {
            var prefix = icon,
                iconname = icon,
                include = true;
            prefix = prefix.replace(/:.*/, ""), iconname.replace("icons:", "");
            if (exclude && (exclude.includes(icon) || exclude.includes("icons:".concat(iconname)))) include = false;
            if (includeSets && !includeSets.includes(prefix)) include = false;
            if (excludeSets && excludeSets.includes(prefix)) include = false;
            return include;
          });
          return icons;
        }
        /**
         * gets a list of icons and load them in a format
         * that the simple-picker can take;
         * if no icons are provided, loads a list from iron-meta
         *
         * @param {array} a list of custom icons for the picker
         * @param {array} default list of icons for the picker
         * @param {boolean} allow a null value for the picker
         *
         */
  
      }, {
        key: "_getOptions",
        value: function _getOptions() {
          var icons = typeof this.icons === "string" ? JSON.parse(this.icons) : this.icons,
              cols = this.optionsPerRow;
          if (icons.length === 0) icons = this._getStoredIcons();
          var options = this.allowNull === false ? [] : [[{
            alt: "null",
            value: null
          }]],
              h = this.allowNull === false ? 0 : 1;
          cols = Math.sqrt(icons.length + h) <= this.optionsPerRow ? Math.ceil(Math.sqrt(icons.length + h)) : this.optionsPerRow;
  
          for (var i = 0; i < icons.length; i++) {
            var j = h + i,
                row = Math.floor(j / cols),
                col = j - row * cols;
            if (options[row] === undefined || options[row] === null) options[row] = [];
            options[row][col] = {
              alt: icons[i],
              icon: icons[i],
              value: icons[i]
            };
          }
  
          this.options = options;
        }
        /**
         * Don't set the selection option until there are options rendered
         */
  
      }, {
        key: "_setSelectedOption",
        value: function _setSelectedOption() {
          if (this.options.length > 1) babelHelpers.get(babelHelpers.getPrototypeOf(SimpleIconPicker.prototype), "_setSelectedOption", this).call(this);
        }
      }], [{
        key: "properties",
        get: // properties available to the custom element for data binding
        function get() {
          return _objectSpread(_objectSpread({}, babelHelpers.get(babelHelpers.getPrototypeOf(SimpleIconPicker), "properties", this)), {}, {
            /**
             * Allow a null option to be selected?
             */
            allowNull: {
              type: Boolean
            },
  
            /**
              * An array of icons by name: ```
            [
            "editor:format-paint",
            "content-copy",
            "av:volume-off"
            
            ]```
            */
            icons: {
              type: Array
            },
            includeSets: {
              type: Array,
              attribute: "include-sets"
            },
            excludeSets: {
              type: Array,
              attribute: "exclude-sets"
            },
            exclude: {
              type: Array,
              attribute: "exclude"
            },
  
            /**
             * The value of the option.
             */
            value: {
              type: String,
              reflect: true
            },
  
            /**
             * the maximum number of options per row
             */
            optionsPerRow: {
              type: Number
            },
  
            /**
              * An array of icons by name: ```
            [
            "editor:format-paint",
            "content-copy",
            "av:volume-off"
            
            ]```
            */
            __iconList: {
              type: Array
            }
          });
        }
        /**
         * Store the tag name to make it easier to obtain directly.
         * @notice function name must be here for tooling to operate correctly
         */
  
      }, {
        key: "tag",
        get: function get() {
          return "simple-icon-picker";
        }
      }]);
      return SimpleIconPicker;
    }(_simplePicker.SimplePicker);
  
    _exports.SimpleIconPicker = SimpleIconPicker;
    window.customElements.define(SimpleIconPicker.tag, SimpleIconPicker);
  });