var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component, Host, h, Element, Prop, Event, Watch, Method } from '@stencil/core';
import { InjectVegaGlobalSlimmer, InjectVegaSlimmer, methodPlaceholder, } from 'vega-slimmer/core';
import { VegaComponentUsageRuntimeMetricsSlimmer } from '../../../helpers/slimmers/component-usage-runtime-metrics';
import { sanitizeVegaComponent } from '../../../utils/component';
import { VegaRichTextLinkEditorRenderer } from './slimmers/renderers/vega-rich-text-link-editor-renderer';
import { createEventEmitSlimmer, } from '../../../helpers/event-manager/slimmers/event-emit-slimmer';
import { VegaChange } from '../../../helpers/event-manager/event-id/vega-event-id';
import { TranslationSlimmer } from '../../../helpers/slimmers/translation';
/**
 * This is an internal used component and shouldn't be used by clients,
 *    it doesn't show up in storybook either.
 *
 * @vegaVersion 2.34.0
 */
export class VegaRichTextLinkEditor {
  constructor() {
    this.globalSlimmers = {};
    this.translationSlimmer = new TranslationSlimmer();
    this.vegaComponentUsageRuntimeMetricsSlimmer = new VegaComponentUsageRuntimeMetricsSlimmer();
    this.renderer = new VegaRichTextLinkEditorRenderer();
    this.changeEventEmitter = createEventEmitSlimmer(VegaRichTextLinkEditor, VegaChange);
    /**
     * Specifies the status of the link editor
     *
     * @vegaVersion 2.34.0
     */
    // eslint-disable-next-line @stencil/strict-mutable
    this.status = 'editOrUnlinkSelection';
    /**
     * Specifies whether the status will be reset after hide the popover
     *
     * @vegaVersion 2.34.0
     */
    this.resetStatusAfterHide = true;
  }
  watchStatusChange() {
    methodPlaceholder();
  }
  watchTargetChange() {
    methodPlaceholder();
  }
  /**
   * Provide a method to show the link editor popover
   *
   * @vegaVersion 2.34.0
   */
  async show() {
    await this.renderer.getPopoverRef().show();
  }
  render() {
    return sanitizeVegaComponent(h(Host, null, this.renderer.render()), this.host);
  }
  static get is() { return "vega-rich-text-link-editor"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["vega-rich-text-link-editor.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["vega-rich-text-link-editor.css"]
  }; }
  static get properties() { return {
    "status": {
      "type": "string",
      "mutable": true,
      "complexType": {
        "original": "VegaRichTextLinkEditorStatus",
        "resolved": "\"editOrUnlinkSelection\" | \"linkEdit\"",
        "references": {
          "VegaRichTextLinkEditorStatus": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.34.0"
          }],
        "text": "Specifies the status of the link editor"
      },
      "attribute": "status",
      "reflect": false,
      "defaultValue": "'editOrUnlinkSelection'"
    },
    "record": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "VegaRTELinkEditorRecord",
        "resolved": "{ text: string; url: string; }",
        "references": {
          "VegaRTELinkEditorRecord": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.34.0"
          }],
        "text": "Specifies the hyperlink editor record"
      }
    },
    "resetStatusAfterHide": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.34.0"
          }],
        "text": "Specifies whether the status will be reset after hide the popover"
      },
      "attribute": "reset-status-after-hide",
      "reflect": false,
      "defaultValue": "true"
    },
    "target": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "HTMLElement",
        "resolved": "HTMLElement",
        "references": {
          "HTMLElement": {
            "location": "global"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.34.0"
          }],
        "text": "Specifies the target element for the popover."
      }
    }
  }; }
  static get events() { return [{
      "method": "vegaChange",
      "name": "vegaChange",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.34.0"
          }],
        "text": "An event emitter notifying content change."
      },
      "complexType": {
        "original": "VegaRichTextLinkEditorChangeDetail",
        "resolved": "{ action: \"link\"; payload: VegaRTELinkEditorRecord; } | { action: \"unlink\"; }",
        "references": {
          "VegaRichTextLinkEditorChangeDetail": {
            "location": "import",
            "path": "./types"
          }
        }
      }
    }, {
      "method": "change",
      "name": "change",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [{
            "name": "vegaVersion",
            "text": "2.34.0"
          }],
        "text": "An event emitter notifying content change."
      },
      "complexType": {
        "original": "VegaRichTextLinkEditorChangeDetail",
        "resolved": "{ action: \"link\"; payload: VegaRTELinkEditorRecord; } | { action: \"unlink\"; }",
        "references": {
          "VegaRichTextLinkEditorChangeDetail": {
            "location": "import",
            "path": "./types"
          }
        }
      }
    }]; }
  static get methods() { return {
    "show": {
      "complexType": {
        "signature": "() => Promise<void>",
        "parameters": [],
        "references": {
          "Promise": {
            "location": "global"
          }
        },
        "return": "Promise<void>"
      },
      "docs": {
        "text": "Provide a method to show the link editor popover",
        "tags": [{
            "name": "vegaVersion",
            "text": "2.34.0"
          }]
      }
    }
  }; }
  static get elementRef() { return "host"; }
  static get watchers() { return [{
      "propName": "status",
      "methodName": "watchStatusChange"
    }, {
      "propName": "target",
      "methodName": "watchTargetChange"
    }]; }
}
__decorate([
  InjectVegaGlobalSlimmer()
], VegaRichTextLinkEditor.prototype, "globalSlimmers", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaRichTextLinkEditor.prototype, "translationSlimmer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaRichTextLinkEditor.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaRichTextLinkEditor.prototype, "renderer", void 0);
__decorate([
  InjectVegaSlimmer()
], VegaRichTextLinkEditor.prototype, "changeEventEmitter", void 0);
