import{r as t,c as s,h as i,H as e,g as a}from"./p-ClISz4NF.js";import{v as o}from"./p-NOJjz9dT.js";import{g as h}from"./p-CoD1xawt.js";import{p as c}from"./p-CQvUntGY.js";import{S as r}from"./p-BcQO4NH2.js";import{B as n,a as f}from"./p-Bo1ROm5Q.js";import{c as d}from"./p-vN03FcXN.js";import{p as l}from"./p-GYov8gU1.js";import{i as p}from"./p-CzXeijOj.js";import{A as b,a as m}from"./p-Bz_RzYFb.js";import"./p-CgDnDrq5.js";import"./p-U40vKHrs.js";const v=c(r,["_XS","_S","_M"]);var g;(function(t){t["SOLID"]="solid";t["OUTLINED"]="outlined"})(g||(g={}));var j;(function(t){t["A"]="a";t["SPAN"]="span";t["BUTTON"]="button"})(j||(j={}));const u={root:"gov-chip",hasRight:"gov-chip--has-right",hasLeft:"gov-chip--has-left"};const y=class{constructor(i){t(this,i);this.govClick=s(this,"gov-click");this.hydrated=false;this.disabled=false;this.size=v._M;this.tag="span";this.color=n.PRIMARY;this.focusable=true;this.inheritedAttributes={};this.h=h(this.host);this.chipId=d("GovChip")}validateColor(t){o(n,t,u.root)}validateSize(t){o(f,t,u.root)}componentWillLoad(){this.validateColor(this.color);this.validateSize(this.size);this.inheritedAttributes=p(this.host)}componentDidLoad(){this.attributeObserver=new b(this.host,((t,s)=>{this.onAriaAttributeChange(t,s)}));this.attributeObserver.startObserving(m)}disconnectedCallback(){var t;(t=this.attributeObserver)===null||t===void 0?void 0:t.stopObserving()}connectedCallback(){this.hydrated=true}onAriaAttributeChange(t,s){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:s})}render(){const t=this.href?j.A:this.tag;const s=t==j.BUTTON?j.BUTTON:undefined;const a=l(this.iconStart);const o=l(this.iconEnd);return i(e,{key:"ef86316065b17ea753e6f46944203be579c9669c",class:this.h.classes([u.root,this.h.hasSlot("right")?u.hasRight:undefined,this.h.hasSlot("left")?u.hasLeft:undefined]),disabled:this.disabled,href:this.href,color:this.color,type:this.type,size:this.size,focusable:this.focusable,hydrated:this.hydrated},i(t,Object.assign({key:"0ecb833e5c5f4e30914d9f12764b78bfd22973b6",class:"element",href:this.href,target:this.target,ref:t=>this.triggerRef=t,onClick:this.onClickHandler.bind(this),tabindex:this.h.hasSlot("left")||this.h.hasSlot("right")||this.disabled||!this.focusable?"-1":"0",id:this.identifier||this.chipId,type:s},this.inheritedAttributes,{"aria-disabled":this.disabled}),i("slot",{key:"9793b743f288573932aec95f68c0f1b1bb617add",name:"left"}),i("slot",{key:"be7cc7cb0a94c666faf842d8ee70701245305001",name:"icon-start"},a&&i("gov-icon",{key:"464ebc3d08b609a17e5e126eca9b0fb8eefc2bd4",type:a.type,name:a.name})),i("slot",{key:"faffc742599b65f40b61b8cbd45e32891f43a869"}),i("slot",{key:"dce2fa1d55332f8cc3d51e8a11e56735f5bcf683",name:"icon-end"},o&&i("gov-icon",{key:"afc841c471bc376cc650150e168d307f3393ef15",type:o.type,name:o.name})),i("slot",{key:"16dc2b17d2b813c2ced12ae44c12d621a82c6cb5",name:"right"})))}onClickHandler(t){t.stopPropagation();if(this.disabled===false&&this.tag===j.BUTTON){this.govClick.emit(t)}}async geRef(){return this.triggerRef}async setFocus(){this.triggerRef.focus()}get host(){return a(this)}static get watchers(){return{color:["validateColor"],size:["validateSize"]}}};export{y as gov_chip};
//# sourceMappingURL=p-e1b2af6b.entry.js.map