File "editor-documents.min.js"

Full Path: /home/diablzlo/glucosebalnce.com/wp-content/plugins/elementor/assets/js/packages/editor-documents/editor-documents.min.js
File size: 6.13 KB
MIME-type: text/plain
Charset: utf-8

!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 b},__useHostDocument:function(){return d},__useNavigateToDocument:function(){return C},__useOpenDocumentInNewTab:function(){return E},getCurrentDocument:function(){return k},getV1DocumentsManager:function(){return p},init:function(){return I},setDocumentModifiedStatus:function(){return y},slice:function(){return m}});var n=window.elementorV2.editor,i=window.elementorV2.store,o=window.React,a=window.wp.i18n;const s=t=>t.documents.entities,r=(0,i.__createSelector)(s,t=>t.documents.activeId,(t,e)=>e&&t[e]?t[e]:null),c=(0,i.__createSelector)(s,t=>t.documents.hostId,(t,e)=>e&&t[e]?t[e]:null);function u(){return(0,i.__useSelector)(r)}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,a.__)('Edit "%s" with Elementor',"elementor").replace("%s",n.title);window.document.title=t},[n?.title])}(),null}function _(t){return!(!t.activeId||!t.entities[t.activeId])}const 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)}}});var v=window.elementorV2.editorV1Adapters,f=window.elementorV2.utils;function p(){const t=window.elementor?.documents;if(!t)throw new Error("Elementor Editor V1 documents manager not found");return t}function g(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 w(t){return t?.config?.panel?.show_copy_and_share??!1}function h(t){return t.config.urls.permalink??""}function S(t){const e=t.config.revisions.current_id!==t.id,n=g(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:h(t),platformEdit:n},isDirty:t.editor.isChanged||e,isSaving:t.editor.isSaving,isSavingDraft:!1,permissions:{allowAddingWidgets:t.config.panel?.allow_adding_widgets??!0,showCopyAndShare:w(t)},userCan:{publish:t.config.user.can_publish}}}function y(t){(0,v.__privateRunCommandSync)("document/save/set-is-modified",{status:t},{internal:!0})}function I(){(0,i.__registerSlice)(m),function(){const{init:t}=m.actions;(0,v.__privateListenTo)((0,v.v1ReadyEvent)(),()=>{const e=p(),n=Object.entries(e.documents).reduce((t,[e,n])=>(t[e]=S(n),t),{});(0,i.__dispatch)(t({entities:n,hostId:e.getInitialId(),activeId:e.getCurrentId()}))})}(),function(){const{activateDocument:t,setAsHost:e}=m.actions;(0,v.__privateListenTo)((0,v.commandEndEvent)("editor/documents/open"),()=>{const n=p(),o=S(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,v.__privateListenTo)((0,v.commandStartEvent)("document/save/save"),e=>{a(e)?(0,i.__dispatch)(n()):(0,i.__dispatch)(t())}),(0,v.__privateListenTo)((0,v.commandEndEvent)("document/save/save"),t=>{const n=S(p().getCurrent());a(t)?(0,i.__dispatch)(o(n)):(0,i.__dispatch)(e(n))})}(),function(){const{updateActiveDocument:t}=m.actions,e=(0,f.debounce)(e=>{const n=e;if(!("post_title"in n.args?.settings))return;const o=p().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}=m.actions;(0,v.__privateListenTo)((0,v.commandEndEvent)("document/save/set-is-modified"),()=>{const n=r((0,i.__getState)())?.isSaving;n||(p().getCurrent().editor.isChanged?(0,i.__dispatch)(t()):(0,i.__dispatch)(e()))})}(),function(){const{updateActiveDocument:t}=m.actions,e=(0,f.debounce)(e=>{const n=e;if(!("exit_to"in n.args?.settings))return;const o=p().getCurrent(),a=g(o),s=h(o);(0,i.__dispatch)(t({links:{platformEdit:a,permalink:s}}))},400);(0,v.__privateListenTo)((0,v.commandEndEvent)("document/elements/settings"),e)}(),(0,n.injectIntoLogic)({id:"documents-hooks",component:l})}function b(){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 D=t=>{const e=new URL(window.location.href);return e.searchParams.set("post",t.toString()),e.searchParams.delete("active-document"),e};function C(){return(0,o.useCallback)(async t=>{const e=D(t);await(0,v.__privateRunCommand)("editor/documents/switch",{id:t,setAsInitial:!0}),history.replaceState({},"",e)},[])}function E(){return(0,o.useCallback)(t=>{const e=D(t);window.open(e.href)},[])}function k(){return r((0,i.__getState)())}(window.elementorV2=window.elementorV2||{}).editorDocuments=e}(),window.elementorV2.editorDocuments?.init?.();