@hhgtech/hhg-components 1.19.28 → 1.19.29
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.
- package/build/babyGrowth.js +1 -1
- package/build/care.js +1 -1
- package/build/components/molecules/babyGrowthChooseProfileDrawer/index.d.ts +1 -1
- package/build/components/molecules/shareDrawer/index.d.ts +1 -0
- package/build/components.js +1 -1
- package/build/core.js +1 -1
- package/build/esm/babyGrowth.js +1 -1
- package/build/esm/care.js +1 -1
- package/build/esm/components.js +1 -1
- package/build/esm/core.js +1 -1
- package/build/esm/i18n.js +1 -1
- package/build/esm/{index-403ad820.js → index-1a943e63.js} +1 -1
- package/build/esm/{index-d5184aa9.js → index-2c513d0f.js} +1 -1
- package/build/esm/{index-e5d0a74c.js → index-68dbdc20.js} +1 -1
- package/build/esm/index-6fde0d1c.js +1 -0
- package/build/esm/{index-64f641c3.js → index-8bf9dbb9.js} +1 -1
- package/build/esm/{index-e2f5f56b.js → index-d08fffaf.js} +1 -1
- package/build/esm/{index-5aa3c2bb.js → index-d6f87862.js} +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/{index.styled-ab940e83.js → index.styled-b819aba0.js} +1 -1
- package/build/esm/{index.styled-7701663c.js → index.styled-cc25a3f7.js} +1 -1
- package/build/esm/navigation.js +1 -1
- package/build/esm/together.js +1 -1
- package/build/esm/{translationsContext-221a5963.js → translationsContext-717621a0.js} +1 -1
- package/build/esm/translationsProvider-3199bad6.js +1 -0
- package/build/esm/{types-5183688a.js → types-0ba75a5c.js} +1 -1
- package/build/esm/{types-8a729754.js → types-3dfed39e.js} +1 -1
- package/build/esm/{useTranslations-8c004122.js → useTranslations-d2f104c4.js} +1 -1
- package/build/i18n.js +1 -1
- package/build/{index-25cc87fd.js → index-219bc509.js} +1 -1
- package/build/{index-db8baa94.js → index-46d2b19a.js} +1 -1
- package/build/{index-7ae23d1b.js → index-4985f6e5.js} +1 -1
- package/build/{index-4a1127ba.js → index-8cd63eb5.js} +1 -1
- package/build/{index-81edcd0b.js → index-ac7f3bc6.js} +1 -1
- package/build/{index-87f2e551.js → index-cf3743ba.js} +1 -1
- package/build/{index-de6a7c01.js → index-f2b51c99.js} +1 -1
- package/build/index.js +1 -1
- package/build/{index.styled-0b69e9af.js → index.styled-81400619.js} +1 -1
- package/build/{index.styled-3fa8dfe7.js → index.styled-b79ab3ac.js} +1 -1
- package/build/navigation.js +1 -1
- package/build/together.js +1 -1
- package/build/{translationsContext-f8e45a1a.js → translationsContext-749279e6.js} +1 -1
- package/build/translationsProvider-e45de025.js +1 -0
- package/build/{types-1226da13.js → types-5c3eabe6.js} +1 -1
- package/build/{types-69b35529.js → types-737dbbbf.js} +1 -1
- package/build/{useTranslations-5516b58c.js → useTranslations-b4596d50.js} +1 -1
- package/package.json +1 -1
- package/build/esm/index-7b749aae.js +0 -1
- package/build/esm/translationsProvider-26ce55b2.js +0 -1
- package/build/translationsProvider-72def8c0.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,b as n,c as i}from"./tslib.es6-6ae0d506.js";import o,{useContext as a,useState as r,useRef as l,useEffect as s,useMemo as c,useCallback as u}from"react";import{H as d,B as m}from"./index-64f641c3.js";import{T as p}from"./index.styled-7701663c.js";import{a as v,D as g}from"./index-d5184aa9.js";import{u as h,t as f,k as w}from"./useTranslations-8c004122.js";import k from"innertext";import{t as C,d as y}from"./theme-886d0d2f.js";import{m as E,z as b,B as N,E as I,F as T,H as x,I as M,b as _,J as P,M as L,K as S,N as j,O as B,Q as F,R,V as D,L as O,W as A,X as z,Y as V,Z as U,_ as H,$ as W,a0 as Z,y as G,a1 as K,j as Q,a2 as X,a3 as J,U as Y,a4 as $,a5 as q,a6 as ee,u as te,g as ne,a7 as ie,a8 as oe,a9 as ae,aa as re,ab as le,ac as se,ad as ce,ae as ue,af as de,ag as me,ah as pe,ai as ve,aj as ge,a as he,ak as fe,f as we,C as ke,al as Ce,am as ye,an as Ee,S as be,ao as Ne,o as Ie,ap as Te,aq as xe,ar as Me}from"./index.styled-ab940e83.js";import"react-range";import*as _e from"react-dom";import{I as Pe}from"./index-e2f5f56b.js";import Le from"lodash/debounce";import Se from"react-contenteditable";import{l as je}from"./lazyLoad-59e8ff6d.js";import"date-fns";import"styled-components";var Be=function(i){var c=i.title,u=i.url,m=i.image,v=i.logo,g=i.className,h=i.style,f=i.noRefetch,w=a(E).data,k=w.locale,C=w.env.isMarryBaby,y=r(!1),M=y[0],_=y[1],P=l(f);P.current=f;var L=r(null),S=L[0],j=L[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return P.current?[2]:u?(j((function(e){return n(n({},e),{isFetching:!0})})),I(T(x.FETCH_PREVIEW,{_locale:k}),"POST",{data:{link:u}}).then((function(e){var t,n,i;_(!1),j({title:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.title,url:u,image:(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.image)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.logo)})})).catch((function(){j(null)})),[2]):[2,j(null)]}))}))}),[u]);var B=(null==S?void 0:S.image)||m,F=(null==S?void 0:S.title)||c,R=(null==S?void 0:S.logo)||v,D=(null==S?void 0:S.url)||u,O=D.replace("http://","").replace("https://","").split(/[/?#]/)[0],A=l(!1);return o.createElement(b,{"data-is-marrybaby":C,className:"".concat(g," no-replace-click"),style:h},o.createElement("a",{href:D,target:"_blank",rel:"noreferrer"},B&&o.createElement("div",{className:"link-image-wrapper"},!C&&o.createElement("img",{className:"link-image-blur",src:B,onError:function(e){A.current||(A.current=!0,e.currentTarget.src=N)}}),o.createElement("img",{className:"link-image",src:B,onError:function(e){A.current||(A.current=!0,e.currentTarget.src=N)}})),o.createElement("div",{className:"link-info-container"},o.createElement(p,{size:"n1"},C&&R&&!M&&o.createElement("img",{className:"link-logo",src:R,onError:function(e){return _(!0)}}),O),o.createElement(d,{tag:"h6"},F))))},Fe=function(e){var t=e.topics,n=e.onClick,i=e.className,s=e.style,c=function(){var e=r(!1),t=e[0],n=e[1],i=l(null),o=l(null),a=l();return{sliding:t,mouseDownHandler:function(e){if(i.current){a.current=setTimeout((function(){n(!0)}),500),o.current={left:i.current.scrollLeft,x:e.clientX};var t=function(e){var t=o.current;if(t){var n=e.clientX-t.x;i.current&&(i.current.scrollLeft=t.left-n)}},r=function(){a.current&&(clearTimeout(a.current),a.current=void 0),n(!1),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)}},sliderRef:i,pos:o}}(),u=c.sliding,d=c.mouseDownHandler,m=c.sliderRef,v=a(E),g=v.data.env.togetherBasePath,h=v.action.sanitizeFunction;return o.createElement(M,{ref:m,onClick:n,onMouseDown:function(e){return d(e)},className:"".concat(i," ").concat(u?"sliding":""),style:s},t.map((function(e,t){return o.createElement("a",{className:"tag-link-item",key:t,href:e.isActive&&!e.isHidden?"".concat(g).concat(e.url):void 0},o.createElement(p,{size:"p3"},o.createElement("span",{dangerouslySetInnerHTML:{__html:(null==h?void 0:h(e.name))||e.name}})))})))},Re=function(e){var t=e.onClick;e.color;var n=e.className,i=e.style,r=a(E).data.env.isMarryBaby,l=h().t;return o.createElement(_,{label:o.createElement(o.Fragment,null,r&&o.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M3.5 19.9999L7.87 15.6299' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.95634 11.294C4.56534 11.685 4.56534 12.318 4.95634 12.708L7.87434 15.626L10.7923 18.544C11.1833 18.935 11.8163 18.935 12.2063 18.544L13.3813 17.369C13.5693 17.181 13.6743 16.927 13.6743 16.662V12.726L16.5743 9.82597L18.8833 9.94897C19.1663 9.96397 19.4433 9.85797 19.6433 9.65797L20.2173 9.08397C20.6083 8.69297 20.6083 8.05997 20.2173 7.66997L15.8313 3.28397C15.4403 2.89297 14.8073 2.89297 14.4173 3.28397L13.8433 3.85797C13.6423 4.05897 13.5363 4.33497 13.5523 4.61797L13.6753 6.92697L10.7753 9.82697H6.83834C6.57334 9.82697 6.31834 9.93197 6.13134 10.12L4.95634 11.294V11.294Z' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath d='M16.5699 9.83018L13.6699 6.93018' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3c/svg%3e"})," ",l("label.pinnedPost")),rightLabel:!r&&o.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cline x1='7.18605' y1='7.68219' x2='3.68219' y2='13.8139' stroke='%23FEA21E' stroke-linecap='round'/%3e%3cpath d='M3.24591 7.78426C3.21275 7.84168 3.20376 7.90993 3.22092 7.97398C3.23808 8.03803 3.27998 8.09264 3.3374 8.12579L8.78429 11.2706C8.90385 11.3396 9.05674 11.2986 9.12578 11.1791C9.71191 10.1641 9.71348 8.97262 9.23682 7.99339L10.8583 5.18521C11.5115 5.00603 12.0982 4.57973 12.4638 3.94629C12.5328 3.82672 12.4919 3.67383 12.3723 3.6048L8.18237 1.18584C8.12494 1.15268 8.0567 1.1437 7.99265 1.16086C7.92861 1.17803 7.874 1.21993 7.84086 1.27736C7.47521 1.91077 7.39934 2.63194 7.57065 3.28723L5.94919 6.09545C4.86323 6.1723 3.83201 6.76934 3.24591 7.78426Z' fill='%23FEA21E' stroke='%23FEA21E' stroke-width='0.5' stroke-linejoin='round'/%3e%3c/svg%3e"}),onClick:t,color:"white",className:"label-pinned ".concat(n),style:i})},De=function(e){return{message:e("notification.failure"),type:"danger"}},Oe="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%23FE921D'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",Ae=function(n){var i=n.id,o=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return i?[4,P(T(x.POST.LIKE,{id:i,_locale:o}),"GET")]:[2];case 1:return[2,e.sent()]}}))}))},ze=function(n){var i=n.id,o=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return i?[4,P(T(x.POST.DELETE,{id:i,_locale:o}),"DELETE")]:[2];case 1:return[2,e.sent()]}}))}))},Ve=function(n){var i=n.title,o=n.description,a=n.communityId,r=n.imageFiles,l=n.previewUrl,s=n.topicIds,c=n.locale,u=n.sanitizeFunction,d=n.categoryCommunityId,m=n.categoryTopicIds,p=n.introUrl,v=n.bannerUrl,g=n.scheduleTime;return e(void 0,void 0,void 0,(function(){var e,n,h,f,w;return t(this,(function(t){switch(t.label){case 0:return e=new FormData,n=S(o),h=S(i),f=j(n),e.append("title",h),e.append("description",B(n,u)),d?e.append("category_community",String(d)):a&&e.append("community_id",String(a)),(null==l?void 0:l.title)&&e.append("preview_title",l.title),(null==l?void 0:l.description)&&e.append("preview_description",l.description),(null==l?void 0:l.url)&&e.append("preview_link",l.url),(null==l?void 0:l.image)&&e.append("preview_image",l.image),null==s||s.forEach((function(t){e.append("topics[]",String(t||""))})),null==m||m.forEach((function(t){e.append("category_topics[]",String(t||""))})),(null==r?void 0:r.length)?[4,Promise.all(r.map((function(e,t){return new Promise((function(n){setTimeout((function(){n(F(e,c))}),2e3*t)}))})))]:[3,2];case 1:return null==(w=t.sent())||w.filter(Boolean).slice(0,L).forEach((function(t,n){e.append("images[".concat(n,"]"),t)})),[3,3];case 2:e.append("images",""),t.label=3;case 3:return null==f||f.forEach((function(t){e.append("mention_ids[]",t)})),e.append("intro_url",p||""),e.append("banner",v||""),g&&(e.append("post_type","scheduled"),e.append("schedule_datetime",g)),[2,e]}}))}))},Ue=function(n){var i=n.locale,o=n.formData,a=n.isArticleComment;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,P(T(a?x.POST.CREATE_ARTICLE_COMMENT:x.POST.CREATE,{_locale:i}),"POST",{data:o,headers:{"Content-Type":"multipart/form-data"}})];case 1:return[2,e.sent()]}}))}))},He=function(n){var i=n.id,o=n.locale,a=n.formData;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,P(T(x.POST.UPDATE,{id:i,_locale:o}),"POST",{data:a})];case 1:return[2,e.sent()]}}))}))},We=function(e){var t=e.id,n=e.reason,i=e.locale,o=new FormData;return o.append("reason",n),P(T(x.POST.REPORT,{_locale:i,id:t}),"POST",{data:o})},Ze=function(e,t){var n=r(e||[]),i=n[0],o=n[1];return{onSelectImages:function(n){var a=n.target.files;a&&(t&&e?t((e||i).concat(Array.from(a))):o((function(n){var i=e||n;return t&&t(i.concat(Array.from(a))),i.concat(Array.from(a))})))},onRemoveImage:function(n){if(t&&e){var i=e;i.splice(n,1),t(i.slice())}else o((function(i){var o=e||i;return o.splice(n,1),t&&t(o.slice()),o.slice()}))},onRemoveAllImages:function(){t?t([]):o([])},imageSrcs:c((function(){return(e||i).map((function(e){return"string"==typeof e?e:URL.createObjectURL(e)}))}),[e,i]),imageFiles:e||i}},Ge="data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 22.9844C17.5228 22.9844 22 18.5072 22 12.9844C22 7.46153 17.5228 2.98438 12 2.98438C6.47715 2.98438 2 7.46153 2 12.9844C2 18.5072 6.47715 22.9844 12 22.9844Z' fill='%23262626'/%3e%3cpath d='M14.8281 10.1562L9.17127 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.17188 10.1562L14.8287 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",Ke=function(e){var t=e.className,n=e.style,i=e.bannedWords,a=void 0===i?[]:i,c=e.value,u=e.onChange,d=e.onPreviewUrlChange,m=e.onInvalidUrlsChange,v=e.onImageFilesChange,g=e.imageFiles,f=e.isReplying,w=h().t,y=r(null),E=y[0],b=y[1],N=l(null),I=Ze(g,v),T=I.onSelectImages,x=I.onRemoveImage,M=I.imageSrcs;return s((function(){d&&((null==E?void 0:E.url)?d({title:E.title||"",url:E.url||"",image:E.image||"",description:E.description||""}):d(null))}),[E]),o.createElement(R,{className:t,style:n},o.createElement(p,{size:"p4",className:"description-label"},w("createPost.popup.description")),o.createElement("div",{className:"textarea-control"},o.createElement("div",{className:"textarea-wrapper"},o.createElement(D,{html:c||"",onChange:u,bannedWords:a,onImagePickerClick:function(){var e;return null===(e=N.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:b,onInvalidUrlsChange:m,isReplying:f}))),o.createElement(p,{size:"p4",className:"count-string"},w("character"),": ",k(c||"").length),(!M||0===M.length)&&E&&o.createElement("div",{className:"link-preview-wrapper"},E.isFetching?o.createElement(O,null):o.createElement(o.Fragment,null,o.createElement(Be,{title:E.title,url:E.url||"#",image:E.image,noRefetch:!0}),o.createElement("img",{src:Ge,className:"icon-close",onClick:function(){return b(null)}}))),o.createElement("input",{ref:N,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:T}),M.length>L?o.createElement("div",{className:"input-notification"},o.createElement("img",{src:Oe}),o.createElement(p,{size:"p4",color:C.colors.alertWarning},w("createPost.popup.warningImage"))):null,M.length>0&&o.createElement("div",{className:"image-gallery"},M.map((function(e,t){return o.createElement("div",{key:t,className:"image-item"},o.createElement("img",{src:e}),o.createElement("img",{className:"close-btn",src:Ge,onClick:function(){return x(t)}}))}))))},Qe=function(e,t){if(!t)return e;var n=t.limit,i=t.bannedWords,o=void 0===i?[]:i,a="number"==typeof n&&n>=0?e.substring(0,n):e;return A(a,o)},Xe=function(e){var t,n=e.className,i=e.style,a=e.bannedWords,c=void 0===a?[]:a,d=e.value,m=e.onChange,v=h().t,g=r(""),f=g[0],w=g[1],k=l(null);s((function(){if(k.current){var e=function(e){var t;e.preventDefault();var n=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,n)},t=k.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[k]);var C=(null==c?void 0:c.join(","))||"";s((function(){var e;if(C){var t=null===(e=k.current)||void 0===e?void 0:e.innerText;if(t){var n=A(t,c);n!==t&&(m&&m(n),w(n))}}}),[C]);var y=u(Le((function(e){if(k.current){var t=Qe(k.current.innerText,{limit:120,bannedWords:c});m&&m(t),w(t)}}),300),[]);return s((function(){setTimeout((function(){var e;null===(e=k.current)||void 0===e||e.focus()}),500)}),[]),o.createElement(z,{className:n,style:i},o.createElement(Pe,{name:"title",value:d||f,size:"md",label:v("createPost.title"),CustomInput:o.createElement(Se,{innerRef:k,html:d||f,onChange:function(e){if(k.current&&k.current.innerText!==(d||f)){var t=Qe(k.current.innerText,{bannedWords:c});m&&m(t),w(t),y(k.current.innerText)}},className:"title-input"})}),o.createElement(p,{size:"p4",className:"count-string"},v("createPost.popup.wordCount",{count:(null===(t=k.current)||void 0===t?void 0:t.innerText.length)||0,max:120})))},Je=function(n){var u=n.className,d=n.style,m=n.topics,p=n.communityId,v=n.onChange,g=n.isLoading,h=n.disabled,f=n.forceTopics,w=n.selectedTopics,k=n.noFetch,C=a(E).data,y=C.locale,b=C.env.isMarryBaby,N=r(m?i([],m,!0):[]),M=N[0],_=N[1],P=r(w?i([],w,!0):[]),L=P[0],S=P[1],j=r(!1),B=j[0],F=j[1],R=l(m);R.current=m,s((function(){var n;!p||k||(null===(n=R.current)||void 0===n?void 0:n.length)||(_([]),F(!0),e(void 0,void 0,void 0,(function(){var e,n,i,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,I(T(x.TOPIC.LIST,{communityId:p,_locale:y}),"GET")];case 1:return e=t.sent(),n=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.topics,Array.isArray(n)&&_((function(){return(null==n?void 0:n.map(U).sort((function(e,t){return(e.order||0)-(t.order||0)})))||[]})),[3,3];case 2:return i=t.sent(),console.log(i),F(!1),[3,3];case 3:return F(!1),[2]}}))})))}),[p,k]);var D=null==m?void 0:m.map((function(e){return e.id})).join("-"),A=null==M?void 0:M.map((function(e){return e.id})).join("-"),z=null==f?void 0:f.map((function(e){return e.id})).join("-");s((function(){m&&void 0!==D&&D!==A&&_(m)}),[m,D,A]);var H=c((function(){return M.filter((function(e){return!(null==f?void 0:f.some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})))}))}),[A,z]);return o.createElement(V,{"data-is-marrybaby":b,className:u,style:d},f.map((function(e){return o.createElement(Ye,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:!0,selected:!0})})),H.map((function(e){return o.createElement(Ye,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:h,selected:(w||L).some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})),onClick:function(){var t=w||L,n=t.findIndex((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId}));-1!==n?t.splice(n,1):t.push(e),v&&w?v(t.slice()):(v&&v(t.slice()),S(t.slice()))}})})),(g||B)&&o.createElement(O,{className:"topic-spinner"}))},Ye=function(e){var t=e.topic,n=e.disabled,i=e.selected,a=e.onClick;return o.createElement("div",{className:"tag-item"+(i?" --active":""),"data-disabled":n,onClick:n?void 0:a},t.name)},$e=function(n){var l=n.className,c=n.style,u=n.onPostCreatedEdited,d=n.onClose,g=n.communities,f=void 0===g?[]:g,w=n.forceSelectCommunity,y=n.forceSelectTopics,b=n.articleId,N=n.optionalTopic,I=n.editPostData,T=n.defaultCommunity,x=n.defaultTopics,M=n.noFetchTopic,_=n.hideTopicList,P=!!(null==I?void 0:I.id),S=a(E),j=S.data,B=j.locale,F=j.env.isMarryBaby,R=S.action,D=R.pushNotifications,O=R.sanitizeFunction,A=h().t,z=r(!1),V=z[0],U=z[1],K=r(""),Q=K[0],X=K[1],J=r(""),Y=J[0],$=J[1],q=r(w?{label:w.name,value:"".concat(w.id||"","-").concat(w.mappedCategoryId||"")}:{label:A("community.choose"),value:""}),ee=q[0],te=q[1],ne=r(i([],y,!0)||[]),ie=ne[0],oe=ne[1],ae=r([]),re=ae[0],le=ae[1],se=r([]),ce=se[0],ue=se[1],de=w||f.find((function(e){return"".concat(e.id||"","-").concat(e.mappedCategoryId||"")===ee.value})),me=w?[w]:f.filter((function(e){return e.isActive})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),pe=r(null),ve=pe[0],ge=pe[1],he=r([]),fe=he[0],we=he[1],ke=Q&&k(Y)&&(N||!N&&ie.length>0)&&de&&(!re||re.length<=L)&&!(null==fe?void 0:fe.length)&&!V;s((function(){if(I){var e=I;X(e.title||""),$(H(W(e.description||"","edit"),e.mentions)),te({label:e.community.name,value:"".concat(e.community.id||"","-").concat(e.community.mappedCategoryId||"")}),oe(e.topics||[]),le(e.photos||[])}else T&&te({label:T.name,value:"".concat(T.id||"","-").concat(T.mappedCategoryId||"")}),x&&oe(x)}),[]);var Ce=function(){return e(void 0,void 0,void 0,(function(){var e,n,i,o,a,r,l,s,c,m,p,v;return t(this,(function(t){switch(t.label){case 0:return[4,Ve({title:Q,description:Y,communityId:String((null==de?void 0:de.id)||""),imageFiles:re,previewUrl:ve,topicIds:null==ie?void 0:ie.map((function(e){return String(e.id||"")})).filter(Boolean),locale:B,sanitizeFunction:O,categoryCommunityId:String((null==de?void 0:de.mappedCategoryId)||""),categoryTopicIds:null==ie?void 0:ie.map((function(e){return String(e.mappedCategoryId||"")})).filter(Boolean)})];case 1:return e=t.sent(),b&&e.append("article_id",b),P?(null==I?void 0:I.id)?[4,He({id:I.id,formData:e,locale:B})]:[3,3]:[3,4];case 2:n=t.sent(),t.label=3;case 3:return[3,6];case 4:return[4,Ue({formData:e,locale:B,isArticleComment:!(null==de?void 0:de.id)&&!!(null==de?void 0:de.mappedCategoryId)})];case 5:n=t.sent(),t.label=6;case 6:return(null==(i=null==n?void 0:n.data)?void 0:i.id)&&!(null===(a=null===(o=null==n?void 0:n.messages)||void 0===o?void 0:o.moderation)||void 0===a?void 0:a.type)?(D({message:A("createPost.popup.success"),type:"success"}),function(e){u&&u(G(e),P),d&&d()}(i)):"banned"===(null===(l=null===(r=null==n?void 0:n.messages)||void 0===r?void 0:r.moderation)||void 0===l?void 0:l.type)?(D({title:A("notification.post.blocked.title"),message:A("notification.post.blocked.message"),type:"danger"}),n.messages.moderation.words&&ue(n.messages.moderation.words)):"suspect"===(null===(c=null===(s=null==n?void 0:n.messages)||void 0===s?void 0:s.moderation)||void 0===c?void 0:c.type)?(D({title:A("notification.post.suspect.title"),message:A("notification.post.suspect.message"),type:"warning"}),d&&d()):(null===(p=null===(m=null==n?void 0:n.messages)||void 0===m?void 0:m.find)||void 0===p?void 0:p.call(m,(function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(D({message:A("notification.suspend.message"),type:"danger"}),d&&d()):D({message:(null===(v=null==n?void 0:n.messages)||void 0===v?void 0:v[0])||A("notification.failure"),type:"danger"}),[2]}}))}))};return o.createElement(Z,{className:l,style:c},o.createElement("div",{className:"input-group-container"},o.createElement(Xe,{className:"input-group",bannedWords:ce,value:Q,onChange:X}),o.createElement(Ke,{className:"input-group",bannedWords:ce,value:Y,onChange:$,onPreviewUrlChange:ge,onInvalidUrlsChange:we,onImageFilesChange:le,imageFiles:re}),o.createElement("div",{className:"input-group"},o.createElement(p,{size:"p4",className:"input-group-label"},A("admin.community")),o.createElement(v,{options:(null==me?void 0:me.map((function(e,t){return{label:e.name,value:"".concat(e.id||"","-").concat(e.mappedCategoryId||"")}})))||[],id:"community-picker",placeholder:A("community.choose"),value:ee,onChange:function(e){te({label:e.label,value:String(e.value)}),oe([])},disabled:!!w}),o.createElement(p,{size:"sm",className:"warning",color:C.colors.gray400},"* ",A("commentPopup.warning.newPost"))),!_&&o.createElement("div",{className:"input-group"},o.createElement(p,{size:"p4",className:"input-group-label"},A("tab.topic")),o.createElement("div",{className:"input-notification"},o.createElement("img",{src:de?"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%232D87F3'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e":Oe}),o.createElement(p,{size:"base",color:C.colors.gray500},A(de?"createPost.popup.primary":"createPost.popup.warning"))),de&&o.createElement(Je,{className:"tag-list",communityId:de.id,forceTopics:y,onChange:oe,selectedTopics:ie,noFetch:M}))),o.createElement(m,{theme:F?"marryBaby":"helloSites",className:"submit-btn",size:"lg",onClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!ke||V)return[3,5];U(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Ce()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.error(e),D(De(A)),[3,4];case 4:U(!1),t.label=5;case 5:return[2]}}))}))},isDisabled:!ke,isLoading:V},A("createPost.popup.submit")))},qe=function(e){var t=e.className,n=e.isMarryBaby,i=e.style,l=e.title,c=e.description,u=e.acceptText,v=e.cancelText,g=e.onAccept,h=e.thumbnail,k=e.isThumbnailIcon,C=e.onClose,y=a(E).data.env.isMarryBaby,b="boolean"==typeof n?n:y,N=r(!1),I=N[0],T=N[1];return s((function(){return f(!0),setTimeout((function(){return T(!0)}),0),function(){return f(!1)}}),[]),_e.createPortal(o.createElement(K,{"data-is-marrybaby":b,className:t,style:i,"data-open":I},o.createElement(Q,{className:"popup-frame",isOpen:I,onClose:C},o.createElement("div",{className:"confirm-dialog",onClick:function(e){return e.stopPropagation()}},o.createElement("div",{className:"confirm-content"},h&&o.createElement("div",{className:"thumbnail-container ".concat(k?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:h})),o.createElement(d,{className:"title",tag:"h2"},l),o.createElement(p,{className:"desc",size:"lg"},c),o.createElement("div",{className:"btn-group"},o.createElement(m,{theme:b?"marryBaby":"helloSites",size:"md",color:"secondary",onClick:function(){null==g||g(),null==C||C()}},u),o.createElement(m,{theme:b?"marryBaby":"helloSites",size:"md",onClick:C},v)))),b&&h&&o.createElement("div",{className:"thumbnail-container is-mobile ".concat(k?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:h})))),w())},et=function(n){var i=n.postId,o=n.message,a=n.photos,r=n.link,l=n.locale,s=n.sanitizeFunction,c=n.replyingUserId,u=n.replyingUserName,d=n.replyingId;return e(void 0,void 0,void 0,(function(){var e,n,m;return t(this,(function(t){switch(t.label){case 0:return e=new FormData,n=B(o.replace(/(\ )+/g," "),s),m=j(n),a&&a.length>0?[4,Promise.all(null==a?void 0:a.map((function(e){return F(e,l)})))]:[3,2];case 1:t.sent().filter(Boolean).slice(0,L).forEach((function(t){e.append("images[]",t)})),t.label=2;case 2:return r&&e.append("link",r),null==m||m.forEach((function(t){e.append("mention_ids[]",t)})),e.append("post_id",i),d&&e.append("parent_id",d),c&&(m.unshift(c),n='[mention+id="'.concat(c,'"+name="').concat((u||"").replace('"',"'"),'"]').concat(n),e.append("parent_user_id",String(c))),e.append("content",n),e.append("content",n),[2,e]}}))}))},tt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,P(T(x.COMMENT.CREATE,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},nt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,P(T(x.COMMENT.REPLY,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},it=function(n){var i=n.commentId,o=n.setLike,a=void 0!==o&&o,r=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,P(T(a?x.COMMENT.LIKE:x.COMMENT.UNLIKE,{_locale:r,id:i}),"GET")]}))}))},ot=function(e){var t=e.id,n=e.locale;return P(T(x.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")},at=function(i){var c=i.isReply,u=i.className,d=i.onClose,v=i.replyToName,g=i.style,f=i.replyingId,w=i.replyingUser,k=i.onPostSuccess;i.isMainCmt;var C=i.post,y=i.isMarryBaby,b=a(E),N=b.action,I=N.pushNotifications,T=N.sanitizeFunction,x=b.data,M=x.userInfo,_=x.locale,P=x.env.isMarryBaby,L="boolean"==typeof y?y:P,S=h().t,j=Ze(),B=j.onSelectImages,F=j.onRemoveImage,R=j.imageSrcs,A=j.onRemoveAllImages,z=j.imageFiles,V=r(""),U=V[0],H=V[1],W=a(X).trigger,Z=r(!1),G=Z[0],K=Z[1],Q=l(null),ee=l(null),te=l(null),ne=r([]),ie=ne[0],oe=ne[1],ae=r([]),re=ae[0],le=ae[1],se=r(null),ce=se[0],ue=se[1];return s((function(){var e;null===(e=te.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout((function(){var e;null===(e=ee.current)||void 0===e||e.focus()}),400)}),[W]),o.createElement(J,{"data-is-reply":c,className:u,style:g},c&&o.createElement("div",{className:"reply-to-container"},o.createElement(p,{size:"p4"},o.createElement("span",{dangerouslySetInnerHTML:{__html:S("inputComment.replyTo",{name:'<span style="color: #2D87F3; cursor: pointer">@'.concat(v||"","</span>")})}})),o.createElement("img",{src:"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8.00016' cy='8.50004' r='6.66667' fill='white' stroke='%23404040'/%3e%3cpath d='M10 6.5L6 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6 6.5L10 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-close-comment",onClick:function(){return d&&d()}})),o.createElement("div",{className:"input-container",ref:te},o.createElement(Y,{className:"avatar-wrapper ".concat(c?"avatar-wrapper-reply":""),avatar:(null==M?void 0:M.id)?M.avatar:$,username:(null==M?void 0:M.name)||(null==M?void 0:M.username)}),o.createElement("input",{ref:Q,onChange:B,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),o.createElement(Pe,{value:U,name:"input",size:"md",className:"input-wrapper",displayIcon:o.createElement("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.7543 4.85352H4.49227C4.01776 4.85352 3.56268 5.04201 3.22715 5.37754C2.89162 5.71307 2.70313 6.16815 2.70312 6.64266V19.1667C2.70313 19.6412 2.89162 20.0963 3.22715 20.4318C3.56268 20.7673 4.01776 20.9558 4.49227 20.9558H17.0163C17.4908 20.9558 17.9459 20.7673 18.2814 20.4318C18.6169 20.0963 18.8054 19.6412 18.8054 19.1667V12.9047' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M17.4633 3.51187C17.8192 3.15599 18.3019 2.95605 18.8052 2.95605C19.3085 2.95605 19.7912 3.15599 20.147 3.51187C20.5029 3.86775 20.7029 4.35044 20.7029 4.85373C20.7029 5.35702 20.5029 5.83971 20.147 6.19559L11.6486 14.694L8.07031 15.5886L8.96489 12.0103L17.4633 3.51187Z' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e"}),CustomInput:o.createElement("div",{className:"as-input"},o.createElement(D,{className:"textarea",html:U,onChange:H,onImagePickerClick:function(){var e;return null===(e=Q.current)||void 0===e?void 0:e.click()},bannedWords:re,onPreviewUrlChange:ue,onInvalidUrlsChange:oe,setEditorRef:function(e){return ee.current=e},isReplying:c}))}),o.createElement(m,{theme:L?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:function(){return e(void 0,void 0,void 0,(function(){var e,i,o,a,r,l,s,u,m,p,v,g,h;return t(this,(function(t){switch(t.label){case 0:if(!(null==C?void 0:C.id)||G)return[2];K(!0),t.label=1;case 1:return t.trys.push([1,4,,5]),e=function(e){H(""),A(),d&&d();var t=q(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),k&&k(t)},[4,et(n({message:U,photos:z,postId:String(C.id),link:null==ce?void 0:ce.url,sanitizeFunction:T,locale:_},c&&f?{replyingUserId:String((null==w?void 0:w.id)||(null===(r=null==C?void 0:C.author)||void 0===r?void 0:r.id)||""),replyingId:f,replyingUserName:(null==w?void 0:w.name)||(null==w?void 0:w.username)||""}:{}))];case 2:return i=t.sent(),[4,c&&f?nt(i,_):tt(i,_)];case 3:return o=t.sent(),(null==(a=null==o?void 0:o.data)?void 0:a.id)&&!(null===(s=null===(l=null==o?void 0:o.messages)||void 0===l?void 0:l.moderation)||void 0===s?void 0:s.type)?e(o):"banned"===(null===(m=null===(u=null==o?void 0:o.messages)||void 0===u?void 0:u.moderation)||void 0===m?void 0:m.type)?(I({title:S("notification.comment.blocked.title"),message:S("notification.comment.blocked.message"),type:"danger"}),o.messages.moderation.words&&le(o.messages.moderation.words)):"suspect"===(null===(v=null===(p=null==o?void 0:o.messages)||void 0===p?void 0:p.moderation)||void 0===v?void 0:v.type)?(I({title:S("notification.comment.suspect.title"),message:S("notification.comment.suspect.message"),type:"warning"}),H(""),A(),d&&d()):(null===(g=null==o?void 0:o.messages)||void 0===g?void 0:g.find((function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(I({message:S("notification.suspend.message"),type:"warning"}),H(""),A(),d&&d()):I({title:"",message:(null===(h=null==o?void 0:o.messages)||void 0===h?void 0:h[0])||S("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 4:return t.sent(),I({title:"",message:S("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 5:return K(!1),[2]}}))}))},isLoading:G,isDisabled:!!(null==ie?void 0:ie.length)||G||!U||(null==U?void 0:U.length)<2||!U.trim()},o.createElement("img",{src:"data:image/svg+xml,%3csvg width='20' height='21' viewBox='0 0 20 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 9.73438L3.75 13.4844L7.5 17.2344' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M16.25 4.73438L16.25 10.3026C16.25 11.1464 15.9208 11.9557 15.3347 12.5524C14.7487 13.1491 13.9538 13.4844 13.125 13.4844L3.75 13.4844' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-enter"}))),(null==ie?void 0:ie.length)?o.createElement("div",{className:"error-text"},S("notification.limitUrlDomain")):null,(!R||0===R.length)&&ce&&o.createElement("div",{className:"link-preview-wrapper"},ce.isFetching?o.createElement(O,null):o.createElement(o.Fragment,null,o.createElement(Be,{title:ce.title,url:ce.url||"#",image:ce.image,noRefetch:!0}),o.createElement("img",{src:Ge,className:"icon-close",onClick:function(){return ue(null)}}))),R&&R.length>0&&o.createElement("div",{className:"preview-images-container"},R.map((function(e,t){return o.createElement("div",{key:t,className:"image-src-wrapper"},o.createElement("img",{className:"preview-image",src:e}),o.createElement("img",{src:Ge,className:"icon-close-circle",onClick:function(){return F(t)}}))}))))},rt="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 5V8' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11H8.00708' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",lt=function(n){var i=n.className,l=n.style,s=n.reason,c=n.reasonText,u=n.onClose,d=n.postId,v=a(E),g=v.data,f=g.locale,w=g.env.isMarryBaby,k=v.action.pushNotifications,y=h().t,b=r(!1),N=b[0],I=b[1];return o.createElement(ee,{"data-is-marrybaby":w,className:i,style:l},o.createElement("ul",{className:"report-list"},o.createElement("li",{className:"report-item"},o.createElement("img",{src:rt}),o.createElement(p,{className:"__label",color:C.colors.gray800,size:"p4"},c))),o.createElement(m,{theme:w?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:N,onClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!d||N)return[2];I(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,We({id:d,reason:s,locale:f})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(k({message:"Post reported",type:"success"}),u&&u()),[3,4];case 3:return t.sent(),[3,4];case 4:return I(!1),[2]}}))}))}},y("submit")))},st=function(e){var t=e.className,n=e.style,i=e.replyingTo,l=e.mentionedUser,s=e.description,u=e.disableShortenContent,d=e.mentions,m=void 0===d?[]:d,p=r(!1),v=p[0],g=p[1],f=h().t,w=te().authActionWrapper,k=r(!1),C=k[0],y=k[1],b=H(W(s||"","display"),m),N=a(E).action.sanitizeFunction,I=c((function(){var e=N(b||"");if(u||v)return{showContent:e,hasSeeMore:!1};var t=e.slice(0,1e3),n=1e3-27*((t.match(/<\/div>/g)||[]).length-1),i=(t||"").slice(0,n<40?40:n),o=N(i.replace(/(<|<\/)( +|[a-zA-Z]*)$/gi,"")),a=o.length<e.length-10;return{showContent:a?o:e,hasSeeMore:a}}),[u,v,b]),T=(null==l?void 0:l.name)||i,x="expert"===(null==l?void 0:l.role)&&!!(null==l?void 0:l.partnerId);return o.createElement(o.Fragment,null,x&&o.createElement(ne,{isOpen:C,onClose:function(){return y(!1)},expertId:String(null==l?void 0:l.partnerId)}),o.createElement(ie,{className:"".concat(t," no-replace-click"),style:n},T&&o.createElement("span",{onClick:function(){return x&&y(!0)},className:"post-content-replying"},"@",T),(null==s?void 0:s.startsWith("[mention+id="))&&o.createElement("span",{className:"post-content-replying tag-only"},"@"),o.createElement("span",{dangerouslySetInnerHTML:{__html:I.showContent},className:"post-content ".concat(I.hasSeeMore?"has-see-more":"")}),I.hasSeeMore&&!v&&o.createElement("span",null,"... ",o.createElement("span",{onClick:function(e){e.preventDefault(),e.stopPropagation(),w((function(){return g(!0)}))},className:"see-more-text"},f("post.seeMore")))))},ct=function(e){var t=e.className,n=e.style,i=e.authorName,a=e.images,l=e.onClose,c=e.onOpenSingleView,u=h().t,d=r(!1),m=d[0],v=d[1];return s((function(){setTimeout((function(){v(!0)}),0)}),[]),_e.createPortal(o.createElement(oe,{className:t,style:n,"data-open":m},o.createElement("div",{className:"top-bar"},o.createElement("img",{className:"icon-arrow-left",src:"data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.0508 18.0607L4.00078 12.0367L10.0508 6.01172' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.00195 12.0352L19.002 12.0352' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",onClick:l,alt:"go back"}),o.createElement(p,{size:"p2",type:"bold",style:{textAlign:"center"}},u("previewPhotos.title",{name:i}))),o.createElement("div",{className:"container"},a.map((function(e,t){return o.createElement("img",{className:"img-preview",key:t,src:e,onClick:function(){return null==c?void 0:c(t)},alt:"post img"})})))),w())},ut="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12.8125L10 8.8125L6 4.8125' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",dt=function(e){var t=e.initialViewIndex,n=e.images,i=e.onClose,a=r(t),l=a[0],c=a[1],u=r(!1),d=u[0],m=u[1];s((function(){setTimeout((function(){m(!0)}),0)}),[]);var p=null==n?void 0:n[l],v=0===l,g=!(null==n?void 0:n.length)||l===(null==n?void 0:n.length)-1;return _e.createPortal(o.createElement(ae,{"data-open":d&&!!p},o.createElement(re,null,o.createElement("img",{src:le,className:"icon-close",onClick:i,alt:"close"})),p&&l>=0&&o.createElement(o.Fragment,null,o.createElement(se,null,o.createElement("img",{className:"img-preview",src:p,alt:"post img open"}),o.createElement(ce,{"data-disabled":v,onClick:function(){return!v&&c(l-1)}},o.createElement(ue,null,o.createElement("img",{src:ut,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":v}))),o.createElement(ce,{"data-right":!0,"data-disabled":g,onClick:function(){return!g&&c(l+1)}},o.createElement(ue,null,o.createElement("img",{src:ut,alt:"right arrow","data-disabled":g})))))),w())},mt=function(e){var t=e.className,n=e.images,i=void 0===n?[]:n,c=e.style,u=e.authorName,m=a(E).data.env.isMarryBaby,p="+ ".concat((i.length||0)-4),v=r(!1),g=v[0],h=v[1],w=r(-1),k=w[0],C=w[1];s((function(){setTimeout((function(){return null==je?void 0:je.update()}),100)}),[null==i?void 0:i.slice(0,5).join("|")]);var y=i.length>5,b=l(!1);return s((function(){return function(){b.current&&f(!1)}}),[]),s((function(){g||k>=0?(f(!0),b.current=!0):(f(!1),b.current=!1)}),[g,k]),o.createElement(o.Fragment,null,o.createElement(de,{className:t,style:c,"data-image-count":y?5:i.length||0,"data-is-marrybaby":m},null==i?void 0:i.slice(0,5).map((function(e,t){return o.createElement("div",{className:"img-wrapper",key:t,onClick:function(){t>=4&&y?h(!0):C(t)}},!m&&o.createElement("img",{className:"lazy img-preview-blur","data-src":e}),o.createElement("img",{className:"lazy img-preview","data-src":e}),4===t&&y&&o.createElement("div",{className:"img-more-overlay"},o.createElement(d,{tag:"h1",color:"white"},p)))}))),g&&o.createElement(ct,{authorName:u||"",images:i,onClose:function(){return h(!1)},onOpenSingleView:C}),k>=0&&o.createElement(dt,{images:i,initialViewIndex:k,onClose:function(){return C(-1)}}))},pt=function(i){var u=i.url,d=i.image,m=i.className,p=i.style,v=a(E).data.locale,g=r(null),h=g[0],f=g[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return d?[2]:u?(f((function(e){return n(n({},e),{isFetching:!0})})),I(T(x.FETCH_PREVIEW,{_locale:v}),"POST",{data:{link:u}}).then((function(e){var t,n;f({url:u,image:(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.image)||(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.logo)})})).catch((function(){f(null)})),[2]):[2,f(null)]}))}))}),[u,d]);var w=(null==h?void 0:h.image)||d,k=(null==h?void 0:h.url)||u,C=c((function(){return me(k)}),[k]),y=c((function(){return pe(k)}),[k]),b=l(0),M=l(0),_=r(!1),P=_[0],L=_[1];s((function(){var e=function(){var e,t=null===(e=S.current)||void 0===e?void 0:e.getBoundingClientRect(),n=!1;t&&(!b.current||Math.abs((b.current-t.width)/(null==t?void 0:t.width))>.2)&&(b.current=Math.floor(t.width),n=!0),t&&(!M.current||Math.abs((M.current-t.height)/(null==t?void 0:t.height))>.2)&&(M.current=Math.floor(t.height),n=!0),n&&L((function(e){return!e}))};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var S=l(null),j=l(!1);return o.createElement(ve,{className:"".concat(m," no-replace-click"),style:p,ref:S},d||!C&&!y?o.createElement("a",{href:k,target:"_blank",rel:"noreferrer"},o.createElement("div",{className:"link-image-wrapper ".concat((null==h?void 0:h.isFetching)?"fetching":"")},(null==h?void 0:h.isFetching)?o.createElement(O,{className:"loading-spinner"}):o.createElement("img",{className:"link-image",src:w||N,onError:function(e){j.current||(j.current=!0,e.currentTarget.src=N)}}))):o.createElement("div",{className:"link-image-wrapper"},C?o.createElement("iframe",{width:"100%",height:"100%",src:"https://www.youtube.com/embed/".concat(C,"?&autoplay=1&mute=1"),frameBorder:"0",allowFullScreen:!0,style:{position:"absolute",top:0,left:0,border:"none",overflow:"hidden"}}):y?o.createElement("iframe",{key:String(P),src:"https://www.facebook.com/plugins/video.php?href=".concat(encodeURIComponent(k),"&autoplay=1&show_text=false&t=0&width=").concat(b.current,"&height=").concat(M.current),style:{position:"absolute",top:"50%",left:"50%",border:"none",overflow:"hidden",height:M.current,width:b.current,transform:"translate(-50%, -50%)"},scrolling:"no",frameBorder:"0",allowFullScreen:!0,allow:"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"}):null))},vt="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10Z' fill='%233E3F58'/%3e %3cpath d='M19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10Z' fill='%233E3F58'/%3e %3cpath d='M12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z' fill='%233E3F58'/%3e %3c/svg%3e",gt="data:image/svg+xml,%3csvg width='3' height='13' viewBox='0 0 3 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='1.58326' cy='6.41663' r='1.25' transform='rotate(89.9997 1.58326 6.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='1.41663' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 1.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='11.4166' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 11.4166)' fill='%23595959'/%3e%3c/svg%3e",ht="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2 4H3.33333H14' stroke='%23737373' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.33334 3.99992V2.66659C5.33334 2.31296 5.47382 1.97382 5.72387 1.72378C5.97392 1.47373 6.31305 1.33325 6.66668 1.33325H9.33334C9.68697 1.33325 10.0261 1.47373 10.2762 1.72378C10.5262 1.97382 10.6667 2.31296 10.6667 2.66659V3.99992M12.6667 3.99992V13.3333C12.6667 13.6869 12.5262 14.026 12.2762 14.2761C12.0261 14.5261 11.687 14.6666 11.3333 14.6666H4.66668C4.31305 14.6666 3.97392 14.5261 3.72387 14.2761C3.47382 14.026 3.33334 13.6869 3.33334 13.3333V3.99992H12.6667Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6.66666 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.33334 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",ft=function(n){var i=n.onDeleteComment,l=n.commentId,s=n.className,c=void 0===s?"":s,u=n.popoverClassName,d=void 0===u?"":u,m=a(E),p=m.data,v=p.env.isMarryBaby,g=p.locale,f=m.action.pushNotifications,w=h().t,k=r(!1),C=k[0],y=k[1],b=te().authActionWrapper;return o.createElement("div",{className:c,onClick:function(e){e.preventDefault(),e.stopPropagation()}},C&&o.createElement(qe,{thumbnail:"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0)'%3e%3cpath d='M2 4.00781H3.33333H14' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.33337 4.00846V2.67513C5.33337 2.32151 5.47385 1.98237 5.7239 1.73232C5.97395 1.48227 6.31309 1.3418 6.66671 1.3418H9.33337C9.687 1.3418 10.0261 1.48227 10.2762 1.73232C10.5262 1.98237 10.6667 2.32151 10.6667 2.67513V4.00846M12.6667 4.00846V13.3418C12.6667 13.6954 12.5262 14.0346 12.2762 14.2846C12.0261 14.5347 11.687 14.6751 11.3334 14.6751H4.66671C4.31309 14.6751 3.97395 14.5347 3.7239 14.2846C3.47385 14.0346 3.33337 13.6954 3.33337 13.3418V4.00846H12.6667Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6.66663 7.3418V11.3418' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.33337 7.3418V11.3418' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0'%3e%3crect width='16' height='16' fill='white' transform='translate(0 0.0078125)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",isThumbnailIcon:!0,title:w("popup.deleteComment.title"),description:w("popup.deleteComment.description"),acceptText:w("popup.deletePost.accept"),cancelText:w("popup.deletePost.cancel"),onAccept:function(){return e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return l?[4,ot({id:l,locale:g})]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(i&&i(),f({title:"",message:w("notification.success"),type:"success"})):f({title:"",message:(null===(n=null==e?void 0:e.messages)||void 0===n?void 0:n[0])||w("notification.failure"),type:"danger"}),[2]}}))}))},onClose:function(){return y(!1)}}),o.createElement(ge,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:ht,label:w("actionPopover.delete"),onClick:function(){b((function(){y(!0)}))}}]},className:d,toggleButtonContent:o.createElement("img",{src:v?vt:gt}),buttonProps:{}}))},wt=function(i){var l,u,d,p,v,f=i.className,w=i.style,k=i.comment,C=i.type,b=void 0===C?"comment":C,N=i.level,T=void 0===N?0:N,x=i.replyingId,M=i.onPostCommentSuccess,_=i.post,P=i.onDeleteComment,L=i.refetchComment,S=i.hasQuickBookingEnable,j=i.handleMakeAppointment,B=a(E).data,F=B.locale,R=B.userInfo,D=B.env.isMarryBaby,O=h().t,A=r(k||null),z=A[0],V=A[1],U=z.id;z.countReplies;var H=z.countLikes,W=z.content,Z=z.createdAt,G=z.replies,K=void 0===G?[]:G,Q=z.images,X=void 0===Q?[]:Q,J=z.author,Y=z.liked,$=z.link,q=z.mentionedUser,ee=z.mentions,ne=function(e){try{var t=e.match(/\[@([^\]]+)\]/),n=t?t[0].replace("[@","").replace("]",""):"";return{text:e.replace(/\[@([^\]]+)\]/,"").trim(),replyingTo:n}}catch(e){}return{text:""}}(W),ie=ne.text,oe=ne.replyingTo,ae=te({_joinCommunityIds:[null===(l=null==_?void 0:_.community)||void 0===l?void 0:l.id],_joinTopicIds:null===(u=null==_?void 0:_.topics)||void 0===u?void 0:u.map((function(e){return e.id}))}).authActionWrapper,re=r(4),le=re[0],se=re[1],ce=!!(null==R?void 0:R.id)&&(null==K?void 0:K.some((function(e){return e.author.id===R.id}))),ue=function(e){V((function(t){if(!t.replies.find((function(t){return t.id===e.id}))){t.replies.unshift(e);var i=n(n({},t),{replies:t.replies.slice(),countReplies:t.countReplies+1});return L&&L(i),i}return t}))},de=r(!1),me=de[0],pe=de[1],ve=c((function(){return"comment"===b&&K&&0!=K.length?K.sort((function(e,t){var n=new Date(e.createdAt).getTime(),i=new Date(t.createdAt).getTime();return n>i?-1:n<i?1:0})):K}),[b,K]),ge=(null==K?void 0:K.length)||0,be=String(null==J?void 0:J.email)&&(null==R?void 0:R.email)&&String(null==J?void 0:J.email)===String(null==R?void 0:R.email),Ne=(null==J?void 0:J.name)||(null==J?void 0:J.username)||"",Ie=null==J?void 0:J.avatar,Te=(null==J?void 0:J.username)||(null==J?void 0:J.name)||"",xe=r(null),Me=xe[0],_e=xe[1],Pe=r(null),Le=Pe[0],Se=Pe[1];s((function(){if(null==J?void 0:J.hospitalId){n=J.hospitalId,e(void 0,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,I(ye(Ee.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:y[F]}),"get")];case 1:return e=t.sent(),(null===(i=null==e?void 0:e._data)||void 0===i?void 0:i.branch)&&_e(null==e?void 0:e._data.branch),[2]}}))}))}var n,i;if(null==J?void 0:J.doctorId){i=J.doctorId,e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,I(ye(Ee.GET_DOCTOR_INFO,{doctorId:i,website_url:y[F]}),"get")];case 1:return e=t.sent(),(null===(n=null==e?void 0:e._data)||void 0===n?void 0:n.doctor)&&Se(null==e?void 0:e._data.doctor),[2]}}))}))}}),[J.hospitalId,J.doctorId]);var je=(null==Le?void 0:Le.valid_outpatient)||(null==Le?void 0:Le.valid_telemedicine),Fe=((null==Me?void 0:Me.total_available_service)||(null==Me?void 0:Me.total_available_doctor))>0,Re=S&&(je||Fe);return o.createElement(he,{defaultParams:{_joinCommunityIds:[null===(d=null==_?void 0:_.community)||void 0===d?void 0:d.id],_joinTopicIds:null===(p=null==_?void 0:_.topics)||void 0===p?void 0:p.map((function(e){return e.id}))}},o.createElement(fe,{className:f,style:w,"data-is-reply":!!T,"data-is-marrybaby":D,"data-has-booking":Re},"reply"===b&&o.createElement(g,{className:"top-divider",type:"solid"}),o.createElement(we,{avatar:Ie,name:Ne,username:Te,email:null==J?void 0:J.email,time:Z,className:"post-author ".concat(be?"with-popover":""),type:b,userId:null==J?void 0:J.id,role:null==J?void 0:J.role,expertId:null==J?void 0:J.partnerId,title:null==J?void 0:J.title,doctorId:null==J?void 0:J.doctorId,hospitalId:null==J?void 0:J.hospitalId,hasQuickBooking:Re,handleMakeAppointment:j}),o.createElement(st,{className:"post-content-wrapper",replyingTo:oe,mentionedUser:q,description:ie,mentions:ee}),o.createElement("span",null),o.createElement("span",null),X&&X.length>0?o.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},o.createElement(mt,{images:X,authorName:null==J?void 0:J.username})):null,X&&0!==X.length||!$?null:o.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},o.createElement(Be,{url:$})),"most-engaging"!==b?o.createElement(o.Fragment,null,o.createElement(ke,{type:Ce.reply,loveCount:H,replyCount:ge,className:"post-reaction",liked:Y,isReplied:ce,hideCommentIcon:"reply"===b,onCommentClick:function(){return ae((function(){return pe((function(e){return!e}))}))},onCommentCountClick:function(){return ae((function(){pe(!0)}))},onLikeClick:function(){return ae((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return U?[4,it({commentId:U,setLike:!Y,locale:F})]:[3,2];case 1:1===e.sent().status&&V((function(e){return n(n({},e),{liked:!Y,countLikes:e.countLikes+(Y?-1:1)})})),e.label=2;case 2:return[2]}}))}))}))}}),me&&o.createElement(at,{replyingId:x||z.id,replyToName:J.name||J.username||"",isReply:!0,onClose:function(){return pe(!1)},onPostSuccess:function(e){"reply"===b?M&&M(e):ue(e)},post:_,replyingUser:J}),"comment"===b&&K&&K.length>0?o.createElement("div",{className:"comment-reply-wrapper"},null===(v=null==ve?void 0:ve.slice(0,le))||void 0===v?void 0:v.map((function(e){return o.createElement(wt,{key:e.id,comment:e,type:"reply",className:"comment-reply-item",level:T+1,replyingId:U,onPostCommentSuccess:ue,post:_,onDeleteComment:function(){V((function(t){return n(n({},t),{replies:t.replies.filter((function(t){return t.id!==e.id})),countReplies:t.countReplies-1})}))},handleMakeAppointment:j,hasQuickBookingEnable:S})})),ge>le&&o.createElement(o.Fragment,null,o.createElement(g,{className:"top-divider",type:"solid"}),o.createElement(m,{className:"more-cmt",size:"lg",color:"ghost",onClick:function(){return se((function(e){return e+4}))}},O("comment.seeMoreReplies",{count:ge-le}),o.createElement("img",{className:"chevron-right",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12L10 8L6 4' stroke='%232D87F3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e"})))):null):null,be&&o.createElement(ft,{onDeleteComment:P,className:"popover",commentId:z.id})))},kt="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='%23595959' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",Ct="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",yt="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 5.33337C13.1046 5.33337 14 4.43794 14 3.33337C14 2.2288 13.1046 1.33337 12 1.33337C10.8954 1.33337 10 2.2288 10 3.33337C10 4.43794 10.8954 5.33337 12 5.33337Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4 10C5.10457 10 6 9.10457 6 8C6 6.89543 5.10457 6 4 6C2.89543 6 2 6.89543 2 8C2 9.10457 2.89543 10 4 10Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M12 14.6666C13.1046 14.6666 14 13.7712 14 12.6666C14 11.5621 13.1046 10.6666 12 10.6666C10.8954 10.6666 10 11.5621 10 12.6666C10 13.7712 10.8954 14.6666 12 14.6666Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.72668 9.00665L10.28 11.66' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M10.2734 4.33997L5.72668 6.9933' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",Et=function(n){var i=n.authorEmail,l=n.onDeletePost,s=n.shareUrl,c=n.post,u=n.className,d=void 0===u?"":u,m=n.popoverClassName,p=void 0===m?"":m,v=n.onBookmark,g=n.onRemoveBookmark,f=n.onEditPost,w=a(E),k=w.data,C=k.locale,y=k.userInfo,b=k.togetherUserId,N=k.env.isMarryBaby,I=w.action.pushNotifications,M=h().t,_=r(!1),L=_[0],S=_[1],j=r(!1),B=j[0],F=j[1],R=r(!1),D=R[0],O=R[1],A=te().authActionWrapper,z=i&&(null==y?void 0:y.email)&&i===String(null==y?void 0:y.email);return o.createElement("div",{className:d,onClick:function(e){e.preventDefault(),e.stopPropagation()}},D&&o.createElement(be,{url:s,text:null==c?void 0:c.title,onClose:function(){return O(!1)}}),B&&o.createElement(qe,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:M("popup.deletePost.title"),description:M("popup.deletePost.description"),acceptText:M("popup.deletePost.accept"),cancelText:M("popup.deletePost.cancel"),onAccept:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!(null==c?void 0:c.id)||L)return[2];S(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,ze({id:c.id,locale:C})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(null==l||l()),[3,4];case 3:return t.sent(),[3,4];case 4:return S(!1),[2]}}))}))},onClose:function(){return F(!1)}}),o.createElement(ge,{className:p,toggleButtonContent:o.createElement("img",{src:N?vt:gt}),position:"bottom",align:"end",buttonProps:{isLoading:L},data:z?{isShowheader:!1,type:"list",list:[{icon:yt,label:M("morePopover.share"),onClick:function(){return O(!0)}},{icon:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.16952 3.2356H2.99484C2.6785 3.2356 2.37512 3.36126 2.15143 3.58495C1.92774 3.80863 1.80208 4.11202 1.80208 4.42836V12.7777C1.80208 13.094 1.92774 13.3974 2.15143 13.6211C2.37512 13.8448 2.6785 13.9705 2.99484 13.9705H11.3442C11.6605 13.9705 11.9639 13.8448 12.1876 13.6211C12.4113 13.3974 12.537 13.094 12.537 12.7777V8.60303' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M11.6425 2.341C11.8798 2.10375 12.2016 1.97046 12.5371 1.97046C12.8726 1.97046 13.1944 2.10375 13.4317 2.341C13.6689 2.57826 13.8022 2.90005 13.8022 3.23558C13.8022 3.57111 13.6689 3.89289 13.4317 4.13015L7.76607 9.79578L5.38054 10.3922L5.97692 8.00663L11.6425 2.341Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",label:M("actionPopover.edit"),onClick:f},{icon:ht,label:M("actionPopover.delete"),onClick:function(){A((function(){return F(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:yt,label:M("morePopover.share"),onClick:function(){return O(!0)}},{icon:(null==c?void 0:c.bookmarked)?kt:Ct,label:(null==c?void 0:c.bookmarked)?M("morePopover.unsavePost"):M("morePopover.savePost"),onClick:function(){A((function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(null==y?void 0:y.id)&&(null==c?void 0:c.id)?(null==c?void 0:c.bookmarked)?[4,P(T(x.BOOKMARK.DELETE,{_locale:C}),"DELETE",{data:{post_id:String(c.id)}})]:[3,2]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(I({title:"",message:"Removed saved post",type:"success",displayIcon:Ct}),g&&g()):I({title:"",message:"Remove failed",type:"danger",displayIcon:Ct}),[3,4];case 2:return[4,P(T(x.BOOKMARK.CREATE,{_locale:C}),"POST",{data:{user_id:b||y.id,post_id:c.id}})];case 3:1===(null==(e=t.sent())?void 0:e.status)?(I({title:"",message:"Post saved",type:"success",displayIcon:kt}),v&&v()):I({title:"",message:"Post saved failed",type:"danger",displayIcon:Ct}),t.label=4;case 4:return[2]}}))}))}))}},{icon:rt,label:M("morePopover.report"),subTree:{title:M("morePopover.report.title"),description:M("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(Ne).map((function(e){return{label:Ne[e].label,reason:Ne[e].reportReasonText,reasonValue:e}})).map((function(e){return{label:M(e.label),subTree:{title:M("morePopover.reportSubmit.title"),description:M("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:function(t){return o.createElement(lt,{reason:e.reasonValue,reasonText:M(e.reason),postId:null==c?void 0:c.id,onClose:function(){return t&&t(!1)}})}}}}))}}]}}))},bt=function(n,i){return e(void 0,void 0,void 0,(function(){var e,o,a,r;return t(this,(function(t){switch(t.label){case 0:return[4,Me(T(x.COMMENT.LIST,{postId:n,_locale:i,sort:"popularity",perPage:1,withoutReply:1}),"GET")];case 1:return e=t.sent(),[2,null===(r=null===(a=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.comments)||void 0===a?void 0:a.map(q))||void 0===r?void 0:r[0]]}}))}))},Nt=function(i){var l=i.className,c=i.style,u=i.hideViewMoreComment,p=i.showMostEngaging,v=i.onCommentClick,g=i.onCommentCountClick,f=i.onMostEngagingCommentClick,w=i.onPostCommentSuccess,C=i.disableCardLink,y=i.disableShortenContent,b=i.onDeletePost,T=i.onEditPost,x=i.post,M=i.mostEngagingComment,_=i.onDeleteComment,P=i.showInputComment,L=i.InlineCommentsComponent,S=i.hasQuickBookingEnable,j=i.handleMakeAppointment,B=r(x),F=B[0],R=B[1],D=r(!1),O=D[0],A=D[1],z=r(M),V=z[0],U=z[1],H=F.community,W=F.topics,Z=F.author,G=F.slug,K=F.isPin,Q=F.liked,X=F.scheduleDateTime,J=F.createdAt,Y=F.photos,$=F.mentions,q=F.title,ee=F.description,ne=F.previewUrl,ie=F.likesCount,oe=F.commentsCount,ae=F.id,re=F.commented,le=a(E),se=le.data,ce=se.locale,ue=se.env,de=ue.isMarryBaby,me=ue.togetherBasePath,pe=le.action.pushNotifications,ve=h().t,ge=r(P),fe=ge[0],Ne=ge[1],Me="".concat(me,"/").concat((null==H?void 0:H.slug)||"_","/").concat(G||""),_e="".concat(Ie(ce)).concat(Me),Pe=te((null==H?void 0:H.slug)?{_joinCommunityIds:[H.id],_joinTopicIds:null==W?void 0:W.map((function(e){return e.id}))}:void 0).authActionWrapper,Le=r(!1),Se=Le[0],je=Le[1];s((function(){Ne(P)}),[P]);var Oe=(null==Z?void 0:Z.name)||(null==Z?void 0:Z.username)||"",ze=(null==Z?void 0:Z.username)||(null==Z?void 0:Z.name)||"",Ve=null==Z?void 0:Z.avatar,Ue=r(null),He=Ue[0],We=Ue[1],Ze=r(null),Ge=Ze[0],Ke=Ze[1];s((function(){if(null==Z?void 0:Z.hospitalId){n=Z.hospitalId,e(void 0,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,I(ye(Ee.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:xe[ce]}),"get")];case 1:return e=t.sent(),(null===(i=null==e?void 0:e._data)||void 0===i?void 0:i.branch)&&We(null==e?void 0:e._data.branch),[2]}}))}))}var n,i;if(null==Z?void 0:Z.doctorId){i=Z.doctorId,e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,I(ye(Ee.GET_DOCTOR_INFO,{doctorId:i,website_url:xe[ce]}),"get")];case 1:return e=t.sent(),(null===(n=null==e?void 0:e._data)||void 0===n?void 0:n.doctor)&&Ke(null==e?void 0:e._data.doctor),[2]}}))}))}}),[Z.hospitalId,Z.doctorId]);var Qe=(null==Ge?void 0:Ge.valid_outpatient)||(null==Ge?void 0:Ge.valid_telemedicine),Xe=((null==He?void 0:He.total_available_service)||(null==He?void 0:He.total_available_doctor))>0,Je=S&&(Qe||Xe);s((function(){e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return ae&&oe&&p&&!(null==M?void 0:M.id)?[4,bt(ae,ce)]:[3,2];case 1:e=t.sent(),U(e),t.label=2;case 2:return[2]}}))}))}),[ae,ce,oe,p,null==M?void 0:M.id]),s((function(){U(M)}),[null==M?void 0:M.id]);var Ye=function(i){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return oe>1&&(null==V?void 0:V.id)&&(null==V?void 0:V.id)===(null==i?void 0:i.id)?[4,bt(ae,ce)]:[3,2];case 1:e=t.sent(),U(e),t.label=2;case 2:return R((function(e){return n(n({},e),{commentsCount:e.commentsCount-1})})),_&&_(i),[2]}}))}))};return o.createElement(he,{defaultParams:(null==H?void 0:H.slug)?{_joinCommunityIds:[H.id],_joinTopicIds:null==W?void 0:W.map((function(e){return e.id}))}:void 0},O&&o.createElement(be,{url:_e,avatar:N,text:q,onClose:function(){return A(!1)}}),o.createElement(Te,{className:l,style:c,"data-is-marrybaby":de},K?o.createElement(Re,{className:"post-pin"}):null,o.createElement("div",{style:{position:"relative"}},o.createElement(we,{avatar:Ve,name:Oe,username:ze,url:C?void 0:Me,email:null==Z?void 0:Z.email,time:X||J,community:H,className:"post-author",role:null==Z?void 0:Z.role,userId:null==Z?void 0:Z.id,expertId:null==Z?void 0:Z.partnerId,doctorId:null==Z?void 0:Z.doctorId,hospitalId:null==Z?void 0:Z.hospitalId,title:null==Z?void 0:Z.title,hasQuickBooking:Je,handleMakeAppointment:j}),o.createElement(Et,{authorEmail:String(null==Z?void 0:Z.email),onDeletePost:b,shareUrl:_e,post:F,className:"popover",onEditPost:T})),o.createElement("a",{href:C?void 0:Me,className:"post-content-link-wrapper"},q&&o.createElement(d,{className:"post-content-title",as:"h1",tag:"h5",fontWeight:"bold"},k(q)),o.createElement(st,{className:"post-content-wrapper",description:ee,disableShortenContent:y,mentions:$})),o.createElement("span",null),o.createElement("span",null),o.createElement("div",{key:"tag-topic"},W&&W.length>0?o.createElement(Fe,{topics:W,className:"post-topics"}):null),o.createElement("div",{key:"social-preview"},(null==F?void 0:F.introUrl)?o.createElement("div",{className:"social-preview-wrapper ".concat((null==Y?void 0:Y.length)?"has-image":"")},o.createElement(pt,{url:F.introUrl,image:F.bannerImage})):null),o.createElement("div",{key:"image-preview"},(null==Y?void 0:Y.length)?o.createElement("div",{className:"image-preview-wrapper"},o.createElement(mt,{images:Y,authorName:null==Z?void 0:Z.name})):null),o.createElement("div",{key:"link-preview"},(null==F?void 0:F.introUrl)||(null==Y?void 0:Y.length)||!(null==ne?void 0:ne.url)?null:o.createElement("div",{className:"link-preview-wrapper"},o.createElement(Be,{title:ne.title,url:ne.url,image:ne.image}))),o.createElement(ke,{type:Ce.post,loveCount:ie,replyCount:oe,className:"post-reaction ".concat((null==Y?void 0:Y.length)||(null==ne?void 0:ne.url)?"hide-top-border":""),liked:Se?!Q:Q,isReplied:re,onCommentClick:function(){return Pe((function(){v?v():Ne((function(e){return!e}))}))},onCommentCountClick:function(){Pe((function(){de?Ne(!0):g?g():!C&&(window.location.href=Me)}))},onShareClick:function(){A(!0)},onLikeClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!ae||Se)return[2];je(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Ae({id:ae,locale:ce})];case 2:return 1!==(null==(e=t.sent())?void 0:e.status)?pe(De(ve)):R((function(e){return n(n({},e),{likesCount:(e.likesCount||0)+(e.liked?-1:1),liked:!e.liked})})),[3,4];case 3:return t.sent(),pe(De(ve)),[3,4];case 4:return je(!1),[2]}}))}))},showingMostEngaging:!(!p||!(null==V?void 0:V.id))}),fe&&o.createElement(at,{isMainCmt:!P,onClose:function(){return Ne(!1)},onPostSuccess:function(e){0!==oe||(null==V?void 0:V.id)||U(e),R((function(e){return n(n({},e),{commentsCount:e.commentsCount+1,commented:!0})})),w&&w(e)},post:F}),p&&(null==V?void 0:V.id)?o.createElement("div",{className:"most-engaging-wrapper",onClick:function(e){f?(e.stopPropagation(),f()):window.location.href=Me}},o.createElement(wt,{hasQuickBookingEnable:S,handleMakeAppointment:j,comment:V,onDeleteComment:function(){Ye&&Ye(V)},className:"most-engaging-comment",type:"most-engaging",key:V.id}),oe>1&&!u&&o.createElement(m,{className:"see-more-comments",color:"ghost",size:"md"},ve("comment.seeMoreComments",{count:oe-1}))):null,L))},It=Object.freeze({__proto__:null});export{Be as C,at as I,Re as L,qe as P,lt as S,Fe as T,$e as a,Ke as b,Xe as c,Je as d,st as e,ct as f,dt as g,mt as h,Nt as i,Et as j,wt as k,ft as l,It as t};
|
|
1
|
+
import{_ as e,a as t,b as n,c as i}from"./tslib.es6-6ae0d506.js";import o,{useContext as a,useState as r,useRef as l,useEffect as s,useMemo as c,useCallback as u}from"react";import{H as d,B as m}from"./index-8bf9dbb9.js";import{T as p}from"./index.styled-cc25a3f7.js";import{a as v,D as g}from"./index-2c513d0f.js";import{u as h,t as f,k as w}from"./useTranslations-d2f104c4.js";import k from"innertext";import{t as C,d as y}from"./theme-886d0d2f.js";import{m as E,z as b,B as N,E as I,F as T,H as x,I as M,b as _,J as P,M as L,K as S,N as j,O as B,Q as F,R,V as D,L as O,W as A,X as z,Y as V,Z as U,_ as H,$ as W,a0 as Z,y as G,a1 as K,j as Q,a2 as X,a3 as J,U as Y,a4 as $,a5 as q,a6 as ee,u as te,g as ne,a7 as ie,a8 as oe,a9 as ae,aa as re,ab as le,ac as se,ad as ce,ae as ue,af as de,ag as me,ah as pe,ai as ve,aj as ge,a as he,ak as fe,f as we,C as ke,al as Ce,am as ye,an as Ee,S as be,ao as Ne,o as Ie,ap as Te,aq as xe,ar as Me}from"./index.styled-b819aba0.js";import"react-range";import*as _e from"react-dom";import{I as Pe}from"./index-d08fffaf.js";import Le from"lodash/debounce";import Se from"react-contenteditable";import{l as je}from"./lazyLoad-59e8ff6d.js";import"date-fns";import"styled-components";var Be=function(i){var c=i.title,u=i.url,m=i.image,v=i.logo,g=i.className,h=i.style,f=i.noRefetch,w=a(E).data,k=w.locale,C=w.env.isMarryBaby,y=r(!1),M=y[0],_=y[1],P=l(f);P.current=f;var L=r(null),S=L[0],j=L[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return P.current?[2]:u?(j((function(e){return n(n({},e),{isFetching:!0})})),I(T(x.FETCH_PREVIEW,{_locale:k}),"POST",{data:{link:u}}).then((function(e){var t,n,i;_(!1),j({title:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.title,url:u,image:(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.image)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.logo)})})).catch((function(){j(null)})),[2]):[2,j(null)]}))}))}),[u]);var B=(null==S?void 0:S.image)||m,F=(null==S?void 0:S.title)||c,R=(null==S?void 0:S.logo)||v,D=(null==S?void 0:S.url)||u,O=D.replace("http://","").replace("https://","").split(/[/?#]/)[0],A=l(!1);return o.createElement(b,{"data-is-marrybaby":C,className:"".concat(g," no-replace-click"),style:h},o.createElement("a",{href:D,target:"_blank",rel:"noreferrer"},B&&o.createElement("div",{className:"link-image-wrapper"},!C&&o.createElement("img",{className:"link-image-blur",src:B,onError:function(e){A.current||(A.current=!0,e.currentTarget.src=N)}}),o.createElement("img",{className:"link-image",src:B,onError:function(e){A.current||(A.current=!0,e.currentTarget.src=N)}})),o.createElement("div",{className:"link-info-container"},o.createElement(p,{size:"n1"},C&&R&&!M&&o.createElement("img",{className:"link-logo",src:R,onError:function(e){return _(!0)}}),O),o.createElement(d,{tag:"h6"},F))))},Fe=function(e){var t=e.topics,n=e.onClick,i=e.className,s=e.style,c=function(){var e=r(!1),t=e[0],n=e[1],i=l(null),o=l(null),a=l();return{sliding:t,mouseDownHandler:function(e){if(i.current){a.current=setTimeout((function(){n(!0)}),500),o.current={left:i.current.scrollLeft,x:e.clientX};var t=function(e){var t=o.current;if(t){var n=e.clientX-t.x;i.current&&(i.current.scrollLeft=t.left-n)}},r=function(){a.current&&(clearTimeout(a.current),a.current=void 0),n(!1),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)}},sliderRef:i,pos:o}}(),u=c.sliding,d=c.mouseDownHandler,m=c.sliderRef,v=a(E),g=v.data.env.togetherBasePath,h=v.action.sanitizeFunction;return o.createElement(M,{ref:m,onClick:n,onMouseDown:function(e){return d(e)},className:"".concat(i," ").concat(u?"sliding":""),style:s},t.map((function(e,t){return o.createElement("a",{className:"tag-link-item",key:t,href:e.isActive&&!e.isHidden?"".concat(g).concat(e.url):void 0},o.createElement(p,{size:"p3"},o.createElement("span",{dangerouslySetInnerHTML:{__html:(null==h?void 0:h(e.name))||e.name}})))})))},Re=function(e){var t=e.onClick;e.color;var n=e.className,i=e.style,r=a(E).data.env.isMarryBaby,l=h().t;return o.createElement(_,{label:o.createElement(o.Fragment,null,r&&o.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M3.5 19.9999L7.87 15.6299' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.95634 11.294C4.56534 11.685 4.56534 12.318 4.95634 12.708L7.87434 15.626L10.7923 18.544C11.1833 18.935 11.8163 18.935 12.2063 18.544L13.3813 17.369C13.5693 17.181 13.6743 16.927 13.6743 16.662V12.726L16.5743 9.82597L18.8833 9.94897C19.1663 9.96397 19.4433 9.85797 19.6433 9.65797L20.2173 9.08397C20.6083 8.69297 20.6083 8.05997 20.2173 7.66997L15.8313 3.28397C15.4403 2.89297 14.8073 2.89297 14.4173 3.28397L13.8433 3.85797C13.6423 4.05897 13.5363 4.33497 13.5523 4.61797L13.6753 6.92697L10.7753 9.82697H6.83834C6.57334 9.82697 6.31834 9.93197 6.13134 10.12L4.95634 11.294V11.294Z' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath d='M16.5699 9.83018L13.6699 6.93018' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3c/svg%3e"})," ",l("label.pinnedPost")),rightLabel:!r&&o.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cline x1='7.18605' y1='7.68219' x2='3.68219' y2='13.8139' stroke='%23FEA21E' stroke-linecap='round'/%3e%3cpath d='M3.24591 7.78426C3.21275 7.84168 3.20376 7.90993 3.22092 7.97398C3.23808 8.03803 3.27998 8.09264 3.3374 8.12579L8.78429 11.2706C8.90385 11.3396 9.05674 11.2986 9.12578 11.1791C9.71191 10.1641 9.71348 8.97262 9.23682 7.99339L10.8583 5.18521C11.5115 5.00603 12.0982 4.57973 12.4638 3.94629C12.5328 3.82672 12.4919 3.67383 12.3723 3.6048L8.18237 1.18584C8.12494 1.15268 8.0567 1.1437 7.99265 1.16086C7.92861 1.17803 7.874 1.21993 7.84086 1.27736C7.47521 1.91077 7.39934 2.63194 7.57065 3.28723L5.94919 6.09545C4.86323 6.1723 3.83201 6.76934 3.24591 7.78426Z' fill='%23FEA21E' stroke='%23FEA21E' stroke-width='0.5' stroke-linejoin='round'/%3e%3c/svg%3e"}),onClick:t,color:"white",className:"label-pinned ".concat(n),style:i})},De=function(e){return{message:e("notification.failure"),type:"danger"}},Oe="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%23FE921D'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",Ae=function(n){var i=n.id,o=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return i?[4,P(T(x.POST.LIKE,{id:i,_locale:o}),"GET")]:[2];case 1:return[2,e.sent()]}}))}))},ze=function(n){var i=n.id,o=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return i?[4,P(T(x.POST.DELETE,{id:i,_locale:o}),"DELETE")]:[2];case 1:return[2,e.sent()]}}))}))},Ve=function(n){var i=n.title,o=n.description,a=n.communityId,r=n.imageFiles,l=n.previewUrl,s=n.topicIds,c=n.locale,u=n.sanitizeFunction,d=n.categoryCommunityId,m=n.categoryTopicIds,p=n.introUrl,v=n.bannerUrl,g=n.scheduleTime;return e(void 0,void 0,void 0,(function(){var e,n,h,f,w;return t(this,(function(t){switch(t.label){case 0:return e=new FormData,n=S(o),h=S(i),f=j(n),e.append("title",h),e.append("description",B(n,u)),d?e.append("category_community",String(d)):a&&e.append("community_id",String(a)),(null==l?void 0:l.title)&&e.append("preview_title",l.title),(null==l?void 0:l.description)&&e.append("preview_description",l.description),(null==l?void 0:l.url)&&e.append("preview_link",l.url),(null==l?void 0:l.image)&&e.append("preview_image",l.image),null==s||s.forEach((function(t){e.append("topics[]",String(t||""))})),null==m||m.forEach((function(t){e.append("category_topics[]",String(t||""))})),(null==r?void 0:r.length)?[4,Promise.all(r.map((function(e,t){return new Promise((function(n){setTimeout((function(){n(F(e,c))}),2e3*t)}))})))]:[3,2];case 1:return null==(w=t.sent())||w.filter(Boolean).slice(0,L).forEach((function(t,n){e.append("images[".concat(n,"]"),t)})),[3,3];case 2:e.append("images",""),t.label=3;case 3:return null==f||f.forEach((function(t){e.append("mention_ids[]",t)})),e.append("intro_url",p||""),e.append("banner",v||""),g&&(e.append("post_type","scheduled"),e.append("schedule_datetime",g)),[2,e]}}))}))},Ue=function(n){var i=n.locale,o=n.formData,a=n.isArticleComment;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,P(T(a?x.POST.CREATE_ARTICLE_COMMENT:x.POST.CREATE,{_locale:i}),"POST",{data:o,headers:{"Content-Type":"multipart/form-data"}})];case 1:return[2,e.sent()]}}))}))},He=function(n){var i=n.id,o=n.locale,a=n.formData;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,P(T(x.POST.UPDATE,{id:i,_locale:o}),"POST",{data:a})];case 1:return[2,e.sent()]}}))}))},We=function(e){var t=e.id,n=e.reason,i=e.locale,o=new FormData;return o.append("reason",n),P(T(x.POST.REPORT,{_locale:i,id:t}),"POST",{data:o})},Ze=function(e,t){var n=r(e||[]),i=n[0],o=n[1];return{onSelectImages:function(n){var a=n.target.files;a&&(t&&e?t((e||i).concat(Array.from(a))):o((function(n){var i=e||n;return t&&t(i.concat(Array.from(a))),i.concat(Array.from(a))})))},onRemoveImage:function(n){if(t&&e){var i=e;i.splice(n,1),t(i.slice())}else o((function(i){var o=e||i;return o.splice(n,1),t&&t(o.slice()),o.slice()}))},onRemoveAllImages:function(){t?t([]):o([])},imageSrcs:c((function(){return(e||i).map((function(e){return"string"==typeof e?e:URL.createObjectURL(e)}))}),[e,i]),imageFiles:e||i}},Ge="data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 22.9844C17.5228 22.9844 22 18.5072 22 12.9844C22 7.46153 17.5228 2.98438 12 2.98438C6.47715 2.98438 2 7.46153 2 12.9844C2 18.5072 6.47715 22.9844 12 22.9844Z' fill='%23262626'/%3e%3cpath d='M14.8281 10.1562L9.17127 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.17188 10.1562L14.8287 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",Ke=function(e){var t=e.className,n=e.style,i=e.bannedWords,a=void 0===i?[]:i,c=e.value,u=e.onChange,d=e.onPreviewUrlChange,m=e.onInvalidUrlsChange,v=e.onImageFilesChange,g=e.imageFiles,f=e.isReplying,w=h().t,y=r(null),E=y[0],b=y[1],N=l(null),I=Ze(g,v),T=I.onSelectImages,x=I.onRemoveImage,M=I.imageSrcs;return s((function(){d&&((null==E?void 0:E.url)?d({title:E.title||"",url:E.url||"",image:E.image||"",description:E.description||""}):d(null))}),[E]),o.createElement(R,{className:t,style:n},o.createElement(p,{size:"p4",className:"description-label"},w("createPost.popup.description")),o.createElement("div",{className:"textarea-control"},o.createElement("div",{className:"textarea-wrapper"},o.createElement(D,{html:c||"",onChange:u,bannedWords:a,onImagePickerClick:function(){var e;return null===(e=N.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:b,onInvalidUrlsChange:m,isReplying:f}))),o.createElement(p,{size:"p4",className:"count-string"},w("character"),": ",k(c||"").length),(!M||0===M.length)&&E&&o.createElement("div",{className:"link-preview-wrapper"},E.isFetching?o.createElement(O,null):o.createElement(o.Fragment,null,o.createElement(Be,{title:E.title,url:E.url||"#",image:E.image,noRefetch:!0}),o.createElement("img",{src:Ge,className:"icon-close",onClick:function(){return b(null)}}))),o.createElement("input",{ref:N,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:T}),M.length>L?o.createElement("div",{className:"input-notification"},o.createElement("img",{src:Oe}),o.createElement(p,{size:"p4",color:C.colors.alertWarning},w("createPost.popup.warningImage"))):null,M.length>0&&o.createElement("div",{className:"image-gallery"},M.map((function(e,t){return o.createElement("div",{key:t,className:"image-item"},o.createElement("img",{src:e}),o.createElement("img",{className:"close-btn",src:Ge,onClick:function(){return x(t)}}))}))))},Qe=function(e,t){if(!t)return e;var n=t.limit,i=t.bannedWords,o=void 0===i?[]:i,a="number"==typeof n&&n>=0?e.substring(0,n):e;return A(a,o)},Xe=function(e){var t,n=e.className,i=e.style,a=e.bannedWords,c=void 0===a?[]:a,d=e.value,m=e.onChange,v=h().t,g=r(""),f=g[0],w=g[1],k=l(null);s((function(){if(k.current){var e=function(e){var t;e.preventDefault();var n=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,n)},t=k.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[k]);var C=(null==c?void 0:c.join(","))||"";s((function(){var e;if(C){var t=null===(e=k.current)||void 0===e?void 0:e.innerText;if(t){var n=A(t,c);n!==t&&(m&&m(n),w(n))}}}),[C]);var y=u(Le((function(e){if(k.current){var t=Qe(k.current.innerText,{limit:120,bannedWords:c});m&&m(t),w(t)}}),300),[]);return s((function(){setTimeout((function(){var e;null===(e=k.current)||void 0===e||e.focus()}),500)}),[]),o.createElement(z,{className:n,style:i},o.createElement(Pe,{name:"title",value:d||f,size:"md",label:v("createPost.title"),CustomInput:o.createElement(Se,{innerRef:k,html:d||f,onChange:function(e){if(k.current&&k.current.innerText!==(d||f)){var t=Qe(k.current.innerText,{bannedWords:c});m&&m(t),w(t),y(k.current.innerText)}},className:"title-input"})}),o.createElement(p,{size:"p4",className:"count-string"},v("createPost.popup.wordCount",{count:(null===(t=k.current)||void 0===t?void 0:t.innerText.length)||0,max:120})))},Je=function(n){var u=n.className,d=n.style,m=n.topics,p=n.communityId,v=n.onChange,g=n.isLoading,h=n.disabled,f=n.forceTopics,w=n.selectedTopics,k=n.noFetch,C=a(E).data,y=C.locale,b=C.env.isMarryBaby,N=r(m?i([],m,!0):[]),M=N[0],_=N[1],P=r(w?i([],w,!0):[]),L=P[0],S=P[1],j=r(!1),B=j[0],F=j[1],R=l(m);R.current=m,s((function(){var n;!p||k||(null===(n=R.current)||void 0===n?void 0:n.length)||(_([]),F(!0),e(void 0,void 0,void 0,(function(){var e,n,i,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,I(T(x.TOPIC.LIST,{communityId:p,_locale:y}),"GET")];case 1:return e=t.sent(),n=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.topics,Array.isArray(n)&&_((function(){return(null==n?void 0:n.map(U).sort((function(e,t){return(e.order||0)-(t.order||0)})))||[]})),[3,3];case 2:return i=t.sent(),console.log(i),F(!1),[3,3];case 3:return F(!1),[2]}}))})))}),[p,k]);var D=null==m?void 0:m.map((function(e){return e.id})).join("-"),A=null==M?void 0:M.map((function(e){return e.id})).join("-"),z=null==f?void 0:f.map((function(e){return e.id})).join("-");s((function(){m&&void 0!==D&&D!==A&&_(m)}),[m,D,A]);var H=c((function(){return M.filter((function(e){return!(null==f?void 0:f.some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})))}))}),[A,z]);return o.createElement(V,{"data-is-marrybaby":b,className:u,style:d},f.map((function(e){return o.createElement(Ye,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:!0,selected:!0})})),H.map((function(e){return o.createElement(Ye,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:h,selected:(w||L).some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})),onClick:function(){var t=w||L,n=t.findIndex((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId}));-1!==n?t.splice(n,1):t.push(e),v&&w?v(t.slice()):(v&&v(t.slice()),S(t.slice()))}})})),(g||B)&&o.createElement(O,{className:"topic-spinner"}))},Ye=function(e){var t=e.topic,n=e.disabled,i=e.selected,a=e.onClick;return o.createElement("div",{className:"tag-item"+(i?" --active":""),"data-disabled":n,onClick:n?void 0:a},t.name)},$e=function(n){var l=n.className,c=n.style,u=n.onPostCreatedEdited,d=n.onClose,g=n.communities,f=void 0===g?[]:g,w=n.forceSelectCommunity,y=n.forceSelectTopics,b=n.articleId,N=n.optionalTopic,I=n.editPostData,T=n.defaultCommunity,x=n.defaultTopics,M=n.noFetchTopic,_=n.hideTopicList,P=!!(null==I?void 0:I.id),S=a(E),j=S.data,B=j.locale,F=j.env.isMarryBaby,R=S.action,D=R.pushNotifications,O=R.sanitizeFunction,A=h().t,z=r(!1),V=z[0],U=z[1],K=r(""),Q=K[0],X=K[1],J=r(""),Y=J[0],$=J[1],q=r(w?{label:w.name,value:"".concat(w.id||"","-").concat(w.mappedCategoryId||"")}:{label:A("community.choose"),value:""}),ee=q[0],te=q[1],ne=r(i([],y,!0)||[]),ie=ne[0],oe=ne[1],ae=r([]),re=ae[0],le=ae[1],se=r([]),ce=se[0],ue=se[1],de=w||f.find((function(e){return"".concat(e.id||"","-").concat(e.mappedCategoryId||"")===ee.value})),me=w?[w]:f.filter((function(e){return e.isActive})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),pe=r(null),ve=pe[0],ge=pe[1],he=r([]),fe=he[0],we=he[1],ke=Q&&k(Y)&&(N||!N&&ie.length>0)&&de&&(!re||re.length<=L)&&!(null==fe?void 0:fe.length)&&!V;s((function(){if(I){var e=I;X(e.title||""),$(H(W(e.description||"","edit"),e.mentions)),te({label:e.community.name,value:"".concat(e.community.id||"","-").concat(e.community.mappedCategoryId||"")}),oe(e.topics||[]),le(e.photos||[])}else T&&te({label:T.name,value:"".concat(T.id||"","-").concat(T.mappedCategoryId||"")}),x&&oe(x)}),[]);var Ce=function(){return e(void 0,void 0,void 0,(function(){var e,n,i,o,a,r,l,s,c,m,p,v;return t(this,(function(t){switch(t.label){case 0:return[4,Ve({title:Q,description:Y,communityId:String((null==de?void 0:de.id)||""),imageFiles:re,previewUrl:ve,topicIds:null==ie?void 0:ie.map((function(e){return String(e.id||"")})).filter(Boolean),locale:B,sanitizeFunction:O,categoryCommunityId:String((null==de?void 0:de.mappedCategoryId)||""),categoryTopicIds:null==ie?void 0:ie.map((function(e){return String(e.mappedCategoryId||"")})).filter(Boolean)})];case 1:return e=t.sent(),b&&e.append("article_id",b),P?(null==I?void 0:I.id)?[4,He({id:I.id,formData:e,locale:B})]:[3,3]:[3,4];case 2:n=t.sent(),t.label=3;case 3:return[3,6];case 4:return[4,Ue({formData:e,locale:B,isArticleComment:!(null==de?void 0:de.id)&&!!(null==de?void 0:de.mappedCategoryId)})];case 5:n=t.sent(),t.label=6;case 6:return(null==(i=null==n?void 0:n.data)?void 0:i.id)&&!(null===(a=null===(o=null==n?void 0:n.messages)||void 0===o?void 0:o.moderation)||void 0===a?void 0:a.type)?(D({message:A("createPost.popup.success"),type:"success"}),function(e){u&&u(G(e),P),d&&d()}(i)):"banned"===(null===(l=null===(r=null==n?void 0:n.messages)||void 0===r?void 0:r.moderation)||void 0===l?void 0:l.type)?(D({title:A("notification.post.blocked.title"),message:A("notification.post.blocked.message"),type:"danger"}),n.messages.moderation.words&&ue(n.messages.moderation.words)):"suspect"===(null===(c=null===(s=null==n?void 0:n.messages)||void 0===s?void 0:s.moderation)||void 0===c?void 0:c.type)?(D({title:A("notification.post.suspect.title"),message:A("notification.post.suspect.message"),type:"warning"}),d&&d()):(null===(p=null===(m=null==n?void 0:n.messages)||void 0===m?void 0:m.find)||void 0===p?void 0:p.call(m,(function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(D({message:A("notification.suspend.message"),type:"danger"}),d&&d()):D({message:(null===(v=null==n?void 0:n.messages)||void 0===v?void 0:v[0])||A("notification.failure"),type:"danger"}),[2]}}))}))};return o.createElement(Z,{className:l,style:c},o.createElement("div",{className:"input-group-container"},o.createElement(Xe,{className:"input-group",bannedWords:ce,value:Q,onChange:X}),o.createElement(Ke,{className:"input-group",bannedWords:ce,value:Y,onChange:$,onPreviewUrlChange:ge,onInvalidUrlsChange:we,onImageFilesChange:le,imageFiles:re}),o.createElement("div",{className:"input-group"},o.createElement(p,{size:"p4",className:"input-group-label"},A("admin.community")),o.createElement(v,{options:(null==me?void 0:me.map((function(e,t){return{label:e.name,value:"".concat(e.id||"","-").concat(e.mappedCategoryId||"")}})))||[],id:"community-picker",placeholder:A("community.choose"),value:ee,onChange:function(e){te({label:e.label,value:String(e.value)}),oe([])},disabled:!!w}),o.createElement(p,{size:"sm",className:"warning",color:C.colors.gray400},"* ",A("commentPopup.warning.newPost"))),!_&&o.createElement("div",{className:"input-group"},o.createElement(p,{size:"p4",className:"input-group-label"},A("tab.topic")),o.createElement("div",{className:"input-notification"},o.createElement("img",{src:de?"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%232D87F3'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e":Oe}),o.createElement(p,{size:"base",color:C.colors.gray500},A(de?"createPost.popup.primary":"createPost.popup.warning"))),de&&o.createElement(Je,{className:"tag-list",communityId:de.id,forceTopics:y,onChange:oe,selectedTopics:ie,noFetch:M}))),o.createElement(m,{theme:F?"marryBaby":"helloSites",className:"submit-btn",size:"lg",onClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!ke||V)return[3,5];U(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Ce()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.error(e),D(De(A)),[3,4];case 4:U(!1),t.label=5;case 5:return[2]}}))}))},isDisabled:!ke,isLoading:V},A("createPost.popup.submit")))},qe=function(e){var t=e.className,n=e.isMarryBaby,i=e.style,l=e.title,c=e.description,u=e.acceptText,v=e.cancelText,g=e.onAccept,h=e.thumbnail,k=e.isThumbnailIcon,C=e.onClose,y=a(E).data.env.isMarryBaby,b="boolean"==typeof n?n:y,N=r(!1),I=N[0],T=N[1];return s((function(){return f(!0),setTimeout((function(){return T(!0)}),0),function(){return f(!1)}}),[]),_e.createPortal(o.createElement(K,{"data-is-marrybaby":b,className:t,style:i,"data-open":I},o.createElement(Q,{className:"popup-frame",isOpen:I,onClose:C},o.createElement("div",{className:"confirm-dialog",onClick:function(e){return e.stopPropagation()}},o.createElement("div",{className:"confirm-content"},h&&o.createElement("div",{className:"thumbnail-container ".concat(k?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:h})),o.createElement(d,{className:"title",tag:"h2"},l),o.createElement(p,{className:"desc",size:"lg"},c),o.createElement("div",{className:"btn-group"},o.createElement(m,{theme:b?"marryBaby":"helloSites",size:"md",color:"secondary",onClick:function(){null==g||g(),null==C||C()}},u),o.createElement(m,{theme:b?"marryBaby":"helloSites",size:"md",onClick:C},v)))),b&&h&&o.createElement("div",{className:"thumbnail-container is-mobile ".concat(k?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:h})))),w())},et=function(n){var i=n.postId,o=n.message,a=n.photos,r=n.link,l=n.locale,s=n.sanitizeFunction,c=n.replyingUserId,u=n.replyingUserName,d=n.replyingId;return e(void 0,void 0,void 0,(function(){var e,n,m;return t(this,(function(t){switch(t.label){case 0:return e=new FormData,n=B(o.replace(/(\ )+/g," "),s),m=j(n),a&&a.length>0?[4,Promise.all(null==a?void 0:a.map((function(e){return F(e,l)})))]:[3,2];case 1:t.sent().filter(Boolean).slice(0,L).forEach((function(t){e.append("images[]",t)})),t.label=2;case 2:return r&&e.append("link",r),null==m||m.forEach((function(t){e.append("mention_ids[]",t)})),e.append("post_id",i),d&&e.append("parent_id",d),c&&(m.unshift(c),n='[mention+id="'.concat(c,'"+name="').concat((u||"").replace('"',"'"),'"]').concat(n),e.append("parent_user_id",String(c))),e.append("content",n),e.append("content",n),[2,e]}}))}))},tt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,P(T(x.COMMENT.CREATE,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},nt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,P(T(x.COMMENT.REPLY,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},it=function(n){var i=n.commentId,o=n.setLike,a=void 0!==o&&o,r=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,P(T(a?x.COMMENT.LIKE:x.COMMENT.UNLIKE,{_locale:r,id:i}),"GET")]}))}))},ot=function(e){var t=e.id,n=e.locale;return P(T(x.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")},at=function(i){var c=i.isReply,u=i.className,d=i.onClose,v=i.replyToName,g=i.style,f=i.replyingId,w=i.replyingUser,k=i.onPostSuccess;i.isMainCmt;var C=i.post,y=i.isMarryBaby,b=a(E),N=b.action,I=N.pushNotifications,T=N.sanitizeFunction,x=b.data,M=x.userInfo,_=x.locale,P=x.env.isMarryBaby,L="boolean"==typeof y?y:P,S=h().t,j=Ze(),B=j.onSelectImages,F=j.onRemoveImage,R=j.imageSrcs,A=j.onRemoveAllImages,z=j.imageFiles,V=r(""),U=V[0],H=V[1],W=a(X).trigger,Z=r(!1),G=Z[0],K=Z[1],Q=l(null),ee=l(null),te=l(null),ne=r([]),ie=ne[0],oe=ne[1],ae=r([]),re=ae[0],le=ae[1],se=r(null),ce=se[0],ue=se[1];return s((function(){var e;null===(e=te.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout((function(){var e;null===(e=ee.current)||void 0===e||e.focus()}),400)}),[W]),o.createElement(J,{"data-is-reply":c,className:u,style:g},c&&o.createElement("div",{className:"reply-to-container"},o.createElement(p,{size:"p4"},o.createElement("span",{dangerouslySetInnerHTML:{__html:S("inputComment.replyTo",{name:'<span style="color: #2D87F3; cursor: pointer">@'.concat(v||"","</span>")})}})),o.createElement("img",{src:"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8.00016' cy='8.50004' r='6.66667' fill='white' stroke='%23404040'/%3e%3cpath d='M10 6.5L6 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6 6.5L10 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-close-comment",onClick:function(){return d&&d()}})),o.createElement("div",{className:"input-container",ref:te},o.createElement(Y,{className:"avatar-wrapper ".concat(c?"avatar-wrapper-reply":""),avatar:(null==M?void 0:M.id)?M.avatar:$,username:(null==M?void 0:M.name)||(null==M?void 0:M.username)}),o.createElement("input",{ref:Q,onChange:B,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),o.createElement(Pe,{value:U,name:"input",size:"md",className:"input-wrapper",displayIcon:o.createElement("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.7543 4.85352H4.49227C4.01776 4.85352 3.56268 5.04201 3.22715 5.37754C2.89162 5.71307 2.70313 6.16815 2.70312 6.64266V19.1667C2.70313 19.6412 2.89162 20.0963 3.22715 20.4318C3.56268 20.7673 4.01776 20.9558 4.49227 20.9558H17.0163C17.4908 20.9558 17.9459 20.7673 18.2814 20.4318C18.6169 20.0963 18.8054 19.6412 18.8054 19.1667V12.9047' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M17.4633 3.51187C17.8192 3.15599 18.3019 2.95605 18.8052 2.95605C19.3085 2.95605 19.7912 3.15599 20.147 3.51187C20.5029 3.86775 20.7029 4.35044 20.7029 4.85373C20.7029 5.35702 20.5029 5.83971 20.147 6.19559L11.6486 14.694L8.07031 15.5886L8.96489 12.0103L17.4633 3.51187Z' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e"}),CustomInput:o.createElement("div",{className:"as-input"},o.createElement(D,{className:"textarea",html:U,onChange:H,onImagePickerClick:function(){var e;return null===(e=Q.current)||void 0===e?void 0:e.click()},bannedWords:re,onPreviewUrlChange:ue,onInvalidUrlsChange:oe,setEditorRef:function(e){return ee.current=e},isReplying:c}))}),o.createElement(m,{theme:L?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:function(){return e(void 0,void 0,void 0,(function(){var e,i,o,a,r,l,s,u,m,p,v,g,h;return t(this,(function(t){switch(t.label){case 0:if(!(null==C?void 0:C.id)||G)return[2];K(!0),t.label=1;case 1:return t.trys.push([1,4,,5]),e=function(e){H(""),A(),d&&d();var t=q(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),k&&k(t)},[4,et(n({message:U,photos:z,postId:String(C.id),link:null==ce?void 0:ce.url,sanitizeFunction:T,locale:_},c&&f?{replyingUserId:String((null==w?void 0:w.id)||(null===(r=null==C?void 0:C.author)||void 0===r?void 0:r.id)||""),replyingId:f,replyingUserName:(null==w?void 0:w.name)||(null==w?void 0:w.username)||""}:{}))];case 2:return i=t.sent(),[4,c&&f?nt(i,_):tt(i,_)];case 3:return o=t.sent(),(null==(a=null==o?void 0:o.data)?void 0:a.id)&&!(null===(s=null===(l=null==o?void 0:o.messages)||void 0===l?void 0:l.moderation)||void 0===s?void 0:s.type)?e(o):"banned"===(null===(m=null===(u=null==o?void 0:o.messages)||void 0===u?void 0:u.moderation)||void 0===m?void 0:m.type)?(I({title:S("notification.comment.blocked.title"),message:S("notification.comment.blocked.message"),type:"danger"}),o.messages.moderation.words&&le(o.messages.moderation.words)):"suspect"===(null===(v=null===(p=null==o?void 0:o.messages)||void 0===p?void 0:p.moderation)||void 0===v?void 0:v.type)?(I({title:S("notification.comment.suspect.title"),message:S("notification.comment.suspect.message"),type:"warning"}),H(""),A(),d&&d()):(null===(g=null==o?void 0:o.messages)||void 0===g?void 0:g.find((function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(I({message:S("notification.suspend.message"),type:"warning"}),H(""),A(),d&&d()):I({title:"",message:(null===(h=null==o?void 0:o.messages)||void 0===h?void 0:h[0])||S("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 4:return t.sent(),I({title:"",message:S("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 5:return K(!1),[2]}}))}))},isLoading:G,isDisabled:!!(null==ie?void 0:ie.length)||G||!U||(null==U?void 0:U.length)<2||!U.trim()},o.createElement("img",{src:"data:image/svg+xml,%3csvg width='20' height='21' viewBox='0 0 20 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 9.73438L3.75 13.4844L7.5 17.2344' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M16.25 4.73438L16.25 10.3026C16.25 11.1464 15.9208 11.9557 15.3347 12.5524C14.7487 13.1491 13.9538 13.4844 13.125 13.4844L3.75 13.4844' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-enter"}))),(null==ie?void 0:ie.length)?o.createElement("div",{className:"error-text"},S("notification.limitUrlDomain")):null,(!R||0===R.length)&&ce&&o.createElement("div",{className:"link-preview-wrapper"},ce.isFetching?o.createElement(O,null):o.createElement(o.Fragment,null,o.createElement(Be,{title:ce.title,url:ce.url||"#",image:ce.image,noRefetch:!0}),o.createElement("img",{src:Ge,className:"icon-close",onClick:function(){return ue(null)}}))),R&&R.length>0&&o.createElement("div",{className:"preview-images-container"},R.map((function(e,t){return o.createElement("div",{key:t,className:"image-src-wrapper"},o.createElement("img",{className:"preview-image",src:e}),o.createElement("img",{src:Ge,className:"icon-close-circle",onClick:function(){return F(t)}}))}))))},rt="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 5V8' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11H8.00708' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",lt=function(n){var i=n.className,l=n.style,s=n.reason,c=n.reasonText,u=n.onClose,d=n.postId,v=a(E),g=v.data,f=g.locale,w=g.env.isMarryBaby,k=v.action.pushNotifications,y=h().t,b=r(!1),N=b[0],I=b[1];return o.createElement(ee,{"data-is-marrybaby":w,className:i,style:l},o.createElement("ul",{className:"report-list"},o.createElement("li",{className:"report-item"},o.createElement("img",{src:rt}),o.createElement(p,{className:"__label",color:C.colors.gray800,size:"p4"},c))),o.createElement(m,{theme:w?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:N,onClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!d||N)return[2];I(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,We({id:d,reason:s,locale:f})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(k({message:"Post reported",type:"success"}),u&&u()),[3,4];case 3:return t.sent(),[3,4];case 4:return I(!1),[2]}}))}))}},y("submit")))},st=function(e){var t=e.className,n=e.style,i=e.replyingTo,l=e.mentionedUser,s=e.description,u=e.disableShortenContent,d=e.mentions,m=void 0===d?[]:d,p=r(!1),v=p[0],g=p[1],f=h().t,w=te().authActionWrapper,k=r(!1),C=k[0],y=k[1],b=H(W(s||"","display"),m),N=a(E).action.sanitizeFunction,I=c((function(){var e=N(b||"");if(u||v)return{showContent:e,hasSeeMore:!1};var t=e.slice(0,1e3),n=1e3-27*((t.match(/<\/div>/g)||[]).length-1),i=(t||"").slice(0,n<40?40:n),o=N(i.replace(/(<|<\/)( +|[a-zA-Z]*)$/gi,"")),a=o.length<e.length-10;return{showContent:a?o:e,hasSeeMore:a}}),[u,v,b]),T=(null==l?void 0:l.name)||i,x="expert"===(null==l?void 0:l.role)&&!!(null==l?void 0:l.partnerId);return o.createElement(o.Fragment,null,x&&o.createElement(ne,{isOpen:C,onClose:function(){return y(!1)},expertId:String(null==l?void 0:l.partnerId)}),o.createElement(ie,{className:"".concat(t," no-replace-click"),style:n},T&&o.createElement("span",{onClick:function(){return x&&y(!0)},className:"post-content-replying"},"@",T),(null==s?void 0:s.startsWith("[mention+id="))&&o.createElement("span",{className:"post-content-replying tag-only"},"@"),o.createElement("span",{dangerouslySetInnerHTML:{__html:I.showContent},className:"post-content ".concat(I.hasSeeMore?"has-see-more":"")}),I.hasSeeMore&&!v&&o.createElement("span",null,"... ",o.createElement("span",{onClick:function(e){e.preventDefault(),e.stopPropagation(),w((function(){return g(!0)}))},className:"see-more-text"},f("post.seeMore")))))},ct=function(e){var t=e.className,n=e.style,i=e.authorName,a=e.images,l=e.onClose,c=e.onOpenSingleView,u=h().t,d=r(!1),m=d[0],v=d[1];return s((function(){setTimeout((function(){v(!0)}),0)}),[]),_e.createPortal(o.createElement(oe,{className:t,style:n,"data-open":m},o.createElement("div",{className:"top-bar"},o.createElement("img",{className:"icon-arrow-left",src:"data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.0508 18.0607L4.00078 12.0367L10.0508 6.01172' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.00195 12.0352L19.002 12.0352' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",onClick:l,alt:"go back"}),o.createElement(p,{size:"p2",type:"bold",style:{textAlign:"center"}},u("previewPhotos.title",{name:i}))),o.createElement("div",{className:"container"},a.map((function(e,t){return o.createElement("img",{className:"img-preview",key:t,src:e,onClick:function(){return null==c?void 0:c(t)},alt:"post img"})})))),w())},ut="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12.8125L10 8.8125L6 4.8125' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",dt=function(e){var t=e.initialViewIndex,n=e.images,i=e.onClose,a=r(t),l=a[0],c=a[1],u=r(!1),d=u[0],m=u[1];s((function(){setTimeout((function(){m(!0)}),0)}),[]);var p=null==n?void 0:n[l],v=0===l,g=!(null==n?void 0:n.length)||l===(null==n?void 0:n.length)-1;return _e.createPortal(o.createElement(ae,{"data-open":d&&!!p},o.createElement(re,null,o.createElement("img",{src:le,className:"icon-close",onClick:i,alt:"close"})),p&&l>=0&&o.createElement(o.Fragment,null,o.createElement(se,null,o.createElement("img",{className:"img-preview",src:p,alt:"post img open"}),o.createElement(ce,{"data-disabled":v,onClick:function(){return!v&&c(l-1)}},o.createElement(ue,null,o.createElement("img",{src:ut,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":v}))),o.createElement(ce,{"data-right":!0,"data-disabled":g,onClick:function(){return!g&&c(l+1)}},o.createElement(ue,null,o.createElement("img",{src:ut,alt:"right arrow","data-disabled":g})))))),w())},mt=function(e){var t=e.className,n=e.images,i=void 0===n?[]:n,c=e.style,u=e.authorName,m=a(E).data.env.isMarryBaby,p="+ ".concat((i.length||0)-4),v=r(!1),g=v[0],h=v[1],w=r(-1),k=w[0],C=w[1];s((function(){setTimeout((function(){return null==je?void 0:je.update()}),100)}),[null==i?void 0:i.slice(0,5).join("|")]);var y=i.length>5,b=l(!1);return s((function(){return function(){b.current&&f(!1)}}),[]),s((function(){g||k>=0?(f(!0),b.current=!0):(f(!1),b.current=!1)}),[g,k]),o.createElement(o.Fragment,null,o.createElement(de,{className:t,style:c,"data-image-count":y?5:i.length||0,"data-is-marrybaby":m},null==i?void 0:i.slice(0,5).map((function(e,t){return o.createElement("div",{className:"img-wrapper",key:t,onClick:function(){t>=4&&y?h(!0):C(t)}},!m&&o.createElement("img",{className:"lazy img-preview-blur","data-src":e}),o.createElement("img",{className:"lazy img-preview","data-src":e}),4===t&&y&&o.createElement("div",{className:"img-more-overlay"},o.createElement(d,{tag:"h1",color:"white"},p)))}))),g&&o.createElement(ct,{authorName:u||"",images:i,onClose:function(){return h(!1)},onOpenSingleView:C}),k>=0&&o.createElement(dt,{images:i,initialViewIndex:k,onClose:function(){return C(-1)}}))},pt=function(i){var u=i.url,d=i.image,m=i.className,p=i.style,v=a(E).data.locale,g=r(null),h=g[0],f=g[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return d?[2]:u?(f((function(e){return n(n({},e),{isFetching:!0})})),I(T(x.FETCH_PREVIEW,{_locale:v}),"POST",{data:{link:u}}).then((function(e){var t,n;f({url:u,image:(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.image)||(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.logo)})})).catch((function(){f(null)})),[2]):[2,f(null)]}))}))}),[u,d]);var w=(null==h?void 0:h.image)||d,k=(null==h?void 0:h.url)||u,C=c((function(){return me(k)}),[k]),y=c((function(){return pe(k)}),[k]),b=l(0),M=l(0),_=r(!1),P=_[0],L=_[1];s((function(){var e=function(){var e,t=null===(e=S.current)||void 0===e?void 0:e.getBoundingClientRect(),n=!1;t&&(!b.current||Math.abs((b.current-t.width)/(null==t?void 0:t.width))>.2)&&(b.current=Math.floor(t.width),n=!0),t&&(!M.current||Math.abs((M.current-t.height)/(null==t?void 0:t.height))>.2)&&(M.current=Math.floor(t.height),n=!0),n&&L((function(e){return!e}))};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var S=l(null),j=l(!1);return o.createElement(ve,{className:"".concat(m," no-replace-click"),style:p,ref:S},d||!C&&!y?o.createElement("a",{href:k,target:"_blank",rel:"noreferrer"},o.createElement("div",{className:"link-image-wrapper ".concat((null==h?void 0:h.isFetching)?"fetching":"")},(null==h?void 0:h.isFetching)?o.createElement(O,{className:"loading-spinner"}):o.createElement("img",{className:"link-image",src:w||N,onError:function(e){j.current||(j.current=!0,e.currentTarget.src=N)}}))):o.createElement("div",{className:"link-image-wrapper"},C?o.createElement("iframe",{width:"100%",height:"100%",src:"https://www.youtube.com/embed/".concat(C,"?&autoplay=1&mute=1"),frameBorder:"0",allowFullScreen:!0,style:{position:"absolute",top:0,left:0,border:"none",overflow:"hidden"}}):y?o.createElement("iframe",{key:String(P),src:"https://www.facebook.com/plugins/video.php?href=".concat(encodeURIComponent(k),"&autoplay=1&show_text=false&t=0&width=").concat(b.current,"&height=").concat(M.current),style:{position:"absolute",top:"50%",left:"50%",border:"none",overflow:"hidden",height:M.current,width:b.current,transform:"translate(-50%, -50%)"},scrolling:"no",frameBorder:"0",allowFullScreen:!0,allow:"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"}):null))},vt="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10Z' fill='%233E3F58'/%3e %3cpath d='M19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10Z' fill='%233E3F58'/%3e %3cpath d='M12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z' fill='%233E3F58'/%3e %3c/svg%3e",gt="data:image/svg+xml,%3csvg width='3' height='13' viewBox='0 0 3 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='1.58326' cy='6.41663' r='1.25' transform='rotate(89.9997 1.58326 6.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='1.41663' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 1.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='11.4166' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 11.4166)' fill='%23595959'/%3e%3c/svg%3e",ht="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2 4H3.33333H14' stroke='%23737373' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.33334 3.99992V2.66659C5.33334 2.31296 5.47382 1.97382 5.72387 1.72378C5.97392 1.47373 6.31305 1.33325 6.66668 1.33325H9.33334C9.68697 1.33325 10.0261 1.47373 10.2762 1.72378C10.5262 1.97382 10.6667 2.31296 10.6667 2.66659V3.99992M12.6667 3.99992V13.3333C12.6667 13.6869 12.5262 14.026 12.2762 14.2761C12.0261 14.5261 11.687 14.6666 11.3333 14.6666H4.66668C4.31305 14.6666 3.97392 14.5261 3.72387 14.2761C3.47382 14.026 3.33334 13.6869 3.33334 13.3333V3.99992H12.6667Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6.66666 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.33334 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",ft=function(n){var i=n.onDeleteComment,l=n.commentId,s=n.className,c=void 0===s?"":s,u=n.popoverClassName,d=void 0===u?"":u,m=a(E),p=m.data,v=p.env.isMarryBaby,g=p.locale,f=m.action.pushNotifications,w=h().t,k=r(!1),C=k[0],y=k[1],b=te().authActionWrapper;return o.createElement("div",{className:c,onClick:function(e){e.preventDefault(),e.stopPropagation()}},C&&o.createElement(qe,{thumbnail:"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0)'%3e%3cpath d='M2 4.00781H3.33333H14' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.33337 4.00846V2.67513C5.33337 2.32151 5.47385 1.98237 5.7239 1.73232C5.97395 1.48227 6.31309 1.3418 6.66671 1.3418H9.33337C9.687 1.3418 10.0261 1.48227 10.2762 1.73232C10.5262 1.98237 10.6667 2.32151 10.6667 2.67513V4.00846M12.6667 4.00846V13.3418C12.6667 13.6954 12.5262 14.0346 12.2762 14.2846C12.0261 14.5347 11.687 14.6751 11.3334 14.6751H4.66671C4.31309 14.6751 3.97395 14.5347 3.7239 14.2846C3.47385 14.0346 3.33337 13.6954 3.33337 13.3418V4.00846H12.6667Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6.66663 7.3418V11.3418' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.33337 7.3418V11.3418' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0'%3e%3crect width='16' height='16' fill='white' transform='translate(0 0.0078125)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",isThumbnailIcon:!0,title:w("popup.deleteComment.title"),description:w("popup.deleteComment.description"),acceptText:w("popup.deletePost.accept"),cancelText:w("popup.deletePost.cancel"),onAccept:function(){return e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return l?[4,ot({id:l,locale:g})]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(i&&i(),f({title:"",message:w("notification.success"),type:"success"})):f({title:"",message:(null===(n=null==e?void 0:e.messages)||void 0===n?void 0:n[0])||w("notification.failure"),type:"danger"}),[2]}}))}))},onClose:function(){return y(!1)}}),o.createElement(ge,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:ht,label:w("actionPopover.delete"),onClick:function(){b((function(){y(!0)}))}}]},className:d,toggleButtonContent:o.createElement("img",{src:v?vt:gt}),buttonProps:{}}))},wt=function(i){var l,u,d,p,v,f=i.className,w=i.style,k=i.comment,C=i.type,b=void 0===C?"comment":C,N=i.level,T=void 0===N?0:N,x=i.replyingId,M=i.onPostCommentSuccess,_=i.post,P=i.onDeleteComment,L=i.refetchComment,S=i.hasQuickBookingEnable,j=i.handleMakeAppointment,B=a(E).data,F=B.locale,R=B.userInfo,D=B.env.isMarryBaby,O=h().t,A=r(k||null),z=A[0],V=A[1],U=z.id;z.countReplies;var H=z.countLikes,W=z.content,Z=z.createdAt,G=z.replies,K=void 0===G?[]:G,Q=z.images,X=void 0===Q?[]:Q,J=z.author,Y=z.liked,$=z.link,q=z.mentionedUser,ee=z.mentions,ne=function(e){try{var t=e.match(/\[@([^\]]+)\]/),n=t?t[0].replace("[@","").replace("]",""):"";return{text:e.replace(/\[@([^\]]+)\]/,"").trim(),replyingTo:n}}catch(e){}return{text:""}}(W),ie=ne.text,oe=ne.replyingTo,ae=te({_joinCommunityIds:[null===(l=null==_?void 0:_.community)||void 0===l?void 0:l.id],_joinTopicIds:null===(u=null==_?void 0:_.topics)||void 0===u?void 0:u.map((function(e){return e.id}))}).authActionWrapper,re=r(4),le=re[0],se=re[1],ce=!!(null==R?void 0:R.id)&&(null==K?void 0:K.some((function(e){return e.author.id===R.id}))),ue=function(e){V((function(t){if(!t.replies.find((function(t){return t.id===e.id}))){t.replies.unshift(e);var i=n(n({},t),{replies:t.replies.slice(),countReplies:t.countReplies+1});return L&&L(i),i}return t}))},de=r(!1),me=de[0],pe=de[1],ve=c((function(){return"comment"===b&&K&&0!=K.length?K.sort((function(e,t){var n=new Date(e.createdAt).getTime(),i=new Date(t.createdAt).getTime();return n>i?-1:n<i?1:0})):K}),[b,K]),ge=(null==K?void 0:K.length)||0,be=String(null==J?void 0:J.email)&&(null==R?void 0:R.email)&&String(null==J?void 0:J.email)===String(null==R?void 0:R.email),Ne=(null==J?void 0:J.name)||(null==J?void 0:J.username)||"",Ie=null==J?void 0:J.avatar,Te=(null==J?void 0:J.username)||(null==J?void 0:J.name)||"",xe=r(null),Me=xe[0],_e=xe[1],Pe=r(null),Le=Pe[0],Se=Pe[1];s((function(){if(null==J?void 0:J.hospitalId){n=J.hospitalId,e(void 0,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,I(ye(Ee.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:y[F]}),"get")];case 1:return e=t.sent(),(null===(i=null==e?void 0:e._data)||void 0===i?void 0:i.branch)&&_e(null==e?void 0:e._data.branch),[2]}}))}))}var n,i;if(null==J?void 0:J.doctorId){i=J.doctorId,e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,I(ye(Ee.GET_DOCTOR_INFO,{doctorId:i,website_url:y[F]}),"get")];case 1:return e=t.sent(),(null===(n=null==e?void 0:e._data)||void 0===n?void 0:n.doctor)&&Se(null==e?void 0:e._data.doctor),[2]}}))}))}}),[J.hospitalId,J.doctorId]);var je=(null==Le?void 0:Le.valid_outpatient)||(null==Le?void 0:Le.valid_telemedicine),Fe=((null==Me?void 0:Me.total_available_service)||(null==Me?void 0:Me.total_available_doctor))>0,Re=S&&(je||Fe);return o.createElement(he,{defaultParams:{_joinCommunityIds:[null===(d=null==_?void 0:_.community)||void 0===d?void 0:d.id],_joinTopicIds:null===(p=null==_?void 0:_.topics)||void 0===p?void 0:p.map((function(e){return e.id}))}},o.createElement(fe,{className:f,style:w,"data-is-reply":!!T,"data-is-marrybaby":D,"data-has-booking":Re},"reply"===b&&o.createElement(g,{className:"top-divider",type:"solid"}),o.createElement(we,{avatar:Ie,name:Ne,username:Te,email:null==J?void 0:J.email,time:Z,className:"post-author ".concat(be?"with-popover":""),type:b,userId:null==J?void 0:J.id,role:null==J?void 0:J.role,expertId:null==J?void 0:J.partnerId,title:null==J?void 0:J.title,doctorId:null==J?void 0:J.doctorId,hospitalId:null==J?void 0:J.hospitalId,hasQuickBooking:Re,handleMakeAppointment:j}),o.createElement(st,{className:"post-content-wrapper",replyingTo:oe,mentionedUser:q,description:ie,mentions:ee}),o.createElement("span",null),o.createElement("span",null),X&&X.length>0?o.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},o.createElement(mt,{images:X,authorName:null==J?void 0:J.username})):null,X&&0!==X.length||!$?null:o.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},o.createElement(Be,{url:$})),"most-engaging"!==b?o.createElement(o.Fragment,null,o.createElement(ke,{type:Ce.reply,loveCount:H,replyCount:ge,className:"post-reaction",liked:Y,isReplied:ce,hideCommentIcon:"reply"===b,onCommentClick:function(){return ae((function(){return pe((function(e){return!e}))}))},onCommentCountClick:function(){return ae((function(){pe(!0)}))},onLikeClick:function(){return ae((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return U?[4,it({commentId:U,setLike:!Y,locale:F})]:[3,2];case 1:1===e.sent().status&&V((function(e){return n(n({},e),{liked:!Y,countLikes:e.countLikes+(Y?-1:1)})})),e.label=2;case 2:return[2]}}))}))}))}}),me&&o.createElement(at,{replyingId:x||z.id,replyToName:J.name||J.username||"",isReply:!0,onClose:function(){return pe(!1)},onPostSuccess:function(e){"reply"===b?M&&M(e):ue(e)},post:_,replyingUser:J}),"comment"===b&&K&&K.length>0?o.createElement("div",{className:"comment-reply-wrapper"},null===(v=null==ve?void 0:ve.slice(0,le))||void 0===v?void 0:v.map((function(e){return o.createElement(wt,{key:e.id,comment:e,type:"reply",className:"comment-reply-item",level:T+1,replyingId:U,onPostCommentSuccess:ue,post:_,onDeleteComment:function(){V((function(t){return n(n({},t),{replies:t.replies.filter((function(t){return t.id!==e.id})),countReplies:t.countReplies-1})}))},handleMakeAppointment:j,hasQuickBookingEnable:S})})),ge>le&&o.createElement(o.Fragment,null,o.createElement(g,{className:"top-divider",type:"solid"}),o.createElement(m,{className:"more-cmt",size:"lg",color:"ghost",onClick:function(){return se((function(e){return e+4}))}},O("comment.seeMoreReplies",{count:ge-le}),o.createElement("img",{className:"chevron-right",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12L10 8L6 4' stroke='%232D87F3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e"})))):null):null,be&&o.createElement(ft,{onDeleteComment:P,className:"popover",commentId:z.id})))},kt="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='%23595959' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",Ct="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",yt="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 5.33337C13.1046 5.33337 14 4.43794 14 3.33337C14 2.2288 13.1046 1.33337 12 1.33337C10.8954 1.33337 10 2.2288 10 3.33337C10 4.43794 10.8954 5.33337 12 5.33337Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4 10C5.10457 10 6 9.10457 6 8C6 6.89543 5.10457 6 4 6C2.89543 6 2 6.89543 2 8C2 9.10457 2.89543 10 4 10Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M12 14.6666C13.1046 14.6666 14 13.7712 14 12.6666C14 11.5621 13.1046 10.6666 12 10.6666C10.8954 10.6666 10 11.5621 10 12.6666C10 13.7712 10.8954 14.6666 12 14.6666Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.72668 9.00665L10.28 11.66' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M10.2734 4.33997L5.72668 6.9933' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",Et=function(n){var i=n.authorEmail,l=n.onDeletePost,s=n.shareUrl,c=n.post,u=n.className,d=void 0===u?"":u,m=n.popoverClassName,p=void 0===m?"":m,v=n.onBookmark,g=n.onRemoveBookmark,f=n.onEditPost,w=a(E),k=w.data,C=k.locale,y=k.userInfo,b=k.togetherUserId,N=k.env.isMarryBaby,I=w.action.pushNotifications,M=h().t,_=r(!1),L=_[0],S=_[1],j=r(!1),B=j[0],F=j[1],R=r(!1),D=R[0],O=R[1],A=te().authActionWrapper,z=i&&(null==y?void 0:y.email)&&i===String(null==y?void 0:y.email);return o.createElement("div",{className:d,onClick:function(e){e.preventDefault(),e.stopPropagation()}},D&&o.createElement(be,{url:s,text:null==c?void 0:c.title,onClose:function(){return O(!1)}}),B&&o.createElement(qe,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:M("popup.deletePost.title"),description:M("popup.deletePost.description"),acceptText:M("popup.deletePost.accept"),cancelText:M("popup.deletePost.cancel"),onAccept:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!(null==c?void 0:c.id)||L)return[2];S(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,ze({id:c.id,locale:C})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(null==l||l()),[3,4];case 3:return t.sent(),[3,4];case 4:return S(!1),[2]}}))}))},onClose:function(){return F(!1)}}),o.createElement(ge,{className:p,toggleButtonContent:o.createElement("img",{src:N?vt:gt}),position:"bottom",align:"end",buttonProps:{isLoading:L},data:z?{isShowheader:!1,type:"list",list:[{icon:yt,label:M("morePopover.share"),onClick:function(){return O(!0)}},{icon:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.16952 3.2356H2.99484C2.6785 3.2356 2.37512 3.36126 2.15143 3.58495C1.92774 3.80863 1.80208 4.11202 1.80208 4.42836V12.7777C1.80208 13.094 1.92774 13.3974 2.15143 13.6211C2.37512 13.8448 2.6785 13.9705 2.99484 13.9705H11.3442C11.6605 13.9705 11.9639 13.8448 12.1876 13.6211C12.4113 13.3974 12.537 13.094 12.537 12.7777V8.60303' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M11.6425 2.341C11.8798 2.10375 12.2016 1.97046 12.5371 1.97046C12.8726 1.97046 13.1944 2.10375 13.4317 2.341C13.6689 2.57826 13.8022 2.90005 13.8022 3.23558C13.8022 3.57111 13.6689 3.89289 13.4317 4.13015L7.76607 9.79578L5.38054 10.3922L5.97692 8.00663L11.6425 2.341Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",label:M("actionPopover.edit"),onClick:f},{icon:ht,label:M("actionPopover.delete"),onClick:function(){A((function(){return F(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:yt,label:M("morePopover.share"),onClick:function(){return O(!0)}},{icon:(null==c?void 0:c.bookmarked)?kt:Ct,label:(null==c?void 0:c.bookmarked)?M("morePopover.unsavePost"):M("morePopover.savePost"),onClick:function(){A((function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(null==y?void 0:y.id)&&(null==c?void 0:c.id)?(null==c?void 0:c.bookmarked)?[4,P(T(x.BOOKMARK.DELETE,{_locale:C}),"DELETE",{data:{post_id:String(c.id)}})]:[3,2]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(I({title:"",message:"Removed saved post",type:"success",displayIcon:Ct}),g&&g()):I({title:"",message:"Remove failed",type:"danger",displayIcon:Ct}),[3,4];case 2:return[4,P(T(x.BOOKMARK.CREATE,{_locale:C}),"POST",{data:{user_id:b||y.id,post_id:c.id}})];case 3:1===(null==(e=t.sent())?void 0:e.status)?(I({title:"",message:"Post saved",type:"success",displayIcon:kt}),v&&v()):I({title:"",message:"Post saved failed",type:"danger",displayIcon:Ct}),t.label=4;case 4:return[2]}}))}))}))}},{icon:rt,label:M("morePopover.report"),subTree:{title:M("morePopover.report.title"),description:M("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(Ne).map((function(e){return{label:Ne[e].label,reason:Ne[e].reportReasonText,reasonValue:e}})).map((function(e){return{label:M(e.label),subTree:{title:M("morePopover.reportSubmit.title"),description:M("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:function(t){return o.createElement(lt,{reason:e.reasonValue,reasonText:M(e.reason),postId:null==c?void 0:c.id,onClose:function(){return t&&t(!1)}})}}}}))}}]}}))},bt=function(n,i){return e(void 0,void 0,void 0,(function(){var e,o,a,r;return t(this,(function(t){switch(t.label){case 0:return[4,Me(T(x.COMMENT.LIST,{postId:n,_locale:i,sort:"popularity",perPage:1,withoutReply:1}),"GET")];case 1:return e=t.sent(),[2,null===(r=null===(a=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.comments)||void 0===a?void 0:a.map(q))||void 0===r?void 0:r[0]]}}))}))},Nt=function(i){var l=i.className,c=i.style,u=i.hideViewMoreComment,p=i.showMostEngaging,v=i.onCommentClick,g=i.onCommentCountClick,f=i.onMostEngagingCommentClick,w=i.onPostCommentSuccess,C=i.disableCardLink,y=i.disableShortenContent,b=i.onDeletePost,T=i.onEditPost,x=i.post,M=i.mostEngagingComment,_=i.onDeleteComment,P=i.showInputComment,L=i.InlineCommentsComponent,S=i.hasQuickBookingEnable,j=i.handleMakeAppointment,B=r(x),F=B[0],R=B[1],D=r(!1),O=D[0],A=D[1],z=r(M),V=z[0],U=z[1],H=F.community,W=F.topics,Z=F.author,G=F.slug,K=F.isPin,Q=F.liked,X=F.scheduleDateTime,J=F.createdAt,Y=F.photos,$=F.mentions,q=F.title,ee=F.description,ne=F.previewUrl,ie=F.likesCount,oe=F.commentsCount,ae=F.id,re=F.commented,le=a(E),se=le.data,ce=se.locale,ue=se.env,de=ue.isMarryBaby,me=ue.togetherBasePath,pe=le.action.pushNotifications,ve=h().t,ge=r(P),fe=ge[0],Ne=ge[1],Me="".concat(me,"/").concat((null==H?void 0:H.slug)||"_","/").concat(G||""),_e="".concat(Ie(ce)).concat(Me),Pe=te((null==H?void 0:H.slug)?{_joinCommunityIds:[H.id],_joinTopicIds:null==W?void 0:W.map((function(e){return e.id}))}:void 0).authActionWrapper,Le=r(!1),Se=Le[0],je=Le[1];s((function(){Ne(P)}),[P]);var Oe=(null==Z?void 0:Z.name)||(null==Z?void 0:Z.username)||"",ze=(null==Z?void 0:Z.username)||(null==Z?void 0:Z.name)||"",Ve=null==Z?void 0:Z.avatar,Ue=r(null),He=Ue[0],We=Ue[1],Ze=r(null),Ge=Ze[0],Ke=Ze[1];s((function(){if(null==Z?void 0:Z.hospitalId){n=Z.hospitalId,e(void 0,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,I(ye(Ee.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:xe[ce]}),"get")];case 1:return e=t.sent(),(null===(i=null==e?void 0:e._data)||void 0===i?void 0:i.branch)&&We(null==e?void 0:e._data.branch),[2]}}))}))}var n,i;if(null==Z?void 0:Z.doctorId){i=Z.doctorId,e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,I(ye(Ee.GET_DOCTOR_INFO,{doctorId:i,website_url:xe[ce]}),"get")];case 1:return e=t.sent(),(null===(n=null==e?void 0:e._data)||void 0===n?void 0:n.doctor)&&Ke(null==e?void 0:e._data.doctor),[2]}}))}))}}),[Z.hospitalId,Z.doctorId]);var Qe=(null==Ge?void 0:Ge.valid_outpatient)||(null==Ge?void 0:Ge.valid_telemedicine),Xe=((null==He?void 0:He.total_available_service)||(null==He?void 0:He.total_available_doctor))>0,Je=S&&(Qe||Xe);s((function(){e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return ae&&oe&&p&&!(null==M?void 0:M.id)?[4,bt(ae,ce)]:[3,2];case 1:e=t.sent(),U(e),t.label=2;case 2:return[2]}}))}))}),[ae,ce,oe,p,null==M?void 0:M.id]),s((function(){U(M)}),[null==M?void 0:M.id]);var Ye=function(i){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return oe>1&&(null==V?void 0:V.id)&&(null==V?void 0:V.id)===(null==i?void 0:i.id)?[4,bt(ae,ce)]:[3,2];case 1:e=t.sent(),U(e),t.label=2;case 2:return R((function(e){return n(n({},e),{commentsCount:e.commentsCount-1})})),_&&_(i),[2]}}))}))};return o.createElement(he,{defaultParams:(null==H?void 0:H.slug)?{_joinCommunityIds:[H.id],_joinTopicIds:null==W?void 0:W.map((function(e){return e.id}))}:void 0},O&&o.createElement(be,{url:_e,avatar:N,text:q,onClose:function(){return A(!1)}}),o.createElement(Te,{className:l,style:c,"data-is-marrybaby":de},K?o.createElement(Re,{className:"post-pin"}):null,o.createElement("div",{style:{position:"relative"}},o.createElement(we,{avatar:Ve,name:Oe,username:ze,url:C?void 0:Me,email:null==Z?void 0:Z.email,time:X||J,community:H,className:"post-author",role:null==Z?void 0:Z.role,userId:null==Z?void 0:Z.id,expertId:null==Z?void 0:Z.partnerId,doctorId:null==Z?void 0:Z.doctorId,hospitalId:null==Z?void 0:Z.hospitalId,title:null==Z?void 0:Z.title,hasQuickBooking:Je,handleMakeAppointment:j}),o.createElement(Et,{authorEmail:String(null==Z?void 0:Z.email),onDeletePost:b,shareUrl:_e,post:F,className:"popover",onEditPost:T})),o.createElement("a",{href:C?void 0:Me,className:"post-content-link-wrapper"},q&&o.createElement(d,{className:"post-content-title",as:"h1",tag:"h5",fontWeight:"bold"},k(q)),o.createElement(st,{className:"post-content-wrapper",description:ee,disableShortenContent:y,mentions:$})),o.createElement("span",null),o.createElement("span",null),o.createElement("div",{key:"tag-topic"},W&&W.length>0?o.createElement(Fe,{topics:W,className:"post-topics"}):null),o.createElement("div",{key:"social-preview"},(null==F?void 0:F.introUrl)?o.createElement("div",{className:"social-preview-wrapper ".concat((null==Y?void 0:Y.length)?"has-image":"")},o.createElement(pt,{url:F.introUrl,image:F.bannerImage})):null),o.createElement("div",{key:"image-preview"},(null==Y?void 0:Y.length)?o.createElement("div",{className:"image-preview-wrapper"},o.createElement(mt,{images:Y,authorName:null==Z?void 0:Z.name})):null),o.createElement("div",{key:"link-preview"},(null==F?void 0:F.introUrl)||(null==Y?void 0:Y.length)||!(null==ne?void 0:ne.url)?null:o.createElement("div",{className:"link-preview-wrapper"},o.createElement(Be,{title:ne.title,url:ne.url,image:ne.image}))),o.createElement(ke,{type:Ce.post,loveCount:ie,replyCount:oe,className:"post-reaction ".concat((null==Y?void 0:Y.length)||(null==ne?void 0:ne.url)?"hide-top-border":""),liked:Se?!Q:Q,isReplied:re,onCommentClick:function(){return Pe((function(){v?v():Ne((function(e){return!e}))}))},onCommentCountClick:function(){Pe((function(){de?Ne(!0):g?g():!C&&(window.location.href=Me)}))},onShareClick:function(){A(!0)},onLikeClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!ae||Se)return[2];je(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Ae({id:ae,locale:ce})];case 2:return 1!==(null==(e=t.sent())?void 0:e.status)?pe(De(ve)):R((function(e){return n(n({},e),{likesCount:(e.likesCount||0)+(e.liked?-1:1),liked:!e.liked})})),[3,4];case 3:return t.sent(),pe(De(ve)),[3,4];case 4:return je(!1),[2]}}))}))},showingMostEngaging:!(!p||!(null==V?void 0:V.id))}),fe&&o.createElement(at,{isMainCmt:!P,onClose:function(){return Ne(!1)},onPostSuccess:function(e){0!==oe||(null==V?void 0:V.id)||U(e),R((function(e){return n(n({},e),{commentsCount:e.commentsCount+1,commented:!0})})),w&&w(e)},post:F}),p&&(null==V?void 0:V.id)?o.createElement("div",{className:"most-engaging-wrapper",onClick:function(e){f?(e.stopPropagation(),f()):window.location.href=Me}},o.createElement(wt,{hasQuickBookingEnable:S,handleMakeAppointment:j,comment:V,onDeleteComment:function(){Ye&&Ye(V)},className:"most-engaging-comment",type:"most-engaging",key:V.id}),oe>1&&!u&&o.createElement(m,{className:"see-more-comments",color:"ghost",size:"md"},ve("comment.seeMoreComments",{count:oe-1}))):null,L))},It=Object.freeze({__proto__:null});export{Be as C,at as I,Re as L,qe as P,lt as S,Fe as T,$e as a,Ke as b,Xe as c,Je as d,st as e,ct as f,dt as g,mt as h,Nt as i,Et as j,wt as k,ft as l,It as t};
|