var e=require("child_process")
var r=require("os")
var i=require("path")
var o=require("./darwinMainBundleIdHack")
const n=(0,i.join)(__dirname,"ColorPicker")
const s=Number((0,r.release)().split(".")[0])<19
exports.DARWIN_IS_PLATFORM_PRE_CATALINA=s
const t=()=>new Promise((r,i)=>(0,e.execFile)(n,(e,o,n)=>{if(e)return i(e)
r({possibleColorString:o})}))
exports.darwinRunColorPicker=t
const a=s?()=>Promise.resolve(!0):()=>new Promise((r,i)=>(0,e.execFile)(n,["--mode=1"],(e,o,n)=>{if(e)return i(e)
const s=o.includes("Permission Granted: YES")
r(s)}))
exports.darwinGetScreenPermissionGranted=a
let c
const d=s?()=>Promise.resolve():async()=>{void 0===c&&(c=await(0,o.getDarwinMainBundleIdHackAsync)())
await new Promise((r,i)=>(0,e.execFile)(n,["--mode=2",`--bundle-id=${c}`],(e,o,n)=>{if(e)return i(e)
r()}))}
exports.darwinRequestScreenPermissionPopup=d
const u=s?t:async()=>{if(!1===await a()){await d()
return{possibleColorString:""}}return t()}
exports.runColorPicker=u
