import{d as H,f as E}from"./chunk-V67SIXYX.js";import{b as T,c as V}from"./chunk-TO2CSN4Q.js";import{c as a,d as O}from"./chunk-YADAVUVK.js";import{l as F}from"./chunk-AVXTYPYF.js";import{$b as r,Ad as R,Cd as b,Dd as v,Ed as A,Ha as h,Hc as f,Ia as C,Ic as k,Kb as P,Qb as g,Rc as L,Td as M,Yc as u,Zc as m,ic as l,jc as c,lc as S,mc as w,oc as x,od as q,rc as y,sb as I,tc as o,xb as i}from"./chunk-HEIW4SFT.js";O();q();M();V();E();var G=()=>[];function N(t,d){if(t&1&&(l(0,"span"),f(1),u(2,"translate"),c()),t&2){let e=o(2);i(),k(m(2,1,e.linkDef.label))}}function B(t,d){if(t&1&&(l(0,"span"),f(1),c()),t&2){let e=o(2);i(),k(e.linkDef.link)}}function Q(t,d){if(t&1){let e=x();l(0,"a",4),y("click",function(s){h(e);let p=o();return C(p.onLinkSelected(s))}),l(1,"button",5),g(2,N,3,3,"span",6)(3,B,2,1,"span",6),c()()}if(t&2){let e=o();r("pawId",e.linkId)("routerLink",e.linkDef.link||L(8,G))("queryParams",e.linkDef.queryParams)("queryParamsHandling",e.linkDef.queryParamsHandling)("ngClass",e.linkDef.styleCss),i(),r("pawId","grid-link-btn-"+e.linkId),i(),r("ngIf",e.linkDef.label),i(),r("ngIf",e.linkDef.link&&!e.linkDef.label)}}function U(t,d){if(t&1&&(l(0,"span"),f(1),u(2,"translate"),c()),t&2){let e=o(2);i(),k(m(2,1,e.linkDef.label))}}function $(t,d){if(t&1&&(l(0,"span"),f(1),c()),t&2){let e=o(2);i(),k(e.linkDef.href)}}function j(t,d){if(t&1){let e=x();l(0,"a",7),y("click",function(s){h(e);let p=o();return C(p.onLinkSelected(s))}),l(1,"button",5),g(2,U,3,3,"span",6)(3,$,2,1,"span",6),c()()}if(t&2){let e=o();r("pawId",e.linkId)("href",e.linkDef.href,I)("ngClass",e.linkDef.styleCss),i(),r("pawId","grid-link-btn-"+e.linkId),i(),r("ngIf",e.linkDef.label),i(),r("ngIf",e.linkDef.href&&!e.linkDef.label)}}function z(t,d){if(t&1&&(l(0,"span"),f(1),u(2,"translate"),c()),t&2){let e=o();i(),k(m(2,1,e.linkDef.label))}}var ie=(()=>{class t{static get agRenderer(){return!0}static{this.allowTooltip=!0}constructor(){this.linkDef={},this.link=[],this.state={type:null},this.linkId=null}agInit(e){this.setAgGridHandler(e.colDef?.cellRendererParams.agGridHandler),this.setLinkId(e.node.id,e.node.rowIndex,e.colDef?.field??e.colDef?.colId),this.setLinkLabelFromParams(e)}refresh(e){return this.setLinkLabelFromParams(e),!0}setLinkLabelFromParams(e){if(!a.isSet(e.colDef)||!a.isSet(e.colDef.cellRendererParams)||!a.isSet(e.data))return;let n=e.colDef.cellRendererParams;if(a.isFunction(n.getParams)){this.linkDef=n.getParams(e.data),this.calcState();return}a.isFunction(n.getLabel)&&(this.linkDef.label=n.getLabel(e.data)),a.isFunction(n.getLink)&&(this.linkDef.link=n.getLink(e.data)),a.isFunction(n.getHref)&&(this.linkDef.href=n.getHref(e.data)),a.isFunction(n.getQueryParams)&&(this.linkDef.queryParams=n.getQueryParams(e.data)),a.isFunction(n.getStyleCss)&&(this.linkDef.styleCss=n.getStyleCss(e.data)),this.calcState()}onLinkSelected(e){a.isFunction(this.linkDef.onSelected)&&this.linkDef.onSelected(e)}setAgGridHandler(e){this.agGridHandler=e}setLinkId(e,n,s){if(this.agGridHandler&&(e||n)){let p=this.agGridHandler.settings?.id,D=[p?`${p}`:void 0,!e||e==="undefined"?n:e,s||""].filter(_=>_!=null&&_!=="").join("-");this.linkId=`ag-router-link${D?"-"+D:""}`;return}this.linkId=null}calcState(){if(this.linkDef?.link||this.linkDef?.queryParams){this.state.type="link";return}if(this.linkDef?.href){this.state.type="href";return}if(this.linkDef?.label){this.state.type="label";return}this.state.type=null}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=P({type:t,selectors:[["paw-ag-router-link-renderer"]],standalone:!1,decls:4,vars:4,consts:[[3,"ngSwitch"],[3,"pawId","routerLink","queryParams","queryParamsHandling","ngClass","click",4,"ngSwitchCase"],["target","_blank",3,"pawId","href","ngClass","click",4,"ngSwitchCase"],[4,"ngSwitchCase"],[3,"click","pawId","routerLink","queryParams","queryParamsHandling","ngClass"],[3,"pawId"],[4,"ngIf"],["target","_blank",3,"click","pawId","href","ngClass"]],template:function(n,s){n&1&&(S(0,0),g(1,Q,4,9,"a",1)(2,j,4,6,"a",2)(3,z,3,3,"span",3),w()),n&2&&(r("ngSwitch",s.state.type),i(),r("ngSwitchCase","link"),i(),r("ngSwitchCase","href"),i(),r("ngSwitchCase","label"))},dependencies:[R,b,v,A,F,T,H],styles:["[_nghost-%COMP%]   a[_ngcontent-%COMP%]{color:var(--paw-text-link);text-decoration:none;font-weight:500}[_nghost-%COMP%]   a[_ngcontent-%COMP%] > button[_ngcontent-%COMP%]{background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;cursor:inherit}[_nghost-%COMP%]   a.paw-text-primary[_ngcontent-%COMP%]{color:var(--paw-text-primary)!important;cursor:default}"]})}}return t})();export{ie as a};
