import "../styles/reset.css";
import "./virtual-render.less";
import { PropTypes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__, resolveClassName as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_resolveClassName__, withInstall as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstall__ } from "../shared";
import { computed as __WEBPACK_EXTERNAL_MODULE_vue_computed__, defineComponent as __WEBPACK_EXTERNAL_MODULE_vue_defineComponent__, h as __WEBPACK_EXTERNAL_MODULE_vue_h__, nextTick as __WEBPACK_EXTERNAL_MODULE_vue_nextTick__, onMounted as __WEBPACK_EXTERNAL_MODULE_vue_onMounted__, onUnmounted as __WEBPACK_EXTERNAL_MODULE_vue_onUnmounted__, reactive as __WEBPACK_EXTERNAL_MODULE_vue_reactive__, ref as __WEBPACK_EXTERNAL_MODULE_vue_ref__, watch as __WEBPACK_EXTERNAL_MODULE_vue_watch__ } from "vue";
import { usePrefix as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__ } from "../config-provider";
import { default as __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a_default__ } from "lodash/throttle";

;// external "../shared"

;// ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}

;// ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js

function _arrayWithoutHoles(r) {
  if (Array.isArray(r)) return _arrayLikeToArray(r);
}

;// ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
function _iterableToArray(r) {
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}

;// ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js

function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

;// ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

;// ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js




function _toConsumableArray(r) {
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}

;// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

;// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

;// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js


function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

;// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

;// external "vue"

;// external "../config-provider"

;// ../../packages/virtual-render/src/props.ts

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

var EventProps = {
  onContentScroll: Function
};
var virtualRenderProps = _objectSpread({
  /** 传入原始数据源 */
  list: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.array.def([]),
  /**
   * 是否启用此功能
   * 如果设置为false，则此组件只会渲染两层指定的 容器，默认渲染两层 div
   * 设置为true才会启用所有的虚拟渲染 & 滚动相关计算
   * 此属性设置为了兼容需要按需开启\关闭虚拟渲染场景，避免外层设计两套样式架构
   * Note: 目前此属性不支持动态修改
   */
  enabled: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
  /**
   * 是否启用内置的Scroll Listener
   * 当启用虚拟滚动时（enabled = true），滚动监听为内置生效
   * 只有当（enabled = false)时此配置项才生效
   */
  scrollEvent: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(false),
  /**
   * 每行数据高度
   * 默认为数值类型，默认高度 30px
   * 如果每行高度不一致，可为回调函数：(index: number, row: any[]): number => {}
   * 函数参数为当前行index & 当前行数据 row，row为数组，当不分组时，为当前行item
   * 如果有分组展示， index 为当前分组 index， row为数组，当前行分组所有 item 数据
   */
  lineHeight: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.oneOfType([__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number, __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.func]).def(30),
  /** 整体最小高度 */
  minHeight: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(30),
  /** 整体最大高度 */
  maxHeight: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.oneOfType([__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number, __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string]),
  /**
   * 整体高度
   * 可设置具体值，如果设置为 100%，则组件会自动计算外层DOM元素offsetHeight，用于计算可渲染行数
   */
  height: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.oneOfType([__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def('100%'), __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number]).def('100%'),
  /**
   * 渲染区域宽度
   * 如果设置 100% 则自适应外层元素宽度
   */
  width: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.oneOfType([__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def('100%'), __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number]).def('100%'),
  /** 最外层元素ClassName */
  className: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.oneOfType([__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.arrayOf(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string), __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.object, __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.arrayOf(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.object), __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string]).def(''),
  /** 内层层元素ClassName */
  contentClassName: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.oneOfType([__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.arrayOf(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string), __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.object, __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.arrayOf(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.object), __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string]).def(''),
  /** 内层元素样式 */
  contentStyle: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.object.def({}),
  /** 用于自定义X轴滚动条样式 */
  scrollXName: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_resolveClassName__('F-scroll-x')),
  /** 用于自定义Y轴滚动条样式 */
  scrollYName: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_resolveClassName__('F-scroll-y')),
  /** 分组展示，一行数据可能有多条数据 */
  groupItemCount: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(1),
  /** 预加载行数，避免空白渲染 */
  preloadItemCount: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(1),
  /** 外层Dom元素需要渲染成的目标元素 */
  renderAs: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def('div'),
  /** top 滚动填充 */
  scrollOffsetTop: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(0),
  /**
   * 内置滚动位置
   * 可选：container （最外层容器），content（内容层容器）
   * Note: container 慎选，需要自己处理样式 & 位置
   */
  scrollPosition: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def('content'),
  /**
   * 绝对高度 | 实际高估
   * 可选值： auto(根据行高和行数计算, LineHeight * List.length) number(外层给定高度，若为0，则不显示)
   */
  abosuteHeight: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.oneOfType([__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def('auto'), __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number]).def('auto'),
  /**
   * 滚动刷新计算间隔时间
   * 默认60 ms
   */
  throttleDelay: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(60),
  rowKey: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def(undefined),
  /**
   * 数据改变时是否保持之前的状态
   * 保持滚动条位置、当前渲染区间
   */
  keepAlive: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(false),
  /**
   * 数据监听改变时，是否自动重置位置到[0, 0]
   */
  autoReset: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
  wrapperStyle: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.any.def({}),
  /**
   * 传入数据如果没有设置rowKey，是否自动生成$index作为唯一ID
   * $index的值默认为index
   */
  autoIndex: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true)
}, EventProps);
;// ../../packages/virtual-render/src/use-fix-top.tsx
/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */
/* harmony default export */ const use_fix_top = (function (props, scrollTo) {
  /**
   * 指定元素滚动到顶部
   * @param param0
   */
  var fixToTop = function fixToTop(params) {
    var id = params.id,
      index = params.index,
      item = params.item;
    var targetIndex = typeof index === 'number' ? index - 1 : 0;
    if (id !== undefined) {
      var _props$list$findIndex;
      targetIndex = (_props$list$findIndex = props.list.findIndex(function (row) {
        return row[props.rowKey] === id;
      })) !== null && _props$list$findIndex !== void 0 ? _props$list$findIndex : targetIndex;
    }
    if (item !== undefined) {
      var _props$list$findIndex2;
      targetIndex = (_props$list$findIndex2 = props.list.findIndex(function (row) {
        return item[props.rowKey] === row[props.rowKey];
      })) !== null && _props$list$findIndex2 !== void 0 ? _props$list$findIndex2 : targetIndex;
    }
    if (typeof targetIndex === 'number') {
      var resolvedIndex = targetIndex >= 0 ? targetIndex : 0;
      var offsetY = resolvedIndex * props.lineHeight;
      scrollTo(0, offsetY);
    }
    return null;
  };
  return {
    fixToTop: fixToTop
  };
});
;// ../../packages/virtual-render/src/use-scrollbar.tsx
/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */
/**
 * 原生滚动管理 Hook
 * 提供统一的滚动控制 API
 */
