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

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, mergeModels, useModel, ref, watch, createElementBlock, openBlock, createVNode, withDirectives, normalizeClass, createElementVNode, vShow, inject, withModifiers, createBlock, Fragment, computed, createCommentVNode, normalizeStyle, createTextVNode, renderList, withCtx, reactive, onMounted, watchEffect } from "vue";
2
+ import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, e as useRequestReport, r as reqCatch, 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-XmRn4ADt.js";
3
+ import { t as transWebUrl } from "./transWebUrl-Bt3I_yb8.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: {
@@ -87,12 +19,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
87
19
  },
88
20
  setup(__props) {
89
21
  return (_ctx, _cache) => {
90
- return toDisplayString(unref(transferNumber)({ number: __props.number, fixed: __props.fixed, byte: __props.byte, gt100: __props.gt100 }));
22
+ return toDisplayString(unref(transferNumber)({ number: _ctx.number, fixed: _ctx.fixed, byte: _ctx.byte, gt100: _ctx.gt100 }));
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
- __props.isLike ? (openBlock(), createBlock(Like, {
160
+ _ctx.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,14 +204,14 @@ 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"
279
211
  }),
280
212
  createElementVNode("span", null, [
281
213
  createVNode(_sfc_main$a, {
282
- number: __props.count || 0
214
+ number: _ctx.count || 0
283
215
  }, null, 8, ["number"])
284
216
  ])
285
217
  ]);
@@ -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)
@@ -351,9 +273,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
351
273
  color: "var(--theme-home-card-color-placeholder)",
352
274
  size: "14"
353
275
  }),
354
- !__props.hideText ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(unref($t)("gitCodeLayout.components.repo.today")), 1)) : createCommentVNode("", true),
276
+ !_ctx.hideText ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(unref($t)("gitCodeLayout.components.repo.today")), 1)) : createCommentVNode("", true),
355
277
  createVNode(_sfc_main$a, {
356
- number: __props.starCountOne || 0
278
+ number: _ctx.starCountOne || 0
357
279
  }, null, 8, ["number"])
358
280
  ]);
359
281
  };
@@ -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",
@@ -384,9 +306,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
384
306
  size: "14"
385
307
  }),
386
308
  createElementVNode("span", _hoisted_2$3, [
387
- _cache[0] || (_cache[0] = createTextVNode("Star ", -1)),
309
+ _cache[0] || (_cache[0] = createTextVNode("Star ")),
388
310
  createVNode(_sfc_main$a, {
389
- number: __props.count || 0,
311
+ number: _ctx.count || 0,
390
312
  gt100: true
391
313
  }, null, 8, ["number"])
392
314
  ])
