vue-layout-gitcode 1.12.55-multiple-account → 1.12.56-multiple-account

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
- import { ref, watchEffect, defineComponent, toDisplayString, unref, useModel, watch, openBlock, createElementBlock, createVNode, normalizeClass, withDirectives, createElementVNode, vShow, mergeModels, inject, withModifiers, createBlock, Fragment, computed, normalizeStyle, createCommentVNode, createTextVNode, onMounted, onUnmounted, renderList, withCtx, reactive } from "vue";
2
- import debounce from "lodash/debounce";
3
- import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, r as reqCatch, f as useRequestReport, h as headRequest, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, j as useCookie, k as usePageResize, L as LANG_ZH, m as isGstarRepo, n as _sfc_main$b, o as isIncubationRepo, p as highlightWords, t as transformUrl, q as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, w as LANG_KEY } from "./index-cvKRePGR.js";
4
- import { t as transWebUrl } from "./transWebUrl-DdydDOiv.js";
1
+ import { defineComponent, toDisplayString, unref, useModel, ref, watch, openBlock, createElementBlock, createVNode, normalizeClass, withDirectives, createElementVNode, vShow, mergeModels, inject, withModifiers, createBlock, Fragment, computed, normalizeStyle, createCommentVNode, createTextVNode, renderList, withCtx, reactive, onMounted, watchEffect } from "vue";
2
+ import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, r as reqCatch, e as useRequestReport, h as headRequest, a as i18n, T as TOPIC_TYPE, f as useTimeFormat, g as useCookie, j as usePageResize, L as LANG_ZH, k as isGstarRepo, m as _sfc_main$b, o as isIncubationRepo, p as highlightWords, t as transformUrl, q as _frEventTrack, E as EVENT_NAME, w as REPO_TYPE, x as extractRepoInfoWithURL, y as LANG_KEY } from "./index-DaQYEtqo.js";
3
+ import { t as transWebUrl } from "./transWebUrl-BQaSzm_8.js";
5
4
  import { useRouter } from "vue-router";
6
5
  import { Row, Col } from "vue-devui-lal/grid";
7
6
  import { Skeleton, SkeletonItem } from "vue-devui-lal/skeleton";
@@ -9,74 +8,7 @@ import "vue-devui-lal/grid/style.css";
9
8
  import "vue-devui-lal/skeleton/style.css";
10
9
  import { Popover } from "vue-devui-lal/popover";
11
10
  import "vue-devui-lal/popover/style.css";
12
- const useReportRepo = (reportParams, viewReport) => {
13
- const list = ref([]);
14
- const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
15
- const locationHref = ref((window == null ? void 0 : window.location.href) || "");
16
- const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
17
- const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
18
- const triggerReport = (type, data) => {
19
- if (type === "click") {
20
- const params = {
21
- chat_title: "",
22
- related: {
23
- list: [formatItem(data)],
24
- type: "repo"
25
- }
26
- };
27
- viewReport(pageRef.value, locationHref.value, "click", params);
28
- } else if (type === "expo") {
29
- list.value.push(data);
30
- }
31
- };
32
- const formatItem = (data) => {
33
- const channelNames = [];
34
- if (data.channelName) channelNames.push(data.channelName);
35
- if (data.subChannelName) channelNames.push(data.subChannelName);
36
- const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
37
- return {
38
- type: "gitcode",
39
- repo_id: repoId,
40
- dest_url: data.web_url,
41
- strategy: channelNames.join("、") || "",
42
- // 官方项目
43
- repo_index: data.index,
44
- page: data.pageIndex || data.p || 0,
45
- per_page: data.pageSize || data.pp || 0,
46
- q: data.keyword || ""
47
- };
48
- };
49
- const doReport = debounce(() => {
50
- if (list.value.length >= 1) {
51
- const reportList = list.value.splice(0).map((item) => {
52
- return formatItem(item);
53
- });
54
- const params = {
55
- chat_title: "",
56
- extend_json: {
57
- key_words: keyword.value,
58
- module_name: moduleName.value
59
- },
60
- related: {
61
- list: reportList,
62
- type: "repo"
63
- }
64
- };
65
- viewReport(pageRef.value, locationHref.value, "expo", params);
66
- }
67
- }, 500, { leading: false });
68
- watchEffect(() => {
69
- if (list.value.length) {
70
- doReport();
71
- }
72
- });
73
- return {
74
- triggerReport
75
- };
76
- };
77
- const formatNameSpace = (content) => {
78
- return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
79
- };
11
+ import debounce from "lodash/debounce";
80
12
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
81
13
  __name: "index",
