text: define(["exports", "../../../../lit/index.js", "./rich-text-editor-picker.js"], function (_exports, _index, _richTextEditorPicker) {
    "use strict";
  
    Object.defineProperty(_exports, "__esModule", {
      value: true
    });
    _exports.RichTextEditorHeadingPicker = 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; } }
  
    /**
     * `rich-text-editor-heading-picker`
     * a heading picker for the rich-text-editor
     *
     * @customElement
     * @lit-html
     * @lit-element
     * @extends RichTextEditorPickerBehaviors
     * @extends LitElement
     * @element rich-text-editor-heading-picker
     * @demo ./demo/buttons.html
     */
    var RichTextEditorHeadingPicker = /*#__PURE__*/function (_RichTextEditorPicker) {
      babelHelpers.inherits(RichTextEditorHeadingPicker, _RichTextEditorPicker);
  
      var _super = _createSuper(RichTextEditorHeadingPicker);
  
      function RichTextEditorHeadingPicker() {
        var _this;
  
        babelHelpers.classCallCheck(this, RichTextEditorHeadingPicker);
        _this = _super.call(this);
        _this.allowNull = true;
        _this.hideNullOption = true;
        _this.blocks = [{
          label: "Paragraph",
          tag: "p"
        }, {
          label: "Heading 1",
          tag: "h1"
        }, {
          label: "Heading 2",
          tag: "h2"
        }, {
          label: "Heading 3",
          tag: "h3"
        }, {
          label: "Heading 4",
          tag: "h4"
        }, {
          label: "Heading 5",
          tag: "h5"
        }, {
          label: "Heading 6",
          tag: "h6"
        }, {
          label: "Preformatted",
          tag: "pre"
        }];
        _this.command = "formatBlock";
        _this.icon = undefined;
        _this.label = "Block format";
        _this.tagsList = "p,h1,h2,h3,h4,h5,h6,div,address,blockquote,pre";
        _this.titleAsHtml = undefined;
        return _this;
      }
  
      babelHelpers.createClass(RichTextEditorHeadingPicker, [{
        key: "render",
        value: // render function for template
        function render() {
          return babelHelpers.get(babelHelpers.getPrototypeOf(RichTextEditorHeadingPicker.prototype), "render", this).call(this);
        }
      }, {
        key: "labelVisibleClass",
        get: function get() {
          return "hide";
        }
      }, {
        key: "updated",
        value: function updated(changedProperties) {
          var _this2 = this;
  
          babelHelpers.get(babelHelpers.getPrototypeOf(RichTextEditorHeadingPicker.prototype), "updated", this).call(this, changedProperties);
          changedProperties.forEach(function (oldValue, propName) {
            if (propName === "blocks") _this2._setOptions();
          });
        }
        /**
         * sets picker's value based ion current selected range
         */
  
      }, {
        key: "_setRangeValue",
        value: function _setRangeValue() {
          var ancestor = this.rangeOrMatchingAncestor(),
              tag = ancestor ? ancestor.tagName : "",
              val = tag.toLowerCase();
  
          if (this.shadowRoot) {
            if (this.tagsArray.includes(val)) {
              this.shadowRoot.querySelector("#button").value = val;
            } else if (!this.range || this.range.collapsed) {
              this.shadowRoot.querySelector("#button").value = undefined;
            }
          }
        } // properties available to the custom element for data binding
  
      }, {
        key: "_setOptions",
        value:
        /**
         * overrides RichTextEditorPickerBehaviors
         * to populate picker with allowable blocks
         *
         * @memberof RichTextEditorHeadingPicker
         */
        function _setOptions() {
          this.tagsList = this.blocks.map(function (block) {
            return block.tag;
          }).join(",");
          this.options = [[{
            alt: this.label,
            value: null
          }]].concat(babelHelpers.toConsumableArray(this.blocks.map(function (block) {
            return [{
              alt: block.label,
              value: block.tag
            }];
          })));
        }
      }], [{
        key: "tag",
        get:
        /**
         * Store the tag name to make it easier to obtain directly.
         */
        function get() {
          return "rich-text-editor-heading-picker";
        }
      }, {
        key: "styles",
        get: function get() {
          return babelHelpers.toConsumableArray(babelHelpers.get(babelHelpers.getPrototypeOf(RichTextEditorHeadingPicker), "styles", this));
        }
      }, {
        key: "properties",
        get: function get() {
          var props = babelHelpers.get(babelHelpers.getPrototypeOf(RichTextEditorHeadingPicker), "properties", this);
          delete props.block;
          return _objectSpread(_objectSpread({}, props), {}, {
            /**
             * block element options as array of objects,
             * eg. [ { label: "Paragraph", tag: "p" }, { label: "Heading 1", tag: "h1" }, ...]
             *
             */
            blocks: {
              name: "blocks",
              type: Array
            }
          });
        }
      }]);
      return RichTextEditorHeadingPicker;
    }((0, _richTextEditorPicker.RichTextEditorPickerBehaviors)(_index.LitElement));
  
    _exports.RichTextEditorHeadingPicker = RichTextEditorHeadingPicker;
    window.customElements.define(RichTextEditorHeadingPicker.tag, RichTextEditorHeadingPicker);
  });