@@ -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,52 +348,42 @@ 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, [
448
360
  createElementVNode("div", _hoisted_1$3, [
449
- __props.tagInfo ? (openBlock(), createBlock(LanguageTag, {
361
+ _ctx.tagInfo ? (openBlock(), createBlock(LanguageTag, {
450
362
  key: 0,
451
- "tag-info": __props.tagInfo
363
+ "tag-info": _ctx.tagInfo
452
364
  }, null, 8, ["tag-info"])) : createCommentVNode("", true),
453
- !__props.hideStarCount ? (openBlock(), createBlock(StarCountOne, {
365
+ !_ctx.hideStarCount ? (openBlock(), createBlock(StarCountOne, {
454
366
  key: 1,
455
367
  hideText: "",
456
- starCountOne: __props.repoInfo.star_count
368
+ starCountOne: _ctx.repoInfo.star_count
457
369
  }, null, 8, ["starCountOne"])) : createCommentVNode("", true),
458
- __props.repoInfo.forks_count ? (openBlock(), createBlock(ForkTag, {
370
+ _ctx.repoInfo.forks_count ? (openBlock(), createBlock(ForkTag, {
459
371
  key: 2,
460
- count: __props.repoInfo.forks_count
372
+ count: _ctx.repoInfo.forks_count
461
373
  }, null, 8, ["count"])) : createCommentVNode("", true),
462
374
  showUpdateTimeDot.value ? (openBlock(), createElementBlock("div", _hoisted_2$2)) : createCommentVNode("", true),
463
- !__props.hideUpdateTime ? (openBlock(), createElementBlock("div", _hoisted_3$2, toDisplayString(unref(formatTimeFromNow)((__props.searchCard ? __props.repoInfo.last_repository_updated_at : __props.repoInfo.last_activity_at) || __props.repoInfo.last_activity_at)), 1)) : createCommentVNode("", true),
464
- !__props.hideStarIncrease && __props.repoInfo.star_count_one ? (openBlock(), createBlock(StarCountOne, {
375
+ !_ctx.hideUpdateTime ? (openBlock(), createElementBlock("div", _hoisted_3$2, toDisplayString(unref(formatTimeFromNow)((_ctx.searchCard ? _ctx.repoInfo.last_repository_updated_at : _ctx.repoInfo.last_activity_at) || _ctx.repoInfo.last_activity_at)), 1)) : createCommentVNode("", true),
376
+ !_ctx.hideStarIncrease && _ctx.repoInfo.star_count_one ? (openBlock(), createBlock(StarCountOne, {
465
377
  key: 5,
466
- starCountOne: __props.repoInfo.star_count_one
378
+ starCountOne: _ctx.repoInfo.star_count_one
467
379
  }, null, 8, ["starCountOne"])) : createCommentVNode("", true),
468
- __props.repoInfo.is_gh_mirrors ? (openBlock(), createBlock(GithubStarNum, {
380
+ _ctx.repoInfo.is_gh_mirrors ? (openBlock(), createBlock(GithubStarNum, {
469
381
  key: 6,
470
- count: __props.repoInfo.import_star_count
382
+ count: _ctx.repoInfo.import_star_count
471
383
  }, null, 8, ["count"])) : createCommentVNode("", true)
472
384
  ])
473
385
  ]),
474
- !__props.hideTopicTags && topicNames.value.length && __props.searchCard ? (openBlock(), createElementBlock("div", {
386
+ !_ctx.hideTopicTags && topicNames.value.length && _ctx.searchCard ? (openBlock(), createElementBlock("div", {
475
387
  key: 0,
476
388
  class: "topic-tags",
477
389
  ref_key: "topicTagsRef",
@@ -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,25 +448,26 @@ 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
- _: 1
453
+ _: 1,
454
+ __: [0]
539
455
  })) : createCommentVNode("", true);
540
456
  };
541
457
  }
542
458
  });
543
459
  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)]" };
460
+ const _hoisted_1$1 = { class: "model-card-footer" };
545
461
  const _hoisted_2$1 = {
546
462
  key: 1,
547
- class: "ellipsis max-150 ml-[6px]"
463
+ class: "ellipsis max-150 model-card-footer__text"
548
464
  };
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]" };
465
+ const _hoisted_3$1 = { class: "model-card-footer__text" };
466
+ const _hoisted_4$1 = { class: "model-card-footer__time" };
467
+ const _hoisted_5$1 = { class: "model-card-footer__text" };
552
468
  const _hoisted_6$1 = {
553
469
  key: 2,
554
- class: "w-[4px] h-[4px] ml-[6px] mr-[6px] rounded-[2px] bg-[var(--theme-placeholder)]"
470
+ class: "model-card-footer__dot"
555
471
  };
556
472
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
557
473
  __name: "ModelCardFooter",
@@ -574,7 +490,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
574
490
  size: "12px"
575
491
  }, null, 8, ["name"])) : createCommentVNode("", true),
576
492
  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))
493
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "model-card-footer__dot" }, null, -1))
578
494
  ], 64)) : createCommentVNode("", true),
579
495
  projectData.value.model_param_size ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
580
496
  createVNode(GIcon, {
@@ -583,10 +499,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
583
499
  color: "var(--theme-release-card-text-color)"
584
500
  }),
585
501
  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))
502
+ _cache[1] || (_cache[1] = createElementVNode("div", { class: "model-card-footer__dot" }, null, -1))
587
503
  ], 64)) : createCommentVNode("", true),
588
504
  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)),
505
+ _cache[2] || (_cache[2] = createElementVNode("div", { class: "model-card-footer__dot" }, null, -1)),
590
506
  createVNode(GIcon, {
591
507
  name: "gt-line-upload",
592
508
  size: "14px",
@@ -608,10 +524,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
608
524
  };
609
525
  }
