Sid Gifari File Manager
đ Root
/
home
/
genremedia08
/
thepassage.overlookedtracks.com
/
wp-content9
/
plugins
/
echo-knowledge-base
/
js
/
ai
/
Editing: admin-ai-content-analysis-details.min.js
(function(){"use strict";const{useState:e,useEffect:t,useCallback:a,useRef:s,createElement:n,Fragment:o}=wp.element;const{__:i}=wp.i18n;const l=()=>{const e=document.getElementById("epkb-ai-notifications");if(e){const t=e.querySelectorAll(".epkb-ai-notification-error");t.forEach((e=>e.remove()))}};const r=({articleData:r,makeApiRequest:d,showSuccess:c,showError:p})=>{const[g,f]=e(null);const[y,u]=e(true);const[b,m]=e("tags");const[x,h]=e(null);const[k,_]=e([]);const[w,v]=e([]);const[S,C]=e(false);const[N,z]=e(false);const[A,I]=e(false);const[T,R]=e(null);const[F,B]=e(null);const[E,W]=e(false);const[D,L]=e(false);const M=s({articleId:null,attempts:0});const P=r&&r.id;const $=a((e=>{if(!e||typeof e!=="object"){return false}const t=e.processed_content;return typeof t==="string"&&t.trim().length>0}),[]);const G=a((async({mergeWithExisting:e=true,skipSetLoading:t=false,setLoadingState:a=null}={})=>{let s=false;if(E){if(M.current.articleId===P){return false}}L(false);W(true);try{const n=await d("content-analysis-processed-content",{params:{article_id:P}});if(n&&n.data&&n.data.processed_content){s=true;const o=document.querySelector(".epkb-ai-processed-content-display");const i=document.querySelector(".epkb-ai-article-content-display");let l=n.data.processed_content;if(typeof marked!=="undefined"&&marked&&marked.parse){try{l=marked.parse(n.data.processed_content)}catch(e){console.error("Markdown parsing failed:",e)}}if(o){o.innerHTML=l}if(i){i.innerHTML=l}f((t=>{const a={processed_content:n.data.processed_content};if(e&&t&&typeof t==="object"){return{...t,...a}}return a}));const r=`epkb_analysis_details_${P}`;const d=Date.now();sessionStorage.setItem(r,JSON.stringify({data:{processed_content:n.data.processed_content},timestamp:d,article_id:P}));const c=typeof a==="function"?a:u;if(!t&&typeof c==="function"){c(false)}return true}}catch(e){console.error("Error fetching processed content:",e);L(true)}finally{W(false);M.current={articleId:P,attempts:M.current.articleId===P?M.current.attempts+1:1}}if(!s){return false}return true}),[P,E,d,f]);t((()=>{if(!window.EPKB_AI_ContentAnalysisDetails_API){window.EPKB_AI_ContentAnalysisDetails_API={}}const e=window.EPKB_AI_ContentAnalysisDetails_API;e.articleId=P;e.getAnalysisDetails=()=>g;e.hasProcessedContent=$;e.fetchProcessedContent=G;e.requestProcessedContent=(t,a={})=>{if(t&&t!==P){e.pendingFetch={articleId:t,options:a};return false}return G(a)};return()=>{if(window.EPKB_AI_ContentAnalysisDetails_API===e){delete e.articleId;delete e.getAnalysisDetails;delete e.hasProcessedContent;delete e.fetchProcessedContent;delete e.requestProcessedContent;delete e.pendingFetch}}}),[g,P,G,$]);t((()=>{L(false)}),[P]);t((()=>{if(!P||!g){return}if(E){return}if(D){return}if(!$(g)){G({mergeWithExisting:true,skipSetLoading:true})}}),[g,P,G,$,E,D]);t((()=>{if(!window.EPKB_AI_ContentAnalysisDetails_API||!P){return}const e=window.EPKB_AI_ContentAnalysisDetails_API;if(!e.pendingFetch||!e.pendingFetch.articleId){return}if(e.pendingFetch.articleId!==P){return}if(E){return}const t=e.pendingFetch.options||{};delete e.pendingFetch;G(t)}),[P,G,E]);const H=3;const O=a((async(e,t)=>{let a=0;while(a<H){try{const s=await d(e,{method:"POST",data:t});if(s&&s.can_retry&&a<H-1){a++;await new Promise((e=>setTimeout(e,a*1e3)));continue}return s}catch(e){if(e&&e.reason=="execution_time_too_low"){break}else if(e&&e.can_retry&&a<H-1){a++;await new Promise((e=>setTimeout(e,a*1e3)))}throw e}}return{success:false}}),[d]);t((()=>{const e=async()=>{if(!r||!r.id){u(false);return}u(true);try{const e=72e5;const t=Date.now();const a=`epkb_analysis_details_${r.id}`;const s=sessionStorage.getItem(a);if(s){try{const n=JSON.parse(s);if(n.timestamp&&t-n.timestamp<e){f(n.data);u(false);return}else{sessionStorage.removeItem(a)}}catch(e){console.warn("[Content Analysis] Failed to parse cache:",e);sessionStorage.removeItem(a)}}const n=await d("content-analysis-details",{params:{article_id:r.id,kb_id:1}});if(n&&n.data){f(n.data);sessionStorage.setItem(a,JSON.stringify({data:n.data,timestamp:t,article_id:r.id}))}else{const e={score:r.score,importance:r.importance,scoreComponents:r.scoreComponents||[],title:r.title,last_analyzed:r.last_analyzed,status:r.status||r.display_status};f(e)}}catch(e){console.error("Error fetching analysis details:",e);const t={score:r.score,importance:r.importance,scoreComponents:r.scoreComponents||[],title:r.title,last_analyzed:r.last_analyzed,status:r.status||r.display_status};f(t)}finally{u(false)}};e()}),[r,d]);const j=a((e=>{_((t=>{if(t.includes(e)){return t.filter((t=>t!==e))}else{return[...t,e]}}))}),[]);const K=a((e=>{if(e&&e.trim()){v((t=>[...t,e.trim()]))}}),[]);const q=a((e=>{v((t=>t.filter(((t,a)=>a!==e))))}),[]);const J=a((async()=>{const{showLoadingDialog:e}=window.EPKB_AI_Util_React||{};const t=e?e(i("Saving tags...","echo-knowledge-base")):null;try{let e=0;let t=0;const a=[];const s=[];for(const a of k){const n=await d("content-analysis-tag-remove",{method:"POST",data:{article_id:r.id,tag_id:a,kb_id:1}});if(n&&n.success){e++;s.push(a)}else{t++}}for(const s of w){const n=await d("content-analysis-tag-add",{method:"POST",data:{article_id:r.id,tag_name:s,kb_id:1}});if(n&&n.success){e++;a.push({name:s,term_id:n.tag_id,id:n.tag_id})}else{t++}}if(e>0){const t=[...(g.current_tags||[]).filter((e=>!s.includes(e.term_id)&&!s.includes(e.id))),...a];const n=t.length;let o=100;if(n<3){o=Math.max(0,50-(3-n)*15)}else if(n>10){o=Math.max(0,100-(n-10)*10)}const l=a.map((e=>e.name.toLowerCase()));let d=g.suggested_tags;if(d){if(Array.isArray(d)){d=d.filter((e=>{const t=typeof e==="string"?e:e.name;return!l.includes(t.toLowerCase())}))}else if(typeof d==="object"){d={broad:(d.broad||[]).filter((e=>{const t=typeof e==="string"?e:e.name;return!l.includes(t.toLowerCase())})),specific:(d.specific||[]).filter((e=>{const t=typeof e==="string"?e:e.name;return!l.includes(t.toLowerCase())}))}}}const p={...g,current_tags:t,suggested_tags:d,tag_analysis:{...g.tag_analysis,count_score:{...g.tag_analysis?.count_score,score:o}}};f(p);sessionStorage.setItem(`epkb_analysis_details_${r.id}`,JSON.stringify({data:p,timestamp:Date.now(),article_id:r.id}));_([]);v([]);c(i(`Successfully updated ${e} tag(s)`,"echo-knowledge-base"))}if(t>0){p(i(`Failed to update ${t} tag(s)`,"echo-knowledge-base"))}}catch(e){console.error("Error saving tags:",e);p(i("Failed to save tag changes","echo-knowledge-base"))}finally{t&&t()}}),[k,w,r,g,d,c,p]);const U=a((async(e,t)=>{try{const a=await d("content-analysis-tag-edit",{method:"POST",data:{article_id:r.id,tag_id:e,new_name:t,kb_id:1}});if(a&&a.success){c(i("Tag updated successfully","echo-knowledge-base"));window.EPKB_AI_Util_React&&window.EPKB_AI_Util_React.removeArticleAnalysisData(r.id);setTimeout((()=>{window.location.reload()}),1e3)}else{p(i("Failed to update tag","echo-knowledge-base"))}}catch(e){console.error("Error updating tag:",e);p(i("Failed to update tag","echo-knowledge-base"))}}),[r,d,c,p]);const Y=(e,t,a)=>{if(!t)return null;const s=t.issues&&t.issues.length>0;return n("div",{className:s?"epkb-analysis-warning":"epkb-analysis-success",style:{padding:"20px",backgroundColor:"#ffffff",border:s?"2px solid #ffc107":"2px solid #28a745",borderRadius:"6px",marginBottom:"15px"}},n("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"}},n("span",{style:{fontSize:"24px",color:s?"#ff9800":"#28a745"}},s?"â ī¸":"â"),n("div",{style:{flex:1}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 8px 0",color:s?"#856404":"#155724"}},e),s?n("ul",{style:{margin:"0",paddingLeft:"20px",color:"#856404"}},t.issues.map(((e,t)=>{const a=e=>{const t=e.indexOf(": ");if(t===-1){return e}const a=e.substring(0,t+2);const s=e.substring(t+2);if(a.toLowerCase().includes("recommended")){return e}const i=s.split(", ");const l=i.map(((e,t)=>{const a=e.trim().replace(/^["']|["']$/g,"");if(!a)return null;return n(o,{key:t},t>0?", ":"",n("span",{style:{padding:"2px 8px",backgroundColor:"#e5e7eb",border:"1px solid #d1d5db",borderRadius:"4px",fontFamily:"monospace",fontSize:"13px",whiteSpace:"nowrap"}},a))}));return n(o,null,a,...l)};return n("li",{key:t,style:{marginBottom:"4px",fontSize:"14px"}},a(e))}))):n("p",{style:{margin:"0",color:"#155724",fontSize:"14px"}},a))))};const V=(e,t)=>{if(e===null||e===undefined){return n("div",{className:"epkb-score-badge epkb-score-badge--not-analyzed"},n("div",{style:{fontSize:"12px",color:"#666"}},t),n("div",{style:{fontSize:"14px",fontWeight:"bold",color:"#666"}},i("Not Analyzed","echo-knowledge-base")))}const a=parseInt(e)||0;let s="";let o="";if(a>=80){s="#46b450";o="rgba(70, 180, 80, 0.1)"}else if(a>=60){s="#f0ad4e";o="rgba(240, 173, 78, 0.1)"}else{s="#d54e21";o="rgba(213, 78, 33, 0.1)"}return n("div",{className:"epkb-score-badge",style:{backgroundColor:o,border:`2px solid ${s}`}},n("div",{style:{fontSize:"12px",color:"#666"}},t),n("div",{style:{fontSize:"17px",fontWeight:"bold",color:s}},e+"%"))};return n("div",{className:"epkb-ai-analysis-details-container",style:{padding:"20px",position:"relative"}},n("style",{},`\n\t\t\t\t@keyframes spin {\n\t\t\t\t\tfrom { transform: rotate(0deg); }\n\t\t\t\t\tto { transform: rotate(360deg); }\n\t\t\t\t}\n\t\t\t`),y?n("div",{className:"epkb-ai-analysis-details-loading",style:{padding:"40px",textAlign:"center"}},n("div",{className:"spinner is-active",style:{float:"none"}}),n("p",null,i("Loading analysis details...","echo-knowledge-base"))):!g?n("div",{className:"epkb-ai-analysis-details-empty",style:{padding:"40px",textAlign:"center"}},n("p",null,i("No analysis details available for this article.","echo-knowledge-base"))):n(o,null,n("div",{className:"epkb-ai-details-nav",style:{marginBottom:"20px",marginLeft:"20px",display:"flex",justifyContent:"space-between",alignItems:"center"}},n("div",{style:{display:"flex",gap:"15px",alignItems:"center"}},n("div",{style:{display:"inline-flex",gap:"0",border:"1px solid #E5E6E7",backgroundColor:"#FFFFFF",borderRadius:"8px",overflow:"hidden"}},["tags","readability","content_gaps"].map(((e,t)=>n("button",{key:e,className:`epkb-ai-section-tab ${b===e?"active":""}`,onClick:()=>m(e),style:{padding:"12px 24px",border:"none",borderRight:t<2?"1px solid #E5E6E7":"none",backgroundColor:b===e?"#F0F8FF":"#FFFFFF",borderBottom:b===e?"3px solid #0073AA":"3px solid transparent",color:b===e?"#0073AA":"#555555",cursor:"pointer",fontSize:"14px",fontWeight:b===e?"600":"400",transition:"all 0.2s ease"},onMouseEnter:t=>{if(b!==e){t.target.style.backgroundColor="#F0F8FF";t.target.style.color="#0073AA"}},onMouseLeave:t=>{if(b!==e){t.target.style.backgroundColor="#FFFFFF";t.target.style.color="#555555"}}},e==="tags"?(()=>{const e=g&&g.scoreComponents||r&&r.scoreComponents||[];const t=e.find((e=>e.name==="Tags Usage"));if(t&&t.value&&t.value!=="-"&&t.value!=="Analyzing..."){const e=parseInt(t.value)||0;let a="#666";if(e>=80){a="#46b450"}else if(e>=60){a="#f0ad4e"}else{a="#d54e21"}return n("span",null,i("Tags","echo-knowledge-base")," ",n("span",{style:{color:a,fontWeight:"bold",marginLeft:"4px"}},`(${t.value}%)`))}return i("Tags","echo-knowledge-base")})():e==="readability"?(()=>{const e=g&&g.readability_analysis;if(e&&e.status==="analyzed"&&e.score!==undefined&&e.score!==null){const t=parseInt(e.score)||0;let a="#666";if(t>=80){a="#46b450"}else if(t>=60){a="#f0ad4e"}else{a="#d54e21"}return n("span",null,i("Readability","echo-knowledge-base")," ",n("span",{style:{color:a,fontWeight:"bold",marginLeft:"4px"}},`(${t}%)`))}return i("Readability","echo-knowledge-base")})():e==="content_gaps"?(()=>{const e=g&&g.gap_analysis;if(e&&e.status==="analyzed"&&e.score!==undefined&&e.score!==null){const t=parseInt(e.score)||0;let a="#666";if(t>=80){a="#46b450"}else if(t>=60){a="#f0ad4e"}else{a="#d54e21"}return n("span",null,i("Content Gaps","echo-knowledge-base")," ",n("span",{style:{color:a,fontWeight:"bold",marginLeft:"4px"}},`(${t}%)`))}return i("Content Gaps","echo-knowledge-base")})():i("Readability","echo-knowledge-base"))))),n("a",{href:r.edit_link||(typeof ajaxurl!=="undefined"?ajaxurl.replace("/wp-admin/admin-ajax.php","/wp-admin/post.php"):window.location.origin+window.location.pathname.split("/").slice(0,-1).join("/")+"/wp-admin/post.php")+`?post=${r.id}&action=edit`,target:"_blank",className:"epkb-article-action-link",style:{display:"inline-flex",alignItems:"center",gap:"6px",textDecoration:"none",color:"#0073aa",fontSize:"14px",fontWeight:"600",padding:"6px 12px",borderRadius:"4px",transition:"all 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f0f6fc";e.currentTarget.style.textDecoration="underline"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent";e.currentTarget.style.textDecoration="none"}},n("span",{className:"dashicons dashicons-edit",style:{fontSize:"16px"}}),i("Edit Article","echo-knowledge-base")),n("a",{href:r.view_link||(typeof ajaxurl!=="undefined"?ajaxurl.replace("/wp-admin/admin-ajax.php",""):window.location.origin+window.location.pathname.split("/").slice(0,-1).join("/"))+`/?p=${r.id}`,target:"_blank",className:"epkb-article-action-link",style:{display:"inline-flex",alignItems:"center",gap:"6px",textDecoration:"none",color:"#0073aa",fontSize:"14px",fontWeight:"600",padding:"6px 12px",borderRadius:"4px",transition:"all 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f0f6fc";e.currentTarget.style.textDecoration="underline"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent";e.currentTarget.style.textDecoration="none"}},n("span",{className:"dashicons dashicons-visibility",style:{fontSize:"16px"}}),i("View Article","echo-knowledge-base"))),n("div",{className:"epkb-score-importance-container"},V(g.score!==null&&g.score!==undefined?g.score:r.score!==null&&r.score!==undefined?r.score:null,i("Overall Score","echo-knowledge-base")),n("div",{className:"epkb-article-importance-container"},n("div",{style:{fontSize:"12px",color:"#666"}},i("Article Importance","echo-knowledge-base")),n("div",{className:"epkb-importance-progress-bar"},n("div",{className:"epkb-importance-progress-fill",style:{width:`${g.importance||r.importance}%`}}),n("div",{className:"epkb-importance-progress-text"},`${g.importance||r.importance}%`))))),n("div",{className:"epkb-ai-analysis-details-content",style:{marginLeft:"20px"}},b==="readability"&&n("div",{className:"epkb-ai-readability-section",style:{display:"flex",gap:"20px",minHeight:"500px",alignItems:"stretch"}},n("div",{className:"epkb-readability-main-content",style:{flex:1,display:"flex",flexDirection:"column",gap:"20px",backgroundColor:"#ffffff",padding:"20px",borderRadius:"6px",border:"1px solid #e5e7eb",overflowY:"auto",position:"relative"}},(()=>{const e=g&&g.readability_analysis;if(e&&e.status==="analyzed"){const t=e.issues||[];const a=t.length>0;return n(o,null,n("button",{className:"button button-secondary epkb-ai-reanalyze-button",disabled:S,onClick:async()=>{l();C(true);f({...g,readability_analysis:{...g.readability_analysis,status:"pending"}});try{const e=await O("content-analysis-readability",{article_id:r.id});if(e&&e.success&&e.data){c(i("Readability analysis completed","echo-knowledge-base"));const t={...g,readability_analysis:e.data};if(e.data.updated_overall_score!==undefined){t.score=e.data.updated_overall_score}if(e.data.updated_score_components!==undefined){t.scoreComponents=e.data.updated_score_components}if(e.data.processed_content){t.processed_content=e.data.processed_content}if(e.data.issue_positions){t.issue_positions=e.data.issue_positions}f(t);sessionStorage.setItem(`epkb_analysis_details_${r.id}`,JSON.stringify({data:t,timestamp:Date.now(),article_id:r.id}))}else{p(i("Failed to run readability analysis","echo-knowledge-base"))}}catch(e){p(i("Failed to run readability analysis","echo-knowledge-base"))}finally{C(false)}}},S?[n("span",{key:"spinner",className:"dashicons dashicons-update",style:{animation:"spin 1s linear infinite",marginRight:"5px"}}),n("span",{key:"text"},i("Analyzing...","echo-knowledge-base"))]:[n("span",{key:"icon",className:"epkbfa epkbfa-refresh",style:{marginRight:"5px"}}),n("span",{key:"text"},i("Re-analyze","echo-knowledge-base"))]),a?t.map(((e,t)=>n("div",{key:t,className:"epkb-analysis-warning",style:{padding:"20px",backgroundColor:"#ffffff",border:"2px solid #ffc107",borderRadius:"6px",marginBottom:"15px",cursor:"pointer",transition:"background-color 0.2s ease"},onClick:()=>{R(t)},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#fffbf0"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#ffffff"}},n("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"}},n("span",{style:{fontSize:"24px",color:"#ff9800"}},"â ī¸"),n("div",{style:{flex:1}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 8px 0",color:"#856404"}},e.issue_type||"Issue"),e.problematic_text&&n("div",{style:{padding:"10px",backgroundColor:"#fff3cd",border:"1px solid #ffc107",borderRadius:"4px",marginBottom:"8px",fontFamily:"monospace",fontSize:"13px",whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:marked.parseInline(e.problematic_text)}}),e.explanation&&n("div",{style:{margin:"0",color:"#856404",fontSize:"14px",lineHeight:"1.6"},dangerouslySetInnerHTML:{__html:marked.parseInline(e.explanation)}})))))):n("div",{className:"epkb-analysis-success",style:{padding:"20px",backgroundColor:"#ffffff",border:"2px solid #28a745",borderRadius:"6px",marginBottom:"15px"}},n("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"}},n("span",{style:{fontSize:"24px",color:"#28a745"}},"â"),n("div",{style:{flex:1}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 8px 0",color:"#155724"}},i("Readability Analysis","echo-knowledge-base")),n("p",{style:{margin:"0",color:"#155724",fontSize:"14px"}},i("No readability issues found. The article is clear and well-written.","echo-knowledge-base"))))))}if(e&&e.status==="error"){return n("div",{style:{padding:"20px",backgroundColor:"#fff3cd",border:"2px solid #ffc107",borderRadius:"6px"}},n("h4",{style:{fontSize:"16px",fontWeight:"600",marginBottom:"10px",color:"#856404"}},i("Analysis Error","echo-knowledge-base")),n("p",{style:{margin:"0 0 15px 0",color:"#856404"}},e.error||i("An error occurred during readability analysis.","echo-knowledge-base")),S?n("div",{style:{textAlign:"center",marginTop:"10px"}},n("div",{className:"spinner is-active",style:{float:"none",margin:"0 auto"}}),n("p",{style:{fontSize:"14px",marginTop:"10px",color:"#856404"}},i("Retrying analysis...","echo-knowledge-base"))):n("button",{className:"button button-primary",onClick:async()=>{l();C(true);f({...g,readability_analysis:{...g.readability_analysis,status:"pending"}});try{const e=await O("content-analysis-readability",{article_id:r.id});if(e&&e.success&&e.data){c(i("Readability analysis completed","echo-knowledge-base"));const t={...g,readability_analysis:e.data};if(e.data.updated_overall_score!==undefined){t.score=e.data.updated_overall_score}if(e.data.updated_score_components!==undefined){t.scoreComponents=e.data.updated_score_components}f(t);sessionStorage.setItem(`epkb_analysis_details_${r.id}`,JSON.stringify({data:t,timestamp:Date.now(),article_id:r.id}));m("readability")}else{p(i("Failed to run readability analysis","echo-knowledge-base"))}}catch(e){p(i("Failed to run readability analysis","echo-knowledge-base"))}finally{C(false)}},style:{fontSize:"14px",padding:"8px 20px"}},i("Retry Analysis","echo-knowledge-base")))}return n("div",{style:{textAlign:"center",padding:"60px 20px"}},n("h3",{style:{fontSize:"20px",marginBottom:"20px",color:"#333"}},i("Readability Analysis","echo-knowledge-base")),S?n("div",{style:{marginBottom:"20px"}},n("div",{className:"spinner is-active",style:{float:"none",margin:"0 auto"}}),n("p",{style:{fontSize:"14px",marginTop:"15px",color:"#666"}},i("Analyzing article readability...","echo-knowledge-base"))):n("p",{style:{fontSize:"14px",marginBottom:"30px",color:"#666"}},i("Click the button below to analyze this article's readability using AI.","echo-knowledge-base")),!S&&n("button",{className:"epkb-run-readability-analysis-btn",onClick:async()=>{l();C(true);try{const e=await O("content-analysis-readability",{article_id:r.id});if(e&&e.success&&e.data){c(i("Readability analysis completed","echo-knowledge-base"));const t={...g,readability_analysis:e.data};if(e.data.updated_overall_score!==undefined){t.score=e.data.updated_overall_score}if(e.data.updated_score_components!==undefined){t.scoreComponents=e.data.updated_score_components}if(e.data.processed_content){t.processed_content=e.data.processed_content}if(e.data.issue_positions){t.issue_positions=e.data.issue_positions}f(t);sessionStorage.setItem(`epkb_analysis_details_${r.id}`,JSON.stringify({data:t,timestamp:Date.now(),article_id:r.id}));m("readability")}else{p(i("Failed to run readability analysis","echo-knowledge-base"))}}catch(e){p(i("Failed to run readability analysis","echo-knowledge-base"))}finally{C(false)}},style:{fontSize:"16px",padding:"12px 30px"}},i("Run Readability Analysis","echo-knowledge-base")))})()),n("div",{className:"epkb-readability-sidebar",style:{width:"50%",backgroundColor:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"6px",padding:"20px",display:"flex",flexDirection:"column",gap:"15px",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",overflowY:"auto"}},n("h4",{style:{fontSize:"15px",fontWeight:"600",margin:"0 0 15px 0",color:"#1e293b"}},i("Article Content","echo-knowledge-base")),(()=>{const e=g&&g.processed_content;if(!e){return n("p",{style:{color:"#999",fontSize:"13px",fontStyle:"italic"}},i("No article content available","echo-knowledge-base"))}const t=e=>{if(!e)return;if(!e.dataset.markersWrapped){const t=e.querySelectorAll("span[data-epkb-issue]");t.forEach((e=>{e.className="epkb-issue-marker";e.style.display="none";e.setAttribute("data-issue-index",e.getAttribute("data-epkb-issue"))}));e.dataset.markersWrapped="true"}const t=e.querySelectorAll(".epkb-highlighted-issue-text");t.forEach((e=>{const t=e.parentNode;while(e.firstChild){t.insertBefore(e.firstChild,e)}t.removeChild(e)}));if(T!==null&&T!==undefined){const t=e.querySelector(`.epkb-issue-marker[data-issue-index="${T}"]`);if(t){let e=t.nextSibling;while(e&&e.nodeType===Node.TEXT_NODE&&!e.textContent.trim()){e=e.nextSibling}if(e){const t=document.createElement("mark");t.className="epkb-highlighted-issue-text";t.style.backgroundColor="#ffc107";t.style.padding="2px 4px";t.style.borderRadius="2px";t.style.fontWeight="bold";if(e.nodeType===Node.TEXT_NODE){t.textContent=e.textContent;e.replaceWith(t)}else if(e.nodeType===Node.ELEMENT_NODE){t.innerHTML=e.innerHTML;e.replaceWith(t)}setTimeout((()=>{t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}),100)}}}};if(typeof marked!=="undefined"&&marked&&marked.parse){try{let a=marked.parse(e);return n("div",{className:"epkb-ai-processed-content-display",style:{fontSize:"13px",lineHeight:"1.6",color:"#333",wordBreak:"break-word"},ref:t,dangerouslySetInnerHTML:{__html:a}})}catch(e){console.error("Markdown parsing failed:",e)}}return n("div",{className:"epkb-ai-processed-content-display",style:{fontSize:"13px",lineHeight:"1.6",color:"#333",whiteSpace:"pre-wrap",wordBreak:"break-word"}},e)})())),b==="content_gaps"&&n("div",{className:"epkb-ai-content-gaps-section",style:{display:"flex",gap:"20px",minHeight:"500px",alignItems:"stretch"}},n("div",{className:"epkb-content-gaps-main-content",style:{flex:1,display:"flex",flexDirection:"column",gap:"20px",backgroundColor:"#ffffff",padding:"20px",borderRadius:"6px",border:"1px solid #e5e7eb",overflowY:"auto",position:"relative"}},(()=>{const e=g&&g.gap_analysis;if(e&&e.status==="analyzed"){const t=e.gaps||[];const a=t.length>0;return n(o,null,n("button",{className:"button button-secondary epkb-ai-reanalyze-button",disabled:A,onClick:async()=>{l();I(true);f({...g,gap_analysis:{...g.gap_analysis,status:"pending"}});try{const e=await O("content-analysis-gap-analysis",{article_id:r.id});if(e&&e.success&&e.data){c(i("Content Gaps analysis completed","echo-knowledge-base"));const t={...g,gap_analysis:e.data};if(e.data.updated_overall_score!==undefined){t.score=e.data.updated_overall_score}if(e.data.updated_score_components!==undefined){t.scoreComponents=e.data.updated_score_components}f(t);sessionStorage.setItem(`epkb_analysis_details_${r.id}`,JSON.stringify({data:t,timestamp:Date.now(),article_id:r.id}))}else{p(i("Failed to run Content Gaps analysis","echo-knowledge-base"))}}catch(e){p(i("Failed to run Content Gaps analysis","echo-knowledge-base"))}finally{I(false)}}},A?[n("span",{key:"spinner",className:"dashicons dashicons-update",style:{animation:"spin 1s linear infinite",marginRight:"5px"}}),n("span",{key:"text"},i("Analyzing...","echo-knowledge-base"))]:[n("span",{key:"icon",className:"epkbfa epkbfa-refresh",style:{marginRight:"5px"}}),n("span",{key:"text"},i("Re-analyze","echo-knowledge-base"))]),a?t.map(((e,t)=>n("div",{key:t,className:"epkb-analysis-warning",style:{padding:"20px",backgroundColor:"#ffffff",border:"2px solid #ffc107",borderRadius:"6px",marginBottom:"15px"}},n("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"}},n("span",{style:{fontSize:"24px",color:"#ff9800"}},"â ī¸"),n("div",{style:{flex:1}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 8px 0",color:"#856404"}},e.gap_type||"Gap"),e.text&&n("div",{style:{padding:"10px",backgroundColor:"#fff3cd",border:"1px solid #ffc107",borderRadius:"4px",marginBottom:"8px",fontFamily:"monospace",fontSize:"13px",whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:marked.parseInline(e.text)}}),e.analysis&&n("div",{style:{margin:"0",color:"#856404",fontSize:"14px",lineHeight:"1.6"},dangerouslySetInnerHTML:{__html:marked.parseInline(e.analysis)}})))))):n("div",{className:"epkb-analysis-success",style:{padding:"20px",backgroundColor:"#ffffff",border:"2px solid #28a745",borderRadius:"6px",marginBottom:"15px"}},n("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"}},n("span",{style:{fontSize:"24px",color:"#28a745"}},"â"),n("div",{style:{flex:1}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 8px 0",color:"#155724"}},i("Content Gaps Analysis","echo-knowledge-base")),n("p",{style:{margin:"0",color:"#155724",fontSize:"14px"}},i("No content gaps found. The article appears to be comprehensive.","echo-knowledge-base"))))))}if(e&&e.status==="error"){return n("div",{style:{padding:"20px",backgroundColor:"#fff3cd",border:"2px solid #ffc107",borderRadius:"6px"}},n("h4",{style:{fontSize:"16px",fontWeight:"600",marginBottom:"10px",color:"#856404"}},i("Analysis Error","echo-knowledge-base")),n("p",{style:{margin:"0 0 15px 0",color:"#856404"}},e.error||i("An error occurred during Content Gaps analysis.","echo-knowledge-base")),A?n("div",{style:{textAlign:"center",marginTop:"10px"}},n("div",{className:"spinner is-active",style:{float:"none",margin:"0 auto"}}),n("p",{style:{fontSize:"14px",marginTop:"10px",color:"#856404"}},i("Retrying analysis...","echo-knowledge-base"))):n("button",{className:"button button-primary",onClick:async()=>{l();I(true);f({...g,gap_analysis:{...g.gap_analysis,status:"pending"}});try{const e=await O("content-analysis-gap-analysis",{article_id:r.id});if(e&&e.success&&e.data){c(i("Content Gaps analysis completed","echo-knowledge-base"));const t={...g,gap_analysis:e.data};if(e.data.updated_overall_score!==undefined){t.score=e.data.updated_overall_score}if(e.data.updated_score_components!==undefined){t.scoreComponents=e.data.updated_score_components}f(t);sessionStorage.setItem(`epkb_analysis_details_${r.id}`,JSON.stringify({data:t,timestamp:Date.now(),article_id:r.id}));m("content_gaps")}else{p(i("Failed to run Content Gaps analysis","echo-knowledge-base"))}}catch(e){p(i("Failed to run Content Gaps analysis","echo-knowledge-base"))}finally{I(false)}},style:{fontSize:"14px",padding:"8px 20px"}},i("Retry Analysis","echo-knowledge-base")))}if(e&&e.status==="not_available"){return n("div",{style:{textAlign:"center",padding:"60px 20px"}},n("h3",{style:{fontSize:"20px",marginBottom:"20px",color:"#333"}},i("Content Gaps Analysis","echo-knowledge-base")),n("p",{style:{fontSize:"14px",marginBottom:"30px",color:"#666"}},e.message||i("Gap analysis is only available with AI Features add-on.","echo-knowledge-base")),n("a",{href:"https://www.echoknowledgebase.com/wordpress-add-ons/ai-features/",target:"_blank",rel:"noopener noreferrer",className:"button button-primary",style:{fontSize:"14px",padding:"10px 30px"}},i("Learn More About AI Features","echo-knowledge-base")))}return n("div",{style:{textAlign:"center",padding:"60px 20px"}},n("h3",{style:{fontSize:"20px",marginBottom:"20px",color:"#333"}},i("Content Gaps Analysis","echo-knowledge-base")),A?n("div",{style:{marginBottom:"20px"}},n("div",{className:"spinner is-active",style:{float:"none",margin:"0 auto"}}),n("p",{style:{fontSize:"14px",marginTop:"15px",color:"#666"}},i("Analyzing article for content gaps...","echo-knowledge-base"))):n("p",{style:{fontSize:"14px",marginBottom:"30px",color:"#666"}},i("Click the button below to analyze this article for missing content using AI.","echo-knowledge-base")),!A&&n("button",{className:"epkb-run-gap-analysis-btn",onClick:async()=>{l();I(true);try{const e=await O("content-analysis-gap-analysis",{article_id:r.id});if(e&&e.success&&e.data){c(i("Content Gaps analysis completed","echo-knowledge-base"));const t={...g,gap_analysis:e.data};if(e.data.updated_overall_score!==undefined){t.score=e.data.updated_overall_score}if(e.data.updated_score_components!==undefined){t.scoreComponents=e.data.updated_score_components}f(t);sessionStorage.setItem(`epkb_analysis_details_${r.id}`,JSON.stringify({data:t,timestamp:Date.now(),article_id:r.id}));m("content_gaps")}else{p(i("Failed to run Content Gaps analysis","echo-knowledge-base"))}}catch(e){p(i("Failed to run Content Gaps analysis","echo-knowledge-base"))}finally{I(false)}},style:{fontSize:"16px",padding:"12px 30px"}},i("Run Content Gaps Analysis","echo-knowledge-base")))})()),n("div",{className:"epkb-content-gaps-sidebar",style:{width:"50%",backgroundColor:"#ffffff",border:"1px solid #e5e7eb",borderRadius:"6px",padding:"20px",display:"flex",flexDirection:"column",gap:"15px",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",overflowY:"auto"}},n("h4",{style:{fontSize:"15px",fontWeight:"600",margin:"0 0 15px 0",color:"#1e293b"}},i("Article Content","echo-knowledge-base")),(()=>{const e=g&&g.processed_content||g&&g.gap_analysis&&g.gap_analysis.processed_content;if(!e){return n("p",{style:{color:"#999",fontSize:"13px",fontStyle:"italic"}},i("No article content available","echo-knowledge-base"))}if(typeof marked!=="undefined"&&marked&&marked.parse){try{let t=marked.parse(e);return n("div",{className:"epkb-ai-article-content-display",style:{fontSize:"13px",lineHeight:"1.6",color:"#333",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:t}})}catch(e){console.error("Markdown parsing failed:",e)}}return n("div",{className:"epkb-ai-article-content-display",style:{fontSize:"13px",lineHeight:"1.6",color:"#333",whiteSpace:"pre-wrap",wordBreak:"break-word"}},e)})())),b==="tags"&&n("div",{className:"epkb-ai-tags-section"},n("div",{className:"epkb-tags-main-content"},n("button",{className:"button button-secondary epkb-ai-reanalyze-button",disabled:N,onClick:async()=>{l();z(true);if(g.tag_analysis){f({...g,tag_analysis:{...g.tag_analysis,status:"pending"}})}try{const e=await O("content-analysis-tags",{article_id:r.id});if(e&&e.success&&e.data){c(i("Tags analysis completed","echo-knowledge-base"));const t={...g,tag_analysis:e.data.tag_analysis,current_tags:e.data.current_tags,suggested_tags:e.data.suggested_tags,recommended_tags:e.data.recommended_tags};if(e.data.updated_overall_score!==undefined){t.score=e.data.updated_overall_score}if(e.data.updated_score_components!==undefined){t.scoreComponents=e.data.updated_score_components}f(t);sessionStorage.setItem(`epkb_analysis_details_${r.id}`,JSON.stringify({data:t,timestamp:Date.now(),article_id:r.id}))}else{p(i("Failed to run tags analysis","echo-knowledge-base"))}}catch(e){p(i("Failed to run tags analysis","echo-knowledge-base"))}finally{z(false)}}},N?[n("span",{key:"spinner",className:"dashicons dashicons-update",style:{animation:"spin 1s linear infinite",marginRight:"5px"}}),n("span",{key:"text"},i("Analyzing...","echo-knowledge-base"))]:[n("span",{key:"icon",className:"epkbfa epkbfa-refresh",style:{marginRight:"5px"}}),n("span",{key:"text"},i("Re-analyze Tags","echo-knowledge-base"))]),g.tag_analysis?n(o,null,n(o,{key:"count"},Y(i("Tag Count","echo-knowledge-base"),g.tag_analysis.count_score,i("The number of tags is within the recommended range (3-10).","echo-knowledge-base"))),n(o,{key:"relevance"},(()=>{const e=!g.current_tags||g.current_tags.length===0;if(e){return n("div",{style:{padding:"20px",backgroundColor:"#ffffff",border:"2px solid #999",borderRadius:"6px",marginBottom:"15px"}},n("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"}},n("span",{style:{fontSize:"24px",color:"#666"}},"âšī¸"),n("div",{style:{flex:1}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 8px 0",color:"#333"}},i("Tag Relevance","echo-knowledge-base")),n("p",{style:{margin:"0",color:"#666",fontSize:"14px"}},i("Not Applicable due to missing tags","echo-knowledge-base")))))}return Y(i("Tag Relevance","echo-knowledge-base"),g.tag_analysis.relevance_score,i("All tags are relevant and appear in the article content.","echo-knowledge-base"))})()),n(o,{key:"format"},(()=>{const e=!g.current_tags||g.current_tags.length===0;if(e){return n("div",{style:{padding:"20px",backgroundColor:"#ffffff",border:"2px solid #999",borderRadius:"6px",marginBottom:"15px"}},n("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"}},n("span",{style:{fontSize:"24px",color:"#666"}},"âšī¸"),n("div",{style:{flex:1}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 8px 0",color:"#333"}},i("Tag Format","echo-knowledge-base")),n("p",{style:{margin:"0",color:"#666",fontSize:"14px"}},i("Not Applicable due to missing tags","echo-knowledge-base")))))}return Y(i("Tag Format","echo-knowledge-base"),g.tag_analysis.format_score,i("All tags are properly formatted and follow best practices.","echo-knowledge-base"))})()),n(o,{key:"duplicates"},(()=>{const e=!g.current_tags||g.current_tags.length===0;if(e){return n("div",{style:{padding:"20px",backgroundColor:"#ffffff",border:"2px solid #999",borderRadius:"6px",marginBottom:"15px"}},n("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"}},n("span",{style:{fontSize:"24px",color:"#666"}},"âšī¸"),n("div",{style:{flex:1}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 8px 0",color:"#333"}},i("Duplicate Tags","echo-knowledge-base")),n("p",{style:{margin:"0",color:"#666",fontSize:"14px"}},i("Not Applicable due to missing tags","echo-knowledge-base")))))}return Y(i("Duplicate Tags","echo-knowledge-base"),g.tag_analysis.duplicate_score,i("No duplicate or similar tags found.","echo-knowledge-base"))})()),n(o,{key:"categories"},Y(i("Categories","echo-knowledge-base"),g.tag_analysis.category_score,i("Article has the right number of categories (1-3).","echo-knowledge-base")))):null,(()=>{const e=g.suggested_tags&&(Array.isArray(g.suggested_tags)&&g.suggested_tags.length>0||typeof g.suggested_tags==="object"&&(g.suggested_tags.broad&&g.suggested_tags.broad.length>0||g.suggested_tags.specific&&g.suggested_tags.specific.length>0));const t=g.recommended_tags&&g.recommended_tags.find((e=>e.type==="ai_feature_required"));const a=g.recommended_tags&&g.recommended_tags.find((e=>e.type==="ai_no_suggestions"));if(!e&&!t&&!a){console.log("AI Tag Suggestions: Box hidden (no relevant AI data)");return null}const s=e=>{if(!e||!Array.isArray(e)||e.length===0){return null}return e.map(((e,t)=>{const a=typeof e==="string"?e:e.name;const s=w.includes(a);const o=g.current_tags&&g.current_tags.some((e=>(e.name||e)===a));return n("div",{key:t,className:"epkb-suggested-tag-item",style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",backgroundColor:o?"#e0e0e0":s?"#d4edda":"#ffffff",border:"1px solid "+(o?"#999":s?"#28a745":"#0073aa"),borderRadius:"4px"}},n("span",{style:{fontSize:"14px",color:o?"#666":"#1e293b",textDecoration:o?"line-through":"none"}},a),o?n("span",{style:{fontSize:"11px",color:"#666",fontStyle:"italic"}},"(existing)"):s?n("span",{style:{fontSize:"11px",color:"#28a745",fontWeight:"bold"}},"â Added"):n("button",{className:"button button-small",onClick:()=>K(a),style:{padding:"4px 12px",fontSize:"12px",backgroundColor:"#28a745",borderColor:"#28a745",color:"#fff",cursor:"pointer",fontWeight:"bold"}},i("Add","echo-knowledge-base")))}))};const o=typeof g.suggested_tags==="object"&&!Array.isArray(g.suggested_tags)&&(g.suggested_tags.broad||g.suggested_tags.specific);return n("div",{className:"epkb-suggested-tags-section",style:{marginTop:"20px",padding:"20px",backgroundColor:"#f0f8ff",border:"2px solid #0073aa",borderRadius:"6px"}},n("h4",{style:{fontSize:"16px",fontWeight:"600",margin:"0 0 15px 0",color:"#0073aa",display:"flex",alignItems:"center",gap:"8px"}},n("span",{style:{fontSize:"20px"}},"đĄ"),i("AI-Powered Tag Suggestions","echo-knowledge-base")),!e&&t?[n("p",{key:"subtitle",style:{fontSize:"14px",color:"#555",margin:"0 0 15px 0"}},i("Based on AI content analysis, consider adding these tags:","echo-knowledge-base")),n("div",{key:"message",style:{padding:"15px",backgroundColor:"#fff8e5",border:"1px solid #ffba00",borderRadius:"4px"}},n("p",{style:{fontSize:"14px",color:"#856404",margin:"0",lineHeight:"1.6"}},t.message||i("Get the AI Features add-on to unlock AI-powered tag suggestions.","echo-knowledge-base")))]:!e&&a?[n("p",{key:"subtitle",style:{fontSize:"14px",color:"#555",margin:"0 0 15px 0"}},i("Based on AI content analysis, consider adding these tags:","echo-knowledge-base")),n("div",{key:"message",style:{padding:"15px",backgroundColor:"#e3f2fd",border:"1px solid #0073aa",borderRadius:"4px"}},n("p",{style:{fontSize:"14px",color:"#004085",margin:"0",lineHeight:"1.6"}},a.message||i("No tag suggestions available for this article at this time.","echo-knowledge-base")))]:[n("p",{key:"subtitle",style:{fontSize:"14px",color:"#555",margin:"0 0 15px 0"}},i("Based on AI content analysis, consider adding these tags:","echo-knowledge-base")),o?[g.suggested_tags.broad&&g.suggested_tags.broad.length>0?n("div",{key:"broad-section",style:{marginBottom:"20px"}},n("h5",{style:{fontSize:"14px",fontWeight:"600",margin:"0 0 10px 0",color:"#0073aa",display:"flex",alignItems:"center",gap:"6px"}},n("span",{style:{fontSize:"16px"}},"đ"),i("Broad Tags","echo-knowledge-base"),n("span",{style:{fontSize:"12px",fontWeight:"normal",color:"#666",marginLeft:"4px"}},i("(General categories)","echo-knowledge-base"))),n("div",{className:"epkb-suggested-tags-list",style:{display:"flex",flexWrap:"wrap",gap:"10px"}},s(g.suggested_tags.broad))):null,g.suggested_tags.specific&&g.suggested_tags.specific.length>0?n("div",{key:"specific-section"},n("h5",{style:{fontSize:"14px",fontWeight:"600",margin:"0 0 10px 0",color:"#0073aa",display:"flex",alignItems:"center",gap:"6px"}},n("span",{style:{fontSize:"16px"}},"đ¯"),i("Specific Tags","echo-knowledge-base"),n("span",{style:{fontSize:"12px",fontWeight:"normal",color:"#666",marginLeft:"4px"}},i("(Detailed topics)","echo-knowledge-base"))),n("div",{className:"epkb-suggested-tags-list",style:{display:"flex",flexWrap:"wrap",gap:"10px"}},s(g.suggested_tags.specific))):null]:n("div",{key:"tags-list",className:"epkb-suggested-tags-list",style:{display:"flex",flexWrap:"wrap",gap:"10px"}},s(g.suggested_tags))])})()),n("div",{className:"epkb-tags-sidebar"},n("h4",{className:"epkb-tags-heading"},n("span",{className:"epkbfa epkbfa-tag epkb-tags-heading-icon"}),i("Article Tags","echo-knowledge-base")),n("div",{className:"epkb-sidebar-tags-list"},g.current_tags&&g.current_tags.length>0?g.current_tags.map((e=>{const t={id:e.id||e.term_id,name:e.name||e,issues:e.issues||[]};const a=k.includes(t.id);const s=!t.issues||t.issues.length===0;const o=x&&x.id===t.id;return n("div",{key:t.id,className:"epkb-sidebar-tag-item-wrapper"},n("span",{style:{fontSize:"14px",fontWeight:"bold",color:s?"#059669":"#666",minWidth:"18px",flexShrink:0}},s?"â":""),n("div",{className:"epkb-sidebar-tag-item"+(a?" is-marked-for-deletion":""),onClick:()=>h(t),onMouseEnter:null,onMouseLeave:null},t.name.replace(/^["']|["']$/g,"")),n("button",{onClick:e=>{e.stopPropagation();j(t.id)},className:a?"epkb-button-restore":"epkb-button-delete",title:a?i("Restore tag","echo-knowledge-base"):i("Mark for deletion","echo-knowledge-base")},a?"âļ":"Ã"))})):n("p",{className:"note"},i("No tags","echo-knowledge-base")),w.map(((e,t)=>n("div",{key:"new-"+t,className:"epkb-sidebar-tag-item-wrapper new"},n("span",{style:{fontSize:"14px",fontWeight:"bold",color:"#0284c7",minWidth:"18px",flexShrink:0}},"+"),n("div",{className:"epkb-sidebar-tag-item new",style:{display:"inline-block",padding:"4px 12px",backgroundColor:"#e0f2fe",border:"1px solid #0ea5e9",borderRadius:"3px",cursor:"pointer",transition:"background-color 0.2s ease",fontSize:"13px",color:"#1e293b"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#bae6fd"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#e0f2fe"}},e.replace(/^["']|["']$/g,"")),n("button",{onClick:()=>q(t),className:"epkb-button-remove",title:i("Remove tag","echo-knowledge-base")},"Ã"))))),n("div",{className:"epkb-sidebar-add-tag",style:{borderTop:"1px solid #e5e7eb",paddingTop:"15px",marginBottom:"20px"}},n("label",{className:"epkb-add-tag-heading"},n("span",{className:"epkbfa epkbfa-plus epkb-add-tag-heading-icon"}),i("Add New Tag","echo-knowledge-base")),n("div",{className:"controls"},n("input",{type:"text",className:"epkb-sidebar-new-tag-input",placeholder:i("Tag name","echo-knowledge-base"),style:{},onKeyDown:e=>{if(e.key==="Enter"){const t=e.target;if(t.value.trim()){K(t.value.trim());t.value=""}}}}),n("button",{className:"button button-primary add-btn",onClick:()=>{const e=document.querySelector(".epkb-sidebar-new-tag-input");if(e&&e.value.trim()){K(e.value.trim());e.value=""}}},"+"))),n("div",{className:"epkb-tag-best-practices",style:{padding:"15px",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",marginBottom:"20px"}},n("h5",{style:{fontSize:"14px",fontWeight:"600",margin:"0 0 12px 0",color:"#1e293b"}},i("Tag Best Practices","echo-knowledge-base")),n("div",{style:{fontSize:"13px",lineHeight:"1.6",color:"#555"}},n("p",{style:{margin:"0 0 10px 0",fontWeight:"600"}},i("Guidelines:","echo-knowledge-base")),n("ul",{style:{margin:"0 0 12px 0",paddingLeft:"20px"}},n("li",{style:{marginBottom:"6px"}},n("strong",{},i("Relevant & Keyword-Rich:","echo-knowledge-base"))," ",i("Use descriptive tags matching content and search terms.","echo-knowledge-base")),n("li",{style:{marginBottom:"6px"}},n("strong",{},i("Avoid Duplicates:","echo-knowledge-base"))," ",i("Don't reuse category names as tags (or vice versa).","echo-knowledge-base")),n("li",{style:{marginBottom:"6px"}},n("strong",{},i("Reuse Consistently:","echo-knowledge-base"))," ",i('Stick to a strategy; avoid unique tags per post to prevent "tag bloat" (thin pages hurt SEO). Tags should group multiple posts; noindex thin archives (â¤2 posts).',"echo-knowledge-base")),n("li",{style:{marginBottom:"6px"}},n("strong",{},i("Keep Short:","echo-knowledge-base"))," ",i("1â3 words, reusable.","echo-knowledge-base"))),n("p",{style:{margin:"0 0 8px 0",fontWeight:"600"}},i("Editor Checklist:","echo-knowledge-base")),n("ul",{style:{margin:"0",paddingLeft:"20px"}},n("li",{style:{marginBottom:"6px"}},i("Groups âĨ3 posts (now or soon)?","echo-knowledge-base")),n("li",{style:{marginBottom:"6px"}},i("1â3 words, distinct from existing tags/categories?","echo-knowledge-base")),n("li",{style:{marginBottom:"6px"}},i("Merge synonyms instead of new tags?","echo-knowledge-base")),n("li",{style:{marginBottom:"0"}},i("Noindex if thin; index if substantial with description?","echo-knowledge-base"))))),n("p",{className:"note"},i("Note: Saving will update tag archive page redirects (optional)","echo-knowledge-base")),n("button",{className:"button button-primary save-btn",onClick:J,disabled:k.length===0&&w.length===0,style:{opacity:k.length===0&&w.length===0?.5:1}},i("Save Changes","echo-knowledge-base")))))))};window.EPKB_AI_ContentAnalysisDetails=r})();
Save
Cancel