import { defineComponent, toRefs, computed, openBlock, createElementBlock, unref, createElementVNode } from "vue";
const _hoisted_1 = { class: "go-border-box" };
const _hoisted_2 = ["width", "height"];
const _hoisted_3 = ["d"];
const _hoisted_4 = /* @__PURE__ */ createElementVNode("stop", {
  offset: "0%",
  "stop-color": "#fff",
  "stop-opacity": "1"
}, null, -1);
const _hoisted_5 = /* @__PURE__ */ createElementVNode("stop", {
  offset: "100%",
  "stop-color": "#fff",
  "stop-opacity": "0"
}, null, -1);
const _hoisted_6 = [
  _hoisted_4,
  _hoisted_5
];
const _hoisted_7 = ["fill"];
const _hoisted_8 = ["dur", "path"];
const _hoisted_9 = ["fill", "points"];
const _hoisted_10 = ["stroke", "xlink:href"];
const _hoisted_11 = ["stroke", "xlink:href", "mask"];
const _hoisted_12 = ["from", "to", "dur"];
const __default__ = defineComponent({ name: "EBorder08" });
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const getUUID = (randomLength = 10) => {
      return Number(
        Math.random().toString().substring(2, randomLength) + Date.now()
      ).toString(36);
    };
    const path = `border-box-08-path-${getUUID()}`;
    const gradient = `border-box-08-gradient-${getUUID()}`;
    const mask = `border-box-08-mask-${getUUID()}`;
    const { w, h } = toRefs(props.chartConfig.attr);
    const { colors, dur, backgroundColor, reverse } = toRefs(
      props.chartConfig.option
    );
    const length = computed(() => {
      return (w.value + h.value - 5) * 2;
    });
    const pathD = computed(() => {
      if (reverse.value)
        return `M 2.5, 2.5 L 2.5, ${h.value - 2.5} L ${w.value - 2.5}, ${h.value - 2.5} L ${w.value - 2.5}, 2.5 L 2.5, 2.5`;
      return `M2.5, 2.5 L${w.value - 2.5}, 2.5 L${w.value - 2.5}, ${h.value - 2.5} L2.5, ${h.value - 2.5} L2.5, 2.5`;
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        (openBlock(), createElementBlock("svg", {
          width: unref(w),
          height: unref(h)
        }, [
          createElementVNode("defs", null, [
            createElementVNode("path", {
              id: path,
              d: unref(pathD),
              fill: "transparent"
            }, null, 8, _hoisted_3),
            createElementVNode("radialGradient", {
              id: gradient,
              cx: "50%",
              cy: "50%",
              r: "50%"
            }, _hoisted_6),
            createElementVNode("mask", { id: mask }, [
              createElementVNode("circle", {
                cx: "0",
                cy: "0",
                r: "150",
                fill: `url(#${gradient})`
              }, [
                createElementVNode("animateMotion", {
                  dur: `${unref(dur)}s`,
                  path: unref(pathD),
                  rotate: "auto",
                  repeatCount: "indefinite"
                }, null, 8, _hoisted_8)
              ], 8, _hoisted_7)
            ])
          ]),
          createElementVNode("polygon", {
            fill: unref(backgroundColor),
            points: `5, 5 ${unref(w) - 5}, 5 ${unref(w) - 5} ${unref(h) - 5} 5, ${unref(h) - 5}`
          }, null, 8, _hoisted_9),
          createElementVNode("use", {
            stroke: unref(colors)[0],
            "stroke-width": "1",
            "xlink:href": `#${path}`
          }, null, 8, _hoisted_10),
          createElementVNode("use", {
            stroke: unref(colors)[1],
            "stroke-width": "3",
            "xlink:href": `#${path}`,
            mask: `url(#${mask})`
          }, [
            createElementVNode("animate", {
              attributeName: "stroke-dasharray",
              from: `0, ${unref(length)}`,
              to: `${unref(length)}, 0`,
              dur: `${unref(dur)}s`,
              repeatCount: "indefinite"
            }, null, 8, _hoisted_12)
          ], 8, _hoisted_11)
        ], 8, _hoisted_2))
      ]);
    };
  }
});
export { _sfc_main as default };