610
526
  });
527
+ const ModelCardFooter = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-vue-layout-gitcode"]]);
611
528
  const _hoisted_1 = ["innerHTML"];
612
529
  const _hoisted_2 = {
613
530
  key: 0,
614
- class: "is-recommend ml-[8px]"
531
+ class: "is-recommend"
615
532
  };
616
533
  const _hoisted_3 = { key: 1 };
617
534
  const _hoisted_4 = { key: 2 };
@@ -623,24 +540,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
623
540
  info: {},
624
541
  keyword: {},
625
542
  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 }
543
+ noborder: { type: Boolean, default: false },
544
+ hover: { type: Boolean, default: false },
545
+ hideTopicTags: { type: Boolean, default: false },
546
+ urlParams: { default: () => ({}) },
547
+ preserveUrlOrigin: { type: Boolean, default: false },
548
+ hideStarBtn: { type: Boolean, default: false },
549
+ hideFooter: { type: Boolean, default: false },
550
+ hideDescription: { type: Boolean, default: false }
633
551
  },
634
552
  emits: ["report"],
635
553
  setup(__props, { emit: __emit }) {
636
554
  const lang = useCookie(LANG_KEY, LANG_ZH);
637
- const API = headRequest(inject("request"));
555
+ const request = inject("request") || (() => Promise.resolve({ data: {} }));
556
+ const API = headRequest(request);
638
557
  const emits = __emit;
639
558
  const router = useRouter();
640
559
  const { widthType } = usePageResize();
641
560
  const { t: $t } = i18n.global;
642
561
  const handleClick = () => {
643
- window.open(transWebUrl(transformUrl(props.info.web_url), props.urlParams), "_blank");
562
+ window.open(transWebUrl(transformUrl(props.info.web_url), props.urlParams, {
563
+ preserveOrigin: props.preserveUrlOrigin
564
+ }), "_blank");
644
565
  emits("report");
645
566
  _frEventTrack(EVENT_NAME.CLICK_SEARCH_RESULT);
646
567
  };
@@ -648,7 +569,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
648
569
  emits("report", "starReport");
649
570
  };
650
571
  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" };
572
+ const repoIcon = { repo: "gt-line-repositories", model: "gt-line-line-Models", dataset: "gt-line-Datasets" };
652
573
  const props = __props;
653
574
  console.log("i-search-projects-card", props.info, props.cardType);
654
575
  const iconName = computed(() => {
@@ -701,7 +622,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
701
622
  name_with_namespace: nameWithSpace,
702
623
  path_with_namespace: path,
703
624
  import_url: importUrl,
704
- is_gh_mirrors: isGhMirrors,
705
625
  is_mirrors: isMirrors
706
626
  } = info || {};
707
627
  const isGitcodeRepo = REPO_TYPE.GITCODE === isMirrors;
@@ -718,13 +638,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
718
638
  });