82
14
  props: {
@@ -91,8 +23,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
91
23
  };
92
24
  }
93
25
  });
94
- const _hoisted_1$8 = { class: "relative flex" };
95
- const _hoisted_2$6 = { class: "absolute w-full h-full left-0 top-0" };
26
+ const _hoisted_1$8 = { class: "g-like" };
27
+ const _hoisted_2$6 = { class: "g-like__overlay" };
96
28
  const ANIM_END = "animEnd";
97
29
  const activeLikeIcon = "gt-plane-like";
98
30
  const unActiveLikeIcon = "gt-line-like";
@@ -127,7 +59,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
127
59
  return (_ctx, _cache) => {
128
60
  return openBlock(), createElementBlock("div", _hoisted_1$8, [
129
61
  createVNode(GIcon, {
130
- class: normalizeClass({ "!text-red-500": active.value }),
62
+ class: normalizeClass({ "g-like__active": active.value }),
131
63
  name: active.value ? activeLikeIcon : unActiveLikeIcon
132
64
  }, null, 8, ["class", "name"]),
133
65
  withDirectives(createElementVNode("div", _hoisted_2$6, [
@@ -136,7 +68,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
136
68
  onAnimationend: animationend
137
69
  }, [
138
70
  createVNode(GIcon, {
139
- class: "!text-red-500",
71
+ class: "g-like__active",
140
72
  name: activeLikeIcon
141
73
  })
142
74
  ], 32)
@@ -149,7 +81,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
149
81
  });
150
82
  const Like = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-vue-layout-gitcode"]]);
151
83
  const _hoisted_1$7 = {
152
- class: "mr-[4px]",
84
+ class: "i-star-tag__icon-wrap",
153
85
  style: { "width": "15px", "height": "15px" }
154
86
  };
155
87
  const _hoisted_2$5 = { class: "i-star-tag__text" };
@@ -220,14 +152,14 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
220
152
  }])
