@kya-os/consent 0.1.0 → 0.1.1

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 (200) hide show
  1. package/dist/bundle/index.d.ts +44 -0
  2. package/dist/bundle/index.d.ts.map +1 -0
  3. package/dist/bundle/index.js +45 -0
  4. package/dist/bundle/index.js.map +1 -0
  5. package/dist/bundle/inline.d.ts +18 -0
  6. package/dist/bundle/inline.d.ts.map +1 -0
  7. package/dist/bundle/inline.js +18 -0
  8. package/dist/bundle/inline.js.map +1 -0
  9. package/dist/bundle/shell.d.ts +91 -0
  10. package/dist/bundle/shell.d.ts.map +1 -0
  11. package/dist/bundle/shell.js +282 -0
  12. package/dist/bundle/shell.js.map +1 -0
  13. package/dist/components/consent-button.d.ts +61 -0
  14. package/dist/components/consent-button.d.ts.map +1 -0
  15. package/dist/components/consent-button.js +177 -0
  16. package/dist/components/consent-button.js.map +1 -0
  17. package/dist/components/consent-checkbox.d.ts +61 -0
  18. package/dist/components/consent-checkbox.d.ts.map +1 -0
  19. package/dist/components/consent-checkbox.js +220 -0
  20. package/dist/components/consent-checkbox.js.map +1 -0
  21. package/dist/components/consent-input.d.ts +91 -0
  22. package/dist/components/consent-input.d.ts.map +1 -0
  23. package/dist/components/consent-input.js +332 -0
  24. package/dist/components/consent-input.js.map +1 -0
  25. package/dist/components/consent-oauth-button.d.ts +87 -0
  26. package/dist/components/consent-oauth-button.d.ts.map +1 -0
  27. package/dist/components/consent-oauth-button.js +389 -0
  28. package/dist/components/consent-oauth-button.js.map +1 -0
  29. package/dist/components/consent-otp-input.d.ts +92 -0
  30. package/dist/components/consent-otp-input.d.ts.map +1 -0
  31. package/dist/components/consent-otp-input.js +378 -0
  32. package/dist/components/consent-otp-input.js.map +1 -0
  33. package/dist/components/consent-permissions.d.ts +104 -0
  34. package/dist/components/consent-permissions.d.ts.map +1 -0
  35. package/dist/components/consent-permissions.js +430 -0
  36. package/dist/components/consent-permissions.js.map +1 -0
  37. package/dist/components/consent-shell.d.ts +72 -0
  38. package/dist/components/consent-shell.d.ts.map +1 -0
  39. package/dist/components/consent-shell.js +231 -0
  40. package/dist/components/consent-shell.js.map +1 -0
  41. package/dist/components/consent-terms.d.ts +89 -0
  42. package/dist/components/consent-terms.d.ts.map +1 -0
  43. package/dist/components/consent-terms.js +284 -0
  44. package/dist/components/consent-terms.js.map +1 -0
  45. package/dist/components/index.d.ts +19 -0
  46. package/dist/components/index.d.ts.map +1 -0
  47. package/dist/components/index.js +23 -0
  48. package/dist/components/index.js.map +1 -0
  49. package/dist/components/mcp-consent.d.ts +152 -0
  50. package/dist/components/mcp-consent.d.ts.map +1 -0
  51. package/dist/components/mcp-consent.js +874 -0
  52. package/dist/components/mcp-consent.js.map +1 -0
  53. package/dist/consent.js +3737 -0
  54. package/dist/consent.min.js +1564 -0
  55. package/dist/constants/auth-modes.d.ts +7 -2
  56. package/dist/constants/auth-modes.d.ts.map +1 -1
  57. package/dist/constants/auth-modes.js +28 -36
  58. package/dist/constants/auth-modes.js.map +1 -1
  59. package/dist/constants/colors.js +1 -4
  60. package/dist/constants/colors.js.map +1 -1
  61. package/dist/constants/defaults.d.ts +1 -1
  62. package/dist/constants/defaults.d.ts.map +1 -1
  63. package/dist/constants/defaults.js +16 -19
  64. package/dist/constants/defaults.js.map +1 -1
  65. package/dist/constants/index.d.ts +3 -3
  66. package/dist/constants/index.d.ts.map +1 -1
  67. package/dist/constants/index.js +3 -26
  68. package/dist/constants/index.js.map +1 -1
  69. package/dist/index.d.ts +10 -7
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +12 -23
  72. package/dist/index.js.map +1 -1
  73. package/dist/react/index.d.ts +123 -0
  74. package/dist/react/index.d.ts.map +1 -0
  75. package/dist/react/index.js +154 -0
  76. package/dist/react/index.js.map +1 -0
  77. package/dist/resolution/index.d.ts +3 -3
  78. package/dist/resolution/index.d.ts.map +1 -1
  79. package/dist/resolution/index.js +3 -19
  80. package/dist/resolution/index.js.map +1 -1
  81. package/dist/resolution/resolve-branding.d.ts +1 -1
  82. package/dist/resolution/resolve-branding.d.ts.map +1 -1
  83. package/dist/resolution/resolve-branding.js +14 -24
  84. package/dist/resolution/resolve-branding.js.map +1 -1
  85. package/dist/resolution/resolve-config.d.ts +2 -2
  86. package/dist/resolution/resolve-config.d.ts.map +1 -1
  87. package/dist/resolution/resolve-config.js +57 -53
  88. package/dist/resolution/resolve-config.js.map +1 -1
  89. package/dist/resolution/resolve-copy.d.ts +2 -2
  90. package/dist/resolution/resolve-copy.d.ts.map +1 -1
  91. package/dist/resolution/resolve-copy.js +35 -43
  92. package/dist/resolution/resolve-copy.js.map +1 -1
  93. package/dist/schemas/api.schemas.d.ts +7 -4
  94. package/dist/schemas/api.schemas.d.ts.map +1 -1
  95. package/dist/schemas/api.schemas.js +70 -74
  96. package/dist/schemas/api.schemas.js.map +1 -1
  97. package/dist/schemas/branding.schemas.js +17 -20
  98. package/dist/schemas/branding.schemas.js.map +1 -1
  99. package/dist/schemas/config.schemas.d.ts +1 -1
  100. package/dist/schemas/config.schemas.d.ts.map +1 -1
  101. package/dist/schemas/config.schemas.js +64 -70
  102. package/dist/schemas/config.schemas.js.map +1 -1
  103. package/dist/schemas/index.d.ts +4 -4
  104. package/dist/schemas/index.d.ts.map +1 -1
  105. package/dist/schemas/index.js +4 -20
  106. package/dist/schemas/index.js.map +1 -1
  107. package/dist/schemas/modes.schemas.js +60 -63
  108. package/dist/schemas/modes.schemas.js.map +1 -1
  109. package/dist/security/escape.d.ts.map +1 -1
  110. package/dist/security/escape.js +12 -17
  111. package/dist/security/escape.js.map +1 -1
  112. package/dist/security/index.d.ts +2 -2
  113. package/dist/security/index.d.ts.map +1 -1
  114. package/dist/security/index.js +2 -18
  115. package/dist/security/index.js.map +1 -1
  116. package/dist/security/validators.js +9 -20
  117. package/dist/security/validators.js.map +1 -1
  118. package/dist/styles/css-variables.d.ts +1 -1
  119. package/dist/styles/css-variables.d.ts.map +1 -1
  120. package/dist/styles/css-variables.js +18 -27
  121. package/dist/styles/css-variables.js.map +1 -1
  122. package/dist/styles/index.d.ts +3 -3
  123. package/dist/styles/index.d.ts.map +1 -1
  124. package/dist/styles/index.js +3 -19
  125. package/dist/styles/index.js.map +1 -1
  126. package/dist/styles/stylesheet.d.ts +1 -1
  127. package/dist/styles/stylesheet.d.ts.map +1 -1
  128. package/dist/styles/stylesheet.js +20 -27
  129. package/dist/styles/stylesheet.js.map +1 -1
  130. package/dist/styles/tokens.js +1 -4
  131. package/dist/styles/tokens.js.map +1 -1
  132. package/dist/templates/base/base-template.d.ts +3 -3
  133. package/dist/templates/base/base-template.d.ts.map +1 -1
  134. package/dist/templates/base/base-template.js +31 -35
  135. package/dist/templates/base/base-template.js.map +1 -1
  136. package/dist/templates/base/components.js +49 -65
  137. package/dist/templates/base/components.js.map +1 -1
  138. package/dist/templates/base/index.d.ts +2 -2
  139. package/dist/templates/base/index.d.ts.map +1 -1
  140. package/dist/templates/base/index.js +2 -20
  141. package/dist/templates/base/index.js.map +1 -1
  142. package/dist/templates/index.d.ts +9 -9
  143. package/dist/templates/index.d.ts.map +1 -1
  144. package/dist/templates/index.js +9 -25
  145. package/dist/templates/index.js.map +1 -1
  146. package/dist/templates/modes/consent-only.template.d.ts +2 -2
  147. package/dist/templates/modes/consent-only.template.d.ts.map +1 -1
  148. package/dist/templates/modes/consent-only.template.js +11 -15
  149. package/dist/templates/modes/consent-only.template.js.map +1 -1
  150. package/dist/templates/modes/credentials.template.d.ts +4 -4
  151. package/dist/templates/modes/credentials.template.d.ts.map +1 -1
  152. package/dist/templates/modes/credentials.template.js +20 -24
  153. package/dist/templates/modes/credentials.template.js.map +1 -1
  154. package/dist/templates/modes/index.d.ts +6 -6
  155. package/dist/templates/modes/index.d.ts.map +1 -1
  156. package/dist/templates/modes/index.js +6 -16
  157. package/dist/templates/modes/index.js.map +1 -1
  158. package/dist/templates/modes/magic-link.template.d.ts +2 -2
  159. package/dist/templates/modes/magic-link.template.d.ts.map +1 -1
  160. package/dist/templates/modes/magic-link.template.js +14 -18
  161. package/dist/templates/modes/magic-link.template.js.map +1 -1
  162. package/dist/templates/modes/oauth.template.d.ts +2 -2
  163. package/dist/templates/modes/oauth.template.d.ts.map +1 -1
  164. package/dist/templates/modes/oauth.template.js +21 -25
  165. package/dist/templates/modes/oauth.template.js.map +1 -1
  166. package/dist/templates/modes/otp.template.d.ts +2 -2
  167. package/dist/templates/modes/otp.template.d.ts.map +1 -1
  168. package/dist/templates/modes/otp.template.js +17 -21
  169. package/dist/templates/modes/otp.template.js.map +1 -1
  170. package/dist/templates/modes/success.template.d.ts +2 -2
  171. package/dist/templates/modes/success.template.d.ts.map +1 -1
  172. package/dist/templates/modes/success.template.js +24 -29
  173. package/dist/templates/modes/success.template.js.map +1 -1
  174. package/dist/templates/registry.d.ts +4 -4
  175. package/dist/templates/registry.d.ts.map +1 -1
  176. package/dist/templates/registry.js +30 -38
  177. package/dist/templates/registry.js.map +1 -1
  178. package/dist/types/api.types.d.ts +6 -5
  179. package/dist/types/api.types.d.ts.map +1 -1
  180. package/dist/types/api.types.js +1 -2
  181. package/dist/types/api.types.js.map +1 -1
  182. package/dist/types/branding.types.js +1 -2
  183. package/dist/types/branding.types.js.map +1 -1
  184. package/dist/types/config.types.d.ts +5 -5
  185. package/dist/types/config.types.d.ts.map +1 -1
  186. package/dist/types/config.types.js +1 -2
  187. package/dist/types/config.types.js.map +1 -1
  188. package/dist/types/copy.types.js +1 -2
  189. package/dist/types/copy.types.js.map +1 -1
  190. package/dist/types/index.d.ts +6 -6
  191. package/dist/types/index.d.ts.map +1 -1
  192. package/dist/types/index.js +6 -22
  193. package/dist/types/index.js.map +1 -1
  194. package/dist/types/modes.types.js +1 -4
  195. package/dist/types/modes.types.js.map +1 -1
  196. package/dist/types/page.types.d.ts +6 -6
  197. package/dist/types/page.types.d.ts.map +1 -1
  198. package/dist/types/page.types.js +1 -2
  199. package/dist/types/page.types.js.map +1 -1
  200. package/package.json +41 -4
