import { h } from './chunks/d4789960.js';
import './chunks/456564be.js';
import './chunks/c26036df.js';
import { u as useEvent } from './chunks/d4058887.js';
import { a as useRef } from './chunks/4ccc6eeb.js';
import { g as getComponentOrDefine } from './chunks/071ed725.js';
import './chunks/23e44913.js';
import './chunks/a02c5734.js';
import './chunks/d76d6172.js';
import './kun-icon.js';
import './chunks/e5702756.js';
import './kun-image.js';
import { m as mockStyle } from './chunks/b7110801.js';
import { e as execWithSixLoad } from './chunks/cf049716.js';
import { r as requestUploadFile1 } from './chunks/ba37e29a.js';

const Comp = () => {
  const refLabel = useRef();
  const updateImg = useEvent("MyChange", {
    composed: true,
    bubbles: true
  });

  const updateImageFile = async event => {
    console.log("upload image");
    await execWithSixLoad(async () => {
      const file = event.target.files[0];
      const formData = new FormData();
      formData.set("file", file);
      const r = await requestUploadFile1(formData);
      updateImg({
        url: r.msg
      });
    });
  };

  const clk = () => {
    console.log("clik");
    refLabel.current.click();
  };

  return h("host", null, h("style", null, mockStyle), h("div", {
    class: "flex flex-row"
  }, h("kun-icon", {
    iconType: "tupian",
    iconWidth: 18,
    iconHeight: 18,
    onclick: clk
  }), h("div", {
    className: "none display-none hidden ml-4 cursor-pointer rounded-lg flex leading-normal bg-orange-400 text-white h-8 px-8 items-center"
  }, "\u56FE\u7247"), h("input", {
    type: "file",
    className: "none display-none hidden",
    ref: refLabel,
    id: "asd",
    onchange: evt => updateImageFile(evt),
    ignore: true
  })));
};

Comp.props = {};
var kunImageUpload = getComponentOrDefine("kun-image-upload", Comp);

export default kunImageUpload;
//# sourceMappingURL=kun-image-upload.js.map