221
153
  }, [
222
154
  createElementVNode("span", {
223
- class: normalizeClass(["i-star-tag hover:bg-[var(--theme-btn-default-hover)]", {
155
+ class: normalizeClass(["i-star-tag", {
224
156
  "i-star-tag__active": starred.value
225
157
  }]),
226
158
  onClick: withModifiers(handleStar, ["stop", "prevent"])
227
159
  }, [
228
160
  __props.isLike ? (openBlock(), createBlock(Like, {
229
161
  key: 0,
230
- class: "mr-[4px]",
162
+ class: "i-star-tag__icon-mr",
231
163
  modelValue: starred.value,
232
164
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => starred.value = $event),
233
165
  runAnimation: running.value,
@@ -272,7 +204,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
272
204
  return (_ctx, _cache) => {
273
205
  return openBlock(), createElementBlock("div", _hoisted_1$6, [
274
206
  createVNode(GIcon, {
275
- class: "mr-[4px]",
207
+ class: "fork-tag__icon",
276
208
  name: "gt-line-fork",
277
209
  color: "var(--theme-home-card-color-placeholder)",
278
210
  size: "14"
@@ -290,7 +222,7 @@ const ForkTag = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
290
222
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
291
223
  __name: "index",
292
224
  props: {
293
- tagInfo: { default: [] },
225
+ tagInfo: { default: () => [] },
294
226
  type: {}
295
227
  },
296
228
  setup(__props) {
@@ -298,15 +230,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
298
230
  const isTag = computed(() => props.type === "tag");
299
231
  const languageTag = props.tagInfo[0] || "";
300
232
  const tagColor = props.tagInfo[1] || "#00ADD8";
301
- computed(() => {
302
- if (isTag.value) {
303
- return {
304
- background: tagColor,
305
- opacity: 0.1
306
- };
307
- }
308
- return {};
309
- });
310
233
  const tagFontColor = computed(() => {
311
234
  if (isTag.value) {
312
235
  return { color: tagColor };
@@ -324,7 +247,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
324
247
  style: normalizeStyle({ background: unref(tagColor), opacity: 0.1 })
325
248
  }, null, 4)) : createCommentVNode("", true),
326
249
  createElementVNode("i", {
327
- class: "mr-[4px]",
328
250
  style: normalizeStyle({ background: unref(tagColor) })
329
251
  }, null, 4),
330
252
  createTextVNode(toDisplayString(unref(languageTag)), 1)
@@ -364,7 +286,7 @@ const _hoisted_1$4 = {
364
286
  key: 0,
365
287
  class: "github-star-num"
366
288
  };
367
- const _hoisted_2$3 = { class: "leading-none" };
289
+ const _hoisted_2$3 = { class: "github-star-num__count" };
368
290
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
369
291
  ...{ name: "GithubStarNum" },
370
292
  __name: "index",
@@ -395,7 +317,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
395
317
  }
396
318
  });
397
319
  const GithubStarNum = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-vue-layout-gitcode"]]);
398
- const _hoisted_1$3 = { class: "repo-card-footer mt-[4px]" };
320
+ const _hoisted_1$3 = { class: "repo-card-footer" };
399
321
  const _hoisted_2$2 = {
400
322
  key: 3,
401
323
  class: "line-separator"
@@ -409,12 +331,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
409
331
  __name: "index",
410
332
  props: {
411
333
  repoInfo: {},
412
- hideTopicTags: { type: Boolean },
413
- tagInfo: {},
414
- hideUpdateTime: { type: Boolean },
415
- hideStarIncrease: { type: Boolean },
416
- hideStarCount: { type: Boolean },
417
- searchCard: { type: Boolean }
334
+ hideTopicTags: { type: Boolean, default: false },
335
+ tagInfo: { default: () => [] },
336
+ hideUpdateTime: { type: Boolean, default: false },
337
+ hideStarIncrease: { type: Boolean, default: false },
338
+ hideStarCount: { type: Boolean, default: false },
339
+ searchCard: { type: Boolean, default: false }
418
340
  },
419
341
  emits: ["topicClick"],
420
342
  setup(__props, { emit: __emit }) {
@@ -426,22 +348,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
426
348
  var _a;
427
349
  return ((_a = props.repoInfo.tags) == null ? void 0 : _a.filter((item) => item.type === TOPIC_TYPE.USER)) || [];
428
350
  });
429
- ref(topicNames.value);
430
- const visibleCount = ref(0);
431
- ref(false);
432
351
  const showUpdateTimeDot = computed(() => {
433
352
  return !props.hideUpdateTime && (!props.hideStarCount || props.tagInfo && props.tagInfo[0] || props.repoInfo.forks_count);
434
353
  });
435
- computed(() => {
436
- return topicNames.value.length - visibleCount.value + 1;
437
- });
438
354
  const handleTopicClick = (topic) => {
439
355
  emits("topicClick", topic);
440
356
  };
441
- onMounted(() => {
442
- });
443
- onUnmounted(() => {
444
- });
445
357
  return (_ctx, _cache) => {
446
358
  return openBlock(), createElementBlock(Fragment, null, [
447
359
  createElementVNode("div", null, [
@@ -490,6 +402,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
490
402
  }
491
403
  });
492
404
  const RepoCardFooter = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-vue-layout-gitcode"]]);
405
+ const formatNameSpace = (content) => {
406
+ return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
407
+ };
493
408
  const _hoisted_1$2 = { class: "new-tag-content" };
494
409
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
495
410
  __name: "index",
@@ -533,7 +448,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
533
448
  createElementVNode("span", _hoisted_1$2, toDisplayString(tagTipsText.value), 1)
534
449
  ]),
535
450
  default: withCtx(() => [
536
- _cache[0] || (_cache[0] = createElementVNode("div", { class: "new-tag w-[32px] h-[15px] text-[9px] text-[#ffffff] flex items-center justify-center leading-[1]" }, "New", -1))
451
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "new-tag" }, "New", -1))
537
452
  ]),
538
453
  _: 1
539
454
  })) : createCommentVNode("", true);
@@ -541,17 +456,17 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
541
456
  }
542
457
  });
543
458
  const NewTag = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-vue-layout-gitcode"]]);
544
- const _hoisted_1$1 = { class: "model-card-footer h-[22px] mt-[4px] flex items-center overflow-hidden whitespace-nowrap text-[14px] leading-[14px] text-[var(--theme-release-card-text-color)]" };
459
+ const _hoisted_1$1 = { class: "model-card-footer" };
545
460
  const _hoisted_2$1 = {
546
461
  key: 1,
547
- class: "ellipsis max-150 ml-[6px]"
462
+ class: "ellipsis max-150 model-card-footer__text"
548
463
  };
549
- const _hoisted_3$1 = { class: "ml-[6px]" };
550
- const _hoisted_4$1 = { class: "whitespace-nowrap overflow-hidden text-ellipsis" };
551
- const _hoisted_5$1 = { class: "ml-[6px]" };
464
+ const _hoisted_3$1 = { class: "model-card-footer__text" };
465
+ const _hoisted_4$1 = { class: "model-card-footer__time" };
466
+ const _hoisted_5$1 = { class: "model-card-footer__text" };
552
467
  const _hoisted_6$1 = {
553
468
  key: 2,
554
- class: "w-[4px] h-[4px] ml-[6px] mr-[6px] rounded-[2px] bg-[var(--theme-placeholder)]"
469
+ class: "model-card-footer__dot"
555
470
  };
556
471
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
557
472
  __name: "ModelCardFooter",
@@ -574,7 +489,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
574
489
  size: "12px"
575
490
  }, null, 8, ["name"])) : createCommentVNode("", true),