/* harmony default export */ const use_scrollbar = (function () {
  var targetElement = null;
  /**
   * 初始化滚动目标元素
   */
  var init = function init(target) {
    targetElement = target.value;
  };
  /**
   * 滚动到指定位置
   */
  var scrollTo = function scrollTo(x, y) {
    if (targetElement) {
      if (typeof targetElement.scrollTo === 'function') {
        targetElement.scrollTo({
          left: x,
          top: y,
          behavior: 'auto'
        });
      } else {
        // jsdom 等环境可能没有 scrollTo，降级为直接赋值
        targetElement.scrollLeft = x;
        targetElement.scrollTop = y;
      }
    }
  };
  /**
   * 更新方法（兼容旧 API，原生滚动无需更新）
   */
  var update = function update() {
    // 原生滚动无需手动更新
  };
  /**
   * 更新滚动高度（兼容旧 API，原生滚动由 CSS 控制）
   */
  var updateScrollHeight = function updateScrollHeight(_height) {
    // 原生滚动高度由内容决定，无需手动设置
  };
  return {
    init: init,
    scrollTo: scrollTo,
    update: update,
    updateScrollHeight: updateScrollHeight
  };
});
;// ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
function _classCallCheck(a, n) {
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
}

;// ../../node_modules/@babel/runtime/helpers/esm/createClass.js

function _defineProperties(e, r) {
  for (var t = 0; t < r.length; t++) {
    var o = r[t];
    o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
  }
}
function _createClass(e, r, t) {
  return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
    writable: !1
  }), e;
}

;// external "lodash/throttle"

;// ../../packages/virtual-render/src/v-virtual-render.ts



/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */
/**
 * @file v-virtual-render
 *
 * Copyright © 2012-2019 Tencent BlueKing. All Rights Reserved. 蓝鲸智云 版权所有
 */

