/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.0.5 (2019-05-09) */ !function(o){"use strict";var a=function(t){var e=t,r=function(){return e};return{get:r,set:function(t){e=t},clone:function(){return a(r())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.Delay"),i=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),u=tinymce.util.Tools.resolve("tinymce.util.Tools"),s=function(t,e){var r=t||e,n=/^(\d+)([ms]?)$/.exec(""+r);return(n[2]?{s:1e3,m:6e4}[n[2]]:1)*parseInt(r,10)},f=function(t){var e=t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-");return e=(e=(e=(e=e.replace(/\{path\}/g,o.document.location.pathname)).replace(/\{query\}/g,o.document.location.search)).replace(/\{hash\}/g,o.document.location.hash)).replace(/\{id\}/g,t.id)},c=function(t,e){var r=t.settings.forced_root_block;return""===(e=u.trim(void 0===e?t.getBody().innerHTML:e))||new RegExp("^<"+r+"[^>]*>((\xa0| |[ \t]|]*>)+?|)|
$","i").test(e)},l=function(t){var e=parseInt(i.getItem(f(t)+"time"),10)||0;return!((new Date).getTime()-e>s(t.settings.autosave_retention,"20m")&&(m(t,!1),1))},m=function(t,e){var r=f(t);i.removeItem(r+"draft"),i.removeItem(r+"time"),!1!==e&&t.fire("RemoveDraft")},v=function(t){var e=f(t);!c(t)&&t.isDirty()&&(i.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),i.setItem(e+"time",(new Date).getTime().toString()),t.fire("StoreDraft"))},d=function(t){var e=f(t);l(t)&&(t.setContent(i.getItem(e+"draft"),{format:"raw"}),t.fire("RestoreDraft"))},g=function(t,e){var r=s(t.settings.autosave_interval,"30s");e.get()||(n.setInterval(function(){t.removed||v(t)},r),e.set(!0))},y=function(t){t.undoManager.transact(function(){d(t),m(t)}),t.focus()};function p(n){for(var o=[],t=1;t