576
491
  projectData.value.task[0].name ? (openBlock(), createElementBlock("span", _hoisted_2$1, toDisplayString(projectData.value.task[0].name), 1)) : createCommentVNode("", true),
577
- _cache[0] || (_cache[0] = createElementVNode("div", { class: "w-[4px] h-[4px] ml-[6px] mr-[6px] rounded-[2px] bg-[var(--theme-placeholder)]" }, null, -1))
492
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "model-card-footer__dot" }, null, -1))
578
493
  ], 64)) : createCommentVNode("", true),
579
494
  projectData.value.model_param_size ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
580
495
  createVNode(GIcon, {
@@ -583,10 +498,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
583
498
  color: "var(--theme-release-card-text-color)"
584
499
  }),
585
500
  createElementVNode("span", _hoisted_3$1, toDisplayString(projectData.value.model_param_size), 1),
586
- _cache[1] || (_cache[1] = createElementVNode("div", { class: "w-[4px] h-[4px] ml-[6px] mr-[6px] rounded-[2px] bg-[var(--theme-placeholder)]" }, null, -1))
501
+ _cache[1] || (_cache[1] = createElementVNode("div", { class: "model-card-footer__dot" }, null, -1))
587
502
  ], 64)) : createCommentVNode("", true),
588
503
  createElementVNode("span", _hoisted_4$1, toDisplayString(unref(formatTimeFromNow)(projectData.value.updated_at)), 1),
589
- _cache[2] || (_cache[2] = createElementVNode("div", { class: "w-[4px] h-[4px] ml-[6px] mr-[6px] rounded-[2px] bg-[var(--theme-placeholder)]" }, null, -1)),
504
+ _cache[2] || (_cache[2] = createElementVNode("div", { class: "model-card-footer__dot" }, null, -1)),
590
505
  createVNode(GIcon, {
591
506
  name: "gt-line-upload",
592
507
  size: "14px",
@@ -608,10 +523,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
608
523
  };
609
524
  }
610
525
  });
526
+ const ModelCardFooter = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-vue-layout-gitcode"]]);
611
527
  const _hoisted_1 = ["innerHTML"];
612
528
  const _hoisted_2 = {
613
529
  key: 0,
614
- class: "is-recommend ml-[8px]"
530
+ class: "is-recommend"
615
531
  };
616
532
  const _hoisted_3 = { key: 1 };
617
533
  const _hoisted_4 = { key: 2 };
@@ -623,24 +539,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
623
539
  info: {},
