import{i as e,t}from"./react-B8IZ02wI.js";import{t as n}from"./button-DqbiydrF.js";import{P as r,d as i}from"./authStore-BvQBJ9ky.js";import{ct as a,gt as o,n as s}from"./index-Bg7bo8aA.js";import{i as c,t as l}from"./fieldAccess-Ce4C729w.js";var u=e(t(),1);async function d(e,t,n){return(await i.revealField(e,t,n)).data.value}function f(e){return r(e,`查看失败`)}var p=s();function m({entity:e,resourceId:t,fieldKey:r,label:i,value:s,access:m,fallbackVisible:h=!1,format:g}){let[_,v]=(0,u.useState)(null),[y,b]=(0,u.useState)(!1);if(!c(m,h))return null;let x=s==null||s===``?null:g?g(s):String(s);if(!x&&!_)return(0,p.jsx)(p.Fragment,{children:`-`});let S=l(m)&&!_,C=async()=>{b(!0);try{v(await d(e,t,r)),a.success(`已显示敏感信息，请注意保密`)}catch(e){a.error(f(e))}finally{b(!1)}};return(0,p.jsxs)(o,{children:[(0,p.jsx)(`span`,{children:_||x}),S&&(0,p.jsx)(n,{type:`link`,size:`small`,loading:y,onClick:()=>void C(),children:`查看`})]})}export{f as n,d as r,m as t};