PageSourceSearch

https://www.petrosoftdesign.com/o/frontend-editor-ckeditor-web/__l…keditor$ckeditor5-watchdog$dist$index.js.js

js petrosoftdesign.com collected 2026-10-05 01:12:51 UTC 17,381 bytes, 10 lines download raw bytes

1var mt=Object.defineProperty;var pt=(r,t)=>{for(var e in t)mt(r,e,{get:t[e],enumerable:!0})};var W={};pt(W,{ContextWatchdog:()=>I,EditorWatchdog:()=>A,Watchdog:()=>l});function R(r){return r==null||typeof r!="object"&&typeof r!="function"}function B(r){return Object.getOwnPropertySymbols(r).filter(t=>Object.prototype.propertyIsEnumerable.call(r,t))}function k(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}var L="[object RegExp]",y="[object String]",_="[object Number]",b="[object Boolean]",E="[object Arguments]",T="[object Symbol]",M="[object Date]",q="[object Map]",F="[object Set]",U="[object Array]";var z="[object ArrayBuffer]",J="[object Object]";var H="[object DataView]",Q="[object Uint8Array]",$="[object Uint8ClampedArray]",K="[object Uint16Array]",V="[object Uint32Array]";var Y="[object Int8Array]",G="[object Int16Array]",X="[object Int32Array]";var Z="[object Float32Array]",v="[object Float64Array]";function C(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function tt(r,t){return u(r,void 0,r,new Map,t)}function u(r,t,e,o=new Map,i=void 0){let a=i?.(r,t,e,o);if(a!=null)return a;
1if(R(r))return r;if(o.has(r))return o.get(r);if(Array.isArray(r)){let s=new Array(r.length);o.set(r,s);for(let n=0;n<r.length;n++)s[n]=u(r[n],n,e,o,i);return Object.hasOwn(r,"index")&&(s.index=r.index),Object.hasOwn(r,"input")&&(s.input=r.input),s}if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp){let s=new RegExp(r.source,r.flags);return s.lastIndex=r.lastIndex,s}if(r instanceof Map){let s=new Map;o.set(r,s);for(let[n,f]of r)s.set(n,u(f,n,e,o,i));return s}if(r instanceof Set){let s=new Set;o.set(r,s);for(let n of r)s.add(u(n,void 0,e,o,i));return s}if(typeof Buffer<"u"&&Buffer.isBuffer(r))return r.subarray();if(C(r)){let s=new(Object.getPrototypeOf(r)).constructor(r.length);o.set(r,s);for(let n=0;n<r.length;n++)s[n]=u(r[n],n,e,o,i);return s}if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer)return r.slice(0);if(r instanceof DataView){let s=new DataView(r.buffer.slice(0),r.byteOffset,r.byteLength);return o.set(r,s),h(s,r,e,o,i),s}if(typeof File<"u"&&r instanceof File){let s=new File([r],r.name,{type:r.type});return o.set(r,s),h(s,r,e,o,i),s}if(r instanceof Blob){let s=new Blob([r],{type:r.type});return o.set(r,s),h(s,r,e,o,i),s}if(r instanceof Error){let s=new r.constructor;return o.set(r,s),s.message=r.message,s.name=r.name,s.stack=r.stack,s.cause=r.cause,h(s,r,e,o,i),s}if(typeof r=="object"&&ht(r)){let s=Object.create(Object.getPrototypeOf(r));return o.set(r,s),h(s,r,e,o,i),s}return r}function h(r,t,e=r,o,i){let a=[...Object.keys(t),...B(t)];for(let s=0;s<a.length;s++){let n=a[s],f=Object.getOwnPropertyDescriptor(r,n);(f==null||f.writable)&&(r[n]=u(t[n],n,e,o,i))}}function ht(r){switch(k(r)){case E:case U:case z:case H:case b:case M:case Z:case v:case Y:case G:case X:case q:case _:case J:case L:case F:case y:case T:case Q:case $:case K:case V:return!0;default:return!1}}function P(r,t){return tt(r,(e,o,i,a)=>{let s=t?.(e,o,i,a);if(s!=null)return s;if(typeof r=="object")switch(Object.prototype.toString.call(r)){case _:case y:case b:{let n=new r.constructor(r?.valueOf());return h(n,r),n}case E:{let n={};return h(n,r),n.length=r.length,n[Symbol.iterator]=r[Symbol.iterator],n}default:return}})}function rt(r){return typeof r=="object"&&r!==null}function et(r,t,{signal:e,edges:o}={}){let i,a=null,s=o!=null&&o.includes("leading"),n=o==null||o.includes("trailing"),f=()=>{a!==null&&(r.apply(i,a),i=void 0,a=null)},m=()=>{n&&f(),O()},c=null,d=()=>{c!=null&&clearTimeout(c),c=setTimeout(()=>{c=null,m()},t)},p=()=>{c!==null&&(clearTimeout(c),c=null)},O=()=>{p(),i=void 0,a=null},at=()=>{p(),f()},g=function(...ft){if(e?.aborted)return;i=this,a=ft;let ct=c==null;d(),s&&ct&&f()};return g.schedule=d,g.cancel=O,g.flush=at,e?.addEventListener("abort",O,{once:!0}),g}function ot(r,t=0,e={}){typeof e!="object"&&(e={});let{leading:o=!1,trailing:i=!0,maxWait:a}=e,s=Array(2);o&&(s[0]="leading"),i&&(s[1]="trailing");let n,f=null,m=et(function(...p){n=r.apply(this,p),f=null},t,{edges:s}),c=function(...p){return a!=null&&(f===null&&(f=Date.now()),Date.now()-f>=a)?(n=r.apply(this,p),f=Date.now(),m.cancel(),m.schedule(),n):(m.apply(this,p),n)},d=()=>(m.flush(),n);return c.cancel=m.cancel,c.flush=d,c}function S(r,t=0,e={}){typeof e!="object"&&(e={});let{leading:o=!0,trailing:i=!0}=e;return ot(r,t,{leading:o,trailing:i,maxWait:t})}function st(r){if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){let e=r[Symbol.toStringTag];return e==null||!Object.getOwnPropertyDescriptor(r,Symbol.toStringTag)?.writable?!1:r.toString()===`[object ${e}]`}let t=r;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function w(r){return rt(r)&&r.nodeType===1&&!st(r)}var l=class{crashes=[];state="initializing";_crashNumberLimit;_now=Date.now;_minimumNonErrorTimePeriod;_boundErrorHandler;_listeners;constructor(t){if(this.crashes=[],this._crashNumberLimit=typeof t.crashNumberLimit=="number"?t.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof t.minimumNonErrorTimePeriod=="number"?t.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=e=>{let o="error"in e?e.error:e.reason;o instanceof Error&&this._handleError(o,e)},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(o=>o!==e)}_fire(t,...e){let o=this._listeners[t]||[];for(let i of o)i.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()});let o=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:t,causesRestart:o}),o?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(t){return t.is&&t.is("CKEditorError")&&t.context!==void 0&&t.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(t)}
1_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;let t=this.crashes[this.crashes.length-1].date,e=this.crashes[this.crashes.length-1-this._crashNumberLimit].date;return(t-e)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}};function j(r,t=new Set){let e=[r],o=new Set,i=0;for(;e.length>i;){let a=e[i++];if(!(o.has(a)||!dt(a)||t.has(a)))if(o.add(a),Symbol.iterator in a)try{for(let s of a)e.push(s)}catch{}else for(let s in a)s!=="defaultValue"&&e.push(a[s])}return o}function dt(r){let t=Object.prototype.toString.call(r),e=typeof r;return!(e==="number"||e==="boolean"||e==="string"||e==="symbol"||e==="function"||t==="[object Date]"||t==="[object RegExp]"||t==="[object Module]"||r===void 0||r===null||r._watchdogExcluded||r instanceof EventTarget||r instanceof Event)}function nt(r,t,e=new Set){if(r===t&&ut(r))return!0;let o=j(r,e),i=j(t,e);for(let a of o)if(i.has(a))return!0;return!1}function ut(r){return typeof r=="object"&&r!==null}var A=class extends l{_editor=null;_lifecyclePromise=null;_throttledSave;_data;_lastDocumentVersion;_elementOrData;_initUsingData=!0;_editables={};_config;_excludedProps;constructor(t,e={}){super(e),this._throttledSave=S(this._save.bind(this),typeof e.saveInterval=="number"?e.saveInterval:5e3),t&&(this._creator=(o,i)=>t.create(o,i)),this._destructor=o=>o.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(()=>{let t={},e=[],o=this._config.rootsAttributes||{},i={};for(let[s,n]of Object.entries(this._data.roots))n.isLoaded?(t[s]="",i[s]=o[s]||{}):e.push(s);let a={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:e,rootsAttributes:i,_watchdogInitialData:this._data};return delete a.initialData,a.extraPlugins.push(D),this._initUsingData?this.create(t,a,a.context):w(this._elementOrData)?this.create(this._elementOrData,a,a.context):this.create(this._editables,a,a.context)}).then(()=>{this._fire("restart")})}create(t=this._elementOrData,e=this._config,o){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(super._startErrorHandling(),this._elementOrData=t,this._initUsingData=typeof t=="string"||Object.keys(t).length>0&&typeof Object.values(t)[0]=="string",this._config=this._cloneEditorConfiguration(e)||{},this._config.context=o,this._creator(t,this._config))).then(i=>{this._editor=i,i.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=i.model.document.version,this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")}).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}destroy(){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())).finally(()=>{this._lifecyclePromise=null}),this._lifecyclePromise}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.cancel();let t=this._editor;return this._editor=null,t.model.document.off("change:data",this._throttledSave),this._destructor(t)})}_save(){let t=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=t}catch(e){console.error(e,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(t){this._excludedProps=t}_getData(){let t=this._editor,e=t.model.document.roots.filter(n=>n.isAttached()&&n.rootName!="$graveyard"),{plugins:o}=t,i=o.has("CommentsRepository")&&o.get("CommentsRepository"),a=o.has("TrackChanges")&&o.get("TrackChanges"),s={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};e.forEach(n=>{s.roots[n.rootName]={content:JSON.stringify(Array.from(n.getChildren())),attributes:JSON.stringify(Array.from(n.getAttributes())),isLoaded:n._isLoaded}});for(let n of t.model.markers)n._affectsData&&(s.markers[n.name]={rangeJSON:n.getRange().toJSON(),usingOperation:n._managedUsingOperations,affectsData:n._affectsData});return i&&(s.commentThreads=JSON.stringify(i.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),a&&(s.suggestions=JSON.stringify(a.getSuggestions({toJSON:!0,skipNotAttached:!0}))),s}_getEditables(){let t={};for(let e of this.editor.model.document.getRootNames()){let o=this.editor.ui.getEditableElement(e);o&&(t[e]=o)}return t}_isErrorComingFromThisItem(t){return nt(this._editor,t.context,this._excludedProps)}_cloneEditorConfiguration(t){return P(t,(e,o)=>{if(w(e)||o==="context")return e})}},D=class{editor;_data;constructor(t){this.editor=t,this._data=t.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",t=>{t.stop(),this.editor.model.enqueueChange({isUndoable:!1},e=>{this._restoreCollaborationData(),this._restoreEditorData(e)}),this.editor.data.fire("ready")},{priority:999})}_createNode(t,e){if("name"in e){let o=t.createElement(e.name,e.attributes);if(e.children)for(let i of e.children)o._appendChild(this._createNode(t,i));return o}else return t.createText(e.data,e.attributes)}_restoreEditorData(t){let e=this.editor;
1Object.entries(this._data.roots).forEach(([o,{content:i,attributes:a}])=>{let s=JSON.parse(i),n=JSON.parse(a),f=e.model.document.getRoot(o);for(let[m,c]of n)t.setAttribute(m,c,f);for(let m of s){let c=this._createNode(t,m);t.insert(c,f,"end")}}),Object.entries(this._data.markers).forEach(([o,i])=>{let{document:a}=e.model,{rangeJSON:{start:s,end:n},...f}=i,m=a.getRoot(s.root),c=t.createPositionFromPath(m,s.path,s.stickiness),d=t.createPositionFromPath(m,n.path,n.stickiness),p=t.createRange(c,d);t.addMarker(o,{range:p,...f})})}_restoreCollaborationData(){let t=JSON.parse(this._data.commentThreads),e=JSON.parse(this._data.suggestions);t.forEach(o=>{let i=this.editor.config.get("collaboration.channelId"),a=this.editor.plugins.get("CommentsRepository");a.hasCommentThread(o.threadId)&&a.getCommentThread(o.threadId).remove(),a.addCommentThread({channelId:i,...o})}),e.forEach(o=>{let i=this.editor.plugins.get("TrackChangesEditing");if(i.hasSuggestion(o.id)){let a=i.getSuggestion(o.id);a.attributes=o.attributes}else i.addSuggestionData(o)})}},x=Symbol("MainQueueId"),I=class extends l{_watchdogs=new Map;_watchdogConfig;_context=null;_contextProps=new Set;_actionQueues=new N;_contextConfig;_item;constructor(t,e={}){super(e),this._watchdogConfig=e,this._creator=o=>t.create(o),this._destructor=o=>o.destroy(),this._actionQueues.onEmpty(()=>{this.state==="initializing"&&(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(x,()=>(this._contextConfig=t,this._create()))}getItem(t){return this._getWatchdog(t)._item}getItemState(t){return this._getWatchdog(t).state}add(t){let e=it(t);return Promise.all(e.map(o=>this._actionQueues.enqueue(o.id,()=>{if(this.state==="destroyed")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 i;if(this._watchdogs.has(o.id))throw new Error(`Item with the given id is already added: '${o.id}'.`);if(o.type==="editor")return i=new A(null,this._watchdogConfig),i.setCreator(o.creator),i._setExcludedProperties(this._contextProps),o.destructor&&i.setDestructor(o.destructor),this._watchdogs.set(o.id,i),i.on("error",(a,{error:s,causesRestart:n})=>{this._fire("itemError",{itemId:o.id,error:s}),n&&this._actionQueues.enqueue(o.id,()=>new Promise(f=>{let m=()=>{i.off("restart",m),this._fire("itemRestart",{itemId:o.id}),f()};i.on("restart",m)}))}),i.create(o.sourceElementOrData,o.config,this._context);throw new Error(`Not supported item type: '${o.type}'.`)})))}remove(t){let e=it(t);return Promise.all(e.map(o=>this._actionQueues.enqueue(o,()=>{let i=this._getWatchdog(o);return this._watchdogs.delete(o),i.destroy()})))}destroy(){return this._actionQueues.enqueue(x,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(x,()=>(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=j(this._context),Promise.all(Array.from(this._watchdogs.values()).map(e=>(e._setExcludedProperties(this._contextProps),e.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();let t=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(e=>e.destroy())).then(()=>this._destructor(t))})}_getWatchdog(t){let e=this._watchdogs.get(t);if(!e)throw new Error(`Item with the given id was not registered: ${t}.`);return e}_isErrorComingFromThisItem(t){for(let e of this._watchdogs.values())if(e._isErrorComingFromThisItem(t))return!1;return nt(this._context,t.context)}},N=class{_onEmptyCallbacks=[];_queues=new Map;_activeActions=0;onEmpty(t){this._onEmptyCallbacks.push(t)}enqueue(t,e){let o=t===x;this._activeActions++,this._queues.get(t)||this._queues.set(t,Promise.resolve());let a=(o?Promise.all(this._queues.values()):Promise.all([this._queues.get(x),this._queues.get(t)])).then(e),s=a.catch(()=>{});return this._queues.set(t,s),a.finally(()=>{this._activeActions--,this._queues.get(t)===s&&this._activeActions===0&&this._onEmptyCallbacks.forEach(n=>n())})}};function it(r){return Array.isArray(r)?r:[r]}
1var{ContextWatchdog:$t,EditorWatchdog:Kt,Watchdog:Vt,__esModule:Yt}=W;export{$t as ContextWatchdog,Kt as EditorWatchdog,Vt as Watchdog,Yt as __esModule};
2/*! Bundled license information:
3
4@ckeditor/ckeditor5-watchdog/dist/index.js:
5  (**
6   * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
7   * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8   *)
9*/
10//# sourceMappingURL=@ckeditor$ckeditor5-watchdog$dist$index.js.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.