"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2354],{nFvH:function(e,t,o){o.d(t,{f:function(){return formatPill}});let formatPill=e=>e?{id:e.id,name:e.name||"",icon:e.fruit_icon||""}:{}},Bkqm:function(e,t,o){o.d(t,{a:function(){return formatPost},b:function(){return formatUserProfileUrl},c:function(){return formatTopic},d:function(){return n},e:function(){return formatComment},f:function(){return formatCommunity},g:function(){return formatArticle},h:function(){return formatCategory}});var i=o("LufY");let formatAuthor=e=>e?{displayName:e.display_name||null,avatar:e.avatar||null,thumbnailAvatar:e.avatar_thumbnail||null,profileUrl:e.profile_url||null,description:e.description||null,metaTag:e.meta_tag||"",specialty:e.specialty||"",organisation:e.organisation||""}:{},formatArticleExpert=e=>e?{id:e.ID||null,name:e.name||null,specialty:e.specialty||null,avatar:e.avatar||null,permalink:e.permalink||null,thumbnailAvatar:e.avatar_thumbnail||null}:{},formatSpotlightsSummary=e=>void 0!==e&&e?{id:e.ID,name:e.name,permalink:e.permalink,image:(null==e?void 0:e.small_banner)||(null==e?void 0:e.image)||"",imageMedium:(null==e?void 0:e.image_medium)||null,imageThumbnail:(null==e?void 0:e.image_thumbnail)||null,startDate:null==e?void 0:e.start_date,endDate:null==e?void 0:e.end_date}:null,formatArticleSubscriptionBanner=e=>{if(!e)return{};let{button_text:t,button_url:o,status:r,banner_desktop:n,banner_mobile:l}=e,a=(0,i._)(e,["button_text","button_url","status","banner_desktop","banner_mobile"]);return Object.assign({buttonText:t||"",buttonUrl:o||"",status:!!r,bannerDesktop:n||"",bannerMobile:l||""},a)},r={EN:"English",FIL:"Filipino"},formatTranslateOptions=e=>void 0===e||Object.keys(e).length<2?[]:Object.keys(e).map(t=>({label:t.toUpperCase() in r?r[t.toUpperCase()]:t.toUpperCase(),value:"/"===e[t].slice(-1)?e[t]:`${e[t]}/`})),formatArticle=e=>{var t,o,i,r;return e?{id:e.ID,postName:e.post_name,sponsor:e.sponsor?formatSponsor(e.sponsor):null,isSponsored:e.is_sponsored||null,isPremium:e.is_premium||!1,postTitle:e.post_title||"",postModified:e.post_modified||"",postDate:e.post_date||"",modifiedTime:e.modified_time||"",permalink:e.permalink||"",featureImage:e.image||null,featureImageMobile:e.image_medium||null,featureImageMobileXs:e.image_thumbnail||null,author:formatAuthor(e.author),reviewer:e.reviewed_by&&formatAuthor(e.reviewed_by)||null,articleReviewed:(null==e?void 0:e.reviewed)?Object.assign(Object.assign({},null==e?void 0:e.reviewed),{author:formatUserProfile(null===(t=null==e?void 0:e.reviewed)||void 0===t?void 0:t.author),editor:formatUserProfile(null===(o=null==e?void 0:e.reviewed)||void 0===o?void 0:o.editor),expert:formatUserProfile(null===(i=null==e?void 0:e.reviewed)||void 0===i?void 0:i.expert),fact_check:formatUserProfile(null===(r=null==e?void 0:e.reviewed)||void 0===r?void 0:r.fact_check)}):null,category:formatCategory(e.category),postContent:e.post_content||null,keyTakeaways:e.key_takeaways||null,categories:(e.categories||[]).map(formatCategory),sources:e.sources||null,description:e.description||null,excerpt:e.excerpt||null,expert:formatArticleExpert(e.expert),metaTag:e.meta_tag||null,spotlight:formatSpotlightsSummary(null==e?void 0:e.spotlight),affiliate_message:e.affiliate_message||null,turnOffComment:!!e.turn_off_comment,hasAffiliate:!!e.is_affiliate,translateOptions:formatTranslateOptions(e.translate),jumpingLink:e.jumping_link||[],pregnancy:(null==e?void 0:e.pregnancy)||!1,pregnancyWeek:(null==e?void 0:e.week_pregnancy)||1,primaryCategory:formatCategory(e.primary_category),turnOffIvsPlayer:!!e.turn_off_ivs_player,turnOffArticleVoice:!!e.turn_off_article_voice,enableAudio:!!e.enable_audio,label:(null==e?void 0:e.label)||"",editLast:formatAuthor(e.edit_last),subscriptionBanner:formatArticleSubscriptionBanner(e.subscription_banner)}:{}},formatUserProfile=e=>void 0!==e&&e?Object.assign(Object.assign({},e),{profile_url:(null==e?void 0:e.slug)?["expert","medical"].includes((null==e?void 0:e.role)||"")?`/expert/${null==e?void 0:e.slug}`:`/author/${null==e?void 0:e.slug}`:e.profile_url}):null,formatSponsor=e=>e?{title:e.title,logo:e.logo,link:e.link}:{},formatReviewedCategory=e=>({postTitle:e.post_title,permalink:e.permalink}),formatCategory=e=>{var t,o;return e?{termId:e.term_id||null,sponsor:e.sponsor?formatSponsor(e.sponsor):null,isSponsored:e.is_sponsored||null,categoryName:e.cat_name||null,name:e.name||null,iconUrl:e.icon||"",slugName:e.category_nicename||null,description:e.description||null,featureImage:e.image||null,displayName:e.name||null,parent:e.parent||null,permalink:e.permalink||null,slug:e.slug||null,childCates:(null===(t=e.child_cates)||void 0===t?void 0:t.map(e=>formatCategory(e)))||[],colorFeatureImage:e.color_feature_image||null,imageColor:e.image_color||null,textColor:e.text_color||null,catParent:(null===(o=e.cat_parent)||void 0===o?void 0:o.name)?{name:e.cat_parent.name,permalink:e.cat_parent.permalink}:{},metaTag:e.meta_tag||"",reviewedBy:e.reviewed_by?formatReviewedCategory(e.reviewed_by):null,reviewedDate:e.reviewed_date||"",faqs:e.faqs?e.faqs.map(e=>formatFaqsCategory(e)):null}:{}},formatFaqsCategory=e=>({title:e.title,content:e.content}),formatHealthTool=e=>e?{icon:e.icon,link:e.link.startsWith("http")?e.link:"/health-tools"+e.link.replace("/health-tools",""),subtitle:e.subtitle,title:e.title}:{},formatCommunity=e=>e?{topicCount:e.topics_count||0,postCount:e.posts_count||0,memberCount:e.members_count||0,thumbnail:e.thumbnail||"",coverImage:e.cover_image||"",mobileCoverImage:e.mobile_cover_image||"",name:e.name||"",description:e.description||"",slug:e.slug||"",id:e.id||0,joined:!!e.joined,isActive:null===e.is_active||void 0===e.is_active||!!e.is_active,mappedCategoryId:e.mapped_category_id||0,discoverCategory:e.discover_category?{categoryId:e.discover_category.category_id||0,name:e.discover_category.name||""}:null,isHidden:!!e.is_hidden}:{},formatTopic=e=>{var t,o,i,r;return e?{id:e.id||0,name:e.name||"",image:e.thumbnail||"",slug:e.slug||"",url:"/"+(null===(t=e.community)||void 0===t?void 0:t.slug)+"/"+(null==e?void 0:e.slug)||0,description:e.description||"",joined:e.joined||!1,postCount:e.count_posts||0,memberCount:e.count_members||0,communityId:String(null===(o=e.community)||void 0===o?void 0:o.id),communitySlug:null===(i=e.community)||void 0===i?void 0:i.slug,communityName:null===(r=e.community)||void 0===r?void 0:r.name,order:e.order||0,isActive:null===e.is_active||void 0===e.is_active||!!e.is_active,mappedCategoryId:e.mapped_category_id||0,discoverCategory:e.discover_category?{categoryId:e.discover_category.category_id||0,name:e.discover_category.name||""}:null,isHidden:!!e.is_hidden}:{}},formatExpertAnswer=e=>e?{answer:null==e?void 0:e.answer.map(formatComment),expert:null==e?void 0:e.expert}:{},formatPost=e=>{var t,o,i,r,n,l,a,d,u,s,m,c,p,v,g,f,b,_,h,y,w;return e?{id:e.id,topics:(null===(t=e.topics)||void 0===t?void 0:t.map(t=>{var o,i,r,n;return{id:t.id||0,name:t.name||"",slug:t.slug||"",url:"/"+(null===(o=e.community)||void 0===o?void 0:o.slug)+"/"+t.slug,communityId:String(null===(i=e.community)||void 0===i?void 0:i.id),communitySlug:(null===(r=e.community)||void 0===r?void 0:r.slug)||"",communityName:(null===(n=e.community)||void 0===n?void 0:n.name)||"",isHidden:!!t.is_hidden,isActive:!0}}))||[],community:{id:(null===(o=e.community)||void 0===o?void 0:o.id)||0,name:(null===(i=e.community)||void 0===i?void 0:i.name)||"",slug:(null===(r=e.community)||void 0===r?void 0:r.slug)||"",isActive:!0,isHidden:!!(null===(n=e.community)||void 0===n?void 0:n.is_hidden)},slug:e.slug||"",author:{id:(null===(l=e.user)||void 0===l?void 0:l.id)||0,username:(null===(a=e.user)||void 0===a?void 0:a.user_name)||"",email:(null===(d=e.user)||void 0===d?void 0:d.email)||"",name:(null===(u=e.user)||void 0===u?void 0:u.name)||"",avatar:(null===(s=e.user)||void 0===s?void 0:s.avatar)||"",role:(null===(m=e.user)||void 0===m?void 0:m.role)?null===(p=null===(c=e.user)||void 0===c?void 0:c.role)||void 0===p?void 0:p.toLowerCase():"",type:(null===(v=e.user)||void 0===v?void 0:v.type)||"",partnerId:(null===(g=e.user)||void 0===g?void 0:g.partner_id)?String(null===(f=e.user)||void 0===f?void 0:f.partner_id):"",title:(null===(b=e.user)||void 0===b?void 0:b.title)||"",doctorId:(null===(_=e.user)||void 0===_?void 0:_.doctor_id)?String(null===(h=e.user)||void 0===h?void 0:h.doctor_id):"",hospitalId:(null===(y=e.user)||void 0===y?void 0:y.hospital_id)?String(null===(w=e.user)||void 0===w?void 0:w.hospital_id):""},previewUrl:{title:e.preview_title||"",url:e.preview_link||"",image:e.preview_image||"",description:e.preview_description||""},createdAt:e.created_at||"",scheduleDateTime:e.schedule_datetime||"",photos:e.images||[],description:e.description||"",commentsCount:e.comments_count||0,likesCount:e.likes_count||0,title:e.name||"",isPin:!!e.is_pin,pinDate:e.pin_date||"",liked:e.liked||!1,bookmarked:!!e.bookmarked,mentions:e.mentions||[],commented:!!e.commented,introUrl:e.intro_url||"",bannerImage:e.banner_image||"",isAnonymous:e.is_anonymous?1:0,isAskDoctor:e.is_question?1:0,expertAnswer:formatExpertAnswer(null==e?void 0:e.expert_answer),createdTime:e.created_time||"",isMinigame:"mini_game"===e.event_type,eventStart:e.event_start,eventEnd:e.event_end,isSensitive:(null==e?void 0:e.is_sensitive)||0}:{}},formatComment=e=>{var t,o,i,r,n,l,a,d,u,s,m,c,p,v,g,f,b,_,h,y,w,k,x,C,E,S,A,T,N,I,P,R;return e?{content:e.content,countLikes:e.likes_count,countReplies:e.replies_count,createdAt:e.created_at,createdTime:e.created_time,id:String(e.id),images:e.image||[],link:e.link||null,replies:e.replies&&e.replies.length>0?e.replies.map(formatComment):[],author:{id:(null===(t=e.user)||void 0===t?void 0:t.id)||0,username:(null===(o=e.user)||void 0===o?void 0:o.user_name)||"",name:(null===(i=e.user)||void 0===i?void 0:i.name)||"",role:(null===(r=e.user)||void 0===r?void 0:r.role)?null===(l=null===(n=e.user)||void 0===n?void 0:n.role)||void 0===l?void 0:l.toLowerCase():"",avatar:(null===(a=e.user)||void 0===a?void 0:a.avatar)||"",type:(null===(d=e.user)||void 0===d?void 0:d.type)||"",email:(null===(u=e.user)||void 0===u?void 0:u.email)||"",partnerId:(null===(s=e.user)||void 0===s?void 0:s.partner_id)?String(null===(m=e.user)||void 0===m?void 0:m.partner_id):"",title:(null===(c=e.user)||void 0===c?void 0:c.title)||"",doctorId:(null===(p=e.user)||void 0===p?void 0:p.doctor_id)?String(null===(v=e.user)||void 0===v?void 0:v.doctor_id):"",hospitalId:(null===(g=e.user)||void 0===g?void 0:g.hospital_id)?String(null===(f=e.user)||void 0===f?void 0:f.hospital_id):""},liked:!!e.liked,mentionedUser:e.mentioned?{id:(null===(b=e.mentioned)||void 0===b?void 0:b.id)||0,username:(null===(_=e.mentioned)||void 0===_?void 0:_.user_name)||"",name:(null===(h=e.mentioned)||void 0===h?void 0:h.name)||"",role:(null===(y=e.mentioned)||void 0===y?void 0:y.role)?null===(k=null===(w=e.mentioned)||void 0===w?void 0:w.role)||void 0===k?void 0:k.toLowerCase():"",avatar:(null===(x=e.mentioned)||void 0===x?void 0:x.avatar)||"",type:(null===(C=e.mentioned)||void 0===C?void 0:C.type)||"",email:(null===(E=e.mentioned)||void 0===E?void 0:E.email)||"",partnerId:(null===(S=e.mentioned)||void 0===S?void 0:S.partner_id)?String(null===(A=e.mentioned)||void 0===A?void 0:A.partner_id):"",doctorId:(null===(T=e.mentioned)||void 0===T?void 0:T.doctor_id)?String(null===(N=e.mentioned)||void 0===N?void 0:N.doctor_id):"",hospitalId:(null===(I=e.mentioned)||void 0===I?void 0:I.hospital_id)?String(null===(P=e.mentioned)||void 0===P?void 0:P.hospital_id):"",title:(null===(R=e.mentioned)||void 0===R?void 0:R.title)||""}:null,mentions:e.mentions||[],isSensitive:e.is_sensitive||0,userReadComment:e.user_read_comment,source:e.source||[],isVerify:e.is_verify||0,isOppose:e.is_oppose||0,userVerify:e.user_verify||{},categorySlug:e.categories||"",isAnonymous:!!Number(e.is_anonymous||0)}:{}},formatUserProfileUrl=e=>void 0!==e&&e?(null==e?void 0:e.turn_off_profile)?"":(null==e?void 0:e.slug)?["expert","medical"].includes((null==e?void 0:e.role)||"")?`/expert/${null==e?void 0:e.slug}`:`/author/${null==e?void 0:e.slug}`:(null==e?void 0:e.profile_url)||(null==e?void 0:e.permalink)||"#":"";var n=Object.freeze({__proto__:null,formatAuthor:formatAuthor,formatArticleExpert:formatArticleExpert,formatSpotlightsSummary:formatSpotlightsSummary,TRANSLATE_LANGUAGES:r,formatTranslateOptions:formatTranslateOptions,formatArticle:formatArticle,formatUserProfile:formatUserProfile,formatBMIResult:e=>{var t,o,i,r,n,l,a,d,u;return e&&e.status?{status:null==e?void 0:e.status,comparison:null!==(t=null==e?void 0:e.comparison)&&void 0!==t?t:"",assessmentData:[{tab:"tools.condition",content:null!==(o=null==e?void 0:e.condition)&&void 0!==o?o:""},{tab:"tools.risks",content:null!==(i=null==e?void 0:e.risk)&&void 0!==i?i:""},{tab:"tools.suggestion",content:null!==(r=null==e?void 0:e.suggestion)&&void 0!==r?r:""}],chartData:(null===(n=null==e?void 0:e.chart_data)||void 0===n?void 0:n.length)>0?null==e?void 0:e.chart_data:[],disclaimer:null!==(l=null==e?void 0:e.disclaimer)&&void 0!==l?l:"",illustrator:null!==(a=null==e?void 0:e.illustrator)&&void 0!==a?a:"",faqs:null!==(d=null==e?void 0:e.faqs)&&void 0!==d?d:[],suggestedArticlesLink:null!==(u=null==e?void 0:e.suggested_articles_link)&&void 0!==u?u:""}:{}},formatSponsor:formatSponsor,formatReviewedCategory:formatReviewedCategory,formatCategory:formatCategory,formatCategoryApi:e=>e?{categoryInfo:formatCategory(e.data.category)||null,explainersPosts:(e.data.explainers_posts||[]).map(formatArticle),subCategories:(e.data.sub_categories||[]).map(formatCategory)}:{},formatFaqsCategory:formatFaqsCategory,formatHealthTool:formatHealthTool,formatHealthToolTypeCategory:e=>{var t,o;return e?{termId:(null==e?void 0:e.term_id)||0,name:(null==e?void 0:e.name)||"",healthTools:null!==(o=null===(t=null==e?void 0:e.health_tools)||void 0===t?void 0:t.map(e=>formatHealthTool(e)))&&void 0!==o?o:[]}:{}},formatCommunity:formatCommunity,formatTopic:formatTopic,formatExpertAnswer:formatExpertAnswer,formatPost:formatPost,formatPostPagination:e=>e?{currentPage:e.current||0,lastPage:e.last||0,total:e.total_items||0}:{},formatNotification:e=>{var t,o,i;return e?{time:e.created_at,content:e.content,postId:String(e.post_id),fromUser:{name:null===(t=e.from_user)||void 0===t?void 0:t.name,id:null===(o=e.from_user)||void 0===o?void 0:o.id,avatar:null===(i=e.from_user)||void 0===i?void 0:i.avatar},toUserId:String(e.to_user_id),postSlug:e.post_slug||"",communitySlug:e.community_slug||""}:{}},formatSpotlightsList:e=>e?e.map(e=>({id:e.ID,name:e.name,permalink:e.permalink,image:(null==e?void 0:e.small_banner)||(null==e?void 0:e.image),imageMedium:(null==e?void 0:e.image_medium)||null,imageThumbnail:(null==e?void 0:e.image_thumbnail)||null,startDate:null==e?void 0:e.start_date,endDate:null==e?void 0:e.end_date})):[],formatOvulationInfo:e=>e?{disclaimer:e.disclaimer,featuredImage:e.featured_image,info:e.informations||[],reviewedBy:e.reviewed_by?{id:e.reviewed_by.ID,permalink:e.reviewed_by.permalink,name:e.reviewed_by.name,postTitle:e.reviewed_by.post_title}:null,reviewedDate:e.reviewed_date}:{},formatSuggestedArticle:e=>e?{postId:e.post_id||null,categoryId:e.category_id||null,postUrl:e.post_url||null,postReviewed:e.post_reviewed||null,postPageviews:e.post_pageviews||null,postRank:e.post_rank||null,isPin:e.is_pin||null,frequency:e.frequency||null,topic:e.topic||null}:{},formatTopicHealthTool:e=>e?{id:e.tool_id||null,topicFrequency:e.frequency||null,topicId:e.topic_id||null,topicName:e.topic_name||null,isPinned:!!e.is_pin||null,toolLink:e.tool_link||""}:{},formatComment:formatComment,formatReportedPostToPostDetail:e=>e?{name:e.title,description:e.description,images:e.images,likes_count:e.count_likes,comments_count:e.count_comments,topics:[],slug:e.post_slug,id:e.post_id,is_pin:e.is_pin,pin_date:"",post_type:e.post_type,schedule_datetime:e.schedule_datetime,is_active:e.is_active,preview_title:e.preview_title||"",preview_image:e.preview_image||"",preview_description:e.preview_description||"",preview_link:e.preview_link||"",user:e.user,created_at:"",created_time:"",community:{id:e.community_id,name:e.community_name,slug:e.community_slug,description:""}}:{},formatTopicSubot:e=>e?{chatBotId:e.subot_id,isPinned:e.is_pin,topicId:e.topic_id,topicFrequency:e.frequency}:{},formatSiteWideBanner:(e,t)=>void 0!==e&&e?{content:(null==e?void 0:e.content)||"",icon:(null==e?void 0:e.icon)||"",type:t||"other"}:null,formatPWGContent:e=>e?{disclaimer:e.disclaimer,info:e.info||[],reviewedBy:e.reviewed_by?formatUserProfile(e.reviewed_by):null,reviewedDate:e.reviewed_date,metaTag:e.meta_tag}:{},formatUserProfileUrl:formatUserProfileUrl,formatTHRContent:e=>e?{disclaimer:e.disclaimer,info:e.info||[],reviewedBy:e.reviewed_by?formatUserProfile(e.reviewed_by):null,reviewedDate:e.reviewed_date,metaTag:e.meta_tag}:{},formatBabyGrowthContent:e=>{var t,o,i;return e&&e.information?{information:null!==(t=e.information.map(e=>({title:e.title,description:e.description})))&&void 0!==t?t:[],reviewBy:{reviewer:(null===(o=e.reviewed_by)||void 0===o?void 0:o.display_name)||(null===(i=e.reviewed_by)||void 0===i?void 0:i.name)||"",date:e.reviewed_date||"",link:formatUserProfileUrl(null==e?void 0:e.reviewed_by)},metaTag:e.meta_tag||"",title:e.title||"",description:e.description||"",disclaimer:e.disclaimer||"",is_sponsored:e.is_sponsored||!1,sponsor:e.sponsor,featuredImage:e.featured_image||""}:{}}})},cC9C:function(e,t,o){o.d(t,{I:function(){return x},R:function(){return RichTextEditor},S:function(){return w}});var i=o("LufY"),r=o("q1tI"),n=o("OaJP"),l=o("BH8n"),a=o("rrs9"),d=o("J5bt"),u=o("sEfC"),s=o.n(u),m=o("27Mu"),c=o("D03Z"),p=o("Y8gQ"),v=o("rBCA"),g=o("iBNF"),f=o("IQVP"),b=o("aIjN"),_=o("8/zt"),h=o("S0Zs"),y=o("FbEX");let w=v.Z.div` input:focus, textarea:focus, [contenteditable='true'] { outline: none; } &.has-ask-doctor-option { .textarea-control { border-bottom: none; border-radius: 4px 4px 0 0; } } &.error-description { .textarea-control { border: 1px solid ${g.r.colors.red600}; } } .textarea-control { position: relative; border: 1px solid ${g.r.colors.gray200}; border-radius: ${g.r.borderRadius}; &.--focus { border-color: ${g.r.colors.primaryBase}; box-shadow: 0px 0px 2px 2px ${g.r.colors.primary200}; } .textarea-wrapper { width: 100%; height: 200px; } .control-tool { position: absolute; bottom: 0; left: 0; display: flex; width: calc(100% - 2rem); height: 40px; align-items: center; justify-content: flex-end; border-top: 1px solid ${g.r.colors.gray200}; margin: 0 1rem; .tool-button { display: flex; width: 2rem; height: 2rem; align-items: center; justify-content: center; background: transparent; cursor: pointer; } .image-icon { vertical-align: middle; } } } .link-preview-wrapper { position: relative; .icon-close { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; cursor: pointer; } } .image-gallery { margin-bottom: 1rem; .image-item { position: relative; overflow: hidden; width: 100%; height: 0; padding-top: 67%; margin-top: 1rem; border-radius: ${g.r.borderRadius}; & > img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; } .close-btn { position: absolute; top: 8px; right: 8px; left: unset; width: 24px; height: 24px; cursor: pointer; } } } .description-label { margin-bottom: 5px; color: ${g.r.colors.gray600}; /* font-family: 'Open Sans', sans-serif; */ font-size: 13px; font-weight: bold; } .count-string { margin-top: 5px; color: ${g.r.colors.gray500}; font-size: 11px; text-align: right; } .input-notification { display: flex; & > img { width: 16px; height: 16px; margin-top: 1.5px; margin-right: 8px; } } `,k=v.Z.div` height: 100%; position: relative; width: 100%; display: flex; flex-direction: column; .ql-toolbar.ql-snow { top: 0; width: 100%; // position: sticky; z-index: 3; border: none; border-bottom: 1px solid #ccc; border-radius: 4px 4px 0 0; background: white; .ql-formats { display: inline-flex; align-items: center; margin-right: 0.5rem; .link-tool-wrapper { .popover-menu__content { padding: 0.5rem; transform: translateX(calc(-50% - 1rem)); max-width: calc(100vw - 4rem); ::before { right: calc(50% - 8px); } .link-tool-popover { input { padding-left: 1rem; } .link-input-url { margin-bottom: 0.5rem; } .link-input-text { margin-bottom: 0.5rem; } label { display: inline-block; margin-bottom: 0.2rem; } .link-input-button-wrapper { &[data-is-marrybaby='true'] { .link-input-button { border: solid 2px ${g.r.mbColors.pink}; background-color: ${g.r.mbColors.pink}; &:hover:not(:disabled) { border: solid 2px ${g.r.mbColors.pink}; background-color: ${g.r.colors.white}; color: ${g.r.mbColors.pink}; } } } } .link-input-button { width: auto; height: auto; padding: 0.4rem 1rem; background-color: ${g.r.colors.primaryBase}; &:disabled { border-color: #bfbfbf; background-color: #bfbfbf; color: #fff; cursor: not-allowed; } &:hover:not(:disabled) { background-color: ${g.r.colors.primaryHover}; } } .error-text { padding: 0; margin-bottom: 0.5rem; font-weight: 600; color: ${g.r.colors.red700}; } } } } } @media (max-width: 450px) { position: relative; .ql-formats { .link-tool-wrapper { position: unset; .popover-menu__content { left: 0; transform: unset; max-width: 100%; } } } } } .quill { flex: 1; overflow-y: hidden; .ql-container { display: inline-block; width: 100%; min-height: 100%; /* padding: 14px 16px; */ border: none; border-radius: ${g.r.borderRadius}; color: ${g.r.colors.gray800}; font-size: 1rem; line-height: 1.5; resize: none; white-space: break-spaces; .ql-editor { word-break: break-word; overflow-wrap: break-word; /* -ms-overflow-style: none; scrollbar-width: none; &::-webkit-scrollbar { display: none; } */ } mocka { padding: 2px 6px; border-radius: 1rem; &[data-url='true'] { /* background-color: #eeeeff; */ font-style: italic; color: #1890ff; cursor: pointer; outline: none; text-decoration: underline; } &[data-error='true'] { background-color: #ffeeee; color: red; text-decoration: underline; font-style: bold; } } mention { padding: 2px 6px; border-radius: 1rem; background-color: #eeeeff; color: #1890ff; cursor: pointer; outline: none; text-decoration: none; } ol, ul { padding-left: 1rem; } } } .mention-search-container { position: absolute; background: white; border-radius: ${g.r.borderRadius}; filter: drop-shadow(0px 10px 16px rgba(0, 0, 0, 0.04)) drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.04)) drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.04)); overflow-y: scroll; z-index: 99; ::-webkit-scrollbar { -webkit-appearance: none; } ::-webkit-scrollbar:vertical { width: 14px; } ::-webkit-scrollbar-thumb { border-radius: ${g.r.borderRadius}; background-color: #d9d9d9; @supports (background-clip: padding-box) { border: 3px solid rgba(0, 0, 0, 0); background-clip: padding-box; } @supports not (background-clip: padding-box) { border: 3px solid white; } } ::-webkit-scrollbar-track { background-color: #fff; border-radius: 0 6px 6px 0; border-left: 1px solid #f2f2f2; } .mention-search-item { cursor: pointer; padding: 12px 1rem; display: flex; align-items: center; &.item-selected { background-color: ${g.r.colors.gray100}; } .search-avatar { width: 40px; height: 40px; font-size: 20px; margin-right: 20px; } } } `;var x="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3e%3cpath stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='M9.545 16H7.091c-.537 0-1.07-.104-1.566-.305a4.1 4.1 0 0 1-1.327-.867A3.96 3.96 0 0 1 3 12c0-1.06.431-2.078 1.198-2.828A4.14 4.14 0 0 1 7.091 8h2.454m4.38 0h2.984c.537 0 1.07.103 1.566.304a4.1 4.1 0 0 1 1.327.868c.38.371.681.812.887 1.297a3.92 3.92 0 0 1 0 3.062 4 4 0 0 1-.887 1.297c-.38.372-.831.667-1.327.867a4.2 4.2 0 0 1-1.566.305h-2.983M9 12h6'/%3e%3c/svg%3e";let C=null;(0,i.a)(void 0,void 0,void 0,function*(){if("undefined"==typeof window)return;let e=yield Promise.all([o.e(9774),o.e(2937),o.e(2138),o.e(9467),o.e(4467),o.e(6966),o.e(5243),o.e(8132),o.e(1375),o.e(4561),o.e(1448),o.e(5465),o.e(1217),o.e(5480),o.e(731),o.e(2050),o.e(2008),o.e(8469),o.e(8214),o.e(1482),o.e(6817),o.e(467),o.e(5951),o.e(9357),o.e(747),o.e(5675),o.e(6753),o.e(4802),o.e(3046),o.e(5745),o.e(3437),o.e(252),o.e(6839),o.e(9424),o.e(5702),o.e(8922),o.e(6399),o.e(553),o.e(2902),o.e(4969),o.e(3257),o.e(6611),o.e(7538),o.e(6894),o.e(5341)]).then(o.t.bind(o,"rmP6",23));C=e.default;let t=e.Quill||C.Quill;t.register("modules/preserveWhiteSpace",class{constructor(e,t){this.quill=e,this.options=t,e.container.style.whiteSpace="pre-line"}});let i=t.import("blots/inline");let MockABlot=class MockABlot extends i{static create(e){if(!e)return super.create(!1);let t=super.create(e);return MockABlot.setNodeConfigurations(t,e),t}static formats(e){return!!(e.innerText&&(e.getAttribute("data-href")||e.getAttribute("data-url")||e.getAttribute("data-error")||e.getAttribute("data-bad-word")))&&{"data-bad-word":e.getAttribute("data-bad-word"),"data-error":e.getAttribute("data-error"),"data-href":e.getAttribute("data-href"),"data-url":e.getAttribute("data-url"),"data-text":e.innerText||e.getAttribute("data-href")}}static setNodeConfigurations(e,t){var o,i;t&&(null===(i=null===(o=null==t?void 0:t["data-text"])||void 0===o?void 0:o.replace(/(\ )+/g," "))||void 0===i?void 0:i.replace(/(\u200c|‌)+/g,""))&&(t["data-bad-word"]&&e.setAttribute("data-bad-word",t["data-bad-word"]),t["data-href"]&&e.setAttribute("data-href",t["data-href"]),t["data-error"]&&e.setAttribute("data-error",t["data-error"]),t["data-url"]&&e.setAttribute("data-url",t["data-url"]))}};MockABlot.blotName="mocka1",MockABlot.tagName="mocka",t.register(MockABlot);let MentionBlot=class MentionBlot extends i{static create(e){if(!e)return super.create(!1);let t=super.create(e);return MentionBlot.setNodeConfigurations(t,e),t}static formats(e){return!!(e.getAttribute("data-name")&&e.getAttribute("data-id"))&&{"data-name":e.getAttribute("data-name"),"data-id":e.getAttribute("data-id")}}static setNodeConfigurations(e,t){var o,i;t&&t["data-id"]&&(null===(i=null===(o=null==t?void 0:t["data-name"])||void 0===o?void 0:o.replace(/(\ )+/g," "))||void 0===i?void 0:i.replace(/(\u200c|‌)+/g,""))&&(t["data-id"]&&e.setAttribute("data-id",t["data-id"]),t["data-name"]&&e.setAttribute("data-name",t["data-name"]))}};MentionBlot.blotName="mention",MentionBlot.tagName="mention",t.register(MentionBlot)});let inputModify=(e,t)=>{var o;let{formatUrl:i,bannedWords:r=[]}=t||{},n=(0,_.f)((0,_.r)(e));if(!i)return{value:(0,_.h)(n,r)};let l=(0,_.a)((0,_.w)(n)),a=(0,_.g)(n);if(a){let e=[];return a.forEach(t=>{if(t)try{let o=new URL(t);_.A.some(e=>o.origin.endsWith(e))||e.push(t)}catch(o){e.push(t)}}),e.length>0&&(l=l.replace(RegExp(`data-url="true">(${e.map(_.e).join("|")})<`,"gi"),'data-error="true" data-url="true">$1<').replace(RegExp(`data-href="/(${e.map(_.e).join("|")})" data-url="true">`,"gi"),'data-href="/$1" data-error="true" data-url="true">')),{invalidUrls:e,previewUrl:null===(o=a.filter(t=>-1===e.indexOf(t)))||void 0===o?void 0:o[0],value:(0,_.h)(l,r)}}return{value:(0,_.h)(l,r)}},RichTextEditor=({html:e,onChange:t,className:o,style:n,onImagePickerClick:l,bannedWords:d=[],onInvalidUrlsChange:u,onPreviewUrlChange:v,setEditorRef:g,isReplying:y})=>{var w,x,E,S;let A=(0,r.useRef)([]);A.current=d;let[T,N]=(0,r.useState)([]),[I,P]=(0,r.useState)(null),{data:{locale:R}}=(0,r.useContext)(p.T),U=(null==d?void 0:d.join(","))||"";(0,r.useEffect)(()=>{var e,t;let o=null===(t=null===(e=H.current)||void 0===e?void 0:e.getEditor())||void 0===t?void 0:t.root.innerHTML;B(o)},[U]);let fetchPreviewData=e=>{I&&I.url===e||(P({url:e,isFetching:!0}),(0,p.c)((0,p.e)(f.yy.FETCH_PREVIEW,{_locale:R}),"POST",{data:{link:e}}).then(t=>{var o,i,r,n;P({title:null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.title,description:null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.description,image:(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.image)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.logo),url:e})}).catch(()=>{P(null)}))},q=(0,r.useRef)(fetchPreviewData);q.current=fetchPreviewData;let B=(0,r.useCallback)(s()(e=>{if(e){let o=inputModify(e,{bannedWords:A.current,formatUrl:!0}),{invalidUrls:i,previewUrl:r,value:n}=o;i&&N(i),r?q.current(r):P(null),n!==e&&(null==t||t(n))}},500),[]);(0,r.useEffect)(()=>{u&&u(T)},[T]),(0,r.useEffect)(()=>{v&&((null==I?void 0:I.url)?v({title:I.title||"",url:I.url||"",image:I.image||"",description:I.description||""}):v(null))},[I]);let O=(0,r.useRef)(l);O.current=l;let D=(0,c.a)(),$=(0,r.useRef)({toolbar:{handlers:{image:()=>{var e;return null===(e=O.current)||void 0===e?void 0:e.call(O)},link:()=>!1},container:"#toolbar-"+D},preserveWhiteSpace:!0}),M=(0,r.useRef)(-1),H=(0,r.useRef)(null);g&&(null===(x=null===(w=H.current)||void 0===w?void 0:w.getEditor())||void 0===x?void 0:x.root)&&g(null===(S=null===(E=H.current)||void 0===E?void 0:E.getEditor())||void 0===S?void 0:S.root);let handleSelectionChange=()=>{var e,t,o,i,r,n,l,a;if(null===(t=null===(e=H.current)||void 0===e?void 0:e.getEditor())||void 0===t?void 0:t.root){let e=function(e){var t,o;let i=-1;if(void 0!==window.getSelection){let r=window.getSelection();if((null==r?void 0:r.rangeCount)&&(null==r?void 0:r.rangeCount)>0){let r=null===(t=window.getSelection())||void 0===t?void 0:t.getRangeAt(0);if(r){let t=r.cloneRange();t.selectNodeContents(e),t.setEnd(r.endContainer,r.endOffset),i=function calculateChildNodeOffset(e,t){return e.forEach((o,i)=>{let r=i+1===e.length;if(o.nodeType===Node.ELEMENT_NODE){let e=o.outerHTML;if(r)t+=e.indexOf(">")+1,t=calculateChildNodeOffset(o.childNodes,t);else{t+=e.length;return}}else o.nodeType===Node.TEXT_NODE&&(t+=(o.nodeValue||"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").length)}),t}(t.cloneContents().childNodes,i);let n=null===(o=r.endContainer.parentElement)||void 0===o?void 0:o.closest("mocka"),l=r.endContainer.nodeValue||r.endContainer.outerHTML;n&&(null==l?void 0:l.length)&&(i=i-r.endOffset+(n.outerHTML.length-(null==n?void 0:n.outerHTML.lastIndexOf(l))))}}}return i}(null===(i=null===(o=H.current)||void 0===o?void 0:o.getEditor())||void 0===i?void 0:i.root),t=null===(n=null===(r=H.current)||void 0===r?void 0:r.getEditor())||void 0===n?void 0:n.root.innerHTML;if(e>=0&&e0){let r=null===(t=window.getSelection())||void 0===t?void 0:t.getRangeAt(0);if(r){let t=r.cloneRange();t.selectNodeContents(e),t.setEnd(r.endContainer,r.endOffset);let n=(t.endContainer.nodeValue||"").substring(0,r.endOffset),l=n.lastIndexOf("@");if(l+1(0,i.a)(void 0,void 0,void 0,function*(){var i,r,n,l;if(!e||!DOMRect)return j([]);let a=yield((null===(i=(0,m.ej)(b.B))||void 0===i?void 0:i.length)||0)>0?(0,p.b)((0,p.e)(f.yy.SEARCH_USER,{_locale:R,name:e}),"get"):(0,p.q)((0,p.e)(f.qf.SEARCH_USER,{_locale:R,name:e}),"get");Z(0),j(null===(n=null===(r=null==a?void 0:a.data)||void 0===r?void 0:r.users)||void 0===n?void 0:n.filter(e=>!(null==o?void 0:o.includes(String(e.id)))));let d=null===(l=V.current)||void 0===l?void 0:l.getBoundingClientRect();if(t&&d){let e={top:t.bottom-d.top,width:"min(343px, 100%)",maxHeight:256},o=d.width-(t.left-d.left);o<343?e.right=0:e.left=t.left-d.left,F(e)}}),500),[]),setSelectUser=(e,t)=>{var o,i,r;if(G.current){G.current.deleteContents();let n=document.createElement("mention");n.setAttribute("data-id",e),n.setAttribute("data-name",t),n.innerText=t;let l=document.createTextNode(" ");G.current.insertNode(l),G.current.insertNode(n);let a=null===(i=null===(o=H.current)||void 0===o?void 0:o.getEditor())||void 0===i?void 0:i.root;a.focus();let d=null===(r=window.getSelection())||void 0===r?void 0:r.getRangeAt(0);null==d||d.setStart(G.current.endContainer,G.current.endOffset),null==d||d.setEnd(G.current.endContainer,G.current.endOffset)}j([])},V=(0,r.useRef)(null),G=(0,r.useRef)(null),Q=(0,r.useRef)(null),[X,Z]=(0,r.useState)(0);return(0,r.useEffect)(()=>{if(Q.current){let e=Q.current,t=e.children.item(X);if(t){let o=e.getBoundingClientRect(),i=t.getBoundingClientRect();t.offsetTope.scrollTop+o.height&&(e.scrollTop=t.offsetTop-o.height+i.height)}}},[X]),(0,r.useEffect)(()=>{let clickHandler=function(e){var t;(null===(t=V.current)||void 0===t?void 0:t.contains(e.target))||j([])};return window.addEventListener("click",clickHandler,{passive:!0}),()=>{window.removeEventListener("click",clickHandler)}},[]),r.createElement(k,{ref:V,className:o,style:n,onKeyDownCapture:e=>{if(null==L?void 0:L.length){let t=!1;if("ArrowDown"===e.key)t=!0,Z(e=>e+1>=L.length?0:e+1);else if("Escape"===e.key)t=!0,Z(0),j([]);else if("ArrowUp"===e.key)t=!0,Z(e=>e-1<0?L.length-1:e-1);else if("Enter"===e.key||"Tab"===e.key){let e=L[X];e&&(t=!0,setSelectUser(e.id,e.name))}if(t)return e.preventDefault(),!1}}},r.createElement(CustomToolbar,{id:D,onAddLink:(e,o)=>{var i,r;let n=M.current+1,l=null===(r=null===(i=H.current)||void 0===i?void 0:i.getEditor())||void 0===r?void 0:r.root.innerHTML,a=((null==l?void 0:l.substring(0,n))||"")+`${e} `+((null==l?void 0:l.substring(n))||"");null==t||t(a),B(a)}}),C&&r.createElement(C,{ref:H,theme:"snow",value:e,onChange:e=>{null==t||t(e),B(e),handleSelectionChange()},onChangeSelection:()=>{handleSelectionChange()},modules:$.current,formats:["mocka1","mention","id","key","bold","italic","underline","list","bullet"]}),!!(null==L?void 0:L.length)&&r.createElement("div",{ref:Q,className:"mention-search-container",style:z},L.map((e,t)=>r.createElement("div",{className:`mention-search-item ${X===t?"item-selected":""}`,key:e.id,onClick:t=>{t.preventDefault(),t.stopPropagation(),setSelectUser(e.id,e.name)},onMouseEnter:()=>{Z(t)}},r.createElement(h.U,{className:"search-avatar",username:e.name,avatar:e.avatar}),r.createElement("div",null,r.createElement(a.T,{size:"p2"},e.name),r.createElement(a.T,{size:"p4",color:"#595959"},"@",e.username))))))},CustomToolbar=({onAddLink:e,id:t})=>r.createElement("div",{id:"toolbar-"+t,onClick:e=>{e.preventDefault(),e.stopPropagation()}},r.createElement("span",{className:"ql-formats"},r.createElement("button",{className:"ql-bold",type:"button"}),r.createElement("button",{className:"ql-italic",type:"button"}),r.createElement("button",{className:"ql-underline",type:"button"})),r.createElement("span",{className:"ql-formats"},r.createElement("button",{className:"ql-list",value:"ordered",type:"button"}),r.createElement("button",{className:"ql-list",value:"bullet",type:"button"})),r.createElement("span",{className:"ql-formats"},e&&r.createElement(y.P,{className:"link-tool-wrapper",toggleButtonContent:r.createElement("img",{className:"link-icon",src:x,loading:"lazy"}),buttonProps:{size:"md",color:"transparent"},align:"end"},({setShow:t})=>r.createElement(LinkToolInputPopover,{onAddUrl:e,setShow:t})))),E=["notification.limitUrlDomain","notification.urlWrongFormat"],LinkToolInputPopover=({onAddUrl:e,setShow:t})=>{let{data:{env:{isMarryBaby:o}}}=(0,r.useContext)(p.T),{t:i}=(0,d.u)(),[u,s]=(0,r.useState)(""),[m,c]=(0,r.useState)(""),[v,g]=(0,r.useState)(-1),checkUrlValid=e=>{let t=(0,_.c)(e.trim());try{let e=new URL(t);if(!e.protocol.startsWith("http"))return g(1),!1;if(!_.A.some(t=>e.origin.endsWith("/"+t)||e.origin.endsWith("."+t)))return g(0),!1;return g(-1),!0}catch(e){return g(1),!1}},f=u.trim()&&m.trim()&&v<0;return r.createElement("div",{className:"link-tool-popover"},r.createElement(l.I,{name:"url",value:u,size:"md",label:"URL",placeholder:i("placeholder.enterUrlHere"),type:"text",className:"link-input-url",onChange:e=>{s(e),checkUrlValid(e)}}),v>=0&&r.createElement(a.T,{size:"c2",className:"error-text"},i(E[v])),r.createElement(l.I,{name:"text",value:m,size:"md",label:i("createPost.urlText"),placeholder:i("placeholder.enterUrlTextHere"),type:"text",className:"link-input-text",onChange:e=>c(e)}),r.createElement("div",{"data-is-marrybaby":o,className:"link-input-button-wrapper"},r.createElement(n.B,{theme:o?"marryBaby":"helloSites",size:"sm",color:"primary",className:"link-input-button",onClick:()=>{f&&(e(m.trim(),(0,_.c)(u.trim())),t&&t(!1))},isDisabled:!f},i("insert"))))}}}]);