JezK
Edit File: editor-site-navigation.min.js
!function(){"use strict";var e={1455:function(e){e.exports=window.wp.apiFetch},5527:function(e){e.exports=window.elementorV2.editorV1Adapters},24413:function(e){e.exports=window.elementorV2.icons},27723:function(e){e.exports=window.wp.i18n},33176:function(e){e.exports=window.elementorV2.events},45643:function(e){e.exports=window.elementorV2.query},46280:function(e){e.exports=window.elementorV2.editorDocuments},51061:function(e){e.exports=window.elementorV2.editorPanels},67660:function(e){e.exports=window.elementorV2.editorAppBar},78806:function(e){e.exports=window.elementorV2.env},79513:function(e){e.exports=window.elementorV2.ui},83617:function(e,t,n){var o,a=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,__copyProps=(e,t,n,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of s(t))c.call(e,a)||a===n||r(e,a,{get:()=>t[a],enumerable:!(o=i(t,a))||o.enumerable});return e},__toESM=(e,t,n)=>(n=null!=e?a(l(e)):{},__copyProps(!t&&e&&e.__esModule?n:r(n,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})(u,{extendIconsMap:()=>extendIconsMap,init:()=>init}),e.exports=(o=u,__copyProps(r({},"__esModule",{value:!0}),o));var p=n(24413),m={...{page:p.PageTemplateIcon,section:p.SectionTemplateIcon,container:p.ContainerTemplateIcon,"wp-page":p.PageTypeIcon,"wp-post":p.PostTypeIcon}};function extendIconsMap(e){Object.assign(m,e)}var d=n(67660),g=n(51061),y=n(51061),E=__toESM(n(97557)),f=n(97557),P=n(51061),_=n(27723),v=__toESM(n(97557)),x=n(97557),w={type:"page",editMode:{mode:"none",details:{}},setEditMode:()=>null,resetEditMode:()=>null,setError:()=>null},h=(0,x.createContext)(w),PostListContextProvider=({type:e,setError:t,children:n})=>{const[o,a]=(0,x.useState)(w.editMode);return v.createElement(h.Provider,{value:{type:e,editMode:o,setEditMode:a,resetEditMode:()=>{a(w.editMode)},setError:t}},n)};function usePostListContext(){const e=(0,x.useContext)(h);if(!e)throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");return e}var I=__toESM(n(97557)),b=n(79513),error_snackbar_default=({open:e,onClose:t})=>I.createElement(b.Snackbar,{open:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"}},I.createElement(b.Alert,{onClose:t,severity:"error",sx:{width:"100%"}},I.createElement(b.Typography,{component:"span",sx:{fontWeight:"bold"}},"We couldn’t complete the action.")," ","Please try again")),C=__toESM(n(97557)),L=n(24413),T=n(79513),M=__toESM(n(1455)),S=n(27723),D={page:{labels:{singular_name:(0,S.__)("Page","elementor"),plural_name:(0,S.__)("Pages","elementor")},rest_base:"pages"}},B=n(45643),k=__toESM(n(1455));function useHomepage(){return(0,B.useQuery)({queryKey:["site-navigation","homepage"],queryFn:()=>(0,k.default)({path:"/elementor/v1/site-navigation/homepage"})})}var A=n(45643),postsQueryKey=e=>["site-navigation","posts",e],flattenData=e=>{if(!e)return e;const t=[];return e.pages.forEach(e=>{t.push(...e.data)}),t};function usePosts(e){const t=(0,A.useInfiniteQuery)({queryKey:postsQueryKey(e),queryFn:({pageParam:t=1})=>(async(e,t)=>{const n=`/wp/v2/${D[e].rest_base}?`+new URLSearchParams({status:"any",order:"asc",page:t.toString(),per_page:10..toString(),_fields:["id","type","title","link","status","user_can"].join(",")}).toString(),o=await(0,M.default)({path:n,parse:!1});return{data:await o.json(),totalPages:Number(o.headers.get("x-wp-totalpages")),totalPosts:Number(o.headers.get("x-wp-total")),currentPage:t}})(e,t),initialPageParam:1,getNextPageParam:e=>e.currentPage<e.totalPages?e.currentPage+1:void 0});return{...t,data:{posts:flattenData(t.data),total:t.data?.pages[0]?.totalPosts??0}}}var O=__toESM(n(97557)),N=n(24413),R=n(79513),F=n(27723),H=n(45643),V=__toESM(n(1455)),getUser=()=>{const e="/wp/v2/users/me?"+new URLSearchParams({_fields:["capabilities"].join(","),context:"edit"}).toString();return(0,V.default)({path:e})},userQueryKey=()=>["site-navigation","user"];function useUser(){return(0,H.useQuery)({queryKey:userQueryKey(),queryFn:getUser,staleTime:18e5})}function AddNewButton(){const{setEditMode:e}=usePostListContext(),{data:t}=useUser();return O.createElement(R.Button,{size:"small",startIcon:O.createElement(N.PlusIcon,null),disabled:!t?.capabilities?.edit_pages,onClick:()=>{e({mode:"create",details:{}})},sx:{px:1.5}},(0,F.__)("Add New","elementor"))}var j=__toESM(n(97557)),z=n(97557),q=n(24413),$=n(79513),W=(0,$.styled)(q.ChevronDownIcon,{shouldForwardProp:e=>"isOpen"!==e})(({theme:e,isOpen:t})=>({transform:t?"rotate(0deg)":"rotate(-90deg)",transition:e.transitions.create("transform",{duration:e.transitions.duration.standard})})),Q=(0,$.styled)($.ListItemIcon)(({theme:e})=>({minWidth:e.spacing(4)}));function CollapsibleList({label:e,Icon:t,isOpenByDefault:n=!1,children:o}){const[a,r]=(0,z.useState)(n);return j.createElement(j.Fragment,null,j.createElement($.ListItem,null,j.createElement(Q,{sx:{color:"text.secondary"}},j.createElement($.IconButton,{onClick:()=>r(e=>!e),size:"small",sx:{color:"inherit"}},j.createElement(W,{fontSize:"small",isOpen:a}))),j.createElement(Q,{size:"small",sx:{color:"inherit"}},j.createElement(t,{fontSize:"small"})),j.createElement($.ListItemText,{primaryTypographyProps:{variant:"subtitle2",component:"span"},primary:e})),j.createElement($.Collapse,{in:a,timeout:"auto",unmountOnExit:!0},j.createElement($.List,{dense:!0},o)),j.createElement($.Divider,{sx:{mt:1}}))}var U=__toESM(n(97557)),K=n(24413),G=n(79513),X=n(27723);function ErrorState(){return U.createElement(G.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pt:"40px",gap:"16px"}},U.createElement(K.Error404TemplateIcon,null),U.createElement(G.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"8px"}},U.createElement(G.Typography,{variant:"body1",color:"text.primary"},(0,X.__)("We couldn’t display your pages.","elementor")),U.createElement(G.Box,null,U.createElement(G.Typography,{variant:"body2",color:"text.primary",sx:{textAlign:"center"}},(0,X.__)("It’s probably a temporary issue.","elementor")),U.createElement(G.Typography,{variant:"body2",color:"text.primary",sx:{textAlign:"center"}},(0,X.__)("If the problem persists,","elementor")," ",U.createElement(G.Link,{target:"_blank",href:"https://go.elementor.com/wp-editor-support-open-ticket/"},"Notify support")))))}var Y=__toESM(n(97557)),J=__toESM(n(97557)),Z=n(46280),ee=n(27723),te=n(45643),ne=n(45643),oe=__toESM(n(1455)),ae=6,getRequest2=()=>{const e=`/elementor/v1/site-navigation/recent-posts?${new URLSearchParams({posts_per_page:`${ae}`}).toString()}`;return(0,oe.default)({path:e})},re=["site-navigation","recent-posts"];function usePostActions(e){const t=function useInvalidatePosts(e){const t=(0,te.useQueryClient)();return(n={})=>{const o=postsQueryKey(e);return t.invalidateQueries({queryKey:re},n),t.invalidateQueries({queryKey:o},n)}}(e),onSuccess=()=>t({exact:!0}),n=(0,te.useMutation)({mutationFn:t=>((e,t)=>{const n=`/wp/v2/${D[e].rest_base}`;return(0,M.default)({path:n,method:"POST",data:t})})(e,t),onSuccess:onSuccess}),o=(0,te.useMutation)({mutationFn:t=>((e,t)=>{const n=`/wp/v2/${D[e].rest_base}`,{id:o,...a}=t;return(0,M.default)({path:`${n}/${o}`,method:"POST",data:a})})(e,t),onSuccess:onSuccess}),a=(0,te.useMutation)({mutationFn:t=>((e,t)=>{const n=`/wp/v2/${D[e].rest_base}`;return(0,M.default)({path:`${n}/${t}`,method:"DELETE"})})(e,t),onSuccess:onSuccess});return{createPost:n,updatePost:o,deletePost:a,duplicatePost:(0,te.useMutation)({mutationFn:e=>(e=>(0,M.default)({path:"/elementor/v1/site-navigation/duplicate-post",method:"POST",data:{post_id:e.id,title:e.title}}))(e),onSuccess:onSuccess})}}var ie=__toESM(n(97557)),se=n(97557),le=n(24413),ce=n(79513),ue=n(27723);function EditModeTemplate({postTitle:e,isLoading:t,callback:n}){const[o,a]=(0,se.useState)(e),[r,i]=(0,se.useState)(!1),[s,l]=(0,se.useState)(null),c=(0,se.useRef)(),validateInput=e=>""!==e.trim(),runCallback=()=>{validateInput(o)&&n(o)};return ie.createElement(ie.Fragment,null,ie.createElement(ce.ListItem,{secondaryAction:ie.createElement(CloseButton,{isLoading:t,closeButton:c})},ie.createElement(ce.Box,{width:"100%",component:"form",onSubmit:e=>{e.preventDefault(),runCallback()}},ie.createElement(ce.TextField,{autoFocus:!0,fullWidth:!0,value:o,onChange:e=>{r||i(!0);const t=e.target.value;validateInput(t)?l(null):l((0,ue.__)("Name is required","elementor")),a(t)},disabled:t,error:!!s,onBlur:e=>{c.current!==e.relatedTarget&&runCallback()},variant:"outlined",color:"secondary",size:"small"}))),s&&ie.createElement(ce.ListItem,null,ie.createElement(ce.ListItemText,{sx:{color:"error.main"}},s)))}function CloseButton({isLoading:e,closeButton:t}){const{resetEditMode:n}=usePostListContext();return ie.createElement(ce.IconButton,{size:"small",color:"secondary",onClick:n,ref:t,disabled:e},e?ie.createElement(ce.CircularProgress,null):ie.createElement(le.XIcon,{fontSize:"small"}))}function ListItemCreate(){const{type:e,resetEditMode:t}=usePostListContext(),{createPost:n}=usePostActions(e),o=(0,Z.__useNavigateToDocument)(),{setError:a}=usePostListContext();return J.createElement(EditModeTemplate,{postTitle:(0,ee.__)("New Page","elementor"),isLoading:n.isPending,callback:async e=>{try{const{id:t}=await n.mutateAsync({title:e,status:"draft"});o(t)}catch{a()}finally{t()}}})}var pe=__toESM(n(97557)),me=n(46280),de=n(27723);function ListItemDuplicate(){const{type:e,editMode:t,resetEditMode:n}=usePostListContext(),o=(0,me.__useNavigateToDocument)(),{duplicatePost:a}=usePostActions(e),{setError:r}=usePostListContext();if("duplicate"!==t.mode)return null;return pe.createElement(EditModeTemplate,{postTitle:`${t.details.title} ${(0,de.__)("copy","elementor")}`,isLoading:a.isPending,callback:async e=>{try{const{post_id:n}=await a.mutateAsync({id:t.details.postId,title:e});o(n)}catch{r()}finally{n()}}})}var ge=__toESM(n(97557)),ye=n(46280),Ee=n(5527);function useRenameActiveDocument(){return async e=>{const t=function getV1DocumentsManager(){const e=window.elementor?.documents;if(!e)throw new Error("Elementor Editor V1 documents manager not found");return e}().getCurrent().container;await(0,Ee.__privateRunCommand)("document/elements/settings",{container:t,settings:{post_title:e}})}}function ListItemRename({post:e}){const{type:t,resetEditMode:n}=usePostListContext(),{updatePost:o}=usePostActions(t),{setError:a}=usePostListContext(),r=(0,ye.__useActiveDocument)(),i=useRenameActiveDocument(),s=r?.id===e.id,l=s?r?.title:e.title.rendered;return ge.createElement(EditModeTemplate,{postTitle:l,isLoading:o.isPending,callback:async t=>{t===l&&n();try{s?await i(t):await o.mutateAsync({id:e.id,title:t})}catch{a()}finally{n()}}})}var fe=__toESM(n(97557)),Pe=n(46280),_e=n(24413),ve=n(79513),xe=n(27723),we=__toESM(n(97557)),he=n(79513),Ie=n(97557);function useReverseHtmlEntities(e=""){return(0,Ie.useMemo)(()=>{const t=document.createElement("textarea");t.innerHTML=e;const{value:n}=t;return t.remove(),n},[e])}var PageStatus=({status:e})=>"publish"===e?null:we.createElement(he.Typography,{component:"span",variant:"body2",color:"text.secondary",sx:{textTransform:"capitalize",fontStyle:"italic",whiteSpace:"nowrap",flexBasis:"content"}},"(",e,")"),PageTitle=({title:e})=>{const t=useReverseHtmlEntities(e);return we.createElement(he.Typography,{component:"span",variant:"body2",color:"text.secondary",noWrap:!0,sx:{flexBasis:"auto"}},t)};function PageTitleAndStatus({title:e,status:t}){return we.createElement(he.Box,{display:"flex"},we.createElement(PageTitle,{title:e})," ",we.createElement(PageStatus,{status:t}))}var be=__toESM(n(97557)),Ce=n(97557),Le=n(46280),Te=n(24413),Me=n(79513),Se=n(27723),De=__toESM(n(97557)),Be=n(79513);function ActionMenuItem({title:e,icon:t,MenuItemProps:n}){return De.createElement(Be.MenuItem,{...n},De.createElement(Be.ListItemIcon,{sx:{color:"inherit"}},De.createElement(t,null)),De.createElement(Be.ListItemText,{primary:e}))}function Delete({post:e}){const[t,n]=(0,Ce.useState)(!1),o=(0,Le.__useActiveDocument)(),a=o?.id===e.id,r=!e.user_can.delete||e.isHome||a;return be.createElement(be.Fragment,null,be.createElement(ActionMenuItem,{title:(0,Se.__)("Delete","elementor"),icon:Te.TrashIcon,MenuItemProps:{disabled:r,onClick:()=>n(!0),sx:{"&:hover":{color:"error.main"}}}}),t&&be.createElement(DeleteDialog,{post:e,setIsDialogOpen:n}))}function DeleteDialog({post:e,setIsDialogOpen:t}){const{type:n}=usePostListContext(),{deletePost:o}=usePostActions(n),{setError:a}=usePostListContext(),r=(0,Se.sprintf)((0,Se.__)('Delete "%s"?',"elementor"),e.title.rendered),handleCancel=()=>{o.isPending||t(!1)};return be.createElement(Me.Dialog,{open:!0,onClose:handleCancel,"aria-labelledby":"delete-dialog"},be.createElement(Me.DialogTitle,{noWrap:!0},r),be.createElement(Me.Divider,null),be.createElement(Me.DialogContent,null,be.createElement(Me.DialogContentText,null,(0,Se.__)("The page and its content will be deleted forever and we won’t be able to recover them.","elementor"))),be.createElement(Me.DialogActions,null,be.createElement(Me.Button,{variant:"contained",color:"secondary",onClick:handleCancel,disabled:o.isPending},(0,Se.__)("Cancel","elementor")),be.createElement(Me.Button,{variant:"contained",color:"error",onClick:async()=>{try{await o.mutateAsync(e.id)}catch{a(),t(!1)}},disabled:o.isPending},o.isPending?be.createElement(Me.CircularProgress,null):(0,Se.__)("Delete","elementor"))))}var ke=__toESM(n(97557)),Ae=n(24413),Oe=n(27723);function Duplicate({post:e,popupState:t}){const{setEditMode:n}=usePostListContext(),{data:o}=useUser(),a=!o?.capabilities?.edit_pages;return ke.createElement(ActionMenuItem,{title:(0,Oe.__)("Duplicate","elementor"),icon:Ae.CopyIcon,MenuItemProps:{disabled:a,onClick:()=>{t.close(),n({mode:"duplicate",details:{postId:e.id,title:e.title.rendered}})}}})}var Ne=__toESM(n(97557)),Re=n(24413),Fe=n(27723);function Rename({post:e}){const{setEditMode:t}=usePostListContext();return Ne.createElement(ActionMenuItem,{title:(0,Fe.__)("Rename","elementor"),icon:Re.EraseIcon,MenuItemProps:{disabled:!e.user_can.edit,onClick:()=>{t({mode:"rename",details:{postId:e.id}})}}})}var He=__toESM(n(97557)),Ve=n(24413),je=n(79513),ze=n(27723),qe=n(45643);function useHomepageActions(){const e=function useInvalidateSettings(){const e=(0,qe.useQueryClient)();return(t={})=>{const n=["site-navigation","homepage"];return e.invalidateQueries({queryKey:n},t)}}();return{updateSettingsMutation:(0,qe.useMutation)({mutationFn:e=>(e=>(0,k.default)({path:"/wp/v2/settings",method:"POST",data:e}))(e),onSuccess:async()=>e({exact:!0})})}}function SetHome({post:e,closeMenu:t}){const{updateSettingsMutation:n}=useHomepageActions(),{setError:o}=usePostListContext(),{data:a}=useUser(),r=!!a?.capabilities?.manage_options,i="publish"===e.status,s=!!e.isHome,l=!r||s||!i||n.isPending;return He.createElement(ActionMenuItem,{title:(0,ze.__)("Set as homepage","elementor"),icon:n.isPending?je.CircularProgress:Ve.HomeIcon,MenuItemProps:{disabled:l,onClick:async()=>{try{await n.mutateAsync({show_on_front:"page",page_on_front:e.id})}catch{o()}finally{t()}}}})}var $e=__toESM(n(97557)),We=n(24413),Qe=n(27723);function View({post:e}){const{type:t}=usePostListContext(),n=(0,Qe.__)("View %s","elementor").replace("%s",D[t].labels.singular_name);return $e.createElement(ActionMenuItem,{title:n,icon:We.EyeIcon,MenuItemProps:{onClick:()=>window.open(e.link,"_blank")}})}var DisabledPostTooltip=({children:e,isDisabled:t})=>{if(t){const t=fe.createElement(ve.Typography,{variant:"caption"},"You cannot edit this page.",fe.createElement("br",null),"To edit it directly, contact the site owner");return fe.createElement(ve.Tooltip,{title:t,placement:"bottom",arrow:!1},e)}return fe.createElement(fe.Fragment,null,e)};function ListItemView({post:e}){const t=(0,Pe.__useActiveDocument)(),n=(0,Pe.__useNavigateToDocument)(),o=(0,ve.usePopupState)({variant:"popover",popupId:"post-actions",disableAutoFocus:!0}),a=t?.id===e.id,r=a?t?.status.value:e.status,i=a?t?.title:e.title.rendered,s=!e.user_can.edit;return fe.createElement(fe.Fragment,null,fe.createElement(DisabledPostTooltip,{isDisabled:s},fe.createElement(ve.ListItem,{disablePadding:!0,secondaryAction:fe.createElement(ve.IconButton,{value:!0,size:"small",...(0,ve.bindTrigger)(o)},fe.createElement(_e.DotsVerticalIcon,{fontSize:"small"}))},fe.createElement(ve.ListItemButton,{selected:a,disabled:s,onClick:()=>{a||n(e.id)},dense:!0},fe.createElement(ve.ListItemText,{disableTypography:!0},fe.createElement(PageTitleAndStatus,{title:i,status:r})),e.isHome&&fe.createElement(_e.HomeIcon,{titleAccess:(0,xe.__)("Homepage","elementor"),color:"disabled"})))),fe.createElement(ve.Menu,{PaperProps:{sx:{mt:2,width:200}},MenuListProps:{dense:!0},...(0,ve.bindMenu)(o)},fe.createElement(Rename,{post:e}),fe.createElement(Duplicate,{post:e,popupState:o}),fe.createElement(Delete,{post:e}),fe.createElement(View,{post:e}),fe.createElement(ve.Divider,null),fe.createElement(SetHome,{post:e,closeMenu:()=>o.close()})))}function PostListItem({post:e}){const{editMode:t}=usePostListContext();return"rename"===t.mode&&e?.id&&e?.id===t.details.postId?Y.createElement(ListItemRename,{post:e}):"create"!==t.mode||e?"duplicate"!==t.mode||e?e?Y.createElement(ListItemView,{post:e}):null:Y.createElement(ListItemDuplicate,null):Y.createElement(ListItemCreate,null)}function PostsCollapsibleList({isOpenByDefault:e=!1}){const{type:t,editMode:n}=usePostListContext(),{data:{posts:o,total:a},isLoading:r,isError:i,fetchNextPage:s,hasNextPage:l,isFetchingNextPage:c}=usePosts(t),{data:u}=useHomepage();if(i)return C.createElement(ErrorState,null);if(!o||r)return C.createElement(T.Box,{sx:{px:5}},C.createElement(T.Box,{display:"flex",justifyContent:"flex-end",alignItems:"center"},C.createElement(T.Skeleton,{sx:{my:4},animation:"wave",variant:"rounded",width:"110px",height:"28px"})),C.createElement(T.Box,null,C.createElement(T.Skeleton,{sx:{my:3},animation:"wave",variant:"rounded",width:"100%",height:"24px"}),C.createElement(T.Skeleton,{sx:{my:3},animation:"wave",variant:"rounded",width:"70%",height:"24px"}),C.createElement(T.Skeleton,{sx:{my:3},animation:"wave",variant:"rounded",width:"70%",height:"24px"}),C.createElement(T.Skeleton,{sx:{my:3},animation:"wave",variant:"rounded",width:"70%",height:"24px"})));const p=`${D[t].labels.plural_name} (${a.toString()})`,m=o.map(e=>e.id===u?{...e,isHome:!0}:e).sort((e,t)=>e.id===u?-1:t.id===u?1:0);return C.createElement(C.Fragment,null,C.createElement(T.Box,{display:"flex",justifyContent:"flex-end",alignItems:"center",sx:{py:1,px:2}},C.createElement(AddNewButton,null)),C.createElement(T.List,{dense:!0},C.createElement(CollapsibleList,{label:p,Icon:L.PageTypeIcon,isOpenByDefault:e||!1},m.map(e=>C.createElement(PostListItem,{key:e.id,post:e})),["duplicate","create"].includes(n.mode)&&C.createElement(PostListItem,null),l&&C.createElement(T.Box,{sx:{display:"flex",justifyContent:"center"}},C.createElement(T.Button,{onClick:s,color:"secondary"},c?C.createElement(T.CircularProgress,null):"Load More")))))}var shell_default=()=>{const[e,t]=(0,f.useState)(!1);return E.createElement(P.Panel,null,E.createElement(P.PanelHeader,null,E.createElement(P.PanelHeaderTitle,null,(0,_.__)("Pages","elementor"))),E.createElement(P.PanelBody,null,E.createElement(PostListContextProvider,{type:"page",setError:()=>t(!0)},E.createElement(PostsCollapsibleList,{isOpenByDefault:!0})),E.createElement(error_snackbar_default,{open:e,onClose:()=>t(!1)})))},{panel:Ue,usePanelStatus:Ke,usePanelActions:Ge}=(0,y.__createPanel)({id:"site-navigation-panel",component:shell_default}),Xe=__toESM(n(97557)),Ye=n(46280),Je=n(24413),Ze=n(79513),et=n(27723),tt=__toESM(n(97557)),nt=n(46280),ot=n(33176),at=n(24413),rt=n(79513),it=n(27723),st=n(97557),lt=__toESM(n(1455)),ct="/elementor/v1/site-navigation/add-new-post";function useCreatePage(){const[e,t]=(0,st.useState)(!1);return{create:()=>(t(!0),async function addNewPage(){return await(0,lt.default)({path:ct,method:"POST",data:{post_type:"page"}})}().then(e=>e).finally(()=>t(!1))),isLoading:e}}function CreatePostListItem({closePopup:e,...t}){const{create:n,isLoading:o}=useCreatePage(),a=(0,nt.__useNavigateToDocument)(),{data:r}=useUser(),{dispatchEvent:i,config:s}=(0,ot.useMixpanel)();return tt.createElement(rt.MenuItem,{disabled:o||!r?.capabilities?.edit_pages,onClick:async()=>{const t=s?.names?.editorOne?.topBarPageList;t&&i?.(t,{app_type:s?.appTypes?.editor,window_name:s?.appTypes?.editor,interaction_type:s?.triggers?.click?.toLowerCase(),target_type:s?.targetTypes?.dropdownItem,target_name:s?.targetNames?.pageList?.addNewPage,interaction_result:s?.interactionResults?.create,target_location:s?.locations?.topBar?.replace(/\s+/g,"_").toLowerCase(),location_l1:s?.secondaryLocations?.pageListDropdown?.replace(/\s+/g,"_").toLowerCase(),location_l2:s?.targetTypes?.dropdownItem});const{id:o}=await n();e(),await a(o)},...t},tt.createElement(rt.ListItemIcon,null,o?tt.createElement(rt.CircularProgress,{size:"1.25rem"}):tt.createElement(at.PlusIcon,{fontSize:"small"})),tt.createElement(rt.ListItemText,{primaryTypographyProps:{variant:"body2"},primary:(0,it.__)("Add new page","elementor")}))}var ut=__toESM(n(97557)),pt=n(79513);function Indicator({title:e,status:t}){return ut.createElement(Tooltip2,{title:e},ut.createElement(pt.Stack,{component:"span",direction:"row",alignItems:"center",spacing:.5},ut.createElement(pt.Typography,{component:"span",variant:"body2",sx:{maxWidth:"120px"},noWrap:!0},e),"publish"!==t.value&&ut.createElement(pt.Typography,{component:"span",variant:"body2",sx:{fontStyle:"italic"}},"(",t.label,")")))}function Tooltip2(e){return ut.createElement(pt.Tooltip,{PopperProps:{sx:{"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom":{mt:2.7}}},...e})}var mt=__toESM(n(97557)),dt=n(46280),gt=n(33176),yt=n(79513),Et=__toESM(n(97557)),ft=n(24413),Pt=n(79513),_t=function getIconsMap(){return m}();function DocTypeChip({postType:e,docType:t,label:n}){const o="elementor_library"===e?"global":"primary",a=_t[t]||ft.PostTypeIcon;return Et.createElement(Pt.Chip,{component:"span",size:"small",variant:"outlined",label:n,"data-value":t,color:o,icon:Et.createElement(a,null),sx:{ml:1,cursor:"inherit"}})}function PostListItem2({post:e,closePopup:t,...n}){const o=(0,dt.__useNavigateToDocument)(),a=useReverseHtmlEntities(e.title),{dispatchEvent:r,config:i}=(0,gt.useMixpanel)();return mt.createElement(yt.MenuItem,{disabled:!e.user_can.edit,onClick:async()=>{const n=i?.names?.editorOne?.topBarPageList;n&&r?.(n,{app_type:i?.appTypes?.editor,window_name:i?.appTypes?.editor,interaction_type:i?.triggers?.click?.toLowerCase(),target_type:i?.targetTypes?.dropdownItem,target_name:a,interaction_result:i?.interactionResults?.navigate,target_location:i?.locations?.topBar?.replace(/\s+/g,"_").toLowerCase(),location_l1:i?.secondaryLocations?.pageListDropdown?.replace(/\s+/g,"_").toLowerCase(),location_l2:i?.targetTypes?.dropdownItem}),t(),await o(e.id)},...n},mt.createElement(yt.ListItemText,{sx:{flexGrow:0},primaryTypographyProps:{variant:"body2",noWrap:!0},primary:a}),mt.createElement(DocTypeChip,{postType:e.type.post_type,docType:e.type.doc_type,label:e.type.label}))}function RecentlyEdited(){const e=(0,Ye.__useActiveDocument)(),t=(0,Ye.__useHostDocument)(),n=e&&"kit"!==e.type.value?e:t,{data:o}=function useRecentPosts(){return(0,ne.useQuery)({queryKey:re,queryFn:()=>getRequest2()})}(),a=o?o.filter(e=>e.id!==n?.id).splice(0,ae-1):[],r=(0,Ze.usePopupState)({variant:"popover",popupId:"elementor-v2-top-bar-recently-edited"}),i=useReverseHtmlEntities(n?.title);if(!n)return null;const s=(0,Ze.bindTrigger)(r);return Xe.createElement(Xe.Fragment,null,Xe.createElement(Ze.Button,{color:"inherit",size:"small",endIcon:Xe.createElement(Je.ChevronDownIcon,{fontSize:"small"}),...s,onClick:e=>{const t=window,n=t?.elementorCommon?.eventsManager?.config;n&&t.elementorCommon.eventsManager.dispatchEvent(n.names.topBar.documentNameDropdown,{location:n.locations.topBar,secondaryLocation:n.secondaryLocations.documentNameDropdown,trigger:n.triggers.dropdownClick,element:n.elements.dropdown}),s.onClick(e)}},Xe.createElement(Indicator,{title:i,status:n.status})),Xe.createElement(Ze.Menu,{MenuListProps:{subheader:Xe.createElement(Ze.ListSubheader,{color:"primary",sx:{fontStyle:"italic",fontWeight:"300"}},(0,et.__)("Recent","elementor"))},PaperProps:{sx:{mt:2.5,width:320}},...(0,Ze.bindMenu)(r)},a.map(e=>Xe.createElement(PostListItem2,{key:e.id,post:e,closePopup:r.close})),0===a.length&&Xe.createElement(Ze.MenuItem,{disabled:!0},Xe.createElement(Ze.ListItemText,{primaryTypographyProps:{variant:"caption",fontStyle:"italic"},primary:(0,et.__)("There are no other pages or templates on this site yet.","elementor")})),Xe.createElement(Ze.Divider,{disabled:0===a.length}),Xe.createElement(CreatePostListItem,{closePopup:r.close})))}var vt=n(78806),{env:xt}=(0,vt.parseEnv)("@elementor/editor-site-navigation",e=>e),wt=n(24413),ht=n(27723);function useToggleButtonProps(){const{isOpen:e,isBlocked:t}=Ke(),{open:n,close:o}=Ge();return{title:(0,ht.__)("Pages","elementor"),icon:wt.PagesIcon,onClick:()=>{const t=window,a=t?.elementorCommon?.eventsManager?.config;return a&&t.elementorCommon.eventsManager.dispatchEvent("top_bar_pages",{location:a.locations.topBar,secondaryLocation:a.secondaryLocations.elementorLogo,trigger:a.triggers.click,element:a.elements.buttonIcon}),e?o():n()},selected:e,disabled:t}}function init(){!function registerTopBarMenuItems(){(0,d.injectIntoPageIndication)({id:"document-recently-edited",component:RecentlyEdited})}(),xt.is_pages_panel_active&&((0,g.__registerPanel)(Ue),function registerButton(){d.toolsMenu.registerToggleAction({id:"toggle-site-navigation-panel",priority:20,useProps:useToggleButtonProps})}())}},97557:function(e){e.exports=window.React}},t={};var n=function __webpack_require__(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,__webpack_require__),a.exports}(83617);(window.elementorV2=window.elementorV2||{}).editorSiteNavigation=n}(),window.elementorV2.editorSiteNavigation?.init?.();