import{a as Bt,d as Ft,e as Rt,f as Kt,g as $t}from"./chunk-7CY5UVL4.js";import{d as kt}from"./chunk-YHXZO4DY.js";import{a as Vt,b as Ze}from"./chunk-N4NZWFKH.js";import{a as At,b as je}from"./chunk-XULGDGRO.js";import{b as Ot}from"./chunk-LL4377Z2.js";import{h as Pt}from"./chunk-BXA2JYKG.js";import{b as ze,c as qe,f as Qe}from"./chunk-G7E24J2R.js";import{b as Nt}from"./chunk-5TTXT2K2.js";import{a as N}from"./chunk-U5Y75IZ5.js";import{b as wt,c as Et,d as $e,e as St,i as He,j as Ue}from"./chunk-2MELUOYA.js";import{D as yt,E as Be,Ea as Lt,H as vt,L as Ct,O as Tt,X as Fe,_ as O,b as xt,d as Oe,ea as Re,fa as Ke,h as Ve,la as Mt,n as It,q as Ae,s as bt,sa as Dt,va as fe,wa as ne,x as ee,y as te}from"./chunk-WOPE6PPO.js";import{E as gt,c as ut,h as _t,o as ht}from"./chunk-MDIMQ3H3.js";import{a as mt}from"./chunk-3DEA4WWC.js";import{n as pt,q as ft}from"./chunk-TKVDP62Z.js";import{Ab as De,Ad as Y,Bb as P,Bc as Se,Bd as J,Ca as f,Cc as ue,Da as Ce,Db as k,Dc as _e,Ec as R,Fa as w,Gb as Le,Ha as se,Hb as Ee,Ib as l,Jb as u,Ka as tt,Kb as _,La as H,Lb as C,Pb as Z,Qb as j,Qc as A,Rb as G,Sa as Te,Tc as Ne,Ua as nt,Ub as E,Ud as ct,Vd as dt,Xb as y,Xd as ke,Yc as X,Za as d,Zb as a,ab as U,ac as le,ad as he,bc as W,cc as T,db as z,dc as M,dd as rt,eb as b,fd as K,gd as $,hc as S,ib as q,jb as ae,jc as it,kb as Q,kc as ce,lc as h,ma as Je,mc as V,na as et,nb as Me,nc as ot,nd as st,oa as re,ob as x,oc as F,pa as ye,pd as at,qd as lt,ra as L,rc as de,rd as Pe,sc as me,sd as ge,tc as pe,va as m,wa as p,wb as we,xa as ve,xb as D}from"./chunk-GJDGQISV.js";import{a as B,b as oe}from"./chunk-SNAKHGZS.js";var Ht=`
    .p-contextmenu {
        background: dt('contextmenu.background');
        color: dt('contextmenu.color');
        border: 1px solid dt('contextmenu.border.color');
        border-radius: dt('contextmenu.border.radius');
        box-shadow: dt('contextmenu.shadow');
        min-width: 12.5rem;
    }

    .p-contextmenu-root-list,
    .p-contextmenu-submenu {
        margin: 0;
        padding: dt('contextmenu.list.padding');
        list-style: none;
        outline: 0 none;
        display: flex;
        flex-direction: column;
        gap: dt('contextmenu.list.gap');
    }

    .p-contextmenu-submenu {
        position: absolute;
        display: flex;
        flex-direction: column;
        min-width: 100%;
        z-index: 1;
        background: dt('contextmenu.background');
        color: dt('contextmenu.color');
        border: 1px solid dt('contextmenu.border.color');
        border-radius: dt('contextmenu.border.radius');
        box-shadow: dt('contextmenu.shadow');
    }

    .p-contextmenu-item {
        position: relative;
    }

    .p-contextmenu-item-content {
        transition:
            background dt('contextmenu.transition.duration'),
            color dt('contextmenu.transition.duration');
        border-radius: dt('contextmenu.item.border.radius');
        color: dt('contextmenu.item.color');
    }

    .p-contextmenu-item-link {
        cursor: pointer;
        display: flex;
        align-items: center;
        text-decoration: none;
        overflow: hidden;
        position: relative;
        color: inherit;
        padding: dt('contextmenu.item.padding');
        gap: dt('contextmenu.item.gap');
        user-select: none;
    }

    .p-contextmenu-item-label {
        line-height: 1;
    }

    .p-contextmenu-item-icon {
        color: dt('contextmenu.item.icon.color');
    }

    .p-contextmenu-submenu-icon {
        color: dt('contextmenu.submenu.icon.color');
        margin-left: auto;
        font-size: dt('contextmenu.submenu.icon.size');
        width: dt('contextmenu.submenu.icon.size');
        height: dt('contextmenu.submenu.icon.size');
    }

    .p-contextmenu-submenu-icon:dir(rtl) {
        margin-left: 0;
        margin-right: auto;
    }

    .p-contextmenu-item.p-focus > .p-contextmenu-item-content {
        color: dt('contextmenu.item.focus.color');
        background: dt('contextmenu.item.focus.background');
    }

    .p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-item-icon {
        color: dt('contextmenu.item.icon.focus.color');
    }

    .p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
        color: dt('contextmenu.submenu.icon.focus.color');
    }

    .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover {
        color: dt('contextmenu.item.focus.color');
        background: dt('contextmenu.item.focus.background');
    }

    .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-item-icon {
        color: dt('contextmenu.item.icon.focus.color');
    }

    .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-submenu-icon {
        color: dt('contextmenu.submenu.icon.focus.color');
    }

    .p-contextmenu-item-active > .p-contextmenu-item-content {
        color: dt('contextmenu.item.active.color');
        background: dt('contextmenu.item.active.background');
    }

    .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-item-icon {
        color: dt('contextmenu.item.icon.active.color');
    }

    .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
        color: dt('contextmenu.submenu.icon.active.color');
    }

    .p-contextmenu-separator {
        border-block-start: 1px solid dt('contextmenu.separator.border.color');
    }

    .p-contextmenu-mobile .p-contextmenu-submenu {
        position: static;
        box-shadow: none;
        border: 0 none;
        padding-inline-start: dt('tieredmenu.submenu.mobile.indent');
        padding-inline-end: 0;
    }

    .p-contextmenu-mobile .p-contextmenu-submenu-icon {
        transition: transform 0.2s;
        transform: rotate(90deg);
    }

    .p-contextmenu-mobile .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
        transform: rotate(-90deg);
    }
`;var Jt=["sublist"],en=(o,r)=>({instance:o,processedItem:r}),zt=()=>({class:"p-contextmenu-submenu-icon"}),tn=()=>({exact:!1}),nn=o=>({$implicit:o});function on(o,r){if(o&1&&C(0,"li",8),o&2){let e=a().$implicit,t=a(2);ce(t.getItemProp(e,"style")),h(t.cn(t.cx("separator"),t.getItemProp(e,"styleClass"))),l("pBind",t._ptm("separator")),D("id",t.getItemId(e))}}function rn(o,r){if(o&1&&C(0,"span",19),o&2){let e=a(4),t=e.$implicit,n=e.index,i=a(2);h(i.cn(i.cx("itemIcon"),i.getItemProp(t,"icon"),i.getItemProp(t,"iconClass"))),l("ngStyle",i.getItemProp(t,"iconStyle"))("pBind",i.getPTOptions(t,n,"itemIcon")),D("aria-hidden",!0)("tabindex",-1)}}function sn(o,r){if(o&1&&(u(0,"span",19),V(1),_()),o&2){let e=a(4),t=e.$implicit,n=e.index,i=a(2);h(i.cn(i.cx("itemLabel"),i.getItemProp(t,"labelClass"))),l("ngStyle",i.getItemProp(t,"labelStyle"))("pBind",i.getPTOptions(t,n,"itemLabel")),d(),F(" ",i.getItemLabel(t)," ")}}function an(o,r){if(o&1&&C(0,"span",20),o&2){let e=a(4),t=e.$implicit,n=e.index,i=a(2);h(i.cn(i.cx("itemLabel"),i.getItemProp(t,"labelClass"))),l("ngStyle",i.getItemProp(t,"labelStyle"))("innerHTML",i.getItemLabel(t),Te)("pBind",i.getPTOptions(t,n,"itemLabel"))}}function ln(o,r){if(o&1&&C(0,"p-badge",21),o&2){let e=a(4).$implicit,t=a(2);h(t.getItemProp(e,"badgeStyleClass")),l("value",t.getItemProp(e,"badge"))("unstyled",t.unstyled())}}function cn(o,r){if(o&1&&(ve(),C(0,"svg",24)),o&2){let e=a(5),t=e.$implicit,n=e.index,i=a(2);h(i.cx("submenuIcon")),l("pBind",i.getPTOptions(t,n,"submenuIcon")),D("aria-hidden",!0)}}function dn(o,r){}function mn(o,r){o&1&&x(0,dn,0,0,"ng-template",25),o&2&&we("aria-hidden",!0)}function pn(o,r){if(o&1&&(Z(0),x(1,cn,1,4,"svg",22)(2,mn,1,1,null,23),j()),o&2){let e=a(6);d(),l("ngIf",!e.contextMenu.submenuIconTemplate&&!e.contextMenu._submenuIconTemplate),d(),l("ngTemplateOutlet",e.contextMenu.submenuIconTemplate||e.contextMenu._submenuIconTemplate)("ngTemplateOutletContext",ue(3,zt))}}function un(o,r){if(o&1&&(u(0,"a",15),x(1,rn,1,6,"span",16)(2,sn,2,5,"span",17)(3,an,1,5,"ng-template",null,2,A)(5,ln,1,4,"p-badge",18)(6,pn,3,4,"ng-container",11),_()),o&2){let e=S(4),t=a(3),n=t.$implicit,i=t.index,s=a(2);h(s.cn(s.cx("itemLink"),s.getItemProp(n,"linkClass"))),l("target",s.getItemProp(n,"target"))("ngStyle",s.getItemProp(n,"linkStyle"))("pBind",s.getPTOptions(n,i,"itemLink")),D("href",s.getItemProp(n,"url"),nt)("data-automationid",s.getItemProp(n,"automationId"))("title",s.getItemProp(n,"title"))("tabindex",-1),d(),l("ngIf",s.getItemProp(n,"icon")),d(),l("ngIf",s.getItemProp(n,"escape"))("ngIfElse",e),d(3),l("ngIf",s.getItemProp(n,"badge")),d(),l("ngIf",s.isItemGroup(n))}}function _n(o,r){if(o&1&&C(0,"span",19),o&2){let e=a(4),t=e.$implicit,n=e.index,i=a(2);h(i.cn(i.cx("itemIcon"),i.getItemProp(t,"icon"),i.getItemProp(t,"iconClass"))),l("ngStyle",i.getItemProp(t,"iconStyle"))("pBind",i.getPTOptions(t,n,"itemIcon")),D("aria-hidden",!0)("tabindex",-1)}}function hn(o,r){if(o&1&&(u(0,"span",19),V(1),_()),o&2){let e=a(4),t=e.$implicit,n=e.index,i=a(2);h(i.cn(i.cx("itemLabel"),i.getItemProp(t,"labelClass"))),l("ngStyle",i.getItemProp(t,"labelStyle"))("pBind",i.getPTOptions(t,n,"itemLabel")),d(),F(" ",i.getItemLabel(t)," ")}}function gn(o,r){if(o&1&&C(0,"span",20),o&2){let e=a(4),t=e.$implicit,n=e.index,i=a(2);h(i.cn(i.cx("itemLabel"),i.getItemProp(t,"labelClass"))),l("ngStyle",i.getItemProp(t,"labelStyle"))("innerHTML",i.getItemLabel(t),Te)("pBind",i.getPTOptions(t,n,"itemLabel"))}}function fn(o,r){if(o&1&&C(0,"p-badge",21),o&2){let e=a(4).$implicit,t=a(2);h(t.getItemProp(e,"badgeStyleClass")),l("value",t.getItemProp(e,"badge"))("unstyled",t.unstyled())}}function xn(o,r){if(o&1&&(ve(),C(0,"svg",24)),o&2){let e=a(5),t=e.$implicit,n=e.index,i=a(2);h(i.cx("submenuIcon")),l("pBind",i.getPTOptions(t,n,"submenuIcon")),D("aria-hidden",!0)}}function In(o,r){}function bn(o,r){o&1&&x(0,In,0,0,"ng-template",25),o&2&&we("aria-hidden",!0)}function yn(o,r){if(o&1&&(Z(0),x(1,xn,1,4,"svg",22)(2,bn,1,1,null,23),j()),o&2){let e=a(6);d(),l("ngIf",!e.contextMenu.submenuIconTemplate&&!e.contextMenu._submenuIconTemplate),d(),l("ngTemplateOutlet",e.contextMenu.submenuIconTemplate||e.contextMenu._submenuIconTemplate)("ngTemplateOutletContext",ue(3,zt))}}function vn(o,r){if(o&1&&(u(0,"a",26),x(1,_n,1,6,"span",16)(2,hn,2,5,"span",17)(3,gn,1,5,"ng-template",null,2,A)(5,fn,1,4,"p-badge",18)(6,yn,3,4,"ng-container",11),_()),o&2){let e=S(4),t=a(3),n=t.$implicit,i=t.index,s=a(2);h(s.cn(s.cx("itemLink"),s.getItemProp(n,"linkClass"))),l("routerLink",s.getItemProp(n,"routerLink"))("queryParams",s.getItemProp(n,"queryParams"))("routerLinkActiveOptions",s.getItemProp(n,"routerLinkActiveOptions")||ue(22,tn))("target",s.getItemProp(n,"target"))("ngStyle",s.getItemProp(n,"linkStyle"))("fragment",s.getItemProp(n,"fragment"))("queryParamsHandling",s.getItemProp(n,"queryParamsHandling"))("preserveFragment",s.getItemProp(n,"preserveFragment"))("skipLocationChange",s.getItemProp(n,"skipLocationChange"))("replaceUrl",s.getItemProp(n,"replaceUrl"))("state",s.getItemProp(n,"state"))("pBind",s.getPTOptions(n,i,"itemLink")),D("data-automationid",s.getItemProp(n,"automationId"))("title",s.getItemProp(n,"title"))("tabindex",-1),d(),l("ngIf",s.getItemProp(n,"icon")),d(),l("ngIf",s.getItemProp(n,"escape"))("ngIfElse",e),d(3),l("ngIf",s.getItemProp(n,"badge")),d(),l("ngIf",s.isItemGroup(n))}}function Cn(o,r){if(o&1&&(Z(0),x(1,un,7,14,"a",13)(2,vn,7,23,"a",14),j()),o&2){let e=a(2).$implicit,t=a(2);d(),l("ngIf",!t.getItemProp(e,"routerLink")),d(),l("ngIf",t.getItemProp(e,"routerLink"))}}function Tn(o,r){}function Mn(o,r){o&1&&x(0,Tn,0,0,"ng-template")}function wn(o,r){if(o&1&&(Z(0),x(1,Mn,1,0,null,23),j()),o&2){let e=a(2).$implicit,t=a(2);d(),l("ngTemplateOutlet",t.itemTemplate)("ngTemplateOutletContext",_e(2,nn,e.item))}}function Dn(o,r){if(o&1){let e=E();u(0,"p-contextmenu-sub",27),y("itemClick",function(n){m(e);let i=a(4);return p(i.itemClick.emit(n))})("itemMouseEnter",function(n){m(e);let i=a(4);return p(i.onItemMouseEnter(n))}),_()}if(o&2){let e=a(2).$implicit,t=a(2);l("items",e.items)("itemTemplate",t.itemTemplate)("menuId",t.menuId)("visible",t.isItemActive(e)&&t.isItemGroup(e))("activeItemPath",t.activeItemPath)("focusedItemId",t.focusedItemId)("level",t.level+1)("pt",t.pt())("motionOptions",t.motionOptions)("unstyled",t.unstyled())}}function Ln(o,r){if(o&1){let e=E();u(0,"li",9,1)(2,"div",10),y("click",function(n){m(e);let i=a().$implicit,s=a(2);return p(s.onItemClick(n,i))})("mouseenter",function(n){m(e);let i=a().$implicit,s=a(2);return p(s.onItemMouseEnter({$event:n,processedItem:i}))}),x(3,Cn,3,2,"ng-container",11)(4,wn,2,4,"ng-container",11),_(),x(5,Dn,1,10,"p-contextmenu-sub",12),_()}if(o&2){let e=a(),t=e.$implicit,n=e.index,i=a(2);ce(i.getItemProp(t,"style")),h(i.cn(i.cx("item",R(24,en,i,t)),i.getItemProp(t,"styleClass"))),l("pBind",i.getPTOptions(t,n,"item"))("tooltipOptions",i.getItemProp(t,"tooltipOptions"))("pTooltipUnstyled",i.unstyled()),D("id",i.getItemId(t))("data-p-highlight",i.isItemActive(t))("data-p-focused",i.isItemFocused(t))("data-p-disabled",i.isItemDisabled(t))("aria-label",i.getItemLabel(t))("aria-disabled",i.isItemDisabled(t)||void 0)("aria-haspopup",i.isItemGroup(t)&&!i.getItemProp(t,"to")?"menu":void 0)("aria-expanded",i.isItemGroup(t)?i.isItemActive(t):void 0)("aria-level",i.level+1)("aria-setsize",i.getAriaSetSize())("aria-posinset",i.getAriaPosInset(n)),d(2),h(i.cx("itemContent")),l("pBind",i.getPTOptions(t,n,"itemContent")),d(),l("ngIf",!i.itemTemplate),d(),l("ngIf",i.itemTemplate),d(),l("ngIf",i.isItemVisible(t)&&i.isItemGroup(t))}}function En(o,r){if(o&1&&x(0,on,1,6,"li",6)(1,Ln,6,27,"li",7),o&2){let e=r.$implicit,t=a(2);l("ngIf",t.isItemVisible(e)&&t.getItemProp(e,"separator")),d(),l("ngIf",t.isItemVisible(e)&&!t.getItemProp(e,"separator"))}}function Sn(o,r){if(o&1){let e=E();u(0,"ul",4,0),y("keydown",function(n){m(e);let i=a();return p(i.menuKeydown.emit(n))})("focus",function(n){m(e);let i=a();return p(i.menuFocus.emit(n))})("blur",function(n){m(e);let i=a();return p(i.menuBlur.emit(n))})("pMotionOnBeforeEnter",function(n){m(e);let i=a();return p(i.onBeforeEnter(n))})("pMotionOnAfterLeave",function(){m(e);let n=a();return p(n.onAfterLeave())}),x(2,En,2,2,"ng-template",5),_()}if(o&2){let e=a();h(e.root?e.cx("rootList"):e.cx("submenu")),l("pBind",e._ptm(e.root?"rootList":"submenu"))("tabindex",e.tabindex)("pMotion",e.root?!0:e.visible)("pMotionAppear",!0)("pMotionName","p-anchored-overlay")("pMotionOptions",e.motionOptions),D("id",e.menuId+"_list")("aria-label",e.ariaLabel)("aria-labelledBy",e.ariaLabelledBy)("aria-activedescendant",e.focusedItemId)("aria-orientation","vertical"),d(2),l("ngForOf",e.items)}}var Nn=["item"],Pn=["submenuicon"],kn=["rootmenu"];function On(o,r){if(o&1){let e=E();u(0,"div",3,0),y("pMotionOnBeforeEnter",function(n){m(e);let i=a();return p(i.onBeforeEnter(n))})("pMotionOnAfterEnter",function(){m(e);let n=a();return p(n.onAfterEnter())})("pMotionOnAfterLeave",function(){m(e);let n=a();return p(n.onAfterLeave())}),u(2,"p-contextmenu-sub",4,1),y("itemClick",function(n){m(e);let i=a();return p(i.onItemClick(n))})("menuFocus",function(n){m(e);let i=a();return p(i.onMenuFocus(n))})("menuBlur",function(n){m(e);let i=a();return p(i.onMenuBlur(n))})("menuKeydown",function(n){m(e);let i=a();return p(i.onKeyDown(n))})("itemMouseEnter",function(n){m(e);let i=a();return p(i.onItemMouseEnter(n))}),_()()}if(o&2){let e=a();ce(e.sx("root")),h(e.cn(e.cx("root"),e.styleClass)),l("ngStyle",e.style)("pBind",e.ptm("root"))("pMotion",e.visible())("pMotionName","p-anchored-overlay")("pMotionAppear",!0)("pMotionOptions",e.computedMotionOptions()),D("id",e.id),d(2),l("root",!0)("items",e.processedItems)("itemTemplate",e.itemTemplate||e._itemTemplate)("menuId",e.id)("ariaLabel",e.ariaLabel)("ariaLabelledBy",e.ariaLabelledBy)("baseZIndex",e.baseZIndex)("autoZIndex",e.autoZIndex)("visible",e.submenuVisible())("focusedItemId",e.focused?e.focusedItemId:void 0)("activeItemPath",e.activeItemPath())("pt",e.pt())("unstyled",e.unstyled())("motionOptions",e.computedMotionOptions())}}var Vn={root:{position:"absolute"}},An={root:()=>["p-contextmenu p-component"],rootList:"p-contextmenu-root-list",item:({instance:o,processedItem:r})=>["p-contextmenu-item",{"p-contextmenu-item-active":o.isItemActive(r),"p-focus":o.isItemFocused(r),"p-disabled":o.isItemDisabled(r),"p-contextmenu-mobile":o.queryMatches}],itemContent:"p-contextmenu-item-content",itemLink:"p-contextmenu-item-link",itemIcon:"p-contextmenu-item-icon",itemLabel:"p-contextmenu-item-label",submenuIcon:"p-contextmenu-submenu-icon",submenu:"p-contextmenu-submenu",separator:"p-contextmenu-separator"},xe=(()=>{class o extends Lt{name="contextmenu";style=Ht;classes=An;inlineStyles=Vn;static \u0275fac=(()=>{let e;return function(n){return(e||(e=tt(o)))(n||o)}})();static \u0275prov=et({token:o,factory:o.\u0275fac})}return o})();var qt=new ye("CONTEXTMENU_INSTANCE"),Ut=new ye("CONTEXTMENUSUB_INSTANCE"),Bn=(()=>{class o extends $e{el;renderer;contextMenu;get visible(){return this._visible}set visible(e){this._visible=e,(this._visible||this.root)&&this.render.set(!0)}items;itemTemplate;root=!1;autoZIndex=!0;baseZIndex=0;popup;menuId;ariaLabel;ariaLabelledBy;level=0;focusedItemId;activeItemPath;motionOptions;tabindex=0;itemClick=new f;itemMouseEnter=new f;menuFocus=new f;menuBlur=new f;menuKeydown=new f;sublistViewChild;render=w(!1);hostName="ContextMenu";_componentStyle=L(xe);$pcContextMenu=L(qt,{optional:!0,skipSelf:!0})??void 0;$pcContextMenuSub=L(Ut,{optional:!0,skipSelf:!0})??void 0;_visible=!1;constructor(e,t,n){super(),this.el=e,this.renderer=t,this.contextMenu=n,this.contextMenu.handleSubmenuAfterLeave=()=>{this.root&&this.onAfterLeave()}}getItemProp(e,t,n=null){return e&&e.item?Ke(e.item[t],n):void 0}getItemId(e){return e.item&&e.item?.id?e.item.id:`${this.menuId}_${e.key}`}getItemKey(e){return this.getItemId(e)}getItemLabel(e){return this.getItemProp(e,"label")}getAriaSetSize(){return this.items.filter(e=>this.isItemVisible(e)&&!this.getItemProp(e,"separator")).length}getAriaPosInset(e){return e-this.items.slice(0,e).filter(t=>this.isItemVisible(t)&&this.getItemProp(t,"separator")).length+1}isItemVisible(e){return this.getItemProp(e,"visible")!==!1}isItemActive(e){if(this.activeItemPath)return this.activeItemPath.some(t=>t.key===e.key)}isItemDisabled(e){return this.getItemProp(e,"disabled")}isItemFocused(e){return this.focusedItemId===this.getItemId(e)}isItemGroup(e){return O(e.items)}onItemMouseEnter(e){let{event:t,processedItem:n}=e;this.itemMouseEnter.emit({originalEvent:t,processedItem:n})}onItemClick(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.itemClick.emit({originalEvent:e,processedItem:t,isFocus:!0})}onBeforeEnter(e){this.position(e.element)}onAfterLeave(){this.render.set(!1)}_ptm(e,t){return this.$pcContextMenu?this.$pcContextMenu.ptm(e,t):this.ptm(e,t)}getPTOptions(e,t,n){return this._ptm(n,{context:{item:e.item,index:t,active:this.isItemActive(e),focused:this.isItemFocused(e),disabled:this.isItemDisabled(e)}})}position(e){let t=e.parentElement.parentElement,n=vt(e.parentElement.parentElement),i=Ve(),s=e.offsetParent?e.offsetWidth:Be(e),c=It(t.children[0]);e.style.top="0px",parseInt(n.left,10)+c+s>i.width-bt()?e.style.left=-1*s+"px":e.style.left=c+"px"}static \u0275fac=function(t){return new(t||o)(b(H),b(z),b(Je(()=>Ie)))};static \u0275cmp=q({type:o,selectors:[["p-contextMenuSub"],["p-contextmenu-sub"]],viewQuery:function(t,n){if(t&1&&W(Jt,5),t&2){let i;T(i=M())&&(n.sublistViewChild=i.first)}},inputs:{visible:"visible",items:"items",itemTemplate:"itemTemplate",root:[2,"root","root",K],autoZIndex:[2,"autoZIndex","autoZIndex",K],baseZIndex:[2,"baseZIndex","baseZIndex",$],popup:[2,"popup","popup",K],menuId:"menuId",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",level:[2,"level","level",$],focusedItemId:"focusedItemId",activeItemPath:"activeItemPath",motionOptions:"motionOptions",tabindex:[2,"tabindex","tabindex",$]},outputs:{itemClick:"itemClick",itemMouseEnter:"itemMouseEnter",menuFocus:"menuFocus",menuBlur:"menuBlur",menuKeydown:"menuKeydown"},features:[Se([xe,{provide:Ut,useExisting:o},{provide:Et,useExisting:o}]),Me],decls:1,vars:1,consts:[["sublist",""],["listItem",""],["htmlLabel",""],["role","menu",3,"class","pBind","tabindex","pMotion","pMotionAppear","pMotionName","pMotionOptions"],["role","menu",3,"keydown","focus","blur","pMotionOnBeforeEnter","pMotionOnAfterLeave","pBind","tabindex","pMotion","pMotionAppear","pMotionName","pMotionOptions"],["ngFor","",3,"ngForOf"],["role","separator",3,"style","class","pBind",4,"ngIf"],["role","menuitem","pTooltip","",3,"style","class","pBind","tooltipOptions","pTooltipUnstyled",4,"ngIf"],["role","separator",3,"pBind"],["role","menuitem","pTooltip","",3,"pBind","tooltipOptions","pTooltipUnstyled"],[3,"click","mouseenter","pBind"],[4,"ngIf"],[3,"items","itemTemplate","menuId","visible","activeItemPath","focusedItemId","level","pt","motionOptions","unstyled","itemClick","itemMouseEnter",4,"ngIf"],["pRipple","",3,"target","class","ngStyle","pBind",4,"ngIf"],["pRipple","",3,"routerLink","queryParams","routerLinkActiveOptions","target","class","ngStyle","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state","pBind",4,"ngIf"],["pRipple","",3,"target","ngStyle","pBind"],[3,"class","ngStyle","pBind",4,"ngIf"],[3,"class","ngStyle","pBind",4,"ngIf","ngIfElse"],[3,"class","value","unstyled",4,"ngIf"],[3,"ngStyle","pBind"],[3,"ngStyle","innerHTML","pBind"],[3,"value","unstyled"],["data-p-icon","angle-right",3,"class","pBind",4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["data-p-icon","angle-right",3,"pBind"],[3,"aria-hidden"],["pRipple","",3,"routerLink","queryParams","routerLinkActiveOptions","target","ngStyle","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state","pBind"],[3,"itemClick","itemMouseEnter","items","itemTemplate","menuId","visible","activeItemPath","focusedItemId","level","pt","motionOptions","unstyled"]],template:function(t,n){t&1&&P(0,Sn,3,14,"ul",3),t&2&&k(n.render()?0:-1)},dependencies:[o,Y,at,lt,ge,Pe,ke,dt,Ot,je,At,He,kt,Ze,Vt,ne,Ue,qe,ze],encapsulation:2})}return o})(),Ie=(()=>{class o extends $e{overlayService;componentName="ContextMenu";set model(e){this._model=e,this._processedItems=this.createProcessedItems(this._model||[])}get model(){return this._model}triggerEvent="contextmenu";target;global;style;styleClass;autoZIndex=!0;baseZIndex=0;id;breakpoint="960px";ariaLabel;ariaLabelledBy;pressDelay=500;appendTo=X(void 0);motionOptions=X(void 0);computedMotionOptions=Ne(()=>B(B({},this.ptm("motion")),this.motionOptions()));onShow=new f;onHide=new f;rootmenu;container;handleSubmenuAfterLeave=null;outsideClickListener;resizeListener;triggerEventListener;documentClickListener;documentTriggerListener;touchEndListener;pageX;pageY;visible=w(!1);render=w(!1);focused=!1;activeItemPath=w([]);focusedItemInfo=w({index:-1,level:0,parentKey:"",item:null});submenuVisible=w(!1);$appendTo=Ne(()=>this.appendTo()||this.config.overlayAppendTo());searchValue="";searchTimeout;_processedItems;_model;pressTimer;hideCallback;matchMediaListener;query;queryMatches=w(!1);_componentStyle=L(xe);get visibleItems(){let e=this.activeItemPath().find(t=>t.key===this.focusedItemInfo().parentKey);return e?e.items:this.processedItems}get processedItems(){return(!this._processedItems||!this._processedItems.length)&&(this._processedItems=this.createProcessedItems(this.model||[])),this._processedItems}get focusedItemId(){let e=this.focusedItemInfo();return e.item&&e.item?.id?e.item.id:e.index!==-1?`${this.id}${O(e.parentKey)?"_"+e.parentKey:""}_${e.index}`:null}constructor(e){super(),this.overlayService=e,se(()=>{let t=this.activeItemPath();O(t)?this.bindGlobalListeners():this.visible()||this.unbindGlobalListeners()})}onInit(){this.id=this.id||wt("pn_id_"),this.bindMatchMediaListener(),this.bindTriggerEventListener()}isMobile(){return Tt()||Ct()}bindTriggerEventListener(){J(this.platformId)&&(this.triggerEventListener||(this.isMobile()?this.global?(this.triggerEventListener=this.renderer.listen(this.document,"touchstart",this.onTouchStart.bind(this)),this.touchEndListener=this.renderer.listen(this.document,"touchend",this.onTouchEnd.bind(this))):this.target&&(this.triggerEventListener=this.renderer.listen(this.target,"touchstart",this.onTouchStart.bind(this)),this.touchEndListener=this.renderer.listen(this.target,"touchend",this.onTouchEnd.bind(this))):this.global?this.triggerEventListener=this.renderer.listen(this.document,this.triggerEvent,e=>{this.show(e)}):this.target&&(this.triggerEventListener=this.renderer.listen(this.target,this.triggerEvent,e=>{this.show(e)}))))}bindGlobalListeners(){if(J(this.platformId)){if(!this.documentClickListener){let e=this.el?this.el.nativeElement.ownerDocument:"document";this.documentClickListener=this.renderer.listen(e,"click",t=>{this.container?.offsetParent&&this.isOutsideClicked(t)&&!t.ctrlKey&&t.button!==2&&this.hide()})}this.resizeListener||(this.resizeListener=this.renderer.listen(this.document.defaultView,"resize",e=>{this.hide()}))}}itemTemplate;submenuIconTemplate;templates;_submenuIconTemplate;_itemTemplate;onAfterContentInit(){this.templates?.forEach(e=>{switch(e.getType()){case"submenuicon":this._submenuIconTemplate=e.template;break;case"item":this._itemTemplate=e.template;break;default:this._itemTemplate=e.template;break}})}getPTOptions(e,t,n,i){return this.ptm(e,{context:{item:t,index:n,focused:this.isItemFocused({index:n,item:t}),disabled:this.isItemDisabled(t)}})}isItemFocused(e){return this.focusedItemInfo().index===e.index}createProcessedItems(e,t=0,n={},i=""){let s=[];return e&&e.forEach((c,g)=>{let I=(i!==""?i+"_":"")+g,v={item:c,index:g,level:t,key:I,parent:n,parentKey:i};v.items=this.createProcessedItems(c.items,t+1,v,I),s.push(v)}),s}bindMatchMediaListener(){if(J(this.platformId)&&!this.matchMediaListener){let e=window.matchMedia(`(max-width: ${this.breakpoint})`);this.query=e,this.queryMatches.set(e.matches),this.matchMediaListener=()=>{this.queryMatches.set(e.matches),this.cd.markForCheck()},e.addEventListener("change",this.matchMediaListener)}}unbindMatchMediaListener(){this.matchMediaListener&&(this.query.removeEventListener("change",this.matchMediaListener),this.matchMediaListener=null)}getItemProp(e,t){return e?Ke(e[t]):void 0}getProccessedItemLabel(e){return e?this.getItemLabel(e.item):void 0}getItemLabel(e){return this.getItemProp(e,"label")}isProcessedItemGroup(e){return e&&O(e.items)}isSelected(e){return this.activeItemPath().some(t=>t.key===e.key)}isValidSelectedItem(e){return this.isValidItem(e)&&this.isSelected(e)}isValidItem(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)}isItemDisabled(e){return this.getItemProp(e,"disabled")}isItemSeparator(e){return this.getItemProp(e,"separator")}isItemMatched(e){return this.isValidItem(e)&&this.getProccessedItemLabel(e).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())}isProccessedItemGroup(e){return e&&O(e.items)}onItemClick(e){let{processedItem:t}=e,n=this.isProcessedItemGroup(t);if(this.isSelected(t)){let{index:s,key:c,level:g,parentKey:I,item:v}=t;this.activeItemPath.set(this.activeItemPath().filter(ie=>c!==ie.key&&c.startsWith(ie.key))),this.focusedItemInfo.set({index:s,level:g,parentKey:I,item:v}),te(this.rootmenu?.sublistViewChild?.nativeElement)}else n?this.onItemChange(e):this.hide()}onItemMouseEnter(e){this.onItemChange(e,"hover")}onKeyDown(e){let t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"Space":this.onSpaceKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!t&&Mt(e.key)&&this.searchItems(e,e.key);break}}onArrowDownKey(e){let t=this.focusedItemInfo().index!==-1?this.findNextItemIndex(this.focusedItemInfo().index):this.findFirstFocusedItemIndex();this.changeFocusedItemIndex(e,t),e.preventDefault()}onArrowRightKey(e){let t=this.visibleItems[this.focusedItemInfo().index];this.isProccessedItemGroup(t)&&(this.onItemChange({originalEvent:e,processedItem:t}),this.focusedItemInfo.set({index:-1,parentKey:t.key,item:t.item}),this.searchValue="",this.onArrowDownKey(e)),e.preventDefault()}onArrowUpKey(e){if(e.altKey){if(this.focusedItemInfo().index!==-1){let t=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide(),e.preventDefault()}else{let t=this.focusedItemInfo().index!==-1?this.findPrevItemIndex(this.focusedItemInfo().index):this.findLastFocusedItemIndex();this.changeFocusedItemIndex(e,t),e.preventDefault()}}onArrowLeftKey(e){let t=this.visibleItems[this.focusedItemInfo().index],n=this.activeItemPath().find(c=>c.key===t.parentKey);Fe(t.parent)||(this.focusedItemInfo.set({index:-1,parentKey:n?n.parentKey:"",item:t.item}),this.searchValue="",this.onArrowDownKey(e));let s=this.activeItemPath().filter(c=>c.parentKey!==this.focusedItemInfo().parentKey);this.activeItemPath.set(s),e.preventDefault()}onHomeKey(e){this.changeFocusedItemIndex(e,this.findFirstItemIndex()),e.preventDefault()}onEndKey(e){this.changeFocusedItemIndex(e,this.findLastItemIndex()),e.preventDefault()}onSpaceKey(e){this.onEnterKey(e)}onEscapeKey(e){this.hide();let t=this.findVisibleItem(this.findFirstFocusedItemIndex()),n=this.focusedItemInfo();this.focusedItemInfo.set(oe(B({},n),{index:this.findFirstFocusedItemIndex(),item:t.item})),e.preventDefault()}onTabKey(e){if(this.focusedItemInfo().index!==-1){let t=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide()}onEnterKey(e){if(this.focusedItemInfo().index!==-1){let t=ee(this.rootmenu?.el?.nativeElement,`li[id="${`${this.focusedItemId}`}"]`),n=t&&(ee(t,'[data-pc-section="itemlink"]')||ee(t,"a,button"));n?n.click():t&&t.click();let i=this.visibleItems[this.focusedItemInfo().index];if(!this.isProccessedItemGroup(i)){let c=this.focusedItemInfo();this.focusedItemInfo.set(oe(B({},c),{index:this.findFirstFocusedItemIndex()}))}}e.preventDefault()}onItemChange(e,t){let{processedItem:n,isFocus:i}=e;if(Fe(n))return;let{index:s,key:c,level:g,parentKey:I,items:v}=n,ie=O(v),Xe=this.activeItemPath().filter(Ye=>Ye.parentKey!==I&&Ye.parentKey!==c);ie&&(Xe.push(n),this.submenuVisible.set(!0)),this.focusedItemInfo.set({index:s,level:g,parentKey:I,item:n.item}),i&&te(this.rootmenu?.sublistViewChild?.nativeElement),!(t==="hover"&&this.queryMatches())&&this.activeItemPath.set(Xe)}onMenuFocus(e){this.focused=!0;let t=this.focusedItemInfo().index!==-1?this.focusedItemInfo():{index:-1,level:0,parentKey:"",item:null};this.focusedItemInfo.set(t)}onMenuBlur(e){this.focused=!1,this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null}),this.searchValue=""}onBeforeEnter(e){this.container=e.element,this.appendOverlay(),this.moveOnTop(),this.position(),this.$attrSelector&&this.container?.setAttribute(this.$attrSelector,"")}onAfterEnter(){this.bindGlobalListeners(),te(this.rootmenu?.sublistViewChild?.nativeElement)}onAfterLeave(){this.restoreOverlayAppend(),this.onOverlayHide(),this.handleSubmenuAfterLeave?.(),this.render.set(!1)}appendOverlay(){this.$appendTo()&&this.$appendTo()!=="self"&&(this.$appendTo()==="body"?Ae(this.document.body,this.container):Ae(this.$appendTo(),this.container))}restoreOverlayAppend(){this.container&&this.$appendTo()!=="self"&&this.el.nativeElement.appendChild(this.container)}moveOnTop(){this.autoZIndex&&this.container&&Qe.set("menu",this.container,this.baseZIndex+this.config.zIndex.menu)}onOverlayHide(){this.unbindGlobalListeners(),this.cd.destroyed||(this.target=null),this.container&&this.autoZIndex&&Qe.clear(this.container),this.container=null}onTouchStart(e){this.pressTimer=setTimeout(()=>{this.show(e)},this.pressDelay)}onTouchEnd(){clearTimeout(this.pressTimer)}hide(){this.visible.set(!1),this.onHide.emit(),this.hideCallback?.(),this.activeItemPath.set([]),this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null})}toggle(e){this.visible()?this.hide():this.show(e)}show(e){this.activeItemPath.set([]),this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null}),te(this.rootmenu?.sublistViewChild?.nativeElement),this.pageX=e.pageX,this.pageY=e.pageY,this.onShow.emit(),this.visible()?this.position():this.visible.set(!0),this.render.set(!0),e.stopPropagation(),e.preventDefault()}position(){if(!this.document.scrollingElement||!this.container)return;let e=this.pageX+1,t=this.pageY+1,n=this.container.offsetParent?this.container.offsetWidth:Be(this.container),i=this.container.offsetParent?this.container.offsetHeight:yt(this.container),s=Ve();e+n-this.document.scrollingElement.scrollLeft>s.width&&(e-=n),t+i-this.document.scrollingElement.scrollTop>s.height&&(t-=i),e<this.document.scrollingElement.scrollLeft&&(e=this.document.scrollingElement.scrollLeft),t<this.document.scrollingElement.scrollTop&&(t=this.document.scrollingElement.scrollTop),this.container.style.left=e+"px",this.container.style.top=t+"px"}searchItems(e,t){this.searchValue=(this.searchValue||"")+t;let n=-1,i=!1;return this.focusedItemInfo().index!==-1?(n=this.visibleItems.slice(this.focusedItemInfo().index).findIndex(s=>this.isItemMatched(s)),n=n===-1?this.visibleItems.slice(0,this.focusedItemInfo().index).findIndex(s=>this.isItemMatched(s)):n+this.focusedItemInfo().index):n=this.visibleItems.findIndex(s=>this.isItemMatched(s)),n!==-1&&(i=!0),n===-1&&this.focusedItemInfo().index===-1&&(n=this.findFirstFocusedItemIndex()),n!==-1&&this.changeFocusedItemIndex(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(()=>{this.searchValue="",this.searchTimeout=null},500),i}findVisibleItem(e){return O(this.visibleItems)?this.visibleItems[e]:null}findLastFocusedItemIndex(){let e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e}findLastItemIndex(){return Re(this.visibleItems,e=>this.isValidItem(e))}findPrevItemIndex(e){let t=e>0?Re(this.visibleItems.slice(0,e),n=>this.isValidItem(n)):-1;return t>-1?t:e}findNextItemIndex(e){let t=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex(n=>this.isValidItem(n)):-1;return t>-1?t+e+1:e}findFirstFocusedItemIndex(){let e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e}findFirstItemIndex(){return this.visibleItems.findIndex(e=>this.isValidItem(e))}findSelectedItemIndex(){return this.visibleItems.findIndex(e=>this.isValidSelectedItem(e))}changeFocusedItemIndex(e,t){let n=this.findVisibleItem(t),i=this.focusedItemInfo();i.index!==t&&(this.focusedItemInfo.set(oe(B({},i),{index:t,item:n.item})),this.scrollInView())}scrollInView(e=-1){let t=e!==-1?`${this.id}_${e}`:this.focusedItemId,n=ee(this.rootmenu?.el?.nativeElement,`li[id="${t}"]`);n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"nearest"})}bindResizeListener(){J(this.platformId)&&(this.resizeListener||(this.resizeListener=this.renderer.listen(this.document.defaultView,"resize",e=>{this.hide()})))}isOutsideClicked(e){return!(this.container?.isSameNode(e.target)||this.container?.contains(e.target))}unbindResizeListener(){this.resizeListener&&(this.resizeListener(),this.resizeListener=null)}unbindGlobalListeners(){this.documentClickListener&&(this.documentClickListener(),this.documentClickListener=null),this.documentTriggerListener&&(this.documentTriggerListener(),this.documentTriggerListener=null),this.resizeListener&&(this.resizeListener(),this.resizeListener=null),this.touchEndListener&&(this.touchEndListener(),this.touchEndListener=null)}unbindTriggerEventListener(){this.triggerEventListener&&(this.triggerEventListener(),this.triggerEventListener=null)}onDestroy(){this.unbindGlobalListeners(),this.unbindTriggerEventListener(),this.unbindMatchMediaListener(),this.restoreOverlayAppend(),this.onOverlayHide()}static \u0275fac=function(t){return new(t||o)(b(Dt))};static \u0275cmp=q({type:o,selectors:[["p-contextMenu"],["p-contextmenu"],["p-context-menu"]],contentQueries:function(t,n,i){if(t&1&&le(i,Nn,4)(i,Pn,4)(i,fe,4),t&2){let s;T(s=M())&&(n.itemTemplate=s.first),T(s=M())&&(n.submenuIconTemplate=s.first),T(s=M())&&(n.templates=s)}},viewQuery:function(t,n){if(t&1&&W(kn,5),t&2){let i;T(i=M())&&(n.rootmenu=i.first)}},inputs:{model:"model",triggerEvent:"triggerEvent",target:"target",global:[2,"global","global",K],style:"style",styleClass:"styleClass",autoZIndex:[2,"autoZIndex","autoZIndex",K],baseZIndex:[2,"baseZIndex","baseZIndex",$],id:"id",breakpoint:"breakpoint",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",pressDelay:[2,"pressDelay","pressDelay",$],appendTo:[1,"appendTo"],motionOptions:[1,"motionOptions"]},outputs:{onShow:"onShow",onHide:"onHide"},features:[Se([xe,{provide:qt,useExisting:o}]),Me],decls:1,vars:1,consts:[["container",""],["rootmenu",""],[3,"class","style","ngStyle","pBind","pMotion","pMotionName","pMotionAppear","pMotionOptions"],[3,"pMotionOnBeforeEnter","pMotionOnAfterEnter","pMotionOnAfterLeave","ngStyle","pBind","pMotion","pMotionName","pMotionAppear","pMotionOptions"],[3,"itemClick","menuFocus","menuBlur","menuKeydown","itemMouseEnter","root","items","itemTemplate","menuId","ariaLabel","ariaLabelledBy","baseZIndex","autoZIndex","visible","focusedItemId","activeItemPath","pt","unstyled","motionOptions"]],template:function(t,n){t&1&&P(0,On,4,25,"div",2),t&2&&k(n.render()?0:-1)},dependencies:[Y,Pe,Bn,ke,je,He,Ze,ne,Ue,qe,ze],encapsulation:2,changeDetection:0})}return o})(),Qt=(()=>{class o{static \u0275fac=function(t){return new(t||o)};static \u0275mod=ae({type:o});static \u0275inj=re({imports:[Ie,ne,ne]})}return o})();var Zt=(()=>{class o{el;zone;renderer;scope;dragEffect;dragHandle;onDragStart=new f;onDragEnd=new f;onDrag=new f;handle;dragListener;mouseDownListener;mouseUpListener;_pDraggableDisabled=!1;constructor(e,t,n){this.el=e,this.zone=t,this.renderer=n}get pDraggableDisabled(){return this._pDraggableDisabled}set pDraggableDisabled(e){this._pDraggableDisabled=e,this._pDraggableDisabled?this.unbindMouseListeners():(this.el.nativeElement.draggable=!0,this.bindMouseListeners())}ngAfterViewInit(){this.pDraggableDisabled||(this.el.nativeElement.draggable=!0,this.bindMouseListeners())}bindDragListener(){this.dragListener||this.zone.runOutsideAngular(()=>{this.dragListener=this.renderer.listen(this.el.nativeElement,"drag",this.drag.bind(this))})}unbindDragListener(){this.dragListener&&this.zone.runOutsideAngular(()=>{this.dragListener&&this.dragListener(),this.dragListener=null})}bindMouseListeners(){!this.mouseDownListener&&!this.mouseUpListener&&this.zone.runOutsideAngular(()=>{this.mouseDownListener=this.renderer.listen(this.el.nativeElement,"mousedown",this.mousedown.bind(this)),this.mouseUpListener=this.renderer.listen(this.el.nativeElement,"mouseup",this.mouseup.bind(this))})}unbindMouseListeners(){this.mouseDownListener&&this.mouseUpListener&&this.zone.runOutsideAngular(()=>{this.mouseDownListener&&this.mouseDownListener(),this.mouseUpListener&&this.mouseUpListener(),this.mouseDownListener=null,this.mouseUpListener=null})}drag(e){this.onDrag.emit(e)}dragStart(e){this.allowDrag()&&!this.pDraggableDisabled?(this.dragEffect&&(e.dataTransfer.effectAllowed=this.dragEffect),e.dataTransfer.setData("text",this.scope),this.onDragStart.emit(e),this.bindDragListener()):e.preventDefault()}dragEnd(e){this.onDragEnd.emit(e),this.unbindDragListener()}mousedown(e){this.handle=e.target}mouseup(e){this.handle=null}allowDrag(){return this.dragHandle&&this.handle?St.matches(this.handle,this.dragHandle):!0}ngOnDestroy(){this.unbindDragListener(),this.unbindMouseListeners()}static \u0275fac=function(t){return new(t||o)(b(H),b(Ce),b(z))};static \u0275dir=Q({type:o,selectors:[["","pDraggable",""]],hostBindings:function(t,n){t&1&&y("dragstart",function(s){return n.dragStart(s)})("dragend",function(s){return n.dragEnd(s)})},inputs:{scope:[0,"pDraggable","scope"],dragEffect:"dragEffect",dragHandle:"dragHandle",pDraggableDisabled:"pDraggableDisabled"},outputs:{onDragStart:"onDragStart",onDragEnd:"onDragEnd",onDrag:"onDrag"}})}return o})(),jt=(()=>{class o{el;zone;renderer;scope;_pDroppableDisabled=!1;get pDroppableDisabled(){return this._pDroppableDisabled}set pDroppableDisabled(e){this._pDroppableDisabled=e,this._pDroppableDisabled?this.unbindDragOverListener():this.bindDragOverListener()}dropEffect;onDragEnter=new f;onDragLeave=new f;onDrop=new f;constructor(e,t,n){this.el=e,this.zone=t,this.renderer=n}dragOverListener;ngAfterViewInit(){this.pDroppableDisabled||this.bindDragOverListener()}bindDragOverListener(){this.dragOverListener||this.zone.runOutsideAngular(()=>{this.dragOverListener=this.renderer.listen(this.el.nativeElement,"dragover",this.dragOver.bind(this))})}unbindDragOverListener(){this.dragOverListener&&this.zone.runOutsideAngular(()=>{this.dragOverListener&&this.dragOverListener(),this.dragOverListener=null})}dragOver(e){e.preventDefault()}drop(e){this.allowDrop(e)&&(Oe(this.el.nativeElement,"p-draggable-enter"),e.preventDefault(),this.onDrop.emit(e))}dragEnter(e){e.preventDefault(),this.dropEffect&&(e.dataTransfer.dropEffect=this.dropEffect),xt(this.el.nativeElement,"p-draggable-enter"),this.onDragEnter.emit(e)}dragLeave(e){e.preventDefault(),this.el.nativeElement.contains(e.relatedTarget)||(Oe(this.el.nativeElement,"p-draggable-enter"),this.onDragLeave.emit(e))}allowDrop(e){let t=e.dataTransfer.getData("text");if(typeof this.scope=="string"&&t==this.scope)return!0;if(Array.isArray(this.scope)){for(let n=0;n<this.scope.length;n++)if(t==this.scope[n])return!0}return!1}ngOnDestroy(){this.unbindDragOverListener()}static \u0275fac=function(t){return new(t||o)(b(H),b(Ce),b(z))};static \u0275dir=Q({type:o,selectors:[["","pDroppable",""]],hostBindings:function(t,n){t&1&&y("drop",function(s){return n.drop(s)})("dragenter",function(s){return n.dragEnter(s)})("dragleave",function(s){return n.dragLeave(s)})},inputs:{scope:[0,"pDroppable","scope"],pDroppableDisabled:"pDroppableDisabled",dropEffect:"dropEffect"},outputs:{onDragEnter:"onDragEnter",onDragLeave:"onDragLeave",onDrop:"onDrop"}})}return o})(),Gt=(()=>{class o{static \u0275fac=function(t){return new(t||o)};static \u0275mod=ae({type:o});static \u0275inj=re({})}return o})();var be=class o{constructor(r){this.template=r}name;static \u0275fac=function(e){return new(e||o)(b(U))};static \u0275dir=Q({type:o,selectors:[["","ttCol",""]],inputs:{name:[0,"ttCol","name"]}})};var Kn=["countTpl"],$n=["renameInput"],Hn=["inputAdd"],We=(o,r)=>({$implicit:o,rowNode:r}),Un=o=>({$implicit:o});function zn(o,r){if(o&1&&(u(0,"th"),V(1),_()),o&2){let e=r.$implicit;h(e.customClass),d(),ot(e.header)}}function qn(o,r){if(o&1&&(u(0,"tr"),Le(1,zn,2,3,"th",10,De().trackByColumn,!0),_()),o&2){let e=r.$implicit;d(),Ee(e)}}function Qn(o,r){if(o&1&&G(0,15),o&2){let e=a(3),t=e.$implicit,n=e.rowData;a();let i=S(9);l("ngTemplateOutlet",i)("ngTemplateOutletContext",R(2,We,n,t.node))}}function Zn(o,r){if(o&1&&G(0,15),o&2){let e=a(3).$implicit;a();let t=S(7);l("ngTemplateOutlet",t)("ngTemplateOutletContext",_e(2,Un,e.node))}}function jn(o,r){if(o&1&&G(0,15),o&2){let e=a(3).$implicit,t=a(),n=t.$implicit,i=t.rowData,s=a();l("ngTemplateOutlet",s.getColumnTemplate(e.field))("ngTemplateOutletContext",R(2,We,i,n))}}function Gn(o,r){if(o&1&&(u(0,"span"),C(1,"i",16),V(2),_()),o&2){let e=a(3).$implicit,t=a(),n=t.$implicit,i=t.rowData,s=a();d(),l("ngClass",s.getIconClass(n)),d(),F(" ",i[e.field]," ")}}function Wn(o,r){if(o&1&&P(0,jn,1,5,"ng-container",15)(1,Gn,3,2,"span"),o&2){let e=a(2).$implicit,t=a(2);k(t.getColumnTemplate(e.field)?0:1)}}function Xn(o,r){if(o&1&&(u(0,"div",12),C(1,"span",13)(2,"p-treetable-toggler",14),P(3,Qn,1,5,"ng-container",15)(4,Zn,1,4,"ng-container",15)(5,Wn,2,1),_()),o&2){let e=a(2),t=e.$implicit,n=e.rowData;d(2),l("rowNode",t),d(),k(n.type==="add"?3:(n==null?null:n.type)==="rename"?4:5)}}function Yn(o,r){if(o&1&&G(0,15),o&2){let e=a(2).$implicit,t=a(),n=t.$implicit,i=t.rowData,s=a();l("ngTemplateOutlet",s.getColumnTemplate(e.field))("ngTemplateOutletContext",R(2,We,i,n))}}function Jn(o,r){if(o&1&&(u(0,"span"),V(1),_()),o&2){let e=a(2).$implicit,t=a().rowData;h(e.customClass),d(),F(" ",t[e.field]," ")}}function ei(o,r){if(o&1&&P(0,Yn,1,5,"ng-container",15)(1,Jn,2,3,"span",10),o&2){let e=a().$implicit,t=a(2);k(t.getColumnTemplate(e.field)?0:1)}}function ti(o,r){if(o&1&&(u(0,"td"),P(1,Xn,6,2,"div",12)(2,ei,2,1),_()),o&2){let e=r.$implicit,t=r.$index;h(e.customClass),d(),k(t===0?1:2)}}function ni(o,r){if(o&1){let e=E();u(0,"tr",11),y("dragenter",function(n){let i=m(e).rowData,s=a();return p(s.onDragEnter(n,i))})("drag",function(n){let i=m(e).rowData,s=a();return p(s.onDragStart(n,i))})("drop",function(n){let i=m(e).rowData,s=a();return p(s.onDropNode(n,i))}),Le(1,ti,3,3,"td",10,De().trackByColumn,!0),_()}if(o&2){let e=r.$implicit,t=r.rowData,n=r.columns,i=a();it("hovered",i.hoveredNodeKey()===t.key),l("ttRow",e)("ttContextMenuRow",e),d(),Ee(n)}}function ii(o,r){if(o&1){let e=E();u(0,"input",17,4),pe("ngModelChange",function(n){let i=m(e).$implicit;return me(i.data.name,n)||(i.data.name=n),p(n)}),y("keydown",function(n){let i,s=m(e).$implicit,c=S(1),g=a();return g.onKeydownEvent(n,(i=g.apiUrls())==null?null:i.rename,s,c.dirty),p(n.stopPropagation())})("focusout",function(){let n,i=m(e).$implicit,s=S(1),c=a();return c.selectedNode.set(i),p(c.saveRename((n=c.apiUrls())==null?null:n.rename,s.dirty))}),_()}if(o&2){let e=r.$implicit;de("ngModel",e.data.name)}}function oi(o,r){if(o&1){let e=E();u(0,"input",18,5),pe("ngModelChange",function(n){let i=m(e).$implicit;return me(i.name,n)||(i.name=n),p(n)}),y("keydown",function(n){let i,s=m(e).rowNode,c=S(1),g=a();return g.onKeydownEvent(n,(i=g.apiUrls())==null?null:i.create,s,c.dirty),p(n.stopPropagation())}),_()}if(o&2){let e=r.$implicit;de("ngModel",e.name)}}var Wt=class o{renameInputs;inputAdds;saveRenameEvent=new f;saveAddEvent=new f;cdr=L(rt);router=L(ct);httpService=L(ft);toastr=L(pt);data=he([]);treeData=[];cols;contextMenuList;deleteMethod=X("delete");apiUrls=he(null);draggedNode;items=[];selectedNode=he(null);oldLabel;hoveredNodeKey=w(null);nodeRootParent=w(null);oldParent;nodeMap=new Map;propertiesInfoUrl;columnTemplates;projectedTemplates;countTpl;_colTemplateMap=new Map;_templateCache=new Map;constructor(){se(()=>{this.treeData=this.data(),this.cdr.markForCheck()})}ngAfterContentInit(){this.updateTemplateMap(),this.columnTemplates.changes?.subscribe(()=>this.updateTemplateMap()),this.projectedTemplates.changes?.subscribe(()=>this.updateTemplateMap())}updateTemplateMap(){this._colTemplateMap.clear(),this._templateCache.clear(),(this.columnTemplates||[]).forEach(e=>{e.name&&this._colTemplateMap.set(e.name,e.template)});let r=this.countTpl&&this.countTpl.first;r&&this._colTemplateMap.set("countCol",r)}getColumnTemplate(r){if(this._templateCache.has(r))return this._templateCache.get(r);let e=this._colTemplateMap.get(r)??null;return this._templateCache.set(r,e),e}getIconClass(r){let e=r.node;return e?.children&&e.children.length>0?e.expanded?"fas fa-folder-open":"fas fa-folder":"far fa-folder"}ngOnDestroy(){clearTimeout(this.dragTimeout),this._templateCache.clear(),this._colTemplateMap.clear()}trackByColumn=(r,e)=>e.field;trackByNode=(r,e)=>e?.data?.key??e?.key??r;getRowStyle=r=>this.hoveredNodeKey()===r?{"border-bottom":"2px solid #2472d1"}:null;changeContextMenu(){this.items=[],this.items.push({label:"Add",icon:"fas fa-plus fa-fw",command:()=>this.add(this.selectedNode())}),this.items.push({label:"Rename",icon:`fas fa-edit  fa-fw ${this.checkedHome()}`,command:()=>{this.checkedHome()||this.rename(this.selectedNode())}}),this.items.push({label:"Properties",icon:`fas fa-screwdriver-wrench fa-fw ${this.checkedHome()}`,command:()=>this.checkedHome()?"":this.properties(this.selectedNode())}),this.items.push({label:"Delete",icon:`fas fa-trash  fa-fw ${this.checkedHome()}`,command:()=>this.checkedHome()?"":this.delete(this.selectedNode())})}allowDrop(r){return r.preventDefault(),!1}onDragEnter(r,e){this.hoveredNodeKey.set(e.key)}onDragLeave=r=>{clearTimeout(this.dragTimeout),this.dragTimeout=setTimeout(()=>{r.relatedTarget?.closest(".data-row")||this.hoveredNodeKey.set(null)},100)};dragTimeout;onDragStart(r,e){clearTimeout(this.dragTimeout),console.debug("TreeTableNodes - onDragStart",e?.key??e?.data?.key,e),(!this.draggedNode||this.draggedNode.key!==e.key)&&(this.draggedNode={key:e.key,name:e.name}),r.dataTransfer&&(r.dataTransfer.effectAllowed="move")}add(r){let e={data:{name:"",key:void 0,type:"add"},children:[],parent:r};r.expanded=!0,r.children=[...r.children||[],e],this.selectedNode.set(e),this.data.update(t=>[...t]),setTimeout(()=>{this.inputAdds?.last?.nativeElement.focus()},0)}checkedHome(){return this.selectedNode()&&this.selectedNode().label=="Home"?"disabled":!1}rename(r){r&&(r.data.type="rename",this.oldLabel=r.data.name,this.selectedNode.set(r),setTimeout(()=>{let e=this.renameInputs?.toArray(),t=e?.[e.length-1];t?.nativeElement&&(t.nativeElement.focus(),t.nativeElement.select())}))}properties(r){mt.IsEmpty(r.data.key)||this.router.navigate([this.propertiesInfoUrl],{queryParams:{ID:r.data.key}})}delete(r){let e=r.data.key,t=this.apiUrls(),n=t.delete??t.delete;(this.deleteMethod()==="delete"?this.onDelete.bind(this):this.onDeletePost.bind(this))(r,e,t,n).subscribe({next:s=>{r.parent?r.parent.children=r.parent.children.filter(c=>c.data.key!==e):this.data.set(this.data().filter(c=>c.data.key!==e)),this.data.set([...this.data()]),this.selectedNode.set(null),this.toastr.success("Success",N.Success)},error:s=>{this.toastr.error(s?.Message??s?.error??"Error",N.Error)}})}onDelete(r,e,t,n){return this.httpService.delete(n,{params:[{key:"ID",value:e}]})}onDeletePost(r,e,t,n){return this.httpService.post(n,{ID:e})}onDropNode(r,e){console.log("Dropped node:",this.draggedNode,"to target:",e),this.hoveredNodeKey.set(null);let t=this.draggedNode.key,n=e.key;if(t!==n){let i={guidID:t,parentID:n},s=this.apiUrls(),c=s.updateParent??s.updateParent;this.httpService.post(c,i).subscribe(g=>{if(!g||g?.Message==="Success"||g?.Message===""){this.toastr.success("Success",N.Success);let I=this.removeNodeByKey(t,this.data());if(I){let v=this.findNodeByKey(n,this.data());v?(v.children=v.children?[...v.children,I]:[I],v.expanded=!0):n===this.nodeRootParent()&&this.data.set([...this.data(),I]),this.data.set([...this.data()])}}else this.toastr.error("Failed",N.Error)})}}findNodeByKey(r,e){for(let t of e||[]){if((t.data?.key??t.key)===r)return t;if(t.children&&t.children.length){let i=this.findNodeByKey(r,t.children);if(i)return i}}return null}removeNodeByKey(r,e){for(let t=0;t<(e||[]).length;t++){let n=e[t];if((n.data?.key??n.key)===r){let[s]=e.splice(t,1);return s}if(n.children&&n.children.length){let s=this.removeNodeByKey(r,n.children);if(s)return s}}return null}onKeydownEvent(r,e,t,n=null){r.key==="Enter"&&(this.selectedNode.set(t),this.selectedNode().data?.type=="rename"?this.saveRename(e,n):this.saveAdd(e))}saveRename(r,e=null){if(this.saveRenameEvent.observed){this.saveRenameEvent.emit({apiUrl:r,dirty:e??!0});return}let t=this.selectedNode();if(!t)return;let n=t.data?.name??"",i=t.parent?.data;t.data.type="default";let s={name:n,parentID:i?.key??this.nodeRootParent(),guidID:t.data?.key};if(n===""){this.toastr.error("Name is required",N.Error),t.data.name=this.oldLabel,this.selectedNode.set(null);return}if(!e){this.selectedNode.set(null);return}let c=this.apiUrls(),g=r??c.rename??c.rename;this.httpService.post(g,s).subscribe({next:()=>{this.toastr.success("Success",N.Success),t.data.type="default",this.selectedNode.set(null)},error:I=>{this.toastr.error(I.error,N.Error),t.data.name=this.oldLabel,t.data.type="default",this.selectedNode.set(null)}})}saveAdd(r){if(this.saveAddEvent.observed){this.saveAddEvent.emit({apiUrl:r});return}let e=this.selectedNode().label??this.selectedNode().data?.name??"",t=this.selectedNode().parent.data,n={name:e,ID:this.selectedNode().key,parentID:t?.key};if(n.name==""){this.toastr.error("Name is required",N.Error),t&&t.children&&t.children.pop(),t&&t.children&&t.children.length==0&&(this.oldParent.icon="far fa-folder"),this.selectedNode.set(null);return}this.selectedNode().data.type="default";let i=this.apiUrls(),s=r??i.create??i.create;this.httpService.post(s,n).subscribe({next:c=>{this.selectedNode().data.key=c.key,this.selectedNode.set(null)},error:c=>{this.toastr.error(c.error,N.Error),t&&t.children&&t.children.pop(),this.selectedNode.set(null)}})}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=q({type:o,selectors:[["POS-tree-table-nodes"]],contentQueries:function(e,t,n){if(e&1&&le(n,be,4)(n,U,4)(n,Kn,5,U),e&2){let i;T(i=M())&&(t.columnTemplates=i),T(i=M())&&(t.projectedTemplates=i),T(i=M())&&(t.countTpl=i)}},viewQuery:function(e,t){if(e&1&&W($n,5)(Hn,5),e&2){let n;T(n=M())&&(t.renameInputs=n),T(n=M())&&(t.inputAdds=n)}},inputs:{data:[1,"data"],cols:"cols",contextMenuList:"contextMenuList",deleteMethod:[1,"deleteMethod"],apiUrls:[1,"apiUrls"],selectedNode:[1,"selectedNode"],propertiesInfoUrl:"propertiesInfoUrl"},outputs:{saveRenameEvent:"saveRenameEvent",saveAddEvent:"saveAddEvent",data:"dataChange",apiUrls:"apiUrlsChange",selectedNode:"selectedNodeChange"},decls:10,vars:10,consts:[["cm",""],["body",""],["renameTpl",""],["add",""],["dirtyRename","ngModel","renameInput",""],["inputAdd",""],["appendTo","body",3,"onShow","model"],["dataKey","key",3,"contextMenuSelectionChange","value","columns","contextMenuSelection","contextMenu","scrollable","lazy","virtualScroll","scrollHeight","virtualRowHeight"],["pTemplate","header"],["pTemplate","default"],[3,"class"],["pDraggable","data-row","pDroppable","data-row",1,"data-row",2,"cursor","pointer",3,"dragenter","drag","drop","ttRow","ttContextMenuRow"],[1,"flex","items-center","gap-2"],[1,"drag-handle","fa","fa-grip-vertical",2,"cursor","grab","color","#ccc","margin-right","5px"],[3,"rowNode"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"storage-icon",3,"ngClass"],["type","text",3,"ngModelChange","keydown","focusout","ngModel"],[3,"ngModelChange","keydown","ngModel"]],template:function(e,t){if(e&1){let n=E();u(0,"p-contextMenu",6,0),y("onShow",function(){return t.changeContextMenu()}),_(),u(2,"p-treetable",7),pe("contextMenuSelectionChange",function(s){return m(n),me(t.selectedNode,s)||(t.selectedNode=s),p(s)}),x(3,qn,3,0,"ng-template",8)(4,ni,3,4,"ng-template",9,1,A)(6,ii,3,1,"ng-template",null,2,A)(8,oi,2,1,"ng-template",null,3,A),_()}if(e&2){let n=S(1);l("model",t.items),d(2),l("value",t.data())("columns",t.cols),de("contextMenuSelection",t.selectedNode),l("contextMenu",n)("scrollable",t.data().length>200)("lazy",!0)("virtualScroll",t.data().length>200)("scrollHeight",t.data().length>200?"350px":"auto")("virtualRowHeight",52.67)}},dependencies:[$t,Bt,fe,Kt,Rt,Ft,Y,st,ge,Qt,Ie,Nt,gt,ut,_t,ht,Pt,Gt,Zt,jt],styles:[".badge[_ngcontent-%COMP%]{display:inline-block}.storage-row[_ngcontent-%COMP%]:hover{background-color:#f0f0f0}.storage-icon[_ngcontent-%COMP%]{margin-right:6px;width:18px;text-align:center;color:#65758c}.drag-target[_ngcontent-%COMP%]{outline:2px dashed #0d6efd;outline-offset:-4px}.hovered[_ngcontent-%COMP%]{border-bottom:2px solid #2472d1}.counter-col-padding[_ngcontent-%COMP%]{padding-right:80px!important}"],changeDetection:0})};export{Qt as a,Gt as b,Wt as c};
