import { defineComponent, ref, reactive, computed, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrInterpolate, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrRenderAttr, ssrRenderClass } from 'vue/server-renderer'; import { u as useApi } from './useApi-BNSkSrat.mjs'; import { u as useToast } from './useToast-MBvLaNjH.mjs'; import { A as ALL_LANG_OPTIONS, l as langName } from './useLangOptions-CXXbv5NM.mjs'; import { _ as _export_sfc } from './server.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'pinia'; import 'perfect-debounce'; const PRIMARY_LANG = "zh-CN"; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "meettemplates", __ssrInlineRender: true, setup(__props) { const SYNC_FIELDS = [ { key: "ttype", label: "类型 ttype" }, { key: "tags", label: "标签 tags" }, { key: "icon", label: "图标 icon" }, { key: "title", label: "标题 title", translated: true }, { key: "description", label: "描述 description", translated: true }, { key: "outline", label: "大纲 outline", translated: true }, { key: "template", label: "模板内容 template", translated: true } ]; useApi(); useToast(); const view = ref("list"); const rows = ref([]); const loading = ref(false); const detailLoading = ref(false); const submitting = ref(false); const catFilter = ref(""); const typeFilter = ref(""); const kwFilter = ref(""); const current = ref(null); const curLang = ref(""); const form = reactive({ id: 0, title: "", tid: "", language: "", ttype: "", tags: "", icon: "", description: "", outline: "", template: "" }); const syncOpen = ref(false); const syncFields = ref([]); const syncLangs = ref([]); const addLangOpen = ref(false); const newLang = ref(""); const newLangErr = ref(""); const createOpen = ref(false); const createTid = ref(""); const createTitle = ref(""); const createLang = ref(PRIMARY_LANG); const createErr = ref(""); function tagList(s) { return (s || "").split(",").map((x) => x.trim()).filter(Boolean); } function isImg(s) { return /^https?:\/\//i.test(s || ""); } function isPrimary(lang) { return lang === PRIMARY_LANG; } function catOf(tid) { const i = (tid || "").indexOf("-"); return i > 0 ? tid.slice(0, i) : "其他"; } function initials(c) { const t = (c.primary.title || c.tid || "?").trim(); return t.slice(0, 1).toUpperCase(); } const cards = computed(() => { const byTid = /* @__PURE__ */ new Map(); rows.value.forEach((t) => { const k = t.tid || ""; if (!byTid.has(k)) byTid.set(k, []); byTid.get(k).push(t); }); const out = []; byTid.forEach((items, tid) => { const langs = items.slice().sort((a, b) => { if (isPrimary(a.language) !== isPrimary(b.language)) return isPrimary(a.language) ? -1 : 1; return (a.language || "") < (b.language || "") ? -1 : 1; }); const zh = langs.find((t) => isPrimary(t.language)); out.push({ tid, primary: zh || langs[0], hasPrimary: !!zh, langs }); }); return out.sort((a, b) => a.tid < b.tid ? -1 : 1); }); const catOptions = computed( () => Array.from(new Set(cards.value.map((c) => catOf(c.tid)))).sort() ); const typeOptions = computed( () => Array.from(new Set(rows.value.map((t) => t.ttype).filter(Boolean))).sort() ); const filteredCards = computed(() => { const kw = kwFilter.value.trim().toLowerCase(); return cards.value.filter((c) => { if (catFilter.value && catOf(c.tid) !== catFilter.value) return false; if (typeFilter.value && c.primary.ttype !== typeFilter.value) return false; if (!kw) return true; return `${c.tid} ${c.primary.title} ${c.primary.description}`.toLowerCase().includes(kw); }); }); const otherLangs = computed( () => (current.value?.langs ?? []).map((t) => t.language).filter((l) => l && l !== curLang.value) ); const addableLangs = computed(() => { const has = new Set((current.value?.langs ?? []).map((t) => t.language)); return ALL_LANG_OPTIONS.filter((o) => !has.has(o.code)); }); return (_ctx, _push, _parent, _attrs) => { _push(``); if (view.value === "list") { _push(`

会议模板

会议纪要公共模板(source=public),所有应用共享。同一 tid 下每种语言一份,卡面展示 ${ssrInterpolate(PRIMARY_LANG)} 版本。修改后各服务约 10 分钟内自动同步。

${ssrInterpolate(cards.value.length)} 个模板 · ${ssrInterpolate(rows.value.length)} 个语言版本 · 命中 ${ssrInterpolate(filteredCards.value.length)}
`); if (loading.value) { _push(`
`); } else if (!filteredCards.value.length) { _push(`
${ssrInterpolate(rows.value.length ? "当前筛选下没有匹配的模板" : "暂无模板,点击右上角「新增模板」创建")}
`); } else { _push(`
`); ssrRenderList(filteredCards.value, (c) => { _push(`
`); if (isImg(c.primary.icon)) { _push(``); } else { _push(`${ssrInterpolate(initials(c))}`); } _push(`
${ssrInterpolate(c.primary.title || "(未命名)")}
${ssrInterpolate(c.tid || "无 tid")}
${ssrInterpolate(c.primary.description || "(无描述)")}
`); if (c.primary.ttype) { _push(`${ssrInterpolate(c.primary.ttype)}`); } else { _push(``); } _push(``); ssrRenderList(tagList(c.primary.tags), (tag, i) => { _push(`${ssrInterpolate(tag)}`); }); _push(`
${ssrInterpolate(c.langs.length)} 种语言`); if (!c.hasPrimary) { _push(`缺 ${ssrInterpolate(PRIMARY_LANG)},按 ${ssrInterpolate(c.primary.language)} 展示`); } else { _push(``); } _push(`查看 →
`); }); _push(`
`); } _push(`
`); } else if (view.value === "detail" && current.value) { _push(`

${ssrInterpolate(form.title || current.value.tid)}

${ssrInterpolate(current.value.tid)} · ${ssrInterpolate(current.value.langs.length)} 种语言
语言版本`); ssrRenderList(current.value.langs, (l) => { _push(``); }); _push(`
`); if (detailLoading.value) { _push(`
`); } else { _push(`
${ssrInterpolate(curLang.value)}${ssrInterpolate(unref(langName)(curLang.value))}`); if (isPrimary(curLang.value)) { _push(`主语言`); } else { _push(``); } _push(`id ${ssrInterpolate(form.id)}
`); ssrRenderList(typeOptions.value, (t) => { _push(``); }); _push(`
`); } _push(`
`); } else { _push(``); } if (syncOpen.value) { _push(``); } else { _push(``); } if (addLangOpen.value) { _push(``); } else { _push(``); } if (createOpen.value) { _push(``); } else { _push(``); } _push(``); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/meettemplates.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const meettemplates = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5eb39361"]]); export { meettemplates as default }; //# sourceMappingURL=meettemplates-BbY84yBS.mjs.map