@arcblock/did-connect-service 4.0.6 → 4.1.0

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.
Files changed (97) hide show
  1. package/dist/_generated/asset-bytes.d.ts +3 -0
  2. package/dist/_generated/asset-bytes.d.ts.map +1 -0
  3. package/dist/_generated/asset-bytes.js +2 -0
  4. package/dist/_generated/asset-bytes.js.map +1 -0
  5. package/dist/_generated/asset-manifest.d.ts +3 -0
  6. package/dist/_generated/asset-manifest.d.ts.map +1 -0
  7. package/dist/_generated/asset-manifest.js +12 -0
  8. package/dist/_generated/asset-manifest.js.map +1 -0
  9. package/dist/asset-registry.d.ts +38 -0
  10. package/dist/asset-registry.d.ts.map +1 -0
  11. package/dist/asset-registry.js +73 -0
  12. package/dist/asset-registry.js.map +1 -0
  13. package/dist/assets/admin-core.c0b5af61.js +1393 -0
  14. package/dist/assets/admin-extra.7ca9c16b.js +2529 -0
  15. package/dist/assets/admin.c26bb17a.css +2219 -0
  16. package/dist/assets/design.99dc4ddc.css +97 -0
  17. package/dist/assets/did-address.7df30f28.js +51 -0
  18. package/dist/assets/header.94d9e46b.js +136 -0
  19. package/dist/assets/login.7b12c6dc.css +662 -0
  20. package/dist/assets/login.d3f05790.js +720 -0
  21. package/dist/assets/qr.c0d203ca.js +3 -0
  22. package/dist/blocklet-service.d.ts +7 -32
  23. package/dist/blocklet-service.d.ts.map +1 -1
  24. package/dist/blocklet-service.js +43 -37
  25. package/dist/blocklet-service.js.map +1 -1
  26. package/dist/env-config.d.ts +86 -0
  27. package/dist/env-config.d.ts.map +1 -0
  28. package/dist/env-config.js +33 -0
  29. package/dist/env-config.js.map +1 -0
  30. package/dist/handlers/auth-handler.d.ts +1 -1
  31. package/dist/handlers/auth-handler.d.ts.map +1 -1
  32. package/dist/handlers/auth-handler.js +11 -11
  33. package/dist/handlers/auth-handler.js.map +1 -1
  34. package/dist/handlers/branding-handler.d.ts.map +1 -1
  35. package/dist/handlers/branding-handler.js +3 -2
  36. package/dist/handlers/branding-handler.js.map +1 -1
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/og/generator.d.ts.map +1 -1
  42. package/dist/og/generator.js +8 -2
  43. package/dist/og/generator.js.map +1 -1
  44. package/dist/og/index.d.ts +2 -0
  45. package/dist/og/index.d.ts.map +1 -1
  46. package/dist/og/index.js +1 -0
  47. package/dist/og/index.js.map +1 -1
  48. package/dist/og/node-config.d.ts +23 -0
  49. package/dist/og/node-config.d.ts.map +1 -0
  50. package/dist/og/node-config.js +22 -0
  51. package/dist/og/node-config.js.map +1 -0
  52. package/dist/og/types.d.ts +10 -5
  53. package/dist/og/types.d.ts.map +1 -1
  54. package/dist/og/types.js.map +1 -1
  55. package/dist/pages/admin/index.d.ts.map +1 -1
  56. package/dist/pages/admin/index.js +25 -41
  57. package/dist/pages/admin/index.js.map +1 -1
  58. package/dist/pages/admin/tab-access.d.ts +1 -1
  59. package/dist/pages/admin/tab-access.d.ts.map +1 -1
  60. package/dist/pages/admin/tab-access.js +5 -2
  61. package/dist/pages/admin/tab-access.js.map +1 -1
  62. package/dist/pages/admin/tab-appearance.d.ts +1 -1
  63. package/dist/pages/admin/tab-appearance.d.ts.map +1 -1
  64. package/dist/pages/admin/tab-appearance.js +4 -2
  65. package/dist/pages/admin/tab-appearance.js.map +1 -1
  66. package/dist/pages/admin/tab-branding.d.ts.map +1 -1
  67. package/dist/pages/admin/tab-branding.js +4 -2
  68. package/dist/pages/admin/tab-branding.js.map +1 -1
  69. package/dist/pages/admin/tab-profile-accounts.d.ts.map +1 -1
  70. package/dist/pages/admin/tab-profile-accounts.js +4 -2
  71. package/dist/pages/admin/tab-profile-accounts.js.map +1 -1
  72. package/dist/pages/admin/tab-settings.d.ts.map +1 -1
  73. package/dist/pages/admin/tab-settings.js +4 -2
  74. package/dist/pages/admin/tab-settings.js.map +1 -1
  75. package/dist/pages/admin-instances-page.d.ts.map +1 -1
  76. package/dist/pages/admin-instances-page.js +4 -6
  77. package/dist/pages/admin-instances-page.js.map +1 -1
  78. package/dist/pages/error-page.d.ts.map +1 -1
  79. package/dist/pages/error-page.js +3 -2
  80. package/dist/pages/error-page.js.map +1 -1
  81. package/dist/pages/gen-access-key-page.d.ts.map +1 -1
  82. package/dist/pages/gen-access-key-page.js +3 -4
  83. package/dist/pages/gen-access-key-page.js.map +1 -1
  84. package/dist/pages/homepage.d.ts.map +1 -1
  85. package/dist/pages/homepage.js +4 -3
  86. package/dist/pages/homepage.js.map +1 -1
  87. package/dist/pages/invite-page.d.ts.map +1 -1
  88. package/dist/pages/invite-page.js +4 -4
  89. package/dist/pages/invite-page.js.map +1 -1
  90. package/dist/pages/login-page.d.ts.map +1 -1
  91. package/dist/pages/login-page.js +3 -4
  92. package/dist/pages/login-page.js.map +1 -1
  93. package/package.json +6 -4
  94. package/dist/identity/csrf.d.ts +0 -17
  95. package/dist/identity/csrf.d.ts.map +0 -1
  96. package/dist/identity/csrf.js +0 -56
  97. package/dist/identity/csrf.js.map +0 -1
