Comment not found
\n${t}
\n \n `,e.appendChild(n)};if(!(n||r.allCommentsLoaded||r.allComments&&0!==r.allComments.length)){const e=Eo.localize("allPages")||"Other Pages";return void m(`${Eo.localize("loading")||"Loading"} ${e}...`)}const c=document.createElement("div");c.style.cssText="display: flex; padding: 12px; gap: 8px; border-bottom: 1px solid #E5E7EB; align-items: center; flex-wrap: wrap;";const p=document.createElement("span");if(p.style.cssText="font-size: 12px; font-weight: 500; color: #6B7280; margin-right: 4px;",p.textContent=Eo.localize("filters"),c.appendChild(p),r.drawerFilterDropdown=Eo.createStatusFilterDropdown({onChange:async(e,t)=>{const n=await Eo.fetchCommentsByStatus(t,!0);n&&n.counts&&(r.statusCounts=n.counts,r.drawerFilterDropdown.updateCounts(r.statusCounts)),Fo()}}),c.appendChild(r.drawerFilterDropdown),r.drawerPageDropdown=function({isPageComments:e,pageCount:t,allCount:n,onChange:o}){const r=document.createElement("div");r.classList.add("simple-commenter-dropdown-container");const i=document.createElement("button");i.type="button",i.classList.add("simple-commenter-status-button");const a=document.createElement("span");a.classList.add("simple-commenter-status-label"),a.textContent=e?`This Page (${t})`:`Other Pages (${n})`;const s=document.createElement("span");s.innerHTML='\n \n ',i.appendChild(a),i.appendChild(s.firstElementChild),i.style.setProperty("--status-bg","#ffffff"),i.style.setProperty("--status-text","#000000"),i.style.setProperty("--status-ring","#E1E1E1"),r.appendChild(i);const l=document.createElement("div");l.classList.add("simple-commenter-dropdown-menu"),l.style.position="fixed",[{value:"comments",label:`This Page (${t})`},{value:"allComments",label:`Other Pages (${n})`}].forEach(t=>{const n=document.createElement("div");n.classList.add("simple-commenter-dropdown-option"),("comments"===t.value&&e||"allComments"===t.value&&!e)&&n.classList.add("selected"),n.dataset.value=t.value;const o=document.createElement("span");o.classList.add("simple-commenter-option-label"),o.textContent=t.label,n.appendChild(o),l.appendChild(n)}),document.body.appendChild(l);let m=!1;function c(){m=!1,l.classList.remove("open"),document.removeEventListener("click",p,!0)}const p=e=>{r.contains(e.target)||l.contains(e.target)||c()};return l.addEventListener("click",e=>{const t=e.target.closest(".simple-commenter-dropdown-option");t&&(c(),o&&o(t.dataset.value))}),i.addEventListener("click",function(e){e.stopPropagation(),m=!m,m?(l.classList.add("open"),function(){const e=i.getBoundingClientRect();l.style.top=`${e.bottom+4}px`,l.style.left=`${e.left}px`,l.style.minWidth=`${e.width}px`}(),setTimeout(()=>{document.addEventListener("click",p,!0)},0)):c()}),r}({isPageComments:n,pageCount:i,allCount:a,onChange:e=>{To(e)}}),c.appendChild(r.drawerPageDropdown),r.drawerSortDropdown=function({currentSort:e,onChange:t}){const n=[{value:"newest",label:Eo.localize("newest")},{value:"oldest",label:Eo.localize("oldest")},{value:"highPriority",label:Eo.localize("highPriority")},{value:"lowPriority",label:Eo.localize("lowPriority")}],o=document.createElement("div");o.classList.add("simple-commenter-dropdown-container");const r=document.createElement("button");r.type="button",r.classList.add("simple-commenter-status-button");const i=n.find(t=>t.value===e)||n[0],a=document.createElement("span");a.classList.add("simple-commenter-status-label"),a.textContent=i.label;const s=document.createElement("span");s.innerHTML='\n \n ',r.appendChild(a),r.appendChild(s.firstElementChild),r.style.setProperty("--status-bg","#ffffff"),r.style.setProperty("--status-text","#000000"),r.style.setProperty("--status-ring","#E1E1E1"),o.appendChild(r);const l=document.createElement("div");l.classList.add("simple-commenter-dropdown-menu"),l.style.position="fixed",n.forEach(t=>{const n=document.createElement("div");n.classList.add("simple-commenter-dropdown-option"),t.value===e&&n.classList.add("selected"),n.dataset.value=t.value;const o=document.createElement("span");o.classList.add("simple-commenter-option-label"),o.textContent=t.label,n.appendChild(o),l.appendChild(n)}),document.body.appendChild(l);let m=!1;function c(){m=!1,l.classList.remove("open"),document.removeEventListener("click",p,!0)}const p=e=>{o.contains(e.target)||l.contains(e.target)||c()};return l.addEventListener("click",e=>{const n=e.target.closest(".simple-commenter-dropdown-option");n&&(c(),t&&t(n.dataset.value))}),r.addEventListener("click",function(e){e.stopPropagation(),m=!m,m?(l.classList.add("open"),function(){const e=r.getBoundingClientRect(),t=l.getBoundingClientRect(),n=window.innerWidth;let o=e.left;o+t.width>n-8&&(o=e.right-t.width),l.style.top=`${e.bottom+4}px`,l.style.left=`${Math.max(8,o)}px`,l.style.minWidth=`${e.width}px`}(),setTimeout(()=>{document.addEventListener("click",p,!0)},0)):c()}),o}({currentSort:r.drawerSortOrder,onChange:e=>{r.drawerSortOrder=e,Fo()}}),c.appendChild(r.drawerSortDropdown),r.drawerPriorityDropdown=function({currentFilter:e,onChange:t}){const n=[{value:"all",label:Eo.localize("allPriorities")},{value:"high",label:Eo.localize("high")},{value:"normal",label:Eo.localize("normal")},{value:"low",label:Eo.localize("low")}],o=document.createElement("div");o.classList.add("simple-commenter-dropdown-container");const r=document.createElement("button");r.type="button",r.classList.add("simple-commenter-status-button");const i=n.find(t=>t.value===e)||n[0],a=document.createElement("span");a.classList.add("simple-commenter-status-label"),a.textContent=i.label;const s=document.createElement("span");s.innerHTML='\n \n ',r.appendChild(a),r.appendChild(s.firstElementChild),r.style.setProperty("--status-bg","#ffffff"),r.style.setProperty("--status-text","#000000"),r.style.setProperty("--status-ring","#E1E1E1"),o.appendChild(r);const l=document.createElement("div");l.classList.add("simple-commenter-dropdown-menu"),l.style.position="fixed",n.forEach(t=>{const n=document.createElement("div");n.classList.add("simple-commenter-dropdown-option"),t.value===e&&n.classList.add("selected"),n.dataset.value=t.value;const o=document.createElement("span");o.classList.add("simple-commenter-option-label"),o.textContent=t.label,n.appendChild(o),l.appendChild(n)}),document.body.appendChild(l);let m=!1;function c(){m=!1,l.classList.remove("open"),document.removeEventListener("click",p,!0)}const p=e=>{o.contains(e.target)||l.contains(e.target)||c()};return l.addEventListener("click",e=>{const n=e.target.closest(".simple-commenter-dropdown-option");n&&(c(),t&&t(n.dataset.value))}),r.addEventListener("click",function(e){e.stopPropagation(),m=!m,m?(l.classList.add("open"),function(){const e=r.getBoundingClientRect(),t=l.getBoundingClientRect(),n=window.innerWidth;let o=e.left;o+t.width>n-8&&(o=e.right-t.width),l.style.top=`${e.bottom+4}px`,l.style.left=`${Math.max(8,o)}px`,l.style.minWidth=`${e.width}px`}(),setTimeout(()=>{document.addEventListener("click",p,!0)},0)):c()}),o}({currentFilter:r.drawerPriorityFilter,onChange:e=>{r.drawerPriorityFilter=e,Fo()}}),c.appendChild(r.drawerPriorityDropdown),e.appendChild(c),n&&r.commentsFetchError){const t=document.createElement("div");t.style.cssText="margin: 12px; padding: 10px 12px; border: 1px solid #FECACA; background: #FEF2F2; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px;";const n=document.createElement("span");n.style.cssText="font-size: 12px; color: #B91C1C;",n.textContent=r.commentsFetchError||"Failed to refresh page comments.";const o=document.createElement("button");o.type="button",o.className="simple-commenter-status-button",o.style.cssText="min-height: 28px; padding: 4px 10px; font-size: 12px;",o.textContent=Eo.localize("retry")||"Retry",o.addEventListener("click",async()=>{try{await(Eo.ensurePageCommentsLoaded?.({force:!0}))}catch(e){T("[drawer] retry page comments failed:",e)}}),t.appendChild(n),t.appendChild(o),e.appendChild(t)}if(n&&r.commentsLoading&&(!t||0===t.length))return void m(`${Eo.localize("loading")||"Loading comments..."}`);let d=t;"all"!==r.drawerPriorityFilter&&(d=t.filter(e=>e.priority===r.drawerPriorityFilter));const u=[...d].sort((e,t)=>{switch(r.drawerSortOrder){case"newest":default:return new Date(t.date)-new Date(e.date);case"oldest":return new Date(e.date)-new Date(t.date);case"highPriority":return(o[e.priority]||4)-(o[t.priority]||4);case"lowPriority":return(o[t.priority]||4)-(o[e.priority]||4)}});if(!u||0===u.length){const t=document.createElement("div");return t.className="simple-commenter-drawer-empty",t.innerHTML=`\n \n${"all"!==r.drawerPriorityFilter?Eo.localize("noCommentsWithPriority"):Eo.localize("noComments")}
\n `,e.appendChild(t),void(r.drawerFilterDropdown&&r.statusCounts&&r.drawerFilterDropdown.updateCounts(r.statusCounts))}const g=document.createElement("div");g.className="simple-commenter-drawer-comments-list",u.forEach(e=>{const t=function(e,t=!1){const n=e.id||e._id,o=e.userData||{},i=o.name&&o.name.trim()?o.name.trim():o.role&&["client","team","user"].includes(o.role)&&Eo.localize(o.role)?Eo.localize(o.role):Eo.localize("anonymous"),a=Eo.timeAgo(e.date),s=e.text||"",l=e.title||"",m=document.createElement("div");m.className="simple-commenter-drawer-comment-item",m.dataset.commentId=n;const c=document.createElement("div");c.style.cssText="display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;";const p=document.createElement("div");p.style.cssText="display: flex; align-items: center; gap: 8px;";const d=document.createElement("div");d.style.cssText="display: flex; align-items: center; gap: 8px;";const u=document.createElement("span");u.style.cssText="font-size: 11px; font-weight: 600; color: #6B7280; background: #F3F4F6; padding: 2px 6px; border-radius: 4px;",u.textContent=`#${e.commentNumber||"?"}`,p.appendChild(u);const g=Eo.createPriorityDropdown({currentPriority:e.priority||"normal",onChange:async e=>{try{await Eo.updateCommentStatus(n,{newPriority:e})}catch(e){F("Error updating comment priority:",e)}}});p.appendChild(g.element),Bo({icon:'',title:Eo.localize("moreInfo"),onClick:n=>{n.stopPropagation(),zo(e,t)}}),c.appendChild(p),c.appendChild(d),m.appendChild(c);const h=document.createElement("div");if(h.style.cssText="margin-bottom: 12px;",l.trim()){const e=document.createElement("p");e.className="simple-commenter-title simple-commenter-title-bold",e.textContent=l,e.style.cssText="margin: 0 0 4px 0; white-space: pre-wrap;",h.appendChild(e)}if(s.trim()){const e=document.createElement("p");e.className=l.trim()?"simple-commenter-title simple-commenter-text":"simple-commenter-title simple-commenter-title-bold";let t=Eo.decodeHTMLEntities(s);t=Eo.decodeHTMLEntities(t),e.innerHTML=xn(t),e.style.cssText="margin: 0; white-space: pre-wrap;",h.appendChild(e)}const f=document.createElement("div");f.className="simple-commenter-attribution-row";const b=document.createElement("span");if(b.className="simple-commenter-attribution",b.textContent=`— ${i}`,r.metaData&&e.metadata){const t=Io(e.metadata,!1,e);f.appendChild(t.querySelector(".simple-commenter-disclosure-btn")),f.appendChild(b),h.appendChild(f),h.appendChild(t.querySelector(".simple-commenter-disclosure-panel"))}else f.appendChild(b),h.appendChild(f);if(e.attachedUsers&&e.attachedUsers.length>0){const t=document.createElement("div");t.className="simple-commenter-attached-badges",t.style.display="flex",e.attachedUsers.forEach(e=>{const n=document.createElement("span");n.className="simple-commenter-attached-badge",n.textContent=`@${e.name||e.displayLabel||"User"}`,t.appendChild(n)}),h.appendChild(t)}if(m.appendChild(h),e.screenshot){const t=Eo.createScreenshotButton({screenshot:e.screenshot});t&&(t.style.marginBottom="12px",m.appendChild(t))}if(e.attachments&&e.attachments.length>0){const t=document.createElement("div");t.className="simple-commenter-files-wrapper",t.style.marginBottom="12px",e.attachments.forEach((e,n)=>{const o=nt({file:e,asLink:!0});t.appendChild(o)}),m.appendChild(t)}if(e.replies&&e.replies.length>0){const t=e.replies.length,n=function({buttonText:e,count:t,renderContent:n,startOpen:o=!1}){const r=document.createElement("div");r.className="simple-commenter-replies-disclosure";const i=document.createElement("button");i.type="button",i.className="simple-commenter-replies-disclosure-btn";const a=document.createElement("span");a.className="simple-commenter-replies-disclosure-chevron",a.innerHTML='';const s=document.createElement("span");s.className="simple-commenter-replies-disclosure-text",s.textContent=e;const l=document.createElement("span");l.className="simple-commenter-replies-disclosure-count",l.textContent=t,i.appendChild(a),i.appendChild(s),i.appendChild(l);const m=document.createElement("div");m.className="simple-commenter-replies-disclosure-content";const c=document.createElement("div");c.className="simple-commenter-replies-disclosure-content-inner";let p=o,d=!1;return i.addEventListener("click",e=>{e.stopPropagation(),p=!p,i.classList.toggle("simple-commenter-replies-disclosure-open",p),p?(d||(n(c),d=!0),m.style.maxHeight=c.scrollHeight+100+"px"):m.style.maxHeight="0"}),m.appendChild(c),r.appendChild(i),r.appendChild(m),o&&(n(c),d=!0,i.classList.add("simple-commenter-replies-disclosure-open"),requestAnimationFrame(()=>{m.style.maxHeight=c.scrollHeight+100+"px"})),r}({buttonText:1===t?Eo.localize("reply"):Eo.localize("replies"),count:t,renderContent:t=>{const n=document.createElement("div");n.className="simple-commenter-replies-wrapper",e.replies.forEach(e=>{const t=Eo.createReplyItem(e);n.appendChild(t)}),t.appendChild(n)},startOpen:!1});m.appendChild(n)}const w=No(n);m.appendChild(w);const y=document.createElement("div");y.style.cssText="display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgb(229, 231, 235, 0.5);";const x=document.createElement("span");x.className="simple-commenter-comment-date-large",x.style.cssText="font-size: 12px; color: #9CA3AF;",x.textContent=a,y.appendChild(x);const v=document.createElement("div");v.style.cssText="display: flex; align-items: center; gap: 8px;";const C=Eo.createStatusDropdown({currentStatus:e.status,dataId:n,onChange:async(e,t)=>{e.stopPropagation();try{await Eo.updateCommentStatus(n,{newStatus:t})}catch(e){F("Error updating comment status:",e)}}});v.appendChild(C.element);const k=Bo({icon:'',text:Eo.localize("view"),title:Eo.localize("viewComment"),onClick:o=>{if(o.stopPropagation(),Ao(),"view"!==r.mode&&dn("view"),t){let t;return t=e.locator?`${e.locator.slugValue}?${e.locator.key}=${e.locator.value}`:e.slug,void(window.location.href=`${t}#simple-comment=${n}`)}if(r.assetCommenting&&e.assetState&&e.assetState.pageNumber!==r.assetState.pageNumber)return"function"==typeof window.simpleCommenterSetPageNumber&&window.simpleCommenterSetPageNumber(e.assetState.pageNumber),void setTimeout(()=>{Eo.displaySingleComment(e,null,!0)},300);const i=document.querySelector(`.simple-commenter-comment-marker[data-id="${n}"]`);i?.scrollIntoView({behavior:"smooth",block:"center"});const a=document.querySelector(`.simple-commenter-comment-box[data-id="${n}"]`);a?Eo.showCommentBoxPanel(a,!0):Eo.displaySingleComment(e,null,!0)}});return v.appendChild(k),y.appendChild(v),m.appendChild(y),m}(e,!n);g.appendChild(t)}),e.appendChild(g),r.drawerFilterDropdown&&r.statusCounts&&r.drawerFilterDropdown.updateCounts(r.statusCounts)}async function Uo(){const e=document.querySelector(".simple-commenter-textarea-new.simple-commenter-textarea-check"),t=e&&l(e)?.trim()||"",n=document.querySelectorAll(".simple-commenter-reply-textarea-inline");let o="",i=null;for(const e of n)if(l(e)?.trim()){o=l(e).trim(),i=e.getAttribute("data-id");break}if(!t&&!o)return null;const a={};if(o&&i)a.draftType="reply",a.parentCommentId=i,a.text=o;else if(t){if(a.draftType="comment",a.text=t,r.currentElement)try{a.elementXPath=W(r.currentElement)}catch(e){L("[draft] Failed to get XPath for current element:",e)}const n=document.querySelector(".simple-commenter-title-input-new");n?.value?.trim()&&(a.title=n.value.trim())}a.slug=window.location.pathname||"/";const s=await async function(e){const t=`${I}save-draft`;return(await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:r.domain,...e})})).json()}(a);return s?.draftResumeToken?s.draftResumeToken:null}function _o(e){const t=r.drawerShowRegister,n="password"===r.drawerLoginMethod,o=r.simpleCommenterUserData.clientAccessMode||"invite",i="open"===o||"request"===o,a="open"===o;let s,l;s=t?a?Eo.localize("registerTitle"):Eo.localize("requestAccessTitle"):Eo.localize("loginTitle"),l=t?a?Eo.localize("registerDescription"):Eo.localize("requestAccessDescription"):!0===r.simpleCommenterUserData.login?Eo.localize("loginDescription"):Eo.localize("loginDescriptionOptional");const m=t?Eo.localize("alreadyHaveAccount"):i?Eo.localize("noAccount"):"",c=t?Eo.localize("signIn"):a?Eo.localize("register"):Eo.localize("requestAccessButton");Eo.localize("sendMagicLink"),t?a?Eo.localize("createAccount"):Eo.localize("requestAccess"):Eo.localize("signIn"),e.innerHTML=`\n${l}
\n\n ${Eo.localize("privacy")}\n
\n \n ${i||t?``:""}\n${Eo.localize("userNameDescription")}
\n${Ur("hiddenCommentDesc")}
\n${Ur("hiddenCommentTip")}
\n `,n.innerHTML=`\n \n \n `,n.querySelector('[data-action="proxy.php?url=https%3A%2F%2Fsimplecommenter.com%2Fclose"]').addEventListener("click",()=>{_i(!0)}),n.querySelector('[data-action="proxy.php?url=https%3A%2F%2Fsimplecommenter.com%2Freattach"]').addEventListener("click",()=>{_i(!0),$i&&it($i)})}(r,i,a);else if("tutorial"===e){Ni=0;const e=Ri()?4:3;qr("[Tutorial] Starting tutorial with",e,"steps (step 4 "+(4===e?"included":"excluded")+")"),function(e,t,n){const o=Ri()?4:3;e.textContent=qi(Ni),t.innerHTML=Hi(Ni),n.innerHTML=ji(Ni,o),Oi(n)}(r,i,a)}requestAnimationFrame(()=>{n.classList.add("open"),requestAnimationFrame(()=>{o.classList.add("open")})})}function _i(e=!1){if(!Bi)return;const{backdrop:t,popup:n}=Ii;"tutorial"!==zi||e||(qr("[Tutorial] Closing tutorial - setting showTutorial to false (won't show again)"),Ft({showTutorial:!1})),n.classList.remove("open"),setTimeout(()=>{t.classList.remove("open"),Bi=!1,zi=null,$i=null},300)}function Ri(){const e=r.simpleCommenterUserData||{};return Hr(),qr("[Tutorial] Checking if step 4 (registration CTA) should be shown..."),qr("[Tutorial] User auth state:",{token:e.token?"[present]":"[absent]",email:e.email||"[none]",login:e.login}),e.token?(qr("[Tutorial] ❌ Step 4 hidden - user has token (logged in)"),Or(),!1):e.email?(qr("[Tutorial] ❌ Step 4 hidden - user has email (identified)"),Or(),!1):e.login?(qr("[Tutorial] ❌ Step 4 hidden - login flag is true"),Or(),!1):(qr("[Tutorial] ✓ Step 4 will show - user is not authenticated"),Or(),!0)}function qi(e){switch(e){case 0:return Ur("tutorialStep1Title");case 1:return Ur("tutorialStep2Title");case 2:return Ur("tutorialStep3Title");case 3:return Ur("tutorialStep4Title");default:return Ur("tutorialTitle")}}function Hi(e){switch(e){case 0:return`\n\n ${Ur("tutorialStep1Desc")}\n
\n\n ${Ur("tutorialModeDisabledDesc")}\n
\n\n ${Ur("tutorialModeViewDesc")}\n
\n\n ${Ur("tutorialModeCommentDesc")}\n
\n${Ur("tutorialStep2Desc")}
\n${Ur("tutorialFeatureClickDesc")}
\n${Ur("tutorialFeatureUploadDesc")}
\n${Ur("tutorialFeatureButtonsDesc")}
\n${Ur("tutorialStep3Desc")}
\n${Ur("tutorialFeatureReplyDesc")}
\n${Ur("tutorialFeatureStatusDesc")}
\n${Ur("tutorialStep4Desc")}
\n${Ur("tutorialBenefitIdentityDesc")}
\n${Ur("tutorialBenefitNotificationsDesc")}
\n${Ur("tutorialCtaDesc")}
\n \n\n ${t}\n
\n `;const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("fill","none"),n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("strokeLinecap","1.5"),n.style.width="20px",n.style.height="20px",n.innerHTML='
Comments
\n