text: define(["exports","../../@polymer/polymer/polymer-element.js","../../@polymer/polymer/lib/utils/flattened-nodes-observer.js","../../@polymer/iron-form-element-behavior/iron-form-element-behavior.js","../../@polymer/iron-validatable-behavior/iron-validatable-behavior.js","../../@polymer/polymer/lib/legacy/class.js"],(function(e,t,r,o,a,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.matchesSelector=e.MtzMarkedEditor=void 0;class MtzMarkedEditor extends((0,s.mixinBehaviors)([o.IronFormElementBehavior,a.IronValidatableBehavior],t.PolymerElement)){static get template(){return t.html`
        <style>
          :host {
            display: block;
          }
        </style>
        <slot name="controls"></slot> <slot name="textarea"></slot>
        <slot name="footer"></slot>
      `}static get tag(){return"mtz-marked-editor"}static get properties(){return{...super.properties,autofocus:Boolean,readonly:Boolean,textareaSelector:{type:String,value:"textarea"},__textarea:Object}}constructor(){super(),this.addEventListener("register-control",this.__bindControlToEditor.bind(this))}connectedCallback(){super.connectedCallback(),this.__textarea=this.queryDistributedElements('[slot="textarea"]')[0]}queryDistributedElements(e){let t=r.FlattenedNodesObserver.getFlattenedNodes(this),o=[];for(let r,a=0,s=t.length;a<s&&(r=t[a]);a++)r.nodeType===Node.ELEMENT_NODE&&matchesSelector(r,e)&&o.push(r);return o}disconnectedCallback(){this.removeEventListener("register-control",this.__bindControlToEditor),super.disconnectedCallback()}getTextarea(){return this.__textarea}getLines(){return this.getContent().split(/(?=\n|\r\n)$/gm)}getContent(){return void 0!==this.getTextarea()?this.getTextarea().value:""}setContent(e){this.getTextarea().value=e}getSelection(e=this.getTextarea()){const t=e.selectionStart,r=e.selectionEnd;return{start:t,end:r,length:r-t,text:e.value.substring(t,r)}}setSelection(e,t,r=this.getTextarea()){r.selectionStart=e,r.selectionEnd=t}replaceSelection(e,t=this.getTextarea(),r=this.getSelection()){const o=t.value;t.value=`${o.substr(0,r.start)}${e}${o.substr(r.end,o.length)}`}__bindControlToEditor(e){e.stopPropagation(),e.target.__editor=this}}e.MtzMarkedEditor=MtzMarkedEditor,window.customElements.define(MtzMarkedEditor.tag,MtzMarkedEditor);const n=Element.prototype,l=n.matches||n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector,matchesSelector=function(e,t){return l.call(e,t)};e.matchesSelector=matchesSelector}));