function e(e){let n=[];if(e.network!=null&&n.push({kind:`network`}),e.fileSystem==null)return n;let r=new Set,i=new Set;if(e.fileSystem.entries!=null)for(let n of e.fileSystem.entries){let e=t(n.path);switch(n.access){case`read`:r.add(e);break;case`write`:i.add(e);break;case`deny`:break}}else{if(e.fileSystem.read!=null)for(let t of e.fileSystem.read)r.add(t);if(e.fileSystem.write!=null)for(let t of e.fileSystem.write)i.add(t)}let a=Array.from(r),o=Array.from(i),s=a.filter(e=>i.has(e)),c=a.filter(e=>!i.has(e)),l=o.filter(e=>!r.has(e));return s.length>0&&n.push({kind:`fileSystem`,access:`readWrite`,paths:s}),c.length>0&&n.push({kind:`fileSystem`,access:`read`,paths:c}),l.length>0&&n.push({kind:`fileSystem`,access:`write`,paths:l}),n}function t(e){switch(e.type){case`path`:return e.path;case`glob_pattern`:return e.pattern;case`special`:return n(e.value)}}function n(e){switch(e.kind){case`root`:return`/`;case`minimal`:return`:minimal`;case`project_roots`:return e.subpath==null?`:project_roots`:`:project_roots/${e.subpath}`;case`tmpdir`:return`:tmpdir`;case`slash_tmp`:return`/tmp`;case`unknown`:return e.subpath==null?e.path:`${e.path}/${e.subpath}`}}export{e as t};
//# sourceMappingURL=permission-request-model-AOGwElJp.js.map