OwlCyberSecurity - MANAGER
Edit File: editor-documents.min.js
!function(){"use strict";var t={d:function(e,n){for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{__useActiveDocument:function(){return u},__useActiveDocumentActions:function(){return y},__useHostDocument:function(){return l},__useNavigateToDocument:function(){return S},slice:function(){return m}});var n=window.elementorV2.editor,i=window.elementorV2.store,o=window.React,a=window.wp.i18n,s=window.elementorV2.editorV1Adapters,r=t=>t.documents.entities,c=(0,i.__createSelector)(r,(t=>t.documents.activeId),((t,e)=>e&&t[e]?t[e]:null)),d=(0,i.__createSelector)(r,(t=>t.documents.hostId),((t,e)=>e&&t[e]?t[e]:null));function u(){return(0,i.__useSelector)(c)}function l(){return(0,i.__useSelector)(d)}function _(t){return!(!t.activeId||!t.entities[t.activeId])}var m=(0,i.__createSlice)({name:"documents",initialState:{entities:{},activeId:null,hostId:null},reducers:{init(t,{payload:e}){t.entities=e.entities,t.hostId=e.hostId,t.activeId=e.activeId},activateDocument(t,e){t.entities[e.payload.id]=e.payload,t.activeId=e.payload.id},setAsHost(t,e){t.hostId=e.payload},updateActiveDocument(t,e){_(t)&&(t.entities[t.activeId]={...t.entities[t.activeId],...e.payload})},startSaving(t){_(t)&&(t.entities[t.activeId].isSaving=!0)},endSaving(t,e){_(t)&&(t.entities[t.activeId]={...e.payload,isSaving:!1})},startSavingDraft:t=>{_(t)&&(t.entities[t.activeId].isSavingDraft=!0)},endSavingDraft(t,e){_(t)&&(t.entities[t.activeId]={...e.payload,isSavingDraft:!1})},markAsDirty(t){_(t)&&(t.entities[t.activeId].isDirty=!0)},markAsPristine(t){_(t)&&(t.entities[t.activeId].isDirty=!1)}}});function v(){const t=window.elementor?.documents;if(!t)throw new Error("Elementor Editor V1 documents manager not found");return t}function p(t){switch(window.elementor?.getPreferences?.("exit_to")||"this_post"){case"dashboard":return t.config.urls.main_dashboard;case"all_posts":return t.config.urls.all_post_type;default:return t.config.urls.exit_to_dashboard}}function f(t){return t?.config?.panel?.show_copy_and_share??!1}function g(t){return t.config.urls.permalink??""}function h(t){const e=t.config.revisions.current_id!==t.id,n=p(t);return{id:t.id,title:t.container.settings.get("post_title"),type:{value:t.config.type,label:t.config.panel.title},status:{value:t.config.status.value,label:t.config.status.label},links:{permalink:g(t),platformEdit:n},isDirty:t.editor.isChanged||e,isSaving:t.editor.isSaving,isSavingDraft:!1,permissions:{allowAddingWidgets:t.config.panel?.allow_adding_widgets??!0,showCopyAndShare:f(t)},userCan:{publish:t.config.user.can_publish}}}function w(t,e){let n;return(...i)=>{clearTimeout(n),n=setTimeout((()=>{t(...i)}),e)}}function y(){const t=u(),e=t?.links?.permalink??"";return{save:(0,o.useCallback)((()=>(0,s.__privateRunCommand)("document/save/default")),[]),saveDraft:(0,o.useCallback)((()=>(0,s.__privateRunCommand)("document/save/draft")),[]),saveTemplate:(0,o.useCallback)((()=>(0,s.__privateOpenRoute)("library/save-template")),[]),copyAndShare:(0,o.useCallback)((()=>{navigator.clipboard.writeText(e)}),[e])}}function S(){return(0,o.useCallback)((async t=>{await(0,s.__privateRunCommand)("editor/documents/switch",{id:t,setAsInitial:!0});const e=new URL(window.location.href);e.searchParams.set("post",t.toString()),e.searchParams.delete("active-document"),history.replaceState({},"",e)}),[])}(0,i.__registerSlice)(m),function(){const{init:t}=m.actions;(0,s.__privateListenTo)((0,s.v1ReadyEvent)(),(()=>{const e=v(),n=Object.entries(e.documents).reduce(((t,[e,n])=>(t[e]=h(n),t)),{});(0,i.__dispatch)(t({entities:n,hostId:e.getInitialId(),activeId:e.getCurrentId()}))}))}(),function(){const{activateDocument:t,setAsHost:e}=m.actions;(0,s.__privateListenTo)((0,s.commandEndEvent)("editor/documents/open"),(()=>{const n=v(),o=h(n.getCurrent());(0,i.__dispatch)(t(o)),n.getInitialId()===o.id&&(0,i.__dispatch)(e(o.id))}))}(),function(){const{startSaving:t,endSaving:e,startSavingDraft:n,endSavingDraft:o}=m.actions,a=t=>{const e=t;return"autosave"===e.args?.status};(0,s.__privateListenTo)((0,s.commandStartEvent)("document/save/save"),(e=>{a(e)?(0,i.__dispatch)(n()):(0,i.__dispatch)(t())})),(0,s.__privateListenTo)((0,s.commandEndEvent)("document/save/save"),(t=>{const n=h(v().getCurrent());a(t)?(0,i.__dispatch)(o(n)):(0,i.__dispatch)(e(n))}))}(),function(){const{updateActiveDocument:t}=m.actions,e=w((e=>{const n=e;if(!("post_title"in n.args?.settings))return;const o=v().getCurrent().container.settings.get("post_title");(0,i.__dispatch)(t({title:o}))}),400);(0,s.__privateListenTo)((0,s.commandEndEvent)("document/elements/settings"),e)}(),function(){const{markAsDirty:t,markAsPristine:e}=m.actions;(0,s.__privateListenTo)((0,s.commandEndEvent)("document/save/set-is-modified"),(()=>{v().getCurrent().editor.isChanged?(0,i.__dispatch)(t()):(0,i.__dispatch)(e())}))}(),function(){const{updateActiveDocument:t}=m.actions,e=w((e=>{const n=e;if(!("exit_to"in n.args?.settings))return;const o=v().getCurrent(),a=p(o),s=g(o);(0,i.__dispatch)(t({links:{platformEdit:a,permalink:s}}))}),400);(0,s.__privateListenTo)((0,s.commandEndEvent)("document/elements/settings"),e)}(),(0,n.injectIntoLogic)({id:"documents-hooks",component:function(){return function(){const t=u(),e=l(),n=t&&"kit"!==t.type.value?t:e;(0,o.useEffect)((()=>{if(void 0===n?.title)return;const t=(0,a.__)('Edit "%s" with Elementor',"elementor").replace("%s",n.title);window.document.title=t}),[n?.title])}(),null}}),(window.elementorV2=window.elementorV2||{}).editorDocuments=e}();