import{d as F}from"./chunk-GJIGZB63.js";import{b as a}from"./chunk-5VDVFGVW.js";import{l as A}from"./chunk-NLMVBXFK.js";import{Ba as _,Bc as p,Ca as h,Cc as d,Eb as S,Kb as u,Lc as P,Rc as g,Sc as m,Ub as x,Vb as r,cc as o,dc as c,fc as L,gc as R,ic as C,lc as y,mb as D,nc as l,rb as i,sd as w,ud as b,vd as I,wd as v}from"./chunk-J476KISY.js";var E=()=>[];function H(t,f){if(t&1&&(o(0,"span"),p(1),g(2,"translate"),c()),t&2){let e=l(2);i(),d(m(2,1,e.linkDef.label))}}function V(t,f){if(t&1&&(o(0,"span"),p(1),c()),t&2){let e=l(2);i(),d(e.linkDef.link)}}function q(t,f){if(t&1){let e=C();o(0,"a",4),y("click",function(s){_(e);let k=l();return h(k.onLinkSelected(s))}),u(1,H,3,3,"span",5)(2,V,2,1,"span",5),c()}if(t&2){let e=l();r("routerLink",e.linkDef.link||P(6,E))("queryParams",e.linkDef.queryParams)("ngClass",e.linkDef.styleCss),x("id",e.linkId),i(),r("ngIf",e.linkDef.label),i(),r("ngIf",e.linkDef.link&&!e.linkDef.label)}}function G(t,f){if(t&1&&(o(0,"span"),p(1),g(2,"translate"),c()),t&2){let e=l(2);i(),d(m(2,1,e.linkDef.label))}}function M(t,f){if(t&1&&(o(0,"span"),p(1),c()),t&2){let e=l(2);i(),d(e.linkDef.href)}}function N(t,f){if(t&1){let e=C();o(0,"a",6),y("click",function(s){_(e);let k=l();return h(k.onLinkSelected(s))}),u(1,G,3,3,"span",5)(2,M,2,1,"span",5),c()}if(t&2){let e=l();r("href",e.linkDef.href,D)("ngClass",e.linkDef.styleCss),x("id",e.linkId),i(),r("ngIf",e.linkDef.label),i(),r("ngIf",e.linkDef.href&&!e.linkDef.label)}}function O(t,f){if(t&1&&(o(0,"span"),p(1),g(2,"translate"),c()),t&2){let e=l();i(),d(m(2,1,e.linkDef.label))}}var j=(()=>{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),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){if(this.agGridHandler&&(e||n)){let s=this.agGridHandler.settings?.id,k=s?`${s}-`:"",T=!e||e==="undefined"?n:e;this.linkId=`ag-router-link-${k}${T}`;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=S({type:t,selectors:[["paw-ag-router-link-renderer"]],standalone:!1,decls:4,vars:4,consts:[[3,"ngSwitch"],[3,"routerLink","queryParams","ngClass","click",4,"ngSwitchCase"],["target","_blank",3,"href","ngClass","click",4,"ngSwitchCase"],[4,"ngSwitchCase"],[3,"click","routerLink","queryParams","ngClass"],[4,"ngIf"],["target","_blank",3,"click","href","ngClass"]],template:function(n,s){n&1&&(L(0,0),u(1,q,3,7,"a",1)(2,N,3,5,"a",2)(3,O,3,3,"span",3),R()),n&2&&(r("ngSwitch",s.state.type),i(),r("ngSwitchCase","link"),i(),r("ngSwitchCase","href"),i(),r("ngSwitchCase","label"))},dependencies:[w,b,I,v,A,F],styles:["[_nghost-%COMP%]   a[_ngcontent-%COMP%]{color:var(--paw-text-link);text-decoration:none;font-weight:500}[_nghost-%COMP%]   a.paw-text-primary[_ngcontent-%COMP%]{color:var(--paw-text-primary)!important;cursor:default}"]})}}return t})();export{j as a};
