1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-04 21:15:24 +02:00

WIP vendored dep upgrades

This commit is contained in:
Harvey Kandola 2018-01-19 11:36:38 +00:00
parent 5f59e95495
commit 6409ad0d63
190 changed files with 64265 additions and 109666 deletions

812
gui/public/tinymce/plugins/autosave/plugin.js Executable file → Normal file
View file

@ -1,608 +1,226 @@
(function () {
var autosave = (function () {
'use strict';
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
// Used when there is no 'main' module.
// The name is probably (hopefully) unique so minification removes for releases.
var register_3795 = function (id) {
var module = dem(id);
var fragments = id.split('.');
var target = Function('return this;')();
for (var i = 0; i < fragments.length - 1; ++i) {
if (target[fragments[i]] === undefined)
target[fragments[i]] = {};
target = target[fragments[i]];
}
target[fragments[fragments.length - 1]] = module;
};
var instantiate = function (id) {
var actual = defs[id];
var dependencies = actual.deps;
var definition = actual.defn;
var len = dependencies.length;
var instances = new Array(len);
for (var i = 0; i < len; ++i)
instances[i] = dem(dependencies[i]);
var defResult = definition.apply(null, instances);
if (defResult === undefined)
throw 'module [' + id + '] returned undefined';
actual.instance = defResult;
};
var def = function (id, dependencies, definition) {
if (typeof id !== 'string')
throw 'module id must be a string';
else if (dependencies === undefined)
throw 'no dependencies for ' + id;
else if (definition === undefined)
throw 'no definition function for ' + id;
defs[id] = {
deps: dependencies,
defn: definition,
instance: undefined
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
var clone = function () {
return Cell(get());
};
return {
get: get,
set: set,
clone: clone
};
};
};
var dem = function (id) {
var actual = defs[id];
if (actual === undefined)
throw 'module [' + id + '] was undefined';
else if (actual.instance === undefined)
instantiate(id);
return actual.instance;
};
var PluginManager = tinymce.util.Tools.resolve('tinymce.PluginManager');
var req = function (ids, callback) {
var len = ids.length;
var instances = new Array(len);
for (var i = 0; i < len; ++i)
instances[i] = dem(ids[i]);
callback.apply(null, instances);
};
var LocalStorage = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');
var ephox = {};
var Tools = tinymce.util.Tools.resolve('tinymce.util.Tools');
ephox.bolt = {
module: {
api: {
define: def,
require: req,
demand: dem
var fireRestoreDraft = function (editor) {
return editor.fire('RestoreDraft');
};
var fireStoreDraft = function (editor) {
return editor.fire('StoreDraft');
};
var fireRemoveDraft = function (editor) {
return editor.fire('RemoveDraft');
};
var $_cpojbd8ajcg89c05 = {
fireRestoreDraft: fireRestoreDraft,
fireStoreDraft: fireStoreDraft,
fireRemoveDraft: fireRemoveDraft
};
var parse = function (time, defaultTime) {
var multiples = {
s: 1000,
m: 60000
};
time = /^(\d+)([ms]?)$/.exec('' + (time || defaultTime));
return (time[2] ? multiples[time[2]] : 1) * parseInt(time, 10);
};
var $_4jglf38cjcg89c0a = { parse: parse };
var shouldAskBeforeUnload = function (editor) {
return editor.getParam('autosave_ask_before_unload', true);
};
var getAutoSavePrefix = function (editor) {
var prefix = editor.getParam('autosave_prefix', 'tinymce-autosave-{path}{query}{hash}-{id}-');
prefix = prefix.replace(/\{path\}/g, document.location.pathname);
prefix = prefix.replace(/\{query\}/g, document.location.search);
prefix = prefix.replace(/\{hash\}/g, document.location.hash);
prefix = prefix.replace(/\{id\}/g, editor.id);
return prefix;
};
var shouldRestoreWhenEmpty = function (editor) {
return editor.getParam('autosave_restore_when_empty', false);
};
var getAutoSaveInterval = function (editor) {
return $_4jglf38cjcg89c0a.parse(editor.settings.autosave_interval, '30s');
};
var getAutoSaveRetention = function (editor) {
return $_4jglf38cjcg89c0a.parse(editor.settings.autosave_retention, '20m');
};
var $_5ygewb8bjcg89c08 = {
shouldAskBeforeUnload: shouldAskBeforeUnload,
getAutoSavePrefix: getAutoSavePrefix,
shouldRestoreWhenEmpty: shouldRestoreWhenEmpty,
getAutoSaveInterval: getAutoSaveInterval,
getAutoSaveRetention: getAutoSaveRetention
};
var isEmpty = function (editor, html) {
var forcedRootBlockName = editor.settings.forced_root_block;
html = Tools.trim(typeof html === 'undefined' ? editor.getBody().innerHTML : html);
return html === '' || new RegExp('^<' + forcedRootBlockName + '[^>]*>((\xA0|&nbsp;|[ \t]|<br[^>]*>)+?|)</' + forcedRootBlockName + '>|<br>$', 'i').test(html);
};
var hasDraft = function (editor) {
var time = parseInt(LocalStorage.getItem($_5ygewb8bjcg89c08.getAutoSavePrefix(editor) + 'time'), 10) || 0;
if (new Date().getTime() - time > $_5ygewb8bjcg89c08.getAutoSaveRetention(editor)) {
removeDraft(editor, false);
return false;
}
}
};
var define = def;
var require = req;
var demand = dem;
// this helps with minification when using a lot of global references
var defineGlobal = function (id, ref) {
define(id, [], function () { return ref; });
};
/*jsc
["tinymce.plugins.autosave.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.autosave.api.Api","tinymce.plugins.autosave.core.BeforeUnload","tinymce.plugins.autosave.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.autosave.core.Storage","global!window","tinymce.core.EditorManager","tinymce.core.util.Tools","tinymce.plugins.autosave.api.Settings","global!setInterval","tinymce.core.util.LocalStorage","tinymce.plugins.autosave.api.Events","global!document","tinymce.plugins.autosave.core.Time"]
jsc*/
define(
'ephox.katamari.api.Cell',
[
],
function () {
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
var clone = function () {
return Cell(get());
};
return {
get: get,
set: set,
clone: clone
};
};
return Cell;
}
);
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.PluginManager',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.PluginManager');
}
);
defineGlobal("global!setInterval", setInterval);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.util.LocalStorage',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.util.LocalStorage');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.util.Tools',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.util.Tools');
}
);
/**
* Events.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.plugins.autosave.api.Events',
[
],
function () {
var fireRestoreDraft = function (editor) {
return editor.fire('RestoreDraft');
};
var fireStoreDraft = function (editor) {
return editor.fire('StoreDraft');
};
var fireRemoveDraft = function (editor) {
return editor.fire('RemoveDraft');
};
return {
fireRestoreDraft: fireRestoreDraft,
fireStoreDraft: fireStoreDraft,
fireRemoveDraft: fireRemoveDraft
};
}
);
defineGlobal("global!document", document);
/**
* Time.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.plugins.autosave.core.Time',
[
],
function () {
var parse = function (time, defaultTime) {
var multiples = {
s: 1000,
m: 60000
};
time = /^(\d+)([ms]?)$/.exec('' + (time || defaultTime));
return (time[2] ? multiples[time[2]] : 1) * parseInt(time, 10);
};
return {
parse: parse
};
}
);
/**
* Settings.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.plugins.autosave.api.Settings',
[
'global!document',
'tinymce.plugins.autosave.core.Time'
],
function (document, Time) {
var shouldAskBeforeUnload = function (editor) {
return editor.getParam("autosave_ask_before_unload", true);
};
var getAutoSavePrefix = function (editor) {
var prefix = editor.getParam('autosave_prefix', 'tinymce-autosave-{path}{query}{hash}-{id}-');
prefix = prefix.replace(/\{path\}/g, document.location.pathname);
prefix = prefix.replace(/\{query\}/g, document.location.search);
prefix = prefix.replace(/\{hash\}/g, document.location.hash);
prefix = prefix.replace(/\{id\}/g, editor.id);
return prefix;
};
var shouldRestoreWhenEmpty = function (editor) {
return editor.getParam('autosave_restore_when_empty', false);
};
var getAutoSaveInterval = function (editor) {
return Time.parse(editor.settings.autosave_interval, '30s');
};
var getAutoSaveRetention = function (editor) {
return Time.parse(editor.settings.autosave_retention, '20m');
};
return {
shouldAskBeforeUnload: shouldAskBeforeUnload,
getAutoSavePrefix: getAutoSavePrefix,
shouldRestoreWhenEmpty: shouldRestoreWhenEmpty,
getAutoSaveInterval: getAutoSaveInterval,
getAutoSaveRetention: getAutoSaveRetention
};
}
);
/**
* Storage.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.plugins.autosave.core.Storage',
[
'global!setInterval',
'tinymce.core.util.LocalStorage',
'tinymce.core.util.Tools',
'tinymce.plugins.autosave.api.Events',
'tinymce.plugins.autosave.api.Settings'
],
function (setInterval, LocalStorage, Tools, Events, Settings) {
var isEmpty = function (editor, html) {
var forcedRootBlockName = editor.settings.forced_root_block;
html = Tools.trim(typeof html === "undefined" ? editor.getBody().innerHTML : html);
return html === '' || new RegExp(
'^<' + forcedRootBlockName + '[^>]*>((\u00a0|&nbsp;|[ \t]|<br[^>]*>)+?|)<\/' + forcedRootBlockName + '>|<br>$', 'i'
).test(html);
};
var hasDraft = function (editor) {
var time = parseInt(LocalStorage.getItem(Settings.getAutoSavePrefix(editor) + "time"), 10) || 0;
if (new Date().getTime() - time > Settings.getAutoSaveRetention(editor)) {
removeDraft(editor, false);
return false;
}
return true;
};
var removeDraft = function (editor, fire) {
var prefix = Settings.getAutoSavePrefix(editor);
LocalStorage.removeItem(prefix + "draft");
LocalStorage.removeItem(prefix + "time");
if (fire !== false) {
Events.fireRemoveDraft(editor);
}
};
var storeDraft = function (editor) {
var prefix = Settings.getAutoSavePrefix(editor);
if (!isEmpty(editor) && editor.isDirty()) {
LocalStorage.setItem(prefix + "draft", editor.getContent({ format: 'raw', no_events: true }));
LocalStorage.setItem(prefix + "time", new Date().getTime());
Events.fireStoreDraft(editor);
}
};
var restoreDraft = function (editor) {
var prefix = Settings.getAutoSavePrefix(editor);
if (hasDraft(editor)) {
editor.setContent(LocalStorage.getItem(prefix + "draft"), { format: 'raw' });
Events.fireRestoreDraft(editor);
}
};
var startStoreDraft = function (editor, started) {
var interval = Settings.getAutoSaveInterval(editor);
if (!started.get()) {
setInterval(function () {
if (!editor.removed) {
storeDraft(editor);
}
}, interval);
started.set(true);
}
};
var restoreLastDraft = function (editor) {
editor.undoManager.transact(function () {
restoreDraft(editor);
removeDraft(editor);
});
editor.focus();
};
return {
isEmpty: isEmpty,
hasDraft: hasDraft,
removeDraft: removeDraft,
storeDraft: storeDraft,
restoreDraft: restoreDraft,
startStoreDraft: startStoreDraft,
restoreLastDraft: restoreLastDraft
};
}
);
/**
* Api.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.plugins.autosave.api.Api',
[
'tinymce.plugins.autosave.core.Storage'
],
function (Storage) {
// Inlined the curry function since adding Fun without tree shaking to every plugin would produce a lot of bloat
var curry = function (f, editor) {
return function () {
var args = Array.prototype.slice.call(arguments);
return f.apply(null, [editor].concat(args));
};
};
var get = function (editor) {
return {
hasDraft: curry(Storage.hasDraft, editor),
storeDraft: curry(Storage.storeDraft, editor),
restoreDraft: curry(Storage.restoreDraft, editor),
removeDraft: curry(Storage.removeDraft, editor),
isEmpty: curry(Storage.isEmpty, editor)
};
};
return {
get: get
};
}
);
defineGlobal("global!window", window);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.EditorManager',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.EditorManager');
}
);
/**
* BeforeUnload.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.plugins.autosave.core.BeforeUnload',
[
'global!window',
'tinymce.core.EditorManager',
'tinymce.core.util.Tools',
'tinymce.plugins.autosave.api.Settings'
],
function (window, EditorManager, Tools, Settings) {
EditorManager._beforeUnloadHandler = function () {
var msg;
Tools.each(EditorManager.get(), function (editor) {
// Store a draft for each editor instance
if (editor.plugins.autosave) {
editor.plugins.autosave.storeDraft();
return true;
};
var removeDraft = function (editor, fire) {
var prefix = $_5ygewb8bjcg89c08.getAutoSavePrefix(editor);
LocalStorage.removeItem(prefix + 'draft');
LocalStorage.removeItem(prefix + 'time');
if (fire !== false) {
$_cpojbd8ajcg89c05.fireRemoveDraft(editor);
}
};
var storeDraft = function (editor) {
var prefix = $_5ygewb8bjcg89c08.getAutoSavePrefix(editor);
if (!isEmpty(editor) && editor.isDirty()) {
LocalStorage.setItem(prefix + 'draft', editor.getContent({
format: 'raw',
no_events: true
}));
LocalStorage.setItem(prefix + 'time', new Date().getTime().toString());
$_cpojbd8ajcg89c05.fireStoreDraft(editor);
}
};
var restoreDraft = function (editor) {
var prefix = $_5ygewb8bjcg89c08.getAutoSavePrefix(editor);
if (hasDraft(editor)) {
editor.setContent(LocalStorage.getItem(prefix + 'draft'), { format: 'raw' });
$_cpojbd8ajcg89c05.fireRestoreDraft(editor);
}
};
var startStoreDraft = function (editor, started) {
var interval = $_5ygewb8bjcg89c08.getAutoSaveInterval(editor);
if (!started.get()) {
setInterval(function () {
if (!editor.removed) {
storeDraft(editor);
}
// Setup a return message if the editor is dirty
if (!msg && editor.isDirty() && Settings.shouldAskBeforeUnload(editor)) {
msg = editor.translate("You have unsaved changes are you sure you want to navigate away?");
}
});
return msg;
};
var setup = function (editor) {
window.onbeforeunload = EditorManager._beforeUnloadHandler;
};
return {
setup: setup
};
}
);
/**
* Buttons.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.plugins.autosave.ui.Buttons',
[
'tinymce.plugins.autosave.core.Storage'
],
function (Storage) {
var postRender = function (editor, started) {
return function (e) {
var ctrl = e.control;
ctrl.disabled(!Storage.hasDraft(editor));
editor.on('StoreDraft RestoreDraft RemoveDraft', function () {
ctrl.disabled(!Storage.hasDraft(editor));
});
// TODO: Investigate why this is only done on postrender that would
// make the feature broken if only the menu item was rendered since
// it is rendered when the menu appears
Storage.startStoreDraft(editor, started);
};
};
var register = function (editor, started) {
editor.addButton('restoredraft', {
title: 'Restore last draft',
onclick: function () {
Storage.restoreLastDraft(editor);
},
onPostRender: postRender(editor, started)
});
editor.addMenuItem('restoredraft', {
text: 'Restore last draft',
onclick: function () {
Storage.restoreLastDraft(editor);
},
onPostRender: postRender(editor, started),
context: 'file'
});
};
return {
register: register
};
}
);
/**
* Plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/**
* This class contains all core logic for the autosave plugin.
*
* @class tinymce.autosave.Plugin
* @private
*/
define(
'tinymce.plugins.autosave.Plugin',
[
'ephox.katamari.api.Cell',
'tinymce.core.PluginManager',
'tinymce.plugins.autosave.api.Api',
'tinymce.plugins.autosave.core.BeforeUnload',
'tinymce.plugins.autosave.ui.Buttons'
],
function (Cell, PluginManager, Api, BeforeUnload, Buttons) {
PluginManager.add('autosave', function (editor) {
var started = Cell(false);
BeforeUnload.setup(editor);
Buttons.register(editor, started);
return Api.get(editor);
}, interval);
started.set(true);
}
};
var restoreLastDraft = function (editor) {
editor.undoManager.transact(function () {
restoreDraft(editor);
removeDraft(editor);
});
editor.focus();
};
var $_c6kll487jcg89c01 = {
isEmpty: isEmpty,
hasDraft: hasDraft,
removeDraft: removeDraft,
storeDraft: storeDraft,
restoreDraft: restoreDraft,
startStoreDraft: startStoreDraft,
restoreLastDraft: restoreLastDraft
};
return function () { };
}
);
dem('tinymce.plugins.autosave.Plugin')();
})();
var curry = function (f, editor) {
return function () {
var args = Array.prototype.slice.call(arguments);
return f.apply(null, [editor].concat(args));
};
};
var get = function (editor) {
return {
hasDraft: curry($_c6kll487jcg89c01.hasDraft, editor),
storeDraft: curry($_c6kll487jcg89c01.storeDraft, editor),
restoreDraft: curry($_c6kll487jcg89c01.restoreDraft, editor),
removeDraft: curry($_c6kll487jcg89c01.removeDraft, editor),
isEmpty: curry($_c6kll487jcg89c01.isEmpty, editor)
};
};
var $_91gau386jcg89bzz = { get: get };
var EditorManager = tinymce.util.Tools.resolve('tinymce.EditorManager');
EditorManager._beforeUnloadHandler = function () {
var msg;
Tools.each(EditorManager.get(), function (editor) {
if (editor.plugins.autosave) {
editor.plugins.autosave.storeDraft();
}
if (!msg && editor.isDirty() && $_5ygewb8bjcg89c08.shouldAskBeforeUnload(editor)) {
msg = editor.translate('You have unsaved changes are you sure you want to navigate away?');
}
});
return msg;
};
var setup = function (editor) {
window.onbeforeunload = EditorManager._beforeUnloadHandler;
};
var $_fyjy3q8djcg89c0c = { setup: setup };
var postRender = function (editor, started) {
return function (e) {
var ctrl = e.control;
ctrl.disabled(!$_c6kll487jcg89c01.hasDraft(editor));
editor.on('StoreDraft RestoreDraft RemoveDraft', function () {
ctrl.disabled(!$_c6kll487jcg89c01.hasDraft(editor));
});
$_c6kll487jcg89c01.startStoreDraft(editor, started);
};
};
var register = function (editor, started) {
editor.addButton('restoredraft', {
title: 'Restore last draft',
onclick: function () {
$_c6kll487jcg89c01.restoreLastDraft(editor);
},
onPostRender: postRender(editor, started)
});
editor.addMenuItem('restoredraft', {
text: 'Restore last draft',
onclick: function () {
$_c6kll487jcg89c01.restoreLastDraft(editor);
},
onPostRender: postRender(editor, started),
context: 'file'
});
};
var $_5oe0fk8fjcg89c0e = { register: register };
PluginManager.add('autosave', function (editor) {
var started = Cell(false);
$_fyjy3q8djcg89c0c.setup(editor);
$_5oe0fk8fjcg89c0e.register(editor, started);
return $_91gau386jcg89bzz.get(editor);
});
var Plugin = function () {
};
return Plugin;
}());
})()

