@ckeditor/ckeditor5-watchdog 36.0.0 → 36.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/watchdog.js +1 -1
- package/package.json +7 -7
package/build/watchdog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
|
-
*/(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r: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,{ContextWatchdog:()=>Hr,EditorWatchdog:()=>kr,Watchdog:()=>r});class r{constructor(t){if(this.crashes=[],this.state="initializing",this._crashNumberLimit="number"==typeof t.crashNumberLimit?t.crashNumberLimit:3,this._now=Date.now,this._minimumNonErrorTimePeriod="number"==typeof t.minimumNonErrorTimePeriod?t.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const e=t.error||t.reason;e instanceof Error&&this._handleError(e,t)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}setCreator(t){this._creator=t}setDestructor(t){this._destructor=t}destroy(){this._stopErrorHandling(),this._listeners={}}on(t,e){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e)}off(t,e){this._listeners[t]=this._listeners[t].filter((t=>t!==e))}_fire(t,...e){const r=this._listeners[t]||[];for(const t of r)t.apply(this,[null,...e])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(t,e){if(this._shouldReactToError(t)){this.crashes.push({message:t.message,stack:t.stack,filename:e.filename,lineno:e.lineno,colno:e.colno,date:this._now()});const r=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:t,causesRestart:r}),r?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(t){return t.is&&t.is("CKEditorError")&&void 0!==t.context&&null!==t.context&&"ready"===this.state&&this._isErrorComingFromThisItem(t)}_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;return(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}const n=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};const o="object"==typeof global&&global&&global.Object===Object&&global;var s="object"==typeof self&&self&&self.Object===Object&&self;const i=o||s||Function("return this")();const c=function(){return i.Date.now()};var a=/\s/;const u=function(t){for(var e=t.length;e--&&a.test(t.charAt(e)););return e};var h=/^\s+/;const l=function(t){return t?t.slice(0,u(t)+1).replace(h,""):t};const f=i.Symbol;var d=Object.prototype,_=d.hasOwnProperty,p=d.toString,y=f?f.toStringTag:void 0;const b=function(t){var e=_.call(t,y),r=t[y];try{t[y]=void 0;var n=!0}catch(t){}var o=p.call(t);return n&&(e?t[y]=r:delete t[y]),o};var v=Object.prototype.toString;const g=function(t){return v.call(t)};var m=f?f.toStringTag:void 0;const j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":m&&m in Object(t)?b(t):g(t)};const w=function(t){return null!=t&&"object"==typeof t};const E=function(t){return"symbol"==typeof t||w(t)&&"[object Symbol]"==j(t)};var x=/^[-+]0x[0-9a-f]+$/i,O=/^0b[01]+$/i,A=/^0o[0-7]+$/i,P=parseInt;const S=function(t){if("number"==typeof t)return t;if(E(t))return NaN;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=l(t);var r=O.test(t);return r||A.test(t)?P(t.slice(2),r?2:8):x.test(t)?NaN:+t};var C=Math.max,T=Math.min;const I=function(t,e,r){var o,s,i,a,u,h,l=0,f=!1,d=!1,_=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){var r=o,n=s;return o=s=void 0,l=e,a=t.apply(n,r)}function y(t){return l=t,u=setTimeout(v,e),f?p(t):a}function b(t){var r=t-h;return void 0===h||r>=e||r<0||d&&t-l>=i}function v(){var t=c();if(b(t))return g(t);u=setTimeout(v,function(t){var r=e-(t-h);return d?T(r,i-(t-l)):r}(t))}function g(t){return u=void 0,_&&o?p(t):(o=s=void 0,a)}function m(){var t=c(),r=b(t);if(o=arguments,s=this,h=t,r){if(void 0===u)return y(h);if(d)return clearTimeout(u),u=setTimeout(v,e),p(h)}return void 0===u&&(u=setTimeout(v,e)),a}return e=S(e)||0,n(r)&&(f=!!r.leading,i=(d="maxWait"in r)?C(S(r.maxWait)||0,e):i,_="trailing"in r?!!r.trailing:_),m.cancel=function(){void 0!==u&&clearTimeout(u),l=0,o=h=s=u=void 0},m.flush=function(){return void 0===u?a:g(c())},m};const z=function(t,e,r){var o=!0,s=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return n(r)&&(o="leading"in r?!!r.leading:o,s="trailing"in r?!!r.trailing:s),I(t,e,{leading:o,maxWait:e,trailing:s})};const D=function(){this.__data__=[],this.size=0};const N=function(t,e){return t===e||t!=t&&e!=e};const W=function(t,e){for(var r=t.length;r--;)if(N(t[r][0],e))return r;return-1};var F=Array.prototype.splice;const M=function(t){var e=this.__data__,r=W(e,t);return!(r<0)&&(r==e.length-1?e.pop():F.call(e,r,1),--this.size,!0)};const q=function(t){var e=this.__data__,r=W(e,t);return r<0?void 0:e[r][1]};const U=function(t){return W(this.__data__,t)>-1};const R=function(t,e){var r=this.__data__,n=W(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function $(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}$.prototype.clear=D,$.prototype.delete=M,$.prototype.get=q,$.prototype.has=U,$.prototype.set=R;const k=$;const L=function(){this.__data__=new k,this.size=0};const H=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};const B=function(t){return this.__data__.get(t)};const Q=function(t){return this.__data__.has(t)};const V=function(t){if(!n(t))return!1;var e=j(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e};const K=i["__core-js_shared__"];var G,Y=(G=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"";const J=function(t){return!!Y&&Y in t};var X=Function.prototype.toString;const Z=function(t){if(null!=t){try{return X.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var tt=/^\[object .+?Constructor\]$/,et=Function.prototype,rt=Object.prototype,nt=et.toString,ot=rt.hasOwnProperty,st=RegExp("^"+nt.call(ot).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const it=function(t){return!(!n(t)||J(t))&&(V(t)?st:tt).test(Z(t))};const ct=function(t,e){return null==t?void 0:t[e]};const at=function(t,e){var r=ct(t,e);return it(r)?r:void 0};const ut=at(i,"Map");const ht=at(Object,"create");const lt=function(){this.__data__=ht?ht(null):{},this.size=0};const ft=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e};var dt=Object.prototype.hasOwnProperty;const _t=function(t){var e=this.__data__;if(ht){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return dt.call(e,t)?e[t]:void 0};var pt=Object.prototype.hasOwnProperty;const yt=function(t){var e=this.__data__;return ht?void 0!==e[t]:pt.call(e,t)};const bt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ht&&void 0===e?"__lodash_hash_undefined__":e,this};function vt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}vt.prototype.clear=lt,vt.prototype.delete=ft,vt.prototype.get=_t,vt.prototype.has=yt,vt.prototype.set=bt;const gt=vt;const mt=function(){this.size=0,this.__data__={hash:new gt,map:new(ut||k),string:new gt}};const jt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};const wt=function(t,e){var r=t.__data__;return jt(e)?r["string"==typeof e?"string":"hash"]:r.map};const Et=function(t){var e=wt(this,t).delete(t);return this.size-=e?1:0,e};const xt=function(t){return wt(this,t).get(t)};const Ot=function(t){return wt(this,t).has(t)};const At=function(t,e){var r=wt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Pt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Pt.prototype.clear=mt,Pt.prototype.delete=Et,Pt.prototype.get=xt,Pt.prototype.has=Ot,Pt.prototype.set=At;const St=Pt;const Ct=function(t,e){var r=this.__data__;if(r instanceof k){var n=r.__data__;if(!ut||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new St(n)}return r.set(t,e),this.size=r.size,this};function Tt(t){var e=this.__data__=new k(t);this.size=e.size}Tt.prototype.clear=L,Tt.prototype.delete=H,Tt.prototype.get=B,Tt.prototype.has=Q,Tt.prototype.set=Ct;const It=Tt;const zt=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t};const Dt=function(){try{var t=at(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();const Nt=function(t,e,r){"__proto__"==e&&Dt?Dt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var Wt=Object.prototype.hasOwnProperty;const Ft=function(t,e,r){var n=t[e];Wt.call(t,e)&&N(n,r)&&(void 0!==r||e in t)||Nt(t,e,r)};const Mt=function(t,e,r,n){var o=!r;r||(r={});for(var s=-1,i=e.length;++s<i;){var c=e[s],a=n?n(r[c],t[c],c,r,t):void 0;void 0===a&&(a=t[c]),o?Nt(r,c,a):Ft(r,c,a)}return r};const qt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};const Ut=function(t){return w(t)&&"[object Arguments]"==j(t)};var Rt=Object.prototype,$t=Rt.hasOwnProperty,kt=Rt.propertyIsEnumerable;const Lt=Ut(function(){return arguments}())?Ut:function(t){return w(t)&&$t.call(t,"callee")&&!kt.call(t,"callee")};const Ht=Array.isArray;const Bt=function(){return!1};var Qt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Vt=Qt&&"object"==typeof module&&module&&!module.nodeType&&module,Kt=Vt&&Vt.exports===Qt?i.Buffer:void 0;const Gt=(Kt?Kt.isBuffer:void 0)||Bt;var Yt=/^(?:0|[1-9]\d*)$/;const Jt=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Yt.test(t))&&t>-1&&t%1==0&&t<e};const Xt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var Zt={};Zt["[object Float32Array]"]=Zt["[object Float64Array]"]=Zt["[object Int8Array]"]=Zt["[object Int16Array]"]=Zt["[object Int32Array]"]=Zt["[object Uint8Array]"]=Zt["[object Uint8ClampedArray]"]=Zt["[object Uint16Array]"]=Zt["[object Uint32Array]"]=!0,Zt["[object Arguments]"]=Zt["[object Array]"]=Zt["[object ArrayBuffer]"]=Zt["[object Boolean]"]=Zt["[object DataView]"]=Zt["[object Date]"]=Zt["[object Error]"]=Zt["[object Function]"]=Zt["[object Map]"]=Zt["[object Number]"]=Zt["[object Object]"]=Zt["[object RegExp]"]=Zt["[object Set]"]=Zt["[object String]"]=Zt["[object WeakMap]"]=!1;const te=function(t){return w(t)&&Xt(t.length)&&!!Zt[j(t)]};const ee=function(t){return function(e){return t(e)}};var re="object"==typeof exports&&exports&&!exports.nodeType&&exports,ne=re&&"object"==typeof module&&module&&!module.nodeType&&module,oe=ne&&ne.exports===re&&o.process;const se=function(){try{var t=ne&&ne.require&&ne.require("util").types;return t||oe&&oe.binding&&oe.binding("util")}catch(t){}}();var ie=se&&se.isTypedArray;const ce=ie?ee(ie):te;var ae=Object.prototype.hasOwnProperty;const ue=function(t,e){var r=Ht(t),n=!r&&Lt(t),o=!r&&!n&&Gt(t),s=!r&&!n&&!o&&ce(t),i=r||n||o||s,c=i?qt(t.length,String):[],a=c.length;for(var u in t)!e&&!ae.call(t,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Jt(u,a))||c.push(u);return c};var he=Object.prototype;const le=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||he)};const fe=function(t,e){return function(r){return t(e(r))}};const de=fe(Object.keys,Object);var _e=Object.prototype.hasOwnProperty;const pe=function(t){if(!le(t))return de(t);var e=[];for(var r in Object(t))_e.call(t,r)&&"constructor"!=r&&e.push(r);return e};const ye=function(t){return null!=t&&Xt(t.length)&&!V(t)};const be=function(t){return ye(t)?ue(t):pe(t)};const ve=function(t,e){return t&&Mt(e,be(e),t)};const ge=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e};var me=Object.prototype.hasOwnProperty;const je=function(t){if(!n(t))return ge(t);var e=le(t),r=[];for(var o in t)("constructor"!=o||!e&&me.call(t,o))&&r.push(o);return r};const we=function(t){return ye(t)?ue(t,!0):je(t)};const Ee=function(t,e){return t&&Mt(e,we(e),t)};var xe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Oe=xe&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=Oe&&Oe.exports===xe?i.Buffer:void 0,Pe=Ae?Ae.allocUnsafe:void 0;const Se=function(t,e){if(e)return t.slice();var r=t.length,n=Pe?Pe(r):new t.constructor(r);return t.copy(n),n};const Ce=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e};const Te=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,s=[];++r<n;){var i=t[r];e(i,r,t)&&(s[o++]=i)}return s};const Ie=function(){return[]};var ze=Object.prototype.propertyIsEnumerable,De=Object.getOwnPropertySymbols;const Ne=De?function(t){return null==t?[]:(t=Object(t),Te(De(t),(function(e){return ze.call(t,e)})))}:Ie;const We=function(t,e){return Mt(t,Ne(t),e)};const Fe=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};const Me=fe(Object.getPrototypeOf,Object);const qe=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Fe(e,Ne(t)),t=Me(t);return e}:Ie;const Ue=function(t,e){return Mt(t,qe(t),e)};const Re=function(t,e,r){var n=e(t);return Ht(t)?n:Fe(n,r(t))};const $e=function(t){return Re(t,be,Ne)};const ke=function(t){return Re(t,we,qe)};const Le=at(i,"DataView");const He=at(i,"Promise");const Be=at(i,"Set");const Qe=at(i,"WeakMap");var Ve="[object Map]",Ke="[object Promise]",Ge="[object Set]",Ye="[object WeakMap]",Je="[object DataView]",Xe=Z(Le),Ze=Z(ut),tr=Z(He),er=Z(Be),rr=Z(Qe),nr=j;(Le&&nr(new Le(new ArrayBuffer(1)))!=Je||ut&&nr(new ut)!=Ve||He&&nr(He.resolve())!=Ke||Be&&nr(new Be)!=Ge||Qe&&nr(new Qe)!=Ye)&&(nr=function(t){var e=j(t),r="[object Object]"==e?t.constructor:void 0,n=r?Z(r):"";if(n)switch(n){case Xe:return Je;case Ze:return Ve;case tr:return Ke;case er:return Ge;case rr:return Ye}return e});const or=nr;var sr=Object.prototype.hasOwnProperty;const ir=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&sr.call(t,"index")&&(r.index=t.index,r.input=t.input),r};const cr=i.Uint8Array;const ar=function(t){var e=new t.constructor(t.byteLength);return new cr(e).set(new cr(t)),e};const ur=function(t,e){var r=e?ar(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)};var hr=/\w*$/;const lr=function(t){var e=new t.constructor(t.source,hr.exec(t));return e.lastIndex=t.lastIndex,e};var fr=f?f.prototype:void 0,dr=fr?fr.valueOf:void 0;const _r=function(t){return dr?Object(dr.call(t)):{}};const pr=function(t,e){var r=e?ar(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};const yr=function(t,e,r){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return ar(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return ur(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return pr(t,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return lr(t);case"[object Symbol]":return _r(t)}};var br=Object.create;const vr=function(){function t(){}return function(e){if(!n(e))return{};if(br)return br(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();const gr=function(t){return"function"!=typeof t.constructor||le(t)?{}:vr(Me(t))};const mr=function(t){return w(t)&&"[object Map]"==or(t)};var jr=se&&se.isMap;const wr=jr?ee(jr):mr;const Er=function(t){return w(t)&&"[object Set]"==or(t)};var xr=se&&se.isSet;const Or=xr?ee(xr):Er;var Ar="[object Arguments]",Pr="[object Function]",Sr="[object Object]",Cr={};Cr[Ar]=Cr["[object Array]"]=Cr["[object ArrayBuffer]"]=Cr["[object DataView]"]=Cr["[object Boolean]"]=Cr["[object Date]"]=Cr["[object Float32Array]"]=Cr["[object Float64Array]"]=Cr["[object Int8Array]"]=Cr["[object Int16Array]"]=Cr["[object Int32Array]"]=Cr["[object Map]"]=Cr["[object Number]"]=Cr[Sr]=Cr["[object RegExp]"]=Cr["[object Set]"]=Cr["[object String]"]=Cr["[object Symbol]"]=Cr["[object Uint8Array]"]=Cr["[object Uint8ClampedArray]"]=Cr["[object Uint16Array]"]=Cr["[object Uint32Array]"]=!0,Cr["[object Error]"]=Cr[Pr]=Cr["[object WeakMap]"]=!1;const Tr=function t(e,r,o,s,i,c){var a,u=1&r,h=2&r,l=4&r;if(o&&(a=i?o(e,s,i,c):o(e)),void 0!==a)return a;if(!n(e))return e;var f=Ht(e);if(f){if(a=ir(e),!u)return Ce(e,a)}else{var d=or(e),_=d==Pr||"[object GeneratorFunction]"==d;if(Gt(e))return Se(e,u);if(d==Sr||d==Ar||_&&!i){if(a=h||_?{}:gr(e),!u)return h?Ue(e,Ee(a,e)):We(e,ve(a,e))}else{if(!Cr[d])return i?e:{};a=yr(e,d,u)}}c||(c=new It);var p=c.get(e);if(p)return p;c.set(e,a),Or(e)?e.forEach((function(n){a.add(t(n,r,o,n,e,c))})):wr(e)&&e.forEach((function(n,s){a.set(s,t(n,r,o,s,e,c))}));var y=f?void 0:(l?h?ke:$e:h?we:be)(e);return zt(y||e,(function(n,s){y&&(n=e[s=n]),Ft(a,s,t(n,r,o,s,e,c))})),a};const Ir=function(t,e){return Tr(t,5,e="function"==typeof e?e:void 0)};var zr=Function.prototype,Dr=Object.prototype,Nr=zr.toString,Wr=Dr.hasOwnProperty,Fr=Nr.call(Object);const Mr=function(t){if(!w(t)||"[object Object]"!=j(t))return!1;var e=Me(t);if(null===e)return!0;var r=Wr.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Nr.call(r)==Fr};const qr=function(t){return w(t)&&1===t.nodeType&&!Mr(t)};function Ur(t,e=new Set){const r=[t],n=new Set;let o=0;for(;r.length>o;){const t=r[o++];if(!(n.has(t)||Rr(t)||e.has(t)))if(n.add(t),t[Symbol.iterator])try{for(const e of t)r.push(e)}catch(t){}else for(const e in t)"defaultValue"!==e&&r.push(t[e])}return n}function Rr(t){const e=Object.prototype.toString.call(t),r=typeof t;return"number"===r||"boolean"===r||"string"===r||"symbol"===r||"function"===r||"[object Date]"===e||"[object RegExp]"===e||"[object Module]"===e||null==t||!0===t._watchdogExcluded||t instanceof EventTarget||t instanceof Event}function $r(t,e,r=new Set){if(t===e&&("object"==typeof(n=t)&&null!==n))return!0;var n;const o=Ur(t,r),s=Ur(e,r);for(const t of o)if(s.has(t))return!0;return!1}class kr extends r{constructor(t,e={}){super(e),this._editor=null,this._throttledSave=z(this._save.bind(this),"number"==typeof e.saveInterval?e.saveInterval:5e3),this._creator=(e,r)=>t.create(e,r),this._destructor=t=>t.destroy()}get editor(){return this._editor}get _item(){return this._editor}_restart(){return Promise.resolve().then((()=>(this.state="initializing",this._fire("stateChange"),this._destroy()))).catch((t=>{console.error("An error happened during the editor destroying.",t)})).then((()=>{if("string"==typeof this._elementOrData)return this.create(this._data,this._config,this._config.context);{const t=Object.assign({},this._config,{initialData:this._data});return this.create(this._elementOrData,t,t.context)}})).then((()=>{this._fire("restart")}))}create(t=this._elementOrData,e=this._config,r){return Promise.resolve().then((()=>(super._startErrorHandling(),this._elementOrData=t,this._config=this._cloneEditorConfiguration(e)||{},this._config.context=r,this._creator(t,this._config)))).then((t=>{this._editor=t,t.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=t.model.document.version,this._data=this._getData(),this.state="ready",this._fire("stateChange")}))}destroy(){return Promise.resolve().then((()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling(),this._throttledSave.flush();const t=this._editor;return this._editor=null,t.model.document.off("change:data",this._throttledSave),this._destructor(t)}))}_save(){const t=this._editor.model.document.version;try{this._data=this._getData(),this._lastDocumentVersion=t}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(t){this._excludedProps=t}_getData(){const t={};for(const e of this._editor.model.document.getRootNames())t[e]=this._editor.data.get({rootName:e});return t}_isErrorComingFromThisItem(t){return $r(this._editor,t.context,this._excludedProps)}_cloneEditorConfiguration(t){return Ir(t,((t,e)=>qr(t)||"context"===e?t:void 0))}}const Lr=Symbol("MainQueueId");class Hr extends r{constructor(t,e={}){super(e),this._watchdogs=new Map,this._watchdogConfig=e,this._context=null,this._contextProps=new Set,this._actionQueues=new Br,this._creator=e=>t.create(e),this._destructor=t=>t.destroy(),this._actionQueues.onEmpty((()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))}))}get context(){return this._context}create(t={}){return this._actionQueues.enqueue(Lr,(()=>(this._contextConfig=t,this._create())))}getItem(t){return this._getWatchdog(t)._item}getItemState(t){return this._getWatchdog(t).state}add(t){const e=Qr(t);return Promise.all(e.map((t=>this._actionQueues.enqueue(t.id,(()=>{if("destroyed"===this.state)throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let e;if(this._watchdogs.has(t.id))throw new Error(`Item with the given id is already added: '${t.id}'.`);if("editor"===t.type)return e=new kr(this._watchdogConfig),e.setCreator(t.creator),e._setExcludedProperties(this._contextProps),t.destructor&&e.setDestructor(t.destructor),this._watchdogs.set(t.id,e),e.on("error",((r,{error:n,causesRestart:o})=>{this._fire("itemError",{itemId:t.id,error:n}),o&&this._actionQueues.enqueue(t.id,(()=>new Promise((r=>{e.on("restart",function n(){e.off("restart",n),this._fire("itemRestart",{itemId:t.id}),r()}.bind(this))}))))})),e.create(t.sourceElementOrData,t.config,this._context);throw new Error(`Not supported item type: '${t.type}'.`)})))))}remove(t){const e=Qr(t);return Promise.all(e.map((t=>this._actionQueues.enqueue(t,(()=>{const e=this._getWatchdog(t);return this._watchdogs.delete(t),e.destroy()})))))}destroy(){return this._actionQueues.enqueue(Lr,(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_restart(){return this._actionQueues.enqueue(Lr,(()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch((t=>{console.error("An error happened during destroying the context or items.",t)})).then((()=>this._create())).then((()=>this._fire("restart"))))))}_create(){return Promise.resolve().then((()=>(this._startErrorHandling(),this._creator(this._contextConfig)))).then((t=>(this._context=t,this._contextProps=Ur(this._context),Promise.all(Array.from(this._watchdogs.values()).map((t=>(t._setExcludedProperties(this._contextProps),t.create(void 0,void 0,this._context))))))))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling();const t=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map((t=>t.destroy()))).then((()=>this._destructor(t)))}))}_getWatchdog(t){const e=this._watchdogs.get(t);if(!e)throw new Error(`Item with the given id was not registered: ${t}.`);return e}_isErrorComingFromThisItem(t){for(const e of this._watchdogs.values())if(e._isErrorComingFromThisItem(t))return!1;return $r(this._context,t.context)}}class Br{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._actions=new WeakMap,this._lastActionId=0,this._activeActions=0}onEmpty(t){this._onEmptyCallbacks.push(t)}enqueue(t,e){const r=t===Lr;this._activeActions++,this._queues.get(t)||this._queues.set(t,Promise.resolve());const n=(r?Promise.all(this._queues.values()):Promise.all([this._queues.get(Lr),this._queues.get(t)])).then(e),o=n.catch((()=>{}));return this._queues.set(t,o),n.finally((()=>{this._activeActions--,this._queues.get(t)===o&&0===this._activeActions&&this._onEmptyCallbacks.forEach((t=>t()))}))}}function Qr(t){return Array.isArray(t)?t:[t]}(window.CKEditor5=window.CKEditor5||{}).watchdog=e})();
|
|
4
|
+
*/(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r: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,{ContextWatchdog:()=>Fn,EditorWatchdog:()=>Dn,Watchdog:()=>r});class r{constructor(t){if(this.crashes=[],this.state="initializing",this._crashNumberLimit="number"==typeof t.crashNumberLimit?t.crashNumberLimit:3,this._now=Date.now,this._minimumNonErrorTimePeriod="number"==typeof t.minimumNonErrorTimePeriod?t.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const e=t.error||t.reason;e instanceof Error&&this._handleError(e,t)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}setCreator(t){this._creator=t}setDestructor(t){this._destructor=t}destroy(){this._stopErrorHandling(),this._listeners={}}on(t,e){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e)}off(t,e){this._listeners[t]=this._listeners[t].filter((t=>t!==e))}_fire(t,...e){const r=this._listeners[t]||[];for(const t of r)t.apply(this,[null,...e])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(t,e){if(this._shouldReactToError(t)){this.crashes.push({message:t.message,stack:t.stack,filename:e.filename,lineno:e.lineno,colno:e.colno,date:this._now()});const r=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:t,causesRestart:r}),r?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(t){return t.is&&t.is("CKEditorError")&&void 0!==t.context&&null!==t.context&&"ready"===this.state&&this._isErrorComingFromThisItem(t)}_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;return(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}const n=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};const o="object"==typeof global&&global&&global.Object===Object&&global;var s="object"==typeof self&&self&&self.Object===Object&&self;const i=o||s||Function("return this")();const c=function(){return i.Date.now()};var a=/\s/;const u=function(t){for(var e=t.length;e--&&a.test(t.charAt(e)););return e};var h=/^\s+/;const l=function(t){return t?t.slice(0,u(t)+1).replace(h,""):t};const f=i.Symbol;var d=Object.prototype,_=d.hasOwnProperty,p=d.toString,y=f?f.toStringTag:void 0;const v=function(t){var e=_.call(t,y),r=t[y];try{t[y]=void 0;var n=!0}catch(t){}var o=p.call(t);return n&&(e?t[y]=r:delete t[y]),o};var b=Object.prototype.toString;const g=function(t){return b.call(t)};var m="[object Null]",j="[object Undefined]",w=f?f.toStringTag:void 0;const E=function(t){return null==t?void 0===t?j:m:w&&w in Object(t)?v(t):g(t)};const x=function(t){return null!=t&&"object"==typeof t};var O="[object Symbol]";const A=function(t){return"symbol"==typeof t||x(t)&&E(t)==O};var P=NaN,S=/^[-+]0x[0-9a-f]+$/i,C=/^0b[01]+$/i,T=/^0o[0-7]+$/i,I=parseInt;const z=function(t){if("number"==typeof t)return t;if(A(t))return P;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=l(t);var r=C.test(t);return r||T.test(t)?I(t.slice(2),r?2:8):S.test(t)?P:+t};var D="Expected a function",W=Math.max,F=Math.min;const M=function(t,e,r){var o,s,i,a,u,h,l=0,f=!1,d=!1,_=!0;if("function"!=typeof t)throw new TypeError(D);function p(e){var r=o,n=s;return o=s=void 0,l=e,a=t.apply(n,r)}function y(t){var r=t-h;return void 0===h||r>=e||r<0||d&&t-l>=i}function v(){var t=c();if(y(t))return b(t);u=setTimeout(v,function(t){var r=e-(t-h);return d?F(r,i-(t-l)):r}(t))}function b(t){return u=void 0,_&&o?p(t):(o=s=void 0,a)}function g(){var t=c(),r=y(t);if(o=arguments,s=this,h=t,r){if(void 0===u)return function(t){return l=t,u=setTimeout(v,e),f?p(t):a}(h);if(d)return clearTimeout(u),u=setTimeout(v,e),p(h)}return void 0===u&&(u=setTimeout(v,e)),a}return e=z(e)||0,n(r)&&(f=!!r.leading,i=(d="maxWait"in r)?W(z(r.maxWait)||0,e):i,_="trailing"in r?!!r.trailing:_),g.cancel=function(){void 0!==u&&clearTimeout(u),l=0,o=h=s=u=void 0},g.flush=function(){return void 0===u?a:b(c())},g};var N="Expected a function";const q=function(t,e,r){var o=!0,s=!0;if("function"!=typeof t)throw new TypeError(N);return n(r)&&(o="leading"in r?!!r.leading:o,s="trailing"in r?!!r.trailing:s),M(t,e,{leading:o,maxWait:e,trailing:s})};const U=function(){this.__data__=[],this.size=0};const R=function(t,e){return t===e||t!=t&&e!=e};const $=function(t,e){for(var r=t.length;r--;)if(R(t[r][0],e))return r;return-1};var k=Array.prototype.splice;const L=function(t){var e=this.__data__,r=$(e,t);return!(r<0)&&(r==e.length-1?e.pop():k.call(e,r,1),--this.size,!0)};const H=function(t){var e=this.__data__,r=$(e,t);return r<0?void 0:e[r][1]};const B=function(t){return $(this.__data__,t)>-1};const Q=function(t,e){var r=this.__data__,n=$(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function V(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}V.prototype.clear=U,V.prototype.delete=L,V.prototype.get=H,V.prototype.has=B,V.prototype.set=Q;const K=V;const G=function(){this.__data__=new K,this.size=0};const Y=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};const J=function(t){return this.__data__.get(t)};const X=function(t){return this.__data__.has(t)};var Z="[object AsyncFunction]",tt="[object Function]",et="[object GeneratorFunction]",rt="[object Proxy]";const nt=function(t){if(!n(t))return!1;var e=E(t);return e==tt||e==et||e==Z||e==rt};const ot=i["__core-js_shared__"];var st,it=(st=/[^.]+$/.exec(ot&&ot.keys&&ot.keys.IE_PROTO||""))?"Symbol(src)_1."+st:"";const ct=function(t){return!!it&&it in t};var at=Function.prototype.toString;const ut=function(t){if(null!=t){try{return at.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var ht=/^\[object .+?Constructor\]$/,lt=Function.prototype,ft=Object.prototype,dt=lt.toString,_t=ft.hasOwnProperty,pt=RegExp("^"+dt.call(_t).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const yt=function(t){return!(!n(t)||ct(t))&&(nt(t)?pt:ht).test(ut(t))};const vt=function(t,e){return null==t?void 0:t[e]};const bt=function(t,e){var r=vt(t,e);return yt(r)?r:void 0};const gt=bt(i,"Map");const mt=bt(Object,"create");const jt=function(){this.__data__=mt?mt(null):{},this.size=0};const wt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e};var Et="__lodash_hash_undefined__",xt=Object.prototype.hasOwnProperty;const Ot=function(t){var e=this.__data__;if(mt){var r=e[t];return r===Et?void 0:r}return xt.call(e,t)?e[t]:void 0};var At=Object.prototype.hasOwnProperty;const Pt=function(t){var e=this.__data__;return mt?void 0!==e[t]:At.call(e,t)};var St="__lodash_hash_undefined__";const Ct=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=mt&&void 0===e?St:e,this};function Tt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Tt.prototype.clear=jt,Tt.prototype.delete=wt,Tt.prototype.get=Ot,Tt.prototype.has=Pt,Tt.prototype.set=Ct;const It=Tt;const zt=function(){this.size=0,this.__data__={hash:new It,map:new(gt||K),string:new It}};const Dt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};const Wt=function(t,e){var r=t.__data__;return Dt(e)?r["string"==typeof e?"string":"hash"]:r.map};const Ft=function(t){var e=Wt(this,t).delete(t);return this.size-=e?1:0,e};const Mt=function(t){return Wt(this,t).get(t)};const Nt=function(t){return Wt(this,t).has(t)};const qt=function(t,e){var r=Wt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Ut(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ut.prototype.clear=zt,Ut.prototype.delete=Ft,Ut.prototype.get=Mt,Ut.prototype.has=Nt,Ut.prototype.set=qt;const Rt=Ut;var $t=200;const kt=function(t,e){var r=this.__data__;if(r instanceof K){var n=r.__data__;if(!gt||n.length<$t-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Rt(n)}return r.set(t,e),this.size=r.size,this};function Lt(t){var e=this.__data__=new K(t);this.size=e.size}Lt.prototype.clear=G,Lt.prototype.delete=Y,Lt.prototype.get=J,Lt.prototype.has=X,Lt.prototype.set=kt;const Ht=Lt;const Bt=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t};const Qt=function(){try{var t=bt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();const Vt=function(t,e,r){"__proto__"==e&&Qt?Qt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var Kt=Object.prototype.hasOwnProperty;const Gt=function(t,e,r){var n=t[e];Kt.call(t,e)&&R(n,r)&&(void 0!==r||e in t)||Vt(t,e,r)};const Yt=function(t,e,r,n){var o=!r;r||(r={});for(var s=-1,i=e.length;++s<i;){var c=e[s],a=n?n(r[c],t[c],c,r,t):void 0;void 0===a&&(a=t[c]),o?Vt(r,c,a):Gt(r,c,a)}return r};const Jt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var Xt="[object Arguments]";const Zt=function(t){return x(t)&&E(t)==Xt};var te=Object.prototype,ee=te.hasOwnProperty,re=te.propertyIsEnumerable;const ne=Zt(function(){return arguments}())?Zt:function(t){return x(t)&&ee.call(t,"callee")&&!re.call(t,"callee")};const oe=Array.isArray;const se=function(){return!1};var ie="object"==typeof exports&&exports&&!exports.nodeType&&exports,ce=ie&&"object"==typeof module&&module&&!module.nodeType&&module,ae=ce&&ce.exports===ie?i.Buffer:void 0;const ue=(ae?ae.isBuffer:void 0)||se;var he=9007199254740991,le=/^(?:0|[1-9]\d*)$/;const fe=function(t,e){var r=typeof t;return!!(e=null==e?he:e)&&("number"==r||"symbol"!=r&&le.test(t))&&t>-1&&t%1==0&&t<e};var de=9007199254740991;const _e=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=de};var pe={};pe["[object Float32Array]"]=pe["[object Float64Array]"]=pe["[object Int8Array]"]=pe["[object Int16Array]"]=pe["[object Int32Array]"]=pe["[object Uint8Array]"]=pe["[object Uint8ClampedArray]"]=pe["[object Uint16Array]"]=pe["[object Uint32Array]"]=!0,pe["[object Arguments]"]=pe["[object Array]"]=pe["[object ArrayBuffer]"]=pe["[object Boolean]"]=pe["[object DataView]"]=pe["[object Date]"]=pe["[object Error]"]=pe["[object Function]"]=pe["[object Map]"]=pe["[object Number]"]=pe["[object Object]"]=pe["[object RegExp]"]=pe["[object Set]"]=pe["[object String]"]=pe["[object WeakMap]"]=!1;const ye=function(t){return x(t)&&_e(t.length)&&!!pe[E(t)]};const ve=function(t){return function(e){return t(e)}};var be="object"==typeof exports&&exports&&!exports.nodeType&&exports,ge=be&&"object"==typeof module&&module&&!module.nodeType&&module,me=ge&&ge.exports===be&&o.process;const je=function(){try{var t=ge&&ge.require&&ge.require("util").types;return t||me&&me.binding&&me.binding("util")}catch(t){}}();var we=je&&je.isTypedArray;const Ee=we?ve(we):ye;var xe=Object.prototype.hasOwnProperty;const Oe=function(t,e){var r=oe(t),n=!r&&ne(t),o=!r&&!n&&ue(t),s=!r&&!n&&!o&&Ee(t),i=r||n||o||s,c=i?Jt(t.length,String):[],a=c.length;for(var u in t)!e&&!xe.call(t,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||fe(u,a))||c.push(u);return c};var Ae=Object.prototype;const Pe=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ae)};const Se=function(t,e){return function(r){return t(e(r))}};const Ce=Se(Object.keys,Object);var Te=Object.prototype.hasOwnProperty;const Ie=function(t){if(!Pe(t))return Ce(t);var e=[];for(var r in Object(t))Te.call(t,r)&&"constructor"!=r&&e.push(r);return e};const ze=function(t){return null!=t&&_e(t.length)&&!nt(t)};const De=function(t){return ze(t)?Oe(t):Ie(t)};const We=function(t,e){return t&&Yt(e,De(e),t)};const Fe=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e};var Me=Object.prototype.hasOwnProperty;const Ne=function(t){if(!n(t))return Fe(t);var e=Pe(t),r=[];for(var o in t)("constructor"!=o||!e&&Me.call(t,o))&&r.push(o);return r};const qe=function(t){return ze(t)?Oe(t,!0):Ne(t)};const Ue=function(t,e){return t&&Yt(e,qe(e),t)};var Re="object"==typeof exports&&exports&&!exports.nodeType&&exports,$e=Re&&"object"==typeof module&&module&&!module.nodeType&&module,ke=$e&&$e.exports===Re?i.Buffer:void 0,Le=ke?ke.allocUnsafe:void 0;const He=function(t,e){if(e)return t.slice();var r=t.length,n=Le?Le(r):new t.constructor(r);return t.copy(n),n};const Be=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e};const Qe=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,s=[];++r<n;){var i=t[r];e(i,r,t)&&(s[o++]=i)}return s};const Ve=function(){return[]};var Ke=Object.prototype.propertyIsEnumerable,Ge=Object.getOwnPropertySymbols;const Ye=Ge?function(t){return null==t?[]:(t=Object(t),Qe(Ge(t),(function(e){return Ke.call(t,e)})))}:Ve;const Je=function(t,e){return Yt(t,Ye(t),e)};const Xe=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};const Ze=Se(Object.getPrototypeOf,Object);const tr=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Xe(e,Ye(t)),t=Ze(t);return e}:Ve;const er=function(t,e){return Yt(t,tr(t),e)};const rr=function(t,e,r){var n=e(t);return oe(t)?n:Xe(n,r(t))};const nr=function(t){return rr(t,De,Ye)};const or=function(t){return rr(t,qe,tr)};const sr=bt(i,"DataView");const ir=bt(i,"Promise");const cr=bt(i,"Set");const ar=bt(i,"WeakMap");var ur="[object Map]",hr="[object Promise]",lr="[object Set]",fr="[object WeakMap]",dr="[object DataView]",_r=ut(sr),pr=ut(gt),yr=ut(ir),vr=ut(cr),br=ut(ar),gr=E;(sr&&gr(new sr(new ArrayBuffer(1)))!=dr||gt&&gr(new gt)!=ur||ir&&gr(ir.resolve())!=hr||cr&&gr(new cr)!=lr||ar&&gr(new ar)!=fr)&&(gr=function(t){var e=E(t),r="[object Object]"==e?t.constructor:void 0,n=r?ut(r):"";if(n)switch(n){case _r:return dr;case pr:return ur;case yr:return hr;case vr:return lr;case br:return fr}return e});const mr=gr;var jr=Object.prototype.hasOwnProperty;const wr=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&jr.call(t,"index")&&(r.index=t.index,r.input=t.input),r};const Er=i.Uint8Array;const xr=function(t){var e=new t.constructor(t.byteLength);return new Er(e).set(new Er(t)),e};const Or=function(t,e){var r=e?xr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)};var Ar=/\w*$/;const Pr=function(t){var e=new t.constructor(t.source,Ar.exec(t));return e.lastIndex=t.lastIndex,e};var Sr=f?f.prototype:void 0,Cr=Sr?Sr.valueOf:void 0;const Tr=function(t){return Cr?Object(Cr.call(t)):{}};const Ir=function(t,e){var r=e?xr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var zr="[object Boolean]",Dr="[object Date]",Wr="[object Map]",Fr="[object Number]",Mr="[object RegExp]",Nr="[object Set]",qr="[object String]",Ur="[object Symbol]",Rr="[object ArrayBuffer]",$r="[object DataView]",kr="[object Float32Array]",Lr="[object Float64Array]",Hr="[object Int8Array]",Br="[object Int16Array]",Qr="[object Int32Array]",Vr="[object Uint8Array]",Kr="[object Uint8ClampedArray]",Gr="[object Uint16Array]",Yr="[object Uint32Array]";const Jr=function(t,e,r){var n=t.constructor;switch(e){case Rr:return xr(t);case zr:case Dr:return new n(+t);case $r:return Or(t,r);case kr:case Lr:case Hr:case Br:case Qr:case Vr:case Kr:case Gr:case Yr:return Ir(t,r);case Wr:return new n;case Fr:case qr:return new n(t);case Mr:return Pr(t);case Nr:return new n;case Ur:return Tr(t)}};var Xr=Object.create;const Zr=function(){function t(){}return function(e){if(!n(e))return{};if(Xr)return Xr(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();const tn=function(t){return"function"!=typeof t.constructor||Pe(t)?{}:Zr(Ze(t))};var en="[object Map]";const rn=function(t){return x(t)&&mr(t)==en};var nn=je&&je.isMap;const on=nn?ve(nn):rn;var sn="[object Set]";const cn=function(t){return x(t)&&mr(t)==sn};var an=je&&je.isSet;const un=an?ve(an):cn;var hn=1,ln=2,fn=4,dn="[object Arguments]",_n="[object Function]",pn="[object GeneratorFunction]",yn="[object Object]",vn={};vn[dn]=vn["[object Array]"]=vn["[object ArrayBuffer]"]=vn["[object DataView]"]=vn["[object Boolean]"]=vn["[object Date]"]=vn["[object Float32Array]"]=vn["[object Float64Array]"]=vn["[object Int8Array]"]=vn["[object Int16Array]"]=vn["[object Int32Array]"]=vn["[object Map]"]=vn["[object Number]"]=vn[yn]=vn["[object RegExp]"]=vn["[object Set]"]=vn["[object String]"]=vn["[object Symbol]"]=vn["[object Uint8Array]"]=vn["[object Uint8ClampedArray]"]=vn["[object Uint16Array]"]=vn["[object Uint32Array]"]=!0,vn["[object Error]"]=vn[_n]=vn["[object WeakMap]"]=!1;const bn=function t(e,r,o,s,i,c){var a,u=r&hn,h=r&ln,l=r&fn;if(o&&(a=i?o(e,s,i,c):o(e)),void 0!==a)return a;if(!n(e))return e;var f=oe(e);if(f){if(a=wr(e),!u)return Be(e,a)}else{var d=mr(e),_=d==_n||d==pn;if(ue(e))return He(e,u);if(d==yn||d==dn||_&&!i){if(a=h||_?{}:tn(e),!u)return h?er(e,Ue(a,e)):Je(e,We(a,e))}else{if(!vn[d])return i?e:{};a=Jr(e,d,u)}}c||(c=new Ht);var p=c.get(e);if(p)return p;c.set(e,a),un(e)?e.forEach((function(n){a.add(t(n,r,o,n,e,c))})):on(e)&&e.forEach((function(n,s){a.set(s,t(n,r,o,s,e,c))}));var y=f?void 0:(l?h?or:nr:h?qe:De)(e);return Bt(y||e,(function(n,s){y&&(n=e[s=n]),Gt(a,s,t(n,r,o,s,e,c))})),a};var gn=1,mn=4;const jn=function(t,e){return bn(t,gn|mn,e="function"==typeof e?e:void 0)};var wn="[object Object]",En=Function.prototype,xn=Object.prototype,On=En.toString,An=xn.hasOwnProperty,Pn=On.call(Object);const Sn=function(t){if(!x(t)||E(t)!=wn)return!1;var e=Ze(t);if(null===e)return!0;var r=An.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&On.call(r)==Pn};const Cn=function(t){return x(t)&&1===t.nodeType&&!Sn(t)};function Tn(t,e=new Set){const r=[t],n=new Set;let o=0;for(;r.length>o;){const t=r[o++];if(!(n.has(t)||In(t)||e.has(t)))if(n.add(t),t[Symbol.iterator])try{for(const e of t)r.push(e)}catch(t){}else for(const e in t)"defaultValue"!==e&&r.push(t[e])}return n}function In(t){const e=Object.prototype.toString.call(t),r=typeof t;return"number"===r||"boolean"===r||"string"===r||"symbol"===r||"function"===r||"[object Date]"===e||"[object RegExp]"===e||"[object Module]"===e||null==t||!0===t._watchdogExcluded||t instanceof EventTarget||t instanceof Event}function zn(t,e,r=new Set){if(t===e&&("object"==typeof(n=t)&&null!==n))return!0;var n;const o=Tn(t,r),s=Tn(e,r);for(const t of o)if(s.has(t))return!0;return!1}class Dn extends r{constructor(t,e={}){super(e),this._editor=null,this._throttledSave=q(this._save.bind(this),"number"==typeof e.saveInterval?e.saveInterval:5e3),this._creator=(e,r)=>t.create(e,r),this._destructor=t=>t.destroy()}get editor(){return this._editor}get _item(){return this._editor}_restart(){return Promise.resolve().then((()=>(this.state="initializing",this._fire("stateChange"),this._destroy()))).catch((t=>{console.error("An error happened during the editor destroying.",t)})).then((()=>{if("string"==typeof this._elementOrData)return this.create(this._data,this._config,this._config.context);{const t=Object.assign({},this._config,{initialData:this._data});return this.create(this._elementOrData,t,t.context)}})).then((()=>{this._fire("restart")}))}create(t=this._elementOrData,e=this._config,r){return Promise.resolve().then((()=>(super._startErrorHandling(),this._elementOrData=t,this._config=this._cloneEditorConfiguration(e)||{},this._config.context=r,this._creator(t,this._config)))).then((t=>{this._editor=t,t.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=t.model.document.version,this._data=this._getData(),this.state="ready",this._fire("stateChange")}))}destroy(){return Promise.resolve().then((()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling(),this._throttledSave.flush();const t=this._editor;return this._editor=null,t.model.document.off("change:data",this._throttledSave),this._destructor(t)}))}_save(){const t=this._editor.model.document.version;try{this._data=this._getData(),this._lastDocumentVersion=t}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(t){this._excludedProps=t}_getData(){const t={};for(const e of this._editor.model.document.getRootNames())t[e]=this._editor.data.get({rootName:e});return t}_isErrorComingFromThisItem(t){return zn(this._editor,t.context,this._excludedProps)}_cloneEditorConfiguration(t){return jn(t,((t,e)=>Cn(t)||"context"===e?t:void 0))}}const Wn=Symbol("MainQueueId");class Fn extends r{constructor(t,e={}){super(e),this._watchdogs=new Map,this._watchdogConfig=e,this._context=null,this._contextProps=new Set,this._actionQueues=new Mn,this._creator=e=>t.create(e),this._destructor=t=>t.destroy(),this._actionQueues.onEmpty((()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))}))}get context(){return this._context}create(t={}){return this._actionQueues.enqueue(Wn,(()=>(this._contextConfig=t,this._create())))}getItem(t){return this._getWatchdog(t)._item}getItemState(t){return this._getWatchdog(t).state}add(t){const e=Nn(t);return Promise.all(e.map((t=>this._actionQueues.enqueue(t.id,(()=>{if("destroyed"===this.state)throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let e;if(this._watchdogs.has(t.id))throw new Error(`Item with the given id is already added: '${t.id}'.`);if("editor"===t.type)return e=new Dn(this._watchdogConfig),e.setCreator(t.creator),e._setExcludedProperties(this._contextProps),t.destructor&&e.setDestructor(t.destructor),this._watchdogs.set(t.id,e),e.on("error",((r,{error:n,causesRestart:o})=>{this._fire("itemError",{itemId:t.id,error:n}),o&&this._actionQueues.enqueue(t.id,(()=>new Promise((r=>{e.on("restart",function n(){e.off("restart",n),this._fire("itemRestart",{itemId:t.id}),r()}.bind(this))}))))})),e.create(t.sourceElementOrData,t.config,this._context);throw new Error(`Not supported item type: '${t.type}'.`)})))))}remove(t){const e=Nn(t);return Promise.all(e.map((t=>this._actionQueues.enqueue(t,(()=>{const e=this._getWatchdog(t);return this._watchdogs.delete(t),e.destroy()})))))}destroy(){return this._actionQueues.enqueue(Wn,(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_restart(){return this._actionQueues.enqueue(Wn,(()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch((t=>{console.error("An error happened during destroying the context or items.",t)})).then((()=>this._create())).then((()=>this._fire("restart"))))))}_create(){return Promise.resolve().then((()=>(this._startErrorHandling(),this._creator(this._contextConfig)))).then((t=>(this._context=t,this._contextProps=Tn(this._context),Promise.all(Array.from(this._watchdogs.values()).map((t=>(t._setExcludedProperties(this._contextProps),t.create(void 0,void 0,this._context))))))))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling();const t=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map((t=>t.destroy()))).then((()=>this._destructor(t)))}))}_getWatchdog(t){const e=this._watchdogs.get(t);if(!e)throw new Error(`Item with the given id was not registered: ${t}.`);return e}_isErrorComingFromThisItem(t){for(const e of this._watchdogs.values())if(e._isErrorComingFromThisItem(t))return!1;return zn(this._context,t.context)}}class Mn{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._actions=new WeakMap,this._lastActionId=0,this._activeActions=0}onEmpty(t){this._onEmptyCallbacks.push(t)}enqueue(t,e){const r=t===Wn;this._activeActions++,this._queues.get(t)||this._queues.set(t,Promise.resolve());const n=(r?Promise.all(this._queues.values()):Promise.all([this._queues.get(Wn),this._queues.get(t)])).then(e),o=n.catch((()=>{}));return this._queues.set(t,o),n.finally((()=>{this._activeActions--,this._queues.get(t)===o&&0===this._activeActions&&this._onEmptyCallbacks.forEach((t=>t()))}))}}function Nn(t){return Array.isArray(t)?t:[t]}(window.CKEditor5=window.CKEditor5||{}).watchdog=e})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-watchdog",
|
|
3
|
-
"version": "36.0.
|
|
3
|
+
"version": "36.0.1",
|
|
4
4
|
"description": "A watchdog feature for CKEditor 5 editors. It keeps a CKEditor 5 editor instance running.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"lodash-es": "^4.17.15"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@ckeditor/ckeditor5-core": "^36.0.
|
|
17
|
+
"@ckeditor/ckeditor5-core": "^36.0.1",
|
|
18
18
|
"@ckeditor/ckeditor5-dev-utils": "^32.0.0",
|
|
19
|
-
"@ckeditor/ckeditor5-editor-classic": "^36.0.
|
|
20
|
-
"@ckeditor/ckeditor5-paragraph": "^36.0.
|
|
21
|
-
"@ckeditor/ckeditor5-theme-lark": "^36.0.
|
|
22
|
-
"@ckeditor/ckeditor5-utils": "^36.0.
|
|
23
|
-
"ckeditor5": "^36.0.
|
|
19
|
+
"@ckeditor/ckeditor5-editor-classic": "^36.0.1",
|
|
20
|
+
"@ckeditor/ckeditor5-paragraph": "^36.0.1",
|
|
21
|
+
"@ckeditor/ckeditor5-theme-lark": "^36.0.1",
|
|
22
|
+
"@ckeditor/ckeditor5-utils": "^36.0.1",
|
|
23
|
+
"ckeditor5": "^36.0.1",
|
|
24
24
|
"webpack": "^5.58.1",
|
|
25
25
|
"webpack-cli": "^4.9.0"
|
|
26
26
|
},
|