{"version":3,"file":"index.min.mjs","sources":["../src/utils/props.ts","../src/utils/install.ts","../src/utils/run.ts","../src/_hooks/create.ts","../src/np-button/src/props.ts","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObjectLike.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isSymbol.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_trimmedEndIndex.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseTrim.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/toNumber.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/debounce.js","../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/throttle.js","../src/np-button/src/np-button.vue","../src/np-button/index.ts","../src/index.ts"],"sourcesContent":["/**\n * prop type helpers\n * help us to write less code and reduce bundle size\n */\n\nconst unknownProp = null\nconst numericProp = [Number, String]\nconst truthProp = {\n  type: Boolean,\n  default: true,\n}\nconst makeRequiredProp = <T>(type: T) => ({\n  type,\n  required: true,\n})\nconst makeArrayProp = () => ({\n  type: Array,\n  default: () => [],\n})\nconst makeNumberProp = (defaultVal: number) => ({\n  type: Number,\n  default: defaultVal,\n})\nconst makeNumericProp = (defaultVal: number | string) => ({\n  type: numericProp,\n  default: defaultVal,\n})\nconst makeStringProp = (defaultVal: string) => ({\n  type: String,\n  default: defaultVal,\n})\nexport {\n  makeArrayProp,\n  makeNumberProp,\n  makeNumericProp,\n  makeRequiredProp,\n  makeStringProp,\n  numericProp,\n  truthProp,\n  unknownProp,\n}\n","import type { App, Component } from 'vue'\n\n// const camelizeRE = /-(\\w)/g\n// const camelize = (str: string) =>\n//   str.replace(camelizeRE, (_, c) => c.toUpperCase())\n\ntype EventShim = {\n  new (...args: any[]): {\n    $props: {\n      onClick?: (...args: any[]) => void\n    }\n  }\n}\nexport type WithInstall<T> = T & {\n  install(app: App): void\n} & EventShim\n\nexport const withInstall = <T extends Component>(\n  options: T\n): WithInstall<T> => {\n  // @ts-ignore\n  options.install = (app: App) => {\n    const { name } = options\n    if (name) {\n      app.component(name, options)\n      // app.component(camelize(`-${name}`), options)\n    }\n  }\n  return options as WithInstall<T>\n}\n","/* eslint-disable  */\nconst obj = Object.prototype.toString\n\n/**\n * 是否函数\n * @param val 值\n * @returns bool\n */\nexport function isFunction(val: any): val is Function {\n  return (\n    obj.call(val) === '[object Function]' ||\n    obj.call(val) === '[object AsyncFunction]'\n  )\n}\n\n/**\n * 是否promise\n * @param val 值\n * @returns bool\n */\nexport function isPromise(val: any): val is Promise<any> {\n  return obj.call(val) === '[object Promise]'\n}\n/**\n * 执行对象，获取真正的值\n * @param val 值或函数或promise\n * @param args 可传参\n * @returns promise\n *\n */\nexport const run = async (val: any, ...args: any): Promise<any> => {\n  if (isFunction(val)) {\n    const result = val(...args)\n    return run(result)\n  }\n  if (isPromise(val)) {\n    return val.then((resolvedResult: any) => run(resolvedResult))\n  }\n  return Promise.resolve(val)\n}\n","import { ref, watch, type Ref } from 'vue'\n\nconst prefixName = ``\n\n/**\n *\n * @param componentName 组件名，例如 button\n * @returns\n */\nexport const useCreate = (\n  componentName: string,\n  args?: Ref<{ [x: string]: any }>\n) => {\n  // 例如 naive-button\n  const name = `${prefixName ? `-${prefixName}` : ''}${componentName}`\n  /**\n   * const { name, bemClass } = useCreate('back-top', toRef({ visible }))\n   * // name = 'prefix-back-top'\n   * // bemClass = 'prefix-back-top prefix-back-top-visible'\n   */\n  const bemClass = ref(name)\n  watch(\n    () => args,\n    () => {\n      const extClass = Object.keys(args?.value || {})\n        .filter((key) => !!args?.value[key])\n        .map((key) => `${name}-${key}`)\n        .join(' ')\n      bemClass.value = `${name} ${extClass}`\n    },\n    {\n      immediate: true,\n      deep: true,\n    }\n  )\n  return {\n    prefixName,\n    name,\n    bemClass,\n  }\n}\n","import type { ExtractPropTypes, PropType } from 'vue'\nimport { makeStringProp } from '../../utils'\n\nexport const npButtonProps = {\n  /**\n   * 类型定义\n   */\n  type: makeStringProp(''),\n\n  class: makeStringProp(''),\n  click: {\n    type: Function as PropType<\n      ((e?: MouseEvent) => void) | ((e?: MouseEvent) => Promise<void>)\n    >,\n  },\n}\n\nexport type NpButtonProps = ExtractPropTypes<typeof npButtonProps>\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n  var isOwn = hasOwnProperty.call(value, symToStringTag),\n      tag = value[symToStringTag];\n\n  try {\n    value[symToStringTag] = undefined;\n    var unmasked = true;\n  } catch (e) {}\n\n  var result = nativeObjectToString.call(value);\n  if (unmasked) {\n    if (isOwn) {\n      value[symToStringTag] = tag;\n    } else {\n      delete value[symToStringTag];\n    }\n  }\n  return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n  return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n    undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n  if (value == null) {\n    return value === undefined ? undefinedTag : nullTag;\n  }\n  return (symToStringTag && symToStringTag in Object(value))\n    ? getRawTag(value)\n    : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n  return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n  return typeof value == 'symbol' ||\n    (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n  var index = string.length;\n\n  while (index-- && reWhitespace.test(string.charAt(index))) {}\n  return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n  return string\n    ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n    : string;\n}\n\nexport default baseTrim;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n  var type = typeof value;\n  return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n  if (typeof value == 'number') {\n    return value;\n  }\n  if (isSymbol(value)) {\n    return NAN;\n  }\n  if (isObject(value)) {\n    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n    value = isObject(other) ? (other + '') : other;\n  }\n  if (typeof value != 'string') {\n    return value === 0 ? value : +value;\n  }\n  value = baseTrim(value);\n  var isBinary = reIsBinary.test(value);\n  return (isBinary || reIsOctal.test(value))\n    ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n    : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import root from './_root.js';\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n *   console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n  return root.Date.now();\n};\n\nexport default now;\n","import isObject from './isObject.js';\nimport now from './now.js';\nimport toNumber from './toNumber.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n    nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n *  Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n *  The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n *  Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n *   'leading': true,\n *   'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n  var lastArgs,\n      lastThis,\n      maxWait,\n      result,\n      timerId,\n      lastCallTime,\n      lastInvokeTime = 0,\n      leading = false,\n      maxing = false,\n      trailing = true;\n\n  if (typeof func != 'function') {\n    throw new TypeError(FUNC_ERROR_TEXT);\n  }\n  wait = toNumber(wait) || 0;\n  if (isObject(options)) {\n    leading = !!options.leading;\n    maxing = 'maxWait' in options;\n    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n    trailing = 'trailing' in options ? !!options.trailing : trailing;\n  }\n\n  function invokeFunc(time) {\n    var args = lastArgs,\n        thisArg = lastThis;\n\n    lastArgs = lastThis = undefined;\n    lastInvokeTime = time;\n    result = func.apply(thisArg, args);\n    return result;\n  }\n\n  function leadingEdge(time) {\n    // Reset any `maxWait` timer.\n    lastInvokeTime = time;\n    // Start the timer for the trailing edge.\n    timerId = setTimeout(timerExpired, wait);\n    // Invoke the leading edge.\n    return leading ? invokeFunc(time) : result;\n  }\n\n  function remainingWait(time) {\n    var timeSinceLastCall = time - lastCallTime,\n        timeSinceLastInvoke = time - lastInvokeTime,\n        timeWaiting = wait - timeSinceLastCall;\n\n    return maxing\n      ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n      : timeWaiting;\n  }\n\n  function shouldInvoke(time) {\n    var timeSinceLastCall = time - lastCallTime,\n        timeSinceLastInvoke = time - lastInvokeTime;\n\n    // Either this is the first call, activity has stopped and we're at the\n    // trailing edge, the system time has gone backwards and we're treating\n    // it as the trailing edge, or we've hit the `maxWait` limit.\n    return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n      (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n  }\n\n  function timerExpired() {\n    var time = now();\n    if (shouldInvoke(time)) {\n      return trailingEdge(time);\n    }\n    // Restart the timer.\n    timerId = setTimeout(timerExpired, remainingWait(time));\n  }\n\n  function trailingEdge(time) {\n    timerId = undefined;\n\n    // Only invoke if we have `lastArgs` which means `func` has been\n    // debounced at least once.\n    if (trailing && lastArgs) {\n      return invokeFunc(time);\n    }\n    lastArgs = lastThis = undefined;\n    return result;\n  }\n\n  function cancel() {\n    if (timerId !== undefined) {\n      clearTimeout(timerId);\n    }\n    lastInvokeTime = 0;\n    lastArgs = lastCallTime = lastThis = timerId = undefined;\n  }\n\n  function flush() {\n    return timerId === undefined ? result : trailingEdge(now());\n  }\n\n  function debounced() {\n    var time = now(),\n        isInvoking = shouldInvoke(time);\n\n    lastArgs = arguments;\n    lastThis = this;\n    lastCallTime = time;\n\n    if (isInvoking) {\n      if (timerId === undefined) {\n        return leadingEdge(lastCallTime);\n      }\n      if (maxing) {\n        // Handle invocations in a tight loop.\n        clearTimeout(timerId);\n        timerId = setTimeout(timerExpired, wait);\n        return invokeFunc(lastCallTime);\n      }\n    }\n    if (timerId === undefined) {\n      timerId = setTimeout(timerExpired, wait);\n    }\n    return result;\n  }\n  debounced.cancel = cancel;\n  debounced.flush = flush;\n  return debounced;\n}\n\nexport default debounce;\n","import debounce from './debounce.js';\nimport isObject from './isObject.js';\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n *  Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n *  Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n  var leading = true,\n      trailing = true;\n\n  if (typeof func != 'function') {\n    throw new TypeError(FUNC_ERROR_TEXT);\n  }\n  if (isObject(options)) {\n    leading = 'leading' in options ? !!options.leading : leading;\n    trailing = 'trailing' in options ? !!options.trailing : trailing;\n  }\n  return debounce(func, wait, {\n    'leading': leading,\n    'maxWait': wait,\n    'trailing': trailing\n  });\n}\n\nexport default throttle;\n","<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n  name: 'NpButton',\n});\n</script>\n<template>\n  <div\n    class=\"flex\"\n    :class=\"[bemClass, props.class]\"\n    style=\"padding: 0\"\n    :style=\"wrapperStyle\"\n  >\n    <n-spin\n      :show=\"loading\"\n      :size=\"14\"\n      :class=\"{ 'cursor-wait': loading }\"\n      class=\"flex\"\n    >\n      <n-button\n        ref=\"buttonRef\"\n        style=\"margin: 0\"\n        v-bind=\"$attrs\"\n        :class=\"props.class\"\n        @click=\"handleClick\"\n      >\n        <template v-if=\"$slots['icon']\" #icon>\n          <slot name=\"icon\"></slot>\n        </template>\n        <slot></slot>\n      </n-button>\n    </n-spin>\n  </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useCreate } from '../../_hooks/create'\nimport { npButtonProps } from './props'\nimport { NButton, NSpin } from 'naive-ui'\nimport { throttle } from 'lodash-es'\nimport { computed, ref, useAttrs, type CSSProperties } from 'vue'\nimport { run } from '../../utils'\n\nconst { bemClass } = useCreate('np-button')\n\n\n\nconst props = defineProps(npButtonProps)\n\nconst emit = defineEmits<{\n  (event: 'click', e?: MouseEvent): void\n}>()\n\nconst wrapperStyle = computed(() => {\n  const _style: CSSProperties = {}\n  const attrs = useAttrs()\n  const { style = {} } = attrs as { style: CSSProperties }\n  if (style.width) {\n    _style.width = style.width\n  }\n  return style\n})\n\nconst loading = ref(false)\nlet timer: any\nconst handleClick = throttle(\n  (e?: MouseEvent) => {\n    if (timer !== undefined) {\n      return\n    }\n    if (props.click !== undefined) {\n      timer = setTimeout(() => {\n        loading.value = true\n      }, 300)\n      run(props.click, e)\n        .then(() => {})\n        .finally(() => {\n          clearTimeout(timer)\n          timer = undefined\n          loading.value = false\n        })\n    } else {\n      emit('click', e)\n    }\n  },\n  350,\n  {\n    leading: true,\n    trailing: false,\n  }\n)\n\nconst buttonRef = ref()\ndefineExpose(\n  new Proxy(\n    {},\n    {\n      get(_, p) {\n        if (p === 'click') {\n          return handleClick\n        }\n        return buttonRef.value?.[p]\n      },\n      has(_, p) {\n        if (p === 'click') {\n          return true\n        }\n        return p in buttonRef.value\n      },\n    }\n  )\n)\n</script>\n","import { withInstall } from '../utils'\nimport _NpButton from './src/np-button.vue'\n\nexport const NpButton = withInstall(_NpButton)\nexport default NpButton\n\nexport * from './src/props'\n","import type { App } from 'vue'\nimport { NpButton } from './np-button'\n\nexport * from './np-button'\n\nconst components = [NpButton]\n\nexport function install(app: App) {\n  components.forEach((item) => {\n    if (item.install!) {\n      app.use(item)\n    } else if (item.name) {\n      app.component(item.name, item)\n    }\n  })\n}\n\nexport default {\n  install,\n}\n"],"names":["makeStringProp","defaultVal","withInstall","options","app","name","obj","isFunction","val","isPromise","run","args","result","resolvedResult","prefixName","useCreate","componentName","bemClass","ref","watch","extClass","key","npButtonProps","freeGlobal","freeSelf","root","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","getRawTag","value","isOwn","tag","unmasked","objectToString","nullTag","undefinedTag","baseGetTag","isObjectLike","symbolTag","isSymbol","reWhitespace","trimmedEndIndex","string","index","reTrimStart","baseTrim","isObject","type","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","toNumber","other","isBinary","now","FUNC_ERROR_TEXT","nativeMax","nativeMin","debounce","func","wait","lastArgs","lastThis","maxWait","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","invokeFunc","time","thisArg","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","throttle","__default__","__MACROS_defineComponent","wrapperStyle","computed","attrs","useAttrs","style","loading","timer","handleClick","e","props","emit","buttonRef","__expose","_","p","NpButton","_NpButton","components","install","item"],"mappings":"kTA2BA,MAAMA,EAAkBC,IAAwB,CAC9C,KAAM,OACN,QAASA,CACX,GCbaC,GACXC,IAGQA,EAAA,QAAWC,GAAa,CACxB,KAAA,CAAE,KAAAC,CAAS,EAAAF,EACbE,GACED,EAAA,UAAUC,EAAMF,CAAO,CAE7B,EAEKA,GC3BHG,EAAM,OAAO,UAAU,SAOtB,SAASC,GAAWC,EAA2B,CAElD,OAAAF,EAAI,KAAKE,CAAG,IAAM,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