import{j as e,r as i,a as G}from"./app-BwDemWQz.js";import{a as F,b as M,c as L,I as X,f as _,A as $}from"./AppLayout-3zbhnyYw.js";import{u as Y}from"./LanguageContext-zkEAKPTE.js";import{T as D,a as Q,b as R}from"./Tabs-BWJM2jyE.js";import{P as Z,E as ee}from"./EngagementChart-DDUpuDcT.js";import{S as ae}from"./StatisticByGender-CD_auR5u.js";import{B as m}from"./Button-B-KWyoQR.js";import{P as te}from"./PlatformIcon-BoGOJKWv.js";import{I as A}from"./Input-BJaxI6jp.js";import{a as O,E as se,S as re}from"./emoji-picker-react.esm-C2auypZg.js";import{s as S}from"./index-CkDmAPFS.js";import{c as K}from"./createLucideIcon-BASx8f0E.js";/* empty css            */import"./index-DxJALBsh.js";import"./Label-1lm7x8-L.js";import"./zap-BsHQ4DWF.js";import"./rocket-Dt03WmgU.js";import"./users-g1HvrzO9.js";import"./globe-C_ZhZ5i9.js";import"./trending-up-rMXlpbCa.js";import"./chevron-left-BxYqeqJW.js";import"./download-Bp5_-seZ.js";/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const le=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],ie=K("reply",le);/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ne=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],ce=K("wand-sparkles",ne),de=({post:t})=>{var n,c;return e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-lg border-2 border-cyan-400 p-6",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(F,{className:"h-10 w-10",children:[e.jsx(M,{src:(n=t==null?void 0:t.account)==null?void 0:n.avatar,alt:"User Avatar"}),e.jsx(L,{children:"AV"})]}),e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-5 h-5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center border-2 border-white dark:border-gray-900",children:e.jsx(te,{slug:(c=t.platform)==null?void 0:c.slug,size:14,round:!0})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white",children:t==null?void 0:t.author}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(t.date).toLocaleDateString(void 0,{weekday:"short",year:"numeric",month:"short",day:"numeric"})})]})]})}),e.jsx("div",{className:"mb-4",children:e.jsx("p",{className:"text-gray-900 dark:text-white leading-relaxed",children:(t==null?void 0:t.content)||"Hey there! I'm excited to share with you some incredible tools that you absolutely need to get familiar with. These tools are not just handy per..."})}),t.media&&t.media.length>0&&e.jsxs("div",{className:"mx-4 mt-3 rounded-lg overflow-hidden flex gap-1",children:[t.media.slice(0,2).map(s=>s.isVideo?e.jsx("video",{src:s.thumbnail||"/placeholder.mp4",className:"w-1/2 aspect-video object-cover rounded",muted:!0,playsInline:!0},s.id):e.jsx("img",{src:s.url||"/placeholder.svg",alt:s.alt||"Post content",className:"w-1/2 aspect-video object-cover rounded"},s.id)),t.media.length>2&&e.jsxs("div",{className:"w-1/2 aspect-video bg-gray-200 dark:bg-gray-800 rounded flex items-center justify-center text-gray-700 dark:text-gray-300 font-semibold text-lg",children:["+",t.media.length-2]})]})]})},oe=({comments:t=[],onAddComment:n,account:c})=>{const[s,d]=i.useState(""),[b,v]=i.useState(!1),[p,x]=i.useState(!1),[f,o]=i.useState(!1),[h,C]=i.useState(!1),[j,N]=i.useState([]),[g,u]=i.useState(!1),[T,z]=i.useState(null),[w,P]=i.useState(""),E=i.useRef(null),W=a=>{d(r=>r+a.emoji),v(!1)},B=a=>{const r=Array.from(a.target.files);N(l=>[...l,...r])},H=async()=>{if(s.trim()){u(!0);try{const r=await(await fetch(S("user.ai.improve-text"),{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').getAttribute("content")},body:JSON.stringify({text:s})})).json();r.improved_text&&d(r.improved_text)}catch(a){console.error("Error improving text:",a)}finally{u(!1),x(!1)}}},U=async a=>{if(s.trim()){u(!0);try{const l=await(await fetch(S("user.ai.change-tone"),{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').getAttribute("content")},body:JSON.stringify({text:s,tone:a})})).json();l.modified_text&&d(l.modified_text)}catch(r){console.error("Error changing tone:",r)}finally{u(!1),x(!1),o(!1)}}},q=async a=>{if(s.trim()){u(!0);try{const l=await(await fetch(S("user.ai.translate"),{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]').getAttribute("content")},body:JSON.stringify({text:s,target_language:a})})).json();l.translated_text&&d(l.translated_text)}catch(r){console.error("Error translating text:",r)}finally{u(!1),x(!1),C(!1)}}},J=a=>{a.preventDefault(),s.trim()&&(n==null||n(s,j),d(""),N([]))},I=a=>{w.trim()&&(z(null),P(""))},V=t&&t.length>0;return e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-lg border border-gray-200 dark:border-zinc-800",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-zinc-800",children:e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Comments"})}),e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-zinc-800 relative",children:e.jsxs("form",{onSubmit:J,children:[e.jsxs("div",{className:"flex items-center space-x-3 mb-4",children:[e.jsxs(F,{className:"h-10 w-10",children:[e.jsx(M,{src:c==null?void 0:c.avatar,alt:"User Avatar"}),e.jsx(L,{children:"AV"})]}),e.jsx(A,{value:s,onChange:a=>d(a.target.value),placeholder:"Write a comment...",className:"flex-1 border-none bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 text-gray-500 placeholder:text-gray-400",disabled:g})]}),j.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:j.map((a,r)=>e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:URL.createObjectURL(a)||"/placeholder.svg",alt:`Selected ${r+1}`,className:"w-16 h-16 object-cover rounded-lg"}),e.jsx("button",{type:"button",onClick:()=>N(l=>l.filter((k,y)=>y!==r)),className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs",children:"×"})]},r))}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2 relative",children:[e.jsxs("div",{className:"relative",children:[e.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 hover:text-gray-600 p-1",onClick:()=>v(!b),children:e.jsx(O,{className:"h-4 w-4"})}),b&&e.jsx("div",{className:"absolute bottom-full left-0 mb-2 z-50",children:e.jsx(se,{onEmojiClick:W})})]}),e.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 hover:text-gray-600 p-1",onClick:()=>{var a;return(a=E.current)==null?void 0:a.click()},children:e.jsx(X,{className:"h-4 w-4"})}),e.jsx("input",{ref:E,type:"file",multiple:!0,accept:"image/*",onChange:B,className:"hidden"}),e.jsxs("div",{className:"relative",children:[e.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 hover:text-gray-600 p-1",onClick:()=>x(!p),disabled:g,children:e.jsx(ce,{className:"h-4 w-4"})}),p&&e.jsxs("div",{className:"absolute bottom-full left-0 mb-2 bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 rounded-lg shadow-lg py-2 min-w-48 z-50",children:[e.jsxs("button",{type:"button",onClick:H,disabled:!s.trim()||g,className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center space-x-2 disabled:opacity-50",children:[e.jsx("span",{children:"✨"}),e.jsx("span",{children:"Improve writing"})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>o(!f),className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{children:"🎭"}),e.jsx("span",{children:"Change tone"})]}),e.jsx(_,{className:"h-4 w-4"})]}),f&&e.jsx("div",{className:"absolute left-full top-0 ml-1 bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 rounded-lg shadow-lg py-2 min-w-32",children:["Formal","Casual","Friendly"].map(a=>e.jsx("button",{type:"button",onClick:()=>U(a.toLowerCase()),disabled:!s.trim()||g,className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50",children:a},a))})]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>C(!h),className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("span",{children:"🌐"}),e.jsx("span",{children:"Translate"})]}),e.jsx(_,{className:"h-4 w-4"})]}),h&&e.jsx("div",{className:"absolute left-full top-0 ml-1 bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 rounded-lg shadow-lg py-2 min-w-48 max-h-64 overflow-y-auto",children:["Arabic","Chinese (Simplified)","Chinese (Traditional)","Dutch","English (United Kingdom)","French","German","Spanish","Italian","Japanese","Korean","Portuguese"].map(a=>e.jsx("button",{type:"button",onClick:()=>q(a),disabled:!s.trim()||g,className:"w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-50",children:a},a))})]})]})]})]}),e.jsx(m,{type:"submit",size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white p-2",disabled:!s.trim()||g,children:e.jsx(re,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"p-4",children:V?e.jsx("div",{className:"space-y-4",children:t.map(a=>{var r,l,k;return e.jsx("div",{className:"border-b border-gray-100 dark:border-gray-700 last:border-b-0 pb-4 last:pb-0",children:e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("img",{src:((r=a.user)==null?void 0:r.avatar)||"/placeholder.svg?height=32&width=32",alt:(l=a.user)==null?void 0:l.name,className:"w-8 h-8 rounded-full object-cover flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[e.jsx("span",{className:"font-medium text-sm text-gray-900 dark:text-white",children:(k=a.user)==null?void 0:k.name}),e.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:a.created_at})]}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mb-3",children:a.content}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(m,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-gray-600 h-6 px-0",children:e.jsx(O,{className:"h-4 w-4"})}),e.jsx(m,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-gray-600 h-6 px-0",onClick:()=>z(T===a.id?null:a.id),children:e.jsx(ie,{className:"h-4 w-4"})})]}),T===a.id&&e.jsx("div",{className:"mt-3 ml-4 border-l-2 border-gray-200 dark:border-gray-600 pl-4",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("img",{src:"/placeholder.svg?height=24&width=24",alt:"Your avatar",className:"w-6 h-6 rounded-full object-cover flex-shrink-0"}),e.jsx(A,{value:w,onChange:y=>P(y.target.value),placeholder:"Write a reply...",className:"flex-1 text-sm",onKeyPress:y=>{y.key==="Enter"&&I(a.id)}}),e.jsx(m,{size:"sm",onClick:()=>I(a.id),disabled:!w.trim(),className:"bg-blue-500 hover:bg-blue-600 text-white px-3 py-1 text-xs",children:"Reply"})]})})]})]})},a.id)})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-300 dark:bg-gray-600 rounded-full mx-auto mb-4"}),e.jsx("h4",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Comments Found!"}),e.jsxs("p",{className:"text-gray-500 dark:text-gray-400 text-sm",children:["Don't forget to share your social media accounts to connect",e.jsx("br",{}),"with others online!"]})]})})]})};function Re({post:t,AnalyticalData:n}){const c=Y(),[s,d]=i.useState("overview"),[b,v]=i.useState("facebook"),p=[{label:"Home",href:"user.home"},{label:"Preview"}],x=o=>{d(o)},f=async o=>{try{await G.post(route("user.post.comment.store"),{post_id:t==null?void 0:t.id,content:o.content,image:o.image,parent_id:o.parentId||null},{preserveState:!0,onSuccess:()=>{},onError:h=>{console.error("[v0] Error adding comment:",h)}})}catch(h){console.error("[v0] Error adding comment:",h)}};return e.jsx(e.Fragment,{children:e.jsx($,{breadcrumbs:p,children:e.jsxs("div",{className:"flex-1 p-6 overflow-auto bg-gray-50 dark:bg-black",children:[e.jsx("div",{className:"flex items-center justify-between flex-wrap gap-4 mb-6",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-2xl dark:text-gray-200 font-bold ",children:c("Preview")}),e.jsx("p",{className:"text-gray-500 dark:text-gray-200",children:c("Make sure to stay engaged with your social media platforms!")})]})}),e.jsx("div",{className:"mb-6",children:e.jsx("div",{className:"flex gap-1",children:e.jsx(D,{value:s,onValueChange:x,className:"space-y-6",children:e.jsxs(Q,{className:"inline-flex bg-white rounded-lg p-1 shadow-sm gap-1 ltr:flex-row rtl:flex-row-reverse",children:[e.jsx(R,{value:"overview",className:"data-[state=active]:bg-gradient-to-r data-[state=active]:from-primary data-[state=active]:to-secondary data-[state=active]:text-white data-[state=active]:shadow-sm rounded-md px-4 py-2 text-sm font-medium transition-colors",children:c("Overview")}),e.jsx(R,{value:"feed",className:"data-[state=active]:bg-gradient-to-r data-[state=active]:from-primary data-[state=active]:to-secondary data-[state=active]:text-white data-[state=active]:shadow-sm rounded-md px-4 py-2 text-sm font-medium transition-colors",children:c("Feed")})]})})})}),e.jsxs("div",{className:"space-y-6",children:[s==="overview"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(Z,{platform:b,data:n.postSummary,metrics:n.postSummary.metrics}),e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsx("div",{className:"col-span-2",children:e.jsx(ee,{platform:b,data:n.engagementAnalytics})}),e.jsx("div",{className:"col-span-1",children:e.jsx(ae,{data:n.statisticByGender})})]})]}),s==="feed"&&e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsx("div",{className:"col-span-1",children:e.jsx(de,{post:t})}),e.jsx("div",{className:"col-span-2",children:e.jsx(oe,{postId:t==null?void 0:t.id,account:t==null?void 0:t.account,onAddComment:f})})]})]})]})})})}export{Re as default};
