@innspel/web 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1900 @@
1
+ import { jsx as o, jsxs as g, Fragment as on } from "react/jsx-runtime";
2
+ import { VEDLEGG_GRENSER as Ee, skaler as le, strokTilRekter as dn, treffer as cn, trykkTilRekt as pn, InnspelApiError as Y, InnspelQueueFullError as un, init as fn } from "@innspel/core";
3
+ import { createRoot as hn } from "react-dom/client";
4
+ import { useRef as q, useLayoutEffect as gn, useEffect as W, useState as E, useId as Se, useMemo as Be, useCallback as V, useInsertionEffect as mn, useContext as kn, createContext as vn } from "react";
5
+ var bn = async (e, n) => {
6
+ const t = typeof n == "function" ? await n(e) : n;
7
+ if (t)
8
+ return e.scheme === "bearer" ? `Bearer ${t}` : e.scheme === "basic" ? `Basic ${btoa(t)}` : t;
9
+ }, yn = {
10
+ bodySerializer: (e) => JSON.stringify(e, (n, t) => typeof t == "bigint" ? t.toString() : t)
11
+ }, wn = (e) => {
12
+ switch (e) {
13
+ case "label":
14
+ return ".";
15
+ case "matrix":
16
+ return ";";
17
+ case "simple":
18
+ return ",";
19
+ default:
20
+ return "&";
21
+ }
22
+ }, xn = (e) => {
23
+ switch (e) {
24
+ case "form":
25
+ return ",";
26
+ case "pipeDelimited":
27
+ return "|";
28
+ case "spaceDelimited":
29
+ return "%20";
30
+ default:
31
+ return ",";
32
+ }
33
+ }, Fn = (e) => {
34
+ switch (e) {
35
+ case "label":
36
+ return ".";
37
+ case "matrix":
38
+ return ";";
39
+ case "simple":
40
+ return ",";
41
+ default:
42
+ return "&";
43
+ }
44
+ }, Re = ({
45
+ allowReserved: e,
46
+ explode: n,
47
+ name: t,
48
+ style: r,
49
+ value: i
50
+ }) => {
51
+ if (!n) {
52
+ const d = (e ? i : i.map((c) => encodeURIComponent(c))).join(xn(r));
53
+ switch (r) {
54
+ case "label":
55
+ return `.${d}`;
56
+ case "matrix":
57
+ return `;${t}=${d}`;
58
+ case "simple":
59
+ return d;
60
+ default:
61
+ return `${t}=${d}`;
62
+ }
63
+ }
64
+ const s = wn(r), l = i.map((d) => r === "label" || r === "simple" ? e ? d : encodeURIComponent(d) : de({
65
+ allowReserved: e,
66
+ name: t,
67
+ value: d
68
+ })).join(s);
69
+ return r === "label" || r === "matrix" ? s + l : l;
70
+ }, de = ({
71
+ allowReserved: e,
72
+ name: n,
73
+ value: t
74
+ }) => {
75
+ if (t == null)
76
+ return "";
77
+ if (typeof t == "object")
78
+ throw new Error(
79
+ "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these."
80
+ );
81
+ return `${n}=${e ? t : encodeURIComponent(t)}`;
82
+ }, Oe = ({
83
+ allowReserved: e,
84
+ explode: n,
85
+ name: t,
86
+ style: r,
87
+ value: i,
88
+ valueOnly: s
89
+ }) => {
90
+ if (i instanceof Date)
91
+ return s ? i.toISOString() : `${t}=${i.toISOString()}`;
92
+ if (r !== "deepObject" && !n) {
93
+ let c = [];
94
+ Object.entries(i).forEach(([p, u]) => {
95
+ c = [...c, p, e ? u : encodeURIComponent(u)];
96
+ });
97
+ const f = c.join(",");
98
+ switch (r) {
99
+ case "form":
100
+ return `${t}=${f}`;
101
+ case "label":
102
+ return `.${f}`;
103
+ case "matrix":
104
+ return `;${t}=${f}`;
105
+ default:
106
+ return f;
107
+ }
108
+ }
109
+ const l = Fn(r), d = Object.entries(i).map(
110
+ ([c, f]) => de({
111
+ allowReserved: e,
112
+ name: r === "deepObject" ? `${t}[${c}]` : c,
113
+ value: f
114
+ })
115
+ ).join(l);
116
+ return r === "label" || r === "matrix" ? l + d : d;
117
+ }, jn = /\{[^{}]+\}/g, En = ({ path: e, url: n }) => {
118
+ let t = n;
119
+ const r = n.match(jn);
120
+ if (r)
121
+ for (const i of r) {
122
+ let s = !1, l = i.substring(1, i.length - 1), d = "simple";
123
+ l.endsWith("*") && (s = !0, l = l.substring(0, l.length - 1)), l.startsWith(".") ? (l = l.substring(1), d = "label") : l.startsWith(";") && (l = l.substring(1), d = "matrix");
124
+ const c = e[l];
125
+ if (c == null)
126
+ continue;
127
+ if (Array.isArray(c)) {
128
+ t = t.replace(i, Re({ explode: s, name: l, style: d, value: c }));
129
+ continue;
130
+ }
131
+ if (typeof c == "object") {
132
+ t = t.replace(
133
+ i,
134
+ Oe({
135
+ explode: s,
136
+ name: l,
137
+ style: d,
138
+ value: c,
139
+ valueOnly: !0
140
+ })
141
+ );
142
+ continue;
143
+ }
144
+ if (d === "matrix") {
145
+ t = t.replace(
146
+ i,
147
+ `;${de({
148
+ name: l,
149
+ value: c
150
+ })}`
151
+ );
152
+ continue;
153
+ }
154
+ const f = encodeURIComponent(
155
+ d === "label" ? `.${c}` : c
156
+ );
157
+ t = t.replace(i, f);
158
+ }
159
+ return t;
160
+ }, Sn = ({
161
+ baseUrl: e,
162
+ path: n,
163
+ query: t,
164
+ querySerializer: r,
165
+ url: i
166
+ }) => {
167
+ const s = i.startsWith("/") ? i : `/${i}`;
168
+ let l = (e ?? "") + s;
169
+ n && (l = En({ path: n, url: l }));
170
+ let d = t ? r(t) : "";
171
+ return d.startsWith("?") && (d = d.substring(1)), d && (l += `?${d}`), l;
172
+ };
173
+ function Ae(e) {
174
+ const n = e.body !== void 0;
175
+ if (n && e.bodySerializer)
176
+ return "serializedBody" in e ? e.serializedBody !== void 0 && e.serializedBody !== "" ? e.serializedBody : null : e.body !== "" ? e.body : null;
177
+ if (n)
178
+ return e.body;
179
+ }
180
+ var Me = ({
181
+ parameters: e = {},
182
+ ...n
183
+ } = {}) => (r) => {
184
+ const i = [];
185
+ if (r && typeof r == "object")
186
+ for (const s in r) {
187
+ const l = r[s];
188
+ if (l == null)
189
+ continue;
190
+ const d = e[s] || n;
191
+ if (Array.isArray(l)) {
192
+ const c = Re({
193
+ allowReserved: d.allowReserved,
194
+ explode: !0,
195
+ name: s,
196
+ style: "form",
197
+ value: l,
198
+ ...d.array
199
+ });
200
+ c && i.push(c);
201
+ } else if (typeof l == "object") {
202
+ const c = Oe({
203
+ allowReserved: d.allowReserved,
204
+ explode: !0,
205
+ name: s,
206
+ style: "deepObject",
207
+ value: l,
208
+ ...d.object
209
+ });
210
+ c && i.push(c);
211
+ } else {
212
+ const c = de({
213
+ allowReserved: d.allowReserved,
214
+ name: s,
215
+ value: l
216
+ });
217
+ c && i.push(c);
218
+ }
219
+ }
220
+ return i.join("&");
221
+ }, An = (e) => {
222
+ if (!e)
223
+ return "stream";
224
+ const n = e.split(";")[0]?.trim();
225
+ if (n) {
226
+ if (n.startsWith("application/json") || n.endsWith("+json"))
227
+ return "json";
228
+ if (n === "multipart/form-data")
229
+ return "formData";
230
+ if (["application/", "audio/", "image/", "video/"].some((t) => n.startsWith(t)))
231
+ return "blob";
232
+ if (n.startsWith("text/"))
233
+ return "text";
234
+ }
235
+ }, Tn = (e, n) => n ? !!(e.headers.has(n) || e.query?.[n] || e.headers.get("Cookie")?.includes(`${n}=`)) : !1;
236
+ async function Nn(e) {
237
+ for (const n of e.security ?? []) {
238
+ if (Tn(e, n.name))
239
+ continue;
240
+ const t = await bn(n, e.auth);
241
+ if (!t)
242
+ continue;
243
+ const r = n.name ?? "Authorization";
244
+ switch (n.in) {
245
+ case "query":
246
+ e.query || (e.query = {}), e.query[r] = t;
247
+ break;
248
+ case "cookie":
249
+ e.headers.append("Cookie", `${r}=${t}`);
250
+ break;
251
+ default:
252
+ e.headers.set(r, t);
253
+ break;
254
+ }
255
+ }
256
+ }
257
+ var Te = (e) => Sn({
258
+ baseUrl: e.baseUrl,
259
+ path: e.path,
260
+ query: e.query,
261
+ querySerializer: typeof e.querySerializer == "function" ? e.querySerializer : Me(e.querySerializer),
262
+ url: e.url
263
+ }), Ne = (e, n) => {
264
+ const t = { ...e, ...n };
265
+ return t.baseUrl?.endsWith("/") && (t.baseUrl = t.baseUrl.substring(0, t.baseUrl.length - 1)), t.headers = Ve(e.headers, n.headers), t;
266
+ }, In = (e) => {
267
+ const n = [];
268
+ return e.forEach((t, r) => {
269
+ n.push([r, t]);
270
+ }), n;
271
+ }, Ve = (...e) => {
272
+ const n = new Headers();
273
+ for (const t of e) {
274
+ if (!t)
275
+ continue;
276
+ const r = t instanceof Headers ? In(t) : Object.entries(t);
277
+ for (const [i, s] of r)
278
+ if (s === null)
279
+ n.delete(i);
280
+ else if (Array.isArray(s))
281
+ for (const l of s)
282
+ n.append(i, l);
283
+ else s !== void 0 && n.set(
284
+ i,
285
+ typeof s == "object" ? JSON.stringify(s) : s
286
+ );
287
+ }
288
+ return n;
289
+ }, he = class {
290
+ fns = [];
291
+ clear() {
292
+ this.fns = [];
293
+ }
294
+ eject(e) {
295
+ const n = this.getInterceptorIndex(e);
296
+ this.fns[n] && (this.fns[n] = null);
297
+ }
298
+ exists(e) {
299
+ const n = this.getInterceptorIndex(e);
300
+ return !!this.fns[n];
301
+ }
302
+ getInterceptorIndex(e) {
303
+ return typeof e == "number" ? this.fns[e] ? e : -1 : this.fns.indexOf(e);
304
+ }
305
+ update(e, n) {
306
+ const t = this.getInterceptorIndex(e);
307
+ return this.fns[t] ? (this.fns[t] = n, e) : !1;
308
+ }
309
+ use(e) {
310
+ return this.fns.push(e), this.fns.length - 1;
311
+ }
312
+ }, Cn = () => ({
313
+ error: new he(),
314
+ request: new he(),
315
+ response: new he()
316
+ }), $n = Me({
317
+ allowReserved: !1,
318
+ array: {
319
+ explode: !0,
320
+ style: "form"
321
+ },
322
+ object: {
323
+ explode: !0,
324
+ style: "deepObject"
325
+ }
326
+ }), Ln = {
327
+ "Content-Type": "application/json"
328
+ }, ve = (e = {}) => ({
329
+ ...yn,
330
+ headers: Ln,
331
+ parseAs: "auto",
332
+ querySerializer: $n,
333
+ ...e
334
+ });
335
+ function Dn({
336
+ onRequest: e,
337
+ onSseError: n,
338
+ onSseEvent: t,
339
+ responseTransformer: r,
340
+ responseValidator: i,
341
+ sseDefaultRetryDelay: s,
342
+ sseMaxRetryAttempts: l,
343
+ sseMaxRetryDelay: d,
344
+ sseSleepFn: c,
345
+ url: f,
346
+ ...p
347
+ }) {
348
+ let u;
349
+ const k = c ?? ((y) => new Promise((w) => setTimeout(w, y)));
350
+ return { stream: async function* () {
351
+ let y = s ?? 3e3, w = 0;
352
+ const j = p.signal ?? new AbortController().signal;
353
+ for (; !j.aborted; ) {
354
+ w++;
355
+ const S = p.headers instanceof Headers ? p.headers : new Headers(p.headers);
356
+ u !== void 0 && S.set("Last-Event-ID", u);
357
+ try {
358
+ const I = {
359
+ redirect: "follow",
360
+ ...p,
361
+ body: p.serializedBody,
362
+ headers: S,
363
+ signal: j
364
+ };
365
+ let N = new Request(f, I);
366
+ e && (N = await e(f, I));
367
+ const A = await (p.fetch ?? globalThis.fetch)(N);
368
+ if (!A.ok) throw new Error(`SSE failed: ${A.status} ${A.statusText}`);
369
+ if (!A.body) throw new Error("No body in SSE response");
370
+ const h = A.body.pipeThrough(new TextDecoderStream()).getReader();
371
+ let m = "";
372
+ const T = () => {
373
+ try {
374
+ h.cancel();
375
+ } catch {
376
+ }
377
+ };
378
+ j.addEventListener("abort", T);
379
+ try {
380
+ for (; ; ) {
381
+ const { done: O, value: C } = await h.read();
382
+ if (O) break;
383
+ m += C, m = m.replace(/\r\n?/g, `
384
+ `);
385
+ const P = m.split(`
386
+
387
+ `);
388
+ m = P.pop() ?? "";
389
+ for (const B of P) {
390
+ const G = B.split(`
391
+ `), x = [];
392
+ let L;
393
+ for (const D of G)
394
+ if (D.startsWith("data:"))
395
+ x.push(D.replace(/^data:\s*/, ""));
396
+ else if (D.startsWith("event:"))
397
+ L = D.replace(/^event:\s*/, "");
398
+ else if (D.startsWith("id:"))
399
+ u = D.replace(/^id:\s*/, "");
400
+ else if (D.startsWith("retry:")) {
401
+ const ne = Number.parseInt(D.replace(/^retry:\s*/, ""), 10);
402
+ Number.isNaN(ne) || (y = ne);
403
+ }
404
+ let M, H = !1;
405
+ if (x.length) {
406
+ const D = x.join(`
407
+ `);
408
+ try {
409
+ M = JSON.parse(D), H = !0;
410
+ } catch {
411
+ M = D;
412
+ }
413
+ }
414
+ H && (i && await i(M), r && (M = await r(M))), t?.({
415
+ data: M,
416
+ event: L,
417
+ id: u,
418
+ retry: y
419
+ }), x.length && (yield M);
420
+ }
421
+ }
422
+ } finally {
423
+ j.removeEventListener("abort", T), h.releaseLock();
424
+ }
425
+ break;
426
+ } catch (I) {
427
+ if (n?.(I), l !== void 0 && w >= l)
428
+ break;
429
+ const N = Math.min(y * 2 ** (w - 1), d ?? 3e4);
430
+ await k(N);
431
+ }
432
+ }
433
+ }() };
434
+ }
435
+ var ze = (e = {}) => {
436
+ let n = Ne(ve(), e);
437
+ const t = () => ({ ...n }), r = (p) => (n = Ne(n, p), t()), i = Cn(), s = async (p) => {
438
+ const u = {
439
+ ...n,
440
+ ...p,
441
+ fetch: p.fetch ?? n.fetch ?? globalThis.fetch,
442
+ headers: Ve(n.headers, p.headers),
443
+ serializedBody: void 0
444
+ };
445
+ u.security && await Nn(u), u.requestValidator && await u.requestValidator(u), u.body !== void 0 && u.bodySerializer && (u.serializedBody = u.bodySerializer(u.body)), (u.body === void 0 || u.serializedBody === "") && u.headers.delete("Content-Type");
446
+ const k = u, b = Te(k);
447
+ return { opts: k, url: b };
448
+ }, l = async (p) => {
449
+ const u = p.throwOnError ?? n.throwOnError, k = p.responseStyle ?? n.responseStyle;
450
+ let b, v;
451
+ try {
452
+ const { opts: y, url: w } = await s(p), j = {
453
+ redirect: "follow",
454
+ ...y,
455
+ body: Ae(y)
456
+ };
457
+ b = new Request(w, j);
458
+ for (const A of i.request.fns)
459
+ A && (b = await A(b, y));
460
+ const S = y.fetch;
461
+ v = await S(b);
462
+ for (const A of i.response.fns)
463
+ A && (v = await A(v, b, y));
464
+ const I = {
465
+ request: b,
466
+ response: v
467
+ };
468
+ if (v.ok) {
469
+ const A = (y.parseAs === "auto" ? An(v.headers.get("Content-Type")) : y.parseAs) ?? "json";
470
+ if (v.status === 204 || v.headers.get("Content-Length") === "0") {
471
+ let m;
472
+ switch (A) {
473
+ case "arrayBuffer":
474
+ case "blob":
475
+ case "text":
476
+ m = await v[A]();
477
+ break;
478
+ case "formData":
479
+ m = new FormData();
480
+ break;
481
+ case "stream":
482
+ m = v.body;
483
+ break;
484
+ default:
485
+ m = {};
486
+ break;
487
+ }
488
+ return y.responseStyle === "data" ? m : {
489
+ data: m,
490
+ ...I
491
+ };
492
+ }
493
+ let h;
494
+ switch (A) {
495
+ case "arrayBuffer":
496
+ case "blob":
497
+ case "formData":
498
+ case "text":
499
+ h = await v[A]();
500
+ break;
501
+ case "json": {
502
+ const m = await v.text();
503
+ h = m ? JSON.parse(m) : {};
504
+ break;
505
+ }
506
+ case "stream":
507
+ return y.responseStyle === "data" ? v.body : {
508
+ data: v.body,
509
+ ...I
510
+ };
511
+ }
512
+ return A === "json" && (y.responseValidator && await y.responseValidator(h), y.responseTransformer && (h = await y.responseTransformer(h))), y.responseStyle === "data" ? h : {
513
+ data: h,
514
+ ...I
515
+ };
516
+ }
517
+ const N = await v.text();
518
+ let $;
519
+ try {
520
+ $ = JSON.parse(N);
521
+ } catch {
522
+ }
523
+ throw $ ?? N;
524
+ } catch (y) {
525
+ let w = y;
526
+ for (const j of i.error.fns)
527
+ j && (w = await j(w, v, b, p));
528
+ if (w = w || {}, u)
529
+ throw w;
530
+ return k === "data" ? void 0 : {
531
+ error: w,
532
+ request: b,
533
+ response: v
534
+ };
535
+ }
536
+ }, d = (p) => (u) => l({ ...u, method: p }), c = (p) => async (u) => {
537
+ const { opts: k, url: b } = await s(u);
538
+ return Dn({
539
+ ...k,
540
+ body: k.body,
541
+ method: p,
542
+ onRequest: async (v, y) => {
543
+ let w = new Request(v, y);
544
+ for (const j of i.request.fns)
545
+ j && (w = await j(w, k));
546
+ return w;
547
+ },
548
+ serializedBody: Ae(k),
549
+ url: b
550
+ });
551
+ };
552
+ return {
553
+ buildUrl: (p) => Te({ ...n, ...p }),
554
+ connect: d("CONNECT"),
555
+ delete: d("DELETE"),
556
+ get: d("GET"),
557
+ getConfig: t,
558
+ head: d("HEAD"),
559
+ interceptors: i,
560
+ options: d("OPTIONS"),
561
+ patch: d("PATCH"),
562
+ post: d("POST"),
563
+ put: d("PUT"),
564
+ request: l,
565
+ setConfig: r,
566
+ sse: {
567
+ connect: c("CONNECT"),
568
+ delete: c("DELETE"),
569
+ get: c("GET"),
570
+ head: c("HEAD"),
571
+ options: c("OPTIONS"),
572
+ patch: c("PATCH"),
573
+ post: c("POST"),
574
+ put: c("PUT"),
575
+ trace: c("TRACE")
576
+ },
577
+ trace: d("TRACE")
578
+ };
579
+ }, Bn = ze(ve()), Rn = (e) => (e.client ?? Bn).post({
580
+ security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
581
+ key: "FeedbackTokenAuth",
582
+ scheme: "bearer",
583
+ type: "http"
584
+ }],
585
+ url: "/v1/ingest/events",
586
+ ...e,
587
+ headers: {
588
+ "Content-Type": "application/json",
589
+ ...e.headers
590
+ }
591
+ }), On = "0.6.0", ge = 100, Mn = /* @__PURE__ */ new Set(["submission_sent", "submission_failed", "followup_answered", "task_completed"]);
592
+ function Vn(e) {
593
+ if (typeof e?.baseUrl != "string" || e.baseUrl.length === 0)
594
+ throw new TypeError("[innspel] createIngestTelemetry: baseUrl mangler. Se README.md.");
595
+ if (typeof e.tenantKey != "string" || e.tenantKey.length === 0)
596
+ throw new TypeError("[innspel] createIngestTelemetry: tenantKey mangler. Se README.md.");
597
+ if (typeof e.platform != "string" || e.platform.length === 0)
598
+ throw new TypeError("[innspel] createIngestTelemetry: platform mangler (ios · android · web · …).");
599
+ const n = ze(ve({ baseUrl: e.baseUrl, ...e.fetch ? { fetch: e.fetch } : {} })), t = e.flushAfterMs ?? 2e3, r = Math.min(e.maxBatch ?? 25, ge);
600
+ let i = [], s;
601
+ async function l() {
602
+ if (s !== void 0 && (clearTimeout(s), s = void 0), i.length === 0) return;
603
+ const d = i.slice(0, ge);
604
+ i = i.slice(ge);
605
+ try {
606
+ await Rn({
607
+ client: n,
608
+ headers: { "X-Innspel-Tenant-Key": e.tenantKey },
609
+ body: { events: d, platform: e.platform, sdkVersion: On, ...e.appVersion ? { appVersion: e.appVersion } : {} }
610
+ });
611
+ } catch {
612
+ }
613
+ i.length > 0 && await l();
614
+ }
615
+ return {
616
+ emit(d) {
617
+ if (i.push(zn(d)), i.length >= r || Mn.has(d.name) || t === 0) {
618
+ l();
619
+ return;
620
+ }
621
+ s ??= setTimeout(() => {
622
+ l();
623
+ }, t);
624
+ },
625
+ flush: l
626
+ };
627
+ }
628
+ function zn(e) {
629
+ const n = (/* @__PURE__ */ new Date()).toISOString();
630
+ switch (e.name) {
631
+ case "track_selected":
632
+ return { name: e.name, at: n, type: e.type };
633
+ case "known_issue_shown":
634
+ return { name: e.name, at: n, count: Math.max(0, Math.min(3, e.count)) };
635
+ case "submission_sent":
636
+ return { name: e.name, at: n, type: e.type, hasAttachment: e.hasAttachment, offlineQueued: e.offlineQueued };
637
+ case "submission_failed":
638
+ return { name: e.name, at: n, reason: Pn(e.reason) };
639
+ case "task_completed":
640
+ return { name: e.name, at: n, outcome: e.outcome };
641
+ default:
642
+ return { name: e.name, at: n };
643
+ }
644
+ }
645
+ function Pn(e) {
646
+ const n = e.toLowerCase();
647
+ return n.includes("network") || n.includes("offline") || n.includes("fetch") ? "network" : n.includes("rate") || n.includes("429") ? "rate_limited" : n.includes("unauth") || n.includes("token") || n.includes("401") ? "unauthorized" : n.includes("valid") || n.includes("text_") || n.includes("field") || n.includes("correlation") || n.includes("attachment") || n.includes("screenshot") ? "validation" : n.includes("server") || n.includes("internal") || n.includes("50") ? "server" : "unknown";
648
+ }
649
+ const Pe = "data-innspel-private", Ue = "data-innspel-widget", Un = /* @__PURE__ */ new Set(["SCRIPT", "NOSCRIPT", "STYLE", "LINK", "META", "TEMPLATE", "IFRAME", "OBJECT", "EMBED", "VIDEO", "AUDIO"]);
650
+ function Kn(e, n) {
651
+ const t = [], r = [];
652
+ return { klon: Ke(e, e, t, n, r), automasker: t, tekstRekter: r };
653
+ }
654
+ function Ke(e, n, t, r, i) {
655
+ if (e.nodeType === Node.TEXT_NODE) {
656
+ for (const d of _n(e, r)) i.push(d);
657
+ return e.cloneNode(!1);
658
+ }
659
+ if (e.nodeType !== Node.ELEMENT_NODE) return null;
660
+ const s = e;
661
+ if (Un.has(s.tagName) || s.hasAttribute(Ue)) return null;
662
+ const l = s.cloneNode(!1);
663
+ if (Ie(s, l), l.removeAttribute("id"), s.hasAttribute(Pe)) {
664
+ const d = He(s.getBoundingClientRect(), r);
665
+ return d && t.push(d), l.textContent = "", l.style.setProperty("color", "transparent"), l.style.setProperty("background", "var(--innspel-screen-auto-mask-fill, #101114)"), l;
666
+ }
667
+ if (s instanceof HTMLImageElement)
668
+ return Hn(s, l);
669
+ if (s instanceof HTMLCanvasElement)
670
+ try {
671
+ const d = s.toDataURL(), c = document.createElement("img");
672
+ return Ie(s, c), c.setAttribute("src", d), c;
673
+ } catch {
674
+ return ae(l);
675
+ }
676
+ if (s instanceof HTMLTextAreaElement)
677
+ return l.textContent = s.value, l;
678
+ if (s instanceof HTMLInputElement)
679
+ return s.type === "password" ? l.setAttribute("value", "•".repeat(s.value.length)) : s.type === "checkbox" || s.type === "radio" ? s.checked ? l.setAttribute("checked", "") : l.removeAttribute("checked") : l.setAttribute("value", s.value), l;
680
+ if (s instanceof HTMLSelectElement)
681
+ for (const [d, c] of Array.from(s.options).entries()) {
682
+ const f = l.children[d];
683
+ f && (c.selected ? f.setAttribute("selected", "") : f.removeAttribute("selected"));
684
+ }
685
+ for (const d of Array.from(s.childNodes)) {
686
+ const c = Ke(d, n, t, r, i);
687
+ c && l.appendChild(c);
688
+ }
689
+ return l;
690
+ }
691
+ function Hn(e, n) {
692
+ try {
693
+ if (!e.complete || e.naturalWidth === 0) return ae(n);
694
+ const t = document.createElement("canvas");
695
+ t.width = e.naturalWidth, t.height = e.naturalHeight;
696
+ const r = t.getContext("2d");
697
+ return r ? (r.drawImage(e, 0, 0), n.setAttribute("src", t.toDataURL()), n.removeAttribute("srcset"), n.removeAttribute("loading"), n) : ae(n);
698
+ } catch {
699
+ return ae(n);
700
+ }
701
+ }
702
+ function ae(e) {
703
+ const n = document.createElement("div");
704
+ return n.setAttribute("style", e.getAttribute("style") ?? ""), n.style.setProperty("background", "var(--innspel-color-neutral-bg, #EEF0F3)"), n.style.setProperty("display", "inline-block"), n;
705
+ }
706
+ function Ie(e, n) {
707
+ const t = getComputedStyle(e), r = [];
708
+ for (let i = 0; i < t.length; i++) {
709
+ const s = t[i], l = t.getPropertyValue(s);
710
+ l && r.push(`${s}:${l}`);
711
+ }
712
+ r.length && n.setAttribute("style", r.join(";")), n.removeAttribute("class");
713
+ }
714
+ function _n(e, n) {
715
+ if (!e.data.trim() || typeof document.createRange != "function") return [];
716
+ const t = document.createRange();
717
+ if (t.selectNodeContents(e), typeof t.getClientRects != "function") return [];
718
+ const r = [];
719
+ for (const i of Array.from(t.getClientRects())) {
720
+ const s = He(i, n);
721
+ s && r.push(s);
722
+ }
723
+ return r;
724
+ }
725
+ function He(e, n) {
726
+ const t = Math.max(0, e.left), r = Math.max(0, e.top), i = Math.min(n.width, e.right), s = Math.min(n.height, e.bottom);
727
+ return i <= t || s <= r ? null : { x: t, y: r, width: i - t, height: s - r };
728
+ }
729
+ function qn(e, n, t, r) {
730
+ e.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
731
+ const i = new XMLSerializer().serializeToString(e);
732
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml" style="width:${n.width}px;height:${n.height}px;overflow:hidden;background:${r}"><div xmlns="http://www.w3.org/1999/xhtml" style="transform:translate(${-t.x}px,${-t.y}px)">${i}</div></div></foreignObject></svg>`;
733
+ }
734
+ function Jn(e, n, t = 4096) {
735
+ return Math.min(n, t / Math.max(e.width, e.height, 1));
736
+ }
737
+ async function Wn(e, n, t) {
738
+ const r = new Image();
739
+ r.decoding = "sync";
740
+ const i = new Promise((d, c) => {
741
+ r.onload = () => d(), r.onerror = () => c(new Error("kunne ikke rendre siden"));
742
+ });
743
+ r.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`, await i;
744
+ const s = document.createElement("canvas");
745
+ s.width = Math.round(n.width * t), s.height = Math.round(n.height * t);
746
+ const l = s.getContext("2d");
747
+ if (!l) throw new Error("canvas er ikke tilgjengelig");
748
+ return l.drawImage(r, 0, 0, s.width, s.height), s;
749
+ }
750
+ const Ce = (e, n) => ({
751
+ x: Math.floor(e.x * n),
752
+ y: Math.floor(e.y * n),
753
+ width: Math.ceil(e.width * n),
754
+ height: Math.ceil(e.height * n)
755
+ });
756
+ async function Gn(e = document.body) {
757
+ const n = { width: window.innerWidth, height: window.innerHeight }, t = { x: window.scrollX, y: window.scrollY }, { klon: r, automasker: i, tekstRekter: s } = Kn(e, n), l = getComputedStyle(document.body).backgroundColor || "#fff", d = qn(r, n, t, l), c = Jn(n, window.devicePixelRatio || 1), f = await Wn(d, n, c);
758
+ return {
759
+ bilde: f,
760
+ width: f.width,
761
+ height: f.height,
762
+ automasker: i.map((p) => Ce(p, c)),
763
+ tekstRekter: s.map((p) => Ce(p, c)),
764
+ kilde: "side"
765
+ };
766
+ }
767
+ const Xn = {
768
+ capture: (e) => Gn(e)
769
+ }, _e = ':root{--innspel-color-bg: #F6F7F9;--innspel-color-surface: #FFFFFF;--innspel-color-surface-raised: #EDEFF3;--innspel-color-border: #D2D7DE;--innspel-color-border-strong: #B9C0C9;--innspel-color-border-interactive: #6F7883;--innspel-color-text-primary: #14181D;--innspel-color-text-secondary: #454D57;--innspel-color-text-muted: #5C6470;--innspel-color-text-disabled: #9AA2AD;--innspel-color-action-primary: #0A6673;--innspel-color-on-action-primary: #FFFFFF;--innspel-color-action-secondary-border: #6F7883;--innspel-color-action-secondary-text: #14181D;--innspel-color-brand: #0A6673;--innspel-color-on-brand: #FFFFFF;--innspel-color-brand-fill: #0A6673;--innspel-color-on-brand-fill: #FFFFFF;--innspel-color-brand-bg: #E0F0F2;--innspel-color-danger: #B3001B;--innspel-color-danger-fill: #B3001B;--innspel-color-on-danger-fill: #FFFFFF;--innspel-color-danger-bg: #FCE8EA;--innspel-color-success: #04693C;--innspel-color-on-success: #FFFFFF;--innspel-color-success-bg: #E4F4EC;--innspel-color-warning: #7A5200;--innspel-color-on-warning: #FFFFFF;--innspel-color-warning-bg: #FBF1DE;--innspel-color-info: #00588F;--innspel-color-on-info: #FFFFFF;--innspel-color-info-bg: #E4F0F8;--innspel-color-neutral: #5C6470;--innspel-color-on-neutral: #FFFFFF;--innspel-color-neutral-bg: #EEF0F3;--innspel-color-scrim: rgba(10, 14, 18, .45);--innspel-space-xs: 4px;--innspel-space-sm: 8px;--innspel-space-md: 16px;--innspel-space-lg: 24px;--innspel-space-xl: 32px;--innspel-space-xxl: 48px;--innspel-radius-sm: 6px;--innspel-radius-md: 8px;--innspel-radius-lg: 12px;--innspel-radius-pill: 999px;--innspel-font-display: 40px;--innspel-font-h1: 24px;--innspel-font-h2: 21px;--innspel-font-h3: 18px;--innspel-font-body: 16px;--innspel-font-small: 13px;--innspel-font-tiny: 11px;--innspel-line-height-display: 48px;--innspel-line-height-h1: 30px;--innspel-line-height-h2: 27px;--innspel-line-height-h3: 24px;--innspel-line-height-body: 24px;--innspel-line-height-small: 18px;--innspel-line-height-tiny: 16px;--innspel-weight-regular: 400;--innspel-weight-medium: 500;--innspel-weight-semibold: 600;--innspel-weight-bold: 700;--innspel-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;--innspel-motion-fast: .12s;--innspel-motion-base: .2s;--innspel-motion-slow: .32s;--innspel-icon-inline: 20px;--innspel-icon-minste: 16px;--innspel-layout-touch: 48px;--innspel-layout-screen-padding: 24px;--innspel-layout-hairline: 1px;--innspel-layout-breakpoint: 768px;--innspel-layout-breakpoint-smal: 900px;--innspel-layout-content-width: 1120px;--innspel-layout-reading-width: 720px;--innspel-screen-brush-fill: #E5007D;--innspel-screen-auto-mask-fill: #101114;--innspel-screen-auto-mask-stroke: #E5007D;--innspel-screen-preview-backdrop: #000000;--innspel-screen-brush-width: 28;--innspel-screen-text-blur-radius: 24}[data-innspel-theme=dark]{--innspel-color-bg: #111417;--innspel-color-surface: #1A1E22;--innspel-color-surface-raised: #232830;--innspel-color-border: #2E343B;--innspel-color-border-strong: #3D444D;--innspel-color-border-interactive: #7C8894;--innspel-color-text-primary: #F2F4F6;--innspel-color-text-secondary: #B4BCC5;--innspel-color-text-muted: #8D96A1;--innspel-color-text-disabled: #5A626B;--innspel-color-action-primary: #5AD3E2;--innspel-color-on-action-primary: #04252A;--innspel-color-action-secondary-border: #7C8894;--innspel-color-action-secondary-text: #F2F4F6;--innspel-color-brand: #5AD3E2;--innspel-color-on-brand: #04252A;--innspel-color-brand-fill: #0E7C8C;--innspel-color-on-brand-fill: #FFFFFF;--innspel-color-brand-bg: #0C2A30;--innspel-color-danger: #FF7A8C;--innspel-color-danger-fill: #C4001F;--innspel-color-on-danger-fill: #FFFFFF;--innspel-color-danger-bg: #2C1116;--innspel-color-success: #3ED88A;--innspel-color-on-success: #062015;--innspel-color-success-bg: #0E2A1E;--innspel-color-warning: #FFC24D;--innspel-color-on-warning: #2A1C02;--innspel-color-warning-bg: #2C2107;--innspel-color-info: #5CC0FF;--innspel-color-on-info: #04222F;--innspel-color-info-bg: #0E2531;--innspel-color-neutral: #A3ACB6;--innspel-color-on-neutral: #111417;--innspel-color-neutral-bg: #242A31;--innspel-color-scrim: rgba(0, 0, 0, .72)}', qe = ".innspel-rot{font-family:var(--innspel-family-base);font-size:var(--innspel-font-body);line-height:var(--innspel-line-height-body);color:var(--innspel-color-text-primary);box-sizing:border-box}.innspel-rot *,.innspel-rot *:before,.innspel-rot *:after{box-sizing:inherit}.innspel-rot button,.innspel-rot textarea,.innspel-rot input{font:inherit;color:inherit}.innspel-rot :focus-visible{outline:calc(2 * var(--innspel-layout-hairline)) solid var(--innspel-color-text-primary);outline-offset:var(--innspel-space-xs)}.innspel-scrim{position:fixed;inset:0;background:var(--innspel-color-scrim);z-index:2147483000;display:flex;align-items:flex-start;justify-content:center;padding:var(--innspel-space-xl) var(--innspel-space-md)}.innspel-scrim[data-form=bunnark]{align-items:flex-end;padding:0}.innspel-dialog{background:var(--innspel-color-bg);color:var(--innspel-color-text-primary);border:var(--innspel-layout-hairline) solid var(--innspel-color-border-strong);border-radius:var(--innspel-radius-lg);width:100%;max-width:calc(9 * var(--innspel-layout-touch) + 2 * var(--innspel-space-md));max-height:100%;display:flex;flex-direction:column;overflow:hidden}.innspel-scrim[data-form=bunnark] .innspel-dialog{max-width:none;max-height:88%;border-radius:calc(2 * var(--innspel-radius-lg)) calc(2 * var(--innspel-radius-lg)) 0 0;border-bottom:none}.innspel-dialog-hode{display:flex;align-items:center;justify-content:space-between;padding:var(--innspel-space-sm) var(--innspel-space-sm) var(--innspel-space-sm) var(--innspel-space-md);border-bottom:var(--innspel-layout-hairline) solid var(--innspel-color-border);min-height:var(--innspel-layout-touch)}.innspel-dialog-tittel{font-size:var(--innspel-font-small);color:var(--innspel-color-text-secondary)}.innspel-handtak{width:var(--innspel-layout-touch);height:var(--innspel-space-xs);border-radius:var(--innspel-radius-pill);background:var(--innspel-color-border-interactive);margin:0 auto}.innspel-dialog-kropp{flex:1;overflow-y:auto;padding:var(--innspel-space-md);display:flex;flex-direction:column;gap:var(--innspel-space-md);min-height:0}.innspel-dialog-fot{padding:var(--innspel-space-md);border-top:var(--innspel-layout-hairline) solid var(--innspel-color-border);background:var(--innspel-color-surface);display:flex;flex-direction:column;gap:var(--innspel-space-sm)}.innspel-knapp-ramme{display:flex;flex-direction:column;gap:var(--innspel-space-xs)}.innspel-knapp-ramme[data-grow=true]{flex:1}.innspel-knapp{width:100%;min-height:var(--innspel-layout-touch);padding:0 var(--innspel-space-md);border-radius:var(--innspel-radius-md);border:var(--innspel-layout-hairline) solid transparent;font-weight:var(--innspel-weight-semibold);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:var(--innspel-space-sm);background:transparent;text-align:center}.innspel-knapp[data-variant=primary]{background:var(--innspel-color-action-primary);color:var(--innspel-color-on-action-primary);border-color:var(--innspel-color-action-primary)}.innspel-knapp[data-variant=secondary]{color:var(--innspel-color-action-secondary-text);border-color:var(--innspel-color-action-secondary-border)}.innspel-knapp[data-variant=ghost]{color:var(--innspel-color-text-secondary)}.innspel-knapp[data-variant=danger]{color:var(--innspel-color-danger);border-color:var(--innspel-color-danger)}.innspel-knapp[data-tall=true]{min-height:calc(1.5 * var(--innspel-layout-touch))}.innspel-knapp:disabled{background:var(--innspel-color-surface-raised);color:var(--innspel-color-text-disabled);border-color:var(--innspel-color-border);cursor:not-allowed}.innspel-ikonknapp{min-width:var(--innspel-layout-touch);min-height:var(--innspel-layout-touch);background:transparent;border:none;color:var(--innspel-color-text-secondary);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:var(--innspel-space-xs);font-size:var(--innspel-font-small);border-radius:var(--innspel-radius-md)}.innspel-h{display:flex;flex-direction:column;gap:var(--innspel-space-xs)}.innspel-h>h2,.innspel-h>h1{margin:0;font-size:var(--innspel-font-h2);line-height:var(--innspel-line-height-h2);font-weight:var(--innspel-weight-semibold);color:var(--innspel-color-text-primary)}.innspel-hint{margin:0;font-size:var(--innspel-font-small);line-height:var(--innspel-line-height-small);color:var(--innspel-color-text-muted)}.innspel-p{margin:0;font-size:var(--innspel-font-body);line-height:var(--innspel-line-height-body);color:var(--innspel-color-text-primary)}.innspel-kort{background:var(--innspel-color-surface);border:var(--innspel-layout-hairline) solid var(--innspel-color-border);border-radius:var(--innspel-radius-lg);padding:var(--innspel-space-md);display:flex;flex-direction:column;gap:var(--innspel-space-sm)}.innspel-kort[data-stiplet=true]{border-style:dashed}.innspel-pille{display:inline-flex;align-items:center;align-self:flex-start;gap:var(--innspel-space-xs);padding:var(--innspel-space-xs) var(--innspel-space-sm);border-radius:var(--innspel-radius-pill);font-size:var(--innspel-font-small);font-weight:var(--innspel-weight-medium)}.innspel-pille[data-farge=info]{color:var(--innspel-color-info);background:var(--innspel-color-info-bg)}.innspel-pille[data-farge=success]{color:var(--innspel-color-success);background:var(--innspel-color-success-bg)}.innspel-pille[data-farge=warning]{color:var(--innspel-color-warning);background:var(--innspel-color-warning-bg)}.innspel-pille[data-farge=neutral]{color:var(--innspel-color-neutral);background:var(--innspel-color-neutral-bg)}.innspel-pille[data-farge=danger]{color:var(--innspel-color-danger);background:var(--innspel-color-danger-bg)}.innspel-banner{display:flex;gap:var(--innspel-space-sm);align-items:flex-start;border-radius:var(--innspel-radius-md);padding:var(--innspel-space-sm) var(--innspel-space-md);font-size:var(--innspel-font-small);line-height:var(--innspel-line-height-small);font-weight:var(--innspel-weight-medium)}.innspel-banner>p{margin:0;flex:1}.innspel-banner[data-tone=info]{color:var(--innspel-color-info);background:var(--innspel-color-info-bg)}.innspel-banner[data-tone=success]{color:var(--innspel-color-success);background:var(--innspel-color-success-bg)}.innspel-banner[data-tone=warning]{color:var(--innspel-color-warning);background:var(--innspel-color-warning-bg)}.innspel-banner[data-tone=danger]{color:var(--innspel-color-danger);background:var(--innspel-color-danger-bg)}.innspel-skjelett{height:var(--innspel-space-lg);width:100%;border-radius:var(--innspel-radius-sm);background:var(--innspel-color-surface-raised)}.innspel-skjelett[data-hoy=true]{height:calc(2 * var(--innspel-layout-touch))}.innspel-rad{display:flex;gap:var(--innspel-space-sm)}.innspel-rad[data-gap=md]{gap:var(--innspel-space-md)}.innspel-stabel{display:flex;flex-direction:column;gap:var(--innspel-space-md)}.innspel-stabel[data-gap=sm]{gap:var(--innspel-space-sm)}.innspel-liste{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--innspel-space-sm)}.innspel-flate{flex:1;min-height:calc(2.5 * var(--innspel-layout-touch));background:var(--innspel-color-surface);border:var(--innspel-layout-hairline) solid var(--innspel-color-border-strong);border-radius:var(--innspel-radius-lg);color:var(--innspel-color-text-primary);cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--innspel-space-sm);padding:var(--innspel-space-md)}.innspel-flate-ikon{font-size:var(--innspel-font-h1)}.innspel-flate-tittel{font-size:var(--innspel-font-h3);font-weight:var(--innspel-weight-semibold)}.innspel-flate-under{font-size:var(--innspel-font-small);color:var(--innspel-color-text-muted);text-align:center}.innspel-kjent-tittel{margin:0;font-weight:var(--innspel-weight-medium)}.innspel-kjent-omvei{margin:0;font-size:var(--innspel-font-small);line-height:var(--innspel-line-height-small);color:var(--innspel-color-text-secondary)}.innspel-kjent-svar{display:flex;gap:var(--innspel-space-sm);flex-wrap:wrap}.innspel-felt{display:flex;flex-direction:column;gap:var(--innspel-space-sm)}.innspel-felt-etikett{font-size:var(--innspel-font-h3);font-weight:var(--innspel-weight-semibold)}.innspel-tekstfelt{width:100%;min-height:calc(2 * var(--innspel-layout-touch));background:var(--innspel-color-surface-raised);border:var(--innspel-layout-hairline) solid var(--innspel-color-border-strong);border-radius:var(--innspel-radius-md);padding:var(--innspel-space-md);color:var(--innspel-color-text-primary);resize:vertical}.innspel-tekstfelt::placeholder{color:var(--innspel-color-text-muted)}.innspel-tekstfelt[data-full=true]{border-color:var(--innspel-color-warning)}.innspel-utfall{flex:1;min-height:var(--innspel-layout-touch);padding:var(--innspel-space-sm);font:inherit;font-size:var(--innspel-font-small);color:var(--innspel-color-text-primary);background:var(--innspel-color-surface-raised);border:var(--innspel-layout-hairline) solid var(--innspel-color-border-strong);border-radius:var(--innspel-radius-md);cursor:pointer}.innspel-utfall[data-aktiv=true]{font-weight:var(--innspel-weight-semibold);background:var(--innspel-color-brand-bg);border-color:var(--innspel-color-brand)}.innspel-teller{align-self:flex-end;font-size:var(--innspel-font-small);color:var(--innspel-color-text-muted)}.innspel-teller[data-full=true]{color:var(--innspel-color-warning)}.innspel-chip{display:flex;align-items:center;gap:var(--innspel-space-sm);min-height:var(--innspel-layout-touch);border:var(--innspel-layout-hairline) solid var(--innspel-color-border-interactive);border-radius:var(--innspel-radius-pill);padding:0 var(--innspel-space-xs) 0 var(--innspel-space-md);font-size:var(--innspel-font-small)}.innspel-chip>span{flex:1}.innspel-kontekst{border-top:var(--innspel-layout-hairline) solid var(--innspel-color-border);padding-top:var(--innspel-space-sm)}.innspel-kontekst-bryter{width:100%;min-height:calc(var(--innspel-layout-touch) - var(--innspel-space-sm));background:transparent;border:none;color:var(--innspel-color-text-secondary);font-size:var(--innspel-font-small);display:flex;align-items:center;gap:var(--innspel-space-sm);cursor:pointer;padding:0;text-align:left;border-radius:var(--innspel-radius-sm)}.innspel-kontekst-linje{display:flex;align-items:center;gap:var(--innspel-space-sm);min-height:calc(var(--innspel-layout-touch) - var(--innspel-space-sm));border-bottom:var(--innspel-layout-hairline) solid var(--innspel-color-border);font-size:var(--innspel-font-small)}.innspel-kontekst-nokkel{color:var(--innspel-color-text-muted);min-width:calc(2 * var(--innspel-layout-touch))}.innspel-kontekst-verdi{flex:1;color:var(--innspel-color-text-primary);overflow-wrap:anywhere}.innspel-varsel{display:flex;flex-direction:column;gap:var(--innspel-space-sm);background:var(--innspel-color-warning-bg);color:var(--innspel-color-warning);border-radius:var(--innspel-radius-md);padding:var(--innspel-space-sm) var(--innspel-space-md);font-size:var(--innspel-font-small);line-height:var(--innspel-line-height-small);font-weight:var(--innspel-weight-medium)}.innspel-varsel>p{margin:0}.innspel-verktoy{flex:1;min-height:var(--innspel-layout-touch);background:transparent;border:var(--innspel-layout-hairline) solid var(--innspel-color-action-secondary-border);border-bottom-width:calc(2 * var(--innspel-layout-hairline));border-radius:var(--innspel-radius-md);color:var(--innspel-color-text-primary);font-size:var(--innspel-font-small);cursor:pointer;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--innspel-space-xs);padding:var(--innspel-space-xs)}.innspel-verktoy[aria-pressed=true]{background:var(--innspel-color-surface-raised);border-bottom-color:var(--innspel-color-text-primary);font-weight:var(--innspel-weight-semibold)}.innspel-forhandsvisning-ramme{background:var(--innspel-screen-preview-backdrop);border-radius:var(--innspel-radius-md);overflow:hidden;display:flex;align-items:center;justify-content:center;min-height:calc(4 * var(--innspel-layout-touch))}.innspel-forhandsvisning{position:relative;display:block;max-width:100%;touch-action:none;cursor:crosshair}.innspel-forhandsvisning>canvas{display:block;max-width:100%;height:auto}.innspel-maske{position:absolute;pointer-events:none}.innspel-maske[data-art=auto]{background:var(--innspel-screen-auto-mask-fill);border:calc(2 * var(--innspel-layout-hairline)) solid var(--innspel-screen-auto-mask-stroke);color:var(--innspel-color-text-secondary);font-size:var(--innspel-font-small);display:flex;align-items:center;justify-content:center;overflow:hidden;white-space:nowrap}.innspel-maske[data-art=egen]{background:var(--innspel-screen-brush-fill)}.innspel-skjult-fil{position:absolute;width:var(--innspel-layout-hairline);height:var(--innspel-layout-hairline);opacity:0;overflow:hidden}.innspel-kvittering{margin:auto 0;text-align:center;display:flex;flex-direction:column;gap:var(--innspel-space-md);align-items:center}.innspel-kvittering-ikon{font-size:calc(2 * var(--innspel-font-h1));color:var(--innspel-color-success)}.innspel-kvittering-ikon[data-tone=neutral]{color:var(--innspel-color-neutral)}.innspel-svar{border-left:calc(2 * var(--innspel-layout-hairline)) solid var(--innspel-color-brand);padding-left:var(--innspel-space-sm);display:flex;flex-direction:column;gap:var(--innspel-space-xs)}.innspel-svar-fra{font-size:var(--innspel-font-small);color:var(--innspel-color-text-secondary)}.innspel-svar-tekst{margin:0;font-size:var(--innspel-font-small);line-height:var(--innspel-line-height-small);color:var(--innspel-color-text-primary)}.innspel-sr{position:absolute;width:var(--innspel-layout-hairline);height:var(--innspel-layout-hairline);padding:0;margin:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}@media(prefers-reduced-motion:no-preference){.innspel-dialog{animation:innspel-inn var(--innspel-motion-base) ease-out}@keyframes innspel-inn{0%{opacity:0;transform:translateY(var(--innspel-space-md))}to{opacity:1;transform:none}}}", $e = "data-innspel-style";
770
+ function Qn(e = document) {
771
+ if (e.head.querySelector(`style[${$e}]`)) return;
772
+ const n = e.createElement("style");
773
+ n.setAttribute($e, ""), n.textContent = `${_e}
774
+ ${qe}`, e.head.appendChild(n);
775
+ }
776
+ const Ct = `${_e}
777
+ ${qe}`;
778
+ function Yn(e) {
779
+ return /Edg\/(\d+)/.exec(e)?.[1] !== void 0 ? `Edge ${/Edg\/(\d+)/.exec(e)[1]}` : /OPR\/(\d+)/.exec(e) ? `Opera ${/OPR\/(\d+)/.exec(e)[1]}` : /Firefox\/(\d+)/.exec(e) ? `Firefox ${/Firefox\/(\d+)/.exec(e)[1]}` : /Chrome\/(\d+)/.exec(e) ? `Chrome ${/Chrome\/(\d+)/.exec(e)[1]}` : /Version\/(\d+).*Safari/.exec(e) ? `Safari ${/Version\/(\d+).*Safari/.exec(e)[1]}` : void 0;
780
+ }
781
+ function Zn(e) {
782
+ try {
783
+ return new URL(e, "http://x").pathname || "/";
784
+ } catch {
785
+ return "/";
786
+ }
787
+ }
788
+ function et(e = {}, n = typeof navigator > "u" ? {} : navigator) {
789
+ const t = { platform: "web" }, r = n.userAgent ? Yn(n.userAgent) : void 0;
790
+ return r && (t.os = r), n.language && (t.locale = n.language), e.appVersion && (t.appVersion = e.appVersion), e.build && (t.build = e.build), t;
791
+ }
792
+ async function nt(e) {
793
+ if (e.type !== "image/png" && e.type !== "image/jpeg")
794
+ throw new Error("type: kun PNG eller JPEG");
795
+ if (e.size > Ee.maxBytes)
796
+ throw new Error(`bytes: over ${Ee.maxBytes}`);
797
+ const n = await tt(e);
798
+ return { bilde: n, width: n.width, height: n.height, automasker: [], kilde: "fil" };
799
+ }
800
+ async function tt(e) {
801
+ if (typeof createImageBitmap == "function")
802
+ try {
803
+ return await createImageBitmap(e, { imageOrientation: "from-image" });
804
+ } catch {
805
+ }
806
+ const n = URL.createObjectURL(e);
807
+ try {
808
+ const t = new Image();
809
+ return await new Promise((r, i) => {
810
+ t.onload = () => r(), t.onerror = () => i(new Error("kunne ikke dekode bildet")), t.src = n;
811
+ }), t;
812
+ } finally {
813
+ URL.revokeObjectURL(n);
814
+ }
815
+ }
816
+ const rt = 0.85, it = 4096;
817
+ async function st(e, n, t = ot()) {
818
+ const r = Math.min(1, it / Math.max(e.width, e.height, 1)), i = { width: Math.max(1, Math.round(e.width * r)), height: Math.max(1, Math.round(e.height * r)) }, s = { width: e.width, height: e.height }, l = document.createElement("canvas");
819
+ l.width = i.width, l.height = i.height;
820
+ const d = l.getContext("2d");
821
+ if (!d) throw new Error("canvas er ikke tilgjengelig");
822
+ if (d.drawImage(e.bilde, 0, 0, i.width, i.height), n.allTekst)
823
+ if (e.tekstRekter && e.tekstRekter.length) {
824
+ d.fillStyle = t.auto;
825
+ for (const f of e.tekstRekter) me(d, le(f, s, i));
826
+ } else
827
+ lt(d, l);
828
+ d.fillStyle = t.auto;
829
+ for (const f of n.automasker) me(d, le(f, s, i));
830
+ d.fillStyle = t.egen;
831
+ for (const f of n.egne) me(d, le(f, s, i));
832
+ return { mime: "image/jpeg", body: await at(l), width: i.width, height: i.height };
833
+ }
834
+ function me(e, n) {
835
+ e.fillRect(n.x, n.y, n.width, n.height);
836
+ }
837
+ function lt(e, n) {
838
+ const r = document.createElement("canvas");
839
+ r.width = Math.max(1, Math.round(n.width / 24)), r.height = Math.max(1, Math.round(n.height / 24));
840
+ const i = r.getContext("2d");
841
+ i && (i.imageSmoothingEnabled = !0, i.drawImage(n, 0, 0, r.width, r.height), e.imageSmoothingEnabled = !1, e.clearRect(0, 0, n.width, n.height), e.drawImage(r, 0, 0, r.width, r.height, 0, 0, n.width, n.height));
842
+ }
843
+ function at(e) {
844
+ return new Promise((n, t) => {
845
+ e.toBlob((r) => r ? n(r) : t(new Error("kunne ikke enkode bildet")), "image/jpeg", rt);
846
+ });
847
+ }
848
+ function ot() {
849
+ const e = (n, t) => typeof getComputedStyle != "function" ? t : getComputedStyle(document.documentElement).getPropertyValue(n).trim() || t;
850
+ return {
851
+ auto: e("--innspel-screen-auto-mask-fill", "#101114"),
852
+ egen: e("--innspel-screen-brush-fill", "#E5007D")
853
+ };
854
+ }
855
+ const a = {
856
+ // 2a — inngang. Vertens knapp får denne etiketten via `bindTrigger` (DD-47).
857
+ inngangHint: "Vi legger ved side, nettleser og versjon — aldri navn eller e-post.",
858
+ // 2b — første valg
859
+ valgTittel: "Hva gjelder det?",
860
+ valgUnder: "Ett valg. Vi spør aldri om kategori eller alvorlighet.",
861
+ sporFeil: "Noe virker ikke",
862
+ sporFeilUnder: "Feilsporet — kontekst legges ved",
863
+ sporOnske: "Jeg ønsker meg noe",
864
+ sporOnskeUnder: "Ønskesporet — aldri spørsmål om reproduksjon",
865
+ // 2c — kjente feil (DD-29, DD-30)
866
+ kjenteFeilTittelFeil: "Er det dette du ser?",
867
+ kjenteFeilUnderFeil: "«Ja» registrerer deg på saken. «Ligner» sender ditt eget med lenke.",
868
+ kjenteFeilTittelOnske: "Har noen ønsket dette?",
869
+ kjenteFeilUnderOnske: "Ett klikk legger deg til på ønsket — ingen ny sak.",
870
+ kjenteFeilLaster: "Sjekker kjente feil",
871
+ kjenteFeilTilbud: "Treffene er et tilbud, aldri en sperre. «Nei» går rett til feltet.",
872
+ svarJa: "Ja, jeg også",
873
+ svarLigner: "Ligner, men ikke helt",
874
+ svarNei: "Nei, det er noe annet",
875
+ omvei: "Omvei:",
876
+ rettesI: (e) => `Rettes i ${e}`,
877
+ rettetI: (e) => `Rettet i ${e}`,
878
+ // 2d + 2e — feltet og kontekstlinja
879
+ /**
880
+ * «Ditt innspill», ikke «Din feil» (DD-54). «Din» festet saken til personen, og
881
+ * «feil» karakteriserte den før noen hadde lest den — innsenderen leste det som
882
+ * skyld. Ønskesporet beholder «Ditt ønske»: et ønske er ingen feil, og der finnes
883
+ * ikke problemet. De to står aldri ved siden av hverandre; sporet velges før dette.
884
+ */
885
+ feltLabelFeil: "Ditt innspill",
886
+ feltLabelOnske: "Ditt ønske",
887
+ /** DD-45: to spørsmål i feilsporet. */
888
+ placeholderFeil: "Hva skjedde? Hva forventet du?",
889
+ placeholderOnske: "Hva ønsker du deg?",
890
+ send: "Send",
891
+ nesteOnske: "Neste — sjekk om noen har ønsket dette",
892
+ /** DD-44: minimum tegn er det ENESTE kravet. */
893
+ forKort: (e) => `Minst ${e} tegn. Ingenting annet er obligatorisk.`,
894
+ sendSnarvei: "Ctrl+Enter sender",
895
+ tellerFull: " — kort og konkret holder",
896
+ /** K5 på web: fem linjer. Nettleser er `os`; viewport finnes ikke (tech-decisions.md, «M1.5»). */
897
+ kontekstLinje: "Legges ved: side, nettleser, språk, versjon",
898
+ kontekstVis: " — Vis",
899
+ kontekstFjern: "Fjern",
900
+ kontekstFjernA11y: (e) => `Fjern ${e.toLowerCase()} fra innsendingen`,
901
+ kontekstAldri: "Aldri: navn, e-post, cookies, query string, det som står på siden. Lista er lukket — ukjente nøkler avvises av tjeneren.",
902
+ kontekstEtiketter: {
903
+ screen: "Side",
904
+ os: "Nettleser",
905
+ locale: "Språk",
906
+ sdkVersion: "SDK",
907
+ appVersion: "Appversjon",
908
+ build: "Bygg",
909
+ platform: "Plattform"
910
+ },
911
+ lenketTil: (e) => `Lenket til: «${e}»`,
912
+ fjernLenke: "Fjern lenken til den kjente feilen",
913
+ // 2f — skjermbilde (K4, DD-39, DD-40, DD-42). To veier på web.
914
+ taBildeAvSiden: "Ta bilde av siden",
915
+ lastOppBilde: "Last opp bilde",
916
+ skjermbildeHint: "Bildet lages i nettleseren din når du trykker — du ser det før noe sendes. Ingenting fra siden sendes ellers.",
917
+ skjermbildeTittel: "Se over bildet",
918
+ skjermbildeUnder: "Det du maskerer, ser vi aldri. Ingenting er sendt ennå.",
919
+ skjermbildeUnderFil: "PNG eller JPEG. Bildet renses for metadata i nettleseren. Det du maskerer, ser vi aldri.",
920
+ maskering: "Maskering",
921
+ maskerFelt: "Masker felt",
922
+ tegnOver: "Tegn over",
923
+ maskerAllTekst: "Masker all tekst",
924
+ maskertAvAppen: "Maskert av appen",
925
+ maskertAvAppenHint: "data-innspel-private. Penselen kan ikke oppheve den.",
926
+ dittStrok: "▲ ditt strøk — maskert (klikk på det for å angre)",
927
+ allTekstHint: "All tekst på siden er dekket. Layouten er synlig.",
928
+ fjernBildet: "Fjern bildet",
929
+ leggVedOgFortsett: "Legg ved og fortsett",
930
+ leggVedHintDD42: "Teksten sendes først; bildet lastes opp for seg.",
931
+ skjermbildeLagtVed: "Skjermbilde lagt ved — maskert",
932
+ fjernSkjermbilde: "Fjern skjermbildet",
933
+ sendHintMedBilde: "Teksten sendes først; bildet lastes opp for seg.",
934
+ skjermbildeFeilet: "kunne ikke ta bilde av siden. Du kan laste opp et bilde, eller sende uten.",
935
+ filFeilet: "kunne ikke lese bildet. PNG eller JPEG, høyst 5 MB.",
936
+ skjermbildeA11y: (e, n, t, r) => `Forhåndsvisning av ${r ? "det opplastede bildet" : "siden"}. ${e ? `${e} felt maskert av appen og kan ikke avmaskeres. ` : ""}${n ? `${n} felt maskert av deg. ` : ""}${t ? "All tekst er dekket. " : ""}Klikk for å maskere et felt, dra for å tegne over.`,
937
+ // DD-46 — mønstervarsel. Aldri stille redaksjon.
938
+ monsterSpm: {
939
+ email: "Dette ser ut som en e-postadresse. Vil du fjerne den?",
940
+ phone: "Dette ser ut som et telefonnummer. Vil du fjerne det?",
941
+ card: "Dette ser ut som et kortnummer. Vil du fjerne det?",
942
+ ip: "Dette ser ut som en IP-adresse. Vil du fjerne den?",
943
+ token: "Dette ser ut som en tilgangsnøkkel. Vil du fjerne den?"
944
+ },
945
+ monsterFjern: "Fjern",
946
+ monsterBehold: "Behold",
947
+ monsterForklaring: "Teksten endres bare hvis du trykker Fjern. Vi fjerner aldri noe stille.",
948
+ // 2g — kvittering
949
+ kvitteringSendt: "Sendt",
950
+ kvitteringSendtAnonymt: "Sendt anonymt",
951
+ kvitteringRegistrert: "Registrert",
952
+ kvitteringFeil: "Du får beskjed når den er rettet, eller hvis vi trenger mer.",
953
+ kvitteringOnske: "Vurderes innen 90 dager. Du får et personlig svar — også hvis det er nei.",
954
+ kvitteringAnonym: "Vi kan ikke svare deg direkte, men saken teller.",
955
+ kvitteringJaOgsa: "Du får beskjed når den er rettet.",
956
+ saksnummer: (e) => `Saksnummer ${e} — vis dette hvis du spør support.`,
957
+ lukk: "Lukk",
958
+ lukkEsc: "Lukk (Esc)",
959
+ /** DD-42: saken er sendt, bildet kom ikke med — aldri en blokkert innsending. */
960
+ kvitteringVedleggFeilet: "Sendt — skjermbildet kunne ikke legges ved",
961
+ tekstenErLagret: "Teksten din er lagret.",
962
+ vedleggFeiletBanner: "Bildet ble ikke lastet opp. Saken er sendt uten det — vil du, kan du sende et nytt innspill med bilde.",
963
+ saksnummerUtenVedlegg: (e) => `Saksnummer ${e} · uten vedlegg`,
964
+ // 2i — tilstander
965
+ offlineTittel: "Ingen nett",
966
+ offlineBanner: "Ingen nett. Lagres i nettleseren og sendes automatisk — du ser det under «Mine innspill» til det er sendt.",
967
+ /** DD-41: et skjermbilde køes aldri. */
968
+ offlineUtenBilde: "Bilde kan ikke legges ved uten nett. Teksten sendes; bildet ble ikke lagret.",
969
+ sendefeilBanner: (e) => `Kunne ikke sende: ${e} Teksten din er beholdt.`,
970
+ provIgjen: "Prøv igjen",
971
+ tjenerenSvarteIkke: "tjeneren svarte ikke (tidsavbrudd etter 10 s).",
972
+ /** Utløpt token under skriving (tech-decisions.md, «Portalen»): teksten står, bare innloggingen gjøres om. */
973
+ utloptTittel: "Innloggingen din gikk ut (15 min). Teksten din er beholdt.",
974
+ loggInnPaaNytt: (e) => `Logg inn på nytt hos ${e}`,
975
+ loggInnPaaNyttGenerisk: "Logg inn på nytt",
976
+ sendAnonymt: "Send anonymt",
977
+ sendAnonymtHint: "Saken kobles ikke til nummeret ditt, og du kan ikke følge den etterpå.",
978
+ // 2j — mine innspill
979
+ mineTittel: "Mine innspill",
980
+ mineUnder: "Status og hva du kan vente deg — samme løfte som i kvitteringen.",
981
+ mineLaster: "Henter innspillene dine",
982
+ mineTom: "Du har ikke sendt noe ennå.",
983
+ mineTomHint: (e) => `Det første innspillet tar under et minutt. Feil eller ønske — ${e} svarer på begge.`,
984
+ mineIkkeSendt: "Ikke sendt ennå",
985
+ mineSak: (e) => `Sak ${e}`,
986
+ svarFra: (e) => `Svar fra ${e}`,
987
+ svarFraGenerisk: "Svar",
988
+ sendNytt: "Send nytt innspill",
989
+ venterIKo: (e) => `${e} innspill venter på nett — sendes automatisk`,
990
+ // Felles
991
+ tilbake: "Tilbake",
992
+ dialogEtikett: "Send innspill",
993
+ venterPaaNett: "Venter på nett — sendes automatisk",
994
+ feil: "feil",
995
+ onske: "ønske"
996
+ }, U = {
997
+ venterNett: "Sendes automatisk når du er på nett — kvitteringen kommer da.",
998
+ vurderes: (e) => `Svar innen ${e} — også hvis det er nei.`,
999
+ vurderesUtenFrist: "Du får svar — også hvis det er nei.",
1000
+ bygges: "Du får beskjed når den er rettet.",
1001
+ planlagt: "Du får beskjed når den er rettet.",
1002
+ rettet: "Ferdig. Ser du feilen igjen, send et nytt innspill.",
1003
+ levert: "Ferdig. Takk for ønsket.",
1004
+ ny: "Vi har fått den. Du hører fra oss.",
1005
+ kjentFeil: "Kjent feil. Du får beskjed når den er rettet.",
1006
+ duplikat: "Slått sammen med et innspill som ligner.",
1007
+ avvist: "Vi har svart på denne."
1008
+ };
1009
+ function dt({
1010
+ open: e,
1011
+ onClose: n,
1012
+ children: t,
1013
+ footer: r,
1014
+ colorScheme: i,
1015
+ returnFocusTo: s
1016
+ }) {
1017
+ const l = q(null), d = q(null), c = pt();
1018
+ return gn(() => {
1019
+ if (!e) return;
1020
+ d.current = s ?? document.activeElement;
1021
+ const f = l.current;
1022
+ ((f ? Le(f)[0] : void 0) ?? f)?.focus();
1023
+ const u = Array.from(document.body.children).filter((k) => !k.contains(f));
1024
+ for (const k of u) k.setAttribute("inert", "");
1025
+ return () => {
1026
+ for (const b of u) b.removeAttribute("inert");
1027
+ const k = d.current;
1028
+ k && document.contains(k) && k.focus();
1029
+ };
1030
+ }, [e, s]), W(() => {
1031
+ if (!e) return;
1032
+ const f = (p) => {
1033
+ if (p.key === "Escape") {
1034
+ p.preventDefault(), n();
1035
+ return;
1036
+ }
1037
+ if (p.key !== "Tab" || !l.current) return;
1038
+ const u = Le(l.current);
1039
+ if (u.length === 0) return;
1040
+ const k = u[0], b = u[u.length - 1], v = document.activeElement;
1041
+ p.shiftKey && (v === k || !l.current.contains(v)) ? (p.preventDefault(), b.focus()) : !p.shiftKey && v === b && (p.preventDefault(), k.focus());
1042
+ };
1043
+ return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
1044
+ }, [e, n]), e ? /* @__PURE__ */ o(
1045
+ "div",
1046
+ {
1047
+ className: "innspel-rot innspel-scrim",
1048
+ "data-form": c,
1049
+ "data-innspel-theme": i,
1050
+ [Ue]: "true",
1051
+ onMouseDown: (f) => {
1052
+ f.target === f.currentTarget && n();
1053
+ },
1054
+ children: /* @__PURE__ */ g("div", { ref: l, role: "dialog", "aria-modal": "true", "aria-label": a.dialogEtikett, className: "innspel-dialog", tabIndex: -1, "data-testid": "innspel-dialog", children: [
1055
+ /* @__PURE__ */ g("div", { className: "innspel-dialog-hode", children: [
1056
+ c === "bunnark" ? /* @__PURE__ */ o("span", { className: "innspel-handtak", "aria-hidden": "true" }) : /* @__PURE__ */ o("span", { className: "innspel-dialog-tittel", children: "Innspill" }),
1057
+ /* @__PURE__ */ o("button", { type: "button", className: "innspel-ikonknapp", "aria-label": a.lukkEsc, "data-testid": "lukk", onClick: n, children: /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "✕" }) })
1058
+ ] }),
1059
+ /* @__PURE__ */ o("div", { className: "innspel-dialog-kropp", children: t }),
1060
+ r ? /* @__PURE__ */ o("div", { className: "innspel-dialog-fot", children: r }) : null
1061
+ ] })
1062
+ }
1063
+ ) : null;
1064
+ }
1065
+ const ct = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
1066
+ function Le(e) {
1067
+ return Array.from(e.querySelectorAll(ct)).filter((n) => !n.hidden && n.getAttribute("aria-hidden") !== "true");
1068
+ }
1069
+ function pt() {
1070
+ const [e, n] = E("modal");
1071
+ return W(() => {
1072
+ if (typeof matchMedia != "function") return;
1073
+ const t = getComputedStyle(document.documentElement).getPropertyValue("--innspel-layout-breakpoint").trim();
1074
+ if (!t) return;
1075
+ const r = matchMedia(`(max-width: calc(${t} - 1px))`), i = () => n(r.matches ? "bunnark" : "modal");
1076
+ return i(), r.addEventListener("change", i), () => r.removeEventListener("change", i);
1077
+ }, []), e;
1078
+ }
1079
+ function R({
1080
+ label: e,
1081
+ onClick: n,
1082
+ variant: t = "primary",
1083
+ ikon: r,
1084
+ hint: i,
1085
+ disabled: s,
1086
+ ariaLabel: l,
1087
+ grow: d,
1088
+ tall: c,
1089
+ type: f = "button",
1090
+ testId: p,
1091
+ autoFocus: u
1092
+ }) {
1093
+ const k = i ? `innspel-hint-${ut(p ?? e)}` : void 0;
1094
+ return /* @__PURE__ */ g("div", { className: "innspel-knapp-ramme", "data-grow": d ? "true" : void 0, children: [
1095
+ /* @__PURE__ */ g(
1096
+ "button",
1097
+ {
1098
+ type: f,
1099
+ className: "innspel-knapp",
1100
+ "data-variant": t,
1101
+ "data-tall": c ? "true" : void 0,
1102
+ "data-testid": p,
1103
+ disabled: s,
1104
+ "aria-label": l,
1105
+ "aria-describedby": k,
1106
+ onClick: n,
1107
+ autoFocus: u,
1108
+ children: [
1109
+ r ? /* @__PURE__ */ o("span", { "aria-hidden": "true", children: r }) : null,
1110
+ e
1111
+ ]
1112
+ }
1113
+ ),
1114
+ i ? /* @__PURE__ */ o("p", { className: "innspel-hint", id: k, children: i }) : null
1115
+ ] });
1116
+ }
1117
+ function ut(e) {
1118
+ return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
1119
+ }
1120
+ function ee({ children: e, sub: n, id: t, nivaa: r = 2 }) {
1121
+ return /* @__PURE__ */ g("div", { className: "innspel-h", children: [
1122
+ r === 1 ? /* @__PURE__ */ o("h1", { id: t, children: e }) : /* @__PURE__ */ o("h2", { id: t, children: e }),
1123
+ n ? /* @__PURE__ */ o("p", { className: "innspel-hint", children: n }) : null
1124
+ ] });
1125
+ }
1126
+ function z({ children: e, id: n }) {
1127
+ return /* @__PURE__ */ o("p", { className: "innspel-hint", id: n, children: e });
1128
+ }
1129
+ function De({ children: e }) {
1130
+ return /* @__PURE__ */ o("p", { className: "innspel-p", children: e });
1131
+ }
1132
+ function ke({
1133
+ children: e,
1134
+ dashed: n,
1135
+ testId: t,
1136
+ role: r,
1137
+ ariaLabel: i
1138
+ }) {
1139
+ return /* @__PURE__ */ o("div", { className: "innspel-kort", "data-stiplet": n ? "true" : void 0, "data-testid": t, role: r, "aria-label": i, children: e });
1140
+ }
1141
+ function Je({
1142
+ ikon: e,
1143
+ etikett: n,
1144
+ farge: t
1145
+ }) {
1146
+ return /* @__PURE__ */ g("span", { className: "innspel-pille", "data-farge": t, children: [
1147
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: e }),
1148
+ n
1149
+ ] });
1150
+ }
1151
+ function oe({
1152
+ ikon: e,
1153
+ tone: n,
1154
+ children: t,
1155
+ live: r,
1156
+ testId: i
1157
+ }) {
1158
+ return /* @__PURE__ */ g("div", { className: "innspel-banner", "data-tone": n, role: r ? "status" : void 0, "aria-live": r ? "polite" : void 0, "data-testid": i, children: [
1159
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: e }),
1160
+ /* @__PURE__ */ o("p", { children: t })
1161
+ ] });
1162
+ }
1163
+ function Z({ hoy: e }) {
1164
+ return /* @__PURE__ */ o("div", { className: "innspel-skjelett", "data-hoy": e ? "true" : void 0, "aria-hidden": "true" });
1165
+ }
1166
+ function ft({
1167
+ spor: e,
1168
+ verdi: n,
1169
+ onEndre: t,
1170
+ minTextLength: r,
1171
+ textMaxLength: i,
1172
+ kontekst: s,
1173
+ fjernedeFelter: l,
1174
+ onFjernKontekst: d,
1175
+ lenketTil: c,
1176
+ onFjernLenke: f,
1177
+ funn: p,
1178
+ onSend: u,
1179
+ sender: k,
1180
+ onTaBilde: b,
1181
+ onLastOppBilde: v,
1182
+ harVedlegg: y,
1183
+ onFjernVedlegg: w
1184
+ }) {
1185
+ const [j, S] = E(!1), [I, N] = E([]), $ = Se(), A = Se(), h = [...n].length, m = h < r, T = h >= i, O = h >= i * 0.8, C = p.find((x) => !I.includes(x.match)), P = Be(() => ["screen", "os", "locale", "sdkVersion", "appVersion", "build"].map((L) => {
1186
+ const M = s[L];
1187
+ return M && !l.includes(L) ? { felt: L, etikett: a.kontekstEtiketter[L] ?? L, verdi: M } : null;
1188
+ }).filter((L) => L !== null), [s, l]), B = (x) => {
1189
+ (x.ctrlKey || x.metaKey) && x.key === "Enter" && !m && !k && (x.preventDefault(), u());
1190
+ }, G = e === "onske" ? a.feltLabelOnske : a.feltLabelFeil;
1191
+ return /* @__PURE__ */ g("div", { className: "innspel-stabel", children: [
1192
+ c ? /* @__PURE__ */ g("div", { className: "innspel-chip", role: "group", "aria-label": "Lenket til kjent feil", children: [
1193
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "🔗" }),
1194
+ /* @__PURE__ */ o("span", { children: a.lenketTil(c.title) }),
1195
+ /* @__PURE__ */ o("button", { type: "button", className: "innspel-ikonknapp", "data-testid": "fjern-lenke", "aria-label": a.fjernLenke, onClick: f, children: /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "✕" }) })
1196
+ ] }) : null,
1197
+ C ? /* @__PURE__ */ g("div", { className: "innspel-varsel", role: "status", "aria-live": "polite", "data-testid": "monstervarsel", children: [
1198
+ /* @__PURE__ */ g("p", { children: [
1199
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "⚠ " }),
1200
+ a.monsterSpm[C.kind]
1201
+ ] }),
1202
+ /* @__PURE__ */ g("div", { className: "innspel-rad", children: [
1203
+ /* @__PURE__ */ o(R, { grow: !0, variant: "secondary", testId: "monster-fjern", label: a.monsterFjern, onClick: () => t(n.slice(0, C.start) + n.slice(C.end)) }),
1204
+ /* @__PURE__ */ o(R, { grow: !0, variant: "ghost", testId: "monster-behold", label: a.monsterBehold, onClick: () => N((x) => [...x, C.match]) })
1205
+ ] }),
1206
+ /* @__PURE__ */ o(z, { children: a.monsterForklaring })
1207
+ ] }) : null,
1208
+ /* @__PURE__ */ g("div", { className: "innspel-felt", children: [
1209
+ /* @__PURE__ */ o("label", { className: "innspel-felt-etikett", htmlFor: $, children: G }),
1210
+ /* @__PURE__ */ o(
1211
+ "textarea",
1212
+ {
1213
+ id: $,
1214
+ className: "innspel-tekstfelt",
1215
+ "data-testid": "innspill-tekst",
1216
+ "data-full": T ? "true" : void 0,
1217
+ value: n,
1218
+ onChange: (x) => t(x.target.value),
1219
+ onKeyDown: B,
1220
+ maxLength: i,
1221
+ rows: 4,
1222
+ placeholder: e === "onske" ? a.placeholderOnske : a.placeholderFeil,
1223
+ "aria-describedby": m ? `${$}-hint` : void 0
1224
+ }
1225
+ ),
1226
+ O ? /* @__PURE__ */ g("span", { className: "innspel-teller", "data-testid": "teller", "data-full": T ? "true" : void 0, role: "status", "aria-live": T ? "assertive" : "polite", children: [
1227
+ T ? /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "⚠ " }) : null,
1228
+ h,
1229
+ " / ",
1230
+ i,
1231
+ T ? a.tellerFull : ""
1232
+ ] }) : null
1233
+ ] }),
1234
+ y ? /* @__PURE__ */ g("div", { className: "innspel-chip", "data-testid": "vedlegg-chip", role: "group", "aria-label": a.skjermbildeLagtVed, children: [
1235
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "📷" }),
1236
+ /* @__PURE__ */ o("span", { children: a.skjermbildeLagtVed }),
1237
+ /* @__PURE__ */ o("button", { type: "button", className: "innspel-ikonknapp", "data-testid": "fjern-vedlegg", "aria-label": a.fjernSkjermbilde, onClick: w, children: /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "✕" }) })
1238
+ ] }) : b || v ? /* @__PURE__ */ g("div", { className: "innspel-stabel", "data-gap": "sm", children: [
1239
+ /* @__PURE__ */ g("div", { className: "innspel-rad", children: [
1240
+ b ? /* @__PURE__ */ o(R, { grow: !0, variant: "secondary", testId: "ta-bilde", ikon: "📷", label: a.taBildeAvSiden, onClick: b }) : null,
1241
+ v ? /* @__PURE__ */ g("div", { className: "innspel-knapp-ramme", "data-grow": "true", children: [
1242
+ /* @__PURE__ */ g("label", { className: "innspel-knapp", "data-variant": "secondary", htmlFor: A, children: [
1243
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "📁" }),
1244
+ a.lastOppBilde
1245
+ ] }),
1246
+ /* @__PURE__ */ o(
1247
+ "input",
1248
+ {
1249
+ id: A,
1250
+ className: "innspel-skjult-fil",
1251
+ "data-testid": "last-opp",
1252
+ type: "file",
1253
+ accept: "image/png,image/jpeg",
1254
+ onChange: (x) => {
1255
+ const L = x.target.files?.[0];
1256
+ L && v(L), x.target.value = "";
1257
+ }
1258
+ }
1259
+ )
1260
+ ] }) : null
1261
+ ] }),
1262
+ /* @__PURE__ */ o(z, { children: a.skjermbildeHint })
1263
+ ] }) : null,
1264
+ /* @__PURE__ */ g("div", { className: "innspel-kontekst", children: [
1265
+ /* @__PURE__ */ g("button", { type: "button", className: "innspel-kontekst-bryter", "data-testid": "kontekst-bryter", "aria-expanded": j, onClick: () => S((x) => !x), children: [
1266
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: j ? "▴" : "▾" }),
1267
+ a.kontekstLinje,
1268
+ j ? "" : a.kontekstVis
1269
+ ] }),
1270
+ j ? /* @__PURE__ */ g("ul", { className: "innspel-liste", style: { gap: 0 }, children: [
1271
+ P.map((x) => /* @__PURE__ */ g("li", { className: "innspel-kontekst-linje", children: [
1272
+ /* @__PURE__ */ o("span", { className: "innspel-kontekst-nokkel", children: x.etikett }),
1273
+ /* @__PURE__ */ o("span", { className: "innspel-kontekst-verdi", children: x.verdi }),
1274
+ /* @__PURE__ */ g("button", { type: "button", className: "innspel-ikonknapp", "data-testid": `fjern-${x.felt}`, "aria-label": a.kontekstFjernA11y(x.etikett), onClick: () => d(x.felt), children: [
1275
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "✕ " }),
1276
+ a.kontekstFjern
1277
+ ] })
1278
+ ] }, x.felt)),
1279
+ /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(z, { children: a.kontekstAldri }) })
1280
+ ] }) : null
1281
+ ] }),
1282
+ /* @__PURE__ */ o(
1283
+ R,
1284
+ {
1285
+ testId: "send",
1286
+ label: e === "onske" && !m ? a.nesteOnske : a.send,
1287
+ disabled: m || k,
1288
+ hint: m ? a.forKort(r) : y ? a.sendHintMedBilde : a.sendSnarvei,
1289
+ onClick: u
1290
+ }
1291
+ ),
1292
+ m ? /* @__PURE__ */ o("span", { id: `${$}-hint`, className: "innspel-sr", children: a.forKort(r) }) : null
1293
+ ] });
1294
+ }
1295
+ function ht({
1296
+ kort: e,
1297
+ spor: n,
1298
+ laster: t,
1299
+ onJaOgsa: r,
1300
+ onLigner: i,
1301
+ onNei: s
1302
+ }) {
1303
+ const l = n === "onske" ? a.kjenteFeilTittelOnske : a.kjenteFeilTittelFeil, d = n === "onske" ? a.kjenteFeilUnderOnske : a.kjenteFeilUnderFeil;
1304
+ return /* @__PURE__ */ g("div", { className: "innspel-stabel", children: [
1305
+ /* @__PURE__ */ o(ee, { sub: d, children: l }),
1306
+ t ? /* @__PURE__ */ g("div", { className: "innspel-stabel", "data-gap": "sm", role: "status", "aria-label": a.kjenteFeilLaster, children: [
1307
+ /* @__PURE__ */ o(Z, { hoy: !0 }),
1308
+ /* @__PURE__ */ o(Z, { hoy: !0 })
1309
+ ] }) : e.map((c) => {
1310
+ const f = c.fixedIn ? c.status === "fikset" ? a.rettetI(c.fixedIn) : a.rettesI(c.fixedIn) : void 0, p = f ? `${c.title}. ${f}` : c.title;
1311
+ return /* @__PURE__ */ g(ke, { role: "group", ariaLabel: `Kjent feil: ${p}`, children: [
1312
+ /* @__PURE__ */ o("p", { className: "innspel-kjent-tittel", children: c.title }),
1313
+ c.workaround ? /* @__PURE__ */ g("p", { className: "innspel-kjent-omvei", children: [
1314
+ /* @__PURE__ */ o("strong", { children: a.omvei }),
1315
+ " ",
1316
+ c.workaround
1317
+ ] }) : null,
1318
+ f ? /* @__PURE__ */ o(Je, { ikon: c.status === "fikset" ? "✓" : "🔧", etikett: f, farge: c.status === "fikset" ? "success" : "info" }) : null,
1319
+ /* @__PURE__ */ g("div", { className: "innspel-kjent-svar", children: [
1320
+ /* @__PURE__ */ o(R, { grow: !0, testId: `ja-ogsa-${c.id}`, label: a.svarJa, ariaLabel: `${a.svarJa}. ${p}`, onClick: () => r(c) }),
1321
+ /* @__PURE__ */ o(R, { grow: !0, variant: "secondary", testId: `ligner-${c.id}`, label: a.svarLigner, ariaLabel: `${a.svarLigner}. ${p}`, onClick: () => i(c) })
1322
+ ] })
1323
+ ] }, c.id);
1324
+ }),
1325
+ /* @__PURE__ */ o(R, { variant: "secondary", testId: "nei-noe-annet", label: a.svarNei, onClick: s }),
1326
+ /* @__PURE__ */ o(z, { children: a.kjenteFeilTilbud })
1327
+ ] });
1328
+ }
1329
+ function gt({
1330
+ art: e,
1331
+ saksnummer: n,
1332
+ vedlegg: t,
1333
+ onLukk: r
1334
+ }) {
1335
+ const i = {
1336
+ feil: { h: a.kvitteringSendt, p: a.kvitteringFeil },
1337
+ onske: { h: a.kvitteringSendt, p: a.kvitteringOnske },
1338
+ anonym: { h: a.kvitteringSendtAnonymt, p: a.kvitteringAnonym },
1339
+ jaOgsa: { h: a.kvitteringRegistrert, p: a.kvitteringJaOgsa },
1340
+ // Køet offline: kvitteringen kan IKKE love svar på noe som ikke er sendt (DD-41).
1341
+ kø: { h: a.offlineTittel, p: a.offlineBanner }
1342
+ }[e], s = t === "feilet" ? a.kvitteringVedleggFeilet : i.h, l = t === "feilet" ? `${a.tekstenErLagret} ${i.p}` : i.p;
1343
+ return /* @__PURE__ */ g("div", { className: "innspel-stabel", children: [
1344
+ /* @__PURE__ */ g("div", { className: "innspel-kvittering", role: "status", "aria-live": "polite", "data-testid": "kvittering", children: [
1345
+ /* @__PURE__ */ o("span", { className: "innspel-kvittering-ikon", "data-tone": e === "kø" ? "neutral" : void 0, "aria-hidden": "true", children: e === "kø" ? "⇅" : "✓" }),
1346
+ /* @__PURE__ */ o(ee, { children: s }),
1347
+ t === "feilet" ? /* @__PURE__ */ o(oe, { ikon: "⚠", tone: "warning", children: a.vedleggFeiletBanner }) : null,
1348
+ t === "forkastet" ? /* @__PURE__ */ o(oe, { ikon: "📷", tone: "info", children: a.offlineUtenBilde }) : null,
1349
+ /* @__PURE__ */ o("p", { className: "innspel-p", "data-testid": "kvittering-tekst", children: l }),
1350
+ n ? /* @__PURE__ */ o(z, { children: t === "feilet" ? a.saksnummerUtenVedlegg(n) : a.saksnummer(n) }) : null
1351
+ ] }),
1352
+ /* @__PURE__ */ o(R, { testId: "kvittering-lukk", label: a.lukk, onClick: r, autoFocus: !0 })
1353
+ ] });
1354
+ }
1355
+ const K = {
1356
+ ny: "⏱",
1357
+ vurderes: "⏱",
1358
+ planlagt: "📅",
1359
+ bygges: "🔧",
1360
+ levert: "✓",
1361
+ kjent_feil: "👁",
1362
+ duplikat: "✕",
1363
+ avvist: "✕",
1364
+ venterNett: "⏳"
1365
+ };
1366
+ function mt(e) {
1367
+ const n = new Date(e);
1368
+ return Number.isNaN(n.getTime()) ? e : new Intl.DateTimeFormat("nb-NO", { day: "numeric", month: "long" }).format(n);
1369
+ }
1370
+ function We(e, n, t) {
1371
+ switch (e) {
1372
+ case "ny":
1373
+ return { ikon: K.ny, etikett: "Mottatt", farge: "neutral", lofte: U.ny };
1374
+ case "vurderes":
1375
+ return {
1376
+ ikon: K.vurderes,
1377
+ etikett: "Vurderes",
1378
+ farge: "warning",
1379
+ lofte: t ? U.vurderes(mt(t)) : U.vurderesUtenFrist
1380
+ };
1381
+ case "planlagt":
1382
+ return { ikon: K.planlagt, etikett: "Planlagt", farge: "success", lofte: U.planlagt };
1383
+ case "bygges":
1384
+ return { ikon: K.bygges, etikett: "Retter nå", farge: "info", lofte: U.bygges };
1385
+ case "levert":
1386
+ return n === "onske" ? { ikon: K.levert, etikett: "Levert", farge: "success", lofte: U.levert } : { ikon: K.levert, etikett: "Rettet", farge: "success", lofte: U.rettet };
1387
+ case "kjent_feil":
1388
+ return { ikon: K.kjent_feil, etikett: "Kjent, ikke planlagt", farge: "neutral", lofte: U.kjentFeil };
1389
+ case "duplikat":
1390
+ return { ikon: K.duplikat, etikett: "Slått sammen", farge: "neutral", lofte: U.duplikat };
1391
+ case "avvist":
1392
+ return { ikon: K.avvist, etikett: "Avvist", farge: "danger", lofte: U.avvist };
1393
+ }
1394
+ }
1395
+ const kt = {
1396
+ ikon: K.venterNett,
1397
+ etikett: "Venter på nett",
1398
+ farge: "neutral",
1399
+ lofte: U.venterNett
1400
+ };
1401
+ function vt(e) {
1402
+ const n = We(e.status, e.type, e.deadlineAt), t = e.type === "onske" ? a.onske : a.feil;
1403
+ return `${a.mineSak(e.id)}, ${t}: ${e.text}. Status ${n.etikett.toLowerCase()}. ${n.lofte}`;
1404
+ }
1405
+ function bt({
1406
+ rader: e,
1407
+ laster: n,
1408
+ tenantName: t,
1409
+ onNytt: r,
1410
+ overskriftNivaa: i = 2
1411
+ }) {
1412
+ return /* @__PURE__ */ g("div", { className: "innspel-stabel", children: [
1413
+ /* @__PURE__ */ o(ee, { sub: a.mineUnder, nivaa: i, children: a.mineTittel }),
1414
+ n ? /* @__PURE__ */ g("div", { className: "innspel-stabel", "data-gap": "sm", role: "status", "aria-label": a.mineLaster, children: [
1415
+ /* @__PURE__ */ o(Z, { hoy: !0 }),
1416
+ /* @__PURE__ */ o(Z, { hoy: !0 }),
1417
+ /* @__PURE__ */ o(Z, { hoy: !0 })
1418
+ ] }) : e.length === 0 ? /* @__PURE__ */ g(ke, { dashed: !0, testId: "mine-tom", children: [
1419
+ /* @__PURE__ */ o("span", { className: "innspel-kvittering-ikon", "data-tone": "neutral", "aria-hidden": "true", children: "✉" }),
1420
+ /* @__PURE__ */ o(De, { children: a.mineTom }),
1421
+ t ? /* @__PURE__ */ o(z, { children: a.mineTomHint(t) }) : null
1422
+ ] }) : /* @__PURE__ */ o("ul", { className: "innspel-liste", "data-testid": "mine-liste", children: e.map((s) => {
1423
+ const l = s.pending === !0, d = l ? kt : We(s.status, s.type, s.deadlineAt), c = l ? s.clientRef : s.id, f = l ? void 0 : s.reply;
1424
+ return /* @__PURE__ */ o("li", { "aria-label": l ? `${a.mineIkkeSendt}: ${s.text}. ${d.lofte}` : vt(s), children: /* @__PURE__ */ g(ke, { dashed: l, children: [
1425
+ /* @__PURE__ */ g(z, { children: [
1426
+ l ? a.mineIkkeSendt : a.mineSak(s.id),
1427
+ " · ",
1428
+ s.type === "onske" ? a.onske : a.feil
1429
+ ] }),
1430
+ /* @__PURE__ */ o(De, { children: s.text }),
1431
+ /* @__PURE__ */ g("div", { className: "innspel-rad", style: { flexWrap: "wrap", alignItems: "flex-start" }, children: [
1432
+ /* @__PURE__ */ o(Je, { ikon: d.ikon, etikett: d.etikett, farge: d.farge }),
1433
+ /* @__PURE__ */ o(z, { children: d.lofte })
1434
+ ] }),
1435
+ f ? /* @__PURE__ */ g("div", { className: "innspel-svar", children: [
1436
+ /* @__PURE__ */ g("span", { className: "innspel-svar-fra", children: [
1437
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "💬 " }),
1438
+ t ? a.svarFra(t) : a.svarFraGenerisk
1439
+ ] }),
1440
+ /* @__PURE__ */ o("p", { className: "innspel-svar-tekst", children: f.text })
1441
+ ] }) : null
1442
+ ] }) }, c);
1443
+ }) }),
1444
+ /* @__PURE__ */ o(R, { testId: "send-nytt", ikon: "💬", label: a.sendNytt, onClick: r })
1445
+ ] });
1446
+ }
1447
+ function yt({ fangst: e, komponerer: n, onFjern: t, onLeggVed: r }) {
1448
+ const [i, s] = E("pensel"), [l, d] = E(!1), [c, f] = E([]), p = q(null), u = q(null), k = q([]), b = q(wt());
1449
+ W(() => {
1450
+ const h = p.current;
1451
+ if (!h) return;
1452
+ h.width = e.width, h.height = e.height;
1453
+ const m = h.getContext("2d");
1454
+ m && m.drawImage(e.bilde, 0, 0);
1455
+ }, [e]);
1456
+ const v = { width: e.width, height: e.height }, y = (h) => {
1457
+ const m = u.current;
1458
+ if (!m) return null;
1459
+ const T = m.getBoundingClientRect();
1460
+ return T.width === 0 || T.height === 0 ? null : le({ x: h.clientX - T.left, y: h.clientY - T.top, width: 0, height: 0 }, { width: T.width, height: T.height }, v);
1461
+ }, w = () => {
1462
+ const h = u.current?.getBoundingClientRect();
1463
+ return h && h.width > 0 ? e.width / h.width : 1;
1464
+ }, j = (h) => {
1465
+ if (n) return;
1466
+ const m = y(h);
1467
+ if (!m) return;
1468
+ const T = c.findIndex((O) => cn(m, O));
1469
+ if (T >= 0) {
1470
+ f((O) => O.filter((C, P) => P !== T));
1471
+ return;
1472
+ }
1473
+ if (i === "felt") {
1474
+ const O = w(), C = pn(m, { width: 4 * b.current.touch * O, height: b.current.touch * O }, v);
1475
+ C && f((P) => [...P, C]);
1476
+ return;
1477
+ }
1478
+ k.current = [m], u.current?.setPointerCapture(h.pointerId);
1479
+ }, S = (h) => {
1480
+ if (i !== "pensel" || k.current.length === 0) return;
1481
+ const m = y(h);
1482
+ m && k.current.push(m);
1483
+ }, I = () => {
1484
+ if (i !== "pensel" || k.current.length === 0) return;
1485
+ const h = dn(k.current, b.current.brush * w(), v);
1486
+ k.current = [], h.length && f((m) => [...m, ...h]);
1487
+ }, N = (h) => ({
1488
+ left: `${h.x / v.width * 100}%`,
1489
+ top: `${h.y / v.height * 100}%`,
1490
+ width: `${h.width / v.width * 100}%`,
1491
+ height: `${h.height / v.height * 100}%`
1492
+ }), $ = (h, m, T) => {
1493
+ const O = h === "allTekst" ? l : i === h;
1494
+ return /* @__PURE__ */ g(
1495
+ "button",
1496
+ {
1497
+ type: "button",
1498
+ className: "innspel-verktoy",
1499
+ "data-testid": `verktoy-${h}`,
1500
+ "aria-pressed": O,
1501
+ onClick: () => h === "allTekst" ? d((C) => !C) : s(h),
1502
+ children: [
1503
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: m }),
1504
+ T
1505
+ ]
1506
+ },
1507
+ h
1508
+ );
1509
+ }, A = a.skjermbildeA11y(e.automasker.length, c.length, l, e.kilde === "fil");
1510
+ return /* @__PURE__ */ g("div", { className: "innspel-stabel", children: [
1511
+ /* @__PURE__ */ o(ee, { sub: e.kilde === "fil" ? a.skjermbildeUnderFil : a.skjermbildeUnder, children: a.skjermbildeTittel }),
1512
+ /* @__PURE__ */ g("div", { role: "toolbar", "aria-label": a.maskering, className: "innspel-rad", children: [
1513
+ $("felt", "▣", a.maskerFelt),
1514
+ $("pensel", "✎", a.tegnOver),
1515
+ $("allTekst", "▦", a.maskerAllTekst)
1516
+ ] }),
1517
+ /* @__PURE__ */ o("div", { className: "innspel-forhandsvisning-ramme", "data-testid": "skjermbilde-ramme", children: /* @__PURE__ */ g(
1518
+ "div",
1519
+ {
1520
+ ref: u,
1521
+ className: "innspel-forhandsvisning",
1522
+ role: "img",
1523
+ "aria-label": A,
1524
+ "data-testid": "forhandsvisning",
1525
+ onPointerDown: j,
1526
+ onPointerMove: S,
1527
+ onPointerUp: I,
1528
+ onPointerCancel: I,
1529
+ children: [
1530
+ /* @__PURE__ */ o("canvas", { ref: p, "data-testid": "skjermbilde-bilde", style: l && !e.tekstRekter?.length ? { filter: "blur(var(--innspel-space-md))" } : void 0 }),
1531
+ l ? (e.tekstRekter ?? []).map((h, m) => /* @__PURE__ */ o("div", { className: "innspel-maske", "data-art": "auto", style: N(h) }, `tekst-${m}`)) : null,
1532
+ e.automasker.map((h, m) => /* @__PURE__ */ o("div", { className: "innspel-maske", "data-art": "auto", "data-testid": `automask-${m}`, style: N(h), children: n ? null : /* @__PURE__ */ g("span", { children: [
1533
+ "🔒 ",
1534
+ a.maskertAvAppen
1535
+ ] }) }, `auto-${m}`)),
1536
+ c.map((h, m) => /* @__PURE__ */ o("div", { className: "innspel-maske", "data-art": "egen", "data-testid": `maske-${m}`, style: N(h) }, `egen-${m}`))
1537
+ ]
1538
+ }
1539
+ ) }),
1540
+ e.automasker.length ? /* @__PURE__ */ g(z, { children: [
1541
+ "🔒 ",
1542
+ a.maskertAvAppenHint
1543
+ ] }) : null,
1544
+ c.length ? /* @__PURE__ */ o(z, { children: a.dittStrok }) : null,
1545
+ l ? /* @__PURE__ */ o(z, { children: a.allTekstHint }) : null,
1546
+ /* @__PURE__ */ g("div", { className: "innspel-stabel", "data-gap": "sm", children: [
1547
+ /* @__PURE__ */ o(R, { variant: "danger", testId: "fjern-bildet", ikon: "🗑", label: a.fjernBildet, onClick: t, disabled: n }),
1548
+ /* @__PURE__ */ o(R, { testId: "legg-ved", label: a.leggVedOgFortsett, hint: a.leggVedHintDD42, disabled: n, onClick: () => r({ automasker: e.automasker, egne: c, allTekst: l }) })
1549
+ ] })
1550
+ ] });
1551
+ }
1552
+ function wt() {
1553
+ if (typeof getComputedStyle != "function") return { touch: 48, brush: 28 };
1554
+ const e = getComputedStyle(document.documentElement), n = (t, r) => {
1555
+ const i = parseFloat(e.getPropertyValue(t));
1556
+ return Number.isFinite(i) && i > 0 ? i : r;
1557
+ };
1558
+ return { touch: n("--innspel-layout-touch", 48), brush: n("--innspel-screen-brush-width", 28) };
1559
+ }
1560
+ function xt({ onVelg: e }) {
1561
+ const n = (t, r, i, s) => /* @__PURE__ */ g("button", { type: "button", className: "innspel-flate", "data-testid": `spor-${t}`, "aria-label": `${i}. ${s}`, onClick: () => e(t), children: [
1562
+ /* @__PURE__ */ o("span", { className: "innspel-flate-ikon", "aria-hidden": "true", children: r }),
1563
+ /* @__PURE__ */ o("span", { className: "innspel-flate-tittel", children: i }),
1564
+ /* @__PURE__ */ o("span", { className: "innspel-flate-under", children: s })
1565
+ ] });
1566
+ return /* @__PURE__ */ g("div", { className: "innspel-stabel", children: [
1567
+ /* @__PURE__ */ o(ee, { sub: a.valgUnder, children: a.valgTittel }),
1568
+ /* @__PURE__ */ g("div", { className: "innspel-rad", "data-gap": "md", children: [
1569
+ n("feil", "🐞", a.sporFeil, a.sporFeilUnder),
1570
+ n("onske", "💡", a.sporOnske, a.sporOnskeUnder)
1571
+ ] })
1572
+ ] });
1573
+ }
1574
+ function Ft({ client: e, open: n, onClose: t, apneOpsjoner: r, tenantName: i, screenshot: s, colorScheme: l, returnFocusTo: d, onIdentityExpired: c, onSendAnonymously: f }) {
1575
+ const [p, u] = E("valg"), [k, b] = E("feil"), [v, y] = E(""), [w, j] = E([]), [S, I] = E(!1), [N, $] = E(), [A, h] = E([]), [m, T] = E([]), [O, C] = E(!1), [P, B] = E(), [G, x] = E(!1), [L, M] = E(!1), [H, D] = E(), [ne, be] = E([]), [Qe, ye] = E(!1), [X, Q] = E(), [Ye, ce] = E(!1), [te, pe] = E(), Ze = q(void 0), J = r?.screen ?? (typeof location > "u" ? void 0 : Zn(location.href)), [ue, en] = E({ ...e.settings }), we = ue.screenshotsEnabled, re = V(() => {
1576
+ u("valg"), b("feil"), y(""), j([]), $(void 0), h([]), T([]), B(void 0), x(!1), M(!1), D(void 0), Q(void 0), pe(void 0), ce(!1);
1577
+ }, []), xe = V(() => {
1578
+ t(), re();
1579
+ }, [t, re]), ie = V(async () => {
1580
+ I(!0);
1581
+ try {
1582
+ j(await e.knownIssues.for(J ? { screen: J } : {}));
1583
+ } finally {
1584
+ I(!1);
1585
+ }
1586
+ }, [e, J]), Fe = V(
1587
+ async (F) => {
1588
+ if (b(F), e.track({ name: "track_selected", type: F }), F === "onske") {
1589
+ u("felt");
1590
+ return;
1591
+ }
1592
+ u("kjenteFeil"), await ie();
1593
+ },
1594
+ [e, ie]
1595
+ );
1596
+ W(() => {
1597
+ n && (Ze.current = r, e.track({ name: "widget_opened" }), e.queue.flush().catch(() => {
1598
+ }), e.loadSettings().then((F) => en({ ...F })).catch(() => {
1599
+ }), r?.draft ? (b(r.draft.track), y(r.draft.text), h(e.scanText(r.draft.text)), u("felt")) : r?.track && Fe(r.track));
1600
+ }, [n]), W(() => {
1601
+ p === "kjenteFeil" && !S && w.length === 0 && u("felt");
1602
+ }, [p, S, w.length]);
1603
+ const nn = V(
1604
+ (F) => {
1605
+ y(F), h(e.scanText(F));
1606
+ },
1607
+ [e]
1608
+ ), tn = V(async () => {
1609
+ if (s) {
1610
+ B(void 0);
1611
+ try {
1612
+ Q(await s.capture(document.body)), u("skjermbilde");
1613
+ } catch {
1614
+ B(a.skjermbildeFeilet);
1615
+ }
1616
+ }
1617
+ }, [s]), rn = V(async (F) => {
1618
+ B(void 0);
1619
+ try {
1620
+ Q(await nt(F)), u("skjermbilde");
1621
+ } catch {
1622
+ B(a.filFeilet);
1623
+ }
1624
+ }, []), sn = V(
1625
+ async (F) => {
1626
+ if (X) {
1627
+ ce(!0);
1628
+ try {
1629
+ pe(await st(X, F));
1630
+ } catch {
1631
+ B(a.skjermbildeFeilet);
1632
+ } finally {
1633
+ ce(!1), Q(void 0), u("felt");
1634
+ }
1635
+ }
1636
+ },
1637
+ [X]
1638
+ ), fe = V(() => {
1639
+ Q(void 0), pe(void 0), u("felt");
1640
+ }, []), se = V(async () => {
1641
+ if (k === "onske" && p === "felt" && w.length === 0 && !S) {
1642
+ u("kjenteFeil"), await ie();
1643
+ return;
1644
+ }
1645
+ C(!0), B(void 0), x(!1);
1646
+ try {
1647
+ const F = await e.capture({
1648
+ type: k,
1649
+ text: v,
1650
+ ...te ? { attachment: te } : {},
1651
+ ...k === "feil" && N ? { relatedKnownIssueId: N.id } : {},
1652
+ context: jt(e, m, J)
1653
+ });
1654
+ F.status === "queued" ? D({ art: "kø", ...F.attachment ? { vedlegg: "forkastet" } : {} }) : D({
1655
+ art: e.isAnonymous ? "anonym" : k,
1656
+ nr: F.submission.id,
1657
+ ...F.attachment?.status === "failed" ? { vedlegg: "feilet" } : {}
1658
+ }), u("kvittering");
1659
+ } catch (F) {
1660
+ F instanceof Y && F.code === "feedback_token_expired" ? x(!0) : F instanceof un ? B(F.userMessage) : F instanceof Y ? B(F.message) : B(a.tjenerenSvarteIkke);
1661
+ } finally {
1662
+ C(!1);
1663
+ }
1664
+ }, [e, k, p, v, te, N, m, w.length, S, ie, J]);
1665
+ W(() => {
1666
+ L && e.isAnonymous && (M(!1), se());
1667
+ }, [L, e.isAnonymous, se]);
1668
+ const ln = V(
1669
+ async (F) => {
1670
+ C(!0);
1671
+ try {
1672
+ const _ = await e.knownIssues.confirm(F.id);
1673
+ D({ art: "jaOgsa", nr: _.id }), u("kvittering");
1674
+ } catch (_) {
1675
+ _ instanceof Y && _.code === "feedback_token_expired" ? x(!0) : B(_ instanceof Y ? _.message : a.tjenerenSvarteIkke);
1676
+ } finally {
1677
+ C(!1);
1678
+ }
1679
+ },
1680
+ [e]
1681
+ ), an = V(async () => {
1682
+ u("mine"), ye(!0);
1683
+ try {
1684
+ be(await e.subjects.submissions());
1685
+ } catch (F) {
1686
+ be([]), F instanceof Y && F.code === "feedback_token_expired" && x(!0);
1687
+ } finally {
1688
+ ye(!1);
1689
+ }
1690
+ }, [e]), je = p === "skjermbilde" ? fe : p !== "valg" && p !== "kvittering" ? re : void 0;
1691
+ return /* @__PURE__ */ g(dt, { open: n, onClose: xe, colorScheme: l, returnFocusTo: d, children: [
1692
+ je ? /* @__PURE__ */ o(R, { variant: "ghost", testId: "tilbake", ikon: "←", label: a.tilbake, onClick: je }) : null,
1693
+ P ? /* @__PURE__ */ o(oe, { live: !0, ikon: "⚠", tone: "danger", testId: "sendefeil", children: a.sendefeilBanner(P) }) : null,
1694
+ G ? /* @__PURE__ */ g("div", { className: "innspel-stabel", "data-gap": "sm", "data-testid": "utlopt", children: [
1695
+ /* @__PURE__ */ o(oe, { live: !0, ikon: "⏱", tone: "warning", children: a.utloptTittel }),
1696
+ c ? /* @__PURE__ */ o(R, { ikon: "🔑", testId: "logg-inn-paa-nytt", label: i ? a.loggInnPaaNytt(i) : a.loggInnPaaNyttGenerisk, onClick: () => c({ track: k, text: v }) }) : null,
1697
+ f ? /* @__PURE__ */ o(
1698
+ R,
1699
+ {
1700
+ variant: "secondary",
1701
+ testId: "send-anonymt",
1702
+ label: a.sendAnonymt,
1703
+ hint: a.sendAnonymtHint,
1704
+ onClick: () => {
1705
+ x(!1), M(!0), f();
1706
+ }
1707
+ }
1708
+ ) : /* @__PURE__ */ o(z, { children: a.sendAnonymtHint })
1709
+ ] }) : null,
1710
+ p === "valg" ? /* @__PURE__ */ g(on, { children: [
1711
+ /* @__PURE__ */ o(xt, { onVelg: Fe }),
1712
+ e.isAnonymous ? null : /* @__PURE__ */ o(R, { variant: "ghost", testId: "mine-innspill", ikon: "📋", label: a.mineTittel, onClick: an })
1713
+ ] }) : null,
1714
+ p === "kjenteFeil" ? /* @__PURE__ */ o(
1715
+ ht,
1716
+ {
1717
+ kort: w,
1718
+ spor: k,
1719
+ laster: S,
1720
+ onJaOgsa: ln,
1721
+ onLigner: (F) => {
1722
+ $(F), u("felt");
1723
+ },
1724
+ onNei: () => k === "onske" ? void se() : u("felt")
1725
+ }
1726
+ ) : null,
1727
+ p === "felt" ? /* @__PURE__ */ o(
1728
+ ft,
1729
+ {
1730
+ spor: k,
1731
+ verdi: v,
1732
+ onEndre: nn,
1733
+ minTextLength: ue.minTextLength,
1734
+ textMaxLength: ue.textMaxLength,
1735
+ kontekst: { ...e.context, ...J ? { screen: J } : {} },
1736
+ fjernedeFelter: m,
1737
+ onFjernKontekst: (F) => T((_) => [..._, F]),
1738
+ ...N ? { lenketTil: N, onFjernLenke: () => $(void 0) } : {},
1739
+ funn: A,
1740
+ onSend: se,
1741
+ sender: O,
1742
+ ...we && s ? { onTaBilde: tn } : {},
1743
+ ...we ? { onLastOppBilde: rn } : {},
1744
+ harVedlegg: te !== void 0,
1745
+ onFjernVedlegg: fe
1746
+ }
1747
+ ) : null,
1748
+ p === "skjermbilde" && X ? /* @__PURE__ */ o(yt, { fangst: X, komponerer: Ye, onFjern: fe, onLeggVed: sn }) : null,
1749
+ p === "kvittering" && H ? /* @__PURE__ */ o(gt, { art: H.art, ...H.nr ? { saksnummer: H.nr } : {}, ...H.vedlegg ? { vedlegg: H.vedlegg } : {}, onLukk: xe }) : null,
1750
+ p === "mine" ? /* @__PURE__ */ o(bt, { rader: ne, laster: Qe, ...i ? { tenantName: i } : {}, onNytt: re }) : null
1751
+ ] });
1752
+ }
1753
+ function jt(e, n, t) {
1754
+ const r = {};
1755
+ t && (r.screen = t);
1756
+ for (const i of [...Object.keys(e.context), "screen"])
1757
+ i !== "sdkVersion" && n.includes(i) && (r[i] = void 0);
1758
+ return r;
1759
+ }
1760
+ const Ge = vn(null);
1761
+ function Et({ client: e, children: n, tenantName: t, colorScheme: r, screenshot: i, injectStyles: s = !0, onIdentityExpired: l, onSendAnonymously: d }) {
1762
+ const [c, f] = E(!1), [p, u] = E(), k = q(null);
1763
+ mn(() => {
1764
+ s && Qn();
1765
+ }, [s]);
1766
+ const b = V(async (j) => {
1767
+ k.current = document.activeElement ?? null, u(j), f(!0);
1768
+ }, []), v = V(() => f(!1), []);
1769
+ W(() => {
1770
+ e.registerPresenter({ open: b });
1771
+ }, [e, b]);
1772
+ const y = Be(() => ({ client: e, open: b, close: v, isOpen: c }), [e, b, v, c]), w = i === !1 ? null : i ?? Xn;
1773
+ return /* @__PURE__ */ g(Ge.Provider, { value: y, children: [
1774
+ n,
1775
+ /* @__PURE__ */ o(
1776
+ Ft,
1777
+ {
1778
+ client: e,
1779
+ open: c,
1780
+ onClose: v,
1781
+ ...p ? { apneOpsjoner: p } : {},
1782
+ ...t ? { tenantName: t } : {},
1783
+ screenshot: w,
1784
+ ...r ? { colorScheme: r } : {},
1785
+ returnFocusTo: k.current,
1786
+ ...l ? { onIdentityExpired: l } : {},
1787
+ ...d ? { onSendAnonymously: d } : {}
1788
+ }
1789
+ )
1790
+ ] });
1791
+ }
1792
+ function $t() {
1793
+ const e = kn(Ge);
1794
+ if (!e)
1795
+ throw new Error("[innspel] useInnspel() ble kalt utenfor <InnspelProvider>. Pakk siden din i den — se README.md.");
1796
+ return e;
1797
+ }
1798
+ function Xe(e = St()) {
1799
+ const n = /* @__PURE__ */ new Map(), t = (r, i) => {
1800
+ try {
1801
+ return r();
1802
+ } catch {
1803
+ return i();
1804
+ }
1805
+ };
1806
+ return {
1807
+ get: async (r) => t(() => e?.getItem(r) ?? n.get(r) ?? null, () => n.get(r) ?? null),
1808
+ set: async (r, i) => {
1809
+ n.set(r, i), t(() => e?.setItem(r, i), () => {
1810
+ });
1811
+ },
1812
+ remove: async (r) => {
1813
+ n.delete(r), t(() => e?.removeItem(r), () => {
1814
+ });
1815
+ }
1816
+ };
1817
+ }
1818
+ function Lt() {
1819
+ return Xe(null);
1820
+ }
1821
+ function St() {
1822
+ try {
1823
+ return typeof localStorage > "u" ? null : localStorage;
1824
+ } catch {
1825
+ return null;
1826
+ }
1827
+ }
1828
+ function Dt(e, n) {
1829
+ if (!(e instanceof HTMLElement))
1830
+ throw new Error("[innspel] mount(el, …): el må være et HTML-element i dokumentet. Se README.md.");
1831
+ const { client: t, baseUrl: r, tenantKey: i, identityProvider: s, storage: l, appVersion: d, build: c, textMaxLength: f, minTextLength: p, screenshotsEnabled: u, telemetry: k, fetch: b, ...v } = n, y = k === !1 ? void 0 : k ?? (r && i ? Vn({ baseUrl: r, tenantKey: i, platform: "web", ...d ? { appVersion: d } : {}, ...b ? { fetch: b } : {} }) : void 0), w = t ?? fn({
1832
+ baseUrl: r,
1833
+ tenantKey: i,
1834
+ identityProvider: s === void 0 ? void 0 : s,
1835
+ storage: l ?? Xe(),
1836
+ context: et({ ...d ? { appVersion: d } : {}, ...c ? { build: c } : {} }),
1837
+ ...f !== void 0 ? { textMaxLength: f } : {},
1838
+ ...p !== void 0 ? { minTextLength: p } : {},
1839
+ ...u !== void 0 ? { screenshotsEnabled: u } : {},
1840
+ ...y ? { telemetry: y } : {},
1841
+ ...b ? { fetch: b } : {}
1842
+ }), j = hn(e);
1843
+ return j.render(/* @__PURE__ */ o(Et, { client: w, ...v })), {
1844
+ client: w,
1845
+ open: (S) => w.openFeedback(S),
1846
+ close: () => {
1847
+ document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: !0 }));
1848
+ },
1849
+ bindTrigger(S, I) {
1850
+ const N = () => {
1851
+ w.openFeedback(I);
1852
+ };
1853
+ return S.addEventListener("click", N), S.setAttribute("aria-haspopup", "dialog"), !S.getAttribute("aria-description") && !S.getAttribute("aria-describedby") && S.setAttribute("aria-description", a.inngangHint), () => {
1854
+ S.removeEventListener("click", N), S.removeAttribute("aria-haspopup");
1855
+ };
1856
+ },
1857
+ unmount: () => j.unmount()
1858
+ };
1859
+ }
1860
+ function Bt({ children: e, inline: n, className: t }) {
1861
+ const r = { [Pe]: "true", className: t, "data-testid": "innspel-privat" };
1862
+ return n ? /* @__PURE__ */ o("span", { ...r, children: e }) : /* @__PURE__ */ o("div", { ...r, children: e });
1863
+ }
1864
+ export {
1865
+ oe as Banner,
1866
+ R as Btn,
1867
+ ke as Card,
1868
+ ee as H,
1869
+ z as Hint,
1870
+ Bt as InnspelPrivate,
1871
+ Et as InnspelProvider,
1872
+ bt as MineInnspill,
1873
+ De as P,
1874
+ Pe as PRIVAT_ATTRIBUTT,
1875
+ Z as Skeleton,
1876
+ Je as StatusPill,
1877
+ Ue as WIDGET_ATTRIBUTT,
1878
+ Ft as Widget,
1879
+ Lt as createMemoryStorage,
1880
+ Xe as createStorage,
1881
+ Ct as css,
1882
+ Qn as ensureStyles,
1883
+ mt as formaterFrist,
1884
+ Kn as klonForBilde,
1885
+ st as komponer,
1886
+ nt as lesBildefil,
1887
+ U as lofte,
1888
+ Dt as mount,
1889
+ Yn as nettleserNavn,
1890
+ vt as radEtikett,
1891
+ Gn as renderPage,
1892
+ Zn as sideSti,
1893
+ Xn as standardAdapter,
1894
+ We as statusVisning,
1895
+ a as tekst,
1896
+ $t as useInnspel,
1897
+ kt as venterVisning,
1898
+ et as webKontekst
1899
+ };
1900
+ //# sourceMappingURL=index.js.map