719
639
  return (_ctx, _cache) => {
720
640
  return openBlock(), createElementBlock("a", {
721
- class: normalizeClass(["i-search-projects-card cursor-pointer", { noborder: __props.noborder, "full-hover": __props.hover }]),
641
+ class: normalizeClass(["i-search-projects-card", { noborder: _ctx.noborder, "full-hover": _ctx.hover }]),
722
642
  onClick: handleClick
723
643
  }, [
724
644
  createVNode(unref(Row), { class: "i-search-projects-card-title" }, {
725
645
  default: withCtx(() => [
726
646
  createVNode(unref(Col), {
727
- class: "ellipsis flex items-center gap-[8px]",
647
+ class: "ellipsis i-search-projects-card-title__col",
728
648
  flex: "auto"
729
649
  }, {
730
650
  default: withCtx(() => {
@@ -732,43 +652,45 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
732
652
  return [
733
653
  createVNode(GIcon, {
734
654
  name: iconName.value,
735
- class: normalizeClass({ "align-middle": __props.info.is_gh_mirrors }),
655
+ class: normalizeClass({ "align-middle": _ctx.info.is_gh_mirrors }),
736
656
  color: "var(--theme-placeholder)"
737
657
  }, null, 8, ["name", "class"]),
738
658
  createElementVNode("span", {
739
659
  class: "repo-title",
740
660
  innerHTML: preHandWord()
741
661
  }, null, 8, _hoisted_1),
742
- __props.info.show_recommend_icon ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.search.recommendTag")), 1)) : createCommentVNode("", true),
743
- unref(isGstarRepo)(__props.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_3, [
662
+ _ctx.info.show_recommend_icon ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(unref($t)("gitCodeLayout.search.recommendTag")), 1)) : createCommentVNode("", true),
663
+ unref(isGstarRepo)(_ctx.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_3, [
744
664
  createVNode(_sfc_main$b, {
745
665
  origin: "repo",
746
666
  icon: "",
747
667
  type: "gstar",
748
668
  message: `G-Star ${unref($t)("gitCodeLayout.GStar.project.graduation")}`
749
669
  }, {
750
- default: withCtx(() => [..._cache[0] || (_cache[0] = [
751
- createTextVNode("G-Star ", -1)
752
- ])]),
753
- _: 1
670
+ default: withCtx(() => _cache[0] || (_cache[0] = [
671
+ createTextVNode("G-Star ")
672
+ ])),
673
+ _: 1,
674
+ __: [0]
754
675
  }, 8, ["message"])
755
676
  ])) : createCommentVNode("", true),
756
- unref(isIncubationRepo)(__props.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
677
+ unref(isIncubationRepo)(_ctx.info.topic_names) ? (openBlock(), createElementBlock("div", _hoisted_4, [
757
678
  createVNode(_sfc_main$b, {
758
679
  origin: "repo",
759
680
  icon: "",
760
681
  type: "incubation",
761
682
  message: `G-Star ${unref($t)("gitCodeLayout.GStar.project.incubation")}`
762
683
  }, {
763
- default: withCtx(() => [..._cache[1] || (_cache[1] = [
764
- createTextVNode(" G-Star ", -1)
765
- ])]),
766
- _: 1
684
+ default: withCtx(() => _cache[1] || (_cache[1] = [
685
+ createTextVNode(" G-Star ")
686
+ ])),
687
+ _: 1,
688
+ __: [1]
767
689
  }, 8, ["message"])
768
690
  ])) : createCommentVNode("", true),
769
691
  createVNode(NewTag, {
770
- repoType: __props.cardType,
771
- isNew: ((_a = __props.info) == null ? void 0 : _a.is_new) || false
692
+ repoType: _ctx.cardType,
693
+ isNew: ((_a = _ctx.info) == null ? void 0 : _a.is_new) || false
772
694
  }, null, 8, ["repoType", "isNew"])
773
695
  ];
774
696
  }),
@@ -776,7 +698,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
776
698
  }),
777
699
  createVNode(unref(Col), { flex: "none" }, {
778
700
  default: withCtx(() => [
779
- !__props.hideStarBtn ? (openBlock(), createBlock(StarTag, {
701
+ !_ctx.hideStarBtn ? (openBlock(), createBlock(StarTag, {
780
702
  key: 0,
781
703
  isLike: isModel.value,
782
704
  "star-info": starInfo.value,
@@ -788,12 +710,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
788
710
  ]),
789
711
  _: 1
790
712
  }),
791
- !__props.hideDescription ? (openBlock(), createElementBlock("div", {
713
+ !_ctx.hideDescription ? (openBlock(), createElementBlock("div", {
792
714
  key: 0,
793
715
  innerHTML: unref(highlightWords)("", description.value),
794
- class: "i-search-projects-card-desc ellipsis mt-[8px]"
716
+ class: "i-search-projects-card-desc ellipsis"
795
717
  }, null, 8, _hoisted_5)) : createCommentVNode("", true),
796
- __props.info.index === 0 && __props.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
718
+ _ctx.info.index === 0 && _ctx.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_6, [
797
719
  queryLoading.value ? (openBlock(), createBlock(unref(Skeleton), { key: 0 }, {
798
720
  placeholder: withCtx(() => [
799
721
  createVNode(unref(Row), {
@@ -805,7 +727,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
805
727
  span: rowSpan[unref(widthType)]
806
728
  }, {
807
729
  default: withCtx(() => [
808
- createVNode(unref(SkeletonItem), { class: "h-[110px] mt-[16px]" })
730
+ createVNode(unref(SkeletonItem), { class: "i-search-projects-card-skel" })
809
731
  ]),
810
732
  _: 1
811
733
  }, 8, ["span"]),
@@ -813,7 +735,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
813
735
  span: rowSpan[unref(widthType)]
814
736
  }, {
815
737
  default: withCtx(() => [
816
- createVNode(unref(SkeletonItem), { class: "h-[110px] mt-[16px]" })
738
+ createVNode(unref(SkeletonItem), { class: "i-search-projects-card-skel" })
817
739
  ]),
818
740
  _: 1
819
741
  }, 8, ["span"]),
@@ -821,7 +743,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
821
743
  span: rowSpan[unref(widthType)]
822
744
  }, {
823
745
  default: withCtx(() => [
824
- createVNode(unref(SkeletonItem), { class: "h-[110px] mt-[16px]" })
746
+ createVNode(unref(SkeletonItem), { class: "i-search-projects-card-skel" })
825
747
  ]),
826
748
  _: 1
827
749
  }, 8, ["span"])
@@ -831,18 +753,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
831
753
  ]),
832
754
  _: 1
833
755
  })) : createCommentVNode("", true)
834
- ])) : isModel.value ? (openBlock(), createBlock(_sfc_main$1, {
756
+ ])) : isModel.value && !_ctx.hideFooter ? (openBlock(), createBlock(ModelCardFooter, {
835
757
  key: 2,
836
- repoInfo: __props.info
758
+ repoInfo: _ctx.info
837
759
  }, null, 8, ["repoInfo"])) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
838
- !__props.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
760
+ !_ctx.hideFooter ? (openBlock(), createBlock(RepoCardFooter, {
839
761
  key: 0,
840
- hideTopicTags: __props.hideTopicTags,
762
+ hideTopicTags: _ctx.hideTopicTags,
841
763
  hideStarCount: "",
842
764
  tagInfo: tagInfo.value,
843
- repoInfo: __props.info,
765
+ repoInfo: _ctx.info,
844
766
  searchCard: "",
845
- class: "i-search-projects-card-bottom mt-[8px]",
767
+ class: "i-search-projects-card-bottom",
846
768
  onTopicClick: handleTopicClick
847
769
  }, null, 8, ["hideTopicTags", "tagInfo", "repoInfo"])) : createCommentVNode("", true)
848
770
  ], 64))
@@ -851,8 +773,140 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
851
773
  }
852
774
  });
853
775
  const SearchRepoCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
776
+ const useReportRepo = (reportParams, viewReport) => {
777
+ const list = ref([]);
778
+ const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
779
+ const locationHref = ref((window == null ? void 0 : window.location.href) || "");
780
+ const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
781
+ const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
782
+ const triggerReport = (type, data) => {
783
+ if (type === "click") {
784
+ const params = {
785
+ chat_title: "",
786
+ related: {
787
+ list: [formatItem(data)],
788
+ type: "repo"
789
+ }
790
+ };
791
+ viewReport(pageRef.value, locationHref.value, "click", params);
792
+ } else if (type === "expo") {
793
+ list.value.push(data);
794
+ }
795
+ };
796
+ const formatItem = (data) => {
797
+ const channelNames = [];
798
+ if (data.channelName) channelNames.push(data.channelName);
799
+ if (data.subChannelName) channelNames.push(data.subChannelName);
800
+ const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
801
+ return {
802
+ type: "gitcode",
803
+ repo_id: repoId,
804
+ dest_url: data.web_url,
805
+ strategy: channelNames.join("、") || "",
806
+ // 官方项目
807
+ repo_index: data.index,
808
+ page: data.pageIndex || data.p || 0,
809
+ per_page: data.pageSize || data.pp || 0,
810
+ q: data.keyword || ""
811
+ };
812
+ };
813
+ const doReport = debounce(() => {
814
+ if (list.value.length >= 1) {
815
+ const reportList = list.value.splice(0).map((item) => {
816
+ return formatItem(item);
817
+ });
818
+ const params = {
819
+ chat_title: "",
820
+ extend_json: {
821
+ key_words: keyword.value,
822
+ module_name: moduleName.value
823
+ },
824
+ related: {
825
+ list: reportList,
826
+ type: "repo"
827
+ }
828
+ };
829
+ viewReport(pageRef.value, locationHref.value, "expo", params);
830
+ }
831
+ }, 500, { leading: false });
832
+ watchEffect(() => {
833
+ if (list.value.length) {
834
+ doReport();
835
+ }
836
+ });
837
+ return {
838
+ triggerReport
839
+ };
840
+ };
841
+ const normalizeOrigin = (origin) => {
842
+ const value = origin.trim().replace(/\/+$/, "");
843
+ if (!value) return "";
844
+ try {
845
+ const url = new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(value) ? value : `https://${value}`);
846
+ return url.origin;
847
+ } catch {
848
+ return value;
849
+ }
850
+ };
851
+ const getStringValue = (value) => typeof value === "string" ? value : "";
852
+ const normalizeProjectUrlForMainSite = (value, projectOrigin, currentOrigin) => {
853
+ const urlValue = getStringValue(value).trim();
854
+ if (!urlValue) return urlValue;
855
+ const mainOrigin = normalizeOrigin(projectOrigin) || normalizeOrigin(currentOrigin);
856
+ if (!mainOrigin) return urlValue;
857
+ try {
858
+ const mainSiteUrl = new URL(mainOrigin);
859
+ const projectUrl = new URL(urlValue, `${mainSiteUrl.origin}/`);
860
+ if (projectUrl.protocol !== "http:" && projectUrl.protocol !== "https:") return urlValue;
861
+ projectUrl.protocol = mainSiteUrl.protocol;
862
+ projectUrl.host = mainSiteUrl.host;
863
+ projectUrl.username = "";
864
+ projectUrl.password = "";
865
+ return projectUrl.toString();
866
+ } catch {
867
+ return urlValue;
868
+ }
869
+ };
870
+ const isProjectSuggestionType = (repoType) => {
871
+ if (repoType === void 0 || repoType === null || repoType === "") return true;
872
+ const normalizedType = String(repoType).trim().toLowerCase();
873
+ return !normalizedType || ["repo", "repository", "project", "0"].includes(normalizedType);
874
+ };
875
+ const convertDataList = ({ dataList, searchType, origin }) => {
876
+ if (!Array.isArray(dataList)) {
877
+ return { items: [] };
878
+ }
879
+ const baseOrigin = normalizeOrigin(origin);
880
+ const items = dataList.slice(0, 3).filter((item) => Boolean(item) && typeof item === "object" && !Array.isArray(item)).map((item) => {
881
+ const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
882
+ const importUrl = getStringValue(item.import_url);
883
+ const importedRepoName = importUrl ? extractRepoInfoWithURL(importUrl) : "";
884
+ const nameWithNamespace = getStringValue(item.name_with_namespace);
885
+ const pathWithNamespace = getStringValue(item.path_with_namespace);
886
+ const repoName = (isGitcodeRepo ? nameWithNamespace : importedRepoName) || nameWithNamespace || pathWithNamespace;
887
+ const displayName = formatNameSpace(repoName).join("/");
888
+ const path = `${baseOrigin}/${pathWithNamespace}`;
889
+ return {
890
+ ...item,
891
+ searchType,
892
+ path,
893
+ displayName,
894
+ web_url: path
895
+ };
896
+ });
897
+ return { items };
898
+ };
899
+ const mergeSearchSuggestions = ({ response = {}, origin, projectOrigin }) => ({
900
+ items: [
901
+ ...convertDataList({ dataList: response.recommend_project, searchType: "repo", origin: projectOrigin || origin }).items,
902
+ ...convertDataList({ dataList: response.recommend_model, searchType: "model", origin }).items,
903
+ ...convertDataList({ dataList: response.recommend_dataset, searchType: "dataset", origin }).items
904
+ ]
905
+ });
854
906
  export {
855
907
  SearchRepoCard as S,
856
- formatNameSpace as f,
908
+ isProjectSuggestionType as i,
909
+ mergeSearchSuggestions as m,
910
+ normalizeProjectUrlForMainSite as n,
857
911
  useReportRepo as u
858
912
  };