plainframe-ui 0.1.42 → 0.1.43

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import me,{forwardRef,createContext,useId,useMemo,useState,useCallback,useRef,useEffect,useContext,isValidElement,cloneElement,Children,memo,useSyncExternalStore,useLayoutEffect}from'react';import {css,keyframes,useTheme,ThemeProvider,Global}from'@emotion/react';import {jsxs,jsx,Fragment}from'@emotion/react/jsx-runtime';import {ChevronDown,CircleAlert,TriangleAlert,CircleCheckBig,Info,X,Eye,EyeOff,ChevronRight,Check,ChevronFirst,ChevronLeft,ChevronLast,ChevronsUpDown}from'lucide-react';import {useFloating,offset,flip,shift,autoUpdate,useDismiss,useRole,useInteractions,FloatingPortal,size,arrow,useHover,safePolygon,useFocus}from'@floating-ui/react';import {motion,AnimatePresence,useAnimationControls}from'framer-motion';import {createRoot}from'react-dom/client';var ha={xxs:"0.15rem",xs:"0.25rem",sm:"0.5rem",md:"0.75rem",lg:"1rem",xl:"1.5rem"},ya={xxs:"0.3rem",xs:"0.4rem",sm:"0.6rem",md:"0.7rem",lg:"1rem",xl:"2rem",full:"9999px"},xa={sm:32,md:36,lg:40,border:"1px"},va={fonts:{sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},sizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px","6xl":"60px"}},qr={0:"#ffffff",50:"#f9f9f9",100:"#f5f5f5",200:"#eeeeee",300:"#e5e5e5",400:"#C6C6C6",500:"#b3b3b3",600:"#737373",700:"#4a4a4a",800:"#2b2b2b",900:"#111111"},Gr={0:"#0c0c0c",50:"#121212",100:"#1a1a1a",200:"#222222",300:"#2b2b2b",400:"#333333",500:"#444444",600:"#6e6e6e",700:"#a6a6a6",800:"#e5e5e5",900:"#ffffff"},ga={mono:{0:"#FFFFFF",50:"#FAFAFA",100:"#F2F2F2",200:"#E6E6E6",300:"#D1D1D1",400:"#8A8A8A",500:"#2A2A2A",600:"#1A1A1A",700:"#121212",800:"#0B0B0B",900:"#000000"},danger:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},success:{0:"#FFFFFF",50:"#EEFFF3",100:"#D7FFE8",200:"#d6ffe7ff",300:"#8EF5BB",400:"#5BEA9A",500:"#0FD45D",600:"#00C853",700:"#109C47",800:"#0E8242",900:"#064D2B"},warning:{0:"#FFFFFF",50:"#FFF7EB",100:"#FFEFC6",200:"#FFE094",300:"#FFC552",400:"#FFB83A",500:"#FFA414",600:"#FF9F0A",700:"#D97500",800:"#AF5E00",900:"#6E3600"},info:{0:"#FFFFFF",50:"#ECFAFF",100:"#D2F2FF",200:"#AEE6FF",300:"#84D6FF",400:"#4BC1FF",500:"#2B9FFF",600:"#1093FF",700:"#0077C0",800:"#0066A8",900:"#083B61"},red:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},amber:{0:"#FFFFFF",50:"#FFF3EA",100:"#FFE3D1",200:"#FFC7A6",300:"#FFAC80",400:"#FF874D",500:"#FF6C1F",600:"#FF5A00",700:"#D24500",800:"#B63C00",900:"#6F2300"},orange:{0:"#FFFFFF",50:"#FFF4EB",100:"#FFE6CC",200:"#FFCE9E",300:"#FFAE66",400:"#FF8B33",500:"#FF7310",600:"#FF6B00",700:"#CC4400",800:"#AF3F00",900:"#6B2400"},yellow:{0:"#FFFFFF",50:"#FFFAE6",100:"#FFF2BF",200:"#FFE780",300:"#FFDB3D",400:"#FFD000",500:"#FFE03F",600:"#FFD60A",700:"#B38600",800:"#8E6D00",900:"#534300"},lime:{0:"#FFFFFF",50:"#F6FFE8",100:"#E7FFC2",200:"#CCFF83",300:"#A8FA3D",400:"#8BE11C",500:"#87DE10",600:"#7ACC00",700:"#4A8C00",800:"#3B7100",900:"#224300"},green:{0:"#FFFFFF",50:"#F0FFF5",100:"#DBFFE9",200:"#BDF7CF",300:"#8FE7A8",400:"#5BD57D",500:"#1DAE52",600:"#16A34A",700:"#168A40",800:"#136A34",900:"#0B3D1F"},teal:{0:"#FFFFFF",50:"#EDFFFB",100:"#D2FFF4",200:"#A6FAEA",300:"#74EEDC",400:"#41DECB",500:"#00CFAA",600:"#00BFA5",700:"#0C8C7F",800:"#0B786C",900:"#084741"},cyan:{0:"#FFFFFF",50:"#EFFFFF",100:"#D4FCFF",200:"#AFF5FD",300:"#7FE8F6",400:"#45D3EB",500:"#09C6E7",600:"#00B8D9",700:"#0A7C92",800:"#0B6E81",900:"#0A4250"},blue:{0:"#FFFFFF",50:"#EFF6FF",100:"#DBE8FF",200:"#B8D3FF",300:"#90BAFF",400:"#5E97FF",500:"#406FFF",600:"#2F66FF",700:"#2452DE",800:"#2248C8",900:"#172C80"},indigo:{0:"#FFFFFF",50:"#EEF2FF",100:"#E0E6FF",200:"#C5D0FF",300:"#A3B5FF",400:"#879CFF",500:"#707AF5",600:"#5A63F3",700:"#4951DA",800:"#3E40BF",900:"#2A2A82"},purple:{0:"#FFFFFF",50:"#F4F0FF",100:"#E8DBFF",200:"#D2B8FF",300:"#B590FF",400:"#996AF5",500:"#7A52F1",600:"#6B3CF0",700:"#592FBE",800:"#4D27A3",900:"#2F1767"},magenta:{0:"#FFFFFF",50:"#FFF0FE",100:"#FCE0FF",200:"#F7BCFF",300:"#F393FD",400:"#E85FF8",500:"#C645D6",600:"#C026D3",700:"#951CAB",800:"#801790",900:"#4C0C59"},pink:{0:"#FFFFFF",50:"#FFF0F7",100:"#FFE0F0",200:"#FFC0E2",300:"#FF9ACE",400:"#FF6CB3",500:"#ED5CA2",600:"#EC4899",700:"#AB236F",800:"#96205D",900:"#5A1238"},rose:{0:"#FFFFFF",50:"#FFF0F3",100:"#FFE1E9",200:"#FFC1D3",300:"#FF98B8",400:"#FF6B98",500:"#EE4278",600:"#E52E69",700:"#B52156",800:"#991A43",900:"#5B0F28"}},ba={mono:{0:"#0B0B0C",50:"#0F0F10",100:"#151515",200:"#1B1B1C",300:"#232323",400:"#DADADA",500:"#E0E0E0",600:"#EDEDED",700:"#F5F5F5",800:"#FCFCFC",900:"#FFFFFF"},danger:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},success:{0:"#06150B",50:"#0A1B10",100:"#0E2416",200:"#11301C",300:"#143B21",400:"#16502C",500:"#22D85A",600:"#00C853",700:"#2FE976",800:"#7FF1AE",900:"#D6FADF"},warning:{0:"#150E05",50:"#1C1408",100:"#261B0B",200:"#31240E",300:"#3D2C12",400:"#583C16",500:"#FFA61A",600:"#FF9F0A",700:"#FFB347",800:"#FFD089",900:"#FFF0C9"},info:{0:"#07131E",50:"#0A1926",100:"#0E2233",200:"#112C44",300:"#143654",400:"#184A78",500:"#1C9CFF",600:"#1093FF",700:"#4FB2FF",800:"#9DD2FF",900:"#D8ECFF"},red:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},amber:{0:"#150D07",50:"#1C120A",100:"#26180E",200:"#311F12",300:"#3E2716",400:"#59361C",500:"#FF6A1E",600:"#FF5A00",700:"#FF8747",800:"#FFB98A",900:"#FFE2CC"},orange:{0:"#140D07",50:"#1B120A",100:"#25190D",200:"#302010",300:"#3B2813",400:"#553817",500:"#FF7F22",600:"#FF6B00",700:"#FF9247",800:"#FFBE8A",900:"#FFE1CC"},yellow:{0:"#141303",50:"#1B1906",100:"#25210A",200:"#2F2A0D",300:"#383212",400:"#524717",500:"#FFE042",600:"#FFD60A",700:"#FFE457",800:"#FFF194",900:"#FFF8CF"},lime:{0:"#0C1306",50:"#101A08",100:"#14210B",200:"#1A2B0F",300:"#203614",400:"#2A4A1A",500:"#86E21A",600:"#7ACC00",700:"#9EEA3B",800:"#C9F57F",900:"#EAFCC4"},green:{0:"#07140C",50:"#0B1B11",100:"#0E2416",200:"#112C1B",300:"#143722",400:"#17502F",500:"#20BF55",600:"#16A34A",700:"#39C964",800:"#86E5A5",900:"#D4F6E1"},teal:{0:"#081815",50:"#0B1F1C",100:"#0F2824",200:"#13322E",300:"#173E39",400:"#14584F",500:"#14CEBD",600:"#00BFA5",700:"#2CD6C6",800:"#7FEAE3",900:"#CFF7F3"},cyan:{0:"#07171C",50:"#0A1E24",100:"#0E2830",200:"#11333D",300:"#153E4A",400:"#165B6A",500:"#20CBE6",600:"#00B8D9",700:"#3FD2E9",800:"#93EBF6",900:"#D5F7FC"},blue:{0:"#081421",50:"#0A1829",100:"#0E2139",200:"#112A4B",300:"#153660",400:"#184A86",500:"#4A78FF",600:"#2F66FF",700:"#5A8AFF",800:"#A7C3FF",900:"#D9E7FF"},indigo:{0:"#0B1023",50:"#0E162C",100:"#141F3F",200:"#1C2A56",300:"#24366E",400:"#2F4894",500:"#707CF6",600:"#5A63F3",700:"#7D86FF",800:"#B5C0FF",900:"#E0E6FF"},purple:{0:"#100B1F",50:"#130E26",100:"#1A1638",200:"#231F4E",300:"#2E2A67",400:"#3C388D",500:"#8256F3",600:"#6B3CF0",700:"#8B66FA",800:"#C1B0FF",900:"#E4DCFF"},magenta:{0:"#160A18",50:"#1C0C21",100:"#25102E",200:"#321544",300:"#421A5C",400:"#58247C",500:"#CB44DB",600:"#C026D3",700:"#D960EB",800:"#F0B5FA",900:"#F9E4FE"},pink:{0:"#170911",50:"#1D0C18",100:"#271220",200:"#371830",300:"#462042",400:"#622C5C",500:"#F067AE",600:"#EC4899",700:"#F679BB",800:"#FFC2E1",900:"#FFE6F3"},rose:{0:"#17090E",50:"#1F0C13",100:"#2A121B",200:"#3A1B28",300:"#4B2636",400:"#673449",500:"#EE457B",600:"#E52E69",700:"#FF558A",800:"#FFA9C6",900:"#FFE0EA"}},Ca=e=>({...e,red:e.danger,error:e.danger,green:e.success,success:e.success,orange:e.orange,amber:e.amber,yellow:e.yellow,lime:e.lime,teal:e.teal,cyan:e.cyan,blue:e.blue,indigo:e.indigo,purple:e.purple,violet:e.purple,magenta:e.magenta,fuchsia:e.magenta,pink:e.pink,rose:e.rose,gray:e.mono,grey:e.mono,neutral:e.mono}),Qn=(e,t)=>e==="light"?{appBg:t[0],panelBg:t[0],subtleBg:t[100],panelHover:t[50],subtleHover:t[200],overlayBg:"linear-gradient(rgba(0,0,0,.15),rgba(0,0,0,.525))",border:t[300]}:{appBg:t[0],panelBg:t[0],subtleBg:t[50],panelHover:t[50],subtleHover:t[100],overlayBg:"linear-gradient(rgba(0,0,0,.35),rgba(0,0,0,.75))",border:t[200]},_o=e=>({primary:e[900],secondary:e[600],muted:e[500],onColors:{}}),jo=e=>({primary:e[900],secondary:e[700],muted:e[600],onColors:{}}),fc=["danger","success","warning","info","amber","orange","yellow","lime","green","teal","cyan","blue","indigo","purple","magenta","pink","rose"],Ra=e=>fc.reduce((t,n)=>(t[n]=e[n]??"#FFFFFF",t),{}),Vo={spacing:ha,radius:ya,componentHeights:xa,typography:va,neutral:qr,palette:{...Ca(ga),primary:ga.mono},surface:Qn("light",qr),text:{..._o(qr),onColors:{primary:"#FFFFFF",...Ra({yellow:"#000000"})}}},Ta={spacing:ha,radius:ya,componentHeights:xa,typography:va,neutral:Gr,palette:{...Ca(ba),primary:ba.mono},surface:Qn("dark",Gr),text:{...jo(Gr),onColors:{primary:"#000000",...Ra({yellow:"#000000",lime:"#000000"})}}};function Ea(e){let t=e,n=new Set;return {get:()=>t,set:o=>{t=o,n.forEach(r=>r());},subscribe:o=>(n.add(o),()=>n.delete(o))}}var Ia={destructive:"danger",error:"danger",violet:"purple",fuchsia:"magenta",gray:"mono",grey:"mono",neutral:"mono"},eo=e=>Ia[e]??e;function an(e){let t={...e};return Object.entries(Ia).forEach(([n,o])=>{t[o]!=null&&t[n]==null&&(t[n]=t[o]);}),t}var Sa=me.createContext(null),Ma=me.createContext(null),Fa=me.createContext({setMode:e=>{},toggleMode:()=>{}}),Aa=me.createContext({setPrimary:e=>{}}),Pa=me.createContext(null);function V(){return useTheme()}function hc(){let e=me.useContext(Sa);if(!e)throw new Error("useColorMode must be used within ThemeProvider");console.log("[useColorMode] store:",e),console.log("[useColorMode] store.get():",e.get());let t=me.useContext(Fa),[n,o]=me.useState(()=>{let s=e.get();return console.log("[useColorMode] useState initializer, store.get():",s),s});console.log("[useColorMode] mode state value:",n),me.useEffect(()=>{console.log("[useColorMode] useEffect running, store.get():",e.get()),o(e.get());let s=e.subscribe(()=>{console.log("[useColorMode] subscription fired, new value:",e.get()),o(e.get());});return ()=>{s();}},[e]);let r={mode:n,setMode:t.setMode,toggleMode:t.toggleMode};return console.log("[useColorMode] returning:",r),r}function yc(){let e=me.useContext(Ma);if(!e)throw new Error("usePrimary must be used within ThemeProvider");let t=me.useContext(Aa),[n,o]=me.useState(()=>e.get());return me.useEffect(()=>{o(e.get());let r=e.subscribe(()=>{o(e.get());});return ()=>{r();}},[e]),{primary:n,setPrimary:t.setPrimary}}function lb(e){let t=me.useContext(Pa);if(!t)throw new Error("usePrimitives must be used within ThemeProvider");let{mode:n}=hc(),{primary:o}=yc(),r=me.useMemo(()=>{let s=n==="light"?t.light:t.dark,i=s.palette[eo(o)]??s.palette.primary,c=an(s.text.onColors)[eo(o)]??Yr(i[600]);return {...s,palette:{...s.palette,primary:i},text:{...s.text,onColors:{...an(s.text.onColors),primary:c,[eo(o)]:c,[o]:c}}}},[t,n,o]);return e?e(r):r}function Uo(e,t){if(!t)return e;let n={...e.palette};if(t.palette)for(let o of Object.keys(t.palette)){let r=t.palette[o];r&&(n[o]={...e.palette[o]??{},...r});}return {...e,spacing:{...e.spacing,...t.spacing??{}},radius:{...e.radius,...t.radius??{}},componentHeights:{...e.componentHeights,...t.componentHeights??{}},typography:{fonts:{...e.typography.fonts,...t.typography?.fonts??{}},sizes:{...e.typography.sizes,...t.typography?.sizes??{}}},palette:n,neutral:t.neutral?{...e.neutral,...t.neutral}:e.neutral,surface:{...e.surface,...t.surface??{}},text:{...e.text,...t.text??{},onColors:{...e.text.onColors,...t.text?.onColors??{}}}}}function Yr(e){let t=e.replace("#",""),n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16),s=c=>{let a=c/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)};return .2126*s(n)+.7152*s(o)+.0722*s(r)>.53?"#000":"#FFF"}function ka(e,t){if(e.current)return;let n=document.createElement("style");n.id=t,document.head.appendChild(n),e.current=n;}function Xr(e){return e?`[data-pfui-scope="${e}"]`:":root"}function Go(e,t,n){let o=[],r=a=>a.startsWith("var(")?a.replace(/^var\([^,]+,\s*/,"").replace(/\)\s*$/,"").trim():a;o.push(`--pf-font-sans:${r(e.typography.fonts.sans)};`),o.push(`--pf-font-mono:${r(e.typography.fonts.mono)};`),o.push(`--pf-text-primary:${e.text.primary};`),o.push(`--pf-text-secondary:${e.text.secondary};`),o.push(`--pf-text-muted:${e.text.muted};`),Object.entries(e.text.onColors).forEach(([a,l])=>o.push(`--pf-text-on-${a}:${l};`)),Object.entries(e.spacing).forEach(([a,l])=>o.push(`--pf-space-${a}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.radius).forEach(([a,l])=>o.push(`--pf-radius-${a}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.typography.sizes).forEach(([a,l])=>o.push(`--pf-fontSize-${a}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.componentHeights).forEach(([a,l])=>o.push(`--pf-cmph-${a}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.neutral).forEach(([a,l])=>o.push(`--pf-neutral-${a}:${l};`)),o.push(`--pf-surface-appBg:${e.surface.appBg};`),o.push(`--pf-surface-panelBg:${e.surface.panelBg};`),o.push(`--pf-surface-subtleBg:${e.surface.subtleBg};`),o.push(`--pf-surface-panelHover:${e.surface.panelHover};`),o.push(`--pf-surface-subtleHover:${e.surface.subtleHover};`),o.push(`--pf-surface-overlayBg:${e.surface.overlayBg};`),o.push(`--pf-surface-border:${e.surface.border};`),o.push("--pf-focus-main:var(--pf-neutral-400);"),o.push(n==="dark"?"--pf-focus-soft:var(--pf-neutral-200);":"--pf-focus-soft:var(--pf-neutral-300);"),Object.entries(e.palette).forEach(([a,l])=>{Object.entries(l).forEach(([u,d])=>{o.push(`--pf-palette-${a}-${u}:${d};`);});});let s="300";Object.keys(e.palette).forEach(a=>{o.push(`--pf-focus-${a}-main: var(--pf-palette-${a}-${s});`),o.push(`--pf-focus-${a}-soft: transparent;`);});let i=t;[0,50,100,200,300,400,500,600,700,800,900].forEach(a=>o.push(`--pf-primary-${a}:var(--pf-palette-${i}-${a});`)),o.push("--pf-focus-accent-main:var(--pf-primary-300);"),o.push("--pf-focus-accent-soft: transparent;");let c=e.text.onColors[i]??(()=>{let l=(e.palette[i]?.[600]??e.palette.primary[600]).replace("#",""),u=parseInt(l.slice(0,2),16),d=parseInt(l.slice(2,4),16),y=parseInt(l.slice(4,6),16),f=I=>{let x=I/255;return x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4)};return .2126*f(u)+.7152*f(d)+.0722*f(y)>.53?"#000":"#FFF"})();return o.push(`--pf-text-on-primary:${c};`),o.push(`color-scheme:${n==="dark"?"dark":"light"};`),o}function qo(e,t,n){return Go(e,t,n).join("")}var Na=({children:e,theme:t,initialMode:n="light",storageKey:o="pfui:pref",scope:r})=>{let s=!!r,i=t?.primaryKey??"mono",a=useRef((()=>{if(!s)try{let b=JSON.parse(localStorage.getItem(o)||"null");if(b?.mode==="light"||b?.mode==="dark")return b.mode}catch{}return n==="system"?window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":n??"light"})());console.log("[ThemeProvider] initialModeRef.current:",a.current);let l=me.useMemo(()=>{let b=Ea(a.current);return console.log("[ThemeProvider] created modeStore, initial value:",b.get()),b},[]),u=me.useMemo(()=>Ea(i),[i]),d=useRef(null),y=useRef(0),f=useRef(r??"__root__");me.useLayoutEffect(()=>{let b=0,h=d.current;for(;h&&h!==document.body;)h.hasAttribute("data-pfui-scope")&&b++,h=h.parentElement;y.current=b;},[r]);let T=useMemo(()=>{let b=Uo(Vo,t),h=Uo(b,t?.light),A=t?.light?.primaryKey??i,D=eo(A),L=h.palette.primary??h.palette[D]??h.palette.mono,k=an({..._o(h.neutral).onColors,...h.text.onColors}),E=k[D]??Yr(L[600]),W=t?.surface||t?.light?.surface?h.surface:Qn("light",h.neutral),z={...t?.text||t?.light?.text?h.text:_o(h.neutral),onColors:an({...k,primary:E,[D]:E})};return {...h,palette:{...h.palette,primary:L},surface:W,text:z}},[t,i]),I=useMemo(()=>{let b=Uo(Ta,t),h=Uo(b,t?.dark),A=t?.dark?.primaryKey??i,D=eo(A),L=h.palette.primary??h.palette[D]??h.palette.mono,k=an({...jo(h.neutral).onColors,...h.text.onColors}),E=k[D]??Yr(L[600]),W=t?.surface||t?.dark?.surface?h.surface:Qn("dark",h.neutral),z={...t?.text||t?.dark?.text?h.text:jo(h.neutral),onColors:an({...k,primary:E,[D]:E})};return {...h,palette:{...h.palette,primary:L},surface:W,text:z}},[t,i]),x=useRef(null),R=useRef(null),g=me.useInsertionEffect||me.useLayoutEffect,p=me.useRef(false),m=useCallback(()=>{let b=Xr(r);ka(R,s?`pfui-guard-${r}`:"pfui-guard-root"),R.current.textContent=`${b} *{transition:none!important;animation:none!important}`,requestAnimationFrame(()=>{R.current.textContent="";});},[r,s]);g(()=>{ka(x,s?`pfui-vars-${r}`:"pfui-vars-root");let b=t?.light?.primaryKey??t?.primaryKey??i,h=t?.dark?.primaryKey??t?.primaryKey??i,A=Xr(r),D=qo(T,b,"light"),L=qo(I,h,"dark");x.current.textContent=`${A}.pf-light{${D}}
1
+ import me,{forwardRef,createContext,useId,useMemo,useState,useCallback,useRef,useEffect,useContext,isValidElement,cloneElement,Children,memo,useSyncExternalStore,useLayoutEffect}from'react';import {css,keyframes,useTheme,ThemeProvider,Global}from'@emotion/react';import {jsxs,jsx,Fragment}from'@emotion/react/jsx-runtime';import {ChevronDown,CircleAlert,TriangleAlert,CircleCheckBig,Info,X,Eye,EyeOff,ChevronRight,Check,ChevronFirst,ChevronLeft,ChevronLast,ChevronsUpDown}from'lucide-react';import {useFloating,offset,flip,shift,autoUpdate,useDismiss,useRole,useInteractions,FloatingPortal,size,arrow,useHover,safePolygon,useFocus}from'@floating-ui/react';import {motion,AnimatePresence,useAnimationControls}from'framer-motion';import {createRoot}from'react-dom/client';var ha={xxs:"0.15rem",xs:"0.25rem",sm:"0.5rem",md:"0.75rem",lg:"1rem",xl:"1.5rem"},ya={xxs:"0.3rem",xs:"0.4rem",sm:"0.6rem",md:"0.7rem",lg:"1rem",xl:"2rem",full:"9999px"},xa={sm:32,md:36,lg:40,border:"1px"},va={fonts:{sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},sizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px","6xl":"60px"}},qr={0:"#ffffff",50:"#f9f9f9",100:"#f5f5f5",200:"#eeeeee",300:"#e5e5e5",400:"#C6C6C6",500:"#b3b3b3",600:"#737373",700:"#4a4a4a",800:"#2b2b2b",900:"#111111"},Gr={0:"#0c0c0c",50:"#121212",100:"#1a1a1a",200:"#222222",300:"#2b2b2b",400:"#333333",500:"#444444",600:"#6e6e6e",700:"#a6a6a6",800:"#e5e5e5",900:"#ffffff"},ga={mono:{0:"#FFFFFF",50:"#FAFAFA",100:"#F2F2F2",200:"#E6E6E6",300:"#D1D1D1",400:"#8A8A8A",500:"#2A2A2A",600:"#1A1A1A",700:"#121212",800:"#0B0B0B",900:"#000000"},danger:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},success:{0:"#FFFFFF",50:"#EEFFF3",100:"#D7FFE8",200:"#d6ffe7ff",300:"#8EF5BB",400:"#5BEA9A",500:"#0FD45D",600:"#00C853",700:"#109C47",800:"#0E8242",900:"#064D2B"},warning:{0:"#FFFFFF",50:"#FFF7EB",100:"#FFEFC6",200:"#FFE094",300:"#FFC552",400:"#FFB83A",500:"#FFA414",600:"#FF9F0A",700:"#D97500",800:"#AF5E00",900:"#6E3600"},info:{0:"#FFFFFF",50:"#ECFAFF",100:"#D2F2FF",200:"#AEE6FF",300:"#84D6FF",400:"#4BC1FF",500:"#2B9FFF",600:"#1093FF",700:"#0077C0",800:"#0066A8",900:"#083B61"},red:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},amber:{0:"#FFFFFF",50:"#FFF3EA",100:"#FFE3D1",200:"#FFC7A6",300:"#FFAC80",400:"#FF874D",500:"#FF6C1F",600:"#FF5A00",700:"#D24500",800:"#B63C00",900:"#6F2300"},orange:{0:"#FFFFFF",50:"#FFF4EB",100:"#FFE6CC",200:"#FFCE9E",300:"#FFAE66",400:"#FF8B33",500:"#FF7310",600:"#FF6B00",700:"#CC4400",800:"#AF3F00",900:"#6B2400"},yellow:{0:"#FFFFFF",50:"#FFFAE6",100:"#FFF2BF",200:"#FFE780",300:"#FFDB3D",400:"#FFD000",500:"#FFE03F",600:"#FFD60A",700:"#B38600",800:"#8E6D00",900:"#534300"},lime:{0:"#FFFFFF",50:"#F6FFE8",100:"#E7FFC2",200:"#CCFF83",300:"#A8FA3D",400:"#8BE11C",500:"#87DE10",600:"#7ACC00",700:"#4A8C00",800:"#3B7100",900:"#224300"},green:{0:"#FFFFFF",50:"#F0FFF5",100:"#DBFFE9",200:"#BDF7CF",300:"#8FE7A8",400:"#5BD57D",500:"#1DAE52",600:"#16A34A",700:"#168A40",800:"#136A34",900:"#0B3D1F"},teal:{0:"#FFFFFF",50:"#EDFFFB",100:"#D2FFF4",200:"#A6FAEA",300:"#74EEDC",400:"#41DECB",500:"#00CFAA",600:"#00BFA5",700:"#0C8C7F",800:"#0B786C",900:"#084741"},cyan:{0:"#FFFFFF",50:"#EFFFFF",100:"#D4FCFF",200:"#AFF5FD",300:"#7FE8F6",400:"#45D3EB",500:"#09C6E7",600:"#00B8D9",700:"#0A7C92",800:"#0B6E81",900:"#0A4250"},blue:{0:"#FFFFFF",50:"#EFF6FF",100:"#DBE8FF",200:"#B8D3FF",300:"#90BAFF",400:"#5E97FF",500:"#406FFF",600:"#2F66FF",700:"#2452DE",800:"#2248C8",900:"#172C80"},indigo:{0:"#FFFFFF",50:"#EEF2FF",100:"#E0E6FF",200:"#C5D0FF",300:"#A3B5FF",400:"#879CFF",500:"#707AF5",600:"#5A63F3",700:"#4951DA",800:"#3E40BF",900:"#2A2A82"},purple:{0:"#FFFFFF",50:"#F4F0FF",100:"#E8DBFF",200:"#D2B8FF",300:"#B590FF",400:"#996AF5",500:"#7A52F1",600:"#6B3CF0",700:"#592FBE",800:"#4D27A3",900:"#2F1767"},magenta:{0:"#FFFFFF",50:"#FFF0FE",100:"#FCE0FF",200:"#F7BCFF",300:"#F393FD",400:"#E85FF8",500:"#C645D6",600:"#C026D3",700:"#951CAB",800:"#801790",900:"#4C0C59"},pink:{0:"#FFFFFF",50:"#FFF0F7",100:"#FFE0F0",200:"#FFC0E2",300:"#FF9ACE",400:"#FF6CB3",500:"#ED5CA2",600:"#EC4899",700:"#AB236F",800:"#96205D",900:"#5A1238"},rose:{0:"#FFFFFF",50:"#FFF0F3",100:"#FFE1E9",200:"#FFC1D3",300:"#FF98B8",400:"#FF6B98",500:"#EE4278",600:"#E52E69",700:"#B52156",800:"#991A43",900:"#5B0F28"}},ba={mono:{0:"#0B0B0C",50:"#0F0F10",100:"#151515",200:"#1B1B1C",300:"#232323",400:"#DADADA",500:"#E0E0E0",600:"#EDEDED",700:"#F5F5F5",800:"#FCFCFC",900:"#FFFFFF"},danger:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},success:{0:"#06150B",50:"#0A1B10",100:"#0E2416",200:"#11301C",300:"#143B21",400:"#16502C",500:"#22D85A",600:"#00C853",700:"#2FE976",800:"#7FF1AE",900:"#D6FADF"},warning:{0:"#150E05",50:"#1C1408",100:"#261B0B",200:"#31240E",300:"#3D2C12",400:"#583C16",500:"#FFA61A",600:"#FF9F0A",700:"#FFB347",800:"#FFD089",900:"#FFF0C9"},info:{0:"#07131E",50:"#0A1926",100:"#0E2233",200:"#112C44",300:"#143654",400:"#184A78",500:"#1C9CFF",600:"#1093FF",700:"#4FB2FF",800:"#9DD2FF",900:"#D8ECFF"},red:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},amber:{0:"#150D07",50:"#1C120A",100:"#26180E",200:"#311F12",300:"#3E2716",400:"#59361C",500:"#FF6A1E",600:"#FF5A00",700:"#FF8747",800:"#FFB98A",900:"#FFE2CC"},orange:{0:"#140D07",50:"#1B120A",100:"#25190D",200:"#302010",300:"#3B2813",400:"#553817",500:"#FF7F22",600:"#FF6B00",700:"#FF9247",800:"#FFBE8A",900:"#FFE1CC"},yellow:{0:"#141303",50:"#1B1906",100:"#25210A",200:"#2F2A0D",300:"#383212",400:"#524717",500:"#FFE042",600:"#FFD60A",700:"#FFE457",800:"#FFF194",900:"#FFF8CF"},lime:{0:"#0C1306",50:"#101A08",100:"#14210B",200:"#1A2B0F",300:"#203614",400:"#2A4A1A",500:"#86E21A",600:"#7ACC00",700:"#9EEA3B",800:"#C9F57F",900:"#EAFCC4"},green:{0:"#07140C",50:"#0B1B11",100:"#0E2416",200:"#112C1B",300:"#143722",400:"#17502F",500:"#20BF55",600:"#16A34A",700:"#39C964",800:"#86E5A5",900:"#D4F6E1"},teal:{0:"#081815",50:"#0B1F1C",100:"#0F2824",200:"#13322E",300:"#173E39",400:"#14584F",500:"#14CEBD",600:"#00BFA5",700:"#2CD6C6",800:"#7FEAE3",900:"#CFF7F3"},cyan:{0:"#07171C",50:"#0A1E24",100:"#0E2830",200:"#11333D",300:"#153E4A",400:"#165B6A",500:"#20CBE6",600:"#00B8D9",700:"#3FD2E9",800:"#93EBF6",900:"#D5F7FC"},blue:{0:"#081421",50:"#0A1829",100:"#0E2139",200:"#112A4B",300:"#153660",400:"#184A86",500:"#4A78FF",600:"#2F66FF",700:"#5A8AFF",800:"#A7C3FF",900:"#D9E7FF"},indigo:{0:"#0B1023",50:"#0E162C",100:"#141F3F",200:"#1C2A56",300:"#24366E",400:"#2F4894",500:"#707CF6",600:"#5A63F3",700:"#7D86FF",800:"#B5C0FF",900:"#E0E6FF"},purple:{0:"#100B1F",50:"#130E26",100:"#1A1638",200:"#231F4E",300:"#2E2A67",400:"#3C388D",500:"#8256F3",600:"#6B3CF0",700:"#8B66FA",800:"#C1B0FF",900:"#E4DCFF"},magenta:{0:"#160A18",50:"#1C0C21",100:"#25102E",200:"#321544",300:"#421A5C",400:"#58247C",500:"#CB44DB",600:"#C026D3",700:"#D960EB",800:"#F0B5FA",900:"#F9E4FE"},pink:{0:"#170911",50:"#1D0C18",100:"#271220",200:"#371830",300:"#462042",400:"#622C5C",500:"#F067AE",600:"#EC4899",700:"#F679BB",800:"#FFC2E1",900:"#FFE6F3"},rose:{0:"#17090E",50:"#1F0C13",100:"#2A121B",200:"#3A1B28",300:"#4B2636",400:"#673449",500:"#EE457B",600:"#E52E69",700:"#FF558A",800:"#FFA9C6",900:"#FFE0EA"}},Ca=e=>({...e,red:e.danger,error:e.danger,green:e.success,success:e.success,orange:e.orange,amber:e.amber,yellow:e.yellow,lime:e.lime,teal:e.teal,cyan:e.cyan,blue:e.blue,indigo:e.indigo,purple:e.purple,violet:e.purple,magenta:e.magenta,fuchsia:e.magenta,pink:e.pink,rose:e.rose,gray:e.mono,grey:e.mono,neutral:e.mono}),Qn=(e,t)=>e==="light"?{appBg:t[0],panelBg:t[0],subtleBg:t[100],panelHover:t[50],subtleHover:t[200],overlayBg:"linear-gradient(rgba(0,0,0,.15),rgba(0,0,0,.525))",border:t[300]}:{appBg:t[0],panelBg:t[0],subtleBg:t[50],panelHover:t[50],subtleHover:t[100],overlayBg:"linear-gradient(rgba(0,0,0,.35),rgba(0,0,0,.75))",border:t[200]},_o=e=>({primary:e[900],secondary:e[600],muted:e[500],onColors:{}}),jo=e=>({primary:e[900],secondary:e[700],muted:e[600],onColors:{}}),fc=["danger","success","warning","info","amber","orange","yellow","lime","green","teal","cyan","blue","indigo","purple","magenta","pink","rose"],Ra=e=>fc.reduce((t,n)=>(t[n]=e[n]??"#FFFFFF",t),{}),Vo={spacing:ha,radius:ya,componentHeights:xa,typography:va,neutral:qr,palette:{...Ca(ga),primary:ga.mono},surface:Qn("light",qr),text:{..._o(qr),onColors:{primary:"#FFFFFF",...Ra({yellow:"#000000"})}}},Ta={spacing:ha,radius:ya,componentHeights:xa,typography:va,neutral:Gr,palette:{...Ca(ba),primary:ba.mono},surface:Qn("dark",Gr),text:{...jo(Gr),onColors:{primary:"#000000",...Ra({yellow:"#000000",lime:"#000000"})}}};function Ea(e){let t=e,n=new Set;return {get:()=>t,set:o=>{t=o,n.forEach(r=>r());},subscribe:o=>(n.add(o),()=>n.delete(o))}}var Ia={destructive:"danger",error:"danger",violet:"purple",fuchsia:"magenta",gray:"mono",grey:"mono",neutral:"mono"},eo=e=>Ia[e]??e;function an(e){let t={...e};return Object.entries(Ia).forEach(([n,o])=>{t[o]!=null&&t[n]==null&&(t[n]=t[o]);}),t}var Sa=me.createContext(null),Ma=me.createContext(null),Fa=me.createContext({setMode:e=>{},toggleMode:()=>{}}),Aa=me.createContext({setPrimary:e=>{}}),Pa=me.createContext(null);function V(){return useTheme()}function hc(){let e=me.useContext(Sa);if(!e)throw new Error("useColorMode must be used within ThemeProvider");let t=me.useContext(Fa),[n,o]=me.useState(()=>e.get());return me.useEffect(()=>{o(e.get());let r=e.subscribe(()=>{o(e.get());});return ()=>{r();}},[e]),{mode:n,setMode:t.setMode,toggleMode:t.toggleMode}}function yc(){let e=me.useContext(Ma);if(!e)throw new Error("usePrimary must be used within ThemeProvider");let t=me.useContext(Aa),[n,o]=me.useState(()=>e.get());return me.useEffect(()=>{o(e.get());let r=e.subscribe(()=>{o(e.get());});return ()=>{r();}},[e]),{primary:n,setPrimary:t.setPrimary}}function lb(e){let t=me.useContext(Pa);if(!t)throw new Error("usePrimitives must be used within ThemeProvider");let{mode:n}=hc(),{primary:o}=yc(),r=me.useMemo(()=>{let s=n==="light"?t.light:t.dark,a=s.palette[eo(o)]??s.palette.primary,c=an(s.text.onColors)[eo(o)]??Yr(a[600]);return {...s,palette:{...s.palette,primary:a},text:{...s.text,onColors:{...an(s.text.onColors),primary:c,[eo(o)]:c,[o]:c}}}},[t,n,o]);return e?e(r):r}function Uo(e,t){if(!t)return e;let n={...e.palette};if(t.palette)for(let o of Object.keys(t.palette)){let r=t.palette[o];r&&(n[o]={...e.palette[o]??{},...r});}return {...e,spacing:{...e.spacing,...t.spacing??{}},radius:{...e.radius,...t.radius??{}},componentHeights:{...e.componentHeights,...t.componentHeights??{}},typography:{fonts:{...e.typography.fonts,...t.typography?.fonts??{}},sizes:{...e.typography.sizes,...t.typography?.sizes??{}}},palette:n,neutral:t.neutral?{...e.neutral,...t.neutral}:e.neutral,surface:{...e.surface,...t.surface??{}},text:{...e.text,...t.text??{},onColors:{...e.text.onColors,...t.text?.onColors??{}}}}}function Yr(e){let t=e.replace("#",""),n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16),s=c=>{let i=c/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)};return .2126*s(n)+.7152*s(o)+.0722*s(r)>.53?"#000":"#FFF"}function ka(e,t){if(e.current)return;let n=document.createElement("style");n.id=t,document.head.appendChild(n),e.current=n;}function Xr(e){return e?`[data-pfui-scope="${e}"]`:":root"}function Go(e,t,n){let o=[],r=i=>i.startsWith("var(")?i.replace(/^var\([^,]+,\s*/,"").replace(/\)\s*$/,"").trim():i;o.push(`--pf-font-sans:${r(e.typography.fonts.sans)};`),o.push(`--pf-font-mono:${r(e.typography.fonts.mono)};`),o.push(`--pf-text-primary:${e.text.primary};`),o.push(`--pf-text-secondary:${e.text.secondary};`),o.push(`--pf-text-muted:${e.text.muted};`),Object.entries(e.text.onColors).forEach(([i,l])=>o.push(`--pf-text-on-${i}:${l};`)),Object.entries(e.spacing).forEach(([i,l])=>o.push(`--pf-space-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.radius).forEach(([i,l])=>o.push(`--pf-radius-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.typography.sizes).forEach(([i,l])=>o.push(`--pf-fontSize-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.componentHeights).forEach(([i,l])=>o.push(`--pf-cmph-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.neutral).forEach(([i,l])=>o.push(`--pf-neutral-${i}:${l};`)),o.push(`--pf-surface-appBg:${e.surface.appBg};`),o.push(`--pf-surface-panelBg:${e.surface.panelBg};`),o.push(`--pf-surface-subtleBg:${e.surface.subtleBg};`),o.push(`--pf-surface-panelHover:${e.surface.panelHover};`),o.push(`--pf-surface-subtleHover:${e.surface.subtleHover};`),o.push(`--pf-surface-overlayBg:${e.surface.overlayBg};`),o.push(`--pf-surface-border:${e.surface.border};`),o.push("--pf-focus-main:var(--pf-neutral-400);"),o.push(n==="dark"?"--pf-focus-soft:var(--pf-neutral-200);":"--pf-focus-soft:var(--pf-neutral-300);"),Object.entries(e.palette).forEach(([i,l])=>{Object.entries(l).forEach(([u,d])=>{o.push(`--pf-palette-${i}-${u}:${d};`);});});let s="300";Object.keys(e.palette).forEach(i=>{o.push(`--pf-focus-${i}-main: var(--pf-palette-${i}-${s});`),o.push(`--pf-focus-${i}-soft: transparent;`);});let a=t;[0,50,100,200,300,400,500,600,700,800,900].forEach(i=>o.push(`--pf-primary-${i}:var(--pf-palette-${a}-${i});`)),o.push("--pf-focus-accent-main:var(--pf-primary-300);"),o.push("--pf-focus-accent-soft: transparent;");let c=e.text.onColors[a]??(()=>{let l=(e.palette[a]?.[600]??e.palette.primary[600]).replace("#",""),u=parseInt(l.slice(0,2),16),d=parseInt(l.slice(2,4),16),y=parseInt(l.slice(4,6),16),f=I=>{let x=I/255;return x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4)};return .2126*f(u)+.7152*f(d)+.0722*f(y)>.53?"#000":"#FFF"})();return o.push(`--pf-text-on-primary:${c};`),o.push(`color-scheme:${n==="dark"?"dark":"light"};`),o}function qo(e,t,n){return Go(e,t,n).join("")}var Na=({children:e,theme:t,initialMode:n="light",storageKey:o="pfui:pref",scope:r})=>{let s=!!r,a=t?.primaryKey??"mono",i=useRef((()=>{if(!s)try{let b=JSON.parse(localStorage.getItem(o)||"null");if(b?.mode==="light"||b?.mode==="dark")return b.mode}catch{}return n==="system"?window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":n??"light"})()),l=me.useMemo(()=>Ea(i.current),[]),u=me.useMemo(()=>Ea(a),[a]),d=useRef(null),y=useRef(0),f=useRef(r??"__root__");me.useLayoutEffect(()=>{let b=0,h=d.current;for(;h&&h!==document.body;)h.hasAttribute("data-pfui-scope")&&b++,h=h.parentElement;y.current=b;},[r]);let T=useMemo(()=>{let b=Uo(Vo,t),h=Uo(b,t?.light),A=t?.light?.primaryKey??a,D=eo(A),L=h.palette.primary??h.palette[D]??h.palette.mono,k=an({..._o(h.neutral).onColors,...h.text.onColors}),E=k[D]??Yr(L[600]),W=t?.surface||t?.light?.surface?h.surface:Qn("light",h.neutral),z={...t?.text||t?.light?.text?h.text:_o(h.neutral),onColors:an({...k,primary:E,[D]:E})};return {...h,palette:{...h.palette,primary:L},surface:W,text:z}},[t,a]),I=useMemo(()=>{let b=Uo(Ta,t),h=Uo(b,t?.dark),A=t?.dark?.primaryKey??a,D=eo(A),L=h.palette.primary??h.palette[D]??h.palette.mono,k=an({...jo(h.neutral).onColors,...h.text.onColors}),E=k[D]??Yr(L[600]),W=t?.surface||t?.dark?.surface?h.surface:Qn("dark",h.neutral),z={...t?.text||t?.dark?.text?h.text:jo(h.neutral),onColors:an({...k,primary:E,[D]:E})};return {...h,palette:{...h.palette,primary:L},surface:W,text:z}},[t,a]),x=useRef(null),R=useRef(null),g=me.useInsertionEffect||me.useLayoutEffect,p=me.useRef(false),m=useCallback(()=>{let b=Xr(r);ka(R,s?`pfui-guard-${r}`:"pfui-guard-root"),R.current.textContent=`${b} *{transition:none!important;animation:none!important}`,requestAnimationFrame(()=>{R.current.textContent="";});},[r,s]);g(()=>{ka(x,s?`pfui-vars-${r}`:"pfui-vars-root");let b=t?.light?.primaryKey??t?.primaryKey??a,h=t?.dark?.primaryKey??t?.primaryKey??a,A=Xr(r),D=qo(T,b,"light"),L=qo(I,h,"dark");x.current.textContent=`${A}.pf-light{${D}}
2
2
  ${A}.pf-dark{${L}}`+(s?`
3
- ${A}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"");},[T,I,t?.primaryKey,t?.light?.primaryKey,t?.dark?.primaryKey,r,s,i]),me.useLayoutEffect(()=>{if(!p.current){p.current=true;let b=s?d.current:document.documentElement;b&&(b.classList.toggle("pf-dark",a.current==="dark"),b.classList.toggle("pf-light",a.current!=="dark"),l.set(a.current));}},[s,l]);let C=useCallback(()=>{window.__pfuiActiveScope={id:f.current,depth:y.current,ts:Date.now()};},[]),P=useCallback(()=>{let b=s?d.current:document.documentElement,h={capture:true},A=()=>C();return b?.addEventListener("pointerdown",A,h),b?.addEventListener("mouseenter",A,h),b?.addEventListener("focusin",A,h),b?.addEventListener("keydown",A,h),()=>{b?.removeEventListener("pointerdown",A,h),b?.removeEventListener("mouseenter",A,h),b?.removeEventListener("focusin",A,h),b?.removeEventListener("keydown",A,h);}},[s,C]),w=useCallback(b=>{let h=window.__pfuiActiveScope,A=h&&Date.now()-h.ts<1500;if(!h||!A||h.id!==f.current)return;let D=l.get(),L=u.get(),E=Go(D==="light"?T:I,L,D).join("");b.style.cssText+=`;${E}`,b.classList.toggle("pf-light",D==="light"),b.classList.toggle("pf-dark",D==="dark"),b.setAttribute("data-pfui-portal-owner",f.current);},[l,u,T,I]),v=b=>{if(b.getAttribute("data-floating-ui-portal")==="true"||b.getAttribute("data-radix-portal")==="true"||b.getAttribute("data-portal")==="true")return true;let h=b.getAttribute("role");if(h==="tooltip"||h==="dialog")return true;let A=window.getComputedStyle(b);return A.position==="fixed"||A.position==="absolute"},N=useCallback(()=>{let b=new MutationObserver(h=>{for(let A of h)A.addedNodes.forEach(D=>{D instanceof HTMLElement&&(v(D)&&w(D),D.querySelectorAll('[data-floating-ui-portal="true"],[data-radix-portal="true"],[data-portal="true"],[role="tooltip"],[role="dialog"]').forEach(L=>w(L)));});});return b.observe(document.body,{childList:true,subtree:true}),()=>b.disconnect()},[w]);me.useEffect(()=>{let b=P(),h=N();return ()=>{b(),h();}},[P,N]);let B=useCallback(b=>{let h=s?d.current:document.documentElement,A=u.get(),L=Go(b==="light"?T:I,A,b).join("");h.style.cssText+=`;${L}`,h.classList.toggle("pf-light",b==="light"),h.classList.toggle("pf-dark",b==="dark");},[s,T,I,u]),K=useCallback(b=>{let h=u.get(),D=Go(b==="light"?T:I,h,b).join("");document.querySelectorAll(`[data-pfui-portal-owner="${f.current}"]`).forEach(L=>{L.style.cssText+=`;${D}`,L.classList.toggle("pf-light",b==="light"),L.classList.toggle("pf-dark",b==="dark");});},[T,I,u]),O=useCallback(b=>{if(l.get()!==b&&(m(),l.set(b),B(b),K(b),!s))try{let h=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...h,mode:b}));}catch{}},[l,s,o,m,B,K]),S=useCallback(()=>O(l.get()==="light"?"dark":"light"),[O,l]),F=useCallback(b=>{u.set(b);let h=Xr(r),A=qo(T,b,"light"),D=qo(I,b,"dark");x.current&&(x.current.textContent=`${h}.pf-light{${A}}
3
+ ${A}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"");},[T,I,t?.primaryKey,t?.light?.primaryKey,t?.dark?.primaryKey,r,s,a]),me.useLayoutEffect(()=>{if(!p.current){p.current=true;let b=s?d.current:document.documentElement;b&&(b.classList.toggle("pf-dark",i.current==="dark"),b.classList.toggle("pf-light",i.current!=="dark"),l.set(i.current));}},[s,l]);let C=useCallback(()=>{window.__pfuiActiveScope={id:f.current,depth:y.current,ts:Date.now()};},[]),P=useCallback(()=>{let b=s?d.current:document.documentElement,h={capture:true},A=()=>C();return b?.addEventListener("pointerdown",A,h),b?.addEventListener("mouseenter",A,h),b?.addEventListener("focusin",A,h),b?.addEventListener("keydown",A,h),()=>{b?.removeEventListener("pointerdown",A,h),b?.removeEventListener("mouseenter",A,h),b?.removeEventListener("focusin",A,h),b?.removeEventListener("keydown",A,h);}},[s,C]),w=useCallback(b=>{let h=window.__pfuiActiveScope,A=h&&Date.now()-h.ts<1500;if(!h||!A||h.id!==f.current)return;let D=l.get(),L=u.get(),E=Go(D==="light"?T:I,L,D).join("");b.style.cssText+=`;${E}`,b.classList.toggle("pf-light",D==="light"),b.classList.toggle("pf-dark",D==="dark"),b.setAttribute("data-pfui-portal-owner",f.current);},[l,u,T,I]),v=b=>{if(b.getAttribute("data-floating-ui-portal")==="true"||b.getAttribute("data-radix-portal")==="true"||b.getAttribute("data-portal")==="true")return true;let h=b.getAttribute("role");if(h==="tooltip"||h==="dialog")return true;let A=window.getComputedStyle(b);return A.position==="fixed"||A.position==="absolute"},N=useCallback(()=>{let b=new MutationObserver(h=>{for(let A of h)A.addedNodes.forEach(D=>{D instanceof HTMLElement&&(v(D)&&w(D),D.querySelectorAll('[data-floating-ui-portal="true"],[data-radix-portal="true"],[data-portal="true"],[role="tooltip"],[role="dialog"]').forEach(L=>w(L)));});});return b.observe(document.body,{childList:true,subtree:true}),()=>b.disconnect()},[w]);me.useEffect(()=>{let b=P(),h=N();return ()=>{b(),h();}},[P,N]);let B=useCallback(b=>{let h=s?d.current:document.documentElement,A=u.get(),L=Go(b==="light"?T:I,A,b).join("");h.style.cssText+=`;${L}`,h.classList.toggle("pf-light",b==="light"),h.classList.toggle("pf-dark",b==="dark");},[s,T,I,u]),K=useCallback(b=>{let h=u.get(),D=Go(b==="light"?T:I,h,b).join("");document.querySelectorAll(`[data-pfui-portal-owner="${f.current}"]`).forEach(L=>{L.style.cssText+=`;${D}`,L.classList.toggle("pf-light",b==="light"),L.classList.toggle("pf-dark",b==="dark");});},[T,I,u]),O=useCallback(b=>{if(l.get()!==b&&(m(),l.set(b),B(b),K(b),!s))try{let h=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...h,mode:b}));}catch{}},[l,s,o,m,B,K]),S=useCallback(()=>O(l.get()==="light"?"dark":"light"),[O,l]),F=useCallback(b=>{u.set(b);let h=Xr(r),A=qo(T,b,"light"),D=qo(I,b,"dark");x.current&&(x.current.textContent=`${h}.pf-light{${A}}
4
4
  ${h}.pf-dark{${D}}`+(s?`
5
- ${h}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m();let L=l.get();if(B(L),K(L),!s)try{let k=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...k,primary:b}));}catch{}},[T,I,r,s,l,u,m,B,K]),M=jsx(Pa.Provider,{value:{light:T,dark:I},children:jsx(Sa.Provider,{value:l,children:jsx(Ma.Provider,{value:u,children:jsx(Fa.Provider,{value:{setMode:O,toggleMode:S},children:jsx(Aa.Provider,{value:{setPrimary:F},children:jsx(ThemeProvider,{theme:xc(T),children:e})})})})})});return s?jsx("div",{ref:d,"data-pfui-scope":r,style:{background:"var(--pf-surface-appBg)",color:"var(--pf-text-primary)"},children:M}):jsx("div",{ref:d,children:M})};function xc(e){let t=(l,u)=>Object.fromEntries(Object.keys(l).map(d=>[d,u(d)])),n=t(e.spacing,l=>`var(--pf-space-${l})`),o=t(e.radius,l=>`var(--pf-radius-${l})`),r=t(e.typography.sizes,l=>`var(--pf-fontSize-${l})`),s=t(e.componentHeights,l=>`var(--pf-cmph-${l})`),i={sans:"var(--pf-font-sans)",mono:"var(--pf-font-mono)"},c=t(e.neutral,l=>`var(--pf-neutral-${l})`),a={};return Object.keys(e.palette).forEach(l=>{a[l]={},Object.keys(e.palette[l]).forEach(u=>{a[l][u]=`var(--pf-palette-${l}-${u})`;});}),a.primary=Object.fromEntries(["0","50","100","200","300","400","500","600","700","800","900"].map(l=>[l,`var(--pf-primary-${l})`])),{...e,spacing:n,radius:o,componentHeights:s,typography:{fonts:i,sizes:r},neutral:c,palette:a,surface:{appBg:"var(--pf-surface-appBg)",panelBg:"var(--pf-surface-panelBg)",subtleBg:"var(--pf-surface-subtleBg)",panelHover:"var(--pf-surface-panelHover)",subtleHover:"var(--pf-surface-subtleHover)",overlayBg:"var(--pf-surface-overlayBg)",border:"var(--pf-surface-border)"},text:{primary:"var(--pf-text-primary)",secondary:"var(--pf-text-secondary)",muted:"var(--pf-text-muted)",onColors:Object.fromEntries(Object.keys(an(e.text.onColors)).map(l=>[l,`var(--pf-text-on-${l})`]))}}}var vc=(e,t)=>{let n=e?.palette??{};return !t||t==="neutral"?"neutral":n[t]?t:"neutral"},Da=(e,t)=>{let n=vc(e,t);if(n==="neutral")return {soft:"var(--pf-focus-soft)",main:"var(--pf-focus-main)"};let o=e?.palette?.[n];return o?{soft:o[300]??"transparent",main:o[600]??o[500]??"currentColor"}:{soft:"var(--pf-focus-soft)",main:"var(--pf-focus-main)"}};function xe(){let e=V();return t=>{if(!((t?.enabled??true)&&!t?.disabled)||t?.mode==="none")return css({});let{soft:o,main:r}=Da(e,t?.color),s=t?.haloWidth??3,i=t?.offset??0,c=t?.mode==="always"?"&:focus":"&:focus-visible",a={transition:"box-shadow .16s ease, border-color 0s ease, outline-color 0s ease, outline-offset .16s ease",":root.pf-mode-switching &":{transition:"none !important"},"&[disabled], &[aria-disabled='true'], &[data-disabled='true']":{boxShadow:"none !important"}};return a[c]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:i,zIndex:1e4},css(a)}}function Yo(){let e=V();return t=>{if(!((t?.enabled??true)&&!t?.disabled)||t?.mode==="none")return css({});let{soft:o,main:r}=Da(e,t?.color),s=t?.haloWidth??3,i=t?.offset??0,c=t?.mode==="always"?"&:focus-within":"&:has(:focus-visible)",a={position:"relative",transition:"box-shadow .16s ease, border-color 0s ease, outline-color 0s ease, outline-offset .16s ease",":root.pf-mode-switching &":{transition:"none !important"},"&[disabled], &[aria-disabled='true'], &[data-disabled='true']":{boxShadow:"none !important"}};return a[c]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:i,zIndex:1e3},css(a)}}var $a=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,za=e=>{let t=e.type;return t?.__PFUI_SLOT||t?.displayName||t?.name||""},es=forwardRef(({children:e,expandIcon:t,expandIconPosition:n="right",hideExpandIcon:o=false,className:r,css:s,expandIconCss:i},c)=>{let a=V(),l=a.typography.sizes.sm,u=20,d=10,y=a.spacing.lg,f=a.spacing.md,T=Number(a.componentHeights?.md),I=a.text,x=css({display:"flex",alignItems:"center",outline:"none",userSelect:"none",fontWeight:500,minHeight:T,padding:`${f} ${y}`,gap:d,fontSize:l,color:I.primary}),R=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:8}),g=css({marginRight:0,marginLeft:-2,lineHeight:0,color:a.text.secondary}),p=css({marginLeft:5,marginRight:-2,lineHeight:0,color:a.text.secondary});return jsxs("div",{ref:c,role:"presentation",tabIndex:-1,className:["plainframe-ui-accordion-summary",r||""].join(" ").trim(),css:[x,s],children:[!o&&n==="left"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-left",css:[g,i],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:u,height:u}})}),jsx("span",{className:"plainframe-ui-accordion-content",css:R,children:e}),!o&&n==="right"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-right",css:[p,i],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:u,height:u}})})]})});es.__PFUI_SLOT="AccordionSummary";es.displayName="AccordionSummary";var ts=({children:e,className:t,css:n})=>{let o=V(),r=o.typography.sizes.sm,s=o.spacing.lg,i="0.15rem",c=o.spacing.md,a=css({padding:`${i} ${s} ${c} ${s}`,fontSize:r,boxSizing:"border-box",minHeight:0});return jsx("div",{className:["plainframe-ui-accordion-details",t||""].join(" ").trim(),css:[a,n],tabIndex:-1,children:e})};ts.__PFUI_SLOT="AccordionDetails";ts.displayName="AccordionDetails";var Oa=({open:e,defaultOpen:t=false,onChange:n,className:o,variant:r="subtle",disabled:s=false,width:i,fullWidth:c=false,css:a,children:l})=>{let u=V(),d=useId(),y=useId(),f=u.radius?.md,T=u.text,I=u.componentHeights?.border??1,x=$a(I)??"1px",R=e!==void 0,[g,p]=useState(!!t),m=R?!!e:g,C=xe(),[P,w]=useState(0),[v,N]=useState(false),B=useRef(null),K=useRef(null),O=useRef(null),S=()=>{if(!m)return;let H=document.activeElement;K.current?.contains(H)&&O.current?.focus();},F=()=>{s||(S(),R?n?.(!e):p(H=>{let U=!H;return n?.(U),U}));},M=me.Children.toArray(l).filter(H=>isValidElement(H)),b=M.findIndex(H=>za(H)==="AccordionSummary"),h=M.findIndex(H=>za(H)==="AccordionDetails");b===-1&&M.length&&(b=0),h===-1&&(h=M.findIndex((H,U)=>U!==b),h===-1&&M.length>=2&&(h=1));let A=M[b]??null,D=M[h]??null,L=r==="subtle"?u.surface.subtleBg:r==="outlined"?u.surface.panelBg:"transparent",k=css({backgroundColor:L,color:T.primary,borderRadius:f,border:r==="outlined"?`${x} solid ${u.surface.border}`:"none",outline:"none",marginBottom:u.spacing.sm,maxWidth:i!=null?$a(i):void 0,width:c?"100%":i!=null?void 0:"auto",boxSizing:"border-box",opacity:s?.55:1,cursor:s?"not-allowed":void 0});useLayoutEffect(()=>{let H=B.current;H&&w(H.scrollHeight);},[m,l]),useEffect(()=>{let H=B.current;if(!H)return;let U=new ResizeObserver(()=>w(H.scrollHeight));return U.observe(H),()=>U.disconnect()},[]),useEffect(()=>{P>0&&!v&&N(true);},[P,v]),useLayoutEffect(()=>{if(!m&&K.current){let H=document.activeElement;K.current.contains(H)&&O.current?.focus();}},[m]),useLayoutEffect(()=>{let H=K.current;if(!H)return;let U=Array.from(H.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]"));m?(U.forEach(X=>{let ae=X.dataset.accordionTabindex;ae!=null&&(ae===""?X.removeAttribute("tabindex"):X.tabIndex=Number(ae),delete X.dataset.accordionTabindex);}),H.removeAttribute("inert")):(U.forEach(X=>{X.dataset.accordionTabindex==null&&(X.dataset.accordionTabindex=X.hasAttribute("tabindex")?X.getAttribute("tabindex")??"":""),X.tabIndex=-1;}),H.setAttribute("inert",""));},[m]);let E=css({maxHeight:m?P||"none":0,overflow:m&&!v?"visible":"hidden",transition:v?"max-height 0.36s cubic-bezier(.25,.8,.4,1)":"none",willChange:v?"max-height":void 0}),W=css({opacity:m?1:0,transform:m?"translateY(0)":"translateY(1rem)",transition:v?"transform 0.28s ease, opacity 0.28s ease":"none"}),$=css({"& .plainframe-ui-accordion-icon":{transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1)",transform:m?"rotate(180deg)":"rotate(0deg)"}}),z=A&&cloneElement(A,{...typeof A.props=="object"&&A.props?A.props:{},className:[A.props?.className,"plainframe-ui-accordion-summary-managed"].filter(Boolean).join(" ")}),_=D;return jsxs("div",{className:["plainframe-ui-accordion",`plainframe-ui-accordion-${r}`,o||""].join(" ").trim(),"data-variant":r,"data-open":m?"true":"false","data-disabled":s?"true":"false",css:[C(),k,a],tabIndex:s?-1:0,ref:O,role:"button","aria-expanded":m,"aria-controls":d,"aria-labelledby":y,"aria-disabled":s||void 0,onClick:H=>{H.detail===0&&document.activeElement!==O.current||F();},onKeyDown:H=>{s||document.activeElement===O.current&&H.target===O.current&&(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),F());},children:[jsx("div",{id:y,className:"plainframe-ui-accordion-summary-wrapper",css:[css({cursor:s?"not-allowed":"pointer"}),$],children:z}),jsx("div",{id:d,"aria-hidden":!m,className:"plainframe-ui-accordion-details-clip",css:E,tabIndex:-1,ref:K,onClick:H=>H.stopPropagation(),children:jsx("div",{ref:B,className:"plainframe-ui-accordion-details-inner",css:W,children:_})})]})};Oa.displayName="Accordion";var Ac=e=>isValidElement(e),Pc=e=>Ac(e)?e.type?.displayName||e.type?.name:void 0,Ka=e=>Pc(e)==="Accordion",Nc=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Dc=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,_a=({children:e,attached:t=false,variant:n,exclusive:o=false,openIndex:r,defaultOpenIndex:s,onOpenIndexChange:i,disabled:c=false,width:a,fullWidth:l=false,className:u,role:d="group",css:y})=>{let f=V(),T=useRef(null),I=Children.toArray(e),x=I.filter(Ka),R=x.length,g=o&&r!==void 0,[p,m]=useState(()=>{if(!o)return null;if(s!==void 0)return s;for(let F=0;F<x.length;F++){let M=x[F].props;if(M.open||M.defaultOpen)return F}return null}),C=o?g?r??null:p:null,P=Dc(f.componentHeights?.border,1),w=f.surface.border,v=f.radius.md,N=n,B=N==="outlined";useEffect(()=>{let F=T.current;if(!F)return;let M=b=>{if(b.key!=="ArrowDown"&&b.key!=="ArrowUp"&&b.key!=="Home"&&b.key!=="End")return;let A=Array.from(F.querySelectorAll(".plainframe-ui-accordion")).filter(E=>E.getAttribute("data-disabled")!=="true");if(A.length===0)return;let D=document.activeElement,L=A.findIndex(E=>E.contains(D));if(L===-1)return;b.preventDefault();let k=L;b.key==="ArrowDown"?k=(L+1)%A.length:b.key==="ArrowUp"?k=(L-1+A.length)%A.length:b.key==="Home"?k=0:b.key==="End"&&(k=A.length-1),A[k]?.focus();};return F.addEventListener("keydown",M),()=>F.removeEventListener("keydown",M)},[R]);let K=css({display:"flex",flexDirection:"column",maxWidth:a!=null?Nc(a):void 0,width:l?"100%":a!=null?void 0:"auto",gap:t?0:f.spacing.sm,border:t&&B?`${P} solid ${w}`:"none",borderRadius:t&&B?v:void 0,background:t&&B?f.surface.panelBg:"transparent"}),O=0,S=[];return I.forEach((F,M)=>{if(!Ka(F)){S.push(F);return}let b=F.props,h=O++,A=h===0,D=h===R-1,L=c||!!b.disabled,k=N??b.variant,E=t?css({width:"100%",marginBottom:0,borderTopLeftRadius:A?v:0,borderTopRightRadius:A?v:0,borderBottomLeftRadius:D?v:0,borderBottomRightRadius:D?v:0}):css({width:"100%",marginBottom:0}),W=!A&&R>1&&t?css({borderTop:`${P} solid ${w}`}):null,$=B?css({border:"1px solid transparent"}):null,z={variant:k,disabled:L,width:"100%",css:[b.css,E,$,W],className:[b.className,"plainframe-ui-accordion-group-item"].filter(Boolean).join(" ")};if(o){let _=b.onChange,H=C===h;z.open=H,z.defaultOpen=void 0,z.onChange=U=>{let X=U?h:null;g||m(X),i?.(X),_?.(U);};}S.push(cloneElement(F,{...b,...z,key:F?.key??M}));}),jsx("div",{ref:T,role:d,"aria-orientation":"vertical","data-attached":t||void 0,"data-exclusive":o||void 0,className:["plainframe-ui-accordion-group",u||""].join(" ").trim(),css:[K,y],children:S})};_a.displayName="AccordionGroup";var jt=e=>typeof e=="number"?`${e}px`:e,Va=({children:e,open:t=true,anchorOrigin:n={horizontal:"center",vertical:"bottom"},direction:o="horizontal",padding:r="sm",gap:s="xs",radius:i="lg",offset:c=0,offsetX:a=0,offsetY:l=0,elevated:u=true,unstyled:d=false,fullWidth:y=false,width:f,height:T,role:I="toolbar","aria-label":x,onClose:R})=>{let g=V(),p=useRef(null),m=useRef(null),C=useRef(false),P=useRef(t),w=n.horizontal??"center",v=n.vertical??"bottom",N=k=>typeof k=="string"?g.spacing[k]??k:k,B=k=>typeof k=="string"?g.radius[k]??k:k,K=jt(N(c)),O=jt(N(a)),S=jt(N(l)),F={position:"fixed",left:0,right:0,top:0,bottom:0,display:"flex",pointerEvents:"none",zIndex:1e3,justifyContent:w==="left"?"flex-start":w==="right"?"flex-end":"center",alignItems:v==="top"?"flex-start":v==="bottom"?"flex-end":"center"},M=()=>`${w==="left"?"left":w==="right"?"right":"center"} ${v==="top"?"top":v==="bottom"?"bottom":"center"}`,b=()=>v==="top"||v==="bottom"?`translateY(${v==="bottom"?100:-100}px) scale(0.98)`:v==="center"?w==="left"?"translateX(-100px) scale(0.98)":w==="right"?"translateX(100px) scale(0.98)":"scale(0.95)":"scale(0.98)",h=()=>v==="center"&&w==="center"?"scale(1)":"translateX(0) translateY(0) scale(1)",A=24,D={margin:A,marginTop:v==="top"?`calc(${A}px + ${K} + ${S})`:A,marginBottom:v==="bottom"?`calc(${A}px + ${K} + ${S})`:A,marginLeft:w==="left"?`calc(${A}px + ${K} + ${O})`:A,marginRight:w==="right"?`calc(${A}px + ${K} + ${O})`:A,padding:d?0:jt(N(r)),background:d?"transparent":g.surface.panelBg,border:d?"none":`1px solid ${g.surface.border}`,borderRadius:d?0:jt(B(i)),boxShadow:d||!u?"none":"0 20px 40px rgba(0,0,0,.08)",display:"flex",flexDirection:o==="vertical"?"column":"row",gap:jt(N(s)),transformOrigin:M(),pointerEvents:t?"auto":"none",width:y?"calc(100% - 48px)":f?jt(f):"auto",height:T?jt(T):"auto",maxWidth:y?"100%":"none"},L=css({"& .plainframe-ui-textfield":{flex:1,minWidth:0}});return useLayoutEffect(()=>{let k=p.current;if(!k)return;let E=b(),W=h();if(!C.current){C.current=true,P.current=t,k.style.opacity=t?"1":"0",k.style.transform=t?W:E;return}if(P.current===t){k.style.opacity=t?"1":"0",k.style.transform=t?W:E;return}P.current=t,m.current&&m.current.cancel();let $=t?[{opacity:0,transform:E},{opacity:1,transform:W}]:[{opacity:1,transform:W},{opacity:0,transform:E}];return m.current=k.animate($,{duration:250,easing:"ease",fill:"forwards"}),()=>{m.current&&m.current.cancel();}},[t,w,v]),useEffect(()=>{if(!t||!R)return;let k=E=>{E.key==="Escape"&&R();};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[t,R]),jsx("div",{css:F,children:jsx("div",{ref:p,css:L,style:D,role:I,"aria-label":x,"aria-hidden":!t,...!t&&{inert:true},children:e})})};Va.displayName="ActionBar";var qa=(e,t,n)=>Math.min(n,Math.max(t,e)),ns=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Ua=1,Oc=keyframes`100% { transform: rotate(360deg); }`,Wc=keyframes`
5
+ ${h}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m();let L=l.get();if(B(L),K(L),!s)try{let k=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...k,primary:b}));}catch{}},[T,I,r,s,l,u,m,B,K]),M=jsx(Pa.Provider,{value:{light:T,dark:I},children:jsx(Sa.Provider,{value:l,children:jsx(Ma.Provider,{value:u,children:jsx(Fa.Provider,{value:{setMode:O,toggleMode:S},children:jsx(Aa.Provider,{value:{setPrimary:F},children:jsx(ThemeProvider,{theme:xc(T),children:e})})})})})});return s?jsx("div",{ref:d,"data-pfui-scope":r,style:{background:"var(--pf-surface-appBg)",color:"var(--pf-text-primary)"},children:M}):jsx("div",{ref:d,children:M})};function xc(e){let t=(l,u)=>Object.fromEntries(Object.keys(l).map(d=>[d,u(d)])),n=t(e.spacing,l=>`var(--pf-space-${l})`),o=t(e.radius,l=>`var(--pf-radius-${l})`),r=t(e.typography.sizes,l=>`var(--pf-fontSize-${l})`),s=t(e.componentHeights,l=>`var(--pf-cmph-${l})`),a={sans:"var(--pf-font-sans)",mono:"var(--pf-font-mono)"},c=t(e.neutral,l=>`var(--pf-neutral-${l})`),i={};return Object.keys(e.palette).forEach(l=>{i[l]={},Object.keys(e.palette[l]).forEach(u=>{i[l][u]=`var(--pf-palette-${l}-${u})`;});}),i.primary=Object.fromEntries(["0","50","100","200","300","400","500","600","700","800","900"].map(l=>[l,`var(--pf-primary-${l})`])),{...e,spacing:n,radius:o,componentHeights:s,typography:{fonts:a,sizes:r},neutral:c,palette:i,surface:{appBg:"var(--pf-surface-appBg)",panelBg:"var(--pf-surface-panelBg)",subtleBg:"var(--pf-surface-subtleBg)",panelHover:"var(--pf-surface-panelHover)",subtleHover:"var(--pf-surface-subtleHover)",overlayBg:"var(--pf-surface-overlayBg)",border:"var(--pf-surface-border)"},text:{primary:"var(--pf-text-primary)",secondary:"var(--pf-text-secondary)",muted:"var(--pf-text-muted)",onColors:Object.fromEntries(Object.keys(an(e.text.onColors)).map(l=>[l,`var(--pf-text-on-${l})`]))}}}var vc=(e,t)=>{let n=e?.palette??{};return !t||t==="neutral"?"neutral":n[t]?t:"neutral"},Da=(e,t)=>{let n=vc(e,t);if(n==="neutral")return {soft:"var(--pf-focus-soft)",main:"var(--pf-focus-main)"};let o=e?.palette?.[n];return o?{soft:o[300]??"transparent",main:o[600]??o[500]??"currentColor"}:{soft:"var(--pf-focus-soft)",main:"var(--pf-focus-main)"}};function xe(){let e=V();return t=>{if(!((t?.enabled??true)&&!t?.disabled)||t?.mode==="none")return css({});let{soft:o,main:r}=Da(e,t?.color),s=t?.haloWidth??3,a=t?.offset??0,c=t?.mode==="always"?"&:focus":"&:focus-visible",i={transition:"box-shadow .16s ease, border-color 0s ease, outline-color 0s ease, outline-offset .16s ease",":root.pf-mode-switching &":{transition:"none !important"},"&[disabled], &[aria-disabled='true'], &[data-disabled='true']":{boxShadow:"none !important"}};return i[c]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:a,zIndex:1e4},css(i)}}function Yo(){let e=V();return t=>{if(!((t?.enabled??true)&&!t?.disabled)||t?.mode==="none")return css({});let{soft:o,main:r}=Da(e,t?.color),s=t?.haloWidth??3,a=t?.offset??0,c=t?.mode==="always"?"&:focus-within":"&:has(:focus-visible)",i={position:"relative",transition:"box-shadow .16s ease, border-color 0s ease, outline-color 0s ease, outline-offset .16s ease",":root.pf-mode-switching &":{transition:"none !important"},"&[disabled], &[aria-disabled='true'], &[data-disabled='true']":{boxShadow:"none !important"}};return i[c]={boxShadow:`0 0 0 ${s}px ${o}`,borderColor:r,outlineColor:r,outlineOffset:a,zIndex:1e3},css(i)}}var $a=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,za=e=>{let t=e.type;return t?.__PFUI_SLOT||t?.displayName||t?.name||""},es=forwardRef(({children:e,expandIcon:t,expandIconPosition:n="right",hideExpandIcon:o=false,className:r,css:s,expandIconCss:a},c)=>{let i=V(),l=i.typography.sizes.sm,u=20,d=10,y=i.spacing.lg,f=i.spacing.md,T=Number(i.componentHeights?.md),I=i.text,x=css({display:"flex",alignItems:"center",outline:"none",userSelect:"none",fontWeight:500,minHeight:T,padding:`${f} ${y}`,gap:d,fontSize:l,color:I.primary}),R=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",gap:8}),g=css({marginRight:0,marginLeft:-2,lineHeight:0,color:i.text.secondary}),p=css({marginLeft:5,marginRight:-2,lineHeight:0,color:i.text.secondary});return jsxs("div",{ref:c,role:"presentation",tabIndex:-1,className:["plainframe-ui-accordion-summary",r||""].join(" ").trim(),css:[x,s],children:[!o&&n==="left"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-left",css:[g,a],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:u,height:u}})}),jsx("span",{className:"plainframe-ui-accordion-content",css:R,children:e}),!o&&n==="right"&&jsx("span",{className:"plainframe-ui-accordion-icon plainframe-ui-accordion-icon-right",css:[p,a],children:t??jsx(ChevronDown,{strokeWidth:2,css:{width:u,height:u}})})]})});es.__PFUI_SLOT="AccordionSummary";es.displayName="AccordionSummary";var ts=({children:e,className:t,css:n})=>{let o=V(),r=o.typography.sizes.sm,s=o.spacing.lg,a="0.15rem",c=o.spacing.md,i=css({padding:`${a} ${s} ${c} ${s}`,fontSize:r,boxSizing:"border-box",minHeight:0});return jsx("div",{className:["plainframe-ui-accordion-details",t||""].join(" ").trim(),css:[i,n],tabIndex:-1,children:e})};ts.__PFUI_SLOT="AccordionDetails";ts.displayName="AccordionDetails";var Oa=({open:e,defaultOpen:t=false,onChange:n,className:o,variant:r="subtle",disabled:s=false,width:a,fullWidth:c=false,css:i,children:l})=>{let u=V(),d=useId(),y=useId(),f=u.radius?.md,T=u.text,I=u.componentHeights?.border??1,x=$a(I)??"1px",R=e!==void 0,[g,p]=useState(!!t),m=R?!!e:g,C=xe(),[P,w]=useState(0),[v,N]=useState(false),B=useRef(null),K=useRef(null),O=useRef(null),S=()=>{if(!m)return;let H=document.activeElement;K.current?.contains(H)&&O.current?.focus();},F=()=>{s||(S(),R?n?.(!e):p(H=>{let U=!H;return n?.(U),U}));},M=me.Children.toArray(l).filter(H=>isValidElement(H)),b=M.findIndex(H=>za(H)==="AccordionSummary"),h=M.findIndex(H=>za(H)==="AccordionDetails");b===-1&&M.length&&(b=0),h===-1&&(h=M.findIndex((H,U)=>U!==b),h===-1&&M.length>=2&&(h=1));let A=M[b]??null,D=M[h]??null,L=r==="subtle"?u.surface.subtleBg:r==="outlined"?u.surface.panelBg:"transparent",k=css({backgroundColor:L,color:T.primary,borderRadius:f,border:r==="outlined"?`${x} solid ${u.surface.border}`:"none",outline:"none",marginBottom:u.spacing.sm,maxWidth:a!=null?$a(a):void 0,width:c?"100%":a!=null?void 0:"auto",boxSizing:"border-box",opacity:s?.55:1,cursor:s?"not-allowed":void 0});useLayoutEffect(()=>{let H=B.current;H&&w(H.scrollHeight);},[m,l]),useEffect(()=>{let H=B.current;if(!H)return;let U=new ResizeObserver(()=>w(H.scrollHeight));return U.observe(H),()=>U.disconnect()},[]),useEffect(()=>{P>0&&!v&&N(true);},[P,v]),useLayoutEffect(()=>{if(!m&&K.current){let H=document.activeElement;K.current.contains(H)&&O.current?.focus();}},[m]),useLayoutEffect(()=>{let H=K.current;if(!H)return;let U=Array.from(H.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, [tabindex]"));m?(U.forEach(X=>{let ae=X.dataset.accordionTabindex;ae!=null&&(ae===""?X.removeAttribute("tabindex"):X.tabIndex=Number(ae),delete X.dataset.accordionTabindex);}),H.removeAttribute("inert")):(U.forEach(X=>{X.dataset.accordionTabindex==null&&(X.dataset.accordionTabindex=X.hasAttribute("tabindex")?X.getAttribute("tabindex")??"":""),X.tabIndex=-1;}),H.setAttribute("inert",""));},[m]);let E=css({maxHeight:m?P||"none":0,overflow:m&&!v?"visible":"hidden",transition:v?"max-height 0.36s cubic-bezier(.25,.8,.4,1)":"none",willChange:v?"max-height":void 0}),W=css({opacity:m?1:0,transform:m?"translateY(0)":"translateY(1rem)",transition:v?"transform 0.28s ease, opacity 0.28s ease":"none"}),$=css({"& .plainframe-ui-accordion-icon":{transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1)",transform:m?"rotate(180deg)":"rotate(0deg)"}}),z=A&&cloneElement(A,{...typeof A.props=="object"&&A.props?A.props:{},className:[A.props?.className,"plainframe-ui-accordion-summary-managed"].filter(Boolean).join(" ")}),_=D;return jsxs("div",{className:["plainframe-ui-accordion",`plainframe-ui-accordion-${r}`,o||""].join(" ").trim(),"data-variant":r,"data-open":m?"true":"false","data-disabled":s?"true":"false",css:[C(),k,i],tabIndex:s?-1:0,ref:O,role:"button","aria-expanded":m,"aria-controls":d,"aria-labelledby":y,"aria-disabled":s||void 0,onClick:H=>{H.detail===0&&document.activeElement!==O.current||F();},onKeyDown:H=>{s||document.activeElement===O.current&&H.target===O.current&&(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),F());},children:[jsx("div",{id:y,className:"plainframe-ui-accordion-summary-wrapper",css:[css({cursor:s?"not-allowed":"pointer"}),$],children:z}),jsx("div",{id:d,"aria-hidden":!m,className:"plainframe-ui-accordion-details-clip",css:E,tabIndex:-1,ref:K,onClick:H=>H.stopPropagation(),children:jsx("div",{ref:B,className:"plainframe-ui-accordion-details-inner",css:W,children:_})})]})};Oa.displayName="Accordion";var Ac=e=>isValidElement(e),Pc=e=>Ac(e)?e.type?.displayName||e.type?.name:void 0,Ka=e=>Pc(e)==="Accordion",Nc=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Dc=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,_a=({children:e,attached:t=false,variant:n,exclusive:o=false,openIndex:r,defaultOpenIndex:s,onOpenIndexChange:a,disabled:c=false,width:i,fullWidth:l=false,className:u,role:d="group",css:y})=>{let f=V(),T=useRef(null),I=Children.toArray(e),x=I.filter(Ka),R=x.length,g=o&&r!==void 0,[p,m]=useState(()=>{if(!o)return null;if(s!==void 0)return s;for(let F=0;F<x.length;F++){let M=x[F].props;if(M.open||M.defaultOpen)return F}return null}),C=o?g?r??null:p:null,P=Dc(f.componentHeights?.border,1),w=f.surface.border,v=f.radius.md,N=n,B=N==="outlined";useEffect(()=>{let F=T.current;if(!F)return;let M=b=>{if(b.key!=="ArrowDown"&&b.key!=="ArrowUp"&&b.key!=="Home"&&b.key!=="End")return;let A=Array.from(F.querySelectorAll(".plainframe-ui-accordion")).filter(E=>E.getAttribute("data-disabled")!=="true");if(A.length===0)return;let D=document.activeElement,L=A.findIndex(E=>E.contains(D));if(L===-1)return;b.preventDefault();let k=L;b.key==="ArrowDown"?k=(L+1)%A.length:b.key==="ArrowUp"?k=(L-1+A.length)%A.length:b.key==="Home"?k=0:b.key==="End"&&(k=A.length-1),A[k]?.focus();};return F.addEventListener("keydown",M),()=>F.removeEventListener("keydown",M)},[R]);let K=css({display:"flex",flexDirection:"column",maxWidth:i!=null?Nc(i):void 0,width:l?"100%":i!=null?void 0:"auto",gap:t?0:f.spacing.sm,border:t&&B?`${P} solid ${w}`:"none",borderRadius:t&&B?v:void 0,background:t&&B?f.surface.panelBg:"transparent"}),O=0,S=[];return I.forEach((F,M)=>{if(!Ka(F)){S.push(F);return}let b=F.props,h=O++,A=h===0,D=h===R-1,L=c||!!b.disabled,k=N??b.variant,E=t?css({width:"100%",marginBottom:0,borderTopLeftRadius:A?v:0,borderTopRightRadius:A?v:0,borderBottomLeftRadius:D?v:0,borderBottomRightRadius:D?v:0}):css({width:"100%",marginBottom:0}),W=!A&&R>1&&t?css({borderTop:`${P} solid ${w}`}):null,$=B?css({border:"1px solid transparent"}):null,z={variant:k,disabled:L,width:"100%",css:[b.css,E,$,W],className:[b.className,"plainframe-ui-accordion-group-item"].filter(Boolean).join(" ")};if(o){let _=b.onChange,H=C===h;z.open=H,z.defaultOpen=void 0,z.onChange=U=>{let X=U?h:null;g||m(X),a?.(X),_?.(U);};}S.push(cloneElement(F,{...b,...z,key:F?.key??M}));}),jsx("div",{ref:T,role:d,"aria-orientation":"vertical","data-attached":t||void 0,"data-exclusive":o||void 0,className:["plainframe-ui-accordion-group",u||""].join(" ").trim(),css:[K,y],children:S})};_a.displayName="AccordionGroup";var jt=e=>typeof e=="number"?`${e}px`:e,Va=({children:e,open:t=true,anchorOrigin:n={horizontal:"center",vertical:"bottom"},direction:o="horizontal",padding:r="sm",gap:s="xs",radius:a="lg",offset:c=0,offsetX:i=0,offsetY:l=0,elevated:u=true,unstyled:d=false,fullWidth:y=false,width:f,height:T,role:I="toolbar","aria-label":x,onClose:R})=>{let g=V(),p=useRef(null),m=useRef(null),C=useRef(false),P=useRef(t),w=n.horizontal??"center",v=n.vertical??"bottom",N=k=>typeof k=="string"?g.spacing[k]??k:k,B=k=>typeof k=="string"?g.radius[k]??k:k,K=jt(N(c)),O=jt(N(i)),S=jt(N(l)),F={position:"fixed",left:0,right:0,top:0,bottom:0,display:"flex",pointerEvents:"none",zIndex:1e3,justifyContent:w==="left"?"flex-start":w==="right"?"flex-end":"center",alignItems:v==="top"?"flex-start":v==="bottom"?"flex-end":"center"},M=()=>`${w==="left"?"left":w==="right"?"right":"center"} ${v==="top"?"top":v==="bottom"?"bottom":"center"}`,b=()=>v==="top"||v==="bottom"?`translateY(${v==="bottom"?100:-100}px) scale(0.98)`:v==="center"?w==="left"?"translateX(-100px) scale(0.98)":w==="right"?"translateX(100px) scale(0.98)":"scale(0.95)":"scale(0.98)",h=()=>v==="center"&&w==="center"?"scale(1)":"translateX(0) translateY(0) scale(1)",A=24,D={margin:A,marginTop:v==="top"?`calc(${A}px + ${K} + ${S})`:A,marginBottom:v==="bottom"?`calc(${A}px + ${K} + ${S})`:A,marginLeft:w==="left"?`calc(${A}px + ${K} + ${O})`:A,marginRight:w==="right"?`calc(${A}px + ${K} + ${O})`:A,padding:d?0:jt(N(r)),background:d?"transparent":g.surface.panelBg,border:d?"none":`1px solid ${g.surface.border}`,borderRadius:d?0:jt(B(a)),boxShadow:d||!u?"none":"0 20px 40px rgba(0,0,0,.08)",display:"flex",flexDirection:o==="vertical"?"column":"row",gap:jt(N(s)),transformOrigin:M(),pointerEvents:t?"auto":"none",width:y?"calc(100% - 48px)":f?jt(f):"auto",height:T?jt(T):"auto",maxWidth:y?"100%":"none"},L=css({"& .plainframe-ui-textfield":{flex:1,minWidth:0}});return useLayoutEffect(()=>{let k=p.current;if(!k)return;let E=b(),W=h();if(!C.current){C.current=true,P.current=t,k.style.opacity=t?"1":"0",k.style.transform=t?W:E;return}if(P.current===t){k.style.opacity=t?"1":"0",k.style.transform=t?W:E;return}P.current=t,m.current&&m.current.cancel();let $=t?[{opacity:0,transform:E},{opacity:1,transform:W}]:[{opacity:1,transform:W},{opacity:0,transform:E}];return m.current=k.animate($,{duration:250,easing:"ease",fill:"forwards"}),()=>{m.current&&m.current.cancel();}},[t,w,v]),useEffect(()=>{if(!t||!R)return;let k=E=>{E.key==="Escape"&&R();};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[t,R]),jsx("div",{css:F,children:jsx("div",{ref:p,css:L,style:D,role:I,"aria-label":x,"aria-hidden":!t,...!t&&{inert:true},children:e})})};Va.displayName="ActionBar";var qa=(e,t,n)=>Math.min(n,Math.max(t,e)),ns=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Ua=1,Oc=keyframes`100% { transform: rotate(360deg); }`,Wc=keyframes`
6
6
  0% { left: -35%; right: 100%; }
7
7
  60% { left: 100%; right: -90%; }
8
8
  100% { left: 100%; right: -90%; }
@@ -10,14 +10,14 @@ ${h}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"")),m()
10
10
  0% { left: -200%; right: 100%; }
11
11
  60% { left: 107%; right: -8%; }
12
12
  100% { left: 107%; right: -8%; }
13
- `,_c=e=>e.startsWith("#")||e.startsWith("rgb(")||e.startsWith("rgba(")||e.startsWith("hsl(")||e.startsWith("hsla(")||e.startsWith("oklch(")||e.startsWith("lab(")||e.startsWith("color(")||e.startsWith("var("),jc=new Set(["0","50","100","200","300","400","500","600","700","800","900"]);function Vc(e,t){if(!t||t.trim()==="")return e.text.primary;let n=t.trim();if(_c(n))return n;let o=n.match(/^([a-zA-Z0-9_-]+)[\.\-:\s]?([0-9]{1,3})?$/);if(o){let r=o[1],s=o[2]&&jc.has(o[2])?o[2]:"600";if(r==="primary"&&e.palette.primary?.[s])return e.palette.primary[s];let i=e.palette[r];if(i&&i[s]!=null)return i[s];if(r==="neutral"||r==="secondary"&&e.neutral[s]!=null)return e.neutral[s]}return e.palette.primary[600]}var no=me.memo(({variant:e="circular",value:t,min:n=0,max:o=100,color:r,size:s,thickness:i,spinDuration:c=.75,wrapperCss:a,trackCss:l,barCss:u,circleCss:d,"aria-label":y})=>{let f=V(),T=typeof t=="number",I=Math.max(o-n,1),x=T?qa(t,n,o):void 0,R=T?(x-n)/I*100:void 0,g=Vc(f,r),p=f.surface.subtleBg,m=f.radius?.md;return e==="circular"?jsx(qc,{size:s,active:g,isDeterminate:T,percent:R,spinDuration:c,wrapperCss:a,trackCss:l,circleCss:d,ariaLabel:y,thickness:i}):jsx(Uc,{thickness:i,active:g,track:p,radius:m,isDeterminate:T,percent:R,wrapperCss:a,trackCss:l,barCss:u,ariaLabel:y,min:n,max:o,value:x})}),Uc=({thickness:e=4,active:t,track:n,radius:o,isDeterminate:r,percent:s,wrapperCss:i,trackCss:c,barCss:a,ariaLabel:l,min:u,max:d,value:y})=>{let f=o==null?"8px":typeof o=="number"?`${o}px`:String(o),T=css([{display:"inline-block",width:"100%"},...Array.isArray(i)?i:i?[i]:[]]),I=css([{position:"relative",width:"100%",height:ns(e,"6px"),backgroundColor:n,borderRadius:f,overflow:"hidden"},...Array.isArray(c)?c:c?[c]:[]]),x=r?Math.max(s??0,Ua):Ua,R=css([{position:"absolute",inset:0,backgroundColor:t,borderRadius:"inherit",transformOrigin:"left",transform:`scaleX(${x/100})`,transition:"transform 160ms cubic-bezier(.2,0,.2,1)",willChange:"transform"},...Array.isArray(a)?a:a?[a]:[]]),g={position:"absolute",top:0,bottom:0,backgroundColor:t,borderRadius:"inherit",willChange:"left,right","@media (prefers-reduced-motion: reduce)":{animation:"none"}},p=css([{...g,left:"-35%",right:"100%",animation:`${Wc} 2.1s cubic-bezier(.65,.815,.735,.395) infinite`},...Array.isArray(a)?a:a?[a]:[]]),m=css([{...g,left:"-200%",right:"100%",animation:`${Kc} 2.1s cubic-bezier(.165,.84,.44,1) 1.15s infinite`},...Array.isArray(a)?a:a?[a]:[]]),C=r?{role:"progressbar","aria-valuemin":u,"aria-valuemax":d,"aria-valuenow":y}:{role:"progressbar","aria-busy":true};return l&&(C["aria-label"]=l),jsx("span",{css:T,...C,children:jsx("div",{className:"plainframe-ui-progress-linear-track",css:I,children:r?jsx("div",{className:"plainframe-ui-progress-linear-fill",css:R}):jsxs(Fragment,{children:[jsx("div",{className:"plainframe-ui-progress-linear-runner1",css:p}),jsx("div",{className:"plainframe-ui-progress-linear-runner2",css:m})]})})})},qc=({size:e,thickness:t=4,active:n,isDeterminate:o,percent:r,spinDuration:s,wrapperCss:i,trackCss:c,circleCss:a,ariaLabel:l})=>{let u=V(),d=40,y=(d-t)/2,f=2*Math.PI*y,I=`${(o?qa((r??0)/100,.01,1):.7)*f} ${f}`,x=css([{display:"inline-block",width:ns(e,`${u.componentHeights.md}`),height:ns(e,`${u.componentHeights.md}`)},...Array.isArray(i)?i:i?[i]:[]]),R=css([{width:"100%",height:"100%",transform:"rotate(-90deg)",transformBox:"fill-box",transformOrigin:"50% 50%"},...Array.isArray(c)?c:c?[c]:[]]),g=css([{stroke:n,strokeLinecap:"butt",strokeDasharray:I,strokeDashoffset:0,transition:o?"stroke-dasharray 160ms cubic-bezier(.2,0,.2,1)":"none",transformBox:"fill-box",transformOrigin:"50% 50%",fill:"none",willChange:o?"stroke-dasharray":"transform",animation:o?"none":`${Oc} ${s}s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}},...Array.isArray(a)?a:a?[a]:[]]),p=o?{role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r??0)}:{role:"progressbar","aria-busy":true};return l&&(p["aria-label"]=l),jsx("span",{css:x,className:"plainframe-ui-progress-circular",...p,children:jsx("svg",{css:R,viewBox:`0 0 ${d} ${d}`,focusable:"false","aria-hidden":true,children:jsx("circle",{cx:d/2,cy:d/2,r:y,strokeWidth:t,css:g})})})};var Ya=createContext(null),Ja=()=>{let e=useContext(Ya);if(!e)throw new Error("AlertTitle and AlertDescription must be used inside <Alert>.");return e},ou=css({display:"flex",flexDirection:"column",textAlign:"left",minWidth:0,flex:1}),ru=css({lineHeight:0,display:"flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto"}),su=css({display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",padding:0,cursor:"pointer",lineHeight:0,transition:"opacity 140ms ease","&:disabled":{cursor:"not-allowed",opacity:.5}}),Za=forwardRef(function({intent:t="neutral",variant:n="soft",intentIcon:o,closeIcon:r,onClose:s,width:i="100%",size:c="md",loading:a=false,css:l,children:u,...d},y){let f=V(),T=useId(),I=useId(),x=useMemo(()=>{let F={sm:{paddingX:f.spacing?.md,paddingY:f.spacing?.md,gap:f.spacing?.sm,radius:f.radius?.md,fontSize:f.typography?.sizes?.xs,titleWeight:600,iconSize:16},md:{paddingX:f.spacing?.lg,paddingY:f.spacing?.lg,gap:f.spacing?.md,radius:f.radius?.md,fontSize:f.typography?.sizes?.sm,titleWeight:600,iconSize:20},lg:{paddingX:f.spacing?.lg,paddingY:f.spacing?.lg,gap:f.spacing?.md,radius:f.radius?.md,fontSize:f.typography?.sizes?.md,titleWeight:600,iconSize:24}};return ["sm","md","lg"].includes(c)?F[c]:F.md},[c,f.typography,f.radius,f.spacing]),R=f.palette??{},g=f.neutral??{},p=useMemo(()=>{let M=(E=>E==="danger"?R.danger??R.error??g:E==="warning"?R.warning??g:E==="success"?R.success??g:E==="info"?R.info??R.primary??g:g)(t),b=M?.[50]??g[50],h=M?.[300]??g[300],A=M?.[600]??M?.[500]??g[600],D=M?.[700]??A,L=M?.[800]??f.text?.primary??"#000",k=f.text?.onColors?.[t]??f.text?.onColors?.primary??f.text?.primary??"#fff";return n==="filled"?{bg:A,fg:k,border:void 0,iconColor:k}:n==="outlined"?{bg:b,fg:L,border:`1px solid ${h}`,iconColor:L}:n==="ghost"?{bg:"transparent",fg:D,border:"none",iconColor:D}:{bg:b,fg:L,border:void 0,iconColor:D}},[t,n,g,R,f.text]),m=t==="danger"||t==="warning"?"alert":"status",C=useMemo(()=>a?jsx(no,{variant:"circular",color:p.iconColor,size:x.iconSize/1.25,thickness:4.5}):o??(t==="danger"?jsx(CircleAlert,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):t==="warning"?jsx(TriangleAlert,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):t==="success"?jsx(CircleCheckBig,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):jsx(Info,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor})),[a,o,t,x.iconSize,p.iconColor]),P=useMemo(()=>css({display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:`${x.paddingY} ${x.paddingX}`,gap:x.gap,borderRadius:x.radius,backgroundColor:p.bg,color:p.fg,border:p.border,fontSize:x.fontSize,fontWeight:500,maxWidth:typeof i=="number"?`${i}px`:i,width:"100%"}),[p.bg,p.border,p.fg,x.fontSize,x.gap,x.paddingX,x.paddingY,x.radius,i]),w=useMemo(()=>css({display:"flex",alignItems:"flex-start",gap:x.gap,minWidth:0,flex:1}),[x.gap]),v=useMemo(()=>[ru,{color:p.iconColor}],[p.iconColor]),N=useMemo(()=>css({display:"flex",alignItems:"center",gap:x.gap,marginLeft:x.gap,flex:"0 0 auto"}),[x.gap]),B=useMemo(()=>[su,{color:p.fg}],[p.fg]),K=useMemo(()=>({fg:p.fg,iconColor:p.iconColor,s:x,titleId:T,descId:I}),[p.fg,p.iconColor,x,T,I]),O=me.Children.toArray(u).some(F=>me.isValidElement(F)&&F.type===ss),S=me.Children.toArray(u).some(F=>me.isValidElement(F)&&F.type===as);return jsx(Ya.Provider,{value:K,children:jsxs("div",{ref:y,role:m,"aria-live":m==="alert"?"assertive":"polite","aria-atomic":"true","aria-busy":a,"aria-labelledby":O?T:void 0,"aria-describedby":S?I:void 0,className:`plainframe-ui-alert plainframe-ui-alert-${t} plainframe-ui-alert-${n}`,css:[P,l],...d,children:[jsxs("div",{className:"plainframe-ui-alert-left",css:w,children:[C&&jsx("span",{className:"plainframe-ui-alert-icon",css:v,children:C}),jsx("div",{className:"plainframe-ui-alert-content",css:ou,children:u})]}),s&&jsx("div",{className:"plainframe-ui-alert-actions",css:N,children:jsx("button",{type:"button","aria-label":"Close alert",onClick:s,disabled:a,className:"plainframe-ui-alert-close",css:B,children:r??jsx(X,{strokeWidth:2,size:x.iconSize-2})})})]})})});Za.displayName="Alert";var ss=forwardRef(function({children:t,css:n,...o},r){let{fg:s,s:i,titleId:c}=Ja(),a=useMemo(()=>css({color:s,fontWeight:i.titleWeight,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),[s,i.titleWeight]);return jsx("span",{ref:r,id:c,className:"plainframe-ui-alert-title",css:[a,n],...o,children:t})});ss.displayName="AlertTitle";var as=forwardRef(function({children:t,css:n,...o},r){let{fg:s,descId:i}=Ja(),c=useMemo(()=>css({color:s,marginTop:2,lineHeight:1.35,wordBreak:"break-word"}),[s]);return jsx("span",{ref:r,id:i,className:"plainframe-ui-alert-desc",css:[c,n],...o,children:t})});as.displayName="AlertDescription";var is=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Gt=e=>e==null?[]:Array.isArray(e)?e:[e],Xt=(...e)=>css(e.filter(Boolean));function ei(e,t,n="currentColor"){if(!isValidElement(e))return e;let o=e.props,r={};o.size==null&&(r.size=t),o.color==null&&(r.color=n);let s=o.style;return s?.fontSize==null&&(r.style={...s||{},fontSize:t}),cloneElement(e,{...o,...r})}var Qo=me.memo(forwardRef(function({label:t,value:n,defaultValue:o="",onChange:r,placeholder:s,error:i,helperText:c,disabled:a=false,fullWidth:l=false,width:u=250,size:d="md",variant:y="subtle",rounded:f=false,startIcon:T,endIcon:I,togglePasswordVisible:x=false,showClear:R,type:g="text",step:p,focusRingMode:m="always",className:C,wrapperCss:P,inputCss:w,labelCss:v,helperRowCss:N,helperTextCss:B,startIconCss:K,endIconCss:O,css:S,onBlur:F,onFocus:M,onKeyDown:b,autoFocus:h,name:A,id:D,tabIndex:L,autoComplete:k,readOnly:E,required:W,maxLength:$,onSurfaceClick:z},_){let H=V(),U=Yo(),X$1=useId(),ae=useMemo(()=>{let ce={sm:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.sm,labelFont:H.typography.sizes.xs,helperFont:H.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:21},md:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.md,labelFont:H.typography.sizes.sm,helperFont:H.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:24},lg:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.lg,labelFont:H.typography.sizes.md,helperFont:H.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:28}},ke=["sm","md","lg"].includes(d)?d:"md";return ce[ke]},[d,H]),q=H.neutral,Y=H.text,le=g==="number",ie=g==="password",be=n!==void 0,[Pe,Re]=useState(o),Ce=be?n:Pe,Ie=useCallback(ce=>{be||Re(ce),r?.(ce);},[be,r]),Te=/^-?\d*(?:[.,]\d*)?$/,we=le&&(p!=null&&String(p).includes(".")||/[.,]/.test(Ce??"")),he=le?we?"decimal":"numeric":void 0,je=le?we?"[0-9]*[.,]?[0-9]*":"[0-9]*":void 0,Z=useCallback(ce=>{(ce===""||Te.test(ce))&&Ie(ce);},[Ie]),Ee=a?q[200]:i&&y==="outlined"?H.palette.danger?.[50]??H.surface.panelBg:i&&y==="subtle"?H.palette.danger?.[50]??H.surface.subtleBg:y==="outlined"?H.surface.panelBg:y==="subtle"?H.surface.subtleBg:"transparent",Q=H.componentHeights.border,ee=y==="outlined"?`${Q} solid ${i?H.palette.danger?.[300]??H.surface.border:H.surface.border}`:"none",se=Xt({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:l?"100%":u!=null?is(u):void 0,flex:"0 0 auto",fontWeight:500}),pe=useMemo(()=>Xt({fontSize:ae.labelFont,fontWeight:500,color:i?H.palette.danger?.[700]??Y.primary:a?q[500]:Y.primary,marginBottom:4,display:"inline-block"},...Gt(v)),[ae.labelFont,i,a,q,Y,H.palette.danger,v]),Se=useMemo(()=>Xt({display:"flex",alignItems:"center",gap:H.spacing.sm,padding:`${is(ae.paddingY)} ${is(ae.paddingX)}`,background:Ee,border:ee,borderRadius:f?H.radius.full:H.radius.md,minHeight:ae.minHeight,boxSizing:"border-box",width:"100%",cursor:a?"not-allowed":"text",opacity:a?.65:1,transition:"box-shadow .18s, border-color .16s"},...Gt(P),...Gt(S)),[H,ae.minHeight,ae.paddingX,ae.paddingY,Ee,ee,f,a,P,S]),Ne=useMemo(()=>Xt({flex:1,minWidth:0,fontSize:ae.fontSize,fontWeight:500,fontFamily:"inherit",color:a?q[500]:i?H.palette.danger?.[800]??Y.primary:Y.primary,background:"transparent",border:"none",outline:"none",padding:0,lineHeight:1.25,cursor:a?"not-allowed":"text",appearance:le?"textfield":"auto","&::placeholder":{color:i?H.palette.danger?.[700]??Y.secondary:Y.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${i?H.palette.danger?.[800]??Y.primary:Y.primary} !important`,boxShadow:`0 0 0 1000px ${Ee} inset !important`,transition:"opacity 99999s ease-out",caretColor:i?H.palette.danger?.[800]??Y.primary:Y.primary},":focus-within":{outline:"none",border:"none",boxShadow:"none"}},...Gt(w)),[ae.fontSize,a,q,Y,i,H.palette.danger,le,Ee,w]),J=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:i?H.palette.danger?.[800]??Y.secondary:Y.secondary,marginLeft:-3},...Gt(K)),[i,H.palette.danger,Y.secondary,K]),oe=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:i?H.palette.danger?.[800]??Y.secondary:Y.secondary,border:"none",background:"transparent",lineHeight:0,cursor:"inherit",padding:0},...Gt(O)),[i,H.palette.danger,Y.secondary,a,O]),re=useMemo(()=>Xt({minHeight:16,fontSize:ae.helperFont,color:i?H.palette.danger?.[700]??Y.secondary:Y.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Gt(N)),[ae.helperFont,i,H.palette.danger,Y.secondary,N]),qe=useMemo(()=>Xt({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400},...Gt(B)),[B]),j=useRef(null),ue=useCallback(ce=>{j.current=ce,_&&(typeof _=="function"?_(ce):_.current=ce);},[_]),de=useCallback(ce=>{let ke=ce.target.value;if(le){Z(ke);return}$&&ke.length>$||Ie(ke);},[le,$,Ie,Z]),[fe,ze]=useState(false),Oe=useCallback(()=>{a||ze(ce=>!ce);},[a]),st=useCallback(()=>{a||(Ie(""),j.current?.focus());},[a,Ie]),Ye=useMemo(()=>{let ce=ae.fontSize;if(typeof ce=="number")return ce;let ke=parseFloat(String(ce));return Number.isFinite(ke)?ke:16},[ae.fontSize]),yt=useMemo(()=>T?jsx("span",{css:J,children:ei(T,Ye)}):null,[T,J,Ye]),tn=useMemo(()=>css({display:"flex",alignItems:"center",gap:4}),[]),nn=useMemo(()=>{let ce=[];if(ie&&x){let bt=fe?jsx(Eye,{strokeWidth:2.5,size:Ye}):jsx(EyeOff,{strokeWidth:2.5,size:Ye});ce.push(jsx("button",{type:"button",css:oe,onMouseDown:Zn=>Zn.preventDefault(),onClick:Zn=>{Zn.stopPropagation(),Oe();},tabIndex:-1,"aria-label":fe?"Hide password":"Show password",disabled:a,children:bt},"pw-toggle"));}R&&Ce&&Ce.length>0&&!a&&ce.push(jsx("button",{type:"button",css:oe,onMouseDown:bt=>bt.preventDefault(),onClick:bt=>{bt.stopPropagation(),st();},tabIndex:-1,"aria-label":"Clear",children:jsx(X,{strokeWidth:2.5,size:Ye})},"clear"));let ke=I?jsx("span",{css:oe,children:ei(I,Ye)},"user-end"):null,at=ce.length>0,De=!!ke;return !at&&!De?null:!at&&De?ke:at&&!De?ce.length===1?ce[0]:jsx("span",{css:tn,children:ce}):jsxs("span",{css:tn,children:[ce,ke]})},[ie,x,fe,Ye,oe,tn,a,R,Ce,I,Oe,st]),Sn=c!=null?`${D??X$1}-help`:void 0,on=D??X$1,Je=useCallback(ce=>{if(a)return;ce.stopPropagation();let ke=j.current;if(!ke)return;let at=ce.target;if(!(ke.contains(at)||at.closest("button,[role='button']"))){if(document.activeElement===ke){ce.preventDefault();return}ce.preventDefault();}},[a]),xt=useCallback(ce=>{if(a)return;let ke=j.current;if(ke&&(z?.(ce),document.activeElement!==ke)){ke.focus({preventScroll:true});try{let at=ke.value?.length??0;ke.setSelectionRange?.(at,at);}catch{}}},[a,z]);return jsxs("div",{className:["plainframe-ui-textfield",C||""].join(" ").trim(),css:se,children:[t&&jsx("label",{htmlFor:on,className:"plainframe-ui-textfield-label",css:pe,children:t}),jsxs("div",{className:"plainframe-ui-textfield-surface",css:[U({enabled:m!=="none",color:i?"danger":void 0}),Se],onPointerDownCapture:Je,onClick:xt,"aria-invalid":!!i||void 0,children:[yt,jsx("input",{ref:ue,id:on,className:"plainframe-ui-textfield-input",css:Ne,type:ie?fe?"text":"password":g==="number"?"text":g,inputMode:he,pattern:je,value:Ce,maxLength:le?void 0:$,onChange:le?ce=>Z(ce.target.value):de,placeholder:s||"",disabled:a,onBlur:F,onFocus:M,onKeyDown:b,autoFocus:h,name:A,tabIndex:L,autoComplete:k,readOnly:E,required:W,"aria-invalid":!!i||void 0,"aria-describedby":Sn}),nn]}),c!=null&&jsx("div",{className:"plainframe-ui-textfield-helper-row",css:re,children:jsx("span",{id:Sn,className:"plainframe-ui-textfield-helper-text",css:qe,children:c})})]})}));Qo.displayName="TextField";var er=me.createContext("ghost"),Tt=me.createContext(false),si=forwardRef(function({variant:t="ghost",size:n="md",width:o,maxHeight:r,unstyled:s=false,className:i,css:c,children:a,label:l,allItemsTabbable:u=false,...d},y){let f=V(),[T,I]=useState(false),x=useRef(null),R=typeof f.spacing.xs=="number"?`${f.spacing.xs}px`:String(f.spacing.xs),g=t==="outlined"?f.surface.panelBg:t==="subtle"?f.surface.subtleBg??f.neutral[50]:"transparent",p=s?void 0:css({background:g,border:t==="outlined"?`${f.componentHeights.border} solid ${f.surface.border}`:"none",borderRadius:f.radius.lg,"--pfui-panel-pad":R,padding:t==="ghost"?0:"var(--pfui-panel-pad)",color:f.text.primary,width:"100%",maxHeight:r,overflowY:r!=null?"auto":void 0,display:"flex",flexDirection:"column",outline:"none",position:"relative","&[data-keyboard-nav]":{cursor:"none"},"&[data-keyboard-nav] *":{cursor:"none !important",pointerEvents:"none"}}),m=n==="sm",C=useMemo(()=>({isKeyboardNav:T,setIsKeyboardNav:I}),[T]),P=useMemo(()=>({allItemsTabbable:u}),[u]),w=useCallback(M=>Array.from(M.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(b=>{if(b.closest('[role="menu"]')!==M)return false;let h=window.getComputedStyle(b);return h.display!=="none"&&h.visibility!=="hidden"}),[]),v=useCallback(M=>{M.removeAttribute("data-keyboard-nav"),M.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),I(false);},[]),N=useRef(false),B=useCallback(M=>{if(M.target!==M.currentTarget)return;if(N.current){N.current=false;return}let b=M.currentTarget,h=w(b);h.length>0&&(I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(A=>A.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(A=>A.removeAttribute("data-hovered")),h[0].setAttribute("data-highlighted",""),h[0].focus({preventScroll:true}));},[w]),K=useCallback(M=>{let b=M.currentTarget,h=w(b);if(h.length===0)return;if(M.key==="Tab"){N.current=true,b.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),I(false),b.tabIndex=-1,requestAnimationFrame(()=>{b.tabIndex=0,N.current=false;});return}let A=b.querySelector("[data-highlighted]"),D=b.querySelector("[data-hovered]"),L=A||D,k=L?h.indexOf(L):-1;if(M.key==="ArrowDown"||M.key==="ArrowUp"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach($=>$.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach($=>$.removeAttribute("data-hovered")),k===-1&&(k=M.key==="ArrowDown"?-1:h.length);let E=M.key==="ArrowDown"?1:-1,W=(k+E+h.length)%h.length;h[W].setAttribute("data-highlighted",""),h[W].focus({preventScroll:true});return}if(M.key==="Home"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),h[0].setAttribute("data-highlighted",""),h[0].focus({preventScroll:true});return}if(M.key==="End"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),h[h.length-1].setAttribute("data-highlighted",""),h[h.length-1].focus({preventScroll:true});return}if(M.key==="Escape"){M.preventDefault(),b.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),I(false),b.blur();return}},[w]),O=useCallback(M=>{let b=M.currentTarget;b.hasAttribute("data-keyboard-nav")&&v(b);},[v]),S=useCallback(M=>{let b=M.currentTarget;b.hasAttribute("data-keyboard-nav")&&v(b);},[v]),F=useCallback(M=>{x.current=M,typeof y=="function"?y(M):y&&(y.current=M);},[y]);return jsx(oo.Provider,{value:C,children:jsx(ro.Provider,{value:P,children:jsx(Tt.Provider,{value:m,children:jsx(er.Provider,{value:t,children:jsxs("div",{css:{display:"flex",flexDirection:"column",gap:f.spacing.sm,width:"100%",maxWidth:o},children:[l?jsx("div",{css:{width:"100%",textAlign:"left"},children:jsx("span",{css:{display:"block",color:f.text.secondary,fontSize:f.typography.sizes.xs,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",padding:typeof f.spacing.sm=="number"?`${f.spacing.sm}px`:f.spacing.sm,paddingTop:0},children:l})}):null,jsx("div",{ref:F,role:"menu","data-keyboard-nav":T?"":void 0,tabIndex:0,"aria-label":l||void 0,className:["plainframe-ui-menu",i||""].join(" ").trim(),css:[p,c],onFocus:B,onKeyDown:K,onPointerMove:O,onPointerDown:S,...d,children:a})]})})})})})});si.displayName="Menu";var ii=createContext(null),or=()=>{let e=useContext(ii);if(!e)throw new Error("Popover components must be used inside <Popover>.");return e};function Du(e,t){e&&(typeof e=="function"?e(t):e.current=t);}var io=(...e)=>t=>{for(let n of e)Du(n,t);},cs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Hu=e=>{useEffect(()=>{if(!e||typeof document>"u"||typeof window>"u")return;let t=document.body,n=t.style.overflow,o=t.style.paddingRight,r=window.innerWidth-document.documentElement.clientWidth,s=parseFloat(getComputedStyle(t).paddingRight||"0");return t.style.overflow="hidden",r>0&&(t.style.paddingRight=`${s+r}px`),()=>{t.style.overflow=n,t.style.paddingRight=o;}},[e]);},tr=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"&&t&&e in t){let n=t[e];return typeof n=="number"?`${n}px`:String(n)}return e}},Lu=({open:e,defaultOpen:t,onOpenChange:n,triggerOn:o="click",lockScroll:r=true,trapFocus:s=true,children:i})=>{let[c,a]=useState(!!t),l=e??c,u=x=>{e===void 0&&a(x),n?.(x);},d=useRef(null),y=useRef(null),f=(x=120)=>{y.current!=null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>u(false),x);},T=()=>{y.current!=null&&(window.clearTimeout(y.current),y.current=null);};Hu(r&&l),useEffect(()=>{if(!s||!l||typeof document>"u")return;let x=R=>{if(R.key!=="Tab")return;let g=document.querySelector(".plainframe-ui-popover");if(!g)return;let p=Array.from(g.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(w=>{let v=window.getComputedStyle(w);return v.display!=="none"&&v.visibility!=="hidden"});if(p.length===0)return;let m=p[0],C=p[p.length-1],P=document.activeElement;R.shiftKey&&P===m?(R.preventDefault(),C.focus()):!R.shiftKey&&P===C&&(R.preventDefault(),m.focus());};return document.addEventListener("keydown",x,true),()=>document.removeEventListener("keydown",x,true)},[s,l]);let I=useMemo(()=>({open:l,setOpen:u,triggerOn:o,referenceRef:d,scheduleClose:f,cancelClose:T}),[l,o]);return jsx(ii.Provider,{value:I,children:i})},li=forwardRef(({asChild:e=true,children:t,css:n},o)=>{let{open:r,setOpen:s,triggerOn:i,referenceRef:c,scheduleClose:a,cancelClose:l}=or(),u=me.Children.only(t),d=u.props||{},y=io(c,o,u.ref),f=i==="click"?{onClick:I=>{I.stopPropagation(),s(!r),d.onClick?.(I);}}:{onMouseEnter:I=>{l(),r||s(true),d.onMouseEnter?.(I);},onMouseLeave:I=>{a(),d.onMouseLeave?.(I);}},T={"aria-haspopup":"dialog","aria-expanded":r};if(e){let I=u.props?.css;return me.cloneElement(u,{...f,...T,ref:y,css:[I,n].filter(Boolean)})}return me.createElement("button",{ref:y,type:"button",css:[n],...f,...T,children:u})});li.displayName="PopoverTrigger";var ci=forwardRef(({asChild:e=true,width:t,css:n,children:o},r)=>{let{referenceRef:s}=or(),i=me.Children.only(o),c=io(s,r,i.ref);if(e){let l=i.props?.css;return me.cloneElement(i,{ref:c,css:[l,n].filter(Boolean)})}let a=css({display:"inline-block",width:cs(t),verticalAlign:"middle",...n});return jsx("span",{ref:c,css:a,children:i})});ci.displayName="PopoverAnchor";function Bu(e){let t=e?.vertical??"bottom",n=e?.horizontal??"center";if(t==="top"||t==="bottom"){let s=t,i=n==="left"?"start":n==="right"?"end":"center";return i==="center"?s:`${s}-${i}`}let o=n==="left"?"left":"right",r="center";return r==="center"?o:`${o}-${r}`}var ui=forwardRef(({anchorOrigin:e={vertical:"bottom",horizontal:"center"},sideOffset:t=8,alignOffset:n=0,collisionPadding:o=8,unstyled:r=false,children:s,width:i,height:c,padding:a,paddingX:l,paddingY:u,radius:d="lg",css:y,...f},T)=>{let{open:I,setOpen:x,triggerOn:R,referenceRef:g,scheduleClose:p,cancelClose:m}=or(),C=V(),P=Bu(e),{refs:w,x:v,y:N,strategy:B,context:K}=useFloating({open:I,onOpenChange:x,whileElementsMounted:autoUpdate,placement:P,strategy:"fixed",middleware:[offset({mainAxis:t,crossAxis:n}),flip({padding:o}),shift({padding:o})]});useEffect(()=>{g.current&&w.setReference(g.current);},[w,g]);let O=useDismiss(K,{outsidePressEvent:"pointerdown",escapeKey:true}),S=useRole(K,{role:"dialog"}),{getFloatingProps:F}=useInteractions([O,S]),[M]=K.placement.split("-"),b=M,h=`${b==="left"?"right":b==="right"?"left":"center"} ${b==="top"?"bottom":b==="bottom"?"top":"center"}`,A=8,D=b==="top"?{y:A}:b==="bottom"?{y:-A}:b==="left"?{x:A}:{x:-A},L={initial:{opacity:0,scale:.96,...D},animate:{opacity:1,scale:1,x:0,y:0},exit:{opacity:0,scale:.96,...D},transition:{scale:{type:"spring",stiffness:520,damping:32,mass:.5},x:{type:"spring",stiffness:420,damping:30,mass:.6},y:{type:"spring",stiffness:420,damping:30,mass:.6},opacity:{duration:.16,ease:"linear"}}},k=C.surface.panelBg,E=C.text.primary,W=`${C.componentHeights.border} solid ${C.surface.border}`,$=tr(a,C.spacing),z=tr(l,C.spacing),_=tr(u,C.spacing),H={};$&&(H.padding=$),z&&(H.paddingInline=z),_&&(H.paddingBlock=_);let U=tr(d,C.radius)??C.radius.md,X="0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)",ae=css({position:B,top:N??0,left:v??0,zIndex:1e3,transformOrigin:h,pointerEvents:"auto",display:"inline-flex",flexDirection:"column",width:cs(i)??"fit-content",height:cs(c)??"fit-content",boxSizing:"border-box",willChange:"opacity, transform"}),q=r?css({}):css({background:k,color:E,border:W,borderRadius:U,boxShadow:X,...H,...H.padding||H.paddingInline||H.paddingBlock?{}:{padding:typeof C.spacing?.sm=="number"?`${C.spacing.sm}px ${C.spacing.md}px`:`${C.spacing?.sm??"0.5rem"} ${C.spacing?.md??"1rem"}`}}),Y=R==="hover"?{onMouseEnter:m,onMouseLeave:()=>p()}:{},le=io(w.setFloating,T),ie=jsx(motion.div,{className:"plainframe-ui-popover",...F({...f,ref:le,...Y}),...L,css:[ae,q,y],children:s});return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:I?ie:null})})});ui.displayName="PopoverContent";var $u=()=>{let e=or();return {open:e.open,close:()=>e.setOpen(false),setOpen:e.setOpen}};var ms=me.memo(forwardRef(function({checked:t,defaultChecked:n=false,onChange:o,disabled:r=false,size:s="md",label:i,className:c,css:a,trackCss:l,thumbCss:u,labelCss:d,...y},f){let T=V(),I=xe(),x={sm:{trackW:25,trackH:16,thumb:11,labelGap:8},md:{trackW:35,trackH:20,thumb:14,labelGap:8},lg:{trackW:45,trackH:24,thumb:18,labelGap:10}},R={slideMs:250,pressMs:150,easing:"ease"},g=t!==void 0,[p,m]=useState(n),C=g?!!t:p,[P,w]=useState(false);useEffect(()=>{if(r)return;w(true);let z=setTimeout(()=>w(false),R.pressMs);return ()=>clearTimeout(z)},[C,r]);let v=["sm","md","lg"].includes(s)?s:"md",N=x[v],B=`${R.slideMs}ms ${R.easing}`,K=T.palette?.primary?.[600]??T.neutral[900],O=T.neutral[300],S=C?K:O,F=C?T.text.onColors.primary:"#ffffff",{trackW:M,trackH:b,thumb:h}=N,A=(b-h)/2,D=css({display:"inline-flex",alignItems:"center",gap:N.labelGap,cursor:r?"not-allowed":"pointer",width:"fit-content",padding:T.spacing.xs,borderRadius:T.radius.sm,outline:"none"}),L=css({position:"relative",width:M,height:b,backgroundColor:S,borderRadius:T.radius.xl,transition:`background-color ${B}, opacity 120ms ease`,willChange:"background-color",cursor:r?"not-allowed":"pointer",opacity:r?.5:1}),k=css({position:"absolute",top:A,left:C?M-h-A:A,width:h,height:h,backgroundColor:F,borderRadius:T.radius.xl,transition:`left ${B}, transform ${B}, background-color 0.25s ease`,transform:P?"scaleX(1.2)":"scaleX(1)",transformOrigin:C?"right center":"left center"}),E=css({fontSize:T.typography.sizes.sm,fontWeight:500,color:r?T.text.muted:T.text.primary}),W=()=>{if(r)return;let z=!C;g||m(z),o?.(z);};return jsxs("label",{ref:f,role:"switch","aria-checked":C,"aria-disabled":r||void 0,"data-checked":C?"":void 0,"data-disabled":r?"":void 0,tabIndex:r?-1:0,onClick:W,onKeyDown:z=>{r||(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),W());},className:["plainframe-ui-switch",c||""].join(" ").trim(),css:[D,I({color:C?"primary":"neutral"}),a],...y,children:[jsx("div",{className:"plainframe-ui-switch-track",css:[L,l],children:jsx("div",{className:"plainframe-ui-switch-thumb",css:[k,u]})}),i!=null&&jsx("span",{className:"plainframe-ui-switch-label",css:[E,d],children:i})]})}));var Uu=(e,t)=>t==="sm"?{box:16,labelFont:e.typography.sizes.xs,gap:8,borderRadius:e.radius.xxs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75}:t==="lg"?{box:24,labelFont:e.typography.sizes.md,gap:8,borderRadius:e.radius.xs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75}:{box:20,labelFont:e.typography.sizes.sm,gap:8,borderRadius:e.radius.xs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75},sr=me.memo(forwardRef(({checked:e,defaultChecked:t=false,onChange:n,disabled:o=false,size:r="md",label:s,description:i,rounded:c=false,checkedIcon:a,color:l="primary",css:u,boxCss:d,checkCss:y,labelCss:f,descriptionCss:T,className:I,...x},R)=>{let g=V(),p=xe(),m=typeof e=="boolean",[C,P]=useState(t),w=m?e:C,v=r==="sm"||r==="lg"?r:"md",N=useMemo(()=>Uu(g,v),[g,v]),{checkedBg:B,checkColor:K,borderCol:O,hoverBg:S,gapPx:F}=useMemo(()=>{let z=g.palette||{},_=g.neutral||{},H=g.text?.onColors||{},U,X;l==="neutral"||l==="secondary"?(U=_,X="neutral"):typeof l=="string"&&Object.prototype.hasOwnProperty.call(z,l)?(U=z[l]||z.primary||_,X=l):(U=z.primary||_,X="primary");let ae=U[600]??U[500]??U[400]??Object.values(U)[0]??g.palette.primary[600],q=H[X]??H.primary??g.text?.onColors?.primary??g.text.primary,Y=typeof N.gap=="number"?N.gap+2:N.gap;return {checkedBg:ae,checkColor:q,borderCol:g.surface.border,hoverBg:g.surface.panelHover,gapPx:Y}},[N.gap,l,g]),M=useMemo(()=>css({display:"inline-flex",alignItems:s&&i?"flex-start":"center",gap:F,cursor:o?"not-allowed":"pointer",userSelect:"auto",position:"relative",width:"fit-content",borderRadius:g.radius.sm,padding:g.spacing.xs,transition:"background-color .16s ease, color .16s ease, opacity .16s ease",'&:not([data-disabled="true"]):hover input:not(:checked) + .plainframe-ui-checkbox-box':{outlineColor:O,backgroundColor:S},"input:checked + .plainframe-ui-checkbox-box":{backgroundColor:B,outlineColor:B,"--pfui-bleed":B},'&:not([data-disabled="true"]):hover input:checked + .plainframe-ui-checkbox-box':{outlineColor:B,backgroundColor:B,"--pfui-bleed":B},".plainframe-ui-checkbox-check":{opacity:0,transform:"scale(0.2)"},"input:checked + .plainframe-ui-checkbox-box .plainframe-ui-checkbox-check":{opacity:1,transform:"scale(1)"}}),[O,B,i,o,F,S,s,g.radius.sm,g.spacing.xs]),b=useMemo(()=>css({position:"absolute",opacity:0,width:0,height:0,margin:0,padding:0,pointerEvents:"none"}),[]),h=useMemo(()=>css({width:N.box,height:N.box,display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",outline:`${N.borderWidth} solid ${O}`,outlineOffset:`-${N.borderWidth}`,boxShadow:"inset 0 0 0 0.5px var(--pfui-bleed, transparent)",borderRadius:c?g.radius.full:N.borderRadius,transition:"background-color .16s ease, outline-color .05s ease, box-shadow .16s ease, transform .16s ease",flex:"0 0 auto",verticalAlign:"middle",overflow:"hidden",transform:"translateZ(0)",backfaceVisibility:"hidden"}),[N.box,N.borderRadius,N.borderWidth,O,c,g.radius.full]),A=useMemo(()=>({w:Math.round(N.box*N.iconRatioW),h:Math.round(N.box*N.iconRatioH)}),[N.box,N.iconRatioH,N.iconRatioW]),D=useMemo(()=>css({width:A.w,height:A.h,transition:"opacity .14s ease, transform .14s ease",color:K,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,pointerEvents:"none","& > svg, & > img":{width:"100%",height:"100%",display:"block"}}),[K,A.h,A.w]),L=useMemo(()=>css({display:"flex",flexDirection:"column",minWidth:0,userSelect:"text",WebkitUserSelect:"text"}),[]),k=useMemo(()=>css({fontSize:N.labelFont,lineHeight:1.1,fontWeight:500,userSelect:"text",WebkitUserSelect:"text",color:g.text.primary}),[N.labelFont,g.text.primary]),E=useMemo(()=>css({fontSize:N.labelFont,lineHeight:1.25,color:g.text.secondary,fontWeight:400,marginTop:s&&i?g.spacing.xs:0,userSelect:"text",WebkitUserSelect:"text"}),[N.labelFont,i,s,g.spacing.xs,g.text.secondary]),W=useCallback(()=>{o||(m?n?.(!w):P(z=>{let _=!z;return n?.(_),_}));},[o,m,w,n]),$=useCallback(z=>{o||(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),W());},[o,W]);return jsxs("label",{ref:R,role:"checkbox","aria-checked":w,"aria-disabled":o||void 0,"data-state":w?"checked":"unchecked",className:["plainframe-ui-checkbox",I||""].join(" ").trim(),css:[M,p({color:w?"primary":"neutral"}),u,o?css({opacity:.6}):null],"data-disabled":o?"true":"false",tabIndex:o?-1:0,onKeyDown:$,children:[jsx("input",{type:"checkbox",checked:w,onChange:W,disabled:o,css:b,...x,tabIndex:-1}),jsx("span",{className:"plainframe-ui-checkbox-box",css:[h,d],"aria-hidden":"true",children:jsx("span",{className:"plainframe-ui-checkbox-check",css:[D,y],children:w&&(a||jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:K,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",css:css({width:"100%",height:"100%",display:"block"}),"aria-hidden":"true",focusable:"false",children:jsx("polyline",{points:"20 6 9 17 4 12"})}))})}),(s||i)&&jsxs("span",{className:"plainframe-ui-checkbox-text",css:L,children:[s&&jsx("span",{className:"plainframe-ui-checkbox-label",css:[k,f],children:s}),i&&jsx("span",{className:"plainframe-ui-checkbox-description",css:[E,T],children:i})]})]})}));sr.displayName="Checkbox";var Xu=()=>useContext(fn),Yu=()=>useContext(ro),Ju=()=>useContext(ur),dn=null,gi=(e,t=35)=>{dn!==null&&window.clearTimeout(dn),dn=window.setTimeout(()=>{e(),dn=null;},t);},lo=()=>{dn!==null&&(window.clearTimeout(dn),dn=null);},pn=me.forwardRef(function({disabled:t=false,destructive:n=false,inset:o,closeOnSelect:r=true,onSelect:s,children:i,className:c,css:a,startIcon:l,endIcon:u,selected:d=false,active:y,meta:f,__index:T,__skipListReg:I,...x},R){let g=Xu(),p=Ju(),m=cr(),C=uo(),P=Yu(),w=V(),N=!!useContext(Tt),B=x["data-subtrigger"]!==void 0,K=B&&u===void 0?jsx(ChevronRight,{size:18,strokeWidth:2.5}):u,S=typeof o=="number"?o:o===false?0:0,F=useContext(er),M=F==="subtle"?w.surface?.subtleHover??w.neutral[100]:w.surface?.subtleBg??w.neutral[100],b=useMemo(()=>css({width:"100%",borderRadius:w.radius.md,padding:`${w.spacing.sm} ${w.spacing.sm}`,paddingLeft:S>0?`calc(${w.spacing.md} + (${w.spacing.xl} * ${S}))`:w.spacing.md,minHeight:N?w.componentHeights.sm:w.componentHeights.md,display:"flex",alignItems:"center",gap:w.spacing.sm,fontWeight:500,fontSize:w.typography.sizes.sm,cursor:t?"not-allowed":"pointer",opacity:t?.55:1,userSelect:"none",background:"transparent",color:n?w.palette.danger[800]:w.text.primary,transition:"background-color .16s ease, color .16s ease",outline:"none","[role='menu']:not([data-keyboard-nav]) &:hover":t?{}:{background:n?w.palette.danger[50]:M},"&[data-highlighted]":t?{}:{background:n?w.palette.danger[50]:M},"&[data-active]":t?{}:{background:n?w.palette.danger[50]:M},"&[data-subtrigger][aria-expanded='true']":t?{}:{background:n?w.palette.danger[50]:M},"[role='menu']:not([data-keyboard-nav]) &:not([data-disabled]):hover [data-menu-checkbox-wrapper],&:not([data-disabled])[data-highlighted] [data-menu-checkbox-wrapper],&:not([data-disabled])[data-active] [data-menu-checkbox-wrapper],&[data-subtrigger][aria-expanded='true'] [data-menu-checkbox-wrapper]":{background:w.surface.border},"& > [data-label]":{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),[w,N,S,t,n,M]),h=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,"& > *":{flexShrink:0},"& > svg:only-child":{width:16,height:16,display:"block"}}),[]),A=useMemo(()=>css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,whiteSpace:"nowrap",lineHeight:0,gap:w.spacing.sm,"& > svg":{width:16,height:16,display:"block"},color:w.text.secondary}),[w.text.secondary,w.spacing.sm]),D=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:w.palette.primary[600],"& > svg":{width:16,height:16,display:"block"}}),[w.palette.primary]),L=[];N&&L.push({minHeight:w.componentHeights.sm,paddingLeft:w.spacing.sm,paddingRight:w.spacing.xs,paddingTop:w.spacing.xs,paddingBottom:w.spacing.xs});let k=()=>{s?.(),r&&!B&&p?.closeAll();},E=($,z)=>{let _=$.closest('[role="menu"]');if(!_)return;let H=Array.from(_.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(Y=>{if(Y.closest('[role="menu"]')!==_)return false;let le=window.getComputedStyle(Y);return le.display!=="none"&&le.visibility!=="hidden"});if(!H.length)return;let U=H.indexOf($),X=U>=0?U:0,ae=z(H.length,X),q=H[ae];q&&(document.querySelectorAll("[data-highlighted]").forEach(Y=>{Y.removeAttribute("data-highlighted");}),q.setAttribute("data-highlighted",""),q.focus(),g&&T!=null&&g.setActiveIndex(ae));},W=t?-1:P?.allItemsTabbable?0:-1;return jsxs("div",{role:"menuitem","aria-disabled":t||void 0,"data-disabled":t?"":void 0,"data-active":y?"":void 0,tabIndex:W,ref:$=>{if(g&&!I){let z=g.listRef.current;$&&(T!=null?z[T]=$:z.includes($)||z.push($));}typeof R=="function"?R($):R&&"current"in R&&(R.current=$);},onMouseMove:$=>{if($.currentTarget.hasAttribute("data-hovered"))return;let z=!!$.currentTarget.closest("[data-submenu-content]");!B&&m&&!z&&gi(m.closeAllSubMenus),document.querySelectorAll("[data-hovered]").forEach(H=>{H.removeAttribute("data-hovered");}),document.querySelectorAll("[data-highlighted]").forEach(H=>{H.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-active]").forEach(H=>{H.removeAttribute("data-active");}),$.currentTarget.setAttribute("data-hovered","");let _=$.currentTarget.closest("[data-menu-id]")||$.currentTarget.closest('[role="menu"]');_?.hasAttribute("data-keyboard-nav")&&_.removeAttribute("data-keyboard-nav"),!t&&g&&T!=null&&g.setActiveIndex(T),!t&&!P?.allItemsTabbable&&$.currentTarget.focus({preventScroll:true});},onMouseEnter:$=>{if(B)lo();else {let H=!!$.currentTarget.closest("[data-submenu-content]");m&&!H&&gi(m.closeAllSubMenus);}$.currentTarget.hasAttribute("data-hovered")||(document.querySelectorAll("[data-highlighted]").forEach(H=>{H.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-hovered]").forEach(H=>{H.removeAttribute("data-hovered");}),document.querySelectorAll("[data-active]").forEach(H=>{H.removeAttribute("data-active");})),$.currentTarget.setAttribute("data-hovered","");let _=$.currentTarget.closest("[data-menu-id]")||$.currentTarget.closest('[role="menu"]');!t&&g&&T!=null&&(_?.hasAttribute("data-keyboard-nav")&&(_.removeAttribute("data-keyboard-nav"),C&&C.setIsKeyboardNav(false)),g.setActiveIndex(T)),!t&&!P?.allItemsTabbable&&$.currentTarget.focus({preventScroll:true});},onFocus:()=>{},onMouseLeave:()=>{g&&g.setActiveIndex(null);},onKeyDown:$=>{if(t)return;let z=$.currentTarget;if($.key==="Tab"&&g&&!P?.allItemsTabbable){$.preventDefault();return}if($.key==="Tab"&&!g){let _=z.closest('[role="menu"]');if(_){_.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(U=>U.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(U=>U.removeAttribute("data-hovered"));let H=_.tabIndex;_.tabIndex=-1,requestAnimationFrame(()=>{_.tabIndex=H>=0?H:0;});}C&&C.setIsKeyboardNav(false);return}if($.key==="Enter"||$.key===" "||$.key==="ArrowRight"){B||$.key!=="ArrowRight"&&($.preventDefault(),$.stopPropagation(),k());return}if($.key==="ArrowLeft"&&z.closest('[role="menu"]')?.closest("[data-submenu-content]")){$.preventDefault(),$.stopPropagation();let U=document.querySelector('[data-subtrigger][aria-expanded="true"]');if(U){let X=U.__pfuiCloseSubmenu;X&&X(),document.querySelectorAll("[data-highlighted]").forEach(q=>q.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(q=>q.removeAttribute("data-hovered")),U.setAttribute("data-highlighted",""),U.focus();let ae=U.closest("[data-menu-id]");ae&&ae.setAttribute("data-keyboard-nav","");}return}if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),p?.closeAll(),z.closest('[role="menu"]')&&document.querySelector('[aria-expanded="true"][aria-haspopup="menu"]')?.focus();return}if($.key==="ArrowDown"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),C&&C.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,(H,U)=>(U+1)%H);return}if($.key==="ArrowUp"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),C&&C.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,(H,U)=>(U-1+H)%H);return}if($.key==="Home"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,()=>0);return}if($.key==="End"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,H=>H-1);return}},className:["plainframe-ui-menu-item",c||""].join(" ").trim(),css:css(...[b,...L,a].flat()),...x,onClick:$=>{t||($.currentTarget.removeAttribute("data-highlighted"),k());},children:[l&&jsx("span",{className:"plainframe-ui-menu-item-start",css:h,children:l}),i,(f!=null||K||d)&&jsxs("span",{className:"plainframe-ui-menu-item-end",css:A,children:[f!=null?jsx("span",{className:"plainframe-ui-menu-item-meta",css:css({lineHeight:1,fontSize:w.typography.sizes.sm,color:w.text.secondary,whiteSpace:"nowrap"}),children:f}):null,K,d&&jsx("span",{className:"plainframe-ui-menu-item-selected",css:D,children:jsx(Check,{size:16,strokeWidth:2.5})})]})]})}),hi=me.createContext(null),gs=({values:e,defaultValues:t,onValuesChange:n,children:o})=>{let[r,s]=useState(t??[]),i=e!==void 0,c=i?e:r,a=useRef(c);a.current=c;let l=useRef(n);l.current=n;let u=useCallback(y=>{let f=a.current,I=f.some(x=>Object.is(x,y))?f.filter(x=>!Object.is(x,y)):[...f,y];i||s(I),l.current?.(I);},[i]),d=useMemo(()=>({values:c,toggle:u}),[c,u]);return jsx(hi.Provider,{value:d,children:o})},co=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,value:r,children:s,__index:i,disabled:c=false,css:a,className:l,startIcon:u,endIcon:d,...y},f){let T=useContext(hi),I=!!T&&r!==void 0,x=!I&&t!==void 0,[R,g]=useState(()=>I?T.values.some(O=>Object.is(O,r)):!!n),p=I?T.values.some(O=>Object.is(O,r)):x?!!t:R,m=V(),P=!!useContext(Tt),w=()=>{if(!c)if(I)T.toggle(r);else {let O=!p;x||g(O),o?.(O);}},v=css({width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,marginLeft:P?-1:-3,borderRadius:m.radius.xs,transition:"background-color .12s ease"}),N=css({pointerEvents:"none"}),B=useCallback(O=>{O&&(O.querySelectorAll("[tabindex]").forEach(S=>{S.tabIndex=-1;}),O.querySelectorAll('input, button, a, [role="checkbox"]').forEach(S=>{S.tabIndex=-1;}));},[]),K=jsxs(Fragment,{children:[jsx("span",{ref:B,"data-menu-checkbox-wrapper":true,className:"plainframe-ui-menu-checkbox-wrapper",css:v,"aria-hidden":"true",children:jsx(sr,{size:"sm",checked:p,css:N})}),u]});return jsx(pn,{...y,className:["plainframe-ui-menu-checkbox-item",l||""].join(" ").trim(),ref:f,__index:i,role:"menuitemcheckbox","aria-checked":p,closeOnSelect:false,onSelect:w,disabled:c,startIcon:K,endIcon:d,css:a,selected:false,children:s})});co.displayName="MenuCheckboxItem";var yi=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,children:r,__index:s,disabled:i=false,css:c,switchSize:a="md",switchCss:l,startIcon:u,className:d,...y},f){let T=t!==void 0,[I,x]=useState(!!n),R=T?!!t:I,p=!!useContext(Tt),m=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),C=css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,paddingRight:p?2:void 0}),P=()=>{if(i)return;let v=!R;T||x(v),o?.(v);},w=css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,"& > *":{flexShrink:0},"& > svg:only-child":{width:16,height:16,display:"block"}});return jsxs(pn,{...y,className:["plainframe-ui-menu-switch-item",d||""].join(" ").trim(),ref:f,__index:s,disabled:i,closeOnSelect:false,onSelect:P,css:c,selected:false,children:[u&&jsx("span",{className:"plainframe-ui-menu-item-start",css:w,children:u}),jsx("span",{"data-label":true,css:m,className:"plainframe-ui-menu-item-label",children:r}),jsx("span",{className:"plainframe-ui-menu-switch-wrap",css:C,children:jsx(ms,{checked:R,css:css({pointerEvents:"none",padding:0,marginRight:-1},l),className:"plainframe-ui-menu-switch",tabIndex:-1,size:a})})]})});yi.displayName="MenuSwitchItem";var xi=me.createContext(null),lr=({value:e,defaultValue:t,onValueChange:n,children:o})=>{let[r,s]=useState(t),i=e??r,c=l=>{e!==void 0||s(l),n?.(l);},a=useMemo(()=>({value:i,onChange:c}),[i]);return jsx(xi.Provider,{value:a,children:o})};lr.displayName="MenuRadioGroup";var Zu=forwardRef(function({value:t,children:n,__index:o,disabled:r=false,css:s,className:i,...c},a){let l=useContext(xi),u=l?.value===t,d=V(),y=css({width:d.spacing.md,display:"inline-flex",justifyContent:"center",alignItems:"center",marginLeft:-1}),f=css({width:7,height:7,borderRadius:"100%",backgroundColor:d.palette.primary[600],transform:u?"scale(1)":"scale(0.4)",opacity:u?1:0,transition:"transform 140ms ease-out, opacity 140ms linear",transformOrigin:"center center"}),T=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"});return jsxs(pn,{...c,className:["plainframe-ui-menu-radio-item",i||""].join(" ").trim(),ref:a,__index:o,role:"menuitemradio","aria-checked":u,closeOnSelect:false,onSelect:()=>{r||l?.onChange?.(t);},disabled:r,css:s,selected:false,children:[jsx("span",{className:"plainframe-ui-menu-radio-dotbox",css:y,children:jsx("span",{className:"plainframe-ui-menu-radio-dot",css:f})}),jsx("span",{className:"plainframe-ui-menu-item-label",css:T,children:n})]})}),mn=forwardRef(function({inset:t,className:n,css:o,children:r,startIcon:s,endIcon:i,wrap:c=false,color:a="primary",...l},u){let d=V(),f=!!useContext(Tt),T=a==="primary"?d.text.primary:a==="secondary"?d.text.secondary:d.palette[a]?.[700]??d.text.primary,I=css({display:"flex",alignItems:"center",padding:f?`${d.spacing.sm} ${d.spacing.md}`:`${d.spacing.sm} ${d.spacing.md}`,fontSize:d.typography.sizes.sm,color:T,fontWeight:500,...t?{paddingLeft:`calc(${d.spacing.lg} * 2)`}:null,gap:d.spacing.xs}),x=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:c?"normal":"nowrap"}),R=css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,padding:"0 3px 0 2px",marginLeft:-2,"& > svg":{width:16,height:16,display:"block"}}),g=css({display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,lineHeight:0,"& > svg":{width:16,height:16,display:"block"}});return jsxs("div",{ref:u,role:"presentation",className:["plainframe-ui-menu-label",n||""].join(" ").trim(),css:css(I,o),...l,children:[s&&jsx("span",{className:"plainframe-ui-menu-label-start",css:R,children:s}),jsx("span",{className:"plainframe-ui-menu-label-text",css:x,children:r}),i&&jsx("span",{className:"plainframe-ui-menu-label-end",css:g,children:i})]})});mn.displayName="MenuLabel";var Qu=({className:e,css:t,variant:n="full",...o})=>{let r=V(),s=`var(--pfui-panel-pad, ${typeof r.spacing.xs=="number"?r.spacing.xs+"px":String(r.spacing.xs)})`,i=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:"calc(var(--pfui-panel-pad, 0px) * -1)",marginRight:"calc(var(--pfui-panel-pad, 0px) * -1)"}),c=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.md}`,marginRight:`${r.spacing.md}`}),a=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.lg}`,marginRight:0}),l=n==="full"?i:n==="middle"?c:a;return jsx("div",{role:"separator",className:["plainframe-ui-menu-separator",e||""].join(" ").trim(),css:css(l,t),...o})};var bs=io,po=0,dr=null,pr=null,pd=()=>typeof window>"u"||typeof document>"u"?0:window.innerWidth-document.documentElement.clientWidth;function md(){if(!(typeof document>"u")){if(po===0){let e=document.body;dr=e.style.overflow||"",pr=e.style.paddingRight||"";let t=pd();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}po+=1;}}function fd(){if(!(typeof document>"u")&&(po>0&&(po-=1),po===0)){let e=document.body;dr!==null&&(e.style.overflow=dr),pr!==null&&(e.style.paddingRight=pr),dr=null,pr=null;}}var fn=createContext(null),mr=()=>{let e=useContext(fn);if(!e)throw new Error("DropdownMenu components must be used inside <DropdownMenu>.");return e},mo=createContext(null),gd=()=>useContext(mo),oo=createContext(null),uo=()=>useContext(oo),Ci=createContext(null),cr=()=>useContext(Ci),Ri=createContext(false),bd=()=>useContext(Ri),ro=createContext({allItemsTabbable:true}),ur=me.createContext(null),hs=()=>useContext(ur);function hd(){let e=[],t=new Set,n={current:false};return {registerCloser(o){return e.push(o),()=>{let r=e.indexOf(o);r>=0&&e.splice(r,1);}},closeAll(){if(!n.current){n.current=true;for(let o=e.length-1;o>=0;o--)try{e[o]();}catch{}queueMicrotask(()=>{n.current=false;});}},registerHoverCtl(o){return t.add(o),()=>t.delete(o)},clearAllHover(){t.forEach(o=>o.clear());},isBusClosingRef:n}}var yd=()=>gd()?.activeIndex??null,Ti=0,$n=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="click",lockScroll:r=true,size:s="md",children:i})=>{let[c,a]=useState(!!t),l=e??c,u=useCallback(F=>{e===void 0&&a(F),n?.(F);},[e,n]),d=useRef(`pfui-menu-${++Ti}`),y=useRef(null),f=useRef([]),T=useRef(null),[I,x]=useState(null),[R,g]=useState(false);useEffect(()=>{l||(x(null),f.current=[],g(false));},[l]);let p=useRef(null),m=useCallback((F,M)=>{if(o!=="hover")return;window.clearTimeout(p.current??0);let b=M??20;p.current=window.setTimeout(()=>u(F),b);},[o,u]),C=useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null);},[]);useEffect(()=>()=>C(),[C]),useEffect(()=>{if(!(!r||!l))return md(),()=>fd()},[l,r]);let P=hs(),[w]=useState(()=>P??hd()),v=useRef(new Set),N=useMemo(()=>({registerSubMenu:F=>(v.current.add(F),()=>v.current.delete(F)),closeAllSubMenus:()=>{v.current.forEach(F=>F());}}),[]),B=useMemo(()=>({open:l,setOpen:u,trigger:o,referenceRef:y,listRef:f,floatingRef:T,setActiveIndex:x,scheduleSubmenuHover:m,clearSubmenuHover:C,menuId:d.current}),[l,u,o,x,m,C]),K=useMemo(()=>({activeIndex:I,setActiveIndex:x}),[I,x]),O=useMemo(()=>({isKeyboardNav:R,setIsKeyboardNav:g}),[R]),S=s==="sm";return jsx(ur.Provider,{value:w,children:jsx(Tt.Provider,{value:S,children:jsx(oo.Provider,{value:O,children:jsx(Ci.Provider,{value:N,children:jsx(mo.Provider,{value:K,children:jsx(fn.Provider,{value:B,children:i})})})})})})};$n.displayName="DropdownMenu";var zn=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},i)=>{let{open:c,setOpen:a,trigger:l,referenceRef:u,listRef:d,setActiveIndex:y,scheduleSubmenuHover:f,clearSubmenuHover:T,floatingRef:I,menuId:x}=mr(),R=uo(),g=cr(),p=!!e&&isValidElement(t),m=p?t:null,C=m&&m.props&&typeof m.props=="object"&&"onKeyDown"in m.props?m.props.onKeyDown:void 0,P=m&&m.props&&typeof m.props=="object"&&"onClick"in m.props?m.props.onClick:void 0,{onKeyDown:w,onClick:v,...N}=s,B=useMemo(()=>bs(i,p&&isValidElement(t)&&"ref"in t?t.ref:void 0,u),[i,p,t,u]),K=useCallback(()=>d.current.filter(Boolean),[d]),O=useCallback(h=>{let A=K();requestAnimationFrame(()=>A[h]?.focus());},[K]),S=useCallback(h=>{if(h.key==="Tab"&&c){h.preventDefault(),R?.setIsKeyboardNav(true);let A=I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=A.querySelector('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])');D&&(document.querySelectorAll("[data-highlighted]").forEach(L=>L.removeAttribute("data-highlighted")),D.setAttribute("data-highlighted",""),D.focus());}return}if(h.key==="ArrowRight"&&c){let A=document.querySelector("[data-subtrigger][data-hovered]");if(A){h.preventDefault(),h.stopPropagation(),R?.setIsKeyboardNav(true),A.removeAttribute("data-hovered"),A.setAttribute("data-highlighted",""),A.focus(),requestAnimationFrame(()=>{let D=new KeyboardEvent("keydown",{key:"ArrowRight",bubbles:true,cancelable:true});A.dispatchEvent(D);});return}}if(h.key==="ArrowDown"||h.key==="ArrowUp"){if(R?.setIsKeyboardNav(true),!c){h.preventDefault(),a(true),requestAnimationFrame(()=>{let A=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=Array.from(A.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(L=>{let k=L.closest("[data-submenu-content]");if(k&&k!==A)return false;let E=window.getComputedStyle(L);return E.display!=="none"&&E.visibility!=="hidden"});if(D.length>0){let L=h.key==="ArrowDown"?0:D.length-1;y(L),D[L]?.setAttribute("data-highlighted",""),D[L]?.focus();}}}),C?.(h),w?.(h);return}if(c){h.preventDefault();let A=document.querySelectorAll("[data-hovered]");for(let L of Array.from(A))if(L.closest("[data-submenu-content]")){let E=L.closest('[role="menu"]');if(E){E.setAttribute("data-keyboard-nav","");let W=Array.from(E.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled])')).filter(z=>{if(z.closest('[role="menu"]')!==E)return false;let _=window.getComputedStyle(z);return _.display!=="none"&&_.visibility!=="hidden"}),$=W.indexOf(L);if(document.querySelectorAll("[data-highlighted]").forEach(z=>z.removeAttribute("data-highlighted")),L.removeAttribute("data-hovered"),$!==-1&&W.length>0){let z=h.key==="ArrowDown"?1:-1,_=($+z+W.length)%W.length;W[_]?.setAttribute("data-highlighted",""),W[_]?.focus();}return}}let D=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(D){D.setAttribute("data-keyboard-nav",""),g?.closeAllSubMenus();let L=Array.from(D.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(k=>{if(k.closest('[role="menu"]')!==D)return false;let E=window.getComputedStyle(k);return E.display!=="none"&&E.visibility!=="hidden"});if(L.length>0){let k=D.querySelector("[data-highlighted]"),E=D.querySelector("[data-hovered]"),W=-1;k?W=L.indexOf(k):E&&(W=L.indexOf(E)),document.querySelectorAll("[data-highlighted]").forEach(_=>_.removeAttribute("data-highlighted")),E&&E.removeAttribute("data-hovered"),W===-1&&(W=h.key==="ArrowDown"?-1:L.length);let $=h.key==="ArrowDown"?1:-1,z=(W+$+L.length)%L.length;y(z),L[z]?.setAttribute("data-highlighted",""),L[z]?.focus();}}C?.(h),w?.(h);return}}if((h.key==="Enter"||h.key===" ")&&!c){h.preventDefault(),R?.setIsKeyboardNav(true),a(true),requestAnimationFrame(()=>{let A=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=Array.from(A.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(L=>{let k=L.closest("[data-submenu-content]");if(k&&k!==A)return false;let E=window.getComputedStyle(L);return E.display!=="none"&&E.visibility!=="hidden"});D.length>0&&(y(0),D[0]?.setAttribute("data-highlighted",""),D[0]?.focus());}}),C?.(h),w?.(h);return}C?.(h),w?.(h);},[c,a,y,C,w,K,O,d,R,x,I,g]),F=useCallback(h=>{l==="click"&&((h.nativeEvent.composedPath?.()??[]).some(k=>{let E=k;if(!E||!("tagName"in E))return false;let W=String(E.tagName).toUpperCase();if(W==="INPUT"||W==="TEXTAREA"||"isContentEditable"in E&&E.isContentEditable)return true;let $="getAttribute"in E?E.getAttribute("role"):null;return $==="textbox"||$==="combobox"})||(h.stopPropagation(),a(!c))),P?.(h),v?.(h);},[l,c,a,P,v]),M=l==="hover"?{onMouseEnter:()=>{T(),a(true);},onMouseLeave:()=>{f(false);}}:{},b=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0;if(p&&m){let h=m.props,A=h.css,D=typeof h.className=="string"?h.className:void 0,L=typeof h.tabIndex=="number"?h.tabIndex:0,k={ref:B,tabIndex:L,className:[D,o].filter(Boolean).join(" ")||void 0,css:[A,b,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":c,onClick:F,onKeyDown:S,...M,...N};return cloneElement(m,k)}return jsx("button",{ref:B,className:o,css:[css({display:"inline-block"}),b,r],type:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":c,onClick:F,onKeyDown:S,...M,...N,children:t})});zn.displayName="DropdownMenuTrigger";var hn=me.forwardRef(({anchor:e,side:t="bottom",align:n="start",sideOffset:o=6,alignOffset:r=0,collisionPadding:s=8,sameWidth:i=false,width:c,height:a,maxHeight:l,unstyled:u=false,closeOnBlur:d=false,allItemsTabbable:y=false,className:f,css:T,children:I,exitPlacement:x,animateOnBusClose:R=true,gap:g,ignoreOutsidePressRefs:p,disableOutsidePressDismiss:m=false,returnFocus:C=false,...P},w)=>{let{open:v,setOpen:N,referenceRef:B,clearSubmenuHover:K,setActiveIndex:O,floatingRef:S,menuId:F}=mr(),M=V(),b=hs(),h=uo();useEffect(()=>{if(!b)return;let J=b.registerCloser(()=>N(false));return ()=>{J&&J();}},[b,N]);let A=typeof o=="string"?parseFloat(o):o,D=typeof r=="string"?parseFloat(r):r,L=typeof s=="string"?parseFloat(s):s,k=`${t}${n==="center"?"":`-${n}`}`,E=useCallback(J=>({getBoundingClientRect:()=>{let oe=Math.round(J.x),re=Math.round(J.y);return {x:oe,y:re,left:oe,top:re,right:oe,bottom:re,width:0,height:0,toJSON:()=>({x:oe,y:re,left:oe,top:re,right:oe,bottom:re,width:0,height:0})}},contextElement:void 0}),[]),W=useMemo(()=>{if(!e)return null;if(e instanceof HTMLElement||typeof e=="object"&&e!==null&&"getBoundingClientRect"in e&&typeof e.getBoundingClientRect=="function")return e;let J=e;return E({x:J.x,y:J.y})},[e,E]),{refs:$,x:z,y:_,strategy:H,context:U,update:X}=useFloating({open:v,onOpenChange:N,placement:k,whileElementsMounted:autoUpdate,middleware:[offset({mainAxis:A??0,crossAxis:D??0}),flip({padding:L??8}),shift({padding:L??8}),size({apply({rects:J,elements:oe}){let re=oe.floating;re.style.boxSizing="border-box",a!=null?re.style.height=typeof a=="number"?`${a}px`:String(a):re.style.removeProperty("height"),c!=null?re.style.width=typeof c=="number"?`${c}px`:String(c):i?re.style.width=`${Math.round(J.reference.width)}px`:re.style.width="200px",l!=null?re.style.maxHeight=typeof l=="number"?`${l}px`:String(l):re.style.removeProperty("max-height");}})]});useEffect(()=>{W?$.setReference(W):B.current&&$.setReference(B.current);},[$,W,B]),useEffect(()=>{if(!v)return;let J=W||B.current,oe=$.floating.current;if(!(!J||!oe))return autoUpdate(J,oe,X)},[v,W,B,$,X]),useEffect(()=>{X();},[X,i,c,a,l]),useEffect(()=>{v&&!y&&O(0);},[v,y,O]),useEffect(()=>{if(!d||!v)return;let J=()=>{let oe=document.activeElement,re=B.current,qe=$.floating.current;oe&&(re?.contains(oe)||qe?.contains(oe)||N(false));};return document.addEventListener("focusin",J,true),()=>document.removeEventListener("focusin",J,true)},[d,v,N,B,$.floating]);let ae=useDismiss(U,{outsidePressEvent:"pointerdown",escapeKey:true,outsidePress:m?false:J=>{if(p?.length){let oe=J.target;for(let re of p)if(re.current?.contains(oe))return false}return true}}),q=useRole(U,{role:"menu"}),{getFloatingProps:Y}=useInteractions([ae,q]),le=useRef(false);useEffect(()=>{v?le.current=true:le.current&&B.current&&C&&(b?.isBusClosingRef.current||requestAnimationFrame(()=>{B.current?.focus();}));},[v,B,b,C]);let ie=typeof M.spacing.xs=="number"?`${M.spacing.xs}px`:String(M.spacing.xs),be=g===void 0?void 0:typeof g=="number"?g:M.spacing[g]??g,Pe=u?void 0:css({boxSizing:"border-box",background:M.surface.panelBg,border:`${M.componentHeights.border} solid ${M.surface.border}`,borderRadius:M.radius.lg,boxShadow:"0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)","--pfui-panel-pad":ie,padding:"var(--pfui-panel-pad)",color:M.text.primary,maxHeight:l,overflowY:"auto",display:"flex",flexDirection:"column",gap:be,"& > *":{flexShrink:0},"&[data-keyboard-nav]":{cursor:"none"},"&[data-keyboard-nav] *":{cursor:"none !important",pointerEvents:"none"}}),Re=-1,Ce=J=>{if(!J||typeof J!="object"||!isValidElement(J))return J;let re=J.type?.displayName;if(re==="DropdownMenu"||re==="DropdownMenuSub")return J;if(re==="MenuItem"||re==="MenuCheckboxItem"||re==="MenuRadioItem"||re==="MenuSwitchItem")return Re+=1,cloneElement(J,{__index:Re,key:J.key??Re});if(re==="DropdownMenuTrigger"){let j=J.props.children;return cloneElement(J,{children:me.Children.map(j,Ce)})}if(re==="DropdownMenuSubTrigger"){Re+=1;let j=Re;return cloneElement(J,{__index:j,key:J.key??j})}let qe=J.props.children;return qe==null?J:cloneElement(J,{children:me.Children.map(qe,Ce)})},Ie=me.Children.map(I,Ce),we=U.placement.split("-")[0]||"bottom",he=we==="bottom"?"center top":we==="top"?"center bottom":we==="left"?"right center":"left center",je=we==="bottom"?{opacity:0,y:-8,scale:.96}:we==="top"?{opacity:0,y:8,scale:.96}:we==="left"?{opacity:0,x:8,scale:.96}:{opacity:0,x:-8,scale:.96},Z=x??we,Ee=Z==="bottom"?{opacity:0,y:-8,scale:.96}:Z==="top"?{opacity:0,y:8,scale:.96}:Z==="left"?{opacity:0,x:8,scale:.96}:{opacity:0,x:-8,scale:.96},ee=!!b?.isBusClosingRef.current&&!R?{scale:{duration:0},x:{duration:0},y:{duration:0},opacity:{duration:0}}:{scale:{type:"spring",stiffness:520,damping:38,mass:.5},x:{type:"spring",stiffness:420,damping:30,mass:.6},y:{type:"spring",stiffness:420,damping:30,mass:.6},opacity:{duration:.12,ease:"linear"}},se=css({position:H,top:_??0,left:z??0,zIndex:1e3,transformOrigin:he}),pe=useCallback(J=>{if(J.key==="Tab"){J.preventDefault();return}if(J.key==="ArrowDown"||J.key==="ArrowUp"){J.preventDefault(),h?.setIsKeyboardNav(true);let oe=J.currentTarget;oe.setAttribute("data-keyboard-nav","");let re=Array.from(oe.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(qe=>{if(qe.closest('[role="menu"]')!==oe)return false;let j=window.getComputedStyle(qe);return j.display!=="none"&&j.visibility!=="hidden"});if(re.length>0){let qe=oe.querySelector("[data-highlighted]"),j=oe.querySelector("[data-hovered]"),ue=-1;qe?ue=re.indexOf(qe):j&&(ue=re.indexOf(j)),document.querySelectorAll("[data-highlighted]").forEach(ze=>ze.removeAttribute("data-highlighted")),j&&j.removeAttribute("data-hovered"),ue===-1&&(ue=J.key==="ArrowDown"?-1:re.length);let de=J.key==="ArrowDown"?1:-1,fe=(ue+de+re.length)%re.length;O(fe),re[fe]?.setAttribute("data-highlighted",""),re[fe]?.focus();}}},[h,O]),Se=useCallback(J=>{let oe=J.currentTarget;oe.removeAttribute("data-keyboard-nav"),oe.querySelectorAll("[data-highlighted]").forEach(re=>re.removeAttribute("data-highlighted")),h?.isKeyboardNav&&h.setIsKeyboardNav(false);},[h]),Ne=useCallback(J=>{J.removeAttribute("data-keyboard-nav"),J.querySelectorAll("[data-highlighted]").forEach(oe=>oe.removeAttribute("data-highlighted")),h?.isKeyboardNav&&h.setIsKeyboardNav(false);},[h]);return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:v?jsx(ro.Provider,{value:{allItemsTabbable:y},children:jsx(motion.div,{...Y({...P,ref:bs(w,$.setFloating,J=>{S&&(S.current=J);})}),"data-menu-id":F,"data-keyboard-nav":h?.isKeyboardNav?"":void 0,className:f,css:[Pe,se,T],initial:je,animate:{opacity:1,x:0,y:0,scale:1},exit:Ee,transition:ee,onPointerMove:J=>Ne(J.currentTarget),onPointerDown:J=>Ne(J.currentTarget),onKeyDown:pe,onMouseMove:Se,onMouseEnter:()=>{K(),b?.clearAllHover();},onMouseLeave:()=>{document.querySelectorAll("[data-hovered]").forEach(J=>J.removeAttribute("data-hovered"));},children:Ie})}):null})})});hn.displayName="DropdownMenuContent";var wi=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="hover",dense:r,children:s})=>{let i=bd(),[c,a]=useState(!!t),l=e??c,u=useCallback(S=>{e===void 0&&a(S),n?.(S);},[e,n]),d=useRef(null),y=useRef(false),f=useCallback((S,F)=>{if(o!=="hover")return;window.clearTimeout(d.current??0),y.current=S;let M=F??20;d.current=window.setTimeout(()=>{y.current=false,u(S);},M);},[o,u]),T=useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null,y.current=false);},[]);useEffect(()=>()=>T(),[T]);let I=cr();useEffect(()=>{if(!I)return;let S=()=>{T(),u(false);};return I.registerSubMenu(S)},[I,u,T]);let x=useRef(`pfui-submenu-${++Ti}`),R=useRef(null),g=useRef([]),p=useRef(null),[m,C]=useState(null),[P,w]=useState(false);useEffect(()=>{l||(C(null),g.current=[],w(false));},[l]);let v=useContext(Tt),N=r??v,B=useMemo(()=>({open:l,setOpen:u,trigger:o,referenceRef:R,listRef:g,floatingRef:p,setActiveIndex:C,scheduleSubmenuHover:f,clearSubmenuHover:T,pendingOpenRef:y,menuId:x.current}),[l,u,o,C,f,T]),K=useMemo(()=>({activeIndex:m,setActiveIndex:C}),[m,C]),O=useMemo(()=>({isKeyboardNav:P,setIsKeyboardNav:w}),[P]);return i?(console.warn("[DropdownMenu] Nested submenus are not supported. DropdownMenuSub can only be used one level deep inside DropdownMenu. The nested submenu content will not be rendered."),jsx(Fragment,{children:me.Children.map(s,S=>{if(!isValidElement(S))return S;let F=S.type;return F?.displayName==="DropdownMenuSubTrigger"||F?.displayName==="DropdownMenuSubContent"?null:S})})):jsx(Ri.Provider,{value:true,children:jsx(Tt.Provider,{value:N,children:jsx(mo.Provider,{value:K,children:jsx(oo.Provider,{value:O,children:jsx(fn.Provider,{value:B,children:s})})})})})};wi.displayName="DropdownMenuSub";var Ei=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},i)=>{let{open:c,setOpen:a,trigger:l,referenceRef:u,scheduleSubmenuHover:d,clearSubmenuHover:y,pendingOpenRef:f,menuId:T}=mr(),I=uo(),x=useCallback(S=>{S&&(S.__pfuiCloseSubmenu=()=>a(false));},[a]),R=!!e&&isValidElement(t),g=R?t:null,p=g?.props,m=p?.onKeyDown,C=p?.onClick,{onKeyDown:P,onClick:w,...v}=s,N=useMemo(()=>bs(i,R&&isValidElement(t)&&"ref"in t?t.ref:void 0,u,x),[i,R,t,u,x]),B=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0,K=useCallback(S=>{if(S.key==="Tab"){S.preventDefault();return}let F=S.currentTarget,M=b=>{I?.setIsKeyboardNav(true);let h=F.closest("[data-menu-id]");if(!h)return;h.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted"));let A=Array.from(h.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(E=>{if(E.closest("[data-menu-id]")!==h)return false;let W=window.getComputedStyle(E);return W.display!=="none"&&W.visibility!=="hidden"});if(!A.length)return;let D=A.indexOf(F),L=D>=0?D:0,k=b==="next"?(L+1)%A.length:(L-1+A.length)%A.length;A[k]?.setAttribute("data-highlighted",""),A[k]?.focus();};if(S.key==="ArrowDown"){S.preventDefault(),S.stopPropagation(),c&&a(false),M("next");return}if(S.key==="ArrowUp"){S.preventDefault(),S.stopPropagation(),c&&a(false),M("prev");return}if(S.key==="ArrowRight"||S.key==="Enter"||S.key===" "){S.preventDefault(),S.stopPropagation(),I?.setIsKeyboardNav(true);let b=S.currentTarget;a(true),requestAnimationFrame(()=>{let h=T?document.querySelector(`[data-menu-id="${T}"]`):document.querySelector("[data-submenu-content]");if(h){h.setAttribute("data-keyboard-nav",""),b.removeAttribute("data-highlighted"),b.removeAttribute("data-hovered");let A=h.querySelector('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]):not([data-subtrigger]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])');A&&(A.setAttribute("data-highlighted",""),A.focus());}});return}if(S.key==="ArrowLeft"){S.preventDefault(),S.stopPropagation(),c&&a(false);let b=F.closest("[data-menu-id]");b&&b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(h=>h.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(h=>h.removeAttribute("data-hovered")),F.setAttribute("data-highlighted",""),F.focus(),I&&I.setIsKeyboardNav(true);return}if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),m?.(S);return}m?.(S),P?.(S);},[c,a,m,P,u,I,T]),O=l==="hover"?{onMouseEnter:S=>{let F=S.currentTarget;lo(),y(),document.querySelectorAll("[data-hovered]").forEach(b=>b.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),F.setAttribute("data-hovered",""),F.focus({preventScroll:true});let M=F.closest("[data-menu-id]");M?.hasAttribute("data-keyboard-nav")&&M.removeAttribute("data-keyboard-nav"),I&&I.setIsKeyboardNav(false),c||d(true,90);},onMouseMove:S=>{let F=S.currentTarget;lo(),F.hasAttribute("data-hovered")||(document.querySelectorAll("[data-hovered]").forEach(M=>M.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(M=>M.removeAttribute("data-highlighted")),F.setAttribute("data-hovered","")),!c&&!f?.current&&d(true,90);},onMouseLeave:()=>{d(false,60);}}:{onClick:S=>{S.stopPropagation(),a(!c),C?.(S),w?.(S);}};if(R&&g){let S=p?.css,F=typeof p?.className=="string"?p.className:void 0,M=typeof p?.tabIndex=="number"?p.tabIndex:0,b={ref:N,tabIndex:M,className:[F,o].filter(Boolean).join(" ")||void 0,css:[S,B,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":c,"data-subtrigger":"",__skipListReg:true,onKeyDown:K,onFocus:h=>{if(h.target.hasAttribute("data-highlighted")){let A=h.target.closest("[data-menu-id]");A&&!A.hasAttribute("data-keyboard-nav")&&(A.setAttribute("data-keyboard-nav",""),I&&I.setIsKeyboardNav(true));}p&&"onFocus"in p&&typeof p.onFocus=="function"&&p.onFocus(h);},...O,...v};return cloneElement(g,b)}return jsx("div",{ref:N,role:"menuitem",tabIndex:0,className:o,css:[css({display:"flex",alignItems:"center",gap:8,cursor:"pointer"}),B,r],"aria-haspopup":"menu","aria-expanded":c,"data-subtrigger":"",onKeyDown:K,onFocus:S=>{if(S.currentTarget.hasAttribute("data-highlighted")){let F=S.currentTarget.closest("[data-menu-id]");F&&!F.hasAttribute("data-keyboard-nav")&&(F.setAttribute("data-keyboard-nav",""),I&&I.setIsKeyboardNav(true));}},...O,...v,children:t})});Ei.displayName="DropdownMenuSubTrigger";var ki=me.forwardRef((e,t)=>{let n=hs(),{referenceRef:o,clearSubmenuHover:r,scheduleSubmenuHover:s}=mr(),i=[e.className,"plainframe-ui-submenu-content"].filter(Boolean).join(" ");return jsx(hn,{ref:t,side:"right",align:"start",exitPlacement:"bottom",animateOnBusClose:true,...e,className:i,"data-submenu-content":"",anchor:o.current,onMouseEnter:c=>{r(),n?.clearAllHover(),lo(),e.onMouseEnter?.(c);},onMouseLeave:c=>{s(false,60),e.onMouseLeave?.(c);}})});ki.displayName="DropdownMenuSubContent";var fr=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toLowerCase(),Cd=css({display:"inline"}),Si=css({display:"inline",fontWeight:700}),Rd=css({position:"absolute",inset:0,pointerEvents:"none",opacity:0,zIndex:-1,outline:"none"}),Td=css({display:"flex",alignItems:"center",gap:4}),wd=css({flex:"1 1 auto",minWidth:0,display:"flex",flexDirection:"column",gap:2}),Mi=css({fontWeight:500,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word"}),Ed=css({fontSize:"0.875em",overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400}),kd=()=>{},Id=e=>e,Sd=e=>`plainframe-ui-autocomplete${e?`-${e}`:""}`,Md=e=>{e.preventDefault(),e.stopPropagation();},Fd=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation());},Ad=e=>{e.preventDefault(),e.stopPropagation();},Fi=me.memo(({onCapture:e})=>{let t=useContext(fn),n=useContext(mo),o=useMemo(()=>({...t,activeIndex:n?.activeIndex??null,setActiveIndex:n?.setActiveIndex??t?.setActiveIndex}),[t,n]);return useEffect(()=>{e(o);},[o,e]),null});Fi.displayName="CtxCapture";var ys=me.memo(({item:e,absIndex:t,multiple:n,getCurrentMulti:o,isSelected:r,renderItem:s,paint:i,cls:c,closeOnSelect:a,pickSingle:l,handleItemKeyDown:u,handleItemMouseDown:d,descriptionColor:y})=>{let f=o(),T=useMemo(()=>{let R=String(e.title??e.value);return s?R:i(R)},[i,e.title,e.value,s]),I=useMemo(()=>e.description?jsxs("span",{className:"plainframe-ui-autocomplete-item-content",css:wd,children:[jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:T}),jsx("span",{className:"plainframe-ui-autocomplete-item-description",css:[Ed,{color:y}],children:e.description})]}):jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:T}),[T,e.description,y]),x=useCallback(()=>{e.disabled||l(e.value);},[e.disabled,e.value,l]);if(n){let R=f.some(g=>Object.is(g,e.value));return s?jsx(co,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${c("checkbox-item")}`.trim(),css:e.css,onMouseDown:d,children:s(e,R)},e.value):jsx(co,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${c("checkbox-item")}`.trim(),css:e.css,onMouseDown:d,startIcon:e.startIcon,endIcon:e.endIcon,children:I},e.value)}return s?jsx(pn,{__index:t,onClick:x,onSelect:x,onKeyDown:u,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:c("item"),css:e.css,closeOnSelect:a,onMouseDown:d,selected:r,children:s(e,r)},e.value):jsx(pn,{startIcon:e.startIcon,endIcon:e.endIcon,__index:t,onClick:x,onSelect:x,onKeyDown:u,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:c("item"),css:e.css,closeOnSelect:a,onMouseDown:d,selected:r,children:I},e.value)},(e,t)=>!(e.item.value!==t.item.value||e.item.disabled!==t.item.disabled||e.item.description!==t.item.description||e.absIndex!==t.absIndex||e.multiple!==t.multiple||e.closeOnSelect!==t.closeOnSelect||e.renderItem!==t.renderItem||e.pickSingle!==t.pickSingle||e.isSelected!==t.isSelected||e.paint!==t.paint||e.descriptionColor!==t.descriptionColor));ys.displayName="AutocompleteRow";var Ai=me.memo(({items:e=[],onSelect:t,width:n=300,fullWidth:o=false,placeholder:r,renderItem:s,focusRingMode:i,css:c,inputCss:a,containerCss:l,label:u,helperText:d,variant:y,startIcon:f,endIcon:T,size:I,disabled:x=false,error:R=false,showClear:g=false,open:p,onOpenChange:m,openOnFocus:C=false,openOnType:P=true,openOnClick:w=true,closeOnSelect:v=true,closeOnBlur:N=true,blurOnSelect:B=false,freeSolo:K=false,customValueLabel:O=false,maxHeight:S,maxItems:F,noResultsText:M="No Items Found",highlightTypedValue:b,typedValueHighlightCss:h,showNoResults:A=true,noResultsLabelCss:D,loadingLabelCss:L,loadItems:k,loading:E,loadingText:W="Loading\u2026",debounceMs:$=200,multiple:z=false,selectedValues:_,defaultSelectedValues:H,onChangeSelected:U,expandIcon:X,showExpandIcon:ae=true,expandIconCss:q,textFieldWrapperCss:Y,textFieldInputCss:le,textFieldLabelCss:ie,textFieldHelperRowCss:be,textFieldHelperTextCss:Pe,textFieldStartIconCss:Re,textFieldEndIconCss:Ce,menuContentCss:Ie})=>{let we=V().text.secondary,[he,je]=useState(""),Z=typeof p=="boolean",[Ee,Q]=useState(false),ee=Z?p:Ee,se=useRef(null),pe=useRef(null),Se=useRef(null),Ne=useRef(null),J=useRef(false),oe=useRef(null),re=useRef(false),qe=useRef(0),j=useMemo(()=>[pe],[]),[ue,de]=useState(H??[]),fe=_??ue,ze=useRef(fe);ze.current=fe;let[Oe,st]=useState(null),Ye=useRef(Oe);Ye.current=Oe;let yt=useCallback(()=>ze.current,[]),[tn,nn]=useState([]),[Sn,on]=useState(false),Je=typeof k=="function",xt=Je?tn:e,ce=useRef(xt);ce.current=xt;let ke=!!E||Sn&&Je,at=useRef(m);useEffect(()=>{at.current=m;},[m]);let De=useCallback(G=>{Z||Q(G),at.current?.(G);},[Z]),bt=useRef(null);useEffect(()=>{if(!Je)return;bt.current&&window.clearTimeout(bt.current);let G=he;return bt.current=window.setTimeout(async()=>{on(true);try{let ne=await k(G)||[];nn(Array.isArray(ne)?ne:[]);}catch{nn([]);}finally{on(false);}},Math.max(0,$)),()=>{bt.current&&window.clearTimeout(bt.current);}},[he,Je,k,$]);let Zn=useMemo(()=>{let G=fr(he);return G?xt.some(ne=>fr(ne.title??ne.value)===G):false},[xt,he]),sa=K&&!!O&&he.trim().length>0&&!Zn,nc=G=>{if(typeof O=="object"){let ne=Object.prototype.hasOwnProperty.call(O,"prefix"),ve=Object.prototype.hasOwnProperty.call(O,"suffix");if(ne||ve){let Me=ne?O.prefix??"":"",ge=ve?O.suffix??"":"";return `${Me}${G}${ge}`}return `Add "${G}"`}return `Add "${G}"`},Or=useMemo(()=>{if(Je)return xt;let G=fr(he);if(!G)return xt;let ne=[],ve=[];for(let Me of xt){let ge=fr(Me.title??Me.value);ge.split(" ").some(Ze=>Ze.startsWith(G))?ne.push(Me):ge.includes(G)&&ve.push(Me);}return ne.length>0?ne:ve},[xt,he,Je]),aa=useMemo(()=>{if(sa){let G=he.trim();return [...Or,{value:G,title:nc(G),__pfui_free__:true}]}return Or},[Or,sa,he]),Kt=useMemo(()=>{let G=[],ne=new Map;for(let pt of aa){let Ze=pt.group??"__ungrouped__";ne.has(Ze)||(ne.set(Ze,[]),G.push(Ze)),ne.get(Ze).push(pt);}let Me=typeof F=="number"?Math.max(0,F):1/0,ge=[];for(let pt of G){if(Me<=0)break;let sn=ne.get(pt).slice(0,Me);sn.length>0&&(ge.push({label:pt==="__ungrouped__"?void 0:pt,items:sn}),Me-=sn.length);}return ge},[aa,F]),Mn=useMemo(()=>Kt.reduce((G,ne)=>(G.push(...ne.items),G),[]),[Kt]),Ho=Mn.length>0,Wr=!Ho&&!!A&&!ke&&he.trim().length>0,Fn=ke||Ho||Wr,Lo=Fn||Je;useEffect(()=>{!Je&&ee&&!Fn&&(re.current=true,De(false),setTimeout(()=>{re.current=false;},150));},[Je,ee,Fn,De]);let Kr=useRef(null),_r=useRef(false);useEffect(()=>{if(K&&!z){if(_r.current){_r.current=false;return}let G=he.trim();if(Kr.current===G)return;Kr.current=G,t?.({value:G,title:G});}},[he,K,z,t]);let jr=useCallback(G=>{let ne=ce.current,ve=new Map(ne.map(ge=>[ge.value,ge])),Me=G.map(ge=>ve.get(ge)??{value:ge,title:ge});U?.(Me);},[U]),Bo=useCallback(G=>{let ne=G.map(String);_||de(ne),jr(ne);},[_,jr]),ia=useCallback(G=>{let ve=fe.includes(G)?fe.filter(Me=>Me!==G):[...fe,G];Bo(ve);},[fe,Bo]),$o=useCallback(G=>{let ne=ce.current.find(ve=>ve.value===G)??{value:G,title:G};ne.disabled||(_r.current=true,Kr.current=(ne.title??ne.value).trim(),st(ne),je(ne.title??ne.value),t?.(ne),Z||(v?(J.current=false,re.current=true,Q(false),at.current?.(false),setTimeout(()=>{re.current=false;},150)):J.current=true),!v&&Se.current?.setActiveIndex&&Se.current.setActiveIndex(null),B?(J.current=false,setTimeout(()=>{Ne.current&&se.current?(Ne.current.tabIndex=0,Ne.current.focus(),Ne.current.blur(),Ne.current.tabIndex=-1):se.current?.blur();},0)):requestAnimationFrame(()=>se.current?.focus()));},[t,Z,v,B]),oc=useCallback(G=>{if(x)return;je(G);let ne=!G.trim();z||(ne?(st(null),t?.(null)):K&&st(null)),!Z&&!ne&&P&&!ee&&De(true);},[z,Z,P,ee,De,x,K,t]),it=Sd,la=kd,rc=Id,ca=useMemo(()=>h?[Si,h]:Si,[h]),sc=useCallback(G=>{let ne=he.trim();if(!ne||ne.length<1)return G;let ve=ne.toLowerCase(),ge=G.toLowerCase().indexOf(ve);return ge<0?G:jsxs("span",{className:"plainframe-ui-autocomplete-highlight-wrap",css:Cd,children:[G.slice(0,ge),jsx("span",{className:"plainframe-ui-autocomplete-highlight",css:ca,children:G.slice(ge,ge+ne.length)}),G.slice(ge+ne.length)]})},[he,ca]),zo=b?sc:rc,ac=useMemo(()=>css({position:"relative",display:o?"block":"inline-block",width:"100%",maxWidth:o?"100%":n}),[o,n]),Oo=Md,Wo=Fd,ic=useCallback(G=>{Se.current=G;},[]),ua=useCallback(G=>{let ne=Se.current;if(!ne)return;let ve=Mn.length;if(ve===0)return;let Me=pe.current?.querySelector("[data-menu-id]")??document.querySelector("[data-menu-id]"),ge=-1;if(Me){let Ze=Me.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"]'),sn=Me.querySelector("[data-active]")||Me.querySelector("[data-hovered]");sn&&(ge=Array.from(Ze).indexOf(sn));}ge<0&&typeof ne.activeIndex=="number"&&(ge=ne.activeIndex);let pt=ge<0?G===1?0:ve-1:(ge+G+ve)%ve;ne.setActiveIndex?.(pt),requestAnimationFrame(()=>{let Ze=pe.current?.querySelector("[data-menu-id]")??document.querySelector("[data-menu-id]");if(!Ze)return;Ze.setAttribute("data-keyboard-nav",""),Ze.querySelectorAll("[data-active]").forEach(Ur=>Ur.removeAttribute("data-active")),Ze.querySelectorAll("[data-hovered]").forEach(Ur=>Ur.removeAttribute("data-hovered"));let Vr=Ze.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"]')[pt];Vr&&(Vr.setAttribute("data-active",""),Vr.scrollIntoView?.({block:"nearest"}));});},[Mn.length]),lc=useCallback(G=>{if(G.key===" "||G.code==="Space"||G.key==="Spacebar"){G.stopPropagation();return}if(G.key==="ArrowDown"||G.key==="ArrowUp"){if(x||!Fn&&!Je)return;G.preventDefault(),!ee&&!Z&&De(true),ua(G.key==="ArrowDown"?1:-1);return}if(G.key==="Enter"){if(x)return;let ne=Se.current&&typeof Se.current.activeIndex=="number"?Se.current.activeIndex:-1,ve=ne>=0&&ne<Mn.length?Mn[ne]:null;if(ee&&ve&&ne>=0){G.preventDefault(),G.stopPropagation(),z?(ia(ve.value),v||requestAnimationFrame(()=>se.current?.focus())):$o(ve.value);return}}else G.key==="Escape"?(G.preventDefault(),G.stopPropagation(),ee&&!Z&&(re.current=true,De(false),G.target.focus(),setTimeout(()=>{re.current=false;},150))):G.key==="Tab"&&ee&&!Z&&De(false);},[Fn,Je,ee,Z,Mn,z,v,ua,ia,$o,De,x]),cc=useCallback(()=>{x||re.current||C&&Lo&&(qe.current=Date.now(),Z||De(true));},[Z,C,Lo,De,x]),uc=useCallback(()=>{if(J.current){J.current=false;return}N&&De(false),!K&&!z&&(Oe?je(Oe.title??Oe.value):he.trim()&&je(""));},[N,K,z,Oe,he,De]),da=useCallback(()=>{let G=[],ne=0;return Kt.forEach((ve,Me)=>{ve.label&&G.push(jsx(mn,{className:it("group-label"),children:ve.label},`g-${Me}`)),ve.items.forEach(ge=>{G.push(jsx(ys,{item:ge,absIndex:ne,multiple:true,getCurrentMulti:yt,isSelected:false,renderItem:s,paint:zo,cls:it,closeOnSelect:false,pickSingle:la,handleItemKeyDown:Wo,handleItemMouseDown:Oo,descriptionColor:we},`${ge.group??"__"}|${ge.value}`)),ne+=1;});}),jsx(gs,{values:fe,onValuesChange:Bo,children:G},"multi-group")},[Kt,it,yt,s,zo,fe,Bo,la,Wo,Oo,we]),pa=useCallback(()=>{let G=[],ne=0;return Kt.forEach((ve,Me)=>{ve.label&&G.push(jsx(mn,{className:it("group-label"),children:ve.label},`g-${Me}`)),ve.items.forEach(ge=>{let pt=Oe?.value===ge.value;G.push(jsx(ys,{item:ge,absIndex:ne,multiple:false,getCurrentMulti:yt,isSelected:pt,renderItem:s,paint:zo,cls:it,closeOnSelect:v,pickSingle:$o,handleItemKeyDown:Wo,handleItemMouseDown:Oo,descriptionColor:we},`${ge.group??"__"}|${ge.value}`)),ne+=1;});}),G},[Kt,it,Oe,yt,s,zo,v,$o,Wo,Oo,we]),dc=useMemo(()=>ke?jsx(mn,{css:L,className:it("label-loading"),children:W},"loading"):Wr?jsx(mn,{css:D,className:it("label-empty"),children:M},"empty"):Kt.length===0?null:z?da():pa(),[ke,Wr,Kt.length,it,W,M,z,da,pa]),rn=ee?false:x||!Je&&!Ho&&!A,ma=useCallback(G=>{G.preventDefault(),G.stopPropagation(),!(rn||x)&&(Z||(ee?(re.current=true,De(false),queueMicrotask(()=>se.current?.focus()),setTimeout(()=>{re.current=false;},150)):(De(true),queueMicrotask(()=>se.current?.focus()))));},[ee,Ho,Je,De,rn,x,Z]),fa=useMemo(()=>css({transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1), opacity 0.15s ease",transform:ee?"rotate(180deg)":"rotate(0deg)",display:"flex",alignItems:"center",justifyContent:"center",cursor:rn?"not-allowed":"pointer",userSelect:"none",opacity:rn?.5:1}),[ee,rn]),Ko=useMemo(()=>ae?jsx("span",{ref:oe,role:"button",tabIndex:-1,css:[fa,q],"aria-disabled":rn||void 0,onMouseDown:Ad,onClick:ma,children:X??jsx(ChevronDown,{size:18,strokeWidth:2})}):null,[ae,fa,q,rn,ma,X]),pc=useMemo(()=>T&&Ko?jsxs("span",{css:Td,children:[T,Ko]}):T??Ko,[T,Ko]),mc=useCallback(G=>{if(!(oe.current&&oe.current.contains(G.target)||re.current||x||Date.now()-qe.current<300)){if(ee){!he.trim()&&!Z&&(re.current=true,De(false),setTimeout(()=>{re.current=false;},150));return}w&&Lo&&(!Z||w)&&De(true);}},[ee,he,w,Lo,De,x,Z]);return jsx("div",{ref:pe,className:it(""),css:[ac,l,c],children:jsxs($n,{open:x?false:ee,onOpenChange:x?void 0:De,children:[jsx(Fi,{onCapture:ic}),jsx(zn,{asChild:true,children:jsx("span",{className:it("anchor"),css:Rd,style:{pointerEvents:"none",position:"absolute",visibility:"hidden"},tabIndex:-1})}),jsx(Qo,{ref:se,className:it("input"),focusRingMode:i,value:he,onChange:oc,onKeyDown:lc,onFocus:cc,onBlur:uc,onSurfaceClick:mc,placeholder:r,label:u,helperText:d,variant:y,startIcon:f,endIcon:pc,size:I,width:n,fullWidth:o,disabled:x,error:R,showClear:g,css:a,wrapperCss:Y,inputCss:le,labelCss:ie,helperRowCss:be,helperTextCss:Pe,startIconCss:Re,endIconCss:Ce}),jsx("span",{ref:Ne,tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}}),Fn&&jsx(hn,{className:it("menu"),side:"bottom",align:"start",sameWidth:true,allItemsTabbable:true,maxHeight:typeof S=="number"?`${S}px`:S,css:Ie,ignoreOutsidePressRefs:j,disableOutsidePressDismiss:Z,returnFocus:!B,children:dc})]})})});Ai.displayName="Autocomplete";var Ld=["sm","md","lg"],Bd=(e,t)=>typeof e=="number"?e:Ld.includes(e)?t.componentHeights[e]:t.componentHeights.md,$d=(e,t)=>{let n=e.palette?.[t??"primary"]??e.palette.primary;return n?.[600]??n?.[500]??e.neutral?.[600]??e.neutral?.[500]},zd=(e,t)=>{let n=e.text?.onColors??{};return n[t??"primary"]??n.primary??e.text?.primary??"#fff"},Od=(e,t)=>typeof e=="string"?e:(t?.trim()?.[0]||"").toUpperCase(),Pi=me.memo(forwardRef(({src:e,alt:t,size:n="md",color:o="primary",rounded:r=true,className:s,css:i,children:c,...a},l)=>{let u=V(),[d,y]=useState(!!e);useEffect(()=>{y(!!e);},[e]);let f=Bd(n,u),T=typeof f=="number"?f:Number.parseFloat(String(f))||0,I=T?Math.round(T*(T<=28?.55:.52)):void 0,x=r?u.radius.full:u.radius.md,R=$d(u,o),g=zd(u,o),p=Od(c,t),m=css({width:f,height:f,borderRadius:x,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:d?"transparent":R,color:d?"inherit":g,boxSizing:"border-box",userSelect:"none"}),C=css({width:"100%",height:"100%",display:"block",objectFit:"cover"}),P=css({fontSize:I,lineHeight:1,fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",marginTop:-1});return jsx("div",{ref:l,className:["plainframe-ui-avatar",s||""].join(" ").trim(),css:[m,i],role:d?void 0:"img","aria-label":d?void 0:t,...a,children:d&&e?jsx("img",{className:"plainframe-ui-avatar-img",src:e,alt:t,css:C,onError:()=>y(false),decoding:"async",loading:"lazy"}):typeof c=="string"?jsx("span",{className:"plainframe-ui-avatar-initials",css:P,children:c}):c||jsx("span",{className:"plainframe-ui-avatar-initials",css:P,children:p})})}));Pi.displayName="Avatar";var Ni=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,jd=({children:e,max:t,size:n="md",overlap:o=-7,css:r,rounded:s=true,bgColor:i,extraLabelCss:c,outlineThickness:a=4,className:l})=>{let u=V(),d=xe(),f=(()=>{if(typeof n=="number")return `${n}px`;if(typeof n=="string"){let w=(u.componentHeights&&u.componentHeights[n])??(u.spacing&&u.spacing[n]);return Ni(w??n)}return "32px"})(),T=Children.toArray(e).filter(Boolean),I=typeof t=="number"&&t>=0,x=I&&T.length>t?T.slice(0,t):T,R=I&&T.length>t?T.length-t:0,g=i==="panel"?u.surface.panelBg:i==="subtle"?u.surface.subtleBg:i??u.surface.appBg,p=Ni(a)??"4px",m=css({display:"flex",alignItems:"center"}),C=w=>css({marginLeft:w===0?0:o,zIndex:x.length-w,boxShadow:`0 0 0 ${p} ${g}`,backgroundColor:g,borderRadius:s?u.radius.full:u.radius.md,display:"inline-flex",width:f,height:f,overflow:"hidden",alignItems:"center",justifyContent:"center",lineHeight:0,flex:"0 0 auto"}),P=css({width:"100%",height:"100%",display:"inline-flex",alignItems:"center",justifyContent:"center",objectFit:"cover",boxSizing:"border-box"});return jsxs("div",{role:"group",tabIndex:-1,"aria-label":"Avatar group",className:`plainframe-ui-avatar-group${l?` ${l}`:""}`,css:[m,r,d()],children:[x.map((w,v)=>{if(!isValidElement(w))return jsx("div",{className:"plainframe-ui-avatar-group-item",css:C(v),children:jsx("span",{css:P,children:w})},v);let N=w,B=N.props?.css,K=B==null?P:[P,B],O=cloneElement(N,{size:n,rounded:s,css:K,style:{...N.props?.style,width:"100%",height:"100%",objectFit:N.props?.objectFit??"cover"}});return jsx("div",{className:"plainframe-ui-avatar-group-item",css:C(v),children:O},v)}),R>0&&jsxs("span",{className:"plainframe-ui-avatar-group-extra",css:[css({marginLeft:5,fontSize:u.typography.sizes.sm,fontWeight:600,lineHeight:1,padding:"2px 1px",zIndex:2,color:u.text.secondary}),c],"aria-label":`+${R} more`,children:["+",R]})]})};var Li=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Ud=(e,t)=>{let n=e,o=n.palette||{},r=n.neutral||{};return t==="neutral"||t==="secondary"?{scale:r,onKey:"neutral"}:typeof t=="string"&&o[t]?{scale:o[t],onKey:t}:{scale:n.primary||r,onKey:"primary"}},qd=e=>e[600]??e[500]??e[400]??Object.values(e)[0]??"#000",Gd=(e,t,n,o)=>o??t[n]??t.primary??e.text?.primary??"#fff",Xd=(e,t,n)=>n==="dot"?"":typeof e=="number"&&typeof t=="number"&&e>t?`${t}+`:e??"",Yd=(e,t,n,o)=>e&&(t==="dot"||!!n||n===0&&o),Jd=me.memo(({content:e,color:t="primary",fontColor:n,fontWeight:o=600,fontSize:r,variant:s="dot",max:i=99,showZero:c=false,visible:a=true,anchorOrigin:l={vertical:"top",horizontal:"right"},overlap:u="rectangular",children:d,animate:y=true,size:f,outline:T=false,outlineColor:I,className:x,badgeClassName:R,css:g,badgeCss:p,offsetX:m,offsetY:C})=>{let P=V(),w=s==="dot",v=f??(w?8:17),N=r??(w?0:10),{scale:B,onKey:K}=Ud(P,t),O=qd(B),S=P.text?.onColors||{},F=Gd(P,S,K,n),M=Xd(e,i,s),b=Yd(a,s,e,c),h=css({position:"relative",display:"inline-block"}),A=u==="circular"?w?"12.5%":"5%":w?"5%":"2.5%",D=Li(m??A),L=Li(C??A),k=l.vertical||"top",E=l.horizontal||"right",W={},$="0",z="0";k==="center"?(W.top="50%",z="-50%"):k==="top"?(W.top=L,z="-45%"):(W.bottom=L,z="45%"),E==="center"?(W.left="50%",$="-50%"):E==="right"?(W.right=D,$="45%"):(W.left=D,$="-45%");let _=b?1:.8,H=css({minWidth:w?v:v/2,height:v,background:O,color:F,fontSize:typeof N=="number"?`${N}px`:N,fontWeight:o,borderRadius:999,padding:w?0:`0 ${v/4}px`,boxShadow:"0 2px 8px rgba(0,0,0,0.04)",lineHeight:1,position:"absolute",pointerEvents:"none",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",...T?{boxShadow:`0 0 0 2px ${I??P.surface?.appBg}`}:{},opacity:b?1:0,transform:`translate(${$}, ${z}) scale(${b?_:.5})`,...y?{transition:"opacity .18s cubic-bezier(.4,1.6,.6,1), transform .18s cubic-bezier(.4,1.6,.6,1)"}:{},...W});return jsxs("div",{className:["plainframe-ui-badge-wrapper",x||""].join(" ").trim(),css:[h,g],children:[d,jsx("span",{"aria-hidden":!b,className:["plainframe-ui-badge",R||""].join(" ").trim(),css:[H,p],children:M})]})});var Es=({on:e,onClickAway:t,blur:n=false,blurDepth:o=2.5,color:r,zIndex:s=1e3,css:i,contentCss:c,overlayCss:a,children:l,transitionDuration:u=300,keepMounted:d=true,className:y,contentClassName:f,lockScroll:T=true,...I})=>{let x=V(),R=useMemo(()=>r??x.surface.overlayBg,[r,x.surface.overlayBg]),[g,p]=useState(e),[m,C]=useState(e),P=useRef(null),w=useRef(null),v=useRef(null);useEffect(()=>(P.current&&(clearTimeout(P.current),P.current=null),w.current!=null&&(cancelAnimationFrame(w.current),w.current=null),e?(p(true),w.current=requestAnimationFrame(()=>{C(true),w.current=null;})):(C(false),P.current=setTimeout(()=>{p(false),P.current=null;},u)),()=>{P.current&&(clearTimeout(P.current),P.current=null),w.current!=null&&(cancelAnimationFrame(w.current),w.current=null);}),[e,u]),useEffect(()=>{if(!T||!e)return;let F=document.body,M=F.style.overflow,b=F.style.paddingRight,h=window.innerWidth-document.documentElement.clientWidth,A=parseFloat(getComputedStyle(F).paddingRight||"0");return F.style.overflow="hidden",h>0&&(F.style.paddingRight=`${A+h}px`),()=>{F.style.overflow=M,F.style.paddingRight=b;}},[e,T]),useEffect(()=>{if(!m||!t)return;let F=M=>{M.key==="Escape"&&t();};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[m,t]);let N=F=>{if(!m||!t||!v.current)return;let M=F.target;M&&!v.current.contains(M)&&t();},B=n&&o?typeof o=="number"?`${o}px`:o:void 0;if(!d&&!g)return null;let K=css({position:"fixed",inset:0,width:"100vw",height:"100vh",zIndex:s,display:"grid",placeItems:"center",pointerEvents:m?"auto":"none",visibility:g?"visible":"hidden"}),O=css({position:"absolute",inset:0,background:R,backdropFilter:B?`blur(${B})`:void 0,WebkitBackdropFilter:B?`blur(${B})`:void 0,opacity:m?1:0,transition:`opacity ${u}ms cubic-bezier(.4,0,.2,1)`,pointerEvents:m?"auto":"none"}),S=css({position:"relative",zIndex:1,pointerEvents:m?"auto":"none"});return jsxs("div",{"aria-hidden":!g||void 0,className:["plainframe-ui-backdrop",y||""].join(" ").trim(),css:[K,i],onPointerDown:N,...I,children:[jsx("div",{className:"plainframe-ui-backdrop-overlay",css:[O,a],role:"presentation"}),jsx("div",{ref:v,className:["plainframe-ui-backdrop-content",f||""].join(" ").trim(),css:[S,c],children:l})]})};var yr=()=>null;Object.defineProperty(yr,"displayName",{value:"PF.BreadCrumbItem",configurable:true});function np(e){let t=e.props??{};return {type:typeof t.__EMOTION_TYPE_PLEASE_DO_NOT_USE__<"u"?t.__EMOTION_TYPE_PLEASE_DO_NOT_USE__:e.type,props:t}}var op=me.memo(({children:e,separator:t="/",css:n,crumbCss:o,activeCrumbCss:r,inactiveCrumbCss:s,linkCrumbCss:i,separatorCss:c,hover:a=true,className:l,...u})=>{let d=V(),y=xe(),f=me.useMemo(()=>me.Children.toArray(e).flatMap(p=>{if(!me.isValidElement(p))return [];let{type:m,props:C}=np(p);if(!(m===yr||typeof m=="function"&&"displayName"in m&&m.displayName===yr.displayName))return [];let w=C;return [{href:w.href,disabled:w.disabled,node:w.children,className:w.className,css:w.css,onClick:w.onClick,startIcon:w.startIcon,endIcon:w.endIcon}]}),[e]),T=me.useMemo(()=>css({display:"flex",alignItems:"center",fontSize:d.typography.sizes.sm,fontWeight:500,gap:d.spacing.xs,cursor:"default"}),[d]),I=me.useMemo(()=>css({margin:"0 0.15rem",color:d.neutral[500],flex:"0 0 auto",justifyContent:"center",alignItems:"center",display:"flex"}),[d]),x=me.useCallback((p,m,C)=>{let P=p?d.text.primary:d.text.secondary,w=a&&m&&!C;return css({display:"inline-flex",alignItems:"center",gap:d.spacing.xs,color:P,cursor:m&&!C?"pointer":"default",textDecoration:"none",borderRadius:d.radius.xs,fontWeight:500,outline:"none",transition:"all .16s ease !important","&:hover":w?{textDecoration:"underline",color:d.text.primary}:{textDecoration:"none"}})},[d,a]),R=me.useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0}),[]),g=me.useMemo(()=>css({display:"inline-block"}),[]);return jsx("nav",{"aria-label":"Breadcrumb",className:["plainframe-ui-breadcrumbs",l||""].join(" ").trim(),css:[T,n],...u,children:f.map((p,m)=>{let C=m===f.length-1,P=!!p.href&&!p.disabled&&!C,w=["plainframe-ui-breadcrumb",C?"plainframe-ui-breadcrumb--active":"plainframe-ui-breadcrumb--inactive",P?"plainframe-ui-breadcrumb--link":"",p.className||""].join(" ").trim(),v=[x(C,P,p.disabled),o,C?r:s,P?i:void 0,y(),p.css],N=jsxs(Fragment,{children:[p.startIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-start",css:R,children:p.startIcon}),jsx("span",{className:"plainframe-ui-breadcrumb-label",css:g,children:p.node}),p.endIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-end",css:R,children:p.endIcon})]});return jsxs(me.Fragment,{children:[m!==0&&jsx("span",{className:"plainframe-ui-breadcrumb-separator",css:[I,c],children:t}),P?jsx("a",{href:p.href,onClick:p.onClick,tabIndex:0,"data-active":C?"true":"false","data-link":"true",className:w,css:v,children:N}):jsx("span",{"aria-current":C?"page":void 0,tabIndex:C?-1:0,"data-active":C?"true":"false","data-link":"false",className:w,css:v,children:N})]},m)})})});var ks=(e,t)=>{if(!isValidElement(e))return e;let n=e.props,o={};return n.size===void 0&&(o.size=t),n.color===void 0&&(o.color="currentColor"),cloneElement(e,{...n,...o})},Is=e=>typeof e=="number"?`${e}px`:e,Oi=e=>{let t=false;return me.Children.forEach(e,n=>{t||(typeof n=="string"||typeof n=="number"?String(n).trim()!==""&&(t=true):Array.isArray(n)&&Oi(n)&&(t=true));}),t};function ip(e,t){let n=e,o=typeof t=="string"&&(t==="sm"||t==="md"||t==="lg")?t:"md";return o==="sm"?{fontSize:n.typography.sizes.sm,paddingY:n.spacing.xs,paddingX:n.spacing.md,paddingXIcon:n.spacing.md,iconSize:14,minHeight:n.componentHeights.sm,radius:n.radius.sm}:o==="lg"?{fontSize:n.typography.sizes.md,paddingY:n.spacing.sm,paddingX:n.spacing.lg,paddingXIcon:n.spacing.md,iconSize:18,minHeight:n.componentHeights.lg,radius:n.radius.md}:{fontSize:n.typography.sizes.sm,paddingY:n.spacing.sm,paddingX:n.spacing.lg,paddingXIcon:n.spacing.md,iconSize:16,minHeight:n.componentHeights.md,radius:n.radius.md}}function lp(e,t){let n=e.neutral,o=e.text,r=e.palette,s=r.primary||n,i=r.danger||r.error||s,c=e.text.onColors||{},a=c.primary??o.onColors.primary,l=c.danger??a,u=(d,y,f)=>d&&d[y]||f;if(t==="primary"){let d=s,y=u(d,600,n[900])||u(d,500,n[900]),f=u(d,500,n[800])||u(d,600,n[800]);return {bg:y,fg:a,hoverBg:f,border:"none"}}if(t==="destructive"){let d=i,y=u(d,600,n[900])||u(d,500,n[900]),f=u(d,500,n[800])||u(d,600,n[800]);return {bg:y,fg:l,hoverBg:f,border:"none"}}return t==="ghost-destructive"?{bg:"transparent",fg:i[700],hoverBg:e.palette.danger[50],border:"none"}:t==="subtle"?{bg:e.surface.subtleBg,fg:o.primary,hoverBg:e.surface.subtleHover,border:"none"}:t==="outlined"?{bg:e.surface.panelBg,fg:o.primary,hoverBg:e.surface.panelHover,border:`${e.componentHeights.border} solid ${e.surface.border}`}:t==="ghost"?{bg:"transparent",fg:e.text.primary,hoverBg:e.surface.subtleBg,border:"none"}:t==="quiet"?{bg:"transparent",fg:o.secondary,hoverBg:e.surface.subtleBg,border:"none"}:{bg:"transparent",fg:o.secondary,hoverBg:e.surface.subtleBg,border:"none"}}var Wi=me.memo(me.forwardRef(({variant:e="primary",size:t="md",startIcon:n,endIcon:o,rounded:r=false,fullWidth:s=false,disabled:i=false,loading:c=false,loadingIndicator:a,loadingPosition:l="center",children:u,className:d,hoverEffect:y=true,icon:f,onClick:T,css:I,...x},R)=>{let g=V(),p=xe(),m=useMemo(()=>ip(g,t),[g,t]),C=useMemo(()=>lp(g,e),[g,e]),P=useMemo(()=>f===true?true:f===false?false:!n&&!o&&!Oi(u)&&me.Children.count(u)===1,[f,n,o,u]),w=m.iconSize,v=useMemo(()=>ks(n,w),[n,w]),N=useMemo(()=>ks(o,w),[o,w]),B=useMemo(()=>a??jsx(no,{color:C.fg,variant:"circular",size:14,thickness:5}),[a,C]),K=useMemo(()=>P?"center":l??"center",[P,l]),O=!!c&&K==="center",S=!!c&&K==="start",F=!!c&&K==="end",M=i||c,b=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",gap:0,width:s?"100%":"auto",minHeight:m.minHeight,lineHeight:1,fontWeight:600,cursor:M?"not-allowed":"pointer",opacity:M?.5:1,userSelect:"none",position:"relative",borderRadius:r?g.radius.full:m.radius,outline:"none",willChange:"box-shadow, transform, outline-offset",transition:"box-shadow 140ms ease, transform 90ms ease, outline-offset 140ms ease"}),[s,m,r,g,M]),h=useMemo(()=>css({backgroundColor:C.bg,color:C.fg,border:C.border}),[C]),A=useMemo(()=>css({overflow:"hidden","::before":{content:'""',position:"absolute",inset:0,backgroundColor:C.hoverBg,opacity:0,pointerEvents:"none",transition:"opacity 140ms ease",zIndex:0},"@media (hover: hover) and (pointer: fine)":y&&!M?{":hover::before":{opacity:1}}:{}}),[C,y,M]),D=useMemo(()=>css(P&&!s?{width:"100%",height:"100%",maxWidth:m.minHeight,minWidth:m.minHeight,maxHeight:m.minHeight,display:"flex",alignItems:"center",justifyContent:"center",fontSize:Is(m.iconSize)}:{fontSize:Is(m.fontSize),padding:n||o?`${m.paddingY} ${m.paddingXIcon}`:`${m.paddingY} ${m.paddingX}`}),[P,s,m,n,o]),L=useMemo(()=>css({position:"relative",zIndex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:Is(g.spacing.sm),opacity:O?0:1,transition:"opacity 140ms ease"}),[g,O]),k=useMemo(()=>css({height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}),[]),E=useMemo(()=>typeof m.iconSize=="number"?m.iconSize:Math.max(12,Math.round(parseFloat(String(m.iconSize))||16)),[m.iconSize]),W=useMemo(()=>css({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:E,minWidth:E,maxWidth:E,height:"1em"}),[E]),$=useMemo(()=>X=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:X?1:0,transition:"opacity 140ms ease"}),[]),z=useMemo(()=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:O?1:0,pointerEvents:"none",zIndex:2,transition:"opacity 140ms ease"}),[O]),_=useMemo(()=>()=>{if(P)return null;let X=!!n;return !X&&!S?null:jsxs("span",{css:W,"aria-hidden":c?true:void 0,children:[jsx("span",{css:$(!S),children:X?v||n:null}),jsx("span",{css:$(!!S),children:B})]})},[P,n,S,W,$,v,c,B]),H=useMemo(()=>()=>{if(P)return null;let X=!!o;return !X&&!F?null:jsxs("span",{css:W,"aria-hidden":c?true:void 0,children:[jsx("span",{css:$(!F),children:X?N||o:null}),jsx("span",{css:$(!!F),children:B})]})},[P,o,F,W,$,N,c,B]),U=!(i||c);return jsxs("button",{ref:R,type:"type"in x&&x.type?x.type:"button","data-variant":e,className:["plainframe-ui-button",d||""].join(" ").trim(),css:[b,p({color:e==="primary"?"primary":e==="destructive"||e==="ghost-destructive"?"danger":"neutral"}),h,A,D,I],onClick:U?T:void 0,disabled:i||void 0,tabIndex:c?-1:void 0,"aria-disabled":i||void 0,"aria-busy":c||void 0,...x,children:[jsxs("span",{className:"plainframe-ui-button-content",css:L,children:[_(),jsx("span",{className:"plainframe-ui-button-label",css:k,children:P?c?B:ks(u,m.iconSize):u}),H()]}),jsx("span",{className:"plainframe-ui-button-center-overlay",css:z,"aria-hidden":"true",children:O?B:null})]})}));Wi.displayName="Button";var Rr=e=>isValidElement(e),cp=e=>{let t=e.type;return t.displayName??t.name},As=(e,t)=>cp(e)===t,ji=e=>As(e,"ButtonGroup"),Vi=e=>As(e,"DropdownMenu"),Ms=e=>As(e,"DropdownMenuTrigger"),Kn=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,up=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,dp=e=>typeof e=="string"&&/^(outlined|outlined-soft|outline-soft)$/i.test(e),Fs=(e,t)=>{if(!Rr(e))return null;if(ji(e)){let n=Children.toArray(e.props.children).filter(isValidElement);return n.length?Fs(t?n[0]:n[n.length-1],t):null}if(Vi(e)){let o=Children.toArray(e.props.children).filter(isValidElement).find(Ms);return o?Fs(o,t):null}if(Ms(e)){let n=Children.toArray(e.props.children??[]).filter(isValidElement);return n.length?n[0]:null}return e},_i=(e,t)=>{if(!e)return false;let n=Fs(e,t==="left"),o=n&&n.props&&typeof n.props=="object"?n.props.variant:void 0;return dp(o)},Ui=me.memo(me.forwardRef(function({children:t,attached:n=false,direction:o="horizontal",fullWidth:r=false,disabled:s=false,size:i="md",rounded:c=false,gap:a,width:l,className:u,role:d="group",css:y,__clipLeft:f,__clipRight:T,...I},x){let R=V(),g=i==="sm"?R.radius.sm:R.radius.md,p=c?R.radius.full:g,m=o==="vertical",C=up(R.componentHeights.border,1),P=R.surface.border,w=n&&!!f,v=n&&!!T,N=css({display:"flex",flexDirection:m?"column":"row",width:r?"100%":l!=null?Kn(l):"auto",maxWidth:"none",backgroundColor:"transparent",gap:n?0:Kn(a??R.spacing.sm)}),B=Children.toArray(t),O=B.filter(Rr).length,S=0,F=false,M=[];for(let b of B){if(!Rr(b)){M.push(b);continue}let h=S===0,A=S===O-1,D=b.props??{},L=D.disabled??s,k=D.size??i,E=0,W=0,$=0,z=0;n&&(m?(E=h?w?0:p:0,W=h?v?0:p:0,z=A?w?0:p:0,$=A?v?0:p:0):(E=h?w?0:p:0,z=h?w?0:p:0,W=A?v?0:p:0,$=A?v?0:p:0));let _=_i(b,"left"),H=_i(b,"right"),ae=n&&!h&&!(F&&_)&&!(F||_)?css({[m?"borderTop":"borderLeft"]:`${C} solid ${P}`}):null,q=n&&!h&&F&&_?css(m?{borderTopWidth:0}:{borderLeftWidth:0}):null,Y=n?css({borderTopLeftRadius:Kn(E),borderTopRightRadius:Kn(W),borderBottomRightRadius:Kn($),borderBottomLeftRadius:Kn(z)}):null,le=r?css({flex:"1 1 0%",minWidth:0,width:"100%"}):null,ie=css([Y,ae,q,le]);if(!Vi(b)){let Ce=D.css,Ie=[D.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" "),Te=ji(b)&&n?{__clipLeft:!h,__clipRight:!A}:{},we=cloneElement(b,{...D,disabled:L,size:k,className:Ie,css:[Ce,ie],...Te});M.push(we),F=H,S+=1;continue}let be=D.children,Pe=Children.map(be,Ce=>{if(!Rr(Ce)||!Ms(Ce))return Ce;let Ie=Ce.props,Te=[Ie.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" ");return cloneElement(Ce,{...Ie,css:[Ie.css,ie],className:Te,disabled:L,size:k})}),Re=cloneElement(b,{...D,children:Pe});M.push(Re),F=H,S+=1;}return jsx("div",{ref:x,role:d,"aria-orientation":m?"vertical":"horizontal","data-attached":n||void 0,"data-direction":o,className:["plainframe-ui-button-group",u||""].join(" ").trim(),css:[N,y],...I,children:M})}));Ui.displayName="ButtonGroup";var Tr=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,hp=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.spacing??t.space;return Tr(n?.[e]??e)}}},yp=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.radius??t.radii;return Tr(n?.[e]??e)}}},xp=(e,t)=>{let n=t.surface??{};return e==="panel"||e==="outlined"?n.panelBg??"transparent":e==="subtle"?n.subtleBg??"transparent":"transparent"},vp=(e,t,n)=>{let o=t.surface??{};return e==="panel"||e==="outlined"?o.panelHover??o.panelBg??n:e==="subtle"?o.subtleHover??o.subtleBg??n:o.subtleBg??n},_n=me.memo(forwardRef(function({children:t,css:n,variant:o="ghost",padding:r,radius:s,className:i,hoverable:c,selectable:a,selected:l,defaultSelected:u,onSelectedChange:d,width:y,height:f,onClick:T,onKeyDown:I,role:x,tabIndex:R,...g},p){let m=V(),C=m.surface??{},[P,w]=useState(!!u),v=l!=null,N=v?!!l:P,B=useMemo(()=>xp(o,m),[o,m]),K=useMemo(()=>vp(o,m,B),[o,m,B]),O=K,S=useMemo(()=>hp(r,m),[r,m]),F=useMemo(()=>yp(s,m),[s,m]),M=!!c||!!a,b=useMemo(()=>css({backgroundColor:B,padding:S,borderRadius:F,border:o==="outlined"?`${m.componentHeights?.border??"1px"} solid ${C.border??"transparent"}`:void 0,backgroundClip:"padding-box",boxSizing:"border-box",width:y?"100%":void 0,maxWidth:Tr(y),height:Tr(f),outline:"none",transition:"background-color .16s ease, border-color .16s ease",cursor:M?"pointer":void 0,...M?{"&:hover":{backgroundColor:K}}:{},'&[data-selected="true"]':{backgroundColor:O},...M?{'&[data-selected="true"]:hover':{backgroundColor:O}}:{}}),[B,S,F,o,m.componentHeights,C.border,y,f,M,K,O]),h=useCallback(()=>{if(!a)return;let k=!N;v||w(k),d?.(k);},[v,d,a,N]),A=useCallback(k=>{a&&h(),T?.(k);},[a,h,T]),D=useCallback(k=>{a&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),h()),I?.(k);},[a,h,I]),L=xe();return jsx("div",{ref:p,"data-variant":o,"data-selected":a&&N?"true":void 0,"aria-pressed":a?N:void 0,className:["plainframe-ui-container",i||""].join(" ").trim(),css:[L(),b,n],onClick:A,onKeyDown:D,role:a?x??"button":x,tabIndex:a?R??0:R,...g,children:t})}));_n.displayName="Container";var Rp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Ns(e,t){if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.spacing??t.space;if(n&&e in n){let o=n[e];return Rp(o)}return e}}}function yo(e){switch(e){case "center":return "center";case "end":return "flex-end";case "start":default:return "flex-start"}}function Ds(e){switch(e){case "center":return "center";case "end":return "right";case "start":default:return "left"}}function Tp(e,t){if(e==null)return t.spacing?.md??void 0;if(typeof e=="number")return e;if(typeof e=="string"){let n=t.spacing??t.space??{};return e in n?n[e]:e}}function xo(e,t,n,o){let r=Ns(t,e),s=Ns(n,e),i=Ns(o,e),c={};return r&&!s&&!i&&(c.padding=r),s&&(c.paddingLeft=s,c.paddingRight=s),i&&(c.paddingTop=i,c.paddingBottom=i),c}function qi(e,t){if(t)return t==="primary"?e.text?.primary:t==="secondary"?e.text?.secondary:t}var Gi=me.createContext("horizontal"),Hs=()=>me.useContext(Gi),Xi=me.memo(me.forwardRef(({children:e,css:t,variant:n="ghost",padding:o="md",radius:r="lg",hoverable:s,selectable:i,selected:c,defaultSelected:a,onSelectedChange:l,width:u="100%",height:d,gap:y,direction:f="horizontal",className:T,onClick:I,...x},R)=>{let g=V(),p=xe(),m=f==="vertical",C=css({position:"relative",display:"flex",flexDirection:m?"column":"row",gap:Tp(y,g),alignItems:m?"stretch":"center",transition:"all .16s ease"});return jsx(Gi.Provider,{value:f,children:jsx(_n,{ref:R,variant:n,padding:o,radius:r,hoverable:s,selectable:i,selected:c,defaultSelected:a,onSelectedChange:l,width:u,height:d,className:["plainframe-ui-card",T||""].join(" ").trim(),css:[p(),C,t],onClick:I,tabIndex:I?0:void 0,...x,children:e})})}));Xi.displayName="Card";var wp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,...c})=>{let a=V(),u=Hs()==="vertical",d=css({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:yo(o),textAlign:Ds(o),...u?{width:"100%"}:{flex:1,minWidth:0},...xo(a,r,s,i)});return jsx("div",{"data-slot":"card-content",className:["plainframe-ui-card-content",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Ep=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,...c})=>{let a=V(),u=Hs()==="vertical",d=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...u?{width:"100%"}:{},...xo(a,r,s,i)});return jsx("div",{"data-slot":"card-start",className:["plainframe-ui-card-start",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),kp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,...c})=>{let a=V(),u=Hs()==="vertical",d=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...u?{width:"100%"}:{},gap:a.spacing.xs,color:a.text.secondary,...xo(a,r,s,i)});return jsx("div",{"data-slot":"card-end",className:["plainframe-ui-card-end",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Ip=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,weight:c,size:a,color:l,...u})=>{let d=V(),y=css({fontWeight:c??500,fontSize:a??(d.typography?.sizes?.sm!==void 0?d.typography.sizes.sm:"1rem"),color:qi(d,l)??d.text?.primary,textAlign:Ds(o),...xo(d,r,s,i),display:"flex",alignItems:"center",gap:d.spacing?.xs??6});return jsx("div",{"data-slot":"card-title",className:["plainframe-ui-card-title",n||""].join(" ").trim(),css:[y,t],...u,children:e})}),Sp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:i,weight:c,size:a,color:l,...u})=>{let d=V(),y=css({fontWeight:c??400,fontSize:a??(d.typography?.sizes?.sm!==void 0?d.typography.sizes.sm:"0.875rem"),color:qi(d,l)??d.text?.secondary,marginTop:d.spacing?.xxs??2,textAlign:Ds(o),...xo(d,r,s,i)});return jsx("div",{"data-slot":"card-description",className:["plainframe-ui-card-description",n||""].join(" ").trim(),css:[y,t],...u,children:e})});var Ji=e=>isValidElement(e),Pp=e=>Ji(e)?e.type?.displayName||e.type?.name:void 0,Yi=e=>Pp(e)==="Card",Np=e=>typeof e=="number"?`${e}px`:e,Zi=({children:e,attached:t=false,gap:n,width:o,direction:r="vertical",variant:s,className:i,role:c="group",css:a})=>{let l=V(),u=r==="vertical",d=String(l.componentHeights?.border??"1px"),y=l.surface.border,f={display:"flex",flexDirection:u?"column":"row",width:typeof o=="string"||typeof o=="number"?Np(o):"auto",maxWidth:"none",gap:t?0:n??l.spacing?.sm},T=Children.toArray(e),x=T.filter(Yi).length,R=0,g=T.map((p,m)=>{if(!Yi(p)||!Ji(p))return p;let C=p.props,P=R++,w=P===0,v=P===x-1,N=s??C.variant,B=t?u?{borderTopLeftRadius:w?C.radius:0,borderTopRightRadius:w?C.radius:0,borderBottomLeftRadius:v?C.radius:0,borderBottomRightRadius:v?C.radius:0}:{borderTopLeftRadius:w?C.radius:0,borderBottomLeftRadius:w?C.radius:0,borderTopRightRadius:v?C.radius:0,borderBottomRightRadius:v?C.radius:0}:void 0,K=t&&!w?u?{borderTopWidth:0}:{borderLeftWidth:0}:void 0,O=N==="subtle"&&x>1&&!w?u?{borderTop:`${d} solid ${y}`}:{borderLeft:`${d} solid ${y}`}:null,F=[B,K,O,t?{width:"100%"}:{width:"100%",marginBottom:u?0:void 0,marginRight:u?void 0:0}].filter(Boolean),M=[C.className,"plainframe-ui-card-group-item"].filter(Boolean).join(" ");return cloneElement(p,{...C,variant:N??C.variant,css:[C.css,...F],className:M,key:typeof p=="object"&&"key"in p?p.key:m})});return jsx("div",{role:c,"aria-orientation":u?"vertical":"horizontal","data-attached":t||void 0,"data-direction":r,className:["plainframe-ui-card-group",i||""].join(" ").trim(),css:[f,a],children:g})};Zi.displayName="CardGroup";var Le=e=>typeof e=="number"?`${e}px`:e,el=e=>{let t=false;return me.Children.forEach(e,n=>{t||(typeof n=="string"||typeof n=="number"?String(n).trim()!==""&&(t=true):Array.isArray(n)&&el(n)&&(t=true));}),t},Bp=(e,t)=>t==="sm"?{fontSize:e.typography.sizes.xs,paddingX:`calc(${e.spacing.sm} * 0.7)`,paddingY:e.spacing.xs,gap:e.spacing.xxs,iconSize:e.typography.sizes.xs,radius:`calc(${e.radius.sm} * 0.8)`,soloPadding:e.spacing.xs,iconOffset:"0px",iconOffsetRounded:"-2px"}:t==="lg"?{fontSize:e.typography.sizes.md,paddingX:e.spacing.sm,paddingY:`calc(${e.spacing.sm} * 0.6)`,gap:e.spacing.xs,iconSize:e.typography.sizes.md,radius:e.radius.md,soloPadding:e.spacing.sm,iconOffset:"0px",iconOffsetRounded:"-3px"}:{fontSize:e.typography.sizes.sm,paddingX:`calc(${e.spacing.sm} * 0.9)`,paddingY:e.spacing.xs,gap:e.spacing.xxs,iconSize:e.typography.sizes.sm,radius:e.radius.sm,soloPadding:e.spacing.xs,iconOffset:"-1px",iconOffsetRounded:"-3px"},tl=me.memo(forwardRef(function({children:t,labelCss:n,variant:o="soft",color:r="primary",rounded:s=false,startIcon:i,endIcon:c,size:a="md",onClick:l,onDelete:u,deleteIcon:d,disabled:y,cursor:f,className:T,css:I},x){let R=V(),g=xe(),p=["sm","md","lg"].includes(a)?a:"md",m=useMemo(()=>Bp(R,p),[R,p]),C=!!l&&!y,P=y?"not-allowed":f||(C?"pointer":"inherit"),w=String(R.componentHeights?.border??"1px"),v=useMemo(()=>{let X=R.palette;return r==="secondary"||r==="neutral"?"neutral":r&&X[r]?r:"primary"},[r,R.palette]),N=useCallback(X=>{let ae=R.palette;return (v==="neutral"?R.neutral[X]:ae[v]?.[X])??ae.primary?.[X]},[v,R.neutral,R.palette]),B=useMemo(()=>v==="neutral"?R.neutral[100]:N(50),[v,N,R.neutral]),K=useMemo(()=>v==="neutral"?R.text.secondary:N(800),[v,N,R.text.secondary]),O=useMemo(()=>v==="neutral"?R.neutral[100]:N(50),[v,N,R.neutral]),S=useMemo(()=>v==="neutral"?R.text.secondary:N(800),[v,N,R.text.secondary]),F=useMemo(()=>v==="neutral"?R.neutral[400]:N(300),[v,N,R.neutral]),M=useMemo(()=>v==="neutral"?R.surface.subtleBg:N(600),[v,N,R.surface.subtleBg]),b=useMemo(()=>(R.text.onColors??{})[v]??(v==="neutral"?R.neutral[900]:R.neutral[0]??"#fff"),[v,R.text.onColors,R.neutral]),h="transparent",A=useMemo(()=>v==="neutral"?R.text.secondary:N(700)??R.text.primary,[v,N,R.text.primary,R.text.secondary]),D=useMemo(()=>!i&&!c&&t!=null&&!el(t)&&me.Children.count(t)===1,[i,c,t]),L=useMemo(()=>o==="filled"?css({backgroundColor:M,color:b,border:"none",boxShadow:"none"}):o==="outlined"?css({backgroundColor:O,color:S,border:"none",boxShadow:`inset 0 0 0 ${w} ${F}`}):o==="ghost"?css({backgroundColor:h,color:A,border:"none",boxShadow:"none"}):css({backgroundColor:B,color:K,border:"none",boxShadow:"none"}),[M,b,A,O,S,F,B,K,w,o]),k=useMemo(()=>css({display:"inline-flex",alignItems:"center",gap:Le(m.gap),padding:o==="ghost"?0:D||t==null?Le(m.soloPadding):`${Le(m.paddingY)} ${Le(m.paddingX)}`,borderRadius:s?R.radius.full:m.radius,fontWeight:600,cursor:P,opacity:y?.55:1,transition:"outline .16s ease, outline-offset .16s ease",overflow:o==="ghost"?"visible":"hidden",...D?{lineHeight:1,minWidth:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,minHeight:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,justifyContent:"center"}:null}),[m,P,t,y,D,s,R.radius.full,o]),E=useMemo(()=>css({fontSize:Le(D?m.iconSize:m.fontSize),lineHeight:1.2,minWidth:0,display:"inline-flex",alignItems:"center",justifyContent:"center","& > svg":{width:D?Le(m.iconSize):void 0,height:D?Le(m.iconSize):void 0,display:D?"block":void 0}}),[m.fontSize,m.iconSize,D]),W=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:Le(m.iconSize),lineHeight:0,"& > svg":{width:Le(m.iconSize),height:Le(m.iconSize),display:"block"}}),[m.iconSize]),$=useMemo(()=>css({marginRight:D||t==null?0:Le(m.gap),marginLeft:D||t==null?0:Le(m.iconOffset)}),[m.gap,m.iconOffset,t,D]),z=useMemo(()=>css({marginLeft:D||t==null?0:Le(m.gap),marginRight:D||t==null?0:Le(s?m.iconOffsetRounded:m.iconOffset)}),[m.gap,m.iconOffset,m.iconOffsetRounded,t,D,s]),_=useMemo(()=>css({marginRight:s?0:Le(m.iconOffset),padding:0,border:"none",outline:"none",background:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:y?"not-allowed":"pointer",color:"currentColor",opacity:y?.4:.85,transition:"background-color .16s ease, color .16s ease, opacity .16s ease, outline .16s ease, outline-offset .16s ease",fontSize:Le(m.iconSize),borderRadius:R.radius.xs}),[m.iconOffset,m.iconSize,y,s,R.radius.xs]),H=useCallback(X=>{C&&(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),l?.());},[C,l]),U=useMemo(()=>jsx(X,{css:{width:m.iconSize,height:m.iconSize},strokeWidth:2.5}),[m.iconSize]);return jsxs("div",{ref:x,className:["plainframe-ui-chip",C?"plainframe-ui-chip-clickable":"",T||""].join(" ").trim(),css:[k,L,C?g({color:r??"primary"}):null,I],onClick:C?l:void 0,onKeyDown:H,role:C?"button":void 0,tabIndex:C?0:void 0,"aria-disabled":y||void 0,"data-variant":o,"data-color":v,"data-size":a,"data-icon-only":D||void 0,children:[i&&jsx("span",{css:[W,$],className:"plainframe-ui-chip-icon-left",children:i}),t!=null&&jsx("span",{css:[E,n],className:"plainframe-ui-chip-label",children:t}),c&&jsx("span",{css:[W,z],className:"plainframe-ui-chip-icon-right",children:c}),u&&jsx("button",{type:"button","aria-label":"Delete",disabled:y,tabIndex:0,onClick:X=>{X.stopPropagation(),y||u?.();},css:[_,g({color:r??"primary"})],className:"plainframe-ui-chip-delete",children:d||U})]})}));tl.displayName="Chip";var Wp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Kp=me.memo(function({value:t,onChange:n,len:o,theme:r,sizeKey:s,s:i,variant:c,error:a,disabled:l,ringEnabled:u,focusRingMode:d,placeholder:y,separator:f,gapPx:T}){let I=xe(),x=r.neutral,R=r.text,g=r.componentHeights.border,p=useRef([]),[m,C]=useState(0),P=useMemo(()=>(t??"").padEnd(o,"").slice(0,o).split(""),[t,o]),w=useMemo(()=>{if(!y)return Array(o).fill("");if(y.length===1)return Array(o).fill(y);let D=y.slice(0,o).split("");for(;D.length<o;)D.push("");return D},[y,o]),v=useMemo(()=>{let D=r.componentHeights[s];return `calc(${typeof D=="number"?`${D}px`:D} * 1.5)`},[r.componentHeights,s]),N=l?x[200]:a&&c==="outlined"?r.palette.danger?.[50]??r.surface.panelBg:a&&c==="subtle"?r.palette.danger?.[50]??r.surface.subtleBg:c==="subtle"?r.surface.subtleBg:c==="outlined"?r.surface.panelBg:"transparent",B=c==="outlined"?`${g} solid ${a?r.palette.danger?.[300]??r.surface.border:r.surface.border}`:"none",K=D=>css({width:v,height:v,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",background:N,border:B,borderRadius:r.radius.lg,transition:"box-shadow .16s, border-color .16s, background .16s",fontSize:i.codeFontSize,fontWeight:600,color:l?x[500]:a?r.palette.danger?.[800]??R.primary:R.primary,textAlign:"center",backgroundClip:"padding-box",appearance:"textfield",outline:"none",caretColor:a?r.palette.danger?.[800]??R.primary:R.primary,"&::placeholder":{color:a?r.palette.danger?.[700]??R.secondary:R.secondary,opacity:.85}},u?I({enabled:true,disabled:l,mode:d==="always"?"always":"visible",color:a?"danger":void 0}):void 0,D?css({}):null),O=css({display:"flex",gap:T,justifyContent:"center",width:"auto",pointerEvents:l?"none":"auto",opacity:l?.65:1}),S=css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:R.secondary,userSelect:"none"}),F=D=>D.replace(/[^a-zA-Z0-9]/g,"").toUpperCase(),M=useCallback(D=>{let L=Math.max(0,Math.min(o-1,D));C(L),p.current[L]?.focus();},[o]),b=useCallback((D,L)=>{let k=F(L).slice(0,1),E=[...P];E[D]=k,n(E.join("")),k&&D<o-1&&M(D+1);},[P,o,n,M]),h=useCallback((D,L)=>{if(L.key==="Backspace")if(!P[D]&&D>0){let k=[...P];k[D-1]="",n(k.join("")),M(D-1),L.preventDefault();return}else {let k=[...P];k[D]="",n(k.join(""));return}if(L.key==="ArrowLeft"&&D>0){L.preventDefault(),M(D-1);return}if(L.key==="ArrowRight"&&D<o-1){L.preventDefault(),M(D+1);return}if(L.key==="Home"){L.preventDefault(),M(0);return}if(L.key==="End"){L.preventDefault(),M(o-1);return}},[P,o,n,M]),A=useCallback(D=>{let L=F(D.clipboardData.getData("text")).slice(0,o);L&&(n(L),requestAnimationFrame(()=>{let k=Math.min(L.length,o-1);M(k);}),D.preventDefault());},[o,n,M]);return jsx("div",{className:"plainframe-ui-code-boxes",css:O,children:Array.from({length:o}).map((D,L)=>jsxs(me.Fragment,{children:[jsx("input",{ref:k=>{p.current[L]=k;},type:"text",inputMode:"text",maxLength:1,value:P[L]||"",placeholder:P[L]?"":w[L]||"",disabled:l,onChange:k=>b(L,k.target.value),onKeyDown:k=>h(L,k),onFocus:()=>C(L),onPaste:L===0?A:void 0,className:"plainframe-ui-code-box",css:K(L===m),"aria-label":`Code character ${L+1}`,tabIndex:L===m?0:-1}),f&&L<o-1?jsx("span",{"aria-hidden":true,role:"presentation",css:S,children:f}):null]},L))})}),_p=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,separator:s,error:i,helperText:c,disabled:a=false,gap:l,size:u="md",variant:d="subtle",length:y=4,focusRingMode:f="always",className:T,wrapperCss:I,labelCss:x,helperRowCss:R,helperTextCss:g,css:p})=>{let m=V(),C=useId(),P=useMemo(()=>({sm:{labelFont:m.typography.sizes.xs,helperFont:m.typography.sizes.xs,minHeight:m.componentHeights.sm,paddingY:0,paddingX:m.spacing.md,codeFontSize:21},md:{labelFont:m.typography.sizes.sm,helperFont:m.typography.sizes.xs,minHeight:m.componentHeights.md,paddingY:0,paddingX:m.spacing.md,codeFontSize:24},lg:{labelFont:m.typography.sizes.md,helperFont:m.typography.sizes.sm,minHeight:m.componentHeights.lg,paddingY:0,paddingX:m.spacing.md,codeFontSize:28}}),[m]),w=["sm","md","lg"].includes(u)?u:"md",v=P[w],N=m.neutral,B=m.text,K=t!=null,[O,S]=useState(n),F=K?t:O,M=$=>{K||S($),o?.($);},b=Math.max(2,Math.min(y,10)),h=m.spacing.sm,A=Wp(l??h)??"0px",D=css({boxSizing:"border-box",display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"auto",maxWidth:"unset",fontWeight:500,cursor:a?"not-allowed":"auto"},...Array.isArray(I)?I:I?[I]:[]),L=css({fontSize:v.labelFont,fontWeight:500,color:i?m.palette.danger?.[700]??B.primary:a?N[500]:B.primary,marginBottom:4,display:"block",cursor:a?"not-allowed":"auto"},...Array.isArray(x)?x:x?[x]:[]),k=css({display:"flex",alignItems:"center",justifyContent:"center",gap:A,width:"auto",background:"transparent",outline:"none",boxShadow:"none"},...Array.isArray(p)?p:p?[p]:[]),E=css({minHeight:16,fontSize:v.helperFont,color:i?m.palette.danger?.[700]??B.secondary:B.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Array.isArray(R)?R:R?[R]:[]),W=css({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400,color:i?m.palette.danger?.[700]??B.primary:a?N[500]:B.primary},...Array.isArray(g)?g:g?[g]:[]);return jsxs("div",{className:["plainframe-ui-codefield",T||""].join(" ").trim(),css:D,children:[e&&jsx("span",{id:C,className:"plainframe-ui-codefield-label",css:L,children:e}),jsx("div",{className:"plainframe-ui-codefield-row",css:k,role:"group","aria-labelledby":e?C:void 0,tabIndex:-1,children:jsx(Kp,{value:F||"",onChange:M,len:b,theme:m,sizeKey:w,s:{codeFontSize:v.codeFontSize},variant:d,error:!!i,disabled:a,ringEnabled:f!=="none",focusRingMode:f,placeholder:r,separator:s,gapPx:A})}),c!=null&&jsx("div",{className:"plainframe-ui-codefield-helper",css:E,children:jsx("span",{className:"plainframe-ui-codefield-helper-text",css:W,children:c})})]})};var al=e=>{if(typeof e=="object"&&e!==null&&"type"in e&&e.type){let t=e.type;return (typeof t=="object"&&t!==null||typeof t=="function")&&(t?.displayName||t?.name)||""}return ""},Bs=e=>{if(!e||typeof e!="object")return false;let t=al(e);if(t==="DropdownMenu"||t==="DropdownMenuContent")return true;let n=e?.props,o=n&&typeof n=="object"&&n!==null&&"children"in n?n.children:void 0;return o==null?false:Array.isArray(o)?o.some(Bs):Bs(o)},Vp=({children:e,content:t,trigger:n="contextmenu",onOpenChange:o,hoverPosition:r="cursor",hoverOffset:s=10})=>{let i=me.useRef(null),[c,a]=me.useState(false),l=me.useCallback(E=>{a(E),o?.(E);},[o]),u=me.useCallback(()=>l(false),[l]),d=me.useRef({x:0,y:0}),y=me.useRef(null),f=me.useRef(null),T=me.useCallback(()=>{f.current=null;let E=y.current;if(!E)return;let W=Math.round(d.current.x),$=Math.round(d.current.y);E.style.transform=`translate3d(${W}px, ${$}px, 0)`;},[]),I=me.useCallback(()=>{f.current==null&&(f.current=requestAnimationFrame(T));},[T]);me.useEffect(()=>()=>{f.current&&cancelAnimationFrame(f.current);},[]);let x=me.useMemo(()=>({getBoundingClientRect:()=>{let E=Math.round(d.current.x),W=Math.round(d.current.y);return {x:E,y:W,left:E,top:W,right:E,bottom:W,width:0,height:0,toJSON:()=>({x:E,y:W})}}}),[]),R=me.useRef(`cz-${Math.random().toString(36).slice(2)}`),g=me.useCallback(()=>typeof document<"u"?document.querySelector(`[data-cz-id="${R.current}"]`):null,[]),p=me.useRef(null),m=me.useRef(null),C=me.useCallback(()=>{p.current!=null&&clearTimeout(p.current),p.current=null;},[]),P=me.useCallback(()=>{m.current!=null&&clearTimeout(m.current),m.current=null;},[]),w=me.useCallback(()=>{P(),m.current=window.setTimeout(()=>l(false),0);},[P,l]),v=me.useCallback(()=>{let E=i.current?.getBoundingClientRect();return E?{x:E.left+E.width/2,y:E.top+E.height/2}:{x:0,y:0}},[]),N=me.useCallback((E,W)=>{d.current={x:E,y:W},I(),l(true);},[I,l]),B=typeof t=="function"?t({close:u}):t,K=Bs(B),O=E=>{if(!me.isValidElement(E))return E;let W=al(E),$=E,z=$.props.children,_=z==null?z:Array.isArray(z)?z.map(H=>me.isValidElement(H)?O(H):H):me.isValidElement(z)?O(z):z;if(W==="DropdownMenu"){let H=$.props.onOpenChange;return me.cloneElement($,{...$.props,open:c,onOpenChange:U=>{H?.(U),l(U);},children:_})}if(W==="DropdownMenuContent"){let H=$.props.onMouseEnter,U=$.props.onMouseLeave;return me.cloneElement($,{...$.props,anchor:x,"data-cz-id":R.current,onMouseEnter:X=>{P(),H?.(X);},onMouseLeave:X=>{w(),U?.(X);},children:_})}return _===z?$:me.cloneElement($,{...$.props,children:_})},S=K?O(B):B,F=me.useCallback(E=>{E.preventDefault(),N(E.clientX,E.clientY);},[N]),M=me.useCallback(E=>{n==="contextmenu"&&F(E);},[n,F]),b=me.useCallback(E=>{n==="dblclick"&&F(E);},[n,F]),h=me.useCallback(E=>{n==="click"&&F(E);},[n,F]),A=me.useCallback(E=>{if(n!=="hover")return;C(),P();let W=r==="center"?v():{x:E.clientX,y:E.clientY};p.current=window.setTimeout(()=>{let $=W.x+(r==="cursor"?s:0),z=W.y+(r==="cursor"?s:0);N($,z);},0);},[n,r,s,v,N,C,P]),D=me.useCallback(E=>{n==="hover"&&c&&r==="cursor"&&!K&&(d.current={x:E.clientX+s,y:E.clientY+s},I());},[n,c,r,K,s,I]),L=me.useCallback(()=>{n==="hover"&&(C(),w());},[n,C,w]);me.useEffect(()=>{if(n!=="hover")return;let E=()=>{if(!c)return;let W=i.current?.matches(":hover"),$=g()?.matches?.(":hover");W||$?P():w();};return window.addEventListener("pointermove",E,{passive:true,capture:true}),()=>window.removeEventListener("pointermove",E,{capture:true})},[c,n,g,P,w]),me.useEffect(()=>{let E=()=>{if(c)if(n==="hover"){let W=i.current?.matches(":hover"),$=g()?.matches?.(":hover");if(W||$?P():w(),r==="center"&&i.current){let z=v();d.current={x:z.x,y:z.y},I();}}else l(false);};return window.addEventListener("scroll",E,true),window.addEventListener("resize",E,true),()=>{window.removeEventListener("scroll",E,true),window.removeEventListener("resize",E,true);}},[c,n,r,v,I,l,P,w,g]),me.useEffect(()=>()=>{C(),P();},[C,P]);let k=({children:E})=>c?jsx("div",{ref:y,style:{position:"fixed",left:0,top:0,transform:`translate3d(${Math.round(d.current.x)}px, ${Math.round(d.current.y)}px, 0)`,willChange:"transform",zIndex:1e3,pointerEvents:"auto"},onMouseEnter:()=>n==="hover"&&P(),onMouseLeave:()=>n==="hover"&&w(),children:E}):null;return jsxs("div",{ref:i,onContextMenu:M,onDoubleClick:b,onClick:h,onMouseEnter:A,onMouseMove:D,onMouseLeave:L,css:css({position:"relative"}),className:"plainframe-ui-context-zone-wrapper",children:[e,K?S:jsx(k,{children:S})]})};var Vn=(e,t="0px")=>e==null?t:typeof e=="number"?`${e}px`:e,Xp=me.memo(forwardRef(function({label:t,variant:n="full",direction:o="horizontal",labelPosition:r="center",thickness:s=1,width:i,middleMargin:c="5px",insetMargin:a="10px",chip:l=false,chipVariant:u="subtle",rounded:d=false,margin:y=10,css:f,labelCss:T,strokeCss:I,className:x,...R},g){let p=V(),{t:m,strokeColor:C,labelTextColor:P,chipSubtleBg:w,chipOutlinedBg:v,outerM:N,padX:B,verticalStrokeMargin:K}=useMemo(()=>{let b=typeof s=="number"?`${s}px`:s,h=p.surface.border,A=p.text.secondary,D=p.surface.subtleBg,L=p.surface.panelBg,k=Vn(y,"10px"),E=o==="horizontal"?n==="middle"?Vn(c):n==="inset"?Vn(a,"0px"):"0":"0",W=o==="vertical"?n==="middle"?Vn(c):n==="inset"?Vn(a,"0px"):"0":"0";return {t:b,strokeColor:h,labelTextColor:A,chipSubtleBg:D,chipOutlinedBg:L,outerM:k,padX:E,verticalStrokeMargin:W}},[s,p,o,n,c,a,y]),O=useMemo(()=>css([{display:"flex",alignItems:"center"},o==="vertical"?{flexDirection:"column",alignSelf:"stretch",width:t?"max-content":m,minWidth:t?"max-content":m,marginLeft:N,marginRight:N}:{flexDirection:"row",width:i?Vn(i):"100%",minWidth:0,paddingLeft:B,paddingRight:n==="middle"?B:"0",marginTop:N,marginBottom:N},...Array.isArray(f)?f:f?[f]:[]]),[o,t,m,N,i,B,n,f]),S=useMemo(()=>css([{background:C,borderRadius:d?p.radius.full:p.radius.xs},o==="vertical"?{width:m,minHeight:18,flex:1,marginTop:K,marginBottom:K}:{height:m,flex:1}]),[C,d,p.radius.full,p.radius.xs,o,m,K]),F=useMemo(()=>css([{margin:l?o==="vertical"?"4px 0":0:o==="vertical"?"2px 0":0,padding:l?"3px 7px":0,borderRadius:l?d?p.radius.full:`calc(${p.radius.sm} * 0.75)`:`calc(${p.radius.sm} * 0.75)`,color:P,fontWeight:500,fontSize:13,textAlign:"center",alignSelf:"center",whiteSpace:o==="vertical"?"normal":"pre",wordBreak:o==="vertical"?"break-all":void 0,...l?u==="subtle"?{background:w,border:"none"}:{background:v,border:`${m} solid ${C}`}:{}},...Array.isArray(T)?T:T?[T]:[]]),[l,o,d,p.radius.full,p.radius.sm,P,u,w,v,m,C,T]),M=useMemo(()=>jsx("div",{className:"plainframe-ui-divider-stroke",css:[S,I]}),[S,I]);return o==="vertical"?jsxs("div",{ref:g,"data-direction":"vertical","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper","is-vertical",x||""].join(" ").trim(),css:O,...R,children:[t&&r!=="top"&&M,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="bottom"&&M,!t&&M]}):jsxs("div",{ref:g,"data-direction":"horizontal","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper",x||""].join(" ").trim(),css:O,...R,children:[t&&r!=="left"&&M,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="right"&&M,!t&&M]})}));var ml=me.createContext(null),fl=()=>{let e=useContext(ml);if(!e)throw new Error("Drawer components must be used within <Drawer>.");return e},gl=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[i,c]=useState(!!n),a=t??i,l=useCallback(d=>{t===void 0&&c(d),o?.(d);},[t,o]),u=useMemo(()=>({open:a,setOpen:l,lockScroll:r,closeOnEscape:s}),[a,l,r,s]);return jsx(ml.Provider,{value:u,children:e})},Zp=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:i}=fl(),c=!!e&&me.isValidElement(t),a=useCallback(u=>{if(c){let d;me.isValidElement(t)&&(d=t.props.onClick),d?.(u);}r.onClick?.(u),u.defaultPrevented||i(true);},[c,t,r.onClick,i]),l=useCallback(u=>{if((u.key==="Enter"||u.key===" ")&&(u.preventDefault(),i(true)),c){let d;me.isValidElement(t)&&(d=t.props.onKeyDown),d?.(u);}r.onKeyDown?.(u);},[c,t,r.onKeyDown,i]);if(c){let u=t,d=u.props.css;return me.cloneElement(u,{...u.props||{},className:[u.props.className,n].filter(Boolean).join(" ")||void 0,css:[d,o].filter(Boolean),onClick:a,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,onClick:a,onKeyDown:l,...r,children:t})});Zp.displayName="DrawerTrigger";var To=0,bl="",hl="",Qp=()=>typeof window>"u"?0:window.innerWidth-document.documentElement.clientWidth;function em(){if(!(typeof document>"u")){if(To===0){let e=document.body;bl=e.style.overflow||"",hl=e.style.paddingRight||"";let t=Qp();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}To+=1;}}function tm(){if(!(typeof document>"u")&&(To>0&&(To-=1),To===0)){let e=document.body;e.style.overflow=bl,e.style.paddingRight=hl;}}var nm=(e,t=0)=>e==null?t:typeof e=="number"?e:parseFloat(String(e))||t,yl=forwardRef(function({children:t,width:n,height:o,position:r="left",variant:s="inset",margin:i=10,radius:c,backdropBlur:a=true,backdropBlurDepth:l,closeOnClickAway:u=true,transitionMs:d,snapClosePct:y=.33,velocityClosePxS:f=950,dragElasticOut:T=.2,className:I,css:x,...R},g){let p=V(),{open:m,setOpen:C,lockScroll:P,closeOnEscape:w}=fl();useEffect(()=>{if(!(!P||!m))return em(),()=>tm()},[m,P]);let v=useMemo(()=>nm(i,0),[i]),N=useMemo(()=>r==="left"||r==="right"?"x":"y",[r]),B=useMemo(()=>r==="left"||r==="top"?-1:1,[r]),K=useMemo(()=>n??(r==="left"||r==="right"?320:s==="inset"?`calc(100% - ${v*2}px)`:"100%"),[n,r,s,v]),O=useMemo(()=>o??(r==="top"||r==="bottom"?420:s==="inset"?`calc(100% - ${v*2}px)`:"100%"),[o,r,s,v]),S=useMemo(()=>{let q=String(p.radius.lg);switch(r){case "left":return `0 ${q} ${q} 0`;case "right":return `${q} 0 0 ${q}`;case "top":return `0 0 ${q} ${q}`;default:return `${q} ${q} 0 0`}},[r,p.radius.lg]),F=useMemo(()=>c??(s==="inset"?p.radius.lg:S),[c,s,p.radius.lg,S]),M=useMemo(()=>s==="inset"?{top:r==="bottom"?void 0:v,bottom:r==="top"?void 0:v,left:r==="right"?void 0:v,right:r==="left"?void 0:v}:{top:r==="bottom"?void 0:0,bottom:r==="top"?void 0:0,left:r==="right"?void 0:0,right:r==="left"?void 0:0},[s,r,v]),b=useRef(null),h=useCallback(()=>{let q=b.current;if(!q)return 1;let Y=q.getBoundingClientRect();return N==="x"?Y.width:Y.height},[N]),A=useMemo(()=>({type:"spring",stiffness:520,damping:40,mass:.7}),[]),D=useMemo(()=>({duration:(d??280)/1e3,ease:[.22,1,.36,1]}),[d]),L=useMemo(()=>B*1.1,[B]),k=useMemo(()=>N==="x"?{x:`${L*100}%`,y:0}:{y:`${L*100}%`,x:0},[N,L]),E=useMemo(()=>css({position:"fixed",zIndex:1100,...M,width:K,height:O,backgroundColor:p.surface.panelBg,borderRadius:F,overflowY:"auto",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",willChange:"transform, box-shadow, opacity",backfaceVisibility:"hidden",pointerEvents:m?"auto":"none",touchAction:N==="x"?"pan-y":"pan-x","@media (prefers-reduced-motion: reduce)":{transition:"none"}}),[M,K,O,p.surface,F,m,N]),W=useMemo(()=>css({position:"fixed",inset:0,zIndex:1099,background:p.surface.overlayBg,transition:"all .3s ease",...a?{backdropFilter:`blur(${l??"2px"})`}:null}),[a,l,p.surface]),$=useCallback(()=>{u&&C(false);},[u,C]),z=useMemo(()=>N==="x"?{left:B===-1?T:0,right:B===1?T:0}:{top:B===-1?T:0,bottom:B===1?T:0},[N,B,T]),_=useMemo(()=>N==="x"?{left:0,right:0}:{top:0,bottom:0},[N]),H=useMemo(()=>Math.max(0,Math.min(1,y)),[y]),U=useCallback((q,Y)=>{let le=N==="x"?Y.offset.x:Y.offset.y,ie=N==="x"?Y.velocity.x:Y.velocity.y,be=B*le>0,Pe=Math.abs(le)>=h()*H,Re=B*ie>f;be&&(Pe||Re)&&C(false);},[N,B,h,H,f,C]),X=useRef(null);useEffect(()=>{if(!m)return;X.current=document.activeElement;let q=setTimeout(()=>{let ie=b.current;if(!ie)return;let be=ie.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');be.length>0?be[0].focus():ie.focus();},100),Y=ie=>{let be=b.current;if(!be||!ie.target)return;let Pe=ie.target;if(!be.contains(Pe)){ie.preventDefault();let Re=be.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');Re.length>0?Re[0].focus():be.focus();}},le=ie=>{ie.key==="Escape"&&w&&(ie.stopPropagation(),C(false));};return document.addEventListener("focusin",Y,true),window.addEventListener("keydown",le),()=>{clearTimeout(q),document.removeEventListener("focusin",Y,true),window.removeEventListener("keydown",le),X.current&&typeof X.current.focus=="function"&&X.current.focus();}},[m,C,w]);let{...ae}=R;return jsx(AnimatePresence,{children:m?jsxs(Fragment,{children:[jsx(motion.div,{role:"presentation","aria-hidden":true,css:W,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:d?D:{duration:.18,ease:"linear"},onClick:$},"overlay"),jsx(motion.div,{ref:q=>{b.current=q,typeof g=="function"?g(q):g&&(g.current=q);},role:"dialog","aria-modal":"true",tabIndex:-1,"data-position":r,"data-variant":s,className:["plainframe-ui-drawer",I||""].join(" ").trim(),css:[E,x],drag:N,dragConstraints:_,dragElastic:z,dragMomentum:false,dragDirectionLock:true,onDragEnd:U,initial:{...k,opacity:.98},animate:{x:0,y:0,opacity:1},exit:{...k,opacity:.98},transition:d?D:A,...ae,children:t},"panel")]}):null})});yl.displayName="DrawerContent";var om=forwardRef(function({open:t,on:n,defaultOpen:o,defaultOn:r,onOpenChange:s,onClose:i,children:c,...a},l){let u=t!==void 0?t:n,d=o!==void 0?o:r,y=u!==void 0,[f,T]=useState(!!d),I=y?!!u:f,x=useCallback(R=>{y||T(R),R||i?.(),s?.(R);},[y,i,s]);return jsx(gl,{open:I,onOpenChange:x,children:jsx(yl,{ref:l,...a,children:c})})});om.displayName="DrawerLegacy";var Ws=({children:e,duration:t=300,delay:n=0,on:o=false,onAnimationEnd:r,asChild:s=false,className:i,blur:c=false})=>{let a={opacity:o?1:0,filter:c?o?"none":"blur(10px)":"none",transition:`opacity ${t}ms ease ${n}ms, filter ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"opacity, filter",backfaceVisibility:"hidden"},l=d=>y=>{y.target===y.currentTarget&&(y.propertyName==="opacity"||y.propertyName==="filter")&&r?.(),d?.(y);};if(s&&isValidElement(e)){let d=e,y=d.props.css,f=Array.isArray(y)?[...y,a]:y?[y,a]:[a],T=["plainframe-ui-transition-fade",d.props.className||"",i||""].join(" ").trim(),I=d.props.onTransitionEnd;return cloneElement(d,{...d.props,css:f,className:T,onTransitionEnd:l(I)})}let u=css(a);return jsx("div",{className:["plainframe-ui-transition-fade",i||""].join(" ").trim(),css:u,onTransitionEnd:l(),children:e})};var xl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,vl=me.memo(({direction:e="row",gap:t="sm",justify:n,align:o="center",className:r,css:s,children:i,width:c,height:a,...l})=>{let u=V(),d=e==="vertical"||e==="column"?"column":"row",y=t===void 0?void 0:typeof t=="number"?t:u.spacing[t]??t,f=css({display:"flex",flexDirection:d,gap:y,justifyContent:n,alignItems:o,maxWidth:xl(c),width:c?"100%":void 0,maxHeight:xl(a),height:a?"100%":void 0,boxSizing:"border-box"});return jsx("div",{className:["plainframe-ui-flex",r||""].join(" ").trim(),css:[f,s],...l,children:i})});vl.displayName="Flex";var Ks=({children:e,duration:t=300,delay:n=0,on:o=false,initialScale:r=0,finalScale:s=1,onAnimationEnd:i,asChild:c=false,className:a})=>{let l={transform:o?`scale(${s})`:`scale(${r})`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},u=y=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&i?.(),y?.(f);};if(c&&isValidElement(e)){let y=e,f=y.props.css,T=Array.isArray(f)?[...f,l]:f?[f,l]:[l],I=y.props.onTransitionEnd,x=["plainframe-ui-transition-grow",y.props.className||"",a||""].join(" ").trim();return cloneElement(y,{...y.props,css:T,className:x,onTransitionEnd:u(I)})}let d=css(l);return jsx("div",{className:["plainframe-ui-transition-grow",a||""].join(" ").trim(),css:d,onTransitionEnd:u(),children:e})};var Cl={h1:{size:"2.25rem",weight:800,lh:1.1,ls:"-0.02em"},h2:{size:"1.875rem",weight:700,lh:1.15,ls:"-0.01em"},h3:{size:"1.5rem",weight:600,lh:1.2,ls:"-0.005em"},h4:{size:"1.25rem",weight:500,lh:1.2,ls:"0"},h5:{size:"1.125rem",weight:500,lh:1.3,ls:"0"},h6:{size:"1rem",weight:500,lh:1.3,ls:"0"},body:{size:"sm",weight:400,lh:1.4,ls:"0"},caption:{size:"xs",weight:400,lh:1.4,ls:"0.01em"}},ym=e=>e==null?void 0:typeof e=="number"?`${e}px`:String(e),xm={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",body:"span",caption:"span"},Un=me.memo(({variant:e="body",children:t,color:n,size:o,weight:r,lineHeight:s,letterSpacing:i,align:c="left",textTransform:a="none",whiteSpace:l="normal",decoration:u="none",decorationStyle:d="solid",decorationThickness:y=1,decorationColor:f,italic:T,className:I,style:x,as:R})=>{let g=V(),p=Cl[e]??Cl.body,m=R??xm[e]??"span",C=F=>F==null?p.size:typeof F=="number"?F:g?.typography?.sizes?.[F]??F,P=C(o)??C(p.size),w=r??p.weight,v=s??p.lh,N=i??p.ls,B=n==="secondary"?g.text.secondary:n==="primary"?g.text.primary:n??"inherit",K=f??g.surface.border,O=css({boxSizing:"border-box",display:c==="left"?"inline":"block",textAlign:c==="left"?void 0:c,fontFamily:g?.typography?.fonts?.sans||"inherit",fontSize:P,fontWeight:w,lineHeight:v,letterSpacing:N,color:B,textTransform:a,whiteSpace:l,fontStyle:T?"italic":"normal",margin:0,padding:0}),S=u==="none"?css({textDecoration:"none"}):css({textDecorationLine:u,textDecorationStyle:d,textDecorationColor:K,textDecorationThickness:ym(y),textDecorationSkipInk:"auto"});return jsx(m,{className:[`pfui-typo-${e}`,I||""].join(" ").trim(),css:[O,S],style:x,"data-variant":e,children:t})});Un.displayName="Typography";var Us=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Rm=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){if(["xs","sm","md","lg","xl","full"].includes(e)){let n=t.radius&&t.radius[e]||t.radii&&t.radii[e];return Us(typeof n=="number"||typeof n=="string"?n:e)}return e}}},Tl=forwardRef(function({src:t,alt:n="",width:o,height:r,radius:s="md",shadow:i=false,hoverEffect:c="none",label:a,labelAlign:l="center",aspectRatio:u,loading:d="lazy",decoding:y="async",fetchPriority:f,srcSet:T,sizes:I,placeholder:x,blurDataURL:R,placeholderColor:g="#f1f1f1",fallbackSrc:p,className:m,css:C,onClick:P,onLoad:w,onError:v,...N},B){let[K,O]=useState(false),[S,F]=useState(false),[M,b]=useState(false),h=V(),A=Rm(s,h)??"0px",D=a?"figure":"div",L=css({display:"flex",flexDirection:"column",gap:a?h.spacing.xs:0,width:"fit-content",borderRadius:`var(--pfui-image-radius, ${A})`}),k=css({position:"relative",borderRadius:`var(--pfui-image-radius, ${A})`,maxWidth:o?Us(o):"100%",maxHeight:r?Us(r):void 0,width:o?"100%":void 0,height:r?"100%":void 0,aspectRatio:u,boxShadow:i?"0 12px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.04)":"none",overflow:"hidden",padding:0,lineHeight:0,transition:"transform 0.3s ease",willChange:"transform",transform:K&&(c==="rotate"||c==="scale-rotate")?"rotate(3deg)":"none",cursor:P?"pointer":void 0}),E=css({position:"absolute",inset:0,background:x==="color"?g:void 0,backgroundImage:x==="blur"&&R?`url(${R})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:x==="blur"?"blur(8px)":void 0,transition:"opacity 0.3s ease",opacity:M?0:1,pointerEvents:"none"}),W=css({width:"100%",height:"100%",display:"block",objectFit:"cover",transform:K&&(c==="scale"||c==="scale-rotate")?"scale(1.08)":"none",transition:"transform 0.3s ease",willChange:"transform"});return jsxs(D,{className:["plainframe-ui-image",m||""].join(" ").trim(),css:[L,C],tabIndex:-1,children:[jsxs("div",{className:"plainframe-ui-image-frame",css:k,onMouseEnter:()=>O(true),onMouseLeave:()=>O(false),onClick:P,children:[!M&&x&&jsx("div",{"aria-hidden":true,className:"plainframe-ui-image-placeholder",css:E}),jsx("img",{ref:B,className:"plainframe-ui-image-img",css:W,src:S&&p?p:t,alt:n,srcSet:T,sizes:I,loading:d,decoding:y,fetchPriority:f,onLoad:$=>{b(true),w?.($);},onError:$=>{F(true),v?.($);},...N})]}),a&&jsx(Un,{as:"figcaption",variant:"caption",align:l,children:a})]})});Tl.displayName="Image";var wl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,km=e=>{if(typeof e=="number"&&isFinite(e)&&e>0)return e;if(typeof e=="string"){let t=e.trim().match(/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/);if(t){let o=parseFloat(t[1]),r=parseFloat(t[2]);if(o>0&&r>0)return o/r}let n=parseFloat(e);if(isFinite(n)&&n>0)return n}},Im=e=>e*Math.PI/180,Sm=(e,t,n)=>{let o=Math.abs(Im(n)),r=Math.cos(o),s=Math.sin(o);return {w:Math.abs(e*r)+Math.abs(t*s),h:Math.abs(t*r)+Math.abs(e*s)}};function Mm(e,t){if(t<=1){let r={ang:[0],dx:[0],dy:[0]};return {base:r,exp:r}}return e==="fan"?{base:t===2?{ang:[-14,10],dx:[-40,24],dy:[0,0]}:{ang:[-14,0,14],dx:[-55,0,55],dy:[-7.5,0,-7.5]},exp:t===2?{ang:[-7,5],dx:[-20,12],dy:[0,0]}:{ang:[-7,0,7],dx:[-32.5,0,32.5],dy:[0,0,0]}}:e==="slide"?{base:t===2?{ang:[-20,3],dx:[-10,5],dy:[-2,0]}:{ang:[-20,-5,10],dx:[-35,-10,12],dy:[4,0,4]},exp:t===2?{ang:[-10,1.5],dx:[-10,5],dy:[-2,0]}:{ang:[-10,-2.5,5],dx:[-30.5,-7.5,6],dy:[4,0,4]}}:e==="domino"?{base:t===2?{ang:[0,0],dx:[0,0],dy:[-11,5]}:{ang:[0,0,0],dx:[0,0,0],dy:[-18,-5,6]},exp:t===2?{ang:[0,0],dx:[0,0],dy:[-5,5]}:{ang:[0,0,0],dx:[0,0,0],dy:[-14,-2.5,7]}}:{base:t===2?{ang:[-4,8],dx:[-22,18],dy:[-30,40]}:{ang:[-10,10,.5],dx:[-30,30,-15],dy:[-65,2,65]},exp:t===2?{ang:[-3,6],dx:[-11,9],dy:[-22.5,30]}:{ang:[-7.5,7.5,.35],dx:[-15,20,-10.5],dy:[-55.5,2,55.5]}}}var Fm=(e,t,n)=>e==="fan"?t===2?[.9,1.08][n]??1:[.8,1,.8][n]??1:e==="slide"?t===2?[.8,1][n]??1:[.7,.85,1][n]??1:e==="domino"?t===2?[.9,1][n]??1:[.85,.95,1][n]??1:1,El=[1.02,1.03,1.02],kl=[1.06,1.08,1.06],Am={sm:150,md:200,lg:260,xl:340},Pm=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Nm(e,t){if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){if(["xs","sm","md","lg","xl","full"].includes(e)){let n=t.radius&&t.radius[e]||t.radii&&t.radii[e];return Pm(typeof n=="number"||typeof n=="string"?n:e)}return e}}}var Dm=memo(function({children:t,variant:n="fan",width:o,aspectRatio:r="4/5",size:s="md",hoverEffect:i="none",hovering:c,maxItems:a=3,shadow:l=false,cursor:u,outline:d,outlineColor:y,outlineWidth:f=3,outlineOffset:T=0,radius:I="md",label:x,labelAlign:R="center",css:g,className:p,...m}){let C=V(),P=km(r)??4/5,w=typeof o=="string"?o:void 0,v=typeof o=="number"?o:w&&/px$/.test(w)?parseFloat(w):Am[s],N=Math.max(1,v/P),K=Children.toArray(t).filter(isValidElement).slice(0,a),O=K.length,S=Mm(n,O),F=K.map((q,Y)=>Fm(n,O,Y)),M=q=>N*.6*F[q],b=q=>M(q)*P,h=0,A=0;for(let q=0;q<O;q++){let Y=b(q),le=M(q),ie=Math.max(Math.abs(S.base.ang[q]??0),Math.abs(S.exp.ang[q]??0)),be=Math.max(Math.abs(S.base.dx[q]??0),Math.abs(S.exp.dx[q]??0)),Pe=Math.max(Math.abs(S.base.dy[q]??0),Math.abs(S.exp.dy[q]??0)),Re=i==="expand"?kl[q]??1.08:i==="reveal"?El[q]??1.03:1,Ce=Sm(Y,le,ie),Ie=Ce.w*Re,Te=Ce.h*Re,we=be/100*Y*Re,he=Pe/100*le*Re;h=Math.max(h,Ie/2+we),A=Math.max(A,Te/2+he);}let D=Math.max(1,2*h),L=Math.max(1,2*A),k=Math.min(1,v/D,N/L),E=c===void 0?"pointer":"controlled",W=c?"true":void 0,$=css({display:"flex",flexDirection:"column",cursor:u||"auto",lineHeight:0,position:"relative",isolation:"isolate",gap:x?C.spacing.xs:0}),z=css({position:"relative",width:wl(typeof o=="number"?o:v)??(typeof o=="string"?o:void 0),height:wl(N)}),_=css({position:"absolute",inset:0,left:"50%",top:"50%",width:`${D}px`,height:`${L}px`,transform:`translate(-50%, -50%) scale(${k})`,transformOrigin:"center center"}),H=Nm(I,C)??"0px",U=q=>{let Y=n==="fan"?`rotate(${S.base.ang[q]}deg) translate(${S.base.dx[q]}%, ${S.base.dy[q]}%)`:n==="slide"?`translate(${S.base.dx[q]}%, ${S.base.dy[q]}%) rotate(${S.base.ang[q]}deg)`:n==="domino"?`translate(0%, ${S.base.dy[q]}%)`:`translate(${S.base.dx[q]}%, ${S.base.dy[q]}%) rotate(${S.base.ang[q]}deg)`,le=n==="fan"?`rotate(${S.exp.ang[q]}deg) translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%)`:n==="slide"?`translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%) rotate(${S.exp.ang[q]}deg)`:n==="domino"?`translate(0%, ${S.exp.dy[q]}%)`:`translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%) rotate(${S.exp.ang[q]}deg)`,ie=i==="reveal"?"translate(0,0) rotate(0) scale(1)":`${Y} scale(1)`,be=i==="expand"?`${le} scale(${kl[q]??1.06})`:i==="reveal"?`${Y} scale(${El[q]??1.03})`:`${Y} scale(1)`;return css({position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) ${ie}`,transition:"transform .22s ease",willChange:"transform",backfaceVisibility:"hidden",zIndex:n==="fan"&&q===1?10:q+1,lineHeight:0,boxShadow:l?"rgba(0,0,0,.12) 0 8px 20px":"none",outline:d?`${f}px solid ${y??C.surface.appBg}`:void 0,outlineOffset:d?T:void 0,pointerEvents:"auto",".plainframe-ui-image-stack-wrapper[data-hover-mode='pointer']:hover &":{transform:`translate(-50%, -50%) ${be}`},".plainframe-ui-image-stack-wrapper[data-hover-mode='controlled'][data-hovered='true'] &":{transform:`translate(-50%, -50%) ${be}`}})},X=q=>css({width:`${b(q)}px`,aspectRatio:`${P}`,position:"relative",overflow:"hidden",borderRadius:H,"--pfui-image-radius":H,"& > *":{position:"absolute",inset:"0",width:"100% !important",height:"100% !important",maxWidth:"none !important",maxHeight:"none !important",display:"block"},"& img, & picture img, & video, & canvas":{width:"100% !important",height:"100% !important",objectFit:"cover",display:"block"}});return jsxs(x?"figure":"div",{className:["plainframe-ui-image-stack-wrapper",p||""].join(" ").trim(),"data-hover-mode":E,"data-hovered":W,css:[$,g],tabIndex:-1,...m,children:[jsx("div",{className:"plainframe-ui-image-stack",css:z,children:jsx("div",{className:"plainframe-ui-image-stack-stage",css:_,children:K.map((q,Y)=>jsx("div",{className:"plainframe-ui-image-stack-item",css:U(Y),children:jsx("div",{className:"plainframe-ui-image-stack-frame",css:X(Y),children:q})},Y))})}),x&&jsx(Un,{as:"figcaption",variant:"caption",align:R,children:x})]})});var Il=e=>typeof e=="number"?`${e}px`:e,Sl={sm:{h:20,px:6,font:10},md:{h:24,px:7,font:12},lg:{h:28,px:8,font:14}};function Bm(e,t){if(e==null){let n=t.radius?.xs??t.radius?.sm??3;return Il(n)}if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.radius?.[e]??t.radii?.[e];if(n!=null)return Il(n)}return e}function $m(e){if(typeof e!="string")return false;let t=e.trim();return !(!t||t.length>4||/[A-Za-z0-9]/.test(t))}var zm=forwardRef(function({children:t,variant:n="outlined",size:o="sm",radius:r,mono:s=true,uppercase:i=false,symbolBoost:c=2,css:a,className:l="plainframe-ui-kbd",...u},d){let y=V(),f=xe(),T=Sl[o]??Sl.sm,I=Bm(r,y),x={br:y.neutral[300],txt:y.neutral[800],inset:y.neutral[0]},R=css({all:"unset",boxSizing:"border-box",display:"inline-flex !important",alignItems:"center",justifyContent:"center",minHeight:n==="ghost"?void 0:`${T.h}px !important`,paddingInline:n==="ghost"?0:`${T.px}px !important`,paddingBlock:"0 !important",fontFamily:s?y.typography.fonts.mono:"inherit",fontSize:`${T.font}px !important`,fontWeight:600,letterSpacing:.2,textTransform:i?"uppercase":"none",borderRadius:I,userSelect:"none",verticalAlign:"baseline",position:"relative",outline:"none"}),g=css({"&&":{background:y.surface.subtleBg,border:"none",boxShadow:"none",color:x.txt}}),p=css({"&&":{background:"transparent",color:x.txt,border:"none",boxShadow:"none"}}),m=css({"&&":{background:y.surface.panelBg,color:x.txt,border:`1px solid ${x.br}`,boxShadow:`inset 0 1px 0 ${x.inset}AA, 0 1px 0 rgba(0,0,0,0.03)`}}),C=n==="subtle"?g:n==="ghost"?p:m,w=s&&c>0&&$m(t)?jsx("span",{css:css({display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:`${T.font+c}px`,lineHeight:1}),children:t}):t;return jsx("kbd",{ref:d,className:l,css:[f(),R,C,a],...u,children:w})});var _m=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,qs=({children:e,direction:t="up",duration:n=450,delay:o=0,on:r=false,onAnimationEnd:s,asChild:i=false,className:c,distance:a})=>{let u=_m(a,t==="left"||t==="right"?"100vw":"100vh"),d=t==="left"?`-${u}`:t==="right"?u:"0",y=t==="up"?u:t==="down"?`-${u}`:"0",f={transform:r?"translate3d(0,0,0)":`translate3d(${d}, ${y}, 0)`,transition:`transform ${n}ms ease ${o}ms`,pointerEvents:r?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},T=x=>R=>{R.target===R.currentTarget&&R.propertyName==="transform"&&s?.(),x?.(R);};if(i&&isValidElement(e)){let x=e,R=x.props.css,g=Array.isArray(R)?[...R,f]:R?[R,f]:[f],p=["plainframe-ui-transition-slide",x.props.className||"",c||""].join(" ").trim(),m=x.props.onTransitionEnd;return cloneElement(x,{...x.props,css:g,className:p,onTransitionEnd:T(m)})}let I=css(f);return jsx("div",{className:["plainframe-ui-transition-slide",c||""].join(" ").trim(),css:I,onTransitionEnd:T(),children:e})};var Gs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Pl=me.createContext(null),Nl=()=>{let e=useContext(Pl);if(!e)throw new Error("Modal components must be used within <Modal>.");return e},Xm=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[i,c]=useState(!!n),a=t??i,l=useCallback(d=>{t===void 0&&c(d),o?.(d);},[t,o]);useEffect(()=>{if(!a||!s)return;let d=y=>{y.key==="Escape"&&(y.stopPropagation(),l(false));};return window.addEventListener("keydown",d,true),()=>window.removeEventListener("keydown",d,true)},[a,s,l]);let u=useMemo(()=>({open:a,setOpen:l,lockScroll:r,closeOnEscape:s}),[a,l,r,s]);return jsx(Pl.Provider,{value:u,children:e})},Dl=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:i}=Nl(),c=!!e&&me.isValidElement(t),a=useCallback(u=>{if(c){let d;me.isValidElement(t)&&(d=t.props.onClick),d?.(u);}r.onClick?.(u),u.defaultPrevented||i(true);},[c,t,r.onClick,i]),l=useCallback(u=>{if((u.key==="Enter"||u.key===" ")&&(u.preventDefault(),i(true)),c){let d;me.isValidElement(t)&&(d=t.props.onKeyDown),d?.(u);}r.onKeyDown?.(u);},[c,t,r.onKeyDown,i]);if(c){let u=t,d=u.props.css;return me.cloneElement(u,{...u.props||{},className:[u.props.className,n].filter(Boolean).join(" ")||void 0,css:[d,o].filter(Boolean),"aria-haspopup":"dialog",onClick:a,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,"aria-haspopup":"dialog",onClick:a,onKeyDown:l,...r,children:t})});Dl.displayName="ModalTrigger";var Hl=forwardRef(({children:e,variant:t="inset",width:n=500,height:o="auto",radius:r="lg",padding:s="lg",backdrop:i=true,backdropBlur:c=true,backdropBlurDepth:a=5,closeOnClickAway:l=true,transitionVariant:u="fade",direction:d="up",transitionDuration:y=300,containerCss:f,backdropCss:T,className:I,...x},R)=>{let g=V(),{open:p,setOpen:m,lockScroll:C}=Nl(),P=me.useRef(null),w=me.useRef(null);me.useEffect(()=>{if(!p)return;w.current=document.activeElement;let S=setTimeout(()=>{let M=P.current;if(!M)return;let b=M.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');b.length>0?b[0].focus():M.focus();},100),F=M=>{let b=P.current;if(!b||!M.target)return;let h=M.target;if(!b.contains(h)){M.preventDefault();let A=b.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');A.length>0?A[0].focus():b.focus();}};return document.addEventListener("focusin",F,true),()=>{clearTimeout(S),document.removeEventListener("focusin",F,true),w.current&&typeof w.current.focus=="function"&&w.current.focus();}},[p]);let v=typeof g.spacing.sm=="number"?`${g.spacing.sm}px`:String(g.spacing.sm),N=css({width:"100%",height:Gs(o),maxWidth:t==="inset"?`min(${Gs(n)||"100%"}, calc(100% - ${v} * 2))`:Gs(n),maxHeight:t==="inset"?`calc(100% - ${v} * 2)`:"100%",margin:t==="inset"?v:void 0}),B=jsx(_n,{role:"dialog","aria-modal":"true",tabIndex:-1,className:["plainframe-ui-modal",I||""].join(" ").trim(),padding:s,radius:r,variant:"panel",css:[N,f],ref:S=>{P.current=S,typeof R=="function"?R(S):R&&(R.current=S);},...x,children:e}),K=u==="none"?B:u==="slide"?jsx(qs,{on:p,direction:d,duration:y,children:B}):u==="grow"?jsx(Ks,{initialScale:.75,on:p,duration:y,children:B}):jsx(Ws,{on:p,duration:y,children:B});if(!i)return jsx(Fragment,{children:K});let O=css(t==="full"?{alignItems:"start",justifyItems:"start",justifyContent:"start"}:{alignItems:"center",justifyItems:"center",justifyContent:"center"});return jsx(Es,{on:p,blur:c,blurDepth:a,onClickAway:l?()=>m(false):void 0,css:[O,T].filter(Boolean),contentCss:O,lockScroll:C,children:K})});Hl.displayName="ModalContent";var of=({count:e,page:t,defaultPage:n=1,onChange:o,siblingCount:r=1,boundaryCount:s=1,disabled:i=false,showFirstLast:c=false,loop:a=false,variant:l="subtle",gap:u,className:d,css:y})=>{let f=V(),T=xe(),I=t!==void 0,[x,R]=useState(n),g=Math.max(1,e),p=Sr(I?t:x,1,g),m=useCallback(k=>{let E=Sr(k,1,g);I||R(E),o?.(E);},[I,g,o]),C=useMemo(()=>rf({count:g,page:p,siblingCount:r,boundaryCount:s}),[g,p,r,s]),P=f.palette?.primary?.[600],w=f.surface?.border,v=l==="subtle"?f.surface.subtleHover:l==="ghost"?f.surface?.subtleBg:f.surface.panelHover,N=f.text?.primary??"#111",B=l==="subtle"?f.surface?.subtleBg:"transparent",K=css({display:"inline-flex",alignItems:"center",gap:u??6,flexWrap:"wrap",borderRadius:f.radius?.md,background:B,padding:l==="subtle"?f.spacing.xs:0,userSelect:"none"},...Array.isArray(y)?y:y?[y]:[]),O=css({minWidth:28,height:28,padding:"0 10px",borderRadius:9,fontSize:13,lineHeight:1,border:"1px solid transparent",background:"transparent",color:N,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:i?"not-allowed":"pointer",outline:"none",transition:"all .16s ease !important","&[aria-disabled='true']":{opacity:.55,pointerEvents:"none",cursor:"not-allowed"},fontWeight:600}),S=css({width:28,minWidth:28,height:28,padding:0}),F=(k=false)=>css([O,T({color:k?"primary":"neutral"}),l==="outlined"?k?{background:P,color:f.text.onColors.primary,borderColor:P}:{background:"transparent",borderColor:w,":hover":{background:v}}:l==="ghost"?k?{background:P,color:f.text.onColors.primary}:{":hover":{background:v}}:k?{background:P,color:f.text.onColors.primary,borderColor:P}:{":hover":{background:v}}]),M=useCallback(()=>m(1),[m]),b=useCallback(()=>m(g),[m,g]),h=useCallback(()=>{p===1?a&&m(g):m(p-1);},[p,a,g,m]),A=useCallback(()=>{p===g?a&&m(1):m(p+1);},[p,a,g,m]),D=i||p===1&&!a,L=i||p===g&&!a;return jsxs("nav",{"aria-label":"Pagination",className:["plainframe-ui-pagination",d||""].join(" ").trim(),css:K,onKeyDown:k=>{i||(k.key==="ArrowLeft"&&(k.preventDefault(),h()),k.key==="ArrowRight"&&(k.preventDefault(),A()),k.key==="Home"&&(k.preventDefault(),M()),k.key==="End"&&(k.preventDefault(),b()));},children:[c&&jsx("button",{className:"plainframe-ui-pagination-first-button",type:"button","aria-label":"First page","aria-disabled":D,disabled:D,css:[F(false),S],onClick:M,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronFirst,{strokeWidth:3,css:{width:14,height:14}})}),jsx("button",{className:"plainframe-ui-pagination-previous-button",type:"button","aria-label":"Previous page","aria-disabled":D,disabled:D,css:[F(false),S],onClick:h,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronLeft,{strokeWidth:3,css:{width:14,height:14}})}),C.map((k,E)=>typeof k=="number"?jsx("button",{className:"plainframe-ui-pagination-page-button",type:"button","aria-label":k===p?`Page ${k}, current page`:`Go to page ${k}`,"aria-current":k===p?"page":void 0,css:F(k===p),onClick:()=>m(k),children:k},k):jsx("span",{className:"plainframe-ui-pagination-ellipsis","aria-hidden":true,css:css([O,T(),{borderColor:"transparent",cursor:"default",opacity:.8,padding:0,minWidth:28}]),children:"\u2026"},`e${E}`)),jsx("button",{className:"plainframe-ui-pagination-next-button",type:"button","aria-label":"Next page","aria-disabled":L,disabled:L,css:[F(false),S],onClick:A,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronRight,{strokeWidth:3,css:{width:14,height:14}})}),c&&jsx("button",{className:"plainframe-ui-pagination-last-button",type:"button","aria-label":"Last page","aria-disabled":L,disabled:L,css:[F(false),S],onClick:b,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronLast,{strokeWidth:3,css:{width:14,height:14}})})]})};function Sr(e,t,n){return Math.max(t,Math.min(n,e))}function rf({count:e,page:t,siblingCount:n,boundaryCount:o}){if(e<=0)return [1];let r=2*o+2*n+3;if(e<=r)return Ir(1,e);let s=Ir(1,Math.min(o,e)),i=Ir(Math.max(e-o+1,o+1),e),c=Sr(t-n,o+2,Math.max(o+2,e-o-2*n-1)),a=Sr(t+n,Math.min(o+2+2*n,e-o-1),e-o-1),l=[],u=d=>{let y=l[l.length-1];y!==d&&(y==="ellipsis"&&d==="ellipsis"||l.push(d));};return s.forEach(u),c>o+2?u("ellipsis"):o+1<c&&u(o+1),Ir(c,a).forEach(u),a<e-o-1?u("ellipsis"):e-o>a&&u(e-o),i.forEach(u),l}function Ir(e,t){if(t<e)return [];let n=[];for(let o=e;o<=t;o++)n.push(o);return n}var cf=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,uf=me.memo(({children:e,direction:t="left",width:n,variant:o="solid",className:r,css:s})=>{let i=V(),c=i.surface.border,a=css({display:"inline-block",boxSizing:"border-box",maxWidth:cf(n,"fit-content"),width:"100%",padding:`0 ${i.spacing.md}`,borderLeft:t==="left"?`3px ${o==="dashed"?"dashed":"solid"} ${c}`:"none",borderRight:t==="right"?`3px ${o==="dashed"?"dashed":"solid"} ${c}`:"none"},...Array.isArray(s)?s:s?[s]:[]);return jsx("div",{className:r??"plainframe-ui-quote",css:a,children:e})});var zl=createContext(null),ff=()=>{let e=useContext(zl);if(!e)throw new Error("RadioItem must be used within a RadioGroup");return e},gf=e=>{let t=e?.horizontal??"left",n=e?.vertical??"center";return t==="center"&&n==="center"?{horizontal:"left",vertical:"center"}:{horizontal:t,vertical:n}},bf=({value:e,defaultValue:t,onChange:n,disabled:o=false,size:r="md",direction:s="horizontal",variant:i="filled",className:c,children:a,anchorOrigin:l,css:u})=>{let d=V(),y=e!==void 0&&n!==void 0,[f,T]=useState(t),I=y?e:f,x=useRef([]),[R,g]=useState(0),p=()=>g(F=>F+1),m=useCallback(F=>{y||T(F),n?.(F);},[y,n]),C=useCallback(F=>(x.current.push(F),p(),x.current.length-1),[]),P=useCallback((F,M)=>{let b=x.current[F];b&&(x.current[F]={...b,...M},p());},[]),w=()=>x.current.map((F,M)=>({it:F,i:M})).filter(({it:F})=>F.ref&&!F.disabled).map(({i:F})=>F),v=useCallback((F,M)=>{let b=w();if(!b.length)return;let h=Math.max(0,b.indexOf(F)),A=b[(h+M+b.length)%b.length],D=x.current[A]?.ref;if(D){D.focus();let L=x.current[A]?.value;L!==void 0&&m(L);}},[m]),N=useCallback(F=>{let M=w();if(!M.length)return;let b=F==="first"?M[0]:M[M.length-1],h=x.current[b]?.ref;if(h){h.focus();let A=x.current[b]?.value;A!==void 0&&m(A);}},[m]),B=useMemo(()=>{let F=x.current.filter(b=>b.ref&&!b.disabled);return F.length?F.some(b=>b.value===I)?I:F[0]?.value:void 0},[I,R]),K=useMemo(()=>({selected:I,setSelected:m,disabled:o,size:r,direction:s,variant:i,register:C,update:P,moveFocusBy:v,moveToEdge:N,focusValue:B,theme:d,anchorOrigin:gf(l)}),[I,m,o,r,s,i,C,P,v,N,B,d,l]),O=css({width:"fit-content"}),S=css({display:"flex",flexDirection:s==="vertical"?"column":"row",gap:d.spacing.sm,width:"fit-content",alignItems:s==="vertical"?"stretch":"center"});return jsx("div",{className:c??"plainframe-ui-radio-group",css:[O,u],children:jsx("div",{className:"plainframe-ui-radio-row",role:"radiogroup","aria-disabled":o||void 0,css:S,children:jsx(zl.Provider,{value:K,children:a})})})},hf=({value:e,disabled:t=false,className:n,children:o,css:r})=>{let{selected:s,setSelected:i,disabled:c,size:a,register:l,update:u,moveFocusBy:d,moveToEdge:y,theme:f,variant:T,focusValue:I,anchorOrigin:x}=ff(),R=c||t,g=s===e,p=["sm","md","lg"].includes(a)?a:"md",m=p==="sm"?16:p==="lg"?24:20,C=z=>f.palette?.primary?.[z],P=C(600),w=C(100),v=f.neutral[300],N=f.palette.primary[300],B=f.text.onColors?.primary??f.neutral[0],K="transparent",O=N,S=B;T==="soft"?(K=w,O=null,S=P):T==="outlined"?(K=C(50),O=N,S=P):(K=f.neutral[200],O="transparent",S=B),g&&(T==="outlined"?(K=w,O=N,S=P):T==="filled"?(K=P,O=null,S=B):(K=w,O=null,S=P));let F=T==="filled"?v:f.palette.primary[100],M=useRef(null),b=useRef(-1);useEffect(()=>{b.current=l({ref:M.current,value:e,disabled:!!R});},[l]),useEffect(()=>{u(b.current,{ref:M.current,value:e,disabled:!!R});},[u,R,e]);let h=css({border:"none",background:"transparent",display:"inline-grid",gridTemplateColumns:"auto auto auto",gridTemplateRows:"auto auto auto",columnGap:x.vertical==="center"?f.spacing.sm:0,rowGap:x.vertical==="center"?0:f.spacing.xs,justifyItems:"center",alignItems:"center",opacity:R?.5:1,borderRadius:f.radius.md,cursor:R?"not-allowed":"pointer",transition:"transform .16s ease",fontSize:f.typography.sizes.sm,fontWeight:500,padding:f.spacing.sm,"&:hover .plainframe-ui-radio-circle-outer":R||g?{}:{background:F,boxShadow:T==="outlined"?`inset 0 0 0 ${f.componentHeights.border} ${N}`:"none"},"&:focus-visible .plainframe-ui-radio-circle-outer":{outline:"none"}}),A=css({width:m,height:m,minWidth:m,minHeight:m,borderRadius:f.radius.full,background:K,boxShadow:O?`inset 0 0 0 ${f.componentHeights.border} ${O}`:"none",transition:"background-color .16s ease, box-shadow .16s ease, filter .16s ease",display:"inline-flex",alignItems:"center",justifyContent:"center"}),D=css({width:g?m*.45:0,height:g?m*.45:0,borderRadius:f.radius.full,background:g?S:"transparent",transition:"all 250ms cubic-bezier(.72,1.6,.32,1)",transform:g?"scale(1)":"scale(0.6)",opacity:g?1:0}),L=css({gridColumn:2,gridRow:2,minWidth:0,maxWidth:"100%",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",textAlign:"left"}),k=(()=>{let z=x.horizontal,_=x.vertical;return _==="center"?{col:z==="right"?3:1,row:2}:{col:2,row:_==="top"?1:3}})(),W=!R&&I===e?0:-1,$=xe();return jsxs("button",{ref:M,className:n??"plainframe-ui-radio-item",type:"button",role:"radio","aria-checked":g,"aria-disabled":R||void 0,disabled:R,tabIndex:W,onClick:()=>{R||i(e);},onKeyDown:z=>{R||(z.key==="Enter"||z.key===" "?(z.preventDefault(),i(e)):z.key==="ArrowRight"||z.key==="ArrowDown"?(z.preventDefault(),d(b.current,1)):z.key==="ArrowLeft"||z.key==="ArrowUp"?(z.preventDefault(),d(b.current,-1)):z.key==="Home"?(z.preventDefault(),y("first")):z.key==="End"&&(z.preventDefault(),y("last")));},css:[h,$({color:"primary"}),r],children:[jsx("span",{className:"plainframe-ui-radio-circle-outer",css:[A,css({gridColumn:k.col,gridRow:k.row})],children:jsx("span",{className:"plainframe-ui-radio-circle-dot",css:D})}),o!=null&&jsx("span",{className:"plainframe-ui-radio-label",css:L,children:o})]})};var Rf=({children:e,duration:t=400,delay:n=0,on:o=false,initialAngle:r=360,finalAngle:s=0,onAnimationEnd:i,asChild:c=false,className:a})=>{let l={transform:`rotate(${o?s:r}deg)`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",transformOrigin:"center center",willChange:"transform",backfaceVisibility:"hidden"},u=y=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&i?.(),y?.(f);};if(c&&isValidElement(e)){let y=e,f=y.props.css,T=Array.isArray(f)?[...f,l]:f?[f,l]:[l],I=["plainframe-ui-transition-rotate",y.props.className||"",a||""].join(" ").trim(),x=y.props.onTransitionEnd;return cloneElement(y,{...y.props,css:T,className:I,onTransitionEnd:u(x)})}let d=css(l);return jsx("div",{className:["plainframe-ui-transition-rotate",a||""].join(" ").trim(),css:d,onTransitionEnd:u(),children:e})};var Fo=(...e)=>e.filter(Boolean).flat(),Mr=e=>me.isValidElement(e),Ao=(e,t)=>{if(!Mr(e))return false;let n=e.type,o=(n?.displayName??n?.name??"")||"";return typeof o=="string"&&t.includes(o)},Ef=(e,t)=>{let n=e.props,o=n.value;if(typeof o<"u")return o;let r=n["data-value"];return typeof r<"u"?r:t};function kf({value:e,defaultValue:t,onChange:n,label:o,placeholder:r="Select\u2026",startIcon:s,endIcon:i,disabled:c,size:a="md",variant:l="subtle",fullWidth:u,width:d=200,menuAlign:y="left",menuWidth:f,menuMaxHeight:T=280,wrapperCss:I,labelCss:x,triggerCss:R,menuCss:g,optionCss:p,children:m,className:C,menuSize:P="md",triggerRender:w}){let v=V(),N=xe(),B=me.useId(),K=`${B}-label`,O=`${B}-menu`,S={sm:{minHeight:v.componentHeights.sm,radius:v.radius.sm},md:{minHeight:v.componentHeights.md,radius:v.radius.md},lg:{minHeight:v.componentHeights.lg,radius:v.radius.md}},F=S[a]||S.md,[M,b]=me.useState(false),h=j=>b(!!j),A=typeof e<"u",D=Array.isArray(e)||Array.isArray(t),[L,k]=me.useState(typeof t<"u"?t:D?[]:void 0),E=A?e:L,W=j=>{A||k(j),n?.(j);},$=me.Children.toArray(m).filter(Mr),z,_=[];for(let j of $)if(Ao(j,["MenuRadioGroup"]))z=j;else if(Ao(j,["MenuCheckboxGroup"])){let ue=j.props.children,de=ue?me.Children.toArray(ue).filter(Mr):[];_.push(...de);}else _.push(j);let U=(z?me.Children.toArray(z.props.children).filter(Mr):_).filter(j=>!Ao(j,["MenuLabel","MenuSeparator"])).map((j,ue)=>{let de=j.props,fe=Ef(j,ue),ze=de.children,Oe=de.label,st=typeof Oe=="string"||typeof Oe=="number"?String(Oe):typeof ze=="string"||typeof ze=="number"?String(ze):void 0,Ye=de.role??"",yt=Ao(j,["MenuCheckboxItem"]),tn=Ao(j,["MenuRadioItem"]),nn=yt||Ye==="menuitemcheckbox"||typeof de.onCheckedChange=="function"||typeof de.checked=="boolean"||typeof de.defaultChecked=="boolean",Sn=!nn&&(tn||Ye==="menuitemradio"||!!z),on=typeof de.children>"u"?st??String(fe):de.children;return {el:j,key:j.key??ue,value:fe,labelText:st,title:de.title,description:de.description,nodeForTrigger:on,disabled:!!de.disabled,className:de.className,itemCss:de.css,startIcon:de.startIcon,endIcon:de.endIcon,isCheckbox:nn,isRadio:Sn}}),X=U.some(j=>j.isCheckbox),ae=U.length>0&&U.every(j=>j.isRadio),Y=(D||X)&&!ae,le=me.useCallback(j=>Y?(Array.isArray(E)?E:[]).some(de=>Object.is(de,j)):Object.is(E,j),[E,Y]),ie=me.useMemo(()=>{if(Y){let ue=Array.isArray(E)?E:[];return U.filter(fe=>ue.some(ze=>Object.is(ze,fe.value))).map(fe=>typeof fe.nodeForTrigger=="string"||typeof fe.nodeForTrigger=="number"?String(fe.nodeForTrigger):fe.nodeForTrigger)}let j=U.find(ue=>Object.is(ue.value,E));if(j)return typeof j.nodeForTrigger=="string"||typeof j.nodeForTrigger=="number"?String(j.nodeForTrigger):j.nodeForTrigger},[E,Y,U]),be=j=>{c||(Object.is(j,E)||W(j),h(false));},Pe=j=>{c||Object.is(j,E)||W(j);},Re=j=>{if(c)return;let ue=Array.isArray(E)?E:[],fe=ue.some(ze=>Object.is(ze,j))?ue.filter(ze=>!Object.is(ze,j)):[...ue,j];W(fe);},Ce={position:"relative",width:u?"100%":typeof d=="number"?`${d}px`:d,maxWidth:"100%"},Ie={width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:F.radius,minHeight:F.minHeight,fontSize:v.typography.sizes.sm,padding:`0 ${typeof v.spacing.sm=="number"?`${v.spacing.sm}px`:v.spacing.sm} 0 ${typeof v.spacing.md=="number"?`${v.spacing.md}px`:v.spacing.md}`,fontWeight:500,lineHeight:1,userSelect:"none",cursor:c?"not-allowed":"pointer",border:"none",outline:"none",transition:"box-shadow .16s ease",color:v.text.primary,background:"transparent",whiteSpace:"nowrap"},Te=l==="subtle"?{background:v.surface.subtleBg}:l==="outlined"?{background:v.surface.panelBg,border:`1px solid ${v.surface.border}`}:{background:"transparent"},we={flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",textAlign:"left",gap:8},he={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},je={flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:500,display:"block"},Z=jsx(ChevronsUpDown,{size:16,css:css({color:v.text.secondary,flexShrink:0}),strokeWidth:2.5,className:"plainframe-ui-select-chevron"}),Ee=()=>{if(w)return w(ie);if(Array.isArray(ie)){let ue=ie.map(fe=>typeof fe=="string"?fe:"").filter(Boolean),de=ue.length?ue.join(", "):String(r);return jsxs(Fragment,{children:[s&&jsx("span",{css:css(he),children:s}),jsx("span",{css:css(je),title:de,children:de})]})}let j=ie??String(r);return jsxs(Fragment,{children:[s&&jsx("span",{css:css(he),children:s}),jsx("span",{css:css(je),title:typeof j=="string"?j:void 0,children:j})]})},Q={left:"start",center:"center",right:"end"},ee=j=>{c||(j.key==="ArrowDown"||j.key==="ArrowUp"||j.key==="Enter"||j.key===" ")&&(j.preventDefault(),h(true));},se={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",marginRight:8},pe={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",marginLeft:8},Se={flex:"1 1 auto",minWidth:0,display:"flex",flexDirection:"column",gap:2},Ne={fontWeight:500,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word"},J={fontSize:"0.875em",color:v.text.secondary,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400},oe=(j,ue)=>{let de=j.title||j.description?jsxs("span",{className:"plainframe-ui-select-option-content",css:css(Se),children:[jsx("span",{className:"plainframe-ui-select-option-title",css:css(Ne),children:j.title??ue}),j.description&&jsx("span",{className:"plainframe-ui-select-option-description",css:css(J),children:j.description})]}):jsx("span",{className:"plainframe-ui-select-option-text",css:css(Ne),children:ue});return jsxs(Fragment,{children:[j.startIcon&&jsx("span",{css:css(se),children:j.startIcon}),de,j.endIcon&&jsx("span",{css:css(pe),children:j.endIcon})]})},re=(j,ue)=>{let de=j.value,fe=le(de),ze=Fo(p,j.itemCss),Oe=j.el.props,st=typeof Oe.children>"u"?j.labelText??String(de):Oe.children;if(Y||j.isCheckbox)return me.cloneElement(j.el,{key:j.key??ue,disabled:c||j.disabled,checked:!!Oe.checked||fe,onCheckedChange:()=>Re(de),closeOnSelect:false,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)});if(j.isRadio)return me.cloneElement(j.el,{key:j.key??ue,value:de,disabled:c||j.disabled,closeOnSelect:false,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)});let Ye=yt=>{yt?.preventDefault?.(),be(de);};return me.cloneElement(j.el,{key:j.key??ue,role:"menuitem","aria-checked":void 0,"aria-selected":fe||void 0,"aria-disabled":c||j.disabled||void 0,disabled:c||j.disabled,closeOnSelect:true,onSelect:Ye,onClick:Ye,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)})},qe=(()=>{let j=!Y&&(z||U.length>0&&U.every(ue=>ue.isRadio));return z?me.cloneElement(z,{key:"controlled-inner-group",value:E,onValueChange:ue=>Pe(ue),children:U.map(re)}):j?jsx(lr,{value:E,onValueChange:ue=>Pe(ue),children:U.map(re)}):U.map(re)})();return jsxs("div",{css:Fo(Ce,I),className:["plainframe-ui-select-wrapper",C||""].join(" ").trim(),children:[o&&jsx("div",{id:K,className:"plainframe-ui-select-label",css:Fo({marginBottom:6,fontSize:v.typography.sizes.sm,fontWeight:500,color:v.text.secondary},x),children:o}),jsxs($n,{size:P,open:M,onOpenChange:h,children:[jsx(zn,{width:"100%",asChild:true,children:jsxs("button",{type:"button",disabled:c,"aria-haspopup":"menu","aria-expanded":M||void 0,"aria-controls":O,"aria-labelledby":o?K:void 0,onKeyDown:ee,onClick:()=>h(!M),className:"plainframe-ui-select-trigger",css:Fo(css(Ie),css(Te),R,N()),children:[jsx("div",{className:"plainframe-ui-select-trigger-content",css:css(we),children:Ee()}),i??Z]})}),jsx(hn,{id:O,gap:"xs",align:Q[y],sameWidth:f==null,width:f??d,className:"plainframe-ui-select-menu",css:Fo({maxHeight:typeof T=="number"?`${T}px`:T,overflowY:"auto"},g),children:qe})]})]})}var Zs=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Sf=keyframes`
13
+ `,_c=e=>e.startsWith("#")||e.startsWith("rgb(")||e.startsWith("rgba(")||e.startsWith("hsl(")||e.startsWith("hsla(")||e.startsWith("oklch(")||e.startsWith("lab(")||e.startsWith("color(")||e.startsWith("var("),jc=new Set(["0","50","100","200","300","400","500","600","700","800","900"]);function Vc(e,t){if(!t||t.trim()==="")return e.text.primary;let n=t.trim();if(_c(n))return n;let o=n.match(/^([a-zA-Z0-9_-]+)[\.\-:\s]?([0-9]{1,3})?$/);if(o){let r=o[1],s=o[2]&&jc.has(o[2])?o[2]:"600";if(r==="primary"&&e.palette.primary?.[s])return e.palette.primary[s];let a=e.palette[r];if(a&&a[s]!=null)return a[s];if(r==="neutral"||r==="secondary"&&e.neutral[s]!=null)return e.neutral[s]}return e.palette.primary[600]}var no=me.memo(({variant:e="circular",value:t,min:n=0,max:o=100,color:r,size:s,thickness:a,spinDuration:c=.75,wrapperCss:i,trackCss:l,barCss:u,circleCss:d,"aria-label":y})=>{let f=V(),T=typeof t=="number",I=Math.max(o-n,1),x=T?qa(t,n,o):void 0,R=T?(x-n)/I*100:void 0,g=Vc(f,r),p=f.surface.subtleBg,m=f.radius?.md;return e==="circular"?jsx(qc,{size:s,active:g,isDeterminate:T,percent:R,spinDuration:c,wrapperCss:i,trackCss:l,circleCss:d,ariaLabel:y,thickness:a}):jsx(Uc,{thickness:a,active:g,track:p,radius:m,isDeterminate:T,percent:R,wrapperCss:i,trackCss:l,barCss:u,ariaLabel:y,min:n,max:o,value:x})}),Uc=({thickness:e=4,active:t,track:n,radius:o,isDeterminate:r,percent:s,wrapperCss:a,trackCss:c,barCss:i,ariaLabel:l,min:u,max:d,value:y})=>{let f=o==null?"8px":typeof o=="number"?`${o}px`:String(o),T=css([{display:"inline-block",width:"100%"},...Array.isArray(a)?a:a?[a]:[]]),I=css([{position:"relative",width:"100%",height:ns(e,"6px"),backgroundColor:n,borderRadius:f,overflow:"hidden"},...Array.isArray(c)?c:c?[c]:[]]),x=r?Math.max(s??0,Ua):Ua,R=css([{position:"absolute",inset:0,backgroundColor:t,borderRadius:"inherit",transformOrigin:"left",transform:`scaleX(${x/100})`,transition:"transform 160ms cubic-bezier(.2,0,.2,1)",willChange:"transform"},...Array.isArray(i)?i:i?[i]:[]]),g={position:"absolute",top:0,bottom:0,backgroundColor:t,borderRadius:"inherit",willChange:"left,right","@media (prefers-reduced-motion: reduce)":{animation:"none"}},p=css([{...g,left:"-35%",right:"100%",animation:`${Wc} 2.1s cubic-bezier(.65,.815,.735,.395) infinite`},...Array.isArray(i)?i:i?[i]:[]]),m=css([{...g,left:"-200%",right:"100%",animation:`${Kc} 2.1s cubic-bezier(.165,.84,.44,1) 1.15s infinite`},...Array.isArray(i)?i:i?[i]:[]]),C=r?{role:"progressbar","aria-valuemin":u,"aria-valuemax":d,"aria-valuenow":y}:{role:"progressbar","aria-busy":true};return l&&(C["aria-label"]=l),jsx("span",{css:T,...C,children:jsx("div",{className:"plainframe-ui-progress-linear-track",css:I,children:r?jsx("div",{className:"plainframe-ui-progress-linear-fill",css:R}):jsxs(Fragment,{children:[jsx("div",{className:"plainframe-ui-progress-linear-runner1",css:p}),jsx("div",{className:"plainframe-ui-progress-linear-runner2",css:m})]})})})},qc=({size:e,thickness:t=4,active:n,isDeterminate:o,percent:r,spinDuration:s,wrapperCss:a,trackCss:c,circleCss:i,ariaLabel:l})=>{let u=V(),d=40,y=(d-t)/2,f=2*Math.PI*y,I=`${(o?qa((r??0)/100,.01,1):.7)*f} ${f}`,x=css([{display:"inline-block",width:ns(e,`${u.componentHeights.md}`),height:ns(e,`${u.componentHeights.md}`)},...Array.isArray(a)?a:a?[a]:[]]),R=css([{width:"100%",height:"100%",transform:"rotate(-90deg)",transformBox:"fill-box",transformOrigin:"50% 50%"},...Array.isArray(c)?c:c?[c]:[]]),g=css([{stroke:n,strokeLinecap:"butt",strokeDasharray:I,strokeDashoffset:0,transition:o?"stroke-dasharray 160ms cubic-bezier(.2,0,.2,1)":"none",transformBox:"fill-box",transformOrigin:"50% 50%",fill:"none",willChange:o?"stroke-dasharray":"transform",animation:o?"none":`${Oc} ${s}s linear infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}},...Array.isArray(i)?i:i?[i]:[]]),p=o?{role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r??0)}:{role:"progressbar","aria-busy":true};return l&&(p["aria-label"]=l),jsx("span",{css:x,className:"plainframe-ui-progress-circular",...p,children:jsx("svg",{css:R,viewBox:`0 0 ${d} ${d}`,focusable:"false","aria-hidden":true,children:jsx("circle",{cx:d/2,cy:d/2,r:y,strokeWidth:t,css:g})})})};var Ya=createContext(null),Ja=()=>{let e=useContext(Ya);if(!e)throw new Error("AlertTitle and AlertDescription must be used inside <Alert>.");return e},ou=css({display:"flex",flexDirection:"column",textAlign:"left",minWidth:0,flex:1}),ru=css({lineHeight:0,display:"flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto"}),su=css({display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",padding:0,cursor:"pointer",lineHeight:0,transition:"opacity 140ms ease","&:disabled":{cursor:"not-allowed",opacity:.5}}),Za=forwardRef(function({intent:t="neutral",variant:n="soft",intentIcon:o,closeIcon:r,onClose:s,width:a="100%",size:c="md",loading:i=false,css:l,children:u,...d},y){let f=V(),T=useId(),I=useId(),x=useMemo(()=>{let F={sm:{paddingX:f.spacing?.md,paddingY:f.spacing?.md,gap:f.spacing?.sm,radius:f.radius?.md,fontSize:f.typography?.sizes?.xs,titleWeight:600,iconSize:16},md:{paddingX:f.spacing?.lg,paddingY:f.spacing?.lg,gap:f.spacing?.md,radius:f.radius?.md,fontSize:f.typography?.sizes?.sm,titleWeight:600,iconSize:20},lg:{paddingX:f.spacing?.lg,paddingY:f.spacing?.lg,gap:f.spacing?.md,radius:f.radius?.md,fontSize:f.typography?.sizes?.md,titleWeight:600,iconSize:24}};return ["sm","md","lg"].includes(c)?F[c]:F.md},[c,f.typography,f.radius,f.spacing]),R=f.palette??{},g=f.neutral??{},p=useMemo(()=>{let M=(E=>E==="danger"?R.danger??R.error??g:E==="warning"?R.warning??g:E==="success"?R.success??g:E==="info"?R.info??R.primary??g:g)(t),b=M?.[50]??g[50],h=M?.[300]??g[300],A=M?.[600]??M?.[500]??g[600],D=M?.[700]??A,L=M?.[800]??f.text?.primary??"#000",k=f.text?.onColors?.[t]??f.text?.onColors?.primary??f.text?.primary??"#fff";return n==="filled"?{bg:A,fg:k,border:void 0,iconColor:k}:n==="outlined"?{bg:b,fg:L,border:`1px solid ${h}`,iconColor:L}:n==="ghost"?{bg:"transparent",fg:D,border:"none",iconColor:D}:{bg:b,fg:L,border:void 0,iconColor:D}},[t,n,g,R,f.text]),m=t==="danger"||t==="warning"?"alert":"status",C=useMemo(()=>i?jsx(no,{variant:"circular",color:p.iconColor,size:x.iconSize/1.25,thickness:4.5}):o??(t==="danger"?jsx(CircleAlert,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):t==="warning"?jsx(TriangleAlert,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):t==="success"?jsx(CircleCheckBig,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor}):jsx(Info,{css:{width:x.iconSize,height:x.iconSize},color:p.iconColor})),[i,o,t,x.iconSize,p.iconColor]),P=useMemo(()=>css({display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:`${x.paddingY} ${x.paddingX}`,gap:x.gap,borderRadius:x.radius,backgroundColor:p.bg,color:p.fg,border:p.border,fontSize:x.fontSize,fontWeight:500,maxWidth:typeof a=="number"?`${a}px`:a,width:"100%"}),[p.bg,p.border,p.fg,x.fontSize,x.gap,x.paddingX,x.paddingY,x.radius,a]),w=useMemo(()=>css({display:"flex",alignItems:"flex-start",gap:x.gap,minWidth:0,flex:1}),[x.gap]),v=useMemo(()=>[ru,{color:p.iconColor}],[p.iconColor]),N=useMemo(()=>css({display:"flex",alignItems:"center",gap:x.gap,marginLeft:x.gap,flex:"0 0 auto"}),[x.gap]),B=useMemo(()=>[su,{color:p.fg}],[p.fg]),K=useMemo(()=>({fg:p.fg,iconColor:p.iconColor,s:x,titleId:T,descId:I}),[p.fg,p.iconColor,x,T,I]),O=me.Children.toArray(u).some(F=>me.isValidElement(F)&&F.type===ss),S=me.Children.toArray(u).some(F=>me.isValidElement(F)&&F.type===as);return jsx(Ya.Provider,{value:K,children:jsxs("div",{ref:y,role:m,"aria-live":m==="alert"?"assertive":"polite","aria-atomic":"true","aria-busy":i,"aria-labelledby":O?T:void 0,"aria-describedby":S?I:void 0,className:`plainframe-ui-alert plainframe-ui-alert-${t} plainframe-ui-alert-${n}`,css:[P,l],...d,children:[jsxs("div",{className:"plainframe-ui-alert-left",css:w,children:[C&&jsx("span",{className:"plainframe-ui-alert-icon",css:v,children:C}),jsx("div",{className:"plainframe-ui-alert-content",css:ou,children:u})]}),s&&jsx("div",{className:"plainframe-ui-alert-actions",css:N,children:jsx("button",{type:"button","aria-label":"Close alert",onClick:s,disabled:i,className:"plainframe-ui-alert-close",css:B,children:r??jsx(X,{strokeWidth:2,size:x.iconSize-2})})})]})})});Za.displayName="Alert";var ss=forwardRef(function({children:t,css:n,...o},r){let{fg:s,s:a,titleId:c}=Ja(),i=useMemo(()=>css({color:s,fontWeight:a.titleWeight,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),[s,a.titleWeight]);return jsx("span",{ref:r,id:c,className:"plainframe-ui-alert-title",css:[i,n],...o,children:t})});ss.displayName="AlertTitle";var as=forwardRef(function({children:t,css:n,...o},r){let{fg:s,descId:a}=Ja(),c=useMemo(()=>css({color:s,marginTop:2,lineHeight:1.35,wordBreak:"break-word"}),[s]);return jsx("span",{ref:r,id:a,className:"plainframe-ui-alert-desc",css:[c,n],...o,children:t})});as.displayName="AlertDescription";var is=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Gt=e=>e==null?[]:Array.isArray(e)?e:[e],Xt=(...e)=>css(e.filter(Boolean));function ei(e,t,n="currentColor"){if(!isValidElement(e))return e;let o=e.props,r={};o.size==null&&(r.size=t),o.color==null&&(r.color=n);let s=o.style;return s?.fontSize==null&&(r.style={...s||{},fontSize:t}),cloneElement(e,{...o,...r})}var Qo=me.memo(forwardRef(function({label:t,value:n,defaultValue:o="",onChange:r,placeholder:s,error:a,helperText:c,disabled:i=false,fullWidth:l=false,width:u=250,size:d="md",variant:y="subtle",rounded:f=false,startIcon:T,endIcon:I,togglePasswordVisible:x=false,showClear:R,type:g="text",step:p,focusRingMode:m="always",className:C,wrapperCss:P,inputCss:w,labelCss:v,helperRowCss:N,helperTextCss:B,startIconCss:K,endIconCss:O,css:S,onBlur:F,onFocus:M,onKeyDown:b,autoFocus:h,name:A,id:D,tabIndex:L,autoComplete:k,readOnly:E,required:W,maxLength:$,onSurfaceClick:z},_){let H=V(),U=Yo(),X$1=useId(),ae=useMemo(()=>{let ce={sm:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.sm,labelFont:H.typography.sizes.xs,helperFont:H.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:21},md:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.md,labelFont:H.typography.sizes.sm,helperFont:H.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:24},lg:{fontSize:H.typography.sizes.sm,minHeight:H.componentHeights.lg,labelFont:H.typography.sizes.md,helperFont:H.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:H.spacing.md,iconSize:H.typography.sizes.xs,codeFontSize:28}},ke=["sm","md","lg"].includes(d)?d:"md";return ce[ke]},[d,H]),q=H.neutral,Y=H.text,le=g==="number",ie=g==="password",be=n!==void 0,[Pe,Re]=useState(o),Ce=be?n:Pe,Ie=useCallback(ce=>{be||Re(ce),r?.(ce);},[be,r]),Te=/^-?\d*(?:[.,]\d*)?$/,we=le&&(p!=null&&String(p).includes(".")||/[.,]/.test(Ce??"")),he=le?we?"decimal":"numeric":void 0,je=le?we?"[0-9]*[.,]?[0-9]*":"[0-9]*":void 0,Z=useCallback(ce=>{(ce===""||Te.test(ce))&&Ie(ce);},[Ie]),Ee=i?q[200]:a&&y==="outlined"?H.palette.danger?.[50]??H.surface.panelBg:a&&y==="subtle"?H.palette.danger?.[50]??H.surface.subtleBg:y==="outlined"?H.surface.panelBg:y==="subtle"?H.surface.subtleBg:"transparent",Q=H.componentHeights.border,ee=y==="outlined"?`${Q} solid ${a?H.palette.danger?.[300]??H.surface.border:H.surface.border}`:"none",se=Xt({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:l?"100%":u!=null?is(u):void 0,flex:"0 0 auto",fontWeight:500}),pe=useMemo(()=>Xt({fontSize:ae.labelFont,fontWeight:500,color:a?H.palette.danger?.[700]??Y.primary:i?q[500]:Y.primary,marginBottom:4,display:"inline-block"},...Gt(v)),[ae.labelFont,a,i,q,Y,H.palette.danger,v]),Se=useMemo(()=>Xt({display:"flex",alignItems:"center",gap:H.spacing.sm,padding:`${is(ae.paddingY)} ${is(ae.paddingX)}`,background:Ee,border:ee,borderRadius:f?H.radius.full:H.radius.md,minHeight:ae.minHeight,boxSizing:"border-box",width:"100%",cursor:i?"not-allowed":"text",opacity:i?.65:1,transition:"box-shadow .18s, border-color .16s"},...Gt(P),...Gt(S)),[H,ae.minHeight,ae.paddingX,ae.paddingY,Ee,ee,f,i,P,S]),Ne=useMemo(()=>Xt({flex:1,minWidth:0,fontSize:ae.fontSize,fontWeight:500,fontFamily:"inherit",color:i?q[500]:a?H.palette.danger?.[800]??Y.primary:Y.primary,background:"transparent",border:"none",outline:"none",padding:0,lineHeight:1.25,cursor:i?"not-allowed":"text",appearance:le?"textfield":"auto","&::placeholder":{color:a?H.palette.danger?.[700]??Y.secondary:Y.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${a?H.palette.danger?.[800]??Y.primary:Y.primary} !important`,boxShadow:`0 0 0 1000px ${Ee} inset !important`,transition:"opacity 99999s ease-out",caretColor:a?H.palette.danger?.[800]??Y.primary:Y.primary},":focus-within":{outline:"none",border:"none",boxShadow:"none"}},...Gt(w)),[ae.fontSize,i,q,Y,a,H.palette.danger,le,Ee,w]),J=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:a?H.palette.danger?.[800]??Y.secondary:Y.secondary,marginLeft:-3},...Gt(K)),[a,H.palette.danger,Y.secondary,K]),oe=useMemo(()=>Xt({display:"inline-flex",alignItems:"center",color:a?H.palette.danger?.[800]??Y.secondary:Y.secondary,border:"none",background:"transparent",lineHeight:0,cursor:"inherit",padding:0},...Gt(O)),[a,H.palette.danger,Y.secondary,i,O]),re=useMemo(()=>Xt({minHeight:16,fontSize:ae.helperFont,color:a?H.palette.danger?.[700]??Y.secondary:Y.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Gt(N)),[ae.helperFont,a,H.palette.danger,Y.secondary,N]),qe=useMemo(()=>Xt({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400},...Gt(B)),[B]),j=useRef(null),ue=useCallback(ce=>{j.current=ce,_&&(typeof _=="function"?_(ce):_.current=ce);},[_]),de=useCallback(ce=>{let ke=ce.target.value;if(le){Z(ke);return}$&&ke.length>$||Ie(ke);},[le,$,Ie,Z]),[fe,ze]=useState(false),Oe=useCallback(()=>{i||ze(ce=>!ce);},[i]),st=useCallback(()=>{i||(Ie(""),j.current?.focus());},[i,Ie]),Ye=useMemo(()=>{let ce=ae.fontSize;if(typeof ce=="number")return ce;let ke=parseFloat(String(ce));return Number.isFinite(ke)?ke:16},[ae.fontSize]),yt=useMemo(()=>T?jsx("span",{css:J,children:ei(T,Ye)}):null,[T,J,Ye]),tn=useMemo(()=>css({display:"flex",alignItems:"center",gap:4}),[]),nn=useMemo(()=>{let ce=[];if(ie&&x){let bt=fe?jsx(Eye,{strokeWidth:2.5,size:Ye}):jsx(EyeOff,{strokeWidth:2.5,size:Ye});ce.push(jsx("button",{type:"button",css:oe,onMouseDown:Zn=>Zn.preventDefault(),onClick:Zn=>{Zn.stopPropagation(),Oe();},tabIndex:-1,"aria-label":fe?"Hide password":"Show password",disabled:i,children:bt},"pw-toggle"));}R&&Ce&&Ce.length>0&&!i&&ce.push(jsx("button",{type:"button",css:oe,onMouseDown:bt=>bt.preventDefault(),onClick:bt=>{bt.stopPropagation(),st();},tabIndex:-1,"aria-label":"Clear",children:jsx(X,{strokeWidth:2.5,size:Ye})},"clear"));let ke=I?jsx("span",{css:oe,children:ei(I,Ye)},"user-end"):null,at=ce.length>0,De=!!ke;return !at&&!De?null:!at&&De?ke:at&&!De?ce.length===1?ce[0]:jsx("span",{css:tn,children:ce}):jsxs("span",{css:tn,children:[ce,ke]})},[ie,x,fe,Ye,oe,tn,i,R,Ce,I,Oe,st]),Sn=c!=null?`${D??X$1}-help`:void 0,on=D??X$1,Je=useCallback(ce=>{if(i)return;ce.stopPropagation();let ke=j.current;if(!ke)return;let at=ce.target;if(!(ke.contains(at)||at.closest("button,[role='button']"))){if(document.activeElement===ke){ce.preventDefault();return}ce.preventDefault();}},[i]),xt=useCallback(ce=>{if(i)return;let ke=j.current;if(ke&&(z?.(ce),document.activeElement!==ke)){ke.focus({preventScroll:true});try{let at=ke.value?.length??0;ke.setSelectionRange?.(at,at);}catch{}}},[i,z]);return jsxs("div",{className:["plainframe-ui-textfield",C||""].join(" ").trim(),css:se,children:[t&&jsx("label",{htmlFor:on,className:"plainframe-ui-textfield-label",css:pe,children:t}),jsxs("div",{className:"plainframe-ui-textfield-surface",css:[U({enabled:m!=="none",color:a?"danger":void 0}),Se],onPointerDownCapture:Je,onClick:xt,"aria-invalid":!!a||void 0,children:[yt,jsx("input",{ref:ue,id:on,className:"plainframe-ui-textfield-input",css:Ne,type:ie?fe?"text":"password":g==="number"?"text":g,inputMode:he,pattern:je,value:Ce,maxLength:le?void 0:$,onChange:le?ce=>Z(ce.target.value):de,placeholder:s||"",disabled:i,onBlur:F,onFocus:M,onKeyDown:b,autoFocus:h,name:A,tabIndex:L,autoComplete:k,readOnly:E,required:W,"aria-invalid":!!a||void 0,"aria-describedby":Sn}),nn]}),c!=null&&jsx("div",{className:"plainframe-ui-textfield-helper-row",css:re,children:jsx("span",{id:Sn,className:"plainframe-ui-textfield-helper-text",css:qe,children:c})})]})}));Qo.displayName="TextField";var er=me.createContext("ghost"),Tt=me.createContext(false),si=forwardRef(function({variant:t="ghost",size:n="md",width:o,maxHeight:r,unstyled:s=false,className:a,css:c,children:i,label:l,allItemsTabbable:u=false,...d},y){let f=V(),[T,I]=useState(false),x=useRef(null),R=typeof f.spacing.xs=="number"?`${f.spacing.xs}px`:String(f.spacing.xs),g=t==="outlined"?f.surface.panelBg:t==="subtle"?f.surface.subtleBg??f.neutral[50]:"transparent",p=s?void 0:css({background:g,border:t==="outlined"?`${f.componentHeights.border} solid ${f.surface.border}`:"none",borderRadius:f.radius.lg,"--pfui-panel-pad":R,padding:t==="ghost"?0:"var(--pfui-panel-pad)",color:f.text.primary,width:"100%",maxHeight:r,overflowY:r!=null?"auto":void 0,display:"flex",flexDirection:"column",outline:"none",position:"relative","&[data-keyboard-nav]":{cursor:"none"},"&[data-keyboard-nav] *":{cursor:"none !important",pointerEvents:"none"}}),m=n==="sm",C=useMemo(()=>({isKeyboardNav:T,setIsKeyboardNav:I}),[T]),P=useMemo(()=>({allItemsTabbable:u}),[u]),w=useCallback(M=>Array.from(M.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(b=>{if(b.closest('[role="menu"]')!==M)return false;let h=window.getComputedStyle(b);return h.display!=="none"&&h.visibility!=="hidden"}),[]),v=useCallback(M=>{M.removeAttribute("data-keyboard-nav"),M.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),I(false);},[]),N=useRef(false),B=useCallback(M=>{if(M.target!==M.currentTarget)return;if(N.current){N.current=false;return}let b=M.currentTarget,h=w(b);h.length>0&&(I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(A=>A.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(A=>A.removeAttribute("data-hovered")),h[0].setAttribute("data-highlighted",""),h[0].focus({preventScroll:true}));},[w]),K=useCallback(M=>{let b=M.currentTarget,h=w(b);if(h.length===0)return;if(M.key==="Tab"){N.current=true,b.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),I(false),b.tabIndex=-1,requestAnimationFrame(()=>{b.tabIndex=0,N.current=false;});return}let A=b.querySelector("[data-highlighted]"),D=b.querySelector("[data-hovered]"),L=A||D,k=L?h.indexOf(L):-1;if(M.key==="ArrowDown"||M.key==="ArrowUp"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach($=>$.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach($=>$.removeAttribute("data-hovered")),k===-1&&(k=M.key==="ArrowDown"?-1:h.length);let E=M.key==="ArrowDown"?1:-1,W=(k+E+h.length)%h.length;h[W].setAttribute("data-highlighted",""),h[W].focus({preventScroll:true});return}if(M.key==="Home"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),h[0].setAttribute("data-highlighted",""),h[0].focus({preventScroll:true});return}if(M.key==="End"){M.preventDefault(),M.stopPropagation(),I(true),b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(E=>E.removeAttribute("data-hovered")),h[h.length-1].setAttribute("data-highlighted",""),h[h.length-1].focus({preventScroll:true});return}if(M.key==="Escape"){M.preventDefault(),b.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted")),I(false),b.blur();return}},[w]),O=useCallback(M=>{let b=M.currentTarget;b.hasAttribute("data-keyboard-nav")&&v(b);},[v]),S=useCallback(M=>{let b=M.currentTarget;b.hasAttribute("data-keyboard-nav")&&v(b);},[v]),F=useCallback(M=>{x.current=M,typeof y=="function"?y(M):y&&(y.current=M);},[y]);return jsx(oo.Provider,{value:C,children:jsx(ro.Provider,{value:P,children:jsx(Tt.Provider,{value:m,children:jsx(er.Provider,{value:t,children:jsxs("div",{css:{display:"flex",flexDirection:"column",gap:f.spacing.sm,width:"100%",maxWidth:o},children:[l?jsx("div",{css:{width:"100%",textAlign:"left"},children:jsx("span",{css:{display:"block",color:f.text.secondary,fontSize:f.typography.sizes.xs,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",padding:typeof f.spacing.sm=="number"?`${f.spacing.sm}px`:f.spacing.sm,paddingTop:0},children:l})}):null,jsx("div",{ref:F,role:"menu","data-keyboard-nav":T?"":void 0,tabIndex:0,"aria-label":l||void 0,className:["plainframe-ui-menu",a||""].join(" ").trim(),css:[p,c],onFocus:B,onKeyDown:K,onPointerMove:O,onPointerDown:S,...d,children:i})]})})})})})});si.displayName="Menu";var ii=createContext(null),or=()=>{let e=useContext(ii);if(!e)throw new Error("Popover components must be used inside <Popover>.");return e};function Du(e,t){e&&(typeof e=="function"?e(t):e.current=t);}var io=(...e)=>t=>{for(let n of e)Du(n,t);},cs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Hu=e=>{useEffect(()=>{if(!e||typeof document>"u"||typeof window>"u")return;let t=document.body,n=t.style.overflow,o=t.style.paddingRight,r=window.innerWidth-document.documentElement.clientWidth,s=parseFloat(getComputedStyle(t).paddingRight||"0");return t.style.overflow="hidden",r>0&&(t.style.paddingRight=`${s+r}px`),()=>{t.style.overflow=n,t.style.paddingRight=o;}},[e]);},tr=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"&&t&&e in t){let n=t[e];return typeof n=="number"?`${n}px`:String(n)}return e}},Lu=({open:e,defaultOpen:t,onOpenChange:n,triggerOn:o="click",lockScroll:r=true,trapFocus:s=true,children:a})=>{let[c,i]=useState(!!t),l=e??c,u=x=>{e===void 0&&i(x),n?.(x);},d=useRef(null),y=useRef(null),f=(x=120)=>{y.current!=null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>u(false),x);},T=()=>{y.current!=null&&(window.clearTimeout(y.current),y.current=null);};Hu(r&&l),useEffect(()=>{if(!s||!l||typeof document>"u")return;let x=R=>{if(R.key!=="Tab")return;let g=document.querySelector(".plainframe-ui-popover");if(!g)return;let p=Array.from(g.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(w=>{let v=window.getComputedStyle(w);return v.display!=="none"&&v.visibility!=="hidden"});if(p.length===0)return;let m=p[0],C=p[p.length-1],P=document.activeElement;R.shiftKey&&P===m?(R.preventDefault(),C.focus()):!R.shiftKey&&P===C&&(R.preventDefault(),m.focus());};return document.addEventListener("keydown",x,true),()=>document.removeEventListener("keydown",x,true)},[s,l]);let I=useMemo(()=>({open:l,setOpen:u,triggerOn:o,referenceRef:d,scheduleClose:f,cancelClose:T}),[l,o]);return jsx(ii.Provider,{value:I,children:a})},li=forwardRef(({asChild:e=true,children:t,css:n},o)=>{let{open:r,setOpen:s,triggerOn:a,referenceRef:c,scheduleClose:i,cancelClose:l}=or(),u=me.Children.only(t),d=u.props||{},y=io(c,o,u.ref),f=a==="click"?{onClick:I=>{I.stopPropagation(),s(!r),d.onClick?.(I);}}:{onMouseEnter:I=>{l(),r||s(true),d.onMouseEnter?.(I);},onMouseLeave:I=>{i(),d.onMouseLeave?.(I);}},T={"aria-haspopup":"dialog","aria-expanded":r};if(e){let I=u.props?.css;return me.cloneElement(u,{...f,...T,ref:y,css:[I,n].filter(Boolean)})}return me.createElement("button",{ref:y,type:"button",css:[n],...f,...T,children:u})});li.displayName="PopoverTrigger";var ci=forwardRef(({asChild:e=true,width:t,css:n,children:o},r)=>{let{referenceRef:s}=or(),a=me.Children.only(o),c=io(s,r,a.ref);if(e){let l=a.props?.css;return me.cloneElement(a,{ref:c,css:[l,n].filter(Boolean)})}let i=css({display:"inline-block",width:cs(t),verticalAlign:"middle",...n});return jsx("span",{ref:c,css:i,children:a})});ci.displayName="PopoverAnchor";function Bu(e){let t=e?.vertical??"bottom",n=e?.horizontal??"center";if(t==="top"||t==="bottom"){let s=t,a=n==="left"?"start":n==="right"?"end":"center";return a==="center"?s:`${s}-${a}`}let o=n==="left"?"left":"right",r="center";return r==="center"?o:`${o}-${r}`}var ui=forwardRef(({anchorOrigin:e={vertical:"bottom",horizontal:"center"},sideOffset:t=8,alignOffset:n=0,collisionPadding:o=8,unstyled:r=false,children:s,width:a,height:c,padding:i,paddingX:l,paddingY:u,radius:d="lg",css:y,...f},T)=>{let{open:I,setOpen:x,triggerOn:R,referenceRef:g,scheduleClose:p,cancelClose:m}=or(),C=V(),P=Bu(e),{refs:w,x:v,y:N,strategy:B,context:K}=useFloating({open:I,onOpenChange:x,whileElementsMounted:autoUpdate,placement:P,strategy:"fixed",middleware:[offset({mainAxis:t,crossAxis:n}),flip({padding:o}),shift({padding:o})]});useEffect(()=>{g.current&&w.setReference(g.current);},[w,g]);let O=useDismiss(K,{outsidePressEvent:"pointerdown",escapeKey:true}),S=useRole(K,{role:"dialog"}),{getFloatingProps:F}=useInteractions([O,S]),[M]=K.placement.split("-"),b=M,h=`${b==="left"?"right":b==="right"?"left":"center"} ${b==="top"?"bottom":b==="bottom"?"top":"center"}`,A=8,D=b==="top"?{y:A}:b==="bottom"?{y:-A}:b==="left"?{x:A}:{x:-A},L={initial:{opacity:0,scale:.96,...D},animate:{opacity:1,scale:1,x:0,y:0},exit:{opacity:0,scale:.96,...D},transition:{scale:{type:"spring",stiffness:520,damping:32,mass:.5},x:{type:"spring",stiffness:420,damping:30,mass:.6},y:{type:"spring",stiffness:420,damping:30,mass:.6},opacity:{duration:.16,ease:"linear"}}},k=C.surface.panelBg,E=C.text.primary,W=`${C.componentHeights.border} solid ${C.surface.border}`,$=tr(i,C.spacing),z=tr(l,C.spacing),_=tr(u,C.spacing),H={};$&&(H.padding=$),z&&(H.paddingInline=z),_&&(H.paddingBlock=_);let U=tr(d,C.radius)??C.radius.md,X="0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)",ae=css({position:B,top:N??0,left:v??0,zIndex:1e3,transformOrigin:h,pointerEvents:"auto",display:"inline-flex",flexDirection:"column",width:cs(a)??"fit-content",height:cs(c)??"fit-content",boxSizing:"border-box",willChange:"opacity, transform"}),q=r?css({}):css({background:k,color:E,border:W,borderRadius:U,boxShadow:X,...H,...H.padding||H.paddingInline||H.paddingBlock?{}:{padding:typeof C.spacing?.sm=="number"?`${C.spacing.sm}px ${C.spacing.md}px`:`${C.spacing?.sm??"0.5rem"} ${C.spacing?.md??"1rem"}`}}),Y=R==="hover"?{onMouseEnter:m,onMouseLeave:()=>p()}:{},le=io(w.setFloating,T),ie=jsx(motion.div,{className:"plainframe-ui-popover",...F({...f,ref:le,...Y}),...L,css:[ae,q,y],children:s});return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:I?ie:null})})});ui.displayName="PopoverContent";var $u=()=>{let e=or();return {open:e.open,close:()=>e.setOpen(false),setOpen:e.setOpen}};var ms=me.memo(forwardRef(function({checked:t,defaultChecked:n=false,onChange:o,disabled:r=false,size:s="md",label:a,className:c,css:i,trackCss:l,thumbCss:u,labelCss:d,...y},f){let T=V(),I=xe(),x={sm:{trackW:25,trackH:16,thumb:11,labelGap:8},md:{trackW:35,trackH:20,thumb:14,labelGap:8},lg:{trackW:45,trackH:24,thumb:18,labelGap:10}},R={slideMs:250,pressMs:150,easing:"ease"},g=t!==void 0,[p,m]=useState(n),C=g?!!t:p,[P,w]=useState(false);useEffect(()=>{if(r)return;w(true);let z=setTimeout(()=>w(false),R.pressMs);return ()=>clearTimeout(z)},[C,r]);let v=["sm","md","lg"].includes(s)?s:"md",N=x[v],B=`${R.slideMs}ms ${R.easing}`,K=T.palette?.primary?.[600]??T.neutral[900],O=T.neutral[300],S=C?K:O,F=C?T.text.onColors.primary:"#ffffff",{trackW:M,trackH:b,thumb:h}=N,A=(b-h)/2,D=css({display:"inline-flex",alignItems:"center",gap:N.labelGap,cursor:r?"not-allowed":"pointer",width:"fit-content",padding:T.spacing.xs,borderRadius:T.radius.sm,outline:"none"}),L=css({position:"relative",width:M,height:b,backgroundColor:S,borderRadius:T.radius.xl,transition:`background-color ${B}, opacity 120ms ease`,willChange:"background-color",cursor:r?"not-allowed":"pointer",opacity:r?.5:1}),k=css({position:"absolute",top:A,left:C?M-h-A:A,width:h,height:h,backgroundColor:F,borderRadius:T.radius.xl,transition:`left ${B}, transform ${B}, background-color 0.25s ease`,transform:P?"scaleX(1.2)":"scaleX(1)",transformOrigin:C?"right center":"left center"}),E=css({fontSize:T.typography.sizes.sm,fontWeight:500,color:r?T.text.muted:T.text.primary}),W=()=>{if(r)return;let z=!C;g||m(z),o?.(z);};return jsxs("label",{ref:f,role:"switch","aria-checked":C,"aria-disabled":r||void 0,"data-checked":C?"":void 0,"data-disabled":r?"":void 0,tabIndex:r?-1:0,onClick:W,onKeyDown:z=>{r||(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),W());},className:["plainframe-ui-switch",c||""].join(" ").trim(),css:[D,I({color:C?"primary":"neutral"}),i],...y,children:[jsx("div",{className:"plainframe-ui-switch-track",css:[L,l],children:jsx("div",{className:"plainframe-ui-switch-thumb",css:[k,u]})}),a!=null&&jsx("span",{className:"plainframe-ui-switch-label",css:[E,d],children:a})]})}));var Uu=(e,t)=>t==="sm"?{box:16,labelFont:e.typography.sizes.xs,gap:8,borderRadius:e.radius.xxs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75}:t==="lg"?{box:24,labelFont:e.typography.sizes.md,gap:8,borderRadius:e.radius.xs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75}:{box:20,labelFont:e.typography.sizes.sm,gap:8,borderRadius:e.radius.xs,borderWidth:e.componentHeights.border,iconRatioW:.7,iconRatioH:.75},sr=me.memo(forwardRef(({checked:e,defaultChecked:t=false,onChange:n,disabled:o=false,size:r="md",label:s,description:a,rounded:c=false,checkedIcon:i,color:l="primary",css:u,boxCss:d,checkCss:y,labelCss:f,descriptionCss:T,className:I,...x},R)=>{let g=V(),p=xe(),m=typeof e=="boolean",[C,P]=useState(t),w=m?e:C,v=r==="sm"||r==="lg"?r:"md",N=useMemo(()=>Uu(g,v),[g,v]),{checkedBg:B,checkColor:K,borderCol:O,hoverBg:S,gapPx:F}=useMemo(()=>{let z=g.palette||{},_=g.neutral||{},H=g.text?.onColors||{},U,X;l==="neutral"||l==="secondary"?(U=_,X="neutral"):typeof l=="string"&&Object.prototype.hasOwnProperty.call(z,l)?(U=z[l]||z.primary||_,X=l):(U=z.primary||_,X="primary");let ae=U[600]??U[500]??U[400]??Object.values(U)[0]??g.palette.primary[600],q=H[X]??H.primary??g.text?.onColors?.primary??g.text.primary,Y=typeof N.gap=="number"?N.gap+2:N.gap;return {checkedBg:ae,checkColor:q,borderCol:g.surface.border,hoverBg:g.surface.panelHover,gapPx:Y}},[N.gap,l,g]),M=useMemo(()=>css({display:"inline-flex",alignItems:s&&a?"flex-start":"center",gap:F,cursor:o?"not-allowed":"pointer",userSelect:"auto",position:"relative",width:"fit-content",borderRadius:g.radius.sm,padding:g.spacing.xs,transition:"background-color .16s ease, color .16s ease, opacity .16s ease",'&:not([data-disabled="true"]):hover input:not(:checked) + .plainframe-ui-checkbox-box':{outlineColor:O,backgroundColor:S},"input:checked + .plainframe-ui-checkbox-box":{backgroundColor:B,outlineColor:B,"--pfui-bleed":B},'&:not([data-disabled="true"]):hover input:checked + .plainframe-ui-checkbox-box':{outlineColor:B,backgroundColor:B,"--pfui-bleed":B},".plainframe-ui-checkbox-check":{opacity:0,transform:"scale(0.2)"},"input:checked + .plainframe-ui-checkbox-box .plainframe-ui-checkbox-check":{opacity:1,transform:"scale(1)"}}),[O,B,a,o,F,S,s,g.radius.sm,g.spacing.xs]),b=useMemo(()=>css({position:"absolute",opacity:0,width:0,height:0,margin:0,padding:0,pointerEvents:"none"}),[]),h=useMemo(()=>css({width:N.box,height:N.box,display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",outline:`${N.borderWidth} solid ${O}`,outlineOffset:`-${N.borderWidth}`,boxShadow:"inset 0 0 0 0.5px var(--pfui-bleed, transparent)",borderRadius:c?g.radius.full:N.borderRadius,transition:"background-color .16s ease, outline-color .05s ease, box-shadow .16s ease, transform .16s ease",flex:"0 0 auto",verticalAlign:"middle",overflow:"hidden",transform:"translateZ(0)",backfaceVisibility:"hidden"}),[N.box,N.borderRadius,N.borderWidth,O,c,g.radius.full]),A=useMemo(()=>({w:Math.round(N.box*N.iconRatioW),h:Math.round(N.box*N.iconRatioH)}),[N.box,N.iconRatioH,N.iconRatioW]),D=useMemo(()=>css({width:A.w,height:A.h,transition:"opacity .14s ease, transform .14s ease",color:K,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:0,pointerEvents:"none","& > svg, & > img":{width:"100%",height:"100%",display:"block"}}),[K,A.h,A.w]),L=useMemo(()=>css({display:"flex",flexDirection:"column",minWidth:0,userSelect:"text",WebkitUserSelect:"text"}),[]),k=useMemo(()=>css({fontSize:N.labelFont,lineHeight:1.1,fontWeight:500,userSelect:"text",WebkitUserSelect:"text",color:g.text.primary}),[N.labelFont,g.text.primary]),E=useMemo(()=>css({fontSize:N.labelFont,lineHeight:1.25,color:g.text.secondary,fontWeight:400,marginTop:s&&a?g.spacing.xs:0,userSelect:"text",WebkitUserSelect:"text"}),[N.labelFont,a,s,g.spacing.xs,g.text.secondary]),W=useCallback(()=>{o||(m?n?.(!w):P(z=>{let _=!z;return n?.(_),_}));},[o,m,w,n]),$=useCallback(z=>{o||(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),W());},[o,W]);return jsxs("label",{ref:R,role:"checkbox","aria-checked":w,"aria-disabled":o||void 0,"data-state":w?"checked":"unchecked",className:["plainframe-ui-checkbox",I||""].join(" ").trim(),css:[M,p({color:w?"primary":"neutral"}),u,o?css({opacity:.6}):null],"data-disabled":o?"true":"false",tabIndex:o?-1:0,onKeyDown:$,children:[jsx("input",{type:"checkbox",checked:w,onChange:W,disabled:o,css:b,...x,tabIndex:-1}),jsx("span",{className:"plainframe-ui-checkbox-box",css:[h,d],"aria-hidden":"true",children:jsx("span",{className:"plainframe-ui-checkbox-check",css:[D,y],children:w&&(i||jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:K,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",css:css({width:"100%",height:"100%",display:"block"}),"aria-hidden":"true",focusable:"false",children:jsx("polyline",{points:"20 6 9 17 4 12"})}))})}),(s||a)&&jsxs("span",{className:"plainframe-ui-checkbox-text",css:L,children:[s&&jsx("span",{className:"plainframe-ui-checkbox-label",css:[k,f],children:s}),a&&jsx("span",{className:"plainframe-ui-checkbox-description",css:[E,T],children:a})]})]})}));sr.displayName="Checkbox";var Xu=()=>useContext(fn),Yu=()=>useContext(ro),Ju=()=>useContext(ur),dn=null,gi=(e,t=35)=>{dn!==null&&window.clearTimeout(dn),dn=window.setTimeout(()=>{e(),dn=null;},t);},lo=()=>{dn!==null&&(window.clearTimeout(dn),dn=null);},pn=me.forwardRef(function({disabled:t=false,destructive:n=false,inset:o,closeOnSelect:r=true,onSelect:s,children:a,className:c,css:i,startIcon:l,endIcon:u,selected:d=false,active:y,meta:f,__index:T,__skipListReg:I,...x},R){let g=Xu(),p=Ju(),m=cr(),C=uo(),P=Yu(),w=V(),N=!!useContext(Tt),B=x["data-subtrigger"]!==void 0,K=B&&u===void 0?jsx(ChevronRight,{size:18,strokeWidth:2.5}):u,S=typeof o=="number"?o:o===false?0:0,F=useContext(er),M=F==="subtle"?w.surface?.subtleHover??w.neutral[100]:w.surface?.subtleBg??w.neutral[100],b=useMemo(()=>css({width:"100%",borderRadius:w.radius.md,padding:`${w.spacing.sm} ${w.spacing.sm}`,paddingLeft:S>0?`calc(${w.spacing.md} + (${w.spacing.xl} * ${S}))`:w.spacing.md,minHeight:N?w.componentHeights.sm:w.componentHeights.md,display:"flex",alignItems:"center",gap:w.spacing.sm,fontWeight:500,fontSize:w.typography.sizes.sm,cursor:t?"not-allowed":"pointer",opacity:t?.55:1,userSelect:"none",background:"transparent",color:n?w.palette.danger[800]:w.text.primary,transition:"background-color .16s ease, color .16s ease",outline:"none","[role='menu']:not([data-keyboard-nav]) &:hover":t?{}:{background:n?w.palette.danger[50]:M},"&[data-highlighted]":t?{}:{background:n?w.palette.danger[50]:M},"&[data-active]":t?{}:{background:n?w.palette.danger[50]:M},"&[data-subtrigger][aria-expanded='true']":t?{}:{background:n?w.palette.danger[50]:M},"[role='menu']:not([data-keyboard-nav]) &:not([data-disabled]):hover [data-menu-checkbox-wrapper],&:not([data-disabled])[data-highlighted] [data-menu-checkbox-wrapper],&:not([data-disabled])[data-active] [data-menu-checkbox-wrapper],&[data-subtrigger][aria-expanded='true'] [data-menu-checkbox-wrapper]":{background:w.surface.border},"& > [data-label]":{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),[w,N,S,t,n,M]),h=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,"& > *":{flexShrink:0},"& > svg:only-child":{width:16,height:16,display:"block"}}),[]),A=useMemo(()=>css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,whiteSpace:"nowrap",lineHeight:0,gap:w.spacing.sm,"& > svg":{width:16,height:16,display:"block"},color:w.text.secondary}),[w.text.secondary,w.spacing.sm]),D=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:w.palette.primary[600],"& > svg":{width:16,height:16,display:"block"}}),[w.palette.primary]),L=[];N&&L.push({minHeight:w.componentHeights.sm,paddingLeft:w.spacing.sm,paddingRight:w.spacing.xs,paddingTop:w.spacing.xs,paddingBottom:w.spacing.xs});let k=()=>{s?.(),r&&!B&&p?.closeAll();},E=($,z)=>{let _=$.closest('[role="menu"]');if(!_)return;let H=Array.from(_.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(Y=>{if(Y.closest('[role="menu"]')!==_)return false;let le=window.getComputedStyle(Y);return le.display!=="none"&&le.visibility!=="hidden"});if(!H.length)return;let U=H.indexOf($),X=U>=0?U:0,ae=z(H.length,X),q=H[ae];q&&(document.querySelectorAll("[data-highlighted]").forEach(Y=>{Y.removeAttribute("data-highlighted");}),q.setAttribute("data-highlighted",""),q.focus(),g&&T!=null&&g.setActiveIndex(ae));},W=t?-1:P?.allItemsTabbable?0:-1;return jsxs("div",{role:"menuitem","aria-disabled":t||void 0,"data-disabled":t?"":void 0,"data-active":y?"":void 0,tabIndex:W,ref:$=>{if(g&&!I){let z=g.listRef.current;$&&(T!=null?z[T]=$:z.includes($)||z.push($));}typeof R=="function"?R($):R&&"current"in R&&(R.current=$);},onMouseMove:$=>{if($.currentTarget.hasAttribute("data-hovered"))return;let z=!!$.currentTarget.closest("[data-submenu-content]");!B&&m&&!z&&gi(m.closeAllSubMenus),document.querySelectorAll("[data-hovered]").forEach(H=>{H.removeAttribute("data-hovered");}),document.querySelectorAll("[data-highlighted]").forEach(H=>{H.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-active]").forEach(H=>{H.removeAttribute("data-active");}),$.currentTarget.setAttribute("data-hovered","");let _=$.currentTarget.closest("[data-menu-id]")||$.currentTarget.closest('[role="menu"]');_?.hasAttribute("data-keyboard-nav")&&_.removeAttribute("data-keyboard-nav"),!t&&g&&T!=null&&g.setActiveIndex(T),!t&&!P?.allItemsTabbable&&$.currentTarget.focus({preventScroll:true});},onMouseEnter:$=>{if(B)lo();else {let H=!!$.currentTarget.closest("[data-submenu-content]");m&&!H&&gi(m.closeAllSubMenus);}$.currentTarget.hasAttribute("data-hovered")||(document.querySelectorAll("[data-highlighted]").forEach(H=>{H.removeAttribute("data-highlighted");}),document.querySelectorAll("[data-hovered]").forEach(H=>{H.removeAttribute("data-hovered");}),document.querySelectorAll("[data-active]").forEach(H=>{H.removeAttribute("data-active");})),$.currentTarget.setAttribute("data-hovered","");let _=$.currentTarget.closest("[data-menu-id]")||$.currentTarget.closest('[role="menu"]');!t&&g&&T!=null&&(_?.hasAttribute("data-keyboard-nav")&&(_.removeAttribute("data-keyboard-nav"),C&&C.setIsKeyboardNav(false)),g.setActiveIndex(T)),!t&&!P?.allItemsTabbable&&$.currentTarget.focus({preventScroll:true});},onFocus:()=>{},onMouseLeave:()=>{g&&g.setActiveIndex(null);},onKeyDown:$=>{if(t)return;let z=$.currentTarget;if($.key==="Tab"&&g&&!P?.allItemsTabbable){$.preventDefault();return}if($.key==="Tab"&&!g){let _=z.closest('[role="menu"]');if(_){_.removeAttribute("data-keyboard-nav"),document.querySelectorAll("[data-highlighted]").forEach(U=>U.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(U=>U.removeAttribute("data-hovered"));let H=_.tabIndex;_.tabIndex=-1,requestAnimationFrame(()=>{_.tabIndex=H>=0?H:0;});}C&&C.setIsKeyboardNav(false);return}if($.key==="Enter"||$.key===" "||$.key==="ArrowRight"){B||$.key!=="ArrowRight"&&($.preventDefault(),$.stopPropagation(),k());return}if($.key==="ArrowLeft"&&z.closest('[role="menu"]')?.closest("[data-submenu-content]")){$.preventDefault(),$.stopPropagation();let U=document.querySelector('[data-subtrigger][aria-expanded="true"]');if(U){let X=U.__pfuiCloseSubmenu;X&&X(),document.querySelectorAll("[data-highlighted]").forEach(q=>q.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(q=>q.removeAttribute("data-hovered")),U.setAttribute("data-highlighted",""),U.focus();let ae=U.closest("[data-menu-id]");ae&&ae.setAttribute("data-keyboard-nav","");}return}if($.key==="Escape"){$.preventDefault(),$.stopPropagation(),p?.closeAll(),z.closest('[role="menu"]')&&document.querySelector('[aria-expanded="true"][aria-haspopup="menu"]')?.focus();return}if($.key==="ArrowDown"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),C&&C.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,(H,U)=>(U+1)%H);return}if($.key==="ArrowUp"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');if(!_)return;_.setAttribute("data-keyboard-nav",""),C&&C.setIsKeyboardNav(true),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,(H,U)=>(U-1+H)%H);return}if($.key==="Home"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,()=>0);return}if($.key==="End"){$.preventDefault(),$.stopPropagation();let _=z.closest("[data-menu-id]")||z.closest('[role="menu"]');_&&_.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(H=>H.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(H=>H.removeAttribute("data-hovered")),E(z,H=>H-1);return}},className:["plainframe-ui-menu-item",c||""].join(" ").trim(),css:css(...[b,...L,i].flat()),...x,onClick:$=>{t||($.currentTarget.removeAttribute("data-highlighted"),k());},children:[l&&jsx("span",{className:"plainframe-ui-menu-item-start",css:h,children:l}),a,(f!=null||K||d)&&jsxs("span",{className:"plainframe-ui-menu-item-end",css:A,children:[f!=null?jsx("span",{className:"plainframe-ui-menu-item-meta",css:css({lineHeight:1,fontSize:w.typography.sizes.sm,color:w.text.secondary,whiteSpace:"nowrap"}),children:f}):null,K,d&&jsx("span",{className:"plainframe-ui-menu-item-selected",css:D,children:jsx(Check,{size:16,strokeWidth:2.5})})]})]})}),hi=me.createContext(null),gs=({values:e,defaultValues:t,onValuesChange:n,children:o})=>{let[r,s]=useState(t??[]),a=e!==void 0,c=a?e:r,i=useRef(c);i.current=c;let l=useRef(n);l.current=n;let u=useCallback(y=>{let f=i.current,I=f.some(x=>Object.is(x,y))?f.filter(x=>!Object.is(x,y)):[...f,y];a||s(I),l.current?.(I);},[a]),d=useMemo(()=>({values:c,toggle:u}),[c,u]);return jsx(hi.Provider,{value:d,children:o})},co=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,value:r,children:s,__index:a,disabled:c=false,css:i,className:l,startIcon:u,endIcon:d,...y},f){let T=useContext(hi),I=!!T&&r!==void 0,x=!I&&t!==void 0,[R,g]=useState(()=>I?T.values.some(O=>Object.is(O,r)):!!n),p=I?T.values.some(O=>Object.is(O,r)):x?!!t:R,m=V(),P=!!useContext(Tt),w=()=>{if(!c)if(I)T.toggle(r);else {let O=!p;x||g(O),o?.(O);}},v=css({width:18,height:18,display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,marginLeft:P?-1:-3,borderRadius:m.radius.xs,transition:"background-color .12s ease"}),N=css({pointerEvents:"none"}),B=useCallback(O=>{O&&(O.querySelectorAll("[tabindex]").forEach(S=>{S.tabIndex=-1;}),O.querySelectorAll('input, button, a, [role="checkbox"]').forEach(S=>{S.tabIndex=-1;}));},[]),K=jsxs(Fragment,{children:[jsx("span",{ref:B,"data-menu-checkbox-wrapper":true,className:"plainframe-ui-menu-checkbox-wrapper",css:v,"aria-hidden":"true",children:jsx(sr,{size:"sm",checked:p,css:N})}),u]});return jsx(pn,{...y,className:["plainframe-ui-menu-checkbox-item",l||""].join(" ").trim(),ref:f,__index:a,role:"menuitemcheckbox","aria-checked":p,closeOnSelect:false,onSelect:w,disabled:c,startIcon:K,endIcon:d,css:i,selected:false,children:s})});co.displayName="MenuCheckboxItem";var yi=forwardRef(function({checked:t,defaultChecked:n=false,onCheckedChange:o,children:r,__index:s,disabled:a=false,css:c,switchSize:i="md",switchCss:l,startIcon:u,className:d,...y},f){let T=t!==void 0,[I,x]=useState(!!n),R=T?!!t:I,p=!!useContext(Tt),m=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),C=css({marginLeft:"auto",display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,paddingRight:p?2:void 0}),P=()=>{if(a)return;let v=!R;T||x(v),o?.(v);},w=css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,"& > *":{flexShrink:0},"& > svg:only-child":{width:16,height:16,display:"block"}});return jsxs(pn,{...y,className:["plainframe-ui-menu-switch-item",d||""].join(" ").trim(),ref:f,__index:s,disabled:a,closeOnSelect:false,onSelect:P,css:c,selected:false,children:[u&&jsx("span",{className:"plainframe-ui-menu-item-start",css:w,children:u}),jsx("span",{"data-label":true,css:m,className:"plainframe-ui-menu-item-label",children:r}),jsx("span",{className:"plainframe-ui-menu-switch-wrap",css:C,children:jsx(ms,{checked:R,css:css({pointerEvents:"none",padding:0,marginRight:-1},l),className:"plainframe-ui-menu-switch",tabIndex:-1,size:i})})]})});yi.displayName="MenuSwitchItem";var xi=me.createContext(null),lr=({value:e,defaultValue:t,onValueChange:n,children:o})=>{let[r,s]=useState(t),a=e??r,c=l=>{e!==void 0||s(l),n?.(l);},i=useMemo(()=>({value:a,onChange:c}),[a]);return jsx(xi.Provider,{value:i,children:o})};lr.displayName="MenuRadioGroup";var Zu=forwardRef(function({value:t,children:n,__index:o,disabled:r=false,css:s,className:a,...c},i){let l=useContext(xi),u=l?.value===t,d=V(),y=css({width:d.spacing.md,display:"inline-flex",justifyContent:"center",alignItems:"center",marginLeft:-1}),f=css({width:7,height:7,borderRadius:"100%",backgroundColor:d.palette.primary[600],transform:u?"scale(1)":"scale(0.4)",opacity:u?1:0,transition:"transform 140ms ease-out, opacity 140ms linear",transformOrigin:"center center"}),T=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"});return jsxs(pn,{...c,className:["plainframe-ui-menu-radio-item",a||""].join(" ").trim(),ref:i,__index:o,role:"menuitemradio","aria-checked":u,closeOnSelect:false,onSelect:()=>{r||l?.onChange?.(t);},disabled:r,css:s,selected:false,children:[jsx("span",{className:"plainframe-ui-menu-radio-dotbox",css:y,children:jsx("span",{className:"plainframe-ui-menu-radio-dot",css:f})}),jsx("span",{className:"plainframe-ui-menu-item-label",css:T,children:n})]})}),mn=forwardRef(function({inset:t,className:n,css:o,children:r,startIcon:s,endIcon:a,wrap:c=false,color:i="primary",...l},u){let d=V(),f=!!useContext(Tt),T=i==="primary"?d.text.primary:i==="secondary"?d.text.secondary:d.palette[i]?.[700]??d.text.primary,I=css({display:"flex",alignItems:"center",padding:f?`${d.spacing.sm} ${d.spacing.md}`:`${d.spacing.sm} ${d.spacing.md}`,fontSize:d.typography.sizes.sm,color:T,fontWeight:500,...t?{paddingLeft:`calc(${d.spacing.lg} * 2)`}:null,gap:d.spacing.xs}),x=css({flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:c?"normal":"nowrap"}),R=css({display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",lineHeight:0,padding:"0 3px 0 2px",marginLeft:-2,"& > svg":{width:16,height:16,display:"block"}}),g=css({display:"inline-flex",alignItems:"center",justifyContent:"flex-end",flex:"0 0 auto",flexShrink:0,lineHeight:0,"& > svg":{width:16,height:16,display:"block"}});return jsxs("div",{ref:u,role:"presentation",className:["plainframe-ui-menu-label",n||""].join(" ").trim(),css:css(I,o),...l,children:[s&&jsx("span",{className:"plainframe-ui-menu-label-start",css:R,children:s}),jsx("span",{className:"plainframe-ui-menu-label-text",css:x,children:r}),a&&jsx("span",{className:"plainframe-ui-menu-label-end",css:g,children:a})]})});mn.displayName="MenuLabel";var Qu=({className:e,css:t,variant:n="full",...o})=>{let r=V(),s=`var(--pfui-panel-pad, ${typeof r.spacing.xs=="number"?r.spacing.xs+"px":String(r.spacing.xs)})`,a=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:"calc(var(--pfui-panel-pad, 0px) * -1)",marginRight:"calc(var(--pfui-panel-pad, 0px) * -1)"}),c=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.md}`,marginRight:`${r.spacing.md}`}),i=css({height:1,background:r.surface.border,marginTop:s,marginBottom:s,marginLeft:`${r.spacing.lg}`,marginRight:0}),l=n==="full"?a:n==="middle"?c:i;return jsx("div",{role:"separator",className:["plainframe-ui-menu-separator",e||""].join(" ").trim(),css:css(l,t),...o})};var bs=io,po=0,dr=null,pr=null,pd=()=>typeof window>"u"||typeof document>"u"?0:window.innerWidth-document.documentElement.clientWidth;function md(){if(!(typeof document>"u")){if(po===0){let e=document.body;dr=e.style.overflow||"",pr=e.style.paddingRight||"";let t=pd();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}po+=1;}}function fd(){if(!(typeof document>"u")&&(po>0&&(po-=1),po===0)){let e=document.body;dr!==null&&(e.style.overflow=dr),pr!==null&&(e.style.paddingRight=pr),dr=null,pr=null;}}var fn=createContext(null),mr=()=>{let e=useContext(fn);if(!e)throw new Error("DropdownMenu components must be used inside <DropdownMenu>.");return e},mo=createContext(null),gd=()=>useContext(mo),oo=createContext(null),uo=()=>useContext(oo),Ci=createContext(null),cr=()=>useContext(Ci),Ri=createContext(false),bd=()=>useContext(Ri),ro=createContext({allItemsTabbable:true}),ur=me.createContext(null),hs=()=>useContext(ur);function hd(){let e=[],t=new Set,n={current:false};return {registerCloser(o){return e.push(o),()=>{let r=e.indexOf(o);r>=0&&e.splice(r,1);}},closeAll(){if(!n.current){n.current=true;for(let o=e.length-1;o>=0;o--)try{e[o]();}catch{}queueMicrotask(()=>{n.current=false;});}},registerHoverCtl(o){return t.add(o),()=>t.delete(o)},clearAllHover(){t.forEach(o=>o.clear());},isBusClosingRef:n}}var yd=()=>gd()?.activeIndex??null,Ti=0,$n=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="click",lockScroll:r=true,size:s="md",children:a})=>{let[c,i]=useState(!!t),l=e??c,u=useCallback(F=>{e===void 0&&i(F),n?.(F);},[e,n]),d=useRef(`pfui-menu-${++Ti}`),y=useRef(null),f=useRef([]),T=useRef(null),[I,x]=useState(null),[R,g]=useState(false);useEffect(()=>{l||(x(null),f.current=[],g(false));},[l]);let p=useRef(null),m=useCallback((F,M)=>{if(o!=="hover")return;window.clearTimeout(p.current??0);let b=M??20;p.current=window.setTimeout(()=>u(F),b);},[o,u]),C=useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null);},[]);useEffect(()=>()=>C(),[C]),useEffect(()=>{if(!(!r||!l))return md(),()=>fd()},[l,r]);let P=hs(),[w]=useState(()=>P??hd()),v=useRef(new Set),N=useMemo(()=>({registerSubMenu:F=>(v.current.add(F),()=>v.current.delete(F)),closeAllSubMenus:()=>{v.current.forEach(F=>F());}}),[]),B=useMemo(()=>({open:l,setOpen:u,trigger:o,referenceRef:y,listRef:f,floatingRef:T,setActiveIndex:x,scheduleSubmenuHover:m,clearSubmenuHover:C,menuId:d.current}),[l,u,o,x,m,C]),K=useMemo(()=>({activeIndex:I,setActiveIndex:x}),[I,x]),O=useMemo(()=>({isKeyboardNav:R,setIsKeyboardNav:g}),[R]),S=s==="sm";return jsx(ur.Provider,{value:w,children:jsx(Tt.Provider,{value:S,children:jsx(oo.Provider,{value:O,children:jsx(Ci.Provider,{value:N,children:jsx(mo.Provider,{value:K,children:jsx(fn.Provider,{value:B,children:a})})})})})})};$n.displayName="DropdownMenu";var zn=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},a)=>{let{open:c,setOpen:i,trigger:l,referenceRef:u,listRef:d,setActiveIndex:y,scheduleSubmenuHover:f,clearSubmenuHover:T,floatingRef:I,menuId:x}=mr(),R=uo(),g=cr(),p=!!e&&isValidElement(t),m=p?t:null,C=m&&m.props&&typeof m.props=="object"&&"onKeyDown"in m.props?m.props.onKeyDown:void 0,P=m&&m.props&&typeof m.props=="object"&&"onClick"in m.props?m.props.onClick:void 0,{onKeyDown:w,onClick:v,...N}=s,B=useMemo(()=>bs(a,p&&isValidElement(t)&&"ref"in t?t.ref:void 0,u),[a,p,t,u]),K=useCallback(()=>d.current.filter(Boolean),[d]),O=useCallback(h=>{let A=K();requestAnimationFrame(()=>A[h]?.focus());},[K]),S=useCallback(h=>{if(h.key==="Tab"&&c){h.preventDefault(),R?.setIsKeyboardNav(true);let A=I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=A.querySelector('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])');D&&(document.querySelectorAll("[data-highlighted]").forEach(L=>L.removeAttribute("data-highlighted")),D.setAttribute("data-highlighted",""),D.focus());}return}if(h.key==="ArrowRight"&&c){let A=document.querySelector("[data-subtrigger][data-hovered]");if(A){h.preventDefault(),h.stopPropagation(),R?.setIsKeyboardNav(true),A.removeAttribute("data-hovered"),A.setAttribute("data-highlighted",""),A.focus(),requestAnimationFrame(()=>{let D=new KeyboardEvent("keydown",{key:"ArrowRight",bubbles:true,cancelable:true});A.dispatchEvent(D);});return}}if(h.key==="ArrowDown"||h.key==="ArrowUp"){if(R?.setIsKeyboardNav(true),!c){h.preventDefault(),i(true),requestAnimationFrame(()=>{let A=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=Array.from(A.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(L=>{let k=L.closest("[data-submenu-content]");if(k&&k!==A)return false;let E=window.getComputedStyle(L);return E.display!=="none"&&E.visibility!=="hidden"});if(D.length>0){let L=h.key==="ArrowDown"?0:D.length-1;y(L),D[L]?.setAttribute("data-highlighted",""),D[L]?.focus();}}}),C?.(h),w?.(h);return}if(c){h.preventDefault();let A=document.querySelectorAll("[data-hovered]");for(let L of Array.from(A))if(L.closest("[data-submenu-content]")){let E=L.closest('[role="menu"]');if(E){E.setAttribute("data-keyboard-nav","");let W=Array.from(E.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled])')).filter(z=>{if(z.closest('[role="menu"]')!==E)return false;let _=window.getComputedStyle(z);return _.display!=="none"&&_.visibility!=="hidden"}),$=W.indexOf(L);if(document.querySelectorAll("[data-highlighted]").forEach(z=>z.removeAttribute("data-highlighted")),L.removeAttribute("data-hovered"),$!==-1&&W.length>0){let z=h.key==="ArrowDown"?1:-1,_=($+z+W.length)%W.length;W[_]?.setAttribute("data-highlighted",""),W[_]?.focus();}return}}let D=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(D){D.setAttribute("data-keyboard-nav",""),g?.closeAllSubMenus();let L=Array.from(D.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(k=>{if(k.closest('[role="menu"]')!==D)return false;let E=window.getComputedStyle(k);return E.display!=="none"&&E.visibility!=="hidden"});if(L.length>0){let k=D.querySelector("[data-highlighted]"),E=D.querySelector("[data-hovered]"),W=-1;k?W=L.indexOf(k):E&&(W=L.indexOf(E)),document.querySelectorAll("[data-highlighted]").forEach(_=>_.removeAttribute("data-highlighted")),E&&E.removeAttribute("data-hovered"),W===-1&&(W=h.key==="ArrowDown"?-1:L.length);let $=h.key==="ArrowDown"?1:-1,z=(W+$+L.length)%L.length;y(z),L[z]?.setAttribute("data-highlighted",""),L[z]?.focus();}}C?.(h),w?.(h);return}}if((h.key==="Enter"||h.key===" ")&&!c){h.preventDefault(),R?.setIsKeyboardNav(true),i(true),requestAnimationFrame(()=>{let A=x?document.querySelector(`[data-menu-id="${x}"]`):I?.current;if(A){A.setAttribute("data-keyboard-nav","");let D=Array.from(A.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(L=>{let k=L.closest("[data-submenu-content]");if(k&&k!==A)return false;let E=window.getComputedStyle(L);return E.display!=="none"&&E.visibility!=="hidden"});D.length>0&&(y(0),D[0]?.setAttribute("data-highlighted",""),D[0]?.focus());}}),C?.(h),w?.(h);return}C?.(h),w?.(h);},[c,i,y,C,w,K,O,d,R,x,I,g]),F=useCallback(h=>{l==="click"&&((h.nativeEvent.composedPath?.()??[]).some(k=>{let E=k;if(!E||!("tagName"in E))return false;let W=String(E.tagName).toUpperCase();if(W==="INPUT"||W==="TEXTAREA"||"isContentEditable"in E&&E.isContentEditable)return true;let $="getAttribute"in E?E.getAttribute("role"):null;return $==="textbox"||$==="combobox"})||(h.stopPropagation(),i(!c))),P?.(h),v?.(h);},[l,c,i,P,v]),M=l==="hover"?{onMouseEnter:()=>{T(),i(true);},onMouseLeave:()=>{f(false);}}:{},b=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0;if(p&&m){let h=m.props,A=h.css,D=typeof h.className=="string"?h.className:void 0,L=typeof h.tabIndex=="number"?h.tabIndex:0,k={ref:B,tabIndex:L,className:[D,o].filter(Boolean).join(" ")||void 0,css:[A,b,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":c,onClick:F,onKeyDown:S,...M,...N};return cloneElement(m,k)}return jsx("button",{ref:B,className:o,css:[css({display:"inline-block"}),b,r],type:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":c,onClick:F,onKeyDown:S,...M,...N,children:t})});zn.displayName="DropdownMenuTrigger";var hn=me.forwardRef(({anchor:e,side:t="bottom",align:n="start",sideOffset:o=6,alignOffset:r=0,collisionPadding:s=8,sameWidth:a=false,width:c,height:i,maxHeight:l,unstyled:u=false,closeOnBlur:d=false,allItemsTabbable:y=false,className:f,css:T,children:I,exitPlacement:x,animateOnBusClose:R=true,gap:g,ignoreOutsidePressRefs:p,disableOutsidePressDismiss:m=false,returnFocus:C=false,...P},w)=>{let{open:v,setOpen:N,referenceRef:B,clearSubmenuHover:K,setActiveIndex:O,floatingRef:S,menuId:F}=mr(),M=V(),b=hs(),h=uo();useEffect(()=>{if(!b)return;let J=b.registerCloser(()=>N(false));return ()=>{J&&J();}},[b,N]);let A=typeof o=="string"?parseFloat(o):o,D=typeof r=="string"?parseFloat(r):r,L=typeof s=="string"?parseFloat(s):s,k=`${t}${n==="center"?"":`-${n}`}`,E=useCallback(J=>({getBoundingClientRect:()=>{let oe=Math.round(J.x),re=Math.round(J.y);return {x:oe,y:re,left:oe,top:re,right:oe,bottom:re,width:0,height:0,toJSON:()=>({x:oe,y:re,left:oe,top:re,right:oe,bottom:re,width:0,height:0})}},contextElement:void 0}),[]),W=useMemo(()=>{if(!e)return null;if(e instanceof HTMLElement||typeof e=="object"&&e!==null&&"getBoundingClientRect"in e&&typeof e.getBoundingClientRect=="function")return e;let J=e;return E({x:J.x,y:J.y})},[e,E]),{refs:$,x:z,y:_,strategy:H,context:U,update:X}=useFloating({open:v,onOpenChange:N,placement:k,whileElementsMounted:autoUpdate,middleware:[offset({mainAxis:A??0,crossAxis:D??0}),flip({padding:L??8}),shift({padding:L??8}),size({apply({rects:J,elements:oe}){let re=oe.floating;re.style.boxSizing="border-box",i!=null?re.style.height=typeof i=="number"?`${i}px`:String(i):re.style.removeProperty("height"),c!=null?re.style.width=typeof c=="number"?`${c}px`:String(c):a?re.style.width=`${Math.round(J.reference.width)}px`:re.style.width="200px",l!=null?re.style.maxHeight=typeof l=="number"?`${l}px`:String(l):re.style.removeProperty("max-height");}})]});useEffect(()=>{W?$.setReference(W):B.current&&$.setReference(B.current);},[$,W,B]),useEffect(()=>{if(!v)return;let J=W||B.current,oe=$.floating.current;if(!(!J||!oe))return autoUpdate(J,oe,X)},[v,W,B,$,X]),useEffect(()=>{X();},[X,a,c,i,l]),useEffect(()=>{v&&!y&&O(0);},[v,y,O]),useEffect(()=>{if(!d||!v)return;let J=()=>{let oe=document.activeElement,re=B.current,qe=$.floating.current;oe&&(re?.contains(oe)||qe?.contains(oe)||N(false));};return document.addEventListener("focusin",J,true),()=>document.removeEventListener("focusin",J,true)},[d,v,N,B,$.floating]);let ae=useDismiss(U,{outsidePressEvent:"pointerdown",escapeKey:true,outsidePress:m?false:J=>{if(p?.length){let oe=J.target;for(let re of p)if(re.current?.contains(oe))return false}return true}}),q=useRole(U,{role:"menu"}),{getFloatingProps:Y}=useInteractions([ae,q]),le=useRef(false);useEffect(()=>{v?le.current=true:le.current&&B.current&&C&&(b?.isBusClosingRef.current||requestAnimationFrame(()=>{B.current?.focus();}));},[v,B,b,C]);let ie=typeof M.spacing.xs=="number"?`${M.spacing.xs}px`:String(M.spacing.xs),be=g===void 0?void 0:typeof g=="number"?g:M.spacing[g]??g,Pe=u?void 0:css({boxSizing:"border-box",background:M.surface.panelBg,border:`${M.componentHeights.border} solid ${M.surface.border}`,borderRadius:M.radius.lg,boxShadow:"0 8px 32px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.02)","--pfui-panel-pad":ie,padding:"var(--pfui-panel-pad)",color:M.text.primary,maxHeight:l,overflowY:"auto",display:"flex",flexDirection:"column",gap:be,"& > *":{flexShrink:0},"&[data-keyboard-nav]":{cursor:"none"},"&[data-keyboard-nav] *":{cursor:"none !important",pointerEvents:"none"}}),Re=-1,Ce=J=>{if(!J||typeof J!="object"||!isValidElement(J))return J;let re=J.type?.displayName;if(re==="DropdownMenu"||re==="DropdownMenuSub")return J;if(re==="MenuItem"||re==="MenuCheckboxItem"||re==="MenuRadioItem"||re==="MenuSwitchItem")return Re+=1,cloneElement(J,{__index:Re,key:J.key??Re});if(re==="DropdownMenuTrigger"){let j=J.props.children;return cloneElement(J,{children:me.Children.map(j,Ce)})}if(re==="DropdownMenuSubTrigger"){Re+=1;let j=Re;return cloneElement(J,{__index:j,key:J.key??j})}let qe=J.props.children;return qe==null?J:cloneElement(J,{children:me.Children.map(qe,Ce)})},Ie=me.Children.map(I,Ce),we=U.placement.split("-")[0]||"bottom",he=we==="bottom"?"center top":we==="top"?"center bottom":we==="left"?"right center":"left center",je=we==="bottom"?{opacity:0,y:-8,scale:.96}:we==="top"?{opacity:0,y:8,scale:.96}:we==="left"?{opacity:0,x:8,scale:.96}:{opacity:0,x:-8,scale:.96},Z=x??we,Ee=Z==="bottom"?{opacity:0,y:-8,scale:.96}:Z==="top"?{opacity:0,y:8,scale:.96}:Z==="left"?{opacity:0,x:8,scale:.96}:{opacity:0,x:-8,scale:.96},ee=!!b?.isBusClosingRef.current&&!R?{scale:{duration:0},x:{duration:0},y:{duration:0},opacity:{duration:0}}:{scale:{type:"spring",stiffness:520,damping:38,mass:.5},x:{type:"spring",stiffness:420,damping:30,mass:.6},y:{type:"spring",stiffness:420,damping:30,mass:.6},opacity:{duration:.12,ease:"linear"}},se=css({position:H,top:_??0,left:z??0,zIndex:1e3,transformOrigin:he}),pe=useCallback(J=>{if(J.key==="Tab"){J.preventDefault();return}if(J.key==="ArrowDown"||J.key==="ArrowUp"){J.preventDefault(),h?.setIsKeyboardNav(true);let oe=J.currentTarget;oe.setAttribute("data-keyboard-nav","");let re=Array.from(oe.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(qe=>{if(qe.closest('[role="menu"]')!==oe)return false;let j=window.getComputedStyle(qe);return j.display!=="none"&&j.visibility!=="hidden"});if(re.length>0){let qe=oe.querySelector("[data-highlighted]"),j=oe.querySelector("[data-hovered]"),ue=-1;qe?ue=re.indexOf(qe):j&&(ue=re.indexOf(j)),document.querySelectorAll("[data-highlighted]").forEach(ze=>ze.removeAttribute("data-highlighted")),j&&j.removeAttribute("data-hovered"),ue===-1&&(ue=J.key==="ArrowDown"?-1:re.length);let de=J.key==="ArrowDown"?1:-1,fe=(ue+de+re.length)%re.length;O(fe),re[fe]?.setAttribute("data-highlighted",""),re[fe]?.focus();}}},[h,O]),Se=useCallback(J=>{let oe=J.currentTarget;oe.removeAttribute("data-keyboard-nav"),oe.querySelectorAll("[data-highlighted]").forEach(re=>re.removeAttribute("data-highlighted")),h?.isKeyboardNav&&h.setIsKeyboardNav(false);},[h]),Ne=useCallback(J=>{J.removeAttribute("data-keyboard-nav"),J.querySelectorAll("[data-highlighted]").forEach(oe=>oe.removeAttribute("data-highlighted")),h?.isKeyboardNav&&h.setIsKeyboardNav(false);},[h]);return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:v?jsx(ro.Provider,{value:{allItemsTabbable:y},children:jsx(motion.div,{...Y({...P,ref:bs(w,$.setFloating,J=>{S&&(S.current=J);})}),"data-menu-id":F,"data-keyboard-nav":h?.isKeyboardNav?"":void 0,className:f,css:[Pe,se,T],initial:je,animate:{opacity:1,x:0,y:0,scale:1},exit:Ee,transition:ee,onPointerMove:J=>Ne(J.currentTarget),onPointerDown:J=>Ne(J.currentTarget),onKeyDown:pe,onMouseMove:Se,onMouseEnter:()=>{K(),b?.clearAllHover();},onMouseLeave:()=>{document.querySelectorAll("[data-hovered]").forEach(J=>J.removeAttribute("data-hovered"));},children:Ie})}):null})})});hn.displayName="DropdownMenuContent";var wi=({open:e,defaultOpen:t,onOpenChange:n,trigger:o="hover",dense:r,children:s})=>{let a=bd(),[c,i]=useState(!!t),l=e??c,u=useCallback(S=>{e===void 0&&i(S),n?.(S);},[e,n]),d=useRef(null),y=useRef(false),f=useCallback((S,F)=>{if(o!=="hover")return;window.clearTimeout(d.current??0),y.current=S;let M=F??20;d.current=window.setTimeout(()=>{y.current=false,u(S);},M);},[o,u]),T=useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null,y.current=false);},[]);useEffect(()=>()=>T(),[T]);let I=cr();useEffect(()=>{if(!I)return;let S=()=>{T(),u(false);};return I.registerSubMenu(S)},[I,u,T]);let x=useRef(`pfui-submenu-${++Ti}`),R=useRef(null),g=useRef([]),p=useRef(null),[m,C]=useState(null),[P,w]=useState(false);useEffect(()=>{l||(C(null),g.current=[],w(false));},[l]);let v=useContext(Tt),N=r??v,B=useMemo(()=>({open:l,setOpen:u,trigger:o,referenceRef:R,listRef:g,floatingRef:p,setActiveIndex:C,scheduleSubmenuHover:f,clearSubmenuHover:T,pendingOpenRef:y,menuId:x.current}),[l,u,o,C,f,T]),K=useMemo(()=>({activeIndex:m,setActiveIndex:C}),[m,C]),O=useMemo(()=>({isKeyboardNav:P,setIsKeyboardNav:w}),[P]);return a?(console.warn("[DropdownMenu] Nested submenus are not supported. DropdownMenuSub can only be used one level deep inside DropdownMenu. The nested submenu content will not be rendered."),jsx(Fragment,{children:me.Children.map(s,S=>{if(!isValidElement(S))return S;let F=S.type;return F?.displayName==="DropdownMenuSubTrigger"||F?.displayName==="DropdownMenuSubContent"?null:S})})):jsx(Ri.Provider,{value:true,children:jsx(Tt.Provider,{value:N,children:jsx(mo.Provider,{value:K,children:jsx(oo.Provider,{value:O,children:jsx(fn.Provider,{value:B,children:s})})})})})};wi.displayName="DropdownMenuSub";var Ei=me.forwardRef(({asChild:e=true,children:t,width:n,className:o,css:r,...s},a)=>{let{open:c,setOpen:i,trigger:l,referenceRef:u,scheduleSubmenuHover:d,clearSubmenuHover:y,pendingOpenRef:f,menuId:T}=mr(),I=uo(),x=useCallback(S=>{S&&(S.__pfuiCloseSubmenu=()=>i(false));},[i]),R=!!e&&isValidElement(t),g=R?t:null,p=g?.props,m=p?.onKeyDown,C=p?.onClick,{onKeyDown:P,onClick:w,...v}=s,N=useMemo(()=>bs(a,R&&isValidElement(t)&&"ref"in t?t.ref:void 0,u,x),[a,R,t,u,x]),B=n!=null?css({width:typeof n=="number"?`${n}px`:n}):void 0,K=useCallback(S=>{if(S.key==="Tab"){S.preventDefault();return}let F=S.currentTarget,M=b=>{I?.setIsKeyboardNav(true);let h=F.closest("[data-menu-id]");if(!h)return;h.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(E=>E.removeAttribute("data-highlighted"));let A=Array.from(h.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])')).filter(E=>{if(E.closest("[data-menu-id]")!==h)return false;let W=window.getComputedStyle(E);return W.display!=="none"&&W.visibility!=="hidden"});if(!A.length)return;let D=A.indexOf(F),L=D>=0?D:0,k=b==="next"?(L+1)%A.length:(L-1+A.length)%A.length;A[k]?.setAttribute("data-highlighted",""),A[k]?.focus();};if(S.key==="ArrowDown"){S.preventDefault(),S.stopPropagation(),c&&i(false),M("next");return}if(S.key==="ArrowUp"){S.preventDefault(),S.stopPropagation(),c&&i(false),M("prev");return}if(S.key==="ArrowRight"||S.key==="Enter"||S.key===" "){S.preventDefault(),S.stopPropagation(),I?.setIsKeyboardNav(true);let b=S.currentTarget;i(true),requestAnimationFrame(()=>{let h=T?document.querySelector(`[data-menu-id="${T}"]`):document.querySelector("[data-submenu-content]");if(h){h.setAttribute("data-keyboard-nav",""),b.removeAttribute("data-highlighted"),b.removeAttribute("data-hovered");let A=h.querySelector('[role="menuitem"]:not([aria-disabled="true"]):not([data-disabled]):not([data-subtrigger]), [role="menuitemcheckbox"]:not([aria-disabled="true"]):not([data-disabled]), [role="menuitemradio"]:not([aria-disabled="true"]):not([data-disabled])');A&&(A.setAttribute("data-highlighted",""),A.focus());}});return}if(S.key==="ArrowLeft"){S.preventDefault(),S.stopPropagation(),c&&i(false);let b=F.closest("[data-menu-id]");b&&b.setAttribute("data-keyboard-nav",""),document.querySelectorAll("[data-highlighted]").forEach(h=>h.removeAttribute("data-highlighted")),document.querySelectorAll("[data-hovered]").forEach(h=>h.removeAttribute("data-hovered")),F.setAttribute("data-highlighted",""),F.focus(),I&&I.setIsKeyboardNav(true);return}if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),m?.(S);return}m?.(S),P?.(S);},[c,i,m,P,u,I,T]),O=l==="hover"?{onMouseEnter:S=>{let F=S.currentTarget;lo(),y(),document.querySelectorAll("[data-hovered]").forEach(b=>b.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(b=>b.removeAttribute("data-highlighted")),F.setAttribute("data-hovered",""),F.focus({preventScroll:true});let M=F.closest("[data-menu-id]");M?.hasAttribute("data-keyboard-nav")&&M.removeAttribute("data-keyboard-nav"),I&&I.setIsKeyboardNav(false),c||d(true,90);},onMouseMove:S=>{let F=S.currentTarget;lo(),F.hasAttribute("data-hovered")||(document.querySelectorAll("[data-hovered]").forEach(M=>M.removeAttribute("data-hovered")),document.querySelectorAll("[data-highlighted]").forEach(M=>M.removeAttribute("data-highlighted")),F.setAttribute("data-hovered","")),!c&&!f?.current&&d(true,90);},onMouseLeave:()=>{d(false,60);}}:{onClick:S=>{S.stopPropagation(),i(!c),C?.(S),w?.(S);}};if(R&&g){let S=p?.css,F=typeof p?.className=="string"?p.className:void 0,M=typeof p?.tabIndex=="number"?p.tabIndex:0,b={ref:N,tabIndex:M,className:[F,o].filter(Boolean).join(" ")||void 0,css:[S,B,r].filter(Boolean),"aria-haspopup":"menu","aria-expanded":c,"data-subtrigger":"",__skipListReg:true,onKeyDown:K,onFocus:h=>{if(h.target.hasAttribute("data-highlighted")){let A=h.target.closest("[data-menu-id]");A&&!A.hasAttribute("data-keyboard-nav")&&(A.setAttribute("data-keyboard-nav",""),I&&I.setIsKeyboardNav(true));}p&&"onFocus"in p&&typeof p.onFocus=="function"&&p.onFocus(h);},...O,...v};return cloneElement(g,b)}return jsx("div",{ref:N,role:"menuitem",tabIndex:0,className:o,css:[css({display:"flex",alignItems:"center",gap:8,cursor:"pointer"}),B,r],"aria-haspopup":"menu","aria-expanded":c,"data-subtrigger":"",onKeyDown:K,onFocus:S=>{if(S.currentTarget.hasAttribute("data-highlighted")){let F=S.currentTarget.closest("[data-menu-id]");F&&!F.hasAttribute("data-keyboard-nav")&&(F.setAttribute("data-keyboard-nav",""),I&&I.setIsKeyboardNav(true));}},...O,...v,children:t})});Ei.displayName="DropdownMenuSubTrigger";var ki=me.forwardRef((e,t)=>{let n=hs(),{referenceRef:o,clearSubmenuHover:r,scheduleSubmenuHover:s}=mr(),a=[e.className,"plainframe-ui-submenu-content"].filter(Boolean).join(" ");return jsx(hn,{ref:t,side:"right",align:"start",exitPlacement:"bottom",animateOnBusClose:true,...e,className:a,"data-submenu-content":"",anchor:o.current,onMouseEnter:c=>{r(),n?.clearAllHover(),lo(),e.onMouseEnter?.(c);},onMouseLeave:c=>{s(false,60),e.onMouseLeave?.(c);}})});ki.displayName="DropdownMenuSubContent";var fr=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toLowerCase(),Cd=css({display:"inline"}),Si=css({display:"inline",fontWeight:700}),Rd=css({position:"absolute",inset:0,pointerEvents:"none",opacity:0,zIndex:-1,outline:"none"}),Td=css({display:"flex",alignItems:"center",gap:4}),wd=css({flex:"1 1 auto",minWidth:0,display:"flex",flexDirection:"column",gap:2}),Mi=css({fontWeight:500,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word"}),Ed=css({fontSize:"0.875em",overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400}),kd=()=>{},Id=e=>e,Sd=e=>`plainframe-ui-autocomplete${e?`-${e}`:""}`,Md=e=>{e.preventDefault(),e.stopPropagation();},Fd=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation());},Ad=e=>{e.preventDefault(),e.stopPropagation();},Fi=me.memo(({onCapture:e})=>{let t=useContext(fn),n=useContext(mo),o=useMemo(()=>({...t,activeIndex:n?.activeIndex??null,setActiveIndex:n?.setActiveIndex??t?.setActiveIndex}),[t,n]);return useEffect(()=>{e(o);},[o,e]),null});Fi.displayName="CtxCapture";var ys=me.memo(({item:e,absIndex:t,multiple:n,getCurrentMulti:o,isSelected:r,renderItem:s,paint:a,cls:c,closeOnSelect:i,pickSingle:l,handleItemKeyDown:u,handleItemMouseDown:d,descriptionColor:y})=>{let f=o(),T=useMemo(()=>{let R=String(e.title??e.value);return s?R:a(R)},[a,e.title,e.value,s]),I=useMemo(()=>e.description?jsxs("span",{className:"plainframe-ui-autocomplete-item-content",css:wd,children:[jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:T}),jsx("span",{className:"plainframe-ui-autocomplete-item-description",css:[Ed,{color:y}],children:e.description})]}):jsx("span",{className:"plainframe-ui-autocomplete-item-title",css:Mi,children:T}),[T,e.description,y]),x=useCallback(()=>{e.disabled||l(e.value);},[e.disabled,e.value,l]);if(n){let R=f.some(g=>Object.is(g,e.value));return s?jsx(co,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${c("checkbox-item")}`.trim(),css:e.css,onMouseDown:d,children:s(e,R)},e.value):jsx(co,{__index:t,value:e.value,disabled:!!e.disabled,closeOnSelect:false,"aria-disabled":!!e.disabled,className:`plainframe-ui-select-option ${c("checkbox-item")}`.trim(),css:e.css,onMouseDown:d,startIcon:e.startIcon,endIcon:e.endIcon,children:I},e.value)}return s?jsx(pn,{__index:t,onClick:x,onSelect:x,onKeyDown:u,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:c("item"),css:e.css,closeOnSelect:i,onMouseDown:d,selected:r,children:s(e,r)},e.value):jsx(pn,{startIcon:e.startIcon,endIcon:e.endIcon,__index:t,onClick:x,onSelect:x,onKeyDown:u,"aria-disabled":!!e.disabled,disabled:!!e.disabled,className:c("item"),css:e.css,closeOnSelect:i,onMouseDown:d,selected:r,children:I},e.value)},(e,t)=>!(e.item.value!==t.item.value||e.item.disabled!==t.item.disabled||e.item.description!==t.item.description||e.absIndex!==t.absIndex||e.multiple!==t.multiple||e.closeOnSelect!==t.closeOnSelect||e.renderItem!==t.renderItem||e.pickSingle!==t.pickSingle||e.isSelected!==t.isSelected||e.paint!==t.paint||e.descriptionColor!==t.descriptionColor));ys.displayName="AutocompleteRow";var Ai=me.memo(({items:e=[],onSelect:t,width:n=300,fullWidth:o=false,placeholder:r,renderItem:s,focusRingMode:a,css:c,inputCss:i,containerCss:l,label:u,helperText:d,variant:y,startIcon:f,endIcon:T,size:I,disabled:x=false,error:R=false,showClear:g=false,open:p,onOpenChange:m,openOnFocus:C=false,openOnType:P=true,openOnClick:w=true,closeOnSelect:v=true,closeOnBlur:N=true,blurOnSelect:B=false,freeSolo:K=false,customValueLabel:O=false,maxHeight:S,maxItems:F,noResultsText:M="No Items Found",highlightTypedValue:b,typedValueHighlightCss:h,showNoResults:A=true,noResultsLabelCss:D,loadingLabelCss:L,loadItems:k,loading:E,loadingText:W="Loading\u2026",debounceMs:$=200,multiple:z=false,selectedValues:_,defaultSelectedValues:H,onChangeSelected:U,expandIcon:X,showExpandIcon:ae=true,expandIconCss:q,textFieldWrapperCss:Y,textFieldInputCss:le,textFieldLabelCss:ie,textFieldHelperRowCss:be,textFieldHelperTextCss:Pe,textFieldStartIconCss:Re,textFieldEndIconCss:Ce,menuContentCss:Ie})=>{let we=V().text.secondary,[he,je]=useState(""),Z=typeof p=="boolean",[Ee,Q]=useState(false),ee=Z?p:Ee,se=useRef(null),pe=useRef(null),Se=useRef(null),Ne=useRef(null),J=useRef(false),oe=useRef(null),re=useRef(false),qe=useRef(0),j=useMemo(()=>[pe],[]),[ue,de]=useState(H??[]),fe=_??ue,ze=useRef(fe);ze.current=fe;let[Oe,st]=useState(null),Ye=useRef(Oe);Ye.current=Oe;let yt=useCallback(()=>ze.current,[]),[tn,nn]=useState([]),[Sn,on]=useState(false),Je=typeof k=="function",xt=Je?tn:e,ce=useRef(xt);ce.current=xt;let ke=!!E||Sn&&Je,at=useRef(m);useEffect(()=>{at.current=m;},[m]);let De=useCallback(G=>{Z||Q(G),at.current?.(G);},[Z]),bt=useRef(null);useEffect(()=>{if(!Je)return;bt.current&&window.clearTimeout(bt.current);let G=he;return bt.current=window.setTimeout(async()=>{on(true);try{let ne=await k(G)||[];nn(Array.isArray(ne)?ne:[]);}catch{nn([]);}finally{on(false);}},Math.max(0,$)),()=>{bt.current&&window.clearTimeout(bt.current);}},[he,Je,k,$]);let Zn=useMemo(()=>{let G=fr(he);return G?xt.some(ne=>fr(ne.title??ne.value)===G):false},[xt,he]),sa=K&&!!O&&he.trim().length>0&&!Zn,nc=G=>{if(typeof O=="object"){let ne=Object.prototype.hasOwnProperty.call(O,"prefix"),ve=Object.prototype.hasOwnProperty.call(O,"suffix");if(ne||ve){let Me=ne?O.prefix??"":"",ge=ve?O.suffix??"":"";return `${Me}${G}${ge}`}return `Add "${G}"`}return `Add "${G}"`},Or=useMemo(()=>{if(Je)return xt;let G=fr(he);if(!G)return xt;let ne=[],ve=[];for(let Me of xt){let ge=fr(Me.title??Me.value);ge.split(" ").some(Ze=>Ze.startsWith(G))?ne.push(Me):ge.includes(G)&&ve.push(Me);}return ne.length>0?ne:ve},[xt,he,Je]),aa=useMemo(()=>{if(sa){let G=he.trim();return [...Or,{value:G,title:nc(G),__pfui_free__:true}]}return Or},[Or,sa,he]),Kt=useMemo(()=>{let G=[],ne=new Map;for(let pt of aa){let Ze=pt.group??"__ungrouped__";ne.has(Ze)||(ne.set(Ze,[]),G.push(Ze)),ne.get(Ze).push(pt);}let Me=typeof F=="number"?Math.max(0,F):1/0,ge=[];for(let pt of G){if(Me<=0)break;let sn=ne.get(pt).slice(0,Me);sn.length>0&&(ge.push({label:pt==="__ungrouped__"?void 0:pt,items:sn}),Me-=sn.length);}return ge},[aa,F]),Mn=useMemo(()=>Kt.reduce((G,ne)=>(G.push(...ne.items),G),[]),[Kt]),Ho=Mn.length>0,Wr=!Ho&&!!A&&!ke&&he.trim().length>0,Fn=ke||Ho||Wr,Lo=Fn||Je;useEffect(()=>{!Je&&ee&&!Fn&&(re.current=true,De(false),setTimeout(()=>{re.current=false;},150));},[Je,ee,Fn,De]);let Kr=useRef(null),_r=useRef(false);useEffect(()=>{if(K&&!z){if(_r.current){_r.current=false;return}let G=he.trim();if(Kr.current===G)return;Kr.current=G,t?.({value:G,title:G});}},[he,K,z,t]);let jr=useCallback(G=>{let ne=ce.current,ve=new Map(ne.map(ge=>[ge.value,ge])),Me=G.map(ge=>ve.get(ge)??{value:ge,title:ge});U?.(Me);},[U]),Bo=useCallback(G=>{let ne=G.map(String);_||de(ne),jr(ne);},[_,jr]),ia=useCallback(G=>{let ve=fe.includes(G)?fe.filter(Me=>Me!==G):[...fe,G];Bo(ve);},[fe,Bo]),$o=useCallback(G=>{let ne=ce.current.find(ve=>ve.value===G)??{value:G,title:G};ne.disabled||(_r.current=true,Kr.current=(ne.title??ne.value).trim(),st(ne),je(ne.title??ne.value),t?.(ne),Z||(v?(J.current=false,re.current=true,Q(false),at.current?.(false),setTimeout(()=>{re.current=false;},150)):J.current=true),!v&&Se.current?.setActiveIndex&&Se.current.setActiveIndex(null),B?(J.current=false,setTimeout(()=>{Ne.current&&se.current?(Ne.current.tabIndex=0,Ne.current.focus(),Ne.current.blur(),Ne.current.tabIndex=-1):se.current?.blur();},0)):requestAnimationFrame(()=>se.current?.focus()));},[t,Z,v,B]),oc=useCallback(G=>{if(x)return;je(G);let ne=!G.trim();z||(ne?(st(null),t?.(null)):K&&st(null)),!Z&&!ne&&P&&!ee&&De(true);},[z,Z,P,ee,De,x,K,t]),it=Sd,la=kd,rc=Id,ca=useMemo(()=>h?[Si,h]:Si,[h]),sc=useCallback(G=>{let ne=he.trim();if(!ne||ne.length<1)return G;let ve=ne.toLowerCase(),ge=G.toLowerCase().indexOf(ve);return ge<0?G:jsxs("span",{className:"plainframe-ui-autocomplete-highlight-wrap",css:Cd,children:[G.slice(0,ge),jsx("span",{className:"plainframe-ui-autocomplete-highlight",css:ca,children:G.slice(ge,ge+ne.length)}),G.slice(ge+ne.length)]})},[he,ca]),zo=b?sc:rc,ac=useMemo(()=>css({position:"relative",display:o?"block":"inline-block",width:"100%",maxWidth:o?"100%":n}),[o,n]),Oo=Md,Wo=Fd,ic=useCallback(G=>{Se.current=G;},[]),ua=useCallback(G=>{let ne=Se.current;if(!ne)return;let ve=Mn.length;if(ve===0)return;let Me=pe.current?.querySelector("[data-menu-id]")??document.querySelector("[data-menu-id]"),ge=-1;if(Me){let Ze=Me.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"]'),sn=Me.querySelector("[data-active]")||Me.querySelector("[data-hovered]");sn&&(ge=Array.from(Ze).indexOf(sn));}ge<0&&typeof ne.activeIndex=="number"&&(ge=ne.activeIndex);let pt=ge<0?G===1?0:ve-1:(ge+G+ve)%ve;ne.setActiveIndex?.(pt),requestAnimationFrame(()=>{let Ze=pe.current?.querySelector("[data-menu-id]")??document.querySelector("[data-menu-id]");if(!Ze)return;Ze.setAttribute("data-keyboard-nav",""),Ze.querySelectorAll("[data-active]").forEach(Ur=>Ur.removeAttribute("data-active")),Ze.querySelectorAll("[data-hovered]").forEach(Ur=>Ur.removeAttribute("data-hovered"));let Vr=Ze.querySelectorAll('[role="menuitem"], [role="menuitemcheckbox"]')[pt];Vr&&(Vr.setAttribute("data-active",""),Vr.scrollIntoView?.({block:"nearest"}));});},[Mn.length]),lc=useCallback(G=>{if(G.key===" "||G.code==="Space"||G.key==="Spacebar"){G.stopPropagation();return}if(G.key==="ArrowDown"||G.key==="ArrowUp"){if(x||!Fn&&!Je)return;G.preventDefault(),!ee&&!Z&&De(true),ua(G.key==="ArrowDown"?1:-1);return}if(G.key==="Enter"){if(x)return;let ne=Se.current&&typeof Se.current.activeIndex=="number"?Se.current.activeIndex:-1,ve=ne>=0&&ne<Mn.length?Mn[ne]:null;if(ee&&ve&&ne>=0){G.preventDefault(),G.stopPropagation(),z?(ia(ve.value),v||requestAnimationFrame(()=>se.current?.focus())):$o(ve.value);return}}else G.key==="Escape"?(G.preventDefault(),G.stopPropagation(),ee&&!Z&&(re.current=true,De(false),G.target.focus(),setTimeout(()=>{re.current=false;},150))):G.key==="Tab"&&ee&&!Z&&De(false);},[Fn,Je,ee,Z,Mn,z,v,ua,ia,$o,De,x]),cc=useCallback(()=>{x||re.current||C&&Lo&&(qe.current=Date.now(),Z||De(true));},[Z,C,Lo,De,x]),uc=useCallback(()=>{if(J.current){J.current=false;return}N&&De(false),!K&&!z&&(Oe?je(Oe.title??Oe.value):he.trim()&&je(""));},[N,K,z,Oe,he,De]),da=useCallback(()=>{let G=[],ne=0;return Kt.forEach((ve,Me)=>{ve.label&&G.push(jsx(mn,{className:it("group-label"),children:ve.label},`g-${Me}`)),ve.items.forEach(ge=>{G.push(jsx(ys,{item:ge,absIndex:ne,multiple:true,getCurrentMulti:yt,isSelected:false,renderItem:s,paint:zo,cls:it,closeOnSelect:false,pickSingle:la,handleItemKeyDown:Wo,handleItemMouseDown:Oo,descriptionColor:we},`${ge.group??"__"}|${ge.value}`)),ne+=1;});}),jsx(gs,{values:fe,onValuesChange:Bo,children:G},"multi-group")},[Kt,it,yt,s,zo,fe,Bo,la,Wo,Oo,we]),pa=useCallback(()=>{let G=[],ne=0;return Kt.forEach((ve,Me)=>{ve.label&&G.push(jsx(mn,{className:it("group-label"),children:ve.label},`g-${Me}`)),ve.items.forEach(ge=>{let pt=Oe?.value===ge.value;G.push(jsx(ys,{item:ge,absIndex:ne,multiple:false,getCurrentMulti:yt,isSelected:pt,renderItem:s,paint:zo,cls:it,closeOnSelect:v,pickSingle:$o,handleItemKeyDown:Wo,handleItemMouseDown:Oo,descriptionColor:we},`${ge.group??"__"}|${ge.value}`)),ne+=1;});}),G},[Kt,it,Oe,yt,s,zo,v,$o,Wo,Oo,we]),dc=useMemo(()=>ke?jsx(mn,{css:L,className:it("label-loading"),children:W},"loading"):Wr?jsx(mn,{css:D,className:it("label-empty"),children:M},"empty"):Kt.length===0?null:z?da():pa(),[ke,Wr,Kt.length,it,W,M,z,da,pa]),rn=ee?false:x||!Je&&!Ho&&!A,ma=useCallback(G=>{G.preventDefault(),G.stopPropagation(),!(rn||x)&&(Z||(ee?(re.current=true,De(false),queueMicrotask(()=>se.current?.focus()),setTimeout(()=>{re.current=false;},150)):(De(true),queueMicrotask(()=>se.current?.focus()))));},[ee,Ho,Je,De,rn,x,Z]),fa=useMemo(()=>css({transition:"transform 0.3s cubic-bezier(.6,1.3,.5,1), opacity 0.15s ease",transform:ee?"rotate(180deg)":"rotate(0deg)",display:"flex",alignItems:"center",justifyContent:"center",cursor:rn?"not-allowed":"pointer",userSelect:"none",opacity:rn?.5:1}),[ee,rn]),Ko=useMemo(()=>ae?jsx("span",{ref:oe,role:"button",tabIndex:-1,css:[fa,q],"aria-disabled":rn||void 0,onMouseDown:Ad,onClick:ma,children:X??jsx(ChevronDown,{size:18,strokeWidth:2})}):null,[ae,fa,q,rn,ma,X]),pc=useMemo(()=>T&&Ko?jsxs("span",{css:Td,children:[T,Ko]}):T??Ko,[T,Ko]),mc=useCallback(G=>{if(!(oe.current&&oe.current.contains(G.target)||re.current||x||Date.now()-qe.current<300)){if(ee){!he.trim()&&!Z&&(re.current=true,De(false),setTimeout(()=>{re.current=false;},150));return}w&&Lo&&(!Z||w)&&De(true);}},[ee,he,w,Lo,De,x,Z]);return jsx("div",{ref:pe,className:it(""),css:[ac,l,c],children:jsxs($n,{open:x?false:ee,onOpenChange:x?void 0:De,children:[jsx(Fi,{onCapture:ic}),jsx(zn,{asChild:true,children:jsx("span",{className:it("anchor"),css:Rd,style:{pointerEvents:"none",position:"absolute",visibility:"hidden"},tabIndex:-1})}),jsx(Qo,{ref:se,className:it("input"),focusRingMode:a,value:he,onChange:oc,onKeyDown:lc,onFocus:cc,onBlur:uc,onSurfaceClick:mc,placeholder:r,label:u,helperText:d,variant:y,startIcon:f,endIcon:pc,size:I,width:n,fullWidth:o,disabled:x,error:R,showClear:g,css:i,wrapperCss:Y,inputCss:le,labelCss:ie,helperRowCss:be,helperTextCss:Pe,startIconCss:Re,endIconCss:Ce}),jsx("span",{ref:Ne,tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}}),Fn&&jsx(hn,{className:it("menu"),side:"bottom",align:"start",sameWidth:true,allItemsTabbable:true,maxHeight:typeof S=="number"?`${S}px`:S,css:Ie,ignoreOutsidePressRefs:j,disableOutsidePressDismiss:Z,returnFocus:!B,children:dc})]})})});Ai.displayName="Autocomplete";var Ld=["sm","md","lg"],Bd=(e,t)=>typeof e=="number"?e:Ld.includes(e)?t.componentHeights[e]:t.componentHeights.md,$d=(e,t)=>{let n=e.palette?.[t??"primary"]??e.palette.primary;return n?.[600]??n?.[500]??e.neutral?.[600]??e.neutral?.[500]},zd=(e,t)=>{let n=e.text?.onColors??{};return n[t??"primary"]??n.primary??e.text?.primary??"#fff"},Od=(e,t)=>typeof e=="string"?e:(t?.trim()?.[0]||"").toUpperCase(),Pi=me.memo(forwardRef(({src:e,alt:t,size:n="md",color:o="primary",rounded:r=true,className:s,css:a,children:c,...i},l)=>{let u=V(),[d,y]=useState(!!e);useEffect(()=>{y(!!e);},[e]);let f=Bd(n,u),T=typeof f=="number"?f:Number.parseFloat(String(f))||0,I=T?Math.round(T*(T<=28?.55:.52)):void 0,x=r?u.radius.full:u.radius.md,R=$d(u,o),g=zd(u,o),p=Od(c,t),m=css({width:f,height:f,borderRadius:x,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden",background:d?"transparent":R,color:d?"inherit":g,boxSizing:"border-box",userSelect:"none"}),C=css({width:"100%",height:"100%",display:"block",objectFit:"cover"}),P=css({fontSize:I,lineHeight:1,fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",marginTop:-1});return jsx("div",{ref:l,className:["plainframe-ui-avatar",s||""].join(" ").trim(),css:[m,a],role:d?void 0:"img","aria-label":d?void 0:t,...i,children:d&&e?jsx("img",{className:"plainframe-ui-avatar-img",src:e,alt:t,css:C,onError:()=>y(false),decoding:"async",loading:"lazy"}):typeof c=="string"?jsx("span",{className:"plainframe-ui-avatar-initials",css:P,children:c}):c||jsx("span",{className:"plainframe-ui-avatar-initials",css:P,children:p})})}));Pi.displayName="Avatar";var Ni=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,jd=({children:e,max:t,size:n="md",overlap:o=-7,css:r,rounded:s=true,bgColor:a,extraLabelCss:c,outlineThickness:i=4,className:l})=>{let u=V(),d=xe(),f=(()=>{if(typeof n=="number")return `${n}px`;if(typeof n=="string"){let w=(u.componentHeights&&u.componentHeights[n])??(u.spacing&&u.spacing[n]);return Ni(w??n)}return "32px"})(),T=Children.toArray(e).filter(Boolean),I=typeof t=="number"&&t>=0,x=I&&T.length>t?T.slice(0,t):T,R=I&&T.length>t?T.length-t:0,g=a==="panel"?u.surface.panelBg:a==="subtle"?u.surface.subtleBg:a??u.surface.appBg,p=Ni(i)??"4px",m=css({display:"flex",alignItems:"center"}),C=w=>css({marginLeft:w===0?0:o,zIndex:x.length-w,boxShadow:`0 0 0 ${p} ${g}`,backgroundColor:g,borderRadius:s?u.radius.full:u.radius.md,display:"inline-flex",width:f,height:f,overflow:"hidden",alignItems:"center",justifyContent:"center",lineHeight:0,flex:"0 0 auto"}),P=css({width:"100%",height:"100%",display:"inline-flex",alignItems:"center",justifyContent:"center",objectFit:"cover",boxSizing:"border-box"});return jsxs("div",{role:"group",tabIndex:-1,"aria-label":"Avatar group",className:`plainframe-ui-avatar-group${l?` ${l}`:""}`,css:[m,r,d()],children:[x.map((w,v)=>{if(!isValidElement(w))return jsx("div",{className:"plainframe-ui-avatar-group-item",css:C(v),children:jsx("span",{css:P,children:w})},v);let N=w,B=N.props?.css,K=B==null?P:[P,B],O=cloneElement(N,{size:n,rounded:s,css:K,style:{...N.props?.style,width:"100%",height:"100%",objectFit:N.props?.objectFit??"cover"}});return jsx("div",{className:"plainframe-ui-avatar-group-item",css:C(v),children:O},v)}),R>0&&jsxs("span",{className:"plainframe-ui-avatar-group-extra",css:[css({marginLeft:5,fontSize:u.typography.sizes.sm,fontWeight:600,lineHeight:1,padding:"2px 1px",zIndex:2,color:u.text.secondary}),c],"aria-label":`+${R} more`,children:["+",R]})]})};var Li=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Ud=(e,t)=>{let n=e,o=n.palette||{},r=n.neutral||{};return t==="neutral"||t==="secondary"?{scale:r,onKey:"neutral"}:typeof t=="string"&&o[t]?{scale:o[t],onKey:t}:{scale:n.primary||r,onKey:"primary"}},qd=e=>e[600]??e[500]??e[400]??Object.values(e)[0]??"#000",Gd=(e,t,n,o)=>o??t[n]??t.primary??e.text?.primary??"#fff",Xd=(e,t,n)=>n==="dot"?"":typeof e=="number"&&typeof t=="number"&&e>t?`${t}+`:e??"",Yd=(e,t,n,o)=>e&&(t==="dot"||!!n||n===0&&o),Jd=me.memo(({content:e,color:t="primary",fontColor:n,fontWeight:o=600,fontSize:r,variant:s="dot",max:a=99,showZero:c=false,visible:i=true,anchorOrigin:l={vertical:"top",horizontal:"right"},overlap:u="rectangular",children:d,animate:y=true,size:f,outline:T=false,outlineColor:I,className:x,badgeClassName:R,css:g,badgeCss:p,offsetX:m,offsetY:C})=>{let P=V(),w=s==="dot",v=f??(w?8:17),N=r??(w?0:10),{scale:B,onKey:K}=Ud(P,t),O=qd(B),S=P.text?.onColors||{},F=Gd(P,S,K,n),M=Xd(e,a,s),b=Yd(i,s,e,c),h=css({position:"relative",display:"inline-block"}),A=u==="circular"?w?"12.5%":"5%":w?"5%":"2.5%",D=Li(m??A),L=Li(C??A),k=l.vertical||"top",E=l.horizontal||"right",W={},$="0",z="0";k==="center"?(W.top="50%",z="-50%"):k==="top"?(W.top=L,z="-45%"):(W.bottom=L,z="45%"),E==="center"?(W.left="50%",$="-50%"):E==="right"?(W.right=D,$="45%"):(W.left=D,$="-45%");let _=b?1:.8,H=css({minWidth:w?v:v/2,height:v,background:O,color:F,fontSize:typeof N=="number"?`${N}px`:N,fontWeight:o,borderRadius:999,padding:w?0:`0 ${v/4}px`,boxShadow:"0 2px 8px rgba(0,0,0,0.04)",lineHeight:1,position:"absolute",pointerEvents:"none",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",...T?{boxShadow:`0 0 0 2px ${I??P.surface?.appBg}`}:{},opacity:b?1:0,transform:`translate(${$}, ${z}) scale(${b?_:.5})`,...y?{transition:"opacity .18s cubic-bezier(.4,1.6,.6,1), transform .18s cubic-bezier(.4,1.6,.6,1)"}:{},...W});return jsxs("div",{className:["plainframe-ui-badge-wrapper",x||""].join(" ").trim(),css:[h,g],children:[d,jsx("span",{"aria-hidden":!b,className:["plainframe-ui-badge",R||""].join(" ").trim(),css:[H,p],children:M})]})});var Es=({on:e,onClickAway:t,blur:n=false,blurDepth:o=2.5,color:r,zIndex:s=1e3,css:a,contentCss:c,overlayCss:i,children:l,transitionDuration:u=300,keepMounted:d=true,className:y,contentClassName:f,lockScroll:T=true,...I})=>{let x=V(),R=useMemo(()=>r??x.surface.overlayBg,[r,x.surface.overlayBg]),[g,p]=useState(e),[m,C]=useState(e),P=useRef(null),w=useRef(null),v=useRef(null);useEffect(()=>(P.current&&(clearTimeout(P.current),P.current=null),w.current!=null&&(cancelAnimationFrame(w.current),w.current=null),e?(p(true),w.current=requestAnimationFrame(()=>{C(true),w.current=null;})):(C(false),P.current=setTimeout(()=>{p(false),P.current=null;},u)),()=>{P.current&&(clearTimeout(P.current),P.current=null),w.current!=null&&(cancelAnimationFrame(w.current),w.current=null);}),[e,u]),useEffect(()=>{if(!T||!e)return;let F=document.body,M=F.style.overflow,b=F.style.paddingRight,h=window.innerWidth-document.documentElement.clientWidth,A=parseFloat(getComputedStyle(F).paddingRight||"0");return F.style.overflow="hidden",h>0&&(F.style.paddingRight=`${A+h}px`),()=>{F.style.overflow=M,F.style.paddingRight=b;}},[e,T]),useEffect(()=>{if(!m||!t)return;let F=M=>{M.key==="Escape"&&t();};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[m,t]);let N=F=>{if(!m||!t||!v.current)return;let M=F.target;M&&!v.current.contains(M)&&t();},B=n&&o?typeof o=="number"?`${o}px`:o:void 0;if(!d&&!g)return null;let K=css({position:"fixed",inset:0,width:"100vw",height:"100vh",zIndex:s,display:"grid",placeItems:"center",pointerEvents:m?"auto":"none",visibility:g?"visible":"hidden"}),O=css({position:"absolute",inset:0,background:R,backdropFilter:B?`blur(${B})`:void 0,WebkitBackdropFilter:B?`blur(${B})`:void 0,opacity:m?1:0,transition:`opacity ${u}ms cubic-bezier(.4,0,.2,1)`,pointerEvents:m?"auto":"none"}),S=css({position:"relative",zIndex:1,pointerEvents:m?"auto":"none"});return jsxs("div",{"aria-hidden":!g||void 0,className:["plainframe-ui-backdrop",y||""].join(" ").trim(),css:[K,a],onPointerDown:N,...I,children:[jsx("div",{className:"plainframe-ui-backdrop-overlay",css:[O,i],role:"presentation"}),jsx("div",{ref:v,className:["plainframe-ui-backdrop-content",f||""].join(" ").trim(),css:[S,c],children:l})]})};var yr=()=>null;Object.defineProperty(yr,"displayName",{value:"PF.BreadCrumbItem",configurable:true});function np(e){let t=e.props??{};return {type:typeof t.__EMOTION_TYPE_PLEASE_DO_NOT_USE__<"u"?t.__EMOTION_TYPE_PLEASE_DO_NOT_USE__:e.type,props:t}}var op=me.memo(({children:e,separator:t="/",css:n,crumbCss:o,activeCrumbCss:r,inactiveCrumbCss:s,linkCrumbCss:a,separatorCss:c,hover:i=true,className:l,...u})=>{let d=V(),y=xe(),f=me.useMemo(()=>me.Children.toArray(e).flatMap(p=>{if(!me.isValidElement(p))return [];let{type:m,props:C}=np(p);if(!(m===yr||typeof m=="function"&&"displayName"in m&&m.displayName===yr.displayName))return [];let w=C;return [{href:w.href,disabled:w.disabled,node:w.children,className:w.className,css:w.css,onClick:w.onClick,startIcon:w.startIcon,endIcon:w.endIcon}]}),[e]),T=me.useMemo(()=>css({display:"flex",alignItems:"center",fontSize:d.typography.sizes.sm,fontWeight:500,gap:d.spacing.xs,cursor:"default"}),[d]),I=me.useMemo(()=>css({margin:"0 0.15rem",color:d.neutral[500],flex:"0 0 auto",justifyContent:"center",alignItems:"center",display:"flex"}),[d]),x=me.useCallback((p,m,C)=>{let P=p?d.text.primary:d.text.secondary,w=i&&m&&!C;return css({display:"inline-flex",alignItems:"center",gap:d.spacing.xs,color:P,cursor:m&&!C?"pointer":"default",textDecoration:"none",borderRadius:d.radius.xs,fontWeight:500,outline:"none",transition:"all .16s ease !important","&:hover":w?{textDecoration:"underline",color:d.text.primary}:{textDecoration:"none"}})},[d,i]),R=me.useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0}),[]),g=me.useMemo(()=>css({display:"inline-block"}),[]);return jsx("nav",{"aria-label":"Breadcrumb",className:["plainframe-ui-breadcrumbs",l||""].join(" ").trim(),css:[T,n],...u,children:f.map((p,m)=>{let C=m===f.length-1,P=!!p.href&&!p.disabled&&!C,w=["plainframe-ui-breadcrumb",C?"plainframe-ui-breadcrumb--active":"plainframe-ui-breadcrumb--inactive",P?"plainframe-ui-breadcrumb--link":"",p.className||""].join(" ").trim(),v=[x(C,P,p.disabled),o,C?r:s,P?a:void 0,y(),p.css],N=jsxs(Fragment,{children:[p.startIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-start",css:R,children:p.startIcon}),jsx("span",{className:"plainframe-ui-breadcrumb-label",css:g,children:p.node}),p.endIcon&&jsx("span",{className:"plainframe-ui-breadcrumb-icon-end",css:R,children:p.endIcon})]});return jsxs(me.Fragment,{children:[m!==0&&jsx("span",{className:"plainframe-ui-breadcrumb-separator",css:[I,c],children:t}),P?jsx("a",{href:p.href,onClick:p.onClick,tabIndex:0,"data-active":C?"true":"false","data-link":"true",className:w,css:v,children:N}):jsx("span",{"aria-current":C?"page":void 0,tabIndex:C?-1:0,"data-active":C?"true":"false","data-link":"false",className:w,css:v,children:N})]},m)})})});var ks=(e,t)=>{if(!isValidElement(e))return e;let n=e.props,o={};return n.size===void 0&&(o.size=t),n.color===void 0&&(o.color="currentColor"),cloneElement(e,{...n,...o})},Is=e=>typeof e=="number"?`${e}px`:e,Oi=e=>{let t=false;return me.Children.forEach(e,n=>{t||(typeof n=="string"||typeof n=="number"?String(n).trim()!==""&&(t=true):Array.isArray(n)&&Oi(n)&&(t=true));}),t};function ip(e,t){let n=e,o=typeof t=="string"&&(t==="sm"||t==="md"||t==="lg")?t:"md";return o==="sm"?{fontSize:n.typography.sizes.sm,paddingY:n.spacing.xs,paddingX:n.spacing.md,paddingXIcon:n.spacing.md,iconSize:14,minHeight:n.componentHeights.sm,radius:n.radius.sm}:o==="lg"?{fontSize:n.typography.sizes.md,paddingY:n.spacing.sm,paddingX:n.spacing.lg,paddingXIcon:n.spacing.md,iconSize:18,minHeight:n.componentHeights.lg,radius:n.radius.md}:{fontSize:n.typography.sizes.sm,paddingY:n.spacing.sm,paddingX:n.spacing.lg,paddingXIcon:n.spacing.md,iconSize:16,minHeight:n.componentHeights.md,radius:n.radius.md}}function lp(e,t){let n=e.neutral,o=e.text,r=e.palette,s=r.primary||n,a=r.danger||r.error||s,c=e.text.onColors||{},i=c.primary??o.onColors.primary,l=c.danger??i,u=(d,y,f)=>d&&d[y]||f;if(t==="primary"){let d=s,y=u(d,600,n[900])||u(d,500,n[900]),f=u(d,500,n[800])||u(d,600,n[800]);return {bg:y,fg:i,hoverBg:f,border:"none"}}if(t==="destructive"){let d=a,y=u(d,600,n[900])||u(d,500,n[900]),f=u(d,500,n[800])||u(d,600,n[800]);return {bg:y,fg:l,hoverBg:f,border:"none"}}return t==="ghost-destructive"?{bg:"transparent",fg:a[700],hoverBg:e.palette.danger[50],border:"none"}:t==="subtle"?{bg:e.surface.subtleBg,fg:o.primary,hoverBg:e.surface.subtleHover,border:"none"}:t==="outlined"?{bg:e.surface.panelBg,fg:o.primary,hoverBg:e.surface.panelHover,border:`${e.componentHeights.border} solid ${e.surface.border}`}:t==="ghost"?{bg:"transparent",fg:e.text.primary,hoverBg:e.surface.subtleBg,border:"none"}:t==="quiet"?{bg:"transparent",fg:o.secondary,hoverBg:e.surface.subtleBg,border:"none"}:{bg:"transparent",fg:o.secondary,hoverBg:e.surface.subtleBg,border:"none"}}var Wi=me.memo(me.forwardRef(({variant:e="primary",size:t="md",startIcon:n,endIcon:o,rounded:r=false,fullWidth:s=false,disabled:a=false,loading:c=false,loadingIndicator:i,loadingPosition:l="center",children:u,className:d,hoverEffect:y=true,icon:f,onClick:T,css:I,...x},R)=>{let g=V(),p=xe(),m=useMemo(()=>ip(g,t),[g,t]),C=useMemo(()=>lp(g,e),[g,e]),P=useMemo(()=>f===true?true:f===false?false:!n&&!o&&!Oi(u)&&me.Children.count(u)===1,[f,n,o,u]),w=m.iconSize,v=useMemo(()=>ks(n,w),[n,w]),N=useMemo(()=>ks(o,w),[o,w]),B=useMemo(()=>i??jsx(no,{color:C.fg,variant:"circular",size:14,thickness:5}),[i,C]),K=useMemo(()=>P?"center":l??"center",[P,l]),O=!!c&&K==="center",S=!!c&&K==="start",F=!!c&&K==="end",M=a||c,b=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",gap:0,width:s?"100%":"auto",minHeight:m.minHeight,lineHeight:1,fontWeight:600,cursor:M?"not-allowed":"pointer",opacity:M?.5:1,userSelect:"none",position:"relative",borderRadius:r?g.radius.full:m.radius,outline:"none",willChange:"box-shadow, transform, outline-offset",transition:"box-shadow 140ms ease, transform 90ms ease, outline-offset 140ms ease"}),[s,m,r,g,M]),h=useMemo(()=>css({backgroundColor:C.bg,color:C.fg,border:C.border}),[C]),A=useMemo(()=>css({overflow:"hidden","::before":{content:'""',position:"absolute",inset:0,backgroundColor:C.hoverBg,opacity:0,pointerEvents:"none",transition:"opacity 140ms ease",zIndex:0},"@media (hover: hover) and (pointer: fine)":y&&!M?{":hover::before":{opacity:1}}:{}}),[C,y,M]),D=useMemo(()=>css(P&&!s?{width:"100%",height:"100%",maxWidth:m.minHeight,minWidth:m.minHeight,maxHeight:m.minHeight,display:"flex",alignItems:"center",justifyContent:"center",fontSize:Is(m.iconSize)}:{fontSize:Is(m.fontSize),padding:n||o?`${m.paddingY} ${m.paddingXIcon}`:`${m.paddingY} ${m.paddingX}`}),[P,s,m,n,o]),L=useMemo(()=>css({position:"relative",zIndex:1,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:Is(g.spacing.sm),opacity:O?0:1,transition:"opacity 140ms ease"}),[g,O]),k=useMemo(()=>css({height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}),[]),E=useMemo(()=>typeof m.iconSize=="number"?m.iconSize:Math.max(12,Math.round(parseFloat(String(m.iconSize))||16)),[m.iconSize]),W=useMemo(()=>css({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:E,minWidth:E,maxWidth:E,height:"1em"}),[E]),$=useMemo(()=>X=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:X?1:0,transition:"opacity 140ms ease"}),[]),z=useMemo(()=>css({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",opacity:O?1:0,pointerEvents:"none",zIndex:2,transition:"opacity 140ms ease"}),[O]),_=useMemo(()=>()=>{if(P)return null;let X=!!n;return !X&&!S?null:jsxs("span",{css:W,"aria-hidden":c?true:void 0,children:[jsx("span",{css:$(!S),children:X?v||n:null}),jsx("span",{css:$(!!S),children:B})]})},[P,n,S,W,$,v,c,B]),H=useMemo(()=>()=>{if(P)return null;let X=!!o;return !X&&!F?null:jsxs("span",{css:W,"aria-hidden":c?true:void 0,children:[jsx("span",{css:$(!F),children:X?N||o:null}),jsx("span",{css:$(!!F),children:B})]})},[P,o,F,W,$,N,c,B]),U=!(a||c);return jsxs("button",{ref:R,type:"type"in x&&x.type?x.type:"button","data-variant":e,className:["plainframe-ui-button",d||""].join(" ").trim(),css:[b,p({color:e==="primary"?"primary":e==="destructive"||e==="ghost-destructive"?"danger":"neutral"}),h,A,D,I],onClick:U?T:void 0,disabled:a||void 0,tabIndex:c?-1:void 0,"aria-disabled":a||void 0,"aria-busy":c||void 0,...x,children:[jsxs("span",{className:"plainframe-ui-button-content",css:L,children:[_(),jsx("span",{className:"plainframe-ui-button-label",css:k,children:P?c?B:ks(u,m.iconSize):u}),H()]}),jsx("span",{className:"plainframe-ui-button-center-overlay",css:z,"aria-hidden":"true",children:O?B:null})]})}));Wi.displayName="Button";var Rr=e=>isValidElement(e),cp=e=>{let t=e.type;return t.displayName??t.name},As=(e,t)=>cp(e)===t,ji=e=>As(e,"ButtonGroup"),Vi=e=>As(e,"DropdownMenu"),Ms=e=>As(e,"DropdownMenuTrigger"),Kn=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,up=(e,t=1)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:/^\d+(\.\d+)?$/.test(e)?`${e}px`:e,dp=e=>typeof e=="string"&&/^(outlined|outlined-soft|outline-soft)$/i.test(e),Fs=(e,t)=>{if(!Rr(e))return null;if(ji(e)){let n=Children.toArray(e.props.children).filter(isValidElement);return n.length?Fs(t?n[0]:n[n.length-1],t):null}if(Vi(e)){let o=Children.toArray(e.props.children).filter(isValidElement).find(Ms);return o?Fs(o,t):null}if(Ms(e)){let n=Children.toArray(e.props.children??[]).filter(isValidElement);return n.length?n[0]:null}return e},_i=(e,t)=>{if(!e)return false;let n=Fs(e,t==="left"),o=n&&n.props&&typeof n.props=="object"?n.props.variant:void 0;return dp(o)},Ui=me.memo(me.forwardRef(function({children:t,attached:n=false,direction:o="horizontal",fullWidth:r=false,disabled:s=false,size:a="md",rounded:c=false,gap:i,width:l,className:u,role:d="group",css:y,__clipLeft:f,__clipRight:T,...I},x){let R=V(),g=a==="sm"?R.radius.sm:R.radius.md,p=c?R.radius.full:g,m=o==="vertical",C=up(R.componentHeights.border,1),P=R.surface.border,w=n&&!!f,v=n&&!!T,N=css({display:"flex",flexDirection:m?"column":"row",width:r?"100%":l!=null?Kn(l):"auto",maxWidth:"none",backgroundColor:"transparent",gap:n?0:Kn(i??R.spacing.sm)}),B=Children.toArray(t),O=B.filter(Rr).length,S=0,F=false,M=[];for(let b of B){if(!Rr(b)){M.push(b);continue}let h=S===0,A=S===O-1,D=b.props??{},L=D.disabled??s,k=D.size??a,E=0,W=0,$=0,z=0;n&&(m?(E=h?w?0:p:0,W=h?v?0:p:0,z=A?w?0:p:0,$=A?v?0:p:0):(E=h?w?0:p:0,z=h?w?0:p:0,W=A?v?0:p:0,$=A?v?0:p:0));let _=_i(b,"left"),H=_i(b,"right"),ae=n&&!h&&!(F&&_)&&!(F||_)?css({[m?"borderTop":"borderLeft"]:`${C} solid ${P}`}):null,q=n&&!h&&F&&_?css(m?{borderTopWidth:0}:{borderLeftWidth:0}):null,Y=n?css({borderTopLeftRadius:Kn(E),borderTopRightRadius:Kn(W),borderBottomRightRadius:Kn($),borderBottomLeftRadius:Kn(z)}):null,le=r?css({flex:"1 1 0%",minWidth:0,width:"100%"}):null,ie=css([Y,ae,q,le]);if(!Vi(b)){let Ce=D.css,Ie=[D.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" "),Te=ji(b)&&n?{__clipLeft:!h,__clipRight:!A}:{},we=cloneElement(b,{...D,disabled:L,size:k,className:Ie,css:[Ce,ie],...Te});M.push(we),F=H,S+=1;continue}let be=D.children,Pe=Children.map(be,Ce=>{if(!Rr(Ce)||!Ms(Ce))return Ce;let Ie=Ce.props,Te=[Ie.className,"plainframe-ui-button-group-item"].filter(Boolean).join(" ");return cloneElement(Ce,{...Ie,css:[Ie.css,ie],className:Te,disabled:L,size:k})}),Re=cloneElement(b,{...D,children:Pe});M.push(Re),F=H,S+=1;}return jsx("div",{ref:x,role:d,"aria-orientation":m?"vertical":"horizontal","data-attached":n||void 0,"data-direction":o,className:["plainframe-ui-button-group",u||""].join(" ").trim(),css:[N,y],...I,children:M})}));Ui.displayName="ButtonGroup";var Tr=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,hp=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.spacing??t.space;return Tr(n?.[e]??e)}}},yp=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.radius??t.radii;return Tr(n?.[e]??e)}}},xp=(e,t)=>{let n=t.surface??{};return e==="panel"||e==="outlined"?n.panelBg??"transparent":e==="subtle"?n.subtleBg??"transparent":"transparent"},vp=(e,t,n)=>{let o=t.surface??{};return e==="panel"||e==="outlined"?o.panelHover??o.panelBg??n:e==="subtle"?o.subtleHover??o.subtleBg??n:o.subtleBg??n},_n=me.memo(forwardRef(function({children:t,css:n,variant:o="ghost",padding:r,radius:s,className:a,hoverable:c,selectable:i,selected:l,defaultSelected:u,onSelectedChange:d,width:y,height:f,onClick:T,onKeyDown:I,role:x,tabIndex:R,...g},p){let m=V(),C=m.surface??{},[P,w]=useState(!!u),v=l!=null,N=v?!!l:P,B=useMemo(()=>xp(o,m),[o,m]),K=useMemo(()=>vp(o,m,B),[o,m,B]),O=K,S=useMemo(()=>hp(r,m),[r,m]),F=useMemo(()=>yp(s,m),[s,m]),M=!!c||!!i,b=useMemo(()=>css({backgroundColor:B,padding:S,borderRadius:F,border:o==="outlined"?`${m.componentHeights?.border??"1px"} solid ${C.border??"transparent"}`:void 0,backgroundClip:"padding-box",boxSizing:"border-box",width:y?"100%":void 0,maxWidth:Tr(y),height:Tr(f),outline:"none",transition:"background-color .16s ease, border-color .16s ease",cursor:M?"pointer":void 0,...M?{"&:hover":{backgroundColor:K}}:{},'&[data-selected="true"]':{backgroundColor:O},...M?{'&[data-selected="true"]:hover':{backgroundColor:O}}:{}}),[B,S,F,o,m.componentHeights,C.border,y,f,M,K,O]),h=useCallback(()=>{if(!i)return;let k=!N;v||w(k),d?.(k);},[v,d,i,N]),A=useCallback(k=>{i&&h(),T?.(k);},[i,h,T]),D=useCallback(k=>{i&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),h()),I?.(k);},[i,h,I]),L=xe();return jsx("div",{ref:p,"data-variant":o,"data-selected":i&&N?"true":void 0,"aria-pressed":i?N:void 0,className:["plainframe-ui-container",a||""].join(" ").trim(),css:[L(),b,n],onClick:A,onKeyDown:D,role:i?x??"button":x,tabIndex:i?R??0:R,...g,children:t})}));_n.displayName="Container";var Rp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Ns(e,t){if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.spacing??t.space;if(n&&e in n){let o=n[e];return Rp(o)}return e}}}function yo(e){switch(e){case "center":return "center";case "end":return "flex-end";case "start":default:return "flex-start"}}function Ds(e){switch(e){case "center":return "center";case "end":return "right";case "start":default:return "left"}}function Tp(e,t){if(e==null)return t.spacing?.md??void 0;if(typeof e=="number")return e;if(typeof e=="string"){let n=t.spacing??t.space??{};return e in n?n[e]:e}}function xo(e,t,n,o){let r=Ns(t,e),s=Ns(n,e),a=Ns(o,e),c={};return r&&!s&&!a&&(c.padding=r),s&&(c.paddingLeft=s,c.paddingRight=s),a&&(c.paddingTop=a,c.paddingBottom=a),c}function qi(e,t){if(t)return t==="primary"?e.text?.primary:t==="secondary"?e.text?.secondary:t}var Gi=me.createContext("horizontal"),Hs=()=>me.useContext(Gi),Xi=me.memo(me.forwardRef(({children:e,css:t,variant:n="ghost",padding:o="md",radius:r="lg",hoverable:s,selectable:a,selected:c,defaultSelected:i,onSelectedChange:l,width:u="100%",height:d,gap:y,direction:f="horizontal",className:T,onClick:I,...x},R)=>{let g=V(),p=xe(),m=f==="vertical",C=css({position:"relative",display:"flex",flexDirection:m?"column":"row",gap:Tp(y,g),alignItems:m?"stretch":"center",transition:"all .16s ease"});return jsx(Gi.Provider,{value:f,children:jsx(_n,{ref:R,variant:n,padding:o,radius:r,hoverable:s,selectable:a,selected:c,defaultSelected:i,onSelectedChange:l,width:u,height:d,className:["plainframe-ui-card",T||""].join(" ").trim(),css:[p(),C,t],onClick:I,tabIndex:I?0:void 0,...x,children:e})})}));Xi.displayName="Card";var wp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Hs()==="vertical",d=css({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:yo(o),textAlign:Ds(o),...u?{width:"100%"}:{flex:1,minWidth:0},...xo(i,r,s,a)});return jsx("div",{"data-slot":"card-content",className:["plainframe-ui-card-content",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Ep=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Hs()==="vertical",d=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...u?{width:"100%"}:{},...xo(i,r,s,a)});return jsx("div",{"data-slot":"card-start",className:["plainframe-ui-card-start",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),kp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,...c})=>{let i=V(),u=Hs()==="vertical",d=css({display:"flex",flexShrink:0,justifyContent:yo(o),alignItems:yo(o),...u?{width:"100%"}:{},gap:i.spacing.xs,color:i.text.secondary,...xo(i,r,s,a)});return jsx("div",{"data-slot":"card-end",className:["plainframe-ui-card-end",n||""].join(" ").trim(),css:[d,t],...c,children:e})}),Ip=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,weight:c,size:i,color:l,...u})=>{let d=V(),y=css({fontWeight:c??500,fontSize:i??(d.typography?.sizes?.sm!==void 0?d.typography.sizes.sm:"1rem"),color:qi(d,l)??d.text?.primary,textAlign:Ds(o),...xo(d,r,s,a),display:"flex",alignItems:"center",gap:d.spacing?.xs??6});return jsx("div",{"data-slot":"card-title",className:["plainframe-ui-card-title",n||""].join(" ").trim(),css:[y,t],...u,children:e})}),Sp=me.memo(({children:e,css:t,className:n,align:o="start",padding:r,paddingX:s,paddingY:a,weight:c,size:i,color:l,...u})=>{let d=V(),y=css({fontWeight:c??400,fontSize:i??(d.typography?.sizes?.sm!==void 0?d.typography.sizes.sm:"0.875rem"),color:qi(d,l)??d.text?.secondary,marginTop:d.spacing?.xxs??2,textAlign:Ds(o),...xo(d,r,s,a)});return jsx("div",{"data-slot":"card-description",className:["plainframe-ui-card-description",n||""].join(" ").trim(),css:[y,t],...u,children:e})});var Ji=e=>isValidElement(e),Pp=e=>Ji(e)?e.type?.displayName||e.type?.name:void 0,Yi=e=>Pp(e)==="Card",Np=e=>typeof e=="number"?`${e}px`:e,Zi=({children:e,attached:t=false,gap:n,width:o,direction:r="vertical",variant:s,className:a,role:c="group",css:i})=>{let l=V(),u=r==="vertical",d=String(l.componentHeights?.border??"1px"),y=l.surface.border,f={display:"flex",flexDirection:u?"column":"row",width:typeof o=="string"||typeof o=="number"?Np(o):"auto",maxWidth:"none",gap:t?0:n??l.spacing?.sm},T=Children.toArray(e),x=T.filter(Yi).length,R=0,g=T.map((p,m)=>{if(!Yi(p)||!Ji(p))return p;let C=p.props,P=R++,w=P===0,v=P===x-1,N=s??C.variant,B=t?u?{borderTopLeftRadius:w?C.radius:0,borderTopRightRadius:w?C.radius:0,borderBottomLeftRadius:v?C.radius:0,borderBottomRightRadius:v?C.radius:0}:{borderTopLeftRadius:w?C.radius:0,borderBottomLeftRadius:w?C.radius:0,borderTopRightRadius:v?C.radius:0,borderBottomRightRadius:v?C.radius:0}:void 0,K=t&&!w?u?{borderTopWidth:0}:{borderLeftWidth:0}:void 0,O=N==="subtle"&&x>1&&!w?u?{borderTop:`${d} solid ${y}`}:{borderLeft:`${d} solid ${y}`}:null,F=[B,K,O,t?{width:"100%"}:{width:"100%",marginBottom:u?0:void 0,marginRight:u?void 0:0}].filter(Boolean),M=[C.className,"plainframe-ui-card-group-item"].filter(Boolean).join(" ");return cloneElement(p,{...C,variant:N??C.variant,css:[C.css,...F],className:M,key:typeof p=="object"&&"key"in p?p.key:m})});return jsx("div",{role:c,"aria-orientation":u?"vertical":"horizontal","data-attached":t||void 0,"data-direction":r,className:["plainframe-ui-card-group",a||""].join(" ").trim(),css:[f,i],children:g})};Zi.displayName="CardGroup";var Le=e=>typeof e=="number"?`${e}px`:e,el=e=>{let t=false;return me.Children.forEach(e,n=>{t||(typeof n=="string"||typeof n=="number"?String(n).trim()!==""&&(t=true):Array.isArray(n)&&el(n)&&(t=true));}),t},Bp=(e,t)=>t==="sm"?{fontSize:e.typography.sizes.xs,paddingX:`calc(${e.spacing.sm} * 0.7)`,paddingY:e.spacing.xs,gap:e.spacing.xxs,iconSize:e.typography.sizes.xs,radius:`calc(${e.radius.sm} * 0.8)`,soloPadding:e.spacing.xs,iconOffset:"0px",iconOffsetRounded:"-2px"}:t==="lg"?{fontSize:e.typography.sizes.md,paddingX:e.spacing.sm,paddingY:`calc(${e.spacing.sm} * 0.6)`,gap:e.spacing.xs,iconSize:e.typography.sizes.md,radius:e.radius.md,soloPadding:e.spacing.sm,iconOffset:"0px",iconOffsetRounded:"-3px"}:{fontSize:e.typography.sizes.sm,paddingX:`calc(${e.spacing.sm} * 0.9)`,paddingY:e.spacing.xs,gap:e.spacing.xxs,iconSize:e.typography.sizes.sm,radius:e.radius.sm,soloPadding:e.spacing.xs,iconOffset:"-1px",iconOffsetRounded:"-3px"},tl=me.memo(forwardRef(function({children:t,labelCss:n,variant:o="soft",color:r="primary",rounded:s=false,startIcon:a,endIcon:c,size:i="md",onClick:l,onDelete:u,deleteIcon:d,disabled:y,cursor:f,className:T,css:I},x){let R=V(),g=xe(),p=["sm","md","lg"].includes(i)?i:"md",m=useMemo(()=>Bp(R,p),[R,p]),C=!!l&&!y,P=y?"not-allowed":f||(C?"pointer":"inherit"),w=String(R.componentHeights?.border??"1px"),v=useMemo(()=>{let X=R.palette;return r==="secondary"||r==="neutral"?"neutral":r&&X[r]?r:"primary"},[r,R.palette]),N=useCallback(X=>{let ae=R.palette;return (v==="neutral"?R.neutral[X]:ae[v]?.[X])??ae.primary?.[X]},[v,R.neutral,R.palette]),B=useMemo(()=>v==="neutral"?R.neutral[100]:N(50),[v,N,R.neutral]),K=useMemo(()=>v==="neutral"?R.text.secondary:N(800),[v,N,R.text.secondary]),O=useMemo(()=>v==="neutral"?R.neutral[100]:N(50),[v,N,R.neutral]),S=useMemo(()=>v==="neutral"?R.text.secondary:N(800),[v,N,R.text.secondary]),F=useMemo(()=>v==="neutral"?R.neutral[400]:N(300),[v,N,R.neutral]),M=useMemo(()=>v==="neutral"?R.surface.subtleBg:N(600),[v,N,R.surface.subtleBg]),b=useMemo(()=>(R.text.onColors??{})[v]??(v==="neutral"?R.neutral[900]:R.neutral[0]??"#fff"),[v,R.text.onColors,R.neutral]),h="transparent",A=useMemo(()=>v==="neutral"?R.text.secondary:N(700)??R.text.primary,[v,N,R.text.primary,R.text.secondary]),D=useMemo(()=>!a&&!c&&t!=null&&!el(t)&&me.Children.count(t)===1,[a,c,t]),L=useMemo(()=>o==="filled"?css({backgroundColor:M,color:b,border:"none",boxShadow:"none"}):o==="outlined"?css({backgroundColor:O,color:S,border:"none",boxShadow:`inset 0 0 0 ${w} ${F}`}):o==="ghost"?css({backgroundColor:h,color:A,border:"none",boxShadow:"none"}):css({backgroundColor:B,color:K,border:"none",boxShadow:"none"}),[M,b,A,O,S,F,B,K,w,o]),k=useMemo(()=>css({display:"inline-flex",alignItems:"center",gap:Le(m.gap),padding:o==="ghost"?0:D||t==null?Le(m.soloPadding):`${Le(m.paddingY)} ${Le(m.paddingX)}`,borderRadius:s?R.radius.full:m.radius,fontWeight:600,cursor:P,opacity:y?.55:1,transition:"outline .16s ease, outline-offset .16s ease",overflow:o==="ghost"?"visible":"hidden",...D?{lineHeight:1,minWidth:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,minHeight:`calc(${Le(m.iconSize)} + ${Le(m.soloPadding)} * 2)`,justifyContent:"center"}:null}),[m,P,t,y,D,s,R.radius.full,o]),E=useMemo(()=>css({fontSize:Le(D?m.iconSize:m.fontSize),lineHeight:1.2,minWidth:0,display:"inline-flex",alignItems:"center",justifyContent:"center","& > svg":{width:D?Le(m.iconSize):void 0,height:D?Le(m.iconSize):void 0,display:D?"block":void 0}}),[m.fontSize,m.iconSize,D]),W=useMemo(()=>css({display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:Le(m.iconSize),lineHeight:0,"& > svg":{width:Le(m.iconSize),height:Le(m.iconSize),display:"block"}}),[m.iconSize]),$=useMemo(()=>css({marginRight:D||t==null?0:Le(m.gap),marginLeft:D||t==null?0:Le(m.iconOffset)}),[m.gap,m.iconOffset,t,D]),z=useMemo(()=>css({marginLeft:D||t==null?0:Le(m.gap),marginRight:D||t==null?0:Le(s?m.iconOffsetRounded:m.iconOffset)}),[m.gap,m.iconOffset,m.iconOffsetRounded,t,D,s]),_=useMemo(()=>css({marginRight:s?0:Le(m.iconOffset),padding:0,border:"none",outline:"none",background:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:y?"not-allowed":"pointer",color:"currentColor",opacity:y?.4:.85,transition:"background-color .16s ease, color .16s ease, opacity .16s ease, outline .16s ease, outline-offset .16s ease",fontSize:Le(m.iconSize),borderRadius:R.radius.xs}),[m.iconOffset,m.iconSize,y,s,R.radius.xs]),H=useCallback(X=>{C&&(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),l?.());},[C,l]),U=useMemo(()=>jsx(X,{css:{width:m.iconSize,height:m.iconSize},strokeWidth:2.5}),[m.iconSize]);return jsxs("div",{ref:x,className:["plainframe-ui-chip",C?"plainframe-ui-chip-clickable":"",T||""].join(" ").trim(),css:[k,L,C?g({color:r??"primary"}):null,I],onClick:C?l:void 0,onKeyDown:H,role:C?"button":void 0,tabIndex:C?0:void 0,"aria-disabled":y||void 0,"data-variant":o,"data-color":v,"data-size":i,"data-icon-only":D||void 0,children:[a&&jsx("span",{css:[W,$],className:"plainframe-ui-chip-icon-left",children:a}),t!=null&&jsx("span",{css:[E,n],className:"plainframe-ui-chip-label",children:t}),c&&jsx("span",{css:[W,z],className:"plainframe-ui-chip-icon-right",children:c}),u&&jsx("button",{type:"button","aria-label":"Delete",disabled:y,tabIndex:0,onClick:X=>{X.stopPropagation(),y||u?.();},css:[_,g({color:r??"primary"})],className:"plainframe-ui-chip-delete",children:d||U})]})}));tl.displayName="Chip";var Wp=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Kp=me.memo(function({value:t,onChange:n,len:o,theme:r,sizeKey:s,s:a,variant:c,error:i,disabled:l,ringEnabled:u,focusRingMode:d,placeholder:y,separator:f,gapPx:T}){let I=xe(),x=r.neutral,R=r.text,g=r.componentHeights.border,p=useRef([]),[m,C]=useState(0),P=useMemo(()=>(t??"").padEnd(o,"").slice(0,o).split(""),[t,o]),w=useMemo(()=>{if(!y)return Array(o).fill("");if(y.length===1)return Array(o).fill(y);let D=y.slice(0,o).split("");for(;D.length<o;)D.push("");return D},[y,o]),v=useMemo(()=>{let D=r.componentHeights[s];return `calc(${typeof D=="number"?`${D}px`:D} * 1.5)`},[r.componentHeights,s]),N=l?x[200]:i&&c==="outlined"?r.palette.danger?.[50]??r.surface.panelBg:i&&c==="subtle"?r.palette.danger?.[50]??r.surface.subtleBg:c==="subtle"?r.surface.subtleBg:c==="outlined"?r.surface.panelBg:"transparent",B=c==="outlined"?`${g} solid ${i?r.palette.danger?.[300]??r.surface.border:r.surface.border}`:"none",K=D=>css({width:v,height:v,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",background:N,border:B,borderRadius:r.radius.lg,transition:"box-shadow .16s, border-color .16s, background .16s",fontSize:a.codeFontSize,fontWeight:600,color:l?x[500]:i?r.palette.danger?.[800]??R.primary:R.primary,textAlign:"center",backgroundClip:"padding-box",appearance:"textfield",outline:"none",caretColor:i?r.palette.danger?.[800]??R.primary:R.primary,"&::placeholder":{color:i?r.palette.danger?.[700]??R.secondary:R.secondary,opacity:.85}},u?I({enabled:true,disabled:l,mode:d==="always"?"always":"visible",color:i?"danger":void 0}):void 0,D?css({}):null),O=css({display:"flex",gap:T,justifyContent:"center",width:"auto",pointerEvents:l?"none":"auto",opacity:l?.65:1}),S=css({display:"inline-flex",alignItems:"center",justifyContent:"center",color:R.secondary,userSelect:"none"}),F=D=>D.replace(/[^a-zA-Z0-9]/g,"").toUpperCase(),M=useCallback(D=>{let L=Math.max(0,Math.min(o-1,D));C(L),p.current[L]?.focus();},[o]),b=useCallback((D,L)=>{let k=F(L).slice(0,1),E=[...P];E[D]=k,n(E.join("")),k&&D<o-1&&M(D+1);},[P,o,n,M]),h=useCallback((D,L)=>{if(L.key==="Backspace")if(!P[D]&&D>0){let k=[...P];k[D-1]="",n(k.join("")),M(D-1),L.preventDefault();return}else {let k=[...P];k[D]="",n(k.join(""));return}if(L.key==="ArrowLeft"&&D>0){L.preventDefault(),M(D-1);return}if(L.key==="ArrowRight"&&D<o-1){L.preventDefault(),M(D+1);return}if(L.key==="Home"){L.preventDefault(),M(0);return}if(L.key==="End"){L.preventDefault(),M(o-1);return}},[P,o,n,M]),A=useCallback(D=>{let L=F(D.clipboardData.getData("text")).slice(0,o);L&&(n(L),requestAnimationFrame(()=>{let k=Math.min(L.length,o-1);M(k);}),D.preventDefault());},[o,n,M]);return jsx("div",{className:"plainframe-ui-code-boxes",css:O,children:Array.from({length:o}).map((D,L)=>jsxs(me.Fragment,{children:[jsx("input",{ref:k=>{p.current[L]=k;},type:"text",inputMode:"text",maxLength:1,value:P[L]||"",placeholder:P[L]?"":w[L]||"",disabled:l,onChange:k=>b(L,k.target.value),onKeyDown:k=>h(L,k),onFocus:()=>C(L),onPaste:L===0?A:void 0,className:"plainframe-ui-code-box",css:K(L===m),"aria-label":`Code character ${L+1}`,tabIndex:L===m?0:-1}),f&&L<o-1?jsx("span",{"aria-hidden":true,role:"presentation",css:S,children:f}):null]},L))})}),_p=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,separator:s,error:a,helperText:c,disabled:i=false,gap:l,size:u="md",variant:d="subtle",length:y=4,focusRingMode:f="always",className:T,wrapperCss:I,labelCss:x,helperRowCss:R,helperTextCss:g,css:p})=>{let m=V(),C=useId(),P=useMemo(()=>({sm:{labelFont:m.typography.sizes.xs,helperFont:m.typography.sizes.xs,minHeight:m.componentHeights.sm,paddingY:0,paddingX:m.spacing.md,codeFontSize:21},md:{labelFont:m.typography.sizes.sm,helperFont:m.typography.sizes.xs,minHeight:m.componentHeights.md,paddingY:0,paddingX:m.spacing.md,codeFontSize:24},lg:{labelFont:m.typography.sizes.md,helperFont:m.typography.sizes.sm,minHeight:m.componentHeights.lg,paddingY:0,paddingX:m.spacing.md,codeFontSize:28}}),[m]),w=["sm","md","lg"].includes(u)?u:"md",v=P[w],N=m.neutral,B=m.text,K=t!=null,[O,S]=useState(n),F=K?t:O,M=$=>{K||S($),o?.($);},b=Math.max(2,Math.min(y,10)),h=m.spacing.sm,A=Wp(l??h)??"0px",D=css({boxSizing:"border-box",display:"inline-flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"auto",maxWidth:"unset",fontWeight:500,cursor:i?"not-allowed":"auto"},...Array.isArray(I)?I:I?[I]:[]),L=css({fontSize:v.labelFont,fontWeight:500,color:a?m.palette.danger?.[700]??B.primary:i?N[500]:B.primary,marginBottom:4,display:"block",cursor:i?"not-allowed":"auto"},...Array.isArray(x)?x:x?[x]:[]),k=css({display:"flex",alignItems:"center",justifyContent:"center",gap:A,width:"auto",background:"transparent",outline:"none",boxShadow:"none"},...Array.isArray(p)?p:p?[p]:[]),E=css({minHeight:16,fontSize:v.helperFont,color:a?m.palette.danger?.[700]??B.secondary:B.secondary,paddingTop:3,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8,width:"100%"},...Array.isArray(R)?R:R?[R]:[]),W=css({flex:1,wordBreak:"break-word",whiteSpace:"pre-wrap",minWidth:0,fontWeight:400,color:a?m.palette.danger?.[700]??B.primary:i?N[500]:B.primary},...Array.isArray(g)?g:g?[g]:[]);return jsxs("div",{className:["plainframe-ui-codefield",T||""].join(" ").trim(),css:D,children:[e&&jsx("span",{id:C,className:"plainframe-ui-codefield-label",css:L,children:e}),jsx("div",{className:"plainframe-ui-codefield-row",css:k,role:"group","aria-labelledby":e?C:void 0,tabIndex:-1,children:jsx(Kp,{value:F||"",onChange:M,len:b,theme:m,sizeKey:w,s:{codeFontSize:v.codeFontSize},variant:d,error:!!a,disabled:i,ringEnabled:f!=="none",focusRingMode:f,placeholder:r,separator:s,gapPx:A})}),c!=null&&jsx("div",{className:"plainframe-ui-codefield-helper",css:E,children:jsx("span",{className:"plainframe-ui-codefield-helper-text",css:W,children:c})})]})};var al=e=>{if(typeof e=="object"&&e!==null&&"type"in e&&e.type){let t=e.type;return (typeof t=="object"&&t!==null||typeof t=="function")&&(t?.displayName||t?.name)||""}return ""},Bs=e=>{if(!e||typeof e!="object")return false;let t=al(e);if(t==="DropdownMenu"||t==="DropdownMenuContent")return true;let n=e?.props,o=n&&typeof n=="object"&&n!==null&&"children"in n?n.children:void 0;return o==null?false:Array.isArray(o)?o.some(Bs):Bs(o)},Vp=({children:e,content:t,trigger:n="contextmenu",onOpenChange:o,hoverPosition:r="cursor",hoverOffset:s=10})=>{let a=me.useRef(null),[c,i]=me.useState(false),l=me.useCallback(E=>{i(E),o?.(E);},[o]),u=me.useCallback(()=>l(false),[l]),d=me.useRef({x:0,y:0}),y=me.useRef(null),f=me.useRef(null),T=me.useCallback(()=>{f.current=null;let E=y.current;if(!E)return;let W=Math.round(d.current.x),$=Math.round(d.current.y);E.style.transform=`translate3d(${W}px, ${$}px, 0)`;},[]),I=me.useCallback(()=>{f.current==null&&(f.current=requestAnimationFrame(T));},[T]);me.useEffect(()=>()=>{f.current&&cancelAnimationFrame(f.current);},[]);let x=me.useMemo(()=>({getBoundingClientRect:()=>{let E=Math.round(d.current.x),W=Math.round(d.current.y);return {x:E,y:W,left:E,top:W,right:E,bottom:W,width:0,height:0,toJSON:()=>({x:E,y:W})}}}),[]),R=me.useRef(`cz-${Math.random().toString(36).slice(2)}`),g=me.useCallback(()=>typeof document<"u"?document.querySelector(`[data-cz-id="${R.current}"]`):null,[]),p=me.useRef(null),m=me.useRef(null),C=me.useCallback(()=>{p.current!=null&&clearTimeout(p.current),p.current=null;},[]),P=me.useCallback(()=>{m.current!=null&&clearTimeout(m.current),m.current=null;},[]),w=me.useCallback(()=>{P(),m.current=window.setTimeout(()=>l(false),0);},[P,l]),v=me.useCallback(()=>{let E=a.current?.getBoundingClientRect();return E?{x:E.left+E.width/2,y:E.top+E.height/2}:{x:0,y:0}},[]),N=me.useCallback((E,W)=>{d.current={x:E,y:W},I(),l(true);},[I,l]),B=typeof t=="function"?t({close:u}):t,K=Bs(B),O=E=>{if(!me.isValidElement(E))return E;let W=al(E),$=E,z=$.props.children,_=z==null?z:Array.isArray(z)?z.map(H=>me.isValidElement(H)?O(H):H):me.isValidElement(z)?O(z):z;if(W==="DropdownMenu"){let H=$.props.onOpenChange;return me.cloneElement($,{...$.props,open:c,onOpenChange:U=>{H?.(U),l(U);},children:_})}if(W==="DropdownMenuContent"){let H=$.props.onMouseEnter,U=$.props.onMouseLeave;return me.cloneElement($,{...$.props,anchor:x,"data-cz-id":R.current,onMouseEnter:X=>{P(),H?.(X);},onMouseLeave:X=>{w(),U?.(X);},children:_})}return _===z?$:me.cloneElement($,{...$.props,children:_})},S=K?O(B):B,F=me.useCallback(E=>{E.preventDefault(),N(E.clientX,E.clientY);},[N]),M=me.useCallback(E=>{n==="contextmenu"&&F(E);},[n,F]),b=me.useCallback(E=>{n==="dblclick"&&F(E);},[n,F]),h=me.useCallback(E=>{n==="click"&&F(E);},[n,F]),A=me.useCallback(E=>{if(n!=="hover")return;C(),P();let W=r==="center"?v():{x:E.clientX,y:E.clientY};p.current=window.setTimeout(()=>{let $=W.x+(r==="cursor"?s:0),z=W.y+(r==="cursor"?s:0);N($,z);},0);},[n,r,s,v,N,C,P]),D=me.useCallback(E=>{n==="hover"&&c&&r==="cursor"&&!K&&(d.current={x:E.clientX+s,y:E.clientY+s},I());},[n,c,r,K,s,I]),L=me.useCallback(()=>{n==="hover"&&(C(),w());},[n,C,w]);me.useEffect(()=>{if(n!=="hover")return;let E=()=>{if(!c)return;let W=a.current?.matches(":hover"),$=g()?.matches?.(":hover");W||$?P():w();};return window.addEventListener("pointermove",E,{passive:true,capture:true}),()=>window.removeEventListener("pointermove",E,{capture:true})},[c,n,g,P,w]),me.useEffect(()=>{let E=()=>{if(c)if(n==="hover"){let W=a.current?.matches(":hover"),$=g()?.matches?.(":hover");if(W||$?P():w(),r==="center"&&a.current){let z=v();d.current={x:z.x,y:z.y},I();}}else l(false);};return window.addEventListener("scroll",E,true),window.addEventListener("resize",E,true),()=>{window.removeEventListener("scroll",E,true),window.removeEventListener("resize",E,true);}},[c,n,r,v,I,l,P,w,g]),me.useEffect(()=>()=>{C(),P();},[C,P]);let k=({children:E})=>c?jsx("div",{ref:y,style:{position:"fixed",left:0,top:0,transform:`translate3d(${Math.round(d.current.x)}px, ${Math.round(d.current.y)}px, 0)`,willChange:"transform",zIndex:1e3,pointerEvents:"auto"},onMouseEnter:()=>n==="hover"&&P(),onMouseLeave:()=>n==="hover"&&w(),children:E}):null;return jsxs("div",{ref:a,onContextMenu:M,onDoubleClick:b,onClick:h,onMouseEnter:A,onMouseMove:D,onMouseLeave:L,css:css({position:"relative"}),className:"plainframe-ui-context-zone-wrapper",children:[e,K?S:jsx(k,{children:S})]})};var Vn=(e,t="0px")=>e==null?t:typeof e=="number"?`${e}px`:e,Xp=me.memo(forwardRef(function({label:t,variant:n="full",direction:o="horizontal",labelPosition:r="center",thickness:s=1,width:a,middleMargin:c="5px",insetMargin:i="10px",chip:l=false,chipVariant:u="subtle",rounded:d=false,margin:y=10,css:f,labelCss:T,strokeCss:I,className:x,...R},g){let p=V(),{t:m,strokeColor:C,labelTextColor:P,chipSubtleBg:w,chipOutlinedBg:v,outerM:N,padX:B,verticalStrokeMargin:K}=useMemo(()=>{let b=typeof s=="number"?`${s}px`:s,h=p.surface.border,A=p.text.secondary,D=p.surface.subtleBg,L=p.surface.panelBg,k=Vn(y,"10px"),E=o==="horizontal"?n==="middle"?Vn(c):n==="inset"?Vn(i,"0px"):"0":"0",W=o==="vertical"?n==="middle"?Vn(c):n==="inset"?Vn(i,"0px"):"0":"0";return {t:b,strokeColor:h,labelTextColor:A,chipSubtleBg:D,chipOutlinedBg:L,outerM:k,padX:E,verticalStrokeMargin:W}},[s,p,o,n,c,i,y]),O=useMemo(()=>css([{display:"flex",alignItems:"center"},o==="vertical"?{flexDirection:"column",alignSelf:"stretch",width:t?"max-content":m,minWidth:t?"max-content":m,marginLeft:N,marginRight:N}:{flexDirection:"row",width:a?Vn(a):"100%",minWidth:0,paddingLeft:B,paddingRight:n==="middle"?B:"0",marginTop:N,marginBottom:N},...Array.isArray(f)?f:f?[f]:[]]),[o,t,m,N,a,B,n,f]),S=useMemo(()=>css([{background:C,borderRadius:d?p.radius.full:p.radius.xs},o==="vertical"?{width:m,minHeight:18,flex:1,marginTop:K,marginBottom:K}:{height:m,flex:1}]),[C,d,p.radius.full,p.radius.xs,o,m,K]),F=useMemo(()=>css([{margin:l?o==="vertical"?"4px 0":0:o==="vertical"?"2px 0":0,padding:l?"3px 7px":0,borderRadius:l?d?p.radius.full:`calc(${p.radius.sm} * 0.75)`:`calc(${p.radius.sm} * 0.75)`,color:P,fontWeight:500,fontSize:13,textAlign:"center",alignSelf:"center",whiteSpace:o==="vertical"?"normal":"pre",wordBreak:o==="vertical"?"break-all":void 0,...l?u==="subtle"?{background:w,border:"none"}:{background:v,border:`${m} solid ${C}`}:{}},...Array.isArray(T)?T:T?[T]:[]]),[l,o,d,p.radius.full,p.radius.sm,P,u,w,v,m,C,T]),M=useMemo(()=>jsx("div",{className:"plainframe-ui-divider-stroke",css:[S,I]}),[S,I]);return o==="vertical"?jsxs("div",{ref:g,"data-direction":"vertical","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper","is-vertical",x||""].join(" ").trim(),css:O,...R,children:[t&&r!=="top"&&M,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="bottom"&&M,!t&&M]}):jsxs("div",{ref:g,"data-direction":"horizontal","data-variant":n,"data-chip":l?"true":void 0,className:["plainframe-ui-divider-wrapper",x||""].join(" ").trim(),css:O,...R,children:[t&&r!=="left"&&M,t&&jsx("span",{className:"plainframe-ui-divider-label",css:F,children:t}),t&&r!=="right"&&M,!t&&M]})}));var ml=me.createContext(null),fl=()=>{let e=useContext(ml);if(!e)throw new Error("Drawer components must be used within <Drawer>.");return e},gl=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[a,c]=useState(!!n),i=t??a,l=useCallback(d=>{t===void 0&&c(d),o?.(d);},[t,o]),u=useMemo(()=>({open:i,setOpen:l,lockScroll:r,closeOnEscape:s}),[i,l,r,s]);return jsx(ml.Provider,{value:u,children:e})},Zp=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:a}=fl(),c=!!e&&me.isValidElement(t),i=useCallback(u=>{if(c){let d;me.isValidElement(t)&&(d=t.props.onClick),d?.(u);}r.onClick?.(u),u.defaultPrevented||a(true);},[c,t,r.onClick,a]),l=useCallback(u=>{if((u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(true)),c){let d;me.isValidElement(t)&&(d=t.props.onKeyDown),d?.(u);}r.onKeyDown?.(u);},[c,t,r.onKeyDown,a]);if(c){let u=t,d=u.props.css;return me.cloneElement(u,{...u.props||{},className:[u.props.className,n].filter(Boolean).join(" ")||void 0,css:[d,o].filter(Boolean),onClick:i,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,onClick:i,onKeyDown:l,...r,children:t})});Zp.displayName="DrawerTrigger";var To=0,bl="",hl="",Qp=()=>typeof window>"u"?0:window.innerWidth-document.documentElement.clientWidth;function em(){if(!(typeof document>"u")){if(To===0){let e=document.body;bl=e.style.overflow||"",hl=e.style.paddingRight||"";let t=Qp();e.style.overflow="hidden",t>0&&(e.style.paddingRight=`${t}px`);}To+=1;}}function tm(){if(!(typeof document>"u")&&(To>0&&(To-=1),To===0)){let e=document.body;e.style.overflow=bl,e.style.paddingRight=hl;}}var nm=(e,t=0)=>e==null?t:typeof e=="number"?e:parseFloat(String(e))||t,yl=forwardRef(function({children:t,width:n,height:o,position:r="left",variant:s="inset",margin:a=10,radius:c,backdropBlur:i=true,backdropBlurDepth:l,closeOnClickAway:u=true,transitionMs:d,snapClosePct:y=.33,velocityClosePxS:f=950,dragElasticOut:T=.2,className:I,css:x,...R},g){let p=V(),{open:m,setOpen:C,lockScroll:P,closeOnEscape:w}=fl();useEffect(()=>{if(!(!P||!m))return em(),()=>tm()},[m,P]);let v=useMemo(()=>nm(a,0),[a]),N=useMemo(()=>r==="left"||r==="right"?"x":"y",[r]),B=useMemo(()=>r==="left"||r==="top"?-1:1,[r]),K=useMemo(()=>n??(r==="left"||r==="right"?320:s==="inset"?`calc(100% - ${v*2}px)`:"100%"),[n,r,s,v]),O=useMemo(()=>o??(r==="top"||r==="bottom"?420:s==="inset"?`calc(100% - ${v*2}px)`:"100%"),[o,r,s,v]),S=useMemo(()=>{let q=String(p.radius.lg);switch(r){case "left":return `0 ${q} ${q} 0`;case "right":return `${q} 0 0 ${q}`;case "top":return `0 0 ${q} ${q}`;default:return `${q} ${q} 0 0`}},[r,p.radius.lg]),F=useMemo(()=>c??(s==="inset"?p.radius.lg:S),[c,s,p.radius.lg,S]),M=useMemo(()=>s==="inset"?{top:r==="bottom"?void 0:v,bottom:r==="top"?void 0:v,left:r==="right"?void 0:v,right:r==="left"?void 0:v}:{top:r==="bottom"?void 0:0,bottom:r==="top"?void 0:0,left:r==="right"?void 0:0,right:r==="left"?void 0:0},[s,r,v]),b=useRef(null),h=useCallback(()=>{let q=b.current;if(!q)return 1;let Y=q.getBoundingClientRect();return N==="x"?Y.width:Y.height},[N]),A=useMemo(()=>({type:"spring",stiffness:520,damping:40,mass:.7}),[]),D=useMemo(()=>({duration:(d??280)/1e3,ease:[.22,1,.36,1]}),[d]),L=useMemo(()=>B*1.1,[B]),k=useMemo(()=>N==="x"?{x:`${L*100}%`,y:0}:{y:`${L*100}%`,x:0},[N,L]),E=useMemo(()=>css({position:"fixed",zIndex:1100,...M,width:K,height:O,backgroundColor:p.surface.panelBg,borderRadius:F,overflowY:"auto",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",willChange:"transform, box-shadow, opacity",backfaceVisibility:"hidden",pointerEvents:m?"auto":"none",touchAction:N==="x"?"pan-y":"pan-x","@media (prefers-reduced-motion: reduce)":{transition:"none"}}),[M,K,O,p.surface,F,m,N]),W=useMemo(()=>css({position:"fixed",inset:0,zIndex:1099,background:p.surface.overlayBg,transition:"all .3s ease",...i?{backdropFilter:`blur(${l??"2px"})`}:null}),[i,l,p.surface]),$=useCallback(()=>{u&&C(false);},[u,C]),z=useMemo(()=>N==="x"?{left:B===-1?T:0,right:B===1?T:0}:{top:B===-1?T:0,bottom:B===1?T:0},[N,B,T]),_=useMemo(()=>N==="x"?{left:0,right:0}:{top:0,bottom:0},[N]),H=useMemo(()=>Math.max(0,Math.min(1,y)),[y]),U=useCallback((q,Y)=>{let le=N==="x"?Y.offset.x:Y.offset.y,ie=N==="x"?Y.velocity.x:Y.velocity.y,be=B*le>0,Pe=Math.abs(le)>=h()*H,Re=B*ie>f;be&&(Pe||Re)&&C(false);},[N,B,h,H,f,C]),X=useRef(null);useEffect(()=>{if(!m)return;X.current=document.activeElement;let q=setTimeout(()=>{let ie=b.current;if(!ie)return;let be=ie.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');be.length>0?be[0].focus():ie.focus();},100),Y=ie=>{let be=b.current;if(!be||!ie.target)return;let Pe=ie.target;if(!be.contains(Pe)){ie.preventDefault();let Re=be.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');Re.length>0?Re[0].focus():be.focus();}},le=ie=>{ie.key==="Escape"&&w&&(ie.stopPropagation(),C(false));};return document.addEventListener("focusin",Y,true),window.addEventListener("keydown",le),()=>{clearTimeout(q),document.removeEventListener("focusin",Y,true),window.removeEventListener("keydown",le),X.current&&typeof X.current.focus=="function"&&X.current.focus();}},[m,C,w]);let{...ae}=R;return jsx(AnimatePresence,{children:m?jsxs(Fragment,{children:[jsx(motion.div,{role:"presentation","aria-hidden":true,css:W,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:d?D:{duration:.18,ease:"linear"},onClick:$},"overlay"),jsx(motion.div,{ref:q=>{b.current=q,typeof g=="function"?g(q):g&&(g.current=q);},role:"dialog","aria-modal":"true",tabIndex:-1,"data-position":r,"data-variant":s,className:["plainframe-ui-drawer",I||""].join(" ").trim(),css:[E,x],drag:N,dragConstraints:_,dragElastic:z,dragMomentum:false,dragDirectionLock:true,onDragEnd:U,initial:{...k,opacity:.98},animate:{x:0,y:0,opacity:1},exit:{...k,opacity:.98},transition:d?D:A,...ae,children:t},"panel")]}):null})});yl.displayName="DrawerContent";var om=forwardRef(function({open:t,on:n,defaultOpen:o,defaultOn:r,onOpenChange:s,onClose:a,children:c,...i},l){let u=t!==void 0?t:n,d=o!==void 0?o:r,y=u!==void 0,[f,T]=useState(!!d),I=y?!!u:f,x=useCallback(R=>{y||T(R),R||a?.(),s?.(R);},[y,a,s]);return jsx(gl,{open:I,onOpenChange:x,children:jsx(yl,{ref:l,...i,children:c})})});om.displayName="DrawerLegacy";var Ws=({children:e,duration:t=300,delay:n=0,on:o=false,onAnimationEnd:r,asChild:s=false,className:a,blur:c=false})=>{let i={opacity:o?1:0,filter:c?o?"none":"blur(10px)":"none",transition:`opacity ${t}ms ease ${n}ms, filter ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"opacity, filter",backfaceVisibility:"hidden"},l=d=>y=>{y.target===y.currentTarget&&(y.propertyName==="opacity"||y.propertyName==="filter")&&r?.(),d?.(y);};if(s&&isValidElement(e)){let d=e,y=d.props.css,f=Array.isArray(y)?[...y,i]:y?[y,i]:[i],T=["plainframe-ui-transition-fade",d.props.className||"",a||""].join(" ").trim(),I=d.props.onTransitionEnd;return cloneElement(d,{...d.props,css:f,className:T,onTransitionEnd:l(I)})}let u=css(i);return jsx("div",{className:["plainframe-ui-transition-fade",a||""].join(" ").trim(),css:u,onTransitionEnd:l(),children:e})};var xl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,vl=me.memo(({direction:e="row",gap:t="sm",justify:n,align:o="center",className:r,css:s,children:a,width:c,height:i,...l})=>{let u=V(),d=e==="vertical"||e==="column"?"column":"row",y=t===void 0?void 0:typeof t=="number"?t:u.spacing[t]??t,f=css({display:"flex",flexDirection:d,gap:y,justifyContent:n,alignItems:o,maxWidth:xl(c),width:c?"100%":void 0,maxHeight:xl(i),height:i?"100%":void 0,boxSizing:"border-box"});return jsx("div",{className:["plainframe-ui-flex",r||""].join(" ").trim(),css:[f,s],...l,children:a})});vl.displayName="Flex";var Ks=({children:e,duration:t=300,delay:n=0,on:o=false,initialScale:r=0,finalScale:s=1,onAnimationEnd:a,asChild:c=false,className:i})=>{let l={transform:o?`scale(${s})`:`scale(${r})`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},u=y=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&a?.(),y?.(f);};if(c&&isValidElement(e)){let y=e,f=y.props.css,T=Array.isArray(f)?[...f,l]:f?[f,l]:[l],I=y.props.onTransitionEnd,x=["plainframe-ui-transition-grow",y.props.className||"",i||""].join(" ").trim();return cloneElement(y,{...y.props,css:T,className:x,onTransitionEnd:u(I)})}let d=css(l);return jsx("div",{className:["plainframe-ui-transition-grow",i||""].join(" ").trim(),css:d,onTransitionEnd:u(),children:e})};var Cl={h1:{size:"2.25rem",weight:800,lh:1.1,ls:"-0.02em"},h2:{size:"1.875rem",weight:700,lh:1.15,ls:"-0.01em"},h3:{size:"1.5rem",weight:600,lh:1.2,ls:"-0.005em"},h4:{size:"1.25rem",weight:500,lh:1.2,ls:"0"},h5:{size:"1.125rem",weight:500,lh:1.3,ls:"0"},h6:{size:"1rem",weight:500,lh:1.3,ls:"0"},body:{size:"sm",weight:400,lh:1.4,ls:"0"},caption:{size:"xs",weight:400,lh:1.4,ls:"0.01em"}},ym=e=>e==null?void 0:typeof e=="number"?`${e}px`:String(e),xm={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",body:"span",caption:"span"},Un=me.memo(({variant:e="body",children:t,color:n,size:o,weight:r,lineHeight:s,letterSpacing:a,align:c="left",textTransform:i="none",whiteSpace:l="normal",decoration:u="none",decorationStyle:d="solid",decorationThickness:y=1,decorationColor:f,italic:T,className:I,style:x,as:R})=>{let g=V(),p=Cl[e]??Cl.body,m=R??xm[e]??"span",C=F=>F==null?p.size:typeof F=="number"?F:g?.typography?.sizes?.[F]??F,P=C(o)??C(p.size),w=r??p.weight,v=s??p.lh,N=a??p.ls,B=n==="secondary"?g.text.secondary:n==="primary"?g.text.primary:n??"inherit",K=f??g.surface.border,O=css({boxSizing:"border-box",display:c==="left"?"inline":"block",textAlign:c==="left"?void 0:c,fontFamily:g?.typography?.fonts?.sans||"inherit",fontSize:P,fontWeight:w,lineHeight:v,letterSpacing:N,color:B,textTransform:i,whiteSpace:l,fontStyle:T?"italic":"normal",margin:0,padding:0}),S=u==="none"?css({textDecoration:"none"}):css({textDecorationLine:u,textDecorationStyle:d,textDecorationColor:K,textDecorationThickness:ym(y),textDecorationSkipInk:"auto"});return jsx(m,{className:[`pfui-typo-${e}`,I||""].join(" ").trim(),css:[O,S],style:x,"data-variant":e,children:t})});Un.displayName="Typography";var Us=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Rm=(e,t)=>{if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){if(["xs","sm","md","lg","xl","full"].includes(e)){let n=t.radius&&t.radius[e]||t.radii&&t.radii[e];return Us(typeof n=="number"||typeof n=="string"?n:e)}return e}}},Tl=forwardRef(function({src:t,alt:n="",width:o,height:r,radius:s="md",shadow:a=false,hoverEffect:c="none",label:i,labelAlign:l="center",aspectRatio:u,loading:d="lazy",decoding:y="async",fetchPriority:f,srcSet:T,sizes:I,placeholder:x,blurDataURL:R,placeholderColor:g="#f1f1f1",fallbackSrc:p,className:m,css:C,onClick:P,onLoad:w,onError:v,...N},B){let[K,O]=useState(false),[S,F]=useState(false),[M,b]=useState(false),h=V(),A=Rm(s,h)??"0px",D=i?"figure":"div",L=css({display:"flex",flexDirection:"column",gap:i?h.spacing.xs:0,width:"fit-content",borderRadius:`var(--pfui-image-radius, ${A})`}),k=css({position:"relative",borderRadius:`var(--pfui-image-radius, ${A})`,maxWidth:o?Us(o):"100%",maxHeight:r?Us(r):void 0,width:o?"100%":void 0,height:r?"100%":void 0,aspectRatio:u,boxShadow:a?"0 12px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.04)":"none",overflow:"hidden",padding:0,lineHeight:0,transition:"transform 0.3s ease",willChange:"transform",transform:K&&(c==="rotate"||c==="scale-rotate")?"rotate(3deg)":"none",cursor:P?"pointer":void 0}),E=css({position:"absolute",inset:0,background:x==="color"?g:void 0,backgroundImage:x==="blur"&&R?`url(${R})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:x==="blur"?"blur(8px)":void 0,transition:"opacity 0.3s ease",opacity:M?0:1,pointerEvents:"none"}),W=css({width:"100%",height:"100%",display:"block",objectFit:"cover",transform:K&&(c==="scale"||c==="scale-rotate")?"scale(1.08)":"none",transition:"transform 0.3s ease",willChange:"transform"});return jsxs(D,{className:["plainframe-ui-image",m||""].join(" ").trim(),css:[L,C],tabIndex:-1,children:[jsxs("div",{className:"plainframe-ui-image-frame",css:k,onMouseEnter:()=>O(true),onMouseLeave:()=>O(false),onClick:P,children:[!M&&x&&jsx("div",{"aria-hidden":true,className:"plainframe-ui-image-placeholder",css:E}),jsx("img",{ref:B,className:"plainframe-ui-image-img",css:W,src:S&&p?p:t,alt:n,srcSet:T,sizes:I,loading:d,decoding:y,fetchPriority:f,onLoad:$=>{b(true),w?.($);},onError:$=>{F(true),v?.($);},...N})]}),i&&jsx(Un,{as:"figcaption",variant:"caption",align:l,children:i})]})});Tl.displayName="Image";var wl=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,km=e=>{if(typeof e=="number"&&isFinite(e)&&e>0)return e;if(typeof e=="string"){let t=e.trim().match(/^(\d+(?:\.\d+)?)\s*\/\s*(\d+(?:\.\d+)?)$/);if(t){let o=parseFloat(t[1]),r=parseFloat(t[2]);if(o>0&&r>0)return o/r}let n=parseFloat(e);if(isFinite(n)&&n>0)return n}},Im=e=>e*Math.PI/180,Sm=(e,t,n)=>{let o=Math.abs(Im(n)),r=Math.cos(o),s=Math.sin(o);return {w:Math.abs(e*r)+Math.abs(t*s),h:Math.abs(t*r)+Math.abs(e*s)}};function Mm(e,t){if(t<=1){let r={ang:[0],dx:[0],dy:[0]};return {base:r,exp:r}}return e==="fan"?{base:t===2?{ang:[-14,10],dx:[-40,24],dy:[0,0]}:{ang:[-14,0,14],dx:[-55,0,55],dy:[-7.5,0,-7.5]},exp:t===2?{ang:[-7,5],dx:[-20,12],dy:[0,0]}:{ang:[-7,0,7],dx:[-32.5,0,32.5],dy:[0,0,0]}}:e==="slide"?{base:t===2?{ang:[-20,3],dx:[-10,5],dy:[-2,0]}:{ang:[-20,-5,10],dx:[-35,-10,12],dy:[4,0,4]},exp:t===2?{ang:[-10,1.5],dx:[-10,5],dy:[-2,0]}:{ang:[-10,-2.5,5],dx:[-30.5,-7.5,6],dy:[4,0,4]}}:e==="domino"?{base:t===2?{ang:[0,0],dx:[0,0],dy:[-11,5]}:{ang:[0,0,0],dx:[0,0,0],dy:[-18,-5,6]},exp:t===2?{ang:[0,0],dx:[0,0],dy:[-5,5]}:{ang:[0,0,0],dx:[0,0,0],dy:[-14,-2.5,7]}}:{base:t===2?{ang:[-4,8],dx:[-22,18],dy:[-30,40]}:{ang:[-10,10,.5],dx:[-30,30,-15],dy:[-65,2,65]},exp:t===2?{ang:[-3,6],dx:[-11,9],dy:[-22.5,30]}:{ang:[-7.5,7.5,.35],dx:[-15,20,-10.5],dy:[-55.5,2,55.5]}}}var Fm=(e,t,n)=>e==="fan"?t===2?[.9,1.08][n]??1:[.8,1,.8][n]??1:e==="slide"?t===2?[.8,1][n]??1:[.7,.85,1][n]??1:e==="domino"?t===2?[.9,1][n]??1:[.85,.95,1][n]??1:1,El=[1.02,1.03,1.02],kl=[1.06,1.08,1.06],Am={sm:150,md:200,lg:260,xl:340},Pm=e=>e==null?void 0:typeof e=="number"?`${e}px`:e;function Nm(e,t){if(e!=null){if(typeof e=="number")return `${e}px`;if(typeof e=="string"){if(["xs","sm","md","lg","xl","full"].includes(e)){let n=t.radius&&t.radius[e]||t.radii&&t.radii[e];return Pm(typeof n=="number"||typeof n=="string"?n:e)}return e}}}var Dm=memo(function({children:t,variant:n="fan",width:o,aspectRatio:r="4/5",size:s="md",hoverEffect:a="none",hovering:c,maxItems:i=3,shadow:l=false,cursor:u,outline:d,outlineColor:y,outlineWidth:f=3,outlineOffset:T=0,radius:I="md",label:x,labelAlign:R="center",css:g,className:p,...m}){let C=V(),P=km(r)??4/5,w=typeof o=="string"?o:void 0,v=typeof o=="number"?o:w&&/px$/.test(w)?parseFloat(w):Am[s],N=Math.max(1,v/P),K=Children.toArray(t).filter(isValidElement).slice(0,i),O=K.length,S=Mm(n,O),F=K.map((q,Y)=>Fm(n,O,Y)),M=q=>N*.6*F[q],b=q=>M(q)*P,h=0,A=0;for(let q=0;q<O;q++){let Y=b(q),le=M(q),ie=Math.max(Math.abs(S.base.ang[q]??0),Math.abs(S.exp.ang[q]??0)),be=Math.max(Math.abs(S.base.dx[q]??0),Math.abs(S.exp.dx[q]??0)),Pe=Math.max(Math.abs(S.base.dy[q]??0),Math.abs(S.exp.dy[q]??0)),Re=a==="expand"?kl[q]??1.08:a==="reveal"?El[q]??1.03:1,Ce=Sm(Y,le,ie),Ie=Ce.w*Re,Te=Ce.h*Re,we=be/100*Y*Re,he=Pe/100*le*Re;h=Math.max(h,Ie/2+we),A=Math.max(A,Te/2+he);}let D=Math.max(1,2*h),L=Math.max(1,2*A),k=Math.min(1,v/D,N/L),E=c===void 0?"pointer":"controlled",W=c?"true":void 0,$=css({display:"flex",flexDirection:"column",cursor:u||"auto",lineHeight:0,position:"relative",isolation:"isolate",gap:x?C.spacing.xs:0}),z=css({position:"relative",width:wl(typeof o=="number"?o:v)??(typeof o=="string"?o:void 0),height:wl(N)}),_=css({position:"absolute",inset:0,left:"50%",top:"50%",width:`${D}px`,height:`${L}px`,transform:`translate(-50%, -50%) scale(${k})`,transformOrigin:"center center"}),H=Nm(I,C)??"0px",U=q=>{let Y=n==="fan"?`rotate(${S.base.ang[q]}deg) translate(${S.base.dx[q]}%, ${S.base.dy[q]}%)`:n==="slide"?`translate(${S.base.dx[q]}%, ${S.base.dy[q]}%) rotate(${S.base.ang[q]}deg)`:n==="domino"?`translate(0%, ${S.base.dy[q]}%)`:`translate(${S.base.dx[q]}%, ${S.base.dy[q]}%) rotate(${S.base.ang[q]}deg)`,le=n==="fan"?`rotate(${S.exp.ang[q]}deg) translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%)`:n==="slide"?`translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%) rotate(${S.exp.ang[q]}deg)`:n==="domino"?`translate(0%, ${S.exp.dy[q]}%)`:`translate(${S.exp.dx[q]}%, ${S.exp.dy[q]}%) rotate(${S.exp.ang[q]}deg)`,ie=a==="reveal"?"translate(0,0) rotate(0) scale(1)":`${Y} scale(1)`,be=a==="expand"?`${le} scale(${kl[q]??1.06})`:a==="reveal"?`${Y} scale(${El[q]??1.03})`:`${Y} scale(1)`;return css({position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) ${ie}`,transition:"transform .22s ease",willChange:"transform",backfaceVisibility:"hidden",zIndex:n==="fan"&&q===1?10:q+1,lineHeight:0,boxShadow:l?"rgba(0,0,0,.12) 0 8px 20px":"none",outline:d?`${f}px solid ${y??C.surface.appBg}`:void 0,outlineOffset:d?T:void 0,pointerEvents:"auto",".plainframe-ui-image-stack-wrapper[data-hover-mode='pointer']:hover &":{transform:`translate(-50%, -50%) ${be}`},".plainframe-ui-image-stack-wrapper[data-hover-mode='controlled'][data-hovered='true'] &":{transform:`translate(-50%, -50%) ${be}`}})},X=q=>css({width:`${b(q)}px`,aspectRatio:`${P}`,position:"relative",overflow:"hidden",borderRadius:H,"--pfui-image-radius":H,"& > *":{position:"absolute",inset:"0",width:"100% !important",height:"100% !important",maxWidth:"none !important",maxHeight:"none !important",display:"block"},"& img, & picture img, & video, & canvas":{width:"100% !important",height:"100% !important",objectFit:"cover",display:"block"}});return jsxs(x?"figure":"div",{className:["plainframe-ui-image-stack-wrapper",p||""].join(" ").trim(),"data-hover-mode":E,"data-hovered":W,css:[$,g],tabIndex:-1,...m,children:[jsx("div",{className:"plainframe-ui-image-stack",css:z,children:jsx("div",{className:"plainframe-ui-image-stack-stage",css:_,children:K.map((q,Y)=>jsx("div",{className:"plainframe-ui-image-stack-item",css:U(Y),children:jsx("div",{className:"plainframe-ui-image-stack-frame",css:X(Y),children:q})},Y))})}),x&&jsx(Un,{as:"figcaption",variant:"caption",align:R,children:x})]})});var Il=e=>typeof e=="number"?`${e}px`:e,Sl={sm:{h:20,px:6,font:10},md:{h:24,px:7,font:12},lg:{h:28,px:8,font:14}};function Bm(e,t){if(e==null){let n=t.radius?.xs??t.radius?.sm??3;return Il(n)}if(typeof e=="number")return `${e}px`;if(typeof e=="string"){let n=t.radius?.[e]??t.radii?.[e];if(n!=null)return Il(n)}return e}function $m(e){if(typeof e!="string")return false;let t=e.trim();return !(!t||t.length>4||/[A-Za-z0-9]/.test(t))}var zm=forwardRef(function({children:t,variant:n="outlined",size:o="sm",radius:r,mono:s=true,uppercase:a=false,symbolBoost:c=2,css:i,className:l="plainframe-ui-kbd",...u},d){let y=V(),f=xe(),T=Sl[o]??Sl.sm,I=Bm(r,y),x={br:y.neutral[300],txt:y.neutral[800],inset:y.neutral[0]},R=css({all:"unset",boxSizing:"border-box",display:"inline-flex !important",alignItems:"center",justifyContent:"center",minHeight:n==="ghost"?void 0:`${T.h}px !important`,paddingInline:n==="ghost"?0:`${T.px}px !important`,paddingBlock:"0 !important",fontFamily:s?y.typography.fonts.mono:"inherit",fontSize:`${T.font}px !important`,fontWeight:600,letterSpacing:.2,textTransform:a?"uppercase":"none",borderRadius:I,userSelect:"none",verticalAlign:"baseline",position:"relative",outline:"none"}),g=css({"&&":{background:y.surface.subtleBg,border:"none",boxShadow:"none",color:x.txt}}),p=css({"&&":{background:"transparent",color:x.txt,border:"none",boxShadow:"none"}}),m=css({"&&":{background:y.surface.panelBg,color:x.txt,border:`1px solid ${x.br}`,boxShadow:`inset 0 1px 0 ${x.inset}AA, 0 1px 0 rgba(0,0,0,0.03)`}}),C=n==="subtle"?g:n==="ghost"?p:m,w=s&&c>0&&$m(t)?jsx("span",{css:css({display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:`${T.font+c}px`,lineHeight:1}),children:t}):t;return jsx("kbd",{ref:d,className:l,css:[f(),R,C,i],...u,children:w})});var _m=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,qs=({children:e,direction:t="up",duration:n=450,delay:o=0,on:r=false,onAnimationEnd:s,asChild:a=false,className:c,distance:i})=>{let u=_m(i,t==="left"||t==="right"?"100vw":"100vh"),d=t==="left"?`-${u}`:t==="right"?u:"0",y=t==="up"?u:t==="down"?`-${u}`:"0",f={transform:r?"translate3d(0,0,0)":`translate3d(${d}, ${y}, 0)`,transition:`transform ${n}ms ease ${o}ms`,pointerEvents:r?"auto":"none",willChange:"transform",backfaceVisibility:"hidden"},T=x=>R=>{R.target===R.currentTarget&&R.propertyName==="transform"&&s?.(),x?.(R);};if(a&&isValidElement(e)){let x=e,R=x.props.css,g=Array.isArray(R)?[...R,f]:R?[R,f]:[f],p=["plainframe-ui-transition-slide",x.props.className||"",c||""].join(" ").trim(),m=x.props.onTransitionEnd;return cloneElement(x,{...x.props,css:g,className:p,onTransitionEnd:T(m)})}let I=css(f);return jsx("div",{className:["plainframe-ui-transition-slide",c||""].join(" ").trim(),css:I,onTransitionEnd:T(),children:e})};var Gs=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,Pl=me.createContext(null),Nl=()=>{let e=useContext(Pl);if(!e)throw new Error("Modal components must be used within <Modal>.");return e},Xm=({children:e,open:t,defaultOpen:n,onOpenChange:o,lockScroll:r=true,closeOnEscape:s=true})=>{let[a,c]=useState(!!n),i=t??a,l=useCallback(d=>{t===void 0&&c(d),o?.(d);},[t,o]);useEffect(()=>{if(!i||!s)return;let d=y=>{y.key==="Escape"&&(y.stopPropagation(),l(false));};return window.addEventListener("keydown",d,true),()=>window.removeEventListener("keydown",d,true)},[i,s,l]);let u=useMemo(()=>({open:i,setOpen:l,lockScroll:r,closeOnEscape:s}),[i,l,r,s]);return jsx(Pl.Provider,{value:u,children:e})},Dl=forwardRef(({asChild:e=true,children:t,className:n,css:o,...r},s)=>{let{setOpen:a}=Nl(),c=!!e&&me.isValidElement(t),i=useCallback(u=>{if(c){let d;me.isValidElement(t)&&(d=t.props.onClick),d?.(u);}r.onClick?.(u),u.defaultPrevented||a(true);},[c,t,r.onClick,a]),l=useCallback(u=>{if((u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a(true)),c){let d;me.isValidElement(t)&&(d=t.props.onKeyDown),d?.(u);}r.onKeyDown?.(u);},[c,t,r.onKeyDown,a]);if(c){let u=t,d=u.props.css;return me.cloneElement(u,{...u.props||{},className:[u.props.className,n].filter(Boolean).join(" ")||void 0,css:[d,o].filter(Boolean),"aria-haspopup":"dialog",onClick:i,onKeyDown:l,...r})}return jsx("button",{ref:s,type:"button",className:n,css:o,"aria-haspopup":"dialog",onClick:i,onKeyDown:l,...r,children:t})});Dl.displayName="ModalTrigger";var Hl=forwardRef(({children:e,variant:t="inset",width:n=500,height:o="auto",radius:r="lg",padding:s="lg",backdrop:a=true,backdropBlur:c=true,backdropBlurDepth:i=5,closeOnClickAway:l=true,transitionVariant:u="fade",direction:d="up",transitionDuration:y=300,containerCss:f,backdropCss:T,className:I,...x},R)=>{let g=V(),{open:p,setOpen:m,lockScroll:C}=Nl(),P=me.useRef(null),w=me.useRef(null);me.useEffect(()=>{if(!p)return;w.current=document.activeElement;let S=setTimeout(()=>{let M=P.current;if(!M)return;let b=M.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');b.length>0?b[0].focus():M.focus();},100),F=M=>{let b=P.current;if(!b||!M.target)return;let h=M.target;if(!b.contains(h)){M.preventDefault();let A=b.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');A.length>0?A[0].focus():b.focus();}};return document.addEventListener("focusin",F,true),()=>{clearTimeout(S),document.removeEventListener("focusin",F,true),w.current&&typeof w.current.focus=="function"&&w.current.focus();}},[p]);let v=typeof g.spacing.sm=="number"?`${g.spacing.sm}px`:String(g.spacing.sm),N=css({width:"100%",height:Gs(o),maxWidth:t==="inset"?`min(${Gs(n)||"100%"}, calc(100% - ${v} * 2))`:Gs(n),maxHeight:t==="inset"?`calc(100% - ${v} * 2)`:"100%",margin:t==="inset"?v:void 0}),B=jsx(_n,{role:"dialog","aria-modal":"true",tabIndex:-1,className:["plainframe-ui-modal",I||""].join(" ").trim(),padding:s,radius:r,variant:"panel",css:[N,f],ref:S=>{P.current=S,typeof R=="function"?R(S):R&&(R.current=S);},...x,children:e}),K=u==="none"?B:u==="slide"?jsx(qs,{on:p,direction:d,duration:y,children:B}):u==="grow"?jsx(Ks,{initialScale:.75,on:p,duration:y,children:B}):jsx(Ws,{on:p,duration:y,children:B});if(!a)return jsx(Fragment,{children:K});let O=css(t==="full"?{alignItems:"start",justifyItems:"start",justifyContent:"start"}:{alignItems:"center",justifyItems:"center",justifyContent:"center"});return jsx(Es,{on:p,blur:c,blurDepth:i,onClickAway:l?()=>m(false):void 0,css:[O,T].filter(Boolean),contentCss:O,lockScroll:C,children:K})});Hl.displayName="ModalContent";var of=({count:e,page:t,defaultPage:n=1,onChange:o,siblingCount:r=1,boundaryCount:s=1,disabled:a=false,showFirstLast:c=false,loop:i=false,variant:l="subtle",gap:u,className:d,css:y})=>{let f=V(),T=xe(),I=t!==void 0,[x,R]=useState(n),g=Math.max(1,e),p=Sr(I?t:x,1,g),m=useCallback(k=>{let E=Sr(k,1,g);I||R(E),o?.(E);},[I,g,o]),C=useMemo(()=>rf({count:g,page:p,siblingCount:r,boundaryCount:s}),[g,p,r,s]),P=f.palette?.primary?.[600],w=f.surface?.border,v=l==="subtle"?f.surface.subtleHover:l==="ghost"?f.surface?.subtleBg:f.surface.panelHover,N=f.text?.primary??"#111",B=l==="subtle"?f.surface?.subtleBg:"transparent",K=css({display:"inline-flex",alignItems:"center",gap:u??6,flexWrap:"wrap",borderRadius:f.radius?.md,background:B,padding:l==="subtle"?f.spacing.xs:0,userSelect:"none"},...Array.isArray(y)?y:y?[y]:[]),O=css({minWidth:28,height:28,padding:"0 10px",borderRadius:9,fontSize:13,lineHeight:1,border:"1px solid transparent",background:"transparent",color:N,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:a?"not-allowed":"pointer",outline:"none",transition:"all .16s ease !important","&[aria-disabled='true']":{opacity:.55,pointerEvents:"none",cursor:"not-allowed"},fontWeight:600}),S=css({width:28,minWidth:28,height:28,padding:0}),F=(k=false)=>css([O,T({color:k?"primary":"neutral"}),l==="outlined"?k?{background:P,color:f.text.onColors.primary,borderColor:P}:{background:"transparent",borderColor:w,":hover":{background:v}}:l==="ghost"?k?{background:P,color:f.text.onColors.primary}:{":hover":{background:v}}:k?{background:P,color:f.text.onColors.primary,borderColor:P}:{":hover":{background:v}}]),M=useCallback(()=>m(1),[m]),b=useCallback(()=>m(g),[m,g]),h=useCallback(()=>{p===1?i&&m(g):m(p-1);},[p,i,g,m]),A=useCallback(()=>{p===g?i&&m(1):m(p+1);},[p,i,g,m]),D=a||p===1&&!i,L=a||p===g&&!i;return jsxs("nav",{"aria-label":"Pagination",className:["plainframe-ui-pagination",d||""].join(" ").trim(),css:K,onKeyDown:k=>{a||(k.key==="ArrowLeft"&&(k.preventDefault(),h()),k.key==="ArrowRight"&&(k.preventDefault(),A()),k.key==="Home"&&(k.preventDefault(),M()),k.key==="End"&&(k.preventDefault(),b()));},children:[c&&jsx("button",{className:"plainframe-ui-pagination-first-button",type:"button","aria-label":"First page","aria-disabled":D,disabled:D,css:[F(false),S],onClick:M,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronFirst,{strokeWidth:3,css:{width:14,height:14}})}),jsx("button",{className:"plainframe-ui-pagination-previous-button",type:"button","aria-label":"Previous page","aria-disabled":D,disabled:D,css:[F(false),S],onClick:h,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronLeft,{strokeWidth:3,css:{width:14,height:14}})}),C.map((k,E)=>typeof k=="number"?jsx("button",{className:"plainframe-ui-pagination-page-button",type:"button","aria-label":k===p?`Page ${k}, current page`:`Go to page ${k}`,"aria-current":k===p?"page":void 0,css:F(k===p),onClick:()=>m(k),children:k},k):jsx("span",{className:"plainframe-ui-pagination-ellipsis","aria-hidden":true,css:css([O,T(),{borderColor:"transparent",cursor:"default",opacity:.8,padding:0,minWidth:28}]),children:"\u2026"},`e${E}`)),jsx("button",{className:"plainframe-ui-pagination-next-button",type:"button","aria-label":"Next page","aria-disabled":L,disabled:L,css:[F(false),S],onClick:A,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronRight,{strokeWidth:3,css:{width:14,height:14}})}),c&&jsx("button",{className:"plainframe-ui-pagination-last-button",type:"button","aria-label":"Last page","aria-disabled":L,disabled:L,css:[F(false),S],onClick:b,style:{backgroundColor:l==="subtle"?f.surface?.panelBg:void 0},children:jsx(ChevronLast,{strokeWidth:3,css:{width:14,height:14}})})]})};function Sr(e,t,n){return Math.max(t,Math.min(n,e))}function rf({count:e,page:t,siblingCount:n,boundaryCount:o}){if(e<=0)return [1];let r=2*o+2*n+3;if(e<=r)return Ir(1,e);let s=Ir(1,Math.min(o,e)),a=Ir(Math.max(e-o+1,o+1),e),c=Sr(t-n,o+2,Math.max(o+2,e-o-2*n-1)),i=Sr(t+n,Math.min(o+2+2*n,e-o-1),e-o-1),l=[],u=d=>{let y=l[l.length-1];y!==d&&(y==="ellipsis"&&d==="ellipsis"||l.push(d));};return s.forEach(u),c>o+2?u("ellipsis"):o+1<c&&u(o+1),Ir(c,i).forEach(u),i<e-o-1?u("ellipsis"):e-o>i&&u(e-o),a.forEach(u),l}function Ir(e,t){if(t<e)return [];let n=[];for(let o=e;o<=t;o++)n.push(o);return n}var cf=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,uf=me.memo(({children:e,direction:t="left",width:n,variant:o="solid",className:r,css:s})=>{let a=V(),c=a.surface.border,i=css({display:"inline-block",boxSizing:"border-box",maxWidth:cf(n,"fit-content"),width:"100%",padding:`0 ${a.spacing.md}`,borderLeft:t==="left"?`3px ${o==="dashed"?"dashed":"solid"} ${c}`:"none",borderRight:t==="right"?`3px ${o==="dashed"?"dashed":"solid"} ${c}`:"none"},...Array.isArray(s)?s:s?[s]:[]);return jsx("div",{className:r??"plainframe-ui-quote",css:i,children:e})});var zl=createContext(null),ff=()=>{let e=useContext(zl);if(!e)throw new Error("RadioItem must be used within a RadioGroup");return e},gf=e=>{let t=e?.horizontal??"left",n=e?.vertical??"center";return t==="center"&&n==="center"?{horizontal:"left",vertical:"center"}:{horizontal:t,vertical:n}},bf=({value:e,defaultValue:t,onChange:n,disabled:o=false,size:r="md",direction:s="horizontal",variant:a="filled",className:c,children:i,anchorOrigin:l,css:u})=>{let d=V(),y=e!==void 0&&n!==void 0,[f,T]=useState(t),I=y?e:f,x=useRef([]),[R,g]=useState(0),p=()=>g(F=>F+1),m=useCallback(F=>{y||T(F),n?.(F);},[y,n]),C=useCallback(F=>(x.current.push(F),p(),x.current.length-1),[]),P=useCallback((F,M)=>{let b=x.current[F];b&&(x.current[F]={...b,...M},p());},[]),w=()=>x.current.map((F,M)=>({it:F,i:M})).filter(({it:F})=>F.ref&&!F.disabled).map(({i:F})=>F),v=useCallback((F,M)=>{let b=w();if(!b.length)return;let h=Math.max(0,b.indexOf(F)),A=b[(h+M+b.length)%b.length],D=x.current[A]?.ref;if(D){D.focus();let L=x.current[A]?.value;L!==void 0&&m(L);}},[m]),N=useCallback(F=>{let M=w();if(!M.length)return;let b=F==="first"?M[0]:M[M.length-1],h=x.current[b]?.ref;if(h){h.focus();let A=x.current[b]?.value;A!==void 0&&m(A);}},[m]),B=useMemo(()=>{let F=x.current.filter(b=>b.ref&&!b.disabled);return F.length?F.some(b=>b.value===I)?I:F[0]?.value:void 0},[I,R]),K=useMemo(()=>({selected:I,setSelected:m,disabled:o,size:r,direction:s,variant:a,register:C,update:P,moveFocusBy:v,moveToEdge:N,focusValue:B,theme:d,anchorOrigin:gf(l)}),[I,m,o,r,s,a,C,P,v,N,B,d,l]),O=css({width:"fit-content"}),S=css({display:"flex",flexDirection:s==="vertical"?"column":"row",gap:d.spacing.sm,width:"fit-content",alignItems:s==="vertical"?"stretch":"center"});return jsx("div",{className:c??"plainframe-ui-radio-group",css:[O,u],children:jsx("div",{className:"plainframe-ui-radio-row",role:"radiogroup","aria-disabled":o||void 0,css:S,children:jsx(zl.Provider,{value:K,children:i})})})},hf=({value:e,disabled:t=false,className:n,children:o,css:r})=>{let{selected:s,setSelected:a,disabled:c,size:i,register:l,update:u,moveFocusBy:d,moveToEdge:y,theme:f,variant:T,focusValue:I,anchorOrigin:x}=ff(),R=c||t,g=s===e,p=["sm","md","lg"].includes(i)?i:"md",m=p==="sm"?16:p==="lg"?24:20,C=z=>f.palette?.primary?.[z],P=C(600),w=C(100),v=f.neutral[300],N=f.palette.primary[300],B=f.text.onColors?.primary??f.neutral[0],K="transparent",O=N,S=B;T==="soft"?(K=w,O=null,S=P):T==="outlined"?(K=C(50),O=N,S=P):(K=f.neutral[200],O="transparent",S=B),g&&(T==="outlined"?(K=w,O=N,S=P):T==="filled"?(K=P,O=null,S=B):(K=w,O=null,S=P));let F=T==="filled"?v:f.palette.primary[100],M=useRef(null),b=useRef(-1);useEffect(()=>{b.current=l({ref:M.current,value:e,disabled:!!R});},[l]),useEffect(()=>{u(b.current,{ref:M.current,value:e,disabled:!!R});},[u,R,e]);let h=css({border:"none",background:"transparent",display:"inline-grid",gridTemplateColumns:"auto auto auto",gridTemplateRows:"auto auto auto",columnGap:x.vertical==="center"?f.spacing.sm:0,rowGap:x.vertical==="center"?0:f.spacing.xs,justifyItems:"center",alignItems:"center",opacity:R?.5:1,borderRadius:f.radius.md,cursor:R?"not-allowed":"pointer",transition:"transform .16s ease",fontSize:f.typography.sizes.sm,fontWeight:500,padding:f.spacing.sm,"&:hover .plainframe-ui-radio-circle-outer":R||g?{}:{background:F,boxShadow:T==="outlined"?`inset 0 0 0 ${f.componentHeights.border} ${N}`:"none"},"&:focus-visible .plainframe-ui-radio-circle-outer":{outline:"none"}}),A=css({width:m,height:m,minWidth:m,minHeight:m,borderRadius:f.radius.full,background:K,boxShadow:O?`inset 0 0 0 ${f.componentHeights.border} ${O}`:"none",transition:"background-color .16s ease, box-shadow .16s ease, filter .16s ease",display:"inline-flex",alignItems:"center",justifyContent:"center"}),D=css({width:g?m*.45:0,height:g?m*.45:0,borderRadius:f.radius.full,background:g?S:"transparent",transition:"all 250ms cubic-bezier(.72,1.6,.32,1)",transform:g?"scale(1)":"scale(0.6)",opacity:g?1:0}),L=css({gridColumn:2,gridRow:2,minWidth:0,maxWidth:"100%",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",textAlign:"left"}),k=(()=>{let z=x.horizontal,_=x.vertical;return _==="center"?{col:z==="right"?3:1,row:2}:{col:2,row:_==="top"?1:3}})(),W=!R&&I===e?0:-1,$=xe();return jsxs("button",{ref:M,className:n??"plainframe-ui-radio-item",type:"button",role:"radio","aria-checked":g,"aria-disabled":R||void 0,disabled:R,tabIndex:W,onClick:()=>{R||a(e);},onKeyDown:z=>{R||(z.key==="Enter"||z.key===" "?(z.preventDefault(),a(e)):z.key==="ArrowRight"||z.key==="ArrowDown"?(z.preventDefault(),d(b.current,1)):z.key==="ArrowLeft"||z.key==="ArrowUp"?(z.preventDefault(),d(b.current,-1)):z.key==="Home"?(z.preventDefault(),y("first")):z.key==="End"&&(z.preventDefault(),y("last")));},css:[h,$({color:"primary"}),r],children:[jsx("span",{className:"plainframe-ui-radio-circle-outer",css:[A,css({gridColumn:k.col,gridRow:k.row})],children:jsx("span",{className:"plainframe-ui-radio-circle-dot",css:D})}),o!=null&&jsx("span",{className:"plainframe-ui-radio-label",css:L,children:o})]})};var Rf=({children:e,duration:t=400,delay:n=0,on:o=false,initialAngle:r=360,finalAngle:s=0,onAnimationEnd:a,asChild:c=false,className:i})=>{let l={transform:`rotate(${o?s:r}deg)`,transition:`transform ${t}ms ease ${n}ms`,pointerEvents:o?"auto":"none",transformOrigin:"center center",willChange:"transform",backfaceVisibility:"hidden"},u=y=>f=>{f.target===f.currentTarget&&f.propertyName==="transform"&&a?.(),y?.(f);};if(c&&isValidElement(e)){let y=e,f=y.props.css,T=Array.isArray(f)?[...f,l]:f?[f,l]:[l],I=["plainframe-ui-transition-rotate",y.props.className||"",i||""].join(" ").trim(),x=y.props.onTransitionEnd;return cloneElement(y,{...y.props,css:T,className:I,onTransitionEnd:u(x)})}let d=css(l);return jsx("div",{className:["plainframe-ui-transition-rotate",i||""].join(" ").trim(),css:d,onTransitionEnd:u(),children:e})};var Fo=(...e)=>e.filter(Boolean).flat(),Mr=e=>me.isValidElement(e),Ao=(e,t)=>{if(!Mr(e))return false;let n=e.type,o=(n?.displayName??n?.name??"")||"";return typeof o=="string"&&t.includes(o)},Ef=(e,t)=>{let n=e.props,o=n.value;if(typeof o<"u")return o;let r=n["data-value"];return typeof r<"u"?r:t};function kf({value:e,defaultValue:t,onChange:n,label:o,placeholder:r="Select\u2026",startIcon:s,endIcon:a,disabled:c,size:i="md",variant:l="subtle",fullWidth:u,width:d=200,menuAlign:y="left",menuWidth:f,menuMaxHeight:T=280,wrapperCss:I,labelCss:x,triggerCss:R,menuCss:g,optionCss:p,children:m,className:C,menuSize:P="md",triggerRender:w}){let v=V(),N=xe(),B=me.useId(),K=`${B}-label`,O=`${B}-menu`,S={sm:{minHeight:v.componentHeights.sm,radius:v.radius.sm},md:{minHeight:v.componentHeights.md,radius:v.radius.md},lg:{minHeight:v.componentHeights.lg,radius:v.radius.md}},F=S[i]||S.md,[M,b]=me.useState(false),h=j=>b(!!j),A=typeof e<"u",D=Array.isArray(e)||Array.isArray(t),[L,k]=me.useState(typeof t<"u"?t:D?[]:void 0),E=A?e:L,W=j=>{A||k(j),n?.(j);},$=me.Children.toArray(m).filter(Mr),z,_=[];for(let j of $)if(Ao(j,["MenuRadioGroup"]))z=j;else if(Ao(j,["MenuCheckboxGroup"])){let ue=j.props.children,de=ue?me.Children.toArray(ue).filter(Mr):[];_.push(...de);}else _.push(j);let U=(z?me.Children.toArray(z.props.children).filter(Mr):_).filter(j=>!Ao(j,["MenuLabel","MenuSeparator"])).map((j,ue)=>{let de=j.props,fe=Ef(j,ue),ze=de.children,Oe=de.label,st=typeof Oe=="string"||typeof Oe=="number"?String(Oe):typeof ze=="string"||typeof ze=="number"?String(ze):void 0,Ye=de.role??"",yt=Ao(j,["MenuCheckboxItem"]),tn=Ao(j,["MenuRadioItem"]),nn=yt||Ye==="menuitemcheckbox"||typeof de.onCheckedChange=="function"||typeof de.checked=="boolean"||typeof de.defaultChecked=="boolean",Sn=!nn&&(tn||Ye==="menuitemradio"||!!z),on=typeof de.children>"u"?st??String(fe):de.children;return {el:j,key:j.key??ue,value:fe,labelText:st,title:de.title,description:de.description,nodeForTrigger:on,disabled:!!de.disabled,className:de.className,itemCss:de.css,startIcon:de.startIcon,endIcon:de.endIcon,isCheckbox:nn,isRadio:Sn}}),X=U.some(j=>j.isCheckbox),ae=U.length>0&&U.every(j=>j.isRadio),Y=(D||X)&&!ae,le=me.useCallback(j=>Y?(Array.isArray(E)?E:[]).some(de=>Object.is(de,j)):Object.is(E,j),[E,Y]),ie=me.useMemo(()=>{if(Y){let ue=Array.isArray(E)?E:[];return U.filter(fe=>ue.some(ze=>Object.is(ze,fe.value))).map(fe=>typeof fe.nodeForTrigger=="string"||typeof fe.nodeForTrigger=="number"?String(fe.nodeForTrigger):fe.nodeForTrigger)}let j=U.find(ue=>Object.is(ue.value,E));if(j)return typeof j.nodeForTrigger=="string"||typeof j.nodeForTrigger=="number"?String(j.nodeForTrigger):j.nodeForTrigger},[E,Y,U]),be=j=>{c||(Object.is(j,E)||W(j),h(false));},Pe=j=>{c||Object.is(j,E)||W(j);},Re=j=>{if(c)return;let ue=Array.isArray(E)?E:[],fe=ue.some(ze=>Object.is(ze,j))?ue.filter(ze=>!Object.is(ze,j)):[...ue,j];W(fe);},Ce={position:"relative",width:u?"100%":typeof d=="number"?`${d}px`:d,maxWidth:"100%"},Ie={width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:F.radius,minHeight:F.minHeight,fontSize:v.typography.sizes.sm,padding:`0 ${typeof v.spacing.sm=="number"?`${v.spacing.sm}px`:v.spacing.sm} 0 ${typeof v.spacing.md=="number"?`${v.spacing.md}px`:v.spacing.md}`,fontWeight:500,lineHeight:1,userSelect:"none",cursor:c?"not-allowed":"pointer",border:"none",outline:"none",transition:"box-shadow .16s ease",color:v.text.primary,background:"transparent",whiteSpace:"nowrap"},Te=l==="subtle"?{background:v.surface.subtleBg}:l==="outlined"?{background:v.surface.panelBg,border:`1px solid ${v.surface.border}`}:{background:"transparent"},we={flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",textAlign:"left",gap:8},he={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},je={flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:500,display:"block"},Z=jsx(ChevronsUpDown,{size:16,css:css({color:v.text.secondary,flexShrink:0}),strokeWidth:2.5,className:"plainframe-ui-select-chevron"}),Ee=()=>{if(w)return w(ie);if(Array.isArray(ie)){let ue=ie.map(fe=>typeof fe=="string"?fe:"").filter(Boolean),de=ue.length?ue.join(", "):String(r);return jsxs(Fragment,{children:[s&&jsx("span",{css:css(he),children:s}),jsx("span",{css:css(je),title:de,children:de})]})}let j=ie??String(r);return jsxs(Fragment,{children:[s&&jsx("span",{css:css(he),children:s}),jsx("span",{css:css(je),title:typeof j=="string"?j:void 0,children:j})]})},Q={left:"start",center:"center",right:"end"},ee=j=>{c||(j.key==="ArrowDown"||j.key==="ArrowUp"||j.key==="Enter"||j.key===" ")&&(j.preventDefault(),h(true));},se={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",marginRight:8},pe={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",marginLeft:8},Se={flex:"1 1 auto",minWidth:0,display:"flex",flexDirection:"column",gap:2},Ne={fontWeight:500,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word"},J={fontSize:"0.875em",color:v.text.secondary,overflow:"hidden",overflowWrap:"break-word",wordBreak:"break-word",fontWeight:400},oe=(j,ue)=>{let de=j.title||j.description?jsxs("span",{className:"plainframe-ui-select-option-content",css:css(Se),children:[jsx("span",{className:"plainframe-ui-select-option-title",css:css(Ne),children:j.title??ue}),j.description&&jsx("span",{className:"plainframe-ui-select-option-description",css:css(J),children:j.description})]}):jsx("span",{className:"plainframe-ui-select-option-text",css:css(Ne),children:ue});return jsxs(Fragment,{children:[j.startIcon&&jsx("span",{css:css(se),children:j.startIcon}),de,j.endIcon&&jsx("span",{css:css(pe),children:j.endIcon})]})},re=(j,ue)=>{let de=j.value,fe=le(de),ze=Fo(p,j.itemCss),Oe=j.el.props,st=typeof Oe.children>"u"?j.labelText??String(de):Oe.children;if(Y||j.isCheckbox)return me.cloneElement(j.el,{key:j.key??ue,disabled:c||j.disabled,checked:!!Oe.checked||fe,onCheckedChange:()=>Re(de),closeOnSelect:false,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)});if(j.isRadio)return me.cloneElement(j.el,{key:j.key??ue,value:de,disabled:c||j.disabled,closeOnSelect:false,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)});let Ye=yt=>{yt?.preventDefault?.(),be(de);};return me.cloneElement(j.el,{key:j.key??ue,role:"menuitem","aria-checked":void 0,"aria-selected":fe||void 0,"aria-disabled":c||j.disabled||void 0,disabled:c||j.disabled,closeOnSelect:true,onSelect:Ye,onClick:Ye,css:ze,className:`plainframe-ui-select-option ${j.className||""}`.trim(),children:oe(j,st)})},qe=(()=>{let j=!Y&&(z||U.length>0&&U.every(ue=>ue.isRadio));return z?me.cloneElement(z,{key:"controlled-inner-group",value:E,onValueChange:ue=>Pe(ue),children:U.map(re)}):j?jsx(lr,{value:E,onValueChange:ue=>Pe(ue),children:U.map(re)}):U.map(re)})();return jsxs("div",{css:Fo(Ce,I),className:["plainframe-ui-select-wrapper",C||""].join(" ").trim(),children:[o&&jsx("div",{id:K,className:"plainframe-ui-select-label",css:Fo({marginBottom:6,fontSize:v.typography.sizes.sm,fontWeight:500,color:v.text.secondary},x),children:o}),jsxs($n,{size:P,open:M,onOpenChange:h,children:[jsx(zn,{width:"100%",asChild:true,children:jsxs("button",{type:"button",disabled:c,"aria-haspopup":"menu","aria-expanded":M||void 0,"aria-controls":O,"aria-labelledby":o?K:void 0,onKeyDown:ee,onClick:()=>h(!M),className:"plainframe-ui-select-trigger",css:Fo(css(Ie),css(Te),R,N()),children:[jsx("div",{className:"plainframe-ui-select-trigger-content",css:css(we),children:Ee()}),a??Z]})}),jsx(hn,{id:O,gap:"xs",align:Q[y],sameWidth:f==null,width:f??d,className:"plainframe-ui-select-menu",css:Fo({maxHeight:typeof T=="number"?`${T}px`:T,overflowY:"auto"},g),children:qe})]})]})}var Zs=(e,t)=>e==null?t:typeof e=="number"?`${e}px`:e,Sf=keyframes`
14
14
  0% { background-position: -200% 0; }
15
15
  100% { background-position: 200% 0; }
16
16
  `,Mf=keyframes`
17
17
  0% { opacity: .6; }
18
18
  50% { opacity: 1; }
19
19
  100% { opacity: .6; }
20
- `,Ff=me.memo(({isLoading:e=true,radius:t,animation:n="wave",children:o,width:r,height:s,style:i,className:c,css:a})=>{let l=V(),u=l.surface.subtleBg,d=l.neutral[200],y=Zs(t??l.radius?.lg??8,"8px"),f=css({position:"relative",display:"inline-block",verticalAlign:"middle",width:r==null?"fit-content":Zs(r,String(r)),height:s==null?"fit-content":Zs(s,String(s))}),T=css({position:"absolute",inset:0,borderRadius:y,pointerEvents:"none",background:u,willChange:"background-position, opacity"}),I=n==="wave"?css({backgroundImage:`linear-gradient(90deg, ${u} 25%, ${d} 50%, ${u} 75%)`,backgroundSize:"200% 100%",animation:`${Sf} 1.4s ease-in-out infinite`}):n==="pulse"?css({animation:`${Mf} 1.2s ease-in-out infinite`}):css({}),x=css({visibility:e?"hidden":"visible",display:"inline-block",borderRadius:y});return jsxs("span",{className:["plainframe-ui-skeleton",c||""].join(" ").trim(),css:[f,a],style:i,"aria-busy":e||void 0,children:[e&&jsx("span",{"aria-hidden":true,css:[T,I]}),jsx("span",{className:"plainframe-ui-skeleton-content",css:x,children:o})]})});var Ar=8,Qs=20,Xn=4,jl=({value:e,defaultValue:t,onChange:n,min:o=0,max:r=100,step:s=1,disabled:i=false,rounded:c=false,showValue:a=false,showStepper:l=false,label:u,fullWidth:d=false,css:y,trackCss:f,thumbCss:T,direction:I="horizontal",className:x,...R})=>{let g=V(),p=I==="vertical",m=useRef(null),[C,P]=useState(false),[w,v]=useState(false),[N,B]=useState(false),K=e!==void 0,O=useCallback(Z=>Math.min(r,Math.max(o,Z)),[o,r]),S=useCallback(Z=>O(Math.round((Z-o)/s)*s+o),[o,s,O]),[F,M]=useState(()=>S(t??o)),b=K?S(e):F;useEffect(()=>{K||M(Z=>S(Z));},[o,r,s,K,S]);let h=g.palette.primary[600],A=g.surface.panelBg,D=g.neutral[500],L=useMemo(()=>{let Z=r-o||1;return (b-o)/Z*100},[b,o,r]),k=useCallback(Z=>{K||M(Z),n?.(Z);},[K,n]),E=useCallback((Z,Ee)=>{let Q=m.current;if(!Q)return b;let ee=Q.getBoundingClientRect(),se=p?(ee.bottom-Ee)/ee.height:(Z-ee.left)/ee.width;return se=Math.max(0,Math.min(1,se)),S(o+se*(r-o))},[b,p,o,r,S]),W=useCallback(Z=>{i||(Z.currentTarget.setPointerCapture?.(Z.pointerId),k(E(Z.clientX,Z.clientY)),P(true));},[i,k,E]),$=useCallback(Z=>{i||(Z.currentTarget.setPointerCapture?.(Z.pointerId),P(true));},[i]),z=useCallback(Z=>{!C||i||k(E(Z.clientX,Z.clientY));},[C,i,k,E]),_=useCallback(()=>P(false),[]);useEffect(()=>{if(C)return window.addEventListener("pointermove",z),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_);}},[C,z,_]);let H=useCallback(Z=>{if(i)return;let Ee=b;if(Z.key==="ArrowRight"||Z.key==="ArrowUp")Ee=b+s;else if(Z.key==="ArrowLeft"||Z.key==="ArrowDown")Ee=b-s;else if(Z.key==="Home")Ee=o;else if(Z.key==="End")Ee=r;else return;Z.preventDefault(),k(S(Ee));},[i,b,s,o,r,k,S]),U=C||w||N,X=(w||C)&&!i,ae=`color-mix(in srgb, ${h} 25%, transparent)`,q=css({display:"flex",flexDirection:p?"row":"column",alignItems:"center",padding:p?"1rem":"1rem 0",width:p?"fit-content":d?"100%":350,height:p?250:"auto",boxSizing:"border-box"}),Y=css({marginBottom:p?0:4,marginRight:p?8:0,color:g.text.primary,userSelect:"none"}),le=css({position:"relative",width:p?Ar:"100%",height:p?"100%":Ar,backgroundColor:g.neutral[200],borderRadius:g.radius.xs,cursor:i?"not-allowed":"pointer",touchAction:"none",outline:"none",overflow:"visible"}),ie=css({position:"absolute",left:p?"50%":0,top:p?2:"50%",transform:p?"translateX(-50%)":"translateY(-50%)",width:p?Ar:`calc(100% - ${Xn*.5}px)`,height:p?`calc(100% - ${Xn*.5}px)`:Ar,display:"flex",flexDirection:p?"column":"row",justifyContent:"space-between",alignItems:"center",pointerEvents:"none",zIndex:0,padding:0}),be=css({width:Xn,height:Xn,borderRadius:"50%",backgroundColor:g.text.primary,opacity:.15,flex:"0 0 auto"}),Pe=css({position:"absolute",left:0,top:p?`calc(${100-L}% )`:0,bottom:0,width:p?"100%":`${L}%`,height:p?`${L}%`:"100%",backgroundColor:i?D:h,borderRadius:g.radius.sm,zIndex:1,transition:"none",pointerEvents:"none"}),Re=css({position:"absolute",appearance:"none",WebkitAppearance:"none",background:A,width:Qs,height:Qs,left:p?"50%":`calc(${L}% - ${Qs/2}px)`,bottom:p?`${L}%`:"auto",top:p?"auto":"50%",transform:p?"translate(-50%, 50%)":"translateY(-50%)",borderRadius:c?g.radius.full:`calc(${g.radius.md} * 0.75)`,border:`2px solid ${i?D:h}`,cursor:i?"not-allowed":"grab",zIndex:5,padding:0,lineHeight:0,transition:"box-shadow .16s ease",boxShadow:X?`0 0 0 ${C?4:8}px ${ae}`:`0 0 0 0px ${ae}`,"&:focus-visible":{boxShadow:`0 0 0 4px ${ae}`,outline:"none"}}),Ce=css({position:"relative",backgroundColor:"transparent",padding:"1rem",top:p?-7.5:-28,left:p?9:-7.5,pointerEvents:"none"}),Ie=css({position:"absolute",top:p?`calc(50% - ${Xn*2.5}px)`:0,left:p?"auto":`calc(50% - ${Xn*3}px)`,transform:p?"translateY(-50%)":"translateX(-50%)",backgroundColor:g.neutral[800],color:g.neutral[0],padding:"0.6rem 0.25rem",fontSize:12,borderRadius:6,whiteSpace:"nowrap",pointerEvents:"auto",zIndex:6,"&::after":{content:'""',position:"absolute",width:6,height:6,backgroundColor:g.neutral[800],borderRadius:2,bottom:p?"50%":-2,left:p?-2.5:"50%",transform:p?"translateY(50%) rotate(45deg)":"translateX(-50%) rotate(45deg)"}}),Te=y,we=f,he=T,je=Math.floor((r-o)/s)+1;return jsxs("div",{...R,role:"group","aria-label":u,className:["plainframe-ui-slider",x||""].join(" ").trim(),css:[q,Te],"data-orientation":p?"vertical":"horizontal",children:[u&&!p&&jsx("div",{className:"plainframe-ui-slider-label",css:Y,children:u}),jsxs("div",{ref:m,className:"plainframe-ui-slider-track",css:[le,we],onPointerDown:W,children:[l&&s>0&&jsx("div",{className:"plainframe-ui-slider-stepper",css:ie,children:Array.from({length:je}).map((Z,Ee)=>jsx("span",{className:"plainframe-ui-slider-step-dot",css:be},Ee))}),jsx("div",{className:"plainframe-ui-slider-fill",css:Pe}),jsxs("button",{type:"button",role:"slider","aria-valuemin":o,"aria-valuemax":r,"aria-valuenow":b,"aria-disabled":i||void 0,tabIndex:i?-1:0,onKeyDown:H,onPointerDown:$,onPointerUp:_,onPointerCancel:_,onMouseEnter:()=>v(true),onMouseLeave:()=>v(false),className:"plainframe-ui-slider-thumb",css:[Re,he],children:[jsx(AnimatePresence,{children:U&&jsx(motion.div,{className:"plainframe-ui-slider-tooltip-anchor",css:Ce,initial:{opacity:0,scale:.9,y:p?0:4,x:p?4:0},animate:{opacity:1,scale:1,y:0,x:0},exit:{opacity:0,scale:.9,y:p?0:4,x:p?4:0},transition:{duration:.16,ease:"easeOut"},children:jsx(motion.div,{className:"plainframe-ui-slider-tooltip",css:Ie,initial:{opacity:0,y:p?0:4,x:p?-4:0},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:p?0:4,x:p?-4:0},transition:{duration:.16,ease:"easeOut"},onMouseEnter:()=>B(true),onMouseLeave:()=>B(false),children:b})})}),null]})]}),u&&p&&jsx("div",{className:"plainframe-ui-slider-label",css:[Y,{marginLeft:8}],children:u})]})};jl.displayName="Slider";var Lf=e=>css({"--pf-ease":"cubic-bezier(.4,0,.2,1)",display:"flex",flexDirection:"column",maxWidth:e==null?"100%":typeof e=="number"?`${e}px`:e,width:"100%"}),Bf=css({display:"flex",alignItems:"center",width:"100%",gap:12}),$f=e=>css({display:"flex",minWidth:0,flex:"0 0 auto",alignItems:"center",justifyContent:"center",gap:8,flexDirection:e==="left"?"row-reverse":e==="right"?"row":e==="top"?"column-reverse":"column"}),zf=e=>css({position:"relative",flex:"1 1 24px",minWidth:6,height:2,borderRadius:1,background:e,overflow:"hidden"}),Of=(e,t,n)=>css({position:"absolute",inset:0,transformOrigin:"left center",transform:`scaleX(${e})`,background:t,transition:n?"all .28s var(--pf-ease)":"none",willChange:"transform"}),Wf=css({flex:"1 1 24px",minWidth:2,display:"flex",alignItems:"center",justifyContent:"center"}),Kf=(e,t,n,o,r)=>css({position:"relative",appearance:"none",border:`2px solid ${o}`,width:e,height:e,minWidth:e,minHeight:e,borderRadius:r,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",userSelect:"none",background:t,color:n,transition:"all .22s var(--pf-ease)","&:disabled, &[aria-disabled='true']":{opacity:.55,cursor:"not-allowed"}}),_f=css({fontWeight:700,fontSize:14,lineHeight:1,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"}),Vl=e=>css({position:"absolute",inset:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transform:`scale(${e?1:.3})`,opacity:e?1:0,transition:"background .22s var(--pf-ease), transform .16s var(--pf-ease), opacity .16s var(--pf-ease)",willChange:"transform, opacity"}),jf=(e,t,n,o,r)=>css({fontSize:14,color:e?t:n,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",transition:"all .16s ease",textAlign:"center",fontWeight:700,margin:`0 ${r}px`,borderRadius:o}),Vf=me.memo(function({i:t,item:n,size:o,tokens:r,variant:s,titlePosition:i,isActive:c,completed:a,disabled:l,connectorColor:u,showConnector:d,animate:y,separator:f,canGoToIndex:T,setSelected:I}){let x=V(),R=xe(),{MAIN:g,ACTIVE_TEXT:p,ACTIVE_TEXT_OUTLINED:m,COMPLETE_BG:C,COMPLETE_FG:P,UPCOMING_BG_FILLED:w,UPCOMING_OUTLINE:v,UPCOMING_FG:N}=r,B="transparent",K=N,O=v;s==="subtle"?a?(B=C,K=P,O=C):c?(B=g,K=p,O=g):(B=w,K=N,O=w):a?(B=C,K=P,O=C):c?(B="transparent",K=m,O=g):(B="transparent",K=N,O=v);let S=n.label,F=n.icon??jsx("span",{css:_f,children:typeof S=="number"?S:t+1}),M=n.completedIcon??jsx(Check,{strokeWidth:3.25,size:16});return jsxs(Fragment,{children:[jsxs("div",{className:"plainframe-ui-step",css:$f(i),children:[jsxs("button",{className:"plainframe-ui-step-node",css:[Kf(o,B,K,O,String(x.radius.full)),!l&&R({color:c?"primary":"neutral"})],onClick:()=>{!l&&T(t)&&I(n.value);},tabIndex:l?-1:0,"aria-current":c?"step":void 0,"aria-disabled":l||void 0,disabled:l,"aria-label":typeof S=="string"?S:`Step ${t+1}`,children:[jsx("span",{className:"plainframe-ui-step-content",css:Vl(!a),children:F}),jsx("span",{className:"plainframe-ui-step-check",css:Vl(!!a),children:M})]}),S&&jsx("span",{className:"plainframe-ui-step-label",css:jf(a||c,x.text.primary,x.text.secondary,String(x.radius.xs),Number(x.spacing.xs)),children:S})]}),d&&(f?jsx("div",{className:"plainframe-ui-stepper-separator",css:Wf,children:f}):jsx("div",{className:"plainframe-ui-step-connector",css:zf(x.neutral[300]),children:jsx("div",{className:"plainframe-ui-step-connector-fill",css:Of(a?1:0,u,y),"aria-hidden":"true"})}))]})},(e,t)=>e.isActive===t.isActive&&e.completed===t.completed&&e.disabled===t.disabled&&e.variant===t.variant&&e.separator===t.separator&&e.connectorColor===t.connectorColor&&e.titlePosition===t.titlePosition&&e.size===t.size),na=()=>null;na.displayName="PlainframeUIStep";var Uf=({variant:e="subtle",value:t,defaultValue:n,onChange:o,disabled:r=false,allowForward:s=true,allComplete:i=false,color:c,activeBgColor:a,activeColor:l,completeBgColor:u,completeColor:d,separator:y,titlePosition:f="right",width:T,css:I,className:x,children:R,...g})=>{let p=V(),m=e==="outlined"?"outlined":"subtle",C=me.useMemo(()=>{let E=me.Children.toArray(R).filter(W=>me.isValidElement(W)&&W.type===na);return E.length?E.map((W,$)=>({index:$,...W.props})):[{value:1},{value:2},{value:3}]},[R]),P=me.useCallback((E,W)=>E?p.palette?.[E]??E:W,[p.palette]),w=me.useMemo(()=>({MAIN:String(P(a,typeof p.palette.primary[600]=="string"?p.palette.primary[600]:"")),ACTIVE_TEXT:String(P(l,typeof p.text.onColors?.primary=="string"?p.text.onColors?.primary:"")),ACTIVE_TEXT_OUTLINED:String(P(l,typeof p.text.primary=="string"?p.text.primary:"")),COMPLETE_BG:String(P(u,typeof p.palette.primary[600]=="string"?p.palette.primary[600]:"")),COMPLETE_FG:String(P(d,typeof p.text.onColors?.primary=="string"?p.text.onColors?.primary:"")),UPCOMING_BG_FILLED:String(typeof p.neutral[100]=="string"?p.neutral[100]:""),UPCOMING_OUTLINE:String(typeof p.neutral[300]=="string"?p.neutral[300]:""),UPCOMING_FG:String(typeof p.text.secondary=="string"?p.text.secondary:"")}),[P,a,l,u,d,p.palette.primary,p.neutral,p.text]),v=me.useMemo(()=>{let E=P(c,p.palette.primary[600]);return typeof E=="string"?E:String(E)},[P,c,p.palette.primary]),[N,B]=me.useState(()=>C.some(W=>W?.value===n)?n:C[0]?.value),K=t!==void 0,O=K?t:N,{activeIndex:S,afterLast:F}=me.useMemo(()=>{let E=C.findIndex(W=>W.value===O);if(E!==-1)return {activeIndex:E,afterLast:false};if(typeof O=="number"){let W=Math.floor(O)-1;if(W>=C.length)return {activeIndex:C.length-1,afterLast:true};if(W>=0)return {activeIndex:W,afterLast:false}}return {activeIndex:0,afterLast:false}},[C,O]),M=me.useCallback(E=>{r||(K||B(E),o?.(E));},[r,K,o]),b=me.useCallback(E=>i||!!C[E]?.complete||(F?true:E<S),[i,C,F,S]),h=me.useCallback(E=>{if(r)return false;let W=C[E];if(!W||W.disabled)return false;if(typeof s=="boolean"){if(s===false&&E>S)return false}else if(typeof s=="function"&&!s(S,E))return false;return true},[r,C,s,S]),[A,D]=me.useState(false);me.useEffect(()=>{let E=requestAnimationFrame(()=>D(true));return ()=>cancelAnimationFrame(E)},[]);let L=me.useCallback(E=>{if(!C.length||r)return;let W=S;if(E.key==="ArrowRight")W=Math.min(C.length-1,S+1);else if(E.key==="ArrowLeft")W=Math.max(0,S-1);else if(E.key==="Home")W=0;else if(E.key==="End")W=C.length-1;else return;E.preventDefault(),h(W)&&M(C[W].value);},[C,r,S,h,M]),k=34;return jsx("div",{tabIndex:-1,className:["plainframe-ui-stepper",x||""].join(" ").trim(),css:[Lf(T),I],...g,children:jsx("div",{tabIndex:-1,className:"plainframe-ui-stepper-track",role:"list",onKeyDown:L,css:Bf,children:C.map((E,W)=>jsx(me.Fragment,{children:jsx(Vf,{i:W,item:E,size:k,tokens:w,variant:m,titlePosition:f,isActive:!F&&W===S,completed:b(W),disabled:r||!!E.disabled,connectorColor:v,showConnector:W<C.length-1,animate:A,separator:y,canGoToIndex:h,setSelected:M})},String(E.value??W)))})})};var Nr=()=>null;Nr.displayName="PF.Tab";var Dr=()=>null;Dr.displayName="PF.TabContent";function Gf(e){let t=e.props;return {type:t?.__EMOTION_TYPE_PLEASE_DO_NOT_USE__??e.type,props:t}}var Xf=({children:e,defaultValue:t,value:n,onChange:o,variant:r="subtle",direction:s="horizontal",className:i,shadow:c=false,width:a,fullWidth:l=false,rounded:u=false,titlePosition:d="right",align:y,css:f,trackCss:T,thumbCss:I,activeTabCss:x,activeIndicatorCss:R})=>{let g=V(),p=xe(),m=s==="vertical",C=l||a!=null,P=y??(m?"left":"center"),w={left:"flex-start",center:"center",right:"flex-end"},{tabs:v,contents:N}=me.useMemo(()=>{let Q=[],ee=[];return me.Children.forEach(e,se=>{if(!me.isValidElement(se))return;let{type:pe,props:Se}=Gf(se),Ne=pe===Nr||pe?.displayName===Nr.displayName,J=pe===Dr||pe?.displayName===Dr.displayName;if(Ne){let oe=Se;if(oe?.value===void 0)return;Q.push({value:oe.value,disabled:oe.disabled,node:oe.children,className:oe.className,css:oe.css,activeCss:oe.activeCss});}else if(J){let oe=Se;if(oe?.value===void 0)return;ee.push({value:oe.value,node:oe.children,className:oe.className,css:oe.css});}}),{tabs:Q,contents:ee}},[e]),B=me.useMemo(()=>v.find(Q=>!Q.disabled)?.value,[v]),[K,O]=me.useState(()=>t!==void 0&&v.some(ee=>ee.value===t&&!ee.disabled)?t:B),S=n!==void 0,F=S?n:K,M=me.useRef(null),b=me.useRef([]),h=Math.max(0,v.findIndex(Q=>Q.value===F)),[A,D]=me.useState({left:0,top:0,width:0,height:0}),[L,k]=me.useState(false),[E,W]=me.useState(false),$=me.useCallback(()=>{let Q=M.current,ee=b.current[h];if(!Q||!ee)return;let se=Q.getBoundingClientRect(),pe=ee.getBoundingClientRect();D({left:pe.left-se.left,top:pe.top-se.top,width:pe.width,height:pe.height});},[h]);me.useLayoutEffect(()=>{$(),L||(k(true),requestAnimationFrame(()=>W(true)));},[$,L]),me.useEffect(()=>{let Q=new ResizeObserver(()=>$());M.current&&Q.observe(M.current);let ee=b.current[h];ee&&Q.observe(ee);let se=()=>$();return window.addEventListener("resize",se),()=>{Q.disconnect(),window.removeEventListener("resize",se);}},[$,h]);let z=(Q,ee)=>{if(!v.length)return Q;let se=Q;for(let pe=0;pe<v.length;pe++)if(se=(se+ee+v.length)%v.length,!v[se].disabled)return se;return Q},_=Q=>{S||O(Q),o?.(Q);},H=Q=>{if(!v.length)return;let ee=h;if(Q.key===(m?"ArrowDown":"ArrowRight"))ee=z(h,1);else if(Q.key===(m?"ArrowUp":"ArrowLeft"))ee=z(h,-1);else if(Q.key==="Home")ee=v.findIndex(pe=>!pe.disabled);else if(Q.key==="End"){let pe=[...v].reverse().findIndex(Se=>!Se.disabled);ee=pe===-1?h:v.length-1-pe;}else return;Q.preventDefault();let se=v[ee]?.value;se!==void 0&&_(se),requestAnimationFrame(()=>b.current[ee]?.focus());},U=g.text.primary,X=g.text.secondary,ae=g.neutral[500],q=r==="subtle"?g.surface.subtleBg:"transparent",Y=r==="subtle"?g.surface.panelBg??g.surface.panelBg:r==="ghost"?g.surface.subtleBg:"transparent",le=g.text.primary,ie=r==="subtle"||r==="ghost"||r==="underlined",be=css({"--pf-ease":"cubic-bezier(.4,0,.2,1)",display:"flex",flexDirection:"column",width:l?"100%":a==null?"auto":typeof a=="number"?`${a}px`:a}),Pe=r==="subtle",Re=css({position:"relative",display:C?"flex":"inline-flex",width:C?"100%":"auto",flexDirection:m?"column":"row",alignItems:m?"stretch":"center",flexWrap:"nowrap",gap:g.spacing.xs,padding:Pe?g.spacing.xs:0,background:q,borderRadius:r==="subtle"?u?m?g.radius.lg:g.radius.full:g.radius.lg:"none"}),Ce=css({position:"absolute",zIndex:0,pointerEvents:"none",opacity:L?1:0,visibility:L?"visible":"hidden",transition:E?`${m?"top":"left"} .24s var(--pf-ease), ${m?"height":"width"} .24s var(--pf-ease), background-color .18s var(--pf-ease)`:"none",borderRadius:r==="subtle"||r==="ghost"?u?g.radius.full:g.radius.md:0,background:r==="underlined"?"transparent":Y,...m?{top:`${A.top}px`,height:`${A.height}px`,left:g.spacing.xs,right:g.spacing.xs}:{left:`${A.left}px`,width:`${A.width}px`,top:g.spacing.xs,bottom:g.spacing.xs},boxShadow:c&&r==="subtle"?"0 1px 3px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.04)":"none"}),Ie=css(r!=="underlined"?{}:m?{background:"transparent",top:`${A.top}px`,height:`${A.height}px`,left:0,width:0,borderLeft:`2px solid ${le}`,borderBottom:"none",borderRadius:2}:{background:"transparent",left:`${A.left}px`,width:`${A.width}px`,bottom:0,top:"auto",height:0,borderBottom:`2px solid ${le}`,borderLeft:"none",borderRadius:2}),Te=css({position:"relative",zIndex:1,border:"none",background:"transparent",padding:r==="underlined"&&s!=="vertical"?`${g.spacing.md}`:r==="ghost"&&s!=="vertical"?`${g.spacing.md}`:`${g.spacing.xs} ${g.spacing.md}`,borderRadius:(r==="subtle"||r==="ghost")&&u?g.radius.full:g.radius.md,minHeight:g.componentHeights.sm,outline:"none",transition:"color .16s ease !important",display:"flex",alignItems:"center",justifyContent:"center",...m?{width:C?"100%":"auto",flex:"0 0 auto",textAlign:P}:C?{flex:"1 1 0",minWidth:0,textAlign:"center"}:{flex:"0 0 auto",minWidth:"max-content",textAlign:"center"},whiteSpace:"nowrap",boxSizing:"border-box",cursor:"pointer",userSelect:"none",fontSize:g.typography.sizes.sm,fontWeight:600,color:X,"&[aria-selected='true']":{color:U},"&:hover":{color:U},"&[aria-disabled='true'], &:disabled":{opacity:.55,cursor:"not-allowed",color:ae}}),we=css({display:"inline-flex",alignItems:"center",justifyContent:m?w[P]:"center",gap:6,width:"100%",flexDirection:d==="top"?"column-reverse":d==="bottom"?"column":d==="left"?"row-reverse":"row"}),he=css({marginTop:g.spacing.sm,width:"100%"}),je=me.useId(),Z=new Map;N.forEach((Q,ee)=>Z.set(Q.value,`${je}-panel-${ee}`));let Ee=Q=>`${je}-tab-${Q}`;return jsxs("div",{className:["plainframe-ui-tabs",i||""].join(" ").trim(),css:[be,f],children:[jsxs("div",{className:"plainframe-ui-tabs-track",ref:M,role:"tablist","aria-orientation":m?"vertical":"horizontal",onKeyDown:H,css:[Re,T],children:[ie&&jsx("div",{className:"plainframe-ui-tabs-thumb",css:[Ce,Ie,I,R]}),v.map((Q,ee)=>{let se=F===Q.value;return jsx("button",{ref:pe=>{b.current[ee]=pe;},role:"tab",id:Ee(ee),"aria-selected":se,"aria-controls":Z.get(Q.value),"aria-disabled":Q.disabled||void 0,disabled:Q.disabled,tabIndex:Q.disabled?-1:ee===h?0:-1,className:["plainframe-ui-tab",Q.className||""].join(" ").trim(),onClick:()=>{Q.disabled||_(Q.value);},css:[Te,!Q.disabled&&p(),Q.css,se?Q.activeCss??x:void 0],children:jsx("span",{className:"plainframe-ui-tab-content",css:we,children:Q.node})},String(Q.value??ee))})]}),N.map((Q,ee)=>{let se=Q.value===F;if(!se)return null;let pe=v.findIndex(Ne=>Ne.value===Q.value),Se=pe>=0?Ee(pe):void 0;return console.log("rendering panel for",Q.value,"active:",se),jsx("div",{role:"tabpanel",id:Z.get(Q.value),"aria-labelledby":Se,className:["plainframe-ui-tab-panel",Q.className||""].join(" ").trim(),css:[he,Q.css],children:Q.node},ee)})]})};var Po=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,kn=e=>e==null?[]:Array.isArray(e)?e:[e],No=(...e)=>css(e.filter(Boolean)),tg=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,error:s,helperText:i,disabled:c=false,fullWidth:a=false,width:l=235,size:u="md",variant:d="subtle",rounded:y=false,rows:f=3,maxRows:T,maxLength:I,showCharCount:x,focusRingMode:R="always",resizable:g=false,className:p,wrapperCss:m,inputCss:C,labelCss:P,helperRowCss:w,helperTextCss:v,charCountCss:N,css:B,onBlur:K,onFocus:O,onKeyDown:S,autoFocus:F,name:M,id:b,tabIndex:h,autoComplete:A,readOnly:D,required:L})=>{let k=V(),E=Yo(),W=useId(),$=useMemo(()=>({sm:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.sm,labelFont:k.typography.sizes.xs,helperFont:k.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:k.spacing.md},md:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.md,labelFont:k.typography.sizes.sm,helperFont:k.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:k.spacing.md},lg:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.lg,labelFont:k.typography.sizes.md,helperFont:k.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:k.spacing.md}}),[k]),z=["sm","md","lg"].includes(u)?u:"md",_=$[z],H=k.neutral,U=k.text,X=t!==void 0,[ae,q]=useState(n),Y=X?t:ae,le=useCallback(se=>{X||q(se),o?.(se);},[X,o]),ie=useMemo(()=>c?H[200]:s&&d==="outlined"?k.palette.danger?.[50]??k.surface.panelBg:s&&d==="subtle"?k.palette.danger?.[50]??k.surface.subtleBg:d==="outlined"?k.surface.panelBg:d==="subtle"?k.surface.subtleBg:"transparent",[c,s,d,H,k.surface,k.palette.danger]),be=k.componentHeights.border,Pe=useMemo(()=>d==="outlined"?`${be} solid ${s?k.palette.danger?.[300]??k.surface.border:k.surface.border}`:"none",[d,be,s,k.palette.danger,k.surface.border]),Re=useMemo(()=>css({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:a?"100%":l!=null?Po(l):void 0,flex:"0 0 auto",fontWeight:500}),[a,l]),Ce=useMemo(()=>No({fontSize:_.labelFont,fontWeight:500,color:s?k.palette.danger?.[700]??U.primary:c?H[500]:U.primary,marginBottom:4,display:"inline-block"},...kn(P)),[_.labelFont,s,c,H,U,k.palette.danger,P]),Ie=useMemo(()=>[{display:"flex",alignItems:"stretch",gap:k.spacing.sm,padding:`${Po(_.paddingY)} 0 ${Po(_.paddingY)} ${Po(_.paddingX)}`,background:ie,border:Pe,borderRadius:y?k.radius.full:k.radius.md,minHeight:_.minHeight,width:"100%",cursor:c?"not-allowed":"text",opacity:c?.65:1,transition:"box-shadow .18s, border-color .16s"},...kn(m),...kn(B)],[k,_,ie,Pe,be,y,c,m,B]),Te=typeof _.minHeight=="number"?`${_.minHeight}px`:_.minHeight,we=useMemo(()=>No({width:"100%",minWidth:0,flex:1,resize:g?"vertical":"none",font:"inherit",fontWeight:500,fontSize:_.fontSize,lineHeight:1.5,color:c?H[500]:s?k.palette.danger?.[800]??U.primary:U.primary,background:"transparent",border:"none",outline:"none",padding:0,paddingRight:Po(_.paddingX),overflowY:"auto",minHeight:Te,"&::placeholder":{color:s?k.palette.danger?.[700]??U.secondary:U.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${s?k.palette.danger?.[800]??U.primary:U.primary} !important`,boxShadow:`0 0 0 1000px ${ie} inset !important`,transition:"opacity 99999s ease-out",caretColor:s?k.palette.danger?.[800]??U.primary:U.primary},":focus-within":{outline:"none",boxShadow:"none"},...f===1?{paddingBlock:`calc((${Te} - 1.5em) / 2)`}:{paddingBlock:"clamp(4px, 0.5em, 12px)"}},...kn(C)),[g,_,c,s,H,U,k.palette.danger,Te,ie,f,C]),he=useMemo(()=>No({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,paddingTop:3},...kn(w)),[w]),je=useMemo(()=>No({fontSize:_.helperFont,color:s?k.palette.danger?.[700]??U.secondary:U.secondary,flex:1,minWidth:0},...kn(v)),[_.helperFont,s,k.palette.danger,U,v]),Z=useMemo(()=>No({fontSize:_.helperFont,color:I&&Y.length>I?k.palette.danger?.[700]??U.secondary:U.secondary,flexShrink:0},...kn(N)),[_.helperFont,I,Y.length,k.palette.danger,U,N]),Ee=useRef(null);useLayoutEffect(()=>{if(typeof window>"u")return;let se=Ee.current;if(!se)return;if(g){let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),J=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),J);se.style.setProperty("--pf-minh",`${oe}px`);return}(()=>{let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),J=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),J);se.style.setProperty("--pf-minh",`${oe}px`);let re=T?Ne*T:1/0;se.style.height="auto",se.style.height=`${Math.min(se.scrollHeight,re)}px`;})();},[Y,f,T,_.minHeight,g]);let Q=i!=null||x?`${b??W}-help`:void 0,ee=b??W;return jsxs("div",{className:["plainframe-ui-textarea",p||""].join(" ").trim(),css:Re,children:[e&&jsx("label",{htmlFor:ee,className:"plainframe-ui-textarea-label",css:Ce,children:e}),jsx("div",{className:"plainframe-ui-textarea-surface",css:[E({enabled:R!=="none",disabled:c,color:s?"danger":void 0}),Ie],"aria-invalid":!!s||void 0,"aria-disabled":c||void 0,onClick:()=>!c&&Ee.current?.focus(),children:jsx("textarea",{ref:Ee,id:ee,className:"plainframe-ui-textarea-input",css:we,rows:f,value:Y,onChange:se=>{let pe=se.target.value;I&&pe.length>I||le(pe);},placeholder:r||"",disabled:c,onBlur:K,onFocus:O,onKeyDown:S,autoFocus:F,name:M,tabIndex:h,autoComplete:A,readOnly:D,required:L,"aria-invalid":!!s||void 0,"aria-describedby":Q})}),(i!=null||x&&I!=null)&&jsxs("div",{className:"plainframe-ui-textarea-helper-row",css:he,children:[jsx("span",{id:Q,className:"plainframe-ui-textarea-helper-text",css:je,children:i}),x&&I!=null&&jsxs("span",{className:"plainframe-ui-textarea-char-count",css:Z,children:[Y.length,"/",I]})]})]})};var cg=Vo,ug={type:"spring",stiffness:920,damping:100},Gl="__toast_root__",dg=(e,t)=>t.split(".").reduce((n,o)=>n!=null&&typeof n=="object"?n[o]:void 0,e),Lr=(e,t)=>{for(let n of t){let o=dg(e,n);if(o!=null&&o!=="")return o}},ra=(e,t)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:String(e);function pg(e){let t=Lr(e,["radius.md","shape.borderRadius","radii.md"]),n=Lr(e,["spacing.lg","space.4","spacing.4"]),o=Lr(e,["spacing.md","space.3","spacing.3"]),r=Lr(e,["shadows.lg","elevation.lg"])??"0 8px 24px rgba(0,0,0,.03), 0 2px 8px rgba(0,0,0,.05)";return {radius:ra(t,16),padX:ra(n,14),padY:ra(o,12),shadow:String(r)}}var mg=pg(cg),Wt=null,Yn=null,ye={max:5,position:"bottom-right",gutter:5,zIndex:1e3,duration:5e3,showDismiss:"hover",styles:{},renderer:void 0,bareRenderer:false};function Jl(){typeof document>"u"||(Wt||(Wt=document.getElementById("toast-host"),Wt||(Wt=document.createElement("div"),Wt.id="toast-host",document.body.appendChild(Wt))),Yn||(Yn=Wt[Gl]??null,Yn||(Yn=createRoot(Wt),Wt[Gl]=Yn,Yn.render(jsx(Na,{children:jsx(wg,{})})))));}var te={displayed:[],queue:[],entering:{},exiting:{},enterFrom:{},timers:new Map,expiry:new Map,remaining:new Map,paused:new Set,listeners:new Set,snapshot:{displayed:[],entering:{},exiting:{},enterFrom:{}},subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)},notify(){this.listeners.forEach(e=>e());},sync(){this.snapshot={displayed:[...this.displayed],entering:{...this.entering},exiting:{...this.exiting},enterFrom:{...this.enterFrom}};}},In=()=>{te.sync(),te.notify();},fg=()=>typeof crypto<"u"&&"randomUUID"in crypto&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2);function Br(e,t){if(t===null)return;let n=t??e.duration;if(n==null||te.timers.has(e.id))return;let o=Date.now(),r=te.remaining.get(e.id),s=r!=null?Math.max(0,r):n;te.expiry.set(e.id,o+s);let i=window.setTimeout(()=>Be.dismiss(e.id),s);te.timers.set(e.id,i);}function $r(e){let t=te.timers.get(e);t&&(clearTimeout(t),te.timers.delete(e));}function gg(){let e=false;for(;te.displayed.length<ye.max&&te.queue.length;){let t=te.queue.shift();te.displayed=[t,...te.displayed],te.enterFrom[t.id]="head",te.entering[t.id]=true,e=true,requestAnimationFrame(()=>{delete te.entering[t.id],In();}),Br(t);}e&&In();}function bg(){if(te.displayed.length<ye.max)return;let e=te.displayed.filter(o=>!te.exiting[o.id]);if(!e.length)return;let t=e.reduce((o,r)=>o.createdAt<=r.createdAt?o:r),n=te.expiry.get(t.id);n!=null&&te.remaining.set(t.id,Math.max(0,n-Date.now())),$r(t.id),te.exiting[t.id]=true,te.displayed=te.displayed.filter(o=>o.id!==t.id),delete te.enterFrom[t.id],te.queue.push(t),In();}var hg=e=>e==="danger"?"error":["default","success","error","warning","info"].includes(e)?e:"default";function yg(e,t){let n=hg(t),o=e,r=o.surface,s=o.text,i=r?.panelBg??"#fff",c=s?.primary??"#111",a=r?.border;if(n==="default"||n==="info")return {bg:i,fg:c,border:a};let l=s?.onColors??{},u=(d,y,f)=>{let T=o.colors,I=o.palette;return {bg:T?.[d]??I?.[d]?.[700]??y,fg:l?.[d]??f,border:"transparent"}};return n==="success"?u("success","#22C55E","#fff"):n==="warning"?u("warning","#F59E0B","#fff"):n==="error"?u("error","#EF4444","#fff"):{bg:i,fg:c,border:a}}var Be=Object.assign((e,t)=>{Jl();let n=a=>a!=null&&typeof a[Symbol.iterator]=="function",o=a=>!!a&&(typeof a=="object"||typeof a=="function")&&typeof a.then=="function",r;typeof e=="object"&&e!=null&&!me.isValidElement(e)&&!n(e)&&!o(e)?r=e:r={content:(me.isValidElement(e),e),...t||{}},r.content==null&&(r.title!=null||r.description!=null)&&(r.content=jsxs("div",{children:[r.title&&jsx("strong",{style:{display:"block",marginBottom:2},children:r.title}),r.description]}));let s=r.id??fg(),i=a=>{let l=a.findIndex(y=>y.id===s);if(l===-1)return false;let u=a[l],d={...u,status:r.status??u.status,content:r.content??u.content,title:r.title??u.title,description:r.description??u.description,startIcon:r.startIcon??u.startIcon,endIcon:r.endIcon??u.endIcon,action:r.action??u.action,onClose:r.onClose??u.onClose,duration:r.duration===void 0?u.duration:r.duration,pauseOnHover:r.pauseOnHover??u.pauseOnHover,showDismiss:r.showDismiss??u.showDismiss,render:r.render??u.render,bare:r.bare??u.bare,onClick:r.onClick??u.onClick,width:r.width??u.width};return a[l]=d,$r(s),te.remaining.delete(s),te.paused.has(s)||Br(d),In(),true};if(i(te.displayed)||i(te.queue))return s;let c={id:s,status:r.status??"default",content:r.content,title:r.title,description:r.description,startIcon:r.startIcon,endIcon:r.endIcon,action:r.action,duration:r.duration===void 0?ye.duration:r.duration,onClose:r.onClose,createdAt:Date.now(),pauseOnHover:r.pauseOnHover??true,showDismiss:r.showDismiss,render:r.render,bare:r.bare,onClick:r.onClick,width:r.width??300};return te.displayed.length>=ye.max&&bg(),te.displayed=[...te.displayed,c],te.enterFrom[c.id]="tail",te.entering[c.id]=true,requestAnimationFrame(()=>{delete te.entering[c.id],In();}),In(),Br(c),s},{success:(e,t={})=>Be(e,{...t,status:"success"}),error:(e,t={})=>Be(e,{...t,status:"error"}),warning:(e,t={})=>Be(e,{...t,status:"warning"}),info:(e,t={})=>Be(e,{...t,status:"info"}),custom:(e,t={})=>Be(e,{...t}),update:(e,t)=>Be({id:e,...t}),dismiss:e=>{if(!e){let n=te.displayed.find(o=>!te.exiting[o.id])?.id;n&&Be.dismiss(n);return}$r(e),te.remaining.delete(e),te.paused.delete(e),te.exiting[e]=true;let t=te.displayed.find(n=>n.id===e);te.displayed=te.displayed.filter(n=>n.id!==e),delete te.enterFrom[e],In(),window.setTimeout(()=>t?.onClose?.(),120),gg();},clear:()=>{[...te.displayed.map(t=>t.id)].forEach(t=>Be.dismiss(t));},pause:e=>{if(te.paused.has(e))return;let t=te.expiry.get(e);t!=null&&te.remaining.set(e,Math.max(0,t-Date.now())),te.paused.add(e),$r(e);},resume:e=>{if(!te.paused.has(e))return;te.paused.delete(e);let t=te.displayed.find(o=>o.id===e)??te.queue.find(o=>o.id===e),n=te.remaining.get(e);t&&Br(t,n??void 0),te.remaining.delete(e);},pauseLatest:()=>{let e=te.displayed.at(-1);e&&Be.pause(e.id);},resumeLatest:()=>{let e=te.displayed.at(-1);e&&Be.resume(e.id);},promise:(e,t,n={})=>{let o=Be(t.loading,{...n,status:"info",duration:null});return e.then(r=>{Be.update(o,{status:"success",content:t.success(r),duration:n.duration??2500});}).catch(r=>{Be.update(o,{status:"error",content:t.error(r),duration:n.duration??3e3});}),e},config:e=>{e.max!=null&&(ye.max=e.max),e.position&&(ye.position=e.position),e.gutter!=null&&(ye.gutter=e.gutter),e.zIndex!=null&&(ye.zIndex=e.zIndex),e.duration!==void 0&&(ye.duration=e.duration),e.showDismiss&&(ye.showDismiss=e.showDismiss),e.styles&&(ye.styles={...ye.styles,...e.styles}),e.renderer!==void 0&&(ye.renderer=e.renderer),e.bareRenderer!==void 0&&(ye.bareRenderer=e.bareRenderer);}});function xg(e){return typeof e=="string"?e:e===true?"always":e===false?"never":ye.showDismiss}function vg(e){return {"top-left":{top:16,left:16,alignItems:"flex-start"},"top-center":{top:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"top-right":{top:16,right:16,alignItems:"flex-end"},"bottom-left":{bottom:16,left:16,alignItems:"flex-start"},"bottom-center":{bottom:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"bottom-right":{bottom:16,right:16,alignItems:"flex-end"}}[e]}var Cg=css({display:"flex",alignItems:"flex-start",gap:10}),Xl=css({flex:"0 0 auto",paddingTop:1,lineHeight:0,marginLeft:-3,"& svg, & img, & canvas, & video":{display:"block"}}),Rg=css({fontSize:14,lineHeight:1.4,fontWeight:500,flex:1,minWidth:0}),Tg=css({display:"flex",alignItems:"center",gap:6,marginRight:-2}),wg=me.memo(function(){let t=useSyncExternalStore(te.subscribe.bind(te),()=>te.snapshot,()=>te.snapshot),n=V(),o=ye.position.startsWith("bottom"),r=me.useMemo(()=>o?t.displayed:[...t.displayed].reverse(),[t.displayed,o]),s=me.useMemo(()=>({position:"fixed",zIndex:ye.zIndex,pointerEvents:"none",width:"100%",display:"flex",flexDirection:"column",...vg(ye.position),...ye.styles.stack??{}}),[]);return jsx("div",{className:"plainframe-ui-toast-stack",css:css(s),children:jsx(AnimatePresence,{initial:false,children:r.map((i,c)=>{let a=t.enterFrom[i.id]||"tail",l=o?a==="head"?-16:16:a==="head"?16:-16,u=c>0?ye.gutter:0,d={toast:i,close:Be.dismiss,pause:Be.pause,resume:Be.resume},{bg:y,fg:f,border:T}=yg(n,i.status),I={position:"relative",overflow:"hidden",borderRadius:n.radius.md,boxShadow:mg.shadow,padding:`${n.spacing.md} calc(${n.spacing.lg} + 30px) ${n.spacing.md} ${n.spacing.lg}`,display:"grid",gridTemplateColumns:"1fr auto",gap:10,background:y,color:f,cursor:i.onClick?"pointer":"default",border:T?`1px solid ${T}`:"1px solid transparent"},x=typeof ye.styles.surface=="function"?ye.styles.surface(i):ye.styles.surface??{},R=xg(i.showDismiss),g={},p="& .plainframe-ui-toast-close",m="&:hover .plainframe-ui-toast-close";R==="hover"?(g[p]={opacity:0,pointerEvents:"none"},g[m]={opacity:1,pointerEvents:"auto"}):R==="always"?g[p]={opacity:1,pointerEvents:"auto"}:R==="never"&&(g[p]={display:"none"});let C=css({...I,...x,...g}),P=css({position:"absolute",top:8,right:8,appearance:"none",border:0,background:"transparent",color:f,width:28,height:28,borderRadius:8,cursor:"pointer",lineHeight:1,transition:"opacity .12s ease",display:"grid",placeItems:"center",...ye.styles.close??{}}),w;if(i.bare&&i.render){let v=typeof i.render=="function"?i.render(d):i.render;w=jsx("div",{style:{pointerEvents:"auto"},onClick:N=>i.onClick?.(i.id,N),children:v});}else if(ye.bareRenderer&&ye.renderer){let v=typeof ye.renderer=="function"?ye.renderer(d):ye.renderer;w=jsx("div",{style:{pointerEvents:"auto"},onClick:N=>i.onClick?.(i.id,N),children:v});}else {let v;ye.renderer?v=typeof ye.renderer=="function"?ye.renderer(d):ye.renderer:i.render&&!i.bare?v=typeof i.render=="function"?i.render(d):i.render:v=jsxs(Fragment,{children:[jsxs("div",{css:Cg,children:[i.startIcon&&jsx("div",{css:Xl,children:i.startIcon}),jsx("div",{css:Rg,children:i.content}),i.endIcon&&jsx("div",{css:Xl,children:i.endIcon})]}),i.action&&jsx("div",{css:Tg,children:i.action})]}),w=jsxs("div",{css:C,onClick:N=>i.onClick?.(i.id,N),children:[v,jsx("button",{className:"plainframe-ui-toast-close","aria-label":"Close",css:P,onClick:N=>{N.stopPropagation(),Be.dismiss(i.id);},children:jsx(X,{strokeWidth:2.5,size:14})})]});}return jsx(Eg,{id:i.id,isBottom:o,mt:u,enterY:l,width:i.width,pauseOnHover:i.pauseOnHover!==false,children:w},i.id)})})})}),Eg=me.memo(function(t){let{id:n,isBottom:o,mt:r,enterY:s,width:i,pauseOnHover:c,children:a}=t,l=useAnimationControls();useEffect(()=>{l.start({opacity:1,y:0,height:"auto",x:0,transition:ug});},[l]);let u={pointerEvents:"auto",willChange:"transform, opacity, height, margin, scale, width, max-width",marginTop:r,width:"100%",maxWidth:i!=null?typeof i=="number"?`${i}px`:i:"none",...ye.styles.item??{}};return jsx(motion.div,{layout:"position",className:"plainframe-ui-toast-item",css:css(u),initial:{opacity:0,y:s,height:"auto",x:0},animate:l,exit:{opacity:0,y:o?6:-6,height:0,marginTop:0,transition:{type:"tween",ease:"easeInOut",duration:.14}},drag:"x",dragElastic:.2,dragMomentum:true,whileDrag:{scale:.98,opacity:.95},onDragEnd:(d,y)=>{let f=Math.abs(y.offset.x),T=Math.abs(y.velocity.x);if(!(f>60||T>600)){l.start({x:0,opacity:1,transition:{type:"spring",stiffness:700,damping:40}});return}let R=(y.offset.x!==0?Math.sign(y.offset.x):Math.sign(y.velocity.x||1))*(window.innerWidth+160),g=typeof y.velocity.x=="number"?y.velocity.x/10:0;l.start({x:R,opacity:.9,transition:{type:"spring",stiffness:280,damping:24,velocity:g}}).then(()=>Be.dismiss(n));},onMouseEnter:c?()=>Be.pause(n):void 0,onMouseLeave:c?()=>Be.resume(n):void 0,children:a})}),Yl=false;(function(){Yl||(Yl=true,Jl());})();var Gg=(...e)=>t=>{for(let n of e)if(n)if(typeof n=="function")n(t);else try{n.current=t;}catch{}},ec=createContext(null),tc=()=>{let e=useContext(ec);if(!e)throw new Error("TooltipTrigger/TooltipContent must be inside <Tooltip>.");return e},Xg=({children:e,placement:t="top",open:n,defaultOpen:o=false,onOpenChange:r,delay:s=80,arrow:i=true,autoWidth:c=false,disableHoverListener:a=false})=>{let[l,u]=useState(!!o),d=n??l,y=w=>{n===void 0&&u(w),r?.(w);},f=useRef(null),T=useFloating({placement:t,open:d,onOpenChange:y,whileElementsMounted:autoUpdate,strategy:"fixed",transform:false,middleware:[offset(8),flip({padding:8}),shift({padding:8}),i?arrow({element:f,padding:4}):void 0].filter(Boolean)}),I=useHover(T.context,{enabled:!a,delay:{open:s,close:60},handleClose:safePolygon(),restMs:20}),x=useFocus(T.context),R=useDismiss(T.context,{escapeKey:true,outsidePress:true}),g=useRole(T.context,{role:"tooltip"}),{getReferenceProps:p,getFloatingProps:m}=useInteractions([I,x,R,g]),C=useId(),P=useMemo(()=>({open:d,setOpen:y,id:C,placement:T.placement,autoWidth:c,allowArrow:!!i,refs:T.refs,floatingStyles:T.floatingStyles,middlewareData:T.middlewareData,getReferenceProps:p,getFloatingProps:m,arrowRef:f}),[d,c,i,T.placement,T.refs,T.floatingStyles,T.middlewareData,p,m]);return jsx(ec.Provider,{value:P,children:e})},Yg=({asChild:e=true,children:t,className:n,css:o})=>{let{refs:r,getReferenceProps:s,id:i}=tc(),c=me.isValidElement(t),a=c&&typeof t.type=="string";if(e&&c&&a){let l=t,u="ref"in l?l.ref:void 0,d=s({...l.props,"aria-describedby":i,ref:Gg(u,r.setReference),className:[l.props?.className||"",n||""].join(" ").trim()||void 0}),y=[l.props?.css||void 0,o].filter(Boolean);return me.cloneElement(l,{...d,css:y})}return jsx("span",{ref:r.setReference,className:n,css:o,style:{display:"inline-flex"},...s({"aria-describedby":i}),children:t})},Jg=({children:e,className:t,css:n,arrowCss:o})=>{let {open:r,refs:s,floatingStyles:i,middlewareData:c,getFloatingProps:a,placement:l,id:u,autoWidth:d,allowArrow:y,arrowRef:f}=tc(),T=V(),I=l.split("-")[0]||"top",R=I==="bottom"?{opacity:0,y:-8,scale:.98}:I==="top"?{opacity:0,y:8,scale:.98}:I==="left"?{opacity:0,x:8,scale:.98}:{opacity:0,x:-8,scale:.98},g=R,p=I==="bottom"?"center top":I==="top"?"center bottom":I==="left"?"right center":"left center",m=css({zIndex:1300,backgroundColor:T.neutral[900],color:T.neutral[0],borderRadius:8,padding:"6px 9px",fontSize:12,fontWeight:500,lineHeight:1.25,maxWidth:260,whiteSpace:d?"nowrap":"normal",boxShadow:"0 10px 30px rgba(0,0,0,.18)",pointerEvents:"auto",transformOrigin:p}),C=css({position:"absolute",width:10,height:10,borderRadius:2,backgroundColor:T.neutral[900],transform:"rotate(45deg)",pointerEvents:"none"}),P=c.arrow,w={top:"bottom",bottom:"top",left:"right",right:"left"}[I];return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:r&&jsxs(motion.div,{id:u,ref:s.setFloating,role:"tooltip","data-state":"open",className:["plainframe-ui-tooltip",t||""].join(" ").trim(),css:[m,n],style:i,initial:R,animate:{opacity:1,x:0,y:0,scale:1},exit:g,transition:{scale:{type:"spring",stiffness:520,damping:36,mass:.6},x:{type:"spring",stiffness:420,damping:32,mass:.6},y:{type:"spring",stiffness:420,damping:32,mass:.6},opacity:{duration:.14,ease:"linear"}},...a(),children:[e,y&&jsx("div",{ref:f,className:"plainframe-ui-tooltip-arrow",css:[C,o],style:{left:P?.x!=null?`${P.x}px`:void 0,top:P?.y!=null?`${P.y}px`:void 0,[w]:"-3px"}})]})})})};function tb(){let e=V();return jsx(Global,{styles:css`
20
+ `,Ff=me.memo(({isLoading:e=true,radius:t,animation:n="wave",children:o,width:r,height:s,style:a,className:c,css:i})=>{let l=V(),u=l.surface.subtleBg,d=l.neutral[200],y=Zs(t??l.radius?.lg??8,"8px"),f=css({position:"relative",display:"inline-block",verticalAlign:"middle",width:r==null?"fit-content":Zs(r,String(r)),height:s==null?"fit-content":Zs(s,String(s))}),T=css({position:"absolute",inset:0,borderRadius:y,pointerEvents:"none",background:u,willChange:"background-position, opacity"}),I=n==="wave"?css({backgroundImage:`linear-gradient(90deg, ${u} 25%, ${d} 50%, ${u} 75%)`,backgroundSize:"200% 100%",animation:`${Sf} 1.4s ease-in-out infinite`}):n==="pulse"?css({animation:`${Mf} 1.2s ease-in-out infinite`}):css({}),x=css({visibility:e?"hidden":"visible",display:"inline-block",borderRadius:y});return jsxs("span",{className:["plainframe-ui-skeleton",c||""].join(" ").trim(),css:[f,i],style:a,"aria-busy":e||void 0,children:[e&&jsx("span",{"aria-hidden":true,css:[T,I]}),jsx("span",{className:"plainframe-ui-skeleton-content",css:x,children:o})]})});var Ar=8,Qs=20,Xn=4,jl=({value:e,defaultValue:t,onChange:n,min:o=0,max:r=100,step:s=1,disabled:a=false,rounded:c=false,showValue:i=false,showStepper:l=false,label:u,fullWidth:d=false,css:y,trackCss:f,thumbCss:T,direction:I="horizontal",className:x,...R})=>{let g=V(),p=I==="vertical",m=useRef(null),[C,P]=useState(false),[w,v]=useState(false),[N,B]=useState(false),K=e!==void 0,O=useCallback(Z=>Math.min(r,Math.max(o,Z)),[o,r]),S=useCallback(Z=>O(Math.round((Z-o)/s)*s+o),[o,s,O]),[F,M]=useState(()=>S(t??o)),b=K?S(e):F;useEffect(()=>{K||M(Z=>S(Z));},[o,r,s,K,S]);let h=g.palette.primary[600],A=g.surface.panelBg,D=g.neutral[500],L=useMemo(()=>{let Z=r-o||1;return (b-o)/Z*100},[b,o,r]),k=useCallback(Z=>{K||M(Z),n?.(Z);},[K,n]),E=useCallback((Z,Ee)=>{let Q=m.current;if(!Q)return b;let ee=Q.getBoundingClientRect(),se=p?(ee.bottom-Ee)/ee.height:(Z-ee.left)/ee.width;return se=Math.max(0,Math.min(1,se)),S(o+se*(r-o))},[b,p,o,r,S]),W=useCallback(Z=>{a||(Z.currentTarget.setPointerCapture?.(Z.pointerId),k(E(Z.clientX,Z.clientY)),P(true));},[a,k,E]),$=useCallback(Z=>{a||(Z.currentTarget.setPointerCapture?.(Z.pointerId),P(true));},[a]),z=useCallback(Z=>{!C||a||k(E(Z.clientX,Z.clientY));},[C,a,k,E]),_=useCallback(()=>P(false),[]);useEffect(()=>{if(C)return window.addEventListener("pointermove",z),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_);}},[C,z,_]);let H=useCallback(Z=>{if(a)return;let Ee=b;if(Z.key==="ArrowRight"||Z.key==="ArrowUp")Ee=b+s;else if(Z.key==="ArrowLeft"||Z.key==="ArrowDown")Ee=b-s;else if(Z.key==="Home")Ee=o;else if(Z.key==="End")Ee=r;else return;Z.preventDefault(),k(S(Ee));},[a,b,s,o,r,k,S]),U=C||w||N,X=(w||C)&&!a,ae=`color-mix(in srgb, ${h} 25%, transparent)`,q=css({display:"flex",flexDirection:p?"row":"column",alignItems:"center",padding:p?"1rem":"1rem 0",width:p?"fit-content":d?"100%":350,height:p?250:"auto",boxSizing:"border-box"}),Y=css({marginBottom:p?0:4,marginRight:p?8:0,color:g.text.primary,userSelect:"none"}),le=css({position:"relative",width:p?Ar:"100%",height:p?"100%":Ar,backgroundColor:g.neutral[200],borderRadius:g.radius.xs,cursor:a?"not-allowed":"pointer",touchAction:"none",outline:"none",overflow:"visible"}),ie=css({position:"absolute",left:p?"50%":0,top:p?2:"50%",transform:p?"translateX(-50%)":"translateY(-50%)",width:p?Ar:`calc(100% - ${Xn*.5}px)`,height:p?`calc(100% - ${Xn*.5}px)`:Ar,display:"flex",flexDirection:p?"column":"row",justifyContent:"space-between",alignItems:"center",pointerEvents:"none",zIndex:0,padding:0}),be=css({width:Xn,height:Xn,borderRadius:"50%",backgroundColor:g.text.primary,opacity:.15,flex:"0 0 auto"}),Pe=css({position:"absolute",left:0,top:p?`calc(${100-L}% )`:0,bottom:0,width:p?"100%":`${L}%`,height:p?`${L}%`:"100%",backgroundColor:a?D:h,borderRadius:g.radius.sm,zIndex:1,transition:"none",pointerEvents:"none"}),Re=css({position:"absolute",appearance:"none",WebkitAppearance:"none",background:A,width:Qs,height:Qs,left:p?"50%":`calc(${L}% - ${Qs/2}px)`,bottom:p?`${L}%`:"auto",top:p?"auto":"50%",transform:p?"translate(-50%, 50%)":"translateY(-50%)",borderRadius:c?g.radius.full:`calc(${g.radius.md} * 0.75)`,border:`2px solid ${a?D:h}`,cursor:a?"not-allowed":"grab",zIndex:5,padding:0,lineHeight:0,transition:"box-shadow .16s ease",boxShadow:X?`0 0 0 ${C?4:8}px ${ae}`:`0 0 0 0px ${ae}`,"&:focus-visible":{boxShadow:`0 0 0 4px ${ae}`,outline:"none"}}),Ce=css({position:"relative",backgroundColor:"transparent",padding:"1rem",top:p?-7.5:-28,left:p?9:-7.5,pointerEvents:"none"}),Ie=css({position:"absolute",top:p?`calc(50% - ${Xn*2.5}px)`:0,left:p?"auto":`calc(50% - ${Xn*3}px)`,transform:p?"translateY(-50%)":"translateX(-50%)",backgroundColor:g.neutral[800],color:g.neutral[0],padding:"0.6rem 0.25rem",fontSize:12,borderRadius:6,whiteSpace:"nowrap",pointerEvents:"auto",zIndex:6,"&::after":{content:'""',position:"absolute",width:6,height:6,backgroundColor:g.neutral[800],borderRadius:2,bottom:p?"50%":-2,left:p?-2.5:"50%",transform:p?"translateY(50%) rotate(45deg)":"translateX(-50%) rotate(45deg)"}}),Te=y,we=f,he=T,je=Math.floor((r-o)/s)+1;return jsxs("div",{...R,role:"group","aria-label":u,className:["plainframe-ui-slider",x||""].join(" ").trim(),css:[q,Te],"data-orientation":p?"vertical":"horizontal",children:[u&&!p&&jsx("div",{className:"plainframe-ui-slider-label",css:Y,children:u}),jsxs("div",{ref:m,className:"plainframe-ui-slider-track",css:[le,we],onPointerDown:W,children:[l&&s>0&&jsx("div",{className:"plainframe-ui-slider-stepper",css:ie,children:Array.from({length:je}).map((Z,Ee)=>jsx("span",{className:"plainframe-ui-slider-step-dot",css:be},Ee))}),jsx("div",{className:"plainframe-ui-slider-fill",css:Pe}),jsxs("button",{type:"button",role:"slider","aria-valuemin":o,"aria-valuemax":r,"aria-valuenow":b,"aria-disabled":a||void 0,tabIndex:a?-1:0,onKeyDown:H,onPointerDown:$,onPointerUp:_,onPointerCancel:_,onMouseEnter:()=>v(true),onMouseLeave:()=>v(false),className:"plainframe-ui-slider-thumb",css:[Re,he],children:[jsx(AnimatePresence,{children:U&&jsx(motion.div,{className:"plainframe-ui-slider-tooltip-anchor",css:Ce,initial:{opacity:0,scale:.9,y:p?0:4,x:p?4:0},animate:{opacity:1,scale:1,y:0,x:0},exit:{opacity:0,scale:.9,y:p?0:4,x:p?4:0},transition:{duration:.16,ease:"easeOut"},children:jsx(motion.div,{className:"plainframe-ui-slider-tooltip",css:Ie,initial:{opacity:0,y:p?0:4,x:p?-4:0},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:p?0:4,x:p?-4:0},transition:{duration:.16,ease:"easeOut"},onMouseEnter:()=>B(true),onMouseLeave:()=>B(false),children:b})})}),null]})]}),u&&p&&jsx("div",{className:"plainframe-ui-slider-label",css:[Y,{marginLeft:8}],children:u})]})};jl.displayName="Slider";var Lf=e=>css({"--pf-ease":"cubic-bezier(.4,0,.2,1)",display:"flex",flexDirection:"column",maxWidth:e==null?"100%":typeof e=="number"?`${e}px`:e,width:"100%"}),Bf=css({display:"flex",alignItems:"center",width:"100%",gap:12}),$f=e=>css({display:"flex",minWidth:0,flex:"0 0 auto",alignItems:"center",justifyContent:"center",gap:8,flexDirection:e==="left"?"row-reverse":e==="right"?"row":e==="top"?"column-reverse":"column"}),zf=e=>css({position:"relative",flex:"1 1 24px",minWidth:6,height:2,borderRadius:1,background:e,overflow:"hidden"}),Of=(e,t,n)=>css({position:"absolute",inset:0,transformOrigin:"left center",transform:`scaleX(${e})`,background:t,transition:n?"all .28s var(--pf-ease)":"none",willChange:"transform"}),Wf=css({flex:"1 1 24px",minWidth:2,display:"flex",alignItems:"center",justifyContent:"center"}),Kf=(e,t,n,o,r)=>css({position:"relative",appearance:"none",border:`2px solid ${o}`,width:e,height:e,minWidth:e,minHeight:e,borderRadius:r,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",userSelect:"none",background:t,color:n,transition:"all .22s var(--pf-ease)","&:disabled, &[aria-disabled='true']":{opacity:.55,cursor:"not-allowed"}}),_f=css({fontWeight:700,fontSize:14,lineHeight:1,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis"}),Vl=e=>css({position:"absolute",inset:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transform:`scale(${e?1:.3})`,opacity:e?1:0,transition:"background .22s var(--pf-ease), transform .16s var(--pf-ease), opacity .16s var(--pf-ease)",willChange:"transform, opacity"}),jf=(e,t,n,o,r)=>css({fontSize:14,color:e?t:n,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",transition:"all .16s ease",textAlign:"center",fontWeight:700,margin:`0 ${r}px`,borderRadius:o}),Vf=me.memo(function({i:t,item:n,size:o,tokens:r,variant:s,titlePosition:a,isActive:c,completed:i,disabled:l,connectorColor:u,showConnector:d,animate:y,separator:f,canGoToIndex:T,setSelected:I}){let x=V(),R=xe(),{MAIN:g,ACTIVE_TEXT:p,ACTIVE_TEXT_OUTLINED:m,COMPLETE_BG:C,COMPLETE_FG:P,UPCOMING_BG_FILLED:w,UPCOMING_OUTLINE:v,UPCOMING_FG:N}=r,B="transparent",K=N,O=v;s==="subtle"?i?(B=C,K=P,O=C):c?(B=g,K=p,O=g):(B=w,K=N,O=w):i?(B=C,K=P,O=C):c?(B="transparent",K=m,O=g):(B="transparent",K=N,O=v);let S=n.label,F=n.icon??jsx("span",{css:_f,children:typeof S=="number"?S:t+1}),M=n.completedIcon??jsx(Check,{strokeWidth:3.25,size:16});return jsxs(Fragment,{children:[jsxs("div",{className:"plainframe-ui-step",css:$f(a),children:[jsxs("button",{className:"plainframe-ui-step-node",css:[Kf(o,B,K,O,String(x.radius.full)),!l&&R({color:c?"primary":"neutral"})],onClick:()=>{!l&&T(t)&&I(n.value);},tabIndex:l?-1:0,"aria-current":c?"step":void 0,"aria-disabled":l||void 0,disabled:l,"aria-label":typeof S=="string"?S:`Step ${t+1}`,children:[jsx("span",{className:"plainframe-ui-step-content",css:Vl(!i),children:F}),jsx("span",{className:"plainframe-ui-step-check",css:Vl(!!i),children:M})]}),S&&jsx("span",{className:"plainframe-ui-step-label",css:jf(i||c,x.text.primary,x.text.secondary,String(x.radius.xs),Number(x.spacing.xs)),children:S})]}),d&&(f?jsx("div",{className:"plainframe-ui-stepper-separator",css:Wf,children:f}):jsx("div",{className:"plainframe-ui-step-connector",css:zf(x.neutral[300]),children:jsx("div",{className:"plainframe-ui-step-connector-fill",css:Of(i?1:0,u,y),"aria-hidden":"true"})}))]})},(e,t)=>e.isActive===t.isActive&&e.completed===t.completed&&e.disabled===t.disabled&&e.variant===t.variant&&e.separator===t.separator&&e.connectorColor===t.connectorColor&&e.titlePosition===t.titlePosition&&e.size===t.size),na=()=>null;na.displayName="PlainframeUIStep";var Uf=({variant:e="subtle",value:t,defaultValue:n,onChange:o,disabled:r=false,allowForward:s=true,allComplete:a=false,color:c,activeBgColor:i,activeColor:l,completeBgColor:u,completeColor:d,separator:y,titlePosition:f="right",width:T,css:I,className:x,children:R,...g})=>{let p=V(),m=e==="outlined"?"outlined":"subtle",C=me.useMemo(()=>{let E=me.Children.toArray(R).filter(W=>me.isValidElement(W)&&W.type===na);return E.length?E.map((W,$)=>({index:$,...W.props})):[{value:1},{value:2},{value:3}]},[R]),P=me.useCallback((E,W)=>E?p.palette?.[E]??E:W,[p.palette]),w=me.useMemo(()=>({MAIN:String(P(i,typeof p.palette.primary[600]=="string"?p.palette.primary[600]:"")),ACTIVE_TEXT:String(P(l,typeof p.text.onColors?.primary=="string"?p.text.onColors?.primary:"")),ACTIVE_TEXT_OUTLINED:String(P(l,typeof p.text.primary=="string"?p.text.primary:"")),COMPLETE_BG:String(P(u,typeof p.palette.primary[600]=="string"?p.palette.primary[600]:"")),COMPLETE_FG:String(P(d,typeof p.text.onColors?.primary=="string"?p.text.onColors?.primary:"")),UPCOMING_BG_FILLED:String(typeof p.neutral[100]=="string"?p.neutral[100]:""),UPCOMING_OUTLINE:String(typeof p.neutral[300]=="string"?p.neutral[300]:""),UPCOMING_FG:String(typeof p.text.secondary=="string"?p.text.secondary:"")}),[P,i,l,u,d,p.palette.primary,p.neutral,p.text]),v=me.useMemo(()=>{let E=P(c,p.palette.primary[600]);return typeof E=="string"?E:String(E)},[P,c,p.palette.primary]),[N,B]=me.useState(()=>C.some(W=>W?.value===n)?n:C[0]?.value),K=t!==void 0,O=K?t:N,{activeIndex:S,afterLast:F}=me.useMemo(()=>{let E=C.findIndex(W=>W.value===O);if(E!==-1)return {activeIndex:E,afterLast:false};if(typeof O=="number"){let W=Math.floor(O)-1;if(W>=C.length)return {activeIndex:C.length-1,afterLast:true};if(W>=0)return {activeIndex:W,afterLast:false}}return {activeIndex:0,afterLast:false}},[C,O]),M=me.useCallback(E=>{r||(K||B(E),o?.(E));},[r,K,o]),b=me.useCallback(E=>a||!!C[E]?.complete||(F?true:E<S),[a,C,F,S]),h=me.useCallback(E=>{if(r)return false;let W=C[E];if(!W||W.disabled)return false;if(typeof s=="boolean"){if(s===false&&E>S)return false}else if(typeof s=="function"&&!s(S,E))return false;return true},[r,C,s,S]),[A,D]=me.useState(false);me.useEffect(()=>{let E=requestAnimationFrame(()=>D(true));return ()=>cancelAnimationFrame(E)},[]);let L=me.useCallback(E=>{if(!C.length||r)return;let W=S;if(E.key==="ArrowRight")W=Math.min(C.length-1,S+1);else if(E.key==="ArrowLeft")W=Math.max(0,S-1);else if(E.key==="Home")W=0;else if(E.key==="End")W=C.length-1;else return;E.preventDefault(),h(W)&&M(C[W].value);},[C,r,S,h,M]),k=34;return jsx("div",{tabIndex:-1,className:["plainframe-ui-stepper",x||""].join(" ").trim(),css:[Lf(T),I],...g,children:jsx("div",{tabIndex:-1,className:"plainframe-ui-stepper-track",role:"list",onKeyDown:L,css:Bf,children:C.map((E,W)=>jsx(me.Fragment,{children:jsx(Vf,{i:W,item:E,size:k,tokens:w,variant:m,titlePosition:f,isActive:!F&&W===S,completed:b(W),disabled:r||!!E.disabled,connectorColor:v,showConnector:W<C.length-1,animate:A,separator:y,canGoToIndex:h,setSelected:M})},String(E.value??W)))})})};var Nr=()=>null;Nr.displayName="PF.Tab";var Dr=()=>null;Dr.displayName="PF.TabContent";function Gf(e){let t=e.props;return {type:t?.__EMOTION_TYPE_PLEASE_DO_NOT_USE__??e.type,props:t}}var Xf=({children:e,defaultValue:t,value:n,onChange:o,variant:r="subtle",direction:s="horizontal",className:a,shadow:c=false,width:i,fullWidth:l=false,rounded:u=false,titlePosition:d="right",align:y,css:f,trackCss:T,thumbCss:I,activeTabCss:x,activeIndicatorCss:R})=>{let g=V(),p=xe(),m=s==="vertical",C=l||i!=null,P=y??(m?"left":"center"),w={left:"flex-start",center:"center",right:"flex-end"},{tabs:v,contents:N}=me.useMemo(()=>{let Q=[],ee=[];return me.Children.forEach(e,se=>{if(!me.isValidElement(se))return;let{type:pe,props:Se}=Gf(se),Ne=pe===Nr||pe?.displayName===Nr.displayName,J=pe===Dr||pe?.displayName===Dr.displayName;if(Ne){let oe=Se;if(oe?.value===void 0)return;Q.push({value:oe.value,disabled:oe.disabled,node:oe.children,className:oe.className,css:oe.css,activeCss:oe.activeCss});}else if(J){let oe=Se;if(oe?.value===void 0)return;ee.push({value:oe.value,node:oe.children,className:oe.className,css:oe.css});}}),{tabs:Q,contents:ee}},[e]),B=me.useMemo(()=>v.find(Q=>!Q.disabled)?.value,[v]),[K,O]=me.useState(()=>t!==void 0&&v.some(ee=>ee.value===t&&!ee.disabled)?t:B),S=n!==void 0,F=S?n:K,M=me.useRef(null),b=me.useRef([]),h=Math.max(0,v.findIndex(Q=>Q.value===F)),[A,D]=me.useState({left:0,top:0,width:0,height:0}),[L,k]=me.useState(false),[E,W]=me.useState(false),$=me.useCallback(()=>{let Q=M.current,ee=b.current[h];if(!Q||!ee)return;let se=Q.getBoundingClientRect(),pe=ee.getBoundingClientRect();D({left:pe.left-se.left,top:pe.top-se.top,width:pe.width,height:pe.height});},[h]);me.useLayoutEffect(()=>{$(),L||(k(true),requestAnimationFrame(()=>W(true)));},[$,L]),me.useEffect(()=>{let Q=new ResizeObserver(()=>$());M.current&&Q.observe(M.current);let ee=b.current[h];ee&&Q.observe(ee);let se=()=>$();return window.addEventListener("resize",se),()=>{Q.disconnect(),window.removeEventListener("resize",se);}},[$,h]);let z=(Q,ee)=>{if(!v.length)return Q;let se=Q;for(let pe=0;pe<v.length;pe++)if(se=(se+ee+v.length)%v.length,!v[se].disabled)return se;return Q},_=Q=>{S||O(Q),o?.(Q);},H=Q=>{if(!v.length)return;let ee=h;if(Q.key===(m?"ArrowDown":"ArrowRight"))ee=z(h,1);else if(Q.key===(m?"ArrowUp":"ArrowLeft"))ee=z(h,-1);else if(Q.key==="Home")ee=v.findIndex(pe=>!pe.disabled);else if(Q.key==="End"){let pe=[...v].reverse().findIndex(Se=>!Se.disabled);ee=pe===-1?h:v.length-1-pe;}else return;Q.preventDefault();let se=v[ee]?.value;se!==void 0&&_(se),requestAnimationFrame(()=>b.current[ee]?.focus());},U=g.text.primary,X=g.text.secondary,ae=g.neutral[500],q=r==="subtle"?g.surface.subtleBg:"transparent",Y=r==="subtle"?g.surface.panelBg??g.surface.panelBg:r==="ghost"?g.surface.subtleBg:"transparent",le=g.text.primary,ie=r==="subtle"||r==="ghost"||r==="underlined",be=css({"--pf-ease":"cubic-bezier(.4,0,.2,1)",display:"flex",flexDirection:"column",width:l?"100%":i==null?"auto":typeof i=="number"?`${i}px`:i}),Pe=r==="subtle",Re=css({position:"relative",display:C?"flex":"inline-flex",width:C?"100%":"auto",flexDirection:m?"column":"row",alignItems:m?"stretch":"center",flexWrap:"nowrap",gap:g.spacing.xs,padding:Pe?g.spacing.xs:0,background:q,borderRadius:r==="subtle"?u?m?g.radius.lg:g.radius.full:g.radius.lg:"none"}),Ce=css({position:"absolute",zIndex:0,pointerEvents:"none",opacity:L?1:0,visibility:L?"visible":"hidden",transition:E?`${m?"top":"left"} .24s var(--pf-ease), ${m?"height":"width"} .24s var(--pf-ease), background-color .18s var(--pf-ease)`:"none",borderRadius:r==="subtle"||r==="ghost"?u?g.radius.full:g.radius.md:0,background:r==="underlined"?"transparent":Y,...m?{top:`${A.top}px`,height:`${A.height}px`,left:g.spacing.xs,right:g.spacing.xs}:{left:`${A.left}px`,width:`${A.width}px`,top:g.spacing.xs,bottom:g.spacing.xs},boxShadow:c&&r==="subtle"?"0 1px 3px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.04)":"none"}),Ie=css(r!=="underlined"?{}:m?{background:"transparent",top:`${A.top}px`,height:`${A.height}px`,left:0,width:0,borderLeft:`2px solid ${le}`,borderBottom:"none",borderRadius:2}:{background:"transparent",left:`${A.left}px`,width:`${A.width}px`,bottom:0,top:"auto",height:0,borderBottom:`2px solid ${le}`,borderLeft:"none",borderRadius:2}),Te=css({position:"relative",zIndex:1,border:"none",background:"transparent",padding:r==="underlined"&&s!=="vertical"?`${g.spacing.md}`:r==="ghost"&&s!=="vertical"?`${g.spacing.md}`:`${g.spacing.xs} ${g.spacing.md}`,borderRadius:(r==="subtle"||r==="ghost")&&u?g.radius.full:g.radius.md,minHeight:g.componentHeights.sm,outline:"none",transition:"color .16s ease !important",display:"flex",alignItems:"center",justifyContent:"center",...m?{width:C?"100%":"auto",flex:"0 0 auto",textAlign:P}:C?{flex:"1 1 0",minWidth:0,textAlign:"center"}:{flex:"0 0 auto",minWidth:"max-content",textAlign:"center"},whiteSpace:"nowrap",boxSizing:"border-box",cursor:"pointer",userSelect:"none",fontSize:g.typography.sizes.sm,fontWeight:600,color:X,"&[aria-selected='true']":{color:U},"&:hover":{color:U},"&[aria-disabled='true'], &:disabled":{opacity:.55,cursor:"not-allowed",color:ae}}),we=css({display:"inline-flex",alignItems:"center",justifyContent:m?w[P]:"center",gap:6,width:"100%",flexDirection:d==="top"?"column-reverse":d==="bottom"?"column":d==="left"?"row-reverse":"row"}),he=css({marginTop:g.spacing.sm,width:"100%"}),je=me.useId(),Z=new Map;N.forEach((Q,ee)=>Z.set(Q.value,`${je}-panel-${ee}`));let Ee=Q=>`${je}-tab-${Q}`;return jsxs("div",{className:["plainframe-ui-tabs",a||""].join(" ").trim(),css:[be,f],children:[jsxs("div",{className:"plainframe-ui-tabs-track",ref:M,role:"tablist","aria-orientation":m?"vertical":"horizontal",onKeyDown:H,css:[Re,T],children:[ie&&jsx("div",{className:"plainframe-ui-tabs-thumb",css:[Ce,Ie,I,R]}),v.map((Q,ee)=>{let se=F===Q.value;return jsx("button",{ref:pe=>{b.current[ee]=pe;},role:"tab",id:Ee(ee),"aria-selected":se,"aria-controls":Z.get(Q.value),"aria-disabled":Q.disabled||void 0,disabled:Q.disabled,tabIndex:Q.disabled?-1:ee===h?0:-1,className:["plainframe-ui-tab",Q.className||""].join(" ").trim(),onClick:()=>{Q.disabled||_(Q.value);},css:[Te,!Q.disabled&&p(),Q.css,se?Q.activeCss??x:void 0],children:jsx("span",{className:"plainframe-ui-tab-content",css:we,children:Q.node})},String(Q.value??ee))})]}),N.map((Q,ee)=>{let se=Q.value===F;if(!se)return null;let pe=v.findIndex(Ne=>Ne.value===Q.value),Se=pe>=0?Ee(pe):void 0;return console.log("rendering panel for",Q.value,"active:",se),jsx("div",{role:"tabpanel",id:Z.get(Q.value),"aria-labelledby":Se,className:["plainframe-ui-tab-panel",Q.className||""].join(" ").trim(),css:[he,Q.css],children:Q.node},ee)})]})};var Po=e=>e==null?void 0:typeof e=="number"?`${e}px`:e,kn=e=>e==null?[]:Array.isArray(e)?e:[e],No=(...e)=>css(e.filter(Boolean)),tg=({label:e,value:t,defaultValue:n="",onChange:o,placeholder:r,error:s,helperText:a,disabled:c=false,fullWidth:i=false,width:l=235,size:u="md",variant:d="subtle",rounded:y=false,rows:f=3,maxRows:T,maxLength:I,showCharCount:x,focusRingMode:R="always",resizable:g=false,className:p,wrapperCss:m,inputCss:C,labelCss:P,helperRowCss:w,helperTextCss:v,charCountCss:N,css:B,onBlur:K,onFocus:O,onKeyDown:S,autoFocus:F,name:M,id:b,tabIndex:h,autoComplete:A,readOnly:D,required:L})=>{let k=V(),E=Yo(),W=useId(),$=useMemo(()=>({sm:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.sm,labelFont:k.typography.sizes.xs,helperFont:k.typography.sizes.xs,width:"12.5rem",paddingY:0,paddingX:k.spacing.md},md:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.md,labelFont:k.typography.sizes.sm,helperFont:k.typography.sizes.xs,width:"15rem",paddingY:0,paddingX:k.spacing.md},lg:{fontSize:k.typography.sizes.sm,minHeight:k.componentHeights.lg,labelFont:k.typography.sizes.md,helperFont:k.typography.sizes.sm,width:"18.125rem",paddingY:0,paddingX:k.spacing.md}}),[k]),z=["sm","md","lg"].includes(u)?u:"md",_=$[z],H=k.neutral,U=k.text,X=t!==void 0,[ae,q]=useState(n),Y=X?t:ae,le=useCallback(se=>{X||q(se),o?.(se);},[X,o]),ie=useMemo(()=>c?H[200]:s&&d==="outlined"?k.palette.danger?.[50]??k.surface.panelBg:s&&d==="subtle"?k.palette.danger?.[50]??k.surface.subtleBg:d==="outlined"?k.surface.panelBg:d==="subtle"?k.surface.subtleBg:"transparent",[c,s,d,H,k.surface,k.palette.danger]),be=k.componentHeights.border,Pe=useMemo(()=>d==="outlined"?`${be} solid ${s?k.palette.danger?.[300]??k.surface.border:k.surface.border}`:"none",[d,be,s,k.palette.danger,k.surface.border]),Re=useMemo(()=>css({boxSizing:"border-box",display:"block",minWidth:0,width:"100%",maxWidth:i?"100%":l!=null?Po(l):void 0,flex:"0 0 auto",fontWeight:500}),[i,l]),Ce=useMemo(()=>No({fontSize:_.labelFont,fontWeight:500,color:s?k.palette.danger?.[700]??U.primary:c?H[500]:U.primary,marginBottom:4,display:"inline-block"},...kn(P)),[_.labelFont,s,c,H,U,k.palette.danger,P]),Ie=useMemo(()=>[{display:"flex",alignItems:"stretch",gap:k.spacing.sm,padding:`${Po(_.paddingY)} 0 ${Po(_.paddingY)} ${Po(_.paddingX)}`,background:ie,border:Pe,borderRadius:y?k.radius.full:k.radius.md,minHeight:_.minHeight,width:"100%",cursor:c?"not-allowed":"text",opacity:c?.65:1,transition:"box-shadow .18s, border-color .16s"},...kn(m),...kn(B)],[k,_,ie,Pe,be,y,c,m,B]),Te=typeof _.minHeight=="number"?`${_.minHeight}px`:_.minHeight,we=useMemo(()=>No({width:"100%",minWidth:0,flex:1,resize:g?"vertical":"none",font:"inherit",fontWeight:500,fontSize:_.fontSize,lineHeight:1.5,color:c?H[500]:s?k.palette.danger?.[800]??U.primary:U.primary,background:"transparent",border:"none",outline:"none",padding:0,paddingRight:Po(_.paddingX),overflowY:"auto",minHeight:Te,"&::placeholder":{color:s?k.palette.danger?.[700]??U.secondary:U.secondary},"&:-webkit-autofill,&:-webkit-autofill:hover,&:-webkit-autofill:focus":{WebkitTextFillColor:`${s?k.palette.danger?.[800]??U.primary:U.primary} !important`,boxShadow:`0 0 0 1000px ${ie} inset !important`,transition:"opacity 99999s ease-out",caretColor:s?k.palette.danger?.[800]??U.primary:U.primary},":focus-within":{outline:"none",boxShadow:"none"},...f===1?{paddingBlock:`calc((${Te} - 1.5em) / 2)`}:{paddingBlock:"clamp(4px, 0.5em, 12px)"}},...kn(C)),[g,_,c,s,H,U,k.palette.danger,Te,ie,f,C]),he=useMemo(()=>No({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,paddingTop:3},...kn(w)),[w]),je=useMemo(()=>No({fontSize:_.helperFont,color:s?k.palette.danger?.[700]??U.secondary:U.secondary,flex:1,minWidth:0},...kn(v)),[_.helperFont,s,k.palette.danger,U,v]),Z=useMemo(()=>No({fontSize:_.helperFont,color:I&&Y.length>I?k.palette.danger?.[700]??U.secondary:U.secondary,flexShrink:0},...kn(N)),[_.helperFont,I,Y.length,k.palette.danger,U,N]),Ee=useRef(null);useLayoutEffect(()=>{if(typeof window>"u")return;let se=Ee.current;if(!se)return;if(g){let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),J=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),J);se.style.setProperty("--pf-minh",`${oe}px`);return}(()=>{let Se=window.getComputedStyle(se),Ne=parseFloat(Se.lineHeight||"20"),J=typeof _.minHeight=="number"?_.minHeight:parseFloat(String(_.minHeight)),oe=Math.max(Ne*(f??1),J);se.style.setProperty("--pf-minh",`${oe}px`);let re=T?Ne*T:1/0;se.style.height="auto",se.style.height=`${Math.min(se.scrollHeight,re)}px`;})();},[Y,f,T,_.minHeight,g]);let Q=a!=null||x?`${b??W}-help`:void 0,ee=b??W;return jsxs("div",{className:["plainframe-ui-textarea",p||""].join(" ").trim(),css:Re,children:[e&&jsx("label",{htmlFor:ee,className:"plainframe-ui-textarea-label",css:Ce,children:e}),jsx("div",{className:"plainframe-ui-textarea-surface",css:[E({enabled:R!=="none",disabled:c,color:s?"danger":void 0}),Ie],"aria-invalid":!!s||void 0,"aria-disabled":c||void 0,onClick:()=>!c&&Ee.current?.focus(),children:jsx("textarea",{ref:Ee,id:ee,className:"plainframe-ui-textarea-input",css:we,rows:f,value:Y,onChange:se=>{let pe=se.target.value;I&&pe.length>I||le(pe);},placeholder:r||"",disabled:c,onBlur:K,onFocus:O,onKeyDown:S,autoFocus:F,name:M,tabIndex:h,autoComplete:A,readOnly:D,required:L,"aria-invalid":!!s||void 0,"aria-describedby":Q})}),(a!=null||x&&I!=null)&&jsxs("div",{className:"plainframe-ui-textarea-helper-row",css:he,children:[jsx("span",{id:Q,className:"plainframe-ui-textarea-helper-text",css:je,children:a}),x&&I!=null&&jsxs("span",{className:"plainframe-ui-textarea-char-count",css:Z,children:[Y.length,"/",I]})]})]})};var cg=Vo,ug={type:"spring",stiffness:920,damping:100},Gl="__toast_root__",dg=(e,t)=>t.split(".").reduce((n,o)=>n!=null&&typeof n=="object"?n[o]:void 0,e),Lr=(e,t)=>{for(let n of t){let o=dg(e,n);if(o!=null&&o!=="")return o}},ra=(e,t)=>e==null?`${t}px`:typeof e=="number"?`${e}px`:String(e);function pg(e){let t=Lr(e,["radius.md","shape.borderRadius","radii.md"]),n=Lr(e,["spacing.lg","space.4","spacing.4"]),o=Lr(e,["spacing.md","space.3","spacing.3"]),r=Lr(e,["shadows.lg","elevation.lg"])??"0 8px 24px rgba(0,0,0,.03), 0 2px 8px rgba(0,0,0,.05)";return {radius:ra(t,16),padX:ra(n,14),padY:ra(o,12),shadow:String(r)}}var mg=pg(cg),Wt=null,Yn=null,ye={max:5,position:"bottom-right",gutter:5,zIndex:1e3,duration:5e3,showDismiss:"hover",styles:{},renderer:void 0,bareRenderer:false};function Jl(){typeof document>"u"||(Wt||(Wt=document.getElementById("toast-host"),Wt||(Wt=document.createElement("div"),Wt.id="toast-host",document.body.appendChild(Wt))),Yn||(Yn=Wt[Gl]??null,Yn||(Yn=createRoot(Wt),Wt[Gl]=Yn,Yn.render(jsx(Na,{children:jsx(wg,{})})))));}var te={displayed:[],queue:[],entering:{},exiting:{},enterFrom:{},timers:new Map,expiry:new Map,remaining:new Map,paused:new Set,listeners:new Set,snapshot:{displayed:[],entering:{},exiting:{},enterFrom:{}},subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)},notify(){this.listeners.forEach(e=>e());},sync(){this.snapshot={displayed:[...this.displayed],entering:{...this.entering},exiting:{...this.exiting},enterFrom:{...this.enterFrom}};}},In=()=>{te.sync(),te.notify();},fg=()=>typeof crypto<"u"&&"randomUUID"in crypto&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2);function Br(e,t){if(t===null)return;let n=t??e.duration;if(n==null||te.timers.has(e.id))return;let o=Date.now(),r=te.remaining.get(e.id),s=r!=null?Math.max(0,r):n;te.expiry.set(e.id,o+s);let a=window.setTimeout(()=>Be.dismiss(e.id),s);te.timers.set(e.id,a);}function $r(e){let t=te.timers.get(e);t&&(clearTimeout(t),te.timers.delete(e));}function gg(){let e=false;for(;te.displayed.length<ye.max&&te.queue.length;){let t=te.queue.shift();te.displayed=[t,...te.displayed],te.enterFrom[t.id]="head",te.entering[t.id]=true,e=true,requestAnimationFrame(()=>{delete te.entering[t.id],In();}),Br(t);}e&&In();}function bg(){if(te.displayed.length<ye.max)return;let e=te.displayed.filter(o=>!te.exiting[o.id]);if(!e.length)return;let t=e.reduce((o,r)=>o.createdAt<=r.createdAt?o:r),n=te.expiry.get(t.id);n!=null&&te.remaining.set(t.id,Math.max(0,n-Date.now())),$r(t.id),te.exiting[t.id]=true,te.displayed=te.displayed.filter(o=>o.id!==t.id),delete te.enterFrom[t.id],te.queue.push(t),In();}var hg=e=>e==="danger"?"error":["default","success","error","warning","info"].includes(e)?e:"default";function yg(e,t){let n=hg(t),o=e,r=o.surface,s=o.text,a=r?.panelBg??"#fff",c=s?.primary??"#111",i=r?.border;if(n==="default"||n==="info")return {bg:a,fg:c,border:i};let l=s?.onColors??{},u=(d,y,f)=>{let T=o.colors,I=o.palette;return {bg:T?.[d]??I?.[d]?.[700]??y,fg:l?.[d]??f,border:"transparent"}};return n==="success"?u("success","#22C55E","#fff"):n==="warning"?u("warning","#F59E0B","#fff"):n==="error"?u("error","#EF4444","#fff"):{bg:a,fg:c,border:i}}var Be=Object.assign((e,t)=>{Jl();let n=i=>i!=null&&typeof i[Symbol.iterator]=="function",o=i=>!!i&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function",r;typeof e=="object"&&e!=null&&!me.isValidElement(e)&&!n(e)&&!o(e)?r=e:r={content:(me.isValidElement(e),e),...t||{}},r.content==null&&(r.title!=null||r.description!=null)&&(r.content=jsxs("div",{children:[r.title&&jsx("strong",{style:{display:"block",marginBottom:2},children:r.title}),r.description]}));let s=r.id??fg(),a=i=>{let l=i.findIndex(y=>y.id===s);if(l===-1)return false;let u=i[l],d={...u,status:r.status??u.status,content:r.content??u.content,title:r.title??u.title,description:r.description??u.description,startIcon:r.startIcon??u.startIcon,endIcon:r.endIcon??u.endIcon,action:r.action??u.action,onClose:r.onClose??u.onClose,duration:r.duration===void 0?u.duration:r.duration,pauseOnHover:r.pauseOnHover??u.pauseOnHover,showDismiss:r.showDismiss??u.showDismiss,render:r.render??u.render,bare:r.bare??u.bare,onClick:r.onClick??u.onClick,width:r.width??u.width};return i[l]=d,$r(s),te.remaining.delete(s),te.paused.has(s)||Br(d),In(),true};if(a(te.displayed)||a(te.queue))return s;let c={id:s,status:r.status??"default",content:r.content,title:r.title,description:r.description,startIcon:r.startIcon,endIcon:r.endIcon,action:r.action,duration:r.duration===void 0?ye.duration:r.duration,onClose:r.onClose,createdAt:Date.now(),pauseOnHover:r.pauseOnHover??true,showDismiss:r.showDismiss,render:r.render,bare:r.bare,onClick:r.onClick,width:r.width??300};return te.displayed.length>=ye.max&&bg(),te.displayed=[...te.displayed,c],te.enterFrom[c.id]="tail",te.entering[c.id]=true,requestAnimationFrame(()=>{delete te.entering[c.id],In();}),In(),Br(c),s},{success:(e,t={})=>Be(e,{...t,status:"success"}),error:(e,t={})=>Be(e,{...t,status:"error"}),warning:(e,t={})=>Be(e,{...t,status:"warning"}),info:(e,t={})=>Be(e,{...t,status:"info"}),custom:(e,t={})=>Be(e,{...t}),update:(e,t)=>Be({id:e,...t}),dismiss:e=>{if(!e){let n=te.displayed.find(o=>!te.exiting[o.id])?.id;n&&Be.dismiss(n);return}$r(e),te.remaining.delete(e),te.paused.delete(e),te.exiting[e]=true;let t=te.displayed.find(n=>n.id===e);te.displayed=te.displayed.filter(n=>n.id!==e),delete te.enterFrom[e],In(),window.setTimeout(()=>t?.onClose?.(),120),gg();},clear:()=>{[...te.displayed.map(t=>t.id)].forEach(t=>Be.dismiss(t));},pause:e=>{if(te.paused.has(e))return;let t=te.expiry.get(e);t!=null&&te.remaining.set(e,Math.max(0,t-Date.now())),te.paused.add(e),$r(e);},resume:e=>{if(!te.paused.has(e))return;te.paused.delete(e);let t=te.displayed.find(o=>o.id===e)??te.queue.find(o=>o.id===e),n=te.remaining.get(e);t&&Br(t,n??void 0),te.remaining.delete(e);},pauseLatest:()=>{let e=te.displayed.at(-1);e&&Be.pause(e.id);},resumeLatest:()=>{let e=te.displayed.at(-1);e&&Be.resume(e.id);},promise:(e,t,n={})=>{let o=Be(t.loading,{...n,status:"info",duration:null});return e.then(r=>{Be.update(o,{status:"success",content:t.success(r),duration:n.duration??2500});}).catch(r=>{Be.update(o,{status:"error",content:t.error(r),duration:n.duration??3e3});}),e},config:e=>{e.max!=null&&(ye.max=e.max),e.position&&(ye.position=e.position),e.gutter!=null&&(ye.gutter=e.gutter),e.zIndex!=null&&(ye.zIndex=e.zIndex),e.duration!==void 0&&(ye.duration=e.duration),e.showDismiss&&(ye.showDismiss=e.showDismiss),e.styles&&(ye.styles={...ye.styles,...e.styles}),e.renderer!==void 0&&(ye.renderer=e.renderer),e.bareRenderer!==void 0&&(ye.bareRenderer=e.bareRenderer);}});function xg(e){return typeof e=="string"?e:e===true?"always":e===false?"never":ye.showDismiss}function vg(e){return {"top-left":{top:16,left:16,alignItems:"flex-start"},"top-center":{top:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"top-right":{top:16,right:16,alignItems:"flex-end"},"bottom-left":{bottom:16,left:16,alignItems:"flex-start"},"bottom-center":{bottom:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"bottom-right":{bottom:16,right:16,alignItems:"flex-end"}}[e]}var Cg=css({display:"flex",alignItems:"flex-start",gap:10}),Xl=css({flex:"0 0 auto",paddingTop:1,lineHeight:0,marginLeft:-3,"& svg, & img, & canvas, & video":{display:"block"}}),Rg=css({fontSize:14,lineHeight:1.4,fontWeight:500,flex:1,minWidth:0}),Tg=css({display:"flex",alignItems:"center",gap:6,marginRight:-2}),wg=me.memo(function(){let t=useSyncExternalStore(te.subscribe.bind(te),()=>te.snapshot,()=>te.snapshot),n=V(),o=ye.position.startsWith("bottom"),r=me.useMemo(()=>o?t.displayed:[...t.displayed].reverse(),[t.displayed,o]),s=me.useMemo(()=>({position:"fixed",zIndex:ye.zIndex,pointerEvents:"none",width:"100%",display:"flex",flexDirection:"column",...vg(ye.position),...ye.styles.stack??{}}),[]);return jsx("div",{className:"plainframe-ui-toast-stack",css:css(s),children:jsx(AnimatePresence,{initial:false,children:r.map((a,c)=>{let i=t.enterFrom[a.id]||"tail",l=o?i==="head"?-16:16:i==="head"?16:-16,u=c>0?ye.gutter:0,d={toast:a,close:Be.dismiss,pause:Be.pause,resume:Be.resume},{bg:y,fg:f,border:T}=yg(n,a.status),I={position:"relative",overflow:"hidden",borderRadius:n.radius.md,boxShadow:mg.shadow,padding:`${n.spacing.md} calc(${n.spacing.lg} + 30px) ${n.spacing.md} ${n.spacing.lg}`,display:"grid",gridTemplateColumns:"1fr auto",gap:10,background:y,color:f,cursor:a.onClick?"pointer":"default",border:T?`1px solid ${T}`:"1px solid transparent"},x=typeof ye.styles.surface=="function"?ye.styles.surface(a):ye.styles.surface??{},R=xg(a.showDismiss),g={},p="& .plainframe-ui-toast-close",m="&:hover .plainframe-ui-toast-close";R==="hover"?(g[p]={opacity:0,pointerEvents:"none"},g[m]={opacity:1,pointerEvents:"auto"}):R==="always"?g[p]={opacity:1,pointerEvents:"auto"}:R==="never"&&(g[p]={display:"none"});let C=css({...I,...x,...g}),P=css({position:"absolute",top:8,right:8,appearance:"none",border:0,background:"transparent",color:f,width:28,height:28,borderRadius:8,cursor:"pointer",lineHeight:1,transition:"opacity .12s ease",display:"grid",placeItems:"center",...ye.styles.close??{}}),w;if(a.bare&&a.render){let v=typeof a.render=="function"?a.render(d):a.render;w=jsx("div",{style:{pointerEvents:"auto"},onClick:N=>a.onClick?.(a.id,N),children:v});}else if(ye.bareRenderer&&ye.renderer){let v=typeof ye.renderer=="function"?ye.renderer(d):ye.renderer;w=jsx("div",{style:{pointerEvents:"auto"},onClick:N=>a.onClick?.(a.id,N),children:v});}else {let v;ye.renderer?v=typeof ye.renderer=="function"?ye.renderer(d):ye.renderer:a.render&&!a.bare?v=typeof a.render=="function"?a.render(d):a.render:v=jsxs(Fragment,{children:[jsxs("div",{css:Cg,children:[a.startIcon&&jsx("div",{css:Xl,children:a.startIcon}),jsx("div",{css:Rg,children:a.content}),a.endIcon&&jsx("div",{css:Xl,children:a.endIcon})]}),a.action&&jsx("div",{css:Tg,children:a.action})]}),w=jsxs("div",{css:C,onClick:N=>a.onClick?.(a.id,N),children:[v,jsx("button",{className:"plainframe-ui-toast-close","aria-label":"Close",css:P,onClick:N=>{N.stopPropagation(),Be.dismiss(a.id);},children:jsx(X,{strokeWidth:2.5,size:14})})]});}return jsx(Eg,{id:a.id,isBottom:o,mt:u,enterY:l,width:a.width,pauseOnHover:a.pauseOnHover!==false,children:w},a.id)})})})}),Eg=me.memo(function(t){let{id:n,isBottom:o,mt:r,enterY:s,width:a,pauseOnHover:c,children:i}=t,l=useAnimationControls();useEffect(()=>{l.start({opacity:1,y:0,height:"auto",x:0,transition:ug});},[l]);let u={pointerEvents:"auto",willChange:"transform, opacity, height, margin, scale, width, max-width",marginTop:r,width:"100%",maxWidth:a!=null?typeof a=="number"?`${a}px`:a:"none",...ye.styles.item??{}};return jsx(motion.div,{layout:"position",className:"plainframe-ui-toast-item",css:css(u),initial:{opacity:0,y:s,height:"auto",x:0},animate:l,exit:{opacity:0,y:o?6:-6,height:0,marginTop:0,transition:{type:"tween",ease:"easeInOut",duration:.14}},drag:"x",dragElastic:.2,dragMomentum:true,whileDrag:{scale:.98,opacity:.95},onDragEnd:(d,y)=>{let f=Math.abs(y.offset.x),T=Math.abs(y.velocity.x);if(!(f>60||T>600)){l.start({x:0,opacity:1,transition:{type:"spring",stiffness:700,damping:40}});return}let R=(y.offset.x!==0?Math.sign(y.offset.x):Math.sign(y.velocity.x||1))*(window.innerWidth+160),g=typeof y.velocity.x=="number"?y.velocity.x/10:0;l.start({x:R,opacity:.9,transition:{type:"spring",stiffness:280,damping:24,velocity:g}}).then(()=>Be.dismiss(n));},onMouseEnter:c?()=>Be.pause(n):void 0,onMouseLeave:c?()=>Be.resume(n):void 0,children:i})}),Yl=false;(function(){Yl||(Yl=true,Jl());})();var Gg=(...e)=>t=>{for(let n of e)if(n)if(typeof n=="function")n(t);else try{n.current=t;}catch{}},ec=createContext(null),tc=()=>{let e=useContext(ec);if(!e)throw new Error("TooltipTrigger/TooltipContent must be inside <Tooltip>.");return e},Xg=({children:e,placement:t="top",open:n,defaultOpen:o=false,onOpenChange:r,delay:s=80,arrow:a=true,autoWidth:c=false,disableHoverListener:i=false})=>{let[l,u]=useState(!!o),d=n??l,y=w=>{n===void 0&&u(w),r?.(w);},f=useRef(null),T=useFloating({placement:t,open:d,onOpenChange:y,whileElementsMounted:autoUpdate,strategy:"fixed",transform:false,middleware:[offset(8),flip({padding:8}),shift({padding:8}),a?arrow({element:f,padding:4}):void 0].filter(Boolean)}),I=useHover(T.context,{enabled:!i,delay:{open:s,close:60},handleClose:safePolygon(),restMs:20}),x=useFocus(T.context),R=useDismiss(T.context,{escapeKey:true,outsidePress:true}),g=useRole(T.context,{role:"tooltip"}),{getReferenceProps:p,getFloatingProps:m}=useInteractions([I,x,R,g]),C=useId(),P=useMemo(()=>({open:d,setOpen:y,id:C,placement:T.placement,autoWidth:c,allowArrow:!!a,refs:T.refs,floatingStyles:T.floatingStyles,middlewareData:T.middlewareData,getReferenceProps:p,getFloatingProps:m,arrowRef:f}),[d,c,a,T.placement,T.refs,T.floatingStyles,T.middlewareData,p,m]);return jsx(ec.Provider,{value:P,children:e})},Yg=({asChild:e=true,children:t,className:n,css:o})=>{let{refs:r,getReferenceProps:s,id:a}=tc(),c=me.isValidElement(t),i=c&&typeof t.type=="string";if(e&&c&&i){let l=t,u="ref"in l?l.ref:void 0,d=s({...l.props,"aria-describedby":a,ref:Gg(u,r.setReference),className:[l.props?.className||"",n||""].join(" ").trim()||void 0}),y=[l.props?.css||void 0,o].filter(Boolean);return me.cloneElement(l,{...d,css:y})}return jsx("span",{ref:r.setReference,className:n,css:o,style:{display:"inline-flex"},...s({"aria-describedby":a}),children:t})},Jg=({children:e,className:t,css:n,arrowCss:o})=>{let {open:r,refs:s,floatingStyles:a,middlewareData:c,getFloatingProps:i,placement:l,id:u,autoWidth:d,allowArrow:y,arrowRef:f}=tc(),T=V(),I=l.split("-")[0]||"top",R=I==="bottom"?{opacity:0,y:-8,scale:.98}:I==="top"?{opacity:0,y:8,scale:.98}:I==="left"?{opacity:0,x:8,scale:.98}:{opacity:0,x:-8,scale:.98},g=R,p=I==="bottom"?"center top":I==="top"?"center bottom":I==="left"?"right center":"left center",m=css({zIndex:1300,backgroundColor:T.neutral[900],color:T.neutral[0],borderRadius:8,padding:"6px 9px",fontSize:12,fontWeight:500,lineHeight:1.25,maxWidth:260,whiteSpace:d?"nowrap":"normal",boxShadow:"0 10px 30px rgba(0,0,0,.18)",pointerEvents:"auto",transformOrigin:p}),C=css({position:"absolute",width:10,height:10,borderRadius:2,backgroundColor:T.neutral[900],transform:"rotate(45deg)",pointerEvents:"none"}),P=c.arrow,w={top:"bottom",bottom:"top",left:"right",right:"left"}[I];return jsx(FloatingPortal,{children:jsx(AnimatePresence,{children:r&&jsxs(motion.div,{id:u,ref:s.setFloating,role:"tooltip","data-state":"open",className:["plainframe-ui-tooltip",t||""].join(" ").trim(),css:[m,n],style:a,initial:R,animate:{opacity:1,x:0,y:0,scale:1},exit:g,transition:{scale:{type:"spring",stiffness:520,damping:36,mass:.6},x:{type:"spring",stiffness:420,damping:32,mass:.6},y:{type:"spring",stiffness:420,damping:32,mass:.6},opacity:{duration:.14,ease:"linear"}},...i(),children:[e,y&&jsx("div",{ref:f,className:"plainframe-ui-tooltip-arrow",css:[C,o],style:{left:P?.x!=null?`${P.x}px`:void 0,top:P?.y!=null?`${P.y}px`:void 0,[w]:"-3px"}})]})})})};function tb(){let e=V();return jsx(Global,{styles:css`
21
21
  *,*::before,*::after{box-sizing:border-box}
22
22
 
23
23
  body{