import*as e from"react";import{PrimeReactContext as n}from"primereact/api";import{Button as t}from"primereact/button";import{ComponentBase as r,useHandleStyle as i}from"primereact/componentbase";import{useMergeProps as o,useDisplayOrder as a,useGlobalOnEscapeKey as l,ESC_KEY_HANDLING_PRIORITIES as c,useEventListener as s,useMountEffect as u,useUpdateEffect as d}from"primereact/hooks";import{MinusIcon as p}from"primereact/icons/minus";import{PlusIcon as f}from"primereact/icons/plus";import{Ripple as m}from"primereact/ripple";import{classNames as b,DomHandler as y,UniqueComponentId as v,IconUtils as h,ObjectUtils as g}from"primereact/utils";function w(){return w=Object.assign?Object.assign.bind():function(e){for(var n=1;ne.length)&&(n=e.length);for(var t=0,r=Array(n);t1&&void 0!==arguments[1]?arguments[1]:null)||T);Se(n),e.preventDefault()},we=function(e){var n=ke((arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)||T);Se(n),e.preventDefault()},Se=function(e){var n=A(y.find(L.current,'[data-pc-section="menuitem"]')).filter((function(e){return!y.hasClass(y.findSingle(e,"a"),"p-disabled")}));n[e]&&V(n[e].getAttribute("id"))},ke=function(e){var n=A(y.find(L.current,'[data-pc-section="menuitem"]')).filter((function(e){return!y.hasClass(y.findSingle(e,"a"),"p-disabled")})),t=-1===e?n[n.length-1].id:e,r=n.findIndex((function(e){return e.getAttribute("id")===t}));return r=-1===e?n.length-1:r-1},xe=function(e){var n=A(y.find(L.current,'[data-pc-section="menuitem"]')).filter((function(e){return!y.hasClass(y.findSingle(e,"a"),"p-disabled")})),t=-1===e?n[0].id:e,r=n.findIndex((function(e){return e.getAttribute("id")===t}));return r=-1===e?0:r+1},Ie=function(e){return L.current&&!(L.current.isSameNode(e.target)||L.current.contains(e.target))},Oe=function(e){return(F?e:q.model.length-e-1)*q.transitionDelay},Ce=function(e){var n=q.type;if("linear"!==n){var t=q.model.length,r=q.radius||20*t;if("circle"===n){var i=2*Math.PI/t;return{left:"calc(".concat(r*Math.cos(i*e),"px + var(--item-diff-x, 0px))"),top:"calc(".concat(r*Math.sin(i*e),"px + var(--item-diff-y, 0px))")}}if("semi-circle"===n){var o=q.direction,a=Math.PI/(t-1),l="calc(".concat(r*Math.cos(a*e),"px + var(--item-diff-x, 0px))"),c="calc(".concat(r*Math.sin(a*e),"px + var(--item-diff-y, 0px))");if("up"===o)return{left:l,bottom:c};if("down"===o)return{left:l,top:c};if("left"===o)return{right:c,top:l};if("right"===o)return{left:c,top:l}}else if("quarter-circle"===n){var s=q.direction,u=Math.PI/(2*(t-1)),d="calc(".concat(r*Math.cos(u*e),"px + var(--item-diff-x, 0px))"),p="calc(".concat(r*Math.sin(u*e),"px + var(--item-diff-y, 0px))");if("up-left"===s)return{right:d,bottom:p};if("up-right"===s)return{left:d,bottom:p};if("down-left"===s)return{right:p,top:d};if("down-right"===s)return{left:p,top:d}}}return{}},Ee=function(e){var n=Oe(e),t=Ce(e);return R({transitionDelay:"".concat(n,"ms")},t)};u((function(){if("linear"!==q.type){var e=y.findSingle(L.current,".p-speeddial-button"),n=y.findSingle(J.current,".p-speeddial-item");if(e&&n){var t=Math.abs(e.offsetWidth-n.offsetWidth),r=Math.abs(e.offsetHeight-n.offsetHeight);J.current.style.setProperty("--item-diff-x","".concat(t/2,"px")),J.current.style.setProperty("--item-diff-y","".concat(r/2,"px"))}}})),d((function(){return x&&q.hideOnClickOutside&&Z(),function(){q.hideOnClickOutside&&ee()}}),[x]),e.useImperativeHandle(S,(function(){return{props:q,show:ne,hide:ie,getElement:function(){return L.current}}}));var De=function(n,t){if(!1===n.visible)return null;var r=n.disabled,i=n.icon,o=n.label,a=n.template,l=n.url,c=n.target,s=n.className,u=n.style,d=b("p-speeddial-action",{"p-disabled":r}),p=b("p-speeddial-action-icon",i),f=U({className:$("actionIcon")},Y("actionIcon")),y=U({href:l||"#",role:"menuitem",className:b(s,$("action",{disabled:r})),"aria-label":n.label,style:u,target:c,tabIndex:"-1","data-pr-tooltip":o,onClick:function(e){return ae(e,n)}},Y("action")),v=h.getJSXIcon(i,R({},f),{props:q}),S=e.createElement("a",y,v,e.createElement(m,null));a&&(S=g.getJSXElement(a,n,{onClick:function(e){return ae(e,n)},className:d,iconClassName:p,element:S,props:q,visible:F}));var k,x=U({id:"".concat(E,"_").concat(t),className:$("menuitem",{active:(k="".concat(E,"_").concat(t),T===k)}),style:Ee(t),role:"menuitem"},Y("menuitem"));return e.createElement("li",w({},x,{key:"".concat(E,"_").concat(t)}),S)},je=function(){for(var e="",n=0;n