"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const comp = require("../../ui/src/comp.js");
require("../../ui/index.js");
const util = require("./util.js");
const XEUtils = require("xe-utils");
const event = require("../../../../@vxe-ui/core/es/src/event.js");
const VxeCarouselItemComponent = comp.defineVxeComponent({
  name: "VxeCarouselItem",
  props: {
    name: [String, Number],
    className: String,
    url: String
  },
  emits: [],
  setup(props, context) {
    const { slots, emit } = context;
    const $xeCarousel = vue.inject("$xeCarousel", null);
    const xID = XEUtils.uniqueId();
    const refElem = vue.ref();
    const reactData = vue.reactive({});
    const itemConfig = vue.reactive({
      id: xID,
      name: props.name,
      url: props.url,
      className: props.className,
      slots
    });
    const refMaps = {
      refElem
    };
    const computeMaps = {};
    const $xeCarouselItem = {
      xID,
      props,
      context,
      reactData,
      getRefMaps: () => refMaps,
      getComputeMaps: () => computeMaps
    };
    const dispatchEvent = (type, params, evnt) => {
      emit(type, event.createEvent(evnt, { $carouselItem: $xeCarouselItem }, params));
    };
    const carouselItemMethods = {
      dispatchEvent
    };
    const carouselItemPrivateMethods = {};
    Object.assign($xeCarouselItem, carouselItemMethods, carouselItemPrivateMethods);
    const renderVN = () => {
      return vue.h("div", {
        ref: refElem
      });
    };
    vue.watch(() => props.name, (val) => {
      itemConfig.name = val;
    });
    vue.watch(() => props.url, (val) => {
      itemConfig.url = val;
    });
    vue.onMounted(() => {
      const elem = refElem.value;
      if ($xeCarousel && elem) {
        util.assembleCarouselItem($xeCarousel, elem, itemConfig);
      }
    });
    vue.onUnmounted(() => {
      if ($xeCarousel) {
        util.destroyCarouselItem($xeCarousel, itemConfig);
      }
    });
    $xeCarouselItem.renderVN = renderVN;
    return $xeCarouselItem;
  },
  render() {
    return this.renderVN();
  }
});
exports.default = VxeCarouselItemComponent;
