import { _ as __nuxt_component_0 } from './IssueHeader-BKlqeUoH.mjs';
import { _ as __nuxt_component_0$1 } from './nuxt-link-Cq8xZgFP.mjs';
import { defineComponent, withAsyncContext, computed, mergeProps, unref, withCtx, createTextVNode, toDisplayString, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrInterpolate } from 'vue/server-renderer';
import { _ as _export_sfc, j as useRoute, u as useI18n, a as useHead } from './server.mjs';
import { u as useFetch } from './fetch-B5NxMLIO.mjs';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'stream';
import 'events';
import 'http';
import 'crypto';
import 'buffer';
import 'zlib';
import 'https';
import 'net';
import 'tls';
import 'url';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'vue-router';
import '@prisma/client';
import '@prisma/adapter-better-sqlite3';
import 'fs';
import 'path';
import 'fs/promises';
import 'child_process';
import 'node:child_process';
import 'node:url';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';
import '@vue/shared';

const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "prompt",
  __ssrInlineRender: true,
  async setup(__props) {
    let __temp, __restore;
    const route = useRoute();
    const { locale } = useI18n();
    const issueId = route.params["id"];
    const columnSlug = route.params["column"];
    const { data: issue } = ([__temp, __restore] = withAsyncContext(() => useFetch(`/api/issues/${issueId}`, "$cZ6-GFSir3")), __temp = await __temp, __restore(), __temp);
    const issueForHeader = computed(() => {
      if (!issue.value) return null;
      const header = {
        id: issue.value.key,
        title: issue.value.title,
        column: issue.value.column_slug
      };
      if (issue.value.priority) header.priority = issue.value.priority;
      return header;
    });
    const {
      data: prompt2,
      status: promptStatus,
      error: promptError
    } = ([__temp, __restore] = withAsyncContext(() => useFetch(`/api/columns/${columnSlug}/prompt`, {
      query: { lang: locale.value }
    }, "$s9GIcvnBUu")), __temp = await __temp, __restore(), __temp);
    useHead({
      title: `Prompt ${columnSlug} - ${issueId} - AutoCode`
    });
    return (_ctx, _push, _parent, _attrs) => {
      const _component_IssueHeader = __nuxt_component_0;
      const _component_NuxtLink = __nuxt_component_0$1;
      _push(`<div${ssrRenderAttrs(mergeProps({ class: "prompt-page" }, _attrs))} data-v-9385d4f2>`);
      _push(ssrRenderComponent(_component_IssueHeader, {
        issue: unref(issueForHeader),
        "active-tab": "history"
      }, null, _parent));
      _push(`<div class="card" data-v-9385d4f2><div class="section-header" data-v-9385d4f2><h2 data-v-9385d4f2>${ssrInterpolate(_ctx.$t("history.viewPrompt"))}</h2><span class="column-badge" data-v-9385d4f2>${ssrInterpolate(unref(columnSlug))}</span></div>`);
      if (unref(promptStatus) === "pending") {
        _push(`<div class="loading" data-v-9385d4f2>${ssrInterpolate(_ctx.$t("app.loading"))}</div>`);
      } else if (unref(promptError)) {
        _push(`<div class="error-message" data-v-9385d4f2>${ssrInterpolate(unref(promptError).message)}</div>`);
      } else if (!unref(prompt2)?.content) {
        _push(`<div class="empty" data-v-9385d4f2>${ssrInterpolate(_ctx.$t("column.noPrompt"))}</div>`);
      } else {
        _push(`<div class="prompt-content" data-v-9385d4f2><pre data-v-9385d4f2>${ssrInterpolate(unref(prompt2).content)}</pre></div>`);
      }
      _push(`</div><div class="actions" data-v-9385d4f2>`);
      _push(ssrRenderComponent(_component_NuxtLink, {
        to: `/issue/${unref(issueId)}/history`,
        class: "btn-secondary"
      }, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`${ssrInterpolate(_ctx.$t("nav.back"))}`);
          } else {
            return [
              createTextVNode(toDisplayString(_ctx.$t("nav.back")), 1)
            ];
          }
        }),
        _: 1
      }, _parent));
      _push(`</div></div>`);
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/issue/[id]/[column]/prompt.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const prompt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9385d4f2"]]);

export { prompt as default };
//# sourceMappingURL=prompt-evT7Aaj_.mjs.map
