"use strict";const r=require("./tslib.es6-CHeFCc6E.js"),a=require("./property-DYTC_2-m.js");require("./query-assigned-elements-8EurZY45.js");const l=require("./base-element-DP9GZic2.js");/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */var e,o;const d=(o=(e=window.ShadyDOM)===null||e===void 0?void 0:e.inUse)!==null&&o!==void 0?o:!1;class n extends l.BaseElement{constructor(){super(...arguments),this.disabled=!1,this.containingForm=null,this.formDataListener=t=>{this.disabled||this.setFormData(t.formData)}}findFormElement(){if(!this.shadowRoot||d)return null;const s=this.getRootNode().querySelectorAll("form");for(const i of Array.from(s))if(i.contains(this))return i;return null}connectedCallback(){var t;super.connectedCallback(),this.containingForm=this.findFormElement(),(t=this.containingForm)===null||t===void 0||t.addEventListener("formdata",this.formDataListener)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.containingForm)===null||t===void 0||t.removeEventListener("formdata",this.formDataListener),this.containingForm=null}click(){this.formElement&&!this.disabled&&(this.formElement.focus(),this.formElement.click())}firstUpdated(){super.firstUpdated(),this.shadowRoot&&this.mdcRoot.addEventListener("change",t=>{this.dispatchEvent(new Event("change",t))})}}n.shadowRootOptions={mode:"open",delegatesFocus:!0};r.__decorate([a.n({type:Boolean})],n.prototype,"disabled",void 0);exports.FormElement=n;