2
gui/public/tinymce/plugins/autosave/plugin.min.js vendored Executable file → Normal file
View file

@ -1 +1 @@
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};g("1",[],function(){var a=function(b){var c=b,d=function(){return c},e=function(a){c=a},f=function(){return a(d())};return{get:d,set:e,clone:f}};return a}),h("6",tinymce.util.Tools.resolve),g("2",["6"],function(a){return a("tinymce.PluginManager")}),h("c",setInterval),g("d",["6"],function(a){return a("tinymce.util.LocalStorage")}),g("a",["6"],function(a){return a("tinymce.util.Tools")}),g("e",[],function(){var a=function(a){return a.fire("RestoreDraft")},b=function(a){return a.fire("StoreDraft")},c=function(a){return a.fire("RemoveDraft")};return{fireRestoreDraft:a,fireStoreDraft:b,fireRemoveDraft:c}}),h("f",document),g("g",[],function(){var a=function(a,b){var c={s:1e3,m:6e4};return a=/^(\d+)([ms]?)$/.exec(""+(a||b)),(a[2]?c[a[2]]:1)*parseInt(a,10)};return{parse:a}}),g("b",["f","g"],function(a,b){var c=function(a){return a.getParam("autosave_ask_before_unload",!0)},d=function(b){var c=b.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-");return c=c.replace(/\{path\}/g,a.location.pathname),c=c.replace(/\{query\}/g,a.location.search),c=c.replace(/\{hash\}/g,a.location.hash),c=c.replace(/\{id\}/g,b.id)},e=function(a){return a.getParam("autosave_restore_when_empty",!1)},f=function(a){return b.parse(a.settings.autosave_interval,"30s")},g=function(a){return b.parse(a.settings.autosave_retention,"20m")};return{shouldAskBeforeUnload:c,getAutoSavePrefix:d,shouldRestoreWhenEmpty:e,getAutoSaveInterval:f,getAutoSaveRetention:g}}),g("7",["c","d","a","e","b"],function(a,b,c,d,e){var f=function(a,b){var d=a.settings.forced_root_block;return b=c.trim("undefined"==typeof b?a.getBody().innerHTML:b),""===b||new RegExp("^<"+d+"[^>]*>((\xa0|&nbsp;|[ \t]|<br[^>]*>)+?|)</"+d+">|<br>$","i").test(b)},g=function(a){var c=parseInt(b.getItem(e.getAutoSavePrefix(a)+"time"),10)||0;return!((new Date).getTime()-c>e.getAutoSaveRetention(a))||(h(a,!1),!1)},h=function(a,c){var f=e.getAutoSavePrefix(a);b.removeItem(f+"draft"),b.removeItem(f+"time"),c!==!1&&d.fireRemoveDraft(a)},i=function(a){var c=e.getAutoSavePrefix(a);!f(a)&&a.isDirty()&&(b.setItem(c+"draft",a.getContent({format:"raw",no_events:!0})),b.setItem(c+"time",(new Date).getTime()),d.fireStoreDraft(a))},j=function(a){var c=e.getAutoSavePrefix(a);g(a)&&(a.setContent(b.getItem(c+"draft"),{format:"raw"}),d.fireRestoreDraft(a))},k=function(b,c){var d=e.getAutoSaveInterval(b);c.get()||(a(function(){b.removed||i(b)},d),c.set(!0))},l=function(a){a.undoManager.transact(function(){j(a),h(a)}),a.focus()};return{isEmpty:f,hasDraft:g,removeDraft:h,storeDraft:i,restoreDraft:j,startStoreDraft:k,restoreLastDraft:l}}),g("3",["7"],function(a){var b=function(a,b){return function(){var c=Array.prototype.slice.call(arguments);return a.apply(null,[b].concat(c))}},c=function(c){return{hasDraft:b(a.hasDraft,c),storeDraft:b(a.storeDraft,c),restoreDraft:b(a.restoreDraft,c),removeDraft:b(a.removeDraft,c),isEmpty:b(a.isEmpty,c)}};return{get:c}}),h("8",window),g("9",["6"],function(a){return a("tinymce.EditorManager")}),g("4",["8","9","a","b"],function(a,b,c,d){b._beforeUnloadHandler=function(){var a;return c.each(b.get(),function(b){b.plugins.autosave&&b.plugins.autosave.storeDraft(),!a&&b.isDirty()&&d.shouldAskBeforeUnload(b)&&(a=b.translate("You have unsaved changes are you sure you want to navigate away?"))}),a};var e=function(c){a.onbeforeunload=b._beforeUnloadHandler};return{setup:e}}),g("5",["7"],function(a){var b=function(b,c){return function(d){var e=d.control;e.disabled(!a.hasDraft(b)),b.on("StoreDraft RestoreDraft RemoveDraft",function(){e.disabled(!a.hasDraft(b))}),a.startStoreDraft(b,c)}},c=function(c,d){c.addButton("restoredraft",{title:"Restore last draft",onclick:function(){a.restoreLastDraft(c)},onPostRender:b(c,d)}),c.addMenuItem("restoredraft",{text:"Restore last draft",onclick:function(){a.restoreLastDraft(c)},onPostRender:b(c,d),context:"file"})};return{register:c}}),g("0",["1","2","3","4","5"],function(a,b,c,d,e){return b.add("autosave",function(b){var f=a(!1);return d.setup(b),e.register(b,f),c.get(b)}),function(){}}),d("0")()}();
!function(){"use strict";var t=function(e){var r=e,n=function(){return r};return{get:n,set:function(t){r=t},clone:function(){return t(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),r=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),n=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(t){return t.fire("RestoreDraft")},o=function(t){return t.fire("StoreDraft")},i=function(t){return t.fire("RemoveDraft")},s=function(t,e){return((t=/^(\d+)([ms]?)$/.exec(""+(t||e)))[2]?{s:1e3,m:6e4}[t[2]]:1)*parseInt(t,10)},u=function(t){return t.getParam("autosave_ask_before_unload",!0)},f=function(t){var e=t.getParam("autosave_prefix","tinymce-autosave-{path}{query}{hash}-{id}-");return e=e.replace(/\{path\}/g,document.location.pathname),e=e.replace(/\{query\}/g,document.location.search),e=e.replace(/\{hash\}/g,document.location.hash),e=e.replace(/\{id\}/g,t.id)},c=function(t){return s(t.settings.autosave_interval,"30s")},l=function(t){return s(t.settings.autosave_retention,"20m")},m=function(t,e){var r=t.settings.forced_root_block;return""===(e=n.trim(void 0===e?t.getBody().innerHTML:e))||new RegExp("^<"+r+"[^>]*>((\xa0|&nbsp;|[ \t]|<br[^>]*>)+?|)</"+r+">|<br>$","i").test(e)},v=function(t){var e=parseInt(r.getItem(f(t)+"time"),10)||0;return!((new Date).getTime()-e>l(t))||(d(t,!1),!1)},d=function(t,e){var n=f(t);r.removeItem(n+"draft"),r.removeItem(n+"time"),!1!==e&&i(t)},D=function(t){var e=f(t);!m(t)&&t.isDirty()&&(r.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),r.setItem(e+"time",(new Date).getTime().toString()),o(t))},g=function(t){var e=f(t);v(t)&&(t.setContent(r.getItem(e+"draft"),{format:"raw"}),a(t))},y={isEmpty:m,hasDraft:v,removeDraft:d,storeDraft:D,restoreDraft:g,startStoreDraft:function(t,e){var r=c(t);e.get()||(setInterval(function(){t.removed||D(t)},r),e.set(!0))},restoreLastDraft:function(t){t.undoManager.transact(function(){g(t),d(t)}),t.focus()}},p=function(t,e){return function(){var r=Array.prototype.slice.call(arguments);return t.apply(null,[e].concat(r))}},h=function(t){return{hasDraft:p(y.hasDraft,t),storeDraft:p(y.storeDraft,t),restoreDraft:p(y.restoreDraft,t),removeDraft:p(y.removeDraft,t),isEmpty:p(y.isEmpty,t)}},_=tinymce.util.Tools.resolve("tinymce.EditorManager");_._beforeUnloadHandler=function(){var t;return n.each(_.get(),function(e){e.plugins.autosave&&e.plugins.autosave.storeDraft(),!t&&e.isDirty()&&u(e)&&(t=e.translate("You have unsaved changes are you sure you want to navigate away?"))}),t};var b=function(t){window.onbeforeunload=_._beforeUnloadHandler},I=function(t,e){return function(r){var n=r.control;n.disabled(!y.hasDraft(t)),t.on("StoreDraft RestoreDraft RemoveDraft",function(){n.disabled(!y.hasDraft(t))}),y.startStoreDraft(t,e)}},w=function(t,e){t.addButton("restoredraft",{title:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e)}),t.addMenuItem("restoredraft",{text:"Restore last draft",onclick:function(){y.restoreLastDraft(t)},onPostRender:I(t,e),context:"file"})};e.add("autosave",function(e){var r=t(!1);return b(e),w(e,r),h(e)})}();