Update packet cracker to version with bigger dict

This commit is contained in:
Jack Kingsman committed 2026-01-11 13:57:52 -08:00
1 parent 57bece26d2
commit c6600f350b
6 files changed
+544 -544

No files matched your search

+1 -1
View File
@@ -560,7 +560,7 @@ The `CrackerPanel` component provides WebGPU-accelerated brute-forcing of channe
### Features
- **Dictionary attack first**: Uses `words_alpha.txt` wordlist
- **Dictionary attack first**: Uses `words.txt` wordlist
- **GPU bruteforce**: Falls back to character-by-character search
- **Queue management**: Automatically processes new packets as they arrive
- **Auto-channel creation**: Cracked channels are automatically added to the channel list
+537
View File
@@ -0,0 +1,537 @@
var ek=Object.defineProperty;var ik=(a,o,r)=>o in a?ek(a,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[o]=r;var Ln=(a,o,r)=>ik(a,typeof o!="symbol"?o+"":o,r);function ak(a,o){for(var r=0;r<o.length;r++){const s=o[r];if(typeof s!="string"&&!Array.isArray(s)){for(const u in s)if(u!=="default"&&!(u in a)){const l=Object.getOwnPropertyDescriptor(s,u);l&&Object.defineProperty(a,u,l.get?l:{enumerable:!0,get:()=>s[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))s(u);new MutationObserver(u=>{for(const l of u)if(l.type==="childList")for(const m of l.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function r(u){const l={};return u.integrity&&(l.integrity=u.integrity),u.referrerPolicy&&(l.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?l.credentials="include":u.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(u){if(u.ep)return;u.ep=!0;const l=r(u);fetch(u.href,l)}})();var eu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fr(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function $g(a){if(Object.prototype.hasOwnProperty.call(a,"__esModule"))return a;var o=a.default;if(typeof o=="function"){var r=function s(){return this instanceof s?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};r.prototype=o.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(a).forEach(function(s){var u=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(r,s,u.get?u:{enumerable:!0,get:function(){return a[s]}})}),r}var iu={exports:{}},fo={},au={exports:{}},Te={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Hm;function nk(){if(Hm)return Te;Hm=1;var a=Symbol.for("react.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),m=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function f(q){return q===null||typeof q!="object"?null:(q=y&&q[y]||q["@@iterator"],typeof q=="function"?q:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,z={};function v(q,I,L){this.props=q,this.context=I,this.refs=z,this.updater=L||w}v.prototype.isReactComponent={},v.prototype.setState=function(q,I){if(typeof q!="object"&&typeof q!="function"&&q!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,q,I,"setState")},v.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function j(){}j.prototype=v.prototype;function A(q,I,L){this.props=q,this.context=I,this.refs=z,this.updater=L||w}var x=A.prototype=new j;x.constructor=A,k(x,v.prototype),x.isPureReactComponent=!0;var _=Array.isArray,C=Object.prototype.hasOwnProperty,D={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function R(q,I,L){var $,le={},me=null,ge=null;if(I!=null)for($ in I.ref!==void 0&&(ge=I.ref),I.key!==void 0&&(me=""+I.key),I)C.call(I,$)&&!F.hasOwnProperty($)&&(le[$]=I[$]);var re=arguments.length-2;if(re===1)le.children=L;else if(1<re){for(var ce=Array(re),qe=0;qe<re;qe++)ce[qe]=arguments[qe+2];le.children=ce}if(q&&q.defaultProps)for($ in re=q.defaultProps,re)le[$]===void 0&&(le[$]=re[$]);return{$$typeof:a,type:q,key:me,ref:ge,props:le,_owner:D.current}}function M(q,I){return{$$typeof:a,type:q.type,key:I,ref:q.ref,props:q.props,_owner:q._owner}}function P(q){return typeof q=="object"&&q!==null&&q.$$typeof===a}function T(q){var I={"=":"=0",":":"=2"};return"$"+q.replace(/[=:]/g,function(L){return I[L]})}var U=/\/+/g;function H(q,I){return typeof q=="object"&&q!==null&&q.key!=null?T(""+q.key):I.toString(36)}function K(q,I,L,$,le){var me=typeof q;(me==="undefined"||me==="boolean")&&(q=null);var ge=!1;if(q===null)ge=!0;else switch(me){case"string":case"number":ge=!0;break;case"object":switch(q.$$typeof){case a:case o:ge=!0}}if(ge)return ge=q,le=le(ge),q=$===""?"."+H(ge,0):$,_(le)?(L="",q!=null&&(L=q.replace(U,"$&/")+"/"),K(le,I,L,"",function(qe){return qe})):le!=null&&(P(le)&&(le=M(le,L+(!le.key||ge&&ge.key===le.key?"":(""+le.key).replace(U,"$&/")+"/")+q)),I.push(le)),1;if(ge=0,$=$===""?".":$+":",_(q))for(var re=0;re<q.length;re++){me=q[re];var ce=$+H(me,re);ge+=K(me,I,L,ce,le)}else if(ce=f(q),typeof ce=="function")for(q=ce.call(q),re=0;!(me=q.next()).done;)me=me.value,ce=$+H(me,re++),ge+=K(me,I,L,ce,le);else if(me==="object")throw I=String(q),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(q).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.");return ge}function ie(q,I,L){if(q==null)return q;var $=[],le=0;return K(q,$,"","",function(me){return I.call(L,me,le++)}),$}function Z(q){if(q._status===-1){var I=q._result;I=I(),I.then(function(L){(q._status===0||q._status===-1)&&(q._status=1,q._result=L)},function(L){(q._status===0||q._status===-1)&&(q._status=2,q._result=L)}),q._status===-1&&(q._status=0,q._result=I)}if(q._status===1)return q._result.default;throw q._result}var ae={current:null},W={transition:null},ne={ReactCurrentDispatcher:ae,ReactCurrentBatchConfig:W,ReactCurrentOwner:D};function X(){throw Error("act(...) is not supported in production builds of React.")}return Te.Children={map:ie,forEach:function(q,I,L){ie(q,function(){I.apply(this,arguments)},L)},count:function(q){var I=0;return ie(q,function(){I++}),I},toArray:function(q){return ie(q,function(I){return I})||[]},only:function(q){if(!P(q))throw Error("React.Children.only expected to receive a single React element child.");return q}},Te.Component=v,Te.Fragment=r,Te.Profiler=u,Te.PureComponent=A,Te.StrictMode=s,Te.Suspense=h,Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,Te.act=X,Te.cloneElement=function(q,I,L){if(q==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+q+".");var $=k({},q.props),le=q.key,me=q.ref,ge=q._owner;if(I!=null){if(I.ref!==void 0&&(me=I.ref,ge=D.current),I.key!==void 0&&(le=""+I.key),q.type&&q.type.defaultProps)var re=q.type.defaultProps;for(ce in I)C.call(I,ce)&&!F.hasOwnProperty(ce)&&($[ce]=I[ce]===void 0&&re!==void 0?re[ce]:I[ce])}var ce=arguments.length-2;if(ce===1)$.children=L;else if(1<ce){re=Array(ce);for(var qe=0;qe<ce;qe++)re[qe]=arguments[qe+2];$.children=re}return{$$typeof:a,type:q.type,key:le,ref:me,props:$,_owner:ge}},Te.createContexLine truncated
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Um;function rk(){if(Um)return fo;Um=1;var a=Iu(),o=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,u=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function m(c,h,d){var g,y={},f=null,w=null;d!==void 0&&(f=""+d),h.key!==void 0&&(f=""+h.key),h.ref!==void 0&&(w=h.ref);for(g in h)s.call(h,g)&&!l.hasOwnProperty(g)&&(y[g]=h[g]);if(c&&c.defaultProps)for(g in h=c.defaultProps,h)y[g]===void 0&&(y[g]=h[g]);return{$$typeof:o,type:c,key:f,ref:w,props:y,_owner:u.current}}return fo.Fragment=r,fo.jsx=m,fo.jsxs=m,fo}var Wm;function ok(){return Wm||(Wm=1,iu.exports=rk()),iu.exports}var B=ok(),E=Iu();const pe=Fr(E),Mu=ak({__proto__:null,default:pe},[E]);var Ys={},nu={exports:{}},aa={},ru={exports:{}},ou={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var $m;function sk(){return $m||($m=1,(function(a){function o(W,ne){var X=W.length;W.push(ne);e:for(;0<X;){var q=X-1>>>1,I=W[q];if(0<u(I,ne))W[q]=ne,W[X]=I,X=q;else break e}}function r(W){return W.length===0?null:W[0]}function s(W){if(W.length===0)return null;var ne=W[0],X=W.pop();if(X!==ne){W[0]=X;e:for(var q=0,I=W.length,L=I>>>1;q<L;){var $=2*(q+1)-1,le=W[$],me=$+1,ge=W[me];if(0>u(le,X))me<I&&0>u(ge,le)?(W[q]=ge,W[me]=X,q=me):(W[q]=le,W[$]=X,q=$);else if(me<I&&0>u(ge,X))W[q]=ge,W[me]=X,q=me;else break e}}return ne}function u(W,ne){var X=W.sortIndex-ne.sortIndex;return X!==0?X:W.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;a.unstable_now=function(){return l.now()}}else{var m=Date,c=m.now();a.unstable_now=function(){return m.now()-c}}var h=[],d=[],g=1,y=null,f=3,w=!1,k=!1,z=!1,v=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(W){for(var ne=r(d);ne!==null;){if(ne.callback===null)s(d);else if(ne.startTime<=W)s(d),ne.sortIndex=ne.expirationTime,o(h,ne);else break;ne=r(d)}}function _(W){if(z=!1,x(W),!k)if(r(h)!==null)k=!0,Z(C);else{var ne=r(d);ne!==null&&ae(_,ne.startTime-W)}}function C(W,ne){k=!1,z&&(z=!1,j(R),R=-1),w=!0;var X=f;try{for(x(ne),y=r(h);y!==null&&(!(y.expirationTime>ne)||W&&!T());){var q=y.callback;if(typeof q=="function"){y.callback=null,f=y.priorityLevel;var I=q(y.expirationTime<=ne);ne=a.unstable_now(),typeof I=="function"?y.callback=I:y===r(h)&&s(h),x(ne)}else s(h);y=r(h)}if(y!==null)var L=!0;else{var $=r(d);$!==null&&ae(_,$.startTime-ne),L=!1}return L}finally{y=null,f=X,w=!1}}var D=!1,F=null,R=-1,M=5,P=-1;function T(){return!(a.unstable_now()-P<M)}function U(){if(F!==null){var W=a.unstable_now();P=W;var ne=!0;try{ne=F(!0,W)}finally{ne?H():(D=!1,F=null)}}else D=!1}var H;if(typeof A=="function")H=function(){A(U)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ie=K.port2;K.port1.onmessage=U,H=function(){ie.postMessage(null)}}else H=function(){v(U,0)};function Z(W){F=W,D||(D=!0,H())}function ae(W,ne){R=v(function(){W(a.unstable_now())},ne)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(W){W.callback=null},a.unstable_continueExecution=function(){k||w||(k=!0,Z(C))},a.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<W?Math.floor(1e3/W):5},a.unstable_getCurrentPriorityLevel=function(){return f},a.unstable_getFirstCallbackNode=function(){return r(h)},a.unstable_next=function(W){switch(f){case 1:case 2:case 3:var ne=3;break;default:ne=f}var X=f;f=ne;try{return W()}finally{f=X}},a.unstable_pauseExecution=function(){},a.unstable_requestPaint=function(){},a.unstable_runWithPriority=function(W,ne){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var X=f;f=W;try{return ne()}finally{f=X}},a.unstable_scheduleCallback=function(W,ne,X){var q=a.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?q+X:q):X=q,W){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=X+I,W={id:g++,callback:ne,priorityLevel:W,startTime:X,expirationTime:I,sortIndex:-1},X>q?(W.sortIndex=X,o(d,W),r(h)===null&&W===r(d)&&(z?(j(R),R=-1):z=!0,ae(_,X-q))):(W.sortIndex=I,o(h,W),k||w||(k=!0,Z(C))),W},a.unstable_shouldYield=T,a.unstable_wrapCallback=function(W){var ne=f;return function(){var X=f;f=ne;try{return W.apply(this,arguments)}finally{f=X}}}})(ou)),ou}var Gm;function tk(){return Gm||(Gm=1,ru.exports=sk()),ru.exports}/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Qm;function lk(){if(Qm)return aa;Qm=1;var a=Iu(),o=tk();function r(e){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)i+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,u={};function l(e,i){m(e,i),m(e+"Capture",i)}function m(e,i){for(u[e]=i,e=0;e<i.length;e++)s.add(i[e])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,g={},y={};function f(e){return h.call(y,e)?!0:h.call(g,e)?!1:d.test(e)?y[e]=!0:(g[e]=!0,!1)}function w(e,i,n,t){if(n!==null&&n.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return t?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function k(e,i,n,t){if(i===null||typeof i>"u"||w(e,i,n,t))return!0;if(t)return!1;if(n!==null)switch(n.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function z(e,i,n,t,p,b,S){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=t,this.attributeNamespace=p,this.mustUseProperty=n,this.propertyName=e,this.type=i,this.sanitizeURL=b,this.removeEmptyString=S}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){v[e]=new z(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var i=e[0];v[i]=new z(i,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){v[e]=new z(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){v[e]=new z(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){v[e]=new z(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){v[e]=new z(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){v[e]=new z(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){v[e]=new z(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){v[e]=new z(e,5,!1,e.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function A(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var i=e.replace(j,A);v[i]=new z(i,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var i=e.replace(j,A);v[i]=new z(i,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var i=e.replace(j,A);v[i]=new z(i,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){v[e]=new z(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new z("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){v[e]=new z(e,1,!1,e.toLowerCase(),null,!0,!0)});function x(e,i,n,t){var p=v.hasOwnProperty(i)?v[i]:null;(p!==null?p.type!==0:t||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!= Line truncated
`+q+e}var L=!1;function $(e,i){if(!e||L)return"";L=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(Y){var t=Y}Reflect.construct(e,[],i)}else{try{i.call()}catch(Y){t=Y}e.call(i.prototype)}else{try{throw Error()}catch(Y){t=Y}e()}}catch(Y){if(Y&&t&&typeof Y.stack=="string"){for(var p=Y.stack.split(`
`),b=t.stack.split(`
`),S=p.length-1,N=b.length-1;1<=S&&0<=N&&p[S]!==b[N];)N--;for(;1<=S&&0<=N;S--,N--)if(p[S]!==b[N]){if(S!==1||N!==1)do if(S--,N--,0>N||p[S]!==b[N]){var O=`
`+p[S].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),O}while(1<=S&&0<=N);break}}}finally{L=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?I(e):""}function le(e){switch(e.tag){case 5:return I(e.type);case 16:return I("Lazy");case 13:return I("Suspense");case 19:return I("SuspenseList");case 0:case 2:case 15:return e=$(e.type,!1),e;case 11:return e=$(e.type.render,!1),e;case 1:return e=$(e.type,!0),e;default:return""}}function me(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case F:return"Fragment";case D:return"Portal";case M:return"Profiler";case R:return"StrictMode";case H:return"Suspense";case K:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:return(e.displayName||"Context")+".Consumer";case P:return(e._context.displayName||"Context")+".Provider";case U:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return i=e.displayName||null,i!==null?i:me(e.type)||"Memo";case Z:i=e._payload,e=e._init;try{return me(e(i))}catch{}}return null}function ge(e){var i=e.type;switch(e.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=i.render,e=e.displayName||e.name||"",i.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(i);case 8:return i===R?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function re(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ce(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function qe(e){var i=ce(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,i),t=""+e[i];if(!e.hasOwnProperty(i)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var p=n.get,b=n.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return p.call(this)},set:function(S){t=""+S,b.call(this,S)}}),Object.defineProperty(e,i,{enumerable:n.enumerable}),{getValue:function(){return t},setValue:function(S){t=""+S},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function De(e){e._valueTracker||(e._valueTracker=qe(e))}function Pe(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var n=i.getValue(),t="";return e&&(t=ce(e)?e.checked?"true":"false":e.value),e=t,e!==n?(i.setValue(e),!0):!1}function ai(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Re(e,i){var n=i.checked;return X({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function He(e,i){var n=i.defaultValue==null?"":i.defaultValue,t=i.checked!=null?i.checked:i.defaultChecked;n=re(i.value!=null?i.value:n),e._wrapperState={initialChecked:t,initialValue:n,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function Oe(e,i){i=i.checked,i!=null&&x(e,"checked",i,!1)}function Je(e,i){Oe(e,i);var n=re(i.value),t=i.type;if(n!=null)t==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(t==="submit"||t==="reset"){e.removeAttribute("value");return}i.hasOwnProperty("value")?ri(e,i.type,n):i.hasOwnProperty("defaultValue")&&ri(e,i.type,re(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(e.defaultChecked=!!i.defaultChecked)}function Ge(e,i,n){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var t=i.type;if(!(t!=="submit"&&t!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+e._wrapperState.initialValue,n||i===e.value||(e.value=i),e.defaultValue=i}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ri(e,i,n){(i!=="number"||ai(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var fi=Array.isArray;function ti(e,i,n,t){if(e=e.options,i){i={};for(var p=0;p<n.length;p++)i["$"+n[p]]=!0;for(n=0;n<e.length;n++)p=i.hasOwnProperty("$"+e[n].value),e[n].selected!==p&&(e[n].selected=p),p&&t&&(e[n].defaultSelected=!0)}else{for(n=""+re(n),i=null,p=0;p<e.length;p++){if(e[p].value===n){e[p].selected=!0,t&&(e[p].defaultSelected=!0);return}i!==null||e[p].disabled||(i=e[p])}i!==null&&(i.selected=!0)}}function Ve(e,i){if(i.dangerouslySetInnerHTML!= Line truncated
`).replace(mv,"")}function cs(e,i,n){if(i=tp(i),tp(e)!==i&&n)throw Error(r(425))}function us(){}var Wl=null,$l=null;function Gl(e,i){return e==="textarea"||e==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Ql=typeof setTimeout=="function"?setTimeout:void 0,hv=typeof clearTimeout=="function"?clearTimeout:void 0,lp=typeof Promise=="function"?Promise:void 0,gv=typeof queueMicrotask=="function"?queueMicrotask:typeof lp<"u"?function(e){return lp.resolve(null).then(e).catch(yv)}:Ql;function yv(e){setTimeout(function(){throw e})}function Kl(e,i){var n=i,t=0;do{var p=n.nextSibling;if(e.removeChild(n),p&&p.nodeType===8)if(n=p.data,n==="/$"){if(t===0){e.removeChild(p),Ur(i);return}t--}else n!=="$"&&n!=="$?"&&n!=="$!"||t++;n=p}while(n);Ur(i)}function un(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return e}function cp(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(i===0)return e;i--}else n==="/$"&&i++}e=e.previousSibling}return null}var tr=Math.random().toString(36).slice(2),Ra="__reactFiber$"+tr,io="__reactProps$"+tr,Ua="__reactContainer$"+tr,Yl="__reactEvents$"+tr,bv="__reactListeners$"+tr,fv="__reactHandles$"+tr;function Sn(e){var i=e[Ra];if(i)return i;for(var n=e.parentNode;n;){if(i=n[Ua]||n[Ra]){if(n=i.alternate,i.child!==null||n!==null&&n.child!==null)for(e=cp(e);e!==null;){if(n=e[Ra])return n;e=cp(e)}return i}e=n,n=e.parentNode}return null}function ao(e){return e=e[Ra]||e[Ua],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function lr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function ds(e){return e[io]||null}var Zl=[],cr=-1;function dn(e){return{current:e}}function ui(e){0>cr||(e.current=Zl[cr],Zl[cr]=null,cr--)}function si(e,i){cr++,Zl[cr]=e.current,e.current=i}var pn={},Oi=dn(pn),Zi=dn(!1),Bn=pn;function ur(e,i){var n=e.type.contextTypes;if(!n)return pn;var t=e.stateNode;if(t&&t.__reactInternalMemoizedUnmaskedChildContext===i)return t.__reactInternalMemoizedMaskedChildContext;var p={},b;for(b in n)p[b]=i[b];return t&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=p),p}function Xi(e){return e=e.childContextTypes,e!=null}function ps(){ui(Zi),ui(Oi)}function up(e,i,n){if(Oi.current!==pn)throw Error(r(168));si(Oi,i),si(Zi,n)}function dp(e,i,n){var t=e.stateNode;if(i=i.childContextTypes,typeof t.getChildContext!="function")return n;t=t.getChildContext();for(var p in t)if(!(p in i))throw Error(r(108,ge(e)||"Unknown",p));return X({},n,t)}function ms(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pn,Bn=Oi.current,si(Oi,e),si(Zi,Zi.current),!0}function pp(e,i,n){var t=e.stateNode;if(!t)throw Error(r(169));n?(e=dp(e,i,Bn),t.__reactInternalMemoizedMergedChildContext=e,ui(Zi),ui(Oi),si(Oi,e)):ui(Zi),si(Zi,n)}var Wa=null,hs=!1,Xl=!1;function mp(e){Wa===null?Wa=[e]:Wa.push(e)}function vv(e){hs=!0,mp(e)}function mn(){if(!Xl&&Wa!==null){Xl=!0;var e=0,i=ii;try{var n=Wa;for(ii=1;e<n.length;e++){var t=n[e];do t=t(!0);while(t!==null)}Wa=null,hs=!1}catch(p){throw Wa!==null&&(Wa=Wa.slice(e+1)),gd(kl,mn),p}finally{ii=i,Xl=!1}}return null}var dr=[],pr=0,gs=null,ys=0,pa=[],ma=0,_n=null,$a=1,Ga="";function Dn(e,i){dr[pr++]=ys,dr[pr++]=gs,gs=e,ys=i}function hp(e,i,n){pa[ma++]=$a,pa[ma++]=Ga,pa[ma++]=_n,_n=e;var t=$a;e=Ga;var p=32-xa(t)-1;t&=~(1<<p),n+=1;var b=32-xa(i)+p;if(30<b){var S=p-p%5;b=(t&(1<<S)-1).toString(32),t>>=S,p-=S,$a=1<<32-xa(i)+p|n<<p|t,Ga=b+e}else $a=1<<b|n<<p|t,Ga=e}function Jl(e){e.return!==null&&(Dn(e,1),hp(e,1,0))}function ec(e){for(;e===gs;)gs=dr[--pr],dr[pr]=null,ys=dr[--pr],dr[pr]=null;for(;e===_n;)_n=pa[--ma],pa[ma]=null,Ga=pa[--ma],pa[ma]=null,$a=pa[--ma],pa[ma]=null}var sa=null,ta=null,di=!1,qa=null;function gp(e,i){var n=ba(5,null,null,0);n.elementType="DELETED",n.stateNode=i,n.return=e,i=e.deletions,i===null?(e.deletions=[n],e.flags|=16):i.push(n)}function yp(e,i){switch(e.tag){case 5:var n=e.type;return i=i.nodeType!==1||n.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(e.stateNode=i,sa=e,ta=un(i.firstChild),!0):!1;case 6:return i=e.pendingProps===""||i.nodeType!==3?null:i,i!==null?(e.stateNode=i,sa=e,ta=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(n=_n!==null?{id:$a,overflow:Ga}:null,e.memoizedState={dehydrated:i,treeContext:n,retryLane:1073741824},n=ba(18,null,null,0),n.stateNode=i,n.return=e,e.child=n,sa=e,ta=null,!0):!1;default:return!1}}function ic(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ac(e){if(di){var i=ta;if(i){var n=i;if(!yp(e,i)){if(ic(e))throw Error(r(418));i=un(n.nextSibling);var t=sa;i&&yp(e,i)?gp(t,n):(e.flags=e.flags&-4097|2,di=!1,sa=e)}}else{if(ic(e))throw Error(r(418));e.flags=e.flags&-4097|2,di=!1,sa=e}}}function bp(e){for(e=e. Line truncated
Error generating stack: `+b.message+`
`+b.stack}return{value:e,source:i,stack:p,digest:null}}function jc(e,i,n){return{value:e,source:null,stack:n??null,digest:i??null}}function qc(e,i){try{console.error(i.value)}catch(n){setTimeout(function(){throw n})}}var Ev=typeof WeakMap=="function"?WeakMap:Map;function Zp(e,i,n){n=Ka(-1,n),n.tag=3,n.payload={element:null};var t=i.value;return n.callback=function(){Ps||(Ps=!0,Oc=t),qc(e,i)},n}function Xp(e,i,n){n=Ka(-1,n),n.tag=3;var t=e.type.getDerivedStateFromError;if(typeof t=="function"){var p=i.value;n.payload=function(){return t(p)},n.callback=function(){qc(e,i)}}var b=e.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(n.callback=function(){qc(e,i),typeof t!="function"&&(bn===null?bn=new Set([this]):bn.add(this));var S=i.stack;this.componentDidCatch(i.value,{componentStack:S!==null?S:""})}),n}function Jp(e,i,n){var t=e.pingCache;if(t===null){t=e.pingCache=new Ev;var p=new Set;t.set(i,p)}else p=t.get(i),p===void 0&&(p=new Set,t.set(i,p));p.has(n)||(p.add(n),e=Hv.bind(null,e,i,n),i.then(e,e))}function em(e){do{var i;if((i=e.tag===13)&&(i=e.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return e;e=e.return}while(e!==null);return null}function im(e,i,n,t,p){return(e.mode&1)===0?(e===i?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(i=Ka(-1,1),i.tag=2,gn(n,i,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=p,e)}var Sv=_.ReactCurrentOwner,Ji=!1;function $i(e,i,n,t){i.child=e===null?wp(i,null,n,t):hr(i,e.child,n,t)}function am(e,i,n,t,p){n=n.render;var b=i.ref;return yr(i,p),t=yc(e,i,n,t,b,p),n=bc(),e!==null&&!Ji?(i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~p,Ya(e,i,p)):(di&&n&&Jl(i),i.flags|=1,$i(e,i,t,p),i.child)}function nm(e,i,n,t,p){if(e===null){var b=n.type;return typeof b=="function"&&!Gc(b)&&b.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(i.tag=15,i.type=b,rm(e,i,b,t,p)):(e=Hs(n.type,null,t,i,i.mode,p),e.ref=i.ref,e.return=i,i.child=e)}if(b=e.child,(e.lanes&p)===0){var S=b.memoizedProps;if(n=n.compare,n=n!==null?n:Yr,n(S,t)&&e.ref===i.ref)return Ya(e,i,p)}return i.flags|=1,e=wn(b,t),e.ref=i.ref,e.return=i,i.child=e}function rm(e,i,n,t,p){if(e!==null){var b=e.memoizedProps;if(Yr(b,t)&&e.ref===i.ref)if(Ji=!1,i.pendingProps=t=b,(e.lanes&p)!==0)(e.flags&131072)!==0&&(Ji=!0);else return i.lanes=e.lanes,Ya(e,i,p)}return Ac(e,i,n,t,p)}function om(e,i,n){var t=i.pendingProps,p=t.children,b=e!==null?e.memoizedState:null;if(t.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},si(kr,la),la|=n;else{if((n&1073741824)===0)return e=b!==null?b.baseLanes|n:n,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:e,cachePool:null,transitions:null},i.updateQueue=null,si(kr,la),la|=e,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},t=b!==null?b.baseLanes:n,si(kr,la),la|=t}else b!==null?(t=b.baseLanes|n,i.memoizedState=null):t=n,si(kr,la),la|=t;return $i(e,i,p,n),i.child}function sm(e,i){var n=i.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(i.flags|=512,i.flags|=2097152)}function Ac(e,i,n,t,p){var b=Xi(n)?Bn:Oi.current;return b=ur(i,b),yr(i,p),n=yc(e,i,n,t,b,p),t=bc(),e!==null&&!Ji?(i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~p,Ya(e,i,p)):(di&&t&&Jl(i),i.flags|=1,$i(e,i,n,p),i.child)}function tm(e,i,n,t,p){if(Xi(n)){var b=!0;ms(i)}else b=!1;if(yr(i,p),i.stateNode===null)_s(e,i),Kp(i,n,t),xc(i,n,t,p),t=!0;else if(e===null){var S=i.stateNode,N=i.memoizedProps;S.props=N;var O=S.context,Y=n.contextType;typeof Y=="object"&&Y!==null?Y=ha(Y):(Y=Xi(n)?Bn:Oi.current,Y=ur(i,Y));var se=n.getDerivedStateFromProps,te=typeof se=="function"||typeof S.getSnapshotBeforeUpdate=="function";te||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(N!==t||O!==Y)&&Yp(i,S,t,Y),hn=!1;var oe=i.memoizedState;S.state=oe,zs(i,t,S,p),O=i.memoizedState,N!==t||oe!==O||Zi.current||hn?(typeof se=="function"&&(zc(i,n,se,t),O=i.memoizedState),(N=hn||Qp(i,n,N,t,oe,O,Y))?(te||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(i.flags|=4194308)):(typeof S.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=t,i.memoizedState=O),S.props=t,S.state=O,S.context=Y,t=N):(typeof S.componentDidMount=="function"&&(i.flags|=4194308),t=!1)}else{S=i.stateNode,xp(e,i),N=i.memoizedProps,Y=i.type===i.elementType?N:Aa(i.type,N),S.props=Y,te=i.pendingProps,oe=S.context,O=n.contextType,typeof O=="object"&&O!==null?O=ha(O):(O=Xi(n)?Bn:Oi.current,O=ur(i,O));var ye=n.getDerivedStateFromProps;(se=typeof ye=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(N!==te||oe!==O)&&Yp(i,S,t,O),hn=!1,oe=i.memoizedState,S Line truncated
`)}function hk(a){if(a.length===0)return`Neighbors
No neighbors reported`;const o=[...a].sort((s,u)=>u.snr-s.snr),r=[`Neighbors (${o.length})`];for(const s of o){const u=s.name||s.pubkey_prefix,l=s.snr>=0?`+${s.snr.toFixed(1)}`:s.snr.toFixed(1);r.push(`${u}, ${l} dB [${tt(s.last_heard_seconds)} ago]`)}return r.join(`
`)}function gk(a){if(a.length===0)return`ACL
No ACL entries`;const o=[`ACL (${a.length})`];for(const r of a){const s=r.name||r.pubkey_prefix;o.push(`${s}: ${r.permission_name}`)}return o.join(`
`)}function Hn(a,o,r,s=0){const u=Math.floor(Date.now()/1e3);return{id:-Date.now()-s,type:"PRIV",conversation_key:a,text:o,sender_timestamp:u,received_at:u,path_len:null,txt_type:0,signature:null,outgoing:r,acked:1}}function yk(a,o,r){const[s,u]=E.useState(!1);E.useEffect(()=>{u(!1)},[a==null?void 0:a.id]);const l=E.useMemo(()=>{if(!a||a.type!=="contact")return!1;const h=o.find(d=>d.public_key===a.id);return(h==null?void 0:h.type)===Qg},[a,o]),m=E.useCallback(async h=>{if(!(!a||a.type!=="contact")&&l)try{const d=await ei.requestTelemetry(a.id,h),g=Hn(a.id,mk(d),!1,0),y=Hn(a.id,hk(d.neighbors),!1,1),f=Hn(a.id,gk(d.acl),!1,2);r(w=>[...w,g,y,f]),u(!0)}catch(d){const g=Hn(a.id,`Telemetry request failed: ${d instanceof Error?d.message:"Unknown error"}`,!1,0);r(y=>[...y,g])}},[a,l,r]),c=E.useCallback(async h=>{if(!a||a.type!=="contact"||!l||!s)return;const d=Hn(a.id,`> ${h}`,!0,0);r(g=>[...g,d]);try{const g=await ei.sendRepeaterCommand(a.id,h),y=Hn(a.id,g.response,!1,1);g.sender_timestamp&&(y.sender_timestamp=g.sender_timestamp),r(f=>[...f,y])}catch(g){const y=Hn(a.id,`Command failed: ${g instanceof Error?g.message:"Unknown error"}`,!1,1);r(f=>[...f,y])}},[a,l,s,r]);return{repeaterLoggedIn:s,activeContactIsRepeater:l,handleTelemetryRequest:m,handleRepeaterCommand:c}}const bk=12;function Br(a){return a.slice(0,bk)}function Kg(a,o){return!a||!o?!1:Br(a)===Br(o)}function Yn(a,o){return a||Br(o)}const xu="remoteterm-lastMessageTime",ju="remoteterm-lastReadTime";function rl(a){try{const o=localStorage.getItem(a);return o?JSON.parse(o):{}}catch{return{}}}function Yg(a,o){try{localStorage.setItem(a,JSON.stringify(o))}catch{}}function Zm(){return rl(xu)}function fk(){return rl(ju)}function su(a,o){const r=rl(xu);return(!r[a]||o>r[a])&&(r[a]=o,Yg(xu,r)),r}function Zs(a,o){const r=rl(ju);return r[a]=o,Yg(ju,r),r}function fa(a,o){return a==="channel"?`channel-${o}`:`contact-${Br(o)}`}function vk(a,o,r){const[s,u]=E.useState({}),[l,m]=E.useState(Zm),c=E.useRef(new Set),h=E.useRef(new Set);E.useEffect(()=>{const w=a.filter(v=>!c.current.has(v.key)),k=o.filter(v=>v.public_key&&!h.current.has(v.public_key));if(w.length===0&&k.length===0)return;w.forEach(v=>c.current.add(v.key)),k.forEach(v=>h.current.add(v.public_key)),(async()=>{const v=[...w.map(j=>({type:"CHAN",conversation_key:j.key})),...k.map(j=>({type:"PRIV",conversation_key:j.public_key}))];if(v.length!==0)try{const j=await ei.getMessagesBulk(v,100),A=fk(),x={},_={};for(const C of w){const D=j[`CHAN:${C.key}`]||[];if(D.length>0){const F=fa("channel",C.key),R=A[F]||0,M=D.filter(T=>!T.outgoing&&T.received_at>R).length;M>0&&(x[F]=M);const P=Math.max(...D.map(T=>T.received_at));_[F]=P,su(F,P)}}for(const C of k){const D=j[`PRIV:${C.public_key}`]||[];if(D.length>0){const F=fa("contact",C.public_key),R=A[F]||0,M=D.filter(T=>!T.outgoing&&T.received_at>R).length;M>0&&(x[F]=M);const P=Math.max(...D.map(T=>T.received_at));_[F]=P,su(F,P)}}Object.keys(x).length>0&&u(C=>({...C,...x})),m(Zm())}catch(j){console.error("Failed to fetch messages bulk:",j)}})()},[a,o]),E.useEffect(()=>{if(r&&r.type!=="raw"){const w=fa(r.type,r.id),k=Math.floor(Date.now()/1e3);Zs(w,k),u(z=>{if(z[w]){const v={...z};return delete v[w],v}return z})}},[r]);const d=E.useCallback(w=>{u(k=>({...k,[w]:(k[w]||0)+1}))},[]),g=E.useCallback(()=>{const w=Math.floor(Date.now()/1e3);for(const k of a){const z=fa("channel",k.key);Zs(z,w)}for(const k of o)if(k.public_key){const z=fa("contact",k.public_key);Zs(z,w)}u({})},[a,o]),y=E.useCallback(w=>{if(w.type==="raw")return;const k=fa(w.type,w.id),z=Math.floor(Date.now()/1e3);Zs(k,z),u(v=>{if(v[k]){const j={...v};return delete j[k],j}return v})},[]),f=E.useCallback(w=>{let k=null;if(w.type==="CHAN"&&w.conversation_key?k=fa("channel",w.conversation_key):w.type==="PRIV"&&w.conversation_key&&(k=fa("contact",w.conversation_key)),k){const z=w.received_at||Math.floor(Date.now()/1e3),v=su(k,z);m(v)}},[]);return{unreadCounts:s,lastMessageTimes:l,incrementUnread:d,markAllRead:g,markConversationRead:y,trackNewMessage:f}}const Xs=200;function tu(a){return`${a.type}-${a.conversation_key}-${a.text}-${a.sender_timestamp}`}function kk(a){const[o,r]=E.useState([]),[s,u]=E.useState(!1),[l,m]=E.useState(!1),[c,h]=E.useState(!1),d=E.useRef(new Set),g=E.useCallback(async(k=!1)=>{if(!a||a.type==="raw"){r([]),h(!1);return}k&&u(!0);try{const z=await ei.getMessages({type:a.type==="channel"?"CHAN":"PRIV",conversation_key:a.id,limit:Xs});r(z),d.current.clear();for(const v of z)d.current.add(tu(v));h(z.length>=Xs)}catch(z){console.error("Failed to fetch messages:",z)}finally{k&&u(!1)}},[a]),y=E.useCallback(async()=>{if(!(!a||a.type==="raw"||l||!c)){m(!0);try{const k=await ei.getMessages({type:a.type==="channel"?"CHAN":"PRIV",conversation_key:a.id,limit:Xs,offset:o.length});if(k.length>0){r(z=>[...z,...k]);for(const z of k)d.current.add(tu(z))}h(k.length>=Xs)}catch(k){console.error("Failed to fetch older messages:",k)}finally{m(!1)}}},[a,l,c,o.length]);E.useEffect(()=>{g(!0)},[g]);const f=E.useCallback( Line truncated
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wk=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zk=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(o,r,s)=>s?s.toUpperCase():r.toLowerCase()),Xm=a=>{const o=zk(a);return o.charAt(0).toUpperCase()+o.slice(1)},Zg=(...a)=>a.filter((o,r,s)=>!!o&&o.trim()!==""&&s.indexOf(o)===r).join(" ").trim(),xk=a=>{for(const o in a)if(o.startsWith("aria-")||o==="role"||o==="title")return!0};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var jk={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qk=E.forwardRef(({color:a="currentColor",size:o=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:u="",children:l,iconNode:m,...c},h)=>E.createElement("svg",{ref:h,...jk,width:o,height:o,stroke:a,strokeWidth:s?Number(r)*24/Number(o):r,className:Zg("lucide",u),...!l&&!xk(c)&&{"aria-hidden":"true"},...c},[...m.map(([d,g])=>E.createElement(d,g)),...Array.isArray(l)?l:[l]]));/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ou=(a,o)=>{const r=E.forwardRef(({className:s,...u},l)=>E.createElement(qk,{ref:l,iconNode:o,className:Zg(`lucide-${wk(Xm(a))}`,`lucide-${a}`,s),...u}));return r.displayName=Xm(a),r};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ak=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ck=Ou("check",Ak);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ek=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Sk=Ou("menu",Ek);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bk=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xg=Ou("x",Bk);var Jg=Gg();const ey=Fr(Jg);function _k(a){if(typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",o.appendChild(r),r.styleSheet?r.styleSheet.cssText=a:r.appendChild(document.createTextNode(a))}const Dk=a=>{switch(a){case"success":return Tk;case"info":return Nk;case"warning":return Pk;case"error":return Ik;default:return null}},Fk=Array(12).fill(0),Rk=({visible:a,className:o})=>pe.createElement("div",{className:["sonner-loading-wrapper",o].filter(Boolean).join(" "),"data-visible":a},pe.createElement("div",{className:"sonner-spinner"},Fk.map((r,s)=>pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),Tk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Pk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Nk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ik=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Mk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},pe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),pe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ok=()=>{const[a,o]=pe.useState(document.hidden);return pe.useEffect(()=>{const r=()=>{o(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),a};let qu=1;class Lk{constructor(){this.subscribe=o=>(this.subscribers.push(o),()=>{const r=this.subscribers.indexOf(o);this.subscribers.splice(r,1)}),this.publish=o=>{this.subscribers.forEach(r=>r(o))},this.addToast=o=>{this.publish(o),this.toasts=[...this.toasts,o]},this.create=o=>{var r;const{message:s,...u}=o,l=typeof(o==null?void 0:o.id)=="number"||((r=o.id)==null?void 0:r.length)>0?o.id:qu++,m=this.toasts.find(h=>h.id===l),c=o.dismissible===void 0?!0:o.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),m?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...o,id:l,title:s}),{...h,...o,id:l,dismissible:c,title:s}):h):this.addToast({title:s,...u,dismissible:c,id:l}),l},this.dismiss=o=>(o?(this.dismissedToasts.add(o),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:o,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),o),this.message=(o,r)=>this.create({...r,message:o}),this.error=(o,r)=>this.create({...r,message:o,type:"error"}),this.success=(o,r)=>this.create({...r,type:"success",message:o}),this.info=(o,r)=>this.create({...r,type:"info",message:o}),this.warning=(o,r)=>this.create({...r,type:"warning",message:o}),this.loading=(o,r)=>this.create({...r,type:"loading",message:o}),this.promise=(o,r)=>{if(!r)return;let s;r.loading!==void 0&&(s=this.create({...r,promise:o,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const u=Promise.resolve(o instanceof Function?o():o);let l=s!==void 0,m;const c=u.then(async d=>{if(m=["resolve",d],pe.isValidElement(d))l=!1,this.create({id:s,type:"default",message:d});else if(Vk(d)&&!d.ok){l=!1;const y=typeof r.error=="function"?await r.error(`HTTP error! status: ${d.status}`):r.error,f=typeof r.description=="function"?await r.description(`HTTP error! status: ${d.status}`):r.description,k=typeof y=="object"&&!pe.isValidElement(y)?y:{message:y};this.create({id:s,type:"error",description:f,...k})}else if(d instanceof Error){l=!1;const y=typeof r.error=="function"?await r.error(d):r.error,Line truncated
`).map((q,I,L)=>B.jsxs("span",{children:[pz(q,c),I<L.length-1&&B.jsx("br",{})]},I)),!Z&&B.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:uh(C.sender_timestamp||C.received_at)}),C.outgoing&&(C.acked>0?` ✓${C.acked>1?C.acked:""}`:" ?")]})]})]},C.id)})]}),y&&B.jsx("button",{onClick:z,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:B.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:B.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const hz=E.forwardRef(function({onSend:o,disabled:r,placeholder:s,isRepeaterMode:u},l){const[m,c]=E.useState(""),[h,d]=E.useState(!1),g=E.useRef(null);E.useImperativeHandle(l,()=>({appendText:k=>{var z;c(v=>v+k),(z=g.current)==null||z.focus()}}));const y=E.useCallback(async k=>{k.preventDefault();const z=m.trim();if(u){if(h||r)return;const v=z==="."?"":z;d(!0);try{await o(v),c("")}catch(j){console.error("Failed to request telemetry:",j);return}finally{d(!1)}setTimeout(()=>{var j;return(j=g.current)==null?void 0:j.focus()},0)}else{if(!z||h||r)return;d(!0);try{await o(z),c("")}catch(v){console.error("Failed to send message:",v);return}finally{d(!1)}setTimeout(()=>{var v;return(v=g.current)==null?void 0:v.focus()},0)}},[m,h,r,o,u]),f=E.useCallback(k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),y(k))},[y]),w=u?m.trim().length>0||m===".":m.trim().length>0;return B.jsxs("form",{className:"px-4 py-3 border-t border-border flex gap-2",onSubmit:y,children:[B.jsx(ji,{ref:g,type:u?"password":"text",value:m,onChange:k=>c(k.target.value),onKeyDown:f,placeholder:s||(u?"Enter password (or . for none)...":"Type a message..."),disabled:r||h,className:"flex-1 min-w-0"}),B.jsx(Ha,{type:"submit",disabled:r||h||!w,className:"flex-shrink-0",children:h?u?"Fetching...":"Sending...":u?"Fetch":"Send"})]})});function Si(a,o,{checkForDefaultPrevented:r=!0}={}){return function(u){if(a==null||a(u),r===!1||!u.defaultPrevented)return o==null?void 0:o(u)}}function gz(a,o){const r=E.createContext(o),s=l=>{const{children:m,...c}=l,h=E.useMemo(()=>c,Object.values(c));return B.jsx(r.Provider,{value:h,children:m})};s.displayName=a+"Provider";function u(l){const m=E.useContext(r);if(m)return m;if(o!==void 0)return o;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[s,u]}function Ho(a,o=[]){let r=[];function s(l,m){const c=E.createContext(m),h=r.length;r=[...r,m];const d=y=>{var j;const{scope:f,children:w,...k}=y,z=((j=f==null?void 0:f[a])==null?void 0:j[h])||c,v=E.useMemo(()=>k,Object.values(k));return B.jsx(z.Provider,{value:v,children:w})};d.displayName=l+"Provider";function g(y,f){var z;const w=((z=f==null?void 0:f[a])==null?void 0:z[h])||c,k=E.useContext(w);if(k)return k;if(m!==void 0)return m;throw new Error(`\`${y}\` must be used within \`${l}\``)}return[d,g]}const u=()=>{const l=r.map(m=>E.createContext(m));return function(c){const h=(c==null?void 0:c[a])||l;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:h}}),[c,h])}};return u.scopeName=a,[s,yz(u,...o)]}function yz(...a){const o=a[0];if(a.length===1)return o;const r=()=>{const s=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(l){const m=s.reduce((c,{useScope:h,scopeName:d})=>{const y=h(l)[`__scope${d}`];return{...c,...y}},{});return E.useMemo(()=>({[`__scope${o.scopeName}`]:m}),[m])}};return r.scopeName=o.scopeName,r}var _r=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},bz=Mu[" useId ".trim().toString()]||(()=>{}),fz=0;function No(a){const[o,r]=E.useState(bz());return _r(()=>{r(s=>s??String(fz++))},[a]),o?`radix-${o}`:""}var vz=Mu[" useInsertionEffect ".trim().toString()]||_r;function sl({prop:a,defaultProp:o,onChange:r=()=>{},caller:s}){const[u,l,m]=kz({defaultProp:o,onChange:r}),c=a!==void 0,h=c?a:u;{const g=E.useRef(a!==void 0);E.useEffect(()=>{const y=g.current;y!==c&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=c},[c,s])}const d=E.useCallback(g=>{var y;if(c){const f=wz(g)?g(a):g;f!==a&&((y=m.current)==null||y.call(m,f))}else l(g)},[c,a,l,m]);return[h,d]}function kz({defaultProp:a,onChange:o}){const[r,s]=E.useState(a),u=E.useRef(r),l=E.useRef(o);return vz(()=>{l.current=o},[o]),E.useEffect(()=>{var m;u.current!==r&&((m=l.current)==null||m.call(l,r),u.current=r)},[r,u]),[r,s,l]}function wz(a){return typeof a=="function"}function zz(a){const o=xz(a),r=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(qz);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.oLine truncated
.`.concat(Zz,` {
overflow: hidden `).concat(s,`;
padding-right: `).concat(c,"px ").concat(s,`;
}
body[`).concat(Er,`] {
overflow: hidden `).concat(s,`;
overscroll-behavior: contain;
`).concat([o&&"position: relative ".concat(s,";"),r==="margin"&&`
padding-left: `.concat(u,`px;
padding-top: `).concat(l,`px;
padding-right: `).concat(m,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(c,"px ").concat(s,`;
`),r==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
}
.`).concat(lt,` {
right: `).concat(c,"px ").concat(s,`;
}
.`).concat(ct,` {
margin-right: `).concat(c,"px ").concat(s,`;
}
.`).concat(lt," .").concat(lt,` {
right: 0 `).concat(s,`;
}
.`).concat(ct," .").concat(ct,` {
margin-right: 0 `).concat(s,`;
}
body[`).concat(Er,`] {
`).concat(Xz,": ").concat(c,`px;
}
`)},vh=function(){var a=parseInt(document.body.getAttribute(Er)||"0",10);return isFinite(a)?a:0},bx=function(){E.useEffect(function(){return document.body.setAttribute(Er,(vh()+1).toString()),function(){var a=vh()-1;a<=0?document.body.removeAttribute(Er):document.body.setAttribute(Er,a.toString())}},[])},fx=function(a){var o=a.noRelative,r=a.noImportant,s=a.gapMode,u=s===void 0?"margin":s;bx();var l=E.useMemo(function(){return hx(u)},[u]);return E.createElement(gx,{styles:yx(l,!o,u,r?"":"!important")})},Su=!1;if(typeof window<"u")try{var nt=Object.defineProperty({},"passive",{get:function(){return Su=!0,!0}});window.addEventListener("test",nt,nt),window.removeEventListener("test",nt,nt)}catch{Su=!1}var jr=Su?{passive:!1}:!1,vx=function(a){return a.tagName==="TEXTAREA"},Cy=function(a,o){if(!(a instanceof Element))return!1;var r=window.getComputedStyle(a);return r[o]!=="hidden"&&!(r.overflowY===r.overflowX&&!vx(a)&&r[o]==="visible")},kx=function(a){return Cy(a,"overflowY")},wx=function(a){return Cy(a,"overflowX")},kh=function(a,o){var r=o.ownerDocument,s=o;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var u=Ey(a,s);if(u){var l=Sy(a,s),m=l[1],c=l[2];if(m>c)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},zx=function(a){var o=a.scrollTop,r=a.scrollHeight,s=a.clientHeight;return[o,r,s]},xx=function(a){var o=a.scrollLeft,r=a.scrollWidth,s=a.clientWidth;return[o,r,s]},Ey=function(a,o){return a==="v"?kx(o):wx(o)},Sy=function(a,o){return a==="v"?zx(o):xx(o)},jx=function(a,o){return a==="h"&&o==="rtl"?-1:1},qx=function(a,o,r,s,u){var l=jx(a,window.getComputedStyle(o).direction),m=l*s,c=r.target,h=o.contains(c),d=!1,g=m>0,y=0,f=0;do{if(!c)break;var w=Sy(a,c),k=w[0],z=w[1],v=w[2],j=z-v-l*k;(k||j)&&Ey(a,c)&&(y+=j,f+=k);var A=c.parentNode;c=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!h&&c!==document.body||h&&(o.contains(c)||o===c));return(g&&Math.abs(y)<1||!g&&Math.abs(f)<1)&&(d=!0),d},rt=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},wh=function(a){return[a.deltaX,a.deltaY]},zh=function(a){return a&&"current"in a?a.current:a},Ax=function(a,o){return a[0]===o[0]&&a[1]===o[1]},Cx=function(a){return`
.block-interactivity-`.concat(a,` {pointer-events: none;}
.allow-interactivity-`).concat(a,` {pointer-events: all;}
`)},Ex=0,qr=[];function Sx(a){var o=E.useRef([]),r=E.useRef([0,0]),s=E.useRef(),u=E.useState(Ex++)[0],l=E.useState(Ay)[0],m=E.useRef(a);E.useEffect(function(){m.current=a},[a]),E.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(u));var z=Yz([a.lockRef.current],(a.shards||[]).map(zh),!0).filter(Boolean);return z.forEach(function(v){return v.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),z.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(u))})}}},[a.inert,a.lockRef.current,a.shards]);var c=E.useCallback(function(z,v){if("touches"in z&&z.touches.length===2||z.type==="wheel"&&z.ctrlKey)return!m.current.allowPinchZoom;var j=rt(z),A=r.current,x="deltaX"in z?z.deltaX:A[0]-j[0],_="deltaY"in z?z.deltaY:A[1]-j[1],C,D=z.target,F=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in z&&F==="h"&&D.type==="range")return!1;var R=window.getSelection(),M=R&&R.anchorNode,P=M?M===D||M.contains(D):!1;if(P)return!1;var T=kh(F,D);if(!T)return!0;if(T?C=F:(C=F==="v"?"h":"v",T=kh(F,D)),!T)return!1;if(!s.current&&"changedTouches"in z&&(x||_)&&(s.current=C),!C)return!0;var U=s.current||C;return qx(U,v,z,U==="h"?x:_)},[]),h=E.useCallback(function(z){var v=z;if(!(!qr.length||qr[qr.length-1]!==l)){var j="deltaY"in v?wh(v):rt(v),A=o.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&Ax(C.delta,j)})[0];if(A&&A.should){v.cancelable&&v.preventDefault();return}if(!A){var x=(m.current.shards||[]).map(zh).filter(Boolean).filter(function(C){return C.contains(v.target)}),_=x.length>0?c(v,x[0]):!m.current.noIsolation;_&&v.cancelable&&v.preventDefault()}}},[]),d=E.useCallback(function(z,v,j,A){var x={name:z,delta:v,target:j,should:A,shadowParent:Bx(j)};o.current.push(x),setTimeout(function(){o.current=o.current.filter(function(_){return _!==x})},1)},[]),g=E.useCallback(function(z){r.current=rt(z),s.current=void 0},[]),y=E.useCallback(function(z){d(z.type,wh(z),z.target,c(z,a.lockRef.current))},[]),f=E.useCallback(function(z){d(z.type,rt(z),z.target,c(z,a.lockRef.current))},[]);E.useEffect(function(){return qr.push(l),a.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:f}),document.addEventListener("wheel",h,jr),document.addEventListener("touchmove",h,jr),document.addEventListener("touchstart",g,jr),function(){qr=qr.filter(function(z){return z!==l}),document.removeEventListener("wheel",h,jr),document.removeEventListener("touchmove",h,jr),document.removeEventListener("touchstart",g,jr)}},[]);var w=a.removeScrollBar,k=a.inert;return E.createElement(E.Fragment,null,k?E.createElement(l,{styles:Cx(u)}):null,w?E.createElement(fx,{noRelative:a.noRelative,gapMode:a.gapMode}):null)}function Bx(a){for(var o=null;a!==null;)a instanceof ShadowRoot&&(o=a.host,a=a.host),a=a.parentNode;return o}const _x=ox(qy,Sx);var By=E.forwardRef(function(a,o){return E.createElement(tl,La({},a,{ref:o,sideCar:_x}))});By.classNames=tl.classNames;var Dx=function(a){if(typeof document>"u")return null;var o=Array.isArray(a)?a[0]:a;return o.ownerDocument.body},Ar=new WeakMap,ot=new WeakMap,st={},yu=0,_y=function(a){return a&&(a.host||_y(a.parentNode))},Fx=function(a,o){return o.map(function(r){if(a.contains(r))return r;var s=_y(r);return s&&a.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",a,". Doing nothing"),null)}).filter(function(r){return!!r})},Rx=function(a,o,r,s){var u=Fx(o,Array.isArray(a)?a:[a]);st[r]||(st[r]=new WeakMap);var l=st[r],m=[],c=new Set,h=new Set(u),d=function(y){!y||c.has(y)||(c.add(y),d(y.parentNode))};u.forEach(d);var g=function(y){!y||h.has(y)||Array.prototype.forEach.call(y.children,function(f){if(c.has(f))g(f);else try{var w=f.getAttribute(s),k=w!==null&&w!=="false",z=(Ar.get(f)||0)+1,v=(l.get(f)||0)+1;Ar.set(f,z),l.set(f,v),m.push(f),z===1&&k&&ot.set(f,!0),v===1&&f.setAttribute(r,"true"),k||f.setAttribute(s,"true")}catch(j){console.error("aria-hidden: cannot operate on ",f,j)}})};return g(o),c.clear(),yu++,function(){m.forEach(function(y){var f=Ar.get(y)-1,w=l.get(y)-1;Ar.set(y,f),l.set(y,w),f||(ot.has(y)||y.removeAttribute(s),ot.delete(y)),w||y.removeAttribute(r)}),yu--,yu||(Ar=new WeakMap,Ar=new WeakMap,ot=new WeakMap,st={})}},Tx=function(a,o,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(a)?a:[a]),u=Dx(a);return u?(s.push.apply(s,Array.from(u.querySelectorAll("[aria-live], script"))),Rx(s,u,r,"aria-hidden")):function(){return null}};function Px(a){const o=Nx(a),r=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(Mx);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(o,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(o,{...m,ref:u,children:l})});return r.displayName=`${a}.Slot`,r}function Nx(a){const o=E.forwardRef((r,s)=>{const{children:u Line truncated
If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;return E.useEffect(()=>{a&&(document.getElementById(a)||console.error(r))},[r,a]),null},Yx="DialogDescriptionWarning",Zx=({contentRef:a,descriptionId:o})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$y(Yx).contentName}}.`;return E.useEffect(()=>{var l;const u=(l=a.current)==null?void 0:l.getAttribute("aria-describedby");o&&u&&(document.getElementById(o)||console.warn(s))},[s,a,o]),null},Gy=Fy,Qy=Py,cl=Ny,ul=Iy,dl=Oy,pl=Hy,Ky=Uy;const Yy=Gy,Xx=Qy,Zy=E.forwardRef(({className:a,...o},r)=>B.jsx(cl,{ref:r,className:$e("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...o}));Zy.displayName=cl.displayName;const $u=E.forwardRef(({className:a,children:o,...r},s)=>B.jsxs(Xx,{children:[B.jsx(Zy,{}),B.jsxs(ul,{ref:s,className:$e("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...r,children:[o,B.jsxs(Ky,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[B.jsx(Xg,{className:"h-4 w-4"}),B.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$u.displayName=ul.displayName;const Gu=({className:a,...o})=>B.jsx("div",{className:$e("flex flex-col space-y-1.5 text-center sm:text-left",a),...o});Gu.displayName="DialogHeader";const Qu=({className:a,...o})=>B.jsx("div",{className:$e("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...o});Qu.displayName="DialogFooter";const Ku=E.forwardRef(({className:a,...o},r)=>B.jsx(dl,{ref:r,className:$e("text-lg font-semibold leading-none tracking-tight",a),...o}));Ku.displayName=dl.displayName;const Jx=E.forwardRef(({className:a,...o},r)=>B.jsx(pl,{ref:r,className:$e("text-sm text-muted-foreground",a),...o}));Jx.displayName=pl.displayName;function xh(a){const o=e0(a),r=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(a0);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(o,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(o,{...m,ref:u,children:l})});return r.displayName=`${a}.Slot`,r}function e0(a){const o=E.forwardRef((r,s)=>{const{children:u,...l}=r;if(E.isValidElement(u)){const m=r0(u),c=n0(l,u.props);return u.type!==E.Fragment&&(c.ref=s?Lo(s,m):m),E.cloneElement(u,c)}return E.Children.count(u)>1?E.Children.only(null):null});return o.displayName=`${a}.SlotClone`,o}var i0=Symbol("radix.slottable");function a0(a){return E.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===i0}function n0(a,o){const r={...o};for(const s in o){const u=a[s],l=o[s];/^on[A-Z]/.test(s)?u&&l?r[s]=(...c)=>{const h=l(...c);return u(...c),h}:u&&(r[s]=u):s==="style"?r[s]={...u,...l}:s==="className"&&(r[s]=[u,l].filter(Boolean).join(" "))}return{...a,...r}}function r0(a){var s,u;let o=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,r=o&&"isReactWarning"in o&&o.isReactWarning;return r?a.ref:(o=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,r=o&&"isReactWarning"in o&&o.isReactWarning,r?a.props.ref:a.props.ref||a.ref)}function o0(a){const o=a+"CollectionProvider",[r,s]=Ho(o),[u,l]=r(o,{collectionRef:{current:null},itemMap:new Map}),m=z=>{const{scope:v,children:j}=z,A=pe.useRef(null),x=pe.useRef(new Map).current;return B.jsx(u,{scope:v,itemMap:x,collectionRef:A,children:j})};m.displayName=o;const c=a+"CollectionSlot",h=xh(c),d=pe.forwardRef((z,v)=>{const{scope:j,children:A}=z,x=l(c,j),_=va(v,x.collectionRef);return B.jsx(h,{ref:_,children:A})});d.displayName=c;const g=a+"CollectionItemSlot",y="data-radix-collection-item",f=xh(g),w=pe.forwardRef((z,v)=>{const{scope:j,children:A,...x}=z,_=pe.useRef(null),C=va(v,_),D=l(g,j);return pe.useEffect(()=>(D.itemMap.set(_,{ref:_,...x}),()=>void D.itemMap.delete(_))),B.jsx(f,{[y]:"",ref:C,children:A})});w.displayName=g;function k(z){const v=l(a+"CollectionConsumer",z);return pe.useCallback(()=>{const A=v.collectionRef.current;if(!A)return[];const x=Array.from(A.querySelectorAll(`[${y}]`));return Array.from(v.itemMap.values()).sort((D,F)=>x.indexOf(D.ref.current)-x.indexOf(F.ref.current))},[v.coll Line truncated
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/return(function(s){var u=r,l=u.lib,m=l.WordArray,c=l.Hasher,h=u.algo,d=m.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),g=m.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),y=m.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=m.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),w=m.create([0,1518500249,1859775393,2400959708,2840853838]),k=m.create([1352829926,1548603684,1836072691,2053994217,0]),z=h.RIPEMD160=c.extend({_doReset:function(){this._hash=m.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(D,F){for(var R=0;R<16;R++){var M=F+R,P=D[M];D[M]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}var T=this._hash.words,U=w.words,H=k.words,K=d.words,ie=g.words,Z=y.words,ae=f.words,W,ne,X,q,I,L,$,le,me,ge;L=W=T[0],$=ne=T[1],le=X=T[2],me=q=T[3],ge=I=T[4];for(var re,R=0;R<80;R+=1)re=W+D[F+K[R]]|0,R<16?re+=v(ne,X,q)+U[0]:R<32?re+=j(ne,X,q)+U[1]:R<48?re+=A(ne,X,q)+U[2]:R<64?re+=x(ne,X,q)+U[3]:re+=_(ne,X,q)+U[4],re=re|0,re=C(re,Z[R]),re=re+I|0,W=I,I=q,q=C(X,10),X=ne,ne=re,re=L+D[F+ie[R]]|0,R<16?re+=_($,le,me)+H[0]:R<32?re+=x($,le,me)+H[1]:R<48?re+=A($,le,me)+H[2]:R<64?re+=j($,le,me)+H[3]:re+=v($,le,me)+H[4],re=re|0,re=C(re,ae[R]),re=re+ge|0,L=ge,ge=me,me=C(le,10),le=$,$=re;re=T[1]+X+me|0,T[1]=T[2]+q+ge|0,T[2]=T[3]+I+L|0,T[3]=T[4]+W+$|0,T[4]=T[0]+ne+le|0,T[0]=re},_doFinalize:function(){var D=this._data,F=D.words,R=this._nDataBytes*8,M=D.sigBytes*8;F[M>>>5]|=128<<24-M%32,F[(M+64>>>9<<4)+14]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,D.sigBytes=(F.length+1)*4,this._process();for(var P=this._hash,T=P.words,U=0;U<5;U++){var H=T[U];T[U]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360}return P},clone:function(){var D=c.clone.call(this);return D._hash=this._hash.clone(),D}});function v(D,F,R){return D^F^R}function j(D,F,R){return D&F|~D&R}function A(D,F,R){return(D|~F)^R}function x(D,F,R){return D&R|F&~R}function _(D,F,R){return D^(F|~R)}function C(D,F){return D<<F|D>>>32-F}u.RIPEMD160=c._createHelper(z),u.HmacRIPEMD160=c._createHmacHelper(z)})(),r.RIPEMD160})})(qt)),qt.exports}var At={exports:{}},gj=At.exports,Vh;function yl(){return Vh||(Vh=1,(function(a,o){(function(r,s){a.exports=s(Me())})(gj,function(r){(function(){var s=r,u=s.lib,l=u.Base,m=s.enc,c=m.Utf8,h=s.algo;h.HMAC=l.extend({init:function(d,g){d=this._hasher=new d.init,typeof g=="string"&&(g=c.parse(g));var y=d.blockSize,f=y*4;g.sigBytes>f&&(g=d.finalize(g)),g.clamp();for(var w=this._oKey=g.clone(),k=this._iKey=g.clone(),z=w.words,v=k.words,j=0;j<y;j++)z[j]^=1549556828,v[j]^=909522486;w.sigBytes=k.sigBytes=f,this.reset()},reset:function(){var d=this._hasher;d.reset(),d.update(this._iKey)},update:function(d){return this._hasher.update(d),this},finalize:function(d){var g=this._hasher,y=g.finalize(d);g.reset();var f=g.finalize(this._oKey.clone().concat(y));return f}})})()})})(At)),At.exports}var Ct={exports:{}},yj=Ct.exports,Uh;function bj(){return Uh||(Uh=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Uo(),yl())})(yj,function(r){return(function(){var s=r,u=s.lib,l=u.Base,m=u.WordArray,c=s.algo,h=c.SHA256,d=c.HMAC,g=c.PBKDF2=l.extend({cfg:l.extend({keySize:128/32,hasher:h,iterations:25e4}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,f){for(var w=this.cfg,k=d.create(w.hasher,y),z=m.create(),v=m.create([1]),j=z.words,A=v.words,x=w.keySize,_=w.iterations;j.length<x;){var C=k.update(f).finalize(v);k.reset();for(var D=C.words,F=D.length,R=C,M=1;M<_;M++){R=k.finalize(R),k.reset();for(var P=R.words,T=0;T<F;T++)D[T]^=P[T]}z.concat(C),A[0]++}return z.sigBytes=x*4,z}});s.PBKDF2=function(y,f,w){return g.create(w).compute(y,f)}})(),r.PBKDF2})})(Ct)),Ct.exports}var Et={exports:{}},fj=Et.exports,Wh;function Cn(){return Wh||(Wh=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Fb(),yl())})(fj,function(r){return(function(){var s=r,u=s.lib,l=u.Base,m=u.WordArray,c=s.algo,h=c.MD5,d=c.EvpKDF=l.extend({cfg:l.extend({keySize:128/32,hasher:h,iterations:1}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,y){for(var f,w=this.cfg,k=w.hasher.create(),z=m.create(),v=z.words,j=w.keySize,A=w.iterations;v.length<j;){f&&k.update(f),f=k.update(g).finalize(y),k.reset();for(var x=1;x<A;x++)f=k.finalize(f),k.reset();z.concat(f)}return z.sigBytes=j*4,z}});s.EvpKDF=function(g,y,f){return d.create(f).compute(g,y)}})(),r.EvpKDF})})(Et)),Et.exports}var St={exports:{}},vj=St.exports,$h;function Ri(Line truncated
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/return r.mode.CTRGladman=(function(){var s=r.lib.BlockCipherMode.extend();function u(c){if((c>>24&255)===255){var h=c>>16&255,d=c>>8&255,g=c&255;h===255?(h=0,d===255?(d=0,g===255?g=0:++g):++d):++h,c=0,c+=h<<16,c+=d<<8,c+=g}else c+=1<<24;return c}function l(c){return(c[0]=u(c[0]))===0&&(c[1]=u(c[1])),c}var m=s.Encryptor=s.extend({processBlock:function(c,h){var d=this._cipher,g=d.blockSize,y=this._iv,f=this._counter;y&&(f=this._counter=y.slice(0),this._iv=void 0),l(f);var w=f.slice(0);d.encryptBlock(w,0);for(var k=0;k<g;k++)c[h+k]^=w[k]}});return s.Decryptor=m,s})(),r.mode.CTRGladman})})(Dt)),Dt.exports}var Ft={exports:{}},Aj=Ft.exports,Yh;function Cj(){return Yh||(Yh=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Ri())})(Aj,function(r){return r.mode.OFB=(function(){var s=r.lib.BlockCipherMode.extend(),u=s.Encryptor=s.extend({processBlock:function(l,m){var c=this._cipher,h=c.blockSize,d=this._iv,g=this._keystream;d&&(g=this._keystream=d.slice(0),this._iv=void 0),c.encryptBlock(g,0);for(var y=0;y<h;y++)l[m+y]^=g[y]}});return s.Decryptor=u,s})(),r.mode.OFB})})(Ft)),Ft.exports}var Rt={exports:{}},Ej=Rt.exports,Zh;function Sj(){return Zh||(Zh=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Ri())})(Ej,function(r){return r.mode.ECB=(function(){var s=r.lib.BlockCipherMode.extend();return s.Encryptor=s.extend({processBlock:function(u,l){this._cipher.encryptBlock(u,l)}}),s.Decryptor=s.extend({processBlock:function(u,l){this._cipher.decryptBlock(u,l)}}),s})(),r.mode.ECB})})(Rt)),Rt.exports}var Tt={exports:{}},Bj=Tt.exports,Xh;function _j(){return Xh||(Xh=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Ri())})(Bj,function(r){return r.pad.AnsiX923={pad:function(s,u){var l=s.sigBytes,m=u*4,c=m-l%m,h=l+c-1;s.clamp(),s.words[h>>>2]|=c<<24-h%4*8,s.sigBytes+=c},unpad:function(s){var u=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=u}},r.pad.Ansix923})})(Tt)),Tt.exports}var Pt={exports:{}},Dj=Pt.exports,Jh;function Fj(){return Jh||(Jh=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Ri())})(Dj,function(r){return r.pad.Iso10126={pad:function(s,u){var l=u*4,m=l-s.sigBytes%l;s.concat(r.lib.WordArray.random(m-1)).concat(r.lib.WordArray.create([m<<24],1))},unpad:function(s){var u=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=u}},r.pad.Iso10126})})(Pt)),Pt.exports}var Nt={exports:{}},Rj=Nt.exports,eg;function Tj(){return eg||(eg=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Ri())})(Rj,function(r){return r.pad.Iso97971={pad:function(s,u){s.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(s,u)},unpad:function(s){r.pad.ZeroPadding.unpad(s),s.sigBytes--}},r.pad.Iso97971})})(Nt)),Nt.exports}var It={exports:{}},Pj=It.exports,ig;function Nj(){return ig||(ig=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Ri())})(Pj,function(r){return r.pad.ZeroPadding={pad:function(s,u){var l=u*4;s.clamp(),s.sigBytes+=l-(s.sigBytes%l||l)},unpad:function(s){for(var u=s.words,l=s.sigBytes-1,l=s.sigBytes-1;l>=0;l--)if(u[l>>>2]>>>24-l%4*8&255){s.sigBytes=l+1;break}}},r.pad.ZeroPadding})})(It)),It.exports}var Mt={exports:{}},Ij=Mt.exports,ag;function Mj(){return ag||(ag=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Ri())})(Ij,function(r){return r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding})})(Mt)),Mt.exports}var Ot={exports:{}},Oj=Ot.exports,ng;function Lj(){return ng||(ng=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Ri())})(Oj,function(r){return(function(s){var u=r,l=u.lib,m=l.CipherParams,c=u.enc,h=c.Hex,d=u.format;d.Hex={stringify:function(g){return g.ciphertext.toString(h)},parse:function(g){var y=h.parse(g);return m.create({ciphertext:y})}}})(),r.format.Hex})})(Ot)),Ot.exports}var Lt={exports:{}},Hj=Lt.exports,rg;function Vj(){return rg||(rg=1,(function(a,o){(function(r,s,u){a.exports=s(Me(),Jn(),er(),Cn(),Ri())})(Hj,function(r){return(function(){var s=r,u=s.lib,l=u.BlockCipher,m=s.algo,c=[],h=[],d=[],g=[],y=[],f=[],w=[],k=[],z=[],v=[];(function(){for(var x=[],_=0;_<256;_++)_<128?x[_]=_<<1:x[_]=_<<1^283;for(var C=0,D=0,_=0;_<256;_++){var F=D^D<<1^D<<2^D<<3^D<<4;F=F>>>8^F&255^99,c[C]=F,h[F]=C;var R=x[C],M=x[R],P=x[M],T=x[F]*257^F*16843008;d[C]=T<<24|T>>>8,g[C]=T<<16|T>>>16,y[C]=T<<8|T>>>24,f[C]=T;var T=P*16843009^M*65537^R*257^C*16843008;w[F]=T<<24|T>>>8,k[F]=T<<16|T>>>16,z[F]=T<<8|T>>>24,v[F]=T,C?(C=R^x[x[x[P^R]]],D^=x[x[D]]):C=D=1}})();var j=[0,1,2,4,8,16,32,64,128,27,54],A=m.AES=l.extend({_doReset:function(){var x;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,C=_.words,D=_.sigBytes/4,F=this._nRounds=D+6,R=(F+1)*4,M=this._keySchedule=[],P=0;P<R;P++)P<D?M[P]=C[P]:(x=M[P-1],P%D?D>6&&P%D==4&&(x=c[x>>>24]<<24|c[x>>>16&255]<<16|c[x>>>8&255]<<8|c[x&255]):(x=x<<8|x>>>24,x=c[x>>>24]<<24|c[x>>>16&255]<<16|c[x>>>8&255]<<8|c[x&255],x^=j[P/D|0]<<24),M[P]=M[P-D]^x);for(var T=this._invKeySchedule=[],U=0;U<R;U++){var P=R-U;if(U%4)var x=M[P];else var x=M[P-4];U<4||P<=4?T[U]=x:T[U]=w[c[x>>>24]]^k[c[x>>>16&255]]^z[c[x>>>8&255]]^v[c[x&255]]}}},encryptBlock:Line truncated
• Timestamp (4 bytes) - send time as unix timestamp
• Request Type (1 byte) - type of request (GetStats, GetTelemetryData, etc.)
• Request Data (remaining bytes) - additional request-specific data`,startByte:c+h,endByte:c+u.length-1,value:f});const w={type:a.PayloadType.Request,version:a.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:a.RequestType.GetStats,requestData:"",destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f};return l!=null&&l.includeSegments&&(w.segments=m),w}catch(m){return{type:a.PayloadType.Request,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode request payload"],timestamp:0,requestType:a.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Ao.RequestPayloadDecoder=r,Ao}var Co={},Cg;function qq(){if(Cg)return Co;Cg=1,Object.defineProperty(Co,"__esModule",{value:!0}),Co.ResponsePayloadDecoder=void 0;const a=ua(),o=Ii();class r{static decode(u,l){try{if(u.length<4){const k={type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(k.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,o.bytesToHex)(u)}]),k}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,o.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:c+h,endByte:c+h,value:g}),h+=1;const y=(0,o.bytesToHex)(u.subarray(h,h+2));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(u.subarray(h));l!=null&&l.includeSegments&&u.length>h&&m.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:c+h,endByte:c+u.length-1,value:f});const w={type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-4};return l!=null&&l.includeSegments&&(w.segments=m),w}catch(m){return{type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Co.ResponsePayloadDecoder=r,Co}var Eo={},Eg;function Aq(){if(Eg)return Eo;Eg=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.AnonRequestPayloadDecoder=void 0;const a=ua(),o=Ii();class r{static decode(u,l){try{if(u.length<35){const k={type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(k.segments=[{name:"Invalid AnonRequest Data",description:"AnonRequest payload too short (minimum 35 bytes required: 1 for dest hash + 32 for public key + 2 for MAC)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,o.bytesToHex)(u)}]),k}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(u[0]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${d}`,startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,o.bytesToHex)(u.subarray(1,33));l!=null&&l.includeSegments&&m.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:c+h,endByte:c+h+31,value:g}),h+=32;const y=(0,o.bytesToHex)(u.subarray(33,35));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(u.subarray(35));l!=null&&l.includeSegments&&u.length>35&&m.push({name:"Ciphertext",description:`Encrypted message data (${u.length-35} bytes). Contains encrypted plaintext with this structure:
• Timestamp (4 bytes) - send time as unix timestamp
• Sync Timestamp (4 bytes) - room server only, sender's "sync messages SINCE x" timestamp
• Password (remaining bytes) - password for repeater/room`,startByte:c+h,endByte:c+u.length-1,value:f});const w={type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,senderPublicKey:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-35};return l!=null&&l.includeSegments&&(w.segments=m),w}catch(m){return{type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Eo.AnonRequestPayloadDecoder=r,Eo}var So={},Sg;function Cq(){if(Sg)return So;Sg=1,Object.defineProperty(So,"__esModule",{value:!0}),So.AckPayloadDecoder=void 0;const a=ua(),o=Ii();class r{static decode(u,l){try{if(u.length<4){const g={type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return l!=null&&l.includeSegments&&(g.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,o.bytesToHex)(u)}]),g}const m=[],c=(l==null?void 0:l.segmentOffset)||0,h=(0,o.bytesToHex)(u.subarray(0,4));l!=null&&l.includeSegments&&m.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${h}`,startByte:c,endByte:c+3,value:h}),l!=null&&l.includeSegments&&u.length>4&&m.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:c+4,endByte:c+u.length-1,value:(0,o.bytesToHex)(u.subarray(4))});const d={type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!0,checksum:h};return l!=null&&l.includeSegments&&(d.segments=m),d}catch(m){return{type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode Ack payload"],checksum:""}}}}return So.AckPayloadDecoder=r,So}var Bo={},Bg;function Eq(){if(Bg)return Bo;Bg=1,Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.PathPayloadDecoder=void 0;const a=ua(),o=Ii();class r{static decode(u){try{if(u.length<2)return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const l=u[0];if(u.length<1+l+1)return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+l+1} bytes for path length + path + extra type)`],pathLength:l,pathHashes:[],extraType:0,extraData:""};const m=[];for(let d=0;d<l;d++)m.push((0,o.byteToHex)(u[1+d]));const c=u[1+l];let h="";return u.length>1+l+1&&(h=(0,o.bytesToHex)(u.subarray(1+l+1))),{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!0,pathLength:l,pathHashes:m,extraType:c,extraData:h}}catch(l){return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:[l instanceof Error?l.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return Bo.PathPayloadDecoder=r,Bo}var _o={},_g;function Sq(){if(_g)return _o;_g=1,Object.defineProperty(_o,"__esModule",{value:!0}),_o.TextMessagePayloadDecoder=void 0;const a=ua(),o=Ii();class r{static decode(u,l){try{if(u.length<4){const k={type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(k.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,o.bytesToHex)(u)}]),k}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,o.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,o.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:c+h,endByte:c+h,value:g}),h+=1;const y=(0,o.bytesToHex)(u.subarray(h,h+2));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,o.bytesToHex)(u.subarray(h));l!=null&&l.includeSegments&&u.length>h&&m.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:c+h,endByte:c+u.length-1,value:f});const w={type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-4};return l!=null&&l.includeSegments&&(w.segments=m),w}catch(m){return{type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,i Line truncated
// SHA256 round constants
const K: array<u32, 64> = array<u32, 64>(
0x428a2f98u, 0x71374491u, 0xb5c0fbcfu, 0xe9b5dba5u, 0x3956c25bu, 0x59f111f1u, 0x923f82a4u, 0xab1c5ed5u,
0xd807aa98u, 0x12835b01u, 0x243185beu, 0x550c7dc3u, 0x72be5d74u, 0x80deb1feu, 0x9bdc06a7u, 0xc19bf174u,
0xe49b69c1u, 0xefbe4786u, 0x0fc19dc6u, 0x240ca1ccu, 0x2de92c6fu, 0x4a7484aau, 0x5cb0a9dcu, 0x76f988dau,
0x983e5152u, 0xa831c66du, 0xb00327c8u, 0xbf597fc7u, 0xc6e00bf3u, 0xd5a79147u, 0x06ca6351u, 0x14292967u,
0x27b70a85u, 0x2e1b2138u, 0x4d2c6dfcu, 0x53380d13u, 0x650a7354u, 0x766a0abbu, 0x81c2c92eu, 0x92722c85u,
0xa2bfe8a1u, 0xa81a664bu, 0xc24b8b70u, 0xc76c51a3u, 0xd192e819u, 0xd6990624u, 0xf40e3585u, 0x106aa070u,
0x19a4c116u, 0x1e376c08u, 0x2748774cu, 0x34b0bcb5u, 0x391c0cb3u, 0x4ed8aa4au, 0x5b9cca4fu, 0x682e6ff3u,
0x748f82eeu, 0x78a5636fu, 0x84c87814u, 0x8cc70208u, 0x90befffau, 0xa4506cebu, 0xbef9a3f7u, 0xc67178f2u
);
// Character lookup table (a-z = 0-25, 0-9 = 26-35, dash = 36)
const CHARS: array<u32, 37> = array<u32, 37>(
0x61u, 0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6au, // a-j
0x6bu, 0x6cu, 0x6du, 0x6eu, 0x6fu, 0x70u, 0x71u, 0x72u, 0x73u, 0x74u, // k-t
0x75u, 0x76u, 0x77u, 0x78u, 0x79u, 0x7au, // u-z
0x30u, 0x31u, 0x32u, 0x33u, 0x34u, 0x35u, 0x36u, 0x37u, 0x38u, 0x39u, // 0-9
0x2du // dash
);
struct Params {
target_channel_hash: u32,
batch_offset: u32,
name_length: u32,
batch_size: u32,
target_mac: u32, // First 2 bytes of target MAC (in high 16 bits)
ciphertext_words: u32, // Number of 32-bit words in ciphertext
ciphertext_len_bits: u32, // Length of ciphertext in bits
verify_mac: u32, // 1 to verify MAC, 0 to skip
}
@group(0) @binding(0) var<uniform> params: Params;
@group(0) @binding(1) var<storage, read_write> match_count: atomic<u32>;
@group(0) @binding(2) var<storage, read_write> match_indices: array<u32>;
@group(0) @binding(3) var<storage, read> ciphertext: array<u32>; // Ciphertext data
fn rotr(x: u32, n: u32) -> u32 {
return (x >> n) | (x << (32u - n));
}
fn ch(x: u32, y: u32, z: u32) -> u32 {
return (x & y) ^ (~x & z);
}
fn maj(x: u32, y: u32, z: u32) -> u32 {
return (x & y) ^ (x & z) ^ (y & z);
}
fn sigma0(x: u32) -> u32 {
return rotr(x, 2u) ^ rotr(x, 13u) ^ rotr(x, 22u);
}
fn sigma1(x: u32) -> u32 {
return rotr(x, 6u) ^ rotr(x, 11u) ^ rotr(x, 25u);
}
fn gamma0(x: u32) -> u32 {
return rotr(x, 7u) ^ rotr(x, 18u) ^ (x >> 3u);
}
fn gamma1(x: u32) -> u32 {
return rotr(x, 17u) ^ rotr(x, 19u) ^ (x >> 10u);
}
// Convert index to room name bytes, returns the hash as a u32 for the first byte check
fn index_to_room_name(idx: u32, length: u32, msg: ptr<function, array<u32, 16>>) -> bool {
// Message starts with '#' (0x23)
var byte_pos = 0u;
var word_idx = 0u;
var current_word = 0x23000000u; // '#' in big-endian position 0
byte_pos = 1u;
var remaining = idx;
var prev_was_dash = false;
// Generate room name from index
for (var i = 0u; i < length; i++) {
let char_count = select(37u, 36u, i == 0u || i == length - 1u); // no dash at start/end
var char_idx = remaining % char_count;
remaining = remaining / char_count;
// Check for consecutive dashes (invalid)
let is_dash = char_idx == 36u && i > 0u && i < length - 1u;
if (is_dash && prev_was_dash) {
return false; // Invalid: consecutive dashes
}
prev_was_dash = is_dash;
// Map char index to actual character
let c = CHARS[char_idx];
// Pack byte into current word (big-endian)
let shift = (3u - byte_pos % 4u) * 8u;
if (byte_pos % 4u == 0u && byte_pos > 0u) {
(*msg)[word_idx] = current_word;
word_idx = word_idx + 1u;
current_word = 0u;
}
current_word = current_word | (c << shift);
byte_pos = byte_pos + 1u;
}
// Add padding: 0x80 followed by zeros, then length in bits
let msg_len_bits = (length + 1u) * 8u; // +1 for '#'
// Add 0x80 padding byte
let shift = (3u - byte_pos % 4u) * 8u;
if (byte_pos % 4u == 0u) {
(*msg)[word_idx] = current_word;
word_idx = word_idx + 1u;
current_word = 0x80000000u;
} else {
current_word = current_word | (0x80u << shift);
}
byte_pos = byte_pos + 1u;
// Store current word
if (byte_pos % 4u == 0u || word_idx < 14u) {
(*msg)[word_idx] = current_word;
word_idx = word_idx + 1u;
}
// Zero-fill until word 14
for (var i = word_idx; i < 14u; i++) {
(*msg)[i] = 0u;
}
// Length in bits (64-bit, but we only use lower 32 bits for short messages)
(*msg)[14u] = 0u;
(*msg)[15u] = msg_len_bits;
return true;
}
fn sha256_block(msg: ptr<function, array<u32, 16>>) -> array<u32, 8> {
// Initialize hash values
var h: array<u32, 8> = array<u32, 8>(
0x6a09e667u, 0xbb67ae85u, 0x3c6ef372u, 0xa54ff53au,
0x510e527fu, 0x9b05688cu, 0x1f83d9abu, 0x5be0cd19u
);
// Message schedule
var w: array<u32, 64>;
for (var i = 0u; i < 16u; i++) {
w[i] = (*msg)[i];
}
for (var i = 16u; i < 64u; i++) {
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
}
// Compression
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
for (var i = 0u; i < 64u; i++) {
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
let t2 = sigma0(a) + maj(a, b, c);
hh = g; g = f; f = e; e = d + t1;
d = c; c = b; b = a; a = t1 + t2;
}
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
return h;
}
// Compute SHA256 of the key (16 bytes) to get channel hash
fn sha256_key(key: array<u32, 4>) -> u32 {
var msg: array<u32, 16>;
// Key bytes (16 bytes = 4 words)
msg[0] = key[0];
msg[1] = key[1];
msg[2] = key[2];
msg[3] = key[3];
// Padding: 0x80 followed by zeros
msg[4] = 0x80000000u;
for (var i = 5u; i < 14u; i++) {
msg[i] = 0u;
}
// Length: 128 bits
msg[14] = 0u;
msg[15] = 128u;
let hash = sha256_block(&msg);
// Return first byte of hash (big-endian)
return hash[0] >> 24u;
}
// HMAC-SHA256 for MAC verification
// Key is 16 bytes (4 words), padded to 32 bytes with zeros for MeshCore
// Returns first 2 bytes of HMAC (as u32 in high 16 bits)
fn hmac_sha256_mac(key: array<u32, 4>, ciphertext_len: u32) -> u32 {
// HMAC: H((K' ^ opad) || H((K' ^ ipad) || message))
// K' is 64 bytes (32 bytes key + 32 bytes zero padding for MeshCore, then padded to 64)
// ipad = 0x36 repeated, opad = 0x5c repeated
// Build padded key (64 bytes = 16 words)
// MeshCore uses 32-byte secret: 16-byte key + 16 zero bytes
var k_pad: array<u32, 16>;
k_pad[0] = key[0];
k_pad[1] = key[1];
k_pad[2] = key[2];
k_pad[3] = key[3];
for (var i = 4u; i < 16u; i++) {
k_pad[i] = 0u;
}
// Inner hash: SHA256((K' ^ ipad) || message)
// First block: K' ^ ipad (64 bytes)
var inner_block: array<u32, 16>;
for (var i = 0u; i < 16u; i++) {
inner_block[i] = k_pad[i] ^ 0x36363636u;
}
// Initialize hash state with first block
var h: array<u32, 8> = sha256_block(&inner_block);
// Process ciphertext blocks (continuing from h state)
let ciphertext_words = params.ciphertext_words;
var word_idx = 0u;
// Process full 64-byte blocks of ciphertext
while (word_idx + 16u <= ciphertext_words) {
var block: array<u32, 16>;
for (var i = 0u; i < 16u; i++) {
block[i] = ciphertext[word_idx + i];
}
h = sha256_block_continue(&block, h);
word_idx = word_idx + 16u;
}
// Final block with remaining ciphertext + padding
var final_block: array<u32, 16>;
var remaining = ciphertext_words - word_idx;
for (var i = 0u; i < 16u; i++) {
if (i < remaining) {
final_block[i] = ciphertext[word_idx + i];
} else if (i == remaining) {
// Add 0x80 padding
final_block[i] = 0x80000000u;
} else {
final_block[i] = 0u;
}
}
// Add length (64 bytes of ipad + ciphertext length)
let total_bits = 512u + params.ciphertext_len_bits;
if (remaining < 14u) {
final_block[14] = 0u;
final_block[15] = total_bits;
h = sha256_block_continue(&final_block, h);
} else {
// Need extra block for length
h = sha256_block_continue(&final_block, h);
var len_block: array<u32, 16>;
for (var i = 0u; i < 14u; i++) {
len_block[i] = 0u;
}
len_block[14] = 0u;
len_block[15] = total_bits;
h = sha256_block_continue(&len_block, h);
}
let inner_hash = h;
// Outer hash: SHA256((K' ^ opad) || inner_hash)
var outer_block: array<u32, 16>;
for (var i = 0u; i < 16u; i++) {
outer_block[i] = k_pad[i] ^ 0x5c5c5c5cu;
}
h = sha256_block(&outer_block);
// Second block: inner_hash (32 bytes) + padding
var hash_block: array<u32, 16>;
for (var i = 0u; i < 8u; i++) {
hash_block[i] = inner_hash[i];
}
hash_block[8] = 0x80000000u;
for (var i = 9u; i < 14u; i++) {
hash_block[i] = 0u;
}
hash_block[14] = 0u;
hash_block[15] = 512u + 256u; // 64 bytes opad + 32 bytes inner hash
h = sha256_block_continue(&hash_block, h);
// Return first 2 bytes (high 16 bits of first word)
return h[0] & 0xFFFF0000u;
}
// SHA256 block computation continuing from existing state
fn sha256_block_continue(msg: ptr<function, array<u32, 16>>, h_in: array<u32, 8>) -> array<u32, 8> {
var h = h_in;
// Message schedule
var w: array<u32, 64>;
for (var i = 0u; i < 16u; i++) {
w[i] = (*msg)[i];
}
for (var i = 16u; i < 64u; i++) {
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
}
// Compression
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
for (var i = 0u; i < 64u; i++) {
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
let t2 = sigma0(a) + maj(a, b, c);
hh = g; g = f; f = e; e = d + t1;
d = c; c = b; b = a; a = t1 + t2;
}
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
return h;
}
// Process a single candidate and record match if found
fn process_candidate(name_idx: u32) {
// Generate message for this room name
var msg: array<u32, 16>;
let valid = index_to_room_name(name_idx, params.name_length, &msg);
if (!valid) {
return;
}
// Compute SHA256("#roomname") - this gives us the key
let key_hash = sha256_block(&msg);
// Take first 16 bytes (4 words) as the key
var key: array<u32, 4>;
key[0] = key_hash[0];
key[1] = key_hash[1];
key[2] = key_hash[2];
key[3] = key_hash[3];
// Compute SHA256(key) to get channel hash
let channel_hash = sha256_key(key);
// Check if channel hash matches target
if (channel_hash != params.target_channel_hash) {
return;
}
// Channel hash matches - verify MAC if enabled
if (params.verify_mac == 1u) {
let computed_mac = hmac_sha256_mac(key, params.ciphertext_len_bits);
if (computed_mac != params.target_mac) {
return;
}
}
// Found a match - record the index
let match_idx = atomicAdd(&match_count, 1u);
if (match_idx < 1024u) { // Limit stored matches
match_indices[match_idx] = name_idx;
}
}
// Each thread processes 16 candidates to amortize thread overhead
const CANDIDATES_PER_THREAD: u32 = 16u;
@compute @workgroup_size(256)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
let base_idx = global_id.x * CANDIDATES_PER_THREAD;
for (var i = 0u; i < CANDIDATES_PER_THREAD; i++) {
let idx = base_idx + i;
if (idx >= params.batch_size) {
return;
}
let name_idx = params.batch_offset + idx;
process_candidate(name_idx);
}
}
`}async init(){if(!navigator.gpu)return console.warn("WebGPU not supported"),!1;try{const o=await navigator.gpu.requestAdapter();if(!o)return console.warn("No GPU adapter found"),!1;this.device=await o.requestDevice(),this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]}),this.paramsBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.matchCountBuffer=this.device.createBuffer({size:4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),this.matchIndicesBuffer=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC});for(let u=0;u<2;u++)this.matchCountReadBuffers[u]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[u]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const r=this.device.createShaderModule({code:this.shaderCode}),s=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:s,compute:{module:r,entryPoint:"main"}}),!0}catch(o){return console.error("WebGPU initialization failed:",o),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(o,r){return Kn(r,o)}countNamesForLength(o){return To(o)}async runBatch(o,r,s,u,l,m){if(!this.device||!this.pipeline||!this.bindGroupLayout||!this.paramsBuffer||!this.matchCountBuffer||!this.matchIndicesBuffer||!this.matchCountReadBuffers[0]||!this.matchCountReadBuffers[1]||!this.matchIndicesReadBuffers[0]||!this.matchIndicesReadBuffers[1])throw new Error("GPU not initialized");const c=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const h=this.matchCountReadBuffers[c],d=this.matchIndicesReadBuffers[c],g=l&&m?1:0;let y,f=0,w=0;if(g){const C=new Uint8Array(l.length/2);for(let P=0;P<C.length;P++)C[P]=parseInt(l.substr(P*2,2),16);f=C.length*8;const D=Math.ceil(C.length/4)*4,F=new Uint8Array(D);F.set(C),y=new Uint32Array(D/4);for(let P=0;P<y.length;P++)y[P]=F[P*4]<<24|F[P*4+1]<<16|F[P*4+2]<<8|F[P*4+3];const R=parseInt(m.substr(0,2),16),M=parseInt(m.substr(2,2),16);w=R<<24|M<<16}else y=new Uint32Array([0]);const k=Math.max(y.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<k)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:k,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=k,this.bindGroupDirty=!0);const z=new Uint32Array([o,s,r,u,w,y.length,f,g]);this.device.queue.writeBuffer(this.paramsBuffer,0,z),this.device.queue.writeBuffer(this.ciphertextBuffer,0,y),this.device.queue.writeBuffer(this.matchCountBuffer,0,fl.ZERO_DATA),(this.bindGroupDirty||!this.bindGroup)&&(this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.paramsBuffer}},{binding:1,resource:{buffer:this.matchCountBuffer}},{binding:2,resource:{buffer:this.matchIndicesBuffer}},{binding:3,resource:{buffer:this.ciphertextBuffer}}]}),this.bindGroupDirty=!1);const v=this.device.createCommandEncoder(),j=v.beginComputePass();j.setPipeline(this.pipeline),j.setBindGroup(0,this.bindGroup),j.dispatchWorkgroups(Math.ceil(u/(256*16))),j.end(),v.copyBufferToBuffer(this.matchCountBuffer,0,h,0,4),v.copyBufferToBuffer(this.matchIndicesBuffer,0,d,0,1024*4),this.device.queue.submit([v.finish()]),await h.mapAsync(GPUMapMode.READ);const x=new Uint32Array(h.getMappedRange())[0];h.unmap();const _=[];if(x>0){await d.mapAsync(GPUMapMode.READ);const C=new Uint32Array(d.getMappedRange());for(let D=0;D<Math.min(x,1024);D++)_.push(C[D]);d.unmap()}return _}destroy(){var o,r,s,u,l,m,c,h;(o=this.paramsBuffer)==null||o.destroy(),(r=this.matchCountBuffer)==null||r.destroy(),(s=this.matchIndicesBuffer)==null||s.destroy(),(u=this.ciphertextBuffer)==null||u.destroy(),(l=this.matchCountReadBuffers[0])==null||l.destroy(),(m=this.matchCountReadBuffers[1])==null||m.destroy(),(c=this.matchIndicesReadBuffers[0])==null||c.destroy(),(h=this.matchIndicesReadBuffers[1])==null||h.destroy(),this.paramsBuffer=null,this.matchCountBuffer=null,this.matchIndicesBuffer=null,this.ciphertextBuffer=null,this.ciphertextBufferSize=0,this.matchCountReadBuffers=[null,null],this.matchIndicesReadBuffers=[null,null],this.currentReadBufferIndex=0,this.bindGroup=null,this.bindGroupDirty=!0,this.device&&(this.device.destroy(),this.device=null),this.pipeline=null,this.bindGroupLayout=null}}fl.ZERO_DATA=new Uint32Array([0]);function Vq(){return typeof navigator<"u"&&"gpu"in navigator}class Lg{runBatch(o,r,s,u,l,m){const c=[],h=o.toString(16).padStart(2,"0") Line truncated
`).map(l=>l.trim().toLowerCase()).filter(l=>l.length>0);this.wordlist=u.filter(Hg)}setWordlist(o){this.wordlist=o.map(r=>r.trim().toLowerCase()).filter(Hg)}abort(){this.abortFlag=!0}isGpuAvailable(){return Vq()}async decodePacket(o){var s;const r=o.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!r||!/^[0-9a-fA-F]+$/.test(r))return null;try{const l=(s=(await Ig.MeshCorePacketDecoder.decodeWithVerification(r,{})).payload)==null?void 0:s.decoded;return!(l!=null&&l.channelHash)||!(l!=null&&l.ciphertext)||!(l!=null&&l.cipherMac)?null:{channelHash:l.channelHash,ciphertext:l.ciphertext,cipherMac:l.cipherMac,isGroupText:!0}}catch{return null}}async crack(o,r,s){this.abortFlag=!1,this.useTimestampFilter=(r==null?void 0:r.useTimestampFilter)??!0,this.useUtf8Filter=(r==null?void 0:r.useUtf8Filter)??!0,this.validSeconds=(r==null?void 0:r.validSeconds)??Tu,this.useCpu=(r==null?void 0:r.forceCpu)??!1;const u=(r==null?void 0:r.maxLength)??8,l=(r==null?void 0:r.startingLength)??1,m=(r==null?void 0:r.useDictionary)??!0,c=(r==null?void 0:r.startFromType)??"bruteforce",h=o.toLowerCase(),d=await this.decodePacket(h);if(!d)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:g,ciphertext:y,cipherMac:f}=d,w=parseInt(g,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new Lg):this.gpuInstance||(this.gpuInstance=new fl,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new Lg));const k=performance.now();let z=0,v=performance.now(),j=l,A=0,x=0,_=!1;if(r!=null&&r.startFrom){const H=r.startFrom.toLowerCase();if(c==="dictionary"){const K=this.wordlist.indexOf(H);K>=0&&(x=K+1)}else{_=!0;const K=Oq(H);K&&(j=Math.max(l,K.length),A=K.index+1,A>=To(j)&&(j++,A=0))}}let C=0;m&&!_&&this.wordlist.length>0&&(C+=this.wordlist.length-x);for(let H=j;H<=u;H++)C+=To(H);C-=A;const D=(H,K,ie)=>{if(!s)return;const ae=(performance.now()-k)/1e3,W=ae>0?Math.round(z/ae):0,ne=C-z,X=W>0?ne/W:0;s({checked:z,total:C,percent:C>0?Math.min(100,z/C*100):0,rateKeysPerSec:W,etaSeconds:X,elapsedSeconds:ae,currentLength:K,currentPosition:ie,phase:H})},F=H=>{if(!af(y,f,H))return{valid:!1};const K=Ig.ChannelCrypto.decryptGroupTextMessage(y,f,H);return!K.success||!K.data?{valid:!1}:this.useTimestampFilter&&!Lq(K.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!Hq(K.data.message)?{valid:!1}:{valid:!0,message:K.data.message}};if(!_&&x===0&&j===l&&A===0){D("public-key",0,Ru);const H=Nu(Yt);if(g===H){const K=F(Yt);if(K.valid)return{found:!0,roomName:Ru,key:Yt,decryptedMessage:K.message}}}if(m&&!_&&this.wordlist.length>0)for(let H=x;H<this.wordlist.length;H++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[H],resumeType:"dictionary"};const K=this.wordlist[H],ie=Pu("#"+K),Z=Nu(ie);if(parseInt(Z,16)===w){const W=F(ie);if(W.valid)return{found:!0,roomName:K,key:ie,decryptedMessage:W.message,resumeFrom:K,resumeType:"dictionary"}}z++;const ae=performance.now();ae-v>=200&&(D("wordlist",K.length,K),v=ae,await new Promise(W=>setTimeout(W,0)))}const R=this.useCpu?1024:32768,M=(r==null?void 0:r.gpuDispatchMs)??1e3;let P=R,T=!1;for(let H=j;H<=u;H++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Kn(H,0)||void 0,resumeType:"bruteforce"};const K=To(H);let ie=H===j?A:0;for(;ie<K;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Kn(H,ie)||void 0,resumeType:"bruteforce"};const Z=Math.min(P,K-ie),ae=performance.now();let W;this.useCpu?W=this.cpuInstance.runBatch(w,H,ie,Z,y,f):W=await this.gpuInstance.runBatch(w,H,ie,Z,y,f);const ne=performance.now()-ae;if(z+=Z,!this.useCpu&&!T&&Z>=R&&ne>0){const q=M/ne,I=Math.round(Z*q),L=Math.pow(2,Math.round(Math.log2(Math.max(R,I))));P=Math.max(R,L),T=!0}for(const q of W){const I=Kn(H,q);if(!I)continue;const L=Pu("#"+I),$=F(L);if($.valid)return{found:!0,roomName:I,key:L,decryptedMessage:$.message,resumeFrom:I,resumeType:"bruteforce"}}ie+=Z;const X=performance.now();if(X-v>=200){const q=Kn(H,Math.min(ie,K-1))||"";D("bruteforce",H,q),v=X,await new Promise(I=>setTimeout(I,0))}}}return{found:!1,resumeFrom:Kn(u,To(u)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}const Qq=["2","1080","10-point","10th","11-point","12-point","16-point","18-point","1st","20-point","2d","2nd","30-30","3d","3-d","3m","3rd","48-point","4-d","4gl","4h","4th","5-point","5-t","5th","6-point","6th","7-point","7th","8-point","8th","9-point","9th","a","a1","a-1","a4","a5","aa","aaa","aaaa","aaaaaa","aaal","aaas","aaberg","aachen","aae","aaee","aaf","aag","aah","aahed","aahing","aahs","aaii","aal","aalborg","aalesund","aalii","aaliis","aals","aalst","aalto","aam","aamsi","aandahl","a-and-r","aani","aao","aap","aapss","aaqbiye","aar","aara","aarau","aarc","aardvark","aardvarks","aardwolf","aardwolves","aaren","aargau","aargh","aarhus","aarika","aaron","aaronic","aaronical","aaronite","aaronitic","aaronsburg","aaronson","aarp","aarrgh","aarrghh","aaru","a Line truncated
NoSleep enabled for older iOS devices. This can interrupt
active or long-running network requests from completing successfully.
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(c=>(this.enabled=!0,c)).catch(c=>{throw this.enabled=!1,c})}disable(){s()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):r()?this.noSleepTimer&&(console.warn(`
NoSleep now disabled for older iOS devices.
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return zu=u,zu}var Zq=Yq();const Xq=Fr(Zq);function Jq({packets:a,channels:o,onChannelCreate:r,onRunningChange:s}){const[u,l]=E.useState(!1),[m,c]=E.useState(6),[h,d]=E.useState(!1),[g,y]=E.useState(!0),[f,w]=E.useState(!1),[k,z]=E.useState(null),[v,j]=E.useState(new Map),[A,x]=E.useState([]),[_,C]=E.useState(!1),[D,F]=E.useState(null),[R,M]=E.useState(null),P=E.useRef(null),T=E.useRef(null),U=E.useRef(!1),H=E.useRef(!1),K=E.useRef(!1),ie=E.useRef(new Map),Z=E.useRef(!1),ae=E.useRef(6),W=E.useRef(!0),ne=E.useRef(!1),X=E.useRef(new Set);E.useEffect(()=>{const ce=new Gq;P.current=ce,F(ce.isGpuAvailable());const qe=new Xq;return T.current=qe,ce.setWordlist(Qq),C(!0),()=>{ce.destroy(),P.current=null,qe.disable(),T.current=null}},[]),E.useEffect(()=>{const ce=()=>{ei.getUndecryptedPacketCount().then(({count:De})=>M(De)).catch(()=>M(null))};ce();const qe=setInterval(ce,3e4);return()=>clearInterval(qe)},[]);const q=new Set(o.map(ce=>ce.key.toUpperCase())),I=a.filter(ce=>ce.payload_type==="GROUP_TEXT"&&!ce.decrypted);E.useEffect(()=>{j(ce=>{const qe=new Map(ce);let De=!1;for(const Pe of I)qe.has(Pe.id)||(qe.set(Pe.id,{packet:Pe,attempts:0,lastAttemptLength:0,status:"pending"}),De=!0);return De?(ie.current=qe,qe):ce})},[I.length]),E.useEffect(()=>{ie.current=v},[v]),E.useEffect(()=>{Z.current=h},[h]),E.useEffect(()=>{ae.current=m},[m]),E.useEffect(()=>{W.current=g},[g]),E.useEffect(()=>{ne.current=f},[f]),E.useEffect(()=>{X.current=new Set(I.map(ce=>ce.id))},[I]),E.useEffect(()=>{s==null||s(u)},[u,s]);const L=Array.from(v.values()).filter(ce=>ce.status==="pending").length,$=Array.from(v.values()).filter(ce=>ce.status==="cracked").length,le=Array.from(v.values()).filter(ce=>ce.status==="failed").length,me=E.useCallback(async()=>{if(K.current||!P.current||!U.current)return;const ce=ie.current;let qe=null,De=null;for(const[He,Oe]of ce.entries())if(Oe.status==="pending"){qe=Oe,De=He;break}if(!qe&&Z.current){const He=Array.from(ce.entries()).filter(([,Oe])=>Oe.status==="failed"&&Oe.lastAttemptLength<10);He.length>0&&(He.sort((Oe,Je)=>Oe[1].lastAttemptLength-Je[1].lastAttemptLength),[De,qe]=He[0])}if(!qe||De===null){U.current&&setTimeout(()=>me(),1e3);return}if(!X.current.has(De)){j(He=>{const Oe=new Map(He);return Oe.delete(De),Oe}),U.current&&setTimeout(()=>me(),10);return}K.current=!0;const Pe=ae.current,ai=qe.lastAttemptLength>0,Re=ai?qe.lastAttemptLength+1:Pe;try{const He=await P.current.crack(qe.packet.data,{maxLength:Re,useTimestampFilter:!0,useUtf8Filter:!0,...ne.current&&{gpuDispatchMs:1e4},...ai&&{useDictionary:!1,startingLength:Re}},Oe=>{z(Oe)});if(H.current){H.current=!1,K.current=!1,z(null);return}if(He.found&&He.roomName&&He.key){j(Ge=>{const ri=new Map(Ge),fi=ri.get(De);return fi&&ri.set(De,{...fi,status:"cracked",attempts:fi.attempts+1,lastAttemptLength:Re}),ri});const Oe={roomName:He.roomName,key:He.key,packetId:De,message:He.decryptedMessage||"",crackedAt:Date.now()};x(Ge=>[...Ge,Oe]);const Je=He.key.toUpperCase();if(!q.has(Je))try{const Ge="#"+He.roomName;await r(Ge,He.key),W.current&&await ei.decryptHistoricalPackets({key_type:"channel",channel_name:Ge})}catch(Ge){console.error("Failed to create channel or decrypt historical:",Ge)}}else j(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}catch(He){console.error("Cracking error:",He),j(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}K.current=!1,z(null),U.current&&setTimeout(()=>me(),100)},[q,r]),ge=()=>{var ce;if(!D){alert("WebGPU is not available in your browser. Please use Chrome 113+ or Edge 113+.");return}l(!0),U.current=!0,H.current=!1,(ce=T.current)==null||ce.enable(),me()},re=()=>{var ce,qe;l(!1),U.current=!1,H.current=!0,(ce=P.current)==null||ce.abort(),(qe=T.current)==null||qe.disable()};return B.jsxs("div",{className:"flex flex-col h-full p-3 gap-3 bg-background border-t border-border",children:[B.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This will attempt to dictionary attack, then brute force GroupText packets as they arrive, testing room names up to the specified length.",B.jsx("strong",{children:" Retry failed at n+1"})," will let the cracker return to the failed queue and pick up messages it couldn't crack, attempting them at one longer length.",B.jsx("strong",{children:" Decrypt historical"})," will run an async job on any room name it finds to see if any historically captured packets will decrypt with that key.",B.jsx("strong",{children:" Turbo mode"})," will push your GPU to the max (target dispatch time of 10s) and may allow accelerated cracking and/or system instability."]}),B.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[B.jsx("button",{onClick:u?re:ge,disabled:!_||D===!1,className:$e("px Line truncated
-537
View File
@@ -1,537 +0,0 @@
var ek=Object.defineProperty;var ik=(a,r,o)=>r in a?ek(a,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[r]=o;var Ln=(a,r,o)=>ik(a,typeof r!="symbol"?r+"":r,o);function ak(a,r){for(var o=0;o<r.length;o++){const s=r[o];if(typeof s!="string"&&!Array.isArray(s)){for(const u in s)if(u!=="default"&&!(u in a)){const l=Object.getOwnPropertyDescriptor(s,u);l&&Object.defineProperty(a,u,l.get?l:{enumerable:!0,get:()=>s[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))s(u);new MutationObserver(u=>{for(const l of u)if(l.type==="childList")for(const m of l.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function o(u){const l={};return u.integrity&&(l.integrity=u.integrity),u.referrerPolicy&&(l.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?l.credentials="include":u.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(u){if(u.ep)return;u.ep=!0;const l=o(u);fetch(u.href,l)}})();var eu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ro(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function $g(a){if(Object.prototype.hasOwnProperty.call(a,"__esModule"))return a;var r=a.default;if(typeof r=="function"){var o=function s(){return this instanceof s?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};o.prototype=r.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(a).forEach(function(s){var u=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(o,s,u.get?u:{enumerable:!0,get:function(){return a[s]}})}),o}var iu={exports:{}},fr={},au={exports:{}},Te={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Hm;function nk(){if(Hm)return Te;Hm=1;var a=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),m=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;function f(j){return j===null||typeof j!="object"?null:(j=y&&j[y]||j["@@iterator"],typeof j=="function"?j:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,x={};function v(j,I,L){this.props=j,this.context=I,this.refs=x,this.updater=L||w}v.prototype.isReactComponent={},v.prototype.setState=function(j,I){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,I,"setState")},v.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function q(){}q.prototype=v.prototype;function A(j,I,L){this.props=j,this.context=I,this.refs=x,this.updater=L||w}var z=A.prototype=new q;z.constructor=A,k(z,v.prototype),z.isPureReactComponent=!0;var _=Array.isArray,C=Object.prototype.hasOwnProperty,D={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function R(j,I,L){var $,le={},me=null,ge=null;if(I!=null)for($ in I.ref!==void 0&&(ge=I.ref),I.key!==void 0&&(me=""+I.key),I)C.call(I,$)&&!F.hasOwnProperty($)&&(le[$]=I[$]);var oe=arguments.length-2;if(oe===1)le.children=L;else if(1<oe){for(var ce=Array(oe),je=0;je<oe;je++)ce[je]=arguments[je+2];le.children=ce}if(j&&j.defaultProps)for($ in oe=j.defaultProps,oe)le[$]===void 0&&(le[$]=oe[$]);return{$$typeof:a,type:j,key:me,ref:ge,props:le,_owner:D.current}}function M(j,I){return{$$typeof:a,type:j.type,key:I,ref:j.ref,props:j.props,_owner:j._owner}}function P(j){return typeof j=="object"&&j!==null&&j.$$typeof===a}function T(j){var I={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(L){return I[L]})}var U=/\/+/g;function H(j,I){return typeof j=="object"&&j!==null&&j.key!=null?T(""+j.key):I.toString(36)}function K(j,I,L,$,le){var me=typeof j;(me==="undefined"||me==="boolean")&&(j=null);var ge=!1;if(j===null)ge=!0;else switch(me){case"string":case"number":ge=!0;break;case"object":switch(j.$$typeof){case a:case r:ge=!0}}if(ge)return ge=j,le=le(ge),j=$===""?"."+H(ge,0):$,_(le)?(L="",j!=null&&(L=j.replace(U,"$&/")+"/"),K(le,I,L,"",function(je){return je})):le!=null&&(P(le)&&(le=M(le,L+(!le.key||ge&&ge.key===le.key?"":(""+le.key).replace(U,"$&/")+"/")+j)),I.push(le)),1;if(ge=0,$=$===""?".":$+":",_(j))for(var oe=0;oe<j.length;oe++){me=j[oe];var ce=$+H(me,oe);ge+=K(me,I,L,ce,le)}else if(ce=f(j),typeof ce=="function")for(j=ce.call(j),oe=0;!(me=j.next()).done;)me=me.value,ce=$+H(me,oe++),ge+=K(me,I,L,ce,le);else if(me==="object")throw I=String(j),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.");return ge}function ie(j,I,L){if(j==null)return j;var $=[],le=0;return K(j,$,"","",function(me){return I.call(L,me,le++)}),$}function Z(j){if(j._status===-1){var I=j._result;I=I(),I.then(function(L){(j._status===0||j._status===-1)&&(j._status=1,j._result=L)},function(L){(j._status===0||j._status===-1)&&(j._status=2,j._result=L)}),j._status===-1&&(j._status=0,j._result=I)}if(j._status===1)return j._result.default;throw j._result}var ae={current:null},W={transition:null},ne={ReactCurrentDispatcher:ae,ReactCurrentBatchConfig:W,ReactCurrentOwner:D};function X(){throw Error("act(...) is not supported in production builds of React.")}return Te.Children={map:ie,forEach:function(j,I,L){ie(j,function(){I.apply(this,arguments)},L)},count:function(j){var I=0;return ie(j,function(){I++}),I},toArray:function(j){return ie(j,function(I){return I})||[]},only:function(j){if(!P(j))throw Error("React.Children.only expected to receive a single React element child.");return j}},Te.Component=v,Te.Fragment=o,Te.Profiler=u,Te.PureComponent=A,Te.StrictMode=s,Te.Suspense=h,Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,Te.act=X,Te.cloneElement=function(j,I,L){if(j==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+j+".");var $=k({},j.props),le=j.key,me=j.ref,ge=j._owner;if(I!=null){if(I.ref!==void 0&&(me=I.ref,ge=D.current),I.key!==void 0&&(le=""+I.key),j.type&&j.type.defaultProps)var oe=j.type.defaultProps;for(ce in I)C.call(I,ce)&&!F.hasOwnProperty(ce)&&($[ce]=I[ce]===void 0&&oe!==void 0?oe[ce]:I[ce])}var ce=arguments.length-2;if(ce===1)$.children=L;else if(1<ce){oe=Array(ce);for(var je=0;je<ce;je++)oe[je]=arguments[je+2];$.children=oe}return{$$typeof:a,type:j.type,key:le,ref:me,props:$,_owner:ge}},Te.createContexLine truncated
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Um;function ok(){if(Um)return fr;Um=1;var a=Iu(),r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,u=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function m(c,h,d){var g,y={},f=null,w=null;d!==void 0&&(f=""+d),h.key!==void 0&&(f=""+h.key),h.ref!==void 0&&(w=h.ref);for(g in h)s.call(h,g)&&!l.hasOwnProperty(g)&&(y[g]=h[g]);if(c&&c.defaultProps)for(g in h=c.defaultProps,h)y[g]===void 0&&(y[g]=h[g]);return{$$typeof:r,type:c,key:f,ref:w,props:y,_owner:u.current}}return fr.Fragment=o,fr.jsx=m,fr.jsxs=m,fr}var Wm;function rk(){return Wm||(Wm=1,iu.exports=ok()),iu.exports}var B=rk(),E=Iu();const pe=Ro(E),Mu=ak({__proto__:null,default:pe},[E]);var Ys={},nu={exports:{}},aa={},ou={exports:{}},ru={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var $m;function sk(){return $m||($m=1,(function(a){function r(W,ne){var X=W.length;W.push(ne);e:for(;0<X;){var j=X-1>>>1,I=W[j];if(0<u(I,ne))W[j]=ne,W[X]=I,X=j;else break e}}function o(W){return W.length===0?null:W[0]}function s(W){if(W.length===0)return null;var ne=W[0],X=W.pop();if(X!==ne){W[0]=X;e:for(var j=0,I=W.length,L=I>>>1;j<L;){var $=2*(j+1)-1,le=W[$],me=$+1,ge=W[me];if(0>u(le,X))me<I&&0>u(ge,le)?(W[j]=ge,W[me]=X,j=me):(W[j]=le,W[$]=X,j=$);else if(me<I&&0>u(ge,X))W[j]=ge,W[me]=X,j=me;else break e}}return ne}function u(W,ne){var X=W.sortIndex-ne.sortIndex;return X!==0?X:W.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;a.unstable_now=function(){return l.now()}}else{var m=Date,c=m.now();a.unstable_now=function(){return m.now()-c}}var h=[],d=[],g=1,y=null,f=3,w=!1,k=!1,x=!1,v=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function z(W){for(var ne=o(d);ne!==null;){if(ne.callback===null)s(d);else if(ne.startTime<=W)s(d),ne.sortIndex=ne.expirationTime,r(h,ne);else break;ne=o(d)}}function _(W){if(x=!1,z(W),!k)if(o(h)!==null)k=!0,Z(C);else{var ne=o(d);ne!==null&&ae(_,ne.startTime-W)}}function C(W,ne){k=!1,x&&(x=!1,q(R),R=-1),w=!0;var X=f;try{for(z(ne),y=o(h);y!==null&&(!(y.expirationTime>ne)||W&&!T());){var j=y.callback;if(typeof j=="function"){y.callback=null,f=y.priorityLevel;var I=j(y.expirationTime<=ne);ne=a.unstable_now(),typeof I=="function"?y.callback=I:y===o(h)&&s(h),z(ne)}else s(h);y=o(h)}if(y!==null)var L=!0;else{var $=o(d);$!==null&&ae(_,$.startTime-ne),L=!1}return L}finally{y=null,f=X,w=!1}}var D=!1,F=null,R=-1,M=5,P=-1;function T(){return!(a.unstable_now()-P<M)}function U(){if(F!==null){var W=a.unstable_now();P=W;var ne=!0;try{ne=F(!0,W)}finally{ne?H():(D=!1,F=null)}}else D=!1}var H;if(typeof A=="function")H=function(){A(U)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,ie=K.port2;K.port1.onmessage=U,H=function(){ie.postMessage(null)}}else H=function(){v(U,0)};function Z(W){F=W,D||(D=!0,H())}function ae(W,ne){R=v(function(){W(a.unstable_now())},ne)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(W){W.callback=null},a.unstable_continueExecution=function(){k||w||(k=!0,Z(C))},a.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<W?Math.floor(1e3/W):5},a.unstable_getCurrentPriorityLevel=function(){return f},a.unstable_getFirstCallbackNode=function(){return o(h)},a.unstable_next=function(W){switch(f){case 1:case 2:case 3:var ne=3;break;default:ne=f}var X=f;f=ne;try{return W()}finally{f=X}},a.unstable_pauseExecution=function(){},a.unstable_requestPaint=function(){},a.unstable_runWithPriority=function(W,ne){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var X=f;f=W;try{return ne()}finally{f=X}},a.unstable_scheduleCallback=function(W,ne,X){var j=a.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?j+X:j):X=j,W){case 1:var I=-1;break;case 2:I=250;break;case 5:I=1073741823;break;case 4:I=1e4;break;default:I=5e3}return I=X+I,W={id:g++,callback:ne,priorityLevel:W,startTime:X,expirationTime:I,sortIndex:-1},X>j?(W.sortIndex=X,r(d,W),o(h)===null&&W===o(d)&&(x?(q(R),R=-1):x=!0,ae(_,X-j))):(W.sortIndex=I,r(h,W),k||w||(k=!0,Z(C))),W},a.unstable_shouldYield=T,a.unstable_wrapCallback=function(W){var ne=f;return function(){var X=f;f=ne;try{return W.apply(this,arguments)}finally{f=X}}}})(ru)),ru}var Gm;function tk(){return Gm||(Gm=1,ou.exports=sk()),ou.exports}/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Qm;function lk(){if(Qm)return aa;Qm=1;var a=Iu(),r=tk();function o(e){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)i+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,u={};function l(e,i){m(e,i),m(e+"Capture",i)}function m(e,i){for(u[e]=i,e=0;e<i.length;e++)s.add(i[e])}var c=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,g={},y={};function f(e){return h.call(y,e)?!0:h.call(g,e)?!1:d.test(e)?y[e]=!0:(g[e]=!0,!1)}function w(e,i,n,t){if(n!==null&&n.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return t?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function k(e,i,n,t){if(i===null||typeof i>"u"||w(e,i,n,t))return!0;if(t)return!1;if(n!==null)switch(n.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function x(e,i,n,t,p,b,S){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=t,this.attributeNamespace=p,this.mustUseProperty=n,this.propertyName=e,this.type=i,this.sanitizeURL=b,this.removeEmptyString=S}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){v[e]=new x(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var i=e[0];v[i]=new x(i,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){v[e]=new x(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){v[e]=new x(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){v[e]=new x(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){v[e]=new x(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){v[e]=new x(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){v[e]=new x(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){v[e]=new x(e,5,!1,e.toLowerCase(),null,!1,!1)});var q=/[\-:]([a-z])/g;function A(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var i=e.replace(q,A);v[i]=new x(i,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var i=e.replace(q,A);v[i]=new x(i,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var i=e.replace(q,A);v[i]=new x(i,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){v[e]=new x(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){v[e]=new x(e,1,!1,e.toLowerCase(),null,!0,!0)});function z(e,i,n,t){var p=v.hasOwnProperty(i)?v[i]:null;(p!==null?p.type!==0:t||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!= Line truncated
`+j+e}var L=!1;function $(e,i){if(!e||L)return"";L=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(Y){var t=Y}Reflect.construct(e,[],i)}else{try{i.call()}catch(Y){t=Y}e.call(i.prototype)}else{try{throw Error()}catch(Y){t=Y}e()}}catch(Y){if(Y&&t&&typeof Y.stack=="string"){for(var p=Y.stack.split(`
`),b=t.stack.split(`
`),S=p.length-1,N=b.length-1;1<=S&&0<=N&&p[S]!==b[N];)N--;for(;1<=S&&0<=N;S--,N--)if(p[S]!==b[N]){if(S!==1||N!==1)do if(S--,N--,0>N||p[S]!==b[N]){var O=`
`+p[S].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),O}while(1<=S&&0<=N);break}}}finally{L=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?I(e):""}function le(e){switch(e.tag){case 5:return I(e.type);case 16:return I("Lazy");case 13:return I("Suspense");case 19:return I("SuspenseList");case 0:case 2:case 15:return e=$(e.type,!1),e;case 11:return e=$(e.type.render,!1),e;case 1:return e=$(e.type,!0),e;default:return""}}function me(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case F:return"Fragment";case D:return"Portal";case M:return"Profiler";case R:return"StrictMode";case H:return"Suspense";case K:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:return(e.displayName||"Context")+".Consumer";case P:return(e._context.displayName||"Context")+".Provider";case U:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return i=e.displayName||null,i!==null?i:me(e.type)||"Memo";case Z:i=e._payload,e=e._init;try{return me(e(i))}catch{}}return null}function ge(e){var i=e.type;switch(e.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=i.render,e=e.displayName||e.name||"",i.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(i);case 8:return i===R?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function oe(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ce(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function je(e){var i=ce(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,i),t=""+e[i];if(!e.hasOwnProperty(i)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var p=n.get,b=n.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return p.call(this)},set:function(S){t=""+S,b.call(this,S)}}),Object.defineProperty(e,i,{enumerable:n.enumerable}),{getValue:function(){return t},setValue:function(S){t=""+S},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function De(e){e._valueTracker||(e._valueTracker=je(e))}function Pe(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var n=i.getValue(),t="";return e&&(t=ce(e)?e.checked?"true":"false":e.value),e=t,e!==n?(i.setValue(e),!0):!1}function ai(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Re(e,i){var n=i.checked;return X({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function He(e,i){var n=i.defaultValue==null?"":i.defaultValue,t=i.checked!=null?i.checked:i.defaultChecked;n=oe(i.value!=null?i.value:n),e._wrapperState={initialChecked:t,initialValue:n,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function Oe(e,i){i=i.checked,i!=null&&z(e,"checked",i,!1)}function Je(e,i){Oe(e,i);var n=oe(i.value),t=i.type;if(n!=null)t==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(t==="submit"||t==="reset"){e.removeAttribute("value");return}i.hasOwnProperty("value")?oi(e,i.type,n):i.hasOwnProperty("defaultValue")&&oi(e,i.type,oe(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(e.defaultChecked=!!i.defaultChecked)}function Ge(e,i,n){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var t=i.type;if(!(t!=="submit"&&t!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+e._wrapperState.initialValue,n||i===e.value||(e.value=i),e.defaultValue=i}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function oi(e,i,n){(i!=="number"||ai(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var fi=Array.isArray;function ti(e,i,n,t){if(e=e.options,i){i={};for(var p=0;p<n.length;p++)i["$"+n[p]]=!0;for(n=0;n<e.length;n++)p=i.hasOwnProperty("$"+e[n].value),e[n].selected!==p&&(e[n].selected=p),p&&t&&(e[n].defaultSelected=!0)}else{for(n=""+oe(n),i=null,p=0;p<e.length;p++){if(e[p].value===n){e[p].selected=!0,t&&(e[p].defaultSelected=!0);return}i!==null||e[p].disabled||(i=e[p])}i!==null&&(i.selected=!0)}}function Ve(e,i){if(i.dangerouslySetInnerHTML!= Line truncated
`).replace(mv,"")}function cs(e,i,n){if(i=tp(i),tp(e)!==i&&n)throw Error(o(425))}function us(){}var Wl=null,$l=null;function Gl(e,i){return e==="textarea"||e==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Ql=typeof setTimeout=="function"?setTimeout:void 0,hv=typeof clearTimeout=="function"?clearTimeout:void 0,lp=typeof Promise=="function"?Promise:void 0,gv=typeof queueMicrotask=="function"?queueMicrotask:typeof lp<"u"?function(e){return lp.resolve(null).then(e).catch(yv)}:Ql;function yv(e){setTimeout(function(){throw e})}function Kl(e,i){var n=i,t=0;do{var p=n.nextSibling;if(e.removeChild(n),p&&p.nodeType===8)if(n=p.data,n==="/$"){if(t===0){e.removeChild(p),Wo(i);return}t--}else n!=="$"&&n!=="$?"&&n!=="$!"||t++;n=p}while(n);Wo(i)}function un(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return e}function cp(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(i===0)return e;i--}else n==="/$"&&i++}e=e.previousSibling}return null}var to=Math.random().toString(36).slice(2),Ra="__reactFiber$"+to,ar="__reactProps$"+to,Ua="__reactContainer$"+to,Yl="__reactEvents$"+to,bv="__reactListeners$"+to,fv="__reactHandles$"+to;function Sn(e){var i=e[Ra];if(i)return i;for(var n=e.parentNode;n;){if(i=n[Ua]||n[Ra]){if(n=i.alternate,i.child!==null||n!==null&&n.child!==null)for(e=cp(e);e!==null;){if(n=e[Ra])return n;e=cp(e)}return i}e=n,n=e.parentNode}return null}function nr(e){return e=e[Ra]||e[Ua],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function lo(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(o(33))}function ds(e){return e[ar]||null}var Zl=[],co=-1;function dn(e){return{current:e}}function ui(e){0>co||(e.current=Zl[co],Zl[co]=null,co--)}function si(e,i){co++,Zl[co]=e.current,e.current=i}var pn={},Oi=dn(pn),Zi=dn(!1),Bn=pn;function uo(e,i){var n=e.type.contextTypes;if(!n)return pn;var t=e.stateNode;if(t&&t.__reactInternalMemoizedUnmaskedChildContext===i)return t.__reactInternalMemoizedMaskedChildContext;var p={},b;for(b in n)p[b]=i[b];return t&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=p),p}function Xi(e){return e=e.childContextTypes,e!=null}function ps(){ui(Zi),ui(Oi)}function up(e,i,n){if(Oi.current!==pn)throw Error(o(168));si(Oi,i),si(Zi,n)}function dp(e,i,n){var t=e.stateNode;if(i=i.childContextTypes,typeof t.getChildContext!="function")return n;t=t.getChildContext();for(var p in t)if(!(p in i))throw Error(o(108,ge(e)||"Unknown",p));return X({},n,t)}function ms(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pn,Bn=Oi.current,si(Oi,e),si(Zi,Zi.current),!0}function pp(e,i,n){var t=e.stateNode;if(!t)throw Error(o(169));n?(e=dp(e,i,Bn),t.__reactInternalMemoizedMergedChildContext=e,ui(Zi),ui(Oi),si(Oi,e)):ui(Zi),si(Zi,n)}var Wa=null,hs=!1,Xl=!1;function mp(e){Wa===null?Wa=[e]:Wa.push(e)}function vv(e){hs=!0,mp(e)}function mn(){if(!Xl&&Wa!==null){Xl=!0;var e=0,i=ii;try{var n=Wa;for(ii=1;e<n.length;e++){var t=n[e];do t=t(!0);while(t!==null)}Wa=null,hs=!1}catch(p){throw Wa!==null&&(Wa=Wa.slice(e+1)),gd(kl,mn),p}finally{ii=i,Xl=!1}}return null}var po=[],mo=0,gs=null,ys=0,pa=[],ma=0,_n=null,$a=1,Ga="";function Dn(e,i){po[mo++]=ys,po[mo++]=gs,gs=e,ys=i}function hp(e,i,n){pa[ma++]=$a,pa[ma++]=Ga,pa[ma++]=_n,_n=e;var t=$a;e=Ga;var p=32-za(t)-1;t&=~(1<<p),n+=1;var b=32-za(i)+p;if(30<b){var S=p-p%5;b=(t&(1<<S)-1).toString(32),t>>=S,p-=S,$a=1<<32-za(i)+p|n<<p|t,Ga=b+e}else $a=1<<b|n<<p|t,Ga=e}function Jl(e){e.return!==null&&(Dn(e,1),hp(e,1,0))}function ec(e){for(;e===gs;)gs=po[--mo],po[mo]=null,ys=po[--mo],po[mo]=null;for(;e===_n;)_n=pa[--ma],pa[ma]=null,Ga=pa[--ma],pa[ma]=null,$a=pa[--ma],pa[ma]=null}var sa=null,ta=null,di=!1,ja=null;function gp(e,i){var n=ba(5,null,null,0);n.elementType="DELETED",n.stateNode=i,n.return=e,i=e.deletions,i===null?(e.deletions=[n],e.flags|=16):i.push(n)}function yp(e,i){switch(e.tag){case 5:var n=e.type;return i=i.nodeType!==1||n.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(e.stateNode=i,sa=e,ta=un(i.firstChild),!0):!1;case 6:return i=e.pendingProps===""||i.nodeType!==3?null:i,i!==null?(e.stateNode=i,sa=e,ta=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(n=_n!==null?{id:$a,overflow:Ga}:null,e.memoizedState={dehydrated:i,treeContext:n,retryLane:1073741824},n=ba(18,null,null,0),n.stateNode=i,n.return=e,e.child=n,sa=e,ta=null,!0):!1;default:return!1}}function ic(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ac(e){if(di){var i=ta;if(i){var n=i;if(!yp(e,i)){if(ic(e))throw Error(o(418));i=un(n.nextSibling);var t=sa;i&&yp(e,i)?gp(t,n):(e.flags=e.flags&-4097|2,di=!1,sa=e)}}else{if(ic(e))throw Error(o(418));e.flags=e.flags&-4097|2,di=!1,sa=e}}}function bp(e){for(e=e. Line truncated
Error generating stack: `+b.message+`
`+b.stack}return{value:e,source:i,stack:p,digest:null}}function qc(e,i,n){return{value:e,source:null,stack:n??null,digest:i??null}}function jc(e,i){try{console.error(i.value)}catch(n){setTimeout(function(){throw n})}}var Ev=typeof WeakMap=="function"?WeakMap:Map;function Zp(e,i,n){n=Ka(-1,n),n.tag=3,n.payload={element:null};var t=i.value;return n.callback=function(){Ps||(Ps=!0,Oc=t),jc(e,i)},n}function Xp(e,i,n){n=Ka(-1,n),n.tag=3;var t=e.type.getDerivedStateFromError;if(typeof t=="function"){var p=i.value;n.payload=function(){return t(p)},n.callback=function(){jc(e,i)}}var b=e.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(n.callback=function(){jc(e,i),typeof t!="function"&&(bn===null?bn=new Set([this]):bn.add(this));var S=i.stack;this.componentDidCatch(i.value,{componentStack:S!==null?S:""})}),n}function Jp(e,i,n){var t=e.pingCache;if(t===null){t=e.pingCache=new Ev;var p=new Set;t.set(i,p)}else p=t.get(i),p===void 0&&(p=new Set,t.set(i,p));p.has(n)||(p.add(n),e=Hv.bind(null,e,i,n),i.then(e,e))}function em(e){do{var i;if((i=e.tag===13)&&(i=e.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return e;e=e.return}while(e!==null);return null}function im(e,i,n,t,p){return(e.mode&1)===0?(e===i?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(i=Ka(-1,1),i.tag=2,gn(n,i,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=p,e)}var Sv=_.ReactCurrentOwner,Ji=!1;function $i(e,i,n,t){i.child=e===null?wp(i,null,n,t):go(i,e.child,n,t)}function am(e,i,n,t,p){n=n.render;var b=i.ref;return bo(i,p),t=yc(e,i,n,t,b,p),n=bc(),e!==null&&!Ji?(i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~p,Ya(e,i,p)):(di&&n&&Jl(i),i.flags|=1,$i(e,i,t,p),i.child)}function nm(e,i,n,t,p){if(e===null){var b=n.type;return typeof b=="function"&&!Gc(b)&&b.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(i.tag=15,i.type=b,om(e,i,b,t,p)):(e=Hs(n.type,null,t,i,i.mode,p),e.ref=i.ref,e.return=i,i.child=e)}if(b=e.child,(e.lanes&p)===0){var S=b.memoizedProps;if(n=n.compare,n=n!==null?n:Zo,n(S,t)&&e.ref===i.ref)return Ya(e,i,p)}return i.flags|=1,e=wn(b,t),e.ref=i.ref,e.return=i,i.child=e}function om(e,i,n,t,p){if(e!==null){var b=e.memoizedProps;if(Zo(b,t)&&e.ref===i.ref)if(Ji=!1,i.pendingProps=t=b,(e.lanes&p)!==0)(e.flags&131072)!==0&&(Ji=!0);else return i.lanes=e.lanes,Ya(e,i,p)}return Ac(e,i,n,t,p)}function rm(e,i,n){var t=i.pendingProps,p=t.children,b=e!==null?e.memoizedState:null;if(t.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},si(wo,la),la|=n;else{if((n&1073741824)===0)return e=b!==null?b.baseLanes|n:n,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:e,cachePool:null,transitions:null},i.updateQueue=null,si(wo,la),la|=e,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},t=b!==null?b.baseLanes:n,si(wo,la),la|=t}else b!==null?(t=b.baseLanes|n,i.memoizedState=null):t=n,si(wo,la),la|=t;return $i(e,i,p,n),i.child}function sm(e,i){var n=i.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(i.flags|=512,i.flags|=2097152)}function Ac(e,i,n,t,p){var b=Xi(n)?Bn:Oi.current;return b=uo(i,b),bo(i,p),n=yc(e,i,n,t,b,p),t=bc(),e!==null&&!Ji?(i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~p,Ya(e,i,p)):(di&&t&&Jl(i),i.flags|=1,$i(e,i,n,p),i.child)}function tm(e,i,n,t,p){if(Xi(n)){var b=!0;ms(i)}else b=!1;if(bo(i,p),i.stateNode===null)_s(e,i),Kp(i,n,t),zc(i,n,t,p),t=!0;else if(e===null){var S=i.stateNode,N=i.memoizedProps;S.props=N;var O=S.context,Y=n.contextType;typeof Y=="object"&&Y!==null?Y=ha(Y):(Y=Xi(n)?Bn:Oi.current,Y=uo(i,Y));var se=n.getDerivedStateFromProps,te=typeof se=="function"||typeof S.getSnapshotBeforeUpdate=="function";te||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(N!==t||O!==Y)&&Yp(i,S,t,Y),hn=!1;var re=i.memoizedState;S.state=re,xs(i,t,S,p),O=i.memoizedState,N!==t||re!==O||Zi.current||hn?(typeof se=="function"&&(xc(i,n,se,t),O=i.memoizedState),(N=hn||Qp(i,n,N,t,re,O,Y))?(te||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(i.flags|=4194308)):(typeof S.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=t,i.memoizedState=O),S.props=t,S.state=O,S.context=Y,t=N):(typeof S.componentDidMount=="function"&&(i.flags|=4194308),t=!1)}else{S=i.stateNode,zp(e,i),N=i.memoizedProps,Y=i.type===i.elementType?N:Aa(i.type,N),S.props=Y,te=i.pendingProps,re=S.context,O=n.contextType,typeof O=="object"&&O!==null?O=ha(O):(O=Xi(n)?Bn:Oi.current,O=uo(i,O));var ye=n.getDerivedStateFromProps;(se=typeof ye=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(N!==te||re!==O)&&Yp(i,S,t,O),hn=!1,re=i.memoizedState,S Line truncated
`)}function hk(a){if(a.length===0)return`Neighbors
No neighbors reported`;const r=[...a].sort((s,u)=>u.snr-s.snr),o=[`Neighbors (${r.length})`];for(const s of r){const u=s.name||s.pubkey_prefix,l=s.snr>=0?`+${s.snr.toFixed(1)}`:s.snr.toFixed(1);o.push(`${u}, ${l} dB [${tt(s.last_heard_seconds)} ago]`)}return o.join(`
`)}function gk(a){if(a.length===0)return`ACL
No ACL entries`;const r=[`ACL (${a.length})`];for(const o of a){const s=o.name||o.pubkey_prefix;r.push(`${s}: ${o.permission_name}`)}return r.join(`
`)}function Hn(a,r,o,s=0){const u=Math.floor(Date.now()/1e3);return{id:-Date.now()-s,type:"PRIV",conversation_key:a,text:r,sender_timestamp:u,received_at:u,path_len:null,txt_type:0,signature:null,outgoing:o,acked:1}}function yk(a,r,o){const[s,u]=E.useState(!1);E.useEffect(()=>{u(!1)},[a==null?void 0:a.id]);const l=E.useMemo(()=>{if(!a||a.type!=="contact")return!1;const h=r.find(d=>d.public_key===a.id);return(h==null?void 0:h.type)===Qg},[a,r]),m=E.useCallback(async h=>{if(!(!a||a.type!=="contact")&&l)try{const d=await ei.requestTelemetry(a.id,h),g=Hn(a.id,mk(d),!1,0),y=Hn(a.id,hk(d.neighbors),!1,1),f=Hn(a.id,gk(d.acl),!1,2);o(w=>[...w,g,y,f]),u(!0)}catch(d){const g=Hn(a.id,`Telemetry request failed: ${d instanceof Error?d.message:"Unknown error"}`,!1,0);o(y=>[...y,g])}},[a,l,o]),c=E.useCallback(async h=>{if(!a||a.type!=="contact"||!l||!s)return;const d=Hn(a.id,`> ${h}`,!0,0);o(g=>[...g,d]);try{const g=await ei.sendRepeaterCommand(a.id,h),y=Hn(a.id,g.response,!1,1);g.sender_timestamp&&(y.sender_timestamp=g.sender_timestamp),o(f=>[...f,y])}catch(g){const y=Hn(a.id,`Command failed: ${g instanceof Error?g.message:"Unknown error"}`,!1,1);o(f=>[...f,y])}},[a,l,s,o]);return{repeaterLoggedIn:s,activeContactIsRepeater:l,handleTelemetryRequest:m,handleRepeaterCommand:c}}const bk=12;function _o(a){return a.slice(0,bk)}function Kg(a,r){return!a||!r?!1:_o(a)===_o(r)}function Yn(a,r){return a||_o(r)}const zu="remoteterm-lastMessageTime",qu="remoteterm-lastReadTime";function ol(a){try{const r=localStorage.getItem(a);return r?JSON.parse(r):{}}catch{return{}}}function Yg(a,r){try{localStorage.setItem(a,JSON.stringify(r))}catch{}}function Zm(){return ol(zu)}function fk(){return ol(qu)}function su(a,r){const o=ol(zu);return(!o[a]||r>o[a])&&(o[a]=r,Yg(zu,o)),o}function Zs(a,r){const o=ol(qu);return o[a]=r,Yg(qu,o),o}function fa(a,r){return a==="channel"?`channel-${r}`:`contact-${_o(r)}`}function vk(a,r,o){const[s,u]=E.useState({}),[l,m]=E.useState(Zm),c=E.useRef(new Set),h=E.useRef(new Set);E.useEffect(()=>{const w=a.filter(v=>!c.current.has(v.key)),k=r.filter(v=>v.public_key&&!h.current.has(v.public_key));if(w.length===0&&k.length===0)return;w.forEach(v=>c.current.add(v.key)),k.forEach(v=>h.current.add(v.public_key)),(async()=>{const v=[...w.map(q=>({type:"CHAN",conversation_key:q.key})),...k.map(q=>({type:"PRIV",conversation_key:q.public_key}))];if(v.length!==0)try{const q=await ei.getMessagesBulk(v,100),A=fk(),z={},_={};for(const C of w){const D=q[`CHAN:${C.key}`]||[];if(D.length>0){const F=fa("channel",C.key),R=A[F]||0,M=D.filter(T=>!T.outgoing&&T.received_at>R).length;M>0&&(z[F]=M);const P=Math.max(...D.map(T=>T.received_at));_[F]=P,su(F,P)}}for(const C of k){const D=q[`PRIV:${C.public_key}`]||[];if(D.length>0){const F=fa("contact",C.public_key),R=A[F]||0,M=D.filter(T=>!T.outgoing&&T.received_at>R).length;M>0&&(z[F]=M);const P=Math.max(...D.map(T=>T.received_at));_[F]=P,su(F,P)}}Object.keys(z).length>0&&u(C=>({...C,...z})),m(Zm())}catch(q){console.error("Failed to fetch messages bulk:",q)}})()},[a,r]),E.useEffect(()=>{if(o&&o.type!=="raw"){const w=fa(o.type,o.id),k=Math.floor(Date.now()/1e3);Zs(w,k),u(x=>{if(x[w]){const v={...x};return delete v[w],v}return x})}},[o]);const d=E.useCallback(w=>{u(k=>({...k,[w]:(k[w]||0)+1}))},[]),g=E.useCallback(()=>{const w=Math.floor(Date.now()/1e3);for(const k of a){const x=fa("channel",k.key);Zs(x,w)}for(const k of r)if(k.public_key){const x=fa("contact",k.public_key);Zs(x,w)}u({})},[a,r]),y=E.useCallback(w=>{if(w.type==="raw")return;const k=fa(w.type,w.id),x=Math.floor(Date.now()/1e3);Zs(k,x),u(v=>{if(v[k]){const q={...v};return delete q[k],q}return v})},[]),f=E.useCallback(w=>{let k=null;if(w.type==="CHAN"&&w.conversation_key?k=fa("channel",w.conversation_key):w.type==="PRIV"&&w.conversation_key&&(k=fa("contact",w.conversation_key)),k){const x=w.received_at||Math.floor(Date.now()/1e3),v=su(k,x);m(v)}},[]);return{unreadCounts:s,lastMessageTimes:l,incrementUnread:d,markAllRead:g,markConversationRead:y,trackNewMessage:f}}const Xs=200;function tu(a){return`${a.type}-${a.conversation_key}-${a.text}-${a.sender_timestamp}`}function kk(a){const[r,o]=E.useState([]),[s,u]=E.useState(!1),[l,m]=E.useState(!1),[c,h]=E.useState(!1),d=E.useRef(new Set),g=E.useCallback(async(k=!1)=>{if(!a||a.type==="raw"){o([]),h(!1);return}k&&u(!0);try{const x=await ei.getMessages({type:a.type==="channel"?"CHAN":"PRIV",conversation_key:a.id,limit:Xs});o(x),d.current.clear();for(const v of x)d.current.add(tu(v));h(x.length>=Xs)}catch(x){console.error("Failed to fetch messages:",x)}finally{k&&u(!1)}},[a]),y=E.useCallback(async()=>{if(!(!a||a.type==="raw"||l||!c)){m(!0);try{const k=await ei.getMessages({type:a.type==="channel"?"CHAN":"PRIV",conversation_key:a.id,limit:Xs,offset:r.length});if(k.length>0){o(x=>[...x,...k]);for(const x of k)d.current.add(tu(x))}h(k.length>=Xs)}catch(k){console.error("Failed to fetch older messages:",k)}finally{m(!1)}}},[a,l,c,r.length]);E.useEffect(()=>{g(!0)},[g]);const f=E.useCallback( Line truncated
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wk=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xk=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(r,o,s)=>s?s.toUpperCase():o.toLowerCase()),Xm=a=>{const r=xk(a);return r.charAt(0).toUpperCase()+r.slice(1)},Zg=(...a)=>a.filter((r,o,s)=>!!r&&r.trim()!==""&&s.indexOf(r)===o).join(" ").trim(),zk=a=>{for(const r in a)if(r.startsWith("aria-")||r==="role"||r==="title")return!0};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var qk={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jk=E.forwardRef(({color:a="currentColor",size:r=24,strokeWidth:o=2,absoluteStrokeWidth:s,className:u="",children:l,iconNode:m,...c},h)=>E.createElement("svg",{ref:h,...qk,width:r,height:r,stroke:a,strokeWidth:s?Number(o)*24/Number(r):o,className:Zg("lucide",u),...!l&&!zk(c)&&{"aria-hidden":"true"},...c},[...m.map(([d,g])=>E.createElement(d,g)),...Array.isArray(l)?l:[l]]));/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ou=(a,r)=>{const o=E.forwardRef(({className:s,...u},l)=>E.createElement(jk,{ref:l,iconNode:r,className:Zg(`lucide-${wk(Xm(a))}`,`lucide-${a}`,s),...u}));return o.displayName=Xm(a),o};/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ak=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ck=Ou("check",Ak);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ek=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Sk=Ou("menu",Ek);/**
* @license lucide-react v0.562.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bk=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xg=Ou("x",Bk);var Jg=Gg();const ey=Ro(Jg);function _k(a){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r.appendChild(o),o.styleSheet?o.styleSheet.cssText=a:o.appendChild(document.createTextNode(a))}const Dk=a=>{switch(a){case"success":return Tk;case"info":return Nk;case"warning":return Pk;case"error":return Ik;default:return null}},Fk=Array(12).fill(0),Rk=({visible:a,className:r})=>pe.createElement("div",{className:["sonner-loading-wrapper",r].filter(Boolean).join(" "),"data-visible":a},pe.createElement("div",{className:"sonner-spinner"},Fk.map((o,s)=>pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),Tk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Pk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Nk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ik=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Mk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},pe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),pe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ok=()=>{const[a,r]=pe.useState(document.hidden);return pe.useEffect(()=>{const o=()=>{r(document.hidden)};return document.addEventListener("visibilitychange",o),()=>window.removeEventListener("visibilitychange",o)},[]),a};let ju=1;class Lk{constructor(){this.subscribe=r=>(this.subscribers.push(r),()=>{const o=this.subscribers.indexOf(r);this.subscribers.splice(o,1)}),this.publish=r=>{this.subscribers.forEach(o=>o(r))},this.addToast=r=>{this.publish(r),this.toasts=[...this.toasts,r]},this.create=r=>{var o;const{message:s,...u}=r,l=typeof(r==null?void 0:r.id)=="number"||((o=r.id)==null?void 0:o.length)>0?r.id:ju++,m=this.toasts.find(h=>h.id===l),c=r.dismissible===void 0?!0:r.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),m?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...r,id:l,title:s}),{...h,...r,id:l,dismissible:c,title:s}):h):this.addToast({title:s,...u,dismissible:c,id:l}),l},this.dismiss=r=>(r?(this.dismissedToasts.add(r),requestAnimationFrame(()=>this.subscribers.forEach(o=>o({id:r,dismiss:!0})))):this.toasts.forEach(o=>{this.subscribers.forEach(s=>s({id:o.id,dismiss:!0}))}),r),this.message=(r,o)=>this.create({...o,message:r}),this.error=(r,o)=>this.create({...o,message:r,type:"error"}),this.success=(r,o)=>this.create({...o,type:"success",message:r}),this.info=(r,o)=>this.create({...o,type:"info",message:r}),this.warning=(r,o)=>this.create({...o,type:"warning",message:r}),this.loading=(r,o)=>this.create({...o,type:"loading",message:r}),this.promise=(r,o)=>{if(!o)return;let s;o.loading!==void 0&&(s=this.create({...o,promise:r,type:"loading",message:o.loading,description:typeof o.description!="function"?o.description:void 0}));const u=Promise.resolve(r instanceof Function?r():r);let l=s!==void 0,m;const c=u.then(async d=>{if(m=["resolve",d],pe.isValidElement(d))l=!1,this.create({id:s,type:"default",message:d});else if(Vk(d)&&!d.ok){l=!1;const y=typeof o.error=="function"?await o.error(`HTTP error! status: ${d.status}`):o.error,f=typeof o.description=="function"?await o.description(`HTTP error! status: ${d.status}`):o.description,k=typeof y=="object"&&!pe.isValidElement(y)?y:{message:y};this.create({id:s,type:"error",description:f,...k})}else if(d instanceof Error){l=!1;const y=typeof o.error=="function"?await o.error(d):o.error,Line truncated
`).map((j,I,L)=>B.jsxs("span",{children:[px(j,c),I<L.length-1&&B.jsx("br",{})]},I)),!Z&&B.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:uh(C.sender_timestamp||C.received_at)}),C.outgoing&&(C.acked>0?` ✓${C.acked>1?C.acked:""}`:" ?")]})]})]},C.id)})]}),y&&B.jsx("button",{onClick:x,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:B.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:B.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const hx=E.forwardRef(function({onSend:r,disabled:o,placeholder:s,isRepeaterMode:u},l){const[m,c]=E.useState(""),[h,d]=E.useState(!1),g=E.useRef(null);E.useImperativeHandle(l,()=>({appendText:k=>{var x;c(v=>v+k),(x=g.current)==null||x.focus()}}));const y=E.useCallback(async k=>{k.preventDefault();const x=m.trim();if(u){if(h||o)return;const v=x==="."?"":x;d(!0);try{await r(v),c("")}catch(q){console.error("Failed to request telemetry:",q);return}finally{d(!1)}setTimeout(()=>{var q;return(q=g.current)==null?void 0:q.focus()},0)}else{if(!x||h||o)return;d(!0);try{await r(x),c("")}catch(v){console.error("Failed to send message:",v);return}finally{d(!1)}setTimeout(()=>{var v;return(v=g.current)==null?void 0:v.focus()},0)}},[m,h,o,r,u]),f=E.useCallback(k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),y(k))},[y]),w=u?m.trim().length>0||m===".":m.trim().length>0;return B.jsxs("form",{className:"px-4 py-3 border-t border-border flex gap-2",onSubmit:y,children:[B.jsx(qi,{ref:g,type:u?"password":"text",value:m,onChange:k=>c(k.target.value),onKeyDown:f,placeholder:s||(u?"Enter password (or . for none)...":"Type a message..."),disabled:o||h,className:"flex-1 min-w-0"}),B.jsx(Ha,{type:"submit",disabled:o||h||!w,className:"flex-shrink-0",children:h?u?"Fetching...":"Sending...":u?"Fetch":"Send"})]})});function Si(a,r,{checkForDefaultPrevented:o=!0}={}){return function(u){if(a==null||a(u),o===!1||!u.defaultPrevented)return r==null?void 0:r(u)}}function gx(a,r){const o=E.createContext(r),s=l=>{const{children:m,...c}=l,h=E.useMemo(()=>c,Object.values(c));return B.jsx(o.Provider,{value:h,children:m})};s.displayName=a+"Provider";function u(l){const m=E.useContext(o);if(m)return m;if(r!==void 0)return r;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[s,u]}function Hr(a,r=[]){let o=[];function s(l,m){const c=E.createContext(m),h=o.length;o=[...o,m];const d=y=>{var q;const{scope:f,children:w,...k}=y,x=((q=f==null?void 0:f[a])==null?void 0:q[h])||c,v=E.useMemo(()=>k,Object.values(k));return B.jsx(x.Provider,{value:v,children:w})};d.displayName=l+"Provider";function g(y,f){var x;const w=((x=f==null?void 0:f[a])==null?void 0:x[h])||c,k=E.useContext(w);if(k)return k;if(m!==void 0)return m;throw new Error(`\`${y}\` must be used within \`${l}\``)}return[d,g]}const u=()=>{const l=o.map(m=>E.createContext(m));return function(c){const h=(c==null?void 0:c[a])||l;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:h}}),[c,h])}};return u.scopeName=a,[s,yx(u,...r)]}function yx(...a){const r=a[0];if(a.length===1)return r;const o=()=>{const s=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(l){const m=s.reduce((c,{useScope:h,scopeName:d})=>{const y=h(l)[`__scope${d}`];return{...c,...y}},{});return E.useMemo(()=>({[`__scope${r.scopeName}`]:m}),[m])}};return o.scopeName=r.scopeName,o}var Do=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},bx=Mu[" useId ".trim().toString()]||(()=>{}),fx=0;function Nr(a){const[r,o]=E.useState(bx());return Do(()=>{o(s=>s??String(fx++))},[a]),r?`radix-${r}`:""}var vx=Mu[" useInsertionEffect ".trim().toString()]||Do;function sl({prop:a,defaultProp:r,onChange:o=()=>{},caller:s}){const[u,l,m]=kx({defaultProp:r,onChange:o}),c=a!==void 0,h=c?a:u;{const g=E.useRef(a!==void 0);E.useEffect(()=>{const y=g.current;y!==c&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=c},[c,s])}const d=E.useCallback(g=>{var y;if(c){const f=wx(g)?g(a):g;f!==a&&((y=m.current)==null||y.call(m,f))}else l(g)},[c,a,l,m]);return[h,d]}function kx({defaultProp:a,onChange:r}){const[o,s]=E.useState(a),u=E.useRef(o),l=E.useRef(r);return vx(()=>{l.current=r},[r]),E.useEffect(()=>{var m;u.current!==o&&((m=l.current)==null||m.call(l,o),u.current=o)},[o,u]),[o,s,l]}function wx(a){return typeof a=="function"}function xx(a){const r=zx(a),o=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(jx);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.oLine truncated
.`.concat(Zx,` {
overflow: hidden `).concat(s,`;
padding-right: `).concat(c,"px ").concat(s,`;
}
body[`).concat(So,`] {
overflow: hidden `).concat(s,`;
overscroll-behavior: contain;
`).concat([r&&"position: relative ".concat(s,";"),o==="margin"&&`
padding-left: `.concat(u,`px;
padding-top: `).concat(l,`px;
padding-right: `).concat(m,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(c,"px ").concat(s,`;
`),o==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
}
.`).concat(lt,` {
right: `).concat(c,"px ").concat(s,`;
}
.`).concat(ct,` {
margin-right: `).concat(c,"px ").concat(s,`;
}
.`).concat(lt," .").concat(lt,` {
right: 0 `).concat(s,`;
}
.`).concat(ct," .").concat(ct,` {
margin-right: 0 `).concat(s,`;
}
body[`).concat(So,`] {
`).concat(Xx,": ").concat(c,`px;
}
`)},vh=function(){var a=parseInt(document.body.getAttribute(So)||"0",10);return isFinite(a)?a:0},bz=function(){E.useEffect(function(){return document.body.setAttribute(So,(vh()+1).toString()),function(){var a=vh()-1;a<=0?document.body.removeAttribute(So):document.body.setAttribute(So,a.toString())}},[])},fz=function(a){var r=a.noRelative,o=a.noImportant,s=a.gapMode,u=s===void 0?"margin":s;bz();var l=E.useMemo(function(){return hz(u)},[u]);return E.createElement(gz,{styles:yz(l,!r,u,o?"":"!important")})},Su=!1;if(typeof window<"u")try{var nt=Object.defineProperty({},"passive",{get:function(){return Su=!0,!0}});window.addEventListener("test",nt,nt),window.removeEventListener("test",nt,nt)}catch{Su=!1}var jo=Su?{passive:!1}:!1,vz=function(a){return a.tagName==="TEXTAREA"},Cy=function(a,r){if(!(a instanceof Element))return!1;var o=window.getComputedStyle(a);return o[r]!=="hidden"&&!(o.overflowY===o.overflowX&&!vz(a)&&o[r]==="visible")},kz=function(a){return Cy(a,"overflowY")},wz=function(a){return Cy(a,"overflowX")},kh=function(a,r){var o=r.ownerDocument,s=r;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var u=Ey(a,s);if(u){var l=Sy(a,s),m=l[1],c=l[2];if(m>c)return!0}s=s.parentNode}while(s&&s!==o.body);return!1},xz=function(a){var r=a.scrollTop,o=a.scrollHeight,s=a.clientHeight;return[r,o,s]},zz=function(a){var r=a.scrollLeft,o=a.scrollWidth,s=a.clientWidth;return[r,o,s]},Ey=function(a,r){return a==="v"?kz(r):wz(r)},Sy=function(a,r){return a==="v"?xz(r):zz(r)},qz=function(a,r){return a==="h"&&r==="rtl"?-1:1},jz=function(a,r,o,s,u){var l=qz(a,window.getComputedStyle(r).direction),m=l*s,c=o.target,h=r.contains(c),d=!1,g=m>0,y=0,f=0;do{if(!c)break;var w=Sy(a,c),k=w[0],x=w[1],v=w[2],q=x-v-l*k;(k||q)&&Ey(a,c)&&(y+=q,f+=k);var A=c.parentNode;c=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!h&&c!==document.body||h&&(r.contains(c)||r===c));return(g&&Math.abs(y)<1||!g&&Math.abs(f)<1)&&(d=!0),d},ot=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},wh=function(a){return[a.deltaX,a.deltaY]},xh=function(a){return a&&"current"in a?a.current:a},Az=function(a,r){return a[0]===r[0]&&a[1]===r[1]},Cz=function(a){return`
.block-interactivity-`.concat(a,` {pointer-events: none;}
.allow-interactivity-`).concat(a,` {pointer-events: all;}
`)},Ez=0,Ao=[];function Sz(a){var r=E.useRef([]),o=E.useRef([0,0]),s=E.useRef(),u=E.useState(Ez++)[0],l=E.useState(Ay)[0],m=E.useRef(a);E.useEffect(function(){m.current=a},[a]),E.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(u));var x=Yx([a.lockRef.current],(a.shards||[]).map(xh),!0).filter(Boolean);return x.forEach(function(v){return v.classList.add("allow-interactivity-".concat(u))}),function(){document.body.classList.remove("block-interactivity-".concat(u)),x.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(u))})}}},[a.inert,a.lockRef.current,a.shards]);var c=E.useCallback(function(x,v){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!m.current.allowPinchZoom;var q=ot(x),A=o.current,z="deltaX"in x?x.deltaX:A[0]-q[0],_="deltaY"in x?x.deltaY:A[1]-q[1],C,D=x.target,F=Math.abs(z)>Math.abs(_)?"h":"v";if("touches"in x&&F==="h"&&D.type==="range")return!1;var R=window.getSelection(),M=R&&R.anchorNode,P=M?M===D||M.contains(D):!1;if(P)return!1;var T=kh(F,D);if(!T)return!0;if(T?C=F:(C=F==="v"?"h":"v",T=kh(F,D)),!T)return!1;if(!s.current&&"changedTouches"in x&&(z||_)&&(s.current=C),!C)return!0;var U=s.current||C;return jz(U,v,x,U==="h"?z:_)},[]),h=E.useCallback(function(x){var v=x;if(!(!Ao.length||Ao[Ao.length-1]!==l)){var q="deltaY"in v?wh(v):ot(v),A=r.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&Az(C.delta,q)})[0];if(A&&A.should){v.cancelable&&v.preventDefault();return}if(!A){var z=(m.current.shards||[]).map(xh).filter(Boolean).filter(function(C){return C.contains(v.target)}),_=z.length>0?c(v,z[0]):!m.current.noIsolation;_&&v.cancelable&&v.preventDefault()}}},[]),d=E.useCallback(function(x,v,q,A){var z={name:x,delta:v,target:q,should:A,shadowParent:Bz(q)};r.current.push(z),setTimeout(function(){r.current=r.current.filter(function(_){return _!==z})},1)},[]),g=E.useCallback(function(x){o.current=ot(x),s.current=void 0},[]),y=E.useCallback(function(x){d(x.type,wh(x),x.target,c(x,a.lockRef.current))},[]),f=E.useCallback(function(x){d(x.type,ot(x),x.target,c(x,a.lockRef.current))},[]);E.useEffect(function(){return Ao.push(l),a.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:f}),document.addEventListener("wheel",h,jo),document.addEventListener("touchmove",h,jo),document.addEventListener("touchstart",g,jo),function(){Ao=Ao.filter(function(x){return x!==l}),document.removeEventListener("wheel",h,jo),document.removeEventListener("touchmove",h,jo),document.removeEventListener("touchstart",g,jo)}},[]);var w=a.removeScrollBar,k=a.inert;return E.createElement(E.Fragment,null,k?E.createElement(l,{styles:Cz(u)}):null,w?E.createElement(fz,{noRelative:a.noRelative,gapMode:a.gapMode}):null)}function Bz(a){for(var r=null;a!==null;)a instanceof ShadowRoot&&(r=a.host,a=a.host),a=a.parentNode;return r}const _z=rz(jy,Sz);var By=E.forwardRef(function(a,r){return E.createElement(tl,La({},a,{ref:r,sideCar:_z}))});By.classNames=tl.classNames;var Dz=function(a){if(typeof document>"u")return null;var r=Array.isArray(a)?a[0]:a;return r.ownerDocument.body},Co=new WeakMap,rt=new WeakMap,st={},yu=0,_y=function(a){return a&&(a.host||_y(a.parentNode))},Fz=function(a,r){return r.map(function(o){if(a.contains(o))return o;var s=_y(o);return s&&a.contains(s)?s:(console.error("aria-hidden",o,"in not contained inside",a,". Doing nothing"),null)}).filter(function(o){return!!o})},Rz=function(a,r,o,s){var u=Fz(r,Array.isArray(a)?a:[a]);st[o]||(st[o]=new WeakMap);var l=st[o],m=[],c=new Set,h=new Set(u),d=function(y){!y||c.has(y)||(c.add(y),d(y.parentNode))};u.forEach(d);var g=function(y){!y||h.has(y)||Array.prototype.forEach.call(y.children,function(f){if(c.has(f))g(f);else try{var w=f.getAttribute(s),k=w!==null&&w!=="false",x=(Co.get(f)||0)+1,v=(l.get(f)||0)+1;Co.set(f,x),l.set(f,v),m.push(f),x===1&&k&&rt.set(f,!0),v===1&&f.setAttribute(o,"true"),k||f.setAttribute(s,"true")}catch(q){console.error("aria-hidden: cannot operate on ",f,q)}})};return g(r),c.clear(),yu++,function(){m.forEach(function(y){var f=Co.get(y)-1,w=l.get(y)-1;Co.set(y,f),l.set(y,w),f||(rt.has(y)||y.removeAttribute(s),rt.delete(y)),w||y.removeAttribute(o)}),yu--,yu||(Co=new WeakMap,Co=new WeakMap,rt=new WeakMap,st={})}},Tz=function(a,r,o){o===void 0&&(o="data-aria-hidden");var s=Array.from(Array.isArray(a)?a:[a]),u=Dz(a);return u?(s.push.apply(s,Array.from(u.querySelectorAll("[aria-live], script"))),Rz(s,u,o,"aria-hidden")):function(){return null}};function Pz(a){const r=Nz(a),o=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(Mz);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(r,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(r,{...m,ref:u,children:l})});return o.displayName=`${a}.Slot`,o}function Nz(a){const r=E.forwardRef((o,s)=>{const{children:u Line truncated
If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return E.useEffect(()=>{a&&(document.getElementById(a)||console.error(o))},[o,a]),null},Yz="DialogDescriptionWarning",Zz=({contentRef:a,descriptionId:r})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$y(Yz).contentName}}.`;return E.useEffect(()=>{var l;const u=(l=a.current)==null?void 0:l.getAttribute("aria-describedby");r&&u&&(document.getElementById(r)||console.warn(s))},[s,a,r]),null},Gy=Fy,Qy=Py,cl=Ny,ul=Iy,dl=Oy,pl=Hy,Ky=Uy;const Yy=Gy,Xz=Qy,Zy=E.forwardRef(({className:a,...r},o)=>B.jsx(cl,{ref:o,className:$e("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...r}));Zy.displayName=cl.displayName;const $u=E.forwardRef(({className:a,children:r,...o},s)=>B.jsxs(Xz,{children:[B.jsx(Zy,{}),B.jsxs(ul,{ref:s,className:$e("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...o,children:[r,B.jsxs(Ky,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[B.jsx(Xg,{className:"h-4 w-4"}),B.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$u.displayName=ul.displayName;const Gu=({className:a,...r})=>B.jsx("div",{className:$e("flex flex-col space-y-1.5 text-center sm:text-left",a),...r});Gu.displayName="DialogHeader";const Qu=({className:a,...r})=>B.jsx("div",{className:$e("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...r});Qu.displayName="DialogFooter";const Ku=E.forwardRef(({className:a,...r},o)=>B.jsx(dl,{ref:o,className:$e("text-lg font-semibold leading-none tracking-tight",a),...r}));Ku.displayName=dl.displayName;const Jz=E.forwardRef(({className:a,...r},o)=>B.jsx(pl,{ref:o,className:$e("text-sm text-muted-foreground",a),...r}));Jz.displayName=pl.displayName;function zh(a){const r=e0(a),o=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(a0);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(r,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(r,{...m,ref:u,children:l})});return o.displayName=`${a}.Slot`,o}function e0(a){const r=E.forwardRef((o,s)=>{const{children:u,...l}=o;if(E.isValidElement(u)){const m=o0(u),c=n0(l,u.props);return u.type!==E.Fragment&&(c.ref=s?Lr(s,m):m),E.cloneElement(u,c)}return E.Children.count(u)>1?E.Children.only(null):null});return r.displayName=`${a}.SlotClone`,r}var i0=Symbol("radix.slottable");function a0(a){return E.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===i0}function n0(a,r){const o={...r};for(const s in r){const u=a[s],l=r[s];/^on[A-Z]/.test(s)?u&&l?o[s]=(...c)=>{const h=l(...c);return u(...c),h}:u&&(o[s]=u):s==="style"?o[s]={...u,...l}:s==="className"&&(o[s]=[u,l].filter(Boolean).join(" "))}return{...a,...o}}function o0(a){var s,u;let r=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?a.ref:(r=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?a.props.ref:a.props.ref||a.ref)}function r0(a){const r=a+"CollectionProvider",[o,s]=Hr(r),[u,l]=o(r,{collectionRef:{current:null},itemMap:new Map}),m=x=>{const{scope:v,children:q}=x,A=pe.useRef(null),z=pe.useRef(new Map).current;return B.jsx(u,{scope:v,itemMap:z,collectionRef:A,children:q})};m.displayName=r;const c=a+"CollectionSlot",h=zh(c),d=pe.forwardRef((x,v)=>{const{scope:q,children:A}=x,z=l(c,q),_=va(v,z.collectionRef);return B.jsx(h,{ref:_,children:A})});d.displayName=c;const g=a+"CollectionItemSlot",y="data-radix-collection-item",f=zh(g),w=pe.forwardRef((x,v)=>{const{scope:q,children:A,...z}=x,_=pe.useRef(null),C=va(v,_),D=l(g,q);return pe.useEffect(()=>(D.itemMap.set(_,{ref:_,...z}),()=>void D.itemMap.delete(_))),B.jsx(f,{[y]:"",ref:C,children:A})});w.displayName=g;function k(x){const v=l(a+"CollectionConsumer",x);return pe.useCallback(()=>{const A=v.collectionRef.current;if(!A)return[];const z=Array.from(A.querySelectorAll(`[${y}]`));return Array.from(v.itemMap.values()).sort((D,F)=>z.indexOf(D.ref.current)-z.indexOf(F.ref.current))},[v.coll Line truncated
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/return(function(s){var u=o,l=u.lib,m=l.WordArray,c=l.Hasher,h=u.algo,d=m.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),g=m.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),y=m.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=m.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),w=m.create([0,1518500249,1859775393,2400959708,2840853838]),k=m.create([1352829926,1548603684,1836072691,2053994217,0]),x=h.RIPEMD160=c.extend({_doReset:function(){this._hash=m.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(D,F){for(var R=0;R<16;R++){var M=F+R,P=D[M];D[M]=(P<<8|P>>>24)&16711935|(P<<24|P>>>8)&4278255360}var T=this._hash.words,U=w.words,H=k.words,K=d.words,ie=g.words,Z=y.words,ae=f.words,W,ne,X,j,I,L,$,le,me,ge;L=W=T[0],$=ne=T[1],le=X=T[2],me=j=T[3],ge=I=T[4];for(var oe,R=0;R<80;R+=1)oe=W+D[F+K[R]]|0,R<16?oe+=v(ne,X,j)+U[0]:R<32?oe+=q(ne,X,j)+U[1]:R<48?oe+=A(ne,X,j)+U[2]:R<64?oe+=z(ne,X,j)+U[3]:oe+=_(ne,X,j)+U[4],oe=oe|0,oe=C(oe,Z[R]),oe=oe+I|0,W=I,I=j,j=C(X,10),X=ne,ne=oe,oe=L+D[F+ie[R]]|0,R<16?oe+=_($,le,me)+H[0]:R<32?oe+=z($,le,me)+H[1]:R<48?oe+=A($,le,me)+H[2]:R<64?oe+=q($,le,me)+H[3]:oe+=v($,le,me)+H[4],oe=oe|0,oe=C(oe,ae[R]),oe=oe+ge|0,L=ge,ge=me,me=C(le,10),le=$,$=oe;oe=T[1]+X+me|0,T[1]=T[2]+j+ge|0,T[2]=T[3]+I+L|0,T[3]=T[4]+W+$|0,T[4]=T[0]+ne+le|0,T[0]=oe},_doFinalize:function(){var D=this._data,F=D.words,R=this._nDataBytes*8,M=D.sigBytes*8;F[M>>>5]|=128<<24-M%32,F[(M+64>>>9<<4)+14]=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,D.sigBytes=(F.length+1)*4,this._process();for(var P=this._hash,T=P.words,U=0;U<5;U++){var H=T[U];T[U]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360}return P},clone:function(){var D=c.clone.call(this);return D._hash=this._hash.clone(),D}});function v(D,F,R){return D^F^R}function q(D,F,R){return D&F|~D&R}function A(D,F,R){return(D|~F)^R}function z(D,F,R){return D&R|F&~R}function _(D,F,R){return D^(F|~R)}function C(D,F){return D<<F|D>>>32-F}u.RIPEMD160=c._createHelper(x),u.HmacRIPEMD160=c._createHmacHelper(x)})(),o.RIPEMD160})})(jt)),jt.exports}var At={exports:{}},gq=At.exports,Vh;function yl(){return Vh||(Vh=1,(function(a,r){(function(o,s){a.exports=s(Me())})(gq,function(o){(function(){var s=o,u=s.lib,l=u.Base,m=s.enc,c=m.Utf8,h=s.algo;h.HMAC=l.extend({init:function(d,g){d=this._hasher=new d.init,typeof g=="string"&&(g=c.parse(g));var y=d.blockSize,f=y*4;g.sigBytes>f&&(g=d.finalize(g)),g.clamp();for(var w=this._oKey=g.clone(),k=this._iKey=g.clone(),x=w.words,v=k.words,q=0;q<y;q++)x[q]^=1549556828,v[q]^=909522486;w.sigBytes=k.sigBytes=f,this.reset()},reset:function(){var d=this._hasher;d.reset(),d.update(this._iKey)},update:function(d){return this._hasher.update(d),this},finalize:function(d){var g=this._hasher,y=g.finalize(d);g.reset();var f=g.finalize(this._oKey.clone().concat(y));return f}})})()})})(At)),At.exports}var Ct={exports:{}},yq=Ct.exports,Uh;function bq(){return Uh||(Uh=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ur(),yl())})(yq,function(o){return(function(){var s=o,u=s.lib,l=u.Base,m=u.WordArray,c=s.algo,h=c.SHA256,d=c.HMAC,g=c.PBKDF2=l.extend({cfg:l.extend({keySize:128/32,hasher:h,iterations:25e4}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,f){for(var w=this.cfg,k=d.create(w.hasher,y),x=m.create(),v=m.create([1]),q=x.words,A=v.words,z=w.keySize,_=w.iterations;q.length<z;){var C=k.update(f).finalize(v);k.reset();for(var D=C.words,F=D.length,R=C,M=1;M<_;M++){R=k.finalize(R),k.reset();for(var P=R.words,T=0;T<F;T++)D[T]^=P[T]}x.concat(C),A[0]++}return x.sigBytes=z*4,x}});s.PBKDF2=function(y,f,w){return g.create(w).compute(y,f)}})(),o.PBKDF2})})(Ct)),Ct.exports}var Et={exports:{}},fq=Et.exports,Wh;function Cn(){return Wh||(Wh=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Fb(),yl())})(fq,function(o){return(function(){var s=o,u=s.lib,l=u.Base,m=u.WordArray,c=s.algo,h=c.MD5,d=c.EvpKDF=l.extend({cfg:l.extend({keySize:128/32,hasher:h,iterations:1}),init:function(g){this.cfg=this.cfg.extend(g)},compute:function(g,y){for(var f,w=this.cfg,k=w.hasher.create(),x=m.create(),v=x.words,q=w.keySize,A=w.iterations;v.length<q;){f&&k.update(f),f=k.update(g).finalize(y),k.reset();for(var z=1;z<A;z++)f=k.finalize(f),k.reset();x.concat(f)}return x.sigBytes=q*4,x}});s.EvpKDF=function(g,y,f){return d.create(f).compute(g,y)}})(),o.EvpKDF})})(Et)),Et.exports}var St={exports:{}},vq=St.exports,$h;function Ri(Line truncated
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/return o.mode.CTRGladman=(function(){var s=o.lib.BlockCipherMode.extend();function u(c){if((c>>24&255)===255){var h=c>>16&255,d=c>>8&255,g=c&255;h===255?(h=0,d===255?(d=0,g===255?g=0:++g):++d):++h,c=0,c+=h<<16,c+=d<<8,c+=g}else c+=1<<24;return c}function l(c){return(c[0]=u(c[0]))===0&&(c[1]=u(c[1])),c}var m=s.Encryptor=s.extend({processBlock:function(c,h){var d=this._cipher,g=d.blockSize,y=this._iv,f=this._counter;y&&(f=this._counter=y.slice(0),this._iv=void 0),l(f);var w=f.slice(0);d.encryptBlock(w,0);for(var k=0;k<g;k++)c[h+k]^=w[k]}});return s.Decryptor=m,s})(),o.mode.CTRGladman})})(Dt)),Dt.exports}var Ft={exports:{}},Aq=Ft.exports,Yh;function Cq(){return Yh||(Yh=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ri())})(Aq,function(o){return o.mode.OFB=(function(){var s=o.lib.BlockCipherMode.extend(),u=s.Encryptor=s.extend({processBlock:function(l,m){var c=this._cipher,h=c.blockSize,d=this._iv,g=this._keystream;d&&(g=this._keystream=d.slice(0),this._iv=void 0),c.encryptBlock(g,0);for(var y=0;y<h;y++)l[m+y]^=g[y]}});return s.Decryptor=u,s})(),o.mode.OFB})})(Ft)),Ft.exports}var Rt={exports:{}},Eq=Rt.exports,Zh;function Sq(){return Zh||(Zh=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ri())})(Eq,function(o){return o.mode.ECB=(function(){var s=o.lib.BlockCipherMode.extend();return s.Encryptor=s.extend({processBlock:function(u,l){this._cipher.encryptBlock(u,l)}}),s.Decryptor=s.extend({processBlock:function(u,l){this._cipher.decryptBlock(u,l)}}),s})(),o.mode.ECB})})(Rt)),Rt.exports}var Tt={exports:{}},Bq=Tt.exports,Xh;function _q(){return Xh||(Xh=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ri())})(Bq,function(o){return o.pad.AnsiX923={pad:function(s,u){var l=s.sigBytes,m=u*4,c=m-l%m,h=l+c-1;s.clamp(),s.words[h>>>2]|=c<<24-h%4*8,s.sigBytes+=c},unpad:function(s){var u=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=u}},o.pad.Ansix923})})(Tt)),Tt.exports}var Pt={exports:{}},Dq=Pt.exports,Jh;function Fq(){return Jh||(Jh=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ri())})(Dq,function(o){return o.pad.Iso10126={pad:function(s,u){var l=u*4,m=l-s.sigBytes%l;s.concat(o.lib.WordArray.random(m-1)).concat(o.lib.WordArray.create([m<<24],1))},unpad:function(s){var u=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=u}},o.pad.Iso10126})})(Pt)),Pt.exports}var Nt={exports:{}},Rq=Nt.exports,eg;function Tq(){return eg||(eg=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ri())})(Rq,function(o){return o.pad.Iso97971={pad:function(s,u){s.concat(o.lib.WordArray.create([2147483648],1)),o.pad.ZeroPadding.pad(s,u)},unpad:function(s){o.pad.ZeroPadding.unpad(s),s.sigBytes--}},o.pad.Iso97971})})(Nt)),Nt.exports}var It={exports:{}},Pq=It.exports,ig;function Nq(){return ig||(ig=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ri())})(Pq,function(o){return o.pad.ZeroPadding={pad:function(s,u){var l=u*4;s.clamp(),s.sigBytes+=l-(s.sigBytes%l||l)},unpad:function(s){for(var u=s.words,l=s.sigBytes-1,l=s.sigBytes-1;l>=0;l--)if(u[l>>>2]>>>24-l%4*8&255){s.sigBytes=l+1;break}}},o.pad.ZeroPadding})})(It)),It.exports}var Mt={exports:{}},Iq=Mt.exports,ag;function Mq(){return ag||(ag=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ri())})(Iq,function(o){return o.pad.NoPadding={pad:function(){},unpad:function(){}},o.pad.NoPadding})})(Mt)),Mt.exports}var Ot={exports:{}},Oq=Ot.exports,ng;function Lq(){return ng||(ng=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Ri())})(Oq,function(o){return(function(s){var u=o,l=u.lib,m=l.CipherParams,c=u.enc,h=c.Hex,d=u.format;d.Hex={stringify:function(g){return g.ciphertext.toString(h)},parse:function(g){var y=h.parse(g);return m.create({ciphertext:y})}}})(),o.format.Hex})})(Ot)),Ot.exports}var Lt={exports:{}},Hq=Lt.exports,og;function Vq(){return og||(og=1,(function(a,r){(function(o,s,u){a.exports=s(Me(),Jn(),eo(),Cn(),Ri())})(Hq,function(o){return(function(){var s=o,u=s.lib,l=u.BlockCipher,m=s.algo,c=[],h=[],d=[],g=[],y=[],f=[],w=[],k=[],x=[],v=[];(function(){for(var z=[],_=0;_<256;_++)_<128?z[_]=_<<1:z[_]=_<<1^283;for(var C=0,D=0,_=0;_<256;_++){var F=D^D<<1^D<<2^D<<3^D<<4;F=F>>>8^F&255^99,c[C]=F,h[F]=C;var R=z[C],M=z[R],P=z[M],T=z[F]*257^F*16843008;d[C]=T<<24|T>>>8,g[C]=T<<16|T>>>16,y[C]=T<<8|T>>>24,f[C]=T;var T=P*16843009^M*65537^R*257^C*16843008;w[F]=T<<24|T>>>8,k[F]=T<<16|T>>>16,x[F]=T<<8|T>>>24,v[F]=T,C?(C=R^z[z[z[P^R]]],D^=z[z[D]]):C=D=1}})();var q=[0,1,2,4,8,16,32,64,128,27,54],A=m.AES=l.extend({_doReset:function(){var z;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var _=this._keyPriorReset=this._key,C=_.words,D=_.sigBytes/4,F=this._nRounds=D+6,R=(F+1)*4,M=this._keySchedule=[],P=0;P<R;P++)P<D?M[P]=C[P]:(z=M[P-1],P%D?D>6&&P%D==4&&(z=c[z>>>24]<<24|c[z>>>16&255]<<16|c[z>>>8&255]<<8|c[z&255]):(z=z<<8|z>>>24,z=c[z>>>24]<<24|c[z>>>16&255]<<16|c[z>>>8&255]<<8|c[z&255],z^=q[P/D|0]<<24),M[P]=M[P-D]^z);for(var T=this._invKeySchedule=[],U=0;U<R;U++){var P=R-U;if(U%4)var z=M[P];else var z=M[P-4];U<4||P<=4?T[U]=z:T[U]=w[c[z>>>24]]^k[c[z>>>16&255]]^x[c[z>>>8&255]]^v[c[z&255]]}}},encryptBlock:Line truncated
• Timestamp (4 bytes) - send time as unix timestamp
• Request Type (1 byte) - type of request (GetStats, GetTelemetryData, etc.)
• Request Data (remaining bytes) - additional request-specific data`,startByte:c+h,endByte:c+u.length-1,value:f});const w={type:a.PayloadType.Request,version:a.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:a.RequestType.GetStats,requestData:"",destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f};return l!=null&&l.includeSegments&&(w.segments=m),w}catch(m){return{type:a.PayloadType.Request,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode request payload"],timestamp:0,requestType:a.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Ar.RequestPayloadDecoder=o,Ar}var Cr={},Cg;function jj(){if(Cg)return Cr;Cg=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.ResponsePayloadDecoder=void 0;const a=ua(),r=Ii();class o{static decode(u,l){try{if(u.length<4){const k={type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(k.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,r.bytesToHex)(u)}]),k}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,r.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,r.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:c+h,endByte:c+h,value:g}),h+=1;const y=(0,r.bytesToHex)(u.subarray(h,h+2));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,r.bytesToHex)(u.subarray(h));l!=null&&l.includeSegments&&u.length>h&&m.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:c+h,endByte:c+u.length-1,value:f});const w={type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-4};return l!=null&&l.includeSegments&&(w.segments=m),w}catch(m){return{type:a.PayloadType.Response,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Cr.ResponsePayloadDecoder=o,Cr}var Er={},Eg;function Aj(){if(Eg)return Er;Eg=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.AnonRequestPayloadDecoder=void 0;const a=ua(),r=Ii();class o{static decode(u,l){try{if(u.length<35){const k={type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(k.segments=[{name:"Invalid AnonRequest Data",description:"AnonRequest payload too short (minimum 35 bytes required: 1 for dest hash + 32 for public key + 2 for MAC)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,r.bytesToHex)(u)}]),k}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,r.byteToHex)(u[0]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${d}`,startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,r.bytesToHex)(u.subarray(1,33));l!=null&&l.includeSegments&&m.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:c+h,endByte:c+h+31,value:g}),h+=32;const y=(0,r.bytesToHex)(u.subarray(33,35));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,r.bytesToHex)(u.subarray(35));l!=null&&l.includeSegments&&u.length>35&&m.push({name:"Ciphertext",description:`Encrypted message data (${u.length-35} bytes). Contains encrypted plaintext with this structure:
• Timestamp (4 bytes) - send time as unix timestamp
• Sync Timestamp (4 bytes) - room server only, sender's "sync messages SINCE x" timestamp
• Password (remaining bytes) - password for repeater/room`,startByte:c+h,endByte:c+u.length-1,value:f});const w={type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,senderPublicKey:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-35};return l!=null&&l.includeSegments&&(w.segments=m),w}catch(m){return{type:a.PayloadType.AnonRequest,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Er.AnonRequestPayloadDecoder=o,Er}var Sr={},Sg;function Cj(){if(Sg)return Sr;Sg=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.AckPayloadDecoder=void 0;const a=ua(),r=Ii();class o{static decode(u,l){try{if(u.length<4){const g={type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return l!=null&&l.includeSegments&&(g.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,r.bytesToHex)(u)}]),g}const m=[],c=(l==null?void 0:l.segmentOffset)||0,h=(0,r.bytesToHex)(u.subarray(0,4));l!=null&&l.includeSegments&&m.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${h}`,startByte:c,endByte:c+3,value:h}),l!=null&&l.includeSegments&&u.length>4&&m.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:c+4,endByte:c+u.length-1,value:(0,r.bytesToHex)(u.subarray(4))});const d={type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!0,checksum:h};return l!=null&&l.includeSegments&&(d.segments=m),d}catch(m){return{type:a.PayloadType.Ack,version:a.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode Ack payload"],checksum:""}}}}return Sr.AckPayloadDecoder=o,Sr}var Br={},Bg;function Ej(){if(Bg)return Br;Bg=1,Object.defineProperty(Br,"__esModule",{value:!0}),Br.PathPayloadDecoder=void 0;const a=ua(),r=Ii();class o{static decode(u){try{if(u.length<2)return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const l=u[0];if(u.length<1+l+1)return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+l+1} bytes for path length + path + extra type)`],pathLength:l,pathHashes:[],extraType:0,extraData:""};const m=[];for(let d=0;d<l;d++)m.push((0,r.byteToHex)(u[1+d]));const c=u[1+l];let h="";return u.length>1+l+1&&(h=(0,r.bytesToHex)(u.subarray(1+l+1))),{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!0,pathLength:l,pathHashes:m,extraType:c,extraData:h}}catch(l){return{type:a.PayloadType.Path,version:a.PayloadVersion.Version1,isValid:!1,errors:[l instanceof Error?l.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return Br.PathPayloadDecoder=o,Br}var _r={},_g;function Sj(){if(_g)return _r;_g=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.TextMessagePayloadDecoder=void 0;const a=ua(),r=Ii();class o{static decode(u,l){try{if(u.length<4){const k={type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return l!=null&&l.includeSegments&&(k.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:l.segmentOffset||0,endByte:(l.segmentOffset||0)+u.length-1,value:(0,r.bytesToHex)(u)}]),k}const m=[],c=(l==null?void 0:l.segmentOffset)||0;let h=0;const d=(0,r.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:c+h,endByte:c+h,value:d}),h+=1;const g=(0,r.byteToHex)(u[h]);l!=null&&l.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:c+h,endByte:c+h,value:g}),h+=1;const y=(0,r.bytesToHex)(u.subarray(h,h+2));l!=null&&l.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:c+h,endByte:c+h+1,value:y}),h+=2;const f=(0,r.bytesToHex)(u.subarray(h));l!=null&&l.includeSegments&&u.length>h&&m.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:c+h,endByte:c+u.length-1,value:f});const w={type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,isValid:!0,destinationHash:d,sourceHash:g,cipherMac:y,ciphertext:f,ciphertextLength:u.length-4};return l!=null&&l.includeSegments&&(w.segments=m),w}catch(m){return{type:a.PayloadType.TextMessage,version:a.PayloadVersion.Version1,i Line truncated
// SHA256 round constants
const K: array<u32, 64> = array<u32, 64>(
0x428a2f98u, 0x71374491u, 0xb5c0fbcfu, 0xe9b5dba5u, 0x3956c25bu, 0x59f111f1u, 0x923f82a4u, 0xab1c5ed5u,
0xd807aa98u, 0x12835b01u, 0x243185beu, 0x550c7dc3u, 0x72be5d74u, 0x80deb1feu, 0x9bdc06a7u, 0xc19bf174u,
0xe49b69c1u, 0xefbe4786u, 0x0fc19dc6u, 0x240ca1ccu, 0x2de92c6fu, 0x4a7484aau, 0x5cb0a9dcu, 0x76f988dau,
0x983e5152u, 0xa831c66du, 0xb00327c8u, 0xbf597fc7u, 0xc6e00bf3u, 0xd5a79147u, 0x06ca6351u, 0x14292967u,
0x27b70a85u, 0x2e1b2138u, 0x4d2c6dfcu, 0x53380d13u, 0x650a7354u, 0x766a0abbu, 0x81c2c92eu, 0x92722c85u,
0xa2bfe8a1u, 0xa81a664bu, 0xc24b8b70u, 0xc76c51a3u, 0xd192e819u, 0xd6990624u, 0xf40e3585u, 0x106aa070u,
0x19a4c116u, 0x1e376c08u, 0x2748774cu, 0x34b0bcb5u, 0x391c0cb3u, 0x4ed8aa4au, 0x5b9cca4fu, 0x682e6ff3u,
0x748f82eeu, 0x78a5636fu, 0x84c87814u, 0x8cc70208u, 0x90befffau, 0xa4506cebu, 0xbef9a3f7u, 0xc67178f2u
);
// Character lookup table (a-z = 0-25, 0-9 = 26-35, dash = 36)
const CHARS: array<u32, 37> = array<u32, 37>(
0x61u, 0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6au, // a-j
0x6bu, 0x6cu, 0x6du, 0x6eu, 0x6fu, 0x70u, 0x71u, 0x72u, 0x73u, 0x74u, // k-t
0x75u, 0x76u, 0x77u, 0x78u, 0x79u, 0x7au, // u-z
0x30u, 0x31u, 0x32u, 0x33u, 0x34u, 0x35u, 0x36u, 0x37u, 0x38u, 0x39u, // 0-9
0x2du // dash
);
struct Params {
target_channel_hash: u32,
batch_offset: u32,
name_length: u32,
batch_size: u32,
target_mac: u32, // First 2 bytes of target MAC (in high 16 bits)
ciphertext_words: u32, // Number of 32-bit words in ciphertext
ciphertext_len_bits: u32, // Length of ciphertext in bits
verify_mac: u32, // 1 to verify MAC, 0 to skip
}
@group(0) @binding(0) var<uniform> params: Params;
@group(0) @binding(1) var<storage, read_write> match_count: atomic<u32>;
@group(0) @binding(2) var<storage, read_write> match_indices: array<u32>;
@group(0) @binding(3) var<storage, read> ciphertext: array<u32>; // Ciphertext data
fn rotr(x: u32, n: u32) -> u32 {
return (x >> n) | (x << (32u - n));
}
fn ch(x: u32, y: u32, z: u32) -> u32 {
return (x & y) ^ (~x & z);
}
fn maj(x: u32, y: u32, z: u32) -> u32 {
return (x & y) ^ (x & z) ^ (y & z);
}
fn sigma0(x: u32) -> u32 {
return rotr(x, 2u) ^ rotr(x, 13u) ^ rotr(x, 22u);
}
fn sigma1(x: u32) -> u32 {
return rotr(x, 6u) ^ rotr(x, 11u) ^ rotr(x, 25u);
}
fn gamma0(x: u32) -> u32 {
return rotr(x, 7u) ^ rotr(x, 18u) ^ (x >> 3u);
}
fn gamma1(x: u32) -> u32 {
return rotr(x, 17u) ^ rotr(x, 19u) ^ (x >> 10u);
}
// Convert index to room name bytes, returns the hash as a u32 for the first byte check
fn index_to_room_name(idx: u32, length: u32, msg: ptr<function, array<u32, 16>>) -> bool {
// Message starts with '#' (0x23)
var byte_pos = 0u;
var word_idx = 0u;
var current_word = 0x23000000u; // '#' in big-endian position 0
byte_pos = 1u;
var remaining = idx;
var prev_was_dash = false;
// Generate room name from index
for (var i = 0u; i < length; i++) {
let char_count = select(37u, 36u, i == 0u || i == length - 1u); // no dash at start/end
var char_idx = remaining % char_count;
remaining = remaining / char_count;
// Check for consecutive dashes (invalid)
let is_dash = char_idx == 36u && i > 0u && i < length - 1u;
if (is_dash && prev_was_dash) {
return false; // Invalid: consecutive dashes
}
prev_was_dash = is_dash;
// Map char index to actual character
let c = CHARS[char_idx];
// Pack byte into current word (big-endian)
let shift = (3u - byte_pos % 4u) * 8u;
if (byte_pos % 4u == 0u && byte_pos > 0u) {
(*msg)[word_idx] = current_word;
word_idx = word_idx + 1u;
current_word = 0u;
}
current_word = current_word | (c << shift);
byte_pos = byte_pos + 1u;
}
// Add padding: 0x80 followed by zeros, then length in bits
let msg_len_bits = (length + 1u) * 8u; // +1 for '#'
// Add 0x80 padding byte
let shift = (3u - byte_pos % 4u) * 8u;
if (byte_pos % 4u == 0u) {
(*msg)[word_idx] = current_word;
word_idx = word_idx + 1u;
current_word = 0x80000000u;
} else {
current_word = current_word | (0x80u << shift);
}
byte_pos = byte_pos + 1u;
// Store current word
if (byte_pos % 4u == 0u || word_idx < 14u) {
(*msg)[word_idx] = current_word;
word_idx = word_idx + 1u;
}
// Zero-fill until word 14
for (var i = word_idx; i < 14u; i++) {
(*msg)[i] = 0u;
}
// Length in bits (64-bit, but we only use lower 32 bits for short messages)
(*msg)[14u] = 0u;
(*msg)[15u] = msg_len_bits;
return true;
}
fn sha256_block(msg: ptr<function, array<u32, 16>>) -> array<u32, 8> {
// Initialize hash values
var h: array<u32, 8> = array<u32, 8>(
0x6a09e667u, 0xbb67ae85u, 0x3c6ef372u, 0xa54ff53au,
0x510e527fu, 0x9b05688cu, 0x1f83d9abu, 0x5be0cd19u
);
// Message schedule
var w: array<u32, 64>;
for (var i = 0u; i < 16u; i++) {
w[i] = (*msg)[i];
}
for (var i = 16u; i < 64u; i++) {
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
}
// Compression
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
for (var i = 0u; i < 64u; i++) {
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
let t2 = sigma0(a) + maj(a, b, c);
hh = g; g = f; f = e; e = d + t1;
d = c; c = b; b = a; a = t1 + t2;
}
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
return h;
}
// Compute SHA256 of the key (16 bytes) to get channel hash
fn sha256_key(key: array<u32, 4>) -> u32 {
var msg: array<u32, 16>;
// Key bytes (16 bytes = 4 words)
msg[0] = key[0];
msg[1] = key[1];
msg[2] = key[2];
msg[3] = key[3];
// Padding: 0x80 followed by zeros
msg[4] = 0x80000000u;
for (var i = 5u; i < 14u; i++) {
msg[i] = 0u;
}
// Length: 128 bits
msg[14] = 0u;
msg[15] = 128u;
let hash = sha256_block(&msg);
// Return first byte of hash (big-endian)
return hash[0] >> 24u;
}
// HMAC-SHA256 for MAC verification
// Key is 16 bytes (4 words), padded to 32 bytes with zeros for MeshCore
// Returns first 2 bytes of HMAC (as u32 in high 16 bits)
fn hmac_sha256_mac(key: array<u32, 4>, ciphertext_len: u32) -> u32 {
// HMAC: H((K' ^ opad) || H((K' ^ ipad) || message))
// K' is 64 bytes (32 bytes key + 32 bytes zero padding for MeshCore, then padded to 64)
// ipad = 0x36 repeated, opad = 0x5c repeated
// Build padded key (64 bytes = 16 words)
// MeshCore uses 32-byte secret: 16-byte key + 16 zero bytes
var k_pad: array<u32, 16>;
k_pad[0] = key[0];
k_pad[1] = key[1];
k_pad[2] = key[2];
k_pad[3] = key[3];
for (var i = 4u; i < 16u; i++) {
k_pad[i] = 0u;
}
// Inner hash: SHA256((K' ^ ipad) || message)
// First block: K' ^ ipad (64 bytes)
var inner_block: array<u32, 16>;
for (var i = 0u; i < 16u; i++) {
inner_block[i] = k_pad[i] ^ 0x36363636u;
}
// Initialize hash state with first block
var h: array<u32, 8> = sha256_block(&inner_block);
// Process ciphertext blocks (continuing from h state)
let ciphertext_words = params.ciphertext_words;
var word_idx = 0u;
// Process full 64-byte blocks of ciphertext
while (word_idx + 16u <= ciphertext_words) {
var block: array<u32, 16>;
for (var i = 0u; i < 16u; i++) {
block[i] = ciphertext[word_idx + i];
}
h = sha256_block_continue(&block, h);
word_idx = word_idx + 16u;
}
// Final block with remaining ciphertext + padding
var final_block: array<u32, 16>;
var remaining = ciphertext_words - word_idx;
for (var i = 0u; i < 16u; i++) {
if (i < remaining) {
final_block[i] = ciphertext[word_idx + i];
} else if (i == remaining) {
// Add 0x80 padding
final_block[i] = 0x80000000u;
} else {
final_block[i] = 0u;
}
}
// Add length (64 bytes of ipad + ciphertext length)
let total_bits = 512u + params.ciphertext_len_bits;
if (remaining < 14u) {
final_block[14] = 0u;
final_block[15] = total_bits;
h = sha256_block_continue(&final_block, h);
} else {
// Need extra block for length
h = sha256_block_continue(&final_block, h);
var len_block: array<u32, 16>;
for (var i = 0u; i < 14u; i++) {
len_block[i] = 0u;
}
len_block[14] = 0u;
len_block[15] = total_bits;
h = sha256_block_continue(&len_block, h);
}
let inner_hash = h;
// Outer hash: SHA256((K' ^ opad) || inner_hash)
var outer_block: array<u32, 16>;
for (var i = 0u; i < 16u; i++) {
outer_block[i] = k_pad[i] ^ 0x5c5c5c5cu;
}
h = sha256_block(&outer_block);
// Second block: inner_hash (32 bytes) + padding
var hash_block: array<u32, 16>;
for (var i = 0u; i < 8u; i++) {
hash_block[i] = inner_hash[i];
}
hash_block[8] = 0x80000000u;
for (var i = 9u; i < 14u; i++) {
hash_block[i] = 0u;
}
hash_block[14] = 0u;
hash_block[15] = 512u + 256u; // 64 bytes opad + 32 bytes inner hash
h = sha256_block_continue(&hash_block, h);
// Return first 2 bytes (high 16 bits of first word)
return h[0] & 0xFFFF0000u;
}
// SHA256 block computation continuing from existing state
fn sha256_block_continue(msg: ptr<function, array<u32, 16>>, h_in: array<u32, 8>) -> array<u32, 8> {
var h = h_in;
// Message schedule
var w: array<u32, 64>;
for (var i = 0u; i < 16u; i++) {
w[i] = (*msg)[i];
}
for (var i = 16u; i < 64u; i++) {
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
}
// Compression
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
for (var i = 0u; i < 64u; i++) {
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
let t2 = sigma0(a) + maj(a, b, c);
hh = g; g = f; f = e; e = d + t1;
d = c; c = b; b = a; a = t1 + t2;
}
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
return h;
}
// Process a single candidate and record match if found
fn process_candidate(name_idx: u32) {
// Generate message for this room name
var msg: array<u32, 16>;
let valid = index_to_room_name(name_idx, params.name_length, &msg);
if (!valid) {
return;
}
// Compute SHA256("#roomname") - this gives us the key
let key_hash = sha256_block(&msg);
// Take first 16 bytes (4 words) as the key
var key: array<u32, 4>;
key[0] = key_hash[0];
key[1] = key_hash[1];
key[2] = key_hash[2];
key[3] = key_hash[3];
// Compute SHA256(key) to get channel hash
let channel_hash = sha256_key(key);
// Check if channel hash matches target
if (channel_hash != params.target_channel_hash) {
return;
}
// Channel hash matches - verify MAC if enabled
if (params.verify_mac == 1u) {
let computed_mac = hmac_sha256_mac(key, params.ciphertext_len_bits);
if (computed_mac != params.target_mac) {
return;
}
}
// Found a match - record the index
let match_idx = atomicAdd(&match_count, 1u);
if (match_idx < 1024u) { // Limit stored matches
match_indices[match_idx] = name_idx;
}
}
// Each thread processes 16 candidates to amortize thread overhead
const CANDIDATES_PER_THREAD: u32 = 16u;
@compute @workgroup_size(256)
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
let base_idx = global_id.x * CANDIDATES_PER_THREAD;
for (var i = 0u; i < CANDIDATES_PER_THREAD; i++) {
let idx = base_idx + i;
if (idx >= params.batch_size) {
return;
}
let name_idx = params.batch_offset + idx;
process_candidate(name_idx);
}
}
`}async init(){if(!navigator.gpu)return console.warn("WebGPU not supported"),!1;try{const r=await navigator.gpu.requestAdapter();if(!r)return console.warn("No GPU adapter found"),!1;this.device=await r.requestDevice(),this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]}),this.paramsBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.matchCountBuffer=this.device.createBuffer({size:4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),this.matchIndicesBuffer=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC});for(let u=0;u<2;u++)this.matchCountReadBuffers[u]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[u]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const o=this.device.createShaderModule({code:this.shaderCode}),s=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:s,compute:{module:o,entryPoint:"main"}}),!0}catch(r){return console.error("WebGPU initialization failed:",r),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(r,o){return Kn(o,r)}countNamesForLength(r){return Tr(r)}async runBatch(r,o,s,u,l,m){if(!this.device||!this.pipeline||!this.bindGroupLayout||!this.paramsBuffer||!this.matchCountBuffer||!this.matchIndicesBuffer||!this.matchCountReadBuffers[0]||!this.matchCountReadBuffers[1]||!this.matchIndicesReadBuffers[0]||!this.matchIndicesReadBuffers[1])throw new Error("GPU not initialized");const c=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const h=this.matchCountReadBuffers[c],d=this.matchIndicesReadBuffers[c],g=l&&m?1:0;let y,f=0,w=0;if(g){const C=new Uint8Array(l.length/2);for(let P=0;P<C.length;P++)C[P]=parseInt(l.substr(P*2,2),16);f=C.length*8;const D=Math.ceil(C.length/4)*4,F=new Uint8Array(D);F.set(C),y=new Uint32Array(D/4);for(let P=0;P<y.length;P++)y[P]=F[P*4]<<24|F[P*4+1]<<16|F[P*4+2]<<8|F[P*4+3];const R=parseInt(m.substr(0,2),16),M=parseInt(m.substr(2,2),16);w=R<<24|M<<16}else y=new Uint32Array([0]);const k=Math.max(y.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<k)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:k,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=k,this.bindGroupDirty=!0);const x=new Uint32Array([r,s,o,u,w,y.length,f,g]);this.device.queue.writeBuffer(this.paramsBuffer,0,x),this.device.queue.writeBuffer(this.ciphertextBuffer,0,y),this.device.queue.writeBuffer(this.matchCountBuffer,0,fl.ZERO_DATA),(this.bindGroupDirty||!this.bindGroup)&&(this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.paramsBuffer}},{binding:1,resource:{buffer:this.matchCountBuffer}},{binding:2,resource:{buffer:this.matchIndicesBuffer}},{binding:3,resource:{buffer:this.ciphertextBuffer}}]}),this.bindGroupDirty=!1);const v=this.device.createCommandEncoder(),q=v.beginComputePass();q.setPipeline(this.pipeline),q.setBindGroup(0,this.bindGroup),q.dispatchWorkgroups(Math.ceil(u/(256*16))),q.end(),v.copyBufferToBuffer(this.matchCountBuffer,0,h,0,4),v.copyBufferToBuffer(this.matchIndicesBuffer,0,d,0,1024*4),this.device.queue.submit([v.finish()]),await h.mapAsync(GPUMapMode.READ);const z=new Uint32Array(h.getMappedRange())[0];h.unmap();const _=[];if(z>0){await d.mapAsync(GPUMapMode.READ);const C=new Uint32Array(d.getMappedRange());for(let D=0;D<Math.min(z,1024);D++)_.push(C[D]);d.unmap()}return _}destroy(){var r,o,s,u,l,m,c,h;(r=this.paramsBuffer)==null||r.destroy(),(o=this.matchCountBuffer)==null||o.destroy(),(s=this.matchIndicesBuffer)==null||s.destroy(),(u=this.ciphertextBuffer)==null||u.destroy(),(l=this.matchCountReadBuffers[0])==null||l.destroy(),(m=this.matchCountReadBuffers[1])==null||m.destroy(),(c=this.matchIndicesReadBuffers[0])==null||c.destroy(),(h=this.matchIndicesReadBuffers[1])==null||h.destroy(),this.paramsBuffer=null,this.matchCountBuffer=null,this.matchIndicesBuffer=null,this.ciphertextBuffer=null,this.ciphertextBufferSize=0,this.matchCountReadBuffers=[null,null],this.matchIndicesReadBuffers=[null,null],this.currentReadBufferIndex=0,this.bindGroup=null,this.bindGroupDirty=!0,this.device&&(this.device.destroy(),this.device=null),this.pipeline=null,this.bindGroupLayout=null}}fl.ZERO_DATA=new Uint32Array([0]);function Vj(){return typeof navigator<"u"&&"gpu"in navigator}class Lg{runBatch(r,o,s,u,l,m){const c=[],h=r.toString(16).padStart(2,"0") Line truncated
`).map(l=>l.trim().toLowerCase()).filter(l=>l.length>0);this.wordlist=u.filter(Hg)}setWordlist(r){this.wordlist=r.map(o=>o.trim().toLowerCase()).filter(Hg)}abort(){this.abortFlag=!0}isGpuAvailable(){return Vj()}async decodePacket(r){var s;const o=r.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!o||!/^[0-9a-fA-F]+$/.test(o))return null;try{const l=(s=(await Ig.MeshCorePacketDecoder.decodeWithVerification(o,{})).payload)==null?void 0:s.decoded;return!(l!=null&&l.channelHash)||!(l!=null&&l.ciphertext)||!(l!=null&&l.cipherMac)?null:{channelHash:l.channelHash,ciphertext:l.ciphertext,cipherMac:l.cipherMac,isGroupText:!0}}catch{return null}}async crack(r,o,s){this.abortFlag=!1,this.useTimestampFilter=(o==null?void 0:o.useTimestampFilter)??!0,this.useUtf8Filter=(o==null?void 0:o.useUtf8Filter)??!0,this.validSeconds=(o==null?void 0:o.validSeconds)??Tu,this.useCpu=(o==null?void 0:o.forceCpu)??!1;const u=(o==null?void 0:o.maxLength)??8,l=(o==null?void 0:o.startingLength)??1,m=(o==null?void 0:o.useDictionary)??!0,c=(o==null?void 0:o.startFromType)??"bruteforce",h=r.toLowerCase(),d=await this.decodePacket(h);if(!d)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:g,ciphertext:y,cipherMac:f}=d,w=parseInt(g,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new Lg):this.gpuInstance||(this.gpuInstance=new fl,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new Lg));const k=performance.now();let x=0,v=performance.now(),q=l,A=0,z=0,_=!1;if(o!=null&&o.startFrom){const H=o.startFrom.toLowerCase();if(c==="dictionary"){const K=this.wordlist.indexOf(H);K>=0&&(z=K+1)}else{_=!0;const K=Oj(H);K&&(q=Math.max(l,K.length),A=K.index+1,A>=Tr(q)&&(q++,A=0))}}let C=0;m&&!_&&this.wordlist.length>0&&(C+=this.wordlist.length-z);for(let H=q;H<=u;H++)C+=Tr(H);C-=A;const D=(H,K,ie)=>{if(!s)return;const ae=(performance.now()-k)/1e3,W=ae>0?Math.round(x/ae):0,ne=C-x,X=W>0?ne/W:0;s({checked:x,total:C,percent:C>0?Math.min(100,x/C*100):0,rateKeysPerSec:W,etaSeconds:X,elapsedSeconds:ae,currentLength:K,currentPosition:ie,phase:H})},F=H=>{if(!af(y,f,H))return{valid:!1};const K=Ig.ChannelCrypto.decryptGroupTextMessage(y,f,H);return!K.success||!K.data?{valid:!1}:this.useTimestampFilter&&!Lj(K.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!Hj(K.data.message)?{valid:!1}:{valid:!0,message:K.data.message}};if(!_&&z===0&&q===l&&A===0){D("public-key",0,Ru);const H=Nu(Yt);if(g===H){const K=F(Yt);if(K.valid)return{found:!0,roomName:Ru,key:Yt,decryptedMessage:K.message}}}if(m&&!_&&this.wordlist.length>0)for(let H=z;H<this.wordlist.length;H++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[H],resumeType:"dictionary"};const K=this.wordlist[H],ie=Pu("#"+K),Z=Nu(ie);if(parseInt(Z,16)===w){const W=F(ie);if(W.valid)return{found:!0,roomName:K,key:ie,decryptedMessage:W.message,resumeFrom:K,resumeType:"dictionary"}}x++;const ae=performance.now();ae-v>=200&&(D("wordlist",K.length,K),v=ae,await new Promise(W=>setTimeout(W,0)))}const R=this.useCpu?1024:32768,M=(o==null?void 0:o.gpuDispatchMs)??1e3;let P=R,T=!1;for(let H=q;H<=u;H++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Kn(H,0)||void 0,resumeType:"bruteforce"};const K=Tr(H);let ie=H===q?A:0;for(;ie<K;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Kn(H,ie)||void 0,resumeType:"bruteforce"};const Z=Math.min(P,K-ie),ae=performance.now();let W;this.useCpu?W=this.cpuInstance.runBatch(w,H,ie,Z,y,f):W=await this.gpuInstance.runBatch(w,H,ie,Z,y,f);const ne=performance.now()-ae;if(x+=Z,!this.useCpu&&!T&&Z>=R&&ne>0){const j=M/ne,I=Math.round(Z*j),L=Math.pow(2,Math.round(Math.log2(Math.max(R,I))));P=Math.max(R,L),T=!0}for(const j of W){const I=Kn(H,j);if(!I)continue;const L=Pu("#"+I),$=F(L);if($.valid)return{found:!0,roomName:I,key:L,decryptedMessage:$.message,resumeFrom:I,resumeType:"bruteforce"}}ie+=Z;const X=performance.now();if(X-v>=200){const j=Kn(H,Math.min(ie,K-1))||"";D("bruteforce",H,j),v=X,await new Promise(I=>setTimeout(I,0))}}}return{found:!1,resumeFrom:Kn(u,Tr(u)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}const Qj=["a","aa","aaa","aah","aahed","aahing","aahs","aal","aalii","aaliis","aals","aam","aani","aardvark","aardvarks","aardwolf","aardwolves","aargh","aaron","aaronic","aaronical","aaronite","aaronitic","aarrgh","aarrghh","aaru","aas","aasvogel","aasvogels","ab","aba","ababdeh","ababua","abac","abaca","abacay","abacas","abacate","abacaxi","abaci","abacinate","abacination","abacisci","abaciscus","abacist","aback","abacli","abacot","abacterial","abactinal","abactinally","abaction","abactor","abaculi","abaculus","abacus","abacuses","abada","abaddon","abadejo","abadengo","abadia","abadite","abaff","abaft","abay","abayah","abaisance","abaised","abaiser","abaisse","abaissed","abaka","abakas","abalation","abalienate","abalienated","abalienating","abalienation","abalone Line truncated
NoSleep enabled for older iOS devices. This can interrupt
active or long-running network requests from completing successfully.
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(c=>(this.enabled=!0,c)).catch(c=>{throw this.enabled=!1,c})}disable(){s()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):o()?this.noSleepTimer&&(console.warn(`
NoSleep now disabled for older iOS devices.
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return xu=u,xu}var Zj=Yj();const Xj=Ro(Zj);function Jj({packets:a,channels:r,onChannelCreate:o,onRunningChange:s}){const[u,l]=E.useState(!1),[m,c]=E.useState(6),[h,d]=E.useState(!1),[g,y]=E.useState(!0),[f,w]=E.useState(!1),[k,x]=E.useState(null),[v,q]=E.useState(new Map),[A,z]=E.useState([]),[_,C]=E.useState(!1),[D,F]=E.useState(null),[R,M]=E.useState(null),P=E.useRef(null),T=E.useRef(null),U=E.useRef(!1),H=E.useRef(!1),K=E.useRef(!1),ie=E.useRef(new Map),Z=E.useRef(!1),ae=E.useRef(6),W=E.useRef(!0),ne=E.useRef(!1),X=E.useRef(new Set);E.useEffect(()=>{const ce=new Gj;P.current=ce,F(ce.isGpuAvailable());const je=new Xj;return T.current=je,ce.setWordlist(Qj),C(!0),()=>{ce.destroy(),P.current=null,je.disable(),T.current=null}},[]),E.useEffect(()=>{const ce=()=>{ei.getUndecryptedPacketCount().then(({count:De})=>M(De)).catch(()=>M(null))};ce();const je=setInterval(ce,3e4);return()=>clearInterval(je)},[]);const j=new Set(r.map(ce=>ce.key.toUpperCase())),I=a.filter(ce=>ce.payload_type==="GROUP_TEXT"&&!ce.decrypted);E.useEffect(()=>{q(ce=>{const je=new Map(ce);let De=!1;for(const Pe of I)je.has(Pe.id)||(je.set(Pe.id,{packet:Pe,attempts:0,lastAttemptLength:0,status:"pending"}),De=!0);return De?(ie.current=je,je):ce})},[I.length]),E.useEffect(()=>{ie.current=v},[v]),E.useEffect(()=>{Z.current=h},[h]),E.useEffect(()=>{ae.current=m},[m]),E.useEffect(()=>{W.current=g},[g]),E.useEffect(()=>{ne.current=f},[f]),E.useEffect(()=>{X.current=new Set(I.map(ce=>ce.id))},[I]),E.useEffect(()=>{s==null||s(u)},[u,s]);const L=Array.from(v.values()).filter(ce=>ce.status==="pending").length,$=Array.from(v.values()).filter(ce=>ce.status==="cracked").length,le=Array.from(v.values()).filter(ce=>ce.status==="failed").length,me=E.useCallback(async()=>{if(K.current||!P.current||!U.current)return;const ce=ie.current;let je=null,De=null;for(const[He,Oe]of ce.entries())if(Oe.status==="pending"){je=Oe,De=He;break}if(!je&&Z.current){const He=Array.from(ce.entries()).filter(([,Oe])=>Oe.status==="failed"&&Oe.lastAttemptLength<10);He.length>0&&(He.sort((Oe,Je)=>Oe[1].lastAttemptLength-Je[1].lastAttemptLength),[De,je]=He[0])}if(!je||De===null){U.current&&setTimeout(()=>me(),1e3);return}if(!X.current.has(De)){q(He=>{const Oe=new Map(He);return Oe.delete(De),Oe}),U.current&&setTimeout(()=>me(),10);return}K.current=!0;const Pe=ae.current,ai=je.lastAttemptLength>0,Re=ai?je.lastAttemptLength+1:Pe;try{const He=await P.current.crack(je.packet.data,{maxLength:Re,useTimestampFilter:!0,useUtf8Filter:!0,...ne.current&&{gpuDispatchMs:1e4},...ai&&{useDictionary:!1,startingLength:Re}},Oe=>{x(Oe)});if(H.current){H.current=!1,K.current=!1,x(null);return}if(He.found&&He.roomName&&He.key){q(Ge=>{const oi=new Map(Ge),fi=oi.get(De);return fi&&oi.set(De,{...fi,status:"cracked",attempts:fi.attempts+1,lastAttemptLength:Re}),oi});const Oe={roomName:He.roomName,key:He.key,packetId:De,message:He.decryptedMessage||"",crackedAt:Date.now()};z(Ge=>[...Ge,Oe]);const Je=He.key.toUpperCase();if(!j.has(Je))try{const Ge="#"+He.roomName;await o(Ge,He.key),W.current&&await ei.decryptHistoricalPackets({key_type:"channel",channel_name:Ge})}catch(Ge){console.error("Failed to create channel or decrypt historical:",Ge)}}else q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}catch(He){console.error("Cracking error:",He),q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}K.current=!1,x(null),U.current&&setTimeout(()=>me(),100)},[j,o]),ge=()=>{var ce;if(!D){alert("WebGPU is not available in your browser. Please use Chrome 113+ or Edge 113+.");return}l(!0),U.current=!0,H.current=!1,(ce=T.current)==null||ce.enable(),me()},oe=()=>{var ce,je;l(!1),U.current=!1,H.current=!0,(ce=P.current)==null||ce.abort(),(je=T.current)==null||je.disable()};return B.jsxs("div",{className:"flex flex-col h-full p-3 gap-3 bg-background border-t border-border",children:[B.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This will attempt to dictionary attack, then brute force GroupText packets as they arrive, testing room names up to the specified length.",B.jsx("strong",{children:" Retry failed at n+1"})," will let the cracker return to the failed queue and pick up messages it couldn't crack, attempting them at one longer length.",B.jsx("strong",{children:" Decrypt historical"})," will run an async job on any room name it finds to see if any historically captured packets will decrypt with that key.",B.jsx("strong",{children:" Turbo mode"})," will push your GPU to the max (target dispatch time of 10s) and may allow accelerated cracking and/or system instability."]}),B.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[B.jsx("button",{onClick:u?oe:ge,disabled:!_||D===!1,className:$e("px Line truncated
+1 -1
View File
@@ -13,7 +13,7 @@
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<script type="module" crossorigin src="/assets/index-DfR6hR94.js"></script>
<script type="module" crossorigin src="/assets/index-C3Nga8Wp.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CacA_plj.css">
</head>
<body>
+4 -4
View File
@@ -17,7 +17,7 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.562.0",
"meshcore-hashtag-cracker": "^1.4.0",
"meshcore-hashtag-cracker": "^1.5.0",
"nosleep.js": "^0.12.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
@@ -2439,9 +2439,9 @@
}
},
"node_modules/meshcore-hashtag-cracker": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/meshcore-hashtag-cracker/-/meshcore-hashtag-cracker-1.4.0.tgz",
"integrity": "sha512-CfDFueRIz6bHHdBT4yQSSrGS6JEKKn+yiw5tIHfW2tTP7LhNRo084OlURXhLk+30PVPGNNUBA2M4ZnxLZe55MQ==",
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/meshcore-hashtag-cracker/-/meshcore-hashtag-cracker-1.5.0.tgz",
"integrity": "sha512-GlU7rYs40BJjzs2OCyXvMjRf8w8jZv7xJXreXds21J0mF+GNt2V9+EFNOo2YjGlFHy65xjEwoRNoTn0r/LwVeA==",
"license": "MIT",
"dependencies": {
"@michaelhart/meshcore-decoder": "^0.2.7",
+1 -1
View File
@@ -20,7 +20,7 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.562.0",
"meshcore-hashtag-cracker": "^1.4.0",
"meshcore-hashtag-cracker": "^1.5.0",
"nosleep.js": "^0.12.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",