/*!
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{toConsumableArray as o}from"../_virtual/_rollupPluginBabelHelpers.js";function t(o,t,n){for(var r=arguments.length,a=new Array(r>3?r-3:0),e=3;e<r;e++)a[e-3]=arguments[e];var c=t.call.apply(t,[o].concat(a));n&&"function"==typeof n&&(c&&c.then?c.then(function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];n.call.apply(n,[o].concat(r))}):n.call.apply(n,[o].concat(a)))}function n(n,r){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[n]&&(this.__hooks[n]=null),function(){var e=arguments,c=this;if(a.pre)try{var i;(i=a.pre).call.apply(i,[this].concat(Array.prototype.slice.call(arguments)))}catch(s){throw s.message="[pluginName: ".concat(this.pluginName,":").concat(n,":pre error] >> ").concat(s.message),s}if(this.__hooks&&this.__hooks[n])try{var l=h.apply(void 0,[this,n,r].concat(Array.prototype.slice.call(arguments)));l?l.then?l.then(function(n){!1!==n&&t.apply(void 0,[c,r,a.next].concat(o(e)))}).catch(function(o){throw o}):t.apply(void 0,[this,r,a.next].concat(Array.prototype.slice.call(arguments))):void 0===l&&t.apply(void 0,[this,r,a.next].concat(Array.prototype.slice.call(arguments)))}catch(s){throw s.message="[pluginName: ".concat(this.pluginName,":").concat(n,"] >> ").concat(s.message),s}else t.apply(void 0,[this,r,a.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function r(o,t){var n=this.__hooks;if(!n||!Array.isArray(n[o]))return-1;for(var r=n[o],a=0;a<r.length;a++)if(r[a]===t)return a;return-1}function a(o,t){var n=this.__hooks;if(n)return n.hasOwnProperty(o)?(Array.isArray(n[o])||(n[o]=[]),-1===r.call(this,o,t)&&n[o].push(t),!0):(console.warn("has no supported hook which name [".concat(o,"]")),!1)}function e(o,t){var n=this.__hooks;if(n)if(Array.isArray(n[o])){var a=n[o],e=r.call(this,o,t);-1!==e&&a.splice(e,1)}else n[o]&&(n[o]=null)}function c(o){if(this.plugins&&this.plugins[o.toLowerCase()]){for(var t=this.plugins[o.toLowerCase()],n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return t.useHooks&&t.useHooks.apply(t,r)}}function i(o){if(this.plugins&&this.plugins[o.toLowerCase()]){var t=this.plugins[o.toLowerCase()];if(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return t.removeHooks&&t.removeHooks.apply(t,r)}}}function l(o){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];o.__hooks={},t&&t.map(function(t){o.__hooks[t]=null}),Object.defineProperty(o,"hooks",{get:function(){return o.__hooks&&Object.keys(o.__hooks).map(function(t){if(o.__hooks[t])return t})}})}function s(o){o.__hooks=null}function h(o,t,n){for(var r=arguments.length,a=new Array(r>3?r-3:0),e=3;e<r;e++)a[e-3]=arguments[e];if(o.__hooks&&Array.isArray(o.__hooks[t])){var c=o.__hooks[t],i=-1;return function o(t,n,r){for(var a=arguments.length,e=new Array(a>3?a-3:0),l=3;l<a;l++)e[l-3]=arguments[l];if(i++,0===c.length||i===c.length)return r.call.apply(r,[t,t].concat(e));var s=c[i],h=s.call.apply(s,[t,t].concat(e));return h&&h.then?h.then(function(a){return!1===a?null:o.apply(void 0,[t,n,r].concat(e))}).catch(function(o){console.warn("[runHooks]".concat(n," reject"),o.message)}):!1!==h?o.apply(void 0,[t,n,r].concat(e)):!1!==h&&void 0}.apply(void 0,[o,t,n].concat(a))}return n.call.apply(n,[o,o].concat(a))}export{l as default,s as delHooksDescriptor,n as hook,e as removeHooks,i as removePluginHooks,h as runHooks,a as useHooks,c as usePluginHooks};