var l=Object.defineProperty;var o=(e,s,r)=>s in e?l(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var n=(e,s,r)=>o(e,typeof s!="symbol"?s+"":s,r);import{l as u,m as p,b as m}from"./vue.esm-bundler.js?ver=1.5.3";import{A as y}from"./Arr.js?ver=1.5.3";class A{constructor(){n(this,"allPermissions",[]);this.allPermissions=y.get(window,"fluentCartAdminApp.app_config.permissions",[])}isSuperAdmin(){return this.allPermissions.includes("is_super_admin")}has(s){return this.isSuperAdmin()?!0:this.allPermissions.includes(s)}hasAny(s){return this.isSuperAdmin()?!0:Array.isArray(s)&&s.some(r=>this.allPermissions.includes(r))}hasAll(s){return this.isSuperAdmin()?!0:Array.isArray(s)&&s.every(r=>this.allPermissions.includes(r))}resolve({permission:s,permissionType:r}){const i=r==="all"?"all":"any",t=Array.isArray(s)?s:typeof s=="string"?s.split(",").map(a=>a.trim()):[];return i==="all"?this.hasAll(t):this.hasAny(t)}}const c=new A,_={__name:"UserCan",props:{permission:{type:[String,Array],required:!0},permissionType:{type:String,default:"any"}},setup(e){const s=e,r=u(()=>c.resolve({permission:s.permission,permissionType:s.permissionType}));return(i,t)=>r.value?p(i.$slots,"default",{key:0}):m("",!0)}};export{_,c as p};
