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