2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
|
export const id=8846;export const ids=[8846];export const modules={86089:(e,t,i)=>{i.d(t,{U:()=>o});const o=e=>e.stopPropagation()},32723:(e,t,i)=>{function o(e,t,i){return t.reduce(((e,t,o,r)=>{if(void 0!==e){if(!e[t]&&i){const i=r[o+1];e[t]=void 0===i||"number"==typeof i?[]:{}}return e[t]}}),e)}function r(e,t,i,r,d){const a=Array.isArray(e)?[...e]:{...e},n=r?o(a,r):a,s=d?o(a,d,!0):a;if(!Array.isArray(n)||!Array.isArray(s))return e;const l=n.splice(t,1)[0];return s.splice(i,0,l),a}i.d(t,{b:()=>r})},26874:(e,t,i)=>{i.d(t,{v:()=>o});const o=async e=>{if(navigator.clipboard)try{return void await navigator.clipboard.writeText(e)}catch(e){}const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}},25799:(e,t,i)=>{var o=i(309),r=i(34541),d=i(47838),a=i(5095),n=i(95260),s=i(14516),l=i(18394),c=i(86089);const h={key:"Mod-s",run:e=>((0,l.B)(e.dom,"editor-save"),!0)},u=e=>{const t=document.createElement("ha-icon");return t.icon=e.label,t};(0,o.Z)([(0,n.Mo)("ha-code-editor")],(function(e,t){class o extends t{constructor(...t){super(...t),e(this)}}return{F:o,d:[{kind:"field",key:"codemirror",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"mode",value:()=>"yaml"},{kind:"field",key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"autofocus",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"readOnly",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"autocomplete-entities"})],key:"autocompleteEntities",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"autocomplete-icons"})],key:"autocompleteIcons",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"error",value:()=>!1},{kind:"field",decorators:[(0,n.SB)()],key:"_value",value:()=>""},{kind:"field",key:"_loadedCodeMirror",value:void 0},{kind:"field",key:"_iconList",value:void 0},{kind:"set",key:"value",value:function(e){this._value=e}},{kind:"get",key:"value",value:function(){return this.codemirror?this.codemirror.state.doc.toString():this._value}},{kind:"get",key:"hasComments",value:function(){if(!this.codemirror||!this._loadedCodeMirror)return!1;const e=this._loadedCodeMirror.highlightingFor(this.codemirror.state,[this._loadedCodeMirror.tags.comment]);return!!this.renderRoot.querySelector(`span.${e}`)}},{kind:"method",key:"connectedCallback",value:function(){(0,r.Z)((0,d.Z)(o.prototype),"connectedCallback",this).call(this),this.hasUpdated&&this.requestUpdate(),this.addEventListener("keydown",c.U),this.codemirror&&!1!==this.autofocus&&this.codemirror.focus()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,r.Z)((0,d.Z)(o.prototype),"disconnectedCallback",this).call(this),this.removeEventListener("keydown",c.U),this.updateComplete.then((()=>{this.codemirror.destroy(),delete this.codemirror}))}},{kind:"method",key:"scheduleUpdate",value:async function(){var e;null!==(e=this._loadedCodeMirror)&&void 0!==e||(this._loadedCodeMirror=await Promise.all([i.e(2562),i.e(9146)]).then(i.bind(i,59146))),(0,r.Z)((0,d.Z)(o.prototype),"scheduleUpdate",this).call(this)}},{kind:"method",key:"update",value:function(e){if((0,r.Z)((0,d.Z)(o.prototype),"update",this).call(this,e),!this.codemirror)return void this._createCodeMirror();const t=[];e.has("mode")&&t.push({effects:this._loadedCodeMirror.langCompartment.reconfigure(this._mode)}),e.has("readOnly")&&t.push({effects:this._loadedCodeMirror.readonlyCompartment.reconfigure(this._loadedCodeMirror.EditorView.editable.of(!this.readOnly))}),e.has("_value")&&this._value!==this.value&&t.push({changes:{from:0,to:this.codemirror.state.doc.length,insert:this._value}}),t.length>0&&this.codemirror.dispatch(...t),e.has("error")&&this.classList.toggle("error-state",this.error)}},{kind:"get",key:"_mode",value:function(){return this._loadedCodeMirror.langs[this.mode]}},{kind:"method",key:"_createCodeMirror",value:function(){if(!this._loadedCodeMirror)throw new Error("Cannot create editor before CodeMirror is loaded");const e=[this._loadedC
|
||
|
//# sourceMappingURL=8846.cC5MtYNxqz4.js.map
|