PageSourceSearch

https://inblog.ai/_next/static/chunks/pages/admin/keywords-3282f721fd7ed042.js

js inblog.ai collected 2026-09-24 09:46:29 UTC 33,371 bytes, 2 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0ce64-55ce-76c0-b8be-bfed58723c4e")}catch(e){}}();(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[47768],{1292:(e,s,t)=>{"use strict";t.d(s,{a:()=>i});var a=t(14232);let i=(e=640)=>{let[s,t]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>{let s=()=>{t(window.innerWidth<e)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[e]),s}},24614:(e,s,t)=>{"use strict";t.d(s,{AM:()=>l,Wv:()=>d,hl:()=>o});var a=t(37876),i=t(14232),r=t(13178),n=t(82705);let l=r.bL,d=r.l9;r.Mz;let o=i.forwardRef(({className:e,align:s="center",sideOffset:t=4,...i},l)=>(0,a.jsx)(r.ZL,{children:(0,a.jsx)(r.UC,{ref:l,align:s,sideOffset:t,className:(0,n.cn)("z-[9999] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})}));o.displayName=r.UC.displayName},28196:(e,s,t)=>{"use strict";t.d(s,{S:()=>d});var a=t(37876),i=t(14232),r=t(29470),n=t(5259),l=t(82705);let d=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)(r.bL,{ref:t,className:(0,l.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...s,children:(0,a.jsx)(r.C1,{className:(0,l.cn)("flex items-center justify-center"),children:(0,a.jsx)(n.Srz,{className:"h-4 w-4"})})}));d.displayName=r.bL.displayName},29540:(e,s,t)=>{"use strict";t.d(s,{Hr:()=>m,Ht:()=>f,I:()=>c,SQ:()=>x,_2:()=>u,lp:()=>h,mB:()=>g,rI:()=>d,ty:()=>o});var a=t(37876),i=t(14232),r=t(70852),n=t(5259),l=t(82705);let d=r.bL,o=r.l9,c=r.YJ;r.ZL,r.Pb;let m=r.z6;i.forwardRef(({className:e,inset:s,children:t,...i},d)=>(0,a.jsxs)(r.ZP,{ref:d,className:(0,l.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-zinc-100 data-[state=open]:bg-zinc-100 dark:focus:bg-zinc-800 dark:data-[state=open]:bg-zinc-800",s&&"pl-8",e),...i,children:[t,(0,a.jsx)(n.vKP,{className:"ml-auto h-4 w-4"})]})).displayName=r.ZP.displayName,i.forwardRef(({className:e,...s},t)=>(0,a.jsx)(r.G5,{ref:t,className:(0,l.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border border-zinc-200 bg-white p-1 text-zinc-950 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50",e),...s})).displayName=r.G5.displayName;let x=i.forwardRef(({className:e,sideOffset:s=4,...t},i)=>(0,a.jsx)(r.ZL,{children:(0,a.jsx)(r.UC,{ref:i,sideOffset:s,className:(0,l.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border border-zinc-200 bg-white p-1 text-zinc-950 shadow-md dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));x.displayName=r.UC.displayName;let u=i.forwardRef(({className:e,inset:s,...t},i)=>(0,a.jsx)(r.q7,{ref:i,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-20 dark:focus:bg-zinc-800 dark:focus:text-zinc-50",s&&"pl-8",e),...t}));u.displayName=r.q7.displayName,i.forwardRef(({className:e,children:s,checked:t,...i},d)=>(0,a.jsxs)(r.H_,{ref:d,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-zinc-800 dark:focus:text-zinc-50",e),checked:t,...i,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(r.VF,{children:(0,a.jsx)(n.Srz,{className:"h-4 w-4"})})}),s]})).displayName=r.H_.displayName;let f=i.forwardRef(({className:e,children:s,...t},i)=>(0,a.jsxs)(r.hN,{ref:i,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-zinc-800 dark:focus:text-zinc-50",e),...t,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(r.VF,{children:(0,a.jsx)(n.RiX,{className:"h-4 w-4 fill-current"})})}),s]}));f.displayName=r.hN.displayName;let h=i.forwardRef(({className:e,inset:s,...t},i)=>(0,a.jsx)(r.JU,{ref:i,className:(0,l.cn)("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",e),...t}));h.displayName=r.JU.displayName;let g=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)(r.wv,{ref:t,className:(0,l.cn)("-mx-1 my-1 h-px bg-zinc-100 dark:bg-zinc-800",e),...s}));g.displayName=r.wv.displayName},32843:(e,s,t)=>{"use strict";t.d(s,{d:()=>l});var a=t(37876),i=t(14232),r=t(98295),n=t(82705);let l=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)(r.bL,{className:(0,n.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...s,ref:t,children:(0,a.jsx)(r.zi,{className:(0,n.cn)("pointer-events-none block h-4 w-4 roun
1ded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));l.displayName=r.bL.displayName},33412:(e,s,t)=>{"use strict";t.d(s,{E:()=>l});var a=t(37876);t(14232);var i=t(94650),r=t(82705);let n=(0,i.F)("inline-flex items-center rounded border px-2.5 py-0.5 text-[10px] font-medium 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",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function l({className:e,variant:s,...t}){return(0,a.jsx)("div",{className:(0,r.cn)(n({variant:s}),e),...t})}},33663:(e,s,t)=>{"use strict";t.r(s),t.d(s,{__N_SSP:()=>G,default:()=>O});var a=t(37876),i=t(14232),r=t(75656),n=t(27459),l=t(32653),d=t(16565),o=t(48155),c=t(24614),m=t(28196),x=t(67467),u=t(14802),f=t(71579),h=t(36954),g=t(59787),p=t(47153),j=t(4917),v=t.n(j),y=t(67833),N=t(29540),b=t(1292),w=t(18868);function C({isLoadingData:e,columns:s,data:t}){let[r,g]=(0,i.useState)({left:["query"],right:[]}),[j,S]=(0,i.useState)({}),A=(0,b.a)(768),[R,_]=(0,i.useState)({}),[M,F]=(0,i.useState)([{id:"visits",desc:!0}]),[P,E]=(0,i.useState)([]),[L,I]=(0,i.useState)({}),D=(0,n.N4)({data:t,columns:s,getCoreRowModel:(0,l.HT)(),getExpandedRowModel:(0,l.D0)(),getFilteredRowModel:(0,l.hM)(),getSortedRowModel:(0,l.h5)(),onExpandedChange:I,onRowSelectionChange:_,onColumnVisibilityChange:S,onColumnFiltersChange:E,onColumnPinningChange:g,onSortingChange:F,state:{columnFilters:P,expanded:L,rowSelection:R,columnVisibility:j,columnPinning:r,sorting:M}}),K=(0,i.useRef)(null),[V,$]=(0,i.useState)(void 0);return((0,i.useEffect)(()=>{let e=()=>{K.current&&$(K.current.getClientRects()[0].width-2)},s=v()(e,300);return window.addEventListener("resize",s),e(),()=>{window.removeEventListener("resize",s)}},[]),A)?(0,a.jsxs)("div",{className:"rounded-md border",children:[(0,a.jsx)("div",{className:"w-full flex justify-between items-center p-2 gap-2",children:(0,a.jsx)("div",{className:"flex flex-col gap-2 w-full",children:(0,a.jsx)(p.p,{placeholder:"Filter keywords...",value:D.getColumn("query")?.getFilterValue()??"",onChange:e=>D.getColumn("query")?.setFilterValue(e.target.value),className:"w-full"})})}),(0,a.jsx)("div",{className:"p-2",children:e?(0,a.jsx)("div",{className:"flex justify-center items-center h-40",children:(0,a.jsx)(x.A,{size:24,className:"animate-spin"})}):t.length>0?(0,a.jsx)("div",{className:"space-y-4",children:t.map((e,s)=>(0,a.jsxs)("div",{className:"p-3 border rounded-md",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:e.query}),(0,a.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-sm text-gray-600",children:[(0,a.jsxs)("span",{children:["Visits: ",e.visits]}),(0,a.jsxs)("span",{children:["Impressions: ",e.impressions]}),(0,a.jsxs)("span",{children:["CTR: ",e.ctr.toFixed(2),"%"]}),(0,a.jsxs)("span",{children:["Position: ",e.position.toFixed(1)]})]})]})})}),(0,a.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>{D.getRowModel().rows[s]?.toggleExpanded(!D.getRowModel().rows[s]?.getIsExpanded())},children:D.getRowModel().rows[s]?.getIsExpanded()?"View Less":"View Pages"})]}),D.getRowModel().rows[s]?.getIsExpanded()&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,a.jsx)("h4",{className:"font-medium mb-2",children:"Pages"}),e.pages&&e.pages.length>0?e.pages.map((e,s)=>(0,a.jsx)("div",{className:"mb-2 p-2 bg-gray-50 rounded-md",children:(0,a.jsx)("a",{href:(0,w.M)(e),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm break-all",children:(()=>{try{return decodeURIComponent(e)}catch{return e}})()})},s)):(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"No pages available."})]})]},s))}):(0,a.jsx)("div",{className:"flex justify-center items-center h-40",children:(0,a.jsx)("p",{children:"No results."})})})]}):(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{ref:K,className:"rounded-md border",children:[(0,a.jsxs)("div",{className:"w-full flex justify-between items-center p-2 gap-2",children:[(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)(p.p,{placeholder:"Search keywords...",value:D.getColumn("query")?.getFilterValue()??"",onChange:e=>D.getColumn("query")?.setFilterValue(e.target.value),className:"max-w-sm"})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(c.AM,{children:[(0,a.jsx)(c.Wv,{asChild:!0,children:(0,a.jsxs)(o.$,{variant:"ghost",className:"ml-auto flex gap-2 items-center",children:[(0,a.jsx)(u.A,{size:16}),"Columns"]})}),(0,a.jsxs)(c.hl,{className:"w-[250px] max-h-[300px] overflow-y-auto",align:"end",children:[(0,a.jsx)("p",{className:"mb-3 font-medium",children:"Columns"}),(0,a.jsx)("div",{className:"flex flex-col gap-2",children:D.getAllColumns().filter(e=>e.getCanHide()).map(e=>{let s=e.columnDef.meta,t=s?.label||e.id;return(0,a.jsxs)("div",{className:"w-full flex items-center gap-2",children:[(0,a.jsx)(m.S,{className:"capitalize",checked:e.getIsVisible(),onCheckedChange:s=>e.toggleVisibility(!!s)}),(0,a.jsx)("p",{children:t})]},e.id)})})]})]}),(0,a.jsxs)(N.rI,{children:[(0,a.jsx)(N.ty,{asChild:!0,children:(0,a.jsxs)(o.$,{variant:"ghost",disabled:!t||0===t.length,children:[(0,a.jsx)(f.A,{className:"w-4 h-4 mr-1"}),"Export Data"]})}),(0,a.jsx)(N.SQ,{children:(0,a.jsx)(N._2,{children:(0,a.jsx)(y.CSVLink,{headers:["index",...D.getAllColumns().filter(e=>"select"!==e.id).map(e=>{let s=e.columnDef.meta;return s?.label??e.id})],data:(t??[]).map((e,s)=>{let t={index:s+1};return D.getAllColumns().filter(e=>
1"select"!==e.id).forEach(s=>{let a=s.columnDef.meta,i=a?.label??s.id,r=e[s.id];t[i]=Array.isArray(r)?r.join("; "):r??""}),t}),filename:`inblog_keywords_${new Date().toLocaleDateString()}.csv`,children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(h.A,{size:16,className:"mr-2"}),"Export as CSV"]})})})})]})]})]}),(0,a.jsx)("div",{className:"relative h-[700px] overflow-auto",children:(0,a.jsxs)(d.XI,{style:{tableLayout:"fixed",width:"100%"},children:[(0,a.jsx)(d.A0,{className:"sticky top-0 z-10",children:D.getHeaderGroups().map(e=>(0,a.jsx)(d.Hj,{children:e.headers.map(e=>(0,a.jsx)(d.nd,{style:{width:k[e.column.id]??"auto"},className:"border-b bg-gray-50",children:e.isPlaceholder?null:(0,n.Kv)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,a.jsx)(d.BF,{children:e?(0,a.jsx)(d.Hj,{children:(0,a.jsx)(d.nA,{colSpan:s.length,className:"h-40 text-center w-full p-0",children:(0,a.jsx)("div",{className:"sticky top-0 left-0 flex justify-center items-center h-full",style:{width:V??"100%"},children:(0,a.jsx)(x.A,{size:24,className:"animate-spin"})})})}):D.getRowModel().rows?.length?D.getRowModel().rows.map(e=>(0,a.jsx)(z,{row:e,columnLength:s.length,visibleTableWidth:V},e.id)):(0,a.jsx)(d.Hj,{children:(0,a.jsx)(d.nA,{colSpan:s.length,className:"h-40 text-center w-full p-0",children:(0,a.jsx)("div",{className:"sticky top-0 left-0 flex justify-center items-center h-full",style:{width:V},children:"No results."})})})})]})})]})})}let k={query:"35%",visits:"8%",visitsChange:"7%",impressions:"10%",impressionsChange:"7%",ctr:"8%",ctrBenchmarkDifference:"6%",position:"10%",positionChange:"7%",pages:"6%"},z=({row:e,columnLength:s,visibleTableWidth:t})=>{let i=e.original.pages??[];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.Hj,{"data-state":e.getIsSelected()&&"selected",className:"cursor-pointer",onClick:()=>e.toggleExpanded(!e.getIsExpanded()),children:e.getVisibleCells().map(e=>(0,a.jsx)(d.nA,{className:"h-12 px-3 py-2",style:{width:k[e.column.id]??"auto"},children:(0,n.Kv)(e.column.columnDef.cell,e.getContext())},e.id))},e.id),e.getIsExpanded()&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:s,className:"border-b border-gray-200 w-full relative p-0",children:(0,a.jsx)("div",{className:"left-0 flex pl-10 w-full",style:{width:t??"100%"},children:(0,a.jsx)("div",{className:"space-y-2",children:i.length>0?i.map((e,s)=>(0,a.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-gray-50 rounded-md w-full",children:[(0,a.jsx)(g.A,{size:16,className:"text-gray-500"}),(0,a.jsx)("a",{href:(0,w.M)(e),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline break-all",children:(()=>{try{return decodeURIComponent(e)}catch{return e}})()})]},s)):(0,a.jsx)("p",{className:"text-gray-500",children:"No pages available."})})})})})]})};var S=t(81452),A=t(32549),R=t(84858),_=t(10707),M=t(55305),F=t(1046),P=t(49715),E=t(33412);let L=({value:e,isPercentage:s=!1,isAbsolute:t=!1})=>{if(void 0===e||0===e)return null;if(t){let s=e>0?"text-green-600":"text-red-600";return(0,a.jsx)("div",{className:`flex items-center gap-1 ${s}`,children:(0,a.jsxs)("span",{className:"text-xs font-medium",children:[e>0?"+":"",e]})})}let i=e>0,r=Math.abs(e),n=i?S.A:A.A;return(0,a.jsxs)("div",{className:`flex items-center gap-1 ${i?"text-green-600":"text-red-600"}`,children:[(0,a.jsx)(n,{size:12}),(0,a.jsx)("span",{className:"text-xs font-medium",children:s?`${r.toFixed(1)}%`:r.toFixed(2)})]})},I=[{accessorKey:"query",meta:{label:"Keyword"},header:"Keyword",cell:({row:e})=>(0,a.jsx)("div",{className:"flex items-center gap-2 cursor-pointer h-full text-left",children:(0,a.jsx)("span",{className:"hover:underline font-medium whitespace-normal break-words",children:e.original.query})}),enableHiding:!1},{accessorKey:"visits",meta:{label:"Clicks"},header:({column:e})=>(0,a.jsxs)("div",{className:"flex items-center gap-1 cursor-pointer w-full justify-end text-right",onClick:()=>e.toggleSorting("asc"===e.getIsSorted()),children:["Visits",(0,a.jsx)(R.A,{size:14})]}),cell:({row:e})=>(0,a.jsx)("div",{className:"text-right font-medium",children:e.original.visits})},{accessorKey:"visitsChange",meta:{label:"Clicks Change"},header:({column:e})=>(0,a.jsxs)("div",{className:"flex items-center gap-1 cursor-pointer w-full justify-end text-right",onClick:()=>e.toggleSorting("asc"===e.getIsSorted()),children:["Change",(0,a.jsx)(R.A,{size:14})]}),cell:({row:e})=>(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(L,{value:e.original.visitsChange,isAbsolute:!0})})},{accessorKey:"impressions",meta:{label:"Impressions"},header:({column:e})=>(0,a.jsxs)("div",{className:"flex items-center gap-1 cursor-pointer w-full justify-end text-right",onClick:()=>e.toggleSorting("asc"===e.getIsSorted()),children:["Impressions",(0,a.jsx)(R.A,{size:14})]}),cell:({row:e})=>(0,a.jsx)("div",{className:"text-right font-medium",children:e.original.impressions})},{accessorKey:"impressionsChange",meta:{label:"Impressions Change"},header:({column:e})=>(0,a.jsxs)("div",{className:"flex items-center gap-1 cursor-pointer w-full justify-end text-right",onClick:()=>e.toggleSorting("asc"===e.getIsSorted()),children:["Change",(0,a.jsx)(R.A,{size:14})]}),cell:({row:e})=>(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(L,{value:e.original.impressionsChange,isAbsolute:!0})})},{accessorKey:"ctr",meta:{label:"CTR"},header:({column:e})=>(0,a.jsxs)("div",{className:"flex items-center cursor-pointer w-full justify-end text-right gap-1",onClick:()=>e.toggleSorting("asc"===e.getIsSorted()),children:[(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsx)("span",{children:"CTR"}),(0,a.jsx)("span",{className:"text-[10px] text-gray-500 leading-3",children:"(Benchmark)"})]}),(0,a.jsx)(R.A,{size:14})]}),cell:({row:e})=>{let{ctr:s,benchmarkCtr:t}=e.original;if(void 0===t)return(0,a.jsx)("div",{className:"flex items-center gap-2 justify-end",children:(0,a.jsxs)("span",{className:"font-medium",children:[s.toFixed(2),"%"]})});let i=s<t;return(0,a.jsxs)("div",{className:"flex flex-col items-end justify-center",children:[(0,a.jsxs)("div",{className:`font-medium ${i?"text-red-600":"text-black"}`,children:[s.toFixed(2),"%"]}),i&&(0,a.jsxs)("div",{className:"text-xs text-gray-500 leading-3",children:["(",t.toFixed(2),"%)"]})]})}},{accessorKey:"ctrBenchmarkDifference",meta:{label:"CTR Change vs Benchmark"},header:({column:e})=>(0,a.jsxs)("div",{className:"flex items-center gap-1 cursor-pointer w-full justify-end text-right",onClick:()=>e.toggleSorting("asc"===e.getIsSorted()),children:["Diff.",(0,a.jsx)(R.A,{size:14})]}),cell:({row:e})=>{let{ctrBenchmarkDifference:s}=e.original;return void 0===s||s>=0?null:(0,a.jsx)("div",{className:"flex items-center gap-1 text-red-600 justify-end",children:(0,a.jsxs)("span",{className:"text-xs font-medium",children:[s.toFixed(1),"%"]})})}},{accessorKey:"position",meta:{label:"Position"},header:({column:e})=>(0,a.jsxs)("div",{className:"flex items-center gap-1 cursor-pointer w-full rounded-md justify-end",onClick:()=>e.toggleSorting("asc"===e.getIsSorted()),children:["Position",(0,a.jsx)(R.A,{size:14})]}),cell:({row:e})=>{let s=void 0!==e.original.position?Math.round(10*e.original.position)/10:void 0,t=void 0!==e.original.previousPosition?Math.round(10*e.original.previousPosition)/10:void 0,i=void 0!==e.original.positionChange?Math.round(10*e.original.positionChange)/10:void 0,r=e=>e<=3?"bg-green-100 text-green-800 border-green-200":e<=10?"bg-yellow-100 text-yellow-800 border-yellow-200":"bg-red-100 text-red-800 border-red-200";return void 0===s&&void 0!==t?(0,a.jsxs)("div",{className:"flex items-center gap-1 justify-end",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-500",children:t.toFixed(1)}),(0,a.jsx)(_.A,{size:12,className:"text-gray-500"}),(0,a.jsx)(M.A,{size:12,className:"text-gray-500"})]}):void 0!==s&&void 0===t?(0,a.jsxs)("div",{className:"flex items-center gap-1 justify-end",children:[(0,a.jsx)(M.A,{size:12,className:"text-gray-500"}),(0,a.jsx)(_.A,{size:12,className:"text-gray-500"}),(0,a.jsx)(E.E,{variant:"outline",className:`${r(s)} text-xs`,children:s.toFixed(1)})]}):void 0!==s&&void 0!==t&&void 0!==i&&0!==i?(0,a.jsxs)("div",{className:"flex items-center gap-1 justify-end",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-500",children:t.toFixed(1)}),(0,a.jsx)(_.A,{size:12,className:"text-gray-500"}),(0,a.jsx)(E.E,{variant:"outline",className:`${r(s)} text-xs`,children:s.toFixed(1)})]}):void 0!==s?(0,a.jsx)("div",{className:"flex justify-end",children:(0,a.jsx)(E.E,{variant:"outline",className:`${r(s)} text-xs`,children:s.toFixed(1)})}):null}},{accessorKey:"positionChange",meta:{label:"Change"},header:({column:e})=>(0,a.jsxs)("div",{className:"flex items-center gap-1 cursor-pointer w-full justify-end",onClick:()=>e.toggleSorting("asc"===e.getIsSorted()),children:["Change",(0,a.jsx)(R.A,{size:14})]}),sortingFn:(e,s)=>{let t=e.original,a=s.original,i=e=>void 0!==e.positionChange&&e.positionChange>0?0:void 0===e.position&&void 0!==e.previousPosition?1:0===e.positionChange?2:void 0===e.previousPosition&&void 0!==e.position?3:void 0!==e.positionChange&&e.positionChange<0?4:5,r=i(t),n=i(a);if(r!==n)return r-n;switch(r){case 0:case 4:return a.positionChange-t.positionChange;case 1:return t.previousPosition-a.previousPosition;case 2:case 3:return a.position-t.position;default:return 0}},cell:({row:e})=>{let s=void 0!==e.original.position?Math.round(10*e.original.position)/10:void 0,t=void 0!==e.original.previousPosition?Math.round(10*e.original.previousPosition)/10:void 0,i=void 0!==e.original.positionChange?Math.round(10*e.original.positionChange)/10:void 0;if(void 0===s&&void 0!==t)return(0,a.jsx)("div",{className:"text-right text-xs font-medium text-red-500",children:"Lost"});if(void 0!==s&&void 0===t)return(0,a.jsx)("div",{className:"text-right text-xs font-medium text-green-600",children:"New"});if(void 0!==i&&0!==i&&void 0!==s){let e=i<0,s=e?F.A:P.A;return(0,a.jsxs)("div",{className:`flex items-center gap-1 ${e?"text-green-600":"text-red-600"} justify-end`,children:[(0,a.jsx)(s,{size:12}),(0,a.jsx)("span",{className:"text-xs font-medium",children:Math.abs(i).toFixed(1)})]})}return null}},{accessorKey:"pages",meta:{label:"Pages"},header:({column:e})=>(0,a.jsx)("div",{className:"flex items-center gap-1 cursor-pointer w-full justify-center",children:"Pages"}),cell:({row:e})=>{let s=e.original.pages?.length||0;return(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)(E.E,{variant:"secondary",className:"text-xs",children:s})})}}];var D=t(73921),K=t(23481),V=t(93487),$=t(82705),B=t(32843),T=t(74947);let H={1:.304,2:.162,3:.0973,4:.0659,5:.0469,6:.0338,7:.0256,8:.0197,9:.015,10:.0113,11:.0091,12:.0075,13:.0059,14:.0056,15:.0051,16:.0043,17:.0043,18:.0033,19:.0027,20:.0024,21:.0023,22:.0022,23:.0021,24:.002205,25:.002052,26:.001915,27:.001792,28:.001681,29:.001581,30:.001489,31:.001406,32:.001329,33:.001259,34:.001195,35:.001135,36:.001081,37:.00103,38:982e-6,39:939e-6,40:898e-6,41:86e-5,42:824e-6,43:79e-5,44:759e-6,45:73e-5,46:702e-6,47:676e-6,48:651e-6,49:628e-6,50:606e-6};function q({subdomain:e}){let[s,t]=(0,i.useState)({from:new Date(Date.now()-2592e6),to:new Date}),[n,l]=(0,i.useState)(!0),d=async()=>
1{if(!s?.from||!s?.to)return[];let t=await fetch("/api/googleSearch/keywordsByBlogSubdomain",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subdomain:e,startDate:(0,V.GP)(s.from,"yyyy-MM-dd"),endDate:(0,V.GP)(s.to,"yyyy-MM-dd"),includePrevious:n})});if(!t.ok)throw Error("Failed to fetch keywords");return(await t.json()).rows||[]},{data:m,error:x,isLoading:u,mutate:f}=(0,r.Ay)(s?.from&&s?.to?["keywords",e,s.from,s.to,n]:null,d),h=m?.map(e=>{if(void 0===e.position)return{...e,benchmarkCtr:0,ctrBenchmarkDifference:0};let s=(e=>{let s=Math.floor(e),t=Math.ceil(e);if(H[s.toString()]){if(s===t)return 100*H[s.toString()];if(H[t.toString()]){let a=H[s.toString()],i=H[t.toString()],r=e-s;return((1-r)*a+r*i)*100}}return 0})(e.position),t=e.ctr-s;return{...e,benchmarkCtr:s,ctrBenchmarkDifference:s>0?t/s*100:0}}),g=(e,s=!1)=>{if(!n||void 0===e||0===e)return null;let t=e>0?"+":"",i=e>0?"text-green-600":"text-red-600",r=s?`${e.toFixed(1)}%`:e.toLocaleString();return(0,a.jsxs)("span",{className:`text-sm font-medium ${i}`,children:["(",t,r,")"]})},p=m?.reduce((e,s)=>e+s.visits,0)??0,j=m?.reduce((e,s)=>e+s.impressions,0)??0,v=m?.reduce((e,s)=>e+(s.visitsChange??0),0)??0,y=m?.reduce((e,s)=>e+(s.impressionsChange??0),0)??0,N=m?.filter(e=>void 0!==e.position).length??0,b=N-(m?.filter(e=>void 0!==e.previousPosition).length??0),w=(m?.reduce((e,s)=>e+s.ctr,0)??0)/(m?.length||1),k=p-v,z=j-y,A=w-(z>0?k/z*100:0);return(0,a.jsxs)("div",{className:"w-full space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold",children:"Keywords Analytics"}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Blog Subdomain: ",e," - Search Console keyword performance"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(B.d,{id:"comparison-mode",checked:n,onCheckedChange:l}),(0,a.jsxs)(T.J,{htmlFor:"comparison-mode",className:"flex items-center gap-1",children:[(0,a.jsx)(S.A,{size:16}),"Compare with previous period"]})]}),(0,a.jsxs)(c.AM,{children:[(0,a.jsx)(c.Wv,{asChild:!0,children:(0,a.jsxs)(o.$,{id:"date",variant:"outline",className:(0,$.cn)("w-[280px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[(0,a.jsx)(K.A,{className:"mr-2 h-4 w-4"}),s?.from?s.to?(0,a.jsxs)(a.Fragment,{children:[(0,V.GP)(s.from,"MMM dd")," -"," ",(0,V.GP)(s.to,"MMM dd, y")]}):(0,V.GP)(s.from,"LLL dd, y"):(0,a.jsx)("span",{children:"Pick a date range"})]})}),(0,a.jsx)(c.hl,{className:"w-auto p-0",align:"start",children:(0,a.jsx)(D.V,{initialFocus:!0,mode:"range",defaultMonth:s?.from,selected:s,onSelect:e=>{t(e)},numberOfMonths:2})})]}),(0,a.jsx)(o.$,{onClick:()=>{f()},disabled:u,size:"sm",children:"Refresh"})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[m&&m.length>0&&(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"bg-white p-4 rounded-lg border",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-500",children:"Total Keywords"}),(0,a.jsxs)("p",{className:"text-2xl font-bold flex items-center gap-2",children:[N.toLocaleString(),g(b)]})]}),(0,a.jsxs)("div",{className:"bg-white p-4 rounded-lg border",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-500",children:"Total Visits"}),(0,a.jsxs)("p",{className:"text-2xl font-bold flex items-center gap-2",children:[p.toLocaleString(),g(v)]})]}),(0,a.jsxs)("div",{className:"bg-white p-4 rounded-lg border",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-500",children:"Total Impressions"}),(0,a.jsxs)("p",{className:"text-2xl font-bold flex items-center gap-2",children:[j.toLocaleString(),g(y)]})]}),(0,a.jsxs)("div",{className:"bg-white p-4 rounded-lg border",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-500",children:"Average CTR"}),(0,a.jsxs)("p",{className:"text-2xl font-bold flex items-center gap-2",children:[w.toFixed(2),"%",g(A,!0)]})]})]}),x&&(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-4",children:(0,a.jsxs)("p",{className:"text-red-800",children:["Error loading keywords: ",x.message]})}),(0,a.jsx)(C,{isLoadingData:u,columns:I,data:h||[]})]})]})}var U=t(56349),Z=t(68917),G=!0;function O({}){let[e,s]=(0,i.useState)("blog"),[t,r]=(0,i.useState)("blog"),n=()=>{e&&r(e)};return(0,a.jsx)(Z.U,{children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto 
1space-y-6",children:(0,a.jsxs)(U.Zp,{children:[(0,a.jsx)(U.aR,{children:(0,a.jsx)(U.ZB,{children:"Admin - Keywords Analytics"})}),(0,a.jsxs)(U.Wu,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"blogSubdomain",className:"text-sm font-medium",children:"Blog Subdomain:"}),(0,a.jsx)(p.p,{id:"blogSubdomain",type:"text",value:e,onChange:e=>s(e.target.value),onKeyPress:e=>{"Enter"===e.key&&n()},className:"w-32",placeholder:"Enter blog subdomain"}),(0,a.jsx)(o.$,{onClick:n,size:"sm",children:"Load Keywords"})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-500",children:["Current: Blog Subdomain ",t]})]}),(0,a.jsx)(q,{subdomain:t})]})]})})})}},47153:(e,s,t)=>{"use strict";t.d(s,{p:()=>n});var a=t(37876),i=t(14232),r=t(82705);let n=i.forwardRef(({className:e,type:s,...t},i)=>(0,a.jsx)("input",{type:s,className:(0,r.cn)("flex h-9 w-full rounded-md border border-input bg-white px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:i,...t}));n.displayName="Input"},56349:(e,s,t)=>{"use strict";t.d(s,{BT:()=>o,Wu:()=>c,ZB:()=>d,Zp:()=>n,aR:()=>l,wL:()=>m});var a=t(37876),i=t(14232),r=t(82705);let n=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)("div",{ref:t,className:(0,r.cn)("rounded-xl border bg-card text-card-foreground shadow",e),...s}));n.displayName="Card";let l=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)("div",{ref:t,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",e),...s}));l.displayName="CardHeader";let d=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)("h3",{ref:t,className:(0,r.cn)("font-semibold leading-none tracking-tight",e),...s}));d.displayName="CardTitle";let o=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)("div",{ref:t,className:(0,r.cn)("text-sm text-muted-foreground",e),...s}));o.displayName="CardDescription";let c=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)("div",{ref:t,className:(0,r.cn)("p-6 pt-0",e),...s}));c.displayName="CardContent";let m=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)("div",{ref:t,className:(0,r.cn)("flex items-center p-6 pt-0",e),...s}));m.displayName="CardFooter"},73921:(e,s,t)=>{"use strict";t.d(s,{V:()=>d});var a=t(37876);t(14232);var i=t(5259),r=t(18133),n=t(82705),l=t(48155);function d({className:e,classNames:s,showOutsideDays:t=!0,...o}){return(0,a.jsx)(r.hv,{showOutsideDays:t,className:(0,n.cn)("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:(0,n.cn)((0,l.r)({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:(0,n.cn)("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===o.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:(0,n.cn)((0,l.r)({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50  aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...s},components:{IconLeft:({...e})=>(0,a.jsx)(i.YJP,{className:"h-4 w-4"}),IconRight:({...e})=>(0,a.jsx)(i.vKP,{className:"h-4 w-4"})},...o})}
1d.displayName="Calendar"},74947:(e,s,t)=>{"use strict";t.d(s,{J:()=>o});var a=t(37876),i=t(14232),r=t(59773),n=t(94650),l=t(82705);let d=(0,n.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),o=i.forwardRef(({className:e,...s},t)=>(0,a.jsx)(r.b,{ref:t,className:(0,l.cn)(d(),e),...s}));o.displayName=r.b.displayName},99012:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/keywords",function(){return t(33663)}])}},e=>{e.O(0,[25587,54587,64455,75372,93487,27459,18133,29291,4138,90636,46593,38792],()=>e(e.s=99012)),_N_E=e.O()}]);
2//# chunkId=01a0ce64-55ce-76c0-b8be-bfed58723c4e

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.