/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as i,h as t,H as e,g as s}from"./index-9ca46203.js";import{h as a,a7 as h,R as n,ay as d,aJ as l,i as r,aK as o,P as f,aL as c,aC as u,S as b,aM as v,aE as _,U as p,aN as g,a as k,I as y}from"./index-0489af72.js";import{t as m}from"./i18n-3bac791b.js";import{o as x}from"./ariaCurrentService-6fe36ebc.js";import{p as A}from"./events-29e84d75.js";import{a as L,f as j,g as w}from"./component-names-61247f2f.js";import"./i18n-fddf0324.js";const K=class{constructor(t){i(this,t),this.catchRef=t=>{this.ref=t,a(this.host,this.ref)},this.onClick=t=>{var e,a;!0===this.state._disabled?A(t):"function"==typeof(null===(e=this.state._on)||void 0===e?void 0:e.onClick)&&(t.preventDefault(),t.stopPropagation(),h(t,this.ref),null===(a=this.state._on)||void 0===a||a.onClick(t,this.state._href))},this.getRenderValues=()=>{const t="string"==typeof this.state._target&&"_self"!==this.state._target,e={href:"string"==typeof this.state._href&&this.state._href.length>0?this.state._href:"javascript:void(0);",target:"string"==typeof this.state._target&&this.state._target.length>0?this.state._target:void 0,rel:t?"noopener":void 0,download:"string"==typeof this.state._download?this.state._download:void 0};return!0!==this.state._hideLabel||this.state._label||n("[KolLink] Es muss ein Aria-Label gesetzt werden, wenn _hide-label gesetzt ist."),{isExternal:t,tagAttrs:e}},this._accessKey=void 0,this._ariaCurrentValue=void 0,this._disabled=!1,this._download=void 0,this._hideLabel=!1,this._href=void 0,this._icons=void 0,this._label=void 0,this._on=void 0,this._role=void 0,this._tabIndex=void 0,this._target=void 0,this._tooltipAlign="right",this.state={_ariaCurrentValue:"page",_href:"",_icons:{}}}render(){const{isExternal:a,tagAttrs:i}=this.getRenderValues(),s=y(this.state._label);return t(e,{key:"504f0f2fe9bed749d0847c0fbd150e76c7871bcd",class:"kol-link-wc"},t("a",Object.assign({key:"a5a83b52474683ce841ed0397e72ff8ae087af87",ref:this.catchRef},i,{accessKey:this.state._accessKey,"aria-current":this.state._ariaCurrent,"aria-disabled":this.state._disabled?"true":void 0,"aria-label":this.state._hideLabel&&"string"==typeof this.state._label?`${this.state._label}${a?` (${m("kol-open-link-in-tab")})`:""}`:void 0,class:{disabled:!0===this.state._disabled,"external-link":a,"hide-label":!0===this.state._hideLabel}},this.state._on,{onClick:this.onClick,onKeyPress:this.onClick,role:this.state._role,tabIndex:this.state._disabled?-1:this.state._tabIndex}),t(j,{key:"41a0a0a0ef71a2f54025e6c60238d2a804963584",_accessKey:this.state._accessKey,_icons:this.state._icons,_hideLabel:this.state._hideLabel,_label:s?"":this.state._label||this.state._href},t("slot",{key:"f4e727bbf7c7a9fb2fc0e19218cf516fd0910c2b",name:"expert",slot:"expert"})),a&&t(w,{class:"external-link-icon",_label:this.state._hideLabel?"":m("kol-open-link-in-tab"),_icons:"codicon codicon-link-external","aria-hidden":this.state._hideLabel})),t(L,{key:"9d203ab09e2ba58b2ed7c1999b1968d3d486367c","aria-hidden":"true",hidden:s||!this.state._hideLabel,_accessKey:this.state._accessKey,_align:this.state._tooltipAlign,_label:this.state._label||this.state._href}))}validateAccessKey(t){d(this,t)}validateAriaCurrentValue(t){l(this,t)}validateDisabled(t){r(this,t)}validateDownload(t){o(this,t)}validateHideLabel(t){f(this,t)}validateHref(t){c(this,t,{required:!0})}validateIcons(t){u(this,t)}validateLabel(t){b(this,t)}validateOn(t){v(this,t)}validateRole(t){_(this,t)}validateTabIndex(t){p(this,t)}validateTarget(t){g(this,t)}validateTooltipAlign(t){k(this,t)}componentWillLoad(){this.validateAccessKey(this._accessKey),this.validateAriaCurrentValue(this._ariaCurrentValue),this.validateDisabled(this._disabled),this.validateDownload(this._download),this.validateHideLabel(this._hideLabel),this.validateHref(this._href),this.validateIcons(this._icons),this.validateLabel(this._label),this.validateOn(this._on),this.validateRole(this._role),this.validateTabIndex(this._tabIndex),this.validateTarget(this._target),this.validateTooltipAlign(this._tooltipAlign),this.unsubscribeOnLocationChange=x((t=>{this.state._ariaCurrent=t===this.state._href?this.state._ariaCurrentValue:void 0}))}disconnectedCallback(){this.unsubscribeOnLocationChange&&this.unsubscribeOnLocationChange()}get host(){return s(this)}static get watchers(){return{_accessKey:["validateAccessKey"],_ariaCurrentValue:["validateAriaCurrentValue"],_disabled:["validateDisabled"],_download:["validateDownload"],_hideLabel:["validateHideLabel"],_href:["validateHref"],_icons:["validateIcons"],_label:["validateLabel"],_on:["validateOn"],_role:["validateRole"],_tabIndex:["validateTabIndex"],_target:["validateTarget"],_tooltipAlign:["validateTooltipAlign"]}}};export{K as kol_link_wc};