1import{r,d as p,z as P,j as e,w as F,y as R,at as z,b as L,aC as B,Z as K,aP as Y,aH as q,af as H}from"./index-BH8Hq4fF.js";import{A as w,i as k,a as D,M as Q,b as _,r as U}from"./useActionVisibility-oACH4aDh.js";import{P as X}from"./pencil-DlA_FTEn.js";import{E as Z}from"./eye-off-B4MzD2pP.js";const C="bg-white rounded-2xl border border-slate-200 shadow-sm";function G({on:a,onChange:d,disabled:g,labelOn:m="ס×פר־××××× ××××",labelOff:j="×××× ××× ×× ×§××××"}){return e.jsx("button",{type:"button",role:"switch","aria-checked":a,"aria-label":a?m:j,disabled:g,onClick:()=>d(!a),className:`relative inline-flex items-center h-7 w-12 rounded-full transition-colors flex-shrink-0 disabled:opacity-40 ${a?"bg-amber-500":"bg-slate-200"}`,children:e.jsx("span",{className:`absolute w-5 h-5 rounded-full bg-white shadow transition-all ${a?"right-6":"right-1"}`})})}function se(){const[a,d]=r.useState({}),[g,m]=r.useState(!0),[j,S]=r.useState(""),[A,M]=r.useState(""),[o,T]=r.useState("all"),[I,x]=r.useState(""),[y,O]=r.useState("");r.useEffect(()=>{E()},[]);async function E(){m(!0);try{const s=await p.entities.PlatformActionVisibility.list("action_key",500),t={};for(const l of s||[])l!=null&&l.action_key&&(t[l.action_key]=l);d(t)}catch(s){console.error(s),P.error("ש×××× ×××¢×× ×ª ××רש××ת")}finally{m(!1)}}async function u(s,t){const l=a[s],i=t.super_admin_only!==void 0?t.super_admin_only:(l==null?void 0:l.super_admin_only)??null,c=t.label_override!==void 0?t.label_override:(l==null?void 0:l.label_override)??null,b=i===null&&!c;S(s);try{if(b)l&&await p.entities.PlatformActionVisibility.delete(s),d(n=>{const f={...n};return delete f[s],f});else{const n={action_key:s,super_admin_only:i,label_override:c||null,updated_at:new Date().toISOString()};l?await p.entities.PlatformActionVisibility.update(s,n):await p.entities.PlatformActionVisibility.create(n),d(f=>({...f,[s]:n}))}U()}catch(n){console.error(n),P.error(String((n==null?void 0:n.message)||"ש×××× ×ש××ר×").slice(0,140)),E()}finally{S("")}}const h=r.useMemo(()=>{const s=w.filter(t=>k(t.key,a));return{total:w.length,hidden:s.length,planned:w.filter(t=>t.planned).length,changed:Object.keys(a).filter(t=>D[t]).length}},[a]),N=r.useMemo(()=>Object.keys(a).filter(s=>!D[s]),[a]),v=A.trim(),$=r.useMemo(()=>Q.map(s=>{const t=s.actions.filter(l=>{const i=k(l.key,a);return o==="hidden"&&!i||o==="visible"&&i||o==="planned"&&!l.planned||o==="changed"&&!a[l.key]?!1:v?[_(l.key,a,l.label),l.label,l.within,l.note,s.label,l.key].some(c=>String(c||"").includes(v)):!0});return{...s,actions:t}}).filter(s=>s.actions.length),[a,o,v]),V=$.reduce((s,t)=>s+t.actions.length,0);return e.jsxs("div",{dir:"rtl",className:"max-w-5xl mx-auto px-4 py-6 space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"w-12 h-12 rounded-2xl bg-amber-50 flex items-center justify-center flex-shrink-0",children:e.jsx(F,{className:"w-6 h-6 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-extrabold text-slate-900",children:"×רש××ת פע×××ת"}),e.jsxs("p",{className:"text-sm text-slate-500 mt-0.5 leading-relaxed max-w-2xl",children:['×× ×¤×¢××× ×תפר×× "פע×××ת × ×ספ×ת" ×××××× ×ת ×××××¨× ×©× ×¤×ª××× ××× ×. פע××× ×ס××× ×ª ××סתרת ××× ××× ××§×××× ',e.jsx("b",{children:"××× ××§××××ת"}),", ×× ×ס×ת ×× ××¦× ×שרת. ×פשר ×× ××©× ×ת ×ת ×××תרת ש××צ×ת ××ס×."]})]})]}),e.jsxs("div",{className:`${C} p-4`,children:[e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[{label:"פע×××ת ××¡× ×××",value:h.total,tone:"text-slate-800"},{label:"××סתר×ת ××× ×× ×§××××",value:h.hidden,tone:"text-amber-600"},{label:"×ת××× × ×ת (××¨× × ×× ×)",value:h.planned,tone:"text-blue-600"},{label:"ש×× ×ת ××× ×ת",value:h.changed,tone:"text-emerald-600"}].map(s=>e.jsxs("div",{className:"rounded-xl bg-slate-50 px-3 py-2.5",children:[e.jsx("p",{className:`text-2xl font-extrabold tabular-nums ${s.tone}`,children:s.value}),e.jsx("p",{className:"text-[0.6875rem] text-slate-500 mt-0.5",children:s.label})]},s.label))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(R,{className:"w-4 h-4 text-slate-400 absolute right-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{value:A,onChange:s=>M(s.target.value),placeholder:"××פ×ש פע××× ×× ×××××â¦",className:"w-full h-10 pr-9 pl-3 rounded-xl border border-slate-200 text-sm focus:outline-none focus:ring-2 focus:ring-amber-200"})]}),[["all","×××"],["hidden","××סתר×ת"],["visible","×××××ת"],["planned","×ת××× × ×ת"],["changed","ש×× ×ת"]].map(([s,t])=>e.jsx("button",{onClick:()=>T(s),className:`h-10 px-3.5 rounded-xl text-sm font-bold border transition-colors ${o===s?"bg-slate-800 text-white border-slate-800":"bg-white text-slate-600 border-slate-200 hover:bg-slate-50"}`,children:t},s))]})]}),N.length>0&&e.jsxs("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 p-4",children:[e.jsxs("p",{className:"text-sm font-bold text-amber-900 flex items-center gap-1.5",children:[e.jsx(z,{className:"w-4 h-4"})," ",N.length," ס×××× ×× ××× ×¤×¢××× ×ת××××"]}),e.jsxs("p",{className:"text-[0.75rem] text-amber-800 mt-1 leading-relaxed",children:["×פע×××ת ×××× ××ר ×× ×§××××ת ××§×× â ×× ×¨×× ×©×× × ×©××. ×ס×××× ×¢×××× ×× ×שפ××¢ ×¢× ××××, ××ש××¢×ת ×××ר ש×פע××× ×¢×¦×× ×××¨× ××××ת ×××××: ",e.jsx("b",{dir:"ltr",children:N.join(", ")})]})]}),g?e.jsx("div",{className:"flex items-center justify-center py-20 text-slate-400",children:e.jsx(L,{className:"w-6 h-6 animate-spin"})}):V===0?e.jsx("div",{className:`${C} py-16 text-center text-slate-400 text-sm`,children:"×× × ×צ×× ×¤×¢×××ת ×ת××××ת"}):$.map(s=>e.jsxs("div",{className:C,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-b border-slate-100",children:[e.jsx("h2",{className:"text-base font-extrabold text-slate-800",children:s.label}),e.jsxs("span",{className:"text-[0.6875rem] text-slate-400 tabular-nums",children:[s.actions.length," פע×××ת"]})]}),e.jsx("ul",{className:"divide-y divide-slate-50",children:s.actions.map(t=>{const l=a[t.key],i=k(t.key,a),c=!!(l!=null&&l.label_override),b=j===t.key;return e.jsxs("li",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx(G,{on:i,disabled:b,onChange:n=>u(t.key,{super_admin_only:n})}),e.jsx("div",{className:"flex-1 min-w-0",children:I===t.key?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{autoFocus:!0,value:y,onChange:n=>O(n.target.value),onKeyDown:n=>{n.key==="Enter"&&(u(t.key,{label_override:y.trim()||null}),x("")),n.key==="Escape"&&x("")},className:"flex-1 h-9 px-2.5 rounded-lg border border-slate-300 text-sm focus:outline-none focus:ring-2 focus:ring-amber-200"}),e.jsx("button",{type:"button","aria-label":"ש××ר×",onClick:()=>{u(t.key,{label_override:y.trim()||null}),x("")},className:"w-9 h-9 rounded-lg bg-emerald-600 text-white flex items-center justify-center hover:bg-emerald-700",children:e.jsx(B,{className:"w-4 h-4"})}),e.jsx("button",{type:"button","aria-label":"×××××",onClick:()=>x(""),className:"w-9 h-9 rounded-lg border border-slate-200 text-slate-500 flex items-center justify-center hover:bg-slate-50",children:e.jsx(K,{className:"w-4 h-4"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-sm font-bold text-slate-800",children:_(t.key,a,t.label)}),e.jsx("button",{type:"button","aria-label":"ש×× ×× ××תרת",onClick:()=>{O(_(t.key,a,t.label)),x(t.key)},className:"text-slate-300 hover:text-slate-600",children:e.jsx(X,{className:"w-3.5 h-3.5"})}),c&&e.jsxs("button",{type:"button",onClick:()=>u(t.key,{label_override:null}),title:`×××תרת ×××§×ר×ת: ${t.label}`,className:"inline-flex items-center gap-1 text-[0.625rem] font-bold px-1.5 py-0.5 rounded-full bg-emerald-50 text-emerald-700 hover:bg-emerald-100",children:[e.jsx(Y,{className:"w-2.5 h-2.5"})," ש×× ×ª×"]}),t.planned&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[0.625rem] font-bold px-1.5 py-0.5 rounded-full bg-blue-50 text-blue-700",children:[e.jsx(q,{className:"w-2.5 h-2.5"})," ×ת××× ×"]})]}),e.jsxs("p",{className:"text-[0.6875rem] text-slate-400 mt-0.5",children:[t.within?e.jsxs(e.Fragment,{children:['××××× "',t.within,'"']}):"×תפר×× ×פע×××ת",t.note?` · ${t.note}`:"",t.sa&&!l?" · ×ר×רת ××××: ××סתר":""]})]})}),e.jsxs("span",{className:`hidden sm:inline-flex items-center gap-1 text-[0.6875rem] font-bold px-2 py-1 rounded-full flex-shrink-0 ${i?"bg-amber-50 text-amber-700":"bg-slate-50 text-slate-500"}`,children:[b?e.jsx(L,{className:"w-3 h-3 animate-spin"}):i?e.jsx(Z,{className:"w-3 h-3"}):e.jsx(H,{className:"w-3 h-3"}),i?"ס×פר־×××××":"××××"]})]},t.key)})})]},s.id))]})}export{se 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.