@ckeditor/ckeditor5-watchdog 37.0.0-alpha.2 → 37.0.0-alpha.3
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/package.json +7 -13
- package/build/watchdog.js +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-watchdog",
|
|
3
|
-
"version": "37.0.0-alpha.
|
|
3
|
+
"version": "37.0.0-alpha.3",
|
|
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,16 +14,12 @@
|
|
|
14
14
|
"lodash-es": "^4.17.15"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.
|
|
18
|
-
"@ckeditor/ckeditor5-
|
|
19
|
-
"@ckeditor/ckeditor5-
|
|
20
|
-
"@ckeditor/ckeditor5-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"ckeditor5": "^37.0.0-alpha.2",
|
|
24
|
-
"typescript": "^4.8.4",
|
|
25
|
-
"webpack": "^5.58.1",
|
|
26
|
-
"webpack-cli": "^4.9.0"
|
|
17
|
+
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.3",
|
|
18
|
+
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.3",
|
|
19
|
+
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.3",
|
|
20
|
+
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.3",
|
|
21
|
+
"ckeditor5": "^37.0.0-alpha.3",
|
|
22
|
+
"typescript": "^4.8.4"
|
|
27
23
|
},
|
|
28
24
|
"engines": {
|
|
29
25
|
"node": ">=14.0.0",
|
|
@@ -43,12 +39,10 @@
|
|
|
43
39
|
"src/**/*.js",
|
|
44
40
|
"src/**/*.d.ts",
|
|
45
41
|
"theme",
|
|
46
|
-
"build",
|
|
47
42
|
"ckeditor5-metadata.json",
|
|
48
43
|
"CHANGELOG.md"
|
|
49
44
|
],
|
|
50
45
|
"scripts": {
|
|
51
|
-
"dll:build": "webpack",
|
|
52
46
|
"build": "tsc -p ./tsconfig.json",
|
|
53
47
|
"postversion": "npm run build"
|
|
54
48
|
},
|
package/build/watchdog.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
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:()=>Wn,EditorWatchdog:()=>zn,Watchdog:()=>r});class r{constructor(t){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit="number"==typeof t.crashNumberLimit?t.crashNumberLimit:3,this._minimumNonErrorTimePeriod="number"==typeof t.minimumNonErrorTimePeriod?t.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const e="error"in t?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.")}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 instanceof ErrorEvent?e.filename:void 0,lineno:e instanceof ErrorEvent?e.lineno:void 0,colno:e instanceof ErrorEvent?e.colno:void 0,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}}function n(t,e=new Set){const r=[t],n=new Set;let s=0;for(;r.length>s;){const t=r[s++];if(!n.has(t)&&o(t)&&!e.has(t))if(n.add(t),Symbol.iterator in t)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 o(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._watchdogExcluded||t instanceof EventTarget||t instanceof Event)}function s(t,e,r=new Set){if(t===e&&("object"==typeof(o=t)&&null!==o))return!0;var o;const s=n(t,r),i=n(e,r);for(const t of s)if(i.has(t))return!0;return!1}const i=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};const c="object"==typeof global&&global&&global.Object===Object&&global;var a="object"==typeof self&&self&&self.Object===Object&&self;const u=c||a||Function("return this")();const h=function(){return u.Date.now()};var l=/\s/;const f=function(t){for(var e=t.length;e--&&l.test(t.charAt(e)););return e};var d=/^\s+/;const _=function(t){return t?t.slice(0,f(t)+1).replace(d,""):t};const p=u.Symbol;var y=Object.prototype,v=y.hasOwnProperty,b=y.toString,g=p?p.toStringTag:void 0;const m=function(t){var e=v.call(t,g),r=t[g];try{t[g]=void 0;var n=!0}catch(t){}var o=b.call(t);return n&&(e?t[g]=r:delete t[g]),o};var j=Object.prototype.toString;const w=function(t){return j.call(t)};var E="[object Null]",x="[object Undefined]",O=p?p.toStringTag:void 0;const A=function(t){return null==t?void 0===t?x:E:O&&O in Object(t)?m(t):w(t)};const P=function(t){return null!=t&&"object"==typeof t};var S="[object Symbol]";const C=function(t){return"symbol"==typeof t||P(t)&&A(t)==S};var T=NaN,I=/^[-+]0x[0-9a-f]+$/i,D=/^0b[01]+$/i,z=/^0o[0-7]+$/i,F=parseInt;const W=function(t){if("number"==typeof t)return t;if(C(t))return T;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=_(t);var r=D.test(t);return r||z.test(t)?F(t.slice(2),r?2:8):I.test(t)?T:+t};var M="Expected a function",N=Math.max,q=Math.min;const U=function(t,e,r){var n,o,s,c,a,u,l=0,f=!1,d=!1,_=!0;if("function"!=typeof t)throw new TypeError(M);function p(e){var r=n,s=o;return n=o=void 0,l=e,c=t.apply(s,r)}function y(t){var r=t-u;return void 0===u||r>=e||r<0||d&&t-l>=s}function v(){var t=h();if(y(t))return b(t);a=setTimeout(v,function(t){var r=e-(t-u);return d?q(r,s-(t-l)):r}(t))}function b(t){return a=void 0,_&&n?p(t):(n=o=void 0,c)}function g(){var t=h(),r=y(t);if(n=arguments,o=this,u=t,r){if(void 0===a)return function(t){return l=t,a=setTimeout(v,e),f?p(t):c}(u);if(d)return clearTimeout(a),a=setTimeout(v,e),p(u)}return void 0===a&&(a=setTimeout(v,e)),c}return e=W(e)||0,i(r)&&(f=!!r.leading,s=(d="maxWait"in r)?N(W(r.maxWait)||0,e):s,_="trailing"in r?!!r.trailing:_),g.cancel=function(){void 0!==a&&clearTimeout(a),l=0,n=u=o=a=void 0},g.flush=function(){return void 0===a?c:b(h())},g};var R="Expected a function";const $=function(t,e,r){var n=!0,o=!0;if("function"!=typeof t)throw new TypeError(R);return i(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),U(t,e,{leading:n,maxWait:e,trailing:o})};const L=function(){this.__data__=[],this.size=0};const k=function(t,e){return t===e||t!=t&&e!=e};const H=function(t,e){for(var r=t.length;r--;)if(k(t[r][0],e))return r;return-1};var B=Array.prototype.splice;const Q=function(t){var e=this.__data__,r=H(e,t);return!(r<0)&&(r==e.length-1?e.pop():B.call(e,r,1),--this.size,!0)};const V=function(t){var e=this.__data__,r=H(e,t);return r<0?void 0:e[r][1]};const K=function(t){return H(this.__data__,t)>-1};const G=function(t,e){var r=this.__data__,n=H(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Y(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])}}Y.prototype.clear=L,Y.prototype.delete=Q,Y.prototype.get=V,Y.prototype.has=K,Y.prototype.set=G;const J=Y;const X=function(){this.__data__=new J,this.size=0};const Z=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};const tt=function(t){return this.__data__.get(t)};const et=function(t){return this.__data__.has(t)};var rt="[object AsyncFunction]",nt="[object Function]",ot="[object GeneratorFunction]",st="[object Proxy]";const it=function(t){if(!i(t))return!1;var e=A(t);return e==nt||e==ot||e==rt||e==st};const ct=u["__core-js_shared__"];var at,ut=(at=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||""))?"Symbol(src)_1."+at:"";const ht=function(t){return!!ut&&ut in t};var lt=Function.prototype.toString;const ft=function(t){if(null!=t){try{return lt.call(t)}catch(t){}try{return t+""}catch(t){}}return""};var dt=/^\[object .+?Constructor\]$/,_t=Function.prototype,pt=Object.prototype,yt=_t.toString,vt=pt.hasOwnProperty,bt=RegExp("^"+yt.call(vt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const gt=function(t){return!(!i(t)||ht(t))&&(it(t)?bt:dt).test(ft(t))};const mt=function(t,e){return null==t?void 0:t[e]};const jt=function(t,e){var r=mt(t,e);return gt(r)?r:void 0};const wt=jt(u,"Map");const Et=jt(Object,"create");const xt=function(){this.__data__=Et?Et(null):{},this.size=0};const Ot=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e};var At="__lodash_hash_undefined__",Pt=Object.prototype.hasOwnProperty;const St=function(t){var e=this.__data__;if(Et){var r=e[t];return r===At?void 0:r}return Pt.call(e,t)?e[t]:void 0};var Ct=Object.prototype.hasOwnProperty;const Tt=function(t){var e=this.__data__;return Et?void 0!==e[t]:Ct.call(e,t)};var It="__lodash_hash_undefined__";const Dt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Et&&void 0===e?It:e,this};function zt(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])}}zt.prototype.clear=xt,zt.prototype.delete=Ot,zt.prototype.get=St,zt.prototype.has=Tt,zt.prototype.set=Dt;const Ft=zt;const Wt=function(){this.size=0,this.__data__={hash:new Ft,map:new(wt||J),string:new Ft}};const Mt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};const Nt=function(t,e){var r=t.__data__;return Mt(e)?r["string"==typeof e?"string":"hash"]:r.map};const qt=function(t){var e=Nt(this,t).delete(t);return this.size-=e?1:0,e};const Ut=function(t){return Nt(this,t).get(t)};const Rt=function(t){return Nt(this,t).has(t)};const $t=function(t,e){var r=Nt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Lt(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])}}Lt.prototype.clear=Wt,Lt.prototype.delete=qt,Lt.prototype.get=Ut,Lt.prototype.has=Rt,Lt.prototype.set=$t;const kt=Lt;var Ht=200;const Bt=function(t,e){var r=this.__data__;if(r instanceof J){var n=r.__data__;if(!wt||n.length<Ht-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new kt(n)}return r.set(t,e),this.size=r.size,this};function Qt(t){var e=this.__data__=new J(t);this.size=e.size}Qt.prototype.clear=X,Qt.prototype.delete=Z,Qt.prototype.get=tt,Qt.prototype.has=et,Qt.prototype.set=Bt;const Vt=Qt;const Kt=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t};const Gt=function(){try{var t=jt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();const Yt=function(t,e,r){"__proto__"==e&&Gt?Gt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r};var Jt=Object.prototype.hasOwnProperty;const Xt=function(t,e,r){var n=t[e];Jt.call(t,e)&&k(n,r)&&(void 0!==r||e in t)||Yt(t,e,r)};const Zt=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?Yt(r,c,a):Xt(r,c,a)}return r};const te=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var ee="[object Arguments]";const re=function(t){return P(t)&&A(t)==ee};var ne=Object.prototype,oe=ne.hasOwnProperty,se=ne.propertyIsEnumerable;const ie=re(function(){return arguments}())?re:function(t){return P(t)&&oe.call(t,"callee")&&!se.call(t,"callee")};const ce=Array.isArray;const ae=function(){return!1};var ue="object"==typeof exports&&exports&&!exports.nodeType&&exports,he=ue&&"object"==typeof module&&module&&!module.nodeType&&module,le=he&&he.exports===ue?u.Buffer:void 0;const fe=(le?le.isBuffer:void 0)||ae;var de=9007199254740991,_e=/^(?:0|[1-9]\d*)$/;const pe=function(t,e){var r=typeof t;return!!(e=null==e?de:e)&&("number"==r||"symbol"!=r&&_e.test(t))&&t>-1&&t%1==0&&t<e};var ye=9007199254740991;const ve=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=ye};var be={};be["[object Float32Array]"]=be["[object Float64Array]"]=be["[object Int8Array]"]=be["[object Int16Array]"]=be["[object Int32Array]"]=be["[object Uint8Array]"]=be["[object Uint8ClampedArray]"]=be["[object Uint16Array]"]=be["[object Uint32Array]"]=!0,be["[object Arguments]"]=be["[object Array]"]=be["[object ArrayBuffer]"]=be["[object Boolean]"]=be["[object DataView]"]=be["[object Date]"]=be["[object Error]"]=be["[object Function]"]=be["[object Map]"]=be["[object Number]"]=be["[object Object]"]=be["[object RegExp]"]=be["[object Set]"]=be["[object String]"]=be["[object WeakMap]"]=!1;const ge=function(t){return P(t)&&ve(t.length)&&!!be[A(t)]};const me=function(t){return function(e){return t(e)}};var je="object"==typeof exports&&exports&&!exports.nodeType&&exports,we=je&&"object"==typeof module&&module&&!module.nodeType&&module,Ee=we&&we.exports===je&&c.process;const xe=function(){try{var t=we&&we.require&&we.require("util").types;return t||Ee&&Ee.binding&&Ee.binding("util")}catch(t){}}();var Oe=xe&&xe.isTypedArray;const Ae=Oe?me(Oe):ge;var Pe=Object.prototype.hasOwnProperty;const Se=function(t,e){var r=ce(t),n=!r&&ie(t),o=!r&&!n&&fe(t),s=!r&&!n&&!o&&Ae(t),i=r||n||o||s,c=i?te(t.length,String):[],a=c.length;for(var u in t)!e&&!Pe.call(t,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||pe(u,a))||c.push(u);return c};var Ce=Object.prototype;const Te=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ce)};const Ie=function(t,e){return function(r){return t(e(r))}};const De=Ie(Object.keys,Object);var ze=Object.prototype.hasOwnProperty;const Fe=function(t){if(!Te(t))return De(t);var e=[];for(var r in Object(t))ze.call(t,r)&&"constructor"!=r&&e.push(r);return e};const We=function(t){return null!=t&&ve(t.length)&&!it(t)};const Me=function(t){return We(t)?Se(t):Fe(t)};const Ne=function(t,e){return t&&Zt(e,Me(e),t)};const qe=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e};var Ue=Object.prototype.hasOwnProperty;const Re=function(t){if(!i(t))return qe(t);var e=Te(t),r=[];for(var n in t)("constructor"!=n||!e&&Ue.call(t,n))&&r.push(n);return r};const $e=function(t){return We(t)?Se(t,!0):Re(t)};const Le=function(t,e){return t&&Zt(e,$e(e),t)};var ke="object"==typeof exports&&exports&&!exports.nodeType&&exports,He=ke&&"object"==typeof module&&module&&!module.nodeType&&module,Be=He&&He.exports===ke?u.Buffer:void 0,Qe=Be?Be.allocUnsafe:void 0;const Ve=function(t,e){if(e)return t.slice();var r=t.length,n=Qe?Qe(r):new t.constructor(r);return t.copy(n),n};const Ke=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e};const Ge=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 Ye=function(){return[]};var Je=Object.prototype.propertyIsEnumerable,Xe=Object.getOwnPropertySymbols;const Ze=Xe?function(t){return null==t?[]:(t=Object(t),Ge(Xe(t),(function(e){return Je.call(t,e)})))}:Ye;const tr=function(t,e){return Zt(t,Ze(t),e)};const er=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};const rr=Ie(Object.getPrototypeOf,Object);const nr=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)er(e,Ze(t)),t=rr(t);return e}:Ye;const or=function(t,e){return Zt(t,nr(t),e)};const sr=function(t,e,r){var n=e(t);return ce(t)?n:er(n,r(t))};const ir=function(t){return sr(t,Me,Ze)};const cr=function(t){return sr(t,$e,nr)};const ar=jt(u,"DataView");const ur=jt(u,"Promise");const hr=jt(u,"Set");const lr=jt(u,"WeakMap");var fr="[object Map]",dr="[object Promise]",_r="[object Set]",pr="[object WeakMap]",yr="[object DataView]",vr=ft(ar),br=ft(wt),gr=ft(ur),mr=ft(hr),jr=ft(lr),wr=A;(ar&&wr(new ar(new ArrayBuffer(1)))!=yr||wt&&wr(new wt)!=fr||ur&&wr(ur.resolve())!=dr||hr&&wr(new hr)!=_r||lr&&wr(new lr)!=pr)&&(wr=function(t){var e=A(t),r="[object Object]"==e?t.constructor:void 0,n=r?ft(r):"";if(n)switch(n){case vr:return yr;case br:return fr;case gr:return dr;case mr:return _r;case jr:return pr}return e});const Er=wr;var xr=Object.prototype.hasOwnProperty;const Or=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&xr.call(t,"index")&&(r.index=t.index,r.input=t.input),r};const Ar=u.Uint8Array;const Pr=function(t){var e=new t.constructor(t.byteLength);return new Ar(e).set(new Ar(t)),e};const Sr=function(t,e){var r=e?Pr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)};var Cr=/\w*$/;const Tr=function(t){var e=new t.constructor(t.source,Cr.exec(t));return e.lastIndex=t.lastIndex,e};var Ir=p?p.prototype:void 0,Dr=Ir?Ir.valueOf:void 0;const zr=function(t){return Dr?Object(Dr.call(t)):{}};const Fr=function(t,e){var r=e?Pr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)};var Wr="[object Boolean]",Mr="[object Date]",Nr="[object Map]",qr="[object Number]",Ur="[object RegExp]",Rr="[object Set]",$r="[object String]",Lr="[object Symbol]",kr="[object ArrayBuffer]",Hr="[object DataView]",Br="[object Float32Array]",Qr="[object Float64Array]",Vr="[object Int8Array]",Kr="[object Int16Array]",Gr="[object Int32Array]",Yr="[object Uint8Array]",Jr="[object Uint8ClampedArray]",Xr="[object Uint16Array]",Zr="[object Uint32Array]";const tn=function(t,e,r){var n=t.constructor;switch(e){case kr:return Pr(t);case Wr:case Mr:return new n(+t);case Hr:return Sr(t,r);case Br:case Qr:case Vr:case Kr:case Gr:case Yr:case Jr:case Xr:case Zr:return Fr(t,r);case Nr:return new n;case qr:case $r:return new n(t);case Ur:return Tr(t);case Rr:return new n;case Lr:return zr(t)}};var en=Object.create;const rn=function(){function t(){}return function(e){if(!i(e))return{};if(en)return en(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();const nn=function(t){return"function"!=typeof t.constructor||Te(t)?{}:rn(rr(t))};var on="[object Map]";const sn=function(t){return P(t)&&Er(t)==on};var cn=xe&&xe.isMap;const an=cn?me(cn):sn;var un="[object Set]";const hn=function(t){return P(t)&&Er(t)==un};var ln=xe&&xe.isSet;const fn=ln?me(ln):hn;var dn=1,_n=2,pn=4,yn="[object Arguments]",vn="[object Function]",bn="[object GeneratorFunction]",gn="[object Object]",mn={};mn[yn]=mn["[object Array]"]=mn["[object ArrayBuffer]"]=mn["[object DataView]"]=mn["[object Boolean]"]=mn["[object Date]"]=mn["[object Float32Array]"]=mn["[object Float64Array]"]=mn["[object Int8Array]"]=mn["[object Int16Array]"]=mn["[object Int32Array]"]=mn["[object Map]"]=mn["[object Number]"]=mn[gn]=mn["[object RegExp]"]=mn["[object Set]"]=mn["[object String]"]=mn["[object Symbol]"]=mn["[object Uint8Array]"]=mn["[object Uint8ClampedArray]"]=mn["[object Uint16Array]"]=mn["[object Uint32Array]"]=!0,mn["[object Error]"]=mn[vn]=mn["[object WeakMap]"]=!1;const jn=function t(e,r,n,o,s,c){var a,u=r&dn,h=r&_n,l=r&pn;if(n&&(a=s?n(e,o,s,c):n(e)),void 0!==a)return a;if(!i(e))return e;var f=ce(e);if(f){if(a=Or(e),!u)return Ke(e,a)}else{var d=Er(e),_=d==vn||d==bn;if(fe(e))return Ve(e,u);if(d==gn||d==yn||_&&!s){if(a=h||_?{}:nn(e),!u)return h?or(e,Le(a,e)):tr(e,Ne(a,e))}else{if(!mn[d])return s?e:{};a=tn(e,d,u)}}c||(c=new Vt);var p=c.get(e);if(p)return p;c.set(e,a),fn(e)?e.forEach((function(o){a.add(t(o,r,n,o,e,c))})):an(e)&&e.forEach((function(o,s){a.set(s,t(o,r,n,s,e,c))}));var y=f?void 0:(l?h?cr:ir:h?$e:Me)(e);return Kt(y||e,(function(o,s){y&&(o=e[s=o]),Xt(a,s,t(o,r,n,s,e,c))})),a};var wn=1,En=4;const xn=function(t,e){return jn(t,wn|En,e="function"==typeof e?e:void 0)};var On="[object Object]",An=Function.prototype,Pn=Object.prototype,Sn=An.toString,Cn=Pn.hasOwnProperty,Tn=Sn.call(Object);const In=function(t){if(!P(t)||A(t)!=On)return!1;var e=rr(t);if(null===e)return!0;var r=Cn.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Sn.call(r)==Tn};const Dn=function(t){return P(t)&&1===t.nodeType&&!In(t)};class zn extends r{constructor(t,e={}){super(e),this._editor=null,this._throttledSave=$(this._save.bind(this),"number"==typeof e.saveInterval?e.saveInterval:5e3),t&&(this._creator=(e,r)=>t.create(e,r)),this._destructor=t=>t.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(t){this._creator=t}setDestructor(t){this._destructor=t}_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 s(this._editor,t.context,this._excludedProps)}_cloneEditorConfiguration(t){return xn(t,((t,e)=>Dn(t)||"context"===e?t:void 0))}}const Fn=Symbol("MainQueueId");class Wn extends r{constructor(t,e={}){super(e),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new Mn,this._watchdogConfig=e,this._creator=e=>t.create(e),this._destructor=t=>t.destroy(),this._actionQueues.onEmpty((()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))}))}setCreator(t){this._creator=t}setDestructor(t){this._destructor=t}get context(){return this._context}create(t={}){return this._actionQueues.enqueue(Fn,(()=>(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 zn(null,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=>{const n=()=>{e.off("restart",n),this._fire("itemRestart",{itemId:t.id}),r()};e.on("restart",n)}))))})),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(Fn,(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_restart(){return this._actionQueues.enqueue(Fn,(()=>(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=n(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 s(this._context,t.context)}}class Mn{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(t){this._onEmptyCallbacks.push(t)}enqueue(t,e){const r=t===Fn;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(Fn),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})();
|