"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[6782],{37660:function(e,t,i){i.r(t),i.d(t,{HaFormString:function(){return y}});var a,s,n,o,r=i(88962),d=i(33368),u=i(71650),l=i(82390),h=i(69205),c=i(70906),m=i(91808),f=i(68144),k=i(79932),v=i(47181),p=(i(5666),i(3555),["password","secret","token"]),y=(0,m.Z)([(0,k.Mo)("ha-form-string")],(function(e,t){var i=function(t){(0,h.Z)(a,t);var i=(0,c.Z)(a);function a(){var t;(0,u.Z)(this,a);for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];return t=i.call.apply(i,[this].concat(n)),e((0,l.Z)(t)),t}return(0,d.Z)(a)}(t);return{F:i,d:[{kind:"field",decorators:[(0,k.Cb)()],key:"schema",value:void 0},{kind:"field",decorators:[(0,k.Cb)()],key:"data",value:void 0},{kind:"field",decorators:[(0,k.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,k.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,k.Cb)({type:Boolean})],key:"disabled",value:function(){return!1}},{kind:"field",decorators:[(0,k.SB)()],key:"_unmaskedPassword",value:function(){return!1}},{kind:"field",decorators:[(0,k.IO)("ha-textfield")],key:"_input",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){var e,t=this,i=p.some((function(e){return t.schema.name.includes(e)}));return(0,f.dy)(a||(a=(0,r.Z)([' <ha-textfield .type="','" .label="','" .value="','" .helper="','" helperPersistent .disabled="','" .required="','" .autoValidate="','" .name="','" .autocomplete="','" .suffix="','" .validationMessage="','" @input="','"></ha-textfield> '," "])),i?this._unmaskedPassword?"text":"password":this._stringType,this.label,this.data||"",this.helper,this.disabled,this.schema.required,this.schema.required,this.schema.name,this.schema.autocomplete,i?(0,f.dy)(s||(s=(0,r.Z)(['<div style="width:24px"></div>']))):null===(e=this.schema.description)||void 0===e?void 0:e.suffix,this.schema.required?"Required":void 0,this._valueChanged,i?(0,f.dy)(n||(n=(0,r.Z)(['<ha-icon-button toggles .label="','" @click="','" .path="','"></ha-icon-button>'])),"".concat(this._unmaskedPassword?"Hide":"Show"," password"),this._toggleUnmaskedPassword,this._unmaskedPassword?"M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z":"M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z"):"")}},{kind:"method",key:"updated",value:function(e){e.has("schema")&&this.toggleAttribute("own-margin",!!this.schema.required)}},{kind:"method",key:"_toggleUnmaskedPassword",value:function(){this._unmaskedPassword=!this._unmaskedPassword}},{kind:"method",key:"_valueChanged",value:function(e){var t=e.target.value;this.data!==t&&(""!==t||this.schema.required||(t=void 0),(0,v.B)(this,"value-changed",{value:t}))}},{kind:"get",key:"_stringType",value:function(){if(this.schema.format){if(["email","url"].includes(this.schema.format))return this.schema.format;if("fqdnurl"===this.schema.format)return"url"}return"text"}},{kind:"get",static:!0,key:"styles",value:function(){return(0,f.iv)(o||(o=(0,r.Z)([":host{display:block;position:relative}:host([own-margin]){margin-bottom:5px}ha-textfield{display:block}ha-icon-button{position:absolute;top:1em;right:12px;--mdc-icon-button-size:24px;color:var(--secondary-text-color)}ha-icon-button{inset-inline-start:initial;inset-inline-end:12px;direction:var(--direction)}"])))}}]}}),f.oi)}}]);
//# sourceMappingURL=6782-OghWucC9vXY.js.map