624
540
  keyword: {},
625
541
  cardType: {},
626
- noborder: { type: Boolean },
627
- hover: { type: Boolean },
628
- hideTopicTags: { type: Boolean },
629
- urlParams: {},
630
- hideStarBtn: { type: Boolean },
631
- hideFooter: { type: Boolean },
632
- hideDescription: { type: Boolean }
542
+ noborder: { type: Boolean, default: false },
543
+ hover: { type: Boolean, default: false },
544
+ hideTopicTags: { type: Boolean, default: false },
545
+ urlParams: { default: () => ({}) },
546
+ preserveUrlOrigin: { type: Boolean, default: false },
547
+ hideStarBtn: { type: Boolean, default: false },
548
+ hideFooter: { type: Boolean, default: false },
549
+ hideDescription: { type: Boolean, default: false }
633
550
  },
634
551
  emits: ["report"],
635
552
  setup(__props, { emit: __emit }) {
636
553
  const lang = useCookie(LANG_KEY, LANG_ZH);
637
- const API = headRequest(inject("request"));
554
+ const request = inject("request") || (() => Promise.resolve({ data: {} }));
555
+ const API = headRequest(request);
638
556
  const emits = __emit;
639
557
  const router = useRouter();
640
558
  const { widthType } = usePageResize();
641
559
  const { t: $t } = i18n.global;
642
560
  const handleClick = () => {
643
- window.open(transWebUrl(transformUrl(props.info.web_url), props.urlParams), "_blank");
561
+ window.open(transWebUrl(transformUrl(props.info.web_url), props.urlParams, {
562
+ preserveOrigin: props.preserveUrlOrigin
563
+ }), "_blank");
644
564
  emits("report");
645
565
  _frEventTrack(EVENT_NAME.CLICK_SEARCH_RESULT);
646
566
  };
@@ -648,7 +568,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
648
568
  emits("report", "starReport");
649
569
  };
650
570
  const rowSpan = reactive({ xxl: 8, xl: 12, md: 12, lg: 24, sm: 24 });
651
- const repoIcon = { repo: "gt-line-repositories", model: "gt-plane-models", dataset: "gt-line-Datasets" };
571
+ const repoIcon = { repo: "gt-line-repositories", model: "gt-line-line-Models", dataset: "gt-line-Datasets" };
652
572
  const props = __props;
653
573
  console.log("i-search-projects-card", props.info, props.cardType);
654
574
  const iconName = computed(() => {
@@ -701,7 +621,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
701
621
  name_with_namespace: nameWithSpace,
702
622
  path_with_namespace: path,
703
623
  import_url: importUrl,
704
- is_gh_mirrors: isGhMirrors,
705
624
  is_mirrors: isMirrors
706
625
  } = info || {};
707
626
  const isGitcodeRepo = REPO_TYPE.GITCODE === isMirrors;
@@ -718,13 +637,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
718
637
  });