@@ -0,0 +1,3737 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i6 = decorators.length - 1, decorator; i6 >= 0; i6--)
6
+ if (decorator = decorators[i6])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+
12
+ // ../../node_modules/.pnpm/@lit+reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js
13
+ var t = globalThis;
14
+ var e = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
15
+ var s = Symbol();
16
+ var o = /* @__PURE__ */ new WeakMap();
17
+ var n = class {
18
+ constructor(t6, e8, o8) {
19
+ if (this._$cssResult$ = true, o8 !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
20
+ this.cssText = t6, this.t = e8;
21
+ }
22
+ get styleSheet() {
23
+ let t6 = this.o;
24
+ const s4 = this.t;
25
+ if (e && void 0 === t6) {
26
+ const e8 = void 0 !== s4 && 1 === s4.length;
27
+ e8 && (t6 = o.get(s4)), void 0 === t6 && ((this.o = t6 = new CSSStyleSheet()).replaceSync(this.cssText), e8 && o.set(s4, t6));
28
+ }
29
+ return t6;
30
+ }
31
+ toString() {
32
+ return this.cssText;
33
+ }
34
+ };
35
+ var r = (t6) => new n("string" == typeof t6 ? t6 : t6 + "", void 0, s);
36
+ var i = (t6, ...e8) => {
37
+ const o8 = 1 === t6.length ? t6[0] : e8.reduce(((e9, s4, o9) => e9 + ((t7) => {
38
+ if (true === t7._$cssResult$) return t7.cssText;
39
+ if ("number" == typeof t7) return t7;
40
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t7 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
41
+ })(s4) + t6[o9 + 1]), t6[0]);
42
+ return new n(o8, t6, s);
43
+ };
44
+ var S = (s4, o8) => {
45
+ if (e) s4.adoptedStyleSheets = o8.map(((t6) => t6 instanceof CSSStyleSheet ? t6 : t6.styleSheet));
46
+ else for (const e8 of o8) {
47
+ const o9 = document.createElement("style"), n5 = t.litNonce;
48
+ void 0 !== n5 && o9.setAttribute("nonce", n5), o9.textContent = e8.cssText, s4.appendChild(o9);
49
+ }
50
+ };
51
+ var c = e ? (t6) => t6 : (t6) => t6 instanceof CSSStyleSheet ? ((t7) => {
52
+ let e8 = "";
53
+ for (const s4 of t7.cssRules) e8 += s4.cssText;
54
+ return r(e8);
55
+ })(t6) : t6;
56
+
57
+ // ../../node_modules/.pnpm/@lit+reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js
58
+ var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: h, getOwnPropertyNames: r2, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
59
+ var a = globalThis;
60
+ var c2 = a.trustedTypes;
61
+ var l = c2 ? c2.emptyScript : "";
62
+ var p = a.reactiveElementPolyfillSupport;
63
+ var d = (t6, s4) => t6;
64
+ var u = { toAttribute(t6, s4) {
65
+ switch (s4) {
66
+ case Boolean:
67
+ t6 = t6 ? l : null;
68
+ break;
69
+ case Object:
70
+ case Array:
71
+ t6 = null == t6 ? t6 : JSON.stringify(t6);
72
+ }
73
+ return t6;
74
+ }, fromAttribute(t6, s4) {
75
+ let i6 = t6;
76
+ switch (s4) {
77
+ case Boolean:
78
+ i6 = null !== t6;
79
+ break;
80
+ case Number:
81
+ i6 = null === t6 ? null : Number(t6);
82
+ break;
83
+ case Object:
84
+ case Array:
85
+ try {
86
+ i6 = JSON.parse(t6);
87
+ } catch (t7) {
88
+ i6 = null;
89
+ }
90
+ }
91
+ return i6;
92
+ } };
93
+ var f = (t6, s4) => !i2(t6, s4);
94
+ var b = { attribute: true, type: String, converter: u, reflect: false, useDefault: false, hasChanged: f };
95
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a.litPropertyMetadata ?? (a.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
96
+ var y = class extends HTMLElement {
97
+ static addInitializer(t6) {
98
+ this._$Ei(), (this.l ?? (this.l = [])).push(t6);
99
+ }
100
+ static get observedAttributes() {
101
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
102
+ }
103
+ static createProperty(t6, s4 = b) {
104
+ if (s4.state && (s4.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t6) && ((s4 = Object.create(s4)).wrapped = true), this.elementProperties.set(t6, s4), !s4.noAccessor) {
105
+ const i6 = Symbol(), h3 = this.getPropertyDescriptor(t6, i6, s4);
106
+ void 0 !== h3 && e2(this.prototype, t6, h3);
107
+ }
108
+ }
109
+ static getPropertyDescriptor(t6, s4, i6) {
110
+ const { get: e8, set: r7 } = h(this.prototype, t6) ?? { get() {
111
+ return this[s4];
112
+ }, set(t7) {
113
+ this[s4] = t7;
114
+ } };
115
+ return { get: e8, set(s5) {
116
+ const h3 = e8?.call(this);
117
+ r7?.call(this, s5), this.requestUpdate(t6, h3, i6);
118
+ }, configurable: true, enumerable: true };
119
+ }
120
+ static getPropertyOptions(t6) {
121
+ return this.elementProperties.get(t6) ?? b;
122
+ }
123
+ static _$Ei() {
124
+ if (this.hasOwnProperty(d("elementProperties"))) return;
125
+ const t6 = n2(this);
126
+ t6.finalize(), void 0 !== t6.l && (this.l = [...t6.l]), this.elementProperties = new Map(t6.elementProperties);
127
+ }
128
+ static finalize() {
129
+ if (this.hasOwnProperty(d("finalized"))) return;
130
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
131
+ const t7 = this.properties, s4 = [...r2(t7), ...o2(t7)];
132
+ for (const i6 of s4) this.createProperty(i6, t7[i6]);
133
+ }
134
+ const t6 = this[Symbol.metadata];
135
+ if (null !== t6) {
136
+ const s4 = litPropertyMetadata.get(t6);
137
+ if (void 0 !== s4) for (const [t7, i6] of s4) this.elementProperties.set(t7, i6);
138
+ }
139
+ this._$Eh = /* @__PURE__ */ new Map();
140
+ for (const [t7, s4] of this.elementProperties) {
141
+ const i6 = this._$Eu(t7, s4);
142
+ void 0 !== i6 && this._$Eh.set(i6, t7);
143
+ }
144
+ this.elementStyles = this.finalizeStyles(this.styles);
145
+ }
146
+ static finalizeStyles(s4) {
147
+ const i6 = [];
148
+ if (Array.isArray(s4)) {
149
+ const e8 = new Set(s4.flat(1 / 0).reverse());
150
+ for (const s5 of e8) i6.unshift(c(s5));
151
+ } else void 0 !== s4 && i6.push(c(s4));
152
+ return i6;
153
+ }
154
+ static _$Eu(t6, s4) {
155
+ const i6 = s4.attribute;
156
+ return false === i6 ? void 0 : "string" == typeof i6 ? i6 : "string" == typeof t6 ? t6.toLowerCase() : void 0;
157
+ }
158
+ constructor() {
159
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
160
+ }
161
+ _$Ev() {
162
+ this._$ES = new Promise(((t6) => this.enableUpdating = t6)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t6) => t6(this)));
163
+ }
164
+ addController(t6) {
165
+ (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t6), void 0 !== this.renderRoot && this.isConnected && t6.hostConnected?.();
166
+ }
167
+ removeController(t6) {
168
+ this._$EO?.delete(t6);
169
+ }
170
+ _$E_() {
171
+ const t6 = /* @__PURE__ */ new Map(), s4 = this.constructor.elementProperties;
172
+ for (const i6 of s4.keys()) this.hasOwnProperty(i6) && (t6.set(i6, this[i6]), delete this[i6]);
173
+ t6.size > 0 && (this._$Ep = t6);
174
+ }
175
+ createRenderRoot() {
176
+ const t6 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
177
+ return S(t6, this.constructor.elementStyles), t6;
178
+ }
179
+ connectedCallback() {
180
+ this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), this._$EO?.forEach(((t6) => t6.hostConnected?.()));
181
+ }
182
+ enableUpdating(t6) {
183
+ }
184
+ disconnectedCallback() {
185
+ this._$EO?.forEach(((t6) => t6.hostDisconnected?.()));
186
+ }
187
+ attributeChangedCallback(t6, s4, i6) {
188
+ this._$AK(t6, i6);
189
+ }
190
+ _$ET(t6, s4) {
191
+ const i6 = this.constructor.elementProperties.get(t6), e8 = this.constructor._$Eu(t6, i6);
192
+ if (void 0 !== e8 && true === i6.reflect) {
193
+ const h3 = (void 0 !== i6.converter?.toAttribute ? i6.converter : u).toAttribute(s4, i6.type);
194
+ this._$Em = t6, null == h3 ? this.removeAttribute(e8) : this.setAttribute(e8, h3), this._$Em = null;
195
+ }
196
+ }
197
+ _$AK(t6, s4) {
198
+ const i6 = this.constructor, e8 = i6._$Eh.get(t6);
199
+ if (void 0 !== e8 && this._$Em !== e8) {
200
+ const t7 = i6.getPropertyOptions(e8), h3 = "function" == typeof t7.converter ? { fromAttribute: t7.converter } : void 0 !== t7.converter?.fromAttribute ? t7.converter : u;
201
+ this._$Em = e8;
202
+ const r7 = h3.fromAttribute(s4, t7.type);
203
+ this[e8] = r7 ?? this._$Ej?.get(e8) ?? r7, this._$Em = null;
204
+ }
205
+ }
206
+ requestUpdate(t6, s4, i6) {
207
+ if (void 0 !== t6) {
208
+ const e8 = this.constructor, h3 = this[t6];
209
+ if (i6 ?? (i6 = e8.getPropertyOptions(t6)), !((i6.hasChanged ?? f)(h3, s4) || i6.useDefault && i6.reflect && h3 === this._$Ej?.get(t6) && !this.hasAttribute(e8._$Eu(t6, i6)))) return;
210
+ this.C(t6, s4, i6);
211
+ }
212
+ false === this.isUpdatePending && (this._$ES = this._$EP());
213
+ }
214
+ C(t6, s4, { useDefault: i6, reflect: e8, wrapped: h3 }, r7) {
215
+ i6 && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t6) && (this._$Ej.set(t6, r7 ?? s4 ?? this[t6]), true !== h3 || void 0 !== r7) || (this._$AL.has(t6) || (this.hasUpdated || i6 || (s4 = void 0), this._$AL.set(t6, s4)), true === e8 && this._$Em !== t6 && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t6));
216
+ }
217
+ async _$EP() {
218
+ this.isUpdatePending = true;
219
+ try {
220
+ await this._$ES;
221
+ } catch (t7) {
222
+ Promise.reject(t7);
223
+ }
224
+ const t6 = this.scheduleUpdate();
225
+ return null != t6 && await t6, !this.isUpdatePending;
226
+ }
227
+ scheduleUpdate() {
228
+ return this.performUpdate();
229
+ }
230
+ performUpdate() {
231
+ if (!this.isUpdatePending) return;
232
+ if (!this.hasUpdated) {
233
+ if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
234
+ for (const [t8, s5] of this._$Ep) this[t8] = s5;
235
+ this._$Ep = void 0;
236
+ }
237
+ const t7 = this.constructor.elementProperties;
238
+ if (t7.size > 0) for (const [s5, i6] of t7) {
239
+ const { wrapped: t8 } = i6, e8 = this[s5];
240
+ true !== t8 || this._$AL.has(s5) || void 0 === e8 || this.C(s5, void 0, i6, e8);
241
+ }
242
+ }
243
+ let t6 = false;
244
+ const s4 = this._$AL;
245
+ try {
246
+ t6 = this.shouldUpdate(s4), t6 ? (this.willUpdate(s4), this._$EO?.forEach(((t7) => t7.hostUpdate?.())), this.update(s4)) : this._$EM();
247
+ } catch (s5) {
248
+ throw t6 = false, this._$EM(), s5;
249
+ }
250
+ t6 && this._$AE(s4);
251
+ }
252
+ willUpdate(t6) {
253
+ }
254
+ _$AE(t6) {
255
+ this._$EO?.forEach(((t7) => t7.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t6)), this.updated(t6);
256
+ }
257
+ _$EM() {
258
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
259
+ }
260
+ get updateComplete() {
261
+ return this.getUpdateComplete();
262
+ }
263
+ getUpdateComplete() {
264
+ return this._$ES;
265
+ }
266
+ shouldUpdate(t6) {
267
+ return true;
268
+ }
269
+ update(t6) {
270
+ this._$Eq && (this._$Eq = this._$Eq.forEach(((t7) => this._$ET(t7, this[t7])))), this._$EM();
271
+ }
272
+ updated(t6) {
273
+ }
274
+ firstUpdated(t6) {
275
+ }
276
+ };
277
+ y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[d("elementProperties")] = /* @__PURE__ */ new Map(), y[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: y }), (a.reactiveElementVersions ?? (a.reactiveElementVersions = [])).push("2.1.1");
278
+
279
+ // ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js
280
+ var t2 = globalThis;
281
+ var i3 = t2.trustedTypes;
282
+ var s2 = i3 ? i3.createPolicy("lit-html", { createHTML: (t6) => t6 }) : void 0;
283
+ var e3 = "$lit$";
284
+ var h2 = `lit$${Math.random().toFixed(9).slice(2)}$`;
285
+ var o3 = "?" + h2;
286
+ var n3 = `<${o3}>`;
287
+ var r3 = document;
288
+ var l2 = () => r3.createComment("");
289
+ var c3 = (t6) => null === t6 || "object" != typeof t6 && "function" != typeof t6;
290
+ var a2 = Array.isArray;
291
+ var u2 = (t6) => a2(t6) || "function" == typeof t6?.[Symbol.iterator];
292
+ var d2 = "[ \n\f\r]";
293
+ var f2 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
294
+ var v = /-->/g;
295
+ var _ = />/g;
296
+ var m = RegExp(`>|${d2}(?:([^\\s"'>=/]+)(${d2}*=${d2}*(?:[^
297
+ \f\r"'\`<>=]|("|')|))|$)`, "g");
298
+ var p2 = /'/g;
299
+ var g = /"/g;
300
+ var $ = /^(?:script|style|textarea|title)$/i;
301
+ var y2 = (t6) => (i6, ...s4) => ({ _$litType$: t6, strings: i6, values: s4 });
302
+ var x = y2(1);
303
+ var b2 = y2(2);
304
+ var w = y2(3);
305
+ var T = Symbol.for("lit-noChange");
306
+ var E = Symbol.for("lit-nothing");
307
+ var A = /* @__PURE__ */ new WeakMap();
308
+ var C = r3.createTreeWalker(r3, 129);
309
+ function P(t6, i6) {
310
+ if (!a2(t6) || !t6.hasOwnProperty("raw")) throw Error("invalid template strings array");
311
+ return void 0 !== s2 ? s2.createHTML(i6) : i6;
312
+ }
313
+ var V = (t6, i6) => {
314
+ const s4 = t6.length - 1, o8 = [];
315
+ let r7, l3 = 2 === i6 ? "<svg>" : 3 === i6 ? "<math>" : "", c4 = f2;
316
+ for (let i7 = 0; i7 < s4; i7++) {
317
+ const s5 = t6[i7];
318
+ let a3, u3, d3 = -1, y3 = 0;
319
+ for (; y3 < s5.length && (c4.lastIndex = y3, u3 = c4.exec(s5), null !== u3); ) y3 = c4.lastIndex, c4 === f2 ? "!--" === u3[1] ? c4 = v : void 0 !== u3[1] ? c4 = _ : void 0 !== u3[2] ? ($.test(u3[2]) && (r7 = RegExp("</" + u3[2], "g")), c4 = m) : void 0 !== u3[3] && (c4 = m) : c4 === m ? ">" === u3[0] ? (c4 = r7 ?? f2, d3 = -1) : void 0 === u3[1] ? d3 = -2 : (d3 = c4.lastIndex - u3[2].length, a3 = u3[1], c4 = void 0 === u3[3] ? m : '"' === u3[3] ? g : p2) : c4 === g || c4 === p2 ? c4 = m : c4 === v || c4 === _ ? c4 = f2 : (c4 = m, r7 = void 0);
320
+ const x2 = c4 === m && t6[i7 + 1].startsWith("/>") ? " " : "";
321
+ l3 += c4 === f2 ? s5 + n3 : d3 >= 0 ? (o8.push(a3), s5.slice(0, d3) + e3 + s5.slice(d3) + h2 + x2) : s5 + h2 + (-2 === d3 ? i7 : x2);
322
+ }
323
+ return [P(t6, l3 + (t6[s4] || "<?>") + (2 === i6 ? "</svg>" : 3 === i6 ? "</math>" : "")), o8];
324
+ };
325
+ var N = class _N {
326
+ constructor({ strings: t6, _$litType$: s4 }, n5) {
327
+ let r7;
328
+ this.parts = [];
329
+ let c4 = 0, a3 = 0;
330
+ const u3 = t6.length - 1, d3 = this.parts, [f3, v2] = V(t6, s4);
331
+ if (this.el = _N.createElement(f3, n5), C.currentNode = this.el.content, 2 === s4 || 3 === s4) {
332
+ const t7 = this.el.content.firstChild;
333
+ t7.replaceWith(...t7.childNodes);
334
+ }
335
+ for (; null !== (r7 = C.nextNode()) && d3.length < u3; ) {
336
+ if (1 === r7.nodeType) {
337
+ if (r7.hasAttributes()) for (const t7 of r7.getAttributeNames()) if (t7.endsWith(e3)) {
338
+ const i6 = v2[a3++], s5 = r7.getAttribute(t7).split(h2), e8 = /([.?@])?(.*)/.exec(i6);
339
+ d3.push({ type: 1, index: c4, name: e8[2], strings: s5, ctor: "." === e8[1] ? H : "?" === e8[1] ? I : "@" === e8[1] ? L : k }), r7.removeAttribute(t7);
340
+ } else t7.startsWith(h2) && (d3.push({ type: 6, index: c4 }), r7.removeAttribute(t7));
341
+ if ($.test(r7.tagName)) {
342
+ const t7 = r7.textContent.split(h2), s5 = t7.length - 1;
343
+ if (s5 > 0) {
344
+ r7.textContent = i3 ? i3.emptyScript : "";
345
+ for (let i6 = 0; i6 < s5; i6++) r7.append(t7[i6], l2()), C.nextNode(), d3.push({ type: 2, index: ++c4 });
346
+ r7.append(t7[s5], l2());
347
+ }
348
+ }
349
+ } else if (8 === r7.nodeType) if (r7.data === o3) d3.push({ type: 2, index: c4 });
350
+ else {
351
+ let t7 = -1;
352
+ for (; -1 !== (t7 = r7.data.indexOf(h2, t7 + 1)); ) d3.push({ type: 7, index: c4 }), t7 += h2.length - 1;
353
+ }
354
+ c4++;
355
+ }
356
+ }
357
+ static createElement(t6, i6) {
358
+ const s4 = r3.createElement("template");
359
+ return s4.innerHTML = t6, s4;
360
+ }
361
+ };
362
+ function S2(t6, i6, s4 = t6, e8) {
363
+ if (i6 === T) return i6;
364
+ let h3 = void 0 !== e8 ? s4._$Co?.[e8] : s4._$Cl;
365
+ const o8 = c3(i6) ? void 0 : i6._$litDirective$;
366
+ return h3?.constructor !== o8 && (h3?._$AO?.(false), void 0 === o8 ? h3 = void 0 : (h3 = new o8(t6), h3._$AT(t6, s4, e8)), void 0 !== e8 ? (s4._$Co ?? (s4._$Co = []))[e8] = h3 : s4._$Cl = h3), void 0 !== h3 && (i6 = S2(t6, h3._$AS(t6, i6.values), h3, e8)), i6;
367
+ }
368
+ var M = class {
369
+ constructor(t6, i6) {
370
+ this._$AV = [], this._$AN = void 0, this._$AD = t6, this._$AM = i6;
371
+ }
372
+ get parentNode() {
373
+ return this._$AM.parentNode;
374
+ }
375
+ get _$AU() {
376
+ return this._$AM._$AU;
377
+ }
378
+ u(t6) {
379
+ const { el: { content: i6 }, parts: s4 } = this._$AD, e8 = (t6?.creationScope ?? r3).importNode(i6, true);
380
+ C.currentNode = e8;
381
+ let h3 = C.nextNode(), o8 = 0, n5 = 0, l3 = s4[0];
382
+ for (; void 0 !== l3; ) {
383
+ if (o8 === l3.index) {
384
+ let i7;
385
+ 2 === l3.type ? i7 = new R(h3, h3.nextSibling, this, t6) : 1 === l3.type ? i7 = new l3.ctor(h3, l3.name, l3.strings, this, t6) : 6 === l3.type && (i7 = new z(h3, this, t6)), this._$AV.push(i7), l3 = s4[++n5];
386
+ }
387
+ o8 !== l3?.index && (h3 = C.nextNode(), o8++);
388
+ }
389
+ return C.currentNode = r3, e8;
390
+ }
391
+ p(t6) {
392
+ let i6 = 0;
393
+ for (const s4 of this._$AV) void 0 !== s4 && (void 0 !== s4.strings ? (s4._$AI(t6, s4, i6), i6 += s4.strings.length - 2) : s4._$AI(t6[i6])), i6++;
394
+ }
395
+ };
396
+ var R = class _R {
397
+ get _$AU() {
398
+ return this._$AM?._$AU ?? this._$Cv;
399
+ }
400
+ constructor(t6, i6, s4, e8) {
401
+ this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t6, this._$AB = i6, this._$AM = s4, this.options = e8, this._$Cv = e8?.isConnected ?? true;
402
+ }
403
+ get parentNode() {
404
+ let t6 = this._$AA.parentNode;
405
+ const i6 = this._$AM;
406
+ return void 0 !== i6 && 11 === t6?.nodeType && (t6 = i6.parentNode), t6;
407
+ }
408
+ get startNode() {
409
+ return this._$AA;
410
+ }
411
+ get endNode() {
412
+ return this._$AB;
413
+ }
414
+ _$AI(t6, i6 = this) {
415
+ t6 = S2(this, t6, i6), c3(t6) ? t6 === E || null == t6 || "" === t6 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t6 !== this._$AH && t6 !== T && this._(t6) : void 0 !== t6._$litType$ ? this.$(t6) : void 0 !== t6.nodeType ? this.T(t6) : u2(t6) ? this.k(t6) : this._(t6);
416
+ }
417
+ O(t6) {
418
+ return this._$AA.parentNode.insertBefore(t6, this._$AB);
419
+ }
420
+ T(t6) {
421
+ this._$AH !== t6 && (this._$AR(), this._$AH = this.O(t6));
422
+ }
423
+ _(t6) {
424
+ this._$AH !== E && c3(this._$AH) ? this._$AA.nextSibling.data = t6 : this.T(r3.createTextNode(t6)), this._$AH = t6;
425
+ }
426
+ $(t6) {
427
+ const { values: i6, _$litType$: s4 } = t6, e8 = "number" == typeof s4 ? this._$AC(t6) : (void 0 === s4.el && (s4.el = N.createElement(P(s4.h, s4.h[0]), this.options)), s4);
428
+ if (this._$AH?._$AD === e8) this._$AH.p(i6);
429
+ else {
430
+ const t7 = new M(e8, this), s5 = t7.u(this.options);
431
+ t7.p(i6), this.T(s5), this._$AH = t7;
432
+ }
433
+ }
434
+ _$AC(t6) {
435
+ let i6 = A.get(t6.strings);
436
+ return void 0 === i6 && A.set(t6.strings, i6 = new N(t6)), i6;
437
+ }
438
+ k(t6) {
439
+ a2(this._$AH) || (this._$AH = [], this._$AR());
440
+ const i6 = this._$AH;
441
+ let s4, e8 = 0;
442
+ for (const h3 of t6) e8 === i6.length ? i6.push(s4 = new _R(this.O(l2()), this.O(l2()), this, this.options)) : s4 = i6[e8], s4._$AI(h3), e8++;
443
+ e8 < i6.length && (this._$AR(s4 && s4._$AB.nextSibling, e8), i6.length = e8);
444
+ }
445
+ _$AR(t6 = this._$AA.nextSibling, i6) {
446
+ for (this._$AP?.(false, true, i6); t6 !== this._$AB; ) {
447
+ const i7 = t6.nextSibling;
448
+ t6.remove(), t6 = i7;
449
+ }
450
+ }
451
+ setConnected(t6) {
452
+ void 0 === this._$AM && (this._$Cv = t6, this._$AP?.(t6));
453
+ }
454
+ };
455
+ var k = class {
456
+ get tagName() {
457
+ return this.element.tagName;
458
+ }
459
+ get _$AU() {
460
+ return this._$AM._$AU;
461
+ }
462
+ constructor(t6, i6, s4, e8, h3) {
463
+ this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t6, this.name = i6, this._$AM = e8, this.options = h3, s4.length > 2 || "" !== s4[0] || "" !== s4[1] ? (this._$AH = Array(s4.length - 1).fill(new String()), this.strings = s4) : this._$AH = E;
464
+ }
465
+ _$AI(t6, i6 = this, s4, e8) {
466
+ const h3 = this.strings;
467
+ let o8 = false;
468
+ if (void 0 === h3) t6 = S2(this, t6, i6, 0), o8 = !c3(t6) || t6 !== this._$AH && t6 !== T, o8 && (this._$AH = t6);
469
+ else {
470
+ const e9 = t6;
471
+ let n5, r7;
472
+ for (t6 = h3[0], n5 = 0; n5 < h3.length - 1; n5++) r7 = S2(this, e9[s4 + n5], i6, n5), r7 === T && (r7 = this._$AH[n5]), o8 || (o8 = !c3(r7) || r7 !== this._$AH[n5]), r7 === E ? t6 = E : t6 !== E && (t6 += (r7 ?? "") + h3[n5 + 1]), this._$AH[n5] = r7;
473
+ }
474
+ o8 && !e8 && this.j(t6);
475
+ }
476
+ j(t6) {
477
+ t6 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t6 ?? "");
478
+ }
479
+ };
480
+ var H = class extends k {
481
+ constructor() {
482
+ super(...arguments), this.type = 3;
483
+ }
484
+ j(t6) {
485
+ this.element[this.name] = t6 === E ? void 0 : t6;
486
+ }
487
+ };
488
+ var I = class extends k {
489
+ constructor() {
490
+ super(...arguments), this.type = 4;
491
+ }
492
+ j(t6) {
493
+ this.element.toggleAttribute(this.name, !!t6 && t6 !== E);
494
+ }
495
+ };
496
+ var L = class extends k {
497
+ constructor(t6, i6, s4, e8, h3) {
498
+ super(t6, i6, s4, e8, h3), this.type = 5;
499
+ }
500
+ _$AI(t6, i6 = this) {
501
+ if ((t6 = S2(this, t6, i6, 0) ?? E) === T) return;
502
+ const s4 = this._$AH, e8 = t6 === E && s4 !== E || t6.capture !== s4.capture || t6.once !== s4.once || t6.passive !== s4.passive, h3 = t6 !== E && (s4 === E || e8);
503
+ e8 && this.element.removeEventListener(this.name, this, s4), h3 && this.element.addEventListener(this.name, this, t6), this._$AH = t6;
504
+ }
505
+ handleEvent(t6) {
506
+ "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t6) : this._$AH.handleEvent(t6);
507
+ }
508
+ };
509
+ var z = class {
510
+ constructor(t6, i6, s4) {
511
+ this.element = t6, this.type = 6, this._$AN = void 0, this._$AM = i6, this.options = s4;
512
+ }
513
+ get _$AU() {
514
+ return this._$AM._$AU;
515
+ }
516
+ _$AI(t6) {
517
+ S2(this, t6);
518
+ }
519
+ };
520
+ var j = t2.litHtmlPolyfillSupport;
521
+ j?.(N, R), (t2.litHtmlVersions ?? (t2.litHtmlVersions = [])).push("3.3.1");
522
+ var B = (t6, i6, s4) => {
523
+ const e8 = s4?.renderBefore ?? i6;
524
+ let h3 = e8._$litPart$;
525
+ if (void 0 === h3) {
526
+ const t7 = s4?.renderBefore ?? null;
527
+ e8._$litPart$ = h3 = new R(i6.insertBefore(l2(), t7), t7, void 0, s4 ?? {});
528
+ }
529
+ return h3._$AI(t6), h3;
530
+ };
531
+
532
+ // ../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js
533
+ var s3 = globalThis;
534
+ var i4 = class extends y {
535
+ constructor() {
536
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
537
+ }
538
+ createRenderRoot() {
539
+ var _a;
540
+ const t6 = super.createRenderRoot();
541
+ return (_a = this.renderOptions).renderBefore ?? (_a.renderBefore = t6.firstChild), t6;
542
+ }
543
+ update(t6) {
544
+ const r7 = this.render();
545
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t6), this._$Do = B(r7, this.renderRoot, this.renderOptions);
546
+ }
547
+ connectedCallback() {
548
+ super.connectedCallback(), this._$Do?.setConnected(true);
549
+ }
550
+ disconnectedCallback() {
551
+ super.disconnectedCallback(), this._$Do?.setConnected(false);
552
+ }
553
+ render() {
554
+ return T;
555
+ }
556
+ };
557
+ i4._$litElement$ = true, i4["finalized"] = true, s3.litElementHydrateSupport?.({ LitElement: i4 });
558
+ var o4 = s3.litElementPolyfillSupport;
559
+ o4?.({ LitElement: i4 });
560
+ (s3.litElementVersions ?? (s3.litElementVersions = [])).push("4.2.1");
561
+
562
+ // ../../node_modules/.pnpm/@lit+reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/custom-element.js
563
+ var t3 = (t6) => (e8, o8) => {
564
+ void 0 !== o8 ? o8.addInitializer((() => {
565
+ customElements.define(t6, e8);
566
+ })) : customElements.define(t6, e8);
567
+ };
568
+
569
+ // ../../node_modules/.pnpm/@lit+reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js
570
+ var o5 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
571
+ var r4 = (t6 = o5, e8, r7) => {
572
+ const { kind: n5, metadata: i6 } = r7;
573
+ let s4 = globalThis.litPropertyMetadata.get(i6);
574
+ if (void 0 === s4 && globalThis.litPropertyMetadata.set(i6, s4 = /* @__PURE__ */ new Map()), "setter" === n5 && ((t6 = Object.create(t6)).wrapped = true), s4.set(r7.name, t6), "accessor" === n5) {
575
+ const { name: o8 } = r7;
576
+ return { set(r8) {
577
+ const n6 = e8.get.call(this);
578
+ e8.set.call(this, r8), this.requestUpdate(o8, n6, t6);
579
+ }, init(e9) {
580
+ return void 0 !== e9 && this.C(o8, void 0, t6, e9), e9;
581
+ } };
582
+ }
583
+ if ("setter" === n5) {
584
+ const { name: o8 } = r7;
585
+ return function(r8) {
586
+ const n6 = this[o8];
587
+ e8.call(this, r8), this.requestUpdate(o8, n6, t6);
588
+ };
589
+ }
590
+ throw Error("Unsupported decorator location: " + n5);
591
+ };
592
+ function n4(t6) {
593
+ return (e8, o8) => "object" == typeof o8 ? r4(t6, e8, o8) : ((t7, e9, o9) => {
594
+ const r7 = e9.hasOwnProperty(o9);
595
+ return e9.constructor.createProperty(o9, t7), r7 ? Object.getOwnPropertyDescriptor(e9, o9) : void 0;
596
+ })(t6, e8, o8);
597
+ }
598
+
599
+ // ../../node_modules/.pnpm/@lit+reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js
600
+ function r5(r7) {
601
+ return n4({ ...r7, state: true, attribute: false });
602
+ }
603
+
604
+ // ../../node_modules/.pnpm/@lit+reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/base.js
605
+ var e4 = (e8, t6, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t6 && Object.defineProperty(e8, t6, c4), c4);
606
+
607
+ // ../../node_modules/.pnpm/@lit+reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query-all.js
608
+ var e5;
609
+ function r6(r7) {
610
+ return (n5, o8) => e4(n5, o8, { get() {
611
+ return (this.renderRoot ?? (e5 ?? (e5 = document.createDocumentFragment()))).querySelectorAll(r7);
612
+ } });
613
+ }
614
+
615
+ // src/components/consent-button.ts
616
+ var ConsentButton = class extends i4 {
617
+ constructor() {
618
+ super();
619
+ this.variant = "primary";
620
+ this.type = "button";
621
+ this.disabled = false;
622
+ this.fullWidth = false;
623
+ this.loading = false;
624
+ this.internals = this.attachInternals();
625
+ }
626
+ handleClick() {
627
+ if (this.disabled || this.loading) return;
628
+ const form = this.internals.form;
629
+ if (!form) return;
630
+ if (this.type === "submit") {
631
+ form.requestSubmit();
632
+ } else if (this.type === "reset") {
633
+ form.reset();
634
+ }
635
+ }
636
+ render() {
637
+ return x`
638
+ <button
639
+ part="button"
640
+ type="button"
641
+ ?disabled=${this.disabled || this.loading}
642
+ aria-busy=${this.loading}
643
+ @click=${this.handleClick}
644
+ >
645
+ ${this.loading ? x`<span class="spinner"></span>` : null}
646
+ <slot></slot>
647
+ </button>
648
+ `;
649
+ }
650
+ };
651
+ // Enable form association
652
+ ConsentButton.formAssociated = true;
653
+ ConsentButton.styles = i`
654
+ :host {
655
+ display: inline-block;
656
+ }
657
+
658
+ :host([full-width]) {
659
+ display: block;
660
+ width: 100%;
661
+ }
662
+
663
+ button {
664
+ /* Base styles - matches AgentShield PreviewButton exactly */
665
+ padding: 0.75rem 1rem;
666
+ height: 2.75rem;
667
+ border-radius: 0.5rem;
668
+ font-size: 0.875rem;
669
+ font-weight: 500;
670
+ font-family: inherit;
671
+ cursor: pointer;
672
+ transition: opacity 0.15s ease, background-color 0.15s ease;
673
+ border: none;
674
+ width: 100%;
675
+ display: inline-flex;
676
+ align-items: center;
677
+ justify-content: center;
678
+ gap: 0.5rem;
679
+ }
680
+
681
+ /* Primary variant */
682
+ :host([variant='primary']) button {
683
+ background-color: var(--consent-primary, #2563eb);
684
+ color: white;
685
+ }
686
+
687
+ :host([variant='primary']) button:hover:not(:disabled) {
688
+ opacity: 0.9;
689
+ }
690
+
691
+ /* Secondary variant */
692
+ :host([variant='secondary']) button {
693
+ background-color: transparent;
694
+ color: #374151;
695
+ border: 1px solid #d1d5db;
696
+ }
697
+
698
+ :host([variant='secondary']) button:hover:not(:disabled) {
699
+ background-color: #f9fafb;
700
+ }
701
+
702
+ /* Disabled state */
703
+ button:disabled {
704
+ opacity: 0.5;
705
+ cursor: not-allowed;
706
+ }
707
+
708
+ /* Loading spinner */
709
+ .spinner {
710
+ width: 1rem;
711
+ height: 1rem;
712
+ border: 2px solid currentColor;
713
+ border-top-color: transparent;
714
+ border-radius: 50%;
715
+ animation: spin 0.8s linear infinite;
716
+ }
717
+
718
+ @keyframes spin {
719
+ to {
720
+ transform: rotate(360deg);
721
+ }
722
+ }
723
+ `;
724
+ __decorateClass([
725
+ n4({ type: String, reflect: true })
726
+ ], ConsentButton.prototype, "variant", 2);
727
+ __decorateClass([
728
+ n4({ type: String })
729
+ ], ConsentButton.prototype, "type", 2);
730
+ __decorateClass([
731
+ n4({ type: Boolean, reflect: true })
732
+ ], ConsentButton.prototype, "disabled", 2);
733
+ __decorateClass([
734
+ n4({ type: Boolean, attribute: "full-width" })
735
+ ], ConsentButton.prototype, "fullWidth", 2);
736
+ __decorateClass([
737
+ n4({ type: Boolean, reflect: true })
738
+ ], ConsentButton.prototype, "loading", 2);
739
+ ConsentButton = __decorateClass([
740
+ t3("consent-button")
741
+ ], ConsentButton);
742
+
743
+ // src/components/consent-checkbox.ts
744
+ var ConsentCheckbox = class extends i4 {
745
+ constructor() {
746
+ super();
747
+ this.name = "";
748
+ this.checked = false;
749
+ this.required = false;
750
+ this.disabled = false;
751
+ this.value = "on";
752
+ this.internals = this.attachInternals();
753
+ }
754
+ // Update form value when properties change
755
+ updated(changedProperties) {
756
+ if (changedProperties.has("checked") || changedProperties.has("value")) {
757
+ this.updateFormValue();
758
+ }
759
+ }
760
+ updateFormValue() {
761
+ if (this.checked) {
762
+ this.internals.setFormValue(this.value);
763
+ } else {
764
+ this.internals.setFormValue(null);
765
+ }
766
+ }
767
+ handleChange(e8) {
768
+ const input = e8.target;
769
+ this.checked = input.checked;
770
+ this.updateFormValue();
771
+ this.dispatchEvent(
772
+ new CustomEvent("change", {
773
+ detail: { checked: this.checked, value: this.value },
774
+ bubbles: true,
775
+ composed: true
776
+ })
777
+ );
778
+ }
779
+ render() {
780
+ return x`
781
+ <label part="label">
782
+ <input
783
+ part="checkbox"
784
+ type="checkbox"
785
+ name=${this.name}
786
+ .value=${this.value}
787
+ .checked=${this.checked}
788
+ ?required=${this.required}
789
+ ?disabled=${this.disabled}
790
+ @change=${this.handleChange}
791
+ />
792
+ <span class="text">
793
+ <slot></slot>
794
+ </span>
795
+ </label>
796
+ `;
797
+ }
798
+ };
799
+ // Enable form association
800
+ ConsentCheckbox.formAssociated = true;
801
+ ConsentCheckbox.styles = i`
802
+ :host {
803
+ display: block;
804
+ }
805
+
806
+ label {
807
+ display: flex;
808
+ align-items: flex-start;
809
+ gap: 0.75rem;
810
+ cursor: pointer;
811
+ font-size: 0.875rem;
812
+ color: #374151;
813
+ line-height: 1.5;
814
+ }
815
+
816
+ :host([disabled]) label {
817
+ cursor: not-allowed;
818
+ opacity: 0.6;
819
+ }
820
+
821
+ /* Custom checkbox styling - matches AgentShield exactly */
822
+ input[type='checkbox'] {
823
+ /* Reset */
824
+ appearance: none;
825
+ -webkit-appearance: none;
826
+ margin: 0;
827
+
828
+ /* Size - matches AgentShield w-4 h-4 */
829
+ width: 1rem;
830
+ height: 1rem;
831
+ min-width: 1rem;
832
+ margin-top: 0.125rem; /* Align with text baseline */
833
+
834
+ /* Border */
835
+ border: 1px solid #d1d5db;
836
+ border-radius: 0.25rem;
837
+
838
+ /* Background */
839
+ background-color: white;
840
+
841
+ /* Interaction */
842
+ cursor: pointer;
843
+ position: relative;
844
+ transition: background-color 0.15s ease, border-color 0.15s ease;
845
+ }
846
+
847
+ input[type='checkbox']:hover:not(:disabled) {
848
+ border-color: var(--consent-primary, #2563eb);
849
+ }
850
+
851
+ input[type='checkbox']:focus-visible {
852
+ outline: 2px solid var(--consent-primary, #2563eb);
853
+ outline-offset: 2px;
854
+ }
855
+
856
+ /* Checked state */
857
+ input[type='checkbox']:checked {
858
+ background-color: var(--consent-primary, #2563eb);
859
+ border-color: var(--consent-primary, #2563eb);
860
+ }
861
+
862
+ /* Checkmark */
863
+ input[type='checkbox']:checked::after {
864
+ content: '';
865
+ position: absolute;
866
+ left: 4px;
867
+ top: 1px;
868
+ width: 5px;
869
+ height: 9px;
870
+ border: solid white;
871
+ border-width: 0 2px 2px 0;
872
+ transform: rotate(45deg);
873
+ }
874
+
875
+ /* Disabled */
876
+ input[type='checkbox']:disabled {
877
+ cursor: not-allowed;
878
+ opacity: 0.5;
879
+ }
880
+
881
+ /* Text wrapper */
882
+ .text {
883
+ flex: 1;
884
+ }
885
+
886
+ /* Links in label */
887
+ ::slotted(a) {
888
+ color: var(--consent-primary, #2563eb);
889
+ text-decoration: underline;
890
+ }
891
+
892
+ ::slotted(a:hover) {
893
+ text-decoration: none;
894
+ }
895
+ `;
896
+ __decorateClass([
897
+ n4({ type: String })
898
+ ], ConsentCheckbox.prototype, "name", 2);
899
+ __decorateClass([
900
+ n4({ type: Boolean, reflect: true })
901
+ ], ConsentCheckbox.prototype, "checked", 2);
902
+ __decorateClass([
903
+ n4({ type: Boolean })
904
+ ], ConsentCheckbox.prototype, "required", 2);
905
+ __decorateClass([
906
+ n4({ type: Boolean, reflect: true })
907
+ ], ConsentCheckbox.prototype, "disabled", 2);
908
+ __decorateClass([
909
+ n4({ type: String })
910
+ ], ConsentCheckbox.prototype, "value", 2);
911
+ ConsentCheckbox = __decorateClass([
912
+ t3("consent-checkbox")
913
+ ], ConsentCheckbox);
914
+
915
+ // src/components/consent-input.ts
916
+ var ConsentInput = class extends i4 {
917
+ constructor() {
918
+ super();
919
+ this.type = "text";
920
+ this.name = "";
921
+ this.value = "";
922
+ this.label = "";
923
+ this.placeholder = "";
924
+ this.required = false;
925
+ this.disabled = false;
926
+ this.autocomplete = "";
927
+ this.showPassword = false;
928
+ this.internals = this.attachInternals();
929
+ }
930
+ // Update form value when properties change
931
+ updated(changedProperties) {
932
+ if (changedProperties.has("value")) {
933
+ this.internals.setFormValue(this.value || null);
934
+ }
935
+ }
936
+ handleInput(e8) {
937
+ const input = e8.target;
938
+ this.value = input.value;
939
+ this.internals.setFormValue(this.value || null);
940
+ this.dispatchEvent(
941
+ new CustomEvent("input", {
942
+ detail: { value: this.value },
943
+ bubbles: true,
944
+ composed: true
945
+ })
946
+ );
947
+ }
948
+ handleChange(e8) {
949
+ const input = e8.target;
950
+ this.value = input.value;
951
+ this.dispatchEvent(
952
+ new CustomEvent("change", {
953
+ detail: { value: this.value },
954
+ bubbles: true,
955
+ composed: true
956
+ })
957
+ );
958
+ }
959
+ togglePasswordVisibility() {
960
+ this.showPassword = !this.showPassword;
961
+ }
962
+ renderPasswordToggle() {
963
+ if (this.type !== "password") return null;
964
+ const icon = this.showPassword ? x`
965
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
966
+ <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>
967
+ <line x1="1" y1="1" x2="23" y2="23"/>
968
+ </svg>
969
+ ` : x`
970
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
971
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
972
+ <circle cx="12" cy="12" r="3"/>
973
+ </svg>
974
+ `;
975
+ return x`
976
+ <button
977
+ type="button"
978
+ class="password-toggle"
979
+ @click=${this.togglePasswordVisibility}
980
+ tabindex="-1"
981
+ aria-label=${this.showPassword ? "Hide password" : "Show password"}
982
+ >
983
+ ${icon}
984
+ </button>
985
+ `;
986
+ }
987
+ render() {
988
+ const inputType = this.type === "password" && this.showPassword ? "text" : this.type;
989
+ return x`
990
+ <div class="field">
991
+ ${this.label ? x`
992
+ <label part="label" for="input">
993
+ ${this.label}${this.required ? x`<span class="required">*</span>` : null}
994
+ </label>
995
+ ` : null}
996
+ <div class="input-wrapper${this.error ? " has-error" : ""}">
997
+ <input
998
+ part="input"
999
+ id="input"
1000
+ type=${inputType}
1001
+ name=${this.name}
1002
+ .value=${this.value}
1003
+ placeholder=${this.placeholder}
1004
+ ?required=${this.required}
1005
+ ?disabled=${this.disabled}
1006
+ autocomplete=${this.autocomplete || "off"}
1007
+ @input=${this.handleInput}
1008
+ @change=${this.handleChange}
1009
+ />
1010
+ ${this.renderPasswordToggle()}
1011
+ </div>
1012
+ ${this.error ? x`<div class="error-message">${this.error}</div>` : null}
1013
+ </div>
1014
+ `;
1015
+ }
1016
+ };
1017
+ // Enable form association
1018
+ ConsentInput.formAssociated = true;
1019
+ ConsentInput.styles = i`
1020
+ :host {
1021
+ display: block;
1022
+ }
1023
+
1024
+ .field {
1025
+ display: flex;
1026
+ flex-direction: column;
1027
+ gap: 0.375rem;
1028
+ }
1029
+
1030
+ label {
1031
+ font-size: 0.875rem;
1032
+ font-weight: 500;
1033
+ color: #374151;
1034
+ }
1035
+
1036
+ .input-wrapper {
1037
+ position: relative;
1038
+ display: flex;
1039
+ align-items: center;
1040
+ }
1041
+
1042
+ /* Base input styles - use .input-wrapper for higher specificity */
1043
+ .input-wrapper input {
1044
+ width: 100%;
1045
+ padding: 0.625rem 0.75rem;
1046
+ font-size: 0.875rem;
1047
+ font-family: inherit;
1048
+ color: #111827;
1049
+ background-color: white;
1050
+ border: 1px solid #d1d5db;
1051
+ border-radius: 0.5rem;
1052
+ outline: none;
1053
+ box-shadow: none;
1054
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
1055
+ }
1056
+
1057
+ .input-wrapper input:focus {
1058
+ border-color: var(--consent-primary, #2563eb);
1059
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
1060
+ }
1061
+
1062
+ .input-wrapper input:disabled {
1063
+ background-color: #f9fafb;
1064
+ cursor: not-allowed;
1065
+ opacity: 0.6;
1066
+ }
1067
+
1068
+ .input-wrapper input::placeholder {
1069
+ color: #9ca3af;
1070
+ }
1071
+
1072
+ /* Prevent browser validation styling before user interaction */
1073
+ .input-wrapper input:invalid {
1074
+ border-color: #d1d5db;
1075
+ box-shadow: none;
1076
+ outline: none;
1077
+ background-color: white;
1078
+ }
1079
+
1080
+ /* Override browser autofill styling */
1081
+ .input-wrapper input:-webkit-autofill,
1082
+ .input-wrapper input:-webkit-autofill:hover,
1083
+ .input-wrapper input:-webkit-autofill:focus {
1084
+ -webkit-box-shadow: 0 0 0 1000px white inset;
1085
+ -webkit-text-fill-color: #111827;
1086
+ border-color: #d1d5db;
1087
+ transition: background-color 5000s ease-in-out 0s;
1088
+ }
1089
+
1090
+ /* Only show validation styling after user interaction */
1091
+ .input-wrapper input:user-invalid {
1092
+ border-color: #ef4444;
1093
+ }
1094
+
1095
+ .input-wrapper input:user-invalid:focus {
1096
+ border-color: #ef4444;
1097
+ box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
1098
+ }
1099
+
1100
+ /* Password toggle */
1101
+ .input-wrapper input[type='password'] {
1102
+ padding-right: 2.5rem;
1103
+ }
1104
+
1105
+ .password-toggle {
1106
+ position: absolute;
1107
+ right: 0.5rem;
1108
+ padding: 0.375rem;
1109
+ background: none;
1110
+ border: none;
1111
+ cursor: pointer;
1112
+ color: #6b7280;
1113
+ display: flex;
1114
+ align-items: center;
1115
+ justify-content: center;
1116
+ }
1117
+
1118
+ .password-toggle:hover {
1119
+ color: #374151;
1120
+ }
1121
+
1122
+ .password-toggle svg {
1123
+ width: 1.25rem;
1124
+ height: 1.25rem;
1125
+ }
1126
+
1127
+ /* Error state - use class instead of attribute for proper specificity */
1128
+ .input-wrapper.has-error input {
1129
+ border-color: #ef4444;
1130
+ }
1131
+
1132
+ .input-wrapper.has-error input:focus {
1133
+ border-color: #ef4444;
1134
+ box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
1135
+ }
1136
+
1137
+ .error-message {
1138
+ font-size: 0.75rem;
1139
+ color: #ef4444;
1140
+ margin-top: 0.25rem;
1141
+ }
1142
+
1143
+ /* Required indicator */
1144
+ .required {
1145
+ color: #ef4444;
1146
+ margin-left: 0.125rem;
1147
+ }
1148
+ `;
1149
+ __decorateClass([
1150
+ n4({ type: String })
1151
+ ], ConsentInput.prototype, "type", 2);
1152
+ __decorateClass([
1153
+ n4({ type: String })
1154
+ ], ConsentInput.prototype, "name", 2);
1155
+ __decorateClass([
1156
+ n4({ type: String })
1157
+ ], ConsentInput.prototype, "value", 2);
1158
+ __decorateClass([
1159
+ n4({ type: String })
1160
+ ], ConsentInput.prototype, "label", 2);
1161
+ __decorateClass([
1162
+ n4({ type: String })
1163
+ ], ConsentInput.prototype, "placeholder", 2);
1164
+ __decorateClass([
1165
+ n4({ type: Boolean })
1166
+ ], ConsentInput.prototype, "required", 2);
1167
+ __decorateClass([
1168
+ n4({ type: Boolean, reflect: true })
1169
+ ], ConsentInput.prototype, "disabled", 2);
1170
+ __decorateClass([
1171
+ n4({ type: String })
1172
+ ], ConsentInput.prototype, "autocomplete", 2);
1173
+ __decorateClass([
1174
+ n4({ type: String })
1175
+ ], ConsentInput.prototype, "error", 2);
1176
+ __decorateClass([
1177
+ r5()
1178
+ ], ConsentInput.prototype, "showPassword", 2);
1179
+ ConsentInput = __decorateClass([
1180
+ t3("consent-input")
1181
+ ], ConsentInput);
1182
+
1183
+ // src/components/consent-shell.ts
1184
+ var ConsentShell = class extends i4 {
1185
+ constructor() {
1186
+ super(...arguments);
1187
+ this.pageTitle = "Permission Request";
1188
+ this.primaryColor = "#2563EB";
1189
+ this.secondaryColor = "#DBEAFE";
1190
+ }
1191
+ renderLogo() {
1192
+ if (this.logoUrl) {
1193
+ return x`
1194
+ <img
1195
+ class="logo"
1196
+ src=${this.logoUrl}
1197
+ alt=${this.companyName || "Company logo"}
1198
+ />
1199
+ `;
1200
+ }
1201
+ return x`
1202
+ <div class="default-icon">
1203
+ <svg
1204
+ xmlns="http://www.w3.org/2000/svg"
1205
+ viewBox="0 0 24 24"
1206
+ fill="none"
1207
+ stroke="currentColor"
1208
+ stroke-width="2"
1209
+ stroke-linecap="round"
1210
+ stroke-linejoin="round"
1211
+ >
1212
+ <path
1213
+ d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"
1214
+ fill="currentColor"
1215
+ opacity="0.2"
1216
+ />
1217
+ <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
1218
+ </svg>
1219
+ </div>
1220
+ `;
1221
+ }
1222
+ updated(changedProperties) {
1223
+ if (changedProperties.has("primaryColor") || changedProperties.has("secondaryColor")) {
1224
+ this.style.setProperty("--consent-primary", this.primaryColor);
1225
+ this.style.setProperty("--consent-secondary", this.secondaryColor);
1226
+ }
1227
+ }
1228
+ render() {
1229
+ return x`
1230
+ <div class="container" part="container">
1231
+ <header class="header" part="header">
1232
+ ${this.renderLogo()}
1233
+ ${this.companyName ? x`<div class="company-name">${this.companyName}</div>` : null}
1234
+ <h1 class="title">${this.pageTitle}</h1>
1235
+ </header>
1236
+
1237
+ <div class="content" part="content">
1238
+ <slot name="content"></slot>
1239
+ </div>
1240
+
1241
+ <footer class="footer" part="footer">
1242
+ <slot name="footer"></slot>
1243
+ </footer>
1244
+ </div>
1245
+ `;
1246
+ }
1247
+ };
1248
+ ConsentShell.styles = i`
1249
+ :host {
1250
+ display: block;
1251
+ /* System font stack with font smoothing for crisp text */
1252
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
1253
+ 'Helvetica Neue', Arial, sans-serif;
1254
+ -webkit-font-smoothing: antialiased;
1255
+ -moz-osx-font-smoothing: grayscale;
1256
+ /* Allow customization via CSS variables */
1257
+ --_primary: var(--consent-primary, #2563eb);
1258
+ --_secondary: var(--consent-secondary, #dbeafe);
1259
+ }
1260
+
1261
+ /* Container - matches AgentShield PreviewShell exactly */
1262
+ .container {
1263
+ background: white;
1264
+ border-radius: 20px;
1265
+ border: 1px solid rgba(0, 0, 0, 0.1);
1266
+ box-shadow:
1267
+ 0 20px 25px -5px rgba(0, 0, 0, 0.1),
1268
+ 0 8px 10px -6px rgba(0, 0, 0, 0.1);
1269
+ overflow: hidden;
1270
+ max-width: 512px;
1271
+ width: 100%;
1272
+ margin: 0 auto;
1273
+ }
1274
+
1275
+ /* Header */
1276
+ .header {
1277
+ padding: 1.25rem 2rem 0;
1278
+ text-align: center;
1279
+ }
1280
+
1281
+ .logo {
1282
+ max-height: 48px;
1283
+ max-width: 200px;
1284
+ margin-bottom: 0.5rem;
1285
+ }
1286
+
1287
+ .company-name {
1288
+ font-size: 0.875rem;
1289
+ color: #6b7280;
1290
+ margin-bottom: 0.5rem;
1291
+ }
1292
+
1293
+ .title {
1294
+ font-size: 1.5rem;
1295
+ font-weight: 700;
1296
+ color: #333333;
1297
+ margin: 0;
1298
+ }
1299
+
1300
+ /* Content */
1301
+ .content {
1302
+ padding: 1rem 2rem 2rem;
1303
+ }
1304
+
1305
+ /* Footer */
1306
+ .footer {
1307
+ padding: 0 2rem 2rem;
1308
+ display: flex;
1309
+ gap: 0.75rem;
1310
+ }
1311
+
1312
+ .footer ::slotted(*) {
1313
+ flex: 1;
1314
+ }
1315
+
1316
+ /* Default icon when no logo */
1317
+ .default-icon {
1318
+ width: 48px;
1319
+ height: 48px;
1320
+ margin: 0 auto 0.5rem;
1321
+ background: var(--_secondary);
1322
+ border-radius: 12px;
1323
+ display: flex;
1324
+ align-items: center;
1325
+ justify-content: center;
1326
+ }
1327
+
1328
+ .default-icon svg {
1329
+ width: 24px;
1330
+ height: 24px;
1331
+ color: var(--_primary);
1332
+ }
1333
+ `;
1334
+ __decorateClass([
1335
+ n4({ type: String, attribute: "page-title" })
1336
+ ], ConsentShell.prototype, "pageTitle", 2);
1337
+ __decorateClass([
1338
+ n4({ type: String, attribute: "logo-url" })
1339
+ ], ConsentShell.prototype, "logoUrl", 2);
1340
+ __decorateClass([
1341
+ n4({ type: String, attribute: "company-name" })
1342
+ ], ConsentShell.prototype, "companyName", 2);
1343
+ __decorateClass([
1344
+ n4({ type: String, attribute: "primary-color" })
1345
+ ], ConsentShell.prototype, "primaryColor", 2);
1346
+ __decorateClass([
1347
+ n4({ type: String, attribute: "secondary-color" })
1348
+ ], ConsentShell.prototype, "secondaryColor", 2);
1349
+ ConsentShell = __decorateClass([
1350
+ t3("consent-shell")
1351
+ ], ConsentShell);
1352
+
1353
+ // src/components/consent-permissions.ts
1354
+ var ConsentPermissions = class extends i4 {
1355
+ constructor() {
1356
+ super(...arguments);
1357
+ this.scopes = [];
1358
+ this.interactive = false;
1359
+ this.selectAll = false;
1360
+ this.iconStyle = "check";
1361
+ this.selectedScopes = /* @__PURE__ */ new Set();
1362
+ /**
1363
+ * Track previous scope IDs to detect newly added scopes
1364
+ * (used to distinguish new scopes from user-deselected scopes)
1365
+ */
1366
+ this.previousScopeIds = /* @__PURE__ */ new Set();
1367
+ }
1368
+ connectedCallback() {
1369
+ super.connectedCallback();
1370
+ if (this.interactive) {
1371
+ this.initializeSelectedScopes();
1372
+ }
1373
+ }
1374
+ updated(changedProperties) {
1375
+ if (changedProperties.has("scopes") && this.interactive) {
1376
+ this.reinitializeSelectedScopes();
1377
+ }
1378
+ }
1379
+ /**
1380
+ * Re-initialize selected scopes when scopes change dynamically.
1381
+ * Preserves existing valid selections while adding new scopes based on selectAll/required settings.
1382
+ */
1383
+ reinitializeSelectedScopes() {
1384
+ const currentScopeIds = new Set(this.normalizedScopes.map((s4) => s4.id));
1385
+ const validSelections = new Set(
1386
+ Array.from(this.selectedScopes).filter((id) => currentScopeIds.has(id))
1387
+ );
1388
+ const newScopeIds = Array.from(currentScopeIds).filter(
1389
+ (id) => !this.previousScopeIds.has(id)
1390
+ );
1391
+ if (this.selectAll) {
1392
+ this.selectedScopes = /* @__PURE__ */ new Set([...validSelections, ...newScopeIds]);
1393
+ } else {
1394
+ const requiredIds = this.normalizedScopes.filter((s4) => s4.required).map((s4) => s4.id);
1395
+ this.selectedScopes = /* @__PURE__ */ new Set([...validSelections, ...requiredIds]);
1396
+ }
1397
+ this.previousScopeIds = currentScopeIds;
1398
+ this.dispatchEvent(
1399
+ new CustomEvent("change", {
1400
+ detail: { selected: this.getSelectedScopes() },
1401
+ bubbles: true,
1402
+ composed: true
1403
+ })
1404
+ );
1405
+ }
1406
+ initializeSelectedScopes() {
1407
+ this.previousScopeIds = new Set(
1408
+ this.normalizedScopes.map((scope) => scope.id)
1409
+ );
1410
+ if (this.selectAll) {
1411
+ this.selectedScopes = new Set(
1412
+ this.normalizedScopes.map((scope) => scope.id)
1413
+ );
1414
+ } else {
1415
+ this.selectedScopes = new Set(
1416
+ this.normalizedScopes.filter((scope) => scope.required).map((scope) => scope.id)
1417
+ );
1418
+ }
1419
+ }
1420
+ /**
1421
+ * Normalize scopes to PermissionItem format
1422
+ */
1423
+ get normalizedScopes() {
1424
+ return this.scopes.map((scope) => {
1425
+ if (typeof scope === "string") {
1426
+ return {
1427
+ id: scope,
1428
+ label: this.formatScopeLabel(scope)
1429
+ };
1430
+ }
1431
+ return scope;
1432
+ });
1433
+ }
1434
+ /**
1435
+ * Convert scope ID to human-readable label
1436
+ */
1437
+ formatScopeLabel(scopeId) {
1438
+ return scopeId.replace(/[_:-]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
1439
+ }
1440
+ /**
1441
+ * Get currently selected scopes
1442
+ */
1443
+ getSelectedScopes() {
1444
+ return Array.from(this.selectedScopes);
1445
+ }
1446
+ handleCheckboxChange(scopeId, checked) {
1447
+ if (checked) {
1448
+ this.selectedScopes.add(scopeId);
1449
+ } else {
1450
+ this.selectedScopes.delete(scopeId);
1451
+ }
1452
+ this.requestUpdate();
1453
+ this.dispatchEvent(
1454
+ new CustomEvent("change", {
1455
+ detail: { selected: this.getSelectedScopes() },
1456
+ bubbles: true,
1457
+ composed: true
1458
+ })
1459
+ );
1460
+ }
1461
+ renderIcon() {
1462
+ switch (this.iconStyle) {
1463
+ case "bullet":
1464
+ return x`<div class="icon icon-bullet"></div>`;
1465
+ case "shield":
1466
+ return x`
1467
+ <div class="icon icon-shield">
1468
+ <svg
1469
+ xmlns="http://www.w3.org/2000/svg"
1470
+ viewBox="0 0 24 24"
1471
+ fill="none"
1472
+ stroke="currentColor"
1473
+ stroke-width="2"
1474
+ >
1475
+ <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
1476
+ </svg>
1477
+ </div>
1478
+ `;
1479
+ default:
1480
+ return x`
1481
+ <div class="icon icon-check">
1482
+ <svg
1483
+ xmlns="http://www.w3.org/2000/svg"
1484
+ viewBox="0 0 24 24"
1485
+ fill="none"
1486
+ stroke="currentColor"
1487
+ stroke-width="2"
1488
+ >
1489
+ <polyline points="20 6 9 17 4 12" />
1490
+ </svg>
1491
+ </div>
1492
+ `;
1493
+ }
1494
+ }
1495
+ renderPermissionItem(scope) {
1496
+ const isSelected = this.selectedScopes.has(scope.id);
1497
+ return x`
1498
+ <li class="permission-item" part="item">
1499
+ ${this.interactive ? x`
1500
+ <input
1501
+ type="checkbox"
1502
+ class="checkbox"
1503
+ .checked=${isSelected}
1504
+ ?disabled=${scope.required}
1505
+ @change=${(e8) => this.handleCheckboxChange(
1506
+ scope.id,
1507
+ e8.target.checked
1508
+ )}
1509
+ aria-label=${scope.label}
1510
+ />
1511
+ ` : this.renderIcon()}
1512
+ <div class="content">
1513
+ <span class="label">
1514
+ ${scope.label}
1515
+ ${scope.required ? x`<span class="required-badge">Required</span>` : null}
1516
+ </span>
1517
+ ${scope.description ? x`<div class="description">${scope.description}</div>` : null}
1518
+ </div>
1519
+ </li>
1520
+ `;
1521
+ }
1522
+ render() {
1523
+ const scopes = this.normalizedScopes;
1524
+ if (scopes.length === 0) {
1525
+ return x`<div class="empty">No permissions requested</div>`;
1526
+ }
1527
+ return x`
1528
+ <ul class="permission-list" part="list" role="list">
1529
+ ${scopes.map((scope) => this.renderPermissionItem(scope))}
1530
+ </ul>
1531
+ `;
1532
+ }
1533
+ };
1534
+ ConsentPermissions.styles = i`
1535
+ :host {
1536
+ display: block;
1537
+ --_primary: var(--consent-primary, #2563eb);
1538
+ }
1539
+
1540
+ .permission-list {
1541
+ list-style: none;
1542
+ padding: 0;
1543
+ margin: 0;
1544
+ }
1545
+
1546
+ .permission-item {
1547
+ display: flex;
1548
+ align-items: flex-start;
1549
+ gap: 0.75rem;
1550
+ padding: 0.625rem 0;
1551
+ font-size: 0.875rem;
1552
+ color: #374151;
1553
+ border-bottom: 1px solid #f3f4f6;
1554
+ }
1555
+
1556
+ .permission-item:last-child {
1557
+ border-bottom: none;
1558
+ }
1559
+
1560
+ /* Icon styles */
1561
+ .icon {
1562
+ flex-shrink: 0;
1563
+ width: 1.25rem;
1564
+ height: 1.25rem;
1565
+ margin-top: 0.0625rem;
1566
+ }
1567
+
1568
+ .icon-check {
1569
+ background: var(--_primary);
1570
+ border-radius: 0.25rem;
1571
+ display: flex;
1572
+ align-items: center;
1573
+ justify-content: center;
1574
+ }
1575
+
1576
+ .icon-check svg {
1577
+ width: 0.75rem;
1578
+ height: 0.75rem;
1579
+ color: white;
1580
+ }
1581
+
1582
+ .icon-bullet {
1583
+ background: var(--_primary);
1584
+ border-radius: 50%;
1585
+ width: 0.5rem;
1586
+ height: 0.5rem;
1587
+ margin: 0.375rem;
1588
+ }
1589
+
1590
+ .icon-shield {
1591
+ color: var(--_primary);
1592
+ }
1593
+
1594
+ .icon-shield svg {
1595
+ width: 1.25rem;
1596
+ height: 1.25rem;
1597
+ }
1598
+
1599
+ /* Content */
1600
+ .content {
1601
+ flex: 1;
1602
+ }
1603
+
1604
+ .label {
1605
+ font-weight: 500;
1606
+ color: #111827;
1607
+ }
1608
+
1609
+ .description {
1610
+ font-size: 0.75rem;
1611
+ color: #6b7280;
1612
+ margin-top: 0.125rem;
1613
+ }
1614
+
1615
+ .required-badge {
1616
+ font-size: 0.625rem;
1617
+ text-transform: uppercase;
1618
+ letter-spacing: 0.05em;
1619
+ color: #6b7280;
1620
+ background: #f3f4f6;
1621
+ padding: 0.125rem 0.375rem;
1622
+ border-radius: 0.25rem;
1623
+ margin-left: 0.5rem;
1624
+ }
1625
+
1626
+ /* Interactive mode checkbox */
1627
+ .checkbox {
1628
+ appearance: none;
1629
+ -webkit-appearance: none;
1630
+ width: 1rem;
1631
+ height: 1rem;
1632
+ border: 1px solid #d1d5db;
1633
+ border-radius: 0.25rem;
1634
+ background: white;
1635
+ cursor: pointer;
1636
+ position: relative;
1637
+ flex-shrink: 0;
1638
+ margin-top: 0.125rem;
1639
+ }
1640
+
1641
+ .checkbox:checked {
1642
+ background: var(--_primary);
1643
+ border-color: var(--_primary);
1644
+ }
1645
+
1646
+ .checkbox:checked::after {
1647
+ content: '';
1648
+ position: absolute;
1649
+ left: 4px;
1650
+ top: 1px;
1651
+ width: 5px;
1652
+ height: 9px;
1653
+ border: solid white;
1654
+ border-width: 0 2px 2px 0;
1655
+ transform: rotate(45deg);
1656
+ }
1657
+
1658
+ .checkbox:disabled {
1659
+ opacity: 0.5;
1660
+ cursor: not-allowed;
1661
+ }
1662
+
1663
+ .checkbox:focus-visible {
1664
+ outline: 2px solid var(--_primary);
1665
+ outline-offset: 2px;
1666
+ }
1667
+
1668
+ /* Empty state */
1669
+ .empty {
1670
+ text-align: center;
1671
+ color: #6b7280;
1672
+ font-size: 0.875rem;
1673
+ padding: 1rem 0;
1674
+ }
1675
+ `;
1676
+ __decorateClass([
1677
+ n4({
1678
+ type: Array,
1679
+ converter: {
1680
+ fromAttribute: (value) => {
1681
+ if (!value) return [];
1682
+ try {
1683
+ const parsed = JSON.parse(value);
1684
+ if (!Array.isArray(parsed)) {
1685
+ console.warn("[consent-permissions] Expected array, got:", typeof parsed);
1686
+ return [];
1687
+ }
1688
+ return parsed;
1689
+ } catch {
1690
+ return [];
1691
+ }
1692
+ },
1693
+ toAttribute: (value) => {
1694
+ return JSON.stringify(value);
1695
+ }
1696
+ }
1697
+ })
1698
+ ], ConsentPermissions.prototype, "scopes", 2);
1699
+ __decorateClass([
1700
+ n4({ type: Boolean })
1701
+ ], ConsentPermissions.prototype, "interactive", 2);
1702
+ __decorateClass([
1703
+ n4({ type: Boolean, attribute: "select-all" })
1704
+ ], ConsentPermissions.prototype, "selectAll", 2);
1705
+ __decorateClass([
1706
+ n4({ type: String, attribute: "icon-style" })
1707
+ ], ConsentPermissions.prototype, "iconStyle", 2);
1708
+ __decorateClass([
1709
+ r5()
1710
+ ], ConsentPermissions.prototype, "selectedScopes", 2);
1711
+ ConsentPermissions = __decorateClass([
1712
+ t3("consent-permissions")
1713
+ ], ConsentPermissions);
1714
+
1715
+ // src/components/consent-terms.ts
1716
+ var ConsentTerms = class extends i4 {
1717
+ constructor() {
1718
+ super();
1719
+ this.name = "termsAccepted";
1720
+ this.text = "Terms and Conditions";
1721
+ this.labelPrefix = "I agree to the";
1722
+ this.conjunction = "and";
1723
+ this.checked = false;
1724
+ this.required = true;
1725
+ this.disabled = false;
1726
+ this.value = "accepted";
1727
+ this.internals = this.attachInternals();
1728
+ }
1729
+ updated(changedProperties) {
1730
+ if (changedProperties.has("checked") || changedProperties.has("value")) {
1731
+ this.updateFormValue();
1732
+ }
1733
+ }
1734
+ updateFormValue() {
1735
+ if (this.checked) {
1736
+ this.internals.setFormValue(this.value);
1737
+ } else {
1738
+ this.internals.setFormValue(null);
1739
+ }
1740
+ }
1741
+ handleChange(e8) {
1742
+ const input = e8.target;
1743
+ this.checked = input.checked;
1744
+ this.updateFormValue();
1745
+ this.dispatchEvent(
1746
+ new CustomEvent("change", {
1747
+ detail: { checked: this.checked, value: this.value },
1748
+ bubbles: true,
1749
+ composed: true
1750
+ })
1751
+ );
1752
+ }
1753
+ renderLink(text, url) {
1754
+ if (url) {
1755
+ return x`<a
1756
+ href=${url}
1757
+ target="_blank"
1758
+ rel="noopener noreferrer"
1759
+ part="link"
1760
+ @click=${(e8) => e8.stopPropagation()}
1761
+ >${text}</a
1762
+ >`;
1763
+ }
1764
+ return x`<span>${text}</span>`;
1765
+ }
1766
+ render() {
1767
+ const hasPrivacy = this.privacyText && this.privacyUrl;
1768
+ return x`
1769
+ <label part="label">
1770
+ <input
1771
+ part="checkbox"
1772
+ type="checkbox"
1773
+ name=${this.name}
1774
+ .value=${this.value}
1775
+ .checked=${this.checked}
1776
+ ?required=${this.required}
1777
+ ?disabled=${this.disabled}
1778
+ @change=${this.handleChange}
1779
+ />
1780
+ <span class="text">
1781
+ ${this.labelPrefix} ${this.renderLink(this.text, this.url)}
1782
+ ${hasPrivacy ? x`
1783
+ ${this.conjunction}
1784
+ ${this.renderLink(this.privacyText, this.privacyUrl)}
1785
+ ` : E}
1786
+ ${this.required ? x`<span class="required">*</span>` : E}
1787
+ </span>
1788
+ </label>
1789
+ `;
1790
+ }
1791
+ };
1792
+ // Enable form association
1793
+ ConsentTerms.formAssociated = true;
1794
+ ConsentTerms.styles = i`
1795
+ :host {
1796
+ display: block;
1797
+ --_primary: var(--consent-primary, #2563eb);
1798
+ }
1799
+
1800
+ label {
1801
+ display: flex;
1802
+ align-items: flex-start;
1803
+ gap: 0.75rem;
1804
+ cursor: pointer;
1805
+ font-size: 0.875rem;
1806
+ color: #374151;
1807
+ line-height: 1.5;
1808
+ }
1809
+
1810
+ :host([disabled]) label {
1811
+ cursor: not-allowed;
1812
+ opacity: 0.6;
1813
+ }
1814
+
1815
+ /* Custom checkbox styling - matches AgentShield exactly */
1816
+ input[type='checkbox'] {
1817
+ appearance: none;
1818
+ -webkit-appearance: none;
1819
+ margin: 0;
1820
+
1821
+ /* Size - matches AgentShield w-4 h-4 */
1822
+ width: 1rem;
1823
+ height: 1rem;
1824
+ min-width: 1rem;
1825
+ margin-top: 0.125rem;
1826
+
1827
+ /* Border */
1828
+ border: 1px solid #d1d5db;
1829
+ border-radius: 0.25rem;
1830
+
1831
+ /* Background */
1832
+ background-color: white;
1833
+
1834
+ /* Interaction */
1835
+ cursor: pointer;
1836
+ position: relative;
1837
+ transition: background-color 0.15s ease, border-color 0.15s ease;
1838
+ }
1839
+
1840
+ input[type='checkbox']:hover:not(:disabled) {
1841
+ border-color: var(--_primary);
1842
+ }
1843
+
1844
+ input[type='checkbox']:focus-visible {
1845
+ outline: 2px solid var(--_primary);
1846
+ outline-offset: 2px;
1847
+ }
1848
+
1849
+ /* Checked state */
1850
+ input[type='checkbox']:checked {
1851
+ background-color: var(--_primary);
1852
+ border-color: var(--_primary);
1853
+ }
1854
+
1855
+ /* Checkmark */
1856
+ input[type='checkbox']:checked::after {
1857
+ content: '';
1858
+ position: absolute;
1859
+ left: 4px;
1860
+ top: 1px;
1861
+ width: 5px;
1862
+ height: 9px;
1863
+ border: solid white;
1864
+ border-width: 0 2px 2px 0;
1865
+ transform: rotate(45deg);
1866
+ }
1867
+
1868
+ /* Disabled */
1869
+ input[type='checkbox']:disabled {
1870
+ cursor: not-allowed;
1871
+ opacity: 0.5;
1872
+ }
1873
+
1874
+ /* Text wrapper */
1875
+ .text {
1876
+ flex: 1;
1877
+ }
1878
+
1879
+ /* Links */
1880
+ a {
1881
+ color: var(--_primary);
1882
+ text-decoration: underline;
1883
+ text-underline-offset: 2px;
1884
+ }
1885
+
1886
+ a:hover {
1887
+ text-decoration: none;
1888
+ }
1889
+
1890
+ a:focus-visible {
1891
+ outline: 2px solid var(--_primary);
1892
+ outline-offset: 2px;
1893
+ border-radius: 2px;
1894
+ }
1895
+
1896
+ /* Required indicator */
1897
+ .required {
1898
+ color: #ef4444;
1899
+ margin-left: 0.125rem;
1900
+ }
1901
+ `;
1902
+ __decorateClass([
1903
+ n4({ type: String })
1904
+ ], ConsentTerms.prototype, "name", 2);
1905
+ __decorateClass([
1906
+ n4({ type: String })
1907
+ ], ConsentTerms.prototype, "text", 2);
1908
+ __decorateClass([
1909
+ n4({ type: String })
1910
+ ], ConsentTerms.prototype, "url", 2);
1911
+ __decorateClass([
1912
+ n4({ type: String, attribute: "privacy-text" })
1913
+ ], ConsentTerms.prototype, "privacyText", 2);
1914
+ __decorateClass([
1915
+ n4({ type: String, attribute: "privacy-url" })
1916
+ ], ConsentTerms.prototype, "privacyUrl", 2);
1917
+ __decorateClass([
1918
+ n4({ type: String, attribute: "label-prefix" })
1919
+ ], ConsentTerms.prototype, "labelPrefix", 2);
1920
+ __decorateClass([
1921
+ n4({ type: String })
1922
+ ], ConsentTerms.prototype, "conjunction", 2);
1923
+ __decorateClass([
1924
+ n4({ type: Boolean, reflect: true })
1925
+ ], ConsentTerms.prototype, "checked", 2);
1926
+ __decorateClass([
1927
+ n4({ type: Boolean })
1928
+ ], ConsentTerms.prototype, "required", 2);
1929
+ __decorateClass([
1930
+ n4({ type: Boolean, reflect: true })
1931
+ ], ConsentTerms.prototype, "disabled", 2);
1932
+ __decorateClass([
1933
+ n4({ type: String })
1934
+ ], ConsentTerms.prototype, "value", 2);
1935
+ ConsentTerms = __decorateClass([
1936
+ t3("consent-terms")
1937
+ ], ConsentTerms);
1938
+
1939
+ // ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.js
1940
+ var t4 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
1941
+ var e6 = (t6) => (...e8) => ({ _$litDirective$: t6, values: e8 });
1942
+ var i5 = class {
1943
+ constructor(t6) {
1944
+ }
1945
+ get _$AU() {
1946
+ return this._$AM._$AU;
1947
+ }
1948
+ _$AT(t6, e8, i6) {
1949
+ this._$Ct = t6, this._$AM = e8, this._$Ci = i6;
1950
+ }
1951
+ _$AS(t6, e8) {
1952
+ return this.update(t6, e8);
1953
+ }
1954
+ update(t6, e8) {
1955
+ return this.render(...e8);
1956
+ }
1957
+ };
1958
+
1959
+ // ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-html.js
1960
+ var e7 = class extends i5 {
1961
+ constructor(i6) {
1962
+ if (super(i6), this.it = E, i6.type !== t4.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
1963
+ }
1964
+ render(r7) {
1965
+ if (r7 === E || null == r7) return this._t = void 0, this.it = r7;
1966
+ if (r7 === T) return r7;
1967
+ if ("string" != typeof r7) throw Error(this.constructor.directiveName + "() called with a non-string value");
1968
+ if (r7 === this.it) return this._t;
1969
+ this.it = r7;
1970
+ const s4 = [r7];
1971
+ return s4.raw = s4, this._t = { _$litType$: this.constructor.resultType, strings: s4, values: [] };
1972
+ }
1973
+ };
1974
+ e7.directiveName = "unsafeHTML", e7.resultType = 1;
1975
+ var o6 = e6(e7);
1976
+
1977
+ // ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/unsafe-svg.js
1978
+ var t5 = class extends e7 {
1979
+ };
1980
+ t5.directiveName = "unsafeSVG", t5.resultType = 2;
1981
+ var o7 = e6(t5);
1982
+
1983
+ // src/components/consent-oauth-button.ts
1984
+ function sanitizeSvg(svg) {
1985
+ if (!svg || typeof svg !== "string") return "";
1986
+ let sanitized = svg.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "");
1987
+ sanitized = sanitized.replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi, "");
1988
+ sanitized = sanitized.replace(/\s*on\w+\s*=\s*[^\s>]*/gi, "");
1989
+ sanitized = sanitized.replace(/(href|src|xlink:href)\s*=\s*["']?\s*javascript:[^"'>\s]*/gi, '$1=""');
1990
+ sanitized = sanitized.replace(/(href|src|xlink:href)\s*=\s*["']?\s*data:[^"'>\s]*/gi, '$1=""');
1991
+ sanitized = sanitized.replace(/data:text\/html[^"'>\s]*/gi, "");
1992
+ return sanitized;
1993
+ }
1994
+ var PROVIDER_CONFIGS = {
1995
+ google: {
1996
+ name: "Google",
1997
+ bgColor: "#ffffff",
1998
+ textColor: "#374151",
1999
+ borderColor: "#d1d5db",
2000
+ hoverBgColor: "#f9fafb"
2001
+ },
2002
+ microsoft: {
2003
+ name: "Microsoft",
2004
+ bgColor: "#2f2f2f",
2005
+ textColor: "#ffffff",
2006
+ borderColor: "#2f2f2f",
2007
+ hoverBgColor: "#1f1f1f"
2008
+ },
2009
+ apple: {
2010
+ name: "Apple",
2011
+ bgColor: "#000000",
2012
+ textColor: "#ffffff",
2013
+ borderColor: "#000000",
2014
+ hoverBgColor: "#1a1a1a"
2015
+ },
2016
+ github: {
2017
+ name: "GitHub",
2018
+ bgColor: "#24292f",
2019
+ textColor: "#ffffff",
2020
+ borderColor: "#24292f",
2021
+ hoverBgColor: "#1b1f23"
2022
+ },
2023
+ twitter: {
2024
+ name: "Twitter",
2025
+ bgColor: "#1da1f2",
2026
+ textColor: "#ffffff",
2027
+ borderColor: "#1da1f2",
2028
+ hoverBgColor: "#0c8de4"
2029
+ },
2030
+ facebook: {
2031
+ name: "Facebook",
2032
+ bgColor: "#1877f2",
2033
+ textColor: "#ffffff",
2034
+ borderColor: "#1877f2",
2035
+ hoverBgColor: "#0b5ed7"
2036
+ },
2037
+ custom: {
2038
+ name: "Sign in",
2039
+ bgColor: "#ffffff",
2040
+ textColor: "#374151",
2041
+ borderColor: "#d1d5db",
2042
+ hoverBgColor: "#f9fafb"
2043
+ }
2044
+ };
2045
+ var ConsentOAuthButton = class extends i4 {
2046
+ constructor() {
2047
+ super(...arguments);
2048
+ this.provider = "custom";
2049
+ this.url = "";
2050
+ this.loading = false;
2051
+ this.disabled = false;
2052
+ this.fullWidth = false;
2053
+ this.redirecting = false;
2054
+ }
2055
+ get config() {
2056
+ return PROVIDER_CONFIGS[this.provider] || PROVIDER_CONFIGS.custom;
2057
+ }
2058
+ get displayName() {
2059
+ if (this.providerName) return this.providerName;
2060
+ return this.config.name;
2061
+ }
2062
+ get displayText() {
2063
+ if (this.buttonText) return this.buttonText;
2064
+ return `Continue with ${this.displayName}`;
2065
+ }
2066
+ handleClick() {
2067
+ if (this.disabled || this.loading || this.redirecting) return;
2068
+ if (this.url) {
2069
+ this.redirecting = true;
2070
+ window.location.href = this.url;
2071
+ }
2072
+ this.dispatchEvent(
2073
+ new CustomEvent("oauth-click", {
2074
+ detail: { provider: this.provider, url: this.url },
2075
+ bubbles: true,
2076
+ composed: true
2077
+ })
2078
+ );
2079
+ }
2080
+ renderProviderIcon() {
2081
+ if (this.customIcon) {
2082
+ const sanitized = sanitizeSvg(this.customIcon);
2083
+ return x`<div class="icon">${o7(sanitized)}</div>`;
2084
+ }
2085
+ switch (this.provider) {
2086
+ case "google":
2087
+ return x`
2088
+ <div class="icon">
2089
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2090
+ <path
2091
+ fill="#4285F4"
2092
+ d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
2093
+ />
2094
+ <path
2095
+ fill="#34A853"
2096
+ d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
2097
+ />
2098
+ <path
2099
+ fill="#FBBC05"
2100
+ d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
2101
+ />
2102
+ <path
2103
+ fill="#EA4335"
2104
+ d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
2105
+ />
2106
+ </svg>
2107
+ </div>
2108
+ `;
2109
+ case "microsoft":
2110
+ return x`
2111
+ <div class="icon">
2112
+ <svg viewBox="0 0 21 21" xmlns="http://www.w3.org/2000/svg">
2113
+ <rect x="1" y="1" width="9" height="9" fill="#f25022" />
2114
+ <rect x="1" y="11" width="9" height="9" fill="#00a4ef" />
2115
+ <rect x="11" y="1" width="9" height="9" fill="#7fba00" />
2116
+ <rect x="11" y="11" width="9" height="9" fill="#ffb900" />
2117
+ </svg>
2118
+ </div>
2119
+ `;
2120
+ case "apple":
2121
+ return x`
2122
+ <div class="icon">
2123
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2124
+ <path
2125
+ fill="currentColor"
2126
+ d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"
2127
+ />
2128
+ </svg>
2129
+ </div>
2130
+ `;
2131
+ case "github":
2132
+ return x`
2133
+ <div class="icon">
2134
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2135
+ <path
2136
+ fill="currentColor"
2137
+ d="M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.17 6.839 9.49.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.464-1.11-1.464-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.831.092-.646.35-1.086.636-1.336-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836c.85.004 1.705.114 2.504.336 1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.167 22 16.418 22 12c0-5.523-4.477-10-10-10z"
2138
+ />
2139
+ </svg>
2140
+ </div>
2141
+ `;
2142
+ case "twitter":
2143
+ return x`
2144
+ <div class="icon">
2145
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2146
+ <path
2147
+ fill="currentColor"
2148
+ d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"
2149
+ />
2150
+ </svg>
2151
+ </div>
2152
+ `;
2153
+ case "facebook":
2154
+ return x`
2155
+ <div class="icon">
2156
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2157
+ <path
2158
+ fill="currentColor"
2159
+ d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"
2160
+ />
2161
+ </svg>
2162
+ </div>
2163
+ `;
2164
+ default:
2165
+ return E;
2166
+ }
2167
+ }
2168
+ updated(changedProperties) {
2169
+ if (changedProperties.has("provider")) {
2170
+ const config = this.config;
2171
+ this.style.setProperty("--button-bg", config.bgColor);
2172
+ this.style.setProperty("--button-text", config.textColor);
2173
+ this.style.setProperty("--button-border", config.borderColor);
2174
+ this.style.setProperty("--button-hover-bg", config.hoverBgColor);
2175
+ }
2176
+ }
2177
+ render() {
2178
+ const isLoading = this.loading || this.redirecting;
2179
+ return x`
2180
+ <button
2181
+ part="button"
2182
+ type="button"
2183
+ ?disabled=${this.disabled || isLoading}
2184
+ @click=${this.handleClick}
2185
+ style="
2186
+ background-color: var(--button-bg, ${this.config.bgColor});
2187
+ color: var(--button-text, ${this.config.textColor});
2188
+ border: 1px solid var(--button-border, ${this.config.borderColor});
2189
+ "
2190
+ aria-busy=${isLoading}
2191
+ >
2192
+ ${isLoading ? x`<span class="spinner"></span>` : this.renderProviderIcon()}
2193
+ <span class="text" part="text">${this.displayText}</span>
2194
+ </button>
2195
+ `;
2196
+ }
2197
+ };
2198
+ ConsentOAuthButton.styles = i`
2199
+ :host {
2200
+ display: inline-block;
2201
+ }
2202
+
2203
+ :host([full-width]) {
2204
+ display: block;
2205
+ width: 100%;
2206
+ }
2207
+
2208
+ button {
2209
+ width: 100%;
2210
+ padding: 0.75rem 1rem;
2211
+ height: 2.75rem;
2212
+ border-radius: 0.5rem;
2213
+ font-size: 0.875rem;
2214
+ font-weight: 500;
2215
+ font-family: inherit;
2216
+ cursor: pointer;
2217
+ transition: background-color 0.15s ease, opacity 0.15s ease;
2218
+ display: inline-flex;
2219
+ align-items: center;
2220
+ justify-content: center;
2221
+ gap: 0.75rem;
2222
+ }
2223
+
2224
+ button:disabled {
2225
+ opacity: 0.5;
2226
+ cursor: not-allowed;
2227
+ }
2228
+
2229
+ button:focus-visible {
2230
+ outline: 2px solid #2563eb;
2231
+ outline-offset: 2px;
2232
+ }
2233
+
2234
+ .icon {
2235
+ width: 1.125rem;
2236
+ height: 1.125rem;
2237
+ flex-shrink: 0;
2238
+ }
2239
+
2240
+ .icon svg {
2241
+ width: 100%;
2242
+ height: 100%;
2243
+ }
2244
+
2245
+ /* Loading spinner */
2246
+ .spinner {
2247
+ width: 1rem;
2248
+ height: 1rem;
2249
+ border: 2px solid currentColor;
2250
+ border-top-color: transparent;
2251
+ border-radius: 50%;
2252
+ animation: spin 0.8s linear infinite;
2253
+ }
2254
+
2255
+ @keyframes spin {
2256
+ to {
2257
+ transform: rotate(360deg);
2258
+ }
2259
+ }
2260
+
2261
+ .text {
2262
+ flex: 1;
2263
+ text-align: center;
2264
+ }
2265
+ `;
2266
+ __decorateClass([
2267
+ n4({ type: String })
2268
+ ], ConsentOAuthButton.prototype, "provider", 2);
2269
+ __decorateClass([
2270
+ n4({ type: String, attribute: "provider-name" })
2271
+ ], ConsentOAuthButton.prototype, "providerName", 2);
2272
+ __decorateClass([
2273
+ n4({ type: String })
2274
+ ], ConsentOAuthButton.prototype, "url", 2);
2275
+ __decorateClass([
2276
+ n4({ type: String, attribute: "button-text" })
2277
+ ], ConsentOAuthButton.prototype, "buttonText", 2);
2278
+ __decorateClass([
2279
+ n4({ type: Boolean, reflect: true })
2280
+ ], ConsentOAuthButton.prototype, "loading", 2);
2281
+ __decorateClass([
2282
+ n4({ type: Boolean, reflect: true })
2283
+ ], ConsentOAuthButton.prototype, "disabled", 2);
2284
+ __decorateClass([
2285
+ n4({ type: Boolean, attribute: "full-width" })
2286
+ ], ConsentOAuthButton.prototype, "fullWidth", 2);
2287
+ __decorateClass([
2288
+ n4({ type: String, attribute: "custom-icon" })
2289
+ ], ConsentOAuthButton.prototype, "customIcon", 2);
2290
+ __decorateClass([
2291
+ r5()
2292
+ ], ConsentOAuthButton.prototype, "redirecting", 2);
2293
+ ConsentOAuthButton = __decorateClass([
2294
+ t3("consent-oauth-button")
2295
+ ], ConsentOAuthButton);
2296
+
2297
+ // src/components/consent-otp-input.ts
2298
+ var ConsentOTPInput = class extends i4 {
2299
+ constructor() {
2300
+ super();
2301
+ this.length = 6;
2302
+ this.name = "otp";
2303
+ this.value = "";
2304
+ this.disabled = false;
2305
+ this.error = false;
2306
+ this.autoFocus = false;
2307
+ this.inputType = "text";
2308
+ this.digits = [];
2309
+ this.internals = this.attachInternals();
2310
+ }
2311
+ connectedCallback() {
2312
+ super.connectedCallback();
2313
+ this.initializeDigits();
2314
+ }
2315
+ initializeDigits() {
2316
+ this.digits = Array.from({ length: this.length }, () => "");
2317
+ if (this.value) {
2318
+ const digitsOnly = this.value.replace(/\D/g, "").slice(0, this.length);
2319
+ const chars = digitsOnly.split("");
2320
+ chars.forEach((char, i6) => {
2321
+ this.digits[i6] = char;
2322
+ });
2323
+ }
2324
+ }
2325
+ firstUpdated() {
2326
+ if (this.autoFocus && this.inputs.length > 0) {
2327
+ this.inputs[0]?.focus();
2328
+ }
2329
+ }
2330
+ updated(changedProperties) {
2331
+ if (changedProperties.has("value") && !changedProperties.has("digits")) {
2332
+ this.initializeDigits();
2333
+ }
2334
+ if (changedProperties.has("length")) {
2335
+ this.initializeDigits();
2336
+ }
2337
+ const fullValue = this.digits.join("");
2338
+ this.internals.setFormValue(fullValue || null);
2339
+ }
2340
+ getFullValue() {
2341
+ return this.digits.join("");
2342
+ }
2343
+ handleInput(index, e8) {
2344
+ const input = e8.target;
2345
+ let newValue = input.value;
2346
+ if (newValue.length > 1) {
2347
+ newValue = newValue.slice(-1);
2348
+ }
2349
+ if (newValue && !/^\d$/.test(newValue)) {
2350
+ input.value = this.digits[index] ?? "";
2351
+ return;
2352
+ }
2353
+ this.digits[index] = newValue;
2354
+ this.digits = [...this.digits];
2355
+ input.value = newValue;
2356
+ const fullValue = this.getFullValue();
2357
+ this.value = fullValue;
2358
+ this.dispatchEvent(
2359
+ new CustomEvent("input", {
2360
+ detail: { value: fullValue, index, digit: newValue },
2361
+ bubbles: true,
2362
+ composed: true
2363
+ })
2364
+ );
2365
+ if (newValue && index < this.length - 1) {
2366
+ this.inputs[index + 1]?.focus();
2367
+ }
2368
+ if (fullValue.length === this.length) {
2369
+ this.dispatchEvent(
2370
+ new CustomEvent("complete", {
2371
+ detail: { value: fullValue },
2372
+ bubbles: true,
2373
+ composed: true
2374
+ })
2375
+ );
2376
+ }
2377
+ this.dispatchEvent(
2378
+ new CustomEvent("change", {
2379
+ detail: { value: fullValue },
2380
+ bubbles: true,
2381
+ composed: true
2382
+ })
2383
+ );
2384
+ }
2385
+ handleKeyDown(index, e8) {
2386
+ switch (e8.key) {
2387
+ case "Backspace":
2388
+ if (!this.digits[index] && index > 0) {
2389
+ e8.preventDefault();
2390
+ this.inputs[index - 1]?.focus();
2391
+ this.digits[index - 1] = "";
2392
+ this.digits = [...this.digits];
2393
+ } else {
2394
+ this.digits[index] = "";
2395
+ this.digits = [...this.digits];
2396
+ }
2397
+ this.value = this.getFullValue();
2398
+ break;
2399
+ case "ArrowLeft":
2400
+ e8.preventDefault();
2401
+ if (index > 0) {
2402
+ this.inputs[index - 1]?.focus();
2403
+ }
2404
+ break;
2405
+ case "ArrowRight":
2406
+ e8.preventDefault();
2407
+ if (index < this.length - 1) {
2408
+ this.inputs[index + 1]?.focus();
2409
+ }
2410
+ break;
2411
+ case "Delete":
2412
+ this.digits[index] = "";
2413
+ this.digits = [...this.digits];
2414
+ this.value = this.getFullValue();
2415
+ break;
2416
+ }
2417
+ }
2418
+ handlePaste(e8) {
2419
+ e8.preventDefault();
2420
+ const pastedData = e8.clipboardData?.getData("text") || "";
2421
+ const digits = pastedData.replace(/\D/g, "").slice(0, this.length);
2422
+ if (digits) {
2423
+ this.digits = Array.from({ length: this.length }, (_2, i6) => digits[i6] || "");
2424
+ this.value = this.getFullValue();
2425
+ this.requestUpdate();
2426
+ const focusIndex = Math.min(digits.length, this.length - 1);
2427
+ setTimeout(() => {
2428
+ this.inputs[focusIndex]?.focus();
2429
+ }, 0);
2430
+ this.dispatchEvent(
2431
+ new CustomEvent("change", {
2432
+ detail: { value: this.value },
2433
+ bubbles: true,
2434
+ composed: true
2435
+ })
2436
+ );
2437
+ if (digits.length === this.length) {
2438
+ this.dispatchEvent(
2439
+ new CustomEvent("complete", {
2440
+ detail: { value: this.value },
2441
+ bubbles: true,
2442
+ composed: true
2443
+ })
2444
+ );
2445
+ }
2446
+ }
2447
+ }
2448
+ handleFocus(e8) {
2449
+ const input = e8.target;
2450
+ input.select();
2451
+ }
2452
+ /**
2453
+ * Focus the first empty input or the last input
2454
+ */
2455
+ focus() {
2456
+ const emptyIndex = this.digits.findIndex((d3) => !d3);
2457
+ const focusIndex = emptyIndex >= 0 ? emptyIndex : this.length - 1;
2458
+ this.inputs[focusIndex]?.focus();
2459
+ }
2460
+ /**
2461
+ * Clear all digits
2462
+ */
2463
+ clear() {
2464
+ this.digits = Array.from({ length: this.length }, () => "");
2465
+ this.value = "";
2466
+ this.inputs[0]?.focus();
2467
+ }
2468
+ renderDigitInput(index) {
2469
+ const digit = this.digits[index] || "";
2470
+ const isFilled = digit !== "";
2471
+ return x`
2472
+ <input
2473
+ part="input"
2474
+ type=${this.inputType}
2475
+ inputmode="numeric"
2476
+ pattern="[0-9]*"
2477
+ maxlength="1"
2478
+ .value=${digit}
2479
+ ?disabled=${this.disabled}
2480
+ placeholder="○"
2481
+ class=${isFilled ? "filled" : ""}
2482
+ @input=${(e8) => this.handleInput(index, e8)}
2483
+ @keydown=${(e8) => this.handleKeyDown(index, e8)}
2484
+ @paste=${this.handlePaste}
2485
+ @focus=${this.handleFocus}
2486
+ aria-label=${`Digit ${index + 1} of ${this.length}`}
2487
+ />
2488
+ `;
2489
+ }
2490
+ render() {
2491
+ return x`
2492
+ <div class="container" part="container" role="group" aria-label="One-time password input">
2493
+ ${Array.from({ length: this.length }, (_2, i6) => this.renderDigitInput(i6))}
2494
+ </div>
2495
+ `;
2496
+ }
2497
+ };
2498
+ // Enable form association
2499
+ ConsentOTPInput.formAssociated = true;
2500
+ ConsentOTPInput.styles = i`
2501
+ :host {
2502
+ display: block;
2503
+ --_primary: var(--consent-primary, #2563eb);
2504
+ }
2505
+
2506
+ .container {
2507
+ display: flex;
2508
+ gap: 0.5rem;
2509
+ justify-content: center;
2510
+ }
2511
+
2512
+ input {
2513
+ width: 2.75rem;
2514
+ height: 3.5rem;
2515
+ text-align: center;
2516
+ font-size: 1.5rem;
2517
+ font-weight: 600;
2518
+ font-family: inherit;
2519
+ color: #111827;
2520
+ background: white;
2521
+ border: 1px solid #d1d5db;
2522
+ border-radius: 0.5rem;
2523
+ outline: none;
2524
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
2525
+
2526
+ /* Hide spinner for number inputs */
2527
+ -moz-appearance: textfield;
2528
+ }
2529
+
2530
+ input::-webkit-outer-spin-button,
2531
+ input::-webkit-inner-spin-button {
2532
+ -webkit-appearance: none;
2533
+ margin: 0;
2534
+ }
2535
+
2536
+ input:focus {
2537
+ border-color: var(--_primary);
2538
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
2539
+ }
2540
+
2541
+ input:disabled {
2542
+ background: #f9fafb;
2543
+ cursor: not-allowed;
2544
+ opacity: 0.6;
2545
+ }
2546
+
2547
+ input::placeholder {
2548
+ color: #d1d5db;
2549
+ }
2550
+
2551
+ /* Error state */
2552
+ :host([error]) input {
2553
+ border-color: #ef4444;
2554
+ }
2555
+
2556
+ :host([error]) input:focus {
2557
+ border-color: #ef4444;
2558
+ box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
2559
+ }
2560
+
2561
+ /* Filled state */
2562
+ input.filled {
2563
+ border-color: var(--_primary);
2564
+ background: #f0f9ff;
2565
+ }
2566
+
2567
+ /* Responsive: smaller on mobile */
2568
+ @media (max-width: 400px) {
2569
+ input {
2570
+ width: 2.25rem;
2571
+ height: 3rem;
2572
+ font-size: 1.25rem;
2573
+ }
2574
+
2575
+ .container {
2576
+ gap: 0.375rem;
2577
+ }
2578
+ }
2579
+ `;
2580
+ __decorateClass([
2581
+ n4({ type: Number })
2582
+ ], ConsentOTPInput.prototype, "length", 2);
2583
+ __decorateClass([
2584
+ n4({ type: String })
2585
+ ], ConsentOTPInput.prototype, "name", 2);
2586
+ __decorateClass([
2587
+ n4({ type: String })
2588
+ ], ConsentOTPInput.prototype, "value", 2);
2589
+ __decorateClass([
2590
+ n4({ type: Boolean, reflect: true })
2591
+ ], ConsentOTPInput.prototype, "disabled", 2);
2592
+ __decorateClass([
2593
+ n4({ type: Boolean, reflect: true })
2594
+ ], ConsentOTPInput.prototype, "error", 2);
2595
+ __decorateClass([
2596
+ n4({ type: Boolean, attribute: "auto-focus" })
2597
+ ], ConsentOTPInput.prototype, "autoFocus", 2);
2598
+ __decorateClass([
2599
+ n4({ type: String, attribute: "input-type" })
2600
+ ], ConsentOTPInput.prototype, "inputType", 2);
2601
+ __decorateClass([
2602
+ r5()
2603
+ ], ConsentOTPInput.prototype, "digits", 2);
2604
+ __decorateClass([
2605
+ r6("input")
2606
+ ], ConsentOTPInput.prototype, "inputs", 2);
2607
+ ConsentOTPInput = __decorateClass([
2608
+ t3("consent-otp-input")
2609
+ ], ConsentOTPInput);
2610
+
2611
+ // src/types/modes.types.ts
2612
+ var AUTH_MODES = {
2613
+ /** Simple consent with no authentication */
2614
+ CONSENT_ONLY: "consent-only",
2615
+ /** Username/password authentication */
2616
+ CREDENTIALS: "credentials",
2617
+ /** OAuth provider authentication */
2618
+ OAUTH: "oauth",
2619
+ /** Email magic link authentication */
2620
+ MAGIC_LINK: "magic-link",
2621
+ /** One-time password (SMS/TOTP) authentication */
2622
+ OTP: "otp",
2623
+ /** QR code scanning authentication (future) */
2624
+ QR_CODE: "qr-code",
2625
+ /** Passkey/WebAuthn authentication (future) */
2626
+ PASSKEY: "passkey",
2627
+ /** Identity verification (future) */
2628
+ IDV: "idv"
2629
+ };
2630
+
2631
+ // src/constants/colors.ts
2632
+ var DEFAULT_COLORS = {
2633
+ /** Primary brand color - Tailwind blue-600 */
2634
+ PRIMARY: "#2563EB",
2635
+ /** Secondary/accent color - Tailwind blue-100 */
2636
+ SECONDARY: "#DBEAFE",
2637
+ /** Background color */
2638
+ BACKGROUND: "#F9FAFB",
2639
+ /** Text colors */
2640
+ TEXT_PRIMARY: "#111827",
2641
+ TEXT_SECONDARY: "#6B7280",
2642
+ TEXT_MUTED: "#9CA3AF",
2643
+ /** Border colors */
2644
+ BORDER: "#E5E7EB",
2645
+ BORDER_DARK: "#D1D5DB",
2646
+ /** Success color - Tailwind green-600 */
2647
+ SUCCESS: "#16A34A",
2648
+ /** Error color - Tailwind red-600 */
2649
+ ERROR: "#DC2626",
2650
+ /** Warning color - Tailwind amber-500 */
2651
+ WARNING: "#F59E0B"
2652
+ };
2653
+
2654
+ // src/constants/defaults.ts
2655
+ var DEFAULT_BRANDING = {
2656
+ primaryColor: DEFAULT_COLORS.PRIMARY,
2657
+ secondaryColor: DEFAULT_COLORS.SECONDARY,
2658
+ logoUrl: void 0,
2659
+ companyName: void 0
2660
+ };
2661
+ var DEFAULT_UI = {
2662
+ title: "Permission request",
2663
+ description: "It looks like you would like to use [AI Agent] to access resources on your behalf.",
2664
+ expirationText: "This delegation will expire in",
2665
+ cancelButtonText: "Cancel",
2666
+ submitButtonText: "Allow access",
2667
+ permissionsHeader: "The agent is requesting the following permissions:",
2668
+ autoClose: false,
2669
+ popupEnabled: false,
2670
+ theme: "auto"
2671
+ };
2672
+ var DEFAULT_TERMS = {
2673
+ text: "Terms and Conditions",
2674
+ url: void 0,
2675
+ version: void 0,
2676
+ required: true
2677
+ };
2678
+ var DEFAULT_SUCCESS = {
2679
+ title: "Access Granted",
2680
+ description: "The agent now has permission to act on your behalf.",
2681
+ showCredential: true,
2682
+ redirectUrl: void 0,
2683
+ redirectDelay: void 0,
2684
+ continueButtonText: "Close"
2685
+ };
2686
+ var DEFAULT_EXPIRATION_DAYS = 30;
2687
+
2688
+ // src/resolution/resolve-branding.ts
2689
+ function isValidHexColor(color) {
2690
+ if (!color) return false;
2691
+ return /^#[0-9A-Fa-f]{6}$/.test(color);
2692
+ }
2693
+ function sanitizeColor(color, defaultColor) {
2694
+ if (isValidHexColor(color)) {
2695
+ return color;
2696
+ }
2697
+ return defaultColor;
2698
+ }
2699
+ function isValidUrl(url) {
2700
+ if (!url) return false;
2701
+ try {
2702
+ const parsed = new URL(url);
2703
+ return parsed.protocol === "http:" || parsed.protocol === "https:";
2704
+ } catch {
2705
+ return false;
2706
+ }
2707
+ }
2708
+ function sanitizeUrl(url) {
2709
+ if (isValidUrl(url)) {
2710
+ return url;
2711
+ }
2712
+ return void 0;
2713
+ }
2714
+ function hexToRgb(hex) {
2715
+ const cleanHex = hex.replace(/^#/, "");
2716
+ const r7 = parseInt(cleanHex.slice(0, 2), 16);
2717
+ const g2 = parseInt(cleanHex.slice(2, 4), 16);
2718
+ const b3 = parseInt(cleanHex.slice(4, 6), 16);
2719
+ return `${r7}, ${g2}, ${b3}`;
2720
+ }
2721
+ function generateBrandingCSSVars(branding) {
2722
+ return {
2723
+ "--consent-primary": branding.primaryColor,
2724
+ "--consent-secondary": branding.secondaryColor,
2725
+ "--consent-primary-rgb": hexToRgb(branding.primaryColor),
2726
+ "--consent-secondary-rgb": hexToRgb(branding.secondaryColor)
2727
+ };
2728
+ }
2729
+ function resolveConsentBranding(branding) {
2730
+ const primaryColor = sanitizeColor(
2731
+ branding?.primaryColor,
2732
+ DEFAULT_COLORS.PRIMARY
2733
+ );
2734
+ const secondaryColor = sanitizeColor(
2735
+ branding?.secondaryColor,
2736
+ DEFAULT_COLORS.SECONDARY
2737
+ );
2738
+ const logoUrl = sanitizeUrl(branding?.logoUrl);
2739
+ const companyName = branding?.companyName?.trim() || void 0;
2740
+ const cssVars = generateBrandingCSSVars({ primaryColor, secondaryColor });
2741
+ return {
2742
+ primaryColor,
2743
+ secondaryColor,
2744
+ logoUrl,
2745
+ companyName,
2746
+ cssVars
2747
+ };
2748
+ }
2749
+
2750
+ // src/resolution/resolve-copy.ts
2751
+ var AGENT_NAME_PLACEHOLDER = "[AI Agent]";
2752
+ function substituteAgentName(text, agentName) {
2753
+ if (!agentName) {
2754
+ return text;
2755
+ }
2756
+ return text.replace(new RegExp(escapeRegExp(AGENT_NAME_PLACEHOLDER), "g"), agentName);
2757
+ }
2758
+ function escapeRegExp(string) {
2759
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2760
+ }
2761
+ function resolveConsentCopy(config, agentName) {
2762
+ const ui = config?.ui ?? {};
2763
+ const terms = config?.terms ?? {};
2764
+ const success = config?.success ?? {};
2765
+ const rawTitle = ui.title ?? DEFAULT_UI.title;
2766
+ const rawDescription = ui.description ?? DEFAULT_UI.description;
2767
+ const rawExpirationText = ui.expirationText ?? DEFAULT_UI.expirationText;
2768
+ const rawCancelButtonText = ui.cancelButtonText ?? DEFAULT_UI.cancelButtonText;
2769
+ const rawSubmitButtonText = ui.submitButtonText ?? DEFAULT_UI.submitButtonText;
2770
+ const rawPermissionsHeader = ui.permissionsHeader ?? DEFAULT_UI.permissionsHeader;
2771
+ const rawTermsText = terms.text ?? DEFAULT_TERMS.text;
2772
+ const rawSuccessTitle = success.title ?? DEFAULT_SUCCESS.title;
2773
+ const rawSuccessDescription = success.description ?? DEFAULT_SUCCESS.description;
2774
+ const resolvedDescription = substituteAgentName(rawDescription, agentName);
2775
+ const resolvedSuccessDescription = substituteAgentName(rawSuccessDescription, agentName);
2776
+ return {
2777
+ // Raw values (without substitution)
2778
+ title: rawTitle,
2779
+ description: rawDescription,
2780
+ expirationText: rawExpirationText,
2781
+ cancelButtonText: rawCancelButtonText,
2782
+ submitButtonText: rawSubmitButtonText,
2783
+ permissionsHeader: rawPermissionsHeader,
2784
+ termsText: rawTermsText,
2785
+ termsUrl: terms.url,
2786
+ termsRequired: terms.required ?? DEFAULT_TERMS.required,
2787
+ // Resolved values (with substitution)
2788
+ resolvedDescription,
2789
+ // Success page
2790
+ successTitle: rawSuccessTitle,
2791
+ successDescription: rawSuccessDescription,
2792
+ resolvedSuccessDescription,
2793
+ showCredential: success.showCredential ?? DEFAULT_SUCCESS.showCredential,
2794
+ continueButtonText: success.continueButtonText ?? DEFAULT_SUCCESS.continueButtonText
2795
+ };
2796
+ }
2797
+
2798
+ // src/resolution/resolve-config.ts
2799
+ function resolveCustomFields(fields) {
2800
+ if (!fields || fields.length === 0) {
2801
+ return [];
2802
+ }
2803
+ const limitedFields = fields.slice(0, 10);
2804
+ return limitedFields.filter((field) => {
2805
+ if (!field.name || !field.label) return false;
2806
+ if (!/^[a-zA-Z0-9_]+$/.test(field.name)) return false;
2807
+ if (field.type === "select" && (!field.options || field.options.length === 0)) {
2808
+ return false;
2809
+ }
2810
+ return true;
2811
+ });
2812
+ }
2813
+ function resolveExpirationDays(days) {
2814
+ if (days === void 0 || days === null) {
2815
+ return DEFAULT_EXPIRATION_DAYS;
2816
+ }
2817
+ if (days < 1) return 1;
2818
+ if (days > 365) return 365;
2819
+ return Math.floor(days);
2820
+ }
2821
+ function determineAuthMode(config) {
2822
+ if (config?.oauth?.providerId) {
2823
+ return AUTH_MODES.OAUTH;
2824
+ }
2825
+ if (config?.credentials?.usernameLabel || config?.credentials?.passwordLabel) {
2826
+ return AUTH_MODES.CREDENTIALS;
2827
+ }
2828
+ if (config?.magicLink?.enabled) {
2829
+ return AUTH_MODES.MAGIC_LINK;
2830
+ }
2831
+ if (config?.otp?.enabled) {
2832
+ return AUTH_MODES.OTP;
2833
+ }
2834
+ return AUTH_MODES.CONSENT_ONLY;
2835
+ }
2836
+ function resolveUISettings(ui) {
2837
+ return {
2838
+ title: ui?.title ?? DEFAULT_UI.title,
2839
+ description: ui?.description ?? DEFAULT_UI.description,
2840
+ expirationText: ui?.expirationText ?? DEFAULT_UI.expirationText,
2841
+ cancelButtonText: ui?.cancelButtonText ?? DEFAULT_UI.cancelButtonText,
2842
+ submitButtonText: ui?.submitButtonText ?? DEFAULT_UI.submitButtonText,
2843
+ permissionsHeader: ui?.permissionsHeader ?? DEFAULT_UI.permissionsHeader,
2844
+ autoClose: ui?.autoClose ?? DEFAULT_UI.autoClose,
2845
+ popupEnabled: ui?.popupEnabled ?? DEFAULT_UI.popupEnabled,
2846
+ theme: ui?.theme ?? DEFAULT_UI.theme
2847
+ };
2848
+ }
2849
+ function resolveTermsSettings(terms) {
2850
+ return {
2851
+ text: terms?.text ?? DEFAULT_TERMS.text,
2852
+ url: terms?.url,
2853
+ version: terms?.version,
2854
+ required: terms?.required ?? DEFAULT_TERMS.required
2855
+ };
2856
+ }
2857
+ function resolveSuccessSettings(success) {
2858
+ return {
2859
+ title: success?.title ?? DEFAULT_SUCCESS.title,
2860
+ description: success?.description ?? DEFAULT_SUCCESS.description,
2861
+ showCredential: success?.showCredential ?? DEFAULT_SUCCESS.showCredential,
2862
+ redirectUrl: success?.redirectUrl,
2863
+ redirectDelay: success?.redirectDelay,
2864
+ continueButtonText: success?.continueButtonText ?? DEFAULT_SUCCESS.continueButtonText
2865
+ };
2866
+ }
2867
+ function resolveConsentConfig(config, agentName) {
2868
+ const branding = resolveConsentBranding(config?.branding);
2869
+ const copy = resolveConsentCopy(config, agentName);
2870
+ const ui = resolveUISettings(config?.ui);
2871
+ const terms = resolveTermsSettings(config?.terms);
2872
+ const success = resolveSuccessSettings(config?.success);
2873
+ const customFields = resolveCustomFields(config?.customFields);
2874
+ const expirationDays = resolveExpirationDays(config?.expirationDays);
2875
+ const authMode = determineAuthMode(config);
2876
+ return {
2877
+ branding,
2878
+ copy,
2879
+ ui,
2880
+ terms,
2881
+ success,
2882
+ customFields,
2883
+ expirationDays,
2884
+ authMode,
2885
+ // Passthrough mode configs
2886
+ credentials: config?.credentials,
2887
+ oauth: config?.oauth,
2888
+ magicLink: config?.magicLink,
2889
+ otp: config?.otp,
2890
+ qrCode: config?.qrCode,
2891
+ passkey: config?.passkey,
2892
+ idv: config?.idv
2893
+ };
2894
+ }
2895
+
2896
+ // src/components/mcp-consent.ts
2897
+ var McpConsent = class extends i4 {
2898
+ constructor() {
2899
+ super(...arguments);
2900
+ this.tool = "";
2901
+ this.scopes = [];
2902
+ this.agentDid = "";
2903
+ this.sessionId = "";
2904
+ this.projectId = "";
2905
+ this.serverUrl = "";
2906
+ this.agentName = "";
2907
+ this.currentMode = AUTH_MODES.CONSENT_ONLY;
2908
+ this.loading = false;
2909
+ this.step = "consent";
2910
+ this.termsAccepted = false;
2911
+ this.formData = {};
2912
+ this.resendCooldown = 0;
2913
+ this.selectedScopes = [];
2914
+ }
2915
+ // === LIFECYCLE ===
2916
+ connectedCallback() {
2917
+ super.connectedCallback();
2918
+ this.resolved = resolveConsentConfig(this.config, this.agentName);
2919
+ this.currentMode = this.mode ?? determineAuthMode(this.config) ?? AUTH_MODES.CONSENT_ONLY;
2920
+ this.selectedScopes = [...this.scopes];
2921
+ }
2922
+ disconnectedCallback() {
2923
+ super.disconnectedCallback();
2924
+ if (this.resendCooldownInterval !== void 0) {
2925
+ clearInterval(this.resendCooldownInterval);
2926
+ this.resendCooldownInterval = void 0;
2927
+ }
2928
+ }
2929
+ updated(changedProperties) {
2930
+ if (changedProperties.has("config") || changedProperties.has("agentName")) {
2931
+ this.resolved = resolveConsentConfig(this.config, this.agentName);
2932
+ }
2933
+ if (changedProperties.has("mode") && this.mode) {
2934
+ this.currentMode = this.mode;
2935
+ }
2936
+ if (changedProperties.has("scopes")) {
2937
+ this.selectedScopes = [...this.scopes];
2938
+ }
2939
+ if (this.resolved) {
2940
+ this.style.setProperty(
2941
+ "--consent-primary",
2942
+ this.resolved.branding.primaryColor
2943
+ );
2944
+ this.style.setProperty(
2945
+ "--consent-secondary",
2946
+ this.resolved.branding.secondaryColor
2947
+ );
2948
+ }
2949
+ }
2950
+ // === FORM SUBMISSION ===
2951
+ async handleApprove(e8) {
2952
+ e8?.preventDefault();
2953
+ if (this.loading) {
2954
+ return;
2955
+ }
2956
+ if (!this.termsAccepted && this.resolved?.terms.required) {
2957
+ this.error = "Please accept the terms to continue";
2958
+ return;
2959
+ }
2960
+ if (this.scopes.length > 0 && this.selectedScopes.length === 0) {
2961
+ this.error = "Please select at least one permission";
2962
+ return;
2963
+ }
2964
+ this.loading = true;
2965
+ this.error = void 0;
2966
+ try {
2967
+ const formData = new FormData();
2968
+ formData.append("tool", this.tool);
2969
+ formData.append("scopes", JSON.stringify(this.selectedScopes));
2970
+ formData.append("agent_did", this.agentDid);
2971
+ formData.append("session_id", this.sessionId);
2972
+ formData.append("project_id", this.projectId);
2973
+ formData.append("auth_mode", this.currentMode);
2974
+ formData.append("provider_type", this.oauthIdentity?.provider ?? "none");
2975
+ formData.append("termsAccepted", String(this.termsAccepted));
2976
+ Object.entries(this.formData).forEach(([key, value]) => {
2977
+ formData.append(key, value);
2978
+ });
2979
+ const response = await fetch(`${this.serverUrl}/consent/approve`, {
2980
+ method: "POST",
2981
+ body: formData
2982
+ });
2983
+ if (!response.ok) {
2984
+ const errorData = await response.json().catch(() => ({}));
2985
+ throw new Error(errorData.message || "Approval failed");
2986
+ }
2987
+ const result = await response.json();
2988
+ this.step = "success";
2989
+ this.dispatchEvent(
2990
+ new CustomEvent("mcp-consent:approve", {
2991
+ detail: { success: true, redirectUrl: result.redirectUrl },
2992
+ bubbles: true,
2993
+ composed: true
2994
+ })
2995
+ );
2996
+ } catch (e9) {
2997
+ this.error = e9 instanceof Error ? e9.message : "Unknown error";
2998
+ this.dispatchEvent(
2999
+ new CustomEvent("mcp-consent:error", {
3000
+ detail: { error: this.error },
3001
+ bubbles: true,
3002
+ composed: true
3003
+ })
3004
+ );
3005
+ } finally {
3006
+ this.loading = false;
3007
+ }
3008
+ }
3009
+ handleDeny() {
3010
+ this.dispatchEvent(
3011
+ new CustomEvent("mcp-consent:deny", {
3012
+ bubbles: true,
3013
+ composed: true
3014
+ })
3015
+ );
3016
+ window.close();
3017
+ }
3018
+ handleTermsChange(e8) {
3019
+ this.termsAccepted = e8.detail.checked;
3020
+ }
3021
+ handleInputChange(name, value) {
3022
+ this.formData = { ...this.formData, [name]: value };
3023
+ }
3024
+ handleResendOtp() {
3025
+ if (this.resendCooldown > 0) {
3026
+ return;
3027
+ }
3028
+ const cooldownSeconds = this.resolved?.otp?.resendCooldown ?? 60;
3029
+ this.resendCooldown = cooldownSeconds;
3030
+ if (this.resendCooldownInterval !== void 0) {
3031
+ clearInterval(this.resendCooldownInterval);
3032
+ }
3033
+ this.resendCooldownInterval = setInterval(() => {
3034
+ this.resendCooldown--;
3035
+ if (this.resendCooldown <= 0) {
3036
+ clearInterval(this.resendCooldownInterval);
3037
+ this.resendCooldownInterval = void 0;
3038
+ }
3039
+ }, 1e3);
3040
+ this.dispatchEvent(
3041
+ new CustomEvent("mcp-consent:resend-otp", {
3042
+ bubbles: true,
3043
+ composed: true
3044
+ })
3045
+ );
3046
+ }
3047
+ // === RENDER METHODS ===
3048
+ renderAgentInfo() {
3049
+ const agentDisplay = this.agentName || "this agent";
3050
+ return x`
3051
+ <div class="agent-info">
3052
+ <div class="agent-icon">
3053
+ <svg
3054
+ xmlns="http://www.w3.org/2000/svg"
3055
+ viewBox="0 0 24 24"
3056
+ fill="none"
3057
+ stroke="currentColor"
3058
+ stroke-width="2"
3059
+ >
3060
+ <circle cx="12" cy="12" r="10" />
3061
+ <path d="M12 16v-4M12 8h.01" />
3062
+ </svg>
3063
+ </div>
3064
+ <div class="agent-text">
3065
+ <p>
3066
+ <strong>${agentDisplay}</strong> is requesting permission to
3067
+ ${this.tool ? x`use the <strong>${this.tool}</strong> tool` : "access your data"}
3068
+ on your behalf.
3069
+ </p>
3070
+ </div>
3071
+ </div>
3072
+ `;
3073
+ }
3074
+ handlePermissionsChange(e8) {
3075
+ this.selectedScopes = e8.detail.selected;
3076
+ }
3077
+ renderPermissions() {
3078
+ if (this.scopes.length === 0) return E;
3079
+ return x`
3080
+ <p class="permissions-header">
3081
+ ${this.resolved?.ui.permissionsHeader ?? "The agent is requesting the following permissions:"}
3082
+ </p>
3083
+ <div class="permissions">
3084
+ <consent-permissions
3085
+ .scopes=${this.scopes}
3086
+ interactive
3087
+ select-all
3088
+ @change=${this.handlePermissionsChange}
3089
+ ></consent-permissions>
3090
+ </div>
3091
+ `;
3092
+ }
3093
+ renderExpiration() {
3094
+ const days = this.resolved?.expirationDays ?? 7;
3095
+ return x`
3096
+ <p class="expiration">
3097
+ ${this.resolved?.ui.expirationText ?? "This delegation will expire in"}
3098
+ <strong>${days} ${days === 1 ? "day" : "days"}</strong>
3099
+ </p>
3100
+ `;
3101
+ }
3102
+ renderTerms() {
3103
+ if (!this.resolved?.terms) return E;
3104
+ return x`
3105
+ <div class="terms">
3106
+ <consent-terms
3107
+ name="termsAccepted"
3108
+ text=${this.resolved.terms.text}
3109
+ url=${this.resolved.terms.url ?? ""}
3110
+ ?required=${this.resolved.terms.required}
3111
+ @change=${this.handleTermsChange}
3112
+ ></consent-terms>
3113
+ </div>
3114
+ `;
3115
+ }
3116
+ renderError() {
3117
+ if (!this.error) return E;
3118
+ return x`<div class="error-message">${this.error}</div>`;
3119
+ }
3120
+ renderFooter() {
3121
+ return x`
3122
+ <div slot="footer">
3123
+ <consent-button variant="secondary" @click=${this.handleDeny}>
3124
+ ${this.resolved?.ui.cancelButtonText ?? "Cancel"}
3125
+ </consent-button>
3126
+ <consent-button
3127
+ variant="primary"
3128
+ ?loading=${this.loading}
3129
+ ?disabled=${this.resolved?.terms.required && !this.termsAccepted}
3130
+ @click=${this.handleApprove}
3131
+ >
3132
+ ${this.resolved?.ui.submitButtonText ?? "Allow access"}
3133
+ </consent-button>
3134
+ </div>
3135
+ `;
3136
+ }
3137
+ // === MODE-SPECIFIC RENDERS ===
3138
+ renderConsentOnly() {
3139
+ return x`
3140
+ <consent-shell
3141
+ page-title=${this.resolved?.ui.title ?? "Permission Request"}
3142
+ company-name=${this.resolved?.branding.companyName ?? ""}
3143
+ logo-url=${this.resolved?.branding.logoUrl ?? ""}
3144
+ primary-color=${this.resolved?.branding.primaryColor ?? "#2563eb"}
3145
+ secondary-color=${this.resolved?.branding.secondaryColor ?? "#dbeafe"}
3146
+ >
3147
+ <div slot="content">
3148
+ ${this.renderError()} ${this.renderAgentInfo()}
3149
+ ${this.renderPermissions()} ${this.renderExpiration()}
3150
+ ${this.renderTerms()}
3151
+ </div>
3152
+ ${this.renderFooter()}
3153
+ </consent-shell>
3154
+ `;
3155
+ }
3156
+ renderCredentials() {
3157
+ const creds = this.resolved?.credentials;
3158
+ return x`
3159
+ <consent-shell
3160
+ page-title=${this.resolved?.ui.title ?? "Sign In"}
3161
+ company-name=${this.resolved?.branding.companyName ?? ""}
3162
+ logo-url=${this.resolved?.branding.logoUrl ?? ""}
3163
+ primary-color=${this.resolved?.branding.primaryColor ?? "#2563eb"}
3164
+ secondary-color=${this.resolved?.branding.secondaryColor ?? "#dbeafe"}
3165
+ >
3166
+ <div slot="content">
3167
+ ${this.renderError()} ${this.renderAgentInfo()}
3168
+
3169
+ <div class="form-fields">
3170
+ <consent-input
3171
+ type="text"
3172
+ name="username"
3173
+ label=${creds?.usernameLabel ?? "Username"}
3174
+ placeholder=${creds?.usernamePlaceholder ?? "Enter your username"}
3175
+ autocomplete="username"
3176
+ required
3177
+ @input=${(e8) => this.handleInputChange("username", e8.detail.value)}
3178
+ ></consent-input>
3179
+
3180
+ <consent-input
3181
+ type="password"
3182
+ name="password"
3183
+ label=${creds?.passwordLabel ?? "Password"}
3184
+ placeholder=${creds?.passwordPlaceholder ?? "Enter your password"}
3185
+ autocomplete="current-password"
3186
+ required
3187
+ @input=${(e8) => this.handleInputChange("password", e8.detail.value)}
3188
+ ></consent-input>
3189
+ </div>
3190
+
3191
+ ${creds?.showForgotPassword && creds.forgotPasswordUrl ? x`
3192
+ <p style="text-align: right; margin-bottom: 1rem;">
3193
+ <a
3194
+ href=${creds.forgotPasswordUrl}
3195
+ style="font-size: 0.75rem; color: var(--_primary);"
3196
+ >
3197
+ Forgot password?
3198
+ </a>
3199
+ </p>
3200
+ ` : E}
3201
+ ${this.renderPermissions()} ${this.renderExpiration()}
3202
+ ${this.renderTerms()}
3203
+ </div>
3204
+ ${this.renderFooter()}
3205
+ </consent-shell>
3206
+ `;
3207
+ }
3208
+ renderOAuth() {
3209
+ const oauth = this.resolved?.oauth;
3210
+ const provider = oauth?.providerId ?? "oauth";
3211
+ const providerName = oauth?.providerName ?? "OAuth Provider";
3212
+ return x`
3213
+ <consent-shell
3214
+ page-title=${this.resolved?.ui.title ?? "Sign In"}
3215
+ company-name=${this.resolved?.branding.companyName ?? ""}
3216
+ logo-url=${this.resolved?.branding.logoUrl ?? ""}
3217
+ primary-color=${this.resolved?.branding.primaryColor ?? "#2563eb"}
3218
+ secondary-color=${this.resolved?.branding.secondaryColor ?? "#dbeafe"}
3219
+ >
3220
+ <div slot="content">
3221
+ ${this.renderError()} ${this.renderAgentInfo()}
3222
+
3223
+ <consent-oauth-button
3224
+ provider=${provider}
3225
+ provider-name=${providerName}
3226
+ url=${`${this.serverUrl}/oauth/${encodeURIComponent(provider)}?session_id=${encodeURIComponent(this.sessionId)}`}
3227
+ button-text=${oauth?.buttonText ?? `Continue with ${providerName}`}
3228
+ full-width
3229
+ ></consent-oauth-button>
3230
+
3231
+ ${this.renderPermissions()}
3232
+
3233
+ <div class="divider">or</div>
3234
+
3235
+ ${this.renderExpiration()} ${this.renderTerms()}
3236
+ </div>
3237
+ ${this.renderFooter()}
3238
+ </consent-shell>
3239
+ `;
3240
+ }
3241
+ renderMagicLink() {
3242
+ const ml = this.resolved?.magicLink;
3243
+ return x`
3244
+ <consent-shell
3245
+ page-title=${this.resolved?.ui.title ?? "Sign In"}
3246
+ company-name=${this.resolved?.branding.companyName ?? ""}
3247
+ logo-url=${this.resolved?.branding.logoUrl ?? ""}
3248
+ primary-color=${this.resolved?.branding.primaryColor ?? "#2563eb"}
3249
+ secondary-color=${this.resolved?.branding.secondaryColor ?? "#dbeafe"}
3250
+ >
3251
+ <div slot="content">
3252
+ ${this.renderError()} ${this.renderAgentInfo()}
3253
+
3254
+ <div class="form-fields">
3255
+ <consent-input
3256
+ type="email"
3257
+ name="email"
3258
+ label=${ml?.emailLabel ?? "Email"}
3259
+ placeholder=${ml?.emailPlaceholder ?? "Enter your email address"}
3260
+ autocomplete="email"
3261
+ required
3262
+ @input=${(e8) => this.handleInputChange("email", e8.detail.value)}
3263
+ ></consent-input>
3264
+ </div>
3265
+
3266
+ ${this.renderPermissions()} ${this.renderExpiration()}
3267
+ ${this.renderTerms()}
3268
+ </div>
3269
+
3270
+ <div slot="footer">
3271
+ <consent-button variant="secondary" @click=${this.handleDeny}>
3272
+ Cancel
3273
+ </consent-button>
3274
+ <consent-button
3275
+ variant="primary"
3276
+ ?loading=${this.loading}
3277
+ ?disabled=${this.resolved?.terms.required && !this.termsAccepted}
3278
+ @click=${this.handleApprove}
3279
+ >
3280
+ ${ml?.buttonText ?? "Send magic link"}
3281
+ </consent-button>
3282
+ </div>
3283
+ </consent-shell>
3284
+ `;
3285
+ }
3286
+ renderOTP() {
3287
+ const otp = this.resolved?.otp;
3288
+ return x`
3289
+ <consent-shell
3290
+ page-title=${this.resolved?.ui.title ?? "Verify Code"}
3291
+ company-name=${this.resolved?.branding.companyName ?? ""}
3292
+ logo-url=${this.resolved?.branding.logoUrl ?? ""}
3293
+ primary-color=${this.resolved?.branding.primaryColor ?? "#2563eb"}
3294
+ secondary-color=${this.resolved?.branding.secondaryColor ?? "#dbeafe"}
3295
+ >
3296
+ <div slot="content">
3297
+ ${this.renderError()} ${this.renderAgentInfo()}
3298
+
3299
+ <div class="otp-section">
3300
+ <p class="otp-instructions">
3301
+ ${otp?.instructions ?? "Enter the verification code sent to your device"}
3302
+ </p>
3303
+ <consent-otp-input
3304
+ length=${otp?.digits ?? 6}
3305
+ name="otp"
3306
+ auto-focus
3307
+ @complete=${(e8) => {
3308
+ this.handleInputChange("otp", e8.detail.value);
3309
+ this.handleApprove();
3310
+ }}
3311
+ @input=${(e8) => this.handleInputChange("otp", e8.detail.value)}
3312
+ ></consent-otp-input>
3313
+ <div class="otp-resend">
3314
+ Didn't receive the code?
3315
+ <button
3316
+ type="button"
3317
+ ?disabled=${this.resendCooldown > 0}
3318
+ @click=${this.handleResendOtp}
3319
+ >
3320
+ ${this.resendCooldown > 0 ? `Resend in ${this.resendCooldown}s` : "Resend"}
3321
+ </button>
3322
+ </div>
3323
+ </div>
3324
+
3325
+ ${this.renderPermissions()} ${this.renderTerms()}
3326
+ </div>
3327
+ ${this.renderFooter()}
3328
+ </consent-shell>
3329
+ `;
3330
+ }
3331
+ renderSuccess() {
3332
+ const success = this.resolved?.success;
3333
+ return x`
3334
+ <consent-shell
3335
+ page-title=${success?.title ?? "Access Granted"}
3336
+ company-name=${this.resolved?.branding.companyName ?? ""}
3337
+ logo-url=${this.resolved?.branding.logoUrl ?? ""}
3338
+ primary-color=${this.resolved?.branding.primaryColor ?? "#2563eb"}
3339
+ secondary-color=${this.resolved?.branding.secondaryColor ?? "#dbeafe"}
3340
+ >
3341
+ <div slot="content">
3342
+ <div class="success-view">
3343
+ <div class="success-icon">
3344
+ <svg
3345
+ xmlns="http://www.w3.org/2000/svg"
3346
+ viewBox="0 0 24 24"
3347
+ fill="none"
3348
+ stroke="currentColor"
3349
+ stroke-width="2"
3350
+ >
3351
+ <polyline points="20 6 9 17 4 12" />
3352
+ </svg>
3353
+ </div>
3354
+ <h2 class="success-title">${success?.title ?? "Access Granted"}</h2>
3355
+ <p class="success-description">
3356
+ ${success?.description ?? "You have successfully granted access. You can now close this window."}
3357
+ </p>
3358
+ </div>
3359
+ </div>
3360
+
3361
+ <div slot="footer">
3362
+ <consent-button
3363
+ variant="primary"
3364
+ full-width
3365
+ @click=${() => window.close()}
3366
+ >
3367
+ ${success?.continueButtonText ?? "Close"}
3368
+ </consent-button>
3369
+ </div>
3370
+ </consent-shell>
3371
+ `;
3372
+ }
3373
+ // === MAIN RENDER ===
3374
+ render() {
3375
+ if (this.step === "success") {
3376
+ return this.renderSuccess();
3377
+ }
3378
+ switch (this.currentMode) {
3379
+ case AUTH_MODES.CREDENTIALS:
3380
+ return this.renderCredentials();
3381
+ case AUTH_MODES.OAUTH:
3382
+ return this.renderOAuth();
3383
+ case AUTH_MODES.MAGIC_LINK:
3384
+ return this.renderMagicLink();
3385
+ case AUTH_MODES.OTP:
3386
+ return this.renderOTP();
3387
+ case AUTH_MODES.CONSENT_ONLY:
3388
+ default:
3389
+ return this.renderConsentOnly();
3390
+ }
3391
+ }
3392
+ };
3393
+ McpConsent.styles = i`
3394
+ :host {
3395
+ display: block;
3396
+ /* System font stack with font smoothing for crisp text */
3397
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
3398
+ 'Helvetica Neue', Arial, sans-serif;
3399
+ -webkit-font-smoothing: antialiased;
3400
+ -moz-osx-font-smoothing: grayscale;
3401
+ --_primary: var(--consent-primary, #2563eb);
3402
+ --_secondary: var(--consent-secondary, #dbeafe);
3403
+ }
3404
+
3405
+ /* Agent info box */
3406
+ .agent-info {
3407
+ display: flex;
3408
+ gap: 1rem;
3409
+ padding: 1rem;
3410
+ background: #f9fafb;
3411
+ border-radius: 0.5rem;
3412
+ margin-bottom: 1rem;
3413
+ }
3414
+
3415
+ .agent-icon {
3416
+ width: 40px;
3417
+ height: 40px;
3418
+ background: var(--_secondary);
3419
+ border-radius: 0.5rem;
3420
+ display: flex;
3421
+ align-items: center;
3422
+ justify-content: center;
3423
+ flex-shrink: 0;
3424
+ }
3425
+
3426
+ .agent-icon svg {
3427
+ width: 20px;
3428
+ height: 20px;
3429
+ color: var(--_primary);
3430
+ }
3431
+
3432
+ .agent-text {
3433
+ flex: 1;
3434
+ }
3435
+
3436
+ .agent-text p {
3437
+ margin: 0;
3438
+ font-size: 0.875rem;
3439
+ color: #374151;
3440
+ line-height: 1.5;
3441
+ }
3442
+
3443
+ .agent-text strong {
3444
+ color: #111827;
3445
+ }
3446
+
3447
+ /* Permissions section */
3448
+ .permissions-header {
3449
+ font-size: 0.875rem;
3450
+ color: #6b7280;
3451
+ margin-bottom: 0.5rem;
3452
+ }
3453
+
3454
+ .permissions {
3455
+ margin-bottom: 1rem;
3456
+ }
3457
+
3458
+ /* Expiration */
3459
+ .expiration {
3460
+ font-size: 0.75rem;
3461
+ color: #6b7280;
3462
+ margin-top: 1rem;
3463
+ }
3464
+
3465
+ .expiration strong {
3466
+ color: #374151;
3467
+ }
3468
+
3469
+ /* Terms */
3470
+ .terms {
3471
+ margin-top: 1.5rem;
3472
+ }
3473
+
3474
+ /* Error message */
3475
+ .error-message {
3476
+ background: #fef2f2;
3477
+ border: 1px solid #fecaca;
3478
+ border-radius: 0.5rem;
3479
+ padding: 0.75rem 1rem;
3480
+ margin-bottom: 1rem;
3481
+ color: #dc2626;
3482
+ font-size: 0.875rem;
3483
+ }
3484
+
3485
+ /* Form fields */
3486
+ .form-fields {
3487
+ display: flex;
3488
+ flex-direction: column;
3489
+ gap: 1rem;
3490
+ margin-bottom: 1rem;
3491
+ }
3492
+
3493
+ /* Divider */
3494
+ .divider {
3495
+ display: flex;
3496
+ align-items: center;
3497
+ gap: 1rem;
3498
+ margin: 1.5rem 0;
3499
+ color: #6b7280;
3500
+ font-size: 0.75rem;
3501
+ }
3502
+
3503
+ .divider::before,
3504
+ .divider::after {
3505
+ content: '';
3506
+ flex: 1;
3507
+ height: 1px;
3508
+ background: #e5e7eb;
3509
+ }
3510
+
3511
+ /* Success view */
3512
+ .success-view {
3513
+ text-align: center;
3514
+ padding: 2rem 0;
3515
+ }
3516
+
3517
+ .success-icon {
3518
+ width: 64px;
3519
+ height: 64px;
3520
+ background: #d1fae5;
3521
+ border-radius: 50%;
3522
+ display: flex;
3523
+ align-items: center;
3524
+ justify-content: center;
3525
+ margin: 0 auto 1.5rem;
3526
+ }
3527
+
3528
+ .success-icon svg {
3529
+ width: 32px;
3530
+ height: 32px;
3531
+ color: #059669;
3532
+ }
3533
+
3534
+ .success-title {
3535
+ font-size: 1.25rem;
3536
+ font-weight: 600;
3537
+ color: #111827;
3538
+ margin: 0 0 0.5rem;
3539
+ }
3540
+
3541
+ .success-description {
3542
+ font-size: 0.875rem;
3543
+ color: #6b7280;
3544
+ margin: 0 0 1.5rem;
3545
+ }
3546
+
3547
+ /* OTP section */
3548
+ .otp-section {
3549
+ text-align: center;
3550
+ margin-bottom: 1.5rem;
3551
+ }
3552
+
3553
+ .otp-instructions {
3554
+ font-size: 0.875rem;
3555
+ color: #6b7280;
3556
+ margin-bottom: 1rem;
3557
+ }
3558
+
3559
+ .otp-resend {
3560
+ margin-top: 1rem;
3561
+ font-size: 0.75rem;
3562
+ }
3563
+
3564
+ .otp-resend button {
3565
+ background: none;
3566
+ border: none;
3567
+ color: var(--_primary);
3568
+ cursor: pointer;
3569
+ text-decoration: underline;
3570
+ }
3571
+
3572
+ .otp-resend button:disabled {
3573
+ color: #9ca3af;
3574
+ cursor: not-allowed;
3575
+ }
3576
+ `;
3577
+ __decorateClass([
3578
+ n4({
3579
+ type: Object,
3580
+ converter: {
3581
+ fromAttribute: (value) => {
3582
+ if (!value) return void 0;
3583
+ try {
3584
+ return JSON.parse(value);
3585
+ } catch {
3586
+ return void 0;
3587
+ }
3588
+ },
3589
+ toAttribute: (value) => {
3590
+ return value ? JSON.stringify(value) : "";
3591
+ }
3592
+ }
3593
+ })
3594
+ ], McpConsent.prototype, "config", 2);
3595
+ __decorateClass([
3596
+ n4({ type: String })
3597
+ ], McpConsent.prototype, "mode", 2);
3598
+ __decorateClass([
3599
+ n4({ type: String })
3600
+ ], McpConsent.prototype, "tool", 2);
3601
+ __decorateClass([
3602
+ n4({
3603
+ type: Array,
3604
+ converter: {
3605
+ fromAttribute: (value) => {
3606
+ if (!value) return [];
3607
+ try {
3608
+ return JSON.parse(value);
3609
+ } catch {
3610
+ return [];
3611
+ }
3612
+ },
3613
+ toAttribute: (value) => {
3614
+ return JSON.stringify(value);
3615
+ }
3616
+ }
3617
+ })
3618
+ ], McpConsent.prototype, "scopes", 2);
3619
+ __decorateClass([
3620
+ n4({ type: String, attribute: "agent-did" })
3621
+ ], McpConsent.prototype, "agentDid", 2);
3622
+ __decorateClass([
3623
+ n4({ type: String, attribute: "session-id" })
3624
+ ], McpConsent.prototype, "sessionId", 2);
3625
+ __decorateClass([
3626
+ n4({ type: String, attribute: "project-id" })
3627
+ ], McpConsent.prototype, "projectId", 2);
3628
+ __decorateClass([
3629
+ n4({ type: String, attribute: "server-url" })
3630
+ ], McpConsent.prototype, "serverUrl", 2);
3631
+ __decorateClass([
3632
+ n4({ type: String, attribute: "agent-name" })
3633
+ ], McpConsent.prototype, "agentName", 2);
3634
+ __decorateClass([
3635
+ n4({
3636
+ type: Object,
3637
+ attribute: "oauth-identity",
3638
+ converter: {
3639
+ fromAttribute: (value) => {
3640
+ if (!value) return void 0;
3641
+ try {
3642
+ return JSON.parse(value);
3643
+ } catch {
3644
+ return void 0;
3645
+ }
3646
+ },
3647
+ toAttribute: (value) => {
3648
+ return value ? JSON.stringify(value) : "";
3649
+ }
3650
+ }
3651
+ })
3652
+ ], McpConsent.prototype, "oauthIdentity", 2);
3653
+ __decorateClass([
3654
+ r5()
3655
+ ], McpConsent.prototype, "resolved", 2);
3656
+ __decorateClass([
3657
+ r5()
3658
+ ], McpConsent.prototype, "currentMode", 2);
3659
+ __decorateClass([
3660
+ r5()
3661
+ ], McpConsent.prototype, "loading", 2);
3662
+ __decorateClass([
3663
+ r5()
3664
+ ], McpConsent.prototype, "error", 2);
3665
+ __decorateClass([
3666
+ r5()
3667
+ ], McpConsent.prototype, "step", 2);
3668
+ __decorateClass([
3669
+ r5()
3670
+ ], McpConsent.prototype, "termsAccepted", 2);
3671
+ __decorateClass([
3672
+ r5()
3673
+ ], McpConsent.prototype, "formData", 2);
3674
+ __decorateClass([
3675
+ r5()
3676
+ ], McpConsent.prototype, "resendCooldown", 2);
3677
+ __decorateClass([
3678
+ r5()
3679
+ ], McpConsent.prototype, "selectedScopes", 2);
3680
+ McpConsent = __decorateClass([
3681
+ t3("mcp-consent")
3682
+ ], McpConsent);
3683
+ export {
3684
+ ConsentButton,
3685
+ ConsentCheckbox,
3686
+ ConsentInput,
3687
+ ConsentOAuthButton,
3688
+ ConsentOTPInput,
3689
+ ConsentPermissions,
3690
+ ConsentShell,
3691
+ ConsentTerms,
3692
+ McpConsent
3693
+ };
3694
+ /*! Bundled license information:
3695
+
3696
+ @lit/reactive-element/css-tag.js:
3697
+ (**
3698
+ * @license
3699
+ * Copyright 2019 Google LLC
3700
+ * SPDX-License-Identifier: BSD-3-Clause
3701
+ *)
3702
+
3703
+ @lit/reactive-element/reactive-element.js:
3704
+ lit-html/lit-html.js:
3705
+ lit-element/lit-element.js:
3706
+ @lit/reactive-element/decorators/custom-element.js:
3707
+ @lit/reactive-element/decorators/property.js:
3708
+ @lit/reactive-element/decorators/state.js:
3709
+ @lit/reactive-element/decorators/event-options.js:
3710
+ @lit/reactive-element/decorators/base.js:
3711
+ @lit/reactive-element/decorators/query.js:
3712
+ @lit/reactive-element/decorators/query-all.js:
3713
+ @lit/reactive-element/decorators/query-async.js:
3714
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
3715
+ lit-html/directive.js:
3716
+ lit-html/directives/unsafe-html.js:
3717
+ lit-html/directives/unsafe-svg.js:
3718
+ (**
3719
+ * @license
3720
+ * Copyright 2017 Google LLC
3721
+ * SPDX-License-Identifier: BSD-3-Clause
3722
+ *)
3723
+
3724
+ lit-html/is-server.js:
3725
+ (**
3726
+ * @license
3727
+ * Copyright 2022 Google LLC
3728
+ * SPDX-License-Identifier: BSD-3-Clause
3729
+ *)
3730
+
3731
+ @lit/reactive-element/decorators/query-assigned-elements.js:
3732
+ (**
3733
+ * @license
3734
+ * Copyright 2021 Google LLC
3735
+ * SPDX-License-Identifier: BSD-3-Clause
3736
+ *)
3737
+ */