/
var
/
www
/
html
/
wordpress
/
wp-content
/
plugins
/
elementor
/
assets
/
js
/
packages
/
editor-documents
/
Upload File
HOME
!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,{COMPONENT_DOCUMENT_TYPE:function(){return L},__useActiveDocument:function(){return u},__useActiveDocumentActions:function(){return P},__useHostDocument:function(){return d},__useNavigateToDocument:function(){return V},__useOpenDocumentInNewTab:function(){return R},getCurrentDocument:function(){return p},getV1CurrentDocument:function(){return C},getV1DocumentsManager:function(){return g},init:function(){return A},invalidateDocumentData:function(){return E},isDocumentDirty:function(){return b},reloadCurrentDocument:function(){return k},setDocumentModifiedStatus:function(){return I},slice:function(){return _},switchToDocument:function(){return T}});var n=window.elementorV2.editor,i=window.elementorV2.store,o=window.React,r=window.wp.i18n;const a=t=>t.documents.entities,s=(0,i.__createSelector)(a,t=>t.documents.activeId,(t,e)=>e&&t[e]?t[e]:null),c=(0,i.__createSelector)(a,t=>t.documents.hostId,(t,e)=>e&&t[e]?t[e]:null);function u(){return(0,i.__useSelector)(s)}function d(){return(0,i.__useSelector)(c)}function l(){return function(){const t=u(),e=d(),n=t&&"kit"!==t.type.value?t:e;(0,o.useEffect)(()=>{if(void 0===n?.title)return;const t=(0,r.__)('Edit "%s" with Elementor',"elementor").replace("%s",n.title);window.document.title=t},[n?.title])}(),null}function m(t){return!(!t.activeId||!t.entities[t.activeId])}const _=(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){m(t)&&(t.entities[t.activeId]={...t.entities[t.activeId],...e.payload})},startSaving(t){m(t)&&(t.entities[t.activeId].isSaving=!0)},endSaving(t,e){m(t)&&(t.entities[t.activeId]={...e.payload,isSaving:!1})},startSavingDraft:t=>{m(t)&&(t.entities[t.activeId].isSavingDraft=!0)},endSavingDraft(t,e){m(t)&&(t.entities[t.activeId]={...e.payload,isSavingDraft:!1})},markAsDirty(t){m(t)&&(t.entities[t.activeId].isDirty=!0)},markAsPristine(t){m(t)&&(t.entities[t.activeId].isDirty=!1)}}});var v=window.elementorV2.editorV1Adapters,f=window.elementorV2.utils;function p(){return s((0,i.__getState)())}function g(){const t=window.elementor?.documents;if(!t)throw new Error("Elementor Editor V1 documents manager not found");return t}function w(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 h(t){return t?.config?.panel?.show_copy_and_share??!1}function S(t){return t.config.urls.permalink??""}function D(t){return t.config.urls.wp_preview??""}function y(t){const e=t.config.revisions.current_id!==t.id,n=w(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:S(t),wpPreview:D(t),platformEdit:n},isDirty:t.editor.isChanged||e,isSaving:t.editor.isSaving,isSavingDraft:!1,permissions:{allowAddingWidgets:t.config.panel?.allow_adding_widgets??!0,showCopyAndShare:h(t)},userCan:{publish:t.config.user.can_publish}}}function I(t){(0,v.__privateRunCommandSync)("document/save/set-is-modified",{status:t},{internal:!0})}function C(){return window.elementor?.documents?.getCurrent()}function b(t){const e="draft"===t.status.value,n=t.revisions?.current_id!==t.id;return e||n}function E(t){g().invalidateCache(t)}function k(){const t=p();return t?.id?(g().invalidateCache(),(0,v.__privateRunCommand)("editor/documents/switch",{id:t.id,shouldScroll:!1,shouldNavigateToDefaultRoute:!1})):Promise.resolve()}function T(t,e){return(0,v.__privateRunCommand)("editor/documents/switch",{id:t,...e})}function A(){(0,i.__registerSlice)(_),function(){const{init:t}=_.actions;(0,v.__privateListenTo)((0,v.v1ReadyEvent)(),()=>{const e=g(),n=Object.entries(e.documents).reduce((t,[e,n])=>(t[e]=y(n),t),{});(0,i.__dispatch)(t({entities:n,hostId:e.getInitialId(),activeId:e.getCurrentId()}))})}(),function(){const{activateDocument:t,setAsHost:e}=_.actions;(0,v.__privateListenTo)((0,v.commandEndEvent)("editor/documents/open"),()=>{const n=g(),o=y(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}=_.actions,r=t=>{const e=t;return"autosave"===e.args?.status};(0,v.__privateListenTo)((0,v.commandStartEvent)("document/save/save"),e=>{r(e)?(0,i.__dispatch)(n()):(0,i.__dispatch)(t())}),(0,v.__privateListenTo)((0,v.commandEndEvent)("document/save/save"),t=>{const n=y(g().getCurrent());r(t)?(0,i.__dispatch)(o(n)):(0,i.__dispatch)(e(n))})}(),function(){const{updateActiveDocument:t}=_.actions,e=(0,f.debounce)(e=>{const n=e;if(!("post_title"in n.args?.settings))return;const o=g().getCurrent().container.settings.get("post_title");(0,i.__dispatch)(t({title:o}))},400);(0,v.__privateListenTo)((0,v.commandEndEvent)("document/elements/settings"),e)}(),function(){const{markAsDirty:t,markAsPristine:e}=_.actions;(0,v.__privateListenTo)((0,v.commandEndEvent)("document/save/set-is-modified"),()=>{const n=s((0,i.__getState)())?.isSaving;n||(g().getCurrent().editor.isChanged?(0,i.__dispatch)(t()):(0,i.__dispatch)(e()))})}(),function(){const{updateActiveDocument:t}=_.actions,e=(0,f.debounce)(e=>{const n=e;if(!("exit_to"in n.args?.settings))return;const o=g().getCurrent(),r=w(o),a=S(o),s=D(o);(0,i.__dispatch)(t({links:{platformEdit:r,permalink:a,wpPreview:s}}))},400);(0,v.__privateListenTo)((0,v.commandEndEvent)("document/elements/settings"),e)}(),(0,n.injectIntoLogic)({id:"documents-hooks",component:l})}function P(){const t=u(),e=t?.links?.permalink??"";return{save:(0,o.useCallback)(()=>(0,v.__privateRunCommand)("document/save/default"),[]),saveDraft:(0,o.useCallback)(()=>(0,v.__privateRunCommand)("document/save/draft"),[]),saveTemplate:(0,o.useCallback)(()=>(0,v.__privateOpenRoute)("library/save-template"),[]),copyAndShare:(0,o.useCallback)(()=>{navigator.clipboard.writeText(e)},[e])}}const O=t=>{const e=new URL(window.location.href);return e.searchParams.set("post",t.toString()),e.searchParams.delete("active-document"),e};function V(){return(0,o.useCallback)(async t=>{const e=O(t);await T(t,{setAsInitial:!0}),history.replaceState({},"",e)},[])}function R(){return(0,o.useCallback)(t=>{const e=O(t);window.open(e.href)},[])}const L="elementor_component";(window.elementorV2=window.elementorV2||{}).editorDocuments=e}(),window.elementorV2.editorDocuments?.init?.();