import "../styles/reset.css";
import "./loading.less";
import { PropTypes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__, classes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__, withInstallProps as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstallProps__ } from "../shared";
import { computed as __WEBPACK_EXTERNAL_MODULE_vue_computed__, createApp as __WEBPACK_EXTERNAL_MODULE_vue_createApp__, createVNode as __WEBPACK_EXTERNAL_MODULE_vue_createVNode__, defineComponent as __WEBPACK_EXTERNAL_MODULE_vue_defineComponent__, h as __WEBPACK_EXTERNAL_MODULE_vue_h__, reactive as __WEBPACK_EXTERNAL_MODULE_vue_reactive__ } from "vue";
import { usePrefix as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__ } from "../config-provider";

;// external "../shared"

;// external "vue"

;// ../../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 "../config-provider"

;// ../../packages/loading/src/loading.tsx

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 BkLoadingMode;
(function (BkLoadingMode) {
  BkLoadingMode["Default"] = "default";
  BkLoadingMode["Spin"] = "spin";
})(BkLoadingMode || (BkLoadingMode = {}));
var BkLoadingSize;
(function (BkLoadingSize) {
  BkLoadingSize["Large"] = "large";
  BkLoadingSize["Mini"] = "mini";
  BkLoadingSize["Normal"] = "";
  BkLoadingSize["Small"] = "small";
})(BkLoadingSize || (BkLoadingSize = {}));
var defaultIndicator;
function setDefaultIndicator(Indicator) {
  defaultIndicator = typeof Indicator === 'function' ? Indicator : function () {
    return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(Indicator, null, null);
  };
}
var loadingTypes = {
  indicator: {
    type: Function
  },
  loading: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
  inline: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
  theme: {
    type: String
  },
  title: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def(''),
  size: {
    type: String,
    "default": BkLoadingSize.Normal
  },
  mode: {
    type: String,
    "default": 'default'
  },
  opacity: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(0.9),
  color: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def('white'),
  zIndex: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(1),
  isDirective: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(false)
};
/* harmony default export */ const loading = (__WEBPACK_EXTERNAL_MODULE_vue_defineComponent__({
  name: 'Loading',
  props: loadingTypes,
  setup: function setup(props, ctx) {
    var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
      resolveClassName = _usePrefix.resolveClassName;
    var dotIndicator = __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
      "class": "".concat(resolveClassName('normal-indicator'))
    }, [[1, 2, 3, 4].map(function (i) {
      return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("span", {
        "class": "dot dot-".concat(i)
      }, null);
    })]);
    var spinIndicator = __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
      "class": "".concat(resolveClassName('spin-indicator'))
    }, [[1, 2, 3, 4, 5, 6, 7, 8].map(function (i) {
      return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("span", {
        "class": "oval oval-".concat(i)
      }, null);
    })]);
    var zIndexStyle = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return {
        zIndex: props.zIndex
      };
    });
    var maskStyle = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return _objectSpread({
        opacity: props.opacity,
        backgroundColor: props.color
      }, zIndexStyle.value);
    });
    var loadingWrapperCls = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__(_defineProperty(_defineProperty(_defineProperty({}, "".concat(resolveClassName('loading-wrapper')), props.loading), "".concat(resolveClassName('nested-loading')), !!ctx.slots["default"]), "".concat(resolveClassName('directive-loading')), props.isDirective));
    });
    var containerCls = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__(_defineProperty(_defineProperty({}, "".concat(resolveClassName("loading-size-".concat(props.size))), !!props.size), "".concat(resolveClassName("loading-".concat(props.theme))), !!props.theme), resolveClassName('loading-indicator'));
    });
    var hasTitle = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return !!props.title;
    });
    var indicator = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      var isSpinMode = props.mode === BkLoadingMode.Spin;
      if (typeof props.indicator === 'function') {
        return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(props.indicator, null, null);
      }
      if (typeof defaultIndicator === 'function') {
        return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(defaultIndicator, null, null);
      }
      return isSpinMode ? spinIndicator : dotIndicator;
    });
    return function () {
      var _ctx$slots$default, _ctx$slots;
      return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
        "class": loadingWrapperCls.value
      }, [(_ctx$slots$default = (_ctx$slots = ctx.slots)["default"]) === null || _ctx$slots$default === void 0 ? void 0 : _ctx$slots$default.call(_ctx$slots), props.loading && [(ctx.slots["default"] || props.isDirective) && __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
        "style": maskStyle.value,
        "class": "".concat(resolveClassName('loading-mask'))
      }, null), __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
        "style": zIndexStyle.value,
        "class": containerCls.value
      }, [indicator.value, hasTitle.value && __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
        "class": "".concat(resolveClassName('loading-title'))
      }, [props.title])])]]);
    };
  }
}));
;// ../../packages/loading/src/directive.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 INSTANCE_KEY = Symbol('vBkLoading');
var createInstance = function createInstance(el, binding) {
  var _getBindingProp, _getBindingProp2, _getBindingProp3, _getBindingProp4, _getBindingProp5;
  var getBindingProp = function getBindingProp(key) {
    var _binding$value$key, _binding$value;
    return (_binding$value$key = (_binding$value = binding.value) === null || _binding$value === void 0 ? void 0 : _binding$value[key]) !== null && _binding$value$key !== void 0 ? _binding$value$key : undefined;
  };
  var options = __WEBPACK_EXTERNAL_MODULE_vue_reactive__({
    indicator: getBindingProp('indicator'),
    loading: (_getBindingProp = getBindingProp('loading')) !== null && _getBindingProp !== void 0 ? _getBindingProp : false,
    inline: (_getBindingProp2 = getBindingProp('inline')) !== null && _getBindingProp2 !== void 0 ? _getBindingProp2 : false,
    theme: getBindingProp('theme'),
    title: (_getBindingProp3 = getBindingProp('title')) !== null && _getBindingProp3 !== void 0 ? _getBindingProp3 : '',
    size: (_getBindingProp4 = getBindingProp('size')) !== null && _getBindingProp4 !== void 0 ? _getBindingProp4 : '',
    mode: getBindingProp('mode'),
    opacity: getBindingProp('opacity'),
    color: (_getBindingProp5 = getBindingProp('color')) !== null && _getBindingProp5 !== void 0 ? _getBindingProp5 : 'white',
    zIndex: getBindingProp('zIndex'),
    isDirective: true
  });
  var div = document.createElement('div');
  Object.assign(div.style, {
    position: 'absolute',
    left: 0,
    right: 0,
    top: 0,
    bottom: 0
  });
  Object.assign(el.style, {
    position: 'relative'
  });
  var instance = __WEBPACK_EXTERNAL_MODULE_vue_createApp__({
    render: function render() {
      return __WEBPACK_EXTERNAL_MODULE_vue_h__(loading, options);
    }
  });
  el[INSTANCE_KEY] = {
    options: options,
    instance: instance,
    vm: instance.mount(div)
  };
  el.appendChild(div);
};
var updateOptions = function updateOptions(newOptions, originalOptions) {
  Object.keys(newOptions).forEach(function (key) {
    if (newOptions[key] !== originalOptions[key]) {
      originalOptions[key] = newOptions[key];
    }
  });
};
var vBkloading = {
  mounted: function mounted(el, binding) {
    if (binding.value) {
      createInstance(el, binding);
      if (!binding.value.loading) {
        var _instance$vm;
        // 只要loading不为真，就必须隐藏loading遮罩层
        var instance = el[INSTANCE_KEY];
        if (instance !== null && instance !== void 0 && (_instance$vm = instance.vm) !== null && _instance$vm !== void 0 && (_instance$vm = _instance$vm.$el) !== null && _instance$vm !== void 0 && (_instance$vm = _instance$vm.parentNode) !== null && _instance$vm !== void 0 && _instance$vm.style) {
          instance.vm.$el.parentNode.style.display = 'none';
        }
      }
    }
  },
  updated: function updated(el, binding) {
    var _instance$vm2;
    var instance = el[INSTANCE_KEY];
    var value = binding.value;
    updateOptions(value, instance.options);
    if (instance !== null && instance !== void 0 && (_instance$vm2 = instance.vm) !== null && _instance$vm2 !== void 0 && (_instance$vm2 = _instance$vm2.$el) !== null && _instance$vm2 !== void 0 && (_instance$vm2 = _instance$vm2.parentNode) !== null && _instance$vm2 !== void 0 && _instance$vm2.style) {
      instance.vm.$el.parentNode.style.display = value.loading ? '' : 'none';
    }
  },
  unmounted: function unmounted(el) {
    var _instance$vm3, _instance$instance;
    var instance = el[INSTANCE_KEY];
    el === null || el === void 0 || el.removeChild(instance === null || instance === void 0 || (_instance$vm3 = instance.vm) === null || _instance$vm3 === void 0 || (_instance$vm3 = _instance$vm3.$el) === null || _instance$vm3 === void 0 ? void 0 : _instance$vm3.parentNode);
    instance === null || instance === void 0 || (_instance$instance = instance.instance) === null || _instance$instance === void 0 || _instance$instance.unmount();
    el[INSTANCE_KEY] = null;
  }
};
;// ../../packages/loading/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 BkLoading = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstallProps__(loading, {
  setDefaultIndicator: setDefaultIndicator,
  BkLoadingMode: BkLoadingMode,
  BkLoadingSize: BkLoadingSize
}, true, {
  name: 'loading',
  directive: vBkloading
});
/* harmony default export */ const src = (BkLoading);

export { BkLoading, BkLoadingMode, BkLoadingSize, src as default, setDefaultIndicator, vBkloading };
