import '@das-fed/ui/packages/components/preview/style.css';
import { withInstall as f } from "@das-fed/utils/with-install/index";
import { getLang as m, t as u, setI18nRule as d } from "@das-fed/web/packages/i18n/index";
import { defineComponent as w, createElementBlock as v, openBlock as g, unref as i, renderSlot as _, createVNode as h, withCtx as k, createTextVNode as x, toDisplayString as $ } from "vue";
import { DasButton as I } from "@das-fed/ui/packages/components/button/index";
import { getPersonalInfo as P, getToken as C } from "@das-fed/utils/common-info";
import { pureImageSrc as U } from "@das-fed/utils/pure-image-src";
const y = (e) => {
  const r = P(), t = location.origin, o = e.host ?? t, s = "/web-apps/preview.html";
  return e.userid ?? r.id, e.username ?? r.name, { preview: () => {
    let n = e.fileUrl;
    const l = m().value, c = C();
    n.startsWith("http") || (n = `${t}${U(n)}`);
    const p = `${o}${s}?access_token=${c}&lang=${l}&fileUrl=${n}`;
    window.open(p);
  } };
}, N = /* @__PURE__ */ w({
  __name: "Index",
  props: {
    host: {},
    fileUrl: {},
    lang: { default: "zh-CN" },
    mode: { default: "view" },
    userid: {},
    username: {}
  },
  setup(e, { expose: r }) {
    const t = e, { preview: o } = y(t);
    return r({ preview: o }), (s, a) => (g(), v("div", {
      class: "das-preview-container",
      onClick: a[0] || (a[0] = //@ts-ignore
      (...n) => i(o) && i(o)(...n))
    }, [
      _(s.$slots, "default", {}, () => [
        h(i(I), {
          "btn-type": "primary-text",
          size: "large",
          block: ""
        }, {
          default: k(() => [
            x(
              $(i(u)("das-preview-text")),
              1
              /* TEXT */
            )
          ]),
          _: 1
          /* STABLE */
        })
      ], !0)
    ]));
  }
}), b = (e, r) => {
  const t = e.__vccOpts || e;
  for (const [o, s] of r)
    t[o] = s;
  return t;
}, z = /* @__PURE__ */ b(N, [["__scopeId", "data-v-9643931e"]]), B = { "das-preview-text": { "zh-CN": "预览", en: "Preview", _appCode: "framework" } }, L = f(z);
d(B);
export {
  L as DasPreview,
  L as default
};
