import "../styles/reset.css";
import "./backtop.less";
import { PropTypes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__, bkZIndexManager as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_bkZIndexManager__, withInstall as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstall__ } from "../shared";
import { Transition as __WEBPACK_EXTERNAL_MODULE_vue_Transition__, createVNode as __WEBPACK_EXTERNAL_MODULE_vue_createVNode__, defineComponent as __WEBPACK_EXTERNAL_MODULE_vue_defineComponent__, onBeforeUnmount as __WEBPACK_EXTERNAL_MODULE_vue_onBeforeUnmount__, onMounted as __WEBPACK_EXTERNAL_MODULE_vue_onMounted__, 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 { AngleUp as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3_AngleUp__ } from "../icon";
import { default as __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a_default__ } from "lodash/throttle";

;// external "../shared"

;// external "vue"

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

;// external "../icon"

;// external "lodash/throttle"

;// ../../packages/backtop/src/backtop.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 backtop = (__WEBPACK_EXTERNAL_MODULE_vue_defineComponent__({
  name: 'Backtop',
  props: {
    visibilityHeight: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(200),
    target: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def(''),
    right: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(40),
    bottom: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(40),
    extCls: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def('')
  },
  setup: function setup(props, _ref) {
    var slots = _ref.slots;
    var container = __WEBPACK_EXTERNAL_MODULE_vue_ref__(null);
    var el = __WEBPACK_EXTERNAL_MODULE_vue_ref__(null);
    var visible = __WEBPACK_EXTERNAL_MODULE_vue_ref__(false);
    var zIndex = __WEBPACK_EXTERNAL_MODULE_vue_ref__(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_bkZIndexManager__.getModalNextIndex());
    var styleBottom = "".concat(props.bottom, "px");
    var styleRight = "".concat(props.right, "px");
    var scrollHandler = __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a_default__(function () {
      visible.value = el.value.scrollTop >= props.visibilityHeight;
    }, 30);
    var scrollTop = function scrollTop() {
      el.value.scrollTo({
        top: 0,
        behavior: 'smooth'
      });
    };
    __WEBPACK_EXTERNAL_MODULE_vue_watch__(function () {
      return visible;
    }, function () {
      zIndex.value = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_bkZIndexManager__.getModalNextIndex();
    });
    __WEBPACK_EXTERNAL_MODULE_vue_onMounted__(function () {
      container.value = document;
      el.value = document.documentElement;
      if (props.target) {
        el.value = document.querySelector(props.target);
        if (!el.value) {
          throw new Error('target does not exist');
        }
        container.value = el.value;
      }
      container.value.addEventListener('scroll', scrollHandler);
    });
    __WEBPACK_EXTERNAL_MODULE_vue_onBeforeUnmount__(function () {
      container.value.removeEventListener('scroll', scrollHandler);
    });
    var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
      resolveClassName = _usePrefix.resolveClassName;
    return function () {
      var _slots$default, _slots$default2;
      return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(__WEBPACK_EXTERNAL_MODULE_vue_Transition__, {
        "name": "bk-fade"
      }, {
        "default": function _default() {
          return [visible.value ? __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
            "style": {
              right: styleRight,
              bottom: styleBottom,
              zIndex: zIndex.value
            },
            "class": "".concat(resolveClassName('backtop'), " ").concat(props.extCls),
            "onClick": scrollTop
          }, [(_slots$default = (_slots$default2 = slots["default"]) === null || _slots$default2 === void 0 ? void 0 : _slots$default2.call(slots)) !== null && _slots$default !== void 0 ? _slots$default : __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3_AngleUp__, {
            "class": "".concat(resolveClassName('backtop-icon'))
          }, null)]) : ''];
        }
      });
    };
  }
}));
;// ../../packages/backtop/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.
 */


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