@lightworkai.official/debug-capture 0.11.2 → 0.12.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.
- package/README.md +58 -0
- package/dist/base64.d.ts +1 -0
- package/dist/capture/replay.d.ts +28 -0
- package/dist/capture/replayRedact.d.ts +6 -0
- package/dist/config.d.ts +40 -0
- package/dist/debug-capture.js +9 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +19 -13
- package/dist/replayPack.d.ts +20 -0
- package/dist/rrweb-record.mjs +78 -0
- package/dist/submit.d.ts +1 -1
- package/dist/types.d.ts +49 -0
- package/dist/ui/strings.d.ts +3 -0
- package/dist/ui/styles.d.ts +1 -1
- package/package.json +10 -5
- package/src/base64.ts +20 -0
- package/src/budget.ts +3 -3
- package/src/bundle.ts +8 -1
- package/src/capture/networkBuffer.ts +4 -4
- package/src/capture/replay.ts +167 -0
- package/src/capture/replayRedact.ts +69 -0
- package/src/config.ts +62 -0
- package/src/embed.ts +17 -1
- package/src/index.ts +3 -1
- package/src/install.ts +3 -0
- package/src/replayPack.ts +66 -0
- package/src/styles.css +1 -1
- package/src/submit.ts +26 -23
- package/src/types.ts +52 -0
- package/src/ui/element.ts +24 -0
- package/src/ui/strings.ts +7 -0
- package/src/ui/styles.ts +6 -0
package/README.md
CHANGED
|
@@ -75,6 +75,58 @@ the problem.
|
|
|
75
75
|
| Context | route, module, user, viewport, memory, timing |
|
|
76
76
|
| Cause | the failed requests and errors most likely to be the reason |
|
|
77
77
|
| Screenshot | `getDisplayMedia` (captures cross-origin iframes), annotated by the user |
|
|
78
|
+
| Replay | opt-in: the last minute of the page as [rrweb](https://github.com/rrweb-io/rrweb) events, played back on the desk |
|
|
79
|
+
|
|
80
|
+
## Session replay
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
configureDebugCapture({
|
|
84
|
+
…,
|
|
85
|
+
replay: true, // the last 60 s, inputs masked
|
|
86
|
+
// replay: { seconds: 90, maskText: true, blockSelector: "[data-lw-private], .pdf-viewer" },
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
A screenshot is the moment; the replay is the minute before it. rrweb records
|
|
91
|
+
the DOM — one snapshot of the page, then every change, scroll, click and
|
|
92
|
+
(masked) keystroke — and the desk plays it back as the page the person was
|
|
93
|
+
looking at, with the failed calls and their own steps from the capture pinned
|
|
94
|
+
on the timeline. It is not a video: the desk sees the markup and the styles,
|
|
95
|
+
never a pixel and never a script.
|
|
96
|
+
|
|
97
|
+
It is the screen, so it is **off unless you turn it on**, and the defaults
|
|
98
|
+
hide everything they can:
|
|
99
|
+
|
|
100
|
+
- every value typed into any field is masked before it is recorded
|
|
101
|
+
(`maskAllInputs`); passwords never leave the field.
|
|
102
|
+
- anything under `blockSelector` — default `data-lw-private` — is recorded as
|
|
103
|
+
a grey box of the same size, contents and changes dropped. Mark document
|
|
104
|
+
viewers, a citizen's record, a chart of somebody's salary.
|
|
105
|
+
- `maskText: true` masks every piece of text as well, for a screen where the
|
|
106
|
+
words themselves are the secret.
|
|
107
|
+
- URLs in links and images go through the same redaction as the network log
|
|
108
|
+
(`token`, `signature`, `code`, …).
|
|
109
|
+
- the reporter sees a ticked box — "แนบการบันทึกหน้าจอ 58 วินาทีก่อนแจ้ง" —
|
|
110
|
+
and can leave the replay out. The desk is told they did.
|
|
111
|
+
|
|
112
|
+
On the way out it is gzipped in the browser (about ten to one) and attached
|
|
113
|
+
as `session-replay.json.gz`, its own file beside the screenshot and the
|
|
114
|
+
bundle, capped at `maxBytes` (4 MB): a report always files, with or without
|
|
115
|
+
its replay, and the ticket says which. The support host keeps replays for
|
|
116
|
+
`REPLAY_RETENTION_DAYS` (30) and shows them to the desk only — never on the
|
|
117
|
+
reporter's own ticket page, never through the MCP tools.
|
|
118
|
+
|
|
119
|
+
**Cost.** The recorder (`@rrweb/record`, 24 KB gzipped) is a dependency of
|
|
120
|
+
this package, loaded by a dynamic `import()` once the page has settled and
|
|
121
|
+
only when `replay` is set — a host that never turns it on never downloads
|
|
122
|
+
it. At runtime it is a `MutationObserver` on the document; on a page that
|
|
123
|
+
re-renders thousands of nodes a second it is measurable, and worth trying on
|
|
124
|
+
your heaviest screen first. Three half-windows of events are kept in memory,
|
|
125
|
+
a few megabytes on a typical page. Canvas content and cross-origin iframes
|
|
126
|
+
are not recorded.
|
|
127
|
+
|
|
128
|
+
From a script tag, add `data-replay="60"` and ship `rrweb-record.mjs` from
|
|
129
|
+
`dist/` beside `debug-capture.js` — it is fetched from there.
|
|
78
130
|
|
|
79
131
|
## Configuration
|
|
80
132
|
|
|
@@ -291,6 +343,12 @@ names bound to nothing — a build that succeeds and ships nothing.
|
|
|
291
343
|
without the Screen Capture API, and it is loaded by a runtime `import()` so an
|
|
292
344
|
app that never installs it still builds.
|
|
293
345
|
|
|
346
|
+
**`@rrweb/record` is a real dependency, kept external.** The ESM build passes
|
|
347
|
+
`--external @rrweb/record`, so `dist/index.mjs` carries a bare
|
|
348
|
+
`import("@rrweb/record")` that the consumer's bundler resolves and splits into
|
|
349
|
+
its own chunk. The script-tag build cannot resolve a bare specifier, so it
|
|
350
|
+
loads `rrweb-record.mjs` from beside itself instead (`setRecorderLoader`).
|
|
351
|
+
|
|
294
352
|
**The reporter UI is one custom element in a shadow root.** Not three framework
|
|
295
353
|
components: the annotator alone would be three ports of the same canvas code.
|
|
296
354
|
The shadow root also means the host's CSS cannot reach in, which is what makes
|
package/dist/base64.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toBase64(bytes: Uint8Array): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReplayCapture, ReplayEvent } from "../types";
|
|
2
|
+
type Recorder = (options: Record<string, unknown>) => (() => void) | undefined;
|
|
3
|
+
export interface RecorderModule {
|
|
4
|
+
record: Recorder;
|
|
5
|
+
}
|
|
6
|
+
export declare function setRecorderLoader(load: () => Promise<RecorderModule>): void;
|
|
7
|
+
/**
|
|
8
|
+
* Start recording, once the host asked for it and the page has had a moment.
|
|
9
|
+
*
|
|
10
|
+
* Idle-scheduled: the first thing the recorder does is walk the whole
|
|
11
|
+
* document, and doing that in the middle of the host's own start-up is how a
|
|
12
|
+
* widget gets blamed for a slow first paint.
|
|
13
|
+
*/
|
|
14
|
+
export declare function installReplay(): void;
|
|
15
|
+
declare function push(event: ReplayEvent): void;
|
|
16
|
+
/**
|
|
17
|
+
* The events a report should carry: whole windows, newest first, until the
|
|
18
|
+
* configured length is covered — or everything, early in a session.
|
|
19
|
+
*/
|
|
20
|
+
export declare function takeReplay(now?: number): ReplayCapture | null;
|
|
21
|
+
export declare function isReplayRecording(): boolean;
|
|
22
|
+
export declare function stopReplay(): void;
|
|
23
|
+
/** Test seam: feed events as the recorder would. */
|
|
24
|
+
export declare const _replayInternals: {
|
|
25
|
+
push: typeof push;
|
|
26
|
+
reset: () => undefined;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReplayEvent } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* In place, on a copy: the recorder's buffers are live and a report may be
|
|
4
|
+
* filed again, so the events handed in are cloned before anything is masked.
|
|
5
|
+
*/
|
|
6
|
+
export declare function redactReplay(events: readonly ReplayEvent[]): ReplayEvent[];
|
package/dist/config.d.ts
CHANGED
|
@@ -107,6 +107,26 @@ export interface DebugCaptureConfig {
|
|
|
107
107
|
extra?: () => Record<string, unknown>;
|
|
108
108
|
capture?: CaptureOptions;
|
|
109
109
|
redact?: RedactOptions;
|
|
110
|
+
/**
|
|
111
|
+
* Keep a replay of the last minute and attach it to a report.
|
|
112
|
+
*
|
|
113
|
+
* Off unless set. What is kept is the DOM, not pixels — rrweb records a
|
|
114
|
+
* snapshot of the page and every change to it after that, and the desk plays
|
|
115
|
+
* it back as the page the person was looking at, with their clicks, scrolls
|
|
116
|
+
* and typing (masked) on top. It is the difference between "I pressed save
|
|
117
|
+
* and it broke" and watching them press save and it break.
|
|
118
|
+
*
|
|
119
|
+
* It is also the screen, which is why it is opt-in and why the defaults hide
|
|
120
|
+
* everything they can: every input's value is masked before it is recorded,
|
|
121
|
+
* and anything under `blockSelector` is recorded as a grey box of the same
|
|
122
|
+
* size. Mark the parts of your app that must never leave the browser —
|
|
123
|
+
* document viewers, a citizen's record — with `data-lw-private`, and set
|
|
124
|
+
* `maskText` if the text on your screens is itself the secret.
|
|
125
|
+
*
|
|
126
|
+
* replay: true // 60 s, masked inputs
|
|
127
|
+
* replay: { seconds: 90, maskText: true }
|
|
128
|
+
*/
|
|
129
|
+
replay?: boolean | ReplayOptions;
|
|
110
130
|
/**
|
|
111
131
|
* A DOM-rendering screenshot fallback, for browsers without the Screen
|
|
112
132
|
* Capture API. Supplied by the host so this package never names a dependency
|
|
@@ -172,6 +192,24 @@ export interface CaptureOptions {
|
|
|
172
192
|
*/
|
|
173
193
|
overlaySelectors?: string[];
|
|
174
194
|
}
|
|
195
|
+
export interface ReplayOptions {
|
|
196
|
+
/** How much history to send with a report. Default 60. */
|
|
197
|
+
seconds?: number;
|
|
198
|
+
/**
|
|
199
|
+
* Elements never recorded — drawn as a box of their size, contents and all
|
|
200
|
+
* changes inside them dropped. Default `[data-lw-private]`; the widget's own
|
|
201
|
+
* dialog and toasts are always excluded.
|
|
202
|
+
*/
|
|
203
|
+
blockSelector?: string;
|
|
204
|
+
/** Mask every piece of text too, not only what is typed. Default false. */
|
|
205
|
+
maskText?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* The most a replay may weigh once compressed. A report still files when its
|
|
208
|
+
* replay is over this; the replay is left out and the desk is told why.
|
|
209
|
+
* Default 4 MB, under the host's 5 MB per-file cap.
|
|
210
|
+
*/
|
|
211
|
+
maxBytes?: number;
|
|
212
|
+
}
|
|
175
213
|
export interface RedactOptions {
|
|
176
214
|
/** Extra header names to mask. Matched case-insensitively, as whole names. */
|
|
177
215
|
headers?: string[];
|
|
@@ -233,6 +271,8 @@ export declare function resolveModule(pathname: string): {
|
|
|
233
271
|
/** Redaction extras, always a usable shape even before configure() runs. */
|
|
234
272
|
export declare function getRedactOptions(): Required<RedactOptions>;
|
|
235
273
|
export declare function overlaySelectors(): string[];
|
|
274
|
+
/** The replay settings, filled in — or null when the host did not ask for one. */
|
|
275
|
+
export declare function replayOptions(): Required<ReplayOptions> | null;
|
|
236
276
|
/**
|
|
237
277
|
* Whether a response body from this URL may be stored.
|
|
238
278
|
*
|
package/dist/debug-capture.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var l1={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},S=null;function L0($){let J=[];if(!$.host?.trim())J.push("host");if(!$.realmKey?.trim())J.push("realmKey");if(!$.app?.name?.trim())J.push("app.name");if(typeof $.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");S=$}function N(){if(!S)throw Error("[debug-capture] configureDebugCapture() has not been called");return S}function e(){return S!==null}function h(){let $=N().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??r1()}}function r1(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function f($){let J=S?.capture?.[$];return typeof J==="number"?J:l1[$]}function f0($){let J=S?.module;if(!J)return null;try{return J($)??null}catch{return null}}function $0(){let $=S?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function E0(){return S?.capture?.overlaySelectors??[]}function x0($){if(typeof window>"u")return!1;let J;try{J=new URL($,window.location.href)}catch{return!1}if(s1(J))return!1;if(J.origin===window.location.origin)return!0;return(S?.capture?.bodyOrigins??[]).some((Q)=>{try{return new URL(Q).origin===J.origin}catch{return!1}})}function s1($){if(!S?.host)return!1;try{if(new URL(S.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function h0($){let J=Object.entries($).map(([Q,j])=>[Q.replace(/\/+$/,"")||"/",j]).sort((Q,j)=>j[0].length-Q[0].length);return(Q)=>{let j=(Q||"/").replace(/\/+$/,"")||"/";for(let[z,W]of J)if(j===z||j.startsWith(`${z}/`))return{key:z,label:W};return null}}var v="‹redacted›",n1=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,a1=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),t1=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,e1=/[\w.+-]+@[\w-]+\.[\w.-]+/g,$2=/\d(?:[\d\s-]{7,})\d/g;function b($){return $.replace(e1,v).replace($2,v)}function J2($){if(n1.test($))return!0;return $0().headers.some((Q)=>Q.toLowerCase()===$.toLowerCase())}function u($){let J={};for(let[Q,j]of Object.entries($))J[Q]=J2(Q)?v:j;return J}function d($){try{let J=/^https?:\/\//i.test($),Q=new URL($,J?void 0:"http://local.invalid"),j=!1;if(Q.searchParams.forEach((z,W)=>{if(a1.has(W.toLowerCase())||$0().queryKeys.includes(W.toLowerCase()))Q.searchParams.set(W,v),j=!0}),!j)return $;return J?Q.toString():`${Q.pathname}${Q.search}`}catch{return $}}function G0($,J){if(J>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((j)=>G0(j,J+1));let Q={};for(let[j,z]of Object.entries($)){let W=t1.test(j)||$0().bodyKeys.some((V)=>j.toLowerCase().includes(V));Q[j]=W?v:G0(z,J+1)}return Q}function i($,J){if($==null)return null;let Q=$,j=$.trim();if(j.startsWith("{")||j.startsWith("["))try{let z=JSON.parse(j);Q=JSON.stringify(G0(z,0))}catch{}if(Q.length>J)return`${Q.slice(0,J)}… [truncated ${Q.length-J} chars]`;return Q}var X0=120,H0=40,m=($,J)=>$.length>J?`${$.slice(0,J)}…`:$,I0=($)=>{try{return decodeURIComponent($)}catch{return $}},p=[],p0=0,m0=!1;function c($,J,Q,j){let z=m(J,X0),W=p[p.length-1];if($==="navigate"&&W?.kind==="click"){let X=z.replace(/^ไปที่\s*/,"");if(W.detail.includes(`→ ${X}`))return W.at=new Date().toISOString(),W;let H=X.split(/[?#]/)[0]??X,U=W.source?I0(W.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(U&&(H===U||H.startsWith(U)))return W.detail=m(`${W.detail} → ${X}`,X0),W.source=void 0,W.at=new Date().toISOString(),W}if(W&&W.kind===$&&W.detail===z){if(W.at=new Date().toISOString(),$!=="navigate")W.count=(W.count??1)+1;return W}p0+=1;let V={id:`act_${p0}`,at:new Date().toISOString(),kind:$,detail:z,count:1,source:Q,html:Q0(j)};p.push(V);while(p.length>f("maxActions"))j2(p.shift());return V}var Q2=200000,o=0;function Q0($){if(!$)return;if(o+$.length>Q2)return;return o+=$.length,$}function j2($){if(!$)return;if(o-=($.html?.length??0)+($.afterHtml?.length??0),o<0)o=0}function J0($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var z2='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',Z2={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},y0={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function W2($){let J=$.getAttribute("role");if(J&&y0[J])return y0[J];return Z2[$.tagName.toLowerCase()]??"ปุ่ม"}function K2($,J){try{let Q=$,j=0;while(Q&&j<=J){let z=i0(Q);if(z&&typeof z.memoizedProps?.onClick==="function")return Q;Q=Q.parentElement,j+=1}}catch{}return null}function V2($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("title")?.trim();if(Q)return Q;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLSelectElement)return($.getAttribute("placeholder")||$.getAttribute("name")||"").trim();if($ instanceof HTMLImageElement)return($.getAttribute("alt")||"").trim();let j=($.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if($ instanceof HTMLAnchorElement){let z=$.getAttribute("href");if(z?.startsWith("/"))return I0(z)}return""}function Y2($){if(!($ instanceof Element))return null;let J=$.closest(z2)??K2($,4);if(!J)return null;let Q=J.tagName.toLowerCase();if(Q==="html"||Q==="body")return null;return J}function F2($){let J=b(V2($));if(!J)return null;return`${W2($)} “${m(J,H0)}”`}var d0=6000,G2=4000,X2=/(?:^|\s)!?(?:fixed|absolute|sticky|inset-\S+|z-\S+|top-\S+|bottom-\S+|left-\S+|right-\S+|w-screen|h-screen|min-h-screen|max-h-screen|translate-\S+|scale-\S+)(?=\s|$)/g;function H2($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((z)=>z.remove());let J=[$,...Array.from($.querySelectorAll("*"))];for(let z of J){for(let V of Array.from(z.attributes)){let X=V.name.toLowerCase();if(X.startsWith("on")||X==="srcdoc"||X==="value"||X.startsWith("data-"))z.removeAttribute(V.name)}if(z instanceof HTMLAnchorElement)z.setAttribute("href","#");if(z instanceof HTMLImageElement)z.removeAttribute("src");let W=z.getAttribute("class");if(W){let V=W.replace(X2," ").replace(/\s+/g," ").trim();if(V)z.setAttribute("class",V);else z.removeAttribute("class")}}let Q=document.createTreeWalker($,NodeFilter.SHOW_TEXT),j=Q.nextNode();while(j){if(j.nodeValue)j.nodeValue=b(j.nodeValue);j=Q.nextNode()}}function U0($,J,Q){try{let j=$.outerHTML;if(!j||j.length>J)return;let z=$.cloneNode(!0);H2(z);let W=z.outerHTML;return W&&W.length<=Q?W:void 0}catch{return}}var I2=($)=>U0($,d0,G2),U2=150000,M2=40000,g0=($)=>U0($,U2,M2);function P2($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let J=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${b(J)}”`}var v0=80;function i0($){let J=Object.keys($).find((Q)=>Q.startsWith("__reactFiber$")||Q.startsWith("__reactInternalInstance$"));return J?$[J]:null}function w2($){if(typeof $!=="function")return null;try{let J=Function.prototype.toString.call($);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function b0($){if(!$)return;return`→ ${$.length>v0?`${$.slice(0,v0)}…`:$}`}function q2($){try{let J=$.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return b0(J);let Q=i0($),j=0;while(Q&&j<30){if(typeof Q.memoizedProps?.onClick==="function")return b0(w2(Q.memoizedProps.onClick));Q=Q.return,j+=1}return}catch{return}}var B2='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function N2(){let $=E0();return $.length?$.join(", "):B2}function D2($){let J=$.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function C2($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("aria-labelledby");if(Q){let W=Q.split(/\s+/).map((V)=>document.getElementById(V)?.textContent?.trim()??"").filter(Boolean).join(" ");if(W)return W}let z=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(z)return z;return($.textContent??"").replace(/\s+/g," ").trim()}function c0($){let J=b(C2($)),Q=D2($);return J?`เปิด ${Q} “${m(J,H0)}”`:`เปิด ${Q}`}var k2='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',R2=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function O2($){if($.querySelector(k2))return!0;return R2.test($.textContent??"")}var S2=400,_2=250,T2=8000;function A2($,J){if(typeof MutationObserver>"u"){J.html=Q0(g0($));return}let Q=Date.now(),j=!1,z=()=>{j=!0,V.disconnect(),window.clearInterval(X),window.clearTimeout(H)},W=()=>{if(j)return;if(z(),!$.isConnected)return;J.detail=m(c0($),X0),J.html=Q0(g0($))},V=new MutationObserver(()=>{Q=Date.now()});V.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let X=window.setInterval(()=>{if(j)return;if(!$.isConnected){z();return}if(Date.now()-Q>=S2&&!O2($))W()},_2),H=window.setTimeout(W,T2)}function L2($){if(J0($))return;let J=c("ui",c0($));if(J)A2($,J)}function f2(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((Q)=>{for(let j of Q)for(let z of Array.from(j.addedNodes)){if(!(z instanceof Element))continue;let W=N2(),V=z.matches(W)?[z]:Array.from(z.querySelectorAll(W));for(let X of V){if($.has(X))continue;$.add(X),L2(X)}}}).observe(document.body,{childList:!0,subtree:!0})}var E2=1600,x2=2500;function u0($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:m(($.textContent??"").replace(/\s+/g," ").trim(),H0)}}function h2($,J){if(!$.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function p2($,J){if(typeof MutationObserver>"u")return;let Q=u0($),j=!1,z=(X,H)=>{if(j)return;if(j=!0,W.disconnect(),window.clearTimeout(V),J.afterNote=X,H)J.afterHtml=Q0(U0($,d0,x2))},W=new MutationObserver(()=>{if(!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let X=h2(Q,u0($));if(X)z(X,!0)});W.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let V=window.setTimeout(()=>{if(!j&&!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,W.disconnect()},E2)}function o0(){if(m0||typeof window>"u")return;m0=!0,document.addEventListener("click",(j)=>{if(J0(j.target))return;let z=Y2(j.target);if(!z)return;let W=F2(z);if(!W)return;let V=c("click",`คลิก ${W}`,q2(z),I2(z));if(V)p2(z,V)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(J0(j.target))return;let z=P2(j.target);if(z)c("input",`แก้ไข ${z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(J0(j.target))return;c("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>c("navigate",`ไปที่ ${I0(d(location.pathname+location.search))}`),J=history.pushState.bind(history),Q=history.replaceState.bind(history);history.pushState=(...j)=>{let z=J(...j);return $(),z},history.replaceState=(...j)=>{let z=Q(...j);return $(),z},window.addEventListener("popstate",$),f2()}function l0(){return p.map(($)=>({...$}))}var r0=2000,j0=[],s0=0,n0=!1;function M0($,J){s0+=1,j0.push({id:`log_${s0}`,at:new Date().toISOString(),level:$,message:J.length>r0?`${J.slice(0,r0)}…`:J});while(j0.length>f("maxConsoleEntries"))j0.shift()}function m2(){let $=new WeakSet;return(J,Q)=>{if(typeof Q==="object"&&Q!==null){if($.has(Q))return"[Circular]";$.add(Q)}if(typeof Q==="bigint")return Q.toString();return Q}}function a0($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let J=JSON.stringify($,m2());if(J!==void 0)return J}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function t0(){if(n0||typeof window>"u")return;n0=!0;let $=["log","info","warn","error","debug"];for(let J of $){let Q=console[J].bind(console);console[J]=(...j)=>{M0(J,j.map(a0).join(" ")),Q(...j)}}window.addEventListener("error",(J)=>{let Q=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";M0("exception",`${J.message}${Q}`)}),window.addEventListener("unhandledrejection",(J)=>{let Q=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:a0(J.reason);M0("unhandledrejection",Q)})}function e0(){return j0.map(($)=>({...$}))}var $1=new Set,J1=new Set;function Q1($,J){return $.add(J),()=>$.delete(J)}function j1($,J){for(let Q of[...$])Q(J)}function z1($){return Q1($1,$)}function z0($={type:"manual"}){j1($1,$)}function Z1($){return Q1(J1,$)}function W1($){j1(J1,$)}var y2=15000,g2=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],K1=!1,V1=0;function v2($){return g2.some((J)=>$.includes(J))}function Y1($){let J=$.message??"";if(!J||v2(J))return;let Q=Date.now();if(Q-V1<y2)return;V1=Q,W1({...$,message:J})}function F1(){if(K1||typeof window>"u")return;K1=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let J=$.error instanceof Error?$.error:null;Y1({type:"runtime-error",message:$.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",($)=>{let J=$.reason;Y1({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var I1=4000,b2=1e6,u2=1e7,Z0=[],G1=0,X1=!1;function U1($){Z0.push($);while(Z0.length>f("maxRequests"))Z0.shift()}function M1(){return G1+=1,`req_${G1}`}function H1($){let J={};if(!$)return J;if($ instanceof Headers)$.forEach((Q,j)=>{J[j]=Q});else if(Array.isArray($))for(let[Q,j]of $)J[Q]=j;else Object.assign(J,$);return J}function d2($){let J={};return $.forEach((Q,j)=>{J[j]=Q}),J}function i2($){if($==null)return null;if(typeof $==="string")return $;if($ instanceof URLSearchParams)return $.toString();if(typeof FormData<"u"&&$ instanceof FormData)return`[FormData: ${Array.from($.keys()).join(", ")}]`;if(typeof Blob<"u"&&$ instanceof Blob)return`[Blob ${$.size} bytes]`;if($ instanceof ArrayBuffer)return`[ArrayBuffer ${$.byteLength} bytes]`;return"[binary]"}function c2($,J){let Q="",j="GET",z={},W=null;if(typeof $==="string")Q=$;else if($ instanceof URL)Q=$.toString();else Q=$.url,j=$.method||j,z=H1($.headers);if(J){if(J.method)j=J.method;if(J.headers)z={...z,...H1(J.headers)};if(J.body!==void 0)W=i2(J.body)}return{method:j.toUpperCase(),url:Q,headers:z,body:W}}function P1($){return!x0($)}function o2($,J){if(P1(J.url)){J.responseSnippet="[body not captured for this origin]";return}let Q=$.headers.get("content-type")??"",j=Number($.headers.get("content-length")??"0"),z=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(Q)){J.responseSnippet=`[binary ${Q||"unknown"}${z}]`;return}if(j>b2){J.responseSnippet=`[response ${Q||"text"}${z} — omitted]`;return}try{$.clone().text().then((W)=>{J.responseSnippet=i(W,f("maxBodyChars"))}).catch(()=>{})}catch{}}function w1($,J){if(/[?&]_rsc=/.test($))return!0;for(let Q of Object.keys(J)){let j=Q.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function l2(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(J,Q)=>{let j=c2(J,Q);if(w1(j.url,j.headers))return $(J,Q);let z={id:M1(),startedAt:new Date().toISOString(),method:j.method,url:d(j.url),requestHeaders:u(j.headers),requestBody:i(j.body,I1),status:null,statusText:null,durationMs:null,via:"fetch"};U1(z);let W=performance.now();try{let V=await $(J,Q);return z.status=V.status,z.statusText=V.statusText,z.durationMs=Math.round(performance.now()-W),z.responseHeaders=u(d2(V.headers)),o2(V,z),V}catch(V){throw z.durationMs=Math.round(performance.now()-W),z.error=V instanceof Error?`${V.name}: ${V.message}`:String(V),V}},$)}function r2(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,J=$.open,Q=$.send,j=function(W,V){let X=typeof V==="string"?V:V.toString();return this.__cibEntry=w1(X,{})?void 0:{id:M1(),startedAt:"",method:(W||"GET").toUpperCase(),url:d(X),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},z=function(W){let V=this.__cibEntry;if(V){V.startedAt=new Date().toISOString(),V.requestBody=typeof W==="string"?i(W,I1):W==null?null:"[non-string body]";let X=performance.now();U1(V),this.addEventListener("loadend",()=>{if(V.status=this.status||null,V.statusText=this.statusText||null,V.durationMs=Math.round(performance.now()-X),P1(V.url))V.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{V.responseSnippet=i(this.responseText||"",f("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;V.responseSnippet=`[binary ${H}]`}})}return Q.apply(this,arguments)};$.open=j,$.send=z}function q1(){if(X1)return;X1=!0,l2(),r2()}function B1(){let $=Z0.map((Q)=>({...Q})),J=0;for(let Q=$.length-1;Q>=0;Q-=1){let j=$[Q],z=j?.responseSnippet;if(!j||typeof z!=="string"||z.length===0)continue;if(J+z.length>u2)j.responseSnippet=`[response omitted — report size budget reached (${z.length.toLocaleString()} chars)]`;else J+=z.length}return $}var s2={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่"},n2={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",captured:"Captured",reporter:"Reporter",page:"Page",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab"};function W0($){return $==="en"?n2:s2}var a2="lw-debug-toasts",t2=6000,e2=`
|
|
1
|
+
(()=>{var V2=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(J,Q)=>(typeof require<"u"?require:J)[Q]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var G2={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},S=null;function p0($){let J=[];if(!$.host?.trim())J.push("host");if(!$.realmKey?.trim())J.push("realmKey");if(!$.app?.name?.trim())J.push("app.name");if(typeof $.module!=="function")J.push("module");if(J.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${J.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");S=$}function w(){if(!S)throw Error("[debug-capture] configureDebugCapture() has not been called");return S}function j0(){return S!==null}function p(){let $=w().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??X2()}}function X2(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function x($){let J=S?.capture?.[$];return typeof J==="number"?J:G2[$]}function y0($){let J=S?.module;if(!J)return null;try{return J($)??null}catch{return null}}function z0(){let $=S?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function b0(){return S?.capture?.overlaySelectors??[]}var M0={seconds:60,blockSelector:"[data-lw-private]",maskText:!1,maxBytes:4000000};function i(){let $=S?.replay;if(!$)return null;let J=$===!0?{}:$,Q=typeof J.seconds==="number"&&J.seconds>0?J.seconds:M0.seconds,j=typeof J.maxBytes==="number"&&J.maxBytes>0?J.maxBytes:M0.maxBytes;return{seconds:Q,blockSelector:J.blockSelector?.trim()||M0.blockSelector,maskText:J.maskText===!0,maxBytes:j}}function v0($){if(typeof window>"u")return!1;let J;try{J=new URL($,window.location.href)}catch{return!1}if(Y2(J))return!1;if(J.origin===window.location.origin)return!0;return(S?.capture?.bodyOrigins??[]).some((Q)=>{try{return new URL(Q).origin===J.origin}catch{return!1}})}function Y2($){if(!S?.host)return!1;try{if(new URL(S.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function u0($){let J=Object.entries($).map(([Q,j])=>[Q.replace(/\/+$/,"")||"/",j]).sort((Q,j)=>j[0].length-Q[0].length);return(Q)=>{let j=(Q||"/").replace(/\/+$/,"")||"/";for(let[z,K]of J)if(j===z||j.startsWith(`${z}/`))return{key:z,label:K};return null}}var c="‹redacted›",F2=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,H2=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),U2=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,I2=/[\w.+-]+@[\w-]+\.[\w.-]+/g,M2=/\d(?:[\d\s-]{7,})\d/g;function o($){return $.replace(I2,c).replace(M2,c)}function P2($){if(F2.test($))return!0;return z0().headers.some((Q)=>Q.toLowerCase()===$.toLowerCase())}function l($){let J={};for(let[Q,j]of Object.entries($))J[Q]=P2(Q)?c:j;return J}function E($){try{let J=/^https?:\/\//i.test($),Q=new URL($,J?void 0:"http://local.invalid"),j=!1;if(Q.searchParams.forEach((z,K)=>{if(H2.has(K.toLowerCase())||z0().queryKeys.includes(K.toLowerCase()))Q.searchParams.set(K,c),j=!0}),!j)return $;return J?Q.toString():`${Q.pathname}${Q.search}`}catch{return $}}function P0($,J){if(J>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((j)=>P0(j,J+1));let Q={};for(let[j,z]of Object.entries($)){let K=U2.test(j)||z0().bodyKeys.some((W)=>j.toLowerCase().includes(W));Q[j]=K?c:P0(z,J+1)}return Q}function r($,J){if($==null)return null;let Q=$,j=$.trim();if(j.startsWith("{")||j.startsWith("["))try{let z=JSON.parse(j);Q=JSON.stringify(P0(z,0))}catch{}if(Q.length>J)return`${Q.slice(0,J)}… [truncated ${Q.length-J} chars]`;return Q}var C0=120,q0=40,b=($,J)=>$.length>J?`${$.slice(0,J)}…`:$,B0=($)=>{try{return decodeURIComponent($)}catch{return $}},y=[],d0=0,i0=!1;function s($,J,Q,j){let z=b(J,C0),K=y[y.length-1];if($==="navigate"&&K?.kind==="click"){let Y=z.replace(/^ไปที่\s*/,"");if(K.detail.includes(`→ ${Y}`))return K.at=new Date().toISOString(),K;let H=Y.split(/[?#]/)[0]??Y,I=K.source?B0(K.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(I&&(H===I||H.startsWith(I)))return K.detail=b(`${K.detail} → ${Y}`,C0),K.source=void 0,K.at=new Date().toISOString(),K}if(K&&K.kind===$&&K.detail===z){if(K.at=new Date().toISOString(),$!=="navigate")K.count=(K.count??1)+1;return K}d0+=1;let W={id:`act_${d0}`,at:new Date().toISOString(),kind:$,detail:z,count:1,source:Q,html:K0(j)};y.push(W);while(y.length>x("maxActions"))q2(y.shift());return W}var C2=200000,n=0;function K0($){if(!$)return;if(n+$.length>C2)return;return n+=$.length,$}function q2($){if(!$)return;if(n-=($.html?.length??0)+($.afterHtml?.length??0),n<0)n=0}function Z0($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var B2='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',N2={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},c0={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function D2($){let J=$.getAttribute("role");if(J&&c0[J])return c0[J];return N2[$.tagName.toLowerCase()]??"ปุ่ม"}function w2($,J){try{let Q=$,j=0;while(Q&&j<=J){let z=a0(Q);if(z&&typeof z.memoizedProps?.onClick==="function")return Q;Q=Q.parentElement,j+=1}}catch{}return null}function k2($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("title")?.trim();if(Q)return Q;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement||$ instanceof HTMLSelectElement)return($.getAttribute("placeholder")||$.getAttribute("name")||"").trim();if($ instanceof HTMLImageElement)return($.getAttribute("alt")||"").trim();let j=($.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if($ instanceof HTMLAnchorElement){let z=$.getAttribute("href");if(z?.startsWith("/"))return B0(z)}return""}function S2($){if(!($ instanceof Element))return null;let J=$.closest(B2)??w2($,4);if(!J)return null;let Q=J.tagName.toLowerCase();if(Q==="html"||Q==="body")return null;return J}function O2($){let J=o(k2($));if(!J)return null;return`${D2($)} “${b(J,q0)}”`}var n0=6000,R2=4000,_2=/(?:^|\s)!?(?:fixed|absolute|sticky|inset-\S+|z-\S+|top-\S+|bottom-\S+|left-\S+|right-\S+|w-screen|h-screen|min-h-screen|max-h-screen|translate-\S+|scale-\S+)(?=\s|$)/g;function T2($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((z)=>z.remove());let J=[$,...Array.from($.querySelectorAll("*"))];for(let z of J){for(let W of Array.from(z.attributes)){let Y=W.name.toLowerCase();if(Y.startsWith("on")||Y==="srcdoc"||Y==="value"||Y.startsWith("data-"))z.removeAttribute(W.name)}if(z instanceof HTMLAnchorElement)z.setAttribute("href","#");if(z instanceof HTMLImageElement)z.removeAttribute("src");let K=z.getAttribute("class");if(K){let W=K.replace(_2," ").replace(/\s+/g," ").trim();if(W)z.setAttribute("class",W);else z.removeAttribute("class")}}let Q=document.createTreeWalker($,NodeFilter.SHOW_TEXT),j=Q.nextNode();while(j){if(j.nodeValue)j.nodeValue=o(j.nodeValue);j=Q.nextNode()}}function N0($,J,Q){try{let j=$.outerHTML;if(!j||j.length>J)return;let z=$.cloneNode(!0);T2(z);let K=z.outerHTML;return K&&K.length<=Q?K:void 0}catch{return}}var L2=($)=>N0($,n0,R2),f2=150000,A2=40000,o0=($)=>N0($,f2,A2);function x2($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let J=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${o(J)}”`}var l0=80;function a0($){let J=Object.keys($).find((Q)=>Q.startsWith("__reactFiber$")||Q.startsWith("__reactInternalInstance$"));return J?$[J]:null}function E2($){if(typeof $!=="function")return null;try{let J=Function.prototype.toString.call($);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function r0($){if(!$)return;return`→ ${$.length>l0?`${$.slice(0,l0)}…`:$}`}function h2($){try{let J=$.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return r0(J);let Q=a0($),j=0;while(Q&&j<30){if(typeof Q.memoizedProps?.onClick==="function")return r0(E2(Q.memoizedProps.onClick));Q=Q.return,j+=1}return}catch{return}}var m2='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function g2(){let $=b0();return $.length?$.join(", "):m2}function p2($){let J=$.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function y2($){let J=$.getAttribute("aria-label")?.trim();if(J)return J;let Q=$.getAttribute("aria-labelledby");if(Q){let K=Q.split(/\s+/).map((W)=>document.getElementById(W)?.textContent?.trim()??"").filter(Boolean).join(" ");if(K)return K}let z=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(z)return z;return($.textContent??"").replace(/\s+/g," ").trim()}function t0($){let J=o(y2($)),Q=p2($);return J?`เปิด ${Q} “${b(J,q0)}”`:`เปิด ${Q}`}var b2='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',v2=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function u2($){if($.querySelector(b2))return!0;return v2.test($.textContent??"")}var d2=400,i2=250,c2=8000;function o2($,J){if(typeof MutationObserver>"u"){J.html=K0(o0($));return}let Q=Date.now(),j=!1,z=()=>{j=!0,W.disconnect(),window.clearInterval(Y),window.clearTimeout(H)},K=()=>{if(j)return;if(z(),!$.isConnected)return;J.detail=b(t0($),C0),J.html=K0(o0($))},W=new MutationObserver(()=>{Q=Date.now()});W.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let Y=window.setInterval(()=>{if(j)return;if(!$.isConnected){z();return}if(Date.now()-Q>=d2&&!u2($))K()},i2),H=window.setTimeout(K,c2)}function l2($){if(Z0($))return;let J=s("ui",t0($));if(J)o2($,J)}function r2(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((Q)=>{for(let j of Q)for(let z of Array.from(j.addedNodes)){if(!(z instanceof Element))continue;let K=g2(),W=z.matches(K)?[z]:Array.from(z.querySelectorAll(K));for(let Y of W){if($.has(Y))continue;$.add(Y),l2(Y)}}}).observe(document.body,{childList:!0,subtree:!0})}var s2=1600,n2=2500;function s0($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:b(($.textContent??"").replace(/\s+/g," ").trim(),q0)}}function a2($,J){if(!$.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function t2($,J){if(typeof MutationObserver>"u")return;let Q=s0($),j=!1,z=(Y,H)=>{if(j)return;if(j=!0,K.disconnect(),window.clearTimeout(W),J.afterNote=Y,H)J.afterHtml=K0(N0($,n0,n2))},K=new MutationObserver(()=>{if(!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}let Y=a2(Q,s0($));if(Y)z(Y,!0)});K.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let W=window.setTimeout(()=>{if(!j&&!$.isConnected){z("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,K.disconnect()},s2)}function e0(){if(i0||typeof window>"u")return;i0=!0,document.addEventListener("click",(j)=>{if(Z0(j.target))return;let z=S2(j.target);if(!z)return;let K=O2(z);if(!K)return;let W=s("click",`คลิก ${K}`,h2(z),L2(z));if(W)t2(z,W)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(Z0(j.target))return;let z=x2(j.target);if(z)s("input",`แก้ไข ${z}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(Z0(j.target))return;s("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>s("navigate",`ไปที่ ${B0(E(location.pathname+location.search))}`),J=history.pushState.bind(history),Q=history.replaceState.bind(history);history.pushState=(...j)=>{let z=J(...j);return $(),z},history.replaceState=(...j)=>{let z=Q(...j);return $(),z},window.addEventListener("popstate",$),r2()}function $1(){return y.map(($)=>({...$}))}var J1=2000,W0=[],Q1=0,j1=!1;function D0($,J){Q1+=1,W0.push({id:`log_${Q1}`,at:new Date().toISOString(),level:$,message:J.length>J1?`${J.slice(0,J1)}…`:J});while(W0.length>x("maxConsoleEntries"))W0.shift()}function e2(){let $=new WeakSet;return(J,Q)=>{if(typeof Q==="object"&&Q!==null){if($.has(Q))return"[Circular]";$.add(Q)}if(typeof Q==="bigint")return Q.toString();return Q}}function z1($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let J=JSON.stringify($,e2());if(J!==void 0)return J}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function Z1(){if(j1||typeof window>"u")return;j1=!0;let $=["log","info","warn","error","debug"];for(let J of $){let Q=console[J].bind(console);console[J]=(...j)=>{D0(J,j.map(z1).join(" ")),Q(...j)}}window.addEventListener("error",(J)=>{let Q=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";D0("exception",`${J.message}${Q}`)}),window.addEventListener("unhandledrejection",(J)=>{let Q=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:z1(J.reason);D0("unhandledrejection",Q)})}function K1(){return W0.map(($)=>({...$}))}var W1=new Set,V1=new Set;function G1($,J){return $.add(J),()=>$.delete(J)}function X1($,J){for(let Q of[...$])Q(J)}function Y1($){return G1(W1,$)}function V0($={type:"manual"}){X1(W1,$)}function F1($){return G1(V1,$)}function H1($){X1(V1,$)}var $4=15000,J4=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],U1=!1,I1=0;function Q4($){return J4.some((J)=>$.includes(J))}function M1($){let J=$.message??"";if(!J||Q4(J))return;let Q=Date.now();if(Q-I1<$4)return;I1=Q,H1({...$,message:J})}function P1(){if(U1||typeof window>"u")return;U1=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let J=$.error instanceof Error?$.error:null;M1({type:"runtime-error",message:$.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",($)=>{let J=$.reason;M1({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var N1=4000,j4=1e6,z4=1e7,G0=[],C1=0,q1=!1;function D1($){G0.push($);while(G0.length>x("maxRequests"))G0.shift()}function w1(){return C1+=1,`req_${C1}`}function B1($){let J={};if(!$)return J;if($ instanceof Headers)$.forEach((Q,j)=>{J[j]=Q});else if(Array.isArray($))for(let[Q,j]of $)J[Q]=j;else Object.assign(J,$);return J}function Z4($){let J={};return $.forEach((Q,j)=>{J[j]=Q}),J}function K4($){if($==null)return null;if(typeof $==="string")return $;if($ instanceof URLSearchParams)return $.toString();if(typeof FormData<"u"&&$ instanceof FormData)return`[FormData: ${Array.from($.keys()).join(", ")}]`;if(typeof Blob<"u"&&$ instanceof Blob)return`[Blob ${$.size} bytes]`;if($ instanceof ArrayBuffer)return`[ArrayBuffer ${$.byteLength} bytes]`;return"[binary]"}function W4($,J){let Q="",j="GET",z={},K=null;if(typeof $==="string")Q=$;else if($ instanceof URL)Q=$.toString();else Q=$.url,j=$.method||j,z=B1($.headers);if(J){if(J.method)j=J.method;if(J.headers)z={...z,...B1(J.headers)};if(J.body!==void 0)K=K4(J.body)}return{method:j.toUpperCase(),url:Q,headers:z,body:K}}function k1($){return!v0($)}function V4($,J){if(k1(J.url)){J.responseSnippet="[body not captured for this origin]";return}let Q=$.headers.get("content-type")??"",j=Number($.headers.get("content-length")??"0"),z=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(Q)){J.responseSnippet=`[binary ${Q||"unknown"}${z}]`;return}if(j>j4){J.responseSnippet=`[response ${Q||"text"}${z} — omitted]`;return}try{$.clone().text().then((K)=>{J.responseSnippet=r(K,x("maxBodyChars"))}).catch(()=>{})}catch{}}function S1($,J){if(/[?&]_rsc=/.test($))return!0;for(let Q of Object.keys(J)){let j=Q.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function G4(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(J,Q)=>{let j=W4(J,Q);if(S1(j.url,j.headers))return $(J,Q);let z={id:w1(),startedAt:new Date().toISOString(),method:j.method,url:E(j.url),requestHeaders:l(j.headers),requestBody:r(j.body,N1),status:null,statusText:null,durationMs:null,via:"fetch"};D1(z);let K=performance.now();try{let W=await $(J,Q);return z.status=W.status,z.statusText=W.statusText,z.durationMs=Math.round(performance.now()-K),z.responseHeaders=l(Z4(W.headers)),V4(W,z),W}catch(W){throw z.durationMs=Math.round(performance.now()-K),z.error=W instanceof Error?`${W.name}: ${W.message}`:String(W),W}},$)}function X4(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,J=$.open,Q=$.send,j=function(K,W){let Y=typeof W==="string"?W:W.toString();return this.__lwEntry=S1(Y,{})?void 0:{id:w1(),startedAt:"",method:(K||"GET").toUpperCase(),url:E(Y),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},z=function(K){let W=this.__lwEntry;if(W){W.startedAt=new Date().toISOString(),W.requestBody=typeof K==="string"?r(K,N1):K==null?null:"[non-string body]";let Y=performance.now();D1(W),this.addEventListener("loadend",()=>{if(W.status=this.status||null,W.statusText=this.statusText||null,W.durationMs=Math.round(performance.now()-Y),k1(W.url))W.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{W.responseSnippet=r(this.responseText||"",x("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;W.responseSnippet=`[binary ${H}]`}})}return Q.apply(this,arguments)};$.open=j,$.send=z}function O1(){if(q1)return;q1=!0,G4(),X4()}function R1(){let $=G0.map((Q)=>({...Q})),J=0;for(let Q=$.length-1;Q>=0;Q-=1){let j=$[Q],z=j?.responseSnippet;if(!j||typeof z!=="string"||z.length===0)continue;if(J+z.length>z4)j.responseSnippet=`[response omitted — report size budget reached (${z.length.toLocaleString()} chars)]`;else J+=z.length}return $}var Y4=4,_1=3,F4=4000,H4="[data-debug-reporter]",T1=()=>import("@rrweb/record");function L1($){T1=$}var _=[],w0=null,X0=!1;function f1(){if(typeof window>"u"||w0||X0)return;let $=i();if(!$)return;X0=!0;let J=()=>void U4($);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function U4($){let J;try{J=(await T1()).record}catch(Q){X0=!1,console.warn("[debug-capture] session replay could not start:",Q);return}if(w0)return;try{w0=J({emit:(Q)=>I4(Q),checkoutEveryNms:Math.max(1000,$.seconds*1000/2),checkoutEveryNth:F4,maskAllInputs:!0,...$.maskText?{maskTextSelector:"*"}:{},blockSelector:`${$.blockSelector}, ${H4}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last"},recordCanvas:!1,errorHandler:()=>!0})??null}catch(Q){console.warn("[debug-capture] session replay could not start:",Q)}finally{X0=!1}}function I4($){if($.type===Y4||_.length===0){if(_.push([]),_.length>_1)_=_.slice(-_1)}_[_.length-1].push($)}function A1($=Date.now()){let J=i();if(!J||!_.length)return null;let Q=$-J.seconds*1000,j=_.length-1;while(j>0&&(_[j][0]?.timestamp??$)>Q)j-=1;let z=_.slice(j).flat(),K=z[0]?.timestamp,W=z[z.length-1]?.timestamp;if(K===void 0||W===void 0)return null;return{events:z,startedAt:new Date(K).toISOString(),endedAt:new Date(W).toISOString(),durationMs:Math.max(0,W-K)}}var M4={title:"รายงานปัญหา",summaryLabel:"หัวข้อปัญหา",summaryRequired:"(ต้องกรอกก่อนแจ้งปัญหา)",summaryPlaceholder:"สรุปปัญหาสั้น ๆ เช่น กดบันทึกร่างแล้ว error",detailLabel:"อธิบายปัญหา (ไม่บังคับ)",detailPlaceholder:"เกิดอะไรขึ้น? กำลังทำอะไรอยู่ตอนที่พบปัญหา?",annotateTitle:"วาดบนรูป",annotateHint:"ทำเครื่องหมายจุดที่มีปัญหาก่อนแนบ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",annotateApply:"ใช้รูปนี้",cancel:"ยกเลิก",toolRect:"กรอบ",toolArrow:"ลูกศร",toolHighlight:"ไฮไลต์",toolText:"ข้อความ",deleteSelected:"ลบที่เลือก",clearAll:"ล้างทั้งหมด",annotateHelp:"เลือกเครื่องมือแล้วลากบนรูป · ไม่ได้เลือกเครื่องมือ = ย้าย/ปรับขนาดสิ่งที่วาดไว้ · กดกากบาทมุมขวาบนของรูปทรงเพื่อลบ",capturing:"กำลังเก็บภาพหน้าจอ…",noScreenshot:"ไม่มีภาพหน้าจอ — ยังส่งรายงานได้",cancelled:"ยกเลิกการเก็บภาพหน้าจอแล้ว",close:"ปิด",submit:"แจ้งปัญหา",submitting:"กำลังส่ง…",submitted:"แจ้งปัญหาสำเร็จ",crashed:"เกิดข้อผิดพลาดในระบบ",crashAction:"แจ้งปัญหา",failed:"ส่งรายงานไม่สำเร็จ",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replayAttach:"แนบการบันทึกหน้าจอ {seconds} วินาทีก่อนแจ้ง",replayWhat:"บันทึกเฉพาะโครงสร้างหน้าจอและการคลิก — ข้อความที่พิมพ์ในช่องกรอกถูกปิดบังไว้",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่"},P4={title:"Report a problem",summaryLabel:"Summary",summaryRequired:"(required)",summaryPlaceholder:"One line, e.g. saving a draft returns an error",detailLabel:"Details (optional)",detailPlaceholder:"What happened? What were you doing at the time?",annotateTitle:"Draw on the image",annotateHint:"Mark what went wrong before attaching — box it, point at it, highlight it, or type on it",annotateApply:"Use this image",cancel:"Cancel",toolRect:"Box",toolArrow:"Arrow",toolHighlight:"Highlight",toolText:"Text",deleteSelected:"Delete selected",clearAll:"Clear all",annotateHelp:"Pick a tool and drag on the image · no tool selected = move/resize what you drew · press the ✕ on a shape to delete it",capturing:"Capturing the screen…",noScreenshot:"No screenshot — you can still send the report",cancelled:"Screen capture cancelled",close:"Close",submit:"Send report",submitting:"Sending…",submitted:"Report sent",crashed:"Something went wrong",crashAction:"Report it",failed:"Could not send the report",captured:"Captured",reporter:"Reporter",page:"Page",replayAttach:"Attach a replay of the last {seconds} seconds",replayWhat:"The page and your clicks are recorded, not a video — anything typed into a field is masked",handoffTitle:"Opening the support portal",handoffBody:"You will be signed in automatically to see what you reported",handoffGo:"Go now",handoffPreparing:"Preparing…",handoffFailed:"Could not open your reports",handoffBlocked:"Your browser blocked the new tab",handoffOpen:"Open in a new tab"};function Y0($){return $==="en"?P4:M4}var C4="lw-debug-toasts",q4=6000,B4=`
|
|
2
2
|
:host { all: initial; }
|
|
3
3
|
.stack {
|
|
4
4
|
position: fixed; top: 16px; right: 16px; z-index: 2147483001;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
@keyframes in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
|
|
32
32
|
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
|
|
33
|
-
`,P0=null;function $4(){if(typeof document>"u")return null;if(P0?.isConnected)return P0;let $=document.createElement(a2);$.dataset.debugReporter="true";let J=$.attachShadow({mode:"open"}),Q=document.createElement("style");Q.textContent=e2;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append(Q,j),document.body.append($),P0=j,j}function l($,J="success",Q){let j=e()?N().toast:void 0;if(j){j({message:$,tone:J,...Q?{action:Q}:{}});return}let z=$4();if(!z)return;let W=document.createElement("div");W.className="toast",W.dataset.tone=J;let V=document.createElement("span");V.className="dot";let X=document.createElement("span");X.textContent=$;let H=document.createElement("button");H.type="button",H.className="close",H.textContent="✕",H.setAttribute("aria-label","ปิด");let U=()=>{window.clearTimeout(q),W.remove()};H.addEventListener("click",U);let q=J==="error"||Q?0:window.setTimeout(U,t2);if(W.append(V,X),Q){let P=document.createElement("button");P.type="button",P.className="action",P.textContent=Q.label,P.addEventListener("click",()=>{U(),Q.onClick()}),W.append(P)}W.append(H),z.append(W)}function N1($,J,Q){let j=$.filter((W)=>Boolean(W.error)||W.status!=null&&W.status>=400).slice(-20).map((W)=>({method:W.method,url:W.url,status:W.status,error:W.error,at:W.startedAt})),z=J.filter((W)=>W.level==="error"||W.level==="exception"||W.level==="unhandledrejection").slice(-20).map((W)=>W.message);return{failedRequests:j,errors:z,erroredQueries:Q.slice(0,20)}}function J4(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let J=performance.memory;if(J)$.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[Q]=performance.getEntriesByType("navigation");if(Q)$.domContentLoadedMs=Math.round(Q.domContentLoadedEventEnd),$.loadEventMs=Math.round(Q.loadEventEnd);return $}function w0($,J){if(!$)return J;try{return $()}catch{return J}}function D1(){let $=N(),{pathname:J,search:Q,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:Q},module:f0(J),user:w0($.user,{}),apiHeaders:u(w0($.headers,{})),app:{name:h().name,version:h().version,environment:h().environment},client:{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,online:navigator.onLine,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio},screen:{width:window.screen.width,height:window.screen.height}},performance:J4(),extra:w0($.extra,{})}}var Q4=2;function C1($){let J=B1(),Q=e0();return{context:D1(),reason:$.reason,note:$.note,cause:N1(J,Q,$.erroredQueries),actionTrail:l0(),network:J,console:Q,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:Q4}}}async function k1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let Q=await j4();if(Q.status==="ok")return{dataUrl:Q.dataUrl,method:"display-media"};if(Q.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await W4();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function j4(){let $=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(J);let Q=await z4($);return Q?{status:"ok",dataUrl:Q}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((J)=>J.stop())}}async function z4($){let J=document.createElement("video");J.srcObject=$,J.muted=!0,J.playsInline=!0,await new Promise((V)=>{let X=!1,H=()=>{if(X)return;X=!0,V()};J.onloadedmetadata=()=>{J.play().then(H).catch(H)},window.setTimeout(H,1500)}),await Z4(J);let{videoWidth:Q,videoHeight:j}=J;if(!Q||!j)return null;let z=document.createElement("canvas");z.width=Q,z.height=j;let W=z.getContext("2d");if(!W)return null;W.drawImage(J,0,0,Q,j),J.pause(),J.srcObject=null;try{return z.toDataURL("image/png")}catch{return null}}function Z4($){return new Promise((J)=>{let Q=!1,j=()=>{if(Q)return;Q=!0,J()},z=$;if(typeof z.requestVideoFrameCallback==="function")z.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function W4(){let $=N().screenshotFallback;if(!$)return null;let J=await $().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(Q)=>!(Q instanceof HTMLElement&&Q.dataset?.debugReporter==="true")})}catch{return null}}var K4=2000,V4=0.82,Y4=3000000;function F4($){return new Promise((J,Q)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>Q(Error("could not read the screenshot")),j.src=$})}async function R1($){try{let J=await F4($),Q=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,K4/Q),z=document.createElement("canvas");z.width=Math.max(1,Math.round(J.naturalWidth*j)),z.height=Math.max(1,Math.round(J.naturalHeight*j));let W=z.getContext("2d");if(!W)return $;W.fillStyle="#fff",W.fillRect(0,0,z.width,z.height),W.drawImage(J,0,0,z.width,z.height);let V=V4,X=z.toDataURL("image/jpeg",V);while(X.length>Y4&&V>0.4)V-=0.15,X=z.toDataURL("image/jpeg",V);return X}catch{return $}}var G4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,X4=/^\d+$/,H4=/^[0-9a-f]{16,}$/i;function O1($){if($.reason.type==="manual")return null;let J=$.cause?.failedRequests?.[0];if(!J?.url)return null;let Q;try{Q=new URL(J.url,"http://x").pathname}catch{Q=J.url}let j=Q.split("/").map((W)=>G4.test(W)||X4.test(W)||H4.test(W)?":id":W).join("/"),z=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${z}`}var S1=2000000;function K0($){let{screenshotDataUrl:J,...Q}=$;return JSON.stringify(Q).length}function _1($,J=2000000){if(K0($)<=J)return $;let Q=$.network.map((z)=>({...z})),j={...$,network:Q};for(let z of Q){if(K0(j)<=J)return j;if(typeof z.responseSnippet==="string"&&z.responseSnippet.length>35)z.responseSnippet="[body dropped — report size budget]";if(typeof z.requestBody==="string"&&z.requestBody.length>35)z.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&K0(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&K0(j)>J)j.console=j.console.slice(1);return j}var T1=32768;function I4($){let J="";for(let Q=0;Q<$.length;Q+=T1)J+=String.fromCharCode(...$.subarray(Q,Q+T1));return btoa(J)}function U4($){let{screenshotDataUrl:J,...Q}=$;return{dataUri:`data:application/json;base64,${I4(new TextEncoder().encode(JSON.stringify(Q)))}`,filename:"debug-bundle.json"}}async function M4(){let $=N().identity;if(!$)return{};try{let J=await $();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function A1($,J){let Q=N(),j=_1(J,S1),{context:z,note:W}=j,V=[];if(j.screenshotDataUrl){let q=await R1(j.screenshotDataUrl);V.push({dataUri:q,filename:"screenshot.jpg"})}V.push(U4(j));let X=O1(j),H={title:$,description:W.trim()||void 0,appName:h().name,category:z.module?.label,routeUrl:z.route.href,priority:"MEDIUM",requesterEmail:z.user.email??void 0,requesterName:z.user.fullName??void 0,customFields:{unit:z.user.unit??"",appVersion:z.app.version,environment:z.app.environment,reasonType:j.reason.type,appName:h().name,module:z.module?.label??""},context:{...X?{signature:X}:{},capturedAt:z.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:z.client,performance:z.performance,apiHeaders:z.apiHeaders,extra:z.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod},attachments:V},U=await fetch(`${Q.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,...await M4()},body:JSON.stringify(H)});if(!U.ok){let q=U.headers.get("retry-after"),P=await U.json().then((w)=>w.error).catch(()=>null);throw Error(U.status===429?`Too many reports — try again in ${q??"a moment"}s`:P??`Report failed (${U.status})`)}return await U.json()}var r=Math.PI/6;function L1($,J,Q){let j=J.x-$.x,z=J.y-$.y,W=Math.hypot(j,z),V=Math.atan2(z,j),X=[{x:J.x,y:J.y},{x:J.x-Q*Math.cos(V-r),y:J.y-Q*Math.sin(V-r)},{x:J.x-Q*Math.cos(V+r),y:J.y-Q*Math.sin(V+r)}],H=Q*Math.cos(r)*0.92;if(W<=H)return{shaft:null,head:X};return{shaft:{from:$,to:{x:J.x-H*Math.cos(V),y:J.y-H*Math.sin(V)}},head:X}}var q0="#f44336",P4="rgba(250, 204, 21, 0.4)",B0=22,f1="#2563eb",E1=9,x1=11,h1=18,p1=4,V0=8,w4=[{id:"nw",fx:0,fy:0,cursor:"nwse-resize"},{id:"n",fx:0.5,fy:0,cursor:"ns-resize"},{id:"ne",fx:1,fy:0,cursor:"nesw-resize"},{id:"e",fx:1,fy:0.5,cursor:"ew-resize"},{id:"se",fx:1,fy:1,cursor:"nwse-resize"},{id:"s",fx:0.5,fy:1,cursor:"ns-resize"},{id:"sw",fx:0,fy:1,cursor:"nesw-resize"},{id:"w",fx:0,fy:0.5,cursor:"ew-resize"}];function m1($,J,Q){let j=[],z=null,W=-1,V=null,X=null,H=$.getContext("2d");function U(){let Z=$.getBoundingClientRect().width;return Z>0?$.width/Z:1}function q(Z){let K=$.getBoundingClientRect();return{x:(Z.clientX-K.left)/K.width*$.width,y:(Z.clientY-K.top)/K.height*$.height}}function P(Z){let K=Z.size??B0;if(!H)return(Z.text?.length??0)*K*0.6;H.save(),H.font=`600 ${K}px system-ui, sans-serif`;let F=H.measureText(Z.text??"").width;return H.restore(),F}function w(Z){if(Z.tool==="text"){let K=Z.size??B0;return{left:Z.x1,top:Z.y1,right:Z.x1+P(Z),bottom:Z.y1+K*1.25}}return{left:Math.min(Z.x1,Z.x2),top:Math.min(Z.y1,Z.y2),right:Math.max(Z.x1,Z.x2),bottom:Math.max(Z.y1,Z.y2)}}function R(Z){if(Z.tool==="arrow")return[{id:"tail",x:Z.x1,y:Z.y1,cursor:"move"},{id:"head",x:Z.x2,y:Z.y2,cursor:"move"}];let K=w(Z);if(Z.tool==="text")return[{id:"size",x:K.right,y:K.bottom,cursor:"nwse-resize"}];return w4.map((F)=>({id:F.id,x:K.left+(K.right-K.left)*F.fx,y:K.top+(K.bottom-K.top)*F.fy,cursor:F.cursor}))}function C(Z){let K=w(Z);return{x:K.right+h1*U(),y:K.top-h1*U()}}function k(Z,K,F){let{shaft:Y,head:G}=L1({x:K.x1,y:K.y1},{x:K.x2,y:K.y2},Math.max(10,16*F));if(Y)Z.lineCap="butt",Z.beginPath(),Z.moveTo(Y.from.x,Y.from.y),Z.lineTo(Y.to.x,Y.to.y),Z.stroke();Z.beginPath(),Z.moveTo(G[0].x,G[0].y),Z.lineTo(G[1].x,G[1].y),Z.lineTo(G[2].x,G[2].y),Z.closePath(),Z.fill()}function _(Z,K,F){Z.save(),Z.lineWidth=Math.max(2,3*F),Z.strokeStyle=q0,Z.fillStyle=q0;let Y=w(K);if(K.tool==="rect")Z.strokeRect(Y.left,Y.top,Y.right-Y.left,Y.bottom-Y.top);else if(K.tool==="arrow")k(Z,K,F);else if(K.tool==="highlight")Z.fillStyle=P4,Z.fillRect(Y.left,Y.top,Y.right-Y.left,Y.bottom-Y.top);else if(K.tool==="text"&&K.text){let G=K.size??B0;Z.font=`600 ${G}px system-ui, sans-serif`,Z.textBaseline="top";let I=G*0.22;Z.fillStyle="rgba(255,255,255,0.92)",Z.fillRect(Y.left-I,Y.top-I,Y.right-Y.left+I*2,Y.bottom-Y.top+I*2),Z.fillStyle=q0,Z.fillText(K.text,Y.left,Y.top)}Z.restore()}function n(Z,K,F){let Y=w(K);Z.save(),Z.strokeStyle=f1,Z.lineWidth=Math.max(1,1.5*F),Z.setLineDash([6*F,4*F]),Z.strokeRect(Y.left,Y.top,Y.right-Y.left,Y.bottom-Y.top),Z.setLineDash([]);let G=E1*F;for(let O of R(K))Z.fillStyle="#fff",Z.strokeStyle=f1,Z.lineWidth=Math.max(1,1.5*F),Z.beginPath(),Z.rect(O.x-G/2,O.y-G/2,G,G),Z.fill(),Z.stroke();let I=C(K),M=x1*F;Z.beginPath(),Z.arc(I.x,I.y,M,0,Math.PI*2),Z.fillStyle="#dc2626",Z.fill(),Z.strokeStyle="#fff",Z.lineWidth=Math.max(1.5,2*F),Z.beginPath(),Z.moveTo(I.x-M*0.4,I.y-M*0.4),Z.lineTo(I.x+M*0.4,I.y+M*0.4),Z.moveTo(I.x+M*0.4,I.y-M*0.4),Z.lineTo(I.x-M*0.4,I.y+M*0.4),Z.stroke(),Z.restore()}function B(){if(!H)return;let Z=U();if(H.clearRect(0,0,$.width,$.height),H.drawImage(J,0,0,$.width,$.height),j.forEach((F,Y)=>{if(Y!==a)_(H,F,Z)}),V)_(H,V,Z);let K=j[W];if(K&&!V)n(H,K,Z)}function D0(Z,K,F,Y,G){return Math.abs(Z-F)<=G&&Math.abs(K-Y)<=G}function C0(Z,K){let F=j[W];if(!F)return null;let Y=E1*U()/2+3*U();for(let G of R(F))if(D0(Z,K,G.x,G.y,Y))return G.id;return null}function k0(Z,K){let F=j[W];if(!F)return!1;let Y=C(F);return D0(Z,K,Y.x,Y.y,x1*U())}function Y0(Z,K){let F=6*U();for(let Y=j.length-1;Y>=0;Y-=1){let G=j[Y];if(G.tool==="arrow"){let M=G.x2-G.x1,O=G.y2-G.y1,E=Math.hypot(M,O)||1,x=Math.max(0,Math.min(1,((Z-G.x1)*M+(K-G.y1)*O)/(E*E)));if(Math.hypot(Z-(G.x1+x*M),K-(G.y1+x*O))<=F+4*U())return Y;continue}let I=w(G);if(Z>=I.left-F&&Z<=I.right+F&&K>=I.top-F&&K<=I.bottom+F)return Y}return-1}function u1(Z,K,F,Y,G){if(K==="tail"){Z.x1=F.x1+Y,Z.y1=F.y1+G;return}if(K==="head"){Z.x2=F.x2+Y,Z.y2=F.y2+G;return}if(K==="size"){let o1=(F.size??24)+G;Z.size=Math.max(10,o1);return}let I=w(F),{left:M,top:O,right:E,bottom:x}=I;if(K.includes("w"))M=Math.min(E-V0,M+Y);if(K.includes("e"))E=Math.max(M+V0,E+Y);if(K.includes("n"))O=Math.min(x-V0,O+G);if(K.includes("s"))x=Math.max(O+V0,x+G);Z.x1=M,Z.y1=O,Z.x2=E,Z.y2=x}function d1(Z,K,F,Y){Z.x1=K.x1+F,Z.y1=K.y1+Y,Z.x2=K.x2+F,Z.y2=K.y2+Y}let T=null,a=-1,A={x:0,y:0,size:24};function i1(){let Z=$.getBoundingClientRect().width;return Z>0?Z/$.width:1}function c1(Z,K){if(!H)return Z.length*K*0.6;H.save(),H.font=`600 ${K}px system-ui, sans-serif`;let F=H.measureText(Z||" ").width;return H.restore(),F}function R0(){if(!T)return;let Z=$.parentElement;if(!Z)return;let K=$.getBoundingClientRect(),F=Z.getBoundingClientRect(),Y=i1(),G=A.size*Y;T.style.left=`${K.left-F.left+A.x*Y}px`,T.style.top=`${K.top-F.top+A.y*Y}px`,T.style.fontSize=`${G}px`,T.style.width=`${Math.max(40,c1(T.value,G)+G)}px`}function g(Z){let K=T;if(!K)return;T=null;let F=K.value.trim(),Y=a;if(a=-1,K.remove(),Z&&F){if(Y>=0&&j[Y])j[Y].text=F,W=Y;else j.push({tool:"text",x1:A.x,y1:A.y,x2:A.x,y2:A.y,text:F,size:A.size}),W=j.length-1;Q()}else if(Y>=0)W=Y;$.focus(),B()}function O0(Z,K,F=-1){g(!0);let Y=$.parentElement;if(!Y)return;if(getComputedStyle(Y).position==="static")Y.style.position="relative";let G=F>=0?j[F]:void 0;a=F,A={x:G?.x1??Z,y:G?.y1??K,size:G?.size??Math.round(24*U())};let I=document.createElement("input");I.type="text",I.className="text-edit",I.value=G?.text??"",I.setAttribute("aria-label","ข้อความบนภาพ"),I.placeholder="ข้อความ",T=I,Y.append(I),R0(),I.addEventListener("input",R0),I.addEventListener("keydown",(M)=>{if(M.stopPropagation(),M.key==="Enter")g(!0);else if(M.key==="Escape")g(!1)}),requestAnimationFrame(()=>{if(T!==I)return;I.focus(),I.select(),I.addEventListener("blur",()=>g(!0))}),B()}function S0(Z){let{x:K,y:F}=q(Z);if($.setPointerCapture(Z.pointerId),k0(K,F)){F0();return}let Y=C0(K,F);if(Y&&j[W]){X={grip:Y,x:K,y:F,start:{...j[W]}};return}if(z==="text"){if(Z.preventDefault(),$.hasPointerCapture(Z.pointerId))$.releasePointerCapture(Z.pointerId);z=null,Q(),O0(K,F);return}if(z){V={tool:z,x1:K,y1:F,x2:K,y2:F},W=-1;return}let G=Y0(K,F);W=G,X=G>=0?{grip:"body",x:K,y:F,start:{...j[G]}}:null,B()}function _0(Z){let{x:K,y:F}=q(Z);if(V){V.x2=K,V.y2=F,B();return}if(X){let G=j[W];if(!G)return;let I=K-X.x,M=F-X.y;if(X.grip==="body")d1(G,X.start,I,M);else u1(G,X.grip,X.start,I,M);B();return}if(z){$.style.cursor="crosshair";return}if(k0(K,F)){$.style.cursor="pointer";return}let Y=C0(K,F);if(Y){let G=j[W]?R(j[W]).find((I)=>I.id===Y):null;$.style.cursor=G?.cursor??"pointer";return}$.style.cursor=Y0(K,F)>=0?"move":"default"}function t(){if(V){if(!(Math.abs(V.x2-V.x1)<p1&&Math.abs(V.y2-V.y1)<p1))j.push(V),W=j.length-1,z=null,Q();V=null}if(X)X=null,Q();B()}function T0(Z){let K=$.getBoundingClientRect(),F=(Z.clientX-K.left)/K.width*$.width,Y=(Z.clientY-K.top)/K.height*$.height,G=Y0(F,Y),I=j[G];if(!I||I.tool!=="text")return;Z.preventDefault(),O0(I.x1,I.y1,G)}function A0(Z){if(W<0)return;if(Z.key==="Delete"||Z.key==="Backspace")Z.preventDefault(),F0();else if(Z.key==="Escape")W=-1,B()}function F0(){if(W<0)return;j.splice(W,1),W=-1,Q(),B()}return $.addEventListener("pointerdown",S0),$.addEventListener("pointermove",_0),$.addEventListener("pointerup",t),$.addEventListener("pointercancel",t),$.addEventListener("dblclick",T0),$.tabIndex=0,$.addEventListener("keydown",A0),B(),{setTool(Z){z=Z,W=-1,$.style.cursor=Z?"crosshair":"default",B()},deleteSelected:F0,clear(){j.length=0,W=-1,Q(),B()},hasShapes:()=>j.length>0,hasSelection:()=>W>=0,toDataUrl(){let Z=document.createElement("canvas");Z.width=J.naturalWidth,Z.height=J.naturalHeight;let K=Z.getContext("2d");if(!K)return $.toDataURL("image/png");K.drawImage(J,0,0);let F=U();for(let Y of j)_(K,Y,F);return Z.toDataURL("image/png")},destroy(){g(!1),$.removeEventListener("pointerdown",S0),$.removeEventListener("pointermove",_0),$.removeEventListener("pointerup",t),$.removeEventListener("pointercancel",t),$.removeEventListener("dblclick",T0),$.removeEventListener("keydown",A0)}}}var y1=`
|
|
33
|
+
`,k0=null;function N4(){if(typeof document>"u")return null;if(k0?.isConnected)return k0;let $=document.createElement(C4);$.dataset.debugReporter="true";let J=$.attachShadow({mode:"open"}),Q=document.createElement("style");Q.textContent=B4;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append(Q,j),document.body.append($),k0=j,j}function a($,J="success",Q){let j=j0()?w().toast:void 0;if(j){j({message:$,tone:J,...Q?{action:Q}:{}});return}let z=N4();if(!z)return;let K=document.createElement("div");K.className="toast",K.dataset.tone=J;let W=document.createElement("span");W.className="dot";let Y=document.createElement("span");Y.textContent=$;let H=document.createElement("button");H.type="button",H.className="close",H.textContent="✕",H.setAttribute("aria-label","ปิด");let I=()=>{window.clearTimeout(k),K.remove()};H.addEventListener("click",I);let k=J==="error"||Q?0:window.setTimeout(I,q4);if(K.append(W,Y),Q){let M=document.createElement("button");M.type="button",M.className="action",M.textContent=Q.label,M.addEventListener("click",()=>{I(),Q.onClick()}),K.append(M)}K.append(H),z.append(K)}function x1($,J,Q){let j=$.filter((K)=>Boolean(K.error)||K.status!=null&&K.status>=400).slice(-20).map((K)=>({method:K.method,url:K.url,status:K.status,error:K.error,at:K.startedAt})),z=J.filter((K)=>K.level==="error"||K.level==="exception"||K.level==="unhandledrejection").slice(-20).map((K)=>K.message);return{failedRequests:j,errors:z,erroredQueries:Q.slice(0,20)}}function D4(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let J=performance.memory;if(J)$.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[Q]=performance.getEntriesByType("navigation");if(Q)$.domContentLoadedMs=Math.round(Q.domContentLoadedEventEnd),$.loadEventMs=Math.round(Q.loadEventEnd);return $}function S0($,J){if(!$)return J;try{return $()}catch{return J}}function E1(){let $=w(),{pathname:J,search:Q,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:Q},module:y0(J),user:S0($.user,{}),apiHeaders:l(S0($.headers,{})),app:{name:p().name,version:p().version,environment:p().environment},client:{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,online:navigator.onLine,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio},screen:{width:window.screen.width,height:window.screen.height}},performance:D4(),extra:S0($.extra,{})}}var w4=2;function h1($){let J=R1(),Q=K1();return{context:E1(),reason:$.reason,note:$.note,cause:x1(J,Q,$.erroredQueries),actionTrail:$1(),network:J,console:Q,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,replay:A1()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:w4}}}async function m1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let Q=await k4();if(Q.status==="ok")return{dataUrl:Q.dataUrl,method:"display-media"};if(Q.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await R4();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function k4(){let $=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(J);let Q=await S4($);return Q?{status:"ok",dataUrl:Q}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((J)=>J.stop())}}async function S4($){let J=document.createElement("video");J.srcObject=$,J.muted=!0,J.playsInline=!0,await new Promise((W)=>{let Y=!1,H=()=>{if(Y)return;Y=!0,W()};J.onloadedmetadata=()=>{J.play().then(H).catch(H)},window.setTimeout(H,1500)}),await O4(J);let{videoWidth:Q,videoHeight:j}=J;if(!Q||!j)return null;let z=document.createElement("canvas");z.width=Q,z.height=j;let K=z.getContext("2d");if(!K)return null;K.drawImage(J,0,0,Q,j),J.pause(),J.srcObject=null;try{return z.toDataURL("image/png")}catch{return null}}function O4($){return new Promise((J)=>{let Q=!1,j=()=>{if(Q)return;Q=!0,J()},z=$;if(typeof z.requestVideoFrameCallback==="function")z.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function R4(){let $=w().screenshotFallback;if(!$)return null;let J=await $().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(Q)=>!(Q instanceof HTMLElement&&Q.dataset?.debugReporter==="true")})}catch{return null}}var _4=2000,T4=0.82,L4=3000000;function f4($){return new Promise((J,Q)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>Q(Error("could not read the screenshot")),j.src=$})}async function g1($){try{let J=await f4($),Q=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,_4/Q),z=document.createElement("canvas");z.width=Math.max(1,Math.round(J.naturalWidth*j)),z.height=Math.max(1,Math.round(J.naturalHeight*j));let K=z.getContext("2d");if(!K)return $;K.fillStyle="#fff",K.fillRect(0,0,z.width,z.height),K.drawImage(J,0,0,z.width,z.height);let W=T4,Y=z.toDataURL("image/jpeg",W);while(Y.length>L4&&W>0.4)W-=0.15,Y=z.toDataURL("image/jpeg",W);return Y}catch{return $}}var A4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,x4=/^\d+$/,E4=/^[0-9a-f]{16,}$/i;function p1($){if($.reason.type==="manual")return null;let J=$.cause?.failedRequests?.[0];if(!J?.url)return null;let Q;try{Q=new URL(J.url,"http://x").pathname}catch{Q=J.url}let j=Q.split("/").map((K)=>A4.test(K)||x4.test(K)||E4.test(K)?":id":K).join("/"),z=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${z}`}var y1=2000000;function F0($){let{screenshotDataUrl:J,replay:Q,...j}=$;return JSON.stringify(j).length}function b1($,J=2000000){if(F0($)<=J)return $;let Q=$.network.map((z)=>({...z})),j={...$,network:Q};for(let z of Q){if(F0(j)<=J)return j;if(typeof z.responseSnippet==="string"&&z.responseSnippet.length>35)z.responseSnippet="[body dropped — report size budget]";if(typeof z.requestBody==="string"&&z.requestBody.length>35)z.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&F0(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&F0(j)>J)j.console=j.console.slice(1);return j}function t($){let J="";for(let Q=0;Q<$.length;Q+=32768)J+=String.fromCharCode(...$.subarray(Q,Q+32768));return btoa(J)}var h4=4,m4=2,g4=3,p4=0,y4=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]);function v1($){if(!$)return;for(let J of Object.keys($)){let Q=$[J];if(typeof Q!=="string"||!y4.has(J)||!Q.includes("?"))continue;$[J]=E(Q)}}function O0($){if(!$)return;v1($.attributes);for(let J of $.childNodes??[])O0(J)}function u1($){let J=JSON.parse(JSON.stringify($));for(let Q of J){let j=Q.data;if(!j||typeof j!=="object")continue;if(Q.type===h4&&typeof j.href==="string")j.href=E(j.href);else if(Q.type===m4)O0(j.node);else if(Q.type===g4&&j.source===p4){for(let z of j.adds??[])O0(z.node);for(let z of j.attributes??[])v1(z.attributes)}}return J}var b4="session-replay.json.gz",v4="session-replay.json";function u4($){return Boolean($&&$.events.length>0)}async function d4($){if(typeof CompressionStream>"u")return null;try{let J=new Blob([$]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function d1($,J){if(!u4($))return{summary:{omitted:"empty"}};let j={seconds:Math.round($.durationMs/1000),events:$.events.length,startedAt:$.startedAt,endedAt:$.endedAt},z=new TextEncoder().encode(JSON.stringify({events:u1($.events)})),K=await d4(z),W=K??z;if(W.byteLength>J)return{summary:{...j,bytes:W.byteLength,omitted:"too-large"}};let Y=K!==null;return{dataUri:`data:${Y?"application/gzip":"application/json"};base64,${t(W)}`,filename:Y?b4:v4,summary:{...j,bytes:W.byteLength,compressed:Y}}}function i4($){let{screenshotDataUrl:J,replay:Q,...j}=$;return{dataUri:`data:application/json;base64,${t(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function c4(){let $=w().identity;if(!$)return{};try{let J=await $();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function i1($,J){let Q=w(),j=b1(J,y1),{context:z,note:K}=j,W=[];if(j.screenshotDataUrl){let P=await g1(j.screenshotDataUrl);W.push({dataUri:P,filename:"screenshot.jpg"})}W.push(i4(j));let Y,H=i();if(H)if(j.replay===null)Y={omitted:"declined"};else{let P=await d1(j.replay,H.maxBytes);if(Y=P.summary,"dataUri"in P)W.push({dataUri:P.dataUri,filename:P.filename})}let I=p1(j),k={title:$,description:K.trim()||void 0,appName:p().name,category:z.module?.label,routeUrl:z.route.href,priority:"MEDIUM",requesterEmail:z.user.email??void 0,requesterName:z.user.fullName??void 0,customFields:{unit:z.user.unit??"",appVersion:z.app.version,environment:z.app.environment,reasonType:j.reason.type,appName:p().name,module:z.module?.label??""},context:{...I?{signature:I}:{},capturedAt:z.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:z.client,performance:z.performance,apiHeaders:z.apiHeaders,extra:z.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...Y?{replay:Y}:{}},attachments:W},M=await fetch(`${Q.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":Q.realmKey,...await c4()},body:JSON.stringify(k)});if(!M.ok){let P=M.headers.get("retry-after"),B=await M.json().then((N)=>N.error).catch(()=>null);throw Error(M.status===429?`Too many reports — try again in ${P??"a moment"}s`:B??`Report failed (${M.status})`)}return await M.json()}var e=Math.PI/6;function c1($,J,Q){let j=J.x-$.x,z=J.y-$.y,K=Math.hypot(j,z),W=Math.atan2(z,j),Y=[{x:J.x,y:J.y},{x:J.x-Q*Math.cos(W-e),y:J.y-Q*Math.sin(W-e)},{x:J.x-Q*Math.cos(W+e),y:J.y-Q*Math.sin(W+e)}],H=Q*Math.cos(e)*0.92;if(K<=H)return{shaft:null,head:Y};return{shaft:{from:$,to:{x:J.x-H*Math.cos(W),y:J.y-H*Math.sin(W)}},head:Y}}var R0="#f44336",o4="rgba(250, 204, 21, 0.4)",_0=22,o1="#2563eb",l1=9,r1=11,s1=18,n1=4,H0=8,l4=[{id:"nw",fx:0,fy:0,cursor:"nwse-resize"},{id:"n",fx:0.5,fy:0,cursor:"ns-resize"},{id:"ne",fx:1,fy:0,cursor:"nesw-resize"},{id:"e",fx:1,fy:0.5,cursor:"ew-resize"},{id:"se",fx:1,fy:1,cursor:"nwse-resize"},{id:"s",fx:0.5,fy:1,cursor:"ns-resize"},{id:"sw",fx:0,fy:1,cursor:"nesw-resize"},{id:"w",fx:0,fy:0.5,cursor:"ew-resize"}];function a1($,J,Q){let j=[],z=null,K=-1,W=null,Y=null,H=$.getContext("2d");function I(){let Z=$.getBoundingClientRect().width;return Z>0?$.width/Z:1}function k(Z){let V=$.getBoundingClientRect();return{x:(Z.clientX-V.left)/V.width*$.width,y:(Z.clientY-V.top)/V.height*$.height}}function M(Z){let V=Z.size??_0;if(!H)return(Z.text?.length??0)*V*0.6;H.save(),H.font=`600 ${V}px system-ui, sans-serif`;let X=H.measureText(Z.text??"").width;return H.restore(),X}function P(Z){if(Z.tool==="text"){let V=Z.size??_0;return{left:Z.x1,top:Z.y1,right:Z.x1+M(Z),bottom:Z.y1+V*1.25}}return{left:Math.min(Z.x1,Z.x2),top:Math.min(Z.y1,Z.y2),right:Math.max(Z.x1,Z.x2),bottom:Math.max(Z.y1,Z.y2)}}function B(Z){if(Z.tool==="arrow")return[{id:"tail",x:Z.x1,y:Z.y1,cursor:"move"},{id:"head",x:Z.x2,y:Z.y2,cursor:"move"}];let V=P(Z);if(Z.tool==="text")return[{id:"size",x:V.right,y:V.bottom,cursor:"nwse-resize"}];return l4.map((X)=>({id:X.id,x:V.left+(V.right-V.left)*X.fx,y:V.top+(V.bottom-V.top)*X.fy,cursor:X.cursor}))}function N(Z){let V=P(Z);return{x:V.right+s1*I(),y:V.top-s1*I()}}function h(Z,V,X){let{shaft:G,head:F}=c1({x:V.x1,y:V.y1},{x:V.x2,y:V.y2},Math.max(10,16*X));if(G)Z.lineCap="butt",Z.beginPath(),Z.moveTo(G.from.x,G.from.y),Z.lineTo(G.to.x,G.to.y),Z.stroke();Z.beginPath(),Z.moveTo(F[0].x,F[0].y),Z.lineTo(F[1].x,F[1].y),Z.lineTo(F[2].x,F[2].y),Z.closePath(),Z.fill()}function O(Z,V,X){Z.save(),Z.lineWidth=Math.max(2,3*X),Z.strokeStyle=R0,Z.fillStyle=R0;let G=P(V);if(V.tool==="rect")Z.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(V.tool==="arrow")h(Z,V,X);else if(V.tool==="highlight")Z.fillStyle=o4,Z.fillRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(V.tool==="text"&&V.text){let F=V.size??_0;Z.font=`600 ${F}px system-ui, sans-serif`,Z.textBaseline="top";let U=F*0.22;Z.fillStyle="rgba(255,255,255,0.92)",Z.fillRect(G.left-U,G.top-U,G.right-G.left+U*2,G.bottom-G.top+U*2),Z.fillStyle=R0,Z.fillText(V.text,G.left,G.top)}Z.restore()}function A(Z,V,X){let G=P(V);Z.save(),Z.strokeStyle=o1,Z.lineWidth=Math.max(1,1.5*X),Z.setLineDash([6*X,4*X]),Z.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top),Z.setLineDash([]);let F=l1*X;for(let R of B(V))Z.fillStyle="#fff",Z.strokeStyle=o1,Z.lineWidth=Math.max(1,1.5*X),Z.beginPath(),Z.rect(R.x-F/2,R.y-F/2,F,F),Z.fill(),Z.stroke();let U=N(V),C=r1*X;Z.beginPath(),Z.arc(U.x,U.y,C,0,Math.PI*2),Z.fillStyle="#dc2626",Z.fill(),Z.strokeStyle="#fff",Z.lineWidth=Math.max(1.5,2*X),Z.beginPath(),Z.moveTo(U.x-C*0.4,U.y-C*0.4),Z.lineTo(U.x+C*0.4,U.y+C*0.4),Z.moveTo(U.x+C*0.4,U.y-C*0.4),Z.lineTo(U.x-C*0.4,U.y+C*0.4),Z.stroke(),Z.restore()}function D(){if(!H)return;let Z=I();if(H.clearRect(0,0,$.width,$.height),H.drawImage(J,0,0,$.width,$.height),j.forEach((X,G)=>{if(G!==J0)O(H,X,Z)}),W)O(H,W,Z);let V=j[K];if(V&&!W)A(H,V,Z)}function u(Z,V,X,G,F){return Math.abs(Z-X)<=F&&Math.abs(V-G)<=F}function L0(Z,V){let X=j[K];if(!X)return null;let G=l1*I()/2+3*I();for(let F of B(X))if(u(Z,V,F.x,F.y,G))return F.id;return null}function f0(Z,V){let X=j[K];if(!X)return!1;let G=N(X);return u(Z,V,G.x,G.y,r1*I())}function U0(Z,V){let X=6*I();for(let G=j.length-1;G>=0;G-=1){let F=j[G];if(F.tool==="arrow"){let C=F.x2-F.x1,R=F.y2-F.y1,m=Math.hypot(C,R)||1,g=Math.max(0,Math.min(1,((Z-F.x1)*C+(V-F.y1)*R)/(m*m)));if(Math.hypot(Z-(F.x1+g*C),V-(F.y1+g*R))<=X+4*I())return G;continue}let U=P(F);if(Z>=U.left-X&&Z<=U.right+X&&V>=U.top-X&&V<=U.bottom+X)return G}return-1}function j2(Z,V,X,G,F){if(V==="tail"){Z.x1=X.x1+G,Z.y1=X.y1+F;return}if(V==="head"){Z.x2=X.x2+G,Z.y2=X.y2+F;return}if(V==="size"){let W2=(X.size??24)+F;Z.size=Math.max(10,W2);return}let U=P(X),{left:C,top:R,right:m,bottom:g}=U;if(V.includes("w"))C=Math.min(m-H0,C+G);if(V.includes("e"))m=Math.max(C+H0,m+G);if(V.includes("n"))R=Math.min(g-H0,R+F);if(V.includes("s"))g=Math.max(R+H0,g+F);Z.x1=C,Z.y1=R,Z.x2=m,Z.y2=g}function z2(Z,V,X,G){Z.x1=V.x1+X,Z.y1=V.y1+G,Z.x2=V.x2+X,Z.y2=V.y2+G}let L=null,J0=-1,f={x:0,y:0,size:24};function Z2(){let Z=$.getBoundingClientRect().width;return Z>0?Z/$.width:1}function K2(Z,V){if(!H)return Z.length*V*0.6;H.save(),H.font=`600 ${V}px system-ui, sans-serif`;let X=H.measureText(Z||" ").width;return H.restore(),X}function A0(){if(!L)return;let Z=$.parentElement;if(!Z)return;let V=$.getBoundingClientRect(),X=Z.getBoundingClientRect(),G=Z2(),F=f.size*G;L.style.left=`${V.left-X.left+f.x*G}px`,L.style.top=`${V.top-X.top+f.y*G}px`,L.style.fontSize=`${F}px`,L.style.width=`${Math.max(40,K2(L.value,F)+F)}px`}function d(Z){let V=L;if(!V)return;L=null;let X=V.value.trim(),G=J0;if(J0=-1,V.remove(),Z&&X){if(G>=0&&j[G])j[G].text=X,K=G;else j.push({tool:"text",x1:f.x,y1:f.y,x2:f.x,y2:f.y,text:X,size:f.size}),K=j.length-1;Q()}else if(G>=0)K=G;$.focus(),D()}function x0(Z,V,X=-1){d(!0);let G=$.parentElement;if(!G)return;if(getComputedStyle(G).position==="static")G.style.position="relative";let F=X>=0?j[X]:void 0;J0=X,f={x:F?.x1??Z,y:F?.y1??V,size:F?.size??Math.round(24*I())};let U=document.createElement("input");U.type="text",U.className="text-edit",U.value=F?.text??"",U.setAttribute("aria-label","ข้อความบนภาพ"),U.placeholder="ข้อความ",L=U,G.append(U),A0(),U.addEventListener("input",A0),U.addEventListener("keydown",(C)=>{if(C.stopPropagation(),C.key==="Enter")d(!0);else if(C.key==="Escape")d(!1)}),requestAnimationFrame(()=>{if(L!==U)return;U.focus(),U.select(),U.addEventListener("blur",()=>d(!0))}),D()}function E0(Z){let{x:V,y:X}=k(Z);if($.setPointerCapture(Z.pointerId),f0(V,X)){I0();return}let G=L0(V,X);if(G&&j[K]){Y={grip:G,x:V,y:X,start:{...j[K]}};return}if(z==="text"){if(Z.preventDefault(),$.hasPointerCapture(Z.pointerId))$.releasePointerCapture(Z.pointerId);z=null,Q(),x0(V,X);return}if(z){W={tool:z,x1:V,y1:X,x2:V,y2:X},K=-1;return}let F=U0(V,X);K=F,Y=F>=0?{grip:"body",x:V,y:X,start:{...j[F]}}:null,D()}function h0(Z){let{x:V,y:X}=k(Z);if(W){W.x2=V,W.y2=X,D();return}if(Y){let F=j[K];if(!F)return;let U=V-Y.x,C=X-Y.y;if(Y.grip==="body")z2(F,Y.start,U,C);else j2(F,Y.grip,Y.start,U,C);D();return}if(z){$.style.cursor="crosshair";return}if(f0(V,X)){$.style.cursor="pointer";return}let G=L0(V,X);if(G){let F=j[K]?B(j[K]).find((U)=>U.id===G):null;$.style.cursor=F?.cursor??"pointer";return}$.style.cursor=U0(V,X)>=0?"move":"default"}function Q0(){if(W){if(!(Math.abs(W.x2-W.x1)<n1&&Math.abs(W.y2-W.y1)<n1))j.push(W),K=j.length-1,z=null,Q();W=null}if(Y)Y=null,Q();D()}function m0(Z){let V=$.getBoundingClientRect(),X=(Z.clientX-V.left)/V.width*$.width,G=(Z.clientY-V.top)/V.height*$.height,F=U0(X,G),U=j[F];if(!U||U.tool!=="text")return;Z.preventDefault(),x0(U.x1,U.y1,F)}function g0(Z){if(K<0)return;if(Z.key==="Delete"||Z.key==="Backspace")Z.preventDefault(),I0();else if(Z.key==="Escape")K=-1,D()}function I0(){if(K<0)return;j.splice(K,1),K=-1,Q(),D()}return $.addEventListener("pointerdown",E0),$.addEventListener("pointermove",h0),$.addEventListener("pointerup",Q0),$.addEventListener("pointercancel",Q0),$.addEventListener("dblclick",m0),$.tabIndex=0,$.addEventListener("keydown",g0),D(),{setTool(Z){z=Z,K=-1,$.style.cursor=Z?"crosshair":"default",D()},deleteSelected:I0,clear(){j.length=0,K=-1,Q(),D()},hasShapes:()=>j.length>0,hasSelection:()=>K>=0,toDataUrl(){let Z=document.createElement("canvas");Z.width=J.naturalWidth,Z.height=J.naturalHeight;let V=Z.getContext("2d");if(!V)return $.toDataURL("image/png");V.drawImage(J,0,0);let X=I();for(let G of j)O(V,G,X);return Z.toDataURL("image/png")},destroy(){d(!1),$.removeEventListener("pointerdown",E0),$.removeEventListener("pointermove",h0),$.removeEventListener("pointerup",Q0),$.removeEventListener("pointercancel",Q0),$.removeEventListener("dblclick",m0),$.removeEventListener("keydown",g0)}}}var t1=`
|
|
34
34
|
:host { all: initial; }
|
|
35
35
|
* { box-sizing: border-box; }
|
|
36
36
|
|
|
@@ -68,6 +68,12 @@ textarea { min-height: 88px; resize: vertical; }
|
|
|
68
68
|
font-size: 13px; line-height: 1.7; color: #475569; word-break: break-all;
|
|
69
69
|
}
|
|
70
70
|
.meta b { color: #0f172a; font-weight: 600; }
|
|
71
|
+
.meta .check {
|
|
72
|
+
display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 0; padding-top: 8px;
|
|
73
|
+
border-top: 1px solid #e2e8f0; font-weight: 500; color: #0f172a; word-break: normal; cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
.meta .check input { margin: 5px 0 0; flex: none; accent-color: #2563eb; }
|
|
76
|
+
.meta .check .hint { display: block; font-size: 12px; line-height: 1.5; margin-top: 2px; }
|
|
71
77
|
|
|
72
78
|
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
|
73
79
|
.sep { width: 1px; align-self: stretch; background: #e2e8f0; margin: 0 4px; }
|
|
@@ -113,4 +119,4 @@ canvas { width: 100%; height: auto; display: block; border: 1px solid #e2e8f0; b
|
|
|
113
119
|
border-radius: 0 0 16px 16px;
|
|
114
120
|
}
|
|
115
121
|
.foot .grow { flex: 1; }
|
|
116
|
-
`;var
|
|
122
|
+
`;var $0="lw-debug-reporter",r4=()=>[];var s4=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function n4(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;constructor(){super();this.root=this.attachShadow({mode:"open"})}connectedCallback(){this.dataset.debugReporter="true",this.stop=Y1((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let Q=Y0(w().locale),j=await m1();if(j.method==="cancelled"){this.close();return}this.bundle=h1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:a4()}),this.renderForm(Q)}close(){this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren()}shell(J){let Q=document.createElement("style");Q.textContent=t1;let j=document.createElement("div");j.className="backdrop";let z=document.createElement("div");return z.className="panel",z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label",J.title),j.append(z),this.root.replaceChildren(Q,j),z}renderShell(J,Q){let j=this.shell(J),z=q("div","head");z.append(q("h2","",J.title)),j.append(z,q("p","status",Q))}renderForm(J){let Q=this.bundle;if(!Q)return;let j=this.shell(J),z=q("div","head"),K=v("✕","icon");K.setAttribute("aria-label",J.close),K.addEventListener("click",()=>this.close()),z.append(q("h2","",J.title),K);let W=document.createElement("input");W.type="text",W.placeholder=J.summaryPlaceholder;let Y=T0(J.summaryLabel,J.summaryRequired,!0),H=document.createElement("textarea");H.placeholder=J.detailPlaceholder;let I=q("div","meta");I.innerHTML="";let{context:k}=Q;for(let[O,A]of[[J.reporter,`${k.user.fullName??"—"} (${k.user.email??"—"})`],[J.page,k.route.href],[J.captured,`${Q.network.length} network · ${Q.console.length} console · ${Q.actionTrail.length} actions`]]){let D=document.createElement("div"),u=document.createElement("b");u.textContent=`${O}: `,D.append(u,document.createTextNode(A)),I.append(D)}let M=Q.replay?this.replayConsent(J,Q.replay.durationMs):null;if(M)I.append(M.row);let P=q("p","status",""),B=v(J.submit,"primary");if(B.disabled=!0,W.addEventListener("input",()=>{B.disabled=W.value.trim().length===0}),j.append(z,Y,W,T0(J.detailLabel),H,I),Q.screenshotDataUrl)j.append(...this.screenshotSection(J,Q.screenshotDataUrl));else j.append(q("p","status",J.noScreenshot));let N=q("div","foot"),h=v(J.close);h.addEventListener("click",()=>this.close()),N.append(h,P,q("span","grow"),B),j.append(N),B.addEventListener("click",async()=>{B.disabled=!0,P.dataset.tone="",P.textContent=J.submitting;try{let O=await i1(W.value.trim(),{...Q,note:H.value,...M&&!M.box.checked?{replay:null}:{},screenshotDataUrl:this.annotator?.hasShapes()?this.annotator.toDataUrl():Q.screenshotDataUrl}),A=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:O,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(),A)a(`${J.submitted} — #${O.number}`,"success")}catch(O){let A=O instanceof Error?O.message:J.failed;P.dataset.tone="error",P.textContent=A,a(`${J.failed} — ${A}`,"error"),B.disabled=!1}}),W.focus()}replayConsent(J,Q){let j=q("label","check"),z=document.createElement("input");z.type="checkbox",z.checked=!0;let K=q("span","",J.replayAttach.replace("{seconds}",String(Math.round(Q/1000)))),W=q("small","hint",J.replayWhat),Y=q("span","grow");return Y.append(K,W),j.append(z,Y),{row:j,box:z}}screenshotSection(J,Q){let j=T0(J.annotateHint),z=q("div","tools"),K=document.createElement("canvas"),W=q("div","shot");W.append(K);let Y=[],H=(P)=>{for(let B of Y)B.setAttribute("aria-pressed",String(B===P))};for(let{tool:P,key:B}of s4){let N=v(J[B]);N.setAttribute("aria-pressed","false"),N.addEventListener("click",()=>{let h=N.getAttribute("aria-pressed")==="true";H(h?null:N),this.annotator?.setTool(h?null:P)}),Y.push(N),z.append(N)}z.append(q("span","sep"));let I=v(J.deleteSelected);I.addEventListener("click",()=>this.annotator?.deleteSelected());let k=v(J.clearAll);k.addEventListener("click",()=>{this.annotator?.clear(),H(null)}),z.append(I,k);let M=new Image;return M.onload=()=>{K.width=M.naturalWidth,K.height=M.naturalHeight,this.annotator=a1(K,M,()=>{H(null),I.disabled=!this.annotator?.hasSelection()})},M.src=Q,[j,z,q("p","status",J.annotateHelp),W]}}}function a4(){try{return r4()}catch{return[]}}function q($,J="",Q=""){let j=document.createElement($);if(J)j.className=J;if(Q)j.textContent=Q;return j}function v($,J=""){let Q=document.createElement("button");if(Q.type="button",Q.textContent=$,J)Q.className=J;return Q}function T0($,J="",Q=!1){let j=document.createElement("label");if(j.append(document.createTextNode($)),Q){let z=document.createElement("span");z.className="req",z.textContent=" *",j.append(z)}if(J){let z=document.createElement("span");z.className="hint",z.textContent=` ${J}`,j.append(z)}return j}function e1(){if(typeof window>"u"||customElements.get($0))return;customElements.define($0,n4())}var $2=!1;function J2($={}){if($2||typeof window>"u")return;if(!j0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if($2=!0,O1(),Z1(),e0(),P1(),f1(),$.ui===!1)return;let J=Y0(w().locale);if(F1((Q)=>{a(Q.message??J.crashed,"error",{label:J.crashAction,onClick:()=>V0(Q)})}),e1(),!document.querySelector($0))document.body.append(document.createElement($0))}var Q2=document.currentScript,T=Q2?.dataset??{},t4="rrweb-record.mjs";L1(()=>import(new URL(t4,Q2?.src??location.href).href));function e4($){if(!$)return{};try{let J=JSON.parse($);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,Q])=>typeof Q==="string"&&Q.trim()))}catch{return{}}}if(T.host&&T.realmKey)p0({host:T.host,realmKey:T.realmKey,app:{name:T.appName??document.title??"app",version:T.appVersion??"0.0.0",environment:T.environment??"production"},module:u0(e4(T.modules)),locale:T.locale==="en"?"en":"th",...T.replay!==void 0?{replay:{seconds:Number(T.replay)||void 0}}:{}}),J2();window.lwReportProblem=V0;})();
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
export { configureDebugCapture, isConfigured, getConfig, appInfo } from "./config";
|
|
13
13
|
export { moduleResolver } from "./modules";
|
|
14
14
|
export type { ModuleMap } from "./modules";
|
|
15
|
-
export type { DebugCaptureConfig, CaptureOptions, RedactOptions, ToastNotice } from "./config";
|
|
15
|
+
export type { DebugCaptureConfig, CaptureOptions, RedactOptions, ReplayOptions, ToastNotice } from "./config";
|
|
16
16
|
export { installDebugCapture } from "./install";
|
|
17
17
|
export type { InstallOptions } from "./install";
|
|
18
18
|
export { launch, onLaunch, onCrash, emitCrash } from "./reporter";
|
|
@@ -25,6 +25,8 @@ export { captureScreen } from "./screenshot";
|
|
|
25
25
|
export { getNetworkLog } from "./capture/networkBuffer";
|
|
26
26
|
export { getConsoleLog } from "./capture/consoleBuffer";
|
|
27
27
|
export { getActionTrail, actionCountSuffix } from "./capture/actionTrail";
|
|
28
|
+
export { takeReplay, isReplayRecording, stopReplay } from "./capture/replay";
|
|
29
|
+
export { packReplay, REPLAY_FILENAME } from "./replayPack";
|
|
28
30
|
export { correlateActionTrail, isQuietStep, isFailedRequest, requestPath, formatDuration } from "./capture/stepCorrelation";
|
|
29
31
|
export type { StepActivity } from "./capture/stepCorrelation";
|
|
30
32
|
export { redactBody, redactHeaders, redactLabel, redactUrl, REDACTED } from "./capture/redact";
|