1import{r as s,j as e,at as ys,C as xa,y as ws,c7 as ha,aC as et,x as Je,cR as vs,T as pa,Z as he,U as _s,P as ks,a9 as Et,b as pe,aq as fa,d as A,z as B,m as ga,n as ba,o as ja,p as Na,cW as ya,B as cs,$ as wa,ag as va,ac as _a,t as ka,aE as Sa,R as Ca,ar as Ss,aK as Cs,J as Ms,M as Ma,c4 as Ea,K as Da,a5 as Nt,aO as yt,aH as ds,Q as $a,aa as Pa}from"./index-BH8Hq4fF.js";import{N as Ia}from"./softDelete-X2GBluex.js";import{K as Ra}from"./KibbutzModuleGuard-BrSTzYkw.js";import{M as tt}from"./ManagerDialog-iFzxbOnI.js";import{F as us}from"./FormSection-8_EQ6Rzg.js";import{n as Fa,i as Aa}from"./phone-DXeRciLF.js";import{L as Es}from"./list-plus-mwazpKH4.js";import{U as St}from"./upload-DtbdHLAK.js";import{l as Ds,c as $s,t as La,g as ms,v as Ta}from"./residentGroupUtils-CFDJNblj.js";import{g as za}from"./GroupIconPicker-CajbHf9M.js";import{U as Ua}from"./UpdateSettingsDialog-tJZMcSZo.js";import{W as Ba}from"./WaText-B67wDB8t.js";import{u as Oa,E as Ga}from"./useCommunityEmailBrand-C2ihWYjw.js";import{F as wt}from"./full-image-BA7U-vQf.js";import{s as Ha,o as Ka,d as xs,p as vt,c as Wa,a as Va}from"./whatsappFormat-BEXpfyEq.js";import{C as qa,S as _t,M as Ya,I as Ja,a as Xa,b as Qa}from"./InlineTemplatePicker-GavaHBTa.js";import{h as Za,M as Qe,d as fe,g as el,f as Ze,e as Dt,v as tl,W as Xe,w as sl,x as al,y as hs,n as ps,z as ll,K as kt,A as nl,r as rl,a as il,B as ol,C as cl,E as dl}from"./messageComposition-RIfY45ev.js";import{L as ul}from"./link-mLidGXFc.js";import{V as $t}from"./video-Dnmc63gI.js";import{I as Ct}from"./image-plus-CFXC8_i6.js";import{P as ml}from"./pencil-DlA_FTEn.js";import{S as Pt}from"./sparkles-DYMjDKmN.js";import{C as xl,r as hl,c as fs}from"./messageUtils-CtQzoGBJ.js";import{a as gs,c as pl}from"./templateTypes-BDoxG06y.js";import{a as fl}from"./whatsappImageCompression-Ba_dR_4a.js";import"./refresh-cw-kjmzcQOe.js";import"./siren-DUj7NgPZ.js";import"./stethoscope-CLBnbMpG.js";import"./music-DKTtf7a1.js";import"./palette-CIgIe0F7.js";import"./graduation-cap-DnGVwVvF.js";import"./baby-Cs7Gtrey.js";import"./trophy-ouGVads6.js";import"./dumbbell-B6wytY5J.js";import"./coffee-QVdpUZKt.js";import"./truck-Btvrvfzs.js";import"./leaf-DJuap4o0.js";import"./sun-DO86yNCK.js";import"./ImageUpload-DUYdpez7.js";import"./input-RnZK1Sdh.js";import"./ImageSizeHint-ldk9MfCu.js";import"./maximize-2-CeboQku1.js";import"./communityEmail-DHv9zmVf.js";import"./image-DgoP-ctX.js";import"./type-BhjkmruF.js";import"./chevron-up-Nk0mcmku.js";import"./TemplateTypeBadge-4lge8Mml.js";import"./sendFailureReason-ChoFICRb.js";function gl(c){return String(c||"").split(/[\s,;|]+/).map(o=>o.trim().replace(/^['"ââââ]+|['"ââââ]+$/g,"")).filter(Boolean)}function bl(c){const o=new Map,g=[],i=[];let p=0;const N=gl(c);for(const d of N){if(!/\d/.test(d))continue;const x=Fa(d);if(!x){i.push({raw:d,reason:"ר××§"});continue}if(!Aa(x)){i.push({raw:d,reason:"×× × ××× ×שר×××"});continue}if(o.has(x)){p+=1;continue}o.set(x,d),g.push({phone:x,raw:d})}return{valid:g,invalid:i,duplicates:p,total:N.filter(d=>/\d/.test(d)).length}}function jl(c){return(c||[]).map(({phone:o})=>({resident_id:null,full_name:o,phone:o,email:"",is_manual:!0,from_phone_list:!0}))}function Nl({onClose:c,onAdd:o,existingKeys:g}){const[i,p]=s.useState(""),N=s.useRef(null),d=s.useMemo(()=>bl(i),[i]),x=s.useMemo(()=>d.valid.filter(j=>g==null?void 0:g.has(j.phone)).length,[d.valid,g]),f=d.valid.filter(j=>!(g!=null&&g.has(j.phone))),y=async j=>{var v;const S=(v=j.target.files)==null?void 0:v[0];S&&(p(await S.text()),j.target.value="")};return e.jsxs(tt,{onClose:c,title:"× ××¢× ×× ×רש××ת ××פ×× ××",icon:Es,tone:"blue",maxWidth:"max-w-2xl",onSave:()=>{o(jl(f)),c()},saveLabel:f.length?`××ספת ${f.length} × ××¢× ××`:"××ספ×",saveDisabled:!f.length,children:[e.jsxs(us,{title:"×××××§× ×ספר××",children:[e.jsx("textarea",{value:i,onChange:j=>p(j.target.value),dir:"ltr",rows:10,placeholder:`0501234567 20521234567 30531234567`,className:"w-full rounded-xl border border-slate-200 p-3 text-sm font-mono text-left focus:outline-none focus:border-blue-400"}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsxs("button",{type:"button",onClick:()=>{var j;return(j=N.current)==null?void 0:j.click()},className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg bg-slate-100 text-slate-600 text-xs font-bold hover:bg-slate-200",children:[e.jsx(St,{className:"w-3.5 h-3.5"})," ××¢×× × ××§×××¥ CSV"]}
3),e.jsx("input",{ref:N,type:"file",accept:".csv,.txt",onChange:y,className:"hidden"})]}),e.jsx("p",{className:"text-[0.6875rem] text-slate-400 leading-relaxed mt-2",children:"×¢×××× ×××××××, ש××¨× ××× ×ספר, ×× ××פר××× ×פס××§×× â ××× ×תק××. ש×רת ××תרת × ×רקת ×עצ××, ××ספר ×©× ××ª× ×××× ×¦×ר×ת (×¢× 0, ×¢× 972, ×¢× ×קפ××) × ×¡×¤×¨ ×¤×¢× ××ת."})]}),d.total>0&&e.jsxs(us,{title:"×× ×ת××סף",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[e.jsx(Ye,{label:"×ת××ספ×",value:f.length,tone:"emerald"}),e.jsx(Ye,{label:"×פ×××××ת ×רש×××",value:d.duplicates,tone:"slate"}),e.jsx(Ye,{label:"××ר ×רש××ת ×× ××¢× ××",value:x,tone:"slate"}),e.jsx(Ye,{label:"×× ×ª×§×× ××",value:d.invalid.length,tone:d.invalid.length?"amber":"slate"})]}),d.invalid.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl bg-amber-50 ring-1 ring-amber-200 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(ys,{className:"w-3.5 h-3.5 text-amber-600"}),e.jsxs("p",{className:"text-xs font-bold text-amber-800",children:[d.invalid.length," ×ספר×× ×× ××××××"]})]}),e.jsxs("div",{className:"max-h-28 overflow-y-auto flex flex-wrap gap-1.5",children:[d.invalid.slice(0,60).map((j,S)=>e.jsxs("span",{dir:"ltr",className:"text-[0.6875rem] bg-white ring-1 ring-amber-200 rounded px-1.5 py-0.5 text-amber-800",children:[j.raw," · ",j.reason]},S)),d.invalid.length>60&&e.jsxs("span",{className:"text-[0.6875rem] text-amber-700",children:["××¢×× ",d.invalid.length-60,"â¦"]})]})]}),!!f.length&&!d.invalid.length&&e.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-emerald-700 font-medium mt-3",children:[e.jsx(xa,{className:"w-3.5 h-3.5"})," ×× ××ספר×× ×ª×§×× ××."]}),e.jsx("p",{className:"text-[0.6875rem] text-slate-500 leading-relaxed mt-3",children:"×× ××¢× ×× ×××× ××× × × ×©×ר×× ×ת×ש××× â ×× ×§××××× ×¨×§ ×××××¢× ×××. ×× ××פ××¢×× ×××× ××ס××¨× ××× × ××¢× ××ר, ××ש××¦× ××××§× ×¤×¢×× ×××××¢× × ×©××ת ××ספר ×××××§× ×××§×× ×××××."})]})]})}function Ye({label:c,value:o,tone:g}){const i={emerald:"bg-emerald-50 text-emerald-700 ring-emerald-200",amber:"bg-amber-50 text-amber-700 ring-amber-200",slate:"bg-slate-50 text-slate-600 ring-slate-200"};return e.jsxs("div",{className:`rounded-xl ring-1 p-2.5 text-center ${i[g]||i.slate}`,children:[e.jsx("p",{className:"text-xl font-extrabold tabular-nums leading-tight",children:o}),e.jsx("p",{className:"text-[0.65625rem] font-medium mt-0.5",children:c})]})}function yl(c){return c.is_system?"system":c.is_private?"private":"public"}const wl=new Set(["all","manual"]),vl={private:"פר××ת",system:"×ער×ת",public:"צ×××ר×ת"};function _l({residentGroups:c=[],groupMembers:o=[],residents:g=[],memberCountsOverride:i=null,selectedGroupIds:p=[],allResidentsSelected:N=!1,onToggleGroup:d,onToggleAllResidents:x,search:f="",onSearchChange:y,hideEmpty:j=!1,membersLoading:S=!1}){const[v,T]=s.useState("all"),M=s.useMemo(()=>{if(i instanceof Map)return i;const r=g!=null&&g.length?new Set(g.map(u=>u.id)):null,l=new Map;for(const u of o||[])!u.group_id||u.is_active===!1||r&&!r.has(u.resident_id)||l.set(u.group_id,(l.get(u.group_id)||0)+1);return l},[o,g,i]),H=r=>M.get(r)||0,L=s.useMemo(()=>{const r=c.filter(l=>l.is_active!==!1);return!i&&o.length===0?r:r.filter(l=>H(l.id)>0)},[c,o,M,i]),K=s.useMemo(()=>{const r=new Map;for(const l of L){const u=l.group_type||"other";wl.has(u)||r.has(u)||r.set(u,Ds[u]||"××ר")}return[...r.entries()].map(([l,u])=>({value:l,label:u}))},[L]),z=s.useMemo(()=>{const r=f.trim();return L.filter(l=>v==="all"||(l.group_type||"other")===v).filter(l=>!r||(l.title||"").includes(r)||(l.description||"").includes(r)).sort((l,u)=>H(u.id)-H(l.id))},[L,v,f,M]),O=r=>r.system_key==="all_residents"?N:p.includes(r.id),Q=r=>r.system_key==="all_residents"?x==null?void 0:x():d==null?void 0:d(r.id);return e.jsxs("div",{className:"space-y-3",dir:"rtl",children:[e.jsxs("div",{className:"rounded-2xl bg-slate-50 border border-slate-100 p-2.5 sm:p-3 space-y-2.5",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ws,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400","aria-hidden":"true"}),e.jsx("input",{type:"text",value:f,onChange:r=>y==null?void 0:y(r.target.value),placeholder:"××פ×ש ×§××צ×, ת×ש×, ××פ×× ×× ××××´×...","aria-label":"××פ×ש × ××¢× ××",className:"w-full h-11 rounded-xl border border-slate-200 bg-white pr-10 pl-4 text-sm focus:outline-none focus:ring-2 focus:ring-cyan-100"})]}),K.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 overflow-x-auto -mx-0.5 px-0.5",role:"group","aria-label":"ס×× ×× ××¤× ×§×××ר××ת ×§××צ×",children:[e.jsx("button",{type:"button",onClick:()=>T("all"),"aria-pressed":v==="all",className:`inline-flex items-center h-8 px-3.5 rounded-full text-xs font-bold whitespace-nowrap transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400 ${v==="all"?"bg-cyan-600 text-white shadow-sm":"bg-white border border-slate-200 text-slate-600 hover:bg-slate-100"}`,children:"×× ××§××צ×ת"}),K.map(r=>e.jsx("button",{type:"button",onClick:()=>T(r.value),"aria-pressed":v===r.value,className:`inline-flex items-center h-8 px-3.5 rounded-full text-xs font-medium whitespace-nowrap transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400 ${v===r.value?"bg-cyan-600 text-white shadow-sm":"bg-white border border-slate-200 text-slate-600 hover:bg-slate-100"}`,children:r.label},r.value))]})]}),z.length===0?j?f.trim()?e.jsx("p",{className:"text-xs text-slate-400 px-1",children:"××× ×§×××¦× ××©× ××"}):null:e.jsxs("div",{className:"text-center py-10 rounded-xl border border-dashed border-slate-200 bg-slate-50/50",children:[e.jsx(ha,{className:"w-9 h-9 text-slate-300 mx-auto mb-2","aria-hidden":"true"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"×× × ×צ×× ×§××צ×ת ת××××ת"})]}):e.jsx("ul",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2 list-none p-0 m-0",children:z.map(r=>{const l=$s(r.color),u=za(r.icon),$=O(r),G=yl(r);return e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>{S||Q(r)},"aria-pressed":$,disabled:S,className:`w-full h-full text-right rounded-xl border p-3 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400 ${S?"opacity-75 curs
3or-wait":""} ${$?"border-cyan-400 bg-cyan-50 ring-1 ring-cyan-200":"border-slate-200 bg-white hover:bg-slate-50"}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:`w-5 h-5 mt-0.5 rounded-md border-2 flex items-center justify-center flex-shrink-0 transition-all ${$?"bg-cyan-600 border-cyan-600":"border-slate-300 bg-white"}`,children:$&&e.jsx(et,{className:"w-3.5 h-3.5 text-white",strokeWidth:3,"aria-hidden":"true"})}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-6 h-6 rounded-lg ${l.bg} flex items-center justify-center flex-shrink-0`,children:e.jsx(u,{className:`w-3.5 h-3.5 ${l.text}`,"aria-hidden":"true"})}),e.jsx("span",{className:"text-sm font-bold text-foreground leading-snug truncate",children:r.title})]}),e.jsxs("span",{className:"flex items-center gap-1.5 mt-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Je,{className:"w-3.5 h-3.5","aria-hidden":"true"})," ",S?"×××¢× ××ר××â¦":`${H(r.id)} ××ר××`]}),e.jsx("span",{className:`text-[0.625rem] px-1.5 py-0.5 rounded-full font-medium ${G==="public"?"bg-emerald-50 text-emerald-600":"bg-slate-100 text-slate-600"}`,children:vl[G]})]})]})]})})},r.id)})})]})}function kl({residents:c,residentGroups:o,groupMembers:g,groupMemberCounts:i=null,selectedGroupIds:p,onToggleGroup:N,recipients:d,onAddRecipient:x,onRemoveRecipient:f,onClearAll:y,allResidentsSelected:j,onToggleAllResidents:S,channels:v=["whatsapp"],duplicatesRemoved:T=0,sourceLabel:M=null,membersLoading:H=!1,residentsLoading:L=!1}){const K=H||L,[z,O]=s.useState(""),[Q,r]=s.useState(""),[l,u]=s.useState(""),[$,G]=s.useState(""),[I,je]=s.useState(!1),[le,Ee]=s.useState(0),Y=v.length===1&&v.includes("whatsapp"),De=v.includes("email"),[R,re]=s.useState("");s.useEffect(()=>{const n=setTimeout(()=>re(z),250);return()=>clearTimeout(n)},[z]);const U=s.useMemo(()=>{const n=R.trim();return n?c.filter(E=>!E.is_deleted&&vs(E,n,E.name||"")).slice(0,50):[]},[c,R]),ce=s.useMemo(()=>d.map((n,E)=>({...n,_idx:E})).filter(n=>(!n.source_groups||n.source_groups.length===0)&&!n.source_all),[d]),Z=s.useMemo(()=>{const n=[];if(j){const E=o.find(te=>te.system_key==="all_residents");E&&n.push({id:"__all_residents__",name:E.title||"×× ×ת×ש×××"})}return p.forEach(E=>{const te=o.find(It=>It.id===E);te&&n.push({id:E,name:te.title})}),n},[j,p,o]);function ie(){const n=Q.trim(),E=l.trim(),te=$.trim();!n&&!E&&!te||(x({resident_id:null,full_name:n||E||te,phone:E,email:te}),r(""),u(""),G(""),O(""))}s.useEffect(()=>{const n=R.trim();!n||U.length>0||(n.includes("@")?(G(n),r(""),u("")):/^[\d\s\-+()]{4,}$/.test(n)?(u(n),r(""),G("")):(r(n),u(""),G("")))},[R,U.length]);const q=n=>x({resident_id:n.id,full_name:n.full_name||n.name||"",phone:n.phone||"",email:n.email||""}),Ne=n=>d.some(E=>E.resident_id===n.id);function ee(n){n.id==="__all_residents__"?S==null||S():n.type==="group"?N(n.id):f(n._idx)}const ye=d.length,W=R.trim();return e.jsxs("div",{className:"space-y-3",dir:"rtl",children:[(Z.length>0||ce.length>0)&&e.jsxs("div",{className:"bg-slate-50 rounded-xl p-2 space-y-1.5","aria-label":"×× ××¢× ×× ×©× ××ר×",children:[e.jsxs("div",{className:"flex items-center justify-between px-1",children:[e.jsxs("span",{className:"text-[0.6875rem] font-medium text-slate-500",children:["×× ××¢× ×× ×©× ××ר×",T>0?` · ×××¡×¨× ${T} ×פ×××××ת`:"",M&&ye>0?` · ××§×ר: ${M}`:""]}),e.jsxs("button",{type:"button",onClick:y,className:"text-[0.6875rem] text-red-500 hover:underline inline-flex items-center gap-1 focus:outline-none focus-visible:ring-2 focus-visible:ring-red-300 rounded px-1",children:[e.jsx(pa,{className:"w-3 h-3","aria-hidden":"true"})," × ×§× ×××"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5 max-h-28 overflow-y-auto",children:[Z.map(n=>e.jsxs("span",{className:"flex items-center gap-1.5 bg-white border border-cyan-200 rounded-full px-2.5 py-1",children:[e.jsx("span",{className:"text-xs font-medium text-slate-700",children:n.name}),e.jsx("button",{type:"button",onClick:()=>ee({...n,type:n.id==="__all_residents__"?"all":"group"}),"aria-label":`×סרת ${n.name}`,className:"text-slate-400 hover:text-red-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-red-300 rounded-full",children:e.jsx(he,{className:"w-3.5 h-3.5","aria-hidden":"true"})})]},n.id)),ce.map(n=>e.jsxs("span",{className:"flex items-center gap-1.5 bg-white border border-slate-200 rounded-full px-2.5 py-1",children:[e.jsx("span",{className:"text-xs font-medium text-slate-700",children:n.full_name||"××× ×©×"}),e.jsx("button",{type:"button",onClick:()=>ee({...n,type:"individual",_idx:n._idx}),"aria-label":`×סרת ${n.full_name||"× ××¢×"}`,className:"text-slate-400 hover:text-red-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-red-300 rounded-full",children:e.jsx(he,{className:"w-3.5 h-3.5","aria-hidden":"true"})})]},n._idx))]})]}),e.jsx(_l,{residentGroups:o,groupMembers:g,residents:c,memberCountsOverride:i,selectedGroupIds:p,allResidentsSelected:j,onToggleGroup:N,onToggleAllResidents:S,search:z,onSearchChange:O,hideEmpty:!0,membersLoading:K}),W&&U.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs font-bold text-slate-500 px-1",children:"ת×ש××× ×ª××××× ×××פ×ש"}),e.jsx("div",{className:"max-h-64 overflow-y-auto divide-y divide-slate-100 rounded-xl border border-slate-200 bg-white",children:U.map(n=>{const E=Ne(n),te=!String(n.phone||"").trim()&&!String(n.email||"").trim();return e.jsxs("button",{type:"button",onClick:()=>!E&&q(n),disabled:E,className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-accent/50 text-right disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300",children:[e.jsxs("span",{className:"flex flex-col min-w-0 flex-1",children:[e.jsx("span",{className:"font-medium truncate",children:n.full_name||n.name||[n.first_name,n.last_name].filter(
3Boolean).join(" ")||"××× ×©×"}),n.email&&e.jsx("span",{className:"text-[0.6875rem] text-muted-foreground truncate",dir:"ltr",children:n.email})]}),n.phone?e.jsx("span",{className:"text-xs text-muted-foreground",dir:"ltr",children:n.phone}):e.jsx("span",{className:"text-[0.625rem] text-amber-600 whitespace-nowrap",children:te?"××× ×¢×¨××¥ ש××××":"××× × ×××"}),E?e.jsx(et,{className:"w-4 h-4 text-emerald-500 flex-shrink-0","aria-hidden":"true"}):e.jsx(_s,{className:"w-4 h-4 text-cyan-500 flex-shrink-0","aria-hidden":"true"})]},n.id)})})]}),W&&L&&U.length===0&&e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-3 flex items-center gap-2",role:"status","aria-live":"polite",children:[e.jsx("span",{className:"w-4 h-4 border-2 border-slate-200 border-t-cyan-500 rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{className:"text-xs text-slate-500",children:"×××¢× ×ת רש××ת ×ת×ש×××â¦"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{type:"button",onClick:()=>je(!0),className:"inline-flex items-center gap-1.5 h-9 px-3.5 rounded-lg bg-slate-100 text-slate-600 text-xs font-bold hover:bg-slate-200",children:[e.jsx(Es,{className:"w-3.5 h-3.5","aria-hidden":"true"})," ××ספת רש××ת ××פ×× ××"]}),le>0&&e.jsxs("span",{className:"text-[0.6875rem] text-slate-400",children:[le," × ××¢× ×× × ××¡×¤× ×רש×××"]})]}),I&&e.jsx(Nl,{onClose:()=>je(!1),existingKeys:new Set((d||[]).map(n=>n.phone).filter(Boolean)),onAdd:n=>{n.forEach(x),Ee(n.length)}}),W&&!L&&U.length===0&&e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-3 space-y-2.5",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"×× × ×צ×/× ××§××צ×ת ×× ×רש××ת ×ת×ש××× â ××ס××¤× × ××¢× ××ש ×××××ר:"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1.2fr_1fr_1.3fr_auto] gap-2",children:[e.jsx("input",{type:"text",value:Q,onChange:n=>r(n.target.value),placeholder:"×©× ×× ××¢×",onKeyDown:n=>{n.key==="Enter"&&ie()},"aria-label":"×©× ×× ××¢×",className:"h-11 rounded-lg border border-slate-200 bg-slate-50 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-cyan-100 focus:bg-white"}),e.jsx("input",{type:"tel",value:l,onChange:n=>u(n.target.value),placeholder:`××פ××${Y?" *":""}`,dir:"ltr",style:{unicodeBidi:"plaintext"},onKeyDown:n=>{n.key==="Enter"&&ie()},"aria-label":"××פ××",className:"h-11 rounded-lg border border-slate-200 bg-slate-50 px-3 text-sm text-right focus:outline-none focus:ring-2 focus:ring-cyan-100 focus:bg-white"}),e.jsx("input",{type:"email",value:$,onChange:n=>G(n.target.value),placeholder:`××××´×${De?" *":""}`,dir:"ltr",style:{unicodeBidi:"plaintext"},onKeyDown:n=>{n.key==="Enter"&&ie()},"aria-label":"××××´×",className:"h-11 rounded-lg border border-slate-200 bg-slate-50 px-3 text-sm text-right focus:outline-none focus:ring-2 focus:ring-cyan-100 focus:bg-white"}),e.jsxs("button",{type:"button",onClick:ie,disabled:!Q.trim()&&!l.trim()&&!$.trim(),className:"h-11 px-4 rounded-lg bg-cyan-600 text-white text-sm font-bold hover:bg-cyan-700 disabled:opacity-40 inline-flex items-center justify-center gap-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400",children:[e.jsx(ks,{className:"w-4 h-4","aria-hidden":"true"})," ××סף ×××××ר"]})]})]})]})}const bs={[Ze]:{label:"×§×צ×× ×צ×רפ××",icon:Et,tone:"rose"},[Dt]:{label:"ת××× ×ת ×××××¢×",icon:Ct,tone:"blue"},[fe]:{label:"סר×××",icon:$t,tone:"purple"},[Qe]:{label:"×§×ש×ר",icon:ul,tone:"cyan"}};function Sl({media:c,mode:o,kind:g,value:i,onChange:p,onClose:N}){const d=bs[c]||bs[Ze],[x,f]=s.useState(!1),[y,j]=s.useState((i==null?void 0:i.url)||""),S=s.useRef(null),v=async(r,l)=>{if(r){f(!0);try{const{file_url:u}=await A.integrations.Core.UploadFile({file:r});l(u,r)}catch{B.error("×××¢××× × ×ש××")}finally{f(!1)}}},T=async(r,l)=>{const u=Array.from(r||[]);if(!u.length)return;f(!0);const $=[];try{for(const G of u){const{file_url:I}=await A.integrations.Core.UploadFile({file:G});$.push(l(I,G))}}catch{B.error("×××¢××× × ×ש××")}finally{f(!1)}return $},M=(i==null?void 0:i.files)||[],H=async r=>{const l=await T(r,(u,$)=>({url:u,name:$.name,size:$.size}));l!=null&&l.length&&p({...i,files:[...M,...l]})},L=(i==null?void 0:i.images)||[],K=(i==null?void 0:i.image)||"",z=(i==null?void 0:i.videoFile)||null,O=async r=>{const l=tl(r);if(!l.ok){B.error(l.error);return}l.warning&&B(l.warning,{icon:"â ï¸"}),await v(r,u=>p({...i,videoFile:{url:u,name:r.name,size:r.size}}))},Q=e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:N,className:"h-10 px-5 rounded-full border border-border text-sm font-medium hover:bg-slate-50",children:"ס××ר×"}),e.jsx("button",{type:"button",onClick:()=>{o==="link"&&p({...i,url:y.trim()}),N()},className:"h-10 px-5 rounded-full bg-cyan-600 text-white text-sm font-bold hover:bg-cyan-700",children:"××ש×ר"})]});return e.jsx(tt,{open:!0,onClose:N,title:d.label,icon:d.icon,tone:d.tone,maxWidth:"max-w-lg",align:"top",footer
3:Q,children:e.jsxs("div",{className:"space-y-3",dir:"rtl",children:[e.jsx("p",{className:"text-xs text-slate-500",children:Za(g,c)}),c===Qe&&e.jsx("input",{autoFocus:!0,type:"url",dir:"ltr",value:y,onChange:r=>j(r.target.value),placeholder:"https://â¦",className:"w-full h-11 rounded-xl border border-slate-200 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-cyan-100"}),c===fe&&o==="link"&&e.jsx("input",{autoFocus:!0,type:"url",dir:"ltr",value:y,onChange:r=>j(r.target.value),placeholder:"https://youtube.com/â¦",className:"w-full h-11 rounded-xl border border-slate-200 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-cyan-100"}),c===fe&&o==="upload"&&e.jsx(e.Fragment,{children:z?e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-violet-200 bg-violet-50/50 p-3",children:[e.jsx($t,{className:"w-5 h-5 text-violet-600 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-slate-800 truncate",children:z.name}),e.jsx("p",{className:"text-[0.6875rem] text-slate-500",children:el(z.size)})]}),e.jsx("button",{type:"button",onClick:()=>p({...i,videoFile:null}),className:"p-1.5 rounded-lg text-slate-400 hover:text-rose-600 hover:bg-rose-50",title:"×סר×",children:e.jsx(he,{className:"w-4 h-4"})})]}):e.jsxs("label",{className:"flex flex-col items-center justify-center gap-1.5 rounded-xl border-2 border-dashed border-violet-200 bg-violet-50/30 p-6 cursor-pointer hover:border-violet-300",children:[x?e.jsx(pe,{className:"w-6 h-6 text-violet-500 animate-spin"}):e.jsx(St,{className:"w-6 h-6 text-violet-500"}),e.jsx("span",{className:"text-sm font-medium text-violet-700",children:"×××רת סר××× MP4"}),e.jsx("span",{className:"text-[0.6875rem] text-slate-500",children:"H.264 · ×¢× 16MB · ×××××¥ ×¢× 10MB"}),e.jsx("input",{type:"file",accept:"video/mp4",className:"hidden",onChange:r=>{var l;return O((l=r.target.files)==null?void 0:l[0])}})]})}),c===Ze&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-1.5",children:M.map((r,l)=>e.jsxs("div",{className:"flex items-center gap-2.5 rounded-xl border border-slate-200 bg-white p-2.5",children:[e.jsx(Et,{className:"w-4 h-4 text-rose-500 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-slate-700 truncate flex-1 min-w-0",children:r.name}),e.jsx("button",{type:"button",title:"×סר×",onClick:()=>p({...i,files:M.filter((u,$)=>$!==l)}),className:"p-1 rounded-lg text-slate-400 hover:text-rose-600 hover:bg-rose-50",children:e.jsx(he,{className:"w-4 h-4"})})]},l))}),e.jsxs("button",{type:"button",onClick:()=>{var r;return(r=S.current)==null?void 0:r.click()},disabled:x,className:"w-full flex items-center justify-center gap-2 rounded-xl border-2 border-dashed border-rose-200 bg-rose-50/30 p-4 text-sm font-medium text-rose-700 hover:border-rose-300 disabled:opacity-50",children:[x?e.jsx(pe,{className:"w-4 h-4 animate-spin"}):e.jsx(St,{className:"w-4 h-4"}),M.length?"××ספת ×§×××¥ × ×סף":"×××רת ×§×××¥"]}),e.jsx("input",{ref:S,type:"file",multiple:!0,className:"hidden",onChange:r=>H(r.target.files)})]}),c===Dt&&e.jsxs(e.Fragment,{children:[o==="main-image"&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs font-bold text-slate-700 mb-1.5 flex items-center gap-1",children:[e.jsx(fa,{className:"w-3 h-3 text-amber-500"})," ת××× × ×¨×ש×ת â ×× ×©×ª×פ××¢ ××××עת ×××××ס×פ"]}),K?e.jsxs("div",{className:"relative w-full h-36 rounded-xl overflow-hidden border border-slate-200",children:[e.jsx("img",{src:K,alt:"",className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",onClick:()=>p({...i,image:""}),className:"absolute top-2 left-2 w-7 h-7 rounded-lg bg-black/50 text-white grid place-items-center",title:"×סר×",children:e.jsx(he,{className:"w-4 h-4"})})]}):e.jsxs("label",{className:"flex flex-col items-center justify-center gap-1.5 rounded-xl border-2 border-dashed border-blue-200 bg-blue-50/30 p-6 cursor-pointer hover:border-blue-300",children:[x?e.jsx(pe,{className:"w-5 h-5 text-blue-500 animate-spin"}):e.jsx(Ct,{className:"w-5 h-5 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-blue-700",children:"×××רת ת××× × ×¨×ש×ת"}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:r=>{var l;return v((l=r.target.files)==null?void 0:l[0],u=>p({...i,image:u}))}})]})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs font-bold text-slate-700 mb-1.5",children:[o==="main-image"?"ת××× ×ת × ×ספ×ת":"ת××× ×ת",e.jsx("span",{className:"font-normal text-slate-400 mr-1.5",children:"â ×××××´×, ×פ×ש ×××תר"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[L.map((r,l)=>e.jsxs("div",{className:"relative w-16 h-16 rounded-lg overflow-hidden border border-slate-200",children:[e.jsx("img",{src:r,alt:"",className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",title:"×סר×",onClick:()=>p({...i,images:L.filter((u,$)=>$!==l)}
3),className:"absolute top-0.5 left-0.5 w-5 h-5 rounded bg-black/50 text-white grid place-items-center",children:e.jsx(he,{className:"w-3 h-3"})})]},l)),e.jsxs("label",{className:"w-16 h-16 flex items-center justify-center rounded-lg border-2 border-dashed border-blue-200 bg-blue-50/30 cursor-pointer hover:border-blue-300",children:[x?e.jsx(pe,{className:"w-4 h-4 text-blue-500 animate-spin"}):e.jsx(Ct,{className:"w-4 h-4 text-blue-500"}),e.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:async r=>{const l=await T(r.target.files,u=>u);l!=null&&l.length&&p({...i,images:[...L,...l]})}})]})]})]})]})]})})}function Cl({chars:c,limit:o=Xe,onShorten:g,onApply:i,onEditMyself:p,onClose:N}){const[d,x]=s.useState("ask"),[f,y]=s.useState(""),j=Math.max(0,c-o);async function S(){x("busy");try{const M=await g();if(!M||!String(M).trim()){x("ask");return}y(String(M).trim()),x("result")}catch{x("ask")}}const v=f.length,T=d==="result"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>x("ask"),className:"h-10 px-5 rounded-full border border-border text-sm font-medium hover:bg-slate-50",children:"××ר×"}),e.jsxs("button",{type:"button",onClick:()=>i(f),className:"h-10 px-5 rounded-full bg-violet-600 text-white text-sm font-bold hover:bg-violet-700 inline-flex items-center gap-1.5",children:[e.jsx(et,{className:"w-4 h-4","aria-hidden":"true"})," ××ש×ר â ×× ×××××¢×"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:p,disabled:d==="busy",className:"h-10 px-5 rounded-full border border-border text-sm font-medium hover:bg-slate-50 disabled:opacity-50 inline-flex items-center gap-1.5",children:[e.jsx(ml,{className:"w-4 h-4","aria-hidden":"true"})," ××××× â ×ער×× ×עצ××"]}),e.jsxs("button",{type:"button",onClick:S,disabled:d==="busy",className:"h-10 px-5 rounded-full bg-violet-600 text-white text-sm font-bold hover:bg-violet-700 disabled:opacity-60 inline-flex items-center gap-1.5",children:[d==="busy"?e.jsx(pe,{className:"w-4 h-4 animate-spin","aria-hidden":"true"}):e.jsx(Pt,{className:"w-4 h-4","aria-hidden":"true"}),d==="busy"?"×¢××¨× ××קצרâ¦":"××ש×ר â ×§×¦×¨× ××"]})]});return e.jsx(tt,{open:!0,onClose:N,title:"×××××¢× ×©×× ×ר×××",subtitle:`${c} ת×××× â ${j} ××¢× ${o}`,icon:ys,tone:"purple",maxWidth:"max-w-xl",footer:T,children:d==="result"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("p",{className:"text-sm font-bold text-slate-800",children:"×× ×ª×ר×× ×××××¢× ×××§×צרת"}),e.jsxs("span",{className:"inline-flex items-center rounded-full bg-emerald-50 text-emerald-700 border border-emerald-200 px-2.5 py-1 text-xs font-bold",children:[v," ת××××"]})]}),e.jsx("div",{className:"rounded-xl border border-slate-200 bg-slate-50 p-4 max-h-72 overflow-y-auto",children:e.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap leading-relaxed",children:f})}),e.jsxs("p",{className:"text-xs text-slate-500",children:[v<c?`×§××¦×¨× ${c-v} ת××××. `:"","××ש×ר ×××××£ ×ת ת××× ×××××¢× ×××¨×¡× ×××. ×××§×¡× ×××§××¨× ×× × ×©×ר â ×× ×ש×× ×סר, «××ר×» ××× ×¢×¨××× ×¢×¦××ת."]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-base text-slate-700 leading-relaxed",children:"×× × ×××× ×ער×× ×× ×ת ×××××¢× â ×קצר ×××ª× ××ש××ר ×¢× ×× ××סר××."}),e.jsxs("ul",{className:"space-y-2 text-sm text-slate-600",children:[e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-violet-500 flex-none",children:"â¢"})," ××£ × ××©× ×× ××ש×× â רק ×××ר×ת, ××ר×××ת ××× ×ס×××× ××× ×פ×××"]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-violet-500 flex-none",children:"â¢"})," ת×ר××, שע×, ××§××, ××פ××, ×××ר ××§×ש×ר × ×©×ר×× ××× ×©××"]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-violet-500 flex-none",children:"â¢"})," תר×× ×ת ×ת×צ×× ××¤× × ×©×ש×× ×ת×××£"]})]}),e.jsx("div",{className:"rounded-xl bg-amber-50 border border-amber-100 px-4 py-3",children:e.jsxs("p",{className:"text-xs text-amber-800 leading-relaxed",children:["××¢× ",o," ת×××× ××××ס×פ ××§×¤× ×ת ס××£ ×××××¢× ×××××¨× Â«×§×¨× ×¢××» â ×קר××× ×פע××× ×©× ×צ×ת ×ת×ת ××§×פ×× ××× ×§×¨××× ×פע××× ×©××£ ××× ×× ×§×ר×."]})})]})})}function Ml({group:c,members:o,residents:g,isSelected:i,onAddGroup:p,onClose:N}){if(!c)return null;const d=La(c.id,o,g),x=$s(c.color),f=Ds[c.group_type]||(c.is_system?"×ער×ת":"××× ×ת");return e.jsx(ga,{open:!!c,onOpenChange:y=>{y||N()},children:e.jsxs(ba,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",dir:"rtl",children:[e.jsx(ja,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-10 h-10 rounded-lg ${x.bg} flex items-center justify-center`,children:e.jsx(Je,{className:`w-5 h-5 ${x.text}`})}),e.jsxs("div",{children:[e.jsxs(Na,{className:"text-right",children:["×××¨× ××§×××¦× - ",c.title]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d.length," ××ר×× â¢ ×¡××: ",f]}
3)]})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto -mx-2 px-2",children:d.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Je,{className:"w-10 h-10 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"××× ××ר×× ××§×××¦× ××"})]}):e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"sticky top-0 bg-background border-b border-border",children:e.jsxs("tr",{className:"text-right text-xs text-muted-foreground",children:[e.jsx("th",{className:"py-2 px-2 font-medium",children:"×©× ×××"}),e.jsx("th",{className:"py-2 px-2 font-medium",children:"××פ××"}),e.jsx("th",{className:"py-2 px-2 font-medium",children:'×××"×'}),e.jsx("th",{className:"py-2 px-2 font-medium",children:"××××× ×ש××××"})]})}),e.jsx("tbody",{children:d.map(y=>e.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-accent/30",children:[e.jsx("td",{className:"py-2 px-2 font-medium",children:y.full_name||"â"}),e.jsx("td",{className:"py-2 px-2 text-muted-foreground",dir:"ltr",children:y.phone||"â"}),e.jsx("td",{className:"py-2 px-2 text-muted-foreground text-xs",dir:"ltr",children:y.email||"â"}),e.jsx("td",{className:"py-2 px-2",children:i?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-emerald-600 font-medium",children:[e.jsx(et,{className:"w-3.5 h-3.5"})," ××"]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"××"})})]},y.id))})]})}),e.jsxs(ya,{className:"flex items-center justify-between gap-2 border-t border-border pt-3",children:[e.jsx(cs,{variant:"outline",onClick:N,children:"ס××ר"}),i?e.jsxs("div",{className:"inline-flex items-center gap-1.5 h-9 px-4 rounded-md bg-emerald-50 text-emerald-700 text-sm font-medium",children:[e.jsx(wa,{className:"w-4 h-4"})," ×§×××¦× × ××ר×"]}):e.jsxs(cs,{onClick:p,className:"gap-1.5",children:[e.jsx(Je,{className:"w-4 h-4"})," ××סף ×§×××¦× ×ש××××"]})]})]})})}const Mt=[{key:"push",label:"פ×ש",icon:Ss,selectedClass:"bg-indigo-50 text-indigo-700 border border-indigo-200",dot:"#6366f1"},{key:"whatsapp",label:"××צ×פ",icon:Cs,selectedClass:"bg-emerald-50 text-emerald-700 border border-emerald-200",dot:"#10b981"},{key:"site",label:"×תר",icon:Ms,selectedClass:"bg-purple-50 text-purple-700 border border-purple-200",dot:"#9333ea"},{key:"email",label:'×××"×',icon:Ma,selectedClass:"bg-blue-50 text-blue-700 border border-blue-200",dot:"#2563eb"}],Ps={push:"פ×ש",whatsapp:"××צ×פ",site:"×תר",email:'×××"×',post:"פ×ס×"},js={unique:{box:"border-slate-200 bg-slate-50",num:"text-slate-800"},push:{box:"border-indigo-200 bg-indigo-50",num:"text-indigo-700"},whatsapp:{box:"border-emerald-200 bg-emerald-50",num:"text-emerald-700"},site:{box:"border-purple-200 bg-purple-50",num:"text-purple-700"},email:{box:"border-blue-200 bg-blue-50",num:"text-blue-700"},post:{box:"border-amber-200 bg-amber-50",num:"text-amber-700"}},Ns={push:"inapp",whatsapp:"whatsapp",email:"email"},El={sender_disabled:"ש×××ת ××××¢×ת ××ש×תת ×¢××ר ×§×××× ××. ×ש ××פע×× ×××ª× ××××ר×ת ×××××¢×ת ××¤× × ×©××××.",not_active:"×××××¢× ××× × ×××¦× ×©× ××ª× ×ש××× ××× ×.",group_campaign:"×××עת ×§×××¦× × ×©××ת ×× ×ª×× × ×¤×¨× ××ª×¦× ×××××××ת.",whatsapp_image_too_large:"×ת××× × ××צ×רפת ××××× ××× ×××צ×פ. ××¢×× ×ª××× × ×××ש ××× ×©× ××××¥ ×××ª× ×××××××ת ××¤× × ×©××××.",whatsapp_image_unreachable:"×× × ××ª× ×××××§ ×ת ×ת××× × ××צ×רפת ×××צ×פ. ××¢×× ×××ª× ×××ש ×× ×¡× ×©××.",whatsapp_image_check_failed:"×××קת ×ת××× × ×××צ×פ × ×ש××. ××¢×× ×××ª× ×××ש ×× ×¡× ×©××.",not_found:"×××××¢× ×× × ×צ×× ×שרת.",not_due:"×××××¢× ×ת×××× ×ª ××××¢× ××××ר ××תר ××ª×¦× ×××××××ת ××××¢× ×©× ×§××¢.",queue_migration_missing:"ת×ר ×ש×××× ××× × ×××× ×שרת. ×ש ××¤× ×ת ××× ×× ××ער×ת ××¤× × ×©×××× ×××רת."},Dl=[{key:"groups",label:"× ××¢× ××"},{key:"content",label:"ת×××"},{key:"send",label:"ש××××"}];function $l(c,o,g){if(!g)return"";let i;if(c==="today")i=new Date;else if(c==="tomorrow")i=new Date,i.setDate(i.getDate()+1);else if(c==="custom"&&o)i=new Date(`${o}T00:00`);else return"";if(Number.isNaN(i.getTime()))return"";const[p,N]=g.split(":");i.setHours(Number(p),Number(N),0,0);const d=x=>String(x).padStart(2,"0");return`${i.getFullYear()}-${d(i.getMonth()+1)}-${d(i.getDate())}T${d(i.getHours())}:${d(i.getMinutes())}`}const Pl=[{key:"today",label:"××××"},{key:"tomorrow",label:"××ר"},{key:"custom",label:"××ר ×××¢×"}];function Il({channels:c,current:o,onPick:g,previewProps:i}){const p=Math.max(0,c.indexOf(o)),N=c[p]||c[0],d=c.length>1;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"bg-slate-100 rounded-2xl p-4",children:e.jsx(Rl,{channel:N,...i})}),d&&e.jsx("div",{className:"flex items-center justify-center gap-2",role:"group","aria-label":"××¢×ר ××× ×ª×¦×××ת ××§××××ת",children:c.map((x,f)=>{var S;const y=f===p,j=((S=Mt.find(v=>v.key===x))==null?void 0:S.dot)||"#94a3b8";return e.jsx("button",{type:"button",onClick:()=>g(x),"aria-label":Ps[x]||x,"aria-pressed":y,className:"rounded-full transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-slate-300",style:{width:y?24:12,height:12,backgroundColor:y?j:`${j}59`}},x)})})]})}function Rl({channel:c,title:o,content:g,imageUrl:i,linkUrl:p,communityLabel:N,sampleName:d,pdfs:x=[],images:f=[],videoUrl:y="",videoFile:j=null,waParagraphs:S=[],waFormatting:v=!1,brand:T=null,waHeader:M="ת××× × ×¨×ש×ת",waTitle:H=""}){const L=new Date().toLocaleTimeString("he-IL",{hour:"2-digit",minute:"2-digit"}),K=g==null?void 0:g.trim(),z=(j==null?void 0:j.url)||"",O=z?e.jsx("video",{src:z,controls:!0,playsInl
3ine:!0,preload:"metadata",className:"w-full rounded-lg bg-black max-h-56"}):null,Q=e.jsxs(e.Fragment,{children:[y&&e.jsxs("p",{className:"text-xs text-blue-600 break-all",children:["â¶ ",y]}),x.map((l,u)=>e.jsxs("p",{className:"text-xs text-blue-600 break-all",children:["ð ",l.name]},u))]}),r=e.jsxs(e.Fragment,{children:[f.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-1",children:f.map((l,u)=>e.jsx("img",{src:l,alt:"",className:"w-full h-16 object-cover rounded-md"},u))}),x.map((l,u)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-rose-100 bg-rose-50/60 px-2.5 py-1.5 text-xs text-slate-700",children:[e.jsx(Et,{className:"w-4 h-4 text-rose-500 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:l.name})]},u)),y&&e.jsxs("a",{href:y,className:"inline-flex items-center gap-1 text-sm text-blue-600 break-all",children:[e.jsx($t,{className:"w-3.5 h-3.5"})," ",y]})]});return c==="whatsapp"?e.jsxs("div",{className:"mx-auto max-w-[320px] rounded-[2.5rem] border-[10px] border-slate-900 bg-slate-900 shadow-xl overflow-hidden",children:[e.jsxs("div",{className:"bg-[#075e54] text-white px-4 py-3 flex items-center gap-2.5",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-white/20 flex items-center justify-center",children:e.jsx(Pa,{className:"w-4 h-4"})}),e.jsxs("div",{className:"leading-tight",children:[e.jsx("p",{className:"text-sm font-semibold",children:N}),e.jsx("p",{className:"text-[0.625rem] text-white/70",children:"××§×××"})]})]}),e.jsxs("div",{className:"bg-[#e5ddd5] p-3 min-h-[240px]",children:[e.jsxs("div",{className:"bg-[#dcf8c6] rounded-xl rounded-tr-none p-2.5 max-w-[88%] mr-auto shadow-sm",children:[M?O?e.jsx("div",{className:"mb-2",children:O}):i?e.jsx(wt,{src:i,maxHeight:"22rem",className:"rounded-lg mb-2"}):null:null,H&&e.jsx("p",{className:"font-bold text-sm text-slate-800 mb-1",children:H}),S.length?S.map((l,u)=>e.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap break-words leading-relaxed mb-1.5",children:e.jsx(Ba,{text:l})},u)):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap leading-relaxed",children:K||"ת××× ×××××¢×..."}),p&&e.jsx("p",{className:"text-xs text-blue-600 mt-1 break-all",children:p}),e.jsx("div",{className:"space-y-0.5 mt-1",children:Q})]}),v&&e.jsxs("p",{className:"text-[0.625rem] text-emerald-600 mt-1 inline-flex items-center gap-1",children:[e.jsx(Pt,{className:"w-3 h-3"})," ×ס×ר ×××××××ת ×-3 פסק××תâ¦"]}),e.jsxs("p",{className:"text-[0.625rem] text-slate-400 text-left mt-1",children:[L," ââ"]})]}),d&&e.jsxs("p",{className:"text-[0.625rem] text-slate-500 text-center mt-2",children:["תצ××× ×-",d]})]})]}):c==="email"?e.jsx(Ga,{height:620,opts:{...T||{},communityName:(T==null?void 0:T.communityName)||N,title:o,body:g,imageUrl:i||void 0,images:f,files:x,videoUrl:z||y||void 0,videoLayout:!!z,ctaUrl:p||void 0,ctaLabel:"×××¢×ר ×פר×××",senderLabel:"×××עת ×§××××",sentAt:new Date().toLocaleString("he-IL",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),year:String(new Date().getFullYear())}}):c==="site"?e.jsxs("div",{className:"mx-auto max-w-2xl rounded-2xl border border-slate-200 bg-white overflow-hidden shadow-sm",children:[O?e.jsxs("div",{className:"p-3 pb-0 space-y-3",children:[O,e.jsx("h2",{className:"text-2xl font-extrabold text-slate-800 text-center",children:o||"××תרת ××¢××××"})]}):i?e.jsxs("div",{className:"relative bg-slate-900",children:[e.jsx(wt,{src:i,maxHeight:"20rem"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"}),e.jsx("h2",{className:"absolute bottom-5 right-6 left-6 text-2xl font-extrabold text-white text-center leading-tight",children:o||"××תרת ××¢××××"})]}):e.jsx("div",{className:"px-6 pt-8",children:e.jsx("h2",{className:"text-2xl font-extrabold text-slate-800 text-center",children:o||"××תרת ××¢××××"})}),e.jsxs("div",{className:"px-6 py-8 space-y-4 max-w-xl mx-auto text-center",children:[e.jsx("p",{className:"text-base text-slate-700 whitespace-pre-wrap leading-relaxed",children:K||"ת××× ××¢××××..."}),p&&e.jsx("a",{href:p,className:"inline-block text-sm text-blue-600 hover:underline break-all",children:p}),e.jsx("div",{className:"space-y-2 text-right",children:r})]})]}):c==="push"?e.jsx("div",{className:"mx-auto max-w-sm rounded-3xl bg-gradient-to-br from-slate-700 to-slate-900 p-6",children:e.jsxs("div",{className:"rounded-2xl bg-white/95 backdrop-blur border border-white/20 shadow-lg p-4 flex gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-600 flex items-center justify-center flex-shrink-0",children:e.jsx(Ss,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 truncate",children:N}),e.jsx("p",{className:"text-[0.625rem] text-slate-400 flex-shrink-0",children:"×¢×ש××"})]}),e.jsx("p",{className:"text-sm font-bold text-slate-800 mb-0.5 truncate",children:o||"××תרת ×××××¢×"}),e.jsx("p",{className:"text-xs text-slate-600 line-clamp-2",children:K||"ת××× ×××××¢×..."})]}),i&&e.jsx("img",{src:i,alt:"",className:"w-12 h-12 rounded-lg object-cover flex-shrink-0"})]})}):e.jsxs("div",{className:"mx-auto max-w-sm rounded-2xl bg-white border border-slate-200 shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-blue-100 flex items-center justify-center flex-shrink-0",children:e.jsx("span",{className:"text-sm font-bold text-blue-600",children:(N||"×§").charAt(0)})}),e.jsxs("div",{className:"leading-tight min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-800 truncate",children:N}),e.jsx("p",{className:"text-[0.625rem] text-slate-400",children:"פ××¡× ×§×××ת×"})]})]}),O?e.jsx("div",{className:"px-3 pt-1",children:O}):i?e.jsx(wt,{src:i,maxHeight:"24rem",className:"bg-slate-900"}):null,e.jsxs("div",{className:"px-4 py-3 space-y-1.5",children:[o&&e.jsx("p",{className:"font-bold text-sm text-slate-800",children:o}),e.jsx("p",{className:"text-sm text-slate-600 whitespace-pre-wrap leading-relaxed",children:K||"ת××× ×פ×ס×..."}),p&&e.jsx("p",{className:"text-xs text-blue-600 break-all",children:p}),e.jsx("div",{className:"space-y-2",children:r})]})]})}function Fl(){var ns,rs,is,os;const{t:c}=va(),{id:o}=_a(),g=Oa(o),i=ka(),p=Sa(),N=(ns=p.state)==null?void 0:ns.preloadedRecipients,d=(rs=p.state)==null?void 0:rs.sourceLabel,x=((is=p.state)==null?void 0:is.prefill)||{},[f,y]=s.useState([]),[j,S]=s.useState([]),[v,T]=s.useState([]),[M,H]=s.useState([]),[L,K]=s.useState(null),[z,O]=s.useState(!0),[Q,r]=s.useState(!1),[l,u]=s.useState([]),[$,G]=s.useState(x.title||""),[I,je]=s.useState(x.kind||sl),[le,Ee]=s.useState(null),[Y,De]=s.useState(null),[R,re]=s.useState(x.content||""),[U,ce]=s.useState(x.imageUrl||""),[Z,ie]=s.useState(x.linkUrl||""),[q,Ne]=s.useState([]),[ee,ye]=s.useState([]),[W,n]=s.useState(""),[E,te]=s.useState(!1),[It,Al]=s.useState(!1),[D,$e]=s.useState(["whatsapp"]),[Pe,Is]=s.useState(()=>new Set),[ge,Ie]=s.useState(""),[Rs,we]=s.useState(!1),[Fs,Re]=s.useState(!1),[Rt,Fe]=s.useState(""),[Ll,Tl]=s.useState(""),[oe,Ft]=s.useState(!1),[be,At]=s.useState(""),[ve,Lt]=s.useState("today"),[st,Tt]=s.useState(""),[Ae,zt]=s.useState(""),[Le,at]=s.useState("whatsapp"),[Ut,_e]=s.useState(!1),[zl,Ul]=s.useState(!1),[ke,As]=s.useState([]),[de,Ls]=s.useState([]),[ne,Te]=s.useState([]),[ue,ze]=s.useState(!1),[Ue,Ts]=s.useState(null),[me,Be]=s.useState("groups"),[zs,lt]=s.useState(!1),nt=Ca.useRef(null),[Us,Bs]=s.useState(""),[Os,Gs]=s.useState(""),[Bt,Ot]=s.useState(!0),[Gt,Oe]=s.useState(null);function Hs(t){if(t===I){t===kt&&Ot(a=>!a);return}je(t),Ot(!0)}s.useEffect(()=>{Ht()},[o]),s.useEffect(()=>{At(oe?$l(ve,st,Ae):"")},[oe,ve,st,Ae]),s.useEffect(()=>{D.length!==0&&(D.includes(Le)||at(D[0]))},[D,Le]),s.useEffect(()=>{Pe.size&&$e(t=>{const a=t.filter(m=>!Pe.has(m));return a.length===t.length?t:a})},[D,Pe]),s.useEffect(()=>{N&&N.length>0&&u(N.map(t=>({resident_id:t.resident_id||null,full_name:t.full_name||"",phone:t.phone||"",email:t.email||"",source_groups:[],is_manual:!0,source_label:d})))},[]);async function Ht(){O(!0),r(!1);const t=C=>C.catch(()=>null),[a,m,h,k,w,F,b,P]=await Promise.all([t(A.entities.Resident.filterAll({kibbutz_id:o,is_deleted:Ia},"full_name")),t(A.entities.MessageTemplate.filter({kibbutz_id:o},"-updated_date",500)),t(A.entities.MessageTemplateCategory.filter({kibbutz_id:o},"sort_order",100)),t(A.entities.NewsUpdateCategory.filter({kibbutz_id:o},"sort_order",100)),t(A.entities.Kibbutz.get(o)),t(A.entities.ResidentGroup.filter({kibbutz_id:o,is_active:!0},"order",200)),t(A.entities.ResidentGroupMember.filterAll({kibbutz_id:o,is_active:!0},"-created_date")),t(A.entities.NotificationChannelPolicy.filter({community_id:o}))]);A.auth.me().then(C=>Bs((C==null?void 0:C.full_name)||(C==null?void 0:C.email)||"")).catch(()=>{});const X=new Set((P||[]).filter(C=>C&&C.recipient_role==="resident"&&C.allowed===!1).map(C=>C.channel));Is(new Set(Mt.filter(C=>Ns[C.key]&&X.has(Ns[C.key])).map(C=>C.key))),a===null&&F===null&&m===null&&r(!0),y(a||[]),S((m||[]).filter(C=>C.is_active!==!1)),T(h||[]),H(k||[]),K(w||null),As(F||[]),Ls(b||[]),O(!1)}async function Kt(){const t=Rt.trim();if(!t){Re(!1),Fe("");return}try{const a=await A.entities.NewsUpdateCategory.create({kibbutz_id:o,title:t,sort_order:M.length});H(m=>[...m,a]),Ie(a.id),Fe(""),Re(!1),B.success("××§×××ר×× × ×ספ×")}catch{B.error("ש×××× ×××ספת ×§×××ר××")}}function Ks(t){$e(a=>a.includes(t)?a.filter(m=>m!==t):[...a,t])}function se(t){return t.resident_id||t.phone||t.email||t.full_name}function Wt(t){const a=ne.includes(t),m=ke.find(h=>h.id===t);if(m)if(a)Te(h=>h.filter(k=>k!==t)),u(h=>h.map(k=>{var w;if((w=k.source_groups)!=null&&w.includes(t)){const F=k.source_groups.filter(b=>b!==t);return{...k,source_groups:F}}return k}).filter(k=>k.source_groups.length>0||k.is_manual));else{Te(b=>[...b,t]);const h=ms([t],de,f),k=new Set(l.map(b=>se(b))),w=h.filter(b=>!k.has(se({resident_id:b.id,phone:b.phone,email:b.email,full_name:b.full_name}))).length;u(b=>{const P=[...b];for(const X of h){const C=se({resident_id:X.id,phone:X.phone,email:X.email,full_name:X.full_name}),qe=P.findIndex(ma=>se(ma)===C);qe>=0?P[qe]={...P[qe],source_groups:[...new Set([...P[qe].source_groups||[],t])]}:P.push({resident_id:X.id,full_name:X.full_name,phone:X.phone||"",email:X.email||"",source_groups:[t],is_manual:!1})}return P});const F=h.length-w;B.success(`× ××¡×¤× ${w} × ××¢× ×× ×××§×××¦× "${m.title}"`+(F>0?` (${F} ××ר ×רש×××)`:""))}}const rt=s.useMemo(()=>{const t=ke.find(a=>a.system_key==="all_residents");return t?ms([t.id],de,f):f.filter(a=>Ea(a))},[ke,de,f]);function Ws(){if(ue)ze(!1),u(t=>t.map(a=>({...a,source_all:!1})).filter(a=>a.is_manual||a.source_groups&&a.source_groups.length>0));else{ze(!0);const t=rt;u(a=>{const m=[...a];for(const h of t){const k=se({resident_id:h.id,phone:h.phone,email:h.email,full_name:h.full_name}),w=m.findIndex(F=>se(F)===k);w>=0?m[w]={...m[w],source_all:!0}:m.push({resident_id:h.id,full_name:h.full_name||"",phone:h.phone||"",email:h.email||"",source_groups:[],is_manual:!1,source_all:!0})}return m})}}const it=s.useMemo(()=>{const t=ne.reduce((w,F)=>w+Ta(F,de,f),0),a=ue?rt.length:0,m=l.filter(w=>w.is_manual).length,h=l.length,k=Math.max(0,t+a+m-h);return{totalUnique:h,duplicatesRemoved:k,totalGroupMembers:t}},[ne,de,l,ue,f,rt]);function Vs(t){const a=se(t);l.find(m=>se(m)===a)||u(m=>[...m,{...t,source_groups:[],is_manual:!0}])}function qs(t){u(a=>a.filter((m,h)=>h!==t))}const Ys=!!(U||q.length||ee.length||W.trim()||Z.trim());function Js(t){var h;G(t.title||"");let a=t.content||"";t.content_paragraph_2&&(a+=` 4 5`+t.content_paragraph_2),t.content_paragraph_3&&(a+=` 6 7`+t.content_paragraph_3),gs(t)===il&&t.content_paragraph_4&&(a+=` 8 9`+t.content_paragraph_4),re(a),t.image_url&&ce(t.image_url),t.link_url&&ie(t.link_url),Array.isArray(t.gallery)&&t.gallery.length&&ye(t.gallery),t.pdf_url&&Ne([{url:t.pdf_url,name:Va(t.pdf_url)}]),t.youtube_url&&n(t.youtube_url);const m=gs(t);if(je(m),De(t.video_file_url?{url:t.video_file_url,name:"סר××× ×ת×× ×ת",size:0}:null),t.channel_type&&$e({whatsapp:["whatsapp"],email:["email"],site:["site"],combined:["whatsapp","email"]}[t.channel_type]||["whatsapp"]),t.category_id){const k=(h=v.find(F=>F.id===t.category_id))==null?void 0:h.title,w=k&&M.find(F=>F.title===k);w&&Ie(w.id)}Gs(t.id||""),B.success(`×ת×× ×ת × ××¢× × ×${pl(m).title} â × ××ª× ×ער×× ×ת ×ת×××`)}function Xs(t){const a=nt.current;if(!a){re(w=>w?`${w} ${t}`:t);return}const m=a.selectionStart??a.value.length,h=a.selectionEnd??m,k=a.value.slice(0,m)+t+a.value.slice(h);re(k),requestAnimationFrame(()=>{a.focus();const w=m+t.length;try{a.setSelectionRange(w,w)}catch{}})}const xe=D.includes("whatsapp"),{metaTemplate:Vt,slots:ot,headlineSlot:ct}=al(I,R),{headline:J,body:dt}=s.useMemo(()=>ct?Ha(R):{headline:"",body:R},[R,ct]);s.useEffect(()=>{G(J||Ka(R))},[R,J]);const[ut,qt]=s.useState({key:"",paragraphs:[]}),[Qs,Ge]=s.useState(!1),Se=s.useRef(new Map),[V,Yt]=s.useState(!0),[mt,Zs]=s.useState("");s.useEffect(()=>{let t=!1;return A.entities.MessageSettings.filter({kibbutz_id:o},null,1).then(a=>{t||!(a!=null&&a[0])||(Yt(a[0].auto_design_messages!==!1),Zs(a[0].whatsapp_default_image||""))}).catch(()=>{}),()=>{t=!0}}
9,[o]);const Jt=s.useRef(null);s.useEffect(()=>{mt&&Jt.current!==I&&(Jt.current=I,hs(I).header==="image"&&ce(t=>t||mt))},[I,mt]);const _=s.useMemo(()=>({text:dt.trim(),title:J.trim(),videoUrl:W.trim(),linkUrl:Z.trim(),pdfs:q.map(t=>({name:t.name,url:t.url})),paragraphs:ot,maxChars:Xe-J.length,design:V}),[dt,J,W,Z,q,ot,V]),ae=s.useMemo(()=>JSON.stringify(_),[_]),xt=_.text.length+_.title.length<=ps,ea=s.useMemo(()=>V?xs(_):vt({..._,max:_.paragraphs}),[_,V]),Xt=s.useMemo(()=>_.text||_.videoUrl||_.linkUrl||_.pdfs.length?V?Wa(_.paragraphs===1?{..._,max:1}:_):vt({..._,max:_.paragraphs}):[],[_,V]),Ce=xt?ea:ut.key===ae&&ut.paragraphs.length?ut.paragraphs:Xt,ht=s.useMemo(()=>J?[J,...Ce]:Ce,[J,Ce]),pt=s.useCallback(async()=>{var m;if(!_.text)return"";if(_.text.length+_.title.length<=ps)return(V?xs(_):vt({..._,max:_.paragraphs})).join(` 10 11`);if(Se.current.has(ae))return Se.current.get(ae).join(` 12 13`);const t=await A.functions.invoke("formatMessageParagraphs",_),a=Array.isArray((m=t==null?void 0:t.data)==null?void 0:m.paragraphs)?t.data.paragraphs.filter(Boolean):[];return a.length?(Se.current.set(ae,a),qt({key:ae,paragraphs:a}),a.join(` 14 15`)):""},[_,ae,V]);s.useEffect(()=>{if(!xe||!_.text||xt){Ge(!1);return}if(Se.current.has(ae)){qt({key:ae,paragraphs:Se.current.get(ae)});return}let t=!1;Ge(!0);const a=setTimeout(async()=>{try{await pt()}catch{}finally{t||Ge(!1)}},900);return()=>{t=!0,clearTimeout(a),Ge(!1)}},[xe,ae,_.text,xt,pt]);function Qt(){Be("content"),Oe({chars:ol(ht)})}async function ta(){var a;const t=dt.trim();if(!t)return"";try{const m=await A.functions.invoke("formatMessageParagraphs",{text:t,title:J.trim(),videoUrl:W.trim(),pdfs:q.map(h=>({name:h.name,url:h.url})),paragraphs:ot,maxChars:Xe-J.length});return dl(I,R,{headline:J,paragraphs:(a=m==null?void 0:m.data)==null?void 0:a.paragraphs})}catch{return B.error("×× ×צ××× × ×קצר ×ת ×××××¢× ×ר××¢ â ×פשר ×ער×× ×××ª× ××× ×ת"),""}}function sa(t){re(t),Oe(null),B.success("×××××¢× ×§××¦×¨× â ×פשר ×ש×××")}const He=(t,a)=>a==="whatsapp"?!!String(t.phone||"").trim():a==="email"?!!String(t.email||"").trim():a==="push"?!!t.resident_id:!0,[Zt,aa]=s.useState(null),[Ke,es]=s.useState(""),ts=s.useMemo(()=>{const t=[{key:"unique",label:"× ××¢× ×× ××××××××",tone:"text-slate-800",count:l.length,list:l}];for(const a of D){const m=l.filter(h=>He(h,a));t.push({key:a,label:`×${Ps[a]||a}`,tone:"text-emerald-600",count:m.length,list:m})}return t},[l,D]),Me=ts.find(t=>t.key===Zt)||null,ft=s.useMemo(()=>Me?Me.list.filter(t=>vs(t,Ke)):[],[Me,Ke]);function la(t){const a=se(t);u(m=>m.filter(h=>se(h)!==a))}const ss=!xe||ll(I,{image:U,videoFile:Y}),as=l.length>0&&R.trim()&&D.length>0&&ss&&!!ge,na=(t,a)=>{!a&&t==="send"&&!ge&&we(!0),Be(a?"":t)},ra=()=>{we(!1),Be("content"),requestAnimationFrame(()=>{var t;(t=document.getElementById("message-category"))==null||t.scrollIntoView({behavior:"smooth",block:"center"})})},gt=(L==null?void 0:L.name)||"",bt=((os=l[0])==null?void 0:os.full_name)||`××ר ${c("community_noun")}`,We=oe&&be&&new Date(be).getTime()>Date.now();function ls(){u([]),G(""),re(""),ce(""),ie(""),Ne([]),ye([]),n(""),$e(["whatsapp"]),Te([]),ze(!1),Ie(""),Ft(!1),At(""),Lt("today"),Tt(""),zt("")}async function ia(){if(!ge){we(!0);return}if(as){if(oe&&!be){B.error("××ר ×××¢× ×ת×××× ×פרס××");return}if(xe&&Ce.length&&!cl(ht)){Qt();return}_e(!0);try{if(xe&&U)try{await fl(U)}catch(b){if((b==null?void 0:b.message)==="whatsapp_image_url_too_large"){const P=(Number(b.size||0)/1e3/1e3).toFixed(1);B.error(`×ת××× × ××צ×רפת ××××× ××× ×××צ×פ (${P}MB). ××¢×× ×ª××× × ×××ש ××× ×©× ××××¥ ×××ª× ×××××××ת.`),_e(!1);return}throw b}const t=await A.auth.me().catch(()=>null),a=[...ue?["×× ×ת×ש×××"]:[],...ne.map(b=>{var P;return(P=ke.find(X=>X.id===b))==null?void 0:P.title}).filter(Boolean)],m=We?new Date(be).toISOString():null;let h="";if(xe&&R.trim()){try{h=await pt()}catch{h=""}h||(h=Xt.join(` 16 17`))}const k=await A.entities.MessageCampaign.create({kibbutz_id:o,title:$||"××××¢× ××× ××תרת",content:R,...h?{whatsapp_content:h}:{},image_url:U,link_url:Z,...q.length?{pdf_urls:q}:{},...ee.length?{image_urls:ee}:{},...W.trim()?{video_url:W.trim()}:{},...Y!=null&&Y.url?{video_file_url:Y.url}:{},...Vt?{meta_template:Vt}:{},channels:fs(D),recipient_type:ne.length>0||ue?"groups":"manual",category_id:ge||null,total_recipients:l.length,sent_count:0,failed_count:0,pending_count:l.length,status:m?"scheduled":"sending",scheduled_at:m,sent_by:(t==null?void 0:t.full_name)||(t==null?void 0:t.email)||"",sent_at:m?null:new Date().toISOString(),selected_group_ids:ne,selected_group_names:a.join(", "),total_selected_groups:ne.length+(ue?1:0),total_group_members:it.totalGroupMembers,total_unique_recipients:l.length,duplicate_recipients_removed:it.duplicatesRemoved});if(l.length>0){const b=l.map(P=>({kibbutz_id:o,campaign_id:k.id,resident_id:P.resident_id||null,full_name:P.full_name||"",phone:P.phone||"",email:P.email||"",channels:fs(D),whatsapp_status:D.includes("whatsapp")&&He(P,"whatsapp")?"pen
17ding":"not_applicable",email_status:D.includes("email")&&He(P,"email")?"pending":"not_applicable",push_status:D.includes("push")&&He(P,"push")?"pending":"not_applicable"}));await A.entities.MessageRecipient.bulkCreate(b)}if(m){B.success(`×××××¢× ×ª×××× × ×-${new Date(be).toLocaleString("he-IL",{dateStyle:"short",timeStyle:"short"})}`),ls(),_e(!1),i(`/kibbutz/${o}/message-reports?campaign=${k.id}`);return}let w=null,F="";try{const b=await A.functions.invoke("sendCampaign",{kibbutz_id:o,campaign_id:k.id});w=(b==null?void 0:b.data)??b}catch(b){F=String((b==null?void 0:b.message)||b||"").slice(0,200),console.error("sendCampaign kick failed (the cron will still pick it up):",b)}if(w!=null&&w.skipped){_e(!1),B.error(El[w.reason]||`×××××¢× × ×©××¨× ×× ×× × ×©×××${w.reason?` (${w.reason})`:""}. ×¤× × ××× ×× ××ער×ת.`,{duration:9e3}),w.reason==="sender_disabled"&<(!0);return}F?B("×××××¢× × ×©×ר×, ×× ××פע×× ××××××ת ×× ×צ××××: "+F+". ××ער×ת ×ª× ×¡× ×©×× ×××××××ת ×××§× ×קר×××. ×¢×§×× ×××¨× ××××.",{icon:"â ï¸",duration:1e4}):B.success("×××××¢× × ×©××¨× ××ש×××× ×ת×××× â ×××× ×תע××× ×××××××ת"),ls(),i(`/kibbutz/${o}/message-reports?campaign=${k.id}`,{state:{justSent:!0}})}catch(t){B.error("ש×××× ×ש××××: "+t.message)}finally{_e(!1)}}}if(z)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})});if(Q)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-4 text-center",children:[e.jsx("p",{className:"text-sm text-slate-600",children:"×××¨×¢× ×©×××× ×××¢×× ×ª ×× ×ª×× ××. × ×¡× ×©××."}),e.jsxs("button",{onClick:Ht,className:"inline-flex items-center gap-2 h-10 px-5 rounded-xl bg-cyan-600 text-white text-sm font-bold hover:bg-cyan-700",children:[e.jsx(pe,{className:"w-4 h-4"})," × ×¡× ×©××"]})]});const jt=D.length>0?D:["whatsapp"],oa=jt.includes(Le)?Le:jt[0],ca={firstName:(bt||"").trim().split(/\s+/)[0]||"",fullName:bt,kibbutzName:gt,siteUrl:Da(o,`/kibbutz-site/${o}`,window.location.origin),senderName:Us},Ve=t=>hl(t,ca),da={title:Ve($),content:Ve(R),imageUrl:U,linkUrl:Z,pdfs:q,images:ee,videoUrl:W,videoFile:Y,communityLabel:gt||c("community_noun"),sampleName:bt,waParagraphs:Ce.map(Ve),waFormatting:Qs,brand:g,waHeader:hs(I).header==="none"?"":"media",waTitle:ct?Ve(J)||gt||c("community_noun"):""},ua=Dl.map(t=>({key:t.key,label:t.label,badge:t.key==="groups"&&l.length>0?l.length:null,nudge:t.key==="content"&&l.length>0&&me!==t.key}));return e.jsxs("div",{dir:"rtl",children:[e.jsxs(qa,{title:"ש×× ××××¢×",icon:Nt,steps:ua,activeKey:me,onStep:na,showPreview:me==="content"||me==="send",preview:e.jsx(Il,{channels:jt,current:oa,onPick:at,previewProps:da}),actions:e.jsx("button",{type:"button",onClick:()=>lt(!0),title:"×××ר×ת ש××××","aria-label":"×××ר×ת ש××××",className:"w-9 h-9 rounded-xl bg-white/15 text-white grid place-items-center flex-none hover:bg-white/25 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50",children:e.jsx($a,{className:"w-4 h-4","aria-hidden":"true"})}),children:[me==="groups"&&e.jsx(_t,{step:"groups",className:"space-y-4",children:e.jsx(kl,{kibbutzId:o,residents:f,residentGroups:ke,groupMembers:de,selectedGroupIds:ne,onToggleGroup:Wt,recipients:l,onAddRecipient:Vs,onRemoveRecipient:qs,onClearAll:()=>{u([]),Te([]),ze(!1)},allResidentsSelected:ue,onToggleAllResidents:Ws,channels:D,duplicatesRemoved:it.duplicatesRemoved,sourceLabel:d})}),me==="content"&&e.jsxs(_t,{step:"content",className:"space-y-4",children:[e.jsx(Ya,{value:I,onChange:Hs,expandedKind:I===kt?Bt:null}),I===kt&&Bt&&e.jsx(Ja,{templates:j,categories:v,activeId:Os,onPick:Js}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[minmax(0,1fr)_9rem] gap-3 items-start",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("textarea",{ref:nt,value:R,onChange:t=>re(t.target.value),rows:8,placeholder:"ת××× ×××××¢× â ×× ××©× ××××××¢. ×ת×× ××פש×; ××ער×ת ×ª× ×¡×, תקצר ××ª×¢×¦× ×ת ×× ×××××ס×פ.",className:"w-full rounded-xl border-2 border-slate-200 bg-white p-3 text-sm leading-relaxed focus:outline-none focus:border-cyan-400 focus:ring-2 focus:ring-cyan-100"}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:xl.map(t=>e.jsx("button",{type:"button",onClick:()=>Xs(t),className:"h-7 px-2.5 rounded-full bg-cyan-50 text-cyan-700 border border-cyan-100 text-[0.6875rem] font-bold hover:bg-cyan-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300",children:t},t))}),e.jsxs("button",{type:"button",role:"switch","aria-checked":V,onClick:()=>Yt(t=>!t),className:`mt-2.5 w-full flex items-center gap-2.5 rounded-xl border p-2.5 text-right transition-colors ${V?"border-cyan-200 bg-cyan-50/60 hover:bg-cyan-50":"border-slate-200 bg-slate-50/60 hover:bg-slate-50"}`,children:[e.jsx("span",{className:`w-9 h-5 rounded-full flex-shrink-0 relative transition-colors ${V?"bg-cyan-500":"bg-slate-300"}`,children:e.jsx("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-all ${V?"right-0.5":"right-[1.125rem]"}`})}),e.jsxs("span",{className:"min-w-0",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-bold text-slate-700",children:[e.jsx(Pt,{className:`w-3.5 h-3.5 ${V?"text-cyan-500":"text-slate-400"}`,"aria-hidden":"true"}),"×¢×¦× ×ת ×××××¢×"]}),e.jsx("span",{className:"block text-[0.6875rem] text-slate-500 leading-snug mt-0.5",children:V?"××ער×ת ת×ס××£ ××××××³× ×ת×××ש ×ת פת××ת ×× ×¤×¡×§×.":"×××××¢× ×ª×ש×× ×××××§ ××¤× ×©×ת××ª× â ××× ×××××׳×× ×××× ×××ש×ת ש××ער×ת ××ס×פ×."})]})]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsx(Xa,{kind:I,counts:{[Ze]:q.length,[Dt]:(U?1:0)+ee.length,[fe]:Y||W.trim()?1:0,[Qe]:Z.trim()?1:0}
17,onOpen:(t,a)=>Ee({media:t,mode:a})}),e.jsx(Qa,{paragraphs:ht,active:xe,onFix:Qt})]})]}),(()=>{const t=nl(I,{image:U,images:ee,files:q,videoFile:Y,videoUrl:W.trim(),linkUrl:Z.trim()});return!t.whatsapp.asLinks.length&&!t.whatsapp.note?null:e.jsxs("p",{className:"text-[0.6875rem] text-slate-500 leading-relaxed",children:[t.whatsapp.asLinks.length>0&&e.jsxs(e.Fragment,{children:["×××××ס×פ ×צ××¨×¤× ××§×ש×ר××: ",t.whatsapp.asLinks.join(" · "),". "]}),t.whatsapp.note]})})(),e.jsx("div",{id:"message-category",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-bold text-slate-600",children:[e.jsx(yt,{className:"w-3.5 h-3.5 text-amber-500","aria-hidden":"true"})," ×§×××ר××:",e.jsx("span",{className:"text-rose-500","aria-hidden":"true",children:"*"})]}),M.length===0&&e.jsx("span",{className:"text-xs text-slate-500",children:"××× ×¢×××× ×§×××ר××ת â ××ס××¤× ××ת ×××"}),M.map(t=>{const a=ge===t.id;return e.jsx("button",{type:"button",onClick:()=>Ie(t.id),className:`inline-flex items-center h-8 px-3.5 rounded-full text-xs font-bold border transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300 ${a?"bg-cyan-600 text-white border-cyan-600 shadow-sm":"bg-white border-slate-200 text-slate-600 hover:bg-slate-50"}`,children:t.title},t.id)}),Fs?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("input",{autoFocus:!0,value:Rt,onChange:t=>Fe(t.target.value),onKeyDown:t=>{t.key==="Enter"&&Kt(),t.key==="Escape"&&(Re(!1),Fe(""))},placeholder:"×©× ×§×××ר××","aria-label":"×©× ×§×××ר×× ××ש×",className:"h-8 w-32 rounded-full border border-slate-200 bg-white px-3 text-xs focus:outline-none focus:ring-2 focus:ring-cyan-100"}),e.jsx("button",{type:"button",onClick:Kt,className:"h-8 px-3 rounded-full bg-cyan-600 text-white text-xs font-bold hover:bg-cyan-700",children:"××סף"})]}):e.jsx("button",{type:"button",onClick:()=>Re(!0),title:"×§×××ר×× ××ש×","aria-label":"××ספת ×§×××ר×× ××ש×",className:"inline-flex items-center justify-center h-8 w-8 rounded-full border border-dashed border-slate-300 text-slate-500 hover:border-cyan-300 hover:text-cyan-600 hover:bg-cyan-50/40 transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300",children:e.jsx(ks,{className:"w-4 h-4","aria-hidden":"true"})})]})})]}),me==="send"&&e.jsxs(_t,{step:"send",className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3 items-start",children:[e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-slate-50/70 p-3 space-y-2.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-bold text-slate-700",children:[e.jsx(Nt,{className:"w-4 h-4 text-cyan-600","aria-hidden":"true"})," ער××¦× ×©××××"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Mt.filter(t=>!Pe.has(t.key)).map(t=>{const a=D.includes(t.key),m=()=>{a&&at(t.key)};return e.jsx("button",{type:"button",onClick:()=>Ks(t.key),"aria-pressed":a,onMouseEnter:m,onFocus:m,title:a?`תצ××× ××§×××× â ${t.label}`:void 0,className:`h-11 px-5 rounded-xl text-sm font-bold transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300 ${a?t.selectedClass:"bg-white text-slate-500 border border-slate-200 hover:bg-slate-50"}`,children:t.label},t.key)})}),D.length>1&&e.jsx("p",{className:"text-[0.6875rem] text-slate-500",children:"×¢××× ×¢× ×¢×¨××¥ × ××ר ××× ×ר××ת ×××ª× ×תצ××× ×××§×××× ×©×צ×."})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-slate-50/70 p-3 space-y-2",children:[e.jsxs("label",{className:"flex items-center justify-between gap-2 cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm font-bold text-slate-700",children:[e.jsx(ds,{className:"w-4 h-4 text-cyan-600"})," ת×××× ×פרס××"]}),e.jsx("button",{type:"button",onClick:()=>Ft(t=>!t),role:"switch","aria-checked":oe,"aria-label":"ת×××× ×פרס××",className:`w-11 h-6 rounded-full transition-all relative flex-shrink-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400 ${oe?"bg-cyan-600":"bg-slate-300"}`,children:e.jsx("span",{className:`absolute top-0.5 w-5 h-5 rounded-full bg-white shadow transition-all ${oe?"right-0.5":"right-5"}`})})]}),oe?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-2",role:"group","aria-label":"××× ×ש××××",children:Pl.map(t=>{const a=ve===t.key;return e.jsx("button",{type:"button",onClick:()=>Lt(t.key),"aria-pressed":a,className:`h-10 rounded-xl text-sm font-bold border transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400 ${a?"bg-cyan-600 text-white border-cyan-600":"bg-white text-slate-600 border-slate-200 hover:bg-slate-50"}`,children:t.label},t.key)})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[ve==="custom"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sched-date",className:"block text-[0.6875rem] font-medium text-slate-500 mb-1",children:"ת×ר××"}),e.jsx("input",{id:"sched-date",type:"date",value:st,onChange:t=>Tt(t.target.value),className:"w-full h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:ring-2 focus:ring-cyan-100"})]}),e.jsxs("div",{className:ve==="custom"?"":"col-span-2",children:[e.jsx("label",{htmlFor:"sched-time",className:"block text-[0.6875rem] font-medium text-slate-500 mb-1",children:"שע×"}),e.jsx("input",{id:"sched-time",type:"time",value:Ae,onChange:t=>zt(t.target.value),className:"w-full h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:ring-2 focus:ring-cyan-100"})]})]}),e.jsx("p",{className:"text-[0.6875rem] text-muted-foreground",children:We?`×××××¢× ×ª×ש×× ×-${new Date(be).toLocaleStr
17ing("he-IL",{dateStyle:"short",timeStyle:"short"})}`:Ae?"××××¢× ×©× ××ר ××× × ×¢×ª××× â ××ר ×××¢× ××××ר ××תר":"××ר ×©×¢× ×ש×××× ×ת×××× ×ª"})]}):e.jsx("p",{className:"text-[0.6875rem] text-muted-foreground",children:"×××× â ×××××¢× ×ª×ש×× ×××"})]})]}),l.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-bold text-slate-700 flex items-center gap-1.5",children:[e.jsx(_s,{className:"w-4 h-4 text-cyan-600","aria-hidden":"true"})," ××× ××§××× ××× ×¢×¨××¥"]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:ts.map(t=>{const a=Zt===t.key,m=js[t.key]||js.unique;return e.jsxs("button",{onClick:()=>{aa(a?null:t.key),es("")},"aria-expanded":a,className:`rounded-2xl border p-3 text-center transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300 ${m.box} ${a?"ring-2 ring-cyan-300":"hover:brightness-[0.98]"}`,children:[e.jsx("p",{className:`text-2xl font-extrabold tabular-nums leading-none ${m.num}`,children:t.count}),e.jsx("p",{className:"text-xs font-bold text-slate-600 leading-tight mt-1",children:t.label})]},t.key)})}),Me&&e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-2 space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ws,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-slate-400"}),e.jsx("input",{value:Ke,onChange:t=>es(t.target.value),placeholder:"××פ×ש × ××¢× ×רש×××...",className:"w-full h-9 rounded-lg border border-slate-200 bg-slate-50 pr-8 pl-3 text-sm focus:outline-none focus:ring-2 focus:ring-cyan-100 focus:bg-white"})]}),e.jsxs("p",{className:"text-[0.6875rem] text-slate-400 px-1",children:[ft.length,' × ××¢× ×× ×"',Me.label,'"',Ke.trim()?" (×ס×× ×)":""]}),e.jsx("div",{className:"max-h-56 overflow-y-auto divide-y divide-slate-100",children:ft.length===0?e.jsx("p",{className:"text-xs text-slate-400 text-center py-4",children:"××× × ××¢× ×× ××צ××"}):ft.map(t=>e.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-1 text-sm",children:[e.jsx("span",{className:"flex-1 min-w-0 truncate font-medium text-slate-700",children:t.full_name||"××× ×©×"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[120px]",dir:"ltr",children:t.phone||t.email||""}),e.jsx("button",{onClick:()=>la(t),title:"××¡×¨× ×××××¢× ××",className:"text-slate-400 hover:text-red-500 flex-shrink-0",children:e.jsx(he,{className:"w-4 h-4"})})]},se(t)))})]})]}),Ys&&e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 p-3 text-xs text-amber-800 space-y-1",children:[D.includes("whatsapp")&&e.jsxs("p",{className:"flex items-start gap-1.5",children:[e.jsx(Cs,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"})," ×××צ×פ ×צ××¨×¤× ×ת××× × ×ר×ש×ת ××§×ש×ר×× ×××× (PDF, סר××× ××§×ש×ר) â ××ר××ת ×ת××× ×ת ת××¦× ×ער×צ×× ×××ר××."]}),D.some(t=>t!=="whatsapp")&&e.jsxs("p",{className:"flex items-start gap-1.5",children:[e.jsx(Ms,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),' ×ער××¦× ×תר / ×××"× / פ×ש ת××¦× ×× ××××× ×©×¦××¨×¤× (ת××× ×ת, PDF ×סר×××).']})]}),as?e.jsxs("button",{onClick:ia,disabled:Ut,className:"w-full h-12 rounded-xl bg-cyan-600 text-white text-sm font-bold hover:bg-cyan-700 disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center gap-2 shadow-sm",children:[Ut?e.jsx(pe,{className:"w-5 h-5 animate-spin"}):We?e.jsx(ds,{className:"w-5 h-5"}):e.jsx(Nt,{className:"w-5 h-5"}),We?"ת××× ×©××××":"ש××"," ×-",l.length," × ××¢× ××"]}):e.jsxs("p",{className:"text-xs text-center text-muted-foreground rounded-xl bg-slate-50 border border-slate-100 py-3",children:[l.length===0?"×××¨× × ××¢× ××, ":"",R.trim()?"":"××ס××¤× ×ª××× ",D.length===0?"××××¨× ×¢×¨××¥ ":"",ss?"":rl(I)===fe?"××¢× × ×ת ×סר××× â ת×× ×ת ×סר××× ×× × ×©××ת ×××¢××× ":"××¢× × ×ª××× × ×¨×ש×ת â ת×× ×ת ×ת××× × ×× × ×©××ת ×××¢××× ",ge?"":'×××¨× ×§×××ר×× ×××××¢× (××ש×× ×ת "ת×××") ',"××× ×ש×××"]})]})]}),e.jsx(tt,{open:Rs,onClose:()=>we(!1),title:"×××¨× ×§×××ר×× ×××××¢×",subtitle:"×× × ××ª× ×ש××× ××××¢× ××× ×§×××ר××",icon:yt,tone:"amber",maxWidth:"max-w-lg",bodyClassName:"p-5",footer
17:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>we(!1),className:"h-10 px-5 rounded-full border border-border text-sm font-medium hover:bg-slate-50",children:"ס××ר×"}),e.jsxs("button",{type:"button",onClick:ra,className:"h-10 px-5 rounded-full bg-amber-600 text-white text-sm font-bold hover:bg-amber-700 inline-flex items-center gap-1.5",children:[e.jsx(yt,{className:"w-4 h-4"})," ×××רת ×§×××ר××"]})]}),children:e.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed",children:["××§×××ר×× × ××רת ××ש×× ×ת ",e.jsx("strong",{children:"ת×××"}),", ×××× ×× ×©××פשר ×××× ×××××¢×ת ×××ר ××ר ×× ×× × ×©×× ××§××××. ×××¢××× ×פת×ר ×ש×××× × ×©×ר ××ש×ת."]})}),Gt&&e.jsx(Cl,{chars:Gt.chars,limit:Xe,onShorten:ta,onApply:sa,onEditMyself:()=>{var t;Oe(null),Be("content"),(t=nt.current)==null||t.focus()},onClose:()=>Oe(null)}),le&&e.jsx(Sl,{media:le.media,mode:le.mode,kind:I,value:{files:q,images:ee,image:U,videoFile:Y,url:le.media===fe?W:Z},onChange:t=>{t.files!==q&&Ne(t.files||[]),t.images!==ee&&ye(t.images||[]),t.image!==U&&ce(t.image||""),t.videoFile!==Y&&De(t.videoFile||null),t.url!==void 0&&(le.media===fe?n(t.url||""):le.media===Qe&&ie(t.url||""))},onClose:()=>Ee(null)}),zs&&e.jsx(Ua,{kibbutzId:o,onClose:()=>lt(!1)}),Ue&&e.jsx(Ml,{group:Ue,members:de,residents:f,isSelected:ne.includes(Ue.id),onAddGroup:()=>{Wt(Ue.id)},onClose:()=>Ts(null)})]})}function An(){return e.jsx(Ra,{moduleKey:"send_message",children:e.jsx(Fl,{})})}
17export{An 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.