719
638
  return (_ctx, _cache) => {
720
639
  return openBlock(), createElementBlock("a", {
721
- class: normalizeClass(["i-search-projects-card cursor-pointer", { noborder: __props.noborder, "full-hover": __props.hover }]),
640
+ class: normalizeClass(["i-search-projects-card", { noborder: __props.noborder, "full-hover": __props.hover }]),
722
641
  onClick: handleClick
723
642
  }, [
724
643
  createVNode(unref(Row), { class: "i-search-projects-card-title" }, {
725
644
  default: withCtx(() => [
726
645
  createVNode(unref(Col), {
727
- class: "ellipsis flex items-center gap-[8px]",
646
+ class: "ellipsis i-search-projects-card-title__col",
728
647
  flex: "auto"
729
648
  }, {
730
649
  default: withCtx(() => {
@@ -791,7 +710,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
791
710
  !__props.hideDescription ? (openBlock(), createElementBlock("div", {
792
711
  key: 0,
793
712
  innerHTML: unref(highlightWords)("", description.value),
794
- class: "i-search-projects-card-desc ellipsis mt-[8px]"
713
+ class: "i-search-projects-card-desc ellipsis"
795
714
  }, null, 8, _hoisted_5)) : createCommentVNode("", true),
796
715
  __props.info.index === 0 && __props.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
797
716
  queryLoading.value ? (openBlock(), createBlock(unref(Skeleton), { key: 0 }, {
@@ -805,7 +724,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
805
724
  span: rowSpan[unref(widthType)]
806
725
  }, {
807
726
  default: withCtx(() => [
808
- createVNode(unref(SkeletonItem), { class: "h-[110px] mt-[16px]" })
727
+ createVNode(unref(SkeletonItem), { class: "i-search-projects-card-skel" })
809
728
  ]),
810
729
  _: 1
811
730
  }, 8, ["span"]),
@@ -813,7 +732,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
813
732
  span: rowSpan[unref(widthType)]
814
733
  }, {
815
734
  default: withCtx(() => [
816
- createVNode(unref(SkeletonItem), { class: "h-[110px] mt-[16px]" })
735
+ createVNode(unref(SkeletonItem), { class: "i-search-projects-card-skel" })
817
736
  ]),
818
737
  _: 1
819
738
  }, 8, ["span"]),
@@ -821,7 +740,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
821
740
  span: rowSpan[unref(widthType)]
822
741
  }, {
823
742
  default: withCtx(() => [
824
- createVNode(unref(SkeletonItem), { class: "h-[110px] mt-[16px]" })
743
+ createVNode(unref(SkeletonItem), { class: "i-search-projects-card-skel" })
825
744
  ]),
826
745
  _: 1
827
746
  }, 8, ["span"])
@@ -831,7 +750,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
831
750
  ]),
832
751
  _: 1
833
752
  })) : createCommentVNode("", true)
834
- ])) : isModel.value ? (openBlock(), createBlock(_sfc_main$1, {
753
+ ])) : isModel.value && !__props.hideFooter ? (openBlock(), createBlock(ModelCardFooter, {
835
754
  key: 2,
836
755
  repoInfo: __props.info
837
756
  }, null, 8, ["repoInfo"])) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
@@ -842,7 +761,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
842
761
  tagInfo: tagInfo.value,
843
762
  repoInfo: __props.info,
844
763
  searchCard: "",
845
- class: "i-search-projects-card-bottom mt-[8px]",
764
+ class: "i-search-projects-card-bottom",
846
765
  onTopicClick: handleTopicClick
847
766
  }, null, 8, ["hideTopicTags", "tagInfo", "repoInfo"])) : createCommentVNode("", true)
848
767
  ], 64))
@@ -851,8 +770,140 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
851
770
  }
852
771
  });
853
772
  const SearchRepoCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
