OwlCyberSecurity - MANAGER
Edit File: editor-site-navigation.min.js
!function(){"use strict";var e={d:function(t,n){for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{extendIconsMap:function(){return y}});var n=window.elementorV2.icons,a=window.React,o=window.elementorV2.ui,r=window.elementorV2.editorDocuments,i=window.elementorV2.query,l=window.wp.apiFetch,s=window.wp.i18n,c=window.elementorV2.editorAppBar,u=window.elementorV2.editorPanels,m=window.elementorV2.editorV1Adapters,d=window.elementorV2.env,p={page:n.PageTemplateIcon,section:n.SectionTemplateIcon,container:n.ContainerTemplateIcon,"wp-page":n.PageTypeIcon,"wp-post":n.PostTypeIcon};function y(e){Object.assign(p,e)}function g({title:e,status:t}){return a.createElement(E,{title:e},a.createElement(o.Stack,{component:"span",direction:"row",alignItems:"center",spacing:.5},a.createElement(o.Typography,{component:"span",variant:"body2",sx:{maxWidth:"120px"},noWrap:!0},e),"publish"!==t.value&&a.createElement(o.Typography,{component:"span",variant:"body2",sx:{fontStyle:"italic"}},"(",t.label,")")))}function E(e){return a.createElement(o.Tooltip,{PopperProps:{sx:{"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom":{mt:2.7}}},...e})}var h=["site-navigation","recent-posts"],f=p;function _({postType:e,docType:t,label:r}){const i="elementor_library"===e?"global":"primary",l=f[t]||n.PostTypeIcon;return a.createElement(o.Chip,{component:"span",size:"small",variant:"outlined",label:r,"data-value":t,color:i,icon:a.createElement(l,null),sx:{ml:1,cursor:"inherit"}})}function v(e=""){return(0,a.useMemo)((()=>{const t=document.createElement("textarea");t.innerHTML=e;const{value:n}=t;return t.remove(),n}),[e])}function P({post:e,closePopup:t,...n}){const i=(0,r.__useNavigateToDocument)(),l=v(e.title);return a.createElement(o.MenuItem,{disabled:!e.user_can.edit,onClick:async()=>{t(),await i(e.id)},...n},a.createElement(o.ListItemText,{sx:{flexGrow:0},primaryTypographyProps:{variant:"body2",noWrap:!0},primary:l}),a.createElement(_,{postType:e.type.post_type,docType:e.type.doc_type,label:e.type.label}))}var x="/elementor/v1/site-navigation/add-new-post";var w=()=>{const e="/wp/v2/users/me?"+new URLSearchParams({_fields:["capabilities"].join(","),context:"edit"}).toString();return l({path:e})},b=()=>["site-navigation","user"];function I(){return(0,i.useQuery)({queryKey:b(),queryFn:()=>w()})}function T({closePopup:e,...t}){const{create:i,isLoading:c}=function(){const[e,t]=(0,a.useState)(!1);return{create:()=>(t(!0),async function(){return await l({path:x,method:"POST",data:{post_type:"page"}})}().then((e=>e)).finally((()=>t(!1)))),isLoading:e}}(),u=(0,r.__useNavigateToDocument)(),{data:m}=I();return a.createElement(o.MenuItem,{disabled:c||!m?.capabilities?.edit_pages,onClick:async()=>{const{id:t}=await i();e(),await u(t)},...t},a.createElement(o.ListItemIcon,null,c?a.createElement(o.CircularProgress,{size:"1.25rem"}):a.createElement(n.PlusIcon,{fontSize:"small"})),a.createElement(o.ListItemText,{primaryTypographyProps:{variant:"body2"},primary:(0,s.__)("Add new page","elementor")}))}var S={page:{labels:{singular_name:(0,s.__)("Page","elementor"),plural_name:(0,s.__)("Pages","elementor")},rest_base:"pages"}},M=(e,t)=>{const n=`/wp/v2/${S[e].rest_base}`;return l({path:n,method:"POST",data:t})},C=(e,t)=>{const n=`/wp/v2/${S[e].rest_base}`,{id:a,...o}=t;return l({path:`${n}/${a}`,method:"POST",data:o})},D=(e,t)=>{const n=`/wp/v2/${S[e].rest_base}`;return l({path:`${n}/${t}`,method:"DELETE"})},L=e=>l({path:"/elementor/v1/site-navigation/duplicate-post",method:"POST",data:{post_id:e.id,title:e.title}}),k=e=>["site-navigation","posts",e],B=e=>{if(!e)return e;const t=[];return e.pages.forEach((e=>{t.push(...e.data)})),t},A={type:"page",editMode:{mode:"none",details:{}},setEditMode:()=>null,resetEditMode:()=>null,setError:()=>null},O=(0,a.createContext)(A),F=({type:e,setError:t,children:n})=>{const[o,r]=(0,a.useState)(A.editMode);return a.createElement(O.Provider,{value:{type:e,editMode:o,setEditMode:r,resetEditMode:()=>{r(A.editMode)},setError:t}},n)};function z(){const e=(0,a.useContext)(O);if(!e)throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");return e}var N=(0,o.styled)(n.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})}))),j=(0,o.styled)(o.ListItemIcon)((({theme:e})=>({minWidth:e.spacing(4)})));function V({label:e,Icon:t,isOpenByDefault:n=!1,children:r}){const[i,l]=(0,a.useState)(n);return a.createElement(a.Fragment,null,a.createElement(o.ListItem,null,a.createElement(j,{sx:{color:"text.secondary"}},a.createElement(o.IconButton,{onClick:()=>l((e=>!e)),size:"small",sx:{color:"inherit"}},a.createElement(N,{fontSize:"small",isOpen:i}))),a.createElement(j,{size:"small",sx:{color:"inherit"}},a.createElement(t,{fontSize:"small"})),a.createElement(o.ListItemText,{primaryTypographyProps:{variant:"subtitle2",component:"span"},primary:e})),a.createElement(o.Collapse,{in:i,timeout:"auto",unmountOnExit:!0},a.createElement(o.List,{dense:!0},r)),a.createElement(o.Divider,{sx:{mt:1}}))}function q(e){const t=function(e){const t=(0,i.useQueryClient)();return(n={})=>{const a=k(e);return t.invalidateQueries({queryKey:h},n),t.invalidateQueries({queryKey:a},n)}}(e),n=()=>t({exact:!0});return{createPost:(0,i.useMutation)({mutationFn:t=>M(e,t),onSuccess:n}),updatePost:(0,i.useMutation)({mutationFn:t=>C(e,t),onSuccess:n}),deletePost:(0,i.useMutation)({mutationFn:t=>D(e,t),onSuccess:n}),duplicatePost:(0,i.useMutation)({mutationFn:e=>L(e),onSuccess:n})}}function $({postTitle:e,isLoading:t,callback:n}){const[r,i]=(0,a.useState)(e),[l,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(null),d=(0,a.useRef)(),p=e=>""!==e.trim(),y=()=>{p(r)&&n(r)};return a.createElement(a.Fragment,null,a.createElement(o.ListItem,{secondaryAction:a.createElement(H,{isLoading:t,closeButton:d})},a.createElement(o.Box,{width:"100%",component:"form",onSubmit:e=>{e.preventDefault(),y()}},a.createElement(o.TextField,{autoFocus:!0,fullWidth:!0,value:r,onChange:e=>{l||c(!0);const t=e.target.value;p(t)?m(null):m((0,s.__)("Name is required","elementor")),i(t)},disabled:t,error:!!u,onBlur:e=>{d.current!==e.relatedTarget&&y()},variant:"outlined",color:"secondary",size:"small"}))),u&&a.createElement(o.ListItem,null,a.createElement(o.ListItemText,{sx:{color:"error.main"}},u)))}function H({isLoading:e,closeButton:t}){const{resetEditMode:r}=z();return a.createElement(o.IconButton,{size:"small",color:"secondary",onClick:r,ref:t,disabled:e},e?a.createElement(o.CircularProgress,null):a.createElement(n.XIcon,{fontSize:"small"}))}function W({post:e}){const{type:t,resetEditMode:n}=z(),{updatePost:o}=q(t),{setError:i}=z(),l=(0,r.__useActiveDocument)(),s=async e=>{const t=function(){const e=window.elementor?.documents;if(!e)throw new Error("Elementor Editor V1 documents manager not found");return e}().getCurrent().container;await(0,m.__privateRunCommand)("document/elements/settings",{container:t,settings:{post_title:e}})},c=l?.id===e.id,u=c?l?.title:e.title.rendered;return a.createElement($,{postTitle:u,isLoading:o.isPending,callback:async t=>{t===u&&n();try{c?await s(t):await o.mutateAsync({id:e.id,title:t})}catch(e){i()}finally{n()}}})}function Q(){const{type:e,resetEditMode:t}=z(),{createPost:n}=q(e),o=(0,r.__useNavigateToDocument)(),{setError:i}=z();return a.createElement($,{postTitle:(0,s.__)("New Page","elementor"),isLoading:n.isPending,callback:async e=>{try{const{id:t}=await n.mutateAsync({title:e,status:"draft"});o(t)}catch(e){i()}finally{t()}}})}function R(){const{type:e,editMode:t,resetEditMode:n}=z(),o=(0,r.__useNavigateToDocument)(),{duplicatePost:i}=q(e),{setError:l}=z();return"duplicate"!==t.mode?null:a.createElement($,{postTitle:`${t.details.title} ${(0,s.__)("copy","elementor")}`,isLoading:i.isPending,callback:async e=>{try{const{post_id:n}=await i.mutateAsync({id:t.details.postId,title:e});o(n)}catch(e){l()}finally{n()}}})}var K=({status:e})=>"publish"===e?null:a.createElement(o.Typography,{component:"span",variant:"body2",color:"text.secondary",sx:{textTransform:"capitalize",fontStyle:"italic",whiteSpace:"nowrap",flexBasis:"content"}},"(",e,")"),U=({title:e})=>{const t=v(e);return a.createElement(o.Typography,{component:"span",variant:"body2",color:"text.secondary",noWrap:!0,sx:{flexBasis:"auto"}},t)};function G({title:e,status:t}){return a.createElement(o.Box,{display:"flex"},a.createElement(U,{title:e})," ",a.createElement(K,{status:t}))}function X({title:e,icon:t,MenuItemProps:n}){return a.createElement(o.MenuItem,{...n},a.createElement(o.ListItemIcon,{sx:{color:"inherit"}},a.createElement(t,null)),a.createElement(o.ListItemText,{primary:e}))}function Y({post:e}){const{setEditMode:t}=z();return a.createElement(X,{title:(0,s.__)("Rename","elementor"),icon:n.EraseIcon,MenuItemProps:{disabled:!e.user_can.edit,onClick:()=>{t({mode:"rename",details:{postId:e.id}})}}})}function J({post:e,popupState:t}){const{setEditMode:o}=z(),{data:r}=I(),i=!r?.capabilities?.edit_pages;return a.createElement(X,{title:(0,s.__)("Duplicate","elementor"),icon:n.CopyIcon,MenuItemProps:{disabled:i,onClick:()=>{t.close(),o({mode:"duplicate",details:{postId:e.id,title:e.title.rendered}})}}})}function Z({post:e}){const[t,o]=(0,a.useState)(!1),i=(0,r.__useActiveDocument)(),l=i?.id===e.id,c=!e.user_can.delete||e.isHome||l;return a.createElement(a.Fragment,null,a.createElement(X,{title:(0,s.__)("Delete","elementor"),icon:n.TrashIcon,MenuItemProps:{disabled:c,onClick:()=>o(!0),sx:{"&:hover":{color:"error.main"}}}}),t&&a.createElement(ee,{post:e,setIsDialogOpen:o}))}function ee({post:e,setIsDialogOpen:t}){const{type:n}=z(),{deletePost:r}=q(n),{setError:i}=z(),l=(0,s.sprintf)((0,s.__)('Delete "%s"?',"elementor"),e.title.rendered),c=()=>{r.isPending||t(!1)};return a.createElement(o.Dialog,{open:!0,onClose:c,"aria-labelledby":"delete-dialog"},a.createElement(o.DialogTitle,{noWrap:!0},l),a.createElement(o.Divider,null),a.createElement(o.DialogContent,null,a.createElement(o.DialogContentText,null,(0,s.__)("The page and its content will be deleted forever and we won’t be able to recover them.","elementor"))),a.createElement(o.DialogActions,null,a.createElement(o.Button,{variant:"contained",color:"secondary",onClick:c,disabled:r.isPending},(0,s.__)("Cancel","elementor")),a.createElement(o.Button,{variant:"contained",color:"error",onClick:async()=>{try{await r.mutateAsync(e.id)}catch(e){i(),t(!1)}},disabled:r.isPending},r.isPending?a.createElement(o.CircularProgress,null):(0,s.__)("Delete","elementor"))))}function te({post:e}){const{type:t}=z(),o=(0,s.__)("View %s","elementor").replace("%s",S[t].labels.singular_name);return a.createElement(X,{title:o,icon:n.EyeIcon,MenuItemProps:{onClick:()=>window.open(e.link,"_blank")}})}var ne=e=>l({path:"/wp/v2/settings",method:"POST",data:e}),ae=()=>["site-navigation","homepage"];function oe({post:e,closeMenu:t}){const{updateSettingsMutation:r}=function(){const e=function(){const e=(0,i.useQueryClient)();return(t={})=>{const n=ae();return e.invalidateQueries({queryKey:n},t)}}();return{updateSettingsMutation:(0,i.useMutation)({mutationFn:e=>ne(e),onSuccess:async()=>e({exact:!0})})}}(),{setError:l}=z(),{data:c}=I(),u=!!c?.capabilities?.manage_options,m="publish"===e.status,d=!!e.isHome,p=!u||d||!m||r.isPending;return a.createElement(X,{title:(0,s.__)("Set as homepage","elementor"),icon:r.isPending?o.CircularProgress:n.HomeIcon,MenuItemProps:{disabled:p,onClick:async()=>{try{await r.mutateAsync({show_on_front:"page",page_on_front:e.id})}catch(e){l()}finally{t()}}}})}var re=({children:e,isDisabled:t})=>{if(t){const t=a.createElement(o.Typography,{variant:"caption"},"You cannot edit this page.",a.createElement("br",null),"To edit it directly, contact the site owner");return a.createElement(o.Tooltip,{title:t,placement:"bottom",arrow:!1},e)}return a.createElement(a.Fragment,null,e)};function ie({post:e}){const t=(0,r.__useActiveDocument)(),i=(0,r.__useNavigateToDocument)(),l=(0,o.usePopupState)({variant:"popover",popupId:"post-actions",disableAutoFocus:!0}),c=t?.id===e.id,u=c?t?.status.value:e.status,m=c?t?.title:e.title.rendered,d=!e.user_can.edit;return a.createElement(a.Fragment,null,a.createElement(re,{isDisabled:d},a.createElement(o.ListItem,{disablePadding:!0,secondaryAction:a.createElement(o.IconButton,{value:!0,size:"small",...(0,o.bindTrigger)(l)},a.createElement(n.DotsVerticalIcon,{fontSize:"small"}))},a.createElement(o.ListItemButton,{selected:c,disabled:d,onClick:()=>{c||i(e.id)},dense:!0},a.createElement(o.ListItemText,{disableTypography:!0},a.createElement(G,{title:m,status:u})),e.isHome&&a.createElement(n.HomeIcon,{titleAccess:(0,s.__)("Homepage","elementor"),color:"disabled"})))),a.createElement(o.Menu,{PaperProps:{sx:{mt:2,width:200}},MenuListProps:{dense:!0},...(0,o.bindMenu)(l)},a.createElement(Y,{post:e}),a.createElement(J,{post:e,popupState:l}),a.createElement(Z,{post:e}),a.createElement(te,{post:e}),a.createElement(o.Divider,null),a.createElement(oe,{post:e,closeMenu:()=>l.close()})))}function le({post:e}){const{editMode:t}=z();return"rename"===t.mode&&e?.id&&e?.id===t.details.postId?a.createElement(W,{post:e}):"create"!==t.mode||e?"duplicate"!==t.mode||e?e?a.createElement(ie,{post:e}):null:a.createElement(R,null):a.createElement(Q,null)}function se(){const{setEditMode:e}=z(),{data:t}=I();return a.createElement(o.Button,{size:"small",startIcon:a.createElement(n.PlusIcon,null),disabled:!t?.capabilities?.edit_pages,onClick:()=>{e({mode:"create",details:{}})},sx:{px:1.5}},(0,s.__)("Add New","elementor"))}function ce(){return a.createElement(o.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pt:"40px",gap:"16px"}},a.createElement(n.Error404TemplateIcon,null),a.createElement(o.Box,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"8px"}},a.createElement(o.Typography,{variant:"body1",color:"text.primary"},(0,s.__)("We couldn’t display your pages.","elementor")),a.createElement(o.Box,null,a.createElement(o.Typography,{variant:"body2",color:"text.primary",sx:{textAlign:"center"}},(0,s.__)("It’s probably a temporary issue.","elementor")),a.createElement(o.Typography,{variant:"body2",color:"text.primary",sx:{textAlign:"center"}},(0,s.__)("If the problem persists,","elementor")," ",a.createElement(o.Link,{target:"_blank",href:"https://go.elementor.com/wp-editor-support-open-ticket/"},"Notify support")))))}function ue({isOpenByDefault:e=!1}){const{type:t,editMode:r}=z(),{data:{posts:s,total:c},isLoading:u,isError:m,fetchNextPage:d,hasNextPage:p,isFetchingNextPage:y}=function(e){const t=(0,i.useInfiniteQuery)({queryKey:k(e),queryFn:({pageParam:t=1})=>(async(e,t)=>{const n=`/wp/v2/${S[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(),a=await l({path:n,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}})(e,t),initialPageParam:1,getNextPageParam:e=>e.currentPage<e.totalPages?e.currentPage+1:void 0});return{...t,data:{posts:B(t.data),total:t.data?.pages[0]?.totalPosts??0}}}(t),{data:g}=(0,i.useQuery)({queryKey:ae(),queryFn:()=>l({path:"/elementor/v1/site-navigation/homepage"})});if(m)return a.createElement(ce,null);if(!s||u)return a.createElement(o.Box,{sx:{px:5}},a.createElement(o.Box,{display:"flex",justifyContent:"flex-end",alignItems:"center"},a.createElement(o.Skeleton,{sx:{my:4},animation:"wave",variant:"rounded",width:"110px",height:"28px"})),a.createElement(o.Box,null,a.createElement(o.Skeleton,{sx:{my:3},animation:"wave",variant:"rounded",width:"100%",height:"24px"}),a.createElement(o.Skeleton,{sx:{my:3},animation:"wave",variant:"rounded",width:"70%",height:"24px"}),a.createElement(o.Skeleton,{sx:{my:3},animation:"wave",variant:"rounded",width:"70%",height:"24px"}),a.createElement(o.Skeleton,{sx:{my:3},animation:"wave",variant:"rounded",width:"70%",height:"24px"})));const E=`${S[t].labels.plural_name} (${c.toString()})`,h=s.map((e=>e.id===g?{...e,isHome:!0}:e)).sort(((e,t)=>e.id===g?-1:t.id===g?1:0));return a.createElement(a.Fragment,null,a.createElement(o.Box,{display:"flex",justifyContent:"flex-end",alignItems:"center",sx:{py:1,px:2}},a.createElement(se,null)),a.createElement(o.List,{dense:!0},a.createElement(V,{label:E,Icon:n.PageTypeIcon,isOpenByDefault:e||!1},h.map((e=>a.createElement(le,{key:e.id,post:e}))),["duplicate","create"].includes(r.mode)&&a.createElement(le,null),p&&a.createElement(o.Box,{sx:{display:"flex",justifyContent:"center"}},a.createElement(o.Button,{onClick:d,color:"secondary"},y?a.createElement(o.CircularProgress,null):"Load More")))))}var me=({open:e,onClose:t})=>a.createElement(o.Snackbar,{open:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"}},a.createElement(o.Alert,{onClose:t,severity:"error",sx:{width:"100%"}},a.createElement(o.Typography,{component:"span",sx:{fontWeight:"bold"}},"We couldn’t complete the action.")," ","Please try again")),{panel:de,usePanelStatus:pe,usePanelActions:ye}=(0,u.__createPanel)({id:"site-navigation-panel",component:()=>{const[e,t]=a.useState(!1);return a.createElement(u.Panel,null,a.createElement(u.PanelHeader,null,a.createElement(u.PanelHeaderTitle,null,(0,s.__)("Pages","elementor"))),a.createElement(u.PanelBody,null,a.createElement(F,{type:"page",setError:()=>t(!0)},a.createElement(ue,{isOpenByDefault:!0})),a.createElement(me,{open:e,onClose:()=>t(!1)})))}});var{env:ge,validateEnv:Ee}=(0,d.parseEnv)("@elementor/editor-site-navigation",(e=>e));(0,c.injectIntoPageIndication)({id:"document-recently-edited",component:function(){const e=(0,r.__useActiveDocument)(),t=(0,r.__useHostDocument)(),c=e&&"kit"!==e.type.value?e:t,{data:u}=(0,i.useQuery)({queryKey:h,queryFn:()=>(()=>{const e=`/elementor/v1/site-navigation/recent-posts?${new URLSearchParams({posts_per_page:"6"}).toString()}`;return l({path:e})})()}),m=u?u.filter((e=>e.id!==c?.id)).splice(0,5):[],d=(0,o.usePopupState)({variant:"popover",popupId:"elementor-v2-top-bar-recently-edited"}),p=v(c?.title);return c?a.createElement(a.Fragment,null,a.createElement(o.Button,{color:"inherit",size:"small",endIcon:a.createElement(n.ChevronDownIcon,{fontSize:"small"}),...(0,o.bindTrigger)(d)},a.createElement(g,{title:p,status:c.status})),a.createElement(o.Menu,{MenuListProps:{subheader:a.createElement(o.ListSubheader,{color:"primary",sx:{fontStyle:"italic",fontWeight:"300"}},(0,s.__)("Recent","elementor"))},PaperProps:{sx:{mt:2.5,width:320}},...(0,o.bindMenu)(d)},m.map((e=>a.createElement(P,{key:e.id,post:e,closePopup:d.close}))),0===m.length&&a.createElement(o.MenuItem,{disabled:!0},a.createElement(o.ListItemText,{primaryTypographyProps:{variant:"caption",fontStyle:"italic"},primary:(0,s.__)("There are no other pages or templates on this site yet.","elementor")})),a.createElement(o.Divider,{disabled:0===m.length}),a.createElement(T,{closePopup:d.close}))):null}}),ge.is_pages_panel_active&&((0,u.__registerPanel)(de),c.toolsMenu.registerToggleAction({id:"toggle-site-navigation-panel",priority:2,useProps:function(){const{isOpen:e,isBlocked:t}=pe(),{open:a,close:o}=ye();return{title:(0,s.__)("Pages","elementor"),icon:n.PagesIcon,onClick:()=>e?o():a(),selected:e,disabled:t}}})),(window.elementorV2=window.elementorV2||{}).editorSiteNavigation=t}();