function getMatchedIndex(maxCount, maxHeight, callback) {
  var startIndex = 0;
  var height = 0;
  var diffHeight = 0;
  var lastHeight = 0;
  for (; startIndex < maxCount; startIndex++) {
    lastHeight = callback({
      index: startIndex
    });
    if (height + lastHeight > maxHeight) {
      diffHeight = maxHeight - height;
      startIndex = startIndex + Math.round(diffHeight / lastHeight);
      break;
    }
    height += lastHeight;
  }
  return {
    startIndex: startIndex,
    height: height,
    diffHeight: diffHeight
  };
}
function computedVirtualIndex(lineHeight, callback, pagination, wrapper, event) {
  var scrollOffsetTop = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  if (!wrapper || !event.offset) {
    return;
  }
  var rawScrollTop = event.offset.y >= 0 ? event.offset.y : 0;
  var elScrollTop = Math.max(0, rawScrollTop - (scrollOffsetTop !== null && scrollOffsetTop !== void 0 ? scrollOffsetTop : 0));
  var elScrollLeft = event.offset.x >= 0 ? event.offset.x : 0;
  var elScrollHeight = wrapper.scrollHeight;
  var elOffsetHeight = wrapper.offsetHeight;
  var count = pagination.count,
    groupItemCount = pagination.groupItemCount;
  var targetStartIndex = 0;
  var targetEndIndex = 0;
  var translateY = 0;
  if (typeof lineHeight === 'number') {
    targetStartIndex = Math.floor(elScrollTop / lineHeight);
    targetEndIndex = Math.ceil(elOffsetHeight / lineHeight) + targetStartIndex + 1;
    translateY = elScrollTop % lineHeight;
  }
  if (typeof lineHeight === 'function') {
    var maxCount = Math.ceil(count / groupItemCount);
    var startValue = getMatchedIndex(maxCount, elScrollTop, lineHeight);
    targetStartIndex = startValue.startIndex > 0 ? startValue.startIndex : 0;
    translateY = startValue.diffHeight;
    var endValue = getMatchedIndex(maxCount, elOffsetHeight, lineHeight);
    targetEndIndex = endValue.startIndex + targetStartIndex + 1;
  }
  // bottom 计算应使用真实 scrollTop（包含顶部偏移），确保触底判定准确
  var bottom = elScrollHeight - elOffsetHeight - rawScrollTop;
  typeof callback === 'function' && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, {
    bottom: bottom >= 0 ? bottom : 0
  });
  return {
    targetStartIndex: targetStartIndex,
    targetEndIndex: targetEndIndex,
    elScrollTop: elScrollTop,
    translateY: translateY,
    elScrollLeft: elScrollLeft
  };
}
var VisibleRender = /*#__PURE__*/function () {
  function VisibleRender(binding, el) {
    var _this = this;
    _classCallCheck(this, VisibleRender);
    /**
     * 统一事件格式
     */
    _defineProperty(this, "getEvent", function (event) {
      if (event !== null && event !== void 0 && event.offset) {
        return {
          offset: event.offset
        };
      }
      // 从 target 元素获取滚动位置
      if (event !== null && event !== void 0 && event.target) {
        var _event$target$scrollL, _event$target$scrollT;
        return {
          offset: {
            x: (_event$target$scrollL = event.target.scrollLeft) !== null && _event$target$scrollL !== void 0 ? _event$target$scrollL : 0,
            y: (_event$target$scrollT = event.target.scrollTop) !== null && _event$target$scrollT !== void 0 ? _event$target$scrollT : 0
          }
        };
      }
      // 默认返回 0
      return {
        offset: {
          x: 0,
          y: 0
        }
      };
    });
    this.binding = binding;
    this.wrapper = el;
    var throttleDelay = binding.value.throttleDelay;
    this.delay = throttleDelay;
    this.delegateWrapper = undefined;
    this.boundScrollHandler = this.handleScroll.bind(this);
    this.throttledRender = __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a_default__(function (e) {
      _this.render(e);
    }, this.delay);
  }
  return _createClass(VisibleRender, [{
    key: "scrollHeight",
    get: function get() {
      var _this$delegateWrapper, _this$delegateWrapper2, _this$wrapper;
      return (_this$delegateWrapper = (_this$delegateWrapper2 = this.delegateWrapper) === null || _this$delegateWrapper2 === void 0 ? void 0 : _this$delegateWrapper2.scrollHeight) !== null && _this$delegateWrapper !== void 0 ? _this$delegateWrapper : (_this$wrapper = this.wrapper) === null || _this$wrapper === void 0 ? void 0 : _this$wrapper.scrollHeight;
    }
  }, {
    key: "offsetHeight",
    get: function get() {
      var _this$delegateWrapper3, _this$delegateWrapper4, _this$wrapper2;
      return (_this$delegateWrapper3 = (_this$delegateWrapper4 = this.delegateWrapper) === null || _this$delegateWrapper4 === void 0 ? void 0 : _this$delegateWrapper4.offsetHeight) !== null && _this$delegateWrapper3 !== void 0 ? _this$delegateWrapper3 : (_this$wrapper2 = this.wrapper) === null || _this$wrapper2 === void 0 ? void 0 : _this$wrapper2.offsetHeight;
    }
  }, {
    key: "setDelegateWrapper",
    value: function setDelegateWrapper(el) {
      this.delegateWrapper = el;
    }
  }, {
    key: "render",
    value: function render(e) {
      var _this$delegateWrapper5;
      var _this$binding$value = this.binding.value,
        _this$binding$value$l = _this$binding$value.lineHeight,
        lineHeight = _this$binding$value$l === void 0 ? 30 : _this$binding$value$l,
        handleScrollCallback = _this$binding$value.handleScrollCallback,
        _this$binding$value$p = _this$binding$value.pagination,
        pagination = _this$binding$value$p === void 0 ? {} : _this$binding$value$p,
        onlyScroll = _this$binding$value.onlyScroll,
        _this$binding$value$s = _this$binding$value.scrollOffsetTop,
        scrollOffsetTop = _this$binding$value$s === void 0 ? 0 : _this$binding$value$s;
      if (onlyScroll) {
        var _e$offset, _e$offset$x, _e$offset2;
        var elScrollTop = (_e$offset = e.offset) === null || _e$offset === void 0 ? void 0 : _e$offset.y;
        var elScrollLeft = (_e$offset$x = (_e$offset2 = e.offset) === null || _e$offset2 === void 0 ? void 0 : _e$offset2.x) !== null && _e$offset$x !== void 0 ? _e$offset$x : 0;
        var bottom = this.scrollHeight - this.offsetHeight - elScrollTop;
        handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, {
          bottom: bottom >= 0 ? bottom : 0
        });
        return;
      }
      var startIndex = pagination.startIndex,
        endIndex = pagination.endIndex,
        groupItemCount = pagination.groupItemCount,
        count = pagination.count,
        scrollTop = pagination.scrollTop,
        scrollLeft = pagination.scrollLeft;
      computedVirtualIndex(lineHeight, handleScrollCallback, {
        scrollTop: scrollTop,
        startIndex: startIndex,
        endIndex: endIndex,
        groupItemCount: groupItemCount,
        count: count,
        scrollLeft: scrollLeft
      }, (_this$delegateWrapper5 = this.delegateWrapper) !== null && _this$delegateWrapper5 !== void 0 ? _this$delegateWrapper5 : this.wrapper, e, scrollOffsetTop);
    }
  }, {
    key: "executeThrottledRender",
    value: function executeThrottledRender(e) {
      var event = this.getEvent(e);
      this.throttledRender(event);
    }
  }, {
    key: "install",
    value: function install() {
      var _this$wrapper3;
      (_this$wrapper3 = this.wrapper) === null || _this$wrapper3 === void 0 || _this$wrapper3.addEventListener('scroll', this.boundScrollHandler, {
        passive: true
      });
    }
  }, {
    key: "uninstall",
    value: function uninstall() {
      var _this$wrapper4;
      (_this$wrapper4 = this.wrapper) === null || _this$wrapper4 === void 0 || _this$wrapper4.removeEventListener('scroll', this.boundScrollHandler);
    }
  }, {
    key: "setBinding",
    value: function setBinding(binding) {
      var _this2 = this;
      this.binding = binding;
      // 更新节流延迟
      var throttleDelay = binding.value.throttleDelay;
      if (throttleDelay !== this.delay) {
        this.delay = throttleDelay;
        this.throttledRender = __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a_default__(function (e) {
          _this2.render(e);
        }, this.delay);
      }
    }
    /**
     * 原生滚动事件处理
     */
  }, {
    key: "handleScroll",
    value: function handleScroll(e) {
      var target = e.target;
      this.executeThrottledRender({
        offset: {
          x: target.scrollLeft,
          y: target.scrollTop
        }
      });
    }
  }]);
}();
var instance = null;
/* harmony default export */ const v_virtual_render = ({
  mounted: function mounted(el, binding) {
    var wrapper = el.parentNode;
    instance = new VisibleRender(binding, wrapper);
    instance.install();
  },
  updated: function updated(_el, binding) {
    var _instance;
    (_instance = instance) === null || _instance === void 0 || _instance.setBinding(binding);
  },
  unbind: function unbind(_el) {
    var _instance2;
    (_instance2 = instance) === null || _instance2 === void 0 || _instance2.uninstall();
    instance = null;
  }
});
;// ../../packages/virtual-render/src/use-tag-render.tsx

