!function(){vara={},b=function(b){for(varc=a[b],e=c.deps,f=c.defn,g=e.length,h=newArray(g),i=0;i<g;++i)h[i]=d(e[i]);varj=f.apply(null,h);if(void0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeofb)throw"module id must be a string";if(void0===c)throw"no dependencies for "+b;if(void0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void0}},d=function(c){vard=a[c];if(void0===d)throw"module ["+c+"] was undefined";returnvoid0===d.instance&&b(c),d.instance},e=function(a,b){for(varc=a.length,e=newArray(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};varg=c,h=function(a,b){g(a,[],function(){returnb})};h("6",tinymce.util.Tools.resolve),g("1",["6"],function(a){returna("tinymce.EditorManager")}),g("2",["6"],function(a){returna("tinymce.PluginManager")}),g("3",["6"],function(a){returna("tinymce.util.LocalStorage")}),g("4",["6"],function(a){returna("tinymce.util.Tools")}),h("5",window),g("0",["1","2","3","4","5"],function(a,b,c,d,e){returna._beforeUnloadHandler=function(){varb;returnd.each(a.get(),function(a){a.plugins.autosave&&a.plugins.autosave.storeDraft(),!b&&a.isDirty()&&a.getParam("autosave_ask_before_unload",!0)&&(b=a.translate("You have unsaved changes are you sure you want to navigate away?"))}),b},b.add("autosave",function(b){functionf(a,b){varc={s:1e3,m:6e4};returna=/^(\d+)([ms]?)$/.exec(""+(a||b)),(a[2]?c[a[2]]:1)*parseInt(a,10)}functiong(){vara=parseInt(c.getItem(o+"time"),10)||0;return!((newDate).getTime()-a>q.autosave_retention)||(h(!1),!1)}functionh(a){c.removeItem(o+"draft"),c.removeItem(o+"time"),a!==!1&&b.fire("RemoveDraft")}functioni(){!n()&&b.isDirty()&&(c.setItem(o+"draft",b.getContent({format:"raw",no_events:!0})),c.setItem(o+"time",(newDate).getTime()),b.fire("StoreDraft"))}functionj(){g()&&(b.setContent(c.getItem(o+"draft"),{format:"raw"}),b.fire("RestoreDraft"))}functionk(){p||(setInterval(function(){b.removed||i()},q.autosave_interval),p=!0)}functionl(){vara=this;a.disabled(!g()),b.on("StoreDraft RestoreDraft RemoveDraft",function(){a.disabled(!g())}),k()}functionm(){b.undoManager.beforeChange(),j(),h(),b.undoManager.add()}functionn(a){varc=b.settings.forced_root_block;returna=d.trim("undefined"==typeofa?b.getBody().innerHTML:a),""===a||newRegExp("^<"+c+"[^>]*>((\xa0| |[ \t]|<br[^>]*>)+?|)</"+c+">|<br>$","i").test(a)}varo,p,q=b.settings;o=q.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",o=o.replace(/\{path\}/g,document.location.pathname),o=o.replace(/\{query\}/g,document.location.search),o=o.replace(/\{id\}/g,b.id),q.autosave_interval=f(q.autosave_interval,"30s"),q.autosave_retention=f(q.autosave_retention,"20m"),b.addButton("restoredraft",{title:"Restore last draft",onclick:m,onPostRender:l}),b.addMenuItem("restoredraft",{text:"Restore last draft",onclick:m,onPostRender:l,context:"file"}),b.settings.autosave_restore_when_empty!==!1&&(b.on("init",function(){g()&&n()&&j()}),b.on("saveContent",function(){h()})),e.onbeforeunload=a._beforeUnloadHandler,this.hasDraft=g,this.storeDraft=i,this.restoreDraft=j,this.removeDraft=h,this.isEmpty=n}),function(){}}),d("0")()}();