"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[2230],{3393(t,e,i){i.d(e,{y:()=>r});var s=i(9696),a=i(79365),n=i(81365);const r=(...t)=>(0,s.Zz)(a.XX,a._$,a.yF,a.jd)((0,n.q)(...t))},29172(t,e,i){var s=i(25964),a=i(3393),n=i(97810);const r=(0,n.xE)("mapping-item"),o=["size","bordered","readonly","full-width","disabled","st-error-message-icon","st-error-message-icon-size","st-error-message-icon-padding"],u=(0,a.y)({componentName:r,baseSelector:"div"});customElements.define(r,class extends u{static get observedAttributes(){return[].concat(u.observedAttributes||[],o,["separator","options","invalid","disabled"])}get separator(){return this.getAttribute("separator")||"map to"}get value(){const t=this.attributeInput.value,e=this.valueInput.value;return t&&e?{[t]:e}:null}set value(t){if(1!==Object.entries(t).length)return void console.error("descope-mapping item expected expects only one key-value pair in the value but received: ",t);const[e,i]=Object.entries(t)[0];this.valueInput.value=i,this.attributeInput.value=e,this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n      <div class="wrapper" part="wrapper">\n        <descope-text-field required="true"></descope-text-field>\n        <div class="separator" part="separator">${this.separator}</div>\n        <descope-combo-box\n          item-label-path="data-name"\n          item-value-path="data-id"\n          required="true"\n        >\n        </descope-combo-box>\n        <descope-button variant="link" mode="primary">\n          <vaadin-icon icon="vaadin:minus"></vaadin-icon>\n        </descope-button>\n      </div>\n\t`,(0,s.fz)("\n        .wrapper {\n          display: flex;\n        }\n        .separator {\n          text-align: center;\n          flex-shrink: 0;\n        }\n    ",this),this.valueInput=this.shadowRoot.querySelector("descope-text-field"),this.attributeInput=this.shadowRoot.querySelector("descope-combo-box"),this.inputs=[this.valueInput,this.attributeInput],this.removeButton=this.shadowRoot.querySelector("descope-button"),(0,n.EA)(this,this.valueInput,{includeAttrs:o}),(0,n.EA)(this,this.attributeInput,{includeAttrs:[...o,"options"],mapAttrs:{options:"data"}}),(0,n.EA)(this,this.removeButton,{includeAttrs:["disabled"]})}initRemoveButton(){this.removeButton.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("mapping-item-removed",{bubbles:!0,composed:!0})))}init(){super.init?.(),this.initRemoveButton()}getValidity(){const t=this.attributeInput.value,e=this.valueInput.value;return t&&e?{}:{badInput:!0}}reportValidity(){this.inputs.forEach(t=>t.reportValidity())}focus(){(this.checkValidity()||!this.valueInput.checkValidity()?this.valueInput:this.attributeInput).focus()}handleSeparatorChange(){this.shadowRoot.querySelector(".separator").textContent=this.separator}#t(t){"true"===t&&(this.valueInput.value||(this.valueInput.setAttribute("invalid","true"),this.valueInput.setAttribute("error-message",this.defaultErrorMsgValueMissing)),this.attributeInput.value||(this.attributeInput.setAttribute("invalid","true"),this.attributeInput.setAttribute("error-message",this.defaultErrorMsgValueMissing)))}attributeChangedCallback(t,e,i){super.attributeChangedCallback?.(t,e,i),"separator"===t&&this.handleSeparatorChange(),"invalid"===t&&this.#t(i)}})}}]);
//# sourceMappingURL=mapping-fields-descope-mappings-field-descope-mapping-item-index-js.js.map