@@ -0,0 +1,720 @@
1
+ "use strict";var __LoginBundle=(()=>{var ie=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var Ae=Object.prototype.hasOwnProperty;var Ie=(o,e)=>{for(var r in e)ie(o,r,{get:e[r],enumerable:!0})},Re=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of De(e))!Ae.call(o,n)&&n!==r&&ie(o,n,{get:()=>e[n],enumerable:!(t=Te(e,n))||t.enumerable});return o};var Se=o=>Re(ie({},"__esModule",{value:!0}),o);var it={};Ie(it,{FetchHttpAdapter:()=>J,LoginPage:()=>ke,runPasskeyAuth:()=>oe});var F={CREATED:"created",SCANNED:"scanned",SUCCEED:"succeed",ERROR:"error",TIMEOUT:"timeout",BUSY:"busy",FORBIDDEN:"forbidden"};var O={API_PREFIX:"/api/did",SERVICE_PREFIX:"/.well-known/service",ACTION:"login",TOKEN_TIMEOUT:3e5,CHECK_INTERVAL:2e3,TOKEN_KEY:"_t_",TOKEN_DELIVERY:"cookie",CREATE_THROTTLE:500,AUTO_CHECK_INTERVAL:6e4};var re="did:abt:";function pe(o){if(!o||typeof o!="string")return!1;let e=o.replace(re,"");return/^(0x)?[0-9a-f]{40}$/i.test(e)}function fe(o,e=8,r=6){return!o||typeof o!="string"?"":o.length<=e+r+3?o:`${o.slice(0,e)}...${o.slice(-r)}`}function ae(o,e={}){if(!o||typeof o!="string")return{prefix:"DID: ABT:",chainLabel:"ABT",address:"",compact:"",copyText:""};let{startChars:r=8,endChars:t=6}=e,n=pe(o),a=o.replace(re,""),s=n?"ETH":"ABT",i=e.includePrefix??!n;return{prefix:`DID: ${s}:`,chainLabel:s,address:a,compact:fe(a,r,t),copyText:i?`${re}${a}`:a}}var L={TOKEN_EXPIRED:"TOKEN_EXPIRED",TOKEN_NOT_FOUND:"TOKEN_NOT_FOUND",TOKEN_TIMEOUT:"TOKEN_TIMEOUT",ALREADY_EXIST:"ALREADY_EXIST",ALREADY_BIND:"ALREADY_BIND",NETWORK_ERROR:"NETWORK_ERROR",INVALID_RESPONSE:"INVALID_RESPONSE",UNAUTHORIZED:"UNAUTHORIZED",FORBIDDEN:"FORBIDDEN"},B=class extends Error{code;constructor(e,r){super(r),this.name="ConnectError",this.code=e}};var J=class{_defaultHeaders;_onRequest;constructor(e){this._defaultHeaders=e?.headers??{},this._onRequest=e?.onRequest}async get(e,r){this._validateUrl(e);let t=r?.params?this._serializeParams(r.params):"",n=t?`${e}${e.includes("?")?"&":"?"}${t}`:e,s={method:"GET",headers:{...this._defaultHeaders,...r?.headers},signal:r?.signal};return this._onRequest&&(s=this._onRequest(n,s)),this._execute(n,s)}async post(e,r,t){this._validateUrl(e);let n=t?.params?this._serializeParams(t.params):"",a=n?`${e}${e.includes("?")?"&":"?"}${n}`:e,i={method:"POST",headers:{"Content-Type":"application/json",...this._defaultHeaders,...t?.headers},body:r!==void 0?JSON.stringify(r):void 0,signal:t?.signal};return this._onRequest&&(i=this._onRequest(a,i)),this._execute(a,i)}_validateUrl(e){if(!e?.trim())throw new B(L.NETWORK_ERROR,"Request URL must not be empty");if(e.trim().toLowerCase().startsWith("javascript:"))throw new B(L.NETWORK_ERROR,"Invalid URL protocol")}async _execute(e,r){let t;try{t=await globalThis.fetch(e,r)}catch(s){throw s?.name==="AbortError"?s:new B(L.NETWORK_ERROR,`Network request failed: ${s?.message??"Unknown error"}`)}if(!t.ok){let s="",i="";try{let m=await t.text();try{let y=JSON.parse(m);y.error&&(s=y.error),y.code&&(i=y.code)}catch{s=m}}catch{}let d=i==="FORBIDDEN"?L.FORBIDDEN:L.NETWORK_ERROR;throw new B(d,s||`HTTP ${t.status} ${t.statusText||"Error"}`)}if(t.status===204)return null;let n=await t.text();if(!n.trim())return null;let a=t.headers.get("content-type")??"";if(!a.includes("application/json")&&!a.includes("+json"))throw new B(L.INVALID_RESPONSE,`Expected JSON response but received: ${a||"unknown content type"}`);try{return JSON.parse(n)}catch{throw new B(L.INVALID_RESPONSE,"Failed to parse JSON response")}}_serializeParams(e){let r=[];for(let t of Object.keys(e)){let n=e[t];if(n!=null)if(Array.isArray(n))for(let a of n)a!=null&&r.push(`${encodeURIComponent(t)}=${encodeURIComponent(String(a))}`);else typeof n=="boolean"?r.push(`${encodeURIComponent(t)}=${n?"true":"false"}`):r.push(`${encodeURIComponent(t)}=${encodeURIComponent(String(n))}`)}return r.join("&")}};function X(o){let e=o.apiPrefix??O.API_PREFIX,r=o.action??O.ACTION,t=e.replace(/\/+$/,""),n=r.replace(/^\/+/,"");return`${t}/${n}`}function me(){return{token:null,url:null,status:null,error:null,appInfo:null,memberAppInfo:null,loading:!1}}var Z=class{_state;_config;_http;_pollTimer=null;_checkCount=0;_maxCheckCount;_realtimeUnsub=null;_realtime;_storage;_lastCreateTime=0;_listeners=new Map;_destroyed=!1;constructor(e,r,t){this._config=this._fillDefaults(e),this._http=r,this._realtime=t?.realtime,this._storage=t?.storage,this._state=me(),this._config.checkInterval<=0?this._maxCheckCount=1/0:this._maxCheckCount=Math.ceil(this._config.tokenTimeout/this._config.checkInterval)}get state(){return Object.freeze({...this._state})}async create(e){if(Date.now()-this._lastCreateTime<O.CREATE_THROTTLE)return this.state;(this._pollTimer!==null||this._realtimeUnsub!==null)&&this.stopPolling(),this._state.loading=!0,this._emit("statusChange",this.state);let r=`${X(this._config)}/token`,t={};e?(e.locale!=null&&(t.locale=e.locale),e.provider!=null?t.provider=e.provider:t.provider="wallet",e.encKey!=null&&(t.__encKey=e.encKey),e.autoConnect!=null&&(t.autoConnect=e.autoConnect),e.visitorId!=null&&(t.visitorId=e.visitorId),e.sourceToken!=null&&(t.sourceToken=e.sourceToken),e.forceConnected!=null&&(t.forceConnected=e.forceConnected),e.connectUrl!=null&&(t.connectUrl=e.connectUrl),e.extraParams&&Object.assign(t,e.extraParams)):t.provider="wallet";try{let n=await this._http.get(r,{params:t});return this._state.token=n.token??null,this._state.url=n.url??null,this._state.status=F.CREATED,this._state.appInfo=n.appInfo??null,this._state.memberAppInfo=n.memberAppInfo??null,this._state.loading=!1,this._state.error=null,this._state.successResult=void 0,this._state.connectedDid=void 0,this._state.mfaCode=void 0,this._state.saveConnect=void 0,this._lastCreateTime=Date.now(),this._emit("statusChange",this.state),this.state}catch(n){throw this._state.loading=!1,this._state.error=n?.message??"Failed to create token",this._state.status=F.ERROR,this._emit("statusChange",this.state),this._emit("error",new B(L.NETWORK_ERROR,this._state.error)),n}}async checkStatus(){if(!this._state.token)throw new B(L.TOKEN_NOT_FOUND,"No token available. Call create() first.");let e=`${X(this._config)}/status`,r={[O.TOKEN_KEY]:this._state.token};this._config.appPid;try{let t=await this._http.get(e,{params:r}),n=t.status;return n&&(this._state.status=n),t.error!==void 0&&(this._state.error=t.error),t.connectedDid!==void 0&&(this._state.connectedDid=t.connectedDid),t.mfaCode!==void 0&&(this._state.mfaCode=t.mfaCode),t.saveConnect!==void 0&&(this._state.saveConnect=t.saveConnect),n===F.FORBIDDEN?(this._state.status=F.ERROR,this._state.error=t.error||"Access forbidden",this._emit("error",new B(L.UNAUTHORIZED,this._state.error)),this.stopPolling()):n===F.SUCCEED?(this._config.tokenDelivery==="response"&&(this._state.successResult=t),this._emit("succeed",this.state),this.stopPolling()):n===F.ERROR?(this._emit("error",new B(L.INVALID_RESPONSE,this._state.error||"Unknown error")),this.stopPolling()):n===F.TIMEOUT&&(this._emit("timeout",this.state),this.stopPolling()),this._emit("statusChange",this.state),this.state}catch(t){throw t}}async cancel(){if(!this._state.token)return;let e=`${X(this._config)}/timeout`,r={[O.TOKEN_KEY]:this._state.token};try{await this._http.get(e,{params:r})}catch{}this.stopPolling()}startPolling(){if(this._state.token){if(this._checkCount=0,this._realtime)try{let e=`relay:${this._config.appPid}:${this._state.token}`;this._realtimeUnsub=this._realtime.subscribe(e,r=>{this._handleRealtimeMessage(r)});return}catch{this._realtimeUnsub=null}this._config.checkInterval>0&&(this._pollTimer=setInterval(()=>{this._pollOnce()},this._config.checkInterval))}}stopPolling(){this._pollTimer!==null&&(clearInterval(this._pollTimer),this._pollTimer=null),this._realtimeUnsub&&(this._realtimeUnsub(),this._realtimeUnsub=null)}reset(){this.stopPolling(),this._state=me(),this._checkCount=0}destroy(){this._destroyed||(this.stopPolling(),this._state.token=null,this._state.successResult=void 0,this._listeners.clear(),this._destroyed=!0)}on(e,r){let t=this._listeners.get(e);return t||(t=new Set,this._listeners.set(e,t)),t.add(r),this}off(e,r){let t=this._listeners.get(e);return t&&(t.delete(r),t.size===0&&this._listeners.delete(e)),this}_emit(e,...r){let t=this._listeners.get(e);if(!(!t||t.size===0))for(let n of[...t])try{n(...r)}catch{}}_pollOnce(){if(this._checkCount++,this._checkCount>=this._maxCheckCount){this._handleTimeout();return}this.checkStatus().catch(()=>{})}_handleTimeout(){this.stopPolling(),this._state.status=F.TIMEOUT,this._emit("timeout",this.state),this._emit("statusChange",this.state)}_handleRealtimeMessage(e){if(!e||typeof e!="object")return;let r=e.status;r&&(this._state.status=r,e.error!==void 0&&(this._state.error=e.error),e.connectedDid!==void 0&&(this._state.connectedDid=e.connectedDid),e.mfaCode!==void 0&&(this._state.mfaCode=e.mfaCode),e.saveConnect!==void 0&&(this._state.saveConnect=e.saveConnect),r===F.FORBIDDEN?(this._state.status=F.ERROR,this._state.error=e.error||"Access forbidden",this._emit("error",new B(L.UNAUTHORIZED,this._state.error)),this.stopPolling()):r===F.SUCCEED?(this._config.tokenDelivery==="response"&&(this._state.successResult=e),this._emit("succeed",this.state),this.stopPolling()):r===F.ERROR?(this._emit("error",new B(L.INVALID_RESPONSE,this._state.error||"Unknown error")),this.stopPolling()):r===F.TIMEOUT&&(this._emit("timeout",this.state),this.stopPolling()),this._emit("statusChange",this.state))}_fillDefaults(e){return{appPid:e.appPid,appName:e.appName,appDescription:e.appDescription??"",appIcon:e.appIcon??"",appUrl:e.appUrl??"",apiPrefix:e.apiPrefix??O.API_PREFIX,action:e.action??O.ACTION,servicePrefix:e.servicePrefix??O.SERVICE_PREFIX,tokenTimeout:e.tokenTimeout??O.TOKEN_TIMEOUT,checkInterval:e.checkInterval??O.CHECK_INTERVAL,tokenDelivery:e.tokenDelivery??O.TOKEN_DELIVERY}}};var C={bg:{root:"#0a0a0b",surface:"#141416",card:"#1c1c20",elevated:"#232328",hover:"#2b2b34",active:"#33333e",input:"rgba(255,255,255,0.06)"},border:{default:"rgba(255,255,255,0.10)",subtle:"rgba(255,255,255,0.06)",strong:"rgba(255,255,255,0.15)",focus:"rgba(255,255,255,0.25)"},text:{primary:"#f5f5f7",secondary:"#9394a1",tertiary:"#767684",placeholder:"#5e5f6e",white:"#ffffff"},color:{blue:"#6c47ff",blueHover:"#5f15fe",blueLight:"rgba(108,71,255,0.15)",blueMuted:"#9280ff",red:"#e02e2e",redLight:"rgba(224,46,46,0.15)",redText:"#f98a8a",green:"#15892b",greenLight:"rgba(21,137,43,0.15)",greenText:"#49dc6e",yellow:"#fd7224",yellowLight:"rgba(253,114,36,0.15)",yellowText:"#fd9357",info:"#236dd7",infoLight:"rgba(35,109,215,0.15)",infoText:"#73acfa"},radius:{xs:"4px",sm:"6px",md:"8px",lg:"12px",full:"9999px"},shadow:{sm:"0 1px 3px rgba(0,0,0,0.3), 0 1px 2px -1px rgba(0,0,0,0.2)",md:"0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3)",lg:"0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4)",focus:"0 0 0 1px rgba(255,255,255,0.12), 0 0 0 3px rgba(108,71,255,0.3)"},font:{family:"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",mono:"'JetBrains Mono', 'SF Mono', monospace",sizeBase:"14px",lineHeight:"1.43"}},P={bg:{root:"#f8f9fa",surface:"#ffffff",card:"#ffffff",elevated:"#f0f1f3",hover:"#e9eaec",active:"#dddee1",input:"rgba(0,0,0,0.04)"},border:{default:"rgba(0,0,0,0.10)",subtle:"rgba(0,0,0,0.06)",strong:"rgba(0,0,0,0.15)",focus:"rgba(0,0,0,0.25)"},text:{primary:"#1a1a1a",secondary:"#6b7280",tertiary:"#9ca3af",placeholder:"#c0c5ce",white:"#1a1a1a"},shadow:{sm:"0 1px 3px rgba(0,0,0,0.08), 0 1px 2px -1px rgba(0,0,0,0.06)",md:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.06)",lg:"0 10px 15px -3px rgba(0,0,0,0.12), 0 4px 6px -4px rgba(0,0,0,0.08)",focus:"0 0 0 1px rgba(0,0,0,0.08), 0 0 0 3px rgba(108,71,255,0.2)"}},Ne=`
2
+ :root {
3
+ /* Backgrounds \u2014 layered depth */
4
+ --bg-root: ${C.bg.root};
5
+ --bg-surface: ${C.bg.surface};
6
+ --bg-card: ${C.bg.card};
7
+ --bg-elevated: ${C.bg.elevated};
8
+ --bg-hover: ${C.bg.hover};
9
+ --bg-active: ${C.bg.active};
10
+ --bg-input: ${C.bg.input};
11
+
12
+ /* Borders \u2014 semi-transparent for adaptability */
13
+ --border: ${C.border.default};
14
+ --border-subtle:${C.border.subtle};
15
+ --border-strong:${C.border.strong};
16
+ --border-focus: ${C.border.focus};
17
+
18
+ /* Text hierarchy */
19
+ --text: ${C.text.primary};
20
+ --text-secondary:${C.text.secondary};
21
+ --text-tertiary:${C.text.tertiary};
22
+ --text-placeholder:${C.text.placeholder};
23
+ --text-white: ${C.text.white};
24
+
25
+ /* Accents */
26
+ --blue: ${C.color.blue};
27
+ --blue-hover: ${C.color.blueHover};
28
+ --blue-light: ${C.color.blueLight};
29
+ --blue-muted: ${C.color.blueMuted};
30
+ --red: ${C.color.red};
31
+ --red-light: ${C.color.redLight};
32
+ --red-text: ${C.color.redText};
33
+ --green: ${C.color.green};
34
+ --green-light: ${C.color.greenLight};
35
+ --green-text: ${C.color.greenText};
36
+ --yellow: ${C.color.yellow};
37
+ --yellow-light: ${C.color.yellowLight};
38
+ --yellow-text: ${C.color.yellowText};
39
+ --info: ${C.color.info};
40
+ --info-light: ${C.color.infoLight};
41
+ --info-text: ${C.color.infoText};
42
+
43
+ /* Radii */
44
+ --radius-xs: ${C.radius.xs};
45
+ --radius-sm: ${C.radius.sm};
46
+ --radius: ${C.radius.md};
47
+ --radius-lg: ${C.radius.lg};
48
+ --radius-full: ${C.radius.full};
49
+
50
+ /* Shadows */
51
+ --shadow-sm: ${C.shadow.sm};
52
+ --shadow-md: ${C.shadow.md};
53
+ --shadow-lg: ${C.shadow.lg};
54
+ --shadow-focus: ${C.shadow.focus};
55
+ }
56
+ `,Be=`
57
+ [data-theme="light"] {
58
+ --bg-root: ${P.bg.root};
59
+ --bg-surface: ${P.bg.surface};
60
+ --bg-card: ${P.bg.card};
61
+ --bg-elevated: ${P.bg.elevated};
62
+ --bg-hover: ${P.bg.hover};
63
+ --bg-active: ${P.bg.active};
64
+ --bg-input: ${P.bg.input};
65
+
66
+ --border: ${P.border.default};
67
+ --border-subtle:${P.border.subtle};
68
+ --border-strong:${P.border.strong};
69
+ --border-focus: ${P.border.focus};
70
+
71
+ --text: ${P.text.primary};
72
+ --text-secondary:${P.text.secondary};
73
+ --text-tertiary:${P.text.tertiary};
74
+ --text-placeholder:${P.text.placeholder};
75
+ --text-white: ${P.text.white};
76
+
77
+ --shadow-sm: ${P.shadow.sm};
78
+ --shadow-md: ${P.shadow.md};
79
+ --shadow-lg: ${P.shadow.lg};
80
+ --shadow-focus: ${P.shadow.focus};
81
+ }
82
+ `,Le=`
83
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
84
+ html { color-scheme: dark; }
85
+ html[data-theme="light"] { color-scheme: light; }
86
+ body {
87
+ font-family: ${C.font.family};
88
+ background: var(--bg-root);
89
+ color: var(--text);
90
+ -webkit-font-smoothing: antialiased;
91
+ -moz-osx-font-smoothing: grayscale;
92
+ font-size: ${C.font.sizeBase};
93
+ line-height: ${C.font.lineHeight};
94
+ }
95
+ a { color: var(--blue-muted); text-decoration: none; }
96
+ a:hover { text-decoration: underline; }
97
+ .hidden { display: none; }
98
+ `,Pe=typeof HTMLElement<"u"?HTMLElement:class{},ye='<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/></svg>',Oe='<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>',$e=`
99
+ :host {
100
+ display: inline-flex;
101
+ align-items: center;
102
+ max-width: 100%;
103
+ overflow: hidden;
104
+ font-family: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
105
+ line-height: 1.5;
106
+ }
107
+ :host([block]) { display: flex; }
108
+ .prefix {
109
+ flex-shrink: 0;
110
+ opacity: 0.6;
111
+ margin-right: 4px;
112
+ white-space: nowrap;
113
+ }
114
+ .address {
115
+ white-space: nowrap;
116
+ overflow: hidden;
117
+ text-overflow: ellipsis;
118
+ color: var(--did-text-color, currentColor);
119
+ }
120
+ .address-compact {
121
+ white-space: nowrap;
122
+ color: var(--did-text-color, currentColor);
123
+ cursor: default;
124
+ }
125
+ .clickable { cursor: pointer; }
126
+ .clickable:hover { opacity: 0.8; }
127
+ .copy-btn {
128
+ flex-shrink: 0;
129
+ display: inline-flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ width: 1em;
133
+ height: 1em;
134
+ margin-left: 6px;
135
+ padding: 0;
136
+ border: none;
137
+ background: none;
138
+ color: inherit;
139
+ opacity: 0.5;
140
+ cursor: pointer;
141
+ transition: opacity 0.15s;
142
+ }
143
+ .copy-btn:hover { opacity: 1; }
144
+ .copy-btn.copied { opacity: 1; color: var(--did-copy-success-color, #22c55e); }
145
+ `,Me=class extends Pe{static observedAttributes=["did","compact","copyable","start-chars","end-chars","show-prefix","no-tooltip","no-copy","block","size"];shadow;copyTimer=null;constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}disconnectedCallback(){this.copyTimer&&clearTimeout(this.copyTimer)}get parts(){let o=Number(this.getAttribute("start-chars")),e=Number(this.getAttribute("end-chars"));return ae(this.getAttribute("did")||"",{startChars:o>0?o:void 0,endChars:e>0?e:void 0})}render(){if(!(this.getAttribute("did")||"")){this.shadow.innerHTML="";return}let e=this.parts,r=this.hasAttribute("compact"),t=!this.hasAttribute("no-copy")&&this.getAttribute("copyable")!=="false",n=this.hasAttribute("show-prefix"),a=this.hasAttribute("no-tooltip"),s=Number(this.getAttribute("size"))||0,i=s>=12?`${s}px`:"inherit",d=r?e.compact:e.address,m=!a&&r?` title="${e.address}"`:"",y=n?`<span class="prefix">${e.prefix} </span>`:"",p=r?"address-compact":"address",l=t?" clickable":"",b=t?`<button class="copy-btn" aria-label="Copy DID">${ye}</button>`:"";if(this.shadow.innerHTML=`
146
+ <style>${$e}:host { font-size: ${i}; }</style>
147
+ ${y}<span class="${p}${l}"${m}>${d}</span>${b}
148
+ `,t){let T=this.shadow.querySelector(`.${p}`);T&&T.addEventListener("click",x=>{x.stopPropagation(),this.copyToClipboard(e.copyText)});let _=this.shadow.querySelector(".copy-btn");_&&_.addEventListener("click",x=>{x.stopPropagation(),this.copyToClipboard(e.copyText)})}}copyToClipboard(o){navigator.clipboard?.writeText?navigator.clipboard.writeText(o).catch(()=>this.fallbackCopy(o)):this.fallbackCopy(o),this.showCopied()}fallbackCopy(o){try{let e=document.createElement("input");e.value=o,document.body.appendChild(e),e.select(),document.execCommand?.("copy"),e.remove()}catch{}}showCopied(){let o=this.shadow.querySelector(".copy-btn");o&&(o.classList.add("copied"),o.innerHTML=Oe,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{o.classList.remove("copied"),o.innerHTML=ye},1500))}};typeof customElements<"u"&&!customElements.get("did-address")&&customElements.define("did-address",Me);var be={en:{signIn:"Sign in",signInTo:"Sign in to {appName}",subtitle:"Sign in to continue",passkeyButton:"Continue with Passkey",passkeySignIn:"Sign in with Passkey",passkeyCreate:"Create Passkey",passkeyFirstTime:"First time? Create a passkey",passkeyBackToSignIn:"Back to sign in",passkeyWaiting:"Waiting for passkey\u2026",passkeyCreating:"Creating your passkey\u2026",passkeyNoLocal:"No passkey found on this device.",passkeyUseAnotherDevice:"Use another device",passkeyCreateInstead:"Create a new passkey instead",didWalletButton:"Continue with DID Wallet",didWalletButtonShort:"DID Wallet",scanWithWallet:"Scan with your DID Wallet",waitingWallet:"Requesting connection",walletContinue:"Please continue in DID Wallet",noPasskey:"No existing passkey found. Enter a name and create one.",success:"Success!",timeout:"Session timed out. Try again.",refreshQR:"Refresh",namePlaceholder:"Your name (optional)",or:"or",emailPlaceholder:"Email address",emailButton:"Email",passkeyUnsupported:"Your browser does not support Passkey authentication.",connecting:"Connecting...",verifying:"Verifying...",openInWallet:"Open in DID Wallet",authFailed:"Authentication failed",accessDenied:"Access denied: your account is not permitted to log in to this site.",regClosed:"Registration requires an invitation.",federatedBy:"Authentication provided by {masterName}",securedBy:"Secured by DID Connect",privacy:"Privacy",terms:"Terms",back:"Back",cancel:"Cancel",scanTitle:"Scan with DID Wallet",emailTitle:"Continue with Email",emailSubmit:"Send Code",emailSending:"Sending code...",emailSent:"We sent a 6-digit code to {email}",emailCodePlaceholder:"6-digit code",emailVerify:"Verify",emailResend:"Resend code",emailInvalid:"Please enter a valid email address.",emailCodeInvalid:"Please enter the 6-digit code."},zh:{signIn:"\u767B\u5F55",signInTo:"\u767B\u5F55\u5230 {appName}",subtitle:"\u767B\u5F55\u4EE5\u7EE7\u7EED",passkeyButton:"\u4F7F\u7528 Passkey \u7EE7\u7EED",passkeySignIn:"\u4F7F\u7528 Passkey \u767B\u5F55",passkeyCreate:"\u521B\u5EFA Passkey",passkeyFirstTime:"\u7B2C\u4E00\u6B21\u4F7F\u7528\uFF1F\u521B\u5EFA Passkey",passkeyBackToSignIn:"\u8FD4\u56DE\u767B\u5F55",passkeyWaiting:"\u6B63\u5728\u7B49\u5F85 Passkey\u2026",passkeyCreating:"\u6B63\u5728\u521B\u5EFA Passkey\u2026",passkeyNoLocal:"\u6B64\u8BBE\u5907\u4E0A\u6CA1\u6709\u627E\u5230 Passkey\u3002",passkeyUseAnotherDevice:"\u7528\u5176\u4ED6\u8BBE\u5907\u767B\u5F55",passkeyCreateInstead:"\u6539\u4E3A\u521B\u5EFA\u65B0\u7684 Passkey",didWalletButton:"\u4F7F\u7528 DID \u94B1\u5305\u7EE7\u7EED",didWalletButtonShort:"DID \u94B1\u5305",scanWithWallet:"\u8BF7\u4F7F\u7528 DID \u94B1\u5305\u626B\u7801",waitingWallet:"\u6B63\u5728\u8BF7\u6C42\u8FDE\u63A5",walletContinue:"\u8BF7\u5728 DID Wallet \u4E2D\u7EE7\u7EED\u5B8C\u6210\u60A8\u7684\u64CD\u4F5C",noPasskey:"\u672A\u627E\u5230\u5DF2\u6709 Passkey\u3002\u8F93\u5165\u540D\u79F0\u5E76\u521B\u5EFA\u4E00\u4E2A\u3002",success:"\u6210\u529F",timeout:"\u4F1A\u8BDD\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002",refreshQR:"\u5237\u65B0",namePlaceholder:"\u4F60\u7684\u540D\u5B57\uFF08\u53EF\u9009\uFF09",or:"\u6216",emailPlaceholder:"\u90AE\u7BB1\u5730\u5740",emailButton:"\u90AE\u7BB1",passkeyUnsupported:"\u4F60\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Passkey \u8BA4\u8BC1\u3002",connecting:"\u8FDE\u63A5\u4E2D...",verifying:"\u9A8C\u8BC1\u4E2D...",openInWallet:"\u5728 DID \u94B1\u5305\u4E2D\u6253\u5F00",authFailed:"\u8BA4\u8BC1\u5931\u8D25",accessDenied:"\u8BBF\u95EE\u88AB\u62D2\u7EDD\uFF1A\u4F60\u7684\u8D26\u6237\u65E0\u6743\u767B\u5F55\u6B64\u7AD9\u70B9\u3002",regClosed:"\u6CE8\u518C\u9700\u8981\u9080\u8BF7\u3002",federatedBy:"\u8BA4\u8BC1\u670D\u52A1\u7531 {masterName} \u63D0\u4F9B",securedBy:"\u7531 DID Connect \u63D0\u4F9B\u5B89\u5168\u4FDD\u969C",privacy:"\u9690\u79C1",terms:"\u6761\u6B3E",back:"\u8FD4\u56DE",cancel:"\u53D6\u6D88",scanTitle:"\u4F7F\u7528 DID \u94B1\u5305\u626B\u7801",emailTitle:"\u4F7F\u7528\u90AE\u7BB1\u7EE7\u7EED",emailSubmit:"\u53D1\u9001\u9A8C\u8BC1\u7801",emailSending:"\u6B63\u5728\u53D1\u9001\u9A8C\u8BC1\u7801...",emailSent:"\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 {email}",emailCodePlaceholder:"6 \u4F4D\u9A8C\u8BC1\u7801",emailVerify:"\u9A8C\u8BC1",emailResend:"\u91CD\u65B0\u53D1\u9001",emailInvalid:"\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740\u3002",emailCodeInvalid:"\u8BF7\u8F93\u5165 6 \u4F4D\u9A8C\u8BC1\u7801\u3002"}},ce=[{code:"en",label:"English"},{code:"zh",label:"\u4E2D\u6587"}];function E(o,e,r){let t=e&&be[e]?e:"en",n=be[t][o]??o;if(r)for(let[a,s]of Object.entries(r))n=n.replace(new RegExp(`\\{${a}\\}`,"g"),s);return n}var le='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M3 20v-2.8q0-.85.438-1.562T4.6 14.55q1.55-.775 3.15-1.162T11 13q.5 0 1 .038t1 .112q-.1 1.45.525 2.738T15.35 18v2zm16 3l-1.5-1.5v-4.65q-1.1-.325-1.8-1.237T15 13.5q0-1.45 1.025-2.475T18.5 10t2.475 1.025T22 13.5q0 1.125-.638 2t-1.612 1.25L21 18l-1.5 1.5L21 21zm-8-11q-1.65 0-2.825-1.175T7 8t1.175-2.825T11 4t2.825 1.175T15 8t-1.175 2.825T11 12m7.5 2q.425 0 .713-.288T19.5 13t-.288-.712T18.5 12t-.712.288T17.5 13t.288.713t.712.287"/></svg>',we='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"><rect x="2" y="4" width="20" height="16" rx="3" fill="#4598FA"/><rect x="3" y="6" width="18" height="12" rx="2" fill="white" opacity="0.9"/><rect x="0" y="14" width="24" height="10" rx="0" fill="url(#dw_g)"/><path d="M5.5 9.5h4.5c.3 0 .5.2.5.5v2.5c0 .3-.2.5-.5.5H5.5c-.3 0-.5-.2-.5-.5V10c0-.3.2-.5.5-.5z" fill="#4598FA"/><defs><linearGradient id="dw_g" x1="12" y1="14" x2="12" y2="24" gradientUnits="userSpaceOnUse"><stop stop-color="#77B2F6"/><stop offset="1" stop-color="#4598FA"/></linearGradient></defs></svg>',Fe='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M22 7.535V17a3 3 0 0 1-2.824 2.995L19 20H5a3 3 0 0 1-2.995-2.824L2 17V7.535l9.445 6.297l.116.066a1 1 0 0 0 .878 0l.116-.066z"/><path fill="currentColor" d="M19 4c1.08 0 2.027.57 2.555 1.427L12 11.797l-9.555-6.37a2.999 2.999 0 0 1 2.354-1.42L5 4z"/></svg>',Ue='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12c5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z"/></svg>',xe='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M20 11H7.83l5.59-5.59L12 4l-8 8l8 8l1.41-1.41L7.83 13H20z"/></svg>',He={google:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 262"><path fill="#4285F4" d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"/><path fill="#34A853" d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"/><path fill="#FBBC05" d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z"/><path fill="#EB4335" d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"/></svg>',github:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 250" fill="currentColor"><path d="M128.001 0C57.317 0 0 57.307 0 128.001c0 56.554 36.676 104.535 87.535 121.46c6.397 1.185 8.746-2.777 8.746-6.158c0-3.052-.12-13.135-.174-23.83c-35.61 7.742-43.124-15.103-43.124-15.103c-5.823-14.795-14.213-18.73-14.213-18.73c-11.613-7.944.876-7.78.876-7.78c12.853.902 19.621 13.19 19.621 13.19c11.417 19.568 29.945 13.911 37.249 10.64c1.149-8.272 4.466-13.92 8.127-17.116c-28.431-3.236-58.318-14.212-58.318-63.258c0-13.975 5-25.394 13.188-34.358c-1.329-3.224-5.71-16.242 1.24-33.874c0 0 10.749-3.44 35.21 13.121c10.21-2.836 21.16-4.258 32.038-4.307c10.878.049 21.837 1.47 32.066 4.307c24.431-16.56 35.165-13.12 35.165-13.12c6.967 17.63 2.584 30.65 1.255 33.873c8.207 8.964 13.173 20.383 13.173 34.358c0 49.163-29.944 59.988-58.447 63.157c4.591 3.972 8.682 11.762 8.682 23.704c0 17.126-.148 30.91-.148 35.126c0 3.407 2.304 7.398 8.792 6.14C219.37 232.5 256 184.537 256 128.002C256 57.307 198.691 0 128.001 0"/></svg>',apple:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 315" fill="currentColor"><path d="M213.803 167.03c.442 47.58 41.74 63.413 42.197 63.615c-.35 1.116-6.599 22.563-21.757 44.716c-13.104 19.153-26.705 38.235-48.13 38.63c-21.05.388-27.82-12.483-51.888-12.483c-24.061 0-31.582 12.088-51.51 12.871c-20.68.783-36.428-20.71-49.64-39.793c-27-39.033-47.633-110.3-19.928-158.406c13.763-23.89 38.36-39.017 65.056-39.405c20.307-.388 39.475 13.675 51.889 13.675c12.406 0 35.699-16.895 60.186-14.414c10.25.427 39.026 4.14 57.503 31.186c-1.49.923-34.335 20.044-33.978 59.808M174.24 50.199c10.98-13.29 18.369-31.79 16.353-50.199c-15.826.636-34.962 10.546-46.314 23.828c-10.173 11.763-19.082 30.589-16.678 48.633c17.64 1.365 35.66-8.964 46.639-22.262"/></svg>',twitter:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 256" fill="currentColor"><path d="M149.079 108.399L242.33 0h-22.098l-80.97 94.12L74.59 0H0l97.796 142.328L0 256h22.1l85.507-99.395L175.905 256h74.59L149.073 108.399zM118.81 143.58l-9.909-14.172l-78.84-112.773h33.943l63.625 91.011l9.909 14.173l82.705 118.3H186.3l-67.49-96.533z"/></svg>',auth0:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 256"><path fill="#EB5424" d="M203.97 200.38L167.47 88l-39.5 112.38h75.98zm0-144.76L167.47 168l75.97-26.16l19.76-60.82c6.64-20.4-1.94-42.72-21.18-52.76l-38.06 27.36zM52.03 55.62L88.54 168l39.5-112.38H52.02zM52.03 200.38L88.54 88L12.56 114.16l-5.92 18.2c-6.64 20.4 1.94 42.72 21.18 52.76l24.2-17.38l.01.01v-.01l-.01.01.01-.37z"/></svg>',facebook:'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 256"><path fill="#1877F2" d="M256 128C256 57.308 198.692 0 128 0S0 57.308 0 128c0 63.888 46.808 116.843 108 126.445V165H75.5v-37H108V99.8c0-32.08 19.11-49.8 48.348-49.8C170.352 50 185 52.5 185 52.5V84h-16.14C152.959 84 148 93.867 148 103.99V128h35.5l-5.675 37H148v89.445c61.192-9.602 108-62.556 108-126.445"/></svg>'},Ke='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2m-1 17.93c-3.95-.49-7-3.85-7-7.93c0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41c0 2.08-.8 3.97-2.1 5.39"/></svg>';function Ve(o){return He[o.toLowerCase()]??""}var Q=function(o,e){let n=o,a=te[e],s=null,i=0,d=null,m=[],y={},p=function(u,g){i=n*4+17,s=(function(c){let f=new Array(c);for(let h=0;h<c;h+=1){f[h]=new Array(c);for(let w=0;w<c;w+=1)f[h][w]=null}return f})(i),l(0,0),l(i-7,0),l(0,i-7),_(),T(),A(u,g),n>=7&&x(u),d==null&&(d=U(n,a,m)),D(d,g)},l=function(u,g){for(let c=-1;c<=7;c+=1)if(!(u+c<=-1||i<=u+c))for(let f=-1;f<=7;f+=1)g+f<=-1||i<=g+f||(0<=c&&c<=6&&(f==0||f==6)||0<=f&&f<=6&&(c==0||c==6)||2<=c&&c<=4&&2<=f&&f<=4?s[u+c][g+f]=!0:s[u+c][g+f]=!1)},b=function(){let u=0,g=0;for(let c=0;c<8;c+=1){p(!0,c);let f=q.getLostPoint(y);(c==0||u>f)&&(u=f,g=c)}return g},T=function(){for(let u=8;u<i-8;u+=1)s[u][6]==null&&(s[u][6]=u%2==0);for(let u=8;u<i-8;u+=1)s[6][u]==null&&(s[6][u]=u%2==0)},_=function(){let u=q.getPatternPosition(n);for(let g=0;g<u.length;g+=1)for(let c=0;c<u.length;c+=1){let f=u[g],h=u[c];if(s[f][h]==null)for(let w=-2;w<=2;w+=1)for(let v=-2;v<=2;v+=1)w==-2||w==2||v==-2||v==2||w==0&&v==0?s[f+w][h+v]=!0:s[f+w][h+v]=!1}},x=function(u){let g=q.getBCHTypeNumber(n);for(let c=0;c<18;c+=1){let f=!u&&(g>>c&1)==1;s[Math.floor(c/3)][c%3+i-8-3]=f}for(let c=0;c<18;c+=1){let f=!u&&(g>>c&1)==1;s[c%3+i-8-3][Math.floor(c/3)]=f}},A=function(u,g){let c=a<<3|g,f=q.getBCHTypeInfo(c);for(let h=0;h<15;h+=1){let w=!u&&(f>>h&1)==1;h<6?s[h][8]=w:h<8?s[h+1][8]=w:s[i-15+h][8]=w}for(let h=0;h<15;h+=1){let w=!u&&(f>>h&1)==1;h<8?s[8][i-h-1]=w:h<9?s[8][15-h-1+1]=w:s[8][15-h-1]=w}s[i-8][8]=!u},D=function(u,g){let c=-1,f=i-1,h=7,w=0,v=q.getMaskFunction(g);for(let I=i-1;I>0;I-=2)for(I==6&&(I-=1);;){for(let R=0;R<2;R+=1)if(s[f][I-R]==null){let N=!1;w<u.length&&(N=(u[w]>>>h&1)==1),v(f,I-R)&&(N=!N),s[f][I-R]=N,h-=1,h==-1&&(w+=1,h=7)}if(f+=c,f<0||i<=f){f-=c,c=-c;break}}},$=function(u,g){let c=0,f=0,h=0,w=new Array(g.length),v=new Array(g.length);for(let k=0;k<g.length;k+=1){let S=g[k].dataCount,H=g[k].totalCount-S;f=Math.max(f,S),h=Math.max(h,H),w[k]=new Array(S);for(let W=0;W<w[k].length;W+=1)w[k][W]=255&u.getBuffer()[W+c];c+=S;let se=q.getErrorCorrectPolynomial(H),de=ne(w[k],se.getLength()-1).mod(se);v[k]=new Array(se.getLength()-1);for(let W=0;W<v[k].length;W+=1){let he=W+de.getLength()-v[k].length;v[k][W]=he>=0?de.getAt(he):0}}let I=0;for(let k=0;k<g.length;k+=1)I+=g[k].totalCount;let R=new Array(I),N=0;for(let k=0;k<f;k+=1)for(let S=0;S<g.length;S+=1)k<w[S].length&&(R[N]=w[S][k],N+=1);for(let k=0;k<h;k+=1)for(let S=0;S<g.length;S+=1)k<v[S].length&&(R[N]=v[S][k],N+=1);return R},U=function(u,g,c){let f=Ee.getRSBlocks(u,g),h=ve();for(let v=0;v<c.length;v+=1){let I=c[v];h.put(I.getMode(),4),h.put(I.getLength(),q.getLengthInBits(I.getMode(),u)),I.write(h)}let w=0;for(let v=0;v<f.length;v+=1)w+=f[v].dataCount;if(h.getLengthInBits()>w*8)throw"code length overflow. ("+h.getLengthInBits()+">"+w*8+")";for(h.getLengthInBits()+4<=w*8&&h.put(0,4);h.getLengthInBits()%8!=0;)h.putBit(!1);for(;!(h.getLengthInBits()>=w*8||(h.put(236,8),h.getLengthInBits()>=w*8));)h.put(17,8);return $(h,f)};y.addData=function(u,g){g=g||"Byte";let c=null;switch(g){case"Numeric":c=We(u);break;case"Alphanumeric":c=je(u);break;case"Byte":c=qe(u);break;case"Kanji":c=ze(u);break;default:throw"mode:"+g}m.push(c),d=null},y.isDark=function(u,g){if(u<0||i<=u||g<0||i<=g)throw u+","+g;return s[u][g]},y.getModuleCount=function(){return i},y.make=function(){if(n<1){let u=1;for(;u<40;u++){let g=Ee.getRSBlocks(u,a),c=ve();for(let h=0;h<m.length;h++){let w=m[h];c.put(w.getMode(),4),c.put(w.getLength(),q.getLengthInBits(w.getMode(),u)),w.write(c)}let f=0;for(let h=0;h<g.length;h++)f+=g[h].dataCount;if(c.getLengthInBits()<=f*8)break}n=u}p(!1,b())},y.createTableTag=function(u,g){u=u||2,g=typeof g>"u"?u*4:g;let c="";c+='<table style="',c+=" border-width: 0px; border-style: none;",c+=" border-collapse: collapse;",c+=" padding: 0px; margin: "+g+"px;",c+='">',c+="<tbody>";for(let f=0;f<y.getModuleCount();f+=1){c+="<tr>";for(let h=0;h<y.getModuleCount();h+=1)c+='<td style="',c+=" border-width: 0px; border-style: none;",c+=" border-collapse: collapse;",c+=" padding: 0px; margin: 0px;",c+=" width: "+u+"px;",c+=" height: "+u+"px;",c+=" background-color: ",c+=y.isDark(f,h)?"#000000":"#ffffff",c+=";",c+='"/>';c+="</tr>"}return c+="</tbody>",c+="</table>",c},y.createSvgTag=function(u,g,c,f){let h={};typeof arguments[0]=="object"&&(h=arguments[0],u=h.cellSize,g=h.margin,c=h.alt,f=h.title),u=u||2,g=typeof g>"u"?u*4:g,c=typeof c=="string"?{text:c}:c||{},c.text=c.text||null,c.id=c.text?c.id||"qrcode-description":null,f=typeof f=="string"?{text:f}:f||{},f.text=f.text||null,f.id=f.text?f.id||"qrcode-title":null;let w=y.getModuleCount()*u+g*2,v,I,R,N,k="",S;for(S="l"+u+",0 0,"+u+" -"+u+",0 0,-"+u+"z ",k+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',k+=h.scalable?"":' width="'+w+'px" height="'+w+'px"',k+=' viewBox="0 0 '+w+" "+w+'" ',k+=' preserveAspectRatio="xMinYMin meet"',k+=f.text||c.text?' role="img" aria-labelledby="'+V([f.id,c.id].join(" ").trim())+'"':"",k+=">",k+=f.text?'<title id="'+V(f.id)+'">'+V(f.text)+"</title>":"",k+=c.text?'<description id="'+V(c.id)+'">'+V(c.text)+"</description>":"",k+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',k+='<path d="',R=0;R<y.getModuleCount();R+=1)for(N=R*u+g,v=0;v<y.getModuleCount();v+=1)y.isDark(R,v)&&(I=v*u+g,k+="M"+I+","+N+S);return k+='" stroke="transparent" fill="black"/>',k+="</svg>",k},y.createDataURL=function(u,g){u=u||2,g=typeof g>"u"?u*4:g;let c=y.getModuleCount()*u+g*2,f=g,h=c-g;return Je(c,c,function(w,v){if(f<=w&&w<h&&f<=v&&v<h){let I=Math.floor((w-f)/u),R=Math.floor((v-f)/u);return y.isDark(R,I)?0:1}else return 1})},y.createImgTag=function(u,g,c){u=u||2,g=typeof g>"u"?u*4:g;let f=y.getModuleCount()*u+g*2,h="";return h+="<img",h+=' src="',h+=y.createDataURL(u,g),h+='"',h+=' width="',h+=f,h+='"',h+=' height="',h+=f,h+='"',c&&(h+=' alt="',h+=V(c),h+='"'),h+="/>",h};let V=function(u){let g="";for(let c=0;c<u.length;c+=1){let f=u.charAt(c);switch(f){case"<":g+="&lt;";break;case">":g+="&gt;";break;case"&":g+="&amp;";break;case'"':g+="&quot;";break;default:g+=f;break}}return g},Ce=function(u){u=typeof u>"u"?2:u;let c=y.getModuleCount()*1+u*2,f=u,h=c-u,w,v,I,R,N,k={"\u2588\u2588":"\u2588","\u2588 ":"\u2580"," \u2588":"\u2584"," ":" "},S={"\u2588\u2588":"\u2580","\u2588 ":"\u2580"," \u2588":" "," ":" "},H="";for(w=0;w<c;w+=2){for(I=Math.floor((w-f)/1),R=Math.floor((w+1-f)/1),v=0;v<c;v+=1)N="\u2588",f<=v&&v<h&&f<=w&&w<h&&y.isDark(I,Math.floor((v-f)/1))&&(N=" "),f<=v&&v<h&&f<=w+1&&w+1<h&&y.isDark(R,Math.floor((v-f)/1))?N+=" ":N+="\u2588",H+=u<1&&w+1>=h?S[N]:k[N];H+=`
149
+ `}return c%2&&u>0?H.substring(0,H.length-c-1)+Array(c+1).join("\u2580"):H.substring(0,H.length-1)};return y.createASCII=function(u,g){if(u=u||1,u<2)return Ce(g);u-=1,g=typeof g>"u"?u*2:g;let c=y.getModuleCount()*u+g*2,f=g,h=c-g,w,v,I,R,N=Array(u+1).join("\u2588\u2588"),k=Array(u+1).join(" "),S="",H="";for(w=0;w<c;w+=1){for(I=Math.floor((w-f)/u),H="",v=0;v<c;v+=1)R=1,f<=v&&v<h&&f<=w&&w<h&&y.isDark(I,Math.floor((v-f)/u))&&(R=0),H+=R?N:k;for(I=0;I<u;I+=1)S+=H+`
150
+ `}return S.substring(0,S.length-1)},y.renderTo2dContext=function(u,g){g=g||2;let c=y.getModuleCount();for(let f=0;f<c;f++)for(let h=0;h<c;h++)u.fillStyle=y.isDark(f,h)?"black":"white",u.fillRect(h*g,f*g,g,g)},y};Q.stringToBytes=function(o){let e=[];for(let r=0;r<o.length;r+=1){let t=o.charCodeAt(r);e.push(t&255)}return e};Q.createStringToBytes=function(o,e){let r=(function(){let n=Ge(o),a=function(){let d=n.read();if(d==-1)throw"eof";return d},s=0,i={};for(;;){let d=n.read();if(d==-1)break;let m=a(),y=a(),p=a(),l=String.fromCharCode(d<<8|m),b=y<<8|p;i[l]=b,s+=1}if(s!=e)throw s+" != "+e;return i})(),t=63;return function(n){let a=[];for(let s=0;s<n.length;s+=1){let i=n.charCodeAt(s);if(i<128)a.push(i);else{let d=r[n.charAt(s)];typeof d=="number"?(d&255)==d?a.push(d):(a.push(d>>>8),a.push(d&255)):a.push(t)}}return a}};var M={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},te={L:1,M:0,Q:3,H:2},j={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},q=(function(){let o=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],e=1335,r=7973,t=21522,n={},a=function(s){let i=0;for(;s!=0;)i+=1,s>>>=1;return i};return n.getBCHTypeInfo=function(s){let i=s<<10;for(;a(i)-a(e)>=0;)i^=e<<a(i)-a(e);return(s<<10|i)^t},n.getBCHTypeNumber=function(s){let i=s<<12;for(;a(i)-a(r)>=0;)i^=r<<a(i)-a(r);return s<<12|i},n.getPatternPosition=function(s){return o[s-1]},n.getMaskFunction=function(s){switch(s){case j.PATTERN000:return function(i,d){return(i+d)%2==0};case j.PATTERN001:return function(i,d){return i%2==0};case j.PATTERN010:return function(i,d){return d%3==0};case j.PATTERN011:return function(i,d){return(i+d)%3==0};case j.PATTERN100:return function(i,d){return(Math.floor(i/2)+Math.floor(d/3))%2==0};case j.PATTERN101:return function(i,d){return i*d%2+i*d%3==0};case j.PATTERN110:return function(i,d){return(i*d%2+i*d%3)%2==0};case j.PATTERN111:return function(i,d){return(i*d%3+(i+d)%2)%2==0};default:throw"bad maskPattern:"+s}},n.getErrorCorrectPolynomial=function(s){let i=ne([1],0);for(let d=0;d<s;d+=1)i=i.multiply(ne([1,z.gexp(d)],0));return i},n.getLengthInBits=function(s,i){if(1<=i&&i<10)switch(s){case M.MODE_NUMBER:return 10;case M.MODE_ALPHA_NUM:return 9;case M.MODE_8BIT_BYTE:return 8;case M.MODE_KANJI:return 8;default:throw"mode:"+s}else if(i<27)switch(s){case M.MODE_NUMBER:return 12;case M.MODE_ALPHA_NUM:return 11;case M.MODE_8BIT_BYTE:return 16;case M.MODE_KANJI:return 10;default:throw"mode:"+s}else if(i<41)switch(s){case M.MODE_NUMBER:return 14;case M.MODE_ALPHA_NUM:return 13;case M.MODE_8BIT_BYTE:return 16;case M.MODE_KANJI:return 12;default:throw"mode:"+s}else throw"type:"+i},n.getLostPoint=function(s){let i=s.getModuleCount(),d=0;for(let p=0;p<i;p+=1)for(let l=0;l<i;l+=1){let b=0,T=s.isDark(p,l);for(let _=-1;_<=1;_+=1)if(!(p+_<0||i<=p+_))for(let x=-1;x<=1;x+=1)l+x<0||i<=l+x||_==0&&x==0||T==s.isDark(p+_,l+x)&&(b+=1);b>5&&(d+=3+b-5)}for(let p=0;p<i-1;p+=1)for(let l=0;l<i-1;l+=1){let b=0;s.isDark(p,l)&&(b+=1),s.isDark(p+1,l)&&(b+=1),s.isDark(p,l+1)&&(b+=1),s.isDark(p+1,l+1)&&(b+=1),(b==0||b==4)&&(d+=3)}for(let p=0;p<i;p+=1)for(let l=0;l<i-6;l+=1)s.isDark(p,l)&&!s.isDark(p,l+1)&&s.isDark(p,l+2)&&s.isDark(p,l+3)&&s.isDark(p,l+4)&&!s.isDark(p,l+5)&&s.isDark(p,l+6)&&(d+=40);for(let p=0;p<i;p+=1)for(let l=0;l<i-6;l+=1)s.isDark(l,p)&&!s.isDark(l+1,p)&&s.isDark(l+2,p)&&s.isDark(l+3,p)&&s.isDark(l+4,p)&&!s.isDark(l+5,p)&&s.isDark(l+6,p)&&(d+=40);let m=0;for(let p=0;p<i;p+=1)for(let l=0;l<i;l+=1)s.isDark(l,p)&&(m+=1);let y=Math.abs(100*m/i/i-50)/5;return d+=y*10,d},n})(),z=(function(){let o=new Array(256),e=new Array(256);for(let t=0;t<8;t+=1)o[t]=1<<t;for(let t=8;t<256;t+=1)o[t]=o[t-4]^o[t-5]^o[t-6]^o[t-8];for(let t=0;t<255;t+=1)e[o[t]]=t;let r={};return r.glog=function(t){if(t<1)throw"glog("+t+")";return e[t]},r.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return o[t]},r})(),ne=function(o,e){if(typeof o.length>"u")throw o.length+"/"+e;let r=(function(){let n=0;for(;n<o.length&&o[n]==0;)n+=1;let a=new Array(o.length-n+e);for(let s=0;s<o.length-n;s+=1)a[s]=o[s+n];return a})(),t={};return t.getAt=function(n){return r[n]},t.getLength=function(){return r.length},t.multiply=function(n){let a=new Array(t.getLength()+n.getLength()-1);for(let s=0;s<t.getLength();s+=1)for(let i=0;i<n.getLength();i+=1)a[s+i]^=z.gexp(z.glog(t.getAt(s))+z.glog(n.getAt(i)));return ne(a,0)},t.mod=function(n){if(t.getLength()-n.getLength()<0)return t;let a=z.glog(t.getAt(0))-z.glog(n.getAt(0)),s=new Array(t.getLength());for(let i=0;i<t.getLength();i+=1)s[i]=t.getAt(i);for(let i=0;i<n.getLength();i+=1)s[i]^=z.gexp(z.glog(n.getAt(i))+a);return ne(s,0).mod(n)},t},Ee=(function(){let o=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],e=function(n,a){let s={};return s.totalCount=n,s.dataCount=a,s},r={},t=function(n,a){switch(a){case te.L:return o[(n-1)*4+0];case te.M:return o[(n-1)*4+1];case te.Q:return o[(n-1)*4+2];case te.H:return o[(n-1)*4+3];default:return}};return r.getRSBlocks=function(n,a){let s=t(n,a);if(typeof s>"u")throw"bad rs block @ typeNumber:"+n+"/errorCorrectionLevel:"+a;let i=s.length/3,d=[];for(let m=0;m<i;m+=1){let y=s[m*3+0],p=s[m*3+1],l=s[m*3+2];for(let b=0;b<y;b+=1)d.push(e(p,l))}return d},r})(),ve=function(){let o=[],e=0,r={};return r.getBuffer=function(){return o},r.getAt=function(t){let n=Math.floor(t/8);return(o[n]>>>7-t%8&1)==1},r.put=function(t,n){for(let a=0;a<n;a+=1)r.putBit((t>>>n-a-1&1)==1)},r.getLengthInBits=function(){return e},r.putBit=function(t){let n=Math.floor(e/8);o.length<=n&&o.push(0),t&&(o[n]|=128>>>e%8),e+=1},r},We=function(o){let e=M.MODE_NUMBER,r=o,t={};t.getMode=function(){return e},t.getLength=function(s){return r.length},t.write=function(s){let i=r,d=0;for(;d+2<i.length;)s.put(n(i.substring(d,d+3)),10),d+=3;d<i.length&&(i.length-d==1?s.put(n(i.substring(d,d+1)),4):i.length-d==2&&s.put(n(i.substring(d,d+2)),7))};let n=function(s){let i=0;for(let d=0;d<s.length;d+=1)i=i*10+a(s.charAt(d));return i},a=function(s){if("0"<=s&&s<="9")return s.charCodeAt(0)-48;throw"illegal char :"+s};return t},je=function(o){let e=M.MODE_ALPHA_NUM,r=o,t={};t.getMode=function(){return e},t.getLength=function(a){return r.length},t.write=function(a){let s=r,i=0;for(;i+1<s.length;)a.put(n(s.charAt(i))*45+n(s.charAt(i+1)),11),i+=2;i<s.length&&a.put(n(s.charAt(i)),6)};let n=function(a){if("0"<=a&&a<="9")return a.charCodeAt(0)-48;if("A"<=a&&a<="Z")return a.charCodeAt(0)-65+10;switch(a){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+a}};return t},qe=function(o){let e=M.MODE_8BIT_BYTE,r=o,t=Q.stringToBytes(o),n={};return n.getMode=function(){return e},n.getLength=function(a){return t.length},n.write=function(a){for(let s=0;s<t.length;s+=1)a.put(t[s],8)},n},ze=function(o){let e=M.MODE_KANJI,r=o,t=Q.stringToBytes;(function(s,i){let d=t(s);if(d.length!=2||(d[0]<<8|d[1])!=i)throw"sjis not supported."})("\u53CB",38726);let n=t(o),a={};return a.getMode=function(){return e},a.getLength=function(s){return~~(n.length/2)},a.write=function(s){let i=n,d=0;for(;d+1<i.length;){let m=(255&i[d])<<8|255&i[d+1];if(33088<=m&&m<=40956)m-=33088;else if(57408<=m&&m<=60351)m-=49472;else throw"illegal char at "+(d+1)+"/"+m;m=(m>>>8&255)*192+(m&255),s.put(m,13),d+=2}if(d<i.length)throw"illegal char at "+(d+1)},a},_e=function(){let o=[],e={};return e.writeByte=function(r){o.push(r&255)},e.writeShort=function(r){e.writeByte(r),e.writeByte(r>>>8)},e.writeBytes=function(r,t,n){t=t||0,n=n||r.length;for(let a=0;a<n;a+=1)e.writeByte(r[a+t])},e.writeString=function(r){for(let t=0;t<r.length;t+=1)e.writeByte(r.charCodeAt(t))},e.toByteArray=function(){return o},e.toString=function(){let r="";r+="[";for(let t=0;t<o.length;t+=1)t>0&&(r+=","),r+=o[t];return r+="]",r},e},Ye=function(){let o=0,e=0,r=0,t="",n={},a=function(i){t+=String.fromCharCode(s(i&63))},s=function(i){if(i<0)throw"n:"+i;if(i<26)return 65+i;if(i<52)return 97+(i-26);if(i<62)return 48+(i-52);if(i==62)return 43;if(i==63)return 47;throw"n:"+i};return n.writeByte=function(i){for(o=o<<8|i&255,e+=8,r+=1;e>=6;)a(o>>>e-6),e-=6},n.flush=function(){if(e>0&&(a(o<<6-e),o=0,e=0),r%3!=0){let i=3-r%3;for(let d=0;d<i;d+=1)t+="="}},n.toString=function(){return t},n},Ge=function(o){let e=o,r=0,t=0,n=0,a={};a.read=function(){for(;n<8;){if(r>=e.length){if(n==0)return-1;throw"unexpected end of file./"+n}let d=e.charAt(r);if(r+=1,d=="=")return n=0,-1;if(d.match(/^\s$/))continue;t=t<<6|s(d.charCodeAt(0)),n+=6}let i=t>>>n-8&255;return n-=8,i};let s=function(i){if(65<=i&&i<=90)return i-65;if(97<=i&&i<=122)return i-97+26;if(48<=i&&i<=57)return i-48+52;if(i==43)return 62;if(i==47)return 63;throw"c:"+i};return a},Qe=function(o,e){let r=o,t=e,n=new Array(o*e),a={};a.setPixel=function(m,y,p){n[y*r+m]=p},a.write=function(m){m.writeString("GIF87a"),m.writeShort(r),m.writeShort(t),m.writeByte(128),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(0),m.writeByte(255),m.writeByte(255),m.writeByte(255),m.writeString(","),m.writeShort(0),m.writeShort(0),m.writeShort(r),m.writeShort(t),m.writeByte(0);let y=2,p=i(y);m.writeByte(y);let l=0;for(;p.length-l>255;)m.writeByte(255),m.writeBytes(p,l,255),l+=255;m.writeByte(p.length-l),m.writeBytes(p,l,p.length-l),m.writeByte(0),m.writeString(";")};let s=function(m){let y=m,p=0,l=0,b={};return b.write=function(T,_){if(T>>>_)throw"length over";for(;p+_>=8;)y.writeByte(255&(T<<p|l)),_-=8-p,T>>>=8-p,l=0,p=0;l=T<<p|l,p=p+_},b.flush=function(){p>0&&y.writeByte(l)},b},i=function(m){let y=1<<m,p=(1<<m)+1,l=m+1,b=d();for(let D=0;D<y;D+=1)b.add(String.fromCharCode(D));b.add(String.fromCharCode(y)),b.add(String.fromCharCode(p));let T=_e(),_=s(T);_.write(y,l);let x=0,A=String.fromCharCode(n[x]);for(x+=1;x<n.length;){let D=String.fromCharCode(n[x]);x+=1,b.contains(A+D)?A=A+D:(_.write(b.indexOf(A),l),b.size()<4095&&(b.size()==1<<l&&(l+=1),b.add(A+D)),A=D)}return _.write(b.indexOf(A),l),_.write(p,l),_.flush(),T.toByteArray()},d=function(){let m={},y=0,p={};return p.add=function(l){if(p.contains(l))throw"dup key:"+l;m[l]=y,y+=1},p.size=function(){return y},p.indexOf=function(l){return m[l]},p.contains=function(l){return typeof m[l]<"u"},p};return a},Je=function(o,e,r){let t=Qe(o,e);for(let i=0;i<e;i+=1)for(let d=0;d<o;d+=1)t.setPixel(d,i,r(d,i));let n=_e();t.write(n);let a=Ye(),s=n.toByteArray();for(let i=0;i<s.length;i+=1)a.writeByte(s[i]);return a.flush(),"data:image/gif;base64,"+a},Xe=Q,ln=Q.stringToBytes;function Ze(o,e,r=200){ue(o);let t=document.createElement("canvas"),n=t.getContext?.("2d")??null;if(!n){let p=document.createElement("a");p.href=e,p.textContent="Open in DID Wallet",p.target="_blank",p.rel="noopener",o.appendChild(p);return}let a=Xe(0,"M");a.addData(e),a.make();let s=a.getModuleCount(),i=Math.floor(r/s),d=i*s;t.width=d,t.height=d,t.style.display="block",t.style.width=`${r}px`,t.style.height=`${r}px`,t.style.imageRendering="pixelated";let m="#e8e8e8";n.fillStyle=m,n.fillRect(0,0,d,d),n.fillStyle="#000000";for(let p=0;p<s;p++)for(let l=0;l<s;l++)a.isDark(p,l)&&n.fillRect(l*i,p*i,i,i);let y=document.createElement("div");y.style.cssText="display:inline-block;padding:10px;background:#e8e8e8;border-radius:8px;line-height:0",y.appendChild(t),o.appendChild(y)}function ue(o){o.innerHTML=""}var et=`
151
+ ${Ne}
152
+ ${Be}
153
+ ${Le}
154
+
155
+ /* Layout */
156
+ body {
157
+ min-height: 100vh;
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ background-image: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.08) 0%, transparent 60%);
162
+ }
163
+
164
+ /* Card \u2014 fixed width prevents shrinking when views switch */
165
+ .card {
166
+ background: var(--bg-card);
167
+ border: 1px solid var(--border);
168
+ border-radius: var(--radius-lg);
169
+ padding: 48px 40px;
170
+ width: min(400px, calc(100vw - 32px));
171
+ text-align: center;
172
+ box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(108,71,255,0.15);
173
+ }
174
+
175
+ /* Brand header */
176
+ .brand-header { margin-bottom: 24px; }
177
+ .app-logo {
178
+ width: 48px;
179
+ height: 48px;
180
+ border-radius: var(--radius-sm);
181
+ object-fit: contain;
182
+ margin-bottom: 16px;
183
+ }
184
+ h1 {
185
+ font-size: 24px;
186
+ font-weight: 600;
187
+ margin-bottom: 8px;
188
+ color: var(--text-white);
189
+ letter-spacing: -0.01em;
190
+ line-height: 1.25;
191
+ /* Never let a long "Sign in to {appName}" blow past two lines \u2014 clamp with
192
+ an ellipsis so the card height stays stable. */
193
+ display: -webkit-box;
194
+ -webkit-line-clamp: 2;
195
+ line-clamp: 2;
196
+ -webkit-box-orient: vertical;
197
+ overflow: hidden;
198
+ }
199
+ .subtitle {
200
+ font-size: 14px;
201
+ color: var(--text-secondary);
202
+ margin-bottom: 0;
203
+ line-height: 1.5;
204
+ }
205
+ .federated-hint {
206
+ font-size: 12px;
207
+ color: var(--text-secondary);
208
+ margin-top: 6px;
209
+ margin-bottom: 0;
210
+ opacity: 0.7;
211
+ }
212
+
213
+ /* Input */
214
+ .input {
215
+ width: 100%;
216
+ height: 36px;
217
+ padding: 0 12px;
218
+ font-size: 14px;
219
+ color: var(--text);
220
+ background: var(--bg-input);
221
+ border: 1px solid var(--border-strong);
222
+ border-radius: var(--radius-sm);
223
+ outline: none;
224
+ margin-bottom: 16px;
225
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
226
+ }
227
+ .input:focus { border-color: var(--blue); box-shadow: var(--shadow-focus); }
228
+ .input::placeholder { color: var(--text-placeholder); }
229
+
230
+ /* Button */
231
+ .btn {
232
+ display: inline-flex;
233
+ align-items: center;
234
+ justify-content: center;
235
+ gap: 6px;
236
+ width: 100%;
237
+ height: 36px;
238
+ padding: 0 16px;
239
+ font-size: 14px;
240
+ font-weight: 500;
241
+ color: #fff;
242
+ background: var(--blue);
243
+ border: none;
244
+ border-radius: var(--radius-sm);
245
+ cursor: pointer;
246
+ transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
247
+ line-height: 1;
248
+ }
249
+ .btn:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(108,71,255,0.3); }
250
+ .btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; transform: none; box-shadow: none; }
251
+ .btn:focus-visible { box-shadow: var(--shadow-focus); }
252
+ .btn svg { width: 18px; height: 18px; flex-shrink: 0; }
253
+ .btn-secondary {
254
+ background: transparent;
255
+ border: 1px solid var(--border-strong);
256
+ color: var(--text);
257
+ }
258
+ .btn-secondary:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.20); }
259
+
260
+ /* Status */
261
+ .status {
262
+ margin-top: 16px;
263
+ font-size: 13px;
264
+ min-height: 20px;
265
+ color: var(--text-secondary);
266
+ }
267
+ .status.error { color: var(--red-text); }
268
+
269
+ /* Name row (passkey registration) */
270
+ .name-row { display: none; }
271
+ .name-row.visible { display: block; }
272
+
273
+ /* Passkey section + secondary text action ("First time? Create a passkey") */
274
+ .passkey-section > .btn + .passkey-alt,
275
+ .passkey-section > .name-row + .btn { margin-top: 10px; }
276
+ .passkey-alt {
277
+ display: block;
278
+ width: 100%;
279
+ margin-top: 10px;
280
+ padding: 4px;
281
+ background: none;
282
+ border: none;
283
+ font-size: 13px;
284
+ color: var(--text-secondary);
285
+ cursor: pointer;
286
+ text-align: center;
287
+ transition: color 0.15s ease;
288
+ }
289
+ .passkey-alt:hover { color: var(--text); text-decoration: underline; }
290
+ .passkey-alt:focus-visible { box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); outline: none; }
291
+
292
+ /* Divider */
293
+ .divider {
294
+ display: flex;
295
+ align-items: center;
296
+ margin: 20px 0;
297
+ color: var(--text-secondary);
298
+ font-size: 13px;
299
+ }
300
+ .divider::before, .divider::after {
301
+ content: '';
302
+ flex: 1;
303
+ border-bottom: 1px solid var(--border);
304
+ }
305
+ .divider::before { margin-right: 12px; }
306
+ .divider::after { margin-left: 12px; }
307
+
308
+ /* DID Wallet section (methods view) */
309
+ .did-wallet-section { margin-top: 8px; }
310
+
311
+ /* QR view */
312
+ .qr-view {
313
+ position: relative;
314
+ margin: 20px auto;
315
+ display: flex;
316
+ justify-content: center;
317
+ min-height: 220px;
318
+ align-items: center;
319
+ }
320
+ .qr-placeholder {
321
+ width: 220px;
322
+ height: 220px;
323
+ display: flex;
324
+ align-items: center;
325
+ justify-content: center;
326
+ border: 1px solid var(--border-subtle);
327
+ border-radius: var(--radius);
328
+ background: var(--bg-elevated);
329
+ }
330
+ .qr-spinner {
331
+ display: inline-block;
332
+ width: 32px; height: 32px;
333
+ border: 3px solid var(--border-strong);
334
+ border-top-color: var(--blue-muted);
335
+ border-radius: 50%;
336
+ animation: spin 0.6s linear infinite;
337
+ }
338
+ #did-connect-status {
339
+ font-size: 13px;
340
+ color: var(--text-secondary);
341
+ }
342
+
343
+ /* Connect result state */
344
+ .connect-result {
345
+ display: flex;
346
+ justify-content: center;
347
+ align-items: center;
348
+ min-height: 120px;
349
+ margin: 32px 0;
350
+ animation: fadeIn 200ms ease-out;
351
+ }
352
+ .result-icon {
353
+ width: 64px;
354
+ height: 64px;
355
+ border-radius: 50%;
356
+ display: flex;
357
+ align-items: center;
358
+ justify-content: center;
359
+ font-size: 28px;
360
+ font-weight: bold;
361
+ }
362
+ .result-error {
363
+ background: rgba(239, 68, 68, 0.15);
364
+ color: var(--red-text);
365
+ border: 2px solid rgba(239, 68, 68, 0.3);
366
+ }
367
+ .result-loading {
368
+ background: transparent;
369
+ }
370
+ .result-loading .qr-spinner {
371
+ width: 36px;
372
+ height: 36px;
373
+ }
374
+ .result-back-btn {
375
+ margin-top: 16px;
376
+ }
377
+ @keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
378
+
379
+ /* QR timeout overlay */
380
+ .qr-timeout-overlay {
381
+ position: absolute;
382
+ inset: 0;
383
+ display: flex;
384
+ flex-direction: column;
385
+ align-items: center;
386
+ justify-content: center;
387
+ gap: 12px;
388
+ background: rgba(0, 0, 0, 0.65);
389
+ border-radius: var(--radius);
390
+ backdrop-filter: blur(2px);
391
+ }
392
+ .qr-timeout-overlay .timeout-text {
393
+ font-size: 13px;
394
+ color: #fff;
395
+ }
396
+ .qr-timeout-overlay .refresh-btn {
397
+ display: inline-flex;
398
+ align-items: center;
399
+ justify-content: center;
400
+ gap: 6px;
401
+ padding: 6px 20px;
402
+ font-size: 14px;
403
+ font-weight: 500;
404
+ color: #fff;
405
+ background: var(--blue);
406
+ border: none;
407
+ border-radius: var(--radius-sm);
408
+ cursor: pointer;
409
+ transition: background-color 0.15s ease;
410
+ }
411
+ .qr-timeout-overlay .refresh-btn:hover {
412
+ background: var(--blue-hover);
413
+ }
414
+ /* Connect status views (scanned / success) */
415
+ .connect-status-icon {
416
+ position: relative;
417
+ width: 72px;
418
+ height: 72px;
419
+ margin: 16px auto;
420
+ display: flex;
421
+ align-items: center;
422
+ justify-content: center;
423
+ }
424
+ @keyframes connectSpin { to { transform: rotate(360deg); } }
425
+ .connect-spinner-ring {
426
+ position: absolute;
427
+ inset: 0;
428
+ width: 72px;
429
+ height: 72px;
430
+ border-radius: 50%;
431
+ border: 3px solid rgba(255,255,255,0.1);
432
+ border-top-color: var(--blue, #6c47ff);
433
+ animation: connectSpin 0.8s linear infinite;
434
+ }
435
+ .connect-status-badge {
436
+ position: relative;
437
+ display: flex;
438
+ align-items: center;
439
+ justify-content: center;
440
+ width: 44px;
441
+ height: 44px;
442
+ }
443
+ .connect-status-badge svg { width: 36px; height: 36px; }
444
+ .connect-status-icon.connect-success svg { animation: fadeIn 0.3s ease; }
445
+ .connect-subtitle {
446
+ font-size: 13px;
447
+ color: var(--text-secondary, #9394a1);
448
+ text-align: center;
449
+ margin: 4px 0 0;
450
+ }
451
+ .status.success { color: #49dc6e; font-weight: 500; }
452
+ .deep-link-btn {
453
+ margin-top: 12px;
454
+ text-decoration: none;
455
+ }
456
+
457
+ /* Email section (methods view) */
458
+ .email-section { margin-top: 8px; }
459
+
460
+ /* Back button */
461
+ .back-btn {
462
+ display: inline-flex;
463
+ align-items: center;
464
+ gap: 4px;
465
+ background: none;
466
+ border: none;
467
+ color: var(--text-secondary);
468
+ font-size: 14px;
469
+ cursor: pointer;
470
+ padding: 0;
471
+ margin-bottom: 16px;
472
+ float: left;
473
+ }
474
+ .back-btn:hover { color: var(--text); }
475
+ .back-btn svg { width: 18px; height: 18px; }
476
+ /* Escape hatch \u2014 a quiet "Cancel" link, top-left of the card, mirroring the
477
+ locale switcher (top-right). Conventional spot for a standalone auth card.
478
+ Low in the hierarchy (tertiary color, small) so it never competes with the
479
+ auth methods; it's an exit, not an action. */
480
+ .home-link {
481
+ position: absolute;
482
+ top: 16px;
483
+ /* Align the arrow's left edge to the content column (card's 40px padding), so
484
+ Cancel sits on the same left line as the title and buttons \u2014 no left padding
485
+ of its own, which would push it off that line. */
486
+ left: 40px;
487
+ display: inline-flex;
488
+ align-items: center;
489
+ gap: 3px;
490
+ background: none;
491
+ border: none;
492
+ color: var(--text-tertiary);
493
+ font-size: 13px;
494
+ line-height: 1;
495
+ text-decoration: none;
496
+ cursor: pointer;
497
+ padding: 2px 4px 2px 0;
498
+ transition: color 0.15s ease;
499
+ }
500
+ .home-link:hover { color: var(--text-secondary); }
501
+ .home-link svg { width: 16px; height: 16px; }
502
+
503
+ /* View title */
504
+ .view-title {
505
+ font-size: 20px;
506
+ font-weight: 600;
507
+ color: var(--text-white);
508
+ margin-bottom: 8px;
509
+ clear: both;
510
+ padding-top: 8px;
511
+ }
512
+
513
+ /* OAuth section \u2014 single provider (legacy) */
514
+ .oauth-section { margin-top: 0; }
515
+
516
+ /* OAuth grid \u2014 2+ providers in 2-column layout (legacy) */
517
+ .oauth-grid {
518
+ display: grid;
519
+ grid-template-columns: 1fr 1fr;
520
+ gap: 8px;
521
+ margin-bottom: 8px;
522
+ }
523
+ .oauth-grid .oauth-btn:last-child:nth-child(odd) {
524
+ grid-column: 1 / -1;
525
+ }
526
+
527
+ /* Unified secondary methods grid \u2014 2-column layout */
528
+ .methods-grid {
529
+ display: grid;
530
+ grid-template-columns: 1fr 1fr;
531
+ gap: 8px;
532
+ }
533
+ /* Odd last child (e.g. DID Wallet when total is odd) spans full width */
534
+ .methods-grid .method-btn:last-child:nth-child(odd) {
535
+ grid-column: 1 / -1;
536
+ }
537
+
538
+ .method-btn {
539
+ display: inline-flex;
540
+ align-items: center;
541
+ justify-content: center;
542
+ gap: 8px;
543
+ width: 100%;
544
+ min-height: 36px;
545
+ padding: 6px 16px;
546
+ font-size: 14px;
547
+ font-weight: 500;
548
+ color: var(--text);
549
+ background: var(--bg-elevated);
550
+ border: 1px solid var(--border-strong);
551
+ border-radius: var(--radius-sm);
552
+ cursor: pointer;
553
+ transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.2s ease;
554
+ white-space: normal;
555
+ }
556
+ .method-btn:hover { background: var(--bg-hover); border-color: var(--blue-muted); }
557
+ .method-btn:disabled { cursor: default; pointer-events: none; }
558
+ .method-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
559
+
560
+ .oauth-btn {
561
+ display: inline-flex;
562
+ align-items: center;
563
+ justify-content: center;
564
+ gap: 8px;
565
+ width: 100%;
566
+ height: 36px;
567
+ padding: 0 16px;
568
+ font-size: 14px;
569
+ font-weight: 500;
570
+ color: var(--text);
571
+ background: var(--bg-card);
572
+ border: 1px solid var(--border);
573
+ border-radius: var(--radius-sm);
574
+ cursor: pointer;
575
+ transition: background-color 0.15s ease, opacity 0.2s ease, border-color 0.2s ease;
576
+ margin-bottom: 0;
577
+ }
578
+ .oauth-section .oauth-btn { margin-bottom: 8px; }
579
+ .oauth-btn:hover { background: var(--bg-hover); }
580
+ .oauth-btn:disabled { cursor: default; pointer-events: none; }
581
+ .oauth-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
582
+ .oauth-btn-loading {
583
+ opacity: 0.8;
584
+ border-color: var(--blue);
585
+ color: var(--text-secondary);
586
+ }
587
+ @keyframes oauth-spin { to { transform: rotate(360deg); } }
588
+ .oauth-spinner {
589
+ display: inline-block;
590
+ width: 14px; height: 14px;
591
+ border: 2px solid var(--border-strong);
592
+ border-top-color: var(--blue-muted);
593
+ border-radius: 50%;
594
+ animation: oauth-spin 0.6s linear infinite;
595
+ }
596
+ .oauth-check { color: var(--green-text); font-size: 16px; }
597
+
598
+ /* Browser compatibility warning */
599
+ .compat-warning {
600
+ font-size: 13px;
601
+ color: var(--text-tertiary);
602
+ padding: 12px;
603
+ background: var(--bg-elevated);
604
+ border-radius: var(--radius-sm);
605
+ margin-bottom: 16px;
606
+ }
607
+
608
+ /* Trust footer */
609
+ .login-footer {
610
+ margin-top: 24px;
611
+ padding-top: 20px;
612
+ border-top: 1px solid var(--border);
613
+ }
614
+ .secured-badge {
615
+ display: flex;
616
+ align-items: center;
617
+ justify-content: center;
618
+ gap: 6px;
619
+ font-size: 12px;
620
+ color: var(--text-tertiary);
621
+ }
622
+ .secured-badge svg { width: 14px; height: 14px; flex-shrink: 0; }
623
+ .footer-links {
624
+ margin-top: 8px;
625
+ font-size: 12px;
626
+ color: var(--text-tertiary);
627
+ }
628
+ .footer-links a {
629
+ color: var(--text-secondary);
630
+ text-decoration: none;
631
+ }
632
+ .footer-links a:hover { text-decoration: underline; }
633
+
634
+ /* \u2500\u2500\u2500 Animations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
635
+ @keyframes fadeIn {
636
+ from { opacity: 0; transform: translateY(4px); }
637
+ to { opacity: 1; transform: translateY(0); }
638
+ }
639
+ @keyframes fadeOut {
640
+ from { opacity: 1; }
641
+ to { opacity: 0; }
642
+ }
643
+ .card[data-view] { animation: fadeIn 200ms ease-out; }
644
+
645
+ /* QR code scale-in */
646
+ .qr-view { animation: qrScaleIn 300ms ease-out; }
647
+ @keyframes qrScaleIn {
648
+ from { opacity: 0; transform: scale(0.95); }
649
+ to { opacity: 1; transform: scale(1); }
650
+ }
651
+
652
+ /* Button loading spinner */
653
+ @keyframes spin { to { transform: rotate(360deg); } }
654
+ .btn-spinner {
655
+ display: inline-block;
656
+ width: 16px; height: 16px;
657
+ border: 2px solid rgba(255,255,255,0.3);
658
+ border-top-color: #fff;
659
+ border-radius: 50%;
660
+ animation: spin 0.6s linear infinite;
661
+ }
662
+
663
+ /* Success checkmark */
664
+ @keyframes checkDraw {
665
+ from { stroke-dashoffset: 24; }
666
+ to { stroke-dashoffset: 0; }
667
+ }
668
+ .success-check {
669
+ display: inline-block;
670
+ width: 20px; height: 20px;
671
+ vertical-align: middle;
672
+ }
673
+ .success-check path {
674
+ stroke-dasharray: 24;
675
+ stroke-dashoffset: 24;
676
+ animation: checkDraw 400ms ease-out forwards;
677
+ }
678
+
679
+ /* Light theme background gradient adjustment */
680
+ [data-theme="light"] body {
681
+ background-image: radial-gradient(ellipse at 50% 0%, rgba(108,71,255,0.05) 0%, transparent 60%);
682
+ }
683
+ [data-theme="light"] .card {
684
+ box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(108,71,255,0.08);
685
+ }
686
+ [data-theme="light"] .btn:hover {
687
+ box-shadow: 0 2px 8px rgba(108,71,255,0.15);
688
+ }
689
+
690
+ /* Language switcher */
691
+ .locale-switcher {
692
+ position: absolute;
693
+ top: 16px;
694
+ right: 16px;
695
+ }
696
+ .locale-btn {
697
+ display: inline-flex;
698
+ align-items: center;
699
+ gap: 4px;
700
+ padding: 4px 10px;
701
+ font-size: 12px;
702
+ color: var(--text-secondary);
703
+ background: var(--bg-elevated);
704
+ border: 1px solid var(--border-subtle);
705
+ border-radius: var(--radius-full);
706
+ cursor: pointer;
707
+ transition: color 0.15s, border-color 0.15s;
708
+ }
709
+ .locale-btn:hover {
710
+ color: var(--text);
711
+ border-color: var(--border-strong);
712
+ }
713
+ .locale-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
714
+ .card { position: relative; }
715
+ `;function Y(o){let e=new Uint8Array(o),r="";for(let t=0;t<e.length;t++)r+=String.fromCharCode(e[t]);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ee(o){let e=o.replace(/-/g,"+").replace(/_/g,"/"),r=atob(e),t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t.buffer}function tt(o){let e=o.response;return{id:o.id,rawId:Y(o.rawId),type:o.type,response:{attestationObject:Y(e.attestationObject),clientDataJSON:Y(e.clientDataJSON)},clientExtensionResults:o.getClientExtensionResults(),authenticatorAttachment:o.authenticatorAttachment}}function nt(o){let e=o.response;return{id:o.id,rawId:Y(o.rawId),type:o.type,response:{authenticatorData:Y(e.authenticatorData),clientDataJSON:Y(e.clientDataJSON),signature:Y(e.signature),userHandle:e.userHandle?Y(e.userHandle):void 0},clientExtensionResults:o.getClientExtensionResults(),authenticatorAttachment:o.authenticatorAttachment}}async function oe(o){let e=o.prefix||"/.well-known/service/api/passkey",r=o.onStatus||(()=>{}),t=o.authOnly||!1,n=o.registerOnly||!1,a=o.invitationId||void 0,s=o.texts||{},i=s.waiting||"Waiting for passkey...",d=s.creating||"Creating your passkey...",m=s.verifying||"Verifying...";async function y(){let x=await fetch(`${e}/auth`,{method:"GET"});if(!x.ok)throw new Error("Failed to get auth challenge");return x.json()}async function p(x){let A=[];x&&A.push(`name=${encodeURIComponent(x)}`),a&&A.push(`invitationId=${encodeURIComponent(a)}`);let D=A.length?`?${A.join("&")}`:"",$=await fetch(`${e}/register${D}`,{method:"GET"});if(!$.ok)throw new Error("Failed to get register challenge");return $.json()}function l(x,A){let D=new Error(x);throw A&&(D.code=A),D}async function b(x,A){let D=await fetch(`${e}/auth`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({challengeId:x,credential:A})});if(!D.ok){let $=await D.json().catch(()=>({}));l($.error||"Authentication failed",$.code)}return D.json()}async function T(x,A,D){let $=await fetch(`${e}/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({challengeId:x,credential:A,name:D||void 0})});if(!$.ok){let U=await $.json().catch(()=>({}));l(U.error||"Registration failed",U.code)}return $.json()}if(!n){r(i,!1);try{let x=await y(),{challengeId:A}=x,D=x.authentication||x,$={publicKey:{...D,challenge:ee(D.challenge),allowCredentials:(D.allowCredentials||[]).map(V=>({...V,id:ee(V.id)}))}},U;try{U=await navigator.credentials.get($)}catch{if(t)return{success:!1,error:"no_passkey"}}if(U){let V=nt(U);return r(m,!1),await b(A,V),{success:!0}}}catch(x){let A=x instanceof Error?x.message:"Authentication failed",D=x instanceof Error?x.code:void 0;return r(A,!0),{success:!1,error:A,code:D}}}let _=await p(o.name||"");if(_.registrationAllowed===!1)return r("Registration requires an invitation.",!0),{success:!1,error:"registration_closed"};r(d,!1);try{let x=_.registration||_,A={publicKey:{...x,challenge:ee(x.challenge),user:{...x.user,id:ee(x.user.id)},excludeCredentials:(x.excludeCredentials||[]).map(U=>({...U,id:ee(U.id)}))}},D=await navigator.credentials.create(A),$=tt(D);return r(m,!1),await T(_.challengeId,$,o.name||""),{success:!0}}catch(x){let A=x instanceof Error?x.message:"Passkey setup failed",D=x instanceof Error?x.code:void 0;return r(A,!0),{success:!1,error:A,code:D}}}function G(o,e){let r=o instanceof Error?o.message:"",t=o instanceof Error&&"code"in o?o.code:"";return t==="FORBIDDEN"?E("accessDenied",e):r==="registration_closed"||t==="registration_closed"?E("regClosed",e):r||E("authFailed",e)}var rt="https://web.abtwallet.io/";function ot(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function st(){return typeof window>"u"?null:window.ABT_DEV??window.ABT??null}function K(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}var ke=class{container;config;http;options;tokenSession=null;styleEl=null;mounted=!1;currentView="methods";cardEl=null;mediaQuery=null;mediaListener=null;constructor(o,e,r,t){if(this.container=o,this.config=e,this.http=r,this.options={methods:["passkey","did-connect"],locale:"en",...t},!this.options.invitationId&&typeof document<"u"){let n=document.cookie.match(/(?:^|;\s*)pending_invitation=([^;]*)/);if(n)try{this.options.invitationId=decodeURIComponent(n[1])}catch{}}}mount(){if(this.mounted)return;this.mounted=!0,this.styleEl=document.createElement("style"),this.styleEl.textContent=et,this.container.appendChild(this.styleEl),this.applyTheme();let o=this.filterMethods(this.options.methods);this.renderCard(o)}destroy(){this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.mediaQuery&&this.mediaListener&&(this.mediaQuery.removeEventListener("change",this.mediaListener),this.mediaQuery=null,this.mediaListener=null),document.documentElement.removeAttribute("data-theme"),this.container.innerHTML="",this.styleEl=null,this.cardEl=null,this.currentView="methods",this.mounted=!1}update(o){Object.assign(this.options,o),this.mounted&&(this.destroy(),this.mount())}applyTheme(){let o=this.options.theme??"dark";if(o==="light")document.documentElement.dataset.theme="light";else if(o==="auto"&&typeof window.matchMedia=="function"){let e=window.matchMedia("(prefers-color-scheme: light)");this.mediaQuery=e;let r=t=>{t?document.documentElement.dataset.theme="light":document.documentElement.removeAttribute("data-theme")};r(e.matches),this.mediaListener=t=>r(t.matches),e.addEventListener("change",this.mediaListener)}}filterMethods(o){return o.filter(e=>e==="passkey"?typeof window<"u"&&window.PublicKeyCredential!==void 0&&typeof window.PublicKeyCredential=="function":!0)}renderCard(o){let e=document.createElement("div");e.className="card",this.cardEl=e,this.container.appendChild(e),this.switchView("methods",o)}renderLocaleSwitcher(o){if(ce.length<2)return;let e=document.createElement("div");e.className="locale-switcher";let r=this.options.locale,t=ce.find(a=>a.code!==r)??ce[0],n=document.createElement("button");n.type="button",n.className="locale-btn",n.innerHTML=`${Ke} ${K(t.label)}`,n.title=t.label,n.addEventListener("click",()=>{this.options.onLocaleChange?.(t.code),this.update({locale:t.code})}),e.appendChild(n),o.appendChild(e)}switchView(o,e){if(!this.cardEl)return;let r=this.options.locale;switch(this.currentView==="qr"&&o!=="qr"&&this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.currentView=o,this.cardEl.innerHTML="",this.cardEl.dataset.view=o,this.renderLocaleSwitcher(this.cardEl),o){case"methods":this.renderMethodsView(this.cardEl,r,e??this.filterMethods(this.options.methods));break;case"qr":this.renderQRView(this.cardEl,r);break;case"email":this.renderEmailView(this.cardEl,r);break}}renderMethodsView(o,e,r){this.renderHomeLink(o,e),this.renderBrandHeader(o,e);let t=this.options.methods.includes("passkey");if(t&&!r.includes("passkey")){let s=document.createElement("div");s.className="compat-warning",s.textContent=E("passkeyUnsupported",e),o.appendChild(s)}let n=r.includes("passkey");n&&this.renderPasskeySection(o,e);let a=r.filter(s=>s!=="passkey");if(n&&a.length>0&&this.renderDivider(o,e),a.length>0&&this.renderSecondaryGrid(o,e,r),r.length===0&&!t){let s=document.createElement("p");s.className="subtitle",s.textContent="No authentication methods available.",o.appendChild(s)}this.renderTrustFooter(o,e)}renderQRView(o,e){this.renderBackButton(o,e);let r=document.createElement("h2");r.className="view-title",r.textContent=E("scanTitle",e),o.appendChild(r);let t=document.createElement("div");t.id="did-connect-qr",t.className="qr-view",t.innerHTML='<div class="qr-placeholder"><span class="qr-spinner"></span></div>',o.appendChild(t);let n=document.createElement("button");n.className="btn btn-secondary deep-link-btn",n.id="did-wallet-open-btn",n.textContent=E("openInWallet",e),n.disabled=!0,o.appendChild(n);let a=document.createElement("div");a.id="did-connect-status",a.className="status",o.appendChild(a),this.renderTrustFooter(o,e),this.startDIDConnectInView(a,t,n,e)}renderEmailView(o,e){this.renderBackButton(o,e);let r=document.createElement("h2");r.className="view-title",r.textContent=E("emailTitle",e),o.appendChild(r);let t=document.createElement("input");t.className="input",t.type="email",t.placeholder=E("emailPlaceholder",e),o.appendChild(t);let n=document.createElement("button");n.className="btn",n.textContent=E("emailSubmit",e),o.appendChild(n);let a=document.createElement("div");a.className="status",o.appendChild(a);let s=document.createElement("div");s.className="email-code-section",s.style.display="none";let i=document.createElement("input");i.className="input",i.type="text",i.inputMode="numeric",i.maxLength=6,i.autocomplete="one-time-code",i.placeholder=E("emailCodePlaceholder",e),s.appendChild(i);let d=document.createElement("button");d.className="btn",d.textContent=E("emailVerify",e),s.appendChild(d);let m=document.createElement("button");m.className="btn btn-secondary",m.textContent=E("emailResend",e),m.style.marginTop="8px",s.appendChild(m),o.insertBefore(s,a),this.renderTrustFooter(o,e);let y="",p=this.config.servicePrefix??"/.well-known/service",l=async()=>{let T=t.value.trim();if(!T?.includes("@")){a.textContent=E("emailInvalid",e),a.className="status error";return}n.disabled=!0,a.textContent=E("emailSending",e),a.className="status";try{await this.http.post(`${p}/api/email/sendCode`,{email:T,locale:e}),y=T,t.style.display="none",n.style.display="none",s.style.display="",r.textContent=E("emailVerify",e),a.textContent=E("emailSent",e,{email:T}),a.className="status",i.focus()}catch(_){let x=_ instanceof Error?_.message:"Failed to send email";a.textContent=x,a.className="status error",n.disabled=!1}},b=async()=>{let T=i.value.trim();if(!T||T.length!==6){a.textContent=E("emailCodeInvalid",e),a.className="status error";return}d.disabled=!0,a.textContent=E("verifying",e),a.className="status";try{await this.http.post(`${p}/api/email/login`,{code:T}),a.textContent=E("success",e),a.className="status",this.handleSuccess()}catch(_){_ instanceof Error&&"code"in _&&_.code==="FORBIDDEN"?this.showFullError(G(_,e)):(a.textContent=G(_,e),a.className="status error",d.disabled=!1,i.value="",i.focus())}};n.addEventListener("click",l),t.addEventListener("keydown",T=>{T.key==="Enter"&&l()}),d.addEventListener("click",b),i.addEventListener("keydown",T=>{T.key==="Enter"&&b()}),m.addEventListener("click",async()=>{m.disabled=!0,a.textContent=E("emailSending",e),a.className="status";try{await this.http.post(`${p}/api/email/sendCode`,{email:y,locale:e}),a.textContent=E("emailSent",e,{email:y}),a.className="status"}catch(T){let _=T instanceof Error?T.message:"Failed to resend";a.textContent=_,a.className="status error"}m.disabled=!1})}renderBackButton(o,e){let r=document.createElement("button");r.className="back-btn",r.innerHTML=`${xe} ${K(E("back",e))}`,r.addEventListener("click",()=>this.switchView("methods")),o.appendChild(r)}renderHomeLink(o,e){let{homeUrl:r,onCancel:t}=this.options;if(!t&&!r)return;let n=`${xe} ${K(E("cancel",e))}`;if(t){let a=document.createElement("button");a.type="button",a.className="home-link",a.innerHTML=n,a.addEventListener("click",()=>this.options.onCancel?.()),o.appendChild(a)}else{let a=document.createElement("a");a.className="home-link",a.href=r,a.innerHTML=n,o.appendChild(a)}}renderBrandHeader(o,e){let r=document.createElement("div");if(r.className="brand-header",this.options.appLogo){let n=document.createElement("img");n.className="app-logo",n.src=K(this.options.appLogo),n.alt=this.options.appName?K(this.options.appName):"",n.width=48,n.height=48,r.appendChild(n)}let t=document.createElement("h1");if(this.options.appName?t.textContent=E("signInTo",e,{appName:this.options.appName}):t.textContent=E("signIn",e),r.appendChild(t),this.options.masterAppName){let n=document.createElement("p");n.className="federated-hint",n.textContent=E("federatedBy",e,{masterName:this.options.masterAppName}),r.appendChild(n)}o.appendChild(r)}renderTrustFooter(o,e){let r=document.createElement("div");r.className="login-footer";let t=document.createElement("div");t.className="secured-badge",t.innerHTML=`${Ue} ${K(E("securedBy",e))}`,r.appendChild(t);let{privacyUrl:n,termsUrl:a}=this.options;if(n||a){let s=document.createElement("div");if(s.className="footer-links",n){let i=document.createElement("a");i.href=n,i.target="_blank",i.rel="noopener noreferrer",i.textContent=E("privacy",e),s.appendChild(i)}if(n&&a&&s.appendChild(document.createTextNode(" \xB7 ")),a){let i=document.createElement("a");i.href=a,i.target="_blank",i.rel="noopener noreferrer",i.textContent=E("terms",e),s.appendChild(i)}r.appendChild(s)}o.appendChild(r)}renderDivider(o,e){let r=document.createElement("div");r.className="divider",r.textContent=E("or",e),o.appendChild(r)}renderPasskeySection(o,e){let r=document.createElement("div");r.className="passkey-section",o.appendChild(r);let t=document.createElement("div");t.className="status",t.id="passkey-status",o.appendChild(t);let n=(l,b)=>{t.textContent=l,t.className=`status${b?" error":""}`},a=()=>n("",!1),s={waiting:E("passkeyWaiting",e),creating:E("passkeyCreating",e),verifying:E("verifying",e)},i=l=>l.success?(n(E("success",e),!1),this.handleSuccess(),!0):l.code==="FORBIDDEN"||l.error==="registration_closed"?(this.showFullError(G({message:l.error,code:l.code||l.error},e)),!0):!1,d=()=>{r.innerHTML="",n(E("passkeyNoLocal",e),!1);let l=document.createElement("button");l.className="btn",l.id="passkey-btn",l.innerHTML=`${le} ${K(E("passkeyUseAnotherDevice",e))}`,r.appendChild(l),l.addEventListener("click",()=>y());let b=document.createElement("button");b.type="button",b.className="passkey-alt",b.textContent=E("passkeyCreateInstead",e),r.appendChild(b),b.addEventListener("click",()=>m())},m=()=>{r.innerHTML="",a();let l=document.createElement("div");l.className="name-row visible",l.id="passkey-name-row";let b=document.createElement("input");b.className="input",b.id="passkey-name-input",b.type="text",b.placeholder=E("namePlaceholder",e),b.autocomplete="name",l.appendChild(b),r.appendChild(l);let T=document.createElement("button");T.className="btn",T.id="passkey-btn",T.innerHTML=`${le} ${K(E("passkeyCreate",e))}`,r.appendChild(T);let _=document.createElement("button");_.type="button",_.className="passkey-alt",_.textContent=E("passkeyBackToSignIn",e),r.appendChild(_);let x=async()=>{T.disabled=!0;let A=await oe({registerOnly:!0,name:b.value.trim(),onStatus:n,texts:s,prefix:this.options.passkeyPrefix,invitationId:this.options.invitationId});i(A)||(A.error&&n(A.error,!0),T.disabled=!1)};T.addEventListener("click",x),b.addEventListener("keydown",A=>{A.key==="Enter"&&x()}),_.addEventListener("click",()=>p()),b.focus()},y=async()=>{let l=r.querySelector("#passkey-btn");l&&(l.disabled=!0);let b=await oe({authOnly:!0,onStatus:n,texts:s,prefix:this.options.passkeyPrefix,invitationId:this.options.invitationId});if(!i(b)){if(b.error&&b.error!=="no_passkey"){n(b.error,!0),l&&(l.disabled=!1);return}d()}},p=()=>{r.innerHTML="",a();let l=document.createElement("button");l.className="btn",l.id="passkey-btn",l.innerHTML=`${le} ${K(E("passkeySignIn",e))}`,r.appendChild(l),l.addEventListener("click",()=>y());let b=document.createElement("button");b.type="button",b.className="passkey-alt",b.textContent=E("passkeyFirstTime",e),r.appendChild(b),b.addEventListener("click",()=>m())};this.options.invitationId?m():p()}startOAuthPopup(o,e){let r=this.config.servicePrefix??"/.well-known/service",n=`${this.options.masterOAuthOrigin?`${this.options.masterOAuthOrigin}${r}`:r}/api/oauth/${encodeURIComponent(o)}/login?returnUrl=${encodeURIComponent(window.location.href)}`,a=500,s=620,i=window.screenX+(window.innerWidth-a)/2,d=window.screenY+(window.innerHeight-s)/2,m=window.open(n,"oauth-login:popup",`left=${i},top=${d},width=${a},height=${s},resizable,scrollbars=yes,status=1,popup`);if(!m){window.location.href=n;return}let y=e.innerHTML;e.innerHTML='<span class="oauth-spinner"></span> Authorizing...',e.disabled=!0,e.classList.add("oauth-btn-loading");let p=()=>{e.innerHTML=y,e.disabled=!1,e.classList.remove("oauth-btn-loading")},l=async _=>{if(!_.data||_.data.type!=="authorization_response")return;if(T(),m.close(),_.data.error){p();return}let{code:x,state:A}=_.data.response??_.data;if(!x){p();return}e.innerHTML='<span class="oauth-spinner"></span> Signing in...';try{let D={provider:o,code:x,state:A};this.options.invitationId&&(D.invitationId=this.options.invitationId),await this.http.post(`${r}/api/oauth/login`,D),e.innerHTML='<span class="oauth-check">\u2713</span> Success',this.handleSuccess()}catch(D){let $=D instanceof Error?D.message:"",U=D instanceof Error&&"code"in D?D.code:"";U==="FORBIDDEN"||$==="registration_closed"||U==="registration_closed"?this.showFullError(G(D,this.options.locale)):p()}},b=setInterval(()=>{m.closed&&(T(),p())},500),T=()=>{clearInterval(b),window.removeEventListener("message",l)};window.addEventListener("message",l)}renderSecondaryGrid(o,e,r){let t=document.createElement("div");if(t.className="methods-grid",r.includes("oauth")&&this.options.oauthProviders?.length){let n=(this.options.oauthProviders??[]).filter(a=>a.enabled);for(let a of n){let s=document.createElement("button");s.className="method-btn",s.dataset.provider=a.id;let i=Ve(a.id);s.innerHTML=`${i} ${K(a.name)}`,t.appendChild(s),s.addEventListener("click",()=>{this.startOAuthPopup(a.id,s)})}}if(r.includes("email")){let n=document.createElement("button");n.className="method-btn",n.id="email-btn",n.innerHTML=`${Fe} ${K(E("emailButton",e))}`,t.appendChild(n),n.addEventListener("click",()=>{this.switchView("email")})}if(r.includes("did-connect")){let n=document.createElement("button");n.className="method-btn",n.id="did-wallet-btn";let a=t.children.length>0?E("didWalletButtonShort",e):E("didWalletButton",e);n.innerHTML=`${we} ${K(a)}`,t.appendChild(n),n.addEventListener("click",()=>{this.switchView("qr")})}o.appendChild(t)}async startDIDConnectInView(o,e,r,t){o.textContent=E("connecting",t);try{this.tokenSession?.destroy(),this.tokenSession=new Z(this.config,this.http),this.tokenSession.on("succeed",async()=>{this.showConnectResult(e,r,o,E("verifying",t));try{let a=this.config.servicePrefix??"/.well-known/service";await this.http.post(`${a}/api/did/connect/complete`,{token:this.tokenSession.state.token}),this.showConnectSuccess(e,r,o,t),this.handleSuccess()}catch(a){this.showConnectResult(e,r,o,G(a,t),!0)}}),this.tokenSession.on("timeout",()=>{o.textContent=E("timeout",t);let a=document.createElement("div");a.className="qr-timeout-overlay",a.innerHTML=`<span class="timeout-text">${K(E("timeout",t))}</span>`;let s=document.createElement("button");s.className="refresh-btn",s.textContent=E("refreshQR",t),s.addEventListener("click",()=>{a.remove(),ue(e),e.innerHTML='<div class="qr-placeholder"><span class="qr-spinner"></span></div>',r.disabled=!0,this.startDIDConnectInView(o,e,r,t)}),a.appendChild(s),e.appendChild(a)}),this.tokenSession.on("error",a=>{this.showConnectResult(e,r,o,G(a,t),!0)}),this.tokenSession.on("statusChange",a=>{a.status==="scanned"&&this.showConnectScanned(e,r,o,t)});let n=await this.tokenSession.create({locale:t});n.url&&(Ze(e,n.url),r.disabled=!1,r.addEventListener("click",()=>{this.showConnectScanned(e,r,o,t),this.openInWallet(n.url,t)})),o.textContent=E("scanWithWallet",t),this.tokenSession.startPolling()}catch(n){o.textContent=G(n,t),ue(e)}}showFullError(o){if(!this.cardEl)return;let e=this.options.locale;this.tokenSession&&(this.tokenSession.destroy(),this.tokenSession=null),this.cardEl.innerHTML="",this.cardEl.dataset.view="error",this.renderLocaleSwitcher(this.cardEl);let r=document.createElement("div");r.className="connect-result",r.innerHTML='<div class="result-icon result-error">\u2715</div>',this.cardEl.appendChild(r);let t=document.createElement("div");t.className="status error",t.textContent=o,this.cardEl.appendChild(t);let n=document.createElement("button");n.className="btn btn-secondary result-back-btn",n.textContent=E("back",e),n.addEventListener("click",()=>this.switchView("methods")),this.cardEl.appendChild(n),this.renderTrustFooter(this.cardEl,e)}showConnectScanned(o,e,r,t="en"){o.style.display="none",e.style.display="none";let n=o.parentElement?.querySelector(".connect-result");n||(n=document.createElement("div"),n.className="connect-result",o.parentElement?.insertBefore(n,r)),n.innerHTML=`<div class="connect-status-icon">
716
+ <div class="connect-spinner-ring"></div>
717
+ <span class="connect-status-badge">${we}</span>
718
+ </div>`,r.textContent=E("waitingWallet",t),r.className="status";let a=r.parentElement?.querySelector(".connect-subtitle");a||(a=document.createElement("p"),a.className="connect-subtitle",r.parentElement?.insertBefore(a,r.nextSibling)),a.textContent=E("walletContinue",t);let s=r.parentElement?.querySelector(".result-back-btn");s||(s=document.createElement("button"),s.className="btn btn-secondary result-back-btn",s.textContent=E("back",t),s.addEventListener("click",()=>this.switchView("methods")),a.parentElement?.insertBefore(s,a.nextSibling))}showConnectSuccess(o,e,r,t="en"){o.style.display="none",e.style.display="none";let n=o.parentElement?.querySelector(".connect-result");n||(n=document.createElement("div"),n.className="connect-result",o.parentElement?.insertBefore(n,r)),n.innerHTML=`<div class="connect-status-icon connect-success">
719
+ <svg viewBox="0 0 64 64" width="64" height="64"><circle cx="32" cy="32" r="28" fill="none" stroke="#49dc6e" stroke-width="3"/><polyline points="20 33 28 41 44 25" fill="none" stroke="#49dc6e" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></svg>
720
+ </div>`,r.textContent=E("success",t),r.className="status success";let a=r.parentElement?.querySelector(".connect-subtitle"),s=r.parentElement?.querySelector(".result-back-btn");a?.remove(),s?.remove()}showConnectResult(o,e,r,t,n=!1){let a=this.options.locale;o.style.display="none",e.style.display="none";let s=o.parentElement?.querySelector(".connect-result");if(s||(s=document.createElement("div"),s.className="connect-result",o.parentElement?.insertBefore(s,r)),n){s.innerHTML='<div class="result-icon result-error">\u2715</div>',r.textContent=t,r.className="status error";let i=r.parentElement?.querySelector(".result-back-btn");i||(i=document.createElement("button"),i.className="btn btn-secondary result-back-btn",i.textContent=E("back",a),i.addEventListener("click",()=>this.switchView("methods")),r.parentElement?.insertBefore(i,r.nextSibling))}else s.innerHTML='<div class="result-icon result-loading"><span class="qr-spinner"></span></div>',r.textContent=t,r.className="status"}openInWallet(o,e="en"){let r=ot(),t=st();if(r){let n=o.replace(/^https?:\/\//,"abt://");window.location.href=n}else if(t&&typeof t.open=="function"){let n=this.tokenSession?.state;t.open({action:this.config.action??"login",locale:e,url:encodeURIComponent(o),appInfo:n?.appInfo??{},memberAppInfo:n?.memberAppInfo??{}})}else{let n=`${rt}?action=requestAuth&url=${encodeURIComponent(o)}`,a=414,s=736,i=window.screenX+window.innerWidth-a,d=window.screenY;window.open(n,"did-wallet:popup",`left=${i},top=${d},width=${a},height=${s},resizable,scrollbars=yes,status=1,popup`)}}handleSuccess(){this.options.onSuccess?this.options.onSuccess():setTimeout(()=>location.reload(),300)}};return Se(it);})();