text: define(["exports", "require", "../../../lit/index.js", "../../simple-colors/simple-colors.js", "../../simple-modal/simple-modal.js", "../../simple-icon/simple-icon.js", "../../simple-icon/lib/simple-icons.js"], function (_exports, _require, _index, _simpleColors, _simpleModal, _simpleIcon, _simpleIcons) {
    "use strict";
  
    Object.defineProperty(_exports, "__esModule", {
      value: true
    });
    _exports.LrnsysDialog = void 0;
    _require = _interopRequireWildcard(_require);
  
    var _templateObject_65a2e620942811ecb1937969798b231a, _templateObject2_65a2e620942811ecb1937969798b231a;
  
    function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
  
    function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || babelHelpers.typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  
    function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : 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; } }
  
    /**
    `lrnsys-dialog`
    
    * @demo demo/index.html
    */
    var LrnsysDialog = /*#__PURE__*/function (_SimpleColors) {
      babelHelpers.inherits(LrnsysDialog, _SimpleColors);
  
      var _super = _createSuper(LrnsysDialog);
  
      /**
       * HTMLElement
       */
      function LrnsysDialog() {
        var _this;
  
        babelHelpers.classCallCheck(this, LrnsysDialog);
        _this = _super.call(this);
        _this.disabled = false;
        _this.focusState = false;
        _this.avatar = "";
        _this.icon = "";
        _this.text = "";
        _this.headingClass = "white-text black";
        setTimeout(function () {
          new Promise(function (res, rej) {
            return _require.default(["../../simple-tooltip/simple-tooltip.js"], res, rej);
          });
          new Promise(function (res, rej) {
            return _require.default(["./lrnsys-button-inner.js"], res, rej);
          });
        }, 0);
        _this.__modal = window.SimpleModal.requestAvailability();
        return _this;
      }
  
      babelHelpers.createClass(LrnsysDialog, [{
        key: "render",
        value: function render() {
          return (0, _index.html)(_templateObject_65a2e620942811ecb1937969798b231a || (_templateObject_65a2e620942811ecb1937969798b231a = babelHelpers.taggedTemplateLiteral(["\n      <button\n        class=\"", "\"\n        part=\"lrnsys-dialog-button\"\n        id=\"dialogtrigger\"\n        @click=\"", "\"\n        @focus-changed=\"", "\"\n        @mousedown=\"", "\"\n        @mouseover=\"", "\"\n        @mouseout=\"", "\"\n        ?raised=\"", "\"\n        ?disabled=\"", "\"\n        title=\"", "\"\n        aria-label=\"", "\"\n      >\n        <lrnsys-button-inner\n          part=\"lrnsys-dialog-lrnsys-button-inner\"\n          avatar=\"", "\"\n          icon=\"", "\"\n          text=\"", "\"\n        >\n          <slot name=\"button\"></slot>\n        </lrnsys-button-inner>\n      </button>\n      <simple-tooltip\n        part=\"lrnsys-dialog-simple-tooltip\"\n        for=\"dialogtrigger\"\n        animation-delay=\"0\"\n        ?hidden=\"", "\"\n        >", "</simple-tooltip\n      >\n    "])), this.class, this.openDialog, this.focusToggle, this.tapEventOn, this.tapEventOn, this.tapEventOff, this.raised, this.disabled, this.alt, this.alt, this.avatar, this.icon, this.text, !this.alt, this.alt);
        }
      }, {
        key: "tapEventOn",
        value:
        /**
         * Handle a focus/tap event and add the hoverclasses
         * to the classList array for button.
         */
        function tapEventOn(e) {
          var _this2 = this;
  
          if (babelHelpers.typeof(this.hoverClass) !== (typeof undefined === "undefined" ? "undefined" : babelHelpers.typeof(undefined))) {
            var classes = this.hoverClass.split(" ");
            classes.forEach(function (item, index) {
              if (item != "") {
                _this2.shadowRoot.querySelector("#dialogtrigger").classList.add(item);
              }
            });
          }
        }
        /**
         * Handle a mouse out event and remove the hoverclasses
         * from the classList array for button.
         */
  
      }, {
        key: "tapEventOff",
        value: function tapEventOff(e) {
          var _this3 = this;
  
          if (babelHelpers.typeof(this.hoverClass) !== (typeof undefined === "undefined" ? "undefined" : babelHelpers.typeof(undefined))) {
            var classes = this.hoverClass.split(" ");
            classes.forEach(function (item, index) {
              if (item != "") {
                _this3.shadowRoot.querySelector("#dialogtrigger").classList.remove(item);
              }
            });
          }
        }
      }, {
        key: "toggleDialog",
        value: function toggleDialog() {
          this.openDialog();
        }
        /**
         * Toggle the drawer to open / close.
         */
  
      }, {
        key: "openDialog",
        value: function openDialog() {
          // assemble everything in the slot
          var nodes = this.children;
          var h = document.createElement("span");
          var c = document.createElement("span");
          var node = {};
  
          for (var i in nodes) {
            if (babelHelpers.typeof(nodes[i].tagName) !== (typeof undefined === "undefined" ? "undefined" : babelHelpers.typeof(undefined))) {
              switch (nodes[i].getAttribute("slot")) {
                case "toolbar-primary":
                case "toolbar-secondary":
                case "toolbar":
                case "header":
                  node = nodes[i].cloneNode(true);
                  node.removeAttribute("slot");
                  h.appendChild(node);
                  break;
  
                case "button":
                  // do nothing
                  break;
  
                default:
                  node = nodes[i].cloneNode(true);
                  node.removeAttribute("slot");
                  c.appendChild(node);
                  break;
              }
            }
          }
  
          var evt = new CustomEvent("simple-modal-show", {
            bubbles: true,
            composed: true,
            cancelable: true,
            detail: {
              title: this.header,
              elements: {
                header: h,
                content: c
              },
              styles: {
                "--simple-modal-width": "75vw",
                "--simple-modal-max-width": "75vw",
                "--simple-modal-z-index": "100000000",
                "--simple-modal-min-height": "50vh"
              },
              invokedBy: this.shadowRoot.querySelector("#dialogtrigger"),
              clone: true
            }
          });
          this.dispatchEvent(evt);
        }
        /**
         * Handle toggle for mouse class and manage classList array for button.
         */
  
      }, {
        key: "focusToggle",
        value: function focusToggle(e) {
          var _this4 = this;
  
          this.dispatchEvent(new CustomEvent("focus-changed", {
            bubbles: true,
            cancelable: true,
            composed: true,
            detail: {
              focus: this.focusState
            }
          })); // see if it has hover classes
  
          if (babelHelpers.typeof(this.hoverClass) !== (typeof undefined === "undefined" ? "undefined" : babelHelpers.typeof(undefined))) {
            // break class into array
            var classes = this.hoverClass.split(" "); // run through each and add or remove classes
  
            classes.forEach(function (item, index) {
              if (item != "") {
                if (_this4.focusState) {
                  _this4.shadowRoot.querySelector("#dialogtrigger").classList.add(item);
                } else {
                  _this4.shadowRoot.querySelector("#dialogtrigger").classList.remove(item);
                }
              }
            });
          }
  
          this.focusState = !this.focusState;
        }
      }], [{
        key: "styles",
        get:
        /**
         * LitElement constructable styles enhancement
         */
        function get() {
          return [].concat(babelHelpers.toConsumableArray(babelHelpers.get(babelHelpers.getPrototypeOf(LrnsysDialog), "styles", this)), [(0, _index.css)(_templateObject2_65a2e620942811ecb1937969798b231a || (_templateObject2_65a2e620942811ecb1937969798b231a = babelHelpers.taggedTemplateLiteral(["\n        :host {\n          display: inline-block;\n          --lrnsys-dialog-color: var(--simple-colors-foreground1, #000);\n          --lrnsys-dialog-background-color: var(--simple-colors-background1);\n          --lrnsys-dialog-toolbar-background-color: var(\n            --simple-colors-background3\n          );\n          --lrnsys-dialog-secondary-background-color: rgba(255, 255, 255, 0.7);\n        }\n        :host([raised]) #dialogtrigger {\n          border: 2px solid black;\n        }\n        :host([dark]) {\n          --lrnsys-dialog-toolbar-background-color: var(\n            --simple-colors-background1\n          );\n          --lrnsys-dialog-background-color: var(--simple-colors-background3);\n          --lrnsys-dialog-secondary-background-color: rgba(0, 0, 0, 0.7);\n        }\n        #dialogtrigger {\n          display: inline-block;\n          min-width: unset;\n          height: var(--lrnsys-button-height);\n          margin: var(--lrnsys-dialog-button-margin);\n          padding: var(--lrnsys-dialog-button-padding);\n          border: none;\n          background: transparent;\n        }\n        #dialogtrigger:hover {\n          cursor: pointer;\n        }\n      "])))]);
        }
      }, {
        key: "tag",
        get: function get() {
          return "lrnsys-dialog";
        }
        /**
         * LitElement / popular convention
         */
  
      }, {
        key: "properties",
        get: function get() {
          return _objectSpread(_objectSpread({}, babelHelpers.get(babelHelpers.getPrototypeOf(LrnsysDialog), "properties", this)), {}, {
            /**
             * Icon to present for clicking.
             */
            icon: {
              type: String
            },
  
            /**
             * If the button should be visually lifted off the UI.
             */
            raised: {
              type: Boolean
            },
  
            /**
             * Icon to present for clicking.
             */
            avatar: {
              type: String
            },
  
            /**
             * Text to present for clicking.
             */
            text: {
              type: String
            },
  
            /**
             * Alt / hover text for this link
             */
            alt: {
              type: String,
              reflect: true
            },
  
            /**
             * Header for the dialog
             */
            header: {
              type: String
            },
  
            /**
             * Disabled state.
             */
            disabled: {
              type: Boolean
            },
  
            /**
             * Classes to add / subtract based on the item being hovered
             */
            hoverClass: {
              type: String,
              attribute: "hover-class"
            },
  
            /**
             * Default heading classes.
             */
            headingClass: {
              type: String,
              attribute: "heading-class"
            },
  
            /**
             * Tracks if focus state is applied
             */
            focusState: {
              type: Boolean,
              attribute: "focus-state"
            }
          });
        }
      }]);
      return LrnsysDialog;
    }(_simpleColors.SimpleColors);
  
    _exports.LrnsysDialog = LrnsysDialog;
    window.customElements.define(LrnsysDialog.tag, LrnsysDialog);
  });