import{r as s,c as t,h as i}from"./p-b891c2f1.js";import{c as h}from"./p-9a3745a6.js";import{o as e}from"./p-494248b1.js";import"./p-6fd3642a.js";import"./p-aafd8ea4.js";import"./p-112455b1.js";import"./p-1c2e2695.js";const a=class{constructor(i){s(this,i),this.scChange=t(this,"scChange",7),this.scUpdateOrderState=t(this,"scUpdateOrderState",7),this.scClear=t(this,"scClear",7),this.scInput=t(this,"scInput",7),this.scFocus=t(this,"scFocus",7),this.scBlur=t(this,"scBlur",7),this.scUpdateCustomer=t(this,"scUpdateCustomer",7),this.size="medium",this.value="",this.pill=!1,this.showLabel=!0,this.help="",this.disabled=!1,this.readonly=!1,this.required=!1,this.invalid=!1}async reportValidity(){return this.input.reportValidity()}async handleChange(){var s;this.value=this.input.value;try{const t=await h({id:null===(s=this.order)||void 0===s?void 0:s.id,data:{name:this.input.value}});this.scUpdateOrderState.emit(t)}catch(s){console.error(s)}}handleSessionChange(s){(null==s?void 0:s.name)&&s.name!==this.value&&(this.value=null==s?void 0:s.name)}render(){var s;return i("sc-input",{type:"text",name:"name",ref:s=>this.input=s,value:(null===(s=this.customer)||void 0===s?void 0:s.name)||this.value,disabled:!!this.loggedIn,label:this.label,help:this.help,autocomplete:"name",placeholder:this.placeholder,readonly:this.readonly,required:this.required,invalid:this.invalid,autofocus:this.autofocus,hasFocus:this.hasFocus,onScChange:()=>this.handleChange(),onScInput:()=>this.scInput.emit(),onScFocus:()=>this.scFocus.emit(),onScBlur:()=>this.scBlur.emit()})}static get watchers(){return{order:["handleSessionChange"]}}};e(a,["order","customer"],!1);export{a as sc_customer_name}