/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
import{createClass as e,classCallCheck as r,defineProperty as t}from"../_virtual/_rollupPluginBabelHelpers.js";import{throttle as n}from"../utils/util.js";import{PLATER_ID as s}from"../constant.js";var i=/* @__PURE__ */function(){function i(){var e=this;if(r(this,i),t(this,"__trigger",function(r){var t=/* @__PURE__ */(new Date).getTime();e.timeStamp=t;for(var n=0;n<r.length;n++)e.__runHandler(r[n].target)}),this.__handlers=[],this.timeStamp=0,this.observer=null,window.ResizeObserver)try{this.observer=new window.ResizeObserver(n(this.__trigger,100,{trailing:!0})),this.timeStamp=/* @__PURE__ */(new Date).getTime()}catch(s){console.error(s)}}return e(i,[{key:"addObserver",value:function(e,r){if(this.observer){this.observer.observe(e);for(var t=e.getAttribute(s),n=this.__handlers,i=-1,a=0;a<n.length;a++)n[a]&&e===n[a].target&&(i=a);i>-1?this.__handlers[i].handler=r:this.__handlers.push({target:e,handler:r,playerId:t})}}},{key:"unObserver",value:function(e){var r=-1;this.__handlers.map(function(t,n){e===t.target&&(r=n)});try{var t;null===(t=this.observer)||void 0===t||t.unobserve(e)}catch(n){}r>-1&&this.__handlers.splice(r,1)}},{key:"destroyObserver",value:function(){var e;null===(e=this.observer)||void 0===e||e.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var r=this.__handlers,t=0;t<r.length;t++)if(r[t]&&e===r[t].target){try{r[t].handler(e)}catch(n){console.error(n)}return!0}return!1}}]),i}(),a=null;function l(e,r){return a||(a=new i),a.addObserver(e,r),a}function o(e,r){var t;null===(t=a)||void 0===t||t.unObserver(e,r)}export{l as addObserver,o as unObserver};