function use_tag_render_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? use_tag_render_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : use_tag_render_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */




/* harmony default export */ const use_tag_render = (function (props, ctx) {
  var renderAs = props.renderAs;
  var refRoot = __WEBPACK_EXTERNAL_MODULE_vue_ref__(null);
  var _useScrollbar = use_scrollbar(),
    init = _useScrollbar.init,
    scrollTo = _useScrollbar.scrollTo;
  /** 指令触发Scroll事件，计算当前startIndex & endIndex & scrollTop & translateY */
  var handleScrollCallback = function handleScrollCallback(event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft, pos) {
    ctx.emit('content-scroll', [event, {
      translateY: translateY,
      translateX: scrollLeft,
      pos: pos
    }]);
  };
  var renderInstance = null;
  var binding = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
    return {
      lineHeight: props.lineHeight,
      handleScrollCallback: handleScrollCallback,
      pagination: {},
      throttleDelay: props.throttleDelay,
      onlyScroll: props.scrollEvent
    };
  });
  /** 虚拟渲染外层容器样式 */
  var wrapperStyle = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
    var _props$maxHeight;
    var height = typeof props.height === 'number' ? "".concat(props.height, "px") : props.height;
    return use_tag_render_objectSpread({
      height: height,
      width: typeof props.width === 'number' ? "".concat(props.width, "px") : props.width,
      display: 'inline-block',
      maxHeight: (_props$maxHeight = props.maxHeight) !== null && _props$maxHeight !== void 0 ? _props$maxHeight : height,
      overflow: 'auto'
    }, props.wrapperStyle);
  });
  var _useFixTop = use_fix_top(props, scrollTo),
    fixToTop = _useFixTop.fixToTop;
  ctx.expose({
    scrollTo: scrollTo,
    fixToTop: fixToTop,
    refRoot: refRoot,
    refContent: refRoot
  });
  __WEBPACK_EXTERNAL_MODULE_vue_onMounted__(function () {
    renderInstance = new VisibleRender(binding, refRoot.value);
    init(refRoot);
    renderInstance.install();
  });
  __WEBPACK_EXTERNAL_MODULE_vue_onUnmounted__(function () {
    var _renderInstance;
    (_renderInstance = renderInstance) === null || _renderInstance === void 0 || _renderInstance.uninstall();
  });
  var wrapperClassNames = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
    return [props.className];
  });
  return {
    rendAsTag: function rendAsTag() {
      var _ctx$slots$beforeCont, _ctx$slots$beforeCont2, _ctx$slots, _ctx$slots$default, _ctx$slots$default2, _ctx$slots2, _ctx$slots$afterConte, _ctx$slots$afterConte2, _ctx$slots3, _ctx$slots$afterSecti, _ctx$slots$afterSecti2, _ctx$slots4;
      return __WEBPACK_EXTERNAL_MODULE_vue_h__(
      // @ts-ignore:next-line
      renderAs, {
        "class": wrapperClassNames.value,
        style: wrapperStyle.value,
        ref: refRoot
      }, [(_ctx$slots$beforeCont = (_ctx$slots$beforeCont2 = (_ctx$slots = ctx.slots).beforeContent) === null || _ctx$slots$beforeCont2 === void 0 ? void 0 : _ctx$slots$beforeCont2.call(_ctx$slots)) !== null && _ctx$slots$beforeCont !== void 0 ? _ctx$slots$beforeCont : '', (_ctx$slots$default = (_ctx$slots$default2 = (_ctx$slots2 = ctx.slots)["default"]) === null || _ctx$slots$default2 === void 0 ? void 0 : _ctx$slots$default2.call(_ctx$slots2, {
        data: props.list
      })) !== null && _ctx$slots$default !== void 0 ? _ctx$slots$default : '', (_ctx$slots$afterConte = (_ctx$slots$afterConte2 = (_ctx$slots3 = ctx.slots).afterContent) === null || _ctx$slots$afterConte2 === void 0 ? void 0 : _ctx$slots$afterConte2.call(_ctx$slots3)) !== null && _ctx$slots$afterConte !== void 0 ? _ctx$slots$afterConte : '', (_ctx$slots$afterSecti = (_ctx$slots$afterSecti2 = (_ctx$slots4 = ctx.slots).afterSection) === null || _ctx$slots$afterSecti2 === void 0 ? void 0 : _ctx$slots$afterSecti2.call(_ctx$slots4)) !== null && _ctx$slots$afterSecti !== void 0 ? _ctx$slots$afterSecti : '']);
    }
  };
});
;// ../../packages/virtual-render/src/virtual-render.tsx



