//! Core JavaScript bridge for permission-gated browser APIs.

pub(super) const SOURCE: &str = "let nav=navigator;nav.permissions={query:function(d){let n='';if(d&&d.name){n=d.name;}let st=__states[n];if(!st){st='prompt';}let o={};o.then=function(cb){if(cb){cb({state:st,name:n});}return o;};o.catch=function(){return o;};return o;}};nav.geolocation={getCurrentPosition:function(ok,bad){let st=__states['geolocation'];if(!st){st='prompt';}if(st!='granted'){if(bad){bad({code:1,message:'geolocation permission denied'});}return;}if(__geo.kind=='position'){if(ok){ok({coords:__geo.coords,timestamp:__geo.timestamp});}}else if(bad){bad({code:__geo.code,message:__geo.message});}}};nav.clipboard={readText:function(){if(__states['clipboard-read']!='granted'){let o={};o.then=function(){return o;};o.catch=function(cb){if(cb){cb({name:'NotAllowedError',message:'clipboard-read denied'});}return o;};return o;}let t=window.__agentClipboardText;if(t==undefined){t='';}let o={};o.then=function(cb){if(cb){cb(t);}return o;};o.catch=function(){return o;};return o;},writeText:function(v){if(__states['clipboard-write']!='granted'){let o={};o.then=function(){return o;};o.catch=function(cb){if(cb){cb({name:'NotAllowedError',message:'clipboard-write denied'});}return o;};return o;}window.__agentClipboardText=''+v;let o={};o.then=function(cb){if(cb){cb(undefined);}return o;};o.catch=function(){return o;};return o;}};nav.mediaDevices={getUserMedia:function(c){let v=c&&c.video;let a=c&&c.audio;if(v&&__states['camera']!='granted'){let o={};o.then=function(){return o;};o.catch=function(cb){if(cb){cb({name:'NotAllowedError',message:'camera denied'});}return o;};return o;}if(a&&__states['microphone']!='granted'){let o={};o.then=function(){return o;};o.catch=function(cb){if(cb){cb({name:'NotAllowedError',message:'microphone denied'});}return o;};return o;}let out=c;if(out==undefined){out={};}let o={};o.then=function(cb){if(cb){cb({active:true,constraints:out});}return o;};o.catch=function(){return o;};return o;}};";
