@seedgrid/fe-components 2026.4.13 → 2026.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -555,9 +555,9 @@ function SgDatatableBase(props, imperativeRef) {
555
555
  return;
556
556
  handleReorderColumn(draggingColumnKey, item.key);
557
557
  setDraggingColumnKey(null);
558
- }, onDragEnd: () => setDraggingColumnKey(null), className: cn("flex items-center gap-3 rounded-md px-2 py-2", draggingColumnKey === item.key ? "opacity-60" : "", "hover:bg-[rgb(var(--sg-primary-50))]"), children: [_jsx("button", { type: "button", disabled: !canHideThisColumn, onClick: () => toggleColumnVisibility(item.key), className: cn("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md border transition", !isHidden
558
+ }, onDragEnd: () => setDraggingColumnKey(null), className: cn("flex items-center gap-3 rounded-md px-2 py-2", draggingColumnKey === item.key ? "opacity-60" : "", "hover:bg-[rgb(var(--sg-primary-50))]"), children: [_jsx("button", { type: "button", disabled: !canHideThisColumn, onClick: () => toggleColumnVisibility(item.key), className: cn("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md border shadow-sm transition", !isHidden
559
559
  ? "border-[rgb(var(--sg-primary-600))] bg-[rgb(var(--sg-primary-600))] text-white"
560
- : "border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] text-transparent", !canHideThisColumn ? "cursor-not-allowed opacity-50" : "hover:scale-[1.02]"), children: _jsx(Check, { size: 14 }) }), _jsx("button", { type: "button", disabled: !canHideThisColumn, onClick: () => toggleColumnVisibility(item.key), className: cn("flex-1 truncate text-left text-sm", isHidden
560
+ : "border-[rgb(var(--sg-primary-300))] bg-[rgb(var(--sg-primary-50))] text-transparent", !canHideThisColumn ? "cursor-not-allowed opacity-50" : "hover:scale-[1.02]"), children: _jsx(Check, { size: 14 }) }), _jsx("button", { type: "button", disabled: !canHideThisColumn, onClick: () => toggleColumnVisibility(item.key), className: cn("flex-1 truncate text-left text-sm", isHidden
561
561
  ? "text-[rgb(var(--sg-muted))]"
562
562
  : "text-[rgb(var(--sg-text))]", !canHideThisColumn ? "cursor-not-allowed" : ""), children: columnLabel }), _jsx("div", { className: cn("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[rgb(var(--sg-muted))]", isReorderable ? "cursor-grab active:cursor-grabbing" : "opacity-40"), title: dragHandleLabel, children: _jsx(GripVertical, { size: 16 }) })] }, `manager-${item.key}`));
563
563
  }) }) }), _jsxs("div", { className: "flex items-center gap-2 border-t border-[rgb(var(--sg-border))] px-3 py-3", children: [_jsx(SgButton, { size: "sm", appearance: "outline", onClick: restoreDefaultColumns, children: restoreColumnsLabel }), _jsx(SgButton, { size: "sm", appearance: "outline", onClick: showAllColumns, children: showAllColumnsLabel })] })] }), document.body)
package/dist/sandbox.cjs CHANGED
@@ -94,7 +94,7 @@ ${e??""}
94
94
  ${Ae?"opacity-50 cursor-not-allowed":""}
95
95
  ${g?"cursor-default":""}
96
96
  ${F}
97
- `,children:[(0,Vt.jsx)("input",{type:"checkbox",...H,value:K.value,checked:$e,disabled:Ae||g,onChange:Qe=>{H.onChange(Qe),q(K.value)},className:"w-4 h-4 rounded text-[rgb(var(--sg-primary-500))] border-[rgb(var(--sg-border))] focus:ring-[rgb(var(--sg-ring))] focus:ring-2 cursor-pointer disabled:cursor-not-allowed"}),K.icon&&(0,Vt.jsx)("span",{className:"flex items-center justify-center",children:K.icon}),!u&&(0,Vt.jsx)("span",{className:"text-sm text-[rgb(var(--sg-text))]",children:K.label})]},`${K.value}-${se}`)})})]}),x&&(0,Vt.jsx)("div",{className:"mt-1 text-sm text-red-500",children:x})]})}return(0,Vt.jsxs)("div",{className:I,style:D,children:[(0,Vt.jsx)(sr,{...v,title:G||" ",className:v.className||"",children:me}),x&&(0,Vt.jsx)("div",{className:"mt-1 text-sm text-red-500",children:x})]})}var Vg=La.default.forwardRef((e,t)=>zg(e,t));var vn=je(require("react"),1);var Hg=je(require("react"),1),gr=require("react/jsx-runtime");function Xr(...e){return e.filter(Boolean).join(" ")}var Ry={primary:{bg:"var(--sg-btn-primary-bg, hsl(var(--primary)))",fg:"var(--sg-btn-primary-fg, hsl(var(--primary-foreground)))",border:"var(--sg-btn-primary-border, hsl(var(--primary)))",hoverBg:"var(--sg-btn-primary-hover-bg, hsl(var(--primary)))",ring:"var(--sg-btn-primary-ring, hsl(var(--primary)/0.35))"},secondary:{bg:"var(--sg-btn-secondary-bg, hsl(var(--secondary)))",fg:"var(--sg-btn-secondary-fg, hsl(var(--secondary-foreground)))",border:"var(--sg-btn-secondary-border, hsl(var(--secondary)))",hoverBg:"var(--sg-btn-secondary-hover-bg, hsl(var(--secondary)))",ring:"var(--sg-btn-secondary-ring, hsl(var(--secondary)/0.35))"},success:{bg:"var(--sg-btn-success-bg, hsl(var(--tertiary, var(--accent))))",fg:"var(--sg-btn-success-fg, hsl(var(--tertiary-foreground, var(--accent-foreground, 0 0% 100%))))",border:"var(--sg-btn-success-border, hsl(var(--tertiary, var(--accent))))",hoverBg:"var(--sg-btn-success-hover-bg, hsl(var(--tertiary, var(--accent))))",ring:"var(--sg-btn-success-ring, hsl(var(--tertiary, var(--accent))/0.35))"},info:{bg:"var(--sg-btn-info-bg, hsl(var(--secondary, var(--primary))))",fg:"var(--sg-btn-info-fg, hsl(var(--secondary-foreground, var(--primary-foreground))))",border:"var(--sg-btn-info-border, hsl(var(--secondary, var(--primary))))",hoverBg:"var(--sg-btn-info-hover-bg, hsl(var(--secondary, var(--primary))))",ring:"var(--sg-btn-info-ring, hsl(var(--secondary, var(--primary))/0.35))"},warning:{bg:"var(--sg-btn-warning-bg, hsl(var(--secondary, var(--accent))))",fg:"var(--sg-btn-warning-fg, hsl(var(--secondary-foreground, var(--accent-foreground, 0 0% 100%))))",border:"var(--sg-btn-warning-border, hsl(var(--secondary, var(--accent))))",hoverBg:"var(--sg-btn-warning-hover-bg, hsl(var(--secondary, var(--accent))))",ring:"var(--sg-btn-warning-ring, hsl(var(--secondary, var(--accent))/0.35))"},help:{bg:"var(--sg-btn-help-bg, hsl(var(--secondary, var(--primary))))",fg:"var(--sg-btn-help-fg, hsl(var(--secondary-foreground, var(--primary-foreground))))",border:"var(--sg-btn-help-border, hsl(var(--secondary, var(--primary))))",hoverBg:"var(--sg-btn-help-hover-bg, hsl(var(--secondary, var(--primary))))",ring:"var(--sg-btn-help-ring, hsl(var(--secondary, var(--primary))/0.35))"},danger:{bg:"var(--sg-btn-danger-bg, hsl(var(--destructive)))",fg:"var(--sg-btn-danger-fg, hsl(var(--destructive-foreground)))",border:"var(--sg-btn-danger-border, hsl(var(--destructive)))",hoverBg:"var(--sg-btn-danger-hover-bg, hsl(var(--destructive)))",ring:"var(--sg-btn-danger-ring, hsl(var(--destructive)/0.35))"}},ky={sm:{h:"h-8",minH:"min-h-8",py:"py-1.5",px:"px-3",text:"text-sm",gap:"gap-2",icon:"size-4",radius:"rounded-md"},md:{h:"h-10",minH:"min-h-10",py:"py-2",px:"px-4",text:"text-sm",gap:"gap-2",icon:"size-4",radius:"rounded-lg"},lg:{h:"h-12",minH:"min-h-12",py:"py-2.5",px:"px-5",text:"text-base",gap:"gap-2.5",icon:"size-5",radius:"rounded-xl"}};function Py(e,t){let n=Ry[e];return{bg:t?.bg??n.bg,fg:t?.fg??n.fg,border:t?.border??n.border,hoverBg:t?.hoverBg??n.hoverBg,hoverFg:t?.hoverFg??t?.fg??n.fg,hoverBorder:t?.hoverBorder??t?.border??n.border,activeBg:t?.activeBg??t?.hoverBg??n.hoverBg,ring:t?.ring??n.ring}}function Ty(e,t){let n=Py(e,t),r=e==="danger"?"error":e==="help"?"tertiary":e;return{"--sg-btn-bg":n.bg,"--sg-btn-fg":n.fg,"--sg-btn-border":n.border,"--sg-btn-hover-bg":n.hoverBg,"--sg-btn-hover-fg":n.hoverFg,"--sg-btn-hover-border":n.hoverBorder,"--sg-btn-active-bg":n.activeBg,"--sg-btn-ring":n.ring,"--sg-btn-tint":`var(--sg-${r}-600)`}}function Ny(e){switch(e){case"solid":return Xr("bg-[var(--sg-btn-bg)] text-[var(--sg-btn-fg)] border border-[var(--sg-btn-border)]","hover:bg-[var(--sg-btn-hover-bg)] hover:text-[var(--sg-btn-hover-fg)] hover:border-[var(--sg-btn-hover-border)]","active:bg-[var(--sg-btn-active-bg)]");case"outline":return Xr("bg-transparent text-[var(--sg-btn-bg)] border border-[var(--sg-btn-border)]","hover:bg-[rgb(var(--sg-btn-tint)/0.12)]","active:bg-[rgb(var(--sg-btn-tint)/0.18)]");case"ghost":return Xr("bg-transparent text-[var(--sg-btn-bg)] border border-transparent","hover:bg-[rgb(var(--sg-btn-tint)/0.10)]","active:bg-[rgb(var(--sg-btn-tint)/0.16)]")}}function My(e){switch(e){case"sm":return"shadow-sm hover:shadow-md active:shadow-sm";case"md":return"shadow-md hover:shadow-lg active:shadow-md";default:return""}}var Tt=Hg.forwardRef(({severity:e="primary",appearance:t="solid",size:n,shape:r,elevation:o="none",label:s,iconOnly:i,leftIcon:c,rightIcon:d,loading:u=!1,disabled:m,className:g,children:h,style:b,customColors:S,type:R="button",...C},N)=>{let B=h??s,P=!!(m||u),x=i??(!B&&(c||d)),I=n??(x?"sm":"md"),D=r??(x?"circle":"default"),F=ky[I],v=Xr("inline-flex min-w-0 items-center justify-center",x?void 0:"w-full",F.gap);return(0,gr.jsx)("button",{ref:N,type:R,disabled:P,style:{...Ty(e,S),...b},className:Xr("inline-flex min-w-0 max-w-full items-center justify-center select-none whitespace-normal break-words text-center","font-medium","transition-[background-color,color,border-color,box-shadow,transform] duration-150","focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-[var(--sg-btn-ring)]","disabled:opacity-60 disabled:cursor-not-allowed",x?Xr("aspect-square",F.h):Xr(F.minH,F.py,F.px),F.text,D==="rounded"||D==="circle"?"rounded-full":D==="square"?"rounded-none":F.radius,Ny(t),My(o),P?!1:"active:translate-y-[0.5px]",g),...C,children:u?(0,gr.jsxs)("span",{className:v,children:[(0,gr.jsx)(Iy,{className:F.icon}),B?(0,gr.jsx)("span",{className:"min-w-0 whitespace-normal break-words",children:B}):null]}):(0,gr.jsxs)("span",{className:v,children:[c?(0,gr.jsx)("span",{className:Xr("shrink-0",F.icon),children:c}):null,B?(0,gr.jsx)("span",{className:"min-w-0 whitespace-normal break-words",children:B}):null,d?(0,gr.jsx)("span",{className:Xr("shrink-0",F.icon),children:d}):null]})})});Tt.displayName="SgButton";function Iy({className:e}){return(0,gr.jsxs)("svg",{className:Xr("animate-spin",e),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,gr.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"3"}),(0,gr.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}var ln=require("react/jsx-runtime");function Ui(...e){return e.filter(Boolean).join(" ")}function ji(e){return Array.from(new Set(e))}function Ey(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function ru(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Dy(e,t){let n=new Set(t);return new Set(e.filter(r=>n.has(r.value)&&!r.disabled).map(r=>r.value))}function $g(e,t){if(e.length<2||t.size===0)return e;let n=e.filter(s=>t.has(s.value));if(n.length===0)return e;let r=e.filter(s=>!t.has(s.value)),o=[...n,...r];return ru(e,o)?e:o}function _g(e,t){if(e.length<2||t.size===0)return e;let n=e.filter(s=>t.has(s.value));if(n.length===0)return e;let o=[...e.filter(s=>!t.has(s.value)),...n];return ru(e,o)?e:o}function Wg(e,t){if(e.length<2||t.size===0)return e;let n=[...e],r=!1;for(let o=1;o<n.length;o+=1){let s=n[o],i=n[o-1];!t.has(s.value)||t.has(i.value)||(n[o]=i,n[o-1]=s,r=!0)}return r?n:e}function qg(e,t){if(e.length<2||t.size===0)return e;let n=[...e],r=!1;for(let o=n.length-2;o>=0;o-=1){let s=n[o],i=n[o+1];!t.has(s.value)||t.has(i.value)||(n[o]=i,n[o+1]=s,r=!0)}return r?n:e}function Ay(e,t,n){if(e.length<2||t<0||t>=e.length||n<0||n>e.length||t===n||t+1===n)return e;let r=[...e],[o]=r.splice(t,1);if(!o)return e;let s=t<n?n-1:n,i=Math.max(0,Math.min(s,r.length));return r.splice(i,0,o),ru(e,r)?e:r}function Gg(e,t){let n=Me(),{id:r,title:o,source:s,value:i,onChange:c,selectedValues:d,onSelectionChange:u,selectionMode:m="multiple",showControls:g=!0,controlsPosition:h="left",draggable:b=!0,disabled:S=!1,readOnly:R=!1,emptyMessage:C,itemTemplate:N,className:B="",style:P,listClassName:w="",itemClassName:x="",groupBoxProps:I={},error:D}=e,[F,v]=vn.default.useState(()=>i??s),[$,G]=vn.default.useState(()=>ji(d??[])),[j,_]=vn.default.useState(null),[V,U]=vn.default.useState(null),[A,q]=vn.default.useState(null),M=i!==void 0,T=d!==void 0;vn.default.useEffect(()=>{M||v(s)},[s,M]);let z=M?i:F,ee=T?d??[]:$,O=vn.default.useMemo(()=>{let Q=new Set(z.map(Pe=>Pe.value));return ji(ee.filter(Pe=>Q.has(Pe)))},[ee,z]),de=vn.default.useMemo(()=>new Set(O),[O]);vn.default.useEffect(()=>{T||G(Q=>{let Pe=new Set(z.map(ue=>ue.value)),at=ji(Q.filter(ue=>Pe.has(ue)));return Ey(Q,at)?Q:at})},[z,T]);let Re=!S&&!R,W=b&&Re,Y=vn.default.useMemo(()=>Dy(z,O),[z,O]),me=vn.default.useCallback(Q=>{M||v(Q),c?.(Q)},[M,c]),H=vn.default.useCallback(Q=>{let Pe=ji(Q);T||G(Pe),u?.(Pe)},[T,u]),K=vn.default.useCallback(Q=>{if(!Re||Y.size===0)return;let Pe=z;Q==="top"&&(Pe=$g(z,Y)),Q==="up"&&(Pe=Wg(z,Y)),Q==="down"&&(Pe=qg(z,Y)),Q==="bottom"&&(Pe=_g(z,Y)),Pe!==z&&me(Pe)},[Re,me,z,Y]);vn.default.useImperativeHandle(t,()=>({getItems:()=>z,setItems:Q=>me(Q),getSelection:()=>O,setSelection:Q=>H(Q),moveTop:()=>K("top"),moveUp:()=>K("up"),moveDown:()=>K("down"),moveBottom:()=>K("bottom"),clearSelection:()=>H([])}),[K,me,H,z,O]);let se=vn.default.useCallback((Q,Pe,at)=>{if(!Re||Pe.disabled)return;let ue=Pe.value;if(m==="single"){H([ue]),_(ue);return}if(Q.shiftKey&&j!==null){let ce=z.findIndex(be=>be.value===j);if(ce>=0){let be=Math.min(ce,at),qe=Math.max(ce,at),Ne=z.slice(be,qe+1).filter(le=>!le.disabled).map(le=>le.value);Q.metaKey||Q.ctrlKey?H([...O,...Ne]):H(Ne);return}}let J=de.has(ue)?O.filter(ce=>ce!==ue):[...O,ue];H(J),_(ue)},[j,Re,H,z,O,de,m]),$e=vn.default.useCallback(()=>{U(null),q(null)},[]),Ae=vn.default.useCallback((Q,Pe,at)=>{if(!W||Pe.disabled){Q.preventDefault();return}U(at),q(at),Q.dataTransfer.effectAllowed="move";try{Q.dataTransfer.setData("text/plain",String(Pe.value))}catch{}if(!de.has(Pe.value)){let ue=m==="single"?[Pe.value]:[Pe.value];H(ue),_(Pe.value)}},[W,H,de,m]),Qe=vn.default.useCallback((Q,Pe)=>{!W||V===null||(Q.preventDefault(),Q.dataTransfer.dropEffect="move",q(Pe))},[W,V]),ge=vn.default.useCallback((Q,Pe)=>{if(!W||V===null)return;Q.preventDefault();let at=Ay(z,V,Pe);at!==z&&me(at),$e()},[W,$e,me,z,V]),pe=vn.default.useCallback((Q,Pe,at)=>{if(Q.key===" "||Q.key==="Enter"){Q.preventDefault(),se(Q,Pe,at);return}if((Q.ctrlKey||Q.metaKey)&&Q.key==="ArrowUp"){Q.preventDefault(),K("up");return}if((Q.ctrlKey||Q.metaKey)&&Q.key==="ArrowDown"){Q.preventDefault(),K("down");return}if((Q.ctrlKey||Q.metaKey)&&Q.key==="Home"){Q.preventDefault(),K("top");return}(Q.ctrlKey||Q.metaKey)&&Q.key==="End"&&(Q.preventDefault(),K("bottom"))},[K,se]),fe=k(n,"components.orderlist.moveTop"),We=k(n,"components.orderlist.moveUp"),Be=k(n,"components.orderlist.moveDown"),Ee=k(n,"components.orderlist.moveBottom"),ke=C??k(n,"components.orderlist.empty"),ne=Re&&$g(z,Y)!==z,he=Re&&Wg(z,Y)!==z,Fe=Re&&qg(z,Y)!==z,ze=Re&&_g(z,Y)!==z,X=(0,ln.jsxs)("ul",{id:r,role:"listbox","aria-multiselectable":m==="multiple"?!0:void 0,"aria-disabled":S||void 0,"aria-readonly":R||void 0,className:Ui("w-full min-w-0 overflow-y-auto rounded-lg border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] p-1","max-h-[22rem]",w),children:[z.length===0?(0,ln.jsx)("li",{className:"list-none px-3 py-4 text-sm text-[rgb(var(--sg-muted))]",children:ke}):z.map((Q,Pe)=>{let at=de.has(Q.value),ue=S||!!Q.disabled,Z=A===Pe&&V!==null&&V!==Pe,J=V===Pe;return(0,ln.jsx)("li",{className:"list-none",children:(0,ln.jsxs)("button",{type:"button",role:"option","aria-selected":at,draggable:W&&!Q.disabled,disabled:ue,onClick:ce=>se(ce,Q,Pe),onKeyDown:ce=>pe(ce,Q,Pe),onDragStart:ce=>Ae(ce,Q,Pe),onDragOver:ce=>Qe(ce,Pe),onDrop:ce=>ge(ce,Pe),onDragEnd:$e,className:Ui("group flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-all",at?"bg-[rgb(var(--sg-primary-100))] text-[rgb(var(--sg-text))] ring-1 ring-[rgb(var(--sg-primary-300))]":"bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] text-[rgb(var(--sg-text))] hover:bg-[rgb(var(--sg-primary-50))]",ue?"cursor-not-allowed opacity-60":"cursor-pointer",W&&!Q.disabled?"active:cursor-grabbing":"",Z?"ring-2 ring-[rgb(var(--sg-primary-400))]":"",J?"opacity-50":"",x),children:[(0,ln.jsx)("span",{className:"min-w-0 flex-1",children:N?N(Q,{index:Pe,selected:at,disabled:ue}):(0,ln.jsxs)("span",{className:"flex items-center gap-2",children:[Q.icon?(0,ln.jsx)("span",{className:"shrink-0",children:Q.icon}):null,(0,ln.jsx)("span",{className:"truncate",children:Q.label})]})}),W&&!Q.disabled?(0,ln.jsx)("span",{"aria-hidden":"true",className:"shrink-0 text-xs tracking-wide text-[rgb(var(--sg-muted))]",children:"::"}):null]})},`${Q.value}-${Pe}`)}),W&&z.length>0?(0,ln.jsx)("li",{className:"list-none",children:(0,ln.jsx)("div",{onDragOver:Q=>Qe(Q,z.length),onDrop:Q=>ge(Q,z.length),className:Ui("mt-1 h-3 rounded-md border border-dashed border-transparent transition-colors",A===z.length?"border-[rgb(var(--sg-primary-400))] bg-[rgb(var(--sg-primary-100))]":"")})}):null]}),ae=g?(0,ln.jsxs)("div",{className:"flex shrink-0 flex-col gap-2",children:[(0,ln.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!ne,title:fe,"aria-label":fe,onClick:()=>K("top"),children:"Top"}),(0,ln.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!he,title:We,"aria-label":We,onClick:()=>K("up"),children:"Up"}),(0,ln.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,title:Be,"aria-label":Be,onClick:()=>K("down"),children:"Down"}),(0,ln.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!ze,title:Ee,"aria-label":Ee,onClick:()=>K("bottom"),children:"Bottom"})]}):null,ie=h==="right"?"flex-row-reverse":"flex-row",ve=(I.title??o??"").trim()||" ";return(0,ln.jsx)("div",{className:B,style:P,children:(0,ln.jsxs)(sr,{...I,title:ve,children:[D?(0,ln.jsx)("p",{className:"mb-2 text-xs text-red-600",children:D}):null,(0,ln.jsxs)("div",{className:Ui("flex items-start gap-3",ie),children:[ae,(0,ln.jsx)("div",{className:"min-w-0 flex-1",children:X})]})]})})}var Ug=vn.default.forwardRef((e,t)=>{let{control:n,name:r,rules:o,...s}=e;return n&&r?(0,ln.jsx)(zt,{name:r,control:n,rules:o,render:({field:i,fieldState:c})=>Gg({...s,error:ht(s.error,c.error?.message),value:Array.isArray(i.value)?i.value:s.value,onChange:d=>{s.onChange?.(d),i.onChange(d)}},t)}):Gg(s,t)});var Ln=je(require("react"),1);var Rt=require("react/jsx-runtime");function jg(...e){return e.filter(Boolean).join(" ")}function Ba(e){return Array.from(new Set(e))}function Ly(e,t,n){if(e.length<2||t<0||t>=e.length||n<0||n>e.length||t===n||t+1===n)return e;let r=[...e],[o]=r.splice(t,1);if(o===void 0)return e;let s=t<n?n-1:n,i=Math.max(0,Math.min(s,r.length));return r.splice(i,0,o),r}function By(e,t){let n=e.filter(o=>t.has(o.value)&&!o.disabled);if(n.length===0)return e;let r=e.filter(o=>!(t.has(o.value)&&!o.disabled));return[...n,...r]}function Fy(e,t){let n=e.filter(o=>t.has(o.value)&&!o.disabled);return n.length===0?e:[...e.filter(o=>!(t.has(o.value)&&!o.disabled)),...n]}function Oy(e,t){let n=[...e];for(let r=1;r<n.length;r+=1){let o=n[r],s=n[r-1];t.has(o.value)&&!o.disabled&&(t.has(s.value)&&!s.disabled||(n[r]=s,n[r-1]=o))}return n}function zy(e,t){let n=[...e];for(let r=n.length-2;r>=0;r-=1){let o=n[r],s=n[r+1];t.has(o.value)&&!o.disabled&&(t.has(s.value)&&!s.disabled||(n[r]=s,n[r+1]=o))}return n}function Yg(e,t,n){let r=e.toLowerCase(),o=t.toLowerCase();return n==="startsWith"?r.startsWith(o):n==="endsWith"?r.endsWith(o):r.includes(o)}function Kg(e,t){let n=Me(),{id:r,title:o,source:s,target:i,value:c,onChange:d,sourceSelection:u,targetSelection:m,onSourceSelectionChange:g,onTargetSelectionChange:h,selectionMode:b="multiple",sourceHeader:S,targetHeader:R,showTransferControls:C=!0,showSourceControls:N=!0,showTargetControls:B=!0,showSourceFilter:P=!1,showTargetFilter:w=!1,sourceFilterPlaceholder:x,targetFilterPlaceholder:I,filterMatchMode:D="contains",draggable:F=!0,disabled:v=!1,readOnly:$=!1,emptyMessage:G,itemTemplate:j,className:_="",style:V,listClassName:U="",itemClassName:A="",groupBoxProps:q={},error:M}=e,[T,z]=Ln.default.useState(()=>({source:s,target:i})),[ee,O]=Ln.default.useState(()=>Ba(u??[])),[de,Re]=Ln.default.useState(()=>Ba(m??[])),[W,Y]=Ln.default.useState(""),[me,H]=Ln.default.useState(""),[K,se]=Ln.default.useState(null),$e=c!==void 0,Ae=u!==void 0,Qe=m!==void 0;Ln.default.useEffect(()=>{$e||z({source:s,target:i})},[s,i,$e]);let ge=$e?c:T,pe=ge.source??[],fe=ge.target??[],We=Ae?u??[]:ee,Be=Qe?m??[]:de,Ee=Ba(We.filter(ye=>pe.some(Ze=>Ze.value===ye))),ke=Ba(Be.filter(ye=>fe.some(Ze=>Ze.value===ye))),ne=new Set(Ee),he=new Set(ke),Fe=!v&&!$,ze=Ln.default.useCallback((ye,Ze)=>{$e||z(ye),d?.({...ye,type:Ze})},[$e,d]),X=Ln.default.useCallback(ye=>{let Ze=Ba(ye);Ae||O(Ze),g?.(Ze)},[Ae,g]),ae=Ln.default.useCallback(ye=>{let Ze=Ba(ye);Qe||Re(Ze),h?.(Ze)},[Qe,h]),ie=Ln.default.useCallback(()=>{X([]),ae([])},[X,ae]),ve=Ln.default.useCallback(()=>{if(!Fe)return;let ye=pe.filter(et=>ne.has(et.value)&&!et.disabled);if(ye.length===0)return;let Ze=pe.filter(et=>!(ne.has(et.value)&&!et.disabled)),ot=[...fe,...ye];ze({source:Ze,target:ot},"moveToTarget"),X([]),ae(ye.map(et=>et.value))},[Fe,pe,ne,fe,ze,X,ae]),Q=Ln.default.useCallback(()=>{if(!Fe)return;let ye=pe.filter(et=>!et.disabled);if(ye.length===0)return;let Ze=pe.filter(et=>et.disabled),ot=[...fe,...ye];ze({source:Ze,target:ot},"moveAllToTarget"),X([]),ae(ye.map(et=>et.value))},[Fe,pe,fe,ze,X,ae]),Pe=Ln.default.useCallback(()=>{if(!Fe)return;let ye=fe.filter(et=>he.has(et.value)&&!et.disabled);if(ye.length===0)return;let Ze=fe.filter(et=>!(he.has(et.value)&&!et.disabled)),ot=[...pe,...ye];ze({source:ot,target:Ze},"moveToSource"),ae([]),X(ye.map(et=>et.value))},[Fe,fe,he,pe,ze,ae,X]),at=Ln.default.useCallback(()=>{if(!Fe)return;let ye=fe.filter(et=>!et.disabled);if(ye.length===0)return;let Ze=fe.filter(et=>et.disabled),ot=[...pe,...ye];ze({source:ot,target:Ze},"moveAllToSource"),ae([]),X(ye.map(et=>et.value))},[Fe,fe,pe,ze,ae,X]),ue=Ln.default.useCallback((ye,Ze)=>{if(!Fe)return;if(ye==="source"){let Ht=pe[Ze];if(!Ht||Ht.disabled)return;let Pt=pe.filter((It,fn)=>fn!==Ze),Mt=[...fe,Ht];ze({source:Pt,target:Mt},"moveToTarget"),X(Ee.filter(It=>It!==Ht.value)),ae([Ht.value]);return}let ot=fe[Ze];if(!ot||ot.disabled)return;let et=fe.filter((Ht,Pt)=>Pt!==Ze),mt=[...pe,ot];ze({source:mt,target:et},"moveToSource"),ae(ke.filter(Ht=>Ht!==ot.value)),X([ot.value])},[Fe,pe,fe,Ee,ke,ze,X,ae]);Ln.default.useImperativeHandle(t,()=>({getValue:()=>({source:pe,target:fe}),setValue:ye=>ze(ye,"dragdrop"),moveToTarget:ve,moveAllToTarget:Q,moveToSource:Pe,moveAllToSource:at,clearSelection:ie}),[pe,fe,ze,ve,Q,Pe,at,ie]);let Z=(ye,Ze)=>{if(!Fe)return;let ot=ye==="source"?pe:fe,et=ye==="source"?ne:he;if(et.size===0)return;let mt=ot;Ze==="top"&&(mt=By(ot,et)),Ze==="up"&&(mt=Oy(ot,et)),Ze==="down"&&(mt=zy(ot,et)),Ze==="bottom"&&(mt=Fy(ot,et)),ye==="source"&&ze({source:mt,target:fe},"reorderSource"),ye==="target"&&ze({source:pe,target:mt},"reorderTarget")},J=(ye,Ze)=>{if(!Fe||Ze.disabled)return;let ot=ye==="source"?ne:he,et=ye==="source"?X:ae,mt=ye==="source"?Ee:ke;if(b==="single"){et([Ze.value]);return}ot.has(Ze.value)?et(mt.filter(Ht=>Ht!==Ze.value)):et([...mt,Ze.value])},ce=Fe&&F,be=(ye,Ze)=>{if(!ce||!K)return;if(K.from===ye){let fn=Ly(ye==="source"?pe:fe,K.fromIndex,Ze);ye==="source"&&ze({source:fn,target:fe},"reorderSource"),ye==="target"&&ze({source:pe,target:fn},"reorderTarget"),se(null);return}let ot=K.from==="source"?pe:fe,et=ye==="source"?pe:fe,mt=ot[K.fromIndex];if(!mt||mt.disabled){se(null);return}let Ht=ot.filter((It,fn)=>fn!==K.fromIndex),Pt=[...et],Mt=Math.max(0,Math.min(Ze,Pt.length));Pt.splice(Mt,0,mt),K.from==="source"&&ye==="target"?(ze({source:Ht,target:Pt},"dragdrop"),X(Ee.filter(It=>It!==mt.value))):(ze({source:Pt,target:Ht},"dragdrop"),ae(ke.filter(It=>It!==mt.value))),se(null)},qe=k(n,"components.orderlist.moveTop"),Ne=k(n,"components.orderlist.moveUp"),le=k(n,"components.orderlist.moveDown"),Ye=k(n,"components.orderlist.moveBottom"),_e=k(n,"components.picklist.moveToTarget"),we=k(n,"components.picklist.moveAllToTarget"),xe=k(n,"components.picklist.moveToSource"),Ce=k(n,"components.picklist.moveAllToSource"),Te=S??k(n,"components.picklist.sourceHeader"),De=R??k(n,"components.picklist.targetHeader"),Ve=x??k(n,"components.picklist.sourceFilterPlaceholder"),Le=I??k(n,"components.picklist.targetFilterPlaceholder"),Je=G??k(n,"components.picklist.empty"),ct=pe.map((ye,Ze)=>({item:ye,index:Ze})).filter(({item:ye})=>!W||Yg(ye.label,W,D)),it=fe.map((ye,Ze)=>({item:ye,index:Ze})).filter(({item:ye})=>!me||Yg(ye.label,me,D)),At=(ye,Ze,ot)=>(0,Rt.jsx)("ul",{id:r?`${r}-${ye}`:void 0,role:"listbox","aria-multiselectable":b==="multiple"||void 0,className:jg("max-h-[22rem] min-w-0 w-full overflow-y-auto rounded-lg border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] p-1",U),onDragOver:et=>{ce&&et.preventDefault()},onDrop:et=>{ce&&(et.preventDefault(),be(ye,ye==="source"?pe.length:fe.length))},children:Ze.length===0?(0,Rt.jsx)("li",{className:"list-none px-3 py-4 text-sm text-[rgb(var(--sg-muted))]",children:Je}):Ze.map(({item:et,index:mt})=>{let Ht=ot.has(et.value),Pt=v||!!et.disabled;return(0,Rt.jsx)("li",{className:"list-none",children:(0,Rt.jsxs)("button",{type:"button",role:"option","aria-selected":Ht,disabled:Pt,draggable:ce&&!et.disabled,onClick:Mt=>{if(Mt.detail>=2){ue(ye,mt);return}J(ye,et)},onDragStart:Mt=>{se({from:ye,fromIndex:mt}),Mt.dataTransfer.effectAllowed="move";try{Mt.dataTransfer.setData("text/plain",String(et.value))}catch{}},onDragOver:Mt=>{ce&&Mt.preventDefault()},onDrop:Mt=>{ce&&(Mt.preventDefault(),Mt.stopPropagation(),be(ye,mt))},onDragEnd:()=>se(null),className:jg("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm",Ht?"bg-[rgb(var(--sg-primary-100))] ring-1 ring-[rgb(var(--sg-primary-300))]":"bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] hover:bg-[rgb(var(--sg-primary-50))]",Pt?"cursor-not-allowed opacity-60":"cursor-pointer",A),children:[(0,Rt.jsx)("span",{className:"min-w-0 flex-1 truncate",children:j?j(et,{index:mt,selected:Ht,disabled:Pt,list:ye}):(0,Rt.jsxs)("span",{className:"flex items-center gap-2",children:[et.icon?(0,Rt.jsx)("span",{className:"shrink-0",children:et.icon}):null,(0,Rt.jsx)("span",{className:"truncate",children:et.label})]})}),ce&&!et.disabled?(0,Rt.jsx)("span",{"aria-hidden":"true",className:"shrink-0 text-xs text-[rgb(var(--sg-muted))]",children:"::"}):null]})},`${et.value}-${mt}`)})}),ft=ye=>(0,Rt.jsxs)("div",{className:"flex shrink-0 flex-col gap-2",children:[(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":qe,title:qe,onClick:()=>Z(ye,"top"),children:k(n,"components.actions.top")}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":Ne,title:Ne,onClick:()=>Z(ye,"up"),children:k(n,"components.actions.up")}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":le,title:le,onClick:()=>Z(ye,"down"),children:k(n,"components.actions.down")}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":Ye,title:Ye,onClick:()=>Z(ye,"bottom"),children:k(n,"components.actions.bottom")})]}),gt=C?(0,Rt.jsxs)("div",{className:"flex shrink-0 flex-row gap-2 md:flex-col",children:[(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":_e,title:_e,onClick:ve,children:">"}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":we,title:we,onClick:Q,children:">>"}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":xe,title:xe,onClick:Pe,children:"<"}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":Ce,title:Ce,onClick:at,children:"<<"})]}):null,an=(q.title??o??"").trim()||" ";return(0,Rt.jsx)("div",{className:_,style:V,children:(0,Rt.jsxs)(sr,{...q,title:an,children:[M?(0,Rt.jsx)("p",{className:"mb-2 text-xs text-red-600",children:M}):null,(0,Rt.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] md:items-start",children:[(0,Rt.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,Rt.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-[rgb(var(--sg-muted))]",children:Te}),P?(0,Rt.jsx)("input",{value:W,onChange:ye=>Y(ye.target.value),placeholder:Ve,className:"w-full rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-sm text-[rgb(var(--sg-input-fg,var(--sg-text)))] placeholder:text-[rgb(var(--sg-input-placeholder,var(--sg-muted)))] outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]"}):null,(0,Rt.jsxs)("div",{className:"flex items-start gap-2",children:[N?ft("source"):null,(0,Rt.jsx)("div",{className:"min-w-0 flex-1",children:At("source",ct,ne)})]})]}),(0,Rt.jsx)("div",{className:"flex justify-center md:pt-7",children:gt}),(0,Rt.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,Rt.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-[rgb(var(--sg-muted))]",children:De}),w?(0,Rt.jsx)("input",{value:me,onChange:ye=>H(ye.target.value),placeholder:Le,className:"w-full rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-sm text-[rgb(var(--sg-input-fg,var(--sg-text)))] placeholder:text-[rgb(var(--sg-input-placeholder,var(--sg-muted)))] outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]"}):null,(0,Rt.jsxs)("div",{className:"flex items-start gap-2",children:[(0,Rt.jsx)("div",{className:"min-w-0 flex-1",children:At("target",it,he)}),B?ft("target"):null]})]})]})]})})}var Zg=Ln.default.forwardRef((e,t)=>{let{control:n,name:r,rules:o,...s}=e;return n&&r?(0,Rt.jsx)(zt,{name:r,control:n,rules:o,render:({field:i,fieldState:c})=>Kg({...s,error:ht(s.error,c.error?.message),value:i.value??s.value,onChange:d=>{s.onChange?.(d),i.onChange({source:d.source,target:d.target})}},t)}):Kg(s,t)});var lt=je(require("react"),1),Jg=require("react-dom"),Zo=require("lucide-react");var st=require("react/jsx-runtime");function zr(...e){return e.filter(Boolean).join(" ")}function Ko(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Yi(e){return e?Object.entries(e).reduce((t,[n,r])=>{let o=String(r??"").trim();return o&&(t[n]=o),t},{}):{}}function Fa(e,t){if(!t)return;if(!t.includes("."))return e[t];let n=t.split("."),r=e;for(let o of n){if(r==null||typeof r!="object")return;r=r[o]}return r}function Vy(e){return e==null?"":typeof e=="string"?e.toLowerCase():typeof e=="number"||typeof e=="bigint"?String(e):typeof e=="boolean"?e?"true":"false":e instanceof Date?e.toISOString().toLowerCase():String(e).toLowerCase()}function Xg(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let o=Vy(e);return n==="startsWith"?o.startsWith(r):n==="endsWith"?o.endsWith(r):n==="equals"?o===r:o.includes(r)}function Hy(e,t){return e===t?0:e==null?-1:t==null?1:typeof e=="number"&&typeof t=="number"?e-t:e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t),void 0,{sensitivity:"base",numeric:!0})}function Ki(e,t,n){return e===t?n:e}function $y(e,t,n=5){if(t<=0)return[];if(t<=n)return Array.from({length:t},(c,d)=>d+1);let r=Math.floor(n/2),o=Math.max(1,e-r),s=o+n-1;s>t&&(s=t,o=s-n+1);let i=[];for(let c=o;c<=s;c+=1)i.push(c);return i}function ou(e,t){return t?Fa(e,t):e}function Ss(e,t,n){return n?ou(e,n)===ou(t,n):e===t}function _y(e,t){return e.columnId?.trim()?`columnId:${e.columnId.trim()}`:e.field?.trim()?`field:${e.field.trim()}`:`index:${t}`}function Wy(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return e;let r=[...e],o=r[t];return o===void 0?e:(r.splice(t,1),r.splice(n,0,o),r)}function Zi(e){return e==="center"?"text-center":e==="right"?"text-right":"text-left"}function qy(e,t){let n=Me(),{id:r,title:o,value:s,columns:i,dataKey:c,lazy:d=!1,totalRecords:u,paginator:m=!1,rows:g=10,first:h,rowsPerPageOptions:b,onPage:S,sortField:R,sortOrder:C,onSort:N,removableSort:B=!0,selectionMode:P,selection:w,onSelectionChange:x,showGlobalFilter:I=!1,globalFilter:D,globalFilterPlaceholder:F,onGlobalFilterChange:v,showColumnFilters:$=!1,filters:G,onFilter:j,showClearFiltersButton:_=!1,stripedRows:V=!1,showGridlines:U=!1,hoverableRows:A=!0,loading:q=!1,emptyMessage:M,className:T="",style:z,tableClassName:ee="",rowClassName:O,groupBoxProps:de={},showColumnManager:Re=!0,columnManagerLabel:W,columnManagerMaxHeight:Y=320}=e,me=h!==void 0,H=R!==void 0,K=C!==void 0,se=w!==void 0,$e=D!==void 0,Ae=G!==void 0,[Qe,ge]=lt.default.useState(Math.max(0,h??0)),[pe,fe]=lt.default.useState(Math.max(1,g)),[We,Be]=lt.default.useState(R??null),[Ee,ke]=lt.default.useState(C??0),[ne,he]=lt.default.useState(null),[Fe,ze]=lt.default.useState(D??""),[X,ae]=lt.default.useState(()=>Yi(G)),ie=lt.default.useRef(null),ve=lt.default.useRef(null),Q=lt.default.useRef(null),[Pe,at]=lt.default.useState(!1),[ue,Z]=lt.default.useState(null),[J,ce]=lt.default.useState(null),be=lt.default.useMemo(()=>i.map((re,Ue)=>({key:_y(re,Ue),column:re,originalIndex:Ue})),[i]),[qe,Ne]=lt.default.useState(()=>be.map(re=>re.key)),[le,Ye]=lt.default.useState(()=>be.reduce((re,Ue)=>(re[Ue.key]=!!Ue.column.hidden,re),{}));lt.default.useEffect(()=>{me&&ge(Math.max(0,h??0))},[me,h]),lt.default.useEffect(()=>{fe(Math.max(1,g))},[g]),lt.default.useEffect(()=>{H&&Be(R??null)},[H,R]),lt.default.useEffect(()=>{K&&ke(C??0)},[K,C]),lt.default.useEffect(()=>{se&&he(w??null)},[se,w]),lt.default.useEffect(()=>{$e&&ze(D??"")},[$e,D]),lt.default.useEffect(()=>{Ae&&ae(Yi(G))},[Ae,G]),lt.default.useEffect(()=>{let re=be.map(Ue=>Ue.key);Ne(Ue=>{let nt=Ue.filter(pt=>re.includes(pt)),bt=re.filter(pt=>!nt.includes(pt));return[...nt,...bt]}),Ye(Ue=>{let nt={};for(let bt of be)nt[bt.key]=Ue[bt.key]??!!bt.column.hidden;return nt})},[be]),lt.default.useEffect(()=>{if(!Pe)return;let re=Ue=>{let nt=Ue.target;ie.current?.contains(nt)||Q.current?.contains(nt)||at(!1)};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[Pe]);let _e=lt.default.useCallback(()=>{let re=ve.current;if(!re)return;let Ue=re.getBoundingClientRect(),nt=300,bt=12,pt=Math.min(Math.max(Ue.left,bt),Math.max(bt,window.innerWidth-nt-bt));ce({top:Ue.bottom+8,left:pt})},[]);lt.default.useLayoutEffect(()=>{if(!Pe)return;_e();let re=window.requestAnimationFrame(_e);return()=>window.cancelAnimationFrame(re)},[Pe,_e]),lt.default.useEffect(()=>{if(!Pe)return;let re=()=>_e(),Ue=!0;return window.addEventListener("resize",re),window.addEventListener("scroll",re,Ue),()=>{window.removeEventListener("resize",re),window.removeEventListener("scroll",re,Ue)}},[Pe,_e]);let we=lt.default.useMemo(()=>{let re=new Map(be.map(Ue=>[Ue.key,Ue]));return qe.map(Ue=>re.get(Ue)).filter(Ue=>!!Ue)},[be,qe]),xe=lt.default.useMemo(()=>we.filter(re=>!le[re.key]).map(re=>re.column),[we,le]),Ce=lt.default.useMemo(()=>we.filter(re=>!le[re.key]).length,[we,le]),Te=me?Math.max(0,h??0):Qe,De=Math.max(1,pe),Ve=H?R??null:We,Le=K?C??0:Ee,Je=se?w??null:ne,ct=$e?D??"":Fe,it=Ae?Yi(G):X,At=lt.default.useMemo(()=>xe.filter(re=>re.field&&!re.excludeGlobalFilter),[xe]),ft=lt.default.useMemo(()=>d?s:s.filter(re=>{if(!(ct.trim()?At.some(bt=>{let pt=bt.filterField??bt.field;return Xg(Fa(re,pt),ct,"contains")}):!0))return!1;let nt=Object.entries(it);if(nt.length===0)return!0;for(let[bt,pt]of nt){let Ut=xe.find(nr=>(nr.filterField??nr.field)===bt);if(!Ut)continue;let Hn=Ut.filterMatchMode??"contains",Tr=Fa(re,bt);if(!Xg(Tr,pt,Hn))return!1}return!0}),[d,s,ct,it,At,xe]),gt=lt.default.useMemo(()=>{if(d||!Ve||Le===0)return ft;let re=xe.find(nt=>(nt.sortField??nt.field)===Ve),Ue=Le===-1?-1:1;return[...ft].sort((nt,bt)=>{if(re?.sortFunction)return re.sortFunction(nt,bt)*Ue;let pt=re?.sortField??re?.field??Ve,Ut=Fa(nt,pt),Hn=Fa(bt,pt);return Hy(Ut,Hn)*Ue})},[d,Ve,Le,ft,xe]),an=d?Math.max(0,u??s.length):gt.length,ye=Math.max(1,Math.ceil(Math.max(an,1)/De)),Ze=Math.max(0,(ye-1)*De),ot=Math.min(Te,Ze),et=lt.default.useMemo(()=>!m||d?gt:gt.slice(ot,ot+De),[m,d,gt,ot,De]),mt=Math.floor(ot/De)+1,Ht=lt.default.useMemo(()=>$y(mt,ye,5),[mt,ye]),Pt=lt.default.useCallback((re,Ue)=>{let nt=Math.max(1,Ue),bt=Math.max(0,re);me||ge(bt),fe(nt);let pt=Math.max(1,Math.ceil(Math.max(an,1)/nt)),Ut=Math.floor(bt/nt)+1;S?.({first:bt,rows:nt,page:Ut,pageCount:pt,totalRecords:an})},[me,S,an]);lt.default.useEffect(()=>{ot!==Te&&Pt(ot,De)},[ot,Te,Pt,De]);let Mt=lt.default.useCallback((re,Ue)=>{H||Be(re),K||ke(Ue),N?.({sortField:re,sortOrder:Ue})},[H,K,N]),It=lt.default.useCallback(re=>{se||he(re),x?.(re)},[se,x]),fn=lt.default.useCallback((re,Ue)=>{Ae||ae(re),$e||ze(Ue),v?.(Ue),j?.({filters:re,globalFilter:Ue}),Pt(0,De)},[Ae,$e,v,j,Pt,De]),jr=lt.default.useCallback(()=>{fn({},"")},[fn]),wr=lt.default.useCallback(()=>{Mt(null,0)},[Mt]),Jn=lt.default.useCallback(()=>{if(P==="multiple"){It([]);return}It(null)},[P,It]),Gt=lt.default.useCallback(re=>{let Ue=Math.max(1,Math.min(re,ye));Pt((Ue-1)*De,De)},[Pt,De,ye]);lt.default.useImperativeHandle(t,()=>({getProcessedRows:()=>gt,getPagedRows:()=>et,clearFilters:jr,clearSelection:Jn,resetSort:wr,resetPage:()=>Pt(0,De),goToPage:Gt}),[gt,et,jr,Jn,wr,Pt,De,Gt]);let ao=M??k(n,"components.datatable.empty"),so=k(n,"components.datatable.loading"),Rr=F??k(n,"components.datatable.globalFilterPlaceholder"),Zs=k(n,"components.datatable.clearFilters"),_o=k(n,"components.datatable.prev"),Xs=k(n,"components.datatable.next"),ha=k(n,"components.datatable.rowsPerPage"),os=k(n,"components.datatable.pageReport",{first:an===0?0:ot+1,last:Math.min(ot+De,an),total:an}),Nn=I||_,Ro=$&&xe.some(re=>re.filter),kr=xe.some(re=>re.footer!==void 0),as=re=>{if(!re.sortable)return;let Ue=re.sortField??re.field;if(Ue){if(Ve!==Ue){Mt(Ue,1);return}if(Le===1){Mt(Ue,-1);return}if(Le===-1){B?Mt(null,0):Mt(Ue,1);return}Mt(Ue,1)}},io=lt.default.useCallback(re=>P?P==="single"?Je!==null&&!Array.isArray(Je)?Ss(Je,re,c):!1:(Array.isArray(Je)?Je:[]).some(nt=>Ss(nt,re,c)):!1,[P,Je,c]),Wo=lt.default.useCallback(re=>{if(!P)return;if(P==="single"){Je!==null&&!Array.isArray(Je)&&Ss(Je,re,c)?It(null):It(re);return}let Ue=Array.isArray(Je)?Je:[],bt=Ue.some(pt=>Ss(pt,re,c))?Ue.filter(pt=>!Ss(pt,re,c)):[...Ue,re];It(bt)},[P,Je,c,It]),Pr=W??Ki(k(n,"components.datatable.columns"),"components.datatable.columns","Colunas"),ko=Ki(k(n,"components.datatable.restoreColumns"),"components.datatable.restoreColumns","Restaurar padr\xE3o"),dr=Ki(k(n,"components.datatable.showAllColumns"),"components.datatable.showAllColumns","Mostrar todas"),qo=Ki(k(n,"components.datatable.dragToReorder"),"components.datatable.dragToReorder","Arrastar para reordenar"),lo=lt.default.useCallback((re,Ue)=>{Ye(nt=>{let bt=!!nt[re],pt=Ue===void 0?!bt:!Ue;return pt&&Ce<=1?nt:{...nt,[re]:pt}})},[Ce]),co=lt.default.useCallback((re,Ue)=>{Ne(nt=>{let bt=nt.indexOf(re),pt=nt.indexOf(Ue);return bt<0||pt<0?nt:Wy(nt,bt,pt)})},[]),mr=lt.default.useCallback(()=>{Ne(be.map(re=>re.key)),Ye(be.reduce((re,Ue)=>(re[Ue.key]=!!Ue.column.hidden,re),{}))},[be]),Go=lt.default.useCallback(()=>{Ye(re=>{let Ue={...re};for(let nt of be)Ue[nt.key]=!1;return Ue})},[be]),jn=(de.title??o??"").trim()||" ";return(0,st.jsx)("div",{className:T,style:z,children:(0,st.jsx)(sr,{...de,title:jn,children:(0,st.jsxs)("div",{className:"space-y-3",children:[Nn?(0,st.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[I?(0,st.jsx)("input",{value:ct,onChange:re=>fn(it,re.target.value),placeholder:Rr,className:"min-w-[220px] flex-1 rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-3 py-2 text-sm text-[rgb(var(--sg-input-fg,var(--sg-text)))] placeholder:text-[rgb(var(--sg-input-placeholder,var(--sg-muted)))] outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]"}):null,_?(0,st.jsx)(Tt,{size:"sm",appearance:"outline",onClick:jr,children:Zs}):null]}):null,(0,st.jsxs)("div",{className:"relative",ref:ie,children:[Re?(0,st.jsx)("div",{className:"mb-2 flex items-center justify-start",children:(0,st.jsx)("button",{ref:ve,type:"button","aria-label":Pr,title:Pr,onClick:()=>at(re=>!re),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] text-[rgb(var(--sg-primary-600))] shadow-sm transition hover:bg-[rgb(var(--sg-primary-50))] hover:text-[rgb(var(--sg-primary-700))]",children:(0,st.jsx)(Zo.SlidersHorizontal,{size:18})})}):null,Re&&Pe&&J&&typeof document<"u"?(0,Jg.createPortal)((0,st.jsxs)("div",{ref:Q,className:"fixed z-[1400] w-[300px] rounded-xl border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] shadow-xl",style:{top:J.top,left:J.left},children:[(0,st.jsxs)("div",{className:"flex items-center gap-2 border-b border-[rgb(var(--sg-border))] px-4 py-3",children:[(0,st.jsx)(Zo.SlidersHorizontal,{size:18,className:"text-[rgb(var(--sg-primary-600))]"}),(0,st.jsx)("span",{className:"text-sm font-semibold text-[rgb(var(--sg-text))]",children:Pr})]}),(0,st.jsx)("div",{className:"overflow-y-auto px-2 py-2",style:{maxHeight:Ko(Y)},children:(0,st.jsx)("div",{className:"space-y-1",children:we.map(re=>{let Ue=!!le[re.key],nt=re.column.hideable!==!1,bt=re.column.reorderable!==!1,pt=nt&&(Ue?!0:Ce>1),Ut=typeof re.column.header=="string"||typeof re.column.header=="number"?String(re.column.header):re.column.field??re.key;return(0,st.jsxs)("div",{draggable:bt,onDragStart:()=>Z(re.key),onDragOver:Hn=>{bt&&Hn.preventDefault()},onDrop:Hn=>{Hn.preventDefault(),bt&&(!ue||ue===re.key||(co(ue,re.key),Z(null)))},onDragEnd:()=>Z(null),className:zr("flex items-center gap-3 rounded-md px-2 py-2",ue===re.key?"opacity-60":"","hover:bg-[rgb(var(--sg-primary-50))]"),children:[(0,st.jsx)("button",{type:"button",disabled:!pt,onClick:()=>lo(re.key),className:zr("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md border transition",Ue?"border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] text-transparent":"border-[rgb(var(--sg-primary-600))] bg-[rgb(var(--sg-primary-600))] text-white",pt?"hover:scale-[1.02]":"cursor-not-allowed opacity-50"),children:(0,st.jsx)(Zo.Check,{size:14})}),(0,st.jsx)("button",{type:"button",disabled:!pt,onClick:()=>lo(re.key),className:zr("flex-1 truncate text-left text-sm",Ue?"text-[rgb(var(--sg-muted))]":"text-[rgb(var(--sg-text))]",pt?"":"cursor-not-allowed"),children:Ut}),(0,st.jsx)("div",{className:zr("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[rgb(var(--sg-muted))]",bt?"cursor-grab active:cursor-grabbing":"opacity-40"),title:qo,children:(0,st.jsx)(Zo.GripVertical,{size:16})})]},`manager-${re.key}`)})})}),(0,st.jsxs)("div",{className:"flex items-center gap-2 border-t border-[rgb(var(--sg-border))] px-3 py-3",children:[(0,st.jsx)(Tt,{size:"sm",appearance:"outline",onClick:mr,children:ko}),(0,st.jsx)(Tt,{size:"sm",appearance:"outline",onClick:Go,children:dr})]})]}),document.body):null,(0,st.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))]",children:(0,st.jsxs)("table",{id:r,className:zr("min-w-full border-collapse text-sm",ee),children:[(0,st.jsxs)("thead",{children:[(0,st.jsx)("tr",{className:"bg-[rgb(var(--sg-primary-50))]",children:xe.map((re,Ue)=>{let nt=re.sortField??re.field,bt=!!nt&&nt===Ve,pt=re.sortable?bt?Le===1?" ^":Le===-1?" v":" <>":" <>":null;return(0,st.jsx)("th",{className:zr("px-3 py-2 font-semibold text-[rgb(var(--sg-text))]",Zi(re.align),U?"border-b border-r border-[rgb(var(--sg-border))] last:border-r-0":"border-b border-[rgb(var(--sg-border))]",re.headerClassName,re.className),style:{width:Ko(re.width),minWidth:Ko(re.minWidth)},children:re.sortable?(0,st.jsxs)("button",{type:"button",onClick:()=>as(re),className:zr("inline-flex items-center gap-1 font-semibold",Zi(re.align),"text-[rgb(var(--sg-text))] hover:text-[rgb(var(--sg-primary-600))]"),children:[(0,st.jsx)("span",{children:re.header}),(0,st.jsx)("span",{"aria-hidden":"true",children:pt})]}):(0,st.jsx)("span",{children:re.header})},`head-${re.columnId??re.field??Ue}`)})}),Ro?(0,st.jsx)("tr",{children:xe.map((re,Ue)=>{let nt=re.filterField??re.field,bt=nt?it[nt]??"":"";return(0,st.jsx)("th",{className:zr("px-3 py-2 align-top",U?"border-b border-r border-[rgb(var(--sg-border))] last:border-r-0":"border-b border-[rgb(var(--sg-border))]"),children:re.filter&&nt?(0,st.jsx)("input",{value:bt,onChange:pt=>{let Ut={...it,[nt]:pt.target.value},Hn=Yi(Ut);fn(Hn,ct)},placeholder:re.filterPlaceholder??k(n,"components.datatable.columnFilterPlaceholder",{column:String(re.header??"")}),className:"w-full rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-xs text-[rgb(var(--sg-input-fg,var(--sg-text)))] placeholder:text-[rgb(var(--sg-input-placeholder,var(--sg-muted)))] outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]"}):null},`filter-${re.columnId??re.field??Ue}`)})}):null]}),(0,st.jsx)("tbody",{children:q?(0,st.jsx)("tr",{children:(0,st.jsx)("td",{colSpan:Math.max(1,xe.length),className:"px-4 py-6 text-center text-sm text-[rgb(var(--sg-muted))]",children:so})}):et.length===0?(0,st.jsx)("tr",{children:(0,st.jsx)("td",{colSpan:Math.max(1,xe.length),className:"px-4 py-6 text-center text-sm text-[rgb(var(--sg-muted))]",children:ao})}):et.map((re,Ue)=>{let nt=ot+Ue,bt=io(re),pt=typeof O=="function"?O(re,nt):O;return(0,st.jsx)("tr",{"aria-selected":bt||void 0,onClick:Ut=>{Ut.target.closest("button,a,input,select,textarea,label,[data-sg-stop-row-select='true']")||Wo(re)},className:zr(P?"cursor-pointer":"",V&&nt%2===1?"bg-[rgb(var(--sg-primary-50))]":"",A?"hover:bg-[rgb(var(--sg-primary-100))]":"",bt?"bg-[rgb(var(--sg-primary-100))]":"",pt),children:xe.map((Ut,Hn)=>{let Tr=Ut.field,nr=Fa(re,Tr),Po=typeof Ut.bodyClassName=="function"?Ut.bodyClassName(re,nt):Ut.bodyClassName,ba=Ut.body?Ut.body(re,{rowData:re,rowIndex:nt,field:Tr,value:nr}):(0,st.jsx)("span",{children:nr==null?"-":String(nr)});return(0,st.jsx)("td",{className:zr("px-3 py-2 text-[rgb(var(--sg-text))]",Zi(Ut.align),U?"border-b border-r border-[rgb(var(--sg-border))] last:border-r-0":"border-b border-[rgb(var(--sg-border))]",Ut.className,Po),style:{width:Ko(Ut.width),minWidth:Ko(Ut.minWidth)},children:ba},`cell-${Ut.columnId??Tr??Hn}-${nt}`)})},String(ou(re,c)??nt))})}),kr?(0,st.jsx)("tfoot",{children:(0,st.jsx)("tr",{className:"bg-[rgb(var(--sg-primary-50))]",children:xe.map((re,Ue)=>{let nt=typeof re.footer=="function"?re.footer(gt):re.footer;return(0,st.jsx)("td",{className:zr("px-3 py-2 font-semibold text-[rgb(var(--sg-text))]",Zi(re.align),U?"border-t border-r border-[rgb(var(--sg-border))] last:border-r-0":"border-t border-[rgb(var(--sg-border))]",re.className),style:{width:Ko(re.width),minWidth:Ko(re.minWidth)},children:nt??null},`foot-${re.columnId??re.field??Ue}`)})})}):null]})})]}),m?(0,st.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,st.jsx)(Tt,{size:"sm",appearance:"outline",disabled:mt<=1,onClick:()=>Gt(mt-1),children:_o}),Ht.map(re=>(0,st.jsx)(Tt,{size:"sm",appearance:re===mt?"solid":"outline",onClick:()=>Gt(re),children:String(re)},`page-${re}`)),(0,st.jsx)(Tt,{size:"sm",appearance:"outline",disabled:mt>=ye,onClick:()=>Gt(mt+1),children:Xs}),(0,st.jsx)("span",{className:"min-w-[180px] text-xs text-[rgb(var(--sg-muted))] md:ml-auto",children:os}),b&&b.length>0?(0,st.jsxs)("label",{className:"ml-auto inline-flex items-center gap-2 text-xs text-[rgb(var(--sg-muted))] md:ml-0",children:[(0,st.jsx)("span",{children:ha}),(0,st.jsx)("select",{value:De,onChange:re=>{let Ue=Number(re.target.value)||De;Pt(0,Ue)},className:"rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-xs text-[rgb(var(--sg-input-fg,var(--sg-text)))]",children:b.map(re=>(0,st.jsx)("option",{value:re,children:re},re))})]}):null]}):null]})})})}var Qg=lt.default.forwardRef(qy);var pr=je(require("react"),1);var ir=require("react/jsx-runtime");function Gy({className:e}){return(0,ir.jsx)("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,ir.jsx)("path",{d:"m6 9 6 6 6-6"})})}var au=pr.forwardRef(({label:e,leftIcon:t,severity:n="primary",appearance:r="solid",size:o="md",shape:s="default",elevation:i="none",disabled:c=!1,loading:d=!1,onClick:u,items:m,customColors:g,className:h,style:b},S)=>{let R=Me(),[C,N]=pr.useState(!1),B=pr.useRef(null),P=pr.useRef(null);pr.useImperativeHandle(S,()=>B.current),pr.useEffect(()=>{if(!C)return;function v(G){B.current&&!B.current.contains(G.target)&&N(!1)}function $(G){G.key==="Escape"&&N(!1)}return document.addEventListener("mousedown",v),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",$)}},[C]);let w=()=>{!c&&!d&&N(v=>!v)},x=v=>{v.disabled||(v.onClick?.(),N(!1))},I=r==="solid"?"border-l border-white/40":r==="outline"?"border-l border-[var(--sg-btn-border,currentColor)]":"border-l border-current/20",F={sm:{menu:"min-w-[140px]",item:"px-3 py-1.5",text:"text-sm",iconSize:"size-3.5"},md:{menu:"min-w-[160px]",item:"px-4 py-2",text:"text-sm",iconSize:"size-4"},lg:{menu:"min-w-[180px]",item:"px-5 py-2.5",text:"text-base",iconSize:"size-5"}}[o];return(0,ir.jsxs)("div",{ref:B,className:`relative inline-flex ${h??""}`,style:b,children:[(0,ir.jsx)(Tt,{severity:n,appearance:r,size:o,shape:s,elevation:i,disabled:c,loading:d,leftIcon:t,onClick:u,customColors:g,className:"rounded-r-none",children:e}),(0,ir.jsx)(Tt,{severity:n,appearance:r,size:o,shape:s,elevation:i,disabled:c||d,leftIcon:(0,ir.jsx)(Gy,{className:"size-4"}),onClick:w,customColors:g,className:`rounded-l-none ${I}`,"aria-haspopup":"menu","aria-expanded":C,"aria-label":C?k(R,"components.actions.close"):k(R,"components.actions.openList")}),C&&(0,ir.jsx)("div",{ref:P,role:"menu",className:`absolute left-0 top-full z-50 mt-1 ${F.menu} overflow-hidden rounded-lg shadow-lg bg-background text-foreground border border-border`,children:m.map((v,$)=>(0,ir.jsxs)(pr.Fragment,{children:[v.separator&&$>0?(0,ir.jsx)("div",{className:"my-0.5 border-t border-border"}):null,(0,ir.jsxs)("button",{role:"menuitem",type:"button",disabled:v.disabled,className:`flex w-full items-center gap-2 ${F.item} ${F.text} transition-colors hover:bg-muted/60 disabled:opacity-50 disabled:cursor-not-allowed`,onClick:()=>x(v),children:[v.icon?(0,ir.jsx)("span",{className:`shrink-0 ${F.iconSize}`,children:v.icon}):null,(0,ir.jsx)("span",{children:v.label})]})]},$))})]})});au.displayName="SgSplitButton";var Nt=je(require("react"),1);function Cs(e){let t=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return null}})():e;return!t||typeof t!="object"||typeof t.x!="number"||typeof t.y!="number"||!Number.isFinite(t.x)||!Number.isFinite(t.y)?null:{x:t.x,y:t.y}}function Xi(e){return e?`sg-fab-pos:${e}`:null}var Bn=je(require("react"),1),op=require("react-dom");var Vr=require("react/jsx-runtime");function su(...e){return e.filter(Boolean).join(" ")}function ep(e,t,n){return Math.max(t,Math.min(e,n))}function tp(e){let t=Bn.useRef(e);return Bn.useEffect(()=>{t.current=e},[e]),Bn.useCallback((...n)=>t.current?.(...n),[])}var Uy={primary:"text-primary-foreground bg-primary hover:brightness-95",secondary:"text-secondary-foreground bg-secondary hover:brightness-95",success:"text-white bg-emerald-600 hover:brightness-95",info:"text-white bg-sky-600 hover:brightness-95",warning:"text-white bg-amber-600 hover:brightness-95",help:"text-white bg-violet-600 hover:brightness-95",danger:"text-destructive-foreground bg-destructive hover:brightness-95",plain:"text-foreground bg-muted hover:bg-muted/80"},jy="text-foreground bg-transparent hover:bg-muted/80";function np(e,t,n){return n==="start"?e.left:n==="center"?e.left+e.width/2-t.width/2:e.right-t.width}function rp(e,t,n){return n==="start"?e.top:n==="center"?e.top+e.height/2-t.height/2:e.bottom-t.height}function Yy(e){let{anchor:t,popup:n,offset:r,prefer:o,viewportW:s,viewportH:i}=e,c={right:s-t.right,left:t.left,bottom:i-t.bottom,top:t.top},d=g=>g==="left"||g==="right"?c[g]>=n.width+r:c[g]>=n.height+r;return[o,{right:"left",left:"right",top:"bottom",bottom:"top"}[o],"bottom","top","right","left"].find(d)??o}function Ky(e){let{anchor:t,popup:n,placement:r,preferPlacement:o,align:s,offset:i,padding:c}=e,d=window.innerWidth,u=window.innerHeight,m=r==="auto"?Yy({anchor:t,popup:n,offset:i,prefer:o,viewportW:d,viewportH:u}):r,g=0,h=0;return m==="right"?(h=t.right+i,g=rp(t,n,s)):m==="left"?(h=t.left-n.width-i,g=rp(t,n,s)):m==="bottom"?(g=t.bottom+i,h=np(t,n,s)):(g=t.top-n.height-i,h=np(t,n,s)),h=ep(h,c,d-n.width-c),g=ep(g,c,u-n.height-c),{top:g,left:h}}function ws(e){let t=Me(),{title:n,subtitle:r,open:o,onOpenChange:s,defaultOpen:i=!1,onOpen:c,onClose:d,anchorRef:u,placement:m="auto",preferPlacement:g="right",align:h="start",offset:b=8,padding:S=8,closeOnOutsideClick:R=!0,closeOnEscape:C=!0,className:N,style:B,zIndex:P=60,minWidth:w=180,actions:x,children:I}=e,D=typeof o=="boolean",[F,v]=Bn.useState(i),$=D?o:F,G=Bn.useCallback(O=>{D||v(O),s?.(O)},[D,s]),j=tp(c),_=tp(d),V=Bn.useRef($);Bn.useEffect(()=>{V.current!==$&&($?j?.():_?.(),V.current=$)},[$,j,_]);let U=Bn.useRef(null),[A,q]=Bn.useState(null),M=Bn.useCallback(()=>{let O=u.current,de=U.current;if(!O||!de)return;let Re=O.getBoundingClientRect(),W=de.getBoundingClientRect(),Y=Ky({anchor:Re,popup:W,placement:m,preferPlacement:g,align:h,offset:b,padding:S});q({top:Y.top,left:Y.left})},[u,m,g,h,b,S]);Bn.useLayoutEffect(()=>{if(!$)return;M();let O=requestAnimationFrame(M);return()=>cancelAnimationFrame(O)},[$,M]),Bn.useEffect(()=>{if(!$)return;let O=()=>M(),de=()=>M();return window.addEventListener("resize",O),window.addEventListener("scroll",de,{passive:!0,capture:!0}),()=>{window.removeEventListener("resize",O),window.removeEventListener("scroll",de,!0)}},[$,M]),Bn.useEffect(()=>{if(!$)return;let O=Re=>{if(!R)return;let W=U.current,Y=u.current,me=Re.target;W&&W.contains(me)||Y&&Y.contains(me)||G(!1)},de=Re=>{C&&Re.key==="Escape"&&G(!1)};return document.addEventListener("mousedown",O),document.addEventListener("keydown",de),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",de)}},[$,R,C,G,u]);let T=Bn.useCallback(()=>G(!1),[G]);if(!$)return null;let z=n??k(t,"components.popup.ariaLabel"),ee=(0,Vr.jsxs)("div",{ref:U,className:su("fixed overflow-hidden rounded-md border border-border bg-background shadow-lg","min-w-[180px]",N),style:{zIndex:P,top:A?.top??-9999,left:A?.left??-9999,minWidth:w,...B},role:"dialog","aria-modal":"false","aria-label":z,children:[n?(0,Vr.jsx)("div",{className:"bg-primary px-3 py-2 text-xs font-medium text-primary-foreground",children:n}):null,r?(0,Vr.jsx)("div",{className:"border-b border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:r}):null,I?(0,Vr.jsx)("div",{className:"p-2",children:I}):null,x&&x.length>0?(0,Vr.jsx)("div",{className:su(I?"border-t border-border":"","p-1"),children:x.map((O,de)=>{let Re=O.severity!==void 0,W=O.severity??"plain";return(0,Vr.jsx)("button",{type:"button",disabled:O.disabled,title:O.hint,className:su("w-full select-none rounded px-3 py-2 text-left text-sm","transition-[filter,background-color] duration-150","disabled:opacity-50 disabled:cursor-not-allowed",de>0?"border-t border-border":"",Re?Uy[W]:jy),onClick:()=>{O.onClick?.(),(O.closeOnClick??!0)&&T()},children:(0,Vr.jsxs)("span",{className:"inline-flex items-center gap-2",children:[O.icon?(0,Vr.jsx)("span",{className:"inline-flex",children:O.icon}):null,(0,Vr.jsx)("span",{children:O.label})]})},de)})}):null]});return(0,op.createPortal)(ee,document.body)}ws.displayName="SgPopup";var Zn=je(require("react"),1);function Rs(e,t,n){let r=t??"";if(!r)return null;let o=(n??"").trim();return o?`sg:${r}:${o}:${e}`:`sg:${r}:${e}`}function ks(e){let t=e?.prefix??"",n=r=>t?`${t}${r}`:r;return{load:r=>{try{let o=window.localStorage.getItem(n(r));return o==null?null:JSON.parse(o)}catch{return null}},save:(r,o)=>{try{window.localStorage.setItem(n(r),JSON.stringify(o))}catch{}},clear:r=>{try{window.localStorage.removeItem(n(r))}catch{}}}}function iu(e){let t=e.fetcher??fetch,n=e.baseUrl.replace(/\/$/,""),r=e.stateVersion,o=e.scope;return{load:async s=>{let i=await t(`${n}/sg/persistence?key=${encodeURIComponent(s)}`,{method:"GET"});if(!i.ok)throw new Error(`SG persistence load failed (${i.status})`);let c=await i.json();return!c?.found||!c.record?null:c.record.state},save:async(s,i)=>{let c={protocolVersion:1,key:s,scope:o,stateVersion:r,updatedAt:new Date().toISOString(),state:i},d=await t(`${n}/sg/persistence`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({record:c})});if(!d.ok)throw new Error(`SG persistence save failed (${d.status})`)},clear:async s=>{let i=await t(`${n}/sg/persistence?key=${encodeURIComponent(s)}`,{method:"DELETE"});if(!i.ok)throw new Error(`SG persistence clear failed (${i.status})`)}}}function lu(e){let{mode:t,primary:n,secondary:r}=e;return{load:async o=>{if(t==="strict")return await n.load(o);if(t==="mirror"){try{let s=await n.load(o);if(s!=null)return s}catch{}return await r.load(o)}try{return await n.load(o)}catch{return await r.load(o)}},save:async(o,s)=>{if(t==="strict"){await n.save(o,s);return}if(t==="mirror"){await Promise.allSettled([Promise.resolve(n.save(o,s)),Promise.resolve(r.save(o,s))]);return}try{await n.save(o,s)}catch{await r.save(o,s)}},clear:async o=>{if(t==="strict"){await n.clear(o);return}if(t==="mirror"){await Promise.allSettled([Promise.resolve(n.clear(o)),Promise.resolve(r.clear(o))]);return}try{await n.clear(o)}catch{await r.clear(o)}}}}function Ps(e){let{loaded:t,defaultValue:n,deserialize:r}=e;return t==null?n:r(t)}function Ji(e){let{storage:t,baseKey:n,defaultValue:r,deserialize:o}=e;try{let s=t.getItem(n);return s===null?r:Ps({loaded:JSON.parse(s),defaultValue:r,deserialize:o})}catch{return r}}function Qi(e){let{storage:t,baseKey:n,value:r}=e;t.setItem(n,JSON.stringify(r))}function el(e){let{storage:t,baseKey:n,defaultValue:r}=e;return t.removeItem(n),r}var lp=require("react/jsx-runtime"),ap={getNamespace:()=>""},Ts={namespaceProvider:ap,persistenceStrategy:ks(),persistence:{scope:"app:unknown",mode:"fallback",stateVersion:1}},cu=Zn.default.createContext(null);function sp(e){let t=Zn.default.useMemo(()=>({namespaceProvider:e.value?.namespaceProvider??ap,persistenceStrategy:e.value?.persistenceStrategy??Ts.persistenceStrategy,persistence:{scope:e.value?.persistence?.scope??Ts.persistence.scope,mode:e.value?.persistence?.mode??Ts.persistence.mode,stateVersion:e.value?.persistence?.stateVersion??Ts.persistence.stateVersion}}),[e.value?.namespaceProvider,e.value?.persistenceStrategy,e.value?.persistence?.scope,e.value?.persistence?.mode,e.value?.persistence?.stateVersion]);return(0,lp.jsx)(cu.Provider,{value:t,children:e.children})}function tl(){return Zn.default.useContext(cu)??Ts}function Hr(){return Zn.default.useContext(cu)!==null}function ip(){return tl().namespaceProvider}function fr(){let e=tl(),t=e.namespaceProvider.getNamespace(),n=i=>Rs(i,t,e.persistence.scope),r=Zn.default.useCallback(async i=>{let c=n(i);return c?await e.persistenceStrategy.load(c):null},[e.persistenceStrategy,t,e.persistence.scope]),o=Zn.default.useCallback(async(i,c)=>{let d=n(i);d&&await e.persistenceStrategy.save(d,c)},[e.persistenceStrategy,t,e.persistence.scope]),s=Zn.default.useCallback(async i=>{let c=n(i);c&&await e.persistenceStrategy.clear(c)},[e.persistenceStrategy,t,e.persistence.scope]);return{namespace:t,scope:e.persistence.scope,mode:e.persistence.mode,stateVersion:e.persistence.stateVersion,load:r,save:o,clear:s}}function nl(e){let{baseKey:t,defaultValue:n}=e,r=Zn.default.useMemo(()=>e.serialize??(b=>b),[e.serialize]),o=Zn.default.useMemo(()=>e.deserialize??(b=>b),[e.deserialize]),s=Hr(),i=fr(),[c,d]=Zn.default.useState(n),[u,m]=Zn.default.useState(!1);Zn.default.useEffect(()=>{let b=!0;return(async()=>{try{let S;if(s?S=await i.load(t):S=Ji({storage:localStorage,baseKey:t,defaultValue:null,deserialize:R=>R}),!b)return;d(Ps({loaded:S,defaultValue:n,deserialize:o})),m(!0)}catch{if(!b)return;d(n),m(!0)}})(),()=>{b=!1}},[t,n,s,i.load,o]),Zn.default.useEffect(()=>{if(u)if(s)i.save(t,r(c));else try{Qi({storage:localStorage,baseKey:t,value:c})}catch{}},[c,u,s,t,i.save,r]);let g=Zn.default.useCallback(b=>{d(b)},[]),h=Zn.default.useCallback(async()=>{if(s)await i.clear(t);else try{el({storage:localStorage,baseKey:t,defaultValue:n})}catch{}d(n)},[t,s,i.clear,n]);return{value:c,setValue:g,clear:h,hydrated:u}}var En=require("react/jsx-runtime");function Ns(...e){return e.filter(Boolean).join(" ")}var Nr=24,Zy={"left-top":{top:Nr,left:Nr},"left-center":{left:Nr,top:"50%"},"left-bottom":{bottom:Nr,left:Nr},"center-top":{top:Nr,left:"50%"},"center-bottom":{bottom:Nr,left:"50%"},"right-top":{top:Nr,right:Nr},"right-center":{right:Nr,top:"50%"},"right-bottom":{bottom:Nr,right:Nr}},Xy={"left-center":"translateY(-50%)","right-center":"translateY(-50%)","center-top":"translateX(-50%)","center-bottom":"translateX(-50%)"},Jy={"left-top":"right","left-center":"right","left-bottom":"right","center-top":"bottom","center-bottom":"top","right-top":"left","right-center":"left","right-bottom":"left"},Qy={"left-top":"down","left-center":"right","left-bottom":"up","center-top":"down","center-bottom":"up","right-top":"down","right-center":"left","right-bottom":"up"},cp={primary:{bg:"var(--sg-btn-primary-bg, hsl(var(--primary)))",fg:"var(--sg-btn-primary-fg, hsl(var(--primary-foreground)))",ring:"var(--sg-btn-primary-ring, hsl(var(--primary)/0.35))"},secondary:{bg:"var(--sg-btn-secondary-bg, hsl(var(--secondary)))",fg:"var(--sg-btn-secondary-fg, hsl(var(--secondary-foreground)))",ring:"var(--sg-btn-secondary-ring, hsl(var(--secondary)/0.35))"},success:{bg:"var(--sg-btn-success-bg, hsl(var(--tertiary, var(--accent))))",fg:"var(--sg-btn-success-fg, hsl(var(--tertiary-foreground, var(--accent-foreground, 0 0% 100%))))",ring:"var(--sg-btn-success-ring, hsl(var(--tertiary, var(--accent))/0.35))"},info:{bg:"var(--sg-btn-info-bg, hsl(var(--secondary, var(--primary))))",fg:"var(--sg-btn-info-fg, hsl(var(--secondary-foreground, var(--primary-foreground))))",ring:"var(--sg-btn-info-ring, hsl(var(--secondary, var(--primary))/0.35))"},warning:{bg:"var(--sg-btn-warning-bg, hsl(var(--secondary, var(--accent))))",fg:"var(--sg-btn-warning-fg, hsl(var(--secondary-foreground, var(--accent-foreground, 0 0% 100%))))",ring:"var(--sg-btn-warning-ring, hsl(var(--secondary, var(--accent))/0.35))"},help:{bg:"var(--sg-btn-help-bg, hsl(var(--secondary, var(--primary))))",fg:"var(--sg-btn-help-fg, hsl(var(--secondary-foreground, var(--primary-foreground))))",ring:"var(--sg-btn-help-ring, hsl(var(--secondary, var(--primary))/0.35))"},danger:{bg:"var(--sg-btn-danger-bg, hsl(var(--destructive)))",fg:"var(--sg-btn-danger-fg, hsl(var(--destructive-foreground)))",ring:"var(--sg-btn-danger-ring, hsl(var(--destructive)/0.35))"},plain:{bg:"hsl(var(--muted))",fg:"hsl(var(--muted-foreground))",ring:"hsl(var(--muted)/0.35)"}},up={sm:40,md:56,lg:64},e0={sm:18,md:22,lg:26},t0={sm:36,md:44,lg:52},n0={sm:14,md:18,lg:20},r0={circle:"rounded-full",rounded:"rounded-xl",square:"rounded-sm"},o0={none:"",sm:"shadow-sm",md:"shadow-md shadow-black/15",lg:"shadow-lg shadow-black/20"},dp={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},a0={up:"left",down:"right",left:"top",right:"bottom"},s0={sm:48,md:60,lg:72},i0={sm:100,md:120,lg:150},l0={up:270,down:90,left:180,right:0};function c0(e){return e*Math.PI/180}function u0(e,t,n,r,o){if(e===0)return[];if(t==="linear"){let m=s0[r];return Array.from({length:e},(g,h)=>{let b=m*(h+1);switch(n){case"up":return{x:0,y:-b};case"down":return{x:0,y:b};case"left":return{x:-b,y:0};case"right":return{x:b,y:0}}})}let s=o??i0[r],i=l0[n]??0,c;switch(t){case"circle":c=360;break;case"semi-circle":c=180;break;case"quarter-circle":c=90;break;default:c=360}let d=t==="circle"?c/e:c/Math.max(e-1,1),u=t==="circle"?i:i-c/2;return Array.from({length:e},(m,g)=>{let h=u+d*g,b=c0(h);return{x:Math.round(s*Math.cos(b)),y:Math.round(s*Math.sin(b))}})}function d0({size:e}){return(0,En.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,En.jsx)("path",{d:"M5 12h14"}),(0,En.jsx)("path",{d:"M12 5v14"})]})}function m0({size:e}){return(0,En.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:"animate-spin","aria-hidden":"true",children:[(0,En.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"3"}),(0,En.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}function g0(e){return e.endsWith("bottom")?"translateY(24px)":e.endsWith("top")?"translateY(-24px)":e.startsWith("left")?"translateX(-24px)":"translateX(24px)"}function mp(e,t=10){return e.endsWith("bottom")?`translateY(${t}px)`:e.endsWith("top")?`translateY(-${t}px)`:e.startsWith("left")?`translateX(-${t}px)`:`translateX(${t}px)`}function uu(e){let t=Me(),n=Hr(),{load:r,save:o,clear:s}=fr(),{hint:i,hintDelay:c=300,icon:d,activeIcon:u,position:m="right-bottom",offset:g,enableDragDrop:h=!1,dragId:b,severity:S="primary",floatActionButtonStyle:R,color:C,size:N="md",shape:B="circle",elevation:P="md",disabled:w=!1,loading:x=!1,autoHideOnScroll:I=!1,hideDirection:D="down",animation:F="scale",animationOn:v="mount",animationDuration:$=200,type:G="linear",radius:j,transitionDelay:_=30,actions:V,onClick:U,className:A,style:q,zIndex:M=50,absolute:T=!1}=e,z=e.hintPosition??Jy[m],ee=e.direction??Qy[m],[O,de]=Nt.useState(!1),[Re,W]=Nt.useState(!1),[Y,me]=Nt.useState(!1),[H,K]=Nt.useState(!1),[se,$e]=Nt.useState(!1),[Ae,Qe]=Nt.useState(!1),[ge,pe]=Nt.useState(null),fe=Nt.useRef(null),We=Nt.useRef(!1),[Be,Ee]=Nt.useState(!1),[ke,ne]=Nt.useState(!1),he=Nt.useRef(null),Fe=Nt.useRef(!1),ze=Nt.useRef(null),X=Nt.useRef(null),ae=Nt.useRef(null),ie=Nt.useRef(null),ve=T===!0,Q=Xi(b),Pe=Nt.useCallback(async()=>{if(!Q)return null;if(n)try{let ye=await r(Q);if(ye==null)return null;let Ze=Cs(ye);return Ze||(await s(Q),null)}catch{return null}try{let ye=localStorage.getItem(Q);if(!ye)return null;let Ze=Cs(ye);return Ze||(localStorage.removeItem(Q),null)}catch{return null}},[s,n,r,Q]),at=Nt.useCallback(async ye=>{if(Q){if(n){try{await o(Q,ye)}catch{}return}try{localStorage.setItem(Q,JSON.stringify(ye))}catch{}}},[n,o,Q]),ue=Nt.useCallback(async()=>{if(Q){if(n){try{await s(Q)}catch{}return}try{localStorage.removeItem(Q)}catch{}}},[s,n,Q]);Nt.useEffect(()=>{let ye=setTimeout(()=>de(!0),20);return()=>clearTimeout(ye)},[]),Nt.useEffect(()=>{if(!Y)return;let ye=setTimeout(()=>me(!1),$);return()=>clearTimeout(ye)},[Y,$]),Nt.useEffect(()=>{if(!I)return;let ye=window.scrollY,Ze=()=>{let ot=window.scrollY,et=ot-ye;D==="down"&&et>5||D==="up"&&et<-5?$e(!0):Math.abs(et)>5&&$e(!1),ye=ot};return window.addEventListener("scroll",Ze,{passive:!0}),()=>window.removeEventListener("scroll",Ze)},[I,D]),Nt.useEffect(()=>{if(!h||!b)return;let ye=!0;return(async()=>{let Ze=await Pe();if(!ye||!Ze)return;let ot=Ze.x,et=Ze.y,mt=up[N],Ht=Math.max(0,window.innerWidth-mt),Pt=Math.max(0,window.innerHeight-mt);if(ve&&ze.current){let It=ze.current.offsetParent;if(It){let fn=It.getBoundingClientRect();Ht=Math.max(0,fn.width-mt),Pt=Math.max(0,fn.height-mt)}}let Mt={x:Math.min(Math.max(ot,0),Ht),y:Math.min(Math.max(et,0),Pt)};fe.current=Mt,pe(Mt),We.current=!0})(),()=>{ye=!1}},[h,b,Pe,N,ve]),Nt.useEffect(()=>{if(!H)return;let ye=ot=>{ze.current&&!ze.current.contains(ot.target)&&K(!1)},Ze=ot=>{ot.key==="Escape"&&K(!1)};return document.addEventListener("mousedown",ye),document.addEventListener("keydown",Ze),()=>{document.removeEventListener("mousedown",ye),document.removeEventListener("keydown",Ze)}},[H]),Nt.useEffect(()=>()=>{ie.current?.(),ie.current=null},[]);let Z=Nt.useCallback(()=>{W(!0),i&&(ae.current=setTimeout(()=>Qe(!0),c))},[i,c]),J=Nt.useCallback(()=>{W(!1),ae.current&&clearTimeout(ae.current),Qe(!1)},[]),ce=Nt.useCallback(()=>{if(!(w||x)){if(h&&Fe.current){Fe.current=!1;return}if(ke){ne(!1);return}me(!0),V&&V.length>0?K(ye=>!ye):U?.()}},[w,x,V,U,h,ke]),be=Nt.useCallback(ye=>{if(ye.button!==0||!h||w||x||!ze.current)return;ie.current?.(),ie.current=null,ye.preventDefault();let Ze=ye.currentTarget.ownerDocument??document,ot=Ze.defaultView??window,et=ze.current.getBoundingClientRect(),mt=ve?ze.current.offsetParent?.getBoundingClientRect()??{left:0,top:0}:{left:0,top:0};he.current={x:ye.clientX,y:ye.clientY,left:et.left-mt.left,top:et.top-mt.top},Fe.current=!1,Ee(!0);let Ht=jr=>{if(!he.current)return;let wr=jr.clientX-he.current.x,Jn=jr.clientY-he.current.y;(Math.abs(wr)>3||Math.abs(Jn)>3)&&(Fe.current=!0,V&&V.length>0&&K(!0));let Gt={x:he.current.left+wr,y:he.current.top+Jn};fe.current=Gt,pe(Gt),We.current=!0},Pt=!1,Mt=()=>{Pt||(Pt=!0,Ee(!1),he.current=null,h&&b&&fe.current&&at(fe.current),ot.removeEventListener("pointermove",Ht),ot.removeEventListener("pointerup",It),ot.removeEventListener("pointercancel",It),ot.removeEventListener("blur",It),Ze.removeEventListener("visibilitychange",fn),ie.current===Mt&&(ie.current=null))},It=()=>Mt(),fn=()=>{Ze.visibilityState==="hidden"&&Mt()};ie.current=Mt,ot.addEventListener("pointermove",Ht),ot.addEventListener("pointerup",It),ot.addEventListener("pointercancel",It),ot.addEventListener("blur",It),Ze.addEventListener("visibilitychange",fn)},[h,w,x,V,b,ve,at]),qe=Nt.useCallback(ye=>{!h||!b||We.current&&(ye.preventDefault(),ne(!0))},[h,b]),Ne=Nt.useCallback(ye=>{if(!ye||!b){ne(!1);return}ue(),fe.current=null,pe(null),K(!1),ne(!1),We.current=!1,Fe.current=!1},[ue,b]),Ye=cp[S??R??"primary"],_e=C??Ye.bg,we=C?"white":Ye.fg,xe=C?`color-mix(in srgb, ${C} 35%, transparent)`:Ye.ring,Ce=up[N],Te=e0[N],De=t0[N],Ve=n0[N],Le={position:T?"absolute":"fixed",...Zy[m],zIndex:M};h&&ge&&(Le.left=ge.x,Le.top=ge.y,delete Le.right,delete Le.bottom),g?.x&&(Le.right!==void 0?Le.right=(typeof Le.right=="number"?Le.right:0)-g.x:Le.left!==void 0&&(Le.left=(typeof Le.left=="number"?Le.left:0)+g.x)),g?.y&&(Le.bottom!==void 0?Le.bottom=(typeof Le.bottom=="number"?Le.bottom:0)-g.y:Le.top!==void 0&&(Le.top=(typeof Le.top=="number"?Le.top:0)+g.y));let Je=!T&&(q?.position==="relative"||q?.position==="static"),ct=!Je,it=[],At=ct&&!(h&&ge)?Xy[m]:void 0;At&&it.push(At),ct&&se&&it.push(D==="down"?"translateY(100px)":"translateY(-100px)");let ft={transition:`transform ${$}ms ease, opacity ${$}ms ease`};if(v==="mount")switch(F){case"scale":ft.transform=O?"scale(1)":"scale(0)",ft.opacity=O?1:0;break;case"fade":ft.opacity=O?1:0;break;case"rotate":ft.transform=O?"rotate(0deg)":"rotate(-180deg)",ft.opacity=O?1:0;break;case"slide":ft.transform=O?"translate(0,0)":g0(m),ft.opacity=O?1:0;break;case"pulse":O?ft.animation="sg-fab-pulse 1.5s ease-in-out infinite":ft.opacity=0;break}else if(v==="hover")switch(F){case"scale":ft.transform=Re?"scale(1.1)":"scale(1)";break;case"fade":ft.opacity=Re?.62:1;break;case"slide":ft.transform=Re?mp(m,10):"translate(0,0)";break;case"rotate":ft.transform=Re?"rotate(15deg)":"rotate(0deg)";break;case"pulse":Re&&(ft.animation="sg-fab-pulse 0.8s ease-in-out infinite");break}else if(v==="click")switch(F){case"scale":ft.transform=Y?"scale(0.9)":"scale(1)";break;case"fade":ft.opacity=Y?.52:1;break;case"slide":ft.transform=Y?mp(m,14):"translate(0,0)";break;case"rotate":ft.transform=Y?"rotate(90deg)":"rotate(0deg)";break}let gt=u0((V??[]).length,G,ee,N,j),an=w||x;return(0,En.jsxs)("div",{ref:ze,style:{...Je?{position:q?.position}:Le,transform:it.length>0?it.join(" "):void 0,transition:"transform 300ms ease, opacity 300ms ease",opacity:ct&&se?0:1,...q},className:Ns("inline-flex items-center justify-center",A),onContextMenu:ye=>{!h||!b||qe(ye)},children:[F==="pulse"&&(0,En.jsx)("style",{children:"@keyframes sg-fab-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}"}),V?.map((ye,Ze)=>{let ot=gt[Ze]??{x:0,y:0},et=ye.severity??ye.floatActionButtonStyle??"plain",mt=cp[et];return(0,En.jsx)("div",{className:"absolute",style:{transform:H?`translate(${ot.x}px, ${ot.y}px) scale(1)`:"translate(0,0) scale(0)",opacity:H?1:0,transition:"transform 200ms ease, opacity 200ms ease",transitionDelay:H?`${Ze*_}ms`:`${(V.length-1-Ze)*_}ms`},children:(0,En.jsxs)("div",{className:"relative group",children:[(0,En.jsx)("button",{disabled:ye.disabled,className:Ns("inline-flex items-center justify-center rounded-full","hover:brightness-90 active:brightness-[0.85]","focus-visible:outline-none focus-visible:ring-2","disabled:opacity-50 disabled:cursor-not-allowed","shadow-md transition-[filter] duration-150"),style:{width:De,height:De,backgroundColor:mt.bg,color:mt.fg,"--tw-ring-color":mt.ring},onClick:()=>{ye.onClick?.(),K(!1)},"aria-label":ye.label,children:ye.icon}),ye.label?(0,En.jsx)("span",{className:Ns("absolute whitespace-nowrap rounded bg-foreground/90 px-2 py-1 text-xs text-background","opacity-0 group-hover:opacity-100 transition-opacity duration-150 pointer-events-none",dp[a0[ee]??"top"]),children:ye.label}):null]})},Ze)}),(0,En.jsxs)("button",{ref:X,disabled:an,className:Ns("relative inline-flex items-center justify-center","hover:brightness-90 active:brightness-[0.85]","focus-visible:outline-none focus-visible:ring-4","disabled:opacity-60 disabled:cursor-not-allowed","transition-[filter] duration-150",h?Be?"cursor-grabbing":"cursor-pointer":"",r0[B],o0[P]),style:{width:Ce,height:Ce,backgroundColor:_e,color:we,"--tw-ring-color":xe,...h?{touchAction:"none"}:{},...ft},onClick:ce,onPointerDown:be,onContextMenu:qe,onMouseEnter:Z,onMouseLeave:J,"aria-label":i??(H?k(t,"components.actions.close"):k(t,"components.actions.open")),"aria-expanded":V?H:void 0,children:[x?(0,En.jsx)(m0,{size:Te}):(0,En.jsx)("span",{className:"inline-flex items-center justify-center transition-transform duration-300",style:{transform:H&&V?"rotate(45deg)":"rotate(0deg)"},children:H&&u?u:d??(0,En.jsx)(d0,{size:Te})}),i&&!H?(0,En.jsx)("span",{className:Ns("absolute whitespace-nowrap rounded bg-foreground/90 px-2.5 py-1.5 text-xs font-medium text-background","transition-opacity duration-200 pointer-events-none",Ae?"opacity-100":"opacity-0",dp[z]),children:i}):null]}),(0,En.jsx)(ws,{title:k(t,"components.fab.resetPosition"),open:ke,onOpenChange:ne,anchorRef:X,placement:"auto",preferPlacement:"left",align:"start",offset:8,actions:[{label:k(t,"components.fab.yes"),closeOnClick:!1,onClick:()=>Ne(!0)},{label:k(t,"components.fab.no"),closeOnClick:!1,onClick:()=>Ne(!1)}]})]})}uu.displayName="SgFloatActionButton";var dn=je(require("react"),1);function Eo(e){let t=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return null}})():e;return!t||typeof t!="object"||typeof t.x!="number"||typeof t.y!="number"||!Number.isFinite(t.x)||!Number.isFinite(t.y)?null:{x:t.x,y:t.y}}function rl(e){return`sg-toolbar-pos:${e}`}function ol(e,t=!1){return e?`sg-dockmenu-pos:${e}:${t?"parent":"viewport"}`:null}function du(e){return e==="center-top"||e==="center-bottom"?"horizontal":e==="left-center"||e==="right-center"?"vertical":"horizontal"}function mu(e,t){return t==="horizontal"?e.includes("bottom")?-1:1:e.startsWith("left")?1:-1}function al(e){let t=du(e);return{orientation:t,liftDirection:mu(e,t)}}function sl(e){let{index:t,hoveredIndex:n,magnify:r,magnifyScale:o,itemSize:s,gap:i,orientation:c,liftDirection:d}=e,u=n===t,m=r&&n!==null,g=m?Math.abs(t-n):Number.POSITIVE_INFINITY,h=m?Math.max(0,1-g/3):0,b=h*h,S=1+(o-1)*b,R=b*Math.min(s*.4,18),C=Math.max(0,s*(o-1)*.68+i*.12),N=m&&g>0?Math.max(0,1-(g-1)*.1):0,B=m&&n!==null?Math.sign(t-n):0,P=B===0?0:B*C*N,w=(c==="vertical"?d*R:0)+(c==="horizontal"?P:0),x=(c==="horizontal"?d*R:0)+(c==="vertical"?P:0),I=c==="horizontal"?d<0?"50% 100%":"50% 0%":d>0?"0% 50%":"100% 50%";return{scale:S,translateX:w,translateY:x,transformOrigin:I,zIndex:u?3:b>0?2:1}}function il(e,t){return e==="horizontal"?{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:8}:t.startsWith("left")?{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:8}:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:8}}var Mr=24,p0={"left-top":{top:Mr,left:Mr},"left-center":{left:Mr,top:"50%"},"left-bottom":{bottom:Mr,left:Mr},"center-top":{top:Mr,left:"50%"},"center-bottom":{bottom:Mr,left:"50%"},"right-top":{top:Mr,right:Mr},"right-center":{right:Mr,top:"50%"},"right-bottom":{bottom:Mr,right:Mr}},f0={"left-center":"translateY(-50%)","right-center":"translateY(-50%)","center-top":"translateX(-50%)","center-bottom":"translateX(-50%)"};function ll(e){let{position:t,zIndex:n,enableDragDrop:r,dragPos:o,offset:s}=e,i={position:"fixed",...p0[t],zIndex:n};r&&o&&(i.left=o.x,i.top=o.y,delete i.right,delete i.bottom),s?.x&&(i.right!==void 0?i.right=(typeof i.right=="number"?i.right:0)-s.x:i.left!==void 0&&(i.left=(typeof i.left=="number"?i.left:0)+s.x)),s?.y&&(i.bottom!==void 0?i.bottom=(typeof i.bottom=="number"?i.bottom:0)-s.y:i.top!==void 0&&(i.top=(typeof i.top=="number"?i.top:0)+s.y));let c=r&&o?"":f0[t]??"";return{style:i,transform:c}}function Ms(e){let t=!!(e.enableDragDrop&&e.dragId&&e.hasStoredPosition);return{canOpenContextMenu:t,canResetPosition:t}}var Vn=require("react/jsx-runtime"),h0={none:"",sm:"shadow-sm",md:"shadow-md shadow-black/15",lg:"shadow-lg shadow-black/20"};function cl(e,t,n){return Math.min(Math.max(e,t),n)}function gp(e){let t=Me(),n=Hr(),{load:r,save:o,clear:s}=fr(),{id:i,items:c,position:d="center-bottom",enableDragDrop:u=!1,dragId:m,offset:g,className:h="",itemClassName:b="",zIndex:S=50,itemSize:R=48,gap:C=16,backgroundColor:N="rgb(var(--sg-surface, 248 250 252) / 0.9)",showLabels:B=!0,magnify:P=!0,magnifyScale:w=1.5,borderRadius:x=16,elevation:I="lg",style:D}=e,[F,v]=dn.useState(null),$=dn.useRef(null),G=dn.useRef(!1),[j,_]=dn.useState(!1),[V,U]=dn.useState(!1),[A,q]=dn.useState(null),M=dn.useRef(null),T=dn.useRef(!1),z=dn.useRef(null),{orientation:ee,liftDirection:O}=al(d),de=Math.max(8,Math.round(C*.6)),Re=Math.max(Math.round(C*2.2),Math.round(R*.45)),W=D?.position==="absolute",Y=ol(m,W),me="rgb(var(--sg-muted-surface, 241 245 249) / 0.92)",H="rgb(var(--sg-primary-500, 34 197 94) / 0.18)",K="rgb(var(--sg-text, 15 23 42))",se="rgb(var(--sg-surface, 15 23 42) / 0.96)",$e="rgb(var(--sg-text, 255 255 255))",Ae=dn.useCallback(async()=>{if(!Y)return null;if(n)try{let ne=await r(Y);if(ne==null)return null;let he=Eo(ne);return he||(await s(Y),null)}catch{return null}try{let ne=localStorage.getItem(Y);if(!ne)return null;let he=Eo(ne);return he||(localStorage.removeItem(Y),null)}catch{return null}},[s,n,r,Y]),Qe=dn.useCallback(async ne=>{if(Y){if(n){try{await o(Y,ne)}catch{}return}try{localStorage.setItem(Y,JSON.stringify(ne))}catch{}}},[n,o,Y]),ge=dn.useCallback(async()=>{if(Y){if(n){try{await s(Y)}catch{}return}try{localStorage.removeItem(Y)}catch{}}},[s,n,Y]),pe=dn.useCallback(()=>{if(!z.current)return null;let ne=z.current,he=ne.getBoundingClientRect();if(W){let Fe=ne.offsetParent;if(!Fe)return null;let ze=Fe.getBoundingClientRect();return{originX:ze.left,originY:ze.top,minX:0,minY:0,maxX:Math.max(0,Fe.clientWidth-he.width),maxY:Math.max(0,Fe.clientHeight-he.height)}}return{originX:0,originY:0,minX:0,minY:0,maxX:Math.max(0,window.innerWidth-he.width),maxY:Math.max(0,window.innerHeight-he.height)}},[W]);dn.useEffect(()=>{if(!u||!Y||!z.current)return;let ne=!0;return(async()=>{let he=await Ae();if(!ne||!he)return;let Fe=pe();if(!Fe)return;let ze={x:cl(he.x,Fe.minX,Fe.maxX),y:cl(he.y,Fe.minY,Fe.maxY)};$.current=ze,v(ze),G.current=!0})(),()=>{ne=!1}},[u,pe,Ae,Y]),dn.useEffect(()=>{if(!u||!j)return;let ne=document.body.style.cursor;return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=ne}},[u,j]);let fe=dn.useCallback(ne=>{if(ne.button!==0||!u||!z.current)return;let he=pe();if(!he||ne.target.closest("[data-dock-item]"))return;ne.preventDefault();let ze=z.current.getBoundingClientRect();M.current={x:ne.clientX,y:ne.clientY,left:ze.left-he.originX,top:ze.top-he.originY},T.current=!1,_(!0);let X=ie=>{if(!M.current)return;let ve=ie.clientX-M.current.x,Q=ie.clientY-M.current.y;(Math.abs(ve)>3||Math.abs(Q)>3)&&(T.current=!0);let Pe={x:cl(M.current.left+ve,he.minX,he.maxX),y:cl(M.current.top+Q,he.minY,he.maxY)};$.current=Pe,v(Pe),G.current=!0},ae=()=>{_(!1),M.current=null,u&&Y&&$.current&&Qe($.current),window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",ae),window.removeEventListener("pointercancel",ae)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",ae),window.addEventListener("pointercancel",ae)},[u,pe,Qe,Y]),We=dn.useCallback(ne=>{Ms({enableDragDrop:u,dragId:m,hasStoredPosition:G.current}).canOpenContextMenu&&(ne.preventDefault(),U(!0))},[u,m]),Be=dn.useCallback(()=>{!Ms({enableDragDrop:u,dragId:m,hasStoredPosition:G.current}).canResetPosition||!Y||(ge(),$.current=null,v(null),U(!1),G.current=!1,T.current=!1)},[ge,m,u,Y]),Ee=dn.useCallback(ne=>{if(!ne.disabled){if(T.current){T.current=!1;return}ne.onClick?.()}},[]),ke=ll({position:d,zIndex:S,enableDragDrop:u,dragPos:F,offset:g});return(0,Vn.jsxs)(Vn.Fragment,{children:[(0,Vn.jsx)("div",{ref:z,id:i,className:`sg-dock ${h} ${h0[I]}`,style:{...ke.style,...D,transform:ke.transform,cursor:u?j?"grabbing":"grab":"default",...u?{touchAction:"none"}:{}},onPointerDown:fe,onContextMenu:We,children:(0,Vn.jsx)("div",{className:"sg-dock-container",style:{display:"flex",flexDirection:ee==="horizontal"?"row":"column",alignItems:"center",gap:`${C}px`,...ee==="horizontal"?{paddingTop:de,paddingBottom:de,paddingLeft:Re,paddingRight:Re}:{paddingTop:Re,paddingBottom:Re,paddingLeft:de,paddingRight:de},backgroundColor:N,border:"1px solid rgb(var(--sg-border, 226 232 240) / 0.85)",borderRadius:`${x}px`,backdropFilter:"blur(10px)",transition:"all 0.3s ease"},children:c.map((ne,he)=>{let Fe=A===he,ze=sl({index:he,hoveredIndex:A,magnify:P,magnifyScale:w,itemSize:R,gap:C,orientation:ee,liftDirection:O});return(0,Vn.jsxs)("div",{"data-dock-item":!0,className:`sg-dock-item ${b} ${ne.className??""}`,style:{position:"relative",width:R,height:R,transform:`translate3d(${ze.translateX}px, ${ze.translateY}px, 0) scale(${ze.scale})`,transformOrigin:ze.transformOrigin,transition:"transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1)",willChange:"transform",cursor:ne.disabled?"not-allowed":"pointer",opacity:ne.disabled?.5:1,zIndex:ze.zIndex},onMouseEnter:()=>q(he),onMouseLeave:()=>q(null),children:[(0,Vn.jsx)("button",{type:"button",className:"sg-dock-item-icon focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35",style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:`${x*.5}px`,backgroundColor:me,color:K,transition:"background-color 0.2s ease"},onMouseEnter:X=>{X.currentTarget.style.backgroundColor=H},onMouseLeave:X=>{X.currentTarget.style.backgroundColor=me},onClick:()=>Ee(ne),"aria-label":ne.label,title:ne.label,disabled:ne.disabled,children:ne.icon}),ne.badge&&(0,Vn.jsx)("div",{className:"sg-dock-item-badge",style:{position:"absolute",top:-4,right:-4,backgroundColor:"hsl(var(--destructive))",color:"hsl(var(--destructive-foreground))",borderRadius:"50%",minWidth:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:600,padding:"0 4px",boxShadow:"0 2px 4px rgba(0,0,0,0.2)"},children:ne.badge}),B&&Fe&&(0,Vn.jsx)("div",{className:"sg-dock-item-label",style:{position:"absolute",...il(ee,d),backgroundColor:se,color:$e,padding:"4px 8px",borderRadius:6,fontSize:12,fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3},children:ne.label})]},ne.id)})})}),V&&(0,Vn.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:S+1},onClick:()=>U(!1),children:(0,Vn.jsxs)("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:"rgb(var(--sg-surface, 248 250 252))",color:"rgb(var(--sg-text, 15 23 42))",border:"1px solid rgb(var(--sg-border, 226 232 240))",borderRadius:12,padding:24,boxShadow:"0 8px 32px rgba(0,0,0,0.2)",maxWidth:400},onClick:ne=>ne.stopPropagation(),children:[(0,Vn.jsx)("h3",{style:{margin:0,marginBottom:12,fontSize:18,fontWeight:600},children:k(t,"components.dock.resetPosition")}),(0,Vn.jsx)("p",{style:{margin:0,marginBottom:16,fontSize:14,color:"hsl(var(--muted-foreground))"},children:k(t,"components.dock.resetConfirm")}),(0,Vn.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,Vn.jsx)("button",{onClick:()=>U(!1),style:{padding:"8px 16px",borderRadius:6,border:"1px solid hsl(var(--border))",backgroundColor:"rgb(var(--sg-muted-surface, 241 245 249))",color:"rgb(var(--sg-text, 15 23 42))",cursor:"pointer",fontSize:14},children:k(t,"components.actions.cancel")}),(0,Vn.jsx)("button",{onClick:Be,style:{padding:"8px 16px",borderRadius:6,border:"none",backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",cursor:"pointer",fontSize:14,fontWeight:500},children:k(t,"components.actions.confirm")})]})]})})]})}var $r=je(require("react"),1);var gu=new Set,lr=[],pp=0;function pu(){let e=[...lr];gu.forEach(t=>t(e))}function fp(){return pp+=1,`sg-toast-${Date.now()}-${pp}`}function b0(e){let t=lr.findIndex(n=>n.id===e.id);if(t<0)lr=[...lr,e];else{let r={...lr[t],...e};lr=[...lr.slice(0,t),r,...lr.slice(t+1)]}return pu(),e.id}function Do(e,t,n={}){let r=n.id??fp();return b0({...n,id:r,type:e,title:t,createdAt:Date.now()})}function Xo(e){if(!e){lr=[],pu();return}let t=lr.length;lr=lr.filter(n=>n.id!==e),lr.length!==t&&pu()}function ul(e){return gu.add(e),e([...lr]),()=>{gu.delete(e)}}var Qn=((e,t)=>Do("default",e,t));Qn.message=(e,t)=>Do("default",e,t);Qn.success=(e,t)=>Do("success",e,t);Qn.info=(e,t)=>Do("info",e,t);Qn.warning=(e,t)=>Do("warning",e,t);Qn.error=(e,t)=>Do("error",e,t);Qn.loading=(e,t)=>Do("loading",e,t);Qn.custom=(e,t)=>{let n=t?.id??fp(),r=typeof e=="function"?e(n):e;return Do("default",r,{...t,id:n})};Qn.dismiss=e=>{Xo(e)};Qn.promise=async(e,t,n)=>{let r=typeof e=="function"?e():e,o=bo(),s=Qn.loading(t.loading??k(o,"components.toast.loading"),n);try{let i=await r;if(t.success!==void 0){let c=typeof t.success=="function"?t.success(i):t.success;Qn.success(c,{...n,id:s})}else Qn.dismiss(s);return i}catch(i){if(t.error!==void 0){let c=typeof t.error=="function"?t.error(i):t.error;Qn.error(c,{...n,id:s})}else Qn.dismiss(s);throw i}};var hp=Qn;var bp=0,Jo=[],fu=new Set;function vp(){fu.forEach(e=>e())}function dl(e){Jo.includes(e)||(Jo.push(e),vp())}function ml(e){let t=Jo.indexOf(e);t>=0&&(Jo.splice(t,1),vp())}function Is(){return Jo[Jo.length-1]??null}function Oa(){return Jo.length>0}function za(e){return fu.add(e),()=>{fu.delete(e)}}function gl(){return bp+=1,`sg-toast-host-${bp}`}var yo=require("react/jsx-runtime");function yp(...e){return e.filter(Boolean).join(" ")}var v0={"top-right":"top-4 right-4 items-end","top-left":"top-4 left-4 items-start","top-center":"top-4 left-1/2 -translate-x-1/2 items-center","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},y0={default:{border:"hsl(var(--border))",bg:"hsl(var(--background))",fg:"hsl(var(--foreground))"},success:{border:"#22c55e",bg:"#16a34a",fg:"#ffffff"},info:{border:"#0ea5e9",bg:"#0284c7",fg:"#ffffff"},warning:{border:"#f59e0b",bg:"#f59e0b",fg:"#000000"},error:{border:"#ef4444",bg:"#dc2626",fg:"#ffffff"},loading:{border:"#3b82f6",bg:"#2563eb",fg:"#ffffff"}},x0={default:{border:"hsl(var(--border))",bg:"hsl(var(--background))",fg:"hsl(var(--foreground))"},success:{border:"#86efac",bg:"#f0fdf4",fg:"#14532d"},info:{border:"#7dd3fc",bg:"#f0f9ff",fg:"#0c4a6e"},warning:{border:"#fcd34d",bg:"#fffbeb",fg:"#78350f"},error:{border:"#fca5a5",bg:"#fef2f2",fg:"#7f1d1d"},loading:{border:"#93c5fd",bg:"#eff6ff",fg:"#1e3a8a"}};function S0(e){return e===void 0||Number.isNaN(e)?0:Math.max(0,Math.min(100,e))}function C0(e,t,n){let r=t?y0[e]:x0[e],o=n?.[e];return{border:o?.border??r.border,bg:o?.bg??r.bg,fg:o?.fg??r.fg}}var hu=$r.default.createContext(!1);function pl(e){let t=$r.default.useContext(hu),{position:n="top-right",duration:r=4e3,visibleToasts:o=6,closeButton:s=!0,richColors:i=!0,transparency:c=0,customColors:d,className:u,style:m,...g}=e,h=Me(),[b,S]=$r.default.useState([]),R=$r.default.useRef({}),[C,N]=$r.default.useState(()=>!t&&Oa());$r.default.useEffect(()=>ul(S),[]),$r.default.useEffect(()=>{if(!t)return N(Oa()),za(()=>N(Oa()))},[t]);let B=$r.default.useMemo(()=>o<=0?[]:b.slice(-o),[b,o]);$r.default.useEffect(()=>{let w=new Set;B.forEach(x=>{let I=x.id;if(w.add(I),R.current[I]||x.type==="loading")return;let D=x.duration??r;D<=0||(R.current[I]=setTimeout(()=>{Xo(I),delete R.current[I]},D))}),Object.entries(R.current).forEach(([x,I])=>{w.has(x)||(clearTimeout(I),delete R.current[x])})},[B,r]),$r.default.useEffect(()=>()=>{Object.values(R.current).forEach(w=>clearTimeout(w)),R.current={}},[]);let P=1-S0(c)/100;return C?null:(0,yo.jsx)("div",{className:yp("pointer-events-none fixed z-[1100] flex max-h-screen w-full flex-col gap-2 p-4 sm:w-auto",v0[n],u),style:m,...g,children:B.map(w=>{let x=C0(w.type,i,d),I=w.closeButton??s;return(0,yo.jsxs)("div",{className:yp("pointer-events-auto flex min-w-[260px] max-w-[420px] items-start gap-3 rounded-md border px-3 py-2 shadow-lg",w.className),style:{borderColor:x.border,backgroundColor:x.bg,color:x.fg,opacity:P,...w.style},role:"status","aria-live":"polite",children:[(0,yo.jsxs)("div",{className:"min-w-0 flex-1",children:[w.title?(0,yo.jsx)("div",{className:"text-sm font-semibold",children:w.title}):null,w.description?(0,yo.jsx)("div",{className:"mt-0.5 text-xs opacity-90",children:w.description}):null]}),w.action?(0,yo.jsx)("button",{type:"button",className:"rounded border border-current/30 px-2 py-1 text-xs font-medium opacity-95 hover:opacity-100",onClick:()=>{w.action?.onClick?.(),Xo(w.id)},children:w.action.label}):null,I?(0,yo.jsx)("button",{type:"button",className:"rounded px-1.5 py-0.5 text-xs opacity-80 hover:opacity-100",onClick:()=>Xo(w.id),"aria-label":k(h,"components.toaster.close"),children:"x"}):null]},w.id)})})}var Es=je(require("react"),1);var bu=require("react/jsx-runtime");function xp(e){let t=Es.default.useRef(null);t.current===null&&(t.current=gl());let n=t.current,[r,o]=Es.default.useState(!1);return Es.default.useEffect(()=>(dl(n),o(Is()===n),()=>{ml(n)}),[n]),Es.default.useEffect(()=>za(()=>{o(Is()===n)}),[n]),r?(0,bu.jsx)(hu.Provider,{value:!0,children:(0,bu.jsx)(pl,{...e})}):null}var ta=je(require("react"),1);var vu=new Set,hr=[],Sp=0;function yu(){let e=[...hr];vu.forEach(t=>t(e))}function Rp(){return Sp+=1,`sg-whistle-${Date.now()}-${Sp}`}function xu(e){let t=hr.findIndex(o=>o.id===e.id);if(t<0)return hr=[...hr,e],yu(),e.id;let n=hr[t],r={...n,...e,createdAt:n.createdAt};return hr=[...hr.slice(0,t),r,...hr.slice(t+1)],yu(),r.id}function Cp(e){let t=hr.filter(e);t.length!==0&&(hr=hr.filter(n=>!e(n)),yu(),t.forEach(n=>{n.onClose?.()}))}function kp(e,t,n=e.id??Rp()){return{...e,id:n,severity:e.severity??t,createdAt:Date.now()}}function wp(e,t){if(e!==void 0)return typeof e=="function"?e(t):e}function Va(e){let t=kp(e,e.severity??"default");return xu(t)}function ea(e){if(!e){Cp(()=>!0);return}Cp(t=>t.id===e)}function fl(e){return vu.add(e),e([...hr]),()=>{vu.delete(e)}}var Qo={show(e){return Va({...e,severity:e.severity??"default"})},success(e){return Va({...e,severity:"success"})},info(e){return Va({...e,severity:"info"})},warning(e){return Va({...e,severity:"warning"})},error(e){return Va({...e,severity:"error"})},loading(e){return Va({...e,severity:"loading"})},dismiss(e){ea(e)},update(e,t){let n=hr.find(r=>r.id===e);return n?xu({...n,...t,id:e,createdAt:n.createdAt}):e},custom(e,t={}){let n=t.id??Rp();return xu({...kp(t,t.severity??"default",n),renderer:typeof e=="function"?e(n):e})},async promise(e,t,n){let r=typeof e=="function"?e():e,o=bo(),s=t.loading??{message:k(o,"components.toast.loading")},i=Qo.loading({...n,...s,severity:"loading"});try{let c=await r,d=wp(t.success,c);return d?Qo.update(i,{...n,...d,severity:"success"}):Qo.dismiss(i),c}catch(c){let d=wp(t.error,c);throw d?Qo.update(i,{...n,...d,severity:"error"}):Qo.dismiss(i),c}}};var Jr=require("react/jsx-runtime");function Su(...e){return e.filter(Boolean).join(" ")}var w0={default:{bg:"hsl(var(--background))",fg:"hsl(var(--foreground))",border:"hsl(var(--border))"},success:{bg:"#f0fdf4",fg:"#14532d",border:"#86efac"},info:{bg:"#eff6ff",fg:"#1e3a8a",border:"#93c5fd"},warning:{bg:"#fffbeb",fg:"#78350f",border:"#fcd34d"},error:{bg:"#fef2f2",fg:"#7f1d1d",border:"#fca5a5"},loading:{bg:"#eff6ff",fg:"#1d4ed8",border:"#60a5fa"}};function R0(e){return e===void 0||Number.isNaN(e)?1:Math.max(0,Math.min(1,e))}function k0(e,t){let n=w0[e],r=t?.[e];return{bg:r?.bg??n.bg,fg:r?.fg??n.fg,border:r?.border??n.border}}function P0(e,t){return e==="none"?{borderWidth:0}:e==="left-accent"?{borderWidth:1,borderColor:t.border,borderLeftWidth:4}:e==="full-accent"?{borderWidth:1,borderColor:t.border,boxShadow:`inset 0 0 0 1px ${t.border}`}:e==="soft"?{borderWidth:1,borderColor:t.border,boxShadow:"0 1px 2px rgba(15, 23, 42, 0.06)"}:{borderWidth:1,borderColor:t.border}}function T0(e){return e.renderer!==void 0?e.renderer:(0,Jr.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,Jr.jsx)("div",{className:"text-sm font-semibold",children:e.title}):null,e.message?(0,Jr.jsx)("div",{className:Su(e.title?"mt-0.5":void 0,"text-sm"),children:e.message}):null]})}function Pp(e){let{max:t=4,newestOnTop:n=!1,gap:r=12,customColors:o,className:s,style:i,...c}=e,d=Me(),[u,m]=ta.default.useState([]),g=ta.default.useRef({});ta.default.useEffect(()=>fl(m),[]);let h=ta.default.useMemo(()=>{if(t<=0)return[];let b=u.slice(-t);return n?[...b].reverse():b},[u,t,n]);return ta.default.useEffect(()=>{let b=new Set;h.forEach(S=>{if(b.add(S.id),g.current[S.id]||S.severity==="loading")return;let R=S.duration??5e3;R<=0||(g.current[S.id]=setTimeout(()=>{ea(S.id),delete g.current[S.id]},R))}),Object.entries(g.current).forEach(([S,R])=>{b.has(S)||(clearTimeout(R),delete g.current[S])})},[h]),ta.default.useEffect(()=>()=>{Object.values(g.current).forEach(b=>clearTimeout(b)),g.current={}},[]),(0,Jr.jsx)("div",{className:Su("flex flex-col",s),style:{gap:r,...i},...c,children:h.map(b=>{let S=k0(b.severity,o),R=b.dismissible??!0;return(0,Jr.jsxs)("div",{className:Su("flex items-start gap-3 rounded-lg px-3 py-2",b.borderStyle==="none"?void 0:"border",b.className),style:{backgroundColor:S.bg,color:S.fg,opacity:R0(b.opacity),...P0(b.borderStyle??"solid",S),...b.style},role:"status","aria-live":"polite",children:[b.icon?(0,Jr.jsx)("div",{className:"shrink-0 pt-0.5",children:b.icon}):null,T0(b),b.action?(0,Jr.jsx)("button",{type:"button",className:"shrink-0 rounded border border-current/25 px-2 py-1 text-xs font-medium",onClick:()=>{b.action?.onClick(),ea(b.id)},children:b.action.label}):null,R?(0,Jr.jsx)("button",{type:"button",className:"shrink-0 rounded px-1 py-0.5 text-sm leading-none opacity-80","aria-label":k(d,"components.toaster.close"),onClick:()=>ea(b.id),children:"x"}):null]},b.id)})})}function Cu(e){switch(e){case"horizontal-right":return{orientation:"horizontal",direction:"left"};case"horizontal-left":return{orientation:"horizontal",direction:"right"};case"vertical-up":return{orientation:"vertical",direction:"up"};default:return{orientation:"vertical",direction:"down"}}}function wu(e,t,n){return!t||n=="free"?e:n==="top"||n==="bottom"?e.startsWith("horizontal")?e:"horizontal-left":e.startsWith("vertical")?e:"vertical-down"}function hl(e){let t=e.inDock&&!e.freeDrag&&e.dragHoverZone?e.dragHoverZone:e.effectiveZone,n=wu(e.orientationDirection,e.inDock,t),{orientation:r,direction:o}=Cu(n),s=r==="vertical"&&o==="up",i=r==="horizontal"&&o==="left";return{zoneForOrientation:t,resolvedOrientationDirection:n,orientation:r,direction:o,openUp:s,openLeft:i,showLeadingCollapseButton:r==="horizontal"&&i&&e.showContent,collapseIconDirection:n==="horizontal-right"?"right":o}}var Dn=je(require("react"),1),Np=require("react-dom");var Fn=require("react/jsx-runtime");function xo(...e){return e.filter(Boolean).join(" ")}function N0(e){switch(e){case"sm":return"max-w-sm";case"md":return"max-w-lg";case"lg":return"max-w-2xl";case"xl":return"max-w-4xl";case"full":return"max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)] max-h-none"}}function M0(e){switch(e){case"primary":return"border-t-[hsl(var(--primary))]";case"secondary":return"border-t-[hsl(var(--secondary))]";case"success":return"border-t-[hsl(var(--tertiary,var(--accent,var(--primary))))]";case"info":return"border-t-[hsl(var(--secondary,var(--primary)))]";case"warning":return"border-t-[hsl(var(--accent,var(--secondary,var(--primary))))]";case"help":return"border-t-[hsl(var(--secondary,var(--primary)))]";case"danger":return"border-t-[hsl(var(--destructive))]";default:return"border-t-[hsl(var(--border))]"}}function I0(e,t){let n=t?"opacity-100":"opacity-0";switch(e){case"fade":return n;case"zoom":return xo(n,t?"scale-100":"scale-95");case"slideUp":return xo(n,t?"translate-y-0":"translate-y-2")}}function E0(e,t){if(e===void 0)return t;if(typeof e!="string")return e;switch(e){case"none":return"none";case"sm":return"0 1px 2px rgba(2, 8, 23, 0.12)";case"md":return"0 10px 24px rgba(2, 8, 23, 0.2), 0 4px 10px rgba(2, 8, 23, 0.12)";case"lg":return"0 24px 60px rgba(2, 8, 23, 0.32), 0 12px 24px rgba(2, 8, 23, 0.18)";default:return e}}function Ds(e){return Math.min(255,Math.max(0,Math.round(e)))}function D0(e){let t=e.replace("#","").trim();if(!t)return null;if(t.length===3||t.length===4){let n=Number.parseInt((t.slice(0,1)||"0").repeat(2),16),r=Number.parseInt((t.slice(1,2)||"0").repeat(2),16),o=Number.parseInt((t.slice(2,3)||"0").repeat(2),16);return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)?null:{r:n,g:r,b:o}}if(t.length===6||t.length===8){let n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),o=Number.parseInt(t.slice(4,6),16);return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)?null:{r:n,g:r,b:o}}return null}function Ru(e){let t=e.trim();if(!t)return null;if(t.endsWith("%")){let r=Number.parseFloat(t.slice(0,-1));return Number.isFinite(r)?Ds(r/100*255):null}let n=Number.parseFloat(t);return Number.isFinite(n)?Ds(n):null}function A0(e){let t=e.match(/^rgba?\((.+)\)$/i);if(!t)return null;let r=(t[1]?.trim()??"").replace(/\s*\/\s*[\d.]+%?\s*$/,""),o=r.includes(",")?r.split(","):r.split(/\s+/);if(o.length<3)return null;let s=Ru(o[0]??""),i=Ru(o[1]??""),c=Ru(o[2]??"");return s===null||i===null||c===null?null:{r:s,g:i,b:c}}function L0(e){let t=e.trim().toLowerCase();if(!t)return null;if(t.endsWith("turn")){let r=Number.parseFloat(t.slice(0,-4));return Number.isFinite(r)?r*360:null}if(t.endsWith("rad")){let r=Number.parseFloat(t.slice(0,-3));return Number.isFinite(r)?r*180/Math.PI:null}if(t.endsWith("deg")){let r=Number.parseFloat(t.slice(0,-3));return Number.isFinite(r)?r:null}let n=Number.parseFloat(t);return Number.isFinite(n)?n:null}function Tp(e){let t=e.trim();if(!t.endsWith("%"))return null;let n=Number.parseFloat(t.slice(0,-1));return Number.isFinite(n)?Math.min(100,Math.max(0,n)):null}function B0(e,t,n){let r=Math.min(1,Math.max(0,t/100)),o=Math.min(1,Math.max(0,n/100)),s=(e%360+360)%360,i=(1-Math.abs(2*o-1))*r,c=i*(1-Math.abs(s/60%2-1)),d=o-i/2,u=0,m=0,g=0;return s<60?(u=i,m=c):s<120?(u=c,m=i):s<180?(m=i,g=c):s<240?(m=c,g=i):s<300?(u=c,g=i):(u=i,g=c),{r:Ds((u+d)*255),g:Ds((m+d)*255),b:Ds((g+d)*255)}}function F0(e){let t=e.match(/^hsla?\((.+)\)$/i);if(!t)return null;let r=(t[1]?.trim()??"").replace(/\s*\/\s*[\d.]+%?\s*$/,""),o=r.includes(",")?r.split(","):r.split(/\s+/);if(o.length<3)return null;let s=L0(o[0]??""),i=Tp(o[1]??""),c=Tp(o[2]??"");return s===null||i===null||c===null?null:B0(s,i,c)}function O0(e){let t=e.trim();return t?t.startsWith("#")?D0(t):/^rgba?\(/i.test(t)?A0(t):/^hsla?\(/i.test(t)?F0(t):null:null}function z0({r:e,g:t,b:n}){let r=o=>{let s=o/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function V0(e){if(typeof e!="string")return null;let t=O0(e);return t?z0(t)>=.56?{foreground:"rgb(17 24 39)",mutedForeground:"rgb(71 85 105)",border:"rgba(15, 23, 42, 0.16)",hoverBg:"rgba(15, 23, 42, 0.08)",activeBg:"rgba(15, 23, 42, 0.14)"}:{foreground:"rgb(243 244 246)",mutedForeground:"rgb(203 213 225)",border:"rgba(248, 250, 252, 0.18)",hoverBg:"rgba(248, 250, 252, 0.08)",activeBg:"rgba(248, 250, 252, 0.14)"}:null}function As(e){let t=Me(),{open:n,onOpenChange:r,defaultOpen:o=!1,title:s,subtitle:i,leading:c,trailing:d,children:u,footer:m,size:g="md",severity:h="plain",animation:b="zoom",transitionMs:S=160,autoCloseMs:R,className:C,style:N,customColor:B,elevation:P,shadow:w,showTopAccent:x=!0,overlayClassName:I,contentClassName:D,headerClassName:F,bodyClassName:v,footerClassName:$,closeable:G=!0,onClose:j,closeOnOverlayClick:_=!0,closeOnEsc:V=!0,lockBodyScroll:U=!0,initialFocusRef:A,restoreFocus:q=!0,ariaLabel:M}=e,T=n!==void 0,[z,ee]=Dn.useState(o),O=T?!!n:z,de=Dn.useCallback(X=>{T||ee(X),r?.(X)},[T,r]),Re=Dn.useCallback(()=>{O&&(de(!1),j?.())},[O,de,j]),[W,Y]=Dn.useState(!1),[me,H]=Dn.useState(O),[K,se]=Dn.useState(!1);Dn.useEffect(()=>Y(!0),[]),Dn.useEffect(()=>{if(O){H(!0);let ae=window.setTimeout(()=>se(!0),0);return()=>window.clearTimeout(ae)}se(!1);let X=window.setTimeout(()=>H(!1),S);return()=>window.clearTimeout(X)},[O,S]),Dn.useEffect(()=>{if(!O||!R||R<=0)return;let X=window.setTimeout(()=>{Re()},R);return()=>window.clearTimeout(X)},[O,R,Re]),Dn.useEffect(()=>{if(!me||!O||!U)return;let X=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=X}},[me,O,U]);let $e=Dn.useRef(null),Ae=Dn.useRef(null),Qe=Dn.useRef(null);Dn.useEffect(()=>{if(!O)return;Qe.current=document.activeElement;let X=A?.current??Ae.current?.querySelector('[data-sg-dialog-initial-focus="true"], button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),ae=window.setTimeout(()=>X?.focus?.(),0);return()=>window.clearTimeout(ae)},[O,A]),Dn.useEffect(()=>{O||q&&Qe.current?.focus?.()},[O,q]),Dn.useEffect(()=>{if(!O||!V)return;let X=ae=>{if(ae.key==="Escape"){ae.preventDefault(),Re();return}if(ae.key==="Tab"){let ie=Ae.current;if(!ie)return;let ve=Array.from(ie.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(ue=>!ue.hasAttribute("disabled")&&ue.getAttribute("aria-hidden")!=="true");if(ve.length===0)return;let Q=ve[0],Pe=ve[ve.length-1];if(!Q||!Pe)return;let at=document.activeElement;!ae.shiftKey&&at===Pe?(ae.preventDefault(),Q.focus()):ae.shiftKey&&at===Q&&(ae.preventDefault(),Pe.focus())}};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[O,V,Re]);let ge=X=>{_&&X.target===$e.current&&Re()},pe=X=>{_&&X.target===X.currentTarget&&Re()};if(!W||!me)return null;let fe=M??(typeof s=="string"?s:void 0)??k(t,"components.dialog.ariaLabel"),We="fixed inset-0 bg-black/60 backdrop-blur-[1px] transition-opacity",Be=K?"opacity-100":"opacity-0",Ee="w-full rounded-2xl bg-background text-foreground shadow-2xl border border-border max-h-[85vh] flex flex-col transition duration-150 ease-out"+(x?" border-t-4":""),ke=E0(P,w),ne=V0(B),he={"--sg-dialog-muted-foreground":ne?.mutedForeground??"hsl(var(--muted-foreground))","--sg-dialog-divider":ne?.border??"hsl(var(--border))","--sg-dialog-hover-bg":ne?.hoverBg??"hsl(var(--muted) / 0.6)","--sg-dialog-active-bg":ne?.activeBg??"hsl(var(--muted))"},Fe={transitionDuration:`${S}ms`},ze={...he,...Fe,...B!==void 0?{backgroundColor:B}:{},...ne?{color:ne.foreground,borderColor:ne.border}:{},...ke!==void 0?{boxShadow:ke}:{}};return(0,Np.createPortal)((0,Fn.jsxs)("div",{className:xo("fixed inset-0 z-[1000]",C),style:N,role:"dialog","aria-modal":"true","aria-label":fe,children:[(0,Fn.jsx)("div",{ref:$e,onMouseDown:ge,className:xo(We,Be,I),style:Fe}),(0,Fn.jsx)("div",{className:"fixed inset-0 flex items-center justify-center p-4",onMouseDown:pe,children:(0,Fn.jsxs)("div",{ref:Ae,className:xo(Ee,N0(g),I0(b,K),x?M0(h):!1,D),style:ze,children:[(s||i||G||c||d)&&(0,Fn.jsxs)("div",{className:xo("px-5 py-4 border-b border-[var(--sg-dialog-divider)] flex items-start gap-3",F),children:[c?(0,Fn.jsx)("div",{className:"shrink-0 pt-0.5",children:c}):null,(0,Fn.jsxs)("div",{className:"min-w-0 flex-1",children:[s?(0,Fn.jsx)("div",{className:"text-base font-semibold leading-6",children:s}):null,i?(0,Fn.jsx)("div",{className:"mt-1 text-sm text-[var(--sg-dialog-muted-foreground)]",children:i}):null]}),(0,Fn.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[d?(0,Fn.jsx)("div",{className:"shrink-0",children:d}):null,G?(0,Fn.jsx)("button",{type:"button",onClick:Re,className:xo("inline-flex items-center justify-center h-9 w-9 rounded-lg","hover:bg-[var(--sg-dialog-hover-bg)] active:bg-[var(--sg-dialog-active-bg)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--ring,var(--primary)))]"),"aria-label":k(t,"components.dialog.close"),children:(0,Fn.jsx)(H0,{})}):null]})]}),(0,Fn.jsx)("div",{className:xo("px-5 py-4 overflow-auto",v),children:u}),m?(0,Fn.jsx)("div",{className:xo("px-5 py-4 border-t border-[var(--sg-dialog-divider)] flex items-center justify-end gap-2",$),children:m}):null]})})]}),document.body)}function H0(){return(0,Fn.jsx)("svg",{viewBox:"0 0 24 24",className:"size-5","aria-hidden":"true",children:(0,Fn.jsx)("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}As.displayName="SgDialog";var Ao=je(require("react"),1);var Lt=require("react/jsx-runtime");function $0(e,t){return!e||e==="plain"?t:e}function _0(){return(0,Lt.jsx)("svg",{viewBox:"0 0 24 24",className:"size-4","aria-hidden":"true",children:(0,Lt.jsx)("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function W0(){return(0,Lt.jsx)("svg",{viewBox:"0 0 24 24",className:"size-4","aria-hidden":"true",children:(0,Lt.jsx)("path",{d:"M5 12l5 5L20 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function q0(){return(0,Lt.jsxs)("svg",{viewBox:"0 0 24 24",className:"size-5 text-sky-600","aria-hidden":"true",children:[(0,Lt.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2"}),(0,Lt.jsx)("path",{d:"M12 10v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,Lt.jsx)("circle",{cx:"12",cy:"7",r:"1.25",fill:"currentColor"})]})}function G0(){return(0,Lt.jsxs)("svg",{viewBox:"0 0 24 24",className:"size-5 text-amber-600","aria-hidden":"true",children:[(0,Lt.jsx)("path",{d:"M12 3L22 20H2L12 3z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),(0,Lt.jsx)("path",{d:"M12 9v5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,Lt.jsx)("circle",{cx:"12",cy:"17.25",r:"1.1",fill:"currentColor"})]})}function U0(){return(0,Lt.jsxs)("svg",{viewBox:"0 0 24 24",className:"size-5 text-red-600","aria-hidden":"true",children:[(0,Lt.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2"}),(0,Lt.jsx)("path",{d:"M9 9l6 6M15 9l-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function j0(e){switch(e){case"info":return(0,Lt.jsx)(q0,{});case"warning":return(0,Lt.jsx)(G0,{});case"danger":return(0,Lt.jsx)(U0,{});default:return}}function ku(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onClose:o,title:s,message:i,icon:c,iconPlacement:d="left",severity:u="warning",customColor:m,elevation:g,showSeverityAccent:h=!1,cancelButton:b,confirmButton:S,onCancel:R,onConfirm:C,closeOnCancel:N=!0,closeOnConfirm:B=!0,closeable:P=!1,size:w="sm",...x}=e,I=Me(),D=t!==void 0,[F,v]=Ao.useState(n),$=D?!!t:F,G=Ao.useCallback(W=>{D||v(W),r?.(W)},[D,r]),j=Ao.useCallback(()=>{b?.onClick?.(),R?.()},[b,R]),_=Ao.useCallback(()=>{j(),N&&G(!1)},[j,N,G]),V=Ao.useCallback(()=>{S?.onClick?.(),C?.(),B&&G(!1)},[S,C,B,G]),U=Ao.useCallback(W=>{!W&&$&&j(),G(W)},[$,j,G]),A=b?.label??k(I,"components.actions.cancel"),q=S?.label??k(I,"components.actions.confirm"),M=b?.icon??(0,Lt.jsx)(_0,{}),T=S?.icon??(0,Lt.jsx)(W0,{}),z=c!==void 0?c:j0(u),ee=b?.severity??"secondary",O=S?.severity??$0(u,"primary"),de=b?.appearance===void 0&&b?.severity===void 0&&b?.className===void 0?{bg:"hsl(var(--foreground))",fg:"hsl(var(--foreground))",border:"hsl(var(--border))",hoverBg:"hsl(var(--muted) / 0.8)",hoverFg:"hsl(var(--foreground))",hoverBorder:"hsl(var(--border))",activeBg:"hsl(var(--muted))"}:void 0,Re=(0,Lt.jsx)("div",{className:"text-sm text-muted-foreground",children:i});return(0,Lt.jsx)(As,{...x,open:$,onOpenChange:U,onClose:o,closeable:P,severity:u,showTopAccent:h,customColor:m,elevation:g,title:s,size:w,footer:(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(Tt,{size:"sm",appearance:b?.appearance??"outline",severity:ee,shape:b?.shape??"rounded",disabled:b?.disabled,className:b?.className,customColors:de,leftIcon:M,onClick:_,children:A}),(0,Lt.jsx)(Tt,{size:"sm",appearance:S?.appearance??"solid",severity:O,shape:S?.shape??"rounded",disabled:S?.disabled,className:S?.className,leftIcon:T,onClick:V,children:q})]}),children:z?d==="top"?(0,Lt.jsxs)("div",{className:"flex flex-col items-start gap-3",children:[(0,Lt.jsx)("div",{className:"shrink-0",children:z}),Re]}):(0,Lt.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Lt.jsx)("div",{className:"shrink-0",children:z}),(0,Lt.jsx)("div",{className:"min-w-0",children:Re})]}):Re})}ku.displayName="SgConfirmationDialog";var Ip=je(require("react"),1);var _r=require("react/jsx-runtime");function Lo(...e){return e.filter(Boolean).join(" ")}var Y0={xs:"h-4 px-1.5 text-[11px]",sm:"h-5 px-2 text-xs",md:"h-6 px-2.5 text-sm",lg:"h-7 px-3 text-base"},Pu={xs:"size-3",sm:"size-4",md:"size-4",lg:"size-5"},Mp={primary:{bg:"hsl(var(--primary))",fg:"hsl(var(--primary-foreground))",border:"hsl(var(--primary))",ring:"hsl(var(--ring, var(--primary)))"},secondary:{bg:"hsl(var(--secondary))",fg:"hsl(var(--secondary-foreground))",border:"hsl(var(--secondary))",ring:"hsl(var(--ring, var(--secondary)))"},success:{bg:"hsl(var(--tertiary, var(--accent, var(--primary))))",fg:"hsl(var(--tertiary-foreground, var(--accent-foreground, var(--primary-foreground))))",border:"hsl(var(--tertiary, var(--accent, var(--primary))))",ring:"hsl(var(--ring, var(--tertiary, var(--accent, var(--primary)))))"},warning:{bg:"hsl(var(--accent, var(--secondary, var(--primary))))",fg:"hsl(var(--accent-foreground, var(--secondary-foreground, var(--primary-foreground))))",border:"hsl(var(--accent, var(--secondary, var(--primary))))",ring:"hsl(var(--ring, var(--accent, var(--secondary, var(--primary)))))"},danger:{bg:"hsl(var(--destructive))",fg:"hsl(var(--destructive-foreground))",border:"hsl(var(--destructive))",ring:"hsl(var(--ring, var(--destructive)))"},info:{bg:"hsl(var(--secondary, var(--primary)))",fg:"hsl(var(--secondary-foreground, var(--primary-foreground)))",border:"hsl(var(--secondary, var(--primary)))",ring:"hsl(var(--ring, var(--secondary, var(--primary))))"},neutral:{bg:"hsl(var(--muted))",fg:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",ring:"hsl(var(--ring, var(--muted)))"}};function K0(e,t){let n=e==="custom"?Mp.primary:Mp[e],r=t?.bg??n.bg,o=t?.fg??n.fg,s=t?.border??n.border,i=t?.softBg??`color-mix(in_srgb, ${r} 14%, transparent)`,c=t?.softFg??r,d=t?.hoverBg??`color-mix(in_srgb, ${r} 12%, transparent)`,u=t?.hoverFg??r,m=t?.hoverBorder??s,g=t?.ring??n.ring;return{bg:r,fg:o,border:s,softBg:i,softFg:c,hoverBg:d,hoverFg:u,hoverBorder:m,ring:g}}function Z0(e,t){let n=K0(e,t);return{"--sg-badge-bg":n.bg,"--sg-badge-fg":n.fg,"--sg-badge-border":n.border,"--sg-badge-soft-bg":n.softBg,"--sg-badge-soft-fg":n.softFg,"--sg-badge-hover-bg":n.hoverBg,"--sg-badge-hover-fg":n.hoverFg,"--sg-badge-hover-border":n.hoverBorder,"--sg-badge-ring":n.ring}}function X0(e,t,n){return typeof e=="number"?!n&&e===0?null:typeof t=="number"&&e>t?`${t}+`:String(e):e??null}function Tu(e){let{value:t,severity:n="primary",badgeStyle:r="solid",size:o="md",rounded:s=!0,dot:i=!1,pulse:c=!1,max:d,showZero:u=!0,leftIcon:m,rightIcon:g,removable:h=!1,onRemove:b,removeAriaLabel:S,autoRemove:R=!1,onClick:C,disabled:N,title:B,hint:P,customColors:w,className:x,style:I,partsClassName:D,...F}=e,v=Me(),$=S??k(v,"components.badge.remove"),G=X0(t,d,u),[j,_]=Ip.useState(!1),V=Z0(n,w);if(i)return(0,_r.jsxs)("span",{title:P??B,className:Lo("relative inline-flex items-center justify-center",D?.dot,x),style:{...V,...I},...F,children:[c?(0,_r.jsx)("span",{className:"absolute inline-flex size-3 rounded-full bg-[var(--sg-badge-bg)] opacity-75 animate-ping"}):null,(0,_r.jsx)("span",{className:"inline-flex size-2.5 rounded-full bg-[var(--sg-badge-bg)]"})]});if(j||G===null&&!m&&!g&&!h)return null;let U=typeof C=="function",A=U?"button":"span",q=Lo("inline-flex items-center gap-1.5 whitespace-nowrap font-medium","transition-[color,background-color,border-color] duration-150",Y0[o],s?"rounded-full":"rounded-md",r==="solid"?"bg-[var(--sg-badge-bg)] text-[var(--sg-badge-fg)] border border-[var(--sg-badge-border)]":r==="soft"?"bg-[var(--sg-badge-soft-bg)] text-[var(--sg-badge-soft-fg)] border border-transparent":r==="outline"?"bg-transparent text-[var(--sg-badge-bg)] border border-[var(--sg-badge-border)]":"bg-transparent text-[var(--sg-badge-bg)] border border-transparent",r==="ghost"||r==="outline"?"hover:bg-[var(--sg-badge-hover-bg)] hover:text-[var(--sg-badge-hover-fg)] hover:border-[var(--sg-badge-hover-border)]":"",U?Lo("cursor-pointer select-none","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sg-badge-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background",N?"pointer-events-none opacity-50":""):"",x,D?.container);return(0,_r.jsxs)(A,{type:U?"button":void 0,title:P??B,onClick:N?void 0:C,disabled:U?N:void 0,style:{...V,...I},className:q,role:U?void 0:"status",...F,children:[m?(0,_r.jsx)("span",{className:Lo("inline-flex",Pu[o]),children:m}):null,G!==null?(0,_r.jsx)("span",{className:Lo("inline-flex items-center",D?.label),children:G}):null,g?(0,_r.jsx)("span",{className:Lo("inline-flex",Pu[o]),children:g}):null,h?(0,_r.jsx)("button",{type:"button",onClick:M=>{M.stopPropagation(),R&&_(!0),b?.()},"aria-label":$,className:Lo("ml-0.5 inline-flex items-center justify-center rounded-full","opacity-70 hover:opacity-100","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sg-badge-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background",D?.removeButton),children:(0,_r.jsx)("span",{className:Lo("inline-flex",Pu[o]),children:"x"})}):null]})}Tu.displayName="SgBadge";var bl=require("react/jsx-runtime");function Ep(...e){return e.filter(Boolean).join(" ")}function Nu(e){let{children:t,badge:n,placement:r="top-right",className:o,style:s}=e,i={"top-left":"left-0 top-0 -translate-x-1/3 -translate-y-1/3","top-right":"right-0 top-0 translate-x-1/3 -translate-y-1/3","bottom-left":"left-0 bottom-0 -translate-x-1/3 translate-y-1/3","bottom-right":"right-0 bottom-0 translate-x-1/3 translate-y-1/3",right:"right-0 top-1/2 translate-x-1/2 -translate-y-1/2",left:"left-0 top-1/2 -translate-x-1/2 -translate-y-1/2",top:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2",bottom:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2"};return(0,bl.jsxs)("span",{className:Ep("relative inline-flex",o),style:s,children:[t,(0,bl.jsx)("span",{className:Ep("absolute",i[r]),children:n})]})}Nu.displayName="SgBadgeOverlay";var yl=je(require("react"),1),Mu=require("react/jsx-runtime");function J0(...e){return e.filter(Boolean).join(" ")}function vl(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Iu(e){let{width:t,height:n,size:r,borderRadius:o,shape:s="text",animation:i="wave",className:c,style:d,...u}=e,m=yl.useRef(null);yl.useEffect(()=>{if(i!=="wave")return;let R=m.current;if(!R||typeof R.animate!="function")return;let C=R.animate([{transform:"translateX(-100%)"},{transform:"translateX(100%)"}],{duration:1300,iterations:1/0,easing:"ease-in-out"});return()=>{C.cancel()}},[i]);let g=vl(r),h=g??vl(t)??(s==="square"||s==="circle"?"2.5rem":"100%"),b=g??vl(n)??(s==="text"?"1rem":s==="square"||s==="circle"?"2.5rem":"2rem"),S=vl(o)??(s==="circle"?"9999px":s==="square"?"0":s==="rounded"?"0.75rem":s==="text"?"9999px":"0.375rem");return(0,Mu.jsx)("div",{className:J0("relative block overflow-hidden bg-muted/80",i==="pulse"?"animate-pulse":"",c),style:{width:h,height:b,borderRadius:S,...d},...u,children:i==="wave"?(0,Mu.jsx)("span",{ref:m,"aria-hidden":"true",className:"pointer-events-none absolute inset-0",style:{backgroundImage:"linear-gradient(90deg, transparent 0%, hsl(var(--background) / 0.55) 50%, transparent 100%)",transform:"translateX(-100%)",willChange:"transform"}}):null})}Iu.displayName="SgSkeleton";var qr=je(require("react"),1);var Wr=require("react/jsx-runtime");function na(...e){return e.filter(Boolean).join(" ")}var Q0={xs:{box:"size-6",text:"text-[11px]",icon:"size-3.5"},sm:{box:"size-8",text:"text-xs",icon:"size-4"},md:{box:"size-10",text:"text-sm",icon:"size-5"},lg:{box:"size-14",text:"text-lg",icon:"size-7"},xl:{box:"size-20",text:"text-2xl",icon:"size-9"}},Dp={none:"",sm:"-ml-1",md:"-ml-2",lg:"-ml-3"},Ap={primary:{bg:"hsl(var(--primary))",fg:"hsl(var(--primary-foreground))",border:"hsl(var(--primary))",ring:"hsl(var(--ring, var(--primary)))"},secondary:{bg:"hsl(var(--secondary))",fg:"hsl(var(--secondary-foreground))",border:"hsl(var(--secondary))",ring:"hsl(var(--ring, var(--secondary)))"},success:{bg:"hsl(var(--tertiary, var(--accent, var(--primary))))",fg:"hsl(var(--tertiary-foreground, var(--accent-foreground, var(--primary-foreground))))",border:"hsl(var(--tertiary, var(--accent, var(--primary))))",ring:"hsl(var(--ring, var(--tertiary, var(--accent, var(--primary)))))"},warning:{bg:"hsl(var(--accent, var(--secondary, var(--primary))))",fg:"hsl(var(--accent-foreground, var(--secondary-foreground, var(--primary-foreground))))",border:"hsl(var(--accent, var(--secondary, var(--primary))))",ring:"hsl(var(--ring, var(--accent, var(--secondary, var(--primary)))))"},danger:{bg:"hsl(var(--destructive))",fg:"hsl(var(--destructive-foreground))",border:"hsl(var(--destructive))",ring:"hsl(var(--ring, var(--destructive)))"},info:{bg:"hsl(var(--secondary, var(--primary)))",fg:"hsl(var(--secondary-foreground, var(--primary-foreground)))",border:"hsl(var(--secondary, var(--primary)))",ring:"hsl(var(--ring, var(--secondary, var(--primary))))"},neutral:{bg:"hsl(var(--muted))",fg:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",ring:"hsl(var(--ring, var(--muted)))"}};function ex(e,t){let n=e==="custom"?Ap.primary:Ap[e];return{bg:t?.bg??n.bg,fg:t?.fg??n.fg,border:t?.border??n.border,ring:t?.ring??n.ring}}function tx(e,t){let n=ex(e,t);return{"--sg-avatar-bg":n.bg,"--sg-avatar-fg":n.fg,"--sg-avatar-border":n.border,"--sg-avatar-ring":n.ring}}function xl(e){return e==null||e===!1?!1:typeof e=="string"?e.trim().length>0:!0}function nx(e){if(typeof e!="string")return e;let t=e.trim();if(!t)return"";if(t.length<=2)return t.toUpperCase();let n=t.split(/\s+/).filter(Boolean);return n.length>=2?`${n[0]?.[0]??""}${n[1]?.[0]??""}`.toUpperCase():t.slice(0,2).toUpperCase()}var ra=qr.forwardRef(({src:e,alt:t,label:n,icon:r,fallback:o,size:s="md",shape:i="circle",severity:c="primary",bordered:d=!0,disabled:u=!1,customColors:m,className:g,imageClassName:h,children:b,onImageError:S,onClick:R,role:C,tabIndex:N,style:B,title:P,["aria-label"]:w,...x},I)=>{let D=Me(),[F,v]=qr.useState(!1),$=Q0[s];qr.useEffect(()=>{v(!1)},[e]);let G=xl(b),j=!G&&!!e&&!F,_=!G&&!j&&xl(r),V=!G&&!j&&!_&&xl(n),U=typeof R=="function"||C==="button"||typeof N=="number",A=t??k(D,"components.avatar.defaultAlt"),q=w??(typeof n=="string"?n:A),M=s==="xs"||s==="sm"?"rounded-md":"rounded-xl";return(0,Wr.jsx)("span",{ref:I,title:P,role:C,tabIndex:N,onClick:u?void 0:R,"aria-label":q,style:{...tx(c,m),...B},className:na("relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden","font-medium leading-none",$.box,$.text,i==="circle"?"rounded-full":M,d?"border border-[var(--sg-avatar-border)]":"border border-transparent",j?"bg-muted text-transparent":"bg-[var(--sg-avatar-bg)] text-[var(--sg-avatar-fg)]",U?"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sg-avatar-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background":"",u?"pointer-events-none opacity-55":"",g),...x,children:G?b:j?(0,Wr.jsx)("img",{src:e,alt:A,loading:"lazy",draggable:!1,className:na("size-full object-cover",h),onError:T=>{v(!0),S?.(T)}}):_?(0,Wr.jsx)("span",{className:na("inline-flex items-center justify-center",$.icon),children:r}):V?(0,Wr.jsx)("span",{className:"uppercase",children:nx(n)}):(0,Wr.jsx)("span",{className:na("inline-flex items-center justify-center",$.icon),children:xl(o)?o:"?"})})});ra.displayName="SgAvatar";var Eu=qr.forwardRef(({children:e,max:t,total:n,overlap:r="md",moreSeverity:o="neutral",moreLabel:s,size:i="md",shape:c="circle",bordered:d=!0,className:u,...m},g)=>{let h=qr.Children.toArray(e).filter(B=>B!=null),b=typeof t=="number"&&Number.isFinite(t)&&t>0?Math.floor(t):void 0,S=b?Math.min(b,h.length):h.length,R=h.slice(0,S),C=Math.max(n??h.length,h.length),N=Math.max(C-S,0);return(0,Wr.jsxs)("div",{ref:g,className:na("inline-flex items-center",u),...m,children:[R.map((B,P)=>{let w=qr.isValidElement(B)&&B.key!=null?String(B.key):`sg-avatar-${P}`;return(0,Wr.jsx)("span",{className:na("inline-flex",P===0?"":Dp[r]),children:B},w)}),N>0?(0,Wr.jsx)("span",{className:na("inline-flex",S===0?"":Dp[r]),children:(0,Wr.jsx)(ra,{label:s?s(N):`+${N}`,size:i,shape:c,severity:o,bordered:d})}):null]})});Eu.displayName="SgAvatarGroup";var aa=je(require("react"),1),Bo=require("react/jsx-runtime");function oa(...e){return e.filter(Boolean).join(" ")}function Qr(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Bs(e){if(e!=null)return typeof e=="number"?`${e}%`:e}function rx(e){return e==="top"||e==="bottom"?"row":"column"}function ox(e){return e==="top"||e==="bottom"?"start":"stretch"}function ax(){return 10}function Lp(e){return{start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"}[e]}function Bp(e){return{start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"}[e]}function sx(e){if(!aa.isValidElement(e))return!1;let t=e.type;return(t.displayName??t.name)==="SgPanel"&&e.props.align!==void 0}function Du(e,t,n,r){if(!aa.isValidElement(e))return(0,Bo.jsx)("div",{style:n,className:r,children:e},t);let o=e,s={...o.props.style??{},...n};return aa.cloneElement(o,{key:o.key??t,className:oa(o.props.className,r),style:s})}function Ls(e,t,n){if(n==="top"||n==="bottom"){let r=Bs(e.height);return Du(e.node,e.key??`${n}-${t}`,{width:"100%",minWidth:0,...e.minHeightPx!==void 0?{minHeight:`${e.minHeightPx}px`}:null,...r!==void 0?{height:r,flex:`0 0 ${r}`}:{height:"auto",flex:"0 0 auto"}},"w-full min-w-0")}if(n==="left"||n==="right"){let r=Bs(e.width);return Du(e.node,e.key??`${n}-${t}`,{height:"100%",minWidth:0,minHeight:0,...e.minWidthPx!==void 0?{minWidth:`${e.minWidthPx}px`}:null,...r!==void 0?{width:r,flex:`0 0 ${r}`}:{width:"auto",flex:"0 0 auto"}},"h-full min-h-0 min-w-0")}return Du(e.node,e.key??`client-${t}`,{width:"100%",height:"100%",minWidth:0,minHeight:0,flex:"1 1 0%"},"h-full w-full min-h-0 min-w-0")}function Sl(e){let{children:t,align:n,contentDirection:r,contentGap:o,contentJustify:s,contentAlign:i,contentWrap:c,contentClassName:d,contentStyle:u}=e,m=r??rx(n),g=o??ax(),h=s??"start",b=i??ox(n),S=c??!1,R=Qr(g),C=[],N=[];aa.Children.forEach(t,(F,v)=>{if(sx(F)){C.push({key:F.key??`dock-${v}`,node:F,align:F.props.align??"client",width:F.props.width,height:F.props.height,minWidthPx:F.props.minWidthPx,minHeightPx:F.props.minHeightPx});return}N.push(F)});let B=C.filter(F=>F.align==="top"),P=C.filter(F=>F.align==="bottom"),w=C.filter(F=>F.align==="left"),x=C.filter(F=>F.align==="right"),I=C.filter(F=>F.align==="client");return C.length>0?(0,Bo.jsxs)("div",{className:"flex flex-1 min-h-0 min-w-0 flex-col",style:R?{gap:R}:void 0,children:[B.map((F,v)=>Ls(F,v,"top")),(0,Bo.jsxs)("div",{className:"flex flex-1 min-h-0 min-w-0",style:R?{gap:R}:void 0,children:[w.map((F,v)=>Ls(F,v,"left")),(0,Bo.jsxs)("div",{className:"flex flex-1 min-h-0 min-w-0",style:R?{gap:R}:void 0,children:[I.map((F,v)=>Ls(F,v,"client")),N.length>0?(0,Bo.jsx)("div",{className:oa("flex flex-1 min-h-0 min-w-0",m==="row"?"flex-row":"flex-col",Lp(h),Bp(b),S?"flex-wrap":"",d),style:{gap:Qr(g),...u},children:N}):null]}),x.map((F,v)=>Ls(F,v,"right"))]}),P.map((F,v)=>Ls(F,v,"bottom"))]}):(0,Bo.jsx)("div",{className:oa("flex flex-1 min-h-0 min-w-0",m==="row"?"flex-row":"flex-col",Lp(h),Bp(b),S?"flex-wrap":"",d),style:{gap:Qr(g),...u},children:t})}var Au=require("react/jsx-runtime");function Fs(e){let{fullscreen:t=!0,width:n,height:r,padding:o,className:s,style:i,children:c,...d}=e;return(0,Au.jsx)("div",{className:oa("relative box-border flex flex-1 self-stretch min-h-0 min-w-0 max-h-full max-w-full overflow-hidden",s),style:{...i,...n!==void 0?{width:Qr(n)}:t?{width:"100%"}:null,...r!==void 0?{height:Qr(r)}:t?{height:"100dvh"}:null,padding:Qr(o)},...d,children:(0,Au.jsx)("div",{className:"flex flex-1 min-h-0 min-w-0 flex-col",children:Sl({children:c,align:"client"})})})}Fs.displayName="SgScreen";var Fp=require("react/jsx-runtime");function ix(e){return e?e===!0||e==="auto"?"overflow-auto":e==="y"?"overflow-y-auto overflow-x-hidden":"overflow-x-auto overflow-y-hidden":"overflow-hidden"}function Lu(e){let{align:t="client",width:n,height:r,minWidthPx:o,minHeightPx:s,borderStyle:i="dashed",padding:c,contentPadding:d,scrollable:u=!1,scrollbarGutter:m=!1,contentDirection:g,contentGap:h,contentJustify:b,contentAlign:S,contentWrap:R,contentClassName:C,contentStyle:N,className:B,style:P,children:w,...x}=e,I=i==="none"?"border border-transparent":i==="solid"?"border border-solid border-border":"border border-dashed border-border",D=Bs(n),F=Bs(r),v=Sl({children:w,align:t,contentDirection:g,contentGap:h,contentJustify:b,contentAlign:S,contentWrap:R,contentClassName:C,contentStyle:N});return(0,Fp.jsx)("div",{className:oa("flex box-border min-h-0 min-w-0 max-w-full flex-col bg-background",I,ix(u),B),style:{...P,...D!==void 0?{width:D}:null,...F!==void 0?{height:F}:null,...o!==void 0?{minWidth:`${o}px`}:null,...s!==void 0?{minHeight:`${s}px`}:null,margin:Qr(c),padding:Qr(d),...m?{scrollbarGutter:"stable"}:null},...x,children:v})}Lu.displayName="SgPanel";var eo=je(require("react"),1),Fo=require("react/jsx-runtime");function lx(...e){return e.filter(Boolean).join(" ")}function Cl(e){if(e!=null)return typeof e=="number"?`${e}px`:e}var Op={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};function cx(e){return e?typeof e=="number"?{base:e}:{base:e.base??1,...e}:{base:1}}function ux(e){return e?{start:"start",center:"center",end:"end",stretch:"stretch",between:"space-between",around:"space-around",evenly:"space-evenly"}[e]:void 0}function dx(e){return e?{start:"start",center:"center",end:"end",stretch:"stretch"}[e]:void 0}function Bu(e){let{columns:t,minItemWidth:n,gap:r=0,padding:o,dense:s=!1,rowHeight:i,justify:c,align:d,className:u,style:m,children:g,...h}=e,b=eo.useId().replace(/:/g,""),S=cx(t),R=eo.useMemo(()=>{if(n)return"";let B=[];return B.push(`[data-sg-grid="${b}"]{--sg-grid-cols:${S.base};}`),Object.keys(Op).forEach(P=>{let w=S[P];!w||w<1||B.push(`@media (min-width:${Op[P]}px){[data-sg-grid="${b}"]{--sg-grid-cols:${w};}}`)}),B.join(`
97
+ `,children:[(0,Vt.jsx)("input",{type:"checkbox",...H,value:K.value,checked:$e,disabled:Ae||g,onChange:Qe=>{H.onChange(Qe),q(K.value)},className:"w-4 h-4 rounded text-[rgb(var(--sg-primary-500))] border-[rgb(var(--sg-border))] focus:ring-[rgb(var(--sg-ring))] focus:ring-2 cursor-pointer disabled:cursor-not-allowed"}),K.icon&&(0,Vt.jsx)("span",{className:"flex items-center justify-center",children:K.icon}),!u&&(0,Vt.jsx)("span",{className:"text-sm text-[rgb(var(--sg-text))]",children:K.label})]},`${K.value}-${se}`)})})]}),x&&(0,Vt.jsx)("div",{className:"mt-1 text-sm text-red-500",children:x})]})}return(0,Vt.jsxs)("div",{className:I,style:D,children:[(0,Vt.jsx)(sr,{...v,title:G||" ",className:v.className||"",children:me}),x&&(0,Vt.jsx)("div",{className:"mt-1 text-sm text-red-500",children:x})]})}var Vg=La.default.forwardRef((e,t)=>zg(e,t));var vn=je(require("react"),1);var Hg=je(require("react"),1),gr=require("react/jsx-runtime");function Xr(...e){return e.filter(Boolean).join(" ")}var Ry={primary:{bg:"var(--sg-btn-primary-bg, hsl(var(--primary)))",fg:"var(--sg-btn-primary-fg, hsl(var(--primary-foreground)))",border:"var(--sg-btn-primary-border, hsl(var(--primary)))",hoverBg:"var(--sg-btn-primary-hover-bg, hsl(var(--primary)))",ring:"var(--sg-btn-primary-ring, hsl(var(--primary)/0.35))"},secondary:{bg:"var(--sg-btn-secondary-bg, hsl(var(--secondary)))",fg:"var(--sg-btn-secondary-fg, hsl(var(--secondary-foreground)))",border:"var(--sg-btn-secondary-border, hsl(var(--secondary)))",hoverBg:"var(--sg-btn-secondary-hover-bg, hsl(var(--secondary)))",ring:"var(--sg-btn-secondary-ring, hsl(var(--secondary)/0.35))"},success:{bg:"var(--sg-btn-success-bg, hsl(var(--tertiary, var(--accent))))",fg:"var(--sg-btn-success-fg, hsl(var(--tertiary-foreground, var(--accent-foreground, 0 0% 100%))))",border:"var(--sg-btn-success-border, hsl(var(--tertiary, var(--accent))))",hoverBg:"var(--sg-btn-success-hover-bg, hsl(var(--tertiary, var(--accent))))",ring:"var(--sg-btn-success-ring, hsl(var(--tertiary, var(--accent))/0.35))"},info:{bg:"var(--sg-btn-info-bg, hsl(var(--secondary, var(--primary))))",fg:"var(--sg-btn-info-fg, hsl(var(--secondary-foreground, var(--primary-foreground))))",border:"var(--sg-btn-info-border, hsl(var(--secondary, var(--primary))))",hoverBg:"var(--sg-btn-info-hover-bg, hsl(var(--secondary, var(--primary))))",ring:"var(--sg-btn-info-ring, hsl(var(--secondary, var(--primary))/0.35))"},warning:{bg:"var(--sg-btn-warning-bg, hsl(var(--secondary, var(--accent))))",fg:"var(--sg-btn-warning-fg, hsl(var(--secondary-foreground, var(--accent-foreground, 0 0% 100%))))",border:"var(--sg-btn-warning-border, hsl(var(--secondary, var(--accent))))",hoverBg:"var(--sg-btn-warning-hover-bg, hsl(var(--secondary, var(--accent))))",ring:"var(--sg-btn-warning-ring, hsl(var(--secondary, var(--accent))/0.35))"},help:{bg:"var(--sg-btn-help-bg, hsl(var(--secondary, var(--primary))))",fg:"var(--sg-btn-help-fg, hsl(var(--secondary-foreground, var(--primary-foreground))))",border:"var(--sg-btn-help-border, hsl(var(--secondary, var(--primary))))",hoverBg:"var(--sg-btn-help-hover-bg, hsl(var(--secondary, var(--primary))))",ring:"var(--sg-btn-help-ring, hsl(var(--secondary, var(--primary))/0.35))"},danger:{bg:"var(--sg-btn-danger-bg, hsl(var(--destructive)))",fg:"var(--sg-btn-danger-fg, hsl(var(--destructive-foreground)))",border:"var(--sg-btn-danger-border, hsl(var(--destructive)))",hoverBg:"var(--sg-btn-danger-hover-bg, hsl(var(--destructive)))",ring:"var(--sg-btn-danger-ring, hsl(var(--destructive)/0.35))"}},ky={sm:{h:"h-8",minH:"min-h-8",py:"py-1.5",px:"px-3",text:"text-sm",gap:"gap-2",icon:"size-4",radius:"rounded-md"},md:{h:"h-10",minH:"min-h-10",py:"py-2",px:"px-4",text:"text-sm",gap:"gap-2",icon:"size-4",radius:"rounded-lg"},lg:{h:"h-12",minH:"min-h-12",py:"py-2.5",px:"px-5",text:"text-base",gap:"gap-2.5",icon:"size-5",radius:"rounded-xl"}};function Py(e,t){let n=Ry[e];return{bg:t?.bg??n.bg,fg:t?.fg??n.fg,border:t?.border??n.border,hoverBg:t?.hoverBg??n.hoverBg,hoverFg:t?.hoverFg??t?.fg??n.fg,hoverBorder:t?.hoverBorder??t?.border??n.border,activeBg:t?.activeBg??t?.hoverBg??n.hoverBg,ring:t?.ring??n.ring}}function Ty(e,t){let n=Py(e,t),r=e==="danger"?"error":e==="help"?"tertiary":e;return{"--sg-btn-bg":n.bg,"--sg-btn-fg":n.fg,"--sg-btn-border":n.border,"--sg-btn-hover-bg":n.hoverBg,"--sg-btn-hover-fg":n.hoverFg,"--sg-btn-hover-border":n.hoverBorder,"--sg-btn-active-bg":n.activeBg,"--sg-btn-ring":n.ring,"--sg-btn-tint":`var(--sg-${r}-600)`}}function Ny(e){switch(e){case"solid":return Xr("bg-[var(--sg-btn-bg)] text-[var(--sg-btn-fg)] border border-[var(--sg-btn-border)]","hover:bg-[var(--sg-btn-hover-bg)] hover:text-[var(--sg-btn-hover-fg)] hover:border-[var(--sg-btn-hover-border)]","active:bg-[var(--sg-btn-active-bg)]");case"outline":return Xr("bg-transparent text-[var(--sg-btn-bg)] border border-[var(--sg-btn-border)]","hover:bg-[rgb(var(--sg-btn-tint)/0.12)]","active:bg-[rgb(var(--sg-btn-tint)/0.18)]");case"ghost":return Xr("bg-transparent text-[var(--sg-btn-bg)] border border-transparent","hover:bg-[rgb(var(--sg-btn-tint)/0.10)]","active:bg-[rgb(var(--sg-btn-tint)/0.16)]")}}function My(e){switch(e){case"sm":return"shadow-sm hover:shadow-md active:shadow-sm";case"md":return"shadow-md hover:shadow-lg active:shadow-md";default:return""}}var Tt=Hg.forwardRef(({severity:e="primary",appearance:t="solid",size:n,shape:r,elevation:o="none",label:s,iconOnly:i,leftIcon:c,rightIcon:d,loading:u=!1,disabled:m,className:g,children:h,style:b,customColors:S,type:R="button",...C},N)=>{let B=h??s,P=!!(m||u),x=i??(!B&&(c||d)),I=n??(x?"sm":"md"),D=r??(x?"circle":"default"),F=ky[I],v=Xr("inline-flex min-w-0 items-center justify-center",x?void 0:"w-full",F.gap);return(0,gr.jsx)("button",{ref:N,type:R,disabled:P,style:{...Ty(e,S),...b},className:Xr("inline-flex min-w-0 max-w-full items-center justify-center select-none whitespace-normal break-words text-center","font-medium","transition-[background-color,color,border-color,box-shadow,transform] duration-150","focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-[var(--sg-btn-ring)]","disabled:opacity-60 disabled:cursor-not-allowed",x?Xr("aspect-square",F.h):Xr(F.minH,F.py,F.px),F.text,D==="rounded"||D==="circle"?"rounded-full":D==="square"?"rounded-none":F.radius,Ny(t),My(o),P?!1:"active:translate-y-[0.5px]",g),...C,children:u?(0,gr.jsxs)("span",{className:v,children:[(0,gr.jsx)(Iy,{className:F.icon}),B?(0,gr.jsx)("span",{className:"min-w-0 whitespace-normal break-words",children:B}):null]}):(0,gr.jsxs)("span",{className:v,children:[c?(0,gr.jsx)("span",{className:Xr("shrink-0",F.icon),children:c}):null,B?(0,gr.jsx)("span",{className:"min-w-0 whitespace-normal break-words",children:B}):null,d?(0,gr.jsx)("span",{className:Xr("shrink-0",F.icon),children:d}):null]})})});Tt.displayName="SgButton";function Iy({className:e}){return(0,gr.jsxs)("svg",{className:Xr("animate-spin",e),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,gr.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"3"}),(0,gr.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}var ln=require("react/jsx-runtime");function Ui(...e){return e.filter(Boolean).join(" ")}function ji(e){return Array.from(new Set(e))}function Ey(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function ru(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Dy(e,t){let n=new Set(t);return new Set(e.filter(r=>n.has(r.value)&&!r.disabled).map(r=>r.value))}function $g(e,t){if(e.length<2||t.size===0)return e;let n=e.filter(s=>t.has(s.value));if(n.length===0)return e;let r=e.filter(s=>!t.has(s.value)),o=[...n,...r];return ru(e,o)?e:o}function _g(e,t){if(e.length<2||t.size===0)return e;let n=e.filter(s=>t.has(s.value));if(n.length===0)return e;let o=[...e.filter(s=>!t.has(s.value)),...n];return ru(e,o)?e:o}function Wg(e,t){if(e.length<2||t.size===0)return e;let n=[...e],r=!1;for(let o=1;o<n.length;o+=1){let s=n[o],i=n[o-1];!t.has(s.value)||t.has(i.value)||(n[o]=i,n[o-1]=s,r=!0)}return r?n:e}function qg(e,t){if(e.length<2||t.size===0)return e;let n=[...e],r=!1;for(let o=n.length-2;o>=0;o-=1){let s=n[o],i=n[o+1];!t.has(s.value)||t.has(i.value)||(n[o]=i,n[o+1]=s,r=!0)}return r?n:e}function Ay(e,t,n){if(e.length<2||t<0||t>=e.length||n<0||n>e.length||t===n||t+1===n)return e;let r=[...e],[o]=r.splice(t,1);if(!o)return e;let s=t<n?n-1:n,i=Math.max(0,Math.min(s,r.length));return r.splice(i,0,o),ru(e,r)?e:r}function Gg(e,t){let n=Me(),{id:r,title:o,source:s,value:i,onChange:c,selectedValues:d,onSelectionChange:u,selectionMode:m="multiple",showControls:g=!0,controlsPosition:h="left",draggable:b=!0,disabled:S=!1,readOnly:R=!1,emptyMessage:C,itemTemplate:N,className:B="",style:P,listClassName:w="",itemClassName:x="",groupBoxProps:I={},error:D}=e,[F,v]=vn.default.useState(()=>i??s),[$,G]=vn.default.useState(()=>ji(d??[])),[j,_]=vn.default.useState(null),[V,U]=vn.default.useState(null),[A,q]=vn.default.useState(null),M=i!==void 0,T=d!==void 0;vn.default.useEffect(()=>{M||v(s)},[s,M]);let z=M?i:F,ee=T?d??[]:$,O=vn.default.useMemo(()=>{let Q=new Set(z.map(Pe=>Pe.value));return ji(ee.filter(Pe=>Q.has(Pe)))},[ee,z]),de=vn.default.useMemo(()=>new Set(O),[O]);vn.default.useEffect(()=>{T||G(Q=>{let Pe=new Set(z.map(ue=>ue.value)),at=ji(Q.filter(ue=>Pe.has(ue)));return Ey(Q,at)?Q:at})},[z,T]);let Re=!S&&!R,W=b&&Re,Y=vn.default.useMemo(()=>Dy(z,O),[z,O]),me=vn.default.useCallback(Q=>{M||v(Q),c?.(Q)},[M,c]),H=vn.default.useCallback(Q=>{let Pe=ji(Q);T||G(Pe),u?.(Pe)},[T,u]),K=vn.default.useCallback(Q=>{if(!Re||Y.size===0)return;let Pe=z;Q==="top"&&(Pe=$g(z,Y)),Q==="up"&&(Pe=Wg(z,Y)),Q==="down"&&(Pe=qg(z,Y)),Q==="bottom"&&(Pe=_g(z,Y)),Pe!==z&&me(Pe)},[Re,me,z,Y]);vn.default.useImperativeHandle(t,()=>({getItems:()=>z,setItems:Q=>me(Q),getSelection:()=>O,setSelection:Q=>H(Q),moveTop:()=>K("top"),moveUp:()=>K("up"),moveDown:()=>K("down"),moveBottom:()=>K("bottom"),clearSelection:()=>H([])}),[K,me,H,z,O]);let se=vn.default.useCallback((Q,Pe,at)=>{if(!Re||Pe.disabled)return;let ue=Pe.value;if(m==="single"){H([ue]),_(ue);return}if(Q.shiftKey&&j!==null){let ce=z.findIndex(be=>be.value===j);if(ce>=0){let be=Math.min(ce,at),qe=Math.max(ce,at),Ne=z.slice(be,qe+1).filter(le=>!le.disabled).map(le=>le.value);Q.metaKey||Q.ctrlKey?H([...O,...Ne]):H(Ne);return}}let J=de.has(ue)?O.filter(ce=>ce!==ue):[...O,ue];H(J),_(ue)},[j,Re,H,z,O,de,m]),$e=vn.default.useCallback(()=>{U(null),q(null)},[]),Ae=vn.default.useCallback((Q,Pe,at)=>{if(!W||Pe.disabled){Q.preventDefault();return}U(at),q(at),Q.dataTransfer.effectAllowed="move";try{Q.dataTransfer.setData("text/plain",String(Pe.value))}catch{}if(!de.has(Pe.value)){let ue=m==="single"?[Pe.value]:[Pe.value];H(ue),_(Pe.value)}},[W,H,de,m]),Qe=vn.default.useCallback((Q,Pe)=>{!W||V===null||(Q.preventDefault(),Q.dataTransfer.dropEffect="move",q(Pe))},[W,V]),ge=vn.default.useCallback((Q,Pe)=>{if(!W||V===null)return;Q.preventDefault();let at=Ay(z,V,Pe);at!==z&&me(at),$e()},[W,$e,me,z,V]),pe=vn.default.useCallback((Q,Pe,at)=>{if(Q.key===" "||Q.key==="Enter"){Q.preventDefault(),se(Q,Pe,at);return}if((Q.ctrlKey||Q.metaKey)&&Q.key==="ArrowUp"){Q.preventDefault(),K("up");return}if((Q.ctrlKey||Q.metaKey)&&Q.key==="ArrowDown"){Q.preventDefault(),K("down");return}if((Q.ctrlKey||Q.metaKey)&&Q.key==="Home"){Q.preventDefault(),K("top");return}(Q.ctrlKey||Q.metaKey)&&Q.key==="End"&&(Q.preventDefault(),K("bottom"))},[K,se]),fe=k(n,"components.orderlist.moveTop"),We=k(n,"components.orderlist.moveUp"),Be=k(n,"components.orderlist.moveDown"),Ee=k(n,"components.orderlist.moveBottom"),ke=C??k(n,"components.orderlist.empty"),ne=Re&&$g(z,Y)!==z,he=Re&&Wg(z,Y)!==z,Fe=Re&&qg(z,Y)!==z,ze=Re&&_g(z,Y)!==z,X=(0,ln.jsxs)("ul",{id:r,role:"listbox","aria-multiselectable":m==="multiple"?!0:void 0,"aria-disabled":S||void 0,"aria-readonly":R||void 0,className:Ui("w-full min-w-0 overflow-y-auto rounded-lg border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] p-1","max-h-[22rem]",w),children:[z.length===0?(0,ln.jsx)("li",{className:"list-none px-3 py-4 text-sm text-[rgb(var(--sg-muted))]",children:ke}):z.map((Q,Pe)=>{let at=de.has(Q.value),ue=S||!!Q.disabled,Z=A===Pe&&V!==null&&V!==Pe,J=V===Pe;return(0,ln.jsx)("li",{className:"list-none",children:(0,ln.jsxs)("button",{type:"button",role:"option","aria-selected":at,draggable:W&&!Q.disabled,disabled:ue,onClick:ce=>se(ce,Q,Pe),onKeyDown:ce=>pe(ce,Q,Pe),onDragStart:ce=>Ae(ce,Q,Pe),onDragOver:ce=>Qe(ce,Pe),onDrop:ce=>ge(ce,Pe),onDragEnd:$e,className:Ui("group flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-all",at?"bg-[rgb(var(--sg-primary-100))] text-[rgb(var(--sg-text))] ring-1 ring-[rgb(var(--sg-primary-300))]":"bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] text-[rgb(var(--sg-text))] hover:bg-[rgb(var(--sg-primary-50))]",ue?"cursor-not-allowed opacity-60":"cursor-pointer",W&&!Q.disabled?"active:cursor-grabbing":"",Z?"ring-2 ring-[rgb(var(--sg-primary-400))]":"",J?"opacity-50":"",x),children:[(0,ln.jsx)("span",{className:"min-w-0 flex-1",children:N?N(Q,{index:Pe,selected:at,disabled:ue}):(0,ln.jsxs)("span",{className:"flex items-center gap-2",children:[Q.icon?(0,ln.jsx)("span",{className:"shrink-0",children:Q.icon}):null,(0,ln.jsx)("span",{className:"truncate",children:Q.label})]})}),W&&!Q.disabled?(0,ln.jsx)("span",{"aria-hidden":"true",className:"shrink-0 text-xs tracking-wide text-[rgb(var(--sg-muted))]",children:"::"}):null]})},`${Q.value}-${Pe}`)}),W&&z.length>0?(0,ln.jsx)("li",{className:"list-none",children:(0,ln.jsx)("div",{onDragOver:Q=>Qe(Q,z.length),onDrop:Q=>ge(Q,z.length),className:Ui("mt-1 h-3 rounded-md border border-dashed border-transparent transition-colors",A===z.length?"border-[rgb(var(--sg-primary-400))] bg-[rgb(var(--sg-primary-100))]":"")})}):null]}),ae=g?(0,ln.jsxs)("div",{className:"flex shrink-0 flex-col gap-2",children:[(0,ln.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!ne,title:fe,"aria-label":fe,onClick:()=>K("top"),children:"Top"}),(0,ln.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!he,title:We,"aria-label":We,onClick:()=>K("up"),children:"Up"}),(0,ln.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,title:Be,"aria-label":Be,onClick:()=>K("down"),children:"Down"}),(0,ln.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!ze,title:Ee,"aria-label":Ee,onClick:()=>K("bottom"),children:"Bottom"})]}):null,ie=h==="right"?"flex-row-reverse":"flex-row",ve=(I.title??o??"").trim()||" ";return(0,ln.jsx)("div",{className:B,style:P,children:(0,ln.jsxs)(sr,{...I,title:ve,children:[D?(0,ln.jsx)("p",{className:"mb-2 text-xs text-red-600",children:D}):null,(0,ln.jsxs)("div",{className:Ui("flex items-start gap-3",ie),children:[ae,(0,ln.jsx)("div",{className:"min-w-0 flex-1",children:X})]})]})})}var Ug=vn.default.forwardRef((e,t)=>{let{control:n,name:r,rules:o,...s}=e;return n&&r?(0,ln.jsx)(zt,{name:r,control:n,rules:o,render:({field:i,fieldState:c})=>Gg({...s,error:ht(s.error,c.error?.message),value:Array.isArray(i.value)?i.value:s.value,onChange:d=>{s.onChange?.(d),i.onChange(d)}},t)}):Gg(s,t)});var Ln=je(require("react"),1);var Rt=require("react/jsx-runtime");function jg(...e){return e.filter(Boolean).join(" ")}function Ba(e){return Array.from(new Set(e))}function Ly(e,t,n){if(e.length<2||t<0||t>=e.length||n<0||n>e.length||t===n||t+1===n)return e;let r=[...e],[o]=r.splice(t,1);if(o===void 0)return e;let s=t<n?n-1:n,i=Math.max(0,Math.min(s,r.length));return r.splice(i,0,o),r}function By(e,t){let n=e.filter(o=>t.has(o.value)&&!o.disabled);if(n.length===0)return e;let r=e.filter(o=>!(t.has(o.value)&&!o.disabled));return[...n,...r]}function Fy(e,t){let n=e.filter(o=>t.has(o.value)&&!o.disabled);return n.length===0?e:[...e.filter(o=>!(t.has(o.value)&&!o.disabled)),...n]}function Oy(e,t){let n=[...e];for(let r=1;r<n.length;r+=1){let o=n[r],s=n[r-1];t.has(o.value)&&!o.disabled&&(t.has(s.value)&&!s.disabled||(n[r]=s,n[r-1]=o))}return n}function zy(e,t){let n=[...e];for(let r=n.length-2;r>=0;r-=1){let o=n[r],s=n[r+1];t.has(o.value)&&!o.disabled&&(t.has(s.value)&&!s.disabled||(n[r]=s,n[r+1]=o))}return n}function Yg(e,t,n){let r=e.toLowerCase(),o=t.toLowerCase();return n==="startsWith"?r.startsWith(o):n==="endsWith"?r.endsWith(o):r.includes(o)}function Kg(e,t){let n=Me(),{id:r,title:o,source:s,target:i,value:c,onChange:d,sourceSelection:u,targetSelection:m,onSourceSelectionChange:g,onTargetSelectionChange:h,selectionMode:b="multiple",sourceHeader:S,targetHeader:R,showTransferControls:C=!0,showSourceControls:N=!0,showTargetControls:B=!0,showSourceFilter:P=!1,showTargetFilter:w=!1,sourceFilterPlaceholder:x,targetFilterPlaceholder:I,filterMatchMode:D="contains",draggable:F=!0,disabled:v=!1,readOnly:$=!1,emptyMessage:G,itemTemplate:j,className:_="",style:V,listClassName:U="",itemClassName:A="",groupBoxProps:q={},error:M}=e,[T,z]=Ln.default.useState(()=>({source:s,target:i})),[ee,O]=Ln.default.useState(()=>Ba(u??[])),[de,Re]=Ln.default.useState(()=>Ba(m??[])),[W,Y]=Ln.default.useState(""),[me,H]=Ln.default.useState(""),[K,se]=Ln.default.useState(null),$e=c!==void 0,Ae=u!==void 0,Qe=m!==void 0;Ln.default.useEffect(()=>{$e||z({source:s,target:i})},[s,i,$e]);let ge=$e?c:T,pe=ge.source??[],fe=ge.target??[],We=Ae?u??[]:ee,Be=Qe?m??[]:de,Ee=Ba(We.filter(ye=>pe.some(Ze=>Ze.value===ye))),ke=Ba(Be.filter(ye=>fe.some(Ze=>Ze.value===ye))),ne=new Set(Ee),he=new Set(ke),Fe=!v&&!$,ze=Ln.default.useCallback((ye,Ze)=>{$e||z(ye),d?.({...ye,type:Ze})},[$e,d]),X=Ln.default.useCallback(ye=>{let Ze=Ba(ye);Ae||O(Ze),g?.(Ze)},[Ae,g]),ae=Ln.default.useCallback(ye=>{let Ze=Ba(ye);Qe||Re(Ze),h?.(Ze)},[Qe,h]),ie=Ln.default.useCallback(()=>{X([]),ae([])},[X,ae]),ve=Ln.default.useCallback(()=>{if(!Fe)return;let ye=pe.filter(et=>ne.has(et.value)&&!et.disabled);if(ye.length===0)return;let Ze=pe.filter(et=>!(ne.has(et.value)&&!et.disabled)),ot=[...fe,...ye];ze({source:Ze,target:ot},"moveToTarget"),X([]),ae(ye.map(et=>et.value))},[Fe,pe,ne,fe,ze,X,ae]),Q=Ln.default.useCallback(()=>{if(!Fe)return;let ye=pe.filter(et=>!et.disabled);if(ye.length===0)return;let Ze=pe.filter(et=>et.disabled),ot=[...fe,...ye];ze({source:Ze,target:ot},"moveAllToTarget"),X([]),ae(ye.map(et=>et.value))},[Fe,pe,fe,ze,X,ae]),Pe=Ln.default.useCallback(()=>{if(!Fe)return;let ye=fe.filter(et=>he.has(et.value)&&!et.disabled);if(ye.length===0)return;let Ze=fe.filter(et=>!(he.has(et.value)&&!et.disabled)),ot=[...pe,...ye];ze({source:ot,target:Ze},"moveToSource"),ae([]),X(ye.map(et=>et.value))},[Fe,fe,he,pe,ze,ae,X]),at=Ln.default.useCallback(()=>{if(!Fe)return;let ye=fe.filter(et=>!et.disabled);if(ye.length===0)return;let Ze=fe.filter(et=>et.disabled),ot=[...pe,...ye];ze({source:ot,target:Ze},"moveAllToSource"),ae([]),X(ye.map(et=>et.value))},[Fe,fe,pe,ze,ae,X]),ue=Ln.default.useCallback((ye,Ze)=>{if(!Fe)return;if(ye==="source"){let Ht=pe[Ze];if(!Ht||Ht.disabled)return;let Pt=pe.filter((It,fn)=>fn!==Ze),Mt=[...fe,Ht];ze({source:Pt,target:Mt},"moveToTarget"),X(Ee.filter(It=>It!==Ht.value)),ae([Ht.value]);return}let ot=fe[Ze];if(!ot||ot.disabled)return;let et=fe.filter((Ht,Pt)=>Pt!==Ze),mt=[...pe,ot];ze({source:mt,target:et},"moveToSource"),ae(ke.filter(Ht=>Ht!==ot.value)),X([ot.value])},[Fe,pe,fe,Ee,ke,ze,X,ae]);Ln.default.useImperativeHandle(t,()=>({getValue:()=>({source:pe,target:fe}),setValue:ye=>ze(ye,"dragdrop"),moveToTarget:ve,moveAllToTarget:Q,moveToSource:Pe,moveAllToSource:at,clearSelection:ie}),[pe,fe,ze,ve,Q,Pe,at,ie]);let Z=(ye,Ze)=>{if(!Fe)return;let ot=ye==="source"?pe:fe,et=ye==="source"?ne:he;if(et.size===0)return;let mt=ot;Ze==="top"&&(mt=By(ot,et)),Ze==="up"&&(mt=Oy(ot,et)),Ze==="down"&&(mt=zy(ot,et)),Ze==="bottom"&&(mt=Fy(ot,et)),ye==="source"&&ze({source:mt,target:fe},"reorderSource"),ye==="target"&&ze({source:pe,target:mt},"reorderTarget")},J=(ye,Ze)=>{if(!Fe||Ze.disabled)return;let ot=ye==="source"?ne:he,et=ye==="source"?X:ae,mt=ye==="source"?Ee:ke;if(b==="single"){et([Ze.value]);return}ot.has(Ze.value)?et(mt.filter(Ht=>Ht!==Ze.value)):et([...mt,Ze.value])},ce=Fe&&F,be=(ye,Ze)=>{if(!ce||!K)return;if(K.from===ye){let fn=Ly(ye==="source"?pe:fe,K.fromIndex,Ze);ye==="source"&&ze({source:fn,target:fe},"reorderSource"),ye==="target"&&ze({source:pe,target:fn},"reorderTarget"),se(null);return}let ot=K.from==="source"?pe:fe,et=ye==="source"?pe:fe,mt=ot[K.fromIndex];if(!mt||mt.disabled){se(null);return}let Ht=ot.filter((It,fn)=>fn!==K.fromIndex),Pt=[...et],Mt=Math.max(0,Math.min(Ze,Pt.length));Pt.splice(Mt,0,mt),K.from==="source"&&ye==="target"?(ze({source:Ht,target:Pt},"dragdrop"),X(Ee.filter(It=>It!==mt.value))):(ze({source:Pt,target:Ht},"dragdrop"),ae(ke.filter(It=>It!==mt.value))),se(null)},qe=k(n,"components.orderlist.moveTop"),Ne=k(n,"components.orderlist.moveUp"),le=k(n,"components.orderlist.moveDown"),Ye=k(n,"components.orderlist.moveBottom"),_e=k(n,"components.picklist.moveToTarget"),we=k(n,"components.picklist.moveAllToTarget"),xe=k(n,"components.picklist.moveToSource"),Ce=k(n,"components.picklist.moveAllToSource"),Te=S??k(n,"components.picklist.sourceHeader"),De=R??k(n,"components.picklist.targetHeader"),Ve=x??k(n,"components.picklist.sourceFilterPlaceholder"),Le=I??k(n,"components.picklist.targetFilterPlaceholder"),Je=G??k(n,"components.picklist.empty"),ct=pe.map((ye,Ze)=>({item:ye,index:Ze})).filter(({item:ye})=>!W||Yg(ye.label,W,D)),it=fe.map((ye,Ze)=>({item:ye,index:Ze})).filter(({item:ye})=>!me||Yg(ye.label,me,D)),At=(ye,Ze,ot)=>(0,Rt.jsx)("ul",{id:r?`${r}-${ye}`:void 0,role:"listbox","aria-multiselectable":b==="multiple"||void 0,className:jg("max-h-[22rem] min-w-0 w-full overflow-y-auto rounded-lg border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] p-1",U),onDragOver:et=>{ce&&et.preventDefault()},onDrop:et=>{ce&&(et.preventDefault(),be(ye,ye==="source"?pe.length:fe.length))},children:Ze.length===0?(0,Rt.jsx)("li",{className:"list-none px-3 py-4 text-sm text-[rgb(var(--sg-muted))]",children:Je}):Ze.map(({item:et,index:mt})=>{let Ht=ot.has(et.value),Pt=v||!!et.disabled;return(0,Rt.jsx)("li",{className:"list-none",children:(0,Rt.jsxs)("button",{type:"button",role:"option","aria-selected":Ht,disabled:Pt,draggable:ce&&!et.disabled,onClick:Mt=>{if(Mt.detail>=2){ue(ye,mt);return}J(ye,et)},onDragStart:Mt=>{se({from:ye,fromIndex:mt}),Mt.dataTransfer.effectAllowed="move";try{Mt.dataTransfer.setData("text/plain",String(et.value))}catch{}},onDragOver:Mt=>{ce&&Mt.preventDefault()},onDrop:Mt=>{ce&&(Mt.preventDefault(),Mt.stopPropagation(),be(ye,mt))},onDragEnd:()=>se(null),className:jg("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm",Ht?"bg-[rgb(var(--sg-primary-100))] ring-1 ring-[rgb(var(--sg-primary-300))]":"bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] hover:bg-[rgb(var(--sg-primary-50))]",Pt?"cursor-not-allowed opacity-60":"cursor-pointer",A),children:[(0,Rt.jsx)("span",{className:"min-w-0 flex-1 truncate",children:j?j(et,{index:mt,selected:Ht,disabled:Pt,list:ye}):(0,Rt.jsxs)("span",{className:"flex items-center gap-2",children:[et.icon?(0,Rt.jsx)("span",{className:"shrink-0",children:et.icon}):null,(0,Rt.jsx)("span",{className:"truncate",children:et.label})]})}),ce&&!et.disabled?(0,Rt.jsx)("span",{"aria-hidden":"true",className:"shrink-0 text-xs text-[rgb(var(--sg-muted))]",children:"::"}):null]})},`${et.value}-${mt}`)})}),ft=ye=>(0,Rt.jsxs)("div",{className:"flex shrink-0 flex-col gap-2",children:[(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":qe,title:qe,onClick:()=>Z(ye,"top"),children:k(n,"components.actions.top")}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":Ne,title:Ne,onClick:()=>Z(ye,"up"),children:k(n,"components.actions.up")}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":le,title:le,onClick:()=>Z(ye,"down"),children:k(n,"components.actions.down")}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":Ye,title:Ye,onClick:()=>Z(ye,"bottom"),children:k(n,"components.actions.bottom")})]}),gt=C?(0,Rt.jsxs)("div",{className:"flex shrink-0 flex-row gap-2 md:flex-col",children:[(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":_e,title:_e,onClick:ve,children:">"}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":we,title:we,onClick:Q,children:">>"}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":xe,title:xe,onClick:Pe,children:"<"}),(0,Rt.jsx)(Tt,{size:"sm",appearance:"outline",disabled:!Fe,"aria-label":Ce,title:Ce,onClick:at,children:"<<"})]}):null,an=(q.title??o??"").trim()||" ";return(0,Rt.jsx)("div",{className:_,style:V,children:(0,Rt.jsxs)(sr,{...q,title:an,children:[M?(0,Rt.jsx)("p",{className:"mb-2 text-xs text-red-600",children:M}):null,(0,Rt.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] md:items-start",children:[(0,Rt.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,Rt.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-[rgb(var(--sg-muted))]",children:Te}),P?(0,Rt.jsx)("input",{value:W,onChange:ye=>Y(ye.target.value),placeholder:Ve,className:"w-full rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-sm text-[rgb(var(--sg-input-fg,var(--sg-text)))] placeholder:text-[rgb(var(--sg-input-placeholder,var(--sg-muted)))] outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]"}):null,(0,Rt.jsxs)("div",{className:"flex items-start gap-2",children:[N?ft("source"):null,(0,Rt.jsx)("div",{className:"min-w-0 flex-1",children:At("source",ct,ne)})]})]}),(0,Rt.jsx)("div",{className:"flex justify-center md:pt-7",children:gt}),(0,Rt.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,Rt.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-[rgb(var(--sg-muted))]",children:De}),w?(0,Rt.jsx)("input",{value:me,onChange:ye=>H(ye.target.value),placeholder:Le,className:"w-full rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-sm text-[rgb(var(--sg-input-fg,var(--sg-text)))] placeholder:text-[rgb(var(--sg-input-placeholder,var(--sg-muted)))] outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]"}):null,(0,Rt.jsxs)("div",{className:"flex items-start gap-2",children:[(0,Rt.jsx)("div",{className:"min-w-0 flex-1",children:At("target",it,he)}),B?ft("target"):null]})]})]})]})})}var Zg=Ln.default.forwardRef((e,t)=>{let{control:n,name:r,rules:o,...s}=e;return n&&r?(0,Rt.jsx)(zt,{name:r,control:n,rules:o,render:({field:i,fieldState:c})=>Kg({...s,error:ht(s.error,c.error?.message),value:i.value??s.value,onChange:d=>{s.onChange?.(d),i.onChange({source:d.source,target:d.target})}},t)}):Kg(s,t)});var lt=je(require("react"),1),Jg=require("react-dom"),Zo=require("lucide-react");var st=require("react/jsx-runtime");function zr(...e){return e.filter(Boolean).join(" ")}function Ko(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Yi(e){return e?Object.entries(e).reduce((t,[n,r])=>{let o=String(r??"").trim();return o&&(t[n]=o),t},{}):{}}function Fa(e,t){if(!t)return;if(!t.includes("."))return e[t];let n=t.split("."),r=e;for(let o of n){if(r==null||typeof r!="object")return;r=r[o]}return r}function Vy(e){return e==null?"":typeof e=="string"?e.toLowerCase():typeof e=="number"||typeof e=="bigint"?String(e):typeof e=="boolean"?e?"true":"false":e instanceof Date?e.toISOString().toLowerCase():String(e).toLowerCase()}function Xg(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let o=Vy(e);return n==="startsWith"?o.startsWith(r):n==="endsWith"?o.endsWith(r):n==="equals"?o===r:o.includes(r)}function Hy(e,t){return e===t?0:e==null?-1:t==null?1:typeof e=="number"&&typeof t=="number"?e-t:e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t),void 0,{sensitivity:"base",numeric:!0})}function Ki(e,t,n){return e===t?n:e}function $y(e,t,n=5){if(t<=0)return[];if(t<=n)return Array.from({length:t},(c,d)=>d+1);let r=Math.floor(n/2),o=Math.max(1,e-r),s=o+n-1;s>t&&(s=t,o=s-n+1);let i=[];for(let c=o;c<=s;c+=1)i.push(c);return i}function ou(e,t){return t?Fa(e,t):e}function Ss(e,t,n){return n?ou(e,n)===ou(t,n):e===t}function _y(e,t){return e.columnId?.trim()?`columnId:${e.columnId.trim()}`:e.field?.trim()?`field:${e.field.trim()}`:`index:${t}`}function Wy(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return e;let r=[...e],o=r[t];return o===void 0?e:(r.splice(t,1),r.splice(n,0,o),r)}function Zi(e){return e==="center"?"text-center":e==="right"?"text-right":"text-left"}function qy(e,t){let n=Me(),{id:r,title:o,value:s,columns:i,dataKey:c,lazy:d=!1,totalRecords:u,paginator:m=!1,rows:g=10,first:h,rowsPerPageOptions:b,onPage:S,sortField:R,sortOrder:C,onSort:N,removableSort:B=!0,selectionMode:P,selection:w,onSelectionChange:x,showGlobalFilter:I=!1,globalFilter:D,globalFilterPlaceholder:F,onGlobalFilterChange:v,showColumnFilters:$=!1,filters:G,onFilter:j,showClearFiltersButton:_=!1,stripedRows:V=!1,showGridlines:U=!1,hoverableRows:A=!0,loading:q=!1,emptyMessage:M,className:T="",style:z,tableClassName:ee="",rowClassName:O,groupBoxProps:de={},showColumnManager:Re=!0,columnManagerLabel:W,columnManagerMaxHeight:Y=320}=e,me=h!==void 0,H=R!==void 0,K=C!==void 0,se=w!==void 0,$e=D!==void 0,Ae=G!==void 0,[Qe,ge]=lt.default.useState(Math.max(0,h??0)),[pe,fe]=lt.default.useState(Math.max(1,g)),[We,Be]=lt.default.useState(R??null),[Ee,ke]=lt.default.useState(C??0),[ne,he]=lt.default.useState(null),[Fe,ze]=lt.default.useState(D??""),[X,ae]=lt.default.useState(()=>Yi(G)),ie=lt.default.useRef(null),ve=lt.default.useRef(null),Q=lt.default.useRef(null),[Pe,at]=lt.default.useState(!1),[ue,Z]=lt.default.useState(null),[J,ce]=lt.default.useState(null),be=lt.default.useMemo(()=>i.map((re,Ue)=>({key:_y(re,Ue),column:re,originalIndex:Ue})),[i]),[qe,Ne]=lt.default.useState(()=>be.map(re=>re.key)),[le,Ye]=lt.default.useState(()=>be.reduce((re,Ue)=>(re[Ue.key]=!!Ue.column.hidden,re),{}));lt.default.useEffect(()=>{me&&ge(Math.max(0,h??0))},[me,h]),lt.default.useEffect(()=>{fe(Math.max(1,g))},[g]),lt.default.useEffect(()=>{H&&Be(R??null)},[H,R]),lt.default.useEffect(()=>{K&&ke(C??0)},[K,C]),lt.default.useEffect(()=>{se&&he(w??null)},[se,w]),lt.default.useEffect(()=>{$e&&ze(D??"")},[$e,D]),lt.default.useEffect(()=>{Ae&&ae(Yi(G))},[Ae,G]),lt.default.useEffect(()=>{let re=be.map(Ue=>Ue.key);Ne(Ue=>{let nt=Ue.filter(pt=>re.includes(pt)),bt=re.filter(pt=>!nt.includes(pt));return[...nt,...bt]}),Ye(Ue=>{let nt={};for(let bt of be)nt[bt.key]=Ue[bt.key]??!!bt.column.hidden;return nt})},[be]),lt.default.useEffect(()=>{if(!Pe)return;let re=Ue=>{let nt=Ue.target;ie.current?.contains(nt)||Q.current?.contains(nt)||at(!1)};return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[Pe]);let _e=lt.default.useCallback(()=>{let re=ve.current;if(!re)return;let Ue=re.getBoundingClientRect(),nt=300,bt=12,pt=Math.min(Math.max(Ue.left,bt),Math.max(bt,window.innerWidth-nt-bt));ce({top:Ue.bottom+8,left:pt})},[]);lt.default.useLayoutEffect(()=>{if(!Pe)return;_e();let re=window.requestAnimationFrame(_e);return()=>window.cancelAnimationFrame(re)},[Pe,_e]),lt.default.useEffect(()=>{if(!Pe)return;let re=()=>_e(),Ue=!0;return window.addEventListener("resize",re),window.addEventListener("scroll",re,Ue),()=>{window.removeEventListener("resize",re),window.removeEventListener("scroll",re,Ue)}},[Pe,_e]);let we=lt.default.useMemo(()=>{let re=new Map(be.map(Ue=>[Ue.key,Ue]));return qe.map(Ue=>re.get(Ue)).filter(Ue=>!!Ue)},[be,qe]),xe=lt.default.useMemo(()=>we.filter(re=>!le[re.key]).map(re=>re.column),[we,le]),Ce=lt.default.useMemo(()=>we.filter(re=>!le[re.key]).length,[we,le]),Te=me?Math.max(0,h??0):Qe,De=Math.max(1,pe),Ve=H?R??null:We,Le=K?C??0:Ee,Je=se?w??null:ne,ct=$e?D??"":Fe,it=Ae?Yi(G):X,At=lt.default.useMemo(()=>xe.filter(re=>re.field&&!re.excludeGlobalFilter),[xe]),ft=lt.default.useMemo(()=>d?s:s.filter(re=>{if(!(ct.trim()?At.some(bt=>{let pt=bt.filterField??bt.field;return Xg(Fa(re,pt),ct,"contains")}):!0))return!1;let nt=Object.entries(it);if(nt.length===0)return!0;for(let[bt,pt]of nt){let Ut=xe.find(nr=>(nr.filterField??nr.field)===bt);if(!Ut)continue;let Hn=Ut.filterMatchMode??"contains",Tr=Fa(re,bt);if(!Xg(Tr,pt,Hn))return!1}return!0}),[d,s,ct,it,At,xe]),gt=lt.default.useMemo(()=>{if(d||!Ve||Le===0)return ft;let re=xe.find(nt=>(nt.sortField??nt.field)===Ve),Ue=Le===-1?-1:1;return[...ft].sort((nt,bt)=>{if(re?.sortFunction)return re.sortFunction(nt,bt)*Ue;let pt=re?.sortField??re?.field??Ve,Ut=Fa(nt,pt),Hn=Fa(bt,pt);return Hy(Ut,Hn)*Ue})},[d,Ve,Le,ft,xe]),an=d?Math.max(0,u??s.length):gt.length,ye=Math.max(1,Math.ceil(Math.max(an,1)/De)),Ze=Math.max(0,(ye-1)*De),ot=Math.min(Te,Ze),et=lt.default.useMemo(()=>!m||d?gt:gt.slice(ot,ot+De),[m,d,gt,ot,De]),mt=Math.floor(ot/De)+1,Ht=lt.default.useMemo(()=>$y(mt,ye,5),[mt,ye]),Pt=lt.default.useCallback((re,Ue)=>{let nt=Math.max(1,Ue),bt=Math.max(0,re);me||ge(bt),fe(nt);let pt=Math.max(1,Math.ceil(Math.max(an,1)/nt)),Ut=Math.floor(bt/nt)+1;S?.({first:bt,rows:nt,page:Ut,pageCount:pt,totalRecords:an})},[me,S,an]);lt.default.useEffect(()=>{ot!==Te&&Pt(ot,De)},[ot,Te,Pt,De]);let Mt=lt.default.useCallback((re,Ue)=>{H||Be(re),K||ke(Ue),N?.({sortField:re,sortOrder:Ue})},[H,K,N]),It=lt.default.useCallback(re=>{se||he(re),x?.(re)},[se,x]),fn=lt.default.useCallback((re,Ue)=>{Ae||ae(re),$e||ze(Ue),v?.(Ue),j?.({filters:re,globalFilter:Ue}),Pt(0,De)},[Ae,$e,v,j,Pt,De]),jr=lt.default.useCallback(()=>{fn({},"")},[fn]),wr=lt.default.useCallback(()=>{Mt(null,0)},[Mt]),Jn=lt.default.useCallback(()=>{if(P==="multiple"){It([]);return}It(null)},[P,It]),Gt=lt.default.useCallback(re=>{let Ue=Math.max(1,Math.min(re,ye));Pt((Ue-1)*De,De)},[Pt,De,ye]);lt.default.useImperativeHandle(t,()=>({getProcessedRows:()=>gt,getPagedRows:()=>et,clearFilters:jr,clearSelection:Jn,resetSort:wr,resetPage:()=>Pt(0,De),goToPage:Gt}),[gt,et,jr,Jn,wr,Pt,De,Gt]);let ao=M??k(n,"components.datatable.empty"),so=k(n,"components.datatable.loading"),Rr=F??k(n,"components.datatable.globalFilterPlaceholder"),Zs=k(n,"components.datatable.clearFilters"),_o=k(n,"components.datatable.prev"),Xs=k(n,"components.datatable.next"),ha=k(n,"components.datatable.rowsPerPage"),os=k(n,"components.datatable.pageReport",{first:an===0?0:ot+1,last:Math.min(ot+De,an),total:an}),Nn=I||_,Ro=$&&xe.some(re=>re.filter),kr=xe.some(re=>re.footer!==void 0),as=re=>{if(!re.sortable)return;let Ue=re.sortField??re.field;if(Ue){if(Ve!==Ue){Mt(Ue,1);return}if(Le===1){Mt(Ue,-1);return}if(Le===-1){B?Mt(null,0):Mt(Ue,1);return}Mt(Ue,1)}},io=lt.default.useCallback(re=>P?P==="single"?Je!==null&&!Array.isArray(Je)?Ss(Je,re,c):!1:(Array.isArray(Je)?Je:[]).some(nt=>Ss(nt,re,c)):!1,[P,Je,c]),Wo=lt.default.useCallback(re=>{if(!P)return;if(P==="single"){Je!==null&&!Array.isArray(Je)&&Ss(Je,re,c)?It(null):It(re);return}let Ue=Array.isArray(Je)?Je:[],bt=Ue.some(pt=>Ss(pt,re,c))?Ue.filter(pt=>!Ss(pt,re,c)):[...Ue,re];It(bt)},[P,Je,c,It]),Pr=W??Ki(k(n,"components.datatable.columns"),"components.datatable.columns","Colunas"),ko=Ki(k(n,"components.datatable.restoreColumns"),"components.datatable.restoreColumns","Restaurar padr\xE3o"),dr=Ki(k(n,"components.datatable.showAllColumns"),"components.datatable.showAllColumns","Mostrar todas"),qo=Ki(k(n,"components.datatable.dragToReorder"),"components.datatable.dragToReorder","Arrastar para reordenar"),lo=lt.default.useCallback((re,Ue)=>{Ye(nt=>{let bt=!!nt[re],pt=Ue===void 0?!bt:!Ue;return pt&&Ce<=1?nt:{...nt,[re]:pt}})},[Ce]),co=lt.default.useCallback((re,Ue)=>{Ne(nt=>{let bt=nt.indexOf(re),pt=nt.indexOf(Ue);return bt<0||pt<0?nt:Wy(nt,bt,pt)})},[]),mr=lt.default.useCallback(()=>{Ne(be.map(re=>re.key)),Ye(be.reduce((re,Ue)=>(re[Ue.key]=!!Ue.column.hidden,re),{}))},[be]),Go=lt.default.useCallback(()=>{Ye(re=>{let Ue={...re};for(let nt of be)Ue[nt.key]=!1;return Ue})},[be]),jn=(de.title??o??"").trim()||" ";return(0,st.jsx)("div",{className:T,style:z,children:(0,st.jsx)(sr,{...de,title:jn,children:(0,st.jsxs)("div",{className:"space-y-3",children:[Nn?(0,st.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[I?(0,st.jsx)("input",{value:ct,onChange:re=>fn(it,re.target.value),placeholder:Rr,className:"min-w-[220px] flex-1 rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-3 py-2 text-sm text-[rgb(var(--sg-input-fg,var(--sg-text)))] placeholder:text-[rgb(var(--sg-input-placeholder,var(--sg-muted)))] outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]"}):null,_?(0,st.jsx)(Tt,{size:"sm",appearance:"outline",onClick:jr,children:Zs}):null]}):null,(0,st.jsxs)("div",{className:"relative",ref:ie,children:[Re?(0,st.jsx)("div",{className:"mb-2 flex items-center justify-start",children:(0,st.jsx)("button",{ref:ve,type:"button","aria-label":Pr,title:Pr,onClick:()=>at(re=>!re),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] text-[rgb(var(--sg-primary-600))] shadow-sm transition hover:bg-[rgb(var(--sg-primary-50))] hover:text-[rgb(var(--sg-primary-700))]",children:(0,st.jsx)(Zo.SlidersHorizontal,{size:18})})}):null,Re&&Pe&&J&&typeof document<"u"?(0,Jg.createPortal)((0,st.jsxs)("div",{ref:Q,className:"fixed z-[1400] w-[300px] rounded-xl border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))] shadow-xl",style:{top:J.top,left:J.left},children:[(0,st.jsxs)("div",{className:"flex items-center gap-2 border-b border-[rgb(var(--sg-border))] px-4 py-3",children:[(0,st.jsx)(Zo.SlidersHorizontal,{size:18,className:"text-[rgb(var(--sg-primary-600))]"}),(0,st.jsx)("span",{className:"text-sm font-semibold text-[rgb(var(--sg-text))]",children:Pr})]}),(0,st.jsx)("div",{className:"overflow-y-auto px-2 py-2",style:{maxHeight:Ko(Y)},children:(0,st.jsx)("div",{className:"space-y-1",children:we.map(re=>{let Ue=!!le[re.key],nt=re.column.hideable!==!1,bt=re.column.reorderable!==!1,pt=nt&&(Ue?!0:Ce>1),Ut=typeof re.column.header=="string"||typeof re.column.header=="number"?String(re.column.header):re.column.field??re.key;return(0,st.jsxs)("div",{draggable:bt,onDragStart:()=>Z(re.key),onDragOver:Hn=>{bt&&Hn.preventDefault()},onDrop:Hn=>{Hn.preventDefault(),bt&&(!ue||ue===re.key||(co(ue,re.key),Z(null)))},onDragEnd:()=>Z(null),className:zr("flex items-center gap-3 rounded-md px-2 py-2",ue===re.key?"opacity-60":"","hover:bg-[rgb(var(--sg-primary-50))]"),children:[(0,st.jsx)("button",{type:"button",disabled:!pt,onClick:()=>lo(re.key),className:zr("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md border shadow-sm transition",Ue?"border-[rgb(var(--sg-primary-300))] bg-[rgb(var(--sg-primary-50))] text-transparent":"border-[rgb(var(--sg-primary-600))] bg-[rgb(var(--sg-primary-600))] text-white",pt?"hover:scale-[1.02]":"cursor-not-allowed opacity-50"),children:(0,st.jsx)(Zo.Check,{size:14})}),(0,st.jsx)("button",{type:"button",disabled:!pt,onClick:()=>lo(re.key),className:zr("flex-1 truncate text-left text-sm",Ue?"text-[rgb(var(--sg-muted))]":"text-[rgb(var(--sg-text))]",pt?"":"cursor-not-allowed"),children:Ut}),(0,st.jsx)("div",{className:zr("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[rgb(var(--sg-muted))]",bt?"cursor-grab active:cursor-grabbing":"opacity-40"),title:qo,children:(0,st.jsx)(Zo.GripVertical,{size:16})})]},`manager-${re.key}`)})})}),(0,st.jsxs)("div",{className:"flex items-center gap-2 border-t border-[rgb(var(--sg-border))] px-3 py-3",children:[(0,st.jsx)(Tt,{size:"sm",appearance:"outline",onClick:mr,children:ko}),(0,st.jsx)(Tt,{size:"sm",appearance:"outline",onClick:Go,children:dr})]})]}),document.body):null,(0,st.jsx)("div",{className:"overflow-x-auto rounded-lg border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-surface))]",children:(0,st.jsxs)("table",{id:r,className:zr("min-w-full border-collapse text-sm",ee),children:[(0,st.jsxs)("thead",{children:[(0,st.jsx)("tr",{className:"bg-[rgb(var(--sg-primary-50))]",children:xe.map((re,Ue)=>{let nt=re.sortField??re.field,bt=!!nt&&nt===Ve,pt=re.sortable?bt?Le===1?" ^":Le===-1?" v":" <>":" <>":null;return(0,st.jsx)("th",{className:zr("px-3 py-2 font-semibold text-[rgb(var(--sg-text))]",Zi(re.align),U?"border-b border-r border-[rgb(var(--sg-border))] last:border-r-0":"border-b border-[rgb(var(--sg-border))]",re.headerClassName,re.className),style:{width:Ko(re.width),minWidth:Ko(re.minWidth)},children:re.sortable?(0,st.jsxs)("button",{type:"button",onClick:()=>as(re),className:zr("inline-flex items-center gap-1 font-semibold",Zi(re.align),"text-[rgb(var(--sg-text))] hover:text-[rgb(var(--sg-primary-600))]"),children:[(0,st.jsx)("span",{children:re.header}),(0,st.jsx)("span",{"aria-hidden":"true",children:pt})]}):(0,st.jsx)("span",{children:re.header})},`head-${re.columnId??re.field??Ue}`)})}),Ro?(0,st.jsx)("tr",{children:xe.map((re,Ue)=>{let nt=re.filterField??re.field,bt=nt?it[nt]??"":"";return(0,st.jsx)("th",{className:zr("px-3 py-2 align-top",U?"border-b border-r border-[rgb(var(--sg-border))] last:border-r-0":"border-b border-[rgb(var(--sg-border))]"),children:re.filter&&nt?(0,st.jsx)("input",{value:bt,onChange:pt=>{let Ut={...it,[nt]:pt.target.value},Hn=Yi(Ut);fn(Hn,ct)},placeholder:re.filterPlaceholder??k(n,"components.datatable.columnFilterPlaceholder",{column:String(re.header??"")}),className:"w-full rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-xs text-[rgb(var(--sg-input-fg,var(--sg-text)))] placeholder:text-[rgb(var(--sg-input-placeholder,var(--sg-muted)))] outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]"}):null},`filter-${re.columnId??re.field??Ue}`)})}):null]}),(0,st.jsx)("tbody",{children:q?(0,st.jsx)("tr",{children:(0,st.jsx)("td",{colSpan:Math.max(1,xe.length),className:"px-4 py-6 text-center text-sm text-[rgb(var(--sg-muted))]",children:so})}):et.length===0?(0,st.jsx)("tr",{children:(0,st.jsx)("td",{colSpan:Math.max(1,xe.length),className:"px-4 py-6 text-center text-sm text-[rgb(var(--sg-muted))]",children:ao})}):et.map((re,Ue)=>{let nt=ot+Ue,bt=io(re),pt=typeof O=="function"?O(re,nt):O;return(0,st.jsx)("tr",{"aria-selected":bt||void 0,onClick:Ut=>{Ut.target.closest("button,a,input,select,textarea,label,[data-sg-stop-row-select='true']")||Wo(re)},className:zr(P?"cursor-pointer":"",V&&nt%2===1?"bg-[rgb(var(--sg-primary-50))]":"",A?"hover:bg-[rgb(var(--sg-primary-100))]":"",bt?"bg-[rgb(var(--sg-primary-100))]":"",pt),children:xe.map((Ut,Hn)=>{let Tr=Ut.field,nr=Fa(re,Tr),Po=typeof Ut.bodyClassName=="function"?Ut.bodyClassName(re,nt):Ut.bodyClassName,ba=Ut.body?Ut.body(re,{rowData:re,rowIndex:nt,field:Tr,value:nr}):(0,st.jsx)("span",{children:nr==null?"-":String(nr)});return(0,st.jsx)("td",{className:zr("px-3 py-2 text-[rgb(var(--sg-text))]",Zi(Ut.align),U?"border-b border-r border-[rgb(var(--sg-border))] last:border-r-0":"border-b border-[rgb(var(--sg-border))]",Ut.className,Po),style:{width:Ko(Ut.width),minWidth:Ko(Ut.minWidth)},children:ba},`cell-${Ut.columnId??Tr??Hn}-${nt}`)})},String(ou(re,c)??nt))})}),kr?(0,st.jsx)("tfoot",{children:(0,st.jsx)("tr",{className:"bg-[rgb(var(--sg-primary-50))]",children:xe.map((re,Ue)=>{let nt=typeof re.footer=="function"?re.footer(gt):re.footer;return(0,st.jsx)("td",{className:zr("px-3 py-2 font-semibold text-[rgb(var(--sg-text))]",Zi(re.align),U?"border-t border-r border-[rgb(var(--sg-border))] last:border-r-0":"border-t border-[rgb(var(--sg-border))]",re.className),style:{width:Ko(re.width),minWidth:Ko(re.minWidth)},children:nt??null},`foot-${re.columnId??re.field??Ue}`)})})}):null]})})]}),m?(0,st.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,st.jsx)(Tt,{size:"sm",appearance:"outline",disabled:mt<=1,onClick:()=>Gt(mt-1),children:_o}),Ht.map(re=>(0,st.jsx)(Tt,{size:"sm",appearance:re===mt?"solid":"outline",onClick:()=>Gt(re),children:String(re)},`page-${re}`)),(0,st.jsx)(Tt,{size:"sm",appearance:"outline",disabled:mt>=ye,onClick:()=>Gt(mt+1),children:Xs}),(0,st.jsx)("span",{className:"min-w-[180px] text-xs text-[rgb(var(--sg-muted))] md:ml-auto",children:os}),b&&b.length>0?(0,st.jsxs)("label",{className:"ml-auto inline-flex items-center gap-2 text-xs text-[rgb(var(--sg-muted))] md:ml-0",children:[(0,st.jsx)("span",{children:ha}),(0,st.jsx)("select",{value:De,onChange:re=>{let Ue=Number(re.target.value)||De;Pt(0,Ue)},className:"rounded-md border border-[rgb(var(--sg-border))] bg-[rgb(var(--sg-input-bg,var(--sg-surface)))] px-2 py-1 text-xs text-[rgb(var(--sg-input-fg,var(--sg-text)))]",children:b.map(re=>(0,st.jsx)("option",{value:re,children:re},re))})]}):null]}):null]})})})}var Qg=lt.default.forwardRef(qy);var pr=je(require("react"),1);var ir=require("react/jsx-runtime");function Gy({className:e}){return(0,ir.jsx)("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,ir.jsx)("path",{d:"m6 9 6 6 6-6"})})}var au=pr.forwardRef(({label:e,leftIcon:t,severity:n="primary",appearance:r="solid",size:o="md",shape:s="default",elevation:i="none",disabled:c=!1,loading:d=!1,onClick:u,items:m,customColors:g,className:h,style:b},S)=>{let R=Me(),[C,N]=pr.useState(!1),B=pr.useRef(null),P=pr.useRef(null);pr.useImperativeHandle(S,()=>B.current),pr.useEffect(()=>{if(!C)return;function v(G){B.current&&!B.current.contains(G.target)&&N(!1)}function $(G){G.key==="Escape"&&N(!1)}return document.addEventListener("mousedown",v),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",$)}},[C]);let w=()=>{!c&&!d&&N(v=>!v)},x=v=>{v.disabled||(v.onClick?.(),N(!1))},I=r==="solid"?"border-l border-white/40":r==="outline"?"border-l border-[var(--sg-btn-border,currentColor)]":"border-l border-current/20",F={sm:{menu:"min-w-[140px]",item:"px-3 py-1.5",text:"text-sm",iconSize:"size-3.5"},md:{menu:"min-w-[160px]",item:"px-4 py-2",text:"text-sm",iconSize:"size-4"},lg:{menu:"min-w-[180px]",item:"px-5 py-2.5",text:"text-base",iconSize:"size-5"}}[o];return(0,ir.jsxs)("div",{ref:B,className:`relative inline-flex ${h??""}`,style:b,children:[(0,ir.jsx)(Tt,{severity:n,appearance:r,size:o,shape:s,elevation:i,disabled:c,loading:d,leftIcon:t,onClick:u,customColors:g,className:"rounded-r-none",children:e}),(0,ir.jsx)(Tt,{severity:n,appearance:r,size:o,shape:s,elevation:i,disabled:c||d,leftIcon:(0,ir.jsx)(Gy,{className:"size-4"}),onClick:w,customColors:g,className:`rounded-l-none ${I}`,"aria-haspopup":"menu","aria-expanded":C,"aria-label":C?k(R,"components.actions.close"):k(R,"components.actions.openList")}),C&&(0,ir.jsx)("div",{ref:P,role:"menu",className:`absolute left-0 top-full z-50 mt-1 ${F.menu} overflow-hidden rounded-lg shadow-lg bg-background text-foreground border border-border`,children:m.map((v,$)=>(0,ir.jsxs)(pr.Fragment,{children:[v.separator&&$>0?(0,ir.jsx)("div",{className:"my-0.5 border-t border-border"}):null,(0,ir.jsxs)("button",{role:"menuitem",type:"button",disabled:v.disabled,className:`flex w-full items-center gap-2 ${F.item} ${F.text} transition-colors hover:bg-muted/60 disabled:opacity-50 disabled:cursor-not-allowed`,onClick:()=>x(v),children:[v.icon?(0,ir.jsx)("span",{className:`shrink-0 ${F.iconSize}`,children:v.icon}):null,(0,ir.jsx)("span",{children:v.label})]})]},$))})]})});au.displayName="SgSplitButton";var Nt=je(require("react"),1);function Cs(e){let t=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return null}})():e;return!t||typeof t!="object"||typeof t.x!="number"||typeof t.y!="number"||!Number.isFinite(t.x)||!Number.isFinite(t.y)?null:{x:t.x,y:t.y}}function Xi(e){return e?`sg-fab-pos:${e}`:null}var Bn=je(require("react"),1),op=require("react-dom");var Vr=require("react/jsx-runtime");function su(...e){return e.filter(Boolean).join(" ")}function ep(e,t,n){return Math.max(t,Math.min(e,n))}function tp(e){let t=Bn.useRef(e);return Bn.useEffect(()=>{t.current=e},[e]),Bn.useCallback((...n)=>t.current?.(...n),[])}var Uy={primary:"text-primary-foreground bg-primary hover:brightness-95",secondary:"text-secondary-foreground bg-secondary hover:brightness-95",success:"text-white bg-emerald-600 hover:brightness-95",info:"text-white bg-sky-600 hover:brightness-95",warning:"text-white bg-amber-600 hover:brightness-95",help:"text-white bg-violet-600 hover:brightness-95",danger:"text-destructive-foreground bg-destructive hover:brightness-95",plain:"text-foreground bg-muted hover:bg-muted/80"},jy="text-foreground bg-transparent hover:bg-muted/80";function np(e,t,n){return n==="start"?e.left:n==="center"?e.left+e.width/2-t.width/2:e.right-t.width}function rp(e,t,n){return n==="start"?e.top:n==="center"?e.top+e.height/2-t.height/2:e.bottom-t.height}function Yy(e){let{anchor:t,popup:n,offset:r,prefer:o,viewportW:s,viewportH:i}=e,c={right:s-t.right,left:t.left,bottom:i-t.bottom,top:t.top},d=g=>g==="left"||g==="right"?c[g]>=n.width+r:c[g]>=n.height+r;return[o,{right:"left",left:"right",top:"bottom",bottom:"top"}[o],"bottom","top","right","left"].find(d)??o}function Ky(e){let{anchor:t,popup:n,placement:r,preferPlacement:o,align:s,offset:i,padding:c}=e,d=window.innerWidth,u=window.innerHeight,m=r==="auto"?Yy({anchor:t,popup:n,offset:i,prefer:o,viewportW:d,viewportH:u}):r,g=0,h=0;return m==="right"?(h=t.right+i,g=rp(t,n,s)):m==="left"?(h=t.left-n.width-i,g=rp(t,n,s)):m==="bottom"?(g=t.bottom+i,h=np(t,n,s)):(g=t.top-n.height-i,h=np(t,n,s)),h=ep(h,c,d-n.width-c),g=ep(g,c,u-n.height-c),{top:g,left:h}}function ws(e){let t=Me(),{title:n,subtitle:r,open:o,onOpenChange:s,defaultOpen:i=!1,onOpen:c,onClose:d,anchorRef:u,placement:m="auto",preferPlacement:g="right",align:h="start",offset:b=8,padding:S=8,closeOnOutsideClick:R=!0,closeOnEscape:C=!0,className:N,style:B,zIndex:P=60,minWidth:w=180,actions:x,children:I}=e,D=typeof o=="boolean",[F,v]=Bn.useState(i),$=D?o:F,G=Bn.useCallback(O=>{D||v(O),s?.(O)},[D,s]),j=tp(c),_=tp(d),V=Bn.useRef($);Bn.useEffect(()=>{V.current!==$&&($?j?.():_?.(),V.current=$)},[$,j,_]);let U=Bn.useRef(null),[A,q]=Bn.useState(null),M=Bn.useCallback(()=>{let O=u.current,de=U.current;if(!O||!de)return;let Re=O.getBoundingClientRect(),W=de.getBoundingClientRect(),Y=Ky({anchor:Re,popup:W,placement:m,preferPlacement:g,align:h,offset:b,padding:S});q({top:Y.top,left:Y.left})},[u,m,g,h,b,S]);Bn.useLayoutEffect(()=>{if(!$)return;M();let O=requestAnimationFrame(M);return()=>cancelAnimationFrame(O)},[$,M]),Bn.useEffect(()=>{if(!$)return;let O=()=>M(),de=()=>M();return window.addEventListener("resize",O),window.addEventListener("scroll",de,{passive:!0,capture:!0}),()=>{window.removeEventListener("resize",O),window.removeEventListener("scroll",de,!0)}},[$,M]),Bn.useEffect(()=>{if(!$)return;let O=Re=>{if(!R)return;let W=U.current,Y=u.current,me=Re.target;W&&W.contains(me)||Y&&Y.contains(me)||G(!1)},de=Re=>{C&&Re.key==="Escape"&&G(!1)};return document.addEventListener("mousedown",O),document.addEventListener("keydown",de),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",de)}},[$,R,C,G,u]);let T=Bn.useCallback(()=>G(!1),[G]);if(!$)return null;let z=n??k(t,"components.popup.ariaLabel"),ee=(0,Vr.jsxs)("div",{ref:U,className:su("fixed overflow-hidden rounded-md border border-border bg-background shadow-lg","min-w-[180px]",N),style:{zIndex:P,top:A?.top??-9999,left:A?.left??-9999,minWidth:w,...B},role:"dialog","aria-modal":"false","aria-label":z,children:[n?(0,Vr.jsx)("div",{className:"bg-primary px-3 py-2 text-xs font-medium text-primary-foreground",children:n}):null,r?(0,Vr.jsx)("div",{className:"border-b border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:r}):null,I?(0,Vr.jsx)("div",{className:"p-2",children:I}):null,x&&x.length>0?(0,Vr.jsx)("div",{className:su(I?"border-t border-border":"","p-1"),children:x.map((O,de)=>{let Re=O.severity!==void 0,W=O.severity??"plain";return(0,Vr.jsx)("button",{type:"button",disabled:O.disabled,title:O.hint,className:su("w-full select-none rounded px-3 py-2 text-left text-sm","transition-[filter,background-color] duration-150","disabled:opacity-50 disabled:cursor-not-allowed",de>0?"border-t border-border":"",Re?Uy[W]:jy),onClick:()=>{O.onClick?.(),(O.closeOnClick??!0)&&T()},children:(0,Vr.jsxs)("span",{className:"inline-flex items-center gap-2",children:[O.icon?(0,Vr.jsx)("span",{className:"inline-flex",children:O.icon}):null,(0,Vr.jsx)("span",{children:O.label})]})},de)})}):null]});return(0,op.createPortal)(ee,document.body)}ws.displayName="SgPopup";var Zn=je(require("react"),1);function Rs(e,t,n){let r=t??"";if(!r)return null;let o=(n??"").trim();return o?`sg:${r}:${o}:${e}`:`sg:${r}:${e}`}function ks(e){let t=e?.prefix??"",n=r=>t?`${t}${r}`:r;return{load:r=>{try{let o=window.localStorage.getItem(n(r));return o==null?null:JSON.parse(o)}catch{return null}},save:(r,o)=>{try{window.localStorage.setItem(n(r),JSON.stringify(o))}catch{}},clear:r=>{try{window.localStorage.removeItem(n(r))}catch{}}}}function iu(e){let t=e.fetcher??fetch,n=e.baseUrl.replace(/\/$/,""),r=e.stateVersion,o=e.scope;return{load:async s=>{let i=await t(`${n}/sg/persistence?key=${encodeURIComponent(s)}`,{method:"GET"});if(!i.ok)throw new Error(`SG persistence load failed (${i.status})`);let c=await i.json();return!c?.found||!c.record?null:c.record.state},save:async(s,i)=>{let c={protocolVersion:1,key:s,scope:o,stateVersion:r,updatedAt:new Date().toISOString(),state:i},d=await t(`${n}/sg/persistence`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({record:c})});if(!d.ok)throw new Error(`SG persistence save failed (${d.status})`)},clear:async s=>{let i=await t(`${n}/sg/persistence?key=${encodeURIComponent(s)}`,{method:"DELETE"});if(!i.ok)throw new Error(`SG persistence clear failed (${i.status})`)}}}function lu(e){let{mode:t,primary:n,secondary:r}=e;return{load:async o=>{if(t==="strict")return await n.load(o);if(t==="mirror"){try{let s=await n.load(o);if(s!=null)return s}catch{}return await r.load(o)}try{return await n.load(o)}catch{return await r.load(o)}},save:async(o,s)=>{if(t==="strict"){await n.save(o,s);return}if(t==="mirror"){await Promise.allSettled([Promise.resolve(n.save(o,s)),Promise.resolve(r.save(o,s))]);return}try{await n.save(o,s)}catch{await r.save(o,s)}},clear:async o=>{if(t==="strict"){await n.clear(o);return}if(t==="mirror"){await Promise.allSettled([Promise.resolve(n.clear(o)),Promise.resolve(r.clear(o))]);return}try{await n.clear(o)}catch{await r.clear(o)}}}}function Ps(e){let{loaded:t,defaultValue:n,deserialize:r}=e;return t==null?n:r(t)}function Ji(e){let{storage:t,baseKey:n,defaultValue:r,deserialize:o}=e;try{let s=t.getItem(n);return s===null?r:Ps({loaded:JSON.parse(s),defaultValue:r,deserialize:o})}catch{return r}}function Qi(e){let{storage:t,baseKey:n,value:r}=e;t.setItem(n,JSON.stringify(r))}function el(e){let{storage:t,baseKey:n,defaultValue:r}=e;return t.removeItem(n),r}var lp=require("react/jsx-runtime"),ap={getNamespace:()=>""},Ts={namespaceProvider:ap,persistenceStrategy:ks(),persistence:{scope:"app:unknown",mode:"fallback",stateVersion:1}},cu=Zn.default.createContext(null);function sp(e){let t=Zn.default.useMemo(()=>({namespaceProvider:e.value?.namespaceProvider??ap,persistenceStrategy:e.value?.persistenceStrategy??Ts.persistenceStrategy,persistence:{scope:e.value?.persistence?.scope??Ts.persistence.scope,mode:e.value?.persistence?.mode??Ts.persistence.mode,stateVersion:e.value?.persistence?.stateVersion??Ts.persistence.stateVersion}}),[e.value?.namespaceProvider,e.value?.persistenceStrategy,e.value?.persistence?.scope,e.value?.persistence?.mode,e.value?.persistence?.stateVersion]);return(0,lp.jsx)(cu.Provider,{value:t,children:e.children})}function tl(){return Zn.default.useContext(cu)??Ts}function Hr(){return Zn.default.useContext(cu)!==null}function ip(){return tl().namespaceProvider}function fr(){let e=tl(),t=e.namespaceProvider.getNamespace(),n=i=>Rs(i,t,e.persistence.scope),r=Zn.default.useCallback(async i=>{let c=n(i);return c?await e.persistenceStrategy.load(c):null},[e.persistenceStrategy,t,e.persistence.scope]),o=Zn.default.useCallback(async(i,c)=>{let d=n(i);d&&await e.persistenceStrategy.save(d,c)},[e.persistenceStrategy,t,e.persistence.scope]),s=Zn.default.useCallback(async i=>{let c=n(i);c&&await e.persistenceStrategy.clear(c)},[e.persistenceStrategy,t,e.persistence.scope]);return{namespace:t,scope:e.persistence.scope,mode:e.persistence.mode,stateVersion:e.persistence.stateVersion,load:r,save:o,clear:s}}function nl(e){let{baseKey:t,defaultValue:n}=e,r=Zn.default.useMemo(()=>e.serialize??(b=>b),[e.serialize]),o=Zn.default.useMemo(()=>e.deserialize??(b=>b),[e.deserialize]),s=Hr(),i=fr(),[c,d]=Zn.default.useState(n),[u,m]=Zn.default.useState(!1);Zn.default.useEffect(()=>{let b=!0;return(async()=>{try{let S;if(s?S=await i.load(t):S=Ji({storage:localStorage,baseKey:t,defaultValue:null,deserialize:R=>R}),!b)return;d(Ps({loaded:S,defaultValue:n,deserialize:o})),m(!0)}catch{if(!b)return;d(n),m(!0)}})(),()=>{b=!1}},[t,n,s,i.load,o]),Zn.default.useEffect(()=>{if(u)if(s)i.save(t,r(c));else try{Qi({storage:localStorage,baseKey:t,value:c})}catch{}},[c,u,s,t,i.save,r]);let g=Zn.default.useCallback(b=>{d(b)},[]),h=Zn.default.useCallback(async()=>{if(s)await i.clear(t);else try{el({storage:localStorage,baseKey:t,defaultValue:n})}catch{}d(n)},[t,s,i.clear,n]);return{value:c,setValue:g,clear:h,hydrated:u}}var En=require("react/jsx-runtime");function Ns(...e){return e.filter(Boolean).join(" ")}var Nr=24,Zy={"left-top":{top:Nr,left:Nr},"left-center":{left:Nr,top:"50%"},"left-bottom":{bottom:Nr,left:Nr},"center-top":{top:Nr,left:"50%"},"center-bottom":{bottom:Nr,left:"50%"},"right-top":{top:Nr,right:Nr},"right-center":{right:Nr,top:"50%"},"right-bottom":{bottom:Nr,right:Nr}},Xy={"left-center":"translateY(-50%)","right-center":"translateY(-50%)","center-top":"translateX(-50%)","center-bottom":"translateX(-50%)"},Jy={"left-top":"right","left-center":"right","left-bottom":"right","center-top":"bottom","center-bottom":"top","right-top":"left","right-center":"left","right-bottom":"left"},Qy={"left-top":"down","left-center":"right","left-bottom":"up","center-top":"down","center-bottom":"up","right-top":"down","right-center":"left","right-bottom":"up"},cp={primary:{bg:"var(--sg-btn-primary-bg, hsl(var(--primary)))",fg:"var(--sg-btn-primary-fg, hsl(var(--primary-foreground)))",ring:"var(--sg-btn-primary-ring, hsl(var(--primary)/0.35))"},secondary:{bg:"var(--sg-btn-secondary-bg, hsl(var(--secondary)))",fg:"var(--sg-btn-secondary-fg, hsl(var(--secondary-foreground)))",ring:"var(--sg-btn-secondary-ring, hsl(var(--secondary)/0.35))"},success:{bg:"var(--sg-btn-success-bg, hsl(var(--tertiary, var(--accent))))",fg:"var(--sg-btn-success-fg, hsl(var(--tertiary-foreground, var(--accent-foreground, 0 0% 100%))))",ring:"var(--sg-btn-success-ring, hsl(var(--tertiary, var(--accent))/0.35))"},info:{bg:"var(--sg-btn-info-bg, hsl(var(--secondary, var(--primary))))",fg:"var(--sg-btn-info-fg, hsl(var(--secondary-foreground, var(--primary-foreground))))",ring:"var(--sg-btn-info-ring, hsl(var(--secondary, var(--primary))/0.35))"},warning:{bg:"var(--sg-btn-warning-bg, hsl(var(--secondary, var(--accent))))",fg:"var(--sg-btn-warning-fg, hsl(var(--secondary-foreground, var(--accent-foreground, 0 0% 100%))))",ring:"var(--sg-btn-warning-ring, hsl(var(--secondary, var(--accent))/0.35))"},help:{bg:"var(--sg-btn-help-bg, hsl(var(--secondary, var(--primary))))",fg:"var(--sg-btn-help-fg, hsl(var(--secondary-foreground, var(--primary-foreground))))",ring:"var(--sg-btn-help-ring, hsl(var(--secondary, var(--primary))/0.35))"},danger:{bg:"var(--sg-btn-danger-bg, hsl(var(--destructive)))",fg:"var(--sg-btn-danger-fg, hsl(var(--destructive-foreground)))",ring:"var(--sg-btn-danger-ring, hsl(var(--destructive)/0.35))"},plain:{bg:"hsl(var(--muted))",fg:"hsl(var(--muted-foreground))",ring:"hsl(var(--muted)/0.35)"}},up={sm:40,md:56,lg:64},e0={sm:18,md:22,lg:26},t0={sm:36,md:44,lg:52},n0={sm:14,md:18,lg:20},r0={circle:"rounded-full",rounded:"rounded-xl",square:"rounded-sm"},o0={none:"",sm:"shadow-sm",md:"shadow-md shadow-black/15",lg:"shadow-lg shadow-black/20"},dp={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},a0={up:"left",down:"right",left:"top",right:"bottom"},s0={sm:48,md:60,lg:72},i0={sm:100,md:120,lg:150},l0={up:270,down:90,left:180,right:0};function c0(e){return e*Math.PI/180}function u0(e,t,n,r,o){if(e===0)return[];if(t==="linear"){let m=s0[r];return Array.from({length:e},(g,h)=>{let b=m*(h+1);switch(n){case"up":return{x:0,y:-b};case"down":return{x:0,y:b};case"left":return{x:-b,y:0};case"right":return{x:b,y:0}}})}let s=o??i0[r],i=l0[n]??0,c;switch(t){case"circle":c=360;break;case"semi-circle":c=180;break;case"quarter-circle":c=90;break;default:c=360}let d=t==="circle"?c/e:c/Math.max(e-1,1),u=t==="circle"?i:i-c/2;return Array.from({length:e},(m,g)=>{let h=u+d*g,b=c0(h);return{x:Math.round(s*Math.cos(b)),y:Math.round(s*Math.sin(b))}})}function d0({size:e}){return(0,En.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,En.jsx)("path",{d:"M5 12h14"}),(0,En.jsx)("path",{d:"M12 5v14"})]})}function m0({size:e}){return(0,En.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",className:"animate-spin","aria-hidden":"true",children:[(0,En.jsx)("circle",{cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"3"}),(0,En.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}function g0(e){return e.endsWith("bottom")?"translateY(24px)":e.endsWith("top")?"translateY(-24px)":e.startsWith("left")?"translateX(-24px)":"translateX(24px)"}function mp(e,t=10){return e.endsWith("bottom")?`translateY(${t}px)`:e.endsWith("top")?`translateY(-${t}px)`:e.startsWith("left")?`translateX(-${t}px)`:`translateX(${t}px)`}function uu(e){let t=Me(),n=Hr(),{load:r,save:o,clear:s}=fr(),{hint:i,hintDelay:c=300,icon:d,activeIcon:u,position:m="right-bottom",offset:g,enableDragDrop:h=!1,dragId:b,severity:S="primary",floatActionButtonStyle:R,color:C,size:N="md",shape:B="circle",elevation:P="md",disabled:w=!1,loading:x=!1,autoHideOnScroll:I=!1,hideDirection:D="down",animation:F="scale",animationOn:v="mount",animationDuration:$=200,type:G="linear",radius:j,transitionDelay:_=30,actions:V,onClick:U,className:A,style:q,zIndex:M=50,absolute:T=!1}=e,z=e.hintPosition??Jy[m],ee=e.direction??Qy[m],[O,de]=Nt.useState(!1),[Re,W]=Nt.useState(!1),[Y,me]=Nt.useState(!1),[H,K]=Nt.useState(!1),[se,$e]=Nt.useState(!1),[Ae,Qe]=Nt.useState(!1),[ge,pe]=Nt.useState(null),fe=Nt.useRef(null),We=Nt.useRef(!1),[Be,Ee]=Nt.useState(!1),[ke,ne]=Nt.useState(!1),he=Nt.useRef(null),Fe=Nt.useRef(!1),ze=Nt.useRef(null),X=Nt.useRef(null),ae=Nt.useRef(null),ie=Nt.useRef(null),ve=T===!0,Q=Xi(b),Pe=Nt.useCallback(async()=>{if(!Q)return null;if(n)try{let ye=await r(Q);if(ye==null)return null;let Ze=Cs(ye);return Ze||(await s(Q),null)}catch{return null}try{let ye=localStorage.getItem(Q);if(!ye)return null;let Ze=Cs(ye);return Ze||(localStorage.removeItem(Q),null)}catch{return null}},[s,n,r,Q]),at=Nt.useCallback(async ye=>{if(Q){if(n){try{await o(Q,ye)}catch{}return}try{localStorage.setItem(Q,JSON.stringify(ye))}catch{}}},[n,o,Q]),ue=Nt.useCallback(async()=>{if(Q){if(n){try{await s(Q)}catch{}return}try{localStorage.removeItem(Q)}catch{}}},[s,n,Q]);Nt.useEffect(()=>{let ye=setTimeout(()=>de(!0),20);return()=>clearTimeout(ye)},[]),Nt.useEffect(()=>{if(!Y)return;let ye=setTimeout(()=>me(!1),$);return()=>clearTimeout(ye)},[Y,$]),Nt.useEffect(()=>{if(!I)return;let ye=window.scrollY,Ze=()=>{let ot=window.scrollY,et=ot-ye;D==="down"&&et>5||D==="up"&&et<-5?$e(!0):Math.abs(et)>5&&$e(!1),ye=ot};return window.addEventListener("scroll",Ze,{passive:!0}),()=>window.removeEventListener("scroll",Ze)},[I,D]),Nt.useEffect(()=>{if(!h||!b)return;let ye=!0;return(async()=>{let Ze=await Pe();if(!ye||!Ze)return;let ot=Ze.x,et=Ze.y,mt=up[N],Ht=Math.max(0,window.innerWidth-mt),Pt=Math.max(0,window.innerHeight-mt);if(ve&&ze.current){let It=ze.current.offsetParent;if(It){let fn=It.getBoundingClientRect();Ht=Math.max(0,fn.width-mt),Pt=Math.max(0,fn.height-mt)}}let Mt={x:Math.min(Math.max(ot,0),Ht),y:Math.min(Math.max(et,0),Pt)};fe.current=Mt,pe(Mt),We.current=!0})(),()=>{ye=!1}},[h,b,Pe,N,ve]),Nt.useEffect(()=>{if(!H)return;let ye=ot=>{ze.current&&!ze.current.contains(ot.target)&&K(!1)},Ze=ot=>{ot.key==="Escape"&&K(!1)};return document.addEventListener("mousedown",ye),document.addEventListener("keydown",Ze),()=>{document.removeEventListener("mousedown",ye),document.removeEventListener("keydown",Ze)}},[H]),Nt.useEffect(()=>()=>{ie.current?.(),ie.current=null},[]);let Z=Nt.useCallback(()=>{W(!0),i&&(ae.current=setTimeout(()=>Qe(!0),c))},[i,c]),J=Nt.useCallback(()=>{W(!1),ae.current&&clearTimeout(ae.current),Qe(!1)},[]),ce=Nt.useCallback(()=>{if(!(w||x)){if(h&&Fe.current){Fe.current=!1;return}if(ke){ne(!1);return}me(!0),V&&V.length>0?K(ye=>!ye):U?.()}},[w,x,V,U,h,ke]),be=Nt.useCallback(ye=>{if(ye.button!==0||!h||w||x||!ze.current)return;ie.current?.(),ie.current=null,ye.preventDefault();let Ze=ye.currentTarget.ownerDocument??document,ot=Ze.defaultView??window,et=ze.current.getBoundingClientRect(),mt=ve?ze.current.offsetParent?.getBoundingClientRect()??{left:0,top:0}:{left:0,top:0};he.current={x:ye.clientX,y:ye.clientY,left:et.left-mt.left,top:et.top-mt.top},Fe.current=!1,Ee(!0);let Ht=jr=>{if(!he.current)return;let wr=jr.clientX-he.current.x,Jn=jr.clientY-he.current.y;(Math.abs(wr)>3||Math.abs(Jn)>3)&&(Fe.current=!0,V&&V.length>0&&K(!0));let Gt={x:he.current.left+wr,y:he.current.top+Jn};fe.current=Gt,pe(Gt),We.current=!0},Pt=!1,Mt=()=>{Pt||(Pt=!0,Ee(!1),he.current=null,h&&b&&fe.current&&at(fe.current),ot.removeEventListener("pointermove",Ht),ot.removeEventListener("pointerup",It),ot.removeEventListener("pointercancel",It),ot.removeEventListener("blur",It),Ze.removeEventListener("visibilitychange",fn),ie.current===Mt&&(ie.current=null))},It=()=>Mt(),fn=()=>{Ze.visibilityState==="hidden"&&Mt()};ie.current=Mt,ot.addEventListener("pointermove",Ht),ot.addEventListener("pointerup",It),ot.addEventListener("pointercancel",It),ot.addEventListener("blur",It),Ze.addEventListener("visibilitychange",fn)},[h,w,x,V,b,ve,at]),qe=Nt.useCallback(ye=>{!h||!b||We.current&&(ye.preventDefault(),ne(!0))},[h,b]),Ne=Nt.useCallback(ye=>{if(!ye||!b){ne(!1);return}ue(),fe.current=null,pe(null),K(!1),ne(!1),We.current=!1,Fe.current=!1},[ue,b]),Ye=cp[S??R??"primary"],_e=C??Ye.bg,we=C?"white":Ye.fg,xe=C?`color-mix(in srgb, ${C} 35%, transparent)`:Ye.ring,Ce=up[N],Te=e0[N],De=t0[N],Ve=n0[N],Le={position:T?"absolute":"fixed",...Zy[m],zIndex:M};h&&ge&&(Le.left=ge.x,Le.top=ge.y,delete Le.right,delete Le.bottom),g?.x&&(Le.right!==void 0?Le.right=(typeof Le.right=="number"?Le.right:0)-g.x:Le.left!==void 0&&(Le.left=(typeof Le.left=="number"?Le.left:0)+g.x)),g?.y&&(Le.bottom!==void 0?Le.bottom=(typeof Le.bottom=="number"?Le.bottom:0)-g.y:Le.top!==void 0&&(Le.top=(typeof Le.top=="number"?Le.top:0)+g.y));let Je=!T&&(q?.position==="relative"||q?.position==="static"),ct=!Je,it=[],At=ct&&!(h&&ge)?Xy[m]:void 0;At&&it.push(At),ct&&se&&it.push(D==="down"?"translateY(100px)":"translateY(-100px)");let ft={transition:`transform ${$}ms ease, opacity ${$}ms ease`};if(v==="mount")switch(F){case"scale":ft.transform=O?"scale(1)":"scale(0)",ft.opacity=O?1:0;break;case"fade":ft.opacity=O?1:0;break;case"rotate":ft.transform=O?"rotate(0deg)":"rotate(-180deg)",ft.opacity=O?1:0;break;case"slide":ft.transform=O?"translate(0,0)":g0(m),ft.opacity=O?1:0;break;case"pulse":O?ft.animation="sg-fab-pulse 1.5s ease-in-out infinite":ft.opacity=0;break}else if(v==="hover")switch(F){case"scale":ft.transform=Re?"scale(1.1)":"scale(1)";break;case"fade":ft.opacity=Re?.62:1;break;case"slide":ft.transform=Re?mp(m,10):"translate(0,0)";break;case"rotate":ft.transform=Re?"rotate(15deg)":"rotate(0deg)";break;case"pulse":Re&&(ft.animation="sg-fab-pulse 0.8s ease-in-out infinite");break}else if(v==="click")switch(F){case"scale":ft.transform=Y?"scale(0.9)":"scale(1)";break;case"fade":ft.opacity=Y?.52:1;break;case"slide":ft.transform=Y?mp(m,14):"translate(0,0)";break;case"rotate":ft.transform=Y?"rotate(90deg)":"rotate(0deg)";break}let gt=u0((V??[]).length,G,ee,N,j),an=w||x;return(0,En.jsxs)("div",{ref:ze,style:{...Je?{position:q?.position}:Le,transform:it.length>0?it.join(" "):void 0,transition:"transform 300ms ease, opacity 300ms ease",opacity:ct&&se?0:1,...q},className:Ns("inline-flex items-center justify-center",A),onContextMenu:ye=>{!h||!b||qe(ye)},children:[F==="pulse"&&(0,En.jsx)("style",{children:"@keyframes sg-fab-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}"}),V?.map((ye,Ze)=>{let ot=gt[Ze]??{x:0,y:0},et=ye.severity??ye.floatActionButtonStyle??"plain",mt=cp[et];return(0,En.jsx)("div",{className:"absolute",style:{transform:H?`translate(${ot.x}px, ${ot.y}px) scale(1)`:"translate(0,0) scale(0)",opacity:H?1:0,transition:"transform 200ms ease, opacity 200ms ease",transitionDelay:H?`${Ze*_}ms`:`${(V.length-1-Ze)*_}ms`},children:(0,En.jsxs)("div",{className:"relative group",children:[(0,En.jsx)("button",{disabled:ye.disabled,className:Ns("inline-flex items-center justify-center rounded-full","hover:brightness-90 active:brightness-[0.85]","focus-visible:outline-none focus-visible:ring-2","disabled:opacity-50 disabled:cursor-not-allowed","shadow-md transition-[filter] duration-150"),style:{width:De,height:De,backgroundColor:mt.bg,color:mt.fg,"--tw-ring-color":mt.ring},onClick:()=>{ye.onClick?.(),K(!1)},"aria-label":ye.label,children:ye.icon}),ye.label?(0,En.jsx)("span",{className:Ns("absolute whitespace-nowrap rounded bg-foreground/90 px-2 py-1 text-xs text-background","opacity-0 group-hover:opacity-100 transition-opacity duration-150 pointer-events-none",dp[a0[ee]??"top"]),children:ye.label}):null]})},Ze)}),(0,En.jsxs)("button",{ref:X,disabled:an,className:Ns("relative inline-flex items-center justify-center","hover:brightness-90 active:brightness-[0.85]","focus-visible:outline-none focus-visible:ring-4","disabled:opacity-60 disabled:cursor-not-allowed","transition-[filter] duration-150",h?Be?"cursor-grabbing":"cursor-pointer":"",r0[B],o0[P]),style:{width:Ce,height:Ce,backgroundColor:_e,color:we,"--tw-ring-color":xe,...h?{touchAction:"none"}:{},...ft},onClick:ce,onPointerDown:be,onContextMenu:qe,onMouseEnter:Z,onMouseLeave:J,"aria-label":i??(H?k(t,"components.actions.close"):k(t,"components.actions.open")),"aria-expanded":V?H:void 0,children:[x?(0,En.jsx)(m0,{size:Te}):(0,En.jsx)("span",{className:"inline-flex items-center justify-center transition-transform duration-300",style:{transform:H&&V?"rotate(45deg)":"rotate(0deg)"},children:H&&u?u:d??(0,En.jsx)(d0,{size:Te})}),i&&!H?(0,En.jsx)("span",{className:Ns("absolute whitespace-nowrap rounded bg-foreground/90 px-2.5 py-1.5 text-xs font-medium text-background","transition-opacity duration-200 pointer-events-none",Ae?"opacity-100":"opacity-0",dp[z]),children:i}):null]}),(0,En.jsx)(ws,{title:k(t,"components.fab.resetPosition"),open:ke,onOpenChange:ne,anchorRef:X,placement:"auto",preferPlacement:"left",align:"start",offset:8,actions:[{label:k(t,"components.fab.yes"),closeOnClick:!1,onClick:()=>Ne(!0)},{label:k(t,"components.fab.no"),closeOnClick:!1,onClick:()=>Ne(!1)}]})]})}uu.displayName="SgFloatActionButton";var dn=je(require("react"),1);function Eo(e){let t=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return null}})():e;return!t||typeof t!="object"||typeof t.x!="number"||typeof t.y!="number"||!Number.isFinite(t.x)||!Number.isFinite(t.y)?null:{x:t.x,y:t.y}}function rl(e){return`sg-toolbar-pos:${e}`}function ol(e,t=!1){return e?`sg-dockmenu-pos:${e}:${t?"parent":"viewport"}`:null}function du(e){return e==="center-top"||e==="center-bottom"?"horizontal":e==="left-center"||e==="right-center"?"vertical":"horizontal"}function mu(e,t){return t==="horizontal"?e.includes("bottom")?-1:1:e.startsWith("left")?1:-1}function al(e){let t=du(e);return{orientation:t,liftDirection:mu(e,t)}}function sl(e){let{index:t,hoveredIndex:n,magnify:r,magnifyScale:o,itemSize:s,gap:i,orientation:c,liftDirection:d}=e,u=n===t,m=r&&n!==null,g=m?Math.abs(t-n):Number.POSITIVE_INFINITY,h=m?Math.max(0,1-g/3):0,b=h*h,S=1+(o-1)*b,R=b*Math.min(s*.4,18),C=Math.max(0,s*(o-1)*.68+i*.12),N=m&&g>0?Math.max(0,1-(g-1)*.1):0,B=m&&n!==null?Math.sign(t-n):0,P=B===0?0:B*C*N,w=(c==="vertical"?d*R:0)+(c==="horizontal"?P:0),x=(c==="horizontal"?d*R:0)+(c==="vertical"?P:0),I=c==="horizontal"?d<0?"50% 100%":"50% 0%":d>0?"0% 50%":"100% 50%";return{scale:S,translateX:w,translateY:x,transformOrigin:I,zIndex:u?3:b>0?2:1}}function il(e,t){return e==="horizontal"?{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:8}:t.startsWith("left")?{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:8}:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:8}}var Mr=24,p0={"left-top":{top:Mr,left:Mr},"left-center":{left:Mr,top:"50%"},"left-bottom":{bottom:Mr,left:Mr},"center-top":{top:Mr,left:"50%"},"center-bottom":{bottom:Mr,left:"50%"},"right-top":{top:Mr,right:Mr},"right-center":{right:Mr,top:"50%"},"right-bottom":{bottom:Mr,right:Mr}},f0={"left-center":"translateY(-50%)","right-center":"translateY(-50%)","center-top":"translateX(-50%)","center-bottom":"translateX(-50%)"};function ll(e){let{position:t,zIndex:n,enableDragDrop:r,dragPos:o,offset:s}=e,i={position:"fixed",...p0[t],zIndex:n};r&&o&&(i.left=o.x,i.top=o.y,delete i.right,delete i.bottom),s?.x&&(i.right!==void 0?i.right=(typeof i.right=="number"?i.right:0)-s.x:i.left!==void 0&&(i.left=(typeof i.left=="number"?i.left:0)+s.x)),s?.y&&(i.bottom!==void 0?i.bottom=(typeof i.bottom=="number"?i.bottom:0)-s.y:i.top!==void 0&&(i.top=(typeof i.top=="number"?i.top:0)+s.y));let c=r&&o?"":f0[t]??"";return{style:i,transform:c}}function Ms(e){let t=!!(e.enableDragDrop&&e.dragId&&e.hasStoredPosition);return{canOpenContextMenu:t,canResetPosition:t}}var Vn=require("react/jsx-runtime"),h0={none:"",sm:"shadow-sm",md:"shadow-md shadow-black/15",lg:"shadow-lg shadow-black/20"};function cl(e,t,n){return Math.min(Math.max(e,t),n)}function gp(e){let t=Me(),n=Hr(),{load:r,save:o,clear:s}=fr(),{id:i,items:c,position:d="center-bottom",enableDragDrop:u=!1,dragId:m,offset:g,className:h="",itemClassName:b="",zIndex:S=50,itemSize:R=48,gap:C=16,backgroundColor:N="rgb(var(--sg-surface, 248 250 252) / 0.9)",showLabels:B=!0,magnify:P=!0,magnifyScale:w=1.5,borderRadius:x=16,elevation:I="lg",style:D}=e,[F,v]=dn.useState(null),$=dn.useRef(null),G=dn.useRef(!1),[j,_]=dn.useState(!1),[V,U]=dn.useState(!1),[A,q]=dn.useState(null),M=dn.useRef(null),T=dn.useRef(!1),z=dn.useRef(null),{orientation:ee,liftDirection:O}=al(d),de=Math.max(8,Math.round(C*.6)),Re=Math.max(Math.round(C*2.2),Math.round(R*.45)),W=D?.position==="absolute",Y=ol(m,W),me="rgb(var(--sg-muted-surface, 241 245 249) / 0.92)",H="rgb(var(--sg-primary-500, 34 197 94) / 0.18)",K="rgb(var(--sg-text, 15 23 42))",se="rgb(var(--sg-surface, 15 23 42) / 0.96)",$e="rgb(var(--sg-text, 255 255 255))",Ae=dn.useCallback(async()=>{if(!Y)return null;if(n)try{let ne=await r(Y);if(ne==null)return null;let he=Eo(ne);return he||(await s(Y),null)}catch{return null}try{let ne=localStorage.getItem(Y);if(!ne)return null;let he=Eo(ne);return he||(localStorage.removeItem(Y),null)}catch{return null}},[s,n,r,Y]),Qe=dn.useCallback(async ne=>{if(Y){if(n){try{await o(Y,ne)}catch{}return}try{localStorage.setItem(Y,JSON.stringify(ne))}catch{}}},[n,o,Y]),ge=dn.useCallback(async()=>{if(Y){if(n){try{await s(Y)}catch{}return}try{localStorage.removeItem(Y)}catch{}}},[s,n,Y]),pe=dn.useCallback(()=>{if(!z.current)return null;let ne=z.current,he=ne.getBoundingClientRect();if(W){let Fe=ne.offsetParent;if(!Fe)return null;let ze=Fe.getBoundingClientRect();return{originX:ze.left,originY:ze.top,minX:0,minY:0,maxX:Math.max(0,Fe.clientWidth-he.width),maxY:Math.max(0,Fe.clientHeight-he.height)}}return{originX:0,originY:0,minX:0,minY:0,maxX:Math.max(0,window.innerWidth-he.width),maxY:Math.max(0,window.innerHeight-he.height)}},[W]);dn.useEffect(()=>{if(!u||!Y||!z.current)return;let ne=!0;return(async()=>{let he=await Ae();if(!ne||!he)return;let Fe=pe();if(!Fe)return;let ze={x:cl(he.x,Fe.minX,Fe.maxX),y:cl(he.y,Fe.minY,Fe.maxY)};$.current=ze,v(ze),G.current=!0})(),()=>{ne=!1}},[u,pe,Ae,Y]),dn.useEffect(()=>{if(!u||!j)return;let ne=document.body.style.cursor;return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=ne}},[u,j]);let fe=dn.useCallback(ne=>{if(ne.button!==0||!u||!z.current)return;let he=pe();if(!he||ne.target.closest("[data-dock-item]"))return;ne.preventDefault();let ze=z.current.getBoundingClientRect();M.current={x:ne.clientX,y:ne.clientY,left:ze.left-he.originX,top:ze.top-he.originY},T.current=!1,_(!0);let X=ie=>{if(!M.current)return;let ve=ie.clientX-M.current.x,Q=ie.clientY-M.current.y;(Math.abs(ve)>3||Math.abs(Q)>3)&&(T.current=!0);let Pe={x:cl(M.current.left+ve,he.minX,he.maxX),y:cl(M.current.top+Q,he.minY,he.maxY)};$.current=Pe,v(Pe),G.current=!0},ae=()=>{_(!1),M.current=null,u&&Y&&$.current&&Qe($.current),window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",ae),window.removeEventListener("pointercancel",ae)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",ae),window.addEventListener("pointercancel",ae)},[u,pe,Qe,Y]),We=dn.useCallback(ne=>{Ms({enableDragDrop:u,dragId:m,hasStoredPosition:G.current}).canOpenContextMenu&&(ne.preventDefault(),U(!0))},[u,m]),Be=dn.useCallback(()=>{!Ms({enableDragDrop:u,dragId:m,hasStoredPosition:G.current}).canResetPosition||!Y||(ge(),$.current=null,v(null),U(!1),G.current=!1,T.current=!1)},[ge,m,u,Y]),Ee=dn.useCallback(ne=>{if(!ne.disabled){if(T.current){T.current=!1;return}ne.onClick?.()}},[]),ke=ll({position:d,zIndex:S,enableDragDrop:u,dragPos:F,offset:g});return(0,Vn.jsxs)(Vn.Fragment,{children:[(0,Vn.jsx)("div",{ref:z,id:i,className:`sg-dock ${h} ${h0[I]}`,style:{...ke.style,...D,transform:ke.transform,cursor:u?j?"grabbing":"grab":"default",...u?{touchAction:"none"}:{}},onPointerDown:fe,onContextMenu:We,children:(0,Vn.jsx)("div",{className:"sg-dock-container",style:{display:"flex",flexDirection:ee==="horizontal"?"row":"column",alignItems:"center",gap:`${C}px`,...ee==="horizontal"?{paddingTop:de,paddingBottom:de,paddingLeft:Re,paddingRight:Re}:{paddingTop:Re,paddingBottom:Re,paddingLeft:de,paddingRight:de},backgroundColor:N,border:"1px solid rgb(var(--sg-border, 226 232 240) / 0.85)",borderRadius:`${x}px`,backdropFilter:"blur(10px)",transition:"all 0.3s ease"},children:c.map((ne,he)=>{let Fe=A===he,ze=sl({index:he,hoveredIndex:A,magnify:P,magnifyScale:w,itemSize:R,gap:C,orientation:ee,liftDirection:O});return(0,Vn.jsxs)("div",{"data-dock-item":!0,className:`sg-dock-item ${b} ${ne.className??""}`,style:{position:"relative",width:R,height:R,transform:`translate3d(${ze.translateX}px, ${ze.translateY}px, 0) scale(${ze.scale})`,transformOrigin:ze.transformOrigin,transition:"transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1)",willChange:"transform",cursor:ne.disabled?"not-allowed":"pointer",opacity:ne.disabled?.5:1,zIndex:ze.zIndex},onMouseEnter:()=>q(he),onMouseLeave:()=>q(null),children:[(0,Vn.jsx)("button",{type:"button",className:"sg-dock-item-icon focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35",style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:`${x*.5}px`,backgroundColor:me,color:K,transition:"background-color 0.2s ease"},onMouseEnter:X=>{X.currentTarget.style.backgroundColor=H},onMouseLeave:X=>{X.currentTarget.style.backgroundColor=me},onClick:()=>Ee(ne),"aria-label":ne.label,title:ne.label,disabled:ne.disabled,children:ne.icon}),ne.badge&&(0,Vn.jsx)("div",{className:"sg-dock-item-badge",style:{position:"absolute",top:-4,right:-4,backgroundColor:"hsl(var(--destructive))",color:"hsl(var(--destructive-foreground))",borderRadius:"50%",minWidth:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:600,padding:"0 4px",boxShadow:"0 2px 4px rgba(0,0,0,0.2)"},children:ne.badge}),B&&Fe&&(0,Vn.jsx)("div",{className:"sg-dock-item-label",style:{position:"absolute",...il(ee,d),backgroundColor:se,color:$e,padding:"4px 8px",borderRadius:6,fontSize:12,fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3},children:ne.label})]},ne.id)})})}),V&&(0,Vn.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:S+1},onClick:()=>U(!1),children:(0,Vn.jsxs)("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:"rgb(var(--sg-surface, 248 250 252))",color:"rgb(var(--sg-text, 15 23 42))",border:"1px solid rgb(var(--sg-border, 226 232 240))",borderRadius:12,padding:24,boxShadow:"0 8px 32px rgba(0,0,0,0.2)",maxWidth:400},onClick:ne=>ne.stopPropagation(),children:[(0,Vn.jsx)("h3",{style:{margin:0,marginBottom:12,fontSize:18,fontWeight:600},children:k(t,"components.dock.resetPosition")}),(0,Vn.jsx)("p",{style:{margin:0,marginBottom:16,fontSize:14,color:"hsl(var(--muted-foreground))"},children:k(t,"components.dock.resetConfirm")}),(0,Vn.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,Vn.jsx)("button",{onClick:()=>U(!1),style:{padding:"8px 16px",borderRadius:6,border:"1px solid hsl(var(--border))",backgroundColor:"rgb(var(--sg-muted-surface, 241 245 249))",color:"rgb(var(--sg-text, 15 23 42))",cursor:"pointer",fontSize:14},children:k(t,"components.actions.cancel")}),(0,Vn.jsx)("button",{onClick:Be,style:{padding:"8px 16px",borderRadius:6,border:"none",backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))",cursor:"pointer",fontSize:14,fontWeight:500},children:k(t,"components.actions.confirm")})]})]})})]})}var $r=je(require("react"),1);var gu=new Set,lr=[],pp=0;function pu(){let e=[...lr];gu.forEach(t=>t(e))}function fp(){return pp+=1,`sg-toast-${Date.now()}-${pp}`}function b0(e){let t=lr.findIndex(n=>n.id===e.id);if(t<0)lr=[...lr,e];else{let r={...lr[t],...e};lr=[...lr.slice(0,t),r,...lr.slice(t+1)]}return pu(),e.id}function Do(e,t,n={}){let r=n.id??fp();return b0({...n,id:r,type:e,title:t,createdAt:Date.now()})}function Xo(e){if(!e){lr=[],pu();return}let t=lr.length;lr=lr.filter(n=>n.id!==e),lr.length!==t&&pu()}function ul(e){return gu.add(e),e([...lr]),()=>{gu.delete(e)}}var Qn=((e,t)=>Do("default",e,t));Qn.message=(e,t)=>Do("default",e,t);Qn.success=(e,t)=>Do("success",e,t);Qn.info=(e,t)=>Do("info",e,t);Qn.warning=(e,t)=>Do("warning",e,t);Qn.error=(e,t)=>Do("error",e,t);Qn.loading=(e,t)=>Do("loading",e,t);Qn.custom=(e,t)=>{let n=t?.id??fp(),r=typeof e=="function"?e(n):e;return Do("default",r,{...t,id:n})};Qn.dismiss=e=>{Xo(e)};Qn.promise=async(e,t,n)=>{let r=typeof e=="function"?e():e,o=bo(),s=Qn.loading(t.loading??k(o,"components.toast.loading"),n);try{let i=await r;if(t.success!==void 0){let c=typeof t.success=="function"?t.success(i):t.success;Qn.success(c,{...n,id:s})}else Qn.dismiss(s);return i}catch(i){if(t.error!==void 0){let c=typeof t.error=="function"?t.error(i):t.error;Qn.error(c,{...n,id:s})}else Qn.dismiss(s);throw i}};var hp=Qn;var bp=0,Jo=[],fu=new Set;function vp(){fu.forEach(e=>e())}function dl(e){Jo.includes(e)||(Jo.push(e),vp())}function ml(e){let t=Jo.indexOf(e);t>=0&&(Jo.splice(t,1),vp())}function Is(){return Jo[Jo.length-1]??null}function Oa(){return Jo.length>0}function za(e){return fu.add(e),()=>{fu.delete(e)}}function gl(){return bp+=1,`sg-toast-host-${bp}`}var yo=require("react/jsx-runtime");function yp(...e){return e.filter(Boolean).join(" ")}var v0={"top-right":"top-4 right-4 items-end","top-left":"top-4 left-4 items-start","top-center":"top-4 left-1/2 -translate-x-1/2 items-center","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},y0={default:{border:"hsl(var(--border))",bg:"hsl(var(--background))",fg:"hsl(var(--foreground))"},success:{border:"#22c55e",bg:"#16a34a",fg:"#ffffff"},info:{border:"#0ea5e9",bg:"#0284c7",fg:"#ffffff"},warning:{border:"#f59e0b",bg:"#f59e0b",fg:"#000000"},error:{border:"#ef4444",bg:"#dc2626",fg:"#ffffff"},loading:{border:"#3b82f6",bg:"#2563eb",fg:"#ffffff"}},x0={default:{border:"hsl(var(--border))",bg:"hsl(var(--background))",fg:"hsl(var(--foreground))"},success:{border:"#86efac",bg:"#f0fdf4",fg:"#14532d"},info:{border:"#7dd3fc",bg:"#f0f9ff",fg:"#0c4a6e"},warning:{border:"#fcd34d",bg:"#fffbeb",fg:"#78350f"},error:{border:"#fca5a5",bg:"#fef2f2",fg:"#7f1d1d"},loading:{border:"#93c5fd",bg:"#eff6ff",fg:"#1e3a8a"}};function S0(e){return e===void 0||Number.isNaN(e)?0:Math.max(0,Math.min(100,e))}function C0(e,t,n){let r=t?y0[e]:x0[e],o=n?.[e];return{border:o?.border??r.border,bg:o?.bg??r.bg,fg:o?.fg??r.fg}}var hu=$r.default.createContext(!1);function pl(e){let t=$r.default.useContext(hu),{position:n="top-right",duration:r=4e3,visibleToasts:o=6,closeButton:s=!0,richColors:i=!0,transparency:c=0,customColors:d,className:u,style:m,...g}=e,h=Me(),[b,S]=$r.default.useState([]),R=$r.default.useRef({}),[C,N]=$r.default.useState(()=>!t&&Oa());$r.default.useEffect(()=>ul(S),[]),$r.default.useEffect(()=>{if(!t)return N(Oa()),za(()=>N(Oa()))},[t]);let B=$r.default.useMemo(()=>o<=0?[]:b.slice(-o),[b,o]);$r.default.useEffect(()=>{let w=new Set;B.forEach(x=>{let I=x.id;if(w.add(I),R.current[I]||x.type==="loading")return;let D=x.duration??r;D<=0||(R.current[I]=setTimeout(()=>{Xo(I),delete R.current[I]},D))}),Object.entries(R.current).forEach(([x,I])=>{w.has(x)||(clearTimeout(I),delete R.current[x])})},[B,r]),$r.default.useEffect(()=>()=>{Object.values(R.current).forEach(w=>clearTimeout(w)),R.current={}},[]);let P=1-S0(c)/100;return C?null:(0,yo.jsx)("div",{className:yp("pointer-events-none fixed z-[1100] flex max-h-screen w-full flex-col gap-2 p-4 sm:w-auto",v0[n],u),style:m,...g,children:B.map(w=>{let x=C0(w.type,i,d),I=w.closeButton??s;return(0,yo.jsxs)("div",{className:yp("pointer-events-auto flex min-w-[260px] max-w-[420px] items-start gap-3 rounded-md border px-3 py-2 shadow-lg",w.className),style:{borderColor:x.border,backgroundColor:x.bg,color:x.fg,opacity:P,...w.style},role:"status","aria-live":"polite",children:[(0,yo.jsxs)("div",{className:"min-w-0 flex-1",children:[w.title?(0,yo.jsx)("div",{className:"text-sm font-semibold",children:w.title}):null,w.description?(0,yo.jsx)("div",{className:"mt-0.5 text-xs opacity-90",children:w.description}):null]}),w.action?(0,yo.jsx)("button",{type:"button",className:"rounded border border-current/30 px-2 py-1 text-xs font-medium opacity-95 hover:opacity-100",onClick:()=>{w.action?.onClick?.(),Xo(w.id)},children:w.action.label}):null,I?(0,yo.jsx)("button",{type:"button",className:"rounded px-1.5 py-0.5 text-xs opacity-80 hover:opacity-100",onClick:()=>Xo(w.id),"aria-label":k(h,"components.toaster.close"),children:"x"}):null]},w.id)})})}var Es=je(require("react"),1);var bu=require("react/jsx-runtime");function xp(e){let t=Es.default.useRef(null);t.current===null&&(t.current=gl());let n=t.current,[r,o]=Es.default.useState(!1);return Es.default.useEffect(()=>(dl(n),o(Is()===n),()=>{ml(n)}),[n]),Es.default.useEffect(()=>za(()=>{o(Is()===n)}),[n]),r?(0,bu.jsx)(hu.Provider,{value:!0,children:(0,bu.jsx)(pl,{...e})}):null}var ta=je(require("react"),1);var vu=new Set,hr=[],Sp=0;function yu(){let e=[...hr];vu.forEach(t=>t(e))}function Rp(){return Sp+=1,`sg-whistle-${Date.now()}-${Sp}`}function xu(e){let t=hr.findIndex(o=>o.id===e.id);if(t<0)return hr=[...hr,e],yu(),e.id;let n=hr[t],r={...n,...e,createdAt:n.createdAt};return hr=[...hr.slice(0,t),r,...hr.slice(t+1)],yu(),r.id}function Cp(e){let t=hr.filter(e);t.length!==0&&(hr=hr.filter(n=>!e(n)),yu(),t.forEach(n=>{n.onClose?.()}))}function kp(e,t,n=e.id??Rp()){return{...e,id:n,severity:e.severity??t,createdAt:Date.now()}}function wp(e,t){if(e!==void 0)return typeof e=="function"?e(t):e}function Va(e){let t=kp(e,e.severity??"default");return xu(t)}function ea(e){if(!e){Cp(()=>!0);return}Cp(t=>t.id===e)}function fl(e){return vu.add(e),e([...hr]),()=>{vu.delete(e)}}var Qo={show(e){return Va({...e,severity:e.severity??"default"})},success(e){return Va({...e,severity:"success"})},info(e){return Va({...e,severity:"info"})},warning(e){return Va({...e,severity:"warning"})},error(e){return Va({...e,severity:"error"})},loading(e){return Va({...e,severity:"loading"})},dismiss(e){ea(e)},update(e,t){let n=hr.find(r=>r.id===e);return n?xu({...n,...t,id:e,createdAt:n.createdAt}):e},custom(e,t={}){let n=t.id??Rp();return xu({...kp(t,t.severity??"default",n),renderer:typeof e=="function"?e(n):e})},async promise(e,t,n){let r=typeof e=="function"?e():e,o=bo(),s=t.loading??{message:k(o,"components.toast.loading")},i=Qo.loading({...n,...s,severity:"loading"});try{let c=await r,d=wp(t.success,c);return d?Qo.update(i,{...n,...d,severity:"success"}):Qo.dismiss(i),c}catch(c){let d=wp(t.error,c);throw d?Qo.update(i,{...n,...d,severity:"error"}):Qo.dismiss(i),c}}};var Jr=require("react/jsx-runtime");function Su(...e){return e.filter(Boolean).join(" ")}var w0={default:{bg:"hsl(var(--background))",fg:"hsl(var(--foreground))",border:"hsl(var(--border))"},success:{bg:"#f0fdf4",fg:"#14532d",border:"#86efac"},info:{bg:"#eff6ff",fg:"#1e3a8a",border:"#93c5fd"},warning:{bg:"#fffbeb",fg:"#78350f",border:"#fcd34d"},error:{bg:"#fef2f2",fg:"#7f1d1d",border:"#fca5a5"},loading:{bg:"#eff6ff",fg:"#1d4ed8",border:"#60a5fa"}};function R0(e){return e===void 0||Number.isNaN(e)?1:Math.max(0,Math.min(1,e))}function k0(e,t){let n=w0[e],r=t?.[e];return{bg:r?.bg??n.bg,fg:r?.fg??n.fg,border:r?.border??n.border}}function P0(e,t){return e==="none"?{borderWidth:0}:e==="left-accent"?{borderWidth:1,borderColor:t.border,borderLeftWidth:4}:e==="full-accent"?{borderWidth:1,borderColor:t.border,boxShadow:`inset 0 0 0 1px ${t.border}`}:e==="soft"?{borderWidth:1,borderColor:t.border,boxShadow:"0 1px 2px rgba(15, 23, 42, 0.06)"}:{borderWidth:1,borderColor:t.border}}function T0(e){return e.renderer!==void 0?e.renderer:(0,Jr.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,Jr.jsx)("div",{className:"text-sm font-semibold",children:e.title}):null,e.message?(0,Jr.jsx)("div",{className:Su(e.title?"mt-0.5":void 0,"text-sm"),children:e.message}):null]})}function Pp(e){let{max:t=4,newestOnTop:n=!1,gap:r=12,customColors:o,className:s,style:i,...c}=e,d=Me(),[u,m]=ta.default.useState([]),g=ta.default.useRef({});ta.default.useEffect(()=>fl(m),[]);let h=ta.default.useMemo(()=>{if(t<=0)return[];let b=u.slice(-t);return n?[...b].reverse():b},[u,t,n]);return ta.default.useEffect(()=>{let b=new Set;h.forEach(S=>{if(b.add(S.id),g.current[S.id]||S.severity==="loading")return;let R=S.duration??5e3;R<=0||(g.current[S.id]=setTimeout(()=>{ea(S.id),delete g.current[S.id]},R))}),Object.entries(g.current).forEach(([S,R])=>{b.has(S)||(clearTimeout(R),delete g.current[S])})},[h]),ta.default.useEffect(()=>()=>{Object.values(g.current).forEach(b=>clearTimeout(b)),g.current={}},[]),(0,Jr.jsx)("div",{className:Su("flex flex-col",s),style:{gap:r,...i},...c,children:h.map(b=>{let S=k0(b.severity,o),R=b.dismissible??!0;return(0,Jr.jsxs)("div",{className:Su("flex items-start gap-3 rounded-lg px-3 py-2",b.borderStyle==="none"?void 0:"border",b.className),style:{backgroundColor:S.bg,color:S.fg,opacity:R0(b.opacity),...P0(b.borderStyle??"solid",S),...b.style},role:"status","aria-live":"polite",children:[b.icon?(0,Jr.jsx)("div",{className:"shrink-0 pt-0.5",children:b.icon}):null,T0(b),b.action?(0,Jr.jsx)("button",{type:"button",className:"shrink-0 rounded border border-current/25 px-2 py-1 text-xs font-medium",onClick:()=>{b.action?.onClick(),ea(b.id)},children:b.action.label}):null,R?(0,Jr.jsx)("button",{type:"button",className:"shrink-0 rounded px-1 py-0.5 text-sm leading-none opacity-80","aria-label":k(d,"components.toaster.close"),onClick:()=>ea(b.id),children:"x"}):null]},b.id)})})}function Cu(e){switch(e){case"horizontal-right":return{orientation:"horizontal",direction:"left"};case"horizontal-left":return{orientation:"horizontal",direction:"right"};case"vertical-up":return{orientation:"vertical",direction:"up"};default:return{orientation:"vertical",direction:"down"}}}function wu(e,t,n){return!t||n=="free"?e:n==="top"||n==="bottom"?e.startsWith("horizontal")?e:"horizontal-left":e.startsWith("vertical")?e:"vertical-down"}function hl(e){let t=e.inDock&&!e.freeDrag&&e.dragHoverZone?e.dragHoverZone:e.effectiveZone,n=wu(e.orientationDirection,e.inDock,t),{orientation:r,direction:o}=Cu(n),s=r==="vertical"&&o==="up",i=r==="horizontal"&&o==="left";return{zoneForOrientation:t,resolvedOrientationDirection:n,orientation:r,direction:o,openUp:s,openLeft:i,showLeadingCollapseButton:r==="horizontal"&&i&&e.showContent,collapseIconDirection:n==="horizontal-right"?"right":o}}var Dn=je(require("react"),1),Np=require("react-dom");var Fn=require("react/jsx-runtime");function xo(...e){return e.filter(Boolean).join(" ")}function N0(e){switch(e){case"sm":return"max-w-sm";case"md":return"max-w-lg";case"lg":return"max-w-2xl";case"xl":return"max-w-4xl";case"full":return"max-w-none w-[calc(100vw-2rem)] h-[calc(100vh-2rem)] max-h-none"}}function M0(e){switch(e){case"primary":return"border-t-[hsl(var(--primary))]";case"secondary":return"border-t-[hsl(var(--secondary))]";case"success":return"border-t-[hsl(var(--tertiary,var(--accent,var(--primary))))]";case"info":return"border-t-[hsl(var(--secondary,var(--primary)))]";case"warning":return"border-t-[hsl(var(--accent,var(--secondary,var(--primary))))]";case"help":return"border-t-[hsl(var(--secondary,var(--primary)))]";case"danger":return"border-t-[hsl(var(--destructive))]";default:return"border-t-[hsl(var(--border))]"}}function I0(e,t){let n=t?"opacity-100":"opacity-0";switch(e){case"fade":return n;case"zoom":return xo(n,t?"scale-100":"scale-95");case"slideUp":return xo(n,t?"translate-y-0":"translate-y-2")}}function E0(e,t){if(e===void 0)return t;if(typeof e!="string")return e;switch(e){case"none":return"none";case"sm":return"0 1px 2px rgba(2, 8, 23, 0.12)";case"md":return"0 10px 24px rgba(2, 8, 23, 0.2), 0 4px 10px rgba(2, 8, 23, 0.12)";case"lg":return"0 24px 60px rgba(2, 8, 23, 0.32), 0 12px 24px rgba(2, 8, 23, 0.18)";default:return e}}function Ds(e){return Math.min(255,Math.max(0,Math.round(e)))}function D0(e){let t=e.replace("#","").trim();if(!t)return null;if(t.length===3||t.length===4){let n=Number.parseInt((t.slice(0,1)||"0").repeat(2),16),r=Number.parseInt((t.slice(1,2)||"0").repeat(2),16),o=Number.parseInt((t.slice(2,3)||"0").repeat(2),16);return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)?null:{r:n,g:r,b:o}}if(t.length===6||t.length===8){let n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),o=Number.parseInt(t.slice(4,6),16);return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)?null:{r:n,g:r,b:o}}return null}function Ru(e){let t=e.trim();if(!t)return null;if(t.endsWith("%")){let r=Number.parseFloat(t.slice(0,-1));return Number.isFinite(r)?Ds(r/100*255):null}let n=Number.parseFloat(t);return Number.isFinite(n)?Ds(n):null}function A0(e){let t=e.match(/^rgba?\((.+)\)$/i);if(!t)return null;let r=(t[1]?.trim()??"").replace(/\s*\/\s*[\d.]+%?\s*$/,""),o=r.includes(",")?r.split(","):r.split(/\s+/);if(o.length<3)return null;let s=Ru(o[0]??""),i=Ru(o[1]??""),c=Ru(o[2]??"");return s===null||i===null||c===null?null:{r:s,g:i,b:c}}function L0(e){let t=e.trim().toLowerCase();if(!t)return null;if(t.endsWith("turn")){let r=Number.parseFloat(t.slice(0,-4));return Number.isFinite(r)?r*360:null}if(t.endsWith("rad")){let r=Number.parseFloat(t.slice(0,-3));return Number.isFinite(r)?r*180/Math.PI:null}if(t.endsWith("deg")){let r=Number.parseFloat(t.slice(0,-3));return Number.isFinite(r)?r:null}let n=Number.parseFloat(t);return Number.isFinite(n)?n:null}function Tp(e){let t=e.trim();if(!t.endsWith("%"))return null;let n=Number.parseFloat(t.slice(0,-1));return Number.isFinite(n)?Math.min(100,Math.max(0,n)):null}function B0(e,t,n){let r=Math.min(1,Math.max(0,t/100)),o=Math.min(1,Math.max(0,n/100)),s=(e%360+360)%360,i=(1-Math.abs(2*o-1))*r,c=i*(1-Math.abs(s/60%2-1)),d=o-i/2,u=0,m=0,g=0;return s<60?(u=i,m=c):s<120?(u=c,m=i):s<180?(m=i,g=c):s<240?(m=c,g=i):s<300?(u=c,g=i):(u=i,g=c),{r:Ds((u+d)*255),g:Ds((m+d)*255),b:Ds((g+d)*255)}}function F0(e){let t=e.match(/^hsla?\((.+)\)$/i);if(!t)return null;let r=(t[1]?.trim()??"").replace(/\s*\/\s*[\d.]+%?\s*$/,""),o=r.includes(",")?r.split(","):r.split(/\s+/);if(o.length<3)return null;let s=L0(o[0]??""),i=Tp(o[1]??""),c=Tp(o[2]??"");return s===null||i===null||c===null?null:B0(s,i,c)}function O0(e){let t=e.trim();return t?t.startsWith("#")?D0(t):/^rgba?\(/i.test(t)?A0(t):/^hsla?\(/i.test(t)?F0(t):null:null}function z0({r:e,g:t,b:n}){let r=o=>{let s=o/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function V0(e){if(typeof e!="string")return null;let t=O0(e);return t?z0(t)>=.56?{foreground:"rgb(17 24 39)",mutedForeground:"rgb(71 85 105)",border:"rgba(15, 23, 42, 0.16)",hoverBg:"rgba(15, 23, 42, 0.08)",activeBg:"rgba(15, 23, 42, 0.14)"}:{foreground:"rgb(243 244 246)",mutedForeground:"rgb(203 213 225)",border:"rgba(248, 250, 252, 0.18)",hoverBg:"rgba(248, 250, 252, 0.08)",activeBg:"rgba(248, 250, 252, 0.14)"}:null}function As(e){let t=Me(),{open:n,onOpenChange:r,defaultOpen:o=!1,title:s,subtitle:i,leading:c,trailing:d,children:u,footer:m,size:g="md",severity:h="plain",animation:b="zoom",transitionMs:S=160,autoCloseMs:R,className:C,style:N,customColor:B,elevation:P,shadow:w,showTopAccent:x=!0,overlayClassName:I,contentClassName:D,headerClassName:F,bodyClassName:v,footerClassName:$,closeable:G=!0,onClose:j,closeOnOverlayClick:_=!0,closeOnEsc:V=!0,lockBodyScroll:U=!0,initialFocusRef:A,restoreFocus:q=!0,ariaLabel:M}=e,T=n!==void 0,[z,ee]=Dn.useState(o),O=T?!!n:z,de=Dn.useCallback(X=>{T||ee(X),r?.(X)},[T,r]),Re=Dn.useCallback(()=>{O&&(de(!1),j?.())},[O,de,j]),[W,Y]=Dn.useState(!1),[me,H]=Dn.useState(O),[K,se]=Dn.useState(!1);Dn.useEffect(()=>Y(!0),[]),Dn.useEffect(()=>{if(O){H(!0);let ae=window.setTimeout(()=>se(!0),0);return()=>window.clearTimeout(ae)}se(!1);let X=window.setTimeout(()=>H(!1),S);return()=>window.clearTimeout(X)},[O,S]),Dn.useEffect(()=>{if(!O||!R||R<=0)return;let X=window.setTimeout(()=>{Re()},R);return()=>window.clearTimeout(X)},[O,R,Re]),Dn.useEffect(()=>{if(!me||!O||!U)return;let X=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=X}},[me,O,U]);let $e=Dn.useRef(null),Ae=Dn.useRef(null),Qe=Dn.useRef(null);Dn.useEffect(()=>{if(!O)return;Qe.current=document.activeElement;let X=A?.current??Ae.current?.querySelector('[data-sg-dialog-initial-focus="true"], button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),ae=window.setTimeout(()=>X?.focus?.(),0);return()=>window.clearTimeout(ae)},[O,A]),Dn.useEffect(()=>{O||q&&Qe.current?.focus?.()},[O,q]),Dn.useEffect(()=>{if(!O||!V)return;let X=ae=>{if(ae.key==="Escape"){ae.preventDefault(),Re();return}if(ae.key==="Tab"){let ie=Ae.current;if(!ie)return;let ve=Array.from(ie.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(ue=>!ue.hasAttribute("disabled")&&ue.getAttribute("aria-hidden")!=="true");if(ve.length===0)return;let Q=ve[0],Pe=ve[ve.length-1];if(!Q||!Pe)return;let at=document.activeElement;!ae.shiftKey&&at===Pe?(ae.preventDefault(),Q.focus()):ae.shiftKey&&at===Q&&(ae.preventDefault(),Pe.focus())}};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[O,V,Re]);let ge=X=>{_&&X.target===$e.current&&Re()},pe=X=>{_&&X.target===X.currentTarget&&Re()};if(!W||!me)return null;let fe=M??(typeof s=="string"?s:void 0)??k(t,"components.dialog.ariaLabel"),We="fixed inset-0 bg-black/60 backdrop-blur-[1px] transition-opacity",Be=K?"opacity-100":"opacity-0",Ee="w-full rounded-2xl bg-background text-foreground shadow-2xl border border-border max-h-[85vh] flex flex-col transition duration-150 ease-out"+(x?" border-t-4":""),ke=E0(P,w),ne=V0(B),he={"--sg-dialog-muted-foreground":ne?.mutedForeground??"hsl(var(--muted-foreground))","--sg-dialog-divider":ne?.border??"hsl(var(--border))","--sg-dialog-hover-bg":ne?.hoverBg??"hsl(var(--muted) / 0.6)","--sg-dialog-active-bg":ne?.activeBg??"hsl(var(--muted))"},Fe={transitionDuration:`${S}ms`},ze={...he,...Fe,...B!==void 0?{backgroundColor:B}:{},...ne?{color:ne.foreground,borderColor:ne.border}:{},...ke!==void 0?{boxShadow:ke}:{}};return(0,Np.createPortal)((0,Fn.jsxs)("div",{className:xo("fixed inset-0 z-[1000]",C),style:N,role:"dialog","aria-modal":"true","aria-label":fe,children:[(0,Fn.jsx)("div",{ref:$e,onMouseDown:ge,className:xo(We,Be,I),style:Fe}),(0,Fn.jsx)("div",{className:"fixed inset-0 flex items-center justify-center p-4",onMouseDown:pe,children:(0,Fn.jsxs)("div",{ref:Ae,className:xo(Ee,N0(g),I0(b,K),x?M0(h):!1,D),style:ze,children:[(s||i||G||c||d)&&(0,Fn.jsxs)("div",{className:xo("px-5 py-4 border-b border-[var(--sg-dialog-divider)] flex items-start gap-3",F),children:[c?(0,Fn.jsx)("div",{className:"shrink-0 pt-0.5",children:c}):null,(0,Fn.jsxs)("div",{className:"min-w-0 flex-1",children:[s?(0,Fn.jsx)("div",{className:"text-base font-semibold leading-6",children:s}):null,i?(0,Fn.jsx)("div",{className:"mt-1 text-sm text-[var(--sg-dialog-muted-foreground)]",children:i}):null]}),(0,Fn.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[d?(0,Fn.jsx)("div",{className:"shrink-0",children:d}):null,G?(0,Fn.jsx)("button",{type:"button",onClick:Re,className:xo("inline-flex items-center justify-center h-9 w-9 rounded-lg","hover:bg-[var(--sg-dialog-hover-bg)] active:bg-[var(--sg-dialog-active-bg)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--ring,var(--primary)))]"),"aria-label":k(t,"components.dialog.close"),children:(0,Fn.jsx)(H0,{})}):null]})]}),(0,Fn.jsx)("div",{className:xo("px-5 py-4 overflow-auto",v),children:u}),m?(0,Fn.jsx)("div",{className:xo("px-5 py-4 border-t border-[var(--sg-dialog-divider)] flex items-center justify-end gap-2",$),children:m}):null]})})]}),document.body)}function H0(){return(0,Fn.jsx)("svg",{viewBox:"0 0 24 24",className:"size-5","aria-hidden":"true",children:(0,Fn.jsx)("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}As.displayName="SgDialog";var Ao=je(require("react"),1);var Lt=require("react/jsx-runtime");function $0(e,t){return!e||e==="plain"?t:e}function _0(){return(0,Lt.jsx)("svg",{viewBox:"0 0 24 24",className:"size-4","aria-hidden":"true",children:(0,Lt.jsx)("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function W0(){return(0,Lt.jsx)("svg",{viewBox:"0 0 24 24",className:"size-4","aria-hidden":"true",children:(0,Lt.jsx)("path",{d:"M5 12l5 5L20 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function q0(){return(0,Lt.jsxs)("svg",{viewBox:"0 0 24 24",className:"size-5 text-sky-600","aria-hidden":"true",children:[(0,Lt.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2"}),(0,Lt.jsx)("path",{d:"M12 10v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,Lt.jsx)("circle",{cx:"12",cy:"7",r:"1.25",fill:"currentColor"})]})}function G0(){return(0,Lt.jsxs)("svg",{viewBox:"0 0 24 24",className:"size-5 text-amber-600","aria-hidden":"true",children:[(0,Lt.jsx)("path",{d:"M12 3L22 20H2L12 3z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),(0,Lt.jsx)("path",{d:"M12 9v5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,Lt.jsx)("circle",{cx:"12",cy:"17.25",r:"1.1",fill:"currentColor"})]})}function U0(){return(0,Lt.jsxs)("svg",{viewBox:"0 0 24 24",className:"size-5 text-red-600","aria-hidden":"true",children:[(0,Lt.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"2"}),(0,Lt.jsx)("path",{d:"M9 9l6 6M15 9l-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function j0(e){switch(e){case"info":return(0,Lt.jsx)(q0,{});case"warning":return(0,Lt.jsx)(G0,{});case"danger":return(0,Lt.jsx)(U0,{});default:return}}function ku(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,onClose:o,title:s,message:i,icon:c,iconPlacement:d="left",severity:u="warning",customColor:m,elevation:g,showSeverityAccent:h=!1,cancelButton:b,confirmButton:S,onCancel:R,onConfirm:C,closeOnCancel:N=!0,closeOnConfirm:B=!0,closeable:P=!1,size:w="sm",...x}=e,I=Me(),D=t!==void 0,[F,v]=Ao.useState(n),$=D?!!t:F,G=Ao.useCallback(W=>{D||v(W),r?.(W)},[D,r]),j=Ao.useCallback(()=>{b?.onClick?.(),R?.()},[b,R]),_=Ao.useCallback(()=>{j(),N&&G(!1)},[j,N,G]),V=Ao.useCallback(()=>{S?.onClick?.(),C?.(),B&&G(!1)},[S,C,B,G]),U=Ao.useCallback(W=>{!W&&$&&j(),G(W)},[$,j,G]),A=b?.label??k(I,"components.actions.cancel"),q=S?.label??k(I,"components.actions.confirm"),M=b?.icon??(0,Lt.jsx)(_0,{}),T=S?.icon??(0,Lt.jsx)(W0,{}),z=c!==void 0?c:j0(u),ee=b?.severity??"secondary",O=S?.severity??$0(u,"primary"),de=b?.appearance===void 0&&b?.severity===void 0&&b?.className===void 0?{bg:"hsl(var(--foreground))",fg:"hsl(var(--foreground))",border:"hsl(var(--border))",hoverBg:"hsl(var(--muted) / 0.8)",hoverFg:"hsl(var(--foreground))",hoverBorder:"hsl(var(--border))",activeBg:"hsl(var(--muted))"}:void 0,Re=(0,Lt.jsx)("div",{className:"text-sm text-muted-foreground",children:i});return(0,Lt.jsx)(As,{...x,open:$,onOpenChange:U,onClose:o,closeable:P,severity:u,showTopAccent:h,customColor:m,elevation:g,title:s,size:w,footer:(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(Tt,{size:"sm",appearance:b?.appearance??"outline",severity:ee,shape:b?.shape??"rounded",disabled:b?.disabled,className:b?.className,customColors:de,leftIcon:M,onClick:_,children:A}),(0,Lt.jsx)(Tt,{size:"sm",appearance:S?.appearance??"solid",severity:O,shape:S?.shape??"rounded",disabled:S?.disabled,className:S?.className,leftIcon:T,onClick:V,children:q})]}),children:z?d==="top"?(0,Lt.jsxs)("div",{className:"flex flex-col items-start gap-3",children:[(0,Lt.jsx)("div",{className:"shrink-0",children:z}),Re]}):(0,Lt.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Lt.jsx)("div",{className:"shrink-0",children:z}),(0,Lt.jsx)("div",{className:"min-w-0",children:Re})]}):Re})}ku.displayName="SgConfirmationDialog";var Ip=je(require("react"),1);var _r=require("react/jsx-runtime");function Lo(...e){return e.filter(Boolean).join(" ")}var Y0={xs:"h-4 px-1.5 text-[11px]",sm:"h-5 px-2 text-xs",md:"h-6 px-2.5 text-sm",lg:"h-7 px-3 text-base"},Pu={xs:"size-3",sm:"size-4",md:"size-4",lg:"size-5"},Mp={primary:{bg:"hsl(var(--primary))",fg:"hsl(var(--primary-foreground))",border:"hsl(var(--primary))",ring:"hsl(var(--ring, var(--primary)))"},secondary:{bg:"hsl(var(--secondary))",fg:"hsl(var(--secondary-foreground))",border:"hsl(var(--secondary))",ring:"hsl(var(--ring, var(--secondary)))"},success:{bg:"hsl(var(--tertiary, var(--accent, var(--primary))))",fg:"hsl(var(--tertiary-foreground, var(--accent-foreground, var(--primary-foreground))))",border:"hsl(var(--tertiary, var(--accent, var(--primary))))",ring:"hsl(var(--ring, var(--tertiary, var(--accent, var(--primary)))))"},warning:{bg:"hsl(var(--accent, var(--secondary, var(--primary))))",fg:"hsl(var(--accent-foreground, var(--secondary-foreground, var(--primary-foreground))))",border:"hsl(var(--accent, var(--secondary, var(--primary))))",ring:"hsl(var(--ring, var(--accent, var(--secondary, var(--primary)))))"},danger:{bg:"hsl(var(--destructive))",fg:"hsl(var(--destructive-foreground))",border:"hsl(var(--destructive))",ring:"hsl(var(--ring, var(--destructive)))"},info:{bg:"hsl(var(--secondary, var(--primary)))",fg:"hsl(var(--secondary-foreground, var(--primary-foreground)))",border:"hsl(var(--secondary, var(--primary)))",ring:"hsl(var(--ring, var(--secondary, var(--primary))))"},neutral:{bg:"hsl(var(--muted))",fg:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",ring:"hsl(var(--ring, var(--muted)))"}};function K0(e,t){let n=e==="custom"?Mp.primary:Mp[e],r=t?.bg??n.bg,o=t?.fg??n.fg,s=t?.border??n.border,i=t?.softBg??`color-mix(in_srgb, ${r} 14%, transparent)`,c=t?.softFg??r,d=t?.hoverBg??`color-mix(in_srgb, ${r} 12%, transparent)`,u=t?.hoverFg??r,m=t?.hoverBorder??s,g=t?.ring??n.ring;return{bg:r,fg:o,border:s,softBg:i,softFg:c,hoverBg:d,hoverFg:u,hoverBorder:m,ring:g}}function Z0(e,t){let n=K0(e,t);return{"--sg-badge-bg":n.bg,"--sg-badge-fg":n.fg,"--sg-badge-border":n.border,"--sg-badge-soft-bg":n.softBg,"--sg-badge-soft-fg":n.softFg,"--sg-badge-hover-bg":n.hoverBg,"--sg-badge-hover-fg":n.hoverFg,"--sg-badge-hover-border":n.hoverBorder,"--sg-badge-ring":n.ring}}function X0(e,t,n){return typeof e=="number"?!n&&e===0?null:typeof t=="number"&&e>t?`${t}+`:String(e):e??null}function Tu(e){let{value:t,severity:n="primary",badgeStyle:r="solid",size:o="md",rounded:s=!0,dot:i=!1,pulse:c=!1,max:d,showZero:u=!0,leftIcon:m,rightIcon:g,removable:h=!1,onRemove:b,removeAriaLabel:S,autoRemove:R=!1,onClick:C,disabled:N,title:B,hint:P,customColors:w,className:x,style:I,partsClassName:D,...F}=e,v=Me(),$=S??k(v,"components.badge.remove"),G=X0(t,d,u),[j,_]=Ip.useState(!1),V=Z0(n,w);if(i)return(0,_r.jsxs)("span",{title:P??B,className:Lo("relative inline-flex items-center justify-center",D?.dot,x),style:{...V,...I},...F,children:[c?(0,_r.jsx)("span",{className:"absolute inline-flex size-3 rounded-full bg-[var(--sg-badge-bg)] opacity-75 animate-ping"}):null,(0,_r.jsx)("span",{className:"inline-flex size-2.5 rounded-full bg-[var(--sg-badge-bg)]"})]});if(j||G===null&&!m&&!g&&!h)return null;let U=typeof C=="function",A=U?"button":"span",q=Lo("inline-flex items-center gap-1.5 whitespace-nowrap font-medium","transition-[color,background-color,border-color] duration-150",Y0[o],s?"rounded-full":"rounded-md",r==="solid"?"bg-[var(--sg-badge-bg)] text-[var(--sg-badge-fg)] border border-[var(--sg-badge-border)]":r==="soft"?"bg-[var(--sg-badge-soft-bg)] text-[var(--sg-badge-soft-fg)] border border-transparent":r==="outline"?"bg-transparent text-[var(--sg-badge-bg)] border border-[var(--sg-badge-border)]":"bg-transparent text-[var(--sg-badge-bg)] border border-transparent",r==="ghost"||r==="outline"?"hover:bg-[var(--sg-badge-hover-bg)] hover:text-[var(--sg-badge-hover-fg)] hover:border-[var(--sg-badge-hover-border)]":"",U?Lo("cursor-pointer select-none","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sg-badge-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background",N?"pointer-events-none opacity-50":""):"",x,D?.container);return(0,_r.jsxs)(A,{type:U?"button":void 0,title:P??B,onClick:N?void 0:C,disabled:U?N:void 0,style:{...V,...I},className:q,role:U?void 0:"status",...F,children:[m?(0,_r.jsx)("span",{className:Lo("inline-flex",Pu[o]),children:m}):null,G!==null?(0,_r.jsx)("span",{className:Lo("inline-flex items-center",D?.label),children:G}):null,g?(0,_r.jsx)("span",{className:Lo("inline-flex",Pu[o]),children:g}):null,h?(0,_r.jsx)("button",{type:"button",onClick:M=>{M.stopPropagation(),R&&_(!0),b?.()},"aria-label":$,className:Lo("ml-0.5 inline-flex items-center justify-center rounded-full","opacity-70 hover:opacity-100","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sg-badge-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background",D?.removeButton),children:(0,_r.jsx)("span",{className:Lo("inline-flex",Pu[o]),children:"x"})}):null]})}Tu.displayName="SgBadge";var bl=require("react/jsx-runtime");function Ep(...e){return e.filter(Boolean).join(" ")}function Nu(e){let{children:t,badge:n,placement:r="top-right",className:o,style:s}=e,i={"top-left":"left-0 top-0 -translate-x-1/3 -translate-y-1/3","top-right":"right-0 top-0 translate-x-1/3 -translate-y-1/3","bottom-left":"left-0 bottom-0 -translate-x-1/3 translate-y-1/3","bottom-right":"right-0 bottom-0 translate-x-1/3 translate-y-1/3",right:"right-0 top-1/2 translate-x-1/2 -translate-y-1/2",left:"left-0 top-1/2 -translate-x-1/2 -translate-y-1/2",top:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2",bottom:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2"};return(0,bl.jsxs)("span",{className:Ep("relative inline-flex",o),style:s,children:[t,(0,bl.jsx)("span",{className:Ep("absolute",i[r]),children:n})]})}Nu.displayName="SgBadgeOverlay";var yl=je(require("react"),1),Mu=require("react/jsx-runtime");function J0(...e){return e.filter(Boolean).join(" ")}function vl(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Iu(e){let{width:t,height:n,size:r,borderRadius:o,shape:s="text",animation:i="wave",className:c,style:d,...u}=e,m=yl.useRef(null);yl.useEffect(()=>{if(i!=="wave")return;let R=m.current;if(!R||typeof R.animate!="function")return;let C=R.animate([{transform:"translateX(-100%)"},{transform:"translateX(100%)"}],{duration:1300,iterations:1/0,easing:"ease-in-out"});return()=>{C.cancel()}},[i]);let g=vl(r),h=g??vl(t)??(s==="square"||s==="circle"?"2.5rem":"100%"),b=g??vl(n)??(s==="text"?"1rem":s==="square"||s==="circle"?"2.5rem":"2rem"),S=vl(o)??(s==="circle"?"9999px":s==="square"?"0":s==="rounded"?"0.75rem":s==="text"?"9999px":"0.375rem");return(0,Mu.jsx)("div",{className:J0("relative block overflow-hidden bg-muted/80",i==="pulse"?"animate-pulse":"",c),style:{width:h,height:b,borderRadius:S,...d},...u,children:i==="wave"?(0,Mu.jsx)("span",{ref:m,"aria-hidden":"true",className:"pointer-events-none absolute inset-0",style:{backgroundImage:"linear-gradient(90deg, transparent 0%, hsl(var(--background) / 0.55) 50%, transparent 100%)",transform:"translateX(-100%)",willChange:"transform"}}):null})}Iu.displayName="SgSkeleton";var qr=je(require("react"),1);var Wr=require("react/jsx-runtime");function na(...e){return e.filter(Boolean).join(" ")}var Q0={xs:{box:"size-6",text:"text-[11px]",icon:"size-3.5"},sm:{box:"size-8",text:"text-xs",icon:"size-4"},md:{box:"size-10",text:"text-sm",icon:"size-5"},lg:{box:"size-14",text:"text-lg",icon:"size-7"},xl:{box:"size-20",text:"text-2xl",icon:"size-9"}},Dp={none:"",sm:"-ml-1",md:"-ml-2",lg:"-ml-3"},Ap={primary:{bg:"hsl(var(--primary))",fg:"hsl(var(--primary-foreground))",border:"hsl(var(--primary))",ring:"hsl(var(--ring, var(--primary)))"},secondary:{bg:"hsl(var(--secondary))",fg:"hsl(var(--secondary-foreground))",border:"hsl(var(--secondary))",ring:"hsl(var(--ring, var(--secondary)))"},success:{bg:"hsl(var(--tertiary, var(--accent, var(--primary))))",fg:"hsl(var(--tertiary-foreground, var(--accent-foreground, var(--primary-foreground))))",border:"hsl(var(--tertiary, var(--accent, var(--primary))))",ring:"hsl(var(--ring, var(--tertiary, var(--accent, var(--primary)))))"},warning:{bg:"hsl(var(--accent, var(--secondary, var(--primary))))",fg:"hsl(var(--accent-foreground, var(--secondary-foreground, var(--primary-foreground))))",border:"hsl(var(--accent, var(--secondary, var(--primary))))",ring:"hsl(var(--ring, var(--accent, var(--secondary, var(--primary)))))"},danger:{bg:"hsl(var(--destructive))",fg:"hsl(var(--destructive-foreground))",border:"hsl(var(--destructive))",ring:"hsl(var(--ring, var(--destructive)))"},info:{bg:"hsl(var(--secondary, var(--primary)))",fg:"hsl(var(--secondary-foreground, var(--primary-foreground)))",border:"hsl(var(--secondary, var(--primary)))",ring:"hsl(var(--ring, var(--secondary, var(--primary))))"},neutral:{bg:"hsl(var(--muted))",fg:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",ring:"hsl(var(--ring, var(--muted)))"}};function ex(e,t){let n=e==="custom"?Ap.primary:Ap[e];return{bg:t?.bg??n.bg,fg:t?.fg??n.fg,border:t?.border??n.border,ring:t?.ring??n.ring}}function tx(e,t){let n=ex(e,t);return{"--sg-avatar-bg":n.bg,"--sg-avatar-fg":n.fg,"--sg-avatar-border":n.border,"--sg-avatar-ring":n.ring}}function xl(e){return e==null||e===!1?!1:typeof e=="string"?e.trim().length>0:!0}function nx(e){if(typeof e!="string")return e;let t=e.trim();if(!t)return"";if(t.length<=2)return t.toUpperCase();let n=t.split(/\s+/).filter(Boolean);return n.length>=2?`${n[0]?.[0]??""}${n[1]?.[0]??""}`.toUpperCase():t.slice(0,2).toUpperCase()}var ra=qr.forwardRef(({src:e,alt:t,label:n,icon:r,fallback:o,size:s="md",shape:i="circle",severity:c="primary",bordered:d=!0,disabled:u=!1,customColors:m,className:g,imageClassName:h,children:b,onImageError:S,onClick:R,role:C,tabIndex:N,style:B,title:P,["aria-label"]:w,...x},I)=>{let D=Me(),[F,v]=qr.useState(!1),$=Q0[s];qr.useEffect(()=>{v(!1)},[e]);let G=xl(b),j=!G&&!!e&&!F,_=!G&&!j&&xl(r),V=!G&&!j&&!_&&xl(n),U=typeof R=="function"||C==="button"||typeof N=="number",A=t??k(D,"components.avatar.defaultAlt"),q=w??(typeof n=="string"?n:A),M=s==="xs"||s==="sm"?"rounded-md":"rounded-xl";return(0,Wr.jsx)("span",{ref:I,title:P,role:C,tabIndex:N,onClick:u?void 0:R,"aria-label":q,style:{...tx(c,m),...B},className:na("relative inline-flex shrink-0 select-none items-center justify-center overflow-hidden","font-medium leading-none",$.box,$.text,i==="circle"?"rounded-full":M,d?"border border-[var(--sg-avatar-border)]":"border border-transparent",j?"bg-muted text-transparent":"bg-[var(--sg-avatar-bg)] text-[var(--sg-avatar-fg)]",U?"cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--sg-avatar-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background":"",u?"pointer-events-none opacity-55":"",g),...x,children:G?b:j?(0,Wr.jsx)("img",{src:e,alt:A,loading:"lazy",draggable:!1,className:na("size-full object-cover",h),onError:T=>{v(!0),S?.(T)}}):_?(0,Wr.jsx)("span",{className:na("inline-flex items-center justify-center",$.icon),children:r}):V?(0,Wr.jsx)("span",{className:"uppercase",children:nx(n)}):(0,Wr.jsx)("span",{className:na("inline-flex items-center justify-center",$.icon),children:xl(o)?o:"?"})})});ra.displayName="SgAvatar";var Eu=qr.forwardRef(({children:e,max:t,total:n,overlap:r="md",moreSeverity:o="neutral",moreLabel:s,size:i="md",shape:c="circle",bordered:d=!0,className:u,...m},g)=>{let h=qr.Children.toArray(e).filter(B=>B!=null),b=typeof t=="number"&&Number.isFinite(t)&&t>0?Math.floor(t):void 0,S=b?Math.min(b,h.length):h.length,R=h.slice(0,S),C=Math.max(n??h.length,h.length),N=Math.max(C-S,0);return(0,Wr.jsxs)("div",{ref:g,className:na("inline-flex items-center",u),...m,children:[R.map((B,P)=>{let w=qr.isValidElement(B)&&B.key!=null?String(B.key):`sg-avatar-${P}`;return(0,Wr.jsx)("span",{className:na("inline-flex",P===0?"":Dp[r]),children:B},w)}),N>0?(0,Wr.jsx)("span",{className:na("inline-flex",S===0?"":Dp[r]),children:(0,Wr.jsx)(ra,{label:s?s(N):`+${N}`,size:i,shape:c,severity:o,bordered:d})}):null]})});Eu.displayName="SgAvatarGroup";var aa=je(require("react"),1),Bo=require("react/jsx-runtime");function oa(...e){return e.filter(Boolean).join(" ")}function Qr(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Bs(e){if(e!=null)return typeof e=="number"?`${e}%`:e}function rx(e){return e==="top"||e==="bottom"?"row":"column"}function ox(e){return e==="top"||e==="bottom"?"start":"stretch"}function ax(){return 10}function Lp(e){return{start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"}[e]}function Bp(e){return{start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"}[e]}function sx(e){if(!aa.isValidElement(e))return!1;let t=e.type;return(t.displayName??t.name)==="SgPanel"&&e.props.align!==void 0}function Du(e,t,n,r){if(!aa.isValidElement(e))return(0,Bo.jsx)("div",{style:n,className:r,children:e},t);let o=e,s={...o.props.style??{},...n};return aa.cloneElement(o,{key:o.key??t,className:oa(o.props.className,r),style:s})}function Ls(e,t,n){if(n==="top"||n==="bottom"){let r=Bs(e.height);return Du(e.node,e.key??`${n}-${t}`,{width:"100%",minWidth:0,...e.minHeightPx!==void 0?{minHeight:`${e.minHeightPx}px`}:null,...r!==void 0?{height:r,flex:`0 0 ${r}`}:{height:"auto",flex:"0 0 auto"}},"w-full min-w-0")}if(n==="left"||n==="right"){let r=Bs(e.width);return Du(e.node,e.key??`${n}-${t}`,{height:"100%",minWidth:0,minHeight:0,...e.minWidthPx!==void 0?{minWidth:`${e.minWidthPx}px`}:null,...r!==void 0?{width:r,flex:`0 0 ${r}`}:{width:"auto",flex:"0 0 auto"}},"h-full min-h-0 min-w-0")}return Du(e.node,e.key??`client-${t}`,{width:"100%",height:"100%",minWidth:0,minHeight:0,flex:"1 1 0%"},"h-full w-full min-h-0 min-w-0")}function Sl(e){let{children:t,align:n,contentDirection:r,contentGap:o,contentJustify:s,contentAlign:i,contentWrap:c,contentClassName:d,contentStyle:u}=e,m=r??rx(n),g=o??ax(),h=s??"start",b=i??ox(n),S=c??!1,R=Qr(g),C=[],N=[];aa.Children.forEach(t,(F,v)=>{if(sx(F)){C.push({key:F.key??`dock-${v}`,node:F,align:F.props.align??"client",width:F.props.width,height:F.props.height,minWidthPx:F.props.minWidthPx,minHeightPx:F.props.minHeightPx});return}N.push(F)});let B=C.filter(F=>F.align==="top"),P=C.filter(F=>F.align==="bottom"),w=C.filter(F=>F.align==="left"),x=C.filter(F=>F.align==="right"),I=C.filter(F=>F.align==="client");return C.length>0?(0,Bo.jsxs)("div",{className:"flex flex-1 min-h-0 min-w-0 flex-col",style:R?{gap:R}:void 0,children:[B.map((F,v)=>Ls(F,v,"top")),(0,Bo.jsxs)("div",{className:"flex flex-1 min-h-0 min-w-0",style:R?{gap:R}:void 0,children:[w.map((F,v)=>Ls(F,v,"left")),(0,Bo.jsxs)("div",{className:"flex flex-1 min-h-0 min-w-0",style:R?{gap:R}:void 0,children:[I.map((F,v)=>Ls(F,v,"client")),N.length>0?(0,Bo.jsx)("div",{className:oa("flex flex-1 min-h-0 min-w-0",m==="row"?"flex-row":"flex-col",Lp(h),Bp(b),S?"flex-wrap":"",d),style:{gap:Qr(g),...u},children:N}):null]}),x.map((F,v)=>Ls(F,v,"right"))]}),P.map((F,v)=>Ls(F,v,"bottom"))]}):(0,Bo.jsx)("div",{className:oa("flex flex-1 min-h-0 min-w-0",m==="row"?"flex-row":"flex-col",Lp(h),Bp(b),S?"flex-wrap":"",d),style:{gap:Qr(g),...u},children:t})}var Au=require("react/jsx-runtime");function Fs(e){let{fullscreen:t=!0,width:n,height:r,padding:o,className:s,style:i,children:c,...d}=e;return(0,Au.jsx)("div",{className:oa("relative box-border flex flex-1 self-stretch min-h-0 min-w-0 max-h-full max-w-full overflow-hidden",s),style:{...i,...n!==void 0?{width:Qr(n)}:t?{width:"100%"}:null,...r!==void 0?{height:Qr(r)}:t?{height:"100dvh"}:null,padding:Qr(o)},...d,children:(0,Au.jsx)("div",{className:"flex flex-1 min-h-0 min-w-0 flex-col",children:Sl({children:c,align:"client"})})})}Fs.displayName="SgScreen";var Fp=require("react/jsx-runtime");function ix(e){return e?e===!0||e==="auto"?"overflow-auto":e==="y"?"overflow-y-auto overflow-x-hidden":"overflow-x-auto overflow-y-hidden":"overflow-hidden"}function Lu(e){let{align:t="client",width:n,height:r,minWidthPx:o,minHeightPx:s,borderStyle:i="dashed",padding:c,contentPadding:d,scrollable:u=!1,scrollbarGutter:m=!1,contentDirection:g,contentGap:h,contentJustify:b,contentAlign:S,contentWrap:R,contentClassName:C,contentStyle:N,className:B,style:P,children:w,...x}=e,I=i==="none"?"border border-transparent":i==="solid"?"border border-solid border-border":"border border-dashed border-border",D=Bs(n),F=Bs(r),v=Sl({children:w,align:t,contentDirection:g,contentGap:h,contentJustify:b,contentAlign:S,contentWrap:R,contentClassName:C,contentStyle:N});return(0,Fp.jsx)("div",{className:oa("flex box-border min-h-0 min-w-0 max-w-full flex-col bg-background",I,ix(u),B),style:{...P,...D!==void 0?{width:D}:null,...F!==void 0?{height:F}:null,...o!==void 0?{minWidth:`${o}px`}:null,...s!==void 0?{minHeight:`${s}px`}:null,margin:Qr(c),padding:Qr(d),...m?{scrollbarGutter:"stable"}:null},...x,children:v})}Lu.displayName="SgPanel";var eo=je(require("react"),1),Fo=require("react/jsx-runtime");function lx(...e){return e.filter(Boolean).join(" ")}function Cl(e){if(e!=null)return typeof e=="number"?`${e}px`:e}var Op={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};function cx(e){return e?typeof e=="number"?{base:e}:{base:e.base??1,...e}:{base:1}}function ux(e){return e?{start:"start",center:"center",end:"end",stretch:"stretch",between:"space-between",around:"space-around",evenly:"space-evenly"}[e]:void 0}function dx(e){return e?{start:"start",center:"center",end:"end",stretch:"stretch"}[e]:void 0}function Bu(e){let{columns:t,minItemWidth:n,gap:r=0,padding:o,dense:s=!1,rowHeight:i,justify:c,align:d,className:u,style:m,children:g,...h}=e,b=eo.useId().replace(/:/g,""),S=cx(t),R=eo.useMemo(()=>{if(n)return"";let B=[];return B.push(`[data-sg-grid="${b}"]{--sg-grid-cols:${S.base};}`),Object.keys(Op).forEach(P=>{let w=S[P];!w||w<1||B.push(`@media (min-width:${Op[P]}px){[data-sg-grid="${b}"]{--sg-grid-cols:${w};}}`)}),B.join(`
98
98
  `)},[b,n,S]),C=n?`repeat(auto-fit, minmax(${Cl(n)}, 1fr))`:"repeat(var(--sg-grid-cols), minmax(0, 1fr))",N=eo.Children.toArray(g);return(0,Fo.jsxs)(Fo.Fragment,{children:[R?(0,Fo.jsx)("style",{children:R}):null,(0,Fo.jsx)("div",{"data-sg-grid":b,className:lx("grid min-h-0 min-w-0",u),style:{...m,gridTemplateColumns:C,gap:Cl(r),padding:Cl(o),gridAutoRows:Cl(i),gridAutoFlow:s?"dense":void 0,justifyContent:ux(c),alignItems:dx(d)},...h,children:N.map((B,P)=>{if(!eo.isValidElement(B))return B;let w=B,x=w.props?.span,I=w.props?.rowSpan,D=typeof x=="number"&&x>1,F=typeof I=="number"&&I>1;if(!D&&!F)return eo.cloneElement(w,{key:w.key??`grid-item-${P}`});let v={};return D&&(v.gridColumn=`span ${x} / span ${x}`),F&&(v.gridRow=`span ${I} / span ${I}`),(0,Fo.jsx)("div",{className:"min-h-0 min-w-0",style:v,children:w},B.key??`grid-wrap-${P}`)})})]})}Bu.displayName="SgGrid";var zp=require("react/jsx-runtime");function mx(...e){return e.filter(Boolean).join(" ")}function gx(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function Fu(e){let{direction:t="column",gap:n=0,justify:r="start",align:o="stretch",wrap:s=!1,grow:i=!1,className:c,style:d,children:u,...m}=e,g={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"},h={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"};return(0,zp.jsx)("div",{className:mx("flex min-h-0 min-w-0",t==="row"?"flex-row":"flex-col",g[r],h[o],s?"flex-wrap":"",i?"flex-1":"",c),style:{...d,gap:gx(n)},...m,children:u})}Fu.displayName="SgStack";var kn=je(require("react"),1);var yn=require("react/jsx-runtime");function br(...e){return e.filter(Boolean).join(" ")}function Vp(e){let t=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return null}})():e;return!t||typeof t!="object"||typeof t.x!="number"||typeof t.y!="number"||!Number.isFinite(t.x)||!Number.isFinite(t.y)?null:{x:t.x,y:t.y}}function px(e,t){return typeof e=="string"&&e.trim().length>0?`${e} ${t}`:t}function fx({open:e,size:t}){return(0,yn.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",className:br("shrink-0 transition-transform duration-200",e?"rotate-90":"rotate-0"),"aria-hidden":"true",children:(0,yn.jsx)("path",{fill:"currentColor",d:"M9.29 6.71a1 1 0 0 0 0 1.41L13.17 12l-3.88 3.88a1 1 0 1 0 1.41 1.41l4.59-4.59a1 1 0 0 0 0-1.41L10.7 6.7a1 1 0 0 0-1.41.01Z"})})}function So(e){let t=Me(),{id:n,className:r,headerClassName:o,bodyClassName:s,footerClassName:i,bgColor:c,bgColorTitle:d,bgColorFooter:u,cardStyle:m="default",size:g="md",leading:h,trailing:b,trailer:S,title:R,description:C,actions:N,header:B,footer:P,clickable:w=!1,disabled:x=!1,collapsible:I=!1,defaultOpen:D=!0,open:F,onOpenChange:v,collapseIcon:$,collapseIconSize:G=18,collapseToggleAlign:j="left",toggleOnHeaderClick:_=!0,draggable:V=!1,defaultPosition:U,dragPersistKey:A,onPositionChange:q,style:M,onClick:T,children:z,...ee}=e,O=Hr(),{load:de,save:Re,clear:W}=fr(),Y=(w||typeof T=="function")&&!I&&!V,me=b??S,[H,K]=kn.useState({x:U?.x??0,y:U?.y??0}),se=kn.useRef(H),[$e,Ae]=kn.useState(!1),[Qe,ge]=kn.useState(!1),pe=kn.useRef(null),fe=kn.useRef(!1),We=kn.useMemo(()=>typeof A=="string"&&A.trim().length>0?A.trim():typeof n=="string"&&n.trim().length>0?`sg-card-pos:${n.trim()}`:null,[A,n]);kn.useEffect(()=>{se.current=H,q?.(H)},[H,q]),kn.useEffect(()=>{if(!V){Ae(!1);return}let Le=!0;return(async()=>{let Je=null;if(We)if(O)try{let ct=await de(We);Je=Vp(ct),!Je&&ct!==null&&ct!==void 0&&await W(We)}catch{Je=null}else try{let ct=localStorage.getItem(We);Je=Vp(ct),!Je&&ct!==null&&localStorage.removeItem(We)}catch{Je=null}Le&&(K(Je||{x:U?.x??0,y:U?.y??0}),Ae(!0))})(),()=>{Le=!1}},[W,U?.x,U?.y,We,V,O,de]),kn.useEffect(()=>{if(!(!V||!$e||!We||Qe)){if(O){Re(We,H);return}try{localStorage.setItem(We,JSON.stringify(H))}catch{}}},[$e,H,We,V,Qe,O,Re]);let[Be,Ee]=kn.useState(D),ke=typeof F=="boolean",ne=I?ke?F:Be:!0,he=kn.useCallback(Le=>{I&&(ke||Ee(Le),v?.(Le))},[I,ke,v]),Fe=g==="sm"?{root:"rounded-xl",header:"px-3 py-2",body:"px-3 py-3",footer:"px-3 py-2",title:"text-sm",desc:"text-xs"}:g==="lg"?{root:"rounded-2xl",header:"px-6 py-4",body:"px-6 py-6",footer:"px-6 py-4",title:"text-base",desc:"text-sm"}:{root:"rounded-2xl",header:"px-4 py-3",body:"px-4 py-4",footer:"px-4 py-3",title:"text-sm",desc:"text-xs"},ze=m==="flat"?"bg-background border border-border/60 shadow-none":m==="outlined"?"bg-background border border-border shadow-none":m==="elevated"?"bg-background border border-border shadow-md":"bg-background border border-border shadow-sm",X=Y?br("transition-[box-shadow,transform] duration-150","hover:shadow-md","focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-[hsl(var(--primary)/0.35)]",x?"":"cursor-pointer",x?"":"active:translate-y-[0.5px]"):"",ae=x?"opacity-60 pointer-events-none select-none":"",ie=br("w-full",Fe.root,ze,X,ae,V?"touch-none":"",r),ve=kn.useCallback(()=>he(!ne),[ne,he]),Q=()=>{if(fe.current){fe.current=!1;return}I&&_&&(x||ve())},Pe=kn.useCallback(Le=>{if(!V||x||Le.button!==0)return;let ct=Le.target?.closest('[data-sg-card-toggle="true"],button,a,input,textarea,select,[role="button"],[data-sg-card-no-drag="true"]');ct&&ct!==Le.currentTarget||(pe.current={pointerId:Le.pointerId,startX:Le.clientX,startY:Le.clientY,originX:se.current.x,originY:se.current.y,moved:!1},Le.currentTarget.setPointerCapture?.(Le.pointerId),ge(!0),Le.preventDefault())},[x,V]),at=kn.useCallback(Le=>{let Je=pe.current;if(!Je||Je.pointerId!==Le.pointerId)return;let ct=Le.clientX-Je.startX,it=Le.clientY-Je.startY;!Je.moved&&(Math.abs(ct)>2||Math.abs(it)>2)&&(Je.moved=!0),K({x:Je.originX+ct,y:Je.originY+it}),Je.moved&&Le.preventDefault()},[]),ue=kn.useCallback(Le=>{let Je=pe.current;if(!(!Je||Je.pointerId!==Le.pointerId)){Je.moved&&(fe.current=!0),pe.current=null,ge(!1);try{Le.currentTarget.releasePointerCapture?.(Le.pointerId)}catch{}}},[]),Z=x?"":V?Qe?"cursor-grabbing":"cursor-grab":I&&_?"cursor-pointer":"",J=I?(0,yn.jsx)("button",{"data-sg-card-toggle":"true",type:"button",onClick:Le=>{Le.stopPropagation(),ve()},className:br("inline-flex h-9 w-9 items-center justify-center rounded-md","text-muted-foreground hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--primary)/0.35)]"),"aria-label":ne?k(t,"components.actions.collapse"):k(t,"components.actions.expand"),"aria-expanded":ne,disabled:x,children:$??(0,yn.jsx)(fx,{open:ne,size:G})}):null,be=!!B||!!h||!!R||!!C||!!me||!!N||I?(0,yn.jsxs)("div",{className:br("flex items-start gap-3","border-b border-border/60",Fe.header,o,Z),style:d?{backgroundColor:d}:void 0,onClick:Q,onPointerDown:Pe,onPointerMove:at,onPointerUp:ue,onPointerCancel:ue,role:I&&_?"button":void 0,tabIndex:I&&_&&!x?0:void 0,onKeyDown:Le=>{!I||!_||x||(Le.key==="Enter"||Le.key===" ")&&(Le.preventDefault(),ve())},"aria-expanded":I?ne:void 0,children:[j==="left"?J:null,h?(0,yn.jsx)("div",{className:"shrink-0 pt-0.5",children:h}):null,(0,yn.jsxs)("div",{className:"min-w-0 flex-1",children:[R?(0,yn.jsx)("div",{className:br("font-medium text-foreground",Fe.title),children:R}):null,C?(0,yn.jsx)("div",{className:br("mt-0.5 text-muted-foreground",Fe.desc),children:C}):null]}),(0,yn.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[me?(0,yn.jsx)("div",{className:"shrink-0",children:me}):null,N?(0,yn.jsx)("div",{className:"shrink-0",children:N}):null,j==="right"?J:null]})]}):null,qe=B?(0,yn.jsx)("div",{className:br("border-b border-border/60",Fe.header,o,Z),style:d?{backgroundColor:d}:void 0,onClick:Q,onPointerDown:Pe,onPointerMove:at,onPointerUp:ue,onPointerCancel:ue,role:I&&_?"button":void 0,tabIndex:I&&_&&!x?0:void 0,onKeyDown:Le=>{!I||!_||x||(Le.key==="Enter"||Le.key===" ")&&(Le.preventDefault(),ve())},"aria-expanded":I?ne:void 0,children:B}):be,Ne=I?(0,yn.jsx)("div",{className:br("grid transition-all duration-200 ease-out motion-reduce:transition-none",ne?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"),children:(0,yn.jsxs)("div",{className:ne?"overflow-visible":"overflow-hidden",children:[(0,yn.jsx)("div",{className:br(Fe.body,s),children:z}),P?(0,yn.jsx)("div",{className:br("border-t border-border/60",Fe.footer,i),style:u?{backgroundColor:u}:void 0,children:P}):null]})}):null,le=I?null:(0,yn.jsx)("div",{className:br(Fe.body,s),children:z}),Ye=!I&&P?(0,yn.jsx)("div",{className:br("border-t border-border/60",Fe.footer,i),style:u?{backgroundColor:u}:void 0,children:P}):null,_e=Y?"button":"section",we=Y?{type:"button",onClick:x?void 0:T,disabled:x}:{},xe=!Y&&typeof T=="function"?{onClick:x?void 0:T}:{},Ce=Math.round(H.x),Te=Math.round(H.y),De=V&&(Qe||Ce!==0||Te!==0),Ve={...M,backgroundColor:c??M?.backgroundColor,transform:De?px(M?.transform,`translate3d(${Ce}px, ${Te}px, 0)`):M?.transform,willChange:De?"transform":M?.willChange};return(0,yn.jsxs)(_e,{id:n,className:ie,style:Ve,...we,...xe,...ee,children:[qe,I?Ne:null,I?null:le,I?null:Ye]})}So.displayName="SgCard";var Ir=je(require("react"),1),cn=require("react/jsx-runtime");function sa(...e){return e.filter(Boolean).join(" ")}function Hp(e){if(e!=null)return typeof e=="number"?`${e}px`:e}function wl(e,t,n){if(e===void 0)return[];let o=(Array.isArray(e)?e:[e]).filter(i=>Number.isInteger(i)).map(i=>Number(i)).filter(i=>i>=0&&i<t),s=Array.from(new Set(o)).sort((i,c)=>i-c);return n?s:s.slice(0,1)}function $p(e){let t=e.horizontal?e.open?"rotate-180":"rotate-90":e.open?"rotate-180":"rotate-0";return(0,cn.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:sa("transition-transform duration-200",t),"aria-hidden":"true",children:(0,cn.jsx)("polyline",{points:"6 9 12 15 18 9"})})}var hx="var(--sg-accordion-header-bg, rgb(var(--sg-primary-50, 239 246 255)))";function Ou(e){let{id:t,items:n,orientation:r="vertical",multiple:o=!1,collapsible:s=!0,activeIndex:i,defaultActiveIndex:c,defaultOpenFirst:d=!0,onActiveIndexChange:u,onItemToggle:m,panelClassName:g,headerClassName:h,headerBackgroundColor:b,contentClassName:S,animationDuration:R=220,horizontalHeaderWidth:C=52,horizontalMinHeight:N=220,keepMounted:B=!0,className:P,...w}=e,x=Ir.useId().replace(/[:]/g,""),I=(t??`sg-accordion-${x}`).replace(/\s+/g,"-"),D=r==="horizontal",F=Hp(C)??"52px",v=Hp(N)??"220px",$=i!==void 0,G=Ir.useMemo(()=>wl(i,n.length,o),[i,n.length,o]),[j,_]=Ir.useState(()=>{let M=c!==void 0?c:d&&n.length>0?0:[];return wl(M,n.length,o)});Ir.useEffect(()=>{$||_(M=>wl(M,n.length,o))},[$,n.length,o]);let V=$?G:j,U=Ir.useMemo(()=>new Set(V),[V]),A=Ir.useCallback(M=>{let T=wl(M,n.length,o);$||_(T),u?.(T)},[$,n.length,o,u]),q=Ir.useCallback(M=>{let T=n[M];if(!T||T.disabled)return;let z=U.has(M);if(z&&!s)return;let ee;z?ee=V.filter(O=>O!==M):ee=o?[...V,M]:[M],A(ee),m?.(M,!z)},[n,U,s,V,o,A,m]);return(0,cn.jsx)("div",{className:sa(D?"flex w-full gap-2 overflow-x-auto":"space-y-2",P),"data-orientation":r,...w,children:n.map((M,T)=>{let z=U.has(T),ee=`${I}-panel-${M.id??T}`,O=`${I}-header-${M.id??T}`,de=`${I}-content-${M.id??T}`,Re=M.headerBackgroundColor??b??hx,W=sa("inline-flex items-center gap-2 text-left font-medium transition-[filter,colors] duration-150","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",M.disabled?"cursor-not-allowed opacity-55":"cursor-pointer hover:brightness-95");return(0,cn.jsxs)("div",{id:ee,className:sa("border border-border bg-background",D?"flex min-w-0 overflow-hidden rounded-lg":"overflow-hidden rounded-lg",g,M.className),style:D?{minHeight:v,flex:z?"1 1 0%":"0 0 auto",transition:`flex-basis ${R}ms ease`}:void 0,children:[(0,cn.jsx)("button",{id:O,type:"button",disabled:M.disabled,"aria-controls":de,"aria-expanded":z,className:sa(W,D?"h-full flex-col justify-between border-r border-border px-2 py-3 text-[11px] uppercase tracking-wide":"w-full justify-between px-4 py-3 text-sm",h,M.headerClassName),style:D?{width:F,backgroundColor:Re}:{backgroundColor:Re},onClick:()=>q(T),children:D?(0,cn.jsxs)(cn.Fragment,{children:[(0,cn.jsx)($p,{open:z,horizontal:!0}),(0,cn.jsx)("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},className:"line-clamp-1 select-none text-center text-[10px] font-semibold tracking-wide",children:M.title}),M.icon?(0,cn.jsx)("span",{className:"opacity-80",children:M.icon}):(0,cn.jsx)("span",{"aria-hidden":"true"})]}):(0,cn.jsxs)(cn.Fragment,{children:[(0,cn.jsxs)("span",{className:"inline-flex items-center gap-2",children:[M.icon?(0,cn.jsx)("span",{className:"opacity-80",children:M.icon}):null,(0,cn.jsx)("span",{children:M.title})]}),(0,cn.jsxs)("span",{className:"inline-flex items-center gap-2",children:[M.end?(0,cn.jsx)("span",{children:M.end}):null,(0,cn.jsx)($p,{open:z,horizontal:!1})]})]})}),(0,cn.jsx)("div",{id:de,role:"region","aria-labelledby":O,className:sa("overflow-hidden",S,M.contentClassName),style:D?{width:z?"100%":"0px",opacity:z?1:0,transition:`width ${R}ms ease, opacity ${R}ms ease`}:{maxHeight:z?"960px":"0px",opacity:z?1:0,transition:`max-height ${R}ms ease, opacity ${R}ms ease`},children:B||z?(0,cn.jsx)("div",{className:sa(D?"h-full min-w-[220px] p-4":"p-4"),children:M.content}):null})]},ee)})})}Ou.displayName="SgAccordion";var Gr=je(require("react"),1),Oo=require("lucide-react");var Xn=require("react/jsx-runtime");function _p(e){let t=Me(),{id:n,items:r,numVisible:o=1,numScroll:s=1,orientation:i="horizontal",circular:c=!0,autoPlay:d=!1,autoPlayInterval:u=3e3,showNavigators:m=!0,showIndicators:g=!0,className:h="",itemClassName:b="",width:S="100%",height:R,gap:C=16,onIndexChange:N,style:B,customNavigators:P}=e,[w,x]=Gr.default.useState(0),[I,D]=Gr.default.useState(!1),F=Gr.default.useRef(null),v=Gr.default.useRef(null),$=Gr.default.useRef(w),[G,j]=Gr.default.useState({width:0,height:0}),_=Math.max(1,o),V=Math.max(1,s),U=r.length,A=Math.max(U-_,0),q=U===0?0:Math.floor(A/V)+1,M=i==="horizontal";Gr.default.useEffect(()=>(d&&!I&&(F.current=setInterval(()=>{T()},u)),()=>{F.current&&clearInterval(F.current)}),[d,u,I,w]),Gr.default.useEffect(()=>{x(K=>Math.min(Math.max(K,0),A))},[A]),Gr.default.useEffect(()=>{$.current!==w&&($.current=w,N?.(w))},[w,N]),Gr.default.useEffect(()=>{let K=v.current;if(!K)return;let se=()=>{let Ae=K.getBoundingClientRect();j({width:Ae.width,height:Ae.height})};if(se(),typeof ResizeObserver>"u")return window.addEventListener("resize",se),()=>{window.removeEventListener("resize",se)};let $e=new ResizeObserver(se);return $e.observe(K),()=>{$e.disconnect()}},[]);let T=()=>{x(K=>{if(U===0)return 0;let se=K+V;return se>A?c?0:A:se})},z=()=>{x(K=>{if(U===0)return 0;let se=K-V;return se<0?c?A:0:se})},ee=K=>{let se=Math.min(K*V,A);x(se)},O=c?A>0:w>0,de=c?A>0:w<A,Re=100/_,W=C*(_-1)/_,Y=`calc(${Re}% - ${W}px)`,me=()=>{let K=M?G.width:G.height;if(K>0){let ge=Math.max(0,(K-C*(_-1))/_)+C,pe=w*ge;return M?`translate3d(-${pe}px, 0, 0)`:`translate3d(0, -${pe}px, 0)`}let se=100/_,$e=w*C/_,Ae=w*se;return M?`translateX(calc(-${Ae}% - ${$e}px))`:`translateY(calc(-${Ae}% - ${$e}px))`},H=({direction:K,onClick:se,disabled:$e})=>{let Ae=K==="prev",Qe=M?Ae?Oo.ChevronLeft:Oo.ChevronRight:Ae?Oo.ChevronUp:Oo.ChevronDown,ge=Ae?P?.prev:P?.next;return ge?(0,Xn.jsx)("button",{type:"button",onClick:se,disabled:$e,className:`
99
99
  absolute z-10 flex items-center justify-center transition-all
100
100
  ${$e?"opacity-30 cursor-not-allowed":"hover:opacity-100 cursor-pointer"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedgrid/fe-components",
3
- "version": "2026.4.13",
3
+ "version": "2026.4.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {