adminizer 4.3.0-build.119 → 4.3.0-build.121

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.
package/assets/app.js CHANGED
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./add-group-D5MrUNE1.js","./app-layout-BmMzULcJ.js","./app-shell-C8Cnr5Hy.js","./monaco-ICtx6xoc.js","./vendor-wzZzN_Jv.js","./jsoneditor-D95dIAP2.js","./handsontable-PVakPtJV.js","./app-sidebar-HwvXNZzk.js","./nav-main-BqKm87JZ.js","./material-icon-DwkE6wKL.js","./app-sidebar-header-RRnKZeeU.js","./breadcrumbs-DSMzNYiS.js","./nav-user-DuCZNsZX.js","./user-info-BGQvqBmO.js","./user-menu-content-BDm88xaM.js","./theme-switcher-cgyA7_cO.js","./icon-DpkedrXG.js","./add-group-form-DMz0_Oo9.js","./add-user-iCupTmGS.js","./add-user-form-izlXhv2-.js","./input-error-CmXZF6xy.js","./add-184PjeSO.js","./add-form-By91jsv1.js","./field-renderer-CiCkOwxl.js","./dynamic-controls-BOYmRX_z.js","./field-renderer-CRNLShJD.css","./catalog-DXyw2KnJ.js","./del-modal-DyIWFflP.js","./catalog-C71LuRag.css","./dashboard-C_EdlZvv.js","./dashboard-BOltB2Hq.css","./form-CTDP9qtV.js","./form--0esJdCP.js","./home-CsjT3Uxk.js","./init-user-DaOvt0vG.js","./list-DhrnZd-J.js","./list-table-BPpHDVPf.js","./pagination-render-io0M2m2O.js","./login-DR6fvKtm.js","./module-C0dPDXsj.js","./notification-BwG5Ug4o.js","./tabs-BhkFoerH.js","./register-hJD1ETdf.js","./welcome-BwoI5hJ3.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./add-group-D5MrUNE1.js","./app-layout-BmMzULcJ.js","./app-shell-C8Cnr5Hy.js","./monaco-ICtx6xoc.js","./vendor-wzZzN_Jv.js","./jsoneditor-D95dIAP2.js","./handsontable-PVakPtJV.js","./app-sidebar-HwvXNZzk.js","./nav-main-BqKm87JZ.js","./material-icon-DwkE6wKL.js","./app-sidebar-header-RRnKZeeU.js","./breadcrumbs-DSMzNYiS.js","./nav-user-DuCZNsZX.js","./user-info-BGQvqBmO.js","./user-menu-content-BDm88xaM.js","./theme-switcher-cgyA7_cO.js","./icon-DpkedrXG.js","./add-group-form-DMz0_Oo9.js","./add-user-iCupTmGS.js","./add-user-form-izlXhv2-.js","./input-error-CmXZF6xy.js","./add-184PjeSO.js","./add-form-By91jsv1.js","./field-renderer-CiCkOwxl.js","./dynamic-controls-BOYmRX_z.js","./field-renderer-CRNLShJD.css","./catalog-CJ5JpPUx.js","./del-modal-DyIWFflP.js","./catalog-C71LuRag.css","./dashboard-C_EdlZvv.js","./dashboard-BOltB2Hq.css","./form-CTDP9qtV.js","./form--0esJdCP.js","./home-CsjT3Uxk.js","./init-user-DaOvt0vG.js","./list-DhrnZd-J.js","./list-table-BPpHDVPf.js","./pagination-render-io0M2m2O.js","./login-DR6fvKtm.js","./module-C0dPDXsj.js","./notification-BwG5Ug4o.js","./tabs-BhkFoerH.js","./register-hJD1ETdf.js","./welcome-BwoI5hJ3.js"])))=>i.map(i=>d[i]);
2
2
  import{g as Ju,s as ai,c as xd,i as kV,h as wQ,e as _Q,f as SQ,t as CQ,_ as fn}from"./jsoneditor-D95dIAP2.js";import{b as LQ,c as VP,r as vV,a as NQ}from"./vendor-wzZzN_Jv.js";import{r as g,e as ve,R as gV,F as IQ}from"./monaco-ICtx6xoc.js";import{r as IA,R as qD,F as sa,a as la,b as da,c as ua,d as ha,e as pa,f as fa,g as ya,h as ma,i as ka,j as va,k as ga,l as Ma,m as xa,n as ba,o as wa,p as _a,q as Sa,s as Ca,t as La,u as Na,v as Ia,w as Aa,x as Ea,y as Ta,z as Ra,A as ja,B as Da,C as qa,D as za,E as $a,G as Oa,H as Pa,I as Ha,J as Ba,K as Va,L as Fa,M as Ua,N as Ga,O as Za,P as Wa,Q as Xa,S as Ka,T as Ya,U as Qa,V as Ja,W as eo,X as to,Y as no,Z as ao,_ as oo,$ as ro,a0 as io,a1 as co,a2 as so,a3 as lo,a4 as uo,a5 as ho,a6 as po,a7 as fo,a8 as yo,a9 as mo,aa as ko,ab as vo,ac as go,ad as Mo,ae as xo,af as bo,ag as wo,ah as _o,ai as So,aj as Co,ak as Ed,al as Td,am as Rd,an as AQ,ao as EQ,ap as TQ,aq as RQ,ar as jQ,as as DQ,at as qQ,au as zQ}from"./handsontable-PVakPtJV.js";var MR={exports:{}},$u={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -8062,4 +8062,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
8062
8062
  * Last updated: Mar 09, 2023
8063
8063
  *
8064
8064
  * Description: Definition file for Chinese - China language-country.
8065
- */const yqe={languageCode:"zh-CN",[Co]:"上方插入行",[So]:"下方插入行",[_o]:"左方插入列",[wo]:"右方插入列",[bo]:["移除该行","移除多行"],[xo]:["移除该列","移除多列"],[Mo]:"撤销",[go]:"恢复",[vo]:"只读",[ko]:"清空该列",[mo]:"对齐",[yo]:"左对齐",[fo]:"水平居中",[po]:"右对齐",[ho]:"两端对齐",[uo]:"顶端对齐",[lo]:"垂直居中",[so]:"底端对齐",[co]:"冻结该列",[io]:"取消冻结",[ro]:"边框",[oo]:"上",[ao]:"右",[no]:"下",[to]:"左",[eo]:"移除边框",[Ja]:"插入批注",[Qa]:"编辑批注",[Ya]:"删除批注",[Ka]:"只读批注",[Xa]:"合并",[Wa]:"取消合并",[Za]:"复制",[Rd]:"带标题的复制",[Td]:"带标题组的复制",[Ed]:"仅复制标题",[Ga]:"剪切",[Ua]:"插入子行",[Fa]:"与母行分离",[Va]:["隐藏该列","隐藏多列"],[Ba]:["显示该列","显示多列"],[Ha]:["隐藏该行","隐藏多行"],[Pa]:["显示该行","显示多行"],[Oa]:"无",[$a]:"为空",[za]:"不为空",[qa]:"等于",[Da]:"不等于",[ja]:"开头是",[Ra]:"结尾是",[Ta]:"包含",[Ea]:"不包含",[Aa]:"大于",[Ia]:"大于或等于",[Na]:"小于",[La]:"小于或等于",[Ca]:"在此范围",[Sa]:"不在此范围",[_a]:"之后",[wa]:"之前",[ba]:"今天",[xa]:"明天",[Ma]:"昨天",[ga]:"空白单元格",[va]:"按条件过滤",[ka]:"按值过滤",[ma]:"且",[ya]:"或",[fa]:"全选",[pa]:"清除",[ha]:"确认",[ua]:"取消",[da]:"搜索",[la]:"值",[sa]:"第二值"};RQ();const yV={de:rqe,en:qQ,es:iqe,fr:cqe,it:sqe,ja:lqe,ko:dqe,nl:uqe,pl:hqe,pt:pqe,ru:fqe,zh:yqe},mqe=document.documentElement.lang,hK=yV[mqe]??yV.en;jQ(hK);const pK=({config:e,data:n=[],onChange:o,disabled:r})=>{const{appearance:c}=iz(),[d,u]=g.useState("ht-theme-main"),h=g.useCallback((k,m)=>{var x,b;if(m==="loadData")return;const y=(b=(x=f.current)==null?void 0:x.hotInstance)==null?void 0:b.getSourceData();o(y)},[]),f=g.useRef(null);return g.useEffect(()=>{const k=setTimeout(()=>{var m;(m=f.current)!=null&&m.hotInstance&&f.current.hotInstance.loadData(n)},100);return()=>clearTimeout(k)},[n]),g.useEffect(()=>{u(c==="dark"?"ht-theme-main-dark":"ht-theme-main")},[c]),M.jsx(DQ,{className:r?"pointer-events-none opacity-50":"",themeName:d,language:hK.languageCode,ref:f,...e,afterChange:h,children:e.columns.map(k=>M.jsx(zQ,{data:k.data,...k},k.data))})},eze=Object.freeze(Object.defineProperty({__proto__:null,default:pK},Symbol.toStringTag,{value:"Module"})),kqe=()=>{const[e,n]=g.useState({width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768});return g.useEffect(()=>{if(typeof window>"u")return;const o=()=>{n({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e},fK=({onChange:e,value:n,options:o,disabled:r})=>{const{appearance:c}=iz(),[d,u]=g.useState("light"),h=g.useRef(null),f=g.useRef(null),{width:k}=kqe(),m=k<768,y=k>=768&&k<1024,x=_=>{e(_)},b=_=>{h.current=_,w()},w=()=>{var C;if(!h.current)return;const _={minimap:{enabled:!m},fontSize:m?12:y?13:14,lineNumbers:m?"off":"on",lineDecorationsWidth:m?5:10,scrollBeyondLastLine:!m,wordWrap:m?"on":"bounded",renderWhitespace:m?"none":"selection",padding:{top:m?8:16,bottom:m?8:16}};h.current.updateOptions(_),(C=f.current)==null||C.classList.add("overflow-hidden"),setTimeout(()=>{var N,A;(N=h.current)==null||N.layout(),(A=f.current)==null||A.classList.remove("overflow-hidden")},100)};g.useEffect(()=>{u(c==="dark"?"vs-dark":"light")},[c]),g.useEffect(()=>{w()},[k]);const S=m?"300px":y?"400px":"500px";return M.jsx("div",{className:`border rounded-lg ${m?"p-1":"p-2"}`,ref:f,children:M.jsx(IQ,{height:S,language:o.language,value:n,theme:d,options:{automaticLayout:!0,...m&&{wordWrap:"on"},minimap:{enabled:!m}},onChange:x,onMount:b,className:`transition-all duration-200 ease-in-out ${r?"pointer-events-none opacity-50 cursor-not-allowed":""}`})})},tze=Object.freeze(Object.defineProperty({__proto__:null,default:fK},Symbol.toStringTag,{value:"Module"})),mV=$A("m-1 flex items-center border rounded-sm px-1",{variants:{variant:{default:"border-foreground/10 text-foreground bg-card hover:bg-card/80",secondary:"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",inverted:"inverted"}},defaultVariants:{variant:"default"}}),cz=g.forwardRef(({options:e,onValueChange:n,variant:o,processing:r,disabled:c,defaultValue:d=[],placeholder:u="",notFound:h="",search:f="",animation:k=0,maxCount:m=3,modalPopover:y=!1,asChild:x=!1,className:b,mode:w="multiple",...S},_)=>{const[C,N]=g.useState(d),[A,T]=g.useState(!1),[q,$]=g.useState(!1),z=V=>{if(V.key==="Enter")T(!0);else if(V.key==="Backspace"&&!V.currentTarget.value){const se=[...C];se.pop(),N(se),n(se)}},P=V=>{let se;w==="single"?se=C.includes(V)?[]:[V]:se=C.includes(V)?C.filter(le=>le!==V):[...C,V],N(se),n(se),w==="single"&&T(!1)},ae=()=>{N([]),n([])},re=()=>{T(V=>!V)},he=()=>{const V=C.slice(0,m);N(V),n(V)};return M.jsxs(FW,{open:A,onOpenChange:T,modal:y,children:[M.jsx(UW,{asChild:!0,children:M.jsx(OA,{ref:_,...S,onClick:re,disabled:c,className:K("flex w-full p-1 rounded-md border-input border-1 min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto",b),children:C.length>0?M.jsxs("div",{className:"flex justify-between items-center w-full",children:[M.jsxs("div",{className:"flex flex-wrap items-center",children:[C.slice(0,m).map(V=>{const se=e.find(ye=>ye.value===V),le=se==null?void 0:se.icon;return M.jsxs("div",{className:K(q?"animate-bounce":"",mV({variant:o})),style:{animationDuration:`${k}s`},children:[le&&M.jsx(le,{className:"h-4 w-4 mr-2"}),se==null?void 0:se.label,M.jsx(Mr,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:ye=>{ye.stopPropagation(),r||P(V)}})]},V)}),w==="multiple"&&C.length>m&&M.jsxs("div",{className:K("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",q?"animate-bounce":"",mV({variant:o})),style:{animationDuration:`${k}s`},children:[`+ ${C.length-m} more`,M.jsx(Mr,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:V=>{V.stopPropagation(),he()}})]})]}),M.jsxs("div",{className:"flex items-center justify-between",children:[C.length>0&&M.jsxs(M.Fragment,{children:[M.jsx(ri,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:V=>{V.stopPropagation(),ae()}}),M.jsx(tz,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),M.jsx(oi,{className:"h-4 mx-2 cursor-pointer text-muted-foreground"})]})]}):M.jsxs("div",{className:"flex items-center justify-between w-full mx-auto",children:[M.jsx("span",{className:"text-sm text-muted-foreground mx-3",children:u}),M.jsx(oi,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),M.jsx(GW,{className:"w-auto p-0 z-[410]",align:"start",onEscapeKeyDown:()=>T(!1),children:M.jsxs(mq,{children:[M.jsx(vG,{placeholder:f,onKeyDown:z}),M.jsxs(gG,{children:[M.jsx(MG,{children:h}),M.jsx(xG,{children:e.map(V=>{const se=C.includes(V.value);return M.jsxs(wG,{onSelect:()=>P(V.value),className:"cursor-pointer",children:[M.jsx("div",{className:K("mr-2 flex h-5 w-5 items-center justify-center rounded border border-primary",se?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:M.jsx(Uo,{className:"h-4 w-4 text-primary-foreground"})}),V.icon&&M.jsx(V.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),M.jsx("span",{children:V.label})]},V.value)})}),M.jsx(bG,{})]})]})}),k>0&&C.length>0&&w==="multiple"&&M.jsx(ti,{className:K("cursor-pointer my-2 text-foreground bg-background w-3 h-3",q?"":"text-muted-foreground"),onClick:()=>$(!q)})]})});cz.displayName="MultiSelect";const nze=Object.freeze(Object.defineProperty({__proto__:null,default:cz},Symbol.toStringTag,{value:"Module"}));function vqe(){window.UIComponents??(window.UIComponents={}),window.JSComponents??(window.JSComponents={}),Object.assign(window.UIComponents,{Avatar:xae,AvatarImage:bae,AvatarFallback:wae,Badge:Sae,Breadcrumb:L9e,BreadcrumbList:N9e,BreadcrumbItem:I9e,BreadcrumbLink:A9e,BreadcrumbPage:E9e,BreadcrumbSeparator:T9e,BreadcrumbEllipsis:R9e,Button:OA,Calendar:MSe,Card:xSe,CardHeader:bSe,CardFooter:LSe,CardTitle:wSe,CardAction:SSe,CardDescription:_Se,CardContent:CSe,Checkbox:$Se,Collapsible:USe,CollapsibleTrigger:GSe,CollapsibleContent:ZSe,Command:mq,CommandDialog:TLe,CommandInput:vG,CommandList:gG,CommandEmpty:MG,CommandGroup:xG,CommandItem:wG,CommandShortcut:RLe,CommandSeparator:bG,ContextMenu:dAe,ContextMenuTrigger:uAe,ContextMenuContent:vAe,ContextMenuItem:gAe,ContextMenuCheckboxItem:MAe,ContextMenuRadioItem:xAe,ContextMenuLabel:bAe,ContextMenuSeparator:wAe,ContextMenuShortcut:_Ae,ContextMenuGroup:hAe,ContextMenuPortal:pAe,ContextMenuSub:fAe,ContextMenuSubContent:kAe,ContextMenuSubTrigger:mAe,ContextMenuRadioGroup:yAe,Dialog:uG,DialogClose:ALe,DialogContent:fG,DialogDescription:kG,DialogFooter:ELe,DialogHeader:yG,DialogOverlay:pG,DialogPortal:hG,DialogTitle:mG,DialogTrigger:ILe,DialogStack:VZ,DialogStackTrigger:SAe,DialogStackOverlay:CAe,DialogStackBody:LAe,DialogStackContent:NAe,DialogStackTitle:IAe,DialogStackDescription:AAe,DialogStackHeader:EAe,DialogStackFooter:TAe,DialogStackNext:RAe,DialogStackPrevious:jAe,DropdownMenu:dEe,DropdownMenuPortal:uEe,DropdownMenuTrigger:hEe,DropdownMenuContent:pEe,DropdownMenuGroup:fEe,DropdownMenuLabel:gEe,DropdownMenuItem:yEe,DropdownMenuCheckboxItem:mEe,DropdownMenuRadioGroup:kEe,DropdownMenuRadioItem:vEe,DropdownMenuSeparator:MEe,DropdownMenuShortcut:xEe,DropdownMenuSub:bEe,DropdownMenuSubTrigger:wEe,DropdownMenuSubContent:_Ee,Input:lW,Label:LEe,Menubar:cTe,MenubarPortal:TW,MenubarMenu:sTe,MenubarTrigger:uTe,MenubarContent:hTe,MenubarGroup:lTe,MenubarSeparator:kTe,MenubarLabel:mTe,MenubarItem:pTe,MenubarShortcut:vTe,MenubarCheckboxItem:fTe,MenubarRadioGroup:dTe,MenubarRadioItem:yTe,MenubarSub:gTe,MenubarSubTrigger:MTe,MenubarSubContent:xTe,Pagination:bTe,PaginationContent:wTe,PaginationLink:Qq,PaginationItem:_Te,PaginationPrevious:STe,PaginationNext:CTe,PaginationEllipsis:LTe,Popover:FW,PopoverTrigger:UW,PopoverContent:GW,PopoverAnchor:BTe,Select:CRe,SelectContent:ARe,SelectGroup:LRe,SelectItem:TRe,SelectLabel:ERe,SelectScrollDownButton:SX,SelectScrollUpButton:_X,SelectSeparator:RRe,SelectTrigger:IRe,SelectValue:NRe,Separator:tz,Sheet:LX,SheetTrigger:$Re,SheetClose:ORe,SheetContent:NX,SheetHeader:IX,SheetFooter:BRe,SheetTitle:AX,SheetDescription:EX,Sidebar:vje,SidebarContent:Cje,SidebarFooter:_je,SidebarGroup:Lje,SidebarGroupAction:Ije,SidebarGroupContent:Aje,SidebarGroupLabel:Nje,SidebarHeader:wje,SidebarInput:bje,SidebarInset:xje,SidebarMenu:Eje,SidebarMenuAction:Dje,SidebarMenuBadge:qje,SidebarMenuButton:jje,SidebarMenuItem:Tje,SidebarMenuSkeleton:zje,SidebarMenuSub:$je,SidebarMenuSubButton:Pje,SidebarMenuSubItem:Oje,SidebarProvider:kje,SidebarRail:Mje,SidebarSeparator:Sje,SidebarTrigger:gje,useSidebar:A2,Skeleton:ND,Slider:iDe,Toaster:$De,Switch:UDe,Table:GDe,TableHeader:ZDe,TableBody:WDe,TableFooter:XDe,TableHead:YDe,TableRow:KDe,TableCell:QDe,TableCaption:JDe,Textarea:eqe,Tooltip:HX,TooltipTrigger:BX,TooltipContent:VX,TooltipProvider:oz,VanillaJSONEditor:DD}),Object.assign(window.JSComponents,{VanillaJSONEditor:DD,HandsonTable:pK,MonacoEditor:fK,MultiSelect:cz})}const{createInertiaApp:gqe}=LF;window.React=ve;window.ReactDOM=qD;window.InertiajsReact=LF;window.LucideReact=C9e;vqe();async function Mqe(e,n){for(const o of Array.isArray(e)?e:[e]){const r=n[o];if(!(typeof r>"u"))return typeof r=="function"?r():r}throw new Error(`Page not found: ${e}`)}gqe({title:e=>`${e}`,resolve:e=>Mqe(`./pages/${e}.tsx`,Object.assign({"./pages/add-group.tsx":()=>fn(()=>import("./add-group-D5MrUNE1.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url),"./pages/add-user.tsx":()=>fn(()=>import("./add-user-iCupTmGS.js"),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,19,20]),import.meta.url),"./pages/add.tsx":()=>fn(()=>import("./add-184PjeSO.js"),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,22,23,24,25,20]),import.meta.url),"./pages/catalog.tsx":()=>fn(()=>import("./catalog-DXyw2KnJ.js"),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,27,22,23,24,25,20,28]),import.meta.url),"./pages/dashboard.tsx":()=>fn(()=>import("./dashboard-C_EdlZvv.js"),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,30]),import.meta.url),"./pages/form.tsx":()=>fn(()=>import("./form-CTDP9qtV.js"),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,32,22,23,24,25,20]),import.meta.url),"./pages/home.tsx":()=>fn(()=>import("./home-CsjT3Uxk.js"),__vite__mapDeps([33,5,4,3,6]),import.meta.url),"./pages/init-user.tsx":()=>fn(()=>import("./init-user-DaOvt0vG.js"),__vite__mapDeps([34,3,4,20,5,6]),import.meta.url),"./pages/list.tsx":()=>fn(()=>import("./list-DhrnZd-J.js"),__vite__mapDeps([35,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,36,27,37]),import.meta.url),"./pages/login.tsx":()=>fn(()=>import("./login-DR6fvKtm.js"),__vite__mapDeps([38,16,5,4,3,6,20]),import.meta.url),"./pages/module.tsx":()=>fn(()=>import("./module-C0dPDXsj.js"),__vite__mapDeps([39,3,4,1,2,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url),"./pages/notification.tsx":()=>fn(()=>import("./notification-BwG5Ug4o.js"),__vite__mapDeps([40,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,41]),import.meta.url),"./pages/register.tsx":()=>fn(()=>import("./register-hJD1ETdf.js"),__vite__mapDeps([42,3,4,20,5,6]),import.meta.url),"./pages/welcome.tsx":()=>fn(()=>import("./welcome-BwoI5hJ3.js"),__vite__mapDeps([43,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url)})),setup({el:e,App:n,props:o}){xne.createRoot(e).render(M.jsx(n,{...o}))},progress:{color:"#0f4898"}});export{En as $,gAe as A,OA as B,Go as C,VZ as D,R5 as E,xSe as F,bSe as G,wSe as H,lW as I,LSe as J,oz as K,Cs as L,HX as M,BX as N,VX as O,tw as P,UDe as Q,SAe as R,CRe as S,$De as T,IAe as U,dne as V,hne as W,xF as X,Xqe as Y,iI as Z,K as _,E5 as a,wU as a$,Tx as a0,Ip as a1,GDe as a2,ZDe as a3,KDe as a4,YDe as a5,WDe as a6,QDe as a7,Ji as a8,uG as a9,KG as aA,YG as aB,ge as aC,xn as aD,sb as aE,O8 as aF,kje as aG,dEe as aH,Ff as aI,yEe as aJ,MEe as aK,gje as aL,vje as aM,wje as aN,Eje as aO,Tje as aP,cTe as aQ,sTe as aR,uTe as aS,jje as aT,w4 as aU,hTe as aV,gTe as aW,MTe as aX,xTe as aY,pTe as aZ,Lje as a_,fG as aa,yG as ab,mG as ac,xje as ad,kqe as ae,iz as af,T7 as ag,f8 as ah,Bw as ai,Uo as aj,mN as ak,nl as al,ri as am,ELe as an,ALe as ao,Op as ap,xp as aq,Sp as ar,ILe as as,ys as at,v2 as au,ln as av,Jt as aw,bt as ax,be as ay,aE as az,LEe as b,GSe as b0,CU as b1,$je as b2,Oje as b3,Pje as b4,Cje as b5,_je as b6,L9e as b7,N9e as b8,I9e as b9,cz as bA,iDe as bB,eqe as bC,Gqe as bD,Rp as bE,Yu as bF,H1 as bG,Xw as bH,bTe as bI,wTe as bJ,_Te as bK,Qq as bL,STe as bM,CTe as bN,Jqe as bO,eze as bP,tze as bQ,nze as bR,E9e as ba,A9e as bb,T9e as bc,FW as bd,UW as be,Il as bf,jm as bg,GW as bh,MSe as bi,Nje as bj,Aje as bk,USe as bl,ZSe as bm,A2 as bn,VRe as bo,WC as bp,Zx as bq,KC as br,xae as bs,bae as bt,wae as bu,gEe as bv,i7 as bw,Qqe as bx,Yqe as by,Kqe as bz,IRe as c,NRe as d,ARe as e,TRe as f,$Se as g,Nt as h,CAe as i,M as j,LAe as k,NAe as l,ND as m,b9 as n,ff as o,UZ as p,hEe as q,CF as r,Ki as s,Wqe as t,gF as u,pEe as v,fEe as w,dAe as x,uAe as y,vAe as z};
8065
+ */const yqe={languageCode:"zh-CN",[Co]:"上方插入行",[So]:"下方插入行",[_o]:"左方插入列",[wo]:"右方插入列",[bo]:["移除该行","移除多行"],[xo]:["移除该列","移除多列"],[Mo]:"撤销",[go]:"恢复",[vo]:"只读",[ko]:"清空该列",[mo]:"对齐",[yo]:"左对齐",[fo]:"水平居中",[po]:"右对齐",[ho]:"两端对齐",[uo]:"顶端对齐",[lo]:"垂直居中",[so]:"底端对齐",[co]:"冻结该列",[io]:"取消冻结",[ro]:"边框",[oo]:"上",[ao]:"右",[no]:"下",[to]:"左",[eo]:"移除边框",[Ja]:"插入批注",[Qa]:"编辑批注",[Ya]:"删除批注",[Ka]:"只读批注",[Xa]:"合并",[Wa]:"取消合并",[Za]:"复制",[Rd]:"带标题的复制",[Td]:"带标题组的复制",[Ed]:"仅复制标题",[Ga]:"剪切",[Ua]:"插入子行",[Fa]:"与母行分离",[Va]:["隐藏该列","隐藏多列"],[Ba]:["显示该列","显示多列"],[Ha]:["隐藏该行","隐藏多行"],[Pa]:["显示该行","显示多行"],[Oa]:"无",[$a]:"为空",[za]:"不为空",[qa]:"等于",[Da]:"不等于",[ja]:"开头是",[Ra]:"结尾是",[Ta]:"包含",[Ea]:"不包含",[Aa]:"大于",[Ia]:"大于或等于",[Na]:"小于",[La]:"小于或等于",[Ca]:"在此范围",[Sa]:"不在此范围",[_a]:"之后",[wa]:"之前",[ba]:"今天",[xa]:"明天",[Ma]:"昨天",[ga]:"空白单元格",[va]:"按条件过滤",[ka]:"按值过滤",[ma]:"且",[ya]:"或",[fa]:"全选",[pa]:"清除",[ha]:"确认",[ua]:"取消",[da]:"搜索",[la]:"值",[sa]:"第二值"};RQ();const yV={de:rqe,en:qQ,es:iqe,fr:cqe,it:sqe,ja:lqe,ko:dqe,nl:uqe,pl:hqe,pt:pqe,ru:fqe,zh:yqe},mqe=document.documentElement.lang,hK=yV[mqe]??yV.en;jQ(hK);const pK=({config:e,data:n=[],onChange:o,disabled:r})=>{const{appearance:c}=iz(),[d,u]=g.useState("ht-theme-main"),h=g.useCallback((k,m)=>{var x,b;if(m==="loadData")return;const y=(b=(x=f.current)==null?void 0:x.hotInstance)==null?void 0:b.getSourceData();o(y)},[]),f=g.useRef(null);return g.useEffect(()=>{const k=setTimeout(()=>{var m;(m=f.current)!=null&&m.hotInstance&&f.current.hotInstance.loadData(n)},100);return()=>clearTimeout(k)},[n]),g.useEffect(()=>{u(c==="dark"?"ht-theme-main-dark":"ht-theme-main")},[c]),M.jsx(DQ,{className:r?"pointer-events-none opacity-50":"",themeName:d,language:hK.languageCode,ref:f,...e,afterChange:h,children:e.columns.map(k=>M.jsx(zQ,{data:k.data,...k},k.data))})},eze=Object.freeze(Object.defineProperty({__proto__:null,default:pK},Symbol.toStringTag,{value:"Module"})),kqe=()=>{const[e,n]=g.useState({width:typeof window<"u"?window.innerWidth:1024,height:typeof window<"u"?window.innerHeight:768});return g.useEffect(()=>{if(typeof window>"u")return;const o=()=>{n({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e},fK=({onChange:e,value:n,options:o,disabled:r})=>{const{appearance:c}=iz(),[d,u]=g.useState("light"),h=g.useRef(null),f=g.useRef(null),{width:k}=kqe(),m=k<768,y=k>=768&&k<1024,x=_=>{e(_)},b=_=>{h.current=_,w()},w=()=>{var C;if(!h.current)return;const _={minimap:{enabled:!m},fontSize:m?12:y?13:14,lineNumbers:m?"off":"on",lineDecorationsWidth:m?5:10,scrollBeyondLastLine:!m,wordWrap:m?"on":"bounded",renderWhitespace:m?"none":"selection",padding:{top:m?8:16,bottom:m?8:16}};h.current.updateOptions(_),(C=f.current)==null||C.classList.add("overflow-hidden"),setTimeout(()=>{var N,A;(N=h.current)==null||N.layout(),(A=f.current)==null||A.classList.remove("overflow-hidden")},100)};g.useEffect(()=>{u(c==="dark"?"vs-dark":"light")},[c]),g.useEffect(()=>{w()},[k]);const S=m?"300px":y?"400px":"500px";return M.jsx("div",{className:`border rounded-lg ${m?"p-1":"p-2"}`,ref:f,children:M.jsx(IQ,{height:S,language:o.language,value:n,theme:d,options:{automaticLayout:!0,...m&&{wordWrap:"on"},minimap:{enabled:!m}},onChange:x,onMount:b,className:`transition-all duration-200 ease-in-out ${r?"pointer-events-none opacity-50 cursor-not-allowed":""}`})})},tze=Object.freeze(Object.defineProperty({__proto__:null,default:fK},Symbol.toStringTag,{value:"Module"})),mV=$A("m-1 flex items-center border rounded-sm px-1",{variants:{variant:{default:"border-foreground/10 text-foreground bg-card hover:bg-card/80",secondary:"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",inverted:"inverted"}},defaultVariants:{variant:"default"}}),cz=g.forwardRef(({options:e,onValueChange:n,variant:o,processing:r,disabled:c,defaultValue:d=[],placeholder:u="",notFound:h="",search:f="",animation:k=0,maxCount:m=3,modalPopover:y=!1,asChild:x=!1,className:b,mode:w="multiple",...S},_)=>{const[C,N]=g.useState(d),[A,T]=g.useState(!1),[q,$]=g.useState(!1),z=V=>{if(V.key==="Enter")T(!0);else if(V.key==="Backspace"&&!V.currentTarget.value){const se=[...C];se.pop(),N(se),n(se)}},P=V=>{let se;w==="single"?se=C.includes(V)?[]:[V]:se=C.includes(V)?C.filter(le=>le!==V):[...C,V],N(se),n(se),w==="single"&&T(!1)},ae=()=>{N([]),n([])},re=()=>{T(V=>!V)},he=()=>{const V=C.slice(0,m);N(V),n(V)};return M.jsxs(FW,{open:A,onOpenChange:T,modal:y,children:[M.jsx(UW,{asChild:!0,children:M.jsx(OA,{ref:_,...S,onClick:re,disabled:c,className:K("flex w-full p-1 rounded-md border-input border-1 min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto",b),children:C.length>0?M.jsxs("div",{className:"flex justify-between items-center w-full",children:[M.jsxs("div",{className:"flex flex-wrap items-center",children:[C.slice(0,m).map(V=>{const se=e.find(ye=>ye.value===V),le=se==null?void 0:se.icon;return M.jsxs("div",{className:K(q?"animate-bounce":"",mV({variant:o})),style:{animationDuration:`${k}s`},children:[le&&M.jsx(le,{className:"h-4 w-4 mr-2"}),se==null?void 0:se.label,M.jsx(Mr,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:ye=>{ye.stopPropagation(),r||P(V)}})]},V)}),w==="multiple"&&C.length>m&&M.jsxs("div",{className:K("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",q?"animate-bounce":"",mV({variant:o})),style:{animationDuration:`${k}s`},children:[`+ ${C.length-m} more`,M.jsx(Mr,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:V=>{V.stopPropagation(),he()}})]})]}),M.jsxs("div",{className:"flex items-center justify-between",children:[C.length>0&&M.jsxs(M.Fragment,{children:[M.jsx(ri,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:V=>{V.stopPropagation(),ae()}}),M.jsx(tz,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),M.jsx(oi,{className:"h-4 mx-2 cursor-pointer text-muted-foreground"})]})]}):M.jsxs("div",{className:"flex items-center justify-between w-full mx-auto",children:[M.jsx("span",{className:"text-sm text-muted-foreground mx-3",children:u}),M.jsx(oi,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),M.jsx(GW,{className:"w-auto p-0 z-[410]",align:"start",onEscapeKeyDown:()=>T(!1),children:M.jsxs(mq,{children:[M.jsx(vG,{placeholder:f,onKeyDown:z}),M.jsxs(gG,{children:[M.jsx(MG,{children:h}),M.jsx(xG,{children:e.map(V=>{const se=C.includes(V.value);return M.jsxs(wG,{onSelect:()=>P(V.value),className:"cursor-pointer",children:[M.jsx("div",{className:K("mr-2 flex h-5 w-5 items-center justify-center rounded border border-primary",se?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:M.jsx(Uo,{className:"h-4 w-4 text-primary-foreground"})}),V.icon&&M.jsx(V.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),M.jsx("span",{children:V.label})]},V.value)})}),M.jsx(bG,{})]})]})}),k>0&&C.length>0&&w==="multiple"&&M.jsx(ti,{className:K("cursor-pointer my-2 text-foreground bg-background w-3 h-3",q?"":"text-muted-foreground"),onClick:()=>$(!q)})]})});cz.displayName="MultiSelect";const nze=Object.freeze(Object.defineProperty({__proto__:null,default:cz},Symbol.toStringTag,{value:"Module"}));function vqe(){window.UIComponents??(window.UIComponents={}),window.JSComponents??(window.JSComponents={}),Object.assign(window.UIComponents,{Avatar:xae,AvatarImage:bae,AvatarFallback:wae,Badge:Sae,Breadcrumb:L9e,BreadcrumbList:N9e,BreadcrumbItem:I9e,BreadcrumbLink:A9e,BreadcrumbPage:E9e,BreadcrumbSeparator:T9e,BreadcrumbEllipsis:R9e,Button:OA,Calendar:MSe,Card:xSe,CardHeader:bSe,CardFooter:LSe,CardTitle:wSe,CardAction:SSe,CardDescription:_Se,CardContent:CSe,Checkbox:$Se,Collapsible:USe,CollapsibleTrigger:GSe,CollapsibleContent:ZSe,Command:mq,CommandDialog:TLe,CommandInput:vG,CommandList:gG,CommandEmpty:MG,CommandGroup:xG,CommandItem:wG,CommandShortcut:RLe,CommandSeparator:bG,ContextMenu:dAe,ContextMenuTrigger:uAe,ContextMenuContent:vAe,ContextMenuItem:gAe,ContextMenuCheckboxItem:MAe,ContextMenuRadioItem:xAe,ContextMenuLabel:bAe,ContextMenuSeparator:wAe,ContextMenuShortcut:_Ae,ContextMenuGroup:hAe,ContextMenuPortal:pAe,ContextMenuSub:fAe,ContextMenuSubContent:kAe,ContextMenuSubTrigger:mAe,ContextMenuRadioGroup:yAe,Dialog:uG,DialogClose:ALe,DialogContent:fG,DialogDescription:kG,DialogFooter:ELe,DialogHeader:yG,DialogOverlay:pG,DialogPortal:hG,DialogTitle:mG,DialogTrigger:ILe,DialogStack:VZ,DialogStackTrigger:SAe,DialogStackOverlay:CAe,DialogStackBody:LAe,DialogStackContent:NAe,DialogStackTitle:IAe,DialogStackDescription:AAe,DialogStackHeader:EAe,DialogStackFooter:TAe,DialogStackNext:RAe,DialogStackPrevious:jAe,DropdownMenu:dEe,DropdownMenuPortal:uEe,DropdownMenuTrigger:hEe,DropdownMenuContent:pEe,DropdownMenuGroup:fEe,DropdownMenuLabel:gEe,DropdownMenuItem:yEe,DropdownMenuCheckboxItem:mEe,DropdownMenuRadioGroup:kEe,DropdownMenuRadioItem:vEe,DropdownMenuSeparator:MEe,DropdownMenuShortcut:xEe,DropdownMenuSub:bEe,DropdownMenuSubTrigger:wEe,DropdownMenuSubContent:_Ee,Input:lW,Label:LEe,Menubar:cTe,MenubarPortal:TW,MenubarMenu:sTe,MenubarTrigger:uTe,MenubarContent:hTe,MenubarGroup:lTe,MenubarSeparator:kTe,MenubarLabel:mTe,MenubarItem:pTe,MenubarShortcut:vTe,MenubarCheckboxItem:fTe,MenubarRadioGroup:dTe,MenubarRadioItem:yTe,MenubarSub:gTe,MenubarSubTrigger:MTe,MenubarSubContent:xTe,Pagination:bTe,PaginationContent:wTe,PaginationLink:Qq,PaginationItem:_Te,PaginationPrevious:STe,PaginationNext:CTe,PaginationEllipsis:LTe,Popover:FW,PopoverTrigger:UW,PopoverContent:GW,PopoverAnchor:BTe,Select:CRe,SelectContent:ARe,SelectGroup:LRe,SelectItem:TRe,SelectLabel:ERe,SelectScrollDownButton:SX,SelectScrollUpButton:_X,SelectSeparator:RRe,SelectTrigger:IRe,SelectValue:NRe,Separator:tz,Sheet:LX,SheetTrigger:$Re,SheetClose:ORe,SheetContent:NX,SheetHeader:IX,SheetFooter:BRe,SheetTitle:AX,SheetDescription:EX,Sidebar:vje,SidebarContent:Cje,SidebarFooter:_je,SidebarGroup:Lje,SidebarGroupAction:Ije,SidebarGroupContent:Aje,SidebarGroupLabel:Nje,SidebarHeader:wje,SidebarInput:bje,SidebarInset:xje,SidebarMenu:Eje,SidebarMenuAction:Dje,SidebarMenuBadge:qje,SidebarMenuButton:jje,SidebarMenuItem:Tje,SidebarMenuSkeleton:zje,SidebarMenuSub:$je,SidebarMenuSubButton:Pje,SidebarMenuSubItem:Oje,SidebarProvider:kje,SidebarRail:Mje,SidebarSeparator:Sje,SidebarTrigger:gje,useSidebar:A2,Skeleton:ND,Slider:iDe,Toaster:$De,Switch:UDe,Table:GDe,TableHeader:ZDe,TableBody:WDe,TableFooter:XDe,TableHead:YDe,TableRow:KDe,TableCell:QDe,TableCaption:JDe,Textarea:eqe,Tooltip:HX,TooltipTrigger:BX,TooltipContent:VX,TooltipProvider:oz,VanillaJSONEditor:DD}),Object.assign(window.JSComponents,{VanillaJSONEditor:DD,HandsonTable:pK,MonacoEditor:fK,MultiSelect:cz})}const{createInertiaApp:gqe}=LF;window.React=ve;window.ReactDOM=qD;window.InertiajsReact=LF;window.LucideReact=C9e;vqe();async function Mqe(e,n){for(const o of Array.isArray(e)?e:[e]){const r=n[o];if(!(typeof r>"u"))return typeof r=="function"?r():r}throw new Error(`Page not found: ${e}`)}gqe({title:e=>`${e}`,resolve:e=>Mqe(`./pages/${e}.tsx`,Object.assign({"./pages/add-group.tsx":()=>fn(()=>import("./add-group-D5MrUNE1.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),import.meta.url),"./pages/add-user.tsx":()=>fn(()=>import("./add-user-iCupTmGS.js"),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,19,20]),import.meta.url),"./pages/add.tsx":()=>fn(()=>import("./add-184PjeSO.js"),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,22,23,24,25,20]),import.meta.url),"./pages/catalog.tsx":()=>fn(()=>import("./catalog-CJ5JpPUx.js"),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,27,22,23,24,25,20,28]),import.meta.url),"./pages/dashboard.tsx":()=>fn(()=>import("./dashboard-C_EdlZvv.js"),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,30]),import.meta.url),"./pages/form.tsx":()=>fn(()=>import("./form-CTDP9qtV.js"),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,32,22,23,24,25,20]),import.meta.url),"./pages/home.tsx":()=>fn(()=>import("./home-CsjT3Uxk.js"),__vite__mapDeps([33,5,4,3,6]),import.meta.url),"./pages/init-user.tsx":()=>fn(()=>import("./init-user-DaOvt0vG.js"),__vite__mapDeps([34,3,4,20,5,6]),import.meta.url),"./pages/list.tsx":()=>fn(()=>import("./list-DhrnZd-J.js"),__vite__mapDeps([35,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,36,27,37]),import.meta.url),"./pages/login.tsx":()=>fn(()=>import("./login-DR6fvKtm.js"),__vite__mapDeps([38,16,5,4,3,6,20]),import.meta.url),"./pages/module.tsx":()=>fn(()=>import("./module-C0dPDXsj.js"),__vite__mapDeps([39,3,4,1,2,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url),"./pages/notification.tsx":()=>fn(()=>import("./notification-BwG5Ug4o.js"),__vite__mapDeps([40,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,41]),import.meta.url),"./pages/register.tsx":()=>fn(()=>import("./register-hJD1ETdf.js"),__vite__mapDeps([42,3,4,20,5,6]),import.meta.url),"./pages/welcome.tsx":()=>fn(()=>import("./welcome-BwoI5hJ3.js"),__vite__mapDeps([43,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url)})),setup({el:e,App:n,props:o}){xne.createRoot(e).render(M.jsx(n,{...o}))},progress:{color:"#0f4898"}});export{En as $,gAe as A,OA as B,Go as C,VZ as D,R5 as E,xSe as F,bSe as G,wSe as H,lW as I,LSe as J,oz as K,Cs as L,HX as M,BX as N,VX as O,tw as P,UDe as Q,SAe as R,CRe as S,$De as T,IAe as U,dne as V,hne as W,xF as X,Xqe as Y,iI as Z,K as _,E5 as a,wU as a$,Tx as a0,Ip as a1,GDe as a2,ZDe as a3,KDe as a4,YDe as a5,WDe as a6,QDe as a7,Ji as a8,uG as a9,KG as aA,YG as aB,ge as aC,xn as aD,sb as aE,O8 as aF,kje as aG,dEe as aH,Ff as aI,yEe as aJ,MEe as aK,gje as aL,vje as aM,wje as aN,Eje as aO,Tje as aP,cTe as aQ,sTe as aR,uTe as aS,jje as aT,w4 as aU,hTe as aV,gTe as aW,MTe as aX,xTe as aY,pTe as aZ,Lje as a_,fG as aa,yG as ab,mG as ac,xje as ad,kqe as ae,iz as af,T7 as ag,f8 as ah,Bw as ai,Uo as aj,mN as ak,nl as al,ri as am,ELe as an,ALe as ao,Op as ap,xp as aq,Sp as ar,ILe as as,ys as at,v2 as au,ln as av,Jt as aw,bt as ax,be as ay,aE as az,LEe as b,GSe as b0,CU as b1,$je as b2,Oje as b3,Pje as b4,Cje as b5,_je as b6,L9e as b7,N9e as b8,I9e as b9,cz as bA,iDe as bB,eqe as bC,Gqe as bD,Rp as bE,Yu as bF,H1 as bG,Xw as bH,bTe as bI,wTe as bJ,_Te as bK,Qq as bL,STe as bM,CTe as bN,Jqe as bO,eze as bP,tze as bQ,nze as bR,E9e as ba,A9e as bb,T9e as bc,FW as bd,UW as be,Il as bf,jm as bg,GW as bh,MSe as bi,Nje as bj,Aje as bk,USe as bl,ZSe as bm,A2 as bn,VRe as bo,WC as bp,Zx as bq,KC as br,xae as bs,bae as bt,wae as bu,gEe as bv,i7 as bw,Qqe as bx,Yqe as by,Kqe as bz,IRe as c,NRe as d,ARe as e,TRe as f,$Se as g,Nt as h,CAe as i,M as j,LAe as k,NAe as l,ND as m,b9 as n,ff as o,UZ as p,hEe as q,CF as r,Ki as s,Wqe as t,gF as u,pEe as v,fEe as w,dAe as x,uAe as y,vAe as z};
@@ -3,4 +3,4 @@ import{j as m,C as cc,E as uc,a as dc,L as Be,b as De,S as Rr,c as Nr,d as kr,e
3
3
  see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-5xx`);if(c&&console.warn(`Deprecation notice: You are using a pipeline which doesn't include backends' 'id'.
4
4
  This might be unsupported in the future, please specify 'id' explicitely for every backend.`),N(this,ee)[l])throw new Error(`You must specify a unique 'id' property in your Backend entry:
5
5
  ${JSON.stringify(o)} (conflicts with: ${JSON.stringify(N(this,ee)[l])})`);return{id:l,instance:a,preview:o.preview??!1,transition:o.transition,skipDispatchOnTransition:o.skipDispatchOnTransition??!1}}),this.setup=()=>{if(!(typeof window>"u")){if(rn.isSetUp)throw new Error("Cannot have two MultiBackends at the same time.");rn.isSetUp=!0,N(this,Pr).call(this,window),N(this,ee)[N(this,Q)].instance.setup()}},this.teardown=()=>{typeof window>"u"||(rn.isSetUp=!1,N(this,Or).call(this,window),N(this,ee)[N(this,Q)].instance.teardown())},this.connectDragSource=(i,s,o)=>N(this,mt).call(this,"connectDragSource",i,s,o),this.connectDragPreview=(i,s,o)=>N(this,mt).call(this,"connectDragPreview",i,s,o),this.connectDropTarget=(i,s,o)=>N(this,mt).call(this,"connectDropTarget",i,s,o),this.profile=()=>N(this,ee)[N(this,Q)].instance.profile(),this.previewEnabled=()=>N(this,ee)[N(this,Q)].preview,this.previewsList=()=>N(this,gt),this.backendsList=()=>N(this,me),se(this,Pr,i=>{for(let s of N(this,me))s.transition&&i.addEventListener(s.transition.event,N(this,tn))}),se(this,Or,i=>{for(let s of N(this,me))s.transition&&i.removeEventListener(s.transition.event,N(this,tn))}),se(this,tn,i=>{var o;let s=N(this,Q);if(N(this,me).some(a=>a.id!==N(this,Q)&&a.transition&&a.transition.check(i)?(Ve(this,Q,a.id),!0):!1),N(this,Q)!==s){N(this,ee)[s].instance.teardown();for(let[u,d]of Object.entries(N(this,je)))d.unsubscribe(),d.unsubscribe=N(this,nn).call(this,d.func,...d.args);N(this,gt).backendChanged(this);let a=N(this,ee)[N(this,Q)];if(a.instance.setup(),a.skipDispatchOnTransition)return;let l=i.constructor,c=new l(i.type,i);(o=i.target)==null||o.dispatchEvent(c)}}),se(this,nn,(i,s,o,a)=>N(this,ee)[N(this,Q)].instance[i](s,o,a)),se(this,mt,(i,s,o,a)=>{let l=`${i}_${s}`,c=N(this,nn).call(this,i,s,o,a);return N(this,je)[l]={func:i,args:[s,o,a],unsubscribe:c},()=>{N(this,je)[l].unsubscribe(),delete N(this,je)[l]}}),!r||!r.backends||r.backends.length<1)throw new Error(`You must specify at least one Backend, if you are coming from 2.x.x (or don't understand this error)
6
- see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-2xx`);Ve(this,gt,new Fm),Ve(this,ee,{}),Ve(this,me,[]);for(let i of r.backends){let s=N(this,Er).call(this,e,n,i);N(this,ee)[s.id]=s,N(this,me).push(s)}Ve(this,Q,N(this,me)[0].id),Ve(this,je,{})}};Q=new WeakMap,gt=new WeakMap,ee=new WeakMap,me=new WeakMap,je=new WeakMap,Er=new WeakMap,Pr=new WeakMap,Or=new WeakMap,tn=new WeakMap,nn=new WeakMap,mt=new WeakMap,Ml.isSetUp=!1;var zm=Ml,Um=(t,e,n)=>new zm(t,e,n),Rl=(t,e)=>({event:t,check:e}),Hm=Rl("touchstart",t=>{let e=t;return e.touches!==null&&e.touches!==void 0}),$m=Rl("pointerdown",t=>t.pointerType==="mouse"),Ce;(function(t){t.mouse="mouse",t.touch="touch",t.keyboard="keyboard"})(Ce||(Ce={}));class Wm{get delay(){var e;return(e=this.args.delay)!==null&&e!==void 0?e:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var e;return(e=this.args.ignoreContextMenu)!==null&&e!==void 0?e:!1}get enableHoverOutsideTarget(){var e;return(e=this.args.enableHoverOutsideTarget)!==null&&e!==void 0?e:!1}get enableKeyboardEvents(){var e;return(e=this.args.enableKeyboardEvents)!==null&&e!==void 0?e:!1}get enableMouseEvents(){var e;return(e=this.args.enableMouseEvents)!==null&&e!==void 0?e:!1}get enableTouchEvents(){var e;return(e=this.args.enableTouchEvents)!==null&&e!==void 0?e:!0}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var e,n,r,i;return(i=(r=(e=this.args)===null||e===void 0?void 0:e.delayTouchStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&i!==void 0?i:0}get delayMouseStart(){var e,n,r,i;return(i=(r=(e=this.args)===null||e===void 0?void 0:e.delayMouseStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&i!==void 0?i:0}get window(){if(this.context&&this.context.window)return this.context.window;if(typeof window<"u")return window}get document(){var e;if(!((e=this.context)===null||e===void 0)&&e.document)return this.context.document;if(this.window)return this.window.document}get rootElement(){var e;return((e=this.args)===null||e===void 0?void 0:e.rootElement)||this.document}constructor(e,n){this.args=e,this.context=n}}function Gm(t,e,n,r){return Math.sqrt(Math.pow(Math.abs(n-t),2)+Math.pow(Math.abs(r-e),2))}function qm(t,e,n,r,i){if(!i)return!1;const s=Math.atan2(r-e,n-t)*180/Math.PI+180;for(let o=0;o<i.length;++o){const a=i[o];if(a&&(a.start==null||s>=a.start)&&(a.end==null||s<=a.end))return!0}return!1}const Km={Left:1},Xm={Left:0};function er(t){return t.button===void 0||t.button===Xm.Left}function Ym(t){return t.buttons===void 0||(t.buttons&Km.Left)===0}function Nl(t){return!!t.targetTouches}const Zm=1;function Jm(t){const e=t.nodeType===Zm?t:t.parentElement;if(!e)return;const{top:n,left:r}=e.getBoundingClientRect();return{x:r,y:n}}function Qm(t,e){if(t.targetTouches.length===1)return gn(t.targetTouches[0]);if(e&&t.touches.length===1&&t.touches[0].target===e.target)return gn(t.touches[0])}function gn(t,e){return Nl(t)?Qm(t,e):{x:t.clientX,y:t.clientY}}const To=(()=>{let t=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return t=!0,!0}}))}catch{}return t})(),ct={[Ce.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[Ce.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[Ce.keyboard]:{keydown:"keydown"}};class wt{profile(){var e;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((e=this.dragOverTargetIds)===null||e===void 0?void 0:e.length)||0}}get document(){return this.options.document}setup(){const e=this.options.rootElement;e&&(L(!wt.isSetUp,"Cannot have two Touch backends at the same time."),wt.isSetUp=!0,this.addEventListener(e,"start",this.getTopMoveStartHandler()),this.addEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(e,"move",this.handleTopMove),this.addEventListener(e,"move",this.handleTopMoveCapture,!0),this.addEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(e,"keydown",this.handleCancelOnEscape,!0))}teardown(){const e=this.options.rootElement;e&&(wt.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(e,"start",this.handleTopMoveStart),this.removeEventListener(e,"move",this.handleTopMoveCapture,!0),this.removeEventListener(e,"move",this.handleTopMove),this.removeEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(e,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(e,n,r,i=!1){const s=To?{capture:i,passive:!1}:i;this.listenerTypes.forEach(function(o){const a=ct[o][n];a&&e.addEventListener(a,r,s)})}removeEventListener(e,n,r,i=!1){const s=To?{capture:i,passive:!1}:i;this.listenerTypes.forEach(function(o){const a=ct[o][n];a&&e.removeEventListener(a,r,s)})}connectDragSource(e,n){const r=this.handleMoveStart.bind(this,e);return this.sourceNodes.set(e,n),this.addEventListener(n,"start",r),()=>{this.sourceNodes.delete(e),this.removeEventListener(n,"start",r)}}connectDragPreview(e,n,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,n),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDropTarget(e,n){const r=this.options.rootElement;if(!this.document||!r)return()=>{};const i=s=>{if(!this.document||!r||!this.monitor.isDragging())return;let o;switch(s.type){case ct.mouse.move:o={x:s.clientX,y:s.clientY};break;case ct.touch.move:var a,l;o={x:((a=s.touches[0])===null||a===void 0?void 0:a.clientX)||0,y:((l=s.touches[0])===null||l===void 0?void 0:l.clientY)||0};break}const c=o!=null?this.document.elementFromPoint(o.x,o.y):void 0,u=c&&n.contains(c);if(c===n||u)return this.handleMove(s,e)};return this.addEventListener(this.document.body,"move",i),this.targetNodes.set(e,n),()=>{this.document&&(this.targetNodes.delete(e),this.removeEventListener(this.document.body,"move",i))}}getTopMoveStartHandler(){return!this.options.delayTouchStart&&!this.options.delayMouseStart?this.handleTopMoveStart:this.handleTopMoveStartDelay}installSourceNodeRemovalObserver(e){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=e,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{e&&!e.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),!(!e||!e.parentElement)&&this.draggedSourceNodeRemovalObserver.observe(e.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(e,n,r){this.getSourceClientOffset=i=>{const s=this.sourceNodes.get(i);return s&&Jm(s)},this.handleTopMoveStartCapture=i=>{er(i)&&(this.moveStartSourceIds=[])},this.handleMoveStart=i=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(i)},this.handleTopMoveStart=i=>{if(!er(i))return;const s=gn(i);s&&(Nl(i)&&(this.lastTargetTouchFallback=i.targetTouches[0]),this._mouseClientOffset=s),this.waitingForDelay=!1},this.handleTopMoveStartDelay=i=>{if(!er(i))return;const s=i.type===ct.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,i),s),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(i,s)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(s)},this.handleTopMove=i=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:s,dragOverTargetIds:o}=this,a=this.options.enableHoverOutsideTarget,l=gn(i,this.lastTargetTouchFallback);if(!l)return;if(this._isScrolling||!this.monitor.isDragging()&&qm(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,l.x,l.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&s&&Gm(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,l.x,l.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(s,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const c=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(c),this.actions.publishDragSource(),i.cancelable&&i.preventDefault();const u=(o||[]).map(p=>this.targetNodes.get(p)).filter(p=>!!p),d=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(l.x,l.y,u):this.document.elementsFromPoint(l.x,l.y),h=[];for(const p in d){if(!d.hasOwnProperty(p))continue;let g=d[p];for(g!=null&&h.push(g);g;)g=g.parentElement,g&&h.indexOf(g)===-1&&h.push(g)}const f=h.filter(p=>u.indexOf(p)>-1).map(p=>this._getDropTargetId(p)).filter(p=>!!p).filter((p,g,b)=>b.indexOf(p)===g);if(a)for(const p in this.targetNodes){const g=this.targetNodes.get(p);if(c&&g&&g.contains(c)&&f.indexOf(p)===-1){f.unshift(p);break}}f.reverse(),this.actions.hover(f,{clientOffset:l})},this._getDropTargetId=i=>{const s=this.targetNodes.keys();let o=s.next();for(;o.done===!1;){const a=o.value;if(i===this.targetNodes.get(a))return a;o=s.next()}},this.handleTopMoveEndCapture=i=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!Ym(i)){if(!this.monitor.isDragging()||this.monitor.didDrop()){this.moveStartSourceIds=void 0;return}i.cancelable&&i.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()}},this.handleCancelOnEscape=i=>{i.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new Wm(r,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(Ce.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(Ce.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(Ce.keyboard)}}const ev=function(e,n={},r={}){return new wt(e,n,r)};var le=function(){return le=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},le.apply(this,arguments)};function Z(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function tv(t){var e=t.isVisible,n=t.ease,r=n===void 0?"easeIn":n,i=t.duration,s=t.variants,o=s===void 0?{open:{opacity:1,height:"auto"},close:{opacity:0,height:0}}:s,a=t.children,l=zp({polyfill:fu}),c=l[0],u=l[1].height,d=v.useState(e),h=d[0],f=d[1],p=v.useState(e),g=p[0],b=p[1],y=v.useState(!1),T=y[0],S=y[1],E=function(){S(!1),e||f(!1)};v.useEffect(function(){S(!0),e?f(!0):b(!1)},[e]);var w=u===0;return v.useEffect(function(){h&&b(!0)},[w]),z.createElement(Fp.div,{style:T?{overflow:"hidden"}:void 0,onAnimationComplete:E,initial:g?"open":"close",animate:g?"open":"close",inherit:!1,variants:o,transition:{ease:r,duration:nv(u,i)}},z.createElement("div",{ref:c},h&&a))}function nv(t,e){if(e)return e;if(!t)return 0;var n=t/36;return Math.round((4+10*Math.pow(n,.25)+n/5)*10)/1500}var kl=v.createContext({}),rv={isLock:!1},iv=function(t){var e=v.useState(rv.isLock),n=e[0],r=e[1];return z.createElement(kl.Provider,{value:{isLock:n,lock:function(){return r(!0)},unlock:function(){return r(!1)}}},t.children)},kt=v.createContext({}),Kt={dropTargetId:void 0,index:void 0},sv=function(t){var e=v.useState(Kt.dropTargetId),n=e[0],r=e[1],i=v.useState(Kt.index),s=i[0],o=i[1],a=function(c,u){r(c),o(u)},l=function(){r(Kt.dropTargetId),o(Kt.index)};return z.createElement(kt.Provider,{value:{dropTargetId:n,index:s,showPlaceholder:a,hidePlaceholder:l}},t.children)},ov=function(t,e){return t.text>e.text?1:t.text<e.text?-1:0},ut=function(t,e){return t.find(function(n){return n.id===e})},Ll=function(t,e,n){if(n===0)return!1;var r=t.find(function(i){return i.id===n});return r===void 0?!1:r.parent===e?!0:Ll(t,e,r.parent)},Si=function(t){return typeof t=="object"&&t!==null&&"id"in t&&"parent"in t&&"text"in t},Oe=function(t,e,n){var r=n.tree,i=n.rootId,s=n.canDrop;if(t===null){if(e===i)return!0;var o=r.find(function(u){return u.id===e});return!!(o&&o.droppable)}else{var a=Si(t)?t.id:null;if(s){var l=s(a,e);if(l!==void 0)return l}if(a===e)return!1;var c=r.find(function(d){return d.id===a}),o=r.find(function(d){return d.id===e});return c===void 0||a===null?e===i||!!(o!=null&&o.droppable):o===void 0?c.parent!==0:c.parent===e||!o.droppable?!1:!Ll(r,a,e)}},av=function(t,e,n){return t.map(function(r){return r.id===e?le(le({},r),{parent:n}):r})},Vl=function(t,e,n){if(n===0)return 0;var r=t.filter(function(i){return i.parent===e});return r[n]?t.findIndex(function(i){return i.id===r[n].id}):t.findIndex(function(i){return i.id===r[n-1].id})+1},lv=function(t,e){return t.findIndex(function(n){return n.id===e})},jl=function(t,e,n,r){var i=lv(t,e),s=Vl(t,n,r);return s=s>i?s-1:s,[i,s]},cv=function(t,e,n){var r=e<0?t.length+e:e;if(r>=0&&r<t.length){var i=n<0?t.length+n:n,s=t.splice(e,1)[0];t.splice(i,0,s)}},uv=function(t,e,n,r){var i=jl(t,e,n,r),s=i[0],o=i[1],a=Z([],t,!0);return cv(a,s,o),a.map(function(l){return l.id===e?le(le({},l),{parent:n}):l})},dv=function(t,e){var n=t.getBoundingClientRect(),r=n.top+n.height/2;return e>r?"down":"up"},Ir=function(t,e){var n="",r=0;return t.forEach(function(i,s){var o,a=dv(i,((o=e.getClientOffset())===null||o===void 0?void 0:o.y)||0);n===""?n=a:n!==a&&(n=a,r=s),s===t.length-1&&a==="down"&&(r=s+1)}),r},So=function(t,e,n){var r=e.closest('[role="list"]'),i=r==null?void 0:r.querySelectorAll(':scope > [role="listitem"]');return i?Ir(i,n):null},hv=function(t,e,n){var r=t.getBoundingClientRect(),i=n.dropTargetOffset;if(i===0)return"middle";var s=r.top+i,o=r.bottom-i;return e>o?"lower":e<s?"upper":"middle"},Ar=function(t,e,n,r){var i;if(!e)return null;if(t===null){var s=e.querySelectorAll(':scope > [role="listitem"]');return{id:r.rootId,index:Ir(s,n)}}var o=n.getItem(),a=e.querySelector('[role="list"]'),l=hv(e,((i=n.getClientOffset())===null||i===void 0?void 0:i.y)||0,r);if(a){if(l==="upper")if(Oe(o,t.parent,r)){var c=So(t,e,n);return c===null?null:{id:t.parent,index:c}}else return{id:t.id,index:0};var s=a.querySelectorAll(':scope > [role="listitem"]');return{id:t.id,index:Ir(s,n)}}else{if(l==="middle")return{id:t.id,index:0};if(Oe(o,t.parent,r)){var c=So(t,e,n);return c===null?null:{id:t.parent,index:c}}return null}},fv=function(t){return t===void 0&&(t={}),{backends:[{id:"html5",backend:Gc,options:t.html5,transition:$m},{id:"touch",backend:ev,options:t.touch||{enableMouseEvents:!0},preview:!0,transition:Hm}]}},sn=function(t,e){return t.some(function(n){return n.parent===e})},_l=v.createContext({}),pv=function(t){var e=xv(t.tree,t.initialOpen),n=e[0],r=e[1],i=r.handleToggle,s=r.handleCloseAll,o=r.handleOpenAll,a=r.handleOpen,l=r.handleClose;v.useImperativeHandle(t.treeRef,function(){return{open:function(f){return a(f,t.onChangeOpen)},close:function(f){return l(f,t.onChangeOpen)},openAll:function(){return o(t.onChangeOpen)},closeAll:function(){return s(t.onChangeOpen)}}});var c=xe().getMonitor(),u=t.canDrop,d=t.canDrag,h=le(le({extraAcceptTypes:[],listComponent:"ul",listItemComponent:"li",placeholderComponent:"li",sort:!0,insertDroppableFirst:!0,enableAnimateExpand:!1,dropTargetOffset:0,initialOpen:!1},t),{openIds:n,onDrop:function(f,p,g){if(f){var b={dragSourceId:f.id,dropTargetId:p,dragSource:f,dropTarget:ut(t.tree,p),monitor:c},y=t.tree;if(ut(y,f.id)||(y=Z(Z([],y,!0),[f],!1)),t.sort===!1){var T=jl(y,f.id,p,g),S=T[1];b.destinationIndex=S,b.relativeIndex=g,t.onDrop(uv(y,f.id,p,g),b);return}t.onDrop(av(y,f.id,p),b)}else{var b={dropTargetId:p,dropTarget:ut(t.tree,p),monitor:c};t.sort===!1&&(b.destinationIndex=Vl(t.tree,p,g),b.relativeIndex=g),t.onDrop(t.tree,b)}},canDrop:u?function(f,p){return u(t.tree,{dragSourceId:f??void 0,dropTargetId:p,dragSource:c.getItem(),dropTarget:ut(t.tree,p),monitor:c})}:void 0,canDrag:d?function(f){return d(ut(t.tree,f))}:void 0,onToggle:function(f){return i(f,t.onChangeOpen)}});return z.createElement(_l.Provider,{value:h},t.children)},gv=function(t){return z.createElement(pv,le({},t),z.createElement(iv,null,z.createElement(sv,null,t.children)))},mv=function(t){var e=v.useContext(kl);v.useEffect(function(){if(t.current){var n=t.current,r=function(u){var d=u.target;(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement)&&e.lock()},i=function(u){var d=u.target;(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement)&&e.unlock()},s=function(u){return r(u)},o=function(u){return i(u)},a=function(u){return r(u)},l=function(u){return i(u)},c=new MutationObserver(function(){document.activeElement===document.body&&e.unlock()});return c.observe(n,{subtree:!0,childList:!0}),n.addEventListener("mouseover",s),n.addEventListener("mouseout",o),n.addEventListener("focusin",a),n.addEventListener("focusout",l),function(){c.disconnect(),n.removeEventListener("mouseover",s),n.removeEventListener("mouseout",o),n.removeEventListener("focusin",a),n.removeEventListener("focusout",l)}}},[t,e]),v.useEffect(function(){var n;(n=t.current)===null||n===void 0||n.setAttribute("draggable",e.isLock?"false":"true")},[t,e.isLock])},En={TREE_ITEM:Symbol()},Bl=null,Fl=function(t){var e=t.target;if(e instanceof HTMLElement){var n=e.closest('[role="listitem"]');t.currentTarget===n&&(Bl=n)}},wo=function(t){return Fl(t)},Do=function(t){return Fl(t)},vv=function(t,e){var n=Ae();v.useEffect(function(){var a=e.current;return a==null||a.addEventListener("dragstart",wo),a==null||a.addEventListener("touchstart",Do,{passive:!0}),function(){a==null||a.removeEventListener("dragstart",wo),a==null||a.removeEventListener("touchstart",Do)}},[e]);var r=Mm({type:En.TREE_ITEM,item:function(a){var l=le({ref:e},t);return n.onDragStart&&n.onDragStart(l,a),l},end:function(a,l){var c=a;n.onDragEnd&&n.onDragEnd(c,l)},canDrag:function(){var a=n.canDrag;return Bl!==e.current?!1:a?a(t.id):!0},collect:function(a){return{isDragging:a.isDragging()}}}),i=r[0].isDragging,s=r[1],o=r[2];return[i,s,o]},yv=function(t){var e=Ae(),n=v.useContext(kt),r=Ol({accept:Z([En.TREE_ITEM],e.extraAcceptTypes,!0),drop:function(l,c){var u=e.rootId,d=e.onDrop,h=n.dropTargetId,f=n.index;c.isOver({shallow:!0})&&h!==void 0&&f!==void 0&&d(Si(l)?l:null,u,f),n.hidePlaceholder()},canDrop:function(l,c){var u=e.rootId;return c.isOver({shallow:!0})?l===void 0?!1:Oe(l,u,e):!1},hover:function(l,c){if(c.isOver({shallow:!0})){var u=e.rootId,d=n.dropTargetId,h=n.index,f=n.showPlaceholder,p=n.hidePlaceholder,g=Ar(null,t.current,c,e);if(g===null||!Oe(l,u,e)){p();return}(g.id!==d||g.index!==h)&&f(g.id,g.index)}},collect:function(l){var c=l.getItem();return{isOver:l.isOver({shallow:!0})&&l.canDrop(),dragSource:c}}}),i=r[0],s=i.isOver,o=i.dragSource,a=r[1];return[s,o,a]},bv=function(t,e){var n=Ae(),r=v.useContext(kt),i=Ol({accept:Z([En.TREE_ITEM],n.extraAcceptTypes,!0),drop:function(c,u){var d=r.dropTargetId,h=r.index;u.isOver({shallow:!0})&&d!==void 0&&h!==void 0&&n.onDrop(Si(c)?c:null,d,h),r.hidePlaceholder()},canDrop:function(c,u){if(u.isOver({shallow:!0})){var d=Ar(t,e.current,u,n);return d===null?!1:Oe(c,d.id,n)}return!1},hover:function(c,u){if(u.isOver({shallow:!0})){var d=r.dropTargetId,h=r.index,f=r.showPlaceholder,p=r.hidePlaceholder,g=Ar(t,e.current,u,n);if(g===null||!Oe(c,g.id,n)){p();return}(g.id!==d||g.index!==h)&&f(g.id,g.index)}},collect:function(c){var u=c.getItem();return{isOver:c.isOver({shallow:!0})&&c.canDrop(),dragSource:u}}}),s=i[0],o=s.isOver,a=s.dragSource,l=i[1];return[o,a,l]},xv=function(t,e){var n=v.useMemo(function(){return e===!0?t.filter(function(d){return sn(t,d.id)}).map(function(d){return d.id}):Array.isArray(e)?e:[]},[e]),r=v.useState(n),i=r[0],s=r[1];v.useEffect(function(){return s(n)},[n]);var o=function(d,h){var f=i.includes(d)?i.filter(function(p){return p!==d}):Z(Z([],i,!0),[d],!1);s(f),h&&h(f)},a=function(d){s([]),d&&d([])},l=function(d){var h=t.filter(function(f){return sn(t,f.id)}).map(function(f){return f.id});s(h),d&&d(h)},c=function(d,h){var f=[];if(Array.isArray(d)){var p=t.filter(function(g){return d.includes(g.id)&&sn(t,g.id)});f=Z(Z([],i,!0),p.map(function(g){return g.id}),!0).filter(function(g,b,y){return y.indexOf(g)===b})}else f=i.includes(d)?i:Z(Z([],i,!0),[d],!1);s(f),h&&h(f)},u=function(d,h){var f=i.filter(function(p){return Array.isArray(d)?!d.includes(p):p!==d});s(f),h&&h(f)};return[i,{handleToggle:o,handleCloseAll:a,handleOpenAll:l,handleOpen:c,handleClose:u}]},Tv=function(){return Rm(function(t){var e=t.getItemType();return{item:t.getItem(),clientOffset:t.getClientOffset(),isDragging:t.isDragging()&&e===En.TREE_ITEM}})},Ae=function(){var t=v.useContext(_l);if(!t)throw new Error("useTreeContext must be used under TreeProvider");return t},Sv=function(t,e){var n=Ae(),r=n.rootId,i=n.rootProps,s=n.classes,o=(s==null?void 0:s.container)||"";return e&&(s!=null&&s.dropTarget)&&(o="".concat(o," ").concat(s.dropTarget)),t===r&&(s!=null&&s.root)&&(o="".concat(o," ").concat(s.root)),t===r&&(i!=null&&i.className)&&(o="".concat(o," ").concat(i.className)),o=o.trim(),o},wv=function(t,e,n){e.current?n(e):n(t),v.useEffect(function(){e.current?n(e):n(t)},[e.current])},Dv=function(t){var e=Ae(),n=v.useContext(kt),r=v.useRef(null),i=v.useRef(null),s=e.tree.find(function(R){return R.id===t.id}),o=e.openIds,a=e.classes,l=e.enableAnimateExpand,c=o.includes(t.id),u=vv(s,r),d=u[0],h=u[1],f=u[2],p=bv(s,r),g=p[0],b=p[1],y=p[2];wv(r,i,h),Oe(b,t.id,e)&&y(r),v.useEffect(function(){e.dragPreviewRender?f(Wc(),{captureDraggingState:!0}):i.current&&f(r)},[f,e.dragPreviewRender]),mv(r);var T=v.useCallback(function(){e.onToggle(s.id)},[s.id,e]),S=e.listItemComponent,E=e.canDrag?e.canDrag(t.id):!0,w=n.dropTargetId===t.id,O={depth:t.depth,isOpen:c,isDragging:d,isDropTarget:w,draggable:E,hasChild:sn(e.tree,t.id),containerRef:r,handleRef:i,onToggle:T},k="";return a!=null&&a.listItem&&(k=typeof a.listItem=="string"?a.listItem:a.listItem(s,O)),g&&(a!=null&&a.dropTarget)&&(k="".concat(k," ").concat(a.dropTarget)),d&&(a!=null&&a.draggingSource)&&(k="".concat(k," ").concat(a.draggingSource)),z.createElement(S,{ref:r,className:k,role:"listitem"},e.render(s,O),l&&O.hasChild&&z.createElement(tv,{isVisible:c},z.createElement(Mr,{parentId:t.id,depth:t.depth+1})),!l&&O.hasChild&&c&&z.createElement(Mr,{parentId:t.id,depth:t.depth+1}))},Co=function(t){var e=Ae(),n=e.placeholderRender,r=e.placeholderComponent,i=e.classes,s=v.useContext(kt),o=xe(),a=o.getMonitor(),l=a.getItem();if(!n||!l)return null;var c=t.dropTargetId===s.dropTargetId&&(t.index===s.index||t.index===void 0&&t.listCount===s.index),u=a.getTargetIds();return!c||!u.length?null:z.createElement(r,{className:(i==null?void 0:i.placeholder)||""},n(l,{depth:t.depth}))},Mr=function(t){var e=Ae(),n=v.useRef(null),r=e.tree.filter(function(g){return g.parent===t.parentId}),i=r,s=typeof e.sort=="function"?e.sort:ov;if(e.insertDroppableFirst){var o=r.filter(function(g){return g.droppable}),a=r.filter(function(g){return!g.droppable});e.sort===!1?i=Z(Z([],o,!0),a,!0):(o=o.sort(s),a=a.sort(s),i=Z(Z([],o,!0),a,!0))}else e.sort!==!1&&(i=r.sort(s));var l=yv(n),c=l[0],u=l[1],d=l[2];t.parentId===e.rootId&&Oe(u,e.rootId,e)&&d(n);var h=Sv(t.parentId,c),f=e.rootProps||{},p=e.listComponent;return z.createElement(p,le({ref:n,role:"list"},f,{className:h}),i.map(function(g,b){return z.createElement(z.Fragment,{key:g.id},z.createElement(Co,{depth:t.depth,listCount:i.length,dropTargetId:t.parentId,index:b}),z.createElement(Dv,{id:g.id,depth:t.depth}))}),z.createElement(Co,{depth:t.depth,listCount:i.length,dropTargetId:t.parentId}))},Cv={height:"100%",left:0,pointerEvents:"none",position:"fixed",top:0,width:"100%",zIndex:100},Ev=function(t){var e=t.clientOffset;if(!e)return{};var n=e.x,r=e.y,i="translate(".concat(n,"px, ").concat(r,"px)");return{pointerEvents:"none",transform:i}},Pv=function(){var t=Ae(),e=Tv(),n=e.isDragging,r=e.clientOffset;return!n||!r?null:z.createElement("div",{style:Cv},z.createElement("div",{style:Ev(e)},t.dragPreviewRender&&t.dragPreviewRender(e)))};function Ov(t,e){return z.createElement(gv,le({},t,{treeRef:e}),t.dragPreviewRender&&z.createElement(Pv,null),z.createElement(Mr,{parentId:t.rootId,depth:0}))}var Iv=v.forwardRef(Ov);const Av="_root_71whx_1",Mv="_isSelected_71whx_10",Rv="_expandIconWrapper_71whx_13",Nv="_isOpen_71whx_25",kv="_labelGridItem_71whx_29",dt={root:Av,isSelected:Mv,expandIconWrapper:Rv,isOpen:Nv,labelGridItem:kv},Lv=t=>{var i,s,o,a;const e=t.depth*24,n=l=>{l.stopPropagation(),t.onToggle(t.node.id)},r=()=>t.onSelect(t.node);return m.jsxs("div",{className:`tree-node ${dt.root} ${t.isSelected?dt.isSelected:""} ${(i=t.node.data)!=null&&i.marked?"bg-gray-200":""}`,style:{paddingInlineStart:e},onClick:r,children:[m.jsx("div",{className:`${dt.expandIconWrapper} ${t.isOpen?dt.isOpen:""}`,children:t.node.droppable&&m.jsx("div",{onClick:n,children:m.jsx(cc,{size:18})})}),m.jsxs("div",{className:"flex items-center gap-2",children:[((s=t.node.data)==null?void 0:s.isNavigation)&&((o=t.node.data)!=null&&o.visible?m.jsx(uc,{className:"size-5"}):m.jsx(dc,{className:"size-5"})),m.jsx(an,{name:((a=t.node.data)==null?void 0:a.icon)??"folder"})]}),m.jsx("div",{className:dt.labelGridItem,children:m.jsx("span",{children:t.node.text})}),t.loading&&m.jsx(Be,{className:"size-4 animate-spin"})]})},Vv="_root_ahb0f_1",jv="_icon_ahb0f_15",_v="_label_ahb0f_16",tr={root:Vv,icon:jv,label:_v},Bv=t=>{var n;const e=t.monitorProps.item;return m.jsxs("div",{className:`${tr.root} bg-chart-1/60`,children:[m.jsx("div",{className:tr.icon,children:m.jsx(an,{name:((n=e.data)==null?void 0:n.icon)??"folder"})}),m.jsx("div",{className:tr.label,children:e.text})]})},Fv="_app_gsniw_1",zv="_draggingSource_gsniw_9",Uv="_placeholderContainer_gsniw_13",nr={app:Fv,draggingSource:zv,placeholderContainer:Uv},Hv="_root_1hoix_1",$v={root:Hv},Wv=t=>{const e=t.depth*24;return m.jsx("div",{className:`${$v.root} bg-chart-3`,style:{left:e}})},zl=v.createContext({messages:{},setMessages:()=>{}}),Gv=({type:t,callback:e,parentId:n,isNavigation:r,...i})=>{const[s,o]=v.useState(!1),[a,l]=v.useState(!1),c=async u=>{try{(await W.post("",{data:{record:u,parentId:n,targetBlank:s,visible:a,_method:"select",type:t},_method:"createItem"})).data&&e()}catch(d){console.log(d)}};return m.jsxs("div",{className:"p-8",children:[m.jsxs("div",{className:"flex gap-4 flex-col",children:[m.jsxs("div",{className:`grid gap-4 ${i.items.length?"":"opacity-50 pointer-events-none"}`,children:[m.jsx(De,{children:i.labels.selectTitle}),m.jsxs(Rr,{onValueChange:c,children:[m.jsx(Nr,{className:"w-full max-w-[170px] cursor-pointer",children:m.jsx(kr,{placeholder:i.labels.selectTitle})}),m.jsx(Lr,{className:"z-[1003]",children:i.items.map(u=>m.jsx(Vr,{value:u.id.toString(),children:u.name},`${u.id}-${u.name}`))})]})]}),r&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex gap-4 items-center",children:[m.jsx(on,{id:"targetBlank",checked:s,onCheckedChange:u=>o(!!u),className:"cursor-pointer size-5"}),m.jsx(De,{htmlFor:"targetBlank",children:i.labels.openInNewWindow})]}),m.jsxs("div",{className:"flex gap-4 items-center",children:[m.jsx(on,{id:"visible",checked:a,onCheckedChange:u=>l(!!u),className:"cursor-pointer size-5"}),m.jsx(De,{htmlFor:"visible",children:i.labels.visible})]})]})]}),m.jsx("div",{className:"mt-8",children:m.jsx("span",{children:m.jsx("b",{children:i.labels.OR})})}),m.jsxs(we,{className:"mt-8",onClick:()=>i.add(i.model),children:[m.jsx(Eo,{}),i.labels.createTitle]})]})},Xt=({update:t=!1,type:e,parentId:n,...r})=>{const[i,s]=v.useState({}),[o,a]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(!1);v.useEffect(()=>{console.log(r)},[]),v.useEffect(()=>{r.item?(s({name:r.item.name||"",...Object.fromEntries(r.items.map(p=>[p.name,r.item?r.item[p.name]:""]))}),a(r.item.targetBlank||!1),c(r.item.visible||!1)):(s({name:"",...Object.fromEntries(r.items.map(p=>[p.name,""]))}),a(!1),c(!1))},[r.item,r.items]);const h=p=>{const{name:g,value:b}=p.target;s(y=>({...y,[g]:b}))},f=async p=>{var g,b;p.preventDefault(),d(!0);try{let y=null;t?(y=await W.put("",{type:(g=r.item)==null?void 0:g.type,modelId:(b=r.item)==null?void 0:b.id,data:{...r.item,...i,targetBlank:o,visible:l},_method:"updateItem"}),r.callback(y.data.data)):(await W.post("",{data:{...i,targetBlank:o,visible:l,parentId:n,type:e},_method:"createItem"}),r.callback(null))}catch(y){console.error(y)}finally{d(!1)}};return m.jsxs("div",{className:"p-8",children:[m.jsxs("form",{className:"grid gap-6",id:"group-add",onSubmit:f,children:[m.jsxs("div",{className:"flex gap-4 items-center",children:[m.jsx(on,{id:"targetBlank",checked:o,onCheckedChange:p=>a(!!p),className:"cursor-pointer size-5"}),m.jsx(De,{htmlFor:"targetBlank",children:r.labels.openInNewWindow})]}),m.jsxs("div",{className:"flex gap-4 items-center",children:[m.jsx(on,{id:"visible",checked:l,onCheckedChange:p=>c(!!p),className:"cursor-pointer size-5"}),m.jsx(De,{htmlFor:"visible",children:r.labels.visible})]}),m.jsxs("div",{className:"grid gap-4",children:[m.jsx(De,{htmlFor:"name",children:r.labels.title}),m.jsx(rr,{required:!0,value:i.name||"",name:"name",placeholder:r.labels.title,onChange:h})]}),r.items.map(p=>m.jsxs("div",{className:"grid gap-4",children:[m.jsx(De,{children:p.name}),m.jsx(rr,{required:p.required,value:i[p.name]||"",name:p.name,placeholder:p.name,onChange:h})]},p.name))]}),m.jsxs(we,{className:"mt-8 w-fit",form:"group-add",type:"submit",disabled:u,children:[r.labels.save,u&&m.jsx(Be,{className:"h-4 w-4 animate-spin ml-2"})]})]})},qv=({items:t,onSelect:e})=>{const n=v.useContext(zl),[r,i]=v.useState(""),s=o=>{i(o),e(o),i("")};return m.jsxs("div",{className:"p-8",children:[m.jsx(De,{className:"mb-4",children:n.messages["Select Item type"]}),m.jsxs(Rr,{onValueChange:s,value:r,children:[m.jsx(Nr,{className:"w-full max-w-[170px] cursor-pointer",children:m.jsx(kr,{placeholder:n.messages["Select Ids"]})}),m.jsx(Lr,{className:"z-[1005]",children:t.map(o=>m.jsx(Vr,{value:o.type,children:o.name},`${o.type}-${o.name}`))})]})]})},Kv=({dialogRef:t,PopupEvent:e,firstRender:n,secondRender:r,popupType:i,addProps:s,editModel:o,popUpTargetBlank:a,popUpVisible:l,isNavigation:c,messages:u,DynamicComponent:d,DynamicActionComponent:h,addLinksGroupProps:f,reloadCatalog:p,itemType:g,parentid:b,addItemProps:y,getAddModelJSON:T,addModel:S,items:E,selectCatalogItem:w})=>m.jsxs(hc,{ref:t,children:[m.jsx(fc,{}),m.jsxs(pc,{children:[m.jsx(Rn,{children:m.jsxs("div",{className:"relative h-full",children:[e==="create"&&m.jsxs(m.Fragment,{children:[n&&m.jsx(Be,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-8 animate-spin"}),m.jsx(qv,{items:E,onSelect:w})]}),e==="update"&&m.jsx("div",{className:"h-full overflow-y-auto mt-5",children:n?m.jsx(Be,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-8 animate-spin"}):m.jsxs(m.Fragment,{children:[i==="model"&&m.jsx(Vi,{page:s,catalog:!0,callback:o,openNewWindowLabel:u["Open in a new window"],visibleLable:u.Visible,openNewWindow:a,DnavVisible:l,isNavigation:c}),i==="navigation.group"&&m.jsx(Xt,{callback:O=>{var k;(k=t.current)==null||k.close(),p(O)},update:!0,type:"group",...f}),i==="navigation.link"&&m.jsx(Xt,{callback:O=>{var k;(k=t.current)==null||k.close(),p(O)},update:!0,type:"link",...f}),i==="component"&&m.jsx(m.Fragment,{children:d})]})}),e==="action"&&m.jsx(m.Fragment,{children:h})]})}),m.jsx(Rn,{children:m.jsxs("div",{className:"relative h-full",children:[r&&m.jsx(Be,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-8 animate-spin"}),e==="create"&&m.jsxs(m.Fragment,{children:[i==="model"&&m.jsx(Gv,{add:T,callback:()=>{var O;(O=t.current)==null||O.close(),p(null)},type:g??"",parentId:b,isNavigation:c,...y}),i==="navigation.group"&&m.jsx(Xt,{callback:O=>{var k;(k=t.current)==null||k.close(),p(O)},type:"group",parentId:b,...f}),i==="navigation.link"&&m.jsx(Xt,{callback:O=>{var k;(k=t.current)==null||k.close(),p(O)},type:"link",parentId:b,...f}),i==="component"&&m.jsx(m.Fragment,{children:d})]})]})}),m.jsx(Rn,{children:m.jsx("div",{className:"h-full overflow-y-auto mt-5",children:m.jsx(Vi,{page:s,catalog:!0,callback:S,openNewWindowLabel:u["Open in a new window"],visibleLable:u.Visible,isNavigation:c})})})]})]}),Xv=()=>{var Ri;const t=v.useRef(null),e=v.useRef(null),[n,r]=v.useState([]),[i,s]=v.useState([]),[o,a]=v.useState({catalogId:"",catalogName:"",catalogSlug:"",idList:[],nodes:[],movingGroupsRootOnly:!1}),[l,c]=v.useState([]),[u,d]=v.useState({}),[h,f]=v.useState(!1),p=v.useRef(null),[g,b]=v.useState({items:[],model:"",labels:{}}),[y,T]=v.useState({items:[],labels:{}}),[S,E]=v.useState(""),[w,O]=v.useState(null),[k,R]=v.useState(null),[U,_]=v.useState(null),[J,de]=v.useState(0),[Pn,Lt]=v.useState(!1),[wi,Di]=v.useState(!1),[q,ce]=v.useState(!1),[it,We]=v.useState(null),[Ul,Hl]=v.useState(null),[st,$l]=v.useState([]),[On,Ci]=v.useState([]),[Wl,Ei]=v.useState(!1),[Gl,In]=v.useState(!1),[ql,Pi]=v.useState({props:{actions:[],btnBack:{link:"",title:""},btnSave:{title:""},edit:!1,fields:[],notFound:"",postLink:"",search:"",view:!1}}),[Kl,Me]=v.useState(!1),[Xl,Oi]=v.useState(!1);v.useEffect(()=>{const x=async()=>{const A=await W.post("",{_method:"getCatalog"}),{catalog:M,items:C,toolsActions:V}=A.data;a(M),c(C),r(M.nodes),$l(V),ce(M.catalogSlug==="navigation")},P=async()=>{let A=await W.post("",{_method:"getLocales"});d(A.data.data)};(async()=>{try{f(!0),await P(),await x()}catch(A){console.error("Error initializing catalog:",A)}finally{f(!1)}})()},[]);const Ii=x=>{i.find(D=>D.id===x.id)?(de(0),s(i.filter(D=>D.id!==x.id))):(de(x.id),s([...i,x]))},Yl=x=>{x.target===x.currentTarget&&s([])},Zl=v.useCallback(async(x,{dragSourceId:P,dropTargetId:D})=>{var A;try{const M=x.find(j=>j.id===P),C=D||0,V={data:{reqNode:[{id:M==null?void 0:M.id,parent:C,text:M==null?void 0:M.text,data:M==null?void 0:M.data}],reqParent:{id:C,children:x.filter(j=>j.parent===C).map(j=>({id:j.id,text:j.text,data:j.data})),data:C===0?{id:0}:(A=x.find(j=>j.id===C))==null?void 0:A.data}},_method:"updateTree"};r(x),await W.put("",V)}catch(M){console.error("Error updating tree:",M)}},[n]),An=v.useCallback(async(x,P)=>{if(P)try{O(x);const D=n.find(C=>C.id===x),M=(await W.post("",{data:D,_method:"getChilds"})).data.data;r(C=>{const V=new Set(C.map(F=>F.id)),j=M.filter(F=>!V.has(F.id));return j.length===0?C:[...C,...j]})}catch(D){console.error("Error loading child nodes:",D)}finally{O(null)}},[n]),Jl=v.useCallback(async()=>{try{const x=await W.post("",{_method:"getCatalog"}),{catalog:P}=x.data;r(D=>{const A=new Map(D.map(j=>[j.id,j])),M=P.nodes,C=D.map(j=>{const F=M.find(Re=>Re.id===j.id);return F&&F.text!==j.text?F:j}),V=M.filter(j=>{var F;return!A.has(j.id)||((F=A.get(j.id))==null?void 0:F.text)!==j.text});return V.length===0&&C.length===D.length&&C.every((j,F)=>j===D[F])?D:[...C,...V]})}catch(x){console.error("Error reloading catalog:",x)}},[]),Vt=v.useCallback(async x=>{var P,D;x?r(A=>A.map(M=>M.id===x.id?{...M,text:x.name,data:{...M.data,...x}}:M)):(P=i[0])!=null&&P.droppable?((D=t.current)==null||D.open(i[0].id),await An(i[0].id,!0)):await Jl()},[i,An,r]),Ql=v.useCallback(async x=>{var D;R(x),Me(!0);const P=await W.post("",{type:x,_method:"getAddTemplate"});tc(P.data),(D=p.current)==null||D.next(),Me(!1)},[J]),Ai=v.useCallback(async()=>{var x,P,D,A,M,C;try{Me(!0);const V=await W.post("",{type:(P=(x=i[0])==null?void 0:x.data)==null?void 0:P.type,modelId:((A=(D=i[0])==null?void 0:D.data)==null?void 0:A.modelId)??null,id:(C=(M=i[0])==null?void 0:M.data)==null?void 0:C.id,_method:"getEditTemplate"});if(V.data)if(V.data.type.includes("navigation"))switch(V.data.type){case"navigation.group":T(V.data.data),E("navigation.group"),Me(!1);break;case"navigation.link":T(V.data.data),E("navigation.link"),Me(!1);break}else switch(V.data.type){case"model":const j=V.data.data.item,F=await W.get(`${window.routePrefix}/model/${j.type}/edit/${j.modelId}?without_layout=true`);Pi(F.data),Lt(j.targetBlank),Di(j.visible),E("model"),Me(!1);break;default:(async()=>{const jt=(await import(V.data.data.path)).default;We(m.jsx(jt,{callback:_t=>{var ot;(ot=p.current)==null||ot.close(),Vt(_t)},update:!0,item:V.data.data.item},`${V.data.data.id}-${V.data.data.item.name}`))})(),E("component"),Me(!1);break}}catch(V){console.log(V)}},[i]),ec=v.useCallback(async()=>{if(i.length)try{for(const x of i)if((await W.delete("",{data:x})).data.data.ok){let D=[...n];const A=(M,C)=>{let V=C.filter(F=>F.id!==M);return C.filter(F=>F.parent===M).forEach(F=>{V=A(F.id,V)}),V};i.forEach(M=>{D=A(M.id,D)}),r(D)}}catch(x){console.error("Error deleting node:",x)}finally{s([]),de(0)}},[i,n]),tc=v.useCallback(x=>{if(x.type.includes("navigation"))switch(x.type){case"model":b(x.data),E("model");break;case"navigation.group":T(x.data),E("navigation.group");break;case"navigation.link":T(x.data),E("navigation.link");break}else switch(x.type){case"model":b(x.data),E("model");break;default:(async()=>{const A=(await import(x.data.path)).default;We(m.jsx(A,{parentId:J,callback:M=>{var C;(C=p.current)==null||C.close(),Vt(M)}},JSON.stringify(new Date)))})(),E("component");break}},[i,q]),nc=v.useCallback(async x=>{var D;Oi(!0);const P=await W.get(`${window.routePrefix}/model/${x}/add?without_layout=true'`);Pi(P.data),(D=p.current)==null||D.next(),Oi(!1)},[k]),rc=async(x,P,D)=>{var A;P&&(x.targetBlank=P),D&&(x.visible=D);try{await W.post("",{data:{record:x,parentId:J,type:k},_method:"createItem"})}catch(M){console.log(M)}finally{(A=p.current)==null||A.close(),Vt()}},ic=v.useCallback(async(x,P,D)=>{var A,M,C,V,j,F,Re;P&&(x[0].targetBlank=P),D&&(x[0].visible=D),x[0].treeId=(M=(A=i[0])==null?void 0:A.data)==null?void 0:M.id;try{const ge=await W.put("",{type:(V=(C=i[0])==null?void 0:C.data)==null?void 0:V.type,data:{record:x[0]},modelId:(F=(j=i[0])==null?void 0:j.data)==null?void 0:F.modelId,_method:"updateItem"});r(jt=>{const{modelId:_t,type:ot,name:lc}=ge.data.data;return _t===void 0||ot===void 0?(console.warn("No modelId or type in response!"),jt):jt.map(at=>{var Ni,ki;return((Ni=at.data)==null?void 0:Ni.modelId)===_t&&((ki=at.data)==null?void 0:ki.type)===ot?{...at,text:lc,data:{...at.data,...ge.data.data,visible:ge.data.data.visible??!1}}:at})})}catch(ge){console.error("Error updating model:",ge)}finally{(Re=p.current)==null||Re.close()}},[i,r,n]),Mi=async x=>{if(s([]),In(!0),!x.trim()){const P=await W.post("",{_method:"getCatalog"}),{catalog:D}=P.data;r(D.nodes),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var A,M;t.current&&((M=(A=t.current).closeAll)==null||M.call(A),In(!1))})});return}try{const P=await W.post("",{s:x,_method:"search"});r(P.data.data),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var D,A;t.current&&((A=(D=t.current).openAll)==null||A.call(D),In(!1))})})}catch(P){console.error("Error searching:",P)}},sc=Ac(Mi,500),oc=v.useCallback((x,P)=>{if(x){const D=i.some(A=>A.id===P.id);s([]),D||(Ii(P),ac(P))}},[]),ac=v.useCallback(async x=>{var P,D;Ci([]),Ei(!0);try{const A=await W.post("",{items:[x],type:"context",_method:"getActions"});A.data&&((D=(P=A==null?void 0:A.data)==null?void 0:P.data)!=null&&D.length)&&Ci(A.data.data)}catch(A){console.error(A)}finally{Ei(!1)}},[]),Mn=v.useCallback(async x=>{var A,M;const P=st.find(C=>C.id===x)??On.find(C=>C.id===x);if(!P)return;let D=null;switch(P.type){case"link":try{D=await W.put("",{actionId:P.id,_method:"getLink"}),D.data&&((A=window.open(`${D.data.data}`,"_blank"))==null||A.focus())}catch(V){console.error(V)}break;case"basic":let C={actionID:P.id,items:i,data:""};try{Li.warning(u["Performing an action..."]),await W.put("",{data:C,_method:"handleAction"})}catch(V){console.error(V)}finally{Li.success(u["Action completed"])}break;case"external":try{const V=await W.put("",{actionId:P.id,_method:"getPopUpTemplate"});V.data&&((async()=>{const Re=(await import(V.data.data)).default;Hl(m.jsx(Re,{items:i,callback:()=>{var ge;(ge=p.current)==null||ge.close()}},JSON.stringify(i)))})(),(M=p.current)==null||M.open(),_("action"))}catch(V){console.error(V)}break}},[st,i,On]);return m.jsx(m.Fragment,{children:h?m.jsxs(m.Fragment,{children:[m.jsx(Nn,{className:"h-12 w-1/4 rounded-md"}),m.jsx(Nn,{className:"h-12 w-full rounded-md"}),m.jsx(Nn,{className:"h-full w-full rounded-md"})]}):m.jsxs(zl.Provider,{value:{messages:u,setMessages:d},children:[m.jsx(gc,{position:"top-center",richColors:!0,closeButton:!0}),m.jsxs("div",{className:"flex gap-8 items-center mb-4",children:[m.jsx("h1",{className:"text-[28px] leading-[36px] text-foreground",children:u[o.catalogName]}),o.idList.length>0&&m.jsxs(Rr,{defaultValue:o.catalogId,onValueChange:x=>{mc.get(`${window.routePrefix}/catalog/${o.catalogSlug}/${x}`)},children:[m.jsx(Nr,{className:"w-full max-w-[170px] cursor-pointer",children:m.jsx(kr,{placeholder:u["Select Ids"]})}),m.jsx(Lr,{children:o.idList.map(x=>m.jsx(Vr,{value:x,children:x},x))})]})]}),m.jsxs("div",{className:"xl:gap-10 justify-between flex flex-col xl:flex-row gap-3.5",children:[m.jsxs("div",{className:"flex gap-2 items-center",children:[m.jsxs("div",{className:"flex gap-2 items-center flex-wrap md:flex-nowrap",children:[m.jsxs(we,{variant:"default",size:"sm",className:`w-fit rounded-sm ${i.length===0||i.length===1&&((Ri=i[0])!=null&&Ri.droppable)?"":"opacity-50 pointer-events-none"}`,onClick:()=>{var x;_("create"),(x=p.current)==null||x.open()},children:[m.jsx(Eo,{}),u.create]}),m.jsxs(we,{variant:"outline",size:"sm",className:`w-fit cursor-pointer rounded-sm ${i.length>1||!i.length?"opacity-50 pointer-events-none":""}`,onClick:()=>{var x;Ai(),_("update"),(x=p.current)==null||x.open()},children:[m.jsx(vc,{}),u.Edit]}),m.jsx(Mc,{btnTitle:u.Delete,ref:e,variant:"destructive",btnCLass:`w-fit text-white hover ${i.length?"":"opacity-50 pointer-events-none"}`,delModal:{yes:u.Yes,no:u.No,text:u["Are you sure?"]},isLink:!1,handleDelete:ec}),m.jsxs(we,{variant:"secondary",size:"sm",className:`w-fit cursor-pointer rounded-sm ${i.length?"":"opacity-50 pointer-events-none"}`,onClick:()=>{de(0),s([])},children:[m.jsx(yc,{}),u.Clean]})]}),m.jsxs("div",{className:"ml-4",children:[m.jsx("div",{className:"hidden lg:flex gap-2",children:st.map(x=>m.jsxs(we,{variant:"outline",size:"sm",onClick:()=>Mn(x.id),children:[m.jsx(an,{name:x.icon}),x.name]},x.id))}),st.length>0&&m.jsx("div",{className:"block lg:hidden",children:m.jsxs(bc,{children:[m.jsx(xc,{asChild:!0,children:m.jsx(we,{variant:"outline",size:"icon",children:m.jsx(Tc,{})})}),m.jsx(Sc,{className:"w-fit",side:"right",align:"start",children:m.jsx(wc,{className:"grid gap-2",children:st.map(x=>m.jsxs(we,{variant:"outline",size:"sm",onClick:()=>Mn(x.id),children:[m.jsx(an,{name:x.icon}),x.name]},x.id))})})]})})]})]}),m.jsxs("div",{className:"flex gap-2 items-center justify-start xl:justify-end",children:[Gl&&m.jsx(Be,{className:"size-4 animate-spin order-2 xl:order-1"}),m.jsx(rr,{type:"search",autoFocus:!1,placeholder:u.Search,className:"w-[200px] p-2 border rounded order-1 xl:order-2",onChange:x=>{sc(x.target.value)},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),Mi(x.currentTarget.value))}})]})]}),m.jsx("div",{className:"h-full",children:m.jsx(lm,{backend:Um,options:fv(),children:m.jsx("div",{className:nr.app,children:m.jsx(Iv,{ref:t,tree:n,rootId:0,render:(x,{depth:P,isOpen:D,onToggle:A})=>{var M;return m.jsxs(Dc,{onOpenChange:C=>oc(C,x),children:[m.jsx(Cc,{children:m.jsx(Lv,{node:x,depth:P,isOpen:D,loading:w===x.id,isSelected:!!i.find(C=>C.id===x.id),onToggle:C=>{A(),An(C,!D)},onSelect:Ii})}),m.jsxs(Ec,{children:[m.jsx(Bt,{className:`${(M=i[0])!=null&&M.droppable?"":"opacity-50 pointer-events-none"}`,onClick:()=>{var C;_("create"),(C=p.current)==null||C.open()},children:u.create}),m.jsx(Bt,{onClick:()=>{var C;Ai(),_("update"),(C=p.current)==null||C.open()},children:u.Edit}),m.jsx(Bt,{variant:"destructive",onClick:()=>{var C;document.body.removeAttribute("style"),(C=e.current)==null||C.click()},className:i.length?"":"opacity-50 pointer-events-none",children:u.Delete}),Wl?m.jsx(Be,{className:"mx-auto size-3 animate-spin"}):On.map(C=>m.jsx(Bt,{onClick:()=>Mn(C.id),children:C.name},C.id))]})]})},dropTargetOffset:5,insertDroppableFirst:!1,classes:{draggingSource:nr.draggingSource,dropTarget:"bg-chart-1/30",placeholder:nr.placeholderContainer,root:"py-4"},canDrop:(x,{dragSource:P,dropTargetId:D})=>{if((P==null?void 0:P.parent)===D)return!0},sort:!1,dragPreviewRender:x=>m.jsx(Bv,{monitorProps:x}),onDrop:Zl,placeholderRender:(x,{depth:P})=>m.jsx(Wv,{node:x,depth:P}),rootProps:{onClick:Yl}})})})}),m.jsx(Kv,{dialogRef:p,PopupEvent:U,firstRender:Kl,secondRender:Xl,popupType:S,addProps:ql,editModel:ic,popUpTargetBlank:Pn,popUpVisible:wi,isNavigation:q,messages:u,DynamicComponent:it,DynamicActionComponent:Ul,addLinksGroupProps:y,reloadCatalog:Vt,itemType:k,parentid:J,addItemProps:g,getAddModelJSON:nc,addModel:rc,items:l,selectCatalogItem:Ql})]})})},Yv=[];function Ty(){return m.jsx(Pc,{breadcrumbs:Yv,children:m.jsx("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:m.jsx(Xv,{})})})}export{Ty as default};
6
+ see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-2xx`);Ve(this,gt,new Fm),Ve(this,ee,{}),Ve(this,me,[]);for(let i of r.backends){let s=N(this,Er).call(this,e,n,i);N(this,ee)[s.id]=s,N(this,me).push(s)}Ve(this,Q,N(this,me)[0].id),Ve(this,je,{})}};Q=new WeakMap,gt=new WeakMap,ee=new WeakMap,me=new WeakMap,je=new WeakMap,Er=new WeakMap,Pr=new WeakMap,Or=new WeakMap,tn=new WeakMap,nn=new WeakMap,mt=new WeakMap,Ml.isSetUp=!1;var zm=Ml,Um=(t,e,n)=>new zm(t,e,n),Rl=(t,e)=>({event:t,check:e}),Hm=Rl("touchstart",t=>{let e=t;return e.touches!==null&&e.touches!==void 0}),$m=Rl("pointerdown",t=>t.pointerType==="mouse"),Ce;(function(t){t.mouse="mouse",t.touch="touch",t.keyboard="keyboard"})(Ce||(Ce={}));class Wm{get delay(){var e;return(e=this.args.delay)!==null&&e!==void 0?e:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var e;return(e=this.args.ignoreContextMenu)!==null&&e!==void 0?e:!1}get enableHoverOutsideTarget(){var e;return(e=this.args.enableHoverOutsideTarget)!==null&&e!==void 0?e:!1}get enableKeyboardEvents(){var e;return(e=this.args.enableKeyboardEvents)!==null&&e!==void 0?e:!1}get enableMouseEvents(){var e;return(e=this.args.enableMouseEvents)!==null&&e!==void 0?e:!1}get enableTouchEvents(){var e;return(e=this.args.enableTouchEvents)!==null&&e!==void 0?e:!0}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var e,n,r,i;return(i=(r=(e=this.args)===null||e===void 0?void 0:e.delayTouchStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&i!==void 0?i:0}get delayMouseStart(){var e,n,r,i;return(i=(r=(e=this.args)===null||e===void 0?void 0:e.delayMouseStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&i!==void 0?i:0}get window(){if(this.context&&this.context.window)return this.context.window;if(typeof window<"u")return window}get document(){var e;if(!((e=this.context)===null||e===void 0)&&e.document)return this.context.document;if(this.window)return this.window.document}get rootElement(){var e;return((e=this.args)===null||e===void 0?void 0:e.rootElement)||this.document}constructor(e,n){this.args=e,this.context=n}}function Gm(t,e,n,r){return Math.sqrt(Math.pow(Math.abs(n-t),2)+Math.pow(Math.abs(r-e),2))}function qm(t,e,n,r,i){if(!i)return!1;const s=Math.atan2(r-e,n-t)*180/Math.PI+180;for(let o=0;o<i.length;++o){const a=i[o];if(a&&(a.start==null||s>=a.start)&&(a.end==null||s<=a.end))return!0}return!1}const Km={Left:1},Xm={Left:0};function er(t){return t.button===void 0||t.button===Xm.Left}function Ym(t){return t.buttons===void 0||(t.buttons&Km.Left)===0}function Nl(t){return!!t.targetTouches}const Zm=1;function Jm(t){const e=t.nodeType===Zm?t:t.parentElement;if(!e)return;const{top:n,left:r}=e.getBoundingClientRect();return{x:r,y:n}}function Qm(t,e){if(t.targetTouches.length===1)return gn(t.targetTouches[0]);if(e&&t.touches.length===1&&t.touches[0].target===e.target)return gn(t.touches[0])}function gn(t,e){return Nl(t)?Qm(t,e):{x:t.clientX,y:t.clientY}}const To=(()=>{let t=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return t=!0,!0}}))}catch{}return t})(),ct={[Ce.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[Ce.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[Ce.keyboard]:{keydown:"keydown"}};class wt{profile(){var e;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((e=this.dragOverTargetIds)===null||e===void 0?void 0:e.length)||0}}get document(){return this.options.document}setup(){const e=this.options.rootElement;e&&(L(!wt.isSetUp,"Cannot have two Touch backends at the same time."),wt.isSetUp=!0,this.addEventListener(e,"start",this.getTopMoveStartHandler()),this.addEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(e,"move",this.handleTopMove),this.addEventListener(e,"move",this.handleTopMoveCapture,!0),this.addEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(e,"keydown",this.handleCancelOnEscape,!0))}teardown(){const e=this.options.rootElement;e&&(wt.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(e,"start",this.handleTopMoveStart),this.removeEventListener(e,"move",this.handleTopMoveCapture,!0),this.removeEventListener(e,"move",this.handleTopMove),this.removeEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(e,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(e,n,r,i=!1){const s=To?{capture:i,passive:!1}:i;this.listenerTypes.forEach(function(o){const a=ct[o][n];a&&e.addEventListener(a,r,s)})}removeEventListener(e,n,r,i=!1){const s=To?{capture:i,passive:!1}:i;this.listenerTypes.forEach(function(o){const a=ct[o][n];a&&e.removeEventListener(a,r,s)})}connectDragSource(e,n){const r=this.handleMoveStart.bind(this,e);return this.sourceNodes.set(e,n),this.addEventListener(n,"start",r),()=>{this.sourceNodes.delete(e),this.removeEventListener(n,"start",r)}}connectDragPreview(e,n,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,n),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDropTarget(e,n){const r=this.options.rootElement;if(!this.document||!r)return()=>{};const i=s=>{if(!this.document||!r||!this.monitor.isDragging())return;let o;switch(s.type){case ct.mouse.move:o={x:s.clientX,y:s.clientY};break;case ct.touch.move:var a,l;o={x:((a=s.touches[0])===null||a===void 0?void 0:a.clientX)||0,y:((l=s.touches[0])===null||l===void 0?void 0:l.clientY)||0};break}const c=o!=null?this.document.elementFromPoint(o.x,o.y):void 0,u=c&&n.contains(c);if(c===n||u)return this.handleMove(s,e)};return this.addEventListener(this.document.body,"move",i),this.targetNodes.set(e,n),()=>{this.document&&(this.targetNodes.delete(e),this.removeEventListener(this.document.body,"move",i))}}getTopMoveStartHandler(){return!this.options.delayTouchStart&&!this.options.delayMouseStart?this.handleTopMoveStart:this.handleTopMoveStartDelay}installSourceNodeRemovalObserver(e){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=e,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{e&&!e.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),!(!e||!e.parentElement)&&this.draggedSourceNodeRemovalObserver.observe(e.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(e,n,r){this.getSourceClientOffset=i=>{const s=this.sourceNodes.get(i);return s&&Jm(s)},this.handleTopMoveStartCapture=i=>{er(i)&&(this.moveStartSourceIds=[])},this.handleMoveStart=i=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(i)},this.handleTopMoveStart=i=>{if(!er(i))return;const s=gn(i);s&&(Nl(i)&&(this.lastTargetTouchFallback=i.targetTouches[0]),this._mouseClientOffset=s),this.waitingForDelay=!1},this.handleTopMoveStartDelay=i=>{if(!er(i))return;const s=i.type===ct.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,i),s),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(i,s)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(s)},this.handleTopMove=i=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:s,dragOverTargetIds:o}=this,a=this.options.enableHoverOutsideTarget,l=gn(i,this.lastTargetTouchFallback);if(!l)return;if(this._isScrolling||!this.monitor.isDragging()&&qm(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,l.x,l.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&s&&Gm(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,l.x,l.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(s,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const c=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(c),this.actions.publishDragSource(),i.cancelable&&i.preventDefault();const u=(o||[]).map(p=>this.targetNodes.get(p)).filter(p=>!!p),d=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(l.x,l.y,u):this.document.elementsFromPoint(l.x,l.y),h=[];for(const p in d){if(!d.hasOwnProperty(p))continue;let g=d[p];for(g!=null&&h.push(g);g;)g=g.parentElement,g&&h.indexOf(g)===-1&&h.push(g)}const f=h.filter(p=>u.indexOf(p)>-1).map(p=>this._getDropTargetId(p)).filter(p=>!!p).filter((p,g,b)=>b.indexOf(p)===g);if(a)for(const p in this.targetNodes){const g=this.targetNodes.get(p);if(c&&g&&g.contains(c)&&f.indexOf(p)===-1){f.unshift(p);break}}f.reverse(),this.actions.hover(f,{clientOffset:l})},this._getDropTargetId=i=>{const s=this.targetNodes.keys();let o=s.next();for(;o.done===!1;){const a=o.value;if(i===this.targetNodes.get(a))return a;o=s.next()}},this.handleTopMoveEndCapture=i=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!Ym(i)){if(!this.monitor.isDragging()||this.monitor.didDrop()){this.moveStartSourceIds=void 0;return}i.cancelable&&i.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()}},this.handleCancelOnEscape=i=>{i.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new Wm(r,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(Ce.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(Ce.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(Ce.keyboard)}}const ev=function(e,n={},r={}){return new wt(e,n,r)};var le=function(){return le=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},le.apply(this,arguments)};function Z(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function tv(t){var e=t.isVisible,n=t.ease,r=n===void 0?"easeIn":n,i=t.duration,s=t.variants,o=s===void 0?{open:{opacity:1,height:"auto"},close:{opacity:0,height:0}}:s,a=t.children,l=zp({polyfill:fu}),c=l[0],u=l[1].height,d=v.useState(e),h=d[0],f=d[1],p=v.useState(e),g=p[0],b=p[1],y=v.useState(!1),T=y[0],S=y[1],E=function(){S(!1),e||f(!1)};v.useEffect(function(){S(!0),e?f(!0):b(!1)},[e]);var w=u===0;return v.useEffect(function(){h&&b(!0)},[w]),z.createElement(Fp.div,{style:T?{overflow:"hidden"}:void 0,onAnimationComplete:E,initial:g?"open":"close",animate:g?"open":"close",inherit:!1,variants:o,transition:{ease:r,duration:nv(u,i)}},z.createElement("div",{ref:c},h&&a))}function nv(t,e){if(e)return e;if(!t)return 0;var n=t/36;return Math.round((4+10*Math.pow(n,.25)+n/5)*10)/1500}var kl=v.createContext({}),rv={isLock:!1},iv=function(t){var e=v.useState(rv.isLock),n=e[0],r=e[1];return z.createElement(kl.Provider,{value:{isLock:n,lock:function(){return r(!0)},unlock:function(){return r(!1)}}},t.children)},kt=v.createContext({}),Kt={dropTargetId:void 0,index:void 0},sv=function(t){var e=v.useState(Kt.dropTargetId),n=e[0],r=e[1],i=v.useState(Kt.index),s=i[0],o=i[1],a=function(c,u){r(c),o(u)},l=function(){r(Kt.dropTargetId),o(Kt.index)};return z.createElement(kt.Provider,{value:{dropTargetId:n,index:s,showPlaceholder:a,hidePlaceholder:l}},t.children)},ov=function(t,e){return t.text>e.text?1:t.text<e.text?-1:0},ut=function(t,e){return t.find(function(n){return n.id===e})},Ll=function(t,e,n){if(n===0)return!1;var r=t.find(function(i){return i.id===n});return r===void 0?!1:r.parent===e?!0:Ll(t,e,r.parent)},Si=function(t){return typeof t=="object"&&t!==null&&"id"in t&&"parent"in t&&"text"in t},Oe=function(t,e,n){var r=n.tree,i=n.rootId,s=n.canDrop;if(t===null){if(e===i)return!0;var o=r.find(function(u){return u.id===e});return!!(o&&o.droppable)}else{var a=Si(t)?t.id:null;if(s){var l=s(a,e);if(l!==void 0)return l}if(a===e)return!1;var c=r.find(function(d){return d.id===a}),o=r.find(function(d){return d.id===e});return c===void 0||a===null?e===i||!!(o!=null&&o.droppable):o===void 0?c.parent!==0:c.parent===e||!o.droppable?!1:!Ll(r,a,e)}},av=function(t,e,n){return t.map(function(r){return r.id===e?le(le({},r),{parent:n}):r})},Vl=function(t,e,n){if(n===0)return 0;var r=t.filter(function(i){return i.parent===e});return r[n]?t.findIndex(function(i){return i.id===r[n].id}):t.findIndex(function(i){return i.id===r[n-1].id})+1},lv=function(t,e){return t.findIndex(function(n){return n.id===e})},jl=function(t,e,n,r){var i=lv(t,e),s=Vl(t,n,r);return s=s>i?s-1:s,[i,s]},cv=function(t,e,n){var r=e<0?t.length+e:e;if(r>=0&&r<t.length){var i=n<0?t.length+n:n,s=t.splice(e,1)[0];t.splice(i,0,s)}},uv=function(t,e,n,r){var i=jl(t,e,n,r),s=i[0],o=i[1],a=Z([],t,!0);return cv(a,s,o),a.map(function(l){return l.id===e?le(le({},l),{parent:n}):l})},dv=function(t,e){var n=t.getBoundingClientRect(),r=n.top+n.height/2;return e>r?"down":"up"},Ir=function(t,e){var n="",r=0;return t.forEach(function(i,s){var o,a=dv(i,((o=e.getClientOffset())===null||o===void 0?void 0:o.y)||0);n===""?n=a:n!==a&&(n=a,r=s),s===t.length-1&&a==="down"&&(r=s+1)}),r},So=function(t,e,n){var r=e.closest('[role="list"]'),i=r==null?void 0:r.querySelectorAll(':scope > [role="listitem"]');return i?Ir(i,n):null},hv=function(t,e,n){var r=t.getBoundingClientRect(),i=n.dropTargetOffset;if(i===0)return"middle";var s=r.top+i,o=r.bottom-i;return e>o?"lower":e<s?"upper":"middle"},Ar=function(t,e,n,r){var i;if(!e)return null;if(t===null){var s=e.querySelectorAll(':scope > [role="listitem"]');return{id:r.rootId,index:Ir(s,n)}}var o=n.getItem(),a=e.querySelector('[role="list"]'),l=hv(e,((i=n.getClientOffset())===null||i===void 0?void 0:i.y)||0,r);if(a){if(l==="upper")if(Oe(o,t.parent,r)){var c=So(t,e,n);return c===null?null:{id:t.parent,index:c}}else return{id:t.id,index:0};var s=a.querySelectorAll(':scope > [role="listitem"]');return{id:t.id,index:Ir(s,n)}}else{if(l==="middle")return{id:t.id,index:0};if(Oe(o,t.parent,r)){var c=So(t,e,n);return c===null?null:{id:t.parent,index:c}}return null}},fv=function(t){return t===void 0&&(t={}),{backends:[{id:"html5",backend:Gc,options:t.html5,transition:$m},{id:"touch",backend:ev,options:t.touch||{enableMouseEvents:!0},preview:!0,transition:Hm}]}},sn=function(t,e){return t.some(function(n){return n.parent===e})},_l=v.createContext({}),pv=function(t){var e=xv(t.tree,t.initialOpen),n=e[0],r=e[1],i=r.handleToggle,s=r.handleCloseAll,o=r.handleOpenAll,a=r.handleOpen,l=r.handleClose;v.useImperativeHandle(t.treeRef,function(){return{open:function(f){return a(f,t.onChangeOpen)},close:function(f){return l(f,t.onChangeOpen)},openAll:function(){return o(t.onChangeOpen)},closeAll:function(){return s(t.onChangeOpen)}}});var c=xe().getMonitor(),u=t.canDrop,d=t.canDrag,h=le(le({extraAcceptTypes:[],listComponent:"ul",listItemComponent:"li",placeholderComponent:"li",sort:!0,insertDroppableFirst:!0,enableAnimateExpand:!1,dropTargetOffset:0,initialOpen:!1},t),{openIds:n,onDrop:function(f,p,g){if(f){var b={dragSourceId:f.id,dropTargetId:p,dragSource:f,dropTarget:ut(t.tree,p),monitor:c},y=t.tree;if(ut(y,f.id)||(y=Z(Z([],y,!0),[f],!1)),t.sort===!1){var T=jl(y,f.id,p,g),S=T[1];b.destinationIndex=S,b.relativeIndex=g,t.onDrop(uv(y,f.id,p,g),b);return}t.onDrop(av(y,f.id,p),b)}else{var b={dropTargetId:p,dropTarget:ut(t.tree,p),monitor:c};t.sort===!1&&(b.destinationIndex=Vl(t.tree,p,g),b.relativeIndex=g),t.onDrop(t.tree,b)}},canDrop:u?function(f,p){return u(t.tree,{dragSourceId:f??void 0,dropTargetId:p,dragSource:c.getItem(),dropTarget:ut(t.tree,p),monitor:c})}:void 0,canDrag:d?function(f){return d(ut(t.tree,f))}:void 0,onToggle:function(f){return i(f,t.onChangeOpen)}});return z.createElement(_l.Provider,{value:h},t.children)},gv=function(t){return z.createElement(pv,le({},t),z.createElement(iv,null,z.createElement(sv,null,t.children)))},mv=function(t){var e=v.useContext(kl);v.useEffect(function(){if(t.current){var n=t.current,r=function(u){var d=u.target;(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement)&&e.lock()},i=function(u){var d=u.target;(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement)&&e.unlock()},s=function(u){return r(u)},o=function(u){return i(u)},a=function(u){return r(u)},l=function(u){return i(u)},c=new MutationObserver(function(){document.activeElement===document.body&&e.unlock()});return c.observe(n,{subtree:!0,childList:!0}),n.addEventListener("mouseover",s),n.addEventListener("mouseout",o),n.addEventListener("focusin",a),n.addEventListener("focusout",l),function(){c.disconnect(),n.removeEventListener("mouseover",s),n.removeEventListener("mouseout",o),n.removeEventListener("focusin",a),n.removeEventListener("focusout",l)}}},[t,e]),v.useEffect(function(){var n;(n=t.current)===null||n===void 0||n.setAttribute("draggable",e.isLock?"false":"true")},[t,e.isLock])},En={TREE_ITEM:Symbol()},Bl=null,Fl=function(t){var e=t.target;if(e instanceof HTMLElement){var n=e.closest('[role="listitem"]');t.currentTarget===n&&(Bl=n)}},wo=function(t){return Fl(t)},Do=function(t){return Fl(t)},vv=function(t,e){var n=Ae();v.useEffect(function(){var a=e.current;return a==null||a.addEventListener("dragstart",wo),a==null||a.addEventListener("touchstart",Do,{passive:!0}),function(){a==null||a.removeEventListener("dragstart",wo),a==null||a.removeEventListener("touchstart",Do)}},[e]);var r=Mm({type:En.TREE_ITEM,item:function(a){var l=le({ref:e},t);return n.onDragStart&&n.onDragStart(l,a),l},end:function(a,l){var c=a;n.onDragEnd&&n.onDragEnd(c,l)},canDrag:function(){var a=n.canDrag;return Bl!==e.current?!1:a?a(t.id):!0},collect:function(a){return{isDragging:a.isDragging()}}}),i=r[0].isDragging,s=r[1],o=r[2];return[i,s,o]},yv=function(t){var e=Ae(),n=v.useContext(kt),r=Ol({accept:Z([En.TREE_ITEM],e.extraAcceptTypes,!0),drop:function(l,c){var u=e.rootId,d=e.onDrop,h=n.dropTargetId,f=n.index;c.isOver({shallow:!0})&&h!==void 0&&f!==void 0&&d(Si(l)?l:null,u,f),n.hidePlaceholder()},canDrop:function(l,c){var u=e.rootId;return c.isOver({shallow:!0})?l===void 0?!1:Oe(l,u,e):!1},hover:function(l,c){if(c.isOver({shallow:!0})){var u=e.rootId,d=n.dropTargetId,h=n.index,f=n.showPlaceholder,p=n.hidePlaceholder,g=Ar(null,t.current,c,e);if(g===null||!Oe(l,u,e)){p();return}(g.id!==d||g.index!==h)&&f(g.id,g.index)}},collect:function(l){var c=l.getItem();return{isOver:l.isOver({shallow:!0})&&l.canDrop(),dragSource:c}}}),i=r[0],s=i.isOver,o=i.dragSource,a=r[1];return[s,o,a]},bv=function(t,e){var n=Ae(),r=v.useContext(kt),i=Ol({accept:Z([En.TREE_ITEM],n.extraAcceptTypes,!0),drop:function(c,u){var d=r.dropTargetId,h=r.index;u.isOver({shallow:!0})&&d!==void 0&&h!==void 0&&n.onDrop(Si(c)?c:null,d,h),r.hidePlaceholder()},canDrop:function(c,u){if(u.isOver({shallow:!0})){var d=Ar(t,e.current,u,n);return d===null?!1:Oe(c,d.id,n)}return!1},hover:function(c,u){if(u.isOver({shallow:!0})){var d=r.dropTargetId,h=r.index,f=r.showPlaceholder,p=r.hidePlaceholder,g=Ar(t,e.current,u,n);if(g===null||!Oe(c,g.id,n)){p();return}(g.id!==d||g.index!==h)&&f(g.id,g.index)}},collect:function(c){var u=c.getItem();return{isOver:c.isOver({shallow:!0})&&c.canDrop(),dragSource:u}}}),s=i[0],o=s.isOver,a=s.dragSource,l=i[1];return[o,a,l]},xv=function(t,e){var n=v.useMemo(function(){return e===!0?t.filter(function(d){return sn(t,d.id)}).map(function(d){return d.id}):Array.isArray(e)?e:[]},[e]),r=v.useState(n),i=r[0],s=r[1];v.useEffect(function(){return s(n)},[n]);var o=function(d,h){var f=i.includes(d)?i.filter(function(p){return p!==d}):Z(Z([],i,!0),[d],!1);s(f),h&&h(f)},a=function(d){s([]),d&&d([])},l=function(d){var h=t.filter(function(f){return sn(t,f.id)}).map(function(f){return f.id});s(h),d&&d(h)},c=function(d,h){var f=[];if(Array.isArray(d)){var p=t.filter(function(g){return d.includes(g.id)&&sn(t,g.id)});f=Z(Z([],i,!0),p.map(function(g){return g.id}),!0).filter(function(g,b,y){return y.indexOf(g)===b})}else f=i.includes(d)?i:Z(Z([],i,!0),[d],!1);s(f),h&&h(f)},u=function(d,h){var f=i.filter(function(p){return Array.isArray(d)?!d.includes(p):p!==d});s(f),h&&h(f)};return[i,{handleToggle:o,handleCloseAll:a,handleOpenAll:l,handleOpen:c,handleClose:u}]},Tv=function(){return Rm(function(t){var e=t.getItemType();return{item:t.getItem(),clientOffset:t.getClientOffset(),isDragging:t.isDragging()&&e===En.TREE_ITEM}})},Ae=function(){var t=v.useContext(_l);if(!t)throw new Error("useTreeContext must be used under TreeProvider");return t},Sv=function(t,e){var n=Ae(),r=n.rootId,i=n.rootProps,s=n.classes,o=(s==null?void 0:s.container)||"";return e&&(s!=null&&s.dropTarget)&&(o="".concat(o," ").concat(s.dropTarget)),t===r&&(s!=null&&s.root)&&(o="".concat(o," ").concat(s.root)),t===r&&(i!=null&&i.className)&&(o="".concat(o," ").concat(i.className)),o=o.trim(),o},wv=function(t,e,n){e.current?n(e):n(t),v.useEffect(function(){e.current?n(e):n(t)},[e.current])},Dv=function(t){var e=Ae(),n=v.useContext(kt),r=v.useRef(null),i=v.useRef(null),s=e.tree.find(function(R){return R.id===t.id}),o=e.openIds,a=e.classes,l=e.enableAnimateExpand,c=o.includes(t.id),u=vv(s,r),d=u[0],h=u[1],f=u[2],p=bv(s,r),g=p[0],b=p[1],y=p[2];wv(r,i,h),Oe(b,t.id,e)&&y(r),v.useEffect(function(){e.dragPreviewRender?f(Wc(),{captureDraggingState:!0}):i.current&&f(r)},[f,e.dragPreviewRender]),mv(r);var T=v.useCallback(function(){e.onToggle(s.id)},[s.id,e]),S=e.listItemComponent,E=e.canDrag?e.canDrag(t.id):!0,w=n.dropTargetId===t.id,O={depth:t.depth,isOpen:c,isDragging:d,isDropTarget:w,draggable:E,hasChild:sn(e.tree,t.id),containerRef:r,handleRef:i,onToggle:T},k="";return a!=null&&a.listItem&&(k=typeof a.listItem=="string"?a.listItem:a.listItem(s,O)),g&&(a!=null&&a.dropTarget)&&(k="".concat(k," ").concat(a.dropTarget)),d&&(a!=null&&a.draggingSource)&&(k="".concat(k," ").concat(a.draggingSource)),z.createElement(S,{ref:r,className:k,role:"listitem"},e.render(s,O),l&&O.hasChild&&z.createElement(tv,{isVisible:c},z.createElement(Mr,{parentId:t.id,depth:t.depth+1})),!l&&O.hasChild&&c&&z.createElement(Mr,{parentId:t.id,depth:t.depth+1}))},Co=function(t){var e=Ae(),n=e.placeholderRender,r=e.placeholderComponent,i=e.classes,s=v.useContext(kt),o=xe(),a=o.getMonitor(),l=a.getItem();if(!n||!l)return null;var c=t.dropTargetId===s.dropTargetId&&(t.index===s.index||t.index===void 0&&t.listCount===s.index),u=a.getTargetIds();return!c||!u.length?null:z.createElement(r,{className:(i==null?void 0:i.placeholder)||""},n(l,{depth:t.depth}))},Mr=function(t){var e=Ae(),n=v.useRef(null),r=e.tree.filter(function(g){return g.parent===t.parentId}),i=r,s=typeof e.sort=="function"?e.sort:ov;if(e.insertDroppableFirst){var o=r.filter(function(g){return g.droppable}),a=r.filter(function(g){return!g.droppable});e.sort===!1?i=Z(Z([],o,!0),a,!0):(o=o.sort(s),a=a.sort(s),i=Z(Z([],o,!0),a,!0))}else e.sort!==!1&&(i=r.sort(s));var l=yv(n),c=l[0],u=l[1],d=l[2];t.parentId===e.rootId&&Oe(u,e.rootId,e)&&d(n);var h=Sv(t.parentId,c),f=e.rootProps||{},p=e.listComponent;return z.createElement(p,le({ref:n,role:"list"},f,{className:h}),i.map(function(g,b){return z.createElement(z.Fragment,{key:g.id},z.createElement(Co,{depth:t.depth,listCount:i.length,dropTargetId:t.parentId,index:b}),z.createElement(Dv,{id:g.id,depth:t.depth}))}),z.createElement(Co,{depth:t.depth,listCount:i.length,dropTargetId:t.parentId}))},Cv={height:"100%",left:0,pointerEvents:"none",position:"fixed",top:0,width:"100%",zIndex:100},Ev=function(t){var e=t.clientOffset;if(!e)return{};var n=e.x,r=e.y,i="translate(".concat(n,"px, ").concat(r,"px)");return{pointerEvents:"none",transform:i}},Pv=function(){var t=Ae(),e=Tv(),n=e.isDragging,r=e.clientOffset;return!n||!r?null:z.createElement("div",{style:Cv},z.createElement("div",{style:Ev(e)},t.dragPreviewRender&&t.dragPreviewRender(e)))};function Ov(t,e){return z.createElement(gv,le({},t,{treeRef:e}),t.dragPreviewRender&&z.createElement(Pv,null),z.createElement(Mr,{parentId:t.rootId,depth:0}))}var Iv=v.forwardRef(Ov);const Av="_root_71whx_1",Mv="_isSelected_71whx_10",Rv="_expandIconWrapper_71whx_13",Nv="_isOpen_71whx_25",kv="_labelGridItem_71whx_29",dt={root:Av,isSelected:Mv,expandIconWrapper:Rv,isOpen:Nv,labelGridItem:kv},Lv=t=>{var i,s,o,a;const e=t.depth*24,n=l=>{l.stopPropagation(),t.onToggle(t.node.id)},r=()=>t.onSelect(t.node);return m.jsxs("div",{className:`tree-node ${dt.root} ${t.isSelected?dt.isSelected:""} ${(i=t.node.data)!=null&&i.marked?"bg-gray-200":""}`,style:{paddingInlineStart:e},onClick:r,children:[m.jsx("div",{className:`${dt.expandIconWrapper} ${t.isOpen?dt.isOpen:""}`,children:t.node.droppable&&m.jsx("div",{onClick:n,children:m.jsx(cc,{size:18})})}),m.jsxs("div",{className:"flex items-center gap-2",children:[((s=t.node.data)==null?void 0:s.isNavigation)&&((o=t.node.data)!=null&&o.visible?m.jsx(uc,{className:"size-5"}):m.jsx(dc,{className:"size-5"})),m.jsx(an,{name:((a=t.node.data)==null?void 0:a.icon)??"folder"})]}),m.jsx("div",{className:dt.labelGridItem,children:m.jsx("span",{children:t.node.text})}),t.loading&&m.jsx(Be,{className:"size-4 animate-spin"})]})},Vv="_root_ahb0f_1",jv="_icon_ahb0f_15",_v="_label_ahb0f_16",tr={root:Vv,icon:jv,label:_v},Bv=t=>{var n;const e=t.monitorProps.item;return m.jsxs("div",{className:`${tr.root} bg-chart-1/60`,children:[m.jsx("div",{className:tr.icon,children:m.jsx(an,{name:((n=e.data)==null?void 0:n.icon)??"folder"})}),m.jsx("div",{className:tr.label,children:e.text})]})},Fv="_app_gsniw_1",zv="_draggingSource_gsniw_9",Uv="_placeholderContainer_gsniw_13",nr={app:Fv,draggingSource:zv,placeholderContainer:Uv},Hv="_root_1hoix_1",$v={root:Hv},Wv=t=>{const e=t.depth*24;return m.jsx("div",{className:`${$v.root} bg-chart-3`,style:{left:e}})},zl=v.createContext({messages:{},setMessages:()=>{}}),Gv=({type:t,callback:e,parentId:n,isNavigation:r,...i})=>{const[s,o]=v.useState(!1),[a,l]=v.useState(!1),c=async u=>{try{(await W.post("",{data:{record:u,parentId:n,targetBlank:s,visible:a,_method:"select",type:t},_method:"createItem"})).data&&e()}catch(d){console.log(d)}};return m.jsxs("div",{className:"p-8",children:[m.jsxs("div",{className:"flex gap-4 flex-col",children:[m.jsxs("div",{className:`grid gap-4 ${i.items.length?"":"opacity-50 pointer-events-none"}`,children:[m.jsx(De,{children:i.labels.selectTitle}),m.jsxs(Rr,{onValueChange:c,children:[m.jsx(Nr,{className:"w-full max-w-[170px] cursor-pointer",children:m.jsx(kr,{placeholder:i.labels.selectTitle})}),m.jsx(Lr,{className:"z-[1003]",children:i.items.map(u=>m.jsx(Vr,{value:u.id.toString(),children:u.name},`${u.id}-${u.name}`))})]})]}),r&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex gap-4 items-center",children:[m.jsx(on,{id:"targetBlank",checked:s,onCheckedChange:u=>o(!!u),className:"cursor-pointer size-5"}),m.jsx(De,{htmlFor:"targetBlank",children:i.labels.openInNewWindow})]}),m.jsxs("div",{className:"flex gap-4 items-center",children:[m.jsx(on,{id:"visible",checked:a,onCheckedChange:u=>l(!!u),className:"cursor-pointer size-5"}),m.jsx(De,{htmlFor:"visible",children:i.labels.visible})]})]})]}),m.jsx("div",{className:"mt-8",children:m.jsx("span",{children:m.jsx("b",{children:i.labels.OR})})}),m.jsxs(we,{className:"mt-8",onClick:()=>i.add(i.model),children:[m.jsx(Eo,{}),i.labels.createTitle]})]})},Xt=({update:t=!1,type:e,parentId:n,...r})=>{const[i,s]=v.useState({}),[o,a]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(!1);v.useEffect(()=>{console.log(r)},[]),v.useEffect(()=>{r.item?(s({name:r.item.name||"",...Object.fromEntries(r.items.map(p=>[p.name,r.item?r.item[p.name]:""]))}),a(r.item.targetBlank||!1),c(r.item.visible||!1)):(s({name:"",...Object.fromEntries(r.items.map(p=>[p.name,""]))}),a(!1),c(!1))},[r.item,r.items]);const h=p=>{const{name:g,value:b}=p.target;s(y=>({...y,[g]:b}))},f=async p=>{var g,b;p.preventDefault(),d(!0);try{let y=null;t?(y=await W.put("",{type:(g=r.item)==null?void 0:g.type,modelId:(b=r.item)==null?void 0:b.id,data:{...r.item,...i,targetBlank:o,visible:l},_method:"updateItem"}),r.callback(y.data.data)):(await W.post("",{data:{...i,targetBlank:o,visible:l,parentId:n,type:e},_method:"createItem"}),r.callback(null))}catch(y){console.error(y)}finally{d(!1)}};return m.jsxs("div",{className:"p-8",children:[m.jsxs("form",{className:"grid gap-6",id:"group-add",onSubmit:f,children:[m.jsxs("div",{className:"flex gap-4 items-center",children:[m.jsx(on,{id:"targetBlank",checked:o,onCheckedChange:p=>a(!!p),className:"cursor-pointer size-5"}),m.jsx(De,{htmlFor:"targetBlank",children:r.labels.openInNewWindow})]}),m.jsxs("div",{className:"flex gap-4 items-center",children:[m.jsx(on,{id:"visible",checked:l,onCheckedChange:p=>c(!!p),className:"cursor-pointer size-5"}),m.jsx(De,{htmlFor:"visible",children:r.labels.visible})]}),m.jsxs("div",{className:"grid gap-4",children:[m.jsx(De,{htmlFor:"name",children:r.labels.title}),m.jsx(rr,{required:!0,value:i.name||"",name:"name",placeholder:r.labels.title,onChange:h})]}),r.items.map(p=>m.jsxs("div",{className:"grid gap-4",children:[m.jsx(De,{children:p.label}),m.jsx(rr,{required:p.required,value:i[p.name]||"",name:p.name,placeholder:p.label,onChange:h})]},p.name))]}),m.jsxs(we,{className:"mt-8 w-fit",form:"group-add",type:"submit",disabled:u,children:[r.labels.save,u&&m.jsx(Be,{className:"h-4 w-4 animate-spin ml-2"})]})]})},qv=({items:t,onSelect:e})=>{const n=v.useContext(zl),[r,i]=v.useState(""),s=o=>{i(o),e(o),i("")};return m.jsxs("div",{className:"p-8",children:[m.jsx(De,{className:"mb-4",children:n.messages["Select Item type"]}),m.jsxs(Rr,{onValueChange:s,value:r,children:[m.jsx(Nr,{className:"w-full max-w-[170px] cursor-pointer",children:m.jsx(kr,{placeholder:n.messages["Select Ids"]})}),m.jsx(Lr,{className:"z-[1005]",children:t.map(o=>m.jsx(Vr,{value:o.type,children:o.name},`${o.type}-${o.name}`))})]})]})},Kv=({dialogRef:t,PopupEvent:e,firstRender:n,secondRender:r,popupType:i,addProps:s,editModel:o,popUpTargetBlank:a,popUpVisible:l,isNavigation:c,messages:u,DynamicComponent:d,DynamicActionComponent:h,addLinksGroupProps:f,reloadCatalog:p,itemType:g,parentid:b,addItemProps:y,getAddModelJSON:T,addModel:S,items:E,selectCatalogItem:w})=>m.jsxs(hc,{ref:t,children:[m.jsx(fc,{}),m.jsxs(pc,{children:[m.jsx(Rn,{children:m.jsxs("div",{className:"relative h-full",children:[e==="create"&&m.jsxs(m.Fragment,{children:[n&&m.jsx(Be,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-8 animate-spin"}),m.jsx(qv,{items:E,onSelect:w})]}),e==="update"&&m.jsx("div",{className:"h-full overflow-y-auto mt-5",children:n?m.jsx(Be,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-8 animate-spin"}):m.jsxs(m.Fragment,{children:[i==="model"&&m.jsx(Vi,{page:s,catalog:!0,callback:o,openNewWindowLabel:u["Open in a new window"],visibleLable:u.Visible,openNewWindow:a,DnavVisible:l,isNavigation:c}),i==="navigation.group"&&m.jsx(Xt,{callback:O=>{var k;(k=t.current)==null||k.close(),p(O)},update:!0,type:"group",...f}),i==="navigation.link"&&m.jsx(Xt,{callback:O=>{var k;(k=t.current)==null||k.close(),p(O)},update:!0,type:"link",...f}),i==="component"&&m.jsx(m.Fragment,{children:d})]})}),e==="action"&&m.jsx(m.Fragment,{children:h})]})}),m.jsx(Rn,{children:m.jsxs("div",{className:"relative h-full",children:[r&&m.jsx(Be,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-8 animate-spin"}),e==="create"&&m.jsxs(m.Fragment,{children:[i==="model"&&m.jsx(Gv,{add:T,callback:()=>{var O;(O=t.current)==null||O.close(),p(null)},type:g??"",parentId:b,isNavigation:c,...y}),i==="navigation.group"&&m.jsx(Xt,{callback:O=>{var k;(k=t.current)==null||k.close(),p(O)},type:"group",parentId:b,...f}),i==="navigation.link"&&m.jsx(Xt,{callback:O=>{var k;(k=t.current)==null||k.close(),p(O)},type:"link",parentId:b,...f}),i==="component"&&m.jsx(m.Fragment,{children:d})]})]})}),m.jsx(Rn,{children:m.jsx("div",{className:"h-full overflow-y-auto mt-5",children:m.jsx(Vi,{page:s,catalog:!0,callback:S,openNewWindowLabel:u["Open in a new window"],visibleLable:u.Visible,isNavigation:c})})})]})]}),Xv=()=>{var Ri;const t=v.useRef(null),e=v.useRef(null),[n,r]=v.useState([]),[i,s]=v.useState([]),[o,a]=v.useState({catalogId:"",catalogName:"",catalogSlug:"",idList:[],nodes:[],movingGroupsRootOnly:!1}),[l,c]=v.useState([]),[u,d]=v.useState({}),[h,f]=v.useState(!1),p=v.useRef(null),[g,b]=v.useState({items:[],model:"",labels:{}}),[y,T]=v.useState({items:[],labels:{}}),[S,E]=v.useState(""),[w,O]=v.useState(null),[k,R]=v.useState(null),[U,_]=v.useState(null),[J,de]=v.useState(0),[Pn,Lt]=v.useState(!1),[wi,Di]=v.useState(!1),[q,ce]=v.useState(!1),[it,We]=v.useState(null),[Ul,Hl]=v.useState(null),[st,$l]=v.useState([]),[On,Ci]=v.useState([]),[Wl,Ei]=v.useState(!1),[Gl,In]=v.useState(!1),[ql,Pi]=v.useState({props:{actions:[],btnBack:{link:"",title:""},btnSave:{title:""},edit:!1,fields:[],notFound:"",postLink:"",search:"",view:!1}}),[Kl,Me]=v.useState(!1),[Xl,Oi]=v.useState(!1);v.useEffect(()=>{const x=async()=>{const A=await W.post("",{_method:"getCatalog"}),{catalog:M,items:C,toolsActions:V}=A.data;a(M),c(C),r(M.nodes),$l(V),ce(M.catalogSlug==="navigation")},P=async()=>{let A=await W.post("",{_method:"getLocales"});d(A.data.data)};(async()=>{try{f(!0),await P(),await x()}catch(A){console.error("Error initializing catalog:",A)}finally{f(!1)}})()},[]);const Ii=x=>{i.find(D=>D.id===x.id)?(de(0),s(i.filter(D=>D.id!==x.id))):(de(x.id),s([...i,x]))},Yl=x=>{x.target===x.currentTarget&&s([])},Zl=v.useCallback(async(x,{dragSourceId:P,dropTargetId:D})=>{var A;try{const M=x.find(j=>j.id===P),C=D||0,V={data:{reqNode:[{id:M==null?void 0:M.id,parent:C,text:M==null?void 0:M.text,data:M==null?void 0:M.data}],reqParent:{id:C,children:x.filter(j=>j.parent===C).map(j=>({id:j.id,text:j.text,data:j.data})),data:C===0?{id:0}:(A=x.find(j=>j.id===C))==null?void 0:A.data}},_method:"updateTree"};r(x),await W.put("",V)}catch(M){console.error("Error updating tree:",M)}},[n]),An=v.useCallback(async(x,P)=>{if(P)try{O(x);const D=n.find(C=>C.id===x),M=(await W.post("",{data:D,_method:"getChilds"})).data.data;r(C=>{const V=new Set(C.map(F=>F.id)),j=M.filter(F=>!V.has(F.id));return j.length===0?C:[...C,...j]})}catch(D){console.error("Error loading child nodes:",D)}finally{O(null)}},[n]),Jl=v.useCallback(async()=>{try{const x=await W.post("",{_method:"getCatalog"}),{catalog:P}=x.data;r(D=>{const A=new Map(D.map(j=>[j.id,j])),M=P.nodes,C=D.map(j=>{const F=M.find(Re=>Re.id===j.id);return F&&F.text!==j.text?F:j}),V=M.filter(j=>{var F;return!A.has(j.id)||((F=A.get(j.id))==null?void 0:F.text)!==j.text});return V.length===0&&C.length===D.length&&C.every((j,F)=>j===D[F])?D:[...C,...V]})}catch(x){console.error("Error reloading catalog:",x)}},[]),Vt=v.useCallback(async x=>{var P,D;x?r(A=>A.map(M=>M.id===x.id?{...M,text:x.name,data:{...M.data,...x}}:M)):(P=i[0])!=null&&P.droppable?((D=t.current)==null||D.open(i[0].id),await An(i[0].id,!0)):await Jl()},[i,An,r]),Ql=v.useCallback(async x=>{var D;R(x),Me(!0);const P=await W.post("",{type:x,_method:"getAddTemplate"});tc(P.data),(D=p.current)==null||D.next(),Me(!1)},[J]),Ai=v.useCallback(async()=>{var x,P,D,A,M,C;try{Me(!0);const V=await W.post("",{type:(P=(x=i[0])==null?void 0:x.data)==null?void 0:P.type,modelId:((A=(D=i[0])==null?void 0:D.data)==null?void 0:A.modelId)??null,id:(C=(M=i[0])==null?void 0:M.data)==null?void 0:C.id,_method:"getEditTemplate"});if(V.data)if(V.data.type.includes("navigation"))switch(V.data.type){case"navigation.group":T(V.data.data),E("navigation.group"),Me(!1);break;case"navigation.link":T(V.data.data),E("navigation.link"),Me(!1);break}else switch(V.data.type){case"model":const j=V.data.data.item,F=await W.get(`${window.routePrefix}/model/${j.type}/edit/${j.modelId}?without_layout=true`);Pi(F.data),Lt(j.targetBlank),Di(j.visible),E("model"),Me(!1);break;default:(async()=>{const jt=(await import(V.data.data.path)).default;We(m.jsx(jt,{callback:_t=>{var ot;(ot=p.current)==null||ot.close(),Vt(_t)},update:!0,item:V.data.data.item},`${V.data.data.id}-${V.data.data.item.name}`))})(),E("component"),Me(!1);break}}catch(V){console.log(V)}},[i]),ec=v.useCallback(async()=>{if(i.length)try{for(const x of i)if((await W.delete("",{data:x})).data.data.ok){let D=[...n];const A=(M,C)=>{let V=C.filter(F=>F.id!==M);return C.filter(F=>F.parent===M).forEach(F=>{V=A(F.id,V)}),V};i.forEach(M=>{D=A(M.id,D)}),r(D)}}catch(x){console.error("Error deleting node:",x)}finally{s([]),de(0)}},[i,n]),tc=v.useCallback(x=>{if(x.type.includes("navigation"))switch(x.type){case"model":b(x.data),E("model");break;case"navigation.group":T(x.data),E("navigation.group");break;case"navigation.link":T(x.data),E("navigation.link");break}else switch(x.type){case"model":b(x.data),E("model");break;default:(async()=>{const A=(await import(x.data.path)).default;We(m.jsx(A,{parentId:J,callback:M=>{var C;(C=p.current)==null||C.close(),Vt(M)}},JSON.stringify(new Date)))})(),E("component");break}},[i,q]),nc=v.useCallback(async x=>{var D;Oi(!0);const P=await W.get(`${window.routePrefix}/model/${x}/add?without_layout=true'`);Pi(P.data),(D=p.current)==null||D.next(),Oi(!1)},[k]),rc=async(x,P,D)=>{var A;P&&(x.targetBlank=P),D&&(x.visible=D);try{await W.post("",{data:{record:x,parentId:J,type:k},_method:"createItem"})}catch(M){console.log(M)}finally{(A=p.current)==null||A.close(),Vt()}},ic=v.useCallback(async(x,P,D)=>{var A,M,C,V,j,F,Re;P&&(x[0].targetBlank=P),D&&(x[0].visible=D),x[0].treeId=(M=(A=i[0])==null?void 0:A.data)==null?void 0:M.id;try{const ge=await W.put("",{type:(V=(C=i[0])==null?void 0:C.data)==null?void 0:V.type,data:{record:x[0]},modelId:(F=(j=i[0])==null?void 0:j.data)==null?void 0:F.modelId,_method:"updateItem"});r(jt=>{const{modelId:_t,type:ot,name:lc}=ge.data.data;return _t===void 0||ot===void 0?(console.warn("No modelId or type in response!"),jt):jt.map(at=>{var Ni,ki;return((Ni=at.data)==null?void 0:Ni.modelId)===_t&&((ki=at.data)==null?void 0:ki.type)===ot?{...at,text:lc,data:{...at.data,...ge.data.data,visible:ge.data.data.visible??!1}}:at})})}catch(ge){console.error("Error updating model:",ge)}finally{(Re=p.current)==null||Re.close()}},[i,r,n]),Mi=async x=>{if(s([]),In(!0),!x.trim()){const P=await W.post("",{_method:"getCatalog"}),{catalog:D}=P.data;r(D.nodes),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var A,M;t.current&&((M=(A=t.current).closeAll)==null||M.call(A),In(!1))})});return}try{const P=await W.post("",{s:x,_method:"search"});r(P.data.data),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var D,A;t.current&&((A=(D=t.current).openAll)==null||A.call(D),In(!1))})})}catch(P){console.error("Error searching:",P)}},sc=Ac(Mi,500),oc=v.useCallback((x,P)=>{if(x){const D=i.some(A=>A.id===P.id);s([]),D||(Ii(P),ac(P))}},[]),ac=v.useCallback(async x=>{var P,D;Ci([]),Ei(!0);try{const A=await W.post("",{items:[x],type:"context",_method:"getActions"});A.data&&((D=(P=A==null?void 0:A.data)==null?void 0:P.data)!=null&&D.length)&&Ci(A.data.data)}catch(A){console.error(A)}finally{Ei(!1)}},[]),Mn=v.useCallback(async x=>{var A,M;const P=st.find(C=>C.id===x)??On.find(C=>C.id===x);if(!P)return;let D=null;switch(P.type){case"link":try{D=await W.put("",{actionId:P.id,_method:"getLink"}),D.data&&((A=window.open(`${D.data.data}`,"_blank"))==null||A.focus())}catch(V){console.error(V)}break;case"basic":let C={actionID:P.id,items:i,data:""};try{Li.warning(u["Performing an action..."]),await W.put("",{data:C,_method:"handleAction"})}catch(V){console.error(V)}finally{Li.success(u["Action completed"])}break;case"external":try{const V=await W.put("",{actionId:P.id,_method:"getPopUpTemplate"});V.data&&((async()=>{const Re=(await import(V.data.data)).default;Hl(m.jsx(Re,{items:i,callback:()=>{var ge;(ge=p.current)==null||ge.close()}},JSON.stringify(i)))})(),(M=p.current)==null||M.open(),_("action"))}catch(V){console.error(V)}break}},[st,i,On]);return m.jsx(m.Fragment,{children:h?m.jsxs(m.Fragment,{children:[m.jsx(Nn,{className:"h-12 w-1/4 rounded-md"}),m.jsx(Nn,{className:"h-12 w-full rounded-md"}),m.jsx(Nn,{className:"h-full w-full rounded-md"})]}):m.jsxs(zl.Provider,{value:{messages:u,setMessages:d},children:[m.jsx(gc,{position:"top-center",richColors:!0,closeButton:!0}),m.jsxs("div",{className:"flex gap-8 items-center mb-4",children:[m.jsx("h1",{className:"text-[28px] leading-[36px] text-foreground",children:u[o.catalogName]}),o.idList.length>0&&m.jsxs(Rr,{defaultValue:o.catalogId,onValueChange:x=>{mc.get(`${window.routePrefix}/catalog/${o.catalogSlug}/${x}`)},children:[m.jsx(Nr,{className:"w-full max-w-[170px] cursor-pointer",children:m.jsx(kr,{placeholder:u["Select Ids"]})}),m.jsx(Lr,{children:o.idList.map(x=>m.jsx(Vr,{value:x,children:x},x))})]})]}),m.jsxs("div",{className:"xl:gap-10 justify-between flex flex-col xl:flex-row gap-3.5",children:[m.jsxs("div",{className:"flex gap-2 items-center",children:[m.jsxs("div",{className:"flex gap-2 items-center flex-wrap md:flex-nowrap",children:[m.jsxs(we,{variant:"default",size:"sm",className:`w-fit rounded-sm ${i.length===0||i.length===1&&((Ri=i[0])!=null&&Ri.droppable)?"":"opacity-50 pointer-events-none"}`,onClick:()=>{var x;_("create"),(x=p.current)==null||x.open()},children:[m.jsx(Eo,{}),u.create]}),m.jsxs(we,{variant:"outline",size:"sm",className:`w-fit cursor-pointer rounded-sm ${i.length>1||!i.length?"opacity-50 pointer-events-none":""}`,onClick:()=>{var x;Ai(),_("update"),(x=p.current)==null||x.open()},children:[m.jsx(vc,{}),u.Edit]}),m.jsx(Mc,{btnTitle:u.Delete,ref:e,variant:"destructive",btnCLass:`w-fit text-white hover ${i.length?"":"opacity-50 pointer-events-none"}`,delModal:{yes:u.Yes,no:u.No,text:u["Are you sure?"]},isLink:!1,handleDelete:ec}),m.jsxs(we,{variant:"secondary",size:"sm",className:`w-fit cursor-pointer rounded-sm ${i.length?"":"opacity-50 pointer-events-none"}`,onClick:()=>{de(0),s([])},children:[m.jsx(yc,{}),u.Clean]})]}),m.jsxs("div",{className:"ml-4",children:[m.jsx("div",{className:"hidden lg:flex gap-2",children:st.map(x=>m.jsxs(we,{variant:"outline",size:"sm",onClick:()=>Mn(x.id),children:[m.jsx(an,{name:x.icon}),x.name]},x.id))}),st.length>0&&m.jsx("div",{className:"block lg:hidden",children:m.jsxs(bc,{children:[m.jsx(xc,{asChild:!0,children:m.jsx(we,{variant:"outline",size:"icon",children:m.jsx(Tc,{})})}),m.jsx(Sc,{className:"w-fit",side:"right",align:"start",children:m.jsx(wc,{className:"grid gap-2",children:st.map(x=>m.jsxs(we,{variant:"outline",size:"sm",onClick:()=>Mn(x.id),children:[m.jsx(an,{name:x.icon}),x.name]},x.id))})})]})})]})]}),m.jsxs("div",{className:"flex gap-2 items-center justify-start xl:justify-end",children:[Gl&&m.jsx(Be,{className:"size-4 animate-spin order-2 xl:order-1"}),m.jsx(rr,{type:"search",autoFocus:!1,placeholder:u.Search,className:"w-[200px] p-2 border rounded order-1 xl:order-2",onChange:x=>{sc(x.target.value)},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),Mi(x.currentTarget.value))}})]})]}),m.jsx("div",{className:"h-full",children:m.jsx(lm,{backend:Um,options:fv(),children:m.jsx("div",{className:nr.app,children:m.jsx(Iv,{ref:t,tree:n,rootId:0,render:(x,{depth:P,isOpen:D,onToggle:A})=>{var M;return m.jsxs(Dc,{onOpenChange:C=>oc(C,x),children:[m.jsx(Cc,{children:m.jsx(Lv,{node:x,depth:P,isOpen:D,loading:w===x.id,isSelected:!!i.find(C=>C.id===x.id),onToggle:C=>{A(),An(C,!D)},onSelect:Ii})}),m.jsxs(Ec,{children:[m.jsx(Bt,{className:`${(M=i[0])!=null&&M.droppable?"":"opacity-50 pointer-events-none"}`,onClick:()=>{var C;_("create"),(C=p.current)==null||C.open()},children:u.create}),m.jsx(Bt,{onClick:()=>{var C;Ai(),_("update"),(C=p.current)==null||C.open()},children:u.Edit}),m.jsx(Bt,{variant:"destructive",onClick:()=>{var C;document.body.removeAttribute("style"),(C=e.current)==null||C.click()},className:i.length?"":"opacity-50 pointer-events-none",children:u.Delete}),Wl?m.jsx(Be,{className:"mx-auto size-3 animate-spin"}):On.map(C=>m.jsx(Bt,{onClick:()=>Mn(C.id),children:C.name},C.id))]})]})},dropTargetOffset:5,insertDroppableFirst:!1,classes:{draggingSource:nr.draggingSource,dropTarget:"bg-chart-1/30",placeholder:nr.placeholderContainer,root:"py-4"},canDrop:(x,{dragSource:P,dropTargetId:D})=>{if((P==null?void 0:P.parent)===D)return!0},sort:!1,dragPreviewRender:x=>m.jsx(Bv,{monitorProps:x}),onDrop:Zl,placeholderRender:(x,{depth:P})=>m.jsx(Wv,{node:x,depth:P}),rootProps:{onClick:Yl}})})})}),m.jsx(Kv,{dialogRef:p,PopupEvent:U,firstRender:Kl,secondRender:Xl,popupType:S,addProps:ql,editModel:ic,popUpTargetBlank:Pn,popUpVisible:wi,isNavigation:q,messages:u,DynamicComponent:it,DynamicActionComponent:Ul,addLinksGroupProps:y,reloadCatalog:Vt,itemType:k,parentid:J,addItemProps:g,getAddModelJSON:nc,addModel:rc,items:l,selectCatalogItem:Ql})]})})},Yv=[];function Ty(){return m.jsx(Pc,{breadcrumbs:Yv,children:m.jsx("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:m.jsx(Xv,{})})})}export{Ty as default};
@@ -599,7 +599,7 @@
599
599
  ]
600
600
  },
601
601
  "src/assets/js/pages/catalog.tsx": {
602
- "file": "catalog-DXyw2KnJ.js",
602
+ "file": "catalog-CJ5JpPUx.js",
603
603
  "name": "catalog",
604
604
  "src": "src/assets/js/pages/catalog.tsx",
605
605
  "isDynamicEntry": true,
@@ -1,4 +1,4 @@
1
- import { VueCatalog } from "./FrontentCatalogAdapter";
1
+ import { FrontendCatalog, FrontendCatalogUtils } from "./FrontendCatalogAdapter";
2
2
  import { Adminizer } from "../../lib/Adminizer";
3
3
  export async function catalogController(req, res) {
4
4
  const slug = req.params.slug;
@@ -34,7 +34,7 @@ export async function catalogController(req, res) {
34
34
  }
35
35
  if (method === 'POST' || method === 'PUT' || method === 'DELETE') {
36
36
  const data = req.body;
37
- const frontendCatalog = new VueCatalog(_catalog);
37
+ const frontendCatalog = new FrontendCatalog(_catalog);
38
38
  if (!frontendCatalog)
39
39
  return res.status(404);
40
40
  frontendCatalog.setId(id);
@@ -62,7 +62,8 @@ export async function catalogController(req, res) {
62
62
  });
63
63
  }
64
64
  case 'createItem':
65
- return res.json({ 'data': await frontendCatalog.createItem(data.data, req) });
65
+ const createdItem = await frontendCatalog.createItem(data.data, req);
66
+ return res.json({ 'data': FrontendCatalogUtils.normalizeForFrontend(createdItem) });
66
67
  case 'getChilds':
67
68
  return res.json({ data: await frontendCatalog.getChilds(data.data, req) });
68
69
  case 'getActions':
@@ -84,7 +85,8 @@ export async function catalogController(req, res) {
84
85
  case 'getPopUpTemplate':
85
86
  return res.json({ data: await frontendCatalog.getPopUpTemplate(data.actionId, req) });
86
87
  case 'updateItem':
87
- return res.json({ data: await frontendCatalog.updateItem(item, data.modelId, data.data, req) });
88
+ const updatedItem = await frontendCatalog.updateItem(item, data.modelId, data.data, req);
89
+ return res.json({ data: FrontendCatalogUtils.normalizeForFrontend(updatedItem) });
88
90
  }
89
91
  break;
90
92
  case 'DELETE':
@@ -0,0 +1,82 @@
1
+ import { AbstractCatalog, Item } from "../../lib/catalog/AbstractCatalog";
2
+ interface NodeModel<TDataType> {
3
+ text: string;
4
+ droppable: boolean;
5
+ id: string;
6
+ parent: number;
7
+ data?: TDataType;
8
+ children?: NodeModel<TDataType>[];
9
+ isSelected?: boolean;
10
+ isVisible?: boolean;
11
+ isDraggable?: boolean;
12
+ isSelectable?: boolean;
13
+ path?: number[];
14
+ pathStr?: string;
15
+ level?: number;
16
+ isFirstChild?: boolean;
17
+ isLastChild?: boolean;
18
+ }
19
+ interface NodeData extends Item {
20
+ }
21
+ interface RequestData {
22
+ reqNode: NodeModel<NodeData>[];
23
+ reqParent: NodeModel<NodeData>;
24
+ _method: string;
25
+ }
26
+ /**
27
+ * @deprecated Now is React
28
+ * // TODO: refactor for react name
29
+ */
30
+ export declare class FrontendCatalog {
31
+ catalog: AbstractCatalog;
32
+ constructor(_catalog: AbstractCatalog);
33
+ setId(id: string): void;
34
+ getItemType(type: string): import("../../lib/catalog/AbstractCatalog").BaseItem<Item>;
35
+ getAddTemplate(item: any, req: ReqType): Promise<{
36
+ type: "component" | "navigation.group" | "navigation.link" | "model";
37
+ data: any;
38
+ }>;
39
+ getEditTemplate(item: any, id: string | number, req: ReqType, modelId: string | number): Promise<{
40
+ type: "component" | "navigation.group" | "navigation.link" | "model";
41
+ data: any;
42
+ }>;
43
+ getitemTypes(): {
44
+ type: string;
45
+ name: string;
46
+ isGroup: boolean;
47
+ allowedRoot: boolean;
48
+ icon: string;
49
+ actionHandlers: import("../../lib/catalog/AbstractCatalog").ActionHandler[];
50
+ }[];
51
+ getLocales(req: ReqType): {
52
+ [key: string]: string;
53
+ };
54
+ getActions(items: NodeModel<any>[], type: string): Promise<import("../../lib/catalog/AbstractCatalog").ActionHandler[]>;
55
+ handleAction(actionId: string, items: any[], data: any, req: ReqType): Promise<string | void>;
56
+ getPopUpTemplate(actionId: string, req: ReqType): Promise<string>;
57
+ getLink(actionId: string): Promise<string>;
58
+ getCatalog(): Promise<NodeModel<Item>[]>;
59
+ createItem(data: any, req: ReqType): Promise<any>;
60
+ getChilds(data: any, req: ReqType): Promise<NodeModel<Item>[]>;
61
+ search(s: string, req: ReqType): Promise<NodeModel<Item>[]>;
62
+ updateTree(data: RequestData, req: ReqType): Promise<any>;
63
+ updateItem(item: any, modelId: string, data: any, req: ReqType): Promise<any>;
64
+ deleteItem(item: Item, req: ReqType): Promise<{
65
+ ok: boolean;
66
+ }>;
67
+ }
68
+ export declare class FrontendCatalogUtils {
69
+ /**
70
+ * Removes unnecessary data from the front
71
+ */
72
+ static refinement<T extends NodeModel<any>>(nodeModel: T): any;
73
+ /**
74
+ * Normalizes data for frontend: replaces null parentId with 0
75
+ */
76
+ static normalizeForFrontend<T extends Item>(item: T): T;
77
+ static arrayToNode<T extends Item>(items: T[], groupTypeName: string): NodeModel<T>[];
78
+ static toNode<T extends NodeData>(data: T, groupTypeName: string): NodeModel<T>;
79
+ static expandTo<T extends NodeData>(frontendCatalogData: NodeModel<T>, theseItemIdsNeedToBeOpened: (string | number)[]): NodeModel<T>;
80
+ static treeToNode(tree: Item[], groupTypeName: string): NodeModel<Item>[];
81
+ }
82
+ export {};
@@ -0,0 +1,228 @@
1
+ /**
2
+ * @deprecated Now is React
3
+ * // TODO: refactor for react name
4
+ */
5
+ export class FrontendCatalog {
6
+ catalog;
7
+ constructor(_catalog) {
8
+ this.catalog = _catalog;
9
+ }
10
+ setId(id) {
11
+ this.catalog.setId(id);
12
+ }
13
+ getItemType(type) {
14
+ return this.catalog.getItemType(type);
15
+ }
16
+ getAddTemplate(item, req) {
17
+ return this.catalog.getAddTemplate(item, req);
18
+ }
19
+ getEditTemplate(item, id, req, modelId) {
20
+ return this.catalog.getEditTemplate(item, id, req, modelId);
21
+ }
22
+ getitemTypes() {
23
+ return this.catalog.getitemTypes();
24
+ }
25
+ getLocales(req) {
26
+ let obj = {
27
+ "Delete": "",
28
+ "Edit": "",
29
+ "create": "",
30
+ "Search": "",
31
+ "Select Item type": "",
32
+ "Select Items": "",
33
+ "Save": "",
34
+ "No": "",
35
+ "Are you sure?": "",
36
+ "Yes": "",
37
+ "Select Ids": "",
38
+ "OR": "",
39
+ "Open in a new window": "",
40
+ "Visible": "",
41
+ "Clean": "",
42
+ "Performing an action...": "",
43
+ "Action completed": "",
44
+ };
45
+ obj[this.catalog.name] = "";
46
+ for (const actionHandler of this.catalog.actionHandlers) {
47
+ obj[actionHandler.name] = "";
48
+ }
49
+ let messages = obj;
50
+ let outMessages = {};
51
+ for (const mess of Object.keys(messages)) {
52
+ outMessages[mess] = req.i18n.__(mess);
53
+ }
54
+ return {
55
+ ...outMessages,
56
+ };
57
+ }
58
+ async getActions(items, type) {
59
+ let arrItems = [];
60
+ for (const item of items) {
61
+ if (item.data.id === 0)
62
+ item.data.id = null;
63
+ arrItems.push(await this.catalog.find(item.data));
64
+ }
65
+ console.log(arrItems);
66
+ if (type === 'tools') {
67
+ return (await this.catalog.getActions(arrItems))?.filter(e => e.displayTool);
68
+ }
69
+ else {
70
+ return (await this.catalog.getActions(arrItems))?.filter(e => e.displayContext);
71
+ }
72
+ }
73
+ async handleAction(actionId, items, data, req) {
74
+ let arrItems = [];
75
+ for (const item of items) {
76
+ if (item.data.id === 0)
77
+ item.data.id = null;
78
+ arrItems.push(await this.catalog.find(item.data));
79
+ }
80
+ console.log(arrItems);
81
+ return this.catalog.handleAction(actionId, arrItems, data, req);
82
+ }
83
+ async getPopUpTemplate(actionId, req) {
84
+ return this.catalog.getPopUpTemplate(actionId, req);
85
+ }
86
+ async getLink(actionId) {
87
+ return this.catalog.getLink(actionId);
88
+ }
89
+ //Below are the methods that require action
90
+ async getCatalog() {
91
+ let rootItems = await this.catalog.getChilds(null);
92
+ return FrontendCatalogUtils.arrayToNode(rootItems, this.catalog.getGroupType().type);
93
+ }
94
+ async createItem(data, req) {
95
+ // TODO It's not clear why it's here.
96
+ //data = VueCatalogUtils.refinement(data);
97
+ // if (this.catalog.slug !== "navigation") {
98
+ // let item = data.record;
99
+ // item.parenId = data.parenId;
100
+ // return await this.catalog.createItem(item, req);
101
+ // } else {
102
+ if (data.parentId === 0)
103
+ data.parentId = null;
104
+ return await this.catalog.createItem(data, req);
105
+ // }
106
+ }
107
+ async getChilds(data, req) {
108
+ data = FrontendCatalogUtils.refinement(data);
109
+ if (!data || data.id === 0 || data.id === undefined) {
110
+ data = { id: null };
111
+ }
112
+ if (data.id === 0)
113
+ data.id = null;
114
+ return FrontendCatalogUtils.arrayToNode(await this.catalog.getChilds(data.id, undefined, req), this.catalog.getGroupType().type);
115
+ }
116
+ // Moved into actions
117
+ // getCreatedItems(data: any) {
118
+ // data = VueCatalogUtils.refinement(data);
119
+ // return this.catalog.getChilds(data.id);
120
+ // }
121
+ async search(s, req) {
122
+ let searchResult = await this.catalog.search(s, undefined, req);
123
+ // let itemsTree = AbstractCatalog.buildTree(searchResult);
124
+ // console.log(itemsTree)
125
+ return FrontendCatalogUtils.treeToNode(searchResult, this.catalog.getGroupType().type);
126
+ }
127
+ async updateTree(data, req) {
128
+ // console.dir(data, {depth: null})
129
+ // return
130
+ let reqParent = data.reqParent;
131
+ if (reqParent.data.id === 0)
132
+ reqParent.data.id = null;
133
+ // Update all items into parent (for two reason: update parent, updare sorting order)
134
+ let sortCount = 0;
135
+ for (const childNode of reqParent.children) {
136
+ childNode.data.sortOrder = sortCount;
137
+ childNode.data.parentId = reqParent.data.id;
138
+ if (childNode.data.id === 0)
139
+ childNode.data.id = null;
140
+ await this.catalog.updateItem(childNode.data.id, childNode.data.type, childNode.data, req);
141
+ sortCount++;
142
+ }
143
+ return Promise.resolve('ok');
144
+ }
145
+ async updateItem(item, modelId, data, req) {
146
+ //TODO It's not clear why it's here.
147
+ //data = VueCatalogUtils.refinement(data);
148
+ // if (this.catalog.slug !== "navigation") {
149
+ // return await this.catalog.updateModelItems(data.modelId, data.type, data.record, req);
150
+ // } else {
151
+ let normalizedModelId = modelId;
152
+ if (normalizedModelId === '0')
153
+ normalizedModelId = null;
154
+ return await this.catalog.updateModelItems(normalizedModelId, item.type, data, req);
155
+ // }
156
+ }
157
+ async deleteItem(item, req) {
158
+ if (item.id === 0)
159
+ item.id = null;
160
+ // Получаем всех непосредственных потомков текущего элемента
161
+ const children = await this.catalog.getChilds(item.id, undefined, req);
162
+ // Рекурсивно удаляем всех потомков
163
+ for (const child of children) {
164
+ await this.deleteItem(child, req);
165
+ }
166
+ // После удаления всех потомков удаляем сам элемент
167
+ await this.catalog.deleteItem(item.type, item.id, req);
168
+ return { ok: true };
169
+ }
170
+ }
171
+ export class FrontendCatalogUtils {
172
+ /**
173
+ * Removes unnecessary data from the front
174
+ */
175
+ static refinement(nodeModel) {
176
+ return nodeModel.data;
177
+ }
178
+ /**
179
+ * Normalizes data for frontend: replaces null parentId with 0
180
+ */
181
+ static normalizeForFrontend(item) {
182
+ return { ...item, parentId: item.parentId === null ? 0 : item.parentId };
183
+ }
184
+ static arrayToNode(items, groupTypeName) {
185
+ return items.map(node => FrontendCatalogUtils.toNode(node, groupTypeName));
186
+ }
187
+ static toNode(data, groupTypeName) {
188
+ const normalizedData = FrontendCatalogUtils.normalizeForFrontend(data);
189
+ return {
190
+ data: normalizedData,
191
+ droppable: data.type === groupTypeName,
192
+ id: data.id,
193
+ text: data.name,
194
+ parent: (data.parentId === null ? 0 : data.parentId),
195
+ };
196
+ }
197
+ static expandTo(frontendCatalogData, theseItemIdsNeedToBeOpened) {
198
+ function expand(node) {
199
+ if (theseItemIdsNeedToBeOpened.includes(node.data.id)) {
200
+ // node.isExpanded = true;
201
+ }
202
+ if (node.children) {
203
+ for (const child of node.children) {
204
+ expand(child);
205
+ }
206
+ }
207
+ }
208
+ theseItemIdsNeedToBeOpened.forEach(id => {
209
+ expand(frontendCatalogData);
210
+ });
211
+ return frontendCatalogData;
212
+ }
213
+ static treeToNode(tree, groupTypeName) {
214
+ function buildNodes(items) {
215
+ return items.map(item => {
216
+ const node = FrontendCatalogUtils.toNode(item, groupTypeName);
217
+ if (item.childs && item.childs.length > 0) {
218
+ // Sort the children before building their nodes
219
+ item.childs.sort((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
220
+ node.children = buildNodes(item.childs);
221
+ // node.isExpanded = !node.droppable;
222
+ }
223
+ return node;
224
+ });
225
+ }
226
+ return buildNodes(tree);
227
+ }
228
+ }
@@ -27,7 +27,7 @@ interface RequestData {
27
27
  * @deprecated Now is React
28
28
  * // TODO: refactor for react name
29
29
  */
30
- export declare class VueCatalog {
30
+ export declare class FrontendCatalog {
31
31
  catalog: AbstractCatalog;
32
32
  constructor(_catalog: AbstractCatalog);
33
33
  setId(id: string): void;
@@ -65,7 +65,7 @@ export declare class VueCatalog {
65
65
  ok: boolean;
66
66
  }>;
67
67
  }
68
- export declare class VueCatalogUtils {
68
+ export declare class FrontendCatalogUtils {
69
69
  /**
70
70
  * Removes unnecessary data from the front
71
71
  */
@@ -2,7 +2,7 @@
2
2
  * @deprecated Now is React
3
3
  * // TODO: refactor for react name
4
4
  */
5
- export class VueCatalog {
5
+ export class FrontendCatalog {
6
6
  catalog;
7
7
  constructor(_catalog) {
8
8
  this.catalog = _catalog;
@@ -58,6 +58,8 @@ export class VueCatalog {
58
58
  async getActions(items, type) {
59
59
  let arrItems = [];
60
60
  for (const item of items) {
61
+ if (item.data.id === 0)
62
+ item.data.id = null;
61
63
  arrItems.push(await this.catalog.find(item.data));
62
64
  }
63
65
  console.log(arrItems);
@@ -71,6 +73,8 @@ export class VueCatalog {
71
73
  async handleAction(actionId, items, data, req) {
72
74
  let arrItems = [];
73
75
  for (const item of items) {
76
+ if (item.data.id === 0)
77
+ item.data.id = null;
74
78
  arrItems.push(await this.catalog.find(item.data));
75
79
  }
76
80
  console.log(arrItems);
@@ -84,8 +88,8 @@ export class VueCatalog {
84
88
  }
85
89
  //Below are the methods that require action
86
90
  async getCatalog() {
87
- let rootItems = await this.catalog.getChilds(0);
88
- return VueCatalogUtils.arrayToNode(rootItems, this.catalog.getGroupType().type);
91
+ let rootItems = await this.catalog.getChilds(null);
92
+ return FrontendCatalogUtils.arrayToNode(rootItems, this.catalog.getGroupType().type);
89
93
  }
90
94
  async createItem(data, req) {
91
95
  // TODO It's not clear why it's here.
@@ -95,12 +99,16 @@ export class VueCatalog {
95
99
  // item.parenId = data.parenId;
96
100
  // return await this.catalog.createItem(item, req);
97
101
  // } else {
102
+ if (data.parentId === 0)
103
+ data.parentId = null;
98
104
  return await this.catalog.createItem(data, req);
99
105
  // }
100
106
  }
101
107
  async getChilds(data, req) {
102
- data = VueCatalogUtils.refinement(data);
103
- return VueCatalogUtils.arrayToNode(await this.catalog.getChilds(data.id, undefined, req), this.catalog.getGroupType().type);
108
+ data = FrontendCatalogUtils.refinement(data);
109
+ if (data.id === 0)
110
+ data.id = null;
111
+ return FrontendCatalogUtils.arrayToNode(await this.catalog.getChilds(data.id, undefined, req), this.catalog.getGroupType().type);
104
112
  }
105
113
  // Moved into actions
106
114
  // getCreatedItems(data: any) {
@@ -111,17 +119,21 @@ export class VueCatalog {
111
119
  let searchResult = await this.catalog.search(s, undefined, req);
112
120
  // let itemsTree = AbstractCatalog.buildTree(searchResult);
113
121
  // console.log(itemsTree)
114
- return VueCatalogUtils.treeToNode(searchResult, this.catalog.getGroupType().type);
122
+ return FrontendCatalogUtils.treeToNode(searchResult, this.catalog.getGroupType().type);
115
123
  }
116
124
  async updateTree(data, req) {
117
125
  // console.dir(data, {depth: null})
118
126
  // return
119
127
  let reqParent = data.reqParent;
128
+ if (reqParent.data.id === 0)
129
+ reqParent.data.id = null;
120
130
  // Update all items into parent (for two reason: update parent, updare sorting order)
121
131
  let sortCount = 0;
122
132
  for (const childNode of reqParent.children) {
123
133
  childNode.data.sortOrder = sortCount;
124
134
  childNode.data.parentId = reqParent.data.id;
135
+ if (childNode.data.id === 0)
136
+ childNode.data.id = null;
125
137
  await this.catalog.updateItem(childNode.data.id, childNode.data.type, childNode.data, req);
126
138
  sortCount++;
127
139
  }
@@ -133,10 +145,15 @@ export class VueCatalog {
133
145
  // if (this.catalog.slug !== "navigation") {
134
146
  // return await this.catalog.updateModelItems(data.modelId, data.type, data.record, req);
135
147
  // } else {
136
- return await this.catalog.updateModelItems(modelId, item.type, data, req);
148
+ let normalizedModelId = modelId;
149
+ if (normalizedModelId === '0')
150
+ normalizedModelId = null;
151
+ return await this.catalog.updateModelItems(normalizedModelId, item.type, data, req);
137
152
  // }
138
153
  }
139
154
  async deleteItem(item, req) {
155
+ if (item.id === 0)
156
+ item.id = null;
140
157
  // Получаем всех непосредственных потомков текущего элемента
141
158
  const children = await this.catalog.getChilds(item.id, undefined, req);
142
159
  // Рекурсивно удаляем всех потомков
@@ -148,7 +165,7 @@ export class VueCatalog {
148
165
  return { ok: true };
149
166
  }
150
167
  }
151
- export class VueCatalogUtils {
168
+ export class FrontendCatalogUtils {
152
169
  /**
153
170
  * Removes unnecessary data from the front
154
171
  */
@@ -156,7 +173,7 @@ export class VueCatalogUtils {
156
173
  return nodeModel.data;
157
174
  }
158
175
  static arrayToNode(items, groupTypeName) {
159
- return items.map(node => VueCatalogUtils.toNode(node, groupTypeName));
176
+ return items.map(node => FrontendCatalogUtils.toNode(node, groupTypeName));
160
177
  }
161
178
  static toNode(data, groupTypeName) {
162
179
  return {
@@ -186,7 +203,7 @@ export class VueCatalogUtils {
186
203
  static treeToNode(tree, groupTypeName) {
187
204
  function buildNodes(items) {
188
205
  return items.map(item => {
189
- const node = VueCatalogUtils.toNode(item, groupTypeName);
206
+ const node = FrontendCatalogUtils.toNode(item, groupTypeName);
190
207
  if (item.childs && item.childs.length > 0) {
191
208
  // Sort the children before building their nodes
192
209
  item.childs.sort((a, b) => (a.sortOrder || 0) - (b.sortOrder || 0));
@@ -453,6 +453,7 @@ export interface NavigationConfig {
453
453
  groupField: {
454
454
  name: string;
455
455
  required: boolean;
456
+ label: string;
456
457
  }[];
457
458
  allowContentInGroup?: boolean;
458
459
  items: NavigationItemTypeConfig[];
@@ -269,7 +269,7 @@ export class AbstractCatalog {
269
269
  const extras = await this.getChilds(item.id, undefined, req);
270
270
  accumulator.push(...extras);
271
271
  }
272
- if (item.parentId === 0)
272
+ if (item.parentId === null)
273
273
  return item;
274
274
  const parentItem = await groupType._find(item.parentId, this.id);
275
275
  if (parentItem) {
@@ -285,7 +285,7 @@ export class AbstractCatalog {
285
285
  foundItems = foundItems.concat(items);
286
286
  }
287
287
  for (const item of foundItems) {
288
- if (item.parentId !== 0) { // changed from null to 0
288
+ if (item.parentId !== null) { // changed from 0 to null
289
289
  await buildTreeUpwards(item, hasExtras);
290
290
  }
291
291
  }
@@ -311,7 +311,7 @@ export class AbstractCatalog {
311
311
  itemMap[item.id] = item;
312
312
  });
313
313
  items.forEach(item => {
314
- if (item.parentId === 0) { // changed from null to 0
314
+ if (item.parentId === null) {
315
315
  tree.push(item);
316
316
  }
317
317
  else {
@@ -1,7 +1,7 @@
1
1
  import { AbstractCatalog, ActionHandler, Item } from "./AbstractCatalog";
2
2
  import { NavigationConfig } from "../../interfaces/adminpanelConfig";
3
3
  import { Adminizer } from "../Adminizer";
4
- export interface NavItem extends Item {
4
+ interface NavItem extends Item {
5
5
  urlPath?: string;
6
6
  modelId?: string | number;
7
7
  targetBlank?: boolean;
@@ -43,3 +43,4 @@ export declare class Navigation extends AbstractCatalog {
43
43
  constructor(adminizer: Adminizer, config: NavigationConfig);
44
44
  getIdList(): Promise<string[]>;
45
45
  }
46
+ export {};
@@ -30,7 +30,7 @@ export class StorageService {
30
30
  return this.id;
31
31
  }
32
32
  async buildTree() {
33
- const rootElements = await this.findElementsByParentId(0, null);
33
+ const rootElements = await this.findElementsByParentId(null, null);
34
34
  const buildSubTree = async (elements) => {
35
35
  const tree = [];
36
36
  for (const element of elements) {
@@ -56,9 +56,9 @@ export class StorageService {
56
56
  return tree;
57
57
  }
58
58
  async populateFromTree(tree) {
59
- const traverseTree = async (node, parentId = 0) => {
59
+ const traverseTree = async (node, parentId = null) => {
60
60
  const { children, ...itemData } = node;
61
- const item = { ...itemData, parentId };
61
+ const item = { ...itemData, parentId: itemData.parentId === 0 ? null : itemData.parentId };
62
62
  await this.setElement(item.id, item, true);
63
63
  if (children && children.length > 0) {
64
64
  for (const child of children) {
@@ -109,6 +109,8 @@ export class StorageService {
109
109
  async findElementsByParentId(parentId, type) {
110
110
  const elements = [];
111
111
  for (const item of this.storageMap.values()) {
112
+ if (parentId === 0)
113
+ parentId = null;
112
114
  if (type === null && item.parentId === parentId) {
113
115
  elements.push(item);
114
116
  continue;
@@ -222,7 +224,9 @@ class NavigationItem extends AbstractItem {
222
224
  async dataPreparation(data, catalogId, sortOrder) {
223
225
  let storage = this.storageServices.get(catalogId);
224
226
  let urlPath = eval('`' + this.urlPath + '`');
225
- let parentId = data.parentId ? data.parentId : 0; // changed from null to 0
227
+ let parentId = data.parentId ? data.parentId : null; // changed from 0 to null
228
+ if (parentId === 0)
229
+ parentId = null;
226
230
  return {
227
231
  id: uuid(),
228
232
  modelId: data.record.id,
@@ -332,7 +336,9 @@ class NavigationGroup extends AbstractGroup {
332
336
  }
333
337
  async dataPreparation(data, catalogId, sortOrder) {
334
338
  let storage = this.storageServices.get(catalogId);
335
- let parentId = data.parentId ? data.parentId : 0; // changed from null to 0
339
+ let parentId = data.parentId ? data.parentId : null; // changed from 0 to null
340
+ if (parentId === 0)
341
+ parentId = null;
336
342
  return {
337
343
  id: uuid(),
338
344
  name: data.name,
@@ -368,6 +374,7 @@ class NavigationGroup extends AbstractGroup {
368
374
  resItems = this.groupField.map((field) => {
369
375
  return {
370
376
  name: field.name,
377
+ label: field.label,
371
378
  required: field.required
372
379
  };
373
380
  });
@@ -393,6 +400,7 @@ class NavigationGroup extends AbstractGroup {
393
400
  resItems = this.groupField.map((field) => {
394
401
  return {
395
402
  name: field.name,
403
+ label: field.label,
396
404
  required: field.required
397
405
  };
398
406
  });
@@ -433,7 +441,8 @@ class LinkItem extends NavigationGroup {
433
441
  let type = 'navigation.link';
434
442
  let resItems = [
435
443
  {
436
- name: req.i18n.__('Link'),
444
+ label: req.i18n.__('Link'),
445
+ name: "link",
437
446
  required: true
438
447
  }
439
448
  ];
@@ -455,7 +464,8 @@ class LinkItem extends NavigationGroup {
455
464
  let type = 'navigation.group';
456
465
  let resItems = [
457
466
  {
458
- name: req.i18n.__('Link'),
467
+ label: req.i18n.__('Link'),
468
+ name: 'link',
459
469
  required: true
460
470
  }
461
471
  ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.3.0-build.119",
4
+ "version": "4.3.0-build.121",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",