!function(t){const e=t.en=t.en||{};e.dictionary=Object.assign(e.dictionary||{},{"Saving changes":"Saving changes"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
/*!
 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md.
 */(()=>{var t={203:(t,e,i)=>{t.exports=i(237)("./src/utils.js")},237:t=>{"use strict";t.exports=CKEditor5.dll},782:(t,e,i)=>{t.exports=i(237)("./src/core.js")}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var o=e[s]={exports:{}};return t[s](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};(()=>{"use strict";i.r(s),i.d(s,{Autosave:()=>o});var t=i(782),e=i(203);function n(t,e,{signal:i,edges:s}={}){let n,o=null;const a=null!=s&&s.includes("leading"),r=null==s||s.includes("trailing"),l=()=>{null!==o&&(t.apply(n,o),n=void 0,o=null)};let c=null;const d=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,r&&l(),h()},e)},u=()=>{null!==c&&(clearTimeout(c),c=null)},h=()=>{u(),n=void 0,o=null},m=function(...t){if(i?.aborted)return;n=this,o=t;const e=null==c;d(),a&&e&&l()};return m.schedule=d,m.cancel=h,m.flush=()=>{u(),l()},i?.addEventListener("abort",h,{once:!0}),m}class o extends t.Plugin{adapter;_debouncedSave;_lastDocumentVersion;_savePromise;_domEmitter;_config;_pendingActions;_makeImmediateSave;_action=null;static get pluginName(){return"Autosave"}static get isOfficialPlugin(){return!0}static get requires(){return[t.PendingActions]}constructor(i){super(i);const s=i.config.get("autosave")||{},o=s.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=function(t,e=0,i={}){"object"!=typeof i&&(i={});const{leading:s=!1,trailing:o=!0,maxWait:a}=i,r=Array(2);let l;s&&(r[0]="leading"),o&&(r[1]="trailing");let c=null;const d=n(function(...e){l=t.apply(this,e),c=null},e,{edges:r}),u=function(...e){return null!=a&&(null===c&&(c=Date.now()),Date.now()-c>=a)?(l=t.apply(this,e),c=Date.now(),d.cancel(),d.schedule(),l):(d.apply(this,e),l)};return u.cancel=d.cancel,u.flush=()=>(d.flush(),l),u}(this._save.bind(this),o),this._lastDocumentVersion=i.model.document.version,this._savePromise=null,this._domEmitter=new((0,e.DomEmitterMixin)()),this._config=s,this._pendingActions=i.plugins.get(t.PendingActions),this._makeImmediateSave=!1}init(){const t=this.editor,e=t.model.document;this.listenTo(t,"ready",()=>{this.listenTo(e,"change:data",(t,e)=>{this._saveCallbacks.length&&e.isLocal&&("synchronized"===this.state&&(this.state="waiting",this._setPendingAction()),"waiting"===this.state&&this._debouncedSave())})}),this.listenTo(t,"destroy",()=>this._flush(),{priority:"highest"}),this._domEmitter.listenTo(window,"beforeunload",(t,e)=>{this._pendingActions.hasAny&&(e.returnValue=this._pendingActions.first.message)})}destroy(){this._domEmitter.stopListening(),super.destroy()}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then(()=>Promise.all(this._saveCallbacks.map(t=>t(this.editor)))).finally(()=>{this._savePromise=null}).then(()=>{if(this._makeImmediateSave)return this._makeImmediateSave=!1,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)}).catch(t=>{throw this.state="error",this.state="saving",this._debouncedSave(),t}),this._savePromise)}_setPendingAction(){const t=this.editor.t;this._action||(this._action=this._pendingActions.add(t("Saving changes")))}get _saveCallbacks(){const t=[];return this.adapter&&this.adapter.save&&t.push(this.adapter.save),this._config.save&&t.push(this._config.save),t}}})(),(window.CKEditor5=window.CKEditor5||{}).autosave=s})();