gwitter
Version:
Turn GitHub Issues into your personal microblog platform
1,343 lines (1,234 loc) • 75.1 kB
JavaScript
(()=>{var e={925:function(e,t,o){"use strict";var i=o(5271),r=o(8751),n=o(2676),a=o(5045),l=o(5956),s=o(5767),d=o(2686);o(3052);var c=o(4767);let p={request:{token:"g?i?t?h?u?b?_?p?a?t?_?1?1?A?H?V?6?E?W?Q?0?M?f?C?S?r?0?4?K?A?j?1?F?_?3?7?n?4?U?y?u?S?m?d?z?i?t?D?s?w?i?s?i?u?a?g?N?b?a?k?V?n?L?I?7?U?W?s?s?h?n?K?p?s?H?S?D?S?4?D?K?O?Q?Q?J?S?S?x?q?z?Z?X?M",clientID:"56af6ab05592f0a2d399",clientSecret:"5d7e71a1b6130001e84956420ca5b88bc45b7d3c",pageSize:6,autoProxy:"https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token",owner:"SimonAKing",repo:"weibo"},app:{onlyShowOwner:!1,enableRepoSwitcher:!0,enableAbout:!1,enableEgg:!1,enableLabelFilter:!0}},u=e=>c.Z.create({baseURL:"https://api.github.com/",headers:{Accept:"application/json",Authorization:`bearer ${e}`}}),h=u(p.request.token.replaceAll("?","")),m=e=>{let t=e.labelName?`labels: ["${e.labelName}"],`:"",o=`
query getIssues($owner: String!, $repo: String!, $cursor: String, $pageSize: Int!) {
repository(owner: $owner, name: $repo) {
issues(first: $pageSize, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}, filterBy: {${p.app.onlyShowOwner?"createdBy: $owner,":""} ${t} states: OPEN}) {
pageInfo {
hasNextPage
endCursor
}
nodes {
id
number
createdAt
bodyHTML
title
url
author {
login
avatarUrl
url
}
reactions(first: 100) {
totalCount
nodes {
content
user {
login
}
}
}
comments(first: 1) {
totalCount
}
labels(first: 1) {
nodes {
name
color
}
}
}
}
}
}
`,i={...e};return null===i.cursor&&Reflect.deleteProperty(i,"cursor"),Reflect.deleteProperty(i,"labelName"),{operationName:"getIssues",query:o,variables:i}},g=e=>{let{owner:t,repo:o}=e;return{query:`
query {
repository(owner: "${t}", name: "${o}") {
labels(first: 100) {
nodes {
name
color
}
}
}
}
`}},x=async(e,t,o)=>{let i=`
mutation AddReaction($subjectId: ID!, $content: ReactionContent!) {
addReaction(input: {subjectId: $subjectId, content: $content}) {
reaction {
content
user {
login
}
}
}
}
`;return e.post("/graphql",{query:i,variables:{subjectId:t,content:o}})},f=async(e,t,o)=>{let i=`
mutation RemoveReaction($subjectId: ID!, $content: ReactionContent!) {
removeReaction(input: {subjectId: $subjectId, content: $content}) {
reaction {
content
user {
login
}
}
}
}
`;return e.post("/graphql",{query:i,variables:{subjectId:t,content:o}})},b=e=>{let{owner:t,repo:o,issueNumber:i}=e;return{query:`
query {
repository(owner: "${t}", name: "${o}") {
issue(number: ${i}) {
comments(first: 100, orderBy: {field: UPDATED_AT, direction: ASC}) {
totalCount
nodes {
id
author {
login
avatarUrl
}
bodyHTML
createdAt
updatedAt
reactions(first: 100) {
totalCount
nodes {
content
user {
login
}
}
}
}
}
}
}
}
`}},w=async(e,t,o)=>{let i=`
mutation AddComment($subjectId: ID!, $body: String!) {
addComment(input: {subjectId: $subjectId, body: $body}) {
commentEdge {
node {
id
author {
login
avatarUrl
}
bodyHTML
createdAt
updatedAt
}
}
}
}
`;return e.post("/graphql",{query:i,variables:{subjectId:t,body:o}})},v=async e=>(await c.Z.get("https://api.github.com/user",{headers:{Authorization:`bearer ${e}`}})).data,y=async e=>(await c.Z.post(p.request.autoProxy,{client_id:p.request.clientID,client_secret:p.request.clientSecret,code:e})).data,j=async(e,t,o)=>{let i=`
mutation UpdateIssueComment($commentId: ID!, $body: String!) {
updateIssueComment(input: {id: $commentId, body: $body}) {
issueComment {
id
author {
login
avatarUrl
}
bodyHTML
createdAt
updatedAt
}
}
}
`;return e.post("/graphql",{query:i,variables:{commentId:t,body:o}})},k=async(e,t)=>{let o=`
mutation DeleteIssueComment($commentId: ID!) {
deleteIssueComment(input: {id: $commentId}) {
clientMutationId
}
}
`;return e.post("/graphql",{query:o,variables:{commentId:t}})};var $=o(692),C=o(8773),S=o(3115),z=o(6887),Z=o(5986);let E=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.search;if(!e)return{};let t="?"===e[0]?e.substring(1):e,o={};return t.split("&").forEach(e=>{let[t,i]=e.split("=");t&&(o[decodeURIComponent(t)]=decodeURIComponent(i))}),o},L=e=>e&&0!==e.length?e[0]:{name:"default",color:"1da1f2"},R=(e,t)=>e.map(e=>{let{id:o,number:i,createdAt:r,bodyHTML:n,title:a,url:l,author:s,reactions:d,comments:c,labels:p}=e,u=d.nodes.filter(e=>"HEART"===e.content),h=u.length,m=!!t&&u.some(e=>e.user.login===t);return{id:o,number:i,createdAt:r,bodyHTML:n,title:a,url:l,author:s,reactions:{totalCount:d.totalCount,userReacted:m,heartCount:h},comments:c.totalCount,label:L(p.nodes)}}),I=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh",o=new Date(e),i=new Date,r=["zh","zh-CN"].includes(t)?z.U:Z._,n=(0,$.B)(o,i,{addSuffix:!0,locale:r});if(r===z.U){if(n.includes("秒")||n.includes("分钟"))return n;if(n.includes("小时")||n.includes("昨天"))return(0,C.l)(o,i,{locale:r});if(n.includes("天"))return n}else{if(n.includes("second")||n.includes("minute"))return n;if(n.includes("hour")||n.includes("yesterday"))return(0,C.l)(o,i,{locale:r});if(n.includes("day"))return n}return(0,S.WU)(o,"yyyy-MM-dd",{locale:r})},_=e=>(299*parseInt(e.substr(0,2),16)+587*parseInt(e.substr(2,2),16)+114*parseInt(e.substr(4,2),16))/1e3>=128?"black":"white",A=e=>Object.keys(e).map(t=>`${t}=${encodeURIComponent(e[t]||"")}`).join("&"),M=e=>{let t={width:Math.max(Math.floor(.4*window.outerWidth),400),height:Math.max(Math.floor(.4*window.outerHeight),400),left:0,top:0};t.left=Math.floor(window.screenX+(window.outerWidth-t.width)/2),t.top=Math.floor(window.screenY+(window.outerHeight-t.height)/3);let o=-1!==e.indexOf("?")?"&":"?",i=`${e}${o}`,r=`toolbar=0,scrollbars=1,status=1,resizable=1,location=1,menuBar=0,
width=${t.width},height=${t.height},
left=${t.left},top=${t.top}`,n=window.open(i,"Gwitter OAuth Application",r),a="addEventListener"in window?"addEventListener":"attachEvent",l=window[a],s="attachEvent"===a?"onmessage":"message",d=(e,t,o,i)=>{if(n&&n.close(),i&&clearInterval(i),"string"!=typeof e.data)return;let{result:r,error:a}=JSON.parse(e.data);a&&o(a),r||o("Unauthorised");let l=r.split("&").find(e=>e.startsWith("access_token="));l&&l.includes("=")||o("Unauthorised"),t(l.split("=")[1])};return new Promise((e,t)=>{let o=setInterval(()=>{n&&n.closed&&(clearInterval(o),t("Window closed by user"))},500);l(s,i=>d(i,e,t,o),!1),n||(clearInterval(o),t("Failed to open authentication window"))})},T=e=>{let t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("a").forEach(e=>{e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer")}),t.innerHTML},P="owner",O="repo",q=()=>{let e=new URLSearchParams(window.location.search),t=e.get(P),o=e.get(O);return t&&o?{owner:t,repo:o}:null},N=(e,t)=>{let o=new URL(window.location.href);o.searchParams.set(P,e),o.searchParams.set(O,t),window.history.replaceState(null,"",o.toString())},D=a.Z.span`
display: inline-block;
line-height: 1;
padding: 5px 6px;
font-size: 0.9em;
font-weight: 600;
border-radius: 3px;
box-shadow: inset 0 -1px 0 rgba(27, 31, 35, 0.12);
background-color: #${e=>e.bgColor};
color: ${e=>_(e.bgColor)};
cursor: ${e=>e.clickable?"pointer":"default"};
transition: ${e=>e.clickable?"opacity 0.2s ease":"none"};
&:hover {
opacity: ${e=>e.clickable?"0.8":"1"};
}
`,F=e=>{let{name:t,color:o,style:i,onClick:r}=e;return(0,n.jsx)(D,{style:i,bgColor:o,clickable:!!r,onClick:e=>{e.stopPropagation(),r&&r(t)},children:t})},H=["dependencies"],V="rgb(167, 167, 167)",G=a.Z.div`
user-select: none;
padding: 16px 20px;
transition: all 0.25s ease;
border-radius: 10px;
background: hsla(0, 0%, 100%, 0.6);
font-size: 1em;
letter-spacing: 1px;
border: 0.5px solid #f1f1f1;
box-shadow: 0 0.1em 0.2em 0 rgba(234, 234, 234, 0.8);
margin: 6px;
margin-bottom: 1em;
ol {
list-style: decimal !important;
}
ul {
list-style: circle !important;
}
code {
background: rgba(232, 125, 143, 0.1);
color: #e96384;
}
summary {
cursor: pointer;
font-size: 1.1em;
&:focus {
outline: none;
}
}
summary::-webkit-details-marker {
display: none;
}
a {
color: #8f63e9;
box-shadow: inset 0 -3px #cfbcf5;
font-weight: 700;
text-decoration: none;
transition: 0.2s;
}
a:hover,
a:focus {
box-shadow: inset 0 -1.2em #8f63e9;
color: #f8f5fe;
}
p {
margin-top: 0;
margin-bottom: 1em;
}
p:last-child {
margin-bottom: 0;
}
.about-title {
font-size: 1.3em;
margin-bottom: 0.3em;
text-align: center;
}
abbr {
font-variant: small-caps;
text-transform: lowercase;
font-size: 1.2em;
}
[type='checkbox'] {
opacity: 0;
position: absolute;
width: 0;
height: 0;
}
[type='checkbox'] + label {
background: #efe7fd;
border-left: 4px solid ${V};
cursor: pointer;
display: block;
font-size: 1em;
font-weight: 700;
text-align: left;
transition: 0.1s;
padding: 0.75em 1em;
}
[type='checkbox'] + label::before {
border: 2px solid;
border-radius: 2px;
color: ${V};
content: '';
display: inline-block;
margin-right: 0.75ch;
transition: 0.1s;
width: 1ch;
height: 1ch;
vertical-align: baseline;
}
[type='checkbox']:focus + label {
outline: 2px solid ${V};
}
[type='checkbox']:checked + label::before {
background: currentColor;
box-shadow: inset 0 0 0 2px #fff;
}
.container {
box-shadow: 0.2em 1em 2em -1em #d6d1e0;
margin: 2.4em 0;
}
details {
border-bottom: 2px solid #d6d1e0;
list-style: none;
}
summary {
display: block;
transition: 0.2s;
padding: 1em;
&:hover {
background-color: #f0f0f0;
}
}
summary:focus {
outline: none;
}
summary::after {
border-right: 2px solid;
border-bottom: 2px solid;
content: '';
float: right;
width: 0.5em;
height: 0.5em;
margin-top: 0.25em;
transform: rotate(45deg);
transition: inherit;
}
[open] summary {
background: ${V};
color: #fff;
font-size: 1.15em;
}
[open] summary::after {
margin-top: 0.5em;
transform: rotate(225deg);
}
/* Collapse styles */
&.collapse-init summary + * {
transition: all 0.25s ease-in-out;
overflow: hidden;
}
&.collapse-init :not(.panel-active) summary + * {
height: 0;
opacity: 0;
-webkit-transform: scale(0.9);
transform: scale(0.9);
transform-origin: bottom center;
}
&.collapse-init summary {
list-style: none;
}
&.collapse-init summary::-webkit-details-marker {
display: none;
}
&.collapse-init summary::before {
display: none;
}
&.collapse-init summary {
cursor: pointer;
}
.details-styling {
padding: 1em;
}
`,U=e=>{let{owner:t,repo:o}=e,[r,a]=(0,i.useState)(null),{t:l}=(0,d.$G)();return(0,i.useEffect)(()=>{new Collapse(document.querySelector(".collapse"),{accordion:!0}).init(),(async()=>{try{var e,i,r,n;let l=await h.post("/graphql",g({owner:t,repo:o})),s=null==l||null==(n=l.data)||null==(r=n.data)||null==(i=r.repository)||null==(e=i.labels)?void 0:e.nodes;if(Array.isArray(s)){let e=s.filter(e=>!H.includes(e.name));a(e)}}catch(e){console.error("Failed to fetch labels:",e)}})()},[t,o]),(0,n.jsxs)(G,{className:"collapse",children:[(0,n.jsx)("div",{className:"about-title",children:l("about.title")}),(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:l("about.gwitter.title")}),(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"details-styling",children:(0,n.jsx)("p",{children:l("about.gwitter.description")})})})]}),(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:l("about.content.title")}),(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"details-styling",children:[(0,n.jsx)("p",{children:l("about.content.categories",{count:(null==r?void 0:r.length)||0})}),(0,n.jsx)("div",{children:null==r?void 0:r.map((e,t)=>(0,n.jsx)(F,{style:{margin:"6px"},name:e.name,color:e.color},t))})]})})]}),(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:l("about.subscription.title")}),(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"details-styling",children:(0,n.jsxs)("ul",{children:[(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:l("about.subscription.watch")}),"\xa0",(0,n.jsx)("a",{href:"https://github.com/SimonAKing/weibo",target:"_blank",rel:"noopener noreferrer",children:l("about.subscription.repo")})]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:l("about.subscription.join")}),"\xa0",(0,n.jsx)("a",{href:"https://thinking.simonaking.com/#ru-kou",target:"_blank",rel:"noopener noreferrer",children:l("about.subscription.wechat")})]}),(0,n.jsxs)("li",{children:[(0,n.jsx)("code",{children:l("about.subscription.join")}),"\xa0",(0,n.jsx)("a",{href:"https://t.me/Simon_AKing",target:"_blank",rel:"noopener noreferrer",children:l("about.subscription.telegram")})]})]})})})]})]})},B=e=>{let{children:t,id:o}=e;return(0,n.jsx)(l.E.div,{initial:{opacity:0,scaleY:0,height:0},animate:{opacity:1,scaleY:1,height:"auto"},exit:{opacity:0,scaleY:0,height:0},transition:{duration:.4,ease:"easeOut",layout:!0},style:{transformOrigin:"top",overflow:"hidden"},layout:!0,children:t},o)};var Y=o(2254);let J=a.Z.div`
position: relative;
width: 100%;
margin-top: 3em;
@media (orientation: landscape) and (max-height: 500px) {
margin-top: 0.8em;
.closing-message {
padding: 0.8em;
margin: 0.8em auto;
transform: rotate(-1deg);
}
.code-block {
max-height: 180px;
}
.button-container {
margin-top: 0.6em;
}
}
`,W=a.Z.div`
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
`,K=a.Z.div`
text-align: center;
padding: clamp(1.2em, 3vw, 2em) clamp(0.8em, 2vw, 1.5em);
margin: clamp(1.5em, 4vw, 2.5em) auto;
width: 85%;
max-width: 600px;
border-radius: clamp(6px, 1.5vw, 12px);
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.3);
position: relative;
overflow: hidden;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
z-index: 2;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
transform: rotate(-3deg) perspective(800px);
transform-style: preserve-3d;
&:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(
120deg,
rgba(255, 255, 255, 0) 30%,
rgba(255, 255, 255, 0.5) 38%,
rgba(255, 255, 255, 0.5) 40%,
rgba(255, 255, 255, 0) 48%
);
background-size: 200% 100%;
background-position: 100% 0;
opacity: 0;
transition:
opacity 0.3s ease,
transform 0.3s ease,
background-position 1.5s ease;
z-index: -1;
}
&:hover {
transform: rotate(0deg) perspective(800px) translateY(-10px);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
&:before {
opacity: 1;
background-position: -100% 0;
}
.code-block {
transform: translateZ(20px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
.button-container {
transform: translateZ(30px);
}
}
@media (max-width: 768px) {
width: 90%;
padding: 1.2em 0.8em;
margin: 1.2em auto;
transform: rotate(-2deg);
}
@media (max-width: 480px) {
width: 95%;
padding: 1em 0.7em;
margin: 0.8em auto;
border-radius: 8px;
transform: rotate(-1deg);
}
`,Q=a.Z.div`
background: #282c34;
color: #abb2bf;
border-radius: 8px;
padding: clamp(0.6em, 1.5vw, 1em);
font-family: monospace;
font-size: clamp(0.75em, 1vw, 0.9em);
text-align: left;
margin: 0 auto;
width: 100%;
max-width: 500px;
overflow: auto;
position: relative;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
@media (max-width: 768px) {
max-width: 100%;
border-radius: 6px;
font-size: 0.8em;
}
@media (max-width: 480px) {
font-size: 0.75em;
padding: 0.6em 0.4em;
border-radius: 4px;
max-height: 250px;
white-space: pre-wrap;
word-break: break-word;
}
`,X=a.Z.span`
display: block;
line-height: 1.4;
@media (max-width: 480px) {
line-height: 1.3;
margin-bottom: 0.2em;
}
`,ee=a.Z.span`
color: #c678dd;
`,et=a.Z.span`
color: #61afef;
`,eo=a.Z.span`
color: #98c379;
`,ei=a.Z.span`
color: #7d8799;
`,er=a.Z.div`
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: clamp(0.4em, 1.5vw, 0.8em);
margin-top: clamp(0.8em, 2vw, 1.2em);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
@media (max-width: 480px) {
flex-direction: column;
width: 90%;
margin: 0.8em auto 0;
gap: 0.4em;
}
`,en=a.Z.button`
padding: clamp(0.5em, 1.2vw, 0.7em) clamp(1.2em, 2.5vw, 2em);
font-size: clamp(0.7em, 0.9vw, 0.9em);
font-weight: 500;
color: white;
background-color: #ff5f6d;
background: linear-gradient(to right, #ff5f6d, #ffc371);
border: none;
border-radius: 50px;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 5px 15px rgba(255, 95, 109, 0.4);
margin: 0.4em;
position: relative;
overflow: hidden;
&:hover {
transform: translateY(-3px) scale(1.05);
box-shadow: 0 7px 20px rgba(255, 95, 109, 0.5);
&:after {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.4),
transparent
);
animation: shine 1.5s ease-in-out;
}
}
@keyframes shine {
0% {
left: -100%;
}
100% {
left: 100%;
}
}
&:active {
transform: translateY(0) scale(1);
box-shadow: 0 5px 15px rgba(255, 95, 109, 0.4);
}
&:focus {
outline: none;
}
@media (max-width: 768px) {
padding: 0.6em 1.5em;
font-size: 0.85em;
}
@media (max-width: 480px) {
width: 100%;
margin: 0.2em 0;
padding: 0.6em 1em;
border-radius: 30px;
}
`,ea=()=>{let{t:e}=(0,d.$G)(),t=(0,i.useRef)(null),o=(0,i.useRef)(null),r=()=>{(0,Y.E)()};return(0,i.useEffect)(()=>{let e=new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting&&(r(),e.disconnect())})},{threshold:.5});return t.current&&e.observe(t.current),()=>{t.current&&e.disconnect()}},[]),(0,n.jsxs)(J,{ref:t,children:[(0,n.jsx)(W,{ref:o}),(0,n.jsxs)(K,{children:[(0,n.jsx)(Q,{children:(0,n.jsxs)("code",{children:[(0,n.jsxs)(X,{delay:.1,children:[(0,n.jsx)(ee,{children:"function"}),(0,n.jsx)(et,{children:" sayGoodbye"}),"() ","{"]}),(0,n.jsxs)(X,{delay:.2,children:["\xa0\xa0",(0,n.jsx)(ee,{children:"const"})," message =",(0,n.jsxs)(eo,{children:['"',e("egg.message"),'"']}),";"]}),(0,n.jsxs)(X,{delay:.3,children:["\xa0\xa0",(0,n.jsx)(ee,{children:"const"})," hope =",(0,n.jsxs)(eo,{children:['"',e("egg.hope"),'"']}),";"]}),(0,n.jsxs)(X,{delay:.4,children:["\xa0\xa0",(0,n.jsx)(et,{children:"console.log"}),"(message, hope);"]}),(0,n.jsxs)(X,{delay:.5,children:["\xa0\xa0",(0,n.jsx)(ei,{children:e("egg.comment")})]}),(0,n.jsx)(X,{delay:.6,children:"}"}),(0,n.jsxs)(X,{delay:.7,children:[(0,n.jsx)(et,{children:"sayGoodbye"}),"();"]})]})}),(0,n.jsx)(er,{children:(0,n.jsx)(en,{onClick:r,children:e("egg.runCode")})})]})]})};o(8980);var el=o(769),es=o(4487);let ed=(0,i.createContext)(void 0),ec=()=>{let e=(0,i.useContext)(ed);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e},ep=e=>{let{children:t}=e,[o,r]=(0,i.useState)(!1),[a,l]=(0,i.useState)(null),[s,d]=(0,i.useState)(null),[c,u]=(0,i.useState)(!0);(0,i.useEffect)(()=>{let e=localStorage.getItem("github_token"),t=localStorage.getItem("github_user");e&&t&&(d(e),l(JSON.parse(t)),r(!0)),u(!1)},[]);let h=async e=>{u(!0);try{let t=await v(e),o={login:t.login,avatarUrl:t.avatar_url};d(e),l(o),r(!0),localStorage.setItem("github_token",e),localStorage.setItem("github_user",JSON.stringify(o))}catch(e){console.error("Auth callback error:",e)}finally{u(!1)}};return(0,n.jsx)(ed.Provider,{value:{isAuthenticated:o,user:a,token:s,isLoading:c,login:()=>{let e={client_id:p.request.clientID,redirect_uri:window.location.href,scope:"public_repo"},t=`https://github.com/login/oauth/authorize?${A(e)}`;u(!0),M(t).then(e=>{h(e)}).catch(e=>{console.error("Login error:",e),u(!1)})},logout:()=>{d(null),l(null),r(!1),u(!1),localStorage.removeItem("github_token"),localStorage.removeItem("github_user")}},children:t})};var eu=o(967);let eh=a.Z.div`
background: white;
border-radius: 12px;
border: 1px solid #e1e8ed;
padding: 12px;
transition:
max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
border-color 0.2s ease;
overflow: hidden;
max-height: ${e=>e.$isExpanded?"500px":"80px"};
will-change: max-height;
contain: layout;
&:focus-within {
border-color: #1d9bf0;
}
`,em=a.Z.textarea`
width: 100%;
min-height: ${e=>e.$isExpanded?"60px":"40px"};
padding: 0;
border: none;
font-size: 14px;
line-height: 1.3125;
resize: vertical;
background: transparent;
color: #0f1419;
transition: min-height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
will-change: min-height;
&:focus {
outline: none;
}
&::placeholder {
color: #536471;
}
`,eg=a.Z.div`
display: flex;
gap: 8px;
justify-content: flex-end;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #e1e8ed;
opacity: ${e=>+!!e.$isExpanded};
transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
pointer-events: ${e=>e.$isExpanded?"auto":"none"};
will-change: opacity;
`,ex=a.Z.button`
padding: 4px 12px;
border-radius: 16px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition:
background-color 0.2s ease,
border-color 0.2s ease;
border: none;
min-width: 70px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
${e=>"primary"===e.variant?`
background: #1d9bf0;
color: white;
&:hover:not(:disabled) {
background: #1a8cd8;
}
&:disabled {
background: #8ecdf8;
cursor: not-allowed;
}
`:`
background: transparent;
color: #0f1419;
border: 1px solid #cfd9de;
&:hover {
background: #f7f9fa;
border-color: #8b98a5;
}
`}
`,ef=e=>{let{onSubmit:t,onCancel:o,initialValue:r="",placeholder:a,submitText:l,showCancel:s=!1,isExpanded:c=!1}=e,{t:p}=(0,d.$G)(),[u,h]=(0,i.useState)(r),[m,g]=(0,i.useState)(!1),[x,f]=(0,i.useState)(!1),b=(0,i.useRef)(null),w=async()=>{if(u.trim()&&!m){g(!0);try{await t(u.trim()),h("")}catch(e){console.error("Failed to submit comment:",e)}finally{g(!1)}}},v=c||x||u.trim().length>0;return(0,n.jsxs)(eh,{$isExpanded:v,children:[(0,n.jsx)(em,{ref:b,value:u,onChange:e=>h(e.target.value),placeholder:a||p("comments.placeholder"),disabled:m,onFocus:()=>{f(!0)},onBlur:()=>{setTimeout(()=>{u.trim()||f(!1)},150)},$isExpanded:v}),(0,n.jsxs)(eg,{$isExpanded:v,children:[s&&(0,n.jsx)(ex,{variant:"secondary",onClick:()=>{h(r),f(!1),null==o||o()},children:p("comments.cancel")}),(0,n.jsx)(ex,{variant:"primary",onClick:w,disabled:!u.trim()||m,children:m?p(s?"comments.saving":"comments.adding"):l||p("comments.add")})]})]})},eb=a.Z.div`
max-height: ${e=>e.isVisible?"85vh":"0"};
overflow: hidden;
transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
border-top: ${e=>e.isVisible?"1px solid #e1e8ed":"none"};
margin-top: ${e=>e.isVisible?"16px":"0"};
background: white;
will-change: max-height;
contain: layout style;
@media (max-width: 768px) {
max-height: ${e=>e.isVisible?"75vh":"0"};
}
@media (max-width: 479px) {
max-height: ${e=>e.isVisible?"65vh":"0"};
}
`,ew=a.Z.div`
opacity: ${e=>e.isVisible?"1":"0"};
transform: ${e=>e.isVisible?"translateY(0)":"translateY(-8px)"};
transition:
opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1)
${e=>e.isVisible?"0.1s":"0s"},
transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)
${e=>e.isVisible?"0.1s":"0s"};
will-change: opacity, transform;
padding: 16px 0 0;
contain: layout style;
`,ev=a.Z.div`
max-height: calc(85vh - 220px);
overflow-y: auto;
padding-right: 4px;
@media (max-width: 768px) {
max-height: calc(75vh - 200px);
}
@media (max-width: 479px) {
max-height: calc(65vh - 180px);
}
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: #d1d9e0;
border-radius: 3px;
}
&::-webkit-scrollbar-thumb:hover {
background: #aab8c2;
}
`,ey=a.Z.div`
display: flex;
gap: 12px;
padding: 12px 16px;
border-bottom: 1px solid #f7f9fa;
/* transition: background-color 0.2s ease; */
&:hover {
background-color: #f7f9fa;
.markdown-body {
background-color: #f7f9fa;
}
}
&:last-child {
border-bottom: none;
margin-bottom: 4px;
}
`,ej=a.Z.img`
width: 2em;
height: 2em;
border-radius: 50%;
flex-shrink: 0;
@media (max-width: 479px) {
width: 1.5em;
height: 1.5em;
}
`,ek=a.Z.div`
flex: 1;
min-width: 0;
position: relative;
`,e$=a.Z.div`
display: flex;
align-items: center;
gap: 4px;
margin-bottom: 4px;
`,eC=a.Z.a`
font-weight: 700;
color: #132850;
font-size: 15px;
text-decoration: none;
&:hover {
text-decoration: underline;
cursor: pointer;
}
`,eS=a.Z.span`
color: #a1a1a1;
text-shadow:
#d9d9d9 0 0 1px,
#fffffb 0 0 1px,
#fffffb 0 0 2px;
font-size: 0.9em;
&::before {
content: '·';
margin: 0 4px;
}
`,ez=a.Z.div`
color: #333;
/* line-height: 1.3125; */
word-wrap: break-word;
margin-bottom: 12px;
font-size: 1em;
letter-spacing: 0.2px;
&.markdown-body {
font-size: 1em;
}
`,eZ=a.Z.div`
position: absolute;
top: 0;
right: 0;
display: flex;
align-items: center;
gap: 4px;
opacity: 0;
transition: opacity 0.2s ease;
`,eE=a.Z.button`
display: flex;
align-items: center;
justify-content: center;
background: transparent;
border: none;
cursor: pointer;
padding: 6px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
transition: all 0.2s ease;
height: 28px;
min-width: 28px;
${e=>"edit"===e.variant?`
color: #1d9bf0;
&:hover {
background: rgba(29, 155, 240, 0.1);
}
`:"delete"===e.variant?`
color: #f4212e;
&:hover {
background: rgba(244, 33, 46, 0.1);
}
`:`
color: #536471;
&:hover {
background: #f7f9fa;
}
`}
svg {
width: 14px;
height: 14px;
}
`,eL=(0,a.Z)(ey)`
&:hover {
background-color: #f7f9fa;
.markdown-body {
background-color: #f7f9fa;
}
.comment-actions {
opacity: 1;
}
}
`,eR=a.Z.div`
text-align: center;
color: #657786;
padding: 32px 20px;
font-size: 15px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
&::before {
content: '';
width: 16px;
height: 16px;
border: 2px solid #e1e8ed;
border-top: 2px solid #1d9bf0;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
`,eI=a.Z.div`
padding: 0 16px;
padding-bottom: ${e=>e.isVisible?"16px":"0"};
max-height: ${e=>e.isVisible?"200px":"0"};
overflow: hidden;
transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
will-change: max-height;
contain: layout;
`;a.Z.span`
color: #536471;
font-size: 13px;
font-weight: 400;
margin-left: 4px;
`;let e_=a.Z.div`
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
opacity: ${e=>e.isOpen?"1":"0"};
visibility: ${e=>e.isOpen?"visible":"hidden"};
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
backdrop-filter: blur(4px);
`,eA=a.Z.div`
background: white;
border-radius: 16px;
padding: 24px;
max-width: 360px;
width: 90%;
box-shadow:
0 20px 25px -5px rgba(0, 0, 0, 0.1),
0 10px 10px -5px rgba(0, 0, 0, 0.04);
transform: ${e=>e.isOpen?"scale(1) translateY(0)":"scale(0.95) translateY(-8px)"};
transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
`,eM=a.Z.h3`
margin: 0 0 8px 0;
font-size: 18px;
font-weight: 700;
color: #0f1419;
line-height: 1.3;
`,eT=a.Z.p`
margin: 0 0 20px 0;
font-size: 15px;
color: #536471;
line-height: 1.4;
`,eP=a.Z.div`
display: flex;
gap: 12px;
justify-content: flex-end;
`,eO=a.Z.button`
padding: 8px 16px;
border-radius: 20px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
border: none;
min-width: 70px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
${e=>"danger"===e.variant?`
background: #f4212e;
color: white;
&:hover:not(:disabled) {
background: #dc1c2a;
}
&:disabled {
background: #f7a1a8;
cursor: not-allowed;
}
`:`
background: transparent;
color: #0f1419;
border: 1px solid #cfd9de;
&:hover {
background: #f7f9fa;
border-color: #8b98a5;
}
`}
`,eq=e=>{let{issueNumber:t,issueId:o,isVisible:r,commentCount:a,onCommentCountChange:l,repoOwner:s=p.request.owner,repoName:c=p.request.repo}=e,{t:m,i18n:g}=(0,d.$G)(),{isAuthenticated:x,user:f,token:v}=ec(),[y,$]=(0,i.useState)([]),[C,S]=(0,i.useState)(!1),[z,Z]=(0,i.useState)(!1),[E,L]=(0,i.useState)(null),[R,_]=(0,i.useState)(null),[A,M]=(0,i.useState)(!1);(0,i.useEffect)(()=>{$([]),Z(!1),L(null),_(null),M(!1)},[s,c,t]),(0,i.useEffect)(()=>{r&&!z&&P()},[r,z,s,c]),(0,i.useEffect)(()=>{if(R){let e=()=>{_(null)};return window.addEventListener("scroll",e,{passive:!0}),document.addEventListener("scroll",e,{passive:!0}),()=>{window.removeEventListener("scroll",e),document.removeEventListener("scroll",e)}}},[R]);let P=async()=>{S(!0);try{let e=(await h.post("/graphql",b({owner:s,repo:c,issueNumber:t}))).data.data.repository.issue.comments.nodes;$(e),Z(!0)}catch(e){console.error("Failed to load comments:",e)}finally{S(!1)}},O=async e=>{if(!x||!v)throw Error(m("interaction.loginRequired"));try{let t=u(v),i=(await w(t,o,e)).data.data.addComment.commentEdge.node;$(e=>{let t=[...e,i];return null==l||l(t.length),t})}catch(e){throw console.error("Failed to add comment:",e),Error(m("comments.addFailed"))}},q=async(e,t)=>{if(!x||!v)throw Error(m("interaction.loginRequired"));try{let o=u(v),i=(await j(o,e,t)).data.data.updateIssueComment.issueComment;$(t=>t.map(t=>t.id===e?i:t)),L(null)}catch(e){throw console.error("Failed to update comment:",e),Error(m("comments.updateFailed"))}},N=async e=>{if(x&&v){M(!0);try{let t=u(v);await k(t,e),$(t=>{let o=t.filter(t=>t.id!==e);return null==l||l(o.length),o}),_(null)}catch(e){console.error("Failed to delete comment:",e)}finally{M(!1)}}},D=e=>{_(e)},F=()=>{_(null)},H=e=>x&&f&&e.author.login===f.login,V=e=>{let t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eb,{isVisible:r,children:(0,n.jsxs)(ew,{isVisible:r,children:[(0,n.jsx)(eI,{isVisible:r,children:(0,n.jsx)(ef,{onSubmit:O,placeholder:m("comments.placeholder"),submitText:m("comments.add")})}),C&&a>0&&(0,n.jsx)(eR,{children:m("comments.loading")}),!C&&y.length>0&&(0,n.jsx)(ev,{children:y.map(e=>(0,n.jsxs)(eL,{children:[(0,n.jsx)(ej,{src:e.author.avatarUrl,alt:e.author.login}),(0,n.jsxs)(ek,{children:[(0,n.jsxs)(e$,{children:[(0,n.jsx)(eC,{href:`https://github.com/${e.author.login}`,target:"_blank",rel:"noopener noreferrer",children:e.author.login}),(0,n.jsx)(eS,{children:I(e.createdAt,g.language)})]}),E===e.id?(0,n.jsx)(ef,{onSubmit:t=>q(e.id,t),onCancel:()=>L(null),initialValue:V(e.bodyHTML),submitText:m("comments.save"),showCancel:!0}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ez,{className:"markdown-body",dangerouslySetInnerHTML:{__html:T(e.bodyHTML)}}),H(e)&&(0,n.jsxs)(eZ,{className:"comment-actions",children:[(0,n.jsx)(eE,{variant:"edit",onClick:()=>L(e.id),title:m("comments.edit"),children:(0,n.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:(0,n.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"})})}),(0,n.jsx)(eE,{variant:"delete",onClick:()=>D(e.id),title:m("comments.delete"),children:(0,n.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:(0,n.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})]})]})]},e.id))})]})}),R&&(0,eu.createPortal)((0,n.jsx)(e_,{isOpen:!!R,onClick:F,children:(0,n.jsxs)(eA,{isOpen:!!R,onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(eM,{children:m("comments.confirmDeleteTitle")}),(0,n.jsx)(eT,{children:m("comments.confirmDeleteMessage")}),(0,n.jsxs)(eP,{children:[(0,n.jsx)(eO,{variant:"cancel",onClick:F,children:m("comments.cancel")}),(0,n.jsx)(eO,{variant:"danger",onClick:()=>R&&N(R),disabled:A,children:A?m("comments.deleting"):m("comments.delete")})]})]})}),document.body)]})},eN="#536471",eD="#f91880",eF="#1d9bf0",eH="rgba(249, 24, 128, 0.1)",eV="rgba(29, 161, 242, 0.1)",eG=(0,el.F4)`
0% {
transform: scale(1);
}
50% {
transform: scale(1.4);
}
100% {
transform: scale(1);
}
`,eU=(0,el.F4)`
0% {
transform: translate(0, 0) scale(1);
opacity: 1;
}
100% {
transform: translate(var(--particle-x), var(--particle-y)) scale(0) rotate(var(--particle-rotation));
opacity: 0;
}
`,eB=a.Z.div`
position: absolute;
left: 50%;
top: 50%;
width: ${e=>e.size};
height: ${e=>e.size};
background-color: ${e=>"circle"===e.shape?e.color:"transparent"};
border-radius: ${e=>"circle"===e.shape?"50%":"0"};
pointer-events: none;
opacity: 0;
transform-origin: center;
transform: translate(-50%, -50%) scale(${e=>e.initialScale})
rotate(${e=>e.initialRotation});
animation: ${eU} ${e=>e.duration} ease-out forwards;
animation-delay: ${e=>e.delay};
--particle-x: ${e=>e.x};
--particle-y: ${e=>e.y};
--particle-rotation: ${e=>180*Math.random()-90}deg;
${e=>"heart"===e.shape&&`
&::before,
&::after {
content: '';
position: absolute;
left: calc(${e.size} / 2);
top: 0;
width: calc(${e.size} / 2);
height: ${e.size};
background: ${e.color};
border-radius: calc(${e.size} / 2) calc(${e.size} / 2) 0 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
&::after {
left: 0;
transform: rotate(45deg);
transform-origin: 100% 100%;
}
`}
`,eY=a.Z.div`
display: flex;
flex-direction: column;
/* margin-top: 10px; */
`,eJ=a.Z.div`
display: flex;
align-items: center;
gap: 10px;
margin: 0;
margin-left: -8px;
`,eW=a.Z.span`
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 20px;
overflow: hidden;
transition:
color 0.2s,
opacity 0.2s,
transform 0.2s;
opacity: ${e=>+!!e.$isVisible};
transform: ${e=>e.$isVisible?"scale(1)":"scale(0.8)"};
pointer-events: ${e=>e.$isVisible?"auto":"none"};
`,eK=a.Z.button`
display: flex;
align-items: center;
color: ${eN};
background: none;
border: none;
padding: 8px 0px;
cursor: pointer;
transition: all 0.2s;
font-size: 13px;
font-weight: 400;
border-radius: 20px;
min-width: 0;
position: relative;
width: 50px;
span {
font-size: 13px;
transition: color 0.2s;
min-width: 0;
position: relative;
z-index: 1;
background-color: rgba(0, 0, 0, 0);
border: 0 solid black;
box-sizing: border-box;
display: inline;
font: inherit;
list-style: none;
margin: 0px;
padding: 0px;
position: relative;
text-align: inherit;
text-decoration: none;
white-space: inherit;
word-wrap: break-word;
}
&.liked {
.icon-container svg {
color: ${eD};
fill: ${eD};
}
.number-container {
color: ${eD};
}
.icon-container:hover {
svg {
color: ${eD};
fill: ${eD};
}
&::before {
background: ${eH};
}
}
}
&:hover.like-button .number-container {
color: ${eD};
}
&:hover.comment-button .number-container {
color: ${eF};
}
&.comment-active .number-container {
color: ${eF};
}
`,eQ=a.Z.div`
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border-radius: 50%;
cursor: pointer;
svg {
width: 20px;
height: 20px;
transition:
color 0.2s,
opacity 0.2s;
position: relative;
z-index: 1;
fill: ${eN};
}
&.liked-animation svg {
animation: ${eG} 0.3s ease-in-out;
}
&::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
border-radius: 50%;
background: transparent;
transform: translate(-50%, -50%);
transition: all 0.2s ease;
z-index: 0;
}
&.like-icon:hover {
svg {
color: ${eD};
fill: ${eD};
}
&::before {
width: 36px;
height: 36px;
background: ${eH};
}
}
&.comment-icon:hover {
svg {
color: ${eF};
fill: ${eF};
}
&::before {
width: 36px;
height: 36px;
background: ${eV};
}
}
&.comment-active {
svg {
color: ${eF};
fill: ${eF};
}
&::before {
width: 36px;
height: 36px;
background: ${eV};
}
}
`,eX=(0,i.forwardRef)((e,t)=>{let{filled:o=!1}=e;return(0,n.jsx)("svg",{viewBox:"0 0 24 24",ref:t,children:(0,n.jsx)("g",{children:o?(0,n.jsx)("path",{d:"M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"}):(0,n.jsx)("path",{d:"M16.697 5.5c-1.222-.06-2.679.51-3.89 2.16l-.805 1.09-.806-1.09C9.984 6.01 8.526 5.44 7.304 5.5c-1.243.07-2.349.78-2.91 1.91-.552 1.12-.633 2.78.479 4.82 1.074 1.97 3.257 4.27 7.129 6.61 3.87-2.34 6.052-4.64 7.126-6.61 1.111-2.04 1.03-3.7.477-4.82-.561-1.13-1.666-1.84-2.908-1.91zm4.187 7.69c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})})})}),e0=()=>(0,n.jsx)("svg",{viewBox:"0 0 24 24",children:(0,n.jsx)("g",{children:(0,n.jsx)("path",{d:"M1.751 10c0-4.42 3.584-8 8.005-8h4.366c4.49 0 8.129 3.64 8.129 8.13 0 2.96-1.607 5.68-4.196 7.11l-8.054 4.46v-3.69h-.067c-4.49.1-8.183-3.51-8.183-8.01zm8.005-6c-3.317 0-6.005 2.69-6.005 6 0 3.37 2.77 6.08 6.138 6.01l.351-.01h1.761v2.3l5.087-2.81c1.951-1.08 3.163-3.13 3.163-5.36 0-3.39-2.744-6.13-6.129-6.13H9.756z"})})}),e1=()=>{let e=360*Math.random(),t=25*Math.random()+25,o=`${Math.cos(Math.PI/180*e)*t}px`,i=[eD,"#ff78c8","#ff4da6","#e60073","#cc0066"],r=Math.random()>.3?"circle":"heart",n=Math.floor(Math.random()*("heart"===r?3:4))+("heart"===r?5:4);return{x:o,y:`${Math.sin(Math.PI/180*e)*t-15}px`,duration:`${.4*Math.random()+.5}s`,delay:`${.15*Math.random()}s`,color:i[Math.floor(Math.random()*i.length)],size:`${n}px`,shape:r,initialScale:.5*Math.random()+.7,initialRotation:`${90*Math.random()-45}deg`}},e2=e=>{let{id:t,issueId:o,reactions:r,comments:a,repoOwner:l,repoName:s}=e,{t:c}=(0,d.$G)(),{isAuthenticated:p,token:h,login:m}=ec(),[g,b]=(0,i.useState)(r.heartCount),[w,v]=(0,i.useState)(r.userReacted),[y,j]=(0,i.useState)(a.totalCount),[k,$]=(0,i.useState)(!1),[C,S]=(0,i.useState)(!1),[z,Z]=(0,i.useState)(!1),[E,L]=(0,i.useState)([]),R=async()=>{try{console.log("Toggle like for issue:",t,w,h);let e=u(h);if(w)v(!1),b(g-1),await f(e,o,"HEART");else{v(!0),b(g+1),Z(!0);let t=Array.from({length:Math.floor(6*Math.random())+10}).map((e,t)=>({id:Date.now()+t,style:e1()}));L(t),await x(e,o,"HEART")}}catch(e){console.error("Failed to toggle like:",e),v(w),b(g)}};return(0,i.useEffect)(()=>{v(r.userReacted),b(r.heartCount)},[r.userReacted,r.heartCount]),(0,i.useEffect)(()=>{j(a.totalCount)},[a.totalCount]),(0,i.useEffect)(()=>{if(z){let e=setTimeout(()=>{Z(!1)},300),t=setTimeout(()=>{L([])},1200);return()=>{clearTimeout(e),clearTimeout(t)}}},[z]),(0,n.jsxs)(eY,{children:[(0,n.jsxs)(eJ,{children:[(0,n.jsxs)(eK,{onClick:()=>{if(!p)return void m();C||(S(!0),R(),S(!1))},className:`like-button ${w?"liked":""}`,title:c(p?w?"interaction.liked":"interaction.like":"interaction.loginToLike"),children:[(0,n.jsxs)(eQ,{className:`icon-container like-icon ${z?"liked-animation":""}`,children:[(0,n.jsx)(eX,{filled:w}),E.map(e=>(0,n.jsx)(eB,{x:e.style.x,y:e.style.y,duration:e.style.duration,delay:e.style.delay,color:e.style.color,size:e.style.size,shape:e.style.shape,initialScale:e.style.initialScale,initialRotation:e.style.initialRotation},e.id))]}),(0,n.jsx)(eW,{className:"number-container",$isVisible:g>0,children:(0,n.jsx)(es.ZP,{transformTiming:{duration:150,easing:"ease-in-out"},spinTiming:{duration:150,easing:"ease-in-out"},opacityTiming:{duration:150,easing:"ease-in-out"},value:g})})]}),(0,n.jsxs)(eK,{onClick:()=>{if(!p)return void m();$(!k)},className:`comment-button ${k?"comment-active":""}`,title:c(p?"interaction.comment":"interaction.loginToComment"),children:[(0,n.jsx)(eQ,{className:`icon-container comment-icon ${k?"comment-active":""}`,children:(0,n.jsx)(e0,{})}),(0,n.jsx)(eW,{className:"number-container",$isVisible:y>0,children:(0,n.jsx)(es.ZP,{transformTiming:{duration:150,easing:"ease-in-out"},spinTiming:{duration:150,easing:"ease-in-out"},opacityTiming:{duration:150,easing:"ease-in-out"},value:y})})]})]}),(0,n.jsx)(eq,{issueNumber:t,issueId:o,isVisible:k,commentCount:y,onCommentCountChange:j,repoOwner:l,repoName:s})]})},e5=a.Z.div`
position: relative;
margin: 0.5em 0;
display: flex;
border-radius: 10px;
`,e4=a.Z.div`
flex: 1 1;
padding: 16px 20px 0px;
margin: 6px;
overflow: auto;
background: hsla(0, 0%, 100%, 0.8);
border: 0.5px solid #f1f1f1;
border-radius: 10px;
box-shadow: 0 0.1em 0.2em 0 rgba(234, 234, 234, 0.8);
transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
position: relative;
overflow: hidden;
font-size: 15px;
z-index: 2;
/* border: 1px solid rgb(212, 212, 216); */
/* box-shadow:
rgba(0, 0, 0, 0) 0px 0px 0px 0px,
rgba(0, 0, 0, 0) 0px 0px 0px 0px,
rgba(0, 0, 0, 0.15) 2px 0px 8px 0px; */
/* &:hover { */
/* box-shadow: 0 0.2em 0.3em 0.1em rgba(200, 200, 200, 0.4); */
/* transform: translateY(-1px); */
/* } */
`,e8=a.Z.div`
margin-bottom: 0.7em;
font-size: 1em;
position: relative;
display: flex;
align-items: center;
flex-wrap: wrap;
/* gap: 0.2em; */
`,e6=a.Z.div`
color: #333;
&.markdown-body {
font-size: 1em;
letter-spacing: 0.2px;
word-wrap: break-word;
background-color: transparent;
/* background: hsla(0, 0%, 100%, 0.8); */
ol {
list-style: decimal !important;
}
ul {
list-style: circle !important;
}
}
`,e3=a.Z.div`
position: relative;
margin-top: 0.8em;
font-size: 1em;
user-select: none;
`;var e7=o(2017),e9=o(9928);let te=e=>{let{className:t,size:o=720,springOptions:r={bounce:0}}=e,a=(0,i.useRef)(null),[s,d]=(0,i.useState)(!1),[c,p]=(0,i.useState)(null),u=(0,e7.q)(0,r),h=(0,e7.q)(0,r),m=(0,e9.H)(u,e=>`${e-o/2}px`),g=(0,e9.H)(h,e=>`${e-o/2}px`);(0,i.useEffect)(()=>{if(a.current){let e=a.current.parentElement;e&&("static"===window.getComputedStyle(e).position&&(e.style.position="relative"),e.style.overflow="hidden",p(e))}},[]);let x=(0,i.useCallback)(e=>{if(!c)return;let{left:t,top:o}=c.getBoundingClientRect();u.set(e.clientX-t),h.set(e.clientY-o)},[u,h,c]);(0,i.useEffect)(()=>{if(c)return c.addEventListener("mousemove",x),c.addEventListener("mouseenter",()=>d(!0)),c.addEventListener("mouseleave",()=>d(!1)),()=>{c.removeEventListener("mousemove",x);try{c.removeEventListener("mouseenter",()=>d(!0)),c.removeEventListener("mouseleave",()=>d(!1))}catch(e){console.warn("Could not remove event listeners from parentElement",e)}}},[c,x]);let f={width:o,height:o,left:m.get(),top:g.get(),position:"absolute",pointerEvents:"none",borderRadius:"9999px",backgroundImage:"radial-gradient(circle at center, rgba(255, 255, 255, 0.95), rgba(244, 244, 245, 0.8), rgba(228, 228, 231, 0.4), rgba(200, 200, 200, 0.1), transparent 70%)",filter:"blur(0.5em)",opacity:.9*!!s,transition:"opacity 0.15s ease-in-out"};return(0,n.jsx)(l.E.div,{ref:a,className:t,style:{...f,left:m,top:g}})},tt=a.Z.span`
font-weight: 700;
font-size: 15px;
color: #132850;
text-decoration: none;
cursor: pointer;
`,to=a.Z.span`
margin-left: 0.2em;
display: inline-flex;
align-items: center;
`,ti=a.Z.svg`
width: 20px;
height: 20px;
color: rgb(29, 155, 240);
fill: rgb(29, 155, 240);
`,tr=a.Z.span`
margin: 0 4px;
font-weight: 600;
color: #a1a1a1;
text-shadow:
#d9d9d9 0 0 1px,
#fffffb 0 0 1px,
#fffffb 0 0 2px;
font-size: 0.9em;
@media (max-width: 479px) {
margin: auto 0.2em;
}
`,tn=a.Z.span`
color: #a1a1a1;
text-shadow:
#d9d9d9 0 0 1px,
#fffffb 0 0 1px,
#fffffb 0 0 2px;
font-size: 0.9em;
`,ta=a.Z.img`
width: 2em;
height: 2em;
border-radius: 50%;
margin-right: 0.5em;
cursor: pointer;
@media (max-width: 479px) {
width: 1.5em;
height: 1.5em;
margin-right: 0.3em;
}
`,tl=a.Z.a`
margin-left: 8px;
display: inline-flex;
align-items: center;
color: #a1a1a1;
text-decoration: none;
transition: color 0.2s ease;
&:hover {
color: #132850;
}
@media (max-width: 479px) {
margin-left: 4px;
}
`,ts=a.Z.svg`
width: 16px;
height: 16px;
fill: currentColor;
`,td=a.Z.div`
margin: 0.5em 0 0.5em 0;
font-size: 0.9em;
font-weight: 500;
line-height: 1.3;
color: #6b7280;
word-wrap: break-word;
word-break: break-word;
background: #f8fafc;
padding: 0.4em 0.6em;
border-radius: 4px;
border-left: 3px solid #e5e7eb;
@media (max-width: 479px) {
font-size: 0.85em;
margin: 0.4em 0 0.2em 0;
padding: 0.3em 0.5em;
}
`,tc=e=>{let{issue:t,repoOwner:o,repoName:i,onLabelClick:r}=e,{i18n:a}=(0,d.$G)(),l=e=>{window.open(e,"_blank")};return(0,n.jsxs)(e5,{children:[(0,n.jsx)(te,{}),(0,n.jsxs)(e4,{children:[(0,n.jsxs)(e8,{children:[(0,n.jsx)(ta,{src:t.author.avatarUrl,onClick:()=>l(t.author.url)}),(0,n.jsx)(tt,{onClick:()=>l(t.author.url),children:t.author.login}),(0,n.jsx)(to,{children:(0,n.jsx)(ti,{viewBox:"0 0 22 22",children:(0,n.jsx)("path",{d:"M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z"})})}),(0,n.jsx)(tr,{children:"\xb7"}),(0,n.jsx)(tn,{children:I(t.createdAt,a.language)}),(0,n.jsx)(tl,{href:t.url,target:"_blank",rel:"noopener noreferrer",title:"在 GitHub 中查看",children:(0,n.jsx)(ts,{viewBox:"0 0 16 16",children:(0,n.jsx)("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})})}),"default"!==t.label.name&&(0,n.jsx)(F,{name:t.label.name,color:t.label.color,style:{position:"absolute",right:0},onClick:r})]}),(0,n.jsx)(td,{children:t.title}),(0,n.jsx)(e6,{className:"markdown-body",dangerouslySetInnerHTML:{__html:T(t.bodyHTML)}}),(0,n.jsx)(e2,{id:t.number,issueId:t.id,reactions:t.