1import{j as s,r as x}from"./vendor-three-BGGFfWe7.js";import{_ as E,bl as L,bN as P,dq as W,ae as $,gu as F,el as k}from"./index-zO3nSPIa.js";function B({open:c,onClose:v,profileApi:f,title:p="Configurar visualização"}){const{profile:n,orderedColumns:u,toggleColumn:j,moveColumn:g,setColumnLabel:m,setColumnWidth:d,clearColumnFilters:a,reset:h,setDensity:y}=f,b=new Set(n.visibleColumns||[]),w=Object.values(n.filters||{}).filter(Boolean).length;return s.jsx(E,{open:c,onClose:v,title:p,maxWidth:"680px",children:s.jsxs("div",{className:"space-y-4 p-1",children:[s.jsx("section",{className:"rounded-govbr-md border border-govbr-outline/40 bg-govbr-surface p-4",children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-semibold text-govbr-on-surface",children:"Exibição"}),s.jsx("p",{className:"mt-1 text-[11px] text-govbr-on-surface/60",children:"Preferências visuais desta coleção."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:n.density||"comfortable",onChange:r=>y(r.target.value),className:"h-9 rounded-govbr-md border border-govbr-outline/40 bg-govbr-surface px-2 text-xs text-govbr-on-surface",children:[s.jsx("option",{value:"compact",children:"Compacta"}),s.jsx("option",{value:"comfortable",children:"Confortável"})]}),w>0&&s.jsxs("button",{type:"button",onClick:a,className:"h-9 rounded-govbr-md border border-govbr-outline/40 bg-govbr-surface px-2.5 text-[11px] text-govbr-on-surface/60",children:["Limpar filtros (",w,")"]})]})]})}),s.jsxs("section",{className:"rounded-govbr-md border border-govbr-outline/40 bg-govbr-surface p-4",children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-semibold text-govbr-on-surface",children:"Colunas"}),s.jsx("p",{className:"mt-1 text-[11px] text-govbr-on-surface/60",children:"Escolha o que aparece, a ordem, o rótulo visual e a largura. O campo original permanece inalterado."})]}),s.jsxs("button",{type:"button",onClick:h,className:"inline-flex h-8 items-center gap-1 rounded-govbr-md border border-govbr-outline/40 bg-govbr-surface px-2 text-[11px] text-govbr-on-surface/60",children:[s.jsx(L,{className:"h-3.5 w-3.5"}),"Restaurar"]})]}),s.jsx("div",{className:"space-y-2",children:u.map((r,O)=>{var M,S;return s.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto] items-start gap-2 rounded-govbr-md bg-govbr-surface-muted p-2.5",children:[s.jsx("button",{type:"button","aria-label":b.has(r.id)?`Ocultar ${r.label}`:`Exibir ${r.label}`,title:b.has(r.id)?`Ocultar ${r.label}`:`Exibir ${r.label}`,onClick:()=>j(r.id),className:"mt-5 flex h-8 w-8 items-center justify-center rounded-govbr-md border border-govbr-outline/40 bg-govbr-surface",children:b.has(r.id)?s.jsx(P,{className:"h-3.5 w-3.5"}):s.jsx(W,{className:"h-3.5 w-3.5 text-govbr-on-surface/40"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-govbr-on-surface/60",children:r.label}),s.jsxs("div",{className:"mt-1 grid gap-2 sm:grid-cols-[1fr_110px]",children:[s.jsx($,{value:((M=n.columnLabelOverrides)==null?void 0:M[r.id])||"",onChange:C=>m(r.id,C.target.value),placeholder:"Rótulo personalizado",className:"h-8 text-xs"}),s.jsx($,{type:"number",min:"80",max:"560",value:((S=n.columnWidths)==null?void 0:S[r.id])||"",onChange:C=>d(r.id,C.target.value),placeholder:"Largura",className:"h-8 text-xs"})]})]}),s.jsxs("div",{className:"mt-5 flex gap-1",children:[s.jsx("button",{type:"button",disabled:O===0,onClick:()=>g(r.id,-1),"aria-label":`Mover ${r.label} para cima`,title:`Mover ${r.label} para cima`,className:"flex h-8 w-8 items-center justify-center rounded-govbr-md border border-govbr-outline/40 bg-govbr-surface disabled:opacity-30",children:s.jsx(F,{className:"h-3.5 w-3.5"})}),s.jsx("button",{type:"button",disabled:O===u.length-1,onClick:()=>g(r.id,1),"aria-label":`Mover ${r.label} para baixo`,title:`Mover ${r.label} para baixo`,className:"flex h-8 w-8 items-center justify-center rounded-govbr-md border border-govbr
1-outline/40 bg-govbr-surface disabled:opacity-30",children:s.jsx(k,{className:"h-3.5 w-3.5"})})]})]},r.id)})})]})]})})}function I(c){try{return c?JSON.parse(c):null}catch{return null}}function R(c,v="main",f="self"){return`hmadv.view.${f}.${c}.${v}.v1`}function J({moduleId:c,surfaceId:v="main",actorId:f="self",defaultViewMode:p="list",allowedViewModes:n=["list"],columns:u=[],defaultDensity:j="comfortable"}){const g=x.useMemo(()=>R(c,v,f),[c,v,f]),m=x.useMemo(()=>({viewMode:n.includes(p)?p:n[0],visibleColumns:u.filter(e=>e.defaultVisible!==!1).map(e=>e.id),columnOrder:u.map(e=>e.id),columnWidths:{},columnLabelOverrides:{},density:j,sort:null,filters:{},savedViewId:null}),[n,u,j,p]),[d,a]=x.useState(()=>{var t,o;if(typeof window>"u")return m;const e=I((o=(t=window.localStorage)==null?void 0:t.getItem)==null?void 0:o.call(t,g));return{...m,...e&&typeof e=="object"?e:{}}});x.useEffect(()=>{a(e=>({...m,...e}))},[m]),x.useEffect(()=>{var e,t;try{(t=(e=window.localStorage)==null?void 0:e.setItem)==null||t.call(e,g,JSON.stringify(d))}catch{}},[g,d]);const h=x.useMemo(()=>{const e=new Map(u.map(t=>[t.id,t]));return(d.columnOrder||[]).map(t=>e.get(t)).filter(Boolean).concat(u.filter(t=>!(d.columnOrder||[]).includes(t.id)))},[u,d.columnOrder]),y=x.useMemo(()=>{const e=new Set(d.visibleColumns||[]);return h.filter(t=>e.has(t.id))},[h,d.visibleColumns]),b=e=>a(t=>({...t,...e}));return{profile:d,setProfile:a,patch:b,setViewMode:e=>n.includes(e)&&b({viewMode:e}),setDensity:e=>b({density:e}),toggleColumn:e=>a(t=>{const o=new Set(t.visibleColumns||[]);return o.has(e)?o.delete(e):o.add(e),{...t,visibleColumns:[...o]}}),moveColumn:(e,t)=>a(o=>{const l=[...o.columnOrder||[]],i=l.indexOf(e),N=i+t;return i<0||N<0||N>=l.length?o:([l[i],l[N]]=[l[N],l[i]],{...o,columnOrder:l})}),setColumnLabel:(e,t)=>
1a(o=>({...o,columnLabelOverrides:{...o.columnLabelOverrides||{},[e]:String(t||"").trim()}})),setColumnWidth:(e,t)=>a(o=>{const l=Number(t),i={...o.columnWidths||{}};return!Number.isFinite(l)||l<=0?delete i[e]:i[e]=Math.max(80,Math.min(560,Math.round(l))),{...o,columnWidths:i}}),setColumnFilter:(e,t)=>a(o=>{const l={...o.filters||{}},i=String(t||"").trim();return i?l[e]=i:delete l[e],{...o,filters:l}}),clearColumnFilters:()=>b({filters:{}}),reset:()=>a(m),orderedColumns:h,visibleColumns:y}}export{B as M,J as u};
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.