@lightworkai.official/debug-capture 0.14.3 → 0.16.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 +55 -0
- package/dist/config.d.ts +24 -0
- package/dist/debug-capture.js +121 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +53 -12
- package/dist/live.d.ts +19 -0
- package/dist/portal.d.ts +5 -0
- package/dist/ui/callFrame.d.ts +63 -0
- package/dist/ui/ring.d.ts +25 -0
- package/dist/ui/strings.d.ts +10 -0
- package/package.json +1 -1
- package/src/config.ts +26 -0
- package/src/index.ts +2 -0
- package/src/install.ts +9 -0
- package/src/live.ts +291 -0
- package/src/portal.ts +3 -0
- package/src/ui/callFrame.ts +240 -0
- package/src/ui/ring.ts +258 -0
- package/src/ui/strings.ts +28 -0
package/README.md
CHANGED
|
@@ -194,6 +194,11 @@ knowing before you ship:
|
|
|
194
194
|
secret the defaults do not know about.
|
|
195
195
|
- **`module(pathname)`** — becomes the ticket's category. Defaults to the first
|
|
196
196
|
path segment.
|
|
197
|
+
- **`ring`** — a call from the support team rings in your app (see below).
|
|
198
|
+
Default `true`; `false` leaves calls to the support host.
|
|
199
|
+
- **`callFrame`** — the call itself happens in your app, in the support host's
|
|
200
|
+
own call UI (0.16, see below). Default `true`; `false` keeps 0.15's card that
|
|
201
|
+
opens the portal to answer.
|
|
197
202
|
|
|
198
203
|
## The other half: letting people track what they reported
|
|
199
204
|
|
|
@@ -339,6 +344,56 @@ thrown for you to handle.
|
|
|
339
344
|
|
|
340
345
|
`supportPortalUrl(host, realmKey, token, returnTo?)` is pure and safe to call on a server.
|
|
341
346
|
|
|
347
|
+
### A call from the support team rings here (0.15)
|
|
348
|
+
|
|
349
|
+
The support team can call a reporter from their ticket — voice, and their screen
|
|
350
|
+
if they choose to share it. The call happens on the support host; what this
|
|
351
|
+
package adds is the **ring, in your app**: with `identity` configured and calls
|
|
352
|
+
switched on for the desk, the widget holds the person's own live connection to
|
|
353
|
+
the support host (the one their portal tab holds, proven with the same signed
|
|
354
|
+
token, told about their own tickets and calls and nothing else). A call then
|
|
355
|
+
shows as a card — *ทีมงานกำลังโทรหาคุณ · เรื่อง ACME-12* — with **ไม่รับ** and
|
|
356
|
+
**เปิดเพื่อรับสาย**, a soft ring and the tab's title. Opening it takes them to
|
|
357
|
+
that ticket on the support host, signed in, where they answer.
|
|
358
|
+
|
|
359
|
+
Nothing to wire: it starts with `installDebugCapture()`, once the page has
|
|
360
|
+
settled. It stays silent — no connection, no card, no console noise — without
|
|
361
|
+
`identity`, with calls off for the desk, against a support host older than 0.15,
|
|
362
|
+
or when the token is refused. To leave calls to the support host and its
|
|
363
|
+
invitation instead:
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
configureDebugCapture({ /* … */, ring: false });
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
A host that renders its own UI (`installDebugCapture({ ui: false })`) can start
|
|
370
|
+
and stop it itself with `startLiveRing()` / `stopLiveRing()`.
|
|
371
|
+
|
|
372
|
+
### …and the call happens here too (0.16)
|
|
373
|
+
|
|
374
|
+
Answering no longer leaves your app. When a call rings, the support host's own
|
|
375
|
+
call — the same ring card, call corner, screen-sharing question and voice
|
|
376
|
+
settings its portal shows — opens in a frame in your page, signed in with the
|
|
377
|
+
token your `identity` already provides. The person answers, talks, shows their
|
|
378
|
+
screen (Chrome and Edge share "this tab" in one press) and changes their
|
|
379
|
+
microphone without a new tab; the corner can be dragged anywhere and goes when
|
|
380
|
+
the call ends. While the frame comes up the 0.15 card is there, and if the frame
|
|
381
|
+
cannot come up it stays: **เปิดเพื่อรับสาย** still answers on the portal.
|
|
382
|
+
|
|
383
|
+
What your app must allow — usually nothing, because most apps set none of these:
|
|
384
|
+
|
|
385
|
+
- **Framing the support host**: no `frame-src` / `child-src` in your
|
|
386
|
+
Content-Security-Policy that leaves out the support host's origin.
|
|
387
|
+
- **The microphone, camera and screen in a frame**: no `Permissions-Policy` that
|
|
388
|
+
forbids `microphone`, `camera` or `display-capture` to the support host (the
|
|
389
|
+
frame asks for them with `allow=`; your page's own policy has the last word).
|
|
390
|
+
|
|
391
|
+
To keep 0.15's way — the card, and the portal to answer:
|
|
392
|
+
|
|
393
|
+
```ts
|
|
394
|
+
configureDebugCapture({ /* … */, callFrame: false });
|
|
395
|
+
```
|
|
396
|
+
|
|
342
397
|
|
|
343
398
|
## Installing
|
|
344
399
|
|
package/dist/config.d.ts
CHANGED
|
@@ -139,6 +139,30 @@ export interface DebugCaptureConfig {
|
|
|
139
139
|
screenshotFallback?: () => Promise<ToPng | null>;
|
|
140
140
|
/** UI language. Only affects the built-in reporter's own strings. */
|
|
141
141
|
locale?: "th" | "en";
|
|
142
|
+
/**
|
|
143
|
+
* The ring for a call from the support team. Default true.
|
|
144
|
+
*
|
|
145
|
+
* With `identity` set and calls switched on for the desk, the reporter's own
|
|
146
|
+
* live connection to the support host is held here — the one their portal
|
|
147
|
+
* tab holds, proven with the same signed token — so a call from the team
|
|
148
|
+
* rings in this app, as a card, and opens the reporter's request on the
|
|
149
|
+
* support host to answer it (the call itself happens there). `false` leaves
|
|
150
|
+
* calls to the support host and the invitation the team sends.
|
|
151
|
+
*/
|
|
152
|
+
ring?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* The call itself, in this app. Default true (0.16).
|
|
155
|
+
*
|
|
156
|
+
* When a call rings, the support host's own call — its ring card, its call
|
|
157
|
+
* corner, its screen-sharing question, its voice settings — opens in a frame
|
|
158
|
+
* in this page, signed in with the same token the portal button uses: the
|
|
159
|
+
* reporter answers, talks and shows their screen without leaving the app.
|
|
160
|
+
* The frame needs nothing of the host but leave to frame the support host and
|
|
161
|
+
* to give it the microphone, camera and screen (no `frame-src` or
|
|
162
|
+
* `Permissions-Policy` that forbids them). Should the frame not come up, the
|
|
163
|
+
* card of 0.15 carries the call: open the portal to answer. `false`: always that.
|
|
164
|
+
*/
|
|
165
|
+
callFrame?: boolean;
|
|
142
166
|
/**
|
|
143
167
|
* Where this library's own notifications go.
|
|
144
168
|
*
|
package/dist/debug-capture.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var b2=(($)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy($,{get:(z,J)=>(typeof require<"u"?require:z)[J]}):$)(function($){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var p2={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},m=null;function X1($){let z=[];if(!$.host?.trim())z.push("host");if(!$.realmKey?.trim())z.push("realmKey");if(!$.app?.name?.trim())z.push("app.name");if(typeof $.module!=="function")z.push("module");if(z.length)throw Error(`[debug-capture] configureDebugCapture is missing: ${z.join(", ")}. `+"See the README — `module` maps a pathname to the part of your app it belongs to.");m=$}function f(){if(!m)throw Error("[debug-capture] configureDebugCapture() has not been called");return m}function f0(){return m!==null}function o(){let $=f().app;return{name:$.name,version:$.version??"0.0.0",environment:$.environment??y2()}}function y2(){if(typeof window>"u")return"unknown";let $=window.location.hostname;if($==="localhost"||$==="127.0.0.1"||$.endsWith(".local"))return"development";return"production"}function t($){let z=m?.capture?.[$];return typeof z==="number"?z:p2[$]}function _0($){let z=m?.module;if(!z)return null;try{return z($)??null}catch{return null}}function S0(){let $=m?.redact;return{headers:$?.headers??[],queryKeys:($?.queryKeys??[]).map((z)=>z.toLowerCase()),bodyKeys:($?.bodyKeys??[]).map((z)=>z.toLowerCase())}}function F1(){return m?.capture?.overlaySelectors??[]}var v2='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',u2="[data-lw-mask]",V1={fps:1,quality:0.5};function w0(){let $=m?.replay;if(!$)return null;let z=$===!0?{}:$,J=(Z,Y)=>typeof Z==="number"&&Z>0?Z:Y,j=z.maskInputs!==!1,Q=z.recordCanvas?{fps:J(typeof z.recordCanvas==="object"?z.recordCanvas.fps:void 0,V1.fps),quality:J(typeof z.recordCanvas==="object"?z.recordCanvas.quality:void 0,V1.quality)}:null;return{seconds:J(z.seconds,60),maskInputs:j,maskTextSelector:z.maskTextSelector?.trim()||(j?v2:u2),maskText:z.maskText===!0,blockSelector:z.blockSelector?.trim()||"[data-lw-private]",maxBytes:J(z.maxBytes,4000000),canvas:Q}}function H1($){if(typeof window>"u")return!1;let z;try{z=new URL($,window.location.href)}catch{return!1}if(i2(z))return!1;if(z.origin===window.location.origin)return!0;return(m?.capture?.bodyOrigins??[]).some((J)=>{try{return new URL(J).origin===z.origin}catch{return!1}})}function i2($){if(!m?.host)return!1;try{if(new URL(m.host).origin!==$.origin)return!1}catch{return!1}return $.pathname.startsWith("/ingest/")}function w1($){let z=Object.entries($).map(([J,j])=>[J.replace(/\/+$/,"")||"/",j]).sort((J,j)=>j[0].length-J[0].length);return(J)=>{let j=(J||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of z)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var P0="‹redacted›",d2=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,c2=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),o2=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,l2=/[\w.+-]+@[\w-]+\.[\w.-]+/g,n2=/\d(?:[\d\s-]{7,})\d/g;function U0($){return $.replace(l2,P0).replace(n2,P0)}function r2($){if(d2.test($))return!0;return S0().headers.some((J)=>J.toLowerCase()===$.toLowerCase())}function I0($){let z={};for(let[J,j]of Object.entries($))z[J]=r2(J)?P0:j;return z}function e($){try{let z=/^https?:\/\//i.test($),J=new URL($,z?void 0:"http://local.invalid"),j=!1;if(J.searchParams.forEach((Q,Z)=>{if(c2.has(Z.toLowerCase())||S0().queryKeys.includes(Z.toLowerCase()))J.searchParams.set(Z,P0),j=!0}),!j)return $;return z?J.toString():`${J.pathname}${J.search}`}catch{return $}}function c0($,z){if(z>6||$===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((j)=>c0(j,z+1));let J={};for(let[j,Q]of Object.entries($)){let Z=o2.test(j)||S0().bodyKeys.some((Y)=>j.toLowerCase().includes(Y));J[j]=Z?P0:c0(Q,z+1)}return J}function M0($,z){if($==null)return null;let J=$,j=$.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);J=JSON.stringify(c0(Q,0))}catch{}if(J.length>z)return`${J.slice(0,z)}… [truncated ${J.length-z} chars]`;return J}var o0=120,l0=40,V0=($,z)=>$.length>z?`${$.slice(0,z)}…`:$,n0=($)=>{try{return decodeURIComponent($)}catch{return $}},G0=[],P1=0,U1=!1;function q0($,z,J,j){let Q=V0(z,o0),Z=G0[G0.length-1];if($==="navigate"&&Z?.kind==="click"){let X=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${X}`))return Z.at=new Date().toISOString(),Z;let H=X.split(/[?#]/)[0]??X,U=Z.source?n0(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(U&&(H===U||H.startsWith(U)))return Z.detail=V0(`${Z.detail} → ${X}`,o0),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===$&&Z.detail===Q){if(Z.at=new Date().toISOString(),$!=="navigate")Z.count=(Z.count??1)+1;return Z}P1+=1;let Y={id:`act_${P1}`,at:new Date().toISOString(),kind:$,detail:Q,count:1,source:J,html:T0(j)};G0.push(Y);while(G0.length>t("maxActions"))a2(G0.shift());return Y}var s2=200000,D0=0;function T0($){if(!$)return;if(D0+$.length>s2)return;return D0+=$.length,$}function a2($){if(!$)return;if(D0-=($.html?.length??0)+($.afterHtml?.length??0),D0<0)D0=0}function R0($){return $ instanceof Element&&Boolean($.closest("[data-debug-reporter]"))}var t2='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',e2={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},I1={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function $4($){let z=$.getAttribute("role");if(z&&I1[z])return I1[z];return e2[$.tagName.toLowerCase()]??"ปุ่ม"}function z4($,z){try{let J=$,j=0;while(J&&j<=z){let Q=x1(J);if(Q&&typeof Q.memoizedProps?.onClick==="function")return J;J=J.parentElement,j+=1}}catch{}return null}function J4($){let z=$.getAttribute("aria-label")?.trim();if(z)return z;let J=$.getAttribute("title")?.trim();if(J)return J;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 Q=$.getAttribute("href");if(Q?.startsWith("/"))return n0(Q)}return""}function j4($){if(!($ instanceof Element))return null;let z=$.closest(t2)??z4($,4);if(!z)return null;let J=z.tagName.toLowerCase();if(J==="html"||J==="body")return null;return z}function Q4($){let z=U0(J4($));if(!z)return null;return`${$4($)} “${V0(z,l0)}”`}var N1=6000,Z4=4000,K4=/(?:^|\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 Y4($){$.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let z=[$,...Array.from($.querySelectorAll("*"))];for(let Q of z){for(let Y of Array.from(Q.attributes)){let X=Y.name.toLowerCase();if(X.startsWith("on")||X==="srcdoc"||X==="value"||X.startsWith("data-"))Q.removeAttribute(Y.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let Y=Z.replace(K4," ").replace(/\s+/g," ").trim();if(Y)Q.setAttribute("class",Y);else Q.removeAttribute("class")}}let J=document.createTreeWalker($,NodeFilter.SHOW_TEXT),j=J.nextNode();while(j){if(j.nodeValue)j.nodeValue=U0(j.nodeValue);j=J.nextNode()}}function r0($,z,J){try{let j=$.outerHTML;if(!j||j.length>z)return;let Q=$.cloneNode(!0);Y4(Q);let Z=Q.outerHTML;return Z&&Z.length<=J?Z:void 0}catch{return}}var W4=($)=>r0($,N1,Z4),G4=150000,V4=40000,M1=($)=>r0($,G4,V4);function X4($){if(!($ instanceof HTMLInputElement)&&!($ instanceof HTMLTextAreaElement)&&!($ instanceof HTMLSelectElement))return null;let z=$.name||$.id||$.getAttribute("aria-label")||$.getAttribute("placeholder")||$.tagName.toLowerCase();return`ช่อง “${U0(z)}”`}var q1=80;function x1($){let z=Object.keys($).find((J)=>J.startsWith("__reactFiber$")||J.startsWith("__reactInternalInstance$"));return z?$[z]:null}function F4($){if(typeof $!=="function")return null;try{let z=Function.prototype.toString.call($);return(z.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??z.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function D1($){if(!$)return;return`→ ${$.length>q1?`${$.slice(0,q1)}…`:$}`}function H4($){try{let z=$.closest("a[href]")?.getAttribute("href");if(z&&z.startsWith("/"))return D1(z);let J=x1($),j=0;while(J&&j<30){if(typeof J.memoizedProps?.onClick==="function")return D1(F4(J.memoizedProps.onClick));J=J.return,j+=1}return}catch{return}}var w4='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function P4(){let $=F1();return $.length?$.join(", "):w4}function U4($){let z=$.getAttribute("role");if(z==="status"||z==="alert")return"ข้อความแจ้งเตือน";if(z==="menu")return"เมนู";if(z==="listbox")return"รายการตัวเลือก";if(z==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function I4($){let z=$.getAttribute("aria-label")?.trim();if(z)return z;let J=$.getAttribute("aria-labelledby");if(J){let Z=J.split(/\s+/).map((Y)=>document.getElementById(Y)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=$.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return($.textContent??"").replace(/\s+/g," ").trim()}function k1($){let z=U0(I4($)),J=U4($);return z?`เปิด ${J} “${V0(z,l0)}”`:`เปิด ${J}`}var M4='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',q4=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function D4($){if($.querySelector(M4))return!0;return q4.test($.textContent??"")}var B4=400,N4=250,x4=8000;function k4($,z){if(typeof MutationObserver>"u"){z.html=T0(M1($));return}let J=Date.now(),j=!1,Q=()=>{j=!0,Y.disconnect(),window.clearInterval(X),window.clearTimeout(H)},Z=()=>{if(j)return;if(Q(),!$.isConnected)return;z.detail=V0(k1($),o0),z.html=T0(M1($))},Y=new MutationObserver(()=>{J=Date.now()});Y.observe($,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let X=window.setInterval(()=>{if(j)return;if(!$.isConnected){Q();return}if(Date.now()-J>=B4&&!D4($))Z()},N4),H=window.setTimeout(Z,x4)}function C4($){if(R0($))return;let z=q0("ui",k1($));if(z)k4($,z)}function O4(){if(typeof MutationObserver>"u")return;let $=new WeakSet;new MutationObserver((J)=>{for(let j of J)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=P4(),Y=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let X of Y){if($.has(X))continue;$.add(X),C4(X)}}}).observe(document.body,{childList:!0,subtree:!0})}var f4=1600,_4=2500;function B1($){return{disabled:$.hasAttribute("disabled")||$.getAttribute("aria-disabled")==="true",busy:$.getAttribute("aria-busy")==="true",text:V0(($.textContent??"").replace(/\s+/g," ").trim(),l0)}}function S4($,z){if(!$.disabled&&z.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!$.busy&&z.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if($.text!==z.text&&z.text)return`ข้อความเปลี่ยนเป็น “${z.text}”`;return null}function R4($,z){if(typeof MutationObserver>"u")return;let J=B1($),j=!1,Q=(X,H)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(Y),z.afterNote=X,H)z.afterHtml=T0(r0($,N1,_4))},Z=new MutationObserver(()=>{if(!$.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let X=S4(J,B1($));if(X)Q(X,!0)});Z.observe($,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let Y=window.setTimeout(()=>{if(!j&&!$.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},f4)}function C1(){if(U1||typeof window>"u")return;U1=!0,document.addEventListener("click",(j)=>{if(R0(j.target))return;let Q=j4(j.target);if(!Q)return;let Z=Q4(Q);if(!Z)return;let Y=q0("click",`คลิก ${Z}`,H4(Q),W4(Q));if(Y)R4(Q,Y)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(R0(j.target))return;let Q=X4(j.target);if(Q)q0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(R0(j.target))return;q0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let $=()=>q0("navigate",`ไปที่ ${n0(e(location.pathname+location.search))}`),z=history.pushState.bind(history),J=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=z(...j);return $(),Q},history.replaceState=(...j)=>{let Q=J(...j);return $(),Q},window.addEventListener("popstate",$),O4()}function O1(){return G0.map(($)=>({...$}))}var f1=2000,h0=[],_1=0,S1=!1;function s0($,z){_1+=1,h0.push({id:`log_${_1}`,at:new Date().toISOString(),level:$,message:z.length>f1?`${z.slice(0,f1)}…`:z});while(h0.length>t("maxConsoleEntries"))h0.shift()}function T4(){let $=new WeakSet;return(z,J)=>{if(typeof J==="object"&&J!==null){if($.has(J))return"[Circular]";$.add(J)}if(typeof J==="bigint")return J.toString();return J}}function R1($){if(typeof $==="string")return $;if($ instanceof Error)return`${$.name}: ${$.message}`;try{let z=JSON.stringify($,T4());if(z!==void 0)return z}catch{}try{return String($)}catch{}try{return Object.prototype.toString.call($)}catch{return`[${typeof $}]`}}function T1(){if(S1||typeof window>"u")return;S1=!0;let $=["log","info","warn","error","debug"];for(let z of $){let J=console[z].bind(console);console[z]=(...j)=>{s0(z,j.map(R1).join(" ")),J(...j)}}window.addEventListener("error",(z)=>{let J=z.filename?` (${z.filename}:${z.lineno}:${z.colno})`:"";s0("exception",`${z.message}${J}`)}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason instanceof Error?`${z.reason.name}: ${z.reason.message}`:R1(z.reason);s0("unhandledrejection",J)})}function h1(){return h0.map(($)=>({...$}))}var A1=new Set,L1=new Set;function E1($,z){return $.add(z),()=>$.delete(z)}function m1($,z){for(let J of[...$])J(z)}function g1($){return E1(A1,$)}function A0($={type:"manual"}){m1(A1,$)}function b1($){return E1(L1,$)}function p1($){m1(L1,$)}var h4=15000,A4=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],y1=!1,v1=0;function L4($){return A4.some((z)=>$.includes(z))}function u1($){let z=$.message??"";if(!z||L4(z))return;let J=Date.now();if(J-v1<h4)return;v1=J,p1({...$,message:z})}function i1(){if(y1||typeof window>"u")return;y1=!0,window.addEventListener("error",($)=>{if(!$.message&&!$.error)return;let z=$.error instanceof Error?$.error:null;u1({type:"runtime-error",message:$.message||(z?z.message:"Unknown error"),stack:z?.stack})}),window.addEventListener("unhandledrejection",($)=>{let z=$.reason;u1({type:"unhandledrejection",message:z instanceof Error?z.message:String(z),stack:z instanceof Error?z.stack:void 0})})}var l1=4000,E4=1e6,m4=1e7,L0=[],d1=0,c1=!1;function n1($){L0.push($);while(L0.length>t("maxRequests"))L0.shift()}function r1(){return d1+=1,`req_${d1}`}function o1($){let z={};if(!$)return z;if($ instanceof Headers)$.forEach((J,j)=>{z[j]=J});else if(Array.isArray($))for(let[J,j]of $)z[J]=j;else Object.assign(z,$);return z}function g4($){let z={};return $.forEach((J,j)=>{z[j]=J}),z}function b4($){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 p4($,z){let J="",j="GET",Q={},Z=null;if(typeof $==="string")J=$;else if($ instanceof URL)J=$.toString();else J=$.url,j=$.method||j,Q=o1($.headers);if(z){if(z.method)j=z.method;if(z.headers)Q={...Q,...o1(z.headers)};if(z.body!==void 0)Z=b4(z.body)}return{method:j.toUpperCase(),url:J,headers:Q,body:Z}}function s1($){return!H1($)}function y4($,z){if(s1(z.url)){z.responseSnippet="[body not captured for this origin]";return}let J=$.headers.get("content-type")??"",j=Number($.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test(J)){z.responseSnippet=`[binary ${J||"unknown"}${Q}]`;return}if(j>E4){z.responseSnippet=`[response ${J||"text"}${Q} — omitted]`;return}try{$.clone().text().then((Z)=>{z.responseSnippet=M0(Z,t("maxBodyChars"))}).catch(()=>{})}catch{}}function a1($,z){if(/[?&]_rsc=/.test($))return!0;for(let J of Object.keys(z)){let j=J.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function v4(){if(typeof window>"u"||typeof window.fetch!=="function")return;let $=window.fetch.bind(window);window.fetch=Object.assign(async(z,J)=>{let j=p4(z,J);if(a1(j.url,j.headers))return $(z,J);let Q={id:r1(),startedAt:new Date().toISOString(),method:j.method,url:e(j.url),requestHeaders:I0(j.headers),requestBody:M0(j.body,l1),status:null,statusText:null,durationMs:null,via:"fetch"};n1(Q);let Z=performance.now();try{let Y=await $(z,J);return Q.status=Y.status,Q.statusText=Y.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=I0(g4(Y.headers)),y4(Y,Q),Y}catch(Y){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=Y instanceof Error?`${Y.name}: ${Y.message}`:String(Y),Y}},$)}function u4(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let $=XMLHttpRequest.prototype,z=$.open,J=$.send,j=function(Z,Y){let X=typeof Y==="string"?Y:Y.toString();return this.__lwEntry=a1(X,{})?void 0:{id:r1(),startedAt:"",method:(Z||"GET").toUpperCase(),url:e(X),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},z.apply(this,arguments)},Q=function(Z){let Y=this.__lwEntry;if(Y){Y.startedAt=new Date().toISOString(),Y.requestBody=typeof Z==="string"?M0(Z,l1):Z==null?null:"[non-string body]";let X=performance.now();n1(Y),this.addEventListener("loadend",()=>{if(Y.status=this.status||null,Y.statusText=this.statusText||null,Y.durationMs=Math.round(performance.now()-X),s1(Y.url))Y.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{Y.responseSnippet=M0(this.responseText||"",t("maxBodyChars"))}catch{}else{let H=this.getResponseHeader("content-type")??this.responseType;Y.responseSnippet=`[binary ${H}]`}})}return J.apply(this,arguments)};$.open=j,$.send=Q}function t1(){if(c1)return;c1=!0,v4(),u4()}function e1(){let $=L0.map((J)=>({...J})),z=0;for(let J=$.length-1;J>=0;J-=1){let j=$[J],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(z+Q.length>m4)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else z+=Q.length}return $}var i4=4,$2=3,d4=4000,c4="[data-debug-reporter]",z2=()=>import("@rrweb/record");function J2($){z2=$}var g=[],a0=null,E0=!1;function j2(){if(typeof window>"u"||a0||E0)return;let $=w0();if(!$)return;E0=!0;let z=()=>void o4($);if("requestIdleCallback"in window)window.requestIdleCallback(z,{timeout:3000});else setTimeout(z,1000)}async function o4($){let z;try{z=(await z2()).record}catch(J){E0=!1,console.warn("[debug-capture] session replay could not start:",J);return}if(a0)return;try{a0=z({emit:(J)=>l4(J),checkoutEveryNms:Math.max(1000,$.seconds*1000/2),checkoutEveryNth:d4,maskAllInputs:$.maskInputs,maskTextSelector:$.maskText?"*":$.maskTextSelector,blockSelector:`${$.blockSelector}, ${c4}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...$.canvas?{canvas:$.canvas.fps}:{}},recordCanvas:$.canvas!==null,...$.canvas?{dataURLOptions:{type:"image/webp",quality:$.canvas.quality}}:{},errorHandler:()=>!0})??null}catch(J){console.warn("[debug-capture] session replay could not start:",J)}finally{E0=!1}}function l4($){if($.type===i4||g.length===0){if(g.push([]),g.length>$2)g=g.slice(-$2)}g[g.length-1].push($)}function Q2($=Date.now()){let z=w0();if(!z||!g.length)return null;let J=$-z.seconds*1000,j=g.length-1;while(j>0&&(g[j][0]?.timestamp??$)>J)j-=1;let Q=g.slice(j).flat(),Z=Q[0]?.timestamp,Y=Q[Q.length-1]?.timestamp;if(Z===void 0||Y===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(Y).toISOString(),durationMs:Math.max(0,Y-Z)}}var n4={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:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง"},r4={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",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",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",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours"};function m0($){return $==="en"?r4:n4}var s4="lw-debug-toasts",a4=6000,t4=`
|
|
1
|
+
(()=>{var d4=((z)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(z,{get:(J,$)=>(typeof require<"u"?require:J)[$]}):z)(function(z){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+z+'" is not supported')});var i4={maxRequests:60,maxConsoleEntries:120,maxActions:80,maxBodyChars:20000},g=null;function s1(z){let J=[];if(!z.host?.trim())J.push("host");if(!z.realmKey?.trim())J.push("realmKey");if(!z.app?.name?.trim())J.push("app.name");if(typeof z.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.");g=z}function I(){if(!g)throw Error("[debug-capture] configureDebugCapture() has not been called");return g}function c0(){return g!==null}function n(){let z=I().app;return{name:z.name,version:z.version??"0.0.0",environment:z.environment??c4()}}function c4(){if(typeof window>"u")return"unknown";let z=window.location.hostname;if(z==="localhost"||z==="127.0.0.1"||z.endsWith(".local"))return"development";return"production"}function z0(z){let J=g?.capture?.[z];return typeof J==="number"?J:i4[z]}function l0(z){let J=g?.module;if(!J)return null;try{return J(z)??null}catch{return null}}function o0(){let z=g?.redact;return{headers:z?.headers??[],queryKeys:(z?.queryKeys??[]).map((J)=>J.toLowerCase()),bodyKeys:(z?.bodyKeys??[]).map((J)=>J.toLowerCase())}}function a1(){return g?.capture?.overlaySelectors??[]}var l4='[contenteditable]:not([contenteditable="false"]), [data-lw-mask]',o4="[data-lw-mask]",r1={fps:1,quality:0.5};function _0(){let z=g?.replay;if(!z)return null;let J=z===!0?{}:z,$=(Z,W)=>typeof Z==="number"&&Z>0?Z:W,j=J.maskInputs!==!1,Q=J.recordCanvas?{fps:$(typeof J.recordCanvas==="object"?J.recordCanvas.fps:void 0,r1.fps),quality:$(typeof J.recordCanvas==="object"?J.recordCanvas.quality:void 0,r1.quality)}:null;return{seconds:$(J.seconds,60),maskInputs:j,maskTextSelector:J.maskTextSelector?.trim()||(j?l4:o4),maskText:J.maskText===!0,blockSelector:J.blockSelector?.trim()||"[data-lw-private]",maxBytes:$(J.maxBytes,4000000),canvas:Q}}function t1(z){if(typeof window>"u")return!1;let J;try{J=new URL(z,window.location.href)}catch{return!1}if(n4(J))return!1;if(J.origin===window.location.origin)return!0;return(g?.capture?.bodyOrigins??[]).some(($)=>{try{return new URL($).origin===J.origin}catch{return!1}})}function n4(z){if(!g?.host)return!1;try{if(new URL(g.host).origin!==z.origin)return!1}catch{return!1}return z.pathname.startsWith("/ingest/")}function e1(z){let J=Object.entries(z).map(([$,j])=>[$.replace(/\/+$/,"")||"/",j]).sort(($,j)=>j[0].length-$[0].length);return($)=>{let j=($||"/").replace(/\/+$/,"")||"/";for(let[Q,Z]of J)if(j===Q||j.startsWith(`${Q}/`))return{key:Q,label:Z};return null}}var S0="‹redacted›",r4=/^(authorization|proxy-authorization|cookie|set-cookie|x-[a-z-]*token|x-csrf[a-z-]*|x-xsrf[a-z-]*)$/i,s4=new Set(["access_token","token","id_token","refresh_token","code","secret","client_secret","password","apikey","api_key","signature","x-amz-signature","x-amz-credential"]),a4=/(password|passwd|token|secret|authorization|refresh|client_secret|otp|pin)/i,t4=/[\w.+-]+@[\w-]+\.[\w.-]+/g,e4=/\d(?:[\d\s-]{7,})\d/g;function R0(z){return z.replace(t4,S0).replace(e4,S0)}function z6(z){if(r4.test(z))return!0;return o0().headers.some(($)=>$.toLowerCase()===z.toLowerCase())}function L0(z){let J={};for(let[$,j]of Object.entries(z))J[$]=z6($)?S0:j;return J}function J0(z){try{let J=/^https?:\/\//i.test(z),$=new URL(z,J?void 0:"http://local.invalid"),j=!1;if($.searchParams.forEach((Q,Z)=>{if(s4.has(Z.toLowerCase())||o0().queryKeys.includes(Z.toLowerCase()))$.searchParams.set(Z,S0),j=!0}),!j)return z;return J?$.toString():`${$.pathname}${$.search}`}catch{return z}}function U1(z,J){if(J>6||z===null||typeof z!=="object")return z;if(Array.isArray(z))return z.map((j)=>U1(j,J+1));let $={};for(let[j,Q]of Object.entries(z)){let Z=a4.test(j)||o0().bodyKeys.some((W)=>j.toLowerCase().includes(W));$[j]=Z?S0:U1(Q,J+1)}return $}function A0(z,J){if(z==null)return null;let $=z,j=z.trim();if(j.startsWith("{")||j.startsWith("["))try{let Q=JSON.parse(j);$=JSON.stringify(U1(Q,0))}catch{}if($.length>J)return`${$.slice(0,J)}… [truncated ${$.length-J} chars]`;return $}var F1=120,M1=40,D0=(z,J)=>z.length>J?`${z.slice(0,J)}…`:z,q1=(z)=>{try{return decodeURIComponent(z)}catch{return z}},q0=[],z2=0,J2=!1;function k0(z,J,$,j){let Q=D0(J,F1),Z=q0[q0.length-1];if(z==="navigate"&&Z?.kind==="click"){let G=Q.replace(/^ไปที่\s*/,"");if(Z.detail.includes(`→ ${G}`))return Z.at=new Date().toISOString(),Z;let P=G.split(/[?#]/)[0]??G,F=Z.source?q1(Z.source.replace(/^→\s*/,"")).split(/[?#]/)[0]:null;if(F&&(P===F||P.startsWith(F)))return Z.detail=D0(`${Z.detail} → ${G}`,F1),Z.source=void 0,Z.at=new Date().toISOString(),Z}if(Z&&Z.kind===z&&Z.detail===Q){if(Z.at=new Date().toISOString(),z!=="navigate")Z.count=(Z.count??1)+1;return Z}z2+=1;let W={id:`act_${z2}`,at:new Date().toISOString(),kind:z,detail:Q,count:1,source:$,html:r0(j)};q0.push(W);while(q0.length>z0("maxActions"))$6(q0.shift());return W}var J6=200000,T0=0;function r0(z){if(!z)return;if(T0+z.length>J6)return;return T0+=z.length,z}function $6(z){if(!z)return;if(T0-=(z.html?.length??0)+(z.afterHtml?.length??0),T0<0)T0=0}function n0(z){return z instanceof Element&&Boolean(z.closest("[data-debug-reporter]"))}var j6='button, a[href], [role="button"], [role="tab"], [role="menuitem"], [role="option"], [role="switch"], [role="checkbox"], [role="radio"], [role="link"], summary, input, select, textarea',Q6={button:"ปุ่ม",a:"ลิงก์",input:"ช่อง",textarea:"ช่อง",select:"ตัวเลือก",summary:"ส่วนขยาย"},$2={button:"ปุ่ม",tab:"แท็บ",menuitem:"เมนู",option:"ตัวเลือก",switch:"สวิตช์",checkbox:"ช่องเลือก",radio:"ตัวเลือก",link:"ลิงก์"};function Z6(z){let J=z.getAttribute("role");if(J&&$2[J])return $2[J];return Q6[z.tagName.toLowerCase()]??"ปุ่ม"}function V6(z,J){try{let $=z,j=0;while($&&j<=J){let Q=X2($);if(Q&&typeof Q.memoizedProps?.onClick==="function")return $;$=$.parentElement,j+=1}}catch{}return null}function W6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("title")?.trim();if($)return $;if(z instanceof HTMLInputElement||z instanceof HTMLTextAreaElement||z instanceof HTMLSelectElement)return(z.getAttribute("placeholder")||z.getAttribute("name")||"").trim();if(z instanceof HTMLImageElement)return(z.getAttribute("alt")||"").trim();let j=(z.textContent??"").replace(/\s+/g," ").trim();if(j)return j;if(z instanceof HTMLAnchorElement){let Q=z.getAttribute("href");if(Q?.startsWith("/"))return q1(Q)}return""}function X6(z){if(!(z instanceof Element))return null;let J=z.closest(j6)??V6(z,4);if(!J)return null;let $=J.tagName.toLowerCase();if($==="html"||$==="body")return null;return J}function K6(z){let J=R0(W6(z));if(!J)return null;return`${Z6(z)} “${D0(J,M1)}”`}var W2=6000,G6=4000,Y6=/(?:^|\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 H6(z){z.querySelectorAll("script, style, link, iframe, object, embed, noscript, canvas, video, audio").forEach((Q)=>Q.remove());let J=[z,...Array.from(z.querySelectorAll("*"))];for(let Q of J){for(let W of Array.from(Q.attributes)){let G=W.name.toLowerCase();if(G.startsWith("on")||G==="srcdoc"||G==="value"||G.startsWith("data-"))Q.removeAttribute(W.name)}if(Q instanceof HTMLAnchorElement)Q.setAttribute("href","#");if(Q instanceof HTMLImageElement)Q.removeAttribute("src");let Z=Q.getAttribute("class");if(Z){let W=Z.replace(Y6," ").replace(/\s+/g," ").trim();if(W)Q.setAttribute("class",W);else Q.removeAttribute("class")}}let $=document.createTreeWalker(z,NodeFilter.SHOW_TEXT),j=$.nextNode();while(j){if(j.nodeValue)j.nodeValue=R0(j.nodeValue);j=$.nextNode()}}function D1(z,J,$){try{let j=z.outerHTML;if(!j||j.length>J)return;let Q=z.cloneNode(!0);H6(Q);let Z=Q.outerHTML;return Z&&Z.length<=$?Z:void 0}catch{return}}var P6=(z)=>D1(z,W2,G6),U6=150000,F6=40000,j2=(z)=>D1(z,U6,F6);function M6(z){if(!(z instanceof HTMLInputElement)&&!(z instanceof HTMLTextAreaElement)&&!(z instanceof HTMLSelectElement))return null;let J=z.name||z.id||z.getAttribute("aria-label")||z.getAttribute("placeholder")||z.tagName.toLowerCase();return`ช่อง “${R0(J)}”`}var Q2=80;function X2(z){let J=Object.keys(z).find(($)=>$.startsWith("__reactFiber$")||$.startsWith("__reactInternalInstance$"));return J?z[J]:null}function q6(z){if(typeof z!=="function")return null;try{let J=Function.prototype.toString.call(z);return(J.match(/\.(?:push|replace)\(\s*['"`]([^'"`]+)['"`]/)??J.match(/redirect\(\s*['"`]([^'"`]+)['"`]/))?.[1]??null}catch{return null}}function Z2(z){if(!z)return;return`→ ${z.length>Q2?`${z.slice(0,Q2)}…`:z}`}function D6(z){try{let J=z.closest("a[href]")?.getAttribute("href");if(J&&J.startsWith("/"))return Z2(J);let $=X2(z),j=0;while($&&j<30){if(typeof $.memoizedProps?.onClick==="function")return Z2(q6($.memoizedProps.onClick));$=$.return,j+=1}return}catch{return}}var I6='[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="status"], [role="alert"]';function N6(){let z=a1();return z.length?z.join(", "):I6}function B6(z){let J=z.getAttribute("role");if(J==="status"||J==="alert")return"ข้อความแจ้งเตือน";if(J==="menu")return"เมนู";if(J==="listbox")return"รายการตัวเลือก";if(J==="alertdialog")return"กล่องยืนยัน";return"กล่องโต้ตอบ"}function x6(z){let J=z.getAttribute("aria-label")?.trim();if(J)return J;let $=z.getAttribute("aria-labelledby");if($){let Z=$.split(/\s+/).map((W)=>document.getElementById(W)?.textContent?.trim()??"").filter(Boolean).join(" ");if(Z)return Z}let Q=z.querySelector('[data-slot="dialog-title"], h1, h2, h3, [role="heading"]')?.textContent?.replace(/\s+/g," ").trim();if(Q)return Q;return(z.textContent??"").replace(/\s+/g," ").trim()}function K2(z){let J=R0(x6(z)),$=B6(z);return J?`เปิด ${$} “${D0(J,M1)}”`:`เปิด ${$}`}var C6='[aria-busy="true"], [role="progressbar"], [data-loading="true"], .animate-pulse, .animate-spin',O6=/กำลังโหลด|กำลังค้นหา|กำลังดำเนินการ|\bloading\b/i;function w6(z){if(z.querySelector(C6))return!0;return O6.test(z.textContent??"")}var _6=400,S6=250,R6=8000;function L6(z,J){if(typeof MutationObserver>"u"){J.html=r0(j2(z));return}let $=Date.now(),j=!1,Q=()=>{j=!0,W.disconnect(),window.clearInterval(G),window.clearTimeout(P)},Z=()=>{if(j)return;if(Q(),!z.isConnected)return;J.detail=D0(K2(z),F1),J.html=r0(j2(z))},W=new MutationObserver(()=>{$=Date.now()});W.observe(z,{childList:!0,subtree:!0,attributes:!0,characterData:!0});let G=window.setInterval(()=>{if(j)return;if(!z.isConnected){Q();return}if(Date.now()-$>=_6&&!w6(z))Z()},S6),P=window.setTimeout(Z,R6)}function A6(z){if(n0(z))return;let J=k0("ui",K2(z));if(J)L6(z,J)}function k6(){if(typeof MutationObserver>"u")return;let z=new WeakSet;new MutationObserver(($)=>{for(let j of $)for(let Q of Array.from(j.addedNodes)){if(!(Q instanceof Element))continue;let Z=N6(),W=Q.matches(Z)?[Q]:Array.from(Q.querySelectorAll(Z));for(let G of W){if(z.has(G))continue;z.add(G),A6(G)}}}).observe(document.body,{childList:!0,subtree:!0})}var T6=1600,E6=2500;function V2(z){return{disabled:z.hasAttribute("disabled")||z.getAttribute("aria-disabled")==="true",busy:z.getAttribute("aria-busy")==="true",text:D0((z.textContent??"").replace(/\s+/g," ").trim(),M1)}}function f6(z,J){if(!z.disabled&&J.disabled)return"ปุ่มถูกปิดใช้งานหลังคลิก";if(!z.busy&&J.busy)return"ปุ่มเข้าสู่สถานะกำลังโหลด";if(z.text!==J.text&&J.text)return`ข้อความเปลี่ยนเป็น “${J.text}”`;return null}function h6(z,J){if(typeof MutationObserver>"u")return;let $=V2(z),j=!1,Q=(G,P)=>{if(j)return;if(j=!0,Z.disconnect(),window.clearTimeout(W),J.afterNote=G,P)J.afterHtml=r0(D1(z,W2,E6))},Z=new MutationObserver(()=>{if(!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}let G=f6($,V2(z));if(G)Q(G,!0)});Z.observe(z,{attributes:!0,attributeFilter:["disabled","aria-disabled","aria-busy","class"],childList:!0,subtree:!0,characterData:!0});let W=window.setTimeout(()=>{if(!j&&!z.isConnected){Q("องค์ประกอบหายไปจากหน้าจอ",!1);return}j=!0,Z.disconnect()},T6)}function G2(){if(J2||typeof window>"u")return;J2=!0,document.addEventListener("click",(j)=>{if(n0(j.target))return;let Q=X6(j.target);if(!Q)return;let Z=K6(Q);if(!Z)return;let W=k0("click",`คลิก ${Z}`,D6(Q),P6(Q));if(W)h6(Q,W)},{capture:!0,passive:!0}),document.addEventListener("change",(j)=>{if(n0(j.target))return;let Q=M6(j.target);if(Q)k0("input",`แก้ไข ${Q}`)},{capture:!0,passive:!0}),document.addEventListener("submit",(j)=>{if(n0(j.target))return;k0("submit","ส่งฟอร์ม")},{capture:!0,passive:!0});let z=()=>k0("navigate",`ไปที่ ${q1(J0(location.pathname+location.search))}`),J=history.pushState.bind(history),$=history.replaceState.bind(history);history.pushState=(...j)=>{let Q=J(...j);return z(),Q},history.replaceState=(...j)=>{let Q=$(...j);return z(),Q},window.addEventListener("popstate",z),k6()}function Y2(){return q0.map((z)=>({...z}))}var H2=2000,s0=[],P2=0,U2=!1;function I1(z,J){P2+=1,s0.push({id:`log_${P2}`,at:new Date().toISOString(),level:z,message:J.length>H2?`${J.slice(0,H2)}…`:J});while(s0.length>z0("maxConsoleEntries"))s0.shift()}function b6(){let z=new WeakSet;return(J,$)=>{if(typeof $==="object"&&$!==null){if(z.has($))return"[Circular]";z.add($)}if(typeof $==="bigint")return $.toString();return $}}function F2(z){if(typeof z==="string")return z;if(z instanceof Error)return`${z.name}: ${z.message}`;try{let J=JSON.stringify(z,b6());if(J!==void 0)return J}catch{}try{return String(z)}catch{}try{return Object.prototype.toString.call(z)}catch{return`[${typeof z}]`}}function M2(){if(U2||typeof window>"u")return;U2=!0;let z=["log","info","warn","error","debug"];for(let J of z){let $=console[J].bind(console);console[J]=(...j)=>{I1(J,j.map(F2).join(" ")),$(...j)}}window.addEventListener("error",(J)=>{let $=J.filename?` (${J.filename}:${J.lineno}:${J.colno})`:"";I1("exception",`${J.message}${$}`)}),window.addEventListener("unhandledrejection",(J)=>{let $=J.reason instanceof Error?`${J.reason.name}: ${J.reason.message}`:F2(J.reason);I1("unhandledrejection",$)})}function q2(){return s0.map((z)=>({...z}))}var D2=new Set,I2=new Set;function N2(z,J){return z.add(J),()=>z.delete(J)}function B2(z,J){for(let $ of[...z])$(J)}function x2(z){return N2(D2,z)}function a0(z={type:"manual"}){B2(D2,z)}function C2(z){return N2(I2,z)}function O2(z){B2(I2,z)}var m6=15000,g6=["ResizeObserver loop","Script error.","Non-Error promise rejection captured"],w2=!1,_2=0;function v6(z){return g6.some((J)=>z.includes(J))}function S2(z){let J=z.message??"";if(!J||v6(J))return;let $=Date.now();if($-_2<m6)return;_2=$,O2({...z,message:J})}function R2(){if(w2||typeof window>"u")return;w2=!0,window.addEventListener("error",(z)=>{if(!z.message&&!z.error)return;let J=z.error instanceof Error?z.error:null;S2({type:"runtime-error",message:z.message||(J?J.message:"Unknown error"),stack:J?.stack})}),window.addEventListener("unhandledrejection",(z)=>{let J=z.reason;S2({type:"unhandledrejection",message:J instanceof Error?J.message:String(J),stack:J instanceof Error?J.stack:void 0})})}var T2=4000,y6=1e6,p6=1e7,t0=[],L2=0,A2=!1;function E2(z){t0.push(z);while(t0.length>z0("maxRequests"))t0.shift()}function f2(){return L2+=1,`req_${L2}`}function k2(z){let J={};if(!z)return J;if(z instanceof Headers)z.forEach(($,j)=>{J[j]=$});else if(Array.isArray(z))for(let[$,j]of z)J[$]=j;else Object.assign(J,z);return J}function u6(z){let J={};return z.forEach(($,j)=>{J[j]=$}),J}function d6(z){if(z==null)return null;if(typeof z==="string")return z;if(z instanceof URLSearchParams)return z.toString();if(typeof FormData<"u"&&z instanceof FormData)return`[FormData: ${Array.from(z.keys()).join(", ")}]`;if(typeof Blob<"u"&&z instanceof Blob)return`[Blob ${z.size} bytes]`;if(z instanceof ArrayBuffer)return`[ArrayBuffer ${z.byteLength} bytes]`;return"[binary]"}function i6(z,J){let $="",j="GET",Q={},Z=null;if(typeof z==="string")$=z;else if(z instanceof URL)$=z.toString();else $=z.url,j=z.method||j,Q=k2(z.headers);if(J){if(J.method)j=J.method;if(J.headers)Q={...Q,...k2(J.headers)};if(J.body!==void 0)Z=d6(J.body)}return{method:j.toUpperCase(),url:$,headers:Q,body:Z}}function h2(z){return!t1(z)}function c6(z,J){if(h2(J.url)){J.responseSnippet="[body not captured for this origin]";return}let $=z.headers.get("content-type")??"",j=Number(z.headers.get("content-length")??"0"),Q=j?`, ~${j} bytes`:"";if(!/json|text|xml|html|javascript|urlencoded/i.test($)){J.responseSnippet=`[binary ${$||"unknown"}${Q}]`;return}if(j>y6){J.responseSnippet=`[response ${$||"text"}${Q} — omitted]`;return}try{z.clone().text().then((Z)=>{J.responseSnippet=A0(Z,z0("maxBodyChars"))}).catch(()=>{})}catch{}}function b2(z,J){if(/[?&]_rsc=/.test(z))return!0;for(let $ of Object.keys(J)){let j=$.toLowerCase();if(j==="rsc"||j==="next-router-prefetch"||j==="next-router-state-tree")return!0}return!1}function l6(){if(typeof window>"u"||typeof window.fetch!=="function")return;let z=window.fetch.bind(window);window.fetch=Object.assign(async(J,$)=>{let j=i6(J,$);if(b2(j.url,j.headers))return z(J,$);let Q={id:f2(),startedAt:new Date().toISOString(),method:j.method,url:J0(j.url),requestHeaders:L0(j.headers),requestBody:A0(j.body,T2),status:null,statusText:null,durationMs:null,via:"fetch"};E2(Q);let Z=performance.now();try{let W=await z(J,$);return Q.status=W.status,Q.statusText=W.statusText,Q.durationMs=Math.round(performance.now()-Z),Q.responseHeaders=L0(u6(W.headers)),c6(W,Q),W}catch(W){throw Q.durationMs=Math.round(performance.now()-Z),Q.error=W instanceof Error?`${W.name}: ${W.message}`:String(W),W}},z)}function o6(){if(typeof window>"u"||typeof window.XMLHttpRequest!=="function")return;let z=XMLHttpRequest.prototype,J=z.open,$=z.send,j=function(Z,W){let G=typeof W==="string"?W:W.toString();return this.__lwEntry=b2(G,{})?void 0:{id:f2(),startedAt:"",method:(Z||"GET").toUpperCase(),url:J0(G),requestHeaders:{},requestBody:null,status:null,statusText:null,durationMs:null,via:"xhr"},J.apply(this,arguments)},Q=function(Z){let W=this.__lwEntry;if(W){W.startedAt=new Date().toISOString(),W.requestBody=typeof Z==="string"?A0(Z,T2):Z==null?null:"[non-string body]";let G=performance.now();E2(W),this.addEventListener("loadend",()=>{if(W.status=this.status||null,W.statusText=this.statusText||null,W.durationMs=Math.round(performance.now()-G),h2(W.url))W.responseSnippet="[body not captured for this origin]";else if(this.responseType===""||this.responseType==="text")try{W.responseSnippet=A0(this.responseText||"",z0("maxBodyChars"))}catch{}else{let P=this.getResponseHeader("content-type")??this.responseType;W.responseSnippet=`[binary ${P}]`}})}return $.apply(this,arguments)};z.open=j,z.send=Q}function m2(){if(A2)return;A2=!0,l6(),o6()}function g2(){let z=t0.map(($)=>({...$})),J=0;for(let $=z.length-1;$>=0;$-=1){let j=z[$],Q=j?.responseSnippet;if(!j||typeof Q!=="string"||Q.length===0)continue;if(J+Q.length>p6)j.responseSnippet=`[response omitted — report size budget reached (${Q.length.toLocaleString()} chars)]`;else J+=Q.length}return z}var n6=4,v2=3,r6=4000,s6="[data-debug-reporter]",y2=()=>import("@rrweb/record");function p2(z){y2=z}var v=[],N1=null,e0=!1;function u2(){if(typeof window>"u"||N1||e0)return;let z=_0();if(!z)return;e0=!0;let J=()=>void a6(z);if("requestIdleCallback"in window)window.requestIdleCallback(J,{timeout:3000});else setTimeout(J,1000)}async function a6(z){let J;try{J=(await y2()).record}catch($){e0=!1,console.warn("[debug-capture] session replay could not start:",$);return}if(N1)return;try{N1=J({emit:($)=>t6($),checkoutEveryNms:Math.max(1000,z.seconds*1000/2),checkoutEveryNth:r6,maskAllInputs:z.maskInputs,maskTextSelector:z.maskText?"*":z.maskTextSelector,blockSelector:`${z.blockSelector}, ${s6}`,slimDOMOptions:"all",inlineStylesheet:!0,sampling:{mousemove:50,scroll:150,media:800,input:"last",...z.canvas?{canvas:z.canvas.fps}:{}},recordCanvas:z.canvas!==null,...z.canvas?{dataURLOptions:{type:"image/webp",quality:z.canvas.quality}}:{},errorHandler:()=>!0})??null}catch($){console.warn("[debug-capture] session replay could not start:",$)}finally{e0=!1}}function t6(z){if(z.type===n6||v.length===0){if(v.push([]),v.length>v2)v=v.slice(-v2)}v[v.length-1].push(z)}function d2(z=Date.now()){let J=_0();if(!J||!v.length)return null;let $=z-J.seconds*1000,j=v.length-1;while(j>0&&(v[j][0]?.timestamp??z)>$)j-=1;let Q=v.slice(j).flat(),Z=Q[0]?.timestamp,W=Q[Q.length-1]?.timestamp;if(Z===void 0||W===void 0)return null;return{events:Q,startedAt:new Date(Z).toISOString(),endedAt:new Date(W).toISOString(),durationMs:Math.max(0,W-Z)}}var e6={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:"ส่งรายงานไม่สำเร็จ",failedOffline:"ส่งไม่สำเร็จ — เชื่อมต่อเซิร์ฟเวอร์ไม่ได้ ข้อความที่พิมพ์ไว้ยังอยู่ ตรวจสอบอินเทอร์เน็ตแล้วลองใหม่",failedUnavailable:"ส่งไม่สำเร็จ — ระบบกำลังปรับปรุงชั่วคราว ข้อความที่พิมพ์ไว้ยังอยู่ ลองใหม่ในอีกสักครู่",failedTooMany:"แจ้งปัญหาถี่เกินไป — ลองใหม่ในอีก {seconds} วินาที",captured:"เก็บข้อมูลแล้ว",reporter:"ผู้แจ้ง",page:"หน้า",replay:"บันทึกการใช้งาน",handoffTitle:"กำลังพาไปที่ระบบแจ้งปัญหา",handoffBody:"ระบบจะลงชื่อเข้าใช้ให้อัตโนมัติ เพื่อดูเรื่องที่คุณแจ้งไว้",handoffGo:"ไปเลย",handoffPreparing:"กำลังเตรียม…",handoffFailed:"เปิดรายการที่แจ้งไว้ไม่สำเร็จ",handoffBlocked:"เบราว์เซอร์บล็อกการเปิดแท็บใหม่",handoffOpen:"เปิดในแท็บใหม่",chooseTitle:"ต้องการให้ทีมช่วยเรื่องอะไร",kindProblem:"แจ้งปัญหา",kindRequest:"คำขอ",askInstead:"เป็นคำขอ?",askInsteadAction:"เลือกเรื่องที่ขอ",problemInstead:"เป็นปัญหาที่ต้องแก้?",problemInsteadAction:"แจ้งปัญหาแทน",problemInsteadShare:"แจ้งปัญหาแทน (แนบภาพหน้าจอ)",chooseProblemHint:"มีอะไรเสีย หรือใช้งานไม่ได้ — แนบภาพหน้าจอ",chooseRequestHint:"ขอให้ทีมทำ เช่น ขอสิทธิ์ ขอแก้ข้อมูล — ไม่ต้องแชร์หน้าจอ",requestTitle:"ขอให้ทีมดำเนินการ",requestTypeLabel:"เรื่องที่ขอ",requestTypeSearch:"ค้นหาเรื่องที่ขอ",requestTypeNone:"ไม่พบเรื่องที่ขอ — ลองคำอื่น",requestTypeCount:"{n} เรื่อง — เลื่อนดูหรือพิมพ์ค้นหา",requestTarget:"ทีมตั้งใจให้เสร็จภายใน {time}",requestSummaryLabel:"หัวข้อ",requestSummaryPlaceholder:"ขออะไร — สั้น ๆ",requestDetailLabel:"รายละเอียด (ไม่บังคับ)",requestDetailPlaceholder:"สิ่งที่ทีมต้องรู้เพื่อดำเนินการ",requestSubmit:"ส่งคำขอ",requestSubmitted:"ส่งคำขอแล้ว",requestWithShot:"แนบภาพหน้าจอนี้ไปกับคำขอ",requestAnnotateHint:"ทำเครื่องหมายสิ่งที่ขอบนภาพ — วงกรอบ ชี้ลูกศร ไฮไลต์ หรือพิมพ์ข้อความ",draftRestored:"ข้อความที่พิมพ์ไว้ครั้งก่อน ยังไม่ได้ส่ง",draftClear:"ล้าง",requestLeaves:"ไม่ส่งไปกับคำขอ",requestLeavesWhat:"บันทึกการใช้งานของหน้านี้ — ใช้กับการแจ้งปัญหาเท่านั้น",days:"{n} วัน",hours:"{n} ชั่วโมง",ringTitle:"ทีมงานกำลังโทรหาคุณ",ringAbout:"เรื่อง {key} · {title}",ringHow:"รับสายในหน้าคำร้องของคุณ — เปิดในแท็บใหม่ ไม่ต้องเข้าสู่ระบบอีก",ringOpen:"เปิดเพื่อรับสาย",ringDecline:"ไม่รับ",ringOpened:"เปิดหน้ารับสายแล้ว — กด รับสาย ในแท็บที่เปิดขึ้น",ringBlocked:"เบราว์เซอร์บล็อกแท็บใหม่ — กดที่นี่เพื่อเปิดหน้ารับสาย",ringClose:"ปิด",ringTab:"\uD83D\uDCDE สายเข้า"},z8={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",failedOffline:"Could not send — the server could not be reached. What you wrote is still here; check your connection and try again.",failedUnavailable:"Could not send — the system is being updated. What you wrote is still here; try again in a moment.",failedTooMany:"Too many reports — try again in {seconds} seconds.",captured:"Captured",reporter:"Reporter",page:"Page",replay:"activity log",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",chooseTitle:"How can the team help?",kindProblem:"Report a problem",kindRequest:"Request",askInstead:"Asking for something?",askInsteadAction:"Choose what you need",problemInstead:"Something broken?",problemInsteadAction:"Report a problem instead",problemInsteadShare:"Report a problem instead (with a screenshot)",chooseProblemHint:"Something is broken or not working — with a screenshot",chooseRequestHint:"Ask the team to do something, like access or a data change — no screen sharing",requestTitle:"Ask the team",requestTypeLabel:"What you need",requestTypeSearch:"Search what you need",requestTypeNone:"Nothing matches — try another word",requestTypeCount:"{n} to choose from — scroll or search",requestTarget:"The team aims to finish within {time}",requestSummaryLabel:"Subject",requestSummaryPlaceholder:"What do you need — briefly",requestDetailLabel:"Details (optional)",requestDetailPlaceholder:"What the team needs to know to do it",requestSubmit:"Send request",requestSubmitted:"Request sent",requestWithShot:"Attach this screenshot to the request",requestAnnotateHint:"Mark what you are asking about — box it, point at it, highlight it, or type on it",draftRestored:"What you typed last time, not sent yet",draftClear:"Clear",requestLeaves:"Not sent with a request",requestLeavesWhat:"this page's activity log — it is for problem reports only",days:"{n} days",hours:"{n} hours",ringTitle:"The support team is calling you",ringAbout:"About {key} · {title}",ringHow:"Answer on your request's page — it opens in a new tab, already signed in",ringOpen:"Open to answer",ringDecline:"Decline",ringOpened:"Opened — press Answer in the new tab",ringBlocked:"Your browser blocked the new tab — open the call here",ringClose:"Close",ringTab:"\uD83D\uDCDE Incoming call"};function Y0(z){return z==="en"?z8:e6}var J8="lw-debug-toasts",$8=6000,j8=`
|
|
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
|
-
`,t0=null;function e4(){if(typeof document>"u")return null;if(t0?.isConnected)return t0;let $=document.createElement(s4);$.dataset.debugReporter="true";let z=$.attachShadow({mode:"open"}),J=document.createElement("style");J.textContent=t4;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),z.append(J,j),document.body.append($),t0=j,j}function X0($,z="success",J){let j=f0()?f().toast:void 0;if(j){j({message:$,tone:z,...J?{action:J}:{}});return}let Q=e4();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=z;let Y=document.createElement("span");Y.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(A),Z.remove()};H.addEventListener("click",U);let A=z==="error"||J?0:window.setTimeout(U,a4);if(Z.append(Y,X),J){let k=document.createElement("button");k.type="button",k.className="action",k.textContent=J.label,k.addEventListener("click",()=>{U(),J.onClick()}),Z.append(k)}Z.append(H),Q.append(Z)}function Z2($,z,J){let j=$.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=z.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:J.slice(0,20)}}function $6(){let $={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return $;let z=performance.memory;if(z)$.memoryUsedMb=Math.round(z.usedJSHeapSize/1024/1024),$.memoryLimitMb=Math.round(z.jsHeapSizeLimit/1024/1024);let[J]=performance.getEntriesByType("navigation");if(J)$.domContentLoadedMs=Math.round(J.domContentLoadedEventEnd),$.loadEventMs=Math.round(J.loadEventEnd);return $}function e0($,z){if(!$)return z;try{return $()}catch{return z}}function K2(){let $=f(),{pathname:z,search:J,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:z,search:J},module:_0(z),user:e0($.user,{}),apiHeaders:I0(e0($.headers,{})),app:{name:o().name,version:o().version,environment:o().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:$6(),extra:e0($.extra,{})}}var z6=2;function g0($){let z=e1(),J=h1();return{context:K2(),reason:$.reason,note:$.note,cause:Z2(z,J,$.erroredQueries),actionTrail:O1(),network:z,console:J,screenshotDataUrl:$.screenshotDataUrl,screenshotMethod:$.screenshotMethod,replay:Q2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:z6}}}async function $1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let J=await J6();if(J.status==="ok")return{dataUrl:J.dataUrl,method:"display-media"};if(J.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let z=await Z6();if(z)return{dataUrl:z,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function J6(){let $=null;try{let z={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};$=await navigator.mediaDevices.getDisplayMedia(z);let J=await j6($);return J?{status:"ok",dataUrl:J}:{status:"error"}}catch(z){if(z instanceof DOMException&&(z.name==="NotAllowedError"||z.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{$?.getTracks().forEach((z)=>z.stop())}}async function j6($){let z=document.createElement("video");z.srcObject=$,z.muted=!0,z.playsInline=!0,await new Promise((Y)=>{let X=!1,H=()=>{if(X)return;X=!0,Y()};z.onloadedmetadata=()=>{z.play().then(H).catch(H)},window.setTimeout(H,1500)}),await Q6(z);let{videoWidth:J,videoHeight:j}=z;if(!J||!j)return null;let Q=document.createElement("canvas");Q.width=J,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(z,0,0,J,j),z.pause(),z.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function Q6($){return new Promise((z)=>{let J=!1,j=()=>{if(J)return;J=!0,z()},Q=$;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function Z6(){let $=f().screenshotFallback;if(!$)return null;let z=await $().catch(()=>null);if(!z)return null;try{return await z(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:(J)=>!(J instanceof HTMLElement&&J.dataset?.debugReporter==="true")})}catch{return null}}var K6=2000,Y6=0.82,W6=3000000;function G6($){return new Promise((z,J)=>{let j=new Image;j.onload=()=>z(j),j.onerror=()=>J(Error("could not read the screenshot")),j.src=$})}async function b0($){try{let z=await G6($),J=Math.max(z.naturalWidth,z.naturalHeight),j=Math.min(1,K6/J),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(z.naturalWidth*j)),Q.height=Math.max(1,Math.round(z.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return $;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(z,0,0,Q.width,Q.height);let Y=Y6,X=Q.toDataURL("image/jpeg",Y);while(X.length>W6&&Y>0.4)Y-=0.15,X=Q.toDataURL("image/jpeg",Y);return X}catch{return $}}var V6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,X6=/^\d+$/,F6=/^[0-9a-f]{16,}$/i;function Y2($){if($.reason.type==="manual")return null;let z=$.cause?.failedRequests?.[0];if(!z?.url)return null;let J;try{J=new URL(z.url,"http://x").pathname}catch{J=z.url}let j=J.split("/").map((Z)=>V6.test(Z)||X6.test(Z)||F6.test(Z)?":id":Z).join("/"),Q=z.status??(z.error?"ERR":"?");return`${z.method??"REQ"} ${j} ${Q}`}var W2=2000000;function p0($){let{screenshotDataUrl:z,replay:J,...j}=$;return JSON.stringify(j).length}function G2($,z=2000000){if(p0($)<=z)return $;let J=$.network.map((Q)=>({...Q})),j={...$,network:J};for(let Q of J){if(p0(j)<=z)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&p0(j)>z)j.network=j.network.slice(1);while(j.console.length>1&&p0(j)>z)j.console=j.console.slice(1);return j}function B0($){let z="";for(let J=0;J<$.length;J+=32768)z+=String.fromCharCode(...$.subarray(J,J+32768));return btoa(z)}var H6=4,w6=2,P6=3,U6=0,I6=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),M6=/^\s*javascript:/i;function q6($,z){let J=$.toLowerCase();if(J.startsWith("on")||J==="srcdoc")return!0;return typeof z==="string"&&M6.test(z)}function V2($,z=!1){if(!$)return;for(let J of Object.keys($)){let j=$[J];if(q6(J,j)){if(z)$[J]=null;else delete $[J];continue}if(typeof j!=="string"||!I6.has(J)||!j.includes("?"))continue;$[J]=e(j)}}function z1($){if(!$)return;V2($.attributes);for(let z of $.childNodes??[])z1(z)}function X2($){let z=JSON.parse(JSON.stringify($));for(let J of z){let j=J.data;if(!j||typeof j!=="object")continue;if(J.type===H6&&typeof j.href==="string")j.href=e(j.href);else if(J.type===w6)z1(j.node);else if(J.type===P6&&j.source===U6){for(let Q of j.adds??[])z1(Q.node);for(let Q of j.attributes??[])V2(Q.attributes,!0)}}return z}var D6="session-replay.json.gz",B6="session-replay.json";function N6($){return Boolean($&&$.events.length>0)}async function x6($){if(typeof CompressionStream>"u")return null;try{let z=new Blob([$]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(z).arrayBuffer())}catch{return null}}async function H2($,z){if(!N6($))return{summary:{omitted:"empty"}};let j={seconds:Math.round($.durationMs/1000),events:$.events.length,startedAt:$.startedAt,endedAt:$.endedAt},Q=X2($.events),Z=await F2(Q),Y=!1;if(Z.bytes.byteLength>z&&O6(Q))Q=f6(Q),Z=await F2(Q),Y=!0;let{bytes:X,compressed:H}=Z;if(X.byteLength>z)return{summary:{...j,bytes:X.byteLength,omitted:"too-large"}};return{dataUri:`data:${H?"application/gzip":"application/json"};base64,${B0(X)}`,filename:H?D6:B6,summary:{...j,events:Q.length,bytes:X.byteLength,compressed:H,...Y?{canvasDropped:Y}:{}}}}async function F2($){let z=new TextEncoder().encode(JSON.stringify({events:$})),J=await x6(z);return J?{bytes:J,compressed:!0}:{bytes:z,compressed:!1}}var k6=3,w2=2,C6=9;function P2($){return $.type===k6&&$.data?.source===C6}function O6($){return $.some(P2)||$.some((z)=>z.type===w2&&U2(z.data.node))}function U2($){if(!$)return!1;if($.attributes&&"rr_dataURL"in $.attributes)return!0;return($.childNodes??[]).some(U2)}function I2($){if(!$)return;if($.attributes&&"rr_dataURL"in $.attributes)delete $.attributes.rr_dataURL;for(let z of $.childNodes??[])I2(z)}function f6($){let z=[];for(let J of $){if(P2(J))continue;if(J.type===w2)I2(J.data.node);z.push(J)}return z}var _6=new Set([502,503,504]);class l extends Error{kind;retryAfter;status;constructor($,z,J,j){super($);this.kind=z;this.retryAfter=J;this.status=j;this.name="ReportError"}}function S6($){let{screenshotDataUrl:z,replay:J,...j}=$;return{dataUri:`data:application/json;base64,${B0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function J1(){let $=f().identity;if(!$)return{};try{let z=await $();return z?{authorization:`Bearer ${z}`}:{}}catch{return{}}}async function M2($,z){let J=f(),j=G2(z,W2),{context:Q,note:Z}=j,Y=[];if(j.screenshotDataUrl){let x=await b0(j.screenshotDataUrl);Y.push({dataUri:x,filename:"screenshot.jpg"})}Y.push(S6(j));let X,H=w0();if(H){let x=await H2(j.replay,H.maxBytes);if(X=x.summary,"dataUri"in x)Y.push({dataUri:x.dataUri,filename:x.filename})}let U=Y2(j),A={title:$,description:Z.trim()||void 0,appName:o().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:o().name,module:Q.module?.label??""},context:{...U?{signature:U}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...X?{replay:X}:{}},attachments:Y},k=await fetch(`${J.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await J1()},body:JSON.stringify(A)}).catch(()=>{throw new l("report never left the browser","offline")});if(!k.ok)throw await j1(k);return await k.json()}async function j1($){let z=$.headers.get("retry-after"),J=await $.json().then((j)=>j.error).catch(()=>null);if($.status===429)return new l("rate limited","rateLimited",z??void 0);if(_6.has($.status))return new l("desk unavailable","unavailable");return new l(J??`Report failed (${$.status})`,"rejected",void 0,$.status)}var y0=null,N0=null,q2=()=>f().host.replace(/\/$/,"");function Q1(){return y0}function F0(){if(N0)return N0;return N0=(async()=>{try{let $=await fetch(`${q2()}/ingest/request-types`,{headers:{"x-realm-key":f().realmKey}}),z=$.ok?await $.json():null;y0=Array.isArray(z?.types)?z.types.filter(R6):[]}catch{y0=[],N0=null}return y0??[]})(),N0}function R6($){let z=$;return!!z&&typeof z.id==="string"&&typeof z.name==="string"}async function D2($){let z=f(),J={};try{J=z.user?.()??{}}catch{J={}}let j=typeof window>"u"?null:window.location,Q={title:$.title,description:$.description.trim()||void 0,ticketTypeId:$.ticketTypeId,appName:o().name,category:j?_0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:J.email??void 0,requesterName:J.fullName??void 0,attachments:$.screenshotDataUrl?[{dataUri:await b0($.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${q2()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":z.realmKey,...await J1()},body:JSON.stringify(Q)}).catch(()=>{throw new l("request never left the browser","offline")});if(!Z.ok)throw await j1(Z);return await Z.json()}var x0=Math.PI/6;function B2($,z,J){let j=z.x-$.x,Q=z.y-$.y,Z=Math.hypot(j,Q),Y=Math.atan2(Q,j),X=[{x:z.x,y:z.y},{x:z.x-J*Math.cos(Y-x0),y:z.y-J*Math.sin(Y-x0)},{x:z.x-J*Math.cos(Y+x0),y:z.y-J*Math.sin(Y+x0)}],H=J*Math.cos(x0)*0.92;if(Z<=H)return{shaft:null,head:X};return{shaft:{from:$,to:{x:z.x-H*Math.cos(Y),y:z.y-H*Math.sin(Y)}},head:X}}var Z1="#f44336",T6="rgba(250, 204, 21, 0.4)",K1=22,N2="#2563eb",x2=9,k2=11,C2=18,O2=4,v0=8,h6=[{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 f2($,z,J){let j=[],Q=null,Z=-1,Y=null,X=null,H=$.getContext("2d");function U(){let K=$.getBoundingClientRect().width;return K>0?$.width/K:1}function A(K){let W=$.getBoundingClientRect();return{x:(K.clientX-W.left)/W.width*$.width,y:(K.clientY-W.top)/W.height*$.height}}function k(K){let W=K.size??K1;if(!H)return(K.text?.length??0)*W*0.6;H.save(),H.font=`600 ${W}px system-ui, sans-serif`;let V=H.measureText(K.text??"").width;return H.restore(),V}function x(K){if(K.tool==="text"){let W=K.size??K1;return{left:K.x1,top:K.y1,right:K.x1+k(K),bottom:K.y1+W*1.25}}return{left:Math.min(K.x1,K.x2),top:Math.min(K.y1,K.y2),right:Math.max(K.x1,K.x2),bottom:Math.max(K.y1,K.y2)}}function S(K){if(K.tool==="arrow")return[{id:"tail",x:K.x1,y:K.y1,cursor:"move"},{id:"head",x:K.x2,y:K.y2,cursor:"move"}];let W=x(K);if(K.tool==="text")return[{id:"size",x:W.right,y:W.bottom,cursor:"nwse-resize"}];return h6.map((V)=>({id:V.id,x:W.left+(W.right-W.left)*V.fx,y:W.top+(W.bottom-W.top)*V.fy,cursor:V.cursor}))}function L(K){let W=x(K);return{x:W.right+C2*U(),y:W.top-C2*U()}}function i(K,W,V){let{shaft:G,head:F}=B2({x:W.x1,y:W.y1},{x:W.x2,y:W.y2},Math.max(10,16*V));if(G)K.lineCap="butt",K.beginPath(),K.moveTo(G.from.x,G.from.y),K.lineTo(G.to.x,G.to.y),K.stroke();K.beginPath(),K.moveTo(F[0].x,F[0].y),K.lineTo(F[1].x,F[1].y),K.lineTo(F[2].x,F[2].y),K.closePath(),K.fill()}function n(K,W,V){K.save(),K.lineWidth=Math.max(2,3*V),K.strokeStyle=Z1,K.fillStyle=Z1;let G=x(W);if(W.tool==="rect")K.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(W.tool==="arrow")i(K,W,V);else if(W.tool==="highlight")K.fillStyle=T6,K.fillRect(G.left,G.top,G.right-G.left,G.bottom-G.top);else if(W.tool==="text"&&W.text){let F=W.size??K1;K.font=`600 ${F}px system-ui, sans-serif`,K.textBaseline="top";let P=F*0.22;K.fillStyle="rgba(255,255,255,0.92)",K.fillRect(G.left-P,G.top-P,G.right-G.left+P*2,G.bottom-G.top+P*2),K.fillStyle=Z1,K.fillText(W.text,G.left,G.top)}K.restore()}function h(K,W,V){let G=x(W);K.save(),K.strokeStyle=N2,K.lineWidth=Math.max(1,1.5*V),K.setLineDash([6*V,4*V]),K.strokeRect(G.left,G.top,G.right-G.left,G.bottom-G.top),K.setLineDash([]);let F=x2*V;for(let T of S(W))K.fillStyle="#fff",K.strokeStyle=N2,K.lineWidth=Math.max(1,1.5*V),K.beginPath(),K.rect(T.x-F/2,T.y-F/2,F,F),K.fill(),K.stroke();let P=L(W),q=k2*V;K.beginPath(),K.arc(P.x,P.y,q,0,Math.PI*2),K.fillStyle="#dc2626",K.fill(),K.strokeStyle="#fff",K.lineWidth=Math.max(1.5,2*V),K.beginPath(),K.moveTo(P.x-q*0.4,P.y-q*0.4),K.lineTo(P.x+q*0.4,P.y+q*0.4),K.moveTo(P.x+q*0.4,P.y-q*0.4),K.lineTo(P.x-q*0.4,P.y+q*0.4),K.stroke(),K.restore()}function B(){if(!H)return;let K=U();if(H.clearRect(0,0,$.width,$.height),H.drawImage(z,0,0,$.width,$.height),j.forEach((V,G)=>{if(G!==J0)n(H,V,K)}),Y)n(H,Y,K);let W=j[Z];if(W&&!Y)h(H,W,K)}function Z0(K,W,V,G,F){return Math.abs(K-V)<=F&&Math.abs(W-G)<=F}function z0(K,W){let V=j[Z];if(!V)return null;let G=x2*U()/2+3*U();for(let F of S(V))if(Z0(K,W,F.x,F.y,G))return F.id;return null}function R(K,W){let V=j[Z];if(!V)return!1;let G=L(V);return Z0(K,W,G.x,G.y,k2*U())}function d(K,W){let V=6*U();for(let G=j.length-1;G>=0;G-=1){let F=j[G];if(F.tool==="arrow"){let q=F.x2-F.x1,T=F.y2-F.y1,u=Math.hypot(q,T)||1,w=Math.max(0,Math.min(1,((K-F.x1)*q+(W-F.y1)*T)/(u*u)));if(Math.hypot(K-(F.x1+w*q),W-(F.y1+w*T))<=V+4*U())return G;continue}let P=x(F);if(K>=P.left-V&&K<=P.right+V&&W>=P.top-V&&W<=P.bottom+V)return G}return-1}function _(K,W,V,G,F){if(W==="tail"){K.x1=V.x1+G,K.y1=V.y1+F;return}if(W==="head"){K.x2=V.x2+G,K.y2=V.y2+F;return}if(W==="size"){let D=(V.size??24)+F;K.size=Math.max(10,D);return}let P=x(V),{left:q,top:T,right:u,bottom:w}=P;if(W.includes("w"))q=Math.min(u-v0,q+G);if(W.includes("e"))u=Math.max(q+v0,u+G);if(W.includes("n"))T=Math.min(w-v0,T+F);if(W.includes("s"))w=Math.max(T+v0,w+F);K.x1=q,K.y1=T,K.x2=u,K.y2=w}function C0(K,W,V,G){K.x1=W.x1+V,K.y1=W.y1+G,K.x2=W.x2+V,K.y2=W.y2+G}let C=null,J0=-1,E={x:0,y:0,size:24};function H0(){let K=$.getBoundingClientRect().width;return K>0?K/$.width:1}function O0(K,W){if(!H)return K.length*W*0.6;H.save(),H.font=`600 ${W}px system-ui, sans-serif`;let V=H.measureText(K||" ").width;return H.restore(),V}function K0(){if(!C)return;let K=$.parentElement;if(!K)return;let W=$.getBoundingClientRect(),V=K.getBoundingClientRect(),G=H0(),F=E.size*G;C.style.left=`${W.left-V.left+E.x*G}px`,C.style.top=`${W.top-V.top+E.y*G}px`,C.style.fontSize=`${F}px`,C.style.width=`${Math.max(40,O0(C.value,F)+F)}px`}function r(K){let W=C;if(!W)return;C=null;let V=W.value.trim(),G=J0;if(J0=-1,W.remove(),K&&V){if(G>=0&&j[G])j[G].text=V,Z=G;else j.push({tool:"text",x1:E.x,y1:E.y,x2:E.x,y2:E.y,text:V,size:E.size}),Z=j.length-1;J()}else if(G>=0)Z=G;$.focus(),B()}function c(K,W,V=-1){r(!0);let G=$.parentElement;if(!G)return;if(getComputedStyle(G).position==="static")G.style.position="relative";let F=V>=0?j[V]:void 0;J0=V,E={x:F?.x1??K,y:F?.y1??W,size:F?.size??Math.round(24*U())};let P=document.createElement("input");P.type="text",P.className="text-edit",P.value=F?.text??"",P.setAttribute("aria-label","ข้อความบนภาพ"),P.placeholder="ข้อความ",C=P,G.append(P),K0(),P.addEventListener("input",K0),P.addEventListener("keydown",(q)=>{if(q.stopPropagation(),q.key==="Enter")r(!0);else if(q.key==="Escape")r(!1)}),requestAnimationFrame(()=>{if(C!==P)return;P.focus(),P.select(),P.addEventListener("blur",()=>r(!0))}),B()}function y(K){let{x:W,y:V}=A(K);if($.setPointerCapture(K.pointerId),R(W,V)){v();return}let G=z0(W,V);if(G&&j[Z]){X={grip:G,x:W,y:V,start:{...j[Z]}};return}if(Q==="text"){if(K.preventDefault(),$.hasPointerCapture(K.pointerId))$.releasePointerCapture(K.pointerId);Q=null,J(),c(W,V);return}if(Q){Y={tool:Q,x1:W,y1:V,x2:W,y2:V},Z=-1;return}let F=d(W,V);Z=F,X=F>=0?{grip:"body",x:W,y:V,start:{...j[F]}}:null,B()}function Y0(K){let{x:W,y:V}=A(K);if(Y){Y.x2=W,Y.y2=V,B();return}if(X){let F=j[Z];if(!F)return;let P=W-X.x,q=V-X.y;if(X.grip==="body")C0(F,X.start,P,q);else _(F,X.grip,X.start,P,q);B();return}if(Q){$.style.cursor="crosshair";return}if(R(W,V)){$.style.cursor="pointer";return}let G=z0(W,V);if(G){let F=j[Z]?S(j[Z]).find((P)=>P.id===G):null;$.style.cursor=F?.cursor??"pointer";return}$.style.cursor=d(W,V)>=0?"move":"default"}function j0(){if(Y){if(!(Math.abs(Y.x2-Y.x1)<O2&&Math.abs(Y.y2-Y.y1)<O2))j.push(Y),Z=j.length-1,Q=null,J();Y=null}if(X)X=null,J();B()}function s(K){let W=$.getBoundingClientRect(),V=(K.clientX-W.left)/W.width*$.width,G=(K.clientY-W.top)/W.height*$.height,F=d(V,G),P=j[F];if(!P||P.tool!=="text")return;K.preventDefault(),c(P.x1,P.y1,F)}function a(K){if(Z<0)return;if(K.key==="Delete"||K.key==="Backspace")K.preventDefault(),v();else if(K.key==="Escape")K.preventDefault(),Z=-1,B()}function v(){if(Z<0)return;j.splice(Z,1),Z=-1,J(),B()}return $.addEventListener("pointerdown",y),$.addEventListener("pointermove",Y0),$.addEventListener("pointerup",j0),$.addEventListener("pointercancel",j0),$.addEventListener("dblclick",s),$.tabIndex=0,$.addEventListener("keydown",a),B(),{setTool(K){Q=K,Z=-1,$.style.cursor=K?"crosshair":"default",B()},deleteSelected:v,clear(){j.length=0,Z=-1,J(),B()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let K=document.createElement("canvas");K.width=z.naturalWidth,K.height=z.naturalHeight;let W=K.getContext("2d");if(!W)return $.toDataURL("image/png");W.drawImage(z,0,0);let V=U();for(let G of j)n(W,G,V);return K.toDataURL("image/png")},destroy(){r(!1),$.removeEventListener("pointerdown",y),$.removeEventListener("pointermove",Y0),$.removeEventListener("pointerup",j0),$.removeEventListener("pointercancel",j0),$.removeEventListener("dblclick",s),$.removeEventListener("keydown",a)}}}var A6=["keydown","keyup","keypress"];function _2($){for(let z of A6)$.addEventListener(z,(J)=>J.stopPropagation())}var S2=`
|
|
33
|
+
`,B1=null;function Q8(){if(typeof document>"u")return null;if(B1?.isConnected)return B1;let z=document.createElement(J8);z.dataset.debugReporter="true";let J=z.attachShadow({mode:"open"}),$=document.createElement("style");$.textContent=j8;let j=document.createElement("div");return j.className="stack",j.setAttribute("role","status"),j.setAttribute("aria-live","polite"),J.append($,j),document.body.append(z),B1=j,j}function I0(z,J="success",$){let j=c0()?I().toast:void 0;if(j){j({message:z,tone:J,...$?{action:$}:{}});return}let Q=Q8();if(!Q)return;let Z=document.createElement("div");Z.className="toast",Z.dataset.tone=J;let W=document.createElement("span");W.className="dot";let G=document.createElement("span");G.textContent=z;let P=document.createElement("button");P.type="button",P.className="close",P.textContent="✕",P.setAttribute("aria-label","ปิด");let F=()=>{window.clearTimeout(L),Z.remove()};P.addEventListener("click",F);let L=J==="error"||$?0:window.setTimeout(F,$8);if(Z.append(W,G),$){let w=document.createElement("button");w.type="button",w.className="action",w.textContent=$.label,w.addEventListener("click",()=>{F(),$.onClick()}),Z.append(w)}Z.append(P),Q.append(Z)}function i2(z,J,$){let j=z.filter((Z)=>Boolean(Z.error)||Z.status!=null&&Z.status>=400).slice(-20).map((Z)=>({method:Z.method,url:Z.url,status:Z.status,error:Z.error,at:Z.startedAt})),Q=J.filter((Z)=>Z.level==="error"||Z.level==="exception"||Z.level==="unhandledrejection").slice(-20).map((Z)=>Z.message);return{failedRequests:j,errors:Q,erroredQueries:$.slice(0,20)}}function Z8(){let z={memoryUsedMb:null,memoryLimitMb:null,domContentLoadedMs:null,loadEventMs:null};if(typeof performance>"u")return z;let J=performance.memory;if(J)z.memoryUsedMb=Math.round(J.usedJSHeapSize/1024/1024),z.memoryLimitMb=Math.round(J.jsHeapSizeLimit/1024/1024);let[$]=performance.getEntriesByType("navigation");if($)z.domContentLoadedMs=Math.round($.domContentLoadedEventEnd),z.loadEventMs=Math.round($.loadEventEnd);return z}function x1(z,J){if(!z)return J;try{return z()}catch{return J}}function c2(){let z=I(),{pathname:J,search:$,href:j}=window.location;return{capturedAt:new Date().toISOString(),route:{href:j,pathname:J,search:$},module:l0(J),user:x1(z.user,{}),apiHeaders:L0(x1(z.headers,{})),app:{name:n().name,version:n().version,environment:n().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:Z8(),extra:x1(z.extra,{})}}var V8=2;function z1(z){let J=g2(),$=q2();return{context:c2(),reason:z.reason,note:z.note,cause:i2(J,$,z.erroredQueries),actionTrail:Y2(),network:J,console:$,screenshotDataUrl:z.screenshotDataUrl,screenshotMethod:z.screenshotMethod,replay:d2()??void 0,meta:{generatedBy:"lightwork-debug-capture",schemaVersion:V8}}}async function C1(){if(typeof navigator<"u"&&Boolean(navigator.mediaDevices?.getDisplayMedia)){let $=await W8();if($.status==="ok")return{dataUrl:$.dataUrl,method:"display-media"};if($.status==="cancelled")return{dataUrl:null,method:"cancelled"}}let J=await G8();if(J)return{dataUrl:J,method:"html-to-image"};return{dataUrl:null,method:"none"}}async function W8(){let z=null;try{let J={video:{frameRate:30},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"};z=await navigator.mediaDevices.getDisplayMedia(J);let $=await X8(z);return $?{status:"ok",dataUrl:$}:{status:"error"}}catch(J){if(J instanceof DOMException&&(J.name==="NotAllowedError"||J.name==="AbortError"))return{status:"cancelled"};return{status:"error"}}finally{z?.getTracks().forEach((J)=>J.stop())}}async function X8(z){let J=document.createElement("video");J.srcObject=z,J.muted=!0,J.playsInline=!0,await new Promise((W)=>{let G=!1,P=()=>{if(G)return;G=!0,W()};J.onloadedmetadata=()=>{J.play().then(P).catch(P)},window.setTimeout(P,1500)}),await K8(J);let{videoWidth:$,videoHeight:j}=J;if(!$||!j)return null;let Q=document.createElement("canvas");Q.width=$,Q.height=j;let Z=Q.getContext("2d");if(!Z)return null;Z.drawImage(J,0,0,$,j),J.pause(),J.srcObject=null;try{return Q.toDataURL("image/png")}catch{return null}}function K8(z){return new Promise((J)=>{let $=!1,j=()=>{if($)return;$=!0,J()},Q=z;if(typeof Q.requestVideoFrameCallback==="function")Q.requestVideoFrameCallback(()=>j()),window.setTimeout(j,1000);else window.setTimeout(j,250)})}async function G8(){let z=I().screenshotFallback;if(!z)return null;let J=await z().catch(()=>null);if(!J)return null;try{return await J(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:($)=>!($ instanceof HTMLElement&&$.dataset?.debugReporter==="true")})}catch{return null}}var Y8=2000,H8=0.82,P8=3000000;function U8(z){return new Promise((J,$)=>{let j=new Image;j.onload=()=>J(j),j.onerror=()=>$(Error("could not read the screenshot")),j.src=z})}async function J1(z){try{let J=await U8(z),$=Math.max(J.naturalWidth,J.naturalHeight),j=Math.min(1,Y8/$),Q=document.createElement("canvas");Q.width=Math.max(1,Math.round(J.naturalWidth*j)),Q.height=Math.max(1,Math.round(J.naturalHeight*j));let Z=Q.getContext("2d");if(!Z)return z;Z.fillStyle="#fff",Z.fillRect(0,0,Q.width,Q.height),Z.drawImage(J,0,0,Q.width,Q.height);let W=H8,G=Q.toDataURL("image/jpeg",W);while(G.length>P8&&W>0.4)W-=0.15,G=Q.toDataURL("image/jpeg",W);return G}catch{return z}}var F8=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,M8=/^\d+$/,q8=/^[0-9a-f]{16,}$/i;function l2(z){if(z.reason.type==="manual")return null;let J=z.cause?.failedRequests?.[0];if(!J?.url)return null;let $;try{$=new URL(J.url,"http://x").pathname}catch{$=J.url}let j=$.split("/").map((Z)=>F8.test(Z)||M8.test(Z)||q8.test(Z)?":id":Z).join("/"),Q=J.status??(J.error?"ERR":"?");return`${J.method??"REQ"} ${j} ${Q}`}var o2=2000000;function $1(z){let{screenshotDataUrl:J,replay:$,...j}=z;return JSON.stringify(j).length}function n2(z,J=2000000){if($1(z)<=J)return z;let $=z.network.map((Q)=>({...Q})),j={...z,network:$};for(let Q of $){if($1(j)<=J)return j;if(typeof Q.responseSnippet==="string"&&Q.responseSnippet.length>35)Q.responseSnippet="[body dropped — report size budget]";if(typeof Q.requestBody==="string"&&Q.requestBody.length>35)Q.requestBody="[body dropped — report size budget]"}while(j.network.length>1&&$1(j)>J)j.network=j.network.slice(1);while(j.console.length>1&&$1(j)>J)j.console=j.console.slice(1);return j}function E0(z){let J="";for(let $=0;$<z.length;$+=32768)J+=String.fromCharCode(...z.subarray($,$+32768));return btoa(J)}var D8=4,I8=2,N8=3,B8=0,x8=new Set(["href","src","action","formaction","xlink:href","data","poster","srcset"]),C8=/^\s*javascript:/i;function O8(z,J){let $=z.toLowerCase();if($.startsWith("on")||$==="srcdoc")return!0;return typeof J==="string"&&C8.test(J)}function r2(z,J=!1){if(!z)return;for(let $ of Object.keys(z)){let j=z[$];if(O8($,j)){if(J)z[$]=null;else delete z[$];continue}if(typeof j!=="string"||!x8.has($)||!j.includes("?"))continue;z[$]=J0(j)}}function O1(z){if(!z)return;r2(z.attributes);for(let J of z.childNodes??[])O1(J)}function s2(z){let J=JSON.parse(JSON.stringify(z));for(let $ of J){let j=$.data;if(!j||typeof j!=="object")continue;if($.type===D8&&typeof j.href==="string")j.href=J0(j.href);else if($.type===I8)O1(j.node);else if($.type===N8&&j.source===B8){for(let Q of j.adds??[])O1(Q.node);for(let Q of j.attributes??[])r2(Q.attributes,!0)}}return J}var w8="session-replay.json.gz",_8="session-replay.json";function S8(z){return Boolean(z&&z.events.length>0)}async function R8(z){if(typeof CompressionStream>"u")return null;try{let J=new Blob([z]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(J).arrayBuffer())}catch{return null}}async function t2(z,J){if(!S8(z))return{summary:{omitted:"empty"}};let j={seconds:Math.round(z.durationMs/1000),events:z.events.length,startedAt:z.startedAt,endedAt:z.endedAt},Q=s2(z.events),Z=await a2(Q),W=!1;if(Z.bytes.byteLength>J&&k8(Q))Q=T8(Q),Z=await a2(Q),W=!0;let{bytes:G,compressed:P}=Z;if(G.byteLength>J)return{summary:{...j,bytes:G.byteLength,omitted:"too-large"}};return{dataUri:`data:${P?"application/gzip":"application/json"};base64,${E0(G)}`,filename:P?w8:_8,summary:{...j,events:Q.length,bytes:G.byteLength,compressed:P,...W?{canvasDropped:W}:{}}}}async function a2(z){let J=new TextEncoder().encode(JSON.stringify({events:z})),$=await R8(J);return $?{bytes:$,compressed:!0}:{bytes:J,compressed:!1}}var L8=3,e2=2,A8=9;function z4(z){return z.type===L8&&z.data?.source===A8}function k8(z){return z.some(z4)||z.some((J)=>J.type===e2&&J4(J.data.node))}function J4(z){if(!z)return!1;if(z.attributes&&"rr_dataURL"in z.attributes)return!0;return(z.childNodes??[]).some(J4)}function $4(z){if(!z)return;if(z.attributes&&"rr_dataURL"in z.attributes)delete z.attributes.rr_dataURL;for(let J of z.childNodes??[])$4(J)}function T8(z){let J=[];for(let $ of z){if(z4($))continue;if($.type===e2)$4($.data.node);J.push($)}return J}var E8=new Set([502,503,504]);class r extends Error{kind;retryAfter;status;constructor(z,J,$,j){super(z);this.kind=J;this.retryAfter=$;this.status=j;this.name="ReportError"}}function f8(z){let{screenshotDataUrl:J,replay:$,...j}=z;return{dataUri:`data:application/json;base64,${E0(new TextEncoder().encode(JSON.stringify(j)))}`,filename:"debug-bundle.json"}}async function w1(){let z=I().identity;if(!z)return{};try{let J=await z();return J?{authorization:`Bearer ${J}`}:{}}catch{return{}}}async function j4(z,J){let $=I(),j=n2(J,o2),{context:Q,note:Z}=j,W=[];if(j.screenshotDataUrl){let O=await J1(j.screenshotDataUrl);W.push({dataUri:O,filename:"screenshot.jpg"})}W.push(f8(j));let G,P=_0();if(P){let O=await t2(j.replay,P.maxBytes);if(G=O.summary,"dataUri"in O)W.push({dataUri:O.dataUri,filename:O.filename})}let F=l2(j),L={title:z,description:Z.trim()||void 0,appName:n().name,category:Q.module?.label,routeUrl:Q.route.href,priority:"MEDIUM",requesterEmail:Q.user.email??void 0,requesterName:Q.user.fullName??void 0,customFields:{unit:Q.user.unit??"",appVersion:Q.app.version,environment:Q.app.environment,reasonType:j.reason.type,appName:n().name,module:Q.module?.label??""},context:{...F?{signature:F}:{},capturedAt:Q.capturedAt,reason:j.reason,cause:j.cause,actionTrail:j.actionTrail,client:Q.client,performance:Q.performance,apiHeaders:Q.apiHeaders,extra:Q.extra,counts:{network:j.network.length,console:j.console.length,actions:j.actionTrail.length},screenshotMethod:j.screenshotMethod,...G?{replay:G}:{}},attachments:W},w=await fetch(`${$.host.replace(/\/$/,"")}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,...await w1()},body:JSON.stringify(L)}).catch(()=>{throw new r("report never left the browser","offline")});if(!w.ok)throw await _1(w);return await w.json()}async function _1(z){let J=z.headers.get("retry-after"),$=await z.json().then((j)=>j.error).catch(()=>null);if(z.status===429)return new r("rate limited","rateLimited",J??void 0);if(E8.has(z.status))return new r("desk unavailable","unavailable");return new r($??`Report failed (${z.status})`,"rejected",void 0,z.status)}var j1=null,f0=null,Q4=()=>I().host.replace(/\/$/,"");function S1(){return j1}function N0(){if(f0)return f0;return f0=(async()=>{try{let z=await fetch(`${Q4()}/ingest/request-types`,{headers:{"x-realm-key":I().realmKey}}),J=z.ok?await z.json():null;j1=Array.isArray(J?.types)?J.types.filter(h8):[]}catch{j1=[],f0=null}return j1??[]})(),f0}function h8(z){let J=z;return!!J&&typeof J.id==="string"&&typeof J.name==="string"}async function Z4(z){let J=I(),$={};try{$=J.user?.()??{}}catch{$={}}let j=typeof window>"u"?null:window.location,Q={title:z.title,description:z.description.trim()||void 0,ticketTypeId:z.ticketTypeId,appName:n().name,category:j?l0(j.pathname)?.label:void 0,routeUrl:j?.href,priority:"MEDIUM",requesterEmail:$.email??void 0,requesterName:$.fullName??void 0,attachments:z.screenshotDataUrl?[{dataUri:await J1(z.screenshotDataUrl),filename:"screenshot.jpg"}]:void 0},Z=await fetch(`${Q4()}/ingest/tickets`,{method:"POST",headers:{"content-type":"application/json","x-realm-key":J.realmKey,...await w1()},body:JSON.stringify(Q)}).catch(()=>{throw new r("request never left the browser","offline")});if(!Z.ok)throw await _1(Z);return await Z.json()}var h0=Math.PI/6;function V4(z,J,$){let j=J.x-z.x,Q=J.y-z.y,Z=Math.hypot(j,Q),W=Math.atan2(Q,j),G=[{x:J.x,y:J.y},{x:J.x-$*Math.cos(W-h0),y:J.y-$*Math.sin(W-h0)},{x:J.x-$*Math.cos(W+h0),y:J.y-$*Math.sin(W+h0)}],P=$*Math.cos(h0)*0.92;if(Z<=P)return{shaft:null,head:G};return{shaft:{from:z,to:{x:J.x-P*Math.cos(W),y:J.y-P*Math.sin(W)}},head:G}}var R1="#f44336",b8="rgba(250, 204, 21, 0.4)",L1=22,W4="#2563eb",X4=9,K4=11,G4=18,Y4=4,Q1=8,m8=[{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 H4(z,J,$){let j=[],Q=null,Z=-1,W=null,G=null,P=z.getContext("2d");function F(){let V=z.getBoundingClientRect().width;return V>0?z.width/V:1}function L(V){let X=z.getBoundingClientRect();return{x:(V.clientX-X.left)/X.width*z.width,y:(V.clientY-X.top)/X.height*z.height}}function w(V){let X=V.size??L1;if(!P)return(V.text?.length??0)*X*0.6;P.save(),P.font=`600 ${X}px system-ui, sans-serif`;let Y=P.measureText(V.text??"").width;return P.restore(),Y}function O(V){if(V.tool==="text"){let X=V.size??L1;return{left:V.x1,top:V.y1,right:V.x1+w(V),bottom:V.y1+X*1.25}}return{left:Math.min(V.x1,V.x2),top:Math.min(V.y1,V.y2),right:Math.max(V.x1,V.x2),bottom:Math.max(V.y1,V.y2)}}function _(V){if(V.tool==="arrow")return[{id:"tail",x:V.x1,y:V.y1,cursor:"move"},{id:"head",x:V.x2,y:V.y2,cursor:"move"}];let X=O(V);if(V.tool==="text")return[{id:"size",x:X.right,y:X.bottom,cursor:"nwse-resize"}];return m8.map((Y)=>({id:Y.id,x:X.left+(X.right-X.left)*Y.fx,y:X.top+(X.bottom-X.top)*Y.fy,cursor:Y.cursor}))}function S(V){let X=O(V);return{x:X.right+G4*F(),y:X.top-G4*F()}}function c(V,X,Y){let{shaft:K,head:H}=V4({x:X.x1,y:X.y1},{x:X.x2,y:X.y2},Math.max(10,16*Y));if(K)V.lineCap="butt",V.beginPath(),V.moveTo(K.from.x,K.from.y),V.lineTo(K.to.x,K.to.y),V.stroke();V.beginPath(),V.moveTo(H[0].x,H[0].y),V.lineTo(H[1].x,H[1].y),V.lineTo(H[2].x,H[2].y),V.closePath(),V.fill()}function s(V,X,Y){V.save(),V.lineWidth=Math.max(2,3*Y),V.strokeStyle=R1,V.fillStyle=R1;let K=O(X);if(X.tool==="rect")V.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(X.tool==="arrow")c(V,X,Y);else if(X.tool==="highlight")V.fillStyle=b8,V.fillRect(K.left,K.top,K.right-K.left,K.bottom-K.top);else if(X.tool==="text"&&X.text){let H=X.size??L1;V.font=`600 ${H}px system-ui, sans-serif`,V.textBaseline="top";let M=H*0.22;V.fillStyle="rgba(255,255,255,0.92)",V.fillRect(K.left-M,K.top-M,K.right-K.left+M*2,K.bottom-K.top+M*2),V.fillStyle=R1,V.fillText(X.text,K.left,K.top)}V.restore()}function h(V,X,Y){let K=O(X);V.save(),V.strokeStyle=W4,V.lineWidth=Math.max(1,1.5*Y),V.setLineDash([6*Y,4*Y]),V.strokeRect(K.left,K.top,K.right-K.left,K.bottom-K.top),V.setLineDash([]);let H=X4*Y;for(let f of _(X))V.fillStyle="#fff",V.strokeStyle=W4,V.lineWidth=Math.max(1,1.5*Y),V.beginPath(),V.rect(f.x-H/2,f.y-H/2,H,H),V.fill(),V.stroke();let M=S(X),N=K4*Y;V.beginPath(),V.arc(M.x,M.y,N,0,Math.PI*2),V.fillStyle="#dc2626",V.fill(),V.strokeStyle="#fff",V.lineWidth=Math.max(1.5,2*Y),V.beginPath(),V.moveTo(M.x-N*0.4,M.y-N*0.4),V.lineTo(M.x+N*0.4,M.y+N*0.4),V.moveTo(M.x+N*0.4,M.y-N*0.4),V.lineTo(M.x-N*0.4,M.y+N*0.4),V.stroke(),V.restore()}function x(){if(!P)return;let V=F();if(P.clearRect(0,0,z.width,z.height),P.drawImage(J,0,0,z.width,z.height),j.forEach((Y,K)=>{if(K!==X0)s(P,Y,V)}),W)s(P,W,V);let X=j[Z];if(X&&!W)h(P,X,V)}function P0(V,X,Y,K,H){return Math.abs(V-Y)<=H&&Math.abs(X-K)<=H}function W0(V,X){let Y=j[Z];if(!Y)return null;let K=X4*F()/2+3*F();for(let H of _(Y))if(P0(V,X,H.x,H.y,K))return H.id;return null}function E(V,X){let Y=j[Z];if(!Y)return!1;let K=S(Y);return P0(V,X,K.x,K.y,K4*F())}function l(V,X){let Y=6*F();for(let K=j.length-1;K>=0;K-=1){let H=j[K];if(H.tool==="arrow"){let N=H.x2-H.x1,f=H.y2-H.y1,i=Math.hypot(N,f)||1,U=Math.max(0,Math.min(1,((V-H.x1)*N+(X-H.y1)*f)/(i*i)));if(Math.hypot(V-(H.x1+U*N),X-(H.y1+U*f))<=Y+4*F())return K;continue}let M=O(H);if(V>=M.left-Y&&V<=M.right+Y&&X>=M.top-Y&&X<=M.bottom+Y)return K}return-1}function T(V,X,Y,K,H){if(X==="tail"){V.x1=Y.x1+K,V.y1=Y.y1+H;return}if(X==="head"){V.x2=Y.x2+K,V.y2=Y.y2+H;return}if(X==="size"){let B=(Y.size??24)+H;V.size=Math.max(10,B);return}let M=O(Y),{left:N,top:f,right:i,bottom:U}=M;if(X.includes("w"))N=Math.min(i-Q1,N+K);if(X.includes("e"))i=Math.max(N+Q1,i+K);if(X.includes("n"))f=Math.min(U-Q1,f+H);if(X.includes("s"))U=Math.max(f+Q1,U+H);V.x1=N,V.y1=f,V.x2=i,V.y2=U}function d0(V,X,Y,K){V.x1=X.x1+Y,V.y1=X.y1+K,V.x2=X.x2+Y,V.y2=X.y2+K}let R=null,X0=-1,m={x:0,y:0,size:24};function w0(){let V=z.getBoundingClientRect().width;return V>0?V/z.width:1}function i0(V,X){if(!P)return V.length*X*0.6;P.save(),P.font=`600 ${X}px system-ui, sans-serif`;let Y=P.measureText(V||" ").width;return P.restore(),Y}function U0(){if(!R)return;let V=z.parentElement;if(!V)return;let X=z.getBoundingClientRect(),Y=V.getBoundingClientRect(),K=w0(),H=m.size*K;R.style.left=`${X.left-Y.left+m.x*K}px`,R.style.top=`${X.top-Y.top+m.y*K}px`,R.style.fontSize=`${H}px`,R.style.width=`${Math.max(40,i0(R.value,H)+H)}px`}function a(V){let X=R;if(!X)return;R=null;let Y=X.value.trim(),K=X0;if(X0=-1,X.remove(),V&&Y){if(K>=0&&j[K])j[K].text=Y,Z=K;else j.push({tool:"text",x1:m.x,y1:m.y,x2:m.x,y2:m.y,text:Y,size:m.size}),Z=j.length-1;$()}else if(K>=0)Z=K;z.focus(),x()}function o(V,X,Y=-1){a(!0);let K=z.parentElement;if(!K)return;if(getComputedStyle(K).position==="static")K.style.position="relative";let H=Y>=0?j[Y]:void 0;X0=Y,m={x:H?.x1??V,y:H?.y1??X,size:H?.size??Math.round(24*F())};let M=document.createElement("input");M.type="text",M.className="text-edit",M.value=H?.text??"",M.setAttribute("aria-label","ข้อความบนภาพ"),M.placeholder="ข้อความ",R=M,K.append(M),U0(),M.addEventListener("input",U0),M.addEventListener("keydown",(N)=>{if(N.stopPropagation(),N.key==="Enter")a(!0);else if(N.key==="Escape")a(!1)}),requestAnimationFrame(()=>{if(R!==M)return;M.focus(),M.select(),M.addEventListener("blur",()=>a(!0))}),x()}function u(V){let{x:X,y:Y}=L(V);if(z.setPointerCapture(V.pointerId),E(X,Y)){d();return}let K=W0(X,Y);if(K&&j[Z]){G={grip:K,x:X,y:Y,start:{...j[Z]}};return}if(Q==="text"){if(V.preventDefault(),z.hasPointerCapture(V.pointerId))z.releasePointerCapture(V.pointerId);Q=null,$(),o(X,Y);return}if(Q){W={tool:Q,x1:X,y1:Y,x2:X,y2:Y},Z=-1;return}let H=l(X,Y);Z=H,G=H>=0?{grip:"body",x:X,y:Y,start:{...j[H]}}:null,x()}function F0(V){let{x:X,y:Y}=L(V);if(W){W.x2=X,W.y2=Y,x();return}if(G){let H=j[Z];if(!H)return;let M=X-G.x,N=Y-G.y;if(G.grip==="body")d0(H,G.start,M,N);else T(H,G.grip,G.start,M,N);x();return}if(Q){z.style.cursor="crosshair";return}if(E(X,Y)){z.style.cursor="pointer";return}let K=W0(X,Y);if(K){let H=j[Z]?_(j[Z]).find((M)=>M.id===K):null;z.style.cursor=H?.cursor??"pointer";return}z.style.cursor=l(X,Y)>=0?"move":"default"}function K0(){if(W){if(!(Math.abs(W.x2-W.x1)<Y4&&Math.abs(W.y2-W.y1)<Y4))j.push(W),Z=j.length-1,Q=null,$();W=null}if(G)G=null,$();x()}function t(V){let X=z.getBoundingClientRect(),Y=(V.clientX-X.left)/X.width*z.width,K=(V.clientY-X.top)/X.height*z.height,H=l(Y,K),M=j[H];if(!M||M.tool!=="text")return;V.preventDefault(),o(M.x1,M.y1,H)}function e(V){if(Z<0)return;if(V.key==="Delete"||V.key==="Backspace")V.preventDefault(),d();else if(V.key==="Escape")V.preventDefault(),Z=-1,x()}function d(){if(Z<0)return;j.splice(Z,1),Z=-1,$(),x()}return z.addEventListener("pointerdown",u),z.addEventListener("pointermove",F0),z.addEventListener("pointerup",K0),z.addEventListener("pointercancel",K0),z.addEventListener("dblclick",t),z.tabIndex=0,z.addEventListener("keydown",e),x(),{setTool(V){Q=V,Z=-1,z.style.cursor=V?"crosshair":"default",x()},deleteSelected:d,clear(){j.length=0,Z=-1,$(),x()},hasShapes:()=>j.length>0,hasSelection:()=>Z>=0,toDataUrl(){let V=document.createElement("canvas");V.width=J.naturalWidth,V.height=J.naturalHeight;let X=V.getContext("2d");if(!X)return z.toDataURL("image/png");X.drawImage(J,0,0);let Y=F();for(let K of j)s(X,K,Y);return V.toDataURL("image/png")},destroy(){a(!1),z.removeEventListener("pointerdown",u),z.removeEventListener("pointermove",F0),z.removeEventListener("pointerup",K0),z.removeEventListener("pointercancel",K0),z.removeEventListener("dblclick",t),z.removeEventListener("keydown",e)}}}var g8=["keydown","keyup","keypress"];function b0(z){for(let J of g8)z.addEventListener(J,($)=>$.stopPropagation())}var P4=`
|
|
34
34
|
:host { all: initial; }
|
|
35
35
|
* { box-sizing: border-box; }
|
|
36
36
|
|
|
@@ -181,4 +181,122 @@ button.link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
|
|
|
181
181
|
.shot-choice input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
|
|
182
182
|
.dropped { opacity: 0.35; pointer-events: none; }
|
|
183
183
|
.draft { margin: -8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eff6ff; font-size: 13px; color: #1e3a8a; }
|
|
184
|
-
`;var k0="lw-debug-reporter",$0=null;function L6($,z){if($ instanceof l){if($.kind==="offline")return z.failedOffline;if($.kind==="unavailable")return z.failedUnavailable;if($.kind==="rateLimited")return z.failedTooMany.replace("{seconds}",$.retryAfter??"60");return $.message||z.failed}return z.failed}var E6=()=>[];var m6=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function g6(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;keep=null;returnFocus=null;constructor(){super();this.root=this.attachShadow({mode:"open"}),_2(this.root),this.root.addEventListener("keydown",(z)=>{let J=z;if(J.key!=="Escape"||J.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;J.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=g1((z)=>void this.open(z))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(z){if(this.busy)return;this.busy=!0;let J=document.activeElement;this.returnFocus=J instanceof HTMLElement&&J!==document.body?J:null;let j=m0(f().locale),Q=Q1();if(Q===null)F0();if(z.type==="manual"&&Q?.length){this.renderChooser(j,z);return}await this.report(z,j)}renderChooser(z,J){let j=this.shell(z);j.classList.add("narrow"),j.setAttribute("aria-label",z.chooseTitle);let Q=M("div","head"),Z=b("✕","icon");Z.setAttribute("aria-label",z.close),Z.addEventListener("click",()=>this.close()),Q.append(M("h2","",z.chooseTitle),Z);let Y=A2("problem",p6,z.kindProblem,z.chooseProblemHint);Y.dataset.choose="problem",Y.addEventListener("click",()=>{this.root.replaceChildren(),this.report(J,z)});let X=A2("request",T2,z.kindRequest,z.chooseRequestHint);X.dataset.choose="request",X.addEventListener("click",()=>{this.bundle=g0({reason:J,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:Y1()}),this.renderForm(z,J,"request")});let H=M("div","kinds choose");H.append(Y,X),H.addEventListener("keydown",(U)=>{if(!R2.includes(U.key))return;U.preventDefault(),(this.root.activeElement===Y?X:Y).focus()}),j.append(Q,H),Y.focus()}async switchToReport(z,J,j){this.root.replaceChildren();let Q=await $1();if(Q.method==="cancelled"){this.renderForm(z,J,"request",{...j,asking:!0});return}this.bundle=g0({reason:J,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:Y1()}),this.renderForm(z,J,"problem",j)}async report(z,J){let j=await $1();if(j.method==="cancelled"){this.close();return}this.bundle=g0({reason:z,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:Y1()}),this.renderForm(J,z,"problem")}close(z=!1){if(z)$0=null;else if(this.keep)$0=this.keep()??$0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let J=this.returnFocus;if(this.returnFocus=null,J?.isConnected)J.focus()}shell(z){let J=document.createElement("style");J.textContent=S2;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",z.title),j.append(Q),this.root.replaceChildren(J,j),Q}renderShell(z,J){let j=this.shell(z),Q=M("div","head");Q.append(M("h2","",z.title)),j.append(Q,M("p","status",J))}renderForm(z,J,j,Q){let Z=this.bundle;if(!Z)return;let Y=this.shell(z),X=j,H=j==="problem"||!!Z.screenshotDataUrl,U=null,A=M("div","head"),k=M("h2","",z.title),x=b("✕","icon");x.setAttribute("aria-label",z.close),x.addEventListener("click",()=>this.close()),A.append(k,x);let S=M("p","door");S.hidden=!0;let L=M("span"),i=b("","link");i.dataset.switchKind="",i.addEventListener("click",()=>W(X==="problem"?"request":"problem")),S.append(L,i);let n=M("div","ask");n.hidden=!0;let h=document.createElement("input");h.type="search",h.className="type-search",h.placeholder=z.requestTypeSearch,h.setAttribute("aria-label",z.requestTypeSearch),h.dataset.requestTypeSearch="",h.hidden=!0;let B=M("div","types");B.setAttribute("role","radiogroup"),B.setAttribute("aria-label",z.requestTypeLabel);let Z0=M("p","status",z.requestTypeNone);Z0.hidden=!0;let z0=M("p","status type-count","");z0.hidden=!0,n.append(u0(z.requestTypeLabel,"",!0),h,B,Z0,z0);let R=[],d=()=>{for(let D of R){let I=D.dataset.requestType===U?.id;D.setAttribute("aria-checked",String(I)),D.tabIndex=I?0:-1}let w=R.find((D)=>D.dataset.requestType===U?.id);if(w&&B.scrollHeight>B.clientHeight){let D=w.offsetTop-B.offsetTop;if(D<B.scrollTop)B.scrollTop=D;else if(D+w.offsetHeight>B.scrollTop+B.clientHeight)B.scrollTop=D+w.offsetHeight-B.clientHeight}},_=document.createElement("input");_.type="text";let C0=u0(""),C=document.createElement("textarea"),J0=u0(""),E=M("div","meta"),{context:H0}=Z,O0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${z.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,K0=(w,D)=>{let I=document.createElement("div"),N=document.createElement("b");N.textContent=`${w}: `;let O=document.createTextNode(D);return I.append(N,O),E.append(I),{b:N,v:O}};K0(z.reporter,`${H0.user.fullName??"—"} (${H0.user.email??"—"})`),K0(z.page,H0.route.href);let r=K0(z.captured,O0),c=document.createElement("label");c.className="shot-choice",c.hidden=!0;let y=document.createElement("input");y.type="checkbox",y.checked=!0,y.dataset.requestShot="",c.append(y,document.createTextNode(` ${z.requestWithShot}`));let Y0=Z.screenshotDataUrl?this.screenshotSection(z,Z.screenshotDataUrl):[M("p","status",z.noScreenshot)],j0=Z.screenshotDataUrl?Y0[0]:null;if(!Z.screenshotDataUrl)c.replaceChildren();let s=M("p","status",""),a=b(z.submit,"primary"),v=()=>{a.disabled=_.value.trim().length===0||X==="request"&&!U};_.addEventListener("input",v);let K=()=>{let w=X==="request";if(k.textContent=w?z.requestTitle:z.title,Y.setAttribute("aria-label",w?z.requestTitle:z.title),L.textContent=`${w?z.problemInstead:z.askInstead} `,i.textContent=w?H?z.problemInsteadAction:z.problemInsteadShare:z.askInsteadAction,n.hidden=!w,i0(C0,w?z.requestSummaryLabel:z.summaryLabel,w?"":z.summaryRequired,!0),_.placeholder=w?z.requestSummaryPlaceholder:z.summaryPlaceholder,i0(J0,w?z.requestDetailLabel:z.detailLabel),C.placeholder=w?z.requestDetailPlaceholder:z.detailPlaceholder,r.b.textContent=`${w?z.requestLeaves:z.captured}: `,r.v.textContent=w?z.requestLeavesWhat:O0,c.hidden=!w||!Z.screenshotDataUrl,j0)i0(j0,w?z.requestAnnotateHint:z.annotateHint);for(let D of Y0)D.classList.toggle("dropped",w&&!y.checked),D.hidden=w&&!Z.screenshotDataUrl;a.textContent=w?z.requestSubmit:z.submit,v()};y.addEventListener("change",K);let W=(w)=>{if(w===X)return;if(w==="problem"&&!H){this.switchToReport(z,J,{title:_.value,detail:C.value,asking:!1,typeId:U?.id??null});return}X=w,K()},V=(w)=>{if(this.bundle!==Z||J.type!=="manual"||!w.length)return;U=w[0],R.length=0;for(let I of w){let N=b("","type");N.setAttribute("role","radio"),N.dataset.requestType=I.id;let O=M("span","type-body");if(O.append(M("b","",I.name)),I.description)O.append(M("span","type-hint",I.description));if(I.targetHours){let W0=M("span","type-due");W0.append(d0(y6),document.createTextNode(z.requestTarget.replace("{time}",b6(z,I.targetHours)))),O.append(W0)}N.append(d0(T2),O),N.addEventListener("click",()=>{U=I,d(),v()}),R.push(N)}B.replaceChildren(...R),B.onkeydown=(I)=>{if(!R2.includes(I.key)||!U)return;I.preventDefault();let N=w.filter((Q0,g2)=>!R[g2].hidden);if(!N.length)return;let O=N.findIndex((Q0)=>Q0.id===U.id),W0=I.key==="ArrowUp"||I.key==="ArrowLeft"?-1:1;U=N[O<0?0:(O+W0+N.length)%N.length],d(),R.find((Q0)=>Q0.dataset.requestType===U.id)?.focus()},B.classList.toggle("long",w.length>=W1),h.hidden=w.length<W1;let D=(I)=>{z0.hidden=w.length<W1||I===0,z0.textContent=z.requestTypeCount.replace("{n}",String(I))};D(w.length),h.oninput=()=>{let I=h.value.trim().toLowerCase(),N=null;if(w.forEach((O,W0)=>{let Q0=!I||`${O.name} ${O.description}`.toLowerCase().includes(I);if(R[W0].hidden=!Q0,Q0&&!N)N=O}),Z0.hidden=!!N,D(R.filter((O)=>!O.hidden).length),N&&U&&R[w.indexOf(U)].hidden)U=N;d(),v()},h.onkeydown=(I)=>{if(I.key==="ArrowDown"||I.key==="Enter")I.preventDefault(),R.find((N)=>N.dataset.requestType===U?.id&&!N.hidden)?.focus()},d(),S.hidden=!1,K()},G=Q??($0&&($0.title||$0.detail)?$0:null),F=M("p","draft");if(F.hidden=!G||!!Q,G){_.value=G.title,C.value=G.detail;let w=b(z.draftClear,"link");w.dataset.draftClear="",w.addEventListener("click",()=>{_.value="",C.value="",$0=null,F.hidden=!0,v(),_.focus()}),F.append(document.createTextNode(`${z.draftRestored} · `),w)}let P=Q1(),q=(w)=>{if(V(w),X!=="request"||S.hidden||!G?.typeId)return;let D=w.find((I)=>I.id===G.typeId);if(D)U=D,d()};if(P)q(P);else if(J.type==="manual")F0().then(q);this.keep=()=>({title:_.value,detail:C.value,asking:X==="request",typeId:U?.id??null}),Y.append(A,S,F,n,C0,_,J0,C,E,c,...Y0);let T=M("div","foot"),u=b(z.close);u.addEventListener("click",()=>this.close()),T.append(u,s,M("span","grow"),a),Y.append(T),K(),a.addEventListener("click",async()=>{a.disabled=!0,s.dataset.tone="",s.textContent=z.submitting;let w=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(X==="request"&&U){let N=await D2({ticketTypeId:U.id,title:_.value.trim(),description:C.value,screenshotDataUrl:y.checked?w():null}),O=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:N,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),O)X0(`${z.requestSubmitted} — #${N.number}`,"success");return}let D=await M2(_.value.trim(),{...Z,note:C.value,screenshotDataUrl:w()}),I=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:D,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),I)X0(`${z.submitted} — #${D.number}`,"success")}catch(D){let I=L6(D,z);s.dataset.tone="error",s.textContent=I,X0(I,"error"),v()}}),_.focus()}screenshotSection(z,J){let j=u0(z.annotateHint),Q=M("div","tools"),Z=document.createElement("canvas"),Y=M("div","shot");Y.append(Z);let X=[],H=(x)=>{for(let S of X)S.setAttribute("aria-pressed",String(S===x))};for(let{tool:x,key:S}of m6){let L=b(z[S]);L.setAttribute("aria-pressed","false"),L.addEventListener("click",()=>{let i=L.getAttribute("aria-pressed")==="true";H(i?null:L),this.annotator?.setTool(i?null:x)}),X.push(L),Q.append(L)}Q.append(M("span","sep"));let U=b(z.deleteSelected);U.addEventListener("click",()=>this.annotator?.deleteSelected());let A=b(z.clearAll);A.addEventListener("click",()=>{this.annotator?.clear(),H(null)}),Q.append(U,A);let k=new Image;return k.onload=()=>{Z.width=k.naturalWidth,Z.height=k.naturalHeight,this.annotator=f2(Z,k,()=>{H(null),U.disabled=!this.annotator?.hasSelection()})},k.src=J,[j,Q,M("p","status",z.annotateHelp),Y]}}}function Y1(){try{return E6()}catch{return[]}}function M($,z="",J=""){let j=document.createElement($);if(z)j.className=z;if(J)j.textContent=J;return j}function b6($,z){return z>=24&&z%24===0?$.days.replace("{n}",String(z/24)):$.hours.replace("{n}",String(z))}var R2=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],W1=7,p6=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],T2=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],y6=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],v6=[["path",{d:"M20 6 9 17l-5-5"}]],h2="http://www.w3.org/2000/svg";function A2($,z,J,j){let Q=b("","kind");Q.dataset.kind=$;let Z=M("span","kind-top");return Z.append(d0(z),M("b","",J)),Q.append(Z,M("span","kind-hint",j),d0(v6,"tick")),Q}function d0($,z="icon"){let J=document.createElementNS(h2,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:z}))J.setAttribute(j,Q);for(let[j,Q]of $){let Z=document.createElementNS(h2,j);for(let[Y,X]of Object.entries(Q))Z.setAttribute(Y,X);J.append(Z)}return J}function b($,z=""){let J=document.createElement("button");if(J.type="button",J.textContent=$,z)J.className=z;return J}function u0($,z="",J=!1){return i0(document.createElement("label"),$,z,J)}function i0($,z,J="",j=!1){if($.replaceChildren(document.createTextNode(z)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",$.append(Q)}if(J){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${J}`,$.append(Q)}return $}function L2(){if(typeof window>"u"||customElements.get(k0))return;customElements.define(k0,g6())}var E2=!1;function G1($={}){if(E2||typeof window>"u")return;if(!f0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(E2=!0,t1(),T1(),C1(),i1(),j2(),$.ui===!1)return;let z=m0(f().locale);if(b1((j)=>{X0(j.message??z.crashed,"error",{label:z.crashAction,onClick:()=>A0(j)})}),L2(),!document.querySelector(k0))document.body.append(document.createElement(k0));let J=window.requestIdleCallback;if(J)J(()=>void F0(),{timeout:5000});else setTimeout(()=>void F0(),2000)}var m2=document.currentScript,p=m2?.dataset??{},u6="rrweb-record.mjs";J2(()=>import(new URL(u6,m2?.src??location.href).href));function i6($){if(!$)return{};try{let z=JSON.parse($);if(!z||typeof z!=="object"||Array.isArray(z))return{};return Object.fromEntries(Object.entries(z).filter(([,J])=>typeof J==="string"&&J.trim()))}catch{return{}}}if(p.host&&p.realmKey)if(X1({host:p.host,realmKey:p.realmKey,app:{name:p.appName??document.title??"app",version:p.appVersion??"0.0.0",environment:p.environment??"production"},module:w1(i6(p.modules)),locale:p.locale==="en"?"en":"th",...p.replay!==void 0?{replay:{seconds:Number(p.replay)||void 0}}:{}}),document.body)G1();else document.addEventListener("DOMContentLoaded",()=>G1(),{once:!0});window.lwReportProblem=A0;})();
|
|
184
|
+
`;var m0="lw-debug-reporter",$0=null;function v8(z,J){if(z instanceof r){if(z.kind==="offline")return J.failedOffline;if(z.kind==="unavailable")return J.failedUnavailable;if(z.kind==="rateLimited")return J.failedTooMany.replace("{seconds}",z.retryAfter??"60");return z.message||J.failed}return J.failed}var y8=()=>[];var p8=[{tool:"rect",key:"toolRect"},{tool:"arrow",key:"toolArrow"},{tool:"highlight",key:"toolHighlight"},{tool:"text",key:"toolText"}];function u8(){return class extends HTMLElement{root;stop=null;annotator=null;bundle=null;busy=!1;keep=null;returnFocus=null;constructor(){super();this.root=this.attachShadow({mode:"open"}),b0(this.root),this.root.addEventListener("keydown",(J)=>{let $=J;if($.key!=="Escape"||$.defaultPrevented||!this.root.querySelector("[role=dialog]"))return;$.preventDefault(),this.close()})}connectedCallback(){this.dataset.debugReporter="true",this.stop=x2((J)=>void this.open(J))}disconnectedCallback(){this.stop?.(),this.stop=null,this.close()}async open(J){if(this.busy)return;this.busy=!0;let $=document.activeElement;this.returnFocus=$ instanceof HTMLElement&&$!==document.body?$:null;let j=Y0(I().locale),Q=S1();if(Q===null)N0();if(J.type==="manual"&&Q?.length){this.renderChooser(j,J);return}await this.report(J,j)}renderChooser(J,$){let j=this.shell(J);j.classList.add("narrow"),j.setAttribute("aria-label",J.chooseTitle);let Q=D("div","head"),Z=y("✕","icon");Z.setAttribute("aria-label",J.close),Z.addEventListener("click",()=>this.close()),Q.append(D("h2","",J.chooseTitle),Z);let W=q4("problem",i8,J.kindProblem,J.chooseProblemHint);W.dataset.choose="problem",W.addEventListener("click",()=>{this.root.replaceChildren(),this.report($,J)});let G=q4("request",F4,J.kindRequest,J.chooseRequestHint);G.dataset.choose="request",G.addEventListener("click",()=>{this.bundle=z1({reason:$,note:"",screenshotDataUrl:null,screenshotMethod:"none",erroredQueries:A1()}),this.renderForm(J,$,"request")});let P=D("div","kinds choose");P.append(W,G),P.addEventListener("keydown",(F)=>{if(!U4.includes(F.key))return;F.preventDefault(),(this.root.activeElement===W?G:W).focus()}),j.append(Q,P),W.focus()}async switchToReport(J,$,j){this.root.replaceChildren();let Q=await C1();if(Q.method==="cancelled"){this.renderForm(J,$,"request",{...j,asking:!0});return}this.bundle=z1({reason:$,note:"",screenshotDataUrl:Q.dataUrl,screenshotMethod:Q.method,erroredQueries:A1()}),this.renderForm(J,$,"problem",j)}async report(J,$){let j=await C1();if(j.method==="cancelled"){this.close();return}this.bundle=z1({reason:J,note:"",screenshotDataUrl:j.dataUrl,screenshotMethod:j.method,erroredQueries:A1()}),this.renderForm($,J,"problem")}close(J=!1){if(J)$0=null;else if(this.keep)$0=this.keep()??$0;this.keep=null,this.annotator?.destroy(),this.annotator=null,this.bundle=null,this.busy=!1,this.root.replaceChildren();let $=this.returnFocus;if(this.returnFocus=null,$?.isConnected)$.focus()}shell(J){let $=document.createElement("style");$.textContent=P4;let j=document.createElement("div");j.className="backdrop";let Q=document.createElement("div");return Q.className="panel",Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label",J.title),j.append(Q),this.root.replaceChildren($,j),Q}renderShell(J,$){let j=this.shell(J),Q=D("div","head");Q.append(D("h2","",J.title)),j.append(Q,D("p","status",$))}renderForm(J,$,j,Q){let Z=this.bundle;if(!Z)return;let W=this.shell(J),G=j,P=j==="problem"||!!Z.screenshotDataUrl,F=null,L=D("div","head"),w=D("h2","",J.title),O=y("✕","icon");O.setAttribute("aria-label",J.close),O.addEventListener("click",()=>this.close()),L.append(w,O);let _=D("p","door");_.hidden=!0;let S=D("span"),c=y("","link");c.dataset.switchKind="",c.addEventListener("click",()=>X(G==="problem"?"request":"problem")),_.append(S,c);let s=D("div","ask");s.hidden=!0;let h=document.createElement("input");h.type="search",h.className="type-search",h.placeholder=J.requestTypeSearch,h.setAttribute("aria-label",J.requestTypeSearch),h.dataset.requestTypeSearch="",h.hidden=!0;let x=D("div","types");x.setAttribute("role","radiogroup"),x.setAttribute("aria-label",J.requestTypeLabel);let P0=D("p","status",J.requestTypeNone);P0.hidden=!0;let W0=D("p","status type-count","");W0.hidden=!0,s.append(Z1(J.requestTypeLabel,"",!0),h,x,P0,W0);let E=[],l=()=>{for(let B of E){let q=B.dataset.requestType===F?.id;B.setAttribute("aria-checked",String(q)),B.tabIndex=q?0:-1}let U=E.find((B)=>B.dataset.requestType===F?.id);if(U&&x.scrollHeight>x.clientHeight){let B=U.offsetTop-x.offsetTop;if(B<x.scrollTop)x.scrollTop=B;else if(B+U.offsetHeight>x.scrollTop+x.clientHeight)x.scrollTop=B+U.offsetHeight-x.clientHeight}},T=document.createElement("input");T.type="text";let d0=Z1(""),R=document.createElement("textarea"),X0=Z1(""),m=D("div","meta"),{context:w0}=Z,i0=`${Z.network.length} network · ${Z.console.length} console · ${Z.actionTrail.length} actions${Z.replay?` · ${J.replay} ${Math.round(Z.replay.durationMs/1000)}s`:""}`,U0=(U,B)=>{let q=document.createElement("div"),C=document.createElement("b");C.textContent=`${U}: `;let A=document.createTextNode(B);return q.append(C,A),m.append(q),{b:C,v:A}};U0(J.reporter,`${w0.user.fullName??"—"} (${w0.user.email??"—"})`),U0(J.page,w0.route.href);let a=U0(J.captured,i0),o=document.createElement("label");o.className="shot-choice",o.hidden=!0;let u=document.createElement("input");u.type="checkbox",u.checked=!0,u.dataset.requestShot="",o.append(u,document.createTextNode(` ${J.requestWithShot}`));let F0=Z.screenshotDataUrl?this.screenshotSection(J,Z.screenshotDataUrl):[D("p","status",J.noScreenshot)],K0=Z.screenshotDataUrl?F0[0]:null;if(!Z.screenshotDataUrl)o.replaceChildren();let t=D("p","status",""),e=y(J.submit,"primary"),d=()=>{e.disabled=T.value.trim().length===0||G==="request"&&!F};T.addEventListener("input",d);let V=()=>{let U=G==="request";if(w.textContent=U?J.requestTitle:J.title,W.setAttribute("aria-label",U?J.requestTitle:J.title),S.textContent=`${U?J.problemInstead:J.askInstead} `,c.textContent=U?P?J.problemInsteadAction:J.problemInsteadShare:J.askInsteadAction,s.hidden=!U,V1(d0,U?J.requestSummaryLabel:J.summaryLabel,U?"":J.summaryRequired,!0),T.placeholder=U?J.requestSummaryPlaceholder:J.summaryPlaceholder,V1(X0,U?J.requestDetailLabel:J.detailLabel),R.placeholder=U?J.requestDetailPlaceholder:J.detailPlaceholder,a.b.textContent=`${U?J.requestLeaves:J.captured}: `,a.v.textContent=U?J.requestLeavesWhat:i0,o.hidden=!U||!Z.screenshotDataUrl,K0)V1(K0,U?J.requestAnnotateHint:J.annotateHint);for(let B of F0)B.classList.toggle("dropped",U&&!u.checked),B.hidden=U&&!Z.screenshotDataUrl;e.textContent=U?J.requestSubmit:J.submit,d()};u.addEventListener("change",V);let X=(U)=>{if(U===G)return;if(U==="problem"&&!P){this.switchToReport(J,$,{title:T.value,detail:R.value,asking:!1,typeId:F?.id??null});return}G=U,V()},Y=(U)=>{if(this.bundle!==Z||$.type!=="manual"||!U.length)return;F=U[0],E.length=0;for(let q of U){let C=y("","type");C.setAttribute("role","radio"),C.dataset.requestType=q.id;let A=D("span","type-body");if(A.append(D("b","",q.name)),q.description)A.append(D("span","type-hint",q.description));if(q.targetHours){let M0=D("span","type-due");M0.append(W1(c8),document.createTextNode(J.requestTarget.replace("{time}",d8(J,q.targetHours)))),A.append(M0)}C.append(W1(F4),A),C.addEventListener("click",()=>{F=q,l(),d()}),E.push(C)}x.replaceChildren(...E),x.onkeydown=(q)=>{if(!U4.includes(q.key)||!F)return;q.preventDefault();let C=U.filter((G0,u4)=>!E[u4].hidden);if(!C.length)return;let A=C.findIndex((G0)=>G0.id===F.id),M0=q.key==="ArrowUp"||q.key==="ArrowLeft"?-1:1;F=C[A<0?0:(A+M0+C.length)%C.length],l(),E.find((G0)=>G0.dataset.requestType===F.id)?.focus()},x.classList.toggle("long",U.length>=k1),h.hidden=U.length<k1;let B=(q)=>{W0.hidden=U.length<k1||q===0,W0.textContent=J.requestTypeCount.replace("{n}",String(q))};B(U.length),h.oninput=()=>{let q=h.value.trim().toLowerCase(),C=null;if(U.forEach((A,M0)=>{let G0=!q||`${A.name} ${A.description}`.toLowerCase().includes(q);if(E[M0].hidden=!G0,G0&&!C)C=A}),P0.hidden=!!C,B(E.filter((A)=>!A.hidden).length),C&&F&&E[U.indexOf(F)].hidden)F=C;l(),d()},h.onkeydown=(q)=>{if(q.key==="ArrowDown"||q.key==="Enter")q.preventDefault(),E.find((C)=>C.dataset.requestType===F?.id&&!C.hidden)?.focus()},l(),_.hidden=!1,V()},K=Q??($0&&($0.title||$0.detail)?$0:null),H=D("p","draft");if(H.hidden=!K||!!Q,K){T.value=K.title,R.value=K.detail;let U=y(J.draftClear,"link");U.dataset.draftClear="",U.addEventListener("click",()=>{T.value="",R.value="",$0=null,H.hidden=!0,d(),T.focus()}),H.append(document.createTextNode(`${J.draftRestored} · `),U)}let M=S1(),N=(U)=>{if(Y(U),G!=="request"||_.hidden||!K?.typeId)return;let B=U.find((q)=>q.id===K.typeId);if(B)F=B,l()};if(M)N(M);else if($.type==="manual")N0().then(N);this.keep=()=>({title:T.value,detail:R.value,asking:G==="request",typeId:F?.id??null}),W.append(L,_,H,s,d0,T,X0,R,m,o,...F0);let f=D("div","foot"),i=y(J.close);i.addEventListener("click",()=>this.close()),f.append(i,t,D("span","grow"),e),W.append(f),V(),e.addEventListener("click",async()=>{e.disabled=!0,t.dataset.tone="",t.textContent=J.submitting;let U=()=>this.annotator?.hasShapes()?this.annotator.toDataUrl():Z.screenshotDataUrl;try{if(G==="request"&&F){let C=await Z4({ticketTypeId:F.id,title:T.value.trim(),description:R.value,screenshotDataUrl:u.checked?U():null}),A=this.dispatchEvent(new CustomEvent("lw-request-submitted",{detail:C,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),A)I0(`${J.requestSubmitted} — #${C.number}`,"success");return}let B=await j4(T.value.trim(),{...Z,note:R.value,screenshotDataUrl:U()}),q=this.dispatchEvent(new CustomEvent("lw-report-submitted",{detail:B,bubbles:!0,composed:!0,cancelable:!0}));if(this.close(!0),q)I0(`${J.submitted} — #${B.number}`,"success")}catch(B){let q=v8(B,J);t.dataset.tone="error",t.textContent=q,I0(q,"error"),d()}}),T.focus()}screenshotSection(J,$){let j=Z1(J.annotateHint),Q=D("div","tools"),Z=document.createElement("canvas"),W=D("div","shot");W.append(Z);let G=[],P=(O)=>{for(let _ of G)_.setAttribute("aria-pressed",String(_===O))};for(let{tool:O,key:_}of p8){let S=y(J[_]);S.setAttribute("aria-pressed","false"),S.addEventListener("click",()=>{let c=S.getAttribute("aria-pressed")==="true";P(c?null:S),this.annotator?.setTool(c?null:O)}),G.push(S),Q.append(S)}Q.append(D("span","sep"));let F=y(J.deleteSelected);F.addEventListener("click",()=>this.annotator?.deleteSelected());let L=y(J.clearAll);L.addEventListener("click",()=>{this.annotator?.clear(),P(null)}),Q.append(F,L);let w=new Image;return w.onload=()=>{Z.width=w.naturalWidth,Z.height=w.naturalHeight,this.annotator=H4(Z,w,()=>{P(null),F.disabled=!this.annotator?.hasSelection()})},w.src=$,[j,Q,D("p","status",J.annotateHelp),W]}}}function A1(){try{return y8()}catch{return[]}}function D(z,J="",$=""){let j=document.createElement(z);if(J)j.className=J;if($)j.textContent=$;return j}function d8(z,J){return J>=24&&J%24===0?z.days.replace("{n}",String(J/24)):z.hours.replace("{n}",String(J))}var U4=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"],k1=7,i8=[["path",{d:"M12 20v-9"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"}],["path",{d:"M14.12 3.88 16 2"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97"}],["path",{d:"M22 13h-4"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97"}],["path",{d:"M6 13H2"}],["path",{d:"m8 2 1.88 1.88"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13"}]],F4=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"}]],c8=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]],l8=[["path",{d:"M20 6 9 17l-5-5"}]],M4="http://www.w3.org/2000/svg";function q4(z,J,$,j){let Q=y("","kind");Q.dataset.kind=z;let Z=D("span","kind-top");return Z.append(W1(J),D("b","",$)),Q.append(Z,D("span","kind-hint",j),W1(l8,"tick")),Q}function W1(z,J="icon"){let $=document.createElementNS(M4,"svg");for(let[j,Q]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",class:J}))$.setAttribute(j,Q);for(let[j,Q]of z){let Z=document.createElementNS(M4,j);for(let[W,G]of Object.entries(Q))Z.setAttribute(W,G);$.append(Z)}return $}function y(z,J=""){let $=document.createElement("button");if($.type="button",$.textContent=z,J)$.className=J;return $}function Z1(z,J="",$=!1){return V1(document.createElement("label"),z,J,$)}function V1(z,J,$="",j=!1){if(z.replaceChildren(document.createTextNode(J)),j){let Q=document.createElement("span");Q.className="req",Q.textContent=" *",z.append(Q)}if($){let Q=document.createElement("span");Q.className="hint",Q.textContent=` ${$}`,z.append(Q)}return z}function D4(){if(typeof window>"u"||customElements.get(m0))return;customElements.define(m0,u8())}var I4=138.23,g3=`
|
|
185
|
+
:host { all: initial; }
|
|
186
|
+
.backdrop {
|
|
187
|
+
position: fixed; inset: 0; z-index: 2147483002;
|
|
188
|
+
display: grid; place-items: center; padding: 20px;
|
|
189
|
+
background: rgba(15, 23, 42, 0.45);
|
|
190
|
+
-webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
|
|
191
|
+
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
|
|
192
|
+
opacity: 0; transition: opacity 180ms ease;
|
|
193
|
+
}
|
|
194
|
+
.backdrop[data-open="1"] { opacity: 1; }
|
|
195
|
+
|
|
196
|
+
.card {
|
|
197
|
+
width: min(360px, 100%); box-sizing: border-box;
|
|
198
|
+
padding: 24px 24px 18px; text-align: center;
|
|
199
|
+
background: #fff; border-radius: 16px;
|
|
200
|
+
box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
|
|
201
|
+
transform: translateY(8px) scale(0.97); opacity: 0;
|
|
202
|
+
transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), opacity 160ms ease;
|
|
203
|
+
}
|
|
204
|
+
.backdrop[data-open="1"] .card { transform: none; opacity: 1; }
|
|
205
|
+
|
|
206
|
+
/* The number is centred by the box, not by a margin guessed against the
|
|
207
|
+
font's line-height — Thai and Latin digits do not share one. */
|
|
208
|
+
.dial { position: relative; width: 56px; height: 56px; margin: 0 auto 14px; }
|
|
209
|
+
.ring { display: block; width: 100%; height: 100%; }
|
|
210
|
+
.ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
|
|
211
|
+
.ring .track { stroke: #e2e8f0; }
|
|
212
|
+
.ring .bar {
|
|
213
|
+
stroke: #0ea5e9; transform: rotate(-90deg); transform-origin: 50% 50%;
|
|
214
|
+
stroke-dasharray: ${I4}; stroke-dashoffset: 0;
|
|
215
|
+
animation: deplete var(--secs, 3s) linear forwards;
|
|
216
|
+
}
|
|
217
|
+
@keyframes deplete { to { stroke-dashoffset: ${I4}; } }
|
|
218
|
+
.count {
|
|
219
|
+
position: absolute; inset: 0; display: grid; place-items: center;
|
|
220
|
+
font-size: 18px; font-weight: 600; color: #0f172a;
|
|
221
|
+
font-variant-numeric: tabular-nums; line-height: 1;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/* The spinner replaces the ring once the countdown is over but the token has
|
|
225
|
+
not arrived — rare, and better than a frozen 0. */
|
|
226
|
+
.spinner { animation: spin 900ms linear infinite; }
|
|
227
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
228
|
+
|
|
229
|
+
h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: #0f172a; }
|
|
230
|
+
p { margin: 0; font-size: 13px; line-height: 1.6; color: #475569; }
|
|
231
|
+
.host { margin-top: 8px; font-size: 12px; color: #94a3b8; word-break: break-all; }
|
|
232
|
+
|
|
233
|
+
.actions { display: flex; gap: 8px; margin-top: 20px; }
|
|
234
|
+
/* The anchor too: when a blocked tab turns the primary action into a link, it
|
|
235
|
+
has to be the same object it was a moment ago. Styling only the button left it
|
|
236
|
+
with the dark fill and none of the shape: an underlined black smear. */
|
|
237
|
+
.actions button, .actions a {
|
|
238
|
+
flex: 1; box-sizing: border-box;
|
|
239
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
240
|
+
padding: 9px 12px; border-radius: 9px; font: inherit; font-size: 14px;
|
|
241
|
+
text-decoration: none; cursor: pointer;
|
|
242
|
+
transition: background 120ms ease, border-color 120ms ease;
|
|
243
|
+
}
|
|
244
|
+
.go { border: none; background: #0f172a; color: #fff; font-weight: 600; }
|
|
245
|
+
.go:hover { background: #1e293b; }
|
|
246
|
+
.cancel { border: 1px solid #e2e8f0; background: #fff; color: #334155; }
|
|
247
|
+
.cancel:hover { background: #f8fafc; }
|
|
248
|
+
.actions button:focus-visible, .actions a:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }
|
|
249
|
+
|
|
250
|
+
.error h2 { color: #b91c1c; }
|
|
251
|
+
|
|
252
|
+
@media (prefers-reduced-motion: reduce) {
|
|
253
|
+
/* Movement goes; the countdown does not — it is information, not decoration,
|
|
254
|
+
and someone who has asked for less motion still needs to know they are
|
|
255
|
+
about to be sent somewhere. */
|
|
256
|
+
.backdrop, .card { transition: opacity 120ms ease; }
|
|
257
|
+
.card { transform: none; }
|
|
258
|
+
.ring .bar { animation: none; stroke-dashoffset: 0; }
|
|
259
|
+
.spinner { animation-duration: 2s; }
|
|
260
|
+
}
|
|
261
|
+
`;var o8="/sso";function n8(z,J,$,j){let Q=new URL(o8,z.endsWith("/")?z:`${z}/`);if(Q.searchParams.set("realm",J),Q.searchParams.set("token",$),j)Q.searchParams.set("return",j);return Q.toString()}class T1 extends Error{constructor(z="No identity provider is configured, or nobody is signed in"){super(z);this.name="NoIdentityError"}}async function r8(z){let J=I();if(!J.identity)throw new T1;let $=await J.identity();if(!$)throw new T1;return n8(J.host,J.realmKey,$,z)}var N4=r8;var s8="lw-call-ring",a8=`
|
|
262
|
+
:host { all: initial; }
|
|
263
|
+
.card {
|
|
264
|
+
position: fixed; right: 16px; bottom: 16px; z-index: 2147483002;
|
|
265
|
+
width: min(340px, calc(100vw - 32px)); box-sizing: border-box;
|
|
266
|
+
padding: 16px; border-radius: 16px; background: #fff; color: #0f172a;
|
|
267
|
+
border: 1px solid #e2e8f0; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
|
|
268
|
+
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
|
|
269
|
+
animation: in 200ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
270
|
+
}
|
|
271
|
+
@media (max-width: 480px) { .card { right: 8px; left: 8px; bottom: 8px; width: auto; } }
|
|
272
|
+
.head { display: flex; align-items: center; gap: 12px; }
|
|
273
|
+
.icon {
|
|
274
|
+
position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%;
|
|
275
|
+
display: grid; place-items: center; background: #ecfdf5; color: #059669;
|
|
276
|
+
}
|
|
277
|
+
.icon::after {
|
|
278
|
+
content: ""; position: absolute; inset: 0; border-radius: 50%;
|
|
279
|
+
background: rgba(16, 185, 129, 0.25); animation: ping 1.4s ease-out infinite;
|
|
280
|
+
}
|
|
281
|
+
.icon svg { position: relative; width: 20px; height: 20px; }
|
|
282
|
+
h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
|
|
283
|
+
.about { margin: 2px 0 0; font-size: 12px; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }
|
|
284
|
+
.how { margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: #64748b; }
|
|
285
|
+
.how a { color: #0369a1; font-weight: 600; }
|
|
286
|
+
.actions { display: flex; gap: 8px; margin-top: 12px; }
|
|
287
|
+
.actions button {
|
|
288
|
+
flex: 1; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
|
|
289
|
+
height: 40px; padding: 0 12px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
|
|
290
|
+
}
|
|
291
|
+
.decline { border: 1px solid #fecdd3; background: #fff1f2; color: #be123c; }
|
|
292
|
+
.decline:hover { background: #ffe4e6; }
|
|
293
|
+
.open { border: none; background: #059669; color: #fff; }
|
|
294
|
+
.open:hover { background: #047857; }
|
|
295
|
+
.close { border: 1px solid #e2e8f0; background: #fff; color: #334155; }
|
|
296
|
+
.actions button:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }
|
|
297
|
+
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
|
|
298
|
+
@keyframes ping { from { transform: scale(1); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
|
|
299
|
+
@media (prefers-reduced-motion: reduce) { .card { animation: none; } .icon::after { animation: none; opacity: 0; } }
|
|
300
|
+
`,t8='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z"/></svg>',b=null,H0=null,B0=null;function e8(z,J){return z.replace("{key}",J.ticketKey).replace("{title}",J.ticketTitle)}var f1=()=>Y0(I().locale);function z5(){if(typeof document>"u")return null;if(b?.isConnected)return b.shadowRoot;b=document.createElement(s8),b.dataset.debugReporter="true";let z=b.attachShadow({mode:"open"});return b0(z),document.body.append(b),z}function B4(z,J){if(H0===z.id&&b?.isConnected)return;let $=z5();if(!$)return;H0=z.id;let j=f1();$.innerHTML="";let Q=document.createElement("style");Q.textContent=a8;let Z=document.createElement("div");Z.className="card",Z.setAttribute("role","alertdialog"),Z.setAttribute("aria-label",j.ringTitle),Z.dataset.lwCallRing=z.id;let W=document.createElement("div");W.className="head";let G=document.createElement("span");G.className="icon",G.innerHTML=t8;let P=document.createElement("div"),F=document.createElement("h2");F.textContent=j.ringTitle;let L=document.createElement("p");L.className="about",L.textContent=e8(j.ringAbout,z),L.title=L.textContent,P.append(F,L),W.append(G,P);let w=document.createElement("p");w.className="how",w.textContent=j.ringHow;let O=document.createElement("div");O.className="actions";let _=document.createElement("button");_.type="button",_.className="decline",_.textContent=j.ringDecline,_.dataset.lwRing="decline",_.onclick=()=>J.decline();let S=document.createElement("button");if(S.type="button",S.className="open",S.textContent=j.ringOpen,S.dataset.lwRing="open",S.onclick=()=>J.open(),O.append(_,S),Z.append(W,w,O),$.append(Q,Z),J5(),B0===null)B0=document.title,document.title=`${j.ringTab} — ${B0}`;S.focus({preventScroll:!0})}function X1(z){let J=b?.shadowRoot;if(!J)return;b1(),C4();let $=f1(),j=J.querySelector(".how"),Q=J.querySelector(".actions");if(j)if(j.textContent="",z){let Z=document.createElement("a");Z.href=z,Z.target="_blank",Z.rel="noopener",Z.textContent=$.ringBlocked,Z.dataset.lwRing="link",Z.onclick=()=>window.setTimeout(()=>X1(),0),j.append(Z)}else j.textContent=$.ringOpened;if(Q){Q.innerHTML="";let Z=document.createElement("button");Z.type="button",Z.className="close",Z.textContent=$.ringClose,Z.dataset.lwRing="close",Z.onclick=()=>x0(),Q.append(Z)}}function h1(z,J=!0){if(!b?.isConnected||H0!==z)return;b.style.display=J?"none":""}function x0(z){if(z&&H0&&z!==H0)return;b1(),C4(),b?.remove(),b=null,H0=null}function x4(){return b?.isConnected?H0:null}function C4(){if(B0===null||typeof document>"u")return;if(document.title.startsWith(f1().ringTab))document.title=B0;B0=null}var j0=null,E1;function J5(){b1();let z=window,J=z.AudioContext??z.webkitAudioContext;if(!J)return;try{let j=j0??new J;j0=j,j.resume?.().catch(()=>{return})}catch{return}let $=()=>{if(!j0||j0.state!=="running")return;let j=j0.currentTime;for(let[Q,Z]of[660,880].entries()){let W=j0.createOscillator(),G=j0.createGain();W.frequency.value=Z,G.gain.setValueAtTime(0.0001,j+Q*0.22),G.gain.exponentialRampToValueAtTime(0.08,j+Q*0.22+0.02),G.gain.exponentialRampToValueAtTime(0.0001,j+Q*0.22+0.2),W.connect(G).connect(j0.destination),W.start(j+Q*0.22),W.stop(j+Q*0.22+0.21)}};$(),E1=setInterval($,2200)}function b1(){clearInterval(E1),E1=void 0}var Z0=null,k=null,K1=null,v1="",g0=null,v0="card",y1={width:368,height:0},p1,m1=!1,V0=null,Q0=null,g1="lw-call-frame-place";function O4(z,J,$,j){let Q=new URL("embed/call",z.endsWith("/")?z:`${z}/`);return Q.searchParams.set("realm",J),Q.searchParams.set("token",$),Q.searchParams.set("call",j),Q.toString()}function w4(z,J,$){return{x:Math.min(Math.max(z.x,8),Math.max(8,$.w-J.w-8)),y:Math.min(Math.max(z.y,8),Math.max(8,$.h-J.h-8))}}function $5(z,J){if(z.origin!==J.origin||z.source!==J.window)return null;let $=z.data;return $&&typeof $==="object"&&$.source==="lw-call"&&typeof $.type==="string"?$:null}function y0(){return Z0?.isConnected?K1:null}function _4(z,J,$,j=15000){if(typeof document>"u")return;if(K1===J&&Z0?.isConnected)return;p0(),K1=J,g0=$,m1=!1,v0="card",y1={width:368,height:0},v1=new URL(z).origin;try{V0=JSON.parse(sessionStorage.getItem(g1)??"null")}catch{V0=null}Z0=document.createElement("lw-call-frame"),Z0.dataset.debugReporter="true";let Q=Z0.attachShadow({mode:"open"}),Z=document.createElement("style");Z.textContent=`:host { all: initial; }
|
|
301
|
+
iframe { position: fixed; z-index: 2147483003; border: 0; background: transparent; color-scheme: normal; visibility: hidden; }
|
|
302
|
+
iframe.on { visibility: visible; }`,k=document.createElement("iframe"),k.allow="microphone; camera; display-capture; autoplay; clipboard-write; fullscreen",k.title="สายจากทีมงาน",k.dataset.lwCallFrame=J,k.setAttribute("allowtransparency","true"),k.src=z,Q.append(Z,k),document.body.append(Z0),C0(),window.addEventListener("message",R4),window.addEventListener("resize",C0),p1=setTimeout(()=>{if(!m1)S4("timeout")},j)}function p0(){clearTimeout(p1),window.removeEventListener("message",R4),window.removeEventListener("resize",C0),Z0?.remove(),Z0=null,k=null,K1=null,g0=null,Q0=null}function S4(z){let J=g0;p0(),J?.failed(z)}function R4(z){if(!k)return;let J=$5(z,{origin:v1,window:k.contentWindow});if(!J)return;switch(J.type){case"ready":m1=!0,clearTimeout(p1),k.classList.add("on"),g0?.ready();return;case"size":if(typeof J.width==="number"&&typeof J.height==="number")y1={width:J.width,height:J.height};if(J.layout==="card"||J.layout==="full"){if(J.layout==="full"&&v0==="card")Q5();v0=J.layout}return C0();case"drag":return j5(J);case"home":return V0=null,L4(),C0();case"done":{let $=g0;p0(),$?.done();return}case"failed":return S4(J.reason??"failed")}}function j5(z){if(!k||v0!=="card"||typeof z.x!=="number"||typeof z.y!=="number")return;if(z.phase==="start"){let J=k.getBoundingClientRect();Q0={sx:z.x,sy:z.y,x:J.left,y:J.top};return}if(!Q0)return;if(V0=w4({x:Q0.x+(z.x-Q0.sx),y:Q0.y+(z.y-Q0.sy)},A4(),G1()),C0(),z.phase==="end")Q0=null,L4()}function Q5(){if(!k?.contentWindow)return;let z=k.getBoundingClientRect();k.contentWindow.postMessage({source:"lw-call-host",type:"corner",x:Math.round(z.left),y:Math.round(z.top),width:Math.round(z.width)},v1)}function L4(){try{if(V0)sessionStorage.setItem(g1,JSON.stringify(V0));else sessionStorage.removeItem(g1)}catch{}}var G1=()=>({w:window.innerWidth,h:window.innerHeight});function A4(){let z=G1();return{w:Math.min(368,z.w-16),h:Math.min(y1.height||0,z.h-16)}}function C0(){if(!k)return;let z=k.style;if(v0==="full"){Object.assign(z,{left:"0px",top:"0px",right:"",bottom:"",width:"100vw",height:"100vh"});return}let J=A4(),$=G1().w<480;if(z.width=$?"calc(100vw - 16px)":`${J.w}px`,z.height=`${J.h}px`,V0&&!$){let j=w4(V0,J,G1());Object.assign(z,{left:`${j.x}px`,top:`${j.y}px`,right:"",bottom:""})}else Object.assign(z,{left:$?"8px":"",top:"",right:$?"":"8px",bottom:"8px"})}var Y1=[2000,5000,15000,30000,60000],Z5=new Set(["ringing","active"]),V5=20000,k4=!1,O0=!1,T4=0,W5=5,u1=null,m4=0,d1,E4,f4,g4=(z)=>z.endsWith("/")?z:`${z}/`;function X5(z,J){let $=new URL("api/presence/ws",g4(z));return $.protocol=$.protocol==="https:"?"wss:":"ws:",$.searchParams.set("t",J),$.toString()}function K5(z){return`/me/tickets/${z.ticketId}?call=${z.id}`}function G5(z){return z.status==="ringing"&&(z.side==="reporter"||z.side===void 0||z.side===null)}async function P1(){let z=I().identity;if(!z)return null;try{return await z()??null}catch{return null}}async function l1(z,J){let $=I();return fetch(new URL(z,g4($.host)).toString(),{method:"POST",headers:{"content-type":"application/json","x-realm-key":$.realmKey,authorization:`Bearer ${J}`},body:"{}"})}function o1(){if(k4||typeof window>"u"||typeof WebSocket>"u")return;let z=I();if(!z.identity||z.ring===!1)return;k4=!0,O0=!1,v4()}function u0(z=!1){if(O0)return;let J=z?Y1[Y1.length-1]:Y1[Math.min(m4++,Y1.length-1)];clearTimeout(E4),E4=setTimeout(()=>void v4(),J)}async function v4(){if(O0)return;let z=await P1();if(!z){if(++T4>=W5){O0=!0;return}return u0(!0)}T4=0;let J;try{J=await l1("ingest/live-ticket",z)}catch{return u0()}if(J.status===401||J.status===404||J.status===403){O0=!0;return}if(!J.ok)return u0(J.status===429);let $;try{$=await J.json()}catch{return u0()}if(!$.calls||!$.ticket){O0=!0;return}if($.call)b4($.call);let j=new WebSocket(X5(I().host,$.ticket));u1=j,j.onopen=()=>{m4=0,clearInterval(d1),d1=setInterval(()=>{if(j.readyState===WebSocket.OPEN)j.send(JSON.stringify({type:"ping"}))},V5)},j.onmessage=(Q)=>{try{let Z=JSON.parse(String(Q.data));if(Z.type==="call-state"&&Z.call)b4(Z.call)}catch{}},j.onclose=()=>{if(clearInterval(d1),u1===j)u1=null;u0()}}var c1="lw-call-framed";function Y5(){try{return sessionStorage.getItem(c1)}catch{return null}}function H1(z){try{if(z)sessionStorage.setItem(c1,z);else sessionStorage.removeItem(c1)}catch{}}var i1=null;async function h4(z){let J=I();if(J.callFrame===!1||y0()===z.id||i1===z.id)return;i1=z.id;let $=await P1();if(i1=null,!$)return;H1(z.id),_4(O4(J.host,J.realmKey,$,z.id),z.id,{ready:()=>h1(z.id),done:()=>{H1(null),x0(z.id)},failed:()=>{H1(null),h1(z.id,!1)}})}function b4(z){if(!G5(z)){if(x0(z.id),z.status==="active"&&Y5()===z.id&&!y0())h4(z);if(!Z5.has(z.status)&&y0()===z.id)setTimeout(()=>{if(y0()===z.id)p0(),H1(null)},12000);return}B4(z,{open:()=>H5(z),decline:()=>void P5(z)}),h4(z),clearTimeout(f4);let J=new Date(z.ringUntil).getTime()-Date.now();f4=setTimeout(()=>{if(x4()===z.id)x0(z.id)},Math.max(5000,J+5000))}function H5(z){let J=window.open("about:blank","_blank");(async()=>{let $=await P1();if($)l1(`ingest/calls/${z.id}/coming`,$).catch(()=>{return});let j;try{j=await N4(K5(z))}catch{J?.close();return}if(J&&!J.closed){J.location.href=j;try{J.opener=null}catch{}X1()}else X1(j)})()}async function P5(z){x0(z.id);let J=await P1();if(J)await l1(`ingest/calls/${z.id}/decline`,J).catch(()=>{return})}var y4=!1;function n1(z={}){if(y4||typeof window>"u")return;if(!c0()){console.error("[debug-capture] configureDebugCapture() must be called before install");return}if(y4=!0,m2(),M2(),G2(),R2(),u2(),z.ui===!1)return;let J=Y0(I().locale);if(C2((j)=>{I0(j.message??J.crashed,"error",{label:J.crashAction,onClick:()=>a0(j)})}),D4(),!document.querySelector(m0))document.body.append(document.createElement(m0));let $=window.requestIdleCallback;if($)$(()=>void N0(),{timeout:5000});else setTimeout(()=>void N0(),2000);if($)$(()=>o1(),{timeout:8000});else setTimeout(()=>o1(),3000)}var p4=document.currentScript,p=p4?.dataset??{},U5="rrweb-record.mjs";p2(()=>import(new URL(U5,p4?.src??location.href).href));function F5(z){if(!z)return{};try{let J=JSON.parse(z);if(!J||typeof J!=="object"||Array.isArray(J))return{};return Object.fromEntries(Object.entries(J).filter(([,$])=>typeof $==="string"&&$.trim()))}catch{return{}}}if(p.host&&p.realmKey)if(s1({host:p.host,realmKey:p.realmKey,app:{name:p.appName??document.title??"app",version:p.appVersion??"0.0.0",environment:p.environment??"production"},module:e1(F5(p.modules)),locale:p.locale==="en"?"en":"th",...p.replay!==void 0?{replay:{seconds:Number(p.replay)||void 0}}:{}}),document.body)n1();else document.addEventListener("DOMContentLoaded",()=>n1(),{once:!0});window.lwReportProblem=a0;})();
|