PageSourceSearch

https://www.mecalux.de/o/frontend-editor-ckeditor-web/__liferay__/…keditor$ckeditor5-watchdog$dist$index.js.js

js mecalux.de collected 2026-09-25 04:26:15 UTC 17,132 bytes, 10 lines download raw bytes

1function W(t){return t==null||typeof t!="object"&&typeof t!="function"}function R(t){return Object.getOwnPropertySymbols(t).filter(r=>Object.prototype.propertyIsEnumerable.call(t,r))}function B(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}var k="[object RegExp]",y="[object String]",_="[object Number]",b="[object Boolean]",E="[object Arguments]",L="[object Symbol]",T="[object Date]",q="[object Map]",F="[object Set]",M="[object Array]";var U="[object ArrayBuffer]",z="[object Object]";var J="[object DataView]",H="[object Uint8Array]",Q="[object Uint8ClampedArray]",$="[object Uint16Array]",K="[object Uint32Array]";var V="[object Int8Array]",Y="[object Int16Array]",G="[object Int32Array]";var X="[object Float32Array]",Z="[object Float64Array]";function v(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function C(t,r){return u(t,void 0,t,new Map,r)}function u(t,r,e,o=new Map,i=void 0){let a=i?.(t,r,e,o);if(a!=null)return a;if(W(t))return t;if(o.has(t))return o.get(t);if(Array.isArray(t)){let s=new Array(t.length);o.set(t,s);for(let n=0;n<t.length;n++)s[n]=u(t[n],n,e,o,i);return Object.hasOwn(t,"index")&&(s.index=t.index),Object.hasOwn(t,"input")&&(s.input=t.input),s}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){let s=new RegExp(t.source,t.flags);return s.lastIndex=t.lastIndex,s}if(t instanceof Map){let s=new Map;o.set(t,s);for(let[n,f]of t)s.set(n,u(f,n,e,o,i));return s}if(t instanceof Set){let s=new Set;o.set(t,s);for(let n of t)s.add(u(n,void 0,e,o,i));return s}if(typeof Buffer<"u"&&Buffer.isBuffer(t))return t.subarray();if(v(t)){let s=new(Object.getPrototypeOf(t)).constructor(t.length);o.set(t,s);for(let n=0;n<t.length;n++)s[n]=u(t[n],n,e,o,i);return s}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){let s=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return o.set(t,s),h(s,t,e,o,i),s}if(typeof File<"u"&&t instanceof File){let s=new File([t],t.name,{type:t.type});return o.set(t,s),h(s,t,e,o,i),s}if(t instanceof Blob){let s=new Blob([t],{type:t.type});return o.set(t,s),h(s,t,e,o,i),s}if(t instanceof Error){let s=new t.constructor;return o.set(t,s),s.message=t.message,s.name=t.name,s.stack=t.stack,s.cause=t.cause,h(s,t,e,o,i),s}if(typeof t=="object"&&ct(t)){let s=Object.create(Object.getPrototypeOf(t));return o.set(t,s),h(s,t,e,o,i),s}return t}function h(t,r,e=t,o,i){let a=[...Object.keys(r),...R(r)];for(let s=0;s<a.length;s++){let n=a[s],f=Object.getOwnPropertyDescriptor(t,n);(f==null||f.writable)&&(t[n]=u(r[n],n,e,o,i))}}function ct(t){switch(B(t)){case E:case M:case U:case J:case b:case T:case X:case Z:case V:case Y:case G:case q:case _:case z:case k:case F:case y:case L:case H:case Q:case $:case K:return!0;default:return!1}}function P(t,r){return C(t,(e,o,i,a)=>{let s=r?.(e,o,i,a);if(s!=null)return s;if(typeof t=="object")switch(Object.prototype.toString.call(t)){case _:case y:case b:{let n=new t.constructor(t?.valueOf());return h(n,t),n}case E:{let n={};return h(n,t),n.length=t.length,n[Symbol.iterator]=t[Symbol.iterator],n}default:return}})}function tt(t){return typeof t=="object"&&t!==null}function rt(t,r,{signal:e,edges:o}={}){let i,a=null,s=o!=null&&o.includes("leading"),n=o==null||o.includes("trailing"),f=()=>{a!==null&&(t.apply(i,a),i=void 0,a=null)},m=()=>{n&&f(),O()},c=null,d=()=>{c!=null&&clearTimeout(c),c=setTimeout(()=>{c=null,m()},r)},p=()=>{c!==null&&(clearTimeout(c),c=null)},O=()=>{p(),i=void 0,a=null},nt=()=>{p(),f()},g=function(...at){if(e?.aborted)return;i=this,a=at;let ft=c==null;d(),s&&ft&&f()};return g.schedule=d,g.cancel=O,g.flush=nt,e?.addEventListener("abort",O,{once:!0}),g}function et(t,r=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=rt(function(...p){n=t.apply(this,p),f=null},r,{edges:s}),c=function(...p){return a!=null&&(f===null&&(f=Date.now()),Date.now()-f>=a)?(n=t.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(t,r=0,e={}){typeof e!="object"&&(e={});let{leading:o=!0,trailing:i=!0}=e;return et(t,r,{leading:o,trailing:i,maxWait:r})}function ot(t){if(typeof t!="object"||t==null)return!1;if(Object.getPrototypeOf(t)===null)return!0;
1if(Object.prototype.toString.call(t)!=="[object Object]"){let e=t[Symbol.toStringTag];return e==null||!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable?!1:t.toString()===`[object ${e}]`}let r=t;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(t)===r}function w(t){return tt(t)&&t.nodeType===1&&!ot(t)}var l=class{crashes=[];state="initializing";_crashNumberLimit;_now=Date.now;_minimumNonErrorTimePeriod;_boundErrorHandler;_listeners;constructor(r){if(this.crashes=[],this._crashNumberLimit=typeof r.crashNumberLimit=="number"?r.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof r.minimumNonErrorTimePeriod=="number"?r.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(r,e){this._listeners[r]||(this._listeners[r]=[]),this._listeners[r].push(e)}off(r,e){this._listeners[r]=this._listeners[r].filter(o=>o!==e)}_fire(r,...e){let o=this._listeners[r]||[];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(r,e){if(this._shouldReactToError(r)){this.crashes.push({message:r.message,stack:r.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:r,causesRestart:o}),o?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(r){return r.is&&r.is("CKEditorError")&&r.context!==void 0&&r.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(r)}_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;let r=this.crashes[this.crashes.length-1].date,e=this.crashes[this.crashes.length-1-this._crashNumberLimit].date;return(r-e)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}};function j(t,r=new Set){let e=[t],o=new Set,i=0;for(;e.length>i;){let a=e[i++];if(!(o.has(a)||!mt(a)||r.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 mt(t){let r=Object.prototype.toString.call(t),e=typeof t;return!(e==="number"||e==="boolean"||e==="string"||e==="symbol"||e==="function"||r==="[object Date]"||r==="[object RegExp]"||r==="[object Module]"||t===void 0||t===null||t._watchdogExcluded||t instanceof EventTarget||t instanceof Event)}function it(t,r,e=new Set){if(t===r&&pt(t))return!0;let o=j(t,e),i=j(r,e);for(let a of o)if(i.has(a))return!0;return!1}function pt(t){return typeof t=="object"&&t!==null}var A=class extends l{_editor=null;_lifecyclePromise=null;_throttledSave;_data;_lastDocumentVersion;_elementOrData;_initUsingData=!0;_editables={};_config;_excludedProps;constructor(r,e={}){super(e),this._throttledSave=S(this._save.bind(this),typeof e.saveInterval=="number"?e.saveInterval:5e3),r&&(this._creator=(o,i)=>r.create(o,i)),this._destructor=o=>o.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(r){this._creator=r}setDestructor(r){this._destructor=r}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(r=>{console.error("An error happened during the editor destroying.",r)}).then(()=>{let r={},e=[],o=this._config.rootsAttributes||{},i={};for(let[s,n]of Object.entries(this._data.roots))n.isLoaded?(r[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(r,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(r=this._elementOrData,e=this._config,o){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>(super._startErrorHandling(),this._elementOrData=r,this._initUsingData=typeof r=="string"||Object.keys(r).length>0&&typeof Object.values(r)[0]=="string",this._config=this._cloneEditorConfiguration(e)||{},this._config.context=o,this._creator(r,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 r=this._editor;return this._editor=null,r.model.document.off("change:data",this._throttledSave),this._destructor(r)})}_save(){let r=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=r}catch(e){console.error(e,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(r){this._excludedProps=r}_getData(){let r=this._editor,e=r.model.document.roots.filter(n=>n.isAttached()&&n.rootName!="$graveyard"),{plugins:o}=r,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 r.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 r={};for(let e of this.editor.model.document.getRootNames()){let o=this.editor.ui.getEditableElement(e);o&&(r[e]=o)}return r}_isErrorComingFromThisItem(r){return it(this._editor,r.context,this._excludedProps)}_cloneEditorConfiguration(r){return P(r,(e,o)=>{if(w(e)||o==="context")return e})}},D=class{editor;_data;constructor(r){this.editor=r,this._data=r.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",r=>{r.stop(),this.editor.model.enqueueChange({isUndoable:!1},e=>{this._restoreCollaborationData(),this._restoreEditorData(e)}),this.editor.data.fire("ready")},{priority:999})}_createNode(r,e){if("name"in e){let o=r.createElement(e.name,e.attributes);if(e.children)for(let i of e.children)o._appendChild(this._createNode(r,i));return o}else return r.createText(e.data,e.attributes)}_restoreEditorData(r){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)r.setAttribute(m,c,f);for(let m of s){let c=this._createNode(r,m);r.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=r.createPositionFromPath(m,s.path,s.stickiness),d=r.createPositionFromPath(m,n.path,n.stickiness),p=r.createRange(c,d);r.addMarker(o,{range:p,...f})})}_restoreCollaborationData(){let r=JSON.parse(this._data.commentThreads),e=JSON.parse(this._data.suggestions);r.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(r,e={}){super(e),this._watchdogConfig=e,this._creator=o=>r.create(o),this._destructor=o=>o.destroy(),this._actionQueues.onEmpty(()=>{this.state==="initializing"&&(this.state="ready",this._fire("stateChange"))})}setCreator(r){this._creator=r}setDestructor(r){this._destructor=r}get context(){return this._context}create(r={}){return this._actionQueues.enqueue(x,()=>(this._contextConfig=r,this._create()))}getItem(r){return this._getWatchdog(r)._item}getItemState(r){return this._getWatchdog(r).state}add(r){let e=st(r);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(r){let e=st(r);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(r=>{console.error("An error happened during destroying the context or items.",r)}).then(()=>this._create()).then(()=>this._fire("restart"))))}_create(){return Promise.resolve().then(()=>(this._startErrorHandling(),this._creator(this._contextConfig))).then(r=>(this._context=r,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 r=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(e=>e.destroy())).then(()=>this._destructor(r))})}_getWatchdog(r){let e=this._watchdogs.get(r);if(!e)throw new Error(`Item with the given id was not registered: ${r}.`);return e}_isErrorComingFromThisItem(r){for(let e of this._watchdogs.values())if(e._isErrorComingFromThisItem(r))return!1;return it(this._context,r.context)}},N=class{_onEmptyCallbacks=[];_queues=new Map;_activeActions=0;onEmpty(r){this._onEmptyCallbacks.push(r)}enqueue(r,e){let o=r===x;this._activeActions++,this._queues.get(r)||this._queues.set(r,Promise.resolve());let a=(o?Promise.all(this._queues.values()):Promise.all([this._queues.get(x),this._queues.get(r)])).then(e),s=a.catch(()=>{});return this._queues.set(r,s),a.finally(()=>{this._activeActions--,this._queues.get(r)===s&&this._activeActions===0&&this._onEmptyCallbacks.forEach(n=>n())})}};function st(t){return Array.isArray(t)?t:[t]}export{I as ContextWatchdog,A as EditorWatchdog,l as Watchdog};
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.(QA45D4CV).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.