import{r as n,z as s,E as e}from"./vendor-s2rfM_Vj.js";import{t as i}from"./apis-DdFSvwR4.js";import{N as a}from"./constant-Dkm_Y9q1.js";import{c as o}from"./newtab-BWIjnu6l.js";import{I as c,B as t}from"./t-r-vendor-gn7FMrPE.js";import"./index-Bf7N7lFc.js";const m=e("div")({name:"WrapUI",class:"w1luatrm",propsAsIs:!1}),r=e("h1")({name:"TitleUI",class:"tb77zq3",propsAsIs:!1}),l=e("div")({name:"InputUI",class:"iy99bmd",propsAsIs:!1}),p=e("div")({name:"IconListUI",class:"i1sf2j4p",propsAsIs:!1}),d=e("div")({name:"IconItemUI",class:"i12v0fj7",propsAsIs:!1,vars:{"i12v0fj7-0":[({active:n})=>n?"var(--theme-white2)":"transparent"]}}),h=e("div")({name:"BottomUI",class:"baek5n",propsAsIs:!1}),j=[{icon:"tool",name:"工具"},{icon:"game",name:"游戏"},{icon:"friend",name:"社交"},{icon:"code",name:"技术"},{icon:"ui",name:"设计"},{icon:"idea",name:"产品"},{icon:"fish",name:"摸鱼"},{icon:"tech",name:"科技"},{icon:"news1",name:"新闻"},{icon:"shop",name:"购物"},{icon:"music",name:"音乐"},{icon:"finance",name:"财经"},{icon:"read",name:"阅读"},{icon:"sport",name:"运动"},{icon:"all",name:"应用"}],I=({type:e,item:I})=>{const v="edit"===e,[f,g]=n.useState("more"===I.iconClass?"":I.name),[x,u]=n.useState("more"===I.iconClass?"":I.iconClass),{navigationInfo:C,setNavigationInfo:A}=o(),U=Boolean(!f.length||!x.length||!v&&C.length>=10);return s.jsxs(m,{children:[s.jsxs(r,{children:[v?"编辑":"新增","分组"," ",v?"":`(${C.length}/10)`]}),s.jsx(l,{children:s.jsx(c,{placeholder:"请输入内容",value:f,onChange:n=>{g(n)},onEnter:n=>{console.log(n)}})}),s.jsx(p,{children:j.map((n=>s.jsxs(d,{active:n.icon===x?1:0,onClick:()=>(n=>{u(n.icon),g(n.name)})(n),children:[s.jsx("i",{className:`ovo ${n.icon}`}),s.jsx("p",{children:n.name})]},n.icon)))}),s.jsxs(h,{children:[v&&s.jsx(t,{style:{marginRight:4,fontSize:12},theme:"danger",onClick:()=>{A(C.filter((n=>n.id!==I.id)))},children:"删除分组"}),s.jsx(t,{disabled:U,onClick:()=>{A(v?C.map((n=>n.id===I.id?{...n,name:f,iconClass:x}:n)):[...C.slice(0,C.length-1),{name:f,iconClass:x,apps:[],type:a.custom,id:i()},...C.slice(C.length-1)])},children:v?"编辑":"添加"})]})]})};export{I as default};
