import{e as h,r as b,c as g,j as u}from"./index-DjCrtoJM.js";import{s as j}from"./Plus-DrYyBDmj.js";import{s as v}from"./Trash01-BW2v6vxa.js";const A=700;function _(r,e,o){const t=h.c(6),s=A,[n,c]=b.useState(r),i=b.useRef(null);let l;t[0]!==s||t[1]!==e?(l=f=>{c(f),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>e(f),s)},t[0]=s,t[1]=e,t[2]=l):l=t[2];const d=l;let a;return t[3]!==n||t[4]!==d?(a=[n,d],t[3]=n,t[4]=d,t[5]=a):a=t[5],a}function k(r){const e=h.c(14),{value:o,onChange:t,placeholder:s,className:n,onFocus:c,onBlur:i,onKeyDown:l,spellCheck:d,inputRef:a}=r,f=d===void 0?!0:d;let p;e[0]!==t?(p=y=>t(y.target.value),e[0]=t,e[1]=p):p=e[1];let m;e[2]!==n?(m=g("w-full resize-none border-0 bg-transparent p-0 outline-none [field-sizing:content] placeholder:text-muted-foreground/50 focus:ring-0",n),e[2]=n,e[3]=m):m=e[3];let x;return e[4]!==a||e[5]!==i||e[6]!==c||e[7]!==l||e[8]!==s||e[9]!==f||e[10]!==p||e[11]!==m||e[12]!==o?(x=u.jsx("textarea",{ref:a,value:o,onChange:p,onInput:T,onFocus:c,onBlur:i,onKeyDown:l,placeholder:s,spellCheck:f,rows:1,className:m}),e[4]=a,e[5]=i,e[6]=c,e[7]=l,e[8]=s,e[9]=f,e[10]=p,e[11]=m,e[12]=o,e[13]=x):x=e[13],x}function T(r){const e=r.currentTarget;e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function R(r){return typeof r=="string"?r:""}function z(r){const e=h.c(5),{label:o,onClick:t,disabled:s}=r;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx(j,{size:13}),e[0]=n):n=e[0];let c;return e[1]!==s||e[2]!==o||e[3]!==t?(c=u.jsxs("button",{type:"button",onClick:t,disabled:s,className:"flex items-center gap-1.5 rounded-md border border-dashed px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:border-foreground/30 hover:text-foreground disabled:opacity-40 disabled:hover:border-dashed disabled:hover:text-muted-foreground cursor-pointer",children:[n,o]}),e[1]=s,e[2]=o,e[3]=t,e[4]=c):c=e[4],c}function D(r){const e=h.c(4),{label:o,onClick:t}=r;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=u.jsx(v,{size:13}),e[0]=s):s=e[0];let n;return e[1]!==o||e[2]!==t?(n=u.jsx("button",{type:"button","aria-label":o,onClick:t,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition-opacity hover:text-destructive group-hover/item:opacity-100 cursor-pointer",children:s}),e[1]=o,e[2]=t,e[3]=n):n=e[3],n}function E(r){const e=h.c(2),{children:o}=r;let t;return e[0]!==o?(t=u.jsx("div",{className:"absolute -top-9 left-0 z-10 flex items-center gap-0.5 rounded-md border bg-popover p-0.5 shadow-md",children:o}),e[0]=o,e[1]=t):t=e[1],t}function S(r){const e=h.c(8),{active:o,label:t,onClick:s,children:n}=r,c=o?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let i;e[0]!==c?(i=g("flex h-7 min-w-7 items-center justify-center rounded px-1.5 text-sm transition-colors cursor-pointer",c),e[0]=c,e[1]=i):i=e[1];let l;return e[2]!==o||e[3]!==n||e[4]!==t||e[5]!==s||e[6]!==i?(l=u.jsx("button",{type:"button","aria-label":t,"aria-pressed":o,onMouseDown:$,onClick:s,className:i,children:n}),e[2]=o,e[3]=n,e[4]=t,e[5]=s,e[6]=i,e[7]=l):l=e[7],l}function $(r){return r.preventDefault()}function B(r){if(Array.isArray(r))return r;if(typeof r!="string"||r.trim()==="")return[];try{const e=JSON.parse(r);return Array.isArray(e)?e:[]}catch{return[]}}export{z as A,E as F,k as I,D as R,S as T,B as p,R as s,_ as u};