function virtual_render_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? virtual_render_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : virtual_render_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */
/**
 * @file virtual-render
 *
 * Copyright © 2012-2019 Tencent BlueKing. All Rights Reserved. 蓝鲸智云 版权所有
 */







/* harmony default export */ const virtual_render = (__WEBPACK_EXTERNAL_MODULE_vue_defineComponent__({
  name: 'VirtualRender',
  directives: {
    bkVirtualRender: v_virtual_render
  },
  props: virtualRenderProps,
  emits: ['content-scroll'],
  slots: Object,
  setup: function setup(props, ctx) {
    var _this = this;
    var renderAs = props.renderAs;
    var resolvePropClassName = function resolvePropClassName(prop) {
      if (typeof prop === 'string') {
        return [prop];
      }
      if (_typeof(prop) === 'object' && !Array.isArray(prop)) {
        return [prop];
      }
      return prop;
    };
    if (!props.enabled) {
      var _useTagRender = use_tag_render(props, ctx),
        rendAsTag = _useTagRender.rendAsTag;
      return rendAsTag;
    }
    var refRoot = __WEBPACK_EXTERNAL_MODULE_vue_ref__(null);
    /** 如果有分组状态，计算总行数 */
    var listLength = __WEBPACK_EXTERNAL_MODULE_vue_ref__(0);
    /** 实际高度，根据行高和总行数计算出来的实际高度 */
    var innerHeight = __WEBPACK_EXTERNAL_MODULE_vue_ref__(0);
    var contentHeight = __WEBPACK_EXTERNAL_MODULE_vue_ref__(0);
    var getRowHeightArgs = function getRowHeightArgs(startIndex) {
      var start = startIndex * props.groupItemCount;
      var end = (startIndex + 1) * props.groupItemCount;
      if (end > listLength.value) {
        var count = end - start;
        end = listLength.value;
        start = end - count;
      }
      return {
        index: start,
        rows: props.list.slice(start, end),
        items: [start, end],
        type: 'virtual'
      };
    };
    var getLineHeight = function getLineHeight() {
      if (typeof props.lineHeight === 'function') {
        return function (_ref) {
          var index = _ref.index;
          return props.lineHeight(getRowHeightArgs(index));
        };
      }
      return props.lineHeight;
    };
    var binding = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return {
        lineHeight: getLineHeight(),
        handleScrollCallback: handleScrollCallback,
        pagination: pagination,
        throttleDelay: props.throttleDelay,
        scrollOffsetTop: props.scrollOffsetTop
      };
    });
    var _useScrollbar = use_scrollbar(),
      init = _useScrollbar.init,
      scrollTo = _useScrollbar.scrollTo;
    var instance = null;
    var pagination = __WEBPACK_EXTERNAL_MODULE_vue_reactive__({
      startIndex: 0,
      endIndex: 0,
      scrollTop: 1,
      scrollLeft: 0,
      translateY: 0,
      translateX: 0,
      count: 0,
      pos: {},
      groupItemCount: props.groupItemCount
    });
    var calcList = __WEBPACK_EXTERNAL_MODULE_vue_ref__([]);
    /** 计算 startIndex 对应的 Y 轴偏移量 */
    var getStartOffset = function getStartOffset(startIndex) {
      if (typeof props.lineHeight === 'function') {
        var offset = 0;
        for (var i = 0; i < startIndex; i++) {
          offset += props.lineHeight(getRowHeightArgs(i));
        }
        return offset;
      }
      return startIndex * props.lineHeight;
    };
    /** 指令触发Scroll事件，计算当前startIndex & endIndex & scrollTop & translateY */
    var handleScrollCallback = function handleScrollCallback(event, startIndex, endIndex, scrollTop, translateY, scrollLeft, pos) {
      var translateX = scrollLeft;
      Object.assign(pagination, {
        startIndex: startIndex,
        endIndex: endIndex,
        scrollTop: scrollTop,
        translateX: translateX,
        translateY: translateY,
        scrollLeft: scrollLeft,
        pos: pos
      });
      // 计算实际的数据起止索引
      var start = startIndex * props.groupItemCount;
      var end = endIndex * props.groupItemCount;
      var total = localList.value.length;
      // 处理预加载，避免空白闪烁
      start = Math.max(0, start - props.preloadItemCount);
      end = Math.min(total, end + props.preloadItemCount);
      // 边界处理
      if (end > total) {
        end = total;
      }
      if (start < 0) {
        start = 0;
      }
      var value = localList.value.slice(start, end);
      calcList.value = value;
      // 更新 pagination 的 startIndex（用于 transform 定位）
      pagination.startIndex = Math.floor(start / props.groupItemCount);
      if (event) {
        ctx.emit('content-scroll', [event, pagination, value]);
      }
    };
    __WEBPACK_EXTERNAL_MODULE_vue_onMounted__(function () {
      instance = new VisibleRender(binding, refRoot.value);
      // 在执行渲染前，先设置正确的容器尺寸
      // 当 props.height 是数字时，使用 props.height 作为 offsetHeight
      // 避免 popover 首次显示时 DOM 元素 offsetHeight 为 0 导致计算错误
      setDelegateEl();
      // 初始化原生滚动
      init(refRoot);
      // 安装滚动事件监听
      instance.install();
      // 初始渲染
      instance.executeThrottledRender({
        offset: {
          x: 0,
          y: 0
        }
      });
    });
    __WEBPACK_EXTERNAL_MODULE_vue_onUnmounted__(function () {
      var _instance;
      (_instance = instance) === null || _instance === void 0 || _instance.uninstall();
    });
    var handleChangeListConfig = function handleChangeListConfig() {
      /** 数据改变时激活当前表单，使其渲染DOM */
      handleListChanged(props.list);
    };
    /**
     * 列表数据改变时，处理相关参数
     */
    var handleListChanged = function handleListChanged(list) {
      listLength.value = Math.ceil((list || []).length / props.groupItemCount);
      pagination.count = listLength.value;
      var isAuto = typeof props.abosuteHeight === 'string' && props.abosuteHeight === 'auto';
      if (isAuto) {
        if (typeof props.lineHeight === 'function') {
          innerHeight.value = 0;
          var fnValue = 0;
          var rowsLength = Math.ceil(listLength.value / props.groupItemCount);
          for (var i = 0; i < rowsLength; i++) {
            var fnVal = props.lineHeight.apply(_this, [getRowHeightArgs(i)]);
            fnValue += typeof fnVal === 'number' ? fnVal : 0;
          }
          innerHeight.value = fnValue;
        } else {
          innerHeight.value = props.lineHeight * listLength.value;
        }
      } else {
        innerHeight.value = props.abosuteHeight;
      }
      setContentHeight();
    };
    /** 列表数据重置之后的处理事项 */
    var afterListDataReset = function afterListDataReset() {
      var _el$scrollLeft, _el$scrollTop;
      var _scrollToOpt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
        left: 0,
        top: 0
      };
      var el = refRoot.value;
      var container = typeof props.height === 'number' ? {
        scrollHeight: innerHeight.value,
        offsetHeight: props.height
      } : el;
      // 传递正确的 offset 参数
      computedVirtualIndex(getLineHeight(), handleScrollCallback, pagination, container, {
        offset: {
          x: (_el$scrollLeft = el === null || el === void 0 ? void 0 : el.scrollLeft) !== null && _el$scrollLeft !== void 0 ? _el$scrollLeft : 0,
          y: (_el$scrollTop = el === null || el === void 0 ? void 0 : el.scrollTop) !== null && _el$scrollTop !== void 0 ? _el$scrollTop : 0
        }
      }, props.scrollOffsetTop);
    };
    /** 映射传入的数组为新的数组，增加 $index属性，用来处理唯一Index */
    var localList = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      if (props.rowKey !== undefined || !props.autoIndex) {
        return props.list;
      }
      return (props.list || []).map(function (item, index) {
        return virtual_render_objectSpread(virtual_render_objectSpread({}, item), {}, {
          $index: index
        });
      });
    });
    /** 展示列表内容区域样式 */
    var innerContentStyle = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return props.scrollPosition === 'content' ? {} : {};
    });
    /** 虚拟渲染外层容器样式 */
    var wrapperStyle = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      var height = typeof props.height === 'number' ? "".concat(props.height, "px") : props.height;
      return virtual_render_objectSpread(virtual_render_objectSpread({
        height: height,
        width: typeof props.width === 'number' ? "".concat(props.width, "px") : props.width,
        display: 'inline-block',
        // maxHeight 支持 number（px）与 string（如 50%、calc(...)）
        maxHeight: props.maxHeight ? typeof props.maxHeight === 'number' ? "".concat(props.maxHeight, "px") : props.maxHeight : false,
        minHeight: props.minHeight ? "".concat(props.minHeight, "px") : false,
        overflow: 'auto'
      }, props.scrollPosition === 'container' ? innerContentStyle.value : {}), props.wrapperStyle);
    });
    var setContentHeight = function setContentHeight() {
      contentHeight.value = innerHeight.value < props.minHeight ? props.minHeight : innerHeight.value;
    };
    var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
      resolveClassName = _usePrefix.resolveClassName;
    /** 外层样式列表 */
    var wrapperClass = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return [resolveClassName('virtual-render')].concat(_toConsumableArray(resolvePropClassName(props.className)), [props.scrollPosition === 'container' ? resolveClassName('virtual-content') : '']);
    });
    /**
     * 重置当前配置，将滚动位置重置到顶部
     */
    var reset = function reset() {
      // 重置 pagination 状态
      Object.assign(pagination, {
        startIndex: 0,
        endIndex: 0,
        scrollTop: 0,
        scrollLeft: 0,
        translateY: 0,
        translateX: 0
      });
      // 重置 DOM 滚动位置
      if (refRoot.value) {
        refRoot.value.scrollTop = 0;
        refRoot.value.scrollLeft = 0;
      }
      handleChangeListConfig();
      setDelegateEl();
      // 立即计算初始数据，确保 calcList 有值
      var container = typeof props.height === 'number' ? {
        scrollHeight: innerHeight.value,
        offsetHeight: props.height
      } : refRoot.value;
      computedVirtualIndex(getLineHeight(), handleScrollCallback, pagination, container, {
        offset: {
          x: 0,
          y: 0
        }
      }, props.scrollOffsetTop);
      // 触发渲染更新
      __WEBPACK_EXTERNAL_MODULE_vue_nextTick__(function () {
        var _instance2;
        (_instance2 = instance) === null || _instance2 === void 0 || _instance2.executeThrottledRender({
          offset: {
            x: 0,
            y: 0
          }
        });
      });
    };
    var _useFixTop = use_fix_top(props, scrollTo),
      fixToTop = _useFixTop.fixToTop;
    var setDelegateEl = function setDelegateEl() {
      var _instance3;
      var el = refRoot.value;
      var container = typeof props.height === 'number' ? {
        scrollHeight: innerHeight.value,
        offsetHeight: props.height
      } : el;
      (_instance3 = instance) === null || _instance3 === void 0 || _instance3.setDelegateWrapper(container);
    };
    var updateVirtualInstance = function updateVirtualInstance() {
      var _instance4;
      (_instance4 = instance) === null || _instance4 === void 0 || _instance4.setBinding(binding);
      handleChangeListConfig();
      setDelegateEl();
      afterListDataReset();
      __WEBPACK_EXTERNAL_MODULE_vue_nextTick__(function () {
        var _instance5;
        (_instance5 = instance) === null || _instance5 === void 0 || _instance5.executeThrottledRender({
          offset: {
            x: pagination.scrollLeft,
            y: pagination.scrollTop
          }
        });
      });
    };
    __WEBPACK_EXTERNAL_MODULE_vue_watch__(function () {
      return props.height;
    }, function () {
      updateVirtualInstance();
    });
    __WEBPACK_EXTERNAL_MODULE_vue_watch__(function () {
      return [props.list, props.list.length];
    }, function () {
      updateVirtualInstance();
    }, {
      immediate: true
    });
    ctx.expose({
      reset: reset,
      scrollTo: scrollTo,
      fixToTop: fixToTop,
      refRoot: refRoot,
      refContent: refRoot
    });
    /** 内容区域样式，使用 transform 定位到正确位置 */
    var contentWrapperStyle = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return virtual_render_objectSpread({
        transform: "translateY(".concat(getStartOffset(pagination.startIndex), "px)")
      }, props.contentStyle);
    });
    return function () {
      var _ctx$slots$beforeCont, _ctx$slots$beforeCont2, _ctx$slots, _ctx$slots$default, _ctx$slots$default2, _ctx$slots2, _ctx$slots$afterConte, _ctx$slots$afterConte2, _ctx$slots3, _ctx$slots$afterSecti, _ctx$slots$afterSecti2, _ctx$slots4;
      return __WEBPACK_EXTERNAL_MODULE_vue_h__(
      // @ts-ignore:next-line
      renderAs || 'div', {
        ref: refRoot,
        "class": _toConsumableArray(wrapperClass.value),
        style: wrapperStyle.value
      }, [
      // 占位元素，撑起完整的滚动高度
      __WEBPACK_EXTERNAL_MODULE_vue_h__('div', {
        "class": resolveClassName('virtual-section'),
        style: {
          height: "".concat(contentHeight.value, "px"),
          position: 'absolute',
          width: '1px',
          pointerEvents: 'none'
        }
      }), (_ctx$slots$beforeCont = (_ctx$slots$beforeCont2 = (_ctx$slots = ctx.slots).beforeContent) === null || _ctx$slots$beforeCont2 === void 0 ? void 0 : _ctx$slots$beforeCont2.call(_ctx$slots)) !== null && _ctx$slots$beforeCont !== void 0 ? _ctx$slots$beforeCont : '',
      // 内容容器，使用 transform 定位到正确位置
      __WEBPACK_EXTERNAL_MODULE_vue_h__('div', {
        "class": [resolveClassName('virtual-content')].concat(_toConsumableArray(resolvePropClassName(props.contentClassName))),
        style: contentWrapperStyle.value
      }, (_ctx$slots$default = (_ctx$slots$default2 = (_ctx$slots2 = ctx.slots)["default"]) === null || _ctx$slots$default2 === void 0 ? void 0 : _ctx$slots$default2.call(_ctx$slots2, {
        data: calcList.value,
        pagination: pagination
      })) !== null && _ctx$slots$default !== void 0 ? _ctx$slots$default : ''), (_ctx$slots$afterConte = (_ctx$slots$afterConte2 = (_ctx$slots3 = ctx.slots).afterContent) === null || _ctx$slots$afterConte2 === void 0 ? void 0 : _ctx$slots$afterConte2.call(_ctx$slots3)) !== null && _ctx$slots$afterConte !== void 0 ? _ctx$slots$afterConte : '', (_ctx$slots$afterSecti = (_ctx$slots$afterSecti2 = (_ctx$slots4 = ctx.slots).afterSection) === null || _ctx$slots$afterSecti2 === void 0 ? void 0 : _ctx$slots$afterSecti2.call(_ctx$slots4)) !== null && _ctx$slots$afterSecti !== void 0 ? _ctx$slots$afterSecti : '']);
    };
  }
}));
;// ../../packages/virtual-render/src/index.ts
/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */
/**
 * @file virtual-render enter
 *
 * Copyright © 2012-2019 Tencent BlueKing. All Rights Reserved. 蓝鲸智云 版权所有
 */


var BkVirtualRender = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstall__(virtual_render);
/* harmony default export */ const src = (BkVirtualRender);
export { src as default };
