@ckeditor/ckeditor5-watchdog
Advanced tools
Comparing version 27.1.0 to 28.0.0
@@ -5,2 +5,2 @@ /*! | ||
*/ | ||
window.CKEditor5=window.CKEditor5||{},window.CKEditor5.watchdog=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=8)}([function(t,e,r){"use strict";var n=r(2),o="object"==typeof self&&self&&self.Object===Object&&self,i=n.a||o||Function("return this")();e.a=i},function(t,e,r){"use strict";(function(t){var n=r(2),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o&&n.a.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();e.a=s}).call(this,r(4)(t))},function(t,e,r){"use strict";(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.a=r}).call(this,r(7))},function(t,e,r){"use strict";(function(t){var n=r(0),o=r(5),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=i&&"object"==typeof t&&t&&!t.nodeType&&t,s=a&&a.exports===i?n.a.Buffer:void 0,c=(s?s.isBuffer:void 0)||o.a;e.a=c}).call(this,r(4)(t))},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e,r){"use strict";e.a=function(){return!1}},function(t,e,r){"use strict";(function(t){var n=r(0),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o?n.a.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.a=function(t,e){if(e)return t.slice();var r=t.length,n=s?s(r):new t.constructor(r);return t.copy(n),n}}).call(this,r(4)(t))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";r.r(e);class n{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}}var o=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},i=r(0),a=function(){return i.a.Date.now()},s=/\s/;var c=function(t){for(var e=t.length;e--&&s.test(t.charAt(e)););return e},u=/^\s+/;var h=function(t){return t?t.slice(0,c(t)+1).replace(u,""):t},f=i.a.Symbol,l=Object.prototype,d=l.hasOwnProperty,p=l.toString,_=f?f.toStringTag:void 0;var v=function(t){var e=d.call(t,_),r=t[_];try{t[_]=void 0;var n=!0}catch(t){}var o=p.call(t);return n&&(e?t[_]=r:delete t[_]),o},b=Object.prototype.toString;var y=function(t){return b.call(t)},g=f?f.toStringTag:void 0;var j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":g&&g in Object(t)?v(t):y(t)};var m=function(t){return null!=t&&"object"==typeof t};var w=function(t){return"symbol"==typeof t||m(t)&&"[object Symbol]"==j(t)},O=/^[-+]0x[0-9a-f]+$/i,x=/^0b[01]+$/i,E=/^0o[0-7]+$/i,P=parseInt;var A=function(t){if("number"==typeof t)return t;if(w(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=h(t);var r=x.test(t);return r||E.test(t)?P(t.slice(2),r?2:8):O.test(t)?NaN:+t},S=Math.max,C=Math.min;var T=function(t,e,r){var n,i,s,c,u,h,f=0,l=!1,d=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function _(e){var r=n,o=i;return n=i=void 0,f=e,c=t.apply(o,r)}function v(t){return f=t,u=setTimeout(y,e),l?_(t):c}function b(t){var r=t-h;return void 0===h||r>=e||r<0||d&&t-f>=s}function y(){var t=a();if(b(t))return g(t);u=setTimeout(y,function(t){var r=e-(t-h);return d?C(r,s-(t-f)):r}(t))}function g(t){return u=void 0,p&&n?_(t):(n=i=void 0,c)}function j(){var t=a(),r=b(t);if(n=arguments,i=this,h=t,r){if(void 0===u)return v(h);if(d)return clearTimeout(u),u=setTimeout(y,e),_(h)}return void 0===u&&(u=setTimeout(y,e)),c}return e=A(e)||0,o(r)&&(l=!!r.leading,s=(d="maxWait"in r)?S(A(r.maxWait)||0,e):s,p="trailing"in r?!!r.trailing:p),j.cancel=function(){void 0!==u&&clearTimeout(u),f=0,n=h=i=u=void 0},j.flush=function(){return void 0===u?c:g(a())},j};var I=function(t,e,r){var n=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),T(t,e,{leading:n,maxWait:e,trailing:i})};var D=function(){this.__data__=[],this.size=0};var z=function(t,e){return t===e||t!=t&&e!=e};var F=function(t,e){for(var r=t.length;r--;)if(z(t[r][0],e))return r;return-1},M=Array.prototype.splice;var N=function(t){var e=this.__data__,r=F(e,t);return!(r<0)&&(r==e.length-1?e.pop():M.call(e,r,1),--this.size,!0)};var W=function(t){var e=this.__data__,r=F(e,t);return r<0?void 0:e[r][1]};var k=function(t){return F(this.__data__,t)>-1};var U=function(t,e){var r=this.__data__,n=F(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function R(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])}}R.prototype.clear=D,R.prototype.delete=N,R.prototype.get=W,R.prototype.has=k,R.prototype.set=U;var $=R;var L=function(){this.__data__=new $,this.size=0};var H=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Q=function(t){return this.__data__.get(t)};var B=function(t){return this.__data__.has(t)};var V,q=function(t){if(!o(t))return!1;var e=j(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},K=i.a["__core-js_shared__"],G=(V=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"";var Y=function(t){return!!G&&G in t},J=Function.prototype.toString;var X=function(t){if(null!=t){try{return J.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Z=/^\[object .+?Constructor\]$/,tt=Function.prototype,et=Object.prototype,rt=tt.toString,nt=et.hasOwnProperty,ot=RegExp("^"+rt.call(nt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var it=function(t){return!(!o(t)||Y(t))&&(q(t)?ot:Z).test(X(t))};var at=function(t,e){return null==t?void 0:t[e]};var st=function(t,e){var r=at(t,e);return it(r)?r:void 0},ct=st(i.a,"Map"),ut=st(Object,"create");var ht=function(){this.__data__=ut?ut(null):{},this.size=0};var ft=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},lt=Object.prototype.hasOwnProperty;var dt=function(t){var e=this.__data__;if(ut){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return lt.call(e,t)?e[t]:void 0},pt=Object.prototype.hasOwnProperty;var _t=function(t){var e=this.__data__;return ut?void 0!==e[t]:pt.call(e,t)};var vt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ut&&void 0===e?"__lodash_hash_undefined__":e,this};function bt(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])}}bt.prototype.clear=ht,bt.prototype.delete=ft,bt.prototype.get=dt,bt.prototype.has=_t,bt.prototype.set=vt;var yt=bt;var gt=function(){this.size=0,this.__data__={hash:new yt,map:new(ct||$),string:new yt}};var jt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var mt=function(t,e){var r=t.__data__;return jt(e)?r["string"==typeof e?"string":"hash"]:r.map};var wt=function(t){var e=mt(this,t).delete(t);return this.size-=e?1:0,e};var Ot=function(t){return mt(this,t).get(t)};var xt=function(t){return mt(this,t).has(t)};var Et=function(t,e){var r=mt(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=gt,Pt.prototype.delete=wt,Pt.prototype.get=Ot,Pt.prototype.has=xt,Pt.prototype.set=Et;var At=Pt;var St=function(t,e){var r=this.__data__;if(r instanceof $){var n=r.__data__;if(!ct||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new At(n)}return r.set(t,e),this.size=r.size,this};function Ct(t){var e=this.__data__=new $(t);this.size=e.size}Ct.prototype.clear=L,Ct.prototype.delete=H,Ct.prototype.get=Q,Ct.prototype.has=B,Ct.prototype.set=St;var Tt=Ct;var It=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t},Dt=function(){try{var t=st(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var zt=function(t,e,r){"__proto__"==e&&Dt?Dt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},Ft=Object.prototype.hasOwnProperty;var Mt=function(t,e,r){var n=t[e];Ft.call(t,e)&&z(n,r)&&(void 0!==r||e in t)||zt(t,e,r)};var Nt=function(t,e,r,n){var o=!r;r||(r={});for(var i=-1,a=e.length;++i<a;){var s=e[i],c=n?n(r[s],t[s],s,r,t):void 0;void 0===c&&(c=t[s]),o?zt(r,s,c):Mt(r,s,c)}return r};var Wt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var kt=function(t){return m(t)&&"[object Arguments]"==j(t)},Ut=Object.prototype,Rt=Ut.hasOwnProperty,$t=Ut.propertyIsEnumerable,Lt=kt(function(){return arguments}())?kt:function(t){return m(t)&&Rt.call(t,"callee")&&!$t.call(t,"callee")},Ht=Array.isArray,Qt=r(3),Bt=/^(?:0|[1-9]\d*)$/;var Vt=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Bt.test(t))&&t>-1&&t%1==0&&t<e};var qt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Kt={};Kt["[object Float32Array]"]=Kt["[object Float64Array]"]=Kt["[object Int8Array]"]=Kt["[object Int16Array]"]=Kt["[object Int32Array]"]=Kt["[object Uint8Array]"]=Kt["[object Uint8ClampedArray]"]=Kt["[object Uint16Array]"]=Kt["[object Uint32Array]"]=!0,Kt["[object Arguments]"]=Kt["[object Array]"]=Kt["[object ArrayBuffer]"]=Kt["[object Boolean]"]=Kt["[object DataView]"]=Kt["[object Date]"]=Kt["[object Error]"]=Kt["[object Function]"]=Kt["[object Map]"]=Kt["[object Number]"]=Kt["[object Object]"]=Kt["[object RegExp]"]=Kt["[object Set]"]=Kt["[object String]"]=Kt["[object WeakMap]"]=!1;var Gt=function(t){return m(t)&&qt(t.length)&&!!Kt[j(t)]};var Yt=function(t){return function(e){return t(e)}},Jt=r(1),Xt=Jt.a&&Jt.a.isTypedArray,Zt=Xt?Yt(Xt):Gt,te=Object.prototype.hasOwnProperty;var ee=function(t,e){var r=Ht(t),n=!r&&Lt(t),o=!r&&!n&&Object(Qt.a)(t),i=!r&&!n&&!o&&Zt(t),a=r||n||o||i,s=a?Wt(t.length,String):[],c=s.length;for(var u in t)!e&&!te.call(t,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Vt(u,c))||s.push(u);return s},re=Object.prototype;var ne=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||re)};var oe=function(t,e){return function(r){return t(e(r))}},ie=oe(Object.keys,Object),ae=Object.prototype.hasOwnProperty;var se=function(t){if(!ne(t))return ie(t);var e=[];for(var r in Object(t))ae.call(t,r)&&"constructor"!=r&&e.push(r);return e};var ce=function(t){return null!=t&&qt(t.length)&&!q(t)};var ue=function(t){return ce(t)?ee(t):se(t)};var he=function(t,e){return t&&Nt(e,ue(e),t)};var fe=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e},le=Object.prototype.hasOwnProperty;var de=function(t){if(!o(t))return fe(t);var e=ne(t),r=[];for(var n in t)("constructor"!=n||!e&&le.call(t,n))&&r.push(n);return r};var pe=function(t){return ce(t)?ee(t,!0):de(t)};var _e=function(t,e){return t&&Nt(e,pe(e),t)},ve=r(6);var be=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e};var ye=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i};var ge=function(){return[]},je=Object.prototype.propertyIsEnumerable,me=Object.getOwnPropertySymbols,we=me?function(t){return null==t?[]:(t=Object(t),ye(me(t),(function(e){return je.call(t,e)})))}:ge;var Oe=function(t,e){return Nt(t,we(t),e)};var xe=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t},Ee=oe(Object.getPrototypeOf,Object),Pe=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)xe(e,we(t)),t=Ee(t);return e}:ge;var Ae=function(t,e){return Nt(t,Pe(t),e)};var Se=function(t,e,r){var n=e(t);return Ht(t)?n:xe(n,r(t))};var Ce=function(t){return Se(t,ue,we)};var Te=function(t){return Se(t,pe,Pe)},Ie=st(i.a,"DataView"),De=st(i.a,"Promise"),ze=st(i.a,"Set"),Fe=st(i.a,"WeakMap"),Me=X(Ie),Ne=X(ct),We=X(De),ke=X(ze),Ue=X(Fe),Re=j;(Ie&&"[object DataView]"!=Re(new Ie(new ArrayBuffer(1)))||ct&&"[object Map]"!=Re(new ct)||De&&"[object Promise]"!=Re(De.resolve())||ze&&"[object Set]"!=Re(new ze)||Fe&&"[object WeakMap]"!=Re(new Fe))&&(Re=function(t){var e=j(t),r="[object Object]"==e?t.constructor:void 0,n=r?X(r):"";if(n)switch(n){case Me:return"[object DataView]";case Ne:return"[object Map]";case We:return"[object Promise]";case ke:return"[object Set]";case Ue:return"[object WeakMap]"}return e});var $e=Re,Le=Object.prototype.hasOwnProperty;var He=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&Le.call(t,"index")&&(r.index=t.index,r.input=t.input),r},Qe=i.a.Uint8Array;var Be=function(t){var e=new t.constructor(t.byteLength);return new Qe(e).set(new Qe(t)),e};var Ve=function(t,e){var r=e?Be(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)},qe=/\w*$/;var Ke=function(t){var e=new t.constructor(t.source,qe.exec(t));return e.lastIndex=t.lastIndex,e},Ge=f?f.prototype:void 0,Ye=Ge?Ge.valueOf:void 0;var Je=function(t){return Ye?Object(Ye.call(t)):{}};var Xe=function(t,e){var r=e?Be(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var Ze=function(t,e,r){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return Be(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return Ve(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 Xe(t,r);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return Ke(t);case"[object Set]":return new n;case"[object Symbol]":return Je(t)}},tr=Object.create,er=function(){function t(){}return function(e){if(!o(e))return{};if(tr)return tr(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();var rr=function(t){return"function"!=typeof t.constructor||ne(t)?{}:er(Ee(t))};var nr=function(t){return m(t)&&"[object Map]"==$e(t)},or=Jt.a&&Jt.a.isMap,ir=or?Yt(or):nr;var ar=function(t){return m(t)&&"[object Set]"==$e(t)},sr=Jt.a&&Jt.a.isSet,cr=sr?Yt(sr):ar,ur={};ur["[object Arguments]"]=ur["[object Array]"]=ur["[object ArrayBuffer]"]=ur["[object DataView]"]=ur["[object Boolean]"]=ur["[object Date]"]=ur["[object Float32Array]"]=ur["[object Float64Array]"]=ur["[object Int8Array]"]=ur["[object Int16Array]"]=ur["[object Int32Array]"]=ur["[object Map]"]=ur["[object Number]"]=ur["[object Object]"]=ur["[object RegExp]"]=ur["[object Set]"]=ur["[object String]"]=ur["[object Symbol]"]=ur["[object Uint8Array]"]=ur["[object Uint8ClampedArray]"]=ur["[object Uint16Array]"]=ur["[object Uint32Array]"]=!0,ur["[object Error]"]=ur["[object Function]"]=ur["[object WeakMap]"]=!1;var hr=function t(e,r,n,i,a,s){var c,u=1&r,h=2&r,f=4&r;if(n&&(c=a?n(e,i,a,s):n(e)),void 0!==c)return c;if(!o(e))return e;var l=Ht(e);if(l){if(c=He(e),!u)return be(e,c)}else{var d=$e(e),p="[object Function]"==d||"[object GeneratorFunction]"==d;if(Object(Qt.a)(e))return Object(ve.a)(e,u);if("[object Object]"==d||"[object Arguments]"==d||p&&!a){if(c=h||p?{}:rr(e),!u)return h?Ae(e,_e(c,e)):Oe(e,he(c,e))}else{if(!ur[d])return a?e:{};c=Ze(e,d,u)}}s||(s=new Tt);var _=s.get(e);if(_)return _;s.set(e,c),cr(e)?e.forEach((function(o){c.add(t(o,r,n,o,e,s))})):ir(e)&&e.forEach((function(o,i){c.set(i,t(o,r,n,i,e,s))}));var v=l?void 0:(f?h?Te:Ce:h?pe:ue)(e);return It(v||e,(function(o,i){v&&(o=e[i=o]),Mt(c,i,t(o,r,n,i,e,s))})),c};var fr=function(t,e){return hr(t,5,e="function"==typeof e?e:void 0)},lr=Function.prototype,dr=Object.prototype,pr=lr.toString,_r=dr.hasOwnProperty,vr=pr.call(Object);var br=function(t){if(!m(t)||"[object Object]"!=j(t))return!1;var e=Ee(t);if(null===e)return!0;var r=_r.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&pr.call(r)==vr};var yr=function(t){return m(t)&&1===t.nodeType&&!br(t)};function gr(t,e=new Set){const r=[t],n=new Set;for(;r.length>0;){const t=r.shift();if(!(n.has(t)||jr(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 jr(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||t instanceof EventTarget||t instanceof Event}function mr(t,e,r=new Set){if(t===e&&("object"==typeof(n=t)&&null!==n))return!0;var n;const o=gr(t,r),i=gr(e,r);for(const t of o)if(i.has(t))return!0;return!1}class wr extends n{constructor(t,e={}){super(e),this._editor=null,this._throttledSave=I(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,this._destructor(t)})}_save(){const t=this._editor.model.document.version;if(t!==this._lastDocumentVersion)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 mr(this._editor,t.context,this._excludedProps)}_cloneEditorConfiguration(t){return fr(t,(t,e)=>yr(t)||"context"===e?t:void 0)}}class Or{constructor(){this._promiseQueue=Promise.resolve(),this._onEmptyCallbacks=[]}onEmpty(t){this._onEmptyCallbacks.push(t)}enqueue(t){let e;const r=this._promiseQueue.then(t).then(()=>{this._promiseQueue===e&&this._onEmptyCallbacks.forEach(t=>t())});return e=this._promiseQueue=r.catch(()=>{}),r}}function xr(t){return Array.isArray(t)?t:[t]}e.default={ContextWatchdog:class extends n{constructor(t,e={}){super(e),this._watchdogs=new Map,this._watchdogConfig=e,this._context=null,this._contextProps=new Set,this._actionQueue=new Or,this._creator=e=>t.create(e),this._destructor=t=>t.destroy(),this._actionQueue.onEmpty(()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))})}get context(){return this._context}create(t={}){return this._actionQueue.enqueue(()=>(this._contextConfig=t,this._create()))}getItem(t){return this._getWatchdog(t)._item}getItemState(t){return this._getWatchdog(t).state}add(t){const e=xr(t);return this._actionQueue.enqueue(()=>{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.");return Promise.all(e.map(t=>{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 wr(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._actionQueue.enqueue(()=>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=xr(t);return this._actionQueue.enqueue(()=>Promise.all(e.map(t=>{const e=this._getWatchdog(t);return this._watchdogs.delete(t),e.destroy()})))}destroy(){return this._actionQueue.enqueue(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueue.enqueue(()=>(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=gr(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 mr(this._context,t.context)}},EditorWatchdog:wr,Watchdog:n}}]).default; | ||
window.CKEditor5=window.CKEditor5||{},window.CKEditor5.watchdog=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=8)}([function(t,e,r){"use strict";var n=r(2),o="object"==typeof self&&self&&self.Object===Object&&self,i=n.a||o||Function("return this")();e.a=i},function(t,e,r){"use strict";(function(t){var n=r(2),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o&&n.a.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();e.a=s}).call(this,r(4)(t))},function(t,e,r){"use strict";(function(t){var r="object"==typeof t&&t&&t.Object===Object&&t;e.a=r}).call(this,r(7))},function(t,e,r){"use strict";(function(t){var n=r(0),o=r(5),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=i&&"object"==typeof t&&t&&!t.nodeType&&t,s=a&&a.exports===i?n.a.Buffer:void 0,c=(s?s.isBuffer:void 0)||o.a;e.a=c}).call(this,r(4)(t))},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e,r){"use strict";e.a=function(){return!1}},function(t,e,r){"use strict";(function(t){var n=r(0),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o?n.a.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.a=function(t,e){if(e)return t.slice();var r=t.length,n=s?s(r):new t.constructor(r);return t.copy(n),n}}).call(this,r(4)(t))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";r.r(e),r.d(e,"ContextWatchdog",(function(){return Or})),r.d(e,"EditorWatchdog",(function(){return wr})),r.d(e,"Watchdog",(function(){return n}));class n{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}}var o=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},i=r(0),a=function(){return i.a.Date.now()},s=/\s/;var c=function(t){for(var e=t.length;e--&&s.test(t.charAt(e)););return e},u=/^\s+/;var h=function(t){return t?t.slice(0,c(t)+1).replace(u,""):t},f=i.a.Symbol,l=Object.prototype,d=l.hasOwnProperty,p=l.toString,_=f?f.toStringTag:void 0;var v=function(t){var e=d.call(t,_),r=t[_];try{t[_]=void 0;var n=!0}catch(t){}var o=p.call(t);return n&&(e?t[_]=r:delete t[_]),o},b=Object.prototype.toString;var y=function(t){return b.call(t)},g=f?f.toStringTag:void 0;var j=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":g&&g in Object(t)?v(t):y(t)};var m=function(t){return null!=t&&"object"==typeof t};var w=function(t){return"symbol"==typeof t||m(t)&&"[object Symbol]"==j(t)},O=/^[-+]0x[0-9a-f]+$/i,x=/^0b[01]+$/i,E=/^0o[0-7]+$/i,P=parseInt;var A=function(t){if("number"==typeof t)return t;if(w(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=h(t);var r=x.test(t);return r||E.test(t)?P(t.slice(2),r?2:8):O.test(t)?NaN:+t},S=Math.max,C=Math.min;var T=function(t,e,r){var n,i,s,c,u,h,f=0,l=!1,d=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function _(e){var r=n,o=i;return n=i=void 0,f=e,c=t.apply(o,r)}function v(t){return f=t,u=setTimeout(y,e),l?_(t):c}function b(t){var r=t-h;return void 0===h||r>=e||r<0||d&&t-f>=s}function y(){var t=a();if(b(t))return g(t);u=setTimeout(y,function(t){var r=e-(t-h);return d?C(r,s-(t-f)):r}(t))}function g(t){return u=void 0,p&&n?_(t):(n=i=void 0,c)}function j(){var t=a(),r=b(t);if(n=arguments,i=this,h=t,r){if(void 0===u)return v(h);if(d)return clearTimeout(u),u=setTimeout(y,e),_(h)}return void 0===u&&(u=setTimeout(y,e)),c}return e=A(e)||0,o(r)&&(l=!!r.leading,s=(d="maxWait"in r)?S(A(r.maxWait)||0,e):s,p="trailing"in r?!!r.trailing:p),j.cancel=function(){void 0!==u&&clearTimeout(u),f=0,n=h=i=u=void 0},j.flush=function(){return void 0===u?c:g(a())},j};var I=function(t,e,r){var n=!0,i=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return o(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),T(t,e,{leading:n,maxWait:e,trailing:i})};var D=function(){this.__data__=[],this.size=0};var z=function(t,e){return t===e||t!=t&&e!=e};var F=function(t,e){for(var r=t.length;r--;)if(z(t[r][0],e))return r;return-1},M=Array.prototype.splice;var N=function(t){var e=this.__data__,r=F(e,t);return!(r<0)&&(r==e.length-1?e.pop():M.call(e,r,1),--this.size,!0)};var W=function(t){var e=this.__data__,r=F(e,t);return r<0?void 0:e[r][1]};var k=function(t){return F(this.__data__,t)>-1};var U=function(t,e){var r=this.__data__,n=F(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function R(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])}}R.prototype.clear=D,R.prototype.delete=N,R.prototype.get=W,R.prototype.has=k,R.prototype.set=U;var $=R;var L=function(){this.__data__=new $,this.size=0};var H=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Q=function(t){return this.__data__.get(t)};var B=function(t){return this.__data__.has(t)};var V,q=function(t){if(!o(t))return!1;var e=j(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},K=i.a["__core-js_shared__"],G=(V=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"";var Y=function(t){return!!G&&G in t},J=Function.prototype.toString;var X=function(t){if(null!=t){try{return J.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Z=/^\[object .+?Constructor\]$/,tt=Function.prototype,et=Object.prototype,rt=tt.toString,nt=et.hasOwnProperty,ot=RegExp("^"+rt.call(nt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var it=function(t){return!(!o(t)||Y(t))&&(q(t)?ot:Z).test(X(t))};var at=function(t,e){return null==t?void 0:t[e]};var st=function(t,e){var r=at(t,e);return it(r)?r:void 0},ct=st(i.a,"Map"),ut=st(Object,"create");var ht=function(){this.__data__=ut?ut(null):{},this.size=0};var ft=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},lt=Object.prototype.hasOwnProperty;var dt=function(t){var e=this.__data__;if(ut){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return lt.call(e,t)?e[t]:void 0},pt=Object.prototype.hasOwnProperty;var _t=function(t){var e=this.__data__;return ut?void 0!==e[t]:pt.call(e,t)};var vt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ut&&void 0===e?"__lodash_hash_undefined__":e,this};function bt(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])}}bt.prototype.clear=ht,bt.prototype.delete=ft,bt.prototype.get=dt,bt.prototype.has=_t,bt.prototype.set=vt;var yt=bt;var gt=function(){this.size=0,this.__data__={hash:new yt,map:new(ct||$),string:new yt}};var jt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var mt=function(t,e){var r=t.__data__;return jt(e)?r["string"==typeof e?"string":"hash"]:r.map};var wt=function(t){var e=mt(this,t).delete(t);return this.size-=e?1:0,e};var Ot=function(t){return mt(this,t).get(t)};var xt=function(t){return mt(this,t).has(t)};var Et=function(t,e){var r=mt(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=gt,Pt.prototype.delete=wt,Pt.prototype.get=Ot,Pt.prototype.has=xt,Pt.prototype.set=Et;var At=Pt;var St=function(t,e){var r=this.__data__;if(r instanceof $){var n=r.__data__;if(!ct||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new At(n)}return r.set(t,e),this.size=r.size,this};function Ct(t){var e=this.__data__=new $(t);this.size=e.size}Ct.prototype.clear=L,Ct.prototype.delete=H,Ct.prototype.get=Q,Ct.prototype.has=B,Ct.prototype.set=St;var Tt=Ct;var It=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t},Dt=function(){try{var t=st(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var zt=function(t,e,r){"__proto__"==e&&Dt?Dt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},Ft=Object.prototype.hasOwnProperty;var Mt=function(t,e,r){var n=t[e];Ft.call(t,e)&&z(n,r)&&(void 0!==r||e in t)||zt(t,e,r)};var Nt=function(t,e,r,n){var o=!r;r||(r={});for(var i=-1,a=e.length;++i<a;){var s=e[i],c=n?n(r[s],t[s],s,r,t):void 0;void 0===c&&(c=t[s]),o?zt(r,s,c):Mt(r,s,c)}return r};var Wt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var kt=function(t){return m(t)&&"[object Arguments]"==j(t)},Ut=Object.prototype,Rt=Ut.hasOwnProperty,$t=Ut.propertyIsEnumerable,Lt=kt(function(){return arguments}())?kt:function(t){return m(t)&&Rt.call(t,"callee")&&!$t.call(t,"callee")},Ht=Array.isArray,Qt=r(3),Bt=/^(?:0|[1-9]\d*)$/;var Vt=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Bt.test(t))&&t>-1&&t%1==0&&t<e};var qt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Kt={};Kt["[object Float32Array]"]=Kt["[object Float64Array]"]=Kt["[object Int8Array]"]=Kt["[object Int16Array]"]=Kt["[object Int32Array]"]=Kt["[object Uint8Array]"]=Kt["[object Uint8ClampedArray]"]=Kt["[object Uint16Array]"]=Kt["[object Uint32Array]"]=!0,Kt["[object Arguments]"]=Kt["[object Array]"]=Kt["[object ArrayBuffer]"]=Kt["[object Boolean]"]=Kt["[object DataView]"]=Kt["[object Date]"]=Kt["[object Error]"]=Kt["[object Function]"]=Kt["[object Map]"]=Kt["[object Number]"]=Kt["[object Object]"]=Kt["[object RegExp]"]=Kt["[object Set]"]=Kt["[object String]"]=Kt["[object WeakMap]"]=!1;var Gt=function(t){return m(t)&&qt(t.length)&&!!Kt[j(t)]};var Yt=function(t){return function(e){return t(e)}},Jt=r(1),Xt=Jt.a&&Jt.a.isTypedArray,Zt=Xt?Yt(Xt):Gt,te=Object.prototype.hasOwnProperty;var ee=function(t,e){var r=Ht(t),n=!r&&Lt(t),o=!r&&!n&&Object(Qt.a)(t),i=!r&&!n&&!o&&Zt(t),a=r||n||o||i,s=a?Wt(t.length,String):[],c=s.length;for(var u in t)!e&&!te.call(t,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Vt(u,c))||s.push(u);return s},re=Object.prototype;var ne=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||re)};var oe=function(t,e){return function(r){return t(e(r))}},ie=oe(Object.keys,Object),ae=Object.prototype.hasOwnProperty;var se=function(t){if(!ne(t))return ie(t);var e=[];for(var r in Object(t))ae.call(t,r)&&"constructor"!=r&&e.push(r);return e};var ce=function(t){return null!=t&&qt(t.length)&&!q(t)};var ue=function(t){return ce(t)?ee(t):se(t)};var he=function(t,e){return t&&Nt(e,ue(e),t)};var fe=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e},le=Object.prototype.hasOwnProperty;var de=function(t){if(!o(t))return fe(t);var e=ne(t),r=[];for(var n in t)("constructor"!=n||!e&&le.call(t,n))&&r.push(n);return r};var pe=function(t){return ce(t)?ee(t,!0):de(t)};var _e=function(t,e){return t&&Nt(e,pe(e),t)},ve=r(6);var be=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e};var ye=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i};var ge=function(){return[]},je=Object.prototype.propertyIsEnumerable,me=Object.getOwnPropertySymbols,we=me?function(t){return null==t?[]:(t=Object(t),ye(me(t),(function(e){return je.call(t,e)})))}:ge;var Oe=function(t,e){return Nt(t,we(t),e)};var xe=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t},Ee=oe(Object.getPrototypeOf,Object),Pe=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)xe(e,we(t)),t=Ee(t);return e}:ge;var Ae=function(t,e){return Nt(t,Pe(t),e)};var Se=function(t,e,r){var n=e(t);return Ht(t)?n:xe(n,r(t))};var Ce=function(t){return Se(t,ue,we)};var Te=function(t){return Se(t,pe,Pe)},Ie=st(i.a,"DataView"),De=st(i.a,"Promise"),ze=st(i.a,"Set"),Fe=st(i.a,"WeakMap"),Me=X(Ie),Ne=X(ct),We=X(De),ke=X(ze),Ue=X(Fe),Re=j;(Ie&&"[object DataView]"!=Re(new Ie(new ArrayBuffer(1)))||ct&&"[object Map]"!=Re(new ct)||De&&"[object Promise]"!=Re(De.resolve())||ze&&"[object Set]"!=Re(new ze)||Fe&&"[object WeakMap]"!=Re(new Fe))&&(Re=function(t){var e=j(t),r="[object Object]"==e?t.constructor:void 0,n=r?X(r):"";if(n)switch(n){case Me:return"[object DataView]";case Ne:return"[object Map]";case We:return"[object Promise]";case ke:return"[object Set]";case Ue:return"[object WeakMap]"}return e});var $e=Re,Le=Object.prototype.hasOwnProperty;var He=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&Le.call(t,"index")&&(r.index=t.index,r.input=t.input),r},Qe=i.a.Uint8Array;var Be=function(t){var e=new t.constructor(t.byteLength);return new Qe(e).set(new Qe(t)),e};var Ve=function(t,e){var r=e?Be(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)},qe=/\w*$/;var Ke=function(t){var e=new t.constructor(t.source,qe.exec(t));return e.lastIndex=t.lastIndex,e},Ge=f?f.prototype:void 0,Ye=Ge?Ge.valueOf:void 0;var Je=function(t){return Ye?Object(Ye.call(t)):{}};var Xe=function(t,e){var r=e?Be(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var Ze=function(t,e,r){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return Be(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return Ve(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 Xe(t,r);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return Ke(t);case"[object Set]":return new n;case"[object Symbol]":return Je(t)}},tr=Object.create,er=function(){function t(){}return function(e){if(!o(e))return{};if(tr)return tr(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();var rr=function(t){return"function"!=typeof t.constructor||ne(t)?{}:er(Ee(t))};var nr=function(t){return m(t)&&"[object Map]"==$e(t)},or=Jt.a&&Jt.a.isMap,ir=or?Yt(or):nr;var ar=function(t){return m(t)&&"[object Set]"==$e(t)},sr=Jt.a&&Jt.a.isSet,cr=sr?Yt(sr):ar,ur={};ur["[object Arguments]"]=ur["[object Array]"]=ur["[object ArrayBuffer]"]=ur["[object DataView]"]=ur["[object Boolean]"]=ur["[object Date]"]=ur["[object Float32Array]"]=ur["[object Float64Array]"]=ur["[object Int8Array]"]=ur["[object Int16Array]"]=ur["[object Int32Array]"]=ur["[object Map]"]=ur["[object Number]"]=ur["[object Object]"]=ur["[object RegExp]"]=ur["[object Set]"]=ur["[object String]"]=ur["[object Symbol]"]=ur["[object Uint8Array]"]=ur["[object Uint8ClampedArray]"]=ur["[object Uint16Array]"]=ur["[object Uint32Array]"]=!0,ur["[object Error]"]=ur["[object Function]"]=ur["[object WeakMap]"]=!1;var hr=function t(e,r,n,i,a,s){var c,u=1&r,h=2&r,f=4&r;if(n&&(c=a?n(e,i,a,s):n(e)),void 0!==c)return c;if(!o(e))return e;var l=Ht(e);if(l){if(c=He(e),!u)return be(e,c)}else{var d=$e(e),p="[object Function]"==d||"[object GeneratorFunction]"==d;if(Object(Qt.a)(e))return Object(ve.a)(e,u);if("[object Object]"==d||"[object Arguments]"==d||p&&!a){if(c=h||p?{}:rr(e),!u)return h?Ae(e,_e(c,e)):Oe(e,he(c,e))}else{if(!ur[d])return a?e:{};c=Ze(e,d,u)}}s||(s=new Tt);var _=s.get(e);if(_)return _;s.set(e,c),cr(e)?e.forEach((function(o){c.add(t(o,r,n,o,e,s))})):ir(e)&&e.forEach((function(o,i){c.set(i,t(o,r,n,i,e,s))}));var v=l?void 0:(f?h?Te:Ce:h?pe:ue)(e);return It(v||e,(function(o,i){v&&(o=e[i=o]),Mt(c,i,t(o,r,n,i,e,s))})),c};var fr=function(t,e){return hr(t,5,e="function"==typeof e?e:void 0)},lr=Function.prototype,dr=Object.prototype,pr=lr.toString,_r=dr.hasOwnProperty,vr=pr.call(Object);var br=function(t){if(!m(t)||"[object Object]"!=j(t))return!1;var e=Ee(t);if(null===e)return!0;var r=_r.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&pr.call(r)==vr};var yr=function(t){return m(t)&&1===t.nodeType&&!br(t)};function gr(t,e=new Set){const r=[t],n=new Set;for(;r.length>0;){const t=r.shift();if(!(n.has(t)||jr(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 jr(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||t instanceof EventTarget||t instanceof Event}function mr(t,e,r=new Set){if(t===e&&("object"==typeof(n=t)&&null!==n))return!0;var n;const o=gr(t,r),i=gr(e,r);for(const t of o)if(i.has(t))return!0;return!1}class wr extends n{constructor(t,e={}){super(e),this._editor=null,this._throttledSave=I(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,this._destructor(t)})}_save(){const t=this._editor.model.document.version;if(t!==this._lastDocumentVersion)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 mr(this._editor,t.context,this._excludedProps)}_cloneEditorConfiguration(t){return fr(t,(t,e)=>yr(t)||"context"===e?t:void 0)}}class Or extends n{constructor(t,e={}){super(e),this._watchdogs=new Map,this._watchdogConfig=e,this._context=null,this._contextProps=new Set,this._actionQueue=new xr,this._creator=e=>t.create(e),this._destructor=t=>t.destroy(),this._actionQueue.onEmpty(()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))})}get context(){return this._context}create(t={}){return this._actionQueue.enqueue(()=>(this._contextConfig=t,this._create()))}getItem(t){return this._getWatchdog(t)._item}getItemState(t){return this._getWatchdog(t).state}add(t){const e=Er(t);return this._actionQueue.enqueue(()=>{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.");return Promise.all(e.map(t=>{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 wr(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._actionQueue.enqueue(()=>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=Er(t);return this._actionQueue.enqueue(()=>Promise.all(e.map(t=>{const e=this._getWatchdog(t);return this._watchdogs.delete(t),e.destroy()})))}destroy(){return this._actionQueue.enqueue(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueue.enqueue(()=>(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=gr(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 mr(this._context,t.context)}}class xr{constructor(){this._promiseQueue=Promise.resolve(),this._onEmptyCallbacks=[]}onEmpty(t){this._onEmptyCallbacks.push(t)}enqueue(t){let e;const r=this._promiseQueue.then(t).then(()=>{this._promiseQueue===e&&this._onEmptyCallbacks.forEach(t=>t())});return e=this._promiseQueue=r.catch(()=>{}),r}}function Er(t){return Array.isArray(t)?t:[t]}}]); |
{ | ||
"name": "@ckeditor/ckeditor5-watchdog", | ||
"version": "27.1.0", | ||
"version": "28.0.0", | ||
"description": "A watchdog feature for CKEditor 5 editors. It keeps a CKEditor 5 editor instance running.", | ||
@@ -16,9 +16,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-core": "^27.1.0", | ||
"@ckeditor/ckeditor5-dev-utils": "^24.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^27.1.0", | ||
"@ckeditor/ckeditor5-paragraph": "^27.1.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^27.1.0", | ||
"@ckeditor/ckeditor5-utils": "^27.1.0", | ||
"ckeditor5": "^27.1.0", | ||
"@ckeditor/ckeditor5-core": "^28.0.0", | ||
"@ckeditor/ckeditor5-dev-utils": "^25.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^28.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^28.0.0", | ||
"@ckeditor/ckeditor5-theme-lark": "^28.0.0", | ||
"@ckeditor/ckeditor5-utils": "^28.0.0", | ||
"ckeditor5": "^28.0.0", | ||
"webpack": "^4.43.0", | ||
@@ -25,0 +25,0 @@ "webpack-cli": "^3.3.11" |
@@ -529,10 +529,4 @@ /** | ||
* | ||
* @typedef {module:watchdog/contextwatchdog~EditorWatchdogConfiguration} module:watchdog/contextwatchdog~WatchdogItemConfiguration | ||
*/ | ||
/** | ||
* The editor watchdog configuration interface specifies how editors should be created and destroyed. | ||
* @typedef {Object} module:watchdog/contextwatchdog~WatchdogItemConfiguration | ||
* | ||
* @typedef {Object} module:watchdog/contextwatchdog~EditorWatchdogConfiguration | ||
* | ||
* @property {String} id A unique item identificator. | ||
@@ -539,0 +533,0 @@ * |
@@ -10,10 +10,4 @@ /** | ||
import ContextWatchdog from './contextwatchdog'; | ||
import EditorWatchdog from './editorwatchdog'; | ||
import Watchdog from './watchdog'; | ||
export default { | ||
ContextWatchdog, | ||
EditorWatchdog, | ||
Watchdog | ||
}; | ||
export { default as ContextWatchdog } from './contextwatchdog'; | ||
export { default as EditorWatchdog } from './editorwatchdog'; | ||
export { default as Watchdog } from './watchdog'; |
@@ -19,2 +19,3 @@ /** | ||
* @param {Object|Array} target2 | ||
* @returns {Boolean} | ||
*/ | ||
@@ -21,0 +22,0 @@ export default function areConnectedThroughProperties( target1, target2, excludedNodes = new Set() ) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1039441
1219