1import{a as V,b as q,j as e}from"./query-zKe4mOlO.js";import{r as a}from"./vendor-BV72JwGM.js";import{u as z,C as y,a as N,b as w,f as A,c as S,n as m,B as p,L as b,s as H}from"./index-b3SWkXql.js";import{T as Q}from"./textarea-eQE_CzYA.js";import{S as k,a as P,b as T,c as B,d as l}from"./select-ziSDwp_c.js";import{B as I}from"./badge-DgEKWgvG.js";import{P as K}from"./progress-NKYFj76u.js";import{t as X,p as _}from"./SocialCommentResponderTab-DfI9bF6Y.js";import{U as J}from"./upload-BWRQ74q7.js";import{S as O}from"./sparkles-QrJd-AwW.js";import{C as W}from"./circle-check-big-C8OVpxhr.js";import{C as Y}from"./radio-group-BTLgXMTl.js";import"./index-BdQq_4o_.js";import"./index-BcFqJv69.js";import"./index-BSNYq_IR.js";import"./check-iA5WZ6OB.js";import"./scroll-area-CxO0cBrC.js";import"./Dashboard-BvvNmA-C.js";import"./PieChart-pJAPfAKX.js";import"./index-DHSHSWAQ.js";import"./CategoricalChart-Di_Chm0k.js";import"./isArguments-HEPTc7lU.js";import"./index-Dxle4OYs.js";import"./band-CquvqAHh.js";import"./init-Dmth1JHB.js";import"./ordinal-DILIJJjt.js";import"./linear-DnxIEBmW.js";import"./defaultLocale-C4B-KCzX.js";import"./time-2UZkfxTs.js";import"./LineChart-DRX42lmR.js";import"./isArrayLikeObject-DzpQn6gc.js";import"./PolarChart-B-DvDaNp.js";import"./dialog-CdE15XCJ.js";import"./alert-dialog-BQMI16rm.js";import"./MarkdownRenderer-DKZ8lzCP.js";import"./trash-2-BY2em3V9.js";import"./building-2-DE4NwWBZ.js";import"./phone-BJp4_jIy.js";import"./search-l52Pk63j.js";import"./users-DxQaKDDx.js";import"./file-text-pFI7E5Qu.js";import"./target-l2FXb8y4.js";import"./calendar-C5ZA1iBg.js";import"./globe-B7ENm54i.js";import"./share-2-ciqVBdKp.js";import"./bot-1LBfHded.js";import"./trending-up-IXie-JW6.js";import"./settings-VdlCTMjp.js";import"./eye-BYPaI2AD.js";import"./shield-check-CoHnWSR1.js";import"./message-square-bdJ2p1mP.js";import"./chart-column-DPj9Q_lm.js";import"./mic-CiZAfYOZ.js";import"./graduation-cap-lyqMv-Ng.js";import"./shopping-cart-BtNIi8EM.js";import"./database-Dng1xT7q.js";import"./brain-p-R5frGv.js";import"./format-CH0aeClC.js";import"./en-US-CyrGnweX.js";import"./user-8aXrqzVN.js";import"./circle-check-BIRNLulk.js";import"./external-link-Nqvgr1K_.js";import"./dollar-sign-CGlNpBPe.js";import"./package-CeD1mARu.js";import"./wrench-1AGdYr6P.js";import"./activity-C1jh7L1J.js";import"./play-CR9Xjm6m.js";import"./rocket-Cohg2hdT.js";import"./book-open-1XKjOEDX.js";import"./zap-DYT0rysY.js";import"./shield-CIRM4zIO.js";import"./formatDistanceToNow-DAaEYBoB.js";import"./download-zZeKFQ4R.js";import"./send-CosEtF2z.js";import"./arrow-right-BbUvn0qn.js";import"./separator-BzmaUWd5.js";import"./user-plus-C06LCCCJ.js";import"./briefcase-D4NjC392.js";import"./podcastHostAvatars-CYJRy1BR.js";import"./server-C5KqvWr5.js";import"./headphones-He8v8tbw.js";import"./network-C4NrUCQ7.js";import"./avatar-Bz7usJvW.js";import"./inputValidation-B-yPAyl_.js";import"./bell--0SSiBTc.js";import"./utensils-DEBnusZG.js";import"./user-cog-Do097Y73.js";import"./AIDemoShowcase-BbAH1eDQ.js";import"./copy-CplDqpsc.js";import"./purify.es-D6gMnemd.js";import"./table-DtZVbMlF.js";import"./arrow-left-C5xhlwR_.js";import"./git-branch-Cw6n6scQ.js";import"./jspdf.es.min-CEe30Vc8.js";import"./webhook-DNBU1Ebj.js";import"./lightbulb-C-0Oti9J.js";import"./DeveloperSDK-UOJ-dggI.js";import"./workflow-DkhYhoME.js";import"./smartphone-DhTMC-4Y.js";import"./IndustryTemplates-DMaH9T2h.js";import"./lib.modern-Cik1-2UG.js";import"./volume-2-llW3zoLj.js";import"./trending-down-jm1ugRZQ.js";import"./checkbox-BGORJrtb.js";import"./index-B0o79vq5.js";import"./printer-B8AMhorV.js";import"./palette-Bak-_pZa.js";import"./scale-BeyCITeP.js";import"./lock-CIYpjrka.js";import"./landmark-CytLTcT7.js";import"./house-B1yijB-O.js";import"./star-7d8js2G-.js";import"./message-circle-DeB_poG8.js";import"./cpu-B5JfTdxH.js";import"./newspaper-BVTErz2K.js";import"./EmailTemplates-DIWkuFHo.js";import"./receipt-BhMTCJrZ.js";import"./file-search-BhYQKZ2t.js";import"./credit-card-I1CJzgnZ.js";function ls({onComplete:L}){const{toast:c}=z(),E=V(),[d,M]=a.useState(""),[x,R]=a.useState("linkedin"),[g,U]=a.useState("professional"),[j,$]=a.useState("medium"),[o,u]=a.useState([]),[n,h]=a.use
1State(!1),[f,v]=a.useState(0),D=()=>{const s=d.split(` 2`).filter(r=>r.trim().length>0).map((r,i)=>({id:`bulk-${Date.now()}-${i}`,platform:x,comment:r.trim(),status:"pending"}));u(s),c({title:`${s.length} comments parsed`,description:"Ready to generate responses"})},F=q({mutationFn:async()=>{h(!0);const t=crypto.randomUUID(),s=[...o];for(let r=0;r<s.length;r++){s[r]={...s[r],status:"generating"},u([...s]),v((r+.5)/s.length*100);try{const{data:i,error:C}=await H.functions.invoke("social-comment-responder",{body:{action:"generate_response",platform:s[r].platform,originalComment:s[r].comment,postContext:s[r].postContext,tone:g,responseLength:j,batchId:t}});if(C)throw C;s[r]={...s[r],status:"generated",response:i.response,confidenceScore:i.confidenceScore}}catch(i){s[r]={...s[r],status:"error",error:i instanceof Error?i.message:"Unknown error"}}u([...s]),v((r+1)/s.length*100)}return s},onSuccess:t=>{h(!1);const s=t.filter(r=>r.status==="generated").length;c({title:"Bulk Generation Complete",description:`${s}/${t.length} responses generated successfully`}),E.invalidateQueries({queryKey:["social-comment-history"]}),L?.()},onError:()=>{h(!1)}}),G=t=>{navigator.clipboard.writeText(t),c({title:"Copied to clipboard"})};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(y,{children:[e.jsxs(N,{children:[e.jsxs(w,{className:"flex items-center gap-2",children:[e.jsx(J,{className:"h-5 w-5"}),"Bulk Import Comments"]}),e.jsx(A,{children:"Paste multiple comments (one per line) to generate responses in batch"})]}),e.jsxs(S,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Platform"}),e.jsx("div",{className:"flex gap-2",children:["linkedin","twitter","instagram","facebook"].map(t=>{const s=_[t];return e.jsx(p,{size:"sm",variant:x===t?"default":"outline",onClick:()=>R(t),children:e.jsx(s,{className:"h-4 w-4"})},t)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Tone"}),e.jsxs(k,{value:g,onValueChange:t=>U(t),children:[e.jsx(P,{children:e.jsx(T,{})}),e.jsx(B,{children:["professional","friendly","witty","educational","grateful"].map(t=>e.jsxs(l,{value:t,children:[X[t]," ",t]},t))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Length"}),e.jsxs(k,{value:j,onValueChange:t=>$(t),children:[e.jsx(P,{children:e.jsx(T,{})}),e.jsxs(B,{children:[e.jsx(l,{value:"short",children:"Short"}),e.jsx(l,{value:"medium",children:"Medium"}),e.jsx(l,{value:"detailed",children:"Detailed"})]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Comments (one per line)"}),e.jsx(Q,{placeholder:`Great post, very insightful! 3How do I get started with this? 4I disagree with your approach here...`,value:d,onChange:t=>M(t.target.value),rows:6,disabled:n})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{onClick:D,disabled:!d.trim()||n,children:"Parse Comments"}),o.length>0&&e.jsx(p,{onClick:()=>F.mutate(),disabled:n||o.every(t=>t.status!=="pending"),children:n?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"mr-2 h-4 w-4"}),"Generate All (",o.filter(t=>t.status==="pending").length,")"]})})]}),n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(K,{value:f}),e.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["Processing ",Math.round(f),"%"]})]})]})]}),o.length>0&&e.jsxs(y,{children:[e.jsx(N,{children:e.jsxs(w,{children:["Results (",o.length," comments)"]})}),e.jsx(S,{children:e.jsx("div",{className:"space-y-3 max-h-[400px] overflow-y-auto",children:o.map(t=>e.jsxs("div",{className:"p-3 border rounded-lg space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1 flex-1",children:t.comment}),e.jsxs(I,{variant:t.status==="generated"?"default":t.status==="error"?"destructive":t.status==="generating"?"secondary":"outline",children:[t.status==="generating"&&e.jsx(b,{className:"mr-1 h-3 w-3 animate-spin"}),t.status==="generated"&&e.jsx(W,{className:"mr-1 h-3 w-3"}),t.status==="error"&&e.jsx(Y,{className:"mr-1 h-3 w-3"}),t.status]})]}),t.response&&e.jsxs("div",{className:"bg-muted/50 p-2 rounded text-sm",children:[e.jsx("p",{children:t.response}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[t.confidenceScore&&e.jsxs(I,{variant:"outline",className:"text-xs",children:[Math.round(t.confidenceScore*100),"% confidence"]}),e.jsx(p,{size:"sm",variant:"ghost",onClick:()=>G(t.response),children:"Copy"})]})]}),t.error&&e.jsx("p",{className:"text-sm text-destructive",children:t.error})]},t.id))})})]})]})}export{ls as default};
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.