(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,618488,e=>{var t=e.i(391398),s=e.i(145246),a=e.i(191788);e.i(966278);var i=e.i(318398),r=e.i(979021),n=e.i(687385),o=e.i(189500),l=e.i(94432);let c=new String(".reaction-list.jsx-e42adad3dadb66e3{background-color:var(--light-background);border-radius:50px;justify-content:center;align-items:center;width:250px;padding:4px 8px;display:flex;position:absolute;top:-44px;left:15px;transform:translateY(0)scale(0);box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d}.reaction-list.hovered.jsx-e42adad3dadb66e3{transform-origin:bottom;transition:all .1s;transform:translateY(-2px)scale(1.2)}.reaction-list.jsx-e42adad3dadb66e3 li.jsx-e42adad3dadb66e3{margin-left:5px}.reaction-list.jsx-e42adad3dadb66e3 li.jsx-e42adad3dadb66e3:first-child{margin-left:0}.reaction-list.jsx-e42adad3dadb66e3 li.jsx-e42adad3dadb66e3>button.jsx-e42adad3dadb66e3{display:block;position:relative}.reaction-list.jsx-e42adad3dadb66e3 li.jsx-e42adad3dadb66e3>button.jsx-e42adad3dadb66e3>span.jsx-e42adad3dadb66e3{background:var(--hover-background);border-radius:10px;padding:1px 5px;font-size:8px;font-weight:700;display:none;position:absolute;top:-17px;left:50%;transform:translate(-50%)}.reaction-list.jsx-e42adad3dadb66e3 li.jsx-e42adad3dadb66e3>button.jsx-e42adad3dadb66e3:hover>span.jsx-e42adad3dadb66e3{display:block}.reaction-list.jsx-e42adad3dadb66e3 li.jsx-e42adad3dadb66e3 img.jsx-e42adad3dadb66e3{width:35px;display:block}.reaction-list.jsx-e42adad3dadb66e3 li.jsx-e42adad3dadb66e3 img.jsx-e42adad3dadb66e3:hover{transition:all .1s;transform:translateY(-2px)scale(1.2)}.reactions.jsx-e42adad3dadb66e3{justify-content:center;align-items:center;width:33.33%;display:flex;position:relative}.reactions.no-manual-width.jsx-e42adad3dadb66e3{width:auto}.reactions.comment-mode.jsx-e42adad3dadb66e3{float:left;width:auto}.reactions.comment-mode.jsx-e42adad3dadb66e3 .icon.jsx-e42adad3dadb66e3{width:16px;position:relative}.reactions.comment-mode.jsx-e42adad3dadb66e3 .icon.jsx-e42adad3dadb66e3 img.jsx-e42adad3dadb66e3{width:16px;min-width:16px}.reactions.comment-mode.jsx-e42adad3dadb66e3 .reaction-text.jsx-e42adad3dadb66e3{color:var(--text-grey);margin-left:4px}.reactions.comment-mode.jsx-e42adad3dadb66e3+*{float:left}.reactions.jsx-e42adad3dadb66e3 .reaction-text.jsx-e42adad3dadb66e3{margin-left:30px;display:none}.reactions.jsx-e42adad3dadb66e3 .reaction-text.reacted.jsx-e42adad3dadb66e3{font-weight:700}.reaction-btn.jsx-e42adad3dadb66e3{align-items:center;display:flex;position:relative}.icon.jsx-e42adad3dadb66e3{width:25px}.icon.jsx-e42adad3dadb66e3 img.jsx-e42adad3dadb66e3,.icon.jsx-e42adad3dadb66e3 svg{filter:brightness(0)saturate()invert(41%)sepia(3%)saturate(1224%)hue-rotate(179deg)brightness(95%)contrast(93%);width:21px;min-width:21px;display:block}.icon.jsx-e42adad3dadb66e3 .icon-active.jsx-e42adad3dadb66e3{filter:unset}");c.__hash="e42adad3dadb66e3";let d=n.f.subscribe(i.f.ApiConsumer(({api:e,commentMode:i=!0,reactions:n,reactionButtonId:d=1,post:h,onReact:p,noManualWidth:x})=>{let m,g=e=>n.find(t=>t.id===e),[b,u]=(0,a.useState)(!1),[f,j]=(0,a.useState)(g(h&&h.reaction.userReactionId)),y=g(d),_=f&&f.id===d,k=(0,r.default)(()=>{clearTimeout(m),u(!0)},100),w=(0,r.default)(()=>{m=setTimeout(()=>{u(!1)},500)},100),v=(e,t)=>{if(e&&!f&&p(l.U.Up,t,null),!e){let e=f.id;p(l.U.Down,null,e)}if(e&&f&&f.id!==t){let e=f.id;p(l.U.Neutral,t,e)}},S=t=>{v(!0,t),u(!1),e.post({uri:`posts/${h.id}/likes`,params:{reaction_id:t}}).then(()=>{j(g(t))})};return(0,a.useEffect)(()=>{j(g(h&&h.reaction.userReactionId))},[h]),(0,t.jsxs)("div",{className:`jsx-${c.__hash} ${i?"comment-mode ":""}reactions no-user-select ${x?"no-manual-width":""}`,children:[(0,t.jsx)("ul",{onMouseEnter:k,onMouseLeave:w,onTouchStart:k,onTouchEnd:w,className:`jsx-${c.__hash} reaction-list ${b&&"hovered"}`,children:(n||[]).map(e=>(0,t.jsx)("li",{className:`jsx-${c.__hash}`,children:(0,t.jsxs)("button",{onClick:()=>S(e.id),className:`jsx-${c.__hash}`,children:[(0,t.jsx)("span",{className:`jsx-${c.__hash}`,children:e.title}),(0,t.jsx)("img",{width:"32",src:e.links.svgImageUrl,alt:e.title,title:e.title,className:`jsx-${c.__hash}`})]})},e.id))}),(0,t.jsxs)("button",{onClick:()=>{w(),_?(v(!1),u(!1),e.del(`posts/${h.id}/likes`).then(()=>{j(null)})):S(d)},className:`jsx-${c.__hash} reaction-btn`,children:[(0,t.jsx)("span",{className:`jsx-${c.__hash} icon`,children:f&&_?(0,t.jsx)("img",{src:f.links.imageUrl,alt:f.title,width:"25",className:`jsx-${c.__hash} icon-active`}):y?(0,t.jsx)("img",{src:y.links.imageUrl,alt:y.title,width:"25",className:`jsx-${c.__hash}`}):(0,t.jsx)(o.f,{})}),(0,t.jsx)("span",{style:{color:f&&_?f.textColor:""},className:`jsx-${c.__hash} ${f&&_?"reacted":""} reaction-text`,children:f&&_?f.title:y?y.title:"Thích"})]}),(0,t.jsx)(s.default,{id:c.__hash,children:c})]})}),({reactions:e})=>({reactions:e}));e.s(["f",0,d],618488)},634529,e=>{var t=e.i(391398),s=e.i(145246),a=e.i(191788);let i=new String(".menu-container.jsx-8833484ec09cf18c{width:100%;position:relative}.menu.jsx-8833484ec09cf18c{min-width:110px;box-shadow:var(--box-shadow);background:var(--context-menu-background);opacity:0;visibility:hidden;z-index:10;border-radius:4px;flex-direction:column;padding:5px;font-size:13px;font-weight:500;transition:opacity .2s,transform .2s,visibility .2s;display:flex;position:absolute;transform:translateY(-20px)}.menu.jsx-8833484ec09cf18c button,.menu.jsx-8833484ec09cf18c a{padding:5px}.menu.left.jsx-8833484ec09cf18c{left:0}.menu.right.jsx-8833484ec09cf18c{right:0}.menu.jsx-8833484ec09cf18c>*{color:var(--primary-text);text-align:left;line-height:15px}.menu.jsx-8833484ec09cf18c>:last-child{margin-bottom:0}.menu.active.jsx-8833484ec09cf18c{opacity:1;visibility:visible;z-index:999;transform:translateY(0)}.menu-trigger.jsx-8833484ec09cf18c{justify-content:center;align-items:center;width:100%;height:auto;padding:10px 5px;display:flex}.menu-trigger.jsx-8833484ec09cf18c>span.jsx-8833484ec09cf18c{background-color:#cacaca;border-radius:15px;width:3px;height:3px;margin:0 1.5px;transform:scale(1.5)}");i.__hash="8833484ec09cf18c",e.s(["f",0,({position:e="left",menuItems:r=null,title:n=null})=>{let o=(0,a.useRef)(null),[l,c]=((e,t)=>{let[s,i]=(0,a.useState)(t);return(0,a.useEffect)(()=>{let t=t=>{null===e.current||e.current.contains(t.target)||i(!s)};return s&&window.addEventListener("click",t),()=>{window.removeEventListener("click",t)}},[s,e]),[s,i]})(o,!1);return(0,t.jsxs)("div",{className:`jsx-${i.__hash} menu-container`,children:[(0,t.jsx)("button",{onClick:()=>{c(!l)},className:`jsx-${i.__hash} menu-trigger`,children:n||(0,t.jsxs)(a.Fragment,{children:[(0,t.jsx)("span",{className:`jsx-${i.__hash}`}),(0,t.jsx)("span",{className:`jsx-${i.__hash}`}),(0,t.jsx)("span",{className:`jsx-${i.__hash}`})]})}),(0,t.jsx)("nav",{ref:o,onClick:()=>{c(!1)},className:`jsx-${i.__hash} menu ${l?"active":"inactive"} ${e}`,children:r}),(0,t.jsx)(s.default,{id:i.__hash,children:i})]})}],634529)},867507,314390,e=>{var t,s,a,i,r,n=e.i(391398),o=e.i(145246),l=e.i(191788),c=e.i(827808),d=e.i(455404),h=e.i(661655),p=e.i(565715);function x(){return(x=Object.assign.bind()).apply(null,arguments)}let m=function(e){return l.createElement("svg",x({xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",viewBox:"0 0 512 512"},e),l.createElement("path",{d:"M418.7 467.9H38.3c-17 0-30.8-13.8-30.8-30.8V127.6c0-17 13.8-30.8 30.8-30.8h380.4c17 0 30.8 13.8 30.8 30.8v309.5c0 17-13.8 30.8-30.8 30.8",style:{fill:"#0396fd"}}),l.createElement("path",{d:"M449.5 127.6v309.5c0 17-13.8 30.8-30.8 30.8h-30.5c17 0 30.8-13.8 30.8-30.8V127.6c0-17-13.8-30.8-30.8-30.8h30.5c17 0 30.8 13.8 30.8 30.8",style:{fill:"#0077f0"}}),l.createElement("path",{d:"M473.7 409.3H93.3c-17 0-30.8-13.8-30.8-30.8V69c0-17 13.8-30.8 30.8-30.8h380.4c17 0 30.8 13.8 30.8 30.8v309.5c0 17-13.8 30.8-30.8 30.8",style:{fill:"#c9f0ff"}}),l.createElement("path",{d:"M504.5 70.4v309.5c0 17-13.8 30.8-30.8 30.8h-30.5c17 0 30.8-13.8 30.8-30.8V70.4c0-17-13.8-30.8-30.8-30.8h30.5c17 0 30.8 13.8 30.8 30.8",style:{fill:"#9ae7fd"}}),l.createElement("path",{d:"M504.5 333.8 391.2 206.2c-1.9-2.2-5.2-2.3-7.3-.2l-67.8 67.7-87.4-98.5c-1.9-2.2-5.2-2.3-7.3-.2l-159 158.9V380c0 17 13.8 30.8 30.8 30.8h380.4c17 0 30.8-13.8 30.8-30.8v-46.2z",style:{fill:"#80e0dc"}}),l.createElement("path",{d:"M504.5 333.8v46.1c0 17-13.8 30.8-30.8 30.8h-30.5c17 0 30.8-13.8 30.8-30.8v-80.4z",style:{fill:"#00a8b0"}}),l.createElement("path",{d:"M459.2 132.9c0 24.4-19.8 44.1-44.1 44.1S371 157.2 371 132.9s19.8-44.1 44.1-44.1 44.1 19.8 44.1 44.1",style:{fill:"#ffd86e"}}),l.createElement("path",{d:"M459.2 132.9c0 24.4-19.8 44.1-44.1 44.1-12.4 0-23.6-5.1-31.6-13.3 5.2 2.1 10.8 3.3 16.8 3.3 24.4 0 44.1-19.8 44.1-44.1 0-12-4.8-22.8-12.5-30.8 16 6.6 27.3 22.4 27.3 40.8",style:{fill:"#ffb509"}}),t||(t=l.createElement("path",{d:"M415.1 81.3c-28.5 0-51.6 23.2-51.6 51.6s23.2 51.6 51.6 51.6 51.6-23.2 51.6-51.6-23.2-51.6-51.6-51.6m0 88.2c-20.2 0-36.6-16.4-36.6-36.6s16.4-36.6 36.6-36.6 36.6 16.4 36.6 36.6-16.5 36.6-36.6 36.6"})),s||(s=l.createElement("path",{d:"M473.7 32.1H93.3C72.2 32.1 55 49.3 55 70.4v18.9H38.3C17.2 89.3 0 106.5 0 127.6v309.5c0 21.1 17.2 38.3 38.3 38.3H290c4.2 0 7.5-3.4 7.5-7.5s-3.4-7.5-7.5-7.5H38.3C25.5 460.4 15 450 15 437.1V127.6c0-12.8 10.4-23.3 23.3-23.3H55v275.6c0 21.1 17.2 38.3 38.3 38.3H442v18.9c0 12.8-10.4 23.3-23.3 23.3h-81.1c-4.2 0-7.5 3.4-7.5 7.5 0 4.2 3.4 7.5 7.5 7.5h81.1c21.1 0 38.3-17.2 38.3-38.3v-18.9h16.7c21.1 0 38.3-17.2 38.3-38.3V70.4c0-21.1-17.2-38.3-38.3-38.3m23.3 282L396.8 201.2c-2.3-2.6-5.6-4.1-9-4.2s-6.8 1.2-9.2 3.7l-62.1 62.1-82.1-92.5c-2.3-2.6-5.6-4.1-9-4.2-3.5-.1-6.8 1.2-9.2 3.7L158 228c-2.9 2.9-2.9 7.7 0 10.6s7.7 2.9 10.6 0l56.3-56.3 106.7 120.3c1.5 1.7 3.6 2.5 5.6 2.5 1.8 0 3.6-.6 5-1.9 3.1-2.8 3.4-7.5.6-10.6L326.5 274l60.9-60.8L497 336.7v43.2c0 12.8-10.4 23.3-23.3 23.3H93.3c-12.8 0-23.3-10.4-23.3-23.3v-43l66.1-66c2.9-2.9 2.9-7.7 0-10.6s-7.7-2.9-10.6 0L70 315.7V70.4c0-12.8 10.4-23.3 23.3-23.3h380.4c12.8 0 23.3 10.4 23.3 23.3z"})))};var g=l,b=e.i(501584);e.i(966278);var u=e.i(318398),f=e.i(5091);function j(){return(j=Object.assign.bind()).apply(null,arguments)}let y=function(e){return l.createElement("svg",j({xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",viewBox:"0 0 512 512"},e),l.createElement("circle",{cx:243.172,cy:273.26,r:229.409,style:{fill:"#fddf6d"}}),l.createElement("path",{d:"M292.329 468.801c-126.699 0-229.408-102.709-229.408-229.408 0-67.69 29.323-128.525 75.953-170.515C64.604 106.852 13.76 184.117 13.76 273.259c0 126.699 102.709 229.408 229.408 229.408 59.009 0 112.807-22.286 153.455-58.892-31.29 15.999-66.737 25.026-104.294 25.026",style:{fill:"#fcc56b"}}),l.createElement("path",{d:"m166.174 18.24 27.935 56.601a15.98 15.98 0 0 0 12.03 8.74l62.463 9.076c13.106 1.904 18.338 18.01 8.855 27.254l-45.199 44.058a15.98 15.98 0 0 0-4.595 14.142l10.67 62.21c2.239 13.052-11.462 23.006-23.184 16.844l-55.869-29.372a15.97 15.97 0 0 0-14.87 0l-55.869 29.372c-11.722 6.162-25.422-3.792-23.184-16.844l10.67-62.21a15.98 15.98 0 0 0-4.595-14.142l-45.199-44.058c-9.483-9.244-4.251-25.349 8.855-27.254l62.463-9.076a15.98 15.98 0 0 0 12.03-8.74l27.935-56.601c5.862-11.876 22.797-11.876 28.658 0M422.946 93.963l18.112 36.697a10.36 10.36 0 0 0 7.8 5.667l40.498 5.885c8.496 1.234 11.89 11.677 5.741 17.67l-29.305 28.564a10.36 10.36 0 0 0-2.979 9.17l6.917 40.333c1.451 8.463-7.431 14.916-15.031 10.92l-36.222-19.044a10.36 10.36 0 0 0-9.641 0l-36.222 19.044c-7.599 3.996-16.483-2.458-15.031-10.92l6.917-40.333a10.36 10.36 0 0 0-2.979-9.17l-29.305-28.564c-6.148-5.993-2.755-16.435 5.741-17.67l40.498-5.885a10.36 10.36 0 0 0 7.8-5.667l18.112-36.697c3.8-7.701 14.78-7.701 18.579 0",style:{fill:"#ff0"}}),l.createElement("path",{d:"m157.705 86.771 11.423 23.146a6.53 6.53 0 0 0 4.92 3.574l25.543 3.712c5.359.779 7.5 7.364 3.621 11.144l-18.484 18.017a6.53 6.53 0 0 0-1.879 5.784l4.363 25.44c.916 5.337-4.687 9.407-9.481 6.888l-22.846-12.011c-1.904-1-4.177-1-6.081 0l-22.846 12.011c-4.793 2.52-10.395-1.55-9.481-6.888l4.363-25.44a6.54 6.54 0 0 0-1.879-5.784l-18.484-18.017c-3.877-3.78-1.738-10.365 3.621-11.144l25.543-3.712a6.54 6.54 0 0 0 4.92-3.574l11.423-23.146c2.399-4.855 9.324-4.855 11.721 0M416.666 144.781l5.867 11.889a3.35 3.35 0 0 0 2.527 1.835l13.119 1.906c2.753.399 3.851 3.783 1.86 5.724l-9.493 9.256a3.36 3.36 0 0 0-.966 2.97l2.241 13.067c.47 2.741-2.408 4.832-4.869 3.538l-11.734-6.17a3.36 3.36 0 0 0-3.123 0l-11.734 6.17c-2.463 1.294-5.34-.796-4.869-3.538l2.241-13.067a3.35 3.35 0 0 0-.966-2.97l-9.493-9.254c-1.992-1.941-.892-5.325 1.86-5.724l13.119-1.906a3.36 3.36 0 0 0 2.527-1.835l5.867-11.889c1.232-2.496 4.788-2.496 6.019-.002",style:{fill:"#fc4c59"}}),l.createElement("path",{d:"M289.948 424.751c-51.285 0-92.86-41.575-92.86-92.86h185.72c0 51.285-41.573 92.86-92.86 92.86",style:{fill:"#7f184c"}}),l.createElement("path",{d:"M219.746 331.891v14.495c0 6.112 4.955 11.066 11.066 11.066h118.272c6.112 0 11.066-4.955 11.066-11.066v-14.495z",style:{fill:"#f2f2f2"}}),l.createElement("path",{d:"M291.898 386.227c-25.101-11.662-52.956-9.967-75.544 2.128 16.973 22.122 43.664 36.397 73.702 36.397a92.5 92.5 0 0 0 37.212-7.78c-8.36-12.936-20.347-23.766-35.37-30.745",style:{fill:"#fc4c59"}}),a||(a=l.createElement("path",{d:"M501.611 166.563c5.407-5.27 7.317-13.005 4.984-20.186s-8.426-12.317-15.898-13.403L450.2 127.09a1.03 1.03 0 0 1-.773-.562L431.316 89.83c-3.342-6.771-10.108-10.976-17.657-10.976-7.551 0-14.318 4.206-17.659 10.976l-.004.006c-21.01-17.548-44.618-31.213-70.343-40.684-4.838-1.783-10.201.697-11.982 5.534-1.782 4.837.697 10.201 5.534 11.982 25.12 9.248 48.05 22.845 68.268 40.438l-9.584 19.419a1.02 1.02 0 0 1-.773.562l-40.498 5.885c-7.472 1.086-13.563 6.222-15.897 13.402-2.333 7.181-.423 14.916 4.984 20.186l29.305 28.565c.241.235.352.576.296.908l-6.919 40.333c-1.277 7.441 1.725 14.822 7.832 19.26 3.452 2.509 7.491 3.783 11.558 3.783 3.13 0 6.275-.754 9.182-2.282l36.222-19.044c.299-.158.655-.157.954 0l36.222 19.044a19.6 19.6 0 0 0 12.42 2c.299 4.7.467 9.412.467 14.13 0 121.351-98.726 220.075-220.075 220.075S23.093 394.61 23.093 273.259c0-40.087 10.752-78.912 31.182-112.982l10.643 10.375a6.64 6.64 0 0 1 1.911 5.882l-10.67 62.21c-1.64 9.567 2.217 19.052 10.069 24.756 4.436 3.224 9.626 4.862 14.853 4.862 4.023 0 8.066-.971 11.803-2.934l55.869-29.372a6.65 6.65 0 0 1 6.184 0l55.869 29.372c8.59 4.516 18.806 3.778 26.655-1.926 7.852-5.704 11.709-15.191 10.069-24.756l-10.67-62.21a6.65 6.65 0 0 1 1.911-5.883l45.2-44.058c6.948-6.774 9.404-16.715 6.403-25.945-2.998-9.229-10.827-15.832-20.432-17.227l-62.464-9.076a6.65 6.65 0 0 1-5.004-3.635l-6.168-12.498a221.4 221.4 0 0 1 46.859-5.028 9.334 9.334 0 0 0 0-18.666 239.8 239.8 0 0 0-55.36 6.469L174.539 14.11C170.248 5.407 161.55 0 151.845 0s-18.402 5.407-22.697 14.109l-27.935 56.602a6.64 6.64 0 0 1-5.004 3.635l-62.463 9.078c-9.604 1.396-17.433 7.996-20.432 17.227-2.999 9.229-.545 19.172 6.405 25.946l20.85 20.324c-23.665 37.86-36.142 81.371-36.142 126.338C4.427 404.902 111.525 512 243.168 512s238.741-107.098 238.741-238.741c0-16.566-1.721-33.106-5.091-49.189l-4.807-28.033a1.03 1.03 0 0 1 .295-.91zM31.066 106.417c.383-1.182 1.675-3.987 5.364-4.523l62.463-9.076a25.3 25.3 0 0 0 19.057-13.846l27.935-56.601c1.65-3.344 4.717-3.704 5.959-3.704 1.243 0 4.309.361 5.959 3.704l27.935 56.601a25.3 25.3 0 0 0 19.057 13.846l62.463 9.076c3.691.536 4.981 3.342 5.366 4.523s.988 4.21-1.682 6.812l-45.199 44.058a25.31 25.31 0 0 0-7.279 22.403l10.67 62.21c.631 3.675-1.639 5.77-2.644 6.499-1.004.729-3.698 2.24-6.998.505l-55.869-29.372a25.296 25.296 0 0 0-23.556 0l-55.869 29.372c-3.299 1.735-5.993.224-6.998-.506-1.005-.729-3.274-2.825-2.644-6.499l10.67-62.212a25.3 25.3 0 0 0-7.279-22.403l-45.199-44.055c-2.67-2.603-2.066-5.631-1.682-6.812m428.212 75.345a19.69 19.69 0 0 0-5.663 17.43l4.542 26.482c.035.352.085.706.161 1.059.051.236.093.474.143.711l2.072 12.081c.034.204.107.628-.408 1.003-.514.375-.9.174-1.081.078l-36.222-19.042a19.68 19.68 0 0 0-18.325 0l-36.222 19.044c-.183.097-.567.296-1.081-.078-.515-.375-.442-.8-.408-1.004l6.92-40.336a19.69 19.69 0 0 0-5.664-17.428l-29.305-28.565c-.149-.144-.458-.445-.26-1.053.197-.607.623-.669.827-.699l40.498-5.885a19.7 19.7 0 0 0 14.828-10.772l12.712-25.758q.054-.105.103-.209l5.295-10.729c.091-.185.282-.572.921-.572.638 0 .829.387.92.572l18.112 36.697a19.7 19.7 0 0 0 14.827 10.771l40.498 5.885c.205.03.632.092.829.699s-.112.907-.26 1.053z"})),i||(i=l.createElement("path",{d:"M187.756 331.891c0 56.349 45.843 102.193 102.193 102.193s102.193-45.843 102.193-102.193a9.333 9.333 0 0 0-9.333-9.333H197.087c-5.153 0-9.331 4.179-9.331 9.333m185.202 9.332c-4.654 41.681-40.106 74.195-83.01 74.195s-78.356-32.514-83.01-74.195z"})),r||(r=l.createElement("circle",{cx:288.13,cy:48.58,r:9.333})))},_=new String('.main.jsx-b7e2450be03b6712{display:flex;position:relative}.sticker-button.jsx-b7e2450be03b6712{width:25px;height:25px}.sticker-wrapper.jsx-b7e2450be03b6712{background-color:var(--light-background);border-radius:10px;flex-direction:column;width:300px;max-height:300px;display:flex;position:relative;box-shadow:5px 5px 20px #0003}.sticker-wrapper.jsx-b7e2450be03b6712:after{content:"";border-color:var(--light-background) transparent;z-index:1;border-style:solid;border-width:0 20px 20px;width:0;height:0;display:block;position:absolute;top:-10px;right:27px}.sticker-categories.jsx-b7e2450be03b6712{border-bottom:1px solid var(--border-light);z-index:10;position:relative;overflow:auto}.categories-wrapper.jsx-b7e2450be03b6712{flex-flow:row;display:flex}.category.jsx-b7e2450be03b6712{width:48px;color:var(--color-accent-dark);background-color:var(--light-background);flex:0 0 48px;justify-content:center;align-items:center;padding:5px;font-size:24px;display:flex}.category.jsx-b7e2450be03b6712:first-child{border-top-left-radius:10px}.category.jsx-b7e2450be03b6712:hover,.category.selected.jsx-b7e2450be03b6712{background-color:var(--color-post)}.category.jsx-b7e2450be03b6712 img.jsx-b7e2450be03b6712{width:100%}.sticker.jsx-b7e2450be03b6712{width:25%;padding:6px}.stickers.jsx-b7e2450be03b6712{width:100%;height:170px;padding:10px;overflow:auto}.loading.jsx-b7e2450be03b6712{justify-content:center;align-items:center;padding:1rem;display:flex}.sticker-list.jsx-b7e2450be03b6712{flex-flow:wrap;display:flex}.empty-list.jsx-b7e2450be03b6712{justify-content:center;align-items:center;display:flex}.empty-list.jsx-b7e2450be03b6712 .reward-store-intro.jsx-b7e2450be03b6712{text-align:center;font-size:16px}.empty-list.jsx-b7e2450be03b6712 .reward-store-intro.jsx-b7e2450be03b6712 .download-app-container.jsx-b7e2450be03b6712{margin-top:18px}.empty-list.jsx-b7e2450be03b6712 .reward-store-intro.jsx-b7e2450be03b6712 .download-app.jsx-b7e2450be03b6712{color:var(--text-light);background-color:var(--button-high-contrast);border-radius:4px;padding:6px 12px}.menu.jsx-b7e2450be03b6712{z-index:99;position:absolute;top:45px;left:-240px}@media (width<=600px){.menu.jsx-b7e2450be03b6712{position:fixed;inset:auto 0 0}.sticker-wrapper.jsx-b7e2450be03b6712{border-radius:0;width:100%}.sticker-wrapper.jsx-b7e2450be03b6712:after{display:none}.stickers.jsx-b7e2450be03b6712,.empty-list.jsx-b7e2450be03b6712{height:200px}}');_.__hash="b7e2450be03b6712";class k extends g.default.Component{constructor(e){super(e),this.state={popped:!1,isLoading:!1,currentCategory:null,categories:[]},this.toggle=this.toggle.bind(this),this.close=this.close.bind(this),this.getStickerCategories=this.getStickerCategories.bind(this),this.getStickers=this.getStickers.bind(this),this.changeStickerCategory=this.changeStickerCategory.bind(this),this.chooseSticker=this.chooseSticker.bind(this)}getStickerCategories(){this.setState({isLoading:!0});let{api:e}=this.props;e.get({uri:"/sticker-categories"}).then(e=>{let t=[];if(t.push({category_id:-1,category_title:"Trending"}),(t=t.concat(e.categories))&&t.length>1){let e=t[1];this.setState({isLoading:!1,categories:t,currentCategory:e}),e.stickers||this.getStickers(e.category_id)}},()=>{this.setState({isLoading:!1})})}getStickers(e){this.setState({isLoading:!0});let{categories:t}=this.state,{api:s}=this.props,a=t.find(t=>t.category_id===e);a&&!a.stickers&&(-1===a.category_id?s.get({uri:"/tinhte-stickers/trending"}).then(e=>{a.stickers=e.stickers,this.setState({isLoading:!1,categories:t})},()=>{this.setState({isLoading:!1})}):s.get({uri:`/sticker-categories/${e}/stickers`,params:{tinhterewardstore_usable:1}}).then(e=>{a.stickers=e.stickers,this.setState({isLoading:!1,categories:t})},()=>{this.setState({isLoading:!1})}))}chooseSticker(e){this.props.chooseSticker(e),this.close()}changeStickerCategory(e){this.setState({currentCategory:e}),e.stickers||this.getStickers(e.category_id)}toggle(){this.props.onToggle&&this.props.onToggle(),this.setState({popped:!this.state.popped}),this.getStickerCategories()}close(){this.setState({popped:!1})}render(){let{popped:e,isLoading:t,categories:s,currentCategory:a}=this.state;return(0,n.jsxs)(f.default,{onClickOutside:this.close,children:[(0,n.jsxs)("div",{className:`jsx-${_.__hash} main`,children:[(0,n.jsx)("button",{onClick:this.toggle,title:"Stickers",className:`jsx-${_.__hash} sticker-button`,children:(0,n.jsx)(y,{})}),e&&(0,n.jsx)("div",{className:`jsx-${_.__hash} menu`,children:(0,n.jsxs)("div",{className:`jsx-${_.__hash} sticker-wrapper`,children:[(0,n.jsx)("div",{className:`jsx-${_.__hash} sticker-categories`,children:(0,n.jsx)("div",{className:`jsx-${_.__hash} categories-wrapper`,children:a&&s.map(e=>(0,n.jsx)("button",{onClick:()=>this.changeStickerCategory(e),className:`jsx-${_.__hash} category ${a.category_id===e.category_id?"selected":""}`,children:e&&e.category_id>-1?(0,n.jsx)("img",{src:e.links.image_url,alt:e.category_title,className:`jsx-${_.__hash} sticker`}):(0,n.jsx)("i",{className:`jsx-${_.__hash} fas fa-clock`})},e.category_id))})}),(0,n.jsx)("div",{className:`jsx-${_.__hash} stickers`,children:t?(0,n.jsx)("div",{className:`jsx-${_.__hash} loading`,children:(0,n.jsx)("i",{className:`jsx-${_.__hash} icon fa fa-spinner fa-spin`})}):(0,n.jsx)("div",{className:`jsx-${_.__hash}`,children:a.stickers&&a.stickers.length>0?(0,n.jsx)("div",{className:`jsx-${_.__hash} sticker-list`,children:a.stickers&&a.stickers.map(e=>(0,n.jsx)("button",{onClick:()=>this.chooseSticker(e),className:`jsx-${_.__hash} sticker`,children:(0,n.jsx)("img",{src:e.links.image_url,alt:e.sticker_name,className:`jsx-${_.__hash}`})},e.sticker_id))}):(0,n.jsx)("div",{className:`jsx-${_.__hash} empty-list`,children:(0,n.jsxs)("div",{className:`jsx-${_.__hash} reward-store-intro`,children:[(0,n.jsxs)("p",{className:`jsx-${_.__hash}`,children:[(0,n.jsx)("span",{className:`jsx-${_.__hash}`,children:"Bộ sticker này dành cho người có xiền, có điểm, nên bạn phải lên Tinhte Reward Store lấy nó nhé"}),(0,n.jsx)("span",{role:"img","aria-label":"mặt cười",style:{marginLeft:6},className:`jsx-${_.__hash}`,children:"😆"})]}),(0,n.jsx)("div",{className:`jsx-${_.__hash} download-app-container`,children:(0,n.jsx)("a",{href:"https://tinhte.vn/app",target:"_blank",rel:"noreferrer",className:`jsx-${_.__hash} download-app`,children:"Tải app để lấy ngay!"})})]})})})})]})})]}),(0,n.jsx)(o.default,{id:_.__hash,children:_})]})}}let w=(0,b.f)(u.f.ApiConsumer(k),{errorMsg:"Stickers bị lỗi rồi ... huhu"});var v=e.i(659967);let S=e=>{let t="";return e&&(t=e.match(/\[(QUOTE)[\s\S]*?\[\/QUOTE\]/gim)),t},$=e=>{let t="";return e&&(t=(t=e.replace(/\[(QUOTE)[\s\S]*?\[\/QUOTE\]/gim,"")).replace(/\s*\[.*?\]\s*/g," ")),t};e.s(["U",0,$,"E",0,S],314390);let N=class{constructor(e){this.api=e}uploadAttachments(e,t,s,a,i){if(!e)return null;let r=e;if(r.constructor!==Array)r=[e];else if(!r.length)return null;let n=[],o=r.filter(e=>e.shoudDelete);n.push(this.deleteAttachments(o,a));let l=r.filter(e=>!e.shoudDelete&&e.shouldUpload&&e.image),c=[],d=`${s||t?"/posts":"/threads"}/attachments`,h=e=>{if(!e.errors)return c.push(e.attachment),e.attachment;throw Error.new(e.errors.toString())},p=e=>{throw console.log(e),Error.new("Có lỗi khi upload file")};return l.forEach(e=>{let r,o=(r=new window.FormData,s?r.append("post_id",s):t?r.append("thread_id",t):r.append("forum_id",a),!i&&e.blob?r.append("file",e.blob,e.jpgName):r.append("file",e.raw),r),l=this.api.post({uri:d,body:o}).then(h,p);n.push(l)}),Promise.all(n).catch(e=>{throw console.log(e),this.deleteAttachments(c,a),e})}deleteSingleAttachment(e,t){return e?this.api.del({uri:"/threads/attachments",params:{forum_id:t,attachment_id:e.attachment_id}}).then(()=>{},console.log):null}deleteAttachments(e,t){let s=[],a=e=>{let a=this.deleteSingleAttachment(e,t);a&&s.push(a)};return e.length?this.api.batch(()=>e.map(a)).then(()=>Promise.all(s)).catch(console.log):[]}};var C=l;let E=e.r(308123)({features:["js","ww"]}),z=async e=>{let t=window.document.createElement("canvas");e.width>1200?(t.width=1200,t.height=1200/e.width*e.height):(t.height=1200,t.width=1200/e.height*e.width);try{return await E.resize(e,t,void 0),{blob:await E.toBlob(t,"image/jpeg",1)}}catch(e){return console.log(e),{error:"Có lỗi khi resize ảnh. Ảnh sẽ được upload với kích thước gốc."}}},T=new String(".attachments.jsx-1186ca3b2203738c{flex-wrap:wrap;display:flex}.image-picker-image-container.jsx-1186ca3b2203738c{box-sizing:border-box;padding:5px;position:relative}@media (width<=768px){.image-picker-image-container.jsx-1186ca3b2203738c{flex-basis:33.3333%}}@media (width>=768px){.image-picker-image-container.jsx-1186ca3b2203738c{flex-basis:25%}}.image-picker-loading.jsx-1186ca3b2203738c{position:absolute;inset:0}.image-picker-image.jsx-1186ca3b2203738c{background-position:50%;background-repeat:no-repeat;background-size:cover;border-radius:4px;padding-top:100%}.image-picker-image-del.jsx-1186ca3b2203738c{color:#fff;text-shadow:2px 2px 2px #000;cursor:pointer;font-size:20px;position:absolute;top:12px;right:12px}.image-picker-error.jsx-1186ca3b2203738c{color:#fff;background:#000c;justify-content:center;align-items:center;padding:10px;font-size:13px;line-height:1.5;display:flex;position:absolute;inset:5px}");T.__hash="1186ca3b2203738c";class U extends C.default.Component{constructor(e){super(e),this.state={loading:!1,error:""},this.onSizeTypeChanged=this.onSizeTypeChanged.bind(this),this.onFileInputChange=this.onFileInputChange.bind(this),this.removeFile=this.removeFile.bind(this)}onSizeTypeChanged(e){this.props.onSizeTypeChanged(e.target.checked)}async onFileInputChange(e){let t=this.props.files,{limit:s}=this.props,{files:a}=e.target;if(a=[...a],this.state.loading)return;this.setState({error:"",loading:!0});let i=t.reduce((e,t)=>e+ +!t.shoudDelete,0),r=a.filter(e=>e.type.match("image.*"));if(s&&i+r.length>s)return void this.setState({error:`Bạn chỉ được đăng một l\xfac tối đa ${s} file`,loading:!1});let n=(r=r.map(e=>({raw:e,shouldUpload:!0}))).map(e=>new Promise(t=>{let s=new window.FileReader;s.onload=s=>{let a=s.target.result,i=new window.Image;i.onload=async()=>{let s={},r=`${e.raw.name.split(".").slice(0,-1).join(".")}.jpg`;(i.width>1200||i.height>1200)&&(s=await z(i)),t({...e,image:a,jpgName:r,...s})},i.src=s.target.result},s.readAsDataURL(e.raw)}).catch(e=>{console.log(e)})),o=await Promise.all(n);this.props.onNewImages(o),this.setState({loading:!1})}show(){this.fileInput.value=null,this.fileInput.click()}removeFile(e){this.props.removeFile(e),this.setState({error:""})}renderFiles(){let{files:e}=this.props;return e.map((e,t)=>e.shoudDelete?(0,n.jsx)("div",{},t):(0,n.jsxs)("div",{className:`jsx-${T.__hash} image-picker-image-container`,children:[(0,n.jsx)("div",{style:{backgroundImage:e.image?`url(${e.image})`:"none"},className:`jsx-${T.__hash} image-picker-image`}),(0,n.jsx)("div",{className:`jsx-${T.__hash} image-picker-loading box center-xs middle-xs`,children:e.image?(0,n.jsx)("div",{className:`jsx-${T.__hash}`}):(0,n.jsx)("i",{style:{color:"#757575",fontSize:20},className:`jsx-${T.__hash} fa fa-spinner fa-spin`})}),e.error&&(0,n.jsx)("div",{className:`jsx-${T.__hash} image-picker-error`,children:e.error}),(0,n.jsx)("button",{onClick:()=>{this.removeFile(t)},className:`jsx-${T.__hash} image-picker-image-del`,children:(0,n.jsx)("i",{"aria-hidden":"true",className:`jsx-${T.__hash} fa fa-times`})}),(0,n.jsx)(o.default,{id:T.__hash,children:T})]},t))}render(){let e=this.props.files.length>0;return(0,n.jsxs)("div",{className:"image-picker box",children:[(0,n.jsx)("input",{style:{display:"none"},type:"file",multiple:!0,ref:e=>{this.fileInput=e},onChange:this.onFileInputChange}),this.state.error&&(0,n.jsx)("p",{className:"full-width",style:{color:"red",fontSize:14,padding:"0 5px 0 0"},children:this.state.error}),e&&(0,n.jsx)("div",{className:"full-width",title:"chọn kích thước gốc sẽ ảnh hưởng tốc độ đăng ảnh và có thể dẫn đến ảnh bị ẩn đi",style:{fontSize:12},children:(0,n.jsxs)("label",{htmlFor:"imgPickerFullsizeCheckbox",children:[(0,n.jsx)("input",{id:"imgPickerFullsizeCheckbox",type:"checkbox",onChange:this.onSizeTypeChanged})," kích thước gốc"]})}),(0,n.jsx)("div",{className:"attachments",style:{display:"flex",flexWrap:"wrap"},children:this.renderFiles()})]})}}let F=new String(".thread-action.jsx-aab067973a4c716f{margin:10px 0;padding:12px 0;display:flex}.thread-action.lite.jsx-aab067973a4c716f{padding:0}.no-margin.jsx-aab067973a4c716f{margin:0}.thread-action.jsx-aab067973a4c716f .user-avatar.jsx-aab067973a4c716f{border:1px solid var(--color-light-1);background-color:var(--avatar-background-dark);border-radius:50%;width:50px;height:50px;margin-top:1px;margin-right:6px}.thread-action.jsx-aab067973a4c716f .user-avatar.lite.jsx-aab067973a4c716f{width:30px;height:30px}.thread-action.jsx-aab067973a4c716f .post-reply-main.jsx-aab067973a4c716f{border:1px solid var(--primary-border);background-color:#0000;border-radius:8px;justify-content:center;align-items:center;width:100%;padding:13px 15px;display:flex;position:relative}.error.jsx-aab067973a4c716f{color:var(--error-text);font-size:14px}.thread-action.jsx-aab067973a4c716f .post-reply-main.jsx-aab067973a4c716f:focus{box-shadow:0 0 3px 1px var(--color-accent-dark)}.thread-action.jsx-aab067973a4c716f .post-reply-main.overflowed.jsx-aab067973a4c716f{padding-bottom:60px;display:block}input.jsx-aab067973a4c716f:focus{outline-width:0}.user-to-reply.jsx-aab067973a4c716f{color:#9d9d9d;margin:0 10px 5px 0;font-size:12px}.post-reply-input{resize:none;box-sizing:border-box;-webkit-appearance:none;min-height:24px;-webkit-box-shadow:none;box-shadow:none;background:0 0;border:none;border-radius:0;outline:none;flex:1;min-height:60px;margin-bottom:10px;line-height:1.4;display:block;overflow:hidden}@media (width<=700px){.post-reply-input{font-size:16px}}.post-reply-actions.jsx-aab067973a4c716f{align-items:center;padding:0 3px;display:flex;position:absolute;bottom:10px;right:10px}.thread-action.jsx-aab067973a4c716f .post-reply-main.overflowed.jsx-aab067973a4c716f .post-reply-actions.jsx-aab067973a4c716f{border-top:1px solid var(----border-light);justify-content:flex-end;width:100%;padding:10px 10px 0;right:0}.post-reply-upload.jsx-aab067973a4c716f{width:25px;height:25px;margin:0 12px}.post-reply-upload.jsx-aab067973a4c716f svg.jsx-aab067973a4c716f{width:25px}.post-reply-sticker.jsx-aab067973a4c716f{width:22px}.post-reply-submit.jsx-aab067973a4c716f{color:var(--button-light-disabled-text);background-color:var(--button-light-disabled);border-radius:3px;padding:8px 24px;font-size:16px;font-weight:700}.post-reply-submit.active.jsx-aab067973a4c716f{background-color:var(--color-accent-dark);color:var(--color-light-0)}.post-reply-container.jsx-aab067973a4c716f{background-color:var(--color-light-0);border:1px solid var(--color-light-border-box);border-bottom-right-radius:24px;border-bottom-left-radius:24px;width:100%;height:24px;margin:36px}.thread-login.jsx-aab067973a4c716f{color:#9d9d9d;align-items:center;height:40px;padding:0 .5rem;display:flex}.stickers.jsx-aab067973a4c716f{flex-wrap:wrap;justify-content:flex-start;align-items:flex-start;width:100%;margin:12px 0 0;display:flex;position:relative}.sticker.jsx-aab067973a4c716f{width:120px;height:auto;margin-right:10px;position:relative}.sticker.jsx-aab067973a4c716f img.jsx-aab067973a4c716f{width:100%;height:auto}.remove-sticker-button.jsx-aab067973a4c716f{position:absolute;top:0;right:0}@media (width<=1000px){.thread-action.jsx-aab067973a4c716f img.jsx-aab067973a4c716f{width:50px;height:50px}.sticker.jsx-aab067973a4c716f img.jsx-aab067973a4c716f{width:100%;height:auto}}.compact.jsx-aab067973a4c716f .user-avatar.jsx-aab067973a4c716f{width:24px;height:24px}.compact.jsx-aab067973a4c716f .post-reply-main.jsx-aab067973a4c716f{border:0;align-items:flex-start;padding:0;display:flex!important}.compact.jsx-aab067973a4c716f .post-reply-main.jsx-aab067973a4c716f textarea{border:1px solid var(--primary-border);border-radius:4px;flex:auto;height:32px;min-height:auto;padding:8px 12px;font-weight:400}.compact.jsx-aab067973a4c716f .post-reply-main.jsx-aab067973a4c716f .post-reply-actions.jsx-aab067973a4c716f{margin-left:12px;position:relative;bottom:auto;width:auto!important;padding:0!important;right:auto!important}.compact.jsx-aab067973a4c716f .post-reply-upload.jsx-aab067973a4c716f,.compact.jsx-aab067973a4c716f .sticker-button{display:none}");F.__hash="aab067973a4c716f";class L extends l.default.Component{constructor(e){super(e),this.state={user:this.props.user,lite:this.props.lite,enterToSubmit:this.props.enterToSubmit,rowCount:1,textAreaExpanded:!1,error:null,postBody:"",postBodyQuote:[],submitting:!1,files:[],stickers:[],fullsizeImage:!1},this.textAreaHeightChanged=this.textAreaHeightChanged.bind(this),this.postBodyComposing=this.postBodyComposing.bind(this),this.showFilePicker=this.showFilePicker.bind(this),this.onSizeTypeChanged=this.onSizeTypeChanged.bind(this),this.onNewImages=this.onNewImages.bind(this),this.removeFile=this.removeFile.bind(this),this.submitPost=this.submitPost.bind(this),this.chooseSticker=this.chooseSticker.bind(this),this.removeSticker=this.removeSticker.bind(this),this.isCommenting=this.isCommenting.bind(this),this.isNotCommenting=this.isNotCommenting.bind(this),this.hotkeyHandler=this.hotkeyHandler.bind(this)}componentDidMount(){let{postToEdit:e}=this.props;if(e){let t=[];e.attachments&&(t=e.attachments.map(e=>({image:e.links.thumbnail||e.links.permalink,attachment_id:e.attachment_id})));let{stickers:s}=e,a=$(e.body),i=S(e.body);this.setState({postBody:a,postBodyQuote:i,files:t,stickers:s})}this.props.api.onAuthenticated(()=>{this.getUserProfile()}),window.document.addEventListener("keydown",this.hotkeyHandler)}componentWillUnmount(){window.document.removeEventListener("keydown",this.hotkeyHandler)}onNewImages(e){this.setState({files:this.state.files.concat(e)})}onSizeTypeChanged(e){this.setState({fullsizeImage:e})}getUserProfile(){let{api:e}=this.props;e&&e.getUserId()&&e.get("users/me").then(e=>{let t=(0,p.U)(e.user||{});this.setState({user:t})},()=>{})}submitCreatePost(){let{postToReply:e,noReply:t,api:s}=this.props,{stickers:a,postBody:i}=this.state,r=a[0]&&a[0].sticker_id?a[0].sticker_id:null,n=new window.FormData;return n.append("thread_id",e.thread.id),n.append("post_body",i),r&&n.append("sticker_ids",r),t||e.isFirstPost||n.append("quote_post_id",e.id),s.post({uri:"posts",body:n}).then(({post:t,errors:s})=>{s&&d.c.error(s),this.setState({postBody:"",error:null,stickers:[]});let a=(0,h.U)(t,e.thread);a.postReplyTo=e.id,this.props.addPost(a,this.props.position)}).catch(e=>{throw e})}submitEditPost(){let{postToEdit:e,api:t}=this.props,{postBody:s}=this.state,{postBodyQuote:a}=this.state;a&&a.length>0&&a.forEach(e=>{s=`${e} ${s}`});let i=new URLSearchParams;return i.append("thread_id",e.thread.id),i.append("post_body",s),t.put({uri:`posts/${e.id}`,body:i}).then(({post:t,errors:s})=>{s&&d.c.error(s);let a=(0,h.U)(t,e.thread);a.postReplyTo=e.postReplyTo,this.props.onEdit(a)}).catch(e=>{throw e})}async submitPost(){let{postBody:e,files:t,fullsizeImage:s,stickers:a,submitting:i}=this.state;if(!e.trim()&&a&&a.length<=0)return void this.setState({error:"Vui lòng không để trống bình luận"});if(i)return;this.setState({submitting:!0});let{postToEdit:r,postToReply:n}=this.props,{forumId:o}=(r||n).thread||642,l=new N(this.props.api),c=null;try{c=await l.uploadAttachments(t,(r||n).thread.id,(r||{}).id,o,s),r?await this.submitEditPost():(await this.submitCreatePost(),this.setState({submitting:!1,files:[]}))}catch(e){c&&l.deleteAttachments(c,o),this.setState({error:e.toString(),submitting:!1})}}removeFile(e){let{files:t}=this.state;t[e].shouldUpload?t[e].shouldUpload=!1:t[e].shoudDelete=!0,this.setState({})}chooseSticker(e){this.setState({stickers:[e]})}isCommenting(){this.props&&this.props.isCommenting&&this.props.isCommenting()}isNotCommenting(){this.props&&this.props.isNotCommenting&&this.props.isNotCommenting()}removeSticker(e){let{stickers:t}=this.state,s=t.findIndex(t=>t.sticker_id===e.sticker_id);s>-1&&t.splice(s,1),this.setState({stickers:t})}textAreaHeightChanged(e,t){let{rowCount:s}=t;s>1?this.setState({textAreaExpanded:!0,rowCount:s}):this.setState({rowCount:s})}checkTextareaOverflow(){let{rowCount:e,textAreaExpanded:t}=this.state;if(1===e&&t){let e=this.replyWrapper;if(!e)return;let t=(e=window.$(e)).find(".post-reply-input-dummy").outerWidth()+50,s=e.find(".post-reply-actions").children("button").toArray().reduce((e,t)=>e+t.offsetWidth,0);t>e.outerWidth()-s||this.setState({textAreaExpanded:!1})}}postBodyComposing(e){this.setState({postBody:e.target.value,error:null})}focus(){this.textarea.focus()}showFilePicker(){this.focus(),this.imagePicker.show()}hotkeyHandler(e){let{enterToSubmit:t,postBody:s,stickers:a}=this.state;t&&(s||!s&&a&&a.length>0)&&13===e.keyCode&&(e.preventDefault(),e.stopPropagation(),this.submitPost())}render(){let{postBody:e,textAreaExpanded:t,submitting:s,files:a,stickers:i,lite:r,user:l}=this.state,{postToReply:d,noReply:h,compact:p=!1,position:x}=this.props,g=d&&d.postReplyTo,b=!!this.props.postToEdit;return(0,n.jsxs)("div",{className:`jsx-${F.__hash} `+((p?"compact action":"action")||""),children:[l&&l.id?(0,n.jsxs)("div",{className:`jsx-${F.__hash} thread-action ${r?"lite":""} ${b?"no-margin":""}`,children:[l.name&&""!==l.name&&!b?(0,n.jsx)("img",{alt:l.name,src:l.avatar,className:`jsx-${F.__hash} user-avatar ${r?"lite":""}`}):(0,n.jsx)("div",{className:`jsx-${F.__hash}`}),(0,n.jsxs)("div",{ref:e=>{this.replyWrapper=e},style:{flex:1},className:`jsx-${F.__hash}`,children:[(0,n.jsx)("span",{style:{display:"none"},dangerouslySetInnerHTML:{__html:e.replace(/\n/g,"
")},className:`jsx-${F.__hash} post-reply-input-dummy post-reply-input`}),g&&(0,n.jsxs)("div",{className:`jsx-${F.__hash} user-to-reply`,children:["Đang trả lời ",d.author.name]}),(0,n.jsxs)("div",{id:`post-reply-${d?d.id:""}${h?"-x":""}`,className:`jsx-${F.__hash} post-reply-main ${t||a.length?" overflowed":""}`,children:[(0,n.jsx)(c.f,{inputRef:e=>{this.textarea=e},className:"post-reply-input",rows:1,placeholder:"Bạn nghĩ gì về chủ đề này?",value:e,onChange:e=>this.postBodyComposing(e),onFocus:this.isCommenting,onBlur:this.isNotCommenting,onHeightChange:this.textAreaHeightChanged,style:{width:"100%",outlineWidth:0,resize:"none"}}),i&&i.length>0&&(0,n.jsx)("div",{className:`jsx-${F.__hash} stickers`,children:i.map(e=>(0,n.jsxs)("div",{className:`jsx-${F.__hash} sticker`,children:[!b&&(0,n.jsx)("button",{onClick:()=>this.removeSticker(e),className:`jsx-${F.__hash} remove-sticker-button`,children:(0,n.jsx)("i",{className:`jsx-${F.__hash} fa fa-times`})}),(0,n.jsx)("img",{src:e.links.image_url,alt:e.sticker_name,className:`jsx-${F.__hash}`})]},e.sticker_id))}),(0,n.jsx)(U,{files:a,limit:10,ref:e=>{this.imagePicker=e},onSizeTypeChanged:this.onSizeTypeChanged,onNewImages:this.onNewImages,removeFile:this.removeFile}),(0,n.jsxs)("div",{className:`jsx-${F.__hash} post-reply-actions`,children:[!b&&(0,n.jsx)(w,{chooseSticker:this.chooseSticker,removeSticker:this.removeSticker}),(0,n.jsx)("button",{onClick:this.showFilePicker,title:"Upload ảnh",className:`jsx-${F.__hash} post-reply-upload`,children:(0,n.jsx)(m,{})}),e||!e&&i&&i.length>0?(0,n.jsxs)("button",{onClick:this.submitPost,disabled:s,className:`jsx-${F.__hash} post-reply-submit ${!s&&"active"}`,children:[b?"Lưu":"Gửi",s&&"..."]}):(0,n.jsx)("button",{disabled:!0,className:`jsx-${F.__hash} post-reply-submit`,children:b?"Lưu":"Gửi"})]})]}),(0,n.jsx)(v.f,{busy:s,color:"var(--button-high-contrast)"}),this.state.error?(0,n.jsx)("p",{className:`jsx-${F.__hash} error`,children:this.state.error}):(0,n.jsx)("span",{className:`jsx-${F.__hash}`})]})]}):"bottom"!==x?(0,n.jsx)("a",{href:"https://tinhte.vn/login/",className:`jsx-${F.__hash}`,children:(0,n.jsxs)("div",{className:`jsx-${F.__hash} thread-action`,children:[(0,n.jsx)("img",{alt:"",src:"https://tinhte.vn/styles/uiflex/xenforo/avatars/avatar_male_m.png",className:`jsx-${F.__hash} user-avatar`}),(0,n.jsx)("div",{className:`jsx-${F.__hash} thread-login`,children:"Đăng nhập một phát, tha hồ bình luận (^ 3^)"})]})}):null,(0,n.jsx)(o.default,{id:F.__hash,children:F})]})}}let P=(0,b.f)(L,{errorMsg:"Lỗi post reply"});e.s(["f",0,P],867507)},94432,e=>{e.s(["q",0,[7,8],"U",0,{Up:1,Down:2,Neutral:0}])},189500,e=>{var t,s,a=e.i(191788);function i(){return(i=Object.assign.bind()).apply(null,arguments)}e.s(["f",0,function(e){return a.createElement("svg",i({xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:21,height:19,viewBox:"0 0 21 19"},e),t||(t=a.createElement("defs",null,a.createElement("path",{id:"a",d:"M0 0h20.342v18.074H0z"}))),s||(s=a.createElement("g",{fill:"none",fillRule:"evenodd"},a.createElement("mask",{id:"b",fill:"#fff"},a.createElement("use",{xlinkHref:"#a"})),a.createElement("path",{fill:"#606670",d:"M11.093 2.762 8.598 5.237a.47.47 0 0 1-.661 0 .46.46 0 0 1-.003-.655l1.59-1.574-.032-.026c-.67-.631-1.437-1.085-2.256-1.3a4.26 4.26 0 0 0-2.374.069 4.85 4.85 0 0 0-1.91 1.148A4.7 4.7 0 0 0 1.77 4.748a3.8 3.8 0 0 0-.078 2.231c.205.76.649 1.475 1.272 2.089l7.206 7.14 7.17-7.1.038-.04c.623-.614 1.065-1.329 1.27-2.089a3.8 3.8 0 0 0-.078-2.228 4.64 4.64 0 0 0-1.18-1.849 4.9 4.9 0 0 0-1.91-1.151 4.3 4.3 0 0 0-2.374-.066c-.72.189-1.405.563-2.013 1.077m-9.237 7.403C1.046 9.362.46 8.411.183 7.38A5.3 5.3 0 0 1 .29 4.262a6.2 6.2 0 0 1 1.566-2.465A6.45 6.45 0 0 1 4.392.277a5.8 5.8 0 0 1 3.24-.089 6.6 6.6 0 0 1 2.538 1.326C10.934.885 11.794.428 12.71.19a5.8 5.8 0 0 1 3.242.088c.95.3 1.823.832 2.533 1.52a6.26 6.26 0 0 1 1.566 2.466 5.33 5.33 0 0 1 .107 3.114c-.28 1.035-.862 1.983-1.673 2.786l-7.765 7.683a.784.784 0 0 1-1.102 0l-7.763-7.683z",mask:"url(#b)"}))))}])}])})();