Files
securebit-chat/dist/app-boot.js
T

130 lines
588 KiB
JavaScript
Raw Normal View History

2026-09-04 17:38:41 -04:00
var en=Object.create;var fi=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var sn=Object.getPrototypeOf,nn=Object.prototype.hasOwnProperty;var pi=(n,e)=>()=>{try{return e||n((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var an=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rn(e))!nn.call(n,i)&&i!==t&&fi(n,i,{get:()=>e[i],enumerable:!(r=tn(e,i))||r.enumerable});return n};var yi=(n,e,t)=>(t=n!=null?en(sn(n)):{},an(e||!n||!n.__esModule?fi(t,"default",{value:n,enumerable:!0}):t,n));var Cs=pi((xo,qt)=>{var wt=class{constructor(e={}){this.permission=typeof Notification<"u"&&Notification&&typeof Notification.permission=="string"?Notification.permission:"denied",this.isTabActive=this.checkTabActive(),this.unreadCount=0,this.originalTitle=document.title,this.notificationQueue=[],this.maxQueueSize=e.maxQueueSize||5,this.rateLimitMs=e.rateLimitMs||2e3,this.lastNotificationTime=0,this.trustedOrigins=e.trustedOrigins||[],this.isSecureContext=window.isSecureContext,this.hidden=this.getHiddenProperty(),this.visibilityChange=this.getVisibilityChangeEvent(),this.initVisibilityTracking(),this.initSecurityChecks()}initSecurityChecks(){}getHiddenProperty(){return typeof document.hidden<"u"?"hidden":typeof document.msHidden<"u"?"msHidden":typeof document.webkitHidden<"u"?"webkitHidden":"hidden"}getVisibilityChangeEvent(){return typeof document.hidden<"u"?"visibilitychange":typeof document.msHidden<"u"?"msvisibilitychange":typeof document.webkitHidden<"u"?"webkitvisibilitychange":"visibilitychange"}checkTabActive(){return this.hidden&&typeof document[this.hidden]<"u"?!document[this.hidden]:typeof document.hasFocus=="function"?document.hasFocus():!0}initVisibilityTracking(){typeof document.addEventListener<"u"&&typeof document[this.hidden]<"u"&&document.addEventListener(this.visibilityChange,()=>{this.isTabActive=this.checkTabActive(),this.isTabActive&&(this.resetUnreadCount(),this.clearNotificationQueue())}),window.addEventListener("focus",()=>{this.isTabActive=this.checkTabActive(),this.isTabActive&&this.resetUnreadCount()}),window.addEventListener("blur",()=>{this.isTabActive=this.checkTabActive()}),window.addEventListener("beforeunload",()=>{this.clearNotificationQueue()})}async requestPermission(){if(!this.isSecureContext||!("Notification"in window))return!1;if(this.permission==="granted")return!0;if(this.permission==="denied")return!1;try{return this.permission=await Notification.requestPermission(),this.permission==="granted"}catch{return!1}}updateTitle(){this.unreadCount>0?document.title=`(${this.unreadCount}) ${this.originalTitle}`:document.title=this.originalTitle}sanitizeText(e){if(typeof e!="string")return"";let t=document.createElement("div");return t.textContent=e,t.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").substring(0,500)}validateIconUrl(e){if(!e)return null;try{let t=new URL(e,window.location.origin);return t.protocol==="https:"||t.protocol==="data:"?this.trustedOrigins.length>0?this.trustedOrigins.some(i=>t.origin===i)?t.href:null:t.href:null}catch{return null}}checkRateLimit(){let e=Date.now();return e-this.lastNotificationTime<this.rateLimitMs?!1:(this.lastNotificationTime=e,!0)}notify(e,t,r={}){if(typeof Notification>"u"||(this.isTabActive=this.checkTabActive(),this.isTabActive)||this.permission!=="granted"||!this.checkRateLimit())return null;let i=this.sanitizeText(e||"Unknown"),s=this.sanitizeText(t||""),a=this.validateIconUrl(r.icon)||"/logo/icon-192x192.png";this.notificationQueue.length>=this.maxQueueSize&&this.clearNotificationQueue();try{let o=new Notification(`${i}`,{body:s.substring(0,200),icon:a,badge:a,tag:`chat-${r.senderId||"unknown"}`,requireInteraction:!1,silent:r.silent||!1,vibrate:navigator.vibrate?[200,100,200]:void 0,data:{senderId:this.sanitizeText(r.senderId),timestamp:Date.now()}});this.unreadCount++,this.updateTitle(),this.notificationQueue.push(o),o.onclick=d=>{if(d.preventDefault(),window.focus(),o.close(),typeof r.onClick=="function")try{r.onClick(r.sende
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dn(n,e){return on(n)||cn(n,e)||un(n,e)||ln()}function un(n,e){if(n){if(typeof n=="string")return gi(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?gi(n,e):void 0}}var Ri=Object.entries,mi=Object.setPrototypeOf,hn=Object.isFrozen,fn=Object.getPrototypeOf,pn=Object.getOwnPropertyDescriptor,ne=Object.freeze,ae=Object.seal,rt=Object.create,Mi=typeof Reflect<"u"&&Reflect,_r=Mi.apply,br=Mi.construct;ne||(ne=function(e){return e});ae||(ae=function(e){return e});_r||(_r=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});br||(br=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});var ht=te(Array.prototype.forEach),yn=te(Array.prototype.lastIndexOf),Si=te(Array.prototype.pop),tt=te(Array.prototype.push),gn=te(Array.prototype.splice),Fe=Array.isArray,yt=te(String.prototype.toLowerCase),pr=te(String.prototype.toString),_i=te(String.prototype.match),ft=te(String.prototype.replace),bi=te(String.prototype.indexOf),mn=te(String.prototype.trim),Sn=te(Number.prototype.toString),_n=te(Boolean.prototype.toString),wi=typeof BigInt>"u"?null:te(BigInt.prototype.toString),Ei=typeof Symbol>"u"?null:te(Symbol.prototype.toString),he=te(Object.prototype.hasOwnProperty),pt=te(Object.prototype.toString),se=te(RegExp.prototype.test),$e=bn(TypeError);function te(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return _r(n,e,r)}}function bn(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return br(n,t)}}function V(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yt;if(mi&&mi(n,null),!Fe(e))return n;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){let s=t(i);s!==i&&(hn(e)||(e[r]=s),i=s)}n[i]=!0}return n}function wn(n){for(let e=0;e<n.length;e++)he(n,e)||(n[e]=null);return n}function ue(n){let e=rt(null);for(let r of Ri(n)){var t=dn(r,2);let i=t[0],s=t[1];he(n,i)&&(Fe(s)?e[i]=wn(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=ue(s):e[i]=s)}return e}function En(n){switch(typeof n){case"string":return n;case"number":return Sn(n);case"boolean":return _n(n);case"bigint":return wi?wi(n):"0";case"symbol":return Ei?Ei(n):"Symbol()";case"undefined":return pt(n);case"function":case"object":{if(n===null)return pt(n);let e=n,t=Ae(e,"toString");if(typeof t=="function"){let r=t(e);return typeof r=="string"?r:pt(r)}return pt(n)}default:return pt(n)}}function Ae(n,e){for(;n!==null;){let r=pn(n,e);if(r){if(r.get)return te(r.get);if(typeof r.value=="function")return te(r.value)}n=fn(n)}function t(){return null}return t}function vn(n){try{return se(n,""),!0}catch{return!1}}var vi=ne(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),yr=ne(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts",
`+ee),Le&&(ee=kt(ee)),b&&vt?M(ee):ee},e.setConfig=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dr(A),er=!0},e.clearConfig=function(){Ze=null,er=!1,b=x,C=""},e.isValidAttribute=function(A,l,y){Ze||dr({});let E=J(A),L=J(l);return di(E,L,y)},e.addHook=function(A,l){typeof l=="function"&&tt(R[A],l)},e.removeHook=function(A,l){if(l!==void 0){let y=yn(R[A],l);return y===-1?void 0:gn(R[A],y,1)[0]}return Si(R[A])},e.removeHooks=function(A){R[A]=[]},e.removeAllHooks=function(){R=Ii()},e}var Di=Li();var Rt=class n{static _keyMetadata=new WeakMap;static _messageSanitizer=null;static sortObjectKeys(e){if(typeof e!="object"||e===null)return e;if(Array.isArray(e))return e.map(n.sortObjectKeys);let t={};return Object.keys(e).sort().forEach(r=>{t[r]=n.sortObjectKeys(e[r])}),t}static assertCryptoKey(e,t=null,r=[]){if(!(e instanceof CryptoKey))throw new Error("Expected CryptoKey");if(t&&e.algorithm?.name!==t)throw new Error(`Expected algorithm ${t}, got ${e.algorithm?.name}`);for(let i of r)if(!e.usages||!e.usages.includes(i))throw new Error(`Missing required key usage: ${i}`)}static arrayBufferToBase64(e){let t="",r=new Uint8Array(e),i=r.byteLength;for(let s=0;s<i;s++)t+=String.fromCharCode(r[s]);return btoa(t)}static base64ToArrayBuffer(e){try{if(typeof e!="string"||!e)throw new Error("Invalid base64 input: must be a non-empty string");let t=e.trim();if(!/^[A-Za-z0-9+/]*={0,2}$/.test(t))throw new Error("Invalid base64 format");if(t==="")return new ArrayBuffer(0);let r=atob(t),i=r.length,s=new Uint8Array(i);for(let a=0;a<i;a++)s[a]=r.charCodeAt(a);return s.buffer}catch(t){throw console.error("Base64 to ArrayBuffer conversion failed:",t.message),new Error(`Base64 conversion error: ${t.message}`)}}static hexToUint8Array(e){try{if(!e||typeof e!="string")throw new Error("Invalid hex string input: must be a non-empty string");let t=e.replace(/:/g,"").replace(/\s/g,"");if(!/^[0-9a-fA-F]*$/.test(t))throw new Error("Invalid hex format: contains non-hex characters");if(t.length%2!==0)throw new Error("Invalid hex format: odd length");let r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i/2]=parseInt(t.substr(i,2),16);return r}catch(t){throw console.error("Hex to Uint8Array conversion failed:",t.message),new Error(`Hex conversion error: ${t.message}`)}}static zeroizeBuffer(e){try{if(!e)return;let t=e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null;if(!t||t.length===0)return;crypto.getRandomValues(t),t.fill(0)}catch{}}static async encryptData(e,t){try{let r=typeof e=="string"?e:JSON.stringify(e),i=crypto.getRandomValues(new Uint8Array(16)),s=new TextEncoder,a=s.encode(t),o=await crypto.subtle.importKey("raw",a,{name:"PBKDF2"},!1,["deriveKey"]),c=await crypto.subtle.deriveKey({name:"PBKDF2",salt:i,iterations:31e4,hash:"SHA-256"},o,{name:"AES-GCM",length:256},!1,["encrypt"]),d=crypto.getRandomValues(new Uint8Array(12)),u=s.encode(r),h=await crypto.subtle.encrypt({name:"AES-GCM",iv:d},c,u),m={version:"1.0",salt:Array.from(i),iv:Array.from(d),data:Array.from(new Uint8Array(h)),timestamp:Date.now()},p=JSON.stringify(m);return n.arrayBufferToBase64(new TextEncoder().encode(p).buffer)}catch(r){throw console.error("Encryption failed:",r.message),new Error(`Encryption error: ${r.message}`)}}static async decryptData(e,t){try{let r=n.base64ToArrayBuffer(e),i=new TextDecoder().decode(r),s=JSON.parse(i);if(!s.version||!s.salt||!s.iv||!s.data)throw new Error("Invalid encrypted data format");let a=new Uint8Array(s.salt),o=new Uint8Array(s.iv),c=new Uint8Array(s.data),u=new TextEncoder().encode(t),h=await crypto.subtle.importKey("raw",u,{name:"PBKDF2"},!1,["deriveKey"]),m=await crypto.subtle.deriveKey({name:"PBKDF2",salt:a,iterations:31e4,hash:"SHA-256"},h,{name:"AES-GCM",length:256},!1,["decrypt"]),p=await crypto.subtle.decrypt({name:"AES-GCM",iv:o},m,c),S=new TextDecoder().decode(p);try{return JSON.parse(S)}catch{return S}}catch(r){throw console.error("Decryption failed:",r.message),new Error(`Decryption error: ${r.message}`)}}static generateSecurePassword(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgh
Please wait for real-time cryptographic verification to complete.`,"sec.verificationUnavailable":"Security verification not available","chat.placeholder":"Type an encrypted message\u2026","chat.send":"Send message","chat.sendFiles":"Send files","chat.hideFiles":"Hide files","chat.recordVoice":"Record voice message","chat.sendVoice":"Send voice message","chat.discard":"Discard","chat.codeBlock":"Send as a code block (expands the input)","chat.codeHint":"Code snippet \xB7 formatting preserved \xB7 \u2318\u21B5 to send","chat.viewOnce":"View once","chat.viewOnceTitle":"View once - vanishes after the peer reads it","chat.viewOncePrefix":"View once \xB7 ","chat.viewOnceTap":"View once \xB7 tap to reveal","chat.viewedOnce":"Viewed once","chat.disappearing":"Disappearing message - deletes on both sides","chat.disappearAfter":"Disappear after","chat.visibleFor":"Visible for","chat.timerPrefix":"Timer \xB7 ","chat.expired":"This message has expired","chat.deleteForEveryone":"Delete for everyone","chat.sending":"Sending","chat.delivered":"Delivered","chat.notSent":"Not sent","chat.notSentReason":"Not sent - the secure channel is not ready. Reconnect to continue.","chat.encrypted":"Encrypted","chat.decrypted":"Decrypted","chat.encryptedOnDevice":"Encrypted on your device","chat.uploading":"Uploading","chat.downloading":"Downloading","chat.transferring":"Transferring\u2026","chat.copied":"Copied!","chat.collapse":"Collapse","chat.closeMenu":"Close menu","chat.newChat":"New chat","chat.newGroup":"New group","chat.createGroup":"Create a group","chat.groupChats":"Group chats","chat.secureChat":"Secure chat","chat.nameThis":"Name this chat","chat.rename":"Rename chat (local only)","chat.renameHint":"Double-click to rename","chat.localLabel":"Local label \xB7 stored only on this device","chat.setStatus":"Set your status","chat.yourStatusPrefix":"Your status - ","chat.meshHint":"Up to 8 peers \xB7 P2P mesh","chat.offline":"Offline","chat.noNetwork":"No network \xB7 reconnecting","chat.startVoiceCall":"Start encrypted voice call","chat.startVideoCall":"Start encrypted video call","chat.verifyForCalls":"Verify the session to enable calls","chat.e2eeNote":"Every message is end-to-end encrypted on your device before it leaves.","chat.peersOnly":"Sent end-to-end to connected peers only - never stored on a server.","flow.invitationCreated":"Secure invitation created","flow.invitationCreatedBang":"Secure invitation created and encrypted!","flow.responseCreated":"Secure response created","flow.responseCreatedBang":"Secure response created!","flow.sendInvitation":"Send the invitation code to your interlocutor via a secure channel (voice call, SMS, etc.).","flow.sendResponse":"Send the response code to the initiator via a secure channel or let them scan the QR code below.","flow.sendEncryptedCode":"Send the encrypted code","flow.sendTheResponse":"Send the response","flow.pasteOrWrite":"Paste or write code\u2026","flow.processingInvitation":"Processing the secure invitation...","flow.processingResponse":"Processing the secure response...","flow.finalizing":"Finalizing the secure connection...","flow.channelEstablished":"Secure channel established","flow.channelReady":"Secure channel is ready","flow.restoring":"Restoring connection\u2026","flow.invitationCaptured":"Invitation captured.","err.needInvitation":"You need to insert the invitation code from your interlocutor.","err.needResponse":"You need to insert the response code from your interlocutor.","err.responseFormat":"Invalid response format - please check the code","err.responseNoKey":"Invalid response code - missing or corrupted cryptographic key. Please check the code and try again.","err.responseNoSignKey":"Invalid response code - missing signature verification key. Please check the code and try again.","err.responseOutdated":"Response data is outdated - please use a fresh invitation","err.setupError":"Connection setup error","err.notReady":"Connection not ready","err.securityBreach":"Security breach detected - connection rejected","err.securityValidation":"Security validation failed - poss
`)!==-1?`\r
`:`
2026-09-04 17:38:41 -04:00
`}function Bi(n){let e=Xn(n),t=n.split(/\r\n|\n/),r=[],i=[],s=null;for(let a of t)a.startsWith("m=")?(s={lines:[a]},i.push(s)):s?s.lines.push(a):r.push(a);return{eol:e,session:r,media:i}}function Hi(n){let e=[...n.session];for(let t of n.media)e.push(...t.lines);return e.join(n.eol)}function $i(n){let e=n.lines[0].match(/^m=(\w+)/);return e?e[1]:null}function Qn(n,e){let t=new RegExp("^a=rtpmap:(\\d+)\\s+"+e+"\\/","i"),r=[];for(let i of n.lines){let s=i.match(t);s&&r.push(s[1])}return r}function Jn(n){let e=new Map;for(let t of n.split(";")){let r=t.trim();if(!r)continue;let i=r.indexOf("=");i===-1?e.set(r,void 0):e.set(r.slice(0,i).trim(),r.slice(i+1).trim())}return e}function Vi(n){let e=[];for(let[t,r]of n)e.push(r===void 0?t:`${t}=${r}`);return e.join(";")}function Zn(n,e,t){let r=n.lines.findIndex(o=>o.startsWith(`a=fmtp:${e} `)||o===`a=fmtp:${e}`);if(r!==-1){let o=n.lines[r].slice(`a=fmtp:${e} `.length),c=Jn(o);for(let[d,u]of Object.entries(t))c.set(d,String(u));n.lines[r]=`a=fmtp:${e} ${Vi(c)}`;return}let i=new Map;for(let[o,c]of Object.entries(t))i.set(o,String(c));let s=`a=fmtp:${e} ${Vi(i)}`,a=n.lines.findIndex(o=>o.startsWith(`a=rtpmap:${e} `));a!==-1?n.lines.splice(a+1,0,s):n.lines.push(s)}function vr(n,e){if(!n||typeof n!="string")return n;let t=Bi(n),r=!1;for(let i of t.media)if($i(i)==="audio")for(let s of Qn(i,"opus"))Zn(i,s,e),r=!0;return r?Hi(t):n}var ea=/^(rtx|red|ulpfec|flexfec-03|telephone-event|CN)$/i;function ta(n){let e=[];for(let t of n.lines){let r=t.match(/^a=rtpmap:(\d+)\s+([^/]+)\//);r&&!ea.test(r[2])&&e.push(r[1])}return e}function ra(n,e){for(let t of ta(n))for(let r of e){let i=`a=rtcp-fb:${t} ${r}`;if(n.lines.includes(i))continue;let s=-1;for(let a=0;a<n.lines.length;a++){let o=n.lines[a];(o.startsWith(`a=rtpmap:${t} `)||o.startsWith(`a=fmtp:${t} `)||o.startsWith(`a=rtcp-fb:${t} `))&&(s=a)}s===-1&&(s=n.lines.length-1),n.lines.splice(s+1,0,i)}}function ia(n,e){if(n.lines.some(i=>i.startsWith("a=extmap:")&&i.includes(e)))return;let t=0,r=-1;for(let i=0;i<n.lines.length;i++){let s=n.lines[i].match(/^a=extmap:(\d+)/);s&&(t=Math.max(t,Number(s[1])),r=i)}r===-1&&(r=n.lines.findIndex(i=>i.startsWith("a=mid:")),r===-1&&(r=n.lines.length-1)),n.lines.splice(r+1,0,`a=extmap:${t+1} ${e}`)}function Gi(n,e){if(!n||typeof n!="string"||!e)return n;let t=Bi(n),r=!1;for(let i of t.media){let s=$i(i),a=s==="video"?e.video:s==="audio"?e.audio:null;a&&(Array.isArray(a.rtcpFb)&&(ra(i,a.rtcpFb),r=!0),a.twcc&&e.twccUri&&(ia(i,e.twccUri),r=!0))}return r?Hi(t):n}function qi(n){try{if(Ue||!n||typeof n.setCodecPreferences!="function"||!nt.preferRed)return!1;let e=typeof RTCRtpSender<"u"&&RTCRtpSender.getCapabilities?RTCRtpSender.getCapabilities("audio"):null;if(!e||!Array.isArray(e.codecs))return!1;let t=o=>/red$/i.test(o.mimeType),r=o=>/opus$/i.test(o.mimeType);if(!e.codecs.some(t))return!1;let i=e.codecs.filter(t),s=e.codecs.filter(r),a=e.codecs.filter(o=>!t(o)&&!r(o));return n.setCodecPreferences([...i,...s,...a]),!0}catch{return!1}}async function ji(n,e={}){try{if(Ue||!n||typeof n.getParameters!="function")return!1;let t={...nt.sender,...e},r=n.getParameters();(!r.encodings||r.encodings.length===0)&&(r.encodings=[{}]);for(let i of r.encodings)i.maxBitrate=t.maxBitrate,i.priority=t.priority,i.networkPriority=t.networkPriority;return await n.setParameters(r),!0}catch{return!1}}var Wi={VP9:0,AV1:1,H264:2,VP8:3};function Yi(n){return(String(n||"").split("/")[1]||"").toUpperCase()}function sa(n){let e=t=>{let r=Yi(t.mimeType);return Object.prototype.hasOwnProperty.call(Wi,r)?Wi[r]:99};return n.map((t,r)=>({c:t,i:r})).sort((t,r)=>e(t.c)-e(r.c)||t.i-r.i).map(t=>t.c)}function Xi(n){if(!n||!Array.isArray(n.codecs))return null;let e=new Set(n.codecs.map(t=>Yi(t.mimeType)));for(let t of Re.codecPreferenceOrder)if(e.has(t))return t;return null}function Qi(){return typeof RTCRtpSender<"u"&&RTCRtpSender.getCapabilities?RTCRtpSender.getCapabilities("video"):null}function Ji(n){try{if(Ue||!n||typeof n.setCodecPreferences!="function")return!1;let e=Qi();return!e||!Array.isArray(e.codecs)?!1:(n.setCodecPreferences(sa(e.codecs)),
`)+`\r
2026-09-04 17:38:41 -04:00
`}}var Fr=new TextEncoder;function zt(...n){let e=n.reduce((i,s)=>i+s.length,0),t=new Uint8Array(e),r=0;for(let i of n)t.set(i,r),r+=i.length;return t}async function Kr(n,e){return(await n(zt(Fr.encode("sbq2/bind\0"),e))).slice(0,$.BINDING_BYTES)}async function Vt(n,e){return(await n(zt(Fr.encode("sbq2/blob\0"),e))).slice(0,$.COMMITMENT_BYTES)}function ys(n,e,t,r){let i=s=>{let a=new Uint8Array(4);return new DataView(a.buffer).setUint32(0,s.length),zt(a,s)};return zt(Fr.encode("sbq2/sas/v1\0"),i(n),i(e),i(t),i(r))}var mt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function va(n){let e="";for(let t=0;t<n.length;t+=3){let r=n[t],i=n[t+1],s=n[t+2];if(e+=mt[r>>2],e+=mt[(r&3)<<4|(i??0)>>4],i===void 0||(e+=mt[(i&15)<<2|(s??0)>>6],s===void 0))break;e+=mt[s&63]}return e}function Ta(n){typeof n!="string"&&F("payload must be a string");let e=n.replace(/\s+/g,"");e.length>Math.ceil($.MAX_PAYLOAD_BYTES*4/3)+4&&F("payload is too long"),/^[A-Za-z0-9_-]*$/.test(e)||F("payload contains characters outside base64url"),e.length%4===1&&F("payload has an impossible length");let t=new Uint8Array(Math.floor(e.length*3/4)),r=0,i=0,s=0;for(let a of e)i=i<<6|mt.indexOf(a),s+=6,s>=8&&(s-=8,t[r++]=i>>s&255);return i&(1<<s)-1&&F("payload has non-zero padding bits"),t.subarray(0,r)}var Ir="SB2:";function gs(n){return Ir+va(n)}function Nr(n){typeof n!="string"&&F("payload must be a string");let e=n.trim();return e.startsWith(Ir)||F("not an SB2 descriptor"),Ta(e.slice(Ir.length))}var ms=2,Ee=Object.freeze({OFFER:0,ANSWER:1}),We=Object.freeze({MAX_SPKI:256,MIN_SPKI:40,MAX_SIG:160,MIN_SIG:48,MAX_BLOB_BYTES:1024}),Or=class extends Error{constructor(e,t="key_exchange"){super(e),this.name="KeyExchangeError",this.code=t}},le=(n,e)=>{throw new Or(n,e)};function Ss({role:n,ecdhSpki:e,ecdsaSpki:t}){n!==Ee.OFFER&&n!==Ee.ANSWER&&le("invalid role");for(let[a,o]of[["ecdh",e],["ecdsa",t]])o instanceof Uint8Array||le(`${a} SPKI must be a Uint8Array`),(o.length<We.MIN_SPKI||o.length>We.MAX_SPKI)&&le(`${a} SPKI length out of range`);let r=new Uint8Array(4+e.length+2+t.length),i=new DataView(r.buffer),s=0;return r[s++]=ms,r[s++]=n,i.setUint16(s,e.length),s+=2,r.set(e,s),s+=e.length,i.setUint16(s,t.length),s+=2,r.set(t,s),r}function _s(n){n instanceof Uint8Array||le("key blob must be a Uint8Array"),n.length===0&&le("key blob is empty"),n.length>We.MAX_BLOB_BYTES&&le("key blob exceeds the size limit");let e=new DataView(n.buffer,n.byteOffset,n.byteLength),t=0,r=u=>{t+u>n.length&&le("key blob is truncated")};r(1);let i=n[t++];i!==ms&&le(`unsupported key blob version 0x${i.toString(16)}`,"version"),r(1);let s=n[t++];s!==Ee.OFFER&&s!==Ee.ANSWER&&le("reserved key blob role"),r(2);let a=e.getUint16(t);t+=2,(a<We.MIN_SPKI||a>We.MAX_SPKI)&&le("ECDH SPKI length out of range"),r(a);let o=n.slice(t,t+a);t+=a,r(2);let c=e.getUint16(t);t+=2,(c<We.MIN_SPKI||c>We.MAX_SPKI)&&le("ECDSA SPKI length out of range"),r(c);let d=n.slice(t,t+c);return t+=c,t!==n.length&&le(`${n.length-t} trailing byte(s) after the key blob`),{version:i,role:s,ecdhSpki:o,ecdsaSpki:d}}function bs({offerDescriptor:n,answerDescriptor:e,offerBlob:t,answerBlob:r}){for(let[i,s]of Object.entries({offerDescriptor:n,answerDescriptor:e,offerBlob:t,answerBlob:r}))(!(s instanceof Uint8Array)||s.length===0)&&le(`transcript component ${i} is missing`);return ys(n,e,t,r)}async function ws(n,e){let t=await n.digest("SHA-512",e);return Array.from(new Uint8Array(t))}var Es=new TextEncoder;function Ur(n){let e=Es.encode("sbq2/proof/v1\0"),t=new Uint8Array(e.length+n.length);return t.set(e,0),t.set(n,e.length),t}async function vs(n,{ecdhPrivateKey:e,peerEcdhPublicKey:t,transcript:r,digits:i=7}){let s=await n.deriveBits({name:"ECDH",public:t},e,256),a=null;try{a=await n.importKey("raw",s,"HKDF",!1,["deriveBits"]);let o=new Uint8Array(await n.digest("SHA-256",r)),c=await n.deriveBits({name:"HKDF",hash:"SHA-256",salt:o,info:Es.encode("sbq2-sas-v1")},a,64),d=new DataView(c),u=(d.getUint32(0)^d.getUint32(4))>>>0,h=10**i;return String(u%h).padStart(i,"0")}finally{try{new Uint8Array(s).fill(0)}catch{}}}async functi
self.onmessage = function(e) {
const { type, data } = e.data;
try {
switch (type) {
case 'cleanup_arrays':
// Simulate heavy array cleanup
let processed = 0;
for (let i = 0; i < data.count; i++) {
// Simulate work
processed++;
if (processed % 1000 === 0) {
// Yield control periodically
setTimeout(() => {}, 0);
}
}
self.postMessage({ success: true, processed });
break;
case 'cleanup_objects':
// Simulate object cleanup
const cleaned = data.objects.map(() => null);
self.postMessage({ success: true, cleaned: cleaned.length });
break;
default:
self.postMessage({ success: true, message: 'Unknown cleanup type' });
}
} catch (error) {
self.postMessage({ success: false, error: error.message });
}
};
2026-09-04 17:38:41 -04:00
`,s=new Blob([i],{type:"application/javascript"}),a=new Worker(URL.createObjectURL(s)),o=setTimeout(()=>{a.terminate(),r(new Error("Worker cleanup timeout"))},5e3);a.onmessage=c=>{clearTimeout(o),a.terminate(),URL.revokeObjectURL(s),c.data.success?t(c.data):r(new Error(c.data.error))},a.onerror=c=>{clearTimeout(o),a.terminate(),URL.revokeObjectURL(s),r(c)},a.postMessage(e)})}async _cleanupInMainThread(e){let{type:t,data:r}=e;switch(t){case"cleanup_arrays":let i=0,s=100;for(;i<r.count;){let d=Math.min(i+s,r.count);for(let u=i;u<d;u++);i=d,await this._asyncSleep(1)}return{success:!0,processed:i};case"cleanup_objects":let a=r.objects||[],o=[];for(let d=0;d<a.length;d+=50)o.push(a.slice(d,d+50));let c=0;for(let d of o)d.forEach(()=>c++),await this._asyncSleep(1);return{success:!0,cleaned:c};default:return{success:!0,message:"Unknown cleanup type"}}}_initializeMutexSystem(){this._keyOperationMutex={locked:!1,queue:[],lockId:null,lockTimeout:null,lockTime:null,operationCount:0},this._cryptoOperationMutex={locked:!1,queue:[],lockId:null,lockTimeout:null,lockTime:null,operationCount:0},this._connectionOperationMutex={locked:!1,queue:[],lockId:null,lockTimeout:null,lockTime:null,operationCount:0},this._keySystemState={isInitializing:!1,isRotating:!1,isDestroying:!1,lastOperation:null,lastOperationTime:Date.now(),operationId:null,concurrentOperations:0,maxConcurrentOperations:1},this._operationCounters={keyOperations:0,cryptoOperations:0,connectionOperations:0,totalOperations:0,failedOperations:0},this._secureLog("info","\u{1F512} Enhanced mutex system initialized with atomic protection",{mutexes:["keyOperation","cryptoOperation","connectionOperation"],timestamp:Date.now(),features:["atomic_operations","race_condition_protection","enhanced_state_tracking"]})}_hardenDebugModeReferences(){this._secureLog("info","\u{1F512} XSS Hardening: Debug mode references already replaced")}_initializeUnifiedScheduler(){this._maintenanceScheduler=setInterval(()=>{this._executeMaintenanceCycle()},3e5),this._secureLog("info","\u{1F527} Unified maintenance scheduler initialized (5-minute cycle)"),this._activeTimers=new Set([this._maintenanceScheduler])}_trackActiveTimer(e){return e&&(this._activeTimers||(this._activeTimers=new Set),this._activeTimers.add(e),e)}_untrackActiveTimer(e){e&&this._activeTimers&&this._activeTimers.delete(e)}_setSASMaterialReady(e,t){this._sasLocalFingerprint=e,this._sasRemoteFingerprint=t}_isVerificationReady(){let e=!!(this.peerConnection?.localDescription&&this.peerConnection?.remoteDescription),t=this.dataChannel?.readyState==="open",r=typeof this.verificationCode=="string"&&this.verificationCode.trim().length>0,i=typeof this._sasLocalFingerprint=="string"&&this._sasLocalFingerprint.trim().length>0&&typeof this._sasRemoteFingerprint=="string"&&this._sasRemoteFingerprint.trim().length>0;return e&&t&&r&&i}_notifyVerificationReadyIfPossible(){return this._isVerificationReady()?(this._verificationUiOpened||(this._verificationUiOpened=!0,this.onStatusChange?.("verifying"),this.onVerificationRequired?.(this.verificationCode)),!0):!1}_countIceCandidatesInSDP(e){return typeof e!="string"?0:(e.match(/^a=candidate:/gm)||[]).length}_summarizeIceCandidatesInSDP(e){let t={total:0,host:0,srflx:0,relay:0,prflx:0,unknown:0};if(typeof e!="string")return t;for(let r of e.match(/^a=candidate:.*$/gm)||[]){t.total+=1;let s=r.match(/\btyp\s+(host|srflx|relay|prflx)\b/i)?.[1]?.toLowerCase();s&&Object.prototype.hasOwnProperty.call(t,s)?t[s]+=1:t.unknown+=1}return t}_describeIceCandidatesInSDP(e){return typeof e!="string"?[]:(e.match(/^a=candidate:.*$/gm)||[]).map(t=>{let r=t.slice(12).trim().split(/\s+/),i=r.findIndex(u=>u.toLowerCase()==="typ"),s=r[4]||"",a=r[5]||"",o=i>=0&&r[i+1]||"unknown",c=(r[2]||"unknown").toLowerCase(),d="unknown";return/\.local$/i.test(s)?d="mdns":/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[0-1])\.)/.test(s)?d="private-ipv4":/^\d{1,3}(\.\d{1,3}){3}$/.test(s)?d="public-ipv4":s.includes(":")&&(d="ipv6"),{candidateType:o,protocol:c,addressKind:d,portPresent:!!a,tcpType:(()=>{let u=r.findIndex(h=>h.toLowerCase()
`),e=e.replace(/\n{3,}/g,`
2026-09-04 17:38:41 -04:00
`),e=e.trim()),e}_sanitizeInputObject(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>this._sanitizeInputObject(r));let t={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];typeof i=="string"?t[r]=this._sanitizeInputString(i):typeof i=="object"?t[r]=this._sanitizeInputObject(i):t[r]=i}return t}_checkRateLimit(e="message"){let t=Date.now();return this._rateLimiter||(this._rateLimiter={messageCount:0,lastReset:t,burstCount:0,lastBurstReset:t}),t-this._rateLimiter.lastReset>6e4&&(this._rateLimiter.messageCount=0,this._rateLimiter.lastReset=t),t-this._rateLimiter.lastBurstReset>1e3&&(this._rateLimiter.burstCount=0,this._rateLimiter.lastBurstReset=t),this._rateLimiter.burstCount>=this._inputValidationLimits.rateLimitBurstSize?(this._secureLog("warn","\u26A0\uFE0F Rate limit burst exceeded",{context:e}),!1):this._rateLimiter.messageCount>=this._inputValidationLimits.rateLimitMessagesPerMinute?(this._secureLog("warn","\u26A0\uFE0F Rate limit exceeded",{context:e}),!1):(this._rateLimiter.messageCount++,this._rateLimiter.burstCount++,!0)}_checkInboundRateLimit(e="incoming_message"){let t=Date.now();return this._inboundRateLimiter||(this._inboundRateLimiter={messageCount:0,lastReset:t,burstCount:0,lastBurstReset:t}),t-this._inboundRateLimiter.lastReset>6e4&&(this._inboundRateLimiter.messageCount=0,this._inboundRateLimiter.lastReset=t),t-this._inboundRateLimiter.lastBurstReset>1e3&&(this._inboundRateLimiter.burstCount=0,this._inboundRateLimiter.lastBurstReset=t),this._inboundRateLimiter.burstCount>=this._inputValidationLimits.rateLimitBurstSize?(this._secureLog("warn","\u26A0\uFE0F Inbound message burst limit exceeded; dropping message",{context:e}),!1):this._inboundRateLimiter.messageCount>=this._inputValidationLimits.rateLimitMessagesPerMinute?(this._secureLog("warn","\u26A0\uFE0F Inbound message rate limit exceeded; dropping message",{context:e}),!1):(this._inboundRateLimiter.messageCount++,this._inboundRateLimiter.burstCount++,!0)}_initializeSecureKeyStorage(){this._masterKeyManager=new Gt,this._secureKeyStorage=new Ht(this._masterKeyManager),this._keyStorageStats={totalKeys:0,activeKeys:0,lastAccess:null,lastRotation:null},this._secureLog("info","\u{1F510} Enhanced secure key storage initialized")}setMasterKeyPasswordCallback(e){this._masterKeyManager&&this._masterKeyManager.setPasswordRequiredCallback(e)}setMasterKeySessionExpiredCallback(e){this._masterKeyManager&&this._masterKeyManager.setSessionExpiredCallback(e)}lockMasterKey(){this._masterKeyManager&&this._masterKeyManager.lock()}isMasterKeyUnlocked(){return this._masterKeyManager?this._masterKeyManager.isUnlocked():!1}getMasterKeySessionStatus(){return this._masterKeyManager?this._masterKeyManager.getSessionStatus():null}async _ensureFileTransferReady(){try{if(this.fileTransferSystem)return!0;if(!this.dataChannel||this.dataChannel.readyState!=="open")throw new Error("Data channel not open");if(!this.isVerified)throw new Error("Connection not verified");this.initializeFileTransfer();let e=0,t=50;for(;!this.fileTransferSystem&&e<t;)await new Promise(r=>setTimeout(r,100)),e++;if(!this.fileTransferSystem)throw new Error("File transfer system initialization timeout");return!0}catch(e){return this._secureLog("error","\u274C _ensureFileTransferReady failed",{errorType:e?.constructor?.name||"Unknown",hasMessage:!!e?.message}),!1}}_getSecureKey(e){return this._secureKeyStorage.retrieveKey(e)}async _setSecureKey(e,t){if(!(t instanceof CryptoKey))return this._secureLog("error","\u274C Attempt to store non-CryptoKey"),!1;let r=await this._secureKeyStorage.storeKey(e,t,{version:this.currentKeyVersion,type:t.algorithm.name});return r&&this._secureLog("info",`\u{1F511} Key ${e} stored securely with encryption`),r}_validateKeyValue(e){return e instanceof CryptoKey&&e.algorithm&&e.usages&&e.usages.length>0}_secureWipeKeys(){this._secureKeyStorage.secureWipeAll(),this._masterKeyManager&&this._masterKeyManager.lock(),this._secureLog("info","\u{1F9F9} All keys securely wiped and encrypted storage cleared")}_validateKeyStorage(){return this._secureKeyStora
2026-09-04 17:38:41 -04:00
`;if(P+=`Security Level: ${R.level} (${R.score}%)
`,P+=`Verification Time: ${new Date(R.timestamp).toLocaleTimeString()}
`,P+=`Data Source: ${R.isRealData?f("sec.realTests"):f("sec.simulatedData")}
2026-09-04 17:38:41 -04:00
`,R.verificationResults){P+=`DETAILED CRYPTOGRAPHIC TESTS:
`,P+="="+"=".repeat(40)+`
`;let Y=Object.entries(R.verificationResults).filter(([_e,ye])=>ye.passed),Se=Object.entries(R.verificationResults).filter(([_e,ye])=>!ye.passed);Y.length>0&&(P+=`PASSED TESTS:
`,Y.forEach(([_e,ye])=>{let Ye=_e.replace(/([A-Z])/g," $1").replace(/^./,W=>W.toUpperCase());P+=` ${Ye}: ${ye.details||f("sec.testPassed")}
`}),P+=`
`),Se.length>0&&(P+=`FAILED/UNAVAILABLE TESTS:
`,Se.forEach(([_e,ye])=>{let Ye=_e.replace(/([A-Z])/g," $1").replace(/^./,W=>W.toUpperCase());P+=` ${Ye}: ${ye.details||f("sec.testFailed")}
`}),P+=`
`),P+=`SUMMARY:
`,P+=`Passed: ${R.passedChecks}/${R.totalChecks} tests
`,P+=`Score: ${R.score}/${R.maxPossibleScore||100} points
2026-09-04 17:38:41 -04:00
`}if(P+=`SECURITY FEATURES STATUS:
`,P+="="+"=".repeat(40)+`
`,R.verificationResults){let Y={"ECDSA Digital Signatures":R.verificationResults.verifyECDSASignatures?.passed||!1,"ECDH Key Exchange":R.verificationResults.verifyECDHKeyExchange?.passed||!1,"AES-GCM Encryption":R.verificationResults.verifyEncryption?.passed||!1,[f("sec.messageIntegrity")]:R.verificationResults.verifyMessageIntegrity?.passed||!1,[f("sec.forwardSecrecy")]:R.verificationResults.verifyPerfectForwardSecrecy?.passed||!1,[f("sec.replayProtection")]:R.verificationResults.verifyReplayProtection?.passed||!1,"DTLS Fingerprint":R.verificationResults.verifyDTLSFingerprint?.passed||!1,"SAS Verification":R.verificationResults.verifySASVerification?.passed||!1,[f("sec.metadataProtection")]:R.verificationResults.verifyMetadataProtection?.passed||!1,[f("sec.trafficObfuscation")]:R.verificationResults.verifyTrafficObfuscation?.passed||!1};Object.entries(Y).forEach(([Se,_e])=>{P+=`${_e?"\u2705":"\u274C"} ${Se}
`})}else P+=`\u2705 ECDSA Digital Signatures
`,P+=`\u2705 ECDH Key Exchange
`,P+=`\u2705 AES-GCM Encryption
`,P+=`\u2705 Message Integrity (HMAC)
`,P+=`\u2705 Perfect Forward Secrecy
`,P+=`\u2705 Replay Protection
`,P+=`\u2705 DTLS Fingerprint
`,P+=`\u2705 SAS Verification
`,P+=`\u2705 Metadata Protection
`,P+=`\u2705 Traffic Obfuscation
`;P+=`
${R.details||f("sec.verificationDone")}`,R.isRealData?P+=`
2026-09-04 17:38:41 -04:00
\u2705 This is REAL-TIME verification using actual cryptographic functions.`:P+=`
\u26A0\uFE0F Warning: This data may be simulated. Connection may not be fully established.`;let K=document.createElement("div");K.style.cssText=`
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
2026-09-04 17:38:41 -04:00
background: rgba(var(--sb-scrim-rgb), 0.8);
z-index: 10000;
display: flex;
align-items: center;
justify-content: center;
font-family: monospace;
2026-09-04 17:38:41 -04:00
`;let O=document.createElement("div");O.style.cssText=`
background: var(--sb-legacy-panel);
color: var(--sb-text-1);
padding: 20px;
border-radius: 8px;
max-width: 80%;
max-height: 80%;
overflow-y: auto;
white-space: pre-line;
2026-09-04 17:38:41 -04:00
border: 1px solid var(--sb-surface-5);
`,O.textContent=P,K.appendChild(O),K.addEventListener("click",Y=>{Y.target===K&&document.body.removeChild(K)});let q=Y=>{Y.key==="Escape"&&(document.body.removeChild(K),document.removeEventListener("keydown",q))};document.addEventListener("keydown",q),document.body.appendChild(K)},D=(()=>{switch(n){case"connected":return{text:f("status.connected"),className:"status-connected",badgeClass:"bg-green-500/10 text-green-400 border-green-500/20"};case"verifying":return{text:f("status.verifying"),className:"status-verifying",badgeClass:"bg-purple-500/10 text-purple-400 border-purple-500/20"};case"connecting":return{text:f("status.connecting"),className:"status-connecting",badgeClass:"bg-blue-500/10 text-blue-400 border-blue-500/20"};case"retrying":return{text:f("status.retrying"),className:"status-connecting",badgeClass:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20"};case"failed":return{text:f("status.error"),className:"status-failed",badgeClass:"bg-red-500/10 text-red-400 border-red-500/20"};case"reconnecting":return{text:f("status.reconnecting"),className:"status-connecting",badgeClass:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20"};case"peer_disconnected":return{text:f("status.peerDisconnected"),className:"status-failed",badgeClass:"bg-orange-500/10 text-orange-400 border-orange-500/20"};default:return{text:f("status.notConnected"),className:"status-disconnected",badgeClass:"bg-gray-500/10 text-gray-400 border-gray-500/20"}}})(),T=i?o||s:null,b=(()=>{if(!T)return{tooltip:f("sec.verificationInProgress"),isVerified:!1,dataSource:"loading"};let G=T.isRealData!==!1,N=`${T.level} (${T.score}%)`;return G?{tooltip:`${N} - Real-time verification \u2705
Right-click or Ctrl+click to disconnect`,isVerified:!0,dataSource:"real"}:{tooltip:`${N} - Estimated (connection establishing...)
Right-click or Ctrl+click to disconnect`,isVerified:!1,dataSource:"estimated"}})();React.useEffect(()=>(window.debugHeaderSecurity=void 0,()=>{delete window.debugHeaderSecurity}),[o,d,i,a,T,b]);let C=T?T.color==="green"?"var(--sb-green)":T.color==="orange"?"var(--sb-orange)":T.color==="yellow"?"var(--sb-yellow)":"var(--sb-red)":"var(--sb-green)",x=i?"var(--sb-green-solid)":["connecting","verifying","retrying","reconnecting"].includes(n)?"var(--sb-yellow-solid)":n==="failed"?"var(--sb-red-solid)":"var(--sb-text-9)",k=x==="var(--sb-green-solid)"?"rgba(var(--sb-green-rgb), 0.16)":x==="var(--sb-yellow-solid)"?"rgba(var(--sb-yellow-rgb), 0.16)":x==="var(--sb-red-solid)"?"rgba(var(--sb-red-rgb), 0.16)":"rgba(var(--sb-text-9-rgb), 0.16)",j="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace",z=!i,[M,fe]=React.useState(!1);React.useEffect(()=>{let G=()=>fe((window.scrollY||window.pageYOffset||0)>8);return G(),window.addEventListener("scroll",G,{passive:!0}),()=>window.removeEventListener("scroll",G)},[]);let re="blur(20px) saturate(180%)",pe="background .25s ease, backdrop-filter .25s ease, -webkit-backdrop-filter .25s ease, border-color .25s ease",me={paddingTop:"var(--sb-safe-top, 0px)",paddingBottom:"var(--sb-bar-extra, 0px)"},ce={position:"fixed",top:0,left:0,right:0,...me},ve=z?M?{...ce,background:"rgba(var(--sb-bg-rgb), 0.72)",backdropFilter:re,WebkitBackdropFilter:re,borderBottom:"1px solid rgba(var(--sb-ink), 0.06)",transition:pe}:{...ce,background:"transparent",backdropFilter:"blur(0px) saturate(100%)",WebkitBackdropFilter:"blur(0px) saturate(100%)",borderBottom:"1px solid transparent",transition:pe}:{...me,background:"rgba(var(--sb-bg-rgb), 0.72)",backdropFilter:re,WebkitBackdropFilter:re,borderBottom:"1px solid rgba(var(--sb-ink), 0.06)"};return React.createElement("header",{className:z?"header-minimal z-50":"header-minimal sticky top-0 z-50",style:ve},[React.createElement("div",{key:"container",className:"max-w-7xl mx-auto",style:{padding:"0 20px"}},[React.createElement("div",{key:"content",className:"flex items-center justify-between",style:{height:"var(--sb-bar-h, 64px)",gap:"16px"}},[React.createElement("div",{key:"left",style:{display:"flex",alignItems:"center",gap:"12px",minWidth:0}},[React.createElement("div",{key:"logo",style:{width:"36px",height:"36px",flex:"none",display:"grid",placeItems:"center"}},React.createElement("img",{src:"/logo/securebit-mark.svg",alt:"SecureBit",style:{width:"100%",height:"100%",objectFit:"contain",display:"block"}})),React.createElement("div",{key:"txt",style:{lineHeight:1.2,minWidth:0}},[React.createElement("div",{key:"r1",style:{display:"flex",alignItems:"baseline",gap:"7px"}},[React.createElement("span",{key:"n",style:{fontSize:"16px",fontWeight:800,letterSpacing:"-0.3px",color:"var(--sb-text-2)"}},"SecureBit"),React.createElement("span",{key:"v",style:{fontFamily:j,fontSize:"10px",fontWeight:500,color:"var(--sb-text-faint)"}},ka)]),React.createElement("div",{key:"r2",className:"hidden sm:block",style:{fontSize:"11px",color:"var(--sb-text-9)",fontWeight:500}},f("hdr.tagline"))])]),React.createElement("div",{key:"right",style:{display:"flex",alignItems:"center",gap:"9px"}},[z&&React.createElement(Vr,{key:"lang"}),z&&React.createElement(Hr,{key:"theme"}),!z&&React.createElement("button",{key:"net",type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("securebit:open-network-settings")),title:f("hdr.netSettingsTitle"),"aria-label":f("hdr.netSettings"),className:"sb-disconnect",style:{display:"grid",placeItems:"center",width:"38px",height:"38px",borderRadius:"9px",border:"1px solid rgba(var(--sb-ink), 0.07)",background:"rgba(var(--sb-ink), 0.02)",color:"var(--sb-text-6)",cursor:"pointer",transition:"all .15s"}},React.createElement("i",{className:"fas fa-network-wired",style:{fontSize:"13px"}})),!z&&T&&React.createElement("div",{key:"sec",onClick:I,onContextMenu:G=>{G.preventDefault(),typeof r=="function"&&r()},title:b.tooltip,className:"sb-secpill",style:{display:"flex",alignItems:"center",gap:"8px",padding:"7px 12px",borderRadius:"9px",border:"1px solid rgb
`).map(r=>r.trim()).filter(Boolean).map(r=>({urls:r}));return Rs(t)}function Ps(n){return Array.isArray(n)?n.some(e=>(Array.isArray(e?.urls)?e.urls:[e?.urls]).some(Ls)):!1}var Ve=window.React,Oa=["# One URL per line, e.g.:","stun:stun.example.com:3478","turn:turn.example.com:3478?transport=udp","","# Or paste JSON for servers with credentials:",'[{"urls":"turns:turn.example.com:5349","username":"user","credential":"secret"}]'].join(`
`);async function Ua(n,e=6e3){let t={host:0,srflx:0,relay:0};if(typeof RTCPeerConnection>"u")return{...t,error:f("ice.errUnavailable")};let r;try{r=new RTCPeerConnection({iceServers:n})}catch(i){return{...t,error:i.message||f("ice.errInvalid")}}return new Promise(i=>{let s=!1,a=()=>{if(!s){s=!0,clearTimeout(o);try{r.close()}catch{}i(t)}},o=setTimeout(a,e);r.onicecandidate=c=>{if(!c.candidate){a();return}let d=c.candidate.candidate||"";/ typ host/.test(d)?t.host++:/ typ srflx/.test(d)?t.srflx++:/ typ relay/.test(d)&&t.relay++};try{r.createDataChannel("securebit-ice-test"),r.createOffer().then(c=>r.setLocalDescription(c)).catch(()=>a())}catch{a()}})}var za=({isOpen:n,onClose:e,initial:t,hasSaved:r,onApply:i,onForget:s,embedded:a})=>{if(!n)return null;let[o,c]=Ve.useState(t?.useCustom||!1),[d,u]=Ve.useState(t?.serversText||""),[h,m]=Ve.useState(t?.privacyMode==="relay-only"),[p,S]=Ve.useState(t?.persisted||!1),[g,_]=Ve.useState("idle"),[I,w]=Ve.useState(null),D=o?Ds(d):{servers:[],errors:[],warnings:[]},T=Ps(D.servers),v=!o||D.servers.length>0&&D.errors.length===0,b=async()=>{_("running"),w(null);let N=await Ua(D.servers);w(N),_("done")},C=()=>{v&&i({useCustom:o,servers:o?D.servers:[],privacyMode:h?"relay-only":"standard",serversText:d},p)},x=async()=>{s&&await s(),S(!1)},k=Ve.createElement,j="var(--sb-orange)",z="var(--sb-green)",M="var(--sb-orange-solid)",fe="var(--sb-green-solid)",re="'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace",pe=(N,R,P,K,O)=>k("button",{type:"button",onClick:R,style:Object.assign({width:"100%",textAlign:"start",display:"flex",alignItems:"flex-start",gap:"12px",padding:"14px 15px",borderRadius:"13px",border:`1px solid ${N?"rgba(var(--sb-orange-rgb), 0.45)":"rgba(var(--sb-ink), 0.07)"}`,background:N?"rgba(var(--sb-orange-rgb), 0.06)":"var(--sb-surface)",color:"inherit",fontFamily:"inherit",cursor:"pointer",transition:"all .15s",marginBottom:"10px"},O||{})},[k("span",{key:"ring",style:{flex:"none",width:"18px",height:"18px",marginTop:"1px",borderRadius:"50%",border:`1.5px solid ${N?j:"rgba(var(--sb-ink), 0.22)"}`,display:"grid",placeItems:"center"}},k("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:N?M:"transparent"}})),k("span",{key:"tx",style:{flex:1}},[k("span",{key:"t",style:{display:"block",fontSize:"14px",fontWeight:700,color:"var(--sb-text-1)"}},P),k("span",{key:"d",style:{display:"block",fontSize:"12.5px",color:"var(--sb-text-7)",marginTop:"2px"}},K)])]),me=(N,R,P,K,O,q)=>k("button",{type:"button",onClick:R,style:{width:"100%",textAlign:"start",display:"flex",alignItems:"flex-start",gap:"12px",padding:"14px 15px",borderRadius:"13px",border:`1px solid ${N?"rgba(var(--sb-green-rgb), 0.3)":"rgba(var(--sb-ink), 0.07)"}`,background:N?"rgba(var(--sb-green-rgb), 0.05)":"var(--sb-surface)",color:"inherit",fontFamily:"inherit",cursor:"pointer",transition:"all .15s",marginBottom:"10px"}},[k("span",{key:"tx",style:{flex:1}},[k("span",{key:"r1",style:{display:"flex",alignItems:"center",gap:"8px"}},[k("span",{key:"t",style:{fontSize:"14px",fontWeight:700,color:"var(--sb-text-1)"}},P),q&&k("span",{key:"b",style:{fontSize:"10px",fontWeight:700,color:z,padding:"2px 7px",borderRadius:"5px",background:"rgba(var(--sb-green-rgb), 0.1)",border:"1px solid rgba(var(--sb-green-rgb), 0.22)"}},q)]),k("span",{key:"d",style:{display:"block",fontSize:"12.5px",lineHeight:1.5,color:"var(--sb-text-7)",marginTop:"3px"}},K)]),k("span",{key:"tr",style:{flex:"none",width:"42px",height:"24px",borderRadius:"99px",background:N?O||fe:"rgba(var(--sb-ink), 0.08)",border:`1px solid ${N?O||z:"rgba(var(--sb-ink), 0.12)"}`,position:"relative",transition:"all .18s",marginTop:"1px"}},k("span",{style:{position:"absolute",top:"2px",insetInlineStart:"2px",width:"18px",height:"18px",borderRadius:"50%",background:"#fff",transform:N?`translateX(${18*Oi()}px)`:"translateX(0)",transition:"transform .18s"}}))]),ce=[];if(ce.push(k("p",{key:"intro",style:{margin:"0 0 18px",fontSize:"13.5px",lineHeight:1.6,color:"var(--sb-text-6)"}},f("ice.intro"))),ce.push(pe(!o,()=>c(!1),f("ice.publicTitle"),f("ice.publicDesc"
/**
* Secure and Reliable Notification Manager for P2P WebRTC Chat
* Follows best practices: OWASP, MDN, Chrome DevRel
*
* @version 1.0.0
* @author SecureBit Team
* @license MIT
*/
/**
* Notification Integration Module for SecureBit WebRTC Chat
* Integrates secure notifications with existing WebRTC architecture
*
* @version 1.0.0
* @author SecureBit Team
* @license MIT
*/
/*! Bundled license information:
dompurify/dist/purify.es.mjs:
2026-06-15 15:08:03 -04:00
(*! @license DOMPurify 3.4.10 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.10/LICENSE *)
*/
//# sourceMappingURL=app-boot.js.map