PageSourceSearch

https://9rank.ai/_next/static/chunks/9450-2ec2d3502b3ac0b1.js

js 9rank.ai collected 2026-10-05 15:15:26 UTC 94,528 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9450],{29450:(e,t,r)=>{r.r(t),r.d(t,{default:()=>ew});var a=r(95155),s=r(12115),n=r(60007),l=r(77711),o=r(15382),i=r(27058),d=r(73312),c=r(69962),m=r(51680),u=r(34072),x=r(20652),p=r(41983),g=r(68726),h=r(25012),f=r(15325),b=r(48694),v=r(689),w=r(66121),j=r(52488),y=r(32645),N=r(10319),k=r(65754),C=r(53149),_=r(22187),S=r(71031),A=r(22783),z=r(11715),R=r(35524),T=r(26848),M=r(13261),E=r(85592),L=r(46854),I=r(84869),D=r(4683),F=r(74094),P=r(2517),U=r(37195),B=r(31342),H=r(654),O=r(97752),q=r(70632),$=r(21567),W=r(62884),V=r(62338),G=r(65564),Y=r(25121),X=r(3343),Q=r(87081),J=r(75828);let Z=(0,J.createServerReference)("60e629f8a9ef69c3cc19ba5cb16db164e732d046d9",J.callServer,void 0,J.findSourceMapURL,"generatePlagiarismReportAction"),K=(0,J.createServerReference)("604abfcdaa178c918f488a639e6339380610c1673f",J.callServer,void 0,J.findSourceMapURL,"performPlagiarismCheckAction");var ee=r(92067);let et=(0,J.createServerReference)("70d98c04b95f15a4cf2e4041e39e27ac2c91b86639",J.callServer,void 0,J.findSourceMapURL,"performBulkItemCheckAction");var er=r(5681),ea=r(22190),es=r(33900),en=r(33621),el=r(59173),eo=r(46754),ei=r(14326);let ed=(0,l.default)(()=>Promise.all([r.e(2833),r.e(5869)]).then(r.bind(r,35869)).then(e=>e.LexicalEditor),{loadableGenerated:{webpack:()=>[35869]},ssr:!1,loading:()=>(0,a.jsx)(Q.E,{className:"h-[250px] w-full"})}),ec=e=>e.trim().split(/\s+/).filter(Boolean).length,em=e=>e<=500?1:e<=2e3?3:e<=5e3?5:e<=1e4?10:20,eu="copy-checker-draft",ex=[{bg:"#fef08a",text:"#713f12",border:"#eab308",dark_bg:"rgba(234,179,8,0.3)",dark_text:"#fef9c3"},{bg:"#fed7aa",text:"#7c2d12",border:"#f97316",dark_bg:"rgba(249,115,22,0.3)",dark_text:"#ffedd5"},{bg:"#fca5a5",text:"#7f1d1d",border:"#ef4444",dark_bg:"rgba(239,68,68,0.3)",dark_text:"#fee2e2"},{bg:"#d9f99d",text:"#365314",border:"#84cc16",dark_bg:"rgba(132,204,22,0.3)",dark_text:"#ecfccb"},{bg:"#bfdbfe",text:"#1e3a8a",border:"#3b82f6",dark_bg:"rgba(59,130,246,0.3)",dark_text:"#dbeafe"},{bg:"#ddd6fe",text:"#4c1d95",border:"#8b5cf6",dark_bg:"rgba(139,92,246,0.3)",dark_text:"#ede9fe"},{bg:"#fbcfe8",text:"#831843",border:"#ec4899",dark_bg:"rgba(236,72,153,0.3)",dark_text:"#fce7f3"},{bg:"#a5f3fc",text:"#164e63",border:"#06b6d4",dark_bg:"rgba(6,182,212,0.3)",dark_text:"#cffafe"},{bg:"#99f6e4",text:"#134e4a",border:"#14b8a6",dark_bg:"rgba(20,184,166,0.3)",dark_text:"#ccfbf1"},{bg:"#e9d5ff",text:"#4a044e",border:"#a855f7",dark_bg:"rgba(168,85,247,0.3)",dark_text:"#f3e8ff"}],ep=["Initializing plagiarism scanner...","Analyzing document structure...","Querying 100 billion+ web pages...","Performing exact and fuzzy matching...","Evaluating semantic similarities...","Extracting matched source URLs...","Finalizing plagiarism report..."],eg=e=>{let{percentPlagiarized:t,totalSentences:r,plagiarizedSentences:n,isAiFallback:l}=e,o=Math.round(100-(Number.isFinite(t)?t:0)),i=o>=80,d=o>
1=50,[u,x]=(0,s.useState)(0),[p,g]=(0,s.useState)(0);(0,s.useEffect)(()=>{x(0),g(0);let e=0,t=setInterval(()=>{let r=1-Math.pow(1-++e/60,3);x(Math.round(r*o)),g(r*o),e>=60&&clearInterval(t)},20);return()=>clearInterval(t)},[o]);let h=2*Math.PI*38,f=p/100*h,b=i?"#22c55e":d?"#eab308":"#ef4444";return(0,a.jsxs)("div",{className:(0,$.cn)("shrink-0 border-b",i?"border-green-500/20":d?"border-yellow-500/20":"border-red-500/20"),children:[(0,a.jsxs)("div",{className:(0,$.cn)("bg-gradient-to-br p-4 relative overflow-hidden",i?"from-green-500/[0.07] to-emerald-500/[0.03]":d?"from-yellow-500/[0.07] to-amber-500/[0.03]":"from-red-500/[0.07] to-rose-500/[0.03]"),children:[(0,a.jsx)("div",{className:"absolute -top-6 -right-6 w-28 h-28 rounded-full blur-2xl pointer-events-none",style:{background:i?"rgba(34,197,94,0.25)":d?"rgba(234,179,8,0.25)":"rgba(239,68,68,0.25)"}}),(0,a.jsxs)("div",{className:"relative flex items-center gap-4",children:[(0,a.jsxs)("div",{className:"relative shrink-0",style:{width:96,height:96},children:[(0,a.jsxs)("svg",{width:96,height:96,viewBox:"0 0 ".concat(96," ").concat(96),overflow:"visible",className:"absolute inset-0 -rotate-90",children:[(0,a.jsx)("circle",{cx:48,cy:48,r:38,fill:"none",strokeWidth:8,stroke:"currentColor",style:{opacity:.12}}),(0,a.jsx)("circle",{cx:48,cy:48,r:38,fill:"none",strokeWidth:8,stroke:b,strokeLinecap:"round",strokeDasharray:"".concat(f," ").concat(h),style:{transition:"stroke-dasharray 0.05s linear",filter:"drop-shadow(0 0 5px ".concat(b,"99)")}})]}),(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,a.jsx)("span",{className:"text-2xl font-black tabular-nums leading-none",style:{color:b},children:u}),(0,a.jsx)("span",{className:"text-[10px] font-bold text-muted-foreground/70 tracking-widest uppercase mt-0.5",children:"%"})]})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-bold text-sm text-foreground leading-tight",children:i?"Mostly Original":d?"Partially Plagiarized":"High Plagiarism"}),(0,a.jsxs)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:[n," of ",r," sentences matched"]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,a.jsxs)("span",{className:(0,$.cn)("inline-flex items-center gap-1 text-[10px] font-semibold px-2 py-0.5 rounded-full border",i?"bg-green-500/10 border-green-500/25 text-green-400":d?"bg-yellow-500/10 border-yellow-500/25 text-yellow-400":"bg-red-500/10 border-red-500/25 text-red-400"),children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:b}}),t.toFixed(1),"% matched"]}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold px-2 py-0.5 rounded-full border border-border/50 bg-muted/30 text-muted-foreground",children:[r," sentences"]})]}),(0,a.jsx)("div",{className:"h-[3px] rounded-full bg-foreground
1/10 overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-full transition-all duration-[1200ms] ease-out",style:{width:"".concat(p,"%"),background:"linear-gradient(90deg, ".concat(b,"99, ").concat(b,")")}})})]}),(0,a.jsx)("div",{className:(0,$.cn)("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center border",i?"bg-green-500/10 border-green-500/25":"bg-red-500/10 border-red-500/25"),children:i?(0,a.jsx)(c.A,{className:"w-5 h-5 text-green-500"}):(0,a.jsx)(m.A,{className:"w-5 h-5 text-red-500"})})]})]}),l&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 bg-amber-500/10 border-t border-amber-500/20 text-amber-500",children:[(0,a.jsx)("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M12 2a10 10 0 100 20A10 10 0 0012 2z"})}),(0,a.jsx)("span",{className:"text-[11px] font-semibold",children:"AI Estimated — Deep scan unavailable, result is approximate"})]})]})},eh=e=>{let{uniqueScore:t,percentPlagiarized:r,totalSentences:n,plagiarizedSentences:l,wordCount:o,totalMatches:i,isClean:d,isMixed:u,isAiFallback:x}=e,[p,g]=(0,s.useState)(0),[h,f]=(0,s.useState)(0);(0,s.useEffect)(()=>{g(0),f(0);let e=0,r=setInterval(()=>{let a=1-Math.pow(1-++e/60,3);g(Math.round(a*t)),f(a*t),e>=60&&clearInterval(r)},20);return()=>clearInterval(r)},[t]);let b=2*Math.PI*35.5,v=h/100*b,w=d?"#22c55e":u?"#eab308":"#ef4444";return(0,a.jsxs)("div",{className:(0,$.cn)("shrink-0 border-b",d?"border-green-500/20":u?"border-yellow-500/20":"border-red-500/20"),children:[(0,a.jsxs)("div",{className:(0,$.cn)("bg-gradient-to-br p-4 relative overflow-hidden",d?"from-green-500/[0.07] to-emerald-500/[0.03]":u?"from-yellow-500/[0.07] to-amber-500/[0.03]":"from-red-500/[0.07] to-rose-500/[0.03]"),children:[(0,a.jsx)("div",{className:"absolute -top-5 -right-5 w-24 h-24 rounded-full blur-2xl pointer-events-none",style:{background:d?"rgba(34,197,94,0.2)":u?"rgba(234,179,8,0.2)":"rgba(239,68,68,0.2)"}}),(0,a.jsxs)("div",{className:"relative flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"relative shrink-0",style:{width:88,height:88},children:[(0,a.jsxs)("svg",{width:88,height:88,viewBox:"0 0 ".concat(88," ").concat(88),overflow:"visible",className:"absolute inset-0 -rotate-90",children:[(0,a.jsx)("circle",{cx:44,cy:44,r:35.5,fill:"none",strokeWidth:7,stroke:"currentColor",className:"opacity-10"}),(0,a.jsx)("circle",{cx:44,cy:44,r:35.5,fill:"none",strokeWidth:7,stroke:w,strokeLinecap:"round",strokeDasharray:"".concat(v," ").concat(b),style:{transition:"stroke-dasharray 0.05s linear",filter:"drop-shadow(0 0 4px ".concat(w,"99)")}})]}),(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,a.jsx)("span",{className:"text-xl font-black tabular-nums leading-none",style:{color:w},children:p}),(0,a.jsx)("span",{className:"text-[9px] font-bold text-muted-foreground/70 tracking-widest uppercase",children:"%"})]})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 space-y-1.5",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-bold text-sm text-foreground leading-tight",children:d?"Mostly Original":u?"Partially Plagiarized":"High Plagiarism Detected"}),(0,a.jsxs)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:[l," of ",n," matched"]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,a.jsxs)("span",{className:(0,$.cn)("inline-flex items-center gap-1 text-[10px] font-semibold px-2 py-0.5 rounded-full border",d?"bg-green-500/10 border-green-500/25 text-green-400":u?"bg-yellow-500/10 border-yellow-500/25 text-yellow-400":"bg-red-500/10 border-red-500/25 text-red-400"),children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:w}}),r.toFixed(1),"%"]}),o&&(0,a.jsxs)("span",{className:"inline-flex items-center text-[10px] font-semibold px-2 py-0.5 rounded-full border border-border/50 bg-muted/30 text-muted-foreground",children:[o.toLocaleString()," words"]}),(0,a.jsxs)("span",{className:"inline-flex items-center text-[10px] font-semibold px-2 py-0.5 rounded-full border border-border/50 bg-muted/30 text-muted-foreground",children:[i," sources"]})]}),(0,a.jsx)("div",{className:"h-[3px] rounded-full bg-foreground
1/10 overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-full transition-all duration-[1200ms] ease-out",style:{width:"".concat(h,"%"),background:"linear-gradient(90deg, ".concat(w,"99, ").concat(w,")")}})})]}),(0,a.jsx)("div",{className:(0,$.cn)("shrink-0 w-8 h-8 rounded-xl flex items-center justify-center border",d?"bg-green-500/10 border-green-500/25":"bg-red-500/10 border-red-500/25"),children:d?(0,a.jsx)(c.A,{className:"w-4 h-4 text-green-500"}):(0,a.jsx)(m.A,{className:"w-4 h-4 text-red-500"})})]})]}),x&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 bg-amber-500/10 border-t border-amber-500/20 text-amber-500",children:[(0,a.jsx)("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M12 2a10 10 0 100 20A10 10 0 0012 2z"})}),(0,a.jsx)("span",{className:"text-[11px] font-semibold",children:"AI Estimated — result is approximate"})]})]})},ef=()=>{let[e,t]=(0,s.useState)(0);return(0,s.useEffect)(()=>{let e=setInterval(()=>t(e=>(e+1)%ep.length),1500);return()=>clearInterval(e)},[]),(0,a.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center space-y-6 max-w-sm px-4",children:[(0,a.jsxs)("div",{className:"relative w-20 h-20 mx-auto",children:[(0,a.jsx)("div",{className:"absolute inset-0 border-4 border-muted rounded-full"}),(0,a.jsx)("div",{className:"absolute inset-0 border-4 border-primary rounded-full border-t-transparent animate-spin"}),(0,a.jsx)(u.A,{className:"w-8 h-8 absolute inset-0 m-auto text-primary animate-pulse"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:"Analyzing Content"}),(0,a.jsx)("p",{className:"text-sm text-primary font-medium animate-pulse",children:ep[e]})]}),(0,a.jsx)(el.k,{value:e/(ep.length-1)*100,className:"h-1.5"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Scanning against 100 billion+ web pages…"})]})})},eb=e=>{let{result:t,label:r,onDownload:n,onClose:l}=e,[o,i]=(0,s.useState)(null),[m,u]=(0,s.useState)(null),[k,C]=(0,s.useState)(!0),_=(0,s.useRef)(null),S=t.plagiarized_content.length,A=Math.round(100-(t.percent_plagiarized||0)),z=(0,s.useMemo)(()=>t.highlightedText?t.highlightedText.replace(RegExp("<mark([^>]*)>(.*?)<\\/mark>","gs"),(e,t,r)=>{var a,s;let n=(null===(a=t.match(/data-url="([^"]*?)"/))||void 0===a?void 0:a[1])||"",l=(null===(s=t.match(/data-domain="([^"]*?)"/))||void 0===s?void 0:s[1])||"";return n?"<mark".concat(t,">").concat(r,'</mark><a href="').concat(n,'" target="_blank" rel="noopener noreferrer" class="plag-src-chip" title="').concat(n,'">').concat(l,'<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="display:inline;vertical-align:middle;margin-left:1px"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg></a>'):"<mark".concat(t,">").concat(r,"</mark>")}):"",[t.highlightedText]),R=(0,s.useMemo)(()=>"mark.plagiarized-match{background-color:#fef08a;color:#713f12;border-bottom:2px solid #eab308;border-radius:3px;padding:1px 2px;cursor:pointer;transition:all .2s}.dark mark.plagiarized-match{background-color:rgba(234,179,8,0.25);color:#fef9c3;border-bottom-color:#facc15}"+t.plagiarized_content.map((e,t)=>{let r=ex[t%ex.length];return'mark.plagiarized-match[data-match-id="'.concat(t,'"]{background-color:').concat(r.bg,";color:").concat(r.text,";border-bottom-color:").concat(r.border,'}.dark mark.plagiarized-match[data-match-id="').concat(t,'"]{background-color:').concat(r.dark_bg,";color:").concat(r.dark_text,";border-bottom-color:").concat(r.border,"}")}).join("")+(null!==o?'mark.plagiarized-match:not([data-match-id="'.concat(o,'"]){opacity:.35}mark.plagiarized-match[data-match-id="').concat(o,'"]{outline:2px solid ').concat(ex[o%ex.length].border,";outline-offset:1px;opacity:1!important;font-weight:600}"):"")+(k?"":"mark.plagiarized-match,.plag-src-chip{display:none!important}"),[t.plagiarized_content,o,k]),T=(0,s.useCallback)(e=>{requestAnimationFrame(()=>{var t;let r=null===(t=_.current)||void 0===t?void 0:t.querySelector('mark.plagiarized-match[data-match-id="'.concat(e,'"]'));if(r&&_.current){let e=_.current.getBoundingClientRect().top,t=r.getBoundingClientRect().top,a=_.current.clientHeight/2;_.current.scrollTop+=t-e-a}})},[]),M=e=>{if(0===S)return;let t=null===o?"next"===e?0:S-1:"next"===e?(o+1)%S:(o-1+S)%S;i(t),u(t),T(t)}
1,[E,L]=(0,s.useState)(!1),I=(0,s.useRef)(null),D=(0,s.useRef)(0),F=(0,s.useCallback)(()=>{L(e=>(e?setTimeout(()=>{window.scrollTo({top:D.current,behavior:"smooth"})},50):(D.current=window.scrollY,window.scrollTo({top:0,behavior:"smooth"})),!e))},[]);return(0,s.useEffect)(()=>{if(!E)return;let e=e=>{"Escape"===e.key&&(L(!1),setTimeout(()=>{window.scrollTo({top:D.current,behavior:"smooth"})},50))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[E]),(0,a.jsxs)("div",{ref:I,className:"relative w-full",children:[E&&(0,a.jsxs)("button",{onClick:F,className:"fixed top-4 right-4 z-[60] flex items-center gap-2 px-3 py-2 rounded-xl bg-background/90 backdrop-blur-sm border border-border shadow-lg text-sm font-semibold text-foreground hover:bg-muted transition-all hover:scale-105",title:"Exit fullscreen (Esc)",children:[(0,a.jsx)(x.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Exit Fullscreen"})]}),(0,a.jsxs)("div",{className:"bg-background transition-all ".concat(E?"fixed inset-0 z-50 overflow-hidden flex flex-col":"border-t-2 border-primary/30"),children:[(0,a.jsx)("style",{children:"\n                .responsive-split-bulk {\n                    display: flex;\n                    flex-direction: column;\n                }\n                @media (min-width: 768px) {\n                    .responsive-split-bulk {\n                        flex-direction: row;\n                    }\n                    .responsive-split-bulk > .panel-left-bulk {\n                        flex: 1;\n                        min-width: 0;\n                        height: 100%;\n                    }\n                    .responsive-split-bulk > .panel-right-bulk {\n                        width: 320px;\n                        flex-shrink: 0;\n                        height: 100%;\n                    }\n                }\n            "}),(0,a.jsxs)("div",{className:"w-full overflow-hidden responsive-split-bulk",style:E?{flex:"1 1 0",height:"100%"}:{minHeight:"420px",maxHeight:"clamp(520px, 80vh, 800px)"},children:[(0,a.jsxs)("div",{className:"panel-left-bulk flex flex-col overflow-hidden border-b md:border-b-0 md:border-r border-border",style:{minHeight:"300px"},children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/40",style:{flexShrink:0},children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,a.jsx)(p.A,{className:"w-4 h-4 text-muted-foreground"}),(0,a.jsx)("span",{className:"truncate max-w-[220px]",title:r,children:r})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[S>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{onClick:()=>C(e=>!e),className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-medium transition-all border ".concat(k?"bg-yellow-100 dark:bg-yellow-900/30 border-yellow-300 dark:border-yellow-700 text-yellow-800 dark:text-yellow-300":"bg-muted border-border text-muted-foreground"),children:[(0,a.jsx)(g.A,{className:"w-3.5 h-3.5"}),k?"Highlights On":"Highlights Off"]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 bg-muted rounded-lg px-1 py-0.5",children:[(0,a.jsx)("button",{onClick:()=>M("prev"),className:"p-1 rounded hover:bg-background transition-colors",children:(0,a.jsx)(h.A,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums min-w-[56px] text-center",children:null!==o?"".concat(o+1," / ").concat(S):"".concat(S," match").concat(1!==S?"es":"")}),(0,a.jsx)("button",{onClick:()=>M("next"),className:"p-1 rounded hover:bg-background transition-colors",children:(0,a.jsx)(f.A,{className:"w-3.5 h-3.5"})})]})]}),(0,a.jsx)("button",{onClick:F,title:E?"Exit fullscreen (Esc)":"Expand to fullscreen",className:"p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:E?(0,a.jsx)(x.A,{className:"w-4 h-4"}):(0,a.jsx)(b.A,{className:"w-4 h-4"})}),(0,a.jsx)("button",{onClick:()=>{E?(L(!1),setTimeout(()=>{window.scrollTo({top:D.current,behavior:"smooth"}),l()},50)):l()},className:"p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Close view",children:(0,a.jsx)(v.A,{className:"w-4 h-4"})})]})]}),(0,a.jsxs)("div",{ref:_,style:{flex:"1 1 0",overflowY:"auto",overflowX:"hidden"},children:[(0,a.jsx)("style",{children:R}),(0,a.jsx)("style",{children:".plag-src-chip{display:inline-flex;align-items:center;gap:2px;margin-left:3px;padding:1px 6px;border-radius:100px;font-size:.68rem;font-weight:700;font-family:ui-monospace,monospace;text-decoration:none!important;background:rgba(0,0,0,.07);border:1px solid rgba(0,0,0,.16);color:#374151!important;cursor:pointer;vertical-align:middle;white-space:nowrap}.dark .plag-src-chip{background:rgba(255,255,255,.1);border-color:rgba(255,255,255,.2);color:#e2e8f0!important}"}),t.highlightedText?(0,a.jsx)("div",{className:"prose dark:prose-invert prose-sm max-w-none px-6 py-5 text-foreground font-body leading-[1.85] [&_p]:mb-4 [&_p]:text-[0.9rem]",dangerouslySetInnerHTML:{__html:z},onClick:e=>{let t=e.target.closest("mark[data-match-id]");if(t){let e=parseInt(t.getAttribute("data-match-id")||"0");i(e),u(e)}}}):(0,a.jsx)("div",{className:"p-8 text-sm text-muted-foreground italic",children:"No highlighted content available for this document."})]})]}),(0,a.jsxs)("div",{className:"panel-right-bulk flex flex-col overflow-hidden border-t md:border-t-0 md:border-l border-border w-full",children:[(0,a.jsx)(eh,{uniqueScore:A,percentPlagiarized:t.percent_plagiarized,totalSentences:t.total_sentences,plagiarizedSentences:t.plagiarized_sentences,wordCount:t.word_count,totalMatches:S,isClean:A>=80,isMixed:A>=50,isAiFallback:t.isAiFallback}),(0,a.jsx)("div",{style:{flex:"1 1 0",overflowY:"auto",overflowX:"hidden"},children:0===S?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center p-6 text-muted-foreground",children:[(0,a.jsx)(c.A,{className:"w-10 h-10 text-green-500 mb-3 opacity-70"}),(0,a.jsx)("p",{className:"font-semibold text-sm",children:"No sources detected"}),(0,a.jsx)("p",{className:"text-xs mt-1",children:"This document appears to be original."})]}):t.plagiarized_content.map((e,t)=>{let r=ex[t%ex.length],s=(()=>{try{return new URL(e.source_url).hostname.replace("www.","")}catch(t){return e.source_url}})(),n=o===t,l=m===t;return(0,a.jsxs)("div",{className:(0,$.cn)("transition-colors border-b border-border last:border-0",n?"bg-muted/50":"hover:bg-muted/20"),children:[(0,a.jsxs)("button",{className:"w-full text-left px-3 py-2.5 flex items-center gap-2.5",onClick:e=>{e.currentTarget.blur(),i(t),u(l?null:t)},children:[(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full shrink-0 mt-0.5",style:{backgroundColor:r.border}}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("img",{src:"https://www.google.com/s2/favicons?domain=".concat(s,"&sz=16"),alt:"",className:"w-3.5 h-3.5 rounded-sm shrink-0",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"text-sm font-medium truncate text-foreground",children:e.title||s})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:s}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground truncate italic",children:['"',(e.matched_text||e.text||"").slice(0,60),(e.matched_text||e.text||"").length>60?"…":"",'"']})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"p-1 rounded text-muted-foreground hover:text-primary transition-colors",children:(0,a.jsx)(w.A,{className:"w-3.5 h-3.5"})}),l?(0,a.jsx)(j.A,{className:"w-3.5 h-3.5 text-muted-foreground"}):(0,a.jsx)(y.A,{className:"w-3.5 h-3.5 text-muted-foreground"})]})]}),l&&(0,a.jsx)("div",{className:"px-3 pb-3",children:(0,a.jsxs)("div",{className:"rounded-lg p-3 space-y-2 border",style:{backgroundColor:r.bg+"33",borderColor:r.border+"55"},children:[(0,a.jsx)("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline break-all leading-tight block",children:e.source_url.length>70?e.source_url.slice(0,70)+"...":e.source_url}),(0,a.jsx)("p",{className:"text-xs font-semibold text-muted-foreground",children:"Matching sentence:"}),(0,a.jsxs)("p",{className:"text-xs leading-relaxed italic text-foreground
1/90",style:{borderLeft:"3px solid ".concat(r.border),paddingLeft:"8px"},children:['"',(e.matched_text||e.text||"").slice(0,200),(e.matched_text||e.text||"").length>200?"…":"",'"']})]})})]},t)})}),(0,a.jsxs)("div",{className:"border-t border-border bg-muted/30 px-3 py-2 space-y-2",style:{flexShrink:0},children:[S>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("button",{onClick:()=>M("prev"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,a.jsx)(h.A,{className:"w-3.5 h-3.5"})," Prev"]}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:null!==o?"Match ".concat(o+1," of ").concat(S):"".concat(S," matches")}),(0,a.jsxs)("button",{onClick:()=>M("next"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Next ",(0,a.jsx)(f.A,{className:"w-3.5 h-3.5"})]})]}),(0,a.jsxs)(d.$,{size:"sm",variant:"outline",className:"w-full font-semibold text-xs gap-1.5 h-8",onClick:n,children:[(0,a.jsx)(N.A,{className:"w-3.5 h-3.5"})," Download PDF Report"]})]})]})]})]})]})},ev=e=>{let{disabled:t,onFiles:r}=e,{getRootProps:s,getInputProps:n,isDragActive:l}=(0,V.VB)({disabled:t,accept:{"text/plain":[".txt"],"application/pdf":[".pdf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"]},maxSize:0x1e00000,onDrop:r});return(0,a.jsxs)("div",{...s(),className:(0,$.cn)("rounded-xl border-2 border-dashed border-border bg-muted/10 p-6 text-center cursor-pointer transition-colors",l?"border-primary bg-primary/5":"hover:border-primary/40 hover:bg-primary/5",t&&"opacity-50 cursor-not-allowed pointer-events-none"),children:[(0,a.jsx)("input",{...n()}),(0,a.jsx)(k.A,{className:(0,$.cn)("w-8 h-8 mx-auto mb-2",l?"text-primary":"text-muted-foreground")}),(0,a.jsx)("p",{className:"text-sm font-medium text-foreground",children:l?"Drop files here":"Drop files or click to upload"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:".txt, .pdf, .docx — up to 30 MB each"})]})};function ew(){var e,t;let{user:r}=(0,o.useUser)(),l=(0,o.useFirestore)(),c=(0,o.useMemoFirebase)(()=>r?(0,i.doc)(l,"users",r.uid):null,[r,l]),{data:m,isLoading:Q}=(0,o.useDoc)(c),{toast:J}
1=(0,G.dj)(),[ep,eh]=(0,s.useState)("text"),[ew,ej]=(0,s.useState)(""),[ey,eN]=(0,s.useState)(0),[ek,eC]=(0,s.useState)(!1),[e_,eS]=(0,s.useState)(null),eA=(0,s.useRef)(null),ez=(0,s.useRef)(""),[eR,eT]=(0,s.useState)(0),eM=(0,s.useRef)(null),eE=(0,s.useRef)(null),eL=(0,s.useRef)(null),eI=(0,s.useRef)(!1),{session:eD,saveSession:eF}=(0,ei.g)("copy-checker-report");(0,s.useEffect)(()=>{(null==eD?void 0:eD.result)&&!e_&&eS(eD.result)},[eD]);let eP=(0,s.useRef)(null),eU=(0,s.useRef)(null),[eB,eH]=(0,s.useState)(null),[eO,eq]=(0,s.useState)(null),[e$,eW]=(0,s.useState)(null),[eV,eG]=(0,s.useState)("details"),[eY,eX]=(0,s.useState)(!0),[eQ,eJ]=(0,s.useState)(!1),[eZ,eK]=(0,s.useState)(""),[e0,e5]=(0,s.useState)(!1),[e1,e2]=(0,s.useState)(!1),[e3,e4]=(0,s.useState)("web"),[e8,e6]=(0,s.useState)(null),[e9,e7]=(0,s.useState)(!1),[te,tt]=(0,s.useState)(!1),tr=(0,s.useRef)(null),[ta,ts]=(0,s.useState)(null),[tn,tl]=(0,s.useState)(null),[to,ti]=(0,s.useState)(null),td=(0,s.useRef)(0),[tc,tm]=(0,s.useState)([]),[tu,tx]=(0,s.useState)(""),[tp,tg]=(0,s.useState)(!1),[th,tf]=(0,s.useState)(0),tb=(0,s.useRef)(!1),[tv,tw]=(0,s.useState)(null),tj=(0,s.useRef)(null),ty=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(tv&&tv!==ty.current){let e=setTimeout(()=>{var e;null===(e=tj.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"nearest"})},120);return ty.current=tv,()=>clearTimeout(e)}tv||(ty.current=null)},[tv]);let tN=(0,s.useCallback)(async()=>{if(document.fullscreenElement)document.exitFullscreen();else try{var e;await (null===(e=eP.current)||void 0===e?void 0:e.requestFullscreen())}catch(e){}},[]);(0,s.useEffect)(()=>{let e=()=>eJ(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,s.useEffect)(()=>{ek&&(eE.current&&eE.current.scrollTo({top:0,behavior:"smooth"}),eP.current?(0,n.A)(eP.current):eL.current&&(0,n.A)(eL.current))},[ek]);let[tk,tC]=(0,s.useState)([]);(0,s.useEffect)(()=>{{let e=localStorage.getItem(eu);e&&ej(e)}},[]),(0,s.useEffect)(()=>{if(ew){let e=setTimeout(()=>localStorage.setItem(eu,ew),1e3);return()=>clearTimeout(e)}},[ew]);let t_=null!==(t=null==e_?void 0:null===(e=e_.plagiarized_content)||void 0===e?void 0:e.length)&&void 0!==t?t:0,tS=(0,s.useCallback)(e=>{let t=eE.current;if(!t)return;let r=t.querySelector('mark.plagiarized-match[data-match-id="'.concat(e,'"]'));if(r){let e=t.getBoundingClientRect(),a=r.getBoundingClientRect(),s=t.scrollTop+(a.top-e.top)-t.clientHeight/2+r.offsetHeight/2;t.scrollTo({top:s,behavior:"smooth"})}},[]),tA=(0,s.useCallback)(e=>{eq(e),eH(e),eW(e),tS(e)},[tS]),tz=(0,s.useCallback)(e=>{if(0===t_)return;let t=null!=eO?eO:-1;tA("next"===e?(t+1)%t_:(t-1+t_)%t_)},[eO,t_,tA]),tR=async()=>{if(!r){J({title:"Login Required",variant:"destructive"});return}if(e_){e7(!0),tt(!0),e6(null),setTimeout(()=>{(0,n.A)(eU.current)},80);try{let e=[e_.percent_plagiarized,e_.total_sentences,...e_.plagiarized_content.slice(0,10).map(e=>e.source_url)].join("|"),t="ai_report_".concat((0,ea.tx)(e));try{let e=await (0,ea.Q$)(t,168);if(e){e6(e),e7(!1),J({title:"✦ AI Report loaded from cache",description:"No credits deducted — same scan result."});return}}catch(e){console.warn("[AI Report] Cache read error:",e)}let a=await r.getIdToken(),s=(e_.highlightedText||"").replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,800),{data:n,error:l}=await Z(a,{uniqueScore:Math.round(100-Number(e_.percent_plagiarized)),percentPlagiarized:Number(e_.percent_plagiarized),totalWords:Number(e_.word_count)||0,totalSentences:Number(e_.total_sentences)||0,plagiarizedSentences:Number(e_.plagiarized_sentences)||0,sources:e_.plagiarized_content.slice(0,10).map(e=>{var t,r;return{source_url:String(e.source_url),title:null!==(t=e.title)&&void 0!==t?t:void 0,matched_text:null!==(r=e.matched_text||e.text)&&void 0!==r?r:void 0,similarity_score:null!=e.similarity_score?Number(e.similarity_score):void 0}}),documentSnippet:s});if(l||!n)throw Error(l||"Report generation failed.");e6(n);try{await (0,ea.aG)(t,n)}catch(e){console.warn("[AI Report] Cache write error:",e)}}catch(e){J({title:"AI Report Failed",description:e.message,variant:"destructive"}),tt(!1)}finally{e7(!1)}}},tT=(0,s.useCallback)(e=>{var t,r;let a=Math.round(100-(Number.isFinite(e.percent_plagiarized)?e.percent_plagiarized:0)),s=a>=80,n=a>=50,l=s?"#22c55e":n?"#f59e0b":"#ef4444",o=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),i=null!==(r=null===(t=e.plagiarized_content)||void 0===t?void 0:t.length)&&void 0!==r?r:0,d=(0,en.GU)("#8b5cf6","139,92,246"),c=[{label:"Unique Score",value:"".concat(a,"%")},{label:"Plagiarized",value:"".concat(e.percent_plagiarized.toFixed(1),"%")}
1,{label:"Word Count",value:e.word_count.toLocaleString()},{label:"Sources Found",value:String(i)},{label:"Date",value:o}],m='\n        <div class="rs" style="text-align:center;background:linear-gradient(135deg,rgba('.concat(s?"34,197,94":n?"245,158,11":"239,68,68",',.14) 0%,rgba(14,17,33,.98) 100%);">\n            <div style="font-size:5.5rem;font-weight:900;color:').concat(l,";font-family:'Outfit',sans-serif;line-height:1;\">").concat(a,'%</div>\n            <div style="font-size:1.3rem;font-weight:700;color:').concat(l,';margin-top:.75rem;">').concat(s?"Mostly Original":n?"Partially Plagiarized":"High Plagiarism Detected",'</div>\n            <div style="color:#64748b;margin-top:.5rem;font-size:.9rem;">').concat(e.plagiarized_sentences," of ").concat(e.total_sentences,' sentences matched external sources</div>\n            <div style="margin-top:1.5rem;height:6px;border-radius:100px;background:rgba(255,255,255,.1);max-width:480px;margin-left:auto;margin-right:auto;overflow:hidden;">\n                <div style="height:100%;width:').concat(a,"%;background:").concat(l,';border-radius:100px;"></div>\n            </div>\n        </div>'),u='\n        <div class="rs">\n            <div class="rs-t">Document Statistics</div>\n            <div class="sg">\n                <div class="sc"><div class="sc-l">Total Words</div><div class="sc-v">'.concat(e.word_count.toLocaleString(),'</div></div>\n                <div class="sc"><div class="sc-l">Total Sentences</div><div class="sc-v">').concat(e.total_sentences,'</div></div>\n                <div class="sc"><div class="sc-l">Plagiarized</div><div class="sc-v" style="color:').concat(l,'">').concat(e.percent_plagiarized.toFixed(1),'%</div></div>\n                <div class="sc"><div class="sc-l">Sources Found</div><div class="sc-v">').concat(i,"</div></div>\n            </div>\n        </div>"),x=e.plagiarized_content.map((e,t)=>{let r=e.matched_text||e.text||"",a=e.source_url;try{a=new URL(e.source_url).hostname.replace("www.","")}catch(e){}return"<tr>\n                <td>".concat(t+1,'</td>\n                <td><a href="').concat(e.source_url,'" style="color:#8b5cf6">').concat(a,'</a></td>\n                <td style="color:#94a3b8;font-style:italic;">&ldquo;').concat(r.slice(0,120)).concat(r.length>120?"…":"","&rdquo;</td>\n                <td>").concat(null!=e.similarity_score?(100*e.similarity_score).toFixed(0)+"%":"&mdash;","</td>\n            </tr>")}).join(""),p=i>0?'\n        <div class="rs">\n            <div class="rs-t">Matched Sources ('.concat(i,")</div>\n            <table>\n                <thead><tr><th>#</th><th>Source Domain</th><th>Matched Text</th><th>Similarity</th></tr></thead>\n                <tbody>").concat(x,"</tbody>\n            </table>\n        </div>"):"",g=e.highlightedText?'\n        <div class="rs">\n            <div class="rs-t">Document with Highlights</div>\n            '.concat("<style>mark.plagiarized-match{background-color:rgba(234,179,8,.28)!important;color:#fef9c3!important;border-bottom:2px solid #eab308!important;border-radius:3px;padding:1px 3px;}</style>",'\n            <div style="line-height:1.9;color:#cbd5e1;font-size:.9rem;padding:.25rem 0;">').concat(e.highlightedText,"</div>\n        </div>"):"",h=(0,en.W9)("Copy Checker Report","9Rank AI Engine &mdash; Deep Plagiarism Analysis",c)+m+u+p+g+(0,en.oZ)()+'<div class="no-print" style="text-align:center;padding:1.5rem 0;">\n            <button onclick="window.print()" style="background:#8b5cf6;color:#fff;border:none;border-radius:10px;padding:14px 32px;font-size:15px;font-weight:700;cursor:pointer;font-family:\'Outfit\',sans-serif;">&#11015; Print / Save as PDF</button>\n        </div>',f=new Blob([(0,en.DV)("Copy Checker Report &ndash; 9Rank.ai",d,h)],{type:"text/html"}),b=URL.createObjectURL(f),v=window.open(b,"_blank");v&&v.addEventListener("load",()=>setTimeout(()=>v.print(),600)),setTimeout(()=>URL.revokeObjectURL(b),3e4)},[]),tM=(0,s.useCallback)(e=>{if(eA.current){let e=eA.current.getHTML();ej(e),eI.current||(ez.current=e)}let t=ec(e.read(()=>(0,X.Ni)().getTextContent()));eN(t),ti(e=>{if(!e)return null;let r=td.current;return(r>0?Math.abs(t-r)/r:1)>.05?null:e})},[]),{getRootProps:tE,getInputProps:tL}=(0,V.VB)({onDrop:(0,s.useCallback)(async(e,t)=>
1{t.forEach(e=>J({title:"File Rejected",description:"".concat(e.file.name,": ").concat(e.errors[0].message),variant:"destructive"}));let r=e.map(e=>({id:Math.random().toString(36).substring(7),file:e,wordCount:0,creditCost:0,status:"pending"}));tC(e=>[...e,...r])},[J]),accept:{"text/plain":[".txt"],"application/pdf":[".pdf"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"]},maxSize:0x1e00000}),tI=async()=>{var e;if(!r){J({title:"Login Required",variant:"destructive"});return}let t=(null===(e=eA.current)||void 0===e?void 0:e.getHTML())||ew;if(t&&(ez.current=t),ey<10){J({title:"Too short",description:"Need at least 10 words.",variant:"destructive"});return}let a=em(ey);if(!Q&&null!==m&&(null==m?void 0:m.creditPlan)!=="free"&&((null==m?void 0:m.credits)||0)<a){J({title:"Need ".concat(a," credits"),variant:"destructive"});return}if(to){let e=td.current;if((e>0?Math.abs(ey-e)/e:1)<=.05){eS(to),eq(null),eG("details"),J({title:"Result loaded from cache",description:"Credits not deducted — same document."}),setTimeout(()=>{(0,n.A)(eP.current)},120);return}}let s="copy_checker_".concat((0,ea.tx)(ew));try{let e=await (0,ea.Q$)(s,168);if(e){eS(e),eq(null),eG("details"),ti(e),td.current=ey,J({title:"Result loaded from cache",description:"Instant load, zero credits deducted."}),setTimeout(()=>{(0,n.A)(eP.current)},120);return}}catch(e){console.warn("Local cache read error:",e)}eC(!0),eS(null),eq(null),eG("details");try{let e=await r.getIdToken(),t=new FormData;t.append("idToken",e),t.append("content",ew),t.append("source","text-input"),t.append("contentType","plaintext_from_html"),t.append("checkMode",e3);let{result:a,error:l,cached:o}=await K(null,t);if(l||!a)throw Error(l||"Check failed.");eS(a),ti(a),td.current=ey,setTimeout(()=>{(0,n.A)(eP.current)},120);try{await (0,ea.aG)(s,a),await eF({input:ew.slice(0,200),result:a})}catch(e){console.warn("Local cache save error:",e)}o&&J({title:"Cached result loaded",description:"Credits not deducted."})}catch(e){J({title:"Check Failed",description:e.message,variant:"destructive"})}finally{eC(!1)}},tD=(0,s.useMemo)(()=>{if(!e_)return"";let e=["mark.plagiarized-match {\n                background-color: #fef08a;\n                color: #713f12;\n                border-bottom: 2px solid #eab308;\n                border-radius: 3px;\n                padding: 1px 2px;\n                cursor: pointer;\n                transition: all 0.2s;\n            }",".dark mark.plagiarized-match {\n                background-color: rgba(234,179,8,0.25);\n                color: #fef9c3;\n                border-bottom-color: #facc15;\n            }"];if(e_.plagiarized_content.forEach((t,r)=>{let a=ex[r%ex.length];e.push('\n                mark.plagiarized-match[data-match-id="'.concat(r,'"] {\n                    background-color: ').concat(a.bg,";\n                    color: ").concat(a.text,";\n                    border-bottom-color: ").concat(a.border,';\n                }\n                .dark mark.plagiarized-match[data-match-id="').concat(r,'"] {\n                    background-color: ').concat(a.dark_bg,";\n                    color: ").concat(a.dark_text,";\n                    border-bottom-color: ").concat(a.border,";\n                }\n            "))}),null!==eO){let t=ex[eO%ex.length];e.push('\n                mark.plagiarized-match:not([data-match-id="'.concat(eO,'"]) { opacity: 0.35; }\n                mark.plagiarized-match[data-match-id="').concat(eO,'"] {\n                    outline: 2px solid ').concat(t.border,";\n                    outline-offset: 1px;\n                    opacity: 1 !important;\n                    font-weight: 600;\n                }\n            "))}return e.join("\n")},[e_,eO]);e_&&Number.isFinite(e_.percent_plagiarized)&&e_.percent_plagiarized;let tF=(0,s.useMemo)(()=>{if(!(null==e_?void 0:e_.highlightedText))return"";let e=e_.highlightedText.replace(RegExp("<mark([^>]*)>(.*?)<\\/mark>","gs"),(e,t,r)=>{let a=t.match(/data-url="([^"]*?)"/),s=t.match(/data-domain="([^"]*?)"/),n=(null==a?void 0:a[1])||"",l=(null==s?void 0:s[1])||"";return n?"<mark".concat(t,">").concat(r,'</mark><a href="').concat(n,'" target="_blank" rel="noopener noreferrer" class="plag-src-chip" contenteditable="false" title="').concat(n,'">').concat(l,'<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewB
1ox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="display:inline;vertical-align:middle;margin-left:1px"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg></a>'):"<mark".concat(t,">").concat(r,"</mark>")});return(e=e.replace(/<\/p><p>/g,"</p>\n<p>")).replace(/(<p[^>]*>)([\s\S]*?)(<\/p>)/g,(e,t,r,a)=>r.length<200?t+r+a:t+r.replace(/(\d+)\.\s+([A-Z])/g,(e,t,r)=>"</p><p><strong>".concat(t,".</strong> ").concat(r)).replace(/\n{2,}/g,"</p><p>").replace(/\n/g,"<br />")+a)},[null==e_?void 0:e_.highlightedText]);return(0,a.jsxs)("div",{ref:eL,className:"max-w-[1600px] mx-auto w-full animate-fade-in",style:{padding:"0 1.5rem 1.5rem"},children:[(0,a.jsxs)("div",{className:"relative rounded-2xl border border-primary/20 bg-gradient-to-r from-primary/8 via-primary/4 to-transparent px-6 py-5 mb-5 overflow-hidden",children:[(0,a.jsx)("div",{className:"absolute -right-20 -top-10 w-64 h-40 bg-primary/10 rounded-full blur-3xl pointer-events-none"}),(0,a.jsxs)("div",{className:"relative flex flex-col sm:flex-row sm:items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-primary/15 border border-primary/30 flex items-center justify-center shrink-0",children:(0,a.jsx)(u.A,{className:"w-6 h-6 text-primary"})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,a.jsx)("h1",{className:"text-xl font-black font-headline tracking-tight text-foreground leading-none",children:"Copy Checker"}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-primary/15 border border-primary/25 text-primary text-[10px] font-bold uppercase tracking-wide",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-primary animate-pulse"}),"AI Deep Scan"]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"100B+ pages indexed \xb7 Exact match + paraphrase \xb7 PDF report"})]})]}),(!r||(null==m?void 0:m.creditPlan)==="free")&&(0,a.jsxs)("div",{className:"sm:ml-auto flex items-center gap-2 px-3 py-2 rounded-xl border border-primary/20 bg-primary/5 text-xs text-primary",children:[(0,a.jsx)(C.A,{className:"w-3.5 h-3.5 shrink-0"}),(0,a.jsxs)("span",{children:[(0,a.jsx)("strong",{children:"Deep Scan:"})," 1–20 credits/doc based on word count. Results cached 24h."]})]})]})]}),(0,a.jsxs)(W.tU,{value:ep,onValueChange:eh,className:"flex-1 flex flex-col min-h-0",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 mb-4",children:[(0,a.jsxs)(W.j7,{className:"h-9 p-1 rounded-xl bg-muted/60 border border-border gap-0.5 w-auto shrink-0",children:[(0,a.jsxs)(W.Xi,{value:"text",className:"rounded-lg px-4 h-7 text-xs font-semibold data-[state=active]:bg-background data-[state=active]:shadow-sm data-[state=active]:text-primary transition-all",children:[(0,a.jsx)(p.A,{className:"w-3.5 h-3.5 mr-1.5"}),"Single Document"]}),(0,a.jsxs)(W.Xi,{value:"files",className:"rounded-lg px-4 h-7 text-xs font-semibold data-[state=active]:bg-background data-[state=active]:shadow-sm data-[state=active]:text-primary transition-all",children:[(0,a.jsx)(_.A,{className:"w-3.5 h-3.5 mr-1.5"}),"Bulk Check"]})]}),!e_&&"text"===ep&&(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,a.jsxs)("form",{className:"flex items-center gap-2 flex-1 min-w-0",onSubmit:async e=>{if(e.preventDefault(),eZ.trim()&&!e0){e5(!0);try{let{text:e,error:r}=await (0,ee.H)(eZ.trim());if(r||!e)J({title:"Import failed",description:r||"No text found.",variant:"destructive"});else{var t;ej(e),null===(t=eA.current)||void 0===t||t.setHTML(e),eN(e.trim().split(/\s+/).filter(Boolean).length),eS(null),eK(""),J({title:"Document imported",description:"Text loaded into editor. Click Check Plagiarism to scan."})}}finally{e5(!1)}}},children:[(0,a.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,a.jsx)(S.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),(0,a.jsx)(es.p,{value:eZ,onChange:e=>eK(e.target.value),placeholder:"Paste Google Doc, .txt or article URL to import…",className:"pl-8 h-9 text-xs bg-background border-border/70 focus-visible:border-primary/50 transition-colors",disabled:e0})]}),(0,a.jsx)(d.$,{type:"submit",size:"sm",variant:"outline",disabled:!eZ.trim()||e0,className:"shrink-0 h-9 text-xs font-semibold border-border/70 hover:border-primary/40 hover:text-primary transition-colors",children:e0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(A.A,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Importing…"]}):"Import"})]}),(0,a.jsx)("input",{ref:tr,type:"file",accept:".txt,.pdf,.docx",className:"hidden",onChange:async e=>{var t,a,s,n;let l=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!l)return;e.target.value="";let o=null===(a=l.name.split(".").pop())||void 0===a?void 0:a.toLowerCase();if("txt"===o){e2(!0);try{let e=await l.text();if(!e.trim()){J({title:"Empty file",variant:"destructive"});return}ej(e),null===(s=eA.current)||void 0===s||s.setHTML(e),eN(e.trim().split(/\s+/).filter(
1Boolean).length),eS(null),J({title:"File loaded",description:'"'.concat(l.name,'" loaded into editor.')})}finally{e2(!1)}}else if("pdf"===o||"docx"===o){if(!r){J({title:"Login required to scan files",variant:"destructive"});return}e2(!0),eC(!0),eS(null),eq(null),eG("details");try{let e=await r.getIdToken(),t=new FormData;t.append("idToken",e),t.append("file",l),t.append("source","file");let{result:a,error:s,cached:o,textContent:i}=await K(null,t);if(s||!a)throw Error(s||"Check failed.");eS(a);let d=i||(a.highlightedText?a.highlightedText.replace(/<mark[^>]*>/g,"").replace(/<\/mark>/g,"").replace(/<a[^>]*class="plag-src-chip"[^>]*>[\s\S]*?<\/a>/g,""):"");tl(d||null),ts(l.name),d&&(ej(d),eN(d.replace(/<[^>]+>/g," ").trim().split(/\s+/).filter(Boolean).length)),ti(a),td.current=null!==(n=a.word_count)&&void 0!==n?n:0,o&&J({title:"Cached result loaded",description:"Credits not deducted."})}catch(e){J({title:"Scan Failed",description:e.message,variant:"destructive"})}finally{e2(!1),eC(!1)}}else J({title:"Unsupported file",description:"Use .txt, .pdf or .docx",variant:"destructive"})}}),(0,a.jsx)(d.$,{type:"button",size:"sm",variant:"outline",disabled:e0||e1||ek,onClick:()=>{var e;return null===(e=tr.current)||void 0===e?void 0:e.click()},className:"shrink-0 h-9 gap-1.5 text-xs font-semibold border-border/70 hover:border-primary/40 hover:text-primary transition-colors",title:"Upload .txt, .pdf or .docx file",children:e1?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(A.A,{className:"w-3.5 h-3.5 animate-spin"}),"Reading…"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k.A,{className:"w-3.5 h-3.5"}),"Upload File"]})})]})]}),(0,a.jsxs)(W.av,{value:"text",className:"mt-0 data-[state=inactive]:hidden flex-1 flex flex-col min-h-0",children:[(0,a.jsx)("style",{children:"\n                        .responsive-split {\n                            display: flex;\n                            flex-direction: column;\n                        }\n                        @media (min-width: 768px) {\n                            .responsive-split {\n                                flex-direction: row;\n                            }\n                            .responsive-split > .panel-left {\n                                flex: 1;\n                                min-width: 0;\n                            }\n                            .responsive-split > .panel-right {\n                                width: 400px;\n                                flex-shrink: 0;\n                            }\n                        }\n                    "}),eQ&&(0,a.jsxs)("button",{onClick:tN,className:"fixed top-4 right-4 z-[60] flex items-center gap-2 px-3 py-2 rounded-xl bg-background/90 backdrop-blur-sm border border-border shadow-lg text-sm font-semibold text-foreground hover:bg-muted transition-all hover:scale-105",title:"Exit fullscreen (Esc)",children:[(0,a.jsx)(x.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Exit Fullscreen"})]}),(0,a.jsxs)("div",{ref:eP,className:"w-full bg-background transition-all responsive-split ".concat(eQ?"overflow-hidden fixed inset-0 z-50":"rounded-xl border border-border shadow-xl overflow-hidden"),style:eQ?{}:{minHeight:"620px"},children:[(0,a.jsx)("style",{children:"\n                            @media (min-width: 768px) {\n                                .responsive-split:not(.fixed) {\n                                    height: calc(100vh - 280px);\n                                }\n                                .panel-left {\n                                    height: 100%;\n                                }\n                            }\n                            @media (max-width: 767px) {\n                                .responsive-split:not(.fixed) {\n                                    height: auto;\n                                }\n                                .panel-left {\n                                    height: 60vh;\n                                }\n                            }\n                        "}),(0,a.jsxs)("div",{className:"panel-left flex flex-col min-w-0 overflow-hidden border-b md:border-b-0 md:border-r border-border",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30 shrink-0",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:[(0,a.jsx)(p.A,{className:"w-3.5 h-3.5"}),e_?"Result View":"Document Editor"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[e_&&t_>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{onClick:()=>eX(e=>!e),title:eY?"Hide highlights":"Show highlights",className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-semibold transition-all border ".concat(eY?"bg-yellow-100 dark:bg-yellow-900/30 border-yellow-300 dark:border-yellow-700 text-yellow-800 dark:text-yellow-300":"bg-muted border-border text-muted-foreground"),children:[(0,a.jsx)(g.A,{className:"w-3 h-3"}),eY?"On":"Off"]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg px-1 py-0.5 border border-border",children:[(0,a.jsx)("button",{onClick:()=>tz("prev"),className:"p-1 rounded hover:bg-background transition-colors",title:"Previous match",children:(0,a.jsx)(h.A,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("span",{className:"text-[11px] font-mono px-1.5 min-w-[54px] text-center text-foreground tabular-nums",children:null!==eO?"".concat(eO+1," / ").concat(t_):"".concat(t_," hits")}),(0,a.jsx)("button",{onClick:()=>tz("next"),className:"p-1 rounded hover:bg-background transition-colors",title:"Next match",children:(0,a.jsx)(f.A,{className:"w-3.5 h-3.5"})})]})]}),(eQ||e_)&&(0,a.jsx)("button",{onClick:tN,title:eQ?"Exit fullscreen (Esc)":"Expand to fullscreen",className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-semibold border transition-all ".concat(eQ?"bg-primary/10 border-primary/30 text-primary hover:bg-primary/20":"bg-muted border-border text-muted-foreground hover:text-foreground hover:border-border/80"),children:eQ?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Minimize"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(b.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Fullscreen"})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-background border border-border text-[11px] font-medium text-muted-foreground",children:[(0,a.jsx)("span",{className:"tabular-nums text-foreground font-semibold",children:ey.toLocaleStr
1ing()}),(0,a.jsx)("span",{children:"words"}),(0,a.jsx)("span",{className:"w-px h-3 bg-border"}),(0,a.jsx)("span",{className:"tabular-nums text-primary font-bold",children:em(ey)}),(0,a.jsx)("span",{children:"cr"})]}),e_&&(0,a.jsxs)("button",{onClick:()=>{let e=ez.current||ew||tn||((null==e_?void 0:e_.highlightedText)?e_.highlightedText.replace(/<mark[^>]*>/g,"").replace(/<\/mark>/g,"").replace(/<a[^>]*class="plag-src-chip"[^>]*>[\s\S]*?<\/a>/g,""):"");if(!e){eS(null),eq(null);return}ez.current=e,eI.current=!0,ej(e),eT(e=>e+1),eS(null),eq(null),setTimeout(()=>{var t;null===(t=eA.current)||void 0===t||t.setHTML(e),setTimeout(()=>{eI.current=!1},100)},200)},title:"Close result",className:"flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-semibold border border-border/60 bg-muted text-muted-foreground hover:bg-red-500/10 hover:border-red-500/30 hover:text-red-400 transition-all",children:[(0,a.jsx)(v.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Close"})]})]})]}),(0,a.jsxs)("div",{ref:eE,className:"flex-1 overflow-y-auto relative bg-background",children:[ek&&(0,a.jsx)("div",{className:"absolute inset-0 z-10 bg-background/90 backdrop-blur-sm",children:(0,a.jsx)(ef,{})}),e_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("style",{children:tD}),!eY&&(0,a.jsx)("style",{children:"\n                                                mark.plagiarized-match {\n                                                    background: transparent !important;\n                                                    color: inherit !important;\n                                                    border-bottom: none !important;\n                                                    padding: 0 !important;\n                                                    cursor: text !important;\n                                                }\n                                                .plag-src-chip { display: none !important; }\n                                            "}),(0,a.jsx)("style",{children:"\n                                            .plag-src-chip {\n                                                display: inline-flex;\n                                                align-items: center;\n                                                gap: 2px;\n                                                margin-left: 3px;\n                                                padding: 1px 6px;\n                                                border-radius: 100px;\n                                                font-size: 0.68rem;\n                                                font-weight: 700;\n                                                font-family: ui-monospace, monospace;\n                                                text-decoration: none !important;\n                                                background: rgba(0,0,0,0.07);\n                                                border: 1px solid rgba(0,0,0,0.16);\n                                                color: #374151 !important;\n                                                cursor: pointer;\n                                                vertical-align: middle;\n                                                line-height: 1.6;\n                                                transition: background 0.15s;\n                                                white-space: nowrap;\n                                            }\n                                            .plag-src-chip:hover { background: rgba(0,0,0,0.14); border-color: rgba(0,0,0,0.32); }\n                                            .dark .plag-src-chip { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); color: #e2e8f0 !important; }\n                                            .dark .plag-src-chip:hover { background: rgba(255,255,255,0.18); }\n                                        "}),(0,a.jsx)("div",{ref:eM,className:"prose dark:prose-invert prose-sm sm:prose-base max-w-none px-8 py-6 text-foreground font-body leading-[1.85] focus:outline-none [&_p]:mb-4 [&_p]:text-[0.925rem] [&_h3]:text-base [&_h3]:font-bold [&_h3]:mt-6 [&_h3]:mb-2 [&_h3]:text-foreground [&_mark]:cursor-pointer [&_mark]:transition-all",dangerouslySetInnerHTML:{__html:tF||'<p class="text-muted-foreground">No content to display.</p>'}})]}):(0,a.jsx)("div",{className:"prose dark:prose-invert prose-sm sm:prose-base max-w-none px-8 py-6 text-foreground font-body leading-[1.85] focus:outline-none [&_p]:mb-4 [&_p]:text-[0.925rem] [&_h3]:text-base [&_h3]:font-bold [&_h3]:mt-6 [&_h3]:mb-2 [&_h3]:text-foreground h-full relative",children:(0,a.jsx)(ed,{ref:eA,initialContent:ew,onChange:tM,placeholder:"Paste your document here to scan against 100 billion+ web pages...",className:"min-h-full focus:outline-none"},eR)})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-0 border-t border-border bg-muted/20 shrink-0",children:[!e_&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 pt-3 pb-2",children:[(0,a.jsx)("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider shrink-0",children:"Check Mode:"}),(0,a.jsxs)("div",{className:"flex rounded-lg border border-border overflow-hidden bg-background shadow-sm",children:[(0,a.jsxs)("button",{onClick:()=>e4("web"),className:(0,$.cn)("flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold transition-all","web"===e3?"bg-primary text-primary-foreground shadow-inner":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:[(0,a.jsx)(u.A,{className:"w-3.5 h-3.5"}),"Plagiarism Check"]}),(0,a.jsxs)("button",{onClick:()=>e4("deep"),className:(0,$.cn)("flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold transition-all border-l border-border","deep"===e3?"bg-violet-600 text-white shadow-inner":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:[(0,a.jsx)(z.A,{className:"w-3.5 h-3.5"}),"AI Integrity Analysis"]})]}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground hidden sm:block",children:"web"===e3?"⚡ Detects copied content across 100B+ web pages":"\uD83D\uDD2C Sentence-level NLP \xb7 Detects paraphrasing & near-copies"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5",children:[(0,a.jsxs)(d.$,{variant:"ghost",size:"sm",onClick:()=>{var e;ej(""),null===(e=eA.current)||void 0===e||e.setHTML(""),eS(null),eq(null),tl(null),ts(null),ti(null)},disabled:ek||!ew&&!e_&&!ta,className:"text-muted-foreground",children:[(0,a.jsx)(R.A,{className:"w-3.5 h-3.5 mr-1.5"})," Clear"]}),e_?(0,a.jsxs)(d.$,{onClick:()=>{let e=ez.current||tn||((null==e_?void 0:e_.highlightedText)?e_.highlightedText.replace(/<mark[^>]*>/g,"").replace(/<\/mark>/g,"").replace(/<a[^>]*class="plag-src-chip"[^>]*>[\s\S]*?<\/a>/g,""):"");if(!e){eS(null),eq(null);return}ez.current=e,eI.current=!0,ej(e),eT(e=>e+1),eN(e.replace(/<[^>]+>
1/g," ").trim().split(/\s+/).filter(Boolean).length),eS(null),eq(null),setTimeout(()=>{var t;null===(t=eA.current)||void 0===t||t.setHTML(e),setTimeout(()=>{eI.current=!1},100)},200)},size:"sm",variant:"outline",className:"font-semibold",children:["← ",ta?'Back to "'.concat(ta.length>20?ta.slice(0,20)+"…":ta,'"'):"Edit Document"]}):(0,a.jsx)(d.$,{onClick:tI,disabled:ek||ey<10,className:(0,$.cn)("font-semibold px-6","deep"===e3&&"bg-violet-600 hover:bg-violet-700"),children:ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(A.A,{className:"w-4 h-4 mr-2 animate-spin"})," ","deep"===e3?"Analyzing...":"Scanning..."]}):"deep"===e3?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(z.A,{className:"w-4 h-4 mr-2"})," AI Integrity Analysis"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.A,{className:"w-4 h-4 mr-2"})," Check Plagiarism"]})})]})]})]}),e_&&(0,a.jsxs)("div",{className:"panel-right flex flex-col overflow-hidden bg-card",children:[(0,a.jsx)(eg,{percentPlagiarized:e_.percent_plagiarized,totalSentences:e_.total_sentences,plagiarizedSentences:e_.plagiarized_sentences,isAiFallback:e_.isAiFallback}),t_>0&&(0,a.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/20 shrink-0",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground mb-1.5 font-medium",children:"Source color legend"}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[e_.plagiarized_content.slice(0,8).map((e,t)=>{let r=e.source_url;try{r=new URL(e.source_url).hostname.replace("www.","")}catch(e){}let s=ex[t%ex.length];return(0,a.jsxs)("button",{title:r,onClick:()=>tA(t),className:(0,$.cn)("flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border transition-all",eO===t?"ring-2 ring-offset-1 ring-current scale-105":"hover:scale-105"),style:{backgroundColor:s.bg,color:s.text,borderColor:s.border},children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:s.border}}),(0,a.jsx)("span",{className:"max-w-[80px] truncate",children:r})]},t)}),t_>8&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground self-center",children:["+",t_-8," more"]})]})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[t_>0&&(0,a.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between sticky top-0 bg-card/95 backdrop-blur-sm z-10",children:[(0,a.jsxs)("span",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[(0,a.jsx)(T.A,{className:"w-3.5 h-3.5 text-primary"})," Matched Sources"]}),(0,a.jsxs)(Y.E,{variant:"secondary",className:"text-xs h-5 px-2",children:[t_," ",1===t_?"source":"sources"]})]}),0===t_?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center py-12 px-4",children:[(0,a.jsx)(M.A,{className:"w-14 h-14 text-green-500 mx-auto mb-3 opacity-90"}),(0,a.jsx)("p",{className:"font-bold text-foreground text-base",children:"100% Original"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"No external matches found."})]}):(0,a.jsx)("div",{className:"divide-y divide-border",children:e_.plagiarized_content.map((e,t)=>{let r=e.source_url;try{r=new URL(e.source_url).hostname.replace("www.","")}catch(e){}let s=ex[t%ex.length],n=eO===t,l=e$===t;return(0,a.jsxs)("div",{className:(0,$.cn)("transition-all",n?"bg-muted/50":"hover:bg-muted/20"),children:[(0,a.jsxs)("button",{className:"w-full text-left px-3 py-2.5 flex items-center gap-2.5",onClick:()=>{tA(t),eW(l?null:t)},children:[(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-full shrink-0 mt-0.5",style:{backgroundColor:s.border}}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("img",{src:"https://www.google.com/s2/favicons?domain=".concat(r,"&sz=16"),alt:"",className:"w-3.5 h-3.5 rounded-sm shrink-0",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{className:"text-sm font-medium truncate text-foreground",children:e.title||r})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground truncate italic",children:['"',(e.matched_text||e.text||"").slice(0,60),(e.matched_text||e.text||"").length>60?"…":"",'"']})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"p-1 rounded text-muted-foreground hover:text-primary transition-colors",title:"Open source",children:(0,a.jsx)(w.A,{className:"w-3.5 h-3.5"})}),l?(0,a.jsx)(j.A,{className:"w-3.5 h-3.5 text-muted-foreground"}):(0,a.jsx)(y.A,{className:"w-3.5 h-3.5 text-muted-foreground"})]})]}),l&&(0,a.jsx)("div",{className:"px-3 pb-3 animate-in fade-in slide-in-from-top-1 duration-150",children:(0,a.jsxs)("div",{className:"rounded-lg p-3 space-y-2 border",style:{backgroundColor:s.bg+"33",borderColor:s.border+"55"},children:[(0,a.jsx)("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline break-all leading-tight block",children:e.source_url.length>70?e.source_url.slice(0,70)+"...":e.source_url}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-muted-foreground mb-1",children:"Matching sentence:"}),(0,a.jsxs)("p",{className:"text-xs leading-relaxed italic text-foreground
1/90",style:{borderLeft:"3px solid ".concat(s.border),paddingLeft:"8px"},children:['"',e.matched_text||e.text,'"']})]})]})})]},t)})})]}),(0,a.jsxs)("div",{className:"shrink-0 border-t border-border bg-muted/30 px-3 py-2 space-y-2",children:[t_>0&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("button",{onClick:()=>tz("prev"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,a.jsx)(h.A,{className:"w-3.5 h-3.5"})," Prev"]}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:null!==eO?"Match ".concat(eO+1," of ").concat(t_):"".concat(t_," matches")}),(0,a.jsxs)("button",{onClick:()=>tz("next"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:["Next ",(0,a.jsx)(f.A,{className:"w-3.5 h-3.5"})]})]}),(0,a.jsxs)(d.$,{size:"sm",variant:"outline",className:"w-full font-semibold text-xs gap-1.5 h-8",onClick:()=>tT(e_),children:[(0,a.jsx)(N.A,{className:"w-3.5 h-3.5"})," Download PDF Report"]}),(0,a.jsx)("button",{className:"w-full font-semibold text-xs gap-1.5 h-8 rounded-lg inline-flex items-center justify-center border-0 shadow-sm transition-all duration-200 disabled:opacity-50 disabled:pointer-events-none hover:brightness-110 active:scale-[0.98]",style:{background:"linear-gradient(to right, #7c3aed, var(--color-primary, #10b981))",color:"#ffffff"},onClick:tR,disabled:e9,children:e9?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(A.A,{className:"w-3.5 h-3.5 animate-spin mr-1.5"})," Generating AI Report..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(E.A,{className:"w-3.5 h-3.5 mr-1.5"})," ✦ AI Report \xb7 5 credits"]})}),(0,a.jsx)(er.H,{toolKey:"copy-checker-report",isProcessing:e9})]})]})]}),te&&e_&&(0,a.jsxs)("div",{ref:eU,className:"mt-4 rounded-xl border border-violet-500/30 bg-violet-500/5 overflow-hidden animate-in fade-in slide-in-from-bottom-2 duration-300",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-violet-500/20 bg-violet-500/10",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(z.A,{className:"w-4 h-4 text-violet-400"}),(0,a.jsx)("span",{className:"text-sm font-bold text-foreground",children:"AI Integrity Report"}),e8&&(0,a.jsx)("span",{className:(0,$.cn)("text-xs font-bold px-2 py-0.5 rounded-full",{"bg-green-500/20 text-green-400":"green"===e8.verdictColor,"bg-yellow-500/20 text-yellow-400":"yellow"===e8.verdictColor,"bg-orange-500/20 text-orange-400":"orange"===e8.verdictColor,"bg-red-500/20 text-red-400":"red"===e8.verdictColor}),children:e8.overallVerdict})]}),(0,a.jsx)("button",{onClick:()=>tt(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,a.jsx)(v.A,{className:"w-4 h-4"})})]}),e9&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3 py-10 text-muted-foreground",children:[(0,a.jsx)(A.A,{className:"w-5 h-5 animate-spin text-violet-400"}),(0,a.jsx)("span",{className:"text-sm animate-pulse",children:"Analyzing plagiarism data with AI..."})]}),e8&&!e9&&(0,a.jsxs)("div",{className:"p-4 space-y-4 text-sm",children:[(0,a.jsxs)("div",{className:"rounded-lg bg-background/60 border border-border p-3",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1.5",children:"Executive Summary"}),(0,a.jsx)("p",{className:"text-foreground leading-relaxed",children:e8.executiveSummary})]}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-2.5 text-center",children:[(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"Risk Level"}),(0,a.jsx)("p",{className:(0,$.cn)("font-bold text-sm",{"text-green-500":"Low"===e8.riskAssessment.level,"text-yellow-500":"Medium"===e8.riskAssessment.level,"text-orange-500":"High"===e8.riskAssessment.level,"text-red-500":"Critical"===e8.riskAssessment.level}),children:e8.riskAssessment.level})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-2.5 text-center",children:[(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"SEO Impact"}),(0,a.jsx)("p",{className:(0,$.cn)("font-bold text-sm",{"text-green-500":"Minimal"===e8.seoImpact.score,"text-yellow-500":"Moderate"===e8.seoImpact.score,"text-red-500":"Severe"===e8.seoImpact.score}),children:e8.seoImpact.score})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-background/60 p-2.5 text-center",children:[(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground mb-0.5",children:"Rewrite"}),(0,a.jsx)("p",{className:(0,$.cn)("font-bold text-xs",{"text-green-500":"Not Required"===e8.rewriteStrategy.urgency,"text-yellow-500":"Recommended"===e8.rewriteStrategy.urgency,"text-red-500":"Urgent"===e8.rewriteStrategy.urgency}),children:e8.rewriteStrategy.urgency})]})]}),(0,a.jsxs)("div",{className:(0,$.cn)("rounded-lg border p-3",{"border-green-500/30 bg-green-500/5":"Publish"===e8.publishingDecision.recommendation,"border-yellow-500/30 bg-yellow-500/5":"Publish with Minor Edits"===e8.publishingDecision.recommendation,"border-orange-500/30 bg-
1orange-500/5":"Revise Before Publishing"===e8.publishingDecision.recommendation,"border-red-500/30 bg-red-500/5":"Do Not Publish"===e8.publishingDecision.recommendation}),children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,a.jsx)(L.A,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Publishing Decision"})]}),(0,a.jsx)("p",{className:"font-bold text-foreground",children:e8.publishingDecision.recommendation}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:e8.publishingDecision.justification})]}),e8.topRisks.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Source Risk Analysis"}),(0,a.jsx)("div",{className:"space-y-1.5",children:e8.topRisks.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-start gap-2.5 rounded-lg border border-border bg-background/40 px-3 py-2",children:[(0,a.jsx)("span",{className:(0,$.cn)("text-[10px] font-bold px-1.5 py-0.5 rounded mt-0.5 shrink-0",{"bg-red-500/20 text-red-400":"High"===e.riskLevel,"bg-yellow-500/20 text-yellow-400":"Medium"===e.riskLevel,"bg-green-500/20 text-green-400":"Low"===e.riskLevel}),children:e.riskLevel}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-primary truncate",children:e.domain}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:e.reason})]})]},t))})]}),"Not Required"!==e8.rewriteStrategy.urgency&&(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2",children:"Rewrite Strategy"}),(0,a.jsx)("ol",{className:"space-y-1.5",children:e8.rewriteStrategy.steps.map((e,t)=>(0,a.jsxs)("li",{className:"flex gap-2 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{className:"text-primary font-bold shrink-0",children:[t+1,"."]}),(0,a.jsx)("span",{children:e})]},t))})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-background/40 p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,a.jsx)(I.A,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"SEO Impact"})]}),(0,a.jsx)("p",{className:"text-xs text-foreground",children:e8.seoImpact.description})]}),(0,a.jsx)("button",{onClick:tR,className:"w-full text-center text-xs text-muted-foreground hover:text-primary transition-colors py-1",children:"↺ Regenerate Report"})]})]})]}),(0,a.jsx)(W.av,{value:"files",className:"mt-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,a.jsxs)("div",{className:"rounded-xl border border-border bg-muted/20 p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[(0,a.jsx)(T.A,{className:"w-4 h-4 text-primary"})," Add URLs to check"]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Paste Google Doc, .txt, or any web article URL — one per line."}),(0,a.jsx)(eo.Textarea,{value:tu,onChange:e=>tx(e.target.value),placeholder:"https://docs.google.com/document/d/...\nhttps://example.com/article\nhttps://raw.githubusercontent.com/...",rows:4,className:"font-mono text-xs resize-none bg-background",disabled:tp}),(0,a.jsxs)(d.$,{size:"sm",variant:"outline",disabled:!tu.trim()||tp,onClick:()=>{let e=tu.split("\n").map(e=>e.trim()).filter(e=>e.startsWith("http"));if(!e.length)return;let t=e.map(e=>({id:Math.random().toString(36).slice(2),type:"url",label:e.length>60?e.slice(0,57)+"...":e,rawInput:e,content:"",wordCount:0,creditCost:0,status:"queued"}));tm(e=>[...e,...t]),tx("")},className:"gap-1.5",children:[(0,a.jsx)(D.A,{className:"w-3.5 h-3.5"})," Add to queue"]})]}),(0,a.jsx)(ev,{disabled:tp,onFiles:e=>{let t=e.map(e=>({id:Math.random().toString(36).slice(2),type:"file",label:e.name,file:e,content:"",wordCount:0,creditCost:0,status:"queued"}));tm(e=>[...e,...t])}}),tc.length>0&&(0,a.jsxs)("div",{className:"rounded-xl border border-border overflow-hidden flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border bg-muted/30",children:[(0,a.jsxs)("span",{className:"text-sm font-semibold",children:[tc.length," item",1!==tc.length?"s":""," in queue"]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:tp?(0,a.jsxs)(d.$,{size:"sm",variant:"destructive",className:"gap-1.5 h-7 text-xs",onClick:()=>{tb.current=!0,tg(!1)},children:[(0,a.jsx)(F.A,{className:"w-3.5 h-3.5"})," Stop"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.$,{size:"sm",variant:"ghost",className:"gap-1.5 h-7 text-xs text-muted-foreground",onClick:()=>tm([]),children:[(0,a.jsx)(R.A,{className:"w-3.5 h-3.5"})," Clear all"]}),(0,a.jsxs)(d.$,{size:"sm",className:"gap-1.5 h-7 text-xs",disabled:!r||tc.every(e=>"done"===e.status),onClick:async()=>
1{if(!r){J({title:"Login required",variant:"destructive"});return}tb.current=!1,tg(!0);let e=await r.getIdToken(),t=tc.filter(e=>"queued"===e.status||"error"===e.status);for(let r=0;r<t.length&&!tb.current;r++){let s=t[r];tm(e=>e.map(e=>e.id===s.id?{...e,status:"fetching"}:e));let n=null;if("url"===s.type&&s.rawInput){let{text:t,error:r}=await (0,ee.H)(s.rawInput);if(r||!t){tm(e=>e.map(e=>e.id===s.id?{...e,status:"error",error:r||"Failed to fetch URL"}:e));continue}let a=ec(t.replace(/<[^>]+>/g," ")),l=em(a);tm(e=>e.map(e=>e.id===s.id?{...e,status:"processing",content:t,wordCount:a,creditCost:l}:e)),n=await et(e,t,s.label)}else if(s.file){var a;let t=null===(a=s.file.name.split(".").pop())||void 0===a?void 0:a.toLowerCase();if("txt"===t){let t=await s.file.text().catch(()=>"");if(!t.trim()){tm(e=>e.map(e=>e.id===s.id?{...e,status:"error",error:"File appears to be empty"}:e));continue}let r=ec(t),a=em(r);tm(e=>e.map(e=>e.id===s.id?{...e,status:"processing",content:t,wordCount:r,creditCost:a}:e)),n=await et(e,t,s.label)}else if("pdf"===t||"docx"===t){tm(e=>e.map(e=>e.id===s.id?{...e,status:"processing"}:e));let t=new FormData;t.append("idToken",e),t.append("file",s.file),t.append("source","file");let r=await K(null,t);r.result&&tm(e=>e.map(e=>e.id===s.id?{...e,wordCount:r.result.word_count,creditCost:em(r.result.word_count)}:e)),n=r}else{tm(e=>e.map(e=>e.id===s.id?{...e,status:"error",error:"Unsupported file type. Use .txt, .pdf or .docx"}:e));continue}}else{tm(e=>e.map(e=>e.id===s.id?{...e,status:"error",error:"No content to check"}:e));continue}n&&tm(e=>e.map(e=>{var t,r;return e.id===s.id?{...e,status:n.error?"error":"done",result:null!==(t=n.result)&&void 0!==t?t:void 0,error:null!==(r=n.error)&&void 0!==r?r:void 0}:e})),tf(Math.round((r+1)/t.length*100))}tg(!1)},children:[(0,a.jsx)(P.A,{className:"w-3.5 h-3.5"})," Run All"]})]})})]}),tp&&(0,a.jsxs)("div",{className:"px-4 py-2 border-b border-border",children:[(0,a.jsx)(el.k,{value:th,className:"h-1.5"}),(0,a.jsxs)("p",{className:"text-[10px] text-muted-foreground mt-1",children:[th,"% complete"]})]}),(0,a.jsx)("div",{className:"overflow-y-auto max-h-[420px]",children:tc.map(e=>{let t=e.result?Math.round(100-(e.result.percent_plagiarized||0)):null,r={queued:(0,a.jsx)(U.A,{className:"w-4 h-4 text-muted-foreground"}),fetching:(0,a.jsx)(A.A,{className:"w-4 h-4 text-blue-500 animate-spin"}),processing:(0,a.jsx)(A.A,{className:"w-4 h-4 text-primary animate-spin"}),done:(0,a.jsx)(B.A,{className:"w-4 h-4 text-green-500"}),error:(0,a.jsx)(H.A,{className:"w-4 h-4 text-red-500"})}[e.status];return(0,a.jsx)("div",{className:"border-b border-border last:border-0",children:(0,a.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 hover:bg-muted/20",children:[(0,a.jsx)("div",{className:"shrink-0",children:r}),(0,a.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:"url"===e.type?(0,a.jsx)(T.A,{className:"w-3.5 h-3.5 text-muted-foreground"}):(0,a.jsx)(p.A,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate text-foreground",children:e.label}),(0,a.jsxs)("div",{className:"text-xs text-muted-foreground",children:["queued"===e.status&&"Waiting...","fetching"===e.status&&"Fetching content...","processing"===e.status&&"Scanning ".concat(e.wordCount.toLocaleString()," words..."),"done"===e.status&&e.result&&"".concat(e.wordCount.toLocaleString()," words \xb7 ").concat(e.result.plagiarized_content.length," source").concat(1!==e.result.plagiarized_content.length?"s":""),"error"===e.status&&(0,a.jsx)("span",{className:"text-red-400",children:e.error})]})]}),"done"===e.status&&null!==t&&(0,a.jsxs)("div",{className:(0,$.cn)("text-lg font-black tabular-nums shrink-0",null!==t?t>=80?"text-green-500":t>=50?"text-yellow-500":"text-red-500":""),children:[t,"%"]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["done"===e.status&&e.result&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{className:(0,$.cn)("p-1.5 rounded transition-colors text-sm font-semibold flex items-center gap-1",tv===e.id?"bg-primary/10 text-primary":"hover:bg-muted text-muted-foreground hover:text-foreground"),title:tv===e.id?"Close result":"View full result",onClick:()=>tw(t=>t===e.id?null:e.id),children:tv===e.id?(0,a.jsx)(O.A,{className:"w-3.5 h-3.5"}):(0,a.jsx)(q.A,{className:"w-3.5 h-3.5"})}),(0,a.jsx)("button",{className:"p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Download PDF report",onClick:()=>tT(e.result),children:(0,a.jsx)(N.A,{className:"w-3.5 h-3.5"})})]}),!tp&&(0,a.jsx)("button",{className:"p-1.5 rounded hover:bg-muted text-muted-foreground hover:text-red-400 transition-colors",title:"Remove",onClick:()=>tm(t=>t.filter(t=>t.id!==e.id)),children:(0,a.jsx)(v.A,{className:"w-3.5 h-3.5"})})]})]})},e.id)})}),tc.some(e=>"done"===e.status)&&(0,a.jsxs)("div",{className:"px-4 py-2 border-t border-border bg-muted/20 flex items-center gap-4 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{children:["✅ ",tc.filter(e=>"done"===e.status).length," done"]}),(0,a.jsxs)("span",{children:["⏳ ",tc.filter(e=>"queued"===e.status).length," queued"]}),tc.some(e=>"error"===e.status)&&(0,a.jsxs)("span",{children:["❌ ",tc.filter(e=>"error"===e.status).length," failed"]}),(0,a.jsxs)("span",{className:"ml-auto",children:["Total credits used: ",tc.filter(e=>"done"===e.status).reduce((e,t)=>
1e+t.creditCost,0)]})]})]}),0===tc.length&&(0,a.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-center py-16 text-muted-foreground",children:[(0,a.jsx)(k.A,{className:"w-14 h-14 mb-4 opacity-30"}),(0,a.jsx)("p",{className:"font-semibold text-base",children:"Add URLs or files above to start"}),(0,a.jsx)("p",{className:"text-xs mt-1 max-w-sm",children:"Supports Google Docs links, .txt, .pdf and .docx files. Items are checked sequentially and results can be exported as PDF."})]}),(()=>{let e=tc.find(e=>e.id===tv&&e.result);return e&&e.result?(0,a.jsx)("div",{ref:tj,className:"rounded-xl border border-border overflow-hidden",children:(0,a.jsx)(eb,{result:e.result,label:e.label,onDownload:()=>tT(e.result),onClose:()=>tw(null)})}):null})()]})})]})]})}},5681:(e,t,r)=>{r.d(t,{H:()=>d});var a=r(95155),s=r(12115),n=r(85592),l=r(28247),o=r(75828);let i=(0,o.createServerReference)("40528a71a97d5faafb4e5255cc0ec124f7a50fdf7b",o.callServer,void 0,o.findSourceMapURL,"getToolActiveModel");function d(e){let{toolKey:t,isProcessing:r=!1,className:o="",variant:d="inline"}=e,[c,m]=(0,s.useState)(null);return((0,s.useEffect)(()=>{i(t).then(m).catch(()=>{})},[t,r]),c)?"floating"===d?(0,a.jsxs)("div",{className:"inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-[11px] font-medium border transition-all duration-300 ".concat(r?"bg-primary/15 border-primary/40 text-primary animate-pulse shadow-[0_0_12px_rgba(0,200,150,0.25)]":"bg-background/60 backdrop-blur border-border/50 text-muted-foreground hover:text-foreground"," ").concat(o),children:[r?(0,a.jsx)(n.A,{className:"w-3 h-3 animate-spin"}):(0,a.jsx)(l.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:r?"Running on":"Powered by"}),(0,a.jsx)("strong",{className:r?"text-primary":"text-foreground",children:c.label})]}):(0,a.jsxs)("div",{className:"flex items-center justify-center gap-1.5 text-[11px] rounded-md px-2 py-1.5 border transition-all duration-300 ".concat(r?"bg-primary/10 border-primary/30 text-primary animate-pulse":"bg-muted/30 border-border/40 text-muted-foreground"," ").concat(o),children:[r?(0,a.jsx)(n.A,{className:"w-3 h-3 animate-spin"}):(0,a.jsx)(l.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:r?"Running on":"Powered by"}),(0,a.jsx)("strong",{className:r?"text-primary":"text-foreground",children:c.label})]}):null}},25121:(e,t,r)=>{r.d(t,{E:()=>o});var a=r(95155);r(12115);var s=r(31027),n=r(21567);let l=(0,s.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function o(e){let{className:t,variant:r,...s}=e;return(0,a.jsx)("div",{className:(0,n.cn)(l({variant:r}),t),...s})}},59173:(e,t,r)=>{r.d(t,{k:()=>o});var a=r(95155),s=r(12115),n=r(16838),l=r(21567);let o=s.forwardRef((e,t)=>{let{className:r,value:s,indicatorClassName:o,...i}=e;return(0,a.jsx)(n.bL,{ref:t,className:(0,l.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",r),...i,children:(0,a.jsx)(n.C1,{className:(0,l.cn)("h-full w-full flex-1 bg-primary transition-all",o),style:{transform:"translateX(-".concat(100-(s||0),"%)")}})})});o.displayName=n.bL.displayName},62884:(e,t,r)=>{r.d(t,{Xi:()=>d,av:()=>c,j7:()=>i,tU:()=>o});var a=r(95155),s=r(12115),n=r(58629),l=r(21567);let o=n.bL,i=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.B8,{ref:t,className:(0,l.cn)("inline-flex h-auto items-center justify-center rounded-lg bg-secondary p-1 text-muted-foreground",r),...s})});i.displayName=n.B8.displayName;let d=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(n.l9,{ref:t,className:(0,l.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",r),...s})});d.displayName=n.l9.displayName;let c=s.forwardRef((e,t)=>
1{let{className:r,...s}=e;return(0,a.jsx)(n.UC,{ref:t,className:(0,l.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...s})});c.displayName=n.UC.displayName},46754:(e,t,r)=>{r.d(t,{Textarea:()=>l});var a=r(95155),s=r(12115),n=r(21567);let l=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)("textarea",{className:(0,n.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...s})});l.displayName="Textarea"},14326:(e,t,r)=>{r.d(t,{g:()=>i});var a=r(12115),s=r(71150),n=r(27058),l=r(49904);function o(e,t){return"".concat("9rank_tool_session_").concat(e).concat(t?"_"+t.slice(0,8):"")}function i(e){var t;let r=(0,s.As)(),i=null==r?void 0:null===(t=r.currentUser)||void 0===t?void 0:t.uid,[d,c]=(0,a.useState)(null),[m,u]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{let t=!1;return p(!0),async function(){try{let r=localStorage.getItem(o(e,i));if(r){let a=JSON.parse(r);if(Date.now()-a.completedAt<6048e5){if(!t){c(a),u(!0),p(!1);return}}else localStorage.removeItem(o(e,i))}}catch(e){}if(i)try{let r=(0,n.getFirestore)((0,l.Sx)()),a=(0,n.doc)(r,"users",i,"toolSessions",e),s=await (0,n.getDoc)(a);if(!t&&s.exists()){let t=s.data();if(Date.now()-t.completedAt<6048e5){c(t),u(!0);try{localStorage.setItem(o(e,i),JSON.stringify(t))}catch(e){}}}}catch(e){}t||p(!1)}(),()=>{t=!0}},[e,i]),{session:d,isRestored:m,saveSession:(0,a.useCallback)(async t=>{let{input:r,result:a}=t,s={toolKey:e,input:r,result:a,completedAt:Date.now(),uid:i};try{localStorage.setItem(o(e,i),JSON.stringify(s))}catch(e){}if(i)try{let t=(0,n.getFirestore)((0,l.Sx)()),r=(0,n.doc)(t,"users",i,"toolSessions",e);await (0,n.setDoc)(r,{...s,savedAt:(0,n.serverTimestamp)()})}catch(e){}c(s),u(!0)},[e,i]),clearSession:(0,a.useCallback)(()=>{try{localStorage.removeItem(o(e,i))}catch(e){}c(null),u(!1)},[e,i]),isLoadingSession:x}}},22190:(e,t,r)=>{r.d(t,{Q$:()=>o,aG:()=>l,tx:()=>s});let a="tool_results";function s(e){if(!e)return"0";let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return Math.abs(t).toString(36)}function n(){return new Promise((e,t)=>{let r=window.indexedDB.open("9rank_client_cache",1);r.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(a)||t.createObjectStore(a)},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}async function l(e,t){try{let r=await n();return new Promise((s,n)=>{let l=r.transaction(a,"readwrite"),o=l.objectStore(a),i={data:t,timestamp:Date.now()};o.put(i,e),l.oncomplete=()=>s(),l.onerror=()=>n(l.error)})}catch(e){console.warn("[IndexedDB] setCacheItem failed:",e)}}async function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;try{let r=await n();return new Promise((s,n)=>{let l=r.transaction(a,"readonly").objectStore(a).get(e);l.onsuccess=()=>{let e=l.result;if(!e)return s(null);(Date.now()-e.timestamp)/36e5>t?s(null):s(e.data)},l.onerror=()=>n(l.error)})}catch(e){return console.warn("[IndexedDB] getCacheItem failed:",e),null}}},33621:(e,t,r)=>{function a(e,t){return"@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@500;700;800&display=swap');*{box-sizing:border-box;margin:0;padding:0;}:root{--a:".concat(e,";--ar:").concat(t,";--bg:#07080f;--c1:#0e1121;--c2:#141829;--t:#e2e8f0;--m:#64748b;--b:rgba(255,255,255,0.08);}@page{margin:.75in .6in;}html,body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--t);-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important;margin:0;padding:1.25rem;}.wm{position:fixed;inset:0;z-index:9999;pointer-events:none;background-image:url('").concat("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='190'%3E%3Ctext x='50%25' y='50%25' font-family='Arial Black%2Csans-serif' font-size='26' font-weight='900' fill='rgba(255%2C255%2C255%2C0.07)' text-anchor='middle' dominant-baseline='middle' transform='rotate(-32%2C160%2C95)'%3E9rank.ai™%3C/text%3E%3C/svg%3E","');background-size:320px 190px;-webkit-print-color-adjust:exact;print-color-adjust:exact;}.page{max-width:1080px;margin:0 auto;}.rh{background:linear-gradient(135deg,rgba(").concat(t,",.28) 0%,rgba(14,17,33,.98) 55%,rgba(7,8,15,1) 100%);border:1px solid rgba(").concat(t,",.35);border-radius:20px;padding:2.75rem 2rem;text-align:center;position:relative;overflow:hidden;margin-bottom:1.5rem;}.rh::before{content:'';position:absolute;inset:0;background:url('").concat("data:image/svg+xml,%3Csvg width='44' height='44' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M44 0v44M0 44h44' stroke='rgba(255%2C255%2C255%2C0.04)' stroke-width='1' fill='none'/%3E%3C/svg%3E","');}.rh::after{content:'';position:absolute;bottom:0;left:0;right:0;height:3px;background:linear-gradient(90deg,transparent,").concat(e,",transparent);}.rh-logo{height:46px;margin-bottom:1.25rem;filter:brightness(0) invert(1);position:relative;}.rh-title{font-family:'Outfit',sans-serif;font-size:2.3rem;font-weight:800;color:#fff;position:relative;letter-spacing:-.02em;}.rh-sub{color:rgba(255,255,255,.5);font-size:.95rem;margin-top:.4rem;position:relative;}.rh-meta{display:flex;flex-wrap:wrap;justify-content:center;gap:.75rem;margin-top:1.75rem;position:relative;}.rh-tag{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.14);padding:.32rem 1rem;border-radius:100px;font-size:.82rem;color:rgba(255,255,255,.8);}.rh-tag b{color:").concat(e,";}.rs{background:var(--c1);border:1px solid var(--b);border-radius:16px;padding:1.75rem;margin-bottom:1.25rem;}.rs-t{font-family:'Outfit',sans-serif;font-size:1.2rem;font-weight:700;color:var(--t);margin-bottom:1.25rem;display:flex;align-items:center;gap:.65rem;}.rs-t::before{content:'';display:block;width:4px;height:1.3rem;background:linear-gradient(180deg,").concat(e,",transparent);border-radius:4px;flex-shrink:0;}.sg{display:grid;grid-template-columns:repeat(auto-fill,minmax(155px,1fr));gap:.8rem;}.sc{background:var(--c2);border:1px solid var(--b);border-radius:12px;padding:1.25rem;text-align:center;position:relative;overflow:hidden;}.sc::after{content:'';position:absolute;bottom:0;left:0;right:0;height:2px;background:linear-gradient(90deg,transparent,rgba(").concat(t,",.55),transparent);}.sc-l{font-size:.72rem;color:var(--m);text-transform:uppercase;letter-spacing:.08em;font-weight:600;margin-bottom:.6rem;}.sc-v{font-family:'Outfit',sans-serif;font-size:1.55rem;font-weight:800;color:var(--t);}.ag{display:grid;grid-template-columns:1fr 1fr;gap:.8rem;}.ab{background:var(--c2);border:1px solid rgba(").concat(t,",.18);border-radius:12px;padding:1.1rem;}.ab h4{font-family:'Outfit',sans-serif;font-size:.78rem;font-weight:700;color:").concat(e,";text-transform:uppercase;letter-spacing:.06em;margin-bottom:.4rem;}.ab p{color:var(--m);font-size:.875rem;line-height:1.65;}.pg{display:grid;grid-template-columns:repeat(auto-fill,minmax(185px,1fr));gap:.9rem;}.pc{background:var(--c2);border:1px solid var(--b);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;}.pi{height:140px;
1display:flex;align-items:center;justify-content:center;padding:.75rem;background:rgba(255,255,255,.025);border-bottom:1px solid var(--b);}.pi img{max-width:100%;max-height:100%;object-fit:contain;}.pb{padding:.9rem;flex-grow:1;display:flex;flex-direction:column;}.pn{font-size:.82rem;font-weight:600;line-height:1.4;color:var(--t);margin-bottom:.4rem;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}.pm{font-size:.72rem;color:var(--m);margin-bottom:.5rem;}.pp{font-family:'Outfit',sans-serif;font-size:1.1rem;font-weight:700;color:").concat(e,";margin-top:auto;}.pp s{font-size:.8rem;color:var(--m);font-weight:400;margin-left:.4rem;}table{width:100%;border-collapse:collapse;}th,td{border:1px solid var(--b);padding:.65rem .9rem;text-align:left;font-size:.875rem;}th{background:var(--c2);color:var(--m);font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;font-weight:600;}td{color:var(--t);}tr:nth-child(even) td{background:rgba(255,255,255,.02);}.rf{text-align:center;padding:1.75rem;border-top:1px solid var(--b);margin-top:1.5rem;color:var(--m);font-size:.8rem;}.rf b{color:").concat(e,";}.rf-brand{display:inline-flex;align-items:center;gap:.4rem;font-family:'Outfit',sans-serif;font-size:1rem;font-weight:700;color:").concat(e,";margin-bottom:.5rem;}@media print{html,body{padding:0!important;}.page{padding:0;}.pc,.ab,.sc,.rs-t,tr{page-break-inside:avoid;break-inside:avoid;}}")}function s(){return'<div class="wm" aria-hidden="true"></div>'}function n(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=r&&r.length>0?r.map(e=>'<div class="rh-tag">'.concat(e.label,": <b>").concat(e.value,"</b></div>")).join(""):"";return'<div class="rh"><img class="rh-logo" src="'.concat("https://firebasestorage.googleapis.com/v0/b/studio-4611420815-598af.firebasestorage.app/o/9ranklogo%2F9ranklogo.png?alt=media&token=bf9454ef-3e59-46b4-b646-bc966258edd3",'" alt="9rank.ai"/><div class="rh-title">').concat(e,'</div><div class="rh-sub">').concat(t,"</div>")+(a?'<div class="rh-meta">'.concat(a,"</div>"):"")+"</div>"}function l(){return'<div class="rf"><div class="rf-brand">9rank.ai™</div><div>Digitally Signed &amp; Verified • Powered by AI Market Intelligence</div><div style="margin-top:.5rem">&copy; '.concat(new Date().getFullYear()," 9rank.ai™ &mdash; All Rights Reserved</div></div>")}function o(e,t,r){return'<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>'.concat(e,"</title><style>").concat(t,"</style></head><body>").concat(s(),'<div class="page">').concat(r,"</div></body></html>")}r.d(t,{DV:()=>o,GU:()=>a,M1:()=>s,W9:()=>n,oZ:()=>l})},60007:(e,t,r)=>{function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;if(!e)return;let r=function(e){let t=e.parentElement;for(;t;){let{overflow:e,overflowY:r,overflowX:a}=window.getComputedStyle(t);if(/auto|scroll/.test(e+r+a))return t;t=t.parentElement}return document.documentElement}(e);if(!r||r===document.documentElement||r===document.body||r.scrollHeight<=r.clientHeight){let r=e.getBoundingClientRect(),a=(window.pageYOffset||window.scrollY)+r.top-t;window.scrollTo({top:Math.max(0,a),behavior:"smooth"});return}let a=r.getBoundingClientRect(),s=e.getBoundingClientRect(),n=r.scrollTop+(s.top-a.top)-t;r.scrollTo({top:Math.max(0,n),behavior:"smooth"})}r.d(t,{A:()=>a})},92067:(e,t,r)=>{r.d(t,{H:()=>s});var a=r(75828);let s=(0,a.createServerReference)("404abf38e37f7d517fec28760207fb5fd907022eaa",a.callServer,void 0,a.findSourceMapURL,"fetchDocumentTextAction")}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.