773
+ const useReportRepo = (reportParams, viewReport) => {
774
+ const list = ref([]);
775
+ const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
776
+ const locationHref = ref((window == null ? void 0 : window.location.href) || "");
777
+ const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
778
+ const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
779
+ const triggerReport = (type, data) => {
780
+ if (type === "click") {
781
+ const params = {
782
+ chat_title: "",
783
+ related: {
784
+ list: [formatItem(data)],
785
+ type: "repo"
786
+ }
787
+ };
788
+ viewReport(pageRef.value, locationHref.value, "click", params);
789
+ } else if (type === "expo") {
790
+ list.value.push(data);
791
+ }
792
+ };
793
+ const formatItem = (data) => {
794
+ const channelNames = [];
795
+ if (data.channelName) channelNames.push(data.channelName);
796
+ if (data.subChannelName) channelNames.push(data.subChannelName);
797
+ const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
798
+ return {
799
+ type: "gitcode",
800
+ repo_id: repoId,
801
+ dest_url: data.web_url,
802
+ strategy: channelNames.join("、") || "",
803
+ // 官方项目
804
+ repo_index: data.index,
805
+ page: data.pageIndex || data.p || 0,
806
+ per_page: data.pageSize || data.pp || 0,
807
+ q: data.keyword || ""
808
+ };
809
+ };
810
+ const doReport = debounce(() => {
811
+ if (list.value.length >= 1) {
812
+ const reportList = list.value.splice(0).map((item) => {
813
+ return formatItem(item);
814
+ });
815
+ const params = {
816
+ chat_title: "",
817
+ extend_json: {
818
+ key_words: keyword.value,
819
+ module_name: moduleName.value
820
+ },
821
+ related: {
822
+ list: reportList,
823
+ type: "repo"
824
+ }
825
+ };
826
+ viewReport(pageRef.value, locationHref.value, "expo", params);
827
+ }
828
+ }, 500, { leading: false });
829
+ watchEffect(() => {
830
+ if (list.value.length) {
831
+ doReport();
832
+ }
833
+ });
834
+ return {
835
+ triggerReport
836
+ };
837
+ };
838
+ const normalizeOrigin = (origin) => {
839
+ const value = origin.trim().replace(/\/+$/, "");
840
+ if (!value) return "";
841
+ try {
842
+ const url = new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(value) ? value : `https://${value}`);
843
+ return url.origin;
844
+ } catch {
845
+ return value;
846
+ }
847
+ };
848
+ const getStringValue = (value) => typeof value === "string" ? value : "";
849
+ const normalizeProjectUrlForMainSite = (value, projectOrigin, currentOrigin) => {
850
+ const urlValue = getStringValue(value).trim();
851
+ if (!urlValue) return urlValue;
852
+ const mainOrigin = normalizeOrigin(projectOrigin) || normalizeOrigin(currentOrigin);
853
+ if (!mainOrigin) return urlValue;
854
+ try {
855
+ const mainSiteUrl = new URL(mainOrigin);
856
+ const projectUrl = new URL(urlValue, `${mainSiteUrl.origin}/`);
857
+ if (projectUrl.protocol !== "http:" && projectUrl.protocol !== "https:") return urlValue;
858
+ projectUrl.protocol = mainSiteUrl.protocol;
859
+ projectUrl.host = mainSiteUrl.host;
860
+ projectUrl.username = "";
861
+ projectUrl.password = "";
862
+ return projectUrl.toString();
863
+ } catch {
864
+ return urlValue;
865
+ }
866
+ };
867
+ const isProjectSuggestionType = (repoType) => {
868
+ if (repoType === void 0 || repoType === null || repoType === "") return true;
869
+ const normalizedType = String(repoType).trim().toLowerCase();
870
+ return !normalizedType || ["repo", "repository", "project", "0"].includes(normalizedType);
871
+ };
872
+ const convertDataList = ({ dataList, searchType, origin }) => {
873
+ if (!Array.isArray(dataList)) {
874
+ return { items: [] };
875
+ }
876
+ const baseOrigin = normalizeOrigin(origin);
877
+ const items = dataList.slice(0, 3).filter((item) => Boolean(item) && typeof item === "object" && !Array.isArray(item)).map((item) => {
878
+ const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
879
+ const importUrl = getStringValue(item.import_url);
880
+ const importedRepoName = importUrl ? extractRepoInfoWithURL(importUrl) : "";
881
+ const nameWithNamespace = getStringValue(item.name_with_namespace);
882
+ const pathWithNamespace = getStringValue(item.path_with_namespace);
883
+ const repoName = (isGitcodeRepo ? nameWithNamespace : importedRepoName) || nameWithNamespace || pathWithNamespace;
884
+ const displayName = formatNameSpace(repoName).join("/");
885
+ const path = `${baseOrigin}/${pathWithNamespace}`;
886
+ return {
887
+ ...item,
888
+ searchType,
889
+ path,
890
+ displayName,
891
+ web_url: path
892
+ };
893
+ });
894
+ return { items };
895
+ };
896
+ const mergeSearchSuggestions = ({ response = {}, origin, projectOrigin }) => ({
897
+ items: [
898
+ ...convertDataList({ dataList: response.recommend_project, searchType: "repo", origin: projectOrigin || origin }).items,
899
+ ...convertDataList({ dataList: response.recommend_model, searchType: "model", origin }).items,
900
+ ...convertDataList({ dataList: response.recommend_dataset, searchType: "dataset", origin }).items
901
+ ]
902
+ });
854
903
  export {
855
904
  SearchRepoCard as S,
856
- formatNameSpace as f,
905
+ isProjectSuggestionType as i,
906
+ mergeSearchSuggestions as m,
907
+ normalizeProjectUrlForMainSite as n,
857
908
  useReportRepo as u
858
909
  };