@openlv/modal 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { ModalView } from './ModalRoot.js';
2
- export declare const Header: (props: {
2
+ export declare const Header: (properties: {
3
3
  title: string;
4
4
  view: ModalView;
5
5
  onClose: () => void;
@@ -5,6 +5,6 @@ export interface ModalRootProps {
5
5
  onCopy?: (uri: string) => void;
6
6
  }
7
7
  export type ModalView = "start" | "settings" | "info";
8
- export declare const ModalRoot: (props: {
8
+ export declare const ModalRoot: (properties: {
9
9
  onClose: () => void;
10
10
  }) => JSX.Element;
@@ -1,3 +1,3 @@
1
- export declare const UnknownState: (props: {
1
+ export declare const UnknownState: (properties: {
2
2
  state: unknown;
3
3
  }) => import("solid-js").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import { SettingsScreen } from '../index.js';
2
- export declare const ConnectionPreferences: (props: {
2
+ export declare const ConnectionPreferences: (properties: {
3
3
  onNavigate: (screen: SettingsScreen) => void;
4
4
  }) => import("solid-js").JSX.Element;
@@ -1,12 +1,12 @@
1
1
  export type SettingsScreen = "main" | "signaling" | "transport";
2
- export interface SettingsNavigationRef {
2
+ export interface SettingsNavigationReference {
3
3
  goBack: () => void;
4
4
  isAtRoot: boolean;
5
5
  }
6
6
  export interface ModalSettingsProps {
7
7
  onTitleChange?: (titleKey: string) => void;
8
8
  navigationRef?: {
9
- current: SettingsNavigationRef | null;
9
+ current: SettingsNavigationReference | null;
10
10
  };
11
11
  }
12
- export declare const ModalSettings: (props: ModalSettingsProps) => import("solid-js").JSX.Element;
12
+ export declare const ModalSettings: (properties: ModalSettingsProps) => import("solid-js").JSX.Element;
package/dist/context.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { OpenLVProvider } from '@openlv/provider';
2
2
  import { Component } from 'solid-js';
3
- import { OpenLVModalElementProps } from './element.js';
3
+ import { OpenLVModalElementProperties } from './element.js';
4
4
  import { ThemeConfig } from './theme/types.js';
5
5
  export type ModalContextValue = {
6
6
  provider: OpenLVProvider;
7
7
  themeConfig?: ThemeConfig;
8
8
  };
9
9
  export declare const ModalContext: import('solid-js').Context<ModalContextValue | undefined>;
10
- export declare const ModalProvider: Component<OpenLVModalElementProps>;
10
+ export declare const ModalProvider: Component<OpenLVModalElementProperties>;
11
11
  export declare const useModalContext: () => ModalContextValue;
package/dist/element.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { OpenLVProvider } from '@openlv/provider';
2
2
  import { ThemeConfig } from './theme/types.js';
3
- export type OpenLVModalElementProps = {
3
+ export type OpenLVModalElementProperties = {
4
4
  provider: OpenLVProvider;
5
5
  onClose?: () => void;
6
6
  theme?: ThemeConfig;
@@ -11,7 +11,7 @@ export declare class OpenLVModalElement extends HTMLElement {
11
11
  private readonly parameters;
12
12
  private themeCleanup?;
13
13
  private disposeRender?;
14
- constructor(parameters: OpenLVModalElementProps);
14
+ constructor(parameters: OpenLVModalElementProperties);
15
15
  connectedCallback(): void;
16
16
  disconnectedCallback(): void;
17
17
  private setupThemeListener;
@@ -1,6 +1,6 @@
1
- interface ConnectionFlowProps {
1
+ interface ConnectionFlowProperties {
2
2
  onClose: () => void;
3
3
  onCopy: (uri: string) => void;
4
4
  }
5
- export declare const ConnectionFlow: (props: ConnectionFlowProps) => import("solid-js").JSX.Element;
5
+ export declare const ConnectionFlow: (properties: ConnectionFlowProperties) => import("solid-js").JSX.Element;
6
6
  export {};
@@ -3,6 +3,6 @@
3
3
  * candidates" transport failure, since that one has a concrete user-side
4
4
  * remedy (WebRTC disabled/blocked by the browser, an extension, or a VPN).
5
5
  */
6
- export declare const ErrorScreen: (props: {
6
+ export declare const ErrorScreen: (properties: {
7
7
  onClose: () => void;
8
8
  }) => import("solid-js").JSX.Element;
@@ -1,3 +1,3 @@
1
- export declare const Disconnected: (props: {
1
+ export declare const Disconnected: (properties: {
2
2
  onSettings: () => void;
3
3
  }) => import("solid-js").JSX.Element;
package/dist/index.cjs.js CHANGED
@@ -3,6 +3,6 @@
3
3
  ${i}
4
4
  }
5
5
  `+cr}else n.textContent=cr};class xt extends HTMLElement{constructor(r){super();te(this,"shadow");te(this,"renderRequested",!1);te(this,"parameters");te(this,"themeCleanup");te(this,"disposeRender");this.parameters=r,this.shadow=this.attachShadow({mode:"open"});const n=r.provider.storage.getSettings()?.theme??"system";dr(this.shadow,r.theme,n)}connectedCallback(){this.requestRender(),this.themeCleanup?.(),this.setupThemeListener()}disconnectedCallback(){this.disposeRender?.(),this.disposeRender=void 0,this.themeCleanup?.()}setupThemeListener(){const r=()=>{const o=this.parameters.provider.storage.getSettings()?.theme??"system";dr(this.shadow,this.parameters.theme,o)};this.parameters.provider.storage.emitter.on("settings_change",r);const n=globalThis.matchMedia("(prefers-color-scheme: dark)");n.addEventListener("change",r),this.themeCleanup=()=>{this.parameters.provider.storage.emitter.off("settings_change",r),n.removeEventListener("change",r)}}showModal(){this.style.display="block"}hideModal(){this.style.display="none"}requestRender(){this.renderRequested||(this.renderRequested=!0,queueMicrotask(()=>{this.renderRequested=!1,this.performRender()}))}performRender(){this.disposeRender?.(),this.disposeRender=Vn(()=>{const r=this;return v(Lo,X(()=>r.parameters))},this.shadow)}}const ko={close:"Close",yes:"Yes",no:"No",protocol:"Protocol"},Co={connectedSuccessfully:"Connected Successfully!",connecting:"Connecting",ready:"Ready",handshakeClosed:"Handshake Closed",handshakePartial:"Handshake Partial",encrypted:"Encrypted",signalError:"Signal Error",disconnected:"Disconnected"},So={title:"Settings",language:"Language",connection:{title:"Connection",description:"Configure how you connect to your wallet."},theme:{title:"Appearance",mode:"Theme",light:"Light",dark:"Dark",system:"System"},connectionPreferences:{title:"Connection preferences",retainSessionHistory:"Retain session history",autoReconnect:"Auto reconnect"},signaling:{title:"Signaling",description:"Signaling is the handshake protocol used to establish a connection.",server:"Server",serverUrl:"Server URL"},transport:{title:"Transport",description:"This is how the connection is maintained.",webrtc:"WebRTC",iceServers:{title:"ICE Servers",stun:"STUN Servers",turn:"TURN Servers",addStun:"Add STUN Server",addTurn:"Add TURN Server",username:"Username",credential:"Password"}},appearance:"Appearance"},Ao={title:"Connect Wallet"},$o={title:"What is openlv?",scanQrCode:"Scan QR Code",approveOnDevice:"Approve on device",youreConnected:"You're connected!"},To={prompt:"Click the button below to start a connection",generateQr:"Generate QR",connectionSettings:"Connection settings"},Eo={preparingConnection:"Preparing connection",generatingKeys:"Generating keys...",connecting:"Connecting",waitingForNetwork:"Waiting for network connection...",establishingConnection:"Establishing connection...",mayTakeFewSeconds:"This may take a few seconds...",connectedSuccessfully:"Connected Successfully!",walletConnectedReady:"Your wallet is now connected and ready to use.",disconnected:"Disconnected",connectionClosed:"The connection has been closed."},_o={clickToCopyUrl:"Click to copy connection URL",copyConnectionUrl:"Copy Connection URL",scanCodeInstruction:`Scan the code above using your mobile wallet.
6
- Or copy the link and paste it into your wallet.`},Po={urlCopied:"Connection URL copied to clipboard!",backToQr:"Back to QR",closeModal:"Close modal"},No={common:ko,status:Co,settings:So,start:Ao,info:$o,disconnected:To,connectionFlow:Eo,handshake:_o,modal:Po};var Bo=x("<br>");const Wt=[{tag:"en",name:"English",nativeName:"English"},{tag:"nl",name:"Dutch",nativeName:"Nederlands"},{tag:"es",name:"Spanish",nativeName:"Español"},{tag:"sv",name:"Swedish",nativeName:"Svenska"},{tag:"zh-cn",name:"Chinese (Simplified)",nativeName:"简体中文"},{tag:"fr",name:"French",nativeName:"Français"},{tag:"ar",name:"Arabic",nativeName:"العربية",rtl:!0},{tag:"he",name:"Hebrew",nativeName:"עברית",rtl:!0},{tag:"fa",name:"Persian",nativeName:"فارسی",rtl:!0}],Mo=t=>Wt.find(r=>r.tag===t)?.rtl??!1;new Set(Wt.map(t=>t.tag));const ur=t=>{if(typeof navigator>"u")return 0;const e=navigator.languages||[navigator.language];for(let r=0;r<e.length;r++){const n=e[r].toLowerCase();if(n===t)return e.length-r+1;if(n.startsWith(`${t}-`)||t.startsWith(`${n}-`))return e.length-r;const[o]=n.split("-");if(o===t||t.startsWith(`${o}-`))return e.length-r-.5}return 0},fr=(t,e)=>{if(!t)return;const r=e.split(".").filter(Boolean);if(r.length===0)return;let n=t;for(const o of r){if(typeof n!="object"||n===null)return;n=n[o]}return n},hr=(t,e)=>e?t.replaceAll(/\{(\w+)\}/g,(r,n)=>{const o=e[n];return o===void 0?r:String(o)}):t,Ro=t=>{const e=fr(t.primary,t.key);if(typeof e=="string")return hr(e,t.params);const r=fr(t.fallback,t.key);return typeof r=="string"?hr(r,t.params):t.key},Yr=Ir(void 0),Oo=async t=>Be(t).with("en",()=>Promise.resolve(void 0)).with("nl",async()=>Promise.resolve().then(()=>require("./nl-bCeoO8RU.cjs")).then(e=>e.default)).with("es",async()=>Promise.resolve().then(()=>require("./es-B9xaw9fo.cjs")).then(e=>e.default)).with("sv",async()=>Promise.resolve().then(()=>require("./sv-BHh_RkLw.cjs")).then(e=>e.default)).with("fr",async()=>Promise.resolve().then(()=>require("./fr-D54ESMxz.cjs")).then(e=>e.default)).with("zh-cn",async()=>Promise.resolve().then(()=>require("./zh-cn-Bqo3eRaE.cjs")).then(e=>e.default)).with("ar",async()=>Promise.resolve().then(()=>require("./ar-xpXGBcxc.cjs")).then(e=>e.default)).with("he",async()=>Promise.resolve().then(()=>require("./he-BWZyf3Uy.cjs")).then(e=>e.default)).with("fa",async()=>Promise.resolve().then(()=>require("./fa-DCpZYzOX.cjs")).then(e=>e.default)).exhaustive(),Io=t=>{const{provider:e}=Re(),r=e.storage.getSettings().language,[n,o]=D(r??"en"),[i,a]=D(void 0),[s,l]=D(!1);ie(()=>{let h=!1;(async()=>{l(!0);try{const b=await Oo(n());if(h)return;a(b)}finally{h||l(!1)}})(),se(()=>{h=!0})});const d=(h,g)=>{const b=Ro({primary:i(),fallback:No,key:h,params:g}),p=b.split(`
7
- `);return p.length<=1?b:Me(()=>p.map((C,k)=>[C,Me(()=>Me(()=>k<p.length-1)()?Bo():null)]))},u=T(()=>Mo(n())),f={languageTag:n,setLanguageTag:h=>{o(h)},isLoadingLanguagePack:s,isRtl:u,t:d};return v(Yr.Provider,{value:f,get children(){return t.children}})},Q=()=>{const t=Lr(Yr);if(!t)throw new Error("TranslationProvider not found");return t},en=Ir(void 0),Lo=t=>{const{provider:e,theme:r}=t;return v(en.Provider,{value:{provider:e,themeConfig:r},get children(){return v(Io,{get children(){return v(fn,{get onClose(){return t.onClose}})}})}})},Re=()=>{const t=Lr(en);if(!t)throw new Error("Modal context not found");return t},Ye=()=>{const{provider:t}=Re(),e=T(()=>t.getSession(),void 0,{name:"session"}),[r,n]=D(e()?.getState());console.log("session status",r());const o=s=>{console.log("session state change",s),n(s)};Ft(()=>{e()?.emitter.on("state_change",o)}),se(()=>{e()?.emitter.off("state_change",o)});const i=T(()=>e()?.getHandshakeParameters());return{uri:T(()=>{const s=i();return s?Zn(s):void 0}),status:r}},jo=()=>{const{provider:t}=Re();return{start:()=>{const e=t.storage.getSettings(),r=e?.signaling?.p,n=r?e?.signaling?.s?.[r]:void 0;if(!r||!n)throw new Error("Invalid protocol or server");return t.createSession({p:r,s:n})}}};var Do=x('<div class="rounded-md bg-(--lv-control-button-secondary-background) p-2 text-(--lv-text-muted)"><div>Unknown state:</div><div>URI:</div><div>Session Status:');const jt=t=>{const{uri:e,status:r}=Ye();return console.error("Unknown state:",{state:t.state}),(()=>{var n=Do(),o=n.firstChild;o.firstChild;var i=o.nextSibling;i.firstChild;var a=i.nextSibling;return a.firstChild,m(o,()=>JSON.stringify(t.state),null),m(i,e,null),m(a,()=>JSON.stringify(r()),null),n})()};const ze={newline:10,reset:27};function Vo(t){if(!Number.isSafeInteger(t))throw new Error(`integer expected: ${t}`)}function Fo(t){if(!Number.isSafeInteger(t)||t<1||t>40)throw new Error(`Invalid version=${t}. Expected number [1..40]`)}function _e(t,e){return t.toString(2).padStart(e,"0")}function gr(t,e){const r=t%e;return r>=0?r:e+r}function fe(t,e){return new Array(t).fill(e)}function Et(t){return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}function vr(t){let e=0,r=0;for(const i of t)e=Math.max(e,i.length),r+=i.length;const n=new Uint8Array(r);let o=0;for(let i=0;i<e;i++)for(const a of t)i<a.length&&(n[o++]=a[i]);return n}function zo(){let t,e=1/0;return{add(r,n){r>=e||(t=n,e=r)},get:()=>t,score:()=>e}}function pr(t){return Object.freeze({has:e=>t.includes(e),decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(r=>{if(typeof r!="string")throw new Error(`alphabet.decode: not string element=${r}`);const n=t.indexOf(r);if(n===-1)throw new Error(`Unknown letter: "${r}". Allowed: ${t}`);return n})},encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(r=>{if(Vo(r),r<0||r>=t.length)throw new Error(`Digit index outside alphabet: ${r} (alphabet: ${t.length})`);return t[r]})}})}function mr(t){if(t.length!==32)throw new Error("expects 32 element matrix");const e=[1431655765,858993459,252645135,16711935,65535];for(let r=0;r<5;r++){const n=e[r]>>>0,o=1<<r,i=o<<1;for(let a=0;a<32;a+=i)for(let s=0;s<o;s++){const l=a+s,d=l+o,u=t[l]>>>0,c=t[d]>>>0,f=(u>>>o^c)&n;t[l]=(u^f<<o)>>>0,t[d]=(c^f)>>>0}}}const Ue=t=>1<<(t&31)>>>0,Pe=(t,e)=>e===0?0:e===32?4294967295:(1<<e)-1<<t>>>0;class q{constructor(e,r){te(this,"defined");te(this,"value");te(this,"tailMask");te(this,"words");te(this,"fullWords");te(this,"height");te(this,"width");const{height:n,width:o}=q.size(e);if(!Number.isSafeInteger(n)||n<=0)throw new Error(`Bitmap: invalid height=${n}, expected positive safe integer dimension`);if(!Number.isSafeInteger(o)||o<=0)throw new Error(`Bitmap: invalid width=${o}, expected positive safe integer dimension`);if(this.height=n,this.width=o,this.tailMask=Pe(0,o&31||32),this.words=Math.ceil(o/32)|0,this.fullWords=Math.floor(o/32)|0,this.value=new Uint32Array(this.words*n),this.defined=new Uint32Array(this.value.length),r){if(r.length!==n)throw new Error(`Bitmap: data height mismatch: exp=${n} got=${r.length}`);for(let i=0;i<n;i++){const a=r[i];if(!a||a.length!==o)throw new Error(`Bitmap: data width mismatch at y=${i}: exp=${o} got=${a?.length}`);for(let s=0;s<o;s++)this.set(s,i,a[s])}}}static size(e,r){if(typeof e=="number"&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw new Error(`Bitmap: invalid height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw new Error(`Bitmap: invalid width=${e.width} (${typeof e.width})`);return r!==void 0&&(e={width:Math.min(e.width,r.width),height:Math.min(e.height,r.height)}),e}static fromString(e){e=e.replace(/^\n+/g,"").replace(/\n+$/g,"");const r=e.split(String.fromCharCode(ze.newline)),n=r.length;let o;const i=[];for(const a of r){const s=a.split("").map(l=>{if(l==="X")return!0;if(l===" ")return!1;if(l!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${l}`)});if(o!==void 0&&s.length!==o)throw new Error(`Bitmap.fromString different row sizes: width=${o} cur=${s.length}`);o=s.length,i.push(s)}return o===void 0&&(o=0),new q({height:n,width:o},i)}point(e){return this.get(e.x,e.y)}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};const{x:r,y:n}=this.xy(e);return{height:this.height-n,width:this.width-r}}xy(e){if(typeof e=="number"&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw new Error(`Bitmap: invalid x=${e.x}`);if(!Number.isSafeInteger(e.y))throw new Error(`Bitmap: invalid y=${e.y}`);return e.x=gr(e.x,this.width),e.y=gr(e.y,this.height),e}wordIndex(e,r){return r*this.words+(e>>>5)}bitIndex(e,r){return{word:this.wordIndex(e,r),bit:e&31}}isDefined(e,r){const n=this.wordIndex(e,r),o=Ue(e);return(this.defined[n]&o)!==0}get(e,r){const n=this.wordIndex(e,r),o=Ue(e);return(this.value[n]&o)!==0}maskWord(e,r,n){const{defined:o,value:i}=this;o[e]|=r,i[e]=i[e]&~r|-n&r}set(e,r,n){n!==void 0&&this.maskWord(this.wordIndex(e,r),Ue(e),n)}fillRectConst(e,r,n,o,i){if(n<=0||o<=0||i===void 0)return;const{value:a,defined:s,words:l}=this,d=e>>>5,u=e+n-1>>>5,c=e&31,f=e+n-1&31;for(let h=0;h<o;h++){const g=(r+h)*l;if(d===u){const b=Pe(c,f-c+1);this.maskWord(g+d,b,i);continue}this.maskWord(g+d,Pe(c,32-c),i);for(let b=d+1;b<u;b++)s[g+b]=4294967295,a[g+b]=i?4294967295:0;this.maskWord(g+u,Pe(0,f+1),i)}}rectWords(e,r,n,o,i){for(let a=0;a<o;a++){const s=r+a;for(let l=0;l<n;){const d=e+l,{bit:u,word:c}=this.bitIndex(d,s),f=Math.min(32-u,n-l);i(c,d,l,a,f),l+=f}}}rect(e,r,n){const{x:o,y:i}=this.xy(e),{height:a,width:s}=q.size(r,this.size({x:o,y:i}));if(typeof n!="function")return this.fillRectConst(o,i,s,a,n),this;const{defined:l,value:d}=this;return this.rectWords(o,i,s,a,(u,c,f,h,g)=>{let b=0,p=d[u];for(let C=0;C<g;C++){const k=Ue(c+C),y=n({x:f+C,y:h},(p&k)!==0);y!==void 0&&(b|=k,p=p&~k|-y&k)}l[u]|=b,d[u]=p}),this}rectRead(e,r,n){const{x:o,y:i}=this.xy(e),{height:a,width:s}=q.size(r,this.size({x:o,y:i})),{value:l}=this;return this.rectWords(o,i,s,a,(d,u,c,f,h)=>{const g=l[d];for(let b=0;b<h;b++){const p=Ue(u+b);n({x:c+b,y:f},(g&p)!==0)}}),this}hLine(e,r,n){return this.rect(e,{width:r,height:1},n)}vLine(e,r,n){return this.rect(e,{width:1,height:r},n)}border(e=2,r){if(!Number.isSafeInteger(e)||e<=0)throw new Error(`Bitmap.border: invalid size=${e}`);const n=this.height+2*e,o=this.width+2*e,i=new q({height:n,width:o});return i.rect(0,1/0,r),i.embed({x:e,y:e},this),i}embed(e,r){const{x:n,y:o}=this.xy(e),{height:i,width:a}=q.size(r.size(),this.size({x:n,y:o}));if(a<=0||i<=0)return this;const{value:s,defined:l}=this,{words:d,value:u}=r;for(let c=0;c<i;c++){const f=c*d;for(let h=0;h<a;){const g=n+h,{word:b,bit:p}=this.bitIndex(g,o+c),{word:C,bit:k}=r.bitIndex(h,c),y=Math.min(32-p,a-h),F=u[C],_=k&&C+1<f+d?u[C+1]:0,pe=k?(F>>>k|_<<32-k)>>>0:F,he=Pe(p,y),De=(pe&Pe(0,y))<<p>>>0;l[b]|=he,s[b]=s[b]&~he|De,h+=y}}return this}rectSlice(e,r=this.size()){const{x:n,y:o}=this.xy(e),{height:i,width:a}=q.size(r,this.size({x:n,y:o})),s=new q({height:i,width:a});return this.rectRead({x:n,y:o},{height:i,width:a},(l,d)=>{this.isDefined(n+l.x,o+l.y)&&s.set(l.x,l.y,d)}),s}transpose(){const{height:e,width:r,value:n,defined:o,words:i}=this,a=new q({height:r,width:e}),{words:s,value:l,defined:d,tailMask:u}=a,c=new Uint32Array(32),f=new Uint32Array(32);for(let h=0;h<e;h+=32)for(let g=0;g<i;g++){const b=Math.min(32,e-h);for(let p=0;p<b;p++){const C=this.wordIndex(32*g,h+p);c[p]=n[C],f[p]=o[C]}c.fill(0,b),f.fill(0,b),mr(c),mr(f);for(let p=0;p<32;p++){const C=g*32+p;if(C>=r)break;const k=a.wordIndex(h,C),y=h>>>5===s-1?u:4294967295;l[k]=c[p]&y,d[k]=f[p]&y}}return a}negate(){const e=this.defined.length;for(let r=0;r<e;r++)this.value[r]=~this.value[r],this.defined[r]=4294967295;return this}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw new Error(`invalid scale factor: ${e}`);const{height:r,width:n}=this;return new q({height:e*r,width:e*n}).rect({x:0,y:0},1/0,({x:i,y:a})=>this.get(i/e|0,a/e|0))}clone(){const e=new q(this.size());return e.defined.set(this.defined),e.value.set(this.value),e}assertDrawn(){const{height:e,width:r,defined:n,tailMask:o,fullWords:i,words:a}=this;if(!(!e||!r))for(let s=0;s<e;s++){const l=s*a;for(let d=0;d<i;d++)if(n[l+d]!==4294967295)throw new Error("Invalid color type=undefined");if(a!==i&&(n[l+i]&o)!==o)throw new Error("Invalid color type=undefined")}}countPatternInRow(e,r,...n){if(!Number.isSafeInteger(r)||r<=0||r>=32)throw new Error("wrong patternLen");const o=(1<<r)-1,{height:i,width:a,value:s,words:l}=this;if(!Number.isSafeInteger(e)||e<0||e>=i)return 0;let d=0;const u=this.wordIndex(0,e);for(let c=0,f=0;c<l;c++){const h=s[u+c],g=c===l-1&&a&31||32;for(let b=0;b<g;b++)if(f=(f<<1|h>>>b&1)&o,!(c*32+b+1<r)){for(const p of n)if(f===p){d++;break}}}return d}getRuns(e,r){const{height:n,width:o,value:i,words:a}=this;if(o===0||!Number.isSafeInteger(e)||e<0||e>=n)return;let s=0,l;const d=this.wordIndex(0,e);for(let u=0;u<a;u++){const c=i[d+u],f=u===a-1&&o&31||32;for(let h=0;h<f;h++){const g=(c&1<<h)!==0;if(g===l){s++;continue}l!==void 0&&r(s,l),l=g,s=1}}l!==void 0&&r(s,l)}popcnt(){const{height:e,width:r,words:n,fullWords:o,tailMask:i}=this;if(!e||!r)return 0;let a=0;for(let s=0;s<e;s++){const l=s*n;for(let d=0;d<o;d++)a+=Et(this.value[l+d]);n!==o&&(a+=Et(this.value[l+o]&i))}return a}countBoxes2x2(e){const{height:r,width:n,words:o}=this;if(n<2||!Number.isSafeInteger(e)||e<0||e+1>=r)return 0;const i=this.wordIndex(0,e),a=this.wordIndex(0,e+1),l=(n&31)===0?2147483647:Pe(0,n-1&31);let d=0;for(let u=0;u<o;u++){const c=this.value[i+u],f=this.value[a+u],h=~(c^f)>>>0,g=u+1<o?this.value[i+u+1]>>>0:0,b=~(c^(c>>>1|(g&1)<<31)>>>0)>>>0,p=u+1<o?this.value[a+u+1]>>>0:0,C=~(f^(f>>>1|(p&1)<<31)>>>0)>>>0;let k=(h&b&C)>>>0;u===o-1&&(k&=l),d+=Et(k)}return d}toString(){const e=String.fromCharCode(ze.newline);let r="";for(let n=0;n<this.height;n++){let o="";for(let i=0;i<this.width;i++){const a=this.get(i,n);o+=this.isDefined(i,n)?a?"X":" ":"?"}r+=o+(n+1===this.height?"":e)}return r}toRaw(){const e=Array.from({length:this.height},()=>new Array(this.width));for(let r=0;r<this.height;r++){const n=e[r];for(let o=0;o<this.width;o++)n[o]=this.get(o,r)}return e}toASCII(){const{height:e,width:r}=this;let n="";for(let o=0;o<e;o+=2){for(let i=0;i<r;i++){const a=this.get(i,o),s=o+1>=e?!0:this.get(i,o+1);!a&&!s?n+="█":!a&&s?n+="▀":a&&!s?n+="▄":a&&s&&(n+=" ")}n+=String.fromCharCode(ze.newline)}return n}toTerm(){const e=String.fromCharCode(ze.reset),r=e+"[0m",n=e+"[1;47m "+r,o=e+"[40m "+r,i=String.fromCharCode(ze.newline);let a="";for(let s=0;s<this.height;s++){for(let l=0;l<this.width;l++){const d=this.get(l,s);a+=d?o:n}a+=i}return a}toSVG(e=!0){let r=`<svg viewBox="0 0 ${this.width} ${this.height}" xmlns="http://www.w3.org/2000/svg">`,n="",o;return this.rectRead(0,1/0,(i,a)=>{if(!a)return;const{x:s,y:l}=i;if(!e){r+=`<rect x="${s}" y="${l}" width="1" height="1" />`;return}let d=`M${s} ${l}`;if(o){const c=`m${s-o.x} ${l-o.y}`;c.length<=d.length&&(d=c)}const u=s<10?`H${s}`:"h-1";n+=`${d}h1v1${u}Z`,o=i}),e&&(r+=`<path d="${n}"/>`),r+="</svg>",r}toGIF(){const e=s=>[s&255,s>>>8&255],r=[...e(this.width),...e(this.height)],n=[];this.rectRead(0,1/0,(s,l)=>n.push(+(l===!0)));const o=126,i=[71,73,70,56,55,97,...r,246,0,0,255,255,255,...fe(381,0),44,0,0,0,0,...r,0,7],a=Math.floor(n.length/o);for(let s=0;s<a;s++)i.push(o+1,128,...n.slice(o*s,o*(s+1)).map(l=>+l));return i.push(n.length%o+1,128,...n.slice(a*o).map(s=>+s)),i.push(1,129,0,59),new Uint8Array(i)}toImage(e=!1){const{height:r,width:n}=this.size(),o=new Uint8Array(r*n*(e?3:4));let i=0;for(let a=0;a<r;a++)for(let s=0;s<n;s++){const l=this.get(s,a)?0:255;o[i++]=l,o[i++]=l,o[i++]=l,e||(o[i++]=255)}return{height:r,width:n,data:o}}}const br=Object.freeze(["low","medium","quartile","high"]),wr=Object.freeze(["numeric","alphanumeric","byte","kanji","eci"]),Uo=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],Wo={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},Go={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},U=Object.freeze({size:Object.freeze({encode:t=>21+4*(t-1),decode:t=>(t-17)/4}),sizeType:t=>Math.floor((t+7)/17),alignmentPatterns(t){if(t===1)return[];const e=6,r=U.size.encode(t)-e-1,n=r-e,o=Math.ceil(n/28);let i=Math.floor(n/o);i%2?i+=1:n%o*2>=o&&(i+=2);const a=[e];for(let s=1;s<o;s++)a.push(r-(o-s)*i);return a.push(r),a},ECCode:Object.freeze({low:1,medium:0,quartile:3,high:2}),formatMask:21522,formatBits(t,e){const r=U.ECCode[t]<<3|e;let n=r;for(let o=0;o<10;o++)n=n<<1^(n>>9)*1335;return(r<<10|n)^U.formatMask},versionBits(t){let e=t;for(let r=0;r<12;r++)e=e<<1^(e>>11)*7973;return t<<12|e},alphabet:Object.freeze({numeric:pr("0123456789"),alphanumerc:pr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")}),lengthBits(t,e){return{numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[e][U.sizeType(t)]},modeBits:Object.freeze({numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"}),capacity(t,e){const r=Uo[t-1],n=Wo[e][t-1],o=Go[e][t-1],i=Math.floor(r/o)-n,a=o-r%o;return{words:n,numBlocks:o,shortBlocks:a,blockLen:i,capacity:(r-n*o)*8,total:(n+i)*o+o-a}}}),Gt=Object.freeze([(t,e)=>(t+e)%2==0,(t,e)=>e%2==0,(t,e)=>t%3==0,(t,e)=>(t+e)%3==0,(t,e)=>(Math.floor(e/2)+Math.floor(t/3))%2==0,(t,e)=>t*e%2+t*e%3==0,(t,e)=>(t*e%2+t*e%3)%2==0,(t,e)=>((t+e)%2+t*e%3)%2==0]),w={tables:(t=>{const e=fe(256,0),r=fe(256,0);for(let n=0,o=1;n<256;n++)e[n]=o,r[o]=n,o<<=1,o&256&&(o^=t);return{exp:e,log:r}})(285),exp:t=>w.tables.exp[t],log(t){if(t===0)throw new Error(`GF.log: invalid arg=${t}`);return w.tables.log[t]%255},mul(t,e){return t===0||e===0?0:w.tables.exp[(w.tables.log[t]+w.tables.log[e])%255]},add:(t,e)=>t^e,pow:(t,e)=>w.tables.exp[w.tables.log[t]*e%255],inv(t){if(t===0)throw new Error(`GF.inverse: invalid arg=${t}`);return w.tables.exp[255-w.tables.log[t]]},polynomial(t){if(t.length==0)throw new Error("GF.polymomial: invalid length");if(t[0]!==0)return t;let e=0;for(;e<t.length-1&&t[e]==0;e++);return t.slice(e)},monomial(t,e){if(t<0)throw new Error(`GF.monomial: invalid degree=${t}`);if(e==0)return[0];let r=fe(t+1,0);return r[0]=e,w.polynomial(r)},degree:t=>t.length-1,coefficient:(t,e)=>t[w.degree(t)-e],mulPoly(t,e){if(t[0]===0||e[0]===0)return[0];const r=fe(t.length+e.length-1,0);for(let n=0;n<t.length;n++)for(let o=0;o<e.length;o++)r[n+o]=w.add(r[n+o],w.mul(t[n],e[o]));return w.polynomial(r)},mulPolyScalar(t,e){if(e==0)return[0];if(e==1)return t;const r=fe(t.length,0);for(let n=0;n<t.length;n++)r[n]=w.mul(t[n],e);return w.polynomial(r)},mulPolyMonomial(t,e,r){if(e<0)throw new Error("GF.mulPolyMonomial: invalid degree");if(r==0)return[0];const n=fe(t.length+e,0);for(let o=0;o<t.length;o++)n[o]=w.mul(t[o],r);return w.polynomial(n)},addPoly(t,e){if(t[0]===0)return e;if(e[0]===0)return t;let r=t,n=e;r.length>n.length&&([r,n]=[n,r]);let o=fe(n.length,0),i=n.length-r.length,a=n.slice(0,i);for(let s=0;s<a.length;s++)o[s]=a[s];for(let s=i;s<n.length;s++)o[s]=w.add(r[s-i],n[s]);return w.polynomial(o)},remainderPoly(t,e){const r=Array.from(t);for(let n=0;n<t.length-e.length+1;n++){const o=r[n];if(o!==0)for(let i=1;i<e.length;i++)e[i]!==0&&(r[n+i]=w.add(r[n+i],w.mul(e[i],o)))}return r.slice(t.length-e.length+1,r.length)},divisorPoly(t){let e=[1];for(let r=0;r<t;r++)e=w.mulPoly(e,[1,w.pow(2,r)]);return e},evalPoly(t,e){if(e==0)return w.coefficient(t,0);let r=t[0];for(let n=1;n<t.length;n++)r=w.add(w.mul(e,r),t[n]);return r},euclidian(t,e,r){w.degree(t)<w.degree(e)&&([t,e]=[e,t]);let n=t,o=e,i=[0],a=[1];for(;2*w.degree(o)>=r;){let d=n,u=i;if(n=o,i=a,n[0]===0)throw new Error("rLast[0] === 0");o=d;let c=[0];const f=w.inv(n[0]);for(;w.degree(o)>=w.degree(n)&&o[0]!==0;){const h=w.degree(o)-w.degree(n),g=w.mul(o[0],f);c=w.addPoly(c,w.monomial(h,g)),o=w.addPoly(o,w.mulPolyMonomial(n,h,g))}if(c=w.mulPoly(c,i),a=w.addPoly(c,u),w.degree(o)>=w.degree(n))throw new Error(`Division failed r: ${o}, rLast: ${n}`)}const s=w.coefficient(a,0);if(s==0)throw new Error("sigmaTilde(0) was zero");const l=w.inv(s);return[w.mulPolyScalar(a,l),w.mulPolyScalar(o,l)]}};function qo(t){return{encode(e){const r=w.divisorPoly(t),n=Array.from(e);return n.push(...r.slice(0,-1).fill(0)),Uint8Array.from(w.remainderPoly(n,r))},decode(e){const r=e.slice(),n=w.polynomial(Array.from(e));let o=fe(t,0),i=!1;for(let c=0;c<t;c++){const f=w.evalPoly(n,w.exp(c));o[o.length-1-c]=f,f!==0&&(i=!0)}if(!i)return r;o=w.polynomial(o);const a=w.monomial(t,1),[s,l]=w.euclidian(a,o,t),d=fe(w.degree(s),0);let u=0;for(let c=1;c<256&&u<d.length;c++)w.evalPoly(s,c)===0&&(d[u++]=w.inv(c));if(u!==d.length)throw new Error("RS.decode: invalid errors number");for(let c=0;c<d.length;c++){const f=r.length-1-w.log(d[c]);if(f<0)throw new Error("RS.decode: invalid error location");const h=w.inv(d[c]);let g=1;for(let b=0;b<d.length;b++)c!==b&&(g=w.mul(g,w.add(1,w.mul(d[b],h))));r[f]=w.add(r[f],w.mul(w.evalPoly(l,h),w.inv(g)))}return r}}}function Ko(t,e){const{words:r,shortBlocks:n,numBlocks:o,blockLen:i,total:a}=U.capacity(t,e),s=qo(r);return{encode(l){const d=[],u=[];for(let g=0;g<o;g++){const b=g<n,p=i+(b?0:1);d.push(l.subarray(0,p)),u.push(s.encode(l.subarray(0,p))),l=l.subarray(p)}const c=vr(d),f=vr(u),h=new Uint8Array(c.length+f.length);return h.set(c),h.set(f,c.length),h},decode(l){if(l.length!==a)throw new Error(`interleave.decode: len(data)=${l.length}, total=${a}`);const d=[];for(let f=0;f<o;f++){const h=f<n;d.push(new Uint8Array(r+i+(h?0:1)))}let u=0;for(let f=0;f<i;f++)for(let h=0;h<o;h++)d[h][f]=l[u++];for(let f=n;f<o;f++)d[f][i]=l[u++];for(let f=i;f<i+r;f++)for(let h=0;h<o;h++){const g=h<n;d[h][f+(g?0:1)]=l[u++]}const c=[];for(const f of d)c.push(...Array.from(s.decode(f)).slice(0,-r));return Uint8Array.from(c)}}}function Ho(t,e,r,n=!1){const o=U.size.encode(t);let i=new q(o+2);const a=new q(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);i=i.embed(0,a).embed({x:-a.width,y:0},a).embed({x:0,y:-a.height},a),i=i.rectSlice(1,o);const s=new q(1).rect(0,1,!0).border(1,!1).border(1,!0),l=U.alignmentPatterns(t);for(const d of l)for(const u of l)i.isDefined(u,d)||i.embed({x:u-2,y:d-2},s);i=i.hLine({x:0,y:6},1/0,({x:d})=>i.isDefined(d,6)?void 0:d%2==0).vLine({x:6,y:0},1/0,({y:d})=>i.isDefined(6,d)?void 0:d%2==0);{const d=U.formatBits(e,r),u=c=>!n&&(d>>c&1)==1;for(let c=0;c<6;c++)i.set(8,c,u(c));for(let c=6;c<8;c++)i.set(8,c+1,u(c));for(let c=8;c<15;c++)i.set(8,o-15+c,u(c));for(let c=0;c<8;c++)i.set(o-c-1,8,u(c));for(let c=8;c<9;c++)i.set(15-c-1+1,8,u(c));for(let c=9;c<15;c++)i.set(15-c-1,8,u(c));i.set(8,o-8,!n)}if(t>=7){const d=U.versionBits(t);for(let u=0;u<18;u+=1){const c=!n&&(d>>u&1)==1,f=Math.floor(u/3),h=u%3+o-8-3;i.set(h,f,c),i.set(f,h,c)}}return i}function Xo(t,e,r){const n=t,o=n.height,i=Gt[e];let a=-1,s=o-1;for(let l=o-1;l>0;l-=2){for(l==6&&(l=5);;s+=a){for(let d=0;d<2;d+=1){const u=l-d;n.isDefined(u,s)||r(u,s,i(u,s))}if(s+a<0||s+a>=o)break}a=-a}}function Qo(t){let e="numeric";for(let r of t)if(!U.alphabet.numeric.has(r)&&(e="alphanumeric",!U.alphabet.alphanumerc.has(r)))return"byte";return e}function Jo(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function yr(t,e,r,n,o=Jo){let i="",a=r.length;if(n==="numeric"){const f=U.alphabet.numeric.decode(r.split("")),h=f.length;for(let g=0;g<h-2;g+=3)i+=_e(f[g]*100+f[g+1]*10+f[g+2],10);h%3===1?i+=_e(f[h-1],4):h%3===2&&(i+=_e(f[h-2]*10+f[h-1],7))}else if(n==="alphanumeric"){const f=U.alphabet.alphanumerc.decode(r.split("")),h=f.length;for(let g=0;g<h-1;g+=2)i+=_e(f[g]*45+f[g+1],11);h%2==1&&(i+=_e(f[h-1],6))}else if(n==="byte"){const f=o(r);a=f.length,i=Array.from(f).map(h=>_e(h,8)).join("")}else throw new Error("encode: unsupported type");const{capacity:s}=U.capacity(t,e),l=_e(a,U.lengthBits(t,n));let d=U.modeBits[n]+l+i;if(d.length>s)throw new Error("Capacity overflow");d+="0".repeat(Math.min(4,Math.max(0,s-d.length))),d.length%8&&(d+="0".repeat(8-d.length%8));const u="1110110000010001";for(let f=0;d.length!==s;f++)d+=u[f%u.length];const c=Uint8Array.from(d.match(/(.{8})/g).map(f=>+`0b${f}`));return Ko(t,e).encode(c)}function xr(t,e,r,n,o=!1){const i=Ho(t,e,n,o);let a=0;const s=8*r.length;if(Xo(i,n,(l,d,u)=>{let c=!1;a<s&&(c=(r[a>>>3]>>(7-a&7)&1)!==0,a++),i.set(l,d,c!==u)}),a!==s)throw new Error("QR: bytes left after draw");return i}const tn=t=>{const e=t.map(r=>r?"1":"0").join("");return{len:e.length,n:+`0b${e}`}},rn=[!0,!1,!0,!0,!0,!1,!0],nn=[!1,!1,!1,!1],st=tn([...rn,...nn]),kr=tn([...nn,...rn]);function Zo(t){const e=t,{width:r,height:n}=e,o=e.transpose();let i=0;for(let f=0;f<n;f++)e.getRuns(f,h=>{h>=5&&(i+=3+(h-5))});for(let f=0;f<r;f++)o.getRuns(f,h=>{h>=5&&(i+=3+(h-5))});let a=0;for(let f=0;f<n-1;f++)a+=3*e.countBoxes2x2(f);let s=0;for(let f=0;f<n;f++)s+=40*e.countPatternInRow(f,st.len,st.n,kr.n);for(let f=0;f<r;f++)s+=40*o.countPatternInRow(f,st.len,st.n,kr.n);const l=n*r,d=e.popcnt(),c=10*Math.ceil(Math.max(0,Math.abs(d*100-l*50)-l*5)/(l*5));return i+a+s+c}function Yo(t,e,r,n){if(n===void 0){const o=zo();for(let i=0;i<Gt.length;i++)o.add(Zo(xr(t,e,r,i,!0)),i);n=o.get()}if(n===void 0)throw new Error("Cannot find mask");return xr(t,e,r,n)}function ei(t){if(!br.includes(t))throw new Error(`Invalid error correction mode=${t}. Expected: ${br}`)}function ti(t){if(!wr.includes(t))throw new Error(`Encoding: invalid mode=${t}. Expected: ${wr}`);if(t==="kanji"||t==="eci")throw new Error(`Encoding: ${t} is not supported (yet?).`)}function ri(t){if(![0,1,2,3,4,5,6,7].includes(t)||!Gt[t])throw new Error(`Invalid mask=${t}. Expected number [0..7]`)}function ni(t,e="raw",r={}){const n=r,o=n.ecc!==void 0?n.ecc:"medium";ei(o);const i=n.encoding!==void 0?n.encoding:Qo(t);ti(i),n.mask!==void 0&&ri(n.mask);let a=n.version,s,l=new Error("Unknown error");if(a!==void 0)Fo(a),s=yr(a,o,t,i,n.textEncoder);else for(let c=1;c<=40;c++)try{s=yr(c,o,t,i,n.textEncoder),a=c;break}catch(f){l=f}if(!a||!s)throw l;let d=Yo(a,o,s,n.mask);d.assertDrawn();const u=n.border===void 0?2:n.border;if(!Number.isSafeInteger(u)||u<=0)throw new Error(`invalid border=${u}`);if(d=d.border(u,!1),n.scale!==void 0&&(d=d.scale(n.scale)),e==="raw")return d.toRaw();if(e==="ascii")return d.toASCII();if(e==="svg")return d.toSVG(n.optimize);if(e==="gif")return d.toGIF();if(e==="term")return d.toTerm();throw new Error(`Unknown output: ${e}`)}const on=async t=>{if(!t)return!1;try{if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch(e){console.error("Failed to copy to clipboard",e)}try{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.append(e),e.focus(),e.select();const r=document.execCommand("copy");return e.remove(),r}catch{return!1}};var oi=x('<div class="flex flex-col items-center gap-4 px-2"><div class="w-full space-y-4 rounded-md border border-(--lv-control-button-secondary-border) bg-(--lv-card-background) p-4"><div class=w-full><button type=button class="w-full cursor-pointer rounded-lg border border-(--lv-control-button-secondary-border) bg-(--lv-control-button-secondary-background) px-4 py-2 text-sm text-(--lv-text-primary) transition hover:bg-(--lv-control-button-secondary-hoverBackground) active:bg-(--lv-control-button-secondary-activeBackground)"></button></div></div><div class="w-full text-sm text-(--lv-text-secondary)"><span>'),ii=x('<div class="relative mx-auto flex w-fit items-center justify-center rounded-lg border border-(--lv-control-button-secondary-border) bg-(--lv-qr-background) p-2"><button type=button class="h-[200px] w-[200px] cursor-pointer rounded bg-(--lv-qr-background) text-(--lv-qr-color)">');const si=t=>ni(t,"svg",{optimize:!0,encoding:"byte",border:2}),ai=()=>{const{t}=Q(),{uri:e}=Ye(),r=()=>{const n=e();n&&on(n)};return(()=>{var n=oi(),o=n.firstChild,i=o.firstChild,a=i.firstChild,s=o.nextSibling,l=s.firstChild;return m(o,v(ve,{get when(){return e()},children:d=>(()=>{var u=ii(),c=u.firstChild;return c.$$click=r,z(f=>{var h=String(t("handshake.clickToCopyUrl")),g=si(d());return h!==f.e&&Z(c,"title",f.e=h),g!==f.t&&(c.innerHTML=f.t=g),f},{e:void 0,t:void 0}),u})()}),i),a.$$click=r,m(a,()=>t("handshake.copyConnectionUrl")),m(l,()=>t("handshake.scanCodeInstruction")),n})()};Ae(["click"]);var li=x('<div class="flex items-center justify-center"><div class="h-8 w-8 animate-spin rounded-full border-4 border-blue-500 border-t-transparent">'),Cr=x('<div class="flex flex-col items-center gap-4 p-6"><div class=text-center><h3 class="mb-2 font-semibold text-(--lv-text-primary) text-lg"></h3><p class="text-(--lv-text-muted) text-sm">'),ci=x("<div>");const Sr=()=>li(),di=()=>{const{status:t}=Ye(),{t:e}=Q();return(()=>{var r=ci();return m(r,v(Gr,{get children(){return[v(Ne,{get when(){return[it.CREATED,it.SIGNALING].includes(t()?.status??"")},get children(){var n=Cr(),o=n.firstChild,i=o.firstChild,a=i.nextSibling;return m(n,v(Sr,{}),o),m(i,()=>e("connectionFlow.connecting")),m(a,()=>e("connectionFlow.waitingForNetwork")),n}}),v(Ne,{get when(){return t()?.status===it.READY},get children(){return v(ai,{})}}),v(Ne,{get when(){return t()?.status===it.LINKING},get children(){var n=Cr(),o=n.firstChild,i=o.firstChild,a=i.nextSibling;return m(n,v(Sr,{}),o),m(i,()=>e("connectionFlow.establishingConnection")),m(a,()=>e("connectionFlow.mayTakeFewSeconds")),n}})]}})),r})()};var ui=x('<div class="flex flex-col items-center gap-4 p-6"><div class=text-center><div class="mb-4 text-4xl">⚠️</div><h3 class="mb-2 font-semibold text-(--lv-text-primary) text-lg"></h3><p class="mb-2 text-(--lv-text-muted) text-sm"></p></div><div class="flex w-full flex-col gap-2"><button type=button class="w-full rounded-lg bg-(--lv-control-button-primary-background) px-4 py-2 font-semibold text-(--lv-control-button-primary-color, var(--lv-text-primary)) text-sm transition hover:bg-(--lv-control-button-primary-background-hover)"></button><button type=button class="w-full rounded-lg bg-(--lv-control-button-secondary-background) px-4 py-2 font-semibold text-(--lv-text-primary) text-sm transition hover:bg-(--lv-control-button-primary-background-hover)">');const fi=t=>{const{t:e}=Q(),{provider:r}=Re(),n=T(()=>r.getState().error??r.getState().session?.error),o=T(()=>/ice candidates/i.test(n()??"")),i=T(()=>o()?e("connectionFlow.errorNoIce"):n()??e("connectionFlow.errorGeneric")),a=()=>{r.closeSession()};return(()=>{var s=ui(),l=s.firstChild,d=l.firstChild,u=d.nextSibling,c=u.nextSibling,f=l.nextSibling,h=f.firstChild,g=h.nextSibling;return m(u,()=>e("connectionFlow.connectionFailed")),m(c,i),h.$$click=a,m(h,()=>e("connectionFlow.tryAgain")),yt(g,"click",t.onClose,!0),m(g,()=>e("common.close")),s})()};Ae(["click"]);var hi=x('<div class="flex items-center justify-center"><div class="h-8 w-8 animate-spin rounded-full border-4 border-blue-500 border-t-transparent">'),Ar=x('<div class="flex flex-col items-center gap-4 p-6"><div class=text-center><h3 class="mb-2 font-semibold text-(--lv-text-primary) text-lg"></h3><p class="text-(--lv-text-muted) text-sm">'),gi=x("<div class=w-full style=view-transition-name:connection-flow>"),vi=x('<div class="mb-4 text-4xl">✅'),pi=x('<div class="mb-4 flex flex-col items-center gap-2"><span class="font-medium text-(--lv-text-primary) text-sm">'),mi=x("<div class=text-4xl>✅"),bi=x('<img alt class="h-12 w-12 rounded-xl">');const wi=()=>hi(),yi=t=>{const{t:e}=Q(),{provider:r}=Re(),[n,o]=D(r.getState().status),i=()=>r.getSession()?.getState().peerInfo,a=()=>{const s=i()?.icon;return s&&(s.startsWith("data:image/")||s.startsWith("https://"))?s:void 0};return Ft(()=>{r.on("status_change",o)}),se(()=>{r.off("status_change",o)}),(()=>{var s=gi();return m(s,v(Gr,{get fallback(){return v(jt,{get state(){return n()}})},get children(){return[v(Ne,{get when(){return n()===oe.CREATING},get children(){var l=Ar(),d=l.firstChild,u=d.firstChild,c=u.nextSibling;return m(l,v(wi,{}),d),m(u,()=>e("connectionFlow.preparingConnection")),m(c,()=>e("connectionFlow.generatingKeys")),l}}),v(Ne,{get when(){return n()===oe.CONNECTING},get children(){return v(di,{get onClose(){return t.onClose}})}}),v(Ne,{get when(){return n()===oe.CONNECTED},get children(){var l=Ar(),d=l.firstChild,u=d.firstChild,c=u.nextSibling;return m(d,v(ve,{get when(){return i()},get fallback(){return vi()},children:f=>(()=>{var h=pi(),g=h.firstChild;return m(h,v(ve,{get when(){return a()},get fallback(){return mi()},children:b=>(()=>{var p=bi();return z(()=>Z(p,"src",b())),p})()}),g),m(g,()=>f().name),h})()}),u),m(u,()=>e("connectionFlow.connectedSuccessfully")),m(c,()=>e("connectionFlow.walletConnectedReady")),l}}),v(Ne,{get when(){return n()===oe.ERROR},get children(){return v(fi,{get onClose(){return t.onClose}})}})]}})),s})()};var xi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},Le=xi,ki=x("<svg>"),Ci=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},Si=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim(),Ai=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase()),$r=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$i=t=>{const e=Ai(t);return e.charAt(0).toUpperCase()+e.slice(1)},Ti=t=>{const[e,r]=wt(t,["color","size","strokeWidth","children","class","name","iconNode","absoluteStrokeWidth"]);return(()=>{var n=ki();return gt(n,X(Le,{get width(){return e.size??Le.width},get height(){return e.size??Le.height},get stroke(){return e.color??Le.stroke},get"stroke-width"(){return Me(()=>!!e.absoluteStrokeWidth)()?Number(e.strokeWidth??Le["stroke-width"])*24/Number(e.size):Number(e.strokeWidth??Le["stroke-width"])},get class(){return Si("lucide","lucide-icon",...e.name!=null?[`lucide-${$r($i(e.name))}`,`lucide-${$r(e.name)}`]:[],e.class!=null?e.class:"")},get"aria-hidden"(){return!e.children&&!Ci(r)?"true":void 0}},r),!0,!0),m(n,v(Ce,{get each(){return e.iconNode},children:([o,i])=>v(Qn,X({component:o},i))})),n})()},$e=Ti,Ei=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_i=t=>v($e,X(t,{iconNode:Ei,name:"chevron-left"})),Pi=_i,Ni=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Bi=t=>v($e,X(t,{iconNode:Ni,name:"chevron-right"})),Mi=Bi,Ri=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Oi=t=>v($e,X(t,{iconNode:Ri,name:"circle-question-mark"})),sn=Oi,Ii=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Li=t=>v($e,X(t,{iconNode:Ii,name:"plus"})),ji=Li,Di=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Vi=t=>v($e,X(t,{iconNode:Di,name:"qr-code"})),Fi=Vi,zi=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ui=t=>v($e,X(t,{iconNode:zi,name:"settings"})),Wi=Ui,Gi=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],qi=t=>v($e,X(t,{iconNode:Gi,name:"trash-2"})),Ki=qi,Hi=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xi=t=>v($e,X(t,{iconNode:Hi,name:"x"})),Qi=Xi,Ji=/\s+/g,Zi=t=>typeof t!="string"||!t?t:t.replace(Ji," ").trim(),mt=(...t)=>{const e=[],r=n=>{if(!n&&n!==0&&n!==0n)return;if(Array.isArray(n)){for(let i=0,a=n.length;i<a;i++)r(n[i]);return}const o=typeof n;if(o==="string"||o==="number"||o==="bigint"){if(o==="number"&&n!==n)return;e.push(String(n))}else if(o==="object"){const i=Object.keys(n);for(let a=0,s=i.length;a<s;a++){const l=i[a];n[l]&&e.push(l)}}};for(let n=0,o=t.length;n<o;n++){const i=t[n];i!=null&&r(i)}return e.length>0?Zi(e.join(" ")):void 0},Tr=t=>t===!1?"false":t===!0?"true":t===0?"0":t,re=t=>{if(!t||typeof t!="object")return!0;for(const e in t)return!1;return!0},Yi=(t,e)=>{if(t===e)return!0;if(!t||!e)return!1;const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){const i=r[o];if(!n.includes(i)||t[i]!==e[i])return!1}return!0},es=(t,e)=>{for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];r in t?t[r]=mt(t[r],n):t[r]=n}return t},an=(t,e)=>{for(let r=0;r<t.length;r++){const n=t[r];Array.isArray(n)?an(n,e):n&&e.push(n)}},ln=(...t)=>{const e=[];an(t,e);const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},Dt=(t,e)=>{const r={};for(const n in t){const o=t[n];if(n in e){const i=e[n];Array.isArray(o)||Array.isArray(i)?r[n]=ln(i,o):typeof o=="object"&&typeof i=="object"&&o&&i?r[n]=Dt(o,i):r[n]=i+" "+o}else r[n]=o}for(const n in e)n in t||(r[n]=e[n]);return r},ts={twMerge:!0,twMergeConfig:{}};function rs(){let t=null,e={},r=!1;return{get cachedTwMerge(){return t},set cachedTwMerge(n){t=n},get cachedTwMergeConfig(){return e},set cachedTwMergeConfig(n){e=n},get didTwMergeConfigChange(){return r},set didTwMergeConfigChange(n){r=n},reset(){t=null,e={},r=!1}}}var _t=rs(),ns=t=>{const e=(n,o)=>{const{extend:i=null,slots:a={},variants:s={},compoundVariants:l=[],compoundSlots:d=[],defaultVariants:u={}}=n,c={...ts,...o},f=i?.base?mt(i.base,n?.base):n?.base,h=i?.variants&&!re(i.variants)?Dt(s,i.variants):s,g=i?.defaultVariants&&!re(i.defaultVariants)?{...i.defaultVariants,...u}:u;!re(c.twMergeConfig)&&!Yi(c.twMergeConfig,_t.cachedTwMergeConfig)&&(_t.didTwMergeConfigChange=!0,_t.cachedTwMergeConfig=c.twMergeConfig);const b=re(i?.slots),p=re(a)?{}:{base:mt(n?.base,b&&i?.base),...a},C=b?p:es({...i?.slots},re(p)?{base:n?.base}:p),k=re(i?.compoundVariants)?l:ln(i?.compoundVariants,l),y=_=>{if(re(h)&&re(a)&&b)return t(f,_?.class,_?.className)(c);if(k&&!Array.isArray(k))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof k}`);if(d&&!Array.isArray(d))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof d}`);const pe=(A,$=h,E=null,M=null)=>{const P=$[A];if(!P||re(P))return null;const O=M?.[A]??_?.[A];if(O===null)return null;const J=Tr(O);if(typeof J=="object")return null;const ce=g?.[A],G=J??Tr(ce);return P[G||"false"]},he=()=>{if(!h)return null;const A=Object.keys(h),$=[];for(let E=0;E<A.length;E++){const M=pe(A[E],h);M&&$.push(M)}return $},De=(A,$)=>{if(!h||typeof h!="object")return null;const E=[];for(const M in h){const P=pe(M,h,A,$),O=A==="base"&&typeof P=="string"?P:P&&P[A];O&&E.push(O)}return E},tt={};for(const A in _){const $=_[A];$!==void 0&&(tt[A]=$)}const Ve=(A,$)=>{const E=typeof _?.[A]=="object"?{[A]:_[A]?.initial}:{};return{...g,...tt,...E,...$}},rt=(A=[],$)=>{const E=[],M=A.length;for(let P=0;P<M;P++){const{class:O,className:J,...ce}=A[P];let G=!0;const ae=Ve(null,$);for(const me in ce){const le=ce[me],Oe=ae[me];if(Array.isArray(le)){if(!le.includes(Oe)){G=!1;break}}else{if((le==null||le===!1)&&(Oe==null||Oe===!1))continue;if(Oe!==le){G=!1;break}}}G&&(O&&E.push(O),J&&E.push(J))}return E},nt=A=>{const $=rt(k,A);if(!Array.isArray($))return $;const E={},M=t;for(let P=0;P<$.length;P++){const O=$[P];if(typeof O=="string")E.base=M(E.base,O)(c);else if(typeof O=="object")for(const J in O)E[J]=M(E[J],O[J])(c)}return E},Te=A=>{if(d.length<1)return null;const $={},E=Ve(null,A);for(let M=0;M<d.length;M++){const{slots:P=[],class:O,className:J,...ce}=d[M];if(!re(ce)){let G=!0;for(const ae in ce){const me=E[ae],le=ce[ae];if(me===void 0||(Array.isArray(le)?!le.includes(me):le!==me)){G=!1;break}}if(!G)continue}for(let G=0;G<P.length;G++){const ae=P[G];$[ae]||($[ae]=[]),$[ae].push([O,J])}}return $};if(!re(a)||!b){const A={};if(typeof C=="object"&&!re(C)){const $=t;for(const E in C)A[E]=M=>{const P=nt(M),O=Te(M);return $(C[E],De(E,M),P?P[E]:void 0,O?O[E]:void 0,M?.class,M?.className)(c)}}return A}return t(f,he(),rt(k),_?.class,_?.className)(c)},F=()=>{if(!(!h||typeof h!="object"))return Object.keys(h)};return y.variantKeys=F(),y.extend=i,y.base=f,y.slots=C,y.variants=h,y.defaultVariants=g,y.compoundSlots=d,y.compoundVariants=k,y};return{tv:e,createTV:n=>(o,i)=>e(o,i?Dt(n,i):n)}},os=(...t)=>e=>mt(t)||void 0,{tv:kt}=ns(os),is=x("<a>"),ss=x("<button type=button>");const Er=kt({base:"flex items-center justify-center rounded-lg transition-all duration-100 cursor-pointer active:scale-95",variants:{$variant:{primary:"font-semibold text-sm bg-(--lv-control-button-primary-background) text-(--lv-control-button-primary-color) border-(--lv-control-button-primary-border) hover:bg-(--lv-control-button-primary-hoverBackground,var(--lv-control-button-primary-background)) active:bg-(--lv-control-button-primary-activeBackground,var(--lv-control-button-primary-hoverBackground,var(--lv-control-button-primary-background))) disabled:bg-(--lv-control-button-primary-disabledBackground,var(--lv-control-button-primary-background)) disabled:text-(--lv-control-button-primary-disabledColor,var(--lv-control-button-primary-color))",secondary:"border bg-(--lv-control-button-secondary-background) text-(--lv-control-button-secondary-color) border-(--lv-control-button-secondary-border,var(--lv-control-button-secondary-background)) hover:bg-(--lv-control-button-secondary-hoverBackground,var(--lv-control-button-secondary-background)) active:bg-(--lv-control-button-secondary-activeBackground,var(--lv-control-button-secondary-hoverBackground,var(--lv-control-button-secondary-background))) disabled:bg-(--lv-control-button-secondary-disabledBackground,var(--lv-control-button-secondary-background)) disabled:text-(--lv-control-button-secondary-disabledColor,var(--lv-control-button-secondary-color))",tertiary:"bg-transparent text-(--lv-text-muted) hover:bg-(--lv-control-button-tertiary-hoverBackground,transparent) active:bg-(--lv-control-button-tertiary-activeBackground,var(--lv-control-button-tertiary-hoverBackground,transparent)) disabled:text-(--lv-control-button-tertiary-disabledColor,var(--lv-text-muted))"},$size:{sm:"h-6",md:"h-8",lg:"h-11"},$aspect:{square:"aspect-square",auto:""}},defaultVariants:{$size:"md",$variant:"primary",$aspect:"auto"}}),je=t=>{const[e,r]=wt(t,["children","class","$variant","$size","$aspect","href","onClick"]);return e.href?(()=>{var n=is();return gt(n,X({get href(){return e.href},get onClick(){return e.onClick},get class(){return ke(Er({$variant:e.$variant,$size:e.$size,$aspect:e.$aspect}),e.class)}},r),!1,!0),m(n,()=>e.children),n})():(()=>{var n=ss();return gt(n,X({get onClick(){return e.onClick},get class(){return ke(Er({$variant:e.$variant,$size:e.$size,$aspect:e.$aspect}),e.class)}},r),!1,!0),m(n,()=>e.children),n})()};var as=x('<div class="flex h-full w-full justify-between"><div class="grow py-1 ps-1"><div class="h-full rounded-sm border border-gray-300 bg-gray-400"></div></div><div class="flex h-full w-3 flex-col items-center justify-center gap-0.5 pr-0.5">'),ls=x('<div class="h-1.5 w-1.5 rounded-full border border-gray-500">'),cs=x('<div class="flex h-full w-full flex-col justify-between"><div class="grow px-1 pt-1"><div class="h-full rounded-sm border border-gray-200 bg-gray-300"></div></div><div class="flex h-3 w-full items-center justify-center gap-0.5 pb-0.5">'),ds=x('<div class="h-1.5 w-1.5 rounded-full border border-gray-400">'),us=x('<div class="-space-x-4 flex items-end"><div class="h-38 w-48 overflow-hidden rounded-lg bg-gray-300"></div><div class="h-18 w-12 overflow-hidden rounded-lg bg-gray-200">');const cn=t=>t?1:3,fs=t=>(()=>{var e=as(),r=e.firstChild,n=r.nextSibling;return m(n,v(Ce,{get each(){return Array.from({length:cn(t.isApple)})},children:()=>ls()})),e})(),hs=t=>(()=>{var e=cs(),r=e.firstChild,n=r.nextSibling;return m(n,v(Ce,{get each(){return Array.from({length:cn(t.isApple)})},children:()=>ds()})),e})(),gs=()=>(()=>{var e=us(),r=e.firstChild,n=r.nextSibling;return m(r,v(fs,{isApple:!0})),m(n,v(hs,{isApple:!0})),e})();var vs=x('<div class="flex flex-col items-center gap-4 p-6"><div class=text-center><p class="text-sm text-(--lv-text-secondary)"></p></div><div class="flex items-center">');const ps=t=>{const{t:e}=Q(),{start:r}=jo();return(()=>{var n=vs(),o=n.firstChild,i=o.firstChild,a=o.nextSibling;return m(n,v(gs,{}),o),m(i,()=>e("disconnected.prompt")),m(a,v(je,{type:"button",onClick:r,class:"z-10 px-6 py-3",$variant:"primary",$size:"lg",get children(){return e("disconnected.generateQr")}}),null),m(a,v(je,{type:"button",get"aria-label"(){return String(e("disconnected.connectionSettings"))},"aria-pressed":!1,get onClick(){return t.onSettings},class:"px-3 ltr:-ml-1 ltr:rounded-l-none rtl:-mr-1 rtl:rounded-r-none",$aspect:"square",$size:"lg",$variant:"secondary",get children(){return v(Wi,{class:"h-5 w-5 text-(--lv-text-muted)"})}}),null),n})()};var ms=x('<div class="flex flex-col space-y-2 px-4 text-start"><div class="min-h-32 w-full rounded-md border border-(--lv-control-button-secondary-border) md:flex justify-start divide-y md:divide-y-0 md:divide-x divide-(--lv-control-button-secondary-border)"><div class="p-2 w-full md:w-3/5"></div><div class="flex justify-center items-center grow"></div></div><div class="w-full rounded-md border border-(--lv-control-button-secondary-border) md:flex justify-start divide-y md:divide-y-0 md:divide-x divide-(--lv-control-button-secondary-border)"><div class="p-2 w-full md:w-3/5"></div><div class></div></div><div class="w-full rounded-md border border-(--lv-control-button-secondary-border) md:flex justify-start divide-y md:divide-y-0 md:divide-x divide-(--lv-control-button-secondary-border)"><div class="p-2 w-full md:w-3/5"></div><div class>');const bs=()=>{const{t}=Q();return(()=>{var e=ms(),r=e.firstChild,n=r.firstChild,o=n.nextSibling,i=r.nextSibling,a=i.firstChild,s=i.nextSibling,l=s.firstChild;return m(n,()=>t("info.scanQrCode")),m(o,v(Fi,{class:"w-10 h-10"})),m(a,()=>t("info.approveOnDevice")),m(l,()=>t("info.youreConnected")),e})()},Vt=(t,{duration:e=200}={})=>{const r=typeof t=="function"?t:()=>t,n=r(),[o,i]=D(n),[a,s]=D(void 0);let l,d=n;return ie(()=>{const u=r();Object.is(u,d)||(l&&globalThis.clearTimeout(l),s(()=>d),i(()=>u),d=u,l=globalThis.setTimeout(()=>{s(()=>{}),l=void 0},e),se(()=>{l&&globalThis.clearTimeout(l)}))}),{current:o,previous:a,isTransitioning:()=>a()!==void 0}},et=()=>{const{provider:t}=Re(),[e,r]=D(t.storage.getSettings()),n=u=>{r(u),t.storage.setSettings(u)};return{settings:e,setSettings:n,setLanguage:u=>{n({...e(),language:u})},setThemeMode:u=>{n({...e(),theme:u})},setSignalingProtocol:u=>{n({...e(),signaling:{p:u,s:e()?.signaling?.s??{}}})},setSignalingOptions:u=>{const c=e()?.signaling?.p;if(!c)return;const f=e()?.signaling?.s??{};n({...e(),signaling:{p:c,s:{...f,[c]:u.url}}})},setRetainSessionHistory:u=>{n({...e(),retainHistory:u})},setAutoReconnect:u=>{n({...e(),autoReconnect:u})}}},dn=()=>{const{settings:t}=et(),e=T(()=>t().theme),r=T(()=>"light");return{theme:e,mode:r}},un="data:image/webp;base64,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";var ws=x('<div class="group flex items-center gap-2 rounded-md px-2 py-2 hover:bg-(--lv-control-button-secondary-background)"><div class="pointer-events-none whitespace-nowrap rounded-md text-xs opacity-0 group-hover:opacity-100"></div><div>');const ys=()=>{const{t}=Q(),{status:e}=Ye(),r=T(()=>{const n=e()?.status,o=e()?.signaling?.state;return Be({sessionState:n,signalState:o}).with({sessionState:"connected"},()=>({icon:"✅",text:t("status.connectedSuccessfully")})).with({sessionState:"signaling",signalState:"standby"},()=>({icon:"🫥",text:t("status.connecting")})).with({sessionState:"signaling",signalState:"connecting"},()=>({icon:"↗️",text:t("status.connecting")})).with({sessionState:"signaling",signalState:"ready"},()=>({icon:"👋",text:t("status.ready")})).with({sessionState:"signaling",signalState:"handshake"},()=>({icon:"🤝",text:t("status.handshakeClosed")})).with({sessionState:"signaling",signalState:"handshake-partial"},()=>({icon:"🤝",text:t("status.handshakePartial")})).with({sessionState:"signaling",signalState:"encrypted"},()=>({icon:"🔒",text:t("status.encrypted")})).with({sessionState:"signaling",signalState:"error"},()=>({icon:"❌",text:t("status.signalError")})).otherwise(()=>{})});return v(ve,{get when(){return r()},children:n=>(()=>{var o=ws(),i=o.firstChild,a=i.nextSibling;return m(i,()=>n().text),m(a,()=>n().icon),o})()})};var xs=x('<div class="h-11 w-full">'),ks=x('<div class="absolute inset-x-0 bottom-0 flex items-end justify-between gap-2 px-3 py-2 text-(--lv-text-muted)"><a href=https://github.com/v3xlabs/open-lavatory target=_blank rel=noreferrer class="flex items-center gap-2 p-1 font-semibold text-sm text-(--lv-text-muted)"><img alt="Open Lavatory Logo"width=20 height=20 class=rounded data-openlv-brand-logo><span>openlv</span></a><div class="text-sm text-(--lv-text-muted)">');const Cs=()=>[xs(),(()=>{var t=ks(),e=t.firstChild,r=e.firstChild,n=e.nextSibling;return Z(r,"src",un),m(n,v(ys,{})),t})()];var Ss=x('<div class="flex items-center justify-between px-2 py-2"><h2 class="flex items-center justify-center gap-2 font-semibold text-(--lv-text-primary) text-lg">');const As=t=>{const{t:e}=Q();return(()=>{var r=Ss(),n=r.firstChild;return m(r,(()=>{var o=Me(()=>!!t.onBack);return()=>o()?v(je,{get onClick(){return t.onBack},get"aria-label"(){return String(t.view==="settings"?e("modal.backToQr"):e("modal.closeModal"))},$variant:"tertiary",$aspect:"square",$size:"md",get children(){return v(Pi,{class:"h-6 w-6 text-(--lv-text-muted) rtl:rotate-180"})}}):v(je,{type:"button",onClick:()=>t.setView("info"),$variant:"tertiary",$aspect:"square",$size:"md",get children(){return v(sn,{class:"h-5 w-5"})}})})(),n),m(n,()=>t.title),m(r,v(je,{type:"button",get"aria-label"(){return String(e("common.close"))},"aria-pressed":!1,get onClick(){return t.onClose},$variant:"tertiary",$aspect:"square",$size:"md",get children(){return v(Qi,{class:"h-6 w-6 text-(--lv-text-muted)"})}}),null),r})()},$s=(t,{transitionDuration:e=200}={})=>{const[r,n]=D([t]),[o,i]=D(0),a=T(()=>r()[o()]??t),{current:s,previous:l,isTransitioning:d}=Vt(a,{duration:e});return{screen:s,previousScreen:l,isTransitioning:d,navigate:f=>{const h=o(),g=r(),b=g[h];if(Object.is(b,f))return;const p=g.slice(0,h+1);p.push(f),n(p),i(p.length-1)},goBack:()=>{i(f=>Math.max(0,f-1))},isAtRoot:()=>o()===0}};var Ts=x('<div class="modal-transition__layer modal-transition__layer--outgoing">'),Es=x("<div><div>");const _s=t=>(()=>{var e=Es(),r=e.firstChild;return m(e,v(ve,{get when(){return t.previous!==void 0},get children(){var n=Ts();return m(n,()=>t.render(t.previous)),n}}),r),m(r,()=>t.render(t.current)),z(n=>{var o=ke("modal-transition__container",t.class),i=ke("modal-transition__layer",t.isTransitioning&&"modal-transition__layer--incoming");return o!==n.e&&ne(e,n.e=o),i!==n.t&&ne(r,n.t=i),n},{e:void 0,t:void 0}),e})();var Ps=x('<div><div class="flex items-end justify-between py-1 pl-2"><div class="font-medium text-(--lv-text-primary) text-sm"></div><div></div></div><div class="flex flex-col gap-1 rounded-md bg-(--lv-card-background)">');const Xe=t=>(()=>{var e=Ps(),r=e.firstChild,n=r.firstChild,o=n.nextSibling,i=r.nextSibling;return m(n,()=>t.title),m(o,()=>t.right),m(i,()=>t.children),e})();var Ns=x('<div class="flex items-baseline justify-between gap-2 px-2 py-1 first:pt-2 last:pb-2"><div class="text-sm text-(--lv-text-secondary) text-start"></div><div>');const Qe=t=>(()=>{var e=Ns(),r=e.firstChild,n=r.nextSibling;return m(r,()=>t.label),m(n,()=>t.children),e})();var Bs=x("<select>"),Ms=x("<div>"),Rs=x("<button type=button>"),Os=x("<option>");const Is=kt({slots:{root:"flex overflow-hidden rounded-md border border-(--lv-control-button-secondary-border)",box:"px-4 py-2 font-semibold text-xs transition border-l first:border-l-0 border-(--lv-control-button-secondary-border)"},variants:{active:{on:{box:"bg-(--lv-control-button-secondary-background) text-(--lv-text-primary)"},off:{box:"bg-transparent text-(--lv-text-secondary) cursor-pointer"}}},defaultVariants:{active:"off"}}),Ls=kt({base:"w-full rounded-md border border-(--lv-control-button-secondary-border) bg-(--lv-control-button-secondary-background) px-3 py-2 font-semibold text-xs text-(--lv-text-primary) cursor-pointer focus:outline-none focus:ring-2 focus:ring-(--lv-control-button-primary-background) appearance-none bg-[url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23888%22%20stroke-width%3D%222%22%3E%3Cpath%20d%3D%22M6%209l6%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:14px] bg-[right_8px_center] bg-no-repeat pr-8"}),Ct=t=>{const e=Ls(),{root:r,box:n}=Is({});return v(ve,{get when(){return t.options.length>(t.dropdownThreshold??3)},get fallback(){return(()=>{var o=Ms();return m(o,v(Ce,{get each(){return t.options},children:([i,a])=>(()=>{var s=Rs();return s.$$click=()=>t.onChange(i),m(s,a),z(l=>{var d=i===t.value,u=n({active:i===t.value?"on":"off"});return d!==l.e&&Z(s,"aria-pressed",l.e=d),u!==l.t&&ne(s,l.t=u),l},{e:void 0,t:void 0}),s})()})),z(()=>ne(o,r())),o})()},get children(){var o=Bs();return o.addEventListener("change",i=>t.onChange(i.currentTarget.value)),ne(o,e),m(o,v(Ce,{get each(){return t.options},children:([i,a])=>(()=>{var s=Os();return s.value=i,m(s,a),s})()})),z(()=>o.value=t.value),o}})};Ae(["click"]);const js=()=>{const{t}=Q(),e=dn(),r=()=>e.mode()==="auto",n=()=>e.mode()==="auto"?"system":e.mode(),o=i=>{};return v(ve,{get when(){return r()},get children(){return v(Qe,{get label(){return t("settings.theme.mode")},get children(){return v(Ct,{get options(){return[["light",t("settings.theme.light")],["dark",t("settings.theme.dark")],["system",t("settings.theme.system")]]},get value(){return n()},onChange:i=>o()})}})}})},Ds=()=>{const{t,languageTag:e,setLanguageTag:r}=Q(),{settings:n,setLanguage:o}=et(),i=T(()=>[...Wt].sort((s,l)=>{const d=ur(s.tag);return ur(l.tag)-d})),a=s=>{const l=s;r(l),o(l)};return v(Xe,{get title(){return t("settings.appearance")},get children(){return[v(Qe,{get label(){return t("settings.language")},get children(){return v(Ct,{get options(){return i().map(s=>[s.tag,s.nativeName])},get value(){return n()?.language||e()},onChange:a})}}),v(js,{})]}})};var Vs=x("<div><div></div><div>"),Fs=x("<div>Text");const zs=kt({slots:{root:"group relative",box:"cursor-pointer rounded-md transition-colors flex items-center justify-center hover:[background-color:var(--lv-control-button-tertiary-hoverBackground)] text-(--lv-text-muted)",popover:"-translate-x-1/2 absolute top-full left-1/2 z-10 hidden rounded-md shadow-sm group-hover:block border border-(--lv-control-button-secondary-border) bg-(--lv-body-background) px-2 py-1.5 text-(--lv-text-primary) text-sm",icon:""},variants:{size:{sm:{box:"h-5 w-5 p-1",icon:"h-3 w-3"},md:{box:"h-6 w-6 p-1",icon:"h-4 w-4"},lg:{box:"h-8 w-8 p-1.5",icon:"h-4 w-4"}},variant:{icon:"",text:""}},defaultVariants:{size:"lg"}}),_r=t=>{const e=X({variant:"icon",size:"lg"},t),{root:r,box:n,popover:o,icon:i}=zs({size:e.size,variant:e.variant});return(()=>{var a=Vs(),s=a.firstChild,l=s.nextSibling;return m(s,()=>Be(e.variant).with("icon",()=>v(sn,{get class(){return i()}})).with("text",()=>Fs()).exhaustive()),m(l,()=>e.children),z(d=>{var u=r(),c=n(),f=o();return u!==d.e&&ne(a,d.e=u),c!==d.t&&ne(s,d.t=c),f!==d.a&&ne(l,d.a=f),d},{e:void 0,t:void 0,a:void 0}),a})()};var Us=x('<span class="text-sm text-(--lv-text-muted)">'),Ws=x('<button type=button class="flex w-full cursor-pointer items-center justify-between gap-2 first:rounded-t-sm last:rounded-b-sm px-2 py-1 first:pt-1.5 last:pb-2 hover:bg-(--lv-control-button-tertiary-hoverBackground)"><div class="text-sm text-(--lv-text-secondary) flex items-center gap-1"></div><div class="flex items-center gap-1">');const Pr=t=>(()=>{var e=Ws(),r=e.firstChild,n=r.nextSibling;return yt(e,"click",t.onClick,!0),m(r,()=>t.label),m(n,v(ve,{get when(){return t.value},get children(){var o=Us();return m(o,()=>t.value),o}}),null),m(n,v(Mi,{class:"h-4 w-4 text-(--lv-text-muted) rtl:rotate-180"}),null),e})();Ae(["click"]);const Gs=t=>{const{t:e}=Q();return v(Ct,{get options(){return[["true",String(e("common.yes"))],["false",String(e("common.no"))]]},get value(){return t.value?"true":"false"},onChange:r=>t.onChange(r==="true")})},qs=t=>{const{t:e}=Q(),{settings:r,setRetainSessionHistory:n,setAutoReconnect:o}=et();return v(Xe,{get title(){return e("settings.connectionPreferences.title")},get children(){return[v(Pr,{get label(){return[Me(()=>e("settings.signaling.title")),v(_r,{variant:"icon",get children(){return e("settings.signaling.description")}})]},onClick:()=>t.onNavigate("signaling"),get value(){return r()?.signaling?.p}}),v(Pr,{get label(){return[Me(()=>e("settings.transport.title")),v(_r,{variant:"icon",get children(){return e("settings.transport.description")}})]},onClick:()=>t.onNavigate("transport"),value:"WebRTC"}),v(Ce,{get each(){return[[e("settings.connectionPreferences.retainSessionHistory"),r()?.retainHistory??!1,n],[e("settings.connectionPreferences.autoReconnect"),r()?.autoReconnect??!1,o]]},children:([i,a,s])=>v(Qe,{label:i,get children(){return v(Gs,{label:i,value:a,onChange:s})}})})]}})};var Ks=x('<input class="h-9 w-full rounded-lg border bg-white px-3 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 text-(--lv-text-primary) bg-(--lv-body-background) border-(--lv-control-input-border)">');const We=t=>{const e=X({readOnly:!0},t),[r]=wt(e,["id","value","placeholder","ariaLabel","readOnly","onChange"]);return(()=>{var n=Ks();return n.$$input=o=>{r.onChange?.(o.currentTarget.value)},z(o=>{var i=r.id,a=r.placeholder,s=r.ariaLabel,l=r.readOnly;return i!==o.e&&Z(n,"id",o.e=i),a!==o.t&&Z(n,"placeholder",o.t=a),s!==o.a&&Z(n,"aria-label",o.a=s),l!==o.o&&(n.readOnly=o.o=l),o},{e:void 0,t:void 0,a:void 0,o:void 0}),z(()=>n.value=r.value),n})()};Ae(["input"]);var Hs=x('<div><div class="p-2 text-sm text-(--lv-text-secondary) text-start">');const Xs=["mqtt","ntfy","gun"],Qs=()=>{const{t}=Q(),{settings:e,setSignalingProtocol:r,setSignalingOptions:n}=et(),o=T(()=>e()?.signaling?.p),i=T(()=>{const a=o();return a?e()?.signaling?.s?.[a]??"":""});return(()=>{var a=Hs(),s=a.firstChild;return m(a,v(Xe,{get title(){return t("settings.signaling.title")},get children(){return[v(Qe,{get label(){return t("common.protocol")},get children(){return v(Ct,{get options(){return Xs.map(l=>[l.toLowerCase(),l.toUpperCase()])},get value(){return o()??""},onChange:l=>r(l)})}}),v(Qe,{get label(){return t("settings.signaling.server")},get children(){return v(We,{id:"server",get value(){return i()},onChange:l=>n({url:l}),get placeholder(){return String(t("settings.signaling.serverUrl"))},get ariaLabel(){return String(t("settings.signaling.serverUrl"))},readOnly:!1})}})]}}),s),m(s,()=>t("settings.signaling.description")),a})()};var Js=x('<div class="flex items-center gap-2"><div class=flex-1>'),Zs=x('<button type=button class="flex w-full cursor-pointer items-center justify-center gap-1 rounded-md border border-dashed border-(--lv-control-input-border) py-2 text-sm text-(--lv-text-muted) hover:bg-(--lv-card-background)">'),Ys=x('<div class="flex flex-col gap-2 p-2">'),ea=x('<div class="flex flex-col gap-3 p-2">'),ta=x('<div class="p-2 text-sm text-(--lv-text-secondary) text-start">'),ra=x('<div class="flex flex-col gap-2 rounded-md border border-(--lv-control-input-border) p-2"><div class="grid grid-cols-2 gap-2">');const Nr=t=>(()=>{var e=Js(),r=e.firstChild;return m(r,()=>t.children),m(e,v(je,{get onClick(){return t.onRemove},$variant:"tertiary",$aspect:"square",$size:"sm",get children(){return v(Ki,{class:"h-4 w-4 text-(--lv-text-muted)"})}}),null),e})(),Br=t=>(()=>{var e=Zs();return yt(e,"click",t.onClick,!0),m(e,v(ji,{class:"h-4 w-4"}),null),m(e,()=>t.label,null),e})(),na=()=>{const{t}=Q();et();const[e,r]=D([]),[n,o]=D([]),i=()=>{o([...n(),""])},a=c=>{o(n().filter((f,h)=>h!==c))},s=(c,f)=>{o(n().map((h,g)=>g===c?f:h))},l=()=>{r([...e(),{urls:""}])},d=c=>{r(e().filter((f,h)=>h!==c))},u=(c,f,h)=>{r(e().map((g,b)=>b===c?{...g,[f]:h}:g))};return[v(Xe,{get title(){return t("settings.transport.iceServers.stun")},get children(){var c=Ys();return m(c,v(Ce,{get each(){return n()},children:(f,h)=>v(Nr,{onRemove:()=>a(h()),get children(){return v(We,{value:f,onChange:g=>s(h(),g),placeholder:"stun:stun.l.google.com:19302",readOnly:!1})}})}),null),m(c,v(Br,{get label(){return t("settings.transport.iceServers.addStun")},onClick:i}),null),c}}),v(Xe,{get title(){return t("settings.transport.iceServers.turn")},get children(){var c=ea();return m(c,v(Ce,{get each(){return e()},children:(f,h)=>(()=>{var g=ra(),b=g.firstChild;return m(g,v(Nr,{onRemove:()=>d(h()),get children(){return v(We,{get value(){return f.urls},onChange:p=>u(h(),"urls",p),placeholder:"turn:relay.example.com:443",readOnly:!1})}}),b),m(b,v(We,{get value(){return f.username??""},onChange:p=>u(h(),"username",p),placeholder:"Username",readOnly:!1}),null),m(b,v(We,{get value(){return f.credential??""},onChange:p=>u(h(),"credential",p),placeholder:"Password",readOnly:!1}),null),g})()}),null),m(c,v(Br,{get label(){return t("settings.transport.iceServers.addTurn")},onClick:l}),null),c}}),(()=>{var c=ta();return m(c,()=>t("settings.transport.description")),c})()]};Ae(["click"]);var oa=x('<div class="px-4 pb-2">');const ia=t=>{switch(t){case"main":return"settings.title";case"signaling":return"settings.signaling.title";case"transport":return"settings.transport.title"}},sa=t=>{const{screen:e,previousScreen:r,isTransitioning:n,navigate:o,goBack:i,isAtRoot:a}=$s("main"),s={goBack:i,get isAtRoot(){return a()}};ie(()=>{t.navigationRef&&(t.navigationRef.current=s)}),ie(()=>{t.onTitleChange?.(ia(e()))});const l=d=>{switch(d){case"main":return[v(qs,{onNavigate:o}),v(Ds,{})];case"signaling":return v(Qs,{});case"transport":return v(na,{})}};return(()=>{var d=oa();return m(d,v(_s,{get current(){return e()},get previous(){return r()},get isTransitioning(){return n()},render:l})),d})()};var aa=x("<div class=modal-transition__container><div>"),la=x('<div class="modal-transition__layer modal-transition__layer--outgoing">'),ca=x('<div class="fixed inset-0 z-10000 flex animate-[bg-in_0.15s_ease-in-out] items-end justify-center md:items-center lg:p-4"role=presentation data-openlv-modal-root><div role=dialog aria-modal=true><div><div class=modal-transition__container><div><div class="flex flex-col text-center"></div></div></div></div><div>');const da=()=>{const[t,e]=D("start"),[r,n]=D(!1);return ie(()=>{if(!r())return;const o=globalThis.setTimeout(()=>n(!1),2e3);se(()=>globalThis.clearTimeout(o))}),{view:t,setView:e,copied:r,setCopied:n}},ua=t=>{ie(()=>{const e=r=>{r.key==="Escape"&&t()};document.addEventListener("keydown",e),se(()=>document.removeEventListener("keydown",e))})},fa=()=>{const[t,e]=D(),[r,n]=D(0),o=(a,s=!1)=>{const l=a||t();if(!l||!l.getBoundingClientRect)return;const d=s?l.scrollHeight:l.getBoundingClientRect().height;d>0&&n(u=>typeof u=="number"&&Math.abs(u-d)<.5?u:d)};ie(()=>{const a=t();if(!a||typeof ResizeObserver>"u")return;const s=new ResizeObserver(()=>{o()});s.observe(a),se(()=>s.disconnect())});const i=()=>o();return ie(()=>{globalThis.window!==void 0&&(window.addEventListener("resize",i),se(()=>window.removeEventListener("resize",i)))}),{setContentRef:e,contentNode:t,height:r,measureHeight:o}},fn=t=>{const{view:e,setView:r,copied:n,setCopied:o}=da(),{uri:i,status:a}=Ye(),{provider:s}=Re(),{setContentRef:l,contentNode:d,height:u,measureHeight:c}=fa(),{current:f,previous:h,isTransitioning:g}=Vt(e),{current:b,previous:p,isTransitioning:C}=Vt(a),k=()=>r("settings"),{t:y,isRtl:F,languageTag:_}=Q(),pe=dn(),he={current:null},[De,tt]=D("settings.title"),Ve=T(()=>Be(e()).with("start",()=>y("start.title")).with("settings",()=>y(De())).with("info",()=>y("info.title")).exhaustive());ua(t.onClose),ie(()=>{a()?.status===oe.CONNECTED&&t.onClose()});const rt=async()=>{const N=i();N&&await on(N)&&o(!0)};let nt=!0,Te,A,$;const[E,M]=D(!1);ie(()=>{b(),f(),d()&&(nt?(Te&&globalThis.clearTimeout(Te),Te=globalThis.setTimeout(()=>{d()&&(c(void 0,!0),nt=!1)},0)):c(),se(()=>{Te&&globalThis.clearTimeout(Te)}))}),ie(()=>{const N=u();A!==void 0&&N!==A&&N>0&&A>0&&Math.abs(N-A)>.5&&(M(!0),$&&globalThis.clearTimeout($),$=globalThis.setTimeout(()=>{M(!1),$=void 0},200)),A=N,se(()=>{$&&globalThis.clearTimeout($)})});const[P,O]=D(s.getState().status);Ft(()=>{s.on("status_change",O)}),se(()=>{s.off("status_change",O)});const J=T(()=>!(e()==="start"&&P()===oe.STANDBY)),ce=()=>{Be({view:e(),status:P()}).with({view:"start",status:oe.STANDBY},()=>{}).with({view:"start"},()=>{s.closeSession()}).with({view:"settings"},()=>{he.current&&!he.current.isAtRoot?he.current.goBack():r("start")}).with({view:"info"},()=>{r("start")}).otherwise(()=>{s.closeSession(),t.onClose()})},G=N=>Be(N).with("start",()=>v(ps,{onSettings:k})).with("settings",()=>v(sa,{onTitleChange:tt,navigationRef:he})).with("info",()=>v(bs,{})).otherwise(()=>v(jt,{state:N})),ae=()=>(()=>{var N=aa(),ee=N.firstChild;return m(N,v(ve,{get when(){return h()},children:Ee=>(()=>{var Fe=la();return m(Fe,()=>G(Ee())),Fe})()}),ee),m(ee,()=>G(f())),z(()=>ne(ee,ke("modal-transition__layer",g()&&"modal-transition__layer--incoming"))),N})(),me=N=>Be(N).with(oe.STANDBY,()=>ae()).with(go.union(oe.CREATING,oe.CONNECTING,oe.CONNECTED,oe.ERROR),()=>v(yi,{get onClose(){return t.onClose},onCopy:rt})).otherwise(ee=>v(jt,{state:ee||"unknown status"})),le={background:"var(--lv-overlay-background, rgba(0,0,0,0.3))","backdrop-filter":"var(--lv-overlay-backdrop-filter, blur(4px))"},Oe={background:"var(--lv-body-background)",color:"var(--lv-body-color, var(--lv-text-primary))","border-radius":"var(--lv-border-radius, 16px)","box-shadow":"var(--lv-modal-shadow, 0px 12px 32px rgba(0,0,0,0.25))"};return(()=>{var N=ca(),ee=N.firstChild,Ee=ee.firstChild,Fe=Ee.firstChild,qt=Fe.firstChild,gn=qt.firstChild,Kt=Ee.nextSibling;return N.$$mouseup=I=>{I.target===I.currentTarget&&t.onClose()},Bt(N,le),ee.$$click=I=>I.stopPropagation(),qr(l,Ee),m(Ee,v(As,{get title(){return String(Ve())},get view(){return e()},get onClose(){return t.onClose},get onBack(){return J()?ce:void 0},setView:r}),Fe),m(gn,()=>me(P())),m(Ee,v(Cs,{}),null),m(Kt,()=>y("modal.urlCopied")),z(I=>{var Ht=pe.mode(),Xt=_(),Qt=F()?"rtl":"ltr",Jt=ke("relative w-full max-w-[400px] animate-[fade-in_0.15s_ease-in-out] transition-[height] duration-200 ease-out",E()||p()?"overflow-hidden":void 0),Zt=String(Ve()),vn={...typeof u()=="number"&&u()>0?{height:`${u()}px`}:{},...Oe},Yt=ke("modal-transition__layer",C()&&"modal-transition__layer--incoming"),er=ke("absolute top-5 rounded-lg bg-blue-500 px-4 py-3 font-medium text-sm text-white transition-all ltr:right-5 rtl:left-5",n()?"translate-x-0 opacity-100":"opacity-0 ltr:translate-x-full rtl:-translate-x-full");return Ht!==I.e&&Z(N,"data-openlv-theme-mode",I.e=Ht),Xt!==I.t&&Z(N,"lang",I.t=Xt),Qt!==I.a&&Z(N,"dir",I.a=Qt),Jt!==I.o&&ne(ee,I.o=Jt),Zt!==I.i&&Z(ee,"aria-label",I.i=Zt),I.n=Bt(ee,vn,I.n),Yt!==I.s&&ne(qt,I.s=Yt),er!==I.h&&ne(Kt,I.h=er),I},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),N})()};Ae(["mouseup","click"]);const ha=(...t)=>console.log("%c[modal]%c","color: yellow; font-weight: bold","color: inherit; font-weight: normal",...t),hn=(t="openlv-modal")=>{if(globalThis.window===void 0)return t;const e=globalThis.customElements;return e?(e.get(t)||e.define(t,xt),t):(console.warn("OpenLV modal: custom elements are not supported in this environment."),t)},ga=t=>{const e=document.querySelector("openlv-modal");if(e&&e.remove(),!e){hn();const r=new xt({onClose(){ha("modal closed"),r.remove(),t.onClose?.()},provider:t.provider,theme:t.theme});document.body.append(r)}};exports.ModalRoot=fn;exports.OPENLV_ICON_128=un;exports.OpenLVModalElement=xt;exports.default=xt;exports.registerOpenLVModal=hn;exports.triggerOpenModal=ga;
6
+ Or copy the link and paste it into your wallet.`},Po={urlCopied:"Connection URL copied to clipboard!",backToQr:"Back to QR",closeModal:"Close modal"},No={common:ko,status:Co,settings:So,start:Ao,info:$o,disconnected:To,connectionFlow:Eo,handshake:_o,modal:Po};var Bo=x("<br>");const Wt=[{tag:"en",name:"English",nativeName:"English"},{tag:"nl",name:"Dutch",nativeName:"Nederlands"},{tag:"es",name:"Spanish",nativeName:"Español"},{tag:"sv",name:"Swedish",nativeName:"Svenska"},{tag:"zh-cn",name:"Chinese (Simplified)",nativeName:"简体中文"},{tag:"fr",name:"French",nativeName:"Français"},{tag:"ar",name:"Arabic",nativeName:"العربية",rtl:!0},{tag:"he",name:"Hebrew",nativeName:"עברית",rtl:!0},{tag:"fa",name:"Persian",nativeName:"فارسی",rtl:!0}],Mo=t=>Wt.find(r=>r.tag===t)?.rtl??!1;new Set(Wt.map(t=>t.tag));const ur=t=>{if(typeof navigator>"u")return 0;const e=navigator.languages||[navigator.language];for(let r=0;r<e.length;r++){const n=e[r].toLowerCase();if(n===t)return e.length-r+1;if(n.startsWith(`${t}-`)||t.startsWith(`${n}-`))return e.length-r;const[o]=n.split("-",1);if(o===t||t.startsWith(`${o}-`))return e.length-r-.5}return 0},fr=(t,e)=>{if(!t)return;const r=e.split(".").filter(Boolean);if(r.length===0)return;let n=t;for(const o of r){if(typeof n!="object"||n===null)return;n=n[o]}return n},hr=(t,e)=>e?t.replaceAll(/\{(\w+)\}/g,(r,n)=>{const o=e[n];return o===void 0?r:String(o)}):t,Ro=t=>{const e=fr(t.primary,t.key);if(typeof e=="string")return hr(e,t.params);const r=fr(t.fallback,t.key);return typeof r=="string"?hr(r,t.params):t.key},Yr=Ir(void 0),Oo=async t=>Be(t).with("en",()=>Promise.resolve(void 0)).with("nl",async()=>Promise.resolve().then(()=>require("./nl-bCeoO8RU.cjs")).then(e=>e.default)).with("es",async()=>Promise.resolve().then(()=>require("./es-B9xaw9fo.cjs")).then(e=>e.default)).with("sv",async()=>Promise.resolve().then(()=>require("./sv-BHh_RkLw.cjs")).then(e=>e.default)).with("fr",async()=>Promise.resolve().then(()=>require("./fr-D54ESMxz.cjs")).then(e=>e.default)).with("zh-cn",async()=>Promise.resolve().then(()=>require("./zh-cn-Bqo3eRaE.cjs")).then(e=>e.default)).with("ar",async()=>Promise.resolve().then(()=>require("./ar-xpXGBcxc.cjs")).then(e=>e.default)).with("he",async()=>Promise.resolve().then(()=>require("./he-BWZyf3Uy.cjs")).then(e=>e.default)).with("fa",async()=>Promise.resolve().then(()=>require("./fa-DCpZYzOX.cjs")).then(e=>e.default)).exhaustive(),Io=t=>{const{provider:e}=Re(),r=e.storage.getSettings().language,[n,o]=D(r??"en"),[i,a]=D(void 0),[s,l]=D(!1);ie(()=>{let h=!1;(async()=>{l(!0);try{const b=await Oo(n());if(h)return;a(b)}finally{h||l(!1)}})(),se(()=>{h=!0})});const d=(h,g)=>{const b=Ro({primary:i(),fallback:No,key:h,params:g}),p=b.split(`
7
+ `);return p.length<=1?b:Me(()=>p.map((C,k)=>[C,Me(()=>Me(()=>k<p.length-1)()?Bo():null)]))},u=T(()=>Mo(n())),f={languageTag:n,setLanguageTag:h=>{o(h)},isLoadingLanguagePack:s,isRtl:u,t:d};return v(Yr.Provider,{value:f,get children(){return t.children}})},Q=()=>{const t=Lr(Yr);if(!t)throw new Error("TranslationProvider not found");return t},en=Ir(void 0),Lo=t=>{const{provider:e,theme:r}=t;return v(en.Provider,{value:{provider:e,themeConfig:r},get children(){return v(Io,{get children(){return v(fn,{get onClose(){return t.onClose}})}})}})},Re=()=>{const t=Lr(en);if(!t)throw new Error("Modal context not found");return t},Ye=()=>{const{provider:t}=Re(),e=T(()=>t.getSession(),void 0,{name:"session"}),[r,n]=D(e()?.getState());console.log("session status",r());const o=s=>{console.log("session state change",s),n(s)};Ft(()=>{e()?.emitter.on("state_change",o)}),se(()=>{e()?.emitter.off("state_change",o)});const i=T(()=>e()?.getHandshakeParameters());return{uri:T(()=>{const s=i();return s?Zn(s):void 0}),status:r}},jo=()=>{const{provider:t}=Re();return{start:()=>{const e=t.storage.getSettings(),r=e?.signaling?.p,n=r?e?.signaling?.s?.[r]:void 0;if(!r||!n)throw new Error("Invalid protocol or server");return t.createSession({p:r,s:n})}}};var Do=x('<div class="rounded-md bg-(--lv-control-button-secondary-background) p-2 text-(--lv-text-muted)"><div>Unknown state:</div><div>URI:</div><div>Session Status:');const jt=t=>{const{uri:e,status:r}=Ye();return console.error("Unknown state:",{state:t.state}),(()=>{var n=Do(),o=n.firstChild;o.firstChild;var i=o.nextSibling;i.firstChild;var a=i.nextSibling;return a.firstChild,m(o,()=>JSON.stringify(t.state),null),m(i,e,null),m(a,()=>JSON.stringify(r()),null),n})()};const ze={newline:10,reset:27};function Vo(t){if(!Number.isSafeInteger(t))throw new Error(`integer expected: ${t}`)}function Fo(t){if(!Number.isSafeInteger(t)||t<1||t>40)throw new Error(`Invalid version=${t}. Expected number [1..40]`)}function _e(t,e){return t.toString(2).padStart(e,"0")}function gr(t,e){const r=t%e;return r>=0?r:e+r}function fe(t,e){return new Array(t).fill(e)}function Et(t){return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}function vr(t){let e=0,r=0;for(const i of t)e=Math.max(e,i.length),r+=i.length;const n=new Uint8Array(r);let o=0;for(let i=0;i<e;i++)for(const a of t)i<a.length&&(n[o++]=a[i]);return n}function zo(){let t,e=1/0;return{add(r,n){r>=e||(t=n,e=r)},get:()=>t,score:()=>e}}function pr(t){return Object.freeze({has:e=>t.includes(e),decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(r=>{if(typeof r!="string")throw new Error(`alphabet.decode: not string element=${r}`);const n=t.indexOf(r);if(n===-1)throw new Error(`Unknown letter: "${r}". Allowed: ${t}`);return n})},encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(r=>{if(Vo(r),r<0||r>=t.length)throw new Error(`Digit index outside alphabet: ${r} (alphabet: ${t.length})`);return t[r]})}})}function mr(t){if(t.length!==32)throw new Error("expects 32 element matrix");const e=[1431655765,858993459,252645135,16711935,65535];for(let r=0;r<5;r++){const n=e[r]>>>0,o=1<<r,i=o<<1;for(let a=0;a<32;a+=i)for(let s=0;s<o;s++){const l=a+s,d=l+o,u=t[l]>>>0,c=t[d]>>>0,f=(u>>>o^c)&n;t[l]=(u^f<<o)>>>0,t[d]=(c^f)>>>0}}}const Ue=t=>1<<(t&31)>>>0,Pe=(t,e)=>e===0?0:e===32?4294967295:(1<<e)-1<<t>>>0;class q{constructor(e,r){te(this,"defined");te(this,"value");te(this,"tailMask");te(this,"words");te(this,"fullWords");te(this,"height");te(this,"width");const{height:n,width:o}=q.size(e);if(!Number.isSafeInteger(n)||n<=0)throw new Error(`Bitmap: invalid height=${n}, expected positive safe integer dimension`);if(!Number.isSafeInteger(o)||o<=0)throw new Error(`Bitmap: invalid width=${o}, expected positive safe integer dimension`);if(this.height=n,this.width=o,this.tailMask=Pe(0,o&31||32),this.words=Math.ceil(o/32)|0,this.fullWords=Math.floor(o/32)|0,this.value=new Uint32Array(this.words*n),this.defined=new Uint32Array(this.value.length),r){if(r.length!==n)throw new Error(`Bitmap: data height mismatch: exp=${n} got=${r.length}`);for(let i=0;i<n;i++){const a=r[i];if(!a||a.length!==o)throw new Error(`Bitmap: data width mismatch at y=${i}: exp=${o} got=${a?.length}`);for(let s=0;s<o;s++)this.set(s,i,a[s])}}}static size(e,r){if(typeof e=="number"&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw new Error(`Bitmap: invalid height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw new Error(`Bitmap: invalid width=${e.width} (${typeof e.width})`);return r!==void 0&&(e={width:Math.min(e.width,r.width),height:Math.min(e.height,r.height)}),e}static fromString(e){e=e.replace(/^\n+/g,"").replace(/\n+$/g,"");const r=e.split(String.fromCharCode(ze.newline)),n=r.length;let o;const i=[];for(const a of r){const s=a.split("").map(l=>{if(l==="X")return!0;if(l===" ")return!1;if(l!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${l}`)});if(o!==void 0&&s.length!==o)throw new Error(`Bitmap.fromString different row sizes: width=${o} cur=${s.length}`);o=s.length,i.push(s)}return o===void 0&&(o=0),new q({height:n,width:o},i)}point(e){return this.get(e.x,e.y)}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};const{x:r,y:n}=this.xy(e);return{height:this.height-n,width:this.width-r}}xy(e){if(typeof e=="number"&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw new Error(`Bitmap: invalid x=${e.x}`);if(!Number.isSafeInteger(e.y))throw new Error(`Bitmap: invalid y=${e.y}`);return e.x=gr(e.x,this.width),e.y=gr(e.y,this.height),e}wordIndex(e,r){return r*this.words+(e>>>5)}bitIndex(e,r){return{word:this.wordIndex(e,r),bit:e&31}}isDefined(e,r){const n=this.wordIndex(e,r),o=Ue(e);return(this.defined[n]&o)!==0}get(e,r){const n=this.wordIndex(e,r),o=Ue(e);return(this.value[n]&o)!==0}maskWord(e,r,n){const{defined:o,value:i}=this;o[e]|=r,i[e]=i[e]&~r|-n&r}set(e,r,n){n!==void 0&&this.maskWord(this.wordIndex(e,r),Ue(e),n)}fillRectConst(e,r,n,o,i){if(n<=0||o<=0||i===void 0)return;const{value:a,defined:s,words:l}=this,d=e>>>5,u=e+n-1>>>5,c=e&31,f=e+n-1&31;for(let h=0;h<o;h++){const g=(r+h)*l;if(d===u){const b=Pe(c,f-c+1);this.maskWord(g+d,b,i);continue}this.maskWord(g+d,Pe(c,32-c),i);for(let b=d+1;b<u;b++)s[g+b]=4294967295,a[g+b]=i?4294967295:0;this.maskWord(g+u,Pe(0,f+1),i)}}rectWords(e,r,n,o,i){for(let a=0;a<o;a++){const s=r+a;for(let l=0;l<n;){const d=e+l,{bit:u,word:c}=this.bitIndex(d,s),f=Math.min(32-u,n-l);i(c,d,l,a,f),l+=f}}}rect(e,r,n){const{x:o,y:i}=this.xy(e),{height:a,width:s}=q.size(r,this.size({x:o,y:i}));if(typeof n!="function")return this.fillRectConst(o,i,s,a,n),this;const{defined:l,value:d}=this;return this.rectWords(o,i,s,a,(u,c,f,h,g)=>{let b=0,p=d[u];for(let C=0;C<g;C++){const k=Ue(c+C),y=n({x:f+C,y:h},(p&k)!==0);y!==void 0&&(b|=k,p=p&~k|-y&k)}l[u]|=b,d[u]=p}),this}rectRead(e,r,n){const{x:o,y:i}=this.xy(e),{height:a,width:s}=q.size(r,this.size({x:o,y:i})),{value:l}=this;return this.rectWords(o,i,s,a,(d,u,c,f,h)=>{const g=l[d];for(let b=0;b<h;b++){const p=Ue(u+b);n({x:c+b,y:f},(g&p)!==0)}}),this}hLine(e,r,n){return this.rect(e,{width:r,height:1},n)}vLine(e,r,n){return this.rect(e,{width:1,height:r},n)}border(e=2,r){if(!Number.isSafeInteger(e)||e<=0)throw new Error(`Bitmap.border: invalid size=${e}`);const n=this.height+2*e,o=this.width+2*e,i=new q({height:n,width:o});return i.rect(0,1/0,r),i.embed({x:e,y:e},this),i}embed(e,r){const{x:n,y:o}=this.xy(e),{height:i,width:a}=q.size(r.size(),this.size({x:n,y:o}));if(a<=0||i<=0)return this;const{value:s,defined:l}=this,{words:d,value:u}=r;for(let c=0;c<i;c++){const f=c*d;for(let h=0;h<a;){const g=n+h,{word:b,bit:p}=this.bitIndex(g,o+c),{word:C,bit:k}=r.bitIndex(h,c),y=Math.min(32-p,a-h),F=u[C],_=k&&C+1<f+d?u[C+1]:0,pe=k?(F>>>k|_<<32-k)>>>0:F,he=Pe(p,y),De=(pe&Pe(0,y))<<p>>>0;l[b]|=he,s[b]=s[b]&~he|De,h+=y}}return this}rectSlice(e,r=this.size()){const{x:n,y:o}=this.xy(e),{height:i,width:a}=q.size(r,this.size({x:n,y:o})),s=new q({height:i,width:a});return this.rectRead({x:n,y:o},{height:i,width:a},(l,d)=>{this.isDefined(n+l.x,o+l.y)&&s.set(l.x,l.y,d)}),s}transpose(){const{height:e,width:r,value:n,defined:o,words:i}=this,a=new q({height:r,width:e}),{words:s,value:l,defined:d,tailMask:u}=a,c=new Uint32Array(32),f=new Uint32Array(32);for(let h=0;h<e;h+=32)for(let g=0;g<i;g++){const b=Math.min(32,e-h);for(let p=0;p<b;p++){const C=this.wordIndex(32*g,h+p);c[p]=n[C],f[p]=o[C]}c.fill(0,b),f.fill(0,b),mr(c),mr(f);for(let p=0;p<32;p++){const C=g*32+p;if(C>=r)break;const k=a.wordIndex(h,C),y=h>>>5===s-1?u:4294967295;l[k]=c[p]&y,d[k]=f[p]&y}}return a}negate(){const e=this.defined.length;for(let r=0;r<e;r++)this.value[r]=~this.value[r],this.defined[r]=4294967295;return this}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw new Error(`invalid scale factor: ${e}`);const{height:r,width:n}=this;return new q({height:e*r,width:e*n}).rect({x:0,y:0},1/0,({x:i,y:a})=>this.get(i/e|0,a/e|0))}clone(){const e=new q(this.size());return e.defined.set(this.defined),e.value.set(this.value),e}assertDrawn(){const{height:e,width:r,defined:n,tailMask:o,fullWords:i,words:a}=this;if(!(!e||!r))for(let s=0;s<e;s++){const l=s*a;for(let d=0;d<i;d++)if(n[l+d]!==4294967295)throw new Error("Invalid color type=undefined");if(a!==i&&(n[l+i]&o)!==o)throw new Error("Invalid color type=undefined")}}countPatternInRow(e,r,...n){if(!Number.isSafeInteger(r)||r<=0||r>=32)throw new Error("wrong patternLen");const o=(1<<r)-1,{height:i,width:a,value:s,words:l}=this;if(!Number.isSafeInteger(e)||e<0||e>=i)return 0;let d=0;const u=this.wordIndex(0,e);for(let c=0,f=0;c<l;c++){const h=s[u+c],g=c===l-1&&a&31||32;for(let b=0;b<g;b++)if(f=(f<<1|h>>>b&1)&o,!(c*32+b+1<r)){for(const p of n)if(f===p){d++;break}}}return d}getRuns(e,r){const{height:n,width:o,value:i,words:a}=this;if(o===0||!Number.isSafeInteger(e)||e<0||e>=n)return;let s=0,l;const d=this.wordIndex(0,e);for(let u=0;u<a;u++){const c=i[d+u],f=u===a-1&&o&31||32;for(let h=0;h<f;h++){const g=(c&1<<h)!==0;if(g===l){s++;continue}l!==void 0&&r(s,l),l=g,s=1}}l!==void 0&&r(s,l)}popcnt(){const{height:e,width:r,words:n,fullWords:o,tailMask:i}=this;if(!e||!r)return 0;let a=0;for(let s=0;s<e;s++){const l=s*n;for(let d=0;d<o;d++)a+=Et(this.value[l+d]);n!==o&&(a+=Et(this.value[l+o]&i))}return a}countBoxes2x2(e){const{height:r,width:n,words:o}=this;if(n<2||!Number.isSafeInteger(e)||e<0||e+1>=r)return 0;const i=this.wordIndex(0,e),a=this.wordIndex(0,e+1),l=(n&31)===0?2147483647:Pe(0,n-1&31);let d=0;for(let u=0;u<o;u++){const c=this.value[i+u],f=this.value[a+u],h=~(c^f)>>>0,g=u+1<o?this.value[i+u+1]>>>0:0,b=~(c^(c>>>1|(g&1)<<31)>>>0)>>>0,p=u+1<o?this.value[a+u+1]>>>0:0,C=~(f^(f>>>1|(p&1)<<31)>>>0)>>>0;let k=(h&b&C)>>>0;u===o-1&&(k&=l),d+=Et(k)}return d}toString(){const e=String.fromCharCode(ze.newline);let r="";for(let n=0;n<this.height;n++){let o="";for(let i=0;i<this.width;i++){const a=this.get(i,n);o+=this.isDefined(i,n)?a?"X":" ":"?"}r+=o+(n+1===this.height?"":e)}return r}toRaw(){const e=Array.from({length:this.height},()=>new Array(this.width));for(let r=0;r<this.height;r++){const n=e[r];for(let o=0;o<this.width;o++)n[o]=this.get(o,r)}return e}toASCII(){const{height:e,width:r}=this;let n="";for(let o=0;o<e;o+=2){for(let i=0;i<r;i++){const a=this.get(i,o),s=o+1>=e?!0:this.get(i,o+1);!a&&!s?n+="█":!a&&s?n+="▀":a&&!s?n+="▄":a&&s&&(n+=" ")}n+=String.fromCharCode(ze.newline)}return n}toTerm(){const e=String.fromCharCode(ze.reset),r=e+"[0m",n=e+"[1;47m "+r,o=e+"[40m "+r,i=String.fromCharCode(ze.newline);let a="";for(let s=0;s<this.height;s++){for(let l=0;l<this.width;l++){const d=this.get(l,s);a+=d?o:n}a+=i}return a}toSVG(e=!0){let r=`<svg viewBox="0 0 ${this.width} ${this.height}" xmlns="http://www.w3.org/2000/svg">`,n="",o;return this.rectRead(0,1/0,(i,a)=>{if(!a)return;const{x:s,y:l}=i;if(!e){r+=`<rect x="${s}" y="${l}" width="1" height="1" />`;return}let d=`M${s} ${l}`;if(o){const c=`m${s-o.x} ${l-o.y}`;c.length<=d.length&&(d=c)}const u=s<10?`H${s}`:"h-1";n+=`${d}h1v1${u}Z`,o=i}),e&&(r+=`<path d="${n}"/>`),r+="</svg>",r}toGIF(){const e=s=>[s&255,s>>>8&255],r=[...e(this.width),...e(this.height)],n=[];this.rectRead(0,1/0,(s,l)=>n.push(+(l===!0)));const o=126,i=[71,73,70,56,55,97,...r,246,0,0,255,255,255,...fe(381,0),44,0,0,0,0,...r,0,7],a=Math.floor(n.length/o);for(let s=0;s<a;s++)i.push(o+1,128,...n.slice(o*s,o*(s+1)).map(l=>+l));return i.push(n.length%o+1,128,...n.slice(a*o).map(s=>+s)),i.push(1,129,0,59),new Uint8Array(i)}toImage(e=!1){const{height:r,width:n}=this.size(),o=new Uint8Array(r*n*(e?3:4));let i=0;for(let a=0;a<r;a++)for(let s=0;s<n;s++){const l=this.get(s,a)?0:255;o[i++]=l,o[i++]=l,o[i++]=l,e||(o[i++]=255)}return{height:r,width:n,data:o}}}const br=Object.freeze(["low","medium","quartile","high"]),wr=Object.freeze(["numeric","alphanumeric","byte","kanji","eci"]),Uo=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],Wo={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},Go={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},U=Object.freeze({size:Object.freeze({encode:t=>21+4*(t-1),decode:t=>(t-17)/4}),sizeType:t=>Math.floor((t+7)/17),alignmentPatterns(t){if(t===1)return[];const e=6,r=U.size.encode(t)-e-1,n=r-e,o=Math.ceil(n/28);let i=Math.floor(n/o);i%2?i+=1:n%o*2>=o&&(i+=2);const a=[e];for(let s=1;s<o;s++)a.push(r-(o-s)*i);return a.push(r),a},ECCode:Object.freeze({low:1,medium:0,quartile:3,high:2}),formatMask:21522,formatBits(t,e){const r=U.ECCode[t]<<3|e;let n=r;for(let o=0;o<10;o++)n=n<<1^(n>>9)*1335;return(r<<10|n)^U.formatMask},versionBits(t){let e=t;for(let r=0;r<12;r++)e=e<<1^(e>>11)*7973;return t<<12|e},alphabet:Object.freeze({numeric:pr("0123456789"),alphanumerc:pr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")}),lengthBits(t,e){return{numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[e][U.sizeType(t)]},modeBits:Object.freeze({numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"}),capacity(t,e){const r=Uo[t-1],n=Wo[e][t-1],o=Go[e][t-1],i=Math.floor(r/o)-n,a=o-r%o;return{words:n,numBlocks:o,shortBlocks:a,blockLen:i,capacity:(r-n*o)*8,total:(n+i)*o+o-a}}}),Gt=Object.freeze([(t,e)=>(t+e)%2==0,(t,e)=>e%2==0,(t,e)=>t%3==0,(t,e)=>(t+e)%3==0,(t,e)=>(Math.floor(e/2)+Math.floor(t/3))%2==0,(t,e)=>t*e%2+t*e%3==0,(t,e)=>(t*e%2+t*e%3)%2==0,(t,e)=>((t+e)%2+t*e%3)%2==0]),w={tables:(t=>{const e=fe(256,0),r=fe(256,0);for(let n=0,o=1;n<256;n++)e[n]=o,r[o]=n,o<<=1,o&256&&(o^=t);return{exp:e,log:r}})(285),exp:t=>w.tables.exp[t],log(t){if(t===0)throw new Error(`GF.log: invalid arg=${t}`);return w.tables.log[t]%255},mul(t,e){return t===0||e===0?0:w.tables.exp[(w.tables.log[t]+w.tables.log[e])%255]},add:(t,e)=>t^e,pow:(t,e)=>w.tables.exp[w.tables.log[t]*e%255],inv(t){if(t===0)throw new Error(`GF.inverse: invalid arg=${t}`);return w.tables.exp[255-w.tables.log[t]]},polynomial(t){if(t.length==0)throw new Error("GF.polymomial: invalid length");if(t[0]!==0)return t;let e=0;for(;e<t.length-1&&t[e]==0;e++);return t.slice(e)},monomial(t,e){if(t<0)throw new Error(`GF.monomial: invalid degree=${t}`);if(e==0)return[0];let r=fe(t+1,0);return r[0]=e,w.polynomial(r)},degree:t=>t.length-1,coefficient:(t,e)=>t[w.degree(t)-e],mulPoly(t,e){if(t[0]===0||e[0]===0)return[0];const r=fe(t.length+e.length-1,0);for(let n=0;n<t.length;n++)for(let o=0;o<e.length;o++)r[n+o]=w.add(r[n+o],w.mul(t[n],e[o]));return w.polynomial(r)},mulPolyScalar(t,e){if(e==0)return[0];if(e==1)return t;const r=fe(t.length,0);for(let n=0;n<t.length;n++)r[n]=w.mul(t[n],e);return w.polynomial(r)},mulPolyMonomial(t,e,r){if(e<0)throw new Error("GF.mulPolyMonomial: invalid degree");if(r==0)return[0];const n=fe(t.length+e,0);for(let o=0;o<t.length;o++)n[o]=w.mul(t[o],r);return w.polynomial(n)},addPoly(t,e){if(t[0]===0)return e;if(e[0]===0)return t;let r=t,n=e;r.length>n.length&&([r,n]=[n,r]);let o=fe(n.length,0),i=n.length-r.length,a=n.slice(0,i);for(let s=0;s<a.length;s++)o[s]=a[s];for(let s=i;s<n.length;s++)o[s]=w.add(r[s-i],n[s]);return w.polynomial(o)},remainderPoly(t,e){const r=Array.from(t);for(let n=0;n<t.length-e.length+1;n++){const o=r[n];if(o!==0)for(let i=1;i<e.length;i++)e[i]!==0&&(r[n+i]=w.add(r[n+i],w.mul(e[i],o)))}return r.slice(t.length-e.length+1,r.length)},divisorPoly(t){let e=[1];for(let r=0;r<t;r++)e=w.mulPoly(e,[1,w.pow(2,r)]);return e},evalPoly(t,e){if(e==0)return w.coefficient(t,0);let r=t[0];for(let n=1;n<t.length;n++)r=w.add(w.mul(e,r),t[n]);return r},euclidian(t,e,r){w.degree(t)<w.degree(e)&&([t,e]=[e,t]);let n=t,o=e,i=[0],a=[1];for(;2*w.degree(o)>=r;){let d=n,u=i;if(n=o,i=a,n[0]===0)throw new Error("rLast[0] === 0");o=d;let c=[0];const f=w.inv(n[0]);for(;w.degree(o)>=w.degree(n)&&o[0]!==0;){const h=w.degree(o)-w.degree(n),g=w.mul(o[0],f);c=w.addPoly(c,w.monomial(h,g)),o=w.addPoly(o,w.mulPolyMonomial(n,h,g))}if(c=w.mulPoly(c,i),a=w.addPoly(c,u),w.degree(o)>=w.degree(n))throw new Error(`Division failed r: ${o}, rLast: ${n}`)}const s=w.coefficient(a,0);if(s==0)throw new Error("sigmaTilde(0) was zero");const l=w.inv(s);return[w.mulPolyScalar(a,l),w.mulPolyScalar(o,l)]}};function qo(t){return{encode(e){const r=w.divisorPoly(t),n=Array.from(e);return n.push(...r.slice(0,-1).fill(0)),Uint8Array.from(w.remainderPoly(n,r))},decode(e){const r=e.slice(),n=w.polynomial(Array.from(e));let o=fe(t,0),i=!1;for(let c=0;c<t;c++){const f=w.evalPoly(n,w.exp(c));o[o.length-1-c]=f,f!==0&&(i=!0)}if(!i)return r;o=w.polynomial(o);const a=w.monomial(t,1),[s,l]=w.euclidian(a,o,t),d=fe(w.degree(s),0);let u=0;for(let c=1;c<256&&u<d.length;c++)w.evalPoly(s,c)===0&&(d[u++]=w.inv(c));if(u!==d.length)throw new Error("RS.decode: invalid errors number");for(let c=0;c<d.length;c++){const f=r.length-1-w.log(d[c]);if(f<0)throw new Error("RS.decode: invalid error location");const h=w.inv(d[c]);let g=1;for(let b=0;b<d.length;b++)c!==b&&(g=w.mul(g,w.add(1,w.mul(d[b],h))));r[f]=w.add(r[f],w.mul(w.evalPoly(l,h),w.inv(g)))}return r}}}function Ko(t,e){const{words:r,shortBlocks:n,numBlocks:o,blockLen:i,total:a}=U.capacity(t,e),s=qo(r);return{encode(l){const d=[],u=[];for(let g=0;g<o;g++){const b=g<n,p=i+(b?0:1);d.push(l.subarray(0,p)),u.push(s.encode(l.subarray(0,p))),l=l.subarray(p)}const c=vr(d),f=vr(u),h=new Uint8Array(c.length+f.length);return h.set(c),h.set(f,c.length),h},decode(l){if(l.length!==a)throw new Error(`interleave.decode: len(data)=${l.length}, total=${a}`);const d=[];for(let f=0;f<o;f++){const h=f<n;d.push(new Uint8Array(r+i+(h?0:1)))}let u=0;for(let f=0;f<i;f++)for(let h=0;h<o;h++)d[h][f]=l[u++];for(let f=n;f<o;f++)d[f][i]=l[u++];for(let f=i;f<i+r;f++)for(let h=0;h<o;h++){const g=h<n;d[h][f+(g?0:1)]=l[u++]}const c=[];for(const f of d)c.push(...Array.from(s.decode(f)).slice(0,-r));return Uint8Array.from(c)}}}function Ho(t,e,r,n=!1){const o=U.size.encode(t);let i=new q(o+2);const a=new q(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);i=i.embed(0,a).embed({x:-a.width,y:0},a).embed({x:0,y:-a.height},a),i=i.rectSlice(1,o);const s=new q(1).rect(0,1,!0).border(1,!1).border(1,!0),l=U.alignmentPatterns(t);for(const d of l)for(const u of l)i.isDefined(u,d)||i.embed({x:u-2,y:d-2},s);i=i.hLine({x:0,y:6},1/0,({x:d})=>i.isDefined(d,6)?void 0:d%2==0).vLine({x:6,y:0},1/0,({y:d})=>i.isDefined(6,d)?void 0:d%2==0);{const d=U.formatBits(e,r),u=c=>!n&&(d>>c&1)==1;for(let c=0;c<6;c++)i.set(8,c,u(c));for(let c=6;c<8;c++)i.set(8,c+1,u(c));for(let c=8;c<15;c++)i.set(8,o-15+c,u(c));for(let c=0;c<8;c++)i.set(o-c-1,8,u(c));for(let c=8;c<9;c++)i.set(15-c-1+1,8,u(c));for(let c=9;c<15;c++)i.set(15-c-1,8,u(c));i.set(8,o-8,!n)}if(t>=7){const d=U.versionBits(t);for(let u=0;u<18;u+=1){const c=!n&&(d>>u&1)==1,f=Math.floor(u/3),h=u%3+o-8-3;i.set(h,f,c),i.set(f,h,c)}}return i}function Xo(t,e,r){const n=t,o=n.height,i=Gt[e];let a=-1,s=o-1;for(let l=o-1;l>0;l-=2){for(l==6&&(l=5);;s+=a){for(let d=0;d<2;d+=1){const u=l-d;n.isDefined(u,s)||r(u,s,i(u,s))}if(s+a<0||s+a>=o)break}a=-a}}function Qo(t){let e="numeric";for(let r of t)if(!U.alphabet.numeric.has(r)&&(e="alphanumeric",!U.alphabet.alphanumerc.has(r)))return"byte";return e}function Jo(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function yr(t,e,r,n,o=Jo){let i="",a=r.length;if(n==="numeric"){const f=U.alphabet.numeric.decode(r.split("")),h=f.length;for(let g=0;g<h-2;g+=3)i+=_e(f[g]*100+f[g+1]*10+f[g+2],10);h%3===1?i+=_e(f[h-1],4):h%3===2&&(i+=_e(f[h-2]*10+f[h-1],7))}else if(n==="alphanumeric"){const f=U.alphabet.alphanumerc.decode(r.split("")),h=f.length;for(let g=0;g<h-1;g+=2)i+=_e(f[g]*45+f[g+1],11);h%2==1&&(i+=_e(f[h-1],6))}else if(n==="byte"){const f=o(r);a=f.length,i=Array.from(f).map(h=>_e(h,8)).join("")}else throw new Error("encode: unsupported type");const{capacity:s}=U.capacity(t,e),l=_e(a,U.lengthBits(t,n));let d=U.modeBits[n]+l+i;if(d.length>s)throw new Error("Capacity overflow");d+="0".repeat(Math.min(4,Math.max(0,s-d.length))),d.length%8&&(d+="0".repeat(8-d.length%8));const u="1110110000010001";for(let f=0;d.length!==s;f++)d+=u[f%u.length];const c=Uint8Array.from(d.match(/(.{8})/g).map(f=>+`0b${f}`));return Ko(t,e).encode(c)}function xr(t,e,r,n,o=!1){const i=Ho(t,e,n,o);let a=0;const s=8*r.length;if(Xo(i,n,(l,d,u)=>{let c=!1;a<s&&(c=(r[a>>>3]>>(7-a&7)&1)!==0,a++),i.set(l,d,c!==u)}),a!==s)throw new Error("QR: bytes left after draw");return i}const tn=t=>{const e=t.map(r=>r?"1":"0").join("");return{len:e.length,n:+`0b${e}`}},rn=[!0,!1,!0,!0,!0,!1,!0],nn=[!1,!1,!1,!1],st=tn([...rn,...nn]),kr=tn([...nn,...rn]);function Zo(t){const e=t,{width:r,height:n}=e,o=e.transpose();let i=0;for(let f=0;f<n;f++)e.getRuns(f,h=>{h>=5&&(i+=3+(h-5))});for(let f=0;f<r;f++)o.getRuns(f,h=>{h>=5&&(i+=3+(h-5))});let a=0;for(let f=0;f<n-1;f++)a+=3*e.countBoxes2x2(f);let s=0;for(let f=0;f<n;f++)s+=40*e.countPatternInRow(f,st.len,st.n,kr.n);for(let f=0;f<r;f++)s+=40*o.countPatternInRow(f,st.len,st.n,kr.n);const l=n*r,d=e.popcnt(),c=10*Math.ceil(Math.max(0,Math.abs(d*100-l*50)-l*5)/(l*5));return i+a+s+c}function Yo(t,e,r,n){if(n===void 0){const o=zo();for(let i=0;i<Gt.length;i++)o.add(Zo(xr(t,e,r,i,!0)),i);n=o.get()}if(n===void 0)throw new Error("Cannot find mask");return xr(t,e,r,n)}function ei(t){if(!br.includes(t))throw new Error(`Invalid error correction mode=${t}. Expected: ${br}`)}function ti(t){if(!wr.includes(t))throw new Error(`Encoding: invalid mode=${t}. Expected: ${wr}`);if(t==="kanji"||t==="eci")throw new Error(`Encoding: ${t} is not supported (yet?).`)}function ri(t){if(![0,1,2,3,4,5,6,7].includes(t)||!Gt[t])throw new Error(`Invalid mask=${t}. Expected number [0..7]`)}function ni(t,e="raw",r={}){const n=r,o=n.ecc!==void 0?n.ecc:"medium";ei(o);const i=n.encoding!==void 0?n.encoding:Qo(t);ti(i),n.mask!==void 0&&ri(n.mask);let a=n.version,s,l=new Error("Unknown error");if(a!==void 0)Fo(a),s=yr(a,o,t,i,n.textEncoder);else for(let c=1;c<=40;c++)try{s=yr(c,o,t,i,n.textEncoder),a=c;break}catch(f){l=f}if(!a||!s)throw l;let d=Yo(a,o,s,n.mask);d.assertDrawn();const u=n.border===void 0?2:n.border;if(!Number.isSafeInteger(u)||u<=0)throw new Error(`invalid border=${u}`);if(d=d.border(u,!1),n.scale!==void 0&&(d=d.scale(n.scale)),e==="raw")return d.toRaw();if(e==="ascii")return d.toASCII();if(e==="svg")return d.toSVG(n.optimize);if(e==="gif")return d.toGIF();if(e==="term")return d.toTerm();throw new Error(`Unknown output: ${e}`)}const on=async t=>{if(!t)return!1;try{if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch(e){console.error("Failed to copy to clipboard",e)}try{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",document.body.append(e),e.focus(),e.select();const r=document.execCommand("copy");return e.remove(),r}catch{return!1}};var oi=x('<div class="flex flex-col items-center gap-4 px-2"><div class="w-full space-y-4 rounded-md border border-(--lv-control-button-secondary-border) bg-(--lv-card-background) p-4"><div class=w-full><button type=button class="w-full cursor-pointer rounded-lg border border-(--lv-control-button-secondary-border) bg-(--lv-control-button-secondary-background) px-4 py-2 text-sm text-(--lv-text-primary) transition hover:bg-(--lv-control-button-secondary-hoverBackground) active:bg-(--lv-control-button-secondary-activeBackground)"></button></div></div><div class="w-full text-sm text-(--lv-text-secondary)"><span>'),ii=x('<div class="relative mx-auto flex w-fit items-center justify-center rounded-lg border border-(--lv-control-button-secondary-border) bg-(--lv-qr-background) p-2"><button type=button class="h-[200px] w-[200px] cursor-pointer rounded bg-(--lv-qr-background) text-(--lv-qr-color)">');const si=t=>ni(t,"svg",{optimize:!0,encoding:"byte",border:2}),ai=()=>{const{t}=Q(),{uri:e}=Ye(),r=()=>{const n=e();n&&on(n)};return(()=>{var n=oi(),o=n.firstChild,i=o.firstChild,a=i.firstChild,s=o.nextSibling,l=s.firstChild;return m(o,v(ve,{get when(){return e()},children:d=>(()=>{var u=ii(),c=u.firstChild;return c.$$click=r,z(f=>{var h=String(t("handshake.clickToCopyUrl")),g=si(d());return h!==f.e&&Z(c,"title",f.e=h),g!==f.t&&(c.innerHTML=f.t=g),f},{e:void 0,t:void 0}),u})()}),i),a.$$click=r,m(a,()=>t("handshake.copyConnectionUrl")),m(l,()=>t("handshake.scanCodeInstruction")),n})()};Ae(["click"]);var li=x('<div class="flex items-center justify-center"><div class="h-8 w-8 animate-spin rounded-full border-4 border-blue-500 border-t-transparent">'),Cr=x('<div class="flex flex-col items-center gap-4 p-6"><div class=text-center><h3 class="mb-2 font-semibold text-(--lv-text-primary) text-lg"></h3><p class="text-(--lv-text-muted) text-sm">'),ci=x("<div>");const Sr=()=>li(),di=()=>{const{status:t}=Ye(),{t:e}=Q();return(()=>{var r=ci();return m(r,v(Gr,{get children(){return[v(Ne,{get when(){return[it.CREATED,it.SIGNALING].includes(t()?.status??"")},get children(){var n=Cr(),o=n.firstChild,i=o.firstChild,a=i.nextSibling;return m(n,v(Sr,{}),o),m(i,()=>e("connectionFlow.connecting")),m(a,()=>e("connectionFlow.waitingForNetwork")),n}}),v(Ne,{get when(){return t()?.status===it.READY},get children(){return v(ai,{})}}),v(Ne,{get when(){return t()?.status===it.LINKING},get children(){var n=Cr(),o=n.firstChild,i=o.firstChild,a=i.nextSibling;return m(n,v(Sr,{}),o),m(i,()=>e("connectionFlow.establishingConnection")),m(a,()=>e("connectionFlow.mayTakeFewSeconds")),n}})]}})),r})()};var ui=x('<div class="flex flex-col items-center gap-4 p-6"><div class=text-center><div class="mb-4 text-4xl">⚠️</div><h3 class="mb-2 font-semibold text-(--lv-text-primary) text-lg"></h3><p class="mb-2 text-(--lv-text-muted) text-sm"></p></div><div class="flex w-full flex-col gap-2"><button type=button class="w-full rounded-lg bg-(--lv-control-button-primary-background) px-4 py-2 font-semibold text-(--lv-control-button-primary-color, var(--lv-text-primary)) text-sm transition hover:bg-(--lv-control-button-primary-background-hover)"></button><button type=button class="w-full rounded-lg bg-(--lv-control-button-secondary-background) px-4 py-2 font-semibold text-(--lv-text-primary) text-sm transition hover:bg-(--lv-control-button-primary-background-hover)">');const fi=t=>{const{t:e}=Q(),{provider:r}=Re(),n=T(()=>r.getState().error??r.getState().session?.error),o=T(()=>/ice candidates/i.test(n()??"")),i=T(()=>o()?e("connectionFlow.errorNoIce"):n()??e("connectionFlow.errorGeneric")),a=()=>{r.closeSession()};return(()=>{var s=ui(),l=s.firstChild,d=l.firstChild,u=d.nextSibling,c=u.nextSibling,f=l.nextSibling,h=f.firstChild,g=h.nextSibling;return m(u,()=>e("connectionFlow.connectionFailed")),m(c,i),h.$$click=a,m(h,()=>e("connectionFlow.tryAgain")),yt(g,"click",t.onClose,!0),m(g,()=>e("common.close")),s})()};Ae(["click"]);var hi=x('<div class="flex items-center justify-center"><div class="h-8 w-8 animate-spin rounded-full border-4 border-blue-500 border-t-transparent">'),Ar=x('<div class="flex flex-col items-center gap-4 p-6"><div class=text-center><h3 class="mb-2 font-semibold text-(--lv-text-primary) text-lg"></h3><p class="text-(--lv-text-muted) text-sm">'),gi=x("<div class=w-full style=view-transition-name:connection-flow>"),vi=x('<div class="mb-4 text-4xl">✅'),pi=x('<div class="mb-4 flex flex-col items-center gap-2"><span class="font-medium text-(--lv-text-primary) text-sm">'),mi=x("<div class=text-4xl>✅"),bi=x('<img alt class="h-12 w-12 rounded-xl">');const wi=()=>hi(),yi=t=>{const{t:e}=Q(),{provider:r}=Re(),[n,o]=D(r.getState().status),i=()=>r.getSession()?.getState().peerInfo,a=()=>{const s=i()?.icon;return s&&(s.startsWith("data:image/")||s.startsWith("https://"))?s:void 0};return Ft(()=>{r.on("status_change",o)}),se(()=>{r.off("status_change",o)}),(()=>{var s=gi();return m(s,v(Gr,{get fallback(){return v(jt,{get state(){return n()}})},get children(){return[v(Ne,{get when(){return n()===oe.CREATING},get children(){var l=Ar(),d=l.firstChild,u=d.firstChild,c=u.nextSibling;return m(l,v(wi,{}),d),m(u,()=>e("connectionFlow.preparingConnection")),m(c,()=>e("connectionFlow.generatingKeys")),l}}),v(Ne,{get when(){return n()===oe.CONNECTING},get children(){return v(di,{get onClose(){return t.onClose}})}}),v(Ne,{get when(){return n()===oe.CONNECTED},get children(){var l=Ar(),d=l.firstChild,u=d.firstChild,c=u.nextSibling;return m(d,v(ve,{get when(){return i()},get fallback(){return vi()},children:f=>(()=>{var h=pi(),g=h.firstChild;return m(h,v(ve,{get when(){return a()},get fallback(){return mi()},children:b=>(()=>{var p=bi();return z(()=>Z(p,"src",b())),p})()}),g),m(g,()=>f().name),h})()}),u),m(u,()=>e("connectionFlow.connectedSuccessfully")),m(c,()=>e("connectionFlow.walletConnectedReady")),l}}),v(Ne,{get when(){return n()===oe.ERROR},get children(){return v(fi,{get onClose(){return t.onClose}})}})]}})),s})()};var xi={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},Le=xi,ki=x("<svg>"),Ci=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},Si=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim(),Ai=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,n)=>n?n.toUpperCase():r.toLowerCase()),$r=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$i=t=>{const e=Ai(t);return e.charAt(0).toUpperCase()+e.slice(1)},Ti=t=>{const[e,r]=wt(t,["color","size","strokeWidth","children","class","name","iconNode","absoluteStrokeWidth"]);return(()=>{var n=ki();return gt(n,X(Le,{get width(){return e.size??Le.width},get height(){return e.size??Le.height},get stroke(){return e.color??Le.stroke},get"stroke-width"(){return Me(()=>!!e.absoluteStrokeWidth)()?Number(e.strokeWidth??Le["stroke-width"])*24/Number(e.size):Number(e.strokeWidth??Le["stroke-width"])},get class(){return Si("lucide","lucide-icon",...e.name!=null?[`lucide-${$r($i(e.name))}`,`lucide-${$r(e.name)}`]:[],e.class!=null?e.class:"")},get"aria-hidden"(){return!e.children&&!Ci(r)?"true":void 0}},r),!0,!0),m(n,v(Ce,{get each(){return e.iconNode},children:([o,i])=>v(Qn,X({component:o},i))})),n})()},$e=Ti,Ei=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_i=t=>v($e,X(t,{iconNode:Ei,name:"chevron-left"})),Pi=_i,Ni=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Bi=t=>v($e,X(t,{iconNode:Ni,name:"chevron-right"})),Mi=Bi,Ri=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Oi=t=>v($e,X(t,{iconNode:Ri,name:"circle-question-mark"})),sn=Oi,Ii=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Li=t=>v($e,X(t,{iconNode:Ii,name:"plus"})),ji=Li,Di=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Vi=t=>v($e,X(t,{iconNode:Di,name:"qr-code"})),Fi=Vi,zi=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ui=t=>v($e,X(t,{iconNode:zi,name:"settings"})),Wi=Ui,Gi=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],qi=t=>v($e,X(t,{iconNode:Gi,name:"trash-2"})),Ki=qi,Hi=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xi=t=>v($e,X(t,{iconNode:Hi,name:"x"})),Qi=Xi,Ji=/\s+/g,Zi=t=>typeof t!="string"||!t?t:t.replace(Ji," ").trim(),mt=(...t)=>{const e=[],r=n=>{if(!n&&n!==0&&n!==0n)return;if(Array.isArray(n)){for(let i=0,a=n.length;i<a;i++)r(n[i]);return}const o=typeof n;if(o==="string"||o==="number"||o==="bigint"){if(o==="number"&&n!==n)return;e.push(String(n))}else if(o==="object"){const i=Object.keys(n);for(let a=0,s=i.length;a<s;a++){const l=i[a];n[l]&&e.push(l)}}};for(let n=0,o=t.length;n<o;n++){const i=t[n];i!=null&&r(i)}return e.length>0?Zi(e.join(" ")):void 0},Tr=t=>t===!1?"false":t===!0?"true":t===0?"0":t,re=t=>{if(!t||typeof t!="object")return!0;for(const e in t)return!1;return!0},Yi=(t,e)=>{if(t===e)return!0;if(!t||!e)return!1;const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(let o=0;o<r.length;o++){const i=r[o];if(!n.includes(i)||t[i]!==e[i])return!1}return!0},es=(t,e)=>{for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=e[r];r in t?t[r]=mt(t[r],n):t[r]=n}return t},an=(t,e)=>{for(let r=0;r<t.length;r++){const n=t[r];Array.isArray(n)?an(n,e):n&&e.push(n)}},ln=(...t)=>{const e=[];an(t,e);const r=[];for(let n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},Dt=(t,e)=>{const r={};for(const n in t){const o=t[n];if(n in e){const i=e[n];Array.isArray(o)||Array.isArray(i)?r[n]=ln(i,o):typeof o=="object"&&typeof i=="object"&&o&&i?r[n]=Dt(o,i):r[n]=i+" "+o}else r[n]=o}for(const n in e)n in t||(r[n]=e[n]);return r},ts={twMerge:!0,twMergeConfig:{}};function rs(){let t=null,e={},r=!1;return{get cachedTwMerge(){return t},set cachedTwMerge(n){t=n},get cachedTwMergeConfig(){return e},set cachedTwMergeConfig(n){e=n},get didTwMergeConfigChange(){return r},set didTwMergeConfigChange(n){r=n},reset(){t=null,e={},r=!1}}}var _t=rs(),ns=t=>{const e=(n,o)=>{const{extend:i=null,slots:a={},variants:s={},compoundVariants:l=[],compoundSlots:d=[],defaultVariants:u={}}=n,c={...ts,...o},f=i?.base?mt(i.base,n?.base):n?.base,h=i?.variants&&!re(i.variants)?Dt(s,i.variants):s,g=i?.defaultVariants&&!re(i.defaultVariants)?{...i.defaultVariants,...u}:u;!re(c.twMergeConfig)&&!Yi(c.twMergeConfig,_t.cachedTwMergeConfig)&&(_t.didTwMergeConfigChange=!0,_t.cachedTwMergeConfig=c.twMergeConfig);const b=re(i?.slots),p=re(a)?{}:{base:mt(n?.base,b&&i?.base),...a},C=b?p:es({...i?.slots},re(p)?{base:n?.base}:p),k=re(i?.compoundVariants)?l:ln(i?.compoundVariants,l),y=_=>{if(re(h)&&re(a)&&b)return t(f,_?.class,_?.className)(c);if(k&&!Array.isArray(k))throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof k}`);if(d&&!Array.isArray(d))throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof d}`);const pe=(A,$=h,E=null,M=null)=>{const P=$[A];if(!P||re(P))return null;const O=M?.[A]??_?.[A];if(O===null)return null;const J=Tr(O);if(typeof J=="object")return null;const ce=g?.[A],G=J??Tr(ce);return P[G||"false"]},he=()=>{if(!h)return null;const A=Object.keys(h),$=[];for(let E=0;E<A.length;E++){const M=pe(A[E],h);M&&$.push(M)}return $},De=(A,$)=>{if(!h||typeof h!="object")return null;const E=[];for(const M in h){const P=pe(M,h,A,$),O=A==="base"&&typeof P=="string"?P:P&&P[A];O&&E.push(O)}return E},tt={};for(const A in _){const $=_[A];$!==void 0&&(tt[A]=$)}const Ve=(A,$)=>{const E=typeof _?.[A]=="object"?{[A]:_[A]?.initial}:{};return{...g,...tt,...E,...$}},rt=(A=[],$)=>{const E=[],M=A.length;for(let P=0;P<M;P++){const{class:O,className:J,...ce}=A[P];let G=!0;const ae=Ve(null,$);for(const me in ce){const le=ce[me],Oe=ae[me];if(Array.isArray(le)){if(!le.includes(Oe)){G=!1;break}}else{if((le==null||le===!1)&&(Oe==null||Oe===!1))continue;if(Oe!==le){G=!1;break}}}G&&(O&&E.push(O),J&&E.push(J))}return E},nt=A=>{const $=rt(k,A);if(!Array.isArray($))return $;const E={},M=t;for(let P=0;P<$.length;P++){const O=$[P];if(typeof O=="string")E.base=M(E.base,O)(c);else if(typeof O=="object")for(const J in O)E[J]=M(E[J],O[J])(c)}return E},Te=A=>{if(d.length<1)return null;const $={},E=Ve(null,A);for(let M=0;M<d.length;M++){const{slots:P=[],class:O,className:J,...ce}=d[M];if(!re(ce)){let G=!0;for(const ae in ce){const me=E[ae],le=ce[ae];if(me===void 0||(Array.isArray(le)?!le.includes(me):le!==me)){G=!1;break}}if(!G)continue}for(let G=0;G<P.length;G++){const ae=P[G];$[ae]||($[ae]=[]),$[ae].push([O,J])}}return $};if(!re(a)||!b){const A={};if(typeof C=="object"&&!re(C)){const $=t;for(const E in C)A[E]=M=>{const P=nt(M),O=Te(M);return $(C[E],De(E,M),P?P[E]:void 0,O?O[E]:void 0,M?.class,M?.className)(c)}}return A}return t(f,he(),rt(k),_?.class,_?.className)(c)},F=()=>{if(!(!h||typeof h!="object"))return Object.keys(h)};return y.variantKeys=F(),y.extend=i,y.base=f,y.slots=C,y.variants=h,y.defaultVariants=g,y.compoundSlots=d,y.compoundVariants=k,y};return{tv:e,createTV:n=>(o,i)=>e(o,i?Dt(n,i):n)}},os=(...t)=>e=>mt(t)||void 0,{tv:kt}=ns(os),is=x("<a>"),ss=x("<button type=button>");const Er=kt({base:"flex items-center justify-center rounded-lg transition-all duration-100 cursor-pointer active:scale-95",variants:{$variant:{primary:"font-semibold text-sm bg-(--lv-control-button-primary-background) text-(--lv-control-button-primary-color) border-(--lv-control-button-primary-border) hover:bg-(--lv-control-button-primary-hoverBackground,var(--lv-control-button-primary-background)) active:bg-(--lv-control-button-primary-activeBackground,var(--lv-control-button-primary-hoverBackground,var(--lv-control-button-primary-background))) disabled:bg-(--lv-control-button-primary-disabledBackground,var(--lv-control-button-primary-background)) disabled:text-(--lv-control-button-primary-disabledColor,var(--lv-control-button-primary-color))",secondary:"border bg-(--lv-control-button-secondary-background) text-(--lv-control-button-secondary-color) border-(--lv-control-button-secondary-border,var(--lv-control-button-secondary-background)) hover:bg-(--lv-control-button-secondary-hoverBackground,var(--lv-control-button-secondary-background)) active:bg-(--lv-control-button-secondary-activeBackground,var(--lv-control-button-secondary-hoverBackground,var(--lv-control-button-secondary-background))) disabled:bg-(--lv-control-button-secondary-disabledBackground,var(--lv-control-button-secondary-background)) disabled:text-(--lv-control-button-secondary-disabledColor,var(--lv-control-button-secondary-color))",tertiary:"bg-transparent text-(--lv-text-muted) hover:bg-(--lv-control-button-tertiary-hoverBackground,transparent) active:bg-(--lv-control-button-tertiary-activeBackground,var(--lv-control-button-tertiary-hoverBackground,transparent)) disabled:text-(--lv-control-button-tertiary-disabledColor,var(--lv-text-muted))"},$size:{sm:"h-6",md:"h-8",lg:"h-11"},$aspect:{square:"aspect-square",auto:""}},defaultVariants:{$size:"md",$variant:"primary",$aspect:"auto"}}),je=t=>{const[e,r]=wt(t,["children","class","$variant","$size","$aspect","href","onClick"]);return e.href?(()=>{var n=is();return gt(n,X({get href(){return e.href},get onClick(){return e.onClick},get class(){return ke(Er({$variant:e.$variant,$size:e.$size,$aspect:e.$aspect}),e.class)}},r),!1,!0),m(n,()=>e.children),n})():(()=>{var n=ss();return gt(n,X({get onClick(){return e.onClick},get class(){return ke(Er({$variant:e.$variant,$size:e.$size,$aspect:e.$aspect}),e.class)}},r),!1,!0),m(n,()=>e.children),n})()};var as=x('<div class="flex h-full w-full justify-between"><div class="grow py-1 ps-1"><div class="h-full rounded-sm border border-gray-300 bg-gray-400"></div></div><div class="flex h-full w-3 flex-col items-center justify-center gap-0.5 pr-0.5">'),ls=x('<div class="h-1.5 w-1.5 rounded-full border border-gray-500">'),cs=x('<div class="flex h-full w-full flex-col justify-between"><div class="grow px-1 pt-1"><div class="h-full rounded-sm border border-gray-200 bg-gray-300"></div></div><div class="flex h-3 w-full items-center justify-center gap-0.5 pb-0.5">'),ds=x('<div class="h-1.5 w-1.5 rounded-full border border-gray-400">'),us=x('<div class="-space-x-4 flex items-end"><div class="h-38 w-48 overflow-hidden rounded-lg bg-gray-300"></div><div class="h-18 w-12 overflow-hidden rounded-lg bg-gray-200">');const cn=t=>t?1:3,fs=t=>(()=>{var e=as(),r=e.firstChild,n=r.nextSibling;return m(n,v(Ce,{get each(){return Array.from({length:cn(t.isApple)})},children:()=>ls()})),e})(),hs=t=>(()=>{var e=cs(),r=e.firstChild,n=r.nextSibling;return m(n,v(Ce,{get each(){return Array.from({length:cn(t.isApple)})},children:()=>ds()})),e})(),gs=()=>(()=>{var e=us(),r=e.firstChild,n=r.nextSibling;return m(r,v(fs,{isApple:!0})),m(n,v(hs,{isApple:!0})),e})();var vs=x('<div class="flex flex-col items-center gap-4 p-6"><div class=text-center><p class="text-sm text-(--lv-text-secondary)"></p></div><div class="flex items-center">');const ps=t=>{const{t:e}=Q(),{start:r}=jo();return(()=>{var n=vs(),o=n.firstChild,i=o.firstChild,a=o.nextSibling;return m(n,v(gs,{}),o),m(i,()=>e("disconnected.prompt")),m(a,v(je,{type:"button",onClick:r,class:"z-10 px-6 py-3",$variant:"primary",$size:"lg",get children(){return e("disconnected.generateQr")}}),null),m(a,v(je,{type:"button",get"aria-label"(){return String(e("disconnected.connectionSettings"))},"aria-pressed":!1,get onClick(){return t.onSettings},class:"px-3 ltr:-ml-1 ltr:rounded-l-none rtl:-mr-1 rtl:rounded-r-none",$aspect:"square",$size:"lg",$variant:"secondary",get children(){return v(Wi,{class:"h-5 w-5 text-(--lv-text-muted)"})}}),null),n})()};var ms=x('<div class="flex flex-col space-y-2 px-4 text-start"><div class="min-h-32 w-full rounded-md border border-(--lv-control-button-secondary-border) md:flex justify-start divide-y md:divide-y-0 md:divide-x divide-(--lv-control-button-secondary-border)"><div class="p-2 w-full md:w-3/5"></div><div class="flex justify-center items-center grow"></div></div><div class="w-full rounded-md border border-(--lv-control-button-secondary-border) md:flex justify-start divide-y md:divide-y-0 md:divide-x divide-(--lv-control-button-secondary-border)"><div class="p-2 w-full md:w-3/5"></div><div class></div></div><div class="w-full rounded-md border border-(--lv-control-button-secondary-border) md:flex justify-start divide-y md:divide-y-0 md:divide-x divide-(--lv-control-button-secondary-border)"><div class="p-2 w-full md:w-3/5"></div><div class>');const bs=()=>{const{t}=Q();return(()=>{var e=ms(),r=e.firstChild,n=r.firstChild,o=n.nextSibling,i=r.nextSibling,a=i.firstChild,s=i.nextSibling,l=s.firstChild;return m(n,()=>t("info.scanQrCode")),m(o,v(Fi,{class:"w-10 h-10"})),m(a,()=>t("info.approveOnDevice")),m(l,()=>t("info.youreConnected")),e})()},Vt=(t,{duration:e=200}={})=>{const r=typeof t=="function"?t:()=>t,n=r(),[o,i]=D(n),[a,s]=D(void 0);let l,d=n;return ie(()=>{const u=r();Object.is(u,d)||(l&&globalThis.clearTimeout(l),s(()=>d),i(()=>u),d=u,l=globalThis.setTimeout(()=>{s(()=>{}),l=void 0},e),se(()=>{l&&globalThis.clearTimeout(l)}))}),{current:o,previous:a,isTransitioning:()=>a()!==void 0}},et=()=>{const{provider:t}=Re(),[e,r]=D(t.storage.getSettings()),n=u=>{r(u),t.storage.setSettings(u)};return{settings:e,setSettings:n,setLanguage:u=>{n({...e(),language:u})},setThemeMode:u=>{n({...e(),theme:u})},setSignalingProtocol:u=>{n({...e(),signaling:{p:u,s:e()?.signaling?.s??{}}})},setSignalingOptions:u=>{const c=e()?.signaling?.p;if(!c)return;const f=e()?.signaling?.s??{};n({...e(),signaling:{p:c,s:{...f,[c]:u.url}}})},setRetainSessionHistory:u=>{n({...e(),retainHistory:u})},setAutoReconnect:u=>{n({...e(),autoReconnect:u})}}},dn=()=>{const{settings:t}=et(),e=T(()=>t().theme),r=T(()=>"light");return{theme:e,mode:r}},un="data:image/webp;base64,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";var ws=x('<div class="group flex items-center gap-2 rounded-md px-2 py-2 hover:bg-(--lv-control-button-secondary-background)"><div class="pointer-events-none whitespace-nowrap rounded-md text-xs opacity-0 group-hover:opacity-100"></div><div>');const ys=()=>{const{t}=Q(),{status:e}=Ye(),r=T(()=>{const n=e()?.status,o=e()?.signaling?.state;return Be({sessionState:n,signalState:o}).with({sessionState:"connected"},()=>({icon:"✅",text:t("status.connectedSuccessfully")})).with({sessionState:"signaling",signalState:"standby"},()=>({icon:"🫥",text:t("status.connecting")})).with({sessionState:"signaling",signalState:"connecting"},()=>({icon:"↗️",text:t("status.connecting")})).with({sessionState:"signaling",signalState:"ready"},()=>({icon:"👋",text:t("status.ready")})).with({sessionState:"signaling",signalState:"handshake"},()=>({icon:"🤝",text:t("status.handshakeClosed")})).with({sessionState:"signaling",signalState:"handshake-partial"},()=>({icon:"🤝",text:t("status.handshakePartial")})).with({sessionState:"signaling",signalState:"encrypted"},()=>({icon:"🔒",text:t("status.encrypted")})).with({sessionState:"signaling",signalState:"error"},()=>({icon:"❌",text:t("status.signalError")})).otherwise(()=>{})});return v(ve,{get when(){return r()},children:n=>(()=>{var o=ws(),i=o.firstChild,a=i.nextSibling;return m(i,()=>n().text),m(a,()=>n().icon),o})()})};var xs=x('<div class="h-11 w-full">'),ks=x('<div class="absolute inset-x-0 bottom-0 flex items-end justify-between gap-2 px-3 py-2 text-(--lv-text-muted)"><a href=https://github.com/open-lavatory/open-lavatory target=_blank rel=noreferrer class="flex items-center gap-2 p-1 font-semibold text-sm text-(--lv-text-muted)"><img alt="Open Lavatory Logo"width=20 height=20 class=rounded data-openlv-brand-logo><span>openlv</span></a><div class="text-sm text-(--lv-text-muted)">');const Cs=()=>[xs(),(()=>{var t=ks(),e=t.firstChild,r=e.firstChild,n=e.nextSibling;return Z(r,"src",un),m(n,v(ys,{})),t})()];var Ss=x('<div class="flex items-center justify-between px-2 py-2"><h2 class="flex items-center justify-center gap-2 font-semibold text-(--lv-text-primary) text-lg">');const As=t=>{const{t:e}=Q();return(()=>{var r=Ss(),n=r.firstChild;return m(r,(()=>{var o=Me(()=>!!t.onBack);return()=>o()?v(je,{get onClick(){return t.onBack},get"aria-label"(){return String(t.view==="settings"?e("modal.backToQr"):e("modal.closeModal"))},$variant:"tertiary",$aspect:"square",$size:"md",get children(){return v(Pi,{class:"h-6 w-6 text-(--lv-text-muted) rtl:rotate-180"})}}):v(je,{type:"button",onClick:()=>t.setView("info"),$variant:"tertiary",$aspect:"square",$size:"md",get children(){return v(sn,{class:"h-5 w-5"})}})})(),n),m(n,()=>t.title),m(r,v(je,{type:"button",get"aria-label"(){return String(e("common.close"))},"aria-pressed":!1,get onClick(){return t.onClose},$variant:"tertiary",$aspect:"square",$size:"md",get children(){return v(Qi,{class:"h-6 w-6 text-(--lv-text-muted)"})}}),null),r})()},$s=(t,{transitionDuration:e=200}={})=>{const[r,n]=D([t]),[o,i]=D(0),a=T(()=>r()[o()]??t),{current:s,previous:l,isTransitioning:d}=Vt(a,{duration:e});return{screen:s,previousScreen:l,isTransitioning:d,navigate:f=>{const h=o(),g=r(),b=g[h];if(Object.is(b,f))return;const p=g.slice(0,h+1);p.push(f),n(p),i(p.length-1)},goBack:()=>{i(f=>Math.max(0,f-1))},isAtRoot:()=>o()===0}};var Ts=x('<div class="modal-transition__layer modal-transition__layer--outgoing">'),Es=x("<div><div>");const _s=t=>(()=>{var e=Es(),r=e.firstChild;return m(e,v(ve,{get when(){return t.previous!==void 0},get children(){var n=Ts();return m(n,()=>t.render(t.previous)),n}}),r),m(r,()=>t.render(t.current)),z(n=>{var o=ke("modal-transition__container",t.class),i=ke("modal-transition__layer",t.isTransitioning&&"modal-transition__layer--incoming");return o!==n.e&&ne(e,n.e=o),i!==n.t&&ne(r,n.t=i),n},{e:void 0,t:void 0}),e})();var Ps=x('<div><div class="flex items-end justify-between py-1 pl-2"><div class="font-medium text-(--lv-text-primary) text-sm"></div><div></div></div><div class="flex flex-col gap-1 rounded-md bg-(--lv-card-background)">');const Xe=t=>(()=>{var e=Ps(),r=e.firstChild,n=r.firstChild,o=n.nextSibling,i=r.nextSibling;return m(n,()=>t.title),m(o,()=>t.right),m(i,()=>t.children),e})();var Ns=x('<div class="flex items-baseline justify-between gap-2 px-2 py-1 first:pt-2 last:pb-2"><div class="text-sm text-(--lv-text-secondary) text-start"></div><div>');const Qe=t=>(()=>{var e=Ns(),r=e.firstChild,n=r.nextSibling;return m(r,()=>t.label),m(n,()=>t.children),e})();var Bs=x("<select>"),Ms=x("<div>"),Rs=x("<button type=button>"),Os=x("<option>");const Is=kt({slots:{root:"flex overflow-hidden rounded-md border border-(--lv-control-button-secondary-border)",box:"px-4 py-2 font-semibold text-xs transition border-l first:border-l-0 border-(--lv-control-button-secondary-border)"},variants:{active:{on:{box:"bg-(--lv-control-button-secondary-background) text-(--lv-text-primary)"},off:{box:"bg-transparent text-(--lv-text-secondary) cursor-pointer"}}},defaultVariants:{active:"off"}}),Ls=kt({base:"w-full rounded-md border border-(--lv-control-button-secondary-border) bg-(--lv-control-button-secondary-background) px-3 py-2 font-semibold text-xs text-(--lv-text-primary) cursor-pointer focus:outline-none focus:ring-2 focus:ring-(--lv-control-button-primary-background) appearance-none bg-[url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23888%22%20stroke-width%3D%222%22%3E%3Cpath%20d%3D%22M6%209l6%206%206-6%22%2F%3E%3C%2Fsvg%3E')] bg-[length:14px] bg-[right_8px_center] bg-no-repeat pr-8"}),Ct=t=>{const e=Ls(),{root:r,box:n}=Is({});return v(ve,{get when(){return t.options.length>(t.dropdownThreshold??3)},get fallback(){return(()=>{var o=Ms();return m(o,v(Ce,{get each(){return t.options},children:([i,a])=>(()=>{var s=Rs();return s.$$click=()=>t.onChange(i),m(s,a),z(l=>{var d=i===t.value,u=n({active:i===t.value?"on":"off"});return d!==l.e&&Z(s,"aria-pressed",l.e=d),u!==l.t&&ne(s,l.t=u),l},{e:void 0,t:void 0}),s})()})),z(()=>ne(o,r())),o})()},get children(){var o=Bs();return o.addEventListener("change",i=>t.onChange(i.currentTarget.value)),ne(o,e),m(o,v(Ce,{get each(){return t.options},children:([i,a])=>(()=>{var s=Os();return s.value=i,m(s,a),s})()})),z(()=>o.value=t.value),o}})};Ae(["click"]);const js=()=>{const{t}=Q(),e=dn(),r=()=>e.mode()==="auto",n=()=>e.mode()==="auto"?"system":e.mode(),o=i=>{};return v(ve,{get when(){return r()},get children(){return v(Qe,{get label(){return t("settings.theme.mode")},get children(){return v(Ct,{get options(){return[["light",t("settings.theme.light")],["dark",t("settings.theme.dark")],["system",t("settings.theme.system")]]},get value(){return n()},onChange:i=>o()})}})}})},Ds=()=>{const{t,languageTag:e,setLanguageTag:r}=Q(),{settings:n,setLanguage:o}=et(),i=T(()=>[...Wt].sort((s,l)=>{const d=ur(s.tag);return ur(l.tag)-d})),a=s=>{const l=s;r(l),o(l)};return v(Xe,{get title(){return t("settings.appearance")},get children(){return[v(Qe,{get label(){return t("settings.language")},get children(){return v(Ct,{get options(){return i().map(s=>[s.tag,s.nativeName])},get value(){return n()?.language||e()},onChange:a})}}),v(js,{})]}})};var Vs=x("<div><div></div><div>"),Fs=x("<div>Text");const zs=kt({slots:{root:"group relative",box:"cursor-pointer rounded-md transition-colors flex items-center justify-center hover:[background-color:var(--lv-control-button-tertiary-hoverBackground)] text-(--lv-text-muted)",popover:"-translate-x-1/2 absolute top-full left-1/2 z-10 hidden rounded-md shadow-sm group-hover:block border border-(--lv-control-button-secondary-border) bg-(--lv-body-background) px-2 py-1.5 text-(--lv-text-primary) text-sm",icon:""},variants:{size:{sm:{box:"h-5 w-5 p-1",icon:"h-3 w-3"},md:{box:"h-6 w-6 p-1",icon:"h-4 w-4"},lg:{box:"h-8 w-8 p-1.5",icon:"h-4 w-4"}},variant:{icon:"",text:""}},defaultVariants:{size:"lg"}}),_r=t=>{const e=X({variant:"icon",size:"lg"},t),{root:r,box:n,popover:o,icon:i}=zs({size:e.size,variant:e.variant});return(()=>{var a=Vs(),s=a.firstChild,l=s.nextSibling;return m(s,()=>Be(e.variant).with("icon",()=>v(sn,{get class(){return i()}})).with("text",()=>Fs()).exhaustive()),m(l,()=>e.children),z(d=>{var u=r(),c=n(),f=o();return u!==d.e&&ne(a,d.e=u),c!==d.t&&ne(s,d.t=c),f!==d.a&&ne(l,d.a=f),d},{e:void 0,t:void 0,a:void 0}),a})()};var Us=x('<span class="text-sm text-(--lv-text-muted)">'),Ws=x('<button type=button class="flex w-full cursor-pointer items-center justify-between gap-2 first:rounded-t-sm last:rounded-b-sm px-2 py-1 first:pt-1.5 last:pb-2 hover:bg-(--lv-control-button-tertiary-hoverBackground)"><div class="text-sm text-(--lv-text-secondary) flex items-center gap-1"></div><div class="flex items-center gap-1">');const Pr=t=>(()=>{var e=Ws(),r=e.firstChild,n=r.nextSibling;return yt(e,"click",t.onClick,!0),m(r,()=>t.label),m(n,v(ve,{get when(){return t.value},get children(){var o=Us();return m(o,()=>t.value),o}}),null),m(n,v(Mi,{class:"h-4 w-4 text-(--lv-text-muted) rtl:rotate-180"}),null),e})();Ae(["click"]);const Gs=t=>{const{t:e}=Q();return v(Ct,{get options(){return[["true",String(e("common.yes"))],["false",String(e("common.no"))]]},get value(){return t.value?"true":"false"},onChange:r=>t.onChange(r==="true")})},qs=t=>{const{t:e}=Q(),{settings:r,setRetainSessionHistory:n,setAutoReconnect:o}=et();return v(Xe,{get title(){return e("settings.connectionPreferences.title")},get children(){return[v(Pr,{get label(){return[Me(()=>e("settings.signaling.title")),v(_r,{variant:"icon",get children(){return e("settings.signaling.description")}})]},onClick:()=>t.onNavigate("signaling"),get value(){return r()?.signaling?.p}}),v(Pr,{get label(){return[Me(()=>e("settings.transport.title")),v(_r,{variant:"icon",get children(){return e("settings.transport.description")}})]},onClick:()=>t.onNavigate("transport"),value:"WebRTC"}),v(Ce,{get each(){return[[e("settings.connectionPreferences.retainSessionHistory"),r()?.retainHistory??!1,n],[e("settings.connectionPreferences.autoReconnect"),r()?.autoReconnect??!1,o]]},children:([i,a,s])=>v(Qe,{label:i,get children(){return v(Gs,{label:i,value:a,onChange:s})}})})]}})};var Ks=x('<input class="h-9 w-full rounded-lg border bg-white px-3 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 text-(--lv-text-primary) bg-(--lv-body-background) border-(--lv-control-input-border)">');const We=t=>{const e=X({readOnly:!0},t),[r]=wt(e,["id","value","placeholder","ariaLabel","readOnly","onChange"]);return(()=>{var n=Ks();return n.$$input=o=>{r.onChange?.(o.currentTarget.value)},z(o=>{var i=r.id,a=r.placeholder,s=r.ariaLabel,l=r.readOnly;return i!==o.e&&Z(n,"id",o.e=i),a!==o.t&&Z(n,"placeholder",o.t=a),s!==o.a&&Z(n,"aria-label",o.a=s),l!==o.o&&(n.readOnly=o.o=l),o},{e:void 0,t:void 0,a:void 0,o:void 0}),z(()=>n.value=r.value),n})()};Ae(["input"]);var Hs=x('<div><div class="p-2 text-sm text-(--lv-text-secondary) text-start">');const Xs=["mqtt","ntfy","gun"],Qs=()=>{const{t}=Q(),{settings:e,setSignalingProtocol:r,setSignalingOptions:n}=et(),o=T(()=>e()?.signaling?.p),i=T(()=>{const a=o();return a?e()?.signaling?.s?.[a]??"":""});return(()=>{var a=Hs(),s=a.firstChild;return m(a,v(Xe,{get title(){return t("settings.signaling.title")},get children(){return[v(Qe,{get label(){return t("common.protocol")},get children(){return v(Ct,{get options(){return Xs.map(l=>[l.toLowerCase(),l.toUpperCase()])},get value(){return o()??""},onChange:l=>r(l)})}}),v(Qe,{get label(){return t("settings.signaling.server")},get children(){return v(We,{id:"server",get value(){return i()},onChange:l=>n({url:l}),get placeholder(){return String(t("settings.signaling.serverUrl"))},get ariaLabel(){return String(t("settings.signaling.serverUrl"))},readOnly:!1})}})]}}),s),m(s,()=>t("settings.signaling.description")),a})()};var Js=x('<div class="flex items-center gap-2"><div class=flex-1>'),Zs=x('<button type=button class="flex w-full cursor-pointer items-center justify-center gap-1 rounded-md border border-dashed border-(--lv-control-input-border) py-2 text-sm text-(--lv-text-muted) hover:bg-(--lv-card-background)">'),Ys=x('<div class="flex flex-col gap-2 p-2">'),ea=x('<div class="flex flex-col gap-3 p-2">'),ta=x('<div class="p-2 text-sm text-(--lv-text-secondary) text-start">'),ra=x('<div class="flex flex-col gap-2 rounded-md border border-(--lv-control-input-border) p-2"><div class="grid grid-cols-2 gap-2">');const Nr=t=>(()=>{var e=Js(),r=e.firstChild;return m(r,()=>t.children),m(e,v(je,{get onClick(){return t.onRemove},$variant:"tertiary",$aspect:"square",$size:"sm",get children(){return v(Ki,{class:"h-4 w-4 text-(--lv-text-muted)"})}}),null),e})(),Br=t=>(()=>{var e=Zs();return yt(e,"click",t.onClick,!0),m(e,v(ji,{class:"h-4 w-4"}),null),m(e,()=>t.label,null),e})(),na=()=>{const{t}=Q();et();const[e,r]=D([]),[n,o]=D([]),i=()=>{o([...n(),""])},a=c=>{o(n().filter((f,h)=>h!==c))},s=(c,f)=>{o(n().map((h,g)=>g===c?f:h))},l=()=>{r([...e(),{urls:""}])},d=c=>{r(e().filter((f,h)=>h!==c))},u=(c,f,h)=>{r(e().map((g,b)=>b===c?{...g,[f]:h}:g))};return[v(Xe,{get title(){return t("settings.transport.iceServers.stun")},get children(){var c=Ys();return m(c,v(Ce,{get each(){return n()},children:(f,h)=>v(Nr,{onRemove:()=>a(h()),get children(){return v(We,{value:f,onChange:g=>s(h(),g),placeholder:"stun:stun.l.google.com:19302",readOnly:!1})}})}),null),m(c,v(Br,{get label(){return t("settings.transport.iceServers.addStun")},onClick:i}),null),c}}),v(Xe,{get title(){return t("settings.transport.iceServers.turn")},get children(){var c=ea();return m(c,v(Ce,{get each(){return e()},children:(f,h)=>(()=>{var g=ra(),b=g.firstChild;return m(g,v(Nr,{onRemove:()=>d(h()),get children(){return v(We,{get value(){return f.urls},onChange:p=>u(h(),"urls",p),placeholder:"turn:relay.example.com:443",readOnly:!1})}}),b),m(b,v(We,{get value(){return f.username??""},onChange:p=>u(h(),"username",p),placeholder:"Username",readOnly:!1}),null),m(b,v(We,{get value(){return f.credential??""},onChange:p=>u(h(),"credential",p),placeholder:"Password",readOnly:!1}),null),g})()}),null),m(c,v(Br,{get label(){return t("settings.transport.iceServers.addTurn")},onClick:l}),null),c}}),(()=>{var c=ta();return m(c,()=>t("settings.transport.description")),c})()]};Ae(["click"]);var oa=x('<div class="px-4 pb-2">');const ia=t=>{switch(t){case"main":return"settings.title";case"signaling":return"settings.signaling.title";case"transport":return"settings.transport.title"}},sa=t=>{const{screen:e,previousScreen:r,isTransitioning:n,navigate:o,goBack:i,isAtRoot:a}=$s("main"),s={goBack:i,get isAtRoot(){return a()}};ie(()=>{t.navigationRef&&(t.navigationRef.current=s)}),ie(()=>{t.onTitleChange?.(ia(e()))});const l=d=>{switch(d){case"main":return[v(qs,{onNavigate:o}),v(Ds,{})];case"signaling":return v(Qs,{});case"transport":return v(na,{})}};return(()=>{var d=oa();return m(d,v(_s,{get current(){return e()},get previous(){return r()},get isTransitioning(){return n()},render:l})),d})()};var aa=x("<div class=modal-transition__container><div>"),la=x('<div class="modal-transition__layer modal-transition__layer--outgoing">'),ca=x('<div class="fixed inset-0 z-10000 flex animate-[bg-in_0.15s_ease-in-out] items-end justify-center md:items-center lg:p-4"role=presentation data-openlv-modal-root><div role=dialog aria-modal=true><div><div class=modal-transition__container><div><div class="flex flex-col text-center"></div></div></div></div><div>');const da=()=>{const[t,e]=D("start"),[r,n]=D(!1);return ie(()=>{if(!r())return;const o=globalThis.setTimeout(()=>n(!1),2e3);se(()=>globalThis.clearTimeout(o))}),{view:t,setView:e,copied:r,setCopied:n}},ua=t=>{ie(()=>{const e=r=>{r.key==="Escape"&&t()};document.addEventListener("keydown",e),se(()=>document.removeEventListener("keydown",e))})},fa=()=>{const[t,e]=D(),[r,n]=D(0),o=(a,s=!1)=>{const l=a||t();if(!l||!l.getBoundingClientRect)return;const d=s?l.scrollHeight:l.getBoundingClientRect().height;d>0&&n(u=>typeof u=="number"&&Math.abs(u-d)<.5?u:d)};ie(()=>{const a=t();if(!a||typeof ResizeObserver>"u")return;const s=new ResizeObserver(()=>{o()});s.observe(a),se(()=>s.disconnect())});const i=()=>o();return ie(()=>{globalThis.window!==void 0&&(window.addEventListener("resize",i),se(()=>window.removeEventListener("resize",i)))}),{setContentRef:e,contentNode:t,height:r,measureHeight:o}},fn=t=>{const{view:e,setView:r,copied:n,setCopied:o}=da(),{uri:i,status:a}=Ye(),{provider:s}=Re(),{setContentRef:l,contentNode:d,height:u,measureHeight:c}=fa(),{current:f,previous:h,isTransitioning:g}=Vt(e),{current:b,previous:p,isTransitioning:C}=Vt(a),k=()=>r("settings"),{t:y,isRtl:F,languageTag:_}=Q(),pe=dn(),he={current:null},[De,tt]=D("settings.title"),Ve=T(()=>Be(e()).with("start",()=>y("start.title")).with("settings",()=>y(De())).with("info",()=>y("info.title")).exhaustive());ua(t.onClose),ie(()=>{a()?.status===oe.CONNECTED&&t.onClose()});const rt=async()=>{const N=i();N&&await on(N)&&o(!0)};let nt=!0,Te,A,$;const[E,M]=D(!1);ie(()=>{b(),f(),d()&&(nt?(Te&&globalThis.clearTimeout(Te),Te=globalThis.setTimeout(()=>{d()&&(c(void 0,!0),nt=!1)},0)):c(),se(()=>{Te&&globalThis.clearTimeout(Te)}))}),ie(()=>{const N=u();A!==void 0&&N!==A&&N>0&&A>0&&Math.abs(N-A)>.5&&(M(!0),$&&globalThis.clearTimeout($),$=globalThis.setTimeout(()=>{M(!1),$=void 0},200)),A=N,se(()=>{$&&globalThis.clearTimeout($)})});const[P,O]=D(s.getState().status);Ft(()=>{s.on("status_change",O)}),se(()=>{s.off("status_change",O)});const J=T(()=>!(e()==="start"&&P()===oe.STANDBY)),ce=()=>{Be({view:e(),status:P()}).with({view:"start",status:oe.STANDBY},()=>{}).with({view:"start"},()=>{s.closeSession()}).with({view:"settings"},()=>{he.current&&!he.current.isAtRoot?he.current.goBack():r("start")}).with({view:"info"},()=>{r("start")}).otherwise(()=>{s.closeSession(),t.onClose()})},G=N=>Be(N).with("start",()=>v(ps,{onSettings:k})).with("settings",()=>v(sa,{onTitleChange:tt,navigationRef:he})).with("info",()=>v(bs,{})).otherwise(()=>v(jt,{state:N})),ae=()=>(()=>{var N=aa(),ee=N.firstChild;return m(N,v(ve,{get when(){return h()},children:Ee=>(()=>{var Fe=la();return m(Fe,()=>G(Ee())),Fe})()}),ee),m(ee,()=>G(f())),z(()=>ne(ee,ke("modal-transition__layer",g()&&"modal-transition__layer--incoming"))),N})(),me=N=>Be(N).with(oe.STANDBY,()=>ae()).with(go.union(oe.CREATING,oe.CONNECTING,oe.CONNECTED,oe.ERROR),()=>v(yi,{get onClose(){return t.onClose},onCopy:rt})).otherwise(ee=>v(jt,{state:ee||"unknown status"})),le={background:"var(--lv-overlay-background, rgba(0,0,0,0.3))","backdrop-filter":"var(--lv-overlay-backdrop-filter, blur(4px))"},Oe={background:"var(--lv-body-background)",color:"var(--lv-body-color, var(--lv-text-primary))","border-radius":"var(--lv-border-radius, 16px)","box-shadow":"var(--lv-modal-shadow, 0px 12px 32px rgba(0,0,0,0.25))"};return(()=>{var N=ca(),ee=N.firstChild,Ee=ee.firstChild,Fe=Ee.firstChild,qt=Fe.firstChild,gn=qt.firstChild,Kt=Ee.nextSibling;return N.$$mouseup=I=>{I.target===I.currentTarget&&t.onClose()},Bt(N,le),ee.$$click=I=>I.stopPropagation(),qr(l,Ee),m(Ee,v(As,{get title(){return String(Ve())},get view(){return e()},get onClose(){return t.onClose},get onBack(){return J()?ce:void 0},setView:r}),Fe),m(gn,()=>me(P())),m(Ee,v(Cs,{}),null),m(Kt,()=>y("modal.urlCopied")),z(I=>{var Ht=pe.mode(),Xt=_(),Qt=F()?"rtl":"ltr",Jt=ke("relative w-full max-w-[400px] animate-[fade-in_0.15s_ease-in-out] transition-[height] duration-200 ease-out",E()||p()?"overflow-hidden":void 0),Zt=String(Ve()),vn={...typeof u()=="number"&&u()>0&&{height:`${u()}px`},...Oe},Yt=ke("modal-transition__layer",C()&&"modal-transition__layer--incoming"),er=ke("absolute top-5 rounded-lg bg-blue-500 px-4 py-3 font-medium text-sm text-white transition-all ltr:right-5 rtl:left-5",n()?"translate-x-0 opacity-100":"opacity-0 ltr:translate-x-full rtl:-translate-x-full");return Ht!==I.e&&Z(N,"data-openlv-theme-mode",I.e=Ht),Xt!==I.t&&Z(N,"lang",I.t=Xt),Qt!==I.a&&Z(N,"dir",I.a=Qt),Jt!==I.o&&ne(ee,I.o=Jt),Zt!==I.i&&Z(ee,"aria-label",I.i=Zt),I.n=Bt(ee,vn,I.n),Yt!==I.s&&ne(qt,I.s=Yt),er!==I.h&&ne(Kt,I.h=er),I},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),N})()};Ae(["mouseup","click"]);const ha=(...t)=>console.log("%c[modal]%c","color: yellow; font-weight: bold","color: inherit; font-weight: normal",...t),hn=(t="openlv-modal")=>{if(globalThis.window===void 0)return t;const e=globalThis.customElements;return e?(e.get(t)||e.define(t,xt),t):(console.warn("OpenLV modal: custom elements are not supported in this environment."),t)},ga=t=>{const e=document.querySelector("openlv-modal");if(e&&e.remove(),!e){hn();const r=new xt({onClose(){ha("modal closed"),r.remove(),t.onClose?.()},provider:t.provider,theme:t.theme});document.body.append(r)}};exports.ModalRoot=fn;exports.OPENLV_ICON_128=un;exports.OpenLVModalElement=xt;exports.default=xt;exports.registerOpenLVModal=hn;exports.triggerOpenModal=ga;
8
8
  //# sourceMappingURL=